Refactor adding actions to chat windows
This commit is contained in:
parent
b8a62a8bb2
commit
afc3075415
|
@ -245,6 +245,7 @@ class ChatControl(ChatControlBase):
|
||||||
self.update_actions()
|
self.update_actions()
|
||||||
|
|
||||||
def add_actions(self):
|
def add_actions(self):
|
||||||
|
super().add_actions()
|
||||||
actions = [
|
actions = [
|
||||||
('invite-contacts-', self._on_invite_contacts),
|
('invite-contacts-', self._on_invite_contacts),
|
||||||
('add-to-roster-', self._on_add_to_roster),
|
('add-to-roster-', self._on_add_to_roster),
|
||||||
|
|
|
@ -371,8 +371,6 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
self._schedule_activity_timers()
|
self._schedule_activity_timers()
|
||||||
|
|
||||||
self.encryption = self.get_encryption_state()
|
self.encryption = self.get_encryption_state()
|
||||||
if self.parent_win:
|
|
||||||
self.add_window_actions()
|
|
||||||
|
|
||||||
# PluginSystem: adding GUI extension point for ChatControlBase
|
# PluginSystem: adding GUI extension point for ChatControlBase
|
||||||
# instance object (also subclasses, eg. ChatControl or GroupchatControl)
|
# instance object (also subclasses, eg. ChatControl or GroupchatControl)
|
||||||
|
@ -391,7 +389,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
# to properly use the super, because of the old code.
|
# to properly use the super, because of the old code.
|
||||||
CommandTools.__init__(self)
|
CommandTools.__init__(self)
|
||||||
|
|
||||||
def add_window_actions(self):
|
def add_actions(self):
|
||||||
action = Gio.SimpleAction.new_stateful(
|
action = Gio.SimpleAction.new_stateful(
|
||||||
"set-encryption-%s" % self.control_id,
|
"set-encryption-%s" % self.control_id,
|
||||||
GLib.VariantType.new("s"),
|
GLib.VariantType.new("s"),
|
||||||
|
|
|
@ -514,6 +514,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
app.plugin_manager.gui_extension_point('groupchat_control', self)
|
app.plugin_manager.gui_extension_point('groupchat_control', self)
|
||||||
|
|
||||||
def add_actions(self):
|
def add_actions(self):
|
||||||
|
super().add_actions()
|
||||||
actions = [
|
actions = [
|
||||||
('change-subject-', self._on_change_subject),
|
('change-subject-', self._on_change_subject),
|
||||||
('change-nick-', self._on_change_nick),
|
('change-nick-', self._on_change_nick),
|
||||||
|
@ -729,7 +730,6 @@ class GroupchatControl(ChatControlBase):
|
||||||
|
|
||||||
def on_groupchat_maximize(self):
|
def on_groupchat_maximize(self):
|
||||||
self.set_tooltip()
|
self.set_tooltip()
|
||||||
self.add_window_actions()
|
|
||||||
self.add_actions()
|
self.add_actions()
|
||||||
self.update_actions()
|
self.update_actions()
|
||||||
self.set_lock_image()
|
self.set_lock_image()
|
||||||
|
|
Loading…
Reference in New Issue