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; }
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; }
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; }
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; }
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; }
static void prefs_display_header_create(void) { GtkWidget *window; GtkWidget *vbox; GtkWidget *btn_hbox; GtkWidget *ok_btn; GtkWidget *cancel_btn; GtkWidget *confirm_area; GtkWidget *vbox1; GtkWidget *hbox1; GtkWidget *hdr_label; GtkWidget *hdr_combo; GtkWidget *btn_vbox; GtkWidget *reg_btn; GtkWidget *del_btn; GtkWidget *up_btn; GtkWidget *down_btn; GtkWidget *list_view_hbox; GtkWidget *list_view_hbox1; GtkWidget *list_view_hbox2; GtkWidget *list_view_scrolledwin; GtkWidget *headers_list_view; GtkWidget *hidden_headers_list_view; GtkWidget *checkbtn_other_headers; gint i; debug_print("Creating display header setting window...\n"); window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefs_display_header"); 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); btn_hbox = gtk_hbox_new (FALSE, 8); gtk_widget_show (btn_hbox); gtk_box_pack_end (GTK_BOX (vbox), btn_hbox, FALSE, FALSE, 0); gtkut_stock_button_set_create(&confirm_area, &cancel_btn, GTK_STOCK_CANCEL, &ok_btn, GTK_STOCK_OK, NULL, NULL); gtk_widget_show (confirm_area); gtk_box_pack_end (GTK_BOX(btn_hbox), confirm_area, FALSE, FALSE, 0); gtk_widget_grab_default (ok_btn); gtk_window_set_title (GTK_WINDOW(window), _("Displayed header configuration")); MANAGE_WINDOW_SIGNALS_CONNECT(window); g_signal_connect (G_OBJECT(window), "delete_event", G_CALLBACK(prefs_display_header_deleted), NULL); g_signal_connect (G_OBJECT(window), "key_press_event", G_CALLBACK(prefs_display_header_key_pressed), NULL); g_signal_connect (G_OBJECT(ok_btn), "clicked", G_CALLBACK(prefs_display_header_ok), NULL); g_signal_connect (G_OBJECT(cancel_btn), "clicked", G_CALLBACK(prefs_display_header_cancel), NULL); 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); hbox1 = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, TRUE, 0); hdr_label = gtk_label_new (_("Header name")); gtk_widget_show (hdr_label); gtk_box_pack_start (GTK_BOX (hbox1), hdr_label, FALSE, FALSE, 0); hdr_combo = gtk_combo_box_text_new_with_entry(); for(i=0; i < 9 ; i++) gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (hdr_combo), (*defaults[i] == '-') ? defaults[i]+1 : defaults[i]); gtk_combo_box_set_active(GTK_COMBO_BOX(hdr_combo), 0); gtk_widget_show (hdr_combo); gtk_box_pack_start (GTK_BOX (hbox1), hdr_combo, TRUE, TRUE, 0); gtk_widget_set_size_request (hdr_combo, 150, -1); list_view_hbox = gtk_hbox_new (FALSE, 10); gtk_widget_show (list_view_hbox); gtk_box_pack_start (GTK_BOX (vbox1), list_view_hbox, TRUE, TRUE, 0); /* display headers list */ list_view_hbox1 = gtk_hbox_new (FALSE, 8); gtk_widget_show (list_view_hbox1); gtk_box_pack_start (GTK_BOX (list_view_hbox), list_view_hbox1, TRUE, TRUE, 0); list_view_scrolledwin = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_size_request (list_view_scrolledwin, 200, 210); gtk_widget_show (list_view_scrolledwin); gtk_box_pack_start (GTK_BOX (list_view_hbox1), list_view_scrolledwin, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (list_view_scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(list_view_scrolledwin), GTK_SHADOW_IN); headers_list_view = prefs_display_header_list_view_create (_("Displayed Headers")); gtk_widget_show (headers_list_view); gtk_container_add(GTK_CONTAINER(list_view_scrolledwin), headers_list_view); gtk_tree_view_set_reorderable(GTK_TREE_VIEW(headers_list_view), TRUE); g_signal_connect(G_OBJECT(headers_list_view), "drag_end", G_CALLBACK(drag_end), headers_list_view); /* connect rows change for this list view's model */ g_signal_connect(G_OBJECT(gtk_tree_view_get_model(GTK_TREE_VIEW(headers_list_view))), "rows-reordered", G_CALLBACK(headers_list_model_rows_reordered), headers_list_view); btn_vbox = gtk_vbox_new (FALSE, 8); gtk_widget_show (btn_vbox); gtk_box_pack_start (GTK_BOX (list_view_hbox1), btn_vbox, 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_vbox), reg_btn, FALSE, TRUE, 0); g_signal_connect (G_OBJECT (reg_btn), "clicked", G_CALLBACK (prefs_display_header_register_cb), GINT_TO_POINTER(FALSE)); del_btn = gtk_button_new_from_stock (GTK_STOCK_REMOVE); gtk_widget_show (del_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), del_btn, FALSE, TRUE, 0); g_signal_connect (G_OBJECT (del_btn), "clicked", G_CALLBACK (prefs_display_header_delete_cb), headers_list_view); 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_display_header_up), NULL); 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_display_header_down), NULL); /* hidden headers list */ list_view_hbox2 = gtk_hbox_new (FALSE, 8); gtk_widget_show (list_view_hbox2); gtk_box_pack_start (GTK_BOX (list_view_hbox), list_view_hbox2, TRUE, TRUE, 0); list_view_scrolledwin = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_size_request (list_view_scrolledwin, 200, 210); gtk_widget_show (list_view_scrolledwin); gtk_box_pack_start (GTK_BOX (list_view_hbox2), list_view_scrolledwin, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (list_view_scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(list_view_scrolledwin), GTK_SHADOW_IN); hidden_headers_list_view = prefs_display_header_list_view_create (_("Hidden headers")); gtk_widget_show (hidden_headers_list_view); gtk_container_add (GTK_CONTAINER (list_view_scrolledwin), hidden_headers_list_view); btn_vbox = gtk_vbox_new (FALSE, 8); gtk_widget_show (btn_vbox); gtk_box_pack_start (GTK_BOX (list_view_hbox2), btn_vbox, 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_vbox), reg_btn, FALSE, TRUE, 0); g_signal_connect (G_OBJECT (reg_btn), "clicked", G_CALLBACK (prefs_display_header_register_cb), GINT_TO_POINTER(TRUE)); del_btn = gtk_button_new_from_stock (GTK_STOCK_DELETE); gtk_widget_show (del_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), del_btn, FALSE, TRUE, 0); g_signal_connect (G_OBJECT (del_btn), "clicked", G_CALLBACK (prefs_display_header_delete_cb), hidden_headers_list_view); PACK_CHECK_BUTTON (vbox, checkbtn_other_headers, _("Show all unspecified headers")); SET_TOGGLE_SENSITIVITY (checkbtn_other_headers, list_view_hbox2); gtk_widget_show_all(window); dispheader.window = window; dispheader.ok_btn = ok_btn; dispheader.cancel_btn = cancel_btn; dispheader.hdr_combo = hdr_combo; dispheader.headers_list_view = headers_list_view; dispheader.hidden_headers_list_view = hidden_headers_list_view; dispheader.other_headers = checkbtn_other_headers; }
static void prefs_display_header_create(void) { GtkWidget *window; GtkWidget *vbox; GtkWidget *btn_hbox; GtkWidget *confirm_area; GtkWidget *ok_btn; GtkWidget *cancel_btn; GtkWidget *vbox1; GtkWidget *hbox1; GtkWidget *hdr_label; GtkWidget *hdr_combo; GtkWidget *btn_vbox; GtkWidget *reg_btn; GtkWidget *del_btn; GtkWidget *up_btn; GtkWidget *down_btn; GtkWidget *clist_hbox; GtkWidget *clist_hbox1; GtkWidget *clist_hbox2; GtkWidget *clist_scrolledwin; GtkWidget *headers_clist; GtkWidget *hidden_headers_clist; GtkWidget *checkbtn_other_headers; gchar *title[1]; debug_print(_("Creating display header setting window...\n")); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width (GTK_CONTAINER (window), 8); gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_modal (GTK_WINDOW (window), TRUE); gtk_window_set_policy (GTK_WINDOW (window), FALSE, TRUE, FALSE); vbox = gtk_vbox_new (FALSE, 6); gtk_widget_show (vbox); gtk_container_add (GTK_CONTAINER (window), vbox); btn_hbox = gtk_hbox_new (FALSE, 8); gtk_widget_show (btn_hbox); gtk_box_pack_end (GTK_BOX (vbox), btn_hbox, FALSE, FALSE, 0); gtkut_stock_button_set_create(&confirm_area, &ok_btn, GTK_STOCK_OK, &cancel_btn, GTK_STOCK_CANCEL, NULL, NULL); gtk_widget_show (confirm_area); gtk_box_pack_end (GTK_BOX(btn_hbox), confirm_area, FALSE, FALSE, 0); gtk_widget_grab_default (ok_btn); gtk_window_set_title (GTK_WINDOW(window), _("Display header setting")); MANAGE_WINDOW_SIGNALS_CONNECT(window); g_signal_connect (G_OBJECT(window), "delete_event", G_CALLBACK(prefs_display_header_deleted), NULL); g_signal_connect (G_OBJECT(window), "key_press_event", G_CALLBACK(prefs_display_header_key_pressed), NULL); g_signal_connect (G_OBJECT(ok_btn), "clicked", G_CALLBACK(prefs_display_header_ok), NULL); g_signal_connect (G_OBJECT(cancel_btn), "clicked", G_CALLBACK(prefs_display_header_cancel), NULL); 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); hbox1 = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, TRUE, 0); hdr_label = gtk_label_new (_("Header name")); gtk_widget_show (hdr_label); gtk_box_pack_start (GTK_BOX (hbox1), hdr_label, FALSE, FALSE, 0); hdr_combo = gtk_combo_new (); gtk_widget_show (hdr_combo); gtk_box_pack_start (GTK_BOX (hbox1), hdr_combo, TRUE, TRUE, 0); gtk_widget_set_size_request (hdr_combo, 150, -1); gtkut_combo_set_items (GTK_COMBO (hdr_combo), "From", "To", "Cc", "Subject", "Date", "Reply-To", "Sender", "User-Agent", "X-Mailer", NULL); clist_hbox = gtk_hbox_new (FALSE, 10); gtk_widget_show (clist_hbox); gtk_box_pack_start (GTK_BOX (vbox1), clist_hbox, TRUE, TRUE, 0); /* display headers list */ clist_hbox1 = gtk_hbox_new (FALSE, 8); gtk_widget_show (clist_hbox1); gtk_box_pack_start (GTK_BOX (clist_hbox), clist_hbox1, TRUE, TRUE, 0); clist_scrolledwin = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_size_request (clist_scrolledwin, 200, 210); gtk_widget_show (clist_scrolledwin); gtk_box_pack_start (GTK_BOX (clist_hbox1), clist_scrolledwin, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (clist_scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); title[0] = _("Displayed Headers"); headers_clist = gtk_clist_new_with_titles(1, title); gtk_widget_show (headers_clist); gtk_container_add (GTK_CONTAINER (clist_scrolledwin), headers_clist); gtk_clist_set_selection_mode (GTK_CLIST (headers_clist), GTK_SELECTION_BROWSE); gtk_clist_set_reorderable (GTK_CLIST (headers_clist), TRUE); gtk_clist_set_use_drag_icons (GTK_CLIST (headers_clist), FALSE); gtkut_clist_set_redraw (GTK_CLIST (headers_clist)); GTK_WIDGET_UNSET_FLAGS (GTK_CLIST (headers_clist)->column[0].button, GTK_CAN_FOCUS); g_signal_connect_after (G_OBJECT (headers_clist), "row_move", G_CALLBACK (prefs_display_header_row_moved), NULL); btn_vbox = gtk_vbox_new (FALSE, 8); gtk_widget_show (btn_vbox); gtk_box_pack_start (GTK_BOX (clist_hbox1), btn_vbox, FALSE, FALSE, 0); reg_btn = gtk_button_new_with_label (_("Add")); gtk_widget_show (reg_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), reg_btn, FALSE, TRUE, 0); g_signal_connect (G_OBJECT (reg_btn), "clicked", G_CALLBACK (prefs_display_header_register_cb), GINT_TO_POINTER(FALSE)); del_btn = gtk_button_new_with_label (_("Delete")); gtk_widget_show (del_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), del_btn, FALSE, TRUE, 0); g_signal_connect (G_OBJECT (del_btn), "clicked", G_CALLBACK (prefs_display_header_delete_cb), headers_clist); up_btn = gtk_button_new_with_label (_("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_display_header_up), NULL); down_btn = gtk_button_new_with_label (_("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_display_header_down), NULL); /* hidden headers list */ clist_hbox2 = gtk_hbox_new (FALSE, 8); gtk_widget_show (clist_hbox2); gtk_box_pack_start (GTK_BOX (clist_hbox), clist_hbox2, TRUE, TRUE, 0); clist_scrolledwin = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_size_request (clist_scrolledwin, 200, 210); gtk_widget_show (clist_scrolledwin); gtk_box_pack_start (GTK_BOX (clist_hbox2), clist_scrolledwin, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (clist_scrolledwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); title[0] = _("Hidden headers"); hidden_headers_clist = gtk_clist_new_with_titles(1, title); gtk_widget_show (hidden_headers_clist); gtk_container_add (GTK_CONTAINER (clist_scrolledwin), hidden_headers_clist); gtk_clist_set_selection_mode (GTK_CLIST (hidden_headers_clist), GTK_SELECTION_BROWSE); gtk_clist_set_auto_sort(GTK_CLIST (hidden_headers_clist), TRUE); gtkut_clist_set_redraw (GTK_CLIST (hidden_headers_clist)); GTK_WIDGET_UNSET_FLAGS (GTK_CLIST (hidden_headers_clist)-> column[0].button, GTK_CAN_FOCUS); btn_vbox = gtk_vbox_new (FALSE, 8); gtk_widget_show (btn_vbox); gtk_box_pack_start (GTK_BOX (clist_hbox2), btn_vbox, FALSE, FALSE, 0); reg_btn = gtk_button_new_with_label (_("Add")); gtk_widget_show (reg_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), reg_btn, FALSE, TRUE, 0); g_signal_connect (G_OBJECT (reg_btn), "clicked", G_CALLBACK (prefs_display_header_register_cb), GINT_TO_POINTER (TRUE)); del_btn = gtk_button_new_with_label (_("Delete")); gtk_widget_show (del_btn); gtk_box_pack_start (GTK_BOX (btn_vbox), del_btn, FALSE, TRUE, 0); g_signal_connect (G_OBJECT (del_btn), "clicked", G_CALLBACK (prefs_display_header_delete_cb), hidden_headers_clist); PACK_CHECK_BUTTON (btn_hbox, checkbtn_other_headers, _("Show all unspecified headers")); SET_TOGGLE_SENSITIVITY (checkbtn_other_headers, clist_hbox2); gtk_widget_show_all(window); dispheader.window = window; dispheader.confirm_area = confirm_area; dispheader.ok_btn = ok_btn; dispheader.cancel_btn = cancel_btn; dispheader.hdr_combo = hdr_combo; dispheader.hdr_entry = GTK_COMBO (hdr_combo)->entry; dispheader.headers_clist = headers_clist; dispheader.hidden_headers_clist = hidden_headers_clist; dispheader.other_headers = checkbtn_other_headers; }
static void prefs_message_create_widget(PrefsPage *_page, GtkWindow *window, gpointer data) { MessagePage *prefs_message = (MessagePage *) _page; GtkWidget *vbox1; GtkWidget *vbox2; GtkWidget *hbox1; GtkWidget *checkbtn_disphdrpane; GtkWidget *checkbtn_disphdr; GtkWidget *checkbtn_dispxface; GtkWidget *button_edit_disphdr; GtkWidget *checkbtn_html; GtkWidget *checkbtn_html_plugin; GtkWidget *checkbtn_promote_html_part; GtkWidget *hbox_linespc; GtkWidget *label_linespc; GtkAdjustment *spinbtn_linespc_adj; GtkWidget *spinbtn_linespc; GtkWidget *frame; GtkWidget *vbox_scr; GtkWidget *checkbtn_smoothscroll; GtkWidget *hbox_scr; GtkWidget *label_scr; GtkAdjustment *spinbtn_scrollstep_adj; GtkWidget *spinbtn_scrollstep; GtkWidget *checkbtn_halfpage; GtkWidget *checkbtn_hide_quoted; GtkWidget *checkbtn_attach_desc; GtkWidget *frame_quote; GtkWidget *hbox2; GtkWidget *vbox_quote; GtkWidget *entry_quote_chars; GtkWidget *label_quote_chars; vbox1 = gtk_vbox_new (FALSE, VSPACING); gtk_widget_show (vbox1); gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); vbox2 = gtkut_get_options_frame(vbox1, &frame, _("Headers")); PACK_CHECK_BUTTON(vbox2, checkbtn_disphdrpane, _("Display header pane above message view")); #if HAVE_LIBCOMPFACE PACK_CHECK_BUTTON(vbox2, checkbtn_dispxface, _("Display (X-)Face in message view")); #else PACK_CHECK_BUTTON(vbox2, checkbtn_dispxface, _("Display Face in message view")); #endif gtk_widget_set_sensitive(checkbtn_dispxface, !prefs_common.display_header_pane); g_signal_connect(G_OBJECT(checkbtn_disphdrpane), "toggled", G_CALLBACK(disphdr_pane_toggled), checkbtn_dispxface); hbox1 = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, TRUE, 0); PACK_CHECK_BUTTON(hbox1, checkbtn_disphdr, _("Display headers in message view")); button_edit_disphdr = gtk_button_new_from_stock(GTK_STOCK_EDIT); gtk_widget_show (button_edit_disphdr); gtk_box_pack_start (GTK_BOX (hbox1), button_edit_disphdr, FALSE, TRUE, 0); g_signal_connect (G_OBJECT (button_edit_disphdr), "clicked", G_CALLBACK (prefs_display_header_open), NULL); SET_TOGGLE_SENSITIVITY(checkbtn_disphdr, button_edit_disphdr); vbox2 = gtkut_get_options_frame(vbox1, &frame, _("HTML messages")); PACK_CHECK_BUTTON(vbox2, checkbtn_html, _("Render HTML messages as text")); PACK_CHECK_BUTTON(vbox2, checkbtn_html_plugin, _("Render HTML-only messages with plugin if possible")); PACK_CHECK_BUTTON(vbox2, checkbtn_promote_html_part, _("Select the HTML part of multipart/alternative messages")); hbox1 = gtk_hbox_new (FALSE, 32); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, TRUE, 0); hbox_linespc = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (hbox1), hbox_linespc, FALSE, TRUE, 0); label_linespc = gtk_label_new (_("Line space")); gtk_widget_show (label_linespc); gtk_box_pack_start (GTK_BOX (hbox_linespc), label_linespc, FALSE, FALSE, 0); spinbtn_linespc_adj = GTK_ADJUSTMENT(gtk_adjustment_new (2, 0, 16, 1, 1, 0)); spinbtn_linespc = gtk_spin_button_new (GTK_ADJUSTMENT (spinbtn_linespc_adj), 1, 0); gtk_widget_show (spinbtn_linespc); gtk_box_pack_start (GTK_BOX (hbox_linespc), spinbtn_linespc, FALSE, FALSE, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_linespc), TRUE); label_linespc = gtk_label_new (_("pixels")); gtk_widget_show (label_linespc); gtk_box_pack_start (GTK_BOX (hbox_linespc), label_linespc, FALSE, FALSE, 0); gtk_widget_show_all (hbox1); vbox_scr = gtkut_get_options_frame(vbox1, &frame, _("Scroll")); PACK_CHECK_BUTTON(vbox_scr, checkbtn_halfpage, _("Half page")); hbox1 = gtk_hbox_new (FALSE, 32); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox_scr), hbox1, FALSE, TRUE, 0); PACK_CHECK_BUTTON(hbox1, checkbtn_smoothscroll, _("Smooth scroll")); hbox_scr = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox_scr); gtk_box_pack_start (GTK_BOX (hbox1), hbox_scr, FALSE, FALSE, 0); label_scr = gtk_label_new (_("Step")); gtk_widget_show (label_scr); gtk_box_pack_start (GTK_BOX (hbox_scr), label_scr, FALSE, FALSE, 0); spinbtn_scrollstep_adj = GTK_ADJUSTMENT(gtk_adjustment_new (1, 1, 100, 1, 10, 0)); spinbtn_scrollstep = gtk_spin_button_new (GTK_ADJUSTMENT (spinbtn_scrollstep_adj), 1, 0); gtk_widget_show (spinbtn_scrollstep); gtk_box_pack_start (GTK_BOX (hbox_scr), spinbtn_scrollstep, FALSE, FALSE, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_scrollstep), TRUE); label_scr = gtk_label_new (_("pixels")); gtk_widget_show (label_scr); gtk_box_pack_start (GTK_BOX (hbox_scr), label_scr, FALSE, FALSE, 0); SET_TOGGLE_SENSITIVITY (checkbtn_smoothscroll, hbox_scr) PACK_CHECK_BUTTON(vbox1, checkbtn_attach_desc, _("Show attachment descriptions (rather than names)")); /* quote chars */ PACK_FRAME (vbox1, frame_quote, _("Quotation")); vbox_quote = gtk_vbox_new (FALSE, VSPACING_NARROW); gtk_widget_show (vbox_quote); gtk_container_add (GTK_CONTAINER (frame_quote), vbox_quote); gtk_container_set_border_width (GTK_CONTAINER (vbox_quote), 8); hbox1 = gtk_hbox_new (FALSE, 32); gtk_widget_show (hbox1); PACK_CHECK_BUTTON(vbox_quote, checkbtn_hide_quoted, _("Collapse quoted text on double click")); gtk_box_pack_start (GTK_BOX (vbox_quote), hbox1, FALSE, FALSE, 0); hbox2 = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox2); gtk_box_pack_start (GTK_BOX (hbox1), hbox2, FALSE, FALSE, 0); label_quote_chars = gtk_label_new (_("Treat these characters as quotation marks")); gtk_widget_show (label_quote_chars); gtk_box_pack_start (GTK_BOX (hbox2), label_quote_chars, FALSE, FALSE, 0); entry_quote_chars = gtk_entry_new (); gtk_widget_show (entry_quote_chars); gtk_box_pack_start (GTK_BOX (hbox2), entry_quote_chars, FALSE, FALSE, 0); gtk_widget_set_size_request (entry_quote_chars, 64, -1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_disphdrpane), prefs_common.display_header_pane); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_dispxface), prefs_common.display_xface); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_disphdr), prefs_common.display_header); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_html), prefs_common.render_html); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_html_plugin), prefs_common.invoke_plugin_on_html); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_promote_html_part), prefs_common.promote_html_part); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_smoothscroll), prefs_common.enable_smooth_scroll); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_hide_quoted), prefs_common.hide_quoted); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_halfpage), prefs_common.scroll_halfpage); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_attach_desc), prefs_common.attach_desc); gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_linespc), prefs_common.line_space); gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_scrollstep), prefs_common.scroll_step); gtk_entry_set_text(GTK_ENTRY(entry_quote_chars), prefs_common.quote_chars?prefs_common.quote_chars:""); prefs_message->window = GTK_WIDGET(window); prefs_message->checkbtn_disphdrpane = checkbtn_disphdrpane; prefs_message->checkbtn_dispxface = checkbtn_dispxface; prefs_message->checkbtn_disphdr = checkbtn_disphdr; prefs_message->checkbtn_html = checkbtn_html; prefs_message->checkbtn_html_plugin = checkbtn_html_plugin; prefs_message->checkbtn_promote_html_part = checkbtn_promote_html_part; prefs_message->spinbtn_linespc = spinbtn_linespc; prefs_message->checkbtn_smoothscroll = checkbtn_smoothscroll; prefs_message->checkbtn_hide_quoted = checkbtn_hide_quoted; prefs_message->spinbtn_scrollstep = spinbtn_scrollstep; prefs_message->checkbtn_halfpage = checkbtn_halfpage; prefs_message->checkbtn_attach_desc = checkbtn_attach_desc; prefs_message->entry_quote_chars = entry_quote_chars; prefs_message->page.widget = vbox1; }