Пример #1
0
static void
ide_run_manager_init (IdeRunManager *self)
{
  ide_run_manager_add_handler (self,
                               "run",
                               _("Run"),
                               "media-playback-start-symbolic",
                               "<Control>F5",
                               NULL,
                               NULL,
                               NULL);
}
static void
ide_debugger_editor_addin_load (IdeEditorAddin   *addin,
                                IdeEditorSurface *editor)
{
  IdeDebuggerEditorAddin *self = (IdeDebuggerEditorAddin *)addin;
  IdeContext *context;
  IdeRunManager *run_manager;
  IdeDebugManager *debug_manager;

  IDE_ENTRY;

  g_assert (IDE_IS_DEBUGGER_EDITOR_ADDIN (self));
  g_assert (IDE_IS_EDITOR_SURFACE (editor));

  self->editor = editor;
  self->workbench = ide_widget_get_workbench (GTK_WIDGET (editor));

  if (!ide_workbench_has_project (self->workbench))
    return;

  context = ide_widget_get_context (GTK_WIDGET (editor));
  run_manager = ide_run_manager_from_context (context);
  debug_manager = ide_debug_manager_from_context (context);

  ide_debugger_editor_addin_add_ui (self);

  ide_run_manager_add_handler (run_manager,
                               "debugger",
                               _("Run with Debugger"),
                               "builder-debugger-symbolic",
                               "F5",
                               debugger_run_handler,
                               g_object_ref (self),
                               g_object_unref);

  self->debugger_signals = dzl_signal_group_new (IDE_TYPE_DEBUGGER);

  dzl_signal_group_connect_swapped (self->debugger_signals,
                                    "log",
                                    G_CALLBACK (debugger_log),
                                    self);

  dzl_signal_group_connect_swapped (self->debugger_signals,
                                    "stopped",
                                    G_CALLBACK (debugger_stopped),
                                    self);

  self->debug_manager_signals = dzl_signal_group_new (IDE_TYPE_DEBUG_MANAGER);

  dzl_signal_group_connect_swapped (self->debug_manager_signals,
                                    "notify::active",
                                    G_CALLBACK (debug_manager_notify_active),
                                    self);

  dzl_signal_group_connect_swapped (self->debug_manager_signals,
                                    "notify::debugger",
                                    G_CALLBACK (debug_manager_notify_debugger),
                                    self);

  dzl_signal_group_set_target (self->debug_manager_signals, debug_manager);

  IDE_EXIT;
}