int
main (int argc, char **argv)
{
	GOptionContext *context;
	GladeXML       *gui;
	char           *gladefile;

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

	context = g_option_context_new ("");

	g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);

	gnome_program_init (argv [0], "0.0.0.0", LIBGNOMEUI_MODULE,
			    argc, argv,
			    GNOME_PARAM_GOPTION_CONTEXT, context,
			    GNOME_PARAM_NONE);

	g_option_context_free (context);

	if (cli_iid) {
		load_applet_from_command_line ();
		gtk_main ();
		return 0;
	}

	gladefile = PANEL_APPLET_GLADEDIR "/panel-test-applets.glade";
	gui = glade_xml_new (gladefile, "toplevel", NULL);
	if (!gui) {
		g_warning ("Error loading `%s'", gladefile);
		return 1;
	}

	glade_xml_signal_autoconnect (gui);

	win             = glade_xml_get_widget (gui, "toplevel");
	applet_combo    = glade_xml_get_widget (gui, "applet-combo");
	prefs_dir_entry = glade_xml_get_widget (gui, "prefs-dir-entry");
	orient_combo    = glade_xml_get_widget (gui, "orient-combo");
	size_combo      = glade_xml_get_widget (gui, "size-combo");

	setup_options ();

	gtk_widget_show (win);

	gtk_main ();

	return 0;
}
예제 #2
0
int
main (int argc, char **argv)
{
	GtkBuilder *builder;
	char       *uifile;
	char       *applets_dir;
	GError     *error;

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

	error = NULL;
	if (!gtk_init_with_args (&argc, &argv,
				 "", (GOptionEntry *) options, GETTEXT_PACKAGE,
				 &error)) {
		if (error) {
			g_printerr ("%s\n", error->message);
			g_error_free (error);
		} else
			g_printerr ("Cannot initiliaze GTK+.\n");

		return 1;
	}

	panel_modules_ensure_loaded ();

	if (g_file_test ("../libmate-panel-applet", G_FILE_TEST_IS_DIR)) {
		applets_dir = g_strdup_printf ("%s:../libmate-panel-applet", MATE_PANEL_APPLETS_DIR);
		g_setenv ("MATE_PANEL_APPLETS_DIR", applets_dir, FALSE);
		g_free (applets_dir);
	}

	if (cli_iid) {
		load_applet_from_command_line ();
		gtk_main ();
		panel_cleanup_do ();

		return 0;
	}

	builder = gtk_builder_new ();
	gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);

	uifile = BUILDERDIR "/panel-test-applets.ui";
	gtk_builder_add_from_file (builder, uifile, &error);

	if (error) {
		g_warning ("Error loading \"%s\": %s", uifile, error->message);
		g_error_free (error);
		panel_cleanup_do ();

		return 1;
	}

	gtk_builder_connect_signals (builder, NULL);

	win             = GTK_WIDGET (gtk_builder_get_object (builder,
							      "toplevel"));
	applet_combo    = GTK_WIDGET (gtk_builder_get_object (builder,
							      "applet-combo"));
	prefs_path_entry = GTK_WIDGET (gtk_builder_get_object (builder,
							      "prefs-path-entry"));
	orient_combo    = GTK_WIDGET (gtk_builder_get_object (builder,
							      "orient-combo"));
	size_combo      = GTK_WIDGET (gtk_builder_get_object (builder,
							      "size-combo"));
	g_object_unref (builder);

	setup_options ();

	gtk_widget_show (win);

	gtk_main ();

	panel_cleanup_do ();

	return 0;
}
int
main (int argc, char **argv)
{
	GtkBuilder *builder;
	char       *uifile;
	GError     *error;

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

	error = NULL;
	if (!gtk_init_with_args (&argc, &argv,
				 "", (GOptionEntry *) options, GETTEXT_PACKAGE,
				 &error)) {
		if (error) {
			g_printerr ("%s\n", error->message);
			g_error_free (error);
		} else
			g_printerr ("Cannot initiliaze GTK+.\n");

		return 1;
	}

	if (!matecomponent_init (&argc, argv)) {
		g_printerr ("Cannot initialize matecomponent.\n");
		return 1;
	}

	if (cli_iid) {
		load_applet_from_command_line ();
		gtk_main ();
		return 0;
	}

	builder = gtk_builder_new ();
	gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);

	uifile = MATE_PANEL_APPLET_BUILDERDIR "/panel-test-applets.ui";
	gtk_builder_add_from_file (builder, uifile, &error);

	if (error) {
		g_warning ("Error loading \"%s\": %s", uifile, error->message);
		g_error_free (error);
		return 1;
	}

	gtk_builder_connect_signals (builder, NULL);

	win             = GTK_WIDGET (gtk_builder_get_object (builder,
							      "toplevel"));
	applet_combo    = GTK_WIDGET (gtk_builder_get_object (builder,
							      "applet-combo"));
	prefs_dir_entry = GTK_WIDGET (gtk_builder_get_object (builder,
							      "prefs-dir-entry"));
	orient_combo    = GTK_WIDGET (gtk_builder_get_object (builder,
							      "orient-combo"));
	size_combo      = GTK_WIDGET (gtk_builder_get_object (builder,
							      "size-combo"));
	g_object_unref (builder);

	setup_options ();

	gtk_widget_show (win);

	gtk_main ();

	return 0;
}