[Nautilus-list] nautilus-adapter UIContainer patch



Hi guys,

there is a problem with the way the nautilus-adapter handles
the Bonobo_UIContainer at the moment:

* nautilus_view_frame_set_to_component() passes the component
  to nautilus_component_adapter_factory_create_adapter(), but at
  this time it isn't bound to a BonoboControlFrame yet (because
  Nautilus doesn't even know whether it's a Control or an Embeddable).

* the nautilus-adapter calls bonobo_control_get_remote_ui_container()
  which will always return CORBA_OBJECT_NIL until the component has
  been bound to a ControlFrame.

The following patch adds an additional Bonobo_UIContainer arguent to
nautilus_component_adapter_factory_create_adapter() to fix this:

====
2000-10-14  Martin Baulig  <baulig suse de>

	* libnautilus-adapter/nautilus-adapter-factory.idl (create_adapter):
	Added Bonobo::UIContainer argument.
	* components/adapter/nautilus-adapter-factory-server.c
	(impl_Nautilus_ComponentAdapterFactory_create_adapter): Added
	`const Bonobo_UIContainer' argument.
	* components/adapter/nautilus-adapter.c (nautilus_adapter_new): Added
	`Bonobo_UIContainer' argument and use it as second argument in the call
	to nautilus_adapter_embed_strategy_get().
	* src/nautilus-component-adapter-factory.c
	(nautilus_component_adapter_factory_create_adapter): Added
	`Bonobo_UIContainer' argument.
	* src/nautilus-view-frame.c (nautilus_view_frame_set_to_component): Pass
	nautilus_component_adapter_factory_create_adapter() our Bonobo_UIContainer.

===

Here's the patch:

Index: components/adapter/nautilus-adapter-factory-server.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/adapter/nautilus-adapter-factory-server.c,v
retrieving revision 1.4
diff -u -u -p -r1.4 nautilus-adapter-factory-server.c
--- components/adapter/nautilus-adapter-factory-server.c	2000/09/27 00:07:29	1.4
+++ components/adapter/nautilus-adapter-factory-server.c	2000/10/14 20:30:55
@@ -50,6 +50,7 @@ typedef struct {
 static Nautilus_View
 impl_Nautilus_ComponentAdapterFactory_create_adapter (PortableServer_Servant           servant,
 						      const Bonobo_Unknown             component,
+						      const Bonobo_UIContainer         ui_container,
 						      CORBA_Environment               *ev);
 
 static void
@@ -132,16 +133,17 @@ adapter_object_destroyed (GtkObject *ada
 
 
 static Nautilus_View
-impl_Nautilus_ComponentAdapterFactory_create_adapter (PortableServer_Servant  servant,
-						      const Bonobo_Unknown    component,
-						      CORBA_Environment      *ev)
+impl_Nautilus_ComponentAdapterFactory_create_adapter (PortableServer_Servant   servant,
+						      const Bonobo_Unknown     component,
+						      const Bonobo_UIContainer ui_container,
+						      CORBA_Environment       *ev)
 {
 	impl_POA_Nautilus_ComponentAdapterFactory *factory_servant;
 	NautilusAdapter *adapter;
 
 	factory_servant = (impl_POA_Nautilus_ComponentAdapterFactory *) servant;
 
-	adapter = nautilus_adapter_new (component);
+	adapter = nautilus_adapter_new (component, ui_container);
 
 	if (adapter == NULL) {
 		return CORBA_OBJECT_NIL;
Index: components/adapter/nautilus-adapter.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/adapter/nautilus-adapter.c,v
retrieving revision 1.7
diff -u -u -p -r1.7 nautilus-adapter.c
--- components/adapter/nautilus-adapter.c	2000/10/05 23:47:33	1.7
+++ components/adapter/nautilus-adapter.c	2000/10/14 20:30:55
@@ -127,7 +127,7 @@ nautilus_adapter_destroy (GtkObject *obj
 
 
 NautilusAdapter *
-nautilus_adapter_new (Bonobo_Unknown component)
+nautilus_adapter_new (Bonobo_Unknown component, Bonobo_UIContainer ui_container)
 {
 	NautilusAdapter      *adapter;
 	BonoboControl        *control;
@@ -155,7 +155,7 @@ nautilus_adapter_new (Bonobo_Unknown com
 
 	/* Get the class to handle embedding this kind of component. */
 	adapter->details->embed_strategy = nautilus_adapter_embed_strategy_get
-		(component, bonobo_control_get_remote_ui_container (control));
+		(component, ui_container);
 
 	if (adapter->details->embed_strategy == NULL) {
 		gtk_object_unref (GTK_OBJECT (adapter));
Index: components/adapter/nautilus-adapter.h
===================================================================
RCS file: /cvs/gnome/nautilus/components/adapter/nautilus-adapter.h,v
retrieving revision 1.2
diff -u -u -p -r1.2 nautilus-adapter.h
--- components/adapter/nautilus-adapter.h	2000/09/20 14:21:28	1.2
+++ components/adapter/nautilus-adapter.h	2000/10/14 20:30:55
@@ -50,7 +50,8 @@ typedef struct {
 /* GtkObject support */
 GtkType          nautilus_adapter_get_type          (void);
 
-NautilusAdapter *nautilus_adapter_new               (Bonobo_Unknown component);
+NautilusAdapter *nautilus_adapter_new               (Bonobo_Unknown component,
+						     Bonobo_UIContainer ui_container);
 
 NautilusView    *nautilus_adapter_get_nautilus_view (NautilusAdapter *adapter);
 #endif /* NAUTILUS_ADAPTER_H */
Index: libnautilus-adapter/nautilus-adapter-factory.idl
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-adapter/nautilus-adapter-factory.idl,v
retrieving revision 1.2
diff -u -u -p -r1.2 nautilus-adapter-factory.idl
--- libnautilus-adapter/nautilus-adapter-factory.idl	2000/09/15 08:33:12	1.2
+++ libnautilus-adapter/nautilus-adapter-factory.idl	2000/10/14 20:30:59
@@ -36,7 +36,8 @@ module Nautilus {
 
 	interface ComponentAdapterFactory : Bonobo::Unknown {
 		/* FIXME: should use exceptions to report reasons for failure. */
-		Nautilus::View create_adapter (in Bonobo::Unknown component);
+		Nautilus::View create_adapter (in Bonobo::Unknown component,
+					       in Bonobo::UIContainer ui_container);
 	};
 
 };
Index: src/nautilus-component-adapter-factory.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-component-adapter-factory.c,v
retrieving revision 1.4
diff -u -u -p -r1.4 nautilus-component-adapter-factory.c
--- src/nautilus-component-adapter-factory.c	2000/09/26 00:52:21	1.4
+++ src/nautilus-component-adapter-factory.c	2000/10/14 20:31:02
@@ -119,7 +119,8 @@ nautilus_component_adapter_factory_get (
 
 Nautilus_View
 nautilus_component_adapter_factory_create_adapter (NautilusComponentAdapterFactory *factory,
-						   BonoboObjectClient              *component)
+						   BonoboObjectClient              *component,
+						   Bonobo_UIContainer               ui_container)
 {
 	Nautilus_View nautilus_view;
 	Bonobo_Control bonobo_control;
@@ -163,6 +164,7 @@ nautilus_component_adapter_factory_creat
 		nautilus_view = Nautilus_ComponentAdapterFactory_create_adapter 
 			(factory->details->corba_factory,
 			 bonobo_object_corba_objref (BONOBO_OBJECT (component)),
+			 ui_container,
 			 &ev);
 
 		if (ev._major != CORBA_NO_EXCEPTION) {
Index: src/nautilus-component-adapter-factory.h
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-component-adapter-factory.h,v
retrieving revision 1.1
diff -u -u -p -r1.1 nautilus-component-adapter-factory.h
--- src/nautilus-component-adapter-factory.h	2000/09/07 09:10:57	1.1
+++ src/nautilus-component-adapter-factory.h	2000/10/14 20:31:02
@@ -66,7 +66,8 @@ GtkType                          nautilu
 NautilusComponentAdapterFactory *nautilus_component_adapter_factory_get       (void);
 
 Nautilus_View nautilus_component_adapter_factory_create_adapter               (NautilusComponentAdapterFactory *factory,
-									       BonoboObjectClient              *component);
+									       BonoboObjectClient              *component,
+									       Bonobo_UIContainer               ui_container);
 
 
 #endif /* NAUTILUS_COMPONENT_ADAPTER_FACTORY_H */
Index: src/nautilus-view-frame-private.h
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-view-frame-private.h,v
retrieving revision 1.25
diff -u -u -p -r1.25 nautilus-view-frame-private.h
--- src/nautilus-view-frame-private.h	2000/09/29 21:34:04	1.25
+++ src/nautilus-view-frame-private.h	2000/10/14 20:31:03
@@ -39,11 +39,8 @@ typedef struct {
 } impl_POA_Nautilus_ViewFrame;
 
 extern POA_Nautilus_ViewFrame__vepv impl_Nautilus_ViewFrame_vepv;
-extern POA_Nautilus_ZoomableFrame__vepv impl_Nautilus_ZoomableFrame_vepv;
 
 BonoboObject *impl_Nautilus_ViewFrame__create                 (NautilusViewFrame *view,
-                                                               CORBA_Environment *ev);
-BonoboObject *impl_Nautilus_ZoomableFrame__create             (NautilusViewFrame *view,
                                                                CORBA_Environment *ev);
 
 /* ViewFrame */
Index: src/nautilus-view-frame.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-view-frame.c,v
retrieving revision 1.100
diff -u -u -p -r1.100 nautilus-view-frame.c
--- src/nautilus-view-frame.c	2000/10/13 05:56:11	1.100
+++ src/nautilus-view-frame.c	2000/10/14 20:31:03
@@ -612,7 +657,8 @@ nautilus_view_frame_set_to_component (Na
 
 	adapted = nautilus_component_adapter_factory_create_adapter 
 		(nautilus_component_adapter_factory_get (),
-		 component);
+		 component,
+		 bonobo_object_corba_objref (BONOBO_OBJECT (view->details->ui_container)));
 	bonobo_object_unref (BONOBO_OBJECT (component));
 
 	/* Handle case where we don't know how to host this component. */
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.2365
diff -u -u -r1.2365 ChangeLog
--- ChangeLog	2000/10/14 07:23:39	1.2365
+++ ChangeLog	2000/10/14 20:52:36
@@ -1,3 +1,19 @@
+2000-10-14  Martin Baulig  <baulig suse de>
+
+	* libnautilus-adapter/nautilus-adapter-factory.idl (create_adapter):
+	Added Bonobo::UIContainer argument.
+	* components/adapter/nautilus-adapter-factory-server.c
+	(impl_Nautilus_ComponentAdapterFactory_create_adapter): Added
+	`const Bonobo_UIContainer' argument.
+	* components/adapter/nautilus-adapter.c (nautilus_adapter_new): Added
+	`Bonobo_UIContainer' argument and use it as second argument in the call
+	to nautilus_adapter_embed_strategy_get().
+	* src/nautilus-component-adapter-factory.c
+	(nautilus_component_adapter_factory_create_adapter): Added
+	`Bonobo_UIContainer' argument.
+	* src/nautilus-view-frame.c (nautilus_view_frame_set_to_component): Pass
+	nautilus_component_adapter_factory_create_adapter() our Bonobo_UIContainer.
+
 2000-10-14  Andy Hertzfeld  <andy eazel com>
 
 	* src/nautilus-throbber.c: (nautilus_throbber_initialize_class),
-- 
Martin Baulig
martin gnome org (private)
baulig suse de (work)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]