diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2022-03-15 19:19:30 +0100 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2022-03-15 19:19:30 +0100 |
commit | 275ac387f9248f2095297cec465fc2c0c90da2d8 (patch) | |
tree | f5101c135306607359c46395bc91b74bd7dd425e | |
parent | 5e1a9a66817f14e2d39962b3ebcee7752925aa95 (diff) | |
download | messenger-gtk-275ac387f9248f2095297cec465fc2c0c90da2d8.tar.gz messenger-gtk-275ac387f9248f2095297cec465fc2c0c90da2d8.zip |
Added button to leave the chat
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r-- | resources/ui/chat.ui | 211 | ||||
-rw-r--r-- | src/event.c | 35 | ||||
-rw-r--r-- | src/ui/chat.c | 112 | ||||
-rw-r--r-- | src/ui/chat.h | 10 | ||||
-rw-r--r-- | src/ui/chat_entry.c | 36 | ||||
-rw-r--r-- | src/ui/chat_entry.h | 6 |
6 files changed, 330 insertions, 80 deletions
diff --git a/resources/ui/chat.ui b/resources/ui/chat.ui index 334fc81..3c55320 100644 --- a/resources/ui/chat.ui +++ b/resources/ui/chat.ui | |||
@@ -607,6 +607,170 @@ Author: Tobias Frisch | |||
607 | <property name="visible">True</property> | 607 | <property name="visible">True</property> |
608 | <property name="can-focus">False</property> | 608 | <property name="can-focus">False</property> |
609 | <property name="orientation">vertical</property> | 609 | <property name="orientation">vertical</property> |
610 | <property name="spacing">4</property> | ||
611 | <child> | ||
612 | <object class="HdyAvatar" id="chat_details_avatar"> | ||
613 | <property name="visible">True</property> | ||
614 | <property name="can-focus">False</property> | ||
615 | <property name="margin-top">8</property> | ||
616 | <property name="margin-bottom">8</property> | ||
617 | <property name="size">128</property> | ||
618 | </object> | ||
619 | <packing> | ||
620 | <property name="expand">False</property> | ||
621 | <property name="fill">True</property> | ||
622 | <property name="position">0</property> | ||
623 | </packing> | ||
624 | </child> | ||
625 | <child> | ||
626 | <object class="GtkBox"> | ||
627 | <property name="visible">True</property> | ||
628 | <property name="can-focus">False</property> | ||
629 | <property name="orientation">vertical</property> | ||
630 | <child> | ||
631 | <object class="GtkButton" id="reveal_identity_button"> | ||
632 | <property name="visible">True</property> | ||
633 | <property name="can-focus">True</property> | ||
634 | <property name="receives-default">True</property> | ||
635 | <property name="relief">none</property> | ||
636 | <child> | ||
637 | <object class="GtkBox"> | ||
638 | <property name="visible">True</property> | ||
639 | <property name="can-focus">False</property> | ||
640 | <property name="border-width">4</property> | ||
641 | <property name="spacing">16</property> | ||
642 | <child> | ||
643 | <object class="GtkImage"> | ||
644 | <property name="visible">True</property> | ||
645 | <property name="can-focus">False</property> | ||
646 | <property name="icon-name">user-info-symbolic</property> | ||
647 | <property name="icon_size">3</property> | ||
648 | </object> | ||
649 | <packing> | ||
650 | <property name="expand">False</property> | ||
651 | <property name="fill">True</property> | ||
652 | <property name="position">0</property> | ||
653 | </packing> | ||
654 | </child> | ||
655 | <child> | ||
656 | <object class="GtkLabel"> | ||
657 | <property name="visible">True</property> | ||
658 | <property name="can-focus">False</property> | ||
659 | <property name="label" translatable="yes">Reveal Identity</property> | ||
660 | </object> | ||
661 | <packing> | ||
662 | <property name="expand">False</property> | ||
663 | <property name="fill">True</property> | ||
664 | <property name="position">1</property> | ||
665 | </packing> | ||
666 | </child> | ||
667 | </object> | ||
668 | </child> | ||
669 | </object> | ||
670 | <packing> | ||
671 | <property name="expand">False</property> | ||
672 | <property name="fill">True</property> | ||
673 | <property name="position">0</property> | ||
674 | </packing> | ||
675 | </child> | ||
676 | <child> | ||
677 | <object class="GtkButton" id="leave_chat_button"> | ||
678 | <property name="visible">True</property> | ||
679 | <property name="can-focus">True</property> | ||
680 | <property name="receives-default">True</property> | ||
681 | <property name="relief">none</property> | ||
682 | <child> | ||
683 | <object class="GtkBox"> | ||
684 | <property name="visible">True</property> | ||
685 | <property name="can-focus">False</property> | ||
686 | <property name="border-width">4</property> | ||
687 | <property name="spacing">16</property> | ||
688 | <child> | ||
689 | <object class="GtkImage"> | ||
690 | <property name="visible">True</property> | ||
691 | <property name="can-focus">False</property> | ||
692 | <property name="icon-name">system-log-out-symbolic</property> | ||
693 | <property name="icon_size">3</property> | ||
694 | </object> | ||
695 | <packing> | ||
696 | <property name="expand">False</property> | ||
697 | <property name="fill">True</property> | ||
698 | <property name="position">0</property> | ||
699 | </packing> | ||
700 | </child> | ||
701 | <child> | ||
702 | <object class="GtkLabel"> | ||
703 | <property name="visible">True</property> | ||
704 | <property name="can-focus">False</property> | ||
705 | <property name="label" translatable="yes">Leave Chat</property> | ||
706 | <property name="xalign">0</property> | ||
707 | </object> | ||
708 | <packing> | ||
709 | <property name="expand">False</property> | ||
710 | <property name="fill">True</property> | ||
711 | <property name="position">1</property> | ||
712 | </packing> | ||
713 | </child> | ||
714 | </object> | ||
715 | </child> | ||
716 | <style> | ||
717 | <class name="delete-button"/> | ||
718 | </style> | ||
719 | </object> | ||
720 | <packing> | ||
721 | <property name="expand">False</property> | ||
722 | <property name="fill">True</property> | ||
723 | <property name="position">1</property> | ||
724 | </packing> | ||
725 | </child> | ||
726 | <style> | ||
727 | <class name="details-group"/> | ||
728 | </style> | ||
729 | </object> | ||
730 | <packing> | ||
731 | <property name="expand">False</property> | ||
732 | <property name="fill">True</property> | ||
733 | <property name="position">1</property> | ||
734 | </packing> | ||
735 | </child> | ||
736 | <child> | ||
737 | <object class="GtkBox"> | ||
738 | <property name="visible">True</property> | ||
739 | <property name="can-focus">False</property> | ||
740 | <child> | ||
741 | <object class="GtkLabel"> | ||
742 | <property name="visible">True</property> | ||
743 | <property name="can-focus">False</property> | ||
744 | <property name="label" translatable="yes">Notifications</property> | ||
745 | </object> | ||
746 | <packing> | ||
747 | <property name="expand">False</property> | ||
748 | <property name="fill">True</property> | ||
749 | <property name="position">0</property> | ||
750 | </packing> | ||
751 | </child> | ||
752 | <child> | ||
753 | <object class="GtkSwitch" id="chat_notifications_switch"> | ||
754 | <property name="visible">True</property> | ||
755 | <property name="can-focus">True</property> | ||
756 | </object> | ||
757 | <packing> | ||
758 | <property name="expand">False</property> | ||
759 | <property name="fill">True</property> | ||
760 | <property name="pack-type">end</property> | ||
761 | <property name="position">1</property> | ||
762 | </packing> | ||
763 | </child> | ||
764 | <style> | ||
765 | <class name="details-entry"/> | ||
766 | </style> | ||
767 | </object> | ||
768 | <packing> | ||
769 | <property name="expand">False</property> | ||
770 | <property name="fill">True</property> | ||
771 | <property name="position">2</property> | ||
772 | </packing> | ||
773 | </child> | ||
610 | <child> | 774 | <child> |
611 | <object class="GtkBox" id="chat_details_contacts_box"> | 775 | <object class="GtkBox" id="chat_details_contacts_box"> |
612 | <property name="visible">True</property> | 776 | <property name="visible">True</property> |
@@ -694,50 +858,11 @@ Author: Tobias Frisch | |||
694 | <packing> | 858 | <packing> |
695 | <property name="expand">False</property> | 859 | <property name="expand">False</property> |
696 | <property name="fill">True</property> | 860 | <property name="fill">True</property> |
697 | <property name="position">0</property> | 861 | <property name="position">3</property> |
698 | </packing> | ||
699 | </child> | ||
700 | <child> | ||
701 | <object class="GtkBox"> | ||
702 | <property name="visible">True</property> | ||
703 | <property name="can-focus">False</property> | ||
704 | <child> | ||
705 | <object class="GtkLabel"> | ||
706 | <property name="visible">True</property> | ||
707 | <property name="can-focus">False</property> | ||
708 | <property name="label" translatable="yes">Notifications</property> | ||
709 | </object> | ||
710 | <packing> | ||
711 | <property name="expand">False</property> | ||
712 | <property name="fill">True</property> | ||
713 | <property name="position">0</property> | ||
714 | </packing> | ||
715 | </child> | ||
716 | <child> | ||
717 | <object class="GtkSwitch"> | ||
718 | <property name="visible">True</property> | ||
719 | <property name="can-focus">True</property> | ||
720 | </object> | ||
721 | <packing> | ||
722 | <property name="expand">False</property> | ||
723 | <property name="fill">True</property> | ||
724 | <property name="pack-type">end</property> | ||
725 | <property name="position">1</property> | ||
726 | </packing> | ||
727 | </child> | ||
728 | <style> | ||
729 | <class name="details-entry"/> | ||
730 | </style> | ||
731 | </object> | ||
732 | <packing> | ||
733 | <property name="expand">False</property> | ||
734 | <property name="fill">True</property> | ||
735 | <property name="position">1</property> | ||
736 | </packing> | 862 | </packing> |
737 | </child> | 863 | </child> |
738 | <child> | 864 | <child> |
739 | <object class="GtkBox"> | 865 | <object class="GtkBox" id="chat_details_files_box"> |
740 | <property name="visible">True</property> | ||
741 | <property name="can-focus">False</property> | 866 | <property name="can-focus">False</property> |
742 | <property name="orientation">vertical</property> | 867 | <property name="orientation">vertical</property> |
743 | <child> | 868 | <child> |
@@ -776,9 +901,9 @@ Author: Tobias Frisch | |||
776 | </style> | 901 | </style> |
777 | </object> | 902 | </object> |
778 | <packing> | 903 | <packing> |
779 | <property name="expand">False</property> | 904 | <property name="expand">True</property> |
780 | <property name="fill">True</property> | 905 | <property name="fill">True</property> |
781 | <property name="position">2</property> | 906 | <property name="position">5</property> |
782 | </packing> | 907 | </packing> |
783 | </child> | 908 | </child> |
784 | </object> | 909 | </object> |
diff --git a/src/event.c b/src/event.c index 5330e5b..486d724 100644 --- a/src/event.c +++ b/src/event.c | |||
@@ -284,8 +284,6 @@ _clear_chat_entry(GtkWidget *widget, | |||
284 | gpointer user_data) | 284 | gpointer user_data) |
285 | { | 285 | { |
286 | MESSENGER_Application *app = (MESSENGER_Application*) user_data; | 286 | MESSENGER_Application *app = (MESSENGER_Application*) user_data; |
287 | |||
288 | UI_MESSENGER_Handle *ui = &(app->ui.messenger); | ||
289 | GtkListBoxRow *row = GTK_LIST_BOX_ROW(widget); | 287 | GtkListBoxRow *row = GTK_LIST_BOX_ROW(widget); |
290 | 288 | ||
291 | if (!gtk_list_box_row_get_selectable(row)) | 289 | if (!gtk_list_box_row_get_selectable(row)) |
@@ -296,29 +294,7 @@ _clear_chat_entry(GtkWidget *widget, | |||
296 | app->quarks.ui | 294 | app->quarks.ui |
297 | ); | 295 | ); |
298 | 296 | ||
299 | ui->chat_entries = g_list_remove(ui->chat_entries, entry); | 297 | ui_chat_entry_dispose(entry, app); |
300 | |||
301 | gtk_container_remove( | ||
302 | GTK_CONTAINER(ui->chats_listbox), | ||
303 | widget | ||
304 | ); | ||
305 | |||
306 | struct GNUNET_CHAT_Context *context = (struct GNUNET_CHAT_Context*) ( | ||
307 | g_object_get_qdata( | ||
308 | G_OBJECT(entry->chat->send_text_view), | ||
309 | app->quarks.data | ||
310 | ) | ||
311 | ); | ||
312 | |||
313 | if (context) | ||
314 | GNUNET_CHAT_context_set_user_pointer(context, NULL); | ||
315 | |||
316 | gtk_container_remove( | ||
317 | GTK_CONTAINER(ui->chats_stack), | ||
318 | entry->chat->chat_box | ||
319 | ); | ||
320 | |||
321 | ui_chat_entry_delete(entry); | ||
322 | } | 298 | } |
323 | 299 | ||
324 | void | 300 | void |
@@ -375,8 +351,7 @@ event_update_chats(MESSENGER_Application *app, | |||
375 | } | 351 | } |
376 | 352 | ||
377 | static void | 353 | static void |
378 | _update_contact_context(MESSENGER_Application *app, | 354 | _update_contact_context(struct GNUNET_CHAT_Contact *contact) |
379 | struct GNUNET_CHAT_Contact *contact) | ||
380 | { | 355 | { |
381 | struct GNUNET_CHAT_Context *context = GNUNET_CHAT_contact_get_context( | 356 | struct GNUNET_CHAT_Context *context = GNUNET_CHAT_contact_get_context( |
382 | contact | 357 | contact |
@@ -425,7 +400,7 @@ event_presence_contact(MESSENGER_Application *app, | |||
425 | ui_message_update(message, app, msg); | 400 | ui_message_update(message, app, msg); |
426 | 401 | ||
427 | contact_create_info(contact); | 402 | contact_create_info(contact); |
428 | _update_contact_context(app, contact); | 403 | _update_contact_context(contact); |
429 | 404 | ||
430 | contact_add_name_avatar_to_info(contact, message->sender_avatar); | 405 | contact_add_name_avatar_to_info(contact, message->sender_avatar); |
431 | contact_add_name_label_to_info(contact, message->sender_label); | 406 | contact_add_name_label_to_info(contact, message->sender_label); |
@@ -461,7 +436,7 @@ event_presence_contact(MESSENGER_Application *app, | |||
461 | } | 436 | } |
462 | 437 | ||
463 | void | 438 | void |
464 | event_update_contacts(MESSENGER_Application *app, | 439 | event_update_contacts(UNUSED MESSENGER_Application *app, |
465 | struct GNUNET_CHAT_Context *context, | 440 | struct GNUNET_CHAT_Context *context, |
466 | const struct GNUNET_CHAT_Message *msg) | 441 | const struct GNUNET_CHAT_Message *msg) |
467 | { | 442 | { |
@@ -473,7 +448,7 @@ event_update_contacts(MESSENGER_Application *app, | |||
473 | return; | 448 | return; |
474 | 449 | ||
475 | contact_update_info(contact); | 450 | contact_update_info(contact); |
476 | _update_contact_context(app, contact); | 451 | _update_contact_context(contact); |
477 | 452 | ||
478 | UI_CHAT_ENTRY_Handle *handle = GNUNET_CHAT_context_get_user_pointer(context); | 453 | UI_CHAT_ENTRY_Handle *handle = GNUNET_CHAT_context_get_user_pointer(context); |
479 | 454 | ||
diff --git a/src/ui/chat.c b/src/ui/chat.c index b96ecd5..c0ea685 100644 --- a/src/ui/chat.c +++ b/src/ui/chat.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <gdk/gdkkeysyms.h> | 27 | #include <gdk/gdkkeysyms.h> |
28 | #include <stdlib.h> | 28 | #include <stdlib.h> |
29 | 29 | ||
30 | #include "chat_entry.h" | ||
30 | #include "file_load_entry.h" | 31 | #include "file_load_entry.h" |
31 | #include "message.h" | 32 | #include "message.h" |
32 | #include "messenger.h" | 33 | #include "messenger.h" |
@@ -154,6 +155,55 @@ handle_back_button_click(UNUSED GtkButton *button, | |||
154 | } | 155 | } |
155 | } | 156 | } |
156 | 157 | ||
158 | static void | ||
159 | handle_reveal_identity_button_click(UNUSED GtkButton *button, | ||
160 | gpointer user_data) | ||
161 | { | ||
162 | UI_CHAT_Handle *handle = (UI_CHAT_Handle*) user_data; | ||
163 | |||
164 | // TODO | ||
165 | } | ||
166 | |||
167 | static void | ||
168 | handle_leave_chat_button_click(UNUSED GtkButton *button, | ||
169 | gpointer user_data) | ||
170 | { | ||
171 | UI_CHAT_Handle *handle = (UI_CHAT_Handle*) user_data; | ||
172 | |||
173 | if ((!handle) || (!(handle->send_text_view))) | ||
174 | return; | ||
175 | |||
176 | struct GNUNET_CHAT_Context *context = (struct GNUNET_CHAT_Context*) ( | ||
177 | g_object_get_qdata( | ||
178 | G_OBJECT(handle->send_text_view), | ||
179 | handle->app->quarks.data | ||
180 | ) | ||
181 | ); | ||
182 | |||
183 | if (!context) | ||
184 | return; | ||
185 | |||
186 | struct GNUNET_CHAT_Contact *contact = GNUNET_CHAT_context_get_contact( | ||
187 | context | ||
188 | ); | ||
189 | |||
190 | struct GNUNET_CHAT_Group *group = GNUNET_CHAT_context_get_group( | ||
191 | context | ||
192 | ); | ||
193 | |||
194 | if (contact) | ||
195 | GNUNET_CHAT_contact_delete(contact); | ||
196 | else if (group) | ||
197 | GNUNET_CHAT_group_leave(group); | ||
198 | |||
199 | UI_CHAT_ENTRY_Handle *entry = GNUNET_CHAT_context_get_user_pointer(context); | ||
200 | |||
201 | if ((!entry) || (!(handle->app))) | ||
202 | return; | ||
203 | |||
204 | ui_chat_entry_dispose(entry, handle->app); | ||
205 | } | ||
206 | |||
157 | static gint | 207 | static gint |
158 | handle_chat_messages_sort(GtkListBoxRow* row0, | 208 | handle_chat_messages_sort(GtkListBoxRow* row0, |
159 | GtkListBoxRow* row1, | 209 | GtkListBoxRow* row1, |
@@ -1089,6 +1139,40 @@ ui_chat_new(MESSENGER_Application *app) | |||
1089 | gtk_builder_get_object(handle->builder, "chat_details_contacts_box") | 1139 | gtk_builder_get_object(handle->builder, "chat_details_contacts_box") |
1090 | ); | 1140 | ); |
1091 | 1141 | ||
1142 | handle->chat_details_files_box = GTK_BOX( | ||
1143 | gtk_builder_get_object(handle->builder, "chat_details_files_box") | ||
1144 | ); | ||
1145 | |||
1146 | handle->chat_details_avatar = HDY_AVATAR( | ||
1147 | gtk_builder_get_object(handle->builder, "chat_details_avatar") | ||
1148 | ); | ||
1149 | |||
1150 | handle->reveal_identity_button = GTK_BUTTON( | ||
1151 | gtk_builder_get_object(handle->builder, "reveal_identity_button") | ||
1152 | ); | ||
1153 | |||
1154 | g_signal_connect( | ||
1155 | handle->reveal_identity_button, | ||
1156 | "clicked", | ||
1157 | G_CALLBACK(handle_reveal_identity_button_click), | ||
1158 | handle | ||
1159 | ); | ||
1160 | |||
1161 | handle->leave_chat_button = GTK_BUTTON( | ||
1162 | gtk_builder_get_object(handle->builder, "leave_chat_button") | ||
1163 | ); | ||
1164 | |||
1165 | g_signal_connect( | ||
1166 | handle->leave_chat_button, | ||
1167 | "clicked", | ||
1168 | G_CALLBACK(handle_leave_chat_button_click), | ||
1169 | handle | ||
1170 | ); | ||
1171 | |||
1172 | handle->chat_notifications_switch = GTK_SWITCH( | ||
1173 | gtk_builder_get_object(handle->builder, "chat_notifications_switch") | ||
1174 | ); | ||
1175 | |||
1092 | handle->selection_close_button = GTK_BUTTON( | 1176 | handle->selection_close_button = GTK_BUTTON( |
1093 | gtk_builder_get_object(handle->builder, "selection_close_button") | 1177 | gtk_builder_get_object(handle->builder, "selection_close_button") |
1094 | ); | 1178 | ); |
@@ -1355,7 +1439,7 @@ iterate_ui_chat_update_group_contacts(void *cls, | |||
1355 | void | 1439 | void |
1356 | ui_chat_update(UI_CHAT_Handle *handle, | 1440 | ui_chat_update(UI_CHAT_Handle *handle, |
1357 | MESSENGER_Application *app, | 1441 | MESSENGER_Application *app, |
1358 | const struct GNUNET_CHAT_Context* context) | 1442 | struct GNUNET_CHAT_Context* context) |
1359 | { | 1443 | { |
1360 | GNUNET_assert((handle) && (app) && (context)); | 1444 | GNUNET_assert((handle) && (app) && (context)); |
1361 | 1445 | ||
@@ -1366,14 +1450,24 @@ ui_chat_update(UI_CHAT_Handle *handle, | |||
1366 | group = GNUNET_CHAT_context_get_group(context); | 1450 | group = GNUNET_CHAT_context_get_group(context); |
1367 | 1451 | ||
1368 | const char *title = NULL; | 1452 | const char *title = NULL; |
1453 | const char *icon = "action-unavailable-symbolic"; | ||
1454 | |||
1369 | GString *subtitle = g_string_new(""); | 1455 | GString *subtitle = g_string_new(""); |
1370 | 1456 | ||
1371 | if (contact) | 1457 | if (contact) |
1458 | { | ||
1372 | title = GNUNET_CHAT_contact_get_name(contact); | 1459 | title = GNUNET_CHAT_contact_get_name(contact); |
1460 | icon = "avatar-default-symbolic"; | ||
1461 | } | ||
1373 | else if (group) | 1462 | else if (group) |
1374 | { | 1463 | { |
1375 | title = GNUNET_CHAT_group_get_name(group); | 1464 | title = GNUNET_CHAT_group_get_name(group); |
1376 | 1465 | ||
1466 | if ((title) && ('#' == *title)) | ||
1467 | icon = "network-wired-symbolic"; | ||
1468 | else | ||
1469 | icon = "system-users-symbolic"; | ||
1470 | |||
1377 | g_string_append_printf( | 1471 | g_string_append_printf( |
1378 | subtitle, | 1472 | subtitle, |
1379 | _("%d members"), | 1473 | _("%d members"), |
@@ -1381,6 +1475,12 @@ ui_chat_update(UI_CHAT_Handle *handle, | |||
1381 | ); | 1475 | ); |
1382 | } | 1476 | } |
1383 | 1477 | ||
1478 | hdy_avatar_set_text(handle->chat_avatar, title? title : ""); | ||
1479 | hdy_avatar_set_icon_name(handle->chat_avatar, icon); | ||
1480 | |||
1481 | hdy_avatar_set_text(handle->chat_details_avatar, title? title : ""); | ||
1482 | hdy_avatar_set_icon_name(handle->chat_details_avatar, icon); | ||
1483 | |||
1384 | if (title) | 1484 | if (title) |
1385 | { | 1485 | { |
1386 | gtk_label_set_text(handle->chat_title, title); | 1486 | gtk_label_set_text(handle->chat_title, title); |
@@ -1424,6 +1524,16 @@ ui_chat_update(UI_CHAT_Handle *handle, | |||
1424 | group? TRUE : FALSE | 1524 | group? TRUE : FALSE |
1425 | ); | 1525 | ); |
1426 | 1526 | ||
1527 | gtk_widget_set_visible( | ||
1528 | GTK_WIDGET(handle->reveal_identity_button), | ||
1529 | contact? TRUE : FALSE | ||
1530 | ); | ||
1531 | |||
1532 | gtk_widget_set_sensitive( | ||
1533 | GTK_WIDGET(handle->leave_chat_button), | ||
1534 | (contact) || (group)? TRUE : FALSE | ||
1535 | ); | ||
1536 | |||
1427 | const int status = GNUNET_CHAT_context_get_status(context); | 1537 | const int status = GNUNET_CHAT_context_get_status(context); |
1428 | const gboolean activated = (GNUNET_OK == status? TRUE : FALSE); | 1538 | const gboolean activated = (GNUNET_OK == status? TRUE : FALSE); |
1429 | 1539 | ||
diff --git a/src/ui/chat.h b/src/ui/chat.h index 5173596..e28374c 100644 --- a/src/ui/chat.h +++ b/src/ui/chat.h | |||
@@ -90,6 +90,14 @@ typedef struct UI_CHAT_Handle | |||
90 | GtkLabel *chat_details_label; | 90 | GtkLabel *chat_details_label; |
91 | GtkButton *hide_chat_details_button; | 91 | GtkButton *hide_chat_details_button; |
92 | GtkBox *chat_details_contacts_box; | 92 | GtkBox *chat_details_contacts_box; |
93 | GtkBox *chat_details_files_box; | ||
94 | |||
95 | HdyAvatar *chat_details_avatar; | ||
96 | |||
97 | GtkButton *reveal_identity_button; | ||
98 | GtkButton *leave_chat_button; | ||
99 | |||
100 | GtkSwitch *chat_notifications_switch; | ||
93 | 101 | ||
94 | GtkButton *selection_close_button; | 102 | GtkButton *selection_close_button; |
95 | GtkLabel *selection_count_label; | 103 | GtkLabel *selection_count_label; |
@@ -128,7 +136,7 @@ ui_chat_new(MESSENGER_Application *app); | |||
128 | void | 136 | void |
129 | ui_chat_update(UI_CHAT_Handle *handle, | 137 | ui_chat_update(UI_CHAT_Handle *handle, |
130 | MESSENGER_Application *app, | 138 | MESSENGER_Application *app, |
131 | const struct GNUNET_CHAT_Context* context); | 139 | struct GNUNET_CHAT_Context* context); |
132 | 140 | ||
133 | void | 141 | void |
134 | ui_chat_delete(UI_CHAT_Handle *handle); | 142 | ui_chat_delete(UI_CHAT_Handle *handle); |
diff --git a/src/ui/chat_entry.c b/src/ui/chat_entry.c index f538978..7ba67d2 100644 --- a/src/ui/chat_entry.c +++ b/src/ui/chat_entry.c | |||
@@ -71,7 +71,7 @@ ui_chat_entry_new(MESSENGER_Application *app) | |||
71 | void | 71 | void |
72 | ui_chat_entry_update(UI_CHAT_ENTRY_Handle *handle, | 72 | ui_chat_entry_update(UI_CHAT_ENTRY_Handle *handle, |
73 | MESSENGER_Application *app, | 73 | MESSENGER_Application *app, |
74 | const struct GNUNET_CHAT_Context *context) | 74 | struct GNUNET_CHAT_Context *context) |
75 | { | 75 | { |
76 | const struct GNUNET_CHAT_Contact* contact; | 76 | const struct GNUNET_CHAT_Contact* contact; |
77 | const struct GNUNET_CHAT_Group* group; | 77 | const struct GNUNET_CHAT_Group* group; |
@@ -107,9 +107,6 @@ ui_chat_entry_update(UI_CHAT_ENTRY_Handle *handle, | |||
107 | 107 | ||
108 | ui_chat_update(handle->chat, app, context); | 108 | ui_chat_update(handle->chat, app, context); |
109 | 109 | ||
110 | hdy_avatar_set_text(handle->chat->chat_avatar, title? title : ""); | ||
111 | hdy_avatar_set_icon_name(handle->chat->chat_avatar, icon); | ||
112 | |||
113 | if (!(handle->chat->messages)) | 110 | if (!(handle->chat->messages)) |
114 | return; | 111 | return; |
115 | 112 | ||
@@ -160,3 +157,34 @@ ui_chat_entry_delete(UI_CHAT_ENTRY_Handle *handle) | |||
160 | 157 | ||
161 | g_free(handle); | 158 | g_free(handle); |
162 | } | 159 | } |
160 | |||
161 | void | ||
162 | ui_chat_entry_dispose(UI_CHAT_ENTRY_Handle *handle, | ||
163 | MESSENGER_Application *app) | ||
164 | { | ||
165 | UI_MESSENGER_Handle *ui = &(app->ui.messenger); | ||
166 | |||
167 | ui->chat_entries = g_list_remove(ui->chat_entries, handle); | ||
168 | |||
169 | gtk_container_remove( | ||
170 | GTK_CONTAINER(ui->chats_listbox), | ||
171 | gtk_widget_get_parent(handle->entry_box) | ||
172 | ); | ||
173 | |||
174 | struct GNUNET_CHAT_Context *context = (struct GNUNET_CHAT_Context*) ( | ||
175 | g_object_get_qdata( | ||
176 | G_OBJECT(handle->chat->send_text_view), | ||
177 | app->quarks.data | ||
178 | ) | ||
179 | ); | ||
180 | |||
181 | if (context) | ||
182 | GNUNET_CHAT_context_set_user_pointer(context, NULL); | ||
183 | |||
184 | gtk_container_remove( | ||
185 | GTK_CONTAINER(ui->chats_stack), | ||
186 | handle->chat->chat_box | ||
187 | ); | ||
188 | |||
189 | ui_chat_entry_delete(handle); | ||
190 | } | ||
diff --git a/src/ui/chat_entry.h b/src/ui/chat_entry.h index 3a614c4..2515e2c 100644 --- a/src/ui/chat_entry.h +++ b/src/ui/chat_entry.h | |||
@@ -51,9 +51,13 @@ ui_chat_entry_new(MESSENGER_Application *app); | |||
51 | void | 51 | void |
52 | ui_chat_entry_update(UI_CHAT_ENTRY_Handle *handle, | 52 | ui_chat_entry_update(UI_CHAT_ENTRY_Handle *handle, |
53 | MESSENGER_Application *app, | 53 | MESSENGER_Application *app, |
54 | const struct GNUNET_CHAT_Context *context); | 54 | struct GNUNET_CHAT_Context *context); |
55 | 55 | ||
56 | void | 56 | void |
57 | ui_chat_entry_delete(UI_CHAT_ENTRY_Handle *handle); | 57 | ui_chat_entry_delete(UI_CHAT_ENTRY_Handle *handle); |
58 | 58 | ||
59 | void | ||
60 | ui_chat_entry_dispose(UI_CHAT_ENTRY_Handle *handle, | ||
61 | MESSENGER_Application *app); | ||
62 | |||
59 | #endif /* UI_CHAT_ENTRY_H_ */ | 63 | #endif /* UI_CHAT_ENTRY_H_ */ |