From 97dbe258cc4ac79b5d8d829a2e5549729f8a9ecb Mon Sep 17 00:00:00 2001 From: mishas Date: Thu, 10 May 2007 15:01:24 +0000 Subject: [PATCH] * implemented a different widget for selecting icon size (use combobox instead of number entry field) * 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 | 5 +++-- dialog-entry.cc | 32 ++++++++++++++++++++++++++++---- dialog-entry.h | 18 +++++++++++++----- settings-dialog.cc | 2 +- settings-dialog.h | 2 +- 5 files changed, 46 insertions(+), 13 deletions(-) diff --git a/debian/changelog b/debian/changelog index 619854a..ebea056 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Tue, 17 Apr 2007 10:50:52 +0300 + -- Mikhail Sobolev Thu, 10 May 2007 17:53:50 +0300 simple-launcher (0.9.3) unstable; urgency=low diff --git a/dialog-entry.cc b/dialog-entry.cc index 6f7a6a2..2d8ea5d 100644 --- a/dialog-entry.cc +++ b/dialog-entry.cc @@ -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); + } +} + /// diff --git a/dialog-entry.h b/dialog-entry.h index 5f13bd9..ad99ecb 100644 --- a/dialog-entry.h +++ b/dialog-entry.h @@ -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 diff --git a/settings-dialog.cc b/settings-dialog.cc index a7c1559..9589413 100644 --- a/settings-dialog.cc +++ b/settings-dialog.cc @@ -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()); diff --git a/settings-dialog.h b/settings-dialog.h index ba6b245..9117820 100644 --- a/settings-dialog.h +++ b/settings-dialog.h @@ -45,7 +45,7 @@ private: GtkNotebook *myNotebook; SettingsDialogBooleanEntry myTransparent; - SettingsDialogIntegerEntry myIconSize; + SettingsDialogIconSizeEntry myIconSize; }; #endif -- 1.7.9.5