After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 377674 - GtkStatusIcon reports 200 as size if is not embedded
GtkStatusIcon reports 200 as size if is not embedded
Status: RESOLVED DUPLICATE of bug 340107
Product: gtk+
Classification: Platform
Component: .General
2.10.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-11-21 07:41 UTC by Diego Escalante Urrelo (not reading bugmail)
Modified: 2006-12-03 05:20 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Diego Escalante Urrelo (not reading bugmail) 2006-11-21 07:41:51 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.
Comment 1 Christian Persch 2006-11-21 12:33:21 UTC
Duplicate of bug 340107.

It works if you only get the size in the size-changed signal callback.
Comment 2 Diego Escalante Urrelo (not reading bugmail) 2006-11-22 01:41:52 UTC
I think you are right chpe.
Comment 3 Diego Escalante Urrelo (not reading bugmail) 2006-12-03 05:20:47 UTC
Closing, based on last comment by chpe

*** This bug has been marked as a duplicate of 340107 ***