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


Commits:
b1108944 by André Apitzsch at 2024-04-09T20:51:50+00:00
feat: Add option to remove group chat avatar

- - - - -


3 changed files:

- gajim/data/gui/groupchat_manage.ui
- gajim/gtk/builder.pyi
- gajim/gtk/groupchat_manage.py


Changes:

=====================================
gajim/data/gui/groupchat_manage.ui
=====================================
@@ -33,6 +33,25 @@
                 <property name="index">-1</property>
               </packing>
             </child>
+            <child type="overlay">
+              <object class="GtkButton" id="remove_avatar_button">
+                <property name="can-focus">True</property>
+                <property name="receives-default">False</property>
+                <property name="no-show-all">True</property>
+                <property name="tooltip-text" translatable="yes">Remove your 
group chat avatar</property>
+                <property name="halign">start</property>
+                <property name="valign">end</property>
+                <property name="always-show-image">True</property>
+                <signal name="clicked" handler="_on_remove_avatar" 
swapped="no"/>
+                <child>
+                  <object class="GtkImage">
+                    <property name="visible">True</property>
+                    <property name="can-focus">False</property>
+                    <property name="icon-name">user-trash-symbolic</property>
+                  </object>
+                </child>
+              </object>
+            </child>
             <child type="overlay">
               <object class="GtkButton" id="avatar_select_button">
                 <property name="can-focus">True</property>


=====================================
gajim/gtk/builder.pyi
=====================================
@@ -484,6 +484,7 @@ class GroupchatInviterBuilder(Builder):
 class GroupchatManageBuilder(Builder):
     stack: Gtk.Stack
     avatar_button_image: Gtk.Image
+    remove_avatar_button: Gtk.Button
     avatar_select_button: Gtk.Button
     muc_description_entry: Gtk.Entry
     muc_name_entry: Gtk.Entry


=====================================
gajim/gtk/groupchat_manage.py
=====================================
@@ -138,6 +138,7 @@ def _prepare_manage(self) -> None:
 
         if vcard_support and self_contact.affiliation.is_owner:
             self._ui.avatar_select_button.show()
+            self._ui.remove_avatar_button.show()
 
         if self_contact.affiliation.is_owner:
             self._client.get_module('MUC').request_config(
@@ -184,6 +185,13 @@ def _on_manage_save_clicked(self, _button: Gtk.Button) -> 
None:
     def _on_avatar_cancel_clicked(self, _button: Gtk.Button) -> None:
         self._ui.stack.set_visible_child_name('manage')
 
+    def _on_remove_avatar(self, _button: Gtk.Button) -> None:
+        vcard = VCard()
+        self._client.get_module('VCardTemp').set_vcard(
+            vcard,
+            jid=self._contact.jid,
+            callback=self._on_upload_avatar_result)
+
     def _on_change_avatar_clicked(self, _button: Gtk.Button) -> None:
         def _on_accept(paths: list[str]) -> None:
             self._avatar_selector.prepare_crop_area(paths[0])



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

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