| 51 | | purple_plugin_pref_add_choice(ppref, purple_savedstatus_get_title(statuses->data), (char *)purple_savedstatus_get_title(statuses->data)); |
| | 52 | gchar *creation_time = NULL; |
| | 53 | creation_time = g_strdup_printf("%d", purple_savedstatus_get_creation_time(statuses->data)); |
| | 54 | purple_plugin_pref_add_choice(ppref, (gchar *)purple_savedstatus_get_title(statuses->data), creation_time); |
| | 55 | /* |
| | 56 | * FIXME: memleak! how can we free this after the frame has |
| | 57 | * been destroyed? Alternatively, how could we pass a |
| | 58 | * pointer to the original creation_time inside the |
| | 59 | * PurpleSavedStatus struct? |
| | 60 | */ |
| | 61 | //g_free(creation_time); |
| | 70 | void prefs_status_deleted_cb(PurpleSavedStatus *savedstatus, gpointer data) |
| | 71 | { |
| | 72 | GList *statuses; |
| | 73 | |
| | 74 | const char *awayonlock_savedstatus = purple_prefs_get_string(AWAYONLOCK_PREF_STATUS); |
| | 75 | |
| | 76 | if(g_strcmp0(awayonlock_savedstatus, "") == 0) |
| | 77 | return; // we use the default, nevermind |
| | 78 | |
| | 79 | statuses = g_list_copy(purple_savedstatuses_get_all()); |
| | 80 | |
| | 81 | for(statuses = g_list_first(statuses); |
| | 82 | statuses; |
| | 83 | statuses = g_list_next(statuses)) { |
| | 84 | if(purple_savedstatus_get_creation_time(statuses->data) == g_ascii_strtoull(awayonlock_savedstatus,NULL,10)) { |
| | 85 | return; // found it, it wasn't deleted |
| | 86 | } |
| | 87 | } |
| | 88 | |
| | 89 | purple_debug(PURPLE_DEBUG_INFO, PACKAGE, N_("our status got deleted, clearing preference\n")); |
| | 90 | purple_prefs_set_string(AWAYONLOCK_PREF_STATUS, ""); |
| | 91 | } |
| | 92 | |