diff options
Diffstat (limited to 'src/ui/accounts.c')
-rw-r--r-- | src/ui/accounts.c | 51 |
1 files changed, 18 insertions, 33 deletions
diff --git a/src/ui/accounts.c b/src/ui/accounts.c index 0741654..969c23d 100644 --- a/src/ui/accounts.c +++ b/src/ui/accounts.c | |||
@@ -72,7 +72,7 @@ handle_accounts_listbox_row_activated(UNUSED GtkListBox* listbox, | |||
72 | } | 72 | } |
73 | 73 | ||
74 | struct GNUNET_CHAT_Account *account = (struct GNUNET_CHAT_Account*) ( | 74 | struct GNUNET_CHAT_Account *account = (struct GNUNET_CHAT_Account*) ( |
75 | bindings_get(app->bindings, row) | 75 | g_object_get_qdata(G_OBJECT(row), app->quarks.data) |
76 | ); | 76 | ); |
77 | 77 | ||
78 | if (!account) | 78 | if (!account) |
@@ -119,8 +119,14 @@ _iterate_accounts(void *cls, | |||
119 | gtk_widget_get_parent(entry->entry_box) | 119 | gtk_widget_get_parent(entry->entry_box) |
120 | ); | 120 | ); |
121 | 121 | ||
122 | bindings_put(app->bindings, row, account); | 122 | g_object_set_qdata(G_OBJECT(row), app->quarks.data, account); |
123 | bindings_put(app->ui.accounts.bindings, row, entry); | 123 | |
124 | g_object_set_qdata_full( | ||
125 | G_OBJECT(row), | ||
126 | app->quarks.ui, | ||
127 | entry, | ||
128 | (GDestroyNotify) ui_account_entry_delete | ||
129 | ); | ||
124 | 130 | ||
125 | return GNUNET_YES; | 131 | return GNUNET_YES; |
126 | } | 132 | } |
@@ -129,7 +135,6 @@ void | |||
129 | ui_accounts_dialog_init(MESSENGER_Application *app, | 135 | ui_accounts_dialog_init(MESSENGER_Application *app, |
130 | UI_ACCOUNTS_Handle *handle) | 136 | UI_ACCOUNTS_Handle *handle) |
131 | { | 137 | { |
132 | handle->bindings = bindings_create(); | ||
133 | handle->show_queued = 0; | 138 | handle->show_queued = 0; |
134 | 139 | ||
135 | handle->builder = gtk_builder_new_from_resource( | 140 | handle->builder = gtk_builder_new_from_resource( |
@@ -175,10 +180,13 @@ ui_accounts_dialog_init(MESSENGER_Application *app, | |||
175 | ); | 180 | ); |
176 | } | 181 | } |
177 | 182 | ||
178 | static void | 183 | void |
179 | _clear_accounts_listbox_rows(UI_ACCOUNTS_Handle *handle, | 184 | ui_accounts_dialog_refresh(MESSENGER_Application *app, |
180 | gboolean bindings_only) | 185 | UI_ACCOUNTS_Handle *handle) |
181 | { | 186 | { |
187 | if (!(handle->accounts_listbox)) | ||
188 | return; | ||
189 | |||
182 | GList *list = gtk_container_get_children( | 190 | GList *list = gtk_container_get_children( |
183 | GTK_CONTAINER(handle->accounts_listbox) | 191 | GTK_CONTAINER(handle->accounts_listbox) |
184 | ); | 192 | ); |
@@ -190,32 +198,14 @@ _clear_accounts_listbox_rows(UI_ACCOUNTS_Handle *handle, | |||
190 | if ((!row) || (!gtk_list_box_row_get_selectable(row))) | 198 | if ((!row) || (!gtk_list_box_row_get_selectable(row))) |
191 | goto skip_row; | 199 | goto skip_row; |
192 | 200 | ||
193 | if (!bindings_only) | 201 | gtk_container_remove( |
194 | gtk_container_remove( | 202 | GTK_CONTAINER(handle->accounts_listbox), |
195 | GTK_CONTAINER(handle->accounts_listbox), | 203 | GTK_WIDGET(row) |
196 | GTK_WIDGET(row) | ||
197 | ); | ||
198 | |||
199 | bindings_remove( | ||
200 | handle->bindings, | ||
201 | row, | ||
202 | NULL, | ||
203 | (GDestroyNotify) ui_account_entry_delete | ||
204 | ); | 204 | ); |
205 | 205 | ||
206 | skip_row: | 206 | skip_row: |
207 | list = list->next; | 207 | list = list->next; |
208 | } | 208 | } |
209 | } | ||
210 | |||
211 | void | ||
212 | ui_accounts_dialog_refresh(MESSENGER_Application *app, | ||
213 | UI_ACCOUNTS_Handle *handle) | ||
214 | { | ||
215 | if (!(handle->accounts_listbox)) | ||
216 | return; | ||
217 | |||
218 | _clear_accounts_listbox_rows(handle, FALSE); | ||
219 | 209 | ||
220 | GNUNET_CHAT_iterate_accounts( | 210 | GNUNET_CHAT_iterate_accounts( |
221 | app->chat.messenger.handle, | 211 | app->chat.messenger.handle, |
@@ -227,12 +217,7 @@ ui_accounts_dialog_refresh(MESSENGER_Application *app, | |||
227 | void | 217 | void |
228 | ui_accounts_dialog_cleanup(UI_ACCOUNTS_Handle *handle) | 218 | ui_accounts_dialog_cleanup(UI_ACCOUNTS_Handle *handle) |
229 | { | 219 | { |
230 | _clear_accounts_listbox_rows(handle, TRUE); | ||
231 | |||
232 | g_object_unref(handle->builder); | 220 | g_object_unref(handle->builder); |
233 | 221 | ||
234 | bindings_destroy(handle->bindings); | ||
235 | handle->bindings = NULL; | ||
236 | |||
237 | handle->accounts_listbox = NULL; | 222 | handle->accounts_listbox = NULL; |
238 | } | 223 | } |