GNOME Bugzilla – Bug 377674
GtkStatusIcon reports 200 as size if is not embedded
Last modified: 2006-12-03 05:20:47 UTC
I have the following code: (...) gtk_status_icon_set_visible (netapplet->tray_icon, TRUE); netapplet_set_icon (DISCONNECT_ICON); (...) Being netapplet_set_icon: (...) panel_h = gtk_status_icon_get_size (netapplet->tray_icon); if (panel_h < 30) icon_size = 16; else icon_size = 24; g_print ("icon_name: %s; panel_h: %d; icon_size: %d\n\n", icon_name, panel_h, icon_size); pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), icon_name, icon_size, 0, NULL); gtk_status_icon_set_from_pixbuf (netapplet->tray_icon, pixbuf); g_object_unref (pixbuf); (...) This will g_print(): icon_name: something; panel_h: 200; icon_size: 24 after the first call to netapplet_set_icon I would see: icon_name: something; panel_h: 22; icon_size: 16 I'm understanding that GtkStatusIcon isn't aware of the notification area size until it's asked to draw something (in this case a pixbuf). I *think* that this shouldn't be like this, I don't know what will be the size of the icon until I set an icon in the GtkStatusIcon (ironic). GtkStatusIcon should tell me the notification area size so I can set my icon size correctly (and not just guess it). Note: I know that I should use a GtkIconFactory and make my icon go into stock so I can do gtk_status_icon_set_from_stock (), but I noticed this bug and I don't think that a bad practice (of the programmer) should be excuse for an unexpected behavior (of gtk+). Note2: If I'm saying nonsense stuff I will understand if you mark as NOTABUG :). Be kind, I'm not much of a GTK+ master.
Duplicate of bug 340107. It works if you only get the size in the size-changed signal callback.
I think you are right chpe.
Closing, based on last comment by chpe *** This bug has been marked as a duplicate of 340107 ***