1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* Nautilus
*
* Copyright (C) 1999, 2000 Red Hat, Inc.
* Copyright (C) 1999, 2000 Eazel, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Author: Elliot Lee <sopwith@redhat.com>
*
*/
#include <config.h>
#include "nautilus.h"
#include "ntl-view-private.h"
typedef struct {
GnomeObject *container, *client_site, *view_frame;
} BonoboSubdocInfo;
static void
destroy_bonobo_subdoc_view(NautilusView *view, CORBA_Environment *ev)
{
BonoboSubdocInfo *bsi = view->component_data;
g_free(bsi);
}
static void
bonobo_subdoc_notify_location_change(NautilusView *view, Nautilus_NavigationInfo *real_nav_ctx, CORBA_Environment *ev)
{
GNOME_PersistFile persist;
persist = gnome_object_client_query_interface(view->client_object, "IDL:GNOME/PersistFile:1.0",
NULL);
if(!CORBA_Object_is_nil(persist, ev))
{
GNOME_PersistFile_load(persist, real_nav_ctx->actual_uri, ev);
GNOME_Unknown_unref(persist, ev);
CORBA_Object_release(persist, ev);
}
else if((persist = gnome_object_client_query_interface(view->client_object, "IDL:GNOME/PersistStream:1.0",
NULL))
&& !CORBA_Object_is_nil(persist, ev))
{
GnomeStream *stream;
stream = gnome_stream_fs_open(real_nav_ctx->actual_uri, GNOME_Storage_READ);
GNOME_PersistStream_load (persist,
(GNOME_Stream) gnome_object_corba_objref (GNOME_OBJECT (stream)),
ev);
GNOME_Unknown_unref(persist, ev);
CORBA_Object_release(persist, ev);
}
}
static gboolean
bonobo_subdoc_try_load_client(NautilusView *view, CORBA_Object obj, CORBA_Environment *ev)
{
BonoboSubdocInfo *bsi;
view->component_data = bsi = g_new0(BonoboSubdocInfo, 1);
bsi->container = GNOME_OBJECT(gnome_container_new());
gnome_object_add_interface(GNOME_OBJECT(bsi->container), view->view_frame);
bsi->client_site =
GNOME_OBJECT(gnome_client_site_new(GNOME_CONTAINER(bsi->container)));
gnome_client_site_bind_embeddable(GNOME_CLIENT_SITE(bsi->client_site), view->client_object);
gnome_container_add(GNOME_CONTAINER(bsi->container), bsi->client_site);
bsi->view_frame = GNOME_OBJECT(gnome_client_site_new_view(GNOME_CLIENT_SITE(bsi->client_site)));
gnome_control_frame_set_ui_handler(GNOME_CONTROL_FRAME(bsi->view_frame),
nautilus_window_get_uih(NAUTILUS_WINDOW(view->main_window)));
g_assert(bsi->view_frame);
view->client_widget = gnome_view_frame_get_wrapper(GNOME_VIEW_FRAME(bsi->view_frame));
return TRUE;
}
NautilusViewComponentType bonobo_subdoc_component_type = {
"IDL:GNOME/Embeddable:1.0",
&bonobo_subdoc_try_load_client, /* try_load */
&destroy_bonobo_subdoc_view, /* destroy */
NULL, /* show_properties */
NULL, /* save_state */
NULL, /* load_state */
&bonobo_subdoc_notify_location_change, /* notify_location_change */
NULL, /* notify_selection_change */
NULL, /* stop_location_change */
NULL, /* get_label */
};
|