1 // This file is a part of Simple Launcher
3 // Copyright (C) 2006, 2007, Mikhail Sobolev
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.
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
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
18 #include <gtk/gtkvbox.h>
19 #include <gtk/gtkhbox.h>
20 #include <gtk/gtksizegroup.h>
21 #include <gtk/gtknotebook.h>
22 #include <gtk/gtklabel.h>
24 #include "settings-dialog.h"
28 inline void addPage(GtkNotebook *notebook, const std::string& name, GtkWidget *widget) {
29 GtkWidget *label = gtk_label_new(name.c_str());
31 gtk_notebook_append_page(notebook, widget, label);
34 inline GtkWidget *packItTogether(GtkSizeGroup *group, const std::string& name, GtkWidget *content) {
35 GtkWidget *box = gtk_hbox_new(false, 0);
36 GtkWidget *label = gtk_label_new(name.c_str());
38 gtk_size_group_add_widget(group, label);
39 gtk_box_pack_start(GTK_BOX(box), label, true, true, 0);
40 gtk_box_pack_start(GTK_BOX(box), content, true, true, 0);
45 inline GtkWidget *createUIPage() {
46 GtkSizeGroup *group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
47 GtkWidget *vbox = gtk_vbox_new(true, 0);
49 // packItTogether(group, "Button Size:", <small/big>);
50 // packItTogether(group, "Button Size:", [ ]);
51 // packItTogether(group, "Button Size:", [ ]);
53 g_object_unref(G_OBJECT(group));
58 SettingsDialog::SettingsDialog(GtkWindow *parent, int size, LauncherItems& items) : myList(size, items) {
59 myDialog = GTK_DIALOG(gtk_dialog_new_with_buttons("Launcher Settings", parent, (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT), "OK", GTK_RESPONSE_OK, "Cancel", GTK_RESPONSE_CANCEL, NULL));
61 GtkNotebook *notebook = GTK_NOTEBOOK(gtk_notebook_new());
63 gtk_container_add(GTK_CONTAINER(myDialog->vbox), GTK_WIDGET(notebook));
65 // addPage(notebook, "UI", createUIPage());
66 addPage(notebook, "Items", myList.getWidget());
68 gtk_widget_set_size_request(GTK_WIDGET(myDialog), 540, 257);
71 SettingsDialog::~SettingsDialog() {
72 gtk_widget_destroy(GTK_WIDGET(myDialog));
75 gint SettingsDialog::run() {
76 gtk_widget_show_all(GTK_WIDGET(myDialog));
78 return gtk_dialog_run(myDialog);