settings dialog now should provide the same functionality as the old dialog, but...
[simple-launcher] / settings-dialog.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/gtknotebook.h>
19 #include <gtk/gtklabel.h>
20
21 #include "settings-dialog.h"
22
23 inline void addPage(GtkNotebook *notebook, const std::string& name, GtkWidget *widget) {
24   GtkWidget *label = gtk_label_new(name.c_str());
25
26   gtk_notebook_append_page(notebook, widget, label);
27 }
28
29 SettingsDialog::SettingsDialog(GtkWindow *parent, int size, LauncherItems& items) : myList(size, items) {
30   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));
31
32   GtkNotebook *notebook = GTK_NOTEBOOK(gtk_notebook_new());
33
34   gtk_container_add(GTK_CONTAINER(myDialog->vbox), GTK_WIDGET(notebook));
35
36   // addPage(notebook, "UI", ...);
37   addPage(notebook, "Items", myList.getWidget());
38
39   gtk_widget_set_size_request(GTK_WIDGET(myDialog), 540, 257);
40 }
41
42 SettingsDialog::~SettingsDialog() {
43   gtk_widget_destroy(GTK_WIDGET(myDialog));
44 }
45
46 gint SettingsDialog::run() {
47   return gtk_dialog_run(myDialog);
48 }