GNOME Bugzilla – Bug 555369
gnome-session-properties work improperly when key X-GNOME-Autostart-enabled=false in .desktop
Last modified: 2009-01-08 01:29:37 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.
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)
Patch makes sense to me.
Commited with some cosmetic changes. Thanks!