static void csm_logout_dialog_init (CsmLogoutDialog *logout_dialog) { logout_dialog->priv = CSM_LOGOUT_DIALOG_GET_PRIVATE (logout_dialog); logout_dialog->priv->timeout_id = 0; logout_dialog->priv->timeout = 0; logout_dialog->priv->default_response = GTK_RESPONSE_CANCEL; gtk_window_set_skip_taskbar_hint (GTK_WINDOW (logout_dialog), TRUE); gtk_window_set_keep_above (GTK_WINDOW (logout_dialog), TRUE); gtk_window_stick (GTK_WINDOW (logout_dialog)); #ifdef HAVE_OLD_UPOWER logout_dialog->priv->up_client = up_client_new (); #endif logout_dialog->priv->system = csm_get_system (); g_signal_connect (logout_dialog, "destroy", G_CALLBACK (csm_logout_dialog_destroy), NULL); g_signal_connect (logout_dialog, "show", G_CALLBACK (csm_logout_dialog_show), NULL); }
int main (int argc, char **argv) { struct sigaction sa; GError *error; char *display_str; CsmManager *manager; CsmStore *client_store; MdmSignalHandler *signal_handler; static char **override_autostart_dirs = NULL; static char *session_name = NULL; static GOptionEntry entries[] = { { "autostart", 'a', 0, G_OPTION_ARG_STRING_ARRAY, &override_autostart_dirs, N_("Override standard autostart directories"), N_("AUTOSTART_DIR") }, { "session", 0, 0, G_OPTION_ARG_STRING, &session_name, N_("Session to use"), N_("SESSION_NAME") }, { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL }, { "failsafe", 'f', 0, G_OPTION_ARG_NONE, &failsafe, N_("Do not load user-specified applications"), NULL }, { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Version of this application"), NULL }, /* Translators: the 'fail whale' is the black dialog we show when something goes seriously wrong */ { "whale", 0, 0, G_OPTION_ARG_NONE, &please_fail, N_("Show the fail whale dialog for testing"), NULL }, { NULL, 0, 0, 0, NULL, NULL, NULL } }; /* Make sure that we have a session bus */ if (!require_dbus_session (argc, argv, &error)) { csm_util_init_error (TRUE, "%s", error->message); } bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); GSettings *settings = g_settings_new ("org.cinnamon.SessionManager"); if (g_settings_get_boolean (settings, "debug")) { debug = TRUE; } g_object_unref(settings); sa.sa_handler = SIG_IGN; sa.sa_flags = 0; sigemptyset (&sa.sa_mask); sigaction (SIGPIPE, &sa, 0); error = NULL; gtk_init_with_args (&argc, &argv, (char *) _(" - the Cinnamon session manager"), entries, GETTEXT_PACKAGE, &error); if (error != NULL) { g_warning ("%s", error->message); exit (1); } if (show_version) { g_print ("%s %s\n", argv [0], VERSION); exit (1); } if (please_fail) { csm_fail_whale_dialog_we_failed (TRUE, TRUE); gtk_main (); exit (1); } mdm_log_init (); mdm_log_set_debug (debug); /* Set DISPLAY explicitly for all our children, in case --display * was specified on the command line. */ display_str = gdk_get_display (); csm_util_setenv ("DISPLAY", display_str); g_free (display_str); const gchar *gtk_modules; gchar *new_gtk_modules = NULL; gtk_modules = g_getenv ("GTK_MODULES"); if (gtk_modules != NULL && g_strstr_len (gtk_modules, -1, "overlay-scrollbar")) { int i = 0; new_gtk_modules = g_strconcat ("", NULL); gchar **module_list = g_strsplit (gtk_modules, ":", -1); for (i = 0; i < g_strv_length (module_list); i++) { if (!g_strstr_len (module_list[i], -1, "overlay-scrollbar")) { gchar *tmp = new_gtk_modules; new_gtk_modules = g_strconcat (tmp, ":", module_list[i], NULL); g_free (tmp); } } g_strfreev (module_list); } if (new_gtk_modules) { csm_util_setenv ("GTK_MODULES", new_gtk_modules); } g_free (new_gtk_modules); /* Some third-party programs rely on GNOME_DESKTOP_SESSION_ID to * detect if GNOME is running. We keep this for compatibility reasons. */ csm_util_setenv ("GNOME_DESKTOP_SESSION_ID", "this-is-deprecated"); /* Make QT5 apps follow the GTK style */ csm_util_setenv ("QT_STYLE_OVERRIDE", "gtk"); client_store = csm_store_new (); /* Talk to logind before acquiring a name, since it does synchronous * calls at initialization time that invoke a main loop and if we * already owned a name, then we would service too early during * that main loop. */ g_object_unref (csm_get_system ()); if (!acquire_name ()) { csm_fail_whale_dialog_we_failed (TRUE, TRUE); gtk_main (); exit (1); } manager = csm_manager_new (client_store, failsafe); /* signal_handler = mdm_signal_handler_new (); mdm_signal_handler_add_fatal (signal_handler); mdm_signal_handler_add (signal_handler, SIGFPE, signal_cb, NULL); mdm_signal_handler_add (signal_handler, SIGHUP, signal_cb, NULL); mdm_signal_handler_add (signal_handler, SIGUSR1, signal_cb, NULL); mdm_signal_handler_add (signal_handler, SIGTERM, signal_cb, manager); mdm_signal_handler_add (signal_handler, SIGINT, signal_cb, manager); mdm_signal_handler_set_fatal_func (signal_handler, shutdown_cb, manager); */ if (IS_STRING_EMPTY (session_name)) session_name = _csm_manager_get_default_session (manager); csm_util_set_autostart_dirs (override_autostart_dirs); if (!csm_session_fill (manager, session_name)) { csm_util_init_error (TRUE, "Failed to load session \"%s\"", session_name ? session_name : "(null)"); } csm_manager_start (manager); gtk_main (); if (manager != NULL) { g_debug ("Unreffing manager"); g_object_unref (manager); } if (client_store != NULL) { g_object_unref (client_store); } if (bus_proxy != NULL) { g_object_unref (bus_proxy); } mdm_log_shutdown (); return 0; }