Philipp Hörist pushed to branch master at gajim / gajim
Commits: b6c4fcfb by Philipp Hörist at 2018-11-04T21:50:21Z Use always an action to open the history window
- Make all menus and shortcuts use the 'app.browse-history' action - HistoryWindow: Inherit from Gtk.ApplicationWindow
- - - - -
10 changed files:
- gajim/app_actions.py - gajim/application.py - gajim/chat_control.py - gajim/chat_control_base.py - gajim/data/gui/history_window.ui - gajim/groupchat_control.py - gajim/gtk/history.py - gajim/gui_menu_builder.py - gajim/message_window.py - gajim/roster_window.py
Changes:
===================================== gajim/app_actions.py ===================================== @@ -313,10 +313,7 @@ def on_file_transfers(action, param):
def on_history(action, param): - if 'logs' in interface.instances: - interface.instances['logs'].window.present() - else: - interface.instances['logs'] = HistoryWindow() + on_browse_history(action, param)
def on_open_event(action, param): @@ -369,3 +366,19 @@ def join_groupchat(_action, param): account, jid = param.get_strv() room_jid = jid.split('?')[0] app.interface.join_gc_minimal(account, room_jid) + + +def on_browse_history(_action, param): + jid, account = None, None + if param is not None: + dict_ = param.unpack() + jid = dict_.get('jid') + account = dict_.get('account') + + window = app.get_app_window(HistoryWindow) + if window is None: + HistoryWindow(jid, account) + else: + window.present() + if jid is not None and account is not None: + window.open_history(jid, account)
===================================== gajim/application.py ===================================== @@ -418,6 +418,11 @@ class GajimApplication(Gtk.Application): act.connect("activate", app_actions.open_link) self.add_action(act)
+ act = Gio.SimpleAction.new('browse-history', + GLib.VariantType.new('a{sv}')) + act.connect("activate", app_actions.on_browse_history) + self.add_action(act) + for action in general_actions: action_name, func = action act = Gio.SimpleAction.new(action_name, None)
===================================== gajim/chat_control.py ===================================== @@ -110,7 +110,7 @@ class ChatControl(ChatControlBase):
# Menu for the HeaderBar self.control_menu = gui_menu_builder.get_singlechat_menu( - self.control_id) + self.control_id, self.account, self.contact.jid) settings_menu = self.xml.get_object('settings_menu') settings_menu.set_menu_model(self.control_menu)
===================================== gajim/chat_control_base.py ===================================== @@ -388,11 +388,6 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): action.connect("change-state", self.change_encryption) self.parent_win.window.add_action(action)
- action = Gio.SimpleAction.new( - 'browse-history-%s' % self.control_id, GLib.VariantType.new('s')) - action.connect('activate', self._on_history) - self.parent_win.window.add_action(action) - action = Gio.SimpleAction.new( 'send-file-%s' % self.control_id, None) action.connect('activate', self._on_send_file) @@ -413,21 +408,6 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
# Actions
- def _on_history(self, action, param): - """ - When history menuitem is pressed: call history window - """ - jid = param.get_string() - if jid == 'none': - jid = self.contact.jid - - if 'logs' in app.interface.instances: - app.interface.instances['logs'].window.present() - app.interface.instances['logs'].open_history(jid, self.account) - else: - from gajim.gtk.history import HistoryWindow - app.interface.instances['logs'] = HistoryWindow(jid, self.account) - def change_encryption(self, action, param): encryption = param.get_string() if encryption == 'disabled': @@ -1039,20 +1019,6 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): start, end = buffer_.get_bounds() buffer_.delete(start, end)
- def _on_history_menuitem_activate(self, widget=None, jid=None): - """ - When history menuitem is pressed: call history window - """ - if not jid: - jid = self.contact.jid - - if 'logs' in app.interface.instances: - app.interface.instances['logs'].window.present() - app.interface.instances['logs'].open_history(jid, self.account) - else: - from gajim.gtk.history import HistoryWindow - app.interface.instances['logs'] = HistoryWindow(jid, self.account) - def _on_send_file(self, action, param): # get file transfer preference ft_pref = app.config.get_per('accounts', self.account,
===================================== gajim/data/gui/history_window.ui ===================================== @@ -278,296 +278,282 @@ </object> </child> </object> - <object class="GtkApplicationWindow" id="history_window"> + <object class="GtkBox" id="history_box"> + <property name="width_request">600</property> + <property name="visible">True</property> <property name="can_focus">False</property> - <property name="title" translatable="yes">Conversation History</property> - <property name="window_position">center</property> - <property name="show_menubar">False</property> - <signal name="delete-event" handler="on_history_window_delete_event" swapped="no"/> - <signal name="destroy" handler="on_history_window_destroy" swapped="no"/> - <signal name="key-press-event" handler="on_history_window_key_press_event" swapped="no"/> - <child type="titlebar"> - <placeholder/> - </child> + <property name="margin_left">18</property> + <property name="margin_right">18</property> + <property name="margin_top">18</property> + <property name="margin_bottom">18</property> + <property name="orientation">vertical</property> + <property name="spacing">24</property> <child> - <object class="GtkBox" id="vbox"> - <property name="width_request">600</property> + <object class="GtkGrid"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="margin_left">18</property> - <property name="margin_right">18</property> - <property name="margin_top">18</property> - <property name="margin_bottom">18</property> - <property name="orientation">vertical</property> - <property name="spacing">24</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> <child> - <object class="GtkGrid"> + <object class="GtkLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">start</property> - <property name="label" translatable="yes">Chat</property> - <style> - <class name="dim-label"/> - </style> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkSwitch" id="log_history_checkbutton"> + <property name="halign">start</property> + <property name="label" translatable="yes">Chat</property> + <style> + <class name="dim-label"/> + </style> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkSwitch" id="log_history_checkbutton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Record history for this chat</property> + <signal name="notify::active" handler="on_log_history_checkbutton_toggled" swapped="no"/> + </object> + <packing> + <property name="left_attach">3</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_left">6</property> + <property name="label" translatable="yes">Record History</property> + <style> + <class name="dim-label"/> + </style> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="query_entry"> + <property name="width_request">400</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="model">liststore1</property> + <property name="tearoff_title" translatable="yes">Ttitle</property> + <property name="has_entry">True</property> + <property name="entry_text_column">1</property> + <property name="id_column">1</property> + <signal name="changed" handler="on_jid_entry_changed" swapped="no"/> + <child internal-child="entry"> + <object class="GtkEntry"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Record history for this chat</property> - <signal name="notify::active" handler="on_log_history_checkbutton_toggled" swapped="no"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_left">6</property> - <property name="label" translatable="yes">Record History</property> - <style> - <class name="dim-label"/> - </style> + <signal name="activate" handler="on_jid_entry_activate" swapped="no"/> </object> - <packing> - <property name="left_attach">2</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="query_entry"> - <property name="width_request">400</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="model">liststore1</property> - <property name="tearoff_title" translatable="yes">Ttitle</property> - <property name="has_entry">True</property> - <property name="entry_text_column">1</property> - <property name="id_column">1</property> - <signal name="changed" handler="on_jid_entry_changed" swapped="no"/> - <child internal-child="entry"> - <object class="GtkEntry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <signal name="activate" handler="on_jid_entry_activate" swapped="no"/> - </object> - </child> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </packing> </child> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> + <property name="left_attach">1</property> + <property name="top_attach">0</property> </packing> </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> <child> <object class="GtkBox"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <child> + <child type="center"> <object class="GtkBox"> <property name="visible">True</property> <property name="can_focus">False</property> - <child type="center"> - <object class="GtkBox"> + <child> + <object class="GtkSearchEntry" id="search_entry"> + <property name="width_request">300</property> <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkSearchEntry" id="search_entry"> - <property name="width_request">300</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="primary_icon_name">edit-find-symbolic</property> - <property name="primary_icon_activatable">False</property> - <property name="primary_icon_sensitive">False</property> - <signal name="activate" handler="on_search_entry_activate" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkMenuButton" id="search_menu_button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="halign">start</property> - <property name="popover">search_menu</property> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="date_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_left">3</property> - <property name="margin_right">3</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">pan-down-symbolic</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <style> - <class name="linked"/> - </style> + <property name="can_focus">True</property> + <property name="primary_icon_name">edit-find-symbolic</property> + <property name="primary_icon_activatable">False</property> + <property name="primary_icon_sensitive">False</property> + <signal name="activate" handler="on_search_entry_activate" swapped="no"/> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">2</property> + <property name="position">0</property> </packing> </child> <child> - <object class="GtkBox"> + <object class="GtkMenuButton" id="search_menu_button"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="halign">start</property> + <property name="popover">search_menu</property> <child> - <object class="GtkMenuButton"> + <object class="GtkBox"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="popover">more_menu</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="date_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_left">3</property> + <property name="margin_right">3</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> <child> <object class="GtkImage"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="icon_name">view-more-symbolic</property> + <property name="icon_name">pan-down-symbolic</property> </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</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="expand">False</property> <property name="fill">True</property> - <property name="pack_type">end</property> <property name="position">1</property> </packing> </child> <style> - <class name="inline-toolbar"/> - <class name="ontop-bar"/> + <class name="linked"/> </style> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="position">2</property> </packing> </child> <child> - <object class="GtkPaned"> + <object class="GtkBox"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="vexpand">True</property> + <property name="can_focus">False</property> <property name="orientation">vertical</property> <child> - <object class="GtkScrolledWindow" id="results_scrolledwindow"> + <object class="GtkMenuButton"> + <property name="visible">True</property> <property name="can_focus">True</property> - <property name="no_show_all">True</property> - <property name="shadow_type">in</property> + <property name="receives_default">True</property> + <property name="popover">more_menu</property> <child> - <object class="GtkTreeView" id="results_treeview"> + <object class="GtkImage"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="rules_hint">True</property> - <property name="hover_expand">True</property> - <signal name="cursor-changed" handler="on_results_treeview_cursor_changed" swapped="no"/> - <child internal-child="selection"> - <object class="GtkTreeSelection"/> - </child> + <property name="can_focus">False</property> + <property name="icon_name">view-more-symbolic</property> </object> </child> </object> <packing> - <property name="resize">True</property> - <property name="shrink">True</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> </packing> </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">1</property> + </packing> + </child> + <style> + <class name="inline-toolbar"/> + <class name="ontop-bar"/> + </style> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkPaned"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkScrolledWindow" id="results_scrolledwindow"> + <property name="can_focus">True</property> + <property name="no_show_all">True</property> + <property name="shadow_type">in</property> <child> - <object class="GtkScrolledWindow" id="scrolledwindow"> + <object class="GtkTreeView" id="results_treeview"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="shadow_type">etched-in</property> - <property name="min_content_height">200</property> - <child> - <placeholder/> + <property name="rules_hint">True</property> + <property name="hover_expand">True</property> + <signal name="cursor-changed" handler="on_results_treeview_cursor_changed" swapped="no"/> + <child internal-child="selection"> + <object class="GtkTreeSelection"/> </child> </object> - <packing> - <property name="resize">True</property> - <property name="shrink">True</property> - </packing> </child> </object> <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> + <property name="resize">True</property> + <property name="shrink">True</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow" id="scrolledwindow"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="shadow_type">etched-in</property> + <property name="min_content_height">200</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="resize">True</property> + <property name="shrink">True</property> </packing> </child> </object> <packing> - <property name="expand">False</property> + <property name="expand">True</property> <property name="fill">True</property> - <property name="position">2</property> + <property name="position">1</property> </packing> </child> </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> </child> </object> </interface>
===================================== gajim/groupchat_control.py ===================================== @@ -494,7 +494,9 @@ class GroupchatControl(ChatControlBase): # GC Roster tooltip self.gc_tooltip = GCTooltip()
- self.control_menu = gui_menu_builder.get_groupchat_menu(self.control_id) + self.control_menu = gui_menu_builder.get_groupchat_menu(self.control_id, + self.account, + self.room_jid) settings_menu = self.xml.get_object('settings_menu') settings_menu.set_menu_model(self.control_menu)
@@ -2714,8 +2716,11 @@ class GroupchatControl(ChatControlBase): self.handlers[id_] = item
item = xml.get_object('history_menuitem') - id_ = item.connect('activate', self.on_history, nick) - self.handlers[id_] = item + item.set_action_name('app.browse-history') + dict_ = {'jid': GLib.Variant('s', fjid), + 'account': GLib.Variant('s', self.account)} + variant = GLib.Variant('a{sv}', dict_) + item.set_action_target_value(variant)
item = xml.get_object('add_to_roster_menuitem') our_jid = app.get_jid_from_account(self.account) @@ -2981,10 +2986,6 @@ class GroupchatControl(ChatControlBase): app.interface.instances[self.account]['infos'][contact.jid] = \ vcard.VcardWindow(contact, self.account, gc_contact)
- def on_history(self, widget, nick): - jid = app.construct_fjid(self.room_jid, nick) - self._on_history_menuitem_activate(widget=widget, jid=jid) - def on_add_to_roster(self, widget, jid): AddNewContactWindow(self.account, jid)
===================================== gajim/gtk/history.py ===================================== @@ -69,14 +69,17 @@ class Column(IntEnum): LOG_LINE_ID = 5
-class HistoryWindow: - """ - Class for browsing logs of conversations with contacts - """ - +class HistoryWindow(Gtk.ApplicationWindow): def __init__(self, jid=None, account=None): + Gtk.ApplicationWindow.__init__(self) + self.set_application(app.app) + self.set_position(Gtk.WindowPosition.CENTER) + self.set_show_menubar(False) + self.set_title(_('Conversation History')) + self._ui = get_builder('history_window.ui') - self._ui.history_window.set_application(app.app) + + self.add(self._ui.history_box)
self.history_textview = conversation_textview.ConversationTextview( account, used_in_history_window=True) @@ -130,15 +133,18 @@ class HistoryWindow: else: self._load_history(None)
- resize_window(self._ui.history_window, + resize_window(self, app.config.get('history_window_width'), app.config.get('history_window_height')) - move_window(self._ui.history_window, + move_window(self, app.config.get('history_window_x-position'), app.config.get('history_window_y-position'))
self._ui.connect_signals(self) - self._ui.history_window.show_all() + self.connect('delete-event', self._on_delete) + self.connect('destroy', self._on_destroy) + self.connect('key-press-event', self._on_key_press) + self.show_all()
# PluginSystem: adding GUI extension point for # HistoryWindow instance object @@ -255,21 +261,20 @@ class HistoryWindow: break return account
- def on_history_window_delete_event(self, widget, *args): + def _on_delete(self, widget, *args): self.save_state()
- def on_history_window_destroy(self, widget): + def _on_destroy(self, widget): # PluginSystem: removing GUI extension points connected with # HistoryWindow instance object app.plugin_manager.remove_gui_extension_point( 'history_window', self) self.history_textview.del_handlers() - del app.interface.instances['logs']
- def on_history_window_key_press_event(self, widget, event): + def _on_key_press(self, widget, event): if event.keyval == Gdk.KEY_Escape: self.save_state() - self._ui.history_window.destroy() + self.destroy()
def on_jid_entry_match_selected(self, widget, model, iter_, *args): self._jid_entry_search(model[iter_][1]) @@ -799,8 +804,8 @@ class HistoryWindow: self._ui.results_scrolledwindow.set_property('visible', False)
def save_state(self): - x, y = self._ui.history_window.get_window().get_root_origin() - width, height = self._ui.history_window.get_size() + x, y = self.get_window().get_root_origin() + width, height = self.get_size()
app.config.set('history_window_x-position', x) app.config.set('history_window_y-position', y)
===================================== gajim/gui_menu_builder.py ===================================== @@ -272,7 +272,12 @@ control=None, gc_contact=None, is_anonymous=True):
rename_menuitem.connect('activate', roster.on_rename, 'contact', jid, account) - history_menuitem.connect('activate', roster.on_history, contact, account) + + history_menuitem.set_action_name('app.browse-history') + dict_ = {'jid': GLib.Variant('s', contact.jid), + 'account': GLib.Variant('s', account)} + variant = GLib.Variant('a{sv}', dict_) + history_menuitem.set_action_target_value(variant)
if control: convert_to_gc_menuitem.connect('activate', @@ -605,7 +610,7 @@ def show_save_as_menu(sha, name): menu.popup_at_pointer()
-def get_singlechat_menu(control_id): +def get_singlechat_menu(control_id, account, jid): singlechat_menu = [ (_('Send File…'), [ ('win.send-file-httpupload-', _('Upload File…')), @@ -616,7 +621,7 @@ def get_singlechat_menu(control_id): ('win.toggle-audio-', _('Audio Session')), ('win.toggle-video-', _('Video Session')), ('win.information-', _('Information')), - ('win.browse-history-', _('History')), + ('app.browse-history', _('History')), ]
def build_menu(preset): @@ -624,8 +629,14 @@ def get_singlechat_menu(control_id): for item in preset: if isinstance(item[1], str): action_name, label = item - if action_name == 'win.browse-history-': - menu.append(label, action_name + control_id + '::none') + if action_name == 'app.browse-history': + menuitem = Gio.MenuItem.new(label, action_name) + dict_ = {'account': GLib.Variant('s', account), + 'jid': GLib.Variant('s', jid)} + variant_dict = GLib.Variant('a{sv}', dict_) + menuitem.set_action_and_target_value(action_name, + variant_dict) + menu.append_item(menuitem) else: menu.append(label, action_name + control_id) else: @@ -638,7 +649,7 @@ def get_singlechat_menu(control_id): return build_menu(singlechat_menu)
-def get_groupchat_menu(control_id): +def get_groupchat_menu(control_id, account, jid): groupchat_menu = [ (_('Manage Room'), [ ('win.change-subject-', _('Change Subject')), @@ -653,7 +664,7 @@ def get_groupchat_menu(control_id): ('win.notify-on-message-', _('Notify on all messages')), ('win.minimize-', _('Minimize on close')), ('win.execute-command-', _('Execute command')), - ('win.browse-history-', _('History')), + ('app.browse-history', _('History')), ('win.disconnect-', _('Disconnect')), ]
@@ -662,8 +673,14 @@ def get_groupchat_menu(control_id): for item in preset: if isinstance(item[1], str): action_name, label = item - if action_name == 'win.browse-history-': - menu.append(label, action_name + control_id + '::none') + if action_name == 'app.browse-history': + menuitem = Gio.MenuItem.new(label, action_name) + dict_ = {'account': GLib.Variant('s', account), + 'jid': GLib.Variant('s', jid)} + variant_dict = GLib.Variant('a{sv}', dict_) + menuitem.set_action_and_target_value(action_name, + variant_dict) + menu.append_item(menuitem) else: menu.append(label, action_name + control_id) else:
===================================== gajim/message_window.py ===================================== @@ -355,9 +355,10 @@ class MessageWindow: if keyval == Gdk.KEY_h: # CTRL + h if Gtk.Settings.get_default().get_property( 'gtk-key-theme-name') != 'Emacs': - arg = GLib.Variant('s', 'none') - self.window.lookup_action( - 'browse-history-%s' % control.control_id).activate(arg) + dict_ = {'jid': GLib.Variant('s', control.contact.jid), + 'account': GLib.Variant('s', control.account)} + variant = GLib.Variant('a{sv}', dict_) + app.app.activate_action('browse-history', variant) return True elif control.type_id == message_control.TYPE_CHAT and \ keyval == Gdk.KEY_f: # CTRL + f
===================================== gajim/roster_window.py ===================================== @@ -78,7 +78,6 @@ from gajim.gtk.bookmarks import ManageBookmarksWindow from gajim.gtk.account_wizard import AccountCreationWizard from gajim.gtk.service_registration import ServiceRegistration from gajim.gtk.discovery import ServiceDiscoveryWindow -from gajim.gtk.history import HistoryWindow from gajim.gtk.accounts import AccountsWindow from gajim.gtk.tooltips import RosterTooltip from gajim.gtk.adhoc_commands import CommandWindow @@ -3041,16 +3040,6 @@ class RosterWindow: def on_edit_groups(self, widget, list_): dialogs.EditGroupsDialog(list_)
- def on_history(self, widget, contact, account): - """ - When history menuitem is activated: call log window - """ - if 'logs' in app.interface.instances: - app.interface.instances['logs'].window.present() - app.interface.instances['logs'].open_history(contact.jid, account) - else: - app.interface.instances['logs'] = HistoryWindow(contact.jid, account) - def on_disconnect(self, widget, jid, account): """ When disconnect menuitem is activated: disconnect from room @@ -3756,6 +3745,9 @@ class RosterWindow: self.on_info(widget, contact, account) elif event.get_state() & Gdk.ModifierType.CONTROL_MASK and event.keyval == \ Gdk.KEY_h: + if app.config.get('one_message_window') == 'always_with_roster': + # Let MessageWindow handle this + return treeselection = self.tree.get_selection() model, list_of_paths = treeselection.get_selected_rows() if len(list_of_paths) != 1: @@ -3767,7 +3759,10 @@ class RosterWindow: account = model[path][Column.ACCOUNT] contact = app.contacts.get_first_contact_from_jid(account, jid) - self.on_history(widget, contact, account) + dict_ = {'jid': GLib.Variant('s', jid), + 'account': GLib.Variant('s', account)} + app.app.activate_action('browse-history', + GLib.Variant('a{sv}', dict_))
def on_roster_window_popup_menu(self, widget): event = Gdk.Event.new(Gdk.EventType.KEY_PRESS) @@ -5392,7 +5387,12 @@ class RosterWindow: menu.append(item)
history_menuitem = Gtk.MenuItem.new_with_mnemonic(_('_History')) - history_menuitem.connect('activate', self.on_history, contact, account) + history_menuitem.set_action_name('app.browse-history') + dict_ = {'jid': GLib.Variant('s', contact.jid), + 'account': GLib.Variant('s', account)} + variant = GLib.Variant('a{sv}', dict_) + history_menuitem.set_action_target_value(variant) + menu.append(history_menuitem)
event_button = gtkgui_helpers.get_possible_button_event(event)
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/b6c4fcfb548e6d9b5b71787559d0d9963bd...