00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00031 #include <string.h>
00032
00033 #include <gtk/gtk.h>
00034
00035 #include <liberdm/display.h>
00036 #include <libergtk/ergtk.h>
00037 #include <liberregxml/erregapi.h>
00038
00039 #include "setupLog.h"
00040 #include "displayStatus.h"
00041 #include "system.h"
00042 #include "gtkInfoItem.h"
00043 #include "gtkSettingItem.h"
00044 #include "gtkPincodeEntry.h"
00045 #include "iLiadPincodeScreen.h"
00046 #include "iLiadPincodeData.h"
00047 #include "iLiadUserData.h"
00048 #include "languages.h"
00049 #include "settings.h"
00050
00051
00052 static GtkWidget *g_pincode_onoff_item = NULL;
00053 static GtkWidget *g_pincode_onoff_infolabel = NULL;
00054 static GtkWidget *g_pincode_onoff_selection = NULL;
00055 static GtkWidget *g_pincode_button_on = NULL;
00056 static GtkWidget *g_pincode_button_off = NULL;
00057 static guint g_pincode_off = -1;
00058 static guint g_pincode_on = -1;
00059
00060 static GtkWidget *g_pincode_select_item = NULL;
00061 static GtkWidget *g_pincode_select_infolabel = NULL;
00062 static GtkWidget *g_old_pincode_label = NULL;
00063 static GtkWidget *g_new_pincode_label = NULL;
00064 static GtkWidget *g_verify_pincode_label = NULL;
00065 static GtkWidget *g_old_pincode_entry = NULL;
00066 static GtkWidget *g_new_pincode_entry = NULL;
00067 static GtkWidget *g_verify_pincode_entry = NULL;
00068 static GtkWidget *g_pincode_confirm_button = NULL;
00069 static GtkWidget *g_pincode_message_label = NULL;
00070 static GtkWidget *g_pincode_additional_info = NULL;
00071
00072
00073 static GtkWidget *create_pincode_onoff_item(void);
00074 static GtkWidget *create_select_pincode_item(void);
00075
00076 static GtkWidget *create_pincode_select_main_area();
00077 static GtkWidget *create_pincode_labels_entries();
00078 static GtkWidget *create_pincode_additional_info();
00079
00080 static void show_help_text(gboolean is_pincode_on);
00081
00082 static void iLiad_pincode_set_message(const gchar * text);
00083
00084
00085 static void on_pincode_onoff_selection_update(erGtkSelectionGroup* selection,
00086 gpointer button,
00087 gpointer data);
00088 static gboolean iLiad_pincode_get_on(void);
00089
00090 static void on_confirm_button_toggled_event(GtkToggleButton * button, gpointer ptr);
00091 static gboolean delayed_on_confirm_button_toggled(gpointer user_data);
00092
00093 static void iLiad_pincode_screen_toolbar_update(void);
00094
00095
00096
00097
00098
00099
00100
00101
00102 GtkWidget *iLiad_pincode_create(void)
00103 {
00104 GtkWidget *vbox;
00105 GtkWidget *onoff_item;
00106 GtkWidget *select_item;
00107
00108 vbox = gtk_vbox_new(FALSE, PINCODE_SCREEN_SPACING_V);
00109
00110 onoff_item = create_pincode_onoff_item();
00111 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(onoff_item), FALSE, FALSE, 0);
00112 select_item = create_select_pincode_item();
00113 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(select_item), FALSE, FALSE, 0);
00114
00115 gtk_widget_show(onoff_item);
00116 gtk_widget_show(select_item);
00117 gtk_widget_show(vbox);
00118
00119 return vbox;
00120 }
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132 static GtkWidget* create_pincode_onoff_item(void)
00133 {
00134 GtkWidget* item;
00135 GtkWidget* selection;
00136 GtkWidget* alignment;
00137 GtkWidget* vbox;
00138 GtkWidget* label;
00139 GtkWidget* hbox;
00140 GtkToggleButton* button_tbl[3];
00141
00142
00143 item = gtk_settingitem_new("");
00144 gtk_widget_set_size_request(item, (-1), (-1));
00145
00146
00147
00148
00149 alignment = gtk_alignment_new(0, 0, 0, 0);
00150 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment),
00151 PINCODE_SCREEN_ITEM_PADDING_TOP,
00152 PINCODE_SCREEN_ITEM_PADDING_BOTTOM,
00153 PINCODE_SCREEN_ITEM_PADDING_LEFT,
00154 PINCODE_SCREEN_ITEM_PADDING_RIGHT);
00155
00156
00157 vbox = gtk_vbox_new(FALSE, PINCODE_SCREEN_SPACING_V * 2);
00158 gtk_container_add(GTK_CONTAINER(alignment), vbox);
00159
00160
00161 label = gtk_label_new("");
00162 gtk_widget_set_name(label, "pincode_screen_info_text");
00163 gtk_widget_set_size_request(label, PINCODE_ONOFF_ITEM_LABEL_WIDTH, (-1));
00164 gtk_label_set_single_line_mode(GTK_LABEL(label), FALSE);
00165 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
00166 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
00167 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
00168
00169
00170 hbox = gtk_hbox_new(FALSE, SMALL_BUTTON_SPACING);
00171 gtk_container_add(GTK_CONTAINER(vbox), hbox);
00172
00173 g_pincode_button_on = ergtk_toggle_button_new_with_label("");
00174 gtk_widget_set_size_request(GTK_WIDGET(g_pincode_button_on), SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT);
00175 gtk_box_pack_start(GTK_BOX(hbox), g_pincode_button_on, FALSE, FALSE, 0);
00176
00177 g_pincode_button_off = ergtk_toggle_button_new_with_label("");
00178 gtk_widget_set_size_request(GTK_WIDGET(g_pincode_button_off), SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT);
00179 gtk_box_pack_start(GTK_BOX(hbox), g_pincode_button_off, FALSE, FALSE, 0);
00180
00181 button_tbl[0] = GTK_TOGGLE_BUTTON(g_pincode_button_on );
00182 button_tbl[1] = GTK_TOGGLE_BUTTON(g_pincode_button_off);
00183 button_tbl[2] = NULL;
00184 g_pincode_on = 0;
00185 g_pincode_off = 1;
00186
00187 selection = ergtk_selection_group_new(button_tbl);
00188 gtk_widget_set_name(selection, "pincode_onoff_background");
00189 ergtk_selection_group_set_details(ERGTK_SELECTION_GROUP(selection), 1, 1);
00190 gtk_widget_set_size_request(GTK_WIDGET(selection), PINCODE_ONOFF_BK_WIDTH, PINCODE_ONOFF_BK_HEIGHT);
00191 g_signal_connect(G_OBJECT(selection), "selection-update", G_CALLBACK(on_pincode_onoff_selection_update), NULL);
00192 gtk_container_add(GTK_CONTAINER(selection), alignment);
00193 gtk_settingitem_add_details(GTK_SETTINGITEM(item), selection);
00194
00195 gtk_widget_show_all(selection);
00196
00197 g_pincode_onoff_item = item;
00198 g_pincode_onoff_infolabel = label;
00199 g_pincode_onoff_selection = selection;
00200 return item;
00201 }
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212 static GtkWidget *create_select_pincode_item(void)
00213 {
00214 GtkWidget *item;
00215 GtkWidget *vbox;
00216 GtkWidget *background;
00217 GtkWidget *alignment;
00218 GtkWidget *widget;
00219 GtkWidget *info;
00220
00221
00222 item = gtk_settingitem_new("");
00223 gtk_widget_set_size_request(GTK_WIDGET(item), (-1), (-1));
00224
00225 vbox = gtk_vbox_new(FALSE, PINCODE_SCREEN_SPACING_V);
00226 gtk_settingitem_add_details(GTK_SETTINGITEM(item), vbox);
00227
00228 background = gtk_event_box_new();
00229 gtk_box_pack_start(GTK_BOX(vbox), background, FALSE, FALSE, 0);
00230 gtk_widget_set_name (GTK_WIDGET (background), "pincode_select_background");
00231 gtk_widget_set_size_request(background, PINCODE_SELECT_BK_WIDTH, PINCODE_SELECT_BK_HEIGHT);
00232
00233 alignment = gtk_alignment_new(0, 0, 0, 0);
00234 gtk_container_add(GTK_CONTAINER(background), alignment);
00235 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment),
00236 PINCODE_SCREEN_ITEM_PADDING_TOP,
00237 PINCODE_SCREEN_ITEM_PADDING_BOTTOM,
00238 PINCODE_SCREEN_ITEM_PADDING_LEFT, PINCODE_SCREEN_ITEM_PADDING_RIGHT);
00239 widget = create_pincode_select_main_area();
00240 gtk_container_add(GTK_CONTAINER(alignment), widget);
00241
00242 info = create_pincode_additional_info();
00243 gtk_box_pack_start(GTK_BOX(vbox), info, FALSE, FALSE, 0);
00244
00245 gtk_widget_show_all(vbox);
00246
00247 g_pincode_select_item = item;
00248
00249 return item;
00250 }
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260 static GtkWidget *create_pincode_select_main_area()
00261 {
00262 GtkWidget *vbox;
00263 GtkWidget *label;
00264 GtkWidget *labels_entries;
00265 GtkWidget *hbox;
00266 GtkWidget *button;
00267 GtkWidget *message;
00268
00269
00270 vbox = gtk_vbox_new(FALSE, PINCODE_SELECT_ITEM_INTER_SPACING1);
00271
00272 label = gtk_label_new("");
00273 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
00274 gtk_widget_set_name(label, "pincode_screen_info_text");
00275 gtk_widget_set_size_request(label, PINCODE_SELECT_ITEM_LABEL_WIDTH, (-1));
00276 gtk_label_set_single_line_mode(GTK_LABEL(label), FALSE);
00277 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
00278 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
00279
00280 labels_entries = create_pincode_labels_entries();
00281 gtk_box_pack_start(GTK_BOX(vbox), labels_entries, FALSE, FALSE, 0);
00282
00283 hbox = gtk_hbox_new(FALSE, PINCODE_SCREEN_SPACING_H);
00284 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
00285
00286 button = ergtk_toggle_button_new_with_label("");
00287 gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(button), FALSE, FALSE, 0);
00288 gtk_widget_set_size_request(button, PINCODE_BUTTON_WIDTH, PINCODE_BUTTON_HEIGHT);
00289 g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(on_confirm_button_toggled_event), NULL);
00290
00291 message = gtk_label_new("");
00292 gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(message), FALSE, FALSE, 0);
00293 gtk_widget_set_name(message, "pincode_screen_info_text");
00294 gtk_widget_set_size_request(message, PINCODE_SELECT_MESSAGE_WIDTH, (-1));
00295 gtk_label_set_single_line_mode(GTK_LABEL(label), FALSE);
00296 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
00297 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
00298
00299 g_pincode_select_infolabel = label;
00300 g_pincode_confirm_button = button;
00301 g_pincode_message_label = message;
00302 return vbox;
00303 }
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317 static GtkWidget *create_pincode_labels_entries()
00318 {
00319 GtkWidget *vbox;
00320 GtkWidget *hbox1;
00321 GtkWidget *hbox2;
00322 GtkWidget *hbox3;
00323 GtkWidget *label1;
00324 GtkWidget *label2;
00325 GtkWidget *label3;
00326 GtkWidget *entry1;
00327 GtkWidget *entry2;
00328 GtkWidget *entry3;
00329
00330 vbox = gtk_vbox_new(FALSE, PINCODE_SELECT_ITEM_INTER_SPACING2);
00331
00332 hbox1 = gtk_hbox_new(FALSE, PINCODE_SCREEN_SPACING_H);
00333 gtk_box_pack_start(GTK_BOX(vbox), hbox1, FALSE, FALSE, 0);
00334
00335 label1 = gtk_label_new("");
00336 gtk_box_pack_start(GTK_BOX(hbox1), label1, FALSE, FALSE, 0);
00337 gtk_widget_set_name(GTK_WIDGET(label1), "pincode_screen_info_text");
00338 gtk_widget_set_size_request(label1, PINCODE_LABELS_WIDTH, PINCODE_LABELS_HEIGHT);
00339 gtk_label_set_justify(GTK_LABEL(label1), GTK_JUSTIFY_LEFT);
00340 gtk_misc_set_alignment(GTK_MISC(label1), 0.0, 0.0);
00341
00342 entry1 = gtk_pincode_entry_new();
00343 gtk_box_pack_start(GTK_BOX(hbox1), entry1, FALSE, FALSE, 0);
00344
00345 hbox2 = gtk_hbox_new(FALSE, PINCODE_SCREEN_SPACING_H);
00346 gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
00347
00348 label2 = gtk_label_new("");
00349 gtk_box_pack_start(GTK_BOX(hbox2), label2, FALSE, FALSE, 0);
00350 gtk_widget_set_name(GTK_WIDGET(label2), "pincode_screen_info_text");
00351 gtk_widget_set_size_request(label2, PINCODE_LABELS_WIDTH, PINCODE_LABELS_HEIGHT);
00352 gtk_label_set_justify(GTK_LABEL(label2), GTK_JUSTIFY_LEFT);
00353 gtk_misc_set_alignment(GTK_MISC(label2), 0.0, 0.0);
00354
00355 entry2 = gtk_pincode_entry_new();
00356 gtk_box_pack_start(GTK_BOX(hbox2), entry2, FALSE, FALSE, 0);
00357
00358 hbox3 = gtk_hbox_new(FALSE, PINCODE_SCREEN_SPACING_H);
00359 gtk_box_pack_start(GTK_BOX(vbox), hbox3, FALSE, FALSE, 0);
00360
00361 label3 = gtk_label_new("");
00362 gtk_box_pack_start(GTK_BOX(hbox3), label3, FALSE, FALSE, 0);
00363 gtk_widget_set_name(GTK_WIDGET(label3), "pincode_screen_info_text");
00364 gtk_widget_set_size_request(label3, PINCODE_LABELS_WIDTH, PINCODE_LABELS_HEIGHT);
00365 gtk_label_set_justify(GTK_LABEL(label3), GTK_JUSTIFY_LEFT);
00366 gtk_misc_set_alignment(GTK_MISC(label3), 0.0, 0.0);
00367
00368 entry3 = gtk_pincode_entry_new();
00369 gtk_box_pack_start(GTK_BOX(hbox3), entry3, FALSE, FALSE, 0);
00370
00371 g_old_pincode_label = label1;
00372 g_new_pincode_label = label2;
00373 g_verify_pincode_label = label3;
00374 g_old_pincode_entry = entry1;
00375 g_new_pincode_entry = entry2;
00376 g_verify_pincode_entry = entry3;
00377 return vbox;
00378 }
00379
00380
00381
00382
00383
00384 static GtkWidget *create_pincode_additional_info()
00385 {
00386 ST_LOGPRINTF("entry");
00387
00388
00389 g_pincode_additional_info = gtk_infoitem_new(FALSE);
00390
00391
00392 gtk_widget_show(g_pincode_additional_info);
00393
00394 return g_pincode_additional_info;
00395 }
00396
00397
00398 void iLiad_pincode_set_text(void)
00399 {
00400 ST_LOGPRINTF("entry");
00401
00402 GtkWidget *item;
00403 GtkWidget *selection;
00404 GtkWidget *label;
00405 GtkWidget *button;
00406
00407
00408 if (g_pincode_onoff_item)
00409 {
00410 item = g_pincode_onoff_item;
00411 gtk_settingitem_set_header_text(GTK_SETTINGITEM(item), _("PIN Code"));
00412 if (g_pincode_onoff_infolabel)
00413 {
00414 label = g_pincode_onoff_infolabel;
00415 gtk_label_set_text(GTK_LABEL(label),
00416 _("The PIN code protects your reader against unauthorized use.\n"
00417 "The code is requested each time the reader is switched on." ));
00418 }
00419 if (g_pincode_onoff_selection)
00420 {
00421 selection = g_pincode_onoff_selection;
00422 gtk_button_set_label(GTK_BUTTON(g_pincode_button_on ), _("On" ));
00423 gtk_button_set_label(GTK_BUTTON(g_pincode_button_off), _("Off"));
00424 }
00425 }
00426
00427 if (g_pincode_select_item)
00428 {
00429 item = g_pincode_select_item;
00430 gtk_settingitem_set_header_text(GTK_SETTINGITEM(item), _("Select PIN code"));
00431 if (g_pincode_select_infolabel)
00432 {
00433 label = g_pincode_select_infolabel;
00434 gtk_label_set_text(GTK_LABEL(label), _("Please select a PIN code of 4 digits."));
00435 }
00436 if (g_old_pincode_label)
00437 {
00438 label = g_old_pincode_label;
00439 gtk_label_set_text(GTK_LABEL(label), _("Please enter current PIN code"));
00440 }
00441 if (g_new_pincode_label)
00442 {
00443 label = g_new_pincode_label;
00444 gtk_label_set_text(GTK_LABEL(label), _("Please enter new PIN code"));
00445 }
00446 if (g_verify_pincode_label)
00447 {
00448 label = g_verify_pincode_label;
00449 gtk_label_set_text(GTK_LABEL(label), _("Please verify new PIN code"));
00450 }
00451
00452 if (g_pincode_confirm_button)
00453 {
00454 button = g_pincode_confirm_button;
00455 gtk_button_set_label(GTK_BUTTON(button), _("Confirm"));
00456 }
00457
00458 if (g_pincode_message_label)
00459 {
00460 label = g_pincode_message_label;
00461 gtk_label_set_text(GTK_LABEL(label), "");
00462 }
00463 if (g_pincode_additional_info)
00464 {
00465 show_help_text(iLiad_pincode_data_is_pincode_on());
00466 }
00467 }
00468 }
00469
00470 void show_help_text(gboolean is_pincode_on)
00471 {
00472 gboolean show_warning_msg = FALSE;
00473
00474 if (is_pincode_on)
00475 {
00476 regUserProfile_t* user_profile = get_user_profile_ptr();
00477
00478 if ((NULL == user_profile) ||
00479 (NULL == user_profile->name) || (user_profile->name[0] == '\0') ||
00480 (NULL == user_profile->email) || (user_profile->email[0] == '\0'))
00481 {
00482 show_warning_msg = TRUE;
00483 }
00484 }
00485
00486
00487 if (show_warning_msg)
00488 {
00489 gtk_infoitem_set_text( GTK_INFOITEM(g_pincode_additional_info),
00490 _("Please create a user account at 'MyiRex' and fill in the account settings in your iLiad."));
00491 }
00492 else
00493 {
00494 gtk_infoitem_set_text( GTK_INFOITEM(g_pincode_additional_info),
00495 _("Warning!\n"
00496 "You can only enter the PIN code with the iLiad's stylus. "
00497 "Make sure that you always have the stylus available "
00498 "after enabling the pin code functionality."));
00499 }
00500 }
00501
00502
00503 void iLiad_pincode_display_data(void)
00504 {
00505 const gboolean enable = iLiad_pincode_data_is_pincode_on();
00506
00507 if (enable)
00508 {
00509 ST_LOGPRINTF("PIN code on");
00510 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g_pincode_button_on), TRUE);
00511 }
00512 else
00513 {
00514 ST_LOGPRINTF("PIN code off");
00515 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g_pincode_button_off), TRUE);
00516 }
00517 }
00518
00519 static gboolean iLiad_pincode_get_on(void)
00520 {
00521 GtkWidget* selection = g_pincode_onoff_selection;
00522 gint selection_id;
00523 gboolean returnValue = FALSE;
00524
00525 ergtk_selection_group_get_selected_buttons(ERGTK_SELECTION_GROUP(selection), &selection_id, 1);
00526
00527 if (g_pincode_on == selection_id)
00528 {
00529 ST_LOGPRINTF("PIN code on");
00530 returnValue = TRUE;
00531 }
00532 else if (g_pincode_off == selection_id)
00533 {
00534 ST_LOGPRINTF("PIN code off");
00535 returnValue = FALSE;
00536 }
00537 else
00538 {
00539 ST_ERRORPRINTF("invalid pincode on/off %d", selection_id);
00540
00541 g_assert_not_reached();
00542 }
00543 return returnValue;
00544 }
00545
00546 static void iLiad_pincode_set_message(const gchar * text)
00547 {
00548 GtkWidget *label;
00549
00550 label = g_pincode_message_label;
00551 if (label && text)
00552 {
00553 gtk_label_set_text(GTK_LABEL(label), text);
00554 gtk_widget_show(label);
00555 display_update_request_screen_refresh(SETTING_ITEM_CHANGE, WAVEFORM_TYPING);
00556 }
00557 }
00558
00559
00560 static void on_pincode_onoff_selection_update(erGtkSelectionGroup* selection,
00561 gpointer button,
00562 gpointer data)
00563 {
00564 gboolean enable;
00565
00566 enable = iLiad_pincode_get_on();
00567
00568 ST_LOGPRINTF("pincode %s", enable == 0 ? "OFF" : "ON");
00569
00570 show_help_text(enable);
00571
00572 iLiad_pincode_data_set_pincode_on(enable);
00573
00574
00575 iLiad_pincode_screen_toolbar_update();
00576
00577
00578 iLiad_pincode_data_store();
00579
00580 display_update_request_screen_refresh(SETTING_ITEM_CHANGE, WAVEFORM_TYPING);
00581 }
00582
00583
00584 static void on_confirm_button_toggled_event(GtkToggleButton * button, gpointer ptr)
00585 {
00586
00587 gboolean pressed = gtk_toggle_button_get_active(button);
00588 if (pressed)
00589 {
00590
00591 display_update_request_screen_refresh(TEXT_ENTRY_CHANGED_LEVEL, WAVEFORM_TYPING);
00592 g_timeout_add(500, delayed_on_confirm_button_toggled, ptr);
00593 }
00594 }
00595
00596 static gboolean delayed_on_confirm_button_toggled(gpointer user_data)
00597 {
00598 GtkWidget *button = g_pincode_confirm_button;
00599
00600 gboolean check_old = FALSE;
00601 gboolean check_new = FALSE;
00602 gboolean check_verify = FALSE;
00603
00604 const gchar *old_pincode = NULL;
00605 const gchar *new_pincode = NULL;
00606 const gchar *verify_pincode = NULL;
00607
00608 gchar *pincode = NULL;
00609
00610 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE);
00611
00612 pincode = iLiad_pincode_data_get_pincode();
00613 if ((NULL == pincode) || (0 == strlen(pincode)))
00614 {
00615 check_old = TRUE;
00616 }
00617 else
00618 {
00619 check_old = gtk_pincode_entry_check_text(GTK_PINCODE_ENTRY(g_old_pincode_entry));
00620 }
00621 check_new = gtk_pincode_entry_check_text(GTK_PINCODE_ENTRY(g_new_pincode_entry));
00622 check_verify = gtk_pincode_entry_check_text(GTK_PINCODE_ENTRY(g_verify_pincode_entry));
00623 if (FALSE == check_old || FALSE == check_new || FALSE == check_verify)
00624 {
00625 gtk_entry_set_text(GTK_ENTRY(g_old_pincode_entry), "");
00626 gtk_entry_set_text(GTK_ENTRY(g_new_pincode_entry), "");
00627 gtk_entry_set_text(GTK_ENTRY(g_verify_pincode_entry), "");
00628 iLiad_pincode_set_message(_("Illegal characters or illegal length, pincode unchanged"));
00629 return FALSE;
00630 }
00631
00632 new_pincode = gtk_entry_get_text(GTK_ENTRY(g_new_pincode_entry));
00633 verify_pincode = gtk_entry_get_text(GTK_ENTRY(g_verify_pincode_entry));
00634 if (strcmp(new_pincode, verify_pincode))
00635 {
00636 gtk_entry_set_text(GTK_ENTRY(g_old_pincode_entry), "");
00637 gtk_entry_set_text(GTK_ENTRY(g_new_pincode_entry), "");
00638 gtk_entry_set_text(GTK_ENTRY(g_verify_pincode_entry), "");
00639
00640 iLiad_pincode_set_message(_("Pincode verification failed, pincode unchanged"));
00641 return FALSE;
00642 }
00643 if (NULL == pincode || 0 == strlen(pincode))
00644 {
00645 iLiad_pincode_data_set_pincode(new_pincode);
00646 iLiad_pincode_display_data();
00647
00648
00649 iLiad_pincode_data_store();
00650
00651 iLiad_pincode_set_message(_("Pincode updated successfully"));
00652
00653 iLiad_pincode_screen_toolbar_update();
00654
00655 gtk_entry_set_text(GTK_ENTRY(g_old_pincode_entry), "");
00656 gtk_entry_set_text(GTK_ENTRY(g_new_pincode_entry), "");
00657 gtk_entry_set_text(GTK_ENTRY(g_verify_pincode_entry), "");
00658
00659 return FALSE;
00660 }
00661 old_pincode = gtk_entry_get_text(GTK_ENTRY(g_old_pincode_entry));
00662 if (strcmp(old_pincode, pincode))
00663 {
00664 gtk_entry_set_text(GTK_ENTRY(g_old_pincode_entry), "");
00665 gtk_entry_set_text(GTK_ENTRY(g_new_pincode_entry), "");
00666 gtk_entry_set_text(GTK_ENTRY(g_verify_pincode_entry), "");
00667
00668 iLiad_pincode_set_message(_("Current pincode incorrect, pincode unchanged"));
00669 }
00670 else
00671 {
00672 iLiad_pincode_data_set_pincode(new_pincode);
00673 iLiad_pincode_display_data();
00674
00675
00676 iLiad_pincode_data_store();
00677
00678 iLiad_pincode_set_message(_("Pincode updated successfully"));
00679
00680 iLiad_pincode_screen_toolbar_update();
00681
00682 gtk_entry_set_text(GTK_ENTRY(g_old_pincode_entry), "");
00683 gtk_entry_set_text(GTK_ENTRY(g_new_pincode_entry), "");
00684 gtk_entry_set_text(GTK_ENTRY(g_verify_pincode_entry), "");
00685 }
00686 return FALSE;
00687 }
00688
00689 static void iLiad_pincode_screen_toolbar_update(void)
00690 {
00691 gboolean enable = FALSE;
00692 gchar *pincode = NULL;
00693
00694
00695 enable = iLiad_pincode_data_is_pincode_on();
00696 pincode = iLiad_pincode_data_get_pincode();
00697
00698 if (FALSE == enable || NULL == pincode || 0 == strlen(pincode))
00699 {
00700 show_lock_screen_icon(FALSE);
00701 }
00702 else
00703 {
00704 show_lock_screen_icon(TRUE);
00705 }
00706 }