common preferences or the warning window itself).
+2001-05-02 [sergey]
+
+ * src/alertpanel.h (AlertValue): added G_ALERT_VALUE_MASK,
+ G_ALERTDISABLE.
+
+ * src/alertpanel.c (alertpanel_create): new argument can_disable,
+ all existing callers changed to pass FALSE; create a check button
+ to disable the message.
+ (alertpanel_message_with_disable): new function.
+ (alertpanel_show): mask value with G_ALERT_VALUE_MASK.
+ (alertpanel_button_toggled): new function.
+ (alertpanel_button_clicked, alertpanel_close): set value using
+ G_ALERT_VALUE_MASK.
+
+ * src/prefs_common.h (PrefsCommon): new field gpgme_warning.
+
+ * src/prefs_common.c (prefs_privacy_create): new check button
+ checkbtn_gpgme_warning.
+
+ * src/main.c (main): moved preferences reading before gpgme
+ initialization; check prefs_common.gpgme_warning before giving the
+ GnuPG warning and set it to FALSE if the user wants to disable the
+ warning.
+
2001-05-02 [hiroyuki]
* src/prefs_display_headers.c: modified the layout and some labels.
const gchar *message,
const gchar *button1_label,
const gchar *button2_label,
- const gchar *button3_label);
+ const gchar *button3_label,
+ gboolean can_disable);
+static void alertpanel_button_toggled (GtkToggleButton *button,
+ gpointer data);
static void alertpanel_button_clicked (GtkWidget *widget,
gpointer data);
static void alertpanel_close (GtkWidget *widget,
alertpanel_is_open = TRUE;
alertpanel_create(title, message, button1_label, button2_label,
- button3_label);
+ button3_label, FALSE);
alertpanel_show();
debug_print("return value = %d\n", value);
else
alertpanel_is_open = TRUE;
- alertpanel_create(title, message, NULL, NULL, NULL);
+ alertpanel_create(title, message, NULL, NULL, NULL, FALSE);
alertpanel_show();
}
+AlertValue alertpanel_message_with_disable(const gchar *title,
+ const gchar *message)
+{
+ if (alertpanel_is_open)
+ return;
+ else
+ alertpanel_is_open = TRUE;
+
+ alertpanel_create(title, message, NULL, NULL, NULL, TRUE);
+ alertpanel_show();
+ return value;
+}
+
void alertpanel_notice(const gchar *format, ...)
{
va_list args;
manage_window_set_transient(GTK_WINDOW(dialog));
value = G_ALERTWAIT;
- while (value == G_ALERTWAIT)
+ while ((value & G_ALERT_VALUE_MASK) == G_ALERTWAIT)
gtk_main_iteration();
gtk_widget_destroy(dialog);
const gchar *message,
const gchar *button1_label,
const gchar *button2_label,
- const gchar *button3_label)
+ const gchar *button3_label,
+ gboolean can_disable)
{
static GdkFont *titlefont;
GtkStyle *style;
GtkWidget *button3;
const gchar *label2;
const gchar *label3;
+ GtkWidget *hbox2;
+ GtkWidget *disable_chkbtn;
+ GtkWidget *box_for_buttons;
debug_print(_("Creating alert panel dialog...\n"));
button2_label ? &button2 : NULL, label2,
button3_label ? &button3 : NULL, label3);
- gtk_box_pack_end(GTK_BOX(vbox), confirm_area, FALSE, FALSE, 0);
+ if (can_disable) {
+ hbox2 = gtk_hbox_new(FALSE, 8);
+ gtk_box_pack_end(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
+ disable_chkbtn = gtk_check_button_new_with_label
+ (_("Show this message next time"));
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(disable_chkbtn),
+ TRUE);
+ gtk_signal_connect(GTK_OBJECT(disable_chkbtn), "toggled",
+ GTK_SIGNAL_FUNC(alertpanel_button_toggled),
+ GUINT_TO_POINTER(G_ALERTDISABLE));
+ gtk_box_pack_start(GTK_BOX(hbox2), disable_chkbtn,
+ TRUE, TRUE, 0);
+ box_for_buttons = hbox2;
+ } else
+ box_for_buttons = vbox;
+
+ gtk_box_pack_end(GTK_BOX(box_for_buttons), confirm_area,
+ FALSE, FALSE, 0);
gtk_widget_grab_default(button1);
gtk_widget_grab_focus(button1);
if (button2_label && *button2_label == '+') {
gtk_widget_show_all(dialog);
}
+static void alertpanel_button_toggled(GtkToggleButton *button,
+ gpointer data)
+{
+ if (gtk_toggle_button_get_active(button))
+ value &= ~GPOINTER_TO_UINT(data);
+ else
+ value |= GPOINTER_TO_UINT(data);
+}
+
static void alertpanel_button_clicked(GtkWidget *widget, gpointer data)
{
- value = (AlertValue)data;
+ value = (value & ~G_ALERT_VALUE_MASK) | (AlertValue)data;
}
static void alertpanel_close(GtkWidget *widget, GdkEventAny *event,
if (((GdkEventKey *)event)->keyval != GDK_Escape)
return;
- value = (AlertValue)data;
+ value = (value & ~G_ALERT_VALUE_MASK) | (AlertValue)data;
}
G_ALERTDEFAULT,
G_ALERTALTERNATE,
G_ALERTOTHER,
- G_ALERTWAIT
+ G_ALERTWAIT,
+
+ G_ALERT_VALUE_MASK = 0x0000FFFF,
+ G_ALERTDISABLE = 0x00010000
} AlertValue;
AlertValue alertpanel (const gchar *title,
void alertpanel_message (const gchar *title,
const gchar *message);
+AlertValue alertpanel_message_with_disable(const gchar *title,
+ const gchar *message);
+
void alertpanel_notice (const gchar *format,
...) G_GNUC_PRINTF(1, 2);
void alertpanel_warning (const gchar *format,
srandom((gint)time(NULL));
+ prefs_common_read_config();
+ prefs_common_save_config();
+ prefs_filter_read_config();
+ prefs_filter_write_config();
+ prefs_display_headers_read_config();
+ prefs_display_headers_write_config();
+
#if USE_GPGME
if (gpgme_check_engine()) { /* Also does some gpgme init */
rfc2015_disable_all();
debug_print("gpgme_engine_version:\n%s\n",
gpgme_get_engine_info());
- alertpanel_warning(_("GnuPG is not installed properly.\n"
- "OpenPGP support disabled."));
+
+ if (prefs_common.gpgme_warning) {
+ AlertValue v = alertpanel_message_with_disable
+ (_("Warning"),
+ _("GnuPG is not installed properly.\n"
+ "OpenPGP support disabled."));
+ if (v & G_ALERTDISABLE) {
+ prefs_common.gpgme_warning = FALSE;
+ prefs_common_save_config();
+ }
+ }
}
gpgme_register_idle(idle_function_for_gpgme);
#endif
- prefs_common_read_config();
- prefs_common_save_config();
- prefs_filter_read_config();
- prefs_filter_write_config();
- prefs_display_headers_read_config();
- prefs_display_headers_write_config();
-
gtkut_widget_init();
mainwin = main_window_create
#if USE_GPGME
static struct Privacy {
+ GtkWidget *checkbtn_gpgme_warning;
GtkWidget *checkbtn_default_encrypt;
GtkWidget *checkbtn_default_sign;
GtkWidget *checkbtn_auto_check_signatures;
#if USE_GPGME
/* Privacy */
+ {"gpgme_warning", "TRUE", &prefs_common.gpgme_warning, P_BOOL,
+ &privacy.checkbtn_gpgme_warning,
+ prefs_set_data_from_toggle, prefs_set_toggle},
{"default_encrypt", "FALSE", &prefs_common.default_encrypt, P_BOOL,
&privacy.checkbtn_default_encrypt,
prefs_set_data_from_toggle, prefs_set_toggle},
GtkWidget *vbox1;
GtkWidget *vbox2;
GtkWidget *hbox1;
+ GtkWidget *checkbtn_gpgme_warning;
GtkWidget *checkbtn_default_encrypt;
GtkWidget *checkbtn_default_sign;
GtkWidget *checkbtn_auto_check_signatures;
gtk_widget_show (vbox2);
gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
+ PACK_CHECK_BUTTON
+ (vbox2, checkbtn_gpgme_warning,
+ _("Display warning on startup if GnuPG does not work"));
+
PACK_CHECK_BUTTON (vbox2, checkbtn_default_encrypt,
_("Encrypt message by default"));
/* FIXME: disabled because not implemented */
gtk_widget_set_sensitive(optmenu, FALSE);
+ privacy.checkbtn_gpgme_warning = checkbtn_gpgme_warning;
privacy.checkbtn_default_encrypt = checkbtn_default_encrypt;
privacy.checkbtn_default_sign = checkbtn_default_sign;
privacy.checkbtn_auto_check_signatures
gchar *mime_audio_player;
/* Privacy */
+ gboolean gpgme_warning;
gboolean default_encrypt;
gboolean default_sign;
gboolean auto_check_signatures;