3 # Clawsker :: A Claws Mail Tweaker
4 # Copyright 2007-2016 Ricardo Mones <ricardo@mones.org>
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # See COPYING file for license details.
12 # See AUTHORS file for a complete list of contributors.
15 binmode STDOUT, ":encoding(utf8)";
21 use Glib qw(TRUE FALSE);
23 use POSIX qw(setlocale);
26 use Digest::MD5 qw(md5_hex);
29 my $NAME = 'clawsker';
30 my $PREFIX = '@PREFIX@';
31 my $LIBDIR = '@LIBDIR@';
32 my $DATADIR = '@DATADIR@';
33 my $VERSION = '@VERSION@';
37 my $main_window = undef;
39 my $locale = (defined($ENV{LC_MESSAGES}) ? $ENV{LC_MESSAGES} : $ENV{LANG});
40 $locale = "C" unless defined($locale);
41 setlocale (LC_ALL, $locale);
42 bindtextdomain ($NAME, sprintf ('%s/share/locale', $PREFIX));
45 my $SHOWHINTS = FALSE;
46 $SHOWHINTS = TRUE if ($Gtk2::VERSION >= 1.040 and Gtk2->CHECK_VERSION (2, 12, 0));
51 my $xla = gettext ($str);
52 if (scalar(keys(%par)) > 0) {
53 foreach my $key (keys %par) {
54 $xla =~ s/\{$key\}/$par{$key}/g;
57 return decode_utf8($xla);
62 win_title => _('Claws Mail Hidden Preferences'),
63 about => _('About...'),
64 about_title => _('Clawsker :: A Claws Mail Tweaker'),
65 about_license => _('License:'),
66 about_version => _('Version:'),
68 tab_colours => _('Colours'),
69 tab_behaviour => _('Behaviour'),
71 tab_other => _('Other'),
72 tab_winpos => _('Windows'),
73 tab_accounts => _('Accounts'),
74 tab_plugins => _('Plugins'),
75 tab_info => _('Info'),
77 ab_frame => _('Addressbook'),
78 mem_frame => _('Memory'),
79 msgview_frame => _('Message View'),
80 log_frame => _('Log window'),
81 dnd_frame => _('Drag \'n\' drop'),
82 ssl_frame => _('Secure Sockets Layer'),
83 msgs_frame => _('Messages'),
84 swc_frame => _('Completion'),
85 stripes_frame => _('Coloured stripes'),
86 sbar_frame => _('Scroll bars'),
87 mlist_frame => _('Message List'),
88 mview_frame => _('Message View'),
89 compo_frame => _('Compose window'),
90 netm_frame => _('NetworkManager'),
91 diff_frame => _('Viewing patches'),
92 mpass_frame => _('Master passphrase'),
93 compose_frame => _('Compose window'),
94 qs_frame => _('Quick search'),
96 l_oth_use_dlg => _('Use detached address book edit dialogue'),
97 h_oth_use_dlg => _('If true use a separate dialogue to edit a person\'s details. Otherwise will use a form embedded in the address book\'s main window.'),
98 l_oth_max_use => _('Maximum memory for message cache (kB)'),
99 h_oth_max_use => _('The maximum amount of memory to use to cache messages, in kilobytes.'),
100 l_oth_min_time => _('Minimun time for cache elements (minutes)'),
101 h_oth_min_time => _('The minimum time in minutes to keep a cache in memory. Caches more recent than this time will not be freed, even if the memory usage is too high.'),
102 l_oth_use_netm => _('Use NetworkManager'),
103 h_oth_use_netm => _('Use NetworkManager to switch offline automatically.'),
104 l_oth_mp_rounds => _('Rounds for PBKDF2 function'),
105 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.'),
107 l_gui_b_unread => _('Show unread messages with bold font'),
108 h_gui_b_unread => _('Show unread messages in the Message List using a bold font.'),
109 l_gui_no_markup => _('Don\'t use markup'),
110 h_gui_no_markup => _('Don\'t use bold and italic text in Compose dialogue\'s account selector.'),
111 l_gui_dot_lines => _('Use dotted lines in tree view components'),
112 h_gui_dot_lines => _('Use the old dotted line look in the main window tree views (Folder, Message and other lists) instead of the modern lineless look.'),
113 l_gui_h_scroll => _('Enable horizontal scrollbar'),
114 h_gui_h_scroll => _('Enable the horizontal scrollbar in the Message List.'),
115 l_gui_swp_from => _('Display To column instead From column in Sent folder'),
116 h_gui_swp_from => _('Display the recipient\'s email address in a To column of the Sent folder instead of the originator\'s one in a From column.'),
117 l_gui_v_scroll => _('Folder List scrollbar behaviour'),
118 h_gui_v_scroll => _('Specify the policy of vertical scrollbar of Folder List: show always, automatic or hide always.'),
119 l_gui_v_scroll_show => _('Show always'),
120 l_gui_v_scroll_auto => _('Automatic'),
121 l_gui_v_scroll_hide => _('Hide always'),
122 l_gui_from_show => _('From column displays'),
123 h_gui_from_show => _('Selects the data displayed in the From column of the Message List: name, address or both.'),
124 l_gui_from_show_name => _('Name only'),
125 l_gui_from_show_addr => _('Address only'),
126 l_gui_from_show_both => _('Both name and address'),
127 l_gui_strip_off => _('Coloured lines contrast'),
128 h_gui_strip_off => _('Specify the value to use when creating alternately coloured lines in tree view components. The smaller the value, the less visible the difference in the alternating colours of the lines.'),
129 l_gui_cursor_v => _('Show cursor'),
130 h_gui_cursor_v => _('Display the cursor in the Message View.'),
131 l_gui_toolbar_d => _('Detachable toolbars'),
132 h_gui_toolbar_d => _('Show handles in the toolbars.'),
133 l_gui_strip_all => _('Use stripes in all tree view components'),
134 h_gui_strip_all => _('Enable alternately coloured lines in all tree view components.'),
135 l_gui_strip_sum => _('Use stripes in Folder List and Message List'),
136 h_gui_strip_sum => _('Enable alternately coloured lines in Message List and Folder List.'),
137 l_gui_two_line_v => _('2 lines per Message List item in 3-column layout'),
138 h_gui_two_line_v => _('Spread Message List information over two lines when using the three column mode.'),
139 l_gui_margin_co => _('Show margin'),
140 h_gui_margin_co => _('Shows a small margin in the Compose View.'),
141 l_gui_mview_date => _('Don\'t display localized date'),
142 h_gui_mview_date => _('Toggles localization of date format in Message View.'),
143 l_gui_zero_char => _('Zero replacement character'),
144 h_gui_zero_char => _('Replaces \'0\' with the given character in Folder List.'),
145 l_gui_type_any => _('Editable headers'),
146 h_gui_type_any => _('Allows to manually type any value in Compose Window header entries or just select from the available choices in the associated dropdown list.'),
147 l_gui_next_del => _('Select next message on delete'),
148 h_gui_next_del => _('When deleting a message, toggles between selecting the next one (newer message) or the previous one (older message).'),
150 l_beh_hover_t => _('Drag \'n\' drop hover timeout (ms)'),
151 h_beh_hover_t => _('Time in milliseconds that will cause a folder tree to expand when the mouse cursor is held over it during drag and drop.'),
152 l_beh_dangerous => _('Don\'t confirm deletions (dangerous!)'),
153 h_beh_dangerous => _('Don\'t ask for confirmation before definitive deletion of emails.'),
154 l_beh_flowed => _('Respect format=flowed in messages'),
155 h_beh_flowed => _('Respect format=flowed on text/plain message parts. This will cause some mails to have long lines, but will fix some URLs that would otherwise be wrapped.'),
156 l_beh_parts_rw => _('Allow writable temporary files'),
157 h_beh_parts_rw => _('Saves temporary files when opening attachment with write bit set.'),
158 l_beh_skip_ssl => _('Don\'t check SSL certificates'),
159 h_beh_skip_ssl => _('Disables the verification of SSL certificates.'),
160 l_beh_up_step => _('Progress bar update step (items)'),
161 h_beh_up_step => _('Update stepping in progress bars.'),
162 l_beh_thread_a => _('Maximum age when threading by subject (days)'),
163 h_beh_thread_a => _('Number of days to include a message in a thread when using "Thread using subject in addition to standard headers".'),
164 l_beh_unsafe_ssl => _('Allow unsafe SSL certificates'),
165 h_beh_unsafe_ssl => _('Allows Claws Mail to remember multiple SSL certificates for a given server/port.'),
166 l_beh_use_utf8 => _('Force UTF-8 for broken mails'),
167 h_beh_use_utf8 => _('Use UTF-8 encoding for broken mails instead of current locale.'),
168 l_beh_warn_dnd => _('Warn on drag \'n\' drop'),
169 h_beh_warn_dnd => _('Display a confirmation dialogue on drag \'n\' drop of folders.'),
170 l_beh_out_ascii => _('Outgoing messages fallback to ASCII'),
171 h_beh_out_ascii => _('If allowed by content, ASCII will be used to encode outgoing messages, otherwise the user-defined encoding is always enforced.'),
172 l_beh_pp_unsel => _('Primary paste unselects selection'),
173 h_beh_pp_unsel => _('Controls how pasting using middle-click changes the selected text and insertion point.'),
174 l_beh_inline_at => _('Show inline attachments'),
175 h_beh_inline_at => _('Allows to hide inline attachments already shown in mail structure view.'),
176 l_beh_addr_swc => _('Address search in compose window matches any'),
177 h_beh_addr_swc => _('On Tab-key completion, address text will match any part of the string or only from the start.'),
178 l_beh_fold_swc => _('Folder search in folder selector matches any'),
179 h_beh_fold_swc => _('On folder name completion text will match any part of the string or only from the start.'),
180 l_beh_rewrite_ff => _('Rewrite first \'From\' using QP encoding'),
181 h_beh_rewrite_ff => _('Workaround some servers which convert first \'From\' to \'>From\' by using Quoted-Printable transfer encoding instead of 7bit/8bit encoding.'),
183 l_col_emphasis => _('X-Mailer header'),
184 h_col_emphasis => _('The colour used for the X-Mailer line when its value is Claws Mail.'),
185 l_col_log_err => _('Error messages'),
186 h_col_log_err => _('Colour for error messages in log window.'),
187 l_col_log_in => _('Server messages'),
188 h_col_log_in => _('Colour for messages received from servers in log window.'),
189 l_col_log_msg => _('Standard messages'),
190 h_col_log_msg => _('Colour for messages in log window.'),
191 l_col_log_out => _('Client messages'),
192 h_col_log_out => _('Colour for messages sent to servers in log window.'),
193 l_col_log_warn => _('Warnings'),
194 h_col_log_warn => _('Colour for warning messages in log window.'),
196 l_col_tags_bg => _('Tags background'),
197 h_col_tags_bg => _('Background colour for tags in message view.'),
198 l_col_tags_text => _('Tags text'),
199 h_col_tags_text => _('Text colour for tags in message view.'),
201 l_col_default_header_bg => _('Default headers background'),
202 h_col_default_header_bg => _('Background colour for default headers in compose window.'),
203 l_col_default_header_text => _('Default headers text'),
204 h_col_default_header_text => _('Text colour for default headers in compose window.'),
206 l_col_qs_active_bg => _('Active quick search background'),
207 h_col_qs_active_bg => _('Background colour for active quick search.'),
208 l_col_qs_active_text => _('Active quick search text'),
209 h_col_qs_active_text => _('Text colour for active quick search.'),
210 l_col_qs_error_bg => _('Quick search error background'),
211 h_col_qs_error_bg => _('Background colour for quick search error.'),
212 l_col_qs_error_text => _('Quick search error text'),
213 h_col_qs_error_text => _('Text colour for quick search error.'),
215 l_col_diff_add => _('Added lines'),
216 h_col_diff_add => _('Colour for added lines in patches.'),
217 l_col_diff_del => _('Deleted lines'),
218 h_col_diff_del => _('Colour for deleted lines in patches.'),
219 l_col_diff_hunk => _('Hunk lines'),
220 h_col_diff_hunk => _('Color for hunk headers in patches.'),
222 l_win_x => _('X position'),
223 h_win_x => _('X coordinate for window\'s top-left corner.'),
224 l_win_y => _('Y position'),
225 h_win_y => _('Y coordinate for window\'s top-left corner.'),
226 l_win_w => _('Width'),
227 h_win_w => _('Window\'s width in pixels.'),
228 l_win_h => _('Height'),
229 h_win_h => _('Window\'s height in pixels.'),
231 l_win_main_mx => _('Maximized'),
232 h_win_main_mx => _('Changes window maximized status.'),
233 l_win_main_fs => _('Full-screen'),
234 h_win_main_fs => _('Changes full screen status.'),
236 l_acc_gtls_set => _('Use custom GnuTLS priority'),
237 h_acc_gtls_set => _('Enables using user provided GnuTLS priority string.'),
238 l_acc_gtls_pri => _('GnuTLS priority'),
239 h_acc_gtls_pri => _('Value to use as GnuTLS priority string if custom priority check is enabled. Otherwise this value is ignored.'),
241 l_plu_gpg_alimit => _('Autocompletion limit'),
242 h_plu_gpg_alimit => _('Limits the number of addresses obtained from keyring through autocompletion. Use 0 to get all matches.'),
243 l_plu_lav_burl => _('Base URL'),
244 h_plu_lav_burl => _('This is the URL where avatar requests are sent. You can use the one of your own libravatar server, if available.'),
245 l_plu_prl_flvb => _('Log level'),
246 h_plu_prl_flvb => _('Verbosity level of log, accumulative.'),
247 l_plu_prl_none => _('None'),
248 l_plu_prl_manual => _('Manual'),
249 l_plu_prl_action => _('Actions'),
250 l_plu_prl_match => _('Matches'),
253 # data and metadata of resource files
258 # all preferences read by load_preferences
262 # values of all preferences handled by clawsker
266 # default config dir and file name
267 my $ALTCONFIGDIR = FALSE;
268 my $CONFIGDIR = $ENV{HOME} . '/.claws-mail/';
269 my $CONFIGRC = 'clawsrc';
270 my $ACCOUNTRC = 'accountrc';
271 # supported and available plugins lists
272 my @PLUGINS = qw(AttRemover GPG ManageSieve Libravatar PerlPlugin);
277 # index constants for preference arrays
278 use constant NAME => 0; # the name on the rc file
279 use constant LABEL => 1; # the label on the GUI
280 use constant DESC => 2; # the description for the hint/help
281 use constant TYPE => 3; # data type: bool, int, float, string, color
282 use constant CMVER => 4; # lowest[,highest] Claws Mail version(s) the feature exists
283 use constant CMDEF => 5; # default value for the preference in Claws Mail
284 use constant PLUGIN => 6; # plugin section (only in plugin preferences)
286 # constants for GUI spacing
287 use constant HBOX_PAD => 5;
288 use constant FRAME_SPC => 2;
289 use constant PAGE_SPC => 5;
293 sub version_greater_or_equal {
294 my ($version, $refvers) = @_;
295 return TRUE if (version->parse($version) >= version->parse($refvers));
299 sub get_claws_version {
300 $_ = qx/which claws-mail/;
302 return "" unless ($_); # not installed
306 my @fver = split (/ /);
307 die "Invalid version string" unless ($fver[2] eq "version");
308 my @ver = split (/\./, $fver[3]);
311 if ($ver[2] =~ /(\d+)git(\d+)/) {
320 # data handlers and auxiliar functions
322 sub handle_bool_value {
323 my ($widget, $event, $dataref) = @_;
324 $$dataref = ($widget->get_active ())? '1': '0';
327 sub handle_int_value {
328 my ($widget, $event, $dataref) = @_;
329 $_ = $widget->get_text ();
334 $widget->set_text ($_);
337 $widget->set_text ($$dataref);
341 sub handle_string_value {
342 my ($widget, $event, $dataref) = @_;
343 $$dataref = $widget->get_text ();
346 sub handle_nchar_value {
347 my ($widget, $event, $dataref, $minlen, $maxlen) = @_;
348 $_ = substr ($widget->get_text (), 0, $maxlen);
349 $widget->set_text ($_);
353 sub gdk_color_from_str {
355 my ($rr, $gg, $bb) = (0, 0 ,0);
357 if (/\#([A-F0-9][A-F0-9])([A-F0-9][A-F0-9])([A-F0-9][A-F0-9])/) {
362 my $color = Gtk2::Gdk::Color->new ($rr, $gg, $bb);
366 sub str_from_gdk_color {
368 my $rr = $color->red / 256;
369 my $gg = $color->green / 256;
370 my $bb = $color->blue / 256;
371 my $str = sprintf ("#%.2x%.2x%.2x", $rr, $gg, $bb);
375 sub handle_color_value {
376 my ($widget, $event, $dataref) = @_;
377 my $newcol = $widget->get_color;
378 $$dataref = str_from_gdk_color ($newcol);
381 sub handle_selection_value {
382 my ($widget, $event, $dataref) = @_;
383 $$dataref = $widget->get_active;
386 sub get_rc_filename {
387 return $CONFIGDIR . $CONFIGRC;
390 sub get_ac_rc_filename {
391 return $CONFIGDIR . $ACCOUNTRC;
394 sub set_rc_filename {
396 my @parts = split ('/', $fullname);
397 $CONFIGRC = $parts[$#parts];
398 $parts[$#parts] = '';
399 $CONFIGDIR = join ('/', @parts);
403 my ($mesg, $fatal) = @_;
404 if (defined($fatal) && $fatal eq 'die') {
405 die "$NAME: $mesg\n";
408 print "$NAME: $mesg\n";
414 my $markup = "<span weight=\"bold\" size=\"large\">" . $emsg . "</span>";
415 my $errordlg = Gtk2::MessageDialog->new_with_markup ($main_window, 'modal', 'error', 'cancel', $markup);
416 $errordlg->set_title (_('Clawsker error'));
421 sub claws_is_running {
422 my $emsg = _('Error: seems Claws Mail is currently running, close it first.');
424 error_dialog ($emsg);
428 sub check_claws_not_running {
429 return TRUE if $READONLY;
430 my $tmpdir = (defined $ENV{TMPDIR})? $ENV{TMPDIR}: '/tmp';
431 $tmpdir = '/tmp' if ($tmpdir eq '');
432 my $lockdir = "$tmpdir/claws-mail-$<";
436 my $socket = "$lockdir/" . md5_hex ($_);
437 -S $socket and return claws_is_running ();
444 (defined($rcfile) && -f $rcfile) or do {
445 my $emsg = _('Error: resource file for Claws Mail was not found.');
447 error_dialog ($emsg);
453 sub set_widget_hint {
455 my ($wdgt, $hint) = @_;
456 $wdgt->set_tooltip_text ($hint);
457 $wdgt->set_has_tooltip (TRUE);
461 sub set_widget_sens {
462 my ($wdgt, $versions) = @_;
463 my @ver = split(/,/, $versions);
465 $wdgt->set_sensitive (
466 version_greater_or_equal ($CLAWSV, $ver[0])
467 and version_greater_or_equal ($ver[1], $CLAWSV)
470 $wdgt->set_sensitive (version_greater_or_equal ($CLAWSV, $ver[0]));
474 # graphic element creation
476 sub new_hbox_spaced_pack {
477 my $hbox = Gtk2::HBox->new (FALSE);
479 $hbox->pack_start ($_, FALSE, FALSE, HBOX_PAD);
484 sub new_check_button_for($$$) {
485 my ($hash, $key, $vhash) = @_;
486 my $name = $$hash{$key}[NAME];
487 my $label = $$hash{$key}[LABEL];
489 my $cb = Gtk2::CheckButton->new ($label);
490 my $value = $$vhash{$name};
491 $value //= $$hash{$key}[CMDEF];
492 $cb->set_active ($value eq '1');
493 $cb->signal_connect (clicked => sub {
495 handle_bool_value ($w, $e, \$$vhash{$name});
497 set_widget_hint ($cb, $$hash{$key}[DESC]);
498 set_widget_sens ($cb, $$hash{$key}[CMVER]);
500 return new_hbox_spaced_pack ($cb);
503 sub new_text_box_for_int($$$) {
504 my ($hash, $key, $vhash) = @_;
505 my $name = $$hash{$key}[NAME];
506 my $label = $$hash{$key}[LABEL];
507 my @type = split (/,/, $$hash{$key}[TYPE]);
508 push (@type, 0), push (@type, 10000) unless ($#type > 0);
510 my $glabel = Gtk2::Label->new ($label);
511 my $pagei = int (($type[2] - $type[1]) / 10);
512 my $gentry = Gtk2::SpinButton->new_with_range ($type[1], $type[2], $pagei);
513 my $value = $$vhash{$name};
514 $value //= $$hash{$key}[CMDEF];
515 $gentry->set_numeric (TRUE);
516 $gentry->set_value ($value);
517 $gentry->signal_connect('value-changed' => sub {
519 handle_int_value ($w, $e, \$$vhash{$name});
521 set_widget_hint ($gentry, $$hash{$key}[DESC]);
522 set_widget_sens ($gentry, $$hash{$key}[CMVER]);
523 $glabel->set_sensitive ($gentry->sensitive);
525 return new_hbox_spaced_pack ($glabel, $gentry);
528 sub new_text_box_for_nchar($$$) {
529 my ($hash, $key, $vhash) = @_;
530 my $name = $$hash{$key}[NAME];
531 my $label = $$hash{$key}[LABEL];
532 my @type = split (/,/, $$hash{$key}[TYPE]); # char,minlen,maxlen,width
533 my $glabel = Gtk2::Label->new ($label);
534 my $gentry = Gtk2::Entry->new ();
535 $gentry->set_max_length($type[2]) if defined ($type[2]);
536 my $width = $type[3];
538 $gentry->set_width_chars(int ($width) + 2) if defined ($width);
539 my $value = $$vhash{$name};
540 $value //= $$hash{$key}[CMDEF];
541 $gentry->set_text ($value);
542 $gentry->signal_connect('key-release-event' => sub {
544 handle_nchar_value ($w, $e, \$$vhash{$name}, $type[1], $type[2]);
546 set_widget_hint ($gentry, $$hash{$key}[DESC]);
547 set_widget_sens ($gentry, $$hash{$key}[CMVER]);
548 $glabel->set_sensitive ($gentry->sensitive);
550 return new_hbox_spaced_pack ($glabel, $gentry);
553 sub new_color_button_for($$$) {
554 my ($hash, $key, $vhash) = @_;
555 my $name = $$hash{$key}[NAME];
556 my $label = $$hash{$key}[LABEL];
558 my $value = $$vhash{$name};
559 $value //= $$hash{$key}[CMDEF];
560 my $col = gdk_color_from_str ($value);
561 my $glabel = Gtk2::Label->new ($label);
562 my $button = Gtk2::ColorButton->new_with_color ($col);
563 $button->set_title ($label);
564 $button->set_relief ('none');
565 $button->signal_connect ('color-set' => sub {
567 handle_color_value ($w, $e, \$$vhash{$name});
569 set_widget_hint ($button, $$hash{$key}[DESC]);
570 set_widget_sens ($button, $$hash{$key}[CMVER]);
571 $glabel->set_sensitive ($button->sensitive);
573 return new_hbox_spaced_pack ($button, $glabel);
576 sub new_selection_box_for($$$) {
577 my ($hash, $key, $vhash) = @_;
578 my $name = $$hash{$key}[NAME];
579 my $label = $$hash{$key}[LABEL];
581 my $glabel = Gtk2::Label->new ($label);
582 my $combo = Gtk2::ComboBox->new_text;
583 my @options = split (';', $$hash{$key}[TYPE]);
584 foreach my $opt (@options) {
585 my ($index, $textkey) = split ('=', $opt);
586 $combo->insert_text ($index, $xl::s{$textkey});
588 $combo->signal_connect ('changed' => sub {
590 handle_selection_value ($w, $e, \$$vhash{$name});
592 my $value = $$vhash{$name};
593 $value //= $$hash{$key}[CMDEF];
594 $combo->set_active ($value);
595 set_widget_hint ($combo, $$hash{$key}[DESC]);
596 set_widget_sens ($combo, $$hash{$key}[CMVER]);
597 $glabel->set_sensitive ($combo->sensitive);
599 return new_hbox_spaced_pack ($glabel, $combo);
602 # more graphic helpers
605 my $hbox = Gtk2::HBox->new (FALSE);
606 $hbox->set_border_width (PAGE_SPC);
608 $hbox->pack_start ($_, FALSE, FALSE, 0);
614 my $vbox = Gtk2::VBox->new (FALSE, 5);
615 $vbox->set_border_width (PAGE_SPC);
617 $vbox->pack_start ($_, FALSE, FALSE, 0);
622 sub new_vbox_pack_compact {
623 my $vbox = Gtk2::VBox->new (FALSE, 0);
624 $vbox->set_border_width (0);
626 $vbox->pack_start ($_, FALSE, FALSE, 0);
631 sub new_subpage_frame {
632 my ($box, $title, $notpacked) = @_;
633 my $frame = Gtk2::Frame->new ($title);
635 return new_vbox_pack ($frame) unless defined ($notpacked);
639 # preference maps and corresponding page creation subs
641 %pr::oth = ( # other preferences
643 'addressbook_use_editaddress_dialog',
644 $xl::s{l_oth_use_dlg},
645 $xl::s{h_oth_use_dlg},
651 'cache_max_mem_usage',
652 $xl::s{l_oth_max_use},
653 $xl::s{h_oth_max_use},
654 'int,0,262144', # 0 Kb - 256 Mb
659 'cache_min_keep_time',
660 $xl::s{l_oth_min_time},
661 $xl::s{h_oth_min_time},
662 'int,0,120', # 0 minutes - 2 hours
667 'use_networkmanager',
668 $xl::s{l_oth_use_netm},
669 $xl::s{h_oth_use_netm},
675 'master_passphrase_pbkdf2_rounds',
676 $xl::s{l_oth_mp_rounds},
677 $xl::s{h_oth_mp_rounds},
684 sub new_other_page() {
685 return new_vbox_pack (
688 new_check_button_for(\%pr::oth, 'use_dlg', \%HPVALUE)),
689 $xl::s{ab_frame}, 'not-packed'),
692 new_text_box_for_int(\%pr::oth, 'max_use', \%HPVALUE),
693 new_text_box_for_int(\%pr::oth, 'min_time', \%HPVALUE)),
694 $xl::s{mem_frame}, 'not-packed'),
697 new_check_button_for(\%pr::oth, 'use_netm', \%HPVALUE)),
698 $xl::s{netm_frame}, 'not-packed'),
701 new_text_box_for_int(\%pr::oth, 'mp_rounds', \%HPVALUE)),
702 $xl::s{mpass_frame}, 'not-packed')
706 %pr::gui = ( # gui bells and whistles
709 $xl::s{l_gui_b_unread},
710 $xl::s{h_gui_b_unread},
717 $xl::s{l_gui_no_markup},
718 $xl::s{h_gui_no_markup},
724 'enable_dotted_lines',
725 $xl::s{l_gui_dot_lines},
726 $xl::s{h_gui_dot_lines},
728 '2.4.0.115,3.7.10.44',
733 $xl::s{l_gui_h_scroll},
734 $xl::s{h_gui_h_scroll},
741 $xl::s{l_gui_swp_from},
742 $xl::s{h_gui_swp_from},
748 'folderview_vscrollbar_policy',
749 $xl::s{l_gui_v_scroll},
750 $xl::s{h_gui_v_scroll},
751 '0=l_gui_v_scroll_show;1=l_gui_v_scroll_auto;2=l_gui_v_scroll_hide',
757 $xl::s{l_gui_from_show},
758 $xl::s{h_gui_from_show},
759 '0=l_gui_from_show_name;1=l_gui_from_show_addr;2=l_gui_from_show_both',
764 'stripes_color_offset',
765 $xl::s{l_gui_strip_off},
766 $xl::s{h_gui_strip_off},
767 'int,0,40000', # no idea what this number means
772 'textview_cursor_visible',
773 $xl::s{l_gui_cursor_v},
774 $xl::s{h_gui_cursor_v},
780 'toolbar_detachable',
781 $xl::s{l_gui_toolbar_d},
782 $xl::s{h_gui_toolbar_d},
788 'use_stripes_everywhere',
789 $xl::s{l_gui_strip_all},
790 $xl::s{h_gui_strip_all},
796 'use_stripes_in_summaries',
797 $xl::s{l_gui_strip_sum},
798 $xl::s{h_gui_strip_sum},
805 $xl::s{l_gui_two_line_v},
806 $xl::s{h_gui_two_line_v},
812 'show_compose_margin',
813 $xl::s{l_gui_margin_co},
814 $xl::s{h_gui_margin_co},
820 'msgview_date_format',
821 $xl::s{l_gui_mview_date},
822 $xl::s{h_gui_mview_date},
828 'zero_replacement_char',
829 $xl::s{l_gui_zero_char},
830 $xl::s{h_gui_zero_char},
837 $xl::s{l_gui_type_any},
838 $xl::s{h_gui_type_any},
845 $xl::s{l_gui_next_del},
846 $xl::s{h_gui_next_del},
854 my $gf = Gtk2::VBox->new (FALSE, 5);
855 $gf->set_border_width (PAGE_SPC);
857 my $cb_dot_lines = new_check_button_for (\%pr::gui, 'dot_lines', \%HPVALUE);
858 my $cb_toolbar_d = new_check_button_for (\%pr::gui, 'toolbar_d', \%HPVALUE);
859 my $tb_zero_char = new_text_box_for_nchar (\%pr::gui, 'zero_char', \%HPVALUE);
861 $gf->pack_start (new_subpage_frame (
863 new_check_button_for (\%pr::gui, 'strip_all', \%HPVALUE),
864 new_check_button_for (\%pr::gui, 'strip_sum', \%HPVALUE),
865 new_text_box_for_int (\%pr::gui, 'strip_off', \%HPVALUE)),
866 $xl::s{stripes_frame}, 'not-packed'),
867 FALSE, FALSE, FRAME_SPC);
868 $gf->pack_start (new_subpage_frame (
870 new_check_button_for (\%pr::gui, 'b_unread', \%HPVALUE),
871 new_check_button_for (\%pr::gui, 'swp_from', \%HPVALUE),
872 new_check_button_for (\%pr::gui, 'two_linev', \%HPVALUE),
873 new_check_button_for (\%pr::gui, 'next_del', \%HPVALUE),
874 new_selection_box_for (\%pr::gui, 'from_show', \%HPVALUE)),
875 $xl::s{mlist_frame}, 'not-packed'),
876 FALSE, FALSE, FRAME_SPC);
877 $gf->pack_start (new_subpage_frame (
879 new_check_button_for (\%pr::gui, 'cursor_v', \%HPVALUE),
880 new_check_button_for (\%pr::gui, 'mview_date', \%HPVALUE)),
881 $xl::s{mview_frame}, 'not-packed'),
882 FALSE, FALSE, FRAME_SPC);
883 $gf->pack_start (new_subpage_frame (
885 new_check_button_for (\%pr::gui, 'no_markup', \%HPVALUE),
886 new_check_button_for (\%pr::gui, 'margin_co', \%HPVALUE),
887 new_check_button_for (\%pr::gui, 'type_any', \%HPVALUE)),
888 $xl::s{compo_frame}, 'not-packed'),
889 FALSE, FALSE, FRAME_SPC);
890 $gf->pack_start ($cb_dot_lines, FALSE, FALSE, 0);
891 $gf->pack_start ($cb_toolbar_d, FALSE, FALSE, 0);
892 $gf->pack_start (new_subpage_frame (
894 new_check_button_for (\%pr::gui, 'h_scroll', \%HPVALUE),
895 new_selection_box_for (\%pr::gui, 'v_scroll', \%HPVALUE)),
896 $xl::s{sbar_frame}, 'not-packed'),
897 FALSE, FALSE, FRAME_SPC);
898 $gf->pack_start ($tb_zero_char, FALSE, FALSE, 0);
903 %pr::beh = ( # tweak some behaviour
906 $xl::s{l_beh_hover_t},
907 $xl::s{h_beh_hover_t},
908 'int,100,3000', # 0.1 seconds - 3 seconds
914 $xl::s{l_beh_dangerous},
915 $xl::s{h_beh_dangerous},
921 'respect_flowed_format',
922 $xl::s{l_beh_flowed},
923 $xl::s{h_beh_flowed},
929 'save_parts_readwrite',
930 $xl::s{l_beh_parts_rw},
931 $xl::s{h_beh_parts_rw},
937 'skip_ssl_cert_check',
938 $xl::s{l_beh_skip_ssl},
939 $xl::s{h_beh_skip_ssl},
945 'statusbar_update_step',
946 $xl::s{l_beh_up_step},
947 $xl::s{h_beh_up_step},
948 'int,1,200', # 1 item - 200 items
953 'thread_by_subject_max_age',
954 $xl::s{l_beh_thread_a},
955 $xl::s{h_beh_thread_a},
956 'int,1,30', # 1 day - 30 days
962 $xl::s{l_beh_unsafe_ssl},
963 $xl::s{h_beh_unsafe_ssl},
969 'utf8_instead_of_locale_for_broken_mail',
970 $xl::s{l_beh_use_utf8},
971 $xl::s{h_beh_use_utf8},
978 $xl::s{l_beh_warn_dnd},
979 $xl::s{h_beh_warn_dnd},
985 'outgoing_fallback_to_ascii',
986 $xl::s{l_beh_out_ascii},
987 $xl::s{h_beh_out_ascii},
993 'primary_paste_unselects',
994 $xl::s{l_beh_pp_unsel},
995 $xl::s{h_beh_pp_unsel},
1001 'show_inline_attachments',
1002 $xl::s{l_beh_inline_at},
1003 $xl::s{h_beh_inline_at},
1009 'address_search_wildcard',
1010 $xl::s{l_beh_addr_swc},
1011 $xl::s{h_beh_addr_swc},
1017 'folder_search_wildcard',
1018 $xl::s{l_beh_fold_swc},
1019 $xl::s{h_beh_fold_swc},
1025 'rewrite_first_from',
1026 $xl::s{l_beh_rewrite_ff},
1027 $xl::s{h_beh_rewrite_ff},
1034 sub new_behaviour_page() {
1035 my $bf = Gtk2::VBox->new (FALSE, 5);
1036 $bf->set_border_width (PAGE_SPC);
1038 my $tb_up_step = new_text_box_for_int (\%pr::beh, 'up_step', \%HPVALUE);
1039 my $tb_thread_a = new_text_box_for_int (\%pr::beh, 'thread_a', \%HPVALUE);
1041 $bf->pack_start (new_subpage_frame (
1043 new_text_box_for_int (\%pr::beh, 'hover_t', \%HPVALUE),
1044 new_check_button_for (\%pr::beh, 'warn_dnd', \%HPVALUE)),
1045 $xl::s{dnd_frame}, 'not-packed'),
1046 FALSE, FALSE, FRAME_SPC);
1047 $bf->pack_start (new_subpage_frame (
1049 new_check_button_for (\%pr::beh, 'skip_ssl', \%HPVALUE),
1050 new_check_button_for (\%pr::beh, 'unsafe_ssl', \%HPVALUE)),
1051 $xl::s{ssl_frame}, 'not-packed'),
1052 FALSE, FALSE, FRAME_SPC);
1053 $bf->pack_start ($tb_up_step, FALSE, FALSE, 0);
1054 $bf->pack_start ($tb_thread_a, FALSE, FALSE, 0);
1055 $bf->pack_start (new_subpage_frame (
1057 new_check_button_for (\%pr::beh, 'flowed', \%HPVALUE),
1058 new_check_button_for (\%pr::beh, 'parts_rw', \%HPVALUE),
1059 new_check_button_for (\%pr::beh, 'use_utf8', \%HPVALUE),
1060 new_check_button_for (\%pr::beh, 'dangerous', \%HPVALUE),
1061 new_check_button_for (\%pr::beh, 'out_ascii', \%HPVALUE),
1062 new_check_button_for (\%pr::beh, 'pp_unsel', \%HPVALUE),
1063 new_check_button_for (\%pr::beh, 'inline_at', \%HPVALUE),
1064 new_check_button_for (\%pr::beh, 'rewrite_ff', \%HPVALUE)),
1065 $xl::s{msgs_frame}, 'not-packed'),
1066 FALSE, FALSE, FRAME_SPC);
1067 $bf->pack_start (new_subpage_frame (
1069 new_check_button_for (\%pr::beh, 'addr_swc', \%HPVALUE),
1070 new_check_button_for (\%pr::beh, 'fold_swc', \%HPVALUE)),
1071 $xl::s{swc_frame}, 'not-packed'),
1072 FALSE, FALSE, FRAME_SPC);
1076 %pr::col = ( # a variety of colours
1079 $xl::s{l_col_emphasis},
1080 $xl::s{h_col_emphasis},
1087 $xl::s{l_col_log_err},
1088 $xl::s{h_col_log_err},
1095 $xl::s{l_col_log_in},
1096 $xl::s{h_col_log_in},
1103 $xl::s{l_col_log_msg},
1104 $xl::s{h_col_log_msg},
1111 $xl::s{l_col_log_out},
1112 $xl::s{h_col_log_out},
1119 $xl::s{l_col_log_warn},
1120 $xl::s{h_col_log_warn},
1127 $xl::s{l_col_diff_add},
1128 $xl::s{h_col_diff_add},
1134 'diff_deleted_color',
1135 $xl::s{l_col_diff_del},
1136 $xl::s{h_col_diff_del},
1143 $xl::s{l_col_diff_hunk},
1144 $xl::s{h_col_diff_hunk},
1151 $xl::s{l_col_tags_bg},
1152 $xl::s{h_col_tags_bg},
1159 $xl::s{l_col_tags_text},
1160 $xl::s{h_col_tags_text},
1165 default_header_bg => [
1166 'default_header_bgcolor',
1167 $xl::s{l_col_default_header_bg},
1168 $xl::s{h_col_default_header_bg},
1173 default_header_text => [
1174 'default_header_color',
1175 $xl::s{l_col_default_header_text},
1176 $xl::s{h_col_default_header_text},
1182 'qs_active_bgcolor',
1183 $xl::s{l_col_qs_active_bg},
1184 $xl::s{h_col_qs_active_bg},
1191 $xl::s{l_col_qs_active_text},
1192 $xl::s{h_col_qs_active_text},
1199 $xl::s{l_col_qs_error_bg},
1200 $xl::s{h_col_qs_error_bg},
1207 $xl::s{l_col_qs_error_text},
1208 $xl::s{h_col_qs_error_text},
1215 sub new_colours_page() {
1216 return new_vbox_pack (
1219 new_color_button_for (\%pr::col, 'emphasis', \%HPVALUE),
1220 new_color_button_for (\%pr::col, 'tags_bg', \%HPVALUE),
1221 new_color_button_for (\%pr::col, 'tags_text', \%HPVALUE)),
1222 $xl::s{msgview_frame}, 'not-packed'),
1225 new_color_button_for (\%pr::col, 'log_err', \%HPVALUE),
1226 new_color_button_for (\%pr::col, 'log_in', \%HPVALUE),
1227 new_color_button_for (\%pr::col, 'log_msg', \%HPVALUE),
1228 new_color_button_for (\%pr::col, 'log_out', \%HPVALUE),
1229 new_color_button_for (\%pr::col, 'log_warn', \%HPVALUE)),
1230 $xl::s{log_frame}, 'not-packed'),
1233 new_color_button_for (\%pr::col, 'diff_add', \%HPVALUE),
1234 new_color_button_for (\%pr::col, 'diff_del', \%HPVALUE),
1235 new_color_button_for (\%pr::col, 'diff_hunk', \%HPVALUE)),
1236 $xl::s{diff_frame}, 'not-packed'),
1239 new_color_button_for (\%pr::col, 'default_header_bg', \%HPVALUE),
1240 new_color_button_for (\%pr::col, 'default_header_text', \%HPVALUE)),
1241 $xl::s{compose_frame}, 'not-packed'),
1244 new_color_button_for (\%pr::col, 'qs_active_bg', \%HPVALUE),
1245 new_color_button_for (\%pr::col, 'qs_active_text', \%HPVALUE),
1246 new_color_button_for (\%pr::col, 'qs_error_bg', \%HPVALUE),
1247 new_color_button_for (\%pr::col, 'qs_error_text', \%HPVALUE)),
1248 $xl::s{qs_frame}, 'not-packed')
1252 %pr::win = ( # tweak window positions and/or sizes
1257 'int,0,3000', # 0 pixels - 3000 pixels
1265 'int,0,3000', # 0 pixels - 3000 pixels
1273 'int,0,3000', # 0 pixels - 3000 pixels
1281 'int,0,3000', # 0 pixels - 3000 pixels
1286 'mainwin_maximised',
1287 $xl::s{l_win_main_mx},
1288 $xl::s{h_win_main_mx},
1294 'mainwin_fullscreen',
1295 $xl::s{l_win_main_fs},
1296 $xl::s{h_win_main_fs},
1302 'main_messagewin_x',
1305 'int,0,3000', # 0 pixels - 3000 pixels
1310 'main_messagewin_y',
1313 'int,0,3000', # 0 pixels - 3000 pixels
1321 'int,0,3000', # 0 pixels - 3000 pixels
1326 'messagewin_height',
1329 'int,0,3000', # 0 pixels - 3000 pixels
1337 'int,0,3000', # 0 pixels - 3000 pixels
1345 'int,0,3000', # 0 pixels - 3000 pixels
1353 'int,0,3000', # 0 pixels - 3000 pixels
1358 'receivewin_height',
1361 'int,0,3000', # 0 pixels - 3000 pixels
1369 'int,0,3000', # 0 pixels - 3000 pixels
1377 'int,0,3000', # 0 pixels - 3000 pixels
1382 'folderitemwin_width',
1385 'int,0,3000', # 0 pixels - 3000 pixels
1390 'folderitemwin_height',
1393 'int,0,3000', # 0 pixels - 3000 pixels
1398 'folderselwin_width',
1401 'int,0,3000', # 0 pixels - 3000 pixels
1406 'folderselwin_height',
1409 'int,0,3000', # 0 pixels - 3000 pixels
1417 'int,0,3000', # 0 pixels - 3000 pixels
1425 'int,0,3000', # 0 pixels - 3000 pixels
1430 'addressbookwin_width',
1433 'int,0,3000', # 0 pixels - 3000 pixels
1438 'addressbookwin_height',
1441 'int,0,3000', # 0 pixels - 3000 pixels
1446 'addressbookeditpersonwin_width',
1449 'int,0,3000', # 0 pixels - 3000 pixels
1454 'addressbookeditpersonwin_height',
1457 'int,0,3000', # 0 pixels - 3000 pixels
1462 'addressbookeditgroupwin_width',
1465 'int,0,3000', # 0 pixels - 3000 pixels
1470 'addressbookeditgroupwin_height',
1473 'int,0,3000', # 0 pixels - 3000 pixels
1478 'addressaddwin_width',
1481 'int,0,3000', # 0 pixels - 3000 pixels
1486 'addressaddwin_height',
1489 'int,0,3000', # 0 pixels - 3000 pixels
1494 'addressbook_folderselwin_width',
1497 'int,0,3000', # 0 pixels - 3000 pixels
1502 'addressbook_folderselwin_height',
1505 'int,0,3000', # 0 pixels - 3000 pixels
1510 'editaccountwin_width',
1513 'int,0,3000', # 0 pixels - 3000 pixels
1518 'editaccountwin_height',
1521 'int,0,3000', # 0 pixels - 3000 pixels
1526 'accountswin_width',
1529 'int,0,3000', # 0 pixels - 3000 pixels
1534 'accountswin_height',
1537 'int,0,3000', # 0 pixels - 3000 pixels
1542 'filteringwin_width',
1545 'int,0,3000', # 0 pixels - 3000 pixels
1550 'filteringwin_height',
1553 'int,0,3000', # 0 pixels - 3000 pixels
1558 'filteringactionwin_width',
1561 'int,0,3000', # 0 pixels - 3000 pixels
1566 'filteringactionwin_height',
1569 'int,0,3000', # 0 pixels - 3000 pixels
1574 'filtering_debugwin_width',
1577 'int,0,3000', # 0 pixels - 3000 pixels
1582 'filtering_debugwin_height',
1585 'int,0,3000', # 0 pixels - 3000 pixels
1593 'int,0,3000', # 0 pixels - 3000 pixels
1598 'matcherwin_height',
1601 'int,0,3000', # 0 pixels - 3000 pixels
1609 'int,0,3000', # 0 pixels - 3000 pixels
1617 'int,0,3000', # 0 pixels - 3000 pixels
1622 'templateswin_width',
1625 'int,0,3000', # 0 pixels - 3000 pixels
1630 'templateswin_height',
1633 'int,0,3000', # 0 pixels - 3000 pixels
1641 'int,0,3000', # 0 pixels - 3000 pixels
1646 'actionswin_height',
1649 'int,0,3000', # 0 pixels - 3000 pixels
1657 'int,0,3000', # 0 pixels - 3000 pixels
1665 'int,0,3000', # 0 pixels - 3000 pixels
1673 'int,0,3000', # 0 pixels - 3000 pixels
1678 'pluginswin_height',
1681 'int,0,3000', # 0 pixels - 3000 pixels
1689 'int,0,3000', # 0 pixels - 3000 pixels
1697 'int,0,3000', # 0 pixels - 3000 pixels
1702 'print_previewwin_width',
1705 'int,0,3000', # 0 pixels - 3000 pixels
1710 'print_previewwin_height',
1713 'int,0,3000', # 0 pixels - 3000 pixels
1719 sub new_winpos_subpage_main() {
1720 return new_subpage_frame (
1721 new_vbox_pack_compact (
1723 new_text_box_for_int (\%pr::win, 'main_x', \%HPVALUE),
1724 new_text_box_for_int (\%pr::win, 'main_y', \%HPVALUE)),
1726 new_text_box_for_int (\%pr::win, 'main_w', \%HPVALUE),
1727 new_text_box_for_int (\%pr::win, 'main_h', \%HPVALUE)),
1729 new_check_button_for (\%pr::win, 'main_fs', \%HPVALUE),
1730 new_check_button_for (\%pr::win, 'main_mx', \%HPVALUE))),
1735 sub new_winpos_subpage_msgs() {
1736 return new_subpage_frame (
1737 new_vbox_pack_compact (
1739 new_text_box_for_int (\%pr::win, 'msgs_x', \%HPVALUE),
1740 new_text_box_for_int (\%pr::win, 'msgs_y', \%HPVALUE)),
1742 new_text_box_for_int (\%pr::win, 'msgs_w', \%HPVALUE),
1743 new_text_box_for_int (\%pr::win, 'msgs_h', \%HPVALUE))),
1748 sub new_winpos_subpage_sendrecv() {
1749 return new_vbox_pack (
1752 new_text_box_for_int (\%pr::win, 'send_w', \%HPVALUE),
1753 new_text_box_for_int (\%pr::win, 'send_h', \%HPVALUE)),
1754 _('Send window'), 'not-packed'),
1757 new_text_box_for_int (\%pr::win, 'recv_w', \%HPVALUE),
1758 new_text_box_for_int (\%pr::win, 'recv_h', \%HPVALUE)),
1759 _('Receive window'), 'not-packed')
1763 sub new_winpos_subpage_fold() {
1764 return new_vbox_pack (
1766 new_vbox_pack_compact (
1768 new_text_box_for_int (\%pr::win, 'fold_x', \%HPVALUE),
1769 new_text_box_for_int (\%pr::win, 'fold_y', \%HPVALUE)),
1771 new_text_box_for_int (\%pr::win, 'fold_w', \%HPVALUE),
1772 new_text_box_for_int (\%pr::win, 'fold_h', \%HPVALUE))),
1773 _('Folder window'), 'not-packed'),
1776 new_text_box_for_int (\%pr::win, 'fsel_w', \%HPVALUE),
1777 new_text_box_for_int (\%pr::win, 'fsel_h', \%HPVALUE)),
1778 _('Folder selection window'), 'not-packed')
1782 sub new_winpos_subpage_addrbook() {
1783 return new_vbox_pack (
1786 new_text_box_for_int (\%pr::win, 'addr_w', \%HPVALUE),
1787 new_text_box_for_int (\%pr::win, 'addr_h', \%HPVALUE)),
1788 _('Addressbook main window'), 'not-packed'),
1791 new_text_box_for_int (\%pr::win, 'adep_w', \%HPVALUE),
1792 new_text_box_for_int (\%pr::win, 'adep_h', \%HPVALUE)),
1793 _('Edit person window'), 'not-packed'),
1796 new_text_box_for_int (\%pr::win, 'adeg_w', \%HPVALUE),
1797 new_text_box_for_int (\%pr::win, 'adeg_h', \%HPVALUE)),
1798 _('Edit group window'), 'not-packed'),
1801 new_text_box_for_int (\%pr::win, 'adda_w', \%HPVALUE),
1802 new_text_box_for_int (\%pr::win, 'adda_h', \%HPVALUE)),
1803 _('Add address window'), 'not-packed'),
1806 new_text_box_for_int (\%pr::win, 'addf_w', \%HPVALUE),
1807 new_text_box_for_int (\%pr::win, 'addf_h', \%HPVALUE)),
1808 _('Folder select window'), 'not-packed')
1812 sub new_winpos_subpage_accounts() {
1813 return new_vbox_pack (
1816 new_text_box_for_int (\%pr::win, 'acco_w', \%HPVALUE),
1817 new_text_box_for_int (\%pr::win, 'acco_h', \%HPVALUE)),
1818 _('Accounts window'), 'not-packed'),
1821 new_text_box_for_int (\%pr::win, 'acce_w', \%HPVALUE),
1822 new_text_box_for_int (\%pr::win, 'acce_h', \%HPVALUE)),
1823 _('Edit account window'), 'not-packed')
1827 sub new_winpos_subpage_filtering() {
1828 return new_vbox_pack (
1831 new_text_box_for_int (\%pr::win, 'filt_w', \%HPVALUE),
1832 new_text_box_for_int (\%pr::win, 'filt_h', \%HPVALUE)),
1833 _('Filtering window'), 'not-packed'),
1836 new_text_box_for_int (\%pr::win, 'fila_w', \%HPVALUE),
1837 new_text_box_for_int (\%pr::win, 'fila_h', \%HPVALUE)),
1838 _('Filtering actions window'), 'not-packed'),
1841 new_text_box_for_int (\%pr::win, 'fild_w', \%HPVALUE),
1842 new_text_box_for_int (\%pr::win, 'fild_h', \%HPVALUE)),
1843 _('Filtering debug window'), 'not-packed'),
1846 new_text_box_for_int (\%pr::win, 'matc_w', \%HPVALUE),
1847 new_text_box_for_int (\%pr::win, 'matc_h', \%HPVALUE)),
1848 _('Matcher window'), 'not-packed')
1852 sub new_winpos_subpage_prefs() {
1853 return new_vbox_pack (
1856 new_text_box_for_int (\%pr::win, 'pref_w', \%HPVALUE),
1857 new_text_box_for_int (\%pr::win, 'pref_h', \%HPVALUE)),
1858 _('Preferences window'), 'not-packed'),
1861 new_text_box_for_int (\%pr::win, 'temp_w', \%HPVALUE),
1862 new_text_box_for_int (\%pr::win, 'temp_h', \%HPVALUE)),
1863 _('Templates window'), 'not-packed'),
1866 new_text_box_for_int (\%pr::win, 'acti_w', \%HPVALUE),
1867 new_text_box_for_int (\%pr::win, 'acti_h', \%HPVALUE)),
1868 _('Actions window'), 'not-packed'),
1871 new_text_box_for_int (\%pr::win, 'tags_w', \%HPVALUE),
1872 new_text_box_for_int (\%pr::win, 'tags_h', \%HPVALUE)),
1873 _('Tags window'), 'not-packed'),
1876 new_text_box_for_int (\%pr::win, 'plug_w', \%HPVALUE),
1877 new_text_box_for_int (\%pr::win, 'plug_h', \%HPVALUE)),
1878 _('Plugins window'), 'not-packed')
1882 sub new_winpos_subpage_misc() {
1883 return new_vbox_pack (
1886 new_text_box_for_int (\%pr::win, 'logw_w', \%HPVALUE),
1887 new_text_box_for_int (\%pr::win, 'logw_h', \%HPVALUE)),
1888 _('Log window'), 'not-packed'),
1891 new_text_box_for_int (\%pr::win, 'prin_w', \%HPVALUE),
1892 new_text_box_for_int (\%pr::win, 'prin_h', \%HPVALUE)),
1893 _('Print preview window'), 'not-packed'),
1896 new_text_box_for_int (\%pr::win, 'sour_w', \%HPVALUE),
1897 new_text_box_for_int (\%pr::win, 'sour_h', \%HPVALUE)),
1898 _('View source window'), 'not-packed')
1902 sub new_winpos_page() {
1903 my $winbook = Gtk2::Notebook->new;
1904 $winbook->set_tab_pos ('right');
1905 $winbook->append_page (new_winpos_subpage_main, _('Main'));
1906 $winbook->append_page (new_winpos_subpage_msgs, _('Message'));
1907 $winbook->append_page (new_winpos_subpage_sendrecv, _('Send/Receive'));
1908 $winbook->append_page (new_winpos_subpage_fold, _('Folder'));
1909 $winbook->append_page (new_winpos_subpage_addrbook, _('Addressbook'));
1910 $winbook->append_page (new_winpos_subpage_accounts, _('Accounts'));
1911 $winbook->append_page (new_winpos_subpage_filtering, _('Filtering'));
1912 $winbook->append_page (new_winpos_subpage_prefs, _('Preferences'));
1913 $winbook->append_page (new_winpos_subpage_misc, _('Other'));
1917 %pr::acc = ( # per account hidden preferences
1919 'gnutls_set_priority',
1920 $xl::s{l_acc_gtls_set},
1921 $xl::s{h_acc_gtls_set},
1928 $xl::s{l_acc_gtls_pri},
1929 $xl::s{h_acc_gtls_pri},
1936 sub new_account_subpage($) {
1938 return new_vbox_pack (
1941 new_check_button_for (\%pr::acc, 'tls_set', $ACHPVALUE{$akey}),
1942 new_text_box_for_nchar (\%pr::acc, 'tls_pri', $ACHPVALUE{$akey})),
1943 _('GnuTLS priority'), 'not-packed')
1947 sub new_accounts_page() {
1948 my $accbook = Gtk2::Notebook->new;
1949 $accbook->set_tab_pos ('right');
1951 $ACPREFS{$a}{'account_name'} cmp $ACPREFS{$b}{'account_name'}
1954 my $name = $ACPREFS{$_}{'account_name'};
1955 my $isdef = ($ACPREFS{$_}{'is_default'} eq '1');
1956 my $page = new_account_subpage ($_);
1957 $accbook->append_page ($page, $isdef? '<b>' . $name . '</b>': $name);
1959 my $label = $accbook->get_tab_label ($page);
1960 $label->set_use_markup (TRUE);
1963 $accbook->set_scrollable (TRUE);
1967 %pr::plu = ( # plugins hidden preferences
1973 'int,0,3000', # 0 pixels - 3000 pixels
1982 'int,0,3000', # 0 pixels - 3000 pixels
1989 'autocompletion_limit',
1990 $xl::s{l_plu_gpg_alimit},
1991 $xl::s{h_plu_gpg_alimit},
1999 'manager_win_width',
2002 'int,0,3000', # 0 pixels - 3000 pixels
2008 'manager_win_height',
2011 'int,0,3000', # 0 pixels - 3000 pixels
2019 $xl::s{l_plu_lav_burl},
2020 $xl::s{h_plu_lav_burl},
2023 'http://cdn.libravatar.org/avatar',
2028 'filter_log_verbosity',
2029 $xl::s{l_plu_prl_flvb},
2030 $xl::s{h_plu_prl_flvb},
2031 '0=l_plu_prl_none;1=l_plu_prl_manual;2=l_plu_prl_action;3=l_plu_prl_match',
2038 sub new_plugins_page() {
2040 $frame{'AttRemover'} =
2043 new_text_box_for_int (\%pr::plu, 'arm_winw', $PLHPVALUE{'AttRemover'}),
2044 new_text_box_for_int (\%pr::plu, 'arm_winh', $PLHPVALUE{'AttRemover'})),
2045 _('Attachment remover'), 'not-packed');
2049 new_text_box_for_int (\%pr::plu, 'gpg_alimit', $PLHPVALUE{'GPG'})),
2050 _('GPG'), 'not-packed');
2051 $frame{'ManageSieve'} =
2054 new_text_box_for_int (\%pr::plu, 'msv_winw', $PLHPVALUE{'ManageSieve'}),
2055 new_text_box_for_int (\%pr::plu, 'msv_winh', $PLHPVALUE{'ManageSieve'})),
2056 _('Sieve manager'), 'not-packed');
2057 $frame{'Libravatar'} =
2060 new_text_box_for_nchar (\%pr::plu, 'lav_burl', $PLHPVALUE{'Libravatar'})),
2061 _('Libravatar'), 'not-packed');
2062 $frame{'PerlPlugin'} =
2065 new_selection_box_for (\%pr::plu, 'prl_flvb', $PLHPVALUE{'PerlPlugin'})),
2066 _('Perl'), 'not-packed');
2067 foreach (@PLUGINS) {
2068 $frame{$_}->set_sensitive (defined $PLHPVALUE{$_});
2070 return new_vbox_pack (
2071 $frame{'AttRemover'},
2073 $frame{'ManageSieve'},
2074 $frame{'Libravatar'},
2075 $frame{'PerlPlugin'});
2078 sub new_info_page() {
2079 my $t0 = Gtk2::Table->new (7, 2, FALSE);
2080 my $v = get_toolkit_versions ();
2082 'glib' => 'Perl-GLib',
2083 'glib-r' => _('GLib runtime'),
2084 'glib-b' => _('GLib built'),
2085 'gtk2' => 'Perl-GTK2',
2086 'gtk2-r' => _('GTK2 runtime'),
2087 'gtk2-b' => _('GTK2 built'),
2090 foreach (sort keys %$v) {
2091 if (defined $v->{$_}) {
2092 my $label = Gtk2::Label->new ($labels{$_});
2093 my $value = Gtk2::Label->new ('<b>' . $v->{$_} . '</b>');
2094 $label->set_alignment (0, 0.5);
2095 $value->set_alignment (0, 0.5);
2096 $value->set_use_markup (TRUE);
2097 $t0->attach ($label, 0, 1, $row, $row + 1, 'fill', 'shrink', 8, 6);
2098 $t0->attach ($value, 1, 2, $row, $row + 1, 'fill', 'shrink', 8, 6);
2102 my $t1 = Gtk2::Table->new (2, 2, FALSE);
2103 my @lbl = map { $_->set_alignment (0, 0.5); $_ } (
2104 Gtk2::Label->new (_('Binary')),
2105 Gtk2::Label->new (_('Configuration'))
2107 my $cfgv = $CONFIGDATA->{'Common'}{'config_version'};
2109 my @val = map { $_->set_alignment (0, 0.5); $_->set_use_markup (TRUE); $_ } (
2110 Gtk2::Label->new ('<b>' . $CLAWSV . '</b>'),
2111 Gtk2::Label->new ('<b>' . $cfgv . '</b>')
2113 for (my $i = 0; $i <= $#lbl; ++$i) {
2114 $t1->attach ($lbl[$i], 0, 1, $i, $i + 1, 'fill', 'shrink', 8, 6);
2115 $t1->attach ($val[$i], 1, 2, $i, $i + 1, 'fill', 'shrink', 8, 6);
2117 return new_vbox_pack (
2118 new_subpage_frame ($t0, _('Library versions'), 'not-packed'),
2119 new_subpage_frame ($t1, _('Claws Mail versions'), 'not-packed'));
2123 sub get_toolkit_versions {
2125 $versions{'glib'} = $Glib::VERSION;
2126 # version info stuff appeared in 1.040
2127 if ($Glib::VERSION >= 1.040) {
2128 $versions{'glib-b'} = join('.', Glib->GET_VERSION_INFO);
2129 $versions{'glib-r'} = join('.',
2130 &Glib::major_version, &Glib::minor_version, &Glib::micro_version);
2132 $versions{'gtk2'} = $Gtk2::VERSION;
2133 if ($Gtk2::VERSION >= 1.040) {
2134 $versions{'gtk2-b'} = join('.', Gtk2->GET_VERSION_INFO);
2135 $versions{'gtk2-r'} = join('.',
2136 &Gtk2::major_version, &Gtk2::minor_version, &Gtk2::micro_version);
2141 sub print_version() {
2142 print $xl::s{about_title} . "\n";
2143 print $xl::s{about_version} . " $VERSION\n";
2144 my $v = get_toolkit_versions ();
2145 if ($v->{'glib-b'}) {
2146 print _("Perl-GLib version {glibv}, built for {glibb}, running with {glibr}.",
2147 glibv => $v->{'glib'},
2148 glibb => $v->{'glib-b'},
2149 glibr => $v->{'glib-r'});
2151 print _("Perl-GLib version {glibv}.", glibv => $v->{'glib'});
2154 if ($v->{'gtk2-b'}) {
2155 print _("Perl-GTK2 version {gtkv}, built for {gtkb}, running with {gtkr}.",
2156 gtkv => $v->{'gtk2'},
2157 gtkb => $v->{'gtk2-b'},
2158 gtkr => $v->{'gtk2-r'});
2160 print _("Perl-GTK2 version {gtkv}.", gtkv => $v->{'gtk2'});
2163 my $clawsver = ($CLAWSV eq "") ?
2164 _("Claws Mail was not found!") :
2165 _("Claws Mail returned version {cmv}.", cmv => $CLAWSV);
2166 print $clawsver . "\n";
2169 # the command line help
2171 my $line = '-' x length ($xl::s{about_title});
2173 say $xl::s{about_title};
2177 _(" clawsker [options]"),
2179 _(" -a|--alternate-config-dir <dir> Uses <dir> as Claws Mail configuration."),
2180 _(" -b|--verbose More messages on standard output."),
2181 _(" -c|--clawsrc <file> Uses <file> as full resource name."),
2182 _(" -h|--help Prints this help screen and exits."),
2183 _(" -r|--read-only Disables writing changes to disk."),
2184 _(" -v|--version Prints version information and exits.")
2186 foreach (@help) { say $_ }
2189 sub parse_command_line {
2191 $CLAWSV = get_claws_version ();
2193 GetOptions('h|help' => sub { print_help (); $cont = FALSE },
2194 'v|version' => sub { print_version (); $cont = FALSE },
2195 'b|verbose' => sub { $VERBOSE = TRUE },
2196 'r|read-only' => sub { $READONLY = TRUE },
2197 'u|use-claws-version=s' => \&opt_use_claws_version,
2198 'a|alternate-config-dir=s' => \&opt_alternate_config_dir,
2199 'c|clawsrc=s' => \&opt_clawsrc)
2200 or die _("try -h or --help for syntax.\n");
2203 my $msg = _("Error in options: {msg}\n", msg => $@);
2204 if (defined $ENV{'DISPLAY'} and $ENV{'DISPLAY'} ne '') {
2205 eval { Gtk2->init };
2206 error_dialog ($msg) unless $@;
2213 sub opt_use_claws_version {
2214 my ($name, $value) = @_;
2215 die _("Error: {opt} requires a dotted numeric value argument\n", opt => $name)
2216 unless ($value =~ /^[\d\.]+$/);
2220 sub opt_alternate_config_dir {
2221 my ($name, $value) = @_;
2222 die _("Error: '{dir}' is not a directory or does not exist\n", dir => $value)
2224 $CONFIGDIR = $value;
2225 $CONFIGDIR .= "/" unless ($CONFIGDIR =~ /.*\/$/);
2226 $ALTCONFIGDIR = TRUE;
2230 my ($name, $value) = @_;
2231 die _("Error: '{value}' is not a file or does not exist\n", value => $value)
2233 set_rc_filename ($value);
2236 # update the hidden preferences status from loaded values
2237 sub init_hidden_preferences {
2238 foreach my $hash (\%pr::beh, \%pr::col, \%pr::gui, \%pr::oth, \%pr::win) {
2239 foreach my $key (keys %$hash) {
2240 $HPVALUE{${$hash}{$key}[NAME]} = $PREFS{${$hash}{$key}[NAME]};
2243 foreach my $akey (keys %ACPREFS) {
2244 foreach my $key (keys %pr::acc) {
2245 my $pname = $pr::acc{$key}[NAME];
2246 $ACHPVALUE{$akey}{$pname} = $ACPREFS{$akey}{$pname};
2249 foreach my $key (keys %pr::plu) {
2250 my $plugin = $pr::plu{$key}[PLUGIN];
2251 my $pname = $pr::plu{$key}[NAME];
2252 if (defined $PLPREFS{$plugin}) {
2253 $PLHPVALUE{$plugin}{$pname} = $PLPREFS{$plugin}{$pname};
2259 # generic load/save resource files
2265 open (RCF, '<:encoding(utf8)', $rc)
2266 or die _("Error: opening '{file}' for reading", file => $rc) . ": $!\n";
2267 my $section = '_'; # default unnamed section
2272 if (/^\[([^\]]+)\]$/) { # new section
2274 die _("Error: duplicate section '{sect}' in resource file '{file}'\n",
2275 sect => $section, file => $rc) if ($data{$section});
2276 $data{$section} = {};
2277 $meta{$section}{'#'} = $line;
2279 elsif (/^([0-9a-z_]+)=(.*)$/) { # key=value
2280 $data{$section}{$1} = $2;
2281 $meta{$section}{$1} = $line;
2283 elsif (/^(.*)$/) { # lone value
2284 push (@{$data{$section}{'_'}}, $1);
2288 return (\%data, \%meta);
2292 my ($rc, $data, $meta) = @_;
2293 open (RCF, '>:utf8', $rc)
2294 or die _("Error: opening '{file}' for writing", file => $rc) . ": $!\n";
2295 my @sections = keys %$data;
2296 if (defined $meta) {
2298 $meta->{$a}{'#'} <=> $meta->{$b}{'#'}
2301 foreach my $section (@sections) {
2302 say RCF "[$section]";
2303 if (ref ($data->{$section}{'_'}) eq 'ARRAY') {
2304 foreach my $val (@{$data->{$section}{'_'}}) {
2308 my @keys = keys %{$data->{$section}};
2309 if (defined $meta) {
2311 $meta->{$section}{$a} <=> $meta->{$section}{$b}
2314 foreach my $key (@keys) {
2315 my $val = $data->{$section}{$key};
2316 say RCF "$key=$val";
2324 # load current status from disc
2325 sub load_rc_preferences {
2326 my $rc = get_rc_filename ();
2327 log_message ("Loading preferences from $rc\n");
2328 return FALSE unless check_rc_file ($rc);
2329 ($CONFIGDATA, $CONFIGMETA) = load_resource ($rc);
2330 foreach (keys %{$CONFIGDATA->{'Common'}}) {
2331 $PREFS{$_} = $CONFIGDATA->{'Common'}{$_};
2333 foreach my $plugin (@PLUGINS) {
2334 if (defined $CONFIGDATA->{$plugin}) {
2335 push (@AVPLUGINS, $plugin);
2336 foreach (keys %{$CONFIGDATA->{$plugin}}) {
2337 $PLPREFS{$plugin}{$_} = $CONFIGDATA->{$plugin}{$_};
2344 sub load_ac_preferences {
2345 my $rc = get_ac_rc_filename ();
2346 log_message ("Loading account preferences from $rc\n");
2347 return FALSE unless check_rc_file ($rc);
2348 ($ACCOUNTDATA, $ACCOUNTMETA) = load_resource ($rc);
2349 foreach my $asect (keys %$ACCOUNTDATA) {
2350 if ($asect =~ /^Account: (\d+)$/) {
2351 foreach (keys %{$ACCOUNTDATA->{$asect}}) {
2352 $ACPREFS{$1}{$_} = $ACCOUNTDATA->{$asect}{$_};
2359 sub load_preferences {
2360 return FALSE unless check_claws_not_running ();
2361 return (load_rc_preferences () and load_ac_preferences ());
2364 # save current preferences to disc
2365 sub save_preferences {
2366 my $rc = get_rc_filename ();
2367 log_message ("Saving preferences to $rc\n");
2368 return FALSE unless check_rc_file ($rc);
2369 return FALSE unless check_claws_not_running ();
2370 my $rcbak = "$rc.backup";
2371 rename ($rc, $rcbak);
2372 foreach (keys %PREFS) {
2373 if (defined $HPVALUE{$_}) {
2374 $CONFIGDATA->{'Common'}{$_} = $HPVALUE{$_};
2377 foreach my $plugin (@AVPLUGINS) {
2378 foreach (keys %{$CONFIGDATA->{$plugin}}) {
2379 if (defined $PLHPVALUE{$plugin}{$_}) {
2380 $CONFIGDATA->{$plugin}{$_} = $PLHPVALUE{$plugin}{$_};
2384 save_resource ($rc, $CONFIGDATA, $CONFIGMETA);
2388 sub save_ac_preferences {
2389 my $rc = get_ac_rc_filename ();
2390 log_message ("Saving account preferences to $rc\n");
2391 return FALSE unless check_rc_file ($rc);
2392 return FALSE unless check_claws_not_running ();
2393 my $rcbak = "$rc.backup";
2394 rename ($rc, $rcbak);
2395 foreach my $asect (keys %$ACCOUNTDATA) {
2396 if ($asect =~ /^Account: (\d+)$/) {
2397 foreach (keys %{$ACCOUNTDATA->{$asect}}) {
2398 if (defined $ACHPVALUE{$1}{$_}) {
2399 $ACCOUNTDATA->{$asect}{$_} = $ACHPVALUE{$1}{$_};
2404 save_resource ($rc, $ACCOUNTDATA, $ACCOUNTMETA);
2410 my $nb = Gtk2::Notebook->new;
2412 $nb->append_page (new_behaviour_page (), $xl::s{tab_behaviour});
2413 $nb->append_page (new_colours_page (), $xl::s{tab_colours});
2414 $nb->append_page (new_gui_page (), $xl::s{tab_gui});
2415 $nb->append_page (new_other_page (), $xl::s{tab_other});
2416 $nb->append_page (new_winpos_page (), $xl::s{tab_winpos});
2417 $nb->append_page (new_accounts_page (), $xl::s{tab_accounts});
2418 $nb->append_page (new_plugins_page (), $xl::s{tab_plugins});
2419 $nb->append_page (new_info_page (), $xl::s{tab_info});
2424 # create an about dialog
2425 sub new_about_dialog {
2427 my $title = $xl::s{about_title};
2428 my $lic = $xl::s{about_license};
2429 my $vers = $xl::s{about_version} . " $VERSION";
2431 "This program is free software: you can redistribute it and/or modify
2432 it under the terms of the GNU General Public License as published by
2433 the Free Software Foundation, either version 3 of the License, or
2434 (at your option) any later version.
2436 This program is distributed in the hope that it will be useful,
2437 but WITHOUT ANY WARRANTY; without even the implied warranty of
2438 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2439 GNU General Public License for more details.
2441 You should have received a copy of the GNU General Public License
2442 along with this program. If not, see <http://www.gnu.org/licenses/>.";
2443 my $year = "2007-2016";
2444 my $holder = "Ricardo Mones <ricardo\@mones.org>";
2445 my $url = "http://www.claws-mail.org/clawsker.php";
2447 my $dialog = Gtk2::MessageDialog->new_with_markup ($parent,
2448 [qw/modal destroy-with-parent/],
2450 "<span size=\"x-large\" weight=\"bold\">$title</span>\n"
2451 . "<span size=\"large\">$vers</span>\n\n"
2452 . "<span color=\"blue\" size=\"large\">$url</span>\n\n"
2453 . "<span>Copyright $year by $holder</span>\n\n"
2454 . "<span size=\"large\">$lic</span>\n\n"
2455 . "<span size=\"small\">$license</span>");
2456 $dialog->set_title ($xl::s{about});
2457 if (Gtk2->CHECK_VERSION (2, 10, 0)) {
2458 my @icons = get_app_icons ();
2459 my $image = Gtk2::Image->new_from_pixbuf ($icons[-1]);
2461 $image->set_alignment (0, 0);
2462 $dialog->set_image ($image);
2468 # create buttons box
2469 sub new_button_box {
2470 my ($parent, $adlg) = @_;
2471 my $b_about = Gtk2::Button->new_from_stock ('gtk-about');
2472 my $b_exit = Gtk2::Button->new_from_stock ('gtk-quit');
2473 my $b_apply = Gtk2::Button->new_from_stock ('gtk-apply');
2474 # disable button until is really implemented
2475 # my $b_undo = Gtk2::Button->new_from_stock ('gtk-undo');
2476 my $hbox = Gtk2::HBox->new (FALSE, 5);
2478 $b_exit->signal_connect (clicked => sub { Gtk2->main_quit });
2479 $b_apply->set_sensitive (not $READONLY);
2480 $b_apply->signal_connect (clicked => sub {
2481 save_preferences ($parent);
2482 save_ac_preferences ($parent);
2484 # $b_undo->signal_connect (clicked => sub { undo_current_changes });
2485 $b_about->signal_connect (clicked => sub { $adlg->run; $adlg->hide });
2487 $hbox->pack_end ($b_apply, FALSE, FALSE, 0);
2488 $hbox->pack_end ($b_exit, FALSE, FALSE, 0);
2489 # $hbox->pack_end ($b_undo, FALSE, FALSE, 0);
2490 $hbox->pack_start ($b_about, FALSE, FALSE, 0);
2496 return @APPICONS if (@APPICONS);
2498 if (-d $DATADIR) { # installed
2499 my $dir = $DATADIR . '/icons/hicolor';
2501 join ('/', ($dir, $_ . 'x' . $_, 'apps', $NAME . '.png'))
2503 } else { # unpacked tarball or git clone
2505 join ('/', ('./icons', $NAME . '-' . $_ . '.png'));
2510 $icon = Gtk2::Gdk::Pixbuf->new_from_file($_) if (-f $_);
2511 push @APPICONS, $icon if ($icon);
2517 exit unless parse_command_line ();
2519 $main_window = Gtk2::Window->new ('toplevel');
2520 exit unless load_preferences ();
2521 exit unless init_hidden_preferences ();
2523 my $box = Gtk2::VBox->new (FALSE, 5);
2524 $box->set_border_width(3);
2525 my $about = new_about_dialog ();
2526 $box->pack_start (new_notebook (), FALSE, FALSE, 0);
2527 $box->pack_end (new_button_box ($main_window, $about), FALSE, FALSE, 0);
2528 $main_window->signal_connect (delete_event => sub { Gtk2->main_quit });
2529 $main_window->set_title ($xl::s{win_title});
2530 $main_window->set_icon_list (get_app_icons ());
2531 $main_window->add ($box);
2532 $main_window->show_all;