summaryrefslogtreecommitdiff
path: root/gtk/gtk.override
diff options
context:
space:
mode:
authorJoe Shaw <joe@ximian.com>2002-11-20 16:16:56 +0000
committerJoe Shaw <joeshaw@src.gnome.org>2002-11-20 16:16:56 +0000
commit775bd0e1296db83b39c62ef290300d0b601a5ffc (patch)
tree98fc971c3c666fbaf60de7eb02cb1100a93af6b8 /gtk/gtk.override
parentf50abb5faff64aa02dc2c69608e34196a3e0d576 (diff)
downloadpygtk-775bd0e1296db83b39c62ef290300d0b601a5ffc.tar.gz
Added. Fixes #97963.
2002-11-20 Joe Shaw <joe@ximian.com> * gtk.override (_wrap_gtk_menu_attach_to_widget): Added. Fixes #97963. * pygtktreemodel.c: Add wrap all calls to PyObject_CallMethod() in pyg_block_threads() and pyg_unblock_threads(). Fixes #98344.
Diffstat (limited to 'gtk/gtk.override')
-rw-r--r--gtk/gtk.override66
1 files changed, 65 insertions, 1 deletions
diff --git a/gtk/gtk.override b/gtk/gtk.override
index aac44d76..54ebaaa6 100644
--- a/gtk/gtk.override
+++ b/gtk/gtk.override
@@ -3278,7 +3278,6 @@ ignore
gtk_item_factory_set_translate_func
gtk_item_factory_create_items_ac
gtk_item_factory_create_menu_entries
- gtk_menu_attach_to_widget
gtk_menu_bar_append
gtk_menu_bar_insert
gtk_menu_bar_prepend
@@ -3807,6 +3806,71 @@ _wrap_gtk_menu_item_new(PyGObject *self, PyObject *args, PyObject *kwargs)
return 0;
}
%%
+override gtk_menu_attach_to_widget kwargs
+static void
+pygtk_menu_detach (GtkWidget *attach_widget, GtkMenu *menu)
+{
+ PyObject *func;
+ PyObject *ret;
+
+ func = g_object_get_data (G_OBJECT (menu), "pygtk_menu_detach_func");
+
+ if (!func)
+ return;
+
+ pyg_block_threads ();
+ ret = PyObject_CallFunction (func, "OO",
+ pygobject_new ((GObject *) menu),
+ pygobject_new ((GObject *) attach_widget));
+ pyg_unblock_threads ();
+
+ if (ret == NULL) {
+ PyErr_Print ();
+ PyErr_Clear ();
+ Py_XDECREF (ret);
+ }
+ else
+ Py_DECREF (ret);
+}
+static PyObject *
+_wrap_gtk_menu_attach_to_widget (PyGObject *self, PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "attach_widget", "detach_func", NULL };
+ PyGObject *py_attach_widget;
+ PyObject *detach_func;
+ GtkWidget *attach_widget;
+
+ if (!PyArg_ParseTupleAndKeywords (args, kwargs,
+ "O!O:GtkMenu.attach_to_widget",
+ kwlist, &PyGtkWidget_Type,
+ &py_attach_widget, &detach_func))
+ return NULL;
+
+ attach_widget = GTK_WIDGET (py_attach_widget->obj);
+
+ if (!PyCallable_Check (detach_func) && detach_func != Py_None) {
+ PyErr_SetString (PyExc_TypeError, "second argument not callable");
+ return NULL;
+ }
+
+ if (detach_func != Py_None) {
+ Py_INCREF (detach_func);
+ g_object_set_data_full (self->obj,
+ "pygtk_menu_detach_func",
+ detach_func,
+ pyg_destroy_notify);
+ }
+ else
+ g_object_set_data (self->obj, "pygtk_menu_detach_func", NULL);
+
+ gtk_menu_attach_to_widget (GTK_MENU (self->obj), attach_widget,
+ (GtkMenuDetachFunc) pygtk_menu_detach);
+
+ Py_INCREF (Py_None);
+ return Py_None;
+}
+%%
ignore gtk_check_menu_item_new_with_label gtk_check_menu_item_new_with_mnemonic
%%
override gtk_check_menu_item_new kwargs