[anjuta] git: Implement branch switching by double-click
- From: James Liggett <jrliggett src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] git: Implement branch switching by double-click
- Date: Mon, 25 Mar 2013 20:27:37 +0000 (UTC)
commit 061323e33323a4a0f38e650c03307b6e180aaafc
Author: James Liggett <jrliggett cox net>
Date: Sun Mar 24 16:05:43 2013 -0700
git: Implement branch switching by double-click
Branches can now be checked out by double-clicking on them in the Branches
view.
plugins/git/git-branches-pane.c | 37 +++++++++++++++++++++++++++++++++++++
plugins/git/git-branches-pane.h | 1 +
2 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/plugins/git/git-branches-pane.c b/plugins/git/git-branches-pane.c
index e1cda47..1f3bd8e 100644
--- a/plugins/git/git-branches-pane.c
+++ b/plugins/git/git-branches-pane.c
@@ -264,6 +264,38 @@ selected_branches_table_foreach (gchar *name, gpointer value,
}
static void
+on_branches_view_row_activated (GtkTreeView *branches_view, GtkTreePath *path,
+ GtkTreeViewColumn *column, GitBranchesPane *self)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gchar *branch;
+ Git *plugin;
+ GitBranchCheckoutCommand *checkout_command;
+
+ model = gtk_tree_view_get_model (branches_view);
+ gtk_tree_model_get_iter (model, &iter, path);
+
+ gtk_tree_model_get (model, &iter, COL_NAME, &branch, -1);
+
+ plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self)));
+ checkout_command = git_branch_checkout_command_new (plugin->project_root_directory,
+ branch);
+
+ g_signal_connect (G_OBJECT (checkout_command), "command-finished",
+ G_CALLBACK (git_pane_report_errors),
+ plugin);
+
+ g_signal_connect (G_OBJECT (checkout_command), "command-finished",
+ G_CALLBACK (g_object_unref),
+ NULL);
+
+ g_free (branch);
+
+ anjuta_command_start (ANJUTA_COMMAND (checkout_command));
+}
+
+static void
git_branches_pane_init (GitBranchesPane *self)
{
gchar *objects[] = {"branches_pane",
@@ -333,6 +365,11 @@ git_branches_pane_init (GitBranchesPane *self)
g_signal_connect (G_OBJECT (branch_selected_renderer), "toggled",
G_CALLBACK (on_branch_selected_renderer_toggled),
self);
+
+ /* Switch branches on double-click */
+ g_signal_connect (G_OBJECT (branches_view), "row-activated",
+ G_CALLBACK (on_branches_view_row_activated),
+ self);
}
static void
diff --git a/plugins/git/git-branches-pane.h b/plugins/git/git-branches-pane.h
index fc4641f..08aa15f 100644
--- a/plugins/git/git-branches-pane.h
+++ b/plugins/git/git-branches-pane.h
@@ -22,6 +22,7 @@
#include <glib-object.h>
#include "git-pane.h"
+#include "git-branch-checkout-command.h"
G_BEGIN_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]