Browse Source

accelerators to the tabs

master
Julio Biason 15 years ago
parent
commit
2e6dcd3197
  1. 38
      mitterlib/ui/ui_pygtk.py

38
mitterlib/ui/ui_pygtk.py

@ -341,6 +341,10 @@ class Interface(object):
<menuitem action="Repost" />
<menuitem action="Favourite" />
</menu>
<menu action="View">
<menuitem action="Messages" />
<menuitem action="Replies" />
</menu>
<menu action="Help">
<menuitem action="About" />
</menu>
@ -364,6 +368,9 @@ class Interface(object):
'Message related options', None)
action_group.add_action(message_action)
view_action = gtk.Action('View', '_View', 'View', None)
action_group.add_action(view_action)
help_action = gtk.Action('Help', '_Help', 'Help', None)
action_group.add_action(help_action)
@ -398,16 +405,6 @@ class Interface(object):
clear_action.connect('activate', self._clear_posts)
action_group.add_action_with_accel(clear_action, '<Ctrl>l')
#shrink_url_action = gtk.Action('ShrinkURL', 'Shrink _URL',
# 'Shrink selected URL', gtk.STOCK_EXECUTE)
#shrink_url_action.connect('activate', self.shrink_url)
#self.action_group.add_action_with_accel(shrink_url_action, '<Ctrl>u')
#mute_action = gtk.ToggleAction('MuteNotify', '_Mute Notifications',
# 'Mutes notifications on new tweets', gtk.STOCK_MEDIA_PAUSE)
#mute_action.set_active(False)
#self.action_group.add_action_with_accel(mute_action, '<Ctrl>m')
settings_action = gtk.Action('Settings', '_Settings',
'Settings', gtk.STOCK_PREFERENCES)
settings_action.connect('activate', self._show_settings)
@ -439,8 +436,17 @@ class Interface(object):
self._favourite_action.set_property('sensitive', False)
self._favourite_action.connect('activate', self._favourite_message)
action_group.add_action_with_accel(self._favourite_action, '<Ctrl>f')
# XXX: Not sure if "Ctrl+F" is a good option, since other applications
# use it as "Find".
# view actions
view_messages_action = gtk.Action('Messages', '_Messages',
'Display messages', None)
view_messages_action.connect('activate', self._change_tab, 0)
action_group.add_action_with_accel(view_messages_action, '<Alt>1')
view_replies_action = gtk.Action('Replies', '_Replies',
'Display replies', None)
view_replies_action.connect('activate', self._change_tab, 1)
action_group.add_action_with_accel(view_replies_action, '<Alt>2')
# Help actions
about_action = gtk.Action('About', '_About', 'About Mitter',
@ -1084,6 +1090,14 @@ class Interface(object):
self._message_count_updated()
return True
def _change_tab(self, widget, user_data=None):
"""Change the notebook tab to display a differnt tab."""
if not user_data:
user_data = 0
self._main_tabs.set_current_page(user_data)
return
# ------------------------------------------------------------
# Network related functions
# ------------------------------------------------------------

Loading…
Cancel
Save