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
This commit is contained in:
Enrico Tröger 2009-04-07 22:09:23 +00:00
parent 8111ada01b
commit 28ac7814fd
2 changed files with 19 additions and 7 deletions

View File

@ -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 <nick(dot)treleaven(at)btinternet(dot)com>

View File

@ -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));