[anjuta/git-shell] git: Implement the Unstage pane



commit 75549bb0281db7fd4e17d6565b73705cf4e3d515
Author: James Liggett <jrliggett cox net>
Date:   Sat Jul 10 23:12:43 2010 -0700

    git: Implement the Unstage pane

 plugins/git/Makefile.am        |    4 ++-
 plugins/git/git-unstage-pane.c |   53 ++++++++++++++++++++++++++++++++++++++++
 plugins/git/git-unstage-pane.h |   28 +++++++++++++++++++++
 plugins/git/plugin.c           |    9 +++++++
 4 files changed, 93 insertions(+), 1 deletions(-)
---
diff --git a/plugins/git/Makefile.am b/plugins/git/Makefile.am
index 3df8004..4fc3c54 100644
--- a/plugins/git/Makefile.am
+++ b/plugins/git/Makefile.am
@@ -183,7 +183,9 @@ libanjuta_git_la_SOURCES = \
 	git-pull-pane.h \
 	git-pull-pane.c \
 	git-checkout-pane.c \
-	git-checkout-pane.h
+	git-checkout-pane.h \
+	git-unstage-pane.c \
+	git-unstage-pane.h
 
 libanjuta_git_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
 
diff --git a/plugins/git/git-unstage-pane.c b/plugins/git/git-unstage-pane.c
new file mode 100644
index 0000000..a058993
--- /dev/null
+++ b/plugins/git/git-unstage-pane.c
@@ -0,0 +1,53 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * git-shell-test
+ * Copyright (C) James Liggett 2010 <jrliggett cox net>
+ * 
+ * git-shell-test is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * git-shell-test is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "git-unstage-pane.h"
+
+void
+on_unstage_button_clicked (GtkAction *action, Git *plugin)
+{
+	GList *paths;
+	GitResetFilesCommand *reset_command;
+
+	paths = git_status_pane_get_selected_commit_items (GIT_STATUS_PANE (plugin->status_pane),
+	                                                   ANJUTA_VCS_STATUS_ALL);
+
+	if (paths)
+	{
+		reset_command = git_reset_files_command_new (plugin->project_root_directory,
+		                                             GIT_RESET_FILES_HEAD,
+		                                             paths);
+
+		git_command_free_string_list (paths);
+
+		g_signal_connect (G_OBJECT (reset_command), "command-finished",
+		                  G_CALLBACK (git_pane_report_errors),
+		                  plugin);
+
+
+		g_signal_connect (G_OBJECT (reset_command), "command-finished",
+		                  G_CALLBACK (g_object_unref),
+		                  NULL);
+
+		anjuta_command_start (ANJUTA_COMMAND (reset_command));
+	}
+	else
+		anjuta_util_dialog_error (NULL, _("No staged files selected."));
+}
+ 
\ No newline at end of file
diff --git a/plugins/git/git-unstage-pane.h b/plugins/git/git-unstage-pane.h
new file mode 100644
index 0000000..8f02c00
--- /dev/null
+++ b/plugins/git/git-unstage-pane.h
@@ -0,0 +1,28 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * git-shell-test
+ * Copyright (C) James Liggett 2010 <jrliggett cox net>
+ * 
+ * git-shell-test is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * git-shell-test is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _GIT_UNSTAGE_PANE_H_
+#define _GIT_UNSTAGE_PANE_H_
+
+#include "git-reset-files-command.h"
+#include "git-status-pane.h"
+
+void on_unstage_button_clicked (GtkAction *action, Git *plugin);
+
+#endif
\ No newline at end of file
diff --git a/plugins/git/plugin.c b/plugins/git/plugin.c
index 7ddb113..a108ec6 100644
--- a/plugins/git/plugin.c
+++ b/plugins/git/plugin.c
@@ -34,6 +34,7 @@
 #include "git-push-pane.h"
 #include "git-pull-pane.h"
 #include "git-checkout-pane.h"
+#include "git-unstage-pane.h"
 
 AnjutaCommandBarEntry branch_entries[] =
 {
@@ -129,6 +130,14 @@ AnjutaCommandBarEntry status_entries[] =
 		GTK_STOCK_UNDO,
 		G_CALLBACK (on_checkout_button_clicked)
 	},
+	{
+		ANJUTA_COMMAND_BAR_ENTRY_BUTTON,
+		"Unstage",
+		N_("Unstage"),
+		N_("Remove staged files from the index"),
+		GTK_STOCK_CANCEL,
+		G_CALLBACK (on_unstage_button_clicked)
+	}
 	
 };
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]