00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00031 #include <dirent.h>
00032 #include <stdlib.h>
00033 #include <string.h>
00034 #include <strings.h>
00035 #include <sys/stat.h>
00036
00037 #include <gtk/gtk.h>
00038
00039 #include <libergtk/ergtk.h>
00040
00041 #include "setupLog.h"
00042 #include "gtkInfoItem.h"
00043 #include "gtkSettingItem.h"
00044 #include "iLiadConfigScreen.h"
00045 #include "iLiadConfigData.h"
00046 #include "languages.h"
00047 #include "background.h"
00048
00049
00050 static iLiad_locale_t* g_locale_installed_tbl = NULL;
00051 static guint g_locale_installed_num = 0;
00052
00053 static GtkWidget* g_vbox = NULL;
00054
00055 static GtkWidget* g_calibration_item = NULL;
00056 static GtkWidget* g_calibration_button = NULL;
00057
00058 static GtkWidget* g_sound_item = NULL;
00059 static GtkWidget* g_sound_selection = NULL;
00060 enum
00061 {
00062 e_sound_on = 0,
00063 e_sound_off,
00064 e_sound_undefined
00065 };
00066 static GtkWidget* g_sound_buttons[e_sound_undefined];
00067
00068 static GtkWidget* g_keys_item = NULL;
00069 static GtkWidget* g_keys_selection = NULL;
00070 enum
00071 {
00072 e_keys_0_5_sec = 0,
00073 e_keys_1_0_sec,
00074 e_keys_1_5_sec,
00075 e_keys_2_0_sec,
00076 e_keys_undefined
00077 };
00078 static GtkWidget* g_keys_buttons[e_keys_undefined];
00079
00080 static GtkWidget* g_flipbar_direction_item = NULL;
00081 static GtkWidget* g_flipbar_direction_selection = NULL;
00082 enum
00083 {
00084 e_flipbar_direction_left = 0,
00085 e_flipbar_direction_right,
00086 e_flipbar_direction_undefined
00087 };
00088 static GtkWidget* g_flipbar_direction_buttons[e_flipbar_direction_undefined];
00089
00090 static GtkWidget* g_keybuffering_item = NULL;
00091 static GtkWidget* g_keybuffering_selection = NULL;
00092 enum
00093 {
00094 e_keybuffering_on = 0,
00095 e_keybuffering_off,
00096 e_keybuffering_undefined
00097 };
00098 static GtkWidget* g_keybuffering_buttons[e_keybuffering_undefined];
00099
00100 static GtkWidget* g_language_item = NULL;
00101 static GtkWidget* g_language_selection = NULL;
00102 static GtkWidget** g_language_buttons = NULL;
00103
00104
00105 static GtkWidget* create_calibration_item(void);
00106 static GtkWidget* create_sound_item(void);
00107 static GtkWidget* create_keys_item(void);
00108 static GtkWidget* create_flipbar_direction_item(void);
00109 static GtkWidget* create_keybuffering_item(void);
00110 static GtkWidget* create_language_item(void);
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122 GtkWidget *iLiad_config_create(void)
00123 {
00124 g_locale_installed_num = find_installed_locales(&g_locale_installed_tbl);
00125
00126 g_vbox = gtk_vbox_new(FALSE, CONFIGSCREEN_ITEM_SPACING);
00127
00128 g_sound_item = create_sound_item();
00129 gtk_box_pack_start(GTK_BOX(g_vbox), GTK_WIDGET(g_sound_item), FALSE, FALSE, 0);
00130
00131 g_keybuffering_item = create_keybuffering_item();
00132 gtk_box_pack_start(GTK_BOX(g_vbox), GTK_WIDGET(g_keybuffering_item), FALSE, FALSE, 0);
00133
00134 g_keys_item = create_keys_item();
00135 gtk_box_pack_start(GTK_BOX(g_vbox), GTK_WIDGET(g_keys_item), FALSE, FALSE, 0);
00136
00137 g_flipbar_direction_item = create_flipbar_direction_item();
00138 gtk_box_pack_start(GTK_BOX(g_vbox), GTK_WIDGET(g_flipbar_direction_item), FALSE, FALSE, 0);
00139
00140 g_calibration_item = create_calibration_item();
00141
00142
00143
00144 g_language_item = create_language_item();
00145 gtk_box_pack_start(GTK_BOX(g_vbox), GTK_WIDGET(g_language_item), FALSE, FALSE, 0);
00146
00147 gtk_widget_show(g_vbox);
00148
00149 return g_vbox;
00150 }
00151
00152
00153 static GtkWidget* create_sound_item(void)
00154 {
00155 int i;
00156 GtkWidget* alignment;
00157 GtkWidget* hbox;
00158 GtkWidget* button;
00159 GtkToggleButton* button_tbl[e_sound_undefined + 1];
00160
00161
00162
00163
00164
00165 g_sound_item = gtk_settingitem_new("");
00166 gtk_widget_set_size_request(GTK_WIDGET(g_sound_item), (-1), (-1));
00167
00168
00169
00170 alignment = gtk_alignment_new(0, 0.5, 0, 0);
00171 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), CONFIGSCREEN_INTRA_PADDING, CONFIGSCREEN_INTER_PADDING, 0, 0);
00172 gtk_settingitem_add_details(GTK_SETTINGITEM(g_sound_item), alignment);
00173
00174
00175
00176
00177
00178 hbox = gtk_hbox_new(FALSE, SMALL_BUTTON_SPACING);
00179
00180 for (i = 0 ; i < e_sound_undefined ; i++)
00181 {
00182 button = ergtk_toggle_button_new_with_label("");
00183 button_tbl[i] = GTK_TOGGLE_BUTTON(button);
00184 gtk_widget_set_name(button, "button_without_border");
00185 gtk_widget_set_size_request(button, SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT);
00186 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
00187
00188 g_sound_buttons[i] = GTK_WIDGET(button);
00189 }
00190 button_tbl[i] = NULL;
00191
00192 g_sound_selection = ergtk_selection_group_new(button_tbl);
00193 ergtk_selection_group_set_details(ERGTK_SELECTION_GROUP(g_sound_selection), 1, 1);
00194 g_signal_connect(G_OBJECT(g_sound_selection), "selection-update", G_CALLBACK(on_sound_selection_update), NULL);
00195 gtk_container_add(GTK_CONTAINER(g_sound_selection), hbox);
00196 gtk_container_add(GTK_CONTAINER(alignment), g_sound_selection);
00197
00198 gtk_widget_show_all(g_sound_item);
00199 return g_sound_item;
00200 }
00201
00202
00203
00204
00205
00206
00207
00208 static GtkWidget *create_calibration_item(void)
00209 {
00210 GtkWidget *alignment;
00211
00212
00213 g_calibration_item = gtk_settingitem_new("");
00214 gtk_widget_set_size_request(GTK_WIDGET(g_calibration_item), (-1), (-1));
00215
00216
00217 alignment = gtk_alignment_new(0, 0.5, 0, 0);
00218 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), CONFIGSCREEN_INTRA_PADDING, CONFIGSCREEN_INTER_PADDING, 0, 0);
00219 gtk_settingitem_add_details(GTK_SETTINGITEM(g_calibration_item), alignment);
00220
00221
00222 g_calibration_button = gtk_button_new_with_label("");
00223 gtk_widget_set_size_request(GTK_WIDGET(g_calibration_button), SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT);
00224 gtk_container_add(GTK_CONTAINER(alignment), g_calibration_button);
00225
00226 gtk_widget_show(g_calibration_button);
00227 gtk_widget_show(alignment);
00228 gtk_widget_show(g_calibration_item);
00229
00230 return g_calibration_item;
00231 }
00232
00233
00234 static GtkWidget *create_keys_item(void)
00235 {
00236 int i;
00237 GtkWidget* alignment;
00238 GtkWidget* hbox;
00239 GtkWidget* button;
00240 GtkToggleButton* button_tbl[e_keys_undefined + 1];
00241
00242
00243
00244
00245
00246 g_keys_item = gtk_settingitem_new("");
00247 gtk_widget_set_size_request(GTK_WIDGET(g_keys_item), (-1), (-1));
00248
00249
00250
00251 alignment = gtk_alignment_new(0, 0.5, 0, 0);
00252 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), CONFIGSCREEN_INTRA_PADDING, CONFIGSCREEN_INTER_PADDING, 0, 0);
00253 gtk_settingitem_add_details(GTK_SETTINGITEM(g_keys_item), alignment);
00254
00255
00256
00257
00258
00259 hbox = gtk_hbox_new(FALSE, SMALL_BUTTON_SPACING);
00260
00261 for (i = 0 ; i < e_keys_undefined ; i++)
00262 {
00263 button = ergtk_toggle_button_new_with_label("");
00264 button_tbl[i] = GTK_TOGGLE_BUTTON(button);
00265 gtk_widget_set_name(button, "button_without_border");
00266 gtk_widget_set_size_request(button, SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT);
00267 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
00268
00269 g_keys_buttons[i] = GTK_WIDGET(button);
00270 }
00271 button_tbl[i] = NULL;
00272
00273 g_keys_selection = ergtk_selection_group_new(button_tbl);
00274 ergtk_selection_group_set_details(ERGTK_SELECTION_GROUP(g_keys_selection), 1, 1);
00275 g_signal_connect(G_OBJECT(g_keys_selection), "selection-update", G_CALLBACK(on_keys_selection_update), NULL);
00276 gtk_container_add(GTK_CONTAINER(g_keys_selection), hbox);
00277 gtk_container_add(GTK_CONTAINER(alignment), g_keys_selection);
00278
00279 gtk_widget_show_all(g_keys_item);
00280 return g_keys_item;
00281 }
00282
00283
00284
00285
00286
00287
00288
00289
00290 static GtkWidget *create_keybuffering_item(void)
00291 {
00292 int i;
00293 GtkWidget* alignment;
00294 GtkWidget* hbox;
00295 GtkWidget* button;
00296 GtkToggleButton* button_tbl[e_keybuffering_undefined + 1];
00297
00298
00299
00300
00301
00302 g_keybuffering_item = gtk_settingitem_new("");
00303 gtk_widget_set_size_request(GTK_WIDGET(g_keybuffering_item), (-1), (-1));
00304
00305
00306
00307 alignment = gtk_alignment_new(0, 0.5, 0, 0);
00308 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), CONFIGSCREEN_INTRA_PADDING, CONFIGSCREEN_INTER_PADDING, 0, 0);
00309 gtk_settingitem_add_details(GTK_SETTINGITEM(g_keybuffering_item), alignment);
00310
00311
00312
00313
00314
00315 hbox = gtk_hbox_new(FALSE, SMALL_BUTTON_SPACING);
00316
00317 for (i = 0 ; i < e_keybuffering_undefined ; i++)
00318 {
00319 button = ergtk_toggle_button_new_with_label("");
00320 button_tbl[i] = GTK_TOGGLE_BUTTON(button);
00321 gtk_widget_set_name(button, "button_without_border");
00322 gtk_widget_set_size_request(button, SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT);
00323 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
00324
00325 g_keybuffering_buttons[i] = GTK_WIDGET(button);
00326 }
00327 button_tbl[i] = NULL;
00328
00329 g_keybuffering_selection = ergtk_selection_group_new(button_tbl);
00330 ergtk_selection_group_set_details(ERGTK_SELECTION_GROUP(g_keybuffering_selection), 1, 1);
00331 g_signal_connect(G_OBJECT(g_keybuffering_selection), "selection-update", G_CALLBACK(on_keybuffering_selection_update), NULL);
00332 gtk_container_add(GTK_CONTAINER(g_keybuffering_selection), hbox);
00333 gtk_container_add(GTK_CONTAINER(alignment), g_keybuffering_selection);
00334
00335 gtk_widget_show_all(g_keybuffering_item);
00336 return g_keybuffering_item;
00337 }
00338
00339
00340 static GtkWidget *create_flipbar_direction_item(void)
00341 {
00342 int i;
00343 GtkWidget* alignment;
00344 GtkWidget* hbox;
00345 GtkWidget* button;
00346 GtkToggleButton* button_tbl[e_flipbar_direction_undefined + 1];
00347
00348
00349
00350
00351
00352 g_flipbar_direction_item = gtk_settingitem_new("");
00353 gtk_widget_set_size_request(GTK_WIDGET(g_flipbar_direction_item), (-1), (-1));
00354
00355
00356
00357 alignment = gtk_alignment_new(0, 0.5, 0, 0);
00358 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), CONFIGSCREEN_INTRA_PADDING, CONFIGSCREEN_INTER_PADDING, 0, 0);
00359 gtk_settingitem_add_details(GTK_SETTINGITEM(g_flipbar_direction_item), alignment);
00360
00361
00362
00363
00364
00365 hbox = gtk_hbox_new(FALSE, SMALL_BUTTON_SPACING);
00366
00367 for (i = 0 ; i < e_flipbar_direction_undefined ; i++)
00368 {
00369 button = ergtk_toggle_button_new_with_label("");
00370 button_tbl[i] = GTK_TOGGLE_BUTTON(button);
00371 gtk_widget_set_name(button, "button_without_border");
00372 gtk_widget_set_size_request(button, SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT);
00373 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
00374
00375 g_flipbar_direction_buttons[i] = GTK_WIDGET(button);
00376 }
00377 button_tbl[i] = NULL;
00378
00379 g_flipbar_direction_selection = ergtk_selection_group_new(button_tbl);
00380 ergtk_selection_group_set_details(ERGTK_SELECTION_GROUP(g_flipbar_direction_selection), 1, 1);
00381 g_signal_connect(G_OBJECT(g_flipbar_direction_selection), "selection-update", G_CALLBACK(on_flipbar_direction_selection_update), NULL);
00382 gtk_container_add(GTK_CONTAINER(g_flipbar_direction_selection), hbox);
00383 gtk_container_add(GTK_CONTAINER(alignment), g_flipbar_direction_selection);
00384
00385 gtk_widget_show_all(g_flipbar_direction_item);
00386 return g_flipbar_direction_item;
00387 }
00388
00389
00390 static GtkWidget *create_language_item(void)
00391 {
00392 int i;
00393 GtkWidget* alignment;
00394 GtkWidget* vbox;
00395 GtkWidget* hbox;
00396 GtkWidget* button;
00397 GtkToggleButton* button_tbl[e_keys_undefined + 1];
00398
00399
00400
00401
00402
00403 g_language_item = gtk_settingitem_new("");
00404 gtk_widget_set_size_request(GTK_WIDGET(g_language_item), (-1), (-1));
00405
00406
00407
00408 alignment = gtk_alignment_new(0, 0.5, 0, 0);
00409 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), CONFIGSCREEN_INTRA_PADDING, CONFIGSCREEN_INTER_PADDING, 0, 0);
00410 gtk_settingitem_add_details(GTK_SETTINGITEM(g_language_item), alignment);
00411
00412
00413
00414
00415
00416
00417 vbox = gtk_vbox_new(TRUE, LARGE_BUTTON_SPACING);
00418 hbox = NULL;
00419 g_language_buttons = g_new0(GtkWidget*, g_locale_installed_num);
00420 for (i = 0 ; i < g_locale_installed_num ; i++)
00421 {
00422 if ((i % LANGUAGE_BUTTONS_PER_LINE) == 0)
00423 {
00424 hbox = gtk_hbox_new(FALSE, SMALL_BUTTON_SPACING);
00425 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
00426 }
00427 button = ergtk_toggle_button_new_with_label( g_locale_installed_tbl[i].name );
00428 button_tbl[i] = GTK_TOGGLE_BUTTON(button);
00429 gtk_widget_set_name(button, "button_without_border");
00430 gtk_widget_set_size_request(button, SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT);
00431 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
00432
00433 g_language_buttons[i] = GTK_WIDGET(button);
00434 }
00435 button_tbl[i] = NULL;
00436
00437 g_language_selection = ergtk_selection_group_new(button_tbl);
00438 ergtk_selection_group_set_details(ERGTK_SELECTION_GROUP(g_language_selection), 1, 1);
00439 g_signal_connect(G_OBJECT(g_language_selection), "selection-update", G_CALLBACK(on_language_selection_update), NULL);
00440 gtk_container_add(GTK_CONTAINER(g_language_selection), vbox);
00441 gtk_container_add(GTK_CONTAINER(alignment), g_language_selection);
00442
00443 gtk_widget_show_all(g_language_item);
00444 return g_language_item;
00445 }
00446
00447 void iLiad_config_set_text(void)
00448 {
00449 ST_LANGUAGEPRINTF("entry");
00450
00451
00452 if (g_sound_item)
00453 {
00454 gtk_settingitem_set_header_text(GTK_SETTINGITEM(g_sound_item), _("Sound"));
00455 gtk_settingitem_set_info_text(GTK_SETTINGITEM(g_sound_item),
00456 _("With this function you can enable or disable the sound of your iLiad."));
00457 gtk_button_set_label(GTK_BUTTON(g_sound_buttons[e_sound_on ]), _("On" ));
00458 gtk_button_set_label(GTK_BUTTON(g_sound_buttons[e_sound_off]), _("Off"));
00459 }
00460
00461
00462 if (g_keybuffering_item)
00463 {
00464 gtk_settingitem_set_header_text(GTK_SETTINGITEM(g_keybuffering_item), _("Key buffering"));
00465 gtk_settingitem_set_info_text(GTK_SETTINGITEM(g_keybuffering_item),
00466 _("When you enable key buffering, the iLiad will remember the keys pressed and process them when the device is ready."));
00467 gtk_button_set_label(GTK_BUTTON(g_keybuffering_buttons[e_keybuffering_on ]), _("On" ));
00468 gtk_button_set_label(GTK_BUTTON(g_keybuffering_buttons[e_keybuffering_off]), _("Off"));
00469 }
00470
00471
00472 if (g_keys_item)
00473 {
00474 gtk_settingitem_set_header_text(GTK_SETTINGITEM(g_keys_item), _("Keys"));
00475 gtk_settingitem_set_info_text(GTK_SETTINGITEM(g_keys_item),
00476 _("With this function you can set the minimum duration for a long keypress."));
00477 gtk_button_set_label(GTK_BUTTON(g_keys_buttons[e_keys_0_5_sec]), _("0.5 seconds"));
00478 gtk_button_set_label(GTK_BUTTON(g_keys_buttons[e_keys_1_0_sec]), _("1 second") );
00479 gtk_button_set_label(GTK_BUTTON(g_keys_buttons[e_keys_1_5_sec]), _("1.5 seconds"));
00480 gtk_button_set_label(GTK_BUTTON(g_keys_buttons[e_keys_2_0_sec]), _("2 seconds") );
00481 }
00482
00483
00484 if (g_flipbar_direction_item)
00485 {
00486 gtk_settingitem_set_header_text(GTK_SETTINGITEM(g_flipbar_direction_item), _("Flipbar direction"));
00487 gtk_settingitem_set_info_text(GTK_SETTINGITEM(g_flipbar_direction_item),
00488 _("With this function you choose how to move the flipbar for advancing in a document."));
00489 gtk_button_set_label(GTK_BUTTON(g_flipbar_direction_buttons[e_flipbar_direction_left ]), _("Left") );
00490 gtk_button_set_label(GTK_BUTTON(g_flipbar_direction_buttons[e_flipbar_direction_right]), _("Right"));
00491 }
00492
00493
00494 if (g_calibration_item)
00495 {
00496 gtk_settingitem_set_header_text(GTK_SETTINGITEM(g_calibration_item), _("Pen interface"));
00497 gtk_button_set_label(GTK_BUTTON(g_calibration_button), _("Calibration"));
00498 }
00499
00500
00501 if (g_language_item)
00502 {
00503 gtk_settingitem_set_header_text(GTK_SETTINGITEM(g_language_item), _("Languages"));
00504 gtk_settingitem_set_info_text(GTK_SETTINGITEM(g_language_item),
00505 _("With this function you can set the language of the iLiad."));
00506 }
00507 }
00508
00509 void iLiad_config_set_language(const gchar *locale)
00510 {
00511 gint i;
00512
00513 for (i = 0 ; i < g_locale_installed_num ; i++)
00514 {
00515 if (strcmp(locale, g_locale_installed_tbl[i].code) == 0)
00516 {
00517
00518 break;
00519 }
00520 }
00521 if (i == g_locale_installed_num)
00522 {
00523
00524 iLiad_config_set_language(DEFAULT_LOCALE);
00525 }
00526 else
00527 {
00528
00529 ST_LANGUAGEPRINTF("%s %s", locale, g_locale_installed_tbl[i].name);
00530 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g_language_buttons[i]), TRUE);
00531 }
00532 }
00533
00534 const gchar *iLiad_config_get_language(void)
00535 {
00536 gint currentLanguage;
00537 const gchar *returnValue = DEFAULT_LOCALE;
00538
00539 ergtk_selection_group_get_selected_buttons(ERGTK_SELECTION_GROUP(g_language_selection), ¤tLanguage, 1);
00540 if (currentLanguage >= 0 && currentLanguage < g_locale_installed_num)
00541 {
00542 returnValue = g_locale_installed_tbl[currentLanguage].code;
00543 }
00544
00545 return returnValue;
00546 }
00547
00548 void iLiad_config_set_keys(guint timeout)
00549 {
00550 if (timeout <= 500)
00551 {
00552 ST_LOGPRINTF("zero_point_five_sec");
00553 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g_keys_buttons[e_keys_0_5_sec]), TRUE);
00554 }
00555 else if (timeout <= 1000)
00556 {
00557 ST_LOGPRINTF("one_sec");
00558 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g_keys_buttons[e_keys_1_0_sec]), TRUE);
00559 }
00560 else if (timeout <= 1500)
00561 {
00562 ST_LOGPRINTF("one_point_five_sec");
00563 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g_keys_buttons[e_keys_1_5_sec]), TRUE);
00564 }
00565 else
00566 {
00567 ST_LOGPRINTF("two_sec_sec");
00568 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g_keys_buttons[e_keys_2_0_sec]), TRUE);
00569 }
00570 }
00571
00572 guint iLiad_config_get_keys(void)
00573 {
00574 gint currentTimeOut = 0;
00575 guint returnValue = 500;
00576
00577 ergtk_selection_group_get_selected_buttons(ERGTK_SELECTION_GROUP(g_keys_selection), ¤tTimeOut, 1);
00578
00579 switch (currentTimeOut)
00580 {
00581 case e_keys_0_5_sec:
00582 ST_LOGPRINTF("zero_point_five_sec");
00583 returnValue = 500;
00584 break;
00585 case e_keys_1_0_sec:
00586 ST_LOGPRINTF("one_sec");
00587 returnValue = 1000;
00588 break;
00589 case e_keys_1_5_sec:
00590 ST_LOGPRINTF("one_point_five_sec");
00591 returnValue = 1500;
00592 break;
00593 case e_keys_2_0_sec:
00594 ST_LOGPRINTF("two_sec");
00595 returnValue = 2000;
00596 break;
00597 default:
00598 ST_ERRORPRINTF("invalid keys ID %d", currentTimeOut);
00599 g_assert_not_reached();
00600 }
00601 return returnValue;
00602 }
00603
00604 void iLiad_config_set_volume(guint volume)
00605 {
00606 if (0 == volume)
00607 {
00608 ST_LOGPRINTF("Sound off");
00609 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g_sound_buttons[e_sound_off]), TRUE);
00610 }
00611 else
00612 {
00613 ST_LOGPRINTF("Sound on");
00614 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g_sound_buttons[e_sound_on]), TRUE);
00615 }
00616 }
00617
00618 guint iLiad_config_get_volume(void)
00619 {
00620 gint current_sound = 0;
00621 guint returnValue = 0;
00622
00623 ergtk_selection_group_get_selected_buttons(ERGTK_SELECTION_GROUP(g_sound_selection), ¤t_sound, 1);
00624
00625 switch (current_sound)
00626 {
00627 case e_sound_off:
00628 ST_LOGPRINTF("sound off");
00629 returnValue = 0;
00630 break;
00631 case e_sound_on:
00632 ST_LOGPRINTF("sound on");
00633 returnValue = 1;
00634 break;
00635 default:
00636 ST_ERRORPRINTF("invalid sound ID %d", current_sound);
00637 g_assert_not_reached();
00638 }
00639 return returnValue;
00640 }
00641
00642 void iLiad_config_set_keybuffering(guint volume)
00643 {
00644 if (volume == 0)
00645 {
00646 ST_LOGPRINTF("KeyBuffering off");
00647 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g_keybuffering_buttons[e_keybuffering_off]), TRUE);
00648 }
00649 else
00650 {
00651 ST_LOGPRINTF("KeyBuffering on");
00652 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g_keybuffering_buttons[e_keybuffering_on]), TRUE);
00653 }
00654 }
00655
00656 guint iLiad_config_get_keybuffering(void)
00657 {
00658 gint currentBuffering = 0;
00659 guint returnValue = 0;
00660
00661 ergtk_selection_group_get_selected_buttons(ERGTK_SELECTION_GROUP(g_keybuffering_selection), ¤tBuffering, 1);
00662
00663 switch (currentBuffering)
00664 {
00665 case e_keybuffering_on:
00666 ST_LOGPRINTF("KeyBuffering on");
00667 returnValue = 1;
00668 break;
00669 case e_keybuffering_off:
00670 ST_LOGPRINTF("KeyBuffering off");
00671 returnValue = 0;
00672 break;
00673 default:
00674 ST_ERRORPRINTF("invalid keyBuffering ID %d", currentBuffering);
00675 g_assert_not_reached();
00676 }
00677 return returnValue;
00678 }
00679
00680 void iLiad_config_set_flipbar_direction(gboolean left)
00681 {
00682 if (left)
00683 {
00684 ST_LOGPRINTF("Flipbar Left");
00685 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g_flipbar_direction_buttons[e_flipbar_direction_left]), TRUE);
00686 }
00687 else
00688 {
00689 ST_LOGPRINTF("Flipbar Right");
00690 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g_flipbar_direction_buttons[e_flipbar_direction_right]), TRUE);
00691 }
00692 }
00693
00694 gboolean iLiad_config_get_flipbar_direction(void)
00695 {
00696 gint currentDirection = 0;
00697 gboolean returnValue = 0;
00698
00699 ergtk_selection_group_get_selected_buttons(ERGTK_SELECTION_GROUP(g_flipbar_direction_selection), ¤tDirection, 1);
00700
00701 switch (currentDirection)
00702 {
00703 case e_flipbar_direction_left:
00704 ST_LOGPRINTF("Flipbar Left");
00705 returnValue = TRUE;
00706 break;
00707 case e_flipbar_direction_right:
00708 ST_LOGPRINTF("Flipbar Right");
00709 returnValue = FALSE;
00710 break;
00711 default:
00712 ST_ERRORPRINTF("invalid flipbarDirection ID %d", currentDirection);
00713 g_assert_not_reached();
00714 }
00715 return returnValue;
00716 }
00717
00718