summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-directory-metafile.c
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2001-02-15 02:06:53 +0000
committerDarin Adler <darin@src.gnome.org>2001-02-15 02:06:53 +0000
commit86110afd60937d0e7799748b77def6e34cbbd98a (patch)
tree0f4b6fd3a8dbe8f37dede76d62d32912210fa314 /libnautilus-private/nautilus-directory-metafile.c
parent086645a15189df9e499d91121d2b34eaa0690c36 (diff)
downloadnautilus-86110afd60937d0e7799748b77def6e34cbbd98a.tar.gz
reviewed by: Gene Ragan <gzr@eazel.com>
* src/nautilus-applicable-views.c: (got_minimum_file_info_callback), (nautilus_determine_initial_view), (nautilus_determine_initial_view_cancel): Get rid of the code to monitor the directory. It's now moved up one level to the manage-views.c code. * src/nautilus-window-private.h: * src/nautilus-window-manage-views.c: (free_location_change), (begin_location_change): Move the code that starts monitoring the directory up here instead. * src/nautilus-application.c: (volume_unmounted_callback): Rewrote this code to not use the viewed_file private field. There's a public call to get the current location that should work just as well. Also fix bug where it would ignore the scheme and just look at the path part. * libnautilus-extensions/nautilus-directory-metafile.c: (nautilus_directory_use_self_contained_metafile_factory): Added check to detect if this is called after using the factory. (free_factory): Simplified. (get_factory): New function to simplify get_metafile. (get_metafile): Simplified. * src/nautilus-location-bar.c: (try_to_expand_path): Fix storage leak. * libnautilus-extensions/nautilus-entry.c: (nautilus_entry_key_press): Added FIXME after noticing a particularly lame version of tilde expansion in here. I'm not sure this is even used to good effect, since the location bar now does its own tidle expansion. * README: Fixed many inaccuracies. * libnautilus-extensions/nautilus-stock-dialogs.c: (timed_wait_free): Formatting tweaks. * src/nautilus-theme-selector.c: (get_theme_description_and_display_name): Formatting tweaks.
Diffstat (limited to 'libnautilus-private/nautilus-directory-metafile.c')
-rw-r--r--libnautilus-private/nautilus-directory-metafile.c56
1 files changed, 29 insertions, 27 deletions
diff --git a/libnautilus-private/nautilus-directory-metafile.c b/libnautilus-private/nautilus-directory-metafile.c
index 955db9bbb..17c62d977 100644
--- a/libnautilus-private/nautilus-directory-metafile.c
+++ b/libnautilus-private/nautilus-directory-metafile.c
@@ -2,7 +2,7 @@
nautilus-directory-metafile.c: Nautilus directory model.
- Copyright (C) 2000 Eazel, Inc.
+ Copyright (C) 2000, 2001 Eazel, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -19,61 +19,63 @@
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
- Author: Darin Adler <darin@eazel.com>
+ Authors: Darin Adler <darin@eazel.com>,
+ Mike Engber <engber@eazel.com>
*/
#include <config.h>
#include "nautilus-directory-metafile.h"
+#include <libnautilus-extensions/nautilus-metafile-factory.h>
#include <libnautilus-extensions/nautilus-metafile-server.h>
#include <libnautilus-extensions/nautilus-string.h>
-
-#include <libnautilus-extensions/nautilus-metafile-factory.h>
-
#include <liboaf/liboaf.h>
-
#include <stdio.h>
-static Nautilus_MetafileFactory the_factory = CORBA_OBJECT_NIL;
-
-static void
-free_factory (void)
-{
- CORBA_Environment ev;
- CORBA_exception_init (&ev);
- bonobo_object_release_unref (the_factory, &ev);
- the_factory = CORBA_OBJECT_NIL;
- CORBA_exception_free (&ev);
-}
-
+static Nautilus_MetafileFactory factory = CORBA_OBJECT_NIL;
static gboolean get_factory_from_oaf = TRUE;
void
nautilus_directory_use_self_contained_metafile_factory (void)
{
+ g_return_if_fail (factory == CORBA_OBJECT_NIL);
+
get_factory_from_oaf = FALSE;
}
-static Nautilus_Metafile
-get_metafile (NautilusDirectory *directory, CORBA_Environment *ev)
+static void
+free_factory (void)
+{
+ bonobo_object_release_unref (factory, NULL);
+}
+
+static Nautilus_MetafileFactory
+get_factory (void)
{
- char * uri;
- Nautilus_Metafile metafile;
NautilusMetafileFactory *instance;
- if (CORBA_Object_is_nil (the_factory, ev)) {
+ if (factory == CORBA_OBJECT_NIL) {
if (get_factory_from_oaf) {
- the_factory = oaf_activate_from_id (METAFILE_FACTORY_IID, 0, NULL, NULL);
+ factory = oaf_activate_from_id (METAFILE_FACTORY_IID, 0, NULL, NULL);
} else {
instance = nautilus_metafile_factory_get_instance ();
- the_factory = bonobo_object_dup_ref (bonobo_object_corba_objref (BONOBO_OBJECT (instance)), ev);
+ factory = bonobo_object_dup_ref (bonobo_object_corba_objref (BONOBO_OBJECT (instance)), NULL);
bonobo_object_unref (BONOBO_OBJECT (instance));
}
g_atexit (free_factory);
}
-
+
+ return factory;
+}
+
+static Nautilus_Metafile
+get_metafile (NautilusDirectory *directory, CORBA_Environment *ev)
+{
+ char *uri;
+ Nautilus_Metafile metafile;
+
uri = nautilus_directory_get_uri (directory);
- metafile = Nautilus_MetafileFactory_open (the_factory, uri, ev);
+ metafile = Nautilus_MetafileFactory_open (get_factory (), uri, ev);
g_free (uri);
return metafile;