int
main (int   argc,
      char *argv[])
{
        gboolean res;

        g_log_set_always_fatal (G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);

        res = session_manager_connect ();
        if (! res) {
                g_warning ("Unable to connect to session manager");
                exit (1);
        }

        res = register_client ();
        if (! res) {
                g_warning ("Unable to register client with session manager");
        }

        main_loop = g_main_loop_new (NULL, FALSE);

        g_timeout_add_seconds (30, quit_test, NULL);

        g_main_loop_run (main_loop);
        g_main_loop_unref (main_loop);

        unregister_client ();
        session_manager_disconnect ();

        return 0;
}
Beispiel #2
0
int
main (int argc, char *argv[])
{

        //bindtextdomain (GETTEXT_PACKAGE, GNOME_SETTINGS_LOCALEDIR);
        //bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
        //textdomain (GETTEXT_PACKAGE);

        parse_args (&argc, &argv);

        gdk_set_allowed_backends ("x11");

        if (! gdk_init_check (NULL, NULL)) {
                g_warning ("Unable to initialize GTK+");
                exit (EXIT_FAILURE);
        }

        g_log_set_default_handler (gsd_log_default_handler, NULL);

        if (g_strcmp0(g_getenv("XDG_CURRENT_DESKTOP"), "GNOME")) {
                xsync = g_slice_new0 (MetaXSync);
                init_xsync();
                mainloop = g_main_loop_new (NULL, FALSE);

                meta_monitor_manager_initialize (replace);
                meta_idle_monitor_init_dbus (replace);

                if (!session_manager_connect ())
                        g_warning ("Unable to connect to session manager");

                register_with_gnome_session (sm_proxy);
                watch_for_term_signal ();

                g_main_loop_run (mainloop);

                g_slice_free(MetaXSync, xsync);
        }
        
        g_debug ("DisplayConfig finished");

        return 0;
}
Beispiel #3
0
void
panel_session_init (void)
{
	gboolean res;

	res = session_manager_connect ();
    if (! res) {
            g_warning ("Unable to connect to session manager");
            exit (1);
    }

    res = register_client ();
    if (! res) {
            g_warning ("Unable to register client with session manager");
    }

	/* We don't want the WM to try and save/restore our
	 * window position */
	gdk_x11_set_sm_client_id (NULL);
}
int
main (int   argc,
      char *argv[])
{
        gboolean   res;
        GtkWidget *dialog;

        g_log_set_always_fatal (G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);

        gtk_init (&argc, &argv);

        res = session_manager_connect ();
        if (! res) {
                g_warning ("Unable to connect to session manager");
                exit (1);
        }

        g_timeout_add_seconds (30, (GSourceFunc)gtk_main_quit, NULL);

        dialog = gtk_message_dialog_new (NULL,
                                         0,
                                         GTK_MESSAGE_INFO,
                                         GTK_BUTTONS_CANCEL,
                                         "Inhibiting logout, switch user, and suspend.");

        g_signal_connect (dialog, "response", G_CALLBACK (gtk_main_quit), NULL);
        g_signal_connect (dialog, "show", G_CALLBACK (on_widget_show), NULL);
        gtk_widget_show (dialog);

        gtk_main ();

        do_uninhibit ();
        session_manager_disconnect ();

        return 0;
}