mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-07-16 10:17:23 +00:00
Just release, don't unref. (get_metafile): Don't keep a ref. Also fix
* libnautilus-private/nautilus-directory-metafile.c: (free_factory): Just release, don't unref. (get_metafile): Don't keep a ref. Also fix CORBA objref leak. * libnautilus-private/nautilus-icon-factory.c: (get_icon_from_cache): * libnautilus-private/nautilus-metafile-factory.c: (nautilus_metafile_factory_get_instance): Return the same instance each time, don't ref, since lifetime is not managed by ref counting. * libnautilus/nautilus-clipboard.c: (initialize_clipboard_component_with_callback_data): Get rid of BonoboUIComponent leak. * src/nautilus-application.c: Formatting tweaks. * libnautilus-private/nautilus-bookmark.c: Minor cleanup. * test/Makefile.am: * test/test-nautilus-async-activation.c: Remove.
This commit is contained in:
parent
57a1da0b53
commit
3035a35267
24
ChangeLog
24
ChangeLog
|
@ -1,3 +1,27 @@
|
|||
2002-02-27 Darin Adler <darin@bentspoon.com>
|
||||
|
||||
* libnautilus-private/nautilus-directory-metafile.c:
|
||||
(free_factory): Just release, don't unref.
|
||||
(get_metafile): Don't keep a ref. Also fix CORBA objref leak.
|
||||
|
||||
* libnautilus-private/nautilus-icon-factory.c:
|
||||
(get_icon_from_cache):
|
||||
|
||||
* libnautilus-private/nautilus-metafile-factory.c:
|
||||
(nautilus_metafile_factory_get_instance): Return the same
|
||||
instance each time, don't ref, since lifetime is not managed
|
||||
by ref counting.
|
||||
|
||||
* libnautilus/nautilus-clipboard.c:
|
||||
(initialize_clipboard_component_with_callback_data):
|
||||
Get rid of BonoboUIComponent leak.
|
||||
|
||||
* src/nautilus-application.c: Formatting tweaks.
|
||||
* libnautilus-private/nautilus-bookmark.c: Minor cleanup.
|
||||
|
||||
* test/Makefile.am:
|
||||
* test/test-nautilus-async-activation.c: Remove.
|
||||
|
||||
2002-02-27 Michael Meeks <michael@ximian.com>
|
||||
|
||||
* libnautilus-private/nautilus-program-choosing.c
|
||||
|
|
|
@ -61,21 +61,20 @@ struct NautilusBookmarkDetails
|
|||
|
||||
static void nautilus_bookmark_connect_file (NautilusBookmark *file);
|
||||
static void nautilus_bookmark_disconnect_file (NautilusBookmark *file);
|
||||
static void nautilus_bookmark_class_init (NautilusBookmarkClass *class);
|
||||
static void nautilus_bookmark_init (NautilusBookmark *bookmark);
|
||||
|
||||
EEL_CLASS_BOILERPLATE (NautilusBookmark, nautilus_bookmark, GTK_TYPE_OBJECT)
|
||||
GNOME_CLASS_BOILERPLATE (NautilusBookmark, nautilus_bookmark,
|
||||
GtkObject, GTK_TYPE_OBJECT)
|
||||
|
||||
/* GtkObject methods. */
|
||||
|
||||
static void
|
||||
nautilus_bookmark_destroy (GtkObject *object)
|
||||
nautilus_bookmark_finalize (GObject *object)
|
||||
{
|
||||
NautilusBookmark *bookmark;
|
||||
|
||||
g_assert (NAUTILUS_IS_BOOKMARK (object));
|
||||
|
||||
bookmark = NAUTILUS_BOOKMARK(object);
|
||||
bookmark = NAUTILUS_BOOKMARK (object);
|
||||
|
||||
nautilus_bookmark_disconnect_file (bookmark);
|
||||
|
||||
|
@ -83,8 +82,7 @@ nautilus_bookmark_destroy (GtkObject *object)
|
|||
g_free (bookmark->details->uri);
|
||||
g_free (bookmark->details);
|
||||
|
||||
/* Chain up */
|
||||
EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
/* Initialization. */
|
||||
|
@ -92,15 +90,11 @@ nautilus_bookmark_destroy (GtkObject *object)
|
|||
static void
|
||||
nautilus_bookmark_class_init (NautilusBookmarkClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
|
||||
object_class = GTK_OBJECT_CLASS (class);
|
||||
|
||||
object_class->destroy = nautilus_bookmark_destroy;
|
||||
G_OBJECT_CLASS (class)->finalize = nautilus_bookmark_finalize;
|
||||
|
||||
signals[APPEARANCE_CHANGED] =
|
||||
g_signal_new ("appearance_changed",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_TYPE_FROM_CLASS (class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (NautilusBookmarkClass, appearance_changed),
|
||||
NULL, NULL,
|
||||
|
@ -109,7 +103,7 @@ nautilus_bookmark_class_init (NautilusBookmarkClass *class)
|
|||
|
||||
signals[CONTENTS_CHANGED] =
|
||||
g_signal_new ("contents_changed",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_TYPE_FROM_CLASS (class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (NautilusBookmarkClass, contents_changed),
|
||||
NULL, NULL,
|
||||
|
@ -119,7 +113,7 @@ nautilus_bookmark_class_init (NautilusBookmarkClass *class)
|
|||
}
|
||||
|
||||
static void
|
||||
nautilus_bookmark_init (NautilusBookmark *bookmark)
|
||||
nautilus_bookmark_instance_init (NautilusBookmark *bookmark)
|
||||
{
|
||||
bookmark->details = g_new0 (NautilusBookmarkDetails, 1);
|
||||
}
|
||||
|
|
|
@ -25,14 +25,14 @@
|
|||
|
||||
#include <config.h>
|
||||
#include "nautilus-directory-metafile.h"
|
||||
#include "nautilus-directory-private.h"
|
||||
|
||||
#include "nautilus-metafile-factory.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 <eel/eel-debug.h>
|
||||
#include <eel/eel-string.h>
|
||||
#include <bonobo-activation/bonobo-activation.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static Nautilus_MetafileFactory factory = CORBA_OBJECT_NIL;
|
||||
|
@ -49,9 +49,13 @@ nautilus_directory_use_self_contained_metafile_factory (void)
|
|||
static void
|
||||
free_factory (void)
|
||||
{
|
||||
bonobo_object_release_unref (factory, NULL);
|
||||
}
|
||||
CORBA_Environment ev;
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
CORBA_Object_release (factory, &ev);
|
||||
CORBA_exception_free (&ev);
|
||||
factory = CORBA_OBJECT_NIL;
|
||||
}
|
||||
|
||||
static void
|
||||
die_on_failed_activation (const char *server_name,
|
||||
|
@ -93,22 +97,19 @@ die_on_failed_activation (const char *server_name,
|
|||
static Nautilus_MetafileFactory
|
||||
get_factory (void)
|
||||
{
|
||||
NautilusMetafileFactory *instance;
|
||||
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 {
|
||||
instance = nautilus_metafile_factory_get_instance ();
|
||||
factory = CORBA_Object_duplicate (BONOBO_OBJREF (instance), &ev);
|
||||
factory = CORBA_Object_duplicate
|
||||
(BONOBO_OBJREF (nautilus_metafile_factory_get_instance ()), &ev);
|
||||
}
|
||||
|
||||
CORBA_exception_free (&ev);
|
||||
|
@ -127,7 +128,7 @@ open_metafile (const char *uri, gboolean make_errors_fatal)
|
|||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
metafile = Nautilus_MetafileFactory_open (get_factory (), (char *) uri, &ev);
|
||||
metafile = Nautilus_MetafileFactory_open (get_factory (), uri, &ev);
|
||||
|
||||
if (ev._major != CORBA_NO_EXCEPTION) {
|
||||
metafile = CORBA_OBJECT_NIL;
|
||||
|
@ -154,7 +155,7 @@ get_metafile (NautilusDirectory *directory)
|
|||
directory->details->metafile_corba_object = open_metafile (uri, !get_factory_from_oaf);
|
||||
if (directory->details->metafile_corba_object == CORBA_OBJECT_NIL) {
|
||||
g_assert (get_factory_from_oaf);
|
||||
factory = CORBA_OBJECT_NIL;
|
||||
free_factory ();
|
||||
directory->details->metafile_corba_object = open_metafile (uri, TRUE);
|
||||
}
|
||||
|
||||
|
@ -163,27 +164,23 @@ get_metafile (NautilusDirectory *directory)
|
|||
|
||||
g_assert (directory->details->metafile_corba_object != CORBA_OBJECT_NIL);
|
||||
|
||||
return bonobo_object_dup_ref (directory->details->metafile_corba_object, NULL);
|
||||
return directory->details->metafile_corba_object;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nautilus_directory_is_metadata_read (NautilusDirectory *directory)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
Nautilus_Metafile metafile;
|
||||
|
||||
gboolean result;
|
||||
|
||||
g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), FALSE);
|
||||
|
||||
metafile = get_metafile (directory);
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
result = Nautilus_Metafile_is_read (metafile, &ev);
|
||||
result = Nautilus_Metafile_is_read (get_metafile (directory), &ev);
|
||||
|
||||
/* FIXME bugzilla.gnome.org 46664: examine ev for errors */
|
||||
CORBA_exception_free (&ev);
|
||||
bonobo_object_release_unref (metafile, NULL);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -195,11 +192,9 @@ nautilus_directory_get_file_metadata (NautilusDirectory *directory,
|
|||
const char *default_metadata)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
Nautilus_Metafile metafile;
|
||||
|
||||
char *result;
|
||||
const char *non_null_default;
|
||||
CORBA_char *corba_value;
|
||||
char *result;
|
||||
const char *non_null_default;
|
||||
CORBA_char *corba_value;
|
||||
|
||||
g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), NULL);
|
||||
g_return_val_if_fail (!eel_str_is_empty (file_name), NULL);
|
||||
|
@ -208,14 +203,12 @@ nautilus_directory_get_file_metadata (NautilusDirectory *directory,
|
|||
/* We can't pass NULL as a CORBA_string - pass "" instead. */
|
||||
non_null_default = default_metadata != NULL ? default_metadata : "";
|
||||
|
||||
metafile = get_metafile (directory);
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
corba_value = Nautilus_Metafile_get (metafile, file_name, key, non_null_default, &ev);
|
||||
corba_value = Nautilus_Metafile_get (get_metafile (directory), file_name, key, non_null_default, &ev);
|
||||
|
||||
/* FIXME bugzilla.gnome.org 46664: examine ev for errors */
|
||||
CORBA_exception_free (&ev);
|
||||
bonobo_object_release_unref (metafile, NULL);
|
||||
|
||||
if (eel_str_is_empty (corba_value)) {
|
||||
/* Even though in all other respects we treat "" as NULL, we want to
|
||||
|
@ -237,9 +230,7 @@ nautilus_directory_get_file_metadata_list (NautilusDirectory *directory,
|
|||
const char *list_key,
|
||||
const char *list_subkey)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
Nautilus_Metafile metafile;
|
||||
|
||||
CORBA_Environment ev;
|
||||
GList *result;
|
||||
Nautilus_MetadataList *corba_value;
|
||||
CORBA_unsigned_long buf_pos;
|
||||
|
@ -249,14 +240,12 @@ nautilus_directory_get_file_metadata_list (NautilusDirectory *directory,
|
|||
g_return_val_if_fail (!eel_str_is_empty (list_key), NULL);
|
||||
g_return_val_if_fail (!eel_str_is_empty (list_subkey), NULL);
|
||||
|
||||
metafile = get_metafile (directory);
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
corba_value = Nautilus_Metafile_get_list (metafile, file_name, list_key, list_subkey, &ev);
|
||||
corba_value = Nautilus_Metafile_get_list (get_metafile (directory), file_name, list_key, list_subkey, &ev);
|
||||
|
||||
/* FIXME bugzilla.gnome.org 46664: examine ev for errors */
|
||||
CORBA_exception_free (&ev);
|
||||
bonobo_object_release_unref (metafile, NULL);
|
||||
|
||||
result = NULL;
|
||||
for (buf_pos = 0; buf_pos < corba_value->_length; ++buf_pos) {
|
||||
|
@ -276,7 +265,6 @@ nautilus_directory_set_file_metadata (NautilusDirectory *directory,
|
|||
const char *metadata)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
Nautilus_Metafile metafile;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
|
||||
g_return_if_fail (!eel_str_is_empty (file_name));
|
||||
|
@ -291,14 +279,12 @@ nautilus_directory_set_file_metadata (NautilusDirectory *directory,
|
|||
metadata = "";
|
||||
}
|
||||
|
||||
metafile = get_metafile (directory);
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
Nautilus_Metafile_set (metafile, file_name, key, default_metadata, metadata, &ev);
|
||||
Nautilus_Metafile_set (get_metafile (directory), file_name, key, default_metadata, metadata, &ev);
|
||||
|
||||
/* FIXME bugzilla.gnome.org 46664: examine ev for errors */
|
||||
CORBA_exception_free (&ev);
|
||||
bonobo_object_release_unref (metafile, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -309,7 +295,6 @@ nautilus_directory_set_file_metadata_list (NautilusDirectory *directory,
|
|||
GList *list)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
Nautilus_Metafile metafile;
|
||||
|
||||
Nautilus_MetadataList *corba_list;
|
||||
int len;
|
||||
|
@ -341,14 +326,12 @@ nautilus_directory_set_file_metadata_list (NautilusDirectory *directory,
|
|||
++buf_pos;
|
||||
}
|
||||
|
||||
metafile = get_metafile (directory);
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
Nautilus_Metafile_set_list (metafile, file_name, list_key, list_subkey, corba_list, &ev);
|
||||
Nautilus_Metafile_set_list (get_metafile (directory), file_name, list_key, list_subkey, corba_list, &ev);
|
||||
|
||||
/* FIXME bugzilla.gnome.org 46664: examine ev for errors */
|
||||
CORBA_exception_free (&ev);
|
||||
bonobo_object_release_unref (metafile, NULL);
|
||||
|
||||
CORBA_free (corba_list);
|
||||
}
|
||||
|
@ -453,8 +436,7 @@ nautilus_directory_copy_file_metadata (NautilusDirectory *source_directory,
|
|||
const char *destination_file_name)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
Nautilus_Metafile source_metafile;
|
||||
char* destination_uri;
|
||||
char *destination_uri;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_DIRECTORY (source_directory));
|
||||
g_return_if_fail (source_file_name != NULL);
|
||||
|
@ -463,14 +445,13 @@ nautilus_directory_copy_file_metadata (NautilusDirectory *source_directory,
|
|||
|
||||
destination_uri = nautilus_directory_get_uri (destination_directory);
|
||||
|
||||
source_metafile = get_metafile (source_directory);
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
Nautilus_Metafile_copy (source_metafile, source_file_name, destination_uri, destination_file_name, &ev);
|
||||
Nautilus_Metafile_copy (get_metafile (source_directory), source_file_name,
|
||||
destination_uri, destination_file_name, &ev);
|
||||
|
||||
/* FIXME bugzilla.gnome.org 46664: examine ev for errors */
|
||||
CORBA_exception_free (&ev);
|
||||
bonobo_object_release_unref (source_metafile, NULL);
|
||||
|
||||
g_free (destination_uri);
|
||||
}
|
||||
|
@ -480,19 +461,16 @@ nautilus_directory_remove_file_metadata (NautilusDirectory *directory,
|
|||
const char *file_name)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
Nautilus_Metafile metafile;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
|
||||
g_return_if_fail (file_name != NULL);
|
||||
|
||||
metafile = get_metafile (directory);
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
Nautilus_Metafile_remove (metafile, file_name, &ev);
|
||||
Nautilus_Metafile_remove (get_metafile (directory), file_name, &ev);
|
||||
|
||||
/* FIXME bugzilla.gnome.org 46664: examine ev for errors */
|
||||
CORBA_exception_free (&ev);
|
||||
bonobo_object_release_unref (metafile, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -501,20 +479,17 @@ nautilus_directory_rename_file_metadata (NautilusDirectory *directory,
|
|||
const char *new_file_name)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
Nautilus_Metafile 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);
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
Nautilus_Metafile_rename (metafile, old_file_name, new_file_name, &ev);
|
||||
Nautilus_Metafile_rename (get_metafile (directory), old_file_name, new_file_name, &ev);
|
||||
|
||||
/* FIXME bugzilla.gnome.org 46664: examine ev for errors */
|
||||
CORBA_exception_free (&ev);
|
||||
bonobo_object_release_unref (metafile, &ev);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -522,26 +497,22 @@ nautilus_directory_rename_directory_metadata (NautilusDirectory *directory,
|
|||
const char *new_directory_uri)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
Nautilus_Metafile metafile;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
|
||||
g_return_if_fail (new_directory_uri != NULL);
|
||||
|
||||
metafile = get_metafile (directory);
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
Nautilus_Metafile_rename_directory (metafile, new_directory_uri, &ev);
|
||||
Nautilus_Metafile_rename_directory (get_metafile (directory), new_directory_uri, &ev);
|
||||
|
||||
/* FIXME bugzilla.gnome.org 46664: examine ev for errors */
|
||||
CORBA_exception_free (&ev);
|
||||
bonobo_object_release_unref (metafile, &ev);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_directory_register_metadata_monitor (NautilusDirectory *directory)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
Nautilus_Metafile metafile;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
|
||||
|
||||
|
@ -552,42 +523,35 @@ nautilus_directory_register_metadata_monitor (NautilusDirectory *directory)
|
|||
|
||||
directory->details->metafile_monitor = nautilus_metafile_monitor_new (directory);
|
||||
|
||||
metafile = get_metafile (directory);
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
Nautilus_Metafile_register_monitor
|
||||
(metafile,
|
||||
(get_metafile (directory),
|
||||
BONOBO_OBJREF (directory->details->metafile_monitor),
|
||||
&ev);
|
||||
|
||||
/* FIXME bugzilla.gnome.org 46664: examine ev for errors */
|
||||
CORBA_exception_free (&ev);
|
||||
bonobo_object_release_unref (metafile, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_directory_unregister_metadata_monitor (NautilusDirectory *directory)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
Nautilus_Metafile metafile;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
|
||||
g_return_if_fail (NAUTILUS_IS_METAFILE_MONITOR (directory->details->metafile_monitor));
|
||||
|
||||
metafile = get_metafile (directory);
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
Nautilus_Metafile_unregister_monitor
|
||||
(metafile,
|
||||
(get_metafile (directory),
|
||||
BONOBO_OBJREF (directory->details->metafile_monitor),
|
||||
&ev);
|
||||
|
||||
/* FIXME bugzilla.gnome.org 46664: examine ev for errors */
|
||||
CORBA_exception_free (&ev);
|
||||
bonobo_object_release_unref (metafile, NULL);
|
||||
|
||||
bonobo_object_unref (directory->details->metafile_monitor);
|
||||
directory->details->metafile_monitor = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1950,8 +1950,9 @@ get_icon_from_cache (NautilusScalableIcon *scalable_icon,
|
|||
key->scalable_icon = scalable_icon;
|
||||
key->size = *size;
|
||||
|
||||
/* recursive get_icon_from_cache might already have placed icon
|
||||
* in hash table if there was an exact match */
|
||||
/* Recursive get_icon_from_cache might already have placed icon
|
||||
* in hash table if there was an exact match.
|
||||
*/
|
||||
if (g_hash_table_lookup (hash_table, key) != NULL) {
|
||||
g_free (key);
|
||||
return icon;
|
||||
|
@ -1960,7 +1961,6 @@ get_icon_from_cache (NautilusScalableIcon *scalable_icon,
|
|||
/* Add the item to the hash table. */
|
||||
nautilus_scalable_icon_ref (scalable_icon);
|
||||
g_hash_table_insert (hash_table, key, icon);
|
||||
|
||||
}
|
||||
|
||||
/* Hand back a ref to the caller. */
|
||||
|
|
|
@ -22,15 +22,12 @@
|
|||
|
||||
#include <config.h>
|
||||
#include "nautilus-metafile-factory.h"
|
||||
|
||||
#include "nautilus-metafile.h"
|
||||
|
||||
#include <bonobo/bonobo-macros.h>
|
||||
#include <eel/eel-debug.h>
|
||||
#include <eel/eel-gtk-macros.h>
|
||||
#include "nautilus-bonobo-extensions.h"
|
||||
|
||||
struct NautilusMetafileFactoryDetails {
|
||||
char dummy; /* ANSI C does not allow empty structs */
|
||||
};
|
||||
static NautilusMetafileFactory *the_factory;
|
||||
|
||||
BONOBO_CLASS_BOILERPLATE_FULL (NautilusMetafileFactory, nautilus_metafile_factory,
|
||||
Nautilus_MetafileFactory,
|
||||
|
@ -39,32 +36,34 @@ BONOBO_CLASS_BOILERPLATE_FULL (NautilusMetafileFactory, nautilus_metafile_factor
|
|||
static void
|
||||
nautilus_metafile_factory_instance_init (NautilusMetafileFactory *factory)
|
||||
{
|
||||
factory->details = g_new0 (NautilusMetafileFactoryDetails, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
NautilusMetafileFactory *factory;
|
||||
|
||||
factory = NAUTILUS_METAFILE_FACTORY (object);
|
||||
g_free (factory->details);
|
||||
|
||||
EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
|
||||
}
|
||||
|
||||
static NautilusMetafileFactory *
|
||||
nautilus_metafile_factory_new (void)
|
||||
{
|
||||
NautilusMetafileFactory *metafile_factory;
|
||||
|
||||
metafile_factory = NAUTILUS_METAFILE_FACTORY (
|
||||
g_object_new (NAUTILUS_TYPE_METAFILE_FACTORY, NULL));
|
||||
|
||||
return metafile_factory;
|
||||
return NAUTILUS_METAFILE_FACTORY
|
||||
(g_object_new (NAUTILUS_TYPE_METAFILE_FACTORY, NULL));
|
||||
}
|
||||
|
||||
static NautilusMetafileFactory *the_factory;
|
||||
static Nautilus_Metafile
|
||||
corba_open (PortableServer_Servant servant,
|
||||
const CORBA_char *directory,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
NautilusMetafile *metafile;
|
||||
Nautilus_Metafile objref;
|
||||
|
||||
metafile = nautilus_metafile_get (directory);
|
||||
objref = bonobo_object_dup_ref (BONOBO_OBJREF (metafile), NULL);
|
||||
bonobo_object_unref (metafile);
|
||||
return objref;
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_metafile_factory_class_init (NautilusMetafileFactoryClass *class)
|
||||
{
|
||||
class->epv.open = corba_open;
|
||||
}
|
||||
|
||||
static void
|
||||
free_factory_instance (void)
|
||||
|
@ -81,25 +80,5 @@ nautilus_metafile_factory_get_instance (void)
|
|||
eel_debug_call_at_shutdown (free_factory_instance);
|
||||
}
|
||||
|
||||
return bonobo_object_ref (the_factory);
|
||||
}
|
||||
|
||||
static Nautilus_Metafile
|
||||
corba_open (PortableServer_Servant servant,
|
||||
const CORBA_char *directory,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
NautilusMetafile *metafile;
|
||||
|
||||
metafile = nautilus_metafile_get (directory);
|
||||
|
||||
return CORBA_Object_duplicate (BONOBO_OBJREF (metafile), ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_metafile_factory_class_init (NautilusMetafileFactoryClass *klass)
|
||||
{
|
||||
G_OBJECT_CLASS (klass)->finalize = finalize;
|
||||
|
||||
klass->epv.open = corba_open;
|
||||
return the_factory;
|
||||
}
|
||||
|
|
|
@ -368,7 +368,6 @@ initialize_clipboard_component_with_callback_data (GtkEditable *target,
|
|||
* time.
|
||||
*/
|
||||
target_data = g_new (TargetCallbackData, 1);
|
||||
bonobo_object_ref (ui);
|
||||
target_data->component = ui;
|
||||
target_data->container = bonobo_object_dup_ref (ui_container, NULL);
|
||||
target_data->editable_shares_selection_changes =
|
||||
|
|
|
@ -122,7 +122,7 @@ create_object (PortableServer_Servant servant,
|
|||
} else if (strcmp (iid, METAFILE_FACTORY_IID) == 0) {
|
||||
object = BONOBO_OBJECT (nautilus_metafile_factory_get_instance ());
|
||||
} else {
|
||||
return CORBA_OBJECT_NIL;
|
||||
object = CORBA_OBJECT_NIL;
|
||||
}
|
||||
|
||||
return CORBA_Object_duplicate (BONOBO_OBJREF (object), ev);
|
||||
|
@ -141,16 +141,12 @@ nautilus_application_instance_init (NautilusApplication *application)
|
|||
application->undo_manager = nautilus_undo_manager_new ();
|
||||
|
||||
/* Watch for volume mounts so we can restore open windows */
|
||||
g_signal_connect (nautilus_volume_monitor_get (),
|
||||
"volume_mounted",
|
||||
G_CALLBACK (volume_mounted_callback),
|
||||
application);
|
||||
g_signal_connect (nautilus_volume_monitor_get (), "volume_mounted",
|
||||
G_CALLBACK (volume_mounted_callback), application);
|
||||
|
||||
/* Watch for volume unmounts so we can close open windows */
|
||||
g_signal_connect (nautilus_volume_monitor_get (),
|
||||
"volume_unmounted",
|
||||
G_CALLBACK (volume_unmounted_callback),
|
||||
application);
|
||||
g_signal_connect (nautilus_volume_monitor_get (), "volume_unmounted",
|
||||
G_CALLBACK (volume_unmounted_callback), application);
|
||||
}
|
||||
|
||||
NautilusApplication *
|
||||
|
@ -417,8 +413,8 @@ nautilus_application_startup (NautilusApplication *application,
|
|||
/* Start up the factory. */
|
||||
while (TRUE) {
|
||||
/* Try to register the file manager view factory. */
|
||||
result = bonobo_activation_active_server_register (
|
||||
FACTORY_IID, BONOBO_OBJREF (application));
|
||||
result = bonobo_activation_active_server_register
|
||||
(FACTORY_IID, BONOBO_OBJREF (application));
|
||||
|
||||
switch (result) {
|
||||
case Bonobo_ACTIVATION_REG_SUCCESS:
|
||||
|
|
|
@ -15,7 +15,6 @@ LDADD =\
|
|||
$(NULL)
|
||||
|
||||
noinst_PROGRAMS =\
|
||||
test-nautilus-async-activation \
|
||||
test-nautilus-mime-actions \
|
||||
test-nautilus-mime-actions-set \
|
||||
test-nautilus-preferences-change \
|
||||
|
@ -23,7 +22,6 @@ noinst_PROGRAMS =\
|
|||
test-nautilus-wrap-table \
|
||||
$(NULL)
|
||||
|
||||
test_nautilus_async_activation_SOURCES = test-nautilus-async-activation.c test.c
|
||||
test_nautilus_mime_actions_SOURCES = test-nautilus-mime-actions.c test.c
|
||||
test_nautilus_mime_actions_set_SOURCES = test-nautilus-mime-actions-set.c test.c
|
||||
test_nautilus_preferences_change_SOURCES = test-nautilus-preferences-change.c test.c
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||
/*
|
||||
Copyright (C) 2000 Eazel
|
||||
|
||||
The Gnome 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.
|
||||
|
||||
The Gnome 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 the Gnome Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
|
||||
Author: Mathieu Lacage <mathieu@eazel.com>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <libnautilus-private/nautilus-bonobo-extensions.h>
|
||||
#include <libbonoboui.h>
|
||||
|
||||
#define IID "OAFIID:bonobo_calculator:fab8c2a7-9576-437c-aa3a-a8617408970f"
|
||||
|
||||
static void
|
||||
activation_callback (NautilusBonoboActivationHandle *handle,
|
||||
Bonobo_Unknown activated_object,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *control;
|
||||
|
||||
window = GTK_WIDGET (callback_data);
|
||||
|
||||
if (activated_object == CORBA_OBJECT_NIL) {
|
||||
g_print ("activation failed\n");
|
||||
} else {
|
||||
control = bonobo_widget_new_control_from_objref (activated_object,
|
||||
CORBA_OBJECT_NIL);
|
||||
gtk_container_add (GTK_CONTAINER (window), control);
|
||||
gtk_widget_show (GTK_WIDGET (control));
|
||||
|
||||
g_print ("activation suceeded\n");
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
NautilusBonoboActivationHandle *handle;
|
||||
|
||||
bonobo_ui_init ("test-nautilus-activation-async",
|
||||
"1.0", &argc, argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
g_signal_connect (window, "destroy",
|
||||
gtk_main_quit, NULL);
|
||||
gtk_widget_show_all (GTK_WIDGET (window));
|
||||
|
||||
|
||||
handle = nautilus_bonobo_activate_from_id (IID, activation_callback, window);
|
||||
#if 0
|
||||
nautilus_bonobo_activate_stop (handle);
|
||||
#endif
|
||||
bonobo_main ();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue