Kaydet (Commit) 2b73b12c authored tarafından Nick Treleaven's avatar Nick Treleaven

Fix a problem with the recent files menu

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@530 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 7f481ca1
2006-07-03 Nick Treleaven <nick.treleaven@btinternet.com>
* src/utils.c, src/dialogs.c:
Fix a problem with the recent files menu.
2006-07-03 Enrico Tröger <enrico.troeger@uvena.de>
* doc/Makefile.am: Fixed wrong dependency in target 'install'.
......
......@@ -716,12 +716,13 @@ void dialogs_create_recent_menu(void)
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);
}
......
......@@ -1937,7 +1937,7 @@ void utils_update_recent_menu(void)
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 @@ void utils_update_recent_menu(void)
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 @@ void utils_update_recent_menu(void)
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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment