aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2021-12-23 22:55:31 +0100
committerTheJackiMonster <thejackimonster@gmail.com>2021-12-23 22:55:31 +0100
commit04865c9e12b9d5ab3507936c554de605c79dc353 (patch)
treeddac0691b7b2a540658cbac9f1620df637d6f762
parent7e69780bb3d18e5abe01202b3b7881548fc5be72 (diff)
downloadmessenger-gtk-04865c9e12b9d5ab3507936c554de605c79dc353.tar.gz
messenger-gtk-04865c9e12b9d5ab3507936c554de605c79dc353.zip
Added icon, desktop-file and used glib resources to load ui
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r--Makefile56
-rw-r--r--resources/.gitignore1
-rw-r--r--resources/css.gresource.xml6
-rw-r--r--resources/icon/full_color.svg198
-rw-r--r--resources/icon/full_color_128.pngbin0 -> 5794 bytes
-rw-r--r--resources/icon/full_color_256.pngbin0 -> 11110 bytes
-rw-r--r--resources/icon/full_color_32.pngbin0 -> 1464 bytes
-rw-r--r--resources/icon/full_color_512.pngbin0 -> 23550 bytes
-rw-r--r--resources/icon/full_color_64.pngbin0 -> 2818 bytes
-rw-r--r--resources/messenger-gtk.desktop14
-rw-r--r--resources/ui.gresource.xml22
-rw-r--r--src/application.c27
-rw-r--r--src/application.h4
-rw-r--r--src/event.c22
-rw-r--r--src/resources.c44
-rw-r--r--src/resources.h34
-rw-r--r--src/ui/chat.c8
-rw-r--r--src/ui/chat_entry.c4
-rw-r--r--src/ui/contact_entry.c6
-rw-r--r--src/ui/contact_entry.h2
-rw-r--r--src/ui/contacts.c6
-rw-r--r--src/ui/invite_contact.c6
-rw-r--r--src/ui/message.c44
-rw-r--r--src/ui/message.h11
-rw-r--r--src/ui/messenger.c4
-rw-r--r--src/ui/new_contact.c4
-rw-r--r--src/ui/new_group.c6
-rw-r--r--src/ui/new_platform.c4
-rw-r--r--src/ui/new_profile.c4
-rw-r--r--src/ui/picker.c4
-rw-r--r--src/ui/profile_entry.c6
-rw-r--r--src/ui/profile_entry.h2
-rw-r--r--src/ui/send_file.c4
-rw-r--r--src/ui/settings.c4
34 files changed, 462 insertions, 95 deletions
diff --git a/Makefile b/Makefile
index d7710e9..dbb4e39 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,14 @@
1 1
2SOURCE_DIR = src/ 2RESOURCES_DIR = resources/
3INSTALL_DIR ?= /usr/local/ 3SOURCE_DIR = src/
4INSTALL_DIR ?= /usr/local/
4 5
5BINARY = messenger-gtk 6BINARY = messenger-gtk
6SOURCES = messenger_gtk.c\ 7SOURCES = messenger_gtk.c\
7 application.c\ 8 application.c\
8 contact.c\ 9 contact.c\
9 event.c\ 10 event.c\
11 resources.c\
10 chat/messenger.c\ 12 chat/messenger.c\
11 ui/chat.c\ 13 ui/chat.c\
12 ui/chat_entry.c\ 14 ui/chat_entry.c\
@@ -23,8 +25,11 @@ SOURCES = messenger_gtk.c\
23 ui/profile_entry.c\ 25 ui/profile_entry.c\
24 ui/send_file.c\ 26 ui/send_file.c\
25 ui/settings.c 27 ui/settings.c
26 28
27HEADERS = 29HEADERS = util.h
30
31RESOURCES = css.gresource.xml\
32 ui.gresource.xml
28 33
29LIBRARIES = gnunetchat 34LIBRARIES = gnunetchat
30PACKAGES = gnunetutil libhandy-1 gtk+-3.0 libnotify zbar libqrencode 35PACKAGES = gnunetutil libhandy-1 gtk+-3.0 libnotify zbar libqrencode
@@ -34,21 +39,43 @@ GNU_CC ?= gcc
34GNU_LD ?= gcc 39GNU_LD ?= gcc
35GNU_RM ?= rm 40GNU_RM ?= rm
36 41
37CFLAGS += -pedantic -Wall -Wextra -ggdb3 42GLIB_COMPILE_RESOURCES ?= glib-compile-resources
43
44CFLAGS += -pedantic -Wall -Wextra -ggdb3 -Wno-overlength-strings
38LDFLAGS += 45LDFLAGS +=
39 46
40DEBUGFLAGS = -O0 -D _DEBUG 47DEBUGFLAGS = -O0 -D _DEBUG
41RELEASEFLAGS = -O2 -D NDEBUG 48RELEASEFLAGS = -O2 -D NDEBUG
42 49
43SOURCE_FILES = $(addprefix $(SOURCE_DIR), $(SOURCES)) 50ICON_SIZES = 32\
44OBJECT_FILES = $(SOURCE_FILES:%.c=%.o) 51 64\
52 128\
53 256\
54 512
55
56APPICON_DIR = $(addprefix $(RESOURCES_DIR), icon/)
57
58RESOURCES_FILES = $(addprefix $(RESOURCES_DIR), $(RESOURCES))
59
60SOURCE_FILES = $(RESOURCES_FILES:%.gresource.xml=%.c)\
61 $(addprefix $(SOURCE_DIR), $(SOURCES))
62
63RESOURCES_HEADERS = $(RESOURCES_FILES:%.gresource.xml=%.h)
64
45HEADER_FILES = $(addprefix $(SOURCE_DIR), $(HEADERS)) 65HEADER_FILES = $(addprefix $(SOURCE_DIR), $(HEADERS))
66
67OBJECT_FILES = $(SOURCE_FILES:%.c=%.o)
68
46LIBRARY_FLAGS = $(addprefix -l, $(LIBRARIES)) 69LIBRARY_FLAGS = $(addprefix -l, $(LIBRARIES))
47PACKAGE_FLAGS = $(shell pkg-config --cflags --libs $(PACKAGES)) 70PACKAGE_FLAGS = $(shell pkg-config --cflags --libs $(PACKAGES))
48INCLUDE_FLAGS = $(addprefix -I, $(INCLUDES)) 71INCLUDE_FLAGS = $(addprefix -I, $(INCLUDES))
49 72
50all: $(BINARY) 73all: $(BINARY)
51 74
75%.c: %.gresource.xml
76 $(GLIB_COMPILE_RESOURCES) --sourcedir=$(RESOURCES_DIR) $< --generate-source
77 $(GLIB_COMPILE_RESOURCES) --sourcedir=$(RESOURCES_DIR) $< --generate-header
78
52debug: CFLAGS += $(DEBUGFLAGS) 79debug: CFLAGS += $(DEBUGFLAGS)
53debug: $(BINARY) 80debug: $(BINARY)
54 81
@@ -68,16 +95,29 @@ mobile: $(BINARY)
68 95
69.PHONY: install 96.PHONY: install
70 97
98define install-icon
99 install -Dm644 $(addprefix $(APPICON_DIR), full_color_$(1).png) $(addprefix $(INSTALL_DIR), share/icons/hicolor/$(1)x$(1)/apps/$(BINARY).png)
100endef
101
71install: 102install:
72 install -m 755 $(BINARY) $(addprefix $(INSTALL_DIR), bin/) 103 install -Dm755 $(BINARY) $(addprefix $(INSTALL_DIR), bin/)
104 $(foreach SIZE,$(ICON_SIZES),$(call install-icon,$(SIZE));)
105 install -Dm644 $(addprefix $(RESOURCES_DIR), $(BINARY).desktop) $(addprefix $(INSTALL_DIR), share/applications/)
73 106
74.PHONY: uninstall 107.PHONY: uninstall
75 108
109define uninstall-icon
110 $(GNU_RM) -f $(addprefix $(INSTALL_DIR), share/icons/hicolor/$(1)x$(1)/apps/$(BINARY).png)
111endef
112
76uninstall: 113uninstall:
77 $(GNU_RM) -f $(addsuffix $(BINARY), $(addprefix $(INSTALL_DIR), bin/)) 114 $(GNU_RM) -f $(addsuffix $(BINARY), $(addprefix $(INSTALL_DIR), bin/))
115 $(foreach SIZE,$(ICON_SIZES),$(call uninstall-icon,$(SIZE)))
116 $(GNU_RM) -f $(addsuffix $(BINARY).desktop, $(addprefix $(INSTALL_DIR), share/applications/))
78 117
79.PHONY: clean 118.PHONY: clean
80 119
81clean: 120clean:
82 $(GNU_RM) -f $(BINARY) 121 $(GNU_RM) -f $(BINARY)
83 $(GNU_RM) -f $(OBJECT_FILES) 122 $(GNU_RM) -f $(OBJECT_FILES)
123 $(GNU_RM) -f $(RESOURCES_HEADERS)
diff --git a/resources/.gitignore b/resources/.gitignore
new file mode 100644
index 0000000..db4787e
--- /dev/null
+++ b/resources/.gitignore
@@ -0,0 +1 @@
*.h \ No newline at end of file
diff --git a/resources/css.gresource.xml b/resources/css.gresource.xml
new file mode 100644
index 0000000..bff70fb
--- /dev/null
+++ b/resources/css.gresource.xml
@@ -0,0 +1,6 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<gresources>
3 <gresource prefix="/org/gnunet/Messenger-GTK">
4 <file>css/style.css</file>
5 </gresource>
6</gresources> \ No newline at end of file
diff --git a/resources/icon/full_color.svg b/resources/icon/full_color.svg
new file mode 100644
index 0000000..14c3b32
--- /dev/null
+++ b/resources/icon/full_color.svg
@@ -0,0 +1,198 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<svg
3 inkscape:export-ydpi="384.00003"
4 inkscape:export-xdpi="384.00003"
5 inkscape:export-filename="/home/thejackimonster/git/messenger-gtk/resources/icon/full_color_512.png"
6 sodipodi:docname="full_color.svg"
7 inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20, custom)"
8 id="svg1209"
9 version="1.1"
10 viewBox="0 0 33.866667 33.866667"
11 height="128"
12 width="128"
13 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
14 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
15 xmlns:xlink="http://www.w3.org/1999/xlink"
16 xmlns="http://www.w3.org/2000/svg"
17 xmlns:svg="http://www.w3.org/2000/svg"
18 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
19 xmlns:cc="http://creativecommons.org/ns#"
20 xmlns:dc="http://purl.org/dc/elements/1.1/">
21 <title
22 id="title850">Cadet-GTK Full Color Icon</title>
23 <defs
24 id="defs1203">
25 <linearGradient
26 id="linearGradient2693"
27 inkscape:collect="always">
28 <stop
29 id="stop2689"
30 offset="0"
31 style="stop-color:#cae4f5;stop-opacity:1" />
32 <stop
33 id="stop2691"
34 offset="1"
35 style="stop-color:#ffffff;stop-opacity:1" />
36 </linearGradient>
37 <linearGradient
38 id="linearGradient2685"
39 inkscape:collect="always">
40 <stop
41 id="stop2681"
42 offset="0"
43 style="stop-color:#cae4f5;stop-opacity:1" />
44 <stop
45 id="stop2683"
46 offset="1"
47 style="stop-color:#ffffff;stop-opacity:1" />
48 </linearGradient>
49 <linearGradient
50 gradientUnits="userSpaceOnUse"
51 y2="5.9243097"
52 x2="17.235741"
53 y1="22.5128"
54 x1="17.037195"
55 id="linearGradient2687"
56 xlink:href="#linearGradient2685"
57 inkscape:collect="always" />
58 <linearGradient
59 gradientUnits="userSpaceOnUse"
60 y2="5.9243097"
61 x2="17.235741"
62 y1="22.5128"
63 x1="17.037195"
64 id="linearGradient2695"
65 xlink:href="#linearGradient2693"
66 inkscape:collect="always" />
67 </defs>
68 <sodipodi:namedview
69 inkscape:window-maximized="0"
70 inkscape:window-y="20"
71 inkscape:window-x="20"
72 inkscape:window-height="1371"
73 inkscape:window-width="1280"
74 height="128px"
75 units="px"
76 showgrid="false"
77 inkscape:document-rotation="0"
78 inkscape:current-layer="layer9"
79 inkscape:document-units="mm"
80 inkscape:cy="82.250001"
81 inkscape:cx="45.375"
82 inkscape:zoom="4"
83 inkscape:pageshadow="2"
84 inkscape:pageopacity="0.0"
85 borderopacity="1.0"
86 bordercolor="#666666"
87 pagecolor="#ffffff"
88 id="base"
89 inkscape:pagecheckerboard="true" />
90 <metadata
91 id="metadata1206">
92 <rdf:RDF>
93 <cc:Work
94 rdf:about="">
95 <dc:format>image/svg+xml</dc:format>
96 <dc:type
97 rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
98 <dc:title>Cadet-GTK Full Color Icon</dc:title>
99 <cc:license
100 rdf:resource="http://creativecommons.org/publicdomain/zero/1.0/" />
101 <dc:date>20.06.2020</dc:date>
102 <dc:creator>
103 <cc:Agent>
104 <dc:title>Tobias Frisch</dc:title>
105 </cc:Agent>
106 </dc:creator>
107 <dc:publisher>
108 <cc:Agent>
109 <dc:title>Tobias Frisch</dc:title>
110 </cc:Agent>
111 </dc:publisher>
112 </cc:Work>
113 <cc:License
114 rdf:about="http://creativecommons.org/publicdomain/zero/1.0/">
115 <cc:permits
116 rdf:resource="http://creativecommons.org/ns#Reproduction" />
117 <cc:permits
118 rdf:resource="http://creativecommons.org/ns#Distribution" />
119 <cc:permits
120 rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
121 </cc:License>
122 </rdf:RDF>
123 </metadata>
124 <g
125 style="display:inline"
126 inkscape:label="speech"
127 id="layer7"
128 inkscape:groupmode="layer"
129 sodipodi:insensitive="true">
130 <g
131 id="g2588"
132 style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none">
133 <rect
134 ry="3.2343187"
135 y="4.2197413"
136 x="2.0222893"
137 height="25.288448"
138 width="29.822088"
139 id="rect2536-5"
140 style="display:inline;fill:#22af22;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke markers fill" />
141 <rect
142 style="fill:#41db41;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke markers fill"
143 id="rect2536"
144 width="29.822086"
145 height="25.004473"
146 x="2.0222902"
147 y="3.3889046"
148 ry="3.1979992" />
149 <path
150 id="path2567-3"
151 d="m 15.460665,29.382866 -11.7363798,3.622699 4.95e-5,-0.989758 C 8.315252,29.320779 11.753889,29.15079 15.460714,28.393108 Z"
152 style="display:inline;fill:#22af22;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
153 sodipodi:nodetypes="ccccc" />
154 <path
155 style="fill:#41db41;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
156 d="M 15.460714,28.393108 3.7243347,32.015807 7.1226253,27.750236 Z"
157 id="path2567" />
158 </g>
159 </g>
160 <g
161 inkscape:label="abstract"
162 id="layer8"
163 inkscape:groupmode="layer"
164 style="display:inline"
165 sodipodi:insensitive="true">
166 <path
167 id="path2609"
168 d="m 24.212469,7.4964826 v 0.6710005 l 3.220454,1.3419431 V 8.8384257 Z"
169 style="fill:#22af22;fill-opacity:1;stroke:#22af22;stroke-width:0.264583px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" />
170 <path
171 sodipodi:nodetypes="ccccc"
172 id="path2611"
173 d="m 10.138688,7.4568379 -0.0043,0.5492806 -3.7016775,1.5286239 1e-7,-0.6710006 z"
174 style="fill:#22af22;fill-opacity:1;stroke:#22af22;stroke-width:0.264583px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" />
175 <path
176 style="fill:#22af22;fill-opacity:1;stroke:#22af22;stroke-width:0.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
177 d="m 10.022067,7.5034378 c -0.5333194,0.833367 -0.9668022,1.726601 -1.3537552,2.6477362 0.6745998,0.42663 1.3900932,0.829291 2.1975522,1.178046 0.664157,-0.111091 1.196816,-0.434828 1.747717,-0.729067 0.738694,1.148835 1.612844,2.266659 2.549213,3.37024 0.05185,0.641311 0.391592,1.444088 0.779771,2.274034 0.487043,0.08719 1.338117,0.03541 2.244909,-0.03763 0.288827,-0.847267 0.587654,-1.681769 0.810159,-2.613705 0.572787,-0.849805 1.158831,-1.68611 1.614033,-2.65565 1.320517,-0.09736 2.66522,-0.140633 3.938912,-0.342728 0.351716,-0.130912 0.745912,-0.217613 0.954731,-0.497246 -0.377639,-0.9704162 -1.182623,-2.2649688 -1.29284,-2.6009852 1.022028,0.501992 2.093066,0.951907 3.220454,1.341943 -0.438905,0.8940442 -0.76765,1.8519602 -1.08419,2.8169532 -1.346651,0.261521 -2.689009,0.540519 -4.012966,0.894441 -0.565235,0.930355 -1.023816,1.90609 -1.490516,2.878371 -0.335084,0.951673 -0.646819,1.885846 -0.949155,2.812975 -0.463826,1.090376 -0.92844,2.241624 -1.391779,3.580121 -1.068806,-0.03388 -2.123796,-0.05246 -3.084791,0.03299 C 14.81844,19.982855 14.249746,18.094645 13.583788,16.276004 13.018325,15.094653 12.493157,13.954545 11.85664,12.700466 11.308898,12.572293 10.691499,12.588294 10.070655,12.611426 9.1131819,12.031736 8.142282,11.475495 7.1612636,10.936924 6.9643046,10.234649 6.7502707,9.536547 6.4327186,8.8637418 7.7687959,8.5194338 8.9093392,8.0223058 10.022067,7.5034378 Z"
178 id="path2532-5"
179 sodipodi:nodetypes="ccccccccccccccccccccccccc" />
180 <path
181 sodipodi:nodetypes="ccccccccccccccccccccccccc"
182 id="path2532"
183 d="M 10.022067,8.1744387 C 9.4887473,9.0078054 9.0552647,9.9010394 8.6683116,10.822174 c 0.6745998,0.42663 1.3900934,0.829291 2.1975524,1.178046 0.664157,-0.111091 1.196816,-0.434828 1.747717,-0.729067 0.738694,1.148835 1.612844,2.266659 2.549213,3.37024 0.05185,0.641311 0.391592,1.444088 0.779771,2.274034 0.487043,0.08719 1.338117,0.03541 2.244909,-0.03763 0.288827,-0.847267 0.587654,-1.681769 0.810159,-2.613705 0.572787,-0.849805 1.158831,-1.68611 1.614033,-2.65565 1.320517,-0.09736 2.66522,-0.140633 3.938912,-0.342728 0.351716,-0.130912 0.745912,-0.217613 0.954731,-0.497246 -0.377639,-0.9704156 -0.846464,-1.7639246 -1.29284,-2.6009847 1.022028,0.5019921 2.093066,0.9519071 3.220454,1.3419431 -0.438905,0.8940436 -0.76765,1.8519596 -1.08419,2.8169526 -1.346651,0.261521 -2.689009,0.540519 -4.012966,0.894441 -0.565235,0.930355 -1.023816,1.90609 -1.490516,2.878371 -0.335084,0.951673 -0.646819,1.885846 -0.949155,2.812974 -0.463826,1.090376 -0.92844,2.241625 -1.391779,3.580121 -1.068806,-0.03388 -2.123796,-0.05246 -3.084791,0.03299 C 14.81844,20.653855 14.249746,18.765644 13.583788,16.947004 13.018325,15.765653 12.493157,14.625545 11.85664,13.371466 11.308898,13.243293 10.691499,13.259294 10.070655,13.282426 9.1131817,12.702736 8.1422819,12.146495 7.1612635,11.607924 6.9643045,10.905649 6.7502706,10.207547 6.4327185,9.5347424 7.7687958,9.1904344 8.909339,8.6933064 10.022067,8.1744387 Z"
184 style="fill:url(#linearGradient2695);fill-opacity:1;stroke:url(#linearGradient2687);stroke-width:0.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
185 </g>
186 <g
187 style="display:inline;mix-blend-mode:soft-light"
188 inkscape:label="light"
189 id="layer9"
190 inkscape:groupmode="layer"
191 sodipodi:insensitive="true">
192 <path
193 sodipodi:nodetypes="ccccccccccccccc"
194 id="path2697"
195 d="m 7.1614078,11.61309 8.2993062,16.780017 12.402689,-0.01103 c 2.367207,0.291295 4.203301,-1.228348 3.978783,-3.794721 L 27.554263,9.4724672 c -0.457817,1.0226548 -0.759177,1.9095408 -1.08419,2.8169508 l -4.134306,0.9314 -1.490516,2.878371 -0.949155,2.812974 -1.391779,3.580121 -3.084791,0.03299 -1.835738,-5.578272 -1.727148,-3.575538 -1.785985,-0.08904 z"
196 style="opacity:1;fill:#aeaeae;fill-opacity:1;stroke:none;stroke-width:0.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
197 </g>
198</svg>
diff --git a/resources/icon/full_color_128.png b/resources/icon/full_color_128.png
new file mode 100644
index 0000000..d42138a
--- /dev/null
+++ b/resources/icon/full_color_128.png
Binary files differ
diff --git a/resources/icon/full_color_256.png b/resources/icon/full_color_256.png
new file mode 100644
index 0000000..653bee8
--- /dev/null
+++ b/resources/icon/full_color_256.png
Binary files differ
diff --git a/resources/icon/full_color_32.png b/resources/icon/full_color_32.png
new file mode 100644
index 0000000..5cd5195
--- /dev/null
+++ b/resources/icon/full_color_32.png
Binary files differ
diff --git a/resources/icon/full_color_512.png b/resources/icon/full_color_512.png
new file mode 100644
index 0000000..b1e5821
--- /dev/null
+++ b/resources/icon/full_color_512.png
Binary files differ
diff --git a/resources/icon/full_color_64.png b/resources/icon/full_color_64.png
new file mode 100644
index 0000000..3dd605a
--- /dev/null
+++ b/resources/icon/full_color_64.png
Binary files differ
diff --git a/resources/messenger-gtk.desktop b/resources/messenger-gtk.desktop
new file mode 100644
index 0000000..a521907
--- /dev/null
+++ b/resources/messenger-gtk.desktop
@@ -0,0 +1,14 @@
1[Desktop Entry]
2Version=0.0.1
3Name=Messenger-GTK
4Comment=A GTK based GUI for the Messenger service of GNUnet.
5TryExec=messenger-gtk
6Exec=messenger-gtk
7Icon=messenger-gtk
8Terminal=false
9StartupWMClass=MessengerGTK
10Type=Application
11Categories=Chat;Network;InstantMessaging;GTK;FileSharing;
12MimeType=x-scheme-handler/messenger-gtk;
13Keywords=messenger-gtk;chat;im;messaging;messenger;gtk;
14X-GNOME-UsesNotifications=true
diff --git a/resources/ui.gresource.xml b/resources/ui.gresource.xml
new file mode 100644
index 0000000..27cf432
--- /dev/null
+++ b/resources/ui.gresource.xml
@@ -0,0 +1,22 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<gresources>
3 <gresource prefix="/org/gnunet/Messenger-GTK">
4 <file compressed="true">ui/chat_entry.ui</file>
5 <file compressed="true">ui/chat.ui</file>
6 <file compressed="true">ui/contacts.ui</file>
7 <file compressed="true">ui/invite_contact.ui</file>
8 <file compressed="true">ui/message_content.ui</file>
9 <file compressed="true">ui/message.ui</file>
10 <file compressed="true">ui/message-sent.ui</file>
11 <file compressed="true">ui/message-status.ui</file>
12 <file compressed="true">ui/messenger.ui</file>
13 <file compressed="true">ui/new_contact.ui</file>
14 <file compressed="true">ui/new_group.ui</file>
15 <file compressed="true">ui/new_platform.ui</file>
16 <file compressed="true">ui/new_profile.ui</file>
17 <file compressed="true">ui/picker.ui</file>
18 <file compressed="true">ui/profile_entry.ui</file>
19 <file compressed="true">ui/send_file.ui</file>
20 <file compressed="true">ui/settings.ui</file>
21 </gresource>
22</gresources> \ No newline at end of file
diff --git a/src/application.c b/src/application.c
index 7c78de0..f1a2fd8 100644
--- a/src/application.c
+++ b/src/application.c
@@ -23,16 +23,17 @@
23 */ 23 */
24 24
25#include "application.h" 25#include "application.h"
26#include "resources.h"
26 27
27static void 28static void
28_load_ui_stylesheets(void) 29_load_ui_stylesheets(void)
29{ 30{
30 GdkScreen* screen = gdk_screen_get_default(); 31 GdkScreen* screen = gdk_screen_get_default();
31 GtkCssProvider* provider = gtk_css_provider_new(); 32 GtkCssProvider* provider = gtk_css_provider_new();
32 gtk_css_provider_load_from_path( 33
34 gtk_css_provider_load_from_resource(
33 provider, 35 provider,
34 "resources/css/style.css", 36 "org/gnunet/Messenger-GTK/css/style.css"
35 NULL
36 ); 37 );
37 38
38 gtk_style_context_add_provider_for_screen( 39 gtk_style_context_add_provider_for_screen(
@@ -65,10 +66,12 @@ application_init(MESSENGER_Application *app,
65 hdy_init(); 66 hdy_init();
66 67
67 app->application = gtk_application_new( 68 app->application = gtk_application_new(
68 "org.gnunet.MESSENGER-GTK", 69 "org.gnunet.Messenger-GTK",
69 G_APPLICATION_NON_UNIQUE 70 G_APPLICATION_NON_UNIQUE
70 ); 71 );
71 72
73 resources_register();
74
72 notify_init("Messenger-GTK"); 75 notify_init("Messenger-GTK");
73 app->notifications = NULL; 76 app->notifications = NULL;
74 77
@@ -112,6 +115,20 @@ application_init(MESSENGER_Application *app,
112 ); 115 );
113} 116}
114 117
118const gchar*
119application_get_resource_path(MESSENGER_Application *app,
120 const char *path)
121{
122 static gchar resource_path [PATH_MAX];
123
124 const gchar *base_path = g_application_get_resource_base_path(
125 G_APPLICATION(app->application)
126 );
127
128 snprintf(resource_path, PATH_MAX, "%s/%s", base_path, path);
129 return resource_path;
130}
131
115static void* 132static void*
116_application_chat_thread(void *args) 133_application_chat_thread(void *args)
117{ 134{
@@ -178,6 +195,8 @@ application_run(MESSENGER_Application *app)
178 195
179 notify_uninit(); 196 notify_uninit();
180 197
198 resources_unregister();
199
181 g_object_unref(app->application); 200 g_object_unref(app->application);
182} 201}
183 202
diff --git a/src/application.h b/src/application.h
index 3c51a87..d66a0cd 100644
--- a/src/application.h
+++ b/src/application.h
@@ -94,6 +94,10 @@ application_init(MESSENGER_Application *app,
94 int argc, 94 int argc,
95 char **argv); 95 char **argv);
96 96
97const gchar*
98application_get_resource_path(MESSENGER_Application *app,
99 const char *path);
100
97void 101void
98application_run(MESSENGER_Application *app); 102application_run(MESSENGER_Application *app);
99 103
diff --git a/src/event.c b/src/event.c
index 7335e91..8f913f2 100644
--- a/src/event.c
+++ b/src/event.c
@@ -160,7 +160,7 @@ event_update_profile(MESSENGER_Application *app)
160 hdy_avatar_set_text(ui->profile_avatar, name); 160 hdy_avatar_set_text(ui->profile_avatar, name);
161 gtk_label_set_text(ui->profile_label, name); 161 gtk_label_set_text(ui->profile_label, name);
162 162
163 UI_PROFILE_ENTRY_Handle *profile = ui_profile_entry_new(); 163 UI_PROFILE_ENTRY_Handle *profile = ui_profile_entry_new(app);
164 164
165 hdy_avatar_set_text(profile->entry_avatar, name); 165 hdy_avatar_set_text(profile->entry_avatar, name);
166 gtk_label_set_text(profile->entry_label, name); 166 gtk_label_set_text(profile->entry_label, name);
@@ -235,11 +235,7 @@ event_joining_contact(MESSENGER_Application *app,
235 if (!handle) 235 if (!handle)
236 return; 236 return;
237 237
238 UI_MESSAGE_Handle *message = ui_message_new( 238 UI_MESSAGE_Handle *message = ui_message_new(app, UI_MESSAGE_STATUS);
239 UI_MESSAGE_STATUS,
240 UI_MESSAGE_CONTENT_TEXT
241 );
242
243 ui_message_update(message, msg); 239 ui_message_update(message, msg);
244 240
245 struct GNUNET_CHAT_Contact *contact = GNUNET_CHAT_message_get_sender( 241 struct GNUNET_CHAT_Contact *contact = GNUNET_CHAT_message_get_sender(
@@ -328,11 +324,7 @@ event_invitation(UNUSED MESSENGER_Application *app,
328 if (!invitation) 324 if (!invitation)
329 return; 325 return;
330 326
331 UI_MESSAGE_Handle *message = ui_message_new( 327 UI_MESSAGE_Handle *message = ui_message_new(app, UI_MESSAGE_STATUS);
332 UI_MESSAGE_STATUS,
333 UI_MESSAGE_CONTENT_TEXT
334 );
335
336 ui_message_update(message, msg); 328 ui_message_update(message, msg);
337 329
338 const struct GNUNET_CHAT_Contact *contact = GNUNET_CHAT_message_get_sender( 330 const struct GNUNET_CHAT_Contact *contact = GNUNET_CHAT_message_get_sender(
@@ -384,15 +376,13 @@ event_receive_message(UNUSED MESSENGER_Application *app,
384 if (!handle) 376 if (!handle)
385 return; 377 return;
386 378
387 struct GNUNET_CHAT_File *file = GNUNET_CHAT_message_get_file(msg);
388
389 const int sent = GNUNET_CHAT_message_is_sent(msg); 379 const int sent = GNUNET_CHAT_message_is_sent(msg);
390 380
391 UI_MESSAGE_Handle *message = ui_message_new( 381 const UI_MESSAGE_Type type = (
392 GNUNET_YES == sent? UI_MESSAGE_SENT : UI_MESSAGE_DEFAULT, 382 GNUNET_YES == sent? UI_MESSAGE_SENT : UI_MESSAGE_DEFAULT
393 file? UI_MESSAGE_CONTENT_FILE : UI_MESSAGE_CONTENT_TEXT
394 ); 383 );
395 384
385 UI_MESSAGE_Handle *message = ui_message_new(app, type);
396 ui_message_update(message, msg); 386 ui_message_update(message, msg);
397 387
398 const struct GNUNET_CHAT_Contact *contact = GNUNET_CHAT_message_get_sender( 388 const struct GNUNET_CHAT_Contact *contact = GNUNET_CHAT_message_get_sender(
diff --git a/src/resources.c b/src/resources.c
new file mode 100644
index 0000000..5f997fe
--- /dev/null
+++ b/src/resources.c
@@ -0,0 +1,44 @@
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 resources.c
23 */
24
25#include "resources.h"
26
27#include <gio/gio.h>
28
29#include "../resources/css.h"
30#include "../resources/ui.h"
31
32void
33resources_register()
34{
35 g_resources_register(css_get_resource());
36 g_resources_register(ui_get_resource());
37}
38
39void
40resources_unregister()
41{
42 g_resources_unregister(css_get_resource());
43 g_resources_unregister(ui_get_resource());
44}
diff --git a/src/resources.h b/src/resources.h
new file mode 100644
index 0000000..82e8534
--- /dev/null
+++ b/src/resources.h
@@ -0,0 +1,34 @@
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 resources.h
23 */
24
25#ifndef RESOURCES_H_
26#define RESOURCES_H_
27
28void
29resources_register();
30
31void
32resources_unregister();
33
34#endif /* RESOURCES_H_ */
diff --git a/src/ui/chat.c b/src/ui/chat.c
index 3831f66..71f7ebc 100644
--- a/src/ui/chat.c
+++ b/src/ui/chat.c
@@ -279,8 +279,8 @@ ui_chat_new(MESSENGER_Application *app)
279 handle->messages = NULL; 279 handle->messages = NULL;
280 handle->edge_value = 0; 280 handle->edge_value = 0;
281 281
282 handle->builder = gtk_builder_new_from_file( 282 handle->builder = gtk_builder_new_from_resource(
283 "resources/ui/chat.ui" 283 application_get_resource_path(app, "ui/chat.ui")
284 ); 284 );
285 285
286 handle->chat_box = GTK_WIDGET( 286 handle->chat_box = GTK_WIDGET(
@@ -466,6 +466,7 @@ ui_chat_new(MESSENGER_Application *app)
466} 466}
467 467
468struct IterateChatGroupClosure { 468struct IterateChatGroupClosure {
469 MESSENGER_Application *app;
469 GHashTable *bindings; 470 GHashTable *bindings;
470 GtkListBox *listbox; 471 GtkListBox *listbox;
471}; 472};
@@ -480,7 +481,7 @@ iterate_ui_chat_update_group_contacts(void *cls,
480 ); 481 );
481 482
482 GtkListBox *listbox = closure->listbox; 483 GtkListBox *listbox = closure->listbox;
483 UI_PROFILE_ENTRY_Handle* entry = ui_profile_entry_new(); 484 UI_PROFILE_ENTRY_Handle* entry = ui_profile_entry_new(closure->app);
484 485
485 const char *name = GNUNET_CHAT_contact_get_name(contact); 486 const char *name = GNUNET_CHAT_contact_get_name(contact);
486 487
@@ -559,6 +560,7 @@ ui_chat_update(UI_CHAT_Handle *handle,
559 if (group) 560 if (group)
560 { 561 {
561 struct IterateChatGroupClosure closure; 562 struct IterateChatGroupClosure closure;
563 closure.app = app;
562 closure.bindings = app->ui.bindings; 564 closure.bindings = app->ui.bindings;
563 closure.listbox = handle->chat_contacts_listbox; 565 closure.listbox = handle->chat_contacts_listbox;
564 566
diff --git a/src/ui/chat_entry.c b/src/ui/chat_entry.c
index 7de4064..1dabec8 100644
--- a/src/ui/chat_entry.c
+++ b/src/ui/chat_entry.c
@@ -35,7 +35,9 @@ ui_chat_entry_new(MESSENGER_Application *app)
35 UI_CHAT_ENTRY_Handle* handle = g_malloc(sizeof(UI_CHAT_ENTRY_Handle)); 35 UI_CHAT_ENTRY_Handle* handle = g_malloc(sizeof(UI_CHAT_ENTRY_Handle));
36 36
37 handle->chat = ui_chat_new(app); 37 handle->chat = ui_chat_new(app);
38 handle->builder = gtk_builder_new_from_file("resources/ui/chat_entry.ui"); 38 handle->builder = gtk_builder_new_from_resource(
39 application_get_resource_path(app, "ui/chat_entry.ui")
40 );
39 41
40 handle->entry_box = GTK_WIDGET( 42 handle->entry_box = GTK_WIDGET(
41 gtk_builder_get_object(handle->builder, "entry_box") 43 gtk_builder_get_object(handle->builder, "entry_box")
diff --git a/src/ui/contact_entry.c b/src/ui/contact_entry.c
index cf830db..291c3b0 100644
--- a/src/ui/contact_entry.c
+++ b/src/ui/contact_entry.c
@@ -27,11 +27,13 @@
27#include "../application.h" 27#include "../application.h"
28 28
29UI_CONTACT_ENTRY_Handle* 29UI_CONTACT_ENTRY_Handle*
30ui_contact_entry_new(void) 30ui_contact_entry_new(MESSENGER_Application *app)
31{ 31{
32 UI_CONTACT_ENTRY_Handle* handle = g_malloc(sizeof(UI_CONTACT_ENTRY_Handle)); 32 UI_CONTACT_ENTRY_Handle* handle = g_malloc(sizeof(UI_CONTACT_ENTRY_Handle));
33 33
34 handle->builder = gtk_builder_new_from_file("resources/ui/contact_entry.ui"); 34 handle->builder = gtk_builder_new_from_resource(
35 application_get_resource_path(app, "ui/contact_entry.ui")
36 );
35 37
36 handle->entry_box = GTK_WIDGET( 38 handle->entry_box = GTK_WIDGET(
37 gtk_builder_get_object(handle->builder, "entry_box") 39 gtk_builder_get_object(handle->builder, "entry_box")
diff --git a/src/ui/contact_entry.h b/src/ui/contact_entry.h
index 6b39077..1ec97fc 100644
--- a/src/ui/contact_entry.h
+++ b/src/ui/contact_entry.h
@@ -40,7 +40,7 @@ typedef struct UI_CONTACT_ENTRY_Handle
40} UI_CONTACT_ENTRY_Handle; 40} UI_CONTACT_ENTRY_Handle;
41 41
42UI_CONTACT_ENTRY_Handle* 42UI_CONTACT_ENTRY_Handle*
43ui_contact_entry_new(void); 43ui_contact_entry_new(MESSENGER_Application *app);
44 44
45void 45void
46ui_contact_entry_delete(UI_CONTACT_ENTRY_Handle *handle); 46ui_contact_entry_delete(UI_CONTACT_ENTRY_Handle *handle);
diff --git a/src/ui/contacts.c b/src/ui/contacts.c
index fac9e62..3969446 100644
--- a/src/ui/contacts.c
+++ b/src/ui/contacts.c
@@ -104,7 +104,7 @@ _iterate_contacts(void *cls,
104 104
105 const char *key = GNUNET_CHAT_contact_get_key(contact); 105 const char *key = GNUNET_CHAT_contact_get_key(contact);
106 106
107 UI_CONTACT_ENTRY_Handle *entry = ui_contact_entry_new(); 107 UI_CONTACT_ENTRY_Handle *entry = ui_contact_entry_new(app);
108 gtk_list_box_prepend( 108 gtk_list_box_prepend(
109 app->ui.contacts.contacts_listbox, 109 app->ui.contacts.contacts_listbox,
110 entry->entry_box 110 entry->entry_box
@@ -139,7 +139,9 @@ ui_contacts_dialog_init(MESSENGER_Application *app,
139{ 139{
140 handle->contact_entries = NULL; 140 handle->contact_entries = NULL;
141 141
142 handle->builder = gtk_builder_new_from_file("resources/ui/contacts.ui"); 142 handle->builder = gtk_builder_new_from_resource(
143 application_get_resource_path(app, "ui/contacts.ui")
144 );
143 145
144 handle->dialog = GTK_DIALOG( 146 handle->dialog = GTK_DIALOG(
145 gtk_builder_get_object(handle->builder, "contacts_dialog") 147 gtk_builder_get_object(handle->builder, "contacts_dialog")
diff --git a/src/ui/invite_contact.c b/src/ui/invite_contact.c
index 5b6a71c..8cbde0c 100644
--- a/src/ui/invite_contact.c
+++ b/src/ui/invite_contact.c
@@ -96,7 +96,7 @@ _iterate_contacts(void *cls,
96 96
97 const char *key = GNUNET_CHAT_contact_get_key(contact); 97 const char *key = GNUNET_CHAT_contact_get_key(contact);
98 98
99 UI_CONTACT_ENTRY_Handle *entry = ui_contact_entry_new(); 99 UI_CONTACT_ENTRY_Handle *entry = ui_contact_entry_new(app);
100 gtk_list_box_prepend( 100 gtk_list_box_prepend(
101 app->ui.invite_contact.contacts_listbox, 101 app->ui.invite_contact.contacts_listbox,
102 entry->entry_box 102 entry->entry_box
@@ -131,7 +131,9 @@ ui_invite_contact_dialog_init(MESSENGER_Application *app,
131{ 131{
132 handle->contact_entries = NULL; 132 handle->contact_entries = NULL;
133 133
134 handle->builder = gtk_builder_new_from_file("resources/ui/invite_contact.ui"); 134 handle->builder = gtk_builder_new_from_resource(
135 application_get_resource_path(app, "ui/invite_contact.ui")
136 );
135 137
136 handle->dialog = GTK_DIALOG( 138 handle->dialog = GTK_DIALOG(
137 gtk_builder_get_object(handle->builder, "invite_contact_dialog") 139 gtk_builder_get_object(handle->builder, "invite_contact_dialog")
diff --git a/src/ui/message.c b/src/ui/message.c
index 47ec2aa..da6bb97 100644
--- a/src/ui/message.c
+++ b/src/ui/message.c
@@ -27,8 +27,8 @@
27#include "../application.h" 27#include "../application.h"
28 28
29UI_MESSAGE_Handle* 29UI_MESSAGE_Handle*
30ui_message_new(UI_MESSAGE_Type type, 30ui_message_new(MESSENGER_Application *app,
31 UI_MESSAGE_ContentType content_type) 31 UI_MESSAGE_Type type)
32{ 32{
33 UI_MESSAGE_Handle* handle = g_malloc(sizeof(UI_MESSAGE_Handle)); 33 UI_MESSAGE_Handle* handle = g_malloc(sizeof(UI_MESSAGE_Handle));
34 34
@@ -39,17 +39,19 @@ ui_message_new(UI_MESSAGE_Type type,
39 switch (handle->type) 39 switch (handle->type)
40 { 40 {
41 case UI_MESSAGE_SENT: 41 case UI_MESSAGE_SENT:
42 ui_builder_file = "resources/ui/message-sent.ui"; 42 ui_builder_file = "ui/message-sent.ui";
43 break; 43 break;
44 case UI_MESSAGE_STATUS: 44 case UI_MESSAGE_STATUS:
45 ui_builder_file = "resources/ui/message-status.ui"; 45 ui_builder_file = "ui/message-status.ui";
46 break; 46 break;
47 default: 47 default:
48 ui_builder_file = "resources/ui/message.ui"; 48 ui_builder_file = "ui/message.ui";
49 break; 49 break;
50 } 50 }
51 51
52 handle->builder = gtk_builder_new_from_file(ui_builder_file); 52 handle->builder = gtk_builder_new_from_resource(
53 application_get_resource_path(app, ui_builder_file)
54 );
53 55
54 handle->message_box = GTK_WIDGET( 56 handle->message_box = GTK_WIDGET(
55 gtk_builder_get_object(handle->builder, "message_box") 57 gtk_builder_get_object(handle->builder, "message_box")
@@ -94,8 +96,8 @@ ui_message_new(UI_MESSAGE_Type type,
94 gtk_builder_get_object(handle->builder, "content_box") 96 gtk_builder_get_object(handle->builder, "content_box")
95 ); 97 );
96 98
97 GtkBuilder *builder = gtk_builder_new_from_file( 99 GtkBuilder *builder = gtk_builder_new_from_resource(
98 "resources/ui/message_content.ui" 100 application_get_resource_path(app, "ui/message_content.ui")
99 ); 101 );
100 102
101 handle->timestamp_label = GTK_LABEL( 103 handle->timestamp_label = GTK_LABEL(
@@ -131,32 +133,6 @@ ui_message_new(UI_MESSAGE_Type type,
131 break; 133 break;
132 } 134 }
133 135
134 switch (content_type)
135 {
136 case UI_MESSAGE_CONTENT_TEXT:
137 gtk_stack_set_visible_child(
138 handle->content_stack,
139 GTK_WIDGET(handle->text_label)
140 );
141 break;
142 case UI_MESSAGE_CONTENT_FILE:
143 gtk_stack_set_visible_child(
144 handle->content_stack,
145 GTK_WIDGET(handle->file_revealer)
146 );
147
148 gtk_revealer_set_reveal_child(handle->file_revealer, TRUE);
149 break;
150 case UI_MESSAGE_CONTENT_PREVIEW:
151 gtk_stack_set_visible_child(
152 handle->content_stack,
153 GTK_WIDGET(handle->preview_drawing_area)
154 );
155 break;
156 default:
157 break;
158 }
159
160 gtk_container_add(content_box, GTK_WIDGET( 136 gtk_container_add(content_box, GTK_WIDGET(
161 gtk_builder_get_object(builder, "message_content_box") 137 gtk_builder_get_object(builder, "message_content_box")
162 )); 138 ));
diff --git a/src/ui/message.h b/src/ui/message.h
index 27577a9..f5883de 100644
--- a/src/ui/message.h
+++ b/src/ui/message.h
@@ -41,13 +41,6 @@ typedef enum UI_MESSAGE_Type
41 UI_MESSAGE_STATUS = 2 41 UI_MESSAGE_STATUS = 2
42} UI_MESSAGE_Type; 42} UI_MESSAGE_Type;
43 43
44typedef enum UI_MESSAGE_ContentType
45{
46 UI_MESSAGE_CONTENT_TEXT = 0,
47 UI_MESSAGE_CONTENT_FILE = 1,
48 UI_MESSAGE_CONTENT_PREVIEW = 2
49} UI_MESSAGE_ContentType;
50
51typedef struct UI_MESSAGE_Handle 44typedef struct UI_MESSAGE_Handle
52{ 45{
53 UI_MESSAGE_Type type; 46 UI_MESSAGE_Type type;
@@ -75,8 +68,8 @@ typedef struct UI_MESSAGE_Handle
75} UI_MESSAGE_Handle; 68} UI_MESSAGE_Handle;
76 69
77UI_MESSAGE_Handle* 70UI_MESSAGE_Handle*
78ui_message_new(UI_MESSAGE_Type type, 71ui_message_new(MESSENGER_Application *app,
79 UI_MESSAGE_ContentType content_type); 72 UI_MESSAGE_Type type);
80 73
81void 74void
82ui_message_update(UI_MESSAGE_Handle *handle, 75ui_message_update(UI_MESSAGE_Handle *handle,
diff --git a/src/ui/messenger.c b/src/ui/messenger.c
index 0db82a0..a926332 100644
--- a/src/ui/messenger.c
+++ b/src/ui/messenger.c
@@ -194,7 +194,9 @@ ui_messenger_init(MESSENGER_Application *app,
194{ 194{
195 handle->chat_entries = NULL; 195 handle->chat_entries = NULL;
196 196
197 handle->builder = gtk_builder_new_from_file("resources/ui/messenger.ui"); 197 handle->builder = gtk_builder_new_from_resource(
198 application_get_resource_path(app, "ui/messenger.ui")
199 );
198 200
199 handle->main_window = GTK_APPLICATION_WINDOW( 201 handle->main_window = GTK_APPLICATION_WINDOW(
200 gtk_builder_get_object(handle->builder, "main_window") 202 gtk_builder_get_object(handle->builder, "main_window")
diff --git a/src/ui/new_contact.c b/src/ui/new_contact.c
index 7e6f9c6..147f591 100644
--- a/src/ui/new_contact.c
+++ b/src/ui/new_contact.c
@@ -287,7 +287,9 @@ ui_new_contact_dialog_init(MESSENGER_Application *app,
287 handle->video = zbar_video_create(); 287 handle->video = zbar_video_create();
288 handle->scanner = zbar_image_scanner_create(); 288 handle->scanner = zbar_image_scanner_create();
289 289
290 handle->builder = gtk_builder_new_from_file("resources/ui/new_contact.ui"); 290 handle->builder = gtk_builder_new_from_resource(
291 application_get_resource_path(app, "ui/new_contact.ui")
292 );
291 293
292 handle->dialog = GTK_DIALOG( 294 handle->dialog = GTK_DIALOG(
293 gtk_builder_get_object(handle->builder, "new_contact_dialog") 295 gtk_builder_get_object(handle->builder, "new_contact_dialog")
diff --git a/src/ui/new_group.c b/src/ui/new_group.c
index e161fbb..dbad66b 100644
--- a/src/ui/new_group.c
+++ b/src/ui/new_group.c
@@ -163,7 +163,7 @@ _iterate_contacts(void *cls,
163 163
164 const char *key = GNUNET_CHAT_contact_get_key(contact); 164 const char *key = GNUNET_CHAT_contact_get_key(contact);
165 165
166 UI_CONTACT_ENTRY_Handle *entry = ui_contact_entry_new(); 166 UI_CONTACT_ENTRY_Handle *entry = ui_contact_entry_new(app);
167 gtk_list_box_prepend( 167 gtk_list_box_prepend(
168 app->ui.new_group.contacts_listbox, 168 app->ui.new_group.contacts_listbox,
169 entry->entry_box 169 entry->entry_box
@@ -198,7 +198,9 @@ ui_new_group_dialog_init(MESSENGER_Application *app,
198{ 198{
199 handle->contact_entries = NULL; 199 handle->contact_entries = NULL;
200 200
201 handle->builder = gtk_builder_new_from_file("resources/ui/new_group.ui"); 201 handle->builder = gtk_builder_new_from_resource(
202 application_get_resource_path(app, "ui/new_group.ui")
203 );
202 204
203 handle->dialog = GTK_DIALOG( 205 handle->dialog = GTK_DIALOG(
204 gtk_builder_get_object(handle->builder, "new_group_dialog") 206 gtk_builder_get_object(handle->builder, "new_group_dialog")
diff --git a/src/ui/new_platform.c b/src/ui/new_platform.c
index dad4ad1..544b7c7 100644
--- a/src/ui/new_platform.c
+++ b/src/ui/new_platform.c
@@ -100,7 +100,9 @@ void
100ui_new_platform_dialog_init(MESSENGER_Application *app, 100ui_new_platform_dialog_init(MESSENGER_Application *app,
101 UI_NEW_PLATFORM_Handle *handle) 101 UI_NEW_PLATFORM_Handle *handle)
102{ 102{
103 handle->builder = gtk_builder_new_from_file("resources/ui/new_platform.ui"); 103 handle->builder = gtk_builder_new_from_resource(
104 application_get_resource_path(app, "ui/new_platform.ui")
105 );
104 106
105 handle->dialog = GTK_DIALOG( 107 handle->dialog = GTK_DIALOG(
106 gtk_builder_get_object(handle->builder, "new_platform_dialog") 108 gtk_builder_get_object(handle->builder, "new_platform_dialog")
diff --git a/src/ui/new_profile.c b/src/ui/new_profile.c
index d845fdf..d1d0274 100644
--- a/src/ui/new_profile.c
+++ b/src/ui/new_profile.c
@@ -77,7 +77,9 @@ void
77ui_new_profile_dialog_init(MESSENGER_Application *app, 77ui_new_profile_dialog_init(MESSENGER_Application *app,
78 UI_NEW_PROFILE_Handle *handle) 78 UI_NEW_PROFILE_Handle *handle)
79{ 79{
80 handle->builder = gtk_builder_new_from_file("resources/ui/new_profile.ui"); 80 handle->builder = gtk_builder_new_from_resource(
81 application_get_resource_path(app, "ui/new_profile.ui")
82 );
81 83
82 handle->dialog = GTK_DIALOG( 84 handle->dialog = GTK_DIALOG(
83 gtk_builder_get_object(handle->builder, "new_profile_dialog") 85 gtk_builder_get_object(handle->builder, "new_profile_dialog")
diff --git a/src/ui/picker.c b/src/ui/picker.c
index 4a5d205..bdaa713 100644
--- a/src/ui/picker.c
+++ b/src/ui/picker.c
@@ -97,8 +97,8 @@ ui_picker_new(UNUSED MESSENGER_Application *app,
97{ 97{
98 UI_PICKER_Handle *handle = g_malloc(sizeof(UI_PICKER_Handle)); 98 UI_PICKER_Handle *handle = g_malloc(sizeof(UI_PICKER_Handle));
99 99
100 handle->builder = gtk_builder_new_from_file( 100 handle->builder = gtk_builder_new_from_resource(
101 "resources/ui/picker.ui" 101 application_get_resource_path(app, "ui/picker.ui")
102 ); 102 );
103 103
104 handle->picker_box = GTK_WIDGET( 104 handle->picker_box = GTK_WIDGET(
diff --git a/src/ui/profile_entry.c b/src/ui/profile_entry.c
index 4a03f94..c2b232f 100644
--- a/src/ui/profile_entry.c
+++ b/src/ui/profile_entry.c
@@ -27,11 +27,13 @@
27#include "../application.h" 27#include "../application.h"
28 28
29UI_PROFILE_ENTRY_Handle* 29UI_PROFILE_ENTRY_Handle*
30ui_profile_entry_new(void) 30ui_profile_entry_new(MESSENGER_Application *app)
31{ 31{
32 UI_PROFILE_ENTRY_Handle* handle = g_malloc(sizeof(UI_PROFILE_ENTRY_Handle)); 32 UI_PROFILE_ENTRY_Handle* handle = g_malloc(sizeof(UI_PROFILE_ENTRY_Handle));
33 33
34 handle->builder = gtk_builder_new_from_file("resources/ui/profile_entry.ui"); 34 handle->builder = gtk_builder_new_from_resource(
35 application_get_resource_path(app, "ui/profile_entry.ui")
36 );
35 37
36 handle->entry_box = GTK_WIDGET( 38 handle->entry_box = GTK_WIDGET(
37 gtk_builder_get_object(handle->builder, "entry_box") 39 gtk_builder_get_object(handle->builder, "entry_box")
diff --git a/src/ui/profile_entry.h b/src/ui/profile_entry.h
index 6196737..92d2fd0 100644
--- a/src/ui/profile_entry.h
+++ b/src/ui/profile_entry.h
@@ -38,7 +38,7 @@ typedef struct UI_PROFILE_ENTRY_Handle
38} UI_PROFILE_ENTRY_Handle; 38} UI_PROFILE_ENTRY_Handle;
39 39
40UI_PROFILE_ENTRY_Handle* 40UI_PROFILE_ENTRY_Handle*
41ui_profile_entry_new(void); 41ui_profile_entry_new(MESSENGER_Application *app);
42 42
43void 43void
44ui_profile_entry_delete(UI_PROFILE_ENTRY_Handle *handle); 44ui_profile_entry_delete(UI_PROFILE_ENTRY_Handle *handle);
diff --git a/src/ui/send_file.c b/src/ui/send_file.c
index 0d0c04b..4b9643c 100644
--- a/src/ui/send_file.c
+++ b/src/ui/send_file.c
@@ -231,7 +231,9 @@ void
231ui_send_file_dialog_init(MESSENGER_Application *app, 231ui_send_file_dialog_init(MESSENGER_Application *app,
232 UI_SEND_FILE_Handle *handle) 232 UI_SEND_FILE_Handle *handle)
233{ 233{
234 handle->builder = gtk_builder_new_from_file("resources/ui/send_file.ui"); 234 handle->builder = gtk_builder_new_from_resource(
235 application_get_resource_path(app, "ui/send_file.ui")
236 );
235 237
236 handle->dialog = GTK_DIALOG( 238 handle->dialog = GTK_DIALOG(
237 gtk_builder_get_object(handle->builder, "send_file_dialog") 239 gtk_builder_get_object(handle->builder, "send_file_dialog")
diff --git a/src/ui/settings.c b/src/ui/settings.c
index ca58270..6863968 100644
--- a/src/ui/settings.c
+++ b/src/ui/settings.c
@@ -37,7 +37,9 @@ void
37ui_settings_dialog_init(MESSENGER_Application *app, 37ui_settings_dialog_init(MESSENGER_Application *app,
38 UI_SETTINGS_Handle *handle) 38 UI_SETTINGS_Handle *handle)
39{ 39{
40 handle->builder = gtk_builder_new_from_file("resources/ui/settings.ui"); 40 handle->builder = gtk_builder_new_from_resource(
41 application_get_resource_path(app, "ui/settings.ui")
42 );
41 43
42 handle->dialog = HDY_PREFERENCES_WINDOW( 44 handle->dialog = HDY_PREFERENCES_WINDOW(
43 gtk_builder_get_object(handle->builder, "settings_dialog") 45 gtk_builder_get_object(handle->builder, "settings_dialog")