#include <gtk/gtk.h>
#include <string.h>
#include <liberregxml/erregapi.h>
#include "setupLog.h"
#include "displayStatus.h"
#include "iLiadUserScreen.h"
#include "iLiadUserData.h"
#include "languages.h"
#include "settings.h"
Go to the source code of this file.
Functions | |
| static regUserProfile_t * | user_profile_dup (const regUserProfile_t *profile) |
| void | iLiad_user_data_init (void) |
| void | iLiad_user_data_destroy (void) |
| void | iLiad_user_data_display (void) |
| void | on_user_name_changed (GtkWidget *item, const gchar *text) |
| void | on_user_email_changed (GtkWidget *item, const gchar *text) |
| void | on_user_password_changed (GtkWidget *item, const gchar *text) |
| void | iLiad_user_data_store (void) |
| regUserProfile_t * | get_user_profile_ptr () |
Variables | |
| static regUserProfile_t * | g_user_profile = NULL |
| static regUserProfile_t * | g_stored_profile = NULL |
Copyright (C) 2005-2008 iRex Technologies B.V. All rights reserved.
Definition in file iLiadUserData.c.
| regUserProfile_t* get_user_profile_ptr | ( | ) |
| void iLiad_user_data_destroy | ( | void | ) |
Definition at line 73 of file iLiadUserData.c.
00074 { 00075 ST_LOGPRINTF("entry"); 00076 00077 if (g_user_profile) 00078 { 00079 erRegFreeUserProfile(g_user_profile); 00080 g_user_profile = NULL; 00081 } 00082 00083 if (g_stored_profile) 00084 { 00085 erRegFreeUserProfile(g_stored_profile); 00086 g_stored_profile = NULL; 00087 } 00088 }

| void iLiad_user_data_display | ( | void | ) |
Definition at line 90 of file iLiadUserData.c.
00091 { 00092 ST_LOGPRINTF("entry"); 00093 00094 g_return_if_fail(NULL != g_user_profile); 00095 g_assert(NULL != g_user_profile); 00096 00097 // name 00098 if (g_user_profile->name) 00099 { 00100 iLiad_user_set_name(g_user_profile->name); 00101 } 00102 00103 // email 00104 if (g_user_profile->email) 00105 { 00106 iLiad_user_set_email(g_user_profile->email); 00107 } 00108 00109 // password 00110 if (g_user_profile->password) 00111 { 00112 iLiad_user_set_password(g_user_profile->password); 00113 } 00114 00115 // redirect-url: not displayed 00116 00117 display_update_request_screen_refresh(SETTING_ITEM_CHANGE, WAVEFORM_FULLSCREEN); 00118 }

| void iLiad_user_data_init | ( | void | ) |
Definition at line 49 of file iLiadUserData.c.
00050 { 00051 ST_LOGPRINTF("entry"); 00052 00053 iLiad_user_data_destroy(); 00054 00055 g_user_profile = erRegGetUserProfile(); 00056 00057 if (g_user_profile == NULL) 00058 { 00059 ST_WARNPRINTF("use default values"); 00060 g_user_profile = g_new0(regUserProfile_t, 1); 00061 00062 g_user_profile->name = g_strdup("iRex"); 00063 g_user_profile->email = g_strdup("i@r.x"); 00064 g_user_profile->password = g_strdup("98In4w5tg"); 00065 g_user_profile->redirectUrl = g_strdup("https://ids.irexnet.com:443/redirector"); 00066 } 00067 else 00068 { 00069 g_stored_profile = user_profile_dup(g_user_profile); 00070 } 00071 }

| void iLiad_user_data_store | ( | void | ) |
Definition at line 165 of file iLiadUserData.c.
00166 { 00167 ST_LOGPRINTF("entry"); 00168 00169 g_return_if_fail(NULL != g_user_profile); 00170 g_assert(NULL != g_user_profile); 00171 g_assert(NULL != g_user_profile->name); 00172 g_assert(NULL != g_user_profile->email); 00173 g_assert(NULL != g_user_profile->password); 00174 g_assert(NULL != g_user_profile->redirectUrl); 00175 00176 if ( g_stored_profile != NULL 00177 && strcmp(g_user_profile->name, g_stored_profile->name ) == 0 00178 && strcmp(g_user_profile->email, g_stored_profile->email ) == 0 00179 && strcmp(g_user_profile->password, g_stored_profile->password ) == 0 00180 && strcmp(g_user_profile->redirectUrl, g_stored_profile->redirectUrl) == 0 ) 00181 { 00182 // Nothing changed, nothing to save 00183 return; 00184 } 00185 00186 prepare_registry_write(); 00187 00188 ST_STOREPRINTF("calling erRegSetUserProfile"); 00189 erRegSetUserProfile(g_user_profile); 00190 00191 erRegFreeUserProfile(g_stored_profile); 00192 g_stored_profile = user_profile_dup(g_user_profile); 00193 00194 do_registry_write(); 00195 }

| void on_user_email_changed | ( | GtkWidget * | item, | |
| const gchar * | text | |||
| ) |
Definition at line 133 of file iLiadUserData.c.
00134 { 00135 g_return_if_fail(NULL != g_user_profile); 00136 00137 if (g_user_profile->email) 00138 { 00139 g_free(g_user_profile->email); 00140 } 00141 g_user_profile->email = strdup(text); 00142 00143 // remove spaces from email 00144 char* cp; 00145 while ( (cp = strchr(g_user_profile->email, ' ')) != NULL ) 00146 { 00147 strcpy(cp, cp+1); 00148 } 00149 }
| void on_user_name_changed | ( | GtkWidget * | item, | |
| const gchar * | text | |||
| ) |
Definition at line 122 of file iLiadUserData.c.
00123 { 00124 g_return_if_fail(NULL != g_user_profile); 00125 00126 if (g_user_profile->name) 00127 { 00128 g_free(g_user_profile->name); 00129 } 00130 g_user_profile->name = strdup(text); 00131 }
| void on_user_password_changed | ( | GtkWidget * | item, | |
| const gchar * | text | |||
| ) |
Definition at line 151 of file iLiadUserData.c.
00152 { 00153 g_return_if_fail(NULL != g_user_profile); 00154 00155 if (g_user_profile->password) 00156 { 00157 g_free(g_user_profile->password); 00158 } 00159 g_user_profile->password = strdup(text); 00160 }
| static regUserProfile_t * user_profile_dup | ( | const regUserProfile_t * | profile | ) | [static] |
Definition at line 198 of file iLiadUserData.c.
00199 { 00200 regUserProfile_t* dup = NULL; 00201 00202 if (profile != NULL) 00203 { 00204 dup = g_new0(regUserProfile_t, 1); 00205 dup->name = strdup(profile->name); 00206 dup->email = strdup(profile->email); 00207 dup->password = strdup(profile->password); 00208 dup->redirectUrl = strdup(profile->redirectUrl); 00209 } 00210 00211 return dup; 00212 }
regUserProfile_t* g_stored_profile = NULL [static] |
Definition at line 43 of file iLiadUserData.c.
regUserProfile_t* g_user_profile = NULL [static] |
Definition at line 42 of file iLiadUserData.c.
1.5.6