Beispiel #1
0
static void PopulateForm(int pgs)
{
    if (pgs & (1<<TAB_CONFIG)) {
        int mode3d, i;
        GtkListStore *modes3d;
        GtkTreeIter iter;
        GtkComboBox *box3d;
        char buf[64];

        mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1);
        if (mode3d < 0) {
            int i, cd[] = { 32, 24, 16, 15, 8, 0 };
            for (i=0; cd[i]; ) {
                if (cd[i] >= settings.bpp3d) i++;
                else break;
            }
            for ( ; cd[i]; i++) {
                mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1);
                if (mode3d < 0) continue;
                settings.bpp3d = cd[i];
                break;
            }
        }

        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(startwin,"fullscreencheck")), settings.fullscreen);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(startwin,"alwaysshowcheck")), settings.forcesetup);

        box3d = GTK_COMBO_BOX(lookup_widget(startwin,"vmode3dcombo"));
        modes3d = GTK_LIST_STORE(gtk_combo_box_get_model(box3d));
        gtk_list_store_clear(modes3d);

        for (i=0; i<validmodecnt; i++) {
            if (validmode[i].fs != settings.fullscreen) continue;

            // all modes get added to the 3D mode list
            Bsprintf(buf, "%d x %d %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
            gtk_list_store_append(modes3d, &iter);
            gtk_list_store_set(modes3d, &iter, 0,buf, 1,i, -1);
            if (i == mode3d) {
                g_signal_handlers_block_by_func(box3d, on_vmode3dcombo_changed, NULL);
                gtk_combo_box_set_active_iter(box3d, &iter);
                g_signal_handlers_unblock_by_func(box3d, on_vmode3dcombo_changed, NULL);
            }
        }

        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(startwin,"inputmousecheck")), settings.usemouse);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(startwin,"inputjoycheck")), settings.usejoy);
    }

    if (pgs & (1<<TAB_GAME)) {
        struct grpfile *fg;
        int i;
        GtkListStore *list;
        GtkTreeIter iter;
        GtkTreeView *gamelist;

        gamelist = GTK_TREE_VIEW(lookup_widget(startwin,"gamelist"));
        list = GTK_LIST_STORE(gtk_tree_view_get_model(gamelist));
        gtk_list_store_clear(list);

        for (fg = foundgrps; fg; fg=fg->next) {
            for (i = 0; i<numgrpfiles; i++)
                if (fg->crcval == grpfiles[i].crcval) break;
            if (i == numgrpfiles) continue; // unrecognised grp file

            gtk_list_store_append(list, &iter);
            gtk_list_store_set(list, &iter, 0, grpfiles[i].name, 1, fg->name, 2, (gpointer)fg, -1);
            if (!Bstrcasecmp(fg->name, settings.selectedgrp)) {
                GtkTreeSelection *sel = gtk_tree_view_get_selection(gamelist);
                g_signal_handlers_block_by_func(sel, on_gamelist_selection_changed, NULL);
                gtk_tree_selection_select_iter(sel, &iter);
                g_signal_handlers_unblock_by_func(sel, on_gamelist_selection_changed, NULL);
            }
        }
    }
}
static void
update_button_state (ButtonData *button_data)
{
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_data->button), button_data->showing_bigboard);
        update_button_display (button_data);
}
Beispiel #3
0
static void mpg123_configurewin_ok(GtkWidget * widget, gpointer data)
{
	ConfigFile *cfg;
	gchar *filename;

	if (GTK_TOGGLE_BUTTON(decode_res_16)->active)
		mpg123_cfg.resolution = 16;
	else if (GTK_TOGGLE_BUTTON(decode_res_8)->active)
		mpg123_cfg.resolution = 8;

	if (GTK_TOGGLE_BUTTON(decode_ch_stereo)->active)
		mpg123_cfg.channels = 2;
	else if (GTK_TOGGLE_BUTTON(decode_ch_mono)->active)
		mpg123_cfg.channels = 1;

	if (GTK_TOGGLE_BUTTON(decode_freq_1to1)->active)
		mpg123_cfg.downsample = 0;
	else if (GTK_TOGGLE_BUTTON(decode_freq_1to2)->active)
		mpg123_cfg.downsample = 1;
	if (GTK_TOGGLE_BUTTON(decode_freq_1to4)->active)
		mpg123_cfg.downsample = 2;

	if (GTK_TOGGLE_BUTTON(detect_by_content)->active)
		mpg123_cfg.detect_by = DETECT_CONTENT;
	else if (GTK_TOGGLE_BUTTON(detect_by_extension)->active)
		mpg123_cfg.detect_by = DETECT_EXTENSION;
	else if (GTK_TOGGLE_BUTTON(detect_by_both)->active)
		mpg123_cfg.detect_by = DETECT_BOTH;
	else mpg123_cfg.detect_by = DETECT_EXTENSION;

#ifdef USE_SIMD
	if (GTK_TOGGLE_BUTTON(auto_select)->active)
                mpg123_cfg.default_synth = SYNTH_AUTO;
        else if (GTK_TOGGLE_BUTTON(decoder_fpu)->active)
                mpg123_cfg.default_synth = SYNTH_FPU;
        else if (GTK_TOGGLE_BUTTON(decoder_mmx)->active)
                mpg123_cfg.default_synth = SYNTH_MMX;
        else mpg123_cfg.default_synth = SYNTH_3DNOW;

#endif
	mpg123_cfg.http_buffer_size = (gint) GTK_ADJUSTMENT(streaming_size_adj)->value;
	mpg123_cfg.http_prebuffer = (gint) GTK_ADJUSTMENT(streaming_pre_adj)->value;

	mpg123_cfg.use_proxy = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use));
	g_free(mpg123_cfg.proxy_host);
	mpg123_cfg.proxy_host = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_host_entry)));
	mpg123_cfg.proxy_port = atoi(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_port_entry)));

	mpg123_cfg.proxy_use_auth = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_auth_use));

	if(mpg123_cfg.proxy_user)
		g_free(mpg123_cfg.proxy_user);
	mpg123_cfg.proxy_user = NULL;
	if(strlen(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_user_entry))) > 0)
		mpg123_cfg.proxy_user = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_user_entry)));

	if(mpg123_cfg.proxy_pass)
		g_free(mpg123_cfg.proxy_pass);
	mpg123_cfg.proxy_pass = NULL;
	if(strlen(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_pass_entry))) > 0)
		mpg123_cfg.proxy_pass = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_pass_entry)));
	
	
	mpg123_cfg.save_http_stream = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_save_use));
	if (mpg123_cfg.save_http_path)
		g_free(mpg123_cfg.save_http_path);
	mpg123_cfg.save_http_path = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_save_entry)));

	mpg123_cfg.cast_title_streaming = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_cast_title));
	mpg123_cfg.use_udp_channel = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_udp_title));
	
	mpg123_cfg.title_override = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_override));
	mpg123_cfg.disable_id3v2 = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_id3v2_disable));
	g_free(mpg123_cfg.id3_format);
	mpg123_cfg.id3_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(title_id3_entry)));

	filename = g_strconcat(g_get_home_dir(), "/.xmms/config", NULL);
	cfg = xmms_cfg_open_file(filename);
	if (!cfg)
		cfg = xmms_cfg_new();
	xmms_cfg_write_int(cfg, "MPG123", "resolution", mpg123_cfg.resolution);
	xmms_cfg_write_int(cfg, "MPG123", "channels", mpg123_cfg.channels);
	xmms_cfg_write_int(cfg, "MPG123", "downsample", mpg123_cfg.downsample);
	xmms_cfg_write_int(cfg, "MPG123", "http_buffer_size", mpg123_cfg.http_buffer_size);
	xmms_cfg_write_int(cfg, "MPG123", "http_prebuffer", mpg123_cfg.http_prebuffer);
	xmms_cfg_write_boolean(cfg, "MPG123", "use_proxy", mpg123_cfg.use_proxy);
	xmms_cfg_write_string(cfg, "MPG123", "proxy_host", mpg123_cfg.proxy_host);
	xmms_cfg_write_int(cfg, "MPG123", "proxy_port", mpg123_cfg.proxy_port);
	xmms_cfg_write_boolean(cfg, "MPG123", "proxy_use_auth", mpg123_cfg.proxy_use_auth);
	if(mpg123_cfg.proxy_user)
		xmms_cfg_write_string(cfg, "MPG123", "proxy_user", mpg123_cfg.proxy_user);
	else
		xmms_cfg_remove_key(cfg, "MPG123", "proxy_user");
	if(mpg123_cfg.proxy_pass)
		xmms_cfg_write_string(cfg, "MPG123", "proxy_pass", mpg123_cfg.proxy_pass);
	else
		xmms_cfg_remove_key(cfg, "MPG123", "proxy_pass");
	xmms_cfg_write_boolean(cfg, "MPG123", "save_http_stream", mpg123_cfg.save_http_stream);
	xmms_cfg_write_string(cfg, "MPG123", "save_http_path", mpg123_cfg.save_http_path);
	xmms_cfg_write_boolean(cfg, "MPG123", "cast_title_streaming", mpg123_cfg.cast_title_streaming);
	xmms_cfg_write_boolean(cfg, "MPG123", "use_udp_channel", mpg123_cfg.use_udp_channel);
	xmms_cfg_write_boolean(cfg, "MPG123", "title_override", mpg123_cfg.title_override);
	xmms_cfg_write_boolean(cfg, "MPG123", "disable_id3v2", mpg123_cfg.disable_id3v2);
	xmms_cfg_write_string(cfg, "MPG123", "id3_format", mpg123_cfg.id3_format);
	xmms_cfg_write_int(cfg, "MPG123", "detect_by", mpg123_cfg.detect_by);
#ifdef USE_SIMD
	xmms_cfg_write_int(cfg, "MPG123", "default_synth", mpg123_cfg.default_synth);
#endif
	xmms_cfg_write_file(cfg, filename);
	xmms_cfg_free(cfg);
	g_free(filename);
	gtk_widget_destroy(mpg123_configurewin);
}
Beispiel #4
0
static void
create_font_picker (void)
{
	GtkWidget *fontpicker1,*fontpicker2,*fontpicker3;

	TestGnomeApp *app;
	GtkWidget *vbox,*vbox1,*vbox2,*vbox3;
	GtkWidget *hbox1,*hbox3;
	GtkWidget *frPixmap,*frFontInfo,*frUser;
	GtkWidget *lbPixmap,*lbFontInfo,*lbUser;
	GtkWidget *ckUseFont,*spUseFont,*ckShowSize;
	GtkAdjustment *adj;

	app = create_newwin(TRUE,"testGNOME","Font Picker");


	vbox=gtk_vbox_new(FALSE,5);
	gtk_container_set_border_width(GTK_CONTAINER(vbox),5);
	bonobo_window_set_contents(BONOBO_WINDOW(app->app),vbox);

	/* Pixmap */
	frPixmap=gtk_frame_new("Default Pixmap");
	gtk_box_pack_start(GTK_BOX(vbox),frPixmap,TRUE,TRUE,0);
	vbox1=gtk_vbox_new(FALSE,FALSE);
	gtk_container_add(GTK_CONTAINER(frPixmap),vbox1);
	
	/* GnomeFontPicker with pixmap */
	fontpicker1 = gnome_font_picker_new();
	gtk_container_set_border_width(GTK_CONTAINER(fontpicker1),5);
	gtk_box_pack_start(GTK_BOX(vbox1),fontpicker1,TRUE,TRUE,0);
	lbPixmap=gtk_label_new("If you choose a font it will appear here");
	gtk_box_pack_start(GTK_BOX(vbox1),lbPixmap,TRUE,TRUE,5);

	g_signal_connect(fontpicker1,"font_set",
			 G_CALLBACK(cfp_set_font),
			 lbPixmap);

	/* Font_Info */
	frFontInfo=gtk_frame_new("Font Info");
	gtk_box_pack_start(GTK_BOX(vbox),frFontInfo,TRUE,TRUE,0);
	vbox2=gtk_vbox_new(FALSE,FALSE);
	gtk_container_set_border_width(GTK_CONTAINER(vbox2),5);
	gtk_container_add(GTK_CONTAINER(frFontInfo),vbox2);

	fontpicker2 = gnome_font_picker_new();

	/* GnomeFontPicker with fontinfo */
	hbox1=gtk_hbox_new(FALSE,5);
	gtk_box_pack_start(GTK_BOX(vbox2),hbox1,FALSE,FALSE,0);
	ckUseFont=gtk_check_button_new_with_label("Use Font in button with size");
	gtk_box_pack_start(GTK_BOX(hbox1),ckUseFont,TRUE,TRUE,0);

	adj=GTK_ADJUSTMENT(gtk_adjustment_new(14,5,150,1,1,1));
	g_signal_connect (adj, "value_changed",
			  G_CALLBACK (cfp_sp_value_changed),
			  fontpicker2);
	spUseFont=gtk_spin_button_new(adj,1,0);
	gtk_box_pack_start(GTK_BOX(hbox1),spUseFont,FALSE,FALSE,0);
	g_object_set_data (G_OBJECT (fontpicker2), "spUseFont", spUseFont);

	g_signal_connect (ckUseFont, "toggled",
			  G_CALLBACK (cfp_ck_UseFont),
			  fontpicker2);

	ckShowSize=gtk_check_button_new_with_label("Show font size");
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ckShowSize),TRUE);
	gtk_box_pack_start(GTK_BOX(vbox2),ckShowSize,FALSE,FALSE,5);

	g_signal_connect (ckShowSize, "toggled",
			  G_CALLBACK (cfp_ck_ShowSize),
			  fontpicker2);

	gnome_font_picker_set_mode(GNOME_FONT_PICKER(fontpicker2),GNOME_FONT_PICKER_MODE_FONT_INFO);
	gtk_box_pack_start(GTK_BOX(vbox2),fontpicker2,TRUE,TRUE,0);

	lbFontInfo=gtk_label_new("If you choose a font it will appear here");
	gtk_box_pack_start(GTK_BOX(vbox2),lbFontInfo,TRUE,TRUE,5);


	g_signal_connect(fontpicker2,"font_set",
			 G_CALLBACK(cfp_set_font),lbFontInfo);


	/* User Widget */
	frUser=gtk_frame_new("User Widget");
	gtk_box_pack_start(GTK_BOX(vbox),frUser,TRUE,TRUE,0);
	vbox3=gtk_vbox_new(FALSE,FALSE);
	gtk_container_add(GTK_CONTAINER(frUser),vbox3);
	
	/* GnomeFontPicker with User Widget */
	fontpicker3 = gnome_font_picker_new();
	gnome_font_picker_set_mode(GNOME_FONT_PICKER(fontpicker3),GNOME_FONT_PICKER_MODE_USER_WIDGET);

	hbox3=gtk_hbox_new(FALSE,0);
	gtk_box_pack_start(GTK_BOX(hbox3),gtk_image_new_from_stock
                           (GNOME_STOCK_PIXMAP_SPELLCHECK, GTK_ICON_SIZE_BUTTON),
			   FALSE,FALSE,5);
	gtk_box_pack_start(GTK_BOX(hbox3),gtk_label_new("This is an hbox with pixmap and text"),
			   FALSE,FALSE,5);
	gnome_font_picker_uw_set_widget(GNOME_FONT_PICKER(fontpicker3),hbox3);
	gtk_container_set_border_width(GTK_CONTAINER(fontpicker3),5);
	gtk_box_pack_start(GTK_BOX(vbox3),fontpicker3,TRUE,TRUE,0);

	lbUser=gtk_label_new("If you choose a font it will appear here");
	gtk_box_pack_start(GTK_BOX(vbox3),lbUser,TRUE,TRUE,5);

	g_signal_connect(fontpicker3,"font_set",
			 G_CALLBACK(cfp_set_font),lbUser);

	gtk_widget_show_all(app->app);

}
Beispiel #5
0
static void
create_appearance_section (GtkWidget *appearance_vbox, GUI *appGUI)
{
	GtkWidget *table, *colors_hbox;
	GtkWidget *checkbutton, *label, *color_button, *font_button;
	GdkColor color;

	table = gtk_table_new (4, 4, FALSE);
	gtk_box_pack_start (GTK_BOX (appearance_vbox), table, FALSE, FALSE, 0);
	gtk_table_set_col_spacings (GTK_TABLE (table), 4);
	gtk_table_set_row_spacings (GTK_TABLE (table), 8);

	colors_hbox = gtk_hbox_new (FALSE, 8);
	gtk_table_attach (GTK_TABLE (table), colors_hbox, 1, 2, 0, 1,
	                  (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0);

	color_button = gtk_color_button_new ();
	if (config.enable_tooltips)
		gtk_widget_set_tooltip_text (color_button, _("Color of items that are due today"));
	gdk_color_parse (config.due_today_color, &color);
	gtk_color_button_set_color (GTK_COLOR_BUTTON (color_button), &color);
	gtk_box_pack_start (GTK_BOX (colors_hbox), color_button, FALSE, FALSE, 0);
	g_signal_connect (G_OBJECT (color_button), "color-set", G_CALLBACK (due_today_color_changed_cb), appGUI);
	appGUI->opt->due_today_color_picker = color_button;

	color_button = gtk_color_button_new ();
	g_signal_connect (G_OBJECT (color_button), "color-set", G_CALLBACK (due_7days_color_changed_cb), appGUI);
	if (config.enable_tooltips)
		gtk_widget_set_tooltip_text (color_button, _("Color of items that are due in the next 7 days"));
	gdk_color_parse (config.due_7days_color, &color);
	gtk_color_button_set_color (GTK_COLOR_BUTTON (color_button), &color);
	gtk_box_pack_start (GTK_BOX (colors_hbox), color_button, FALSE, FALSE, 0);
	appGUI->opt->due_7days_color_picker = color_button;

	color_button = gtk_color_button_new ();
	if (config.enable_tooltips)
		gtk_widget_set_tooltip_text (color_button, _("Color of items that are past due"));
	gdk_color_parse(config.past_due_color, &color);
	gtk_color_button_set_color (GTK_COLOR_BUTTON (color_button), &color);
	gtk_box_pack_start (GTK_BOX (colors_hbox), color_button, FALSE, FALSE, 0);
	g_signal_connect (G_OBJECT (color_button), "color-set", G_CALLBACK (past_due_color_changed_cb), appGUI);
	appGUI->opt->past_due_color_picker = color_button;

	appGUI->opt->ti_font_entry = gtk_entry_new ();
	gtk_entry_set_text (GTK_ENTRY (appGUI->opt->ti_font_entry), config.task_info_font);
	GTK_WIDGET_UNSET_FLAGS (appGUI->opt->ti_font_entry, GTK_CAN_FOCUS);
	gtk_table_attach (GTK_TABLE (table), appGUI->opt->ti_font_entry, 1, 2, 1, 2,
	                  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0);

	if (config.default_stock_icons)
		font_button = utl_gui_stock_button (GTK_STOCK_SELECT_FONT, FALSE);
	else
		font_button = utl_gui_stock_button (OSMO_STOCK_BUTTON_SELECT_FONT, FALSE);
	gtk_table_attach (GTK_TABLE (table), font_button, 2, 3, 1, 2,
	                  (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
	g_signal_connect (G_OBJECT (font_button), "clicked", G_CALLBACK (ti_font_select_cb), appGUI);

	label = utl_gui_create_label ("%s:", _("Task info font"));
	gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
	                  (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);

	label = utl_gui_create_label ("%s:", _("Colors"));
	gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
	                  (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);

	checkbutton = gtk_check_button_new_with_mnemonic (_("Show in bold tasks with high priority"));
	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton), config.tasks_high_in_bold);
	gtk_table_attach (GTK_TABLE (table), checkbutton, 0, 3, 3, 4,
	                  (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
	g_signal_connect (G_OBJECT (checkbutton), "toggled", G_CALLBACK (bold_items_cb), appGUI);
	appGUI->opt->ct_bold_items_checkbutton = checkbutton;
}
Beispiel #6
0
void create_gtab_conf_window()
{
  if (hime_gtab_conf_window) {
    gtk_window_present(GTK_WINDOW(hime_gtab_conf_window));
    return;
  }

  load_setttings();

  hime_gtab_conf_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_position(GTK_WINDOW(hime_gtab_conf_window), GTK_WIN_POS_MOUSE);
  gtk_window_set_has_resize_grip(GTK_WINDOW(hime_gtab_conf_window), FALSE);

  g_signal_connect (G_OBJECT (hime_gtab_conf_window), "delete_event",
                    G_CALLBACK (close_gtab_conf_window),
                    NULL);

  gtk_window_set_title (GTK_WINDOW (hime_gtab_conf_window), _("倉頡/行列/大易設定"));
  gtk_container_set_border_width (GTK_CONTAINER (hime_gtab_conf_window), 3);

  GtkWidget *vbox_top = gtk_vbox_new (FALSE, 10);
  gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox_top), GTK_ORIENTATION_VERTICAL);
  gtk_container_add (GTK_CONTAINER (hime_gtab_conf_window), vbox_top);

  GtkWidget *hbox_lr = gtk_hbox_new (FALSE, 10);
  gtk_box_pack_start (GTK_BOX (vbox_top), hbox_lr, FALSE, FALSE, 0);


  GtkWidget *frame_gtab_l = gtk_frame_new(_("外觀"));
  gtk_container_set_border_width (GTK_CONTAINER (frame_gtab_l), 5);
  gtk_box_pack_start (GTK_BOX (hbox_lr), frame_gtab_l, FALSE, FALSE, 0);
  GtkWidget *vbox_gtab_l = gtk_vbox_new (FALSE, 0);
  gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox_gtab_l), GTK_ORIENTATION_VERTICAL);
  gtk_container_add (GTK_CONTAINER (frame_gtab_l), vbox_gtab_l);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_gtab_l), 10);


  GtkWidget *frame_gtab_r = gtk_frame_new(_("行為"));
  gtk_container_set_border_width (GTK_CONTAINER (frame_gtab_r), 5);
  gtk_box_pack_start (GTK_BOX (hbox_lr), frame_gtab_r, FALSE, FALSE, 0);
  GtkWidget *vbox_gtab_r = gtk_vbox_new (FALSE, 0);
  gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox_gtab_r), GTK_ORIENTATION_VERTICAL);
  gtk_container_add (GTK_CONTAINER (frame_gtab_r), vbox_gtab_r);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_gtab_r), 10);

#define SPC 1

  GtkWidget *hbox_gtab_pre_select = gtk_hbox_new (FALSE, SPC);
  gtk_box_pack_start (GTK_BOX (vbox_gtab_l), hbox_gtab_pre_select, FALSE, FALSE, 0);
  opt_gtab_pre_select = gtk_label_new (_("預覽/預選 字"));
  gtk_box_pack_start (GTK_BOX (hbox_gtab_pre_select),opt_gtab_pre_select,  FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (hbox_gtab_pre_select), create_auto_select_by_phrase_opts(&opt_gtab_pre_select, gtab_pre_select),  FALSE, FALSE, 0);

  GtkWidget *hbox_gtab_disp_partial_match = gtk_hbox_new (FALSE, SPC);
  gtk_box_pack_start (GTK_BOX (vbox_gtab_l), hbox_gtab_disp_partial_match, FALSE, FALSE, 0);
  opt_gtab_disp_partial_match = gtk_label_new (_("預選列中顯示部份符合的字"));
  gtk_box_pack_start (GTK_BOX (hbox_gtab_disp_partial_match), opt_gtab_disp_partial_match,  FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (hbox_gtab_disp_partial_match), create_auto_select_by_phrase_opts(&opt_gtab_disp_partial_match, gtab_disp_partial_match), FALSE, FALSE, 0);

  GtkWidget *hbox_gtab_disp_key_codes = gtk_hbox_new (FALSE, SPC);
  gtk_box_pack_start (GTK_BOX (vbox_gtab_l), hbox_gtab_disp_key_codes, FALSE, FALSE, 0);
  check_button_gtab_disp_key_codes = gtk_check_button_new_with_label (_("顯示字根"));
  gtk_box_pack_start (GTK_BOX (hbox_gtab_disp_key_codes), check_button_gtab_disp_key_codes,  FALSE, FALSE, 0);

  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button_gtab_disp_key_codes),
     gtab_disp_key_codes);


  GtkWidget *hbox_gtab_disp_im_name = gtk_hbox_new (FALSE, SPC);
  gtk_box_pack_start (GTK_BOX (vbox_gtab_l), hbox_gtab_disp_im_name, FALSE, FALSE, 0);
  check_button_gtab_disp_im_name = gtk_check_button_new_with_label (_("顯示輸入法名稱"));
  gtk_box_pack_start (GTK_BOX (hbox_gtab_disp_im_name), check_button_gtab_disp_im_name,  FALSE, FALSE, 0);

  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button_gtab_disp_im_name),
     gtab_disp_im_name);

  GtkWidget *hbox_gtab_hide_row2 = gtk_hbox_new (FALSE, SPC);
  gtk_box_pack_start (GTK_BOX (vbox_gtab_l), hbox_gtab_hide_row2, FALSE, FALSE, 0);
  check_button_gtab_hide_row2 = gtk_check_button_new_with_label (_("隱藏第二列 (輸入鍵…)"));
  gtk_box_pack_start (GTK_BOX (hbox_gtab_hide_row2), check_button_gtab_hide_row2,  FALSE, FALSE, 0);
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button_gtab_hide_row2),
     gtab_hide_row2);


  GtkWidget *hbox_gtab_in_row1 = gtk_hbox_new (FALSE, SPC);
  gtk_box_pack_start (GTK_BOX (vbox_gtab_l), hbox_gtab_in_row1, FALSE, FALSE, 0);
  check_button_gtab_in_row1 = gtk_check_button_new_with_label (_("將字根移至第一列"));
  gtk_box_pack_start (GTK_BOX (hbox_gtab_in_row1), check_button_gtab_in_row1,  FALSE, FALSE, 0);
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button_gtab_in_row1),
     gtab_in_row1);

  GtkWidget *hbox_gtab_vertical_select = gtk_hbox_new (FALSE, SPC);
  gtk_box_pack_start (GTK_BOX (vbox_gtab_l), hbox_gtab_vertical_select, FALSE, FALSE, 0);
  GtkWidget *label_gtab_vertical_select = gtk_label_new (_("垂直選擇"));
  gtk_box_pack_start (GTK_BOX (hbox_gtab_vertical_select), label_gtab_vertical_select,  FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (hbox_gtab_vertical_select), create_auto_select_by_phrase_opts(&opt_gtab_vertical_select, gtab_vertical_select),  FALSE, FALSE, 0);

  GtkWidget *hbox_gtab_press_full_auto_send = gtk_hbox_new (FALSE, SPC);
  gtk_box_pack_start (GTK_BOX (vbox_gtab_r), hbox_gtab_press_full_auto_send, FALSE, FALSE, 0);
  GtkWidget *label_gtab_gtab_press_full_auto_send = gtk_label_new(_("按滿字根自動送字"));
  gtk_box_pack_start (GTK_BOX (hbox_gtab_press_full_auto_send), label_gtab_gtab_press_full_auto_send, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (hbox_gtab_press_full_auto_send), create_auto_select_by_phrase_opts(&opt_gtab_press_full_auto_send, gtab_press_full_auto_send),  FALSE, FALSE, 0);

  GtkWidget *hbox_gtab_auto_select_by_phrase = gtk_hbox_new (FALSE, SPC);
  gtk_box_pack_start (GTK_BOX (vbox_gtab_r), hbox_gtab_auto_select_by_phrase, FALSE, FALSE, 0);
  GtkWidget *label_gtab_auto_select = gtk_label_new(_("由詞庫自動選字"));
  gtk_box_pack_start (GTK_BOX (hbox_gtab_auto_select_by_phrase), label_gtab_auto_select,  FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (hbox_gtab_auto_select_by_phrase), create_auto_select_by_phrase_opts(&opt_auto_select_by_phrase, gtab_auto_select_by_phrase),  FALSE, FALSE, 0);
  check_button_gtab_phrase_pre_select = gtk_check_button_new_with_label (_("使用預選詞"));
  gtk_box_pack_start (GTK_BOX (hbox_gtab_auto_select_by_phrase), check_button_gtab_phrase_pre_select,  FALSE, FALSE, 0);
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button_gtab_phrase_pre_select), gtab_phrase_pre_select);


  GtkWidget *hbox_gtab_dup_select_bell = gtk_hbox_new (FALSE, SPC);
  gtk_box_pack_start (GTK_BOX (vbox_gtab_r), hbox_gtab_dup_select_bell, FALSE, FALSE, 0);
  check_button_gtab_dup_select_bell = gtk_check_button_new_with_label (_("有重複字時,發出嗶聲"));
  gtk_box_pack_start (GTK_BOX (hbox_gtab_dup_select_bell),check_button_gtab_dup_select_bell,  FALSE, FALSE, 0);
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button_gtab_dup_select_bell),
     gtab_dup_select_bell);

  gtk_box_pack_start (GTK_BOX (vbox_gtab_r), create_spc_opts(), FALSE, FALSE, 0);

  GtkWidget *hbox_gtab_invalid_key_in = gtk_hbox_new (FALSE, SPC);
  gtk_box_pack_start (GTK_BOX (vbox_gtab_r), hbox_gtab_invalid_key_in, FALSE, FALSE, 0);
  check_button_gtab_invalid_key_in = gtk_check_button_new_with_label (_("可鍵入錯誤字根 (傳統)"));
  gtk_box_pack_start (GTK_BOX (hbox_gtab_invalid_key_in), check_button_gtab_invalid_key_in,  FALSE, FALSE, 0);

  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button_gtab_invalid_key_in),
     gtab_invalid_key_in);


  GtkWidget *hbox_gtab_shift_phrase_key = gtk_hbox_new (FALSE, SPC);
  gtk_box_pack_start (GTK_BOX (vbox_gtab_r), hbox_gtab_shift_phrase_key, FALSE, FALSE, 0);
  check_button_gtab_shift_phrase_key = gtk_check_button_new_with_label (_("可用 Shift 輸入片語 (預設為 Alt-Shift)"));
  gtk_box_pack_start (GTK_BOX (hbox_gtab_shift_phrase_key), check_button_gtab_shift_phrase_key,  FALSE, FALSE, 0);
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button_gtab_shift_phrase_key),
     gtab_shift_phrase_key);

  gtk_box_pack_start (GTK_BOX (vbox_gtab_r), create_en_pho_key_sel(_("切換[中/英]輸入")), FALSE, FALSE, 0);

#if 0
  GtkWidget *hbox_hime_capslock_lower = gtk_hbox_new (FALSE, SPC);
  gtk_box_pack_start (GTK_BOX (vbox_gtab_r), hbox_hime_capslock_lower, FALSE, FALSE, 0);
  check_button_hime_capslock_lower = gtk_check_button_new_with_label (_("\t用小寫字母"));
  gtk_box_pack_start (GTK_BOX (hbox_hime_capslock_lower), check_button_hime_capslock_lower,  FALSE, FALSE, 0);
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button_hime_capslock_lower),
     hime_capslock_lower);
#endif

  GtkWidget *hbox_gtab_unique_auto_send = gtk_hbox_new (FALSE, SPC);
  gtk_box_pack_start (GTK_BOX (vbox_gtab_r), hbox_gtab_unique_auto_send, FALSE, FALSE, 0);
  GtkWidget *label_gtab_unique_auto_send = gtk_label_new (_("唯一選擇時自動送出"));
  gtk_box_pack_start (GTK_BOX (hbox_gtab_unique_auto_send), label_gtab_unique_auto_send,  FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (hbox_gtab_unique_auto_send),  create_auto_select_by_phrase_opts(&opt_gtab_unique_auto_send, gtab_unique_auto_send),  FALSE, FALSE, 0);

  GtkWidget *hbox_gtab_que_wild_card = gtk_hbox_new (FALSE, SPC);
  gtk_box_pack_start (GTK_BOX (vbox_gtab_r), hbox_gtab_que_wild_card, FALSE, FALSE, 0);
  check_button_gtab_que_wild_card = gtk_check_button_new_with_label (_("使用?萬用字元"));
  gtk_box_pack_start (GTK_BOX (hbox_gtab_que_wild_card), check_button_gtab_que_wild_card,  FALSE, FALSE, 0);
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button_gtab_que_wild_card),
     gtab_que_wild_card);


  GtkWidget *button_edit_append = gtk_button_new_with_label(_("編輯預設輸入法的使用者外加字詞"));
  gtk_box_pack_start (GTK_BOX (vbox_gtab_r), button_edit_append, FALSE, FALSE, 0);

  g_signal_connect_swapped (G_OBJECT (button_edit_append), "clicked",
                            G_CALLBACK (cb_gtab_edit_append), NULL);


  GtkWidget *hbox_cancel_ok = gtk_hbox_new (FALSE, 10);
  gtk_grid_set_column_homogeneous(GTK_GRID(hbox_cancel_ok), TRUE);
  gtk_box_pack_start (GTK_BOX (vbox_top), hbox_cancel_ok, FALSE, FALSE, 0);

  GtkWidget *button_cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
  if (button_order)
    gtk_box_pack_end (GTK_BOX (hbox_cancel_ok), button_cancel, TRUE, TRUE, 0);
  else
    gtk_box_pack_start (GTK_BOX (hbox_cancel_ok), button_cancel, TRUE, TRUE, 0);

  g_signal_connect (G_OBJECT (button_cancel), "clicked",
                            G_CALLBACK (close_gtab_conf_window),
                            G_OBJECT (hime_gtab_conf_window));

  GtkWidget *button_ok = gtk_button_new_from_stock (GTK_STOCK_OK);
#if !GTK_CHECK_VERSION(2,91,2)
  if (button_order)
    gtk_box_pack_end (GTK_BOX (hbox_cancel_ok), button_ok, TRUE, TRUE, 0);
  else
    gtk_box_pack_start (GTK_BOX (hbox_cancel_ok), button_ok, TRUE, TRUE, 0);
#else
  if (button_order)
    gtk_grid_attach_next_to (GTK_BOX (hbox_cancel_ok), button_ok, button_cancel, GTK_POS_LEFT, 1, 1);
  else
    gtk_grid_attach_next_to (GTK_BOX (hbox_cancel_ok), button_ok, button_cancel, GTK_POS_RIGHT, 1, 1);
#endif

  g_signal_connect_swapped (G_OBJECT (button_ok), "clicked",
                            G_CALLBACK (cb_gtab_conf_ok),
                            G_OBJECT (hime_gtab_conf_window));

  GTK_WIDGET_SET_FLAGS (button_ok, GTK_CAN_DEFAULT);
  gtk_widget_grab_default (button_ok);

  gtk_widget_show_all (hime_gtab_conf_window);

  return;
}
static void show_auth_dialog(WebKitAuthData* authData, const char* login, const char* password)
{
    GtkWidget* toplevel;
    GtkWidget* widget;
    GtkDialog* dialog;
    GtkWindow* window;
    GtkWidget* entryContainer;
    GtkWidget* hbox;
    GtkWidget* mainVBox;
    GtkWidget* vbox;
    GtkWidget* icon;
    GtkWidget* table;
    GtkWidget* messageLabel;
    char* message;
    SoupURI* uri;
    GtkWidget* rememberBox;
    GtkWidget* checkButton;

    /* From GTK+ gtkmountoperation.c, modified and simplified. LGPL 2 license */

    widget = gtk_dialog_new();
    window = GTK_WINDOW(widget);
    dialog = GTK_DIALOG(widget);

    gtk_dialog_add_buttons(dialog,
                           GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                           GTK_STOCK_OK, GTK_RESPONSE_OK,
                           NULL);

    /* Set the dialog up with HIG properties */
    gtk_dialog_set_has_separator(dialog, FALSE);
    gtk_container_set_border_width(GTK_CONTAINER(dialog), 5);
    gtk_box_set_spacing(GTK_BOX(dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
    gtk_container_set_border_width(GTK_CONTAINER(dialog->action_area), 5);
    gtk_box_set_spacing(GTK_BOX(dialog->action_area), 6);

    gtk_window_set_resizable(window, FALSE);
    gtk_window_set_title(window, "");
    gtk_window_set_icon_name(window, GTK_STOCK_DIALOG_AUTHENTICATION);

    gtk_dialog_set_default_response(dialog, GTK_RESPONSE_OK);

    /* Get the current toplevel */
    g_signal_emit(authData->manager, signals[CURRENT_TOPLEVEL], 0, authData->msg, &toplevel);

    if (toplevel)
        gtk_window_set_transient_for(window, GTK_WINDOW(toplevel));

    /* Build contents */
    hbox = gtk_hbox_new(FALSE, 12);
    gtk_container_set_border_width(GTK_CONTAINER(hbox), 5);
    gtk_box_pack_start(GTK_BOX(dialog->vbox), hbox, TRUE, TRUE, 0);

    icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION,
                                    GTK_ICON_SIZE_DIALOG);

    gtk_misc_set_alignment(GTK_MISC(icon), 0.5, 0.0);
    gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, FALSE, 0);

    mainVBox = gtk_vbox_new(FALSE, 18);
    gtk_box_pack_start(GTK_BOX(hbox), mainVBox, TRUE, TRUE, 0);

    uri = soup_message_get_uri(authData->msg);
    message = g_strdup_printf(_("A username and password are being requested by the site %s"), uri->host);
    messageLabel = gtk_label_new(message);
    g_free(message);
    gtk_misc_set_alignment(GTK_MISC(messageLabel), 0.0, 0.5);
    gtk_label_set_line_wrap(GTK_LABEL(messageLabel), TRUE);
    gtk_box_pack_start(GTK_BOX(mainVBox), GTK_WIDGET(messageLabel),
                       FALSE, FALSE, 0);

    vbox = gtk_vbox_new(FALSE, 6);
    gtk_box_pack_start(GTK_BOX(mainVBox), vbox, FALSE, FALSE, 0);

    /* The table that holds the entries */
    entryContainer = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);

    gtk_alignment_set_padding(GTK_ALIGNMENT(entryContainer),
                              0, 0, 0, 0);

    gtk_box_pack_start(GTK_BOX(vbox), entryContainer,
                       FALSE, FALSE, 0);

    table = gtk_table_new(2, 2, FALSE);
    gtk_table_set_col_spacings(GTK_TABLE(table), 12);
    gtk_table_set_row_spacings(GTK_TABLE(table), 6);
    gtk_container_add(GTK_CONTAINER(entryContainer), table);

    authData->loginEntry = table_add_entry(table, 0, _("Username:"******"Password:"******"_Remember password"));
        if (login && password)
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkButton), TRUE);
        gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(checkButton))), TRUE);
        gtk_box_pack_start(GTK_BOX(rememberBox), checkButton, FALSE, FALSE, 0);
        authData->checkButton = checkButton;
    }

    g_signal_connect(dialog, "response", G_CALLBACK(response_callback), authData);
    gtk_widget_show_all(widget);
}
Beispiel #8
0
static gboolean _togglebutton_draw(GtkWidget *widget, cairo_t *cr)
{
  g_return_val_if_fail(widget != NULL, FALSE);
  g_return_val_if_fail(DTGTK_IS_TOGGLEBUTTON(widget), FALSE);

  GtkDarktableToggleButton *button = DTGTK_TOGGLEBUTTON(widget);

  GtkStateFlags state = gtk_widget_get_state_flags(widget);

  GdkRGBA bg_color, fg_color;
  GtkStyleContext *context = gtk_widget_get_style_context(widget);
  if(button->icon_flags & CPF_CUSTOM_BG)
    bg_color = button->bg;
  else
  {
    GdkRGBA *bc;
    gtk_style_context_get(context, state, "background-color", &bc, NULL);
    bg_color = *bc;
    gdk_rgba_free(bc);
  }
  if(button->icon_flags & CPF_CUSTOM_FG)
    fg_color = button->fg;
  else
    gtk_style_context_get_color(context, state, &fg_color);

  /* fetch flags */
  int flags = DTGTK_TOGGLEBUTTON(widget)->icon_flags;

  /* set inner border */
  int border = DT_PIXEL_APPLY_DPI((flags & CPF_DO_NOT_USE_BORDER) ? 2 : 6);

  /* update active state paint flag */
  gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
  if(active)
    flags |= CPF_ACTIVE;
  else
    flags &= ~(CPF_ACTIVE);

  /* prelight */
  if(state & GTK_STATE_FLAG_PRELIGHT)
    flags |= CPF_PRELIGHT;
  else
    flags &= ~CPF_PRELIGHT;

  /* begin cairo drawing */
  GtkAllocation allocation;
  gtk_widget_get_allocation(widget, &allocation);
  int width = allocation.width;
  int height = allocation.height;

  /* draw standard button background if not transparent nor flat styled */
  if((flags & CPF_STYLE_FLAT))
  {
    if(flags & CPF_PRELIGHT || flags & CPF_ACTIVE)
    {
      cairo_rectangle(cr, 0, 0, width, height);
      gdk_cairo_set_source_rgba(cr, &bg_color);
      cairo_fill(cr);
    }
  }
  else if(!(flags & CPF_BG_TRANSPARENT))
  {
    /* draw default boxed button */
    gtk_render_background(context, cr, 0, 0, width, height);
    if(!(flags & CPF_DO_NOT_USE_BORDER))
      gtk_render_frame(context, cr, 0, 0, width, height);
  }


  /* create pango text settings if label exists */
  PangoLayout *layout = NULL;
  int pw = 0, ph = 0;
  const gchar *text = gtk_button_get_label(GTK_BUTTON(widget));
  if(text)
  {
    layout = pango_cairo_create_layout(cr);
    pango_layout_set_font_description(layout, darktable.bauhaus->pango_font_desc);
    pango_cairo_context_set_resolution(pango_layout_get_context(layout), darktable.gui->dpi);
    pango_layout_set_text(layout, text, -1);
    pango_layout_get_pixel_size(layout, &pw, &ph);
  }

  gdk_cairo_set_source_rgba(cr, &fg_color);

  /* draw icon */
  if(DTGTK_TOGGLEBUTTON(widget)->icon)
  {
    //     if (flags & CPF_IGNORE_FG_STATE)
    //       state = GTK_STATE_NORMAL;

    int icon_width = text ? height - (border * 2) : width - (border * 2);
    int icon_height = height - (border * 2);

    if(icon_width > 0 && icon_height > 0)
    {
      if(text)
        DTGTK_TOGGLEBUTTON(widget)
            ->icon(cr, border, border, height - (border * 2), height - (border * 2), flags);
      else
        DTGTK_TOGGLEBUTTON(widget)
            ->icon(cr, border, border, width - (border * 2), height - (border * 2), flags);
    }
  }


  /* draw label */
  if(text)
  {
    int lx = DT_PIXEL_APPLY_DPI(2), ly = ((height / 2.0) - (ph / 2.0));
    // if (DTGTK_TOGGLEBUTTON (widget)->icon) lx += width;
    // GdkRectangle t={x,y,x+width,y+height};
    // gtk_paint_layout(style,gtk_widget_get_window(widget),
    // state,TRUE,&t,widget,"togglebutton",lx,ly,layout);
    cairo_translate(cr, lx, ly);
    pango_cairo_show_layout(cr, layout);
    g_object_unref(layout);
  }

  return FALSE;
}
Beispiel #9
0
void
prefsbox_open (void)
{
  GtkWidget *notebook;
  GtkWidget *grid;
  GtkWidget *controls_list;
  GtkWidget *label;
  GtkCellRenderer *renderer;
  GtkListStore *model;
  GtkTreeIter iter;
  gint i;

  if (prefsbox != NULL) {
    gtk_window_present (GTK_WINDOW (prefsbox));
    return;
  }

  prefsbox = gtk_dialog_new_with_buttons (_("Four-in-a-Row Preferences"),
					  GTK_WINDOW (app),
					  GTK_DIALOG_DESTROY_WITH_PARENT,
					  GTK_STOCK_CLOSE,
					  GTK_RESPONSE_ACCEPT, NULL);
  gtk_container_set_border_width (GTK_CONTAINER (prefsbox), 5);
  gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (prefsbox))),
		       2);

  g_signal_connect (G_OBJECT (prefsbox), "destroy",
		    G_CALLBACK (gtk_widget_destroyed), &prefsbox);

  notebook = gtk_notebook_new ();
  gtk_container_set_border_width (GTK_CONTAINER (notebook), 5);
  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (prefsbox))), notebook, TRUE, TRUE, 0);

  /* game tab */

  grid = gtk_grid_new ();
  gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
  gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
  gtk_container_set_border_width (GTK_CONTAINER (grid), 12);

  label = gtk_label_new (_("Game"));
  gtk_notebook_append_page (GTK_NOTEBOOK (notebook), grid, label);

  label = gtk_label_new (_("Player One:"));
  gtk_widget_set_hexpand (label, TRUE);
  gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);

  combobox1 = gtk_combo_box_new ();
  renderer = gtk_cell_renderer_text_new ();
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox1), renderer, TRUE);
  gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combobox1), renderer, "text", 0);
  model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
  gtk_combo_box_set_model (GTK_COMBO_BOX (combobox1), GTK_TREE_MODEL (model));
  gtk_list_store_append (model, &iter);
  gtk_list_store_set (model, &iter, 0, _("Human"), 1, LEVEL_HUMAN, -1);
  if (p.level[PLAYER1] == LEVEL_HUMAN)
    gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox1), &iter);
  gtk_list_store_append (model, &iter);
  gtk_list_store_set (model, &iter, 0, _("Level one"), 1, LEVEL_WEAK, -1);
  if (p.level[PLAYER1] == LEVEL_WEAK)
    gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox1), &iter);
  gtk_list_store_append (model, &iter);
  gtk_list_store_set (model, &iter, 0, _("Level two"), 1, LEVEL_MEDIUM, -1);
  if (p.level[PLAYER1] == LEVEL_MEDIUM)
    gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox1), &iter);
  gtk_list_store_append (model, &iter);
  gtk_list_store_set (model, &iter, 0, _("Level three"), 1, LEVEL_STRONG, -1);
  if (p.level[PLAYER1] == LEVEL_STRONG)
    gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox1), &iter);
  g_signal_connect (combobox1, "changed", G_CALLBACK (on_select_player1), NULL);
  gtk_grid_attach (GTK_GRID (grid), combobox1, 1, 0, 1, 1);

  label = gtk_label_new (_("Player Two:"));
  gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);

  combobox2 = gtk_combo_box_new ();
  renderer = gtk_cell_renderer_text_new ();
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox2), renderer, TRUE);
  gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combobox2), renderer, "text", 0);
  model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
  gtk_combo_box_set_model (GTK_COMBO_BOX (combobox2), GTK_TREE_MODEL (model));
  gtk_list_store_append (model, &iter);
  gtk_list_store_set (model, &iter, 0, _("Human"), 1, LEVEL_HUMAN, -1);
  if (p.level[PLAYER2] == LEVEL_HUMAN)
    gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox2), &iter);
  gtk_list_store_append (model, &iter);
  gtk_list_store_set (model, &iter, 0, _("Level one"), 1, LEVEL_WEAK, -1);
  if (p.level[PLAYER2] == LEVEL_WEAK)
    gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox2), &iter);
  gtk_list_store_append (model, &iter);
  gtk_list_store_set (model, &iter, 0, _("Level two"), 1, LEVEL_MEDIUM, -1);
  if (p.level[PLAYER2] == LEVEL_MEDIUM)
    gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox2), &iter);
  gtk_list_store_append (model, &iter);
  gtk_list_store_set (model, &iter, 0, _("Level three"), 1, LEVEL_STRONG, -1);
  if (p.level[PLAYER2] == LEVEL_STRONG)
    gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox2), &iter);
  g_signal_connect (combobox2, "changed", G_CALLBACK (on_select_player2), NULL);
  gtk_grid_attach (GTK_GRID (grid), combobox2, 1, 1, 1, 1);

  label = gtk_label_new_with_mnemonic (_("_Theme:"));
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
  gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 1, 1);

  combobox_theme = gtk_combo_box_text_new ();
  for (i = 0; i < n_themes; i++) {
    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox_theme),
		 	            _(theme_get_title (i)));
  }
  gtk_label_set_mnemonic_widget (GTK_LABEL (label), combobox_theme);
  gtk_grid_attach (GTK_GRID (grid), combobox_theme, 1, 2, 1, 1);

  checkbutton_animate =
    gtk_check_button_new_with_mnemonic (_("Enable _animation"));
  gtk_grid_attach (GTK_GRID (grid), checkbutton_animate, 0, 3, 2, 1);

  checkbutton_sound =
    gtk_check_button_new_with_mnemonic (_("E_nable sounds"));
  gtk_grid_attach (GTK_GRID (grid), checkbutton_sound, 0, 4, 2, 1);

  /* keyboard tab */

  label = gtk_label_new_with_mnemonic (_("Keyboard Controls"));

  controls_list = games_controls_list_new (settings);
  games_controls_list_add_controls (GAMES_CONTROLS_LIST (controls_list),
				    "key-left", _("Move left"), DEFAULT_KEY_LEFT,
                                    "key-right", _("Move right"), DEFAULT_KEY_RIGHT,
				    "key-drop", _("Drop marble"), DEFAULT_KEY_DROP,
                                    NULL);
  gtk_container_set_border_width (GTK_CONTAINER (controls_list), 12);
  gtk_notebook_append_page (GTK_NOTEBOOK (notebook), controls_list, label);

  /* fill in initial values */

  gtk_combo_box_set_active (GTK_COMBO_BOX (combobox_theme), p.theme_id);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton_animate),
				p.do_animate);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton_sound),
				p.do_sound);

  /* connect signals */

  g_signal_connect (prefsbox, "response", G_CALLBACK (on_dialog_close),
		    &prefsbox);

  g_signal_connect (G_OBJECT (combobox_theme), "changed",
		    G_CALLBACK (on_select_theme), NULL);

  g_signal_connect (G_OBJECT (checkbutton_animate), "toggled",
		    G_CALLBACK (on_toggle_animate), NULL);

  g_signal_connect (G_OBJECT (checkbutton_sound), "toggled",
		    G_CALLBACK (on_toggle_sound), NULL);

  gtk_widget_show_all (prefsbox);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//	Calibrator::calibrate
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void Calibrator::calibrate(void)
{
	// Bring globals into scope
	extern GladeXML     *gui;

    // Locals
	unsigned int        seq_index,
                        count;

	char                label_text[50];

    bool                skip,
                        started,
                        paused;

	Sequence            *seq;

	GtkWidget           *label,
                        *notify,
                        *window,
                        *progress_bar;

	vector< vector<float> > temp;
	Template sequence_template(NUMBER_OF_CHANNELS,sequences->length());

	gdk_threads_enter();    // Get GDK lock
	progress_bar = glade_xml_get_widget(gui, "cal_progress_bar");
	window = glade_xml_get_widget(gui, "cal_progress");
	label = glade_xml_get_widget(gui, "cal_label");
	notify = glade_xml_get_widget(gui, "cal_notify");
    username = (const char*)gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(gui, "user_field")));
    gdk_threads_leave();    // Release GDK lock

	for(seq_index = 0; seq_index < sequences->number(); ++seq_index)	// calibrate for each sequence
	{
        // Reset calibration progress window
        sprintf(label_text, "Calibrate Sequence %d", seq_index+1);

        gdk_threads_enter();    // Get GDK lock
        gtk_widget_set_sensitive(glade_xml_get_widget(gui, "cal_skip"),TRUE);
        gtk_widget_set_sensitive(glade_xml_get_widget(gui, "cal_pause"),FALSE);
        gtk_label_set_text(GTK_LABEL(label),label_text);
        gdk_threads_leave();    // Release GDK lock

        update_cal_progress_window(-1);


        // wait for user to click start button
        do
        {
            gdk_threads_enter();    // Get GDK lock
            skip = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(gui, "cal_skip")));
            gdk_threads_leave();    // Release GDK lock

            if(skip)
            {
                gdk_threads_enter();    // Get GDK lock
                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(gui, "cal_skip")),FALSE);
                gdk_threads_leave();

                ++seq_index;
                break;		// return to beginning
            }

            gdk_threads_enter();    // Get GDK lock
            started = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(gui, "cal_start")));
            gdk_threads_leave();    // Release GDK lock

        }while(!started);

        if (seq_index < sequences->number())
        {

            gdk_threads_enter();    // Get GDK lock
            gtk_widget_set_sensitive(glade_xml_get_widget(gui, "cal_start"), FALSE);
            gtk_widget_set_sensitive(glade_xml_get_widget(gui, "cal_skip"),FALSE);
            gtk_widget_set_sensitive(glade_xml_get_widget(gui, "cal_pause"),TRUE);
            gdk_threads_leave();    // Release GDK lock

            // Reset the template
            sequence_template.reset();

            // average PERIODS_TO_AVERAGE periods of EEG signal
            for(count = 0; count < PERIODS_TO_AVERAGE; ++count)
            {
                // Check pause button
                do
                {
                    gdk_threads_enter();
                    paused = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(gui, "cal_pause")));
                    gdk_threads_leave();
                    for(unsigned i = 0; i < 10000; ++i);
                } while (paused); // Wait in loop

                temp = get_one_period();

                if (!is_corrupt(temp) )
                {
                    sequence_template.add_data(temp);
                    update_cal_progress_window(count);

                }
                else{ --count; }
            }

            sequence_template.generate_template();
            seq = sequences->at(seq_index);
            seq->set_template(sequence_template);

            // Write cal file
            write_calibration_file(seq_index+1, sequence_template.get_template());
        }

		// Reset toggle button
		gdk_threads_enter();    // Get GDK lock
		gtk_widget_set_sensitive(glade_xml_get_widget(gui, "cal_start"), TRUE);
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(gui, "cal_start")),FALSE);
        gdk_threads_leave();    // Release GDK lock
	}


	xval("xval.txt");
	// Hide widget
	gdk_threads_enter();    // Get GDK lock
	gtk_widget_hide(window);
	gdk_threads_leave();    // Release GDK lock

}
Beispiel #11
0
gint display_scroptions_dbox()
{
	GladeXML *xml;
	GtkWidget *dbox;
	GtkWidget *data;
	gint result;
	
	xml = glade_xml_new
		(tilp_paths_build_glade("scroptions-2.glade"), 
		 "scroptions_dbox",
		 PACKAGE);
	if (!xml)
		g_error(_("%s: GUI loading failed!\n"), __FILE__);
	glade_xml_signal_autoconnect(xml);
	
	dbox = glade_xml_get_widget(xml, "scroptions_dbox");
	gtk_dialog_set_alternative_button_order(GTK_DIALOG(dbox), GTK_RESPONSE_OK,
	                                        GTK_RESPONSE_CANCEL,-1);
	memcpy(&tmp_options, &options2, sizeof(ScrOptions));
    tmp_options.file = g_strdup(options2.file);
	tmp_options.folder = g_strdup(options2.folder);

	frame = glade_xml_get_widget(xml, "frame5");
	gtk_widget_set_sensitive(frame, tmp_options.size == IMG_LCD);

	switch (tmp_options.format)
	{
	case IMG_JPG: 
		data = glade_xml_get_widget(xml, "radiobutton30");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	case IMG_PNG: 
		data = glade_xml_get_widget(xml, "radiobutton31");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	case IMG_ICO: 
		data = glade_xml_get_widget(xml, "radiobutton32");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break; 
	case IMG_EPS:
		data = glade_xml_get_widget(xml, "radiobutton33");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	case IMG_PDF:
		data = glade_xml_get_widget(xml, "radiobutton34");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	case IMG_BMP:
		data = glade_xml_get_widget(xml, "radiobutton35");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	}

	switch (tmp_options.type)
	{
	case IMG_BW:
		data = glade_xml_get_widget(xml, "radiobutton10");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	case IMG_COL:
		data = glade_xml_get_widget(xml, "radiobutton11");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	}

	switch (tmp_options.size)
	{
	case IMG_LCD:
		data = glade_xml_get_widget(xml, "radiobutton20");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	case IMG_SKIN:
		data = glade_xml_get_widget(xml, "radiobutton21");
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), TRUE);
		break;
	}

	data = glade_xml_get_widget(xml, "spinbutton1");
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(data), tmp_options.shots);

	data = glade_xml_get_widget(xml, "spinbutton2");
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(data), tmp_options.skips);

	label = glade_xml_get_widget(xml, "label10");
	refresh_label();
		
	data = glade_xml_get_widget(xml, "entry10");
	gtk_entry_set_text(GTK_ENTRY(data), tmp_options.file);

	data = glade_xml_get_widget(xml, "filechooserbutton1");
	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (data), tmp_options.folder);
	
	result = gtk_dialog_run(GTK_DIALOG(dbox));
	switch (result) {
	case GTK_RESPONSE_OK:
        g_free(options2.file);
		g_free(options2.folder);

		memcpy(&options2, &tmp_options, sizeof(ScrOptions));

		options2.file = g_strdup(tmp_options.file);
        g_free(tmp_options.file);

		options2.folder = g_strdup(tmp_options.folder);
		g_free(tmp_options.folder);
		break;
	default:
		break;
	}

	frame = label = NULL;
	gtk_widget_destroy(dbox);

	return 0;
}
void perform_uninstall_slot(GtkWidget* w, gpointer data)
{
    GtkWidget *notebook;
    GtkWidget *progress;
    GtkWidget *widget;
    GList *list, *poopy, *clist;
    GtkWidget *button;
    component_list *component;
    size_t size, total;
    char text[1024];
	const char *message;

	/* Set through environment to hide questions, and assume Yes */
	int show_messages;
	const char *env;

	show_messages = 1;

	env = getenv("SETUP_NO_PROMPT");
	if ( env && atoi(env) )
		show_messages = 0;


    /* First switch to the next notebook page */
    notebook = glade_xml_get_widget(uninstall_glade, "uninstall_notebook");
    gtk_notebook_set_page(GTK_NOTEBOOK(notebook), 1);
    widget = glade_xml_get_widget(uninstall_glade, "finished_button");
    if ( widget ) {
        gtk_button_set_sensitive(widget, FALSE);
    }

    /* Now uninstall all the selected components */
    progress = glade_xml_get_widget(uninstall_glade, "uninstall_progress");
    size = 0;
    total = calculate_recovered_space();
    widget = glade_xml_get_widget(uninstall_glade, "uninstall_vbox");
    list = gtk_container_children(GTK_CONTAINER(widget));
    while ( list && ! uninstall_cancelled ) {
        widget = GTK_WIDGET(list->data);
        poopy = gtk_container_children(GTK_CONTAINER(widget));
        widget = GTK_WIDGET(poopy->data);
        /* First do the addon components */
        clist = gtk_container_children(GTK_CONTAINER(widget));
        while ( clist && ! uninstall_cancelled ) {
            button = GTK_WIDGET(clist->data);
            if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)) ) {
                component = gtk_object_get_data(GTK_OBJECT(button), "data");
                if ( loki_isdefault_component(component->component) ) {
                    clist = clist->next;
                    continue;
                }
                /* Put up the status */
                snprintf(text, sizeof(text), "%s: %s",
                        component->info->description,
                        loki_getname_component(component->component));
                set_status_text(text);

                /* See if the user wants to cancel the uninstall */
                while( gtk_events_pending() ) {
                    gtk_main_iteration();
                }
				
				/* Display an optional message to the user */
				message = loki_getmessage_component(component->component);
				if (show_messages && message && !display_message(message, BUTTON_OK|BUTTON_ABORT) ) {
                    clist = clist->next;
					uninstall_cancelled = 1;
					break;
				}

                /* Remove the component */
                if ( ! uninstall_component(component->component, component->info) ) {
					uninstall_cancelled = 2;
					snprintf(text, sizeof(text), _("Uninstallation of component %s has failed!\n"
												   "The whole uninstallation may be incomplete.\n"),
							 loki_getname_component(component->component));
					display_message(text, BUTTON_ABORT);
					break;
				}

                /* Update the progress bar */
                if ( total && progress ) {
                    size += component->size/1024;
                    gtk_progress_set_percentage(GTK_PROGRESS(progress),
                                                (float)size/total);
                }
                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE);

                /* See if the user wants to cancel the uninstall */
                while( gtk_events_pending() ) {
                    gtk_main_iteration();
                }
            }
            clist = clist->next;
        }
        /* Now do the primary components */
        clist = gtk_container_children(GTK_CONTAINER(widget));
        while ( clist && ! uninstall_cancelled ) {
            button = GTK_WIDGET(clist->data);
            if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)) ) {
                component = gtk_object_get_data(GTK_OBJECT(button), "data");
                if ( ! loki_isdefault_component(component->component) ) {
                    clist = clist->next;
                    continue;
                }
                /* Put up the status */
                strncpy(text, component->info->description, sizeof(text));
                set_status_text(text);

                /* See if the user wants to cancel the uninstall */
                while( gtk_events_pending() ) {
                    gtk_main_iteration();
                }

				/* Display an optional message to the user */
				message = loki_getmessage_component(component->component);
				if ( message && !display_message(message, BUTTON_OK|BUTTON_ABORT) ) {
                    clist = clist->next;
					uninstall_cancelled = 1;
					break;
				}

                /* Remove the component */
                if ( ! perform_uninstall(component->product, component->info, 0) ) {
					uninstall_cancelled = 2;
					snprintf(text, sizeof(text), _("Uninstallation of product %s has failed!\n"
												   "Aborting the rest of the uninstallation.\n"),
							 component->info->description);
					display_message(text, BUTTON_ABORT);
					break;
				}
                remove_product(component->product);

                /* Update the progress bar */
                if ( total && progress ) {
                    size += component->size/1024;
                    gtk_progress_set_percentage(GTK_PROGRESS(progress),
                                                (float)size/total);
                }

                /* See if the user wants to cancel the uninstall */
                while( gtk_events_pending() ) {
                    gtk_main_iteration();
                }
                break;
            }
            clist = clist->next;
        }
        list = list->next;
    }
    switch ( uninstall_cancelled ) {
	case 1:
        set_status_text(_("Uninstall cancelled"));
		break;
	case 2:
        set_status_text(_("Uninstall aborted"));
		break;
	default:
        set_status_text(_("Uninstall complete"));
		gtk_progress_set_percentage(GTK_PROGRESS(progress), 1.0f);
		break;
    }
    widget = glade_xml_get_widget(uninstall_glade, "cancel_button");
    if ( widget ) {
        gtk_button_set_sensitive(widget, FALSE);
    }
    widget = glade_xml_get_widget(uninstall_glade, "finished_button");
    if ( widget ) {
        gtk_button_set_sensitive(widget, TRUE);
    }
}
Beispiel #13
0
static void create_find_dialog(GtkWidget *htmlwidget)
{
	GtkWidget *dialog_vbox29;
	GtkWidget *vbox45;
	GtkWidget *label180;
	GtkWidget *hbox66;
	GtkWidget *dialog_action_area29;
	GtkWidget *hbuttonbox8;
#ifndef HAVE_GTK_310
	GtkWidget *alignment;
#endif
	GtkWidget *hbox5;
	GtkWidget *image;
	GtkWidget *label12;
	//gchar title[80];

	//sprintf(title, "%s - %s", settings.program_title, _("Find"));

	dialog = g_new(FIND_DIALOG, 1); /* must be freed */
	dialog->regular = FALSE;
	dialog->htmlwidget = htmlwidget;

	dialog->dialog = gtk_dialog_new();
	g_object_set_data(G_OBJECT(dialog->dialog),
			  "dialog->dialog", dialog->dialog);
	gtk_window_set_title(GTK_WINDOW(dialog->dialog), _("Find"));
	//GTK_WINDOW(dialog->dialog)->type = GTK_WINDOW_TOPLEVEL;
	/*gtk_window_set_policy(GTK_WINDOW(dialog->dialog), TRUE, TRUE,
	   FALSE); */
	gtk_container_set_border_width(GTK_CONTAINER(dialog->dialog), 6);
	gtk_window_set_resizable(GTK_WINDOW(dialog->dialog), FALSE);
#ifndef USE_GTK_3
	gtk_dialog_set_has_separator(GTK_DIALOG(dialog->dialog), FALSE);
#endif
	dialog_vbox29 =
	    gtk_dialog_get_content_area(GTK_DIALOG(dialog->dialog));
	g_object_set_data(G_OBJECT(dialog->dialog), "dialog_vbox29",
			  dialog_vbox29);
	gtk_widget_show(dialog_vbox29);

	UI_VBOX(vbox45, FALSE, 12);
	gtk_widget_show(vbox45);
	gtk_box_pack_start(GTK_BOX(dialog_vbox29), vbox45, TRUE, TRUE, 0);

	label180 = gtk_label_new(_("Enter Word or Phrase"));
	gtk_widget_show(label180);
	gtk_box_pack_start(GTK_BOX(vbox45), label180, FALSE, FALSE, 0);

	dialog->entry = gtk_entry_new();
	gtk_widget_show(dialog->entry);
	gtk_box_pack_start(GTK_BOX(vbox45), dialog->entry, FALSE, FALSE,
			   0);
	gtk_widget_set_size_request(dialog->entry, 291, -1);

	UI_HBOX(hbox66, FALSE, 0);
	gtk_widget_show(hbox66);
	gtk_box_pack_start(GTK_BOX(vbox45), hbox66, TRUE, TRUE, 0);

	dialog->backward =
	    gtk_check_button_new_with_label(_("Search backwards"));
	gtk_widget_show(dialog->backward);
	gtk_box_pack_start(GTK_BOX(hbox66), dialog->backward, FALSE,
			   FALSE, 0);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->backward), FALSE);

	dialog_action_area29 =
#ifdef HAVE_GTK_312
	    gtk_dialog_get_content_area(GTK_DIALOG(dialog->dialog));
#else
	    gtk_dialog_get_action_area(GTK_DIALOG(dialog->dialog));
#endif
	g_object_set_data(G_OBJECT(dialog->dialog),
			  "dialog_action_area29", dialog_action_area29);
	gtk_widget_show(dialog_action_area29);
	gtk_container_set_border_width(GTK_CONTAINER(dialog_action_area29), 10);

#ifdef USE_GTK_3
	hbuttonbox8 = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
#else
	hbuttonbox8 = gtk_hbutton_box_new();
#endif
	gtk_widget_show(hbuttonbox8);
	gtk_box_pack_start(GTK_BOX(dialog_action_area29), hbuttonbox8,
			   TRUE, TRUE, 0);

	dialog->find =
#ifdef HAVE_GTK_310
	    gtk_button_new_from_icon_name("edit-find",
					  GTK_ICON_SIZE_BUTTON);
#else
	    gtk_button_new_from_stock(GTK_STOCK_FIND); //gtk_button_new_with_label(_("Find"));
#endif
	gtk_widget_show(dialog->find);
	gtk_container_add(GTK_CONTAINER(hbuttonbox8), dialog->find);

	dialog->next = gtk_button_new();
	gtk_widget_show(dialog->next);
	gtk_container_add(GTK_CONTAINER(hbuttonbox8), dialog->next);
//GTK_WIDGET_SET_FLAGS(dialog->next, GTK_CAN_DEFAULT);

#ifndef HAVE_GTK_310
	alignment = gtk_alignment_new(0.5, 0.5, 0, 0);
	gtk_widget_show(alignment);
	gtk_container_add(GTK_CONTAINER(dialog->next), alignment);

#endif
	UI_HBOX(hbox5, FALSE, 2);
	gtk_widget_show(hbox5);
#ifndef HAVE_GTK_310
	gtk_container_add(GTK_CONTAINER(alignment), hbox5);
#endif

	image =
#ifdef HAVE_GTK_310
	    gtk_image_new_from_icon_name("edit-find",
					 GTK_ICON_SIZE_BUTTON);
#else
	    gtk_image_new_from_stock(GTK_STOCK_FIND, GTK_ICON_SIZE_BUTTON);
#endif
	gtk_widget_show(image);
	gtk_box_pack_start(GTK_BOX(hbox5), image, FALSE, FALSE, 0);

	label12 = gtk_label_new_with_mnemonic(_("Find Next"));
	gtk_widget_show(label12);
	gtk_box_pack_start(GTK_BOX(hbox5), label12, FALSE, FALSE, 0);
	gtk_label_set_justify(GTK_LABEL(label12), GTK_JUSTIFY_LEFT);

	dialog->close =
#ifdef HAVE_GTK_310
	    // Don't use an icon with GTK3
	    gtk_button_new_with_label(_("Close"));
#else
	    gtk_button_new_from_stock(GTK_STOCK_CLOSE);
#endif
	gtk_widget_show(dialog->close);
	gtk_container_add(GTK_CONTAINER(hbuttonbox8), dialog->close);
	//GTK_WIDGET_SET_FLAGS(dialog->close, GTK_CAN_DEFAULT);
	gtk_widget_set_can_default(dialog->find, 1);

	g_signal_connect(G_OBJECT(dialog->dialog), "destroy",
			 G_CALLBACK(dialog_destroy), dialog);
	g_signal_connect(G_OBJECT(dialog->find), "clicked",
			 G_CALLBACK(find_clicked), dialog);
	g_signal_connect(G_OBJECT(dialog->next), "clicked",
			 G_CALLBACK(next_clicked), dialog);
	g_signal_connect(G_OBJECT(dialog->close), "clicked",
			 G_CALLBACK(close_clicked), dialog);
}
Beispiel #14
0
static void next_clicked(GtkButton *button, FIND_DIALOG *d)
{
	XIPHOS_HTML_FIND_AGAIN((void *)d->htmlwidget, 1);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(d->backward), 0);
}
Beispiel #15
0
bool SettingsDialog::getCheckbox(const char * name) {
	XOJ_CHECK_TYPE(SettingsDialog);

	GtkToggleButton * b = GTK_TOGGLE_BUTTON(get(name));
	return gtk_toggle_button_get_active(b);
}
Beispiel #16
0
PidginXferDialog *
pidgin_xfer_dialog_new(void)
{
	PidginXferDialog *dialog;
	GtkWidget *window;
	GtkWidget *vbox1, *vbox2;
	GtkWidget *sw;
	GtkWidget *button;
	GtkWidget *expander;
	GtkWidget *table;
	GtkWidget *checkbox;

	dialog = g_new0(PidginXferDialog, 1);
	dialog->keep_open =
		purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/filetransfer/keep_open");
	dialog->auto_clear =
		purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/filetransfer/clear_finished");

	/* Create the window. */
	dialog->window = window = pidgin_create_dialog(_("File Transfers"), PIDGIN_HIG_BORDER, "file transfer", TRUE);
	gtk_window_set_default_size(GTK_WINDOW(window), 450, 250);

	g_signal_connect(G_OBJECT(window), "delete_event",
					 G_CALLBACK(delete_win_cb), dialog);

	/* Create the parent vbox for everything. */
	vbox1 = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(window), FALSE, PIDGIN_HIG_BORDER);

	/* Create the main vbox for top half of the window. */
	vbox2 = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
	gtk_box_pack_start(GTK_BOX(vbox1), vbox2, TRUE, TRUE, 0);
	gtk_widget_show(vbox2);

	/* Setup the listbox */
	sw = setup_tree(dialog);
	gtk_box_pack_start(GTK_BOX(vbox2), sw, TRUE, TRUE, 0);
	gtk_widget_set_size_request(sw,-1, 140);

	/* "Close this window when all transfers finish" */
	checkbox = gtk_check_button_new_with_mnemonic(
			_("Close this window when all transfers _finish"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox),
								 !dialog->keep_open);
	g_signal_connect(G_OBJECT(checkbox), "toggled",
					 G_CALLBACK(toggle_keep_open_cb), dialog);
	gtk_box_pack_start(GTK_BOX(vbox2), checkbox, FALSE, FALSE, 0);
	gtk_widget_show(checkbox);

	/* "Clear finished transfers" */
	checkbox = gtk_check_button_new_with_mnemonic(
			_("C_lear finished transfers"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox),
								 dialog->auto_clear);
	g_signal_connect(G_OBJECT(checkbox), "toggled",
					 G_CALLBACK(toggle_clear_finished_cb), dialog);
	gtk_box_pack_start(GTK_BOX(vbox2), checkbox, FALSE, FALSE, 0);
	gtk_widget_show(checkbox);

	/* "Download Details" arrow */
	expander = gtk_expander_new_with_mnemonic(_("File transfer _details"));
	dialog->expander = expander;
	gtk_box_pack_start(GTK_BOX(vbox2), expander, FALSE, FALSE, 0);
	gtk_widget_show(expander);

	gtk_widget_set_sensitive(expander, FALSE);

	/* The table of information. */
	table = make_info_table(dialog);
	gtk_container_add(GTK_CONTAINER(expander), table);
	gtk_widget_show(table);

	/* Open button */
	button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_OPEN, G_CALLBACK(open_button_cb), dialog);
	gtk_widget_set_sensitive(button, FALSE);
	dialog->open_button = button;

	/* Remove button */
	button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_REMOVE, G_CALLBACK(remove_button_cb), dialog);
	gtk_widget_hide(button);
	dialog->remove_button = button;

	/* Stop button */
	button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_STOP, G_CALLBACK(stop_button_cb), dialog);
	gtk_widget_set_sensitive(button, FALSE);
	dialog->stop_button = button;

	/* Close button */
	button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CLOSE, G_CALLBACK(close_button_cb), dialog);
	dialog->close_button = button;

#ifdef _WIN32
	g_signal_connect(G_OBJECT(dialog->window), "show",
		G_CALLBACK(winpidgin_ensure_onscreen), dialog->window);
#endif

	return dialog;
}
Beispiel #17
0
void DisplayDialog()
{
    GtkWidget *dialog;
    int return_value;

    GtkWidget *msg_box, *log_box, *dump_box, *main_box;
    GtkWidget *msg_frame, *log_frame, *dump_frame, *main_frame;

    GtkWidget *msg_console_check, *msg_key_check, *msg_voice_check, *msg_dma_check;
    GtkWidget *msg_autodma_check, *msg_overrun_check, *msg_cache_check;

    GtkWidget *log_access_check, *log_dma_check, *log_wave_check;
    GtkWidget *dump_core_check, *dump_mem_check, *dump_reg_check;

	ReadSettings();

    // Create the widgets
    dialog = gtk_dialog_new_with_buttons (
		"Spu2-X Config",
		NULL, // parent window
		(GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
		"OK", GTK_RESPONSE_ACCEPT,
		"Cancel", GTK_RESPONSE_REJECT,
		NULL);

    main_box = gtk_hbox_new(false, 5);
    main_frame = gtk_frame_new ("Spu2-X Config");
    gtk_container_add (GTK_CONTAINER(main_frame), main_box);

    // Message Section

    msg_box =  gtk_vbox_new(false, 5);

	msg_console_check = gtk_check_button_new_with_label("Show In Console");
    msg_key_check = gtk_check_button_new_with_label("KeyOn/Off Events");
    msg_voice_check = gtk_check_button_new_with_label("Voice Stop Events");
    msg_dma_check = gtk_check_button_new_with_label("DMA Operations");
    msg_autodma_check = gtk_check_button_new_with_label("AutoDMA Operations");
    msg_overrun_check = gtk_check_button_new_with_label("Buffer Over/Underruns");
    msg_cache_check = gtk_check_button_new_with_label("ADPCM Cache Statistics");

	gtk_container_add(GTK_CONTAINER(msg_box), msg_console_check);
	gtk_container_add(GTK_CONTAINER(msg_box), msg_key_check);
	gtk_container_add(GTK_CONTAINER(msg_box), msg_voice_check);
	gtk_container_add(GTK_CONTAINER(msg_box), msg_dma_check);
	gtk_container_add(GTK_CONTAINER(msg_box), msg_autodma_check);
	gtk_container_add(GTK_CONTAINER(msg_box), msg_overrun_check);
	gtk_container_add(GTK_CONTAINER(msg_box), msg_cache_check);

    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_console_check), _MsgToConsole);
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_key_check), _MsgKeyOnOff);
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_voice_check), _MsgVoiceOff);
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_dma_check), _MsgDMA);
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_autodma_check), _MsgAutoDMA);
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_overrun_check), _MsgOverruns);
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_cache_check), _MsgCache);

    msg_frame = gtk_frame_new ("Message/Log Options");
    gtk_container_add (GTK_CONTAINER(msg_frame), msg_box);

    // Log Section
    log_box =  gtk_vbox_new(false, 5);

    log_access_check = gtk_check_button_new_with_label("Log Register/DMA Actions");
    log_dma_check = gtk_check_button_new_with_label("Log DMA Writes");
    log_wave_check = gtk_check_button_new_with_label("Log Audio Output");

	gtk_container_add(GTK_CONTAINER(log_box), log_access_check);
	gtk_container_add(GTK_CONTAINER(log_box), log_dma_check);
	gtk_container_add(GTK_CONTAINER(log_box), log_wave_check);

    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(log_access_check), _AccessLog);
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(log_dma_check), _DMALog);
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(log_wave_check), _WaveLog);

    log_frame = gtk_frame_new ("Log Options");
    gtk_container_add (GTK_CONTAINER(log_frame), log_box);

    // Dump Section
    dump_box = gtk_vbox_new(false, 5);

    dump_core_check = gtk_check_button_new_with_label("Dump Core and Voice State");
    dump_mem_check = gtk_check_button_new_with_label("Dump Memory Contents");
    dump_reg_check = gtk_check_button_new_with_label("Dump Register Data");

	gtk_container_add(GTK_CONTAINER(dump_box), dump_core_check);
	gtk_container_add(GTK_CONTAINER(dump_box), dump_mem_check);
	gtk_container_add(GTK_CONTAINER(dump_box), dump_reg_check);

    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dump_core_check), _CoresDump);
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dump_mem_check), _MemDump);
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dump_reg_check), _RegDump);

    dump_frame = gtk_frame_new ("Dumps (on close)");
    gtk_container_add (GTK_CONTAINER(dump_frame), dump_box);

    // Add everything

    gtk_container_add (GTK_CONTAINER(main_box), msg_frame);
    gtk_container_add (GTK_CONTAINER(main_box), log_frame);
    gtk_container_add (GTK_CONTAINER(main_box), dump_frame);

    // Add all our widgets, and show everything we've added to the dialog.
    gtk_container_add (GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), main_frame);
    gtk_widget_show_all (dialog);

    return_value = gtk_dialog_run (GTK_DIALOG (dialog));

    if (return_value == GTK_RESPONSE_ACCEPT)
    {
		_MsgToConsole = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_console_check));
		_MsgKeyOnOff = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_key_check));
		_MsgVoiceOff = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_voice_check));
		_MsgDMA = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_dma_check));
		_MsgAutoDMA = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_autodma_check));
		_MsgOverruns = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_overrun_check));
		_MsgCache = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_cache_check));

		_AccessLog = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(log_access_check));
		_DMALog = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(log_dma_check));
		_WaveLog = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(log_wave_check));

		_CoresDump = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dump_core_check));
		_MemDump = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dump_mem_check));
		_RegDump = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dump_reg_check));
    }

    gtk_widget_destroy (dialog);

    WriteSettings();
}
Beispiel #18
0
static void * file_configure (void)
{
        GtkWidget * configure_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);

        GtkWidget * fileext_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
        gtk_box_pack_start(GTK_BOX(configure_vbox), fileext_hbox, FALSE, FALSE, 0);

        GtkWidget * fileext_label = gtk_label_new (_("Output file format:"));
        gtk_box_pack_start(GTK_BOX(fileext_hbox), fileext_label, FALSE, FALSE, 0);

        fileext_combo = gtk_combo_box_text_new ();
        gtk_combo_box_text_append_text ((GtkComboBoxText *) fileext_combo, "WAV");
#ifdef FILEWRITER_MP3
        gtk_combo_box_text_append_text ((GtkComboBoxText *) fileext_combo, "MP3");
#endif
#ifdef FILEWRITER_VORBIS
        gtk_combo_box_text_append_text ((GtkComboBoxText *) fileext_combo, "Vorbis");
#endif
#ifdef FILEWRITER_FLAC
        gtk_combo_box_text_append_text ((GtkComboBoxText *) fileext_combo, "FLAC");
#endif
        gtk_box_pack_start(GTK_BOX(fileext_hbox), fileext_combo, FALSE, FALSE, 0);
        gtk_combo_box_set_active(GTK_COMBO_BOX(fileext_combo), fileext);

        plugin_button = gtk_button_new_with_label(_("Configure"));
        gtk_widget_set_sensitive(plugin_button, plugin->configure != NULL);
        gtk_box_pack_end(GTK_BOX(fileext_hbox), plugin_button, FALSE, FALSE, 0);

        gtk_box_pack_start(GTK_BOX(configure_vbox), gtk_separator_new(GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, 0);

        GtkWidget * saveplace_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
        gtk_container_add(GTK_CONTAINER(configure_vbox), saveplace_hbox);

        GtkWidget * saveplace1 = gtk_radio_button_new_with_label (NULL,
         _("Save into original directory"));
        gtk_box_pack_start ((GtkBox *) saveplace_hbox, saveplace1, FALSE, FALSE, 0);

        GtkWidget * saveplace2 = gtk_radio_button_new_with_label_from_widget
         ((GtkRadioButton *) saveplace1, _("Save into custom directory"));

        if (!save_original)
            gtk_toggle_button_set_active ((GtkToggleButton *) saveplace2, TRUE);

        gtk_box_pack_start ((GtkBox *) saveplace_hbox, saveplace2, FALSE, FALSE, 0);

        path_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
        gtk_box_pack_start(GTK_BOX(configure_vbox), path_hbox, FALSE, FALSE, 0);

        GtkWidget * path_label = gtk_label_new (_("Output file folder:"));
        gtk_box_pack_start ((GtkBox *) path_hbox, path_label, FALSE, FALSE, 0);

        path_dirbrowser =
            gtk_file_chooser_button_new (_("Pick a folder"),
                                         GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
        gtk_file_chooser_set_uri ((GtkFileChooser *) path_dirbrowser, file_path);
        gtk_box_pack_start(GTK_BOX(path_hbox), path_dirbrowser, TRUE, TRUE, 0);

        if (save_original)
            gtk_widget_set_sensitive(path_hbox, FALSE);

        gtk_box_pack_start(GTK_BOX(configure_vbox), gtk_separator_new(GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, 0);

        filenamefrom_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
        gtk_container_add(GTK_CONTAINER(configure_vbox), filenamefrom_hbox);

        filenamefrom_label = gtk_label_new(_("Get filename from:"));
        gtk_box_pack_start(GTK_BOX(filenamefrom_hbox), filenamefrom_label, FALSE, FALSE, 0);

        GtkWidget * filenamefrom_toggle1 = gtk_radio_button_new_with_label
         (NULL, _("original file tags"));
        gtk_box_pack_start ((GtkBox *) filenamefrom_hbox, filenamefrom_toggle1, FALSE, FALSE, 0);

        GtkWidget * filenamefrom_toggle2 =
         gtk_radio_button_new_with_label_from_widget
         ((GtkRadioButton *) filenamefrom_toggle1, _("original filename"));
        gtk_box_pack_start ((GtkBox *) filenamefrom_hbox, filenamefrom_toggle2, FALSE, FALSE, 0);

        if (!filenamefromtags)
            gtk_toggle_button_set_active ((GtkToggleButton *) filenamefrom_toggle2, TRUE);

        use_suffix_toggle = gtk_check_button_new_with_label(_("Don't strip file name extension"));
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(use_suffix_toggle), use_suffix);
        gtk_box_pack_start(GTK_BOX(configure_vbox), use_suffix_toggle, FALSE, FALSE, 0);

        if (filenamefromtags)
            gtk_widget_set_sensitive(use_suffix_toggle, FALSE);

        gtk_box_pack_start(GTK_BOX(configure_vbox), gtk_separator_new(GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, 0);

        prependnumber_toggle = gtk_check_button_new_with_label(_("Prepend track number to filename"));
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prependnumber_toggle), prependnumber);
        gtk_box_pack_start(GTK_BOX(configure_vbox), prependnumber_toggle, FALSE, FALSE, 0);

        g_signal_connect (fileext_combo, "changed", (GCallback) fileext_cb, NULL);
        g_signal_connect (plugin_button, "clicked", (GCallback) plugin_configure_cb, NULL);
        g_signal_connect (saveplace1, "toggled", (GCallback) saveplace_original_cb, NULL);
        g_signal_connect (saveplace2, "toggled", (GCallback) saveplace_custom_cb, NULL);
        g_signal_connect (filenamefrom_toggle1, "toggled", (GCallback) filenamefromtags_cb, NULL);
        g_signal_connect (filenamefrom_toggle2, "toggled",
         (GCallback) filenamefromfilename_cb, NULL);

        return configure_vbox;
}
Beispiel #19
0
/**
 * fm_app_chooser_dlg_new
 * @mime_type: (allow-none): MIME type for list creation
 * @can_set_default: %TRUE if widget can set selected item as default for @mime_type
 *
 * Creates a widget for choosing an application either from tree of
 * existing ones or also allows to set up own command for it.
 *
 * Returns: (transfer full): a widget.
 *
 * Since: 0.1.0
 */
GtkDialog *fm_app_chooser_dlg_new(FmMimeType* mime_type, gboolean can_set_default)
{
    GtkContainer* scroll;
    GtkLabel *file_type, *file_type_header;
    GtkTreeSelection* tree_sel;
    GtkBuilder* builder = gtk_builder_new();
    AppChooserData* data = g_slice_new0(AppChooserData);

    gtk_builder_set_translation_domain(builder, GETTEXT_PACKAGE);
    gtk_builder_add_from_file(builder, PACKAGE_UI_DIR "/app-chooser.ui", NULL);
    data->dlg = GTK_DIALOG(gtk_builder_get_object(builder, "dlg"));
    data->notebook = GTK_NOTEBOOK(gtk_builder_get_object(builder, "notebook"));
    scroll = GTK_CONTAINER(gtk_builder_get_object(builder, "apps_scroll"));
    file_type = GTK_LABEL(gtk_builder_get_object(builder, "file_type"));
    file_type_header = GTK_LABEL(gtk_builder_get_object(builder, "file_type_header"));
    data->cmdline = GTK_ENTRY(gtk_builder_get_object(builder, "cmdline"));
    data->set_default = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "set_default"));
    data->use_terminal = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "use_terminal"));
    data->keep_open = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "keep_open"));
    data->browse_btn = GTK_WIDGET(gtk_builder_get_object(builder, "browse_btn"));
    data->app_name = GTK_ENTRY(gtk_builder_get_object(builder, "app_name"));
    /* FIXME: shouldn't verify if app-chooser.ui was correct? */
    if(mime_type)
        data->mime_type = fm_mime_type_ref(mime_type);

    gtk_dialog_set_alternative_button_order(data->dlg, GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1);

    if(!can_set_default)
        gtk_widget_hide(GTK_WIDGET(data->set_default));

    if(mime_type && fm_mime_type_get_desc(mime_type))
    {
        if (file_type_header)
        {
            char *text = g_strdup_printf(_("<b>Select an application to open \"%s\" files</b>"),
                                         fm_mime_type_get_desc(mime_type));
            gtk_label_set_markup(file_type_header, text);
            g_free(text);
        }
        else
            gtk_label_set_text(file_type, fm_mime_type_get_desc(mime_type));
    }
    else
    {
        GtkWidget* hbox = GTK_WIDGET(gtk_builder_get_object(builder, "file_type_hbox"));
        gtk_widget_destroy(hbox);
        gtk_widget_hide(GTK_WIDGET(data->set_default));
    }

    data->apps_view = fm_app_menu_view_new();
    gtk_tree_view_set_headers_visible(data->apps_view, FALSE);
    gtk_widget_show(GTK_WIDGET(data->apps_view));
    gtk_container_add(scroll, GTK_WIDGET(data->apps_view));
    gtk_widget_grab_focus(GTK_WIDGET(data->apps_view));

    g_object_unref(builder);

    g_signal_connect(data->browse_btn, "clicked", G_CALLBACK(on_browse_btn_clicked), data);

    g_object_set_qdata_full(G_OBJECT(data->dlg), fm_qdata_id, data, (GDestroyNotify)on_dlg_destroy);
    g_signal_connect(data->notebook, "switch-page", G_CALLBACK(on_switch_page), data);
    on_switch_page(data->notebook, NULL, 0, data);
    tree_sel = gtk_tree_view_get_selection(data->apps_view);
    g_signal_connect(tree_sel, "changed", G_CALLBACK(on_apps_view_sel_changed), data);
    g_signal_connect(data->cmdline, "changed", G_CALLBACK(on_cmdline_changed), data);
    g_signal_connect(data->use_terminal, "toggled", G_CALLBACK(on_use_terminal_changed), data);
    gtk_dialog_set_response_sensitive(data->dlg, GTK_RESPONSE_OK, FALSE);

    return data->dlg;
}
Beispiel #20
0
void
on_startupactionbtn_toggled (GtkButton *button, gpointer user_data)
{
	gboolean enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
	conf_set_int_value (STARTUP_FEED_ACTION, enabled?0:1);
}
Beispiel #21
0
static void
file_entry_directory_toggle(GtkWidget *w, GnomeFileEntry *fentry)
{
	gnome_file_entry_set_directory_entry (fentry,GTK_TOGGLE_BUTTON(w)->active);
}
Beispiel #22
0
void
preferences_dialog_init (PreferencesDialog *pd)
{
	GtkWidget		*widget, *entry;
	GtkComboBox		*combo;
	GtkListStore		*store;
	GtkTreeIter		treeiter;
	GtkAdjustment		*itemCount;
	GtkTreeStore		*treestore;
	GtkTreeViewColumn 	*column;
	GSList			*list;
	gchar			*proxyport;
	gchar			*configuredBrowser, *name;
	gboolean		enabled;
	static int		manual;
	struct browser		*iter;
	gint			tmp, i, iSetting, proxy_port;
	gboolean		bSetting;
	gchar			*proxy_host, *proxy_user, *proxy_passwd;
	gchar			*browser_command;
	
	prefdialog = pd;
	pd->priv = PREFERENCES_DIALOG_GET_PRIVATE (pd);
	pd->priv->dialog = liferea_dialog_new ("prefs.ui", "prefdialog");

	/* Set up browser selection popup */
	store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
	for(i = 0, iter = browser_get_all (); iter->id != NULL; iter++, i++) {
		gtk_list_store_append (store, &treeiter);
		gtk_list_store_set (store, &treeiter, 0, _(iter->display), 1, i, -1);
	}
	manual = i;
	/* This allows the user to choose their own browser by typing in the command. */
	gtk_list_store_append (store, &treeiter);
	gtk_list_store_set (store, &treeiter, 0, _("Manual"), 1, i, -1);
	combo = GTK_COMBO_BOX (liferea_dialog_lookup (pd->priv->dialog, "browserpopup"));
	gtk_combo_box_set_model (combo, GTK_TREE_MODEL (store));
	ui_common_setup_combo_text (combo, 0);
	g_signal_connect(G_OBJECT(combo), "changed", G_CALLBACK(on_browser_changed), pd);

	/* Create location menu */
	store = gtk_list_store_new (1, G_TYPE_STRING);

	combo = GTK_COMBO_BOX (liferea_dialog_lookup (pd->priv->dialog, "browserlocpopup"));
	gtk_combo_box_set_model (combo, GTK_TREE_MODEL (store));
	ui_common_setup_combo_text (combo, 0);
	g_signal_connect(G_OBJECT(combo), "changed", G_CALLBACK(on_browser_place_changed), pd);

	gtk_list_store_append (store, &treeiter);
	gtk_list_store_set (store, &treeiter, 0, _("Browser default"), -1);

	gtk_list_store_append (store, &treeiter);
	gtk_list_store_set (store, &treeiter, 0, _("Existing window"), -1);

	gtk_list_store_append (store, &treeiter);
	gtk_list_store_set (store, &treeiter, 0, _("New window"), -1);

	gtk_list_store_append (store, &treeiter);
	gtk_list_store_set (store, &treeiter, 0, _("New tab"), -1);


	/* ================== panel 1 "feeds" ==================== */

	/* check box for feed startup update */
	conf_get_int_value (STARTUP_FEED_ACTION, &iSetting);
	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (liferea_dialog_lookup (pd->priv->dialog, "startupactionbtn")), (iSetting == 0)); 

	/* cache size setting */
	widget = liferea_dialog_lookup (pd->priv->dialog, "itemCountBtn");
	itemCount = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget));
	conf_get_int_value (DEFAULT_MAX_ITEMS, &iSetting);
	gtk_adjustment_set_value (itemCount, iSetting);

	/* set default update interval spin button and unit combo box */
	ui_common_setup_combo_menu (liferea_dialog_lookup (pd->priv->dialog, "globalRefreshIntervalUnitComboBox"),
	                            default_update_interval_unit_options,
	                            G_CALLBACK (on_default_update_interval_unit_changed),
				    -1);
				   
	widget = liferea_dialog_lookup (pd->priv->dialog, "globalRefreshIntervalUnitComboBox");
	conf_get_int_value (DEFAULT_UPDATE_INTERVAL, &tmp);
	if (tmp % 1440 == 0) {		/* days */
		gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 2);
		tmp /= 1440;
	} else if (tmp % 60 == 0) {	/* hours */
		gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 1);
		tmp /= 60;
	} else {			/* minutes */
		gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
	}
	widget = liferea_dialog_lookup (pd->priv->dialog,"globalRefreshIntervalSpinButton");
	gtk_spin_button_set_range (GTK_SPIN_BUTTON (widget), 0, 1000000000);
	gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), tmp);
	g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (on_default_update_interval_value_changed), pd);

	/* ================== panel 2 "folders" ==================== */

	g_signal_connect (G_OBJECT (liferea_dialog_lookup (pd->priv->dialog, "updateAllFavicons")), "clicked", G_CALLBACK(on_updateallfavicons_clicked), pd);

	conf_get_int_value (FOLDER_DISPLAY_MODE, &iSetting);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (liferea_dialog_lookup (pd->priv->dialog, "folderdisplaybtn")), iSetting?TRUE:FALSE);
	conf_get_bool_value (FOLDER_DISPLAY_HIDE_READ, &bSetting);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (liferea_dialog_lookup (pd->priv->dialog, "hidereadbtn")), bSetting?TRUE:FALSE);

	/* ================== panel 3 "headlines" ==================== */

	conf_get_int_value (BROWSE_KEY_SETTING, &iSetting);
	ui_common_setup_combo_menu (liferea_dialog_lookup (pd->priv->dialog, "skimKeyCombo"),
	                            browser_skim_key_options,
	                            G_CALLBACK (on_skim_key_changed),
	                            iSetting);

	conf_get_int_value (DEFAULT_VIEW_MODE, &iSetting);
	ui_common_setup_combo_menu (liferea_dialog_lookup (pd->priv->dialog, "defaultViewModeCombo"),
	                            default_view_mode_options,
	                            G_CALLBACK (on_default_view_mode_changed),
	                            iSetting);
				  
	/* Setup social bookmarking list */
	i = 0;
	conf_get_str_value (SOCIAL_BM_SITE, &name);
	store = gtk_list_store_new (1, G_TYPE_STRING);
	list = bookmarkSites;
	while (list) {
		socialSitePtr siter = list->data;
		if (name && !strcmp (siter->name, name))
			tmp = i;
		gtk_list_store_append (store, &treeiter);
		gtk_list_store_set (store, &treeiter, 0, siter->name, -1);
		list = g_slist_next (list);
		i++;
	}

	combo = GTK_COMBO_BOX (liferea_dialog_lookup (pd->priv->dialog, "socialpopup"));
	g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (on_socialsite_changed), pd);
	gtk_combo_box_set_model (combo, GTK_TREE_MODEL (store));
	ui_common_setup_combo_text (combo, 0);
	gtk_combo_box_set_active (combo, tmp);

	/* ================== panel 4 "browser" ==================== */

	/* set the inside browsing flag */
	widget = liferea_dialog_lookup(pd->priv->dialog, "browseinwindow");
	conf_get_bool_value(BROWSE_INSIDE_APPLICATION, &bSetting);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), bSetting);

	/* set the javascript-disabled flag */
	widget = liferea_dialog_lookup(pd->priv->dialog, "disablejavascript");
	conf_get_bool_value(DISABLE_JAVASCRIPT, &bSetting);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), bSetting);
	
	/* set the enable Plugins flag */
	widget = liferea_dialog_lookup(pd->priv->dialog, "enableplugins");
	conf_get_bool_value(ENABLE_PLUGINS, &bSetting);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), bSetting);

	tmp = 0;
	conf_get_str_value(BROWSER_ID, &configuredBrowser);

	if(!strcmp(configuredBrowser, "manual"))
		tmp = manual;
	else
		for(i=0, iter = browser_get_all (); iter->id != NULL; iter++, i++)
			if(!strcmp(configuredBrowser, iter->id))
				tmp = i;

	gtk_combo_box_set_active(GTK_COMBO_BOX(liferea_dialog_lookup(pd->priv->dialog, "browserpopup")), tmp);
	g_free(configuredBrowser);

	conf_get_int_value (BROWSER_PLACE, &iSetting);
	gtk_combo_box_set_active(GTK_COMBO_BOX(liferea_dialog_lookup(pd->priv->dialog, "browserlocpopup")), iSetting);

	conf_get_str_value (BROWSER_COMMAND, &browser_command);
	entry = liferea_dialog_lookup(pd->priv->dialog, "browsercmd");
	gtk_entry_set_text(GTK_ENTRY(entry), browser_command);
	g_free (browser_command);

	gtk_widget_set_sensitive (GTK_WIDGET (entry), tmp == manual);
	gtk_widget_set_sensitive (liferea_dialog_lookup (pd->priv->dialog, "manuallabel"), tmp == manual);	
	gtk_widget_set_sensitive (liferea_dialog_lookup (pd->priv->dialog, "urlhintlabel"), tmp == manual);

	/* ================== panel 4 "GUI" ================ */

	/* tool bar settings */	
	widget = liferea_dialog_lookup (pd->priv->dialog, "hidetoolbarbtn");
	conf_get_bool_value(DISABLE_TOOLBAR, &bSetting);
	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), bSetting);

	/* select currently active toolbar style option */
	conf_get_str_value (TOOLBAR_STYLE, &name);
	for (i = 0; gui_toolbar_style_values[i] != NULL; ++i) {
		if (strcmp (name, gui_toolbar_style_values[i]) == 0)
			break;
	}
	g_free (name);

	/* On invalid key value: revert to default */
	if (gui_toolbar_style_values[i] == NULL)
		i = 0;

	/* create toolbar style menu */
	ui_common_setup_combo_menu (liferea_dialog_lookup (pd->priv->dialog, "toolbarCombo"),
	                            gui_toolbar_style_options,
	                            G_CALLBACK (on_gui_toolbar_style_changed),
	                            i);

	/* ================= panel 5 "proxy" ======================== */
	conf_get_str_value (PROXY_HOST, &proxy_host);
	gtk_entry_set_text (GTK_ENTRY (liferea_dialog_lookup (pd->priv->dialog, "proxyhostentry")), proxy_host);
	g_free (proxy_host);

	conf_get_int_value (PROXY_PORT, &proxy_port);
	proxyport = g_strdup_printf ("%d", proxy_port);
	gtk_entry_set_text (GTK_ENTRY (liferea_dialog_lookup (pd->priv->dialog, "proxyportentry")), proxyport);
	g_free (proxyport);

	conf_get_bool_value (PROXY_USEAUTH, &enabled);
	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (liferea_dialog_lookup (pd->priv->dialog, "useProxyAuth")), enabled);

	conf_get_str_value (PROXY_USER, &proxy_user);
	gtk_entry_set_text (GTK_ENTRY (liferea_dialog_lookup (pd->priv->dialog, "proxyusernameentry")), proxy_user);
	g_free (proxy_user);

	conf_get_str_value (PROXY_PASSWD, &proxy_passwd);
	gtk_entry_set_text (GTK_ENTRY (liferea_dialog_lookup (pd->priv->dialog, "proxypasswordentry")), proxy_passwd);
	g_free (proxy_passwd);

	gtk_widget_set_sensitive (GTK_WIDGET (liferea_dialog_lookup(pd->priv->dialog, "proxyauthtable")), enabled);
		
	conf_get_int_value (PROXY_DETECT_MODE, &i);
	switch (i) {
		default:
		case 0: /* proxy auto detect */
			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (liferea_dialog_lookup (pd->priv->dialog, "proxyAutoDetectRadio")), TRUE);
			enabled = FALSE;
			break;
		case 1: /* no proxy */
			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (liferea_dialog_lookup (pd->priv->dialog, "noProxyRadio")), TRUE);
			enabled = FALSE;
			break;
		case 2: /* manual proxy */
			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (liferea_dialog_lookup (pd->priv->dialog, "manualProxyRadio")), TRUE);
			enabled = TRUE;
			break;
	}
	gtk_widget_set_sensitive (GTK_WIDGET (liferea_dialog_lookup (pd->priv->dialog, "proxybox")), enabled);
	g_signal_connect (G_OBJECT (liferea_dialog_lookup (pd->priv->dialog, "proxyAutoDetectRadio")), "clicked", G_CALLBACK (on_proxyAutoDetect_clicked), pd);
	g_signal_connect (G_OBJECT (liferea_dialog_lookup (pd->priv->dialog, "noProxyRadio")), "clicked", G_CALLBACK (on_noProxy_clicked), pd);
	g_signal_connect (G_OBJECT (liferea_dialog_lookup (pd->priv->dialog, "manualProxyRadio")), "clicked", G_CALLBACK (on_manualProxy_clicked), pd);
	g_signal_connect (G_OBJECT (liferea_dialog_lookup (pd->priv->dialog, "proxyhostentry")), "changed", G_CALLBACK (on_proxyhostentry_changed), pd);
	g_signal_connect (G_OBJECT (liferea_dialog_lookup (pd->priv->dialog, "proxyportentry")), "changed", G_CALLBACK (on_proxyportentry_changed), pd);
	g_signal_connect (G_OBJECT (liferea_dialog_lookup (pd->priv->dialog, "proxyusernameentry")), "changed", G_CALLBACK (on_proxyusernameentry_changed), pd);
	g_signal_connect (G_OBJECT (liferea_dialog_lookup (pd->priv->dialog, "proxypasswordentry")), "changed", G_CALLBACK (on_proxypasswordentry_changed), pd);

	/* ================= panel 6 "Enclosures" ======================== */

	/* menu for download tool */
	conf_get_int_value (DOWNLOAD_TOOL, &iSetting);
	ui_common_setup_combo_menu (liferea_dialog_lookup (pd->priv->dialog, "downloadToolCombo"),
	                            enclosure_download_tool_options,
	                            G_CALLBACK (on_enclosure_download_tool_changed),
	                            iSetting);

	/* set up list of configured enclosure types */
	treestore = gtk_tree_store_new (FTS_LEN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
	list = (GSList *)enclosure_mime_types_get ();
	while (list) {
		GtkTreeIter *newIter = g_new0 (GtkTreeIter, 1);
		gtk_tree_store_append (treestore, newIter, NULL);
		gtk_tree_store_set (treestore, newIter,
	                	    FTS_TYPE, (NULL != ((encTypePtr)(list->data))->mime)?((encTypePtr)(list->data))->mime:((encTypePtr)(list->data))->extension, 
	                	    FTS_CMD, ((encTypePtr)(list->data))->cmd,
	                	    FTS_PTR, list->data, 
				    -1);
		list = g_slist_next (list);
	}

	widget = liferea_dialog_lookup (pd->priv->dialog, "enc_action_view");
	gtk_tree_view_set_model (GTK_TREE_VIEW (widget), GTK_TREE_MODEL (treestore));

	column = gtk_tree_view_column_new_with_attributes (_("Type"), gtk_cell_renderer_text_new (), "text", FTS_TYPE, NULL);
	gtk_tree_view_append_column (GTK_TREE_VIEW (widget), column);
	gtk_tree_view_column_set_sort_column_id (column, FTS_TYPE);
	column = gtk_tree_view_column_new_with_attributes (_("Program"), gtk_cell_renderer_text_new (), "text", FTS_CMD, NULL);
	gtk_tree_view_column_set_sort_column_id (column, FTS_CMD);
	gtk_tree_view_append_column (GTK_TREE_VIEW(widget), column);

	gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW(widget)), GTK_SELECTION_SINGLE);

	/* ================= panel 7 "Plugins" ======================== */

	pd->priv->plugins_box = liferea_dialog_lookup (pd->priv->dialog, "plugins_box");
	g_assert (pd->priv->plugins_box != NULL);

	GtkWidget *alignment;

	alignment = gtk_alignment_new (0., 0., 1., 1.);
	gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 12, 12, 12, 12);

	widget = peas_gtk_plugin_manager_new (NULL);
	g_assert (widget != NULL);

	gtk_container_add (GTK_CONTAINER (alignment), widget);
	gtk_box_pack_start (GTK_BOX (pd->priv->plugins_box), alignment, TRUE, TRUE, 0);

	g_signal_connect_object (pd->priv->dialog, "destroy", G_CALLBACK (preferences_dialog_destroy_cb), pd, 0);

	gtk_widget_show_all (pd->priv->dialog);

	gtk_window_present (GTK_WINDOW (pd->priv->dialog));
}
static void
refresh_widget (NemoExtensionConfigWidget *widget)
{
    if (widget->current_extensions != NULL) {
        g_list_free_full (widget->current_extensions, (GDestroyNotify) extension_proxy_free);
        widget->current_extensions = NULL;
    }

    nemo_config_base_widget_clear_list (NEMO_CONFIG_BASE_WIDGET (widget));

    detect_extensions (widget);

    if (widget->current_extensions == NULL) {
        GtkWidget *empty_label = gtk_label_new (NULL);
        gchar *markup = NULL;

        markup = g_strdup_printf ("<i>%s</i>", _("No extensions found"));

        gtk_label_set_markup (GTK_LABEL (empty_label), markup);
        g_free (markup);

        GtkWidget *empty_row = gtk_list_box_row_new ();
        gtk_container_add (GTK_CONTAINER (empty_row), empty_label);

        gtk_widget_show_all (empty_row);
        gtk_container_add (GTK_CONTAINER (NEMO_CONFIG_BASE_WIDGET (widget)->listbox), empty_row);
    } else {
        GList *l;
        gchar **blacklist = g_settings_get_strv (widget->settings, BLACKLIST_KEY);

        for (l = widget->current_extensions; l != NULL; l=l->next) {
            ExtensionProxy *proxy = l->data;

            gboolean active = TRUE;
            gint i = 0;

            for (i = 0; i < g_strv_length (blacklist); i++) {
                if (g_strcmp0 (blacklist[i], proxy->name) == 0) {
                    active = FALSE;
                    break;
                }
            }

            GtkWidget *w;
            GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);

            GtkWidget *button = gtk_check_button_new ();

            gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), active);
            g_signal_connect (button, "toggled", G_CALLBACK (on_check_toggled), proxy);
            gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 2);

            w = gtk_label_new (NULL);
            gchar *markup = NULL;

            if (proxy->display_name == NULL)
                markup = g_strdup_printf ("%s - <i>%s</i>", proxy->name, _("no information available"));
            else
                markup = g_strdup_printf ("%s - <i>%s</i>", proxy->display_name, proxy->desc);

            gtk_label_set_markup (GTK_LABEL (w), markup);
            g_free (markup);

            gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 2);

            GtkWidget *row = gtk_list_box_row_new ();
            gtk_container_add (GTK_CONTAINER (row), box);

            gtk_widget_show_all (row);
            gtk_container_add (GTK_CONTAINER (NEMO_CONFIG_BASE_WIDGET (widget)->listbox), row);
        }

        g_strfreev (blacklist);
    }

    update_restart_visiblity (widget);
    nemo_config_base_widget_set_default_buttons_sensitive (NEMO_CONFIG_BASE_WIDGET (widget), widget->current_extensions != NULL);
}
Beispiel #24
0
void gui_init(dt_lib_module_t *self)
{
  unsigned int i;

  GtkWidget *container = gtk_vbox_new(FALSE, 5);
  GtkWidget *output_row = gtk_hbox_new(FALSE, 2);
  GtkWidget *output_options = gtk_vbox_new(FALSE, 5);
  GtkWidget *picker_subrow = gtk_hbox_new(FALSE, 2);
  GtkWidget *restrict_button;
  GtkWidget *samples_label = dtgtk_label_new(_("live samples"),
                             DARKTABLE_LABEL_TAB
                             | DARKTABLE_LABEL_ALIGN_RIGHT);
  GtkWidget *samples_options_row = gtk_hbox_new(FALSE, 2);

  // Initializing self data structure
  dt_lib_colorpicker_t *data =
    (dt_lib_colorpicker_t*)malloc(sizeof(dt_lib_colorpicker_t));
  self->data = (void*)data;
  memset(data, 0, sizeof(dt_lib_colorpicker_t));

  // Initializing proxy functions and data
  darktable.lib->proxy.colorpicker.module = self;
  darktable.lib->proxy.colorpicker.size =
    dt_conf_get_int("ui_last/colorpicker_size");
  darktable.lib->proxy.colorpicker.display_samples =
    dt_conf_get_int("ui_last/colorpicker_display_samples");
  darktable.lib->proxy.colorpicker.live_samples = NULL;
  darktable.lib->proxy.colorpicker.picked_color_rgb_mean =
    (uint8_t*)malloc(sizeof(uint8_t) * 3);
  darktable.lib->proxy.colorpicker.picked_color_rgb_min =
    (uint8_t*)malloc(sizeof(uint8_t) * 3);
  darktable.lib->proxy.colorpicker.picked_color_rgb_max =
    (uint8_t*)malloc(sizeof(uint8_t) * 3);
  darktable.lib->proxy.colorpicker.picked_color_lab_mean =
    (float*)malloc(sizeof(float) * 3);
  darktable.lib->proxy.colorpicker.picked_color_lab_min =
    (float*)malloc(sizeof(float) * 3);
  darktable.lib->proxy.colorpicker.picked_color_lab_max =
    (float*)malloc(sizeof(float) * 3);
  for(i = 0; i < 3; i++)
    darktable.lib->proxy.colorpicker.picked_color_rgb_mean[i]
    = darktable.lib->proxy.colorpicker.picked_color_rgb_min[i]
      = darktable.lib->proxy.colorpicker.picked_color_rgb_max[i] = 0;
  for(i = 0; i < 3; i++)
    darktable.lib->proxy.colorpicker.picked_color_lab_mean[i]
    = darktable.lib->proxy.colorpicker.picked_color_lab_min[i]
      = darktable.lib->proxy.colorpicker.picked_color_lab_max[i] = 0;
  darktable.lib->proxy.colorpicker.update_panel =  _update_picker_output;
  darktable.lib->proxy.colorpicker.update_samples = _update_samples_output;
  darktable.lib->proxy.colorpicker.set_sample_area = _set_sample_area;
  darktable.lib->proxy.colorpicker.set_sample_point = _set_sample_point;

  // Setting up the GUI
  self->widget = container;
  gtk_box_pack_start(GTK_BOX(container), output_row, TRUE, TRUE, 0);

  // The output button
  data->output_button = dtgtk_button_new(NULL, CPF_STYLE_BOX);
  gtk_widget_set_size_request(data->output_button, 100, 100);
  gtk_widget_set_sensitive(data->output_button, FALSE);
  gtk_box_pack_start(GTK_BOX(output_row), data->output_button, FALSE, FALSE, 0);

  // The picker button, output selectors and label
  gtk_box_pack_start(GTK_BOX(output_row), output_options, TRUE, TRUE, 0);

  data->size_selector = gtk_combo_box_text_new();
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->size_selector),
                            _("point"));
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->size_selector),
                            _("area"));
  gtk_combo_box_set_active(GTK_COMBO_BOX(data->size_selector),
                           dt_conf_get_int("ui_last/colorpicker_size"));
  gtk_widget_set_size_request(data->size_selector, 30, -1);
  gtk_box_pack_start(GTK_BOX(picker_subrow), data->size_selector,
                     TRUE, TRUE, 0);

  g_signal_connect(G_OBJECT(data->size_selector), "changed",
                   G_CALLBACK(_size_changed), (gpointer)self);

  data->picker_button = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker,
                        CPF_STYLE_BOX);
  gtk_widget_set_size_request(data->picker_button, 50, -1);
  gtk_box_pack_start(GTK_BOX(picker_subrow), data->picker_button,
                     FALSE, FALSE, 0);

  g_signal_connect(G_OBJECT(data->picker_button), "toggled",
                   G_CALLBACK(_picker_button_toggled), self);

  gtk_box_pack_start(GTK_BOX(output_options), picker_subrow, TRUE, TRUE, 0);

  data->statistic_selector = gtk_combo_box_text_new();
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->statistic_selector),
                            _("mean"));
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->statistic_selector),
                            _("min"));
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->statistic_selector),
                            _("max"));
  gtk_combo_box_set_active(GTK_COMBO_BOX(data->statistic_selector),
                           dt_conf_get_int("ui_last/colorpicker_mode"));
  gtk_widget_set_sensitive(data->statistic_selector,
                           dt_conf_get_int("ui_last/colorpicker_size"));
  gtk_box_pack_start(GTK_BOX(output_options), data->statistic_selector,
                     TRUE, TRUE, 0);

  g_signal_connect(G_OBJECT(data->statistic_selector), "changed",
                   G_CALLBACK(_statistic_changed), self);

  data->color_mode_selector = gtk_combo_box_text_new();
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->color_mode_selector),
                            _("RGB"));
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->color_mode_selector),
                            _("Lab"));
  gtk_combo_box_set_active(GTK_COMBO_BOX(data->color_mode_selector),
                           dt_conf_get_int("ui_last/colorpicker_model"));
  gtk_box_pack_start(GTK_BOX(output_options), data->color_mode_selector,
                     TRUE, TRUE, 0);

  g_signal_connect(G_OBJECT(data->color_mode_selector), "changed",
                   G_CALLBACK(_color_mode_changed), self);

  data->output_label = gtk_label_new("");
  gtk_label_set_justify(GTK_LABEL(data->output_label), GTK_JUSTIFY_CENTER);
  gtk_widget_set_size_request(data->output_label, 80, -1);
  gtk_box_pack_start(GTK_BOX(output_options), data->output_label,
                     FALSE, FALSE, 0);

  restrict_button = gtk_check_button_new_with_label(
                      _("restrict histogram to selection"));
  gtk_toggle_button_set_active(
    GTK_TOGGLE_BUTTON(restrict_button),
    dt_conf_get_int("ui_last/colorpicker_restrict_histogram"));
  darktable.lib->proxy.colorpicker.restrict_histogram =
    dt_conf_get_int("ui_last/colorpicker_restrict_histogram");
  gtk_box_pack_start(GTK_BOX(container), restrict_button, TRUE, TRUE, 0);

  g_signal_connect(G_OBJECT(restrict_button), "toggled",
                   G_CALLBACK(_restrict_histogram_changed), NULL);

  // Adding the live samples section
  gtk_box_pack_start(GTK_BOX(container), samples_label, TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(container), samples_options_row, TRUE, TRUE, 0);

  data->samples_statistic_selector = gtk_combo_box_text_new();
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->samples_statistic_selector),
                            _("mean"));
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->samples_statistic_selector),
                            _("min"));
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->samples_statistic_selector),
                            _("max"));
  gtk_combo_box_set_active(GTK_COMBO_BOX(data->samples_statistic_selector),
                           dt_conf_get_int("ui_last/colorsamples_mode"));
  gtk_box_pack_start(GTK_BOX(samples_options_row),
                     data->samples_statistic_selector,
                     TRUE, TRUE, 0);

  g_signal_connect(G_OBJECT(data->samples_statistic_selector), "changed",
                   G_CALLBACK(_samples_statistic_changed), self);

  data->samples_mode_selector = gtk_combo_box_text_new();
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->samples_mode_selector),
                            _("RGB"));
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(data->samples_mode_selector),
                            _("Lab"));
  gtk_combo_box_set_active(GTK_COMBO_BOX(data->samples_mode_selector),
                           dt_conf_get_int("ui_last/colorsamples_model"));
  gtk_box_pack_start(GTK_BOX(samples_options_row), data->samples_mode_selector,
                     TRUE, TRUE, 0);

  g_signal_connect(G_OBJECT(data->samples_mode_selector), "changed",
                   G_CALLBACK(_samples_mode_changed), self);

  data->add_sample_button = gtk_button_new_from_stock(GTK_STOCK_ADD);
  gtk_widget_set_sensitive(data->add_sample_button, FALSE);
  gtk_box_pack_start(GTK_BOX(samples_options_row), data->add_sample_button,
                     FALSE, FALSE, 0);

  g_signal_connect(G_OBJECT(data->add_sample_button), "clicked",
                   G_CALLBACK(_add_sample), self);

  data->samples_container = gtk_vbox_new(FALSE, 2);
  gtk_box_pack_start(GTK_BOX(container), data->samples_container,
                     TRUE, TRUE, 0);

  data->display_samples_check_box =
    gtk_check_button_new_with_label(_("display sample areas on image"));
  gtk_toggle_button_set_active(
    GTK_TOGGLE_BUTTON(data->display_samples_check_box),
    dt_conf_get_int("ui_last/colorpicker_display_samples"));
  gtk_box_pack_start(GTK_BOX(container), data->display_samples_check_box,
                     TRUE, TRUE, 0);

  g_signal_connect(G_OBJECT(data->display_samples_check_box), "toggled",
                   G_CALLBACK(_display_samples_changed), NULL);

}
Beispiel #25
0
static void
hide_items_cb (GtkToggleButton *togglebutton, GUI *appGUI)
{
	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (appGUI->opt->ct_hide_items_checkbutton)))
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (appGUI->opt->ct_delete_items_checkbutton), FALSE);
}
Beispiel #26
0
static void
eog_preferences_dialog_init (EogPreferencesDialog *pref_dlg)
{
	EogPreferencesDialogPrivate *priv;
	GtkAdjustment *scale_adjustment;

	pref_dlg->priv = eog_preferences_dialog_get_instance_private (pref_dlg);
	priv = pref_dlg->priv;

	gtk_widget_init_template (GTK_WIDGET (pref_dlg));

	priv->view_settings = g_settings_new (EOG_CONF_VIEW);
	priv->fullscreen_settings = g_settings_new (EOG_CONF_FULLSCREEN);

	g_signal_connect (G_OBJECT (pref_dlg),
			  "response",
			  G_CALLBACK (eog_preferences_response_cb),
			  pref_dlg);

	g_settings_bind (priv->view_settings, EOG_CONF_VIEW_INTERPOLATE,
			 priv->interpolate_check, "active",
			 G_SETTINGS_BIND_DEFAULT);
	g_settings_bind (priv->view_settings, EOG_CONF_VIEW_EXTRAPOLATE,
			 priv->extrapolate_check, "active",
			 G_SETTINGS_BIND_DEFAULT);
	g_settings_bind (priv->view_settings, EOG_CONF_VIEW_AUTOROTATE,
			 priv->autorotate_check, "active",
			 G_SETTINGS_BIND_DEFAULT);
	g_settings_bind (priv->view_settings, EOG_CONF_VIEW_USE_BG_COLOR,
			 priv->bg_color_check, "active",
			 G_SETTINGS_BIND_DEFAULT);
	g_settings_bind_with_mapping (priv->view_settings,
				      EOG_CONF_VIEW_BACKGROUND_COLOR,
				      priv->bg_color_button, "rgba",
				      G_SETTINGS_BIND_DEFAULT,
				      pd_string_to_rgba_mapping,
				      pd_rgba_to_string_mapping,
				      NULL, NULL);
	g_object_set_data (G_OBJECT (priv->color_radio),
			   GCONF_OBJECT_VALUE,
			   GINT_TO_POINTER (EOG_TRANSP_COLOR));

	g_signal_connect (G_OBJECT (priv->color_radio),
			  "toggled",
			  G_CALLBACK (pd_transp_radio_toggle_cb),
			  priv->view_settings);

	g_object_set_data (G_OBJECT (priv->checkpattern_radio),
			   GCONF_OBJECT_VALUE,
			   GINT_TO_POINTER (EOG_TRANSP_CHECKED));

	g_signal_connect (G_OBJECT (priv->checkpattern_radio),
			  "toggled",
			  G_CALLBACK (pd_transp_radio_toggle_cb),
			  priv->view_settings);

	g_object_set_data (G_OBJECT (priv->background_radio),
			   GCONF_OBJECT_VALUE,
			   GINT_TO_POINTER (EOG_TRANSP_BACKGROUND));

	g_signal_connect (G_OBJECT (priv->background_radio),
			  "toggled",
			  G_CALLBACK (pd_transp_radio_toggle_cb),
			  priv->view_settings);

	g_signal_connect (G_OBJECT (priv->seconds_scale), "format-value",
			  G_CALLBACK (pd_seconds_scale_format_value_cb),
			  NULL);

	switch (g_settings_get_enum (priv->view_settings,
				     EOG_CONF_VIEW_TRANSPARENCY))
	{
	case EOG_TRANSP_COLOR:
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->color_radio), TRUE);
		break;
	case EOG_TRANSP_CHECKED:
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->checkpattern_radio), TRUE);
		break;
	default:
		// Log a warning and use EOG_TRANSP_BACKGROUND as fallback
		g_warn_if_reached();
	case EOG_TRANSP_BACKGROUND:
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->background_radio), TRUE);
		break;
	}

	g_settings_bind_with_mapping (priv->view_settings,
				      EOG_CONF_VIEW_TRANS_COLOR,
				      priv->transp_color_button, "rgba",
				      G_SETTINGS_BIND_DEFAULT,
				      pd_string_to_rgba_mapping,
				      pd_rgba_to_string_mapping,
				      NULL, NULL);

	g_settings_bind (priv->fullscreen_settings, EOG_CONF_FULLSCREEN_UPSCALE,
			 priv->upscale_check, "active",
			 G_SETTINGS_BIND_DEFAULT);

	g_settings_bind (priv->fullscreen_settings, EOG_CONF_FULLSCREEN_LOOP,
			 priv->loop_check, "active",
			 G_SETTINGS_BIND_DEFAULT);

	scale_adjustment = gtk_range_get_adjustment (GTK_RANGE (priv->seconds_scale));

	g_settings_bind (priv->fullscreen_settings, EOG_CONF_FULLSCREEN_SECONDS,
			 scale_adjustment, "value",
			 G_SETTINGS_BIND_DEFAULT);

	gtk_widget_show_all (priv->plugin_manager);

}
Beispiel #27
0
void
search_open (session * sess)
{
	GtkWidget *win, *hbox, *vbox, *entry, *wid;
	gchar *text;

	if (searchwin)
	{
		gtk_widget_destroy (searchwin);
		searchwin = NULL;
	}
	win = mg_create_generic_tab ("search", _(DISPLAY_NAME": Search"), TRUE, FALSE,
								 search_cleanup_cb, NULL, 0, 0, &vbox, 0);
	gtk_container_set_border_width (GTK_CONTAINER (win), 12);
	gtk_box_set_spacing (GTK_BOX (vbox), 4);

	/* First line:  _____________________   _Find */
	hbox = gtk_hbox_new (0, 10);
	gtk_container_add (GTK_CONTAINER (vbox), hbox);
	gtk_widget_show (hbox);

	entry = gtk_entry_new ();
	text = GTK_XTEXT (sess->gui->xtext)->buffer->search_text;
	if (text)
	{
		gtk_entry_set_text (GTK_ENTRY (entry), text);
		gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
	}
	g_signal_connect (G_OBJECT (entry), "activate",
							G_CALLBACK (search_entry_cb), sess);
	gtk_container_add (GTK_CONTAINER (hbox), entry);
	gtk_widget_show (entry);
	gtk_widget_grab_focus (entry);

	wid = gtk_hbutton_box_new ();
	gtk_container_add (GTK_CONTAINER (hbox), wid);
	gtk_widget_show (wid);
	wid = gtkutil_button (wid, GTK_STOCK_FIND, 0, search_find_cb, sess,
								 _("_Find"));
	g_object_set_data (G_OBJECT (wid), "e", entry);

	/* Second line:  X Match case */
	wid = gtk_check_button_new_with_mnemonic (_("_Match case"));
	GTK_TOGGLE_BUTTON (wid)->active = prefs.text_search_case_match;
	g_signal_connect (G_OBJECT (wid), "toggled", G_CALLBACK (search_caseign_cb), sess);
	gtk_container_add (GTK_CONTAINER (vbox), wid);
	add_tip (wid, "Perform a case-sensitive search.");
	gtk_widget_show (wid);

	/* Third line:  X Search backwards */
	wid = gtk_check_button_new_with_mnemonic (_("Search _backwards"));
	GTK_TOGGLE_BUTTON (wid)->active = prefs.text_search_backward;
	g_signal_connect (G_OBJECT (wid), "toggled", G_CALLBACK (search_dirbwd_cb), sess);
	gtk_container_add (GTK_CONTAINER (vbox), wid);
	add_tip (wid, "Search from the newest text line to the oldest.");
	gtk_widget_show (wid);

	/* Fourth line:  X Highlight all */
	wid = gtk_check_button_new_with_mnemonic (_("_Highlight all"));
	GTK_TOGGLE_BUTTON (wid)->active = prefs.text_search_highlight_all;
	g_signal_connect (G_OBJECT (wid), "toggled", G_CALLBACK (search_highlight_cb), sess);
	gtk_container_add (GTK_CONTAINER (vbox), wid);
	add_tip (wid, "Highlight all occurrences, and underline the current occurrence.");
	gtk_widget_show (wid);

	/* Fifth line:  X Regular expression */
	wid = gtk_check_button_new_with_mnemonic (_("R_egular expression"));
	GTK_TOGGLE_BUTTON (wid)->active = prefs.text_search_regexp;
	g_signal_connect (G_OBJECT (wid), "toggled", G_CALLBACK (search_regexp_cb), sess);
	gtk_container_add (GTK_CONTAINER (vbox), wid);
	add_tip (wid, "Regard search string as a regular expression.");
	gtk_widget_show (wid);

	/* Sixth line:  _Close    Close and _Reset */
	hbox = gtk_hbutton_box_new ();
	gtk_box_pack_start (GTK_BOX (vbox), hbox, 0, 0, 4);
	gtk_widget_show (hbox);

	wid = gtkutil_button (hbox, GTK_STOCK_CLOSE, 0, search_close_cb, win,
						_("_Close"));
	add_tip (wid, "Close this box, but continue searching new lines.");
	wid = gtkutil_button (hbox, "gtk-reset", 0, search_reset_cb, sess,
						_("Close and _Reset"));
	add_tip (wid, "Close this box, reset highlighted search items, and stop searching new lines.");

	/* Add recognition of the ESC key to close the box */
	g_signal_connect (G_OBJECT (win), "key_press_event", G_CALLBACK (search_key_cb), win);

	/* That's all, folks */
	searchwin = win;
	gtk_widget_show (win);
}
Beispiel #28
0
void SettingsDialog::loadCheckbox(const char * name, gboolean value) {
	XOJ_CHECK_TYPE(SettingsDialog);

	GtkToggleButton * b = GTK_TOGGLE_BUTTON(get(name));
	gtk_toggle_button_set_active(b, value);
}
Beispiel #29
0
/**
 * vtable_dialog_get_replace_if_exists:
 */
gboolean
vtable_dialog_get_replace_if_exists (VtableDialog *dlg)
{
	g_return_val_if_fail (IS_VTABLE_DIALOG (dlg), FALSE);
	return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dlg->priv->tname_replace));
}
Beispiel #30
0
void
esd_gtk_option_dialog()
{
  GtkWidget *window, *label, *accept, *cancel;
  GtkWidget *on, *off;
  char *option;

  window = gtk_dialog_new();
  accept = gtk_button_new_with_label(" Accept ");
  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->action_area), accept,
		     TRUE, TRUE, 0);
  cancel = gtk_button_new_with_label("  Cancel  ");
  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->action_area), cancel,
		     TRUE, TRUE, 0);

  label = gtk_label_new("  ESD Record Mode:  ");
  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), label,
		     TRUE, TRUE, 5);

  on = gtk_radio_button_new_with_label(NULL, "On");
  off = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(on)), "Off");

  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), on,
		     TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), off,
		     TRUE, TRUE, 0);

  option = datasrc->save_option(1);	/* format will be "esdrecord=%d" */
  if (option) temp_rec = option[10] - '0';

  gtk_toggle_button_set_active
    (GTK_TOGGLE_BUTTON(on), temp_rec == 1);
  gtk_toggle_button_set_active
    (GTK_TOGGLE_BUTTON(off), temp_rec == 0);

  gtk_signal_connect(GTK_OBJECT(on), "clicked",
		     GTK_SIGNAL_FUNC(esdrecord), (gpointer) 1);
  gtk_signal_connect(GTK_OBJECT(off), "clicked",
		     GTK_SIGNAL_FUNC(esdrecord), (gpointer) 0);

  gtk_signal_connect_object(GTK_OBJECT(window), "delete_event",
			    GTK_SIGNAL_FUNC(gtk_widget_destroy),
			    GTK_OBJECT(window));
  gtk_signal_connect(GTK_OBJECT(accept), "clicked",
		     GTK_SIGNAL_FUNC(esd_save_values), NULL);
  gtk_signal_connect_object_after(GTK_OBJECT(accept), "clicked",
				  GTK_SIGNAL_FUNC(gtk_widget_destroy),
				  GTK_OBJECT(window));
  gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked",
			    GTK_SIGNAL_FUNC(gtk_widget_destroy),
			    GTK_OBJECT(window));

  GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
  GTK_WIDGET_SET_FLAGS(accept, GTK_CAN_DEFAULT);
  gtk_widget_grab_default(accept);

  gtk_widget_show(on);
  gtk_widget_show(off);
  gtk_widget_show(accept);
  gtk_widget_show(cancel);
  gtk_widget_show(label);
  gtk_widget_show(window);
}