[Galago-commits] r2607 - in trunk/galago-gtk-python: . src
galago-commits at freedesktop.org
galago-commits at freedesktop.org
Fri Mar 17 00:30:13 PST 2006
Author: chipx86
Date: 2006-03-17 00:30:09 -0800 (Fri, 17 Mar 2006)
New Revision: 2607
Modified:
trunk/galago-gtk-python/ChangeLog
trunk/galago-gtk-python/src/Makefile.am
trunk/galago-gtk-python/src/galago-gtk.override
Log:
Wrapped a couple of unwrapped functions. We now have 100% coverage, technically.
Modified: trunk/galago-gtk-python/ChangeLog
===================================================================
--- trunk/galago-gtk-python/ChangeLog 2006-03-17 07:35:55 UTC (rev 2606)
+++ trunk/galago-gtk-python/ChangeLog 2006-03-17 08:30:09 UTC (rev 2607)
@@ -1,3 +1,10 @@
+Fri Mar 17 00:29:40 PST 2006 Christian Hammond <chipx86 at chipx86.com>
+
+ * src/galago-gtk.override:
+ * src/Makefile.am:
+ - Wrapped a couple of unwrapped functions. We now have 100% coverage,
+ technically.
+
Thu Mar 16 23:35:42 PST 2006 Christian Hammond <chipx86 at chipx86.com>
* src/galago-gtk.defs:
Modified: trunk/galago-gtk-python/src/Makefile.am
===================================================================
--- trunk/galago-gtk-python/src/Makefile.am 2006-03-17 07:35:55 UTC (rev 2606)
+++ trunk/galago-gtk-python/src/Makefile.am 2006-03-17 08:30:09 UTC (rev 2607)
@@ -34,11 +34,16 @@
DEFHEADERS = $(wildcard $(includedir)/libgalago-gtk/*.h)
update-defs:
- @python $(datadir)/pygtk/2.0/codegen/h2def.py $(DEFHEADERS) > galago-gtk.defs.tmp
- @sed -e 's/"const-Galago/"Galago/g' \
+ python $(datadir)/pygtk/2.0/codegen/h2def.py $(DEFHEADERS) > galago-gtk.defs.tmp \
+ && sed -i \
+ -e 's/"const-Galago/"Galago/g' \
-e 's/\(define-\(object\|method\|enum\)\) Gtk/\1 /g' \
-e 's/in-module "Galago"/in-module "GalagoGtk"/g' \
-e 's/GALAGO_TYPE_GTK/GALAGO_GTK_TYPE/g' \
- galago-gtk.defs.tmp > galago-gtk.defs
- @rm -f galago-gtk.defs.tmp
- @echo Definitions updated
+ galago-gtk.defs.tmp \
+ && (if test 1 -eq 2 -a -e galago-gtk.defs; then \
+ python $(datadir)/pygtk/2.0/codegen/mergedefs.py \
+ galago-gtk.defs.tmp galago-gtk.defs; \
+ fi) \
+ && mv galago-gtk.defs.tmp galago-gtk.defs \
+ && echo Definitions updated
Modified: trunk/galago-gtk-python/src/galago-gtk.override
===================================================================
--- trunk/galago-gtk-python/src/galago-gtk.override 2006-03-17 07:35:55 UTC (rev 2606)
+++ trunk/galago-gtk-python/src/galago-gtk.override 2006-03-17 08:30:09 UTC (rev 2607)
@@ -5,7 +5,7 @@
#include "pygobject.h"
static PyObject *
-pygalago_wrap_gobj_list(GList *list)
+wrap_gobj_list(GList *list)
{
GList *l;
PyObject *item, *ret;
@@ -33,8 +33,7 @@
}
GList *
-pygalago_unwrap_gobj_list(PyObject *py_items, PyTypeObject *type,
- gboolean *ok)
+unwrap_gobj_list(PyObject *py_items, PyTypeObject *type, gboolean *ok)
{
int len, i;
GList *items;
@@ -81,8 +80,143 @@
import gtk.TreeView as PyGtkTreeView_Type
import gtk.VBox as PyGtkVBox_Type
import gtk.Widget as PyGtkWidget_Type
+import gtk.Window as PyGtkWindow_Type
%%
ignore-glob
*_get_type
+ galago_gtk_contact_chooser_dialog_new_valist
%%
+override galago_gtk_service_list_set_valid_services
+static PyObject *
+_wrap_galago_gtk_service_list_set_valid_services(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "services", NULL };
+ PyObject *py_services = NULL;
+ GList *services;
+ gboolean ok;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!:GalagoGtkServiceList.set_valid_services:",
+ kwlist, &PyList_Type, &py_services))
+ {
+ return NULL;
+ }
+
+ services = unwrap_gobj_list(py_services, &PyGalagoService_Type, &ok);
+
+ if (!ok)
+ return NULL;
+
+ galago_gtk_service_list_set_valid_services(
+ GALAGO_GTK_SERVICE_LIST(self->obj), services);
+ g_list_free(services);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+%%
+override galago_gtk_contact_chooser_dialog_new
+static int
+_wrap_galago_gtk_contact_chooser_dialog_new(PyGObject *self, PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "title", "parent", "flags", "buttons", NULL };
+ gchar *title = NULL;
+ PyGObject *py_window = NULL;
+ PyObject *py_buttons = NULL;
+ PyObject *py_flags = NULL;
+ GalagoGtkContactChooserFlags flags =
+ GALAGO_GTK_CONTACT_CHOOSER_SELECT_CONTACTS;
+ GtkWindow *parent = NULL;
+ int len, i;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "|zOOO:GalagoGtkContactChooser.__init__",
+ kwlist, &title, &py_window, &py_flags,
+ &py_buttons))
+ {
+ return -1;
+ }
+
+ if (py_window == NULL || (PyObject *)py_window == Py_None)
+ parent = NULL;
+ else if (pygobject_check(py_window, &PyGtkWindow_Type))
+ parent = GTK_WINDOW(py_window->obj);
+ else
+ {
+ PyErr_SetString(PyExc_TypeError, "parent must be a GtkWindow or None");
+ return -1;
+ }
+
+ if (pyg_enum_get_value(GALAGO_GTK_TYPE_CONTACT_CHOOSER_FLAGS, py_flags,
+ (gint *)&flags))
+ return -1;
+
+ if (py_buttons == Py_None)
+ len = 0;
+ else if (PyTiple_Check(py_buttons))
+ len = PyTuple_Size(py_buttons);
+ else
+ {
+ PyErr_SetString(PyExc_TypeError,
+ "buttons must be a tuple containing text/response "
+ "pairs or None");
+ return -1;
+ }
+
+ if (len % 2)
+ {
+ PyErr_SetString(PyExc_RuntimeError,
+ "buttons tuple must contain text/response id pairs");
+ return -1;
+ }
+
+ pygobject_construct(self,
+ "title", title,
+ NULL);
+
+ if (self->obj == NULL)
+ {
+ PyErr_SetString(PyExc_RuntimeError,
+ "could not create GalagoGtkContactChooserDialog object");
+ return -1;
+ }
+
+ if (parent != NULL)
+ gtk_window_set_transient_for(GTK_WINDOW(self->obj), parent);
+
+ for (i = 0; i < len; i += 2)
+ {
+ PyObject *text = PyTuple_GetItem(py_buttons, i);
+ PyObject *id = PyTuple_GetItem(py_buttons, i + 1);
+
+ if (!PyString_Check(text))
+ {
+ gtk_object_destroy(GTK_OBJECT(self->obj));
+ self->obj = NULL;
+ PyErr_SetString(PyExc_RuntimeError,
+ "first member of each text/response id pair "
+ "must be a string");
+ return -1;
+ }
+
+ if (!PyInt_Check(id))
+ {
+ gtk_object_destroy(GTK_OBJECT(self->obj));
+ self->obj = NULL;
+ PyErr_SetString(PyExc_RuntimeError,
+ "second member of each text/response id pair "
+ "must be a number");
+ return -1;
+ }
+
+ gtk_dialog_add_button(GTK_DIALOG(self->obj), PyString_AsString(text),
+ PyInt_AsLong(id));
+ }
+
+ g_object_ref(self->obj);
+}
+%%
// vim: ft=c
More information about the galago-commits
mailing list