示例#1
0
/*
  ┌─Icon cache───────────────────────────────────────────┐
  │ [✔] Use cached icons                                 │
  │ Cache refresh interval [ 24 |⬘] hours                │
  │ Using X KB in Y files and Z directories [Clear]      │
  └──────────────────────────────────────────────────────┘
  ┌─Default missing icon mode────────────────────────────┐
  │ (•) None                                             │
  │ ( ) Mystery man                                      │
  │ ( ) Identicon                                        │
  │ ( ) MonsterID                                        │
  │ ( ) Wavatar                                          │
  │ ( ) Retro                                            │
  │ ( ) Custom URL [___________________________________] │
  └──────────────────────────────────────────────────────┘
  ┌─Network──────────────────────────────────────────────┐
  │ [✔] Allow redirects                                  │
  │ [✔] Federated servers                                │
  │ Timeout [ 10 |⬘] seconds                             │
  └──────────────────────────────────────────────────────┘
 */
static void libravatar_prefs_create_widget_func(PrefsPage * _page,
					        GtkWindow * window,
					        gpointer data)
{
	struct LibravatarPrefsPage *page = (struct LibravatarPrefsPage *) _page;
	GtkWidget *vbox, *vbox1, *vbox2, *vbox3, *frame;

	vbox1 = p_create_frame_cache(page);
	vbox2 = p_create_frame_missing(page);
	vbox3 = p_create_frame_network(page);

	vbox = gtk_vbox_new(FALSE, 6);
	gtk_container_set_border_width(GTK_CONTAINER(vbox), VBOX_BORDER);

	PACK_FRAME (vbox, frame, _("Icon cache"));
	gtk_container_set_border_width(GTK_CONTAINER(vbox1), 6);
	gtk_container_add(GTK_CONTAINER(frame), vbox1);

	PACK_FRAME (vbox, frame, _("Default missing icon mode"));
	gtk_container_set_border_width(GTK_CONTAINER(vbox2), 6);
	gtk_container_add(GTK_CONTAINER(frame), vbox2);

	PACK_FRAME (vbox, frame, _("Network"));
	gtk_container_set_border_width(GTK_CONTAINER(vbox3), 6);
	gtk_container_add(GTK_CONTAINER(frame), vbox3);

	gtk_widget_show_all(vbox);
	page->page.widget = vbox;
}
示例#2
0
static void create_rssyl_prefs_page(PrefsPage *page,
		GtkWindow *window, gpointer data)
{
	RPrefsPage *prefs_page = (RPrefsPage *) page;
	GtkWidget *vbox, *vbox1, *vbox2;
	GtkWidget *frame;
	GtkWidget *refresh, *refresh_enabled, *refresh_hbox;
	GtkWidget *label;
	GtkWidget *refresh_on_startup;
	GtkObject *refresh_adj;
	GtkWidget *cookies_path, *cookies_btn, *cookies_hbox;
	GtkWidget *ssl_verify_peer;

	vbox1 = gtk_vbox_new(FALSE, 6);

	/* Refresh interval */
	refresh_hbox = gtk_hbox_new(FALSE, 6);
	refresh_enabled = gtk_check_button_new_with_label(
			_("Default refresh interval"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(refresh_enabled),
			rssyl_prefs.refresh_enabled);
	gtk_box_pack_start(GTK_BOX(refresh_hbox), refresh_enabled, FALSE, FALSE, 0);

	refresh_adj = gtk_adjustment_new(rssyl_prefs.refresh,
			1, 100000, 1, 10, 0);
	refresh = gtk_spin_button_new(GTK_ADJUSTMENT(refresh_adj), 1, 0);
	gtk_widget_set_sensitive(GTK_WIDGET(refresh), rssyl_prefs.refresh_enabled);
	g_signal_connect(G_OBJECT(refresh_enabled), "toggled",
			G_CALLBACK(rssyl_refresh_enabled_toggled_cb), refresh);
	gtk_box_pack_start(GTK_BOX(refresh_hbox), refresh, FALSE, FALSE, 0);

	label = gtk_label_new(_("minute(s)"));
	gtk_box_pack_start(GTK_BOX(refresh_hbox), label, FALSE, FALSE, 0);

	gtk_box_pack_start(GTK_BOX(vbox1), refresh_hbox, FALSE, FALSE, 0);

	/* Whether to refresh all feeds on CM startup */
	refresh_on_startup = gtk_check_button_new_with_label(
			_("Refresh all feeds on application start"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(refresh_on_startup),
			rssyl_prefs.refresh_on_startup);
	gtk_box_pack_start(GTK_BOX(vbox1), refresh_on_startup, FALSE, FALSE, 0);

	vbox2 = gtk_vbox_new(FALSE, 6);

	/* Whether to verify SSL peer certificate */
	ssl_verify_peer = gtk_check_button_new_with_label(
			_("Verify SSL certificates validity for new feeds"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ssl_verify_peer),
			rssyl_prefs.ssl_verify_peer);
	gtk_box_pack_start(GTK_BOX(vbox2), ssl_verify_peer, FALSE, FALSE, 0);

	/* Path to cookies file for libcurl to use */
	cookies_hbox = gtk_hbox_new(FALSE, 6);
	label = gtk_label_new(_("Path to cookies file"));
	gtk_box_pack_start(GTK_BOX(cookies_hbox), label, FALSE, FALSE, 0);

	cookies_path = gtk_entry_new();
	gtk_entry_set_text(GTK_ENTRY(cookies_path), rssyl_prefs.cookies_path);
	gtk_box_pack_start(GTK_BOX(cookies_hbox), cookies_path, TRUE, TRUE, 0);
	gtk_widget_set_tooltip_text(cookies_path,
			_("Path to Netscape-style cookies.txt file containing your cookies"));

	cookies_btn = gtkut_get_browse_file_btn(_("Bro_wse"));
	gtk_box_pack_start(GTK_BOX(cookies_hbox), cookies_btn, FALSE, FALSE, 0);
	g_signal_connect(G_OBJECT(cookies_btn), "clicked",
		G_CALLBACK(rssyl_prefs_cookies_browse_cb), cookies_path);
	gtk_box_pack_start(GTK_BOX(vbox2), cookies_hbox, FALSE, FALSE, 0);

	vbox = gtk_vbox_new(FALSE, 6);
	gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);

	PACK_FRAME (vbox, frame, _("Refreshing"));
	gtk_container_set_border_width(GTK_CONTAINER(vbox1), 6);
	gtk_container_add(GTK_CONTAINER(frame), vbox1);

	PACK_FRAME (vbox, frame, _("Security and privacy"));
	gtk_container_set_border_width(GTK_CONTAINER(vbox2), 6);
	gtk_container_add(GTK_CONTAINER(frame), vbox2);

	gtk_widget_show_all(vbox);

	/* Store pointers to relevant widgets */
	prefs_page->page.widget = vbox;
	prefs_page->refresh_enabled = refresh_enabled;
	prefs_page->refresh = refresh;
	prefs_page->refresh_on_startup = refresh_on_startup;
	prefs_page->cookies_path = cookies_path;
	prefs_page->ssl_verify_peer = ssl_verify_peer;
}
示例#3
0
static void prefs_themes_create_widget(PrefsPage *page, GtkWindow *window, gpointer data)
{
	ThemesPage *prefs_themes = (ThemesPage *)page;
	ThemesData *tdata = prefs_themes_data;

	GtkWidget *vbox1;
	GtkWidget *frame1;
	GtkWidget *vbox2;
	GtkWidget *hbox3;
	GtkWidget *menu_themes;
	GtkWidget *btn_install;
	GtkWidget *btn_more;
	GtkWidget *label_global_status;
	GtkWidget *frame_info;
	GtkWidget *table1;
	GtkWidget *label1;
	GtkWidget *label2;
	GtkWidget *label3;
	GtkWidget *label_name;
	GtkWidget *label_author;
	GtkWidget *label_url;
	GtkWidget *label4;
	GtkWidget *label_status;
	GtkWidget *frame_preview;
	GtkWidget *hbox1;
	GtkWidget *icon_1;
	GtkWidget *icon_2;
	GtkWidget *icon_3;
	GtkWidget *icon_4;
	GtkWidget *icon_5;
	GtkWidget *icon_6;
	GtkWidget *icon_7;
	GtkWidget *frame_buttons;
	GtkWidget *hbuttonbox1;
	GtkWidget *btn_remove;
	GtkCellRenderer *renderer;

	vbox1 = gtk_vbox_new (FALSE, VSPACING);
	gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
	gtk_widget_show (vbox1);

	vbox2 = gtkut_get_options_frame(vbox1, &frame1, _("Selector"));

	hbox3 = gtk_hbox_new (FALSE, 5);
	gtk_widget_show (hbox3);
	gtk_box_pack_start (GTK_BOX (vbox2), hbox3, FALSE, FALSE, 0);
	gtk_container_set_border_width (GTK_CONTAINER (hbox3), 5);

	menu_themes = gtk_combo_box_new();
	gtk_widget_show (menu_themes);
	gtk_box_pack_start (GTK_BOX (hbox3), menu_themes, FALSE, FALSE, 0);

	btn_install = gtk_button_new_with_label (_("Install new..."));
	gtk_widget_show (btn_install);
	gtk_box_pack_start (GTK_BOX (hbox3), btn_install, FALSE, FALSE, 0);
	gtkut_widget_set_can_default (btn_install, TRUE);

	btn_more = gtkut_get_link_btn((GtkWidget *)window, THEMES_URI, _("Get more..."));
	gtk_widget_show (btn_more);
	gtk_box_pack_start (GTK_BOX (hbox3), btn_more, FALSE, FALSE, 0);

	label_global_status = gtk_label_new ("");
	gtk_widget_show (label_global_status);
	gtk_box_pack_start (GTK_BOX (vbox2), label_global_status, FALSE, FALSE, 0);
	gtk_label_set_justify (GTK_LABEL (label_global_status), GTK_JUSTIFY_LEFT);
	gtk_misc_set_alignment (GTK_MISC (label_global_status), 0, 0.5);
	gtk_misc_set_padding (GTK_MISC (label_global_status), 6, 0);

	PACK_FRAME(vbox1, frame_info, _("Information"));

	table1 = gtk_table_new (4, 2, FALSE);
	gtk_widget_show (table1);
	gtk_container_add (GTK_CONTAINER (frame_info), table1);

	label1 = gtk_label_new (_("Name: "));
	gtk_widget_show (label1);
	gtk_table_attach (GTK_TABLE (table1), label1, 0, 1, 0, 1,
			(GtkAttachOptions) (GTK_FILL),
			(GtkAttachOptions) (0), 8, 2);
	gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);
	gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);

	label2 = gtk_label_new (_("Author: "));
	gtk_widget_show (label2);
	gtk_table_attach (GTK_TABLE (table1), label2, 0, 1, 1, 2,
			(GtkAttachOptions) (GTK_FILL),
			(GtkAttachOptions) (0), 8, 2);
	gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);
	gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);

	label3 = gtk_label_new (_("URL:"));
	gtk_widget_show (label3);
	gtk_table_attach (GTK_TABLE (table1), label3, 0, 1, 2, 3,
			(GtkAttachOptions) (GTK_FILL),
			(GtkAttachOptions) (0), 8, 2);
	gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5);

	label_name = gtk_label_new ("");
	gtk_widget_show (label_name);
	gtk_table_attach (GTK_TABLE (table1), label_name, 1, 2, 0, 1,
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
			(GtkAttachOptions) (0), 0, 0);
	gtk_misc_set_alignment (GTK_MISC (label_name), 0, 0.5);

	label_author = gtk_label_new ("");
	gtk_widget_show (label_author);
	gtk_table_attach (GTK_TABLE (table1), label_author, 1, 2, 1, 2,
			(GtkAttachOptions) (GTK_FILL),
			(GtkAttachOptions) (0), 0, 0);
	gtk_misc_set_alignment (GTK_MISC (label_author), 0, 0.5);

	label_url = gtk_label_new ("");
	gtk_widget_show (label_url);
	gtk_table_attach (GTK_TABLE (table1), label_url, 1, 2, 2, 3,
			(GtkAttachOptions) (GTK_FILL),
			(GtkAttachOptions) (0), 0, 0);
	gtk_misc_set_alignment (GTK_MISC (label_url), 0, 0.5);

	label4 = gtk_label_new (_("Status:"));
	gtk_widget_show (label4);
	gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 3, 4,
			(GtkAttachOptions) (GTK_FILL),
			(GtkAttachOptions) (0), 8, 2);
	gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);

	label_status = gtk_label_new ("");
	gtk_widget_show (label_status);
	gtk_table_attach (GTK_TABLE (table1), label_status, 1, 2, 3, 4,
			(GtkAttachOptions) (GTK_FILL),
			(GtkAttachOptions) (0), 0, 0);
	gtk_misc_set_alignment (GTK_MISC (label_status), 0, 0.5);

	PACK_FRAME(vbox1, frame_preview, _("Preview"));

	hbox1 = gtk_hbox_new (FALSE, 0);
	gtk_widget_show (hbox1);
	gtk_container_add (GTK_CONTAINER (frame_preview), hbox1);

	icon_1 = gtk_image_new();
	gtk_widget_show (icon_1);
	gtk_box_pack_start (GTK_BOX (hbox1), icon_1, TRUE, TRUE, 2);
	gtk_misc_set_padding (GTK_MISC (icon_1), 0, 5);

	icon_2 = gtk_image_new();
	gtk_widget_show (icon_2);
	gtk_box_pack_start (GTK_BOX (hbox1), icon_2, TRUE, TRUE, 2);
	gtk_misc_set_padding (GTK_MISC (icon_2), 0, 5);

	icon_3 = gtk_image_new();
	gtk_widget_show (icon_3);
	gtk_box_pack_start (GTK_BOX (hbox1), icon_3, TRUE, TRUE, 2);
	gtk_misc_set_padding (GTK_MISC (icon_3), 0, 5);

	icon_4 = gtk_image_new();
	gtk_widget_show (icon_4);
	gtk_box_pack_start (GTK_BOX (hbox1), icon_4, TRUE, TRUE, 2);
	gtk_misc_set_padding (GTK_MISC (icon_4), 0, 5);

	icon_5 = gtk_image_new();
	gtk_widget_show (icon_5);
	gtk_box_pack_start (GTK_BOX (hbox1), icon_5, TRUE, TRUE, 2);
	gtk_misc_set_padding (GTK_MISC (icon_5), 0, 5);

	icon_6 = gtk_image_new();
	gtk_widget_show (icon_6);
	gtk_box_pack_start (GTK_BOX (hbox1), icon_6, TRUE, TRUE, 0);
	gtk_misc_set_padding (GTK_MISC (icon_6), 0, 5);

	icon_7 = gtk_image_new();
	gtk_widget_show (icon_7);
	gtk_box_pack_start (GTK_BOX (hbox1), icon_7, TRUE, TRUE, 0);
	gtk_misc_set_padding (GTK_MISC (icon_7), 0, 5);

	PACK_FRAME(vbox1, frame_buttons, _("Actions"));

	hbuttonbox1 = gtk_hbutton_box_new ();
	gtk_widget_show (hbuttonbox1);
	gtk_container_add (GTK_CONTAINER (frame_buttons), hbuttonbox1);
	gtk_container_set_border_width (GTK_CONTAINER (hbuttonbox1), 5);
	gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox1), GTK_BUTTONBOX_START);
	gtk_box_set_spacing (GTK_BOX (hbuttonbox1), 5);

	btn_remove = gtk_button_new_with_label (_("Remove"));
	gtk_widget_show (btn_remove);
	gtk_container_add (GTK_CONTAINER (hbuttonbox1), btn_remove);
	gtkut_widget_set_can_default (btn_remove, TRUE);

	g_signal_connect(G_OBJECT(btn_remove), "clicked",
			 G_CALLBACK(prefs_themes_btn_remove_clicked_cb),
			 NULL);
	g_signal_connect(G_OBJECT(btn_install), "clicked",
			 G_CALLBACK(prefs_themes_btn_install_clicked_cb),
			 NULL);

	prefs_themes->window = GTK_WIDGET(window);

	prefs_themes->name   = label_name;
	prefs_themes->author = label_author;
	prefs_themes->url    = label_url;
	prefs_themes->status = label_status;
	prefs_themes->global = label_global_status;

	prefs_themes->icons[0] = icon_1;
	prefs_themes->icons[1] = icon_2;
	prefs_themes->icons[2] = icon_3;
	prefs_themes->icons[3] = icon_4;
	prefs_themes->icons[4] = icon_5;
	prefs_themes->icons[5] = icon_6;
	prefs_themes->icons[6] = icon_7;

	prefs_themes->btn_remove  = btn_remove;
	prefs_themes->btn_install = btn_install;
	prefs_themes->btn_more    = btn_more;

	prefs_themes->op_menu     = menu_themes;

	prefs_themes->page.widget = vbox1;
	
	prefs_themes_set_themes_menu(GTK_COMBO_BOX(menu_themes), tdata);
	renderer = gtk_cell_renderer_text_new();
	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(menu_themes), renderer, TRUE);
	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(menu_themes), renderer,
					"text", 0, NULL);

	prefs_themes_get_theme_info(tdata);
	prefs_themes_display_global_stats(tdata);
}
示例#4
0
static void vcal_prefs_create_widget_func(PrefsPage * _page,
        GtkWindow * window,
        gpointer data)
{
    struct VcalendarPage *page = (struct VcalendarPage *) _page;

    GtkWidget *vbox1, *vbox2, *vbox3;
    GtkWidget *hbox1, *hbox2, *hbox3;

    GtkWidget *frame_alert;
    GtkWidget *alert_enable_checkbtn;
    GtkObject *alert_enable_spinbtn_adj;
    GtkWidget *alert_enable_h_spinbtn;
    GtkWidget *alert_enable_m_spinbtn;
    GtkWidget *label_alert_enable;

    GtkWidget *frame_export;
    GtkWidget *export_enable_checkbtn;
    GtkWidget *export_subs_checkbtn;
    GtkWidget *export_path_entry;
    GtkWidget *export_command_label;
    GtkWidget *export_command_entry;
    GtkWidget *register_orage_checkbtn;
    GtkWidget *calendar_server_checkbtn;

    GtkWidget *export_user_label;
    GtkWidget *export_user_entry;
    GtkWidget *export_pass_label;
    GtkWidget *export_pass_entry;

    GtkWidget *frame_freebusy_export;
    GtkWidget *export_freebusy_enable_checkbtn;
    GtkWidget *export_freebusy_path_entry;
    GtkWidget *export_freebusy_command_label;
    GtkWidget *export_freebusy_command_entry;

    GtkWidget *export_freebusy_user_label;
    GtkWidget *export_freebusy_user_entry;
    GtkWidget *export_freebusy_pass_label;
    GtkWidget *export_freebusy_pass_entry;

    GtkWidget *freebusy_get_url_label;
    GtkWidget *freebusy_get_url_entry;

    GtkWidget *frame_ssl_options;
    GtkWidget *ssl_verify_peer_checkbtn;
    gchar *export_pass = NULL;
    gchar *export_freebusy_pass = NULL;

    vbox1 = gtk_vbox_new (FALSE, VSPACING);
    gtk_widget_show (vbox1);
    gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);

    vbox2 = gtk_vbox_new (FALSE, 4);
    gtk_widget_show (vbox2);
    gtk_box_pack_start(GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);


    /* alert stuff */
    PACK_FRAME(vbox2, frame_alert, _("Reminders"));
    vbox3 = gtk_vbox_new (FALSE, 8);
    gtk_widget_show (vbox3);
    gtk_container_add (GTK_CONTAINER (frame_alert), vbox3);
    gtk_container_set_border_width (GTK_CONTAINER (vbox3), VBOX_BORDER);
    hbox1 = gtk_hbox_new (FALSE, 8);
    gtk_widget_show (hbox1);
    gtk_box_pack_start(GTK_BOX (vbox3), hbox1, TRUE, TRUE, 0);

    alert_enable_checkbtn = gtk_check_button_new_with_label(_("Alert me"));
    gtk_widget_show (alert_enable_checkbtn);
    gtk_box_pack_start(GTK_BOX (hbox1), alert_enable_checkbtn, FALSE, FALSE, 0);

    alert_enable_spinbtn_adj = gtk_adjustment_new (0, 0, 24, 1, 10, 0);
    alert_enable_h_spinbtn = gtk_spin_button_new (
                                 GTK_ADJUSTMENT (alert_enable_spinbtn_adj), 1, 0);
    gtk_widget_set_size_request (alert_enable_h_spinbtn, 64, -1);
    gtk_spin_button_set_numeric (
        GTK_SPIN_BUTTON (alert_enable_h_spinbtn), TRUE);
    gtk_widget_show (alert_enable_h_spinbtn);
    gtk_box_pack_start (
        GTK_BOX (hbox1), alert_enable_h_spinbtn, FALSE, FALSE, 0);

    label_alert_enable = gtk_label_new (_("hours"));
    gtk_widget_show (label_alert_enable);
    gtk_box_pack_start (
        GTK_BOX (hbox1), label_alert_enable, FALSE, FALSE, 0);

    alert_enable_spinbtn_adj = gtk_adjustment_new (0, 0, 59, 1, 10, 0);
    alert_enable_m_spinbtn = gtk_spin_button_new (
                                 GTK_ADJUSTMENT (alert_enable_spinbtn_adj), 1, 0);
    gtk_widget_set_size_request (alert_enable_m_spinbtn, 64, -1);
    gtk_spin_button_set_numeric (
        GTK_SPIN_BUTTON (alert_enable_m_spinbtn), TRUE);
    gtk_widget_show (alert_enable_m_spinbtn);
    gtk_box_pack_start (
        GTK_BOX (hbox1), alert_enable_m_spinbtn, FALSE, FALSE, 0);

    label_alert_enable = gtk_label_new(_("minutes before an event"));
    gtk_widget_show (label_alert_enable);
    gtk_box_pack_start (
        GTK_BOX (hbox1), label_alert_enable, FALSE, FALSE, 0);

    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(alert_enable_checkbtn),
                                  vcalprefs.alert_enable);
    gtk_spin_button_set_value (GTK_SPIN_BUTTON(alert_enable_h_spinbtn),
                               vcalprefs.alert_delay / 60);
    gtk_spin_button_set_value (GTK_SPIN_BUTTON(alert_enable_m_spinbtn),
                               vcalprefs.alert_delay % 60);
    SET_TOGGLE_SENSITIVITY(alert_enable_checkbtn, alert_enable_h_spinbtn);
    SET_TOGGLE_SENSITIVITY(alert_enable_checkbtn, alert_enable_m_spinbtn);

    g_signal_connect(G_OBJECT(alert_enable_h_spinbtn), "value-changed",
                     G_CALLBACK(alert_spinbutton_value_changed),
                     (gpointer) page);
    g_signal_connect(G_OBJECT(alert_enable_m_spinbtn), "value-changed",
                     G_CALLBACK(alert_spinbutton_value_changed),
                     (gpointer) page);

    /* calendar export */
    /* export enable + path stuff */
    PACK_FRAME(vbox2, frame_export, _("Calendar export"));
    vbox3 = gtk_vbox_new (FALSE, 8);
    gtk_widget_show (vbox3);
    gtk_container_add (GTK_CONTAINER (frame_export), vbox3);
    gtk_container_set_border_width (GTK_CONTAINER (vbox3), VBOX_BORDER);

    /* export path */
    hbox2 = gtk_hbox_new (FALSE, 8);
    gtk_widget_show (hbox2);
    gtk_box_pack_start(GTK_BOX (vbox3), hbox2, TRUE, TRUE, 0);

    export_enable_checkbtn = gtk_check_button_new_with_label(_("Automatically export calendar to"));
    gtk_widget_show(export_enable_checkbtn);
    gtk_box_pack_start(GTK_BOX (hbox2), export_enable_checkbtn, FALSE, FALSE, 0);

    export_path_entry = gtk_entry_new();
    gtk_widget_show(export_path_entry);
    gtk_box_pack_start(GTK_BOX(hbox2), export_path_entry, TRUE, TRUE, 0);
    SET_TOGGLE_SENSITIVITY(export_enable_checkbtn, export_path_entry);
    CLAWS_SET_TIP(export_enable_checkbtn,
                  _("You can export to a local file or URL"));
    CLAWS_SET_TIP(export_path_entry,
                  _("Specify a local file or URL "
                    "(http://server/path/file.ics)"));

    /* export auth */
    hbox2 = gtk_hbox_new (FALSE, 8);
    gtk_widget_show (hbox2);
    gtk_box_pack_start(GTK_BOX (vbox3), hbox2, TRUE, TRUE, 0);

    export_user_label = gtk_label_new(_("User ID"));
    gtk_widget_show(export_user_label);
    gtk_box_pack_start(GTK_BOX (hbox2), export_user_label, FALSE, FALSE, 0);

    export_user_entry = gtk_entry_new();
    gtk_widget_show(export_user_entry);
    gtk_box_pack_start(GTK_BOX (hbox2), export_user_entry, FALSE, FALSE, 0);

    export_pass_label = gtk_label_new(_("Password"));
    gtk_widget_show(export_pass_label);
    gtk_box_pack_start(GTK_BOX (hbox2), export_pass_label, FALSE, FALSE, 0);

    export_pass_entry = gtk_entry_new();
    gtk_entry_set_visibility(GTK_ENTRY(export_pass_entry), FALSE);
    gtk_widget_show(export_pass_entry);
    gtk_box_pack_start(GTK_BOX (hbox2), export_pass_entry, FALSE, FALSE, 0);

    /* export subscriptions too */
    hbox2 = gtk_hbox_new (FALSE, 8);
    gtk_widget_show (hbox2);
    gtk_box_pack_start(GTK_BOX (vbox3), hbox2, TRUE, TRUE, 0);

    export_subs_checkbtn = gtk_check_button_new_with_label(_("Include Webcal subscriptions in export"));
    gtk_widget_show(export_subs_checkbtn);
    gtk_box_pack_start(GTK_BOX (hbox2), export_subs_checkbtn, FALSE, FALSE, 0);
    SET_TOGGLE_SENSITIVITY(export_enable_checkbtn, export_subs_checkbtn);

    /* run-command after export stuff */
    hbox3 = gtk_hbox_new (FALSE, 8);
    gtk_widget_show (hbox3);
    gtk_box_pack_start(GTK_BOX (vbox3), hbox3, TRUE, TRUE, 0);

    export_command_label = gtk_label_new(_("Command to run after calendar export"));
    gtk_widget_show(export_command_label);
    gtk_box_pack_start(GTK_BOX (hbox3), export_command_label, FALSE, FALSE, 0);
    SET_TOGGLE_SENSITIVITY(export_enable_checkbtn, export_command_label);

    export_command_entry = gtk_entry_new();
    gtk_widget_show(export_command_entry);
    gtk_box_pack_start(GTK_BOX (hbox3), export_command_entry, TRUE, TRUE, 0);
    SET_TOGGLE_SENSITIVITY(export_enable_checkbtn, export_command_entry);


    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(export_enable_checkbtn),
                                 vcalprefs.export_enable);
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(export_subs_checkbtn),
                                 vcalprefs.export_subs);
    if (vcalprefs.export_path == NULL || *vcalprefs.export_path == '\0')
        vcalprefs.export_path = g_strconcat(get_rc_dir(),
                                            G_DIR_SEPARATOR_S,
                                            "claws-mail.ics", NULL);
    if (vcalprefs.export_command == NULL)
        vcalprefs.export_command = g_strdup("");
    gtk_entry_set_text(GTK_ENTRY(export_path_entry),
                       vcalprefs.export_path);
    gtk_entry_set_text(GTK_ENTRY(export_command_entry),
                       vcalprefs.export_command);

    hbox3 = gtk_hbox_new (FALSE, 8);
    gtk_widget_show (hbox3);
    gtk_box_pack_start(GTK_BOX (vbox3), hbox3, TRUE, TRUE, 0);
    register_orage_checkbtn = gtk_check_button_new_with_label(_("Register Claws' calendar in XFCE's Orage clock"));
    CLAWS_SET_TIP(register_orage_checkbtn,
                  _("Allows Orage (version greater than 4.4) to see Claws Mail's calendar"));

    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(register_orage_checkbtn),
                                 vcalprefs.orage_registered);
    gtk_widget_set_sensitive(register_orage_checkbtn, orage_available());
    g_signal_connect(G_OBJECT(register_orage_checkbtn), "toggled",
                     G_CALLBACK(register_orage_checkbtn_toggled), NULL);
    gtk_widget_show (register_orage_checkbtn);
    gtk_box_pack_start(GTK_BOX (hbox3), register_orage_checkbtn, TRUE, TRUE, 0);

    hbox3 = gtk_hbox_new (FALSE, 8);
    gtk_widget_show (hbox3);
    gtk_box_pack_start(GTK_BOX (vbox3), hbox3, TRUE, TRUE, 0);
    calendar_server_checkbtn = gtk_check_button_new_with_label(_("Export as GNOME shell calendar server"));
    CLAWS_SET_TIP(calendar_server_checkbtn,
                  _("Register D-Bus calendar server interface to export Claws Mail's calendar"));
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(calendar_server_checkbtn),
                                 vcalprefs.calendar_server);
    g_signal_connect(G_OBJECT(calendar_server_checkbtn), "toggled",
                     G_CALLBACK(calendar_server_checkbtn_toggled), NULL);
    gtk_widget_show(calendar_server_checkbtn);
    gtk_box_pack_start(GTK_BOX(hbox3), calendar_server_checkbtn, TRUE, TRUE, 0);

    /* freebusy export */
    /* export enable + path stuff */
    PACK_FRAME(vbox2, frame_freebusy_export, _("Free/Busy information"));
    vbox3 = gtk_vbox_new (FALSE, 8);
    gtk_widget_show (vbox3);
    gtk_container_add (GTK_CONTAINER (frame_freebusy_export), vbox3);
    gtk_container_set_border_width (GTK_CONTAINER (vbox3), VBOX_BORDER);

    /* export */
    hbox2 = gtk_hbox_new (FALSE, 8);
    gtk_widget_show (hbox2);
    gtk_box_pack_start(GTK_BOX (vbox3), hbox2, TRUE, TRUE, 0);

    export_freebusy_enable_checkbtn = gtk_check_button_new_with_label(
                                          _("Automatically export free/busy status to"));
    gtk_widget_show(export_freebusy_enable_checkbtn);
    gtk_box_pack_start(GTK_BOX (hbox2), export_freebusy_enable_checkbtn, FALSE, FALSE, 0);

    export_freebusy_path_entry = gtk_entry_new();
    gtk_widget_show(export_freebusy_path_entry);
    gtk_box_pack_start(GTK_BOX(hbox2), export_freebusy_path_entry, TRUE, TRUE, 0);
    SET_TOGGLE_SENSITIVITY(export_freebusy_enable_checkbtn, export_freebusy_path_entry);
    CLAWS_SET_TIP(export_freebusy_enable_checkbtn,
                  _("You can export to a local file or URL"));
    CLAWS_SET_TIP(export_freebusy_path_entry,
                  _("Specify a local file or URL "
                    "(http://server/path/file.ifb)"));

    /* auth */
    hbox2 = gtk_hbox_new (FALSE, 8);
    gtk_widget_show (hbox2);
    gtk_box_pack_start(GTK_BOX (vbox3), hbox2, TRUE, TRUE, 0);

    export_freebusy_user_label = gtk_label_new(_("User ID"));
    gtk_widget_show(export_freebusy_user_label);
    gtk_box_pack_start(GTK_BOX (hbox2), export_freebusy_user_label, FALSE, FALSE, 0);

    export_freebusy_user_entry = gtk_entry_new();
    gtk_widget_show(export_freebusy_user_entry);
    gtk_box_pack_start(GTK_BOX (hbox2), export_freebusy_user_entry, FALSE, FALSE, 0);

    export_freebusy_pass_label = gtk_label_new(_("Password"));
    gtk_widget_show(export_freebusy_pass_label);
    gtk_box_pack_start(GTK_BOX (hbox2), export_freebusy_pass_label, FALSE, FALSE, 0);

    export_freebusy_pass_entry = gtk_entry_new();
    gtk_entry_set_visibility(GTK_ENTRY(export_freebusy_pass_entry), FALSE);
    gtk_widget_show(export_freebusy_pass_entry);
    gtk_box_pack_start(GTK_BOX (hbox2), export_freebusy_pass_entry, FALSE, FALSE, 0);

    /* run-command after export stuff */
    hbox3 = gtk_hbox_new (FALSE, 8);
    gtk_widget_show (hbox3);
    gtk_box_pack_start(GTK_BOX (vbox3), hbox3, TRUE, TRUE, 0);

    export_freebusy_command_label = gtk_label_new(_("Command to run after free/busy status export"));
    gtk_widget_show(export_freebusy_command_label);
    gtk_box_pack_start(GTK_BOX (hbox3), export_freebusy_command_label, FALSE, FALSE, 0);
    SET_TOGGLE_SENSITIVITY(export_freebusy_enable_checkbtn, export_freebusy_command_label);
    export_freebusy_command_entry = gtk_entry_new();
    gtk_widget_show(export_freebusy_command_entry);
    gtk_box_pack_start(GTK_BOX (hbox3), export_freebusy_command_entry, TRUE, TRUE, 0);
    SET_TOGGLE_SENSITIVITY(export_freebusy_enable_checkbtn, export_freebusy_command_entry);

    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(export_freebusy_enable_checkbtn),
                                 vcalprefs.export_freebusy_enable);
    if (vcalprefs.export_freebusy_path == NULL ||
            *vcalprefs.export_freebusy_path == '\0')
        vcalprefs.export_freebusy_path = g_strconcat(get_rc_dir(),
                                         G_DIR_SEPARATOR_S,
                                         "claws-mail.ifb", NULL);
    if (vcalprefs.export_freebusy_command == NULL)
        vcalprefs.export_freebusy_command = g_strdup("");
    if (vcalprefs.freebusy_get_url == NULL)
        vcalprefs.freebusy_get_url = g_strdup("");

    /* free/busy import */
    hbox2 = gtk_hbox_new (FALSE, 8);
    gtk_widget_show (hbox2);
    gtk_box_pack_start(GTK_BOX (vbox3), hbox2, TRUE, TRUE, 0);

    freebusy_get_url_label = gtk_label_new(
                                 _("Get free/busy status of others from"));
    gtk_widget_show(freebusy_get_url_label);
    gtk_box_pack_start(GTK_BOX (hbox2), freebusy_get_url_label, FALSE, FALSE, 0);

    freebusy_get_url_entry = gtk_entry_new();
    gtk_widget_show(freebusy_get_url_entry);
    gtk_box_pack_start(GTK_BOX(hbox2), freebusy_get_url_entry, TRUE, TRUE, 0);
    CLAWS_SET_TIP(freebusy_get_url_entry,
                  _("Specify a local file or URL "
                    "(http://server/path/file.ifb). Use %u "
                    "for the left part of the email address, %d for "
                    "the domain"));

    gtk_entry_set_text(GTK_ENTRY(export_freebusy_path_entry),
                       vcalprefs.export_freebusy_path);
    gtk_entry_set_text(GTK_ENTRY(export_freebusy_command_entry),
                       vcalprefs.export_freebusy_command);

    gtk_entry_set_text(GTK_ENTRY(freebusy_get_url_entry),
                       vcalprefs.freebusy_get_url);

    /* SSL frame */
    PACK_FRAME(vbox2, frame_ssl_options, _("SSL options"));
    vbox3 = gtk_vbox_new (FALSE, 8);
    gtk_widget_show (vbox3);
    gtk_container_add (GTK_CONTAINER (frame_ssl_options), vbox3);
    gtk_container_set_border_width (GTK_CONTAINER (vbox3), VBOX_BORDER);

    /* SSL peer verification */
    hbox2 = gtk_hbox_new (FALSE, 8);
    gtk_widget_show (hbox2);
    gtk_box_pack_start(GTK_BOX (vbox3), hbox2, TRUE, TRUE, 0);

    ssl_verify_peer_checkbtn = gtk_check_button_new_with_label(
                                   _("Verify SSL certificate validity"));
    gtk_widget_show(ssl_verify_peer_checkbtn);
    gtk_box_pack_start(GTK_BOX (hbox2), ssl_verify_peer_checkbtn, FALSE, FALSE, 0);
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ssl_verify_peer_checkbtn),
                                 vcalprefs.ssl_verify_peer);

    if (!vcalprefs.export_user)
        vcalprefs.export_user = g_strdup("");
    if (!vcalprefs.export_freebusy_user)
        vcalprefs.export_freebusy_user = g_strdup("");

    export_pass = vcal_passwd_get("export");
    export_freebusy_pass = vcal_passwd_get("export_freebusy");

    gtk_entry_set_text(GTK_ENTRY(export_user_entry), vcalprefs.export_user);
    gtk_entry_set_text(GTK_ENTRY(export_pass_entry), (export_pass != NULL ? export_pass : ""));
    gtk_entry_set_text(GTK_ENTRY(export_freebusy_user_entry), vcalprefs.export_freebusy_user);
    gtk_entry_set_text(GTK_ENTRY(export_freebusy_pass_entry), (export_freebusy_pass != NULL ? export_freebusy_pass : ""));

    if (export_pass != NULL) {
        memset(export_pass, 0, strlen(export_pass));
    }
    g_free(export_pass);

    if (export_freebusy_pass != NULL) {
        memset(export_freebusy_pass, 0, strlen(export_freebusy_pass));
    }
    g_free(export_freebusy_pass);

    g_signal_connect(G_OBJECT(export_enable_checkbtn),
                     "toggled", G_CALLBACK(path_changed), page);
    g_signal_connect(G_OBJECT(export_freebusy_enable_checkbtn),
                     "toggled", G_CALLBACK(path_changed), page);
    g_signal_connect(G_OBJECT(export_path_entry),
                     "changed", G_CALLBACK(path_changed), page);
    g_signal_connect(G_OBJECT(export_freebusy_path_entry),
                     "changed", G_CALLBACK(path_changed), page);

    page->alert_enable_btn = alert_enable_checkbtn;
    page->alert_delay_h_spinbtn = alert_enable_h_spinbtn;
    page->alert_delay_m_spinbtn = alert_enable_m_spinbtn;

    page->export_enable_btn = export_enable_checkbtn;
    page->export_subs_btn = export_subs_checkbtn;
    page->export_path_entry = export_path_entry;
    page->export_command_entry = export_command_entry;

    page->export_freebusy_enable_btn = export_freebusy_enable_checkbtn;
    page->export_freebusy_path_entry = export_freebusy_path_entry;
    page->export_freebusy_command_entry = export_freebusy_command_entry;

    page->export_user_label = export_user_label;
    page->export_user_entry = export_user_entry;
    page->export_pass_label = export_pass_label;
    page->export_pass_entry = export_pass_entry;

    page->export_freebusy_user_label = export_freebusy_user_label;
    page->export_freebusy_user_entry = export_freebusy_user_entry;
    page->export_freebusy_pass_label = export_freebusy_pass_label;
    page->export_freebusy_pass_entry = export_freebusy_pass_entry;

    page->ssl_verify_peer_checkbtn = ssl_verify_peer_checkbtn;

    set_auth_sensitivity(page);

    page->freebusy_get_url_entry = freebusy_get_url_entry;

    page->page.widget = vbox1;
}
示例#5
0
static void create_archiver_prefs_page(PrefsPage * _page,
				       GtkWindow *window,
                                       gpointer data)
{
	struct ArchiverPrefsPage *page = (struct ArchiverPrefsPage *) _page;
        GtkWidget *vbox1, *vbox2;
	GtkWidget *hbox1;
	GtkWidget *save_folder_label;
  	GtkWidget *save_folder;
  	GtkWidget *save_folder_select;
	GtkWidget *frame;
	GSList    *compression_group = NULL;
	GtkWidget *zip_radiobtn;
	GtkWidget *bzip_radiobtn;
    GtkWidget *compress_radiobtn;
	GtkWidget *none_radiobtn;
	GSList    *format_group = NULL;
	GtkWidget *tar_radiobtn;
	GtkWidget *shar_radiobtn;
	GtkWidget *cpio_radiobtn;
	GtkWidget *pax_radiobtn;
	GtkWidget *recursive_chkbtn;
	GtkWidget *md5sum_chkbtn;
	GtkWidget *rename_chkbtn;
        GtkWidget *unlink_chkbtn;

	vbox1 = gtk_vbox_new (FALSE, VSPACING);
	gtk_widget_show (vbox1);
	gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);

	vbox2 = gtk_vbox_new (FALSE, 4);
	gtk_widget_show (vbox2);
	gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);

  	hbox1 = gtk_hbox_new (FALSE, 8);
	gtk_widget_show (hbox1);
	gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);

 	save_folder_label = gtk_label_new(_("Default save folder"));
	gtk_widget_show (save_folder_label);
	gtk_box_pack_start (GTK_BOX (hbox1), save_folder_label, FALSE, FALSE, 0);

  	save_folder = gtk_entry_new ();
	gtk_widget_show (save_folder);
	gtk_box_pack_start (GTK_BOX (hbox1), save_folder, TRUE, TRUE, 0);

	save_folder_select = gtkut_get_browse_directory_btn(_("_Select"));
	gtk_widget_show (save_folder_select);
  	gtk_box_pack_start (GTK_BOX (hbox1), save_folder_select, FALSE, FALSE, 0);
	CLAWS_SET_TIP(save_folder_select,
			     _("Click this button to select the default location for saving archives"));

	g_signal_connect(G_OBJECT(save_folder_select), "clicked", 
			 G_CALLBACK(foldersel_cb), page);

	if (archiver_prefs.save_folder != NULL)
		gtk_entry_set_text(GTK_ENTRY(save_folder),
				   archiver_prefs.save_folder);

	PACK_FRAME (vbox1, frame, _("Default compression"));

	hbox1 = gtk_hbox_new(FALSE, 4);
	gtk_widget_show(hbox1);
	gtk_container_set_border_width(GTK_CONTAINER(hbox1), 4);
	gtk_container_add(GTK_CONTAINER(frame), hbox1);

	zip_radiobtn = gtk_radio_button_new_with_label(compression_group, "ZIP");
	compression_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(zip_radiobtn));
	gtk_widget_show(zip_radiobtn);
 	gtk_box_pack_start(GTK_BOX (hbox1), zip_radiobtn, FALSE, FALSE, 0);
	CLAWS_SET_TIP(zip_radiobtn,
			_("Choose this option to use ZIP compression by default"));

	bzip_radiobtn = gtk_radio_button_new_with_label(compression_group, "BZIP2");
	compression_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(bzip_radiobtn));
	gtk_widget_show(bzip_radiobtn);
	gtk_box_pack_start(GTK_BOX (hbox1), bzip_radiobtn, FALSE, FALSE, 0);
	CLAWS_SET_TIP(bzip_radiobtn,
			_("Choose this option to use BZIP2 compression by default"));

	compress_radiobtn = gtk_radio_button_new_with_label(compression_group, "COMPRESS");
	compression_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(compress_radiobtn));
	gtk_widget_show(compress_radiobtn);
	gtk_box_pack_start(GTK_BOX (hbox1), compress_radiobtn, FALSE, FALSE, 0);
	CLAWS_SET_TIP(compress_radiobtn,
			_("Choose this option to use COMPRESS compression by default"));

    none_radiobtn = gtk_radio_button_new_with_label(compression_group, _("None"));
	compression_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(none_radiobtn));
	gtk_widget_show(none_radiobtn);
	gtk_box_pack_start(GTK_BOX (hbox1), none_radiobtn, FALSE, FALSE, 0);
	CLAWS_SET_TIP(none_radiobtn,
			_("Choose this option to disable compression by default"));

	switch (archiver_prefs.compression) {
	case COMPRESSION_ZIP:
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(zip_radiobtn), TRUE);
		break;
	case COMPRESSION_BZIP:
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bzip_radiobtn), TRUE);
		break;
    case COMPRESSION_COMPRESS:       
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(compress_radiobtn), TRUE);
		break;
	case COMPRESSION_NONE:
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(none_radiobtn), TRUE);
		break;
	}

	PACK_FRAME (vbox1, frame, _("Default format"));

	hbox1 = gtk_hbox_new(FALSE, 4);
	gtk_widget_show(hbox1);
	gtk_container_set_border_width(GTK_CONTAINER(hbox1), 4);
	gtk_container_add(GTK_CONTAINER(frame), hbox1);

	tar_radiobtn = gtk_radio_button_new_with_label(format_group, "TAR");
	format_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(tar_radiobtn));
	gtk_widget_show(tar_radiobtn);
 	gtk_box_pack_start(GTK_BOX (hbox1), tar_radiobtn, FALSE, FALSE, 0);
	CLAWS_SET_TIP(tar_radiobtn,
			_("Choose this option to use the TAR format by default"));

	shar_radiobtn = gtk_radio_button_new_with_label(format_group, "SHAR");
	format_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(shar_radiobtn));
	gtk_widget_show(shar_radiobtn);
 	gtk_box_pack_start(GTK_BOX (hbox1), shar_radiobtn, FALSE, FALSE, 0);
	CLAWS_SET_TIP(shar_radiobtn,
			_("Choose this option to use the SHAR format by default"));

	cpio_radiobtn = gtk_radio_button_new_with_label(format_group, "CPIO");
	format_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(cpio_radiobtn));
	gtk_widget_show(cpio_radiobtn);
 	gtk_box_pack_start(GTK_BOX (hbox1), cpio_radiobtn, FALSE, FALSE, 0);
	CLAWS_SET_TIP(cpio_radiobtn,
			_("Choose this option to use the CPIO format by default"));

	pax_radiobtn = gtk_radio_button_new_with_label(format_group, "PAX");
	format_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(pax_radiobtn));
	gtk_widget_show(pax_radiobtn);
 	gtk_box_pack_start(GTK_BOX (hbox1), pax_radiobtn, FALSE, FALSE, 0);
	CLAWS_SET_TIP(pax_radiobtn,
			_("Choose this option to use the PAX format by default"));

	switch (archiver_prefs.format) {
	case FORMAT_TAR:
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tar_radiobtn), TRUE);
		break;
	case FORMAT_SHAR:
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(shar_radiobtn), TRUE);
		break;
	case FORMAT_CPIO:
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cpio_radiobtn), TRUE);
		break;
	case FORMAT_PAX:
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pax_radiobtn), TRUE);
		break;
	}

	PACK_FRAME (vbox1, frame, _("Default miscellaneous options"));

	hbox1 = gtk_hbox_new(FALSE, 4);
	gtk_widget_show(hbox1);
	gtk_container_set_border_width(GTK_CONTAINER(hbox1), 4);
	gtk_container_add(GTK_CONTAINER(frame), hbox1);

	PACK_CHECK_BUTTON(hbox1, recursive_chkbtn, _("Recursive"));
	CLAWS_SET_TIP(recursive_chkbtn,
		_("Choose this option to include subfolders in the archives by default"));
	PACK_CHECK_BUTTON(hbox1, md5sum_chkbtn, _("MD5sum"));
	CLAWS_SET_TIP(md5sum_chkbtn,
		_("Choose this option to add MD5 checksums for each file in the archives by default.\n"
		  "Be aware though, that this dramatically increases the time it\n"
		  "will take to create the archives"));

	PACK_CHECK_BUTTON(hbox1, rename_chkbtn, _("Rename"));
	CLAWS_SET_TIP(rename_chkbtn,
		_("Choose this option to use descriptive names for each file in the archive.\n"
		  "The naming scheme: date_from@to@subject.\n"
		  "Names will be truncated to max 96 characters"));

	PACK_CHECK_BUTTON(hbox1, unlink_chkbtn, _("Delete"));
	CLAWS_SET_TIP(unlink_chkbtn,
		_("Choose this option to delete mails after archiving"));

	if (archiver_prefs.recursive)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(recursive_chkbtn), TRUE);
	if (archiver_prefs.md5sum)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(md5sum_chkbtn), TRUE);
	if (archiver_prefs.rename)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rename_chkbtn), TRUE);
	if (archiver_prefs.unlink)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(unlink_chkbtn), TRUE);


	page->save_folder = save_folder;
	page->zip_radiobtn = zip_radiobtn;
	page->bzip_radiobtn = bzip_radiobtn;
    page->compress_radiobtn = compress_radiobtn;
	page->none_radiobtn = none_radiobtn;
	page->tar_radiobtn = tar_radiobtn;
	page->shar_radiobtn = shar_radiobtn;
	page->cpio_radiobtn = cpio_radiobtn;
	page->pax_radiobtn = pax_radiobtn;
	page->recursive_chkbtn = recursive_chkbtn;
	page->md5sum_chkbtn = md5sum_chkbtn;
	page->rename_chkbtn = rename_chkbtn;
        page->unlink_chkbtn = unlink_chkbtn;

	page->page.widget = vbox1;
}
void A_requantize2( float percent, uint32_t quality, char *out_name )	
{
	FILE 		*file=NULL;
	uint32_t 	len,flags,lenout;
	DIA_encoding	*encoding=NULL;
	AVDMGenericAudioStream *audio=NULL;
	double 		audioInc=0;
	double		audioWanted=0,audioGot=0;
	uint32_t	audioLen;
	mplexMuxer	*muxer=NULL;
	uint32_t	fps1000=0;
	uint32_t order=0,display;
	
	
	uint64_t size=0;
	uint32_t fsize=0;
	uint8_t *buffer 	= new uint8_t[avifileinfo->width * avifileinfo->height * 2];
	uint8_t *outbuffer 	= new uint8_t[avifileinfo->width * avifileinfo->height * 2];
	uint8_t *audioBuffer 	= new uint8_t[56000*10]; //  10 sec of audio at max bitrate
 
	Mrequant_init (percent,1);
	
	
 	
	// get audio if any
	audio=mpt_getAudioStream();
	
	if(audio)
	{
		fps1000=avifileinfo->fps1000;
		muxer=new mplexMuxer;
		aviInfo info;
		video_body->getVideoInfo(&info);
		if(!muxer->open(out_name,0,MUXER_DVD,&info,audio->getInfo()))
		//if(!muxer->open(out_name,0,fps1000,audio->getInfo(),(float)audioInc))
		{
			GUI_Error_HIG("Muxer init failed", NULL);
			goto _abt;
		}
		// The requantizer will not alter the gop timestamp
		// they (may) need to be resynced
		muxer->forceRestamp();
		
		
	}
	else
	{
		file=fopen(out_name,"wb");
		if(!file)
		{
			GUI_Error_HIG("File error", "Cannot open \"%s\" for writing.", out_name);
			goto _abt;
		}	
				
	}
	
	
		
	
	encoding=new DIA_encoding(avifileinfo->fps1000);

	encoding->setPhasis("Requantizing.");
	encoding->setCodec("Requant");
	if(muxer)
	        encoding->setContainer("Mpeg PS (DVD)");
	    else
	        encoding->setContainer("Mpeg video (.m2v)");
	    
	encoding->setFrame(0,frameEnd-frameStart);
	
	for(uint32_t i=frameStart;i<frameEnd;i++)
	{
    	
		encoding->setFrame(i-frameStart,frameEnd-frameStart);
		
      		if(!encoding->isAlive()) goto _abt;
      		ADM_assert (video_body->getFlags (i, &flags));
      		if (flags & AVI_B_FRAME)	// oops
		{
	  		// se search for the next i /p
	  		uint32_t found = 0;

	  		for (uint32_t j = i + 1; j < frameEnd; j++)
	    		{
	      			ADM_assert (video_body->getFlags (j, &flags));
	      			if (!(flags & AVI_B_FRAME))
				{
		  			found = j;
		  			break;
				}
	    		}
	  		if (!found)
	    			goto _abt;
	  		// Write the found frame
	  		PACK_FRAME(i,found);
	  		// and the B frames
	  		for (uint32_t j = i; j < found; j++)
	    		{
	      			PACK_FRAME(j+1,j);
			}
	  		i = found;		// Will be plussed by for
		}
      		else	// P or I frame
		{	// First frame is special as we want the stream to begin by a SEQ_HEADER
			// In case it is aleady the case do nothing
			// If not, we fetch the seq header from the extraData, hoping it is there
			if(i==frameStart)
			{
				video_body->getRaw (i, buffer, &len);
				
				if(buffer[0]==0 && buffer[1]==0 && buffer[2]==1 && buffer[3]==0xb3) // Seq start
				{	
					printf("1st frame contains the seq header\n");
					Mrequant_frame(buffer,  len,outbuffer, &lenout); 	
					encoding->feedFrame(lenout);	
					if(!muxer) 
	  					fwrite (outbuffer, lenout, 1, file); 
					else
					{
						muxer->writeVideoPacket(lenout,outbuffer,0,0); 
						aprintf("in:%03lu out:%03lu\n",len>>10,lenout>>10); 
						PACK_AUDIO; 
					}
				}
				else // need to add seq start
				{
					uint32_t seq;
					video_body->getRawStart (frameStart, buffer, &seq);	
					printf("Adding seq header (%lu)\n",seq);
					
	  				video_body->getRaw (i, buffer+seq, &len);
					printf("Stat : %x %x %x %x\n",buffer[seq],buffer[seq+1],buffer[seq+2],
								buffer[seq+3]);
					Mrequant_frame(buffer,  len+seq,outbuffer, &lenout);
					encoding->feedFrame(lenout);	 
	  				if(!muxer) 
	  					fwrite (outbuffer, lenout, 1, file); 
					else
					{
						muxer->writeVideoPacket(lenout,outbuffer,0,0); 
						PACK_AUDIO; 
						aprintf("in:%03lu out:%03lu\n",len>>10,lenout>>10);
					}
				}
			}
示例#7
0
static void prefs_message_create_widget(PrefsPage *_page, GtkWindow *window, 
			       	  gpointer data)
{
	MessagePage *prefs_message = (MessagePage *) _page;
	
	GtkWidget *vbox1;
	GtkWidget *vbox2;
	GtkWidget *hbox1;
	GtkWidget *checkbtn_disphdrpane;
	GtkWidget *checkbtn_disphdr;
	GtkWidget *checkbtn_dispxface;

	GtkWidget *button_edit_disphdr;
	GtkWidget *checkbtn_html;
	GtkWidget *checkbtn_html_plugin;
	GtkWidget *checkbtn_promote_html_part;
	GtkWidget *hbox_linespc;
	GtkWidget *label_linespc;
	GtkAdjustment *spinbtn_linespc_adj;
	GtkWidget *spinbtn_linespc;

	GtkWidget *frame;
	GtkWidget *vbox_scr;
	GtkWidget *checkbtn_smoothscroll;
	GtkWidget *hbox_scr;
	GtkWidget *label_scr;
	GtkAdjustment *spinbtn_scrollstep_adj;
	GtkWidget *spinbtn_scrollstep;
	GtkWidget *checkbtn_halfpage;
	GtkWidget *checkbtn_hide_quoted;

	GtkWidget *checkbtn_attach_desc;
	
	GtkWidget *frame_quote;
	GtkWidget *hbox2;
	GtkWidget *vbox_quote;
	GtkWidget *entry_quote_chars;
	GtkWidget *label_quote_chars;

	vbox1 = gtk_vbox_new (FALSE, VSPACING);
	gtk_widget_show (vbox1);
	gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);

	vbox2 = gtkut_get_options_frame(vbox1, &frame, _("Headers"));

	PACK_CHECK_BUTTON(vbox2, checkbtn_disphdrpane,
			  _("Display header pane above message view"));

#if HAVE_LIBCOMPFACE
	PACK_CHECK_BUTTON(vbox2, checkbtn_dispxface,
			  _("Display (X-)Face in message view"));
#else
	PACK_CHECK_BUTTON(vbox2, checkbtn_dispxface,
			  _("Display Face in message view"));
#endif

	gtk_widget_set_sensitive(checkbtn_dispxface, 
		!prefs_common.display_header_pane);

	g_signal_connect(G_OBJECT(checkbtn_disphdrpane), "toggled",
			 G_CALLBACK(disphdr_pane_toggled), checkbtn_dispxface);

	hbox1 = gtk_hbox_new (FALSE, 8);
	gtk_widget_show (hbox1);
	gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0);

	PACK_CHECK_BUTTON(hbox1, checkbtn_disphdr,
			  _("Display headers in message view"));

	button_edit_disphdr = gtk_button_new_from_stock(GTK_STOCK_EDIT);
	gtk_widget_show (button_edit_disphdr);
	gtk_box_pack_start (GTK_BOX (hbox1), button_edit_disphdr,
			  FALSE, TRUE, 0);
	g_signal_connect (G_OBJECT (button_edit_disphdr), "clicked",
			  G_CALLBACK (prefs_display_header_open),
			  NULL);

	SET_TOGGLE_SENSITIVITY(checkbtn_disphdr, button_edit_disphdr);

	vbox2 = gtkut_get_options_frame(vbox1, &frame, _("HTML messages"));

	PACK_CHECK_BUTTON(vbox2, checkbtn_html,
			  _("Render HTML messages as text"));

	PACK_CHECK_BUTTON(vbox2, checkbtn_html_plugin,
			  _("Render HTML-only messages with plugin if possible"));
	
	PACK_CHECK_BUTTON(vbox2, checkbtn_promote_html_part,
			  _("Select the HTML part of multipart/alternative messages"));

	hbox1 = gtk_hbox_new (FALSE, 32);
	gtk_widget_show (hbox1);
	gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, TRUE, 0);

	hbox_linespc = gtk_hbox_new (FALSE, 8);
	gtk_widget_show (hbox1);
	gtk_box_pack_start (GTK_BOX (hbox1), hbox_linespc, FALSE, TRUE, 0);

	label_linespc = gtk_label_new (_("Line space"));
	gtk_widget_show (label_linespc);
	gtk_box_pack_start (GTK_BOX (hbox_linespc), label_linespc,
			    FALSE, FALSE, 0);

	spinbtn_linespc_adj = GTK_ADJUSTMENT(gtk_adjustment_new (2, 0, 16, 1, 1, 0));
	spinbtn_linespc = gtk_spin_button_new
		(GTK_ADJUSTMENT (spinbtn_linespc_adj), 1, 0);
	gtk_widget_show (spinbtn_linespc);
	gtk_box_pack_start (GTK_BOX (hbox_linespc), spinbtn_linespc,
			    FALSE, FALSE, 0);
	gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_linespc), TRUE);

	label_linespc = gtk_label_new (_("pixels"));
	gtk_widget_show (label_linespc);
	gtk_box_pack_start (GTK_BOX (hbox_linespc), label_linespc,
			    FALSE, FALSE, 0);
	gtk_widget_show_all (hbox1);

	vbox_scr = gtkut_get_options_frame(vbox1, &frame, _("Scroll"));

	PACK_CHECK_BUTTON(vbox_scr, checkbtn_halfpage, _("Half page"));

	hbox1 = gtk_hbox_new (FALSE, 32);
	gtk_widget_show (hbox1);
	gtk_box_pack_start (GTK_BOX (vbox_scr), hbox1, FALSE, TRUE, 0);

	PACK_CHECK_BUTTON(hbox1, checkbtn_smoothscroll, _("Smooth scroll"));

	hbox_scr = gtk_hbox_new (FALSE, 8);
	gtk_widget_show (hbox_scr);
	gtk_box_pack_start (GTK_BOX (hbox1), hbox_scr, FALSE, FALSE, 0);

	label_scr = gtk_label_new (_("Step"));
	gtk_widget_show (label_scr);
	gtk_box_pack_start (GTK_BOX (hbox_scr), label_scr, FALSE, FALSE, 0);

	spinbtn_scrollstep_adj = GTK_ADJUSTMENT(gtk_adjustment_new (1, 1, 100, 1, 10, 0));
	spinbtn_scrollstep = gtk_spin_button_new
		(GTK_ADJUSTMENT (spinbtn_scrollstep_adj), 1, 0);
	gtk_widget_show (spinbtn_scrollstep);
	gtk_box_pack_start (GTK_BOX (hbox_scr), spinbtn_scrollstep,
			    FALSE, FALSE, 0);
	gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_scrollstep),
				     TRUE);

	label_scr = gtk_label_new (_("pixels"));
	gtk_widget_show (label_scr);
	gtk_box_pack_start (GTK_BOX (hbox_scr), label_scr, FALSE, FALSE, 0);

	SET_TOGGLE_SENSITIVITY (checkbtn_smoothscroll, hbox_scr)

	PACK_CHECK_BUTTON(vbox1, checkbtn_attach_desc,
			  _("Show attachment descriptions (rather than names)"));

	/* quote chars */
	PACK_FRAME (vbox1, frame_quote, _("Quotation"));

	vbox_quote = gtk_vbox_new (FALSE, VSPACING_NARROW);
	gtk_widget_show (vbox_quote);
	gtk_container_add (GTK_CONTAINER (frame_quote), vbox_quote);
	gtk_container_set_border_width (GTK_CONTAINER (vbox_quote), 8);

	hbox1 = gtk_hbox_new (FALSE, 32);
	gtk_widget_show (hbox1);
	PACK_CHECK_BUTTON(vbox_quote, checkbtn_hide_quoted, _("Collapse quoted text on double click"));
	gtk_box_pack_start (GTK_BOX (vbox_quote), hbox1, FALSE, FALSE, 0);

	hbox2 = gtk_hbox_new (FALSE, 8);
	gtk_widget_show (hbox2);
	gtk_box_pack_start (GTK_BOX (hbox1), hbox2, FALSE, FALSE, 0);

	label_quote_chars = gtk_label_new (_("Treat these characters as quotation marks"));
	gtk_widget_show (label_quote_chars);
	gtk_box_pack_start (GTK_BOX (hbox2), label_quote_chars, FALSE, FALSE, 0);

	entry_quote_chars = gtk_entry_new ();
	gtk_widget_show (entry_quote_chars);
	gtk_box_pack_start (GTK_BOX (hbox2), entry_quote_chars,
			    FALSE, FALSE, 0);
	gtk_widget_set_size_request (entry_quote_chars, 64, -1);

	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_disphdrpane),
		prefs_common.display_header_pane);

	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_dispxface),
		prefs_common.display_xface);

	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_disphdr),
		prefs_common.display_header);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_html),
		prefs_common.render_html);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_html_plugin),
		prefs_common.invoke_plugin_on_html);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_promote_html_part),
		prefs_common.promote_html_part);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_smoothscroll),
		prefs_common.enable_smooth_scroll);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_hide_quoted),
		prefs_common.hide_quoted);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_halfpage),
		prefs_common.scroll_halfpage);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_attach_desc),
		prefs_common.attach_desc);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_linespc),
		prefs_common.line_space);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_scrollstep),
		prefs_common.scroll_step);
	gtk_entry_set_text(GTK_ENTRY(entry_quote_chars), 
			prefs_common.quote_chars?prefs_common.quote_chars:"");
		
	prefs_message->window = GTK_WIDGET(window);
	prefs_message->checkbtn_disphdrpane = checkbtn_disphdrpane;
	prefs_message->checkbtn_dispxface = checkbtn_dispxface;
	prefs_message->checkbtn_disphdr = checkbtn_disphdr;
	prefs_message->checkbtn_html = checkbtn_html;
	prefs_message->checkbtn_html_plugin = checkbtn_html_plugin;
	prefs_message->checkbtn_promote_html_part = checkbtn_promote_html_part;
	prefs_message->spinbtn_linespc = spinbtn_linespc;
	prefs_message->checkbtn_smoothscroll = checkbtn_smoothscroll;
	prefs_message->checkbtn_hide_quoted = checkbtn_hide_quoted;
	prefs_message->spinbtn_scrollstep = spinbtn_scrollstep;
	prefs_message->checkbtn_halfpage = checkbtn_halfpage;
	prefs_message->checkbtn_attach_desc = checkbtn_attach_desc;
	prefs_message->entry_quote_chars = entry_quote_chars;
	
	prefs_message->page.widget = vbox1;
}