Commit c81f075c authored by Maciej Stachowiak's avatar Maciej Stachowiak

store zoom_control object in the window.

	* src/ntl-window.c, src/ntl-window.h: store zoom_control object in
	the window.

	* src/nautilus-zoomable-frame-svr.c: New file; implement CORBA
	server for Nautilus::ZommableFrame interface.
	* src/ntl-view-private.h: prototypes for shared stuff needed to make
	this work.
	* src/ntl-view.c: Attach a Nautilus::ZoomableFrame interface to
	the Nautilus::ViewFrame.

	* libnautilus/nautilus-gtk-extensions.h,
	libnautilus/nautilus-gtk-extensions.c
	(nautilus_gtk_marshal_NONE__DOUBLE): New function.
parent fc3403b7
2000-03-10 Maciej Stachowiak <mjs@eazel.com>
* src/ntl-window.c, src/ntl-window.h: store zoom_control object in
the window.
* src/nautilus-zoomable-frame-svr.c: New file; implement CORBA
server for Nautilus::ZommableFrame interface.
* src/ntl-view-private.h: prototypes for shared stuff needed to make
this work.
* src/ntl-view.c: Attach a Nautilus::ZoomableFrame interface to
the Nautilus::ViewFrame.
* libnautilus/nautilus-gtk-extensions.h,
libnautilus/nautilus-gtk-extensions.c
(nautilus_gtk_marshal_NONE__DOUBLE): New function.
* src/ntl-uri-map.c (my_notify_when_ready): Enable both
html-appropriate and directory-appropriate views for
special/webdav-directory mime type (temporary hack).
......
......@@ -229,6 +229,11 @@ typedef void (*NautilusGtkSignal_NONE__POINTER_INT_INT_DOUBLE_DOUBLE) (GtkObject
double arg5,
gpointer user_data);
typedef void (*NautilusGtkSignal_NONE__DOUBLE) (GtkObject * object,
double arg1,
gpointer user_data);
void
nautilus_gtk_marshal_NONE__POINTER_INT_INT_DOUBLE (GtkObject * object,
GtkSignalFunc func,
......@@ -259,3 +264,17 @@ nautilus_gtk_marshal_NONE__POINTER_INT_INT_DOUBLE_DOUBLE (GtkObject * object,
GTK_VALUE_DOUBLE (args[4]),
func_data);
}
void
nautilus_gtk_marshal_NONE__DOUBLE (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args)
{
(* (NautilusGtkSignal_NONE__DOUBLE) func)
(object,
GTK_VALUE_DOUBLE (args[0]),
func_data);
}
......@@ -59,4 +59,10 @@ void nautilus_gtk_marshal_NONE__POINTER_INT_INT_DOUBLE_DOUBLE (GtkO
gpointer func_data,
GtkArg *args);
void nautilus_gtk_marshal_NONE__DOUBLE (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args);
#endif /* NAUTILUS_GTK_EXTENSIONS_H */
......@@ -229,6 +229,11 @@ typedef void (*NautilusGtkSignal_NONE__POINTER_INT_INT_DOUBLE_DOUBLE) (GtkObject
double arg5,
gpointer user_data);
typedef void (*NautilusGtkSignal_NONE__DOUBLE) (GtkObject * object,
double arg1,
gpointer user_data);
void
nautilus_gtk_marshal_NONE__POINTER_INT_INT_DOUBLE (GtkObject * object,
GtkSignalFunc func,
......@@ -259,3 +264,17 @@ nautilus_gtk_marshal_NONE__POINTER_INT_INT_DOUBLE_DOUBLE (GtkObject * object,
GTK_VALUE_DOUBLE (args[4]),
func_data);
}
void
nautilus_gtk_marshal_NONE__DOUBLE (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args)
{
(* (NautilusGtkSignal_NONE__DOUBLE) func)
(object,
GTK_VALUE_DOUBLE (args[0]),
func_data);
}
......@@ -59,4 +59,10 @@ void nautilus_gtk_marshal_NONE__POINTER_INT_INT_DOUBLE_DOUBLE (GtkO
gpointer func_data,
GtkArg *args);
void nautilus_gtk_marshal_NONE__DOUBLE (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args);
#endif /* NAUTILUS_GTK_EXTENSIONS_H */
......@@ -229,6 +229,11 @@ typedef void (*NautilusGtkSignal_NONE__POINTER_INT_INT_DOUBLE_DOUBLE) (GtkObject
double arg5,
gpointer user_data);
typedef void (*NautilusGtkSignal_NONE__DOUBLE) (GtkObject * object,
double arg1,
gpointer user_data);
void
nautilus_gtk_marshal_NONE__POINTER_INT_INT_DOUBLE (GtkObject * object,
GtkSignalFunc func,
......@@ -259,3 +264,17 @@ nautilus_gtk_marshal_NONE__POINTER_INT_INT_DOUBLE_DOUBLE (GtkObject * object,
GTK_VALUE_DOUBLE (args[4]),
func_data);
}
void
nautilus_gtk_marshal_NONE__DOUBLE (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args)
{
(* (NautilusGtkSignal_NONE__DOUBLE) func)
(object,
GTK_VALUE_DOUBLE (args[0]),
func_data);
}
......@@ -59,4 +59,10 @@ void nautilus_gtk_marshal_NONE__POINTER_INT_INT_DOUBLE_DOUBLE (GtkO
gpointer func_data,
GtkArg *args);
void nautilus_gtk_marshal_NONE__DOUBLE (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args);
#endif /* NAUTILUS_GTK_EXTENSIONS_H */
......@@ -467,7 +467,7 @@ nautilus_window_constructed(NautilusWindow *window)
{
GnomeApp *app;
GtkWidget *location_bar_box, *statusbar;
GtkWidget *temp_frame, *zoom_control;
GtkWidget *temp_frame;
GtkWidget *toolbar;
app = GNOME_APP(window);
......@@ -497,9 +497,9 @@ nautilus_window_constructed(NautilusWindow *window)
/* allocate the zoom control and place on the right next to the menu */
zoom_control = nautilus_zoom_control_new();
gtk_widget_show(zoom_control);
gtk_box_pack_end(GTK_BOX(location_bar_box), zoom_control, FALSE, FALSE, 0);
window->zoom_control = nautilus_zoom_control_new ();
gtk_widget_show (window->zoom_control);
gtk_box_pack_end (GTK_BOX (location_bar_box), window->zoom_control, FALSE, FALSE, 0);
gtk_widget_show_all(location_bar_box);
......@@ -1073,14 +1073,13 @@ nautilus_window_real_set_content_view (NautilusWindow *window, NautilusView *new
if (window->content_view != NULL)
{
gtk_container_remove(GTK_CONTAINER(window->content_hbox), GTK_WIDGET(window->content_view));
gtk_container_remove (GTK_CONTAINER(window->content_hbox), GTK_WIDGET(window->content_view));
}
if (new_view != NULL)
{
gtk_widget_show (GTK_WIDGET (new_view));
nautilus_content_view_set_active (NAUTILUS_CONTENT_VIEW (new_view));
#ifdef CONTENTS_AS_HBOX
......
......@@ -84,6 +84,7 @@ struct _NautilusWindow {
GtkWidget *up_button;
GtkWidget *reload_button;
GtkWidget *stop_button;
GtkWidget *zoom_control;
/* Pending changes */
NautilusNavigationInfo *pending_ni;
......
......@@ -467,7 +467,7 @@ nautilus_window_constructed(NautilusWindow *window)
{
GnomeApp *app;
GtkWidget *location_bar_box, *statusbar;
GtkWidget *temp_frame, *zoom_control;
GtkWidget *temp_frame;
GtkWidget *toolbar;
app = GNOME_APP(window);
......@@ -497,9 +497,9 @@ nautilus_window_constructed(NautilusWindow *window)
/* allocate the zoom control and place on the right next to the menu */
zoom_control = nautilus_zoom_control_new();
gtk_widget_show(zoom_control);
gtk_box_pack_end(GTK_BOX(location_bar_box), zoom_control, FALSE, FALSE, 0);
window->zoom_control = nautilus_zoom_control_new ();
gtk_widget_show (window->zoom_control);
gtk_box_pack_end (GTK_BOX (location_bar_box), window->zoom_control, FALSE, FALSE, 0);
gtk_widget_show_all(location_bar_box);
......@@ -1073,14 +1073,13 @@ nautilus_window_real_set_content_view (NautilusWindow *window, NautilusView *new
if (window->content_view != NULL)
{
gtk_container_remove(GTK_CONTAINER(window->content_hbox), GTK_WIDGET(window->content_view));
gtk_container_remove (GTK_CONTAINER(window->content_hbox), GTK_WIDGET(window->content_view));
}
if (new_view != NULL)
{
gtk_widget_show (GTK_WIDGET (new_view));
nautilus_content_view_set_active (NAUTILUS_CONTENT_VIEW (new_view));
#ifdef CONTENTS_AS_HBOX
......
......@@ -84,6 +84,7 @@ struct _NautilusWindow {
GtkWidget *up_button;
GtkWidget *reload_button;
GtkWidget *stop_button;
GtkWidget *zoom_control;
/* Pending changes */
NautilusNavigationInfo *pending_ni;
......
......@@ -467,7 +467,7 @@ nautilus_window_constructed(NautilusWindow *window)
{
GnomeApp *app;
GtkWidget *location_bar_box, *statusbar;
GtkWidget *temp_frame, *zoom_control;
GtkWidget *temp_frame;
GtkWidget *toolbar;
app = GNOME_APP(window);
......@@ -497,9 +497,9 @@ nautilus_window_constructed(NautilusWindow *window)
/* allocate the zoom control and place on the right next to the menu */
zoom_control = nautilus_zoom_control_new();
gtk_widget_show(zoom_control);
gtk_box_pack_end(GTK_BOX(location_bar_box), zoom_control, FALSE, FALSE, 0);
window->zoom_control = nautilus_zoom_control_new ();
gtk_widget_show (window->zoom_control);
gtk_box_pack_end (GTK_BOX (location_bar_box), window->zoom_control, FALSE, FALSE, 0);
gtk_widget_show_all(location_bar_box);
......@@ -1073,14 +1073,13 @@ nautilus_window_real_set_content_view (NautilusWindow *window, NautilusView *new
if (window->content_view != NULL)
{
gtk_container_remove(GTK_CONTAINER(window->content_hbox), GTK_WIDGET(window->content_view));
gtk_container_remove (GTK_CONTAINER(window->content_hbox), GTK_WIDGET(window->content_view));
}
if (new_view != NULL)
{
gtk_widget_show (GTK_WIDGET (new_view));
nautilus_content_view_set_active (NAUTILUS_CONTENT_VIEW (new_view));
#ifdef CONTENTS_AS_HBOX
......
......@@ -84,6 +84,7 @@ struct _NautilusWindow {
GtkWidget *up_button;
GtkWidget *reload_button;
GtkWidget *stop_button;
GtkWidget *zoom_control;
/* Pending changes */
NautilusNavigationInfo *pending_ni;
......
......@@ -30,16 +30,25 @@
#include "nautilus.h"
extern POA_Nautilus_ViewFrame__vepv impl_Nautilus_ViewFrame_vepv;
BonoboObject *impl_Nautilus_ViewFrame__create(NautilusView *view, CORBA_Environment * ev);
void nautilus_view_request_location_change(NautilusView *view,
Nautilus_NavigationRequestInfo *loc);
void nautilus_view_request_selection_change(NautilusView *view,
Nautilus_SelectionRequestInfo *loc);
void nautilus_view_request_status_change(NautilusView *view,
Nautilus_StatusRequestInfo *loc);
void nautilus_view_request_progress_change(NautilusView *view,
Nautilus_ProgressRequestInfo *loc);
extern POA_Nautilus_ZoomableFrame__vepv impl_Nautilus_ZoomableFrame_vepv;
BonoboObject *impl_Nautilus_ViewFrame__create (NautilusView *view,
CORBA_Environment * ev);
BonoboObject *impl_Nautilus_ZoomableFrame__create (NautilusView *view,
CORBA_Environment * ev);
void nautilus_view_request_location_change (NautilusView *view,
Nautilus_NavigationRequestInfo *loc);
void nautilus_view_request_selection_change (NautilusView *view,
Nautilus_SelectionRequestInfo *loc);
void nautilus_view_request_status_change (NautilusView *view,
Nautilus_StatusRequestInfo *loc);
void nautilus_view_request_progress_change (NautilusView *view,
Nautilus_ProgressRequestInfo *loc);
void nautilus_view_notify_zoom_level (NautilusView *view,
double level);
struct _NautilusViewComponentType {
const char *primary_repoid;
......
......@@ -27,16 +27,18 @@
and its associated CORBA object for proxying requests into this
object. */
#include "ntl-view-private.h"
#include "nautilus.h"
#include <libnautilus/nautilus-gtk-extensions.h>
#include <gtk/gtksignal.h>
#include <gtk/gtk.h>
#include "nautilus.h"
#include "ntl-view-private.h"
enum {
REQUEST_LOCATION_CHANGE,
REQUEST_SELECTION_CHANGE,
REQUEST_STATUS_CHANGE,
REQUEST_PROGRESS_CHANGE,
NOTIFY_ZOOM_LEVEL,
LAST_SIGNAL
};
......@@ -131,6 +133,10 @@ nautilus_view_class_init (NautilusViewClass *klass)
klass->servant_destroy_func = POA_Nautilus_ViewFrame__fini;
klass->vepv = &impl_Nautilus_ViewFrame_vepv;
klass->zoomable_servant_init_func = POA_Nautilus_ZoomableFrame__init;
klass->zoomable_servant_destroy_func = POA_Nautilus_ZoomableFrame__fini;
klass->zoomable_vepv = &impl_Nautilus_ZoomableFrame_vepv;
klass->parent_class = gtk_type_class (gtk_type_parent (object_class->type));
/* klass->request_location_change = NULL; */
/* klass->request_selection_change = NULL; */
......@@ -167,6 +173,14 @@ nautilus_view_class_init (NautilusViewClass *klass)
gtk_marshal_NONE__BOXED,
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
nautilus_view_signals[NOTIFY_ZOOM_LEVEL] = gtk_signal_new("notify_zoom_level",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (NautilusViewClass,
notify_zoom_level),
nautilus_gtk_marshal_NONE__DOUBLE,
GTK_TYPE_NONE, 1, GTK_TYPE_DOUBLE);
gtk_object_class_add_signals (object_class, nautilus_view_signals, LAST_SIGNAL);
......@@ -338,6 +352,8 @@ gboolean /* returns TRUE if successful */
nautilus_view_load_client(NautilusView *view, const char *iid)
{
CORBA_Object obj;
CORBA_Object zoomable;
CORBA_Environment ev;
int i;
NautilusViewComponentType *component_types[] = {
......@@ -359,6 +375,7 @@ nautilus_view_load_client(NautilusView *view, const char *iid)
return FALSE;
view->view_frame = impl_Nautilus_ViewFrame__create(view, &ev);
view->zoomable_frame = impl_Nautilus_ZoomableFrame__create(view, &ev);
/* Now figure out which type of embedded object it is: */
......@@ -372,6 +389,11 @@ nautilus_view_load_client(NautilusView *view, const char *iid)
if(CORBA_Object_is_nil(obj, &ev))
continue;
zoomable = bonobo_object_query_interface (BONOBO_OBJECT (view->client_object),
"IDL:Nautilus/Zoomable:1.0");
view->zoomable = zoomable;
if(component_types[i]->try_load(view, obj, &ev))
view->component_class = component_types[i];
......@@ -519,6 +541,182 @@ nautilus_view_stop_location_change(NautilusView *view)
}
gboolean
nautilus_view_is_zoomable (NautilusView *view)
{
CORBA_Environment ev;
gboolean retval;
CORBA_exception_init (&ev);
retval = CORBA_Object_is_nil (view->zoomable, &ev);
CORBA_exception_free (&ev);
return retval;
}
gdouble
nautilus_view_get_zoom_level (NautilusView *view)
{
CORBA_Environment ev;
gdouble retval;
g_return_val_if_fail (view, 0);
CORBA_exception_init (&ev);
if (!CORBA_Object_is_nil (view->zoomable, &ev)) {
retval = Nautilus_Zoomable__get_zoom_level (view->zoomable, &ev);
} else {
retval = 1.0;
}
CORBA_exception_free (&ev);
return retval;
}
void
nautilus_view_set_zoom_level (NautilusView *view,
gdouble zoom_level)
{
CORBA_Environment ev;
g_return_if_fail (view);
CORBA_exception_init (&ev);
if (!CORBA_Object_is_nil (view->zoomable, &ev)) {
Nautilus_Zoomable__set_zoom_level (view->zoomable, zoom_level, &ev);
} else {
/* do nothing */
}
CORBA_exception_free (&ev);
}
gdouble
nautilus_view_get_min_zoom_level (NautilusView *view)
{
CORBA_Environment ev;
gdouble retval;
g_return_val_if_fail (view, 0);
CORBA_exception_init (&ev);
if (!CORBA_Object_is_nil (view->zoomable, &ev)) {
retval = Nautilus_Zoomable__get_min_zoom_level (view->zoomable, &ev);
} else {
retval = 1.0;
}
CORBA_exception_free (&ev);
return retval;
}
gdouble
nautilus_view_get_max_zoom_level (NautilusView *view)
{
CORBA_Environment ev;
gdouble retval;
g_return_val_if_fail (view, 0);
CORBA_exception_init (&ev);
if (!CORBA_Object_is_nil (view->zoomable, &ev)) {
retval = Nautilus_Zoomable__get_max_zoom_level (view->zoomable, &ev);
} else {
retval = 1.0;
}
CORBA_exception_free (&ev);
return retval;
}
gboolean
nautilus_view_get_is_continuous (NautilusView *view)
{
CORBA_Environment ev;
gboolean retval;
g_return_val_if_fail (view, FALSE);
CORBA_exception_init (&ev);
if (!CORBA_Object_is_nil (view->zoomable, &ev)) {
retval = Nautilus_Zoomable__get_zoom_level (view->zoomable, &ev);
} else {
retval = FALSE;
}
CORBA_exception_free (&ev);
return retval;
}
void
nautilus_view_zoom_in (NautilusView *view)
{
CORBA_Environment ev;
g_return_if_fail(view);
CORBA_exception_init (&ev);
if (!CORBA_Object_is_nil (view->zoomable, &ev)) {
Nautilus_Zoomable_zoom_in (view->zoomable, &ev);
} else {
/* do nothing */
}
CORBA_exception_free (&ev);
}
void
nautilus_view_zoom_out (NautilusView *view)
{
CORBA_Environment ev;
g_return_if_fail(view);
CORBA_exception_init (&ev);
if (!CORBA_Object_is_nil (view->zoomable, &ev)) {
Nautilus_Zoomable_zoom_out (view->zoomable, &ev);
} else {
/* do nothing */
}
CORBA_exception_free (&ev);
}
void
nautilus_view_zoom_to_fit (NautilusView *view)
{
CORBA_Environment ev;
g_return_if_fail(view);
CORBA_exception_init (&ev);
if (!CORBA_Object_is_nil (view->zoomable, &ev)) {
Nautilus_Zoomable_zoom_to_fit (view->zoomable, &ev);
} else {
/* do nothing */
}
CORBA_exception_free (&ev);
}
const char *
nautilus_view_get_iid(NautilusView *view)
{
......@@ -566,6 +764,14 @@ nautilus_view_request_progress_change(NautilusView *view,
gtk_signal_emit(GTK_OBJECT(view), nautilus_view_signals[REQUEST_PROGRESS_CHANGE], loc);
}
void
nautilus_view_notify_zoom_level (NautilusView *view,
gdouble level)
{
gtk_signal_emit (GTK_OBJECT (view), nautilus_view_signals[NOTIFY_ZOOM_LEVEL], level);
}
static gboolean
check_object(NautilusView *view)
{
......
......@@ -63,6 +63,8 @@ struct _NautilusViewClass
Nautilus_StatusRequestInfo *loc);
void (*request_progress_change) (NautilusView *view,
Nautilus_ProgressRequestInfo *loc);
void (*notify_zoom_level) (NautilusView *view,
gdouble zoom_level);
/* Not a signal. Work-around for Gtk+'s lack of a 'constructed' operation */
void (*view_constructed) (NautilusView *view);
......@@ -71,6 +73,7 @@ struct _NautilusViewClass
guint num_construct_args;
gpointer servant_init_func, servant_destroy_func, vepv;
gpointer zoomable_servant_init_func, zoomable_servant_destroy_func, zoomable_vepv;
};
typedef struct _NautilusViewComponentType NautilusViewComponentType;
......@@ -87,7 +90,9 @@ struct _NautilusView
GtkWidget *client_widget;
BonoboObject *view_frame;
BonoboObject *zoomable_frame;
Nautilus_Zoomable zoomable;
NautilusViewComponentType *component_class;
gpointer component_data;
......@@ -119,6 +124,19 @@ void nautilus_view_show_properties (NautilusView *view);
void nautilus_view_stop_location_change (NautilusView *view);
void nautilus_view_set_active_errors (NautilusView *view, gboolean enabled);
gboolean nautilus_view_is_zoomable (NautilusView *view);
gdouble nautilus_view_get_zoom_level (NautilusView *view);
void nautilus_view_set_zoom_level (NautilusView *view,
gdouble zoom_level);
gdouble nautilus_view_get_min_zoom_level (NautilusView *view);
gdouble nautilus_view_get_max_zoom_level (NautilusView *view);
gboolean nautilus_view_get_is_continuous (NautilusView *view);
void nautilus_view_zoom_in (NautilusView *view);
void nautilus_view_zoom_out (NautilusView *view);
void nautilus_view_zoom_to_fit (NautilusView *view);
/* This is a "protected" operation */
void nautilus_view_construct_arg_set(NautilusView *view);
......
......@@ -467,7 +467,7 @@ nautilus_window_constructed(NautilusWindow *window)
{
GnomeApp *app;
GtkWidget *location_bar_box, *statusbar;
GtkWidget *temp_frame, *zoom_control;
GtkWidget *temp_frame;
GtkWidget *toolbar;