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


Commits:
5dca1597 by wurstsalat at 2024-11-06T22:18:47+01:00
refactor: OMEMOTrustManager: Fix QR button position

- - - - -
d144f8a6 by wurstsalat at 2024-11-06T22:18:47+01:00
refactor: AddContact: Fix groups combo, fix account combo

- - - - -


3 changed files:

- gajim/data/gui/add_contact.ui
- gajim/data/gui/omemo_trust_manager.ui
- gajim/gtk/add_contact.py


Changes:

=====================================
gajim/data/gui/add_contact.ui
=====================================
@@ -1,12 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk" version="4.0"/>
-  <object class="GtkListStore" id="account_liststore">
-    <columns>
-      <column type="gchararray"/>
-      <column type="gchararray"/>
-    </columns>
-  </object>
   <object class="GtkBox" id="address_box">
     <property name="halign">center</property>
     <property name="orientation">vertical</property>
@@ -37,7 +31,6 @@
         </child>
         <child>
           <object class="GtkComboBox" id="account_combo">
-            <property name="model">account_liststore</property>
             <property name="id-column">0</property>
             <child>
               <object class="GtkCellRendererText" id="cellrenderertext3"/>
@@ -124,13 +117,6 @@
     <child>
       <object class="GtkComboBoxText" id="group_combo">
         <property name="has-entry">1</property>
-        <property name="child">
-          <object class="GtkEntry">
-            <property name="visible">0</property>
-            <property name="focusable">1</property>
-            <property name="placeholder-text" translatable="1">Choose a 
group…</property>
-          </object>
-        </property>
         <layout>
           <property name="column">1</property>
           <property name="row">3</property>


=====================================
gajim/data/gui/omemo_trust_manager.ui
=====================================
@@ -120,6 +120,7 @@
                             <property name="focusable">1</property>
                             <property name="receives-default">1</property>
                             <property name="tooltip-text" 
translatable="1">Scan QR Code</property>
+                            <property name="hexpand">1</property>
                             <property name="halign">end</property>
                             <property name="valign">center</property>
                             <property name="direction">up</property>


=====================================
gajim/gtk/add_contact.py
=====================================
@@ -212,8 +212,9 @@ def __init__(self, account: str | None, jid: JID | None) -> 
None:
         self._connect(self._ui.address_entry, "changed", self._set_complete)
 
         accounts = app.get_enabled_accounts_with_labels(connected_only=True)
-        liststore = self._ui.account_combo.get_model()
-        assert isinstance(liststore, Gtk.ListStore)
+
+        liststore = Gtk.ListStore(str, str)
+        self._ui.account_combo.set_model(liststore)
         for acc in accounts:
             liststore.append(acc)
 
@@ -335,6 +336,11 @@ def __init__(self) -> None:
         self._ui = get_builder("add_contact.ui")
         self.append(self._ui.contact_grid)
 
+        entry = self._ui.group_combo.get_child()
+        assert isinstance(entry, Gtk.Entry)
+        entry.set_activates_default(True)
+        entry.set_placeholder_text(_("Choose a group…"))
+
         self._connect(self._ui.contact_info_button, "clicked", 
self._on_info_clicked)
 
     def get_visible_buttons(self) -> list[str]:
@@ -366,7 +372,9 @@ def _on_info_clicked(self, _button: Gtk.Button) -> None:
         open_window("ContactInfo", account=self._account, 
contact=self._contact)
 
     def get_subscription_data(self) -> dict[str, str | list[str] | bool]:
-        group = self._ui.group_combo.get_child().get_text()
+        entry = self._ui.group_combo.get_child()
+        assert isinstance(entry, Gtk.Entry)
+        group = entry.get_text()
         groups = [group] if group else []
         return {
             "message": self._ui.message_entry.get_text(),



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/088fc35a8421c973c8f6ed6c508647272b7e8282...d144f8a61e493bbdb67cedd263f8d9bd614a1f65

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/088fc35a8421c973c8f6ed6c508647272b7e8282...d144f8a61e493bbdb67cedd263f8d9bd614a1f65
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