aboutsummaryrefslogtreecommitdiff
path: root/src/ui/chat.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/chat.c')
-rw-r--r--src/ui/chat.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/ui/chat.c b/src/ui/chat.c
index 45d361e..72d75b0 100644
--- a/src/ui/chat.c
+++ b/src/ui/chat.c
@@ -215,6 +215,37 @@ handle_chat_selection_close_button_click(UNUSED GtkButton *button,
215} 215}
216 216
217static void 217static void
218handle_chat_selection_delete_button_click(UNUSED GtkButton *button,
219 gpointer user_data)
220{
221 UI_CHAT_Handle *handle = (UI_CHAT_Handle*) user_data;
222
223 GList *selected = gtk_list_box_get_selected_rows(handle->messages_listbox);
224 UI_MESSAGE_Handle *message;
225
226 while (selected)
227 {
228 GtkListBoxRow *row = GTK_LIST_BOX_ROW(selected->data);
229
230 if (!row)
231 goto skip_row;
232
233 message = g_hash_table_lookup(handle->bindings, row);
234
235 if ((!message) || (!(message->msg)))
236 goto skip_row;
237
238 GNUNET_CHAT_message_delete(
239 message->msg,
240 GNUNET_TIME_relative_get_zero_()
241 );
242
243 skip_row:
244 selected = selected->next;
245 }
246}
247
248static void
218handle_attach_file_button_click(GtkButton *button, 249handle_attach_file_button_click(GtkButton *button,
219 gpointer user_data) 250 gpointer user_data)
220{ 251{
@@ -362,6 +393,8 @@ ui_chat_new(MESSENGER_Application *app)
362 UI_CHAT_Handle *handle = g_malloc(sizeof(UI_CHAT_Handle)); 393 UI_CHAT_Handle *handle = g_malloc(sizeof(UI_CHAT_Handle));
363 UI_MESSENGER_Handle *messenger = &(app->ui.messenger); 394 UI_MESSENGER_Handle *messenger = &(app->ui.messenger);
364 395
396 handle->bindings = app->ui.bindings;
397
365 handle->messages = NULL; 398 handle->messages = NULL;
366 handle->edge_value = 0; 399 handle->edge_value = 0;
367 400
@@ -524,6 +557,13 @@ ui_chat_new(MESSENGER_Application *app)
524 ); 557 );
525 558
526 g_signal_connect( 559 g_signal_connect(
560 handle->selection_delete_button,
561 "clicked",
562 G_CALLBACK(handle_chat_selection_delete_button_click),
563 handle
564 );
565
566 g_signal_connect(
527 handle->messages_listbox, 567 handle->messages_listbox,
528 "size-allocate", 568 "size-allocate",
529 G_CALLBACK(handle_chat_messages_listbox_size_allocate), 569 G_CALLBACK(handle_chat_messages_listbox_size_allocate),