I've done a patch for gnome-python to add GOption support[1].  Using the
existing GOptionContext wrapper in pygobject this is possible but access
to the wrapped GOptionContext pointer is required to pass to
gnome_program_init.

I'd be grateful to know whether cobjects are a good way of doing this
per http://bugzilla.gnome.org/attachment.cgi?id=117380&action=view -
included inline here because it is quite short:


--- glib/pygoptioncontext.c     (revision 949)
+++ glib/pygoptioncontext.c     (working copy)
@@ -281,6 +281,12 @@
     return -1;
 }
 
+static PyObject *
+pyg_option_get_context(PyGOptionContext *self)
+{
+    return PyCObject_FromVoidPtr(self->context, NULL);
+}
+
 static PyMethodDef pyg_option_context_methods[] = {
     { "parse", (PyCFunction)pyg_option_context_parse, METH_VARARGS | 
METH_KEYWORDS },
     { "set_help_enabled", (PyCFunction)pyg_option_context_set_help_enabled, 
METH_VARARGS | METH_KEYWORDS },
@@ -290,6 +296,7 @@
     { "set_main_group", (PyCFunction)pyg_option_context_set_main_group, 
METH_VARARGS | METH_KEYWORDS },
     { "get_main_group", (PyCFunction)pyg_option_context_get_main_group, 
METH_NOARGS },
     { "add_group", (PyCFunction)pyg_option_context_add_group, METH_VARARGS | 
METH_KEYWORDS },
+    { "_get_context", (PyCFunction)pyg_option_get_context, METH_NOARGS },
     { NULL, NULL, 0 },
 };
 



[1] http://bugzilla.gnome.org/show_bug.cgi?id=507174

_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to