Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
9b311c2d by wurstsalat at 2022-03-04T22:15:46+01:00
GroupchatDetails: Add Remove History button
- - - - -
cac54541 by wurstsalat at 2022-03-04T22:15:46+01:00
Chat menus: Remove obsolete entries
- - - - -
2 changed files:
- gajim/gtk/groupchat_details.py
- gajim/gtk/menus.py
Changes:
=====================================
gajim/gtk/groupchat_details.py
=====================================
@@ -35,6 +35,7 @@
from .groupchat_manage import GroupchatManage
from .groupchat_settings import GroupChatSettings
from .sidebar_switcher import SideBarSwitcher
+from .structs import RemoveHistoryActionParams
class GroupchatDetails(Gtk.ApplicationWindow):
@@ -146,13 +147,28 @@ def _add_groupchat_info(self) -> None:
self._ui.info_box.add(self._groupchat_info)
def _add_groupchat_settings(self) -> None:
+ main_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=24)
+
+ settings_box = GroupChatSettings(self.account, self._contact.jid)
+ main_box.add(settings_box)
+
+ remove_history_button = Gtk.Button(label=_('Remove History…'))
+ remove_history_button.set_halign(Gtk.Align.START)
+ remove_history_button.get_style_context().add_class(
+ 'destructive-action')
+ params = RemoveHistoryActionParams(
+ account=self.account, jid=self._contact.jid)
+ remove_history_button.set_action_name('app.remove-history')
+ remove_history_button.set_action_target_value(
+ params.to_variant())
+ main_box.add(remove_history_button)
+
scrolled_window = Gtk.ScrolledWindow()
scrolled_window.set_vexpand(True)
scrolled_window.set_policy(Gtk.PolicyType.NEVER,
Gtk.PolicyType.AUTOMATIC)
+ scrolled_window.add(main_box)
- settings_box = GroupChatSettings(self.account, self._contact.jid)
- scrolled_window.add(settings_box)
self._ui.settings_box.add(scrolled_window)
def _add_affiliations(self) -> None:
=====================================
gajim/gtk/menus.py
=====================================
@@ -16,7 +16,6 @@
from __future__ import annotations
-from typing import List
from typing import Union
from typing import Any
from typing import Optional
@@ -76,15 +75,12 @@ def get_singlechat_menu(control_id: str,
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…')),
- ('app.remove-history', _('Remove History…')),
('win.search-history', _('Search…'))
]
@@ -94,28 +90,11 @@ def get_singlechat_menu(control_id: str,
singlechat_menu.append(
('win.add-to-roster-', _('Add to Contact List…')))
- def build_chatstate_menu() -> Gio.Menu:
- menu = Gio.Menu()
- entries = [
- (_('Disabled'), 'disabled'),
- (_('Composing Only'), 'composing_only'),
- (_('All Chat States'), 'all')
- ]
-
- for entry in entries:
- label, setting = entry
- action = f'win.send-chatstate-{control_id}::{setting}'
- menu.append(label, action)
- return menu
-
def build_menu(preset: list[tuple[str, Any]]):
menu = Gio.Menu()
for item in preset:
if isinstance(item[1], str):
action_name, label = item
- if action_name == 'win.send-marker-' and type_.is_privatechat:
- continue
-
if action_name == 'win.search-history':
menuitem = Gio.MenuItem.new(label, action_name)
menuitem.set_action_and_target_value(action_name, None)
@@ -136,10 +115,7 @@ def build_menu(preset: list[tuple[str, Any]]):
menu.append(label, action_name + control_id)
else:
label, sub_menu = item
- if 'chatstate' in sub_menu:
- submenu = build_chatstate_menu()
- else:
- submenu = build_menu(sub_menu)
+ submenu = build_menu(sub_menu)
menu.append_submenu(label, submenu)
return menu
@@ -150,15 +126,11 @@ def build_menu(preset: list[tuple[str, Any]]):
def get_groupchat_menu(control_id: str, account: str, jid: JID) -> Gio.Menu:
-
- params = RemoveHistoryActionParams(account=account, jid=jid)
-
menulist: MenuItemListT = [
(_('Details'), f'win.groupchat-details-{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}', '""'),
- (_('Remove History…'), 'app.remove-history', params),
(_('Search…'), 'win.search-history', None)
]
@@ -454,7 +426,7 @@ def get_chat_list_row_menu(workspace_id: str,
toggle_label = _('Unpin Chat') if pinned else _('Pin Chat')
- menu_items: List[Any] = [
+ menu_items: list[Any] = [
('toggle-chat-pinned', toggle_label),
]
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/0dbbf715fc2196cff67cd55fc2bd39b9e5dc5bf9...cac5454133538a16d6616cb6238c0089c8f4c22b
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/0dbbf715fc2196cff67cd55fc2bd39b9e5dc5bf9...cac5454133538a16d6616cb6238c0089c8f4c22b
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits