[Gtk-sharp-list] Embed Gtk+ theme into app

Wolfgang Silbermayr wolfgang at silbermayr.at
Fri Oct 4 06:34:31 UTC 2013


On 2013-10-03 22:42, Weston Weems wrote:
> Wow that worked almost perfectly... I had to track down windows version
> of some of the theme engines, the themes I was trying to use,
> utilized.... but aside from that it was good.
> 
> Is there any rhyme or reason on how to help the theme engine locate
> resources like images and such? Some of these themes will do like a
> ./assets/toolbarbg.png or whatever...

Good to see that it helped.

I have not investigated this further, but I think you have to start from
the Icon* classes, like IconFactory, IconSource or IconTheme. I have,
however, not yet figured out the link that leads from Gtk.Rc towards the
Icon* classes.

> On Wed, Oct 2, 2013 at 12:05 AM, Wolfgang Silbermayr
> <wolfgang at silbermayr.at <mailto:wolfgang at silbermayr.at>> wrote:
> 
>     On 2013-10-01 19:05, Weston Weems wrote:
>     > I'd like to embed a gtk+ theme, so I can effectively skin my app and
>     > look the same way regardless of what default gtk+ theme is setup.
>     >
>     > Is this something I can do? I've read people make comments of using
>     > resource files etc... but I have yet to hear specific details on
>     this...
>     > or better yet an example.
>     >
>     > Anyone have any pointers?
> 
>     You can deploy your own gtkrc file and load the data from there:
> 
>     Gtk.Application.Init();
>     string filename = "/the/path/to/my.gtkrc";
>     Gtk.Rc.Parse(filename);
> 
>     or my preferred method: you include the gtkrc file as a resource inside
>     your assembly:
> 
>     Gtk.Application.Init();
>     using (Stream stream =
>       GetType().Assembly.GetManifestResourceStream("my.gtkrc"))
>     {
>       using (TextReader reader = new StreamReader(stream))
>       {
>         Gtk.Rc.ParseString (reader.ReadToEnd());
>       }
>     }
> 
>     Hope this helps.
> 
> 
>     _______________________________________________
>     Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
>     <mailto:Gtk-sharp-list at lists.ximian.com>
>     http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> 
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 551 bytes
Desc: OpenPGP digital signature
URL: <http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20131004/0e7b44b0/attachment.pgp>


More information about the Gtk-sharp-list mailing list