예제 #1
0
static void
ide_omni_bar_update (IdeOmniBar *self)
{
  g_autofree gchar *branch_name = NULL;
  const gchar *project_name = NULL;
  IdeContext *context;

  g_assert (IDE_IS_OMNI_BAR (self));

  context = ide_widget_get_context (GTK_WIDGET (self));

  if (IDE_IS_CONTEXT (context))
    {
      IdeProject *project;
      IdeVcs *vcs;

      project = ide_context_get_project (context);
      project_name = ide_project_get_name (project);

      vcs = ide_context_get_vcs (context);
      branch_name = ide_vcs_get_branch_name (vcs);
    }

  gtk_label_set_label (self->project_label, project_name);
  gtk_label_set_label (self->branch_label, branch_name);
  gtk_label_set_label (self->popover_branch_label, branch_name);
}
예제 #2
0
gchar *
ide_build_system_get_builddir (IdeBuildSystem   *self,
                               IdePipeline *pipeline)
{
  gchar *ret = NULL;

  IDE_ENTRY;

  g_return_val_if_fail (IDE_IS_BUILD_SYSTEM (self), NULL);
  g_return_val_if_fail (IDE_IS_PIPELINE (pipeline), NULL);

  if (IDE_BUILD_SYSTEM_GET_IFACE (self)->get_builddir)
    ret = IDE_BUILD_SYSTEM_GET_IFACE (self)->get_builddir (self, pipeline);

  if (ret == NULL)
    {
      g_autofree gchar *name = NULL;
      g_autofree gchar *branch = NULL;
      g_autoptr(GFile) base = NULL;
      g_autoptr(GFile) nosymlink = NULL;
      IdeConfig *config;
      const gchar *config_id;
      const gchar *runtime_id;
      IdeRuntime *runtime;
      IdeContext *context;
      IdeVcs *vcs;

      context = ide_object_get_context (IDE_OBJECT (self));
      vcs = ide_vcs_from_context (context);
      config = ide_pipeline_get_config (pipeline);
      config_id = ide_config_get_id (config);
      runtime = ide_pipeline_get_runtime (pipeline);
      runtime_id = ide_runtime_get_id (runtime);
      branch = ide_vcs_get_branch_name (vcs);

      if (branch != NULL)
        name = g_strdup_printf ("%s-%s-%s", config_id, runtime_id, branch);
      else
        name = g_strdup_printf ("%s-%s", config_id, runtime_id);

      g_strdelimit (name, "@:/ ", '-');

      /* Avoid symlink's when we can, so that paths with symlinks have at least
       * a chance of working.
       */
      base = ide_context_cache_file (context, "builds", name, NULL);
      nosymlink = _ide_g_file_readlink (base);

      ret = g_file_get_path (nosymlink);
    }

  IDE_RETURN (ret);
}
예제 #3
0
gchar *
gbp_flatpak_get_staging_dir (IdePipeline *pipeline)
{
  g_autofree gchar *branch = NULL;
  g_autofree gchar *name = NULL;
  g_autofree gchar *arch = NULL;
  g_autoptr (IdeTriplet) triplet = NULL;
  g_autoptr(IdeContext) context = NULL;
  g_autoptr(IdeVcs) vcs = NULL;
  g_autoptr(IdeToolchain) toolchain = NULL;

  g_assert (IDE_IS_PIPELINE (pipeline));

  context = ide_object_ref_context (IDE_OBJECT (pipeline));
  vcs = ide_vcs_ref_from_context (context);
  branch = ide_vcs_get_branch_name (vcs);
  arch = ide_pipeline_get_arch (pipeline);
  name = g_strdup_printf ("%s-%s", arch, branch);

  g_strdelimit (name, G_DIR_SEPARATOR_S, '-');

  return ide_context_cache_filename (context, "flatpak", "staging", name, NULL);
}