X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=dialog-entry.cc;h=7c089612d19597fbad8baa71c04f1206d8910312;hb=f104a51446caaec3a7a567e5e534ee32172f9bb8;hp=eadc87830362e304b0a4b47100efd9b757fad3f5;hpb=f0543a055fbcea269eeba19b459b4d9614b907b5;p=simple-launcher diff --git a/dialog-entry.cc b/dialog-entry.cc index eadc878..7c08961 100644 --- a/dialog-entry.cc +++ b/dialog-entry.cc @@ -15,6 +15,74 @@ // this program; if not, write to the Free Software Foundation, Inc., 51 // Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#include +#include + #include "dialog-entry.h" +SettingsDialogBooleanEntry::SettingsDialogBooleanEntry(GConfBooleanOption& option, const std::string& name): SettingsDialogEntry(option, name) { + myWidget = gtk_check_button_new(); + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(myWidget), option.value()); +} + +void SettingsDialogBooleanEntry::updateValue() { + ((GConfBooleanOption&)myOption).setValue(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(myWidget))); +} + +SettingsDialogIntegerEntry::SettingsDialogIntegerEntry(GConfIntegerOption& option, const std::string& name, int minValue, int maxValue): SettingsDialogEntry(option, name) { + mySpinBox = HILDON_NUMBER_EDITOR(hildon_number_editor_new(minValue, maxValue)); + hildon_number_editor_set_value(mySpinBox, option.value()); +} + +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 + +/// + +static struct { + int value; + const char *name; +} IconSizes[] = { + { 26, "Extra Small (26)" }, + { 32, "Small (32)" }, + { 48, "Medium (48)" }, + { 54, "Large (54)" }, + { 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; + } + } + + if (active != -1) { + gtk_combo_box_set_active(GTK_COMBO_BOX(myWidget), active); + } +} + +void SettingsDialogIconSizeEntry::updateValue() { + gint index = gtk_combo_box_get_active(GTK_COMBO_BOX(myWidget)); + + if (index != -1) { + ((GConfIntegerOption&)myOption).setValue(IconSizes[index].value); + } +} +///