mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-11-05 16:04:31 +00:00
53c5e06a43
* libnautilus/ntl-view-frame.c, libnautilus/ntl-view-frame.h: Changed NautilusViewFrame to allow creation of `Nautilus::View' objects that have additional interfaces while sharing the actual control. This will allow, for instance, the creation of components that are both a `Nautilus::View' and a `Bonobo::Embeddable'. The basic changes are to require a `BonoboObject' with a `Bonobo::Control' interface at construction time. - Two creation functions are provided: `nautilus_view_frame_new', which takes a GtkWidget, creates a new control that contains that widget, and the constructs a NautilusViewFrame with that control, and `nautilus_view_frame_new_from_control', which creates a NautilusViewFrame that gets added as an additional interface to an existing control. - In the course of doing this it became clear that it would be easier if NautilusViewFrame were changed to inherit from BonoboObject rather than GtkBin, so this was done; as a result, the nautilus_view_frame_get_bonobo_object call was removed, since the view_frame _is_ a bonobo object. However, a nautilus_view_frame_get_bonobo_control call was added as a convenience, to allow other code to avoid having to query_local_interface for the control object manually. * libnautilus/ntl-meta-view-frame.c, libnautilus/ntl-meta-view-frame.h, libnautilus/ntl-content-view-frame.c, libnautilus/ntl-content-view-frame.h: Analogous changes; mainly, added `nautilus_meta_view_frame_new', `nautilus_meta_view_frame_new_from_control', `nautilus_content_view_frame_new' and `nautilus_content_view_frame_new_from_control'. * components/help/hyperbola-nav-index.c, components/help/hyperbola-nav-tree.c, components/history/ntl-history-view.c, components/html/ntl-web-browser.c, components/notes/ntl-notes.c, components/websearch/ntl-web-search.c, src/ntl-app.c, src/file-manager/fm-directory-view.c: Fixed initialization and object creation functions to deal with the above API change.
156 lines
4.4 KiB
C
156 lines
4.4 KiB
C
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */
|
|
|
|
/*
|
|
* libnautilus: A library for nautilus view implementations.
|
|
*
|
|
* Copyright (C) 1999, 2000 Red Hat, Inc.
|
|
* Copyright (C) 2000 Eazel, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
*
|
|
* Author: Elliot Lee <sopwith@redhat.com>
|
|
*
|
|
*/
|
|
|
|
/* ntl-meta-view-frame.c: Implementation for object that represents a
|
|
nautilus meta view implementation. */
|
|
|
|
#include <config.h>
|
|
#include "ntl-meta-view-frame.h"
|
|
|
|
#include <libgnome/gnome-i18n.h>
|
|
#include <bonobo/bonobo-control.h>
|
|
#include <bonobo/bonobo-property-bag.h>
|
|
|
|
typedef struct {
|
|
POA_Nautilus_View servant;
|
|
gpointer bonobo_object;
|
|
|
|
NautilusMetaViewFrame *view;
|
|
} impl_POA_Nautilus_MetaView;
|
|
|
|
extern POA_Nautilus_View__epv libnautilus_Nautilus_View_epv;
|
|
|
|
static POA_Nautilus_MetaView__epv impl_Nautilus_MetaView_epv = {
|
|
NULL /* _private */
|
|
};
|
|
|
|
static PortableServer_ServantBase__epv base_epv = { NULL, NULL, NULL };
|
|
|
|
static POA_Nautilus_MetaView__vepv impl_Nautilus_MetaView_vepv =
|
|
{
|
|
&base_epv,
|
|
NULL,
|
|
&libnautilus_Nautilus_View_epv,
|
|
&impl_Nautilus_MetaView_epv
|
|
};
|
|
|
|
static void nautilus_meta_view_frame_init (NautilusMetaViewFrame *view);
|
|
static void nautilus_meta_view_frame_destroy (NautilusMetaViewFrame *view);
|
|
static void nautilus_meta_view_frame_class_init (NautilusMetaViewFrameClass *klass);
|
|
|
|
GtkType
|
|
nautilus_meta_view_frame_get_type (void)
|
|
{
|
|
static GtkType view_frame_type = 0;
|
|
|
|
if (!view_frame_type)
|
|
{
|
|
const GtkTypeInfo view_frame_info =
|
|
{
|
|
"NautilusMetaViewFrame",
|
|
sizeof (NautilusMetaViewFrame),
|
|
sizeof (NautilusMetaViewFrameClass),
|
|
(GtkClassInitFunc) nautilus_meta_view_frame_class_init,
|
|
(GtkObjectInitFunc) nautilus_meta_view_frame_init,
|
|
/* reserved_1 */ NULL,
|
|
/* reserved_2 */ NULL,
|
|
(GtkClassInitFunc) NULL,
|
|
};
|
|
|
|
view_frame_type = gtk_type_unique (nautilus_view_frame_get_type(), &view_frame_info);
|
|
}
|
|
|
|
return view_frame_type;
|
|
}
|
|
|
|
static void
|
|
nautilus_meta_view_frame_init (NautilusMetaViewFrame *view)
|
|
{
|
|
}
|
|
|
|
NautilusMetaViewFrame *
|
|
nautilus_meta_view_frame_new (GtkWidget *widget)
|
|
{
|
|
BonoboObject *control;
|
|
|
|
control = BONOBO_OBJECT (bonobo_control_new (widget));
|
|
|
|
return nautilus_meta_view_frame_new_from_bonobo_control (control);
|
|
}
|
|
|
|
NautilusMetaViewFrame *
|
|
nautilus_meta_view_frame_new_from_bonobo_control (BonoboObject *bonobo_control)
|
|
{
|
|
NautilusMetaViewFrame *view;
|
|
|
|
view = NAUTILUS_META_VIEW_FRAME (gtk_object_new (NAUTILUS_TYPE_META_VIEW_FRAME,
|
|
"bonobo_control", bonobo_control,
|
|
NULL));
|
|
|
|
return view;
|
|
}
|
|
|
|
static void
|
|
nautilus_meta_view_frame_destroy (NautilusMetaViewFrame *view)
|
|
{
|
|
NautilusViewFrameClass *klass = NAUTILUS_VIEW_FRAME_CLASS(GTK_OBJECT(view)->klass);
|
|
|
|
if(((GtkObjectClass *)klass->parent_class)->destroy)
|
|
((GtkObjectClass *)klass->parent_class)->destroy((GtkObject *)view);
|
|
}
|
|
|
|
static void
|
|
nautilus_meta_view_frame_class_init (NautilusMetaViewFrameClass *klass)
|
|
{
|
|
NautilusViewFrameClass *view_class = ((NautilusViewFrameClass *)klass);
|
|
|
|
GTK_OBJECT_CLASS(klass)->destroy = (void (*)(GtkObject *))nautilus_meta_view_frame_destroy;
|
|
|
|
view_class->servant_init_func = POA_Nautilus_MetaView__init;
|
|
view_class->servant_destroy_func = POA_Nautilus_MetaView__fini;
|
|
view_class->vepv = &impl_Nautilus_MetaView_vepv;
|
|
}
|
|
|
|
void
|
|
nautilus_meta_view_frame_set_label(NautilusMetaViewFrame *mvc, const char *label)
|
|
{
|
|
BonoboObject *ctl;
|
|
BonoboPropertyBag *bag;
|
|
|
|
ctl = nautilus_view_frame_get_bonobo_control (NAUTILUS_VIEW_FRAME (mvc));
|
|
|
|
bag = bonobo_control_get_property_bag (BONOBO_CONTROL (ctl));
|
|
|
|
if (!bag)
|
|
{
|
|
bag = bonobo_property_bag_new ();
|
|
bonobo_control_set_property_bag (BONOBO_CONTROL (ctl), bag);
|
|
}
|
|
|
|
bonobo_property_bag_add (bag, "label", "string",
|
|
g_strdup (label), g_strdup (label),
|
|
_("Label"), BONOBO_PROPERTY_READ_ONLY);
|
|
}
|