From 28ac7814fd91ab17f3a40eef6cd4bfb41077fcdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Tue, 7 Apr 2009 22:09:23 +0000 Subject: [PATCH] Don't add opened project files to the GtkRecentManager. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3699 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 2 ++ src/ui_utils.c | 24 +++++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1abf2af..831afb04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,8 @@ Prevent showing an empty macro list. Show only macros of the same filetype instead of all macros of all loaded filetypes. + * src/ui_utils.c: + Don't add opened project files to the GtkRecentManager. 2009-04-07 Nick Treleaven diff --git a/src/ui_utils.c b/src/ui_utils.c index 345931ee..b50ba2e8 100644 --- a/src/ui_utils.c +++ b/src/ui_utils.c @@ -71,8 +71,15 @@ static struct } widgets; +enum +{ + RECENT_FILE_FILE, + RECENT_FILE_PROJECT +}; + typedef struct { + gint type; GQueue *recent_queue; GtkWidget *menubar; GtkWidget *toolbar; @@ -926,7 +933,7 @@ static void recent_create_menu(GeanyRecentFiles *grf) static GeanyRecentFiles *recent_get_recent_files(void) { - static GeanyRecentFiles grf = { NULL, NULL, NULL, NULL }; + static GeanyRecentFiles grf = { RECENT_FILE_FILE, NULL, NULL, NULL, NULL }; if (G_UNLIKELY(grf.recent_queue == NULL)) { @@ -941,7 +948,7 @@ static GeanyRecentFiles *recent_get_recent_files(void) static GeanyRecentFiles *recent_get_recent_projects(void) { - static GeanyRecentFiles grf = { NULL, NULL, NULL, NULL }; + static GeanyRecentFiles grf = { RECENT_FILE_PROJECT, NULL, NULL, NULL, NULL }; if (G_UNLIKELY(grf.recent_queue == NULL)) { @@ -992,12 +999,15 @@ static void add_recent_file(const gchar *utf8_filename, GeanyRecentFiles *grf) if (g_queue_find_custom(grf->recent_queue, utf8_filename, (GCompareFunc) strcmp) == NULL) { #if GTK_CHECK_VERSION(2, 10, 0) - GtkRecentManager *manager = gtk_recent_manager_get_default(); - gchar *uri = g_filename_to_uri(utf8_filename, NULL, NULL); - if (G_LIKELY(uri != NULL)) + if (grf->type == RECENT_FILE_FILE) { - gtk_recent_manager_add_item(manager, uri); - g_free(uri); + GtkRecentManager *manager = gtk_recent_manager_get_default(); + gchar *uri = g_filename_to_uri(utf8_filename, NULL, NULL); + if (G_LIKELY(uri != NULL)) + { + gtk_recent_manager_add_item(manager, uri); + g_free(uri); + } } #endif g_queue_push_head(grf->recent_queue, g_strdup(utf8_filename));