diff options
Diffstat (limited to 'src/ui/accounts.c')
-rw-r--r-- | src/ui/accounts.c | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/src/ui/accounts.c b/src/ui/accounts.c index 261993d..e0db9e4 100644 --- a/src/ui/accounts.c +++ b/src/ui/accounts.c | |||
@@ -139,11 +139,10 @@ _iterate_accounts(void *cls, | |||
139 | 139 | ||
140 | g_object_set_qdata(G_OBJECT(row), app->quarks.data, account); | 140 | g_object_set_qdata(G_OBJECT(row), app->quarks.data, account); |
141 | 141 | ||
142 | g_object_set_qdata_full( | 142 | g_object_set_qdata( |
143 | G_OBJECT(row), | 143 | G_OBJECT(row), |
144 | app->quarks.ui, | 144 | app->quarks.ui, |
145 | entry, | 145 | entry |
146 | (GDestroyNotify) ui_account_entry_delete | ||
147 | ); | 146 | ); |
148 | 147 | ||
149 | return GNUNET_YES; | 148 | return GNUNET_YES; |
@@ -200,14 +199,11 @@ ui_accounts_dialog_init(MESSENGER_Application *app, | |||
200 | ); | 199 | ); |
201 | } | 200 | } |
202 | 201 | ||
203 | void | 202 | static void |
204 | ui_accounts_dialog_refresh(MESSENGER_Application *app, | 203 | _ui_accounts_cleanup_listbox(UI_ACCOUNTS_Handle *handle, |
205 | UI_ACCOUNTS_Handle *handle) | 204 | MESSENGER_Application *app) |
206 | { | 205 | { |
207 | g_assert((app) && (handle)); | 206 | g_assert(handle); |
208 | |||
209 | if (!(handle->accounts_listbox)) | ||
210 | return; | ||
211 | 207 | ||
212 | GList *list = gtk_container_get_children( | 208 | GList *list = gtk_container_get_children( |
213 | GTK_CONTAINER(handle->accounts_listbox) | 209 | GTK_CONTAINER(handle->accounts_listbox) |
@@ -221,6 +217,13 @@ ui_accounts_dialog_refresh(MESSENGER_Application *app, | |||
221 | if ((!row) || (!gtk_list_box_row_get_selectable(row))) | 217 | if ((!row) || (!gtk_list_box_row_get_selectable(row))) |
222 | goto skip_row; | 218 | goto skip_row; |
223 | 219 | ||
220 | UI_ACCOUNT_ENTRY_Handle *entry = g_object_get_qdata( | ||
221 | G_OBJECT(row), | ||
222 | app->quarks.ui | ||
223 | ); | ||
224 | |||
225 | ui_account_entry_delete(entry); | ||
226 | |||
224 | gtk_container_remove( | 227 | gtk_container_remove( |
225 | GTK_CONTAINER(handle->accounts_listbox), | 228 | GTK_CONTAINER(handle->accounts_listbox), |
226 | GTK_WIDGET(row) | 229 | GTK_WIDGET(row) |
@@ -232,6 +235,18 @@ ui_accounts_dialog_refresh(MESSENGER_Application *app, | |||
232 | 235 | ||
233 | if (list) | 236 | if (list) |
234 | g_list_free(list); | 237 | g_list_free(list); |
238 | } | ||
239 | |||
240 | void | ||
241 | ui_accounts_dialog_refresh(MESSENGER_Application *app, | ||
242 | UI_ACCOUNTS_Handle *handle) | ||
243 | { | ||
244 | g_assert((app) && (handle)); | ||
245 | |||
246 | if (!(handle->accounts_listbox)) | ||
247 | return; | ||
248 | |||
249 | _ui_accounts_cleanup_listbox(handle, app); | ||
235 | 250 | ||
236 | GNUNET_CHAT_iterate_accounts( | 251 | GNUNET_CHAT_iterate_accounts( |
237 | app->chat.messenger.handle, | 252 | app->chat.messenger.handle, |
@@ -241,12 +256,17 @@ ui_accounts_dialog_refresh(MESSENGER_Application *app, | |||
241 | } | 256 | } |
242 | 257 | ||
243 | void | 258 | void |
244 | ui_accounts_dialog_cleanup(UI_ACCOUNTS_Handle *handle) | 259 | ui_accounts_dialog_cleanup(UI_ACCOUNTS_Handle *handle, |
260 | MESSENGER_Application *app) | ||
245 | { | 261 | { |
246 | g_assert(handle); | 262 | g_assert((handle) && (app)); |
247 | 263 | ||
248 | if (handle->builder) | 264 | if (handle->builder) |
265 | { | ||
266 | _ui_accounts_cleanup_listbox(handle, app); | ||
267 | |||
249 | g_object_unref(handle->builder); | 268 | g_object_unref(handle->builder); |
269 | } | ||
250 | 270 | ||
251 | guint show = handle->show_queued; | 271 | guint show = handle->show_queued; |
252 | memset(handle, 0, sizeof(*handle)); | 272 | memset(handle, 0, sizeof(*handle)); |