Only make an EggRecentModel once, instead of for every new window. Moved

2002-11-05  James Willcox  <jwillcox@gnome.org>

	* libnautilus-private/Makefile.am:
	* libnautilus-private/nautilus-recent.[ch]:
	* src/file-manager/Makefile.am:
	* src/file-manager/fm-directory-view.c:
	(fm_directory_view_launch_application), (fm_directory_view_init),
	(fm_directory_view_destroy):

	Only make an EggRecentModel once, instead of for every new window.
	Moved egg-recent*.[ch] into libnautilus-private
This commit is contained in:
James Willcox 2002-11-05 19:02:08 +00:00 committed by James Willcox
parent 9e47a1d75b
commit c0939bb808
12 changed files with 80 additions and 29 deletions

View file

@ -1,3 +1,15 @@
2002-11-05 James Willcox <jwillcox@gnome.org>
* libnautilus-private/Makefile.am:
* libnautilus-private/nautilus-recent.[ch]:
* src/file-manager/Makefile.am:
* src/file-manager/fm-directory-view.c:
(fm_directory_view_launch_application), (fm_directory_view_init),
(fm_directory_view_destroy):
Only make an EggRecentModel once, instead of for every new window.
Moved egg-recent*.[ch] into libnautilus-private
2002-11-05 James Willcox <jwillcox@gnome.org>
* libnautilus-private/apps_nautilus_preferences.schemas:

View file

@ -35,7 +35,7 @@ marshal_sources = \
nautilus-marshal-guts.c \
$(NULL)
EGGFILES = \
EGG_SCREEN_FILES = \
egg-screen-exec.h \
egg-screen-exec.c \
egg-screen-url.h \
@ -44,6 +44,15 @@ EGGFILES = \
egg-screen-help.c \
$(NULL)
EGG_RECENT_FILES = \
egg-recent-model.c \
egg-recent-model.h \
egg-recent-item.c \
egg-recent-item.h \
egg-recent-vfs-utils.c \
egg-recent-vfs-utils.h \
$(NULL)
libnautilus_private_la_SOURCES = \
$(nautilus_metafile_server_idl_sources) \
eggtreemultidnd.c \
@ -141,6 +150,8 @@ libnautilus_private_la_SOURCES = \
nautilus-program-chooser.h \
nautilus-program-choosing.c \
nautilus-program-choosing.h \
nautilus-recent.h \
nautilus-recent.c \
nautilus-search-uri.c \
nautilus-search-uri.h \
nautilus-sidebar-functions.c \
@ -173,7 +184,8 @@ libnautilus_private_la_SOURCES = \
nautilus-view-identifier.h \
nautilus-volume-monitor.c \
nautilus-volume-monitor.h \
$(EGGFILES) \
$(EGG_SCREEN_FILES) \
$(EGG_RECENT_FILES) \
$(NULL)
fsattributesdir = $(datadir)/nautilus
@ -222,7 +234,9 @@ CLEANFILES = \
dist-hook:
cd $(distdir); rm -f $(CLEANFILES)
EGGDIR = $(srcdir)/../../libegg/libegg/screen-exec
EGG_SCREEN_DIR = $(srcdir)/../../libegg/libegg/screen-exec
EGG_RECENT_DIR = $(srcdir)/../../libegg/libegg/recent-files
regenerate-built-sources:
EGGFILES="$(EGGFILES)" EGGDIR="$(EGGDIR)" $(srcdir)/update-from-egg.sh
EGGFILES="$(EGG_SCREEN_FILES)" EGGDIR="$(EGG_SCREEN_DIR)" $(srcdir)/update-from-egg.sh
EGGFILES="$(EGG_RECENT_FILES)" EGGDIR="$(EGG_RECENT_DIR)" $(srcdir)/update-from-egg.sh

View file

@ -0,0 +1,36 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2002 James Willcox
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "nautilus-recent.h"
EggRecentModel *
nautilus_recent_get_model (void)
{
static EggRecentModel *model = NULL;
if (model == NULL) {
model = egg_recent_model_new (EGG_RECENT_MODEL_SORT_NONE);
egg_recent_model_set_limit (model, 0);
}
return model;
}

View file

@ -0,0 +1,11 @@
#ifndef __NAUTILUS_RECENT_H__
#define __NAUTILUS_RECENT_H__
#include "egg-recent-model.h"
EggRecentModel *nautilus_recent_get_model (void);
#endif

View file

@ -15,13 +15,7 @@ INCLUDES = \
-DGNOME_DISABLE_DEPRECATED \
$(NULL)
EGG_RECENT_FILES = \
egg-recent-model.c \
egg-recent-model.h \
egg-recent-item.c \
egg-recent-item.h \
egg-recent-vfs-utils.c \
egg-recent-vfs-utils.h
libnautilus_file_manager_la_SOURCES= \
fm-desktop-icon-view.c \
@ -45,7 +39,6 @@ libnautilus_file_manager_la_SOURCES= \
fm-properties-window.h \
fm-search-list-view.h \
nautilus-indexing-info.h \
$(EGG_RECENT_FILES) \
$(NULL)
uidir = $(datadir)/gnome-2.0/ui
@ -57,8 +50,3 @@ ui_DATA = \
$(NULL)
EXTRA_DIST = $(ui_DATA)
EGG_DIR = $(srcdir)/../../../libegg/libegg/recent-files
regenerate-built-sources:
EGGFILES="$(EGG_RECENT_FILES)" EGGDIR="$(EGG_DIR)" $(srcdir)/update-from-egg.sh

View file

@ -30,7 +30,6 @@
#include <config.h>
#include "fm-directory-view.h"
#include "egg-recent-model.h"
#include "fm-desktop-icon-view.h"
#include "fm-error-reporting.h"
#include "fm-properties-window.h"
@ -62,6 +61,7 @@
#include <libgnomevfs/gnome-vfs-result.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libnautilus-private/nautilus-recent.h>
#include <libnautilus-private/egg-screen-exec.h>
#include <libnautilus-private/nautilus-bonobo-extensions.h>
#include <libnautilus-private/nautilus-directory-background.h>
@ -237,8 +237,6 @@ struct FMDirectoryViewDetails
gboolean send_selection_change_to_shell;
NautilusFile *file_monitored_for_open_with;
EggRecentModel *recent_model;
};
typedef enum {
@ -585,7 +583,7 @@ fm_directory_view_launch_application (GnomeVFSMimeApplication *application,
(application, file, fm_directory_view_get_containing_window (directory_view));
uri = nautilus_file_get_uri (file);
egg_recent_model_add (directory_view->details->recent_model, uri);
egg_recent_model_add (nautilus_recent_get_model (), uri);
g_free (uri);
}
@ -1358,9 +1356,6 @@ fm_directory_view_init (FMDirectoryView *view)
eel_preferences_add_callback (NAUTILUS_PREFERENCES_SORT_DIRECTORIES_FIRST,
sort_directories_first_changed_callback, view);
view->details->recent_model = egg_recent_model_new (EGG_RECENT_MODEL_SORT_NONE);
/* we aren't interested at all in viewing the list */
egg_recent_model_set_limit (view->details->recent_model, 0);
}
static void
@ -1372,11 +1367,6 @@ fm_directory_view_destroy (GtkObject *object)
disconnect_model_handlers (view);
if (view->details->recent_model) {
g_object_unref (view->details->recent_model);
view->details->recent_model = NULL;
}
/* Since we are owned by the NautilusView, if we're going it's
* gone. It would be even better to NULL this out when the
* NautilusView goes away, but this is good enough for our