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


Commits:
1f752748 by Philipp Hörist at 2024-11-10T23:13:45+01:00
refactor: DropDown: Improve width settings

- - - - -


2 changed files:

- gajim/gtk/dropdown.py
- gajim/gtk/settings.py


Changes:

=====================================
gajim/gtk/dropdown.py
=====================================
@@ -27,8 +27,6 @@ def __init__(
         Gtk.DropDown.__init__(self)
 
         self._kwargs: dict[str, Any] = {
-            "ellipsize": Pango.EllipsizeMode.END,
-            "xalign": 0,
             "width_chars": fixed_width,
             "max_width_chars": fixed_width,
         }
@@ -51,9 +49,7 @@ def __init__(
         self.set_factory(factory)
 
         factory = Gtk.SignalListItemFactory()
-        factory.connect(
-            "setup", self._on_factory_setup, KeyValueViewListItem, self._kwargs
-        )
+        factory.connect("setup", self._on_factory_setup, KeyValueViewListItem, 
{})
         factory.connect("bind", self._on_factory_bind)
 
         self.set_list_factory(factory)
@@ -116,10 +112,16 @@ class KeyValueItem(GObject.Object):
 
 
 class KeyValueViewItem(Gtk.Label):
+    def __init__(self, **kwargs: Any):
+        Gtk.Label.__init__(self, ellipsize=Pango.EllipsizeMode.END, xalign=0, 
**kwargs)
+
     def bind(self, item: KeyValueItem) -> None:
         self.set_label(item.value)
 
 
 class KeyValueViewListItem(Gtk.Label):
+    def __init__(self, **kwargs: Any):
+        Gtk.Label.__init__(self, ellipsize=Pango.EllipsizeMode.END, xalign=0, 
**kwargs)
+
     def bind(self, item: KeyValueItem) -> None:
         self.set_label(item.value)


=====================================
gajim/gtk/settings.py
=====================================
@@ -681,7 +681,7 @@ def __init__(
         box.set_halign(Gtk.Align.END)
         box.set_hexpand(True)
 
-        self._dropdown = GajimDropDown(data=data)
+        self._dropdown = GajimDropDown(data=data, fixed_width=15)
         self._dropdown.select_key(self.get_value())
         self._dropdown.connect("notify::selected", self._on_selected)
         box.append(self._dropdown)
@@ -705,6 +705,9 @@ def update_entries(self, data: list[str] | dict[str, str]) 
-> None:
         self._dropdown.set_data(data)
         self._dropdown.connect("notify::selected", self._on_selected)
 
+    def on_row_activated(self) -> None:
+        pass
+
 
 class PopoverRow(Gtk.ListBoxRow):
     def __init__(self, label: str, value: str) -> None:



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

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