void Color_Selector::showDialog()
{
    p->old_color = color();
    p->dialog->setColor(color());
    connect_dialog();
    p->dialog->show();
}
Example #2
0
gint main (int argc, char **argv)
{
	int c;

	char *profile = NULL;

	init_signal_handlers(argv[0]);

	opterr = 0;
	while ((c = getopt (argc, argv, "c:p:u:")) != -1)
		switch (c) {
			case 'c':
				ctx = iio_create_network_context(optarg);
				if (!ctx) {
					printf("Failed connecting to remote device: %s\n", optarg);
					exit(-1);
				}
				break;
			case 'u':
				ctx = iio_create_context_from_uri(optarg);
				if (!ctx) {
					printf("Failed connecting to remote device: %s\n", optarg);
					exit(-1);
				}
				break;
			case 'p':
				profile = strdup(optarg);
				break;
			case '?':
				usage(argv[0]);
				break;
			default:
				printf("Unknown command line option\n");
				usage(argv[0]);
				break;
		}

#ifndef __MINGW32__
	/* XXX: Enabling threading when compiling for Windows will lock the UI
	 * as soon as the main window is moved. */
	gdk_threads_init();
#endif
	gtk_init(&argc, &argv);

	signal(SIGTERM, sigterm);
	signal(SIGINT, sigterm);
#ifndef __MINGW32__
	signal(SIGHUP, sigterm);
#endif

	gdk_threads_enter();
	init_application();
	c = load_default_profile(profile, true);
	if (!ctx_destroyed_by_do_quit) {
		if (!ctx)
			connect_dialog(false);

		create_default_plot();
		if (c == 0) {
			if (gtk_check_menu_item_get_active(
					GTK_CHECK_MENU_ITEM(versioncheck_en)))
				version_check_start(NULL);
			gtk_main();
		} else
			application_quit();
	}
	gdk_threads_leave();

	if (profile)
	    free(profile);

	if (c == 0 || c == -ENOTTY)
		return 0;
	else
		return -1;
}