[anjuta] git: Disable the stash widget clear button if there are no stashes in the repository
- From: James Liggett <jrliggett src gnome org>
- To: svn-commits-list gnome org
- Subject: [anjuta] git: Disable the stash widget clear button if there are no stashes in the repository
- Date: Fri, 24 Jul 2009 01:49:48 +0000 (UTC)
commit 3f2ea9cff5b3e23e29e7324d044f08def56c14ad
Author: James Liggett <jrliggett cox net>
Date: Thu Jul 23 18:21:08 2009 -0700
git: Disable the stash widget clear button if there are no stashes in the repository
plugins/git/anjuta-git.ui | 3 ++-
plugins/git/git-stash-widget.c | 18 ++++++++++++++++--
2 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/plugins/git/anjuta-git.ui b/plugins/git/anjuta-git.ui
index 6bd9958..837375a 100644
--- a/plugins/git/anjuta-git.ui
+++ b/plugins/git/anjuta-git.ui
@@ -5387,9 +5387,10 @@
<child>
<object class="GtkButton" id="stash_widget_clear_button">
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Delete all stashes</property>
+ <property name="tooltip_text" translatable="yes">Clear all stashes</property>
<child>
<object class="GtkImage" id="image7">
<property name="visible">True</property>
diff --git a/plugins/git/git-stash-widget.c b/plugins/git/git-stash-widget.c
index 0c353c8..61bc010 100644
--- a/plugins/git/git-stash-widget.c
+++ b/plugins/git/git-stash-widget.c
@@ -38,12 +38,26 @@ on_stash_refresh_monitor_changed (GFileMonitor *file_monitor, GFile *file,
static void
on_list_command_finished (AnjutaCommand *command, guint return_code,
- GtkListStore *stash_list_model)
+ GitUIData *data)
{
+ GtkTreeModel *stash_list_model;
+ GtkWidget *stash_widget_clear_button;
+ GtkTreeIter iter;
+
+ stash_list_model = GTK_TREE_MODEL (gtk_builder_get_object (data->bxml,
+ "stash_list_model"));
+ stash_widget_clear_button = GTK_WIDGET (gtk_builder_get_object (data->bxml,
+ "stash_widget_clear_button"));
+
/* Allow refreshes to continue */
g_object_set_data (G_OBJECT (stash_list_model), "being-refreshed",
GINT_TO_POINTER (FALSE));
+ gtk_widget_set_sensitive (stash_widget_clear_button,
+ gtk_tree_model_get_iter_first (stash_list_model,
+ &iter));
+
+
git_report_errors (command, return_code);
g_object_unref (command);
}
@@ -350,7 +364,7 @@ git_stash_widget_refresh (Git *plugin)
g_signal_connect (G_OBJECT (list_command), "command-finished",
G_CALLBACK (on_list_command_finished),
- stash_list_model);
+ data);
g_object_set_data (G_OBJECT (stash_list_model), "being-refreshed",
GINT_TO_POINTER (TRUE));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]