SF.net SVN: geany: [530] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Mon Jul 3 12:06:23 UTC 2006


Revision: 530
Author:   ntrel
Date:     2006-07-03 05:06:13 -0700 (Mon, 03 Jul 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=530&view=rev

Log Message:
-----------
Fix a problem with the recent files menu

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/dialogs.c
    trunk/src/utils.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-07-03 11:31:00 UTC (rev 529)
+++ trunk/ChangeLog	2006-07-03 12:06:13 UTC (rev 530)
@@ -1,3 +1,9 @@
+2006-07-03  Nick Treleaven  <nick.treleaven at btinternet.com>
+
+ * src/utils.c, src/dialogs.c:
+   Fix a problem with the recent files menu.
+
+
 2006-07-03  Enrico Tröger  <enrico.troeger at uvena.de>
 
  * doc/Makefile.am: Fixed wrong dependency in target 'install'.

Modified: trunk/src/dialogs.c
===================================================================
--- trunk/src/dialogs.c	2006-07-03 11:31:00 UTC (rev 529)
+++ trunk/src/dialogs.c	2006-07-03 12:06:13 UTC (rev 530)
@@ -716,12 +716,13 @@
 		return;
 	}
 
-	for (i = (MIN(app->mru_length, g_queue_get_length(app->recent_queue)) - 1); i >= 0; i--)
+	for (i = 0; i < MIN(app->mru_length, g_queue_get_length(app->recent_queue));
+		i++)
 	{
 		filename = g_queue_peek_nth(app->recent_queue, i);
 		tmp = gtk_menu_item_new_with_label(filename);
 		gtk_widget_show(tmp);
-		gtk_container_add(GTK_CONTAINER(recent_menu), tmp);
+		gtk_menu_shell_append(GTK_MENU_SHELL(recent_menu), tmp);
 		g_signal_connect((gpointer) tmp, "activate",
 					G_CALLBACK(on_recent_file_activate), (gpointer) filename);
 	}

Modified: trunk/src/utils.c
===================================================================
--- trunk/src/utils.c	2006-07-03 11:31:00 UTC (rev 529)
+++ trunk/src/utils.c	2006-07-03 12:06:13 UTC (rev 530)
@@ -1937,7 +1937,7 @@
 	GtkWidget *recent_files_item = lookup_widget(app->window, "recent_files1");
 	GtkWidget *tmp;
 	gchar *filename;
-	GList *children = gtk_container_get_children(GTK_CONTAINER(recent_menu));
+	GList *children;
 
 	if (g_queue_get_length(app->recent_queue) == 0)
 	{
@@ -1949,8 +1949,9 @@
 		gtk_widget_set_sensitive(recent_files_item, TRUE);
 	}
 
-	// clean the MRU list
-	if (g_list_length(children) > app->mru_length)
+	// clean the MRU list before adding an item
+	children = gtk_container_get_children(GTK_CONTAINER(recent_menu));
+	if (g_list_length(children) > app->mru_length - 1)
 	{
 		children = g_list_nth(children, app->mru_length - 1);
 		while (children != NULL)
@@ -1963,8 +1964,7 @@
 	filename = g_queue_peek_head(app->recent_queue);
 	tmp = gtk_menu_item_new_with_label(filename);
 	gtk_widget_show(tmp);
-	//gtk_menu_shell_insert(GTK_MENU_SHELL(recent_menu), tmp, 0);
-	gtk_container_add(GTK_CONTAINER(recent_menu), tmp);
+	gtk_menu_shell_prepend(GTK_MENU_SHELL(recent_menu), tmp);
 	g_signal_connect((gpointer) tmp, "activate",
 				G_CALLBACK(on_recent_file_activate), (gpointer) filename);
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Commits mailing list