int
main (int    argc,
      char **argv)
{
        GError *error = NULL;

#ifdef ENABLE_NLS
        bindtextdomain (GETTEXT_PACKAGE, "/usr/share/cinnamon/locale");
# ifdef HAVE_BIND_TEXTDOMAIN_CODESET
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
# endif
        textdomain (GETTEXT_PACKAGE);
#endif

        if (! gtk_init_with_args (&argc, &argv, NULL, NULL, NULL, &error)) {
                fprintf (stderr, "%s", error->message);
                g_error_free (error);
                exit (1);
        }

        gs_debug_init (TRUE, FALSE);

        test_watcher ();

        gtk_main ();

        gs_debug_shutdown ();

        return 0;
}
int
main (int    argc,
      char **argv)
{
        GError *error = NULL;
        int     op, event, err;

#ifdef ENABLE_NLS
        bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
# ifdef HAVE_BIND_TEXTDOMAIN_CODESET
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
# endif
        textdomain (GETTEXT_PACKAGE);
#endif

        if (error) {
                fprintf (stderr, "%s\n", error->message);
                exit (1);
        }

        if (! gtk_init_with_args (&argc, &argv, NULL, NULL, NULL, &error)) {
                fprintf (stderr, "%s", error->message);
                g_error_free (error);
                exit (1);
        }

        if (! XQueryExtension (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XF86_VIDMODE_NAME, &op, &event, &err)) {
                g_message ("no " XF86_VIDMODE_NAME " extension");
        } else {
# ifdef HAVE_XF86VMODE_GAMMA
                int major;
                int minor;

                if (! XF86VidModeQueryVersion (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &major, &minor)) {
                        g_message ("unable to get " XF86_VIDMODE_NAME " version");
                } else {
                        g_message (XF86_VIDMODE_NAME " version %d.%d", major, minor);
                }
# else /* !HAVE_XF86VMODE_GAMMA */
                g_message ("no support for display's " XF86_VIDMODE_NAME " extension");
# endif /* !HAVE_XF86VMODE_GAMMA */
        }

        gs_debug_init (TRUE, FALSE);

        test_fade ();

        gs_debug_shutdown ();

        return 0;
}
示例#3
0
int
main (int    argc,
      char **argv)
{
	GError *error = NULL;

#ifdef ENABLE_NLS
	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
# ifdef HAVE_BIND_TEXTDOMAIN_CODESET
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
# endif
	textdomain (GETTEXT_PACKAGE);
#endif

	if (! gtk_init_with_args (&argc, &argv, NULL, NULL, NULL, &error))
	{
		fprintf (stderr, "%s", error->message);
		g_error_free (error);
		exit (1);
	}

	gs_debug_init (TRUE, FALSE);

	grab = gs_grab_new ();

	test_window ();

	/* safety valve in case we can't authenticate */
	g_timeout_add (30000, (GSourceFunc)gtk_main_quit, NULL);

	gtk_main ();

	g_object_unref (grab);

	gs_debug_shutdown ();

	return 0;
}
int
main (int    argc,
      char **argv)
{
        GSMonitor          *monitor;
        GError             *error = NULL;
        static gboolean     show_version = FALSE;
        static gboolean     no_daemon    = TRUE;
        static gboolean     debug        = FALSE;
        static GOptionEntry entries []   = {
                { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Version of this application"), NULL },
                { "no-daemon", 0, 0, G_OPTION_ARG_NONE, &no_daemon, N_("Don't become a daemon"), NULL },
                { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL },
                { NULL }
        };

#ifdef ENABLE_NLS
        bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
# ifdef HAVE_BIND_TEXTDOMAIN_CODESET
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
# endif
        textdomain (GETTEXT_PACKAGE);
#endif

        if (! gtk_init_with_args (&argc, &argv, NULL, entries, NULL, &error)) {
                if (error) {
                        g_warning ("%s", error->message);
                        g_error_free (error);
                } else {
                        g_warning ("Unable to initialize GTK+");
                }
                exit (1);
        }

        if (show_version) {
                g_print ("%s %s\n", argv [0], VERSION);
                exit (1);
        }

        gs_debug_init (debug, FALSE);
        gs_debug ("initializing cinnamon-screensaver %s", VERSION);

        monitor = gs_monitor_new ();

        if (monitor == NULL) {
                exit (1);
        }

        error = NULL;
        if (! gs_monitor_start (monitor, &error)) {
                if (error) {
                        g_warning ("%s", error->message);
                        g_error_free (error);
                } else {
                        g_warning ("Unable to start screensaver");
                }
                exit (1);
        }

        gtk_main ();

        g_object_unref (monitor);

        gs_debug ("cinnamon-screensaver finished");

        gs_debug_shutdown ();

        return 0;
}