diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2021-12-12 22:31:42 +0100 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2021-12-12 22:31:42 +0100 |
commit | cbefefb69b4db53fad2c01d45b66d9056bc98fdb (patch) | |
tree | 8e80423c16ea14e926e1629471d81a0f50a0db08 | |
parent | 1e666517d6f6bccb85b2a92fd51986efba2e2563 (diff) | |
download | messenger-gtk-cbefefb69b4db53fad2c01d45b66d9056bc98fdb.tar.gz messenger-gtk-cbefefb69b4db53fad2c01d45b66d9056bc98fdb.zip |
Added chat details with a list of contacts for groups
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r-- | resources/css/style.css | 12 | ||||
-rw-r--r-- | resources/ui/chat.ui | 644 | ||||
-rw-r--r-- | resources/ui/messenger.ui | 151 | ||||
-rw-r--r-- | src/event.c | 27 | ||||
-rw-r--r-- | src/ui/chat.c | 113 | ||||
-rw-r--r-- | src/ui/chat.h | 12 | ||||
-rw-r--r-- | src/ui/chat_entry.c | 25 | ||||
-rw-r--r-- | src/ui/chat_entry.h | 3 | ||||
-rw-r--r-- | src/ui/messenger.c | 15 | ||||
-rw-r--r-- | src/ui/messenger.h | 3 |
10 files changed, 618 insertions, 387 deletions
diff --git a/resources/css/style.css b/resources/css/style.css index 1f923d6..afda9fe 100644 --- a/resources/css/style.css +++ b/resources/css/style.css | |||
@@ -69,7 +69,17 @@ | |||
69 | font-size: large; | 69 | font-size: large; |
70 | } | 70 | } |
71 | 71 | ||
72 | .settings-entry { | 72 | .settings-entry, .details-entry { |
73 | margin: 8px; | 73 | margin: 8px; |
74 | } | 74 | } |
75 | 75 | ||
76 | .details-group { | ||
77 | margin-top: 16px; | ||
78 | } | ||
79 | |||
80 | .details-group-title { | ||
81 | margin-left: 8px; | ||
82 | margin-right: 8px; | ||
83 | margin-bottom: 4px; | ||
84 | } | ||
85 | |||
diff --git a/resources/ui/chat.ui b/resources/ui/chat.ui index ca93f9d..9b89023 100644 --- a/resources/ui/chat.ui +++ b/resources/ui/chat.ui | |||
@@ -22,53 +22,121 @@ Author: Tobias Frisch | |||
22 | --> | 22 | --> |
23 | <interface> | 23 | <interface> |
24 | <requires lib="gtk+" version="3.24"/> | 24 | <requires lib="gtk+" version="3.24"/> |
25 | <requires lib="libhandy" version="1.2"/> | ||
25 | <object class="GtkBox" id="chat_box"> | 26 | <object class="GtkBox" id="chat_box"> |
26 | <property name="visible">True</property> | 27 | <property name="visible">True</property> |
27 | <property name="can-focus">False</property> | 28 | <property name="can-focus">False</property> |
28 | <property name="orientation">vertical</property> | 29 | <property name="orientation">vertical</property> |
29 | <child> | 30 | <child> |
30 | <object class="GtkBox"> | 31 | <object class="HdyFlap" id="flap_chat_details"> |
31 | <property name="visible">True</property> | 32 | <property name="visible">True</property> |
32 | <property name="can-focus">False</property> | 33 | <property name="can-focus">False</property> |
33 | <property name="border-width">8</property> | 34 | <property name="flap-position">end</property> |
34 | <property name="spacing">8</property> | 35 | <property name="reveal-flap">False</property> |
35 | <child> | 36 | <property name="fold-policy">always</property> |
36 | <object class="GtkButton" id="back_button"> | ||
37 | <property name="visible">True</property> | ||
38 | <property name="can-focus">True</property> | ||
39 | <property name="receives-default">True</property> | ||
40 | <property name="relief">none</property> | ||
41 | <child> | ||
42 | <object class="GtkImage"> | ||
43 | <property name="visible">True</property> | ||
44 | <property name="can-focus">False</property> | ||
45 | <property name="icon-name">go-previous-symbolic</property> | ||
46 | </object> | ||
47 | </child> | ||
48 | </object> | ||
49 | <packing> | ||
50 | <property name="expand">False</property> | ||
51 | <property name="fill">True</property> | ||
52 | <property name="position">0</property> | ||
53 | </packing> | ||
54 | </child> | ||
55 | <child> | 37 | <child> |
56 | <object class="GtkBox"> | 38 | <object class="GtkBox"> |
57 | <property name="visible">True</property> | 39 | <property name="visible">True</property> |
58 | <property name="can-focus">False</property> | 40 | <property name="can-focus">False</property> |
59 | <property name="halign">start</property> | ||
60 | <property name="margin-start">4</property> | ||
61 | <property name="margin-end">4</property> | ||
62 | <property name="orientation">vertical</property> | 41 | <property name="orientation">vertical</property> |
63 | <child> | 42 | <child> |
64 | <object class="GtkLabel" id="chat_title"> | 43 | <object class="GtkBox"> |
65 | <property name="visible">True</property> | 44 | <property name="visible">True</property> |
66 | <property name="can-focus">False</property> | 45 | <property name="can-focus">False</property> |
67 | <property name="label" translatable="yes">Chat title</property> | 46 | <property name="border-width">8</property> |
68 | <property name="xalign">0</property> | 47 | <property name="spacing">8</property> |
69 | <attributes> | 48 | <child> |
70 | <attribute name="weight" value="bold"/> | 49 | <object class="GtkButton" id="back_button"> |
71 | </attributes> | 50 | <property name="visible">True</property> |
51 | <property name="can-focus">True</property> | ||
52 | <property name="receives-default">True</property> | ||
53 | <property name="relief">none</property> | ||
54 | <child> | ||
55 | <object class="GtkImage"> | ||
56 | <property name="visible">True</property> | ||
57 | <property name="can-focus">False</property> | ||
58 | <property name="icon-name">go-previous-symbolic</property> | ||
59 | </object> | ||
60 | </child> | ||
61 | </object> | ||
62 | <packing> | ||
63 | <property name="expand">False</property> | ||
64 | <property name="fill">True</property> | ||
65 | <property name="position">0</property> | ||
66 | </packing> | ||
67 | </child> | ||
68 | <child> | ||
69 | <object class="GtkBox"> | ||
70 | <property name="visible">True</property> | ||
71 | <property name="can-focus">False</property> | ||
72 | <property name="halign">start</property> | ||
73 | <property name="margin-start">4</property> | ||
74 | <property name="margin-end">4</property> | ||
75 | <property name="orientation">vertical</property> | ||
76 | <child> | ||
77 | <object class="GtkLabel" id="chat_title"> | ||
78 | <property name="visible">True</property> | ||
79 | <property name="can-focus">False</property> | ||
80 | <property name="xalign">0</property> | ||
81 | <attributes> | ||
82 | <attribute name="weight" value="bold"/> | ||
83 | </attributes> | ||
84 | </object> | ||
85 | <packing> | ||
86 | <property name="expand">False</property> | ||
87 | <property name="fill">True</property> | ||
88 | <property name="position">0</property> | ||
89 | </packing> | ||
90 | </child> | ||
91 | <child> | ||
92 | <object class="GtkLabel" id="chat_subtitle"> | ||
93 | <property name="visible">True</property> | ||
94 | <property name="can-focus">False</property> | ||
95 | <property name="xalign">0</property> | ||
96 | <attributes> | ||
97 | <attribute name="weight" value="light"/> | ||
98 | </attributes> | ||
99 | <style> | ||
100 | <class name="header-subtitle"/> | ||
101 | </style> | ||
102 | </object> | ||
103 | <packing> | ||
104 | <property name="expand">True</property> | ||
105 | <property name="fill">True</property> | ||
106 | <property name="position">1</property> | ||
107 | </packing> | ||
108 | </child> | ||
109 | </object> | ||
110 | <packing> | ||
111 | <property name="expand">True</property> | ||
112 | <property name="fill">True</property> | ||
113 | <property name="position">1</property> | ||
114 | </packing> | ||
115 | </child> | ||
116 | <child> | ||
117 | <object class="GtkButton" id="chat_details_button"> | ||
118 | <property name="visible">True</property> | ||
119 | <property name="can-focus">True</property> | ||
120 | <property name="receives-default">True</property> | ||
121 | <property name="relief">none</property> | ||
122 | <child> | ||
123 | <object class="GtkImage"> | ||
124 | <property name="visible">True</property> | ||
125 | <property name="can-focus">False</property> | ||
126 | <property name="icon-name">view-more-symbolic</property> | ||
127 | </object> | ||
128 | </child> | ||
129 | </object> | ||
130 | <packing> | ||
131 | <property name="expand">False</property> | ||
132 | <property name="fill">True</property> | ||
133 | <property name="pack-type">end</property> | ||
134 | <property name="position">1</property> | ||
135 | </packing> | ||
136 | </child> | ||
137 | <style> | ||
138 | <class name=".header-box"/> | ||
139 | </style> | ||
72 | </object> | 140 | </object> |
73 | <packing> | 141 | <packing> |
74 | <property name="expand">False</property> | 142 | <property name="expand">False</property> |
@@ -77,17 +145,33 @@ Author: Tobias Frisch | |||
77 | </packing> | 145 | </packing> |
78 | </child> | 146 | </child> |
79 | <child> | 147 | <child> |
80 | <object class="GtkLabel" id="chat_subtitle"> | 148 | <object class="GtkScrolledWindow"> |
81 | <property name="visible">True</property> | 149 | <property name="visible">True</property> |
82 | <property name="can-focus">False</property> | 150 | <property name="can-focus">True</property> |
83 | <property name="label" translatable="yes">Chat subtitle</property> | 151 | <child> |
84 | <property name="xalign">0</property> | 152 | <object class="GtkViewport"> |
85 | <attributes> | 153 | <property name="visible">True</property> |
86 | <attribute name="weight" value="light"/> | 154 | <property name="can-focus">False</property> |
87 | </attributes> | 155 | <child> |
88 | <style> | 156 | <object class="GtkStack"> |
89 | <class name="header-subtitle"/> | 157 | <property name="visible">True</property> |
90 | </style> | 158 | <property name="can-focus">False</property> |
159 | <child> | ||
160 | <object class="GtkListBox" id="messages_listbox"> | ||
161 | <property name="visible">True</property> | ||
162 | <property name="can-focus">False</property> | ||
163 | <property name="selection-mode">none</property> | ||
164 | <property name="activate-on-single-click">False</property> | ||
165 | </object> | ||
166 | <packing> | ||
167 | <property name="name">page0</property> | ||
168 | <property name="title" translatable="yes">page0</property> | ||
169 | </packing> | ||
170 | </child> | ||
171 | </object> | ||
172 | </child> | ||
173 | </object> | ||
174 | </child> | ||
91 | </object> | 175 | </object> |
92 | <packing> | 176 | <packing> |
93 | <property name="expand">True</property> | 177 | <property name="expand">True</property> |
@@ -95,197 +179,363 @@ Author: Tobias Frisch | |||
95 | <property name="position">1</property> | 179 | <property name="position">1</property> |
96 | </packing> | 180 | </packing> |
97 | </child> | 181 | </child> |
98 | </object> | ||
99 | <packing> | ||
100 | <property name="expand">True</property> | ||
101 | <property name="fill">True</property> | ||
102 | <property name="position">1</property> | ||
103 | </packing> | ||
104 | </child> | ||
105 | <child> | ||
106 | <object class="GtkButton" id="chat_details_button"> | ||
107 | <property name="visible">True</property> | ||
108 | <property name="can-focus">True</property> | ||
109 | <property name="receives-default">True</property> | ||
110 | <property name="relief">none</property> | ||
111 | <child> | 182 | <child> |
112 | <object class="GtkImage"> | 183 | <object class="GtkRevealer" id="picker_revealer"> |
113 | <property name="visible">True</property> | 184 | <property name="visible">True</property> |
114 | <property name="can-focus">False</property> | 185 | <property name="can-focus">False</property> |
115 | <property name="icon-name">view-more-symbolic</property> | 186 | <property name="transition-type">slide-up</property> |
187 | <child> | ||
188 | <placeholder/> | ||
189 | </child> | ||
116 | </object> | 190 | </object> |
191 | <packing> | ||
192 | <property name="expand">False</property> | ||
193 | <property name="fill">True</property> | ||
194 | <property name="pack-type">end</property> | ||
195 | <property name="position">2</property> | ||
196 | </packing> | ||
117 | </child> | 197 | </child> |
118 | </object> | ||
119 | <packing> | ||
120 | <property name="expand">False</property> | ||
121 | <property name="fill">True</property> | ||
122 | <property name="pack-type">end</property> | ||
123 | <property name="position">1</property> | ||
124 | </packing> | ||
125 | </child> | ||
126 | <style> | ||
127 | <class name=".header-box"/> | ||
128 | </style> | ||
129 | </object> | ||
130 | <packing> | ||
131 | <property name="expand">False</property> | ||
132 | <property name="fill">True</property> | ||
133 | <property name="position">0</property> | ||
134 | </packing> | ||
135 | </child> | ||
136 | <child> | ||
137 | <object class="GtkScrolledWindow"> | ||
138 | <property name="visible">True</property> | ||
139 | <property name="can-focus">True</property> | ||
140 | <child> | ||
141 | <object class="GtkViewport"> | ||
142 | <property name="visible">True</property> | ||
143 | <property name="can-focus">False</property> | ||
144 | <child> | 198 | <child> |
145 | <object class="GtkStack"> | 199 | <object class="GtkBox"> |
146 | <property name="visible">True</property> | 200 | <property name="visible">True</property> |
147 | <property name="can-focus">False</property> | 201 | <property name="can-focus">False</property> |
202 | <property name="margin-start">4</property> | ||
203 | <property name="margin-end">4</property> | ||
204 | <property name="border-width">4</property> | ||
205 | <property name="spacing">4</property> | ||
148 | <child> | 206 | <child> |
149 | <object class="GtkListBox" id="messages_listbox"> | 207 | <object class="GtkButton" id="attach_file_button"> |
150 | <property name="visible">True</property> | 208 | <property name="visible">True</property> |
151 | <property name="can-focus">False</property> | 209 | <property name="sensitive">False</property> |
152 | <property name="selection-mode">none</property> | 210 | <property name="can-focus">True</property> |
153 | <property name="activate-on-single-click">False</property> | 211 | <property name="receives-default">True</property> |
212 | <property name="valign">center</property> | ||
213 | <property name="relief">none</property> | ||
214 | <child> | ||
215 | <object class="GtkImage"> | ||
216 | <property name="visible">True</property> | ||
217 | <property name="can-focus">False</property> | ||
218 | <property name="icon-name">mail-attachment-symbolic</property> | ||
219 | </object> | ||
220 | </child> | ||
154 | </object> | 221 | </object> |
155 | <packing> | 222 | <packing> |
156 | <property name="name">page0</property> | 223 | <property name="expand">False</property> |
157 | <property name="title" translatable="yes">page0</property> | 224 | <property name="fill">True</property> |
225 | <property name="position">0</property> | ||
226 | </packing> | ||
227 | </child> | ||
228 | <child> | ||
229 | <object class="GtkTextView" id="send_text_view"> | ||
230 | <property name="width-request">210</property> | ||
231 | <property name="height-request">48</property> | ||
232 | <property name="visible">True</property> | ||
233 | <property name="sensitive">False</property> | ||
234 | <property name="can-focus">True</property> | ||
235 | <property name="valign">end</property> | ||
236 | <property name="editable">False</property> | ||
237 | <property name="wrap-mode">word-char</property> | ||
238 | <property name="left-margin">8</property> | ||
239 | <property name="right-margin">8</property> | ||
240 | <property name="top-margin">8</property> | ||
241 | <property name="bottom-margin">8</property> | ||
242 | <property name="input-hints">GTK_INPUT_HINT_SPELLCHECK | GTK_INPUT_HINT_WORD_COMPLETION | GTK_INPUT_HINT_INHIBIT_OSK | GTK_INPUT_HINT_EMOJI | GTK_INPUT_HINT_NONE</property> | ||
243 | </object> | ||
244 | <packing> | ||
245 | <property name="expand">True</property> | ||
246 | <property name="fill">True</property> | ||
247 | <property name="position">1</property> | ||
248 | </packing> | ||
249 | </child> | ||
250 | <child> | ||
251 | <object class="GtkButton" id="emoji_button"> | ||
252 | <property name="visible">True</property> | ||
253 | <property name="sensitive">False</property> | ||
254 | <property name="can-focus">True</property> | ||
255 | <property name="receives-default">True</property> | ||
256 | <property name="valign">center</property> | ||
257 | <property name="relief">none</property> | ||
258 | <child> | ||
259 | <object class="GtkImage"> | ||
260 | <property name="visible">True</property> | ||
261 | <property name="can-focus">False</property> | ||
262 | <property name="icon-name">face-smile-symbolic</property> | ||
263 | </object> | ||
264 | </child> | ||
265 | </object> | ||
266 | <packing> | ||
267 | <property name="expand">False</property> | ||
268 | <property name="fill">True</property> | ||
269 | <property name="position">2</property> | ||
270 | </packing> | ||
271 | </child> | ||
272 | <child> | ||
273 | <object class="GtkButton" id="send_record_button"> | ||
274 | <property name="visible">True</property> | ||
275 | <property name="sensitive">False</property> | ||
276 | <property name="can-focus">True</property> | ||
277 | <property name="receives-default">True</property> | ||
278 | <property name="valign">center</property> | ||
279 | <property name="relief">none</property> | ||
280 | <child> | ||
281 | <object class="GtkImage" id="send_record_symbol"> | ||
282 | <property name="visible">True</property> | ||
283 | <property name="can-focus">False</property> | ||
284 | <property name="icon-name">audio-input-microphone-symbolic</property> | ||
285 | </object> | ||
286 | </child> | ||
287 | </object> | ||
288 | <packing> | ||
289 | <property name="expand">False</property> | ||
290 | <property name="fill">True</property> | ||
291 | <property name="position">3</property> | ||
158 | </packing> | 292 | </packing> |
159 | </child> | 293 | </child> |
160 | </object> | 294 | </object> |
295 | <packing> | ||
296 | <property name="expand">False</property> | ||
297 | <property name="fill">True</property> | ||
298 | <property name="pack-type">end</property> | ||
299 | <property name="position">3</property> | ||
300 | </packing> | ||
161 | </child> | 301 | </child> |
162 | </object> | 302 | </object> |
163 | </child> | 303 | </child> |
164 | </object> | 304 | <child type="separator"> |
165 | <packing> | 305 | <object class="GtkSeparator"> |
166 | <property name="expand">True</property> | ||
167 | <property name="fill">True</property> | ||
168 | <property name="position">1</property> | ||
169 | </packing> | ||
170 | </child> | ||
171 | <child> | ||
172 | <object class="GtkRevealer" id="picker_revealer"> | ||
173 | <property name="visible">True</property> | ||
174 | <property name="can-focus">False</property> | ||
175 | <property name="transition-type">slide-up</property> | ||
176 | <child> | ||
177 | <placeholder/> | ||
178 | </child> | ||
179 | </object> | ||
180 | <packing> | ||
181 | <property name="expand">False</property> | ||
182 | <property name="fill">True</property> | ||
183 | <property name="pack-type">end</property> | ||
184 | <property name="position">2</property> | ||
185 | </packing> | ||
186 | </child> | ||
187 | <child> | ||
188 | <object class="GtkBox"> | ||
189 | <property name="visible">True</property> | ||
190 | <property name="can-focus">False</property> | ||
191 | <property name="margin-start">4</property> | ||
192 | <property name="margin-end">4</property> | ||
193 | <property name="border-width">4</property> | ||
194 | <property name="spacing">4</property> | ||
195 | <child> | ||
196 | <object class="GtkButton" id="attach_file_button"> | ||
197 | <property name="visible">True</property> | ||
198 | <property name="sensitive">False</property> | ||
199 | <property name="can-focus">True</property> | ||
200 | <property name="receives-default">True</property> | ||
201 | <property name="valign">center</property> | ||
202 | <property name="relief">none</property> | ||
203 | <child> | ||
204 | <object class="GtkImage"> | ||
205 | <property name="visible">True</property> | ||
206 | <property name="can-focus">False</property> | ||
207 | <property name="icon-name">mail-attachment-symbolic</property> | ||
208 | </object> | ||
209 | </child> | ||
210 | </object> | ||
211 | <packing> | ||
212 | <property name="expand">False</property> | ||
213 | <property name="fill">True</property> | ||
214 | <property name="position">0</property> | ||
215 | </packing> | ||
216 | </child> | ||
217 | <child> | ||
218 | <object class="GtkTextView" id="send_text_view"> | ||
219 | <property name="width-request">210</property> | ||
220 | <property name="height-request">48</property> | ||
221 | <property name="visible">True</property> | 306 | <property name="visible">True</property> |
222 | <property name="sensitive">False</property> | 307 | <property name="can-focus">False</property> |
223 | <property name="can-focus">True</property> | ||
224 | <property name="valign">end</property> | ||
225 | <property name="editable">False</property> | ||
226 | <property name="wrap-mode">word-char</property> | ||
227 | <property name="left-margin">8</property> | ||
228 | <property name="right-margin">8</property> | ||
229 | <property name="top-margin">8</property> | ||
230 | <property name="bottom-margin">8</property> | ||
231 | <property name="input-hints">GTK_INPUT_HINT_SPELLCHECK | GTK_INPUT_HINT_WORD_COMPLETION | GTK_INPUT_HINT_INHIBIT_OSK | GTK_INPUT_HINT_EMOJI | GTK_INPUT_HINT_NONE</property> | ||
232 | </object> | 308 | </object> |
233 | <packing> | ||
234 | <property name="expand">True</property> | ||
235 | <property name="fill">True</property> | ||
236 | <property name="position">1</property> | ||
237 | </packing> | ||
238 | </child> | 309 | </child> |
239 | <child> | 310 | <child type="flap"> |
240 | <object class="GtkButton" id="emoji_button"> | 311 | <object class="GtkBox"> |
241 | <property name="visible">True</property> | 312 | <property name="visible">True</property> |
242 | <property name="sensitive">False</property> | 313 | <property name="can-focus">False</property> |
243 | <property name="can-focus">True</property> | 314 | <property name="orientation">vertical</property> |
244 | <property name="receives-default">True</property> | ||
245 | <property name="valign">center</property> | ||
246 | <property name="relief">none</property> | ||
247 | <child> | 315 | <child> |
248 | <object class="GtkImage"> | 316 | <object class="GtkBox" id="details-header-box"> |
317 | <property name="width-request">250</property> | ||
249 | <property name="visible">True</property> | 318 | <property name="visible">True</property> |
250 | <property name="can-focus">False</property> | 319 | <property name="can-focus">False</property> |
251 | <property name="icon-name">face-smile-symbolic</property> | 320 | <property name="border-width">8</property> |
321 | <child> | ||
322 | <object class="GtkBox"> | ||
323 | <property name="visible">True</property> | ||
324 | <property name="can-focus">False</property> | ||
325 | <property name="spacing">8</property> | ||
326 | <child> | ||
327 | <object class="GtkLabel" id="chat_details_label"> | ||
328 | <property name="visible">True</property> | ||
329 | <property name="can-focus">False</property> | ||
330 | <property name="xpad">8</property> | ||
331 | <property name="xalign">0</property> | ||
332 | <attributes> | ||
333 | <attribute name="weight" value="bold"/> | ||
334 | </attributes> | ||
335 | </object> | ||
336 | <packing> | ||
337 | <property name="expand">True</property> | ||
338 | <property name="fill">True</property> | ||
339 | <property name="position">0</property> | ||
340 | </packing> | ||
341 | </child> | ||
342 | <child> | ||
343 | <object class="GtkButton" id="hide_chat_details_button"> | ||
344 | <property name="visible">True</property> | ||
345 | <property name="can-focus">True</property> | ||
346 | <property name="receives-default">True</property> | ||
347 | <property name="relief">none</property> | ||
348 | <child> | ||
349 | <object class="GtkImage"> | ||
350 | <property name="visible">True</property> | ||
351 | <property name="can-focus">False</property> | ||
352 | <property name="icon-name">window-close-symbolic</property> | ||
353 | </object> | ||
354 | </child> | ||
355 | </object> | ||
356 | <packing> | ||
357 | <property name="expand">False</property> | ||
358 | <property name="fill">True</property> | ||
359 | <property name="pack-type">end</property> | ||
360 | <property name="position">1</property> | ||
361 | </packing> | ||
362 | </child> | ||
363 | </object> | ||
364 | <packing> | ||
365 | <property name="expand">True</property> | ||
366 | <property name="fill">True</property> | ||
367 | <property name="position">0</property> | ||
368 | </packing> | ||
369 | </child> | ||
252 | </object> | 370 | </object> |
371 | <packing> | ||
372 | <property name="expand">False</property> | ||
373 | <property name="fill">True</property> | ||
374 | <property name="position">0</property> | ||
375 | </packing> | ||
253 | </child> | 376 | </child> |
254 | </object> | ||
255 | <packing> | ||
256 | <property name="expand">False</property> | ||
257 | <property name="fill">True</property> | ||
258 | <property name="position">2</property> | ||
259 | </packing> | ||
260 | </child> | ||
261 | <child> | ||
262 | <object class="GtkButton" id="send_record_button"> | ||
263 | <property name="visible">True</property> | ||
264 | <property name="sensitive">False</property> | ||
265 | <property name="can-focus">True</property> | ||
266 | <property name="receives-default">True</property> | ||
267 | <property name="valign">center</property> | ||
268 | <property name="relief">none</property> | ||
269 | <child> | 377 | <child> |
270 | <object class="GtkImage" id="send_record_symbol"> | 378 | <object class="GtkScrolledWindow"> |
271 | <property name="visible">True</property> | 379 | <property name="visible">True</property> |
272 | <property name="can-focus">False</property> | 380 | <property name="can-focus">True</property> |
273 | <property name="icon-name">audio-input-microphone-symbolic</property> | 381 | <child> |
382 | <object class="GtkViewport"> | ||
383 | <property name="visible">True</property> | ||
384 | <property name="can-focus">False</property> | ||
385 | <property name="shadow-type">none</property> | ||
386 | <child> | ||
387 | <object class="GtkBox"> | ||
388 | <property name="visible">True</property> | ||
389 | <property name="can-focus">False</property> | ||
390 | <property name="orientation">vertical</property> | ||
391 | <child> | ||
392 | <object class="GtkBox"> | ||
393 | <property name="visible">True</property> | ||
394 | <property name="can-focus">False</property> | ||
395 | <child> | ||
396 | <object class="GtkLabel"> | ||
397 | <property name="visible">True</property> | ||
398 | <property name="can-focus">False</property> | ||
399 | <property name="label" translatable="yes">Notifications</property> | ||
400 | </object> | ||
401 | <packing> | ||
402 | <property name="expand">False</property> | ||
403 | <property name="fill">True</property> | ||
404 | <property name="position">0</property> | ||
405 | </packing> | ||
406 | </child> | ||
407 | <child> | ||
408 | <object class="GtkSwitch"> | ||
409 | <property name="visible">True</property> | ||
410 | <property name="can-focus">True</property> | ||
411 | </object> | ||
412 | <packing> | ||
413 | <property name="expand">False</property> | ||
414 | <property name="fill">True</property> | ||
415 | <property name="pack-type">end</property> | ||
416 | <property name="position">1</property> | ||
417 | </packing> | ||
418 | </child> | ||
419 | <style> | ||
420 | <class name="details-entry"/> | ||
421 | </style> | ||
422 | </object> | ||
423 | <packing> | ||
424 | <property name="expand">False</property> | ||
425 | <property name="fill">True</property> | ||
426 | <property name="position">0</property> | ||
427 | </packing> | ||
428 | </child> | ||
429 | <child> | ||
430 | <object class="GtkBox" id="chat_details_contacts_box"> | ||
431 | <property name="visible">True</property> | ||
432 | <property name="can-focus">False</property> | ||
433 | <property name="orientation">vertical</property> | ||
434 | <child> | ||
435 | <object class="GtkLabel"> | ||
436 | <property name="visible">True</property> | ||
437 | <property name="can-focus">False</property> | ||
438 | <property name="label" translatable="yes">Contacts</property> | ||
439 | <property name="xalign">0</property> | ||
440 | <attributes> | ||
441 | <attribute name="weight" value="semibold"/> | ||
442 | </attributes> | ||
443 | <style> | ||
444 | <class name="details-group-title"/> | ||
445 | </style> | ||
446 | </object> | ||
447 | <packing> | ||
448 | <property name="expand">False</property> | ||
449 | <property name="fill">True</property> | ||
450 | <property name="position">0</property> | ||
451 | </packing> | ||
452 | </child> | ||
453 | <child> | ||
454 | <object class="GtkListBox" id="chat_contacts_listbox"> | ||
455 | <property name="visible">True</property> | ||
456 | <property name="can-focus">False</property> | ||
457 | <property name="selection-mode">none</property> | ||
458 | <child> | ||
459 | <object class="GtkListBoxRow"> | ||
460 | <property name="visible">True</property> | ||
461 | <property name="can-focus">True</property> | ||
462 | <child> | ||
463 | <object class="GtkBox"> | ||
464 | <property name="visible">True</property> | ||
465 | <property name="can-focus">False</property> | ||
466 | <property name="spacing">8</property> | ||
467 | <child> | ||
468 | <object class="GtkImage"> | ||
469 | <property name="width-request">36</property> | ||
470 | <property name="height-request">36</property> | ||
471 | <property name="visible">True</property> | ||
472 | <property name="can-focus">False</property> | ||
473 | <property name="icon-name">list-add-symbolic</property> | ||
474 | <property name="icon_size">3</property> | ||
475 | </object> | ||
476 | <packing> | ||
477 | <property name="expand">False</property> | ||
478 | <property name="fill">True</property> | ||
479 | <property name="position">0</property> | ||
480 | </packing> | ||
481 | </child> | ||
482 | <child> | ||
483 | <object class="GtkLabel"> | ||
484 | <property name="visible">True</property> | ||
485 | <property name="can-focus">False</property> | ||
486 | <property name="label" translatable="yes">Invite Contact</property> | ||
487 | </object> | ||
488 | <packing> | ||
489 | <property name="expand">False</property> | ||
490 | <property name="fill">True</property> | ||
491 | <property name="position">1</property> | ||
492 | </packing> | ||
493 | </child> | ||
494 | <style> | ||
495 | <class name="profile-entry"/> | ||
496 | </style> | ||
497 | </object> | ||
498 | </child> | ||
499 | </object> | ||
500 | </child> | ||
501 | </object> | ||
502 | <packing> | ||
503 | <property name="expand">False</property> | ||
504 | <property name="fill">True</property> | ||
505 | <property name="position">1</property> | ||
506 | </packing> | ||
507 | </child> | ||
508 | <style> | ||
509 | <class name="details-group"/> | ||
510 | </style> | ||
511 | </object> | ||
512 | <packing> | ||
513 | <property name="expand">False</property> | ||
514 | <property name="fill">True</property> | ||
515 | <property name="position">1</property> | ||
516 | </packing> | ||
517 | </child> | ||
518 | </object> | ||
519 | </child> | ||
520 | </object> | ||
521 | </child> | ||
274 | </object> | 522 | </object> |
523 | <packing> | ||
524 | <property name="expand">True</property> | ||
525 | <property name="fill">True</property> | ||
526 | <property name="position">1</property> | ||
527 | </packing> | ||
275 | </child> | 528 | </child> |
529 | <style> | ||
530 | <class name="flap-background"/> | ||
531 | </style> | ||
276 | </object> | 532 | </object> |
277 | <packing> | ||
278 | <property name="expand">False</property> | ||
279 | <property name="fill">True</property> | ||
280 | <property name="position">3</property> | ||
281 | </packing> | ||
282 | </child> | 533 | </child> |
283 | </object> | 534 | </object> |
284 | <packing> | 535 | <packing> |
285 | <property name="expand">False</property> | 536 | <property name="expand">True</property> |
286 | <property name="fill">True</property> | 537 | <property name="fill">True</property> |
287 | <property name="pack-type">end</property> | 538 | <property name="position">1</property> |
288 | <property name="position">3</property> | ||
289 | </packing> | 539 | </packing> |
290 | </child> | 540 | </child> |
291 | </object> | 541 | </object> |
diff --git a/resources/ui/messenger.ui b/resources/ui/messenger.ui index e917f98..d79f875 100644 --- a/resources/ui/messenger.ui +++ b/resources/ui/messenger.ui | |||
@@ -718,164 +718,43 @@ Author: Tobias Frisch | |||
718 | <property name="hexpand">True</property> | 718 | <property name="hexpand">True</property> |
719 | <property name="orientation">vertical</property> | 719 | <property name="orientation">vertical</property> |
720 | <child> | 720 | <child> |
721 | <object class="HdyFlap" id="flap_chat_details"> | 721 | <object class="GtkStack" id="chats_stack"> |
722 | <property name="visible">True</property> | 722 | <property name="visible">True</property> |
723 | <property name="can-focus">False</property> | 723 | <property name="can-focus">False</property> |
724 | <property name="flap-position">end</property> | ||
725 | <property name="reveal-flap">False</property> | ||
726 | <property name="fold-policy">always</property> | ||
727 | <child> | 724 | <child> |
728 | <object class="GtkStack" id="chats_stack"> | ||
729 | <property name="visible">True</property> | ||
730 | <property name="can-focus">False</property> | ||
731 | <child> | ||
732 | <object class="GtkBox"> | ||
733 | <property name="visible">True</property> | ||
734 | <property name="can-focus">False</property> | ||
735 | <property name="orientation">vertical</property> | ||
736 | <child> | ||
737 | <object class="GtkLabel"> | ||
738 | <property name="visible">True</property> | ||
739 | <property name="can-focus">False</property> | ||
740 | <property name="halign">center</property> | ||
741 | <property name="valign">center</property> | ||
742 | <property name="label" translatable="yes">Select a chat to start messaging...</property> | ||
743 | <style> | ||
744 | <class name="message-box"/> | ||
745 | <class name="status"/> | ||
746 | </style> | ||
747 | </object> | ||
748 | <packing> | ||
749 | <property name="expand">True</property> | ||
750 | <property name="fill">True</property> | ||
751 | <property name="position">0</property> | ||
752 | </packing> | ||
753 | </child> | ||
754 | </object> | ||
755 | <packing> | ||
756 | <property name="name">page0</property> | ||
757 | <property name="title" translatable="yes">page0</property> | ||
758 | </packing> | ||
759 | </child> | ||
760 | </object> | ||
761 | </child> | ||
762 | <child type="separator"> | ||
763 | <object class="GtkSeparator"> | ||
764 | <property name="visible">True</property> | ||
765 | <property name="can-focus">False</property> | ||
766 | </object> | ||
767 | </child> | ||
768 | <child type="flap"> | ||
769 | <object class="GtkBox"> | 725 | <object class="GtkBox"> |
770 | <property name="visible">True</property> | 726 | <property name="visible">True</property> |
771 | <property name="can-focus">False</property> | 727 | <property name="can-focus">False</property> |
772 | <property name="orientation">vertical</property> | 728 | <property name="orientation">vertical</property> |
773 | <child> | 729 | <child> |
774 | <object class="GtkBox" id="details-header-box"> | 730 | <object class="GtkLabel"> |
775 | <property name="width-request">250</property> | ||
776 | <property name="visible">True</property> | 731 | <property name="visible">True</property> |
777 | <property name="can-focus">False</property> | 732 | <property name="can-focus">False</property> |
778 | <property name="border-width">8</property> | 733 | <property name="halign">center</property> |
779 | <child> | 734 | <property name="valign">center</property> |
780 | <object class="GtkStack"> | 735 | <property name="label" translatable="yes">Select a chat to start messaging...</property> |
781 | <property name="visible">True</property> | 736 | <style> |
782 | <property name="can-focus">False</property> | 737 | <class name="message-box"/> |
783 | <child> | 738 | <class name="status"/> |
784 | <object class="GtkBox"> | 739 | </style> |
785 | <property name="visible">True</property> | ||
786 | <property name="can-focus">False</property> | ||
787 | <property name="spacing">8</property> | ||
788 | <child> | ||
789 | <object class="GtkLabel"> | ||
790 | <property name="visible">True</property> | ||
791 | <property name="can-focus">False</property> | ||
792 | <property name="xpad">8</property> | ||
793 | <property name="label" translatable="yes">Chat Details</property> | ||
794 | <property name="xalign">0</property> | ||
795 | </object> | ||
796 | <packing> | ||
797 | <property name="expand">True</property> | ||
798 | <property name="fill">True</property> | ||
799 | <property name="position">0</property> | ||
800 | </packing> | ||
801 | </child> | ||
802 | <child> | ||
803 | <object class="GtkButton" id="hide_chat_details_button"> | ||
804 | <property name="visible">True</property> | ||
805 | <property name="can-focus">True</property> | ||
806 | <property name="receives-default">True</property> | ||
807 | <property name="relief">none</property> | ||
808 | <child> | ||
809 | <object class="GtkImage"> | ||
810 | <property name="visible">True</property> | ||
811 | <property name="can-focus">False</property> | ||
812 | <property name="icon-name">window-close-symbolic</property> | ||
813 | </object> | ||
814 | </child> | ||
815 | </object> | ||
816 | <packing> | ||
817 | <property name="expand">False</property> | ||
818 | <property name="fill">True</property> | ||
819 | <property name="pack-type">end</property> | ||
820 | <property name="position">1</property> | ||
821 | </packing> | ||
822 | </child> | ||
823 | </object> | ||
824 | <packing> | ||
825 | <property name="name">page0</property> | ||
826 | <property name="title" translatable="yes">page0</property> | ||
827 | </packing> | ||
828 | </child> | ||
829 | </object> | ||
830 | <packing> | ||
831 | <property name="expand">True</property> | ||
832 | <property name="fill">True</property> | ||
833 | <property name="position">0</property> | ||
834 | </packing> | ||
835 | </child> | ||
836 | </object> | ||
837 | <packing> | ||
838 | <property name="expand">False</property> | ||
839 | <property name="fill">True</property> | ||
840 | <property name="position">0</property> | ||
841 | </packing> | ||
842 | </child> | ||
843 | <child> | ||
844 | <object class="GtkScrolledWindow"> | ||
845 | <property name="visible">True</property> | ||
846 | <property name="can-focus">True</property> | ||
847 | <child> | ||
848 | <object class="GtkViewport"> | ||
849 | <property name="visible">True</property> | ||
850 | <property name="can-focus">False</property> | ||
851 | <child> | ||
852 | <object class="GtkStack"> | ||
853 | <property name="visible">True</property> | ||
854 | <property name="can-focus">False</property> | ||
855 | <child> | ||
856 | <placeholder/> | ||
857 | </child> | ||
858 | </object> | ||
859 | </child> | ||
860 | </object> | ||
861 | </child> | ||
862 | </object> | 740 | </object> |
863 | <packing> | 741 | <packing> |
864 | <property name="expand">True</property> | 742 | <property name="expand">True</property> |
865 | <property name="fill">True</property> | 743 | <property name="fill">True</property> |
866 | <property name="position">1</property> | 744 | <property name="position">0</property> |
867 | </packing> | 745 | </packing> |
868 | </child> | 746 | </child> |
869 | <style> | ||
870 | <class name="flap-background"/> | ||
871 | </style> | ||
872 | </object> | 747 | </object> |
748 | <packing> | ||
749 | <property name="name">page0</property> | ||
750 | <property name="title" translatable="yes">page0</property> | ||
751 | </packing> | ||
873 | </child> | 752 | </child> |
874 | </object> | 753 | </object> |
875 | <packing> | 754 | <packing> |
876 | <property name="expand">True</property> | 755 | <property name="expand">True</property> |
877 | <property name="fill">True</property> | 756 | <property name="fill">True</property> |
878 | <property name="position">3</property> | 757 | <property name="position">0</property> |
879 | </packing> | 758 | </packing> |
880 | </child> | 759 | </child> |
881 | </object> | 760 | </object> |
diff --git a/src/event.c b/src/event.c index a1cb4fc..f63598d 100644 --- a/src/event.c +++ b/src/event.c | |||
@@ -35,31 +35,13 @@ _add_new_chat_entry(MESSENGER_Application *app, | |||
35 | { | 35 | { |
36 | UI_MESSENGER_Handle *ui = &(app->ui.messenger); | 36 | UI_MESSENGER_Handle *ui = &(app->ui.messenger); |
37 | 37 | ||
38 | const struct GNUNET_CHAT_Contact* contact; | 38 | UI_CHAT_ENTRY_Handle *entry = ui_chat_entry_new(app); |
39 | const struct GNUNET_CHAT_Group* group; | ||
40 | |||
41 | contact = GNUNET_CHAT_context_get_contact(context); | ||
42 | group = GNUNET_CHAT_context_get_group(context); | ||
43 | |||
44 | const char *title = NULL; | ||
45 | 39 | ||
46 | if (contact) | 40 | ui_chat_entry_update(entry, context); |
47 | title = GNUNET_CHAT_contact_get_name(contact); | ||
48 | else if (group) | ||
49 | title = GNUNET_CHAT_group_get_name(group); | ||
50 | 41 | ||
51 | UI_CHAT_ENTRY_Handle *entry = ui_chat_entry_new(app); | ||
52 | gtk_container_add(GTK_CONTAINER(ui->chats_listbox), entry->entry_box); | 42 | gtk_container_add(GTK_CONTAINER(ui->chats_listbox), entry->entry_box); |
53 | GNUNET_CHAT_context_set_user_pointer(context, entry); | 43 | GNUNET_CHAT_context_set_user_pointer(context, entry); |
54 | 44 | ||
55 | if (title) | ||
56 | { | ||
57 | gtk_label_set_text(entry->title_label, title); | ||
58 | hdy_avatar_set_text(entry->entry_avatar, title); | ||
59 | |||
60 | gtk_label_set_text(entry->chat->chat_title, title); | ||
61 | } | ||
62 | |||
63 | char context_id [9]; | 45 | char context_id [9]; |
64 | g_snprintf(context_id, sizeof(context_id), "%08lx", (gulong) context); | 46 | g_snprintf(context_id, sizeof(context_id), "%08lx", (gulong) context); |
65 | 47 | ||
@@ -181,10 +163,7 @@ event_joining_contact(MESSENGER_Application *app, | |||
181 | if (!handle) | 163 | if (!handle) |
182 | return; | 164 | return; |
183 | 165 | ||
184 | int status = GNUNET_CHAT_context_get_status(context); | 166 | ui_chat_entry_update(handle, context); |
185 | |||
186 | if (GNUNET_OK == status) | ||
187 | ui_chat_entry_activate(handle); | ||
188 | 167 | ||
189 | UI_MESSAGE_Handle *message = ui_message_new(app, UI_MESSAGE_STATUS); | 168 | UI_MESSAGE_Handle *message = ui_message_new(app, UI_MESSAGE_STATUS); |
190 | 169 | ||
diff --git a/src/ui/chat.c b/src/ui/chat.c index 73e014c..0ddd59c 100644 --- a/src/ui/chat.c +++ b/src/ui/chat.c | |||
@@ -26,6 +26,7 @@ | |||
26 | 26 | ||
27 | #include "messenger.h" | 27 | #include "messenger.h" |
28 | #include "picker.h" | 28 | #include "picker.h" |
29 | #include "profile_entry.h" | ||
29 | #include "../application.h" | 30 | #include "../application.h" |
30 | 31 | ||
31 | static void | 32 | static void |
@@ -176,6 +177,10 @@ ui_chat_new(MESSENGER_Application *app) | |||
176 | messenger->leaflet_chat | 177 | messenger->leaflet_chat |
177 | ); | 178 | ); |
178 | 179 | ||
180 | handle->flap_chat_details = HDY_FLAP( | ||
181 | gtk_builder_get_object(handle->builder, "flap_chat_details") | ||
182 | ); | ||
183 | |||
179 | handle->chat_title = GTK_LABEL( | 184 | handle->chat_title = GTK_LABEL( |
180 | gtk_builder_get_object(handle->builder, "chat_title") | 185 | gtk_builder_get_object(handle->builder, "chat_title") |
181 | ); | 186 | ); |
@@ -192,7 +197,30 @@ ui_chat_new(MESSENGER_Application *app) | |||
192 | handle->chat_details_button, | 197 | handle->chat_details_button, |
193 | "clicked", | 198 | "clicked", |
194 | G_CALLBACK(handle_flap_via_button_click), | 199 | G_CALLBACK(handle_flap_via_button_click), |
195 | messenger->flap_chat_details | 200 | handle->flap_chat_details |
201 | ); | ||
202 | |||
203 | handle->chat_details_label = GTK_LABEL( | ||
204 | gtk_builder_get_object(handle->builder, "chat_details_label") | ||
205 | ); | ||
206 | |||
207 | handle->hide_chat_details_button = GTK_BUTTON( | ||
208 | gtk_builder_get_object(handle->builder, "hide_chat_details_button") | ||
209 | ); | ||
210 | |||
211 | g_signal_connect( | ||
212 | handle->hide_chat_details_button, | ||
213 | "clicked", | ||
214 | G_CALLBACK(handle_flap_via_button_click), | ||
215 | handle->flap_chat_details | ||
216 | ); | ||
217 | |||
218 | handle->chat_details_contacts_box = GTK_BOX( | ||
219 | gtk_builder_get_object(handle->builder, "chat_details_contacts_box") | ||
220 | ); | ||
221 | |||
222 | handle->chat_contacts_listbox = GTK_LIST_BOX( | ||
223 | gtk_builder_get_object(handle->builder, "chat_contacts_listbox") | ||
196 | ); | 224 | ); |
197 | 225 | ||
198 | handle->messages_listbox = GTK_LIST_BOX( | 226 | handle->messages_listbox = GTK_LIST_BOX( |
@@ -271,15 +299,86 @@ ui_chat_new(MESSENGER_Application *app) | |||
271 | return handle; | 299 | return handle; |
272 | } | 300 | } |
273 | 301 | ||
302 | static int | ||
303 | iterate_ui_chat_update_group_contacts(void *cls, | ||
304 | UNUSED const struct GNUNET_CHAT_Group *group, | ||
305 | struct GNUNET_CHAT_Contact *contact) | ||
306 | { | ||
307 | GtkListBox *listbox = GTK_LIST_BOX(cls); | ||
308 | UI_PROFILE_ENTRY_Handle* entry = ui_profile_entry_new(); | ||
309 | |||
310 | const char *name = GNUNET_CHAT_contact_get_name(contact); | ||
311 | |||
312 | if (name) | ||
313 | { | ||
314 | gtk_label_set_text(entry->entry_label, name); | ||
315 | hdy_avatar_set_text(entry->entry_avatar, name); | ||
316 | } | ||
317 | |||
318 | gtk_list_box_prepend(listbox, entry->entry_box); | ||
319 | |||
320 | ui_profile_entry_delete(entry); | ||
321 | return GNUNET_YES; | ||
322 | } | ||
323 | |||
274 | void | 324 | void |
275 | ui_chat_activate(UI_CHAT_Handle *handle) | 325 | ui_chat_update(UI_CHAT_Handle *handle, |
326 | const struct GNUNET_CHAT_Context* context) | ||
276 | { | 327 | { |
277 | gtk_text_view_set_editable(handle->send_text_view, TRUE); | 328 | const struct GNUNET_CHAT_Contact* contact; |
278 | gtk_widget_set_sensitive(GTK_WIDGET(handle->send_text_view), TRUE); | 329 | const struct GNUNET_CHAT_Group* group; |
330 | |||
331 | contact = GNUNET_CHAT_context_get_contact(context); | ||
332 | group = GNUNET_CHAT_context_get_group(context); | ||
333 | |||
334 | const char *title = NULL; | ||
335 | |||
336 | if (contact) | ||
337 | title = GNUNET_CHAT_contact_get_name(contact); | ||
338 | else if (group) | ||
339 | title = GNUNET_CHAT_group_get_name(group); | ||
340 | |||
341 | if (title) | ||
342 | { | ||
343 | gtk_label_set_text(handle->chat_title, title); | ||
344 | gtk_label_set_text(handle->chat_details_label, title); | ||
345 | } | ||
346 | |||
347 | GList* children = gtk_container_get_children( | ||
348 | GTK_CONTAINER(handle->chat_contacts_listbox) | ||
349 | ); | ||
350 | |||
351 | while ((children) && (children->next)) { | ||
352 | GtkWidget *widget = GTK_WIDGET(children->data); | ||
353 | children = children->next; | ||
354 | |||
355 | gtk_container_remove( | ||
356 | GTK_CONTAINER(handle->chat_contacts_listbox), | ||
357 | widget | ||
358 | ); | ||
359 | } | ||
360 | |||
361 | if (group) | ||
362 | GNUNET_CHAT_group_iterate_contacts( | ||
363 | group, | ||
364 | iterate_ui_chat_update_group_contacts, | ||
365 | handle->chat_contacts_listbox | ||
366 | ); | ||
367 | |||
368 | gtk_widget_set_visible( | ||
369 | GTK_WIDGET(handle->chat_details_contacts_box), | ||
370 | group? TRUE : FALSE | ||
371 | ); | ||
372 | |||
373 | const int status = GNUNET_CHAT_context_get_status(context); | ||
374 | const gboolean activated = (GNUNET_OK == status? TRUE : FALSE); | ||
375 | |||
376 | gtk_text_view_set_editable(handle->send_text_view, activated); | ||
377 | gtk_widget_set_sensitive(GTK_WIDGET(handle->send_text_view), activated); | ||
279 | 378 | ||
280 | gtk_widget_set_sensitive(GTK_WIDGET(handle->attach_file_button), TRUE); | 379 | gtk_widget_set_sensitive(GTK_WIDGET(handle->attach_file_button), activated); |
281 | gtk_widget_set_sensitive(GTK_WIDGET(handle->emoji_button), TRUE); | 380 | gtk_widget_set_sensitive(GTK_WIDGET(handle->emoji_button), activated); |
282 | gtk_widget_set_sensitive(GTK_WIDGET(handle->send_record_button), TRUE); | 381 | gtk_widget_set_sensitive(GTK_WIDGET(handle->send_record_button), activated); |
283 | } | 382 | } |
284 | 383 | ||
285 | void | 384 | void |
diff --git a/src/ui/chat.h b/src/ui/chat.h index 68b2eb3..ce1df94 100644 --- a/src/ui/chat.h +++ b/src/ui/chat.h | |||
@@ -29,6 +29,8 @@ | |||
29 | #include <libhandy-1/handy.h> | 29 | #include <libhandy-1/handy.h> |
30 | #include <libnotify/notify.h> | 30 | #include <libnotify/notify.h> |
31 | 31 | ||
32 | #include <gnunet/gnunet_chat_lib.h> | ||
33 | |||
32 | typedef struct MESSENGER_Application MESSENGER_Application; | 34 | typedef struct MESSENGER_Application MESSENGER_Application; |
33 | typedef struct UI_PICKER_Handle UI_PICKER_Handle; | 35 | typedef struct UI_PICKER_Handle UI_PICKER_Handle; |
34 | 36 | ||
@@ -39,10 +41,17 @@ typedef struct UI_CHAT_Handle | |||
39 | 41 | ||
40 | GtkButton *back_button; | 42 | GtkButton *back_button; |
41 | 43 | ||
44 | HdyFlap *flap_chat_details; | ||
45 | |||
42 | GtkLabel *chat_title; | 46 | GtkLabel *chat_title; |
43 | GtkLabel *chat_subtitle; | 47 | GtkLabel *chat_subtitle; |
44 | GtkButton *chat_details_button; | 48 | GtkButton *chat_details_button; |
45 | 49 | ||
50 | GtkLabel *chat_details_label; | ||
51 | GtkButton *hide_chat_details_button; | ||
52 | GtkBox *chat_details_contacts_box; | ||
53 | |||
54 | GtkListBox *chat_contacts_listbox; | ||
46 | GtkListBox *messages_listbox; | 55 | GtkListBox *messages_listbox; |
47 | 56 | ||
48 | GtkButton *attach_file_button; | 57 | GtkButton *attach_file_button; |
@@ -60,7 +69,8 @@ UI_CHAT_Handle* | |||
60 | ui_chat_new(MESSENGER_Application *app); | 69 | ui_chat_new(MESSENGER_Application *app); |
61 | 70 | ||
62 | void | 71 | void |
63 | ui_chat_activate(UI_CHAT_Handle *handle); | 72 | ui_chat_update(UI_CHAT_Handle *handle, |
73 | const struct GNUNET_CHAT_Context* context); | ||
64 | 74 | ||
65 | void | 75 | void |
66 | ui_chat_delete(UI_CHAT_Handle *handle); | 76 | ui_chat_delete(UI_CHAT_Handle *handle); |
diff --git a/src/ui/chat_entry.c b/src/ui/chat_entry.c index 33d969c..c7f07ff 100644 --- a/src/ui/chat_entry.c +++ b/src/ui/chat_entry.c | |||
@@ -62,9 +62,30 @@ ui_chat_entry_new(MESSENGER_Application *app) | |||
62 | } | 62 | } |
63 | 63 | ||
64 | void | 64 | void |
65 | ui_chat_entry_activate(UI_CHAT_ENTRY_Handle *handle) | 65 | ui_chat_entry_update(UI_CHAT_ENTRY_Handle *handle, |
66 | const struct GNUNET_CHAT_Context *context) | ||
66 | { | 67 | { |
67 | ui_chat_activate(handle->chat); | 68 | const struct GNUNET_CHAT_Contact* contact; |
69 | const struct GNUNET_CHAT_Group* group; | ||
70 | |||
71 | contact = GNUNET_CHAT_context_get_contact(context); | ||
72 | group = GNUNET_CHAT_context_get_group(context); | ||
73 | |||
74 | const char *title = NULL; | ||
75 | |||
76 | if (contact) | ||
77 | title = GNUNET_CHAT_contact_get_name(contact); | ||
78 | else if (group) | ||
79 | title = GNUNET_CHAT_group_get_name(group); | ||
80 | |||
81 | if (title) | ||
82 | { | ||
83 | gtk_label_set_text(handle->title_label, title); | ||
84 | hdy_avatar_set_text(handle->entry_avatar, title); | ||
85 | } | ||
86 | |||
87 | if (handle->chat) | ||
88 | ui_chat_update(handle->chat, context); | ||
68 | } | 89 | } |
69 | 90 | ||
70 | void | 91 | void |
diff --git a/src/ui/chat_entry.h b/src/ui/chat_entry.h index 743429a..82b431a 100644 --- a/src/ui/chat_entry.h +++ b/src/ui/chat_entry.h | |||
@@ -47,7 +47,8 @@ UI_CHAT_ENTRY_Handle* | |||
47 | ui_chat_entry_new(MESSENGER_Application *app); | 47 | ui_chat_entry_new(MESSENGER_Application *app); |
48 | 48 | ||
49 | void | 49 | void |
50 | ui_chat_entry_activate(UI_CHAT_ENTRY_Handle *handle); | 50 | ui_chat_entry_update(UI_CHAT_ENTRY_Handle *handle, |
51 | const struct GNUNET_CHAT_Context *context); | ||
51 | 52 | ||
52 | void | 53 | void |
53 | ui_chat_entry_delete(UI_CHAT_ENTRY_Handle *handle); | 54 | ui_chat_entry_delete(UI_CHAT_ENTRY_Handle *handle); |
diff --git a/src/ui/messenger.c b/src/ui/messenger.c index 17b30a5..1d09608 100644 --- a/src/ui/messenger.c +++ b/src/ui/messenger.c | |||
@@ -218,10 +218,6 @@ ui_messenger_init(MESSENGER_Application *app, | |||
218 | gtk_builder_get_object(handle->builder, "flap_user_details") | 218 | gtk_builder_get_object(handle->builder, "flap_user_details") |
219 | ); | 219 | ); |
220 | 220 | ||
221 | handle->flap_chat_details = HDY_FLAP( | ||
222 | gtk_builder_get_object(handle->builder, "flap_chat_details") | ||
223 | ); | ||
224 | |||
225 | handle->title_bar = HDY_HEADER_BAR( | 221 | handle->title_bar = HDY_HEADER_BAR( |
226 | gtk_builder_get_object(handle->builder, "title_bar") | 222 | gtk_builder_get_object(handle->builder, "title_bar") |
227 | ); | 223 | ); |
@@ -390,17 +386,6 @@ ui_messenger_init(MESSENGER_Application *app, | |||
390 | gtk_builder_get_object(handle->builder, "chats_stack") | 386 | gtk_builder_get_object(handle->builder, "chats_stack") |
391 | ); | 387 | ); |
392 | 388 | ||
393 | handle->hide_chat_details_button = GTK_BUTTON( | ||
394 | gtk_builder_get_object(handle->builder, "hide_chat_details_button") | ||
395 | ); | ||
396 | |||
397 | g_signal_connect( | ||
398 | handle->hide_chat_details_button, | ||
399 | "clicked", | ||
400 | G_CALLBACK(handle_flap_via_button_click), | ||
401 | handle->flap_chat_details | ||
402 | ); | ||
403 | |||
404 | gtk_widget_show(GTK_WIDGET(handle->main_window)); | 389 | gtk_widget_show(GTK_WIDGET(handle->main_window)); |
405 | 390 | ||
406 | g_signal_connect( | 391 | g_signal_connect( |
diff --git a/src/ui/messenger.h b/src/ui/messenger.h index da2155e..44deb3c 100644 --- a/src/ui/messenger.h +++ b/src/ui/messenger.h | |||
@@ -40,7 +40,6 @@ typedef struct UI_MESSENGER_Handle | |||
40 | 40 | ||
41 | HdyLeaflet *leaflet_chat; | 41 | HdyLeaflet *leaflet_chat; |
42 | HdyFlap *flap_user_details; | 42 | HdyFlap *flap_user_details; |
43 | HdyFlap *flap_chat_details; | ||
44 | 43 | ||
45 | HdyHeaderBar *title_bar; | 44 | HdyHeaderBar *title_bar; |
46 | 45 | ||
@@ -68,8 +67,6 @@ typedef struct UI_MESSENGER_Handle | |||
68 | GtkListBox *chats_listbox; | 67 | GtkListBox *chats_listbox; |
69 | 68 | ||
70 | GtkStack *chats_stack; | 69 | GtkStack *chats_stack; |
71 | |||
72 | GtkButton *hide_chat_details_button; | ||
73 | } UI_MESSENGER_Handle; | 70 | } UI_MESSENGER_Handle; |
74 | 71 | ||
75 | void | 72 | void |