[Nautilus-list] adapter port
- From: Dave Camp <dave ximian com>
- To: nautilus-list eazel com
- Subject: [Nautilus-list] adapter port
- Date: 04 Jan 2002 14:42:20 -0500
This patch ports the adapter component, minus the embeddable and
progressive data sink strategies. It also ports/re-enables the code in
nautilus-component-adapter-factory.c.
-dave
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.4886
diff -u -r1.4886 ChangeLog
--- ChangeLog 2002/01/03 22:48:22 1.4886
+++ ChangeLog 2002/01/04 19:27:28
@@ -1,3 +1,76 @@
+2002-01-04 Dave Camp <dave ximian com>
+
+ * components/adapter/nautilus-zoomable-proxy.c
+ (nautilus_zoomable_prozy_init_epv): Renamed from
+ nautilus_get_modified_bonobo_zoomable_epv and changed to
+ initialize a passed in epv rather than allocating a new one.
+ (nautilus_zoomable_proxy_destroy):
+ (nautilus_zoomable_proxy_finalize):
+ (nautilus_zoomable_proxy_class_init):
+ (nautilus_zoomable_proxy_get):
+ (nautilus_zoomable_proxy_get_type): Derive from BonoboObject rather
+ than BonoboZoomable, as this object fully implements the Zoomable
+ interface.
+
+ * components/adapter/nautilus-adapter.c (nautilus_adapter_new):
+ Replaced gtk_signal_connect_object with g_signal_connect_swapped,
+ cast callbacks to G_CALLBACK, and use a weak reference rather than
+ a "destroy" handler.
+ (nautilus_adapter_activate_callback): Pass NULL as the opt_ev
+ parameter to bonobo_control_get_remote_ui_container().
+
+ * components/adapter/nautilus-adapter-stream-load-strategy.c
+ (nautilus_adapter_stream_load_strategy_load_location): The
+ bonobo-stream-vfs code was moved to the VFS moniker in gnome-vfs,
+ so use it here.
+
+ * components/adapter/nautilus-adapter-load-strategy.c
+ (nautilus_adapter_load_strategy_class_init): replaced
+ eel_marshal_VOID__DOUBLE with g_cclosure_marshal_VOID__DOUBLE.
+ (nautilus_adapter_load_strategy_get): Disabled the progressive
+ data sink code using GNOME2_CONVERSION_COMPLETE.
+
+ * components/adapter/nautilus-adapter-factory-server.c (nautilus_adapter_factory_server_class_init):
+ (nautilus_adapter_factory_server_init):
+ (nautilus_adapter_factory_server_finalize):
+ (adapter_object_destroyed):
+ (impl_Nautilus_ComponentAdapterFactory_create_adapter):
+ (nautilus_adapter_factory_server_get_type): Changed to the new
+ style of deriving from BonoboObject.
+ (impl_Nautilus_ComponentAdapterFactory_create_adapter): Use a weak
+ reference to the adapter view rather than connecting to "destroy".
+
+ * components/adapter/nautilus-adapter-embed-strategy.c (nautilus_adapter_embed_strategy_class_init): Fixed the argument type lists for the
+ activate and open_location signals.
+ (nautilus_adapter_embed_strategy_get): Disable use of the embeddable
+ embed strategy using GNOME2_CONVERSION_COMPLETE.
+
+ * components/adapter/nautilus-adapter-control-embed-strategy.c
+ (nautilus_adapter_control_embed_strategy_new): Pass NULL for the
+ opt_ev parameter of bonobo_control_frame_bind_to_control().
+
+ * components/adapter/main.c (main): Replaced initialization
+ functions with bonobo_ui_init, and put an #ifdef
+ GNOME2_CONVERSION_COMPLETE around
+ gnome_client_disable_master_connect().
+ (adapter_factory_make_object): Use a weak reference rather than a
+ destroy signal handler.
+ (adapter_factory_object_weak_notify): Moved here from
+ adapter_factory_object_destroy, use bonobo_main_quit() rather than
+ gtk_main_quit().
+
+ * components/adapter/Makefile.am: Removed
+ nautilus-adapter-progressive-load-strategy.[ch], and moved
+ nautilus-adapter-embeddable-embed-strategy.[ch] out of the build,
+ removed bonobo-stream-vfs.[ch] replaced
+ NAUTILUS_PRIVATE_CFLAGS/LIBS with COMPONENT_CFLAGS/LIBS.
+
+ * src/nautilus-component-adapter-factory.c: Removed
+ no-longer-necessary #if GNOME2_CONVERSION_COMPLETE lines.
+ (activate_factory): Replaced BonoboObjectClient code with a call to
+ bonobo_get_object().
+
+
2002-01-03 Darin Adler <darin bentspoon com>
* TODO: Updated.
Index: components/Makefile.am
===================================================================
RCS file: /cvs/gnome/nautilus/components/Makefile.am,v
retrieving revision 1.35
diff -u -r1.35 Makefile.am
--- components/Makefile.am 2001/12/13 23:37:38 1.35
+++ components/Makefile.am 2002/01/04 19:27:28
@@ -1,6 +1,7 @@
NULL=
SUBDIRS = \
+ adapter \
history \
image-viewer \
news \
@@ -11,7 +12,6 @@
$(NULL)
XXX=
- adapter \
hardware \
loser \
music \
Index: components/adapter/Makefile.am
===================================================================
RCS file: /cvs/gnome/nautilus/components/adapter/Makefile.am,v
retrieving revision 1.18
diff -u -r1.18 Makefile.am
--- components/adapter/Makefile.am 2001/11/09 01:09:25 1.18
+++ components/adapter/Makefile.am 2002/01/04 19:27:28
@@ -4,7 +4,7 @@
-DG_LOG_DOMAIN=\"Nautilus-Adapter\" \
-DICON_DIR=\"$(datadir)/pixmaps/nautilus\" \
-I$(top_srcdir) \
- $(NAUTILUS_PRIVATE_CFLAGS) \
+ $(COMPONENT_CFLAGS) \
$(NULL)
serverdir = $(libdir)/bonobo/servers
@@ -22,15 +22,11 @@
nautilus_adapter_SOURCES = \
main.c \
- bonobo-stream-vfs.c \
- bonobo-stream-vfs.h \
nautilus-adapter-control-embed-strategy.c \
nautilus-adapter-control-embed-strategy.h \
nautilus-adapter-embed-strategy-private.h \
nautilus-adapter-embed-strategy.c \
nautilus-adapter-embed-strategy.h \
- nautilus-adapter-embeddable-embed-strategy.c \
- nautilus-adapter-embeddable-embed-strategy.h \
nautilus-adapter-factory-server.c \
nautilus-adapter-factory-server.h \
nautilus-adapter-file-load-strategy.c \
@@ -38,8 +34,6 @@
nautilus-adapter-load-strategy.c \
nautilus-adapter-load-strategy.h \
nautilus-adapter-load-strategy.h \
- nautilus-adapter-progressive-load-strategy.c \
- nautilus-adapter-progressive-load-strategy.h \
nautilus-adapter-stream-load-strategy.c \
nautilus-adapter-stream-load-strategy.h \
nautilus-zoomable-proxy.c \
@@ -48,11 +42,15 @@
nautilus-adapter.h \
$(NULL)
+XXX = \
+ nautilus-adapter-embeddable-embed-strategy.c \
+ nautilus-adapter-embeddable-embed-strategy.h \
+ $(NULL)
+
nautilus_adapter_LDADD = \
$(top_builddir)/libnautilus/libnautilus.la \
$(top_builddir)/libnautilus-adapter/libnautilus-adapter.la \
- $(NAUTILUS_PRIVATE_LIBS) \
+ $(COMPONENT_LIBS) \
$(NULL)
EXTRA_DIST = $(server_in_files) $(server_DATA)
-
Index: components/adapter/main.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/adapter/main.c,v
retrieving revision 1.14
diff -u -r1.14 main.c
--- components/adapter/main.c 2001/12/07 00:54:06 1.14
+++ components/adapter/main.c 2002/01/04 19:27:28
@@ -29,8 +29,7 @@
#include <libgnome/gnome-init.h> /* must come before liboaf.h */
#include "nautilus-adapter-factory-server.h"
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-main.h>
+#include <bonobo.h>
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
#include <libgnomevfs/gnome-vfs-init.h>
@@ -38,19 +37,19 @@
#include <bonobo-activation/bonobo-activation.h>
#include <stdlib.h>
+#include <string.h>
+
#define META_FACTORY_IID "OAFIID:nautilus_adapter_factory_generic_factory:8e62e106-807d-4d37-b14a-00dc82ecf88f"
#define FACTORY_OBJECT_IID "OAFIID:nautilus_adapter_factory:fd24ecfc-0a6e-47ab-bc53-69d7487c6ad4"
static int object_count = 0;
static void
-adapter_factory_object_destroyed (GtkObject *object)
+adapter_factory_object_weak_notify (gpointer data, GObject *object)
{
- g_assert (GTK_IS_OBJECT (object));
-
object_count--;
if (object_count <= 0) {
- gtk_main_quit ();
+ bonobo_main_quit ();
}
}
@@ -78,8 +77,9 @@
* when there are no more objects outstanding.
*/
object_count++;
- g_signal_connect (adapter, "destroy",
- adapter_factory_object_destroyed, NULL);
+ g_object_weak_ref (G_OBJECT (adapter),
+ (GWeakNotify)adapter_factory_object_weak_notify,
+ NULL);
return BONOBO_OBJECT (adapter);
}
@@ -87,7 +87,6 @@
int
main (int argc, char *argv[])
{
- CORBA_ORB orb;
BonoboGenericFactory *factory;
char *registration_id;
@@ -95,26 +94,24 @@
eel_make_warnings_and_criticals_stop_in_debugger ();
}
+#ifdef GNOME2_CONVERSION_COMPLETE
/* Disable session manager connection */
gnome_client_disable_master_connection ();
+#endif
- gnomelib_register_popt_table (bonobo_activation_popt_options, bonobo_activation_get_popt_table_name ());
- orb = bonobo_activation_init (argc, argv);
-
- /* Initialize libraries. */
- gnome_init ("nautilus-adapter", VERSION,
- argc, argv);
- g_thread_init (NULL);
- gnome_vfs_init ();
- bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
+ if (!bonobo_ui_init ("nautilus-adapter", VERSION, &argc, argv)) {
+ g_error (_("I could not initialize Bonobo"));
+ }
/* Create the factory. */
registration_id = bonobo_activation_make_registration_id (META_FACTORY_IID, g_getenv ("DISPLAY"));
- factory = bonobo_generic_factory_new_multi (registration_id, adapter_factory_make_object, NULL);
+ factory = bonobo_generic_factory_new (registration_id, adapter_factory_make_object, NULL);
+#ifdef GNOME2_CONVERSION_COMPLETE
g_free (registration_id);
+#endif
/* Loop until we have no more objects. */
do {
Index: components/adapter/nautilus-adapter-control-embed-strategy.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/adapter/nautilus-adapter-control-embed-strategy.c,v
retrieving revision 1.18
diff -u -r1.18 nautilus-adapter-control-embed-strategy.c
--- components/adapter/nautilus-adapter-control-embed-strategy.c 2001/12/07 00:54:07 1.18
+++ components/adapter/nautilus-adapter-control-embed-strategy.c 2002/01/04 19:27:28
@@ -38,6 +38,7 @@
#include <gtk/gtksignal.h>
#include <eel/eel-gtk-macros.h>
#include <bonobo/bonobo-control.h>
+#include <bonobo/bonobo-control-frame.h>
struct NautilusAdapterControlEmbedStrategyDetails {
@@ -162,7 +163,7 @@
strategy->details->control_frame = bonobo_control_frame_new (ui_container);
- bonobo_control_frame_bind_to_control (strategy->details->control_frame, control);
+ bonobo_control_frame_bind_to_control (strategy->details->control_frame, control, NULL);
strategy->details->widget = bonobo_control_frame_get_widget (strategy->details->control_frame);
Index: components/adapter/nautilus-adapter-embed-strategy.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/adapter/nautilus-adapter-embed-strategy.c,v
retrieving revision 1.14
diff -u -r1.14 nautilus-adapter-embed-strategy.c
--- components/adapter/nautilus-adapter-embed-strategy.c 2001/11/09 02:05:14 1.14
+++ components/adapter/nautilus-adapter-embed-strategy.c 2002/01/04 19:27:28
@@ -72,7 +72,7 @@
G_STRUCT_OFFSET (NautilusAdapterEmbedStrategyClass, activate),
NULL, NULL,
gtk_marshal_VOID__POINTER,
- G_TYPE_POINTER, 0);
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
signals[DEACTIVATE] =
g_signal_new ("deactivate",
G_TYPE_FROM_CLASS (object_class),
@@ -88,7 +88,7 @@
G_STRUCT_OFFSET (NautilusAdapterEmbedStrategyClass, open_location),
NULL, NULL,
g_cclosure_marshal_VOID__STRING,
- G_TYPE_STRING, 0);
+ G_TYPE_NONE, 1, G_TYPE_STRING);
EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, nautilus_adapter_embed_strategy, get_widget);
EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, nautilus_adapter_embed_strategy, get_zoomable);
@@ -103,7 +103,9 @@
nautilus_adapter_embed_strategy_get (Bonobo_Unknown component)
{
Bonobo_Control control;
+#if GNOME2_CONVERSION_COMPLETE
Bonobo_Embeddable embeddable;
+#endif
CORBA_Environment ev;
NautilusAdapterEmbedStrategy *strategy;
@@ -119,6 +121,7 @@
bonobo_object_release_unref (control, NULL);
}
+#if GNOME2_CONVERSION_COMPLETE
if (strategy != NULL) {
embeddable = Bonobo_Unknown_queryInterface
(component, "IDL:Bonobo/Embeddable:1.0", &ev);
@@ -128,6 +131,7 @@
bonobo_object_release_unref (embeddable, NULL);
}
}
+#endif
CORBA_exception_free (&ev);
Index: components/adapter/nautilus-adapter-factory-server.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/adapter/nautilus-adapter-factory-server.c,v
retrieving revision 1.13
diff -u -r1.13 nautilus-adapter-factory-server.c
--- components/adapter/nautilus-adapter-factory-server.c 2001/11/09 02:05:14 1.13
+++ components/adapter/nautilus-adapter-factory-server.c 2002/01/04 19:27:28
@@ -44,34 +44,27 @@
const Bonobo_Unknown component,
CORBA_Environment *ev);
-static void
-impl_Nautilus_ComponentAdapterFactory__destroy (BonoboObject *object,
- PortableServer_Servant servant);
-
-static Nautilus_ComponentAdapterFactory
-impl_Nautilus_ComponentAdapterFactory__create (NautilusAdapterFactoryServer *bonobo_object,
- CORBA_Environment *ev);
-
-
static void nautilus_adapter_factory_server_class_init (NautilusAdapterFactoryServerClass *klass);
static void nautilus_adapter_factory_server_init (NautilusAdapterFactoryServer *server);
-static void nautilus_adapter_factory_server_destroy (GtkObject *object);
+static void nautilus_adapter_factory_server_finalize (GObject *object);
+static BonoboObjectClass *parent_class;
-EEL_CLASS_BOILERPLATE (NautilusAdapterFactoryServer,
- nautilus_adapter_factory_server,
- BONOBO_OBJECT_TYPE)
static void
nautilus_adapter_factory_server_class_init (NautilusAdapterFactoryServerClass *klass)
{
- GtkObjectClass *object_class;
-
+ GObjectClass *object_class;
+ POA_Nautilus_ComponentAdapterFactory__epv *epv = &klass->epv;
+
g_assert (NAUTILUS_IS_ADAPTER_FACTORY_SERVER_CLASS (klass));
- object_class = GTK_OBJECT_CLASS (klass);
-
- object_class->destroy = nautilus_adapter_factory_server_destroy;
+ parent_class = g_type_class_peek_parent (klass);
+
+ epv->create_adapter = impl_Nautilus_ComponentAdapterFactory_create_adapter;
+
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = nautilus_adapter_factory_server_finalize;
}
static void
@@ -83,21 +76,18 @@
g_assert (NAUTILUS_IS_ADAPTER_FACTORY_SERVER (server));
- bonobo_object_construct
- (BONOBO_OBJECT (server),
- impl_Nautilus_ComponentAdapterFactory__create (server, &ev));
-
CORBA_exception_free (&ev);
}
static void
-nautilus_adapter_factory_server_destroy (GtkObject *object)
+nautilus_adapter_factory_server_finalize (GObject *object)
{
- EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
+ EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
}
static void
-adapter_object_destroyed (GtkObject *adapter, NautilusAdapterFactoryServer *server)
+adapter_object_weak_notify (NautilusAdapterFactoryServer *server,
+ GObject *adapter)
{
bonobo_object_unref (BONOBO_OBJECT (server));
}
@@ -108,65 +98,55 @@
const Bonobo_Unknown component,
CORBA_Environment *ev)
{
- impl_POA_Nautilus_ComponentAdapterFactory *factory_servant;
+ NautilusAdapterFactoryServer *factory_servant;
NautilusAdapter *adapter;
NautilusView *adapter_view;
- factory_servant = (impl_POA_Nautilus_ComponentAdapterFactory *) servant;
-
+ factory_servant = NAUTILUS_ADAPTER_FACTORY_SERVER (bonobo_object (servant));
adapter = nautilus_adapter_new (component);
if (adapter == NULL) {
return CORBA_OBJECT_NIL;
} else {
- bonobo_object_ref (BONOBO_OBJECT (factory_servant->bonobo_object));
+ bonobo_object_ref (BONOBO_OBJECT (factory_servant));
adapter_view = nautilus_adapter_get_nautilus_view (adapter);
+ g_object_weak_ref (G_OBJECT (adapter_view),
+ (GWeakNotify)adapter_object_weak_notify,
+ factory_servant);
- g_signal_connect (adapter_view, "destroy",
- adapter_object_destroyed, factory_servant->bonobo_object);
-
- return CORBA_Object_duplicate
- (bonobo_object_corba_objref (BONOBO_OBJECT (adapter_view)), ev);
+ return CORBA_Object_duplicate (BONOBO_OBJREF (adapter_view),
+ ev);
}
}
-static void
-impl_Nautilus_ComponentAdapterFactory__destroy (BonoboObject *object,
- PortableServer_Servant servant)
+GType
+nautilus_adapter_factory_server_get_type (void)
{
- PortableServer_ObjectId *object_id;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
+ static GType type = 0;
- object_id = PortableServer_POA_servant_to_id (bonobo_poa (), servant, &ev);
- PortableServer_POA_deactivate_object (bonobo_poa (), object_id, &ev);
- CORBA_free (object_id);
-
- object->servant = NULL;
+ if (!type) {
+ GTypeInfo info = {
+ sizeof (NautilusAdapterFactoryServerClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc)nautilus_adapter_factory_server_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (NautilusAdapterFactoryServer),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc)nautilus_adapter_factory_server_init
+ };
+
+ type = bonobo_type_unique
+ (BONOBO_OBJECT_TYPE,
+ POA_Nautilus_ComponentAdapterFactory__init, NULL,
+ G_STRUCT_OFFSET (NautilusAdapterFactoryServerClass,
+ epv),
+ &info, "NautilusAdapterFactoryServer");
+ }
- POA_Nautilus_ComponentAdapterFactory__fini (servant, &ev);
- g_free (servant);
-
- CORBA_exception_free (&ev);
+ return type;
}
-static Nautilus_ComponentAdapterFactory
-impl_Nautilus_ComponentAdapterFactory__create (NautilusAdapterFactoryServer *bonobo_object,
- CORBA_Environment *ev)
-{
- impl_POA_Nautilus_ComponentAdapterFactory *servant;
-
- impl_Nautilus_ComponentAdapterFactory_vepv.Bonobo_Unknown_epv = nautilus_bonobo_object_get_epv ();
-
- servant = g_new0 (impl_POA_Nautilus_ComponentAdapterFactory, 1);
- servant->servant.vepv = &impl_Nautilus_ComponentAdapterFactory_vepv;
- POA_Nautilus_ComponentAdapterFactory__init ((PortableServer_Servant) servant, ev);
- g_signal_connect (bonobo_object, "destroy",
- G_CALLBACK (impl_Nautilus_ComponentAdapterFactory__destroy), servant);
-
- servant->bonobo_object = bonobo_object;
- return bonobo_object_activate_servant (BONOBO_OBJECT (bonobo_object), servant);
-}
Index: components/adapter/nautilus-adapter-factory-server.h
===================================================================
RCS file: /cvs/gnome/nautilus/components/adapter/nautilus-adapter-factory-server.h,v
retrieving revision 1.2
diff -u -r1.2 nautilus-adapter-factory-server.h
--- components/adapter/nautilus-adapter-factory-server.h 2000/09/16 12:00:24 1.2
+++ components/adapter/nautilus-adapter-factory-server.h 2002/01/04 19:27:28
@@ -28,14 +28,15 @@
#ifndef NAUTILUS_ADAPTER_FACTORY_SERVER_H
#define NAUTILUS_ADAPTER_FACTORY_SERVER_H
+#include <libnautilus-adapter/nautilus-adapter-factory.h>
#include <gtk/gtklabel.h>
#include <libnautilus/nautilus-view.h>
#define NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER (nautilus_adapter_factory_server_get_type ())
-#define NAUTILUS_ADAPTER_FACTORY_SERVER(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER, NautilusAdapterFactoryServer))
-#define NAUTILUS_ADAPTER_FACTORY_SERVER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER, NautilusAdapterFactoryServerClass))
-#define NAUTILUS_IS_ADAPTER_FACTORY_SERVER(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER))
-#define NAUTILUS_IS_ADAPTER_FACTORY_SERVER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER))
+#define NAUTILUS_ADAPTER_FACTORY_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER, NautilusAdapterFactoryServer))
+#define NAUTILUS_ADAPTER_FACTORY_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER, NautilusAdapterFactoryServerClass))
+#define NAUTILUS_IS_ADAPTER_FACTORY_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER))
+#define NAUTILUS_IS_ADAPTER_FACTORY_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER))
typedef struct {
BonoboObject parent;
@@ -43,10 +44,12 @@
typedef struct {
BonoboObjectClass parent;
+
+ POA_Nautilus_ComponentAdapterFactory__epv epv;
} NautilusAdapterFactoryServerClass;
-/* GtkObject support */
-GtkType nautilus_adapter_factory_server_get_type (void);
+/* GObject support */
+GType nautilus_adapter_factory_server_get_type (void);
#endif /* NAUTILUS_ADAPTER_FACTORY_SERVER_H */
Index: components/adapter/nautilus-adapter-load-strategy.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/adapter/nautilus-adapter-load-strategy.c,v
retrieving revision 1.11
diff -u -r1.11 nautilus-adapter-load-strategy.c
--- components/adapter/nautilus-adapter-load-strategy.c 2001/11/09 02:05:14 1.11
+++ components/adapter/nautilus-adapter-load-strategy.c 2002/01/04 19:27:28
@@ -33,7 +33,9 @@
#include "nautilus-adapter-load-strategy.h"
#include "nautilus-adapter-stream-load-strategy.h"
#include "nautilus-adapter-file-load-strategy.h"
+#if GNOME2_CONVERSION_COMPLETE
#include "nautilus-adapter-progressive-load-strategy.h"
+#endif
#include <gtk/gtkobject.h>
#include <eel/eel-gtk-macros.h>
@@ -89,7 +91,7 @@
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (NautilusAdapterLoadStrategyClass, report_load_progress),
NULL, NULL,
- eel_marshal_VOID__DOUBLE,
+ g_cclosure_marshal_VOID__DOUBLE,
G_TYPE_NONE, 1, G_TYPE_DOUBLE);
signals[REPORT_LOAD_COMPLETE] =
g_signal_new ("report_load_complete",
@@ -133,11 +135,14 @@
{
Bonobo_PersistStream persist_stream;
Bonobo_PersistFile persist_file;
+#if GNOME2_CONVERSION_COMPLETE
Bonobo_ProgressiveDataSink progressive_data_sink;
+#endif
CORBA_Environment ev;
CORBA_exception_init (&ev);
+#if GNOME2_CONVERSION_COMPLETE
progressive_data_sink = Bonobo_Unknown_queryInterface (component,
"IDL:Bonobo/ProgressiveDataSink:1.0", &ev);
@@ -148,7 +153,7 @@
return nautilus_adapter_progressive_load_strategy_new (progressive_data_sink);
}
-
+#endif
persist_stream = Bonobo_Unknown_queryInterface (component,
"IDL:Bonobo/PersistStream:1.0", &ev);
Index: components/adapter/nautilus-adapter-stream-load-strategy.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/adapter/nautilus-adapter-stream-load-strategy.c,v
retrieving revision 1.15
diff -u -r1.15 nautilus-adapter-stream-load-strategy.c
--- components/adapter/nautilus-adapter-stream-load-strategy.c 2001/12/07 00:54:09 1.15
+++ components/adapter/nautilus-adapter-stream-load-strategy.c 2002/01/04 19:27:28
@@ -31,8 +31,8 @@
#include <config.h>
#include "nautilus-adapter-stream-load-strategy.h"
-#include "bonobo-stream-vfs.h"
+#include <bonobo.h>
#include <gtk/gtkobject.h>
#include <eel/eel-gtk-macros.h>
#include <libnautilus/nautilus-view.h>
@@ -117,8 +117,9 @@
const char *uri)
{
NautilusAdapterStreamLoadStrategy *strategy;
- BonoboStream *stream;
+ Bonobo_Stream stream;
CORBA_Environment ev;
+ char *moniker_str;
strategy = NAUTILUS_ADAPTER_STREAM_LOAD_STRATEGY (abstract_strategy);
g_object_ref (strategy);
@@ -127,9 +128,12 @@
nautilus_adapter_load_strategy_report_load_underway (abstract_strategy);
- stream = bonobo_stream_vfs_open (uri, Bonobo_Storage_READ);
+ moniker_str = g_strconcat ("vfs:", uri, NULL);
+ stream = bonobo_get_object (moniker_str, "IDL:Bonobo/Stream:1.0", &ev);
+ g_free (moniker_str);
- if (stream == NULL) {
+ if (BONOBO_EX (&ev) || CORBA_Object_is_nil (stream, &ev)) {
+ g_print ("couldn't get stream object\n");
nautilus_adapter_load_strategy_report_load_failed (abstract_strategy);
} else {
/* FIXME bugzilla.gnome.org 41248:
@@ -141,17 +145,26 @@
* it should be easy to keep it around and pass it in here.
*/
+ fprintf (stderr, "before load\n");
+
Bonobo_PersistStream_load
(strategy->details->persist_stream,
- bonobo_object_corba_objref (BONOBO_OBJECT (stream)),
+ stream,
"", /* MIME type of stream */
&ev);
+
+ fprintf (stderr, "after load\n");
+
+ if (BONOBO_EX (&ev)) {
+ g_print ("couldn't load stream object: %s\n", bonobo_exception_get_text (&ev));
+ }
- bonobo_object_unref (BONOBO_OBJECT (stream));
+ bonobo_object_release_unref (stream, &ev);
if (ev._major == CORBA_NO_EXCEPTION) {
nautilus_adapter_load_strategy_report_load_complete (abstract_strategy);
} else {
+ g_print ("couldn't unref stream object: %s\n", bonobo_exception_get_text (&ev));
nautilus_adapter_load_strategy_report_load_failed (abstract_strategy);
}
}
Index: components/adapter/nautilus-adapter.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/adapter/nautilus-adapter.c,v
retrieving revision 1.26
diff -u -r1.26 nautilus-adapter.c
--- components/adapter/nautilus-adapter.c 2001/12/07 00:54:09 1.26
+++ components/adapter/nautilus-adapter.c 2002/01/04 19:27:28
@@ -33,7 +33,6 @@
#include "nautilus-adapter-load-strategy.h"
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-item-container.h>
-#include <bonobo/bonobo-view-frame.h>
#include <eel/eel-generous-bin.h>
#include <eel/eel-gtk-macros.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
@@ -152,11 +151,8 @@
control = bonobo_control_new (bin);
adapter->details->nautilus_view = nautilus_view_new_from_bonobo_control (control);
- g_signal_connect_closure (
- G_OBJECT (adapter->details->nautilus_view),
- "destroy", g_cclosure_new_swap (
- G_CALLBACK (g_object_unref),
- G_OBJECT (adapter), NULL), 0);
+ g_object_weak_ref (G_OBJECT (adapter->details->nautilus_view),
+ (GWeakNotify)g_object_unref, adapter);
/* Get the class to handle embedding this kind of component. */
adapter->details->embed_strategy = nautilus_adapter_embed_strategy_get (component);
@@ -175,7 +171,8 @@
adapter);
g_signal_connect (adapter->details->embed_strategy, "open_location",
- nautilus_adapter_open_location_callback, adapter);
+ G_CALLBACK (nautilus_adapter_open_location_callback),
+ adapter);
/* Get the class to handle loading this kind of component. */
@@ -187,25 +184,25 @@
/* hook up load strategy signals */
adapter->details->report_load_underway_id =
- gtk_signal_connect_object (GTK_OBJECT (adapter->details->load_strategy),
- "report_load_underway",
- nautilus_adapter_load_underway_callback,
- GTK_OBJECT (adapter));
+ g_signal_connect_swapped (GTK_OBJECT (adapter->details->load_strategy),
+ "report_load_underway",
+ G_CALLBACK (nautilus_adapter_load_underway_callback),
+ GTK_OBJECT (adapter));
adapter->details->report_load_progress_id =
- gtk_signal_connect_object (GTK_OBJECT (adapter->details->load_strategy),
- "report_load_progress",
- nautilus_adapter_load_progress_callback,
- GTK_OBJECT (adapter));
+ g_signal_connect_swapped (GTK_OBJECT (adapter->details->load_strategy),
+ "report_load_progress",
+ G_CALLBACK (nautilus_adapter_load_progress_callback),
+ GTK_OBJECT (adapter));
adapter->details->report_load_complete_id =
- gtk_signal_connect_object (GTK_OBJECT (adapter->details->load_strategy),
- "report_load_complete",
- nautilus_adapter_load_complete_callback,
- GTK_OBJECT (adapter));
+ g_signal_connect_swapped (GTK_OBJECT (adapter->details->load_strategy),
+ "report_load_complete",
+ G_CALLBACK (nautilus_adapter_load_complete_callback),
+ GTK_OBJECT (adapter));
adapter->details->report_load_failed_id =
- gtk_signal_connect_object (GTK_OBJECT (adapter->details->load_strategy),
- "report_load_failed",
- nautilus_adapter_load_failed_callback,
- GTK_OBJECT (adapter));
+ g_signal_connect_swapped (GTK_OBJECT (adapter->details->load_strategy),
+ "report_load_failed",
+ G_CALLBACK (nautilus_adapter_load_failed_callback),
+ GTK_OBJECT (adapter));
/* complete the embedding */
gtk_container_add (GTK_CONTAINER (bin),
@@ -213,13 +210,13 @@
/* hook up view signals. */
g_signal_connect (adapter->details->nautilus_view,
- "load_location",
- nautilus_adapter_load_location_callback,
- adapter);
+ "load_location",
+ G_CALLBACK (nautilus_adapter_load_location_callback),
+ adapter);
g_signal_connect (adapter->details->nautilus_view,
- "stop_loading",
- nautilus_adapter_stop_loading_callback,
- adapter);
+ "stop_loading",
+ G_CALLBACK (nautilus_adapter_stop_loading_callback),
+ adapter);
return adapter;
}
@@ -271,7 +268,7 @@
if (state) {
Bonobo_UIContainer corba_container;
- corba_container = bonobo_control_get_remote_ui_container (control);
+ corba_container = bonobo_control_get_remote_ui_container (control, NULL);
nautilus_adapter_embed_strategy_activate (adapter->details->embed_strategy,
corba_container);
} else
Index: components/adapter/nautilus-zoomable-proxy.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/adapter/nautilus-zoomable-proxy.c,v
retrieving revision 1.3
diff -u -r1.3 nautilus-zoomable-proxy.c
--- components/adapter/nautilus-zoomable-proxy.c 2001/04/17 21:04:38 1.3
+++ components/adapter/nautilus-zoomable-proxy.c 2002/01/04 19:27:28
@@ -27,21 +27,12 @@
#undef ZOOMABLE_DEBUG
-static BonoboZoomableClass *nautilus_zoomable_proxy_parent_class;
-static NautilusZoomableProxyClass *nautilus_zoomable_proxy_class;
+static BonoboObjectClass *nautilus_zoomable_proxy_parent_class;
struct _NautilusZoomableProxyPrivate {
Bonobo_Zoomable remote_zoomable;
};
-typedef struct {
- POA_Bonobo_Zoomable servant;
-
- NautilusZoomableProxy *gtk_object;
-} impl_POA_Bonobo_Zoomable;
-
-static POA_Bonobo_Zoomable__vepv nautilus_zoomable_proxy_vepv;
-
static inline NautilusZoomableProxy *
nautilus_zoomable_proxy_from_servant (PortableServer_Servant servant)
{
@@ -195,13 +186,9 @@
}
-static POA_Bonobo_Zoomable__epv *
-nautilus_get_modified_bonobo_zoomable_epv (void)
+static void
+nautilus_zoomable_proxy_init_epv (POA_Bonobo_Zoomable__epv *epv)
{
- POA_Bonobo_Zoomable__epv *epv;
-
- epv = g_new0 (POA_Bonobo_Zoomable__epv, 1);
-
epv->_get_level = impl_Nautilus_ZoomableProxy__get_level;
epv->_get_minLevel = impl_Nautilus_ZoomableProxy__get_minLevel;
epv->_get_maxLevel = impl_Nautilus_ZoomableProxy__get_maxLevel;
@@ -218,22 +205,11 @@
epv->setLevel = impl_Nautilus_ZoomableProxy_setLevel;
epv->setFrame = impl_Nautilus_ZoomableProxy_setFrame;
-
- return epv;
}
static void
-init_zoomable_proxy_corba_class (void)
+nautilus_zoomable_proxy_destroy (BonoboObject *object)
{
- /* The VEPV */
- nautilus_zoomable_proxy_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv ();
- nautilus_zoomable_proxy_vepv.Bonobo_Zoomable_epv = nautilus_get_modified_bonobo_zoomable_epv ();
-}
-
-
-static void
-nautilus_zoomable_proxy_destroy (GtkObject *object)
-{
NautilusZoomableProxy *proxy;
g_return_if_fail (object != NULL);
@@ -245,11 +221,11 @@
bonobo_object_release_unref (proxy->priv->remote_zoomable, NULL);
proxy->priv->remote_zoomable = CORBA_OBJECT_NIL;
- GTK_OBJECT_CLASS (nautilus_zoomable_proxy_parent_class)->destroy (object);
+ BONOBO_OBJECT_CLASS (nautilus_zoomable_proxy_parent_class)->destroy (BONOBO_OBJECT (object));
}
static void
-nautilus_zoomable_proxy_finalize (GtkObject *object)
+nautilus_zoomable_proxy_finalize (GObject *object)
{
NautilusZoomableProxy *proxy;
@@ -261,23 +237,25 @@
g_free (proxy->priv);
proxy->priv = NULL;
- GTK_OBJECT_CLASS (nautilus_zoomable_proxy_parent_class)->finalize (object);
+ G_OBJECT_CLASS (nautilus_zoomable_proxy_parent_class)->finalize (object);
}
static void
nautilus_zoomable_proxy_class_init (NautilusZoomableProxyClass *klass)
{
- GtkObjectClass *object_class;
+ GObjectClass *object_class;
+ BonoboObjectClass *bonobo_object_class;
+
+ object_class = (GObjectClass *) klass;
+ bonobo_object_class = (BonoboObjectClass *)klass;
- object_class = (GtkObjectClass *) klass;
+ nautilus_zoomable_proxy_parent_class =
+ g_type_class_peek_parent (klass);
- nautilus_zoomable_proxy_parent_class = gtk_type_class (bonobo_zoomable_get_type ());
- nautilus_zoomable_proxy_class = klass;
-
- object_class->destroy = nautilus_zoomable_proxy_destroy;
+ bonobo_object_class->destroy = nautilus_zoomable_proxy_destroy;
object_class->finalize = nautilus_zoomable_proxy_finalize;
- init_zoomable_proxy_corba_class ();
+ nautilus_zoomable_proxy_init_epv (&klass->epv);
}
static void
@@ -291,67 +269,44 @@
*
* Returns: the GtkType for a NautilusZoomableProxy object.
*/
-GtkType
+GType
nautilus_zoomable_proxy_get_type (void)
{
- static GtkType type = 0;
+ static GType type = 0;
if (!type) {
- GtkTypeInfo info = {
- "NautilusZoomableProxy",
- sizeof (NautilusZoomableProxy),
+ GTypeInfo info = {
sizeof (NautilusZoomableProxyClass),
- (GtkClassInitFunc) nautilus_zoomable_proxy_class_init,
- (GtkObjectInitFunc) nautilus_zoomable_proxy_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) nautilus_zoomable_proxy_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (NautilusZoomableProxy),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) nautilus_zoomable_proxy_init
};
- type = gtk_type_unique (bonobo_zoomable_get_type (), &info);
+ type = bonobo_type_unique
+ (BONOBO_TYPE_OBJECT,
+ POA_Bonobo_Zoomable__init, NULL,
+ G_STRUCT_OFFSET (NautilusZoomableProxyClass, epv),
+ &info, "NautilusZoomableProxy");
}
return type;
}
-static Bonobo_Zoomable
-nautilus_zoomable_proxy_corba_object_create (BonoboObject *object)
-{
- POA_Bonobo_Zoomable *servant;
- CORBA_Environment ev;
-
- servant = (POA_Bonobo_Zoomable *) g_new0 (BonoboObjectServant, 1);
- servant->vepv = &nautilus_zoomable_proxy_vepv;
-
- CORBA_exception_init (&ev);
-
- POA_Bonobo_Zoomable__init ((PortableServer_Servant) servant, &ev);
- if (ev._major != CORBA_NO_EXCEPTION){
- g_free (servant);
- CORBA_exception_free (&ev);
- return CORBA_OBJECT_NIL;
- }
-
- CORBA_exception_free (&ev);
- return (Bonobo_Zoomable) bonobo_object_activate_servant (object, servant);
-}
-
-
BonoboObject *
nautilus_zoomable_proxy_get (Bonobo_Zoomable remote_zoomable)
{
NautilusZoomableProxy *proxy;
- Bonobo_Zoomable corba_zoomable;
g_return_val_if_fail (remote_zoomable != CORBA_OBJECT_NIL, NULL);
- proxy = gtk_type_new (nautilus_zoomable_proxy_get_type ());
+ proxy = g_object_new (nautilus_zoomable_proxy_get_type (), NULL);
proxy->priv->remote_zoomable = bonobo_object_dup_ref (remote_zoomable, NULL);
-
- corba_zoomable = nautilus_zoomable_proxy_corba_object_create (BONOBO_OBJECT (proxy));
-
- bonobo_zoomable_construct (BONOBO_ZOOMABLE (proxy), corba_zoomable);
return BONOBO_OBJECT (proxy);
}
Index: components/adapter/nautilus-zoomable-proxy.h
===================================================================
RCS file: /cvs/gnome/nautilus/components/adapter/nautilus-zoomable-proxy.h,v
retrieving revision 1.1
diff -u -r1.1 nautilus-zoomable-proxy.h
--- components/adapter/nautilus-zoomable-proxy.h 2000/11/16 22:16:32 1.1
+++ components/adapter/nautilus-zoomable-proxy.h 2002/01/04 19:27:28
@@ -28,26 +28,28 @@
#include <bonobo/bonobo-zoomable.h>
#define NAUTILUS_ZOOMABLE_PROXY_TYPE (nautilus_zoomable_proxy_get_type ())
-#define NAUTILUS_ZOOMABLE_PROXY(o) (GTK_CHECK_CAST ((o), NAUTILUS_ZOOMABLE_PROXY_TYPE, NautilusZoomableProxy))
-#define NAUTILUS_ZOOMABLE_PROXY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), NAUTILUS_ZOOMABLE_PROXY_TYPE, NautilusZoomableProxyClass))
-#define NAUTILUS_IS_ZOOMABLE_PROXY(o) (GTK_CHECK_TYPE ((o), NAUTILUS_ZOOMABLE_PROXY_TYPE))
-#define NAUTILUS_S_ZOOMABLE_PROXY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), NAUTILUS_ZOOMABLE_PROXY_TYPE))
+#define NAUTILUS_ZOOMABLE_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NAUTILUS_ZOOMABLE_PROXY_TYPE, NautilusZoomableProxy))
+#define NAUTILUS_ZOOMABLE_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NAUTILUS_ZOOMABLE_PROXY_TYPE, NautilusZoomableProxyClass))
+#define NAUTILUS_IS_ZOOMABLE_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NAUTILUS_ZOOMABLE_PROXY_TYPE))
+#define NAUTILUS_S_ZOOMABLE_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NAUTILUS_ZOOMABLE_PROXY_TYPE))
typedef struct _NautilusZoomableProxy NautilusZoomableProxy;
typedef struct _NautilusZoomableProxyPrivate NautilusZoomableProxyPrivate;
typedef struct _NautilusZoomableProxyClass NautilusZoomableProxyClass;
struct _NautilusZoomableProxy {
- BonoboZoomable zoomable;
+ BonoboObject parent;
NautilusZoomableProxyPrivate *priv;
};
struct _NautilusZoomableProxyClass {
- BonoboZoomableClass parent;
+ BonoboObjectClass parent;
+
+ POA_Bonobo_Zoomable__epv epv;
};
-GtkType nautilus_zoomable_proxy_get_type (void);
+GType nautilus_zoomable_proxy_get_type (void);
BonoboObject *nautilus_zoomable_proxy_get (Bonobo_Zoomable corba_zoomable);
Index: src/nautilus-component-adapter-factory.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-component-adapter-factory.c,v
retrieving revision 1.15
diff -u -r1.15 nautilus-component-adapter-factory.c
--- src/nautilus-component-adapter-factory.c 2002/01/03 00:50:06 1.15
+++ src/nautilus-component-adapter-factory.c 2002/01/04 19:27:31
@@ -29,6 +29,7 @@
#include <config.h>
#include "nautilus-component-adapter-factory.h"
+#include <bonobo/bonobo-moniker-util.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-object.h>
#include <eel/eel-gtk-macros.h>
@@ -50,20 +51,10 @@
GTK_TYPE_OBJECT)
-#if GNOME2_CONVERSION_COMPLETE
static void
activate_factory (NautilusComponentAdapterFactory *factory)
{
- BonoboObjectClient *object_client;
-
- object_client = bonobo_object_activate (NAUTILUS_COMPONENT_ADAPTER_FACTORY_IID, 0);
- if (object_client == NULL) {
- return;
- }
-
- factory->details->corba_factory = bonobo_object_query_interface
- (BONOBO_OBJECT (object_client), "IDL:Nautilus/ComponentAdapterFactory:1.0");
- bonobo_object_unref (BONOBO_OBJECT (object_client));
+ factory->details->corba_factory = bonobo_get_object (NAUTILUS_COMPONENT_ADAPTER_FACTORY_IID, "IDL:Nautilus/ComponentAdapterFactory:1.0", NULL);
}
static void
@@ -75,8 +66,6 @@
Bonobo_Unknown_unref (factory->details->corba_factory, &ev);
CORBA_exception_free (&ev);
}
-#endif
-
static void
release_factory (NautilusComponentAdapterFactory *factory)
@@ -89,7 +78,6 @@
CORBA_exception_free (&ev);
}
-#ifdef GNOME2_CONVERSION_COMPLETE
static Nautilus_ComponentAdapterFactory
get_corba_factory (NautilusComponentAdapterFactory *factory)
{
@@ -117,7 +105,6 @@
}
return result;
}
-#endif
static void
nautilus_component_adapter_factory_init (NautilusComponentAdapterFactory *factory)
@@ -180,9 +167,7 @@
{
Nautilus_View nautilus_view;
Bonobo_Control bonobo_control;
-#ifdef GNOME2_CONVERSION_COMPLETE
Nautilus_ComponentAdapterFactory corba_factory;
-#endif
CORBA_Environment ev;
CORBA_exception_init (&ev);
@@ -209,7 +194,6 @@
}
} else {
nautilus_view = CORBA_OBJECT_NIL;
-#ifdef GNOME2_CONVERSION_COMPLETE
/* No View interface, we must adapt the object */
corba_factory = get_corba_factory (factory);
@@ -219,7 +203,6 @@
nautilus_view = CORBA_OBJECT_NIL;
}
bonobo_object_release_unref (corba_factory, NULL);
-#endif
}
CORBA_exception_free (&ev);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]