diff options
Diffstat (limited to 'src/prefs_ui.c')
| -rw-r--r-- | src/prefs_ui.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/prefs_ui.c b/src/prefs_ui.c index a3a8f74..5539f4a 100644 --- a/src/prefs_ui.c +++ b/src/prefs_ui.c | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | #include "codeconv.h" | 36 | #include "codeconv.h" |
| 37 | #include "utils.h" | 37 | #include "utils.h" |
| 38 | #include "gtkutils.h" | 38 | #include "gtkutils.h" |
| 39 | #include "masterpassword.h" | ||
| 39 | 40 | ||
| 40 | typedef enum | 41 | typedef enum |
| 41 | { | 42 | { |
| @@ -268,6 +269,44 @@ void prefs_set_data_from_entry(PrefParam *pparam) | |||
| 268 | } | 269 | } |
| 269 | } | 270 | } |
| 270 | 271 | ||
| 272 | void prefs_set_data_from_epass_entry(PrefParam *pparam) | ||
| 273 | { | ||
| 274 | #if USE_SSL | ||
| 275 | PrefsUIData *ui_data; | ||
| 276 | gchar **str; | ||
| 277 | const gchar *entry_str; | ||
| 278 | |||
| 279 | if (!master_password_active()) { | ||
| 280 | prefs_set_data_from_entry(pparam); | ||
| 281 | return; | ||
| 282 | } | ||
| 283 | |||
| 284 | ui_data = (PrefsUIData *)pparam->ui_data; | ||
| 285 | g_return_if_fail(ui_data != NULL); | ||
| 286 | g_return_if_fail(*ui_data->widget != NULL); | ||
| 287 | |||
| 288 | entry_str = gtk_entry_get_text(GTK_ENTRY(*ui_data->widget)); | ||
| 289 | |||
| 290 | switch (pparam->type) { | ||
| 291 | case P_STRING: | ||
| 292 | str = (gchar **)pparam->data; | ||
| 293 | g_free(*str); | ||
| 294 | if ((entry_str != NULL) && (!mpes_string_prefix(entry_str))) { | ||
| 295 | debug_print("Encrypting GTK password entry\n"); | ||
| 296 | *str = encrypt_with_master_password(entry_str); | ||
| 297 | } else { | ||
| 298 | *str = entry_str[0] ? g_strdup(entry_str) : NULL; | ||
| 299 | } | ||
| 300 | break; | ||
| 301 | default: | ||
| 302 | g_warning("Invalid PrefType for GtkEntry widget: %d\n", | ||
| 303 | pparam->type); | ||
| 304 | } | ||
| 305 | #else | ||
| 306 | prefs_set_data_from_entry(pparam); | ||
| 307 | #endif | ||
| 308 | } | ||
| 309 | |||
| 271 | void prefs_set_entry(PrefParam *pparam) | 310 | void prefs_set_entry(PrefParam *pparam) |
| 272 | { | 311 | { |
| 273 | PrefsUIData *ui_data; | 312 | PrefsUIData *ui_data; |
