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 555369 - gnome-session-properties work improperly when key X-GNOME-Autostart-enabled=false in .desktop
gnome-session-properties work improperly when key X-GNOME-Autostart-enabled=f...
Status: RESOLVED FIXED
Product: gnome-session
Classification: Core
Component: gnome-session-properties
git master
Other opensolaris
: Normal major
: ---
Assigned To: Session Maintainers
Session Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-10-07 09:50 UTC by Halton Huo
Modified: 2009-01-08 01:29 UTC
See Also:
GNOME target: ---
GNOME version: 2.23/2.24


Attachments
patch for bug #555369 (5.43 KB, patch)
2008-10-08 03:22 UTC, Halton Huo
committed Details | Review

Description Halton Huo 2008-10-07 09:50:45 UTC
I have some .desktop under /etc/xdg/autostart, their key X-GNOME-Autostart-enabled=false by default. g-s-p work improperly for these kind of .desktop files.

Take a look an example:
$cat /etc/xdg/autostart/test.desktop 
[Desktop Entry]
Name=A Test autostart
Comment=this is a test
Exec=gedit
Icon=
Terminal=false
Type=Application
X-GNOME-Autostart-enabled=false

Enable "A Test autostart" with gnome-session-properties, file ~/.config/autostart/test.desktop is not created.
Disable it, ~/.config/autostart/test.desktop is created and X-GNOME-Autostart-enabled=false
$grep X-GNOME-Autostart-enabled ~/.config/autostart/test.desktop
X-GNOME-Autostart-enabled=false

Guess g-s-p does not look at the default value for key X-GNOME-Autostart-enabled. It simply create copy with false when disable, and remove that copy when enable. That will cause this bug.
Comment 1 Halton Huo 2008-10-08 03:22:34 UTC
Created attachment 120176 [details] [review]
patch for bug #555369

Checking code r5133, the logic is really wrong when key X-GNOME-Autostart-enabled=false in system .desktop files. 

The main idea is 
if (original_enabled == enaled) {
   // remove user .desktop file
} else {
   // write user .desktop with new key_value 
}
Most part in enable_app() can be reused, disable_app() is no use. So I remove disable_app() and rename enable_app() to switch_app(), and add new parameter enabled to stand for the new key value.

I've tested three kind of .desktop files:
1) test.desktop (X-GNOME-Autostart-enabled=false)
2) gnome-at-session.desktop (X-GNOME-Autostart-enabled=true)
3) gnome-settings-daemon.desktop (no X-GNOME-Autostart-enabled key)

When enable 1), ~/.config/autostart/test.desktop is created with X-GNOME-Autostart-enabled=true; when disable it, ~/.config/autostart/test.desktop is removed

When disable 2), ~/.config/autostart/gnome-at-session is created with X-GNOME-Autostart-enabled=false; when enabled it, ~/.config/autostart/gnome-at-session is removed

3) is same with 2)
Comment 2 Matthias Clasen 2008-11-08 03:21:47 UTC
Patch makes sense to me.
Comment 3 Lucas Rocha 2009-01-08 01:29:37 UTC
Commited with some cosmetic changes. Thanks!