diff options
Diffstat (limited to 'src/application.c')
-rw-r--r-- | src/application.c | 27 |
1 files changed, 23 insertions, 4 deletions
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 | ||
27 | static void | 28 | static 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 | ||
118 | const gchar* | ||
119 | application_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 | |||
115 | static void* | 132 | static 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 | ||