Added CTRL+J shortcut for joining a conference

This commit is contained in:
Alexander Cherniuk 2009-11-28 13:29:28 +02:00
parent 9121a873b8
commit af67012f63
2 changed files with 19 additions and 9 deletions

View File

@ -2112,6 +2112,7 @@ class JoinGroupchatWindow:
if self.account and 'join_gc' in gajim.interface.instances[self.account]: if self.account and 'join_gc' in gajim.interface.instances[self.account]:
# remove us from open windows # remove us from open windows
del gajim.interface.instances[self.account]['join_gc'] del gajim.interface.instances[self.account]['join_gc']
gajim.interface.roster.window.present()
def on_join_groupchat_window_key_press_event(self, widget, event): def on_join_groupchat_window_key_press_event(self, widget, event):
if event.keyval == gtk.keysyms.Escape: # ESCAPE if event.keyval == gtk.keysyms.Escape: # ESCAPE

View File

@ -2351,7 +2351,9 @@ class RosterWindow:
self.make_menu() self.make_menu()
def on_edit_menuitem_activate(self, widget): def on_edit_menuitem_activate(self, widget):
'''need to call make_menu to build profile, avatar item''' """
Need to call make_menu to build profile, avatar item
"""
self.make_menu() self.make_menu()
def on_bookmark_menuitem_activate(self, widget, account, bookmark): def on_bookmark_menuitem_activate(self, widget, account, bookmark):
@ -3444,7 +3446,6 @@ class RosterWindow:
if 'join_gc' in gajim.interface.instances[account]: if 'join_gc' in gajim.interface.instances[account]:
gajim.interface.instances[account]['join_gc'].window.present() gajim.interface.instances[account]['join_gc'].window.present()
else: else:
# c http://nkour.blogspot.com/2005/05/pythons-init-return-none-doesnt-return.html
try: try:
gajim.interface.instances[account]['join_gc'] = \ gajim.interface.instances[account]['join_gc'] = \
dialogs.JoinGroupchatWindow(account) dialogs.JoinGroupchatWindow(account)
@ -3498,9 +3499,10 @@ class RosterWindow:
gajim.interface.edit_own_details(account) gajim.interface.edit_own_details(account)
def on_execute_command(self, widget, contact, account, resource=None): def on_execute_command(self, widget, contact, account, resource=None):
'''Execute command. Full JID needed; if it is other contact, """
resource is necessary. Widget is unnecessary, only to be Execute command. Full JID needed; if it is other contact, resource is
able to make this a callback.''' necessary. Widget is unnecessary, only to be able to make this a callback
"""
jid = contact.jid jid = contact.jid
if resource is not None: if resource is not None:
jid = jid + u'/' + resource jid = jid + u'/' + resource
@ -5654,15 +5656,22 @@ class RosterWindow:
icon = gtk.image_new_from_stock(gtk.STOCK_NEW, gtk.ICON_SIZE_MENU) icon = gtk.image_new_from_stock(gtk.STOCK_NEW, gtk.ICON_SIZE_MENU)
item.set_image(icon) item.set_image(icon)
item.connect('activate', self.on_join_gc_activate, account) item.connect('activate', self.on_join_gc_activate, account)
# Setting CTRL+J to be the shortcut for the fast joining to a conference.
ag = gtk.accel_groups_from_object(self.window)[0]
item.add_accelerator('activate', ag, gtk.keysyms.j, gtk.gdk.CONTROL_MASK,
gtk.ACCEL_VISIBLE)
gc_sub_menu.append(item) gc_sub_menu.append(item)
# user has at least one bookmark # User has at least one bookmark.
if len(gajim.connections[account].bookmarks) > 0: if gajim.connections[account].bookmarks:
item = gtk.SeparatorMenuItem() # separator item = gtk.SeparatorMenuItem()
gc_sub_menu.append(item) gc_sub_menu.append(item)
for bookmark in gajim.connections[account].bookmarks: for bookmark in gajim.connections[account].bookmarks:
item = gtk.MenuItem(bookmark['name'], False) # Do not use underline # Do not use underline.
item = gtk.MenuItem(bookmark['name'], False)
item.connect('activate', self.on_bookmark_menuitem_activate, item.connect('activate', self.on_bookmark_menuitem_activate,
account, bookmark) account, bookmark)
gc_sub_menu.append(item) gc_sub_menu.append(item)