Re: Re[2]: [PHP-GTK-DEV] Defeated
| From: | Steph | Date: | Thu, 20 Oct 2005 16:00:42 +0000 |
| Subject: | Re: Re[2]: [PHP-GTK-DEV] Defeated | ||
| References: | 1 2 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-1869@lists.php.net to get a copy of this message | ||
Yep, I was trying to connect the signal name rather than the callback
handler name... nothing to do with internals, At All, just me not
understanding that I wasn't supposed to use the signal name there...
Haven't even started to implement glade_xml_signal_autoconnect() yet, I'm
still trying to get glade_xml_signal_connect() to pass user data
(specifically: to pass an object when it's supposed to be a connect_object
call from within Glade).
----- Original Message -----
From: "Tom Rogers" <trogers@kwikin.com>
To: "Steph" <steph@zend.com>
Cc: "PHP-GTK dev" <php-gtk-dev@lists.php.net>; "Andrei"
<andrei@gravitonic.com>
Sent: Thursday, October 20, 2005 4:34 PM
Subject: Re[2]: [PHP-GTK-DEV] Defeated
> Hi Steph,
>
> Thursday, October 20, 2005, 10:47:26 PM, you wrote:
> S> Forget it, I played with the script I have here & the original function
and
> S> it works now (in as much as it reaches the marshal). I'm trying to
figure
> S> out wtf I was doing before to prevent it...
>
> The way glade seems to work is you ask it for the widget that has a
> connect name of for example 'on_open1_activate' it then calls your
> marshal function and gives it a chance to do the real connect,
>
> If you use the glade_xml_signal_autoconnect it repeatedly calls your
> marshal function for each widget that has a signal name in it.
> Perhaps you should change the name to glade_signal_connect instead of
> glade_signal_marshal ???
>
>
>
> Anyway here is my test script and glade file:
>
>
>
> <?php
> function on_open1_activate(){
> echo "Button Pressed\n";
> }
> $glade = new GladeXML("gladetest\\gladetest.glade");
> $window = $glade->get_widget('window1');
> // returns the widget named
> $menu1 = $glade->get_widget('menu1');
> $items = $menu1->children();
>
> print $window->get_name()."\n";
> // returns widget's name via GTK+
> print glade::get_widget_name($window->child)."\n";
> // returns widget's name via libglade
>
> var_dump(glade::get_widget_tree($window));
> // returns current GladeXML object
> print $glade->relative_file($glade->filename)."\n";
> // returns relative path (and given filename)
> $list = $glade->get_widget_prefix("button");
> // returns every widget having the given id prefix
> foreach($list as $item) {
> print $item->get_name()."\n";
> }
>
> $window->connect_simple('destroy', array('gtk', 'main_quit'));
> // works as advertised
> $glade->signal_connect('on_open1_activate','on_open1_activate');
> // untested, probably won't work
>
> gtk::main();
> ?>
>
> <?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
> <!DOCTYPE glade-interface SYSTEM
> "http://glade.gnome.org/glade-2.0.dtd">
>
> <glade-interface>
>
> <widget class="GtkWindow" id="window1">
> <property name="visible">True</property>
> <property name="title" translatable="yes">window1</property>
> <property name="type">GTK_WINDOW_TOPLEVEL</property>
> <property name="window_position">GTK_WIN_POS_NONE</property>
> <property name="modal">False</property>
> <property name="resizable">True</property>
> <property name="destroy_with_parent">False</property>
> <property name="decorated">True</property>
> <property name="skip_taskbar_hint">False</property>
> <property name="skip_pager_hint">False</property>
> <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
>
> <child>
> <widget class="GtkVBox" id="vbox1">
> <property name="visible">True</property>
> <property name="homogeneous">False</property>
> <property name="spacing">0</property>
>
> <child>
> <widget class="GtkMenuBar" id="menubar1">
> <property name="visible">True</property>
>
> <child>
> <widget class="GtkMenuItem" id="menuitem1">
> <property name="visible">True</property>
> <property name="label"
> translatable="yes">_File</property>
> <property name="use_underline">True</property>
>
> <child>
> <widget class="GtkMenu" id="menu1">
>
> <child>
> <widget class="GtkImageMenuItem" id="new1">
> <property name="visible">True</property>
> <property name="label">gtk-new</property>
> <property name="use_stock">True</property>
> <signal name="activate" handler="on_new1_activate"
last_modification_time="Tue, 18 Oct 2005 00:12:42 GMT"/>
> </widget>
> </child>
>
> <child>
> <widget class="GtkImageMenuItem" id="open1">
> <property name="visible">True</property>
> <property name="label">gtk-open</property>
> <property name="use_stock">True</property>
> <signal name="activate" handler="on_open1_activate"
last_modification_time="Tue, 18 Oct 2005 00:12:42 GMT"/>
> </widget>
> </child>
>
> <child>
> <widget class="GtkImageMenuItem" id="save1">
> <property name="visible">True</property>
> <property name="label">gtk-save</property>
> <property name="use_stock">True</property>
> <signal name="activate" handler="on_save1_activate"
last_modification_time="Tue, 18 Oct 2005 00:12:42 GMT"/>
> </widget>
> </child>
>
> <child>
> <widget class="GtkImageMenuItem" id="save_as1">
> <property name="visible">True</property>
> <property name="label">gtk-save-as</property>
> <property name="use_stock">True</property>
> <signal name="activate" handler="on_save_as1_activate"
last_modification_time="Tue, 18 Oct 2005 00:12:42 GMT"/>
> </widget>
> </child>
>
> <child>
> <widget class="GtkSeparatorMenuItem" id="separatormenuitem1">
> <property name="visible">True</property>
> </widget>
> </child>
>
> <child>
> <widget class="GtkImageMenuItem" id="quit1">
> <property name="visible">True</property>
> <property name="label">gtk-quit</property>
> <property name="use_stock">True</property>
> <signal name="activate" handler="on_quit1_activate"
last_modification_time="Tue, 18 Oct 2005 00:12:42 GMT"/>
> </widget>
> </child>
> </widget>
> </child>
> </widget>
> </child>
>
> <child>
> <widget class="GtkMenuItem" id="menuitem2">
> <property name="visible">True</property>
> <property name="label"
> translatable="yes">_Edit</property>
> <property name="use_underline">True</property>
>
> <child>
> <widget class="GtkMenu" id="menu2">
>
> <child>
> <widget class="GtkImageMenuItem" id="cut1">
> <property name="visible">True</property>
> <property name="label">gtk-cut</property>
> <property name="use_stock">True</property>
> <signal name="activate" handler="on_cut1_activate"
last_modification_time="Tue, 18 Oct 2005 00:12:42 GMT"/>
> </widget>
> </child>
>
> <child>
> <widget class="GtkImageMenuItem" id="copy1">
> <property name="visible">True</property>
> <property name="label">gtk-copy</property>
> <property name="use_stock">True</property>
> <signal name="activate" handler="on_copy1_activate"
last_modification_time="Tue, 18 Oct 2005 00:12:42 GMT"/>
> </widget>
> </child>
>
> <child>
> <widget class="GtkImageMenuItem" id="paste1">
> <property name="visible">True</property>
> <property name="label">gtk-paste</property>
> <property name="use_stock">True</property>
> <signal name="activate" handler="on_paste1_activate"
last_modification_time="Tue, 18 Oct 2005 00:12:42 GMT"/>
> </widget>
> </child>
>
> <child>
> <widget class="GtkImageMenuItem" id="delete1">
> <property name="visible">True</property>
> <property name="label">gtk-delete</property>
> <property name="use_stock">True</property>
> <signal name="activate" handler="on_delete1_activate"
last_modification_time="Tue, 18 Oct 2005 00:12:42 GMT"/>
> </widget>
> </child>
> </widget>
> </child>
> </widget>
> </child>
>
> <child>
> <widget class="GtkMenuItem" id="menuitem3">
> <property name="visible">True</property>
> <property name="label"
> translatable="yes">_View</property>
> <property name="use_underline">True</property>
>
> <child>
> <widget class="GtkMenu" id="menu3">
> </widget>
> </child>
> </widget>
> </child>
>
> <child>
> <widget class="GtkMenuItem" id="menuitem4">
> <property name="visible">True</property>
> <property name="label"
> translatable="yes">_Help</property>
> <property name="use_underline">True</property>
>
> <child>
> <widget class="GtkMenu" id="menu4">
>
> <child>
> <widget class="GtkMenuItem" id="about1">
> <property name="visible">True</property>
> <property name="label"
> translatable="yes">_About</property>
> <property name="use_underline">True</property>
> <signal name="activate" handler="on_about1_activate"
last_modification_time="Tue, 18 Oct 2005 00:12:42 GMT"/>
> </widget>
> </child>
> </widget>
> </child>
> </widget>
> </child>
> </widget>
> <packing>
> <property name="padding">0</property>
> <property name="expand">False</property>
> <property name="fill">False</property>
> </packing>
> </child>
>
> <child>
> <widget class="GtkScrolledWindow" id="scrolledwindow1">
> <property name="visible">True</property>
> <property name="can_focus">True</property>
> <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
> <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
> <property name="shadow_type">GTK_SHADOW_NONE</property>
> <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
>
> <child>
> <widget class="GtkTextView" id="textview1">
> <property name="visible">True</property>
> <property name="can_focus">True</property>
> <property name="editable">True</property>
> <property name="overwrite">False</property>
> <property name="accepts_tab">True</property>
> <property name="justification">GTK_JUSTIFY_LEFT</property>
> <property name="wrap_mode">GTK_WRAP_NONE</property>
> <property name="cursor_visible">True</property>
> <property name="pixels_above_lines">0</property>
> <property name="pixels_below_lines">0</property>
> <property name="pixels_inside_wrap">0</property>
> <property name="left_margin">0</property>
> <property name="right_margin">0</property>
> <property name="indent">0</property>
> <property name="text" translatable="yes"></property>
> </widget>
> </child>
> </widget>
> <packing>
> <property name="padding">0</property>
> <property name="expand">True</property>
> <property name="fill">True</property>
> </packing>
> </child>
>
> <child>
> <widget class="GtkStatusbar" id="statusbar1">
> <property name="visible">True</property>
> <property name="has_resize_grip">True</property>
> </widget>
> <packing>
> <property name="padding">0</property>
> <property name="expand">False</property>
> <property name="fill">False</property>
> </packing>
> </child>
> </widget>
> </child>
> </widget>
>
> </glade-interface>
>
>
>
> --
> regards,
> Tom
>