* implemented a different widget for selecting icon size (use combobox instead of...
authormishas <mikhail.sobolev@gmail.com>
Thu, 10 May 2007 15:01:24 +0000 (15:01 +0000)
committermishas <mikhail.sobolev@gmail.com>
Thu, 10 May 2007 15:01:24 +0000 (15:01 +0000)
* implementation is somewhat hackish: probably it will need some review later
 * started to use the new widget
 * renamed the icon size, now they are "Small, Medium, Large, Extra Large"

git-svn-id: file:///svnroot/simple-launcher/trunk@201 3ba93dab-e023-0410-b42a-de7732cf370a

debian/changelog
dialog-entry.cc
dialog-entry.h
settings-dialog.cc
settings-dialog.h

index 619854a..ebea056 100644 (file)
@@ -1,4 +1,4 @@
-simple-launcher (0.9.4~16) unstable; urgency=low
+simple-launcher (0.9.4~17) unstable; urgency=low
 
   * NOT RELEASED YET
   * settings dialog is moved into a separate class
@@ -25,8 +25,9 @@ simple-launcher (0.9.4~16) unstable; urgency=low
         * do not destroy applet's widget
    * delete array when it was allocated as array
   * make a private copy of icons obtained through GtkIconTheme
+  * implemented a different widget for icon size selection
 
- -- Mikhail Sobolev <mss@mawhrin.net>  Tue, 17 Apr 2007 10:50:52 +0300
+ -- Mikhail Sobolev <mss@mawhrin.net>  Thu, 10 May 2007 17:53:50 +0300
 
 simple-launcher (0.9.3) unstable; urgency=low
 
index 6f7a6a2..2d8ea5d 100644 (file)
@@ -39,9 +39,11 @@ void SettingsDialogIntegerEntry::updateValue() {
        ((GConfIntegerOption&)myOption).setValue(hildon_number_editor_get_value(mySpinBox));
 }
 
+#if 0
 SettingsDialogChoiceEntry::SettingsDialogChoiceEntry(GConfIntegerOption& option, const std::string& name): SettingsDialogEntry(option, name) {
        myWidget = gtk_combo_box_new_text();
 }
+#endif
 
 ///
 
@@ -49,11 +51,33 @@ static struct {
        int value;
        const char *name;
 } IconSizes[] = {
-       { 26, "Extra Small (26)" },
-       { 32, "Small (32)" },
-       { 48, "Medium (48)" },
-       { 64, "Large (64)" },
+       { 26, "Small (26)" },
+       { 32, "Medium (32)" },
+       { 48, "Large (48)" },
+       { 64, "Extra Large (64)" },
        { -1, NULL }
 };
 
+SettingsDialogIconSizeEntry::SettingsDialogIconSizeEntry(GConfIntegerOption& option, const std::string& name): SettingsDialogEntry(option, name) {
+       myWidget = gtk_combo_box_new_text();
+
+       int active = -1;
+
+       for (int i = 0; IconSizes[i].value != -1; ++i) {
+               gtk_combo_box_append_text(GTK_COMBO_BOX(myWidget), IconSizes[i].name);
+
+               if (IconSizes[i].value == option.value()) {
+                       active = i;
+               }
+       }
+}
+
+void SettingsDialogIconSizeEntry::updateValue() {
+       gint index = gtk_combo_box_get_active(GTK_COMBO_BOX(myWidget));
+
+       if (index != -1) {
+               ((GConfIntegerOption&)myOption).setValue(IconSizes[index].value);
+       }
+}
+
 ///
index 5f13bd9..ad99ecb 100644 (file)
@@ -71,6 +71,7 @@ private:
   HildonNumberEditor *mySpinBox;
 };
 
+#if 0
 class SettingsDialogChoiceEntry : public SettingsDialogEntry {
 public:
   SettingsDialogChoiceEntry(GConfIntegerOption& option, const std::string& name);
@@ -86,12 +87,19 @@ private:
   GtkWidget *myWidget;
 };
 
-class SettingsDialogIconSizeEntry : public SettingsDialogChoiceEntry {
-  SettingsDialogIconSizeEntry(GConfIntegerOption& option, const std::string& name): SettingsDialogChoiceEntry(option, name) {}
+class SettingsDialogIconSizeEntry : public SettingsDialogChoiceEntry
+#endif
+
+class SettingsDialogIconSizeEntry : public SettingsDialogEntry {
+public:
+  SettingsDialogIconSizeEntry(GConfIntegerOption& option, const std::string& name);
+
+  void updateValue();
 
-  const std::string& text(int index) const;
-  int numberOfChoices() const;
-  int initialValue() const;
+  GtkWidget *getWidget() const { return myWidget; }
+
+private:
+  GtkWidget *myWidget;
 };
 
 #endif
index a7c1559..9589413 100644 (file)
@@ -26,7 +26,7 @@
 
 SettingsDialog::SettingsDialog(GtkWindow *parent, LauncherItems& items, GConfBooleanOption& transparent, GConfIntegerOption& icon_size):
   myTransparent(transparent, "Transparent background:"),
-  myIconSize(icon_size, "Icon Size:", 26, 64) {
+  myIconSize(icon_size, "Icon 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));
 
   myNotebook = GTK_NOTEBOOK(gtk_notebook_new());
index ba6b245..9117820 100644 (file)
@@ -45,7 +45,7 @@ private:
   GtkNotebook *myNotebook;
 
   SettingsDialogBooleanEntry myTransparent;
-  SettingsDialogIntegerEntry myIconSize;
+  SettingsDialogIconSizeEntry myIconSize;
 };
 
 #endif