[polari/wip/fmuellner/remove-background-feature] app: Remove run-in-background feature
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/remove-background-feature] app: Remove run-in-background feature
- Date: Thu, 24 Jan 2019 01:15:22 +0000 (UTC)
commit 0080316385b310e94904da71d23d3b1fba945f7e
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Nov 1 12:18:08 2018 +0100
app: Remove run-in-background feature
The feature was originally added to satisfy users that were missing
legacy status icon support offered by other IRC clients, without
falling to the dark side of actual status icons.
It did make Polari more service-like though, which is rather odd
for an IRC client, more so as the background-app pattern hasn't
really taken off in GNOME.
And considering that part of the feature (auto-enabling autostart)
never worked under flatpak, removing it looks like a good idea.
https://gitlab.gnome.org/GNOME/polari/issues/89
data/meson.build | 1 -
data/org.gnome.Polari.Autostart.desktop | 6 -----
data/org.gnome.Polari.gschema.xml | 5 ----
data/resources/main-window.ui | 26 -------------------
data/resources/menus.ui | 6 -----
src/application.js | 45 +--------------------------------
src/mainWindow.js | 42 +-----------------------------
7 files changed, 2 insertions(+), 129 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/org.gnome.Polari.gschema.xml b/data/org.gnome.Polari.gschema.xml
index 2d561e8..adaefa2 100644
--- a/data/org.gnome.Polari.gschema.xml
+++ b/data/org.gnome.Polari.gschema.xml
@@ -6,11 +6,6 @@
<summary>Saved channel list</summary>
<description>List of channels to restore on startup</description>
</key>
- <key type="b" name="run-in-background">
- <default>false</default>
- <summary>Run in Background</summary>
- <description>Keep running in background when closed.</description>
- </key>
<key type="ai" name="window-size">
<default>[800,500]</default>
<summary>Window size</summary>
diff --git a/data/resources/main-window.ui b/data/resources/main-window.ui
index 9247e48..4d8d142 100644
--- a/data/resources/main-window.ui
+++ b/data/resources/main-window.ui
@@ -9,32 +9,6 @@
<class name="polari-user-list"/>
</style>
</object>
- <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="destroy-with-parent">true</property>
- <property name="modal">true</property>
- <signal name="delete-event" handler="hide_on_delete"/>
- <child type="action">
- <object class="GtkButton" id="quitButton">
- <property name="label" translatable="yes">_Quit</property>
- <property name="visible">true</property>
- <property name="use-underline">true</property>
- </object>
- </child>
- <child type="action">
- <object class="GtkButton" id="backgroundButton">
- <property name="label" translatable="yes">_Run in background</property>
- <property name="visible">true</property>
- <property name="use-underline">true</property>
- </object>
- </child>
- <action-widgets>
- <action-widget response="close">quitButton</action-widget>
- <action-widget response="accept">backgroundButton</action-widget>
- </action-widgets>
- </object>
<template class="Gjs_MainWindow">
<property name="title" translatable="yes">Polari</property>
<property name="icon-name">org.gnome.Polari</property>
diff --git a/data/resources/menus.ui b/data/resources/menus.ui
index eff8d78..22f20e5 100644
--- a/data/resources/menus.ui
+++ b/data/resources/menus.ui
@@ -1,11 +1,5 @@
<interface>
<menu id="app-menu">
- <section>
- <item>
- <attribute name="action">app.run-in-background</attribute>
- <attribute name="label" translatable="yes">Run in Background</attribute>
- </item>
- </section>
<section>
<item>
<attribute name="action">win.show-help-overlay</attribute>
diff --git a/src/application.js b/src/application.js
index a8f9877..94d6447 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': {} },
@@ -267,18 +264,11 @@ var Application = GObject.registerClass({
this.add_action(action);
});
- this._settings = new Gio.Settings({ schema_id: 'org.gnome.Polari' });
- 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}`]);
this._telepathyClient = null;
+ this._settings = new Gio.Settings({ schema_id: 'org.gnome.Polari' });
this._roomManager = RoomManager.getDefault();
this._accountsMonitor = AccountsMonitor.getDefault();
@@ -353,8 +343,6 @@ var Application = GObject.registerClass({
} else {
let window = new MainWindow({ application: this });
this._windowRemovedId = this.connect('window-removed', () => {
- if (this._settings.get_boolean('run-in-background'))
- return;
this.emit('prepare-shutdown');
});
window.connect('notify::active-room',
@@ -754,37 +742,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;
diff --git a/src/mainWindow.js b/src/mainWindow.js
index dd65c51..560521b 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -87,8 +87,7 @@ var MainWindow = GObject.registerClass({
'userListPopover',
'roomListRevealer',
'overlay',
- 'roomStack',
- 'closeConfirmationDialog'],
+ 'roomStack'],
Properties: {
subtitle: GObject.ParamSpec.string('subtitle',
'subtitle',
@@ -184,19 +183,9 @@ var MainWindow = GObject.registerClass({
this._updateDecorations.bind(this));
this._updateDecorations();
- this._closeConfirmationDialog.transient_for = this;
- this._closeConfirmationDialog.connect('response', (w, r) => {
- if (r == Gtk.ResponseType.DELETE_EVENT)
- return;
-
- this._settings.set_boolean('run-in-background', r == Gtk.ResponseType.ACCEPT);
- this.destroy();
- });
-
this.connect('window-state-event', this._onWindowStateEvent.bind(this));
this.connect('size-allocate', this._onSizeAllocate.bind(this));
this.connect('destroy', this._onDestroy.bind(this));
- this.connect('delete-event', this._onDeleteEvent.bind(this));
this.connect('notify::active-room', () => {
this._updateUserListLabel();
});
@@ -255,35 +244,6 @@ var MainWindow = GObject.registerClass({
this._overlay.remove(this.application.commandOutputQueue);
}
- _touchFile(file) {
- 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
- }
-
- let stream = file.create(0, null);
- stream.close(null);
- }
-
- _onDeleteEvent() {
- let f = Gio.File.new_for_path(
- `${GLib.get_user_cache_dir()}/polari/close-confirmation-shown`
- );
- try {
- this._touchFile(f);
- } catch (e) {
- if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.EXISTS))
- return Gdk.EVENT_PROPAGATE; // the dialog has been shown
- log(`Failed to mark confirmation dialog as shown: ${e.message}`);
- }
-
- this._closeConfirmationDialog.show();
- return Gdk.EVENT_STOP;
- }
-
_onAccountsChanged() {
let hasAccounts = this._accountsMonitor.visibleAccounts.length > 0;
this._roomListRevealer.reveal_child = hasAccounts;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]