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 387215 - GtkStatusIcon doesn't signal when it is embedded
GtkStatusIcon doesn't signal when it is embedded
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
2.10.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-12-18 17:30 UTC by Martyn Russell
Modified: 2007-02-16 20:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix for this bug (6.06 KB, patch)
2006-12-18 17:33 UTC, Martyn Russell
none Details | Review
my proposed patch (8.64 KB, patch)
2006-12-18 22:36 UTC, Christian Persch
none Details | Review

Description Martyn Russell 2006-12-18 17:30:48 UTC
The issue here is that you can't rely on the _is_embedded() call straight after the icon is created. Since it is not instant, it would be better for applications developers to have a signal to watch out for instead of having to add their own timeouts.

Patch to follow.
Comment 1 Martyn Russell 2006-12-18 17:33:30 UTC
Created attachment 78578 [details] [review]
Fix for this bug

Is this good enough as is, or would it be better to have some sort of timeout for attempting to embed the status icon and signal if not possible?

I have also updated the documentation to mention that the _is_embedded() signal is not something you can rely on straight after calling _new().
Comment 2 Christian Persch 2006-12-18 18:22:53 UTC
I don't think we should be polling every 500ms whether the icon is embedded...

The backend tray (gtktrayicon-x11) knows when it's embedded, can't it signal and status icon just forward the signal?
Comment 3 Matthias Clasen 2006-12-18 18:26:51 UTC
I thought so and looked into it a bit some time ago, but AFAIR it wasn't entirely trivial.
Comment 4 Martyn Russell 2006-12-18 18:48:35 UTC
chpe: are you talking about the ::embedded signal for the GtkPlug? I agree having a 500ms timeout isn't great, which is why I asked about having a timeout for the polling to accept that it is not ever going to be embedded - or perhaps update the backend so we signal when we know either way.

I am not entirely sure which is the best way forward on this. From an application writer's point of view, I would rather have some sort of callback which returns the state (embedded or not) and times out after a period of 10 seconds. I wrote the patch with the thinking that the status icon could be embedded or not at any point and it was some state that could change often. If it is simply embedded once then a callback or property is better than a signal by far.

Comments?
Comment 5 Christian Persch 2006-12-18 22:36:15 UTC
Created attachment 78600 [details] [review]
my proposed patch

No, I wasn't talking about ::embedded on the GtkPlug (that signal is completely useless :).

But the GtkPlug knows when its embedding changes, so it should notify on this. This patch adds a "embedded" property on GtkPlug and makes the status icon listen to notify::embedded on its tray icon and forward the notification.

Playing with testtray and teststatusicon, this seems to work fine.
Comment 6 Martyn Russell 2006-12-19 09:29:57 UTC
Seems to work nicely, thanks chpe.
Comment 7 Matthias Clasen 2006-12-22 07:18:33 UTC
2006-12-22  Matthias Clasen  <mclasen@redhat.com>

        Make it possible to track the embeddedness of
        statusicon (#387215, Martyn Russell, patch by Christian
        Persch)

        * gtk/gtkstatusicon.c: Add orientation and embedded properties.
        * gtk/gtkplug.c:
        * gtk/gtkplug-x11.c: Add an embedded property.
        * tests/teststatusicon.c: Test the new properties.

Comment 8 Mikael Hallendal 2006-12-28 08:35:13 UTC
This patch breaks build on Windows and Mac OS X ports (and all other platforms that doesn't have a GtkTrayIcon.

Thread on gtk-devel-list: http://mail.gnome.org/archives/gtk-devel-list/2006-December/msg00112.html

Reopening.
Comment 9 Mikael Hallendal 2006-12-28 08:57:30 UTC
Noticed that Tor already commited this to CVS to closing again. Sorry for the noise.