[anjuta] git: Provide an automatically updated list of project stashes in the stash widget



commit 67ded17b0856c46f68ffae0baec8424e5d3eeb54
Author: James Liggett <jrliggett cox net>
Date:   Mon Jul 20 00:50:08 2009 -0700

    git: Provide an automatically updated list of project stashes in the stash widget

 plugins/git/Makefile.am              |    6 +-
 plugins/git/anjuta-git.ui            |    6 +-
 plugins/git/git-stash-list-command.c |  150 ++++++++++++++++++++++++++++++++++
 plugins/git/git-stash-list-command.h |   63 ++++++++++++++
 plugins/git/git-stash-widget.c       |  109 ++++++++++++++++++++++++
 plugins/git/git-stash-widget.h       |    3 +
 plugins/git/git-stash.c              |   86 +++++++++++++++++++
 plugins/git/git-stash.h              |   62 ++++++++++++++
 plugins/git/git-ui-utils.c           |   33 +++++++-
 plugins/git/git-ui-utils.h           |    3 +
 plugins/git/plugin.c                 |    5 +
 plugins/git/plugin.h                 |    1 +
 12 files changed, 522 insertions(+), 5 deletions(-)
---
diff --git a/plugins/git/Makefile.am b/plugins/git/Makefile.am
index 255a4ee..84e6d49 100644
--- a/plugins/git/Makefile.am
+++ b/plugins/git/Makefile.am
@@ -205,7 +205,11 @@ libanjuta_git_la_SOURCES = \
 	git-stash-changes-dialog.c \
 	git-stash-changes-dialog.h \
 	git-stash-widget.c \
-	git-stash-widget.h
+	git-stash-widget.h \
+	git-stash.c \
+	git-stash.h \
+	git-stash-list-command.c \
+	git-stash-list-command.h
 
 libanjuta_git_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
 
diff --git a/plugins/git/anjuta-git.ui b/plugins/git/anjuta-git.ui
index afcebb7..fbec5d4 100644
--- a/plugins/git/anjuta-git.ui
+++ b/plugins/git/anjuta-git.ui
@@ -37,10 +37,10 @@
   </object>
   <object class="GtkListStore" id="stash_list_model">
     <columns>
-      <!-- column-name name -->
-      <column type="gchararray"/>
       <!-- column-name id -->
       <column type="gchararray"/>
+      <!-- column-name message -->
+      <column type="gchararray"/>
     </columns>
   </object>
   <object class="GtkDialog" id="commit_dialog">
@@ -5254,7 +5254,7 @@
             <child>
               <object class="GtkCellRendererText" id="stash_widget_view_name_renderer"/>
               <attributes>
-                <attribute name="text">0</attribute>
+                <attribute name="text">1</attribute>
               </attributes>
             </child>
           </object>
diff --git a/plugins/git/git-stash-list-command.c b/plugins/git/git-stash-list-command.c
new file mode 100644
index 0000000..2169192
--- /dev/null
+++ b/plugins/git/git-stash-list-command.c
@@ -0,0 +1,150 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * anjuta
+ * Copyright (C) James Liggett 2008 <jrliggett cox net>
+ * 
+ * anjuta is free software.
+ * 
+ * You may redistribute it and/or modify it under the terms of the
+ * GNU General Public License, as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ * 
+ * anjuta 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 anjuta.  If not, write to:
+ * 	The Free Software Foundation, Inc.,
+ * 	51 Franklin Street, Fifth Floor
+ * 	Boston, MA  02110-1301, USA.
+ */
+
+#include "git-stash-list-command.h"
+
+/* Splits the stash ID from the stash message */
+#define STASH_REGEX "(stash \\{\\d+\\})(?:\\:) (.*)"
+
+struct _GitStashListCommandPriv
+{
+	GRegex *stash_regex;
+	GQueue *output;
+};
+
+G_DEFINE_TYPE (GitStashListCommand, git_stash_list_command, GIT_TYPE_COMMAND);
+
+static void
+git_stash_list_command_init (GitStashListCommand *self)
+{
+	self->priv = g_new0 (GitStashListCommandPriv, 1);
+	self->priv->stash_regex = g_regex_new (STASH_REGEX, 0, 0, NULL);
+	
+	self->priv->output = g_queue_new ();
+}
+
+static void
+git_stash_list_command_finalize (GObject *object)
+{
+	GitStashListCommand *self;
+	GList *current_stash;
+	
+	self = GIT_STASH_LIST_COMMAND (object);
+	current_stash = self->priv->output->head;
+	
+	g_regex_unref (self->priv->stash_regex);
+	
+	while (current_stash)
+	{
+		g_object_unref (current_stash->data);
+		current_stash = g_list_next (current_stash);
+	}
+	
+	g_queue_free (self->priv->output);
+	g_free (self->priv);
+
+	G_OBJECT_CLASS (git_stash_list_command_parent_class)->finalize (object);
+}
+
+static guint
+git_stash_list_command_run (AnjutaCommand *command)
+{
+	GitStashListCommand *self;
+	
+	self = GIT_STASH_LIST_COMMAND (command);
+	
+	git_command_add_arg (GIT_COMMAND (command), "stash");
+	git_command_add_arg (GIT_COMMAND (command), "list");
+	return 0;
+}
+
+static void
+git_stash_list_command_handle_output (GitCommand *git_command, 
+									  const gchar *output)
+{
+	GitStashListCommand *self;
+	GMatchInfo *match_info;
+	gchar *stash_id;
+	gchar *stash_message;
+	GitStash *stash;
+
+	self = GIT_STASH_LIST_COMMAND (git_command);
+	
+	match_info = NULL;
+	stash_id = NULL;
+	stash_message = NULL;
+	stash = NULL;
+	
+	if (g_regex_match (self->priv->stash_regex, output, 0, &match_info))
+	{
+		stash_id = g_match_info_fetch (match_info, 1);
+		stash_message = g_match_info_fetch (match_info, 2);
+	}
+	
+	if (stash_id && stash_message)
+		stash = git_stash_new (stash_id, stash_message);
+	
+	g_free (stash_id);
+	g_free (stash_message);
+
+
+	if (match_info)
+		g_match_info_free (match_info);
+	
+	g_queue_push_head (self->priv->output, stash);
+	anjuta_command_notify_data_arrived (ANJUTA_COMMAND (git_command));
+	
+}
+
+static void
+git_stash_list_command_class_init (GitStashListCommandClass *klass)
+{
+	GObjectClass* object_class = G_OBJECT_CLASS (klass);
+	GitCommandClass* parent_class = GIT_COMMAND_CLASS (klass);
+	AnjutaCommandClass *command_class = ANJUTA_COMMAND_CLASS (klass);
+
+	object_class->finalize = git_stash_list_command_finalize;
+	parent_class->output_handler = git_stash_list_command_handle_output;
+	command_class->run = git_stash_list_command_run;
+}
+
+
+GitStashListCommand *
+git_stash_list_command_new (const gchar *working_directory)
+{
+	GitStashListCommand *self;
+	
+	self = g_object_new (GIT_TYPE_STASH_LIST_COMMAND,
+						 "working-directory", working_directory,
+						 "single-line-output", TRUE,
+						 NULL);
+	
+	return self;
+}
+
+GQueue *
+git_stash_list_command_get_output (GitStashListCommand *self)
+{
+	return self->priv->output;
+}
diff --git a/plugins/git/git-stash-list-command.h b/plugins/git/git-stash-list-command.h
new file mode 100644
index 0000000..f94a0bd
--- /dev/null
+++ b/plugins/git/git-stash-list-command.h
@@ -0,0 +1,63 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * anjuta
+ * Copyright (C) James Liggett 2008 <jrliggett cox net>
+ * 
+ * anjuta is free software.
+ * 
+ * You may redistribute it and/or modify it under the terms of the
+ * GNU General Public License, as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ * 
+ * anjuta 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 anjuta.  If not, write to:
+ * 	The Free Software Foundation, Inc.,
+ * 	51 Franklin Street, Fifth Floor
+ * 	Boston, MA  02110-1301, USA.
+ */
+
+#ifndef _GIT_STASH_LIST_COMMAND_H_
+#define _GIT_STASH_LIST_COMMAND_H_
+
+#include <glib-object.h>
+#include "git-command.h"
+#include "git-stash.h"
+
+G_BEGIN_DECLS
+
+#define GIT_TYPE_STASH_LIST_COMMAND             (git_stash_list_command_get_type ())
+#define GIT_STASH_LIST_COMMAND(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIT_TYPE_STASH_LIST_COMMAND, GitStashListCommand))
+#define GIT_STASH_LIST_COMMAND_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), GIT_TYPE_STASH_LIST_COMMAND, GitStashListCommandClass))
+#define GIT_IS_STASH_LIST_COMMAND(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIT_TYPE_STASH_LIST_COMMAND))
+#define GIT_IS_STASH_LIST_COMMAND_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GIT_TYPE_STASH_LIST_COMMAND))
+#define GIT_STASH_LIST_COMMAND_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GIT_TYPE_STASH_LIST_COMMAND, GitStashListCommandClass))
+
+typedef struct _GitStashListCommandClass GitStashListCommandClass;
+typedef struct _GitStashListCommand GitStashListCommand;
+typedef struct _GitStashListCommandPriv GitStashListCommandPriv;
+
+struct _GitStashListCommandClass
+{
+	GitCommandClass parent_class;
+};
+
+struct _GitStashListCommand
+{
+	GitCommand parent_instance;
+	
+	GitStashListCommandPriv *priv;
+};
+
+GType git_stash_list_command_get_type (void) G_GNUC_CONST;
+GitStashListCommand *git_stash_list_command_new (const gchar *working_directory);
+GQueue *git_stash_list_command_get_output (GitStashListCommand *self);
+
+G_END_DECLS
+
+#endif /* _GIT_STASH_LIST_COMMAND_H_ */
diff --git a/plugins/git/git-stash-widget.c b/plugins/git/git-stash-widget.c
index d903682..c0416a8 100644
--- a/plugins/git/git-stash-widget.c
+++ b/plugins/git/git-stash-widget.c
@@ -19,6 +19,35 @@
 
 #include "git-stash-widget.h"
 
+static void 
+on_stash_refresh_monitor_changed (GFileMonitor *file_monitor, GFile *file,
+								  GFile *other_file, 
+								  GFileMonitorEvent event_type, Git *plugin)
+{
+	
+	 /* Git seems to make several changes to this file at once, so just respond
+	  * to the changes done hint so we don't refresh more than once at a 
+	  * time. */
+	if (event_type == G_FILE_MONITOR_EVENT_CREATED ||
+	    event_type == G_FILE_MONITOR_EVENT_DELETED ||
+	    event_type == G_FILE_MONITOR_EVENT_CHANGED)
+	{
+		git_stash_widget_refresh (plugin);
+	}
+}
+
+static void
+on_list_command_finished (AnjutaCommand *command, guint return_code,
+						  GtkListStore *stash_list_model)
+{
+	/* Allow refreshes to continue */
+	g_object_set_data (G_OBJECT (stash_list_model), "being-refreshed", 
+					   GINT_TO_POINTER (FALSE));
+
+	git_report_errors (command, return_code);
+	g_object_unref (command);
+}
+
 void
 git_stash_widget_create (Git *plugin, GtkWidget **stash_widget, 
 						 GtkWidget **stash_widget_grip)
@@ -54,3 +83,83 @@ git_stash_widget_create (Git *plugin, GtkWidget **stash_widget,
 	*stash_widget = stash_widget_scrolled_window;
 	*stash_widget_grip = stash_widget_grip_hbox;
 }
+
+void
+git_stash_widget_refresh (Git *plugin)
+{
+	GitUIData *data;
+	GtkListStore *stash_list_model;
+	gboolean being_refreshed;
+	GitStashListCommand *list_command;
+
+	data = g_object_get_data (G_OBJECT (plugin->stash_widget), "ui-data");
+	stash_list_model = GTK_LIST_STORE (gtk_builder_get_object (data->bxml,
+															   "stash_list_model"));
+	being_refreshed = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (stash_list_model), 
+														  "being-refreshed"));
+
+	/* Use a crude locking hack similar to what the log viewer does to avoid 
+	 * multiple concurrent refreshes. */
+	if (!being_refreshed)
+	{
+		list_command = git_stash_list_command_new (plugin->project_root_directory);
+
+		gtk_list_store_clear (stash_list_model);
+
+		g_signal_connect (G_OBJECT (list_command), "data-arrived",
+						  G_CALLBACK (on_git_list_stash_command_data_arrived),
+						  stash_list_model);
+
+		g_signal_connect (G_OBJECT (list_command), "command-finished",
+						  G_CALLBACK (on_list_command_finished),
+						  stash_list_model);
+
+		g_object_set_data (G_OBJECT (stash_list_model), "being-refreshed", 
+						   GINT_TO_POINTER (TRUE));
+
+		anjuta_command_start (ANJUTA_COMMAND (list_command));
+	}
+	 
+}
+
+void
+git_stash_widget_clear (Git *plugin)
+{
+	GitUIData *data;
+	GtkListStore *stash_list_model;
+
+	data = g_object_get_data (G_OBJECT (plugin->stash_widget), "ui-data");
+	stash_list_model = GTK_LIST_STORE (gtk_builder_get_object (data->bxml,
+															   "stash_list_model"));
+
+	gtk_list_store_clear (stash_list_model);
+}
+
+GFileMonitor *
+git_stash_widget_setup_refresh_monitor (Git *plugin)
+{
+	gchar *git_stash_path;
+	GFile *git_stash_file;
+	GFileMonitor *git_stash_monitor;
+
+	git_stash_path = g_strjoin (G_DIR_SEPARATOR_S,
+	                            plugin->project_root_directory,
+	                            ".git",
+								"logs",
+	                            "refs",
+	                            "stash",
+	                            NULL);
+
+	git_stash_file = g_file_new_for_path (git_stash_path);
+	git_stash_monitor = g_file_monitor_file (git_stash_file, 0, NULL, 
+											 NULL);
+
+	g_signal_connect (G_OBJECT (git_stash_monitor), "changed",
+	                  G_CALLBACK (on_stash_refresh_monitor_changed),
+	                  plugin);
+
+	g_free (git_stash_path);
+	g_object_unref (git_stash_file);
+
+	return git_stash_monitor;
+}
\ No newline at end of file
diff --git a/plugins/git/git-stash-widget.h b/plugins/git/git-stash-widget.h
index 30377fd..6fa36d1 100644
--- a/plugins/git/git-stash-widget.h
+++ b/plugins/git/git-stash-widget.h
@@ -24,5 +24,8 @@
 
 void git_stash_widget_create (Git *plugin, GtkWidget **stash_widget,
 							  GtkWidget **stash_widget_grip);
+void git_stash_widget_refresh (Git *plugin);
+void git_stash_widget_clear (Git *plugin);
+GFileMonitor *git_stash_widget_setup_refresh_monitor (Git *plugin);
 
 #endif
\ No newline at end of file
diff --git a/plugins/git/git-stash.c b/plugins/git/git-stash.c
new file mode 100644
index 0000000..0ced049
--- /dev/null
+++ b/plugins/git/git-stash.c
@@ -0,0 +1,86 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * anjuta
+ * Copyright (C) James Liggett 2008 <jrliggett cox net>
+ * 
+ * anjuta is free software.
+ * 
+ * You may redistribute it and/or modify it under the terms of the
+ * GNU General Public License, as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ * 
+ * anjuta 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 anjuta.  If not, write to:
+ * 	The Free Software Foundation, Inc.,
+ * 	51 Franklin Street, Fifth Floor
+ * 	Boston, MA  02110-1301, USA.
+ */
+
+#include "git-stash.h"
+
+struct _GitStashPriv
+{
+	gchar *id;
+	gchar *message;
+};
+
+G_DEFINE_TYPE (GitStash, git_stash, G_TYPE_OBJECT);
+
+static void
+git_stash_init (GitStash *self)
+{
+	self->priv = g_new0 (GitStashPriv, 1);
+}
+
+static void
+git_stash_finalize (GObject *object)
+{
+	GitStash *self;
+	
+	self = GIT_STASH (object);
+	
+	g_free (self->priv->id);
+	g_free (self->priv->message);
+	g_free (self->priv);
+
+	G_OBJECT_CLASS (git_stash_parent_class)->finalize (object);
+}
+
+static void
+git_stash_class_init (GitStashClass *klass)
+{
+	GObjectClass* object_class = G_OBJECT_CLASS (klass);
+
+	object_class->finalize = git_stash_finalize;
+}
+
+GitStash *
+git_stash_new (const gchar *id, const gchar *message)
+{
+	GitStash *self;
+	
+	self = g_object_new (GIT_TYPE_STASH, NULL);
+	
+	self->priv->id = g_strdup (id);
+	self->priv->message = g_strdup (message);
+	
+	return self;
+}
+
+gchar *
+git_stash_get_id (GitStash *self)
+{
+	return g_strdup (self->priv->id);
+}
+
+gchar *
+git_stash_get_message (GitStash *self)
+{
+	return g_strdup (self->priv->message);
+}
diff --git a/plugins/git/git-stash.h b/plugins/git/git-stash.h
new file mode 100644
index 0000000..e10c089
--- /dev/null
+++ b/plugins/git/git-stash.h
@@ -0,0 +1,62 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * anjuta
+ * Copyright (C) James Liggett 2008 <jrliggett cox net>
+ * 
+ * anjuta is free software.
+ * 
+ * You may redistribute it and/or modify it under the terms of the
+ * GNU General Public License, as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ * 
+ * anjuta 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 anjuta.  If not, write to:
+ * 	The Free Software Foundation, Inc.,
+ * 	51 Franklin Street, Fifth Floor
+ * 	Boston, MA  02110-1301, USA.
+ */
+
+#ifndef _GIT_STASH_H_
+#define _GIT_STASH_H_
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GIT_TYPE_STASH             (git_stash_get_type ())
+#define GIT_STASH(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIT_TYPE_STASH, GitStash))
+#define GIT_STASH_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), GIT_TYPE_STASH, GitStashClass))
+#define GIT_IS_STASH(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIT_TYPE_STASH))
+#define GIT_IS_STASH_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GIT_TYPE_STASH))
+#define GIT_STASH_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GIT_TYPE_STASH, GitStashClass))
+
+typedef struct _GitStashClass GitStashClass;
+typedef struct _GitStash GitStash;
+typedef struct _GitStashPriv GitStashPriv;
+
+struct _GitStashClass
+{
+	GObjectClass parent_class;
+};
+
+struct _GitStash
+{
+	GObject parent_instance;
+	
+	GitStashPriv *priv;
+};
+
+GType git_stash_get_type (void) G_GNUC_CONST;
+GitStash *git_stash_new (const gchar *id, const gchar *message);
+gchar *git_stash_get_id (GitStash *self);
+gchar *git_stash_get_message (GitStash *self);
+
+G_END_DECLS
+
+#endif /* _GIT_STASH_H_ */
diff --git a/plugins/git/git-ui-utils.c b/plugins/git/git-ui-utils.c
index 579a0be..c991dec 100644
--- a/plugins/git/git-ui-utils.c
+++ b/plugins/git/git-ui-utils.c
@@ -428,6 +428,37 @@ on_git_list_tag_command_data_arrived (AnjutaCommand *command,
 		g_free (tag_name);
 	}
 }
+
+void
+on_git_list_stash_command_data_arrived (AnjutaCommand *command,
+										GtkListStore *stash_list_model)
+{
+	GQueue *output_queue;
+	GitStash *stash;
+	GtkTreeIter iter;
+	gchar *id;
+	gchar *message;
+	
+	output_queue = git_stash_list_command_get_output (GIT_STASH_LIST_COMMAND (command));
+
+	while (g_queue_peek_head (output_queue))
+	{
+		stash = g_queue_pop_head (output_queue);
+		id = git_stash_get_id (stash);
+		message = git_stash_get_message (stash);
+
+		gtk_list_store_append (stash_list_model, &iter);
+		gtk_list_store_set (stash_list_model, &iter, 
+							0, id,
+							1, message, 
+							-1);
+		
+		g_object_unref (stash);
+		g_free (id);
+		g_free (message);
+	}
+}
+
 void
 git_select_all_status_items (GtkButton *select_all_button,
 							 AnjutaVcsStatusTreeView *tree_view)
@@ -601,4 +632,4 @@ on_git_selected_column_toggled (GtkCellRendererToggle *renderer, gchar *path,
 	
 	gtk_list_store_set (list_store, &iter, 0, !selected, -1);
 	
-}
\ No newline at end of file
+}
diff --git a/plugins/git/git-ui-utils.h b/plugins/git/git-ui-utils.h
index 071c37b..e9e9f0c 100644
--- a/plugins/git/git-ui-utils.h
+++ b/plugins/git/git-ui-utils.h
@@ -33,6 +33,7 @@
 #include "git-status-command.h"
 #include "git-diff-command.h"
 #include "git-branch-list-command.h"
+#include "git-stash-list-command.h"
 
 typedef struct
 {
@@ -80,6 +81,8 @@ void on_git_list_branch_combo_command_finished (AnjutaCommand *command,
                                                 GtkComboBox *combo_box);
 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 git_select_all_status_items (GtkButton *select_all_button, 
 								  AnjutaVcsStatusTreeView *tree_view);
 void git_clear_all_status_selections (GtkButton *clear_button,
diff --git a/plugins/git/plugin.c b/plugins/git/plugin.c
index b7bae8d..d51a99d 100644
--- a/plugins/git/plugin.c
+++ b/plugins/git/plugin.c
@@ -586,7 +586,9 @@ on_project_root_added (AnjutaPlugin *plugin, const gchar *name,
 	git_plugin->bisect_file_monitor = bisect_menus_init (git_plugin);
 	git_plugin->log_branch_refresh_monitor = git_log_setup_branch_refresh_monitor (git_plugin);
 	git_plugin->log_refresh_monitor = git_log_setup_log_refresh_monitor (git_plugin);
+	git_plugin->stash_refresh_monitor = git_stash_widget_setup_refresh_monitor (git_plugin);
 	git_log_refresh_branches (git_plugin);
+	git_stash_widget_refresh (git_plugin);
 }
 
 static void
@@ -619,14 +621,17 @@ on_project_root_removed (AnjutaPlugin *plugin, const gchar *name,
 	gtk_widget_set_sensitive (git_plugin->stash_widget_grip, FALSE);
 
 	git_log_window_clear (git_plugin);
+	git_stash_widget_clear (git_plugin);
 	
 	g_file_monitor_cancel (git_plugin->bisect_file_monitor);
 	g_file_monitor_cancel (git_plugin->log_branch_refresh_monitor);
 	g_file_monitor_cancel (git_plugin->log_refresh_monitor);
+	g_file_monitor_cancel (git_plugin->stash_refresh_monitor);
 	
 	g_object_unref (git_plugin->bisect_file_monitor);
 	g_object_unref (git_plugin->log_branch_refresh_monitor);
 	g_object_unref (git_plugin->log_refresh_monitor);
+	g_object_unref (git_plugin->stash_refresh_monitor);
 }
 
 static void
diff --git a/plugins/git/plugin.h b/plugins/git/plugin.h
index ae4ab2e..2aa06b7 100644
--- a/plugins/git/plugin.h
+++ b/plugins/git/plugin.h
@@ -69,6 +69,7 @@ struct _Git
 	GFileMonitor *bisect_file_monitor;
 	GFileMonitor *log_branch_refresh_monitor;
 	GFileMonitor *log_refresh_monitor;
+	GFileMonitor *stash_refresh_monitor;
 };
 
 struct _GitClass



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