diff options
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | resources/css/style.css | 16 | ||||
-rw-r--r-- | resources/ui/chat.ui | 20 | ||||
-rw-r--r-- | resources/ui/contact_entry.ui | 11 | ||||
-rw-r--r-- | resources/ui/contacts.ui | 46 | ||||
-rw-r--r-- | resources/ui/messenger.ui | 139 | ||||
-rw-r--r-- | resources/ui/profile_entry.ui | 62 | ||||
-rw-r--r-- | src/application.c | 19 | ||||
-rw-r--r-- | src/application.h | 1 | ||||
-rw-r--r-- | src/chat/messenger.c | 2 | ||||
-rw-r--r-- | src/event.c | 21 | ||||
-rw-r--r-- | src/ui/contacts.c | 21 | ||||
-rw-r--r-- | src/ui/messenger.c | 5 | ||||
-rw-r--r-- | src/ui/messenger.h | 1 | ||||
-rw-r--r-- | src/ui/profile_entry.c | 57 | ||||
-rw-r--r-- | src/ui/profile_entry.h | 46 |
16 files changed, 397 insertions, 71 deletions
@@ -15,6 +15,7 @@ SOURCES = messenger_gtk.c\ | |||
15 | ui/messenger.c\ | 15 | ui/messenger.c\ |
16 | ui/new_contact.c\ | 16 | ui/new_contact.c\ |
17 | ui/new_platform.c\ | 17 | ui/new_platform.c\ |
18 | ui/profile_entry.c\ | ||
18 | ui/settings.c | 19 | ui/settings.c |
19 | 20 | ||
20 | HEADERS = | 21 | HEADERS = |
diff --git a/resources/css/style.css b/resources/css/style.css index 4dd8ea4..743e0c1 100644 --- a/resources/css/style.css +++ b/resources/css/style.css | |||
@@ -3,10 +3,26 @@ | |||
3 | background-color: @theme_bg_color; | 3 | background-color: @theme_bg_color; |
4 | } | 4 | } |
5 | 5 | ||
6 | .header-box { | ||
7 | min-height: 36px; | ||
8 | } | ||
9 | |||
10 | .header-subtitle { | ||
11 | font-size: small; | ||
12 | } | ||
13 | |||
14 | .profile-key { | ||
15 | font-size: xx-small; | ||
16 | } | ||
17 | |||
6 | .profile-entry { | 18 | .profile-entry { |
7 | padding: 4px 20px; | 19 | padding: 4px 20px; |
8 | } | 20 | } |
9 | 21 | ||
22 | .contact-entry { | ||
23 | padding: 2px; | ||
24 | } | ||
25 | |||
10 | .chat-entry { | 26 | .chat-entry { |
11 | padding: 4px; | 27 | padding: 4px; |
12 | } | 28 | } |
diff --git a/resources/ui/chat.ui b/resources/ui/chat.ui index c7f333c..c653b3e 100644 --- a/resources/ui/chat.ui +++ b/resources/ui/chat.ui | |||
@@ -27,13 +27,10 @@ Author: Tobias Frisch | |||
27 | <property name="can-focus">False</property> | 27 | <property name="can-focus">False</property> |
28 | <property name="orientation">vertical</property> | 28 | <property name="orientation">vertical</property> |
29 | <child> | 29 | <child> |
30 | <object class="GtkBox" id="chat-header-box"> | 30 | <object class="GtkBox"> |
31 | <property name="visible">True</property> | 31 | <property name="visible">True</property> |
32 | <property name="can-focus">False</property> | 32 | <property name="can-focus">False</property> |
33 | <property name="margin-start">8</property> | 33 | <property name="border-width">8</property> |
34 | <property name="margin-end">8</property> | ||
35 | <property name="margin-top">8</property> | ||
36 | <property name="margin-bottom">8</property> | ||
37 | <property name="spacing">8</property> | 34 | <property name="spacing">8</property> |
38 | <child> | 35 | <child> |
39 | <object class="GtkButton" id="back_button"> | 36 | <object class="GtkButton" id="back_button"> |
@@ -88,6 +85,9 @@ Author: Tobias Frisch | |||
88 | <attributes> | 85 | <attributes> |
89 | <attribute name="weight" value="light"/> | 86 | <attribute name="weight" value="light"/> |
90 | </attributes> | 87 | </attributes> |
88 | <style> | ||
89 | <class name="header-subtitle"/> | ||
90 | </style> | ||
91 | </object> | 91 | </object> |
92 | <packing> | 92 | <packing> |
93 | <property name="expand">True</property> | 93 | <property name="expand">True</property> |
@@ -123,6 +123,9 @@ Author: Tobias Frisch | |||
123 | <property name="position">1</property> | 123 | <property name="position">1</property> |
124 | </packing> | 124 | </packing> |
125 | </child> | 125 | </child> |
126 | <style> | ||
127 | <class name=".header-box"/> | ||
128 | </style> | ||
126 | </object> | 129 | </object> |
127 | <packing> | 130 | <packing> |
128 | <property name="expand">False</property> | 131 | <property name="expand">False</property> |
@@ -169,10 +172,9 @@ Author: Tobias Frisch | |||
169 | <object class="GtkBox"> | 172 | <object class="GtkBox"> |
170 | <property name="visible">True</property> | 173 | <property name="visible">True</property> |
171 | <property name="can-focus">False</property> | 174 | <property name="can-focus">False</property> |
172 | <property name="margin-start">8</property> | 175 | <property name="margin-start">4</property> |
173 | <property name="margin-end">8</property> | 176 | <property name="margin-end">4</property> |
174 | <property name="margin-top">4</property> | 177 | <property name="border-width">4</property> |
175 | <property name="margin-bottom">4</property> | ||
176 | <property name="spacing">4</property> | 178 | <property name="spacing">4</property> |
177 | <child> | 179 | <child> |
178 | <object class="GtkButton" id="attach_file_button"> | 180 | <object class="GtkButton" id="attach_file_button"> |
diff --git a/resources/ui/contact_entry.ui b/resources/ui/contact_entry.ui index c0376b3..908fee1 100644 --- a/resources/ui/contact_entry.ui +++ b/resources/ui/contact_entry.ui | |||
@@ -54,12 +54,13 @@ Author: Tobias Frisch | |||
54 | <property name="wrap-mode">word-char</property> | 54 | <property name="wrap-mode">word-char</property> |
55 | <property name="ellipsize">end</property> | 55 | <property name="ellipsize">end</property> |
56 | <property name="xalign">0</property> | 56 | <property name="xalign">0</property> |
57 | <property name="yalign">1</property> | ||
57 | <attributes> | 58 | <attributes> |
58 | <attribute name="weight" value="bold"/> | 59 | <attribute name="weight" value="bold"/> |
59 | </attributes> | 60 | </attributes> |
60 | </object> | 61 | </object> |
61 | <packing> | 62 | <packing> |
62 | <property name="expand">False</property> | 63 | <property name="expand">True</property> |
63 | <property name="fill">True</property> | 64 | <property name="fill">True</property> |
64 | <property name="position">0</property> | 65 | <property name="position">0</property> |
65 | </packing> | 66 | </packing> |
@@ -76,10 +77,14 @@ Author: Tobias Frisch | |||
76 | <attributes> | 77 | <attributes> |
77 | <attribute name="weight" value="semilight"/> | 78 | <attribute name="weight" value="semilight"/> |
78 | </attributes> | 79 | </attributes> |
80 | <style> | ||
81 | <class name="profile-key"/> | ||
82 | </style> | ||
79 | </object> | 83 | </object> |
80 | <packing> | 84 | <packing> |
81 | <property name="expand">True</property> | 85 | <property name="expand">False</property> |
82 | <property name="fill">True</property> | 86 | <property name="fill">True</property> |
87 | <property name="pack-type">end</property> | ||
83 | <property name="position">1</property> | 88 | <property name="position">1</property> |
84 | </packing> | 89 | </packing> |
85 | </child> | 90 | </child> |
@@ -92,7 +97,7 @@ Author: Tobias Frisch | |||
92 | </packing> | 97 | </packing> |
93 | </child> | 98 | </child> |
94 | <style> | 99 | <style> |
95 | <class name="chat-entry"/> | 100 | <class name="contact-entry"/> |
96 | </style> | 101 | </style> |
97 | </object> | 102 | </object> |
98 | </interface> | 103 | </interface> |
diff --git a/resources/ui/contacts.ui b/resources/ui/contacts.ui index a679cfc..85da426 100644 --- a/resources/ui/contacts.ui +++ b/resources/ui/contacts.ui | |||
@@ -85,6 +85,52 @@ Author: Tobias Frisch | |||
85 | <object class="GtkListBox" id="contacts_listbox"> | 85 | <object class="GtkListBox" id="contacts_listbox"> |
86 | <property name="visible">True</property> | 86 | <property name="visible">True</property> |
87 | <property name="can-focus">False</property> | 87 | <property name="can-focus">False</property> |
88 | <child> | ||
89 | <object class="GtkListBoxRow"> | ||
90 | <property name="visible">True</property> | ||
91 | <property name="can-focus">True</property> | ||
92 | <property name="selectable">False</property> | ||
93 | <child> | ||
94 | <object class="GtkBox"> | ||
95 | <property name="visible">True</property> | ||
96 | <property name="can-focus">False</property> | ||
97 | <property name="spacing">8</property> | ||
98 | <child> | ||
99 | <object class="GtkImage"> | ||
100 | <property name="width-request">48</property> | ||
101 | <property name="height-request">48</property> | ||
102 | <property name="visible">True</property> | ||
103 | <property name="can-focus">False</property> | ||
104 | <property name="icon-name">contact-new-symbolic</property> | ||
105 | <property name="icon_size">3</property> | ||
106 | </object> | ||
107 | <packing> | ||
108 | <property name="expand">False</property> | ||
109 | <property name="fill">True</property> | ||
110 | <property name="position">0</property> | ||
111 | </packing> | ||
112 | </child> | ||
113 | <child> | ||
114 | <object class="GtkLabel"> | ||
115 | <property name="visible">True</property> | ||
116 | <property name="can-focus">False</property> | ||
117 | <property name="label" translatable="yes">Add Contact</property> | ||
118 | <property name="xalign">0</property> | ||
119 | </object> | ||
120 | <packing> | ||
121 | <property name="expand">True</property> | ||
122 | <property name="fill">True</property> | ||
123 | <property name="pack-type">end</property> | ||
124 | <property name="position">1</property> | ||
125 | </packing> | ||
126 | </child> | ||
127 | <style> | ||
128 | <class name="contact-entry"/> | ||
129 | </style> | ||
130 | </object> | ||
131 | </child> | ||
132 | </object> | ||
133 | </child> | ||
88 | </object> | 134 | </object> |
89 | </child> | 135 | </child> |
90 | </object> | 136 | </object> |
diff --git a/resources/ui/messenger.ui b/resources/ui/messenger.ui index 3c60f2e..f301650 100644 --- a/resources/ui/messenger.ui +++ b/resources/ui/messenger.ui | |||
@@ -50,13 +50,10 @@ Author: Tobias Frisch | |||
50 | <property name="can-focus">False</property> | 50 | <property name="can-focus">False</property> |
51 | <property name="orientation">vertical</property> | 51 | <property name="orientation">vertical</property> |
52 | <child> | 52 | <child> |
53 | <object class="GtkBox" id="chats-header-box"> | 53 | <object class="GtkBox"> |
54 | <property name="visible">True</property> | 54 | <property name="visible">True</property> |
55 | <property name="can-focus">False</property> | 55 | <property name="can-focus">False</property> |
56 | <property name="margin-start">8</property> | 56 | <property name="border-width">8</property> |
57 | <property name="margin-end">8</property> | ||
58 | <property name="margin-top">8</property> | ||
59 | <property name="margin-bottom">8</property> | ||
60 | <property name="spacing">8</property> | 57 | <property name="spacing">8</property> |
61 | <child> | 58 | <child> |
62 | <object class="GtkButton" id="user_details_button"> | 59 | <object class="GtkButton" id="user_details_button"> |
@@ -93,6 +90,9 @@ Author: Tobias Frisch | |||
93 | <property name="position">1</property> | 90 | <property name="position">1</property> |
94 | </packing> | 91 | </packing> |
95 | </child> | 92 | </child> |
93 | <style> | ||
94 | <class name="header-box"/> | ||
95 | </style> | ||
96 | </object> | 96 | </object> |
97 | <packing> | 97 | <packing> |
98 | <property name="expand">False</property> | 98 | <property name="expand">False</property> |
@@ -146,10 +146,7 @@ Author: Tobias Frisch | |||
146 | <object class="GtkBox"> | 146 | <object class="GtkBox"> |
147 | <property name="visible">True</property> | 147 | <property name="visible">True</property> |
148 | <property name="can-focus">False</property> | 148 | <property name="can-focus">False</property> |
149 | <property name="margin-start">16</property> | 149 | <property name="border-width">16</property> |
150 | <property name="margin-end">16</property> | ||
151 | <property name="margin-top">16</property> | ||
152 | <property name="margin-bottom">16</property> | ||
153 | <property name="orientation">vertical</property> | 150 | <property name="orientation">vertical</property> |
154 | <property name="spacing">16</property> | 151 | <property name="spacing">16</property> |
155 | <child> | 152 | <child> |
@@ -166,11 +163,44 @@ Author: Tobias Frisch | |||
166 | </packing> | 163 | </packing> |
167 | </child> | 164 | </child> |
168 | <child> | 165 | <child> |
169 | <object class="GtkLabel" id="profile_label"> | 166 | <object class="GtkBox"> |
170 | <property name="visible">True</property> | 167 | <property name="visible">True</property> |
171 | <property name="can-focus">False</property> | 168 | <property name="can-focus">False</property> |
172 | <property name="label" translatable="yes">Profile name</property> | 169 | <property name="orientation">vertical</property> |
173 | <property name="xalign">0</property> | 170 | <property name="spacing">2</property> |
171 | <child> | ||
172 | <object class="GtkLabel" id="profile_label"> | ||
173 | <property name="visible">True</property> | ||
174 | <property name="can-focus">False</property> | ||
175 | <property name="ellipsize">end</property> | ||
176 | <property name="xalign">0</property> | ||
177 | <attributes> | ||
178 | <attribute name="weight" value="bold"/> | ||
179 | </attributes> | ||
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" id="profile_key_label"> | ||
189 | <property name="visible">True</property> | ||
190 | <property name="can-focus">False</property> | ||
191 | <property name="ellipsize">end</property> | ||
192 | <property name="max-width-chars">30</property> | ||
193 | <property name="xalign">0</property> | ||
194 | <style> | ||
195 | <class name="profile-key"/> | ||
196 | </style> | ||
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> | ||
174 | </object> | 204 | </object> |
175 | <packing> | 205 | <packing> |
176 | <property name="expand">False</property> | 206 | <property name="expand">False</property> |
@@ -189,10 +219,7 @@ Author: Tobias Frisch | |||
189 | <object class="GtkBox"> | 219 | <object class="GtkBox"> |
190 | <property name="visible">True</property> | 220 | <property name="visible">True</property> |
191 | <property name="can-focus">False</property> | 221 | <property name="can-focus">False</property> |
192 | <property name="margin-start">8</property> | 222 | <property name="border-width">8</property> |
193 | <property name="margin-end">8</property> | ||
194 | <property name="margin-top">8</property> | ||
195 | <property name="margin-bottom">8</property> | ||
196 | <property name="orientation">vertical</property> | 223 | <property name="orientation">vertical</property> |
197 | <property name="spacing">8</property> | 224 | <property name="spacing">8</property> |
198 | <property name="homogeneous">True</property> | 225 | <property name="homogeneous">True</property> |
@@ -306,21 +333,24 @@ Author: Tobias Frisch | |||
306 | <object class="GtkListBox" id="accounts_listbox"> | 333 | <object class="GtkListBox" id="accounts_listbox"> |
307 | <property name="visible">True</property> | 334 | <property name="visible">True</property> |
308 | <property name="can-focus">False</property> | 335 | <property name="can-focus">False</property> |
309 | <property name="selection-mode">none</property> | ||
310 | <child> | 336 | <child> |
311 | <object class="GtkListBoxRow"> | 337 | <object class="GtkListBoxRow"> |
312 | <property name="visible">True</property> | 338 | <property name="visible">True</property> |
313 | <property name="can-focus">True</property> | 339 | <property name="can-focus">True</property> |
340 | <property name="selectable">False</property> | ||
314 | <child> | 341 | <child> |
315 | <object class="GtkBox"> | 342 | <object class="GtkBox"> |
316 | <property name="visible">True</property> | 343 | <property name="visible">True</property> |
317 | <property name="can-focus">False</property> | 344 | <property name="can-focus">False</property> |
318 | <property name="spacing">8</property> | 345 | <property name="spacing">8</property> |
319 | <child> | 346 | <child> |
320 | <object class="HdyAvatar"> | 347 | <object class="GtkImage"> |
348 | <property name="width-request">36</property> | ||
349 | <property name="height-request">36</property> | ||
321 | <property name="visible">True</property> | 350 | <property name="visible">True</property> |
322 | <property name="can-focus">False</property> | 351 | <property name="can-focus">False</property> |
323 | <property name="size">36</property> | 352 | <property name="icon-name">list-add-symbolic</property> |
353 | <property name="icon_size">3</property> | ||
324 | </object> | 354 | </object> |
325 | <packing> | 355 | <packing> |
326 | <property name="expand">False</property> | 356 | <property name="expand">False</property> |
@@ -332,14 +362,10 @@ Author: Tobias Frisch | |||
332 | <object class="GtkLabel"> | 362 | <object class="GtkLabel"> |
333 | <property name="visible">True</property> | 363 | <property name="visible">True</property> |
334 | <property name="can-focus">False</property> | 364 | <property name="can-focus">False</property> |
335 | <property name="label" translatable="yes">Name</property> | 365 | <property name="label" translatable="yes">Add Account</property> |
336 | <property name="wrap">True</property> | ||
337 | <property name="wrap-mode">word-char</property> | ||
338 | <property name="ellipsize">end</property> | ||
339 | <property name="xalign">0</property> | ||
340 | </object> | 366 | </object> |
341 | <packing> | 367 | <packing> |
342 | <property name="expand">True</property> | 368 | <property name="expand">False</property> |
343 | <property name="fill">True</property> | 369 | <property name="fill">True</property> |
344 | <property name="position">1</property> | 370 | <property name="position">1</property> |
345 | </packing> | 371 | </packing> |
@@ -380,10 +406,7 @@ Author: Tobias Frisch | |||
380 | <object class="GtkBox"> | 406 | <object class="GtkBox"> |
381 | <property name="visible">True</property> | 407 | <property name="visible">True</property> |
382 | <property name="can-focus">False</property> | 408 | <property name="can-focus">False</property> |
383 | <property name="margin-start">4</property> | 409 | <property name="border-width">4</property> |
384 | <property name="margin-end">4</property> | ||
385 | <property name="margin-top">4</property> | ||
386 | <property name="margin-bottom">4</property> | ||
387 | <property name="spacing">16</property> | 410 | <property name="spacing">16</property> |
388 | <child> | 411 | <child> |
389 | <object class="GtkImage"> | 412 | <object class="GtkImage"> |
@@ -431,10 +454,7 @@ Author: Tobias Frisch | |||
431 | <object class="GtkBox"> | 454 | <object class="GtkBox"> |
432 | <property name="visible">True</property> | 455 | <property name="visible">True</property> |
433 | <property name="can-focus">False</property> | 456 | <property name="can-focus">False</property> |
434 | <property name="margin-start">4</property> | 457 | <property name="border-width">4</property> |
435 | <property name="margin-end">4</property> | ||
436 | <property name="margin-top">4</property> | ||
437 | <property name="margin-bottom">4</property> | ||
438 | <property name="spacing">16</property> | 458 | <property name="spacing">16</property> |
439 | <child> | 459 | <child> |
440 | <object class="GtkImage"> | 460 | <object class="GtkImage"> |
@@ -482,10 +502,7 @@ Author: Tobias Frisch | |||
482 | <object class="GtkBox"> | 502 | <object class="GtkBox"> |
483 | <property name="visible">True</property> | 503 | <property name="visible">True</property> |
484 | <property name="can-focus">False</property> | 504 | <property name="can-focus">False</property> |
485 | <property name="margin-start">4</property> | 505 | <property name="border-width">4</property> |
486 | <property name="margin-end">4</property> | ||
487 | <property name="margin-top">4</property> | ||
488 | <property name="margin-bottom">4</property> | ||
489 | <property name="spacing">16</property> | 506 | <property name="spacing">16</property> |
490 | <child> | 507 | <child> |
491 | <object class="GtkImage"> | 508 | <object class="GtkImage"> |
@@ -533,10 +550,7 @@ Author: Tobias Frisch | |||
533 | <object class="GtkBox"> | 550 | <object class="GtkBox"> |
534 | <property name="visible">True</property> | 551 | <property name="visible">True</property> |
535 | <property name="can-focus">False</property> | 552 | <property name="can-focus">False</property> |
536 | <property name="margin-start">4</property> | 553 | <property name="border-width">4</property> |
537 | <property name="margin-end">4</property> | ||
538 | <property name="margin-top">4</property> | ||
539 | <property name="margin-bottom">4</property> | ||
540 | <property name="spacing">16</property> | 554 | <property name="spacing">16</property> |
541 | <child> | 555 | <child> |
542 | <object class="GtkImage"> | 556 | <object class="GtkImage"> |
@@ -584,10 +598,7 @@ Author: Tobias Frisch | |||
584 | <object class="GtkBox"> | 598 | <object class="GtkBox"> |
585 | <property name="visible">True</property> | 599 | <property name="visible">True</property> |
586 | <property name="can-focus">False</property> | 600 | <property name="can-focus">False</property> |
587 | <property name="margin-start">4</property> | 601 | <property name="border-width">4</property> |
588 | <property name="margin-end">4</property> | ||
589 | <property name="margin-top">4</property> | ||
590 | <property name="margin-bottom">4</property> | ||
591 | <property name="spacing">16</property> | 602 | <property name="spacing">16</property> |
592 | <child> | 603 | <child> |
593 | <object class="GtkImage"> | 604 | <object class="GtkImage"> |
@@ -635,10 +646,7 @@ Author: Tobias Frisch | |||
635 | <object class="GtkBox"> | 646 | <object class="GtkBox"> |
636 | <property name="visible">True</property> | 647 | <property name="visible">True</property> |
637 | <property name="can-focus">False</property> | 648 | <property name="can-focus">False</property> |
638 | <property name="margin-start">16</property> | 649 | <property name="border-width">16</property> |
639 | <property name="margin-end">16</property> | ||
640 | <property name="margin-top">16</property> | ||
641 | <property name="margin-bottom">16</property> | ||
642 | <property name="orientation">vertical</property> | 650 | <property name="orientation">vertical</property> |
643 | <child> | 651 | <child> |
644 | <object class="GtkLabel"> | 652 | <object class="GtkLabel"> |
@@ -721,7 +729,33 @@ Author: Tobias Frisch | |||
721 | <property name="visible">True</property> | 729 | <property name="visible">True</property> |
722 | <property name="can-focus">False</property> | 730 | <property name="can-focus">False</property> |
723 | <child> | 731 | <child> |
724 | <placeholder/> | 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> | ||
725 | </child> | 759 | </child> |
726 | </object> | 760 | </object> |
727 | </child> | 761 | </child> |
@@ -741,10 +775,7 @@ Author: Tobias Frisch | |||
741 | <property name="width-request">250</property> | 775 | <property name="width-request">250</property> |
742 | <property name="visible">True</property> | 776 | <property name="visible">True</property> |
743 | <property name="can-focus">False</property> | 777 | <property name="can-focus">False</property> |
744 | <property name="margin-start">8</property> | 778 | <property name="border-width">8</property> |
745 | <property name="margin-end">8</property> | ||
746 | <property name="margin-top">8</property> | ||
747 | <property name="margin-bottom">8</property> | ||
748 | <child> | 779 | <child> |
749 | <object class="GtkStack"> | 780 | <object class="GtkStack"> |
750 | <property name="visible">True</property> | 781 | <property name="visible">True</property> |
diff --git a/resources/ui/profile_entry.ui b/resources/ui/profile_entry.ui new file mode 100644 index 0000000..0545f55 --- /dev/null +++ b/resources/ui/profile_entry.ui | |||
@@ -0,0 +1,62 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!-- Generated with glade 3.38.2 | ||
3 | |||
4 | Copyright (C) 2021 GNUnet e.V. | ||
5 | |||
6 | GNUnet is free software: you can redistribute it and/or modify it | ||
7 | under the terms of the GNU Affero General Public License as published | ||
8 | by the Free Software Foundation, either version 3 of the License, | ||
9 | or (at your option) any later version. | ||
10 | |||
11 | GNUnet is distributed in the hope that it will be useful, but | ||
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | Affero General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU Affero General Public License | ||
17 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
18 | |||
19 | SPDX-License-Identifier: AGPL3.0-or-later | ||
20 | Author: 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="entry_box"> | ||
27 | <property name="visible">True</property> | ||
28 | <property name="can-focus">False</property> | ||
29 | <property name="spacing">8</property> | ||
30 | <child> | ||
31 | <object class="HdyAvatar" id="entry_avatar"> | ||
32 | <property name="visible">True</property> | ||
33 | <property name="can-focus">False</property> | ||
34 | <property name="size">36</property> | ||
35 | </object> | ||
36 | <packing> | ||
37 | <property name="expand">False</property> | ||
38 | <property name="fill">True</property> | ||
39 | <property name="position">0</property> | ||
40 | </packing> | ||
41 | </child> | ||
42 | <child> | ||
43 | <object class="GtkLabel" id="entry_label"> | ||
44 | <property name="visible">True</property> | ||
45 | <property name="can-focus">False</property> | ||
46 | <property name="wrap">True</property> | ||
47 | <property name="wrap-mode">word-char</property> | ||
48 | <property name="ellipsize">end</property> | ||
49 | <property name="xalign">0</property> | ||
50 | </object> | ||
51 | <packing> | ||
52 | <property name="expand">True</property> | ||
53 | <property name="fill">True</property> | ||
54 | <property name="pack-type">end</property> | ||
55 | <property name="position">1</property> | ||
56 | </packing> | ||
57 | </child> | ||
58 | <style> | ||
59 | <class name="profile-entry"/> | ||
60 | </style> | ||
61 | </object> | ||
62 | </interface> | ||
diff --git a/src/application.c b/src/application.c index 764b8ea..7cb827b 100644 --- a/src/application.c +++ b/src/application.c | |||
@@ -91,6 +91,16 @@ application_init(MESSENGER_Application *app, | |||
91 | NULL | 91 | NULL |
92 | ); | 92 | ); |
93 | 93 | ||
94 | g_application_add_main_option( | ||
95 | G_APPLICATION(app->application), | ||
96 | "ego", | ||
97 | 'e', | ||
98 | G_OPTION_FLAG_NONE, | ||
99 | G_OPTION_ARG_STRING, | ||
100 | "Identity to select for messaging", | ||
101 | "IDENTITY" | ||
102 | ); | ||
103 | |||
94 | g_signal_connect( | 104 | g_signal_connect( |
95 | app->application, | 105 | app->application, |
96 | "activate", | 106 | "activate", |
@@ -111,6 +121,13 @@ _application_chat_thread(void *args) | |||
111 | "Optimize UI spacing for mobile devices", | 121 | "Optimize UI spacing for mobile devices", |
112 | &(app->ui.mobile) | 122 | &(app->ui.mobile) |
113 | ), | 123 | ), |
124 | GNUNET_GETOPT_option_string ( | ||
125 | 'e', | ||
126 | "ego", | ||
127 | "IDENTITY", | ||
128 | "Identity to select for messaging", | ||
129 | &(app->chat.identity) | ||
130 | ), | ||
114 | GNUNET_GETOPT_OPTION_END | 131 | GNUNET_GETOPT_OPTION_END |
115 | }; | 132 | }; |
116 | 133 | ||
@@ -198,7 +215,7 @@ application_call_event(MESSENGER_Application *app, | |||
198 | } | 215 | } |
199 | } | 216 | } |
200 | 217 | ||
201 | g_idle_add(_application_event_call, call); | 218 | g_idle_add(G_SOURCE_FUNC(_application_event_call), call); |
202 | } | 219 | } |
203 | 220 | ||
204 | void | 221 | void |
diff --git a/src/application.h b/src/application.h index 6b99bdd..f30ebb8 100644 --- a/src/application.h +++ b/src/application.h | |||
@@ -54,6 +54,7 @@ typedef struct MESSENGER_Application | |||
54 | struct { | 54 | struct { |
55 | int status; | 55 | int status; |
56 | pthread_t tid; | 56 | pthread_t tid; |
57 | char *identity; | ||
57 | 58 | ||
58 | MESSENGER_ApplicationSignal signal; | 59 | MESSENGER_ApplicationSignal signal; |
59 | 60 | ||
diff --git a/src/chat/messenger.c b/src/chat/messenger.c index fa91250..6df3664 100644 --- a/src/chat/messenger.c +++ b/src/chat/messenger.c | |||
@@ -119,7 +119,7 @@ chat_messenger_run(void *cls, | |||
119 | app->chat.messenger.handle = GNUNET_CHAT_start( | 119 | app->chat.messenger.handle = GNUNET_CHAT_start( |
120 | cfg, | 120 | cfg, |
121 | "messenger-gtk", | 121 | "messenger-gtk", |
122 | "test", | 122 | app->chat.identity, |
123 | &_chat_messenger_message, | 123 | &_chat_messenger_message, |
124 | app | 124 | app |
125 | ); | 125 | ); |
diff --git a/src/event.c b/src/event.c index ac0680e..16b709e 100644 --- a/src/event.c +++ b/src/event.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "ui/chat_entry.h" | 27 | #include "ui/chat_entry.h" |
28 | #include "ui/contact_entry.h" | 28 | #include "ui/contact_entry.h" |
29 | #include "ui/message.h" | 29 | #include "ui/message.h" |
30 | #include "ui/profile_entry.h" | ||
30 | 31 | ||
31 | static void | 32 | static void |
32 | _add_new_chat_entry(MESSENGER_Application *app, | 33 | _add_new_chat_entry(MESSENGER_Application *app, |
@@ -129,8 +130,28 @@ event_update_profile(MESSENGER_Application *app, | |||
129 | { | 130 | { |
130 | hdy_avatar_set_text(ui->profile_avatar, name); | 131 | hdy_avatar_set_text(ui->profile_avatar, name); |
131 | gtk_label_set_text(ui->profile_label, name); | 132 | gtk_label_set_text(ui->profile_label, name); |
133 | |||
134 | UI_PROFILE_ENTRY_Handle *profile = ui_profile_entry_new(); | ||
135 | |||
136 | hdy_avatar_set_text(profile->entry_avatar, name); | ||
137 | gtk_label_set_text(profile->entry_label, name); | ||
138 | |||
139 | gtk_list_box_prepend(ui->accounts_listbox, profile->entry_box); | ||
140 | |||
141 | GtkListBoxRow *row = GTK_LIST_BOX_ROW( | ||
142 | gtk_widget_get_parent(profile->entry_box) | ||
143 | ); | ||
144 | |||
145 | gtk_list_box_select_row(ui->accounts_listbox, row); | ||
146 | |||
147 | ui_profile_entry_delete(profile); | ||
132 | } | 148 | } |
133 | 149 | ||
150 | const char *key = GNUNET_CHAT_get_key(chat->handle); | ||
151 | |||
152 | if (key) | ||
153 | gtk_label_set_text(ui->profile_key_label, key); | ||
154 | |||
134 | gtk_container_foreach( | 155 | gtk_container_foreach( |
135 | GTK_CONTAINER(ui->chats_listbox), | 156 | GTK_CONTAINER(ui->chats_listbox), |
136 | _clear_each_widget, | 157 | _clear_each_widget, |
diff --git a/src/ui/contacts.c b/src/ui/contacts.c index cc349f3..1a9b83b 100644 --- a/src/ui/contacts.c +++ b/src/ui/contacts.c | |||
@@ -36,6 +36,17 @@ handle_close_button_click(UNUSED GtkButton *button, | |||
36 | gtk_window_close(GTK_WINDOW(dialog)); | 36 | gtk_window_close(GTK_WINDOW(dialog)); |
37 | } | 37 | } |
38 | 38 | ||
39 | static gboolean | ||
40 | _open_new_contact_dialog(gpointer user_data) | ||
41 | { | ||
42 | MESSENGER_Application *app = (MESSENGER_Application*) user_data; | ||
43 | |||
44 | ui_new_contact_dialog_init(app, &(app->ui.new_contact)); | ||
45 | |||
46 | gtk_widget_show(GTK_WIDGET(app->ui.new_contact.dialog)); | ||
47 | return FALSE; | ||
48 | } | ||
49 | |||
39 | static void | 50 | static void |
40 | handle_contacts_listbox_row_activated(UNUSED GtkListBox* listbox, | 51 | handle_contacts_listbox_row_activated(UNUSED GtkListBox* listbox, |
41 | GtkListBoxRow* row, | 52 | GtkListBoxRow* row, |
@@ -43,6 +54,12 @@ handle_contacts_listbox_row_activated(UNUSED GtkListBox* listbox, | |||
43 | { | 54 | { |
44 | MESSENGER_Application *app = (MESSENGER_Application*) user_data; | 55 | MESSENGER_Application *app = (MESSENGER_Application*) user_data; |
45 | 56 | ||
57 | if (!gtk_list_box_row_get_selectable(row)) | ||
58 | { | ||
59 | g_idle_add(G_SOURCE_FUNC(_open_new_contact_dialog), app); | ||
60 | goto close_dialog; | ||
61 | } | ||
62 | |||
46 | struct GNUNET_CHAT_Contact *contact = (struct GNUNET_CHAT_Contact*) ( | 63 | struct GNUNET_CHAT_Contact *contact = (struct GNUNET_CHAT_Contact*) ( |
47 | g_hash_table_lookup(app->ui.bindings, row) | 64 | g_hash_table_lookup(app->ui.bindings, row) |
48 | ); | 65 | ); |
@@ -135,8 +152,8 @@ _iterate_contacts(void *cls, | |||
135 | const char *key = GNUNET_CHAT_contact_get_key(contact); | 152 | const char *key = GNUNET_CHAT_contact_get_key(contact); |
136 | 153 | ||
137 | UI_CONTACT_ENTRY_Handle *entry = ui_contact_entry_new(); | 154 | UI_CONTACT_ENTRY_Handle *entry = ui_contact_entry_new(); |
138 | gtk_container_add( | 155 | gtk_list_box_prepend( |
139 | GTK_CONTAINER(app->ui.contacts.contacts_listbox), | 156 | app->ui.contacts.contacts_listbox, |
140 | entry->entry_box | 157 | entry->entry_box |
141 | ); | 158 | ); |
142 | 159 | ||
diff --git a/src/ui/messenger.c b/src/ui/messenger.c index 314edb4..669ef19 100644 --- a/src/ui/messenger.c +++ b/src/ui/messenger.c | |||
@@ -60,7 +60,6 @@ handle_account_details_button_click(UNUSED GtkButton* button, | |||
60 | gboolean old_state = gtk_revealer_get_reveal_child(revealer); | 60 | gboolean old_state = gtk_revealer_get_reveal_child(revealer); |
61 | 61 | ||
62 | gtk_revealer_set_reveal_child(revealer, !old_state); | 62 | gtk_revealer_set_reveal_child(revealer, !old_state); |
63 | |||
64 | gtk_image_set_from_icon_name( | 63 | gtk_image_set_from_icon_name( |
65 | symbol, | 64 | symbol, |
66 | old_state? | 65 | old_state? |
@@ -218,6 +217,10 @@ ui_messenger_init(MESSENGER_Application *app, | |||
218 | gtk_builder_get_object(handle->builder, "profile_label") | 217 | gtk_builder_get_object(handle->builder, "profile_label") |
219 | ); | 218 | ); |
220 | 219 | ||
220 | handle->profile_key_label = GTK_LABEL( | ||
221 | gtk_builder_get_object(handle->builder, "profile_key_label") | ||
222 | ); | ||
223 | |||
221 | handle->hide_user_details_button = GTK_BUTTON( | 224 | handle->hide_user_details_button = GTK_BUTTON( |
222 | gtk_builder_get_object(handle->builder, "hide_user_details_button") | 225 | gtk_builder_get_object(handle->builder, "hide_user_details_button") |
223 | ); | 226 | ); |
diff --git a/src/ui/messenger.h b/src/ui/messenger.h index 28829c2..6a4a43e 100644 --- a/src/ui/messenger.h +++ b/src/ui/messenger.h | |||
@@ -46,6 +46,7 @@ typedef struct UI_MESSENGER_Handle | |||
46 | 46 | ||
47 | HdyAvatar *profile_avatar; | 47 | HdyAvatar *profile_avatar; |
48 | GtkLabel *profile_label; | 48 | GtkLabel *profile_label; |
49 | GtkLabel *profile_key_label; | ||
49 | 50 | ||
50 | GtkButton *hide_user_details_button; | 51 | GtkButton *hide_user_details_button; |
51 | GtkButton *favourites_button; | 52 | GtkButton *favourites_button; |
diff --git a/src/ui/profile_entry.c b/src/ui/profile_entry.c new file mode 100644 index 0000000..4a03f94 --- /dev/null +++ b/src/ui/profile_entry.c | |||
@@ -0,0 +1,57 @@ | |||
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/profile_entry.c | ||
23 | */ | ||
24 | |||
25 | #include "profile_entry.h" | ||
26 | |||
27 | #include "../application.h" | ||
28 | |||
29 | UI_PROFILE_ENTRY_Handle* | ||
30 | ui_profile_entry_new(void) | ||
31 | { | ||
32 | UI_PROFILE_ENTRY_Handle* handle = g_malloc(sizeof(UI_PROFILE_ENTRY_Handle)); | ||
33 | |||
34 | handle->builder = gtk_builder_new_from_file("resources/ui/profile_entry.ui"); | ||
35 | |||
36 | handle->entry_box = GTK_WIDGET( | ||
37 | gtk_builder_get_object(handle->builder, "entry_box") | ||
38 | ); | ||
39 | |||
40 | handle->entry_avatar = HDY_AVATAR( | ||
41 | gtk_builder_get_object(handle->builder, "entry_avatar") | ||
42 | ); | ||
43 | |||
44 | handle->entry_label = GTK_LABEL( | ||
45 | gtk_builder_get_object(handle->builder, "entry_label") | ||
46 | ); | ||
47 | |||
48 | return handle; | ||
49 | } | ||
50 | |||
51 | void | ||
52 | ui_profile_entry_delete(UI_PROFILE_ENTRY_Handle *handle) | ||
53 | { | ||
54 | g_object_unref(handle->builder); | ||
55 | |||
56 | g_free(handle); | ||
57 | } | ||
diff --git a/src/ui/profile_entry.h b/src/ui/profile_entry.h new file mode 100644 index 0000000..6196737 --- /dev/null +++ b/src/ui/profile_entry.h | |||
@@ -0,0 +1,46 @@ | |||
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/profile_entry.h | ||
23 | */ | ||
24 | |||
25 | #ifndef UI_PROFILE_ENTRY_H_ | ||
26 | #define UI_PROFILE_ENTRY_H_ | ||
27 | |||
28 | #include "messenger.h" | ||
29 | |||
30 | typedef struct UI_PROFILE_ENTRY_Handle | ||
31 | { | ||
32 | GtkBuilder *builder; | ||
33 | |||
34 | GtkWidget *entry_box; | ||
35 | |||
36 | HdyAvatar *entry_avatar; | ||
37 | GtkLabel *entry_label; | ||
38 | } UI_PROFILE_ENTRY_Handle; | ||
39 | |||
40 | UI_PROFILE_ENTRY_Handle* | ||
41 | ui_profile_entry_new(void); | ||
42 | |||
43 | void | ||
44 | ui_profile_entry_delete(UI_PROFILE_ENTRY_Handle *handle); | ||
45 | |||
46 | #endif /* UI_PROFILE_ENTRY_H_ */ | ||