aboutsummaryrefslogtreecommitdiff
path: root/src/event.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/event.c')
-rw-r--r--src/event.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/src/event.c b/src/event.c
index 8cfdaa7..59c47d6 100644
--- a/src/event.c
+++ b/src/event.c
@@ -26,8 +26,9 @@
26 26
27#include "contact.h" 27#include "contact.h"
28#include "file.h" 28#include "file.h"
29#include "ui/account_entry.h" 29#include "ui.h"
30 30
31#include "ui/account_entry.h"
31#include "ui/chat_entry.h" 32#include "ui/chat_entry.h"
32#include "ui/contact_entry.h" 33#include "ui/contact_entry.h"
33#include "ui/message.h" 34#include "ui/message.h"
@@ -50,9 +51,9 @@ static void
50_show_notification(MESSENGER_Application *app, 51_show_notification(MESSENGER_Application *app,
51 UNUSED struct GNUNET_CHAT_Context *context, 52 UNUSED struct GNUNET_CHAT_Context *context,
52 const struct GNUNET_CHAT_Contact *contact, 53 const struct GNUNET_CHAT_Contact *contact,
53 const gchar *text, 54 const char *text,
54 const gchar *icon, 55 const char *icon,
55 const gchar *category) 56 const char *category)
56{ 57{
57 if (app->settings.disable_notifications) 58 if (app->settings.disable_notifications)
58 return; 59 return;
@@ -85,13 +86,13 @@ event_handle_warning(MESSENGER_Application *app,
85 struct GNUNET_CHAT_Context *context, 86 struct GNUNET_CHAT_Context *context,
86 const struct GNUNET_CHAT_Message *msg) 87 const struct GNUNET_CHAT_Message *msg)
87{ 88{
88 const gchar *text = GNUNET_CHAT_message_get_text(msg); 89 const char *text = GNUNET_CHAT_message_get_text(msg);
89 90
90 const struct GNUNET_CHAT_Contact *contact = GNUNET_CHAT_message_get_sender( 91 const struct GNUNET_CHAT_Contact *contact = GNUNET_CHAT_message_get_sender(
91 msg 92 msg
92 ); 93 );
93 94
94 fprintf(stderr, "ERROR: %s\n", text); 95 g_printerr("ERROR: %s\n", text);
95 96
96 _show_notification( 97 _show_notification(
97 app, 98 app,
@@ -141,7 +142,7 @@ _select_chat_to_activate(gpointer user_data)
141{ 142{
142 UI_CHAT_ENTRY_Handle *entry = (UI_CHAT_ENTRY_Handle*) user_data; 143 UI_CHAT_ENTRY_Handle *entry = (UI_CHAT_ENTRY_Handle*) user_data;
143 144
144 if (!(entry->chat)) 145 if ((!entry) || (!(entry->chat)) || (!(entry->entry_box)))
145 return FALSE; 146 return FALSE;
146 147
147 MESSENGER_Application *app = entry->chat->app; 148 MESSENGER_Application *app = entry->chat->app;
@@ -149,12 +150,15 @@ _select_chat_to_activate(gpointer user_data)
149 if (!app) 150 if (!app)
150 return FALSE; 151 return FALSE;
151 152
152 UI_MESSENGER_Handle *ui = &(app->ui.messenger);
153
154 GtkListBoxRow *row = GTK_LIST_BOX_ROW( 153 GtkListBoxRow *row = GTK_LIST_BOX_ROW(
155 gtk_widget_get_parent(entry->entry_box) 154 gtk_widget_get_parent(entry->entry_box)
156 ); 155 );
157 156
157 if (!row)
158 return FALSE;
159
160 UI_MESSENGER_Handle *ui = &(app->ui.messenger);
161
158 gtk_list_box_select_row(ui->chats_listbox, row); 162 gtk_list_box_select_row(ui->chats_listbox, row);
159 gtk_list_box_invalidate_filter(ui->chats_listbox); 163 gtk_list_box_invalidate_filter(ui->chats_listbox);
160 164
@@ -224,9 +228,7 @@ _add_new_chat_entry(MESSENGER_Application *app,
224 228
225 ui->chat_entries = g_list_append(ui->chat_entries, entry); 229 ui->chat_entries = g_list_append(ui->chat_entries, entry);
226 230
227 GtkListBoxRow *row = GTK_LIST_BOX_ROW( 231 GtkWidget *row = gtk_widget_get_parent(entry->entry_box);
228 gtk_widget_get_parent(entry->entry_box)
229 );
230 232
231 g_object_set_qdata( 233 g_object_set_qdata(
232 G_OBJECT(row), 234 G_OBJECT(row),
@@ -305,16 +307,12 @@ event_update_profile(MESSENGER_Application *app)
305 307
306 const char *name = GNUNET_CHAT_get_name(chat->handle); 308 const char *name = GNUNET_CHAT_get_name(chat->handle);
307 309
308 if (name) 310 ui_avatar_set_text(ui->profile_avatar, name);
309 { 311 ui_label_set_text(ui->profile_label, name);
310 hdy_avatar_set_text(ui->profile_avatar, name);
311 gtk_label_set_text(ui->profile_label, name);
312 }
313 312
314 const char *key = GNUNET_CHAT_get_key(chat->handle); 313 const char *key = GNUNET_CHAT_get_key(chat->handle);
315 314
316 if (key) 315 ui_label_set_text(ui->profile_key_label, key);
317 gtk_label_set_text(ui->profile_key_label, key);
318 316
319 gtk_container_foreach( 317 gtk_container_foreach(
320 GTK_CONTAINER(ui->chats_listbox), 318 GTK_CONTAINER(ui->chats_listbox),
@@ -430,7 +428,7 @@ event_presence_contact(MESSENGER_Application *app,
430 contact_add_name_avatar_to_info(contact, message->sender_avatar); 428 contact_add_name_avatar_to_info(contact, message->sender_avatar);
431 contact_add_name_label_to_info(contact, message->sender_label); 429 contact_add_name_label_to_info(contact, message->sender_label);
432 430
433 const gchar *presence_message = ( 431 const char *text = (
434 GNUNET_CHAT_KIND_JOIN == kind? _("joined the chat") : _("left the chat") 432 GNUNET_CHAT_KIND_JOIN == kind? _("joined the chat") : _("left the chat")
435 ); 433 );
436 434
@@ -439,7 +437,7 @@ event_presence_contact(MESSENGER_Application *app,
439 app, 437 app,
440 context, 438 context,
441 contact, 439 contact,
442 presence_message, 440 text,
443 "avatar-default-symbolic", 441 "avatar-default-symbolic",
444 "presence.online" 442 "presence.online"
445 ); 443 );
@@ -448,10 +446,10 @@ event_presence_contact(MESSENGER_Application *app,
448 msg 446 msg
449 ); 447 );
450 448
451 const gchar *time = GNUNET_STRINGS_absolute_time_to_string(timestamp); 449 const char *time = GNUNET_STRINGS_absolute_time_to_string(timestamp);
452 450
453 gtk_label_set_text(message->text_label, presence_message); 451 ui_label_set_text(message->text_label, text);
454 gtk_label_set_text(message->timestamp_label, time? time : ""); 452 ui_label_set_text(message->timestamp_label, time);
455 453
456 ui_chat_add_message(handle->chat, app, message); 454 ui_chat_add_message(handle->chat, app, message);
457 455
@@ -531,7 +529,7 @@ event_invitation(MESSENGER_Application *app,
531 contact_add_name_avatar_to_info(contact, message->sender_avatar); 529 contact_add_name_avatar_to_info(contact, message->sender_avatar);
532 contact_add_name_label_to_info(contact, message->sender_label); 530 contact_add_name_label_to_info(contact, message->sender_label);
533 531
534 const gchar *invite_message = _("invited you to a chat"); 532 const char *invite_message = _("invited you to a chat");
535 533
536 if (!ui_messenger_is_context_active(&(app->ui.messenger), context)) 534 if (!ui_messenger_is_context_active(&(app->ui.messenger), context))
537 _show_notification( 535 _show_notification(
@@ -543,7 +541,7 @@ event_invitation(MESSENGER_Application *app,
543 "im.received" 541 "im.received"
544 ); 542 );
545 543
546 gtk_label_set_text(message->text_label, invite_message); 544 ui_label_set_text(message->text_label, invite_message);
547 545
548 g_signal_connect( 546 g_signal_connect(
549 message->accept_button, 547 message->accept_button,
@@ -632,7 +630,7 @@ event_receive_message(MESSENGER_Application *app,
632 msg 630 msg
633 ); 631 );
634 632
635 const gchar *time = GNUNET_STRINGS_absolute_time_to_string(timestamp); 633 const char *time = GNUNET_STRINGS_absolute_time_to_string(timestamp);
636 634
637 if ((!ui_messenger_is_context_active(&(app->ui.messenger), context)) && 635 if ((!ui_messenger_is_context_active(&(app->ui.messenger), context)) &&
638 (GNUNET_YES != sent)) 636 (GNUNET_YES != sent))
@@ -645,8 +643,8 @@ event_receive_message(MESSENGER_Application *app,
645 "im.received" 643 "im.received"
646 ); 644 );
647 645
648 gtk_label_set_text(message->text_label, text? text : ""); 646 ui_label_set_text(message->text_label, text);
649 gtk_label_set_text(message->timestamp_label, time? time : ""); 647 ui_label_set_text(message->timestamp_label, time);
650 648
651 ui_chat_add_message(handle->chat, app, message); 649 ui_chat_add_message(handle->chat, app, message);
652 650