[Gtk-sharp-list] Glade# and toolbar buttons

Olaf Leidinger leidola@web.de
Thu, 23 Dec 2004 11:48:01 +0100


--=-PngAjAY+vhPrqRLgfqma
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hello list!

The following smaal gtk# application won't work properly for me. The
problem is, that the toggled or clicked events for toolbar buttons
aren't fired (or at least the functions aren't called-back)

// project created on 23.12.2004 at 10:34
using System;
using Gtk;
using Glade;

public class GladeApp
{
        public static void Main (string[] args)
        {
                new GladeApp (args);
        }

        public GladeApp (string[] args) 
        {
                Application.Init();

                Glade.XML gxml = new Glade.XML ( "gui.glade", "window1",
null);
                gxml.Autoconnect (this);
                Application.Run();
        }

        /* Connect the Signals defined in Glade */
        public void OnWindowDeleteEvent (object o, DeleteEventArgs
args) 
        {
                Application.Quit ();
                args.RetVal = true;
        }
        
        public void OnRadiotoolbutton1Toggled (object o, EventArgs args)
        {
        	Console.Write ("radio1\n");
        }
        
        public void OnRadioToolButton2Toggled (object o, EventArgs args)
        {
        	Console.Write ("radio2\n");
        }
        
        public void OnToolButton1Clicked (object o, EventArgs args)
        {
        	Console.Write ("tool1\n");
        }

        public void OnButton1Clicked (System.Object obj, EventArgs e) 
        {
		Console.WriteLine ("Button 1 clicked");
		} 
}

gui.glade is attached.

The callback for button1 works properly but the ones for the toolbutton
or radiotoolbutton don't.
Another strange thing is when removing one of the *toolbutton-callback
functions the program executes fine but on removing the button-callback
it won't start. Seems as if the *toolbutton callbacks aren't connected.

I'm using :

gtk-sharp-1.0.4
mono  1.0.4
gtk 2.6.0
glade 2.6.0
libglade 2.4.1

on gentoo-linux

Any idea what might be wrong?

Thanks a lot,

Ciao,

Olaf






--=-PngAjAY+vhPrqRLgfqma
Content-Description: 
Content-Type: application/x-glade
Content-Disposition: inline; filename=gui.glade
Content-Transfer-Encoding: 7bit

<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">

<glade-interface>
<requires lib="gnome"/>

<widget class="GtkWindow" id="window1">
  <property name="visible">True</property>
  <property name="title" translatable="yes">Glade Window</property>
  <property name="type">GTK_WINDOW_TOPLEVEL</property>
  <property name="window_position">GTK_WIN_POS_CENTER</property>
  <property name="modal">False</property>
  <property name="default_width">256</property>
  <property name="default_height">256</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>
  <signal name="delete_event" handler="OnWindowDeleteEvent"/>

  <child>
    <widget class="GtkVBox" id="vbox1">
      <property name="visible">True</property>
      <property name="homogeneous">False</property>
      <property name="spacing">0</property>

      <child>
	<widget class="GtkHandleBox" id="handlebox1">
	  <property name="visible">True</property>
	  <property name="shadow_type">GTK_SHADOW_OUT</property>
	  <property name="handle_position">GTK_POS_LEFT</property>
	  <property name="snap_edge">GTK_POS_TOP</property>

	  <child>
	    <widget class="GtkToolbar" id="toolbar1">
	      <property name="visible">True</property>
	      <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
	      <property name="toolbar_style">GTK_TOOLBAR_BOTH</property>
	      <property name="tooltips">True</property>
	      <property name="show_arrow">True</property>

	      <child>
		<widget class="GtkToolButton" id="toolbutton1">
		  <property name="visible">True</property>
		  <property name="stock_id">gtk-refresh</property>
		  <property name="visible_horizontal">True</property>
		  <property name="visible_vertical">True</property>
		  <property name="is_important">False</property>
		  <signal name="clicked" handler="OnToolButton1Clicked" last_modification_time="Thu, 23 Dec 2004 10:44:09 GMT"/>
		</widget>
		<packing>
		  <property name="expand">False</property>
		  <property name="homogeneous">True</property>
		</packing>
	      </child>

	      <child>
		<widget class="GtkRadioToolButton" id="radiotoolbutton1">
		  <property name="visible">True</property>
		  <property name="stock_id">gtk-sort-descending</property>
		  <property name="visible_horizontal">True</property>
		  <property name="visible_vertical">True</property>
		  <property name="is_important">False</property>
		  <property name="active">False</property>
		  <signal name="toggled" handler="OnRadioToolButton1Toggled" last_modification_time="Thu, 23 Dec 2004 10:43:51 GMT"/>
		</widget>
		<packing>
		  <property name="expand">False</property>
		  <property name="homogeneous">True</property>
		</packing>
	      </child>

	      <child>
		<widget class="GtkRadioToolButton" id="radiotoolbutton2">
		  <property name="visible">True</property>
		  <property name="stock_id">gtk-sort-ascending</property>
		  <property name="visible_horizontal">True</property>
		  <property name="visible_vertical">True</property>
		  <property name="is_important">False</property>
		  <property name="active">False</property>
		  <property name="group">radiotoolbutton1</property>
		  <signal name="toggled" handler="OnRadioToolButton2Toggled" last_modification_time="Thu, 23 Dec 2004 10:43:29 GMT"/>
		</widget>
		<packing>
		  <property name="expand">False</property>
		  <property name="homogeneous">True</property>
		</packing>
	      </child>
	    </widget>
	  </child>
	</widget>
	<packing>
	  <property name="padding">0</property>
	  <property name="expand">False</property>
	  <property name="fill">True</property>
	</packing>
      </child>

      <child>
	<widget class="GtkButton" id="button1">
	  <property name="visible">True</property>
	  <property name="can_focus">True</property>
	  <property name="label" translatable="yes">button1</property>
	  <property name="use_underline">True</property>
	  <property name="relief">GTK_RELIEF_NORMAL</property>
	  <property name="focus_on_click">True</property>
	  <signal name="clicked" handler="OnButton1Clicked" last_modification_time="Thu, 23 Dec 2004 10:01:02 GMT"/>
	</widget>
	<packing>
	  <property name="padding">0</property>
	  <property name="expand">False</property>
	  <property name="fill">False</property>
	</packing>
      </child>
    </widget>
  </child>
</widget>

</glade-interface>

--=-PngAjAY+vhPrqRLgfqma--