コード例 #1
0
static void
ide_autotools_build_system_tags_build_async (IdeTagsBuilder      *builder,
                                             GFile               *file_or_directory,
                                             gboolean             recursive,
                                             GCancellable        *cancellable,
                                             GAsyncReadyCallback  callback,
                                             gpointer             user_data)
{
  IdeAutotoolsBuildSystem *self = (IdeAutotoolsBuildSystem *)builder;
  IdeConfigurationManager *config_manager;
  IdeConfiguration *configuration;
  IdeContext *context;
  g_autoptr(GTask) task = NULL;

  g_assert (IDE_IS_AUTOTOOLS_BUILD_SYSTEM (self));
  g_assert (G_IS_FILE (file_or_directory));
  g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));

  context = ide_object_get_context (IDE_OBJECT (self));
  config_manager = ide_context_get_configuration_manager (context);
  configuration = ide_configuration_manager_get_current (config_manager);

  task = g_task_new (self, cancellable, callback, user_data);
  simple_make_command (file_or_directory, "ctags", task, configuration);
}
コード例 #2
0
static void
do_run_async (IdeRunManager *self,
              GTask         *task)
{
  IdeBuildTarget *build_target;
  IdeContext *context;
  IdeConfigurationManager *config_manager;
  IdeConfiguration *config;
  IdeRuntime *runtime;
  g_autoptr(IdeRunner) runner = NULL;
  GCancellable *cancellable;

  g_assert (IDE_IS_RUN_MANAGER (self));
  g_assert (G_IS_TASK (task));

  build_target = g_task_get_task_data (task);
  context = ide_object_get_context (IDE_OBJECT (self));

  g_assert (IDE_IS_BUILD_TARGET (build_target));
  g_assert (IDE_IS_CONTEXT (context));

  config_manager = ide_context_get_configuration_manager (context);
  config = ide_configuration_manager_get_current (config_manager);
  runtime = ide_configuration_get_runtime (config);

  if (runtime == NULL)
    {
      g_task_return_new_error (task,
                               IDE_RUNTIME_ERROR,
                               IDE_RUNTIME_ERROR_NO_SUCH_RUNTIME,
                               "%s “%s”",
                               _("Failed to locate runtime"),
                               ide_configuration_get_runtime_id (config));
      IDE_EXIT;
    }

  runner = ide_runtime_create_runner (runtime, build_target);
  cancellable = g_task_get_cancellable (task);

  g_assert (IDE_IS_RUNNER (runner));
  g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));

  /*
   * If the current handler has a callback specified (our default "run" handler
   * does not), then we need to allow that handler to prepare the runner.
   */
  if (self->handler != NULL && self->handler->handler != NULL)
    self->handler->handler (self, runner, self->handler->handler_data);

  g_signal_emit (self, signals [RUN], 0, runner);

  ide_runner_run_async (runner,
                        cancellable,
                        ide_run_manager_run_cb,
                        g_object_ref (task));
}
コード例 #3
0
static void
ide_omni_bar_context_set (GtkWidget  *widget,
                          IdeContext *context)
{
  IdeOmniBar *self = (IdeOmniBar *)widget;
  IdeConfigurationManager *config_manager = NULL;
  IdeBuildManager *build_manager = NULL;
  GListModel *pausables = NULL;
  IdeProject *project = NULL;
  IdeVcs *vcs = NULL;

  IDE_ENTRY;

  g_assert (IDE_IS_OMNI_BAR (self));
  g_assert (!context || IDE_IS_CONTEXT (context));

  ide_omni_bar_update (self);

  if (context != NULL)
    {
      vcs = ide_context_get_vcs (context);
      build_manager = ide_context_get_build_manager (context);
      config_manager = ide_context_get_configuration_manager (context);
      project = ide_context_get_project (context);
      pausables = _ide_context_get_pausables (context);
    }

  dzl_binding_group_set_source (self->build_manager_bindings, build_manager);
  dzl_signal_group_set_target (self->build_manager_signals, build_manager);
  dzl_binding_group_set_source (self->config_manager_bindings, config_manager);
  dzl_signal_group_set_target (self->config_manager_signals, config_manager);
  dzl_binding_group_set_source (self->project_bindings, project);
  dzl_binding_group_set_source (self->vcs_bindings, vcs);
  dzl_list_box_set_model (self->pausables, pausables);

  if (config_manager != NULL)
    ide_omni_bar__config_manager__notify_current (self, NULL, config_manager);

  IDE_EXIT;
}