Re: cannot create gtksourcestylesheme interface

From: Date: Thu, 19 Apr 2007 15:17:05 +0000
Subject: Re: cannot create gtksourcestylesheme interface
Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-3799@lists.php.net to get a copy of this message
Hello, I'm running into the same problem. I have a GtkTreeView that I was using a GtkListStore model with. However, for quick searching in the list I wrapped the GtkListStore in a GtkTreeModelFilter. The problem, of course, is that GtkTreeModelFilter implements GtkTreeModel but not GtkTreeSortable, effectively hiding the sorting capability of the GtkListStore. So I tried a simple class to tie them together and pass the sortable methods through to the underlying model. ---------- <?php class LyrGtkTreeModelFilterSortable extends GtkTreeModelFilter implements GtkTreeSortable { public function get_sort_column_id() { return $this->get_model()->get_sort_column_id(); } public function has_default_sort_func() { return $this->get_model()->has_default_sort_func(); } public function set_default_sort_func($callback) { $this->get_model()->set_default_sort_func($callback); } public function set_sort_column_id($column_id,$order) { $this->get_model()->set_sort_column_id($column_id,$order); } public function set_sort_func($column,$callback) { $this->get_model()->set_sort_func($column, $callback); } public function sort_column_changed() { $this->get_model()->sort_column_changed(); } } ?> ---------- This dies with the same error mentioned by Christian. ---------- Fatal error: Cannot inherit previously-inherited constant gtype from interface GtkTreeSortable ---------- Although it says fixed in 5.1, the main PHP bug list had a very similar issue: http://bugs.php.net/bug.php?id=33732 My build is PHP 5.2 and PHP-GTK from CVS, checked out roughly a month ago. Thanks. -Jake Cobb * *>Christian, you find the best (obscure) bugs. This one was rather non-
trivial. I committed a fix, but I do need you and others to test areas in PHP-GTK related to interfaces, including tree models. Also, test GdkGC stuff (creating and getting them).
If you're curious about what the problem was.. readon. When get_style_scheme() is called, it dynamically creates a class called GtkSourceDefaultStyleScheme that implements the GtkSourceStyleScheme interface. Since both the class and the interface had 'gtype' constant registered, there was a conflict. So now, we don't register 'gtype' for interfaces. However, that uncovered another problem. If you implement an interface, the method in the class is marked as abstract (since there's no implementation for this dynamic class). But the interface supplies default implementation, so we need to get to that somehow. This necessitated changing how we register interface methods and also required unsetting the abstract flag on inherited methods and class itself. So that's why I'm asking for more testing in these areas.
-Andrei
On Feb 3, 2007, at 6:46 AM, Christian Weiske wrote:
Hi all, trying this: <?php $gslm = new GtkSourceLanguagesManager(); $gsl = $gslm->get_language_from_mime_type('application/x-php'); $schema = $gsl->get_style_scheme(); ?> I get -------------- Fatal error: Cannot inherit previously-inherited constant gtype from interface GtkSourceStyleScheme -------------- I don't know what to do with it nor how to fix it.. -- Regards/Mit freundlichen Grüßen Christian Weiske


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