diff options
author | John Finlay <finlay@src.gnome.org> | 2004-04-13 01:11:38 +0000 |
---|---|---|
committer | John Finlay <finlay@src.gnome.org> | 2004-04-13 01:11:38 +0000 |
commit | 9734fd05a5dc8622e714bbce932a1fdd2cbccedc (patch) | |
tree | d3b34e361bac396d29b55be6e283687569c83e7a /gtk | |
parent | e8ab41642c1c38c3edc143021ca3e763ae74e7b1 (diff) | |
download | pygtk-9734fd05a5dc8622e714bbce932a1fdd2cbccedc.tar.gz |
gtk/gtk.override (_wrap_gtk_action_group_add_radio_actions) Fix bugs in
* gtk/gtk.override (_wrap_gtk_action_group_add_radio_actions) Fix
bugs in connecting callback to first radio action.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtk.override | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/gtk/gtk.override b/gtk/gtk.override index ed957870..80724a1c 100644 --- a/gtk/gtk.override +++ b/gtk/gtk.override @@ -3978,7 +3978,7 @@ _wrap_gtk_action_group_add_radio_actions (PyGObject *self, PyObject *args, PyObject *item; GtkRadioActionEntry entry; GtkRadioAction *action, *first_action = NULL; - PyObject *callback = Py_None, *py_action; + PyObject *callback = Py_None; GClosure *closure; GSList * group = NULL; gint value = 0; @@ -4017,28 +4017,30 @@ _wrap_gtk_action_group_add_radio_actions (PyGObject *self, PyObject *args, return NULL; } - if (i == 0) - first_action = action; - gtk_radio_action_set_group(action, group); group = gtk_radio_action_get_group(action); if (value == entry.value) gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE); - py_action = pygobject_new((GObject *)action); gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP(self->obj), GTK_ACTION(action), entry.accelerator); - g_object_unref (action); - + if (i == 0) + first_action = action; + else + g_object_unref (action); } - if (callback != Py_None && PyCallable_Check(callback)) { + if (first_action && callback != Py_None && PyCallable_Check(callback)) { + PyObject *py_action; + closure = pyg_closure_new(callback, NULL, NULL); g_signal_connect_closure(first_action, "changed", closure, FALSE); + py_action = pygobject_new((GObject *)first_action); pygobject_watch_closure(py_action, closure); + g_object_unref(first_action); } Py_INCREF(Py_None); |