/*
- * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 Colin Leroy <colin@colino.net> and
- * the Claws Mail team
+ * Claws Mail -- a GTK based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2021 the Claws Mail team and Colin Leroy
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "defs.h"
#include "mainwindow.h"
-#include "password.h"
+#include "passwordstore.h"
#include "prefs.h"
#include "prefs_gtk.h"
#include "prefswindow.h"
PrefsPage page;
GtkWidget *alert_enable_btn;
- GtkWidget *alert_delay_spinbtn;
+ GtkWidget *alert_delay_h_spinbtn;
+ GtkWidget *alert_delay_m_spinbtn;
GtkWidget *export_enable_btn;
GtkWidget *export_subs_btn;
(!strncmp(export_path, "http://", 7) ||
!strncmp(export_path, "ftp://", 6) ||
!strncmp(export_path, "https://", 8) ||
- !strncmp(export_path, "sftp://", 5) ||
+ !strncmp(export_path, "ftps://", 7) ||
+ !strncmp(export_path, "sftp://", 7) ||
!strncmp(export_path, "webcal://", 9) ||
!strncmp(export_path, "webcals://", 10))) {
gtk_widget_set_sensitive(page->export_user_label, TRUE);
(!strncmp(export_freebusy_path, "http://", 7) ||
!strncmp(export_freebusy_path, "ftp://", 6) ||
!strncmp(export_freebusy_path, "https://", 8) ||
- !strncmp(export_freebusy_path, "sftp://", 5) ||
+ !strncmp(export_freebusy_path, "ftps://", 7) ||
+ !strncmp(export_freebusy_path, "sftp://", 7) ||
!strncmp(export_freebusy_path, "webcal://", 9) ||
!strncmp(export_freebusy_path, "webcals://", 10))) {
gtk_widget_set_sensitive(page->export_freebusy_user_label, TRUE);
set_auth_sensitivity((struct VcalendarPage *)data);
}
+static void alert_spinbutton_value_changed(GtkWidget *widget, gpointer data)
+{
+ struct VcalendarPage *page = (struct VcalendarPage *)data;
+ gint minutes = gtk_spin_button_get_value_as_int (
+ GTK_SPIN_BUTTON (page->alert_delay_m_spinbtn));
+ gint hours = gtk_spin_button_get_value_as_int (
+ GTK_SPIN_BUTTON (page->alert_delay_h_spinbtn));
+ if (minutes < 1 && hours == 0) {
+ gtk_spin_button_set_value (
+ GTK_SPIN_BUTTON (page->alert_delay_m_spinbtn), 1.0);
+ }
+}
+
static gboolean orage_available(void)
{
gchar *tmp = g_find_program_in_path("orage");
GtkWidget *frame_alert;
GtkWidget *alert_enable_checkbtn;
- GtkObject *alert_enable_spinbtn_adj;
- GtkWidget *alert_enable_spinbtn;
+ GtkAdjustment *alert_enable_spinbtn_adj;
+ GtkWidget *alert_enable_h_spinbtn;
+ GtkWidget *alert_enable_m_spinbtn;
GtkWidget *label_alert_enable;
GtkWidget *frame_export;
gchar *export_pass = NULL;
gchar *export_freebusy_pass = NULL;
- vbox1 = gtk_vbox_new (FALSE, VSPACING);
+ vbox1 = gtk_box_new(GTK_ORIENTATION_VERTICAL, VSPACING);
gtk_widget_show (vbox1);
gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
- vbox2 = gtk_vbox_new (FALSE, 4);
+ vbox2 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 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);
+ vbox3 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 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);
+ hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
gtk_widget_show (hbox1);
gtk_box_pack_start(GTK_BOX (vbox3), hbox1, TRUE, TRUE, 0);
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 (10, 1, 24*60, 1, 10, 0);
- alert_enable_spinbtn = gtk_spin_button_new
- (GTK_ADJUSTMENT (alert_enable_spinbtn_adj), 1, 0);
- gtk_widget_set_size_request (alert_enable_spinbtn, 64, -1);
- gtk_widget_show (alert_enable_spinbtn);
- gtk_box_pack_start(GTK_BOX (hbox1), alert_enable_spinbtn, FALSE, FALSE, 0);
- gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (alert_enable_spinbtn), TRUE);
+ 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_box_pack_start (
+ GTK_BOX (hbox1), label_alert_enable, FALSE, FALSE, 0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(alert_enable_checkbtn),
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(alert_enable_checkbtn),
vcalprefs.alert_enable);
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(alert_enable_spinbtn),
- vcalprefs.alert_delay);
- SET_TOGGLE_SENSITIVITY(alert_enable_checkbtn, alert_enable_spinbtn);
+ 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);
+ vbox3 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 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);
+ hbox2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
gtk_widget_show (hbox2);
gtk_box_pack_start(GTK_BOX (vbox3), hbox2, TRUE, TRUE, 0);
"(http://server/path/file.ics)"));
/* export auth */
- hbox2 = gtk_hbox_new (FALSE, 8);
+ hbox2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
gtk_widget_show (hbox2);
gtk_box_pack_start(GTK_BOX (vbox3), hbox2, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX (hbox2), export_pass_entry, FALSE, FALSE, 0);
/* export subscriptions too */
- hbox2 = gtk_hbox_new (FALSE, 8);
+ hbox2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 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"));
+ 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);
+ hbox3 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
gtk_widget_show (hbox3);
gtk_box_pack_start(GTK_BOX (vbox3), hbox3, TRUE, TRUE, 0);
gtk_entry_set_text(GTK_ENTRY(export_command_entry),
vcalprefs.export_command);
- hbox3 = gtk_hbox_new (FALSE, 8);
+ hbox3 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 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"));
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);
+ hbox3 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 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"));
/* freebusy export */
/* export enable + path stuff */
PACK_FRAME(vbox2, frame_freebusy_export, _("Free/Busy information"));
- vbox3 = gtk_vbox_new (FALSE, 8);
+ vbox3 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 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);
+ hbox2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
gtk_widget_show (hbox2);
gtk_box_pack_start(GTK_BOX (vbox3), hbox2, TRUE, TRUE, 0);
"(http://server/path/file.ifb)"));
/* auth */
- hbox2 = gtk_hbox_new (FALSE, 8);
+ hbox2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
gtk_widget_show (hbox2);
gtk_box_pack_start(GTK_BOX (vbox3), hbox2, TRUE, TRUE, 0);
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);
+ hbox3 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
gtk_widget_show (hbox3);
gtk_box_pack_start(GTK_BOX (vbox3), hbox3, TRUE, TRUE, 0);
vcalprefs.freebusy_get_url = g_strdup("");
/* free/busy import */
- hbox2 = gtk_hbox_new (FALSE, 8);
+ hbox2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
gtk_widget_show (hbox2);
gtk_box_pack_start(GTK_BOX (vbox3), hbox2, TRUE, TRUE, 0);
vcalprefs.freebusy_get_url);
/* SSL frame */
- PACK_FRAME(vbox2, frame_ssl_options, _("SSL options"));
- vbox3 = gtk_vbox_new (FALSE, 8);
+ PACK_FRAME(vbox2, frame_ssl_options, _("TLS options"));
+ vbox3 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 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);
+ hbox2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 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"));
+ _("Verify TLS 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),
if (!vcalprefs.export_user)
vcalprefs.export_user = g_strdup("");
- if (!vcalprefs.export_pass)
- vcalprefs.export_pass = g_strdup("");
if (!vcalprefs.export_freebusy_user)
vcalprefs.export_freebusy_user = g_strdup("");
- if (!vcalprefs.export_freebusy_pass)
- vcalprefs.export_freebusy_pass = g_strdup("");
- export_pass = password_decrypt(vcalprefs.export_pass, NULL);
- export_freebusy_pass = password_decrypt(vcalprefs.export_freebusy_pass, NULL);
-
+ 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);
"changed", G_CALLBACK(path_changed), page);
page->alert_enable_btn = alert_enable_checkbtn;
- page->alert_delay_spinbtn = alert_enable_spinbtn;
+ 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;
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
(page->alert_enable_btn));
vcalprefs.alert_delay =
- gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON
- (page->alert_delay_spinbtn));
+ 60 * gtk_spin_button_get_value_as_int (
+ GTK_SPIN_BUTTON(page->alert_delay_h_spinbtn))
+ + gtk_spin_button_get_value_as_int (
+ GTK_SPIN_BUTTON(page->alert_delay_m_spinbtn));
/* calendar export */
vcalprefs.export_enable =
g_free(vcalprefs.export_user);
vcalprefs.export_user =
gtk_editable_get_chars(GTK_EDITABLE(page->export_user_entry), 0, -1);
- g_free(vcalprefs.export_pass);
pass = gtk_editable_get_chars(GTK_EDITABLE(page->export_pass_entry), 0, -1);
- vcalprefs.export_pass = password_encrypt(pass, NULL);
+ vcal_passwd_set("export", pass);
memset(pass, 0, strlen(pass));
g_free(pass);
g_free(vcalprefs.export_freebusy_user);
vcalprefs.export_freebusy_user =
gtk_editable_get_chars(GTK_EDITABLE(page->export_freebusy_user_entry), 0, -1);
- g_free(vcalprefs.export_freebusy_pass);
pass = gtk_editable_get_chars(GTK_EDITABLE(page->export_freebusy_pass_entry), 0, -1);
- vcalprefs.export_freebusy_pass = password_encrypt(pass, NULL);
+
+ vcal_passwd_set("export_freebusy", pass);
memset(pass, 0, strlen(pass));
g_free(pass);
(page->ssl_verify_peer_checkbtn));
vcal_prefs_save();
+ passwd_store_write_config();
vcal_folder_export(NULL);
}
{
static gchar *path[3];
gchar *rcpath;
+ gboolean passwords_migrated = FALSE;
path[0] = _("Plugins");
- path[1] = _("vCalendar");
+ path[1] = _(PLUGIN_NAME);
path[2] = NULL;
prefs_set_default(param);
prefs_read_config(param, PREFS_BLOCK_NAME, rcpath, NULL);
g_free(rcpath);
+ /* Move passwords that are still in main config to password store. */
+ if (vcalprefs.export_pass != NULL &&
+ strlen(vcalprefs.export_pass) > 0) {
+ passwd_store_set(PWS_PLUGIN, PLUGIN_NAME, "export",
+ vcalprefs.export_pass, TRUE);
+ passwords_migrated = TRUE;
+ memset(vcalprefs.export_pass, 0, strlen(vcalprefs.export_pass));
+ g_free(vcalprefs.export_pass);
+ }
+ if (vcalprefs.export_freebusy_pass != NULL &&
+ strlen(vcalprefs.export_freebusy_pass) > 0) {
+ passwd_store_set(PWS_PLUGIN, PLUGIN_NAME, "export",
+ vcalprefs.export_freebusy_pass, TRUE);
+ passwords_migrated = TRUE;
+ memset(vcalprefs.export_freebusy_pass, 0, strlen(vcalprefs.export_freebusy_pass));
+ g_free(vcalprefs.export_freebusy_pass);
+ }
+
+ if (passwords_migrated)
+ passwd_store_write_config();
+
vcal_prefs_page.page.path = path;
vcal_prefs_page.page.create_widget = vcal_prefs_create_widget_func;
vcal_prefs_page.page.destroy_widget = vcal_prefs_destroy_widget_func;