Re: How to set application icon



Carlo Agrusti writes:
tomas tuxteam de ha scritto lo scorso 23/11/2006 12:25:
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.
Try this:
  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);
  }

Hmm. That's non-themeable, though. I think possibly the icon path /usr/share/icons/hicolor/48x48/apps/foobar/foobar.png should be /usr/share/icons/hicolor/48x48/apps/foobar.png - IIRC GTK will only look in specified directories of the theme path, not subdirs. Also, dumping it in /usr/share/pixmaps/ should work. wrt troubleshooting - have you tried just creating a GtkImage with the relevant stock image name?



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