[polari/wip/fmuellner/remove-close-confirmation-dialog: 5/6] app: Do not auto-enable autostart when running in background



commit 334c635f576c58e17064a8f03703c9e63b214a4b
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Nov 1 12:18:08 2018 +0100

    app: Do not auto-enable autostart when running in background
    
    Polari is a user application rather than a service, so whether it should
    be started at login is better left to the user than tied to the desire
    to get its window out of the way.
    
    We also never put the hacks and sandbox holes in place that would have
    made it work with flatpak, so this also removes an inconsistency between
    distribution channels.
    
    https://gitlab.gnome.org/GNOME/polari/issues/89

 data/meson.build                        |  1 -
 data/org.gnome.Polari.Autostart.desktop |  6 ------
 data/resources/main-window.ui           |  2 +-
 src/application.js                      | 38 ---------------------------------
 4 files changed, 1 insertion(+), 46 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index bfff80b..849cdbb 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -37,5 +37,4 @@ foreach s : services
 endforeach
 
 install_data(app_id + '.gschema.xml', install_dir: schemadir)
-install_data(app_id + '.Autostart.desktop', install_dir: pkgdatadir)
 install_data('Polari.client', install_dir: tpclientdir)
diff --git a/data/resources/main-window.ui b/data/resources/main-window.ui
index 9247e48..e0675cb 100644
--- a/data/resources/main-window.ui
+++ b/data/resources/main-window.ui
@@ -12,7 +12,7 @@
   <object class="GtkMessageDialog" id="closeConfirmationDialog">
     <property name="message-type">question</property>
     <property name="text" translatable="yes">Run Polari in the Background?</property>
-    <property name="secondary-text" translatable="yes">Polari will continue to run when closed and will be 
automatically started on login.</property>
+    <property name="secondary-text" translatable="yes">Polari will continue to run when closed.</property>
     <property name="destroy-with-parent">true</property>
     <property name="modal">true</property>
     <signal name="delete-event" handler="hide_on_delete"/>
diff --git a/src/application.js b/src/application.js
index a8f9877..33ca652 100644
--- a/src/application.js
+++ b/src/application.js
@@ -19,9 +19,6 @@ const MAX_RETRIES = 3;
 
 const IRC_SCHEMA_REGEX = /^(irc?:\/\/)([\da-z.-]+):?(\d+)?\/(?:%23)?([\w.+-]+)/i;
 
-const AUTOSTART_DIR = `${GLib.get_user_config_dir()}${'/'}autostart`;
-const AUTOSTART_FILE = '/org.gnome.Polari.Autostart.desktop';
-
 var Application = GObject.registerClass({
     Signals: { 'prepare-shutdown': {},
                'room-focus-changed': {} },
@@ -271,10 +268,6 @@ var Application = GObject.registerClass({
         let action = this._settings.create_action('run-in-background');
         this.add_action(action);
 
-        this._settings.connect('changed::run-in-background',
-                               this._onRunInBackgroundChanged.bind(this));
-        this._onRunInBackgroundChanged();
-
         for (let i = 1; i < 10; i++)
             this.set_accels_for_action(`app.nth-room(${i})`, [`<Alt>${i}`]);
 
@@ -754,37 +747,6 @@ var Application = GObject.registerClass({
         dialog.show();
     }
 
-    _createLink(file, target) {
-        try {
-            file.get_parent().make_directory_with_parents(null);
-        } catch (e) {
-            if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.EXISTS))
-                throw e;
-            // not an error, carry on
-        }
-
-        file.make_symbolic_link(target, null);
-    }
-
-    _onRunInBackgroundChanged() {
-        let file = Gio.File.new_for_path(`${AUTOSTART_DIR}${AUTOSTART_FILE}`);
-
-        if (this._settings.get_boolean('run-in-background'))
-            try {
-                this._createLink(file, `${pkg.pkgdatadir}${AUTOSTART_FILE}`);
-            } catch (e) {
-                if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.EXISTS))
-                    log(`Failed to create autostart link: ${e.message}`);
-            }
-        else
-            try {
-                file.delete(null);
-            } catch (e) {
-                if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_FOUND))
-                    log(`Failed to remove autostart link: ${e.message}`);
-            }
-    }
-
     _onStartClient() {
         if (this._telepathyClient)
             return;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]