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 127285 - Workspace switcher applet displays only one workspace when added to panel.
Workspace switcher applet displays only one workspace when added to panel.
Status: RESOLVED FIXED
Product: GConf
Classification: Deprecated
Component: gconf
unspecified
Other Linux
: Normal minor
: ---
Assigned To: GConf Maintainers
GConf Maintainers
: 140277 163093 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2003-11-18 12:42 UTC by Vijaykumar Patwari
Modified: 2006-01-06 08:08 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
Probable fix (864 bytes, patch)
2003-11-19 14:11 UTC, Vijaykumar Patwari
none Details | Review
Patch Fixes the bug. (2.88 KB, patch)
2004-07-07 05:09 UTC, Vijaykumar Patwari
none Details | Review
Remove entries from cache when removing a directory (1.65 KB, patch)
2006-01-01 17:44 UTC, Vincent Untz
needs-work Details | Review

Description Vijaykumar Patwari 2003-11-18 12:42:35 UTC
1) Add few instances (say around 5) of workspace switcher applet to panel. 
2) Remove some of the instances of it. 
3) Then try to add the applet again, 
	only one workspace is shown.  

Note : If still not reproducible, follow steps 1 to 3 again and again.
Comment 1 Vijaykumar Patwari 2003-11-19 14:11:22 UTC
Created attachment 21620 [details] [review]
Probable fix
Comment 2 Vijaykumar Patwari 2003-11-19 14:30:37 UTC
Mark: There seems to be a timing issue for the occurance of this
bug. Noticed that the gconf is returning FALSE for the 
display_all_workspaces key when the "applet_id" is re-used in 
"/app/panel/profiles/default/applets/applet_id/prefs".
Doing a gconf_client_remove_dir() appears solves the problem. It seems
to have fixed tasklist max and min size sometimes going 0 as well.
Comment 3 Mark McLoughlin 2003-12-02 18:24:44 UTC
I'm really glad you tracked this down. I've committed a similar patch
to HEAD:

2003-12-02  Mark McLoughlin  <mark@skynet.ie>
                                                                     
                                                                         
        Make sure to stop monitoring the applet's GConf directory so
        that if we remove an applet the directory goes away completely
        before. Based a patch from Vijaykumar Patwari in #127285.
                                                                     
                                                                         
        * panel-applet.c:
        (panel_applet_add_preferences): don't start monitoring the
        dir here.
        (panel_applet_set_preferences_key): do it here and also remove
        the dir when we're unsetting.
        (panel_applet_finalize): unset the prefs key so the dir isn't
        monitored anymore.
        (panel_applet_item_handler_get_object): use set_prefs_key().
        (panel_applet_instance_init): initialize the GConfClient here.
Comment 4 Vijaykumar Patwari 2003-12-19 10:12:07 UTC
Mark: I can still reproduce the problem. So re-opening the bug
Comment 5 Luis Villa 2004-01-03 19:37:05 UTC
Can still reproduce with HEAD or with an older build?
Comment 6 Vincent Untz 2004-02-05 15:21:07 UTC
Vijay: ping?
Comment 7 Vijaykumar Patwari 2004-02-06 03:55:13 UTC
Sorry for the late response, apologies!. Yes i can still reproduce
with HEAD.
Comment 8 Bart Martens 2004-02-19 19:03:19 UTC
I just reproduced this bug a few times on Fedora Core 1 with
gnome-panel-2.4.0-3.
Comment 9 Arvind S N 2004-05-31 05:59:53 UTC
*** Bug 140277 has been marked as a duplicate of this bug. ***
Comment 10 Vijaykumar Patwari 2004-07-07 05:09:42 UTC
Created attachment 29303 [details] [review]
Patch Fixes the bug.
Comment 11 Vincent Noel 2004-08-12 15:59:25 UTC
ping : can this patch be committed ?
Comment 12 Vincent Untz 2004-08-16 09:16:27 UTC
It looks ok, but I'd prefer if Mark could look at it because I'm not a
libpanel-applet expert.
Comment 13 Vincent Noel 2004-10-01 20:16:46 UTC
Mark : ping ?
Comment 14 Mark McLoughlin 2004-10-04 16:31:00 UTC
Vijay: I don't understand how/why this fixes the bug. Could you explain?

All it seems to do is delay the add_dir() until we do add_preferences().
Comment 15 Vincent Untz 2004-12-21 18:08:52 UTC
Vijay: ping ?
Comment 16 Vijaykumar Patwari 2004-12-22 04:58:21 UTC
Oops sorry Mark, Vincent, I missed out this mail.

Basically it looks like, it is watching the directory without having gconf
values set for the keys.

So, this fix first associates gconf values for the schema key, and then add
directory to the list of directories that GConfClient will watch.
Comment 17 Vincent Untz 2005-01-07 08:25:09 UTC
Mark: is it clearer for you now?
Comment 18 Vincent Untz 2005-01-10 08:02:15 UTC
Could bug #163093 be related to this?
Comment 19 Vijaykumar Patwari 2005-01-10 08:48:48 UTC
Vincent: I have updated the bug #163093 with comments. Looks to be similar, but
not very sure :).
Comment 20 Vincent Untz 2006-01-01 14:50:26 UTC
I can reproduce with HEAD.
Comment 21 Vincent Untz 2006-01-01 16:02:22 UTC
*** Bug 163093 has been marked as a duplicate of this bug. ***
Comment 22 Vincent Untz 2006-01-01 17:18:40 UTC
Note for myself: what might be going on here is that when we do gconf_client_remove_dir(), the cache of the gconf client might not remove the data for the directory. Or something like this. Might be a gconf bug.
Comment 23 Vincent Untz 2006-01-01 17:36:05 UTC
I made a patch for gconf and it fixes it. Will attach it in a few minutes.
Comment 24 Vincent Untz 2006-01-01 17:44:45 UTC
Created attachment 56635 [details] [review]
Remove entries from cache when removing a directory

So, I think what's happening here is that the cache contained some old entries that didn't get updated. Some background:

 + when you remove an applet from the panel, the gconf directory containing the prefs of the applet is removed
 + wnck-applet continues running if you remove the workspace switcher since it also contains some other applets
 + when an applet is removed, we tell the gconf library we're not interested in the gconf directory of this applet anymore, but it keeps in cache the previous values
 + when we reuse the same applet number in the panel, and old gconf directory is used for the pref. It doesn't contain anything (yet), but in this case, values are still in the cache

Solution: when we tell the gconf client we're not interested in a directory anymore, remove values from the cache. It works for me.
Comment 25 Mark McLoughlin 2006-01-05 08:14:59 UTC
Nice catch vuntz - my main suggestion would be to use gconf_key_is_below() in clear_dir_cache_foreach() ... i.e. /foofoo isn't under /foo

Another problem is that we are be removing too much from the cache - i.e. if we do

  gconf_client_add_dir (client, "/foo/bar");

  entry = get (client, "/foo/bar/1");

  gconf_client_add_dir (client, "/foo");
  gconf_client_remove_dir (client, "/foo");

then the entry for "/foo/bar/1" isn't cache before, even though it clearly should be. The only problem that would cause, though, is that the value would have to be re-fetched.

That's a minor issue compared to the fact that we seem to be removing the notify for "/foo/bar" when we remove "/foo" - see foreach_setup_overlap() 

So ... the patch looks good to me - make it use gconf_key_is_below() and commit
Comment 26 Mark McLoughlin 2006-01-05 08:16:22 UTC
s/isn't cache before/isn't cached anymore/
Comment 27 Vincent Untz 2006-01-05 20:20:00 UTC
Thanks, committed in HEAD. Should I commit to gnome-2-12?
Comment 28 Mark McLoughlin 2006-01-06 08:08:15 UTC
Sure, sounds sensible for gnome-2-12