[Gtk-sharp-list] Glade using resources
Mike Rhodes
mike.rhodes at gmail.com
Tue Jul 5 05:16:40 EDT 2005
I use the commented out version in your code successfully:
Glade.XML glade_xml = new Glade.XML (null, "main_window.glade",
"mainWindow", null);
glade_xml.Autoconnect (this);
Are you sure you are compiling the glade file into the binary? I don't
know much about resources, but I use:
-resource:$(srcdir)/../glade/main_window.glade,main_window.glade
in my makefile.
Mike.
On 7/4/05, underdog10 at netcourrier.com <underdog10 at netcourrier.com> wrote:
> Hello,
>
> I would like to load image from resources using a glade interface.
> I try this 2 method without success:
>
> //Glade.XML gxml = new Glade.XML(null, "testgui.glade", "window1", null);
>
> Glade.XML gxml = Glade.XML.FromAssembly ("testgui.glade", "window1", null);
>
> When i say without success, i mean it fail because galde is looking for the file on disk not in built in resources.
>
> I can set the gui icon using:
> window1.Icon = Gdk.Pixbuf.LoadFromResource ("testicon.png");
>
> So is there anyway to load image from resources using a glade interface?
>
> Thanks
>
>
> --Error here---
> (<unknown>:2000): GLib-CRITICAL **: g_path_get_dirname: assertion `file_name != NULL' failed
>
> (<unknown>:2000): GdkPixbuf-CRITICAL **: gdk_pixbuf_new_from_file_utf8: assertion `filename != NULL' failed
>
> (<unknown>:2000): libglade-WARNING **: Couldn't find image file: "test.png"
>
> (<unknown>:2000): GLib-CRITICAL **: g_path_get_dirname: assertion `file_name != NULL' failed
>
> (<unknown>:2000): GdkPixbuf-CRITICAL **: gdk_pixbuf_new_from_file_utf8: assertion `filename != NULL' failed
> Glade GUI error: Object reference not set to an instance of an object
>
> Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
> in <0x000f4> Test.Gui.MyGui:.ctor ()
> in <0x0006a> Test.MainClass:Main (System.String[] args)
>
> -------------------------------------------------------------
> NetCourrier, votre bureau virtuel sur Internet : Mail, Agenda, Clubs, Toolbar...
> Web/Wap : www.netcourrier.com
> Téléphone/Fax : 08 92 69 00 21 (0,34 € TTC/min)
> Minitel: 3615 NETCOURRIER (0,16 € TTC/min)
>
> _______________________________________________
> Gtk-sharp-list maillist - Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>
--
"He who fights with monsters might take care
lest he thereby become a monster. And if you
gaze for long into an abyss, the abyss gazes
also into you." - Nietzsche
More information about the Gtk-sharp-list
mailing list