[Gtk-sharp-list] Glade - problem when menu entries specified

Viktor Stansvik vstansvik@home.se
Wed, 16 Jun 2004 21:08:26 +0200


--=-K+nxbjWBRJQKzuDcGcZT
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

ons 2004-06-16 klockan 20.33 skrev Mike Kestner:
> On Wed, 2004-06-16 at 13:12, Viktor Stansvik wrote:
> 
> > > My guess is that you are using Gtk.Application.Init and glade is
> > > sticking Gnome.Stock items in your menu, which causes libglade to go
> > > through some gnomeui code which isn't initialized.
> 
> > I tried to add "using Gnome" to my program and add gnome-sharp to my
> > references but I still got the same problem.
> > Then I tried to add only one non-stock item to my MenuBar and got
> > another error when trying to run the app:
> 
> A "using Gnome" won't help.  You would have to create a Gnome.Program
> object like in the GnomeHelloWorld sample.  I point this out because
> others have missed this requirement for dabbling in the Gnome namespace.
> Gnome.Program initializes all the libraries in the Gnome namespace like
> Gtk.Application.Init does for Gtk-only programs.
> 
> Implied in my "My guess" statement above is that you have not provided
> anywhere near enough information for us to adequately help you debug
> your issue.  You'll need to show the code, preferably boiled down to as
> small of a sample as possible to reproduce the issue.  Otherwise we are
> reduced to making wild guesses.

Okay, thanks.
To illustrate the problem I created a new minimal Glade# project using
MonoDevelop and edited the gui.glade file with Glade. I added a MenuBar,
removed all the stock items that's in it by default and added one
non-stock item to it. It compiles but I get the error messages I
mentioned previously.

Some version numbers:
mono - 0.91
gtk-sharp - 0.91

I've attached the source code file, the glade file and the error
message.
Sorry for not getting your hint about providing more information -
English isn't my native language you know :)

Viktor

--=-K+nxbjWBRJQKzuDcGcZT
Content-Disposition: attachment; filename=Main.cs
Content-Type: text/x-csharp; name=Main.cs; charset=iso-8859-1
Content-Transfer-Encoding: 7bit

// project created on 2004-06-16 at 20.52
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 (null, "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;
        }
}


--=-K+nxbjWBRJQKzuDcGcZT
Content-Disposition: attachment; filename=gui.glade
Content-Type: application/x-glade; name=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>
  <signal name="delete_event" handler="OnWindowDeleteEvent"/>

  <child>
    <widget class="GtkMenuBar" id="menubar1">
      <property name="visible">True</property>

      <child>
	<widget class="GtkMenuItem" id="item1">
	  <property name="visible">True</property>
	  <property name="label" translatable="yes">item1</property>
	  <property name="use_underline">True</property>
	  <signal name="activate" handler="on_item1_activate" last_modification_time="Wed, 16 Jun 2004 18:53:46 GMT"/>
	</widget>
      </child>
    </widget>
  </child>
</widget>

</glade-interface>

--=-K+nxbjWBRJQKzuDcGcZT
Content-Disposition: attachment; filename=error.txt
Content-Type: text/plain; name=error.txt; charset=iso-8859-1
Content-Transfer-Encoding: 7bit

Unhandled Exception: System.NullReferenceException: A null value was found where an object instance was required.
in (unmanaged) (wrapper managed-to-native) SignalConnector:glade_xml_signal_autoconnect_full (intptr,Glade.XML/SignalConnector/RawXMLConnectFunc,intptr)in <0x00004> (wrapper managed-to-native) SignalConnector:glade_xml_signal_autoconnect_full (intptr,Glade.XML/SignalConnector/RawXMLConnectFunc,intptr)
in <0x0006b> SignalConnector:Autoconnect ()
in <0x00050> Glade.XML:Autoconnect (object)
in <0x0005a> GladeApp:.ctor (string[])
in <0x00020> GladeApp:Main (string[])

--=-K+nxbjWBRJQKzuDcGcZT--