aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2021-11-01 21:27:54 +0100
committerTheJackiMonster <thejackimonster@gmail.com>2021-11-01 21:27:54 +0100
commit21eff6c7c215672d9d0fedd68bc1ca3c3eb4762f (patch)
tree97a4cb5a8e8a3d5c672f1b3cba78b27ad1a630ae
parent9d5b6a94224d6fcf6820bbc4230ef7cf1c2f9714 (diff)
downloadmessenger-gtk-21eff6c7c215672d9d0fedd68bc1ca3c3eb4762f.tar.gz
messenger-gtk-21eff6c7c215672d9d0fedd68bc1ca3c3eb4762f.zip
Added ui files for messages and automated some debug entries
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r--Makefile1
-rw-r--r--resources/css/style.css8
-rw-r--r--resources/ui/chat_entry.ui45
-rw-r--r--resources/ui/message-sent.ui137
-rw-r--r--resources/ui/message.ui133
-rw-r--r--resources/ui/messenger.ui543
-rw-r--r--src/event.c11
-rw-r--r--src/ui/chat_entry.c20
-rw-r--r--src/ui/chat_entry.h9
-rw-r--r--src/ui/message.c74
-rw-r--r--src/ui/message.h52
-rw-r--r--src/ui/messenger.c4
-rw-r--r--src/ui/messenger.h2
13 files changed, 473 insertions, 566 deletions
diff --git a/Makefile b/Makefile
index 3cd1555..bcde7ff 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,7 @@ SOURCES = messenger_gtk.c\
8 event.c\ 8 event.c\
9 chat/messenger.c\ 9 chat/messenger.c\
10 ui/chat_entry.c\ 10 ui/chat_entry.c\
11 ui/message.c\
11 ui/messenger.c 12 ui/messenger.c
12 13
13HEADERS = 14HEADERS =
diff --git a/resources/css/style.css b/resources/css/style.css
index 9029684..27eec48 100644
--- a/resources/css/style.css
+++ b/resources/css/style.css
@@ -11,6 +11,10 @@
11 padding: 4px; 11 padding: 4px;
12} 12}
13 13
14.message-avatar {
15 margin: 4px;
16}
17
14.message-box { 18.message-box {
15 border-radius: 12px; 19 border-radius: 12px;
16 padding: 8px 12px; 20 padding: 8px 12px;
@@ -18,13 +22,13 @@
18 font-size: small; 22 font-size: small;
19} 23}
20 24
21.message-box:not(.own) { 25.message-box:not(.sent) {
22 background-color: mix(@theme_bg_color, @theme_fg_color, 0.1); 26 background-color: mix(@theme_bg_color, @theme_fg_color, 0.1);
23 color: @theme_fg_color; 27 color: @theme_fg_color;
24 margin-right: 20px; 28 margin-right: 20px;
25} 29}
26 30
27.message-box.own { 31.message-box.sent {
28 background-color: @theme_selected_bg_color; 32 background-color: @theme_selected_bg_color;
29 color: @theme_selected_fg_color; 33 color: @theme_selected_fg_color;
30 margin-left: 20px; 34 margin-left: 20px;
diff --git a/resources/ui/chat_entry.ui b/resources/ui/chat_entry.ui
index cb80132..b339fa2 100644
--- a/resources/ui/chat_entry.ui
+++ b/resources/ui/chat_entry.ui
@@ -28,7 +28,7 @@ Author: Tobias Frisch
28 <property name="can-focus">False</property> 28 <property name="can-focus">False</property>
29 <property name="spacing">8</property> 29 <property name="spacing">8</property>
30 <child> 30 <child>
31 <object class="HdyAvatar"> 31 <object class="HdyAvatar" id="entry_avatar">
32 <property name="visible">True</property> 32 <property name="visible">True</property>
33 <property name="can-focus">False</property> 33 <property name="can-focus">False</property>
34 <property name="size">48</property> 34 <property name="size">48</property>
@@ -51,7 +51,7 @@ Author: Tobias Frisch
51 <property name="can-focus">False</property> 51 <property name="can-focus">False</property>
52 <property name="spacing">8</property> 52 <property name="spacing">8</property>
53 <child> 53 <child>
54 <object class="GtkLabel"> 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> 57 <property name="label" translatable="yes">Chat title</property>
@@ -67,7 +67,7 @@ Author: Tobias Frisch
67 </packing> 67 </packing>
68 </child> 68 </child>
69 <child> 69 <child>
70 <object class="GtkLabel"> 70 <object class="GtkLabel" id="timestamp_label">
71 <property name="visible">True</property> 71 <property name="visible">True</property>
72 <property name="can-focus">False</property> 72 <property name="can-focus">False</property>
73 <property name="label" translatable="yes">11.12.13</property> 73 <property name="label" translatable="yes">11.12.13</property>
@@ -88,15 +88,40 @@ Author: Tobias Frisch
88 </packing> 88 </packing>
89 </child> 89 </child>
90 <child> 90 <child>
91 <object class="GtkLabel"> 91 <object class="GtkBox">
92 <property name="visible">True</property> 92 <property name="visible">True</property>
93 <property name="can-focus">False</property> 93 <property name="can-focus">False</property>
94 <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> 94 <property name="spacing">4</property>
95 <property name="wrap">True</property> 95 <child>
96 <property name="wrap-mode">word-char</property> 96 <object class="GtkLabel" id="text_label">
97 <property name="ellipsize">end</property> 97 <property name="visible">True</property>
98 <property name="max-width-chars">48</property> 98 <property name="can-focus">False</property>
99 <property name="xalign">0</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>
101 <property name="wrap-mode">word-char</property>
102 <property name="ellipsize">end</property>
103 <property name="max-width-chars">48</property>
104 <property name="xalign">0</property>
105 </object>
106 <packing>
107 <property name="expand">True</property>
108 <property name="fill">True</property>
109 <property name="position">0</property>
110 </packing>
111 </child>
112 <child>
113 <object class="GtkImage" id="read_receipt_image">
114 <property name="visible">True</property>
115 <property name="can-focus">False</property>
116 <property name="icon-name">emblem-default-symbolic</property>
117 </object>
118 <packing>
119 <property name="expand">False</property>
120 <property name="fill">True</property>
121 <property name="pack-type">end</property>
122 <property name="position">1</property>
123 </packing>
124 </child>
100 </object> 125 </object>
101 <packing> 126 <packing>
102 <property name="expand">True</property> 127 <property name="expand">True</property>
diff --git a/resources/ui/message-sent.ui b/resources/ui/message-sent.ui
new file mode 100644
index 0000000..88a87e3
--- /dev/null
+++ b/resources/ui/message-sent.ui
@@ -0,0 +1,137 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Generated with glade 3.38.2
3
4Copyright (C) 2021 GNUnet e.V.
5
6GNUnet is free software: you can redistribute it and/or modify it
7under the terms of the GNU Affero General Public License as published
8by the Free Software Foundation, either version 3 of the License,
9or (at your option) any later version.
10
11GNUnet is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14Affero General Public License for more details.
15
16You should have received a copy of the GNU Affero General Public License
17along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19SPDX-License-Identifier: AGPL3.0-or-later
20Author: Tobias Frisch
21
22-->
23<interface>
24 <requires lib="gtk+" version="3.24"/>
25 <requires lib="libhandy" version="1.2"/>
26 <object class="GtkBox" id="message_box">
27 <property name="visible">True</property>
28 <property name="can-focus">False</property>
29 <child>
30 <object class="HdyAvatar" id="sender_avatar">
31 <property name="visible">True</property>
32 <property name="can-focus">False</property>
33 <property name="valign">end</property>
34 <property name="size">36</property>
35 <style>
36 <class name="message-avatar"/>
37 </style>
38 </object>
39 <packing>
40 <property name="expand">False</property>
41 <property name="fill">True</property>
42 <property name="pack-type">end</property>
43 <property name="position">0</property>
44 </packing>
45 </child>
46 <child>
47 <object class="GtkFrame">
48 <property name="visible">True</property>
49 <property name="can-focus">False</property>
50 <property name="label-xalign">0</property>
51 <property name="shadow-type">none</property>
52 <child>
53 <object class="GtkBox">
54 <property name="visible">True</property>
55 <property name="can-focus">False</property>
56 <property name="orientation">vertical</property>
57 <child>
58 <object class="GtkLabel" id="text_label">
59 <property name="visible">True</property>
60 <property name="can-focus">False</property>
61 <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>
62 <property name="wrap">True</property>
63 <property name="max-width-chars">64</property>
64 </object>
65 <packing>
66 <property name="expand">True</property>
67 <property name="fill">True</property>
68 <property name="position">0</property>
69 </packing>
70 </child>
71 <child>
72 <object class="GtkBox">
73 <property name="visible">True</property>
74 <property name="can-focus">False</property>
75 <property name="spacing">4</property>
76 <child>
77 <object class="GtkImage" id="read_receipt_image">
78 <property name="visible">True</property>
79 <property name="can-focus">False</property>
80 <property name="icon-name">emblem-default-symbolic</property>
81 </object>
82 <packing>
83 <property name="expand">False</property>
84 <property name="fill">True</property>
85 <property name="pack-type">end</property>
86 <property name="position">0</property>
87 </packing>
88 </child>
89 <child>
90 <object class="GtkLabel" id="timestamp_label">
91 <property name="visible">True</property>
92 <property name="can-focus">False</property>
93 <property name="label" translatable="yes">0min</property>
94 <attributes>
95 <attribute name="weight" value="light"/>
96 </attributes>
97 </object>
98 <packing>
99 <property name="expand">False</property>
100 <property name="fill">True</property>
101 <property name="pack-type">end</property>
102 <property name="position">1</property>
103 </packing>
104 </child>
105 </object>
106 <packing>
107 <property name="expand">False</property>
108 <property name="fill">True</property>
109 <property name="position">1</property>
110 </packing>
111 </child>
112 </object>
113 </child>
114 <child type="label">
115 <object class="GtkLabel" id="sender_label">
116 <property name="visible">True</property>
117 <property name="can-focus">False</property>
118 <property name="label" translatable="yes">User</property>
119 <attributes>
120 <attribute name="weight" value="semibold"/>
121 </attributes>
122 </object>
123 </child>
124 <style>
125 <class name="message-box"/>
126 <class name="sent"/>
127 </style>
128 </object>
129 <packing>
130 <property name="expand">False</property>
131 <property name="fill">True</property>
132 <property name="pack-type">end</property>
133 <property name="position">1</property>
134 </packing>
135 </child>
136 </object>
137</interface>
diff --git a/resources/ui/message.ui b/resources/ui/message.ui
new file mode 100644
index 0000000..32d04d6
--- /dev/null
+++ b/resources/ui/message.ui
@@ -0,0 +1,133 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Generated with glade 3.38.2
3
4Copyright (C) 2021 GNUnet e.V.
5
6GNUnet is free software: you can redistribute it and/or modify it
7under the terms of the GNU Affero General Public License as published
8by the Free Software Foundation, either version 3 of the License,
9or (at your option) any later version.
10
11GNUnet is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14Affero General Public License for more details.
15
16You should have received a copy of the GNU Affero General Public License
17along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19SPDX-License-Identifier: AGPL3.0-or-later
20Author: Tobias Frisch
21
22-->
23<interface>
24 <requires lib="gtk+" version="3.24"/>
25 <requires lib="libhandy" version="1.2"/>
26 <object class="GtkBox" id="message_box">
27 <property name="visible">True</property>
28 <property name="can-focus">False</property>
29 <child>
30 <object class="HdyAvatar" id="sender_avatar">
31 <property name="visible">True</property>
32 <property name="can-focus">False</property>
33 <property name="valign">end</property>
34 <property name="size">36</property>
35 <style>
36 <class name="message-avatar"/>
37 </style>
38 </object>
39 <packing>
40 <property name="expand">False</property>
41 <property name="fill">True</property>
42 <property name="position">0</property>
43 </packing>
44 </child>
45 <child>
46 <object class="GtkFrame">
47 <property name="visible">True</property>
48 <property name="can-focus">False</property>
49 <property name="label-xalign">0</property>
50 <property name="shadow-type">none</property>
51 <child>
52 <object class="GtkBox">
53 <property name="visible">True</property>
54 <property name="can-focus">False</property>
55 <property name="orientation">vertical</property>
56 <child>
57 <object class="GtkLabel" id="text_label">
58 <property name="visible">True</property>
59 <property name="can-focus">False</property>
60 <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>
61 <property name="wrap">True</property>
62 <property name="max-width-chars">64</property>
63 </object>
64 <packing>
65 <property name="expand">True</property>
66 <property name="fill">True</property>
67 <property name="position">0</property>
68 </packing>
69 </child>
70 <child>
71 <object class="GtkBox">
72 <property name="visible">True</property>
73 <property name="can-focus">False</property>
74 <property name="spacing">4</property>
75 <child>
76 <object class="GtkImage" id="read_receipt_image">
77 <property name="can-focus">False</property>
78 <property name="icon-name">emblem-default-symbolic</property>
79 </object>
80 <packing>
81 <property name="expand">False</property>
82 <property name="fill">True</property>
83 <property name="pack-type">end</property>
84 <property name="position">0</property>
85 </packing>
86 </child>
87 <child>
88 <object class="GtkLabel" id="timestamp_label">
89 <property name="visible">True</property>
90 <property name="can-focus">False</property>
91 <property name="label" translatable="yes">0min</property>
92 <attributes>
93 <attribute name="weight" value="light"/>
94 </attributes>
95 </object>
96 <packing>
97 <property name="expand">False</property>
98 <property name="fill">True</property>
99 <property name="pack-type">end</property>
100 <property name="position">1</property>
101 </packing>
102 </child>
103 </object>
104 <packing>
105 <property name="expand">False</property>
106 <property name="fill">True</property>
107 <property name="position">1</property>
108 </packing>
109 </child>
110 </object>
111 </child>
112 <child type="label">
113 <object class="GtkLabel" id="sender_label">
114 <property name="visible">True</property>
115 <property name="can-focus">False</property>
116 <property name="label" translatable="yes">User</property>
117 <attributes>
118 <attribute name="weight" value="semibold"/>
119 </attributes>
120 </object>
121 </child>
122 <style>
123 <class name="message-box"/>
124 </style>
125 </object>
126 <packing>
127 <property name="expand">False</property>
128 <property name="fill">True</property>
129 <property name="position">1</property>
130 </packing>
131 </child>
132 </object>
133</interface>
diff --git a/resources/ui/messenger.ui b/resources/ui/messenger.ui
index 79b1186..9ff5e9b 100644
--- a/resources/ui/messenger.ui
+++ b/resources/ui/messenger.ui
@@ -114,107 +114,6 @@ Author: Tobias Frisch
114 <property name="visible">True</property> 114 <property name="visible">True</property>
115 <property name="can-focus">False</property> 115 <property name="can-focus">False</property>
116 <property name="selection-mode">none</property> 116 <property name="selection-mode">none</property>
117 <child>
118 <object class="GtkListBoxRow">
119 <property name="visible">True</property>
120 <property name="can-focus">True</property>
121 <child>
122 <object class="GtkBox">
123 <property name="visible">True</property>
124 <property name="can-focus">False</property>
125 <property name="spacing">8</property>
126 <child>
127 <object class="HdyAvatar">
128 <property name="visible">True</property>
129 <property name="can-focus">False</property>
130 <property name="text">Tobias Frisch</property>
131 <property name="size">48</property>
132 </object>
133 <packing>
134 <property name="expand">False</property>
135 <property name="fill">True</property>
136 <property name="position">0</property>
137 </packing>
138 </child>
139 <child>
140 <object class="GtkBox">
141 <property name="visible">True</property>
142 <property name="can-focus">False</property>
143 <property name="orientation">vertical</property>
144 <property name="spacing">2</property>
145 <child>
146 <object class="GtkBox">
147 <property name="visible">True</property>
148 <property name="can-focus">False</property>
149 <property name="spacing">8</property>
150 <child>
151 <object class="GtkLabel">
152 <property name="visible">True</property>
153 <property name="can-focus">False</property>
154 <property name="label" translatable="yes">Chat title</property>
155 <property name="wrap">True</property>
156 <property name="wrap-mode">word-char</property>
157 <property name="ellipsize">end</property>
158 <property name="xalign">2.2351741291171123e-10</property>
159 </object>
160 <packing>
161 <property name="expand">False</property>
162 <property name="fill">True</property>
163 <property name="position">0</property>
164 </packing>
165 </child>
166 <child>
167 <object class="GtkLabel">
168 <property name="visible">True</property>
169 <property name="can-focus">False</property>
170 <property name="label" translatable="yes">11.12.13</property>
171 <property name="justify">right</property>
172 </object>
173 <packing>
174 <property name="expand">False</property>
175 <property name="fill">True</property>
176 <property name="pack-type">end</property>
177 <property name="position">1</property>
178 </packing>
179 </child>
180 </object>
181 <packing>
182 <property name="expand">False</property>
183 <property name="fill">True</property>
184 <property name="position">0</property>
185 </packing>
186 </child>
187 <child>
188 <object class="GtkLabel">
189 <property name="visible">True</property>
190 <property name="can-focus">False</property>
191 <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>
192 <property name="wrap">True</property>
193 <property name="wrap-mode">word-char</property>
194 <property name="ellipsize">end</property>
195 <property name="max-width-chars">48</property>
196 <property name="xalign">0</property>
197 </object>
198 <packing>
199 <property name="expand">False</property>
200 <property name="fill">True</property>
201 <property name="position">1</property>
202 </packing>
203 </child>
204 </object>
205 <packing>
206 <property name="expand">True</property>
207 <property name="fill">True</property>
208 <property name="position">1</property>
209 </packing>
210 </child>
211 <style>
212 <class name="chat-entry"/>
213 </style>
214 </object>
215 </child>
216 </object>
217 </child>
218 </object> 117 </object>
219 </child> 118 </child>
220 </object> 119 </object>
@@ -940,451 +839,11 @@ Author: Tobias Frisch
940 <property name="visible">True</property> 839 <property name="visible">True</property>
941 <property name="can-focus">False</property> 840 <property name="can-focus">False</property>
942 <child> 841 <child>
943 <object class="GtkListBox"> 842 <object class="GtkListBox" id="messages_listbox">
944 <property name="visible">True</property> 843 <property name="visible">True</property>
945 <property name="can-focus">False</property> 844 <property name="can-focus">False</property>
946 <property name="selection-mode">none</property> 845 <property name="selection-mode">none</property>
947 <property name="activate-on-single-click">False</property> 846 <property name="activate-on-single-click">False</property>
948 <child>
949 <object class="GtkListBoxRow">
950 <property name="visible">True</property>
951 <property name="can-focus">True</property>
952 <child>
953 <object class="GtkBox">
954 <property name="visible">True</property>
955 <property name="can-focus">False</property>
956 <child>
957 <object class="GtkFrame">
958 <property name="visible">True</property>
959 <property name="can-focus">False</property>
960 <property name="label-xalign">0</property>
961 <property name="shadow-type">none</property>
962 <child>
963 <object class="GtkBox">
964 <property name="visible">True</property>
965 <property name="can-focus">False</property>
966 <property name="orientation">vertical</property>
967 <child>
968 <object class="GtkLabel">
969 <property name="visible">True</property>
970 <property name="can-focus">False</property>
971 <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>
972 <property name="wrap">True</property>
973 <property name="max-width-chars">64</property>
974 </object>
975 <packing>
976 <property name="expand">False</property>
977 <property name="fill">True</property>
978 <property name="position">0</property>
979 </packing>
980 </child>
981 <child>
982 <object class="GtkLabel">
983 <property name="visible">True</property>
984 <property name="can-focus">False</property>
985 <property name="label" translatable="yes">5h</property>
986 <property name="justify">right</property>
987 <property name="xalign">1</property>
988 <attributes>
989 <attribute name="weight" value="light"/>
990 </attributes>
991 </object>
992 <packing>
993 <property name="expand">False</property>
994 <property name="fill">True</property>
995 <property name="position">1</property>
996 </packing>
997 </child>
998 </object>
999 </child>
1000 <child type="label">
1001 <object class="GtkLabel">
1002 <property name="visible">True</property>
1003 <property name="can-focus">False</property>
1004 <property name="label" translatable="yes">User</property>
1005 </object>
1006 </child>
1007 <style>
1008 <class name="message-box"/>
1009 <class name="own"/>
1010 </style>
1011 </object>
1012 <packing>
1013 <property name="expand">False</property>
1014 <property name="fill">True</property>
1015 <property name="pack-type">end</property>
1016 <property name="position">2</property>
1017 </packing>
1018 </child>
1019 </object>
1020 </child>
1021 </object>
1022 </child>
1023 <child>
1024 <object class="GtkListBoxRow">
1025 <property name="visible">True</property>
1026 <property name="can-focus">True</property>
1027 <child>
1028 <object class="GtkBox">
1029 <property name="visible">True</property>
1030 <property name="can-focus">False</property>
1031 <child>
1032 <object class="GtkFrame">
1033 <property name="visible">True</property>
1034 <property name="can-focus">False</property>
1035 <property name="label-xalign">0</property>
1036 <property name="shadow-type">none</property>
1037 <child>
1038 <object class="GtkBox">
1039 <property name="visible">True</property>
1040 <property name="can-focus">False</property>
1041 <property name="orientation">vertical</property>
1042 <child>
1043 <object class="GtkLabel">
1044 <property name="visible">True</property>
1045 <property name="can-focus">False</property>
1046 <property name="label" translatable="yes">Great stuff to write</property>
1047 <property name="max-width-chars">64</property>
1048 </object>
1049 <packing>
1050 <property name="expand">False</property>
1051 <property name="fill">True</property>
1052 <property name="position">0</property>
1053 </packing>
1054 </child>
1055 <child>
1056 <object class="GtkLabel">
1057 <property name="visible">True</property>
1058 <property name="can-focus">False</property>
1059 <property name="label" translatable="yes">4h</property>
1060 <property name="xalign">0</property>
1061 <attributes>
1062 <attribute name="weight" value="light"/>
1063 </attributes>
1064 </object>
1065 <packing>
1066 <property name="expand">False</property>
1067 <property name="fill">True</property>
1068 <property name="position">1</property>
1069 </packing>
1070 </child>
1071 </object>
1072 </child>
1073 <child type="label">
1074 <object class="GtkLabel">
1075 <property name="visible">True</property>
1076 <property name="can-focus">False</property>
1077 <property name="label" translatable="yes">OtherGuy69</property>
1078 </object>
1079 </child>
1080 <style>
1081 <class name="message-box"/>
1082 </style>
1083 </object>
1084 <packing>
1085 <property name="expand">False</property>
1086 <property name="fill">True</property>
1087 <property name="position">0</property>
1088 </packing>
1089 </child>
1090 </object>
1091 </child>
1092 </object>
1093 </child>
1094 <child>
1095 <object class="GtkListBoxRow">
1096 <property name="visible">True</property>
1097 <property name="can-focus">True</property>
1098 <child>
1099 <object class="GtkBox">
1100 <property name="visible">True</property>
1101 <property name="can-focus">False</property>
1102 <child>
1103 <object class="GtkFrame">
1104 <property name="visible">True</property>
1105 <property name="can-focus">False</property>
1106 <property name="label-xalign">0</property>
1107 <property name="shadow-type">none</property>
1108 <child>
1109 <object class="GtkBox">
1110 <property name="visible">True</property>
1111 <property name="can-focus">False</property>
1112 <property name="orientation">vertical</property>
1113 <child>
1114 <object class="GtkLabel">
1115 <property name="visible">True</property>
1116 <property name="can-focus">False</property>
1117 <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>
1118 <property name="wrap">True</property>
1119 <property name="max-width-chars">64</property>
1120 </object>
1121 <packing>
1122 <property name="expand">False</property>
1123 <property name="fill">True</property>
1124 <property name="position">0</property>
1125 </packing>
1126 </child>
1127 <child>
1128 <object class="GtkLabel">
1129 <property name="visible">True</property>
1130 <property name="can-focus">False</property>
1131 <property name="label" translatable="yes">2h</property>
1132 <property name="justify">right</property>
1133 <property name="xalign">1</property>
1134 <attributes>
1135 <attribute name="weight" value="light"/>
1136 </attributes>
1137 </object>
1138 <packing>
1139 <property name="expand">False</property>
1140 <property name="fill">True</property>
1141 <property name="position">1</property>
1142 </packing>
1143 </child>
1144 </object>
1145 </child>
1146 <child type="label">
1147 <object class="GtkLabel">
1148 <property name="visible">True</property>
1149 <property name="can-focus">False</property>
1150 <property name="label" translatable="yes">User</property>
1151 </object>
1152 </child>
1153 <style>
1154 <class name="message-box"/>
1155 <class name="own"/>
1156 </style>
1157 </object>
1158 <packing>
1159 <property name="expand">False</property>
1160 <property name="fill">True</property>
1161 <property name="pack-type">end</property>
1162 <property name="position">2</property>
1163 </packing>
1164 </child>
1165 </object>
1166 </child>
1167 </object>
1168 </child>
1169 <child>
1170 <object class="GtkListBoxRow">
1171 <property name="visible">True</property>
1172 <property name="can-focus">True</property>
1173 <child>
1174 <object class="GtkBox">
1175 <property name="visible">True</property>
1176 <property name="can-focus">False</property>
1177 <child>
1178 <object class="GtkFrame">
1179 <property name="visible">True</property>
1180 <property name="can-focus">False</property>
1181 <property name="label-xalign">0</property>
1182 <property name="shadow-type">none</property>
1183 <child>
1184 <object class="GtkBox">
1185 <property name="visible">True</property>
1186 <property name="can-focus">False</property>
1187 <property name="orientation">vertical</property>
1188 <child>
1189 <object class="GtkLabel">
1190 <property name="visible">True</property>
1191 <property name="can-focus">False</property>
1192 <property name="label" translatable="yes">If people would know that you spam here like this...</property>
1193 <property name="wrap">True</property>
1194 <property name="max-width-chars">64</property>
1195 </object>
1196 <packing>
1197 <property name="expand">False</property>
1198 <property name="fill">True</property>
1199 <property name="position">0</property>
1200 </packing>
1201 </child>
1202 <child>
1203 <object class="GtkLabel">
1204 <property name="visible">True</property>
1205 <property name="can-focus">False</property>
1206 <property name="label" translatable="yes">1h</property>
1207 <property name="xalign">0</property>
1208 <attributes>
1209 <attribute name="weight" value="light"/>
1210 </attributes>
1211 </object>
1212 <packing>
1213 <property name="expand">False</property>
1214 <property name="fill">True</property>
1215 <property name="position">1</property>
1216 </packing>
1217 </child>
1218 </object>
1219 </child>
1220 <child type="label">
1221 <object class="GtkLabel">
1222 <property name="visible">True</property>
1223 <property name="can-focus">False</property>
1224 <property name="label" translatable="yes">CookieHunter</property>
1225 </object>
1226 </child>
1227 <style>
1228 <class name="message-box"/>
1229 </style>
1230 </object>
1231 <packing>
1232 <property name="expand">False</property>
1233 <property name="fill">True</property>
1234 <property name="position">2</property>
1235 </packing>
1236 </child>
1237 </object>
1238 </child>
1239 </object>
1240 </child>
1241 <child>
1242 <object class="GtkListBoxRow">
1243 <property name="visible">True</property>
1244 <property name="can-focus">True</property>
1245 <child>
1246 <object class="GtkBox">
1247 <property name="visible">True</property>
1248 <property name="can-focus">False</property>
1249 <child>
1250 <object class="GtkFrame">
1251 <property name="visible">True</property>
1252 <property name="can-focus">False</property>
1253 <property name="label-xalign">0</property>
1254 <property name="shadow-type">none</property>
1255 <child>
1256 <object class="GtkBox">
1257 <property name="visible">True</property>
1258 <property name="can-focus">False</property>
1259 <property name="orientation">vertical</property>
1260 <child>
1261 <object class="GtkLabel">
1262 <property name="visible">True</property>
1263 <property name="can-focus">False</property>
1264 <property name="label" translatable="yes">Existence is a crisis my friends. You will only get releaf by open-sourcing your hard work because profit is temporary. Forks remain forever!</property>
1265 <property name="wrap">True</property>
1266 <property name="max-width-chars">64</property>
1267 </object>
1268 <packing>
1269 <property name="expand">False</property>
1270 <property name="fill">True</property>
1271 <property name="position">0</property>
1272 </packing>
1273 </child>
1274 <child>
1275 <object class="GtkLabel">
1276 <property name="visible">True</property>
1277 <property name="can-focus">False</property>
1278 <property name="label" translatable="yes">30min</property>
1279 <property name="xalign">0</property>
1280 <attributes>
1281 <attribute name="weight" value="light"/>
1282 </attributes>
1283 </object>
1284 <packing>
1285 <property name="expand">False</property>
1286 <property name="fill">True</property>
1287 <property name="position">1</property>
1288 </packing>
1289 </child>
1290 </object>
1291 </child>
1292 <child type="label">
1293 <object class="GtkLabel">
1294 <property name="visible">True</property>
1295 <property name="can-focus">False</property>
1296 <property name="label" translatable="yes">SomePhilosoph28</property>
1297 </object>
1298 </child>
1299 <style>
1300 <class name="message-box"/>
1301 </style>
1302 </object>
1303 <packing>
1304 <property name="expand">False</property>
1305 <property name="fill">True</property>
1306 <property name="position">2</property>
1307 </packing>
1308 </child>
1309 </object>
1310 </child>
1311 </object>
1312 </child>
1313 <child>
1314 <object class="GtkListBoxRow">
1315 <property name="visible">True</property>
1316 <property name="can-focus">True</property>
1317 <child>
1318 <object class="GtkBox">
1319 <property name="visible">True</property>
1320 <property name="can-focus">False</property>
1321 <child>
1322 <object class="GtkFrame">
1323 <property name="visible">True</property>
1324 <property name="can-focus">False</property>
1325 <property name="label-xalign">0</property>
1326 <property name="shadow-type">none</property>
1327 <child>
1328 <object class="GtkBox">
1329 <property name="visible">True</property>
1330 <property name="can-focus">False</property>
1331 <property name="orientation">vertical</property>
1332 <child>
1333 <object class="GtkLabel">
1334 <property name="visible">True</property>
1335 <property name="can-focus">False</property>
1336 <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>
1337 <property name="wrap">True</property>
1338 <property name="max-width-chars">64</property>
1339 </object>
1340 <packing>
1341 <property name="expand">False</property>
1342 <property name="fill">True</property>
1343 <property name="position">0</property>
1344 </packing>
1345 </child>
1346 <child>
1347 <object class="GtkLabel">
1348 <property name="visible">True</property>
1349 <property name="can-focus">False</property>
1350 <property name="label" translatable="yes">12min</property>
1351 <property name="justify">right</property>
1352 <property name="xalign">1</property>
1353 <attributes>
1354 <attribute name="weight" value="light"/>
1355 </attributes>
1356 </object>
1357 <packing>
1358 <property name="expand">False</property>
1359 <property name="fill">True</property>
1360 <property name="position">1</property>
1361 </packing>
1362 </child>
1363 </object>
1364 </child>
1365 <child type="label">
1366 <object class="GtkLabel">
1367 <property name="visible">True</property>
1368 <property name="can-focus">False</property>
1369 <property name="label" translatable="yes">User</property>
1370 </object>
1371 </child>
1372 <style>
1373 <class name="message-box"/>
1374 <class name="own"/>
1375 </style>
1376 </object>
1377 <packing>
1378 <property name="expand">False</property>
1379 <property name="fill">True</property>
1380 <property name="pack-type">end</property>
1381 <property name="position">2</property>
1382 </packing>
1383 </child>
1384 </object>
1385 </child>
1386 </object>
1387 </child>
1388 </object> 847 </object>
1389 <packing> 848 <packing>
1390 <property name="name">page0</property> 849 <property name="name">page0</property>
diff --git a/src/event.c b/src/event.c
index e04fe5c..e023613 100644
--- a/src/event.c
+++ b/src/event.c
@@ -25,6 +25,7 @@
25#include "event.h" 25#include "event.h"
26 26
27#include "ui/chat_entry.h" 27#include "ui/chat_entry.h"
28#include "ui/message.h"
28 29
29static int 30static int
30_iterate_profile_contacts(void *cls, 31_iterate_profile_contacts(void *cls,
@@ -93,4 +94,14 @@ event_update_profile(MESSENGER_Application *app)
93 94
94 GNUNET_CHAT_iterate_contacts(chat->handle, _iterate_profile_contacts, app); 95 GNUNET_CHAT_iterate_contacts(chat->handle, _iterate_profile_contacts, app);
95 GNUNET_CHAT_iterate_groups(chat->handle, _iterate_profile_groups, app); 96 GNUNET_CHAT_iterate_groups(chat->handle, _iterate_profile_groups, app);
97
98 UI_CHAT_ENTRY_Handle *entry = ui_chat_entry_new();
99 gtk_container_add(GTK_CONTAINER(ui->chats_listbox), entry->entry_box);
100 g_free(entry);
101
102 for (int i = 0; i < 8; i++) {
103 UI_MESSAGE_Handle *message = ui_message_new(app, i % 2 == 0);
104 gtk_container_add(GTK_CONTAINER(ui->messages_listbox), message->message_box);
105 g_free(message);
106 }
96} 107}
diff --git a/src/ui/chat_entry.c b/src/ui/chat_entry.c
index 5ff7063..b314211 100644
--- a/src/ui/chat_entry.c
+++ b/src/ui/chat_entry.c
@@ -35,20 +35,24 @@ ui_chat_entry_new(void)
35 gtk_builder_get_object(builder, "entry_box") 35 gtk_builder_get_object(builder, "entry_box")
36 ); 36 );
37 37
38 handle->avatar = HDY_AVATAR( 38 handle->entry_avatar = HDY_AVATAR(
39 gtk_builder_get_object(builder, "avatar") 39 gtk_builder_get_object(builder, "entry_avatar")
40 ); 40 );
41 41
42 handle->title = GTK_LABEL( 42 handle->title_label = GTK_LABEL(
43 gtk_builder_get_object(builder, "title") 43 gtk_builder_get_object(builder, "title_label")
44 ); 44 );
45 45
46 handle->timestamp = GTK_LABEL( 46 handle->timestamp_label = GTK_LABEL(
47 gtk_builder_get_object(builder, "timestamp") 47 gtk_builder_get_object(builder, "timestamp_label")
48 ); 48 );
49 49
50 handle->text = GTK_LABEL( 50 handle->text_label = GTK_LABEL(
51 gtk_builder_get_object(builder, "text") 51 gtk_builder_get_object(builder, "text_label")
52 );
53
54 handle->read_receipt_image = GTK_IMAGE(
55 gtk_builder_get_object(builder, "read_receipt_image")
52 ); 56 );
53 57
54 return handle; 58 return handle;
diff --git a/src/ui/chat_entry.h b/src/ui/chat_entry.h
index 48f2fb7..2315686 100644
--- a/src/ui/chat_entry.h
+++ b/src/ui/chat_entry.h
@@ -34,12 +34,13 @@ typedef struct UI_CHAT_ENTRY_Handle
34{ 34{
35 GtkWidget* entry_box; 35 GtkWidget* entry_box;
36 36
37 HdyAvatar* avatar; 37 HdyAvatar* entry_avatar;
38 38
39 GtkLabel* title; 39 GtkLabel* title_label;
40 GtkLabel* timestamp; 40 GtkLabel* timestamp_label;
41 41
42 GtkLabel* text; 42 GtkLabel* text_label;
43 GtkImage* read_receipt_image;
43} UI_CHAT_ENTRY_Handle; 44} UI_CHAT_ENTRY_Handle;
44 45
45UI_CHAT_ENTRY_Handle* 46UI_CHAT_ENTRY_Handle*
diff --git a/src/ui/message.c b/src/ui/message.c
new file mode 100644
index 0000000..f48bbaa
--- /dev/null
+++ b/src/ui/message.c
@@ -0,0 +1,74 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20/*
21 * @author Tobias Frisch
22 * @file ui/message.c
23 */
24
25#include "message.h"
26
27#include "../application.h"
28
29UI_MESSAGE_Handle*
30ui_message_new(MESSENGER_Application *app,
31 bool sent)
32{
33 UI_MESSAGE_Handle* handle = g_malloc(sizeof(UI_MESSAGE_Handle));
34 GtkBuilder* builder;
35
36 if (sent)
37 builder = gtk_builder_new_from_file("resources/ui/message-sent.ui");
38 else
39 builder = gtk_builder_new_from_file("resources/ui/message.ui");
40
41 handle->message_box = GTK_WIDGET(
42 gtk_builder_get_object(builder, "message_box")
43 );
44
45 handle->sender_avatar = HDY_AVATAR(
46 gtk_builder_get_object(builder, "sender_avatar")
47 );
48
49 handle->sender_label = GTK_LABEL(
50 gtk_builder_get_object(builder, "sender_label")
51 );
52
53 if (sent)
54 {
55 const char *sender = GNUNET_CHAT_get_name(app->chat.messenger.handle);
56
57 hdy_avatar_set_text(handle->sender_avatar, sender);
58 gtk_label_set_text(handle->sender_label, sender);
59 }
60
61 handle->text_label = GTK_LABEL(
62 gtk_builder_get_object(builder, "text_label")
63 );
64
65 handle->timestamp_label = GTK_LABEL(
66 gtk_builder_get_object(builder, "timestamp_label")
67 );
68
69 handle->read_receipt_image = GTK_IMAGE(
70 gtk_builder_get_object(builder, "read_receipt_image")
71 );
72
73 return handle;
74}
diff --git a/src/ui/message.h b/src/ui/message.h
new file mode 100644
index 0000000..b55cb8d
--- /dev/null
+++ b/src/ui/message.h
@@ -0,0 +1,52 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20/*
21 * @author Tobias Frisch
22 * @file ui/message.h
23 */
24
25#ifndef UI_MESSAGE_H_
26#define UI_MESSAGE_H_
27
28#include <stdbool.h>
29
30#include <gtk-3.0/gtk/gtk.h>
31#include <libhandy-1/handy.h>
32
33typedef struct MESSENGER_Application MESSENGER_Application;
34
35typedef struct UI_MESSAGE_Handle
36{
37 GtkWidget* message_box;
38
39 HdyAvatar* sender_avatar;
40 GtkLabel* sender_label;
41
42 GtkLabel* text_label;
43
44 GtkLabel* timestamp_label;
45 GtkImage* read_receipt_image;
46} UI_MESSAGE_Handle;
47
48UI_MESSAGE_Handle*
49ui_message_new(MESSENGER_Application *app,
50 bool sent);
51
52#endif /* UI_MESSAGE_H_ */
diff --git a/src/ui/messenger.c b/src/ui/messenger.c
index 37827d8..196b00a 100644
--- a/src/ui/messenger.c
+++ b/src/ui/messenger.c
@@ -279,6 +279,10 @@ ui_messenger_init(MESSENGER_Application *app,
279 handle->flap_chat_details 279 handle->flap_chat_details
280 ); 280 );
281 281
282 handle->messages_listbox = GTK_LIST_BOX(
283 gtk_builder_get_object(builder, "messages_listbox")
284 );
285
282 gtk_widget_show(GTK_WIDGET(handle->main_window)); 286 gtk_widget_show(GTK_WIDGET(handle->main_window));
283 287
284 g_signal_connect( 288 g_signal_connect(
diff --git a/src/ui/messenger.h b/src/ui/messenger.h
index 4174754..e923964 100644
--- a/src/ui/messenger.h
+++ b/src/ui/messenger.h
@@ -67,6 +67,8 @@ typedef struct UI_MESSENGER_Handle
67 GtkButton *chat_details_button; 67 GtkButton *chat_details_button;
68 68
69 GtkButton *hide_chat_details_button; 69 GtkButton *hide_chat_details_button;
70
71 GtkListBox *messages_listbox;
70} UI_MESSENGER_Handle; 72} UI_MESSENGER_Handle;
71 73
72void 74void