[gitg] Prevent showing popup for dummy revisions



commit ff5c3f6ab188756230226970ebdf04230c07bc63
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Sat Oct 23 14:50:45 2010 +0200

    Prevent showing popup for dummy revisions

 gitg/gitg-dnd.c    |    2 +-
 gitg/gitg-window.c |   50 ++++++++++++++++++++++++++++++++++++++------------
 2 files changed, 39 insertions(+), 13 deletions(-)
---
diff --git a/gitg/gitg-dnd.c b/gitg/gitg-dnd.c
index 322dc84..777db38 100644
--- a/gitg/gitg-dnd.c
+++ b/gitg/gitg-dnd.c
@@ -429,7 +429,7 @@ begin_drag (GtkWidget   *widget,
 		                                (gint)data->y,
 		                                &path);
 
-		if (revision)
+		if (revision && !gitg_revision_get_sign (revision))
 		{
 			/* Make a DND for the revision */
 			data->revision = revision;
diff --git a/gitg/gitg-window.c b/gitg/gitg-window.c
index fc1d111..425a324 100644
--- a/gitg/gitg-window.c
+++ b/gitg/gitg-window.c
@@ -3070,32 +3070,58 @@ popup_revision (GitgWindow     *window,
 	selection = gtk_tree_view_get_selection (window->priv->tree_view);
 	GList *rows = gtk_tree_selection_get_selected_rows (selection, NULL);
 
+	if (!rows)
+	{
+		return FALSE;
+	}
+
 	gboolean show = FALSE;
 
 	update_cherry_pick (window);
 
-	if (rows)
+	GtkAction *tag;
+
+	tag = gtk_ui_manager_get_action (window->priv->menus_ui_manager,
+	                                 "/ui/revision_popup/TagAction");
+
+	GtkAction *squash;
+
+	squash = gtk_ui_manager_get_action (window->priv->menus_ui_manager,
+	                                    "/ui/revision_popup/SquashAction");
+
+	if (!rows->next)
 	{
-		GtkAction *tag = gtk_ui_manager_get_action (window->priv->menus_ui_manager,
-		                                            "/ui/revision_popup/TagAction");
+		GtkTreeModel *model;
+		GtkTreeIter iter;
+		GitgRevision *rev;
+		gchar sign;
 
-		GtkAction *squash = gtk_ui_manager_get_action (window->priv->menus_ui_manager,
-		                                               "/ui/revision_popup/SquashAction");
+		model = GTK_TREE_MODEL (window->priv->repository);
+		gtk_tree_model_get_iter (model, &iter, rows->data);
 
-		if (!rows->next)
+		gtk_tree_model_get (model, &iter, 0, &rev, -1);
+
+		sign = gitg_revision_get_sign (rev);
+		gitg_revision_unref (rev);
+
+		if (sign)
+		{
+			show = FALSE;
+		}
+		else
 		{
 			show = TRUE;
 
 			gtk_action_set_visible (squash, FALSE);
 			gtk_action_set_visible (tag, TRUE);
 		}
-		else if (consecutive_revisions (window, rows))
-		{
-			show = TRUE;
+	}
+	else if (consecutive_revisions (window, rows))
+	{
+		show = TRUE;
 
-			gtk_action_set_visible (squash, TRUE);
-			gtk_action_set_visible (tag, FALSE);
-		}
+		gtk_action_set_visible (squash, TRUE);
+		gtk_action_set_visible (tag, FALSE);
 	}
 
 	g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL);



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