Daniel Brötzmann pushed to branch master at gajim / gajim
Commits: 298a6900 by wurstsalat at 2022-01-23T19:06:13+01:00 Groupchat: Remove rename page
- - - - - e797ae75 by wurstsalat at 2022-01-23T19:25:36+01:00 Menus: Unify single and group chat menu
- - - - -
3 changed files:
- gajim/data/gui/groupchat_control.ui - gajim/gtk/controls/groupchat.py - gajim/gtk/menus.py
Changes:
===================================== gajim/data/gui/groupchat_control.ui ===================================== @@ -1748,112 +1748,7 @@ </packing> </child> <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="orientation">vertical</property> - <child> - <!-- n-columns=1 n-rows=3 --> - <object class="GtkGrid"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="halign">center</property> - <property name="valign">center</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="row-spacing">12</property> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label" translatable="yes">Rename This Chat</property> - <property name="xalign">0</property> - <style> - <class name="bold16"/> - </style> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">0</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="name_entry"> - <property name="width-request">200</property> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="activates-default">True</property> - <property name="caps-lock-warning">False</property> - <property name="secondary-icon-name">face-smile-symbolic</property> - <property name="secondary-icon-tooltip-text" translatable="yes">Insert Emoji</property> - <property name="secondary-icon-tooltip-markup" translatable="yes">Insert Emoji</property> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">1</property> - </packing> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="homogeneous">True</property> - <child> - <object class="GtkButton"> - <property name="label" translatable="yes">_Cancel</property> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <property name="halign">start</property> - <property name="valign">start</property> - <property name="use-underline">True</property> - <signal name="clicked" handler="_on_page_cancel_clicked" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="rename_button"> - <property name="label" translatable="yes">_Rename</property> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="can-default">True</property> - <property name="receives-default">True</property> - <property name="halign">end</property> - <property name="valign">start</property> - <property name="use-underline">True</property> - <signal name="clicked" handler="_on_rename_clicked" swapped="no"/> - <style> - <class name="suggested-action"/> - </style> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">2</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - </object> - <packing> - <property name="name">rename</property> - <property name="position">10</property> - </packing> + <placeholder/> </child> <child> <object class="GtkBox"> @@ -1934,9 +1829,6 @@ <property name="position">11</property> </packing> </child> - <child> - <placeholder/> - </child> <child> <object class="GtkBox"> <property name="visible">True</property> @@ -2148,7 +2040,7 @@ </object> <packing> <property name="name">muc-manage</property> - <property name="position">13</property> + <property name="position">12</property> </packing> </child> <child> @@ -2257,7 +2149,7 @@ </object> <packing> <property name="name">avatar-selector</property> - <property name="position">14</property> + <property name="position">13</property> </packing> </child> </object>
===================================== gajim/gtk/controls/groupchat.py ===================================== @@ -286,7 +286,6 @@ def add_actions(self) -> None: super().add_actions() actions = [ ('groupchat-manage-', None, self._on_groupchat_manage), - ('rename-groupchat-', None, self._on_rename_groupchat), ('change-nickname-', None, self._on_change_nick), ('destroy-', None, self._on_destroy_room), ('configure-', None, self._on_configure_room), @@ -385,7 +384,6 @@ def remove_actions(self) -> None: super().remove_actions() actions = [ 'groupchat-manage-', - 'rename-groupchat-', 'change-nickname-', 'destroy-', 'configure-', @@ -1578,8 +1576,6 @@ def focus(self) -> None: self.xml.password_entry.grab_focus_without_selecting() elif page_name == 'nickname': self.xml.nickname_entry.grab_focus_without_selecting() - elif page_name == 'rename': - self.xml.name_entry.grab_focus_without_selecting() elif page_name == 'subject': self.xml.subject_textview.grab_focus() elif page_name == 'captcha': @@ -1645,23 +1641,6 @@ def _on_nickname_change_clicked(self, _button: Gtk.Button) -> None: self._client.get_module('MUC').change_nick(self.room_jid, new_nick) self._show_page('groupchat')
- def _on_rename_groupchat(self, - _action: Gio.SimpleAction, - _param: Optional[GLib.Variant] - ) -> None: - if self._get_current_page() != 'groupchat': - return - self.xml.name_entry.set_text(self.contact.name) - self.xml.name_entry.grab_focus() - self.xml.rename_button.grab_default() - self._show_page('rename') - - def _on_rename_clicked(self, _button: Gtk.Button) -> None: - new_name = self.xml.name_entry.get_text() - self._client.get_module('Bookmarks').modify( - self.room_jid, name=new_name) - self._show_page('groupchat') - def _on_manage_save_clicked(self, _button: Gtk.Button) -> None: if self._room_config_form is not None: name = self.xml.muc_name_entry.get_text()
===================================== gajim/gtk/menus.py ===================================== @@ -64,35 +64,36 @@ def get_singlechat_menu(control_id: str, is_self_contact = jid.bare == client.get_own_jid().bare contact = client.get_module('Contacts').get_contact(jid)
- singlechat_menu: list[tuple[str, Any]] = [ + self_contact_menu: list[tuple[str, Any]] = [ + ('profile', _('Profile')), (_('Send File'), [ ('win.send-file-httpupload-', _('Upload File…')), ('win.send-file-jingle-', _('Send File Directly…')) - ]) + ]), + ('app.remove-history', _('Remove History…')), + ('win.search-history', _('Search…')) ]
- additional_menu: list[tuple[str, Any]] = [ + singlechat_menu: list[tuple[str, Any]] = [ + ('win.information-', _('Details')), ('win.send-marker-', _('Send Read Markers')), (_('Send Chatstate'), ['chatstate']), ('win.block-contact-', _('Block Contact…')), + (_('Send File'), [ + ('win.send-file-httpupload-', _('Upload File…')), + ('win.send-file-jingle-', _('Send File Directly…')) + ]), ('win.start-call-', _('Start Call…')), - ('win.information-', _('Information')), - ('app.remove-history', _('Remove History…')) + ('app.remove-history', _('Remove History…')), + ('win.search-history', _('Search…')) ]
if not contact.is_in_roster: if (type_.is_chat or (type_.is_privatechat and contact.real_jid is not None)): - additional_menu.append( + singlechat_menu.append( ('win.add-to-roster-', _('Add to Contact List…')))
- if is_self_contact: - singlechat_menu.append(('profile', _('Profile'))) - else: - singlechat_menu.extend(additional_menu) - - singlechat_menu.append(('win.search-history', _('Search…'))) - def build_chatstate_menu() -> Gio.Menu: menu = Gio.Menu() entries = [ @@ -112,7 +113,7 @@ def build_menu(preset: list[tuple[str, Any]]): for item in preset: if isinstance(item[1], str): action_name, label = item - if action_name == 'win.send-marker-' and type_ == 'pm': + if action_name == 'win.send-marker-' and type_.is_privatechat: continue
if action_name == 'win.search-history': @@ -142,6 +143,9 @@ def build_menu(preset: list[tuple[str, Any]]): menu.append_submenu(label, submenu) return menu
+ if is_self_contact: + return build_menu(self_contact_menu) + return build_menu(singlechat_menu)
@@ -152,12 +156,11 @@ def get_groupchat_menu(control_id: str, account: str, jid: JID) -> Gio.Menu: menulist: MenuItemListT = [ (_('Details'), f'win.groupchat-details-{control_id}', None), (_('Manage…'), f'win.groupchat-manage-{control_id}', None), - (_('Rename Chat…'), f'win.rename-groupchat-{control_id}', None), (_('Change Nickname…'), f'win.change-nickname-{control_id}', None), (_('Request Voice'), f'win.request-voice-{control_id}', None), (_('Execute Command…'), f'win.execute-command-{control_id}', '""'), - (_('Search…'), 'win.search-history', None), - (_('Remove History…'), 'app.remove-history', params) + (_('Remove History…'), 'app.remove-history', params), + (_('Search…'), 'win.search-history', None) ]
return make_menu(menulist) @@ -408,7 +411,7 @@ def get_roster_menu(account: str, jid: str, gateway: bool = False) -> Gio.Menu: value = f'"{jid}"'
menuitems: MenuItemListT = [ - (_('Information'), f'win.contact-info-{account}', value), + (_('Details'), f'win.contact-info-{account}', value), (_('Execute Command…'), f'win.execute-command-{account}', value), (block_label, f'win.block-contact-{account}', value), (_('Remove…'), f'win.remove-contact-{account}', value), @@ -429,7 +432,7 @@ def get_subscription_menu(account: str, jid: JID) -> Gio.Menu: value = f'"{jid}"' menuitems: MenuItemListT = [ (_('Start Chat'), 'win.add-chat', params), - (_('Information'), f'win.contact-info-{account}', value), + (_('Details'), f'win.contact-info-{account}', value), (_('Block'), f'win.subscription-block-{account}', value), (_('Report'), f'win.subscription-report-{account}', value), (_('Deny'), f'win.subscription-deny-{account}', value), @@ -588,7 +591,7 @@ def get_groupchat_roster_menu(account: str, value = f'"{contact.name}"'
general_items: MenuItemListT = [ - (_('Information'), f'win.contact-information-{control_id}', value), + (_('Details'), f'win.contact-information-{control_id}', value), (_('Execute Command…'), f'win.execute-command-{control_id}', value), ]
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/59439c83b3b7e5136a3508328f037bce...