Commit c0a6c84a authored by Jakub Brindza's avatar Jakub Brindza

Accelerators refactored to use app.set_accels_for_action()

Differential Revision: https://phabricator.freedesktop.org/D1066
parent f901dd63
......@@ -155,17 +155,17 @@ class Pitivi(Gtk.Application, Loggable):
self.undo_action = Gio.SimpleAction.new("undo", None)
self.undo_action.connect("activate", self._undoCb)
self.add_action(self.undo_action)
self.add_accelerator("<Control>z", "app.undo", None)
self.set_accels_for_action("app.undo", ["<Control>z"])
self.redo_action = Gio.SimpleAction.new("redo", None)
self.redo_action.connect("activate", self._redoCb)
self.add_action(self.redo_action)
self.add_accelerator("<Control><Shift>z", "app.redo", None)
self.set_accels_for_action("app.redo", ["<Control><Shift>z"])
self.quit_action = Gio.SimpleAction.new("quit", None)
self.quit_action.connect("activate", self._quitCb)
self.add_action(self.quit_action)
self.add_accelerator("<Control>q", "app.quit", None)
self.set_accels_for_action("app.quit", ["<Control>q"])
def do_activate(self):
if self.gui:
......
......@@ -373,7 +373,7 @@ HARD_DEPENDENCIES = [GICheck("3.14.0"),
GstDependency("Gst", GST_API_VERSION, "1.6.0"),
GstDependency("GES", GST_API_VERSION, "1.6.0.0"),
GIDependency("GstTranscoder", GST_API_VERSION),
GtkDependency("Gtk", GTK_API_VERSION, "3.10.0"),
GtkDependency("Gtk", GTK_API_VERSION, "3.12.0"),
ClassicDependency("numpy"),
GIDependency("Gio", "2.0"),
GstPluginDependency("gstgtk", "1.6.0"),
......
......@@ -234,7 +234,7 @@ class EffectProperties(Gtk.Expander, Loggable):
self.remove_effect_action = Gio.SimpleAction.new("remove-effect", None)
self.remove_effect_action.connect("activate", self._removeEffectCb)
effects_actions_group.add_action(self.remove_effect_action)
self.app.add_accelerator("Delete", "clipproperties-effects.remove-effect", None)
self.app.set_accels_for_action("clipproperties-effects.remove-effect", ["Delete"])
self.remove_effect_action.set_enabled(False)
remove_effect_button.set_action_name("clipproperties-effects.remove-effect")
......
......@@ -462,33 +462,33 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
self.save_action = Gio.SimpleAction.new("save", None)
self.save_action.connect("activate", self._saveProjectCb)
self.add_action(self.save_action)
self.app.add_accelerator("<Control>s", "win.save", None)
self.app.set_accels_for_action("win.save", ["<Control>s"])
self.save_button.set_action_name("win.save")
self.new_project_action = Gio.SimpleAction.new("new-project", None)
self.new_project_action.connect("activate", self._newProjectMenuCb)
self.add_action(self.new_project_action)
self.app.add_accelerator("<Control>n", "win.new-project", None)
self.app.set_accels_for_action("win.new-project", ["<Control>n"])
self.open_project_action = Gio.SimpleAction.new("open-project", None)
self.open_project_action.connect("activate", self._openProjectCb)
self.add_action(self.open_project_action)
self.app.add_accelerator("<Control>o", "win.open-project", None)
self.app.set_accels_for_action("win.open-project", ["<Control>o"])
self.save_as_action = Gio.SimpleAction.new("save-as", None)
self.save_as_action.connect("activate", self._saveProjectAsCb)
self.add_action(self.save_as_action)
self.app.add_accelerator("<Control><Shift>s", "win.save-as", None)
self.app.set_accels_for_action("win.save-as", ["<Control><Shift>s"])
self.help_action = Gio.SimpleAction.new("help", None)
self.help_action.connect("activate", self._userManualCb)
self.add_action(self.help_action)
self.app.add_accelerator("F1", "win.help", None)
self.app.set_accels_for_action("win.help", ["F1"])
self.menu_button_action = Gio.SimpleAction.new("menu-button", None)
self.menu_button_action.connect("activate", self._menuCb)
self.add_action(self.menu_button_action)
self.app.add_accelerator("F10", "win.menu-button", None)
self.app.set_accels_for_action("win.menu-button", ["F10"])
def showProjectStatus(self):
project = self.app.project_manager.current_project
......
......@@ -427,12 +427,12 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
self.remove_assets_action = Gio.SimpleAction.new("remove-assets", None)
self.remove_assets_action.connect("activate", self._removeAssetsCb)
actions_group.add_action(self.remove_assets_action)
self.app.add_accelerator("<Control>Delete", "medialibrary.remove-assets", None)
self.app.set_accels_for_action("medialibrary.remove-assets", ["<Control>Delete"])
self.insert_at_end_action = Gio.SimpleAction.new("insert-assets-at-end", None)
self.insert_at_end_action.connect("activate", self._insertEndCb)
actions_group.add_action(self.insert_at_end_action)
self.app.add_accelerator("Insert", "medialibrary.insert-assets-at-end", None)
self.app.set_accels_for_action("medialibrary.insert-assets-at-end", ["Insert"])
self._updateActions()
......
......@@ -1428,51 +1428,51 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
self.zoom_in_action = Gio.SimpleAction.new("zoom-in", None)
self.zoom_in_action.connect("activate", self._zoomInCb)
group.add_action(self.zoom_in_action)
self.app.add_accelerator("<Control>plus", "timeline.zoom-in", None)
self.app.add_accelerator("<Control>equal", "timeline.zoom-in", None)
self.app.add_accelerator("<Control>KP_Add", "timeline.zoom-in", None)
self.app.set_accels_for_action("timeline.zoom-in", ["<Control>plus",
"<Control>equal",
"<Control>KP_Add"])
self.zoom_out_action = Gio.SimpleAction.new("zoom-out", None)
self.zoom_out_action.connect("activate", self._zoomOutCb)
group.add_action(self.zoom_out_action)
self.app.add_accelerator("<Control>minus", "timeline.zoom-out", None)
self.app.add_accelerator("<Control>KP_Subtract", "timeline.zoom-out", None)
self.app.set_accels_for_action("timeline.zoom-out", ["<Control>minus",
"<Control>KP_Subtract"])
self.zoom_fit_action = Gio.SimpleAction.new("zoom-fit", None)
self.zoom_fit_action.connect("activate", self._zoomFitCb)
group.add_action(self.zoom_fit_action)
self.app.add_accelerator("<Control>0", "timeline.zoom-fit", None)
self.app.set_accels_for_action("timeline.zoom-fit", ["<Control>0"])
# Clips actions.
self.delete_action = Gio.SimpleAction.new("delete-selected-clips", None)
self.delete_action.connect("activate", self._deleteSelected)
group.add_action(self.delete_action)
self.app.add_accelerator("Delete", "timeline.delete-selected-clips", None)
self.app.set_accels_for_action("timeline.delete-selected-clips", ["Delete"])
self.group_action = Gio.SimpleAction.new("group-selected-clips", None)
self.group_action.connect("activate", self._groupSelected)
group.add_action(self.group_action)
self.app.add_accelerator("<Control>g", "timeline.group-selected-clips", None)
self.app.set_accels_for_action("timeline.group-selected-clips", ["<Control>g"])
self.ungroup_action = Gio.SimpleAction.new("ungroup-selected-clips", None)
self.ungroup_action.connect("activate", self._ungroupSelected)
group.add_action(self.ungroup_action)
self.app.add_accelerator("<Shift><Control>g", "timeline.ungroup-selected-clips", None)
self.app.set_accels_for_action("timeline.ungroup-selected-clips", ["<Shift><Control>g"])
self.copy_action = Gio.SimpleAction.new("copy-selected-clips", None)
self.copy_action.connect("activate", self.__copyClipsCb)
group.add_action(self.copy_action)
self.app.add_accelerator("<Control>c", "timeline.copy-selected-clips", None)
self.app.set_accels_for_action("timeline.copy-selected-clips", ["<Control>c"])
self.paste_action = Gio.SimpleAction.new("paste-clips", None)
self.paste_action.connect("activate", self.__pasteClipsCb)
group.add_action(self.paste_action)
self.app.add_accelerator("<Control>v", "timeline.paste-clips", None)
self.app.set_accels_for_action("timeline.paste-clips", ["<Control>v"])
self.align_action = Gio.SimpleAction.new("align-selected-clips", None)
self.align_action.connect("activate", self._alignSelectedCb)
group.add_action(self.align_action)
self.app.add_accelerator("<Shift><Control>a", "timeline.align-selected-clips", None)
self.app.set_accels_for_action("timeline.align-selected-clips", ["<Shift><Control>a"])
self.gapless_action = Gio.SimpleAction.new("toggle-gapless-mode", None)
self.gapless_action.connect("activate", self._gaplessmodeToggledCb)
......@@ -1482,18 +1482,18 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
self.play_action = Gio.SimpleAction.new("play", None)
self.play_action.connect("activate", self._playPauseCb)
group.add_action(self.play_action)
self.app.add_accelerator("space", "timeline.play", None)
self.app.set_accels_for_action("timeline.play", ["space"])
self.split_action = Gio.SimpleAction.new("split-clips", None)
self.split_action.connect("activate", self._splitCb)
group.add_action(self.split_action)
self.app.add_accelerator("S", "timeline.split-clips", None)
self.app.set_accels_for_action("timeline.split-clips", ["S"])
self.split_action.set_enabled(True)
self.keyframe_action = Gio.SimpleAction.new("keyframe-selected-clips", None)
self.keyframe_action.connect("activate", self._keyframe_cb)
group.add_action(self.keyframe_action)
self.app.add_accelerator("K", "timeline.keyframe-selected-clips", None)
self.app.set_accels_for_action("timeline.keyframe-selected-clips", ["K"])
def _setBestZoomRatio(self, allow_zoom_in=False):
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment