Fw: [php-gtk-cvs] cvs: php-gtk /ext/libglade libglade.overrides

From: Date: Sun, 16 Oct 2005 23:30:38 +0000
Subject: Fw: [php-gtk-cvs] cvs: php-gtk /ext/libglade libglade.overrides
Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-1844@lists.php.net to get a copy of this message
Andrei, hi, Can't find you on irc. I wanted to say, I'm not happy about the hardcoded value part (at all) but the only option I can see right now is to force everyone to use two parameters for the constructor. At least this way we can doc it saying 'if you changed your root element you'll need to add its name as a parameter'. It's NOT okay to have NULL for the second parameter, even though it says it is in libglade docs and source. Do it this way, and most users can forget about it altogether. I can't see a way to determine the name of the root just from the libglade object within GTK+. It's probably more straightforward in PHP internals... nuts tho' it seems... - Steph ----- Original Message ----- From: "Steph" <sfox@php.net> To: <php-gtk-cvs@lists.php.net> Sent: Sunday, October 16, 2005 10:03 PM Subject: [php-gtk-cvs] cvs: php-gtk /ext/libglade libglade.overrides > sfox Sun Oct 16 17:03:06 2005 EDT > > Modified files: > /php-gtk/ext/libglade libglade.overrides > Log: > Make libglade constructor work out of the box in most cases. > > http://cvs.php.net/diff.php/php-gtk/ext/libglade/libglade.overrides?r1=1.14&r2=1.15&ty=u > Index: php-gtk/ext/libglade/libglade.overrides > diff -u php-gtk/ext/libglade/libglade.overrides:1.14 php-gtk/ext/libglade/libglade.overrides:1.15 > --- php-gtk/ext/libglade/libglade.overrides:1.14 Thu Oct 6 16:35:18 2005 > +++ php-gtk/ext/libglade/libglade.overrides Sun Oct 16 17:03:02 2005 > @@ -8,8 +8,33 @@ > *_get_type > %% > ignore > - glade_xml_new > - glade_xml_signal_connect_full > - glade_xml_signal_connect_data > - glade_xml_signal_autoconnect_full > + glade_xml_construct > > +%% {{{ GladeXML > +%% > +override glade_xml_new > +PHP_METHOD > +{ > + char *fname, *root = NULL, *domain = NULL; > + zend_bool free_fname, free_root, free_domain; > + GObject *wrapped_obj; > + > + if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "u|uu", &fname, &free_fname, &root, &free_root, &domain, &free_domain)) { > + PHPG_THROW_CONSTRUCT_EXCEPTION(GladeXML); > + } > + > + /* Glade's default name for the toplevel window is hard-coded - but there may be a better way */ > + if (!root) root = (char *)"window1"; > + > + wrapped_obj = (GObject *) glade_xml_new(fname, root, domain); > + if (free_fname) g_free(fname); > + if (free_root) g_free(root); > + if (free_domain) g_free(domain); > + > + if (!wrapped_obj) { > + PHPG_THROW_CONSTRUCT_EXCEPTION(GladeXML); > + } > + phpg_gobject_set_wrapper(this_ptr, wrapped_obj TSRMLS_CC); > +} > + > +%% }}} > > -- > PHP-GTK CVS Mailing List (http://gtk.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

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