diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2021-11-21 03:13:32 +0100 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2021-11-21 03:13:32 +0100 |
commit | 39f27418afa22e63019aa569473b0ee12ff7eb7d (patch) | |
tree | eb6e86892e4cdb3377db73c30de04dfc138c3fff | |
parent | fc7f147d38bd144d3868861e97923c87d9d1a283 (diff) | |
download | messenger-gtk-39f27418afa22e63019aa569473b0ee12ff7eb7d.tar.gz messenger-gtk-39f27418afa22e63019aa569473b0ee12ff7eb7d.zip |
Added settings dialog
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | resources/css/style.css | 4 | ||||
-rw-r--r-- | resources/ui/settings.ui | 793 | ||||
-rw-r--r-- | src/application.h | 2 | ||||
-rw-r--r-- | src/ui/messenger.c | 22 | ||||
-rw-r--r-- | src/ui/settings.c | 63 | ||||
-rw-r--r-- | src/ui/settings.h | 43 |
7 files changed, 929 insertions, 1 deletions
@@ -14,7 +14,8 @@ SOURCES = messenger_gtk.c\ | |||
14 | ui/message.c\ | 14 | ui/message.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/settings.c | ||
18 | 19 | ||
19 | HEADERS = | 20 | HEADERS = |
20 | 21 | ||
diff --git a/resources/css/style.css b/resources/css/style.css index 57b51d4..4dd8ea4 100644 --- a/resources/css/style.css +++ b/resources/css/style.css | |||
@@ -45,3 +45,7 @@ | |||
45 | padding: 2px 12px; | 45 | padding: 2px 12px; |
46 | } | 46 | } |
47 | 47 | ||
48 | .settings-entry { | ||
49 | margin: 8px; | ||
50 | } | ||
51 | |||
diff --git a/resources/ui/settings.ui b/resources/ui/settings.ui new file mode 100644 index 0000000..7152bb5 --- /dev/null +++ b/resources/ui/settings.ui | |||
@@ -0,0 +1,793 @@ | |||
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="GtkListStore" id="delay_store"> | ||
27 | <columns> | ||
28 | <!-- column-name name --> | ||
29 | <column type="gchararray"/> | ||
30 | <!-- column-name value --> | ||
31 | <column type="gulong"/> | ||
32 | </columns> | ||
33 | <data> | ||
34 | <row> | ||
35 | <col id="0" translatable="yes">Off</col> | ||
36 | <col id="1">0</col> | ||
37 | </row> | ||
38 | <row> | ||
39 | <col id="0" translatable="yes">4 weeks</col> | ||
40 | <col id="1">2419200</col> | ||
41 | </row> | ||
42 | <row> | ||
43 | <col id="0" translatable="yes">1 week</col> | ||
44 | <col id="1">604800</col> | ||
45 | </row> | ||
46 | <row> | ||
47 | <col id="0" translatable="yes">1 day</col> | ||
48 | <col id="1">86400</col> | ||
49 | </row> | ||
50 | <row> | ||
51 | <col id="0" translatable="yes">8 hours</col> | ||
52 | <col id="1">28800</col> | ||
53 | </row> | ||
54 | <row> | ||
55 | <col id="0" translatable="yes">1 hour</col> | ||
56 | <col id="1">3600</col> | ||
57 | </row> | ||
58 | <row> | ||
59 | <col id="0" translatable="yes">5 minutes</col> | ||
60 | <col id="1">300</col> | ||
61 | </row> | ||
62 | <row> | ||
63 | <col id="0" translatable="yes">30 seconds</col> | ||
64 | <col id="1">30</col> | ||
65 | </row> | ||
66 | </data> | ||
67 | </object> | ||
68 | <object class="HdyPreferencesWindow" id="settings_dialog"> | ||
69 | <property name="can-focus">False</property> | ||
70 | <property name="title" translatable="yes">Settings</property> | ||
71 | <property name="modal">True</property> | ||
72 | <property name="window-position">center-on-parent</property> | ||
73 | <property name="type-hint">dialog</property> | ||
74 | <child> | ||
75 | <object class="HdyPreferencesPage"> | ||
76 | <property name="visible">True</property> | ||
77 | <property name="can-focus">False</property> | ||
78 | <property name="icon-name">preferences-system-symbolic</property> | ||
79 | <property name="title" translatable="yes">General</property> | ||
80 | <child> | ||
81 | <object class="HdyPreferencesGroup"> | ||
82 | <property name="visible">True</property> | ||
83 | <property name="can-focus">False</property> | ||
84 | <property name="title" translatable="yes">System</property> | ||
85 | <child> | ||
86 | <object class="HdyPreferencesRow"> | ||
87 | <property name="visible">True</property> | ||
88 | <property name="can-focus">True</property> | ||
89 | <property name="title" translatable="yes">Start on login</property> | ||
90 | <child> | ||
91 | <object class="GtkCheckButton"> | ||
92 | <property name="label" translatable="yes">Start on login</property> | ||
93 | <property name="visible">True</property> | ||
94 | <property name="can-focus">True</property> | ||
95 | <property name="receives-default">False</property> | ||
96 | <property name="draw-indicator">True</property> | ||
97 | <style> | ||
98 | <class name="settings-entry"/> | ||
99 | </style> | ||
100 | </object> | ||
101 | </child> | ||
102 | </object> | ||
103 | </child> | ||
104 | <child> | ||
105 | <object class="HdyPreferencesRow"> | ||
106 | <property name="visible">True</property> | ||
107 | <property name="can-focus">True</property> | ||
108 | <property name="title" translatable="yes">Run in background</property> | ||
109 | <child> | ||
110 | <object class="GtkCheckButton"> | ||
111 | <property name="label" translatable="yes">Run in background</property> | ||
112 | <property name="visible">True</property> | ||
113 | <property name="can-focus">True</property> | ||
114 | <property name="receives-default">False</property> | ||
115 | <property name="draw-indicator">True</property> | ||
116 | <style> | ||
117 | <class name="settings-entry"/> | ||
118 | </style> | ||
119 | </object> | ||
120 | </child> | ||
121 | </object> | ||
122 | </child> | ||
123 | </object> | ||
124 | </child> | ||
125 | </object> | ||
126 | </child> | ||
127 | <child> | ||
128 | <object class="HdyPreferencesPage"> | ||
129 | <property name="visible">True</property> | ||
130 | <property name="can-focus">False</property> | ||
131 | <property name="icon-name">preferences-system-notifications-symbolic</property> | ||
132 | <property name="title" translatable="yes">Notifications</property> | ||
133 | <child> | ||
134 | <object class="HdyPreferencesGroup"> | ||
135 | <property name="visible">True</property> | ||
136 | <property name="can-focus">False</property> | ||
137 | <property name="title" translatable="yes">Notifications</property> | ||
138 | <child> | ||
139 | <object class="HdyPreferencesRow"> | ||
140 | <property name="visible">True</property> | ||
141 | <property name="can-focus">False</property> | ||
142 | <property name="title" translatable="yes">Enable notifications</property> | ||
143 | <child> | ||
144 | <object class="GtkCheckButton"> | ||
145 | <property name="label" translatable="yes">Enable notifications</property> | ||
146 | <property name="visible">True</property> | ||
147 | <property name="can-focus">True</property> | ||
148 | <property name="receives-default">False</property> | ||
149 | <property name="draw-indicator">True</property> | ||
150 | <style> | ||
151 | <class name="settings-entry"/> | ||
152 | </style> | ||
153 | </object> | ||
154 | </child> | ||
155 | </object> | ||
156 | </child> | ||
157 | <child> | ||
158 | <object class="HdyPreferencesRow"> | ||
159 | <property name="visible">True</property> | ||
160 | <property name="can-focus">True</property> | ||
161 | <property name="title" translatable="yes">Play notification sounds</property> | ||
162 | <child> | ||
163 | <object class="GtkCheckButton"> | ||
164 | <property name="label" translatable="yes">Play notification sounds</property> | ||
165 | <property name="visible">True</property> | ||
166 | <property name="can-focus">True</property> | ||
167 | <property name="receives-default">False</property> | ||
168 | <property name="draw-indicator">True</property> | ||
169 | <style> | ||
170 | <class name="settings-entry"/> | ||
171 | </style> | ||
172 | </object> | ||
173 | </child> | ||
174 | </object> | ||
175 | </child> | ||
176 | </object> | ||
177 | </child> | ||
178 | </object> | ||
179 | </child> | ||
180 | <child> | ||
181 | <object class="HdyPreferencesPage"> | ||
182 | <property name="visible">True</property> | ||
183 | <property name="can-focus">False</property> | ||
184 | <property name="icon-name">preferences-system-privacy-symbolic</property> | ||
185 | <property name="title" translatable="yes">Privacy</property> | ||
186 | <child> | ||
187 | <object class="HdyPreferencesGroup"> | ||
188 | <property name="visible">True</property> | ||
189 | <property name="can-focus">False</property> | ||
190 | <property name="title" translatable="yes">Blocked</property> | ||
191 | <child> | ||
192 | <object class="HdyPreferencesRow"> | ||
193 | <property name="visible">True</property> | ||
194 | <property name="can-focus">True</property> | ||
195 | <child> | ||
196 | <object class="GtkLabel"> | ||
197 | <property name="visible">True</property> | ||
198 | <property name="can-focus">False</property> | ||
199 | <property name="label" translatable="yes">0 blocked contacts</property> | ||
200 | <style> | ||
201 | <class name="settings-entry"/> | ||
202 | </style> | ||
203 | </object> | ||
204 | </child> | ||
205 | </object> | ||
206 | </child> | ||
207 | </object> | ||
208 | </child> | ||
209 | <child> | ||
210 | <object class="HdyPreferencesGroup"> | ||
211 | <property name="visible">True</property> | ||
212 | <property name="can-focus">False</property> | ||
213 | <property name="title" translatable="yes">Messaging</property> | ||
214 | <child> | ||
215 | <object class="HdyPreferencesRow"> | ||
216 | <property name="visible">True</property> | ||
217 | <property name="can-focus">True</property> | ||
218 | <property name="title" translatable="yes">Send read receipts</property> | ||
219 | <child> | ||
220 | <object class="GtkCheckButton"> | ||
221 | <property name="label" translatable="yes">Send read receipts</property> | ||
222 | <property name="visible">True</property> | ||
223 | <property name="can-focus">True</property> | ||
224 | <property name="receives-default">False</property> | ||
225 | <property name="draw-indicator">True</property> | ||
226 | <style> | ||
227 | <class name="settings-entry"/> | ||
228 | </style> | ||
229 | </object> | ||
230 | </child> | ||
231 | </object> | ||
232 | </child> | ||
233 | <child> | ||
234 | <object class="HdyPreferencesRow"> | ||
235 | <property name="visible">True</property> | ||
236 | <property name="can-focus">True</property> | ||
237 | <property name="title" translatable="yes">Show whispering</property> | ||
238 | <child> | ||
239 | <object class="GtkCheckButton"> | ||
240 | <property name="label" translatable="yes">Show whispering</property> | ||
241 | <property name="visible">True</property> | ||
242 | <property name="can-focus">True</property> | ||
243 | <property name="receives-default">False</property> | ||
244 | <property name="draw-indicator">True</property> | ||
245 | <style> | ||
246 | <class name="settings-entry"/> | ||
247 | </style> | ||
248 | </object> | ||
249 | </child> | ||
250 | </object> | ||
251 | </child> | ||
252 | </object> | ||
253 | </child> | ||
254 | <child> | ||
255 | <object class="HdyPreferencesGroup"> | ||
256 | <property name="visible">True</property> | ||
257 | <property name="can-focus">False</property> | ||
258 | <property name="title" translatable="yes">Disappearing messages</property> | ||
259 | <child> | ||
260 | <object class="HdyPreferencesRow"> | ||
261 | <property name="visible">True</property> | ||
262 | <property name="can-focus">True</property> | ||
263 | <property name="title" translatable="yes">Default timer for new chats</property> | ||
264 | <child> | ||
265 | <object class="GtkBox"> | ||
266 | <property name="visible">True</property> | ||
267 | <property name="can-focus">False</property> | ||
268 | <child> | ||
269 | <object class="GtkLabel"> | ||
270 | <property name="visible">True</property> | ||
271 | <property name="can-focus">False</property> | ||
272 | <property name="label" translatable="yes">Default timer for new chats</property> | ||
273 | <property name="xalign">0</property> | ||
274 | </object> | ||
275 | <packing> | ||
276 | <property name="expand">True</property> | ||
277 | <property name="fill">True</property> | ||
278 | <property name="position">0</property> | ||
279 | </packing> | ||
280 | </child> | ||
281 | <child> | ||
282 | <object class="GtkComboBox"> | ||
283 | <property name="visible">True</property> | ||
284 | <property name="can-focus">False</property> | ||
285 | <property name="model">delay_store</property> | ||
286 | <property name="active">0</property> | ||
287 | <child> | ||
288 | <object class="GtkCellRendererText"/> | ||
289 | <attributes> | ||
290 | <attribute name="text">0</attribute> | ||
291 | </attributes> | ||
292 | </child> | ||
293 | </object> | ||
294 | <packing> | ||
295 | <property name="expand">False</property> | ||
296 | <property name="fill">True</property> | ||
297 | <property name="position">1</property> | ||
298 | </packing> | ||
299 | </child> | ||
300 | <style> | ||
301 | <class name="settings-entry"/> | ||
302 | </style> | ||
303 | </object> | ||
304 | </child> | ||
305 | </object> | ||
306 | </child> | ||
307 | </object> | ||
308 | </child> | ||
309 | <child> | ||
310 | <object class="HdyPreferencesGroup"> | ||
311 | <property name="visible">True</property> | ||
312 | <property name="can-focus">False</property> | ||
313 | <property name="title" translatable="yes">History</property> | ||
314 | <child> | ||
315 | <object class="HdyPreferencesRow"> | ||
316 | <property name="visible">True</property> | ||
317 | <property name="can-focus">True</property> | ||
318 | <property name="title" translatable="yes">Clear history automatically</property> | ||
319 | <child> | ||
320 | <object class="GtkBox"> | ||
321 | <property name="visible">True</property> | ||
322 | <property name="can-focus">False</property> | ||
323 | <child> | ||
324 | <object class="GtkLabel"> | ||
325 | <property name="visible">True</property> | ||
326 | <property name="can-focus">False</property> | ||
327 | <property name="label" translatable="yes">Clear history automatically</property> | ||
328 | <property name="xalign">0</property> | ||
329 | </object> | ||
330 | <packing> | ||
331 | <property name="expand">True</property> | ||
332 | <property name="fill">True</property> | ||
333 | <property name="position">0</property> | ||
334 | </packing> | ||
335 | </child> | ||
336 | <child> | ||
337 | <object class="GtkComboBox"> | ||
338 | <property name="visible">True</property> | ||
339 | <property name="can-focus">False</property> | ||
340 | <property name="model">delay_store</property> | ||
341 | <property name="active">0</property> | ||
342 | <child> | ||
343 | <object class="GtkCellRendererText"/> | ||
344 | <attributes> | ||
345 | <attribute name="text">0</attribute> | ||
346 | </attributes> | ||
347 | </child> | ||
348 | </object> | ||
349 | <packing> | ||
350 | <property name="expand">False</property> | ||
351 | <property name="fill">True</property> | ||
352 | <property name="position">1</property> | ||
353 | </packing> | ||
354 | </child> | ||
355 | <style> | ||
356 | <class name="settings-entry"/> | ||
357 | </style> | ||
358 | </object> | ||
359 | </child> | ||
360 | </object> | ||
361 | </child> | ||
362 | <child> | ||
363 | <object class="HdyPreferencesRow"> | ||
364 | <property name="visible">True</property> | ||
365 | <property name="can-focus">True</property> | ||
366 | <child> | ||
367 | <object class="GtkBox"> | ||
368 | <property name="visible">True</property> | ||
369 | <property name="can-focus">False</property> | ||
370 | <child> | ||
371 | <object class="GtkButton"> | ||
372 | <property name="label" translatable="yes">Clear all history</property> | ||
373 | <property name="visible">True</property> | ||
374 | <property name="can-focus">True</property> | ||
375 | <property name="receives-default">True</property> | ||
376 | <style> | ||
377 | <class name="delete-button"/> | ||
378 | </style> | ||
379 | </object> | ||
380 | <packing> | ||
381 | <property name="expand">False</property> | ||
382 | <property name="fill">True</property> | ||
383 | <property name="pack-type">end</property> | ||
384 | <property name="position">1</property> | ||
385 | </packing> | ||
386 | </child> | ||
387 | <style> | ||
388 | <class name="settings-entry"/> | ||
389 | </style> | ||
390 | </object> | ||
391 | </child> | ||
392 | </object> | ||
393 | </child> | ||
394 | </object> | ||
395 | </child> | ||
396 | </object> | ||
397 | </child> | ||
398 | <child> | ||
399 | <object class="HdyPreferencesPage"> | ||
400 | <property name="visible">True</property> | ||
401 | <property name="can-focus">False</property> | ||
402 | <property name="icon-name">preferences-system-network-symbolic</property> | ||
403 | <property name="title" translatable="yes">Network</property> | ||
404 | <child> | ||
405 | <object class="HdyPreferencesGroup"> | ||
406 | <property name="visible">True</property> | ||
407 | <property name="can-focus">False</property> | ||
408 | <property name="title" translatable="yes">Invitations</property> | ||
409 | <child> | ||
410 | <object class="HdyPreferencesRow"> | ||
411 | <property name="visible">True</property> | ||
412 | <property name="can-focus">True</property> | ||
413 | <property name="title" translatable="yes">Automatically accept invitations</property> | ||
414 | <child> | ||
415 | <object class="GtkBox"> | ||
416 | <property name="visible">True</property> | ||
417 | <property name="can-focus">False</property> | ||
418 | <child> | ||
419 | <object class="GtkLabel"> | ||
420 | <property name="visible">True</property> | ||
421 | <property name="can-focus">False</property> | ||
422 | <property name="label" translatable="yes">Automatically accept invitations</property> | ||
423 | </object> | ||
424 | <packing> | ||
425 | <property name="expand">False</property> | ||
426 | <property name="fill">True</property> | ||
427 | <property name="position">0</property> | ||
428 | </packing> | ||
429 | </child> | ||
430 | <child> | ||
431 | <object class="GtkSwitch"> | ||
432 | <property name="visible">True</property> | ||
433 | <property name="can-focus">True</property> | ||
434 | </object> | ||
435 | <packing> | ||
436 | <property name="expand">False</property> | ||
437 | <property name="fill">True</property> | ||
438 | <property name="pack-type">end</property> | ||
439 | <property name="position">1</property> | ||
440 | </packing> | ||
441 | </child> | ||
442 | <style> | ||
443 | <class name="settings-entry"/> | ||
444 | </style> | ||
445 | </object> | ||
446 | </child> | ||
447 | </object> | ||
448 | </child> | ||
449 | <child> | ||
450 | <object class="HdyPreferencesRow"> | ||
451 | <property name="visible">True</property> | ||
452 | <property name="can-focus">True</property> | ||
453 | <property name="title" translatable="yes">Clear invitations automatically</property> | ||
454 | <child> | ||
455 | <object class="GtkBox"> | ||
456 | <property name="visible">True</property> | ||
457 | <property name="can-focus">False</property> | ||
458 | <child> | ||
459 | <object class="GtkLabel"> | ||
460 | <property name="visible">True</property> | ||
461 | <property name="can-focus">False</property> | ||
462 | <property name="label" translatable="yes">Clear invitations automatically</property> | ||
463 | <property name="xalign">0</property> | ||
464 | </object> | ||
465 | <packing> | ||
466 | <property name="expand">True</property> | ||
467 | <property name="fill">True</property> | ||
468 | <property name="position">0</property> | ||
469 | </packing> | ||
470 | </child> | ||
471 | <child> | ||
472 | <object class="GtkComboBox"> | ||
473 | <property name="visible">True</property> | ||
474 | <property name="can-focus">False</property> | ||
475 | <property name="model">delay_store</property> | ||
476 | <property name="active">0</property> | ||
477 | <child> | ||
478 | <object class="GtkCellRendererText"/> | ||
479 | <attributes> | ||
480 | <attribute name="text">0</attribute> | ||
481 | </attributes> | ||
482 | </child> | ||
483 | </object> | ||
484 | <packing> | ||
485 | <property name="expand">False</property> | ||
486 | <property name="fill">True</property> | ||
487 | <property name="position">1</property> | ||
488 | </packing> | ||
489 | </child> | ||
490 | <style> | ||
491 | <class name="settings-entry"/> | ||
492 | </style> | ||
493 | </object> | ||
494 | </child> | ||
495 | </object> | ||
496 | </child> | ||
497 | <child> | ||
498 | <object class="HdyPreferencesRow"> | ||
499 | <property name="visible">True</property> | ||
500 | <property name="can-focus">True</property> | ||
501 | <property name="title" translatable="yes">Clear all invitations</property> | ||
502 | <child> | ||
503 | <object class="GtkBox"> | ||
504 | <property name="visible">True</property> | ||
505 | <property name="can-focus">False</property> | ||
506 | <child> | ||
507 | <object class="GtkButton"> | ||
508 | <property name="label" translatable="yes">Clear all invitations</property> | ||
509 | <property name="visible">True</property> | ||
510 | <property name="can-focus">True</property> | ||
511 | <property name="receives-default">True</property> | ||
512 | <style> | ||
513 | <class name="delete-button"/> | ||
514 | </style> | ||
515 | </object> | ||
516 | <packing> | ||
517 | <property name="expand">False</property> | ||
518 | <property name="fill">True</property> | ||
519 | <property name="pack-type">end</property> | ||
520 | <property name="position">1</property> | ||
521 | </packing> | ||
522 | </child> | ||
523 | <style> | ||
524 | <class name="settings-entry"/> | ||
525 | </style> | ||
526 | </object> | ||
527 | </child> | ||
528 | </object> | ||
529 | </child> | ||
530 | </object> | ||
531 | </child> | ||
532 | <child> | ||
533 | <object class="HdyPreferencesGroup"> | ||
534 | <property name="visible">True</property> | ||
535 | <property name="can-focus">False</property> | ||
536 | <property name="title" translatable="yes">Files</property> | ||
537 | <child> | ||
538 | <object class="HdyPreferencesRow"> | ||
539 | <property name="visible">True</property> | ||
540 | <property name="can-focus">True</property> | ||
541 | <property name="title" translatable="yes">Automatically accept files</property> | ||
542 | <child> | ||
543 | <object class="GtkBox"> | ||
544 | <property name="visible">True</property> | ||
545 | <property name="can-focus">False</property> | ||
546 | <child> | ||
547 | <object class="GtkLabel"> | ||
548 | <property name="visible">True</property> | ||
549 | <property name="can-focus">False</property> | ||
550 | <property name="label" translatable="yes">Automatically accept files</property> | ||
551 | </object> | ||
552 | <packing> | ||
553 | <property name="expand">False</property> | ||
554 | <property name="fill">True</property> | ||
555 | <property name="position">0</property> | ||
556 | </packing> | ||
557 | </child> | ||
558 | <child> | ||
559 | <object class="GtkSwitch"> | ||
560 | <property name="visible">True</property> | ||
561 | <property name="can-focus">True</property> | ||
562 | </object> | ||
563 | <packing> | ||
564 | <property name="expand">False</property> | ||
565 | <property name="fill">True</property> | ||
566 | <property name="pack-type">end</property> | ||
567 | <property name="position">1</property> | ||
568 | </packing> | ||
569 | </child> | ||
570 | <style> | ||
571 | <class name="settings-entry"/> | ||
572 | </style> | ||
573 | </object> | ||
574 | </child> | ||
575 | </object> | ||
576 | </child> | ||
577 | <child> | ||
578 | <object class="HdyPreferencesRow"> | ||
579 | <property name="visible">True</property> | ||
580 | <property name="can-focus">True</property> | ||
581 | <property name="title" translatable="yes">Download folder</property> | ||
582 | <child> | ||
583 | <object class="GtkBox"> | ||
584 | <property name="visible">True</property> | ||
585 | <property name="can-focus">False</property> | ||
586 | <child> | ||
587 | <object class="GtkLabel"> | ||
588 | <property name="visible">True</property> | ||
589 | <property name="can-focus">False</property> | ||
590 | <property name="label" translatable="yes">Download folder</property> | ||
591 | <property name="ellipsize">end</property> | ||
592 | <property name="xalign">0</property> | ||
593 | </object> | ||
594 | <packing> | ||
595 | <property name="expand">True</property> | ||
596 | <property name="fill">True</property> | ||
597 | <property name="position">0</property> | ||
598 | </packing> | ||
599 | </child> | ||
600 | <child> | ||
601 | <object class="GtkFileChooserButton"> | ||
602 | <property name="visible">True</property> | ||
603 | <property name="can-focus">False</property> | ||
604 | <property name="title" translatable="yes">Select download folder</property> | ||
605 | </object> | ||
606 | <packing> | ||
607 | <property name="expand">False</property> | ||
608 | <property name="fill">True</property> | ||
609 | <property name="position">1</property> | ||
610 | </packing> | ||
611 | </child> | ||
612 | <style> | ||
613 | <class name="settings-entry"/> | ||
614 | </style> | ||
615 | </object> | ||
616 | </child> | ||
617 | </object> | ||
618 | </child> | ||
619 | <child> | ||
620 | <object class="HdyPreferencesRow"> | ||
621 | <property name="visible">True</property> | ||
622 | <property name="can-focus">True</property> | ||
623 | <property name="title" translatable="yes">Delete files automatically</property> | ||
624 | <child> | ||
625 | <object class="GtkBox"> | ||
626 | <property name="visible">True</property> | ||
627 | <property name="can-focus">False</property> | ||
628 | <child> | ||
629 | <object class="GtkLabel"> | ||
630 | <property name="visible">True</property> | ||
631 | <property name="can-focus">False</property> | ||
632 | <property name="label" translatable="yes">Delete files automatically</property> | ||
633 | <property name="xalign">0</property> | ||
634 | </object> | ||
635 | <packing> | ||
636 | <property name="expand">True</property> | ||
637 | <property name="fill">True</property> | ||
638 | <property name="position">0</property> | ||
639 | </packing> | ||
640 | </child> | ||
641 | <child> | ||
642 | <object class="GtkComboBox"> | ||
643 | <property name="visible">True</property> | ||
644 | <property name="can-focus">False</property> | ||
645 | <property name="model">delay_store</property> | ||
646 | <property name="active">0</property> | ||
647 | <child> | ||
648 | <object class="GtkCellRendererText"/> | ||
649 | <attributes> | ||
650 | <attribute name="text">0</attribute> | ||
651 | </attributes> | ||
652 | </child> | ||
653 | </object> | ||
654 | <packing> | ||
655 | <property name="expand">False</property> | ||
656 | <property name="fill">True</property> | ||
657 | <property name="position">1</property> | ||
658 | </packing> | ||
659 | </child> | ||
660 | <style> | ||
661 | <class name="settings-entry"/> | ||
662 | </style> | ||
663 | </object> | ||
664 | </child> | ||
665 | </object> | ||
666 | </child> | ||
667 | <child> | ||
668 | <object class="HdyPreferencesRow"> | ||
669 | <property name="visible">True</property> | ||
670 | <property name="can-focus">True</property> | ||
671 | <property name="title" translatable="yes">Delete all files</property> | ||
672 | <child> | ||
673 | <object class="GtkBox"> | ||
674 | <property name="visible">True</property> | ||
675 | <property name="can-focus">False</property> | ||
676 | <child> | ||
677 | <object class="GtkButton"> | ||
678 | <property name="label" translatable="yes">Delete all files</property> | ||
679 | <property name="visible">True</property> | ||
680 | <property name="can-focus">True</property> | ||
681 | <property name="receives-default">True</property> | ||
682 | <style> | ||
683 | <class name="delete-button"/> | ||
684 | </style> | ||
685 | </object> | ||
686 | <packing> | ||
687 | <property name="expand">False</property> | ||
688 | <property name="fill">True</property> | ||
689 | <property name="pack-type">end</property> | ||
690 | <property name="position">1</property> | ||
691 | </packing> | ||
692 | </child> | ||
693 | <style> | ||
694 | <class name="settings-entry"/> | ||
695 | </style> | ||
696 | </object> | ||
697 | </child> | ||
698 | </object> | ||
699 | </child> | ||
700 | </object> | ||
701 | </child> | ||
702 | <child> | ||
703 | <object class="HdyPreferencesGroup"> | ||
704 | <property name="visible">True</property> | ||
705 | <property name="can-focus">False</property> | ||
706 | <property name="title" translatable="yes">Rooms</property> | ||
707 | <child> | ||
708 | <object class="HdyPreferencesRow"> | ||
709 | <property name="visible">True</property> | ||
710 | <property name="can-focus">True</property> | ||
711 | <property name="title" translatable="yes">Leave rooms automatically</property> | ||
712 | <child> | ||
713 | <object class="GtkBox"> | ||
714 | <property name="visible">True</property> | ||
715 | <property name="can-focus">False</property> | ||
716 | <child> | ||
717 | <object class="GtkLabel"> | ||
718 | <property name="visible">True</property> | ||
719 | <property name="can-focus">False</property> | ||
720 | <property name="label" translatable="yes">Leave rooms automatically</property> | ||
721 | <property name="xalign">0</property> | ||
722 | </object> | ||
723 | <packing> | ||
724 | <property name="expand">True</property> | ||
725 | <property name="fill">True</property> | ||
726 | <property name="position">0</property> | ||
727 | </packing> | ||
728 | </child> | ||
729 | <child> | ||
730 | <object class="GtkComboBox"> | ||
731 | <property name="visible">True</property> | ||
732 | <property name="can-focus">False</property> | ||
733 | <property name="model">delay_store</property> | ||
734 | <property name="active">0</property> | ||
735 | <child> | ||
736 | <object class="GtkCellRendererText"/> | ||
737 | <attributes> | ||
738 | <attribute name="text">0</attribute> | ||
739 | </attributes> | ||
740 | </child> | ||
741 | </object> | ||
742 | <packing> | ||
743 | <property name="expand">False</property> | ||
744 | <property name="fill">True</property> | ||
745 | <property name="position">1</property> | ||
746 | </packing> | ||
747 | </child> | ||
748 | <style> | ||
749 | <class name="settings-entry"/> | ||
750 | </style> | ||
751 | </object> | ||
752 | </child> | ||
753 | </object> | ||
754 | </child> | ||
755 | <child> | ||
756 | <object class="HdyPreferencesRow"> | ||
757 | <property name="visible">True</property> | ||
758 | <property name="can-focus">True</property> | ||
759 | <property name="title" translatable="yes">Leave all rooms</property> | ||
760 | <child> | ||
761 | <object class="GtkBox"> | ||
762 | <property name="visible">True</property> | ||
763 | <property name="can-focus">False</property> | ||
764 | <child> | ||
765 | <object class="GtkButton"> | ||
766 | <property name="label" translatable="yes">Leave all rooms</property> | ||
767 | <property name="visible">True</property> | ||
768 | <property name="can-focus">True</property> | ||
769 | <property name="receives-default">True</property> | ||
770 | <style> | ||
771 | <class name="delete-button"/> | ||
772 | </style> | ||
773 | </object> | ||
774 | <packing> | ||
775 | <property name="expand">False</property> | ||
776 | <property name="fill">True</property> | ||
777 | <property name="pack-type">end</property> | ||
778 | <property name="position">1</property> | ||
779 | </packing> | ||
780 | </child> | ||
781 | <style> | ||
782 | <class name="settings-entry"/> | ||
783 | </style> | ||
784 | </object> | ||
785 | </child> | ||
786 | </object> | ||
787 | </child> | ||
788 | </object> | ||
789 | </child> | ||
790 | </object> | ||
791 | </child> | ||
792 | </object> | ||
793 | </interface> | ||
diff --git a/src/application.h b/src/application.h index 4a56ffd..6b99bdd 100644 --- a/src/application.h +++ b/src/application.h | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "ui/messenger.h" | 33 | #include "ui/messenger.h" |
34 | #include "ui/new_contact.h" | 34 | #include "ui/new_contact.h" |
35 | #include "ui/new_platform.h" | 35 | #include "ui/new_platform.h" |
36 | #include "ui/settings.h" | ||
36 | 37 | ||
37 | #include "util.h" | 38 | #include "util.h" |
38 | 39 | ||
@@ -70,6 +71,7 @@ typedef struct MESSENGER_Application | |||
70 | UI_NEW_CONTACT_Handle new_contact; | 71 | UI_NEW_CONTACT_Handle new_contact; |
71 | UI_NEW_PLATFORM_Handle new_platform; | 72 | UI_NEW_PLATFORM_Handle new_platform; |
72 | UI_CONTACTS_Handle contacts; | 73 | UI_CONTACTS_Handle contacts; |
74 | UI_SETTINGS_Handle settings; | ||
73 | } ui; | 75 | } ui; |
74 | } MESSENGER_Application; | 76 | } MESSENGER_Application; |
75 | 77 | ||
diff --git a/src/ui/messenger.c b/src/ui/messenger.c index 8842385..314edb4 100644 --- a/src/ui/messenger.c +++ b/src/ui/messenger.c | |||
@@ -31,6 +31,8 @@ | |||
31 | #include "message.h" | 31 | #include "message.h" |
32 | #include "new_contact.h" | 32 | #include "new_contact.h" |
33 | #include "new_platform.h" | 33 | #include "new_platform.h" |
34 | #include "settings.h" | ||
35 | |||
34 | #include "../application.h" | 36 | #include "../application.h" |
35 | 37 | ||
36 | static void | 38 | static void |
@@ -108,6 +110,19 @@ handle_contacts_button_click(UNUSED GtkButton* button, | |||
108 | } | 110 | } |
109 | 111 | ||
110 | static void | 112 | static void |
113 | handle_settings_button_click(UNUSED GtkButton* button, | ||
114 | gpointer user_data) | ||
115 | { | ||
116 | MESSENGER_Application *app = (MESSENGER_Application*) user_data; | ||
117 | |||
118 | hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE); | ||
119 | |||
120 | ui_settings_dialog_init(app, &(app->ui.settings)); | ||
121 | |||
122 | gtk_widget_show(GTK_WIDGET(app->ui.settings.dialog)); | ||
123 | } | ||
124 | |||
125 | static void | ||
111 | handle_chats_listbox_row_activated(UNUSED GtkListBox* listbox, | 126 | handle_chats_listbox_row_activated(UNUSED GtkListBox* listbox, |
112 | GtkListBoxRow* row, | 127 | GtkListBoxRow* row, |
113 | gpointer user_data) | 128 | gpointer user_data) |
@@ -282,6 +297,13 @@ ui_messenger_init(MESSENGER_Application *app, | |||
282 | app | 297 | app |
283 | ); | 298 | ); |
284 | 299 | ||
300 | g_signal_connect( | ||
301 | handle->settings_button, | ||
302 | "clicked", | ||
303 | G_CALLBACK(handle_settings_button_click), | ||
304 | app | ||
305 | ); | ||
306 | |||
285 | handle->user_details_button = GTK_BUTTON( | 307 | handle->user_details_button = GTK_BUTTON( |
286 | gtk_builder_get_object(handle->builder, "user_details_button") | 308 | gtk_builder_get_object(handle->builder, "user_details_button") |
287 | ); | 309 | ); |
diff --git a/src/ui/settings.c b/src/ui/settings.c new file mode 100644 index 0000000..ca58270 --- /dev/null +++ b/src/ui/settings.c | |||
@@ -0,0 +1,63 @@ | |||
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/settings.c | ||
23 | */ | ||
24 | |||
25 | #include "settings.h" | ||
26 | |||
27 | #include "../application.h" | ||
28 | |||
29 | static void | ||
30 | handle_dialog_destroy(UNUSED GtkWidget *window, | ||
31 | gpointer user_data) | ||
32 | { | ||
33 | ui_settings_dialog_cleanup((UI_SETTINGS_Handle*) user_data); | ||
34 | } | ||
35 | |||
36 | void | ||
37 | ui_settings_dialog_init(MESSENGER_Application *app, | ||
38 | UI_SETTINGS_Handle *handle) | ||
39 | { | ||
40 | handle->builder = gtk_builder_new_from_file("resources/ui/settings.ui"); | ||
41 | |||
42 | handle->dialog = HDY_PREFERENCES_WINDOW( | ||
43 | gtk_builder_get_object(handle->builder, "settings_dialog") | ||
44 | ); | ||
45 | |||
46 | gtk_window_set_transient_for( | ||
47 | GTK_WINDOW(handle->dialog), | ||
48 | GTK_WINDOW(app->ui.messenger.main_window) | ||
49 | ); | ||
50 | |||
51 | g_signal_connect( | ||
52 | handle->dialog, | ||
53 | "destroy", | ||
54 | G_CALLBACK(handle_dialog_destroy), | ||
55 | handle | ||
56 | ); | ||
57 | } | ||
58 | |||
59 | void | ||
60 | ui_settings_dialog_cleanup(UI_SETTINGS_Handle *handle) | ||
61 | { | ||
62 | g_object_unref(handle->builder); | ||
63 | } | ||
diff --git a/src/ui/settings.h b/src/ui/settings.h new file mode 100644 index 0000000..733efed --- /dev/null +++ b/src/ui/settings.h | |||
@@ -0,0 +1,43 @@ | |||
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/settings.h | ||
23 | */ | ||
24 | |||
25 | #ifndef UI_SETTINGS_H_ | ||
26 | #define UI_SETTINGS_H_ | ||
27 | |||
28 | #include "messenger.h" | ||
29 | |||
30 | typedef struct UI_SETTINGS_Handle | ||
31 | { | ||
32 | GtkBuilder *builder; | ||
33 | HdyPreferencesWindow *dialog; | ||
34 | } UI_SETTINGS_Handle; | ||
35 | |||
36 | void | ||
37 | ui_settings_dialog_init(MESSENGER_Application *app, | ||
38 | UI_SETTINGS_Handle *handle); | ||
39 | |||
40 | void | ||
41 | ui_settings_dialog_cleanup(UI_SETTINGS_Handle *handle); | ||
42 | |||
43 | #endif /* UI_SETTINGS_H_ */ | ||