started a hackish implementation of settings dialog for real values
authormishas <mikhail.sobolev@gmail.com>
Thu, 12 Apr 2007 15:07:28 +0000 (15:07 +0000)
committermishas <mikhail.sobolev@gmail.com>
Thu, 12 Apr 2007 15:07:28 +0000 (15:07 +0000)
git-svn-id: file:///svnroot/simple-launcher/trunk@178 3ba93dab-e023-0410-b42a-de7732cf370a

settings-dialog.cc
settings-dialog.h
simple-launcher.cc

index 58b4acb..c691019 100644 (file)
@@ -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
index 268c1f0..a3b452c 100644 (file)
 
 #include <gtk/gtkdialog.h>
 
+#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
index e74e1ab..5fe3aae 100644 (file)
@@ -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;