[geany/geany-plugins] 8b5607: TreeBrowser: Fix the row to which the popup menu pops for

Colomban Wendling git-noreply at xxxxx
Mon Mar 4 16:52:30 UTC 2013


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Mon, 04 Mar 2013 16:52:30 UTC
Commit:      8b56073e9503c0dd1fb474dcf1654a3820d9164b
             https://github.com/geany/geany-plugins/commit/8b56073e9503c0dd1fb474dcf1654a3820d9164b

Log Message:
-----------
TreeBrowser: Fix the row to which the popup menu pops for

When right-clocking, the clicked row got selected but the name and URI
were still fetched from the previously selected row.  Fix this so if
the user right clicks on an unselected row the popup works for the
corrected item.


Modified Paths:
--------------
    treebrowser/src/treebrowser.c

Modified: treebrowser/src/treebrowser.c
13 files changed, 7 insertions(+), 6 deletions(-)
===================================================================
@@ -1402,12 +1402,6 @@ enum
 		GtkWidget *menu;
 		gchar *name = NULL, *uri = NULL;
 
-		if (gtk_tree_selection_get_selected(selection, &model, &iter))
-			gtk_tree_model_get(GTK_TREE_MODEL(treestore), &iter,
-								TREEBROWSER_COLUMN_NAME, &name,
-								TREEBROWSER_COLUMN_URI, &uri,
-								-1);
-
 		/* Get tree path for row that was clicked */
 		if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(treeview),
 																		 (gint) event->x,
@@ -1419,6 +1413,13 @@ enum
 			gtk_tree_selection_select_path(selection, path);
 			gtk_tree_path_free(path);
 		}
+
+		if (gtk_tree_selection_get_selected(selection, &model, &iter))
+			gtk_tree_model_get(GTK_TREE_MODEL(treestore), &iter,
+								TREEBROWSER_COLUMN_NAME, &name,
+								TREEBROWSER_COLUMN_URI, &uri,
+								-1);
+
 		menu = create_popup_menu(name != NULL ? name : "", uri != NULL ? uri : "");
 		gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time);
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list