Re: GtkTreeView get_cursor patch

From: Date: Tue, 28 Feb 2006 20:45:58 +0000
Subject: Re: GtkTreeView get_cursor patch
References: 1 2 3 4  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-2463@lists.php.net to get a copy of this message
Andrei, Upon further inspection, it looks like it may be partially the fault of my PHP code, I just want to check. Basically, between get_cursor calls, I'm calling $treeview->set_model(&new GtkListStore(Gtk::TYPE_STRING)); Looks like that clears out any cursor selection on the treeview, and get_cursor returns a NULL path. Next time it's called like that, it segfaults, so it seems the set_model doesn't set any keyboard focus information on the treeview. Adam On Feb 27, 2006, at 8:24 PM, Andrei Zmievski wrote:
Can you please provide a small script reproducing the problem? I tried calling the function several times and it works. -Andrei On Feb 27, 2006, at 8:13 AM, Adam Lebsack wrote:
Andrei, That function is casing a segfault now.... After calling it a couple times, it just crashes the program. My version didn't do this, and I struggled to figure out why, but couldn't. That's probably why my code was a bit ugly. :) Got any ideas? Thanks, Adam On Feb 23, 2006, at 10:00 PM, Andrei Zmievski wrote:
Applied, with some modifications. -Andrei On Feb 14, 2006, at 8:57 AM, Adam Lebsack wrote:
Hey guys, 've been doing some development with php-gtk2 and I needed a function implemented, so I uhhh... implemented it. It's GtkTreeView::get_cursor. I've included the patch. Could we get this override into the CVS tree? Thanks! Adam Lebsack --- php-gtk/ext/gtk+/gtktreeview.overrides 2006-02-13 20:09:54.000000000 -0700 +++ php-gtk.patched/ext/gtk+/gtktreeview.overrides 2006-02-10 16:39:30.000000000 -0700 @@ -1020,6 +1020,32 @@ } %% +override gtk_tree_view_get_cursor +PHP_METHOD +{
+        GtkTreePath *path = NULL;
+        GtkTreeViewColumn *column = NULL;
+        zval *php_path = NULL, *php_column = NULL;
+
+        NOT_STATIC_METHOD();
+        gtk_tree_view_get_cursor(GTK_TREE_VIEW(PHPG_GOBJECT(this_ptr)), &path, &column);
+
+        array_init(return_value);
+        if (path) {
+                phpg_tree_path_to_zval(path, &php_path TSRMLS_CC);
+                phpg_gobject_new(&php_column, (GObject*)column TSRMLS_CC);
+
+                array_init(return_value);
+                add_next_index_zval(return_value, php_path);
+                add_next_index_zval(return_value, php_column);
+        } else {
+                RETURN_FALSE;
+                //MAKE_STD_ZVAL(php_path);
+                //MAKE_STD_ZVAL(php_column);
+        }
+} + +%% add-arginfo GtkTreeView get_path_at_pos static ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0) --PHP-GTK Development Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
--PHP-GTK Development Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.gtk.dev (#2463) next »