File: | cafe-settings-daemon/main.c |
Warning: | line 549, column 17 This statement is never executed |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- |
2 | * |
3 | * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu> |
4 | * |
5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. |
9 | * |
10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
18 | */ |
19 | |
20 | #include "config.h" |
21 | |
22 | #include <stdlib.h> |
23 | #include <unistd.h> |
24 | #include <libintl.h> |
25 | #include <errno(*__errno_location ()).h> |
26 | #include <locale.h> |
27 | #include <signal.h> |
28 | #include <fcntl.h> |
29 | #include <sys/wait.h> |
30 | |
31 | #include <glib/gi18n.h> |
32 | #include <glib/gstdio.h> |
33 | #include <ctk/ctk.h> |
34 | |
35 | #include <dbus/dbus-glib.h> |
36 | #include <dbus/dbus-glib-lowlevel.h> |
37 | |
38 | #ifdef HAVE_LIBNOTIFY1 |
39 | #include <libnotify/notify.h> |
40 | #endif /* HAVE_LIBNOTIFY */ |
41 | |
42 | #include "cafe-settings-manager.h" |
43 | #include "cafe-settings-profile.h" |
44 | |
45 | #include <libcafe-desktop/cafe-gsettings.h> |
46 | |
47 | #define CSD_DBUS_NAME"org.cafe.SettingsDaemon" "org.cafe.SettingsDaemon" |
48 | |
49 | #define DEBUG_KEY"cafe-settings-daemon" "cafe-settings-daemon" |
50 | #define DEBUG_SCHEMA"org.cafe.debug" "org.cafe.debug" |
51 | |
52 | #define CAFE_SESSION_DBUS_NAME"org.gnome.SessionManager" "org.gnome.SessionManager" |
53 | #define CAFE_SESSION_DBUS_OBJECT"/org/gnome/SessionManager" "/org/gnome/SessionManager" |
54 | #define CAFE_SESSION_DBUS_INTERFACE"org.gnome.SessionManager" "org.gnome.SessionManager" |
55 | #define CAFE_SESSION_PRIVATE_DBUS_INTERFACE"org.gnome.SessionManager.ClientPrivate" "org.gnome.SessionManager.ClientPrivate" |
56 | |
57 | /* this is kept only for compatibility with custom .desktop files */ |
58 | static gboolean no_daemon = TRUE(!(0)); |
59 | static gboolean replace = FALSE(0); |
60 | static gboolean debug = FALSE(0); |
61 | static gboolean do_timed_exit = FALSE(0); |
62 | static int term_signal_pipe_fds[2]; |
63 | |
64 | static GOptionEntry entries[] = { |
65 | { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code")("Enable debugging code"), NULL((void*)0) }, |
66 | { "replace", 0, 0, G_OPTION_ARG_NONE, &replace, N_("Replace the current daemon")("Replace the current daemon"), NULL((void*)0) }, |
67 | { "no-daemon", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &no_daemon, N_("Don't become a daemon")("Don't become a daemon"), NULL((void*)0) }, |
68 | { "timed-exit", 0, 0, G_OPTION_ARG_NONE, &do_timed_exit, N_("Exit after a time (for debugging)")("Exit after a time (for debugging)"), NULL((void*)0) }, |
69 | { NULL((void*)0) } |
70 | }; |
71 | |
72 | static gboolean |
73 | timed_exit_cb (void) |
74 | { |
75 | ctk_main_quit (); |
76 | return FALSE(0); |
77 | } |
78 | |
79 | static DBusGProxy * |
80 | get_bus_proxy (DBusGConnection *connection) |
81 | { |
82 | DBusGProxy *bus_proxy; |
83 | |
84 | bus_proxy = dbus_g_proxy_new_for_name (connection, |
85 | DBUS_SERVICE_DBUS"org.freedesktop.DBus", |
86 | DBUS_PATH_DBUS"/org/freedesktop/DBus", |
87 | DBUS_INTERFACE_DBUS"org.freedesktop.DBus"); |
88 | |
89 | return bus_proxy; |
90 | } |
91 | |
92 | static gboolean |
93 | acquire_name_on_proxy (DBusGProxy *bus_proxy) |
94 | { |
95 | GError *error; |
96 | guint result; |
97 | gboolean res; |
98 | gboolean ret; |
99 | guint32 flags; |
100 | |
101 | ret = FALSE(0); |
102 | |
103 | flags = DBUS_NAME_FLAG_DO_NOT_QUEUE0x4|DBUS_NAME_FLAG_ALLOW_REPLACEMENT0x1; |
104 | if (replace) |
105 | flags |= DBUS_NAME_FLAG_REPLACE_EXISTING0x2; |
106 | |
107 | error = NULL((void*)0); |
108 | res = dbus_g_proxy_call (bus_proxy, |
109 | "RequestName", |
110 | &error, |
111 | G_TYPE_STRING((GType) ((16) << (2))), CSD_DBUS_NAME"org.cafe.SettingsDaemon", |
112 | G_TYPE_UINT((GType) ((7) << (2))), flags, |
113 | G_TYPE_INVALID((GType) ((0) << (2))), |
114 | G_TYPE_UINT((GType) ((7) << (2))), &result, |
115 | G_TYPE_INVALID((GType) ((0) << (2)))); |
116 | if (! res) { |
117 | if (error != NULL((void*)0)) { |
118 | g_warning ("Failed to acquire %s: %s", CSD_DBUS_NAME"org.cafe.SettingsDaemon", error->message); |
119 | g_error_free (error); |
120 | } else { |
121 | g_warning ("Failed to acquire %s", CSD_DBUS_NAME"org.cafe.SettingsDaemon"); |
122 | } |
123 | goto out; |
124 | } |
125 | |
126 | if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER1) { |
127 | if (error != NULL((void*)0)) { |
128 | g_warning ("Failed to acquire %s: %s", CSD_DBUS_NAME"org.cafe.SettingsDaemon", error->message); |
129 | g_error_free (error); |
130 | } else { |
131 | g_warning ("Failed to acquire %s", CSD_DBUS_NAME"org.cafe.SettingsDaemon"); |
132 | } |
133 | goto out; |
134 | } |
135 | |
136 | ret = TRUE(!(0)); |
137 | |
138 | out: |
139 | return ret; |
140 | } |
141 | |
142 | static DBusHandlerResult |
143 | bus_message_handler (DBusConnection *connection, |
144 | DBusMessage *message, |
145 | void *user_data) |
146 | { |
147 | if (dbus_message_is_signal (message, |
148 | DBUS_INTERFACE_LOCAL"org.freedesktop.DBus.Local", |
149 | "Disconnected")) { |
150 | ctk_main_quit (); |
151 | return DBUS_HANDLER_RESULT_HANDLED; |
152 | } |
153 | else if (dbus_message_is_signal (message, |
154 | DBUS_INTERFACE_DBUS"org.freedesktop.DBus", |
155 | "NameLost")) { |
156 | g_warning ("D-Bus name lost, quitting"); |
157 | ctk_main_quit (); |
158 | return DBUS_HANDLER_RESULT_HANDLED; |
159 | } |
160 | |
161 | return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; |
162 | } |
163 | |
164 | static DBusGConnection * |
165 | get_session_bus (void) |
166 | { |
167 | GError *error; |
168 | DBusGConnection *bus; |
169 | DBusConnection *connection; |
170 | |
171 | error = NULL((void*)0); |
172 | bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error); |
173 | if (bus == NULL((void*)0)) { |
174 | g_warning ("Couldn't connect to session bus: %s", |
175 | error->message); |
176 | g_error_free (error); |
177 | goto out; |
178 | } |
179 | |
180 | connection = dbus_g_connection_get_connection (bus); |
181 | dbus_connection_add_filter (connection, |
182 | (DBusHandleMessageFunction) |
183 | bus_message_handler, |
184 | NULL((void*)0), NULL((void*)0)); |
185 | |
186 | dbus_connection_set_exit_on_disconnect (connection, FALSE(0)); |
187 | |
188 | out: |
189 | return bus; |
190 | } |
191 | |
192 | static gboolean |
193 | bus_register (DBusGConnection *bus) |
194 | { |
195 | DBusGProxy *bus_proxy; |
196 | gboolean ret; |
197 | |
198 | cafe_settings_profile_start (NULL); |
199 | |
200 | ret = FALSE(0); |
201 | |
202 | bus_proxy = get_bus_proxy (bus); |
203 | |
204 | if (bus_proxy == NULL((void*)0)) { |
205 | g_warning ("Could not construct bus_proxy object"); |
206 | goto out; |
207 | } |
208 | |
209 | ret = acquire_name_on_proxy (bus_proxy); |
210 | g_object_unref (bus_proxy); |
211 | |
212 | if (!ret) { |
213 | g_warning ("Could not acquire name"); |
214 | goto out; |
215 | } |
216 | |
217 | g_debug ("Successfully connected to D-Bus"); |
218 | |
219 | out: |
220 | cafe_settings_profile_end (NULL); |
221 | |
222 | return ret; |
223 | } |
224 | |
225 | static void |
226 | on_session_over (DBusGProxy *proxy, CafeSettingsManager *manager) |
227 | { |
228 | /* not used, see on_session_end instead */ |
229 | } |
230 | |
231 | static void |
232 | on_session_query_end (DBusGProxy *proxy, guint flags, CafeSettingsManager *manager) |
233 | { |
234 | GError *error = NULL((void*)0); |
235 | gboolean ret = FALSE(0); |
236 | |
237 | /* send response */ |
238 | ret = dbus_g_proxy_call (proxy, "EndSessionResponse", &error, |
239 | G_TYPE_BOOLEAN((GType) ((5) << (2))), TRUE(!(0)) /* ok */, |
240 | G_TYPE_STRING((GType) ((16) << (2))), NULL((void*)0) /* reason */, |
241 | G_TYPE_INVALID((GType) ((0) << (2))), |
242 | G_TYPE_INVALID((GType) ((0) << (2)))); |
243 | if (!ret) { |
244 | g_warning ("failed to send session response: %s", error->message); |
245 | g_error_free (error); |
246 | } |
247 | } |
248 | |
249 | static void |
250 | on_session_end (DBusGProxy *proxy, guint flags, CafeSettingsManager *manager) |
251 | { |
252 | GError *error = NULL((void*)0); |
253 | gboolean ret = FALSE(0); |
254 | |
255 | /* send response */ |
256 | ret = dbus_g_proxy_call (proxy, "EndSessionResponse", &error, |
257 | G_TYPE_BOOLEAN((GType) ((5) << (2))), TRUE(!(0)) /* ok */, |
258 | G_TYPE_STRING((GType) ((16) << (2))), NULL((void*)0) /* reason */, |
259 | G_TYPE_INVALID((GType) ((0) << (2))), |
260 | G_TYPE_INVALID((GType) ((0) << (2)))); |
261 | if (!ret) { |
262 | g_warning ("failed to send session response: %s", error->message); |
263 | g_error_free (error); |
264 | } |
265 | |
266 | cafe_settings_manager_stop (manager); |
267 | ctk_main_quit (); |
268 | } |
269 | |
270 | static void |
271 | on_term_signal (int signal) |
272 | { |
273 | /* Wake up main loop to tell it to shutdown */ |
274 | close (term_signal_pipe_fds[1]); |
275 | term_signal_pipe_fds[1] = -1; |
276 | } |
277 | |
278 | static gboolean |
279 | on_term_signal_pipe_closed (GIOChannel *source, |
280 | GIOCondition condition, |
281 | gpointer data) |
282 | { |
283 | term_signal_pipe_fds[0] = -1; |
284 | |
285 | /* Got SIGTERM, time to clean up and get out |
286 | */ |
287 | ctk_main_quit (); |
288 | |
289 | return FALSE(0); |
290 | } |
291 | |
292 | static void |
293 | watch_for_term_signal (CafeSettingsManager *manager) |
294 | { |
295 | GIOChannel *channel; |
296 | |
297 | if (-1 == pipe (term_signal_pipe_fds) || |
298 | -1 == fcntl (term_signal_pipe_fds[0], F_SETFD2, FD_CLOEXEC1) || |
299 | -1 == fcntl (term_signal_pipe_fds[1], F_SETFD2, FD_CLOEXEC1)) { |
300 | g_error ("Could not create pipe: %s", g_strerror (errno(*__errno_location ()))); |
301 | exit (EXIT_FAILURE1); |
302 | } |
303 | |
304 | channel = g_io_channel_unix_new (term_signal_pipe_fds[0]); |
305 | g_io_channel_set_encoding (channel, NULL((void*)0), NULL((void*)0)); |
306 | g_io_channel_set_buffered (channel, FALSE(0)); |
307 | g_io_add_watch (channel, G_IO_HUP, on_term_signal_pipe_closed, manager); |
308 | g_io_channel_unref (channel); |
309 | |
310 | signal (SIGTERM15, on_term_signal); |
311 | |
312 | } |
313 | |
314 | static void |
315 | set_session_over_handler (DBusGConnection *bus, CafeSettingsManager *manager) |
316 | { |
317 | DBusGProxy *session_proxy; |
318 | gchar *client_id = NULL((void*)0); |
319 | const char *startup_id; |
320 | GError *error = NULL((void*)0); |
321 | gboolean res; |
322 | |
323 | g_assert (bus != NULL)do { if (bus != ((void*)0)) ; else g_assertion_message_expr ( ((gchar*) 0), "main.c", 323, ((const char*) (__func__)), "bus != NULL" ); } while (0); |
324 | |
325 | cafe_settings_profile_start (NULL); |
326 | |
327 | session_proxy = |
328 | dbus_g_proxy_new_for_name (bus, |
329 | CAFE_SESSION_DBUS_NAME"org.gnome.SessionManager", |
330 | CAFE_SESSION_DBUS_OBJECT"/org/gnome/SessionManager", |
331 | CAFE_SESSION_DBUS_INTERFACE"org.gnome.SessionManager"); |
332 | |
333 | dbus_g_object_register_marshaller ( |
334 | g_cclosure_marshal_VOID__VOID, |
335 | G_TYPE_NONE((GType) ((1) << (2))), |
336 | G_TYPE_INVALID((GType) ((0) << (2)))); |
337 | |
338 | dbus_g_proxy_add_signal (session_proxy, |
339 | "SessionOver", |
340 | G_TYPE_INVALID((GType) ((0) << (2)))); |
341 | |
342 | dbus_g_proxy_connect_signal (session_proxy, |
343 | "SessionOver", |
344 | G_CALLBACK (on_session_over)((GCallback) (on_session_over)), |
345 | manager, |
346 | NULL((void*)0)); |
347 | |
348 | /* Register with cafe-session */ |
349 | startup_id = g_getenv ("DESKTOP_AUTOSTART_ID"); |
350 | if (startup_id != NULL((void*)0) && *startup_id != '\0') { |
351 | res = dbus_g_proxy_call (session_proxy, |
352 | "RegisterClient", |
353 | &error, |
354 | G_TYPE_STRING((GType) ((16) << (2))), "cafe-settings-daemon", |
355 | G_TYPE_STRING((GType) ((16) << (2))), startup_id, |
356 | G_TYPE_INVALID((GType) ((0) << (2))), |
357 | DBUS_TYPE_G_OBJECT_PATH(dbus_g_object_path_get_g_type ()), &client_id, |
358 | G_TYPE_INVALID((GType) ((0) << (2)))); |
359 | if (!res) { |
360 | g_warning ("failed to register client '%s': %s", startup_id, error->message); |
361 | g_error_free (error); |
362 | } |
363 | else { |
364 | DBusGProxy *private_proxy; |
365 | |
366 | /* get org.gnome.SessionManager.ClientPrivate interface */ |
367 | private_proxy = dbus_g_proxy_new_for_name_owner (bus, CAFE_SESSION_DBUS_NAME"org.gnome.SessionManager", |
368 | client_id, CAFE_SESSION_PRIVATE_DBUS_INTERFACE"org.gnome.SessionManager.ClientPrivate", |
369 | &error); |
370 | if (private_proxy == NULL((void*)0)) { |
371 | g_warning ("DBUS error: %s", error->message); |
372 | g_error_free (error); |
373 | } |
374 | else { |
375 | |
376 | /* get QueryEndSession */ |
377 | dbus_g_proxy_add_signal (private_proxy, "QueryEndSession", G_TYPE_UINT((GType) ((7) << (2))), G_TYPE_INVALID((GType) ((0) << (2)))); |
378 | dbus_g_proxy_connect_signal (private_proxy, "QueryEndSession", |
379 | G_CALLBACK (on_session_query_end)((GCallback) (on_session_query_end)), |
380 | manager, NULL((void*)0)); |
381 | |
382 | /* get EndSession */ |
383 | dbus_g_proxy_add_signal (private_proxy, "EndSession", G_TYPE_UINT((GType) ((7) << (2))), G_TYPE_INVALID((GType) ((0) << (2)))); |
384 | dbus_g_proxy_connect_signal (private_proxy, "EndSession", |
385 | G_CALLBACK (on_session_end)((GCallback) (on_session_end)), manager, NULL((void*)0)); |
386 | |
387 | } |
388 | |
389 | g_free (client_id); |
390 | } |
391 | } |
392 | |
393 | watch_for_term_signal (manager); |
394 | cafe_settings_profile_end (NULL); |
395 | } |
396 | |
397 | static void |
398 | csd_log_default_handler (const gchar *log_domain, |
399 | GLogLevelFlags log_level, |
400 | const gchar *message, |
401 | gpointer unused_data) |
402 | { |
403 | /* filter out DEBUG messages if debug isn't set */ |
404 | if ((log_level & G_LOG_LEVEL_MASK) == G_LOG_LEVEL_DEBUG |
405 | && ! debug) { |
406 | return; |
407 | } |
408 | |
409 | g_log_default_handler (log_domain, |
410 | log_level, |
411 | message, |
412 | unused_data); |
413 | } |
414 | |
415 | static void |
416 | parse_args (int *argc, char ***argv) |
417 | { |
418 | GError *error; |
419 | GOptionContext *context; |
420 | |
421 | cafe_settings_profile_start (NULL); |
422 | |
423 | |
424 | context = g_option_context_new (NULL((void*)0)); |
425 | |
426 | g_option_context_add_main_entries (context, entries, NULL((void*)0)); |
427 | g_option_context_add_group (context, ctk_get_option_group (FALSE(0))); |
428 | |
429 | error = NULL((void*)0); |
430 | if (!g_option_context_parse (context, argc, argv, &error)) { |
431 | if (error != NULL((void*)0)) { |
432 | g_warning ("%s", error->message); |
433 | g_error_free (error); |
434 | } else { |
435 | g_warning ("Unable to initialize CTK+"); |
436 | } |
437 | exit (EXIT_FAILURE1); |
438 | } |
439 | |
440 | g_option_context_free (context); |
441 | |
442 | cafe_settings_profile_end (NULL); |
443 | |
444 | if (debug) |
445 | g_setenv ("G_MESSAGES_DEBUG", "all", FALSE(0)); |
446 | } |
447 | |
448 | static void debug_changed (GSettings *settings, gchar *key, gpointer user_data) |
449 | { |
450 | debug = g_settings_get_boolean (settings, DEBUG_KEY"cafe-settings-daemon"); |
451 | if (debug) { |
452 | g_warning ("Enable DEBUG"); |
453 | g_setenv ("G_MESSAGES_DEBUG", "all", FALSE(0)); |
454 | } else { |
455 | g_warning ("Disable DEBUG"); |
456 | g_unsetenv ("G_MESSAGES_DEBUG"); |
457 | } |
458 | } |
459 | |
460 | int |
461 | main (int argc, char *argv[]) |
462 | { |
463 | CafeSettingsManager *manager; |
464 | DBusGConnection *bus; |
465 | gboolean res; |
466 | GError *error; |
467 | GSettings *debug_settings = NULL((void*)0); |
468 | |
469 | manager = NULL((void*)0); |
470 | |
471 | cafe_settings_profile_start (NULL); |
472 | |
473 | bindtextdomain (GETTEXT_PACKAGE"cafe-settings-daemon", CAFE_SETTINGS_LOCALEDIR"/usr/share/locale"); |
474 | bind_textdomain_codeset (GETTEXT_PACKAGE"cafe-settings-daemon", "UTF-8"); |
475 | textdomain (GETTEXT_PACKAGE"cafe-settings-daemon"); |
476 | setlocale (LC_ALL6, ""); |
477 | |
478 | parse_args (&argc, &argv); |
479 | |
480 | /* Allows to enable/disable debug from GSettings only if it is not set from argument */ |
481 | if (cafe_gsettings_schema_exists (DEBUG_SCHEMA"org.cafe.debug")) |
482 | { |
483 | debug_settings = g_settings_new (DEBUG_SCHEMA"org.cafe.debug"); |
484 | debug = g_settings_get_boolean (debug_settings, DEBUG_KEY"cafe-settings-daemon"); |
485 | g_signal_connect (debug_settings, "changed::" DEBUG_KEY, G_CALLBACK (debug_changed), NULL)g_signal_connect_data ((debug_settings), ("changed::" "cafe-settings-daemon" ), (((GCallback) (debug_changed))), (((void*)0)), ((void*)0), (GConnectFlags) 0); |
486 | |
487 | if (debug) { |
488 | g_setenv ("G_MESSAGES_DEBUG", "all", FALSE(0)); |
489 | } |
490 | } |
491 | |
492 | cafe_settings_profile_start ("opening ctk display"); |
493 | if (! ctk_init_check (NULL((void*)0), NULL((void*)0))) { |
494 | g_warning ("Unable to initialize CTK+"); |
495 | exit (EXIT_FAILURE1); |
496 | } |
497 | cafe_settings_profile_end ("opening ctk display"); |
498 | |
499 | g_log_set_default_handler (csd_log_default_handler, NULL((void*)0)); |
500 | |
501 | bus = get_session_bus (); |
502 | if (bus == NULL((void*)0)) { |
503 | g_warning ("Could not get a connection to the bus"); |
504 | goto out; |
505 | } |
506 | |
507 | if (! bus_register (bus)) { |
508 | goto out; |
509 | } |
510 | |
511 | #ifdef HAVE_LIBNOTIFY1 |
512 | notify_init ("cafe-settings-daemon"); |
513 | #endif /* HAVE_LIBNOTIFY */ |
514 | |
515 | cafe_settings_profile_start ("cafe_settings_manager_new"); |
516 | manager = cafe_settings_manager_new (); |
517 | cafe_settings_profile_end ("cafe_settings_manager_new"); |
518 | if (manager == NULL((void*)0)) { |
519 | g_warning ("Unable to register object"); |
520 | goto out; |
521 | } |
522 | |
523 | /* If we aren't started by dbus then load the plugins automatically during the |
524 | * Initialization phase. Otherwise, wait for an Awake etc. */ |
525 | if (g_getenv ("DBUS_STARTER_BUS_TYPE") == NULL((void*)0)) { |
526 | error = NULL((void*)0); |
527 | res = cafe_settings_manager_start (manager, PLUGIN_LOAD_INIT, &error); |
528 | if (! res) { |
529 | g_warning ("Unable to start: %s", error->message); |
530 | g_error_free (error); |
531 | } |
532 | } |
533 | |
534 | set_session_over_handler (bus, manager); |
535 | |
536 | /* If we aren't started by dbus then load the plugins automatically after |
537 | * cafe-settings-daemon has registered itself. Otherwise, wait for an Awake etc. */ |
538 | if (g_getenv ("DBUS_STARTER_BUS_TYPE") == NULL((void*)0)) { |
539 | error = NULL((void*)0); |
540 | res = cafe_settings_manager_start (manager, PLUGIN_LOAD_DEFER, &error); |
541 | if (! res) { |
542 | g_warning ("Unable to start: %s", error->message); |
543 | g_error_free (error); |
544 | goto out; |
545 | } |
546 | } |
547 | |
548 | if (do_timed_exit) { |
549 | g_timeout_add_seconds (30, (GSourceFunc) timed_exit_cb, NULL((void*)0)); |
This statement is never executed | |
550 | } |
551 | |
552 | ctk_main (); |
553 | |
554 | out: |
555 | |
556 | if (bus != NULL((void*)0)) { |
557 | dbus_g_connection_unref (bus); |
558 | } |
559 | |
560 | if (manager != NULL((void*)0)) { |
561 | g_object_unref (manager); |
562 | } |
563 | |
564 | if (debug_settings != NULL((void*)0)) { |
565 | g_object_unref (debug_settings); |
566 | } |
567 | |
568 | #ifdef HAVE_LIBNOTIFY1 |
569 | if (notify_is_initted ()) |
570 | notify_uninit (); |
571 | #endif /* HAVE_LIBNOTIFY */ |
572 | |
573 | g_debug ("SettingsDaemon finished"); |
574 | cafe_settings_profile_end (NULL); |
575 | |
576 | return 0; |
577 | } |