[anjuta] git: Fix switch delete branch, and merge action sensitivity



commit ba40c68c362ba611b11b631a5c4bb7cb9e3dffb3
Author: James Liggett <jrliggett cox net>
Date:   Sun Jan 15 16:58:42 2012 -0800

    git: Fix switch delete branch, and merge action sensitivity
    
    The swtich action doesn't care about how many items in the branch pane are
    ticked;it switches to the branch that is highlighted, which is usually the last
    branch item the user clicked on.
    
    When deleting branches, the check boxes can be checked either before or after
    running the action. The selections aren't considered until the OK button the the
    dialog is clicked.
    
    Finally, merging doesn't requre any branch to be selected at all, because users
    can merge with any git reference, including branches, tags, and even arbitrary
    commits.

 plugins/git/git-branches-pane.c |   33 ---------------------------------
 plugins/git/git-branches-pane.h |    1 -
 plugins/git/plugin.c            |    1 -
 3 files changed, 0 insertions(+), 35 deletions(-)
---
diff --git a/plugins/git/git-branches-pane.c b/plugins/git/git-branches-pane.c
index 468e126..450f6ff 100644
--- a/plugins/git/git-branches-pane.c
+++ b/plugins/git/git-branches-pane.c
@@ -41,10 +41,6 @@ struct _GitBranchesPanePriv
 	GtkBuilder *builder;
 	GHashTable *selected_local_branches;
 	GHashTable *selected_remote_branches;
-
-	GtkAction *merge_action;
-	GtkAction *delete_action;
-	GtkAction *switch_action;
 };
 
 
@@ -231,7 +227,6 @@ on_branch_selected_renderer_toggled (GtkCellRendererToggle *renderer,
 
 	gtk_list_store_set (GTK_LIST_STORE (branches_list_model), &iter, 0, selected,
 	                    -1);
-	git_branches_pane_update_ui (self);
 }
 
 static void
@@ -475,31 +470,3 @@ git_branches_pane_get_selected_branch (GitBranchesPane *self)
 	return selected_branch;
 }
 
-void git_branches_pane_update_ui (GitBranchesPane *self)
-{
-	gint n_selection;
-	
-	/* Enable only actions that make sense with the selection */
-	if (!self->priv->merge_action || 
-	    !self->priv->delete_action ||
-	    !self->priv->switch_action)
-	{
-		Git* plugin = 
-			ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self)));
-		AnjutaCommandBar* bar = anjuta_dock_get_command_bar (ANJUTA_DOCK(plugin->dock));
-		self->priv->merge_action = anjuta_command_bar_get_action (bar,
-		                                                          "Branches",
-		                                                          "Merge");
-		self->priv->delete_action = anjuta_command_bar_get_action (bar,
-		                                                          "Branches",
-		                                                          "DeleteBranches");
-		self->priv->switch_action = anjuta_command_bar_get_action (bar,
-		                                                          "Branches",
-		                                                          "Switch");
-	}
-	n_selection = g_hash_table_size (self->priv->selected_local_branches) + 
-		g_hash_table_size (self->priv->selected_remote_branches);
-	gtk_action_set_sensitive (self->priv->merge_action, n_selection > 0);
-	gtk_action_set_sensitive (self->priv->delete_action, n_selection > 0);
-	gtk_action_set_sensitive (self->priv->switch_action, n_selection == 1);	
-}
diff --git a/plugins/git/git-branches-pane.h b/plugins/git/git-branches-pane.h
index dfc7a01..a9af306 100644
--- a/plugins/git/git-branches-pane.h
+++ b/plugins/git/git-branches-pane.h
@@ -53,7 +53,6 @@ GList *git_branches_pane_get_selected_local_branches (GitBranchesPane *self);
 GList *git_branches_pane_get_selected_remote_branches (GitBranchesPane *self);
 gsize git_branches_pane_count_selected_items (GitBranchesPane *self);
 gchar *git_branches_pane_get_selected_branch (GitBranchesPane *self);
-void git_branches_pane_update_ui (GitBranchesPane* self);
 
 G_END_DECLS
 
diff --git a/plugins/git/plugin.c b/plugins/git/plugin.c
index c920c72..966a03d 100644
--- a/plugins/git/plugin.c
+++ b/plugins/git/plugin.c
@@ -770,7 +770,6 @@ git_activate_plugin (AnjutaPlugin *plugin)
 	                      _("Branches"), NULL, git_plugin->branches_pane,   
 	                      GDL_DOCK_CENTER, branch_entries, 
 	                      G_N_ELEMENTS (branch_entries), git_plugin);
-	git_branches_pane_update_ui (GIT_BRANCHES_PANE (git_plugin->branches_pane));
 
 	git_plugin->tags_pane = git_tags_pane_new (git_plugin);
 	anjuta_dock_add_pane (ANJUTA_DOCK (git_plugin->dock), "Tags", _("Tags"),



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