my $DATADIR = '@DATADIR@';
my $VERSION = '@VERSION@';
my $VERBOSE = FALSE;
+my $READONLY = FALSE;
my $CLAWSV = undef;
my $main_window = undef;
tab_gui => _('GUI'),
tab_other => _('Other'),
tab_winpos => _('Windows'),
+ tab_accounts => _('Accounts'),
ab_frame => _('Addressbook'),
mem_frame => _('Memory'),
h_oth_use_netm => _('Use NetworkManager to switch offline automatically.'),
l_oth_mp_rounds => _('Rounds for PBKDF2 function'),
h_oth_mp_rounds => _('Specify the number of iterations the key derivation function will be applied on master passphrase computation. Does not modify currently stored passphrase, only master passphrases computed after changing this value are affected.'),
-
+
l_gui_b_unread => _('Show unread messages with bold font'),
h_gui_b_unread => _('Show unread messages in the Message List using a bold font.'),
l_gui_no_markup => _('Don\'t use markup'),
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
use constant TYPE => 3; # data type: bool, int, float, string, color
use constant CMVER => 4; # lowest[,highest] Claws Mail version(s) the feature exists
use constant CMDEF => 5; # default value for the preference in Claws Mail
-use constant GUI => 6; # GUI element
# constants for GUI spacing
use constant HBOX_SPC => 5;
push (@version, '0');
}
my $idx = 0;
- while (($idx <= $#refvers)
+ while (($idx <= $#refvers)
and (int ($version[$idx]) == int ($refvers[$idx]))) {
++$idx;
}
}
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 = $_;
}
$_ = uc ($str);
if (/\#([A-F0-9][A-F0-9])([A-F0-9][A-F0-9])([A-F0-9][A-F0-9])/) {
$rr = hex($1) * 256;
- $gg = hex($2) * 256;
+ $gg = hex($2) * 256;
$bb = hex($3) * 256;
}
my $color = Gtk2::Gdk::Color->new ($rr, $gg, $bb);
return $CONFIGDIR . $CONFIGRC;
}
+sub get_ac_rc_filename {
+ return $CONFIGDIR . $ACCOUNTRC;
+}
+
sub set_rc_filename {
my ($fullname) = @_;
my @parts = split ('/', $fullname);
}
sub check_claws_not_running {
+ return TRUE if $READONLY;
my $tmpdir = (defined $ENV{TMPDIR})? $ENV{TMPDIR}: '/tmp';
$tmpdir = '/tmp' if ($tmpdir eq '');
my $lockdir = "$tmpdir/claws-mail-$<";
- -d $lockdir and do {
+ -d $lockdir and do {
$_ = $CONFIGDIR;
s/\/$//;
my $socket = "$lockdir/" . md5_hex ($_);
sub set_widget_hint {
if ($SHOWHINTS) {
- my ($wdgt, $hint) = @_;
+ my ($wdgt, $hint) = @_;
$wdgt->set_tooltip_text ($hint);
$wdgt->set_has_tooltip (TRUE);
}
}
}
-# graphic element creation
+# graphic element creation
sub new_check_button_for($$$) {
my ($hash, $key, $vhash) = @_;
my $name = $$hash{$key}[NAME];
my $label = $$hash{$key}[LABEL];
my @type = split (/,/, $$hash{$key}[TYPE]);
- push (@type, 0), push (@type, 10000) unless ($#type > 0);
+ push (@type, 0), push (@type, 10000) unless ($#type > 0);
#
my $hbox = Gtk2::HBox->new (FALSE, 5);
my $glabel = Gtk2::Label->new ($label);
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);
$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]);
$hbox->pack_start ($item, FALSE, FALSE, 0);
}
return $hbox;
-}
+}
sub new_vbox_pack {
my $vbox = Gtk2::VBox->new (FALSE, 5);
$vbox->pack_start ($item, FALSE, FALSE, 0);
}
return $vbox;
-}
+}
sub new_vbox_pack_compact {
my $vbox = Gtk2::VBox->new (FALSE, 0);
$vbox->pack_start ($item, FALSE, FALSE, 0);
}
return $vbox;
-}
+}
sub new_subpage_frame {
my ($box, $title, $notpacked) = @_;
my $frame = Gtk2::Frame->new ($title);
- $frame->add ($box);
+ $frame->add ($box);
return new_vbox_pack ($frame) unless defined ($notpacked);
return $frame;
}
# preference maps and corresponding page creation subs
%pr::oth = ( # other preferences
- use_dlg => [
+ use_dlg => [
'addressbook_use_editaddress_dialog',
$xl::s{l_oth_use_dlg},
$xl::s{h_oth_use_dlg},
'bool',
'2.7.0',
'0',
- undef,
],
max_use => [
'cache_max_mem_usage',
'int,0,262144', # 0 Kb - 256 Mb
'0.0.0',
'4096',
- undef,
],
min_time => [
'cache_min_keep_time',
'int,0,120', # 0 minutes - 2 hours
'0.0.0',
'15',
- undef,
],
use_netm => [
'use_networkmanager',
'bool',
'3.3.1',
'1',
- undef,
],
mp_rounds => [
'master_passphrase_pbkdf2_rounds',
'int,50000,1000000',
'3.13.2.110',
'50000',
- undef,
],
);
}
%pr::gui = ( # gui bells and whistles
- b_unread => [
+ b_unread => [
'bold_unread',
$xl::s{l_gui_b_unread},
$xl::s{h_gui_b_unread},
'bool',
'0.0.0',
'1',
- undef,
],
no_markup => [
'compose_no_markup',
'bool',
'0.0.0',
'0',
- undef,
],
dot_lines => [
'enable_dotted_lines',
'bool',
'0.0.0,3.7.10.44',
'0',
- undef,
],
h_scroll => [
'enable_hscrollbar',
'bool',
'0.0.0',
'1',
- undef,
],
swp_from => [
'enable_swap_from',
'bool',
'0.0.0',
'0',
- undef,
],
v_scroll => [
'folderview_vscrollbar_policy',
'0=l_gui_v_scroll_show;1=l_gui_v_scroll_auto;2=l_gui_v_scroll_hide',
'0.0.0',
'0',
- undef,
],
from_show => [
'summary_from_show',
'0=l_gui_from_show_name;1=l_gui_from_show_addr;2=l_gui_from_show_both',
'3.7.10',
'0',
- undef,
],
strip_off => [
'stripes_color_offset',
'int,0,40000', # no idea what this number means
'0.0.0',
'4000',
- undef,
],
cursor_v => [
'textview_cursor_visible',
'bool',
'0.0.0',
'0',
- undef,
],
toolbar_d => [
'toolbar_detachable',
'bool',
'0.0.0',
'0',
- undef,
],
strip_all => [
'use_stripes_everywhere',
'bool',
'0.0.0',
'1',
- undef,
],
strip_sum => [
'use_stripes_in_summaries',
'bool',
'0.0.0',
'1',
- undef,
],
two_linev => [
'two_line_vertical',
'bool',
'3.4.0.7',
'0',
- undef,
],
margin_co => [
'show_compose_margin',
'bool',
'3.7.6.7',
'0',
- undef,
],
mview_date => [
'msgview_date_format',
'bool',
'3.7.8.42',
'0',
- undef,
],
zero_char => [
'zero_replacement_char',
'char,1,1',
'2.8.1.77',
'0',
- undef,
],
type_any => [
'type_any_header',
'bool',
'3.12.0.44',
'0',
- undef,
],
next_del => [
'next_on_delete',
'bool',
'3.13.0.5',
'0',
- undef,
],
);
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'),
+ $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', \%HPVALUE),
new_check_button_for (\%pr::gui, 'mview_date', \%HPVALUE)),
- $xl::s{mview_frame}, 'not-packed'),
+ $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', \%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'),
+ $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);
'int,100,3000', # 0.1 seconds - 3 seconds
'0.0.0',
'500',
- undef,
],
dangerous => [
'live_dangerously',
'bool',
'0.0.0',
'0',
- undef,
],
flowed => [
'respect_flowed_format',
'bool',
'0.0.0',
'0',
- undef,
],
parts_rw => [
'save_parts_readwrite',
'bool',
'0.0.0',
'0',
- undef,
],
skip_ssl => [
'skip_ssl_cert_check',
'bool',
'0.0.0',
'0',
- undef,
],
up_step => [
'statusbar_update_step',
'int,1,200', # 1 item - 200 items
'0.0.0',
'10',
- undef,
],
thread_a => [
'thread_by_subject_max_age',
'int,1,30', # 1 day - 30 days
'0.0.0',
'10',
- undef,
],
unsafe_ssl => [
'unsafe_ssl_certs',
'bool',
'0.0.0',
'0',
- undef,
],
use_utf8 => [
'utf8_instead_of_locale_for_broken_mail',
'bool',
'0.0.0',
'0',
- undef,
],
warn_dnd => [
'warn_dnd',
'bool',
'0.0.0',
'1',
- undef,
],
out_ascii => [
'outgoing_fallback_to_ascii',
'bool',
'3.4.0.37',
'1',
- undef,
],
pp_unsel => [
'primary_paste_unselects',
'bool',
'3.6.1.35',
'0',
- undef,
],
inline_at => [
'show_inline_attachments',
'bool',
'3.7.8.48',
'1',
- undef,
],
addr_swc => [
'address_search_wildcard',
'bool',
'3.9.3.18',
'0',
- undef,
],
fold_swc => [
'folder_search_wildcard',
'bool',
'3.9.3.18',
'0',
- undef,
],
);
new_vbox_pack (
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'),
+ $xl::s{dnd_frame}, 'not-packed'),
FALSE, FALSE, FRAME_SPC);
$bf->pack_start (new_subpage_frame (
new_hbox_pack (
'color',
'0.0.0',
'#0000cf',
- undef,
],
log_err => [
'log_error_color',
'color',
'0.0.0',
'#af0000',
- undef,
],
log_in => [
'log_in_color',
'color',
'0.0.0',
'#000000',
- undef,
],
log_msg => [
'log_msg_color',
'color',
'0.0.0',
'#00af00',
- undef,
],
log_out => [
'log_out_color',
'color',
'0.0.0',
'#0000ef',
- undef,
],
log_warn => [
'log_warn_color',
'color',
'0.0.0',
'#af0000',
- undef,
],
diff_add => [
'diff_added_color',
'color',
'3.8.0.54',
'#008b8b',
- undef,
],
diff_del => [
'diff_deleted_color',
'color',
'3.8.0.54',
'#6a5acd',
- undef,
],
diff_hunk => [
'diff_hunk_color',
'color',
'3.8.0.54',
'#a52a2a',
- undef,
],
);
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'16',
- undef,
],
main_y => [
'mainwin_y',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'16',
- undef,
],
main_w => [
'mainwin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'779',
- undef,
],
main_h => [
'mainwin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'568',
- undef,
],
main_mx => [
'mainwin_maximised',
'bool',
'0.0.0',
'0',
- undef,
],
main_fs => [
'mainwin_fullscreen',
'bool',
'0.0.0',
'0',
- undef,
],
msgs_x => [
'main_messagewin_x',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'256',
- undef,
],
msgs_y => [
'main_messagewin_y',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'210',
- undef,
],
msgs_w => [
'messagewin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'600',
- undef,
],
msgs_h => [
'messagewin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'540',
- undef,
],
send_w => [
'sendwin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'460',
- undef,
],
send_h => [
'sendwin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
recv_w => [
'receivewin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'460',
- undef,
],
recv_h => [
'receivewin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
fold_x => [
'folderwin_x',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'16',
- undef,
],
fold_y => [
'folderwin_y',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'16',
- undef,
],
fold_w => [
'folderitemwin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'500',
- undef,
],
fold_h => [
'folderitemwin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
fsel_w => [
'folderselwin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'300',
- undef,
],
fsel_h => [
'folderselwin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
sour_w => [
'sourcewin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'600',
- undef,
],
sour_h => [
'sourcewin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'500',
- undef,
],
addr_w => [
'addressbookwin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'520',
- undef,
],
addr_h => [
'addressbookwin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
adep_w => [
'addressbookeditpersonwin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'640',
- undef,
],
adep_h => [
'addressbookeditpersonwin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'320',
- undef,
],
adeg_w => [
'addressbookeditgroupwin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'580',
- undef,
],
adeg_h => [
'addressbookeditgroupwin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'340',
- undef,
],
adda_w => [
'addressaddwin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'300',
- undef,
],
adda_h => [
'addressaddwin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
addf_w => [
'addressbook_folderselwin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'300',
- undef,
],
addf_h => [
'addressbook_folderselwin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
acce_w => [
'editaccountwin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'500',
- undef,
],
acce_h => [
'editaccountwin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
acco_w => [
'accountswin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'500',
- undef,
],
acco_h => [
'accountswin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
filt_w => [
'filteringwin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'500',
- undef,
],
filt_h => [
'filteringwin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
fila_w => [
'filteringactionwin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'490',
- undef,
],
fila_h => [
'filteringactionwin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
fild_w => [
'filtering_debugwin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'600',
- undef,
],
fild_h => [
'filtering_debugwin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
matc_w => [
'matcherwin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'520',
- undef,
],
matc_h => [
'matcherwin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
pref_w => [
'prefswin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'600',
- undef,
],
pref_h => [
'prefswin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
temp_w => [
'templateswin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'480',
- undef,
],
temp_h => [
'templateswin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
acti_w => [
'actionswin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'486',
- undef,
],
acti_h => [
'actionswin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
tags_w => [
'tagswin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'486',
- undef,
],
tags_h => [
'tagswin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
plug_w => [
'pluginswin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
plug_h => [
'pluginswin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
logw_w => [
'logwin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'520',
- undef,
],
logw_h => [
'logwin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
prin_w => [
'print_previewwin_width',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'600',
- undef,
],
prin_h => [
'print_previewwin_height',
'int,0,3000', # 0 pixels - 3000 pixels
'0.0.0',
'-1',
- undef,
],
);
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',
+ ],
+ 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',
+ ],
+);
+
+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;
+}
+
+%pr::plu = ( # plugins hidden preferences
+ # att_remover
+ arm_winw => [
+ 'win_width',
+ $xl::s{l_win_w},
+ $xl::s{h_win_w},
+ 'int,0,3000', # 0 pixels - 3000 pixels
+ '3.9.0.74',
+ '-1',
+ undef,
+ ],
+ arm_winh => [
+ 'win_height',
+ $xl::s{l_win_h},
+ $xl::s{h_win_h},
+ 'int,0,3000', # 0 pixels - 3000 pixels
+ '3.9.0.74',
+ '-1',
+ undef,
+ ],
+);
+
# version info
sub print_version() {
print $xl::s{about_title} . "\n";
print "Perl-GLib " . $Glib::VERSION;
# version info stuff appeared in 1.040
if ($Glib::VERSION >= 1.040) {
- print _(", built for ") . join(".", Glib->GET_VERSION_INFO)
- . _(", running with ") . join(".", &Glib::major_version,
+ print _(", built for ") . join(".", Glib->GET_VERSION_INFO)
+ . _(", running with ") . join(".", &Glib::major_version,
&Glib::minor_version, &Glib::micro_version);
}
print "\n";
print "Perl-GTK2 " . $Gtk2::VERSION;
if ($Gtk2::VERSION >= 1.040) {
print _(", built for ") . join(".", Gtk2->GET_VERSION_INFO)
- . _(", running with ") . join(".", &Gtk2::major_version,
+ . _(", running with ") . join(".", &Gtk2::major_version,
&Gtk2::minor_version, &Gtk2::micro_version);
}
print "\n";
- my $clawsver = ($CLAWSV eq "") ?
- _("was not found!") :
+ my $clawsver = ($CLAWSV eq "") ?
+ _("was not found!") :
(_("returned version ") . $CLAWSV);
print "Claws Mail " . $clawsver . "\n";
}
GetOptions('h|help' => sub { print_help (); $cont = FALSE },
'v|version' => sub { print_version (); $cont = FALSE },
'b|verbose' => sub { $VERBOSE = TRUE },
+ 'r|read-only' => sub { $READONLY = 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 ($@) {
# update the hidden preferences status from loaded values
sub init_hidden_preferences {
foreach my $hash (\%pr::beh, \%pr::col, \%pr::gui, \%pr::oth, \%pr::win) {
- foreach my $key (keys %$hash) {
+ foreach my $key (keys %$hash) {
$HPVALUE{${$hash}{$key}[NAME]} = $PREFS{${$hash}{$key}[NAME]};
}
}
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_behaviour_page (), $xl::s{tab_behaviour});
$nb->append_page (new_colours_page (), $xl::s{tab_colours});
$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 $title = $xl::s{about_title};
my $lic = $xl::s{about_license};
my $vers = $xl::s{about_version} . " $VERSION";
- my $license =
+ my $license =
"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
the Free Software Foundation, either version 3 of the License, or
my $holder = "Ricardo Mones <ricardo\@mones.org>";
my $url = "http://www.claws-mail.org/clawsker.php";
- my $dialog = Gtk2::MessageDialog->new_with_markup ($parent,
- [qw/modal destroy-with-parent/],
- 'info', 'close',
+ my $dialog = Gtk2::MessageDialog->new_with_markup ($parent,
+ [qw/modal destroy-with-parent/],
+ 'info', 'close',
"<span size=\"x-large\" weight=\"bold\">$title</span>\n"
. "<span size=\"large\">$vers</span>\n\n"
. "<span color=\"blue\" size=\"large\">$url</span>\n\n"
# disable button until is really implemented
# my $b_undo = Gtk2::Button->new_from_stock ('gtk-undo');
my $hbox = Gtk2::HBox->new (FALSE, 5);
- # signal handlers
+ # signal handlers
$b_exit->signal_connect (clicked => sub { Gtk2->main_quit });
- $b_apply->signal_connect (clicked => sub { save_preferences ($parent) });
+ $b_apply->set_sensitive (not $READONLY);
+ $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);