static GObject * gdm_display_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties) { GdmDisplay *display; char *canonical_display_name; gboolean res; display = GDM_DISPLAY (G_OBJECT_CLASS (gdm_display_parent_class)->constructor (type, n_construct_properties, construct_properties)); canonical_display_name = g_strdelimit (g_strdup (display->priv->x11_display_name), ":" G_STR_DELIMITERS, '_'); g_free (display->priv->id); display->priv->id = g_strdup_printf ("/org/gnome/DisplayManager/Displays/%s", canonical_display_name); g_free (canonical_display_name); res = register_display (display); if (! res) { g_warning ("Unable to register display with system bus"); } return G_OBJECT (display); }
void end_application(void) { t_display *display; display = register_display(0); (void)display; exit(1); }
static GObject * gdm_display_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties) { GdmDisplay *display; gboolean res; display = GDM_DISPLAY (G_OBJECT_CLASS (gdm_display_parent_class)->constructor (type, n_construct_properties, construct_properties)); g_free (display->priv->id); display->priv->id = g_strdup_printf ("/org/gnome/DisplayManager/Display%u", get_next_display_serial ()); res = register_display (display); if (! res) { g_warning ("Unable to register display with system bus"); } return G_OBJECT (display); }
int main (int argc, char **argv) { State *state = NULL; GOptionContext *context = NULL; static char **args = NULL; static gboolean run_script = FALSE; static gboolean allow_remote_connections = FALSE; gboolean debug = FALSE; gboolean ret; int exit_status = EX_OK; static GOptionEntry entries [] = { { "run-script", 'r', 0, G_OPTION_ARG_NONE, &run_script, N_("Run program through /etc/gdm/Xsession wrapper script"), NULL }, { "allow-remote-connections", 'a', 0, G_OPTION_ARG_NONE, &allow_remote_connections, N_("Listen on TCP socket"), NULL }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &args, "", "" }, { NULL } }; bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); textdomain (GETTEXT_PACKAGE); setlocale (LC_ALL, ""); gdm_log_init (); context = g_option_context_new (_("GNOME Display Manager X Session Launcher")); g_option_context_add_main_entries (context, entries, NULL); g_option_context_parse (context, &argc, &argv, NULL); g_option_context_free (context); if (args == NULL || args[0] == NULL || args[1] != NULL) { g_warning ("gdm-x-session takes one argument (the session)"); exit_status = EX_USAGE; goto out; } init_state (&state); state->session_command = args[0]; state->settings = gdm_settings_new (); ret = gdm_settings_direct_init (state->settings, DATADIR "/gdm/gdm.schemas", "/"); if (!ret) { g_printerr ("Unable to initialize settings"); exit_status = EX_DATAERR; goto out; } gdm_settings_direct_get_boolean (GDM_KEY_DEBUG, &debug); state->debug_enabled = debug; gdm_log_set_debug (debug); state->main_loop = g_main_loop_new (NULL, FALSE); state->cancellable = g_cancellable_new (); g_unix_signal_add (SIGTERM, (GSourceFunc) on_sigterm, state); ret = spawn_x_server (state, allow_remote_connections, state->cancellable); if (!ret) { g_printerr ("Unable to run X server"); exit_status = EX_SOFTWARE; goto out; } ret = spawn_bus (state, state->cancellable); if (!ret) { g_printerr ("Unable to run session message bus"); exit_status = EX_SOFTWARE; goto out; } ret = register_display (state, state->cancellable); if (!ret) { g_printerr ("Unable to register display with display manager"); exit_status = EX_SOFTWARE; goto out; } ret = spawn_session (state, run_script, state->cancellable); if (!ret) { g_printerr ("Unable to run session"); exit_status = EX_SOFTWARE; goto out; } g_main_loop_run (state->main_loop); /* Only use exit status of session if we're here because it exit */ if (state->session_subprocess == NULL) { exit_status = state->session_exit_status; } out: signal_subprocesses (state); wait_on_subprocesses (state); clear_state (&state); return exit_status; }