Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hörist <philipp@hoerist.com>2023-04-23 17:24:24 +0300
committerPhilipp Hörist <philipp@hoerist.com>2023-04-23 17:27:26 +0300
commitb475635f488861c57597ab36c6af4d44484dd62b (patch)
tree3113bea13182e279c9b5869c1e3c0aa014a7fb5a
parent534f9f7e9c8ceee080bd3ad34b8e14a329b7ef41 (diff)
change: Raise gajim when no cmdline options are provided
- Remove the --show cmdline option because it is now obsolete Fixes #11482
-rw-r--r--data/gajim.13
-rw-r--r--data/gajim.1.md3
-rw-r--r--gajim/gtk/application.py28
3 files changed, 13 insertions, 21 deletions
diff --git a/data/gajim.1 b/data/gajim.1
index 681fd2bae..149445856 100644
--- a/data/gajim.1
+++ b/data/gajim.1
@@ -97,9 +97,6 @@ Profile application with cprofile
.TP
\f[V]--start-chat\f[R]
Start a new chat
-.TP
-\f[V]--show\f[R]
-Show Gajim
.SH FILES
.TP
$XDG_CACHE_HOME/gajim/
diff --git a/data/gajim.1.md b/data/gajim.1.md
index 53816654d..16c7ed4bc 100644
--- a/data/gajim.1.md
+++ b/data/gajim.1.md
@@ -69,9 +69,6 @@ protocol see https://xmpp.org/about/.
`--start-chat`
: Start a new chat
-`--show`
-: Show Gajim
-
# FILES
$XDG_CACHE_HOME/gajim/
diff --git a/gajim/gtk/application.py b/gajim/gtk/application.py
index 5dae8dcb9..d5864a5c6 100644
--- a/gajim/gtk/application.py
+++ b/gajim/gtk/application.py
@@ -193,14 +193,9 @@ class GajimApplication(Gtk.Application, CoreApplication):
GLib.OptionArg.NONE,
_('Start a new chat'))
- self.add_main_option(
- 'show', 0,
- GLib.OptionFlags.NONE,
- GLib.OptionArg.NONE,
- _('Show Gajim'))
-
self.add_main_option_entries(self._get_remaining_entry())
+ self.connect('activate', self._on_activate)
self.connect('handle-local-options', self._handle_local_options)
self.connect('command-line', self._command_line)
self.connect('shutdown', self._shutdown)
@@ -343,21 +338,25 @@ class GajimApplication(Gtk.Application, CoreApplication):
remote_commands = [
('start-chat', GLib.Variant('as', ['', ''])),
- ('show', None)
]
- remaining = options.lookup_value(GLib.OPTION_REMAINING,
- GLib.VariantType.new('as'))
-
for cmd, parameter in remote_commands:
if options.contains(cmd):
self.activate_action(cmd, parameter)
return 0
+ remaining = options.lookup_value(GLib.OPTION_REMAINING,
+ GLib.VariantType.new('as'))
+
if remaining is not None:
self._open_uris(remaining.unpack())
return 0
+ if not options.contains('is-first-startup'):
+ # If no commands have been handled and it's not the first
+ # startup, raise the application.
+ self.activate()
+
return 0
def _handle_local_options(self,
@@ -383,10 +382,14 @@ class GajimApplication(Gtk.Application, CoreApplication):
'The primary instance will handle remote commands')
return -1
+ options.insert_value('is-first-startup', GLib.Variant('b', True))
self._core_command_line(options)
self._startup()
return -1
+ def _on_activate(self, _application: Gtk.Application) -> None:
+ app.window.show()
+
def _add_app_actions(self) -> None:
for action in APP_ACTIONS:
action_name, variant = action
@@ -423,7 +426,6 @@ class GajimApplication(Gtk.Application, CoreApplication):
('forget-groupchat', self._on_forget_groupchat_action),
('open-chat', self._on_open_chat_action),
('mute-chat', self._on_mute_chat_action),
- ('show', self._on_show),
]
for action in actions:
@@ -872,7 +874,3 @@ class GajimApplication(Gtk.Application, CoreApplication):
client.get_module('Bookmarks').remove(params.jid)
app.storage.archive.remove_history(params.account, params.jid)
-
- @staticmethod
- def _on_show(_action: Gio.SimpleAction, param: GLib.Variant) -> None:
- app.window.show()