On Sun, 19 Sep 2010 23:46:39 -0600 Stuart Jansen <[email protected]> wrote:
> On Sun, 2010-09-19 at 22:53 -0600, Charles Curley wrote: > > I'd like to set the program icon for a gtk 2 application written in > > C. To do this, I know to use gtk_window_set_icon (). It takes a GDK > > pixbuf. I can create a pixbuf from an external file using > > gdk_pixbuf_new_from_file, but that's a bit tacky. I'd rather > > compile it into the program. Supposedly you can do it, but how? > > > http://library.gnome.org/devel/gdk-pixbuf/stable/gdk-pixbuf-creating.html#gdk-pixbuf-new-from-xpm-data > > or > > http://library.gnome.org/devel/gdk-pixbuf/stable/gdk-pixbuf-creating.html#gdk-pixbuf-new-from-inline Thank you, that did it, with a nice one-liner: /* Set our icon. */ gtk_window_set_icon ((GtkWindow *)window, gdk_pixbuf_new_from_inline ( -1, iconPixBuf, false, NULL)); I went with the pixbuf rather than xpm because the pixbuf will be as portable as gkt+ lets it be, and everything else graphical in the program is gtk+. -- Charles Curley /"\ ASCII Ribbon Campaign Looking for fine software \ / Respect for open standards and/or writing? X No HTML/RTF in email http://www.charlescurley.com / \ No M$ Word docs in email Key fingerprint = CE5C 6645 A45A 64E4 94C0 809C FFF6 4C48 4ECD DFDB /* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */
