mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-24 18:25:50 +00:00
Removed. Removed. Removed.
2007-12-10 Alexander Larsson <alexl@redhat.com> * libnautilus-private/nautilus-directory-async.c: * libnautilus-private/nautilus-directory-metafile.[ch]: * libnautilus-private/nautilus-metafile.[ch]: * libnautilus-private/nautilus-directory-private.h: * libnautilus-private/nautilus-directory.c: * libnautilus-private/Makefile.am: * libnautilus-private/nautilus-directory-metafile-monitor.[ch]: Removed. * libnautilus-private/nautilus-metafile-factory.[ch]: Removed. * libnautilus-private/nautilus-metafile-server.idl: Removed. * src/nautilus-application.c: * src/nautilus-main.c: * src/nautilus-spatial-window.c: Remove the bonobo layer for metadata, as we're always in-process anyway these days. svn path=/trunk/; revision=13515
This commit is contained in:
parent
679a09d262
commit
c2e8c49325
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2007-12-10 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* libnautilus-private/nautilus-directory-async.c:
|
||||
* libnautilus-private/nautilus-directory-metafile.[ch]:
|
||||
* libnautilus-private/nautilus-metafile.[ch]:
|
||||
* libnautilus-private/nautilus-directory-private.h:
|
||||
* libnautilus-private/nautilus-directory.c:
|
||||
* libnautilus-private/Makefile.am:
|
||||
* libnautilus-private/nautilus-directory-metafile-monitor.[ch]: Removed.
|
||||
* libnautilus-private/nautilus-metafile-factory.[ch]: Removed.
|
||||
* libnautilus-private/nautilus-metafile-server.idl: Removed.
|
||||
* src/nautilus-application.c:
|
||||
* src/nautilus-main.c:
|
||||
* src/nautilus-spatial-window.c:
|
||||
Remove the bonobo layer for metadata, as we're always in-process anyway
|
||||
these days.
|
||||
|
||||
2007-12-07 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* libnautilus-private/nautilus-file.[ch]:
|
||||
|
|
|
@ -35,20 +35,12 @@ libnautilus_private_la_LIBADD = \
|
|||
$(CORE_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
nautilus_metafile_server_idl_sources = \
|
||||
nautilus-metafile-server-stubs.c \
|
||||
nautilus-metafile-server-skels.c \
|
||||
nautilus-metafile-server.h \
|
||||
nautilus-metafile-server-common.c \
|
||||
$(NULL)
|
||||
|
||||
marshal_sources = \
|
||||
nautilus-marshal.h \
|
||||
nautilus-marshal-guts.c \
|
||||
$(NULL)
|
||||
|
||||
libnautilus_private_la_SOURCES = \
|
||||
$(nautilus_metafile_server_idl_sources) \
|
||||
nautilus-bookmark.c \
|
||||
nautilus-bookmark.h \
|
||||
nautilus-cell-renderer-pixbuf-emblem.c \
|
||||
|
@ -82,8 +74,6 @@ libnautilus_private_la_SOURCES = \
|
|||
nautilus-directory-async.c \
|
||||
nautilus-directory-background.c \
|
||||
nautilus-directory-background.h \
|
||||
nautilus-directory-metafile-monitor.c \
|
||||
nautilus-directory-metafile-monitor.h \
|
||||
nautilus-directory-metafile.c \
|
||||
nautilus-directory-metafile.h \
|
||||
nautilus-directory-notify.h \
|
||||
|
@ -140,8 +130,6 @@ libnautilus_private_la_SOURCES = \
|
|||
nautilus-merged-directory.c \
|
||||
nautilus-merged-directory.h \
|
||||
nautilus-metadata.h \
|
||||
nautilus-metafile-factory.c \
|
||||
nautilus-metafile-factory.h \
|
||||
nautilus-metafile.c \
|
||||
nautilus-metafile.h \
|
||||
nautilus-mime-actions.c \
|
||||
|
@ -227,17 +215,12 @@ endif
|
|||
|
||||
$(lib_LTLIBRARIES): $(dependency_static_libs)
|
||||
|
||||
$(nautilus_metafile_server_idl_sources): nautilus_metafile_server_idl_stamp
|
||||
nautilus_metafile_server_idl_stamp: nautilus-metafile-server.idl $(ORBIT_IDL)
|
||||
$(ORBIT_IDL) -I$(top_srcdir) $(CORE_IDL_INCLUDES) $<
|
||||
touch $@
|
||||
|
||||
nautilus-marshal.h: nautilus-marshal.list $(GLIB_GENMARSHAL)
|
||||
$(GLIB_GENMARSHAL) $< --header --prefix=nautilus_marshal > $@
|
||||
nautilus-marshal-guts.c: nautilus-marshal.list $(GLIB_GENMARSHAL)
|
||||
$(GLIB_GENMARSHAL) $< --body --prefix=nautilus_marshal > $@
|
||||
|
||||
$(libnautilus_private_la_OBJECTS): nautilus_metafile_server_idl_stamp $(marshal_sources)
|
||||
$(libnautilus_private_la_OBJECTS): $(marshal_sources)
|
||||
|
||||
|
||||
schema_in_files = apps_nautilus_preferences.schemas.in
|
||||
|
@ -257,7 +240,6 @@ install-data-local:
|
|||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
nautilus-metafile-server.idl \
|
||||
nautilus-marshal.list \
|
||||
$(schema_in_files) \
|
||||
$(BEAGLE_SOURCES) \
|
||||
|
@ -265,8 +247,6 @@ EXTRA_DIST = \
|
|||
$(NULL)
|
||||
|
||||
CLEANFILES = \
|
||||
$(nautilus_metafile_server_idl_sources) \
|
||||
nautilus_metafile_server_idl_stamp \
|
||||
$(marshal_sources) \
|
||||
$(schema_DATA) \
|
||||
$(NULL)
|
||||
|
|
|
@ -683,7 +683,7 @@ nautilus_directory_monitor_add_internal (NautilusDirectory *directory,
|
|||
/* We could just call update_metadata_monitors here, but we can be smarter
|
||||
* since we know what monitor was just added.
|
||||
*/
|
||||
if (monitor->request.metafile && directory->details->metafile_monitor == NULL) {
|
||||
if (monitor->request.metafile && !directory->details->metafile_monitored) {
|
||||
nautilus_directory_register_metadata_monitor (directory);
|
||||
}
|
||||
|
||||
|
@ -1066,13 +1066,13 @@ update_metadata_monitors (NautilusDirectory *directory)
|
|||
|
||||
is_metadata_monitored = is_anyone_waiting_for_metafile (directory);
|
||||
|
||||
if (directory->details->metafile_monitor == NULL) {
|
||||
if (!directory->details->metafile_monitored) {
|
||||
if (is_metadata_monitored) {
|
||||
nautilus_directory_register_metadata_monitor (directory);
|
||||
nautilus_directory_register_metadata_monitor (directory);
|
||||
}
|
||||
} else {
|
||||
if (!is_metadata_monitored) {
|
||||
nautilus_directory_unregister_metadata_monitor (directory);
|
||||
nautilus_directory_unregister_metadata_monitor (directory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1298,7 +1298,7 @@ nautilus_directory_call_when_ready_internal (NautilusDirectory *directory,
|
|||
* We could just call update_metadata_monitors here, but we can be smarter
|
||||
* since we know what was just added.
|
||||
*/
|
||||
if (callback.request.metafile && directory->details->metafile_monitor == NULL) {
|
||||
if (callback.request.metafile && !directory->details->metafile_monitored) {
|
||||
nautilus_directory_register_metadata_monitor (directory);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,125 +0,0 @@
|
|||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||
|
||||
/* nautilus-directory-metafile-monitor.c
|
||||
*
|
||||
* Copyright (C) 2001 Eazel, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "nautilus-directory-metafile-monitor.h"
|
||||
|
||||
#include "nautilus-directory-private.h"
|
||||
#include "nautilus-file-private.h"
|
||||
|
||||
#include <eel/eel-gtk-macros.h>
|
||||
#include <eel/eel-glib-extensions.h>
|
||||
|
||||
struct NautilusMetafileMonitorDetails {
|
||||
NautilusDirectory *directory;
|
||||
};
|
||||
|
||||
BONOBO_CLASS_BOILERPLATE_FULL (NautilusMetafileMonitor, nautilus_metafile_monitor,
|
||||
Nautilus_MetafileMonitor,
|
||||
BonoboObject, BONOBO_OBJECT_TYPE)
|
||||
|
||||
static void
|
||||
nautilus_metafile_monitor_instance_init (NautilusMetafileMonitor *monitor)
|
||||
{
|
||||
monitor->details = g_new0 (NautilusMetafileMonitorDetails, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
NautilusMetafileMonitor *monitor;
|
||||
|
||||
monitor = NAUTILUS_METAFILE_MONITOR (object);
|
||||
|
||||
g_free (monitor->details);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
NautilusMetafileMonitor *
|
||||
nautilus_metafile_monitor_new (NautilusDirectory *directory)
|
||||
{
|
||||
NautilusMetafileMonitor *monitor;
|
||||
|
||||
monitor = NAUTILUS_METAFILE_MONITOR (g_object_new (NAUTILUS_TYPE_METAFILE_MONITOR, NULL));
|
||||
monitor->details->directory = directory;
|
||||
/* The monitor is owned by the directory, so we don't ref the directory. */
|
||||
return monitor;
|
||||
}
|
||||
|
||||
static void
|
||||
corba_metafile_changed (PortableServer_Servant servant,
|
||||
const Nautilus_FileNameList *file_names,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
GList *file_list;
|
||||
NautilusFile *file;
|
||||
CORBA_unsigned_long buf_pos;
|
||||
NautilusMetafileMonitor *monitor;
|
||||
|
||||
monitor = NAUTILUS_METAFILE_MONITOR (bonobo_object_from_servant (servant));
|
||||
|
||||
file_list = NULL;
|
||||
|
||||
for (buf_pos = 0; buf_pos < file_names->_length; ++buf_pos) {
|
||||
file = nautilus_directory_find_file_by_internal_filename
|
||||
(monitor->details->directory, file_names->_buffer [buf_pos]);
|
||||
|
||||
if (file != NULL) {
|
||||
if (nautilus_file_is_self_owned (file)) {
|
||||
nautilus_file_emit_changed (file);
|
||||
} else {
|
||||
file_list = g_list_prepend (file_list, file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (file_list != NULL) {
|
||||
file_list = g_list_reverse (file_list);
|
||||
nautilus_directory_emit_change_signals (monitor->details->directory, file_list);
|
||||
g_list_free (file_list);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
corba_metafile_ready (PortableServer_Servant servant,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
NautilusMetafileMonitor *monitor;
|
||||
|
||||
monitor = NAUTILUS_METAFILE_MONITOR (bonobo_object_from_servant (servant));
|
||||
emit_change_signals_for_all_files (monitor->details->directory);
|
||||
nautilus_idle_queue_add (monitor->details->directory->details->idle_queue,
|
||||
(GFunc) nautilus_directory_async_state_changed,
|
||||
monitor->details->directory,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_metafile_monitor_class_init (NautilusMetafileMonitorClass *klass)
|
||||
{
|
||||
G_OBJECT_CLASS (klass)->finalize = finalize;
|
||||
|
||||
klass->epv.metafile_changed = corba_metafile_changed;
|
||||
klass->epv.metafile_ready = corba_metafile_ready;
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */
|
||||
|
||||
/* nautilus-directory-metafile-monitor.h
|
||||
*
|
||||
* Copyright (C) 2001 Eazel, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef NAUTILUS_METAFILE_MONITOR_H
|
||||
#define NAUTILUS_METAFILE_MONITOR_H
|
||||
|
||||
#include <bonobo/bonobo-object.h>
|
||||
#include <libnautilus-private/nautilus-directory.h>
|
||||
#include <libnautilus-private/nautilus-metafile-server.h>
|
||||
|
||||
#define NAUTILUS_TYPE_METAFILE_MONITOR (nautilus_metafile_monitor_get_type ())
|
||||
#define NAUTILUS_METAFILE_MONITOR(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_METAFILE_MONITOR, NautilusMetafileMonitor))
|
||||
#define NAUTILUS_METAFILE_MONITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_METAFILE_MONITOR, NautilusMetafileMonitorClass))
|
||||
#define NAUTILUS_IS_METAFILE_MONITOR(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_METAFILE_MONITOR))
|
||||
#define NAUTILUS_IS_METAFILE_MONITOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_METAFILE_MONITOR))
|
||||
|
||||
typedef struct NautilusMetafileMonitorDetails NautilusMetafileMonitorDetails;
|
||||
|
||||
typedef struct {
|
||||
BonoboObject parent_slot;
|
||||
NautilusMetafileMonitorDetails *details;
|
||||
} NautilusMetafileMonitor;
|
||||
|
||||
typedef struct {
|
||||
BonoboObjectClass parent_slot;
|
||||
POA_Nautilus_MetafileMonitor__epv epv;
|
||||
} NautilusMetafileMonitorClass;
|
||||
|
||||
GType nautilus_metafile_monitor_get_type (void);
|
||||
NautilusMetafileMonitor *nautilus_metafile_monitor_new (NautilusDirectory *directory);
|
||||
|
||||
#endif /* NAUTILUS_METAFILE_MONITOR_H */
|
|
@ -26,167 +26,42 @@
|
|||
#include <config.h>
|
||||
#include "nautilus-directory-metafile.h"
|
||||
|
||||
#include "nautilus-directory-metafile-monitor.h"
|
||||
#include "nautilus-directory-private.h"
|
||||
#include "nautilus-metafile-factory.h"
|
||||
#include "nautilus-metafile-server.h"
|
||||
#include <bonobo-activation/bonobo-activation.h>
|
||||
#include "nautilus-file-private.h"
|
||||
#include "nautilus-metafile.h"
|
||||
#include <eel/eel-debug.h>
|
||||
#include <eel/eel-string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static Nautilus_MetafileFactory factory = CORBA_OBJECT_NIL;
|
||||
/* We disable the remote metafile factory, because there seems to be some
|
||||
* sort of races with bonobo activation that sometimes leads to crashes
|
||||
* like in bug #351713. This isn't really a problem anyway, since nautilus
|
||||
* is only one process these days, and we still use bonobo activation to
|
||||
* avoid starting multiple copies of it.
|
||||
*/
|
||||
static gboolean get_factory_from_oaf = FALSE;
|
||||
|
||||
void
|
||||
nautilus_directory_use_self_contained_metafile_factory (void)
|
||||
{
|
||||
g_return_if_fail (factory == CORBA_OBJECT_NIL);
|
||||
|
||||
get_factory_from_oaf = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
free_factory (void)
|
||||
{
|
||||
CORBA_Object_release (factory, NULL);
|
||||
factory = CORBA_OBJECT_NIL;
|
||||
}
|
||||
|
||||
static void
|
||||
die_on_failed_activation (const char *server_name,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
/* This isn't supposed to happen. So do some core-dumping
|
||||
* action, and don't bother translating the error message.
|
||||
*/
|
||||
|
||||
const char *details;
|
||||
Bonobo_GeneralError *general_error;
|
||||
|
||||
switch (ev->_major) {
|
||||
case CORBA_NO_EXCEPTION:
|
||||
details = "got NIL but no exception";
|
||||
break;
|
||||
|
||||
case CORBA_SYSTEM_EXCEPTION:
|
||||
case CORBA_USER_EXCEPTION:
|
||||
details = CORBA_exception_id (ev);
|
||||
if (strcmp (details, "IDL:Bonobo/GeneralError:1.0") == 0) {
|
||||
general_error = CORBA_exception_value (ev);
|
||||
details = general_error->description;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
details = "got bad exception";
|
||||
break;
|
||||
}
|
||||
|
||||
g_error ("Failed to activate the server %s; this may indicate a broken\n"
|
||||
"Nautilus or Bonobo installation, or may reflect a bug in something,\n"
|
||||
"or may mean that your PATH or LD_LIBRARY_PATH or the like is\n"
|
||||
"incorrect. Nautilus will dump core and exit.\n"
|
||||
"Details: '%s'", server_name, details);
|
||||
}
|
||||
|
||||
static Nautilus_MetafileFactory
|
||||
get_factory (void)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
|
||||
if (factory == CORBA_OBJECT_NIL) {
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
if (get_factory_from_oaf) {
|
||||
factory = bonobo_activation_activate_from_id (METAFILE_FACTORY_IID, 0, NULL, &ev);
|
||||
if (ev._major != CORBA_NO_EXCEPTION || factory == CORBA_OBJECT_NIL) {
|
||||
die_on_failed_activation ("Nautilus_MetafileFactory", &ev);
|
||||
}
|
||||
} else {
|
||||
factory = CORBA_Object_duplicate
|
||||
(BONOBO_OBJREF (nautilus_metafile_factory_get_instance ()), &ev);
|
||||
}
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
|
||||
eel_debug_call_at_shutdown (free_factory);
|
||||
}
|
||||
|
||||
return factory;
|
||||
}
|
||||
|
||||
static Nautilus_Metafile
|
||||
open_metafile (const char *uri, gboolean make_errors_fatal)
|
||||
{
|
||||
Nautilus_Metafile metafile;
|
||||
CORBA_Environment ev;
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
metafile = Nautilus_MetafileFactory_open (get_factory (), uri, &ev);
|
||||
|
||||
if (ev._major != CORBA_NO_EXCEPTION) {
|
||||
metafile = CORBA_OBJECT_NIL;
|
||||
if (make_errors_fatal) {
|
||||
g_error ("%s: CORBA error opening MetafileFactory: %s",
|
||||
g_get_prgname (),
|
||||
CORBA_exception_id (&ev));
|
||||
}
|
||||
}
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
|
||||
return metafile;
|
||||
}
|
||||
|
||||
static Nautilus_Metafile
|
||||
static NautilusMetafile *
|
||||
get_metafile (NautilusDirectory *directory)
|
||||
{
|
||||
char *uri;
|
||||
|
||||
if (directory->details->metafile_corba_object == CORBA_OBJECT_NIL) {
|
||||
if (directory->details->metafile == NULL) {
|
||||
uri = nautilus_directory_get_uri (directory);
|
||||
directory->details->metafile_corba_object = open_metafile (uri, FALSE);
|
||||
directory->details->metafile = nautilus_metafile_get_for_uri (uri);
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
return directory->details->metafile_corba_object;
|
||||
return directory->details->metafile;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nautilus_directory_is_metadata_read (NautilusDirectory *directory)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
gboolean result;
|
||||
Nautilus_Metafile metafile;
|
||||
NautilusMetafile *metafile;
|
||||
|
||||
g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), FALSE);
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
metafile = get_metafile (directory);
|
||||
|
||||
if (metafile == CORBA_OBJECT_NIL) {
|
||||
if (metafile == NULL) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
result = Nautilus_Metafile_is_read (metafile, &ev);
|
||||
if (ev._major != CORBA_NO_EXCEPTION) {
|
||||
result = TRUE;
|
||||
g_debug ("CORBA exception when determining whether metafile is read: %s",
|
||||
CORBA_exception_id (&ev));
|
||||
}
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
|
||||
return result;
|
||||
return nautilus_metafile_is_read (metafile);
|
||||
}
|
||||
|
||||
char *
|
||||
|
@ -195,49 +70,15 @@ nautilus_directory_get_file_metadata (NautilusDirectory *directory,
|
|||
const char *key,
|
||||
const char *default_metadata)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
char *result;
|
||||
const char *non_null_default;
|
||||
CORBA_char *corba_value;
|
||||
Nautilus_Metafile metafile;
|
||||
NautilusMetafile *metafile;
|
||||
|
||||
g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), g_strdup (default_metadata));
|
||||
g_return_val_if_fail (!eel_str_is_empty (file_name), g_strdup (default_metadata));
|
||||
g_return_val_if_fail (!eel_str_is_empty (key), g_strdup (default_metadata));
|
||||
|
||||
/* We can't pass NULL as a CORBA_string - pass "" instead. */
|
||||
non_null_default = default_metadata != NULL ? default_metadata : "";
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
metafile = get_metafile (directory);
|
||||
|
||||
if (metafile == CORBA_OBJECT_NIL) {
|
||||
return g_strdup (default_metadata);
|
||||
}
|
||||
|
||||
corba_value = Nautilus_Metafile_get (metafile, file_name, key, non_null_default, &ev);
|
||||
|
||||
if (ev._major != CORBA_NO_EXCEPTION) {
|
||||
g_debug ("CORBA exception when getting file metadata: %s", CORBA_exception_id (&ev));
|
||||
CORBA_exception_free (&ev);
|
||||
return g_strdup (default_metadata);
|
||||
}
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
|
||||
if (eel_str_is_empty (corba_value)) {
|
||||
/* Even though in all other respects we treat "" as NULL, we want to
|
||||
* make sure the caller gets back the same default that was passed in.
|
||||
*/
|
||||
result = g_strdup (default_metadata);
|
||||
} else {
|
||||
result = g_strdup (corba_value);
|
||||
}
|
||||
|
||||
CORBA_free (corba_value);
|
||||
|
||||
return result;
|
||||
return nautilus_metafile_get (metafile, file_name, key, default_metadata);
|
||||
}
|
||||
|
||||
GList *
|
||||
|
@ -246,11 +87,7 @@ nautilus_directory_get_file_metadata_list (NautilusDirectory *directory,
|
|||
const char *list_key,
|
||||
const char *list_subkey)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
GList *result;
|
||||
Nautilus_MetadataList *corba_value;
|
||||
CORBA_unsigned_long buf_pos;
|
||||
Nautilus_Metafile metafile;
|
||||
NautilusMetafile * metafile;
|
||||
|
||||
g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), NULL);
|
||||
g_return_val_if_fail (!eel_str_is_empty (file_name), NULL);
|
||||
|
@ -258,30 +95,7 @@ nautilus_directory_get_file_metadata_list (NautilusDirectory *directory,
|
|||
g_return_val_if_fail (!eel_str_is_empty (list_subkey), NULL);
|
||||
|
||||
metafile = get_metafile (directory);
|
||||
|
||||
if (metafile == CORBA_OBJECT_NIL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
corba_value = Nautilus_Metafile_get_list (metafile, file_name, list_key, list_subkey, &ev);
|
||||
if (ev._major != CORBA_NO_EXCEPTION) {
|
||||
g_debug ("Failed to get metafile list: %s\n", CORBA_exception_id (&ev));
|
||||
CORBA_exception_free (&ev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
|
||||
result = NULL;
|
||||
for (buf_pos = 0; buf_pos < corba_value->_length; ++buf_pos) {
|
||||
result = g_list_prepend (result, g_strdup (corba_value->_buffer [buf_pos]));
|
||||
}
|
||||
result = g_list_reverse (result);
|
||||
CORBA_free (corba_value);
|
||||
|
||||
return result;
|
||||
return nautilus_metafile_get_list (metafile, file_name, list_key, list_subkey);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -291,37 +105,14 @@ nautilus_directory_set_file_metadata (NautilusDirectory *directory,
|
|||
const char *default_metadata,
|
||||
const char *metadata)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
Nautilus_Metafile metafile;
|
||||
NautilusMetafile *metafile;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
|
||||
g_return_if_fail (!eel_str_is_empty (file_name));
|
||||
g_return_if_fail (!eel_str_is_empty (key));
|
||||
|
||||
metafile = get_metafile (directory);
|
||||
|
||||
if (metafile == CORBA_OBJECT_NIL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* We can't pass NULL as a CORBA_string - pass "" instead.
|
||||
*/
|
||||
if (default_metadata == NULL) {
|
||||
default_metadata = "";
|
||||
}
|
||||
if (metadata == NULL) {
|
||||
metadata = "";
|
||||
}
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
Nautilus_Metafile_set (metafile, file_name, key, default_metadata, metadata, &ev);
|
||||
|
||||
if (ev._major != CORBA_NO_EXCEPTION) {
|
||||
g_debug ("CORBA exception when setting file metadata: %s", CORBA_exception_id (&ev));
|
||||
}
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
nautilus_metafile_set (metafile, file_name, key, default_metadata, metadata);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -331,12 +122,7 @@ nautilus_directory_set_file_metadata_list (NautilusDirectory *directory,
|
|||
const char *list_subkey,
|
||||
GList *list)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
Nautilus_Metafile metafile;
|
||||
Nautilus_MetadataList *corba_list;
|
||||
int len;
|
||||
int buf_pos;
|
||||
GList *list_ptr;
|
||||
NautilusMetafile *metafile;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
|
||||
g_return_if_fail (!eel_str_is_empty (file_name));
|
||||
|
@ -344,42 +130,11 @@ nautilus_directory_set_file_metadata_list (NautilusDirectory *directory,
|
|||
g_return_if_fail (!eel_str_is_empty (list_subkey));
|
||||
|
||||
metafile = get_metafile (directory);
|
||||
|
||||
if (metafile == CORBA_OBJECT_NIL) {
|
||||
return;
|
||||
}
|
||||
|
||||
len = g_list_length (list);
|
||||
|
||||
corba_list = Nautilus_MetadataList__alloc ();
|
||||
corba_list->_maximum = len;
|
||||
corba_list->_length = len;
|
||||
corba_list->_buffer = CORBA_sequence_CORBA_string_allocbuf (len);
|
||||
|
||||
/* We allocate our buffer with CORBA calls, so CORBA_free will clean it
|
||||
* all up if we set release to TRUE.
|
||||
*/
|
||||
CORBA_sequence_set_release (corba_list, CORBA_TRUE);
|
||||
|
||||
buf_pos = 0;
|
||||
list_ptr = list;
|
||||
while (list_ptr != NULL) {
|
||||
corba_list->_buffer [buf_pos] = CORBA_string_dup (list_ptr->data);
|
||||
list_ptr = g_list_next (list_ptr);
|
||||
++buf_pos;
|
||||
}
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
Nautilus_Metafile_set_list (metafile, file_name, list_key, list_subkey, corba_list, &ev);
|
||||
|
||||
if (ev._major != CORBA_NO_EXCEPTION) {
|
||||
g_debug ("CORBA exception when setting file metadata list: %s", CORBA_exception_id (&ev));
|
||||
}
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
|
||||
CORBA_free (corba_list);
|
||||
nautilus_metafile_set_list (metafile,
|
||||
file_name,
|
||||
list_key,
|
||||
list_subkey,
|
||||
list);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -476,9 +231,8 @@ nautilus_directory_copy_file_metadata (NautilusDirectory *source_directory,
|
|||
NautilusDirectory *destination_directory,
|
||||
const char *destination_file_name)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
char *destination_uri;
|
||||
Nautilus_Metafile metafile;
|
||||
NautilusMetafile *metafile;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_DIRECTORY (source_directory));
|
||||
g_return_if_fail (source_file_name != NULL);
|
||||
|
@ -486,23 +240,10 @@ nautilus_directory_copy_file_metadata (NautilusDirectory *source_directory,
|
|||
g_return_if_fail (destination_file_name != NULL);
|
||||
|
||||
metafile = get_metafile (source_directory);
|
||||
|
||||
if (metafile == CORBA_OBJECT_NIL) {
|
||||
return;
|
||||
}
|
||||
|
||||
destination_uri = nautilus_directory_get_uri (destination_directory);
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
Nautilus_Metafile_copy (metafile, source_file_name,
|
||||
destination_uri, destination_file_name, &ev);
|
||||
|
||||
if (ev._major != CORBA_NO_EXCEPTION) {
|
||||
g_debug ("CORBA exception when copying file metadata: %s", CORBA_exception_id (&ev));
|
||||
}
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
nautilus_metafile_copy (metafile, source_file_name,
|
||||
destination_uri, destination_file_name);
|
||||
|
||||
g_free (destination_uri);
|
||||
}
|
||||
|
@ -511,27 +252,13 @@ void
|
|||
nautilus_directory_remove_file_metadata (NautilusDirectory *directory,
|
||||
const char *file_name)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
Nautilus_Metafile metafile;
|
||||
NautilusMetafile *metafile;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
|
||||
g_return_if_fail (file_name != NULL);
|
||||
|
||||
metafile = get_metafile (directory);
|
||||
|
||||
if (metafile == CORBA_OBJECT_NIL) {
|
||||
return;
|
||||
}
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
Nautilus_Metafile_remove (metafile, file_name, &ev);
|
||||
|
||||
if (ev._major != CORBA_NO_EXCEPTION) {
|
||||
g_debug ("CORBA exception when removing file metadata: %s", CORBA_exception_id (&ev));
|
||||
}
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
nautilus_metafile_remove (metafile, file_name);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -539,120 +266,98 @@ nautilus_directory_rename_file_metadata (NautilusDirectory *directory,
|
|||
const char *old_file_name,
|
||||
const char *new_file_name)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
Nautilus_Metafile metafile;
|
||||
NautilusMetafile *metafile;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
|
||||
g_return_if_fail (old_file_name != NULL);
|
||||
g_return_if_fail (new_file_name != NULL);
|
||||
|
||||
metafile = get_metafile (directory);
|
||||
|
||||
if (metafile == CORBA_OBJECT_NIL) {
|
||||
return;
|
||||
}
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
Nautilus_Metafile_rename (metafile, old_file_name, new_file_name, &ev);
|
||||
|
||||
if (ev._major != CORBA_NO_EXCEPTION) {
|
||||
g_debug ("CORBA exception when renaming file metadata: %s", CORBA_exception_id (&ev));
|
||||
}
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
nautilus_metafile_rename (metafile, old_file_name,new_file_name);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_directory_rename_directory_metadata (NautilusDirectory *directory,
|
||||
const char *new_directory_uri)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
Nautilus_Metafile metafile;
|
||||
NautilusMetafile *metafile;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
|
||||
g_return_if_fail (new_directory_uri != NULL);
|
||||
|
||||
metafile = get_metafile (directory);
|
||||
|
||||
if (metafile == CORBA_OBJECT_NIL) {
|
||||
return;
|
||||
}
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
Nautilus_Metafile_rename_directory (metafile, new_directory_uri, &ev);
|
||||
|
||||
if (ev._major != CORBA_NO_EXCEPTION) {
|
||||
g_debug ("CORBA exception when renaming directory metadata: %s", CORBA_exception_id (&ev));
|
||||
}
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
nautilus_metafile_rename_directory (metafile, new_directory_uri);
|
||||
}
|
||||
|
||||
static void
|
||||
metafile_changed_cb (NautilusMetafile *metafile,
|
||||
GList *file_names,
|
||||
NautilusDirectory *directory)
|
||||
{
|
||||
GList *file_list;
|
||||
NautilusFile *file;
|
||||
|
||||
file_list = NULL;
|
||||
while (file_names != NULL) {
|
||||
file = nautilus_directory_find_file_by_internal_filename
|
||||
(directory, file_names->data);
|
||||
|
||||
if (file != NULL) {
|
||||
if (nautilus_file_is_self_owned (file)) {
|
||||
nautilus_file_emit_changed (file);
|
||||
} else {
|
||||
file_list = g_list_prepend (file_list, file);
|
||||
}
|
||||
}
|
||||
file_names = file_names->next;
|
||||
}
|
||||
|
||||
if (file_list != NULL) {
|
||||
file_list = g_list_reverse (file_list);
|
||||
nautilus_directory_emit_change_signals (directory, file_list);
|
||||
g_list_free (file_list);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
metafile_ready_cb (NautilusMetafile *metafile,
|
||||
NautilusDirectory *directory)
|
||||
{
|
||||
emit_change_signals_for_all_files (directory);
|
||||
nautilus_directory_async_state_changed (directory);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nautilus_directory_register_metadata_monitor (NautilusDirectory *directory)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
Nautilus_Metafile metafile;
|
||||
NautilusMetafile *metafile;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
|
||||
|
||||
if (directory->details->metafile_monitor != NULL) {
|
||||
/* If there's already a monitor, it's already registered. */
|
||||
if (directory->details->metafile_monitored) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
metafile = get_metafile (directory);
|
||||
directory->details->metafile_monitored = TRUE;
|
||||
|
||||
if (metafile == CORBA_OBJECT_NIL) {
|
||||
return;
|
||||
}
|
||||
|
||||
directory->details->metafile_monitor = nautilus_metafile_monitor_new (directory);
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
Nautilus_Metafile_register_monitor
|
||||
(metafile,
|
||||
BONOBO_OBJREF (directory->details->metafile_monitor),
|
||||
&ev);
|
||||
|
||||
if (ev._major != CORBA_NO_EXCEPTION) {
|
||||
g_debug ("CORBA exception when registering metadata monitor: %s", CORBA_exception_id (&ev));
|
||||
}
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
g_signal_connect (metafile, "changed", (GCallback)metafile_changed_cb, directory);
|
||||
g_signal_connect (metafile, "ready", (GCallback)metafile_ready_cb, directory);
|
||||
|
||||
nautilus_metafile_load (metafile);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_directory_unregister_metadata_monitor (NautilusDirectory *directory)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
Nautilus_Metafile metafile;
|
||||
NautilusMetafile *metafile;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
|
||||
g_return_if_fail (NAUTILUS_IS_METAFILE_MONITOR (directory->details->metafile_monitor));
|
||||
|
||||
directory->details->metafile_monitored = FALSE;
|
||||
|
||||
metafile = get_metafile (directory);
|
||||
|
||||
if (metafile == CORBA_OBJECT_NIL) {
|
||||
return;
|
||||
}
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
Nautilus_Metafile_unregister_monitor
|
||||
(metafile,
|
||||
BONOBO_OBJREF (directory->details->metafile_monitor),
|
||||
&ev);
|
||||
|
||||
if (ev._major != CORBA_NO_EXCEPTION) {
|
||||
g_debug ("CORBA exception when unregistering metadata monitor: %s", CORBA_exception_id (&ev));
|
||||
}
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
|
||||
bonobo_object_unref (directory->details->metafile_monitor);
|
||||
directory->details->metafile_monitor = NULL;
|
||||
g_signal_handlers_disconnect_by_func (metafile, metafile_changed_cb, directory);
|
||||
g_signal_handlers_disconnect_by_func (metafile, metafile_ready_cb, directory);
|
||||
}
|
||||
|
|
|
@ -79,5 +79,3 @@ void nautilus_directory_rename_directory_metadata (NautilusDirectory *dire
|
|||
|
||||
void nautilus_directory_register_metadata_monitor (NautilusDirectory *directory);
|
||||
void nautilus_directory_unregister_metadata_monitor (NautilusDirectory *directory);
|
||||
|
||||
void nautilus_directory_use_self_contained_metafile_factory (void);
|
||||
|
|
|
@ -24,11 +24,10 @@
|
|||
|
||||
#include <gio/gfile.h>
|
||||
#include <eel/eel-vfs-extensions.h>
|
||||
#include <libnautilus-private/nautilus-directory-metafile-monitor.h>
|
||||
#include <libnautilus-private/nautilus-directory.h>
|
||||
#include <libnautilus-private/nautilus-file-queue.h>
|
||||
#include <libnautilus-private/nautilus-file.h>
|
||||
#include <libnautilus-private/nautilus-metafile-server.h>
|
||||
#include <libnautilus-private/nautilus-metafile.h>
|
||||
#include <libnautilus-private/nautilus-monitor.h>
|
||||
#include <libnautilus-private/nautilus-idle-queue.h>
|
||||
#include <libnautilus-extension/nautilus-info-provider.h>
|
||||
|
@ -71,8 +70,8 @@ struct NautilusDirectoryDetails
|
|||
gulong mime_db_monitor;
|
||||
|
||||
NautilusIdleQueue *idle_queue;
|
||||
NautilusMetafileMonitor *metafile_monitor;
|
||||
Nautilus_Metafile metafile_corba_object;
|
||||
gboolean metafile_monitored;
|
||||
NautilusMetafile *metafile;
|
||||
|
||||
gboolean in_async_service_loop;
|
||||
gboolean state_changed;
|
||||
|
|
|
@ -190,11 +190,13 @@ nautilus_directory_finalize (GObject *object)
|
|||
nautilus_monitor_cancel (directory->details->monitor);
|
||||
}
|
||||
|
||||
if (directory->details->metafile_monitor != NULL) {
|
||||
if (directory->details->metafile_monitored) {
|
||||
nautilus_directory_unregister_metadata_monitor (directory);
|
||||
}
|
||||
|
||||
bonobo_object_release_unref (directory->details->metafile_corba_object, NULL);
|
||||
if (directory->details->metafile != NULL) {
|
||||
g_object_unref (directory->details->metafile);
|
||||
}
|
||||
|
||||
if (directory->details->dequeue_pending_idle_id != 0) {
|
||||
g_source_remove (directory->details->dequeue_pending_idle_id);
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */
|
||||
|
||||
/* nautilus-metafile.c - server side of Nautilus::MetafileFactory
|
||||
*
|
||||
* Copyright (C) 2001 Eazel, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "nautilus-metafile-factory.h"
|
||||
|
||||
#include "nautilus-metafile.h"
|
||||
#include <bonobo/bonobo-macros.h>
|
||||
#include <eel/eel-debug.h>
|
||||
|
||||
static NautilusMetafileFactory *the_factory;
|
||||
|
||||
BONOBO_CLASS_BOILERPLATE_FULL (NautilusMetafileFactory, nautilus_metafile_factory,
|
||||
Nautilus_MetafileFactory,
|
||||
BonoboObject, BONOBO_OBJECT_TYPE)
|
||||
|
||||
static void
|
||||
nautilus_metafile_factory_instance_init (NautilusMetafileFactory *factory)
|
||||
{
|
||||
}
|
||||
|
||||
static NautilusMetafileFactory *
|
||||
nautilus_metafile_factory_new (void)
|
||||
{
|
||||
return NAUTILUS_METAFILE_FACTORY
|
||||
(g_object_new (NAUTILUS_TYPE_METAFILE_FACTORY, NULL));
|
||||
}
|
||||
|
||||
static Nautilus_Metafile
|
||||
corba_open (PortableServer_Servant servant,
|
||||
const CORBA_char *directory,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
NautilusMetafile *metafile;
|
||||
|
||||
metafile = nautilus_metafile_get (directory);
|
||||
|
||||
if (!metafile) {
|
||||
return CORBA_OBJECT_NIL;
|
||||
}
|
||||
|
||||
return CORBA_Object_duplicate (BONOBO_OBJREF (metafile), ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_metafile_factory_class_init (NautilusMetafileFactoryClass *class)
|
||||
{
|
||||
class->epv.open = corba_open;
|
||||
}
|
||||
|
||||
static void
|
||||
free_factory_instance (void)
|
||||
{
|
||||
bonobo_object_unref (the_factory);
|
||||
the_factory = NULL;
|
||||
}
|
||||
|
||||
NautilusMetafileFactory *
|
||||
nautilus_metafile_factory_get_instance (void)
|
||||
{
|
||||
if (the_factory == NULL) {
|
||||
the_factory = nautilus_metafile_factory_new ();
|
||||
eel_debug_call_at_shutdown (free_factory_instance);
|
||||
}
|
||||
|
||||
return the_factory;
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */
|
||||
|
||||
/* nautilus-metafile.h - server side of Nautilus::MetafileFactory
|
||||
*
|
||||
* Copyright (C) 2001 Eazel, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef NAUTILUS_METAFILE_FACTORY_H
|
||||
#define NAUTILUS_METAFILE_FACTORY_H
|
||||
|
||||
#include <libnautilus-private/nautilus-metafile-server.h>
|
||||
|
||||
#include <bonobo/bonobo-object.h>
|
||||
|
||||
#define NAUTILUS_TYPE_METAFILE_FACTORY (nautilus_metafile_factory_get_type ())
|
||||
#define NAUTILUS_METAFILE_FACTORY(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_METAFILE_FACTORY, NautilusMetafileFactory))
|
||||
#define NAUTILUS_METAFILE_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_METAFILE_FACTORY, NautilusMetafileFactoryClass))
|
||||
#define NAUTILUS_IS_METAFILE_FACTORY(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_METAFILE_FACTORY))
|
||||
#define NAUTILUS_IS_METAFILE_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_METAFILE_FACTORY))
|
||||
|
||||
typedef struct NautilusMetafileFactoryDetails NautilusMetafileFactoryDetails;
|
||||
|
||||
typedef struct {
|
||||
BonoboObject parent_slot;
|
||||
NautilusMetafileFactoryDetails *details;
|
||||
} NautilusMetafileFactory;
|
||||
|
||||
typedef struct {
|
||||
BonoboObjectClass parent_slot;
|
||||
POA_Nautilus_MetafileFactory__epv epv;
|
||||
} NautilusMetafileFactoryClass;
|
||||
|
||||
GType nautilus_metafile_factory_get_type (void);
|
||||
|
||||
#define METAFILE_FACTORY_IID "OAFIID:Nautilus_Metafile_Factory"
|
||||
|
||||
NautilusMetafileFactory *nautilus_metafile_factory_get_instance (void);
|
||||
|
||||
#endif /* NAUTILUS_METAFILE_FACTORY_H */
|
|
@ -1,92 +0,0 @@
|
|||
/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */
|
||||
|
||||
/* nautilus-metafile-server.idl - Interface for components to access Nautilus metadata
|
||||
*
|
||||
* Copyright (C) 2001 Eazel, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef NAUTILUS_METAFILE_SERVER_IDL_INCLUDED
|
||||
#define NAUTILUS_METAFILE_SERVER_IDL_INCLUDED
|
||||
|
||||
#include <Bonobo.idl>
|
||||
|
||||
module Nautilus {
|
||||
|
||||
typedef string URI;
|
||||
typedef sequence<string> FileNameList;
|
||||
|
||||
/* NautilusFiles creates (and registers) MetafileMonitors in order
|
||||
* to get notified of metafile changes.
|
||||
*/
|
||||
interface MetafileMonitor : ::Bonobo::Unknown {
|
||||
void metafile_changed (in FileNameList file_names);
|
||||
void metafile_ready ();
|
||||
};
|
||||
|
||||
typedef sequence<string> MetadataList;
|
||||
|
||||
/* A Metafile provides access to the metadata for the files
|
||||
* in a directory.
|
||||
*
|
||||
* Note: file names within the directory are specified, by
|
||||
* strings whose special characters have been URI encoded.
|
||||
*/
|
||||
interface Metafile : ::Bonobo::Unknown {
|
||||
|
||||
/* returns whether the metadata has been read in yet */
|
||||
boolean is_read ();
|
||||
|
||||
/* getters for a file's metadata */
|
||||
string get (in string file_name,
|
||||
in string key,
|
||||
in string default_value);
|
||||
MetadataList get_list (in string file_name,
|
||||
in string list_key,
|
||||
in string list_subkey);
|
||||
|
||||
/* setters for a file's metadata */
|
||||
void set (in string file_name,
|
||||
in string key,
|
||||
in string default_value,
|
||||
in string metadata);
|
||||
void set_list (in string file_name,
|
||||
in string list_key,
|
||||
in string list_subkey,
|
||||
in MetadataList list);
|
||||
|
||||
/* calls to keep metadata in sync with file operations */
|
||||
void copy (in string source_file_name,
|
||||
in URI destination_directory_uri,
|
||||
in string destination_file_name);
|
||||
void remove (in string file_name);
|
||||
void rename (in string old_file_name,
|
||||
in string new_file_name);
|
||||
void rename_directory (in string new_directory_uri);
|
||||
|
||||
/* calls for registering a MetafileMonitor with a Metafile */
|
||||
void register_monitor (in MetafileMonitor monitor);
|
||||
void unregister_monitor (in MetafileMonitor monitor);
|
||||
};
|
||||
|
||||
/* Components use the MetafileFactory to get a Metafile for a directory. */
|
||||
interface MetafileFactory : ::Bonobo::Unknown {
|
||||
Metafile open (in URI directory);
|
||||
};
|
||||
};
|
||||
|
||||
#endif /* NAUTILUS_METAFILE_SERVER_IDL_INCLUDED */
|
File diff suppressed because it is too large
Load diff
|
@ -23,9 +23,8 @@
|
|||
#ifndef NAUTILUS_METAFILE_H
|
||||
#define NAUTILUS_METAFILE_H
|
||||
|
||||
#include <bonobo/bonobo-object.h>
|
||||
#include <glib-object.h>
|
||||
#include <libnautilus-private/nautilus-directory.h>
|
||||
#include <libnautilus-private/nautilus-metafile-server.h>
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#define NAUTILUS_TYPE_METAFILE (nautilus_metafile_get_type ())
|
||||
|
@ -34,20 +33,50 @@
|
|||
#define NAUTILUS_IS_METAFILE(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_METAFILE))
|
||||
#define NAUTILUS_IS_METAFILE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_METAFILE))
|
||||
|
||||
typedef struct NautilusMetafileDetails NautilusMetafileDetails;
|
||||
typedef struct _NautilusMetafile NautilusMetafile;
|
||||
|
||||
typedef struct {
|
||||
BonoboObject parent_slot;
|
||||
NautilusMetafileDetails *details;
|
||||
} NautilusMetafile;
|
||||
GObjectClass parent_slot;
|
||||
|
||||
typedef struct {
|
||||
BonoboObjectClass parent_slot;
|
||||
POA_Nautilus_Metafile__epv epv;
|
||||
void *(*changed) (NautilusMetafile *metafile,
|
||||
GList *files);
|
||||
void *(*ready) (NautilusMetafile *metafile);
|
||||
} NautilusMetafileClass;
|
||||
|
||||
GType nautilus_metafile_get_type (void);
|
||||
|
||||
NautilusMetafile *nautilus_metafile_get (const char *directory_uri);
|
||||
NautilusMetafile *nautilus_metafile_get_for_uri (const char *directory_uri);
|
||||
|
||||
gboolean nautilus_metafile_is_read (NautilusMetafile *metafile);
|
||||
char * nautilus_metafile_get (NautilusMetafile *metafile,
|
||||
const char *file_name,
|
||||
const char *key,
|
||||
const char *default_value);
|
||||
GList * nautilus_metafile_get_list (NautilusMetafile *metafile,
|
||||
const char *file_name,
|
||||
const char *list_key,
|
||||
const char *list_subkey);
|
||||
void nautilus_metafile_set (NautilusMetafile *metafile,
|
||||
const char *file_name,
|
||||
const char *key,
|
||||
const char *default_value,
|
||||
const char *metadata);
|
||||
void nautilus_metafile_set_list (NautilusMetafile *metafile,
|
||||
const char *file_name,
|
||||
const char *list_key,
|
||||
const char *list_subkey,
|
||||
GList *list);
|
||||
void nautilus_metafile_copy (NautilusMetafile *metafile,
|
||||
const char *source_file_name,
|
||||
const char *destination_directory_uri,
|
||||
const char *destination_file_name);
|
||||
void nautilus_metafile_remove (NautilusMetafile *metafile,
|
||||
const char *file_name);
|
||||
void nautilus_metafile_rename (NautilusMetafile *metafile,
|
||||
const char *old_file_name,
|
||||
const char *new_file_name);
|
||||
void nautilus_metafile_rename_directory (NautilusMetafile *metafile,
|
||||
const char *new_directory_uri);
|
||||
void nautilus_metafile_load (NautilusMetafile *metafile);
|
||||
|
||||
#endif /* NAUTILUS_METAFILE_H */
|
||||
|
|
|
@ -75,7 +75,6 @@
|
|||
#include <libnautilus-private/nautilus-debug-log.h>
|
||||
#include <libnautilus-private/nautilus-file-utilities.h>
|
||||
#include <libnautilus-private/nautilus-global-preferences.h>
|
||||
#include <libnautilus-private/nautilus-metafile-factory.h>
|
||||
#include <libnautilus-private/nautilus-module.h>
|
||||
#include <libnautilus-private/nautilus-undo-manager.h>
|
||||
#include <libnautilus-private/nautilus-desktop-link-monitor.h>
|
||||
|
@ -137,8 +136,6 @@ create_object (PortableServer_Servant servant,
|
|||
if (strcmp (iid, SHELL_IID) == 0) {
|
||||
application = NAUTILUS_APPLICATION (bonobo_object_from_servant (servant));
|
||||
object = BONOBO_OBJECT (nautilus_shell_new (application));
|
||||
} else if (strcmp (iid, METAFILE_FACTORY_IID) == 0) {
|
||||
object = BONOBO_OBJECT (nautilus_metafile_factory_get_instance ());
|
||||
} else {
|
||||
object = CORBA_OBJECT_NIL;
|
||||
}
|
||||
|
|
|
@ -526,8 +526,6 @@ main (int argc, char *argv[])
|
|||
#ifndef NAUTILUS_OMIT_SELF_CHECK
|
||||
/* Run the checks (each twice) for nautilus and libnautilus-private. */
|
||||
|
||||
nautilus_directory_use_self_contained_metafile_factory ();
|
||||
|
||||
nautilus_run_self_checks ();
|
||||
nautilus_run_lib_self_checks ();
|
||||
eel_exit_if_self_checks_failed ();
|
||||
|
|
|
@ -178,30 +178,34 @@ static gboolean
|
|||
nautilus_spatial_window_state_event (GtkWidget *widget,
|
||||
GdkEventWindowState *event)
|
||||
{
|
||||
if (event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED &&
|
||||
NAUTILUS_WINDOW (widget)->details->viewed_file != NULL) {
|
||||
nautilus_file_set_boolean_metadata (NAUTILUS_WINDOW (widget)->details->viewed_file,
|
||||
NAUTILUS_METADATA_KEY_WINDOW_MAXIMIZED,
|
||||
FALSE,
|
||||
event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED);
|
||||
}
|
||||
if (!NAUTILUS_IS_DESKTOP_WINDOW (widget)) {
|
||||
|
||||
if (event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED &&
|
||||
NAUTILUS_WINDOW (widget)->details->viewed_file != NULL) {
|
||||
nautilus_file_set_boolean_metadata (NAUTILUS_WINDOW (widget)->details->viewed_file,
|
||||
NAUTILUS_METADATA_KEY_WINDOW_MAXIMIZED,
|
||||
FALSE,
|
||||
event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED);
|
||||
}
|
||||
|
||||
if (event->changed_mask & GDK_WINDOW_STATE_STICKY &&
|
||||
NAUTILUS_WINDOW (widget)->details->viewed_file != NULL) {
|
||||
nautilus_file_set_boolean_metadata (NAUTILUS_WINDOW (widget)->details->viewed_file,
|
||||
NAUTILUS_METADATA_KEY_WINDOW_STICKY,
|
||||
FALSE,
|
||||
event->new_window_state & GDK_WINDOW_STATE_STICKY);
|
||||
}
|
||||
|
||||
if (event->changed_mask & GDK_WINDOW_STATE_ABOVE &&
|
||||
NAUTILUS_WINDOW (widget)->details->viewed_file != NULL) {
|
||||
nautilus_file_set_boolean_metadata (NAUTILUS_WINDOW (widget)->details->viewed_file,
|
||||
NAUTILUS_METADATA_KEY_WINDOW_KEEP_ABOVE,
|
||||
FALSE,
|
||||
event->new_window_state & GDK_WINDOW_STATE_ABOVE);
|
||||
}
|
||||
|
||||
if (event->changed_mask & GDK_WINDOW_STATE_STICKY &&
|
||||
NAUTILUS_WINDOW (widget)->details->viewed_file != NULL) {
|
||||
nautilus_file_set_boolean_metadata (NAUTILUS_WINDOW (widget)->details->viewed_file,
|
||||
NAUTILUS_METADATA_KEY_WINDOW_STICKY,
|
||||
FALSE,
|
||||
event->new_window_state & GDK_WINDOW_STATE_STICKY);
|
||||
}
|
||||
|
||||
if (event->changed_mask & GDK_WINDOW_STATE_ABOVE &&
|
||||
NAUTILUS_WINDOW (widget)->details->viewed_file != NULL) {
|
||||
nautilus_file_set_boolean_metadata (NAUTILUS_WINDOW (widget)->details->viewed_file,
|
||||
NAUTILUS_METADATA_KEY_WINDOW_KEEP_ABOVE,
|
||||
FALSE,
|
||||
event->new_window_state & GDK_WINDOW_STATE_ABOVE);
|
||||
}
|
||||
|
||||
|
||||
if (GTK_WIDGET_CLASS (nautilus_spatial_window_parent_class)->window_state_event != NULL) {
|
||||
return GTK_WIDGET_CLASS (nautilus_spatial_window_parent_class)->window_state_event (widget, event);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue