aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2021-11-14 18:11:33 +0100
committerTheJackiMonster <thejackimonster@gmail.com>2021-11-14 18:11:33 +0100
commitf6e0bb11c86814b5246aa0e03938ade2f4acd2d1 (patch)
tree9f09b00abe803a00693c4313e3eba409062abb5a
parentbcf36809da07651976fc6528a391f3b51fc5ce0b (diff)
downloadmessenger-gtk-f6e0bb11c86814b5246aa0e03938ade2f4acd2d1.tar.gz
messenger-gtk-f6e0bb11c86814b5246aa0e03938ade2f4acd2d1.zip
Fixing ui inconsistency, removing placeholder values
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r--resources/ui/chat_entry.ui4
-rw-r--r--src/event.c26
-rw-r--r--src/ui/new_platform.c8
3 files changed, 32 insertions, 6 deletions
diff --git a/resources/ui/chat_entry.ui b/resources/ui/chat_entry.ui
index b339fa2..b8a72d9 100644
--- a/resources/ui/chat_entry.ui
+++ b/resources/ui/chat_entry.ui
@@ -54,7 +54,6 @@ Author: Tobias Frisch
54 <object class="GtkLabel" id="title_label"> 54 <object class="GtkLabel" id="title_label">
55 <property name="visible">True</property> 55 <property name="visible">True</property>
56 <property name="can-focus">False</property> 56 <property name="can-focus">False</property>
57 <property name="label" translatable="yes">Chat title</property>
58 <property name="wrap">True</property> 57 <property name="wrap">True</property>
59 <property name="wrap-mode">word-char</property> 58 <property name="wrap-mode">word-char</property>
60 <property name="ellipsize">end</property> 59 <property name="ellipsize">end</property>
@@ -70,7 +69,6 @@ Author: Tobias Frisch
70 <object class="GtkLabel" id="timestamp_label"> 69 <object class="GtkLabel" id="timestamp_label">
71 <property name="visible">True</property> 70 <property name="visible">True</property>
72 <property name="can-focus">False</property> 71 <property name="can-focus">False</property>
73 <property name="label" translatable="yes">11.12.13</property>
74 <property name="justify">right</property> 72 <property name="justify">right</property>
75 </object> 73 </object>
76 <packing> 74 <packing>
@@ -96,7 +94,6 @@ Author: Tobias Frisch
96 <object class="GtkLabel" id="text_label"> 94 <object class="GtkLabel" id="text_label">
97 <property name="visible">True</property> 95 <property name="visible">True</property>
98 <property name="can-focus">False</property> 96 <property name="can-focus">False</property>
99 <property name="label" translatable="yes">My evil comment text is awesome! This is coming to the Pinephone which will be extremely awesome and this text may only cut some borders in certain areas!!!</property>
100 <property name="wrap">True</property> 97 <property name="wrap">True</property>
101 <property name="wrap-mode">word-char</property> 98 <property name="wrap-mode">word-char</property>
102 <property name="ellipsize">end</property> 99 <property name="ellipsize">end</property>
@@ -111,7 +108,6 @@ Author: Tobias Frisch
111 </child> 108 </child>
112 <child> 109 <child>
113 <object class="GtkImage" id="read_receipt_image"> 110 <object class="GtkImage" id="read_receipt_image">
114 <property name="visible">True</property>
115 <property name="can-focus">False</property> 111 <property name="can-focus">False</property>
116 <property name="icon-name">emblem-default-symbolic</property> 112 <property name="icon-name">emblem-default-symbolic</property>
117 </object> 113 </object>
diff --git a/src/event.c b/src/event.c
index 6683e63..da5295e 100644
--- a/src/event.c
+++ b/src/event.c
@@ -33,10 +33,31 @@ _add_new_chat_entry(MESSENGER_Application *app,
33{ 33{
34 UI_MESSENGER_Handle *ui = &(app->ui.messenger); 34 UI_MESSENGER_Handle *ui = &(app->ui.messenger);
35 35
36 const struct GNUNET_CHAT_Contact* contact;
37 const struct GNUNET_CHAT_Group* group;
38
39 contact = GNUNET_CHAT_context_get_contact(context);
40 group = GNUNET_CHAT_context_get_group(context);
41
42 const char *title = NULL;
43
44 if (contact)
45 title = GNUNET_CHAT_contact_get_name(contact);
46 else if (group)
47 title = GNUNET_CHAT_group_get_name(group);
48
36 UI_CHAT_ENTRY_Handle *entry = ui_chat_entry_new(app); 49 UI_CHAT_ENTRY_Handle *entry = ui_chat_entry_new(app);
37 gtk_container_add(GTK_CONTAINER(ui->chats_listbox), entry->entry_box); 50 gtk_container_add(GTK_CONTAINER(ui->chats_listbox), entry->entry_box);
38 GNUNET_CHAT_context_set_user_pointer(context, entry); 51 GNUNET_CHAT_context_set_user_pointer(context, entry);
39 52
53 if (title)
54 {
55 gtk_label_set_text(entry->title_label, title);
56 hdy_avatar_set_text(entry->entry_avatar, title);
57
58 gtk_label_set_text(entry->chat->chat_title, title);
59 }
60
40 char context_id [9]; 61 char context_id [9];
41 g_snprintf(context_id, sizeof(context_id), "%08lx", (gulong) context); 62 g_snprintf(context_id, sizeof(context_id), "%08lx", (gulong) context);
42 63
@@ -184,4 +205,9 @@ event_receive_message(MESSENGER_Application *app,
184 205
185 gtk_label_set_text(handle->text_label, text? text : ""); 206 gtk_label_set_text(handle->text_label, text? text : "");
186 gtk_label_set_text(handle->timestamp_label, time? time : ""); 207 gtk_label_set_text(handle->timestamp_label, time? time : "");
208
209 gtk_widget_set_visible(
210 GTK_WIDGET(handle->read_receipt_image),
211 GNUNET_YES == sent
212 );
187} 213}
diff --git a/src/ui/new_platform.c b/src/ui/new_platform.c
index 75966b5..e4f8c4a 100644
--- a/src/ui/new_platform.c
+++ b/src/ui/new_platform.c
@@ -39,7 +39,6 @@ _open_new_platform(GtkEntry *entry, MESSENGER_Application *app)
39 ); 39 );
40 40
41 g_string_prepend_c(topic_string, '#'); 41 g_string_prepend_c(topic_string, '#');
42
43 GNUNET_CHAT_group_set_name(group, topic_string->str); 42 GNUNET_CHAT_group_set_name(group, topic_string->str);
44 43
45 g_string_free(topic_string, TRUE); 44 g_string_free(topic_string, TRUE);
@@ -52,7 +51,12 @@ handle_platform_entry_changed(GtkEditable *editable,
52 HdyAvatar *avatar = HDY_AVATAR(user_data); 51 HdyAvatar *avatar = HDY_AVATAR(user_data);
53 GtkEntry *entry = GTK_ENTRY(editable); 52 GtkEntry *entry = GTK_ENTRY(editable);
54 53
55 hdy_avatar_set_text(avatar, gtk_entry_get_text(entry)); 54 GString *topic_string = g_string_new(gtk_entry_get_text(entry));
55
56 g_string_prepend_c(topic_string, '#');
57 hdy_avatar_set_text(avatar, topic_string->str);
58
59 g_string_free(topic_string, TRUE);
56} 60}
57 61
58static void 62static void