Hi.  I just added a wrapper for gtk_binding_entry_remove() to pygtk
cvs HEAD.  You should be able to solve your problem with this new
function.

  Regards.

A Sex, 2004-02-13 �s 20:28, Abel Daniel escreveu:
> How can I remove keybindings added with gtk.binding_entry_add_signal()?
> 
> I would like to make my app to have modes, a bit like the vi
> editor. Launching a mode would change some keybindings. I figured I
> can add the keybindings with gtk.binding_entry_add_signal() when the
> mode is started, but the problem is, how do I remove them when the
> user exits the mode?
-- 
Gustavo J. A. M. Carneiro
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
? docs/html
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-python/pygtk/ChangeLog,v
retrieving revision 1.701
diff -u -p -r1.701 ChangeLog
--- ChangeLog	10 Feb 2004 23:32:21 -0000	1.701
+++ ChangeLog	14 Feb 2004 13:04:29 -0000
@@ -1,3 +1,10 @@
+2004-02-14  Gustavo J. A. M. Carneiro  <[EMAIL PROTECTED]>
+
+	* gtk/gtk.override (_wrap_gtk_binding_entry_remove): impl.
+
+	* gtk/gtk.defs (binding_entry_remove): remove gtk_ prefix from
+	function name.
+
 2004-02-10  Seth Nickell  <[EMAIL PROTECTED]>
 
 	Reviewed by: random luser <[EMAIL PROTECTED]>
@@ -7,7 +14,6 @@
 	Change type of argument in signature for gdk.event_get_axis
 	from "d" to "i" so that get_axis works
 
-	
 2004-01-14  Johan Dahlin  <[EMAIL PROTECTED]>
 
 	* gtk/pygtktreemodel.c (pygtk_generic_tree_model_iter_n_children):
Index: gtk/gtk.defs
===================================================================
RCS file: /cvs/gnome/gnome-python/pygtk/gtk/gtk.defs,v
retrieving revision 1.136
diff -u -p -r1.136 gtk.defs
--- gtk/gtk.defs	18 Dec 2003 23:04:50 -0000	1.136
+++ gtk/gtk.defs	14 Feb 2004 13:04:35 -0000
@@ -679,7 +679,7 @@
   )
 )
 
-(define-function gtk_binding_entry_remove
+(define-function binding_entry_remove
   (c-name "gtk_binding_entry_remove")
   (return-type "none")
   (parameters
Index: gtk/gtk.override
===================================================================
RCS file: /cvs/gnome/gnome-python/pygtk/gtk/gtk.override,v
retrieving revision 1.217
diff -u -p -r1.217 gtk.override
--- gtk/gtk.override	22 Dec 2003 15:46:56 -0000	1.217
+++ gtk/gtk.override	14 Feb 2004 13:04:38 -0000
@@ -3583,3 +3583,33 @@ _wrap_gtk_color_selection_palette_to_str
 
     return ret;
 }
+
+%%
+override gtk_binding_entry_remove kwargs
+static PyObject *
+_wrap_gtk_binding_entry_remove(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+    static char *kwlist[] = { "class_type", "keyval", "modifiers", NULL };
+    int keyval;
+    PyObject *py_modifiers = NULL;
+    GdkModifierType modifiers;
+    PyObject *class;
+    GType class_type;
+    GtkBindingSet *bset = NULL;
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:gtk_binding_entry_remove",
+				     kwlist, &class, &keyval, &py_modifiers))
+        return NULL;
+    if (pyg_flags_get_value(GDK_TYPE_MODIFIER_TYPE, py_modifiers, (gint *)&modifiers))
+        return NULL;
+
+    class_type = pyg_type_from_object(class);
+    if (class_type == 0)
+        return NULL;
+
+    bset = gtk_binding_set_by_class(gtk_type_class(class_type));
+    gtk_binding_entry_remove(bset, keyval, modifiers);
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to