static void name_acquired_handler (GDBusConnection *connection, const gchar *name, gpointer user_data) { set_session_over_handler (connection); }
int main (int argc, char *argv[]) { MateSettingsManager *manager; DBusGConnection *bus; gboolean res; GError *error; manager = NULL; if (!g_thread_supported ()) { g_thread_init (NULL); } mate_settings_profile_start (NULL); bindtextdomain (GETTEXT_PACKAGE, MATE_SETTINGS_LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); setlocale (LC_ALL, ""); parse_args (&argc, &argv); daemon_start (); g_type_init (); mate_settings_profile_start ("opening gtk display"); if (! gtk_init_check (NULL, NULL)) { g_warning ("Unable to initialize GTK+"); daemon_terminate_parent (); exit (EXIT_FAILURE); } mate_settings_profile_end ("opening gtk display"); daemon_detach (); g_log_set_default_handler (gsd_log_default_handler, NULL); bus = get_session_bus (); if (bus == NULL) { g_warning ("Could not get a connection to the bus"); goto out; } if (! bus_register (bus)) { goto out; } mate_settings_profile_start ("mate_settings_manager_new"); manager = mate_settings_manager_new (); mate_settings_profile_end ("mate_settings_manager_new"); if (manager == NULL) { g_warning ("Unable to register object"); goto out; } set_session_over_handler (bus, manager); /* If we aren't started by dbus then load the plugins automatically. Otherwise, wait for an Awake etc. */ if (g_getenv ("DBUS_STARTER_BUS_TYPE") == NULL) { error = NULL; if (mateconf_prefix != NULL) { res = mate_settings_manager_start_with_settings_prefix (manager, mateconf_prefix, &error); } else { res = mate_settings_manager_start (manager, &error); } if (! res) { g_warning ("Unable to start: %s", error->message); g_error_free (error); goto out; } } daemon_terminate_parent (); if (do_timed_exit) { g_timeout_add (1000 * 30, (GSourceFunc) timed_exit_cb, NULL); } gtk_main (); out: g_free (mateconf_prefix); if (bus != NULL) { dbus_g_connection_unref (bus); } if (manager != NULL) { g_object_unref (manager); } g_debug ("SettingsDaemon finished"); mate_settings_profile_end (NULL); return 0; }
int main (int argc, char *argv[]) { MateSettingsManager *manager; DBusGConnection *bus; gboolean res; GError *error; GSettings *debug_settings = NULL; manager = NULL; mate_settings_profile_start (NULL); bindtextdomain (GETTEXT_PACKAGE, MATE_SETTINGS_LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); setlocale (LC_ALL, ""); parse_args (&argc, &argv); /* Allows to enable/disable debug from GSettings only if it is not set from argument */ if (mate_gsettings_schema_exists (DEBUG_SCHEMA)) { debug_settings = g_settings_new (DEBUG_SCHEMA); debug = g_settings_get_boolean (debug_settings, DEBUG_KEY); g_signal_connect (debug_settings, "changed::" DEBUG_KEY, G_CALLBACK (debug_changed), NULL); if (debug) { g_setenv ("G_MESSAGES_DEBUG", "all", FALSE); } } mate_settings_profile_start ("opening gtk display"); if (! gtk_init_check (NULL, NULL)) { g_warning ("Unable to initialize GTK+"); exit (EXIT_FAILURE); } mate_settings_profile_end ("opening gtk display"); g_log_set_default_handler (msd_log_default_handler, NULL); bus = get_session_bus (); if (bus == NULL) { g_warning ("Could not get a connection to the bus"); goto out; } if (! bus_register (bus)) { goto out; } #ifdef HAVE_LIBNOTIFY notify_init ("mate-settings-daemon"); #endif /* HAVE_LIBNOTIFY */ mate_settings_profile_start ("mate_settings_manager_new"); manager = mate_settings_manager_new (); mate_settings_profile_end ("mate_settings_manager_new"); if (manager == NULL) { g_warning ("Unable to register object"); goto out; } set_session_over_handler (bus, manager); /* If we aren't started by dbus then load the plugins automatically. Otherwise, wait for an Awake etc. */ if (g_getenv ("DBUS_STARTER_BUS_TYPE") == NULL) { error = NULL; res = mate_settings_manager_start (manager, &error); if (! res) { g_warning ("Unable to start: %s", error->message); g_error_free (error); goto out; } } if (do_timed_exit) { g_timeout_add_seconds (30, (GSourceFunc) timed_exit_cb, NULL); } gtk_main (); out: if (bus != NULL) { dbus_g_connection_unref (bus); } if (manager != NULL) { g_object_unref (manager); } if (debug_settings != NULL) { g_object_unref (debug_settings); } #ifdef HAVE_LIBNOTIFY if (notify_is_initted ()) notify_uninit (); #endif /* HAVE_LIBNOTIFY */ g_debug ("SettingsDaemon finished"); mate_settings_profile_end (NULL); return 0; }