[Bug?] GtkStatusIcon bad default size when used with GtkIconFactory



Hi!

Improving the GtkStatusIcon support in a program, I bumped into a
problem that I believe is a bug. I reported it here:
http://bugzilla.gnome.org/show_bug.cgi?id=524488
I tried getting help on gtk-app-devel, but nobody answered. Since I'm
still not sure this is a bug, I ask here to get more information. Just
tell me if what I use is not the recommended way to do this. On the
contrary, I'd be pleased to make more tests if this is likely to be a
bug.


I'm trying to use the GtkIconFactory system to set the icon used by
GtkStatusIcon. Once I've created the GtkIconSet for my icons (I have 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.

Normally, the status icons measure: (height of the panel) - 2 px. But
this is not true in my case, the icon is always smaller than it should.
The strange point is, if I set the GtkStatus Icon directly from an icon
file, the size is 22x22.

Is that a bug in GNOME/GTK or am I doing something wrong? I guess this
would be the prefferred way of setting up a status icon, since with a
custom stock icon it can be risized without problems - but still I may
have missed something.


Thanks in advance!


Here's for reference a part of the code that I use, if you like (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);
  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);

  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");







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