diff options
Diffstat (limited to 'src/ui/chat.c')
-rw-r--r-- | src/ui/chat.c | 50 |
1 files changed, 39 insertions, 11 deletions
diff --git a/src/ui/chat.c b/src/ui/chat.c index 72d75b0..4fe4735 100644 --- a/src/ui/chat.c +++ b/src/ui/chat.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "../application.h" | 33 | #include "../application.h" |
34 | #include "../contact.h" | 34 | #include "../contact.h" |
35 | #include "account_entry.h" | 35 | #include "account_entry.h" |
36 | #include "delete_messages.h" | ||
36 | 37 | ||
37 | static gboolean | 38 | static gboolean |
38 | _flap_reveal_switch(gpointer user_data) | 39 | _flap_reveal_switch(gpointer user_data) |
@@ -214,13 +215,11 @@ handle_chat_selection_close_button_click(UNUSED GtkButton *button, | |||
214 | gtk_list_box_unselect_all(listbox); | 215 | gtk_list_box_unselect_all(listbox); |
215 | } | 216 | } |
216 | 217 | ||
217 | static void | 218 | void |
218 | handle_chat_selection_delete_button_click(UNUSED GtkButton *button, | 219 | _delete_messages_callback(GHashTable *bindings, |
219 | gpointer user_data) | 220 | GList *selected, |
221 | gulong delay) | ||
220 | { | 222 | { |
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; | 223 | UI_MESSAGE_Handle *message; |
225 | 224 | ||
226 | while (selected) | 225 | while (selected) |
@@ -230,14 +229,17 @@ handle_chat_selection_delete_button_click(UNUSED GtkButton *button, | |||
230 | if (!row) | 229 | if (!row) |
231 | goto skip_row; | 230 | goto skip_row; |
232 | 231 | ||
233 | message = g_hash_table_lookup(handle->bindings, row); | 232 | message = g_hash_table_lookup(bindings, row); |
234 | 233 | ||
235 | if ((!message) || (!(message->msg))) | 234 | if ((!message) || (!(message->msg))) |
236 | goto skip_row; | 235 | goto skip_row; |
237 | 236 | ||
238 | GNUNET_CHAT_message_delete( | 237 | GNUNET_CHAT_message_delete( |
239 | message->msg, | 238 | message->msg, |
240 | GNUNET_TIME_relative_get_zero_() | 239 | GNUNET_TIME_relative_multiply( |
240 | GNUNET_TIME_relative_get_second_(), | ||
241 | delay | ||
242 | ) | ||
241 | ); | 243 | ); |
242 | 244 | ||
243 | skip_row: | 245 | skip_row: |
@@ -246,6 +248,32 @@ handle_chat_selection_delete_button_click(UNUSED GtkButton *button, | |||
246 | } | 248 | } |
247 | 249 | ||
248 | static void | 250 | static void |
251 | handle_chat_selection_delete_button_click(UNUSED GtkButton *button, | ||
252 | gpointer user_data) | ||
253 | { | ||
254 | UI_CHAT_Handle *handle = (UI_CHAT_Handle*) user_data; | ||
255 | |||
256 | MESSENGER_Application *app = handle->app; | ||
257 | |||
258 | GList *selected = gtk_list_box_get_selected_rows(handle->messages_listbox); | ||
259 | |||
260 | if (app->settings.hide_delete_dialog) | ||
261 | _delete_messages_callback(app->ui.bindings, selected, 0); | ||
262 | else | ||
263 | { | ||
264 | ui_delete_messages_dialog_init(app, &(app->ui.delete_messages)); | ||
265 | |||
266 | ui_delete_messages_dialog_link( | ||
267 | &(app->ui.delete_messages), | ||
268 | _delete_messages_callback, | ||
269 | selected | ||
270 | ); | ||
271 | |||
272 | gtk_widget_show(GTK_WIDGET(app->ui.delete_messages.dialog)); | ||
273 | } | ||
274 | } | ||
275 | |||
276 | static void | ||
249 | handle_attach_file_button_click(GtkButton *button, | 277 | handle_attach_file_button_click(GtkButton *button, |
250 | gpointer user_data) | 278 | gpointer user_data) |
251 | { | 279 | { |
@@ -366,7 +394,7 @@ handle_send_text_key_press (GtkWidget *widget, | |||
366 | { | 394 | { |
367 | MESSENGER_Application *app = (MESSENGER_Application*) user_data; | 395 | MESSENGER_Application *app = (MESSENGER_Application*) user_data; |
368 | 396 | ||
369 | if ((app->ui.mobile) || | 397 | if ((app->settings.mobile_design) || |
370 | (event->state & GDK_SHIFT_MASK) || | 398 | (event->state & GDK_SHIFT_MASK) || |
371 | ((event->keyval != GDK_KEY_Return) && | 399 | ((event->keyval != GDK_KEY_Return) && |
372 | (event->keyval != GDK_KEY_KP_Enter))) | 400 | (event->keyval != GDK_KEY_KP_Enter))) |
@@ -393,7 +421,7 @@ ui_chat_new(MESSENGER_Application *app) | |||
393 | UI_CHAT_Handle *handle = g_malloc(sizeof(UI_CHAT_Handle)); | 421 | UI_CHAT_Handle *handle = g_malloc(sizeof(UI_CHAT_Handle)); |
394 | UI_MESSENGER_Handle *messenger = &(app->ui.messenger); | 422 | UI_MESSENGER_Handle *messenger = &(app->ui.messenger); |
395 | 423 | ||
396 | handle->bindings = app->ui.bindings; | 424 | handle->app = app; |
397 | 425 | ||
398 | handle->messages = NULL; | 426 | handle->messages = NULL; |
399 | handle->edge_value = 0; | 427 | handle->edge_value = 0; |