move accelerators tom (group)chat_control to message_window. fixes traceback with minimized groupchats
This commit is contained in:
parent
37b755ecef
commit
f9a7a5c373
|
@ -967,12 +967,6 @@ class ChatControl(ChatControlBase):
|
|||
id = widget.connect('clicked', self.on_actions_button_clicked)
|
||||
self.handlers[id] = widget
|
||||
|
||||
ag = gtk.accel_groups_from_object(self.parent_win.window)[0]
|
||||
key, mod = gtk.accelerator_parse("<Control>h")
|
||||
ag.connect_group(key, mod, gtk.ACCEL_VISIBLE, self.accel_group_func)
|
||||
key, mod = gtk.accelerator_parse("<Control>i")
|
||||
ag.connect_group(key, mod, gtk.ACCEL_VISIBLE, self.accel_group_func)
|
||||
|
||||
compact_view = gajim.config.get('compact_view')
|
||||
self.chat_buttons_set_visible(compact_view)
|
||||
self.widget_set_visible(self.xml.get_widget('banner_eventbox'),
|
||||
|
@ -1664,13 +1658,6 @@ class ChatControl(ChatControlBase):
|
|||
# destroy menu
|
||||
menu.destroy()
|
||||
|
||||
def accel_group_func(self, accel_group, acceleratable, keyval, modifier):
|
||||
if modifier & gtk.gdk.CONTROL_MASK:
|
||||
if keyval == gtk.keysyms.h:
|
||||
self._on_history_menuitem_activate()
|
||||
if keyval == gtk.keysyms.i:
|
||||
self._on_contact_information_menuitem_activate(None)
|
||||
|
||||
def send_chatstate(self, state, contact = None):
|
||||
''' sends OUR chatstate as STANDLONE chat state message (eg. no body)
|
||||
to contact only if new chatstate is different from the previous one
|
||||
|
|
|
@ -193,10 +193,6 @@ class GroupchatControl(ChatControlBase):
|
|||
self.on_list_treeview_leave_notify_event)
|
||||
self.handlers[id] = widget
|
||||
|
||||
ag = gtk.accel_groups_from_object(self.parent_win.window)[0]
|
||||
key, mod = gtk.accelerator_parse("<Control>h")
|
||||
ag.connect_group(key, mod, gtk.ACCEL_VISIBLE, self.accel_group_func)
|
||||
|
||||
self.room_jid = self.contact.jid
|
||||
self.nick = contact.name
|
||||
self.name = self.room_jid.split('@')[0]
|
||||
|
@ -540,11 +536,6 @@ class GroupchatControl(ChatControlBase):
|
|||
self.change_nick_menuitem.set_sensitive(False)
|
||||
return self.gc_popup_menu
|
||||
|
||||
def accel_group_func(self, accel_group, acceleratable, keyval, modifier):
|
||||
if modifier & gtk.gdk.CONTROL_MASK:
|
||||
if keyval == gtk.keysyms.h:
|
||||
self._on_history_menuitem_activate()
|
||||
|
||||
def on_message(self, nick, msg, tim, has_timestamp = False, xhtml = None,
|
||||
status_code = []):
|
||||
if '100' in status_code:
|
||||
|
|
|
@ -71,6 +71,12 @@ class MessageWindow:
|
|||
self.handlers[id] = self.window
|
||||
|
||||
accel_group = gtk.AccelGroup()
|
||||
key, mod = gtk.accelerator_parse('<Control>h')
|
||||
accel_group.connect_group(key, mod, gtk.ACCEL_VISIBLE,
|
||||
self.accel_group_func)
|
||||
key, mod = gtk.accelerator_parse('<Control>i')
|
||||
accel_group.connect_group(key, mod, gtk.ACCEL_VISIBLE,
|
||||
self.accel_group_func)
|
||||
self.window.add_accel_group(accel_group)
|
||||
|
||||
# gtk+ doesn't make use of the motion notify on gtkwindow by default
|
||||
|
@ -244,6 +250,18 @@ class MessageWindow:
|
|||
elif event.keyval == gtk.keysyms.Page_Up: # CTRL + PAGE UP
|
||||
self.notebook.emit('key_press_event', event)
|
||||
|
||||
def accel_group_func(self, accel_group, acceleratable, keyval, modifier):
|
||||
control = self.get_active_control()
|
||||
if not control:
|
||||
# No more control in this window
|
||||
return
|
||||
if modifier & gtk.gdk.CONTROL_MASK:
|
||||
if keyval == gtk.keysyms.h:
|
||||
control._on_history_menuitem_activate()
|
||||
if control.type_id == message_control.TYPE_CHAT and \
|
||||
keyval == gtk.keysyms.i:
|
||||
control._on_contact_information_menuitem_activate(None)
|
||||
|
||||
def _on_close_button_clicked(self, button, control):
|
||||
'''When close button is pressed: close a tab'''
|
||||
self.remove_tab(control, self.CLOSE_CLOSE_BUTTON)
|
||||
|
|
Loading…
Reference in New Issue