finalized implementation of createItem for ApplicationItemFactory
[simple-launcher] / settings-page-entries.cc
1 // This file is a part of Simple Launcher
2 //
3 // Copyright (C) 2006, 2007, Mikhail Sobolev
4 //
5 // Simple Launcher is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License version 2 as published by
7 // the Free Software Foundation.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT
10 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12 // more details.
13 //
14 // You should have received a copy of the GNU General Public License along with
15 // this program; if not, write to the Free Software Foundation, Inc., 51
16 // Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
18 #include <gtk/gtkvbox.h>
19 #include <gtk/gtkhbox.h>
20 #include <gtk/gtklabel.h>
21
22 #include "settings-page-entries.h"
23
24 SettingsPageWithEntries::SettingsPageWithEntries() {
25   myBox = gtk_vbox_new(false, 0);
26   myGroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
27 }
28
29 SettingsPageWithEntries::~SettingsPageWithEntries() {
30   if (myGroup != NULL) {
31     g_object_unref(G_OBJECT(myGroup));
32     myGroup = NULL;
33   }
34 }
35
36 void SettingsPageWithEntries::addEntry(SettingsDialogEntry *entry) {
37   GtkWidget *box = gtk_hbox_new(false, 0);
38   GtkWidget *label = gtk_label_new(entry->name().c_str());
39
40   gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT);
41
42   gtk_size_group_add_widget(myGroup, label);
43   gtk_box_pack_start(GTK_BOX(box), label, false, false, 0);
44   gtk_box_pack_start(GTK_BOX(box), entry->getWidget(), false, false, 2);
45
46   gtk_box_pack_start(GTK_BOX(myBox), box, false, false, 0);
47 }