コード例 #1
0
ファイル: gb-vim.c プロジェクト: MaX121/gnome-builder
static gboolean
gb_vim_command_quit (GtkSourceView  *source_view,
                     const gchar    *command,
                     const gchar    *options,
                     GError        **error)
{
  gb_widget_activate_action (GTK_WIDGET (source_view), "view", "save", NULL);
  gb_widget_activate_action (GTK_WIDGET (source_view), "view", "close", NULL);
  return TRUE;
}
コード例 #2
0
ファイル: gb-vim.c プロジェクト: MaX121/gnome-builder
static gboolean
gb_vim_command_buffers (GtkSourceView  *source_view,
                        const gchar    *command,
                        const gchar    *options,
                        GError        **error)
{
  gb_widget_activate_action (GTK_WIDGET (source_view), "view-stack", "show-list", NULL);
  return TRUE;
}
コード例 #3
0
ファイル: gb-vim.c プロジェクト: MaX121/gnome-builder
static gboolean
gb_vim_command_make (GtkSourceView  *source_view,
                     const gchar    *command,
                     const gchar    *options,
                     GError        **error)
{
  gb_widget_activate_action (GTK_WIDGET (source_view), "workbench", "build", NULL);
  return TRUE;
}
コード例 #4
0
ファイル: gb-vim.c プロジェクト: MaX121/gnome-builder
static gboolean
gb_vim_command_help (GtkSourceView  *source_view,
                     const gchar    *command,
                     const gchar    *options,
                     GError        **error)
{
  GVariant *param;

  param = g_variant_new_string (options);
  gb_widget_activate_action (GTK_WIDGET (source_view), "workbench", "search-docs", param);
  return TRUE;
}
コード例 #5
0
ファイル: gb-vim.c プロジェクト: MaX121/gnome-builder
static gboolean
gb_vim_command_tabe (GtkSourceView  *source_view,
                     const gchar    *command,
                     const gchar    *options,
                     GError        **error)
{
  if (!ide_str_empty0 (options))
    return gb_vim_command_edit (source_view, command, options, error);

  gb_widget_activate_action (GTK_WIDGET (source_view), "workbench", "new-document", NULL);

  return TRUE;
}
コード例 #6
0
static void
child_exited_cb (VteTerminal    *terminal,
                 gint            exit_status,
                 GbTerminalView *self)
{
  g_assert (VTE_IS_TERMINAL (terminal));
  g_assert (GB_IS_TERMINAL_VIEW (self));

  if (!gb_widget_activate_action (GTK_WIDGET (self), "view-stack", "close", NULL))
    {
      if (!gtk_widget_in_destruction (GTK_WIDGET (terminal)))
        gb_terminal_respawn (self, terminal);
    }
}
コード例 #7
0
static void
gb_editor_view_actions_close (GSimpleAction *action,
                              GVariant      *param,
                              gpointer       user_data)
{
  GbEditorView *self = user_data;

  g_assert (GB_IS_EDITOR_VIEW (self));

  /* just close our current frame if we have split view */
  if (self->frame2 != NULL)
    {
      /* todo: swap frame1/frame2 if frame2 was last focused. */
      g_timeout_add (0, set_split_view, g_object_ref (self));
    }
  else
    {
      gb_widget_activate_action (GTK_WIDGET (self), "view-stack", "close", NULL);
    }
}
コード例 #8
0
ファイル: gb-vim.c プロジェクト: MaX121/gnome-builder
static gboolean
gb_vim_command_edit (GtkSourceView  *source_view,
                     const gchar    *command,
                     const gchar    *options,
                     GError        **error)
{
  GbWorkbench *workbench;
  IdeContext *context;
  IdeVcs *vcs;
  GFile *workdir;
  GFile *file = NULL;

  if (ide_str_empty0 (options))
    {
      gb_widget_activate_action (GTK_WIDGET (source_view), "workbench", "open", NULL);
      return TRUE;
    }

  if (!(workbench = gb_widget_get_workbench (GTK_WIDGET (source_view))) ||
      !(context = gb_workbench_get_context (workbench)) ||
      !(vcs = ide_context_get_vcs (context)) ||
      !(workdir = ide_vcs_get_working_directory (vcs)))
    {
      g_set_error (error,
                   GB_VIM_ERROR,
                   GB_VIM_ERROR_NOT_SOURCE_VIEW,
                   _("Failed to locate working directory"));
      return FALSE;
    }

  if (g_path_is_absolute (options))
    file = g_file_new_for_path (options);
  else
    file = g_file_get_child (workdir, options);

  gb_workbench_open (workbench, file);

  g_clear_object (&file);

  return TRUE;
}