Commit 00c39630 authored by Martin Baulig's avatar Martin Baulig Committed by Martin Baulig
Browse files

reviewed by: Darin Adler <darin@eazel.com> reviewed by: Maciej Stachowiak

2000-10-22  Martin Baulig  <baulig@suse.de>

	reviewed by: Darin Adler  <darin@eazel.com>
	reviewed by: Maciej Stachowiak  <mjs@eazel.com>

	Use the new Bonobo::Zoomable interface instead of Nautilus::Zoomable.

	* libnautilus/nautilus-zoomable.[ch]: Removed.
	* src/nautilus-zoomable-frame-corba.c: Removed.

	* libnautilus/nautilus-view-component.idl
	(ZoomLevels, ZoomLevelList, Zoomable, ZoomableFrame): Removed.

	* src/nautilus-view-frame-private.h
	(impl_Nautilus_ZoomableFrame_vepv, impl_Nautilus_ZoomableFrame__create):
	Removed external declarations.

	* src/nautilus-view-frame.h: include <bonobo/bonobo-zoomable-frame.h>.
	(NautilusViewFrame): Removed the `zoomable' field and changed the
	type of the `zoomable_frame' field from BonoboObject into
	BonoboZoomableFrame.
	(NautilusViewFrameClass): Added `zoom_parameters_changed' signal.

	* src/nautilus-view-frame.c (nautilus_view_frame_destroy_client):
	Don't release `view->zoomable' and set `view->history_frame' and
	`view->zoomable_frame' to NULL, not to CORBA_OBJECT_NIL.
	(nautilus_view_frame_initialize_class): Added ZOOM_PARAMETERS_CHANGED
	signal.
	(zoom_level_changed_callback): New static callback function; this emits
	the ZOOM_LEVEL_CHANGED signal on the NautilusViewFrame.
	(zoom_parameters_changed_callback): New static callback function; this
	emits the ZOOM_PARAMETERS_CHANGED signal on the NautilusViewFrame.
	(nautilus_view_frame_set_to_component): QI the adapted component for
	"IDL:Bonobo/Zoomable:1.0" and - if it was found - create the
	BonoboZoomableFrame, bind it to the BonoboZoomable and connect the
	"zoom_level_changed" and the "zoom_parameters_changed" signals.
	(nautilus_view_frame_is_zoomable): Return `view->zoomable_frame != NULL'.
	(nautilus_view_frame_get_zoom_level): Check whether view->zoomable_frame
	is not NULL and call bonobo_zoomable_frame_get_zoom_level().
	(nautilus_view_frame_set_zoom_level): Check whether view->zoomable_frame
	is not NULL and call bonobo_zoomable_frame_set_zoom_level().
	(nautilus_view_frame_get_min_zoom_level): Check whether
	view->zoomable_frame is not NULL and call
	bonobo_zoomable_frame_get_min_zoom_level().
	(nautilus_view_frame_get_max_zoom_level): Check whether
	view->zoomable_frame is not NULL and call
	bonobo_zoomable_frame_get_max_zoom_level().
	(nautilus_view_frame_get_has_min_zoom_level): New function.
	Check whether view->zoomable_frame is not NULL and call
	bonobo_zoomable_frame_has_min_zoom_level().
	(nautilus_view_frame_get_has_max_zoom_level): New function.
	Check whether view->zoomable_frame is not NULL and call
	bonobo_zoomable_frame_has_max_zoom_level().
	(nautilus_view_frame_get_is_continuous): New function.
	Check whether view->zoomable_frame is not NULL and call
	bonobo_zoomable_frame_is_continuous().
	(nautilus_view_frame_get_preferred_zoom_levels): If
	view->zoomable_frame is NULL, return NULL. Otherwise
	bonobo_zoomable_frame_get_preferred_zoom_levels() returns GList *
	of floats which we can just return.
	(nautilus_view_frame_zoom_in): If view->zoomable_frame is not NULL,
	call bonobo_zoomable_frame_zoom_in().
	(nautilus_view_frame_zoom_out): If view->zoomable_frame is not NULL,
	call bonobo_zoomable_frame_zoom_out().
	(nautilus_view_frame_zoom_to_fit):  If view->zoomable_frame is not
	NULL, call bonobo_zoomable_frame_zoom_out().
	(nautilus_view_frame_zoom_level_changed): Removed.

	* src/nautilus-zoom-control.c (NautilusZoomControlDetails): Added
	`has_min_zoom_level' and `has_max_zoom_level'.
	(draw_zoom_control_image): Call nautilus_zoom_control_can_zoom_in/out()
	to find out whether we can zoom.
	(zoom_menu_callback): Likewise.
	(nautilus_zoom_control_button_press_event): Likewise.
	(create_zoom_menu_item): Changed the type of the `zoom_level' argument
	from double to float.
	(nautilus_zoom_control_set_min_zoom_level): Removed.
	(nautilus_zoom_control_set_max_zoom_level): Removed.
	(nautilus_zoom_control_set_preferred_zoom_levels): Removed.
	(nautilus_zoom_control_set_parameters): New function.
	(nautilus_zoom_control_has_min_zoom_level): New function.
	(nautilus_zoom_control_has_max_zoom_level): New function.
	(nautilus_zoom_control_can_zoom_in): New function.
	(nautilus_zoom_control_can_zoom_out): New function.

	* src/file-manager/fm-directory-view.c: #include
	<bonobo/bonobo-zoomable.h> instead of
	<libnautilus/libnautilus-zoomable.h>.
	(FMDirectoryViewDetails): Changed the type of `zoomable' to
	BonoboZoomable.
	(fm_directory_view_preferred_zoom_levels): Made this an array of float,
	not double.
	(fm_directory_view_initialize): Create a new BonoboZoomable object here.
	(zoomable_zoom_in_callback): The first argument is now a BonoboZoomable.
	(zoomable_zoom_out_callback): The first argument is now a BonoboZoomable.
	(nautilus_zoom_level_from_double): Renamed into
	nautilus_zoom_level_from_float().
	(zoomable_set_zoom_level_callback): The first argument is now a
	BonoboZoomable and the second one a float.
	(zoomable_zoom_to_fit_callback): The first argument is now a
	BonoboZoomable.
	(fm_directory_view_set_zoom_level): Call
	bonobo_zoomable_report_zoom_level_changed()
	instead of using nautilus_zoomable_set_zoom_level().

	* src/nautilus-window-manage-views.c:
	(zoom_level_changed_callback): Don't call
	nautilus_zoom_control_set_min_zoom_level(),
	nautilus_zoom_control_set_max_zoom_level() and
	nautilus_zoom_control_set_preferred_zoom_levels() here.
	Use nautilus_zoom_control_can_zoom_in/out() to find out whether we
	can zoom in the calls to nautilus_bonobo_set_sensitive().
	, (zoom_parameters_changed_callback): New callback function.
	Call nautilus_zoom_control_set_parameters() and - if the zoom_level
	is not 0.0 - zoom_level_changed_callback().

	* components/adapter/nautilus-zoomable-proxy.[ch]: New files.

	* components/adapter/Makefile.am (nautilus_adapter_SOURCES):
	Added nautilus-zoomable-proxy.c and nautilus-zoomable-proxy.h.

	* components/adapter/nautilus-adapter-embed-strategy.c
	(NautilusAdapterEmbedStrategyClass): Added new virtual signal
	`get_zoomable' which must be overridden.
	(nautilus_adapter_embed_strategy_initialize_class): Assign it here.
	(nautilus_adapter_embed_strategy_get_zoomable): New static function;
	call the virtual `get_zoomable' in the derived class.

	* components/adapter/nautilus-adapter-control-embed-strategy.c:
	(nautilus_adapter_control_embed_strategy_initialize_class):
	Assign nautilus_adapter_control_embed_strategy_get_zoomable() as
	handler of the `get_zoomable' signal.
	(nautilus_adapter_control_embed_strategy_new): QI the Control for
	"IDL:Bonobo/Zoomable:1.0" and pass it to nautilus_zoomable_proxy_get()
	if found and store the return value in strategy->details->zoomable.
	(nautilus_adapter_control_embed_strategy_get_zoomable): New static
	function; return strategy->details->zoomable which is set in
	nautilus_adapter_control_embed_strategy_new().

	* components/adapter/nautilus-adapter-embeddable-embed-strategy.c:
	(nautilus_adapter_embeddable_embed_strategy_initialize_class):
	Assign nautilus_adapter_embeddable_embed_strategy_get_zoomable() as
	handler of the `get_zoomable' signal.
	(nautilus_adapter_embeddable_embed_strategy_new): QI the View for
	"IDL:Bonobo/Zoomable:1.0" and pass it to nautilus_zoomable_proxy_get()
	if found and store the return value in strategy->details->zoomable.
	(nautilus_adapter_embeddable_embed_strategy_get_zoomable): New static
	function; return strategy->details->zoomable which is set in
	nautilus_adapter_embeddable_embed_strategy_new().

	* components/adapter/nautilus-adapter.c: (nautilus_adapter_new):
	Call nautilus_adapter_embed_strategy_get_zoomable(embed_strategy) and
	bonobo_add_interface() it to the control if found.

	* components/image-viewer/nautilus-image-view.c: Rewrote the Nautilus
	image viewer to be a BonoboControl, to add zoomable support to it and
	to merge back everything from bonobo-image-generic into it.
parent 56c95829
2000-10-22 Martin Baulig <baulig@suse.de>
reviewed by: Darin Adler <darin@eazel.com>
reviewed by: Maciej Stachowiak <mjs@eazel.com>
Use the new Bonobo::Zoomable interface instead of Nautilus::Zoomable.
* libnautilus/nautilus-zoomable.[ch]: Removed.
* src/nautilus-zoomable-frame-corba.c: Removed.
* libnautilus/nautilus-view-component.idl
(ZoomLevels, ZoomLevelList, Zoomable, ZoomableFrame): Removed.
* src/nautilus-view-frame-private.h
(impl_Nautilus_ZoomableFrame_vepv, impl_Nautilus_ZoomableFrame__create):
Removed external declarations.
* src/nautilus-view-frame.h: include <bonobo/bonobo-zoomable-frame.h>.
(NautilusViewFrame): Removed the `zoomable' field and changed the
type of the `zoomable_frame' field from BonoboObject into
BonoboZoomableFrame.
(NautilusViewFrameClass): Added `zoom_parameters_changed' signal.
* src/nautilus-view-frame.c (nautilus_view_frame_destroy_client):
Don't release `view->zoomable' and set `view->history_frame' and
`view->zoomable_frame' to NULL, not to CORBA_OBJECT_NIL.
(nautilus_view_frame_initialize_class): Added ZOOM_PARAMETERS_CHANGED
signal.
(zoom_level_changed_callback): New static callback function; this emits
the ZOOM_LEVEL_CHANGED signal on the NautilusViewFrame.
(zoom_parameters_changed_callback): New static callback function; this
emits the ZOOM_PARAMETERS_CHANGED signal on the NautilusViewFrame.
(nautilus_view_frame_set_to_component): QI the adapted component for
"IDL:Bonobo/Zoomable:1.0" and - if it was found - create the
BonoboZoomableFrame, bind it to the BonoboZoomable and connect the
"zoom_level_changed" and the "zoom_parameters_changed" signals.
(nautilus_view_frame_is_zoomable): Return `view->zoomable_frame != NULL'.
(nautilus_view_frame_get_zoom_level): Check whether view->zoomable_frame
is not NULL and call bonobo_zoomable_frame_get_zoom_level().
(nautilus_view_frame_set_zoom_level): Check whether view->zoomable_frame
is not NULL and call bonobo_zoomable_frame_set_zoom_level().
(nautilus_view_frame_get_min_zoom_level): Check whether
view->zoomable_frame is not NULL and call
bonobo_zoomable_frame_get_min_zoom_level().
(nautilus_view_frame_get_max_zoom_level): Check whether
view->zoomable_frame is not NULL and call
bonobo_zoomable_frame_get_max_zoom_level().
(nautilus_view_frame_get_has_min_zoom_level): New function.
Check whether view->zoomable_frame is not NULL and call
bonobo_zoomable_frame_has_min_zoom_level().
(nautilus_view_frame_get_has_max_zoom_level): New function.
Check whether view->zoomable_frame is not NULL and call
bonobo_zoomable_frame_has_max_zoom_level().
(nautilus_view_frame_get_is_continuous): New function.
Check whether view->zoomable_frame is not NULL and call
bonobo_zoomable_frame_is_continuous().
(nautilus_view_frame_get_preferred_zoom_levels): If
view->zoomable_frame is NULL, return NULL. Otherwise
bonobo_zoomable_frame_get_preferred_zoom_levels() returns GList *
of floats which we can just return.
(nautilus_view_frame_zoom_in): If view->zoomable_frame is not NULL,
call bonobo_zoomable_frame_zoom_in().
(nautilus_view_frame_zoom_out): If view->zoomable_frame is not NULL,
call bonobo_zoomable_frame_zoom_out().
(nautilus_view_frame_zoom_to_fit): If view->zoomable_frame is not
NULL, call bonobo_zoomable_frame_zoom_out().
(nautilus_view_frame_zoom_level_changed): Removed.
* src/nautilus-zoom-control.c (NautilusZoomControlDetails): Added
`has_min_zoom_level' and `has_max_zoom_level'.
(draw_zoom_control_image): Call nautilus_zoom_control_can_zoom_in/out()
to find out whether we can zoom.
(zoom_menu_callback): Likewise.
(nautilus_zoom_control_button_press_event): Likewise.
(create_zoom_menu_item): Changed the type of the `zoom_level' argument
from double to float.
(nautilus_zoom_control_set_min_zoom_level): Removed.
(nautilus_zoom_control_set_max_zoom_level): Removed.
(nautilus_zoom_control_set_preferred_zoom_levels): Removed.
(nautilus_zoom_control_set_parameters): New function.
(nautilus_zoom_control_has_min_zoom_level): New function.
(nautilus_zoom_control_has_max_zoom_level): New function.
(nautilus_zoom_control_can_zoom_in): New function.
(nautilus_zoom_control_can_zoom_out): New function.
* src/file-manager/fm-directory-view.c: #include
<bonobo/bonobo-zoomable.h> instead of
<libnautilus/libnautilus-zoomable.h>.
(FMDirectoryViewDetails): Changed the type of `zoomable' to
BonoboZoomable.
(fm_directory_view_preferred_zoom_levels): Made this an array of float,
not double.
(fm_directory_view_initialize): Create a new BonoboZoomable object here.
(zoomable_zoom_in_callback): The first argument is now a BonoboZoomable.
(zoomable_zoom_out_callback): The first argument is now a BonoboZoomable.
(nautilus_zoom_level_from_double): Renamed into
nautilus_zoom_level_from_float().
(zoomable_set_zoom_level_callback): The first argument is now a
BonoboZoomable and the second one a float.
(zoomable_zoom_to_fit_callback): The first argument is now a
BonoboZoomable.
(fm_directory_view_set_zoom_level): Call
bonobo_zoomable_report_zoom_level_changed()
instead of using nautilus_zoomable_set_zoom_level().
* src/nautilus-window-manage-views.c:
(zoom_level_changed_callback): Don't call
nautilus_zoom_control_set_min_zoom_level(),
nautilus_zoom_control_set_max_zoom_level() and
nautilus_zoom_control_set_preferred_zoom_levels() here.
Use nautilus_zoom_control_can_zoom_in/out() to find out whether we
can zoom in the calls to nautilus_bonobo_set_sensitive().
, (zoom_parameters_changed_callback): New callback function.
Call nautilus_zoom_control_set_parameters() and - if the zoom_level
is not 0.0 - zoom_level_changed_callback().
* components/adapter/nautilus-zoomable-proxy.[ch]: New files.
* components/adapter/Makefile.am (nautilus_adapter_SOURCES):
Added nautilus-zoomable-proxy.c and nautilus-zoomable-proxy.h.
* components/adapter/nautilus-adapter-embed-strategy.c
(NautilusAdapterEmbedStrategyClass): Added new virtual signal
`get_zoomable' which must be overridden.
(nautilus_adapter_embed_strategy_initialize_class): Assign it here.
(nautilus_adapter_embed_strategy_get_zoomable): New static function;
call the virtual `get_zoomable' in the derived class.
* components/adapter/nautilus-adapter-control-embed-strategy.c:
(nautilus_adapter_control_embed_strategy_initialize_class):
Assign nautilus_adapter_control_embed_strategy_get_zoomable() as
handler of the `get_zoomable' signal.
(nautilus_adapter_control_embed_strategy_new): QI the Control for
"IDL:Bonobo/Zoomable:1.0" and pass it to nautilus_zoomable_proxy_get()
if found and store the return value in strategy->details->zoomable.
(nautilus_adapter_control_embed_strategy_get_zoomable): New static
function; return strategy->details->zoomable which is set in
nautilus_adapter_control_embed_strategy_new().
* components/adapter/nautilus-adapter-embeddable-embed-strategy.c:
(nautilus_adapter_embeddable_embed_strategy_initialize_class):
Assign nautilus_adapter_embeddable_embed_strategy_get_zoomable() as
handler of the `get_zoomable' signal.
(nautilus_adapter_embeddable_embed_strategy_new): QI the View for
"IDL:Bonobo/Zoomable:1.0" and pass it to nautilus_zoomable_proxy_get()
if found and store the return value in strategy->details->zoomable.
(nautilus_adapter_embeddable_embed_strategy_get_zoomable): New static
function; return strategy->details->zoomable which is set in
nautilus_adapter_embeddable_embed_strategy_new().
* components/adapter/nautilus-adapter.c: (nautilus_adapter_new):
Call nautilus_adapter_embed_strategy_get_zoomable(embed_strategy) and
bonobo_add_interface() it to the control if found.
* components/image-viewer/nautilus-image-view.c: Rewrote the Nautilus
image viewer to be a BonoboControl, to add zoomable support to it and
to merge back everything from bonobo-image-generic into it.
2000-11-16 Ramiro Estrugo <ramiro@eazel.com>
* components/help/converters/gnome-info2html2/main.c: (main):
......
......@@ -45,6 +45,8 @@ nautilus_adapter_SOURCES = \
nautilus-adapter-progressive-load-strategy.h \
nautilus-adapter-stream-load-strategy.c \
nautilus-adapter-stream-load-strategy.h \
nautilus-zoomable-proxy.c \
nautilus-zoomable-proxy.h \
nautilus-adapter.c \
nautilus-adapter.h \
$(NULL)
......@@ -67,3 +69,4 @@ nautilus_adapter_LDADD = \
EXTRA_DIST = $(oaf_DATA)
......@@ -32,6 +32,7 @@
#include "nautilus-adapter-control-embed-strategy.h"
#include "nautilus-adapter-embed-strategy-private.h"
#include "nautilus-zoomable-proxy.h"
#include <gtk/gtkobject.h>
#include <gtk/gtksignal.h>
......@@ -42,6 +43,7 @@
struct NautilusAdapterControlEmbedStrategyDetails {
Bonobo_Control control;
BonoboControlFrame *control_frame;
BonoboObject *zoomable;
GtkWidget *widget;
};
......@@ -54,6 +56,7 @@ static void nautilus_adapter_control_embed_strategy_deactivate (NautilusAd
static void nautilus_adapter_control_embed_strategy_destroy (GtkObject *object);
static GtkWidget *nautilus_adapter_control_embed_strategy_get_widget (NautilusAdapterEmbedStrategy *strategy);
static BonoboObject *nautilus_adapter_control_embed_strategy_get_zoomable (NautilusAdapterEmbedStrategy *strategy);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusAdapterControlEmbedStrategy, nautilus_adapter_control_embed_strategy, NAUTILUS_TYPE_ADAPTER_EMBED_STRATEGY)
......@@ -72,6 +75,7 @@ nautilus_adapter_control_embed_strategy_initialize_class (NautilusAdapterControl
adapter_embed_strategy_class = NAUTILUS_ADAPTER_EMBED_STRATEGY_CLASS (klass);
adapter_embed_strategy_class->get_widget = nautilus_adapter_control_embed_strategy_get_widget;
adapter_embed_strategy_class->get_zoomable = nautilus_adapter_control_embed_strategy_get_zoomable;
adapter_embed_strategy_class->activate = nautilus_adapter_control_embed_strategy_activate;
adapter_embed_strategy_class->deactivate = nautilus_adapter_control_embed_strategy_deactivate;
}
......@@ -157,6 +161,8 @@ nautilus_adapter_control_embed_strategy_new (Bonobo_Control control,
Bonobo_UIContainer ui_container)
{
NautilusAdapterControlEmbedStrategy *strategy;
Bonobo_Zoomable corba_zoomable;
CORBA_Environment ev;
strategy = NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY (gtk_object_new (NAUTILUS_TYPE_ADAPTER_CONTROL_EMBED_STRATEGY, NULL));
gtk_object_ref (GTK_OBJECT (strategy));
......@@ -172,6 +178,18 @@ nautilus_adapter_control_embed_strategy_new (Bonobo_Control control,
gtk_signal_connect (GTK_OBJECT (strategy->details->control_frame),
"activate_uri", GTK_SIGNAL_FUNC (activate_uri_callback), strategy);
CORBA_exception_init (&ev);
corba_zoomable = Bonobo_Unknown_queryInterface (control,
"IDL:Bonobo/Zoomable:1.0",
&ev);
if ((ev._major == CORBA_NO_EXCEPTION) &&
!CORBA_Object_is_nil (corba_zoomable, &ev)) {
strategy->details->zoomable = nautilus_zoomable_proxy_get
(corba_zoomable);
}
CORBA_exception_free (&ev);
return NAUTILUS_ADAPTER_EMBED_STRATEGY (strategy);
}
......@@ -185,5 +203,14 @@ nautilus_adapter_control_embed_strategy_get_widget (NautilusAdapterEmbedStrategy
return strategy->details->widget;
}
static BonoboObject *
nautilus_adapter_control_embed_strategy_get_zoomable (NautilusAdapterEmbedStrategy *abstract_strategy)
{
NautilusAdapterControlEmbedStrategy *strategy;
strategy = NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY (abstract_strategy);
return strategy->details->zoomable;
}
......@@ -32,6 +32,7 @@
#include "nautilus-adapter-embeddable-embed-strategy.h"
#include "nautilus-adapter-embed-strategy-private.h"
#include "nautilus-zoomable-proxy.h"
#include <bonobo/bonobo-client-site.h>
#include <bonobo/bonobo-item-container.h>
......@@ -45,6 +46,7 @@ struct NautilusAdapterEmbeddableEmbedStrategyDetails {
BonoboClientSite *client_site;
BonoboViewFrame *view_frame;
GtkWidget *client_widget;
BonoboObject *zoomable;
};
......@@ -57,6 +59,7 @@ static void nautilus_adapter_embeddable_embed_strategy_deactivate (Nautilu
static GtkWidget *nautilus_adapter_embeddable_embed_strategy_get_widget (NautilusAdapterEmbedStrategy *strategy);
static BonoboObject *nautilus_adapter_embeddable_embed_strategy_get_zoomable (NautilusAdapterEmbedStrategy *strategy);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusAdapterEmbeddableEmbedStrategy, nautilus_adapter_embeddable_embed_strategy, NAUTILUS_TYPE_ADAPTER_EMBED_STRATEGY)
......@@ -75,6 +78,7 @@ nautilus_adapter_embeddable_embed_strategy_initialize_class (NautilusAdapterEmbe
adapter_embed_strategy_class = NAUTILUS_ADAPTER_EMBED_STRATEGY_CLASS (klass);
adapter_embed_strategy_class->get_widget = nautilus_adapter_embeddable_embed_strategy_get_widget;
adapter_embed_strategy_class->get_zoomable = nautilus_adapter_embeddable_embed_strategy_get_zoomable;
adapter_embed_strategy_class->activate = nautilus_adapter_embeddable_embed_strategy_activate;
adapter_embed_strategy_class->deactivate = nautilus_adapter_embeddable_embed_strategy_deactivate;
}
......@@ -163,6 +167,9 @@ nautilus_adapter_embeddable_embed_strategy_new (Bonobo_Embeddable embeddable,
Bonobo_UIContainer ui_container)
{
NautilusAdapterEmbeddableEmbedStrategy *strategy;
Bonobo_Zoomable corba_zoomable;
Bonobo_View corba_view;
CORBA_Environment ev;
strategy = NAUTILUS_ADAPTER_EMBEDDABLE_EMBED_STRATEGY (gtk_object_new (NAUTILUS_TYPE_ADAPTER_EMBEDDABLE_EMBED_STRATEGY, NULL));
gtk_object_ref (GTK_OBJECT (strategy));
......@@ -179,6 +186,21 @@ nautilus_adapter_embeddable_embed_strategy_new (Bonobo_Embeddable embeddable,
strategy->details->view_frame = bonobo_client_site_new_view (strategy->details->client_site, ui_container);
strategy->details->client_widget = bonobo_view_frame_get_wrapper (strategy->details->view_frame);
CORBA_exception_init (&ev);
corba_view = bonobo_view_frame_get_view (strategy->details->view_frame);
corba_zoomable = Bonobo_Unknown_queryInterface (corba_view,
"IDL:Bonobo/Zoomable:1.0",
&ev);
if ((ev._major == CORBA_NO_EXCEPTION) &&
!CORBA_Object_is_nil (corba_zoomable, &ev)) {
strategy->details->zoomable = nautilus_zoomable_proxy_get
(corba_zoomable);
}
CORBA_exception_free (&ev);
bonobo_wrapper_set_visibility (BONOBO_WRAPPER (strategy->details->client_widget), FALSE);
bonobo_view_frame_set_covered (strategy->details->view_frame, FALSE);
......@@ -199,5 +221,14 @@ nautilus_adapter_embeddable_embed_strategy_get_widget (NautilusAdapterEmbedStrat
return strategy->details->client_widget;
}
static BonoboObject *
nautilus_adapter_embeddable_embed_strategy_get_zoomable (NautilusAdapterEmbedStrategy *abstract_strategy)
{
NautilusAdapterEmbeddableEmbedStrategy *strategy;
strategy = NAUTILUS_ADAPTER_EMBEDDABLE_EMBED_STRATEGY (abstract_strategy);
return strategy->details->zoomable;
}
......@@ -57,6 +57,7 @@ static void nautilus_adapter_embed_strategy_destroy (GtkObject
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusAdapterEmbedStrategy, nautilus_adapter_embed_strategy, GTK_TYPE_OBJECT)
NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL (nautilus_adapter_embed_strategy, get_widget)
NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL (nautilus_adapter_embed_strategy, get_zoomable)
static void
nautilus_adapter_embed_strategy_initialize_class (NautilusAdapterEmbedStrategyClass *klass)
......@@ -92,6 +93,7 @@ nautilus_adapter_embed_strategy_initialize_class (NautilusAdapterEmbedStrategyCl
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, nautilus_adapter_embed_strategy, get_widget);
NAUTILUS_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, nautilus_adapter_embed_strategy, get_zoomable);
}
static void
......@@ -151,6 +153,13 @@ nautilus_adapter_embed_strategy_get_widget (NautilusAdapterEmbedStrategy *strate
get_widget, (strategy));
}
BonoboObject *
nautilus_adapter_embed_strategy_get_zoomable (NautilusAdapterEmbedStrategy *strategy)
{
return NAUTILUS_CALL_VIRTUAL (NAUTILUS_ADAPTER_EMBED_STRATEGY_CLASS, strategy,
get_zoomable, (strategy));
}
void
nautilus_adapter_embed_strategy_activate (NautilusAdapterEmbedStrategy *strategy,
......
......@@ -54,7 +54,8 @@ typedef struct {
const char *uri);
/* virtual functions */
GtkWidget *(*get_widget) (NautilusAdapterEmbedStrategy *strategy);
GtkWidget *(*get_widget) (NautilusAdapterEmbedStrategy *strategy);
BonoboObject *(*get_zoomable)(NautilusAdapterEmbedStrategy *strategy);
} NautilusAdapterEmbedStrategyClass;
......@@ -70,6 +71,8 @@ void nautilus_adapter_embed_strategy_deactivate(Nautilu
GtkWidget *nautilus_adapter_embed_strategy_get_widget (NautilusAdapterEmbedStrategy *strategy);
BonoboObject *nautilus_adapter_embed_strategy_get_zoomable (NautilusAdapterEmbedStrategy *strategy);
#endif /* NAUTILUS_ADAPTER_EMBED_STRATEGY_H */
......
......@@ -32,6 +32,7 @@
#include "nautilus-adapter-embeddable-embed-strategy.h"
#include "nautilus-adapter-embed-strategy-private.h"
#include "nautilus-zoomable-proxy.h"
#include <bonobo/bonobo-client-site.h>
#include <bonobo/bonobo-item-container.h>
......@@ -45,6 +46,7 @@ struct NautilusAdapterEmbeddableEmbedStrategyDetails {
BonoboClientSite *client_site;
BonoboViewFrame *view_frame;
GtkWidget *client_widget;
BonoboObject *zoomable;
};
......@@ -57,6 +59,7 @@ static void nautilus_adapter_embeddable_embed_strategy_deactivate (Nautilu
static GtkWidget *nautilus_adapter_embeddable_embed_strategy_get_widget (NautilusAdapterEmbedStrategy *strategy);
static BonoboObject *nautilus_adapter_embeddable_embed_strategy_get_zoomable (NautilusAdapterEmbedStrategy *strategy);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusAdapterEmbeddableEmbedStrategy, nautilus_adapter_embeddable_embed_strategy, NAUTILUS_TYPE_ADAPTER_EMBED_STRATEGY)
......@@ -75,6 +78,7 @@ nautilus_adapter_embeddable_embed_strategy_initialize_class (NautilusAdapterEmbe
adapter_embed_strategy_class = NAUTILUS_ADAPTER_EMBED_STRATEGY_CLASS (klass);
adapter_embed_strategy_class->get_widget = nautilus_adapter_embeddable_embed_strategy_get_widget;
adapter_embed_strategy_class->get_zoomable = nautilus_adapter_embeddable_embed_strategy_get_zoomable;
adapter_embed_strategy_class->activate = nautilus_adapter_embeddable_embed_strategy_activate;
adapter_embed_strategy_class->deactivate = nautilus_adapter_embeddable_embed_strategy_deactivate;
}
......@@ -163,6 +167,9 @@ nautilus_adapter_embeddable_embed_strategy_new (Bonobo_Embeddable embeddable,
Bonobo_UIContainer ui_container)
{
NautilusAdapterEmbeddableEmbedStrategy *strategy;
Bonobo_Zoomable corba_zoomable;
Bonobo_View corba_view;
CORBA_Environment ev;
strategy = NAUTILUS_ADAPTER_EMBEDDABLE_EMBED_STRATEGY (gtk_object_new (NAUTILUS_TYPE_ADAPTER_EMBEDDABLE_EMBED_STRATEGY, NULL));
gtk_object_ref (GTK_OBJECT (strategy));
......@@ -179,6 +186,21 @@ nautilus_adapter_embeddable_embed_strategy_new (Bonobo_Embeddable embeddable,
strategy->details->view_frame = bonobo_client_site_new_view (strategy->details->client_site, ui_container);
strategy->details->client_widget = bonobo_view_frame_get_wrapper (strategy->details->view_frame);
CORBA_exception_init (&ev);
corba_view = bonobo_view_frame_get_view (strategy->details->view_frame);
corba_zoomable = Bonobo_Unknown_queryInterface (corba_view,
"IDL:Bonobo/Zoomable:1.0",
&ev);
if ((ev._major == CORBA_NO_EXCEPTION) &&
!CORBA_Object_is_nil (corba_zoomable, &ev)) {
strategy->details->zoomable = nautilus_zoomable_proxy_get
(corba_zoomable);
}
CORBA_exception_free (&ev);
bonobo_wrapper_set_visibility (BONOBO_WRAPPER (strategy->details->client_widget), FALSE);
bonobo_view_frame_set_covered (strategy->details->view_frame, FALSE);
......@@ -199,5 +221,14 @@ nautilus_adapter_embeddable_embed_strategy_get_widget (NautilusAdapterEmbedStrat
return strategy->details->client_widget;
}
static BonoboObject *
nautilus_adapter_embeddable_embed_strategy_get_zoomable (NautilusAdapterEmbedStrategy *abstract_strategy)
{
NautilusAdapterEmbeddableEmbedStrategy *strategy;
strategy = NAUTILUS_ADAPTER_EMBEDDABLE_EMBED_STRATEGY (abstract_strategy);
return strategy->details->zoomable;
}
......@@ -148,6 +148,7 @@ nautilus_adapter_new (Bonobo_Unknown component)
NautilusAdapter *adapter;
BonoboControl *control;
GtkWidget *bin;
BonoboObject *zoomable;
CORBA_Environment ev;
......@@ -179,6 +180,11 @@ nautilus_adapter_new (Bonobo_Unknown component)
return NULL;
}
/* Get the NautilusAdapterZoomable proxy object. */
zoomable = nautilus_adapter_embed_strategy_get_zoomable (adapter->details->embed_strategy);
if (zoomable != NULL)
bonobo_object_add_interface (BONOBO_OBJECT (control), zoomable);
gtk_signal_connect (GTK_OBJECT (control), "activate",
GTK_SIGNAL_FUNC (nautilus_adapter_activate_callback),
adapter);
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (C) 2000 Eazel, Inc.
* 2000 SuSE GmbH.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Authors: Maciej Stachowiak <mjs@eazel.com>
* Martin Baulig <baulig@suse.de>
*
*/
#include "nautilus-zoomable-proxy.h"
#undef ZOOMABLE_DEBUG
static BonoboZoomableClass *nautilus_zoomable_proxy_parent_class;
static NautilusZoomableProxyClass *nautilus_zoomable_proxy_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;
#define CLASS(o) BONOBO_ZOOMABLE_CLASS(GTK_OBJECT(o)->klass)
static inline NautilusZoomableProxy *
nautilus_zoomable_proxy_from_servant (PortableServer_Servant servant)
{
g_assert (NAUTILUS_IS_ZOOMABLE_PROXY (bonobo_object_from_servant (servant)));
return NAUTILUS_ZOOMABLE_PROXY (bonobo_object_from_servant (servant));
}
static CORBA_float
impl_Nautilus_ZoomableProxy__get_level (PortableServer_Servant servant,
CORBA_Environment *ev)
{
NautilusZoomableProxy *proxy;
proxy = nautilus_zoomable_proxy_from_servant (servant);
return Bonobo_Zoomable__get_level (proxy->priv->remote_zoomable, ev);
}
static CORBA_float
impl_Nautilus_ZoomableProxy__get_minLevel (PortableServer_Servant servant,
CORBA_Environment *ev)
{
NautilusZoomableProxy *proxy;
proxy = nautilus_zoomable_proxy_from_servant (servant);
return Bonobo_Zoomable__get_minLevel (proxy->priv->remote_zoomable, ev);
}
static CORBA_float
impl_Nautilus_ZoomableProxy__get_maxLevel (PortableServer_Servant servant,
CORBA_Environment *ev)
{
NautilusZoomableProxy *proxy;
proxy = nautilus_zoomable_proxy_from_servant (servant);
return Bonobo_Zoomable__get_maxLevel (proxy->priv->remote_zoomable, ev);
}
static CORBA_boolean
impl_Nautilus_ZoomableProxy__get_hasMinLevel (PortableServer_Servant servant,
CORBA_Environment *ev)
{
NautilusZoomableProxy *proxy;
proxy = nautilus_zoomable_proxy_from_servant (servant);
return Bonobo_Zoomable__get_hasMinLevel (proxy->priv->remote_zoomable, ev);
}
static CORBA_boolean
impl_Nautilus_ZoomableProxy__get_hasMaxLevel (PortableServer_Servant servant,
CORBA_Environment *ev)
{
NautilusZoomableProxy *proxy;
proxy = nautilus_zoomable_proxy_from_servant (servant);
return Bonobo_Zoomable__get_hasMaxLevel (proxy->priv->remote_zoomable, ev);
}
static CORBA_boolean
impl_Nautilus_ZoomableProxy__get_isContinuous (PortableServer_Servant servant,
CORBA_Environment *ev)
{
NautilusZoomableProxy *proxy;
proxy = nautilus_zoomable_proxy_from_servant (servant);
return Bonobo_Zoomable__get_isContinuous (proxy->priv->remote_zoomable, ev);
}
static Bonobo_ZoomLevelList *
impl_Nautilus_ZoomableProxy__get_preferredLevels (PortableServer_Servant servant,
CORBA_Environment *ev)
{
NautilusZoomableProxy *proxy;
proxy = nautilus_zoomable_proxy_from_servant (servant);
return Bonobo_Zoomable__get_preferredLevels (proxy->priv->remote_zoomable, ev);
}
static Bonobo_ZoomLevelNameList *
impl_Nautilus_ZoomableProxy__get_preferredLevelNames (PortableServer_Servant servant,
CORBA_Environment *ev)
{
NautilusZoomableProxy *proxy;
proxy = nautilus_zoomable_proxy_from_servant (servant);
return Bonobo_Zoomable__get_preferredLevelNames (proxy->priv->remote_zoomable, ev);
}
static void
impl_Nautilus_ZoomableProxy_setLevel (PortableServer_Servant servant,
const CORBA_float zoom_leve