3 * Copyright (C) 2003-2009 Jim Evins <evins@snaught.com>.
5 * This file is part of gLabels.
7 * gLabels is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * gLabels 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
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with gLabels. If not, see <http://www.gnu.org/licenses/>.
23 #include "ui-sidebar.h"
25 #include <glib/gi18n.h>
28 #include "object-editor.h"
33 /*===========================================================================*/
34 /* Private macros and constants. */
35 /*===========================================================================*/
37 #define DEFAULT_SIDEBAR_WIDTH 340
40 /*===========================================================================*/
41 /* Private data types */
42 /*===========================================================================*/
44 struct _glUISidebarPrivate {
49 /*===========================================================================*/
51 /*===========================================================================*/
54 /*===========================================================================*/
55 /* Local function prototypes */
56 /*===========================================================================*/
58 static void gl_ui_sidebar_finalize (GObject *object);
60 static void gl_ui_sidebar_construct (glUISidebar *sidebar);
63 /****************************************************************************/
64 /* Boilerplate Object stuff. */
65 /****************************************************************************/
66 G_DEFINE_TYPE (glUISidebar, gl_ui_sidebar, GTK_TYPE_VBOX)
70 gl_ui_sidebar_class_init (glUISidebarClass *class)
72 GObjectClass *object_class = G_OBJECT_CLASS (class);
74 gl_debug (DEBUG_UI, "START");
76 gl_ui_sidebar_parent_class = g_type_class_peek_parent (class);
78 object_class->finalize = gl_ui_sidebar_finalize;
80 gl_debug (DEBUG_UI, "END");
85 gl_ui_sidebar_init (glUISidebar *sidebar)
87 gl_debug (DEBUG_UI, "START");
89 sidebar->priv = g_new0 (glUISidebarPrivate, 1);
91 gl_debug (DEBUG_UI, "END");
96 gl_ui_sidebar_finalize (GObject *object)
98 glUISidebar *sidebar = GL_UI_SIDEBAR (object);
100 gl_debug (DEBUG_UI, "START");
102 g_return_if_fail (object != NULL);
103 g_return_if_fail (GL_IS_UI_SIDEBAR (object));
105 g_free (sidebar->priv);
107 G_OBJECT_CLASS (gl_ui_sidebar_parent_class)->finalize (object);
109 gl_debug (DEBUG_UI, "END");
113 /****************************************************************************/
114 /* Create a NEW sidebar. */
115 /****************************************************************************/
117 gl_ui_sidebar_new (void)
119 glUISidebar *sidebar;
121 gl_debug (DEBUG_UI, "START");
123 sidebar = g_object_new (gl_ui_sidebar_get_type (), NULL);
125 gl_ui_sidebar_construct (sidebar);
127 gl_debug (DEBUG_UI, "END");
129 return GTK_WIDGET(sidebar);
133 /******************************************************************************/
134 /* Initialize property toolbar. */
135 /******************************************************************************/
137 gl_ui_sidebar_construct (glUISidebar *sidebar)
139 gl_debug (DEBUG_UI, "START");
141 sidebar->priv->editor = gl_object_editor_new ();
142 gtk_widget_show (sidebar->priv->editor);
144 gtk_box_pack_start (GTK_BOX (sidebar), sidebar->priv->editor, FALSE, FALSE, 0);
145 gtk_widget_set_vexpand (GTK_WIDGET (sidebar->priv->editor), FALSE);
146 gtk_widget_set_hexpand (GTK_WIDGET (sidebar->priv->editor), FALSE);
148 gl_debug (DEBUG_UI, "END");
152 /****************************************************************************/
153 /* Set label associated with sidebar. */
154 /****************************************************************************/
156 gl_ui_sidebar_set_label (glUISidebar *sidebar,
159 gl_debug (DEBUG_UI, "START");
161 g_return_if_fail (label && GL_IS_LABEL (label));
163 gl_object_editor_set_label (GL_OBJECT_EDITOR (sidebar->priv->editor), label);
165 gl_debug (DEBUG_UI, "END");
171 * Local Variables: -- emacs
173 * c-basic-offset: 8 -- emacs
174 * tab-width: 8 -- emacs
175 * indent-tabs-mode: nil -- emacs