[Gtk-sharp-list] Glade# problem with autoconnect.

Philipp Kern phil@philkern.de
Thu, 05 Aug 2004 03:47:42 +0200


--=-Noty9dDU1OFqjp72VNeT
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Do, 2004-08-05 at 03:45, Philipp Kern wrote:
> I attached both the Main.cs source and the glade GUI description.

I intended to attach them. Here we are. Sorry for this second mail.

Regards,
Philipp Kern

--=-Noty9dDU1OFqjp72VNeT
Content-Disposition: attachment; filename=Main.cs
Content-Type: text/plain; name=Main.cs; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

// project created on 08/05/2004 at 01:43

namespace Todo
{
	using System;
	using Gtk;
	using Glade;
	using Gnome;
	using GnomeSharp;

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

		[Widget] Gnome.Window MainWindow;
		
		/* Menu File */
		[Widget] ImageMenuItem New;
		[Widget] ImageMenuItem Open;
		[Widget] ImageMenuItem Save;
		[Widget] ImageMenuItem SaveAs;		
		[Widget] ImageMenuItem Quit;
		
		/* Menu Edit */
		[Widget] ImageMenuItem Cut;
		[Widget] ImageMenuItem Copy;
		[Widget] ImageMenuItem Paste;
		[Widget] ImageMenuItem Clear;
		[Widget] ImageMenuItem Properties;
		[Widget] ImageMenuItem Preferences;
		
		/* Menu Help */
		[Widget] ImageMenuItem About;
		
        public TodoApp (string[] args) 
        {
			Program program = new Program("Todo", "0.01", Modules.UI, args);
        
            /*Application.Init();*/

            Glade.XML gxml = new Glade.XML (null, "gui.glade", "MainWindow", null);
            gxml.Autoconnect(this);
            try
            {
            	program.Run();
            }
            catch (Exception ex)
            {
            	Console.WriteLine("Error in main loop:\n\n{0}", ex);
            }
        }

        /* Connect the Signals defined in Glade */
        public void OnWindowDeleteEvent (object o, DeleteEventArgs args) 
        {
			Application.Quit();
            args.RetVal = true;
        }

        /* Menu File */
        public void OnNewActivate (object o, EventArgs e) {}
        public void OnOpenActivate (object o, EventArgs e) {}
        public void OnSaveActivate (object o, EventArgs e) {}
        public void OnSaveAsActivate (object o, EventArgs e) {}        
        public void OnQuitActivate (object o, EventArgs e)
        {
        	/* This should probably be MainWindow.destroy() or something similar. */
        	Application.Quit();
        }
        
        /* Menu Edit */
        public void OnCutActivate (object o, EventArgs e) {}
        public void OnCopyActivate (object o, EventArgs e) {}
        public void OnPasteActivate (object o, EventArgs e) {}
        public void OnClearActivate (object o, EventArgs e) {}
        public void OnPropertiesActivate (object o, EventArgs e) {}
        public void OnPreferencesActivate (object o, EventArgs e) {}
        
        /* Menu Help */
        public void OnAboutActivate (object o, EventArgs e) {}
	}
}


--=-Noty9dDU1OFqjp72VNeT
Content-Disposition: attachment; filename=gui.glade
Content-Type: text/plain; name=gui.glade; charset=ISO-8859-1
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="MainWindow">
  <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="GtkMenuBar" id="menubar1">
	  <property name="visible">True</property>

	  <child>
	    <widget class="GtkMenuItem" id="file">
	      <property name="visible">True</property>
	      <property name="stock_item">GNOMEUIINFO_MENU_FILE_TREE</property>

	      <child>
		<widget class="GtkMenu" id="file_menu">

		  <child>
		    <widget class="GtkImageMenuItem" id="New">
		      <property name="visible">True</property>
		      <property name="stock_item">GNOMEUIINFO_MENU_NEW_ITEM</property>
		      <property name="label" translatable="yes">_New</property>
		      <property name="use_underline">True</property>
		      <signal name="activate" handler="OnNewActivate" last_modification_time="Wed, 04 Aug 2004 23:54:18 GMT"/>
		    </widget>
		  </child>

		  <child>
		    <widget class="GtkImageMenuItem" id="Open">
		      <property name="visible">True</property>
		      <property name="stock_item">GNOMEUIINFO_MENU_OPEN_ITEM</property>
		      <signal name="activate" handler="OnOpenActivate" last_modification_time="Wed, 04 Aug 2004 23:54:18 GMT"/>
		    </widget>
		  </child>

		  <child>
		    <widget class="GtkImageMenuItem" id="Save">
		      <property name="visible">True</property>
		      <property name="stock_item">GNOMEUIINFO_MENU_SAVE_ITEM</property>
		      <signal name="activate" handler="OnSaveActivate" last_modification_time="Wed, 04 Aug 2004 23:54:18 GMT"/>
		    </widget>
		  </child>

		  <child>
		    <widget class="GtkImageMenuItem" id="SaveAs">
		      <property name="visible">True</property>
		      <property name="stock_item">GNOMEUIINFO_MENU_SAVE_AS_ITEM</property>
		      <signal name="activate" handler="OnSaveAsActivate" last_modification_time="Wed, 04 Aug 2004 23:54:18 GMT"/>
		    </widget>
		  </child>

		  <child>
		    <widget class="GtkSeparatorMenuItem" id="separator3">
		      <property name="visible">True</property>
		    </widget>
		  </child>

		  <child>
		    <widget class="GtkImageMenuItem" id="Quit">
		      <property name="visible">True</property>
		      <property name="stock_item">GNOMEUIINFO_MENU_EXIT_ITEM</property>
		      <signal name="activate" handler="OnQuitActivate" last_modification_time="Wed, 04 Aug 2004 23:54:18 GMT"/>
		    </widget>
		  </child>
		</widget>
	      </child>
	    </widget>
	  </child>

	  <child>
	    <widget class="GtkMenuItem" id="edit">
	      <property name="visible">True</property>
	      <property name="stock_item">GNOMEUIINFO_MENU_EDIT_TREE</property>

	      <child>
		<widget class="GtkMenu" id="edit_menu">

		  <child>
		    <widget class="GtkImageMenuItem" id="Cut">
		      <property name="visible">True</property>
		      <property name="stock_item">GNOMEUIINFO_MENU_CUT_ITEM</property>
		      <signal name="activate" handler="OnCutActivate" last_modification_time="Wed, 04 Aug 2004 23:54:18 GMT"/>
		    </widget>
		  </child>

		  <child>
		    <widget class="GtkImageMenuItem" id="Copy">
		      <property name="visible">True</property>
		      <property name="stock_item">GNOMEUIINFO_MENU_COPY_ITEM</property>
		      <signal name="activate" handler="OnCopyActivate" last_modification_time="Wed, 04 Aug 2004 23:54:18 GMT"/>
		    </widget>
		  </child>

		  <child>
		    <widget class="GtkImageMenuItem" id="Paste">
		      <property name="visible">True</property>
		      <property name="stock_item">GNOMEUIINFO_MENU_PASTE_ITEM</property>
		      <signal name="activate" handler="OnPasteActivate" last_modification_time="Wed, 04 Aug 2004 23:54:18 GMT"/>
		    </widget>
		  </child>

		  <child>
		    <widget class="GtkImageMenuItem" id="Clear">
		      <property name="visible">True</property>
		      <property name="stock_item">GNOMEUIINFO_MENU_CLEAR_ITEM</property>
		      <signal name="activate" handler="OnClearActivate" last_modification_time="Wed, 04 Aug 2004 23:54:18 GMT"/>
		    </widget>
		  </child>

		  <child>
		    <widget class="GtkSeparatorMenuItem" id="separator4">
		      <property name="visible">True</property>
		    </widget>
		  </child>

		  <child>
		    <widget class="GtkImageMenuItem" id="Properties">
		      <property name="visible">True</property>
		      <property name="stock_item">GNOMEUIINFO_MENU_PROPERTIES_ITEM</property>
		      <signal name="activate" handler="OnPropertiesActivate" last_modification_time="Wed, 04 Aug 2004 23:54:18 GMT"/>
		    </widget>
		  </child>

		  <child>
		    <widget class="GtkSeparatorMenuItem" id="separator5">
		      <property name="visible">True</property>
		    </widget>
		  </child>

		  <child>
		    <widget class="GtkImageMenuItem" id="Preferences">
		      <property name="visible">True</property>
		      <property name="stock_item">GNOMEUIINFO_MENU_PREFERENCES_ITEM</property>
		      <signal name="activate" handler="OnPreferencesActivate" last_modification_time="Wed, 04 Aug 2004 23:54:18 GMT"/>
		    </widget>
		  </child>
		</widget>
	      </child>
	    </widget>
	  </child>

	  <child>
	    <widget class="GtkMenuItem" id="view">
	      <property name="visible">True</property>
	      <property name="stock_item">GNOMEUIINFO_MENU_VIEW_TREE</property>
	    </widget>
	  </child>

	  <child>
	    <widget class="GtkMenuItem" id="help">
	      <property name="visible">True</property>
	      <property name="stock_item">GNOMEUIINFO_MENU_HELP_TREE</property>

	      <child>
		<widget class="GtkMenu" id="help_menu">

		  <child>
		    <widget class="GtkImageMenuItem" id="About">
		      <property name="visible">True</property>
		      <property name="stock_item">GNOMEUIINFO_MENU_ABOUT_ITEM</property>
		      <signal name="activate" handler="OnAboutActivate" last_modification_time="Wed, 04 Aug 2004 23:52:24 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>
	<placeholder/>
      </child>

      <child>
	<placeholder/>
      </child>
    </widget>
  </child>
</widget>

</glade-interface>

--=-Noty9dDU1OFqjp72VNeT--