summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>2001-10-05 19:50:52 +0000
committerMatt Wilson <msw@src.gnome.org>2001-10-05 19:50:52 +0000
commit235393696e6f58c8fe2b5a0e3c0d6ba43f374455 (patch)
treed18d415643d8ac686223cdb2399238278d14f473
parentfdbf043ba87e601b741623aa9d3de46be375dedb (diff)
downloadpygtk-235393696e6f58c8fe2b5a0e3c0d6ba43f374455.tar.gz
implemented function to return the selection.
2001-10-05 Matt Wilson <msw@redhat.com> * gtk/gtk.override (_wrap_gtk_list__get_selection): implemented function to return the selection. (_wrap_gtk_list_get_selection): use above to implement a method for getting the selection, like old pygtk. * gtk/gtk.defs (GtkList.get_selection): added function to be compatible with previous versions. (GtkList): added "selection" field
-rw-r--r--ChangeLog9
-rw-r--r--gtk/gtk.defs9
-rw-r--r--gtk/gtk.override37
3 files changed, 54 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index ff93d2cc..e350c2c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2001-10-05 Matt Wilson <msw@redhat.com>
+ * gtk/gtk.override (_wrap_gtk_list__get_selection): implemented
+ function to return the selection.
+ (_wrap_gtk_list_get_selection): use above to implement a method
+ for getting the selection, like old pygtk.
+
+ * gtk/gtk.defs (GtkList.get_selection): added function to be
+ compatible with previous versions.
+ (GtkList): added "selection" field
+
* gobjectmodule.c (pyg_closure_new): too many tuples.
2001-10-05 Matt Wilson <msw@redhat.com>
diff --git a/gtk/gtk.defs b/gtk/gtk.defs
index 44461ae1..8b42ab3a 100644
--- a/gtk/gtk.defs
+++ b/gtk/gtk.defs
@@ -549,6 +549,9 @@
(parent "GtkContainer")
(c-name "GtkList")
(gtype-id "GTK_TYPE_LIST")
+ (fields
+ '("GList*" "selection")
+ )
)
(define-object Layout
@@ -7926,7 +7929,11 @@
(return-type "none")
)
-
+(define-method get_selection
+ (of-object "GtkList")
+ (c-name "gtk_list_get_selection")
+ (return-type "GList*")
+)
;; From /opt/gtk2/include/gtk-2.0/gtk/gtklistitem.h
diff --git a/gtk/gtk.override b/gtk/gtk.override
index 293cf509..4aa8f1ca 100644
--- a/gtk/gtk.override
+++ b/gtk/gtk.override
@@ -3217,6 +3217,43 @@ _wrap_gtk_list_remove_items(PyGObject *self, PyObject *args,
%%
ignore gtk_list_remove_items_no_unref
%%
+override-attr GtkList.selection
+static PyObject *
+_wrap_gtk_list__get_selection(PyGObject *self, void *closure)
+{
+ guint row;
+ GList *selection;
+ PyObject *item, *ret = PyList_New(0);
+
+ if (ret == NULL)
+ return NULL;
+
+ for (selection = GTK_LIST(self->obj)->selection; selection != NULL;
+ selection = selection->next) {
+ item = pygobject_new((GObject *) GTK_LIST_ITEM(selection->data));
+
+ if (!item) {
+ Py_DECREF(ret);
+ return NULL;
+ }
+
+ PyList_Append(ret, item);
+ Py_DECREF(item);
+ }
+ return ret;
+}
+%%
+override gtk_list_get_selection
+static PyObject *
+_wrap_gtk_list__get_selection(PyGObject *self, void *closure);
+static PyObject *
+_wrap_gtk_list_get_selection(PyGObject *self, PyObject *args)
+{
+ if (!PyArg_ParseTuple(args, ":GtkList.get_selection"))
+ return NULL;
+ return _wrap_gtk_list__get_selection(self, NULL);
+}
+%%
override gtk_color_selection_get_current_color
static PyObject *
_wrap_gtk_color_selection_get_current_color(PyGObject *self, PyObject *args)