2 #include <hildon/hildon.h>
3 #include <hildon-cp-plugin/hildon-cp-plugin-interface.h>
5 /* TODO: read these from disk */
7 static const struct voice {
13 { "en-us", "English (American)" },
14 { "en-sc", "English (Scottish)" },
15 { "af", "Afrikaans" },
21 { "eo", "Esperanto" },
23 { "es-la", "Spanish (Latin America)" },
27 { "hu", "Hungarian" },
32 { "pt", "Portuguese (Brazil)" },
33 { "pt-pt", "Portuguese (European)" },
41 { "zh", "Mandarin Chinese" },
43 static const int num_voices = sizeof(voices) / sizeof(voices[0]);
45 static const struct effect {
64 { "klatt2", "Klatt 2" },
65 { "klatt3", "Klatt 3" },
66 { "whisper", "Whisper" },
68 static const int num_effects = sizeof(effects) / sizeof(effects[0]);
70 static GtkWidget *build_ui(void)
73 GtkVBox *vbox = GTK_VBOX(gtk_vbox_new(0, FALSE));
75 HildonPickerButton *voice, *effect;
76 HildonTouchSelector *voice_selector, *effect_selector;
77 voice = HILDON_PICKER_BUTTON(hildon_picker_button_new(HILDON_SIZE_FINGER_HEIGHT, HILDON_BUTTON_ARRANGEMENT_VERTICAL));
78 hildon_button_set_title(HILDON_BUTTON(voice), "Voice");
79 voice_selector = HILDON_TOUCH_SELECTOR(hildon_touch_selector_new_text());
80 for (k = 0; k < num_voices; k++)
81 hildon_touch_selector_append_text(voice_selector, voices[k].name);
82 hildon_picker_button_set_selector(voice, voice_selector);
83 hildon_picker_button_set_active(voice, 0);
85 effect = HILDON_PICKER_BUTTON(hildon_picker_button_new(HILDON_SIZE_FINGER_HEIGHT, HILDON_BUTTON_ARRANGEMENT_VERTICAL));
86 hildon_button_set_title(HILDON_BUTTON(effect), "Effect");
87 effect_selector = HILDON_TOUCH_SELECTOR(hildon_touch_selector_new_text());
88 for (k = 0; k < num_effects; k++)
89 hildon_touch_selector_append_text(effect_selector, effects[k].name);
90 hildon_picker_button_set_selector(effect, effect_selector);
91 hildon_picker_button_set_active(effect, 0);
93 GtkHBox *buttons = GTK_HBOX(gtk_hbox_new(0, TRUE));
94 gtk_container_add(GTK_CONTAINER(buttons), GTK_WIDGET(voice));
95 gtk_container_add(GTK_CONTAINER(buttons), GTK_WIDGET(effect));
96 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(buttons), FALSE, FALSE, 0);
98 HildonEntry *text = HILDON_ENTRY(hildon_entry_new(HILDON_SIZE_AUTO));
99 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(text), FALSE, FALSE, 0);
101 gtk_box_pack_start(GTK_BOX(vbox), hildon_hvolumebar_new(), FALSE, FALSE, 0);
103 return GTK_WIDGET(vbox);
106 osso_return_t execute(osso_context_t *osso, gpointer data, gboolean user_activated)
110 dialog = gtk_dialog_new_with_buttons(
111 "eSpeakTime Settings",
113 GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR,
120 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), build_ui());
121 gtk_widget_show_all(dialog);
122 gtk_dialog_run(GTK_DIALOG(dialog));
123 gtk_widget_destroy(GTK_WIDGET(dialog));
128 osso_return_t save_state(osso_context_t *osso, gpointer data)
134 int main(int argc, char *argv[])
136 gtk_init(&argc, &argv);
137 return execute(NULL, NULL, 0);