|
|
|
@ -282,77 +282,15 @@ class Interface(object):
|
|
|
|
|
def _create_menu_and_toolbar(self): |
|
|
|
|
"""Create the main menu and the toolbar.""" |
|
|
|
|
|
|
|
|
|
# tasks (used by the menu and toolbar) |
|
|
|
|
|
|
|
|
|
refresh_action = gtk.Action('Refresh', '_Refresh', |
|
|
|
|
'Update the listing', gtk.STOCK_REFRESH) |
|
|
|
|
#refresh_action.connect('activate', self.refresh) |
|
|
|
|
|
|
|
|
|
quit_action = gtk.Action('Quit', '_Quit', |
|
|
|
|
'Exit Mitter', gtk.STOCK_QUIT) |
|
|
|
|
quit_action.connect('activate', self._quit_app) |
|
|
|
|
|
|
|
|
|
settings_action = gtk.Action('Settings', '_Settings', |
|
|
|
|
'Settings', gtk.STOCK_PREFERENCES) |
|
|
|
|
#settings_action.connect('activate', self.show_settings) |
|
|
|
|
|
|
|
|
|
self._update_action = gtk.Action('Update', '_Update', |
|
|
|
|
'Update your status', gtk.STOCK_ADD) |
|
|
|
|
self._update_action.set_property('sensitive', False) |
|
|
|
|
self._update_action.connect('activate', self._update_status) |
|
|
|
|
|
|
|
|
|
delete_action = gtk.Action('Delete', '_Delete', 'Delete a post', |
|
|
|
|
gtk.STOCK_DELETE) |
|
|
|
|
delete_action.set_property('sensitive', False) |
|
|
|
|
#delete_action.connect('activate', self.delete_tweet) |
|
|
|
|
|
|
|
|
|
about_action = gtk.Action('About', '_About', 'About Mitter', |
|
|
|
|
gtk.STOCK_ABOUT) |
|
|
|
|
about_action.connect('activate', self._show_about) |
|
|
|
|
|
|
|
|
|
#shrink_url_action = gtk.Action('ShrinkURL', 'Shrink _URL', |
|
|
|
|
# 'Shrink selected URL', gtk.STOCK_EXECUTE) |
|
|
|
|
#shrink_url_action.connect('activate', self.shrink_url) |
|
|
|
|
|
|
|
|
|
#mute_action = gtk.ToggleAction('MuteNotify', '_Mute Notifications', |
|
|
|
|
# 'Mutes notifications on new tweets', gtk.STOCK_MEDIA_PAUSE) |
|
|
|
|
#mute_action.set_active(False) |
|
|
|
|
|
|
|
|
|
post_action = gtk.Action('Posts', '_Posts', 'Post management', None) |
|
|
|
|
|
|
|
|
|
file_action = gtk.Action('File', '_File', 'File', None) |
|
|
|
|
edit_action = gtk.Action('Edit', '_Edit', 'Edit', None) |
|
|
|
|
help_action = gtk.Action('Help', '_Help', 'Help', None) |
|
|
|
|
|
|
|
|
|
# action group (will have all the actions, 'cause we are not actually |
|
|
|
|
# grouping them, but Gtk requires them that way) |
|
|
|
|
|
|
|
|
|
self.action_group = gtk.ActionGroup('MainMenu') |
|
|
|
|
self.action_group.add_action_with_accel(refresh_action, 'F5') |
|
|
|
|
# None = use the default accelerator, based on the STOCK used. |
|
|
|
|
self.action_group.add_action_with_accel(quit_action, None) |
|
|
|
|
self.action_group.add_action(settings_action) |
|
|
|
|
self.action_group.add_action(delete_action) |
|
|
|
|
self.action_group.add_action(post_action) |
|
|
|
|
self.action_group.add_action(file_action) |
|
|
|
|
self.action_group.add_action(edit_action) |
|
|
|
|
self.action_group.add_action(help_action) |
|
|
|
|
self.action_group.add_action(about_action) |
|
|
|
|
#self.action_group.add_action_with_accel(shrink_url_action, '<Ctrl>u') |
|
|
|
|
#self.action_group.add_action_with_accel(mute_action, '<Ctrl>m') |
|
|
|
|
self.action_group.add_action_with_accel(self._update_action, |
|
|
|
|
'<Ctrl>Return') |
|
|
|
|
|
|
|
|
|
# definition of the UI |
|
|
|
|
|
|
|
|
|
uimanager = gtk.UIManager() |
|
|
|
|
uimanager.insert_action_group(self.action_group, 0) |
|
|
|
|
ui = ''' |
|
|
|
|
# UI elements |
|
|
|
|
ui_elements = ''' |
|
|
|
|
<ui> |
|
|
|
|
<toolbar name="MainToolbar"> |
|
|
|
|
<toolitem action="Refresh" /> |
|
|
|
|
<separator /> |
|
|
|
|
<toolitem action="Delete" /> |
|
|
|
|
<toolitem action="Reply" /> |
|
|
|
|
<toolitem action="Retweet" /> |
|
|
|
|
<separator /> |
|
|
|
|
<toolitem action="Settings" /> |
|
|
|
|
<toolitem action="Quit" /> |
|
|
|
@ -364,19 +302,107 @@ class Interface(object):
|
|
|
|
|
<menu action="Edit"> |
|
|
|
|
<menuitem action="Refresh" /> |
|
|
|
|
<menuitem action="Update" /> |
|
|
|
|
<menuitem action="Delete" /> |
|
|
|
|
<menuitem action="ShrinkURL" /> |
|
|
|
|
<menuitem action="MuteNotify" /> |
|
|
|
|
<separator /> |
|
|
|
|
<menuitem action="Settings" /> |
|
|
|
|
</menu> |
|
|
|
|
<menu action="Message"> |
|
|
|
|
<menuitem action="Delete" /> |
|
|
|
|
<menuitem action="Reply" /> |
|
|
|
|
<menuitem action="Retweet" /> |
|
|
|
|
</menu> |
|
|
|
|
<menu action="Help"> |
|
|
|
|
<menuitem action="About" /> |
|
|
|
|
</menu> |
|
|
|
|
</menubar> |
|
|
|
|
</ui> |
|
|
|
|
''' |
|
|
|
|
uimanager.add_ui_from_string(ui) |
|
|
|
|
|
|
|
|
|
# The group with all actions; we are going to split them using the |
|
|
|
|
# definitions inside the XML. |
|
|
|
|
action_group = gtk.ActionGroup('Mitter') |
|
|
|
|
|
|
|
|
|
# Actions related to the UI elements above |
|
|
|
|
# Top-level menu actions |
|
|
|
|
file_action = gtk.Action('File', '_File', 'File', None) |
|
|
|
|
action_group.add_action(file_action) |
|
|
|
|
|
|
|
|
|
edit_action = gtk.Action('Edit', '_Edit', 'Edit', None) |
|
|
|
|
action_group.add_action(edit_action) |
|
|
|
|
|
|
|
|
|
message_action = gtk.Action('Message', '_Message', |
|
|
|
|
'Message related options', None) |
|
|
|
|
action_group.add_action(message_action) |
|
|
|
|
|
|
|
|
|
help_action = gtk.Action('Help', '_Help', 'Help', None) |
|
|
|
|
action_group.add_action(help_action) |
|
|
|
|
|
|
|
|
|
# File actions |
|
|
|
|
quit_action = gtk.Action('Quit', '_Quit', |
|
|
|
|
'Exit Mitter', gtk.STOCK_QUIT) |
|
|
|
|
quit_action.connect('activate', self._quit_app) |
|
|
|
|
action_group.add_action_with_accel(quit_action, None) |
|
|
|
|
|
|
|
|
|
# Edit actions |
|
|
|
|
refresh_action = gtk.Action('Refresh', '_Refresh', |
|
|
|
|
'Update the listing', gtk.STOCK_REFRESH) |
|
|
|
|
#refresh_action.connect('activate', self.refresh) |
|
|
|
|
action_group.add_action_with_accel(refresh_action, 'F5') |
|
|
|
|
|
|
|
|
|
self._update_action = gtk.Action('Update', '_Update', |
|
|
|
|
'Update your status', gtk.STOCK_ADD) |
|
|
|
|
self._update_action.set_property('sensitive', False) |
|
|
|
|
self._update_action.connect('activate', self._update_status) |
|
|
|
|
action_group.add_action_with_accel(self._update_action, |
|
|
|
|
'<Ctrl>Return') |
|
|
|
|
|
|
|
|
|
#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) |
|
|
|
|
action_group.add_action(settings_action) |
|
|
|
|
|
|
|
|
|
# Message actions |
|
|
|
|
delete_action = gtk.Action('Delete', '_Delete', 'Delete a post', |
|
|
|
|
gtk.STOCK_DELETE) |
|
|
|
|
delete_action.set_property('sensitive', False) |
|
|
|
|
#delete_action.connect('activate', self.delete_tweet) |
|
|
|
|
action_group.add_action(delete_action) |
|
|
|
|
|
|
|
|
|
reply_action = gtk.Action('Reply', '_Reply', |
|
|
|
|
"Send a response to someone's else message", gtk.STOCK_REDO) |
|
|
|
|
reply_action.set_property('sensitive', False) |
|
|
|
|
# TODO: Connect |
|
|
|
|
action_group.add_action(reply_action) |
|
|
|
|
|
|
|
|
|
# TODO: Find a better word (non-network related) to this |
|
|
|
|
retweet_action = gtk.Action('Retweet', 'Re_tweet', |
|
|
|
|
"Put someone's else message on your timeline", |
|
|
|
|
gtk.STOCK_CONVERT) |
|
|
|
|
retweet_action.set_property('sensitive', False) |
|
|
|
|
# TODO: Connect |
|
|
|
|
action_group.add_action(retweet_action) |
|
|
|
|
|
|
|
|
|
# Help actions |
|
|
|
|
about_action = gtk.Action('About', '_About', 'About Mitter', |
|
|
|
|
gtk.STOCK_ABOUT) |
|
|
|
|
about_action.connect('activate', self._show_about) |
|
|
|
|
action_group.add_action(about_action) |
|
|
|
|
|
|
|
|
|
# definition of the UI |
|
|
|
|
uimanager = gtk.UIManager() |
|
|
|
|
uimanager.insert_action_group(action_group, 0) |
|
|
|
|
uimanager.add_ui_from_string(ui_elements) |
|
|
|
|
|
|
|
|
|
main_menu = uimanager.get_widget('/MainMenu') |
|
|
|
|
main_toolbar = uimanager.get_widget('/MainToolbar') |
|
|
|
|