about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJosh Rickmar <jrick@devio.us>2012-06-18 14:51:26 -0400
committerJosh Rickmar <jrick@devio.us>2012-06-28 15:22:36 -0400
commit71f9e485c1b6501819f8dc9c9db7d94eb9c76c39 (patch)
treec583b5d54aa5cc87373643e650cc45d2957b1385
parentf284a63967c1f5f349abdfbb7b3f8710b6c419fd (diff)
downloadxombrero-71f9e485c1b6501819f8dc9c9db7d94eb9c76c39.tar.gz
Respect the current tab's ordering when showing the drow down menu
(clicking the arrow).
-rw-r--r--xombrero.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/xombrero.c b/xombrero.c
index d2b9a78..b003bfe 100644
--- a/xombrero.c
+++ b/xombrero.c
@@ -7624,15 +7624,19 @@ arrow_cb(GtkWidget *w, GdkEventButton *event, gpointer user_data)
 {
 	GtkWidget		*menu, *menu_items;
 	GdkEventButton		*bevent;
+	struct tab		**stabs = NULL;
+	int			i, num_tabs;
 	const gchar		*uri;
-	struct tab		*ti;
 
 	if (event->type == GDK_BUTTON_PRESS) {
 		bevent = (GdkEventButton *) event;
 		menu = gtk_menu_new();
 
-		TAILQ_FOREACH(ti, &tabs, entry) {
-			if ((uri = get_uri(ti)) == NULL)
+		num_tabs = sort_tabs_by_page_num(&stabs);
+		for (i = 0; i < num_tabs; ++i) {
+			if (stabs[i] == NULL)
+				continue;
+			if ((uri = get_uri(stabs[i])) == NULL)
 				/* XXX make sure there is something to print */
 				/* XXX add gui pages in here to look purdy */
 				uri = "(untitled)";
@@ -7642,8 +7646,9 @@ arrow_cb(GtkWidget *w, GdkEventButton *event, gpointer user_data)
 
 			g_signal_connect_swapped((menu_items),
 			    "activate", G_CALLBACK(menuitem_response),
-			    (gpointer)ti);
+			    (gpointer)stabs[i]);
 		}
+		g_free(stabs);
 
 		gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
 		    bevent->button, bevent->time);