Daniel Brötzmann pushed to branch mainwindow at gajim / gajim


Commits:
a1ef719a by wurstsalat at 2021-05-22T09:32:25+02:00
StatusSelector: Add account parameter

- - - - -


4 changed files:

- gajim/gtk/account_page.py
- gajim/gtk/app_page.py
- gajim/gtk/status_selector.py
- gajim/gui_interface.py


Changes:

=====================================
gajim/gtk/account_page.py
=====================================
@@ -45,7 +45,7 @@ def __init__(self, account):
         self._ui = get_builder('account_page.ui')
         self.add(self._ui.paned)
 
-        self._status_selector = StatusSelector()
+        self._status_selector = StatusSelector(account=account)
         self._status_selector.set_halign(Gtk.Align.CENTER)
         self._ui.account_action_box.add(self._status_selector)
 


=====================================
gajim/gtk/app_page.py
=====================================
@@ -19,6 +19,7 @@
 from gajim.common.helpers import open_uri
 from gajim.common.i18n import _
 
+from .status_selector import StatusSelector
 from .util import get_builder
 
 
@@ -33,13 +34,24 @@ class AppPage(Gtk.Box):
     def __init__(self):
         Gtk.Box.__init__(self,
                          orientation=Gtk.Orientation.VERTICAL,
-                         spacing=12)
+                         spacing=6)
         self.get_style_context().add_class('app-page')
-
         self._unread_count = 0
 
+        gajim_label = Gtk.Label(label=_('Status'))
+        gajim_label.get_style_context().add_class('large-header')
+        self.add(gajim_label)
+        status_label = Gtk.Label(label=_('Status for all accounts'))
+        status_label.get_style_context().add_class('dim-label')
+        self.add(status_label)
+
+        self._status_selector = StatusSelector()
+        self._status_selector.set_halign(Gtk.Align.CENTER)
+        self.add(self._status_selector)
+
         update_label = Gtk.Label(label=_('Updates'))
         update_label.get_style_context().add_class('large-header')
+        update_label.get_style_context().add_class('margin-top12')
         self.add(update_label)
 
         self._app_message_listbox = AppMessageListBox()


=====================================
gajim/gtk/status_selector.py
=====================================
@@ -27,9 +27,10 @@
 
 
 class StatusSelector(Gtk.MenuButton):
-    def __init__(self, compact=False):
+    def __init__(self, account=None, compact=False):
         Gtk.MenuButton.__init__(self)
         self.set_direction(Gtk.ArrowType.UP)
+        self._account = account
         self._compact = compact
         self._create_popover()
 
@@ -112,7 +113,7 @@ def _on_change_status(self, button):
         new_status = button.get_name()
         if new_status == 'change_status_message':
             new_status = None
-        app.interface.change_status(status=new_status)
+        app.interface.change_status(status=new_status, account=self._account)
         self.update()
 
     def update(self, *args, **kwargs):
@@ -121,7 +122,11 @@ def update(self, *args, **kwargs):
         #     return
 
         # self.show()
-        show = get_global_show()
+        if self._account is not None:
+            client = app.get_client(self._account)
+            show = client.status
+        else:
+            show = get_global_show()
         uf_show = get_uf_show(show)
 
         surface = get_show_circle(


=====================================
gajim/gui_interface.py
=====================================
@@ -1496,7 +1496,7 @@ def autoconnect(self):
 
             app.connections[account].change_status(status, status_message)
 
-    def change_status(self, status):
+    def change_status(self, status, account=None):
         ask = ask_for_status_message(status)
 
         if status is None:
@@ -1506,6 +1506,10 @@ def change_status(self, status):
             open_window('StatusChange', status=status)
             return
 
+        if account is not None:
+            self._change_status(account, status)
+            return
+
         for account in app.connections:
             if not app.settings.get_account_setting(account,
                                                     'sync_with_global_status'):



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/a1ef719a3395f60cbd0be09aec3b6b15a456ff3a

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/a1ef719a3395f60cbd0be09aec3b6b15a456ff3a
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