[gnome-builder] run manager: move to DzlShortcut classes



commit cd2374247fc2b4cf80598e980525a6365e630171
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Tue Aug 15 23:28:11 2017 +0200

    run manager: move to DzlShortcut classes

 libide/runner/ide-run-manager.c               |   20 +++++++++++++++-----
 plugins/sysprof/gbp-sysprof-workbench-addin.c |    2 +-
 plugins/valgrind/valgrind_plugin.py           |    2 +-
 3 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/libide/runner/ide-run-manager.c b/libide/runner/ide-run-manager.c
index 22ffe02..85400b6 100644
--- a/libide/runner/ide-run-manager.c
+++ b/libide/runner/ide-run-manager.c
@@ -690,8 +690,9 @@ ide_run_manager_add_handler (IdeRunManager  *self,
                              GDestroyNotify  user_data_destroy)
 {
   IdeRunHandlerInfo *info;
+  DzlShortcutManager *manager;
+  DzlShortcutTheme *theme;
   g_autofree gchar *action_name = NULL;
-  const gchar *accels[] = { accel, NULL };
   GApplication *app;
 
   g_return_if_fail (IDE_IS_RUN_MANAGER (self));
@@ -707,13 +708,22 @@ ide_run_manager_add_handler (IdeRunManager  *self,
   info->handler_data = user_data;
   info->handler_data_destroy = user_data_destroy;
 
+  self->handlers = g_list_append (self->handlers, info);
+
   app = g_application_get_default ();
+  manager = dzl_application_get_shortcut_manager (DZL_APPLICATION (app));
+  theme = g_object_ref (dzl_shortcut_manager_get_theme (manager));
+
   action_name = g_strdup_printf ("run-manager.run-with-handler('%s')", id);
 
-  if (accel != NULL && app != NULL)
-    gtk_application_set_accels_for_action (GTK_APPLICATION (app), action_name, accels);
+  dzl_shortcut_manager_add_action (manager,
+                                   action_name,
+                                   NC_("shortcut winndow", "Workbench shortcuts"),
+                                   NC_("shortcut winndow", "Build and Run"),
+                                   NC_("shortcut winndow", title),
+                                   NULL);
 
-  self->handlers = g_list_append (self->handlers, info);
+  dzl_shortcut_theme_set_accel_for_action (theme, action_name, accel, DZL_SHORTCUT_PHASE_DISPATCH);
 
   if (self->handler == NULL)
     self->handler = info;
@@ -1103,7 +1113,7 @@ ide_run_manager_init (IdeRunManager *self)
                                "run",
                                _("Run"),
                                "media-playback-start-symbolic",
-                               "<Control>F5",
+                               "<primary>F5",
                                NULL,
                                NULL,
                                NULL);
diff --git a/plugins/sysprof/gbp-sysprof-workbench-addin.c b/plugins/sysprof/gbp-sysprof-workbench-addin.c
index 0786faa..48c4204 100644
--- a/plugins/sysprof/gbp-sysprof-workbench-addin.c
+++ b/plugins/sysprof/gbp-sysprof-workbench-addin.c
@@ -475,7 +475,7 @@ gbp_sysprof_workbench_addin_load (IdeWorkbenchAddin *addin,
                                "profiler",
                                _("Run with Profiler"),
                                "utilities-system-monitor-symbolic",
-                               "<Control>F8",
+                               "<primary>F8",
                                profiler_run_handler,
                                self,
                                NULL);
diff --git a/plugins/valgrind/valgrind_plugin.py b/plugins/valgrind/valgrind_plugin.py
index 8327691..5c420f8 100644
--- a/plugins/valgrind/valgrind_plugin.py
+++ b/plugins/valgrind/valgrind_plugin.py
@@ -49,7 +49,7 @@ class ValgrindWorkbenchAddin(GObject.Object, Ide.WorkbenchAddin):
             runtime = pipeline.get_configuration().get_runtime()
             if runtime and runtime.contains_program_in_path('valgrind'):
                 if not self.has_handler:
-                    run_manager.add_handler('valgrind', _('Run with Valgrind'), 'system-run-symbolic', 
'<control>F10', self.valgrind_handler)
+                    run_manager.add_handler('valgrind', _('Run with Valgrind'), 'system-run-symbolic', 
'<primary>F10', self.valgrind_handler)
                     self.has_handler = True
                 return
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]