[Gtk-sharp-list] Glade# and resources.

Bob Smith bob@thestuff.net
Thu, 12 Sep 2002 17:41:24 -0400 (EDT)


I've wondered why we havent done this with non microsoft binaries. Is elf
limited so that this kind of stuff cant be done?

On 12 Sep 2002, Miguel de Icaza wrote:

> Hey guys,
>
>     In the .NET universe you can "embed" into your executable resources
> files, like for instance the .glade files, could we add a constructor
> that would allow a developer to load the glade file from its resource?
>
>     The resource is embedded like this:
>
> 	mcs test.cs -resource:file.glade
>
>     Then we can retrieve the XML like this:
>
>
>
> using System;
> using System.Reflection;
> using System.IO;
>
> class X {
>
>         static void Main ()
>         {
>                 Assembly a = AppDomain.CurrentDomain.GetAssemblies ()[0];
>
>                 Console.WriteLine ("Assembly: " + a.ToString ());
>                 Stream s = a.GetManifestResourceStream ("file.glade");
>                 if (s != null){
>                         StreamReader sr = new StreamReader (s);
>
>                         Console.WriteLine (sr.ReadToEnd ());
>                 }
>         }
> }
>
> We could then use the glade_xml_new_from_buffer.
>
> With this we can ship a standalone .exe file, and not worry about the
> installation prefix or how to locate our data files: everything can be
> embedded into the executable.
>
> best wishes,
> Miguel.
>
>
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list@ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>