2 * nautilus-property-page.h - Property pages exported by
3 * NautilusPropertyProvider objects.
5 * Copyright (C) 2003 Novell, Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * Author: Dave Camp <dave@ximian.com>
26 #include "nautilus-property-page.h"
28 #include "nautilus-extension-i18n.h"
38 struct _NautilusPropertyPageDetails
{
44 static GObjectClass
*parent_class
= NULL
;
46 NautilusPropertyPage
*
47 nautilus_property_page_new (const char *name
,
49 GtkWidget
*page_widget
)
51 NautilusPropertyPage
*page
;
53 g_return_val_if_fail (name
!= NULL
, NULL
);
54 g_return_val_if_fail (label
!= NULL
&& GTK_IS_WIDGET (label
), NULL
);
55 g_return_val_if_fail (page_widget
!= NULL
&& GTK_IS_WIDGET (page_widget
),
58 page
= g_object_new (NAUTILUS_TYPE_PROPERTY_PAGE
,
68 nautilus_property_page_get_property (GObject
*object
,
73 NautilusPropertyPage
*page
;
75 page
= NAUTILUS_PROPERTY_PAGE (object
);
79 g_value_set_string (value
, page
->details
->name
);
82 g_value_set_object (value
, page
->details
->label
);
85 g_value_set_object (value
, page
->details
->page
);
88 G_OBJECT_WARN_INVALID_PROPERTY_ID (object
, param_id
, pspec
);
94 nautilus_property_page_set_property (GObject
*object
,
99 NautilusPropertyPage
*page
;
101 page
= NAUTILUS_PROPERTY_PAGE (object
);
105 g_free (page
->details
->name
);
106 page
->details
->name
= g_strdup (g_value_get_string (value
));
107 g_object_notify (object
, "name");
110 if (page
->details
->label
) {
111 g_object_unref (page
->details
->label
);
114 page
->details
->label
= g_object_ref (g_value_get_object (value
));
115 g_object_notify (object
, "label");
118 if (page
->details
->page
) {
119 g_object_unref (page
->details
->page
);
122 page
->details
->page
= g_object_ref (g_value_get_object (value
));
123 g_object_notify (object
, "page");
126 G_OBJECT_WARN_INVALID_PROPERTY_ID (object
, param_id
, pspec
);
132 nautilus_property_page_dispose (GObject
*object
)
134 NautilusPropertyPage
*page
;
136 page
= NAUTILUS_PROPERTY_PAGE (object
);
138 if (page
->details
->label
) {
139 g_object_unref (page
->details
->label
);
140 page
->details
->label
= NULL
;
142 if (page
->details
->page
) {
143 g_object_unref (page
->details
->page
);
144 page
->details
->page
= NULL
;
149 nautilus_property_page_finalize (GObject
*object
)
151 NautilusPropertyPage
*page
;
153 page
= NAUTILUS_PROPERTY_PAGE (object
);
155 g_free (page
->details
->name
);
157 g_free (page
->details
);
159 G_OBJECT_CLASS (parent_class
)->finalize (object
);
163 nautilus_property_page_instance_init (NautilusPropertyPage
*page
)
165 page
->details
= g_new0 (NautilusPropertyPageDetails
, 1);
169 nautilus_property_page_class_init (NautilusPropertyPageClass
*class)
171 parent_class
= g_type_class_peek_parent (class);
173 G_OBJECT_CLASS (class)->finalize
= nautilus_property_page_finalize
;
174 G_OBJECT_CLASS (class)->dispose
= nautilus_property_page_dispose
;
175 G_OBJECT_CLASS (class)->get_property
= nautilus_property_page_get_property
;
176 G_OBJECT_CLASS (class)->set_property
= nautilus_property_page_set_property
;
178 g_object_class_install_property (G_OBJECT_CLASS (class),
180 g_param_spec_string ("name",
184 G_PARAM_CONSTRUCT_ONLY
| G_PARAM_WRITABLE
| G_PARAM_READABLE
));
185 g_object_class_install_property (G_OBJECT_CLASS (class),
187 g_param_spec_object ("label",
189 "Label widget to display in the notebook tab",
192 g_object_class_install_property (G_OBJECT_CLASS (class),
194 g_param_spec_object ("page",
196 "Widget for the property page",
202 nautilus_property_page_get_type (void)
204 static GType type
= 0;
207 const GTypeInfo info
= {
208 sizeof (NautilusPropertyPageClass
),
211 (GClassInitFunc
)nautilus_property_page_class_init
,
214 sizeof (NautilusPropertyPage
),
216 (GInstanceInitFunc
)nautilus_property_page_instance_init
219 type
= g_type_register_static
221 "NautilusPropertPage",