#include <liberregxml/erregapi.h>

Go to the source code of this file.
Enumerations | |
| enum | pc_fieldtype_t { e_pcfield_profile_name = 0, e_pcfield_pcname, e_pcfield_sharename, e_pcfield_workgroup, e_pcfield_username, e_pcfield_password } |
Functions | |
| void | iLiad_pc_connect_data_init (void) |
| void | iLiad_pc_connect_data_destroy (void) |
| void | iLiad_pc_connect_data_store (void) |
| const regPCProfile_t * | iLiad_pc_connect_get_profiledata (const gint profile_index) |
| gboolean | iLiad_pc_connect_set_profile_field (gint profile_index, pc_fieldtype_t field, const char *value) |
Copyright (C) 2005-2008 iRex Technologies B.V. All rights reserved.
<File description>="">
Definition in file iLiadPCConnectData.h.
| enum pc_fieldtype_t |
| e_pcfield_profile_name | |
| e_pcfield_pcname | |
| e_pcfield_sharename | |
| e_pcfield_workgroup | |
| e_pcfield_username | |
| e_pcfield_password |
Definition at line 36 of file iLiadPCConnectData.h.
00037 { 00038 e_pcfield_profile_name = 0, 00039 e_pcfield_pcname, 00040 e_pcfield_sharename, 00041 e_pcfield_workgroup, 00042 e_pcfield_username, 00043 e_pcfield_password 00044 } pc_fieldtype_t;
| void iLiad_pc_connect_data_destroy | ( | void | ) |
Definition at line 86 of file iLiadPCConnectData.c.
00087 { 00088 ST_LOGPRINTF("entry"); 00089 00090 if (g_pc_connect_config) 00091 { 00092 erRegFreePCProfiles(g_pc_connect_config, g_pc_connect_settings); 00093 g_pc_connect_settings = NULL; 00094 g_pc_connect_config = NULL; 00095 } 00096 }

| void iLiad_pc_connect_data_init | ( | void | ) |
Definition at line 58 of file iLiadPCConnectData.c.
00059 { 00060 regPCProfile_t* setting = NULL; 00061 00062 ST_LOGPRINTF("entry"); 00063 00064 iLiad_pc_connect_data_destroy(); 00065 00066 // read all pc connect profiles from registry 00067 erRegGetPCProfiles(&g_pc_connect_config, &g_pc_connect_settings); 00068 00069 // make sure at least one profile is present 00070 if (g_pc_connect_config->size == 0) 00071 { 00072 ST_WARNPRINTF("no PC profiles, create one empty profile"); 00073 iLiad_pc_connect_add_profile(); 00074 setting = g_new0(regPCProfile_t, 1); 00075 g_assert(setting != NULL); 00076 setting->name = strdup(""); 00077 setting->pcname = strdup(""); 00078 setting->sharename = strdup(""); 00079 setting->workgroup = strdup(""); 00080 setting->username = strdup(""); 00081 setting->password = strdup(""); 00082 g_pc_connect_settings[0] = setting; 00083 } 00084 }

| void iLiad_pc_connect_data_store | ( | void | ) |
Definition at line 163 of file iLiadPCConnectData.c.
00164 { 00165 ST_LOGPRINTF("entry"); 00166 00167 if (g_pc_connect_changed == FALSE) 00168 { 00169 // nothing to save 00170 ST_LOGPRINTF("nothing to save"); 00171 return; 00172 } 00173 00174 // write our pc profiles to registry 00175 prepare_registry_write(); 00176 00177 const regPCProfile_t** p = (const regPCProfile_t**)g_pc_connect_settings; // const_cast 00178 erRegSetPCProfiles(g_pc_connect_config, p); 00179 00180 g_pc_connect_changed = FALSE; 00181 00182 do_registry_write(); 00183 }

| const regPCProfile_t* iLiad_pc_connect_get_profiledata | ( | const gint | profile_index | ) |
Definition at line 98 of file iLiadPCConnectData.c.
00099 { 00100 ST_LOGPRINTF("entry: index [%d]", profile_index); 00101 00102 g_return_val_if_fail((g_pc_connect_config != NULL), NULL); 00103 00104 if (profile_index < g_pc_connect_config->size) 00105 { 00106 return g_pc_connect_settings[profile_index]; 00107 } 00108 else 00109 { 00110 return NULL; 00111 } 00112 }
| gboolean iLiad_pc_connect_set_profile_field | ( | gint | profile_index, | |
| pc_fieldtype_t | field, | |||
| const char * | value | |||
| ) |
Definition at line 114 of file iLiadPCConnectData.c.
00115 { 00116 gchar** cpp; 00117 00118 ST_LOGPRINTF("entry: index [%d] field [%d] value [%s] size [%d]", profile_index, field, value, g_pc_connect_config->size); 00119 00120 g_return_val_if_fail((g_pc_connect_config != NULL), FALSE); 00121 g_return_val_if_fail((profile_index < g_pc_connect_config->size), FALSE); 00122 00123 if (value == NULL) 00124 { 00125 value = ""; 00126 } 00127 00128 // remember new value 00129 switch (field) 00130 { 00131 case e_pcfield_profile_name: 00132 cpp = &(g_pc_connect_settings[profile_index]->name); 00133 break; 00134 case e_pcfield_pcname: 00135 cpp = &(g_pc_connect_settings[profile_index]->pcname); 00136 break; 00137 case e_pcfield_sharename: 00138 cpp = &(g_pc_connect_settings[profile_index]->sharename); 00139 break; 00140 case e_pcfield_workgroup: 00141 cpp = &(g_pc_connect_settings[profile_index]->workgroup); 00142 break; 00143 case e_pcfield_username: 00144 cpp = &(g_pc_connect_settings[profile_index]->username); 00145 break; 00146 case e_pcfield_password: 00147 cpp = &(g_pc_connect_settings[profile_index]->password); 00148 break; 00149 default: 00150 g_assert_not_reached(); 00151 return FALSE; 00152 } 00153 if (*cpp) 00154 { 00155 g_free(*cpp); 00156 } 00157 *cpp = g_strdup(value); 00158 00159 g_pc_connect_changed = TRUE; 00160 return TRUE; 00161 }
1.5.6