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


Commits:
97487bf7 by Philipp Hörist at 2025-03-17T23:56:52+01:00
fix: Disable start chat buttons if no accounts are active

- - - - -


2 changed files:

- gajim/gtk/chat_list.py
- gajim/gtk/chat_stack.py


Changes:

=====================================
gajim/gtk/chat_list.py
=====================================
@@ -339,11 +339,14 @@ def process_event(self, event: events.ChatListEventT) -> 
None:
             log.warning("Unhandled Event: %s", event.name)
 
     def _set_placeholder(self) -> None:
-        button = Gtk.Button.new_with_label(_("Start Chat"))
+        button = Gtk.Button(
+            label=_("Start Chat"),
+            halign=Gtk.Align.CENTER,
+            valign=Gtk.Align.CENTER,
+            action_name="app.start-chat",
+            action_target=GLib.Variant("as", ["", ""]),
+        )
         button.add_css_class("suggested-action")
-        button.set_halign(Gtk.Align.CENTER)
-        button.set_valign(Gtk.Align.CENTER)
-        button.connect("clicked", self._on_start_chat_clicked)
         self.set_placeholder(button)
 
     def _emit_unread_changed(self) -> None:
@@ -525,10 +528,6 @@ def _on_cursor_leave(self, _controller: 
Gtk.EventControllerMotion) -> None:
         self._mouseover = False
         self._schedule_check_sort_inhibit()
 
-    @staticmethod
-    def _on_start_chat_clicked(_button: Gtk.Button) -> None:
-        app.app.activate_action("start-chat", GLib.Variant("as", ["", ""]))
-
     @staticmethod
     def _get_nick_for_received_message(account: str, message: Message) -> str:
 


=====================================
gajim/gtk/chat_stack.py
=====================================
@@ -868,10 +868,10 @@ def __init__(self):
         image.set_opacity(0.2)
         self.append(image)
 
-        button = Gtk.Button(label=_("Start Chatting…"))
-        button.set_halign(Gtk.Align.CENTER)
-        button.connect("clicked", self._on_start_chatting)
+        button = Gtk.Button(
+            label=_("Start Chatting…"),
+            halign=Gtk.Align.CENTER,
+            action_name="app.start-chat",
+            action_target=GLib.Variant("as", ["", ""]),
+        )
         self.append(button)
-
-    def _on_start_chatting(self, _button: Gtk.Button) -> None:
-        app.app.activate_action("start-chat", GLib.Variant("as", ["", ""]))



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

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/97487bf7b34bfcf88cb978379f9e9e4b17531fbe
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to