changeset 18682:254823d66aa5

The promised cleanups.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 28 Jul 2007 20:21:48 +0000
parents ef15236a0866
children 8000beb73585
files finch/libgnt/pygnt/common.h finch/libgnt/pygnt/example/rss/gntrss-ui.py finch/libgnt/pygnt/example/rss/gntrss.py finch/libgnt/pygnt/gntmodule.c finch/libgnt/pygnt/gnttree.override
diffstat 5 files changed, 31 insertions(+), 93 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/pygnt/common.h	Sat Jul 28 11:30:54 2007 +0000
+++ b/finch/libgnt/pygnt/common.h	Sat Jul 28 20:21:48 2007 +0000
@@ -3,5 +3,3 @@
 
 PyObject *create_pyobject_from_string_list(GList *list);
 
-PyObject *create_mygpointer(gpointer data);
-
--- a/finch/libgnt/pygnt/example/rss/gntrss-ui.py	Sat Jul 28 11:30:54 2007 +0000
+++ b/finch/libgnt/pygnt/example/rss/gntrss-ui.py	Sat Jul 28 20:21:48 2007 +0000
@@ -158,7 +158,6 @@
     details.scroll(0)
     if item.unread:
         item.set_property('unread', False)
-    win.give_focus_to_child(browser)
 
 #
 # Look for action keys in the feed-item list.
@@ -196,7 +195,8 @@
 
 win.add_widget(box)
 
-win.add_widget(gnt.Line(vertical = False))
+line = gnt.Line(vertical = False)
+win.add_widget(line)
 
 # The textview to show the details of a feed
 details = gnt.TextView()
@@ -217,6 +217,7 @@
 
 # populate everything
 for feed in gntrss.feeds:
+    feed.refresh()
     add_feed(feed)
 
 gnt.gnt_main()
--- a/finch/libgnt/pygnt/example/rss/gntrss.py	Sat Jul 28 11:30:54 2007 +0000
+++ b/finch/libgnt/pygnt/example/rss/gntrss.py	Sat Jul 28 20:21:48 2007 +0000
@@ -154,8 +154,7 @@
 feeds = []
 urls = ("http://rss.slashdot.org/Slashdot/slashdot",
         "http://www.python.org/channews.rdf",
-        "http://pidgin.im/rss.php",
-        "./rss.php"
+        "http://pidgin.im/rss.php"
         )
 
 for url in urls:
--- a/finch/libgnt/pygnt/gntmodule.c	Sat Jul 28 11:30:54 2007 +0000
+++ b/finch/libgnt/pygnt/gntmodule.c	Sat Jul 28 20:21:48 2007 +0000
@@ -1,62 +1,5 @@
 #include <pygobject.h>
  
-/* {{{ Wrapper for gpointer */
-
-typedef struct {
-	PyObject_HEAD
-	PyGPointer *data;
-} mygpointer;
-
-static PyObject *
-mygpointer_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-	mygpointer *self = (mygpointer*)type->tp_alloc(type, 0);
-	self->data = NULL;
-	return (PyObject*)self;
-}
-
-static const PyMethodDef mygpointer_methods[] = {
-	/*{"value", (PyCFunction)get_value, METH_NOARGS, NULL},*/
-	{NULL, NULL, 0, NULL}
-};
-
-static int
-mygpointer_init(mygpointer *self, PyObject *args, PyObject *kwds)
-{
-	static char *kwlist[] = {"data", NULL};
-	PyObject *data = NULL;
-
-	if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O", kwlist, 
-				&data))
-		return -1; 
-
-	Py_INCREF(data);
-	Py_DECREF(self->data);
-	self->data = data;
-
-	return 0;
-}
-
-static PyTypeObject mygpointer_type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	.tp_name = "gpointer",
-	.tp_basicsize = sizeof(mygpointer),
-	.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-	.tp_doc = "gpointer stuff",
-	.tp_members = NULL,
-	.tp_init = mygpointer_init,
-	.tp_new = mygpointer_new,
-	.tp_methods = mygpointer_methods
-};
-
-PyObject *create_mygpointer(gpointer data)
-{
-	mygpointer *p = mygpointer_new(&mygpointer_type, NULL, NULL);
-	p->data = data;
-	return (PyObject *)p;
-}
-/* }}} Wrapper for gpointer */
-
 void gnt_register_classes (PyObject *d); 
 extern PyMethodDef gnt_functions[];
  
@@ -67,9 +10,6 @@
  
     init_pygobject ();
 
-	if (PyType_Ready(&mygpointer_type) < 0)
-		return;
-
     m = Py_InitModule ("gnt", gnt_functions);
     d = PyModule_GetDict (m);
  
--- a/finch/libgnt/pygnt/gnttree.override	Sat Jul 28 11:30:54 2007 +0000
+++ b/finch/libgnt/pygnt/gnttree.override	Sat Jul 28 20:21:48 2007 +0000
@@ -20,7 +20,7 @@
  * USA
  */
 %%
-headrs
+headers
 #include "common.h"
 %%
 ignore 
@@ -63,7 +63,7 @@
 {
 	static char *kwlist[] = {"key", "row", "parent", "bigbro", NULL};
 	PyObject *py_list;
-	PyGObject *key, *parent, *bigbro;
+	gpointer key, parent, bigbro;
 	int len, i;
 	GList *list = NULL;
 	GntTreeRow *row;
@@ -116,49 +116,49 @@
 static PyObject *
 _wrap_gnt_tree_change_text(PyGObject *self, PyObject *args, PyObject *kwargs)
 {
-    static char *kwlist[] = { "key", "colno", "text", NULL };
-    char *text;
+	static char *kwlist[] = { "key", "colno", "text", NULL };
+	char *text;
 	int colno;
 	gpointer key;
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs,"Ois:GntTree.change_text", kwlist, &key, &colno, &text))
-        return NULL;
-    
-    gnt_tree_change_text(GNT_TREE(self->obj), key, colno, text);
-    
-    Py_INCREF(Py_None);
-    return Py_None;
+	if (!PyArg_ParseTupleAndKeywords(args, kwargs,"Ois:GntTree.change_text", kwlist, &key, &colno, &text))
+		return NULL;
+
+	gnt_tree_change_text(GNT_TREE(self->obj), key, colno, text);
+
+	Py_INCREF(Py_None);
+	return Py_None;
 }
 %%
 override gnt_tree_set_row_flags
 static PyObject *
 _wrap_gnt_tree_set_row_flags(PyGObject *self, PyObject *args, PyObject *kwargs)
 {
-    static char *kwlist[] = { "key", "flag", NULL };
+	static char *kwlist[] = { "key", "flag", NULL };
 	int flag;
 	gpointer key;
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs,"Oi:GntTree.set_row_flags", kwlist, &key, &flag))
-        return NULL;
-    
-    gnt_tree_set_row_flags(GNT_TREE(self->obj), key, flag);
-    
-    Py_INCREF(Py_None);
-    return Py_None;
+	if (!PyArg_ParseTupleAndKeywords(args, kwargs,"Oi:GntTree.set_row_flags", kwlist, &key, &flag))
+		return NULL;
+
+	gnt_tree_set_row_flags(GNT_TREE(self->obj), key, flag);
+
+	Py_INCREF(Py_None);
+	return Py_None;
 }
 %%
 override gnt_tree_remove
 static PyObject *
 _wrap_gnt_tree_remove(PyGObject *self, PyObject *args, PyObject *kwargs)
 {
-    static char *kwlist[] = { "key", NULL };
+	static char *kwlist[] = { "key", NULL };
 	gpointer key;
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:GntTree.remove", kwlist, &key))
-        return NULL;
-    
-    gnt_tree_remove(GNT_TREE(self->obj), key);
-    
-    Py_INCREF(Py_None);
-    return Py_None;
+	if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:GntTree.remove", kwlist, &key))
+		return NULL;
+
+	gnt_tree_remove(GNT_TREE(self->obj), key);
+
+	Py_INCREF(Py_None);
+	return Py_None;
 }