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


Commits:
4662a610 by wurstsalat at 2024-05-23T23:19:36+02:00
imprv: Reactions: Add more default reactions to MessageRowActions

- - - - -
d6c8d423 by wurstsalat at 2024-05-23T23:21:32+02:00
imprv: MessageRow: Pop up chat row menu to the top

- - - - -


2 changed files:

- gajim/gtk/conversation/rows/message.py
- gajim/gtk/conversation/rows/widgets.py


Changes:

=====================================
gajim/gtk/conversation/rows/message.py
=====================================
@@ -287,7 +287,7 @@ def show_chat_row_menu(
             is_moderated=self._is_moderated,
         )
 
-        popover = GajimPopover(menu, relative_to=button)
+        popover = GajimPopover(menu, relative_to=button, 
position=Gtk.PositionType.TOP)
         popover.connect(
             'closed',
             self._on_more_menu_popover_closed,


=====================================
gajim/gtk/conversation/rows/widgets.py
=====================================
@@ -59,21 +59,24 @@ def __init__(self) -> None:
 
         self._timeout_id: int | None = None
 
-        self._default_reaction_button = Gtk.Button(
-            label='👍', tooltip_text=_('React with 👍')
+        self._reaction_buttons: list[Gtk.Button] = []
+
+        for emoji in ['👍', '❤', '🤣']:
+            button = Gtk.Button(
+                label=emoji, tooltip_text=_('React with %s') % emoji, 
no_show_all=True
+            )
+            button.connect('clicked', 
self._on_specific_reaction_button_clicked)
+            button.get_style_context().remove_class('text-button')
+            button.get_style_context().add_class('image-button')
+            self._reaction_buttons.append(button)
+
+        choose_reaction_button = AddReactionButton()
+        choose_reaction_button.set_no_show_all(True)
+        choose_reaction_button.connect(
+            'clicked', self._on_choose_reaction_button_clicked
         )
-        self._default_reaction_button.set_no_show_all(True)
-        self._default_reaction_button.connect(
-            'clicked', self._on_specific_reaction_button_clicked
-        )
-        
self._default_reaction_button.get_style_context().remove_class('text-button')
-        
self._default_reaction_button.get_style_context().add_class('image-button')
-
-        self._choose_reaction_button = AddReactionButton()
-        self._choose_reaction_button.set_no_show_all(True)
-        self._choose_reaction_button.connect(
-            'clicked', self._on_choose_reaction_button_clicked)
-        self._choose_reaction_button.connect('emoji-added', 
self._on_reaction_added)
+        choose_reaction_button.connect('emoji-added', self._on_reaction_added)
+        self._reaction_buttons.append(choose_reaction_button)
 
         self._reply_button = Gtk.Button.new_from_icon_name(
             'lucide-reply-symbolic', Gtk.IconSize.BUTTON
@@ -89,8 +92,10 @@ def __init__(self) -> None:
 
         box = Gtk.Box()
         box.get_style_context().add_class('linked')
-        box.add(self._default_reaction_button)
-        box.add(self._choose_reaction_button)
+
+        for button in self._reaction_buttons:
+            box.add(button)
+
         box.add(self._reply_button)
         box.add(more_button)
 
@@ -125,8 +130,10 @@ def update(self, y_coord: int, message_row: MessageRow) -> 
None:
         self.set_no_show_all(False)
         self.show_all()
 
-        
self._default_reaction_button.set_visible(self._get_reactions_visible())
-        self._choose_reaction_button.set_visible(self._get_reactions_visible())
+        reactions_visible = self._get_reactions_visible()
+        for button in self._reaction_buttons:
+            button.set_visible(reactions_visible)
+
         self._reply_button.set_visible(self._get_reply_visible())
 
     def switch_contact(self, contact: ChatContactT) -> None:



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/769e88c7deb6554962f4875cb6d676b74ae2db97...d6c8d4235f40d9c7efc02ce85c4fa6de83ed3035

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/769e88c7deb6554962f4875cb6d676b74ae2db97...d6c8d4235f40d9c7efc02ce85c4fa6de83ed3035
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