tab_gui => _('GUI'),
tab_other => _('Other'),
tab_winpos => _('Windows'),
+ tab_accounts => _('Accounts'),
ab_frame => _('Addressbook'),
mem_frame => _('Memory'),
l_win_main_fs => _('Full-screen'),
h_win_main_fs => _('Changes full screen status.'),
+ l_acc_gtls_set => _('Use custom GnuTLS priority'),
+ h_acc_gtls_set => _('Enables using user provided GnuTLS priority string.'),
+ l_acc_gtls_pri => _('GnuTLS priority'),
+ h_acc_gtls_pri => _('Value to use as GnuTLS priority string if custom priority check is enabled. Otherwise this value is ignored.'),
+
e_error => _('Error: '),
e_noclawsrc => _('resource file for Claws Mail was not found.'),
e_running => _('seems Claws Mail is currently running, close it first.'),
# all preferences read by load_preferences
my %PREFS = ();
+my %ACPREFS = ();
# values of all preferences handled by clawsker
my %HPVALUE = ();
+my %ACHPVALUE = ();
# default config dir and file name
my $ALTCONFIGDIR = FALSE;
my $CONFIGDIR = $ENV{HOME} . '/.claws-mail/';
my $CONFIGRC = 'clawsrc';
+my $ACCOUNTRC = 'accountrc';
# index constants for preference arrays
use constant NAME => 0; # the name on the rc file
}
sub get_claws_version {
- my @cmbin = (
- 'claws-mail',
- );
- my $res = "";
- foreach my $bin (@cmbin) {
- $_ = qx/which $bin/;
- chomp;
- last if ($_ ne "");
- }
+ $_ = qx/which claws-mail/;
+ chomp;
return "" unless ($_); # not installed
+ my $res = "";
$_ = qx/$_ -v/;
chomp;
my @fver = split (/ /);
}
sub handle_nchar_value {
- my ($widget, $event, $dataref, $minlen) = @_;
- $_ = substr ($widget->get_text (), 0, $minlen);
+ my ($widget, $event, $dataref, $minlen, $maxlen) = @_;
+ $_ = substr ($widget->get_text (), 0, $maxlen);
$widget->set_text ($_);
$$dataref = $_;
}
return $CONFIGDIR . $CONFIGRC;
}
+sub get_ac_rc_filename {
+ return $CONFIGDIR . $ACCOUNTRC;
+}
+
sub set_rc_filename {
my ($fullname) = @_;
my @parts = split ('/', $fullname);
# graphic element creation
-sub new_check_button_for {
- my ($hash, $key) = @_;
+sub new_check_button_for($$$) {
+ my ($hash, $key, $vhash) = @_;
my $name = $$hash{$key}[NAME];
my $label = $$hash{$key}[LABEL];
#
my $hbox = Gtk2::HBox->new (FALSE, 5);
my $cb = Gtk2::CheckButton->new ($label);
- $$hash{$key}[GUI] = $cb;
- my $value = $HPVALUE{$name};
+ my $value = $$vhash{$name};
$value //= $$hash{$key}[CMDEF];
$cb->set_active ($value eq '1');
$cb->signal_connect (clicked => sub {
my ($w, $e) = @_;
- handle_bool_value ($w, $e, \$HPVALUE{$name});
+ handle_bool_value ($w, $e, \$$vhash{$name});
});
set_widget_hint ($cb, $$hash{$key}[DESC]);
set_widget_sens ($cb, $$hash{$key}[CMVER]);
return $hbox;
}
-sub new_text_box_for_int {
- my ($hash, $key) = @_;
+sub new_text_box_for_int($$$) {
+ my ($hash, $key, $vhash) = @_;
my $name = $$hash{$key}[NAME];
my $label = $$hash{$key}[LABEL];
my @type = split (/,/, $$hash{$key}[TYPE]);
my $glabel = Gtk2::Label->new ($label);
my $pagei = int (($type[2] - $type[1]) / 10);
my $gentry = Gtk2::SpinButton->new_with_range ($type[1], $type[2], $pagei);
- my $value = $HPVALUE{$name};
+ my $value = $$vhash{$name};
$value //= $$hash{$key}[CMDEF];
$gentry->set_numeric (TRUE);
$gentry->set_value ($value);
- $$hash{$key}[GUI] = $gentry;
$gentry->signal_connect('value-changed' => sub {
my ($w, $e) = @_;
- handle_int_value ($w, $e, \$HPVALUE{$name});
+ handle_int_value ($w, $e, \$$vhash{$name});
});
set_widget_hint ($gentry, $$hash{$key}[DESC]);
set_widget_sens ($gentry, $$hash{$key}[CMVER]);
my ($hash, $key, $vhash) = @_;
my $name = $$hash{$key}[NAME];
my $label = $$hash{$key}[LABEL];
- my @type = split (/,/, $$hash{$key}[TYPE]); # char,minlen,maxlen
+ my @type = split (/,/, $$hash{$key}[TYPE]); # char,minlen,maxlen,width
my $hbox = Gtk2::HBox->new (FALSE, 5);
my $glabel = Gtk2::Label->new ($label);
my $gentry = Gtk2::Entry->new ();
$gentry->set_max_length($type[2]) if defined ($type[2]);
- $gentry->set_width_chars(int ($type[2]) + 2) if defined ($type[2]);
+ my $width = $type[3];
+ $width //= $type[2];
+ $gentry->set_width_chars(int ($width) + 2) if defined ($width);
my $value = $$vhash{$name};
$value //= $$hash{$key}[CMDEF];
$gentry->set_text ($value);
- $$hash{$key}[GUI] = $gentry;
$gentry->signal_connect('key-release-event' => sub {
my ($w, $e) = @_;
- handle_nchar_value ($w, $e, \$$vhash{$name}, $type[1]);
+ handle_nchar_value ($w, $e, \$$vhash{$name}, $type[1], $type[2]);
});
set_widget_hint ($gentry, $$hash{$key}[DESC]);
set_widget_sens ($gentry, $$hash{$key}[CMVER]);
return $hbox;
}
-sub new_color_button_for {
- my ($hash, $key) = @_;
+sub new_color_button_for($$$) {
+ my ($hash, $key, $vhash) = @_;
my $name = $$hash{$key}[NAME];
my $label = $$hash{$key}[LABEL];
#
- my $value = $HPVALUE{$name};
+ my $value = $$vhash{$name};
$value //= $$hash{$key}[CMDEF];
my $col = gdk_color_from_str ($value);
my $hbox = Gtk2::HBox->new (FALSE, 5);
my $glabel = Gtk2::Label->new ($label);
my $button = Gtk2::ColorButton->new_with_color ($col);
- $$hash{$key}[GUI] = $button;
$button->set_title ($label);
$button->set_relief ('none');
$button->signal_connect ('color-set' => sub {
my ($w, $e) = @_;
- handle_color_value ($w, $e, \$HPVALUE{$name});
+ handle_color_value ($w, $e, \$$vhash{$name});
});
set_widget_hint ($button, $$hash{$key}[DESC]);
set_widget_sens ($button, $$hash{$key}[CMVER]);
return $hbox;
}
-sub new_selection_box_for {
- my ($hash, $key) = @_;
+sub new_selection_box_for($$$) {
+ my ($hash, $key, $vhash) = @_;
my $name = $$hash{$key}[NAME];
my $label = $$hash{$key}[LABEL];
#
my $hbox = Gtk2::HBox->new (FALSE, 5);
my $glabel = Gtk2::Label->new ($label);
my $combo = Gtk2::ComboBox->new_text;
- $$hash{$key}[GUI] = $combo;
my @options = split (';', $$hash{$key}[TYPE]);
foreach my $opt (@options) {
my ($index, $textkey) = split ('=', $opt);
}
$combo->signal_connect ('changed' => sub {
my ($w, $e) = @_;
- handle_selection_value ($w, $e, \$HPVALUE{$name});
+ handle_selection_value ($w, $e, \$$vhash{$name});
});
- my $value = $HPVALUE{$name};
+ my $value = $$vhash{$name};
$value //= $$hash{$key}[CMDEF];
$combo->set_active ($value);
set_widget_hint ($combo, $$hash{$key}[DESC]);
return new_vbox_pack (
new_subpage_frame (
new_vbox_pack (
- new_check_button_for(\%pr::oth, 'use_dlg')),
+ new_check_button_for(\%pr::oth, 'use_dlg', \%HPVALUE)),
$xl::s{ab_frame}, 'not-packed'),
new_subpage_frame (
new_vbox_pack (
- new_text_box_for_int(\%pr::oth, 'max_use'),
- new_text_box_for_int(\%pr::oth, 'min_time')),
+ new_text_box_for_int(\%pr::oth, 'max_use', \%HPVALUE),
+ new_text_box_for_int(\%pr::oth, 'min_time', \%HPVALUE)),
$xl::s{mem_frame}, 'not-packed'),
new_subpage_frame (
new_vbox_pack (
- new_check_button_for(\%pr::oth, 'use_netm')),
+ new_check_button_for(\%pr::oth, 'use_netm', \%HPVALUE)),
$xl::s{netm_frame}, 'not-packed'),
new_subpage_frame (
new_vbox_pack (
- new_text_box_for_int(\%pr::oth, 'mp_rounds')),
+ new_text_box_for_int(\%pr::oth, 'mp_rounds', \%HPVALUE)),
$xl::s{mpass_frame}, 'not-packed')
);
}
my $gf = Gtk2::VBox->new (FALSE, 5);
$gf->set_border_width (PAGE_SPC);
- my $cb_dot_lines = new_check_button_for (\%pr::gui, 'dot_lines');
- my $cb_toolbar_d = new_check_button_for (\%pr::gui, 'toolbar_d');
+ my $cb_dot_lines = new_check_button_for (\%pr::gui, 'dot_lines', \%HPVALUE);
+ my $cb_toolbar_d = new_check_button_for (\%pr::gui, 'toolbar_d', \%HPVALUE);
my $tb_zero_char = new_text_box_for_nchar (\%pr::gui, 'zero_char', \%HPVALUE);
$gf->pack_start (new_subpage_frame (
new_vbox_pack (
- new_check_button_for (\%pr::gui, 'strip_all'),
- new_check_button_for (\%pr::gui, 'strip_sum'),
- new_text_box_for_int (\%pr::gui, 'strip_off')),
+ new_check_button_for (\%pr::gui, 'strip_all', \%HPVALUE),
+ new_check_button_for (\%pr::gui, 'strip_sum', \%HPVALUE),
+ new_text_box_for_int (\%pr::gui, 'strip_off', \%HPVALUE)),
$xl::s{stripes_frame}, 'not-packed'),
FALSE, FALSE, FRAME_SPC);
$gf->pack_start (new_subpage_frame (
new_vbox_pack (
- new_check_button_for (\%pr::gui, 'b_unread'),
- new_check_button_for (\%pr::gui, 'swp_from'),
- new_check_button_for (\%pr::gui, 'two_linev'),
- new_check_button_for (\%pr::gui, 'next_del'),
- new_selection_box_for (\%pr::gui, 'from_show')),
+ new_check_button_for (\%pr::gui, 'b_unread', \%HPVALUE),
+ new_check_button_for (\%pr::gui, 'swp_from', \%HPVALUE),
+ new_check_button_for (\%pr::gui, 'two_linev', \%HPVALUE),
+ new_check_button_for (\%pr::gui, 'next_del', \%HPVALUE),
+ new_selection_box_for (\%pr::gui, 'from_show', \%HPVALUE)),
$xl::s{mlist_frame}, 'not-packed'),
FALSE, FALSE, FRAME_SPC);
$gf->pack_start (new_subpage_frame (
new_hbox_pack (
- new_check_button_for (\%pr::gui, 'cursor_v'),
- new_check_button_for (\%pr::gui, 'mview_date')),
+ new_check_button_for (\%pr::gui, 'cursor_v', \%HPVALUE),
+ new_check_button_for (\%pr::gui, 'mview_date', \%HPVALUE)),
$xl::s{mview_frame}, 'not-packed'),
FALSE, FALSE, FRAME_SPC);
$gf->pack_start (new_subpage_frame (
new_hbox_pack (
- new_check_button_for (\%pr::gui, 'no_markup'),
- new_check_button_for (\%pr::gui, 'margin_co'),
- new_check_button_for (\%pr::gui, 'type_any')),
+ new_check_button_for (\%pr::gui, 'no_markup', \%HPVALUE),
+ new_check_button_for (\%pr::gui, 'margin_co', \%HPVALUE),
+ new_check_button_for (\%pr::gui, 'type_any', \%HPVALUE)),
$xl::s{compo_frame}, 'not-packed'),
FALSE, FALSE, FRAME_SPC);
$gf->pack_start ($cb_dot_lines, FALSE, FALSE, 0);
$gf->pack_start ($cb_toolbar_d, FALSE, FALSE, 0);
$gf->pack_start (new_subpage_frame (
new_vbox_pack (
- new_check_button_for (\%pr::gui, 'h_scroll'),
- new_selection_box_for (\%pr::gui, 'v_scroll')),
+ new_check_button_for (\%pr::gui, 'h_scroll', \%HPVALUE),
+ new_selection_box_for (\%pr::gui, 'v_scroll', \%HPVALUE)),
$xl::s{sbar_frame}, 'not-packed'),
FALSE, FALSE, FRAME_SPC);
$gf->pack_start ($tb_zero_char, FALSE, FALSE, 0);
my $bf = Gtk2::VBox->new (FALSE, 5);
$bf->set_border_width (PAGE_SPC);
- my $tb_up_step = new_text_box_for_int (\%pr::beh, 'up_step');
- my $tb_thread_a = new_text_box_for_int (\%pr::beh, 'thread_a');
+ my $tb_up_step = new_text_box_for_int (\%pr::beh, 'up_step', \%HPVALUE);
+ my $tb_thread_a = new_text_box_for_int (\%pr::beh, 'thread_a', \%HPVALUE);
$bf->pack_start (new_subpage_frame (
new_vbox_pack (
- new_text_box_for_int (\%pr::beh, 'hover_t'),
- new_check_button_for (\%pr::beh, 'warn_dnd')),
+ new_text_box_for_int (\%pr::beh, 'hover_t', \%HPVALUE),
+ new_check_button_for (\%pr::beh, 'warn_dnd', \%HPVALUE)),
$xl::s{dnd_frame}, 'not-packed'),
FALSE, FALSE, FRAME_SPC);
$bf->pack_start (new_subpage_frame (
new_hbox_pack (
- new_check_button_for (\%pr::beh, 'skip_ssl'),
- new_check_button_for (\%pr::beh, 'unsafe_ssl')),
+ new_check_button_for (\%pr::beh, 'skip_ssl', \%HPVALUE),
+ new_check_button_for (\%pr::beh, 'unsafe_ssl', \%HPVALUE)),
$xl::s{ssl_frame}, 'not-packed'),
FALSE, FALSE, FRAME_SPC);
$bf->pack_start ($tb_up_step, FALSE, FALSE, 0);
$bf->pack_start ($tb_thread_a, FALSE, FALSE, 0);
$bf->pack_start (new_subpage_frame (
new_vbox_pack (
- new_check_button_for (\%pr::beh, 'flowed'),
- new_check_button_for (\%pr::beh, 'parts_rw'),
- new_check_button_for (\%pr::beh, 'use_utf8'),
- new_check_button_for (\%pr::beh, 'dangerous'),
- new_check_button_for (\%pr::beh, 'out_ascii'),
- new_check_button_for (\%pr::beh, 'pp_unsel'),
- new_check_button_for (\%pr::beh, 'inline_at')),
+ new_check_button_for (\%pr::beh, 'flowed', \%HPVALUE),
+ new_check_button_for (\%pr::beh, 'parts_rw', \%HPVALUE),
+ new_check_button_for (\%pr::beh, 'use_utf8', \%HPVALUE),
+ new_check_button_for (\%pr::beh, 'dangerous', \%HPVALUE),
+ new_check_button_for (\%pr::beh, 'out_ascii', \%HPVALUE),
+ new_check_button_for (\%pr::beh, 'pp_unsel', \%HPVALUE),
+ new_check_button_for (\%pr::beh, 'inline_at', \%HPVALUE)),
$xl::s{msgs_frame}, 'not-packed'),
FALSE, FALSE, FRAME_SPC);
$bf->pack_start (new_subpage_frame (
new_vbox_pack (
- new_check_button_for (\%pr::beh, 'addr_swc'),
- new_check_button_for (\%pr::beh, 'fold_swc')),
+ new_check_button_for (\%pr::beh, 'addr_swc', \%HPVALUE),
+ new_check_button_for (\%pr::beh, 'fold_swc', \%HPVALUE)),
$xl::s{swc_frame}, 'not-packed'),
FALSE, FALSE, FRAME_SPC);
return $bf;
return new_vbox_pack (
new_subpage_frame (
new_vbox_pack (
- new_color_button_for (\%pr::col, 'emphasis')),
+ new_color_button_for (\%pr::col, 'emphasis', \%HPVALUE)),
$xl::s{msgview_frame}, 'not-packed'),
new_subpage_frame (
new_vbox_pack (
- new_color_button_for (\%pr::col, 'log_err'),
- new_color_button_for (\%pr::col, 'log_in'),
- new_color_button_for (\%pr::col, 'log_msg'),
- new_color_button_for (\%pr::col, 'log_out'),
- new_color_button_for (\%pr::col, 'log_warn')),
+ new_color_button_for (\%pr::col, 'log_err', \%HPVALUE),
+ new_color_button_for (\%pr::col, 'log_in', \%HPVALUE),
+ new_color_button_for (\%pr::col, 'log_msg', \%HPVALUE),
+ new_color_button_for (\%pr::col, 'log_out', \%HPVALUE),
+ new_color_button_for (\%pr::col, 'log_warn', \%HPVALUE)),
$xl::s{log_frame}, 'not-packed'),
new_subpage_frame (
new_vbox_pack (
- new_color_button_for (\%pr::col, 'diff_add'),
- new_color_button_for (\%pr::col, 'diff_del'),
- new_color_button_for (\%pr::col, 'diff_hunk')),
+ new_color_button_for (\%pr::col, 'diff_add', \%HPVALUE),
+ new_color_button_for (\%pr::col, 'diff_del', \%HPVALUE),
+ new_color_button_for (\%pr::col, 'diff_hunk', \%HPVALUE)),
$xl::s{diff_frame}, 'not-packed')
);
}
return new_subpage_frame (
new_vbox_pack_compact (
new_vbox_pack (
- new_text_box_for_int (\%pr::win, 'main_x'),
- new_text_box_for_int (\%pr::win, 'main_y')),
+ new_text_box_for_int (\%pr::win, 'main_x', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'main_y', \%HPVALUE)),
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'main_w'),
- new_text_box_for_int (\%pr::win, 'main_h')),
+ new_text_box_for_int (\%pr::win, 'main_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'main_h', \%HPVALUE)),
new_vbox_pack (
- new_check_button_for (\%pr::win, 'main_fs'),
- new_check_button_for (\%pr::win, 'main_mx'))),
+ new_check_button_for (\%pr::win, 'main_fs', \%HPVALUE),
+ new_check_button_for (\%pr::win, 'main_mx', \%HPVALUE))),
_('Main window')
);
}
return new_subpage_frame (
new_vbox_pack_compact (
new_vbox_pack (
- new_text_box_for_int (\%pr::win, 'msgs_x'),
- new_text_box_for_int (\%pr::win, 'msgs_y')),
+ new_text_box_for_int (\%pr::win, 'msgs_x', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'msgs_y', \%HPVALUE)),
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'msgs_w'),
- new_text_box_for_int (\%pr::win, 'msgs_h'))),
+ new_text_box_for_int (\%pr::win, 'msgs_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'msgs_h', \%HPVALUE))),
_('Message window')
);
}
return new_vbox_pack (
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'send_w'),
- new_text_box_for_int (\%pr::win, 'send_h')),
+ new_text_box_for_int (\%pr::win, 'send_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'send_h', \%HPVALUE)),
_('Send window'), 'not-packed'),
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'recv_w'),
- new_text_box_for_int (\%pr::win, 'recv_h')),
+ new_text_box_for_int (\%pr::win, 'recv_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'recv_h', \%HPVALUE)),
_('Receive window'), 'not-packed')
);
}
new_subpage_frame (
new_vbox_pack_compact (
new_vbox_pack (
- new_text_box_for_int (\%pr::win, 'fold_x'),
- new_text_box_for_int (\%pr::win, 'fold_y')),
+ new_text_box_for_int (\%pr::win, 'fold_x', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'fold_y', \%HPVALUE)),
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'fold_w'),
- new_text_box_for_int (\%pr::win, 'fold_h'))),
+ new_text_box_for_int (\%pr::win, 'fold_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'fold_h', \%HPVALUE))),
_('Folder window'), 'not-packed'),
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'fsel_w'),
- new_text_box_for_int (\%pr::win, 'fsel_h')),
+ new_text_box_for_int (\%pr::win, 'fsel_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'fsel_h', \%HPVALUE)),
_('Folder selection window'), 'not-packed')
);
}
return new_vbox_pack (
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'addr_w'),
- new_text_box_for_int (\%pr::win, 'addr_h')),
+ new_text_box_for_int (\%pr::win, 'addr_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'addr_h', \%HPVALUE)),
_('Addressbook main window'), 'not-packed'),
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'adep_w'),
- new_text_box_for_int (\%pr::win, 'adep_h')),
+ new_text_box_for_int (\%pr::win, 'adep_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'adep_h', \%HPVALUE)),
_('Edit person window'), 'not-packed'),
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'adeg_w'),
- new_text_box_for_int (\%pr::win, 'adeg_h')),
+ new_text_box_for_int (\%pr::win, 'adeg_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'adeg_h', \%HPVALUE)),
_('Edit group window'), 'not-packed'),
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'adda_w'),
- new_text_box_for_int (\%pr::win, 'adda_h')),
+ new_text_box_for_int (\%pr::win, 'adda_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'adda_h', \%HPVALUE)),
_('Add address window'), 'not-packed'),
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'addf_w'),
- new_text_box_for_int (\%pr::win, 'addf_h')),
+ new_text_box_for_int (\%pr::win, 'addf_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'addf_h', \%HPVALUE)),
_('Folder select window'), 'not-packed')
);
}
return new_vbox_pack (
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'acco_w'),
- new_text_box_for_int (\%pr::win, 'acco_h')),
+ new_text_box_for_int (\%pr::win, 'acco_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'acco_h', \%HPVALUE)),
_('Accounts window'), 'not-packed'),
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'acce_w'),
- new_text_box_for_int (\%pr::win, 'acce_h')),
+ new_text_box_for_int (\%pr::win, 'acce_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'acce_h', \%HPVALUE)),
_('Edit account window'), 'not-packed')
);
}
return new_vbox_pack (
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'filt_w'),
- new_text_box_for_int (\%pr::win, 'filt_h')),
+ new_text_box_for_int (\%pr::win, 'filt_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'filt_h', \%HPVALUE)),
_('Filtering window'), 'not-packed'),
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'fila_w'),
- new_text_box_for_int (\%pr::win, 'fila_h')),
+ new_text_box_for_int (\%pr::win, 'fila_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'fila_h', \%HPVALUE)),
_('Filtering actions window'), 'not-packed'),
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'fild_w'),
- new_text_box_for_int (\%pr::win, 'fild_h')),
+ new_text_box_for_int (\%pr::win, 'fild_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'fild_h', \%HPVALUE)),
_('Filtering debug window'), 'not-packed'),
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'matc_w'),
- new_text_box_for_int (\%pr::win, 'matc_h')),
+ new_text_box_for_int (\%pr::win, 'matc_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'matc_h', \%HPVALUE)),
_('Matcher window'), 'not-packed')
);
}
return new_vbox_pack (
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'pref_w'),
- new_text_box_for_int (\%pr::win, 'pref_h')),
+ new_text_box_for_int (\%pr::win, 'pref_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'pref_h', \%HPVALUE)),
_('Preferences window'), 'not-packed'),
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'temp_w'),
- new_text_box_for_int (\%pr::win, 'temp_h')),
+ new_text_box_for_int (\%pr::win, 'temp_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'temp_h', \%HPVALUE)),
_('Templates window'), 'not-packed'),
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'acti_w'),
- new_text_box_for_int (\%pr::win, 'acti_h')),
+ new_text_box_for_int (\%pr::win, 'acti_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'acti_h', \%HPVALUE)),
_('Actions window'), 'not-packed'),
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'tags_w'),
- new_text_box_for_int (\%pr::win, 'tags_h')),
+ new_text_box_for_int (\%pr::win, 'tags_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'tags_h', \%HPVALUE)),
_('Tags window'), 'not-packed'),
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'plug_w'),
- new_text_box_for_int (\%pr::win, 'plug_h')),
+ new_text_box_for_int (\%pr::win, 'plug_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'plug_h', \%HPVALUE)),
_('Plugins window'), 'not-packed')
);
}
return new_vbox_pack (
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'logw_w'),
- new_text_box_for_int (\%pr::win, 'logw_h')),
+ new_text_box_for_int (\%pr::win, 'logw_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'logw_h', \%HPVALUE)),
_('Log window'), 'not-packed'),
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'prin_w'),
- new_text_box_for_int (\%pr::win, 'prin_h')),
+ new_text_box_for_int (\%pr::win, 'prin_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'prin_h', \%HPVALUE)),
_('Print preview window'), 'not-packed'),
new_subpage_frame (
new_hbox_pack (
- new_text_box_for_int (\%pr::win, 'sour_w'),
- new_text_box_for_int (\%pr::win, 'sour_h')),
+ new_text_box_for_int (\%pr::win, 'sour_w', \%HPVALUE),
+ new_text_box_for_int (\%pr::win, 'sour_h', \%HPVALUE)),
_('View source window'), 'not-packed')
);
}
return $winbook;
}
+%pr::acc = ( # per account hidden preferences
+ tls_set => [
+ 'gnutls_set_priority',
+ $xl::s{l_acc_gtls_set},
+ $xl::s{h_acc_gtls_set},
+ 'bool',
+ '3.9.0.181',
+ '0',
+ undef,
+ ],
+ tls_pri => [
+ 'gnutls_priority',
+ $xl::s{l_acc_gtls_pri},
+ $xl::s{h_acc_gtls_pri},
+ 'char,0,256,32',
+ '3.9.0.181',
+ '0',
+ undef,
+ ],
+);
+
+sub new_account_subpage($) {
+ my ($akey) = @_;
+ return new_vbox_pack (
+ new_subpage_frame (
+ new_vbox_pack (
+ new_check_button_for (\%pr::acc, 'tls_set', $ACHPVALUE{$akey}),
+ new_text_box_for_nchar (\%pr::acc, 'tls_pri', $ACHPVALUE{$akey})),
+ _('GnuTLS priority'), 'not-packed')
+ );
+}
+
+sub new_accounts_page() {
+ my $accbook = Gtk2::Notebook->new;
+ $accbook->set_tab_pos ('right');
+ foreach (keys %ACPREFS) {
+ my $name = $ACPREFS{$_}{'account_name'};
+ $accbook->append_page (new_account_subpage ($_), $name);
+ }
+ return $accbook;
+}
+
# version info
sub print_version() {
print $xl::s{about_title} . "\n";
'b|verbose' => sub { $VERBOSE = TRUE },
'u|use-claws-version=s' => \&opt_use_claws_version,
'a|alternate-config-dir=s' => \&opt_alternate_config_dir,
- 'r|clawsrc=s' => \&opt_clawsrc)
+ 'c|clawsrc=s' => \&opt_clawsrc)
or die _("try -h or --help for syntax.\n");
};
if ($@) {
return TRUE;
}
+sub init_ac_hidden_preferences {
+ foreach my $akey (keys %ACPREFS) {
+ foreach my $key (keys %pr::acc) {
+ my $pname = $pr::acc{$key}[NAME];
+ $ACHPVALUE{$akey}{$pname} = $ACPREFS{$akey}{$pname};
+ }
+ }
+ return TRUE;
+}
+
# load current status from disc
sub load_preferences {
my $rc = get_rc_filename ();
return TRUE;
}
+sub load_ac_preferences {
+ my $rc = get_ac_rc_filename ();
+ log_message ("Loading account preferences from $rc\n");
+ return FALSE unless check_rc_file ($rc);
+ return FALSE unless check_claws_not_running ();
+ open (RCF, "<$rc");
+ my $akey;
+ while (<RCF>) {
+ chomp;
+ if (/^\[Account: (\d+)\]$/) {
+ $akey = $1;
+ next;
+ }
+ if (/^([8a-z_]+)=(.*)$/) {
+ $ACPREFS{$akey}{$1} = decode('UTF-8', $2);
+ }
+ }
+ close (RCF);
+ return TRUE;
+}
+
# save current preferences to disc
sub save_preferences {
my $rc = get_rc_filename ();
return TRUE;
}
+sub save_ac_preferences {
+ my $rc = get_ac_rc_filename ();
+ log_message ("Saving account preferences to $rc\n");
+ return FALSE unless check_rc_file ($rc);
+ return FALSE unless check_claws_not_running ();
+ my $rcbak = "$rc.backup";
+ rename ($rc, $rcbak);
+ open (RCF, ">$rc");
+ open (RCB, "<$rcbak");
+ my $akey;
+ while (<RCB>) {
+ chomp;
+ if (/^\[Account: (\d+)\]$/) {
+ $akey = $1;
+ print RCF $_ . "\n";
+ next;
+ }
+ if (/^([8a-z_]+)=(.*)$/) {
+ if (defined($ACHPVALUE{$akey}{$1})) {
+ print RCF $1 . "=" . $ACHPVALUE{$akey}{$1} . "\n";
+ }
+ else {
+ print RCF $_ . "\n";
+ }
+ }
+ else {
+ print RCF $_ . "\n";
+ }
+ }
+ close (RCB);
+ close (RCF);
+ return TRUE;
+}
+
# create notebook
sub new_notebook {
my $nb = Gtk2::Notebook->new;
$nb->append_page (new_gui_page (), $xl::s{tab_gui});
$nb->append_page (new_other_page (), $xl::s{tab_other});
$nb->append_page (new_winpos_page (), $xl::s{tab_winpos});
+ $nb->append_page (new_accounts_page (), $xl::s{tab_accounts});
return $nb;
}
my $hbox = Gtk2::HBox->new (FALSE, 5);
# signal handlers
$b_exit->signal_connect (clicked => sub { Gtk2->main_quit });
- $b_apply->signal_connect (clicked => sub { save_preferences ($parent) });
+ $b_apply->signal_connect (clicked => sub {
+ save_preferences ($parent);
+ save_ac_preferences ($parent);
+ });
# $b_undo->signal_connect (clicked => sub { undo_current_changes });
$b_about->signal_connect (clicked => sub { $adlg->run; $adlg->hide });
# package them
Gtk2->init;
$main_window = Gtk2::Window->new ('toplevel');
exit unless load_preferences ();
+exit unless load_ac_preferences ();
exit unless init_hidden_preferences ();
+exit unless init_ac_hidden_preferences ();
# create main GUI
my $box = Gtk2::VBox->new (FALSE, 5);
$box->set_border_width(3);