[Gtk-sharp-list] Glade using resources

Christian Rudh lists-christian at rudh.se
Mon Jul 4 13:30:16 EDT 2005


Hi

I haven't found any way. According to this thread:

http://galactus.ximian.com/pipermail/gtk-sharp-list/2005-February/005438.html

it isn't possible (if it is still valid, since it is from February).

Adding images from the code is simple, but it would be nice to do it
directly in glade. If you find any solution, please post it here.


/Christian

On Mon, 2005-07-04 at 19:08 +0200, 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
> 
> 



More information about the Gtk-sharp-list mailing list