1
/* gb-shortcuts-group.c
3
* Copyright (C) 2015 Christian Hergert <christian@hergert.me>
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (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, see <http://www.gnu.org/licenses/>.
19
#include "gb-shortcuts-group.h"
21
struct _GbShortcutsGroup
23
GtkBox parent_instance;
28
G_DEFINE_TYPE (GbShortcutsGroup, gb_shortcuts_group, GTK_TYPE_BOX)
36
static GParamSpec *gParamSpecs [LAST_PROP];
39
gb_shortcuts_group_get_property (GObject *object,
44
GbShortcutsGroup *self = GB_SHORTCUTS_GROUP (object);
49
g_value_set_string (value, gtk_label_get_label (self->title));
53
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
58
gb_shortcuts_group_set_property (GObject *object,
63
GbShortcutsGroup *self = GB_SHORTCUTS_GROUP (object);
68
gtk_label_set_label (self->title, g_value_get_string (value));
72
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
77
gb_shortcuts_group_class_init (GbShortcutsGroupClass *klass)
79
GObjectClass *object_class = G_OBJECT_CLASS (klass);
81
object_class->get_property = gb_shortcuts_group_get_property;
82
object_class->set_property = gb_shortcuts_group_set_property;
84
gParamSpecs [PROP_TITLE] =
85
g_param_spec_string ("title",
89
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
91
g_object_class_install_properties (object_class, LAST_PROP, gParamSpecs);
95
gb_shortcuts_group_init (GbShortcutsGroup *self)
99
gtk_orientable_set_orientation (GTK_ORIENTABLE (self), GTK_ORIENTATION_VERTICAL);
100
gtk_box_set_spacing (GTK_BOX (self), 10);
102
attrs = pango_attr_list_new ();
103
pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
104
self->title = g_object_new (GTK_TYPE_LABEL,
109
gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (self->title));
110
pango_attr_list_unref (attrs);