GNOME Bugzilla – Bug 524488
GtkStatusIcon wrong size when created from a custom stock icon
Last modified: 2014-08-30 05:20:24 UTC
Basically, the default size of the GtkStatusIcon is 20x20px when you create it from a custom stock icon (using GtkIconFactory), while it normally should be set to 22x22. I'm trying to use the GtkIconFactory system to set the icon used by GtkStatusIcon. Once I've created the GtkIconSet for my icons (with SVG and PNG versions of the same icon), I use gtk_status_icon_set_from_stock. Everything goes right, except that the created icon is 20x20 px by default (i.e. when the GNOME panel is set to a size of 24 px), when it should be (like every app does) 22x22. The SVG version is thus used (because the size is non-standard), but if if only provide a PNG version of 22x22 px, it is even resized to fit the 20x20 size, and therefore is blurry. Normally, the status icons measure: (height of the panel) - 2 px. But this is not true in my case until the panel is >= 26 px. The strange point is, if I set the GtkStatusIcon directly from an icon file, the size is 22x22. If I set it from a GTK stock icon, it also has the right size of 22x22. I'm not really sure this is a GTK bug - it might still be a gnome-panel one. Please just ask for any information/testing. Thanks. Here's for reference a part of the code that I use (it's in gnunet-gtk from the GNUnet project): char *instDir; char *iconPath; GtkStatusIcon *trayIcon; GtkIconSet *iconSet; GtkIconSource *iconSource; (...) iconSet = gtk_icon_set_new (); iconSource = gtk_icon_source_new (); iconPath = g_build_filename (instDir, "..", "gnunet-gtk", "gnunet-gtk-status-connected.svg", NULL); gtk_icon_source_set_filename (iconSource, iconPath); g_free (iconPath); gtk_icon_set_add_source (iconSet, iconSource); iconPath = g_build_filename (instDir, "..", "gnunet-gtk", "gnunet-gtk-status-connected.png", NULL); // 22x22px icon gtk_icon_source_set_filename (iconSource, iconPath); g_free (iconPath); gtk_icon_source_set_size_wildcarded (iconSource, FALSE); gtk_icon_set_add_source (iconSet, iconSource); // this icon factory has already been added to the default gtk_icon_factory_add (GNUNET_GTK_get_iconFactory(), "gnunet-gtk-status-connected", iconSet); gtk_icon_set_unref (iconSet); gtk_icon_source_free (iconSource); gtk_status_icon_set_from_stock (trayIcon, "gnunet-gtk-status-connected");
*** Bug 588113 has been marked as a duplicate of this bug. ***
*** Bug 593345 has been marked as a duplicate of this bug. ***
It would seem this issue is fixed with the rhythmbox 0.12.5 status icon in Ubuntu 9.10, for me anyway (gtk 2.18.0). Is this bug still left in gtk 2.18.0?
GtkStatusIcon has been deprecated