From: mishas Date: Thu, 12 Apr 2007 15:07:28 +0000 (+0000) Subject: started a hackish implementation of settings dialog for real values X-Git-Url: https://vcs.maemo.org/git/?p=simple-launcher;a=commitdiff_plain;h=bbcdba5541d589f6dc02e31f7759a059cd812542 started a hackish implementation of settings dialog for real values git-svn-id: file:///svnroot/simple-launcher/trunk@178 3ba93dab-e023-0410-b42a-de7732cf370a --- diff --git a/settings-dialog.cc b/settings-dialog.cc index 58b4acb..c691019 100644 --- a/settings-dialog.cc +++ b/settings-dialog.cc @@ -60,7 +60,9 @@ inline GtkWidget *createUIPage() { return vbox; } -SettingsDialog::SettingsDialog(GtkWindow *parent, LauncherItems& items) : myList(SL_APPLET_SETTINGS_ICON_SIZE, items) { +SettingsDialog::SettingsDialog(GtkWindow *parent, LauncherItems& items, GConfBooleanOption& transparent, GConfIntegerOption& icon_size, GConfIntegerOption& canvas_size): + myList(SL_APPLET_SETTINGS_ICON_SIZE, items), + myTransparent(transparent, "Transparent background:"), myIconSize(icon_size, "Icon Size:"), myCanvasSize(canvas_size, "Canvas Size:") { 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)); GtkNotebook *notebook = GTK_NOTEBOOK(gtk_notebook_new()); @@ -86,4 +88,10 @@ gint SettingsDialog::run() { return gtk_dialog_run(myDialog); } +void SettingsDialog::updateValues() { + myTransparent.updateValue(); + myIconSize.updateValue(); + myCanvasSize.updateValue(); +} + // vim:ts=2:sw=2:et diff --git a/settings-dialog.h b/settings-dialog.h index 268c1f0..a3b452c 100644 --- a/settings-dialog.h +++ b/settings-dialog.h @@ -20,20 +20,28 @@ #include +#include "gconf-wrapper.h" #include "sla-list.h" #include "launcher-item.h" +#include "dialog-entry.h" class SettingsDialog { public: - SettingsDialog(GtkWindow *parent, LauncherItems& items); + SettingsDialog(GtkWindow *parent, LauncherItems& items, GConfBooleanOption& transparent, GConfIntegerOption& icon_size, GConfIntegerOption& canvas_size); ~SettingsDialog(); gint run(); + void updateValues(); + private: SLAList myList; GtkDialog *myDialog; + + SettingsDialogBooleanEntry myTransparent; + SettingsDialogIntegerEntry myIconSize; + SettingsDialogIntegerEntry myCanvasSize; }; #endif diff --git a/simple-launcher.cc b/simple-launcher.cc index e74e1ab..5fe3aae 100644 --- a/simple-launcher.cc +++ b/simple-launcher.cc @@ -354,11 +354,14 @@ void SimpleLauncherApplet::runDialog() { LauncherItems newItems = myItems; - SettingsDialog dialog(myParent, newItems); + // TODO: make it nicer... this code is ugly :( + SettingsDialog dialog(myParent, newItems, myTransparent, myIconSize, myCanvasSize); switch (dialog.run()) { case GTK_RESPONSE_OK: myItems = newItems; + dialog.updateValues(); // FIXME: hackish :( make it better + saveConfig(); // save it immediately! updateWidget(); break;