Added scrolled window
[irreco.git] / irreco / src / core / irreco_internal_widget.c
blob35cf3dec7a6f806d7583316e41ed333a79027009
1 /*
2 * irreco - Ir Remote Control
3 * Copyright (C) 2007,2008 Arto Karppinen (arto.karppinen@iki.fi)
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #include "irreco_internal_widget.h"
22 /**
23 * @addtogroup IrrecoInternalWidget
24 * @ingroup Irreco
26 * A widget class which has IrrecoData construction property.
28 * @{
31 /**
32 * @file
33 * Source file of @ref IrrecoInternalWidget.
38 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
39 /* Datatypes */
40 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
42 enum
44 PROP_0,
45 PROP_IRRECO_DATA
48 typedef struct _IrrecoInternalWidgetPrivate IrrecoInternalWidgetPrivate;
49 struct _IrrecoInternalWidgetPrivate {
50 IrrecoData *irreco_data;
53 #define _GET_PRIVATE(_self) \
54 G_TYPE_INSTANCE_GET_PRIVATE( \
55 IRRECO_INTERNAL_WIDGET(_self), \
56 IRRECO_TYPE_INTERNAL_WIDGET, \
57 IrrecoInternalWidgetPrivate);
61 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
62 /* Prototypes */
63 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
67 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
68 /* Construction & Destruction */
69 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
71 /**
72 * @name Construction & Destruction
73 * @{
76 G_DEFINE_TYPE(IrrecoInternalWidget, irreco_internal_widget, GTK_TYPE_VBOX)
78 static void
79 irreco_internal_widget_init (IrrecoInternalWidget *object)
81 /* TODO: Add initialization code here */
84 static void
85 irreco_internal_widget_finalize (GObject *object)
87 /* TODO: Add deinitalization code here */
89 G_OBJECT_CLASS (irreco_internal_widget_parent_class)->finalize (object);
92 static void
93 irreco_internal_widget_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
95 IrrecoInternalWidgetPrivate *priv = NULL;
96 g_return_if_fail (IRRECO_IS_INTERNAL_WIDGET (object));
98 switch (prop_id)
100 case PROP_IRRECO_DATA:
101 priv = _GET_PRIVATE(object);
102 priv->irreco_data = (IrrecoData*) g_value_get_pointer(value);
103 break;
104 default:
105 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
106 break;
110 static void
111 irreco_internal_widget_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
113 IrrecoInternalWidgetPrivate *priv = NULL;
114 g_return_if_fail (IRRECO_IS_INTERNAL_WIDGET (object));
116 switch (prop_id)
118 case PROP_IRRECO_DATA:
119 priv = _GET_PRIVATE(object);
120 g_value_set_pointer(value, priv->irreco_data);
121 break;
122 default:
123 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
124 break;
128 static void
129 irreco_internal_widget_class_init (IrrecoInternalWidgetClass *klass)
131 GObjectClass* object_class = G_OBJECT_CLASS (klass);
132 /*GtkHBoxClass* parent_class = GTK_HBOX_CLASS (klass);*/
134 object_class->finalize = irreco_internal_widget_finalize;
135 object_class->set_property = irreco_internal_widget_set_property;
136 object_class->get_property = irreco_internal_widget_get_property;
138 g_type_class_add_private(klass, sizeof (IrrecoInternalWidgetPrivate));
140 g_object_class_install_property(
141 object_class,
142 PROP_IRRECO_DATA,
143 g_param_spec_pointer(
144 "irreco-data",
145 "irreco-data",
146 "IrrecoData",
147 G_PARAM_READABLE |
148 G_PARAM_WRITABLE |
149 G_PARAM_CONSTRUCT_ONLY));
152 /** @} */
156 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
157 /* Public Functions */
158 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
161 * @name Public Functions
162 * @{
165 IrrecoData *irreco_internal_widget_get_irreco_data(IrrecoInternalWidget *self)
167 IrrecoInternalWidgetPrivate *priv = NULL;
168 IRRECO_ENTER
170 priv = _GET_PRIVATE(self);
171 IRRECO_RETURN_PTR(priv->irreco_data);
174 /** @} */
176 /** @} */