Philipp Hörist pushed to branch master at gajim / gajim

Commits:
417464d9 by Philipp Hörist at 2017-10-31T17:29:54+01:00
Remove advanced commandline handling

Its enough to connect to the handle-local-options signal for what we
currently want to do.

- - - - -
cb3d4f46 by Philipp Hörist at 2017-10-31T17:33:02+01:00
Update nbxmpp dependency to 0.6.0

- - - - -
a7e53eb0 by Philipp Hörist at 2017-10-31T17:33:32+01:00
Catch Application signals instead of overwriting

- - - - -
1b9c5066 by Philipp Hörist at 2017-10-31T17:33:32+01:00
Add Option to hide Gajim on pressing close

This also adds that Gajim gets present if Gajim is launched a second time

- - - - -


4 changed files:

- gajim/common/config.py
- gajim/gajim.py
- gajim/roster_window.py
- setup.py


Changes:

=====================================
gajim/common/config.py
=====================================
--- a/gajim/common/config.py
+++ b/gajim/common/config.py
@@ -237,6 +237,7 @@ class Config:
             'notification_position_y': [opt_int, -1],
             'muc_highlight_words': [opt_str, '', _('A semicolon-separated list 
of words that will be highlighted in group chats.')],
             'quit_on_roster_x_button': [opt_bool, False, _('If True, quits 
Gajim when X button of Window Manager is clicked. This setting is taken into 
account only if notification icon is used.')],
+            'hide_on_roster_x_button': [opt_bool, False, _('If True, Gajim 
hides the Roster window on pressing the X button instead of minimizing into the 
Dock.')],
             'show_unread_tab_icon': [opt_bool, False, _('If True, Gajim will 
display an icon on each tab containing unread messages. Depending on the theme, 
this icon may be animated.')],
             'show_status_msgs_in_roster': [opt_bool, True, _('If True, Gajim 
will display the status message, if not empty, for every contact under the 
contact name in roster window.'), True],
             'show_avatars_in_roster': [opt_bool, True, '', True],


=====================================
gajim/gajim.py
=====================================
--- a/gajim/gajim.py
+++ b/gajim/gajim.py
@@ -53,15 +53,14 @@ from gajim.common import i18n
 from gajim.common import logging_helpers
 from gajim.common import crypto
 
-MIN_NBXMPP_VER = "0.5.6"
+MIN_NBXMPP_VER = "0.6.0"
 
 
 class GajimApplication(Gtk.Application):
     '''Main class handling activation and command line.'''
 
     def __init__(self):
-        Gtk.Application.__init__(self, application_id='org.gajim.Gajim',
-                                 
flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
+        Gtk.Application.__init__(self, application_id='org.gajim.Gajim')
 
         self.add_main_option('version', ord('V'), GLib.OptionFlags.NONE,
                              GLib.OptionArg.NONE,
@@ -94,6 +93,10 @@ class GajimApplication(Gtk.Application):
                              GLib.OptionArg.STRING_ARRAY,
                              "")
 
+        self.connect('handle-local-options', self._handle_local_options)
+        self.connect('startup', self._startup)
+        self.connect('activate', self._activate)
+
         self.profile = ''
         self.config_path = None
         self.profile_separation = False
@@ -103,9 +106,7 @@ class GajimApplication(Gtk.Application):
         if GLib.get_application_name() != 'Gajim':
             GLib.set_application_name('Gajim')
 
-    def do_startup(self):
-        Gtk.Application.do_startup(self)
-
+    def _startup(self, application):
         from gajim import gtkexcepthook
         gtkexcepthook.init()
 
@@ -222,8 +223,10 @@ class GajimApplication(Gtk.Application):
             menubar.prepend_submenu('Gajim', appmenu)
         self.set_menubar(menubar)
 
-    def do_activate(self):
-        Gtk.Application.do_activate(self)
+    def _activate(self, application):
+        if self.interface is not None:
+            self.interface.roster.window.present()
+            return
         from gajim.gui_interface import Interface
         from gajim import gtkgui_helpers
         self.interface = Interface()
@@ -243,7 +246,8 @@ class GajimApplication(Gtk.Application):
         from gajim.common import app
         app.logger.commit()
 
-    def do_handle_local_options(self, options: GLib.VariantDict) -> int:
+    def _handle_local_options(self, application,
+                              options: GLib.VariantDict) -> int:
 
         logging_helpers.init()
 
@@ -277,12 +281,6 @@ class GajimApplication(Gtk.Application):
             return 0
         return -1
 
-    def do_command_line(self, command_line: Gio.ApplicationCommandLine) -> int:
-        Gtk.Application.do_command_line(self, command_line)
-        if not command_line.get_is_remote():
-            self.activate()
-        return 0
-
     def show_warnings(self):
         import traceback
         import warnings


=====================================
gajim/roster_window.py
=====================================
--- a/gajim/roster_window.py
+++ b/gajim/roster_window.py
@@ -2406,7 +2406,10 @@ class RosterWindow:
                 x, y = self.window.get_position()
                 app.config.set('roster_x-position', x)
                 app.config.set('roster_y-position', y)
-            self.window.iconify()
+            if app.config.get('hide_on_roster_x_button'):
+                self.window.hide()
+            else:
+                self.window.iconify()
         elif app.config.get('quit_on_roster_x_button'):
             self.on_quit_request()
         else:
@@ -3755,7 +3758,10 @@ class RosterWindow:
             'quit_on_roster_x_button') and ((app.interface.systray_enabled and\
             app.config.get('trayicon') == 'always') or app.config.get(
             'allow_hide_roster')):
-                self.window.iconify()
+                if app.config.get('hide_on_roster_x_button'):
+                    self.window.hide()
+                else:
+                    self.window.iconify()
         elif event.get_state() & Gdk.ModifierType.CONTROL_MASK and 
event.keyval == \
         Gdk.KEY_i:
             treeselection = self.tree.get_selection()


=====================================
setup.py
=====================================
--- a/setup.py
+++ b/setup.py
@@ -269,7 +269,7 @@ setup(
     data_files=data_files,
     install_requires=[
         'dbus-python;sys_platform=="linux"',
-        'nbxmpp',
+        'nbxmpp>=0.6.0',
         'pyOpenSSL>=0.12',
         'pyasn1',
     ],



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/compare/0b21c12c416aa79b64a9654fc90ca7150087f545...1b9c5066f59fab6ac8b967999b155ea0eca31454

---
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/compare/0b21c12c416aa79b64a9654fc90ca7150087f545...1b9c5066f59fab6ac8b967999b155ea0eca31454
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to