Re: How to set application icon



tomas tuxteam de ha scritto lo scorso 23/11/2006 12:25:
Hi,

i guess this must be a faq, so shame on me. How do I set the application
icon (the little thingie some window managers show on the upper-left of
teh app windows and on a task bar when iconified?)

I already do:

  gtk_window_set_default_icon_name("foobar");

just before gtk_main() and I dropped some png in
/usr/share/icons/hicolor/48x48/apps/foobar/foobar.png -- but with no
results. The worse part is that I'm at a loss as to how troubleshoot the
problem. <http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html>
gives some hints, but not enough for dumb people like me.



Try this:

  GtkWidget *yourWin;
  GdkPixbuf *icon_pixbuf;

  ...

  icon_pixbuf =
  gdk_pixbuf_new_from_file ("/path/to/your/share/dir/foobar.png", NULL);
  if (icon_pixbuf)
  {
      gtk_window_set_icon (GTK_WINDOW (yourWin), icon_pixbuf);
      gdk_pixbuf_unref (icon_pixbuf);
  }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]