[anjuta] git: Allow creating stashes from the stash widget
- From: James Liggett <jrliggett src gnome org>
- To: svn-commits-list gnome org
- Subject: [anjuta] git: Allow creating stashes from the stash widget
- Date: Fri, 24 Jul 2009 01:49:18 +0000 (UTC)
commit deadf1cac2bf2eef52b3f4a01179c0960433844c
Author: James Liggett <jrliggett cox net>
Date: Mon Jul 20 17:41:07 2009 -0700
git: Allow creating stashes from the stash widget
plugins/git/git-stash-changes-dialog.c | 18 +-----------------
plugins/git/git-stash-widget.c | 29 +++++++++++++++++++++++++++++
plugins/git/git-stash-widget.h | 1 +
plugins/git/git-ui-utils.c | 16 ++++++++++++++++
plugins/git/git-ui-utils.h | 2 ++
5 files changed, 49 insertions(+), 17 deletions(-)
---
diff --git a/plugins/git/git-stash-changes-dialog.c b/plugins/git/git-stash-changes-dialog.c
index 21651af..b831dbc 100644
--- a/plugins/git/git-stash-changes-dialog.c
+++ b/plugins/git/git-stash-changes-dialog.c
@@ -20,22 +20,6 @@
#include "git-stash-changes-dialog.h"
static void
-on_stash_command_finished (AnjutaCommand *command, guint return_code,
- Git *plugin)
-{
- AnjutaStatus *status;
-
- status = anjuta_shell_get_status (ANJUTA_PLUGIN (plugin)->shell,
- NULL);
-
- anjuta_status (status, _("Git: Changes stored in a stash."), 5);
-
- git_report_errors (command, return_code);
-
- g_object_unref (command);
-}
-
-static void
on_stash_changes_dialog_response (GtkDialog *dialog, gint response,
GitUIData *data)
{
@@ -67,7 +51,7 @@ on_stash_changes_dialog_response (GtkDialog *dialog, gint response,
git_create_message_view (data->plugin);
g_signal_connect (G_OBJECT (stash_command), "command-finished",
- G_CALLBACK (on_stash_command_finished),
+ G_CALLBACK (on_git_stash_save_command_finished),
data->plugin);
g_signal_connect (G_OBJECT (stash_command), "data-arrived",
diff --git a/plugins/git/git-stash-widget.c b/plugins/git/git-stash-widget.c
index 906901f..6416396 100644
--- a/plugins/git/git-stash-widget.c
+++ b/plugins/git/git-stash-widget.c
@@ -76,6 +76,28 @@ on_stash_widget_view_row_selected (GtkTreeSelection *selection,
return TRUE;
}
+static void
+on_stash_widget_save_button_clicked (GtkButton *button, GitUIData *data)
+{
+ GitStashSaveCommand *save_command;
+
+ save_command = git_stash_save_command_new (data->plugin->project_root_directory,
+ FALSE, NULL);
+
+ git_create_message_view (data->plugin);
+
+ g_signal_connect (G_OBJECT (save_command), "command-finished",
+ G_CALLBACK (on_git_stash_save_command_finished),
+ data->plugin);
+
+ g_signal_connect (G_OBJECT (save_command), "data-arrived",
+ G_CALLBACK (on_git_command_info_arrived),
+ data->plugin);
+
+ anjuta_command_start (ANJUTA_COMMAND (save_command));
+
+}
+
void
git_stash_widget_create (Git *plugin, GtkWidget **stash_widget,
GtkWidget **stash_widget_grip)
@@ -89,6 +111,7 @@ git_stash_widget_create (Git *plugin, GtkWidget **stash_widget,
GtkWidget *stash_widget_scrolled_window;
GtkWidget *stash_widget_view;
GtkWidget *stash_widget_grip_hbox;
+ GtkWidget *stash_widget_save_button;
GtkTreeSelection *selection;
bxml = gtk_builder_new ();
@@ -108,12 +131,18 @@ git_stash_widget_create (Git *plugin, GtkWidget **stash_widget,
"stash_widget_view"));
stash_widget_grip_hbox = GTK_WIDGET (gtk_builder_get_object (bxml,
"stash_widget_grip_hbox"));
+ stash_widget_save_button = GTK_WIDGET (gtk_builder_get_object (bxml,
+ "stash_widget_save_button"));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (stash_widget_view));
gtk_tree_selection_set_select_function (selection,
(GtkTreeSelectionFunc) on_stash_widget_view_row_selected,
data, NULL);
+ g_signal_connect (G_OBJECT (stash_widget_save_button), "clicked",
+ G_CALLBACK (on_stash_widget_save_button_clicked),
+ data);
+
g_object_set_data_full (G_OBJECT (stash_widget_scrolled_window), "ui-data",
data, (GDestroyNotify) git_ui_data_free);
diff --git a/plugins/git/git-stash-widget.h b/plugins/git/git-stash-widget.h
index 6fa36d1..d047738 100644
--- a/plugins/git/git-stash-widget.h
+++ b/plugins/git/git-stash-widget.h
@@ -21,6 +21,7 @@
#define _GIT_STASH_WIDGET_H
#include "git-ui-utils.h"
+#include "git-stash-save-command.h"
void git_stash_widget_create (Git *plugin, GtkWidget **stash_widget,
GtkWidget **stash_widget_grip);
diff --git a/plugins/git/git-ui-utils.c b/plugins/git/git-ui-utils.c
index c991dec..c7ee7c1 100644
--- a/plugins/git/git-ui-utils.c
+++ b/plugins/git/git-ui-utils.c
@@ -460,6 +460,22 @@ on_git_list_stash_command_data_arrived (AnjutaCommand *command,
}
void
+on_git_stash_save_command_finished (AnjutaCommand *command, guint return_code,
+ Git *plugin)
+{
+ AnjutaStatus *status;
+
+ status = anjuta_shell_get_status (ANJUTA_PLUGIN (plugin)->shell,
+ NULL);
+
+ anjuta_status (status, _("Git: Changes stored in a stash."), 5);
+
+ git_report_errors (command, return_code);
+
+ g_object_unref (command);
+}
+
+void
git_select_all_status_items (GtkButton *select_all_button,
AnjutaVcsStatusTreeView *tree_view)
{
diff --git a/plugins/git/git-ui-utils.h b/plugins/git/git-ui-utils.h
index e9e9f0c..362d3cd 100644
--- a/plugins/git/git-ui-utils.h
+++ b/plugins/git/git-ui-utils.h
@@ -83,6 +83,8 @@ void on_git_list_tag_command_data_arrived (AnjutaCommand *command,
GtkListStore *tag_list_model);
void on_git_list_stash_command_data_arrived (AnjutaCommand *command,
GtkListStore *stash_list_model);
+void on_git_stash_save_command_finished (AnjutaCommand *command,
+ guint return_code, Git *plugin);
void git_select_all_status_items (GtkButton *select_all_button,
AnjutaVcsStatusTreeView *tree_view);
void git_clear_all_status_selections (GtkButton *clear_button,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]