[mlview-list][patch] delete attributes with Del key
- From: Sebastien Bacher <seb128 debian org>
- To: mlview-list gnome org
- Subject: [mlview-list][patch] delete attributes with Del key
- Date: Sat, 31 Jan 2004 20:59:17 +0100
Hi,
With this patch it's possible to delete an attribute by pressing the Del
key. It's a part of the wishlist #132700.
All the comments are welcome, it's my first patch for mlview ... :)
Cheers,
Sebastien
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/mlview/ChangeLog,v
retrieving revision 1.217
diff -u -r1.217 ChangeLog
--- ChangeLog 29 Jan 2004 10:04:35 -0000 1.217
+++ ChangeLog 31 Jan 2004 19:52:45 -0000
@@ -1,3 +1,9 @@
+2004-01-31 Sebastien Bacher <seb128 debian org>
+
+ * src/mlview-attrs-editor.c: (mlview_attrs_editor_construct),
+ (tree_key_press_cb): allow to delete the selected attribute by pressing
+ the Del key in the list of the attributes.
+
2004-01-29 Kjartan Maraas <kmaraas gnome org>
* configure.in: Added "no" to ALL_LINGUAS.
Index: src/mlview-attrs-editor.c
===================================================================
RCS file: /cvs/gnome/mlview/src/mlview-attrs-editor.c,v
retrieving revision 1.21
diff -u -r1.21 mlview-attrs-editor.c
--- src/mlview-attrs-editor.c 21 Dec 2003 21:46:56 -0000 1.21
+++ src/mlview-attrs-editor.c 31 Jan 2004 19:53:08 -0000
@@ -30,6 +30,7 @@
#include "mlview-attrs-editor.h"
#include "mlview-attribute-picker.h"
#include "mlview-marshal.h"
+#include <gdk/gdkkeysyms.h>
/**
* file
@@ -149,6 +150,11 @@
xmlAttr *a_attr,
MlViewAttrsEditor *a_editor) ;
+static gboolean
+tree_key_press_cb (GtkTreeView *a_tree,
+ GdkEventKey *a_event,
+ MlViewAttrsEditor *a_this);
+
/*
*Mandatory private functions to comply with the gtk object
*framework. go to http://www.gtk.org/tutorial/sec-theanatomyofawidget.html
@@ -257,6 +263,11 @@
(PRIVATE (a_this)->model)) ;
g_return_if_fail (PRIVATE (a_this)->attrs_view) ;
+ g_signal_connect (G_OBJECT (PRIVATE (a_this)->attrs_view),
+ "key_press_event",
+ G_CALLBACK (tree_key_press_cb),
+ a_this) ;
+
selection = gtk_tree_view_get_selection
(PRIVATE (a_this)->attrs_view) ;
g_return_if_fail (selection) ;
@@ -821,6 +832,34 @@
}
}
+
+/**
+ *callback for key_press_event in the attributes treeview
+ *remove the selected attribute if DEL key is pressed
+ */
+
+static gboolean
+tree_key_press_cb (GtkTreeView *a_tree,
+ GdkEventKey *a_event,
+ MlViewAttrsEditor *a_this)
+{
+ enum MlViewStatus status = MLVIEW_OK ;
+ GtkTreeIter iter = {0} ;
+
+ g_return_val_if_fail (a_tree && a_event && a_this, FALSE) ;
+
+ status = mlview_attrs_editor_get_cur_sel_iter(a_this, &iter);
+ if(status != MLVIEW_OK)
+ return FALSE ;
+
+ if (a_event->keyval == GDK_Delete) {
+ mlview_attrs_editor_remove_attribute (a_this, &iter) ;
+ return TRUE ;
+ }
+
+ return FALSE ;
+}
+
/************************
*public methods *
************************/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]