コード例 #1
0
ファイル: irman.c プロジェクト: jetlive/xynth
int s_video_helper_irman_init (char *port)
{
	int ret;
	ret = ir_open_port(port);
	if (ret == -1)
		return -1;
	ret = ir_init(port);
	if (ret == -1)
		return -1;
	return ir_get_portfd();
}
コード例 #2
0
ファイル: configure.c プロジェクト: sedwards/xmms3
static void irconf_control_cb(GtkWidget * w, gchar * data)
{
	GtkWidget *vbox, *frame, *table, *button, *box;
	gint i;

	if (!irconf_controlwin && !irconf_playlistwin)
	{
		char *tmp;

		keepConfGoing = TRUE;
		irbutton_to_edit = data;
		irconf_controlwin = gtk_window_new(GTK_WINDOW_DIALOG);
		gtk_signal_connect(GTK_OBJECT(irconf_controlwin), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &irconf_controlwin);
		tmp=g_strdup_printf(_("`%s' Button Setup"),_(data));
		gtk_window_set_title(GTK_WINDOW(irconf_controlwin), tmp);
		g_free(tmp);
		gtk_window_set_policy(GTK_WINDOW(irconf_controlwin), FALSE, FALSE, FALSE);
		gtk_window_set_position(GTK_WINDOW(irconf_controlwin), GTK_WIN_POS_MOUSE);
		gtk_container_border_width(GTK_CONTAINER(irconf_controlwin), 10);

		vbox = gtk_vbox_new(FALSE, 10);
		gtk_container_add(GTK_CONTAINER(irconf_controlwin), vbox);

		frame = gtk_frame_new(_("Enter code or use remote"));
		gtk_container_border_width(GTK_CONTAINER(frame), 5);
		gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);

		table = gtk_table_new(1, 1, FALSE);
		gtk_container_set_border_width(GTK_CONTAINER(table), 5);
		gtk_container_add(GTK_CONTAINER(frame), table);
		gtk_table_set_row_spacings(GTK_TABLE(table), 2);
		gtk_table_set_col_spacings(GTK_TABLE(table), 5);

		ircode_entry = gtk_entry_new();
		gtk_table_attach_defaults(GTK_TABLE(table), ircode_entry, 0, 1, 0, 1);
		if (!strcmp(data, ir_control[0]))
			gtk_entry_set_text(GTK_ENTRY(ircode_entry), ircfg.button_play);
		else if (!strcmp(data, ir_control[1]))
			gtk_entry_set_text(GTK_ENTRY(ircode_entry), ircfg.button_stop);
		else if (!strcmp(data, ir_control[2]))
			gtk_entry_set_text(GTK_ENTRY(ircode_entry), ircfg.button_pause);
		else if (!strcmp(data, ir_control[3]))
			gtk_entry_set_text(GTK_ENTRY(ircode_entry), ircfg.button_prev);
		else if (!strcmp(data, ir_control[4]))
			gtk_entry_set_text(GTK_ENTRY(ircode_entry), ircfg.button_next);
		else if (!strcmp(data, ir_control[5]))
			gtk_entry_set_text(GTK_ENTRY(ircode_entry), ircfg.button_volup);
		else if (!strcmp(data, ir_control[6]))
			gtk_entry_set_text(GTK_ENTRY(ircode_entry), ircfg.button_seekb);
		else if (!strcmp(data, ir_control[7]))
			gtk_entry_set_text(GTK_ENTRY(ircode_entry), ircfg.button_seekf);
		else if (!strcmp(data, ir_control[8]))
			gtk_entry_set_text(GTK_ENTRY(ircode_entry), ircfg.button_voldown);
		else if (!strcmp(data, ir_control[9]))
			gtk_entry_set_text(GTK_ENTRY(ircode_entry), ircfg.button_shuffle);
		else if (!strcmp(data, ir_control[10]))
			gtk_entry_set_text(GTK_ENTRY(ircode_entry), ircfg.button_repeat);
		else if (!strcmp(data, ir_control[11]))
			gtk_entry_set_text(GTK_ENTRY(ircode_entry), ircfg.button_playlist);
		else if (!strcmp(data, ir_control[12]))
			gtk_entry_set_text(GTK_ENTRY(ircode_entry), ircfg.button_plus100);
		else
			for (i = 0; i < 10; i++)
				if (!strcmp(data, ir_playlist[i]))
					gtk_entry_set_text(GTK_ENTRY(ircode_entry), ircfg.button[i]);
		gtk_widget_show(ircode_entry);

		box = gtk_hbutton_box_new();
		gtk_button_box_set_layout(GTK_BUTTON_BOX(box), GTK_BUTTONBOX_END);
		gtk_button_box_set_spacing(GTK_BUTTON_BOX(box), 5);
		gtk_box_pack_start(GTK_BOX(vbox), box, FALSE, FALSE, 0);

		button = gtk_button_new_with_label(_("OK"));
		gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(irconf_control_ok_cb), NULL);
		GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
		gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 0);
		gtk_widget_grab_default(button);
		gtk_widget_show(button);

		button = gtk_button_new_with_label(_("Cancel"));
		gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(irconf_control_cancel_cb), NULL);
		GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
		gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 0);
		gtk_widget_show(button);

		gtk_widget_show(box);
		gtk_widget_show(table);
		gtk_widget_show(frame);
		gtk_widget_show(vbox);
		gtk_widget_show(irconf_controlwin);

		if ((ir_was_enabled = ir_get_portfd()))
			ir_close_port();
		irapp_init_port(g_strdup(gtk_entry_get_text(GTK_ENTRY(dev_entry))));
		irconf_is_going = TRUE;
		gtk_timeout_add(10, irconf_codeentry_routine, NULL);
	}
}