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


Commits:
9a3cb940 by wurstsalat at 2022-07-27T17:07:27+02:00
imprv: ContactInfo/GroupchatDetails: Toggle icon when editing name

- - - - -


5 changed files:

- gajim/data/gui/contact_info.ui
- gajim/data/gui/groupchat_details.ui
- gajim/gtk/builder.pyi
- gajim/gtk/contact_info.py
- gajim/gtk/groupchat_details.py


Changes:

=====================================
gajim/data/gui/contact_info.ui
=====================================
@@ -239,7 +239,7 @@
                     <property name="valign">center</property>
                     <signal name="toggled" handler="_on_edit_name_toggled" 
swapped="no"/>
                     <child>
-                      <object class="GtkImage">
+                      <object class="GtkImage" id="edit_name_button_image">
                         <property name="visible">True</property>
                         <property name="can-focus">False</property>
                         <property 
name="icon-name">document-edit-symbolic</property>
@@ -302,6 +302,7 @@
                         <child>
                           <object class="GtkLabel" id="contact_name_label">
                             <property name="visible">True</property>
+                            <property name="can-focus">False</property>
                             <property name="halign">center</property>
                             <property name="ellipsize">end</property>
                             <property name="single-line-mode">True</property>
@@ -319,6 +320,7 @@
                         <child>
                           <object class="GtkLabel" id="contact_jid_label">
                             <property name="visible">True</property>
+                            <property name="can-focus">False</property>
                             <property name="margin-bottom">6</property>
                             <property name="selectable">True</property>
                             <property name="ellipsize">end</property>


=====================================
gajim/data/gui/groupchat_details.ui
=====================================
@@ -61,7 +61,7 @@
                     <property name="valign">center</property>
                     <signal name="toggled" handler="_on_edit_name_toggled" 
swapped="no"/>
                     <child>
-                      <object class="GtkImage">
+                      <object class="GtkImage" id="edit_name_button_image">
                         <property name="visible">True</property>
                         <property name="can-focus">False</property>
                         <property 
name="icon-name">document-edit-symbolic</property>


=====================================
gajim/gtk/builder.pyi
=====================================
@@ -273,6 +273,7 @@ class ContactInfoBuilder(Builder):
     header_image: Gtk.Image
     name_entry: Gtk.Entry
     edit_name_button: Gtk.ToggleButton
+    edit_name_button_image: Gtk.Image
     main_stack: Gtk.Stack
     vcard_scrolled: Gtk.ScrolledWindow
     vcard_box: Gtk.Box
@@ -475,6 +476,7 @@ class GroupchatDetailsBuilder(Builder):
     header_image: Gtk.Image
     name_entry: Gtk.Entry
     edit_name_button: Gtk.ToggleButton
+    edit_name_button_image: Gtk.Image
     main_stack: Gtk.Stack
     info_box: Gtk.Box
     settings_box: Gtk.Box


=====================================
gajim/gtk/contact_info.py
=====================================
@@ -332,7 +332,11 @@ def _on_edit_name_toggled(self, widget: Gtk.ToggleButton) 
-> None:
         self._ui.name_entry.set_sensitive(active)
         if active:
             self._ui.name_entry.grab_focus()
+            self._ui.edit_name_button_image.set_from_icon_name(
+                'document-save-symbolic', Gtk.IconSize.BUTTON)
         else:
+            self._ui.edit_name_button_image.set_from_icon_name(
+                'document-edit-symbolic', Gtk.IconSize.BUTTON)
             name = self._ui.name_entry.get_text()
             if name == self.contact.name:
                 return


=====================================
gajim/gtk/groupchat_details.py
=====================================
@@ -111,11 +111,15 @@ def _on_edit_name_toggled(self, widget: Gtk.ToggleButton) 
-> None:
         active = widget.get_active()
         self._ui.name_entry.set_sensitive(active)
         if active:
+            self._ui.edit_name_button_image.set_from_icon_name(
+                'document-save-symbolic', Gtk.IconSize.BUTTON)
             self._ui.name_entry.grab_focus()
-
-        name = self._ui.name_entry.get_text()
-        self._client.get_module('Bookmarks').modify(
-            self._contact.jid, name=name)
+        else:
+            self._ui.edit_name_button_image.set_from_icon_name(
+                'document-edit-symbolic', Gtk.IconSize.BUTTON)
+            name = self._ui.name_entry.get_text()
+            self._client.get_module('Bookmarks').modify(
+                self._contact.jid, name=name)
 
     def _load_avatar(self) -> None:
         scale = self.get_scale_factor()



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

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


_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to