mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-27 11:29:24 +00:00
Implement libnautilus.
Implement libnautilus. Normalize the way requests and notifications are passed around.
This commit is contained in:
parent
44302b3c22
commit
1d23907d45
|
@ -1 +1 @@
|
|||
SUBDIRS=src
|
||||
SUBDIRS=libnautilus src
|
||||
|
|
|
@ -40,5 +40,6 @@ AC_C_CONST
|
|||
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
libnautilus/Makefile
|
||||
src/Makefile
|
||||
])
|
||||
|
|
2
docs/design.txt
Normal file
2
docs/design.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
Factors that influence how a URL will be displayed:
|
||||
In a new window or not
|
37
idl/nautilus.idl
Normal file
37
idl/nautilus.idl
Normal file
|
@ -0,0 +1,37 @@
|
|||
#include <gnome-unknown.idl>
|
||||
|
||||
module Nautilus {
|
||||
enum TruthValue { V_UNKNOWN, V_FALSE, V_TRUE };
|
||||
struct NavigationRequestInfo {
|
||||
string requested_uri;
|
||||
TruthValue new_window_default, new_window_suggested, new_window_enforced;
|
||||
};
|
||||
|
||||
struct NavigationInfo {
|
||||
string requested_uri, actual_uri, content_type;
|
||||
string referring_uri, actual_referring_uri, referring_content_type;
|
||||
};
|
||||
|
||||
struct SelectionInfo {
|
||||
string selected_uri;
|
||||
};
|
||||
|
||||
struct SelectionRequestInfo {
|
||||
string selected_uri;
|
||||
};
|
||||
|
||||
interface View : ::GNOME::Unknown {
|
||||
void save_state(in string config_path);
|
||||
void load_state(in string config_path);
|
||||
oneway void notify_location_change(in NavigationInfo navinfo);
|
||||
|
||||
oneway void show_properties(); // Requests that the client show its properties
|
||||
|
||||
oneway void notify_selection_change(in SelectionInfo selinfo);
|
||||
};
|
||||
|
||||
interface ViewFrame : ::GNOME::Unknown {
|
||||
oneway void request_location_change(in NavigationRequestInfo navinfo);
|
||||
oneway void request_selection_change(in SelectionRequestInfo selinfo);
|
||||
};
|
||||
};
|
22
libnautilus-extensions/Makefile.am
Normal file
22
libnautilus-extensions/Makefile.am
Normal file
|
@ -0,0 +1,22 @@
|
|||
lib_LTLIBRARIES=libnautilus.la
|
||||
|
||||
INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GNOME_CFLAGS) $(GNORBA_CFLAGS)
|
||||
|
||||
nautilus_idl_sources=nautilus-stubs.c nautilus-skels.c nautilus.h nautilus-common.c
|
||||
BUILT_SOURCES=$(nautilus_idl_sources)
|
||||
|
||||
libnautilusincludedir=$(includedir)/libnautilus
|
||||
libnautilusinclude_HEADERS= \
|
||||
ntl-view-client.h \
|
||||
nautilus.h
|
||||
|
||||
libnautilus_la_SOURCES=$(nautilus_idl_sources) \
|
||||
ntl-view-client.c
|
||||
|
||||
$(nautilus_idl_sources): nautilus_idl_stamp
|
||||
|
||||
nautilus_idl_stamp: $(top_srcdir)/idl/nautilus.idl
|
||||
orbit-idl `gnome-config --cflags idl` $(top_srcdir)/idl/nautilus.idl
|
||||
touch nautilus_idl_stamp
|
||||
|
||||
CLEANFILES=nautilus_idl_stamp
|
8
libnautilus-extensions/libnautilus.h
Normal file
8
libnautilus-extensions/libnautilus.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef LIBNAUTILUS_H
|
||||
#define LIBNAUTILUS_H 1
|
||||
|
||||
#include <bonobo/gnome-bonobo.h>
|
||||
#include <libnautilus/nautilus.h>
|
||||
#include <libnautilus/ntl-view-client.h>
|
||||
|
||||
#endif
|
383
libnautilus-extensions/ntl-view-client.c
Normal file
383
libnautilus-extensions/ntl-view-client.c
Normal file
|
@ -0,0 +1,383 @@
|
|||
/* ntl-view-client.c
|
||||
* Copyright (C) 1999 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "libnautilus.h"
|
||||
|
||||
typedef struct {
|
||||
POA_Nautilus_View servant;
|
||||
gpointer gnome_object;
|
||||
|
||||
NautilusViewClient *view;
|
||||
} impl_POA_Nautilus_View;
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_save_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_load_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_location_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_NavigationInfo * navinfo,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_show_properties(impl_POA_Nautilus_View * servant,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_SelectionInfo * selinfo,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static POA_Nautilus_View__epv impl_Nautilus_View_epv =
|
||||
{
|
||||
NULL, /* _private */
|
||||
(gpointer) & impl_Nautilus_View_save_state,
|
||||
(gpointer) & impl_Nautilus_View_load_state,
|
||||
(gpointer) & impl_Nautilus_View_notify_location_change,
|
||||
(gpointer) & impl_Nautilus_View_show_properties,
|
||||
(gpointer) & impl_Nautilus_View_notify_selection_change
|
||||
};
|
||||
|
||||
static POA_Nautilus_View__vepv impl_Nautilus_View_vepv =
|
||||
{
|
||||
&gnome_object_base_epv,
|
||||
&gnome_object_epv,
|
||||
&impl_Nautilus_View_epv
|
||||
};
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_save_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "save_state", config_path);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_load_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "load_state", config_path);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_location_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_NavigationInfo * navinfo,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "notify_location_change", navinfo);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_show_properties(impl_POA_Nautilus_View * servant,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "show_properties");
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_SelectionInfo * selinfo,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "notify_selection_change", selinfo);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
impl_Nautilus_View__destroy(GnomeObject *obj, impl_POA_Nautilus_View *servant)
|
||||
{
|
||||
PortableServer_ObjectId *objid;
|
||||
CORBA_Environment ev;
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
|
||||
objid = PortableServer_POA_servant_to_id(bonobo_poa(), servant, &ev);
|
||||
PortableServer_POA_deactivate_object(bonobo_poa(), objid, &ev);
|
||||
CORBA_free(objid);
|
||||
obj->servant = NULL;
|
||||
|
||||
POA_Nautilus_View__fini((PortableServer_Servant) servant, &ev);
|
||||
g_free(servant);
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static GnomeObject *
|
||||
impl_Nautilus_View__create(NautilusViewClient *view, CORBA_Environment * ev)
|
||||
{
|
||||
GnomeObject *retval;
|
||||
impl_POA_Nautilus_View *newservant;
|
||||
|
||||
newservant = g_new0(impl_POA_Nautilus_View, 1);
|
||||
newservant->servant.vepv = &impl_Nautilus_View_vepv;
|
||||
newservant->view = view;
|
||||
POA_Nautilus_View__init((PortableServer_Servant) newservant, ev);
|
||||
|
||||
retval = gnome_object_new_from_servant(newservant);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(retval), "destroy", GTK_SIGNAL_FUNC(impl_Nautilus_View__destroy), newservant);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void nautilus_view_client_init (NautilusViewClient *view);
|
||||
static void nautilus_view_client_destroy (NautilusViewClient *view);
|
||||
static void nautilus_view_client_class_init (NautilusViewClientClass *klass);
|
||||
static void nautilus_view_client_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_view_client_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_view_client_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void nautilus_view_client_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
|
||||
GtkType
|
||||
nautilus_view_client_get_type (void)
|
||||
{
|
||||
static GtkType view_client_type = 0;
|
||||
|
||||
if (!view_client_type) {
|
||||
const GtkTypeInfo view_client_info = {
|
||||
"NautilusViewClient",
|
||||
sizeof (NautilusViewClient),
|
||||
sizeof (NautilusViewClientClass),
|
||||
(GtkClassInitFunc) nautilus_view_client_class_init,
|
||||
(GtkObjectInitFunc) nautilus_view_client_init,
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserved_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL,
|
||||
};
|
||||
|
||||
view_client_type = gtk_type_unique (gtk_bin_get_type(), &view_client_info);
|
||||
}
|
||||
|
||||
return view_client_type;
|
||||
}
|
||||
|
||||
#if 0
|
||||
typedef void (*GtkSignal_NONE__BOXED_OBJECT_BOXED) (GtkObject * object,
|
||||
gpointer arg1,
|
||||
GtkObject *arg2,
|
||||
gpointer arg3,
|
||||
gpointer user_data);
|
||||
static void
|
||||
gtk_marshal_NONE__BOXED_OBJECT_BOXED (GtkObject * object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data,
|
||||
GtkArg * args)
|
||||
{
|
||||
GtkSignal_NONE__BOXED_OBJECT_BOXED rfunc;
|
||||
rfunc = (GtkSignal_NONE__BOXED_OBJECT_BOXED) func;
|
||||
(*rfunc) (object,
|
||||
GTK_VALUE_BOXED (args[0]),
|
||||
GTK_VALUE_OBJECT (args[1]),
|
||||
GTK_VALUE_BOXED (args[2]),
|
||||
func_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
nautilus_view_client_class_init (NautilusViewClientClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
int i;
|
||||
|
||||
object_class = (GtkObjectClass*) klass;
|
||||
object_class->destroy = (void (*)(GtkObject*))nautilus_view_client_destroy;
|
||||
object_class->set_arg = nautilus_view_client_set_arg;
|
||||
object_class->get_arg = nautilus_view_client_get_arg;
|
||||
|
||||
widget_class = (GtkWidgetClass*) klass;
|
||||
widget_class->size_request = nautilus_view_client_size_request;
|
||||
widget_class->size_allocate = nautilus_view_client_size_allocate;
|
||||
|
||||
klass->notify_location_change = NULL;
|
||||
|
||||
klass->parent_class = gtk_type_class (gtk_type_parent (object_class->type));
|
||||
|
||||
i = 0;
|
||||
klass->view_client_signals[i++] = gtk_signal_new("notify_location_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, notify_location_change),
|
||||
gtk_marshal_NONE__BOXED,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("load_state",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, load_state),
|
||||
gtk_marshal_NONE__STRING,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_STRING);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("save_state",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, save_state),
|
||||
gtk_marshal_NONE__STRING,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_STRING);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("show_properties",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, show_properties),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("notify_selection_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, notify_selection_change),
|
||||
gtk_marshal_NONE__BOXED,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
|
||||
gtk_object_class_add_signals (object_class, klass->view_client_signals, i);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_init (NautilusViewClient *view)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
GTK_WIDGET_SET_FLAGS (view, GTK_NO_WINDOW);
|
||||
|
||||
view->control = GNOME_OBJECT(gnome_control_new(GTK_WIDGET(view)));
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
view->view_client = impl_Nautilus_View__create(view, &ev);
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_destroy (NautilusViewClient *view)
|
||||
{
|
||||
gtk_object_destroy(GTK_OBJECT(view->view_client));
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_view_client_request_location_change(NautilusViewClient *view,
|
||||
Nautilus_NavigationRequestInfo *loc)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
|
||||
g_return_if_fail (view != NULL);
|
||||
g_return_if_fail (NAUTILUS_IS_VIEW_CLIENT (view));
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
view->view_frame = GNOME_Unknown_query_interface(gnome_control_get_control_frame(GNOME_CONTROL(view->control)),
|
||||
"IDL:Nautilus/ViewFrame:1.0", &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
return;
|
||||
|
||||
Nautilus_ViewFrame_request_location_change(view->view_frame, loc, &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
{
|
||||
CORBA_Object_release(view->view_frame, &ev);
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
}
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_view_client_request_selection_change (NautilusViewClient *view,
|
||||
Nautilus_SelectionRequestInfo *loc)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
|
||||
g_return_if_fail (view != NULL);
|
||||
g_return_if_fail (NAUTILUS_IS_VIEW_CLIENT (view));
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
view->view_frame = GNOME_Unknown_query_interface(gnome_control_get_control_frame(GNOME_CONTROL(view->control)),
|
||||
"IDL:Nautilus/ViewFrame:1.0", &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
return;
|
||||
|
||||
Nautilus_ViewFrame_request_selection_change(view->view_frame, loc, &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
{
|
||||
CORBA_Object_release(view->view_frame, &ev);
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
}
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
GtkBin *bin;
|
||||
|
||||
bin = GTK_BIN (widget);
|
||||
|
||||
requisition->width = 0;
|
||||
requisition->height = 0;
|
||||
|
||||
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
|
||||
{
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
gtk_widget_size_request (bin->child, &child_requisition);
|
||||
|
||||
requisition->width += child_requisition.width;
|
||||
requisition->height += child_requisition.height;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkBin *bin;
|
||||
GtkAllocation child_allocation;
|
||||
|
||||
widget->allocation = child_allocation = *allocation;
|
||||
bin = GTK_BIN (widget);
|
||||
|
||||
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
|
||||
gtk_widget_size_allocate (bin->child, &child_allocation);
|
||||
}
|
55
libnautilus-extensions/ntl-view-client.h
Normal file
55
libnautilus-extensions/ntl-view-client.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
#ifndef NTL_VIEW_CLIENT_H
|
||||
#define NTL_VIEW_CLIENT_H
|
||||
|
||||
#include <gtk/gtkobject.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define NAUTILUS_TYPE_VIEW_CLIENT (nautilus_view_client_get_type ())
|
||||
#define NAUTILUS_VIEW_CLIENT(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_VIEW_CLIENT, NautilusViewClient))
|
||||
#define NAUTILUS_VIEW_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_VIEW_CLIENT, NautilusViewClientClass))
|
||||
#define NAUTILUS_IS_VIEW_CLIENT(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_VIEW_CLIENT))
|
||||
#define NAUTILUS_IS_VIEW_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), NAUTILUS_TYPE_VIEW_CLIENT))
|
||||
|
||||
typedef struct _NautilusViewClient NautilusViewClient;
|
||||
typedef struct _NautilusViewClientClass NautilusViewClientClass;
|
||||
|
||||
struct _NautilusViewClientClass
|
||||
{
|
||||
GtkBinClass parent_spot;
|
||||
|
||||
void (*notify_location_change) (NautilusViewClient *view,
|
||||
Nautilus_NavigationInfo *nav_context);
|
||||
void (*notify_selection_change) (NautilusViewClient *view,
|
||||
Nautilus_SelectionInfo *nav_context);
|
||||
void (*load_state) (NautilusViewClient *view, const char *config_path);
|
||||
void (*save_state) (NautilusViewClient *view, const char *config_path);
|
||||
void (*show_properties) (NautilusViewClient *view);
|
||||
|
||||
GtkBinClass *parent_class;
|
||||
guint view_client_signals[5];
|
||||
};
|
||||
|
||||
struct _NautilusViewClient
|
||||
{
|
||||
GtkBin parent;
|
||||
|
||||
GtkWidget *main_window;
|
||||
|
||||
GnomeObject *control, *view_client;
|
||||
Nautilus_ViewFrame view_frame;
|
||||
};
|
||||
|
||||
GtkType nautilus_view_client_get_type (void);
|
||||
void nautilus_view_client_request_location_change (NautilusViewClient *view,
|
||||
Nautilus_NavigationRequestInfo *loc);
|
||||
void nautilus_view_client_request_selection_change (NautilusViewClient *view,
|
||||
Nautilus_SelectionRequestInfo *loc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
22
libnautilus-private/Makefile.am
Normal file
22
libnautilus-private/Makefile.am
Normal file
|
@ -0,0 +1,22 @@
|
|||
lib_LTLIBRARIES=libnautilus.la
|
||||
|
||||
INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GNOME_CFLAGS) $(GNORBA_CFLAGS)
|
||||
|
||||
nautilus_idl_sources=nautilus-stubs.c nautilus-skels.c nautilus.h nautilus-common.c
|
||||
BUILT_SOURCES=$(nautilus_idl_sources)
|
||||
|
||||
libnautilusincludedir=$(includedir)/libnautilus
|
||||
libnautilusinclude_HEADERS= \
|
||||
ntl-view-client.h \
|
||||
nautilus.h
|
||||
|
||||
libnautilus_la_SOURCES=$(nautilus_idl_sources) \
|
||||
ntl-view-client.c
|
||||
|
||||
$(nautilus_idl_sources): nautilus_idl_stamp
|
||||
|
||||
nautilus_idl_stamp: $(top_srcdir)/idl/nautilus.idl
|
||||
orbit-idl `gnome-config --cflags idl` $(top_srcdir)/idl/nautilus.idl
|
||||
touch nautilus_idl_stamp
|
||||
|
||||
CLEANFILES=nautilus_idl_stamp
|
8
libnautilus-private/libnautilus.h
Normal file
8
libnautilus-private/libnautilus.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef LIBNAUTILUS_H
|
||||
#define LIBNAUTILUS_H 1
|
||||
|
||||
#include <bonobo/gnome-bonobo.h>
|
||||
#include <libnautilus/nautilus.h>
|
||||
#include <libnautilus/ntl-view-client.h>
|
||||
|
||||
#endif
|
383
libnautilus-private/ntl-view-client.c
Normal file
383
libnautilus-private/ntl-view-client.c
Normal file
|
@ -0,0 +1,383 @@
|
|||
/* ntl-view-client.c
|
||||
* Copyright (C) 1999 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "libnautilus.h"
|
||||
|
||||
typedef struct {
|
||||
POA_Nautilus_View servant;
|
||||
gpointer gnome_object;
|
||||
|
||||
NautilusViewClient *view;
|
||||
} impl_POA_Nautilus_View;
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_save_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_load_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_location_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_NavigationInfo * navinfo,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_show_properties(impl_POA_Nautilus_View * servant,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_SelectionInfo * selinfo,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static POA_Nautilus_View__epv impl_Nautilus_View_epv =
|
||||
{
|
||||
NULL, /* _private */
|
||||
(gpointer) & impl_Nautilus_View_save_state,
|
||||
(gpointer) & impl_Nautilus_View_load_state,
|
||||
(gpointer) & impl_Nautilus_View_notify_location_change,
|
||||
(gpointer) & impl_Nautilus_View_show_properties,
|
||||
(gpointer) & impl_Nautilus_View_notify_selection_change
|
||||
};
|
||||
|
||||
static POA_Nautilus_View__vepv impl_Nautilus_View_vepv =
|
||||
{
|
||||
&gnome_object_base_epv,
|
||||
&gnome_object_epv,
|
||||
&impl_Nautilus_View_epv
|
||||
};
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_save_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "save_state", config_path);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_load_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "load_state", config_path);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_location_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_NavigationInfo * navinfo,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "notify_location_change", navinfo);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_show_properties(impl_POA_Nautilus_View * servant,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "show_properties");
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_SelectionInfo * selinfo,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "notify_selection_change", selinfo);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
impl_Nautilus_View__destroy(GnomeObject *obj, impl_POA_Nautilus_View *servant)
|
||||
{
|
||||
PortableServer_ObjectId *objid;
|
||||
CORBA_Environment ev;
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
|
||||
objid = PortableServer_POA_servant_to_id(bonobo_poa(), servant, &ev);
|
||||
PortableServer_POA_deactivate_object(bonobo_poa(), objid, &ev);
|
||||
CORBA_free(objid);
|
||||
obj->servant = NULL;
|
||||
|
||||
POA_Nautilus_View__fini((PortableServer_Servant) servant, &ev);
|
||||
g_free(servant);
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static GnomeObject *
|
||||
impl_Nautilus_View__create(NautilusViewClient *view, CORBA_Environment * ev)
|
||||
{
|
||||
GnomeObject *retval;
|
||||
impl_POA_Nautilus_View *newservant;
|
||||
|
||||
newservant = g_new0(impl_POA_Nautilus_View, 1);
|
||||
newservant->servant.vepv = &impl_Nautilus_View_vepv;
|
||||
newservant->view = view;
|
||||
POA_Nautilus_View__init((PortableServer_Servant) newservant, ev);
|
||||
|
||||
retval = gnome_object_new_from_servant(newservant);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(retval), "destroy", GTK_SIGNAL_FUNC(impl_Nautilus_View__destroy), newservant);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void nautilus_view_client_init (NautilusViewClient *view);
|
||||
static void nautilus_view_client_destroy (NautilusViewClient *view);
|
||||
static void nautilus_view_client_class_init (NautilusViewClientClass *klass);
|
||||
static void nautilus_view_client_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_view_client_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_view_client_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void nautilus_view_client_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
|
||||
GtkType
|
||||
nautilus_view_client_get_type (void)
|
||||
{
|
||||
static GtkType view_client_type = 0;
|
||||
|
||||
if (!view_client_type) {
|
||||
const GtkTypeInfo view_client_info = {
|
||||
"NautilusViewClient",
|
||||
sizeof (NautilusViewClient),
|
||||
sizeof (NautilusViewClientClass),
|
||||
(GtkClassInitFunc) nautilus_view_client_class_init,
|
||||
(GtkObjectInitFunc) nautilus_view_client_init,
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserved_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL,
|
||||
};
|
||||
|
||||
view_client_type = gtk_type_unique (gtk_bin_get_type(), &view_client_info);
|
||||
}
|
||||
|
||||
return view_client_type;
|
||||
}
|
||||
|
||||
#if 0
|
||||
typedef void (*GtkSignal_NONE__BOXED_OBJECT_BOXED) (GtkObject * object,
|
||||
gpointer arg1,
|
||||
GtkObject *arg2,
|
||||
gpointer arg3,
|
||||
gpointer user_data);
|
||||
static void
|
||||
gtk_marshal_NONE__BOXED_OBJECT_BOXED (GtkObject * object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data,
|
||||
GtkArg * args)
|
||||
{
|
||||
GtkSignal_NONE__BOXED_OBJECT_BOXED rfunc;
|
||||
rfunc = (GtkSignal_NONE__BOXED_OBJECT_BOXED) func;
|
||||
(*rfunc) (object,
|
||||
GTK_VALUE_BOXED (args[0]),
|
||||
GTK_VALUE_OBJECT (args[1]),
|
||||
GTK_VALUE_BOXED (args[2]),
|
||||
func_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
nautilus_view_client_class_init (NautilusViewClientClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
int i;
|
||||
|
||||
object_class = (GtkObjectClass*) klass;
|
||||
object_class->destroy = (void (*)(GtkObject*))nautilus_view_client_destroy;
|
||||
object_class->set_arg = nautilus_view_client_set_arg;
|
||||
object_class->get_arg = nautilus_view_client_get_arg;
|
||||
|
||||
widget_class = (GtkWidgetClass*) klass;
|
||||
widget_class->size_request = nautilus_view_client_size_request;
|
||||
widget_class->size_allocate = nautilus_view_client_size_allocate;
|
||||
|
||||
klass->notify_location_change = NULL;
|
||||
|
||||
klass->parent_class = gtk_type_class (gtk_type_parent (object_class->type));
|
||||
|
||||
i = 0;
|
||||
klass->view_client_signals[i++] = gtk_signal_new("notify_location_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, notify_location_change),
|
||||
gtk_marshal_NONE__BOXED,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("load_state",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, load_state),
|
||||
gtk_marshal_NONE__STRING,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_STRING);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("save_state",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, save_state),
|
||||
gtk_marshal_NONE__STRING,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_STRING);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("show_properties",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, show_properties),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("notify_selection_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, notify_selection_change),
|
||||
gtk_marshal_NONE__BOXED,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
|
||||
gtk_object_class_add_signals (object_class, klass->view_client_signals, i);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_init (NautilusViewClient *view)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
GTK_WIDGET_SET_FLAGS (view, GTK_NO_WINDOW);
|
||||
|
||||
view->control = GNOME_OBJECT(gnome_control_new(GTK_WIDGET(view)));
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
view->view_client = impl_Nautilus_View__create(view, &ev);
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_destroy (NautilusViewClient *view)
|
||||
{
|
||||
gtk_object_destroy(GTK_OBJECT(view->view_client));
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_view_client_request_location_change(NautilusViewClient *view,
|
||||
Nautilus_NavigationRequestInfo *loc)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
|
||||
g_return_if_fail (view != NULL);
|
||||
g_return_if_fail (NAUTILUS_IS_VIEW_CLIENT (view));
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
view->view_frame = GNOME_Unknown_query_interface(gnome_control_get_control_frame(GNOME_CONTROL(view->control)),
|
||||
"IDL:Nautilus/ViewFrame:1.0", &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
return;
|
||||
|
||||
Nautilus_ViewFrame_request_location_change(view->view_frame, loc, &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
{
|
||||
CORBA_Object_release(view->view_frame, &ev);
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
}
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_view_client_request_selection_change (NautilusViewClient *view,
|
||||
Nautilus_SelectionRequestInfo *loc)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
|
||||
g_return_if_fail (view != NULL);
|
||||
g_return_if_fail (NAUTILUS_IS_VIEW_CLIENT (view));
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
view->view_frame = GNOME_Unknown_query_interface(gnome_control_get_control_frame(GNOME_CONTROL(view->control)),
|
||||
"IDL:Nautilus/ViewFrame:1.0", &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
return;
|
||||
|
||||
Nautilus_ViewFrame_request_selection_change(view->view_frame, loc, &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
{
|
||||
CORBA_Object_release(view->view_frame, &ev);
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
}
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
GtkBin *bin;
|
||||
|
||||
bin = GTK_BIN (widget);
|
||||
|
||||
requisition->width = 0;
|
||||
requisition->height = 0;
|
||||
|
||||
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
|
||||
{
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
gtk_widget_size_request (bin->child, &child_requisition);
|
||||
|
||||
requisition->width += child_requisition.width;
|
||||
requisition->height += child_requisition.height;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkBin *bin;
|
||||
GtkAllocation child_allocation;
|
||||
|
||||
widget->allocation = child_allocation = *allocation;
|
||||
bin = GTK_BIN (widget);
|
||||
|
||||
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
|
||||
gtk_widget_size_allocate (bin->child, &child_allocation);
|
||||
}
|
55
libnautilus-private/ntl-view-client.h
Normal file
55
libnautilus-private/ntl-view-client.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
#ifndef NTL_VIEW_CLIENT_H
|
||||
#define NTL_VIEW_CLIENT_H
|
||||
|
||||
#include <gtk/gtkobject.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define NAUTILUS_TYPE_VIEW_CLIENT (nautilus_view_client_get_type ())
|
||||
#define NAUTILUS_VIEW_CLIENT(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_VIEW_CLIENT, NautilusViewClient))
|
||||
#define NAUTILUS_VIEW_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_VIEW_CLIENT, NautilusViewClientClass))
|
||||
#define NAUTILUS_IS_VIEW_CLIENT(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_VIEW_CLIENT))
|
||||
#define NAUTILUS_IS_VIEW_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), NAUTILUS_TYPE_VIEW_CLIENT))
|
||||
|
||||
typedef struct _NautilusViewClient NautilusViewClient;
|
||||
typedef struct _NautilusViewClientClass NautilusViewClientClass;
|
||||
|
||||
struct _NautilusViewClientClass
|
||||
{
|
||||
GtkBinClass parent_spot;
|
||||
|
||||
void (*notify_location_change) (NautilusViewClient *view,
|
||||
Nautilus_NavigationInfo *nav_context);
|
||||
void (*notify_selection_change) (NautilusViewClient *view,
|
||||
Nautilus_SelectionInfo *nav_context);
|
||||
void (*load_state) (NautilusViewClient *view, const char *config_path);
|
||||
void (*save_state) (NautilusViewClient *view, const char *config_path);
|
||||
void (*show_properties) (NautilusViewClient *view);
|
||||
|
||||
GtkBinClass *parent_class;
|
||||
guint view_client_signals[5];
|
||||
};
|
||||
|
||||
struct _NautilusViewClient
|
||||
{
|
||||
GtkBin parent;
|
||||
|
||||
GtkWidget *main_window;
|
||||
|
||||
GnomeObject *control, *view_client;
|
||||
Nautilus_ViewFrame view_frame;
|
||||
};
|
||||
|
||||
GtkType nautilus_view_client_get_type (void);
|
||||
void nautilus_view_client_request_location_change (NautilusViewClient *view,
|
||||
Nautilus_NavigationRequestInfo *loc);
|
||||
void nautilus_view_client_request_selection_change (NautilusViewClient *view,
|
||||
Nautilus_SelectionRequestInfo *loc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
22
libnautilus/Makefile.am
Normal file
22
libnautilus/Makefile.am
Normal file
|
@ -0,0 +1,22 @@
|
|||
lib_LTLIBRARIES=libnautilus.la
|
||||
|
||||
INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GNOME_CFLAGS) $(GNORBA_CFLAGS)
|
||||
|
||||
nautilus_idl_sources=nautilus-stubs.c nautilus-skels.c nautilus.h nautilus-common.c
|
||||
BUILT_SOURCES=$(nautilus_idl_sources)
|
||||
|
||||
libnautilusincludedir=$(includedir)/libnautilus
|
||||
libnautilusinclude_HEADERS= \
|
||||
ntl-view-client.h \
|
||||
nautilus.h
|
||||
|
||||
libnautilus_la_SOURCES=$(nautilus_idl_sources) \
|
||||
ntl-view-client.c
|
||||
|
||||
$(nautilus_idl_sources): nautilus_idl_stamp
|
||||
|
||||
nautilus_idl_stamp: $(top_srcdir)/idl/nautilus.idl
|
||||
orbit-idl `gnome-config --cflags idl` $(top_srcdir)/idl/nautilus.idl
|
||||
touch nautilus_idl_stamp
|
||||
|
||||
CLEANFILES=nautilus_idl_stamp
|
8
libnautilus/libnautilus.h
Normal file
8
libnautilus/libnautilus.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef LIBNAUTILUS_H
|
||||
#define LIBNAUTILUS_H 1
|
||||
|
||||
#include <bonobo/gnome-bonobo.h>
|
||||
#include <libnautilus/nautilus.h>
|
||||
#include <libnautilus/ntl-view-client.h>
|
||||
|
||||
#endif
|
383
libnautilus/nautilus-view-frame.c
Normal file
383
libnautilus/nautilus-view-frame.c
Normal file
|
@ -0,0 +1,383 @@
|
|||
/* ntl-view-client.c
|
||||
* Copyright (C) 1999 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "libnautilus.h"
|
||||
|
||||
typedef struct {
|
||||
POA_Nautilus_View servant;
|
||||
gpointer gnome_object;
|
||||
|
||||
NautilusViewClient *view;
|
||||
} impl_POA_Nautilus_View;
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_save_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_load_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_location_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_NavigationInfo * navinfo,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_show_properties(impl_POA_Nautilus_View * servant,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_SelectionInfo * selinfo,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static POA_Nautilus_View__epv impl_Nautilus_View_epv =
|
||||
{
|
||||
NULL, /* _private */
|
||||
(gpointer) & impl_Nautilus_View_save_state,
|
||||
(gpointer) & impl_Nautilus_View_load_state,
|
||||
(gpointer) & impl_Nautilus_View_notify_location_change,
|
||||
(gpointer) & impl_Nautilus_View_show_properties,
|
||||
(gpointer) & impl_Nautilus_View_notify_selection_change
|
||||
};
|
||||
|
||||
static POA_Nautilus_View__vepv impl_Nautilus_View_vepv =
|
||||
{
|
||||
&gnome_object_base_epv,
|
||||
&gnome_object_epv,
|
||||
&impl_Nautilus_View_epv
|
||||
};
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_save_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "save_state", config_path);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_load_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "load_state", config_path);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_location_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_NavigationInfo * navinfo,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "notify_location_change", navinfo);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_show_properties(impl_POA_Nautilus_View * servant,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "show_properties");
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_SelectionInfo * selinfo,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "notify_selection_change", selinfo);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
impl_Nautilus_View__destroy(GnomeObject *obj, impl_POA_Nautilus_View *servant)
|
||||
{
|
||||
PortableServer_ObjectId *objid;
|
||||
CORBA_Environment ev;
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
|
||||
objid = PortableServer_POA_servant_to_id(bonobo_poa(), servant, &ev);
|
||||
PortableServer_POA_deactivate_object(bonobo_poa(), objid, &ev);
|
||||
CORBA_free(objid);
|
||||
obj->servant = NULL;
|
||||
|
||||
POA_Nautilus_View__fini((PortableServer_Servant) servant, &ev);
|
||||
g_free(servant);
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static GnomeObject *
|
||||
impl_Nautilus_View__create(NautilusViewClient *view, CORBA_Environment * ev)
|
||||
{
|
||||
GnomeObject *retval;
|
||||
impl_POA_Nautilus_View *newservant;
|
||||
|
||||
newservant = g_new0(impl_POA_Nautilus_View, 1);
|
||||
newservant->servant.vepv = &impl_Nautilus_View_vepv;
|
||||
newservant->view = view;
|
||||
POA_Nautilus_View__init((PortableServer_Servant) newservant, ev);
|
||||
|
||||
retval = gnome_object_new_from_servant(newservant);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(retval), "destroy", GTK_SIGNAL_FUNC(impl_Nautilus_View__destroy), newservant);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void nautilus_view_client_init (NautilusViewClient *view);
|
||||
static void nautilus_view_client_destroy (NautilusViewClient *view);
|
||||
static void nautilus_view_client_class_init (NautilusViewClientClass *klass);
|
||||
static void nautilus_view_client_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_view_client_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_view_client_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void nautilus_view_client_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
|
||||
GtkType
|
||||
nautilus_view_client_get_type (void)
|
||||
{
|
||||
static GtkType view_client_type = 0;
|
||||
|
||||
if (!view_client_type) {
|
||||
const GtkTypeInfo view_client_info = {
|
||||
"NautilusViewClient",
|
||||
sizeof (NautilusViewClient),
|
||||
sizeof (NautilusViewClientClass),
|
||||
(GtkClassInitFunc) nautilus_view_client_class_init,
|
||||
(GtkObjectInitFunc) nautilus_view_client_init,
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserved_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL,
|
||||
};
|
||||
|
||||
view_client_type = gtk_type_unique (gtk_bin_get_type(), &view_client_info);
|
||||
}
|
||||
|
||||
return view_client_type;
|
||||
}
|
||||
|
||||
#if 0
|
||||
typedef void (*GtkSignal_NONE__BOXED_OBJECT_BOXED) (GtkObject * object,
|
||||
gpointer arg1,
|
||||
GtkObject *arg2,
|
||||
gpointer arg3,
|
||||
gpointer user_data);
|
||||
static void
|
||||
gtk_marshal_NONE__BOXED_OBJECT_BOXED (GtkObject * object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data,
|
||||
GtkArg * args)
|
||||
{
|
||||
GtkSignal_NONE__BOXED_OBJECT_BOXED rfunc;
|
||||
rfunc = (GtkSignal_NONE__BOXED_OBJECT_BOXED) func;
|
||||
(*rfunc) (object,
|
||||
GTK_VALUE_BOXED (args[0]),
|
||||
GTK_VALUE_OBJECT (args[1]),
|
||||
GTK_VALUE_BOXED (args[2]),
|
||||
func_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
nautilus_view_client_class_init (NautilusViewClientClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
int i;
|
||||
|
||||
object_class = (GtkObjectClass*) klass;
|
||||
object_class->destroy = (void (*)(GtkObject*))nautilus_view_client_destroy;
|
||||
object_class->set_arg = nautilus_view_client_set_arg;
|
||||
object_class->get_arg = nautilus_view_client_get_arg;
|
||||
|
||||
widget_class = (GtkWidgetClass*) klass;
|
||||
widget_class->size_request = nautilus_view_client_size_request;
|
||||
widget_class->size_allocate = nautilus_view_client_size_allocate;
|
||||
|
||||
klass->notify_location_change = NULL;
|
||||
|
||||
klass->parent_class = gtk_type_class (gtk_type_parent (object_class->type));
|
||||
|
||||
i = 0;
|
||||
klass->view_client_signals[i++] = gtk_signal_new("notify_location_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, notify_location_change),
|
||||
gtk_marshal_NONE__BOXED,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("load_state",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, load_state),
|
||||
gtk_marshal_NONE__STRING,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_STRING);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("save_state",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, save_state),
|
||||
gtk_marshal_NONE__STRING,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_STRING);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("show_properties",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, show_properties),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("notify_selection_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, notify_selection_change),
|
||||
gtk_marshal_NONE__BOXED,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
|
||||
gtk_object_class_add_signals (object_class, klass->view_client_signals, i);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_init (NautilusViewClient *view)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
GTK_WIDGET_SET_FLAGS (view, GTK_NO_WINDOW);
|
||||
|
||||
view->control = GNOME_OBJECT(gnome_control_new(GTK_WIDGET(view)));
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
view->view_client = impl_Nautilus_View__create(view, &ev);
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_destroy (NautilusViewClient *view)
|
||||
{
|
||||
gtk_object_destroy(GTK_OBJECT(view->view_client));
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_view_client_request_location_change(NautilusViewClient *view,
|
||||
Nautilus_NavigationRequestInfo *loc)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
|
||||
g_return_if_fail (view != NULL);
|
||||
g_return_if_fail (NAUTILUS_IS_VIEW_CLIENT (view));
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
view->view_frame = GNOME_Unknown_query_interface(gnome_control_get_control_frame(GNOME_CONTROL(view->control)),
|
||||
"IDL:Nautilus/ViewFrame:1.0", &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
return;
|
||||
|
||||
Nautilus_ViewFrame_request_location_change(view->view_frame, loc, &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
{
|
||||
CORBA_Object_release(view->view_frame, &ev);
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
}
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_view_client_request_selection_change (NautilusViewClient *view,
|
||||
Nautilus_SelectionRequestInfo *loc)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
|
||||
g_return_if_fail (view != NULL);
|
||||
g_return_if_fail (NAUTILUS_IS_VIEW_CLIENT (view));
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
view->view_frame = GNOME_Unknown_query_interface(gnome_control_get_control_frame(GNOME_CONTROL(view->control)),
|
||||
"IDL:Nautilus/ViewFrame:1.0", &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
return;
|
||||
|
||||
Nautilus_ViewFrame_request_selection_change(view->view_frame, loc, &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
{
|
||||
CORBA_Object_release(view->view_frame, &ev);
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
}
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
GtkBin *bin;
|
||||
|
||||
bin = GTK_BIN (widget);
|
||||
|
||||
requisition->width = 0;
|
||||
requisition->height = 0;
|
||||
|
||||
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
|
||||
{
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
gtk_widget_size_request (bin->child, &child_requisition);
|
||||
|
||||
requisition->width += child_requisition.width;
|
||||
requisition->height += child_requisition.height;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkBin *bin;
|
||||
GtkAllocation child_allocation;
|
||||
|
||||
widget->allocation = child_allocation = *allocation;
|
||||
bin = GTK_BIN (widget);
|
||||
|
||||
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
|
||||
gtk_widget_size_allocate (bin->child, &child_allocation);
|
||||
}
|
55
libnautilus/nautilus-view-frame.h
Normal file
55
libnautilus/nautilus-view-frame.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
#ifndef NTL_VIEW_CLIENT_H
|
||||
#define NTL_VIEW_CLIENT_H
|
||||
|
||||
#include <gtk/gtkobject.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define NAUTILUS_TYPE_VIEW_CLIENT (nautilus_view_client_get_type ())
|
||||
#define NAUTILUS_VIEW_CLIENT(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_VIEW_CLIENT, NautilusViewClient))
|
||||
#define NAUTILUS_VIEW_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_VIEW_CLIENT, NautilusViewClientClass))
|
||||
#define NAUTILUS_IS_VIEW_CLIENT(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_VIEW_CLIENT))
|
||||
#define NAUTILUS_IS_VIEW_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), NAUTILUS_TYPE_VIEW_CLIENT))
|
||||
|
||||
typedef struct _NautilusViewClient NautilusViewClient;
|
||||
typedef struct _NautilusViewClientClass NautilusViewClientClass;
|
||||
|
||||
struct _NautilusViewClientClass
|
||||
{
|
||||
GtkBinClass parent_spot;
|
||||
|
||||
void (*notify_location_change) (NautilusViewClient *view,
|
||||
Nautilus_NavigationInfo *nav_context);
|
||||
void (*notify_selection_change) (NautilusViewClient *view,
|
||||
Nautilus_SelectionInfo *nav_context);
|
||||
void (*load_state) (NautilusViewClient *view, const char *config_path);
|
||||
void (*save_state) (NautilusViewClient *view, const char *config_path);
|
||||
void (*show_properties) (NautilusViewClient *view);
|
||||
|
||||
GtkBinClass *parent_class;
|
||||
guint view_client_signals[5];
|
||||
};
|
||||
|
||||
struct _NautilusViewClient
|
||||
{
|
||||
GtkBin parent;
|
||||
|
||||
GtkWidget *main_window;
|
||||
|
||||
GnomeObject *control, *view_client;
|
||||
Nautilus_ViewFrame view_frame;
|
||||
};
|
||||
|
||||
GtkType nautilus_view_client_get_type (void);
|
||||
void nautilus_view_client_request_location_change (NautilusViewClient *view,
|
||||
Nautilus_NavigationRequestInfo *loc);
|
||||
void nautilus_view_client_request_selection_change (NautilusViewClient *view,
|
||||
Nautilus_SelectionRequestInfo *loc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
383
libnautilus/nautilus-view.c
Normal file
383
libnautilus/nautilus-view.c
Normal file
|
@ -0,0 +1,383 @@
|
|||
/* ntl-view-client.c
|
||||
* Copyright (C) 1999 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "libnautilus.h"
|
||||
|
||||
typedef struct {
|
||||
POA_Nautilus_View servant;
|
||||
gpointer gnome_object;
|
||||
|
||||
NautilusViewClient *view;
|
||||
} impl_POA_Nautilus_View;
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_save_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_load_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_location_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_NavigationInfo * navinfo,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_show_properties(impl_POA_Nautilus_View * servant,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_SelectionInfo * selinfo,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static POA_Nautilus_View__epv impl_Nautilus_View_epv =
|
||||
{
|
||||
NULL, /* _private */
|
||||
(gpointer) & impl_Nautilus_View_save_state,
|
||||
(gpointer) & impl_Nautilus_View_load_state,
|
||||
(gpointer) & impl_Nautilus_View_notify_location_change,
|
||||
(gpointer) & impl_Nautilus_View_show_properties,
|
||||
(gpointer) & impl_Nautilus_View_notify_selection_change
|
||||
};
|
||||
|
||||
static POA_Nautilus_View__vepv impl_Nautilus_View_vepv =
|
||||
{
|
||||
&gnome_object_base_epv,
|
||||
&gnome_object_epv,
|
||||
&impl_Nautilus_View_epv
|
||||
};
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_save_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "save_state", config_path);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_load_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "load_state", config_path);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_location_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_NavigationInfo * navinfo,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "notify_location_change", navinfo);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_show_properties(impl_POA_Nautilus_View * servant,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "show_properties");
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_SelectionInfo * selinfo,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "notify_selection_change", selinfo);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
impl_Nautilus_View__destroy(GnomeObject *obj, impl_POA_Nautilus_View *servant)
|
||||
{
|
||||
PortableServer_ObjectId *objid;
|
||||
CORBA_Environment ev;
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
|
||||
objid = PortableServer_POA_servant_to_id(bonobo_poa(), servant, &ev);
|
||||
PortableServer_POA_deactivate_object(bonobo_poa(), objid, &ev);
|
||||
CORBA_free(objid);
|
||||
obj->servant = NULL;
|
||||
|
||||
POA_Nautilus_View__fini((PortableServer_Servant) servant, &ev);
|
||||
g_free(servant);
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static GnomeObject *
|
||||
impl_Nautilus_View__create(NautilusViewClient *view, CORBA_Environment * ev)
|
||||
{
|
||||
GnomeObject *retval;
|
||||
impl_POA_Nautilus_View *newservant;
|
||||
|
||||
newservant = g_new0(impl_POA_Nautilus_View, 1);
|
||||
newservant->servant.vepv = &impl_Nautilus_View_vepv;
|
||||
newservant->view = view;
|
||||
POA_Nautilus_View__init((PortableServer_Servant) newservant, ev);
|
||||
|
||||
retval = gnome_object_new_from_servant(newservant);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(retval), "destroy", GTK_SIGNAL_FUNC(impl_Nautilus_View__destroy), newservant);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void nautilus_view_client_init (NautilusViewClient *view);
|
||||
static void nautilus_view_client_destroy (NautilusViewClient *view);
|
||||
static void nautilus_view_client_class_init (NautilusViewClientClass *klass);
|
||||
static void nautilus_view_client_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_view_client_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_view_client_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void nautilus_view_client_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
|
||||
GtkType
|
||||
nautilus_view_client_get_type (void)
|
||||
{
|
||||
static GtkType view_client_type = 0;
|
||||
|
||||
if (!view_client_type) {
|
||||
const GtkTypeInfo view_client_info = {
|
||||
"NautilusViewClient",
|
||||
sizeof (NautilusViewClient),
|
||||
sizeof (NautilusViewClientClass),
|
||||
(GtkClassInitFunc) nautilus_view_client_class_init,
|
||||
(GtkObjectInitFunc) nautilus_view_client_init,
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserved_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL,
|
||||
};
|
||||
|
||||
view_client_type = gtk_type_unique (gtk_bin_get_type(), &view_client_info);
|
||||
}
|
||||
|
||||
return view_client_type;
|
||||
}
|
||||
|
||||
#if 0
|
||||
typedef void (*GtkSignal_NONE__BOXED_OBJECT_BOXED) (GtkObject * object,
|
||||
gpointer arg1,
|
||||
GtkObject *arg2,
|
||||
gpointer arg3,
|
||||
gpointer user_data);
|
||||
static void
|
||||
gtk_marshal_NONE__BOXED_OBJECT_BOXED (GtkObject * object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data,
|
||||
GtkArg * args)
|
||||
{
|
||||
GtkSignal_NONE__BOXED_OBJECT_BOXED rfunc;
|
||||
rfunc = (GtkSignal_NONE__BOXED_OBJECT_BOXED) func;
|
||||
(*rfunc) (object,
|
||||
GTK_VALUE_BOXED (args[0]),
|
||||
GTK_VALUE_OBJECT (args[1]),
|
||||
GTK_VALUE_BOXED (args[2]),
|
||||
func_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
nautilus_view_client_class_init (NautilusViewClientClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
int i;
|
||||
|
||||
object_class = (GtkObjectClass*) klass;
|
||||
object_class->destroy = (void (*)(GtkObject*))nautilus_view_client_destroy;
|
||||
object_class->set_arg = nautilus_view_client_set_arg;
|
||||
object_class->get_arg = nautilus_view_client_get_arg;
|
||||
|
||||
widget_class = (GtkWidgetClass*) klass;
|
||||
widget_class->size_request = nautilus_view_client_size_request;
|
||||
widget_class->size_allocate = nautilus_view_client_size_allocate;
|
||||
|
||||
klass->notify_location_change = NULL;
|
||||
|
||||
klass->parent_class = gtk_type_class (gtk_type_parent (object_class->type));
|
||||
|
||||
i = 0;
|
||||
klass->view_client_signals[i++] = gtk_signal_new("notify_location_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, notify_location_change),
|
||||
gtk_marshal_NONE__BOXED,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("load_state",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, load_state),
|
||||
gtk_marshal_NONE__STRING,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_STRING);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("save_state",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, save_state),
|
||||
gtk_marshal_NONE__STRING,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_STRING);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("show_properties",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, show_properties),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("notify_selection_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, notify_selection_change),
|
||||
gtk_marshal_NONE__BOXED,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
|
||||
gtk_object_class_add_signals (object_class, klass->view_client_signals, i);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_init (NautilusViewClient *view)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
GTK_WIDGET_SET_FLAGS (view, GTK_NO_WINDOW);
|
||||
|
||||
view->control = GNOME_OBJECT(gnome_control_new(GTK_WIDGET(view)));
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
view->view_client = impl_Nautilus_View__create(view, &ev);
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_destroy (NautilusViewClient *view)
|
||||
{
|
||||
gtk_object_destroy(GTK_OBJECT(view->view_client));
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_view_client_request_location_change(NautilusViewClient *view,
|
||||
Nautilus_NavigationRequestInfo *loc)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
|
||||
g_return_if_fail (view != NULL);
|
||||
g_return_if_fail (NAUTILUS_IS_VIEW_CLIENT (view));
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
view->view_frame = GNOME_Unknown_query_interface(gnome_control_get_control_frame(GNOME_CONTROL(view->control)),
|
||||
"IDL:Nautilus/ViewFrame:1.0", &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
return;
|
||||
|
||||
Nautilus_ViewFrame_request_location_change(view->view_frame, loc, &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
{
|
||||
CORBA_Object_release(view->view_frame, &ev);
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
}
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_view_client_request_selection_change (NautilusViewClient *view,
|
||||
Nautilus_SelectionRequestInfo *loc)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
|
||||
g_return_if_fail (view != NULL);
|
||||
g_return_if_fail (NAUTILUS_IS_VIEW_CLIENT (view));
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
view->view_frame = GNOME_Unknown_query_interface(gnome_control_get_control_frame(GNOME_CONTROL(view->control)),
|
||||
"IDL:Nautilus/ViewFrame:1.0", &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
return;
|
||||
|
||||
Nautilus_ViewFrame_request_selection_change(view->view_frame, loc, &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
{
|
||||
CORBA_Object_release(view->view_frame, &ev);
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
}
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
GtkBin *bin;
|
||||
|
||||
bin = GTK_BIN (widget);
|
||||
|
||||
requisition->width = 0;
|
||||
requisition->height = 0;
|
||||
|
||||
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
|
||||
{
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
gtk_widget_size_request (bin->child, &child_requisition);
|
||||
|
||||
requisition->width += child_requisition.width;
|
||||
requisition->height += child_requisition.height;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkBin *bin;
|
||||
GtkAllocation child_allocation;
|
||||
|
||||
widget->allocation = child_allocation = *allocation;
|
||||
bin = GTK_BIN (widget);
|
||||
|
||||
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
|
||||
gtk_widget_size_allocate (bin->child, &child_allocation);
|
||||
}
|
55
libnautilus/nautilus-view.h
Normal file
55
libnautilus/nautilus-view.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
#ifndef NTL_VIEW_CLIENT_H
|
||||
#define NTL_VIEW_CLIENT_H
|
||||
|
||||
#include <gtk/gtkobject.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define NAUTILUS_TYPE_VIEW_CLIENT (nautilus_view_client_get_type ())
|
||||
#define NAUTILUS_VIEW_CLIENT(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_VIEW_CLIENT, NautilusViewClient))
|
||||
#define NAUTILUS_VIEW_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_VIEW_CLIENT, NautilusViewClientClass))
|
||||
#define NAUTILUS_IS_VIEW_CLIENT(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_VIEW_CLIENT))
|
||||
#define NAUTILUS_IS_VIEW_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), NAUTILUS_TYPE_VIEW_CLIENT))
|
||||
|
||||
typedef struct _NautilusViewClient NautilusViewClient;
|
||||
typedef struct _NautilusViewClientClass NautilusViewClientClass;
|
||||
|
||||
struct _NautilusViewClientClass
|
||||
{
|
||||
GtkBinClass parent_spot;
|
||||
|
||||
void (*notify_location_change) (NautilusViewClient *view,
|
||||
Nautilus_NavigationInfo *nav_context);
|
||||
void (*notify_selection_change) (NautilusViewClient *view,
|
||||
Nautilus_SelectionInfo *nav_context);
|
||||
void (*load_state) (NautilusViewClient *view, const char *config_path);
|
||||
void (*save_state) (NautilusViewClient *view, const char *config_path);
|
||||
void (*show_properties) (NautilusViewClient *view);
|
||||
|
||||
GtkBinClass *parent_class;
|
||||
guint view_client_signals[5];
|
||||
};
|
||||
|
||||
struct _NautilusViewClient
|
||||
{
|
||||
GtkBin parent;
|
||||
|
||||
GtkWidget *main_window;
|
||||
|
||||
GnomeObject *control, *view_client;
|
||||
Nautilus_ViewFrame view_frame;
|
||||
};
|
||||
|
||||
GtkType nautilus_view_client_get_type (void);
|
||||
void nautilus_view_client_request_location_change (NautilusViewClient *view,
|
||||
Nautilus_NavigationRequestInfo *loc);
|
||||
void nautilus_view_client_request_selection_change (NautilusViewClient *view,
|
||||
Nautilus_SelectionRequestInfo *loc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
383
libnautilus/ntl-view-client.c
Normal file
383
libnautilus/ntl-view-client.c
Normal file
|
@ -0,0 +1,383 @@
|
|||
/* ntl-view-client.c
|
||||
* Copyright (C) 1999 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "libnautilus.h"
|
||||
|
||||
typedef struct {
|
||||
POA_Nautilus_View servant;
|
||||
gpointer gnome_object;
|
||||
|
||||
NautilusViewClient *view;
|
||||
} impl_POA_Nautilus_View;
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_save_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_load_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_location_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_NavigationInfo * navinfo,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_show_properties(impl_POA_Nautilus_View * servant,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_SelectionInfo * selinfo,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static POA_Nautilus_View__epv impl_Nautilus_View_epv =
|
||||
{
|
||||
NULL, /* _private */
|
||||
(gpointer) & impl_Nautilus_View_save_state,
|
||||
(gpointer) & impl_Nautilus_View_load_state,
|
||||
(gpointer) & impl_Nautilus_View_notify_location_change,
|
||||
(gpointer) & impl_Nautilus_View_show_properties,
|
||||
(gpointer) & impl_Nautilus_View_notify_selection_change
|
||||
};
|
||||
|
||||
static POA_Nautilus_View__vepv impl_Nautilus_View_vepv =
|
||||
{
|
||||
&gnome_object_base_epv,
|
||||
&gnome_object_epv,
|
||||
&impl_Nautilus_View_epv
|
||||
};
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_save_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "save_state", config_path);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_load_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "load_state", config_path);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_location_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_NavigationInfo * navinfo,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "notify_location_change", navinfo);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_show_properties(impl_POA_Nautilus_View * servant,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "show_properties");
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_SelectionInfo * selinfo,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "notify_selection_change", selinfo);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
impl_Nautilus_View__destroy(GnomeObject *obj, impl_POA_Nautilus_View *servant)
|
||||
{
|
||||
PortableServer_ObjectId *objid;
|
||||
CORBA_Environment ev;
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
|
||||
objid = PortableServer_POA_servant_to_id(bonobo_poa(), servant, &ev);
|
||||
PortableServer_POA_deactivate_object(bonobo_poa(), objid, &ev);
|
||||
CORBA_free(objid);
|
||||
obj->servant = NULL;
|
||||
|
||||
POA_Nautilus_View__fini((PortableServer_Servant) servant, &ev);
|
||||
g_free(servant);
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static GnomeObject *
|
||||
impl_Nautilus_View__create(NautilusViewClient *view, CORBA_Environment * ev)
|
||||
{
|
||||
GnomeObject *retval;
|
||||
impl_POA_Nautilus_View *newservant;
|
||||
|
||||
newservant = g_new0(impl_POA_Nautilus_View, 1);
|
||||
newservant->servant.vepv = &impl_Nautilus_View_vepv;
|
||||
newservant->view = view;
|
||||
POA_Nautilus_View__init((PortableServer_Servant) newservant, ev);
|
||||
|
||||
retval = gnome_object_new_from_servant(newservant);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(retval), "destroy", GTK_SIGNAL_FUNC(impl_Nautilus_View__destroy), newservant);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void nautilus_view_client_init (NautilusViewClient *view);
|
||||
static void nautilus_view_client_destroy (NautilusViewClient *view);
|
||||
static void nautilus_view_client_class_init (NautilusViewClientClass *klass);
|
||||
static void nautilus_view_client_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_view_client_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_view_client_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void nautilus_view_client_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
|
||||
GtkType
|
||||
nautilus_view_client_get_type (void)
|
||||
{
|
||||
static GtkType view_client_type = 0;
|
||||
|
||||
if (!view_client_type) {
|
||||
const GtkTypeInfo view_client_info = {
|
||||
"NautilusViewClient",
|
||||
sizeof (NautilusViewClient),
|
||||
sizeof (NautilusViewClientClass),
|
||||
(GtkClassInitFunc) nautilus_view_client_class_init,
|
||||
(GtkObjectInitFunc) nautilus_view_client_init,
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserved_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL,
|
||||
};
|
||||
|
||||
view_client_type = gtk_type_unique (gtk_bin_get_type(), &view_client_info);
|
||||
}
|
||||
|
||||
return view_client_type;
|
||||
}
|
||||
|
||||
#if 0
|
||||
typedef void (*GtkSignal_NONE__BOXED_OBJECT_BOXED) (GtkObject * object,
|
||||
gpointer arg1,
|
||||
GtkObject *arg2,
|
||||
gpointer arg3,
|
||||
gpointer user_data);
|
||||
static void
|
||||
gtk_marshal_NONE__BOXED_OBJECT_BOXED (GtkObject * object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data,
|
||||
GtkArg * args)
|
||||
{
|
||||
GtkSignal_NONE__BOXED_OBJECT_BOXED rfunc;
|
||||
rfunc = (GtkSignal_NONE__BOXED_OBJECT_BOXED) func;
|
||||
(*rfunc) (object,
|
||||
GTK_VALUE_BOXED (args[0]),
|
||||
GTK_VALUE_OBJECT (args[1]),
|
||||
GTK_VALUE_BOXED (args[2]),
|
||||
func_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
nautilus_view_client_class_init (NautilusViewClientClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
int i;
|
||||
|
||||
object_class = (GtkObjectClass*) klass;
|
||||
object_class->destroy = (void (*)(GtkObject*))nautilus_view_client_destroy;
|
||||
object_class->set_arg = nautilus_view_client_set_arg;
|
||||
object_class->get_arg = nautilus_view_client_get_arg;
|
||||
|
||||
widget_class = (GtkWidgetClass*) klass;
|
||||
widget_class->size_request = nautilus_view_client_size_request;
|
||||
widget_class->size_allocate = nautilus_view_client_size_allocate;
|
||||
|
||||
klass->notify_location_change = NULL;
|
||||
|
||||
klass->parent_class = gtk_type_class (gtk_type_parent (object_class->type));
|
||||
|
||||
i = 0;
|
||||
klass->view_client_signals[i++] = gtk_signal_new("notify_location_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, notify_location_change),
|
||||
gtk_marshal_NONE__BOXED,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("load_state",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, load_state),
|
||||
gtk_marshal_NONE__STRING,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_STRING);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("save_state",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, save_state),
|
||||
gtk_marshal_NONE__STRING,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_STRING);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("show_properties",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, show_properties),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("notify_selection_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, notify_selection_change),
|
||||
gtk_marshal_NONE__BOXED,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
|
||||
gtk_object_class_add_signals (object_class, klass->view_client_signals, i);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_init (NautilusViewClient *view)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
GTK_WIDGET_SET_FLAGS (view, GTK_NO_WINDOW);
|
||||
|
||||
view->control = GNOME_OBJECT(gnome_control_new(GTK_WIDGET(view)));
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
view->view_client = impl_Nautilus_View__create(view, &ev);
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_destroy (NautilusViewClient *view)
|
||||
{
|
||||
gtk_object_destroy(GTK_OBJECT(view->view_client));
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_view_client_request_location_change(NautilusViewClient *view,
|
||||
Nautilus_NavigationRequestInfo *loc)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
|
||||
g_return_if_fail (view != NULL);
|
||||
g_return_if_fail (NAUTILUS_IS_VIEW_CLIENT (view));
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
view->view_frame = GNOME_Unknown_query_interface(gnome_control_get_control_frame(GNOME_CONTROL(view->control)),
|
||||
"IDL:Nautilus/ViewFrame:1.0", &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
return;
|
||||
|
||||
Nautilus_ViewFrame_request_location_change(view->view_frame, loc, &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
{
|
||||
CORBA_Object_release(view->view_frame, &ev);
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
}
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_view_client_request_selection_change (NautilusViewClient *view,
|
||||
Nautilus_SelectionRequestInfo *loc)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
|
||||
g_return_if_fail (view != NULL);
|
||||
g_return_if_fail (NAUTILUS_IS_VIEW_CLIENT (view));
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
view->view_frame = GNOME_Unknown_query_interface(gnome_control_get_control_frame(GNOME_CONTROL(view->control)),
|
||||
"IDL:Nautilus/ViewFrame:1.0", &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
return;
|
||||
|
||||
Nautilus_ViewFrame_request_selection_change(view->view_frame, loc, &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
{
|
||||
CORBA_Object_release(view->view_frame, &ev);
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
}
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
GtkBin *bin;
|
||||
|
||||
bin = GTK_BIN (widget);
|
||||
|
||||
requisition->width = 0;
|
||||
requisition->height = 0;
|
||||
|
||||
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
|
||||
{
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
gtk_widget_size_request (bin->child, &child_requisition);
|
||||
|
||||
requisition->width += child_requisition.width;
|
||||
requisition->height += child_requisition.height;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkBin *bin;
|
||||
GtkAllocation child_allocation;
|
||||
|
||||
widget->allocation = child_allocation = *allocation;
|
||||
bin = GTK_BIN (widget);
|
||||
|
||||
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
|
||||
gtk_widget_size_allocate (bin->child, &child_allocation);
|
||||
}
|
55
libnautilus/ntl-view-client.h
Normal file
55
libnautilus/ntl-view-client.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
#ifndef NTL_VIEW_CLIENT_H
|
||||
#define NTL_VIEW_CLIENT_H
|
||||
|
||||
#include <gtk/gtkobject.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define NAUTILUS_TYPE_VIEW_CLIENT (nautilus_view_client_get_type ())
|
||||
#define NAUTILUS_VIEW_CLIENT(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_VIEW_CLIENT, NautilusViewClient))
|
||||
#define NAUTILUS_VIEW_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_VIEW_CLIENT, NautilusViewClientClass))
|
||||
#define NAUTILUS_IS_VIEW_CLIENT(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_VIEW_CLIENT))
|
||||
#define NAUTILUS_IS_VIEW_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), NAUTILUS_TYPE_VIEW_CLIENT))
|
||||
|
||||
typedef struct _NautilusViewClient NautilusViewClient;
|
||||
typedef struct _NautilusViewClientClass NautilusViewClientClass;
|
||||
|
||||
struct _NautilusViewClientClass
|
||||
{
|
||||
GtkBinClass parent_spot;
|
||||
|
||||
void (*notify_location_change) (NautilusViewClient *view,
|
||||
Nautilus_NavigationInfo *nav_context);
|
||||
void (*notify_selection_change) (NautilusViewClient *view,
|
||||
Nautilus_SelectionInfo *nav_context);
|
||||
void (*load_state) (NautilusViewClient *view, const char *config_path);
|
||||
void (*save_state) (NautilusViewClient *view, const char *config_path);
|
||||
void (*show_properties) (NautilusViewClient *view);
|
||||
|
||||
GtkBinClass *parent_class;
|
||||
guint view_client_signals[5];
|
||||
};
|
||||
|
||||
struct _NautilusViewClient
|
||||
{
|
||||
GtkBin parent;
|
||||
|
||||
GtkWidget *main_window;
|
||||
|
||||
GnomeObject *control, *view_client;
|
||||
Nautilus_ViewFrame view_frame;
|
||||
};
|
||||
|
||||
GtkType nautilus_view_client_get_type (void);
|
||||
void nautilus_view_client_request_location_change (NautilusViewClient *view,
|
||||
Nautilus_NavigationRequestInfo *loc);
|
||||
void nautilus_view_client_request_selection_change (NautilusViewClient *view,
|
||||
Nautilus_SelectionRequestInfo *loc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
383
libnautilus/ntl-view-frame.c
Normal file
383
libnautilus/ntl-view-frame.c
Normal file
|
@ -0,0 +1,383 @@
|
|||
/* ntl-view-client.c
|
||||
* Copyright (C) 1999 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "libnautilus.h"
|
||||
|
||||
typedef struct {
|
||||
POA_Nautilus_View servant;
|
||||
gpointer gnome_object;
|
||||
|
||||
NautilusViewClient *view;
|
||||
} impl_POA_Nautilus_View;
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_save_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_load_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_location_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_NavigationInfo * navinfo,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_show_properties(impl_POA_Nautilus_View * servant,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_SelectionInfo * selinfo,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static POA_Nautilus_View__epv impl_Nautilus_View_epv =
|
||||
{
|
||||
NULL, /* _private */
|
||||
(gpointer) & impl_Nautilus_View_save_state,
|
||||
(gpointer) & impl_Nautilus_View_load_state,
|
||||
(gpointer) & impl_Nautilus_View_notify_location_change,
|
||||
(gpointer) & impl_Nautilus_View_show_properties,
|
||||
(gpointer) & impl_Nautilus_View_notify_selection_change
|
||||
};
|
||||
|
||||
static POA_Nautilus_View__vepv impl_Nautilus_View_vepv =
|
||||
{
|
||||
&gnome_object_base_epv,
|
||||
&gnome_object_epv,
|
||||
&impl_Nautilus_View_epv
|
||||
};
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_save_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "save_state", config_path);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_load_state(impl_POA_Nautilus_View * servant,
|
||||
CORBA_char * config_path,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "load_state", config_path);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_location_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_NavigationInfo * navinfo,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "notify_location_change", navinfo);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_show_properties(impl_POA_Nautilus_View * servant,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "show_properties");
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_View_notify_selection_change(impl_POA_Nautilus_View * servant,
|
||||
Nautilus_SelectionInfo * selinfo,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
gtk_signal_emit_by_name(GTK_OBJECT(servant->view), "notify_selection_change", selinfo);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
impl_Nautilus_View__destroy(GnomeObject *obj, impl_POA_Nautilus_View *servant)
|
||||
{
|
||||
PortableServer_ObjectId *objid;
|
||||
CORBA_Environment ev;
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
|
||||
objid = PortableServer_POA_servant_to_id(bonobo_poa(), servant, &ev);
|
||||
PortableServer_POA_deactivate_object(bonobo_poa(), objid, &ev);
|
||||
CORBA_free(objid);
|
||||
obj->servant = NULL;
|
||||
|
||||
POA_Nautilus_View__fini((PortableServer_Servant) servant, &ev);
|
||||
g_free(servant);
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static GnomeObject *
|
||||
impl_Nautilus_View__create(NautilusViewClient *view, CORBA_Environment * ev)
|
||||
{
|
||||
GnomeObject *retval;
|
||||
impl_POA_Nautilus_View *newservant;
|
||||
|
||||
newservant = g_new0(impl_POA_Nautilus_View, 1);
|
||||
newservant->servant.vepv = &impl_Nautilus_View_vepv;
|
||||
newservant->view = view;
|
||||
POA_Nautilus_View__init((PortableServer_Servant) newservant, ev);
|
||||
|
||||
retval = gnome_object_new_from_servant(newservant);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(retval), "destroy", GTK_SIGNAL_FUNC(impl_Nautilus_View__destroy), newservant);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void nautilus_view_client_init (NautilusViewClient *view);
|
||||
static void nautilus_view_client_destroy (NautilusViewClient *view);
|
||||
static void nautilus_view_client_class_init (NautilusViewClientClass *klass);
|
||||
static void nautilus_view_client_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_view_client_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_view_client_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void nautilus_view_client_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
|
||||
GtkType
|
||||
nautilus_view_client_get_type (void)
|
||||
{
|
||||
static GtkType view_client_type = 0;
|
||||
|
||||
if (!view_client_type) {
|
||||
const GtkTypeInfo view_client_info = {
|
||||
"NautilusViewClient",
|
||||
sizeof (NautilusViewClient),
|
||||
sizeof (NautilusViewClientClass),
|
||||
(GtkClassInitFunc) nautilus_view_client_class_init,
|
||||
(GtkObjectInitFunc) nautilus_view_client_init,
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserved_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL,
|
||||
};
|
||||
|
||||
view_client_type = gtk_type_unique (gtk_bin_get_type(), &view_client_info);
|
||||
}
|
||||
|
||||
return view_client_type;
|
||||
}
|
||||
|
||||
#if 0
|
||||
typedef void (*GtkSignal_NONE__BOXED_OBJECT_BOXED) (GtkObject * object,
|
||||
gpointer arg1,
|
||||
GtkObject *arg2,
|
||||
gpointer arg3,
|
||||
gpointer user_data);
|
||||
static void
|
||||
gtk_marshal_NONE__BOXED_OBJECT_BOXED (GtkObject * object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data,
|
||||
GtkArg * args)
|
||||
{
|
||||
GtkSignal_NONE__BOXED_OBJECT_BOXED rfunc;
|
||||
rfunc = (GtkSignal_NONE__BOXED_OBJECT_BOXED) func;
|
||||
(*rfunc) (object,
|
||||
GTK_VALUE_BOXED (args[0]),
|
||||
GTK_VALUE_OBJECT (args[1]),
|
||||
GTK_VALUE_BOXED (args[2]),
|
||||
func_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
nautilus_view_client_class_init (NautilusViewClientClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
int i;
|
||||
|
||||
object_class = (GtkObjectClass*) klass;
|
||||
object_class->destroy = (void (*)(GtkObject*))nautilus_view_client_destroy;
|
||||
object_class->set_arg = nautilus_view_client_set_arg;
|
||||
object_class->get_arg = nautilus_view_client_get_arg;
|
||||
|
||||
widget_class = (GtkWidgetClass*) klass;
|
||||
widget_class->size_request = nautilus_view_client_size_request;
|
||||
widget_class->size_allocate = nautilus_view_client_size_allocate;
|
||||
|
||||
klass->notify_location_change = NULL;
|
||||
|
||||
klass->parent_class = gtk_type_class (gtk_type_parent (object_class->type));
|
||||
|
||||
i = 0;
|
||||
klass->view_client_signals[i++] = gtk_signal_new("notify_location_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, notify_location_change),
|
||||
gtk_marshal_NONE__BOXED,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("load_state",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, load_state),
|
||||
gtk_marshal_NONE__STRING,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_STRING);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("save_state",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, save_state),
|
||||
gtk_marshal_NONE__STRING,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_STRING);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("show_properties",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, show_properties),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
klass->view_client_signals[i++] = gtk_signal_new("notify_selection_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClientClass, notify_selection_change),
|
||||
gtk_marshal_NONE__BOXED,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
|
||||
gtk_object_class_add_signals (object_class, klass->view_client_signals, i);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_init (NautilusViewClient *view)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
GTK_WIDGET_SET_FLAGS (view, GTK_NO_WINDOW);
|
||||
|
||||
view->control = GNOME_OBJECT(gnome_control_new(GTK_WIDGET(view)));
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
view->view_client = impl_Nautilus_View__create(view, &ev);
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_destroy (NautilusViewClient *view)
|
||||
{
|
||||
gtk_object_destroy(GTK_OBJECT(view->view_client));
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_view_client_request_location_change(NautilusViewClient *view,
|
||||
Nautilus_NavigationRequestInfo *loc)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
|
||||
g_return_if_fail (view != NULL);
|
||||
g_return_if_fail (NAUTILUS_IS_VIEW_CLIENT (view));
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
view->view_frame = GNOME_Unknown_query_interface(gnome_control_get_control_frame(GNOME_CONTROL(view->control)),
|
||||
"IDL:Nautilus/ViewFrame:1.0", &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
return;
|
||||
|
||||
Nautilus_ViewFrame_request_location_change(view->view_frame, loc, &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
{
|
||||
CORBA_Object_release(view->view_frame, &ev);
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
}
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_view_client_request_selection_change (NautilusViewClient *view,
|
||||
Nautilus_SelectionRequestInfo *loc)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
|
||||
g_return_if_fail (view != NULL);
|
||||
g_return_if_fail (NAUTILUS_IS_VIEW_CLIENT (view));
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
view->view_frame = GNOME_Unknown_query_interface(gnome_control_get_control_frame(GNOME_CONTROL(view->control)),
|
||||
"IDL:Nautilus/ViewFrame:1.0", &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
if(CORBA_Object_is_nil(view->view_frame, &ev))
|
||||
return;
|
||||
|
||||
Nautilus_ViewFrame_request_selection_change(view->view_frame, loc, &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
{
|
||||
CORBA_Object_release(view->view_frame, &ev);
|
||||
view->view_frame = CORBA_OBJECT_NIL;
|
||||
}
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
GtkBin *bin;
|
||||
|
||||
bin = GTK_BIN (widget);
|
||||
|
||||
requisition->width = 0;
|
||||
requisition->height = 0;
|
||||
|
||||
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
|
||||
{
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
gtk_widget_size_request (bin->child, &child_requisition);
|
||||
|
||||
requisition->width += child_requisition.width;
|
||||
requisition->height += child_requisition.height;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_client_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkBin *bin;
|
||||
GtkAllocation child_allocation;
|
||||
|
||||
widget->allocation = child_allocation = *allocation;
|
||||
bin = GTK_BIN (widget);
|
||||
|
||||
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
|
||||
gtk_widget_size_allocate (bin->child, &child_allocation);
|
||||
}
|
55
libnautilus/ntl-view-frame.h
Normal file
55
libnautilus/ntl-view-frame.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
#ifndef NTL_VIEW_CLIENT_H
|
||||
#define NTL_VIEW_CLIENT_H
|
||||
|
||||
#include <gtk/gtkobject.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define NAUTILUS_TYPE_VIEW_CLIENT (nautilus_view_client_get_type ())
|
||||
#define NAUTILUS_VIEW_CLIENT(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_VIEW_CLIENT, NautilusViewClient))
|
||||
#define NAUTILUS_VIEW_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_VIEW_CLIENT, NautilusViewClientClass))
|
||||
#define NAUTILUS_IS_VIEW_CLIENT(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_VIEW_CLIENT))
|
||||
#define NAUTILUS_IS_VIEW_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), NAUTILUS_TYPE_VIEW_CLIENT))
|
||||
|
||||
typedef struct _NautilusViewClient NautilusViewClient;
|
||||
typedef struct _NautilusViewClientClass NautilusViewClientClass;
|
||||
|
||||
struct _NautilusViewClientClass
|
||||
{
|
||||
GtkBinClass parent_spot;
|
||||
|
||||
void (*notify_location_change) (NautilusViewClient *view,
|
||||
Nautilus_NavigationInfo *nav_context);
|
||||
void (*notify_selection_change) (NautilusViewClient *view,
|
||||
Nautilus_SelectionInfo *nav_context);
|
||||
void (*load_state) (NautilusViewClient *view, const char *config_path);
|
||||
void (*save_state) (NautilusViewClient *view, const char *config_path);
|
||||
void (*show_properties) (NautilusViewClient *view);
|
||||
|
||||
GtkBinClass *parent_class;
|
||||
guint view_client_signals[5];
|
||||
};
|
||||
|
||||
struct _NautilusViewClient
|
||||
{
|
||||
GtkBin parent;
|
||||
|
||||
GtkWidget *main_window;
|
||||
|
||||
GnomeObject *control, *view_client;
|
||||
Nautilus_ViewFrame view_frame;
|
||||
};
|
||||
|
||||
GtkType nautilus_view_client_get_type (void);
|
||||
void nautilus_view_client_request_location_change (NautilusViewClient *view,
|
||||
Nautilus_NavigationRequestInfo *loc);
|
||||
void nautilus_view_client_request_selection_change (NautilusViewClient *view,
|
||||
Nautilus_SelectionRequestInfo *loc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
|
@ -1,7 +1,7 @@
|
|||
bin_PROGRAMS=nautilus
|
||||
|
||||
INCLUDES=$(GNORBA_CFLAGS) $(GNOMEUI_CFLAGS) -DVERSION="\"$(VERSION)\""
|
||||
LDADD=$(GNORBA_LIBS) $(GNOMEUI_LIBS) $(BONOBO_LIBS)
|
||||
INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(BONOBO_CFLAGS) $(GNORBA_CFLAGS) $(GNOMEUI_CFLAGS) -DVERSION="\"$(VERSION)\""
|
||||
LDADD=../libnautilus/libnautilus.la $(BONOBO_LIBS) $(GNORBA_LIBS) $(GNOMEUI_LIBS) $(BONOBO_LIBS)
|
||||
|
||||
nautilus_SOURCES= \
|
||||
ntl-content-view.h \
|
||||
|
|
|
@ -2,15 +2,21 @@
|
|||
#include <libgnorba/gnorba.h>
|
||||
|
||||
NautilusNavigationInfo *
|
||||
nautilus_navinfo_new(NautilusNavigationInfo *navinfo, NautilusLocationReference uri,
|
||||
nautilus_navinfo_new(NautilusNavigationInfo *navinfo,
|
||||
Nautilus_NavigationRequestInfo *nri,
|
||||
NautilusLocationReference referring_uri,
|
||||
NautilusLocationReference actual_referring_uri,
|
||||
const char *referring_content_type)
|
||||
const char *referring_content_type,
|
||||
GtkWidget *requesting_view)
|
||||
{
|
||||
navinfo->requested_uri = uri;
|
||||
navinfo->referring_uri = referring_uri;
|
||||
navinfo->actual_referring_uri = actual_referring_uri;
|
||||
navinfo->referring_content_type = (char *)referring_content_type;
|
||||
memset(navinfo, 0, sizeof(*navinfo));
|
||||
|
||||
navinfo->navinfo.requested_uri = nri->requested_uri;
|
||||
navinfo->navinfo.referring_uri = referring_uri;
|
||||
navinfo->navinfo.actual_referring_uri = actual_referring_uri;
|
||||
navinfo->navinfo.referring_content_type = (char *)referring_content_type;
|
||||
|
||||
navinfo->requesting_view = requesting_view;
|
||||
|
||||
/* XXX turn the provided information into some activateable IID's */
|
||||
|
||||
|
|
|
@ -3,10 +3,12 @@
|
|||
|
||||
#include "ntl-types.h"
|
||||
|
||||
NautilusNavigationInfo *nautilus_navinfo_new(NautilusNavigationInfo *navinfo, NautilusLocationReference uri,
|
||||
NautilusNavigationInfo *nautilus_navinfo_new(NautilusNavigationInfo *navinfo,
|
||||
Nautilus_NavigationRequestInfo *nri,
|
||||
NautilusLocationReference referring_uri,
|
||||
NautilusLocationReference actual_referring_uri,
|
||||
const char *referring_content_type);
|
||||
const char *referring_content_type,
|
||||
GtkWidget *requesting_view);
|
||||
void nautilus_navinfo_free(NautilusNavigationInfo *navinfo);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -16,7 +16,7 @@ static void nautilus_window_get_arg (GtkObject *object,
|
|||
static void nautilus_window_close (GtkWidget *widget,
|
||||
GtkWidget *window);
|
||||
static void nautilus_window_real_request_location_change (NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
|
||||
#define CONTENTS_AS_HBOX
|
||||
|
@ -44,20 +44,20 @@ nautilus_window_get_type(void)
|
|||
return window_type;
|
||||
}
|
||||
|
||||
typedef void (*GtkSignal_NONE__STRING_OBJECT) (GtkObject * object,
|
||||
const char *arg1,
|
||||
typedef void (*GtkSignal_NONE__BOXED_OBJECT) (GtkObject * object,
|
||||
gpointer arg1,
|
||||
GtkObject *arg2,
|
||||
gpointer user_data);
|
||||
static void
|
||||
gtk_marshal_NONE__STRING_OBJECT (GtkObject * object,
|
||||
gtk_marshal_NONE__BOXED_OBJECT (GtkObject * object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data,
|
||||
GtkArg * args)
|
||||
{
|
||||
GtkSignal_NONE__STRING_OBJECT rfunc;
|
||||
rfunc = (GtkSignal_NONE__STRING_OBJECT) func;
|
||||
GtkSignal_NONE__BOXED_OBJECT rfunc;
|
||||
rfunc = (GtkSignal_NONE__BOXED_OBJECT) func;
|
||||
(*rfunc) (object,
|
||||
GTK_VALUE_STRING (args[0]),
|
||||
GTK_VALUE_BOXED (args[0]),
|
||||
GTK_VALUE_OBJECT (args[1]),
|
||||
func_data);
|
||||
}
|
||||
|
@ -90,8 +90,14 @@ nautilus_window_class_init (NautilusWindowClass *klass)
|
|||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusWindowClass, request_location_change),
|
||||
gtk_marshal_NONE__STRING_OBJECT,
|
||||
GTK_TYPE_NONE, 2, GTK_TYPE_STRING, GTK_TYPE_OBJECT);
|
||||
gtk_marshal_NONE__BOXED_OBJECT,
|
||||
GTK_TYPE_NONE, 2, GTK_TYPE_BOXED, GTK_TYPE_OBJECT);
|
||||
klass->window_signals[i++] = gtk_signal_new("request_selection_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusWindowClass, request_selection_change),
|
||||
gtk_marshal_NONE__BOXED_OBJECT,
|
||||
GTK_TYPE_NONE, 2, GTK_TYPE_BOXED, GTK_TYPE_OBJECT);
|
||||
gtk_object_class_add_signals (object_class, klass->window_signals, i);
|
||||
|
||||
gtk_object_add_arg_type ("NautilusWindow::app_id",
|
||||
|
@ -414,9 +420,23 @@ nautilus_window_remove_meta_view(NautilusWindow *window, NautilusView *meta_view
|
|||
gtk_notebook_remove_page(GTK_NOTEBOOK(window->meta_notebook), pagenum);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_window_request_selection_change(NautilusWindow *window,
|
||||
Nautilus_SelectionRequestInfo *loc,
|
||||
GtkWidget *requesting_view)
|
||||
{
|
||||
NautilusWindowClass *klass;
|
||||
GtkObject *obj;
|
||||
|
||||
obj = GTK_OBJECT(window);
|
||||
|
||||
klass = NAUTILUS_WINDOW_CLASS(obj->klass);
|
||||
gtk_signal_emit(obj, klass->window_signals[1], loc, requesting_view);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_window_request_location_change(NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view)
|
||||
{
|
||||
NautilusWindowClass *klass;
|
||||
|
@ -430,7 +450,7 @@ nautilus_window_request_location_change(NautilusWindow *window,
|
|||
|
||||
static void
|
||||
nautilus_window_change_location(NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view,
|
||||
gboolean is_back)
|
||||
{
|
||||
|
@ -440,12 +460,13 @@ nautilus_window_change_location(NautilusWindow *window,
|
|||
|
||||
NautilusNavigationInfo loci_spot, *loci;
|
||||
|
||||
loci = nautilus_navinfo_new(&loci_spot, loc, window->current_uri, window->actual_current_uri, window->current_content_type);
|
||||
loci = nautilus_navinfo_new(&loci_spot, loc, window->current_uri, window->actual_current_uri, window->current_content_type,
|
||||
requesting_view);
|
||||
|
||||
if(!loci)
|
||||
{
|
||||
char cbuf[1024];
|
||||
g_snprintf(cbuf, sizeof(cbuf), _("Cannot load %s"), loc);
|
||||
g_snprintf(cbuf, sizeof(cbuf), _("Cannot load %s"), loc->requested_uri);
|
||||
nautilus_window_set_status(window, cbuf);
|
||||
return;
|
||||
}
|
||||
|
@ -459,14 +480,14 @@ nautilus_window_change_location(NautilusWindow *window,
|
|||
else
|
||||
{
|
||||
char *append_val;
|
||||
if(window->uris_next && !strcmp(loc, window->uris_next->data))
|
||||
if(window->uris_next && !strcmp(loc->requested_uri, window->uris_next->data))
|
||||
{
|
||||
append_val = window->uris_next->data;
|
||||
window->uris_next = g_slist_remove(window->uris_next, window->uris_next->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
append_val = g_strdup(loc);
|
||||
append_val = g_strdup(loc->requested_uri);
|
||||
g_slist_foreach(window->uris_next, (GFunc)g_free, NULL);
|
||||
g_slist_free(window->uris_next); window->uris_next = NULL;
|
||||
}
|
||||
|
@ -514,18 +535,18 @@ nautilus_window_change_location(NautilusWindow *window,
|
|||
g_slist_free(discard_views);
|
||||
|
||||
g_free(window->current_content_type);
|
||||
window->current_content_type = g_strdup(loci->content_type);
|
||||
window->current_content_type = g_strdup(loci->navinfo.content_type);
|
||||
g_free(window->current_uri);
|
||||
window->current_uri = g_strdup(loci->requested_uri);
|
||||
window->current_uri = g_strdup(loci->navinfo.requested_uri);
|
||||
g_free(window->actual_current_uri);
|
||||
window->actual_current_uri = g_strdup(loci->actual_uri);
|
||||
window->actual_current_uri = g_strdup(loci->navinfo.actual_uri);
|
||||
|
||||
nautilus_navinfo_free(loci);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_window_real_request_location_change (NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view)
|
||||
{
|
||||
nautilus_window_change_location(window, loc, requesting_view, FALSE);
|
||||
|
@ -683,23 +704,26 @@ nautilus_window_load_state(NautilusWindow *window, const char *config_path)
|
|||
static void
|
||||
nautilus_window_back (NautilusWindow *window)
|
||||
{
|
||||
char *uri;
|
||||
Nautilus_NavigationRequestInfo nri;
|
||||
|
||||
g_assert(window->uris_prev);
|
||||
|
||||
uri = window->uris_prev->data;
|
||||
memset(&nri, 0, sizeof(nri));
|
||||
nri.requested_uri = window->uris_prev->data;
|
||||
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
|
||||
|
||||
nautilus_window_change_location(window, uri, NULL, TRUE);
|
||||
nautilus_window_change_location(window, &nri, NULL, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_window_fwd (NautilusWindow *window)
|
||||
{
|
||||
char *uri;
|
||||
Nautilus_NavigationRequestInfo nri;
|
||||
|
||||
g_assert(window->uris_next);
|
||||
|
||||
uri = window->uris_next->data;
|
||||
|
||||
nautilus_window_change_location(window, uri, NULL, FALSE);
|
||||
memset(&nri, 0, sizeof(nri));
|
||||
nri.requested_uri = window->uris_next->data;
|
||||
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
|
||||
nautilus_window_change_location(window, &nri, NULL, FALSE);
|
||||
}
|
||||
|
|
|
@ -19,9 +19,12 @@ typedef struct {
|
|||
GnomeAppClass *parent_class;
|
||||
|
||||
void (* request_location_change)(NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
guint window_signals[1];
|
||||
void (* request_selection_change)(NautilusWindow *window,
|
||||
Nautilus_SelectionRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
guint window_signals[2];
|
||||
} NautilusWindowClass;
|
||||
|
||||
struct _NautilusWindow {
|
||||
|
@ -42,8 +45,11 @@ struct _NautilusWindow {
|
|||
GtkType nautilus_window_get_type(void);
|
||||
GtkWidget *nautilus_window_new(const char *app_id);
|
||||
void nautilus_window_request_location_change(NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
void nautilus_window_request_selection_change(NautilusWindow *window,
|
||||
Nautilus_SelectionRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
void nautilus_window_save_state(NautilusWindow *window, const char *config_path);
|
||||
void nautilus_window_load_state(NautilusWindow *window, const char *config_path);
|
||||
void nautilus_window_set_initial_state(NautilusWindow *window);
|
||||
|
|
|
@ -16,7 +16,7 @@ static void nautilus_window_get_arg (GtkObject *object,
|
|||
static void nautilus_window_close (GtkWidget *widget,
|
||||
GtkWidget *window);
|
||||
static void nautilus_window_real_request_location_change (NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
|
||||
#define CONTENTS_AS_HBOX
|
||||
|
@ -44,20 +44,20 @@ nautilus_window_get_type(void)
|
|||
return window_type;
|
||||
}
|
||||
|
||||
typedef void (*GtkSignal_NONE__STRING_OBJECT) (GtkObject * object,
|
||||
const char *arg1,
|
||||
typedef void (*GtkSignal_NONE__BOXED_OBJECT) (GtkObject * object,
|
||||
gpointer arg1,
|
||||
GtkObject *arg2,
|
||||
gpointer user_data);
|
||||
static void
|
||||
gtk_marshal_NONE__STRING_OBJECT (GtkObject * object,
|
||||
gtk_marshal_NONE__BOXED_OBJECT (GtkObject * object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data,
|
||||
GtkArg * args)
|
||||
{
|
||||
GtkSignal_NONE__STRING_OBJECT rfunc;
|
||||
rfunc = (GtkSignal_NONE__STRING_OBJECT) func;
|
||||
GtkSignal_NONE__BOXED_OBJECT rfunc;
|
||||
rfunc = (GtkSignal_NONE__BOXED_OBJECT) func;
|
||||
(*rfunc) (object,
|
||||
GTK_VALUE_STRING (args[0]),
|
||||
GTK_VALUE_BOXED (args[0]),
|
||||
GTK_VALUE_OBJECT (args[1]),
|
||||
func_data);
|
||||
}
|
||||
|
@ -90,8 +90,14 @@ nautilus_window_class_init (NautilusWindowClass *klass)
|
|||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusWindowClass, request_location_change),
|
||||
gtk_marshal_NONE__STRING_OBJECT,
|
||||
GTK_TYPE_NONE, 2, GTK_TYPE_STRING, GTK_TYPE_OBJECT);
|
||||
gtk_marshal_NONE__BOXED_OBJECT,
|
||||
GTK_TYPE_NONE, 2, GTK_TYPE_BOXED, GTK_TYPE_OBJECT);
|
||||
klass->window_signals[i++] = gtk_signal_new("request_selection_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusWindowClass, request_selection_change),
|
||||
gtk_marshal_NONE__BOXED_OBJECT,
|
||||
GTK_TYPE_NONE, 2, GTK_TYPE_BOXED, GTK_TYPE_OBJECT);
|
||||
gtk_object_class_add_signals (object_class, klass->window_signals, i);
|
||||
|
||||
gtk_object_add_arg_type ("NautilusWindow::app_id",
|
||||
|
@ -414,9 +420,23 @@ nautilus_window_remove_meta_view(NautilusWindow *window, NautilusView *meta_view
|
|||
gtk_notebook_remove_page(GTK_NOTEBOOK(window->meta_notebook), pagenum);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_window_request_selection_change(NautilusWindow *window,
|
||||
Nautilus_SelectionRequestInfo *loc,
|
||||
GtkWidget *requesting_view)
|
||||
{
|
||||
NautilusWindowClass *klass;
|
||||
GtkObject *obj;
|
||||
|
||||
obj = GTK_OBJECT(window);
|
||||
|
||||
klass = NAUTILUS_WINDOW_CLASS(obj->klass);
|
||||
gtk_signal_emit(obj, klass->window_signals[1], loc, requesting_view);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_window_request_location_change(NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view)
|
||||
{
|
||||
NautilusWindowClass *klass;
|
||||
|
@ -430,7 +450,7 @@ nautilus_window_request_location_change(NautilusWindow *window,
|
|||
|
||||
static void
|
||||
nautilus_window_change_location(NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view,
|
||||
gboolean is_back)
|
||||
{
|
||||
|
@ -440,12 +460,13 @@ nautilus_window_change_location(NautilusWindow *window,
|
|||
|
||||
NautilusNavigationInfo loci_spot, *loci;
|
||||
|
||||
loci = nautilus_navinfo_new(&loci_spot, loc, window->current_uri, window->actual_current_uri, window->current_content_type);
|
||||
loci = nautilus_navinfo_new(&loci_spot, loc, window->current_uri, window->actual_current_uri, window->current_content_type,
|
||||
requesting_view);
|
||||
|
||||
if(!loci)
|
||||
{
|
||||
char cbuf[1024];
|
||||
g_snprintf(cbuf, sizeof(cbuf), _("Cannot load %s"), loc);
|
||||
g_snprintf(cbuf, sizeof(cbuf), _("Cannot load %s"), loc->requested_uri);
|
||||
nautilus_window_set_status(window, cbuf);
|
||||
return;
|
||||
}
|
||||
|
@ -459,14 +480,14 @@ nautilus_window_change_location(NautilusWindow *window,
|
|||
else
|
||||
{
|
||||
char *append_val;
|
||||
if(window->uris_next && !strcmp(loc, window->uris_next->data))
|
||||
if(window->uris_next && !strcmp(loc->requested_uri, window->uris_next->data))
|
||||
{
|
||||
append_val = window->uris_next->data;
|
||||
window->uris_next = g_slist_remove(window->uris_next, window->uris_next->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
append_val = g_strdup(loc);
|
||||
append_val = g_strdup(loc->requested_uri);
|
||||
g_slist_foreach(window->uris_next, (GFunc)g_free, NULL);
|
||||
g_slist_free(window->uris_next); window->uris_next = NULL;
|
||||
}
|
||||
|
@ -514,18 +535,18 @@ nautilus_window_change_location(NautilusWindow *window,
|
|||
g_slist_free(discard_views);
|
||||
|
||||
g_free(window->current_content_type);
|
||||
window->current_content_type = g_strdup(loci->content_type);
|
||||
window->current_content_type = g_strdup(loci->navinfo.content_type);
|
||||
g_free(window->current_uri);
|
||||
window->current_uri = g_strdup(loci->requested_uri);
|
||||
window->current_uri = g_strdup(loci->navinfo.requested_uri);
|
||||
g_free(window->actual_current_uri);
|
||||
window->actual_current_uri = g_strdup(loci->actual_uri);
|
||||
window->actual_current_uri = g_strdup(loci->navinfo.actual_uri);
|
||||
|
||||
nautilus_navinfo_free(loci);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_window_real_request_location_change (NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view)
|
||||
{
|
||||
nautilus_window_change_location(window, loc, requesting_view, FALSE);
|
||||
|
@ -683,23 +704,26 @@ nautilus_window_load_state(NautilusWindow *window, const char *config_path)
|
|||
static void
|
||||
nautilus_window_back (NautilusWindow *window)
|
||||
{
|
||||
char *uri;
|
||||
Nautilus_NavigationRequestInfo nri;
|
||||
|
||||
g_assert(window->uris_prev);
|
||||
|
||||
uri = window->uris_prev->data;
|
||||
memset(&nri, 0, sizeof(nri));
|
||||
nri.requested_uri = window->uris_prev->data;
|
||||
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
|
||||
|
||||
nautilus_window_change_location(window, uri, NULL, TRUE);
|
||||
nautilus_window_change_location(window, &nri, NULL, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_window_fwd (NautilusWindow *window)
|
||||
{
|
||||
char *uri;
|
||||
Nautilus_NavigationRequestInfo nri;
|
||||
|
||||
g_assert(window->uris_next);
|
||||
|
||||
uri = window->uris_next->data;
|
||||
|
||||
nautilus_window_change_location(window, uri, NULL, FALSE);
|
||||
memset(&nri, 0, sizeof(nri));
|
||||
nri.requested_uri = window->uris_next->data;
|
||||
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
|
||||
nautilus_window_change_location(window, &nri, NULL, FALSE);
|
||||
}
|
||||
|
|
|
@ -19,9 +19,12 @@ typedef struct {
|
|||
GnomeAppClass *parent_class;
|
||||
|
||||
void (* request_location_change)(NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
guint window_signals[1];
|
||||
void (* request_selection_change)(NautilusWindow *window,
|
||||
Nautilus_SelectionRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
guint window_signals[2];
|
||||
} NautilusWindowClass;
|
||||
|
||||
struct _NautilusWindow {
|
||||
|
@ -42,8 +45,11 @@ struct _NautilusWindow {
|
|||
GtkType nautilus_window_get_type(void);
|
||||
GtkWidget *nautilus_window_new(const char *app_id);
|
||||
void nautilus_window_request_location_change(NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
void nautilus_window_request_selection_change(NautilusWindow *window,
|
||||
Nautilus_SelectionRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
void nautilus_window_save_state(NautilusWindow *window, const char *config_path);
|
||||
void nautilus_window_load_state(NautilusWindow *window, const char *config_path);
|
||||
void nautilus_window_set_initial_state(NautilusWindow *window);
|
||||
|
|
|
@ -16,7 +16,7 @@ static void nautilus_window_get_arg (GtkObject *object,
|
|||
static void nautilus_window_close (GtkWidget *widget,
|
||||
GtkWidget *window);
|
||||
static void nautilus_window_real_request_location_change (NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
|
||||
#define CONTENTS_AS_HBOX
|
||||
|
@ -44,20 +44,20 @@ nautilus_window_get_type(void)
|
|||
return window_type;
|
||||
}
|
||||
|
||||
typedef void (*GtkSignal_NONE__STRING_OBJECT) (GtkObject * object,
|
||||
const char *arg1,
|
||||
typedef void (*GtkSignal_NONE__BOXED_OBJECT) (GtkObject * object,
|
||||
gpointer arg1,
|
||||
GtkObject *arg2,
|
||||
gpointer user_data);
|
||||
static void
|
||||
gtk_marshal_NONE__STRING_OBJECT (GtkObject * object,
|
||||
gtk_marshal_NONE__BOXED_OBJECT (GtkObject * object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data,
|
||||
GtkArg * args)
|
||||
{
|
||||
GtkSignal_NONE__STRING_OBJECT rfunc;
|
||||
rfunc = (GtkSignal_NONE__STRING_OBJECT) func;
|
||||
GtkSignal_NONE__BOXED_OBJECT rfunc;
|
||||
rfunc = (GtkSignal_NONE__BOXED_OBJECT) func;
|
||||
(*rfunc) (object,
|
||||
GTK_VALUE_STRING (args[0]),
|
||||
GTK_VALUE_BOXED (args[0]),
|
||||
GTK_VALUE_OBJECT (args[1]),
|
||||
func_data);
|
||||
}
|
||||
|
@ -90,8 +90,14 @@ nautilus_window_class_init (NautilusWindowClass *klass)
|
|||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusWindowClass, request_location_change),
|
||||
gtk_marshal_NONE__STRING_OBJECT,
|
||||
GTK_TYPE_NONE, 2, GTK_TYPE_STRING, GTK_TYPE_OBJECT);
|
||||
gtk_marshal_NONE__BOXED_OBJECT,
|
||||
GTK_TYPE_NONE, 2, GTK_TYPE_BOXED, GTK_TYPE_OBJECT);
|
||||
klass->window_signals[i++] = gtk_signal_new("request_selection_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusWindowClass, request_selection_change),
|
||||
gtk_marshal_NONE__BOXED_OBJECT,
|
||||
GTK_TYPE_NONE, 2, GTK_TYPE_BOXED, GTK_TYPE_OBJECT);
|
||||
gtk_object_class_add_signals (object_class, klass->window_signals, i);
|
||||
|
||||
gtk_object_add_arg_type ("NautilusWindow::app_id",
|
||||
|
@ -414,9 +420,23 @@ nautilus_window_remove_meta_view(NautilusWindow *window, NautilusView *meta_view
|
|||
gtk_notebook_remove_page(GTK_NOTEBOOK(window->meta_notebook), pagenum);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_window_request_selection_change(NautilusWindow *window,
|
||||
Nautilus_SelectionRequestInfo *loc,
|
||||
GtkWidget *requesting_view)
|
||||
{
|
||||
NautilusWindowClass *klass;
|
||||
GtkObject *obj;
|
||||
|
||||
obj = GTK_OBJECT(window);
|
||||
|
||||
klass = NAUTILUS_WINDOW_CLASS(obj->klass);
|
||||
gtk_signal_emit(obj, klass->window_signals[1], loc, requesting_view);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_window_request_location_change(NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view)
|
||||
{
|
||||
NautilusWindowClass *klass;
|
||||
|
@ -430,7 +450,7 @@ nautilus_window_request_location_change(NautilusWindow *window,
|
|||
|
||||
static void
|
||||
nautilus_window_change_location(NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view,
|
||||
gboolean is_back)
|
||||
{
|
||||
|
@ -440,12 +460,13 @@ nautilus_window_change_location(NautilusWindow *window,
|
|||
|
||||
NautilusNavigationInfo loci_spot, *loci;
|
||||
|
||||
loci = nautilus_navinfo_new(&loci_spot, loc, window->current_uri, window->actual_current_uri, window->current_content_type);
|
||||
loci = nautilus_navinfo_new(&loci_spot, loc, window->current_uri, window->actual_current_uri, window->current_content_type,
|
||||
requesting_view);
|
||||
|
||||
if(!loci)
|
||||
{
|
||||
char cbuf[1024];
|
||||
g_snprintf(cbuf, sizeof(cbuf), _("Cannot load %s"), loc);
|
||||
g_snprintf(cbuf, sizeof(cbuf), _("Cannot load %s"), loc->requested_uri);
|
||||
nautilus_window_set_status(window, cbuf);
|
||||
return;
|
||||
}
|
||||
|
@ -459,14 +480,14 @@ nautilus_window_change_location(NautilusWindow *window,
|
|||
else
|
||||
{
|
||||
char *append_val;
|
||||
if(window->uris_next && !strcmp(loc, window->uris_next->data))
|
||||
if(window->uris_next && !strcmp(loc->requested_uri, window->uris_next->data))
|
||||
{
|
||||
append_val = window->uris_next->data;
|
||||
window->uris_next = g_slist_remove(window->uris_next, window->uris_next->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
append_val = g_strdup(loc);
|
||||
append_val = g_strdup(loc->requested_uri);
|
||||
g_slist_foreach(window->uris_next, (GFunc)g_free, NULL);
|
||||
g_slist_free(window->uris_next); window->uris_next = NULL;
|
||||
}
|
||||
|
@ -514,18 +535,18 @@ nautilus_window_change_location(NautilusWindow *window,
|
|||
g_slist_free(discard_views);
|
||||
|
||||
g_free(window->current_content_type);
|
||||
window->current_content_type = g_strdup(loci->content_type);
|
||||
window->current_content_type = g_strdup(loci->navinfo.content_type);
|
||||
g_free(window->current_uri);
|
||||
window->current_uri = g_strdup(loci->requested_uri);
|
||||
window->current_uri = g_strdup(loci->navinfo.requested_uri);
|
||||
g_free(window->actual_current_uri);
|
||||
window->actual_current_uri = g_strdup(loci->actual_uri);
|
||||
window->actual_current_uri = g_strdup(loci->navinfo.actual_uri);
|
||||
|
||||
nautilus_navinfo_free(loci);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_window_real_request_location_change (NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view)
|
||||
{
|
||||
nautilus_window_change_location(window, loc, requesting_view, FALSE);
|
||||
|
@ -683,23 +704,26 @@ nautilus_window_load_state(NautilusWindow *window, const char *config_path)
|
|||
static void
|
||||
nautilus_window_back (NautilusWindow *window)
|
||||
{
|
||||
char *uri;
|
||||
Nautilus_NavigationRequestInfo nri;
|
||||
|
||||
g_assert(window->uris_prev);
|
||||
|
||||
uri = window->uris_prev->data;
|
||||
memset(&nri, 0, sizeof(nri));
|
||||
nri.requested_uri = window->uris_prev->data;
|
||||
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
|
||||
|
||||
nautilus_window_change_location(window, uri, NULL, TRUE);
|
||||
nautilus_window_change_location(window, &nri, NULL, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_window_fwd (NautilusWindow *window)
|
||||
{
|
||||
char *uri;
|
||||
Nautilus_NavigationRequestInfo nri;
|
||||
|
||||
g_assert(window->uris_next);
|
||||
|
||||
uri = window->uris_next->data;
|
||||
|
||||
nautilus_window_change_location(window, uri, NULL, FALSE);
|
||||
memset(&nri, 0, sizeof(nri));
|
||||
nri.requested_uri = window->uris_next->data;
|
||||
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
|
||||
nautilus_window_change_location(window, &nri, NULL, FALSE);
|
||||
}
|
||||
|
|
|
@ -19,9 +19,12 @@ typedef struct {
|
|||
GnomeAppClass *parent_class;
|
||||
|
||||
void (* request_location_change)(NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
guint window_signals[1];
|
||||
void (* request_selection_change)(NautilusWindow *window,
|
||||
Nautilus_SelectionRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
guint window_signals[2];
|
||||
} NautilusWindowClass;
|
||||
|
||||
struct _NautilusWindow {
|
||||
|
@ -42,8 +45,11 @@ struct _NautilusWindow {
|
|||
GtkType nautilus_window_get_type(void);
|
||||
GtkWidget *nautilus_window_new(const char *app_id);
|
||||
void nautilus_window_request_location_change(NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
void nautilus_window_request_selection_change(NautilusWindow *window,
|
||||
Nautilus_SelectionRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
void nautilus_window_save_state(NautilusWindow *window, const char *config_path);
|
||||
void nautilus_window_load_state(NautilusWindow *window, const char *config_path);
|
||||
void nautilus_window_set_initial_state(NautilusWindow *window);
|
||||
|
|
|
@ -23,15 +23,98 @@
|
|||
#include "ntl-window.h"
|
||||
|
||||
enum {
|
||||
NOTIFY_LOCATION_CHANGE,
|
||||
LAST_SIGNAL
|
||||
NOTIFY_LOCATION_CHANGE,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_MAIN_WINDOW
|
||||
ARG_0,
|
||||
ARG_MAIN_WINDOW
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
POA_Nautilus_ViewFrame servant;
|
||||
gpointer gnome_object;
|
||||
|
||||
NautilusView *view;
|
||||
} impl_POA_Nautilus_ViewFrame;
|
||||
|
||||
static void
|
||||
impl_Nautilus_ViewFrame_request_location_change(impl_POA_Nautilus_ViewFrame * servant,
|
||||
Nautilus_NavigationRequestInfo * navinfo,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_ViewFrame_request_selection_change(impl_POA_Nautilus_ViewFrame * servant,
|
||||
Nautilus_SelectionRequestInfo * selinfo,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static POA_Nautilus_ViewFrame__epv impl_Nautilus_ViewFrame_epv =
|
||||
{
|
||||
NULL, /* _private */
|
||||
(void(*))&impl_Nautilus_ViewFrame_request_location_change,
|
||||
(void(*))&impl_Nautilus_ViewFrame_request_selection_change
|
||||
};
|
||||
|
||||
static POA_Nautilus_ViewFrame__vepv impl_Nautilus_ViewFrame_vepv =
|
||||
{
|
||||
&gnome_object_base_epv,
|
||||
&gnome_object_epv,
|
||||
&impl_Nautilus_ViewFrame_epv
|
||||
};
|
||||
|
||||
static void
|
||||
impl_Nautilus_ViewFrame__destroy(GnomeObject *obj, impl_POA_Nautilus_ViewFrame *servant)
|
||||
{
|
||||
PortableServer_ObjectId *objid;
|
||||
CORBA_Environment ev;
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
|
||||
objid = PortableServer_POA_servant_to_id(bonobo_poa(), servant, &ev);
|
||||
PortableServer_POA_deactivate_object(bonobo_poa(), objid, &ev);
|
||||
CORBA_free(objid);
|
||||
obj->servant = NULL;
|
||||
|
||||
POA_Nautilus_ViewFrame__fini((PortableServer_Servant) servant, &ev);
|
||||
g_free(servant);
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static GnomeObject *
|
||||
impl_Nautilus_ViewFrame__create(NautilusView *view, CORBA_Environment * ev)
|
||||
{
|
||||
GnomeObject *retval;
|
||||
impl_POA_Nautilus_ViewFrame *newservant;
|
||||
|
||||
newservant = g_new0(impl_POA_Nautilus_ViewFrame, 1);
|
||||
newservant->servant.vepv = &impl_Nautilus_ViewFrame_vepv;
|
||||
newservant->view = view;
|
||||
POA_Nautilus_ViewFrame__init((PortableServer_Servant) newservant, ev);
|
||||
|
||||
retval = gnome_object_new_from_servant(newservant);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(retval), "destroy", GTK_SIGNAL_FUNC(impl_Nautilus_ViewFrame__destroy), newservant);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_ViewFrame_request_location_change(impl_POA_Nautilus_ViewFrame * servant,
|
||||
Nautilus_NavigationRequestInfo * navinfo,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
nautilus_view_request_location_change(servant->view, navinfo);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_ViewFrame_request_selection_change(impl_POA_Nautilus_ViewFrame * servant,
|
||||
Nautilus_SelectionRequestInfo * selinfo,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
nautilus_view_request_selection_change(servant->view, selinfo);
|
||||
}
|
||||
|
||||
static void nautilus_view_init (NautilusView *view);
|
||||
static void nautilus_view_constructed(NautilusView *view);
|
||||
static void nautilus_view_class_init (NautilusViewClass *klass);
|
||||
|
@ -45,7 +128,13 @@ static void nautilus_view_size_request (GtkWidget *widget,
|
|||
GtkRequisition *requisition);
|
||||
static void nautilus_view_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
|
||||
static void nautilus_view_notify_location_change(NautilusView *view,
|
||||
Nautilus_NavigationInfo *nav_context);
|
||||
static void nautilus_view_notify_selection_change(NautilusView *view,
|
||||
Nautilus_SelectionInfo *nav_context);
|
||||
static void nautilus_view_load_state(NautilusView *view, const char *config_path);
|
||||
static void nautilus_view_save_state(NautilusView *view, const char *config_path);
|
||||
static void nautilus_view_show_properties(NautilusView *view);
|
||||
|
||||
GtkType
|
||||
nautilus_view_get_type (void)
|
||||
|
@ -70,6 +159,7 @@ nautilus_view_get_type (void)
|
|||
return view_type;
|
||||
}
|
||||
|
||||
#if 0
|
||||
typedef void (*GtkSignal_NONE__BOXED_OBJECT_BOXED) (GtkObject * object,
|
||||
gpointer arg1,
|
||||
GtkObject *arg2,
|
||||
|
@ -89,6 +179,7 @@ gtk_marshal_NONE__BOXED_OBJECT_BOXED (GtkObject * object,
|
|||
GTK_VALUE_BOXED (args[2]),
|
||||
func_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
nautilus_view_class_init (NautilusViewClass *klass)
|
||||
|
@ -109,14 +200,19 @@ nautilus_view_class_init (NautilusViewClass *klass)
|
|||
|
||||
klass->parent_class = gtk_type_class (gtk_type_parent (object_class->type));
|
||||
klass->view_constructed = nautilus_view_constructed;
|
||||
klass->notify_location_change = nautilus_view_notify_location_change;
|
||||
klass->notify_selection_change = nautilus_view_notify_selection_change;
|
||||
klass->load_state = nautilus_view_load_state;
|
||||
klass->save_state = nautilus_view_save_state;
|
||||
klass->show_properties = nautilus_view_show_properties;
|
||||
|
||||
i = 0;
|
||||
klass->view_signals[i++] = gtk_signal_new("notify_location_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClass, notify_location_change),
|
||||
gtk_marshal_NONE__BOXED_OBJECT_BOXED,
|
||||
GTK_TYPE_NONE, 3, GTK_TYPE_BOXED, GTK_TYPE_OBJECT, GTK_TYPE_BOXED);
|
||||
gtk_marshal_NONE__BOXED,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
|
||||
klass->view_signals[i++] = gtk_signal_new("load_state",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
|
@ -135,6 +231,12 @@ nautilus_view_class_init (NautilusViewClass *klass)
|
|||
GTK_SIGNAL_OFFSET (NautilusViewClass, show_properties),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
klass->view_signals[i++] = gtk_signal_new("notify_selection_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClass, notify_selection_change),
|
||||
gtk_marshal_NONE__BOXED,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
|
||||
gtk_object_class_add_signals (object_class, klass->view_signals, i);
|
||||
|
||||
gtk_object_add_arg_type ("NautilusView::main_window",
|
||||
|
@ -175,7 +277,12 @@ nautilus_view_get_arg (GtkObject *object,
|
|||
static void
|
||||
nautilus_view_init (NautilusView *view)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
GTK_WIDGET_SET_FLAGS (view, GTK_NO_WINDOW);
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
view->view_frame = impl_Nautilus_ViewFrame__create(view, &ev);
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -202,7 +309,7 @@ nautilus_view_construct_arg_set(NautilusView *view)
|
|||
|
||||
void
|
||||
nautilus_view_request_location_change(NautilusView *view,
|
||||
NautilusLocationReference loc)
|
||||
Nautilus_NavigationRequestInfo *loc)
|
||||
{
|
||||
g_return_if_fail (view != NULL);
|
||||
g_return_if_fail (NAUTILUS_IS_VIEW (view));
|
||||
|
@ -211,6 +318,13 @@ nautilus_view_request_location_change(NautilusView *view,
|
|||
nautilus_window_request_location_change(NAUTILUS_WINDOW(view->main_window), loc, GTK_WIDGET(view));
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_view_request_selection_change (NautilusView *view,
|
||||
Nautilus_SelectionRequestInfo *loc)
|
||||
{
|
||||
nautilus_window_request_selection_change(NAUTILUS_WINDOW(view->main_window), loc, GTK_WIDGET(view));
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
|
@ -247,10 +361,24 @@ nautilus_view_size_allocate (GtkWidget *widget,
|
|||
gtk_widget_size_allocate (bin->child, &child_allocation);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_activate_uri(GnomeControlFrame *frame, const char *uri, gboolean relative, NautilusView *view)
|
||||
{
|
||||
Nautilus_NavigationRequestInfo nri;
|
||||
g_assert(!relative);
|
||||
|
||||
memset(&nri, 0, sizeof(nri));
|
||||
nri.requested_uri = (char *)uri;
|
||||
nautilus_view_request_location_change(view, &nri);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_view_load_client(NautilusView *view,
|
||||
const char * iid)
|
||||
{
|
||||
GnomeControlFrame *frame;
|
||||
CORBA_Environment ev;
|
||||
|
||||
if(view->client)
|
||||
{
|
||||
g_free(view->iid); view->iid = NULL;
|
||||
|
@ -259,7 +387,82 @@ nautilus_view_load_client(NautilusView *view,
|
|||
|
||||
view->client = gnome_bonobo_widget_new_control((char *)iid);
|
||||
g_return_if_fail(view->client);
|
||||
CORBA_exception_init(&ev);
|
||||
CORBA_Object_release(view->view_client, &ev);
|
||||
frame = gnome_bonobo_widget_get_control_frame(GNOME_BONOBO_WIDGET(view->client));
|
||||
gnome_object_add_interface(GNOME_OBJECT(frame), view->view_frame);
|
||||
view->view_client = GNOME_Unknown_query_interface(gnome_control_frame_get_control(GNOME_CONTROL_FRAME(frame)),
|
||||
"IDL:Nautilus/View:1.0", &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
view->view_client = CORBA_OBJECT_NIL;
|
||||
view->iid = g_strdup(iid);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(frame), "activate_uri", GTK_SIGNAL_FUNC(nautilus_view_activate_uri), view);
|
||||
gtk_widget_show(view->client);
|
||||
gtk_container_add(GTK_CONTAINER(view), view->client);
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_notify_location_change(NautilusView *view,
|
||||
Nautilus_NavigationInfo *nav_context)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
g_return_if_fail(!CORBA_Object_is_nil(view->view_client, &ev));
|
||||
|
||||
Nautilus_View_notify_location_change(view->view_client, nav_context, &ev);
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_notify_selection_change(NautilusView *view,
|
||||
Nautilus_SelectionInfo *nav_context)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
CORBA_exception_init(&ev);
|
||||
g_return_if_fail(!CORBA_Object_is_nil(view->view_client, &ev));
|
||||
|
||||
Nautilus_View_notify_selection_change(view->view_client, nav_context, &ev);
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_load_state(NautilusView *view, const char *config_path)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
CORBA_exception_init(&ev);
|
||||
g_return_if_fail(!CORBA_Object_is_nil(view->view_client, &ev));
|
||||
|
||||
Nautilus_View_load_state(view->view_client, (char *)config_path, &ev);
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_save_state(NautilusView *view, const char *config_path)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
CORBA_exception_init(&ev);
|
||||
g_return_if_fail(!CORBA_Object_is_nil(view->view_client, &ev));
|
||||
|
||||
Nautilus_View_save_state(view->view_client, (char *)config_path, &ev);
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_show_properties(NautilusView *view)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
CORBA_exception_init(&ev);
|
||||
g_return_if_fail(!CORBA_Object_is_nil(view->view_client, &ev));
|
||||
|
||||
Nautilus_View_show_properties(view->view_client, &ev);
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,9 @@ struct _NautilusViewClass
|
|||
GtkBinClass parent_spot;
|
||||
|
||||
void (*notify_location_change) (NautilusView *view,
|
||||
NautilusNavigationInfo *nav_context);
|
||||
Nautilus_NavigationInfo *nav_context);
|
||||
void (*notify_selection_change) (NautilusView *view,
|
||||
Nautilus_SelectionInfo *nav_context);
|
||||
void (*load_state) (NautilusView *view, const char *config_path);
|
||||
void (*save_state) (NautilusView *view, const char *config_path);
|
||||
void (*show_properties) (NautilusView *view);
|
||||
|
@ -50,7 +52,7 @@ struct _NautilusViewClass
|
|||
void (*view_constructed) (NautilusView *view); /* Not a signal. Work-around for Gtk+'s lack of a 'constructed' operation */
|
||||
|
||||
GtkBinClass *parent_class;
|
||||
guint view_signals[3];
|
||||
guint view_signals[6];
|
||||
guint num_construct_args;
|
||||
};
|
||||
|
||||
|
@ -62,13 +64,18 @@ struct _NautilusView
|
|||
|
||||
char *iid;
|
||||
GtkWidget *client;
|
||||
CORBA_Object view_client;
|
||||
|
||||
GnomeObject *view_frame;
|
||||
|
||||
guint construct_arg_count;
|
||||
};
|
||||
|
||||
GtkType nautilus_view_get_type (void);
|
||||
void nautilus_view_request_location_change (NautilusView *view,
|
||||
NautilusLocationReference loc);
|
||||
Nautilus_NavigationRequestInfo *loc);
|
||||
void nautilus_view_request_selection_change (NautilusView *view,
|
||||
Nautilus_SelectionRequestInfo *loc);
|
||||
void nautilus_view_load_client (NautilusView *view,
|
||||
const char * iid);
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ static void nautilus_window_get_arg (GtkObject *object,
|
|||
static void nautilus_window_close (GtkWidget *widget,
|
||||
GtkWidget *window);
|
||||
static void nautilus_window_real_request_location_change (NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
|
||||
#define CONTENTS_AS_HBOX
|
||||
|
@ -44,20 +44,20 @@ nautilus_window_get_type(void)
|
|||
return window_type;
|
||||
}
|
||||
|
||||
typedef void (*GtkSignal_NONE__STRING_OBJECT) (GtkObject * object,
|
||||
const char *arg1,
|
||||
typedef void (*GtkSignal_NONE__BOXED_OBJECT) (GtkObject * object,
|
||||
gpointer arg1,
|
||||
GtkObject *arg2,
|
||||
gpointer user_data);
|
||||
static void
|
||||
gtk_marshal_NONE__STRING_OBJECT (GtkObject * object,
|
||||
gtk_marshal_NONE__BOXED_OBJECT (GtkObject * object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data,
|
||||
GtkArg * args)
|
||||
{
|
||||
GtkSignal_NONE__STRING_OBJECT rfunc;
|
||||
rfunc = (GtkSignal_NONE__STRING_OBJECT) func;
|
||||
GtkSignal_NONE__BOXED_OBJECT rfunc;
|
||||
rfunc = (GtkSignal_NONE__BOXED_OBJECT) func;
|
||||
(*rfunc) (object,
|
||||
GTK_VALUE_STRING (args[0]),
|
||||
GTK_VALUE_BOXED (args[0]),
|
||||
GTK_VALUE_OBJECT (args[1]),
|
||||
func_data);
|
||||
}
|
||||
|
@ -90,8 +90,14 @@ nautilus_window_class_init (NautilusWindowClass *klass)
|
|||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusWindowClass, request_location_change),
|
||||
gtk_marshal_NONE__STRING_OBJECT,
|
||||
GTK_TYPE_NONE, 2, GTK_TYPE_STRING, GTK_TYPE_OBJECT);
|
||||
gtk_marshal_NONE__BOXED_OBJECT,
|
||||
GTK_TYPE_NONE, 2, GTK_TYPE_BOXED, GTK_TYPE_OBJECT);
|
||||
klass->window_signals[i++] = gtk_signal_new("request_selection_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusWindowClass, request_selection_change),
|
||||
gtk_marshal_NONE__BOXED_OBJECT,
|
||||
GTK_TYPE_NONE, 2, GTK_TYPE_BOXED, GTK_TYPE_OBJECT);
|
||||
gtk_object_class_add_signals (object_class, klass->window_signals, i);
|
||||
|
||||
gtk_object_add_arg_type ("NautilusWindow::app_id",
|
||||
|
@ -414,9 +420,23 @@ nautilus_window_remove_meta_view(NautilusWindow *window, NautilusView *meta_view
|
|||
gtk_notebook_remove_page(GTK_NOTEBOOK(window->meta_notebook), pagenum);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_window_request_selection_change(NautilusWindow *window,
|
||||
Nautilus_SelectionRequestInfo *loc,
|
||||
GtkWidget *requesting_view)
|
||||
{
|
||||
NautilusWindowClass *klass;
|
||||
GtkObject *obj;
|
||||
|
||||
obj = GTK_OBJECT(window);
|
||||
|
||||
klass = NAUTILUS_WINDOW_CLASS(obj->klass);
|
||||
gtk_signal_emit(obj, klass->window_signals[1], loc, requesting_view);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_window_request_location_change(NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view)
|
||||
{
|
||||
NautilusWindowClass *klass;
|
||||
|
@ -430,7 +450,7 @@ nautilus_window_request_location_change(NautilusWindow *window,
|
|||
|
||||
static void
|
||||
nautilus_window_change_location(NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view,
|
||||
gboolean is_back)
|
||||
{
|
||||
|
@ -440,12 +460,13 @@ nautilus_window_change_location(NautilusWindow *window,
|
|||
|
||||
NautilusNavigationInfo loci_spot, *loci;
|
||||
|
||||
loci = nautilus_navinfo_new(&loci_spot, loc, window->current_uri, window->actual_current_uri, window->current_content_type);
|
||||
loci = nautilus_navinfo_new(&loci_spot, loc, window->current_uri, window->actual_current_uri, window->current_content_type,
|
||||
requesting_view);
|
||||
|
||||
if(!loci)
|
||||
{
|
||||
char cbuf[1024];
|
||||
g_snprintf(cbuf, sizeof(cbuf), _("Cannot load %s"), loc);
|
||||
g_snprintf(cbuf, sizeof(cbuf), _("Cannot load %s"), loc->requested_uri);
|
||||
nautilus_window_set_status(window, cbuf);
|
||||
return;
|
||||
}
|
||||
|
@ -459,14 +480,14 @@ nautilus_window_change_location(NautilusWindow *window,
|
|||
else
|
||||
{
|
||||
char *append_val;
|
||||
if(window->uris_next && !strcmp(loc, window->uris_next->data))
|
||||
if(window->uris_next && !strcmp(loc->requested_uri, window->uris_next->data))
|
||||
{
|
||||
append_val = window->uris_next->data;
|
||||
window->uris_next = g_slist_remove(window->uris_next, window->uris_next->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
append_val = g_strdup(loc);
|
||||
append_val = g_strdup(loc->requested_uri);
|
||||
g_slist_foreach(window->uris_next, (GFunc)g_free, NULL);
|
||||
g_slist_free(window->uris_next); window->uris_next = NULL;
|
||||
}
|
||||
|
@ -514,18 +535,18 @@ nautilus_window_change_location(NautilusWindow *window,
|
|||
g_slist_free(discard_views);
|
||||
|
||||
g_free(window->current_content_type);
|
||||
window->current_content_type = g_strdup(loci->content_type);
|
||||
window->current_content_type = g_strdup(loci->navinfo.content_type);
|
||||
g_free(window->current_uri);
|
||||
window->current_uri = g_strdup(loci->requested_uri);
|
||||
window->current_uri = g_strdup(loci->navinfo.requested_uri);
|
||||
g_free(window->actual_current_uri);
|
||||
window->actual_current_uri = g_strdup(loci->actual_uri);
|
||||
window->actual_current_uri = g_strdup(loci->navinfo.actual_uri);
|
||||
|
||||
nautilus_navinfo_free(loci);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_window_real_request_location_change (NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view)
|
||||
{
|
||||
nautilus_window_change_location(window, loc, requesting_view, FALSE);
|
||||
|
@ -683,23 +704,26 @@ nautilus_window_load_state(NautilusWindow *window, const char *config_path)
|
|||
static void
|
||||
nautilus_window_back (NautilusWindow *window)
|
||||
{
|
||||
char *uri;
|
||||
Nautilus_NavigationRequestInfo nri;
|
||||
|
||||
g_assert(window->uris_prev);
|
||||
|
||||
uri = window->uris_prev->data;
|
||||
memset(&nri, 0, sizeof(nri));
|
||||
nri.requested_uri = window->uris_prev->data;
|
||||
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
|
||||
|
||||
nautilus_window_change_location(window, uri, NULL, TRUE);
|
||||
nautilus_window_change_location(window, &nri, NULL, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_window_fwd (NautilusWindow *window)
|
||||
{
|
||||
char *uri;
|
||||
Nautilus_NavigationRequestInfo nri;
|
||||
|
||||
g_assert(window->uris_next);
|
||||
|
||||
uri = window->uris_next->data;
|
||||
|
||||
nautilus_window_change_location(window, uri, NULL, FALSE);
|
||||
memset(&nri, 0, sizeof(nri));
|
||||
nri.requested_uri = window->uris_next->data;
|
||||
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
|
||||
nautilus_window_change_location(window, &nri, NULL, FALSE);
|
||||
}
|
||||
|
|
|
@ -19,9 +19,12 @@ typedef struct {
|
|||
GnomeAppClass *parent_class;
|
||||
|
||||
void (* request_location_change)(NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
guint window_signals[1];
|
||||
void (* request_selection_change)(NautilusWindow *window,
|
||||
Nautilus_SelectionRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
guint window_signals[2];
|
||||
} NautilusWindowClass;
|
||||
|
||||
struct _NautilusWindow {
|
||||
|
@ -42,8 +45,11 @@ struct _NautilusWindow {
|
|||
GtkType nautilus_window_get_type(void);
|
||||
GtkWidget *nautilus_window_new(const char *app_id);
|
||||
void nautilus_window_request_location_change(NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
void nautilus_window_request_selection_change(NautilusWindow *window,
|
||||
Nautilus_SelectionRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
void nautilus_window_save_state(NautilusWindow *window, const char *config_path);
|
||||
void nautilus_window_load_state(NautilusWindow *window, const char *config_path);
|
||||
void nautilus_window_set_initial_state(NautilusWindow *window);
|
||||
|
|
|
@ -50,5 +50,36 @@ nautilus_meta_view_new(void)
|
|||
const char *
|
||||
nautilus_meta_view_get_description(NautilusMetaView *nview)
|
||||
{
|
||||
return NULL;
|
||||
NautilusView *view = NAUTILUS_VIEW(nview);
|
||||
GnomePropertyBagClient *bc;
|
||||
GNOME_Property prop;
|
||||
CORBA_Environment ev;
|
||||
char *retval = NULL;
|
||||
CORBA_any *anyval;
|
||||
|
||||
g_return_val_if_fail(view->client, NULL);
|
||||
|
||||
bc = gnome_control_frame_get_control_property_bag(gnome_bonobo_widget_get_control_frame(GNOME_BONOBO_WIDGET(view->client)));
|
||||
g_return_val_if_fail(bc, NULL);
|
||||
|
||||
prop = gnome_property_bag_client_get_property(bc, "description");
|
||||
CORBA_exception_init(&ev);
|
||||
|
||||
if(CORBA_Object_is_nil(prop, &ev))
|
||||
goto out;
|
||||
|
||||
anyval = GNOME_Property_get_value(prop, &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
goto out;
|
||||
|
||||
if(!CORBA_TypeCode_equal(anyval->_type, TC_string, &ev))
|
||||
goto out;
|
||||
|
||||
retval = g_strdup(*(CORBA_char **)anyval->_value);
|
||||
|
||||
CORBA_free(anyval);
|
||||
|
||||
out:
|
||||
CORBA_exception_free(&ev);
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
#define NTL_TYPES_H 1
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <libnautilus/libnautilus.h>
|
||||
|
||||
typedef char *NautilusLocationReference;
|
||||
|
||||
typedef struct {
|
||||
NautilusLocationReference requested_uri, actual_uri;
|
||||
NautilusLocationReference referring_uri, actual_referring_uri;
|
||||
char *content_type, *referring_content_type;
|
||||
Nautilus_NavigationInfo navinfo;
|
||||
|
||||
GtkWidget *requesting_view;
|
||||
|
||||
char *content_iid;
|
||||
|
|
|
@ -2,15 +2,21 @@
|
|||
#include <libgnorba/gnorba.h>
|
||||
|
||||
NautilusNavigationInfo *
|
||||
nautilus_navinfo_new(NautilusNavigationInfo *navinfo, NautilusLocationReference uri,
|
||||
nautilus_navinfo_new(NautilusNavigationInfo *navinfo,
|
||||
Nautilus_NavigationRequestInfo *nri,
|
||||
NautilusLocationReference referring_uri,
|
||||
NautilusLocationReference actual_referring_uri,
|
||||
const char *referring_content_type)
|
||||
const char *referring_content_type,
|
||||
GtkWidget *requesting_view)
|
||||
{
|
||||
navinfo->requested_uri = uri;
|
||||
navinfo->referring_uri = referring_uri;
|
||||
navinfo->actual_referring_uri = actual_referring_uri;
|
||||
navinfo->referring_content_type = (char *)referring_content_type;
|
||||
memset(navinfo, 0, sizeof(*navinfo));
|
||||
|
||||
navinfo->navinfo.requested_uri = nri->requested_uri;
|
||||
navinfo->navinfo.referring_uri = referring_uri;
|
||||
navinfo->navinfo.actual_referring_uri = actual_referring_uri;
|
||||
navinfo->navinfo.referring_content_type = (char *)referring_content_type;
|
||||
|
||||
navinfo->requesting_view = requesting_view;
|
||||
|
||||
/* XXX turn the provided information into some activateable IID's */
|
||||
|
||||
|
|
|
@ -3,10 +3,12 @@
|
|||
|
||||
#include "ntl-types.h"
|
||||
|
||||
NautilusNavigationInfo *nautilus_navinfo_new(NautilusNavigationInfo *navinfo, NautilusLocationReference uri,
|
||||
NautilusNavigationInfo *nautilus_navinfo_new(NautilusNavigationInfo *navinfo,
|
||||
Nautilus_NavigationRequestInfo *nri,
|
||||
NautilusLocationReference referring_uri,
|
||||
NautilusLocationReference actual_referring_uri,
|
||||
const char *referring_content_type);
|
||||
const char *referring_content_type,
|
||||
GtkWidget *requesting_view);
|
||||
void nautilus_navinfo_free(NautilusNavigationInfo *navinfo);
|
||||
|
||||
#endif
|
||||
|
|
219
src/ntl-view.c
219
src/ntl-view.c
|
@ -23,15 +23,98 @@
|
|||
#include "ntl-window.h"
|
||||
|
||||
enum {
|
||||
NOTIFY_LOCATION_CHANGE,
|
||||
LAST_SIGNAL
|
||||
NOTIFY_LOCATION_CHANGE,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_MAIN_WINDOW
|
||||
ARG_0,
|
||||
ARG_MAIN_WINDOW
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
POA_Nautilus_ViewFrame servant;
|
||||
gpointer gnome_object;
|
||||
|
||||
NautilusView *view;
|
||||
} impl_POA_Nautilus_ViewFrame;
|
||||
|
||||
static void
|
||||
impl_Nautilus_ViewFrame_request_location_change(impl_POA_Nautilus_ViewFrame * servant,
|
||||
Nautilus_NavigationRequestInfo * navinfo,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static void
|
||||
impl_Nautilus_ViewFrame_request_selection_change(impl_POA_Nautilus_ViewFrame * servant,
|
||||
Nautilus_SelectionRequestInfo * selinfo,
|
||||
CORBA_Environment * ev);
|
||||
|
||||
static POA_Nautilus_ViewFrame__epv impl_Nautilus_ViewFrame_epv =
|
||||
{
|
||||
NULL, /* _private */
|
||||
(void(*))&impl_Nautilus_ViewFrame_request_location_change,
|
||||
(void(*))&impl_Nautilus_ViewFrame_request_selection_change
|
||||
};
|
||||
|
||||
static POA_Nautilus_ViewFrame__vepv impl_Nautilus_ViewFrame_vepv =
|
||||
{
|
||||
&gnome_object_base_epv,
|
||||
&gnome_object_epv,
|
||||
&impl_Nautilus_ViewFrame_epv
|
||||
};
|
||||
|
||||
static void
|
||||
impl_Nautilus_ViewFrame__destroy(GnomeObject *obj, impl_POA_Nautilus_ViewFrame *servant)
|
||||
{
|
||||
PortableServer_ObjectId *objid;
|
||||
CORBA_Environment ev;
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
|
||||
objid = PortableServer_POA_servant_to_id(bonobo_poa(), servant, &ev);
|
||||
PortableServer_POA_deactivate_object(bonobo_poa(), objid, &ev);
|
||||
CORBA_free(objid);
|
||||
obj->servant = NULL;
|
||||
|
||||
POA_Nautilus_ViewFrame__fini((PortableServer_Servant) servant, &ev);
|
||||
g_free(servant);
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static GnomeObject *
|
||||
impl_Nautilus_ViewFrame__create(NautilusView *view, CORBA_Environment * ev)
|
||||
{
|
||||
GnomeObject *retval;
|
||||
impl_POA_Nautilus_ViewFrame *newservant;
|
||||
|
||||
newservant = g_new0(impl_POA_Nautilus_ViewFrame, 1);
|
||||
newservant->servant.vepv = &impl_Nautilus_ViewFrame_vepv;
|
||||
newservant->view = view;
|
||||
POA_Nautilus_ViewFrame__init((PortableServer_Servant) newservant, ev);
|
||||
|
||||
retval = gnome_object_new_from_servant(newservant);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(retval), "destroy", GTK_SIGNAL_FUNC(impl_Nautilus_ViewFrame__destroy), newservant);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_ViewFrame_request_location_change(impl_POA_Nautilus_ViewFrame * servant,
|
||||
Nautilus_NavigationRequestInfo * navinfo,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
nautilus_view_request_location_change(servant->view, navinfo);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_Nautilus_ViewFrame_request_selection_change(impl_POA_Nautilus_ViewFrame * servant,
|
||||
Nautilus_SelectionRequestInfo * selinfo,
|
||||
CORBA_Environment * ev)
|
||||
{
|
||||
nautilus_view_request_selection_change(servant->view, selinfo);
|
||||
}
|
||||
|
||||
static void nautilus_view_init (NautilusView *view);
|
||||
static void nautilus_view_constructed(NautilusView *view);
|
||||
static void nautilus_view_class_init (NautilusViewClass *klass);
|
||||
|
@ -45,7 +128,13 @@ static void nautilus_view_size_request (GtkWidget *widget,
|
|||
GtkRequisition *requisition);
|
||||
static void nautilus_view_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
|
||||
static void nautilus_view_notify_location_change(NautilusView *view,
|
||||
Nautilus_NavigationInfo *nav_context);
|
||||
static void nautilus_view_notify_selection_change(NautilusView *view,
|
||||
Nautilus_SelectionInfo *nav_context);
|
||||
static void nautilus_view_load_state(NautilusView *view, const char *config_path);
|
||||
static void nautilus_view_save_state(NautilusView *view, const char *config_path);
|
||||
static void nautilus_view_show_properties(NautilusView *view);
|
||||
|
||||
GtkType
|
||||
nautilus_view_get_type (void)
|
||||
|
@ -70,6 +159,7 @@ nautilus_view_get_type (void)
|
|||
return view_type;
|
||||
}
|
||||
|
||||
#if 0
|
||||
typedef void (*GtkSignal_NONE__BOXED_OBJECT_BOXED) (GtkObject * object,
|
||||
gpointer arg1,
|
||||
GtkObject *arg2,
|
||||
|
@ -89,6 +179,7 @@ gtk_marshal_NONE__BOXED_OBJECT_BOXED (GtkObject * object,
|
|||
GTK_VALUE_BOXED (args[2]),
|
||||
func_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
nautilus_view_class_init (NautilusViewClass *klass)
|
||||
|
@ -109,14 +200,19 @@ nautilus_view_class_init (NautilusViewClass *klass)
|
|||
|
||||
klass->parent_class = gtk_type_class (gtk_type_parent (object_class->type));
|
||||
klass->view_constructed = nautilus_view_constructed;
|
||||
klass->notify_location_change = nautilus_view_notify_location_change;
|
||||
klass->notify_selection_change = nautilus_view_notify_selection_change;
|
||||
klass->load_state = nautilus_view_load_state;
|
||||
klass->save_state = nautilus_view_save_state;
|
||||
klass->show_properties = nautilus_view_show_properties;
|
||||
|
||||
i = 0;
|
||||
klass->view_signals[i++] = gtk_signal_new("notify_location_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClass, notify_location_change),
|
||||
gtk_marshal_NONE__BOXED_OBJECT_BOXED,
|
||||
GTK_TYPE_NONE, 3, GTK_TYPE_BOXED, GTK_TYPE_OBJECT, GTK_TYPE_BOXED);
|
||||
gtk_marshal_NONE__BOXED,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
|
||||
klass->view_signals[i++] = gtk_signal_new("load_state",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
|
@ -135,6 +231,12 @@ nautilus_view_class_init (NautilusViewClass *klass)
|
|||
GTK_SIGNAL_OFFSET (NautilusViewClass, show_properties),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
klass->view_signals[i++] = gtk_signal_new("notify_selection_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusViewClass, notify_selection_change),
|
||||
gtk_marshal_NONE__BOXED,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
|
||||
gtk_object_class_add_signals (object_class, klass->view_signals, i);
|
||||
|
||||
gtk_object_add_arg_type ("NautilusView::main_window",
|
||||
|
@ -175,7 +277,12 @@ nautilus_view_get_arg (GtkObject *object,
|
|||
static void
|
||||
nautilus_view_init (NautilusView *view)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
GTK_WIDGET_SET_FLAGS (view, GTK_NO_WINDOW);
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
view->view_frame = impl_Nautilus_ViewFrame__create(view, &ev);
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -202,7 +309,7 @@ nautilus_view_construct_arg_set(NautilusView *view)
|
|||
|
||||
void
|
||||
nautilus_view_request_location_change(NautilusView *view,
|
||||
NautilusLocationReference loc)
|
||||
Nautilus_NavigationRequestInfo *loc)
|
||||
{
|
||||
g_return_if_fail (view != NULL);
|
||||
g_return_if_fail (NAUTILUS_IS_VIEW (view));
|
||||
|
@ -211,6 +318,13 @@ nautilus_view_request_location_change(NautilusView *view,
|
|||
nautilus_window_request_location_change(NAUTILUS_WINDOW(view->main_window), loc, GTK_WIDGET(view));
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_view_request_selection_change (NautilusView *view,
|
||||
Nautilus_SelectionRequestInfo *loc)
|
||||
{
|
||||
nautilus_window_request_selection_change(NAUTILUS_WINDOW(view->main_window), loc, GTK_WIDGET(view));
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
|
@ -247,10 +361,24 @@ nautilus_view_size_allocate (GtkWidget *widget,
|
|||
gtk_widget_size_allocate (bin->child, &child_allocation);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_activate_uri(GnomeControlFrame *frame, const char *uri, gboolean relative, NautilusView *view)
|
||||
{
|
||||
Nautilus_NavigationRequestInfo nri;
|
||||
g_assert(!relative);
|
||||
|
||||
memset(&nri, 0, sizeof(nri));
|
||||
nri.requested_uri = (char *)uri;
|
||||
nautilus_view_request_location_change(view, &nri);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_view_load_client(NautilusView *view,
|
||||
const char * iid)
|
||||
{
|
||||
GnomeControlFrame *frame;
|
||||
CORBA_Environment ev;
|
||||
|
||||
if(view->client)
|
||||
{
|
||||
g_free(view->iid); view->iid = NULL;
|
||||
|
@ -259,7 +387,82 @@ nautilus_view_load_client(NautilusView *view,
|
|||
|
||||
view->client = gnome_bonobo_widget_new_control((char *)iid);
|
||||
g_return_if_fail(view->client);
|
||||
CORBA_exception_init(&ev);
|
||||
CORBA_Object_release(view->view_client, &ev);
|
||||
frame = gnome_bonobo_widget_get_control_frame(GNOME_BONOBO_WIDGET(view->client));
|
||||
gnome_object_add_interface(GNOME_OBJECT(frame), view->view_frame);
|
||||
view->view_client = GNOME_Unknown_query_interface(gnome_control_frame_get_control(GNOME_CONTROL_FRAME(frame)),
|
||||
"IDL:Nautilus/View:1.0", &ev);
|
||||
if(ev._major != CORBA_NO_EXCEPTION)
|
||||
view->view_client = CORBA_OBJECT_NIL;
|
||||
view->iid = g_strdup(iid);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(frame), "activate_uri", GTK_SIGNAL_FUNC(nautilus_view_activate_uri), view);
|
||||
gtk_widget_show(view->client);
|
||||
gtk_container_add(GTK_CONTAINER(view), view->client);
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_notify_location_change(NautilusView *view,
|
||||
Nautilus_NavigationInfo *nav_context)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
|
||||
CORBA_exception_init(&ev);
|
||||
g_return_if_fail(!CORBA_Object_is_nil(view->view_client, &ev));
|
||||
|
||||
Nautilus_View_notify_location_change(view->view_client, nav_context, &ev);
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_notify_selection_change(NautilusView *view,
|
||||
Nautilus_SelectionInfo *nav_context)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
CORBA_exception_init(&ev);
|
||||
g_return_if_fail(!CORBA_Object_is_nil(view->view_client, &ev));
|
||||
|
||||
Nautilus_View_notify_selection_change(view->view_client, nav_context, &ev);
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_load_state(NautilusView *view, const char *config_path)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
CORBA_exception_init(&ev);
|
||||
g_return_if_fail(!CORBA_Object_is_nil(view->view_client, &ev));
|
||||
|
||||
Nautilus_View_load_state(view->view_client, (char *)config_path, &ev);
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_save_state(NautilusView *view, const char *config_path)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
CORBA_exception_init(&ev);
|
||||
g_return_if_fail(!CORBA_Object_is_nil(view->view_client, &ev));
|
||||
|
||||
Nautilus_View_save_state(view->view_client, (char *)config_path, &ev);
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_view_show_properties(NautilusView *view)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
CORBA_exception_init(&ev);
|
||||
g_return_if_fail(!CORBA_Object_is_nil(view->view_client, &ev));
|
||||
|
||||
Nautilus_View_show_properties(view->view_client, &ev);
|
||||
|
||||
CORBA_exception_free(&ev);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,9 @@ struct _NautilusViewClass
|
|||
GtkBinClass parent_spot;
|
||||
|
||||
void (*notify_location_change) (NautilusView *view,
|
||||
NautilusNavigationInfo *nav_context);
|
||||
Nautilus_NavigationInfo *nav_context);
|
||||
void (*notify_selection_change) (NautilusView *view,
|
||||
Nautilus_SelectionInfo *nav_context);
|
||||
void (*load_state) (NautilusView *view, const char *config_path);
|
||||
void (*save_state) (NautilusView *view, const char *config_path);
|
||||
void (*show_properties) (NautilusView *view);
|
||||
|
@ -50,7 +52,7 @@ struct _NautilusViewClass
|
|||
void (*view_constructed) (NautilusView *view); /* Not a signal. Work-around for Gtk+'s lack of a 'constructed' operation */
|
||||
|
||||
GtkBinClass *parent_class;
|
||||
guint view_signals[3];
|
||||
guint view_signals[6];
|
||||
guint num_construct_args;
|
||||
};
|
||||
|
||||
|
@ -62,13 +64,18 @@ struct _NautilusView
|
|||
|
||||
char *iid;
|
||||
GtkWidget *client;
|
||||
CORBA_Object view_client;
|
||||
|
||||
GnomeObject *view_frame;
|
||||
|
||||
guint construct_arg_count;
|
||||
};
|
||||
|
||||
GtkType nautilus_view_get_type (void);
|
||||
void nautilus_view_request_location_change (NautilusView *view,
|
||||
NautilusLocationReference loc);
|
||||
Nautilus_NavigationRequestInfo *loc);
|
||||
void nautilus_view_request_selection_change (NautilusView *view,
|
||||
Nautilus_SelectionRequestInfo *loc);
|
||||
void nautilus_view_load_client (NautilusView *view,
|
||||
const char * iid);
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ static void nautilus_window_get_arg (GtkObject *object,
|
|||
static void nautilus_window_close (GtkWidget *widget,
|
||||
GtkWidget *window);
|
||||
static void nautilus_window_real_request_location_change (NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
|
||||
#define CONTENTS_AS_HBOX
|
||||
|
@ -44,20 +44,20 @@ nautilus_window_get_type(void)
|
|||
return window_type;
|
||||
}
|
||||
|
||||
typedef void (*GtkSignal_NONE__STRING_OBJECT) (GtkObject * object,
|
||||
const char *arg1,
|
||||
typedef void (*GtkSignal_NONE__BOXED_OBJECT) (GtkObject * object,
|
||||
gpointer arg1,
|
||||
GtkObject *arg2,
|
||||
gpointer user_data);
|
||||
static void
|
||||
gtk_marshal_NONE__STRING_OBJECT (GtkObject * object,
|
||||
gtk_marshal_NONE__BOXED_OBJECT (GtkObject * object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data,
|
||||
GtkArg * args)
|
||||
{
|
||||
GtkSignal_NONE__STRING_OBJECT rfunc;
|
||||
rfunc = (GtkSignal_NONE__STRING_OBJECT) func;
|
||||
GtkSignal_NONE__BOXED_OBJECT rfunc;
|
||||
rfunc = (GtkSignal_NONE__BOXED_OBJECT) func;
|
||||
(*rfunc) (object,
|
||||
GTK_VALUE_STRING (args[0]),
|
||||
GTK_VALUE_BOXED (args[0]),
|
||||
GTK_VALUE_OBJECT (args[1]),
|
||||
func_data);
|
||||
}
|
||||
|
@ -90,8 +90,14 @@ nautilus_window_class_init (NautilusWindowClass *klass)
|
|||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusWindowClass, request_location_change),
|
||||
gtk_marshal_NONE__STRING_OBJECT,
|
||||
GTK_TYPE_NONE, 2, GTK_TYPE_STRING, GTK_TYPE_OBJECT);
|
||||
gtk_marshal_NONE__BOXED_OBJECT,
|
||||
GTK_TYPE_NONE, 2, GTK_TYPE_BOXED, GTK_TYPE_OBJECT);
|
||||
klass->window_signals[i++] = gtk_signal_new("request_selection_change",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (NautilusWindowClass, request_selection_change),
|
||||
gtk_marshal_NONE__BOXED_OBJECT,
|
||||
GTK_TYPE_NONE, 2, GTK_TYPE_BOXED, GTK_TYPE_OBJECT);
|
||||
gtk_object_class_add_signals (object_class, klass->window_signals, i);
|
||||
|
||||
gtk_object_add_arg_type ("NautilusWindow::app_id",
|
||||
|
@ -414,9 +420,23 @@ nautilus_window_remove_meta_view(NautilusWindow *window, NautilusView *meta_view
|
|||
gtk_notebook_remove_page(GTK_NOTEBOOK(window->meta_notebook), pagenum);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_window_request_selection_change(NautilusWindow *window,
|
||||
Nautilus_SelectionRequestInfo *loc,
|
||||
GtkWidget *requesting_view)
|
||||
{
|
||||
NautilusWindowClass *klass;
|
||||
GtkObject *obj;
|
||||
|
||||
obj = GTK_OBJECT(window);
|
||||
|
||||
klass = NAUTILUS_WINDOW_CLASS(obj->klass);
|
||||
gtk_signal_emit(obj, klass->window_signals[1], loc, requesting_view);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_window_request_location_change(NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view)
|
||||
{
|
||||
NautilusWindowClass *klass;
|
||||
|
@ -430,7 +450,7 @@ nautilus_window_request_location_change(NautilusWindow *window,
|
|||
|
||||
static void
|
||||
nautilus_window_change_location(NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view,
|
||||
gboolean is_back)
|
||||
{
|
||||
|
@ -440,12 +460,13 @@ nautilus_window_change_location(NautilusWindow *window,
|
|||
|
||||
NautilusNavigationInfo loci_spot, *loci;
|
||||
|
||||
loci = nautilus_navinfo_new(&loci_spot, loc, window->current_uri, window->actual_current_uri, window->current_content_type);
|
||||
loci = nautilus_navinfo_new(&loci_spot, loc, window->current_uri, window->actual_current_uri, window->current_content_type,
|
||||
requesting_view);
|
||||
|
||||
if(!loci)
|
||||
{
|
||||
char cbuf[1024];
|
||||
g_snprintf(cbuf, sizeof(cbuf), _("Cannot load %s"), loc);
|
||||
g_snprintf(cbuf, sizeof(cbuf), _("Cannot load %s"), loc->requested_uri);
|
||||
nautilus_window_set_status(window, cbuf);
|
||||
return;
|
||||
}
|
||||
|
@ -459,14 +480,14 @@ nautilus_window_change_location(NautilusWindow *window,
|
|||
else
|
||||
{
|
||||
char *append_val;
|
||||
if(window->uris_next && !strcmp(loc, window->uris_next->data))
|
||||
if(window->uris_next && !strcmp(loc->requested_uri, window->uris_next->data))
|
||||
{
|
||||
append_val = window->uris_next->data;
|
||||
window->uris_next = g_slist_remove(window->uris_next, window->uris_next->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
append_val = g_strdup(loc);
|
||||
append_val = g_strdup(loc->requested_uri);
|
||||
g_slist_foreach(window->uris_next, (GFunc)g_free, NULL);
|
||||
g_slist_free(window->uris_next); window->uris_next = NULL;
|
||||
}
|
||||
|
@ -514,18 +535,18 @@ nautilus_window_change_location(NautilusWindow *window,
|
|||
g_slist_free(discard_views);
|
||||
|
||||
g_free(window->current_content_type);
|
||||
window->current_content_type = g_strdup(loci->content_type);
|
||||
window->current_content_type = g_strdup(loci->navinfo.content_type);
|
||||
g_free(window->current_uri);
|
||||
window->current_uri = g_strdup(loci->requested_uri);
|
||||
window->current_uri = g_strdup(loci->navinfo.requested_uri);
|
||||
g_free(window->actual_current_uri);
|
||||
window->actual_current_uri = g_strdup(loci->actual_uri);
|
||||
window->actual_current_uri = g_strdup(loci->navinfo.actual_uri);
|
||||
|
||||
nautilus_navinfo_free(loci);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_window_real_request_location_change (NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view)
|
||||
{
|
||||
nautilus_window_change_location(window, loc, requesting_view, FALSE);
|
||||
|
@ -683,23 +704,26 @@ nautilus_window_load_state(NautilusWindow *window, const char *config_path)
|
|||
static void
|
||||
nautilus_window_back (NautilusWindow *window)
|
||||
{
|
||||
char *uri;
|
||||
Nautilus_NavigationRequestInfo nri;
|
||||
|
||||
g_assert(window->uris_prev);
|
||||
|
||||
uri = window->uris_prev->data;
|
||||
memset(&nri, 0, sizeof(nri));
|
||||
nri.requested_uri = window->uris_prev->data;
|
||||
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
|
||||
|
||||
nautilus_window_change_location(window, uri, NULL, TRUE);
|
||||
nautilus_window_change_location(window, &nri, NULL, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_window_fwd (NautilusWindow *window)
|
||||
{
|
||||
char *uri;
|
||||
Nautilus_NavigationRequestInfo nri;
|
||||
|
||||
g_assert(window->uris_next);
|
||||
|
||||
uri = window->uris_next->data;
|
||||
|
||||
nautilus_window_change_location(window, uri, NULL, FALSE);
|
||||
memset(&nri, 0, sizeof(nri));
|
||||
nri.requested_uri = window->uris_next->data;
|
||||
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_FALSE;
|
||||
nautilus_window_change_location(window, &nri, NULL, FALSE);
|
||||
}
|
||||
|
|
|
@ -19,9 +19,12 @@ typedef struct {
|
|||
GnomeAppClass *parent_class;
|
||||
|
||||
void (* request_location_change)(NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
guint window_signals[1];
|
||||
void (* request_selection_change)(NautilusWindow *window,
|
||||
Nautilus_SelectionRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
guint window_signals[2];
|
||||
} NautilusWindowClass;
|
||||
|
||||
struct _NautilusWindow {
|
||||
|
@ -42,8 +45,11 @@ struct _NautilusWindow {
|
|||
GtkType nautilus_window_get_type(void);
|
||||
GtkWidget *nautilus_window_new(const char *app_id);
|
||||
void nautilus_window_request_location_change(NautilusWindow *window,
|
||||
NautilusLocationReference loc,
|
||||
Nautilus_NavigationRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
void nautilus_window_request_selection_change(NautilusWindow *window,
|
||||
Nautilus_SelectionRequestInfo *loc,
|
||||
GtkWidget *requesting_view);
|
||||
void nautilus_window_save_state(NautilusWindow *window, const char *config_path);
|
||||
void nautilus_window_load_state(NautilusWindow *window, const char *config_path);
|
||||
void nautilus_window_set_initial_state(NautilusWindow *window);
|
||||
|
|
Loading…
Reference in a new issue