[anjuta/git-shell] git: Include a version of the Apply Stash pane that can restore the index



commit 2a0f252091cd31a70b15310e3fb1fe8cc5925e0b
Author: James Liggett <jrliggett cox net>
Date:   Tue Jul 27 22:33:09 2010 -0700

    git: Include a version of the Apply Stash pane that can restore the index

 plugins/git/git-apply-stash-pane.c |   18 +++++++++++++++---
 plugins/git/git-apply-stash-pane.h |    1 +
 plugins/git/plugin.c               |    8 ++++++++
 3 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/plugins/git/git-apply-stash-pane.c b/plugins/git/git-apply-stash-pane.c
index 22731a7..c5a04c8 100644
--- a/plugins/git/git-apply-stash-pane.c
+++ b/plugins/git/git-apply-stash-pane.c
@@ -19,8 +19,8 @@
 
 #include "git-apply-stash-pane.h"
 
-void
-on_apply_stash_button_clicked (GtkAction *action, Git *plugin)
+static void
+apply_stash (Git *plugin, gboolean restore_index)
 {
 	gchar *stash;
 	GitStashApplyCommand *apply_command;
@@ -30,7 +30,7 @@ on_apply_stash_button_clicked (GtkAction *action, Git *plugin)
 	if (stash)
 	{
 		apply_command = git_stash_apply_command_new (plugin->project_root_directory,
-		                                             FALSE, stash);
+		                                             restore_index, stash);
 		g_free (stash);
 
 		git_pane_create_message_view (plugin);
@@ -53,4 +53,16 @@ on_apply_stash_button_clicked (GtkAction *action, Git *plugin)
 	else
 		anjuta_util_dialog_error (NULL, _("No stash selected."));
 }
+
+void
+on_apply_stash_button_clicked (GtkAction *action, Git *plugin)
+{
+	apply_stash (plugin, FALSE);
+}
+
+void
+on_apply_stash_index_button_clicked (GtkAction *action, Git *plugin)
+{
+	apply_stash (plugin, TRUE);
+}
  
\ No newline at end of file
diff --git a/plugins/git/git-apply-stash-pane.h b/plugins/git/git-apply-stash-pane.h
index 9a93f09..ed753fa 100644
--- a/plugins/git/git-apply-stash-pane.h
+++ b/plugins/git/git-apply-stash-pane.h
@@ -24,5 +24,6 @@
 #include "git-stash-pane.h"
 
 void on_apply_stash_button_clicked (GtkAction *action, Git *plugin);
+void on_apply_stash_index_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 434c32a..0e2371b 100644
--- a/plugins/git/plugin.c
+++ b/plugins/git/plugin.c
@@ -274,6 +274,14 @@ AnjutaCommandBarEntry stash_entries[] =
 		N_("Apply stashed changes back into the working tree"),
 		GTK_STOCK_APPLY,
 		G_CALLBACK (on_apply_stash_button_clicked)
+	},
+	{
+		ANJUTA_COMMAND_BAR_ENTRY_BUTTON,
+		"ApplyStashIndex",
+		N_("Apply stash and restore index"),
+		N_("Apply stashed changes back into the working tree and the index"),
+		GTK_STOCK_OK,
+		G_CALLBACK (on_apply_stash_index_button_clicked)
 	}
 	
 };



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