Пример #1
0
static GtkWidget *create_checkbox(gchar *label, gchar *hint)
{
	GtkWidget *cb = gtk_check_button_new_with_mnemonic(label);
	CLAWS_SET_TIP(cb, hint);
	gtk_widget_show(cb);

	return cb;
}
Пример #2
0
static void imageviewer_create_widget_func(PrefsPage * _page,
					   GtkWindow * window,
					   gpointer data)
{
	ImageViewerPage *prefs_imageviewer = (ImageViewerPage *) _page;

	GtkWidget *table;
	GtkWidget *autoload_img;
	GtkWidget *resize_img;
	GtkWidget *inline_img;
	GtkWidget *print_imgs;

	table = gtk_table_new(4, 1, FALSE);
	gtk_widget_show(table);
	gtk_container_set_border_width(GTK_CONTAINER(table), VBOX_BORDER);
	gtk_table_set_row_spacings(GTK_TABLE(table), 4);
	gtk_table_set_col_spacings(GTK_TABLE(table), 8);

	autoload_img = gtk_check_button_new_with_label(_("Automatically display attached images"));
	gtk_widget_show(autoload_img);
	gtk_table_attach(GTK_TABLE(table), autoload_img, 0, 1, 0, 1,
			 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
			 (GtkAttachOptions) (0), 0, 0);

	resize_img = gtk_check_button_new_with_label(_("Resize attached images by default"));
	gtk_widget_show(resize_img);
	CLAWS_SET_TIP(resize_img,
			     _("Clicking image toggles scaling"));
	gtk_table_attach(GTK_TABLE(table), resize_img, 0, 1, 1, 2,
			 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
			 (GtkAttachOptions) (0), 0, 0);

	inline_img = gtk_check_button_new_with_label(_("Display images inline"));
	gtk_widget_show(inline_img);
	gtk_table_attach(GTK_TABLE(table), inline_img, 0, 1, 2, 3,
			 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
			 (GtkAttachOptions) (0), 0, 0);
	
	print_imgs = gtk_check_button_new_with_label(_("Print images"));
	gtk_widget_show(print_imgs);
	gtk_table_attach(GTK_TABLE(table), print_imgs, 0, 1, 3, 4,
			 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
			 (GtkAttachOptions) (0), 0, 0);
	
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resize_img), prefs_common.resize_img);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(autoload_img), prefs_common.display_img);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(inline_img), prefs_common.inline_img);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(print_imgs), prefs_common.print_imgs);

	prefs_imageviewer->window	= GTK_WIDGET(window);
	prefs_imageviewer->autoload_img = autoload_img;
	prefs_imageviewer->resize_img 	= resize_img;
	prefs_imageviewer->inline_img 	= inline_img;
	prefs_imageviewer->print_imgs 	= print_imgs;

	prefs_imageviewer->page.widget = table;
}
Пример #3
0
void noticeview_set_tooltip (NoticeView *noticeview, const gchar *text)
{
#if !(GTK_CHECK_VERSION(2,12,0))
	GtkTooltips *tips = noticeview->tooltips;
#endif
	CLAWS_SET_TIP(noticeview->evtbox,
			text);

}
Пример #4
0
static GtkWidget *labeled_spinner_box(gchar *label, GtkWidget *spinner, gchar *units, gchar *hint)
{
	GtkWidget *lbl, *lbla, *hbox;

	lbl = gtk_label_new(label);
	gtk_widget_show(lbl);
	lbla = gtk_label_new(units);
	gtk_widget_show(lbla);
	hbox = gtk_hbox_new(FALSE, 6);
	if (hint != NULL) {
		CLAWS_SET_TIP(spinner, hint);
	}
	gtk_box_pack_start(GTK_BOX(hbox), lbl, FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(hbox), spinner, FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(hbox), lbla, FALSE, FALSE, 0);

	return hbox;
}
Пример #5
0
void pluginwindow_create()
{
	PluginWindow *pluginwindow;
	GtkWidget *window;
	GtkWidget *vbox1;
	GtkWidget *hbox2;
	GtkWidget *scrolledwindow2;
	GtkWidget *plugin_list_view;
	GtkWidget *vbox2;
	GtkWidget *frame2;
	GtkWidget *label13;
	GtkWidget *scrolledwindow3;
	GtkWidget *plugin_desc;
	GtkWidget *hbuttonbox1;
	GtkWidget *hbuttonbox2;
	GtkWidget *help_btn;
	GtkWidget *load_btn;
	GtkWidget *unload_btn;
	GtkWidget *close_btn;
	gchar *markup, *span;
	GtkWidget *desc_lbl;
	GtkWidget *vbox3;
	GtkWidget *hbox_info;
	static GdkGeometry geometry;

	debug_print("Creating plugins window...\n");

	pluginwindow = g_new0(PluginWindow, 1);

	window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "pluginwindow");
	gtk_container_set_border_width(GTK_CONTAINER(window), 8);
	gtk_window_set_title(GTK_WINDOW(window), _("Plugins"));
	gtk_window_set_modal(GTK_WINDOW(window), TRUE);
	manage_window_set_transient(GTK_WINDOW(window));

	vbox1 = gtk_vbox_new(FALSE, 4);
	gtk_widget_show(vbox1);
	gtk_container_add(GTK_CONTAINER(window), vbox1);
	gtk_box_set_homogeneous(GTK_BOX(vbox1), FALSE);
	gtk_widget_realize(window);

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

	vbox3 = gtk_vbox_new(FALSE, 4);
	gtk_widget_show(vbox3);
	gtk_box_pack_start(GTK_BOX(hbox2), vbox3, FALSE, FALSE, 0);

	scrolledwindow2 = gtk_scrolled_window_new(NULL, NULL);
	gtk_widget_show(scrolledwindow2);
	gtk_box_pack_start(GTK_BOX(vbox3), scrolledwindow2, TRUE, TRUE, 0);
	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow2),
					GTK_SHADOW_ETCHED_IN);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW
				       (scrolledwindow2), GTK_POLICY_NEVER,
				       GTK_POLICY_AUTOMATIC);

	plugin_list_view = pluginwindow_list_view_create(pluginwindow);
	gtk_widget_show(plugin_list_view);
	gtk_container_add(GTK_CONTAINER(scrolledwindow2), plugin_list_view);
	gtk_widget_grab_focus(GTK_WIDGET(plugin_list_view));

	gtkut_stock_button_set_create(&hbuttonbox1,
				&load_btn, _("_Load..."),
				&unload_btn, _("_Unload"),
				NULL, NULL);
	gtk_widget_show(hbuttonbox1);
	gtk_box_pack_start(GTK_BOX(vbox3), hbuttonbox1, FALSE, FALSE, 0);
	
	vbox2 = gtk_vbox_new(FALSE, 0);
	gtk_widget_show(vbox2);
	gtk_box_pack_start(GTK_BOX(hbox2), vbox2, TRUE, TRUE, 0);

	frame2 = gtk_frame_new(NULL);
	gtk_frame_set_shadow_type(GTK_FRAME(frame2), GTK_SHADOW_OUT);
	gtk_widget_show(frame2);
	gtk_box_pack_start(GTK_BOX(vbox2), frame2, FALSE, TRUE, 0);

	label13 = gtk_label_new(_("Description"));
	gtk_widget_show(label13);
	gtk_container_add(GTK_CONTAINER(frame2), label13);
	gtk_misc_set_alignment(GTK_MISC(label13), 0, 0.5);
	gtk_misc_set_padding(GTK_MISC(label13), 2, 2);

	scrolledwindow3 = gtk_scrolled_window_new(NULL, NULL);
	gtk_widget_show(scrolledwindow3);
	gtk_box_pack_start(GTK_BOX(vbox2), scrolledwindow3, TRUE, TRUE, 0);
	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow3),
					GTK_SHADOW_ETCHED_IN);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW
				       (scrolledwindow3), GTK_POLICY_NEVER,
				       GTK_POLICY_ALWAYS);

	plugin_desc = gtk_text_view_new();
	gtk_widget_show(plugin_desc);
	gtk_container_add(GTK_CONTAINER(scrolledwindow3), plugin_desc);

	hbox_info = gtk_hbox_new(FALSE, 5);
	gtk_widget_show(hbox_info);
	
	desc_lbl = gtk_label_new("");
	span = g_strdup_printf("<a href=\"%s\"><span underline=\"none\">", PLUGINS_URI);
	markup = g_strdup_printf(_("For more information about plugins see the "
					   "%sClaws Mail website%s."), span, "</span></a>");
	gtk_label_set_markup(GTK_LABEL(desc_lbl), markup);
	g_free(markup);
	g_free(span);
	gtk_misc_set_alignment(GTK_MISC(desc_lbl), 0, 0.5);
	gtk_widget_show(desc_lbl);
	gtk_box_pack_start(GTK_BOX(hbox_info), desc_lbl, FALSE, FALSE, 0);

	gtk_box_pack_start(GTK_BOX(hbox_info), gtk_label_new(""), TRUE, TRUE, 0);
	gtk_box_pack_start(GTK_BOX(vbox1), hbox_info, FALSE, FALSE, 0);

	gtkut_stock_button_set_create_with_help(&hbuttonbox2, &help_btn,
			&close_btn, GTK_STOCK_CLOSE,
			NULL, NULL, NULL, NULL);

	gtk_box_set_spacing(GTK_BOX(hbuttonbox2), 6);
	gtk_widget_show(hbuttonbox2);
	gtk_box_pack_end(GTK_BOX(vbox1), hbuttonbox2, FALSE, FALSE, 0);

	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(plugin_desc), GTK_WRAP_WORD);
	gtk_widget_set_sensitive(GTK_WIDGET(unload_btn), FALSE);

	g_signal_connect(G_OBJECT(help_btn), "clicked",
			 G_CALLBACK(manual_open_with_anchor_cb),
			 MANUAL_ANCHOR_PLUGINS);
	g_signal_connect(G_OBJECT(load_btn), "clicked",
			 G_CALLBACK(load_cb), pluginwindow);
	g_signal_connect(G_OBJECT(unload_btn), "clicked",
			 G_CALLBACK(unload_cb), pluginwindow);
	g_signal_connect(G_OBJECT(close_btn), "clicked",
			 G_CALLBACK(close_cb), pluginwindow);
	g_signal_connect(G_OBJECT(window), "size_allocate",
			 G_CALLBACK(pluginwindow_size_allocate_cb), NULL);
	g_signal_connect(G_OBJECT(window), "key_press_event",
			   G_CALLBACK(pluginwindow_key_pressed), pluginwindow);
	g_signal_connect(G_OBJECT(window), "delete_event",
			 G_CALLBACK(pluginwindow_delete_cb), pluginwindow);
	MANAGE_WINDOW_SIGNALS_CONNECT(window);

	CLAWS_SET_TIP(load_btn,
			_("Click here to load one or more plugins"));

	CLAWS_SET_TIP(unload_btn,
			_("Unload the selected plugin"));

	pluginwindow->window = window;
	pluginwindow->plugin_list_view = plugin_list_view;
	pluginwindow->plugin_desc = plugin_desc;
	pluginwindow->unload_btn = unload_btn;
	pluginwindow->selected_plugin = NULL;

	set_plugin_list(pluginwindow);

	inc_lock();

	if (!geometry.min_height) {
		geometry.min_width = -1;
		geometry.min_height = 300;
	}

	gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
				      GDK_HINT_MIN_SIZE);
	gtk_window_set_default_size(GTK_WINDOW(window), prefs_common.pluginswin_width,
				    prefs_common.pluginswin_height);

	gtk_widget_show(window);
}
Пример #6
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;
}
Пример #7
0
static void prefs_actions_create(MainWindow *mainwin)
{
	GtkWidget *window;
	GtkWidget *vbox;
	GtkWidget *filter_hbox;
	GtkWidget *help_btn;
	GtkWidget *ok_btn;
	GtkWidget *cancel_btn;
	GtkWidget *confirm_area;

	GtkWidget *vbox1;
	GtkWidget *table;

	GtkWidget *shell_radiobtn;
	GtkWidget *filter_radiobtn;

	GtkWidget *name_label;
	GtkWidget *name_entry;
	GtkWidget *cmd_label;
	GtkWidget *cmd_entry;
	GtkWidget *filter_btn;

	GtkWidget *reg_hbox;
	GtkWidget *btn_hbox;
	GtkWidget *arrow;
	GtkWidget *reg_btn;
	GtkWidget *subst_btn;
	GtkWidget *del_btn;
	GtkWidget *clear_btn;

	GtkWidget *cond_hbox;
	GtkWidget *cond_scrolledwin;
	GtkWidget *cond_list_view;

	GtkWidget *info_btn;

	GtkWidget *btn_vbox;
	GtkWidget *up_btn;
	GtkWidget *down_btn;
	static GdkGeometry geometry;

	debug_print("Creating actions configuration window...\n");

	window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefs_actions");

	gtk_container_set_border_width(GTK_CONTAINER (window), 8);
	gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
	gtk_window_set_resizable(GTK_WINDOW(window), TRUE);

	vbox = gtk_vbox_new(FALSE, 6);
	gtk_widget_show(vbox);
	gtk_container_add(GTK_CONTAINER(window), vbox);

	gtkut_stock_button_set_create_with_help(&confirm_area, &help_btn,
			&cancel_btn, GTK_STOCK_CANCEL,
			&ok_btn, GTK_STOCK_OK,
			NULL, NULL);
	gtk_widget_show(confirm_area);
	gtk_box_pack_end(GTK_BOX(vbox), confirm_area, FALSE, FALSE, 0);
	gtk_widget_grab_default(ok_btn);

	gtk_window_set_title(GTK_WINDOW(window), _("Actions configuration"));
	g_signal_connect(G_OBJECT(window), "delete_event",
			 G_CALLBACK(prefs_actions_deleted), NULL);
	g_signal_connect(G_OBJECT(window), "size_allocate",
			 G_CALLBACK(prefs_actions_size_allocate_cb), NULL);
	g_signal_connect(G_OBJECT(window), "key_press_event",
			 G_CALLBACK(prefs_actions_key_pressed), NULL);
	MANAGE_WINDOW_SIGNALS_CONNECT(window);
	g_signal_connect(G_OBJECT(ok_btn), "clicked",
			 G_CALLBACK(prefs_actions_ok), mainwin);
	g_signal_connect(G_OBJECT(cancel_btn), "clicked",
			 G_CALLBACK(prefs_actions_cancel), NULL);
	g_signal_connect(G_OBJECT(help_btn), "clicked",
			 G_CALLBACK(manual_open_with_anchor_cb),
			 MANUAL_ANCHOR_ACTIONS);

	vbox1 = gtk_vbox_new(FALSE, VSPACING);
	gtk_widget_show(vbox1);
	gtk_box_pack_start(GTK_BOX(vbox), vbox1, TRUE, TRUE, 0);
	gtk_container_set_border_width(GTK_CONTAINER(vbox1), 2);	

	table = gtk_table_new(3, 2, FALSE);
	gtk_table_set_row_spacings (GTK_TABLE (table), VSPACING_NARROW_2);
	gtk_table_set_col_spacings (GTK_TABLE (table), 4);
	gtk_widget_show(table);
	gtk_box_pack_start (GTK_BOX (vbox1), table, FALSE, FALSE, 0);

	name_label = gtk_label_new (_("Menu name"));
	gtk_widget_show (name_label);
	gtk_misc_set_alignment (GTK_MISC (name_label), 1, 0.5);
  	gtk_table_attach (GTK_TABLE (table), name_label, 0, 1, 0, 1,
                    	  (GtkAttachOptions) (GTK_FILL),
                    	  (GtkAttachOptions) (0), 0, 0);

	name_entry = gtk_entry_new ();
	gtk_widget_show (name_entry);
  	gtk_table_attach (GTK_TABLE (table), name_entry, 1, 2, 0, 1,
                    	  (GtkAttachOptions) (GTK_FILL|GTK_EXPAND),
			  (GtkAttachOptions) (0), 0, 0);

	cmd_label = gtk_label_new (_("Command"));
	gtk_widget_show (cmd_label);
	gtk_misc_set_alignment (GTK_MISC (cmd_label), 1, 0.5);
  	gtk_table_attach (GTK_TABLE (table), cmd_label, 0, 1, 2, 3,
                    	  (GtkAttachOptions) (GTK_FILL),
                    	  (GtkAttachOptions) (0), 0, 0);

	cmd_entry = gtk_entry_new ();
	gtk_widget_show (cmd_entry);
  	gtk_table_attach (GTK_TABLE (table), cmd_entry, 1, 2, 2, 3,
                    	  (GtkAttachOptions) (GTK_FILL|GTK_EXPAND),
                    	  (GtkAttachOptions) (0), 0, 0);

	/* radio buttons for filter actions or shell */
	filter_hbox = gtk_hbox_new(FALSE,4);
	gtk_table_attach(GTK_TABLE(table), filter_hbox, 1, 2, 3, 4,
                    	  (GtkAttachOptions) (GTK_FILL|GTK_EXPAND),
			  (GtkAttachOptions) (0), 0, 0);
	gtk_widget_show(filter_hbox);

	shell_radiobtn = gtk_radio_button_new_with_label(NULL, _("Shell command"));
	gtk_box_pack_start(GTK_BOX(filter_hbox), shell_radiobtn, FALSE, FALSE, 0);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(shell_radiobtn), TRUE);
	gtk_widget_show(shell_radiobtn);
	
	g_signal_connect(G_OBJECT(shell_radiobtn), "clicked",
			 G_CALLBACK(prefs_action_shell_radiobtn_cb), NULL);

	filter_radiobtn =
		gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(shell_radiobtn), 
							    _("Filter action"));
	gtk_box_pack_start(GTK_BOX(filter_hbox), filter_radiobtn, FALSE, FALSE, 0);
	gtk_widget_show(filter_radiobtn);
	g_signal_connect(G_OBJECT(filter_radiobtn), "clicked",
			 G_CALLBACK(prefs_action_filter_radiobtn_cb), NULL);

	filter_btn = gtk_button_new_with_label(_("Edit filter action"));
	gtk_box_pack_start(GTK_BOX(filter_hbox), filter_btn, FALSE, FALSE, 0);
	gtk_widget_set_sensitive(filter_btn, FALSE);
	g_signal_connect(G_OBJECT(filter_btn), "clicked",
			 G_CALLBACK(prefs_action_filterbtn_cb), NULL);
	gtk_widget_show(filter_btn);

	/* register / substitute / delete */

	reg_hbox = gtk_hbox_new(FALSE, 4);
	gtk_widget_show(reg_hbox);
	gtk_box_pack_start(GTK_BOX(vbox1), reg_hbox, FALSE, FALSE, 0);

	arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_OUT);
	gtk_widget_show(arrow);
	gtk_box_pack_start(GTK_BOX(reg_hbox), arrow, FALSE, FALSE, 0);
	gtk_widget_set_size_request(arrow, -1, 16);

	btn_hbox = gtk_hbox_new(TRUE, 4);
	gtk_widget_show(btn_hbox);
	gtk_box_pack_start(GTK_BOX(reg_hbox), btn_hbox, FALSE, FALSE, 0);

	reg_btn = gtk_button_new_from_stock(GTK_STOCK_ADD);
	gtk_widget_show(reg_btn);
	gtk_box_pack_start(GTK_BOX(btn_hbox), reg_btn, FALSE, TRUE, 0);
	g_signal_connect(G_OBJECT(reg_btn), "clicked",
			 G_CALLBACK(prefs_actions_register_cb), NULL);
	CLAWS_SET_TIP(reg_btn,
			_("Append the new action above to the list"));

	subst_btn = gtkut_get_replace_btn(_("_Replace"));
	gtk_widget_show(subst_btn);
	gtk_box_pack_start(GTK_BOX(btn_hbox), subst_btn, FALSE, TRUE, 0);
	g_signal_connect(G_OBJECT(subst_btn), "clicked",
			 G_CALLBACK(prefs_actions_substitute_cb), NULL);
	CLAWS_SET_TIP(subst_btn,
			_("Replace the selected action in list with the action above"));

	del_btn = gtk_button_new_with_mnemonic (_("Re_move"));
	gtk_button_set_image(GTK_BUTTON(del_btn),
			gtk_image_new_from_stock(GTK_STOCK_REMOVE,GTK_ICON_SIZE_BUTTON));
	gtk_widget_show(del_btn);
	gtk_box_pack_start(GTK_BOX(btn_hbox), del_btn, FALSE, TRUE, 0);
	g_signal_connect(G_OBJECT(del_btn), "clicked",
			 G_CALLBACK(prefs_actions_delete_cb), NULL);
	CLAWS_SET_TIP(del_btn,
			_("Delete the selected action from the list"));

	clear_btn = gtk_button_new_with_mnemonic (_("C_lear"));
	gtk_button_set_image(GTK_BUTTON(clear_btn),
			gtk_image_new_from_stock(GTK_STOCK_CLEAR,GTK_ICON_SIZE_BUTTON));
	gtk_widget_show (clear_btn);
	gtk_box_pack_start (GTK_BOX (btn_hbox), clear_btn, FALSE, TRUE, 0);
	g_signal_connect(G_OBJECT (clear_btn), "clicked",
			G_CALLBACK(prefs_actions_clear_cb), NULL);
	CLAWS_SET_TIP(clear_btn,
			_("Clear all the input fields in the dialog"));

	info_btn = gtk_button_new_from_stock(GTK_STOCK_INFO);
	gtk_widget_show(info_btn);
	gtk_box_pack_end(GTK_BOX(reg_hbox), info_btn, FALSE, FALSE, 0);
	g_signal_connect(G_OBJECT(info_btn), "clicked",
			 G_CALLBACK(prefs_actions_info_cb), GTK_WINDOW(window));
	CLAWS_SET_TIP(info_btn,
			_("Show information on configuring actions"));

	cond_hbox = gtk_hbox_new(FALSE, 8);
	gtk_widget_show(cond_hbox);
	gtk_box_pack_start(GTK_BOX(vbox1), cond_hbox, TRUE, TRUE, 0);

	cond_scrolledwin = gtk_scrolled_window_new(NULL, NULL);
	gtk_widget_show(cond_scrolledwin);
	gtk_widget_set_size_request(cond_scrolledwin, -1, 150);
	gtk_box_pack_start(GTK_BOX(cond_hbox), cond_scrolledwin,
			   TRUE, TRUE, 0);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (cond_scrolledwin),
				       GTK_POLICY_AUTOMATIC,
				       GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(cond_scrolledwin),
					    GTK_SHADOW_ETCHED_IN);

	cond_list_view = prefs_actions_list_view_create();				       
	gtk_widget_show(cond_list_view);
	gtk_container_add(GTK_CONTAINER (cond_scrolledwin), cond_list_view);

	btn_vbox = gtk_vbox_new(FALSE, 8);
	gtk_widget_show(btn_vbox);
	gtk_box_pack_start(GTK_BOX(cond_hbox), btn_vbox, FALSE, FALSE, 0);

	up_btn = gtk_button_new_from_stock(GTK_STOCK_GO_UP);
	gtk_widget_show(up_btn);
	gtk_box_pack_start(GTK_BOX(btn_vbox), up_btn, FALSE, FALSE, 0);
	g_signal_connect(G_OBJECT(up_btn), "clicked",
			 G_CALLBACK(prefs_actions_up), NULL);
	CLAWS_SET_TIP(up_btn,
			_("Move the selected action up"));

	down_btn = gtk_button_new_from_stock(GTK_STOCK_GO_DOWN);
	gtk_widget_show(down_btn);
	gtk_box_pack_start(GTK_BOX(btn_vbox), down_btn, FALSE, FALSE, 0);
	g_signal_connect(G_OBJECT(down_btn), "clicked",
			 G_CALLBACK(prefs_actions_down), NULL);
	CLAWS_SET_TIP(down_btn,
			_("Move selected action down"));

	if (!geometry.min_height) {
		geometry.min_width = 486;
		geometry.min_height = 322;
	}

	gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
				      GDK_HINT_MIN_SIZE);
	gtk_widget_set_size_request(window, prefs_common.actionswin_width,
				    prefs_common.actionswin_height);

	gtk_widget_show(window);

	actions.window = window;
	actions.ok_btn = ok_btn;
	actions.info_btn = info_btn;

	actions.name_entry = name_entry;
	actions.cmd_entry  = cmd_entry;
	actions.filter_btn = filter_btn;
	actions.shell_radiobtn = shell_radiobtn;
	actions.filter_radiobtn = filter_radiobtn;
	
	actions.actions_list_view = cond_list_view;
}
Пример #8
0
static void create_rssyl_prefs_page(PrefsPage *page,
		GtkWindow *window, gpointer data)
{
	RSSylPrefsPage *prefs_page = (RSSylPrefsPage *) page;
	GtkWidget *table;
	GtkWidget *refresh;
	GtkWidget *expired;
	GtkWidget *refresh_on_startup;
	GtkWidget *cookies_path;
	GtkWidget *label;
	GtkObject *refresh_adj, *expired_adj;

	table = gtk_table_new(RSSYL_NUM_PREFS, 2, FALSE);
	gtk_container_set_border_width(GTK_CONTAINER(table), 5);
	gtk_table_set_row_spacings(GTK_TABLE(table), VSPACING_NARROW);
	gtk_table_set_col_spacings(GTK_TABLE(table), 8);

	label = gtk_label_new(_("Default refresh interval in minutes"));
	gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
			GTK_FILL, 0, 0, 0);

	refresh_adj = gtk_adjustment_new(rssyl_prefs.refresh,
			0, 100000, 1, 10, 0);
	refresh = gtk_spin_button_new(GTK_ADJUSTMENT(refresh_adj), 1, 0);
	gtk_table_attach(GTK_TABLE(table), refresh, 1, 2, 0, 1,
			GTK_FILL, 0, 0, 0);
	CLAWS_SET_TIP(refresh,
			_("Set to 0 to disable automatic refreshing"));

	label = gtk_label_new(_("Default number of expired items to keep"));
	gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2,
			GTK_FILL, 0, 0, 0);

	expired_adj = gtk_adjustment_new(rssyl_prefs.expired,
			-1, 100000, 1, 10, 0);
	expired = gtk_spin_button_new(GTK_ADJUSTMENT(expired_adj), 1, 0);
	gtk_table_attach(GTK_TABLE(table), expired, 1, 2, 1, 2,
			GTK_FILL, 0, 0, 0);
	CLAWS_SET_TIP(expired,
			_("Set to -1 to keep expired items"));

	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_table_attach(GTK_TABLE(table), refresh_on_startup, 0, 2, 3, 4,
			GTK_FILL | GTK_EXPAND, 0, 0, 0);

	label = gtk_label_new(_("Path to cookies file"));
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5,
			GTK_FILL, 0, 0, 0);
	gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);

	cookies_path = gtk_entry_new ();
	gtk_entry_set_text(GTK_ENTRY(cookies_path), rssyl_prefs.cookies_path);
	gtk_table_attach(GTK_TABLE(table), cookies_path, 1, 2, 4, 5,
			GTK_FILL | GTK_EXPAND, 0, 0, 0);
	CLAWS_SET_TIP(cookies_path,
			_("Path to Netscape-style cookies.txt file containing your cookies"));

	gtk_widget_show_all(table);

	prefs_page->page.widget = table;
	prefs_page->refresh = refresh;
	prefs_page->expired = expired;
	prefs_page->refresh_on_startup = refresh_on_startup;
	prefs_page->cookies_path = cookies_path;
}
Пример #9
0
static void bsfilter_create_widget_func(PrefsPage * _page,
					    GtkWindow * window,
					    gpointer data)
{
	struct BsfilterPage *page = (struct BsfilterPage *) _page;
	BsfilterConfig *config;

	GtkWidget *vbox1, *vbox2;
	GtkWidget *hbox_max_size;
	GtkWidget *hbox_process_emails, *hbox_save_spam;
	GtkWidget *hbox_bspath, *hbox_whitelist;
	GtkWidget *hbox_mark_as_read;

	GtkWidget *max_size_label;
	GtkObject *max_size_spinbtn_adj;
	GtkWidget *max_size_spinbtn;
	GtkWidget *max_size_kb_label;

	GtkWidget *process_emails_checkbtn;

	GtkWidget *save_spam_checkbtn;
	GtkWidget *save_spam_folder_entry;
	GtkWidget *save_spam_folder_select;

	GtkWidget *whitelist_ab_checkbtn;
	GtkWidget *learn_from_whitelist_chkbtn;
	GtkWidget *bspath_label;
	GtkWidget *bspath_entry;

	GtkWidget *mark_as_read_checkbtn;

	GtkWidget *whitelist_ab_folder_combo;
	GtkWidget *whitelist_ab_select_btn;

	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);

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

	process_emails_checkbtn = gtk_check_button_new_with_label(
			_("Process messages on receiving"));
	gtk_widget_show(process_emails_checkbtn);
	gtk_box_pack_start(GTK_BOX(hbox_process_emails), process_emails_checkbtn, TRUE, TRUE, 0);

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

	max_size_label = gtk_label_new(_("Maximum size"));
	gtk_widget_show(max_size_label);
	gtk_box_pack_start(GTK_BOX(hbox_max_size), max_size_label, FALSE, FALSE, 0);

	max_size_spinbtn_adj = gtk_adjustment_new(250, 0, 10000, 10, 10, 0);
	max_size_spinbtn = gtk_spin_button_new(GTK_ADJUSTMENT(max_size_spinbtn_adj), 1, 0);
	gtk_widget_show(max_size_spinbtn);
	gtk_box_pack_start(GTK_BOX(hbox_max_size), max_size_spinbtn, FALSE, FALSE, 0);
	CLAWS_SET_TIP(max_size_spinbtn,
			_("Messages larger than this will not be checked"));
	gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(max_size_spinbtn), TRUE);

	max_size_kb_label = gtk_label_new(_("KB"));
	gtk_widget_show(max_size_kb_label);
	gtk_box_pack_start(GTK_BOX(hbox_max_size), max_size_kb_label, FALSE, FALSE, 0);

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

	save_spam_checkbtn = gtk_check_button_new_with_label(_("Save spam in"));
	gtk_widget_show(save_spam_checkbtn);
	gtk_box_pack_start(GTK_BOX(hbox_save_spam), save_spam_checkbtn, FALSE, FALSE, 0);

	save_spam_folder_entry = gtk_entry_new();
	gtk_widget_show (save_spam_folder_entry);
	gtk_box_pack_start (GTK_BOX (hbox_save_spam), save_spam_folder_entry, TRUE, TRUE, 0);
	CLAWS_SET_TIP(save_spam_folder_entry,
			_("Folder for storing identified spam. Leave empty to use the trash folder."));

	save_spam_folder_select = gtkut_get_browse_directory_btn(_("_Browse"));
	gtk_widget_show (save_spam_folder_select);
	gtk_box_pack_start (GTK_BOX (hbox_save_spam), save_spam_folder_select, FALSE, FALSE, 0);
	CLAWS_SET_TIP(save_spam_folder_select,
			_("Click this button to select a folder for storing spam"));

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

	whitelist_ab_checkbtn = gtk_check_button_new_with_label(_("Whitelist senders found in address book/folder"));
	gtk_widget_show(whitelist_ab_checkbtn);
	gtk_box_pack_start(GTK_BOX(hbox_whitelist), whitelist_ab_checkbtn, FALSE, FALSE, 0);
	CLAWS_SET_TIP(whitelist_ab_checkbtn,
			_("Messages coming from your address book contacts will be received in the normal folder even if detected as spam"));

	whitelist_ab_folder_combo = combobox_text_new(TRUE, _("Any"), NULL);
	gtk_widget_set_size_request(whitelist_ab_folder_combo, 100, -1);
	gtk_box_pack_start (GTK_BOX (hbox_whitelist), whitelist_ab_folder_combo, TRUE, TRUE, 0);

	whitelist_ab_select_btn = gtk_button_new_with_label(_("Select..."));
	gtk_widget_show (whitelist_ab_select_btn);
	gtk_box_pack_start (GTK_BOX (hbox_whitelist), whitelist_ab_select_btn, FALSE, FALSE, 0);
	CLAWS_SET_TIP(whitelist_ab_select_btn,
			_("Click this button to select a book or folder in the address book"));

	learn_from_whitelist_chkbtn = gtk_check_button_new_with_label(_("Learn whitelisted emails as ham"));
	CLAWS_SET_TIP(learn_from_whitelist_chkbtn,
			_("If Bsfilter thought an email was spam or unsure, but it was whitelisted, "
			  "learn it as ham."));
	gtk_widget_show(learn_from_whitelist_chkbtn);
	gtk_box_pack_start (GTK_BOX (vbox2), learn_from_whitelist_chkbtn, TRUE, TRUE, 0);

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

	bspath_label = gtk_label_new(_("Bsfilter call"));
	gtk_widget_show(bspath_label);
	gtk_box_pack_start(GTK_BOX(hbox_bspath), bspath_label, FALSE, FALSE, 0);

	bspath_entry = gtk_entry_new();
	gtk_widget_show(bspath_entry);
	gtk_box_pack_start(GTK_BOX(hbox_bspath), bspath_entry, FALSE, FALSE, 0);
	CLAWS_SET_TIP(bspath_entry,
			_("Path to bsfilter executable"));

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

	mark_as_read_checkbtn = gtk_check_button_new_with_label(_("Mark spam as read"));
	gtk_widget_show(mark_as_read_checkbtn);
	gtk_box_pack_start(GTK_BOX(hbox_mark_as_read), mark_as_read_checkbtn, FALSE, FALSE, 0);

	SET_TOGGLE_SENSITIVITY(save_spam_checkbtn, save_spam_folder_entry);
	SET_TOGGLE_SENSITIVITY(save_spam_checkbtn, save_spam_folder_select);
	SET_TOGGLE_SENSITIVITY(whitelist_ab_checkbtn, whitelist_ab_folder_combo);
	SET_TOGGLE_SENSITIVITY(whitelist_ab_checkbtn, whitelist_ab_select_btn);
	SET_TOGGLE_SENSITIVITY(whitelist_ab_checkbtn, learn_from_whitelist_chkbtn);
	SET_TOGGLE_SENSITIVITY(save_spam_checkbtn, mark_as_read_checkbtn);

	config = bsfilter_get_config();

	g_signal_connect(G_OBJECT(save_spam_folder_select), "clicked",
			G_CALLBACK(foldersel_cb), save_spam_folder_entry);
#ifndef USE_ALT_ADDRBOOK
	g_signal_connect(G_OBJECT (whitelist_ab_select_btn), "clicked",
			 G_CALLBACK(bsfilter_whitelist_ab_select_cb), page);
#else
	gtk_widget_set_sensitive(whitelist_ab_select_btn, FALSE);
#endif

	gtk_spin_button_set_value(GTK_SPIN_BUTTON(max_size_spinbtn), (float) config->max_size);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(process_emails_checkbtn), config->process_emails);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(save_spam_checkbtn), config->receive_spam);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(whitelist_ab_checkbtn), config->whitelist_ab);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(learn_from_whitelist_chkbtn), config->learn_from_whitelist);
	if (config->whitelist_ab_folder != NULL) {
		/* translate "Any" (stored UNtranslated) */
		if (strcasecmp(config->whitelist_ab_folder, "Any") == 0)
			gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((whitelist_ab_folder_combo)))),
					config->whitelist_ab_folder);
		else
		/* backward compatibility (when translated "Any" was stored) */
		if (g_utf8_collate(config->whitelist_ab_folder, _("Any")) == 0)
			gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((whitelist_ab_folder_combo)))),
					config->whitelist_ab_folder);
		else
			gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((whitelist_ab_folder_combo)))),
					config->whitelist_ab_folder);
	}
	if (config->save_folder != NULL)
		gtk_entry_set_text(GTK_ENTRY(save_spam_folder_entry), config->save_folder);
	if (config->bspath != NULL)
		gtk_entry_set_text(GTK_ENTRY(bspath_entry), config->bspath);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mark_as_read_checkbtn), config->mark_as_read);

	page->max_size = max_size_spinbtn;
	page->process_emails = process_emails_checkbtn;

	page->receive_spam = save_spam_checkbtn;
	page->save_folder = save_spam_folder_entry;
	page->save_folder_select = save_spam_folder_select;

	page->whitelist_ab = whitelist_ab_checkbtn;
	page->whitelist_ab_folder_combo = whitelist_ab_folder_combo;
	page->learn_from_whitelist_chkbtn = learn_from_whitelist_chkbtn;
	page->bspath = bspath_entry;

	page->mark_as_read = mark_as_read_checkbtn;

	page->page.widget = vbox1;
}
Пример #10
0
/**
 * Format notebook fields page.
 * \param pageNum Page (tab) number.
 * \param pageLbl Page (tab) label.
 */
static void imp_ldif_page_fields( gint pageNum, gchar *pageLbl ) {
	GtkWidget *vbox;
	GtkWidget *vboxt;
	GtkWidget *vboxb;
	GtkWidget *table;
	GtkWidget *label;
	GtkWidget *clist_swin;
	GtkWidget *clist_field;
	GtkWidget *entryField;
	GtkWidget *entryAttrib;
	GtkWidget *checkSelect;
	GtkWidget *btnModify;
	GtkWidget *eventBox;
	gint top;

	gchar *titles[ FIELDS_N_COLS ];
	gint i;

	titles[ FIELD_COL_RESERVED ] = _("R");
	titles[ FIELD_COL_SELECT   ] = _("S");
	titles[ FIELD_COL_FIELD    ] = _("LDIF Field Name");
	titles[ FIELD_COL_ATTRIB   ] = _("Attribute Name");

	vbox = gtk_vbox_new(FALSE, 8);
	gtk_container_add( GTK_CONTAINER( impldif_dlg.notebook ), vbox );
	gtk_container_set_border_width( GTK_CONTAINER (vbox), 4 );

	label = gtk_label_new( pageLbl );
	gtk_widget_show( label );
	gtk_notebook_set_tab_label(
		GTK_NOTEBOOK( impldif_dlg.notebook ),
		gtk_notebook_get_nth_page(GTK_NOTEBOOK( impldif_dlg.notebook ), pageNum ),
		label );

	/* Upper area - Field list */
	vboxt = gtk_vbox_new( FALSE, 4 );
	gtk_container_add( GTK_CONTAINER( vbox ), vboxt );

	clist_swin = gtk_scrolled_window_new( NULL, NULL );
	gtk_container_add( GTK_CONTAINER(vboxt), clist_swin );
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(clist_swin),
				       GTK_POLICY_AUTOMATIC,
				       GTK_POLICY_AUTOMATIC);

	clist_field = gtk_cmclist_new_with_titles( FIELDS_N_COLS, titles );
	gtk_container_add( GTK_CONTAINER(clist_swin), clist_field );
	gtk_cmclist_set_selection_mode(
		GTK_CMCLIST(clist_field), GTK_SELECTION_BROWSE );
	gtk_cmclist_set_column_width( GTK_CMCLIST(clist_field),
		FIELD_COL_RESERVED, FIELDS_COL_WIDTH_RESERVED );
	gtk_cmclist_set_column_width( GTK_CMCLIST(clist_field),
		FIELD_COL_SELECT, FIELDS_COL_WIDTH_SELECT );
	gtk_cmclist_set_column_width( GTK_CMCLIST(clist_field),
		FIELD_COL_FIELD, FIELDS_COL_WIDTH_FIELD );
	gtk_cmclist_set_column_width( GTK_CMCLIST(clist_field),
		FIELD_COL_ATTRIB, FIELDS_COL_WIDTH_ATTRIB );

	/* Remove focus capability for column headers */
	for( i = 0; i < FIELDS_N_COLS; i++ ) {
		gtkut_widget_set_can_focus(
			GTK_CMCLIST(clist_field)->column[i].button,
			FALSE);
	}

	/* Lower area - Edit area */
	vboxb = gtk_vbox_new( FALSE, 4 );
	gtk_box_pack_end(GTK_BOX(vbox), vboxb, FALSE, FALSE, 2);

	/* Data entry area */
	table = gtk_table_new( 3, 3, FALSE);
	gtk_box_pack_start(GTK_BOX(vboxb), table, FALSE, FALSE, 0);
	gtk_table_set_row_spacings(GTK_TABLE(table), 4);
	gtk_table_set_col_spacings(GTK_TABLE(table), 4);

	/* First row */
	top = 0;
	label = gtk_label_new(_("LDIF Field"));
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1),
		GTK_FILL, 0, 0, 0);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);

	entryField = gtk_label_new( "" );
	gtk_misc_set_alignment(GTK_MISC(entryField), 0.01, 0.5);
	gtk_table_attach(GTK_TABLE(table), entryField, 1, 3, top, (top + 1),
		GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);

	/* Second row */
	++top;
	label = gtk_label_new(_("Attribute"));
	/*
	 * Use an event box to attach some help in the form of a tooltip.
	 * Tried this for the clist but it looked bad.
	 */
	eventBox = gtk_event_box_new();
	gtk_container_add( GTK_CONTAINER(eventBox), label );
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
	gtk_table_attach(GTK_TABLE(table), eventBox, 0, 1, top, (top + 1),
		GTK_FILL, 0, 0, 0);

	CLAWS_SET_TIP(eventBox, _(
		"Choose the LDIF field that will be renamed or selected " \
		"for import in the list above. Reserved fields (marked " \
		"with a tick in the \"R\" column), are automatically " \
		"imported and cannot be renamed. A single click in the " \
		"Select (\"S\") column will select the field for import " \
		"with a tick. A single click anywhere in the row will " \
		"select that field for rename in the input area below " \
		"the list. A double click anywhere in the row will also " \
		"select the field for import."));

	entryAttrib = gtk_entry_new();
	gtk_table_attach(GTK_TABLE(table), entryAttrib, 1, 3, top, (top + 1),
		GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);

	CLAWS_SET_TIP(entryAttrib,
		_( "The LDIF field can be renamed to the User Attribute name." ));

	/* Next row */
	++top;

	checkSelect = gtk_check_button_new_with_label( _( "Select for Import" ) );
	gtk_table_attach(GTK_TABLE(table), checkSelect, 1, 2, top, (top + 1),
		GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);

	CLAWS_SET_TIP(checkSelect,
		_( "Select the LDIF field for import into the address book." ));

	btnModify = gtk_button_new_with_label( _(" Modify "));
	gtk_table_attach(GTK_TABLE(table), btnModify, 2, 3, top, (top + 1),
		GTK_FILL, 0, 3, 0);

	CLAWS_SET_TIP(btnModify,
		_( "This button will update the list above with the data supplied." ));

	gtk_widget_show_all(vbox);

	/* Event handlers */
	g_signal_connect( G_OBJECT(clist_field), "select_row",
			  G_CALLBACK(imp_ldif_field_list_selected), NULL );
	g_signal_connect( G_OBJECT(clist_field), "button_press_event",
			  G_CALLBACK(imp_ldif_field_list_toggle), NULL );
	g_signal_connect( G_OBJECT(btnModify), "clicked",
			  G_CALLBACK(imp_ldif_modify_pressed), NULL );

	impldif_dlg.clist_field = clist_field;
	impldif_dlg.entryField  = entryField;
	impldif_dlg.entryAttrib = entryAttrib;
	impldif_dlg.checkSelect = checkSelect;
	impldif_dlg.btnModify   = btnModify;
}
Пример #11
0
static void addkeeper_prefs_create_widget_func(PrefsPage * _page,
					       GtkWindow * window,
					       gpointer data)
{
	struct AddressKeeperPrefsPage *page = (struct AddressKeeperPrefsPage *) _page;
	GtkWidget *path_frame;
	GtkWidget *path_hbox;
	GtkWidget *path_vbox;
	GtkWidget *path_entry;
	GtkWidget *path_label;
	GtkWidget *path_button;
	GtkWidget *keep_frame;
	GtkWidget *keep_hbox;
	GtkWidget *keep_to_checkbox;
	GtkWidget *keep_cc_checkbox;
	GtkWidget *keep_bcc_checkbox;
	GtkWidget *blocked_frame;
	GtkWidget *blocked_vbox;
	GtkWidget *blocked_scrolledwin;
	GtkWidget *vbox;
	GtkTextBuffer *buffer;

	vbox = gtk_vbox_new(FALSE, 6);

	path_vbox = gtkut_get_options_frame(vbox, &path_frame,
		_("Address book location"));
	gtk_container_set_border_width(GTK_CONTAINER(path_frame), 6);
	path_hbox = gtk_hbox_new(FALSE, 6);
	gtk_box_pack_start(GTK_BOX(path_vbox), path_hbox, FALSE, FALSE, 0);

	path_label = gtk_label_new(_("Keep to folder"));
	gtk_box_pack_start(GTK_BOX(path_hbox), path_label, FALSE, FALSE, 0);
	gtk_widget_show(path_label);

	path_entry = gtk_entry_new();
	gtk_entry_set_text(GTK_ENTRY(path_entry), addkeeperprefs.addressbook_folder);
	gtk_box_pack_start(GTK_BOX(path_hbox), path_entry, TRUE, TRUE, 0);
	gtk_widget_show(path_entry);
	CLAWS_SET_TIP(path_entry, _("Address book path where addresses are kept"));

	path_button = gtk_button_new_with_label(_("Select..."));
	gtk_box_pack_start(GTK_BOX(path_hbox), path_button, FALSE, FALSE, 0);
#ifndef USE_NEW_ADDRBOOK
	g_signal_connect(G_OBJECT (path_button), "clicked",
			 G_CALLBACK (select_addressbook_clicked_cb),
			 path_entry);
#else
	gtk_widget_set_sensitive(path_button, FALSE);
#endif
	gtk_widget_show(path_button);
	gtk_widget_show(path_hbox);
	gtk_widget_show(path_vbox);

	page->addressbook_folder = path_entry;

	keep_hbox = gtkut_get_options_frame(vbox, &keep_frame,
		_("Fields to keep addresses from"));
	gtk_container_set_border_width(GTK_CONTAINER(keep_frame), 6);

	keep_to_checkbox = gtk_check_button_new_with_label(_("To"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(keep_to_checkbox), addkeeperprefs.keep_to_addrs);
	gtk_box_pack_start(GTK_BOX(keep_hbox), keep_to_checkbox, FALSE, FALSE, 0);
	gtk_widget_show(keep_to_checkbox);
	CLAWS_SET_TIP(keep_to_checkbox, _("Keep addresses which appear in 'To' headers"));
	gtk_widget_show(keep_to_checkbox);

	page->keep_to_addrs_check = keep_to_checkbox;

	keep_cc_checkbox = gtk_check_button_new_with_label(_("Cc"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(keep_cc_checkbox), addkeeperprefs.keep_cc_addrs);
	gtk_box_pack_start(GTK_BOX(keep_hbox), keep_cc_checkbox, FALSE, FALSE, 0);
	gtk_widget_show(keep_cc_checkbox);
	CLAWS_SET_TIP(keep_cc_checkbox, _("Keep addresses which appear in 'Cc' headers"));
	gtk_widget_show(keep_cc_checkbox);

	page->keep_cc_addrs_check = keep_cc_checkbox;

	keep_bcc_checkbox = gtk_check_button_new_with_label(_("Bcc"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(keep_bcc_checkbox), addkeeperprefs.keep_bcc_addrs);
	gtk_box_pack_start(GTK_BOX(keep_hbox), keep_bcc_checkbox, FALSE, FALSE, 0);
	gtk_widget_show(keep_bcc_checkbox);
	CLAWS_SET_TIP(keep_bcc_checkbox, _("Keep addresses which appear in 'Bcc' headers"));
	gtk_widget_show(keep_bcc_checkbox);

	page->keep_bcc_addrs_check = keep_bcc_checkbox;

	blocked_vbox = gtkut_get_options_frame(vbox, &blocked_frame,
		_("Exclude addresses matching the following regular expressions (one per line)"));
	gtk_container_set_border_width(GTK_CONTAINER(blocked_frame), 6);

	page->block_matching_addrs = gtk_text_view_new();
	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(page->block_matching_addrs));
	gtk_text_buffer_set_text(buffer, addkeeperprefs.block_matching_addrs, -1);
	
	blocked_scrolledwin = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy
		(GTK_SCROLLED_WINDOW (blocked_scrolledwin),
		 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_set_shadow_type
		(GTK_SCROLLED_WINDOW (blocked_scrolledwin), GTK_SHADOW_IN);

	gtk_container_add(GTK_CONTAINER(blocked_scrolledwin), page->block_matching_addrs);
	gtk_widget_set_size_request(page->block_matching_addrs, -1, 72);
	gtk_box_pack_start(GTK_BOX(blocked_vbox), blocked_scrolledwin, FALSE, FALSE, 0);
	
	gtk_widget_show_all(vbox);

	page->page.widget = vbox;
}
Пример #12
0
static GtkWidget *p_create_frame_missing(struct LibravatarPrefsPage *page)
{
	GtkWidget *vbox, *radio[NUM_DEF_BUTTONS], *hbox, *entry;
	gboolean enable = FALSE;
	int i, e = 0;
	gchar *radio_label[] = {
		_("None"),
		_("Mystery man"),
		_("Identicon"),
		_("MonsterID"),
		_("Wavatar"),
		_("Retro"),
		_("Custom URL")
	};
	gchar *radio_hint[] = {
		_("A blank image"),
		_("The unobtrusive low-contrast greyish silhouette"),
		_("A generated geometric pattern"),
		_("A generated full-body monster"),
		_("A generated almost unique face"),
		_("A generated 8-bit arcade-style pixelated image"),
		_("Redirect to a user provided URL")
	};

	vbox =  gtk_vbox_new(FALSE, 6);

	for (i = 0; i < NUM_DEF_BUTTONS; ++i) {
		enable = (libravatarprefs.default_mode == radio_value[i])? TRUE: FALSE;
		e += enable? 1: 0;
		radio[i] = gtk_radio_button_new_with_label_from_widget(
				(i > 0)? GTK_RADIO_BUTTON(radio[i - 1]): NULL, radio_label[i]);
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio[i]), enable);
		if (i == CUSTOM_URL_BUTTON_INDEX) {
			/* set related entry next to radio button */
			entry = gtk_entry_new_with_max_length(MAX_URL_LENGTH);
			CLAWS_SET_TIP(entry, _("Enter the URL you want to be "
				"redirected when no user icon is available. "
				"Leave an empty URL to use the default "
				"libravatar orange icon."));
			gtk_widget_show(entry);
			gtk_entry_set_text(GTK_ENTRY(entry),
				libravatarprefs.default_mode_url);
			hbox = gtk_hbox_new(FALSE, 6);
			gtk_box_pack_start(GTK_BOX(hbox), radio[i], FALSE, FALSE, 0);
			gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 0);
			gtk_widget_set_sensitive(entry,
				(libravatarprefs.default_mode == DEF_MODE_URL)
				? TRUE: FALSE);
			page->defm_url_text = entry;
			gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
		} else {
			gtk_box_pack_start(GTK_BOX(vbox), radio[i], FALSE, FALSE, 0);
		}
		g_signal_connect(radio[i], "toggled",
				 G_CALLBACK(default_mode_radio_button_cb),
				 (gpointer) &(radio_value[i]));
		CLAWS_SET_TIP(radio[i], radio_hint[i]);
		gtk_widget_show(radio[i]);
		page->defm_radio[i] = radio[i];
	}
	if (e == 0) { /* unknown value, go default */
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio[0]), TRUE);
		libravatarprefs.default_mode = DEF_MODE_NONE;
	}
	/* don't waste time with headers that won't be displayed */
	prefs_common_get_prefs()->enable_avatars =
		(libravatarprefs.default_mode == DEF_MODE_NONE)
		? AVATARS_ENABLE_BOTH: AVATARS_DISABLE;



	return vbox;
}
Пример #13
0
static void spamassassin_create_widget_func(PrefsPage * _page,
					    GtkWindow * window,
					    gpointer data)
{
	struct SpamAssassinPage *page = (struct SpamAssassinPage *) _page;
	SpamAssassinConfig *config;
	guint i, active;

	GtkWidget *vbox1, *vbox2;
	GtkWidget *frame_transport, *table_transport, *vbox_transport;
	GtkWidget *hbox_spamd, *hbox_max_size, *hbox_timeout;
	GtkWidget *hbox_process_emails, *hbox_save_spam;
	GtkWidget *hbox_mark_as_read, *hbox_whitelist;
	GtkWidget *whitelist_ab_checkbtn;
	GtkWidget *whitelist_ab_folder_combo;
	GtkWidget *whitelist_ab_select_btn;

	GtkWidget *enable_sa_checkbtn;

	GtkWidget *transport_label;
	GtkWidget *transport_optmenu;

	GtkWidget *user_label;
	GtkWidget *user_entry;

	GtkWidget *spamd_label;
	GtkWidget *spamd_hostname_entry;
	GtkWidget *spamd_colon_label;
	GtkAdjustment *spamd_port_spinbtn_adj;
	GtkWidget *spamd_port_spinbtn;
	GtkWidget *spamd_socket_entry;

	GtkWidget *max_size_label;
	GtkAdjustment *max_size_spinbtn_adj;
	GtkWidget *max_size_spinbtn;
	GtkWidget *max_size_kb_label;

	GtkWidget *timeout_label;
	GtkAdjustment *timeout_spinbtn_adj;
	GtkWidget *timeout_spinbtn;
	GtkWidget *timeout_seconds_label;

	GtkWidget *process_emails_checkbtn;

	GtkWidget *save_spam_checkbtn;
	GtkWidget *save_spam_folder_entry;
	GtkWidget *save_spam_folder_select;

	GtkWidget *mark_as_read_checkbtn;

	GtkListStore *store;
	GtkCellRenderer *renderer;
	GtkTreeIter iter;

	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);

	enable_sa_checkbtn = gtk_check_button_new_with_label(_("Enable SpamAssassin plugin"));
	gtk_widget_show(enable_sa_checkbtn);
	gtk_box_pack_start(GTK_BOX(vbox2), enable_sa_checkbtn, TRUE, TRUE, 0);

	vbox_transport = gtkut_get_options_frame(vbox2, &frame_transport, _("Transport"));

	table_transport = gtk_table_new (3, 3, FALSE);
	gtk_widget_show (table_transport);
	gtk_box_pack_start(GTK_BOX(vbox_transport), table_transport, TRUE, TRUE, 0);
	gtk_table_set_row_spacings (GTK_TABLE (table_transport), 4);
	gtk_table_set_col_spacings (GTK_TABLE (table_transport), 8);

	transport_label = gtk_label_new(_("Type of transport"));
	gtk_widget_show(transport_label);
	gtk_table_attach (GTK_TABLE (table_transport), transport_label, 0, 1, 0, 1,
			(GtkAttachOptions) (GTK_FILL),
			(GtkAttachOptions) (0), 0, 0);
	gtk_label_set_justify(GTK_LABEL(transport_label), GTK_JUSTIFY_RIGHT);
	gtk_misc_set_alignment(GTK_MISC(transport_label), 1, 0.5);

	store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_POINTER);
	transport_optmenu = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
	renderer = gtk_cell_renderer_text_new();
	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(transport_optmenu),
				   renderer, TRUE);
	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(transport_optmenu),
				       renderer, "text", 0, NULL);
	gtk_widget_show(transport_optmenu);

	gtk_table_attach (GTK_TABLE (table_transport), transport_optmenu, 1, 2, 0, 1,
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
			(GtkAttachOptions) (0), 0, 0);

	user_label = gtk_label_new(_("User"));
	gtk_widget_show(user_label);
	gtk_table_attach (GTK_TABLE (table_transport), user_label, 0, 1, 1, 2,
			(GtkAttachOptions) (GTK_FILL),
			(GtkAttachOptions) (0), 0, 0);
	gtk_label_set_justify(GTK_LABEL(user_label), GTK_JUSTIFY_RIGHT);
	gtk_misc_set_alignment(GTK_MISC(user_label), 1, 0.5);

	user_entry = gtk_entry_new();
	gtk_widget_show(user_entry);
	gtk_table_attach (GTK_TABLE (table_transport), user_entry, 1, 2, 1, 2,
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
			(GtkAttachOptions) (0), 0, 0);
	CLAWS_SET_TIP(user_entry, _("User to use with spamd server"));

	spamd_label = gtk_label_new(_("spamd"));
	gtk_widget_show(spamd_label);
	gtk_table_attach (GTK_TABLE (table_transport), spamd_label, 0, 1, 2, 3,
			(GtkAttachOptions) (GTK_FILL),
			(GtkAttachOptions) (0), 0, 0);
	gtk_label_set_justify(GTK_LABEL(spamd_label), GTK_JUSTIFY_RIGHT);
	gtk_misc_set_alignment(GTK_MISC(spamd_label), 1, 0.5);

	hbox_spamd = gtk_hbox_new(FALSE, 8);
	gtk_widget_show(hbox_spamd);
	gtk_table_attach (GTK_TABLE (table_transport), hbox_spamd, 1, 2, 2, 3,
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
			(GtkAttachOptions) (0), 0, 0);

	spamd_hostname_entry = gtk_entry_new();
	gtk_widget_show(spamd_hostname_entry);
	gtk_box_pack_start(GTK_BOX(hbox_spamd), spamd_hostname_entry, TRUE, TRUE, 0);
	CLAWS_SET_TIP(spamd_hostname_entry,
			_("Hostname or IP address of spamd server"));

	spamd_colon_label = gtk_label_new(":");
	gtk_widget_show(spamd_colon_label);
	gtk_box_pack_start(GTK_BOX(hbox_spamd), spamd_colon_label, FALSE, FALSE, 0);

	spamd_port_spinbtn_adj = GTK_ADJUSTMENT(gtk_adjustment_new(783, 1, 65535, 1, 10, 0));
	spamd_port_spinbtn = gtk_spin_button_new(GTK_ADJUSTMENT(spamd_port_spinbtn_adj), 1, 0);
	gtk_widget_show(spamd_port_spinbtn);
	gtk_box_pack_start(GTK_BOX(hbox_spamd), spamd_port_spinbtn, FALSE, FALSE, 0);
	CLAWS_SET_TIP(spamd_port_spinbtn,
			_("Port of spamd server"));
	gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(spamd_port_spinbtn), TRUE);

	spamd_socket_entry = gtk_entry_new();
	gtk_widget_show(spamd_socket_entry);
	gtk_box_pack_start(GTK_BOX(hbox_spamd), spamd_socket_entry, TRUE, TRUE, 0);
	CLAWS_SET_TIP(spamd_socket_entry, _("Path of Unix socket"));

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

	max_size_label = gtk_label_new(_("Maximum size"));
	gtk_widget_show(max_size_label);
	gtk_box_pack_start(GTK_BOX(hbox_max_size), max_size_label, FALSE, FALSE, 0);

	max_size_spinbtn_adj = GTK_ADJUSTMENT(gtk_adjustment_new(250, 0, 10000, 10, 10, 0));
	max_size_spinbtn = gtk_spin_button_new(GTK_ADJUSTMENT(max_size_spinbtn_adj), 1, 0);
	gtk_widget_show(max_size_spinbtn);
	gtk_box_pack_start(GTK_BOX(hbox_max_size), max_size_spinbtn, FALSE, FALSE, 0);
	CLAWS_SET_TIP(max_size_spinbtn,
			_("Messages larger than this will not be checked"));
	gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(max_size_spinbtn), TRUE);

	max_size_kb_label = gtk_label_new(_("KB"));
	gtk_widget_show(max_size_kb_label);
	gtk_box_pack_start(GTK_BOX(hbox_max_size), max_size_kb_label, FALSE, FALSE, 0);

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

	timeout_label = gtk_label_new(_("Timeout"));
	gtk_widget_show(timeout_label);
	gtk_box_pack_start(GTK_BOX(hbox_timeout), timeout_label, FALSE, FALSE, 0);

	timeout_spinbtn_adj = GTK_ADJUSTMENT(gtk_adjustment_new(60, 0, 10000, 10, 10, 0));
	timeout_spinbtn = gtk_spin_button_new(GTK_ADJUSTMENT(timeout_spinbtn_adj), 1, 0);
	gtk_widget_show(timeout_spinbtn);
	gtk_box_pack_start(GTK_BOX(hbox_timeout), timeout_spinbtn, FALSE, FALSE, 0);
	CLAWS_SET_TIP(timeout_spinbtn,
			_("Maximum time allowed for checking. If the check takes longer "
				"it will be aborted."));
	gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(timeout_spinbtn), TRUE);

	timeout_seconds_label = gtk_label_new(_("seconds"));
	gtk_widget_show(timeout_seconds_label);
	gtk_box_pack_start(GTK_BOX(hbox_timeout), timeout_seconds_label, FALSE, FALSE, 0);

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

	process_emails_checkbtn = gtk_check_button_new_with_label(
			_("Process messages on receiving"));
	gtk_widget_show(process_emails_checkbtn);
	gtk_box_pack_start(GTK_BOX(hbox_process_emails), process_emails_checkbtn, TRUE, TRUE, 0);

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

	save_spam_checkbtn = gtk_check_button_new_with_label(_("Save spam in"));
	gtk_widget_show(save_spam_checkbtn);
	gtk_box_pack_start(GTK_BOX(hbox_save_spam), save_spam_checkbtn, FALSE, FALSE, 0);

	save_spam_folder_entry = gtk_entry_new();
	gtk_widget_show (save_spam_folder_entry);
	gtk_box_pack_start (GTK_BOX (hbox_save_spam), save_spam_folder_entry, TRUE, TRUE, 0);
	CLAWS_SET_TIP(save_spam_folder_entry,
			_("Folder for storing identified spam. Leave empty to use the trash folder."));

	save_spam_folder_select = gtkut_get_browse_directory_btn(_("_Browse"));
	gtk_widget_show (save_spam_folder_select);
	gtk_box_pack_start (GTK_BOX (hbox_save_spam), save_spam_folder_select, FALSE, FALSE, 0);
	CLAWS_SET_TIP(save_spam_folder_select,
			_("Click this button to select a folder for storing spam"));

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

	mark_as_read_checkbtn = gtk_check_button_new_with_label(
			_("Mark spam as read"));
	gtk_widget_show(mark_as_read_checkbtn);
	gtk_box_pack_start(GTK_BOX(hbox_mark_as_read), mark_as_read_checkbtn, TRUE, TRUE, 0);

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

	whitelist_ab_checkbtn = gtk_check_button_new_with_label(_("Whitelist senders found in address book/folder"));
	gtk_widget_show(whitelist_ab_checkbtn);
	gtk_box_pack_start(GTK_BOX(hbox_whitelist), whitelist_ab_checkbtn, FALSE, FALSE, 0);
	CLAWS_SET_TIP(whitelist_ab_checkbtn,
			_("Messages coming from your address book contacts will be received in the normal folder even if detected as spam"));

	whitelist_ab_folder_combo = combobox_text_new(TRUE, _("Any"), NULL);
	gtk_widget_set_size_request(whitelist_ab_folder_combo, 100, -1);
	gtk_box_pack_start (GTK_BOX (hbox_whitelist), whitelist_ab_folder_combo, TRUE, TRUE, 0);

	whitelist_ab_select_btn = gtk_button_new_with_label(_("Select..."));
	gtk_widget_show (whitelist_ab_select_btn);
	gtk_box_pack_start (GTK_BOX (hbox_whitelist), whitelist_ab_select_btn, FALSE, FALSE, 0);
	CLAWS_SET_TIP(whitelist_ab_select_btn,
			_("Click this button to select a book or folder in the address book"));

	SET_TOGGLE_SENSITIVITY(enable_sa_checkbtn, frame_transport);
	SET_TOGGLE_SENSITIVITY(enable_sa_checkbtn, hbox_max_size);
	SET_TOGGLE_SENSITIVITY(enable_sa_checkbtn, hbox_timeout);
	SET_TOGGLE_SENSITIVITY(enable_sa_checkbtn, hbox_save_spam);
	SET_TOGGLE_SENSITIVITY(save_spam_checkbtn, save_spam_folder_entry);
	SET_TOGGLE_SENSITIVITY(save_spam_checkbtn, save_spam_folder_select);
	SET_TOGGLE_SENSITIVITY(enable_sa_checkbtn, hbox_process_emails);
	SET_TOGGLE_SENSITIVITY(save_spam_checkbtn, mark_as_read_checkbtn);
	SET_TOGGLE_SENSITIVITY(whitelist_ab_checkbtn, whitelist_ab_folder_combo);
#ifndef USE_ALT_ADDRBOOK
	SET_TOGGLE_SENSITIVITY(whitelist_ab_checkbtn, whitelist_ab_select_btn);
#endif
	config = spamassassin_get_config();

	g_signal_connect(G_OBJECT(save_spam_folder_select), "clicked",
			G_CALLBACK(foldersel_cb), page);
#ifndef USE_ALT_ADDRBOOK
	g_signal_connect(G_OBJECT (whitelist_ab_select_btn), "clicked",
			 G_CALLBACK(spamassassin_whitelist_ab_select_cb), page);
#else
	gtk_widget_set_sensitive(GTK_WIDGET(whitelist_ab_select_btn), FALSE);
#endif

	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enable_sa_checkbtn), config->enable);
	if (config->username != NULL)
		gtk_entry_set_text(GTK_ENTRY(user_entry), config->username);
	if (config->hostname != NULL)
		gtk_entry_set_text(GTK_ENTRY(spamd_hostname_entry), config->hostname);
	if (config->socket != NULL)
		gtk_entry_set_text(GTK_ENTRY(spamd_socket_entry), config->socket);
	if (config->whitelist_ab_folder != NULL) {
		/* translate "Any" (stored UNtranslated) */
		if (strcasecmp(config->whitelist_ab_folder, "Any") == 0)
			gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((whitelist_ab_folder_combo)))),
					config->whitelist_ab_folder);
		else
		/* backward compatibility (when translated "Any" was stored) */
		if (g_utf8_collate(config->whitelist_ab_folder, _("Any")) == 0)
			gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((whitelist_ab_folder_combo)))),
					config->whitelist_ab_folder);
		else
			gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((whitelist_ab_folder_combo)))),
					config->whitelist_ab_folder);
	}
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(spamd_port_spinbtn), (float) config->port);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(max_size_spinbtn), (float) config->max_size);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(timeout_spinbtn), (float) config->timeout);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(process_emails_checkbtn), config->process_emails);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(save_spam_checkbtn), config->receive_spam);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(whitelist_ab_checkbtn), config->whitelist_ab);
	if (config->save_folder != NULL)
		gtk_entry_set_text(GTK_ENTRY(save_spam_folder_entry), config->save_folder);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mark_as_read_checkbtn), config->mark_as_read);

	page->enable_sa_checkbtn = enable_sa_checkbtn;
	page->transport_label = transport_label;
	page->transport_optmenu = transport_optmenu;
	page->username = user_entry;
	page->hostname = spamd_hostname_entry;
	page->colon = spamd_colon_label;
	page->port = spamd_port_spinbtn;
	page->socket = spamd_socket_entry;
	page->max_size = max_size_spinbtn;
	page->timeout = timeout_spinbtn;
	page->process_emails = process_emails_checkbtn;
	page->receive_spam = save_spam_checkbtn;
	page->save_folder = save_spam_folder_entry;
	page->save_folder_select = save_spam_folder_select;
	page->mark_as_read = mark_as_read_checkbtn;
	page->whitelist_ab = whitelist_ab_checkbtn;
	page->whitelist_ab_folder_combo = whitelist_ab_folder_combo;

	active = 0;
	for (i = 0; i < (sizeof(transports) / sizeof(struct Transport)); i++) {
		
		gtk_list_store_append(store, &iter);
		gtk_list_store_set(store, &iter,
				   0, gettext(transports[i].name),
				   1, &transports[i], -1);

		if (config->transport == transports[i].transport) {
			show_transport(page, &transports[i]);
			active = i;
		} else if (config->transport == SPAMASSASSIN_DISABLED 
			&& transports[i].transport == SPAMASSASSIN_TRANSPORT_LOCALHOST) {
			show_transport(page, &transports[i]);
			active = i;
			/* and disable via new way */
			config->enable = FALSE;
			gtk_toggle_button_set_active(
				GTK_TOGGLE_BUTTON(enable_sa_checkbtn), 
				config->enable);
		}
	}
	gtk_combo_box_set_active(GTK_COMBO_BOX(transport_optmenu), active);
	g_signal_connect(G_OBJECT(transport_optmenu), "changed",
			 G_CALLBACK(transport_sel_cb), page);

	page->page.widget = vbox1;
}
Пример #14
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;
}
Пример #15
0
void quotefmt_create_forward_fmt_widgets(GtkWindow *parent_window,
						GtkWidget *parent_box,
						GtkWidget **checkbtn_forward_with_format,
						GtkWidget **override_from_format,
						GtkWidget **edit_fw_quotemark,
						GtkWidget **edit_fw_format,
						gboolean add_info_button,
						void(*set_defaults_func)(void))
{
	GtkWidget *checkbtn_use_format = NULL;
	GtkWidget *vbox_quote;
	GtkWidget *hbox1;
	GtkWidget *hbox2;
	GtkWidget *hbox3;
	GtkWidget *label_quotemark;
	GtkWidget *entry_fw_quotemark;
	GtkWidget *label_from = NULL;
	GtkWidget *entry_from = NULL;
	GtkWidget *scrolledwin_quotefmt;
	GtkWidget *text_fw_quotefmt;
	GtkSizeGroup *size_group;

	if (add_info_button)
		cm_return_if_fail(parent_window != NULL);
	cm_return_if_fail(parent_box != NULL);
	if (checkbtn_forward_with_format) {
		cm_return_if_fail(checkbtn_forward_with_format != NULL);
	}
	cm_return_if_fail(edit_fw_quotemark != NULL);
	cm_return_if_fail(edit_fw_format != NULL);

	size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);

	if (checkbtn_forward_with_format)
		PACK_CHECK_BUTTON (parent_box, checkbtn_use_format,
				   _("Use template when forwarding messages"));

	vbox_quote = gtk_vbox_new (FALSE, 4);
	gtk_widget_show(vbox_quote);
	gtk_container_add(GTK_CONTAINER (parent_box), vbox_quote);
	gtk_container_set_border_width (GTK_CONTAINER (vbox_quote), 8);

	if (override_from_format) {
		hbox3 = gtk_hbox_new (FALSE, 8);
		gtk_widget_show (hbox3);
		gtk_box_pack_start (GTK_BOX (vbox_quote), hbox3, FALSE, FALSE, 0);

		label_from = gtk_label_new (prefs_common_translated_header_name("From"));
		gtk_misc_set_alignment(GTK_MISC(label_from), 1, 0.5);
		gtk_widget_show (label_from);
		gtk_box_pack_start (GTK_BOX (hbox3), label_from, FALSE, FALSE, 0);
		gtk_size_group_add_widget(size_group, label_from);

		entry_from = gtk_entry_new ();
		gtk_widget_show (entry_from);
		gtk_box_pack_start (GTK_BOX (hbox3), entry_from, TRUE, TRUE, 0);
		gtk_widget_set_size_request (entry_from, 100, -1);

		CLAWS_SET_TIP(entry_from,
				_("Override From header. This doesn't change the account used to forward."));
	}

	hbox1 = gtk_hbox_new (FALSE, 32);
	gtk_widget_show (hbox1);
	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_quotemark = gtk_label_new (_("Quotation mark"));
	gtk_misc_set_alignment(GTK_MISC(label_quotemark), 1, 0.5);
	gtk_widget_show (label_quotemark);
	gtk_box_pack_start (GTK_BOX (hbox2), label_quotemark, FALSE, FALSE, 0);
	gtk_size_group_add_widget(size_group, label_quotemark);

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

	scrolledwin_quotefmt = gtk_scrolled_window_new (NULL, NULL);
	gtk_widget_show (scrolledwin_quotefmt);
	gtk_box_pack_start (GTK_BOX (vbox_quote), scrolledwin_quotefmt,
			    TRUE, TRUE, 0);
	gtk_scrolled_window_set_policy
		(GTK_SCROLLED_WINDOW (scrolledwin_quotefmt),
		 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_set_shadow_type
		(GTK_SCROLLED_WINDOW (scrolledwin_quotefmt), GTK_SHADOW_IN);

	text_fw_quotefmt = gtk_text_view_new ();
	if (prefs_common.textfont) {
		PangoFontDescription *font_desc;

		font_desc = pango_font_description_from_string
						(prefs_common.textfont);
		if (font_desc) {
			gtk_widget_modify_font(text_fw_quotefmt, font_desc);
			pango_font_description_free(font_desc);
		}
	}
	gtk_widget_show(text_fw_quotefmt);
	gtk_container_add(GTK_CONTAINER(scrolledwin_quotefmt),
			  text_fw_quotefmt);
	gtk_text_view_set_editable (GTK_TEXT_VIEW (text_fw_quotefmt), TRUE);
	gtk_widget_set_size_request (text_fw_quotefmt, -1, 100);

	if (checkbtn_forward_with_format) {
		SET_TOGGLE_SENSITIVITY(checkbtn_use_format, label_quotemark);
		SET_TOGGLE_SENSITIVITY(checkbtn_use_format, entry_fw_quotemark);
		if (override_from_format) {
			SET_TOGGLE_SENSITIVITY(checkbtn_use_format, entry_from);
			SET_TOGGLE_SENSITIVITY(checkbtn_use_format, label_from);
		}
		SET_TOGGLE_SENSITIVITY(checkbtn_use_format, text_fw_quotefmt);
	}

	quote_fmt_add_buttons(parent_window, vbox_quote,
				add_info_button, set_defaults_func);

	if (checkbtn_forward_with_format)
		*checkbtn_forward_with_format = checkbtn_use_format;
	*edit_fw_quotemark = entry_fw_quotemark;
	if (override_from_format)
		*override_from_format = entry_from;
	*edit_fw_format = text_fw_quotefmt;
}
Пример #16
0
static void prefs_summaries_create_widget(PrefsPage *_page, GtkWindow *window, 
			       	  gpointer data)
{
	SummariesPage *prefs_summaries = (SummariesPage *) _page;
	
	GtkWidget *vbox1;
	GtkWidget *checkbtn_transhdr;
	GtkWidget *hbox0;
	GtkWidget *optmenu_folder_unread;
	GtkWidget *hbox1;
	GtkWidget *label_ng_abbrev;
	GtkWidget *spinbtn_ng_abbrev_len;
	GtkAdjustment *spinbtn_ng_abbrev_len_adj;
	GtkWidget *vbox2;
	GtkWidget *vbox3;
	GtkWidget *checkbtn_useaddrbook;
	GtkWidget *checkbtn_show_tooltips;
	GtkWidget *checkbtn_threadsubj;
	GtkWidget *label_datefmt;
	GtkWidget *button_datefmt;
	GtkWidget *entry_datefmt;
	GtkWidget *hbox_dispitem;
	GtkWidget *button_dispitem;
	GtkWidget *hbox2;
	GtkWidget *checkbtn_reopen_last_folder;
	GtkWidget *optmenu_always_show_msg;
	GtkWidget *spinbtn_mark_as_read_delay;
	GtkAdjustment *spinbtn_mark_as_read_delay_adj;
	GtkWidget *checkbtn_immedexec;
	GtkWidget *checkbtn_ask_mark_all_read;
	GtkWidget *label, *label_fill;
	GtkListStore *menu;
	GtkTreeIter iter;
 	GtkWidget *optmenu_nextunreadmsgdialog;
	GtkWidget *folderview_frame;
	GtkWidget *summaryview_frame;
	GtkWidget *button_edit_actions;
	GtkWidget *radio_mark_as_read_on_select;
	GtkWidget *radio_mark_as_read_on_new_win;
	GtkWidget *optmenu_sort_key;
	GtkWidget *optmenu_sort_type;

	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, &folderview_frame, _("Folder list"));

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

	label = gtk_label_new (_("Display message count next to folder name"));
	gtk_widget_show (label);
	gtk_box_pack_start(GTK_BOX(hbox0), label, FALSE, FALSE, 0);

	optmenu_folder_unread = gtkut_sc_combobox_create(NULL, FALSE);
	menu = GTK_LIST_STORE(gtk_combo_box_get_model(
				GTK_COMBO_BOX(optmenu_folder_unread)));
	gtk_widget_show (optmenu_folder_unread);
 	
	COMBOBOX_ADD (menu, _("No"), 0);
	COMBOBOX_ADD (menu, _("Unread messages"), 1);
	COMBOBOX_ADD (menu, _("Unread and Total messages"), 2);

	gtk_box_pack_start(GTK_BOX(hbox0), optmenu_folder_unread, FALSE, FALSE, 0);

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

	PACK_CHECK_BUTTON
		(vbox2, checkbtn_reopen_last_folder,
		 _("Open last opened folder at start-up"));

	label_ng_abbrev = gtk_label_new
		(_("Abbreviate newsgroup names longer than"));
	gtk_widget_show (label_ng_abbrev);
	gtk_box_pack_start (GTK_BOX (hbox1), label_ng_abbrev, FALSE, FALSE, 0);

	spinbtn_ng_abbrev_len_adj = GTK_ADJUSTMENT(gtk_adjustment_new (16, 0, 999, 1, 10, 0));
	spinbtn_ng_abbrev_len = gtk_spin_button_new
		(GTK_ADJUSTMENT (spinbtn_ng_abbrev_len_adj), 1, 0);
	gtk_widget_show (spinbtn_ng_abbrev_len);
	gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_ng_abbrev_len,
			    FALSE, FALSE, 0);
	gtk_widget_set_size_request (spinbtn_ng_abbrev_len, 56, -1);
	gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_ng_abbrev_len),
				     TRUE);

	label_ng_abbrev = gtk_label_new (_("letters"));
	gtk_widget_show (label_ng_abbrev);
	gtk_box_pack_start (GTK_BOX (hbox1), label_ng_abbrev, FALSE, FALSE, 0);

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

	label = gtk_label_new(_("Displayed columns"));
	gtk_widget_show(label);
	gtk_box_pack_start(GTK_BOX(hbox_dispitem), label, FALSE, FALSE, 0);
	button_dispitem = gtk_button_new_from_stock(GTK_STOCK_EDIT);
	gtk_widget_show (button_dispitem);
	gtk_box_pack_start (GTK_BOX (hbox_dispitem), button_dispitem, FALSE, FALSE, 0);
	g_signal_connect (G_OBJECT (button_dispitem), "clicked",
			  G_CALLBACK (prefs_folder_column_open),
			  NULL);

	vbox2 = gtkut_get_options_frame(vbox1, &summaryview_frame, _("Message list"));

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

	label = gtk_label_new(_("Sort new folders by"));
	gtk_widget_show(label);
	gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 0);

	optmenu_sort_key = gtkut_sc_combobox_create(NULL, FALSE);
	menu = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu_sort_key)));
	gtk_widget_show(optmenu_sort_key);

	COMBOBOX_ADD(menu, _("Number"), SORT_BY_NUMBER);
	COMBOBOX_ADD(menu, _("Size"), SORT_BY_SIZE);
	COMBOBOX_ADD(menu, _("Date"), SORT_BY_DATE);
	COMBOBOX_ADD(menu, _("Thread date"), SORT_BY_THREAD_DATE);
	COMBOBOX_ADD(menu, _("From"), SORT_BY_FROM);
	COMBOBOX_ADD(menu, _("To"), SORT_BY_TO);
	COMBOBOX_ADD(menu, _("Subject"), SORT_BY_SUBJECT);
	COMBOBOX_ADD(menu, _("Color label"), SORT_BY_LABEL);
	COMBOBOX_ADD(menu, _("Tag"), SORT_BY_TAGS);
	COMBOBOX_ADD(menu, _("Mark"), SORT_BY_MARK);
	COMBOBOX_ADD(menu, _("Status"), SORT_BY_STATUS);
	COMBOBOX_ADD(menu, _("Attachment"), SORT_BY_MIME);
	COMBOBOX_ADD(menu, _("Score"), SORT_BY_SCORE);
	COMBOBOX_ADD(menu, _("Locked"), SORT_BY_LOCKED);
	COMBOBOX_ADD(menu, _("Don't sort"), SORT_BY_NONE);

	gtk_box_pack_start(GTK_BOX(hbox1), optmenu_sort_key, FALSE, FALSE, 0);

	optmenu_sort_type = gtkut_sc_combobox_create(NULL, FALSE);
	menu = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu_sort_type)));
	gtk_widget_show(optmenu_sort_type);

	COMBOBOX_ADD(menu, _("Ascending"), SORT_ASCENDING);
	COMBOBOX_ADD(menu, _("Descending"), SORT_DESCENDING);

	gtk_box_pack_start(GTK_BOX(hbox1), optmenu_sort_type, FALSE, FALSE, 0);

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

	button_edit_actions = gtk_button_new_with_label(_("Set default selection when entering a folder"));
	gtk_widget_show (button_edit_actions);
	gtk_box_pack_start (GTK_BOX (hbox1), button_edit_actions,
			  FALSE, TRUE, 0);
	g_signal_connect (G_OBJECT (button_edit_actions), "clicked",
			  G_CALLBACK (prefs_summary_open_open),
			  NULL);

	/* Next Unread Message Dialog */
	hbox1 = gtk_hbox_new (FALSE, 10);
	gtk_widget_show (hbox1);
	gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);	

	label = gtk_label_new (_("Show \"no unread (or new) message\" dialog"));
	gtk_widget_show (label);
	gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 0);
	
	optmenu_nextunreadmsgdialog = gtkut_sc_combobox_create(NULL, FALSE);
	menu = GTK_LIST_STORE(gtk_combo_box_get_model(
				GTK_COMBO_BOX(optmenu_nextunreadmsgdialog)));
	gtk_widget_show (optmenu_nextunreadmsgdialog);

	COMBOBOX_ADD (menu, _("Always"), NEXTUNREADMSGDIALOG_ALWAYS);
	COMBOBOX_ADD (menu, _("Assume 'Yes'"), NEXTUNREADMSGDIALOG_ASSUME_YES);
	COMBOBOX_ADD (menu, _("Assume 'No'"), NEXTUNREADMSGDIALOG_ASSUME_NO);

	gtk_box_pack_start(GTK_BOX(hbox1), optmenu_nextunreadmsgdialog, FALSE, FALSE, 0);

	/* Open message on select policy */
	hbox1 = gtk_hbox_new (FALSE, 10);
	gtk_widget_show (hbox1);
	gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);	
	label = gtk_label_new (_("Open message when selected"));
	gtk_widget_show (label);
	gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 0);

	optmenu_always_show_msg = gtkut_sc_combobox_create(NULL, FALSE);
	menu = GTK_LIST_STORE(gtk_combo_box_get_model(
				GTK_COMBO_BOX(optmenu_always_show_msg)));
	gtk_widget_show (optmenu_always_show_msg);
	COMBOBOX_ADD (menu, _("Never"), OPENMSG_REQUEST_ONLY);
	COMBOBOX_ADD (menu, _("Always"), OPENMSG_ALWAYS);
	COMBOBOX_ADD (menu, _("When message view is visible"),
			OPENMSG_WHEN_VIEW_VISIBLE);
	gtk_box_pack_start(GTK_BOX(hbox1), optmenu_always_show_msg, FALSE, FALSE, 0);

	PACK_CHECK_BUTTON
		(vbox2, checkbtn_threadsubj,
		 _("Thread using subject in addition to standard headers"));

	PACK_CHECK_BUTTON
		(vbox2, checkbtn_immedexec,
		 _("Execute immediately when moving or deleting messages"));
	CLAWS_SET_TIP(checkbtn_immedexec,
			     _("Defers moving, copying and deleting of messages"
		   	       " until you choose 'Tools/Execute'"));

	vbox3 = gtkut_get_options_frame(vbox2, NULL, _("Mark message as read"));

	radio_mark_as_read_on_select = gtk_radio_button_new_with_label(NULL,
			_("when selected, after"));

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

	spinbtn_mark_as_read_delay_adj = GTK_ADJUSTMENT(gtk_adjustment_new (0, 0, 60, 1, 10, 0));
	spinbtn_mark_as_read_delay = gtk_spin_button_new
			(GTK_ADJUSTMENT (spinbtn_mark_as_read_delay_adj), 1, 0);
	gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_mark_as_read_delay,
			    FALSE, FALSE, 0);
	gtk_widget_set_size_request (spinbtn_mark_as_read_delay, 56, -1);
	gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_mark_as_read_delay),
				     TRUE);
	gtk_box_pack_start (GTK_BOX (hbox1), gtk_label_new
			(_("seconds")), FALSE, FALSE, 0);

	gtk_box_pack_start (GTK_BOX (vbox3), hbox1, FALSE, FALSE, 0);

	radio_mark_as_read_on_new_win = gtk_radio_button_new_with_label_from_widget(
			GTK_RADIO_BUTTON(radio_mark_as_read_on_select),
			_("only when opened in a new window, or replied to"));
	gtk_box_pack_start (GTK_BOX (vbox3), radio_mark_as_read_on_new_win,
			FALSE, FALSE, 0);
	gtk_widget_show_all(vbox3);
                                                                                             
	PACK_CHECK_BUTTON
		(vbox2, checkbtn_useaddrbook,
		 _("Display sender using address book"));
		 
	PACK_CHECK_BUTTON
		(vbox2, checkbtn_show_tooltips,
		 _("Show tooltips"));

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

	label_datefmt = gtk_label_new (_("Date format"));
	gtk_widget_show (label_datefmt);
	gtk_box_pack_start (GTK_BOX (hbox2), label_datefmt, FALSE, FALSE, 0);

	entry_datefmt = gtk_entry_new ();
	gtk_widget_show (entry_datefmt);
	gtk_widget_set_size_request(entry_datefmt, 200, -1);
	gtk_box_pack_start (GTK_BOX (hbox2), entry_datefmt, FALSE, FALSE, 0);

	button_datefmt = gtk_button_new_from_stock(GTK_STOCK_INFO);

	gtk_widget_show (button_datefmt);
	gtk_box_pack_start (GTK_BOX (hbox2), button_datefmt, FALSE, FALSE, 0);
	g_signal_connect (G_OBJECT (button_datefmt), "clicked",
			  G_CALLBACK (date_format_create), NULL);
	
	label_fill = gtk_label_new(" ");
	gtk_box_pack_start(GTK_BOX(hbox2), label_fill, TRUE, FALSE, 0);
	
	CLAWS_SET_TIP(button_datefmt,
			     _("Date format help"));
			     
	hbox_dispitem = gtk_hbox_new (FALSE, 8);
	gtk_widget_show (hbox_dispitem);
	gtk_box_pack_start(GTK_BOX(vbox2), hbox_dispitem, FALSE, TRUE, 0);
	
	label = gtk_label_new(_("Displayed columns"));
	gtk_widget_show(label);
	gtk_box_pack_start(GTK_BOX(hbox_dispitem), label, FALSE, FALSE, 0);
	button_dispitem = gtk_button_new_from_stock(GTK_STOCK_EDIT);
	gtk_widget_show (button_dispitem);
	gtk_box_pack_start (GTK_BOX (hbox_dispitem), button_dispitem, FALSE, FALSE, 0);
	g_signal_connect (G_OBJECT (button_dispitem), "clicked",
			  G_CALLBACK (prefs_summary_column_open),
			  NULL);

	PACK_CHECK_BUTTON
		(vbox1, checkbtn_ask_mark_all_read,
		 _("Confirm before marking all messages in a folder as read"));
	PACK_CHECK_BUTTON
		(vbox1, checkbtn_transhdr,
		 _("Translate header names"));
	CLAWS_SET_TIP(checkbtn_transhdr,
			     _("The display of standard headers (such as 'From:', 'Subject:') "
			     "will be translated into your language."));
	
	hbox2 = gtk_hbox_new (FALSE, 8);
	gtk_widget_show (hbox2);
	gtk_box_pack_start (GTK_BOX (vbox1), hbox2, FALSE, FALSE, 0);

	g_signal_connect(G_OBJECT(radio_mark_as_read_on_select), "toggled",
			 G_CALLBACK(mark_as_read_toggled),
			 spinbtn_mark_as_read_delay);

	prefs_summaries->window			= GTK_WIDGET(window);
	
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_transhdr),
			prefs_common.trans_hdr);
	combobox_select_by_data(GTK_COMBO_BOX(optmenu_folder_unread),
			prefs_common.display_folder_unread);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_useaddrbook),
			prefs_common.use_addr_book);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_tooltips),
			prefs_common.show_tooltips);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_threadsubj),
			prefs_common.thread_by_subject);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_ng_abbrev_len),
			prefs_common.ng_abbrev_len);
	gtk_entry_set_text(GTK_ENTRY(entry_datefmt), 
			prefs_common.date_format?prefs_common.date_format:"");	

	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_reopen_last_folder),
			prefs_common.goto_last_folder_on_startup);
	combobox_select_by_data(GTK_COMBO_BOX(optmenu_always_show_msg),
			prefs_common.always_show_msg);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_mark_as_read_on_new_win),
			prefs_common.mark_as_read_on_new_window);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_mark_as_read_delay),
			prefs_common.mark_as_read_delay);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_immedexec),
			prefs_common.immediate_exec);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_ask_mark_all_read),
			prefs_common.ask_mark_all_read);

	combobox_select_by_data(GTK_COMBO_BOX(optmenu_sort_key),
			prefs_common.default_sort_key);
	combobox_select_by_data(GTK_COMBO_BOX(optmenu_sort_type),
			prefs_common.default_sort_type);

	combobox_select_by_data(GTK_COMBO_BOX(optmenu_nextunreadmsgdialog),
			prefs_common.next_unread_msg_dialog);

	prefs_summaries->checkbtn_transhdr = checkbtn_transhdr;
	prefs_summaries->optmenu_folder_unread = optmenu_folder_unread;
	prefs_summaries->spinbtn_ng_abbrev_len = spinbtn_ng_abbrev_len;
	prefs_summaries->checkbtn_useaddrbook = checkbtn_useaddrbook;
	prefs_summaries->checkbtn_show_tooltips = checkbtn_show_tooltips;
	prefs_summaries->checkbtn_threadsubj = checkbtn_threadsubj;
	prefs_summaries->entry_datefmt = entry_datefmt;

	prefs_summaries->checkbtn_reopen_last_folder = checkbtn_reopen_last_folder;
	prefs_summaries->optmenu_always_show_msg = optmenu_always_show_msg;
	prefs_summaries->checkbtn_mark_as_read_on_newwin = radio_mark_as_read_on_new_win;
	prefs_summaries->spinbtn_mark_as_read_delay = spinbtn_mark_as_read_delay;
	prefs_summaries->checkbtn_immedexec = checkbtn_immedexec;
	prefs_summaries->checkbtn_ask_mark_all_read = checkbtn_ask_mark_all_read;
	prefs_summaries->optmenu_sort_key = optmenu_sort_key;
	prefs_summaries->optmenu_sort_type = optmenu_sort_type;
	prefs_summaries->optmenu_nextunreadmsgdialog = optmenu_nextunreadmsgdialog;

	prefs_summaries->page.widget = vbox1;
}
Пример #17
0
static void prefs_gpg_create_widget_func(PrefsPage *_page,
					 GtkWindow *window,
					 gpointer data)
{
	struct GPGPage *page = (struct GPGPage *) _page;
	struct GPGConfig *config;

	GtkWidget *checkbtn_use_gpg_agent;
	GtkWidget *checkbtn_passphrase_grab;
	GtkWidget *checkbtn_store_passphrase;
	GtkWidget *checkbtn_auto_check_signatures;
	GtkWidget *checkbtn_autocompletion;
	GtkWidget *checkbtn_gpg_warning;
	GtkWidget *hbox1, *hbox2;
	GtkWidget *vbox1, *vbox2;
	GtkWidget *label_gpg_path;
	GtkWidget *label_expire1;
	GtkAdjustment *spinbtn_store_passphrase_adj;
	GtkWidget *spinbtn_store_passphrase;
	GtkWidget *label_expire2;
	GtkWidget *frame_passphrase;
	GtkWidget *gpg_path, *gpg_path_btn;

	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, 0);
	gtk_widget_show (vbox2);
	gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);

	PACK_CHECK_BUTTON (vbox2, checkbtn_auto_check_signatures,
			_("Automatically check signatures"));

	PACK_CHECK_BUTTON (vbox2, checkbtn_autocompletion,
			_("Use keyring for address autocompletion"));

	vbox2 = gtkut_get_options_frame(vbox1, &frame_passphrase, _("Passphrase"));

	PACK_CHECK_BUTTON (vbox2, checkbtn_use_gpg_agent,
			_("Use gpg-agent to manage passwords"));
	if (saved_gpg_agent_info == NULL)
		gtk_widget_set_sensitive(checkbtn_use_gpg_agent, FALSE);

	PACK_CHECK_BUTTON (vbox2, checkbtn_store_passphrase,
			_("Store passphrase in memory"));

	SET_TOGGLE_SENSITIVITY_REVERSE(checkbtn_use_gpg_agent, checkbtn_store_passphrase);

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

	SET_TOGGLE_SENSITIVITY_REVERSE(checkbtn_use_gpg_agent, hbox1);

	label_expire1 = gtk_label_new(_("Expire after"));
	gtk_widget_show (label_expire1);
	gtk_box_pack_start (GTK_BOX (hbox1), label_expire1, FALSE, FALSE, 0);

	spinbtn_store_passphrase_adj =
	    GTK_ADJUSTMENT(gtk_adjustment_new(1, 0, 1440, 1, 10, 0));
	spinbtn_store_passphrase =
	    gtk_spin_button_new(GTK_ADJUSTMENT
				(spinbtn_store_passphrase_adj), 1, 0);
	gtk_widget_show(spinbtn_store_passphrase);
	gtk_box_pack_start(GTK_BOX(hbox1), spinbtn_store_passphrase, FALSE,
			   FALSE, 0);
	gtk_widget_set_size_request(spinbtn_store_passphrase, 64, -1);
	CLAWS_SET_TIP(spinbtn_store_passphrase,
		      _("Setting to '0' will store the passphrase for the whole session"));
	gtk_spin_button_set_numeric(GTK_SPIN_BUTTON
				    (spinbtn_store_passphrase), TRUE);

	label_expire2 = gtk_label_new(_("minute(s)"));
	gtk_widget_show(label_expire2);
	gtk_box_pack_start(GTK_BOX(hbox1), label_expire2, FALSE, FALSE, 0);
	gtk_misc_set_alignment(GTK_MISC(label_expire2), 0.0, 0.5);

	SET_TOGGLE_SENSITIVITY (checkbtn_store_passphrase, label_expire1);
	SET_TOGGLE_SENSITIVITY (checkbtn_store_passphrase, spinbtn_store_passphrase);
	SET_TOGGLE_SENSITIVITY (checkbtn_store_passphrase, label_expire2);

	PACK_CHECK_BUTTON (vbox2, checkbtn_passphrase_grab,
			_("Grab input while entering a passphrase"));

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

	PACK_CHECK_BUTTON (vbox2, checkbtn_gpg_warning,
			_("Display warning on start-up if GnuPG doesn't work"));

	hbox2 = gtk_hbox_new(FALSE, 6);
	label_gpg_path = gtk_label_new(_("Path to GnuPG executable"));
	gtk_box_pack_start(GTK_BOX(hbox2), label_gpg_path, FALSE, FALSE, 0);
	gpg_path = gtk_entry_new();
	gtk_box_pack_start(GTK_BOX(hbox2), gpg_path, TRUE, TRUE, 0);
	CLAWS_SET_TIP(gpg_path,
		      _("If left blank the location of the GnuPG executable will be automatically determined."));
	gpg_path_btn = gtkut_get_browse_file_btn(_("Bro_wse"));
	gtk_box_pack_start(GTK_BOX(hbox2), gpg_path_btn, FALSE, FALSE, 0);
	g_signal_connect(G_OBJECT(gpg_path_btn), "clicked",
			 G_CALLBACK(gpg_path_browse_cb), gpg_path);
	pref_set_entry_from_pref(GTK_ENTRY(gpg_path), prefs_gpg.gpg_path);

	gtk_box_pack_start(GTK_BOX(vbox2), hbox2, FALSE, FALSE, 0);
	gtk_widget_show_all(vbox1);

	config = prefs_gpg_get_config();

	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_auto_check_signatures), config->auto_check_signatures);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_autocompletion), config->autocompletion);
	if (!g_getenv("GPG_AGENT_INFO"))
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_use_gpg_agent), FALSE);
	else
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_use_gpg_agent), config->use_gpg_agent);
	if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbtn_use_gpg_agent)))
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_store_passphrase), config->store_passphrase);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_store_passphrase), (float) config->store_passphrase_timeout);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_passphrase_grab), config->passphrase_grab);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_gpg_warning), config->gpg_warning);
	gtk_entry_set_text(GTK_ENTRY(gpg_path), config->gpg_path);

	page->checkbtn_auto_check_signatures = checkbtn_auto_check_signatures;
	page->checkbtn_autocompletion = checkbtn_autocompletion;
	page->checkbtn_store_passphrase = checkbtn_store_passphrase;
	page->spinbtn_store_passphrase = spinbtn_store_passphrase;
	page->checkbtn_passphrase_grab = checkbtn_passphrase_grab;
	page->checkbtn_gpg_warning = checkbtn_gpg_warning;
	page->checkbtn_use_gpg_agent = checkbtn_use_gpg_agent;
	page->gpg_path = gpg_path;
	page->page.widget = vbox1;
}
Пример #18
0
/**
 * Format notebook distinguished name page.
 * \param pageNum Page (tab) number.
 * \param pageLbl Page (tab) label.
 */
static void export_ldif_page_dn( gint pageNum, gchar *pageLbl ) {
	GtkWidget *vbox;
	GtkWidget *table;
	GtkWidget *label;
	GtkWidget *entrySuffix;
	GtkWidget *optmenuRDN;
	GtkWidget *labelRDN;
	GtkWidget *checkUseDN;
	GtkWidget *checkEMail;
	GtkListStore *store;
	GtkTreeIter iter;
	gint top;

	vbox = gtk_vbox_new(FALSE, 8);
	gtk_container_add( GTK_CONTAINER( expldif_dlg.notebook ), vbox );
	gtk_container_set_border_width( GTK_CONTAINER (vbox), BORDER_WIDTH );

	label = gtk_label_new( pageLbl );
	gtk_widget_show( label );
	gtk_notebook_set_tab_label(
		GTK_NOTEBOOK( expldif_dlg.notebook ),
		gtk_notebook_get_nth_page(
			GTK_NOTEBOOK( expldif_dlg.notebook ), pageNum ),
		label );

	table = gtk_table_new( 6, 2, FALSE );
	gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
	gtk_container_set_border_width( GTK_CONTAINER(table), 8 );
	gtk_table_set_row_spacings(GTK_TABLE(table), 8);
	gtk_table_set_col_spacings(GTK_TABLE(table), 8 );

	/* First row */
	top = 0;
	label = gtk_label_new( _( "Suffix" ) );
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1),
		GTK_FILL, 0, 0, 0);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);

	entrySuffix = gtk_entry_new();
	gtk_table_attach(GTK_TABLE(table), entrySuffix, 1, 2, top, (top + 1),
		GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);

	CLAWS_SET_TIP(entrySuffix, _(
		"The suffix is used to create a \"Distinguished Name\" " \
		"(or DN) for an LDAP entry. Examples include:\n" \
		"  dc=claws-mail,dc=org\n" \
		"  ou=people,dc=domainname,dc=com\n" \
		"  o=Organization Name,c=Country\n"));

	/* Second row */
	top++;
	label = gtk_label_new( _( "Relative DN" ) );
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1),
		GTK_FILL, 0, 0, 0);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);

	optmenuRDN = gtkut_sc_combobox_create(NULL, TRUE);
	store = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenuRDN)));
	
	COMBOBOX_ADD(store, _("Unique ID"), EXPORT_LDIF_ID_UID);
	COMBOBOX_ADD(store, _("Display Name"), EXPORT_LDIF_ID_DNAME);
	COMBOBOX_ADD(store, _("Email Address"), EXPORT_LDIF_ID_EMAIL);

	gtk_table_attach(GTK_TABLE(table), optmenuRDN, 1, 2, top, (top + 1),
		GTK_FILL, 0, 0, 0);

	CLAWS_SET_TIP(optmenuRDN, _(
		"The LDIF file contains several data records that " \
		"are usually loaded into an LDAP server. Each data " \
		"record in the LDIF file is uniquely identified by " \
		"a \"Distinguished Name\" (or DN). The suffix is " \
		"appended to the \"Relative Distinguished Name\" "\
		"(or RDN) to create the DN. Please select one of " \
		"the available RDN options that will be used to " \
		"create the DN."));
	
	/* Third row*/
	top++;
	labelRDN = gtk_label_new("");
	gtk_label_set_line_wrap(GTK_LABEL(labelRDN), TRUE);
	gtk_label_set_justify(GTK_LABEL(labelRDN), GTK_JUSTIFY_CENTER);
	gtk_table_attach(GTK_TABLE(table), labelRDN, 0, 2, top, (top + 1),
		GTK_FILL, 0, 0, 0);
		
	/* Fourth row */
	top++;
	checkUseDN = gtk_check_button_new_with_label(
			_( "Use DN attribute if present in data" ) );
	gtk_table_attach(GTK_TABLE(table), checkUseDN, 1, 2, top, (top + 1),
		GTK_FILL, 0, 0, 0);

	CLAWS_SET_TIP(checkUseDN, _(
		"The addressbook may contain entries that were " \
		"previously imported from an LDIF file. The " \
		"\"Distinguished Name\" (DN) user attribute, if " \
		"present in the address book data, may be used in " \
		"the exported LDIF file. The RDN selected above " \
		"will be used if the DN user attribute is not found."));

	/* Fifth row */
	top++;
	checkEMail = gtk_check_button_new_with_label(
			_( "Exclude record if no Email Address" ) );
	gtk_table_attach(GTK_TABLE(table), checkEMail, 1, 2, top, (top + 1),
		GTK_FILL, 0, 0, 0);

	CLAWS_SET_TIP(checkEMail, _(
		"An addressbook may contain entries without " \
		"Email Addresses. Check this option to ignore " \
		"these records."));


	gtk_widget_show_all(vbox);

	g_signal_connect(G_OBJECT(optmenuRDN), "changed",
		G_CALLBACK(export_ldif_relative_dn_changed), labelRDN);
	gtk_combo_box_set_active(GTK_COMBO_BOX(optmenuRDN), 0);


	expldif_dlg.entrySuffix = entrySuffix;
	expldif_dlg.optmenuRDN  = optmenuRDN;
	expldif_dlg.checkUseDN  = checkUseDN;
	expldif_dlg.checkEMail  = checkEMail;
}
Пример #19
0
/**
 * Format notebook "file" page.
 * \param pageNum Page (tab) number.
 * \param pageLbl Page (tab) label.
 */
static void imp_ldif_page_file( gint pageNum, gchar *pageLbl ) {
	GtkWidget *vbox;
	GtkWidget *table;
	GtkWidget *label;
	GtkWidget *entryFile;
	GtkWidget *entryName;
	GtkWidget *btnFile;
	gint top;

	vbox = gtk_vbox_new(FALSE, 8);
	gtk_container_add( GTK_CONTAINER( impldif_dlg.notebook ), vbox );
	gtk_container_set_border_width( GTK_CONTAINER (vbox), BORDER_WIDTH );

	label = gtk_label_new( pageLbl );
	gtk_widget_show( label );
	gtk_notebook_set_tab_label(
		GTK_NOTEBOOK( impldif_dlg.notebook ),
		gtk_notebook_get_nth_page(
			GTK_NOTEBOOK( impldif_dlg.notebook ), pageNum ),
		label );

	table = gtk_table_new(2, 3, FALSE);
	gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
	gtk_container_set_border_width( GTK_CONTAINER(table), 8 );
	gtk_table_set_row_spacings(GTK_TABLE(table), 8);
	gtk_table_set_col_spacings(GTK_TABLE(table), 8 );

	/* First row */
	top = 0;
	label = gtk_label_new(_("Address Book"));
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1),
		GTK_FILL, 0, 0, 0);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);

	entryName = gtk_entry_new();
	gtk_table_attach(GTK_TABLE(table), entryName, 1, 2, top, (top + 1),
		GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);

	CLAWS_SET_TIP(entryName, _( 
		"Specify the name for the address book that will " \
		"be created from the LDIF file data." ));

	/* Second row */
	top = 1;
	label = gtk_label_new(_("File Name"));
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1),
		GTK_FILL, 0, 0, 0);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);

	entryFile = gtk_entry_new();
	gtk_table_attach(GTK_TABLE(table), entryFile, 1, 2, top, (top + 1),
		GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);

	CLAWS_SET_TIP(entryFile,
		_( "The full file specification of the LDIF file to import." ));

	btnFile = gtkut_get_browse_file_btn(_("B_rowse"));
	gtk_table_attach(GTK_TABLE(table), btnFile, 2, 3, top, (top + 1),
		GTK_FILL, 0, 3, 0);

	CLAWS_SET_TIP(btnFile,
		_( "Select the LDIF file to import." ));

	gtk_widget_show_all(vbox);

	/* Button handler */
	g_signal_connect(G_OBJECT(btnFile), "clicked",
			 G_CALLBACK(imp_ldif_file_select), NULL);

	impldif_dlg.entryFile = entryFile;
	impldif_dlg.entryName = entryName;

}