GtkStatusIcon bad default size when used with GtkIconFactory



Hi!

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 until the panel is >= 26 px. 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 or am I doing something wrong? I guess this would
be the prefferred way of setting up a status icon, since with a custom
sotck 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]