summaryrefslogtreecommitdiff
path: root/libnautilus/nautilus-meta-view-frame.c
blob: 05d498092ed18f8b9f1bf4ac6e03660c3f5becbb (plain)
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/* -*- 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>
#include <libnautilus/nautilus-gtk-macros.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_initialize       (NautilusMetaViewFrame      *view);
static void nautilus_meta_view_frame_destroy          (NautilusMetaViewFrame      *view);
static void nautilus_meta_view_frame_initialize_class (NautilusMetaViewFrameClass *klass);

NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusMetaViewFrame, nautilus_meta_view_frame, NAUTILUS_TYPE_VIEW_FRAME)


static void
nautilus_meta_view_frame_initialize       (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)
{  
  NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, GTK_OBJECT (view));
}

static void
nautilus_meta_view_frame_initialize_class (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);
}