3 # Clawsker :: A Claws Mail Tweaker
8 use Glib qw(TRUE FALSE);
10 use POSIX qw(setlocale);
13 my $NAME = 'clawsker';
14 my $PREFIX = '@PREFIX@';
15 my $LIBDIR = '@LIBDIR@';
16 my $VERSION = '@VERSION@';
19 my $main_window = undef;
21 my $locale = (defined($ENV{LC_MESSAGES}) ? $ENV{LC_MESSAGES} : $ENV{LANG});
22 $locale = "C" unless defined($locale);
23 setlocale (LC_ALL, $locale);
24 bindtextdomain ($NAME, sprintf ('%s/share/locale', $PREFIX));
27 my $SHOWHINTS = FALSE;
28 $SHOWHINTS = TRUE if ($Gtk2::VERSION >= 1.040 and Gtk2->CHECK_VERSION (2, 12, 0));
33 my $xla = gettext ($str);
34 if (scalar(keys(%par)) > 0) {
35 foreach my $key (keys %par) {
36 $xla =~ s/\{$key\}/$par{$key}/g;
44 win_title => _('Claws Mail Hidden Preferences'),
45 about => _('About...'),
46 about_title => _('Clawsker :: A Claws Mail Tweaker'),
47 about_license => _('License:'),
48 about_version => _('Version:'),
50 tab_colours => _('Colours'),
51 tab_behaviour => _('Behaviour'),
53 tab_other => _('Other'),
54 tab_winpos => _('Windows'),
56 ab_frame => _('Addressbook'),
57 mem_frame => _('Memory'),
58 msgview_frame => _('Message view'),
59 log_frame => _('Log window'),
60 dnd_frame => _('Drag \'n\' drop'),
61 ssl_frame => _('Secure Sockets Layer'),
62 msgs_frame => _('Messages'),
63 stripes_frame => _('Coloured stripes'),
64 sbar_frame => _('Scroll bars'),
65 mlist_frame => _('Message List'),
66 netm_frame => _('NetworkManager'),
68 l_oth_use_dlg => _('Use detached address book edit dialogue'),
69 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.'),
70 l_oth_max_use => _('Maximum memory for message cache (kB)'),
71 h_oth_max_use => _('The maximum amount of memory to use to cache messages, in kilobytes.'),
72 l_oth_min_time => _('Minimun time for cache elements (minutes)'),
73 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.'),
74 l_oth_use_netm => _('Use NetworkManager'),
75 h_oth_use_netm => _('Use NetworkManager to switch offline automatically.'),
77 l_gui_b_unread => _('Show unread messages with bold font'),
78 h_gui_b_unread => _('Show unread messages in the Message List using a bold font.'),
79 l_gui_no_markup => _('Don\'t use markup in compose window'),
80 h_gui_no_markup => _('Don\'t use bold and italic text in Compose dialogue\'s account selector.'),
81 l_gui_dot_lines => _('Use dotted lines in tree view components'),
82 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.'),
83 l_gui_h_scroll => _('Enable horizontal scrollbar'),
84 h_gui_h_scroll => _('Enable the horizontal scrollbar in the Message List.'),
85 l_gui_swp_from => _('Display To column instead From column in Sent folder'),
86 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.'),
87 l_gui_v_scroll => _('Folder List scrollbar behaviour'),
88 h_gui_v_scroll => _('Specify the policy of vertical scrollbar of Folder List: show always, automatic or hide always.'),
89 l_gui_v_scroll_show => _('Show always'),
90 l_gui_v_scroll_auto => _('Automatic'),
91 l_gui_v_scroll_hide => _('Hide always'),
92 l_gui_strip_off => _('Coloured lines contrast'),
93 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.'),
94 l_gui_cursor_v => _('Show Cursor in message view'),
95 h_gui_cursor_v => _('Display the cursor in the message view.'),
96 l_gui_toolbar_d => _('Detachable toolbars'),
97 h_gui_toolbar_d => _('Show handles in the toolbars.'),
98 l_gui_strip_all => _('Use stripes in all tree view components'),
99 h_gui_strip_all => _('Enable alternately coloured lines in all tree view components.'),
100 l_gui_strip_sum => _('Use stripes in Folder List and Message List'),
101 h_gui_strip_sum => _('Enable alternately coloured lines in Message list and Folder list.'),
102 l_gui_two_line_v => _('2 lines per Message List item in 3-column layout'),
103 h_gui_two_line_v => _('Spread Message List information over two lines when using the three column mode.'),
104 l_gui_margin_co => _('Show compose margin'),
105 h_gui_margin_co => _('Shows a small margin in the compose view.'),
107 l_beh_hover_t => _('Drag \'n\' drop hover timeout (ms)'),
108 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.'),
109 l_beh_dangerous => _('Don\'t confirm deletions (dangerous!)'),
110 h_beh_dangerous => _('Don\'t ask for confirmation before definitive deletion of emails.'),
111 l_beh_flowed => _('Respect format=flowed in messages'),
112 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.'),
113 l_beh_parts_rw => _('Allow writable temporary files'),
114 h_beh_parts_rw => _('Saves temporary files when opening attachment with write bit set.'),
115 l_beh_skip_ssl => _('Don\'t check SSL certificates'),
116 h_beh_skip_ssl => _('Disables the verification of SSL certificates.'),
117 l_beh_up_step => _('Progress bar update step (items)'),
118 h_beh_up_step => _('Update stepping in progress bars.'),
119 l_beh_thread_a => _('Maximum age when threading by subject (days)'),
120 h_beh_thread_a => _('Number of days to include a message in a thread when using "Thread using subject in addition to standard headers".'),
121 l_beh_unsafe_ssl => _('Allow unsafe SSL certificates'),
122 h_beh_unsafe_ssl => _('Allows Claws Mail to remember multiple SSL certificates for a given server/port.'),
123 l_beh_use_utf8 => _('Force UTF-8 for broken mails'),
124 h_beh_use_utf8 => _('Use UTF-8 encoding for broken mails instead of current locale.'),
125 l_beh_warn_dnd => _('Warn on drag \'n\' drop'),
126 h_beh_warn_dnd => _('Display a confirmation dialogue on drag \'n\' drop of folders.'),
127 l_beh_out_ascii => _('Ougoing messages fallback to ASCII'),
128 h_beh_out_ascii => _('If content allows, ASCII will be used to encode outgoing messages, otherwise the user-defined encoding is enforced always.'),
129 l_beh_pp_unsel => _('Primary paste unselects selection'),
130 h_beh_pp_unsel => _('Controls how pasting using middle-click changes the selected text and insertion point.'),
132 l_col_emphasis => _('X-Mailer header'),
133 h_col_emphasis => _('The colour used for the X-Mailer line when its value is Claws Mail.'),
134 l_col_log_err => _('Error messages'),
135 h_col_log_err => _('Colour for error messages in log window.'),
136 l_col_log_in => _('Server messages'),
137 h_col_log_in => _('Colour for messages received from servers in log window.'),
138 l_col_log_msg => _('Standard messages'),
139 h_col_log_msg => _('Colour for messages in log window.'),
140 l_col_log_out => _('Client messages'),
141 h_col_log_out => _('Colour for messages sent to servers in log window.'),
142 l_col_log_warn => _('Warnings'),
143 h_col_log_warn => _('Colour for warning messages in log window.'),
145 l_win_x => _('X position'),
146 h_win_x => _('X coordinate for window\'s top-left corner.'),
147 l_win_y => _('Y position'),
148 h_win_y => _('Y coordinate for window\'s top-left corner.'),
149 l_win_w => _('Width'),
150 h_win_w => _('Window\'s width in pixels.'),
151 l_win_h => _('Height'),
152 h_win_h => _('Window\'s height in pixels.'),
154 l_win_main_mx => _('Maximized'),
155 h_win_main_mx => _('Changes window maximized status.'),
156 l_win_main_fs => _('Full-screen'),
157 h_win_main_fs => _('Changes full screen status.'),
159 e_error => _('Error: '),
160 e_noclawsrc => _('resource file for Claws Mail was not found.'),
161 e_running => _('seems Claws Mail is currently running, close it first.'),
162 e_requireddir => _('option requires a directory name.'),
163 e_requiredfile => _('option requires a file name.'),
164 e_notadir => _('specified name is not a directory or does not exist.'),
165 e_notafile => _('specified name is not a file or does not exist.'),
168 # all preferences read by load_preferences
170 # values of all preferences handled by clawsker
172 # default config dir and file name
173 my $ALTCONFIGDIR = FALSE;
174 my $CONFIGDIR = $ENV{HOME} . '/.claws-mail/';
175 my $CONFIGRC = 'clawsrc';
177 # index constants for preference arrays
178 use constant NAME => 0; # the name on the rc file
179 use constant LABEL => 1; # the label on the GUI
180 use constant DESC => 2; # the description for the hint/help
181 use constant TYPE => 3; # data type: bool, int, float, string, color
182 use constant CMVER => 4; # lowest Claws Mail version the feature exists
183 use constant CMDEF => 5; # default value for the preference in Claws Mail
184 use constant GUI => 6; # GUI element
186 # constants for GUI spacing
187 use constant HBOX_SPC => 5;
188 use constant FRAME_SPC => 2;
189 use constant PAGE_SPC => 5;
193 sub version_greater_or_equal() {
194 my ($version, $refvers) = @_;
195 my @version = split (/\./, $version);
196 my @refvers = split (/\./, $refvers);
197 while ($#version < $#refvers) {
198 push (@version, '0');
201 while (($idx <= $#refvers)
202 and (int ($version[$idx]) == int ($refvers[$idx]))) {
205 return TRUE if (($idx > $#refvers)
206 or (int ($version[$idx]) >= int ($refvers[$idx])));
210 sub get_claws_version() {
215 foreach my $bin (@cmbin) {
220 return "" unless ($_); # not installed
223 my @fver = split (/ /);
224 die "Invalid version string" unless ($fver[2] eq "version");
225 my @ver = split (/\./, $fver[3]);
228 if ($ver[2] =~ /(\d+)cvs(\d+)/) {
237 # data handlers and auxiliar functions
239 sub handle_bool_value {
240 my ($widget, $event, $dataref) = @_;
241 $$dataref = ($widget->get_active ())? '1': '0';
244 sub handle_int_value {
245 my ($widget, $event, $dataref) = @_;
246 $_ = $widget->get_text ();
251 $widget->set_text ($_);
254 $widget->set_text ($$dataref);
258 sub handle_string_value {
259 my ($widget, $event, $dataref) = @_;
260 $$dataref = $widget->get_text ();
263 sub gdk_color_from_str {
265 my ($rr, $gg, $bb) = (0, 0 ,0);
267 if (/\#([A-F0-9][A-F0-9])([A-F0-9][A-F0-9])([A-F0-9][A-F0-9])/) {
272 my $color = Gtk2::Gdk::Color->new ($rr, $gg, $bb);
276 sub str_from_gdk_color {
278 my $rr = $color->red / 256;
279 my $gg = $color->green / 256;
280 my $bb = $color->blue / 256;
281 my $str = sprintf ("#%.2x%.2x%.2x", $rr, $gg, $bb);
285 sub handle_color_value {
286 my ($widget, $event, $dataref) = @_;
287 my $newcol = $widget->get_color;
288 $$dataref = &str_from_gdk_color ($newcol);
291 sub handle_selection_value {
292 my ($widget, $event, $dataref) = @_;
293 $$dataref = $widget->get_active;
296 sub get_rc_filename {
297 return $CONFIGDIR . $CONFIGRC;
300 sub set_rc_filename {
302 my @parts = split ('/', $fullname);
303 $CONFIGRC = $parts[$#parts];
304 $parts[$#parts] = '';
305 $CONFIGDIR = join ('/', @parts);
309 my ($mesg, $fatal) = @_;
310 if (defined($fatal) && $fatal eq 'die') {
311 die "$NAME: $mesg\n";
314 print "$NAME: $mesg\n";
320 my $markup = "<span weight=\"bold\" size=\"large\">" . $emsg . "</span>";
321 my $errordlg = Gtk2::MessageDialog->new_with_markup ($main_window, 'modal', 'error', 'cancel', $markup);
322 $errordlg->set_title (_('Error message'));
327 sub check_claws_not_running() {
328 my $socket = (not $ALTCONFIGDIR)? "/tmp/": $CONFIGDIR;
329 $socket .= "claws-mail-$<";
331 my $emsg = "$xl::s{e_error}$xl::s{e_running}";
333 error_dialog ($emsg);
339 sub check_rc_file() {
341 (defined($rcfile) && -f $rcfile) or do {
342 my $emsg = "$xl::s{e_error}$xl::s{e_noclawsrc}\n";
344 error_dialog ($emsg);
350 sub set_widget_hint() {
352 my ($wdgt, $hint) = @_;
353 $wdgt->set_tooltip_text ($hint);
354 $wdgt->set_has_tooltip (TRUE);
358 sub set_widget_sens() {
359 my ($wdgt, $minver) = @_;
360 $wdgt->set_sensitive (&version_greater_or_equal ($CLAWSV, $minver));
363 # graphic element creation
365 sub new_check_button_for {
366 my ($hash, $key) = @_;
367 my $name = $$hash{$key}[NAME];
368 my $label = $$hash{$key}[LABEL];
370 my $hbox = Gtk2::HBox->new (FALSE, 5);
371 my $cb = Gtk2::CheckButton->new ($label);
372 $$hash{$key}[GUI] = $cb;
373 if (defined ($HPVALUE{$name})) {
374 $cb->set_active ($HPVALUE{$name} eq '1');
376 $cb->signal_connect (clicked => sub {
378 &handle_bool_value($w, $e, \$HPVALUE{$name});
380 &set_widget_hint ($cb, $$hash{$key}[DESC]);
381 &set_widget_sens ($cb, $$hash{$key}[CMVER]);
382 $hbox->pack_start ($cb, FALSE, FALSE, HBOX_SPC);
387 sub new_text_box_for_int {
388 my ($hash, $key) = @_;
389 my $name = $$hash{$key}[NAME];
390 my $label = $$hash{$key}[LABEL];
391 my @type = split (/,/, $$hash{$key}[TYPE]);
392 push (@type, 0), push (@type, 10000) unless ($#type > 0);
394 my $hbox = Gtk2::HBox->new (FALSE, 5);
395 my $glabel = Gtk2::Label->new ($label);
396 my $pagei = int (($type[2] - $type[1]) / 10);
397 my $gentry = Gtk2::SpinButton->new_with_range ($type[1], $type[2], $pagei);
398 $gentry->set_numeric (TRUE);
399 $$hash{$key}[GUI] = $gentry;
400 $gentry->signal_connect('value-changed' => sub {
402 &handle_int_value($w, $e, \$HPVALUE{$name});
404 &set_widget_hint ($gentry, $$hash{$key}[DESC]);
405 &set_widget_sens ($gentry, $$hash{$key}[CMVER]);
406 $glabel->set_sensitive ($gentry->sensitive);
407 $hbox->pack_start ($glabel, FALSE, FALSE, HBOX_SPC);
408 $hbox->pack_start ($gentry, FALSE, FALSE, HBOX_SPC);
413 sub new_color_button_for {
414 my ($hash, $key) = @_;
415 my $name = $$hash{$key}[NAME];
416 my $label = $$hash{$key}[LABEL];
418 my $col = &gdk_color_from_str ($HPVALUE{$name});
419 my $hbox = Gtk2::HBox->new (FALSE, 5);
420 my $glabel = Gtk2::Label->new ($label);
421 my $button = Gtk2::ColorButton->new_with_color ($col);
422 $$hash{$key}[GUI] = $button;
423 $button->set_title ($label);
424 $button->set_relief ('none');
425 $button->signal_connect ('color-set' => sub {
427 &handle_color_value($w, $e, \$HPVALUE{$name});
429 &set_widget_hint ($button, $$hash{$key}[DESC]);
430 &set_widget_sens ($button, $$hash{$key}[CMVER]);
431 $glabel->set_sensitive ($button->sensitive);
432 $hbox->pack_start ($button, FALSE, FALSE, HBOX_SPC);
433 $hbox->pack_start ($glabel, FALSE, FALSE, HBOX_SPC);
438 sub new_selection_box_for {
439 my ($hash, $key) = @_;
440 my $name = $$hash{$key}[NAME];
441 my $label = $$hash{$key}[LABEL];
443 my $hbox = Gtk2::HBox->new (FALSE, 5);
444 my $glabel = Gtk2::Label->new ($label);
445 my $combo = Gtk2::ComboBox->new_text;
446 $$hash{$key}[GUI] = $combo;
447 my @options = split (';', $$hash{$key}[TYPE]);
448 foreach my $opt (@options) {
449 my ($index, $textkey) = split ('=', $opt);
450 $combo->insert_text ($index, $xl::s{$textkey});
452 $combo->signal_connect ('changed' => sub {
454 &handle_selection_value($w, $e, \$HPVALUE{$name});
456 $combo->set_active ($HPVALUE{$name});
457 &set_widget_hint ($combo, $$hash{$key}[DESC]);
458 &set_widget_sens ($combo, $$hash{$key}[CMVER]);
459 $glabel->set_sensitive ($combo->sensitive);
460 $hbox->pack_start ($glabel, FALSE, FALSE, HBOX_SPC);
461 $hbox->pack_start ($combo, FALSE, FALSE, HBOX_SPC);
466 # more graphic helpers
468 sub new_hbox_pack() {
469 my $hbox = Gtk2::HBox->new (FALSE, 5);
470 $hbox->set_border_width (PAGE_SPC);
471 foreach my $item (@_) {
472 $hbox->pack_start ($item, FALSE, FALSE, 0);
477 sub new_vbox_pack() {
478 my $vbox = Gtk2::VBox->new (FALSE, 5);
479 $vbox->set_border_width (PAGE_SPC);
480 foreach my $item (@_) {
481 $vbox->pack_start ($item, FALSE, FALSE, 0);
486 sub new_vbox_pack_compact() {
487 my $vbox = Gtk2::VBox->new (FALSE, 0);
488 $vbox->set_border_width (0);
489 foreach my $item (@_) {
490 $vbox->pack_start ($item, FALSE, FALSE, 0);
495 sub new_subpage_frame () {
496 my ($box, $title, $notpacked) = @_;
497 my $frame = Gtk2::Frame->new ($title);
499 return &new_vbox_pack ($frame) unless defined ($notpacked);
503 # preference maps and corresponding page creation subs
505 %pr::oth = ( # other preferences
507 'addressbook_use_editaddress_dialog',
508 $xl::s{l_oth_use_dlg},
509 $xl::s{h_oth_use_dlg},
516 'cache_max_mem_usage',
517 $xl::s{l_oth_max_use},
518 $xl::s{h_oth_max_use},
519 'int,0,262144', # 0 Kb - 256 Mb
525 'cache_min_keep_time',
526 $xl::s{l_oth_min_time},
527 $xl::s{h_oth_min_time},
528 'int,0,120', # 0 minutes - 2 hours
534 'use_networkmanager',
535 $xl::s{l_oth_use_netm},
536 $xl::s{h_oth_use_netm},
544 sub new_other_page() {
545 return &new_vbox_pack (
548 &new_check_button_for(\%pr::oth, 'use_dlg')),
549 $xl::s{ab_frame}, 'not-packed'),
552 &new_text_box_for_int(\%pr::oth, 'max_use'),
553 &new_text_box_for_int(\%pr::oth, 'min_time')),
554 $xl::s{mem_frame}, 'not-packed'),
557 &new_check_button_for(\%pr::oth, 'use_netm')),
558 $xl::s{netm_frame}, 'not-packed')
562 %pr::gui = ( # gui bells and whistles
565 $xl::s{l_gui_b_unread},
566 $xl::s{h_gui_b_unread},
574 $xl::s{l_gui_no_markup},
575 $xl::s{h_gui_no_markup},
582 'enable_dotted_lines',
583 $xl::s{l_gui_dot_lines},
584 $xl::s{h_gui_dot_lines},
592 $xl::s{l_gui_h_scroll},
593 $xl::s{h_gui_h_scroll},
601 $xl::s{l_gui_swp_from},
602 $xl::s{h_gui_swp_from},
609 'folderview_vscrollbar_policy',
610 $xl::s{l_gui_v_scroll},
611 $xl::s{h_gui_v_scroll},
612 '0=l_gui_v_scroll_show;1=l_gui_v_scroll_auto;2=l_gui_v_scroll_hide',
618 'stripes_color_offset',
619 $xl::s{l_gui_strip_off},
620 $xl::s{h_gui_strip_off},
621 'int,0,10000', # no idea what this number means
627 'textview_cursor_visible',
628 $xl::s{l_gui_cursor_v},
629 $xl::s{h_gui_cursor_v},
636 'toolbar_detachable',
637 $xl::s{l_gui_toolbar_d},
638 $xl::s{h_gui_toolbar_d},
645 'use_stripes_everywhere',
646 $xl::s{l_gui_strip_all},
647 $xl::s{h_gui_strip_all},
654 'use_stripes_in_summaries',
655 $xl::s{l_gui_strip_sum},
656 $xl::s{h_gui_strip_sum},
664 $xl::s{l_gui_two_line_v},
665 $xl::s{h_gui_two_line_v},
672 'show_compose_margin',
673 $xl::s{l_gui_margin_co},
674 $xl::s{h_gui_margin_co},
683 my $gf = Gtk2::VBox->new (FALSE, 5);
684 $gf->set_border_width (PAGE_SPC);
686 my $cb_no_markup = &new_check_button_for (\%pr::gui, 'no_markup');
687 my $cb_dot_lines = &new_check_button_for (\%pr::gui, 'dot_lines');
688 my $cb_cursor_v = &new_check_button_for (\%pr::gui, 'cursor_v');
689 my $cb_toolbar_d = &new_check_button_for (\%pr::gui, 'toolbar_d');
690 my $cb_two_linev = &new_check_button_for (\%pr::gui, 'two_linev');
691 my $cb_margin_co = &new_check_button_for (\%pr::gui, 'margin_co');
693 $gf->pack_start (&new_subpage_frame (
695 &new_check_button_for (\%pr::gui, 'strip_all'),
696 &new_check_button_for (\%pr::gui, 'strip_sum'),
697 &new_text_box_for_int (\%pr::gui, 'strip_off')),
698 $xl::s{stripes_frame}, 'not-packed'),
699 FALSE, FALSE, FRAME_SPC);
700 $gf->pack_start (&new_subpage_frame (
702 &new_check_button_for (\%pr::gui, 'b_unread'),
703 &new_check_button_for (\%pr::gui, 'swp_from')),
704 $xl::s{mlist_frame}, 'not-packed'),
705 FALSE, FALSE, FRAME_SPC);
706 $gf->pack_start ($cb_no_markup, FALSE, FALSE, 0);
707 $gf->pack_start ($cb_dot_lines, FALSE, FALSE, 0);
708 $gf->pack_start ($cb_cursor_v, FALSE, FALSE, 0);
709 $gf->pack_start ($cb_toolbar_d, FALSE, FALSE, 0);
710 $gf->pack_start ($cb_two_linev, FALSE, FALSE, 0);
711 $gf->pack_start ($cb_margin_co, FALSE, FALSE, 0);
712 $gf->pack_start (&new_subpage_frame (
714 &new_check_button_for (\%pr::gui, 'h_scroll'),
715 &new_selection_box_for (\%pr::gui, 'v_scroll')),
716 $xl::s{sbar_frame}, 'not-packed'),
717 FALSE, FALSE, FRAME_SPC);
722 %pr::beh = ( # tweak some behaviour
725 $xl::s{l_beh_hover_t},
726 $xl::s{h_beh_hover_t},
727 'int,100,3000', # 0.1 seconds - 3 seconds
734 $xl::s{l_beh_dangerous},
735 $xl::s{h_beh_dangerous},
742 'respect_flowed_format',
743 $xl::s{l_beh_flowed},
744 $xl::s{h_beh_flowed},
751 'save_parts_readwrite',
752 $xl::s{l_beh_parts_rw},
753 $xl::s{h_beh_parts_rw},
760 'skip_ssl_cert_check',
761 $xl::s{l_beh_skip_ssl},
762 $xl::s{h_beh_skip_ssl},
769 'statusbar_update_step',
770 $xl::s{l_beh_up_step},
771 $xl::s{h_beh_up_step},
772 'int,1,200', # 1 item - 200 items
778 'thread_by_subject_max_age',
779 $xl::s{l_beh_thread_a},
780 $xl::s{h_beh_thread_a},
781 'int,1,30', # 1 day - 30 days
788 $xl::s{l_beh_unsafe_ssl},
789 $xl::s{h_beh_unsafe_ssl},
796 'utf8_instead_of_locale_for_broken_mail',
797 $xl::s{l_beh_use_utf8},
798 $xl::s{h_beh_use_utf8},
806 $xl::s{l_beh_warn_dnd},
807 $xl::s{h_beh_warn_dnd},
814 'outgoing_fallback_to_ascii',
815 $xl::s{l_beh_out_ascii},
816 $xl::s{h_beh_out_ascii},
823 'primary_paste_unselects',
824 $xl::s{l_beh_pp_unsel},
825 $xl::s{h_beh_pp_unsel},
833 sub new_behaviour_page() {
834 my $bf = Gtk2::VBox->new (FALSE, 5);
835 $bf->set_border_width (PAGE_SPC);
837 my $tb_up_step = &new_text_box_for_int (\%pr::beh, 'up_step');
838 my $tb_thread_a = &new_text_box_for_int (\%pr::beh, 'thread_a');
840 $bf->pack_start (&new_subpage_frame (
842 &new_text_box_for_int (\%pr::beh, 'hover_t'),
843 &new_check_button_for (\%pr::beh, 'warn_dnd')),
844 $xl::s{dnd_frame}, 'not-packed'),
845 FALSE, FALSE, FRAME_SPC);
846 $bf->pack_start (&new_subpage_frame (
848 &new_check_button_for (\%pr::beh, 'skip_ssl'),
849 &new_check_button_for (\%pr::beh, 'unsafe_ssl')),
850 $xl::s{ssl_frame}, 'not-packed'),
851 FALSE, FALSE, FRAME_SPC);
852 $bf->pack_start ($tb_up_step, FALSE, FALSE, 0);
853 $bf->pack_start ($tb_thread_a, FALSE, FALSE, 0);
854 $bf->pack_start (&new_subpage_frame (
856 &new_check_button_for (\%pr::beh, 'flowed'),
857 &new_check_button_for (\%pr::beh, 'parts_rw'),
858 &new_check_button_for (\%pr::beh, 'use_utf8'),
859 &new_check_button_for (\%pr::beh, 'dangerous'),
860 &new_check_button_for (\%pr::beh, 'out_ascii'),
861 &new_check_button_for (\%pr::beh, 'pp_unsel')),
862 $xl::s{msgs_frame}, 'not-packed'),
863 FALSE, FALSE, FRAME_SPC);
868 %pr::col = ( # a variety of colours
871 $xl::s{l_col_emphasis},
872 $xl::s{h_col_emphasis},
880 $xl::s{l_col_log_err},
881 $xl::s{h_col_log_err},
889 $xl::s{l_col_log_in},
890 $xl::s{h_col_log_in},
898 $xl::s{l_col_log_msg},
899 $xl::s{h_col_log_msg},
907 $xl::s{l_col_log_out},
908 $xl::s{h_col_log_out},
916 $xl::s{l_col_log_warn},
917 $xl::s{h_col_log_warn},
925 sub new_colours_page() {
926 return &new_vbox_pack (
929 &new_color_button_for (\%pr::col, 'emphasis')),
930 $xl::s{msgview_frame}, 'not-packed'),
933 &new_color_button_for (\%pr::col, 'log_err'),
934 &new_color_button_for (\%pr::col, 'log_in'),
935 &new_color_button_for (\%pr::col, 'log_msg'),
936 &new_color_button_for (\%pr::col, 'log_out'),
937 &new_color_button_for (\%pr::col, 'log_warn')),
938 $xl::s{log_frame}, 'not-packed')
942 %pr::win = ( # tweak window positions and/or sizes
947 'int,0,3000', # 0 pixels - 3000 pixels
956 'int,0,3000', # 0 pixels - 3000 pixels
965 'int,0,3000', # 0 pixels - 3000 pixels
974 'int,0,3000', # 0 pixels - 3000 pixels
981 $xl::s{l_win_main_mx},
982 $xl::s{h_win_main_mx},
989 'mainwin_fullscreen',
990 $xl::s{l_win_main_fs},
991 $xl::s{h_win_main_fs},
1001 'int,0,3000', # 0 pixels - 3000 pixels
1007 'main_messagewin_y',
1010 'int,0,3000', # 0 pixels - 3000 pixels
1019 'int,0,3000', # 0 pixels - 3000 pixels
1025 'messagewin_height',
1028 'int,0,3000', # 0 pixels - 3000 pixels
1037 'int,0,3000', # 0 pixels - 3000 pixels
1046 'int,0,3000', # 0 pixels - 3000 pixels
1055 'int,0,3000', # 0 pixels - 3000 pixels
1061 'receivewin_height',
1064 'int,0,3000', # 0 pixels - 3000 pixels
1073 'int,0,3000', # 0 pixels - 3000 pixels
1082 'int,0,3000', # 0 pixels - 3000 pixels
1088 'folderitemwin_width',
1091 'int,0,3000', # 0 pixels - 3000 pixels
1097 'folderitemwin_height',
1100 'int,0,3000', # 0 pixels - 3000 pixels
1106 'folderselwin_width',
1109 'int,0,3000', # 0 pixels - 3000 pixels
1115 'folderselwin_height',
1118 'int,0,3000', # 0 pixels - 3000 pixels
1127 'int,0,3000', # 0 pixels - 3000 pixels
1136 'int,0,3000', # 0 pixels - 3000 pixels
1142 'addressbookwin_width',
1145 'int,0,3000', # 0 pixels - 3000 pixels
1151 'addressbookwin_height',
1154 'int,0,3000', # 0 pixels - 3000 pixels
1160 'addressbookeditpersonwin_width',
1163 'int,0,3000', # 0 pixels - 3000 pixels
1169 'addressbookeditpersonwin_height',
1172 'int,0,3000', # 0 pixels - 3000 pixels
1178 'addressbookeditgroupwin_width',
1181 'int,0,3000', # 0 pixels - 3000 pixels
1187 'addressbookeditgroupwin_height',
1190 'int,0,3000', # 0 pixels - 3000 pixels
1196 'addressaddwin_width',
1199 'int,0,3000', # 0 pixels - 3000 pixels
1205 'addressaddwin_height',
1208 'int,0,3000', # 0 pixels - 3000 pixels
1214 'addressbook_folderselwin_width',
1217 'int,0,3000', # 0 pixels - 3000 pixels
1223 'addressbook_folderselwin_height',
1226 'int,0,3000', # 0 pixels - 3000 pixels
1232 'editaccountwin_width',
1235 'int,0,3000', # 0 pixels - 3000 pixels
1241 'editaccountwin_height',
1244 'int,0,3000', # 0 pixels - 3000 pixels
1250 'accountswin_width',
1253 'int,0,3000', # 0 pixels - 3000 pixels
1259 'accountswin_height',
1262 'int,0,3000', # 0 pixels - 3000 pixels
1268 'filteringwin_width',
1271 'int,0,3000', # 0 pixels - 3000 pixels
1277 'filteringwin_height',
1280 'int,0,3000', # 0 pixels - 3000 pixels
1286 'filteringactionwin_width',
1289 'int,0,3000', # 0 pixels - 3000 pixels
1295 'filteringactionwin_height',
1298 'int,0,3000', # 0 pixels - 3000 pixels
1304 'filtering_debugwin_width',
1307 'int,0,3000', # 0 pixels - 3000 pixels
1313 'filtering_debugwin_height',
1316 'int,0,3000', # 0 pixels - 3000 pixels
1325 'int,0,3000', # 0 pixels - 3000 pixels
1331 'matcherwin_height',
1334 'int,0,3000', # 0 pixels - 3000 pixels
1343 'int,0,3000', # 0 pixels - 3000 pixels
1352 'int,0,3000', # 0 pixels - 3000 pixels
1358 'templateswin_width',
1361 'int,0,3000', # 0 pixels - 3000 pixels
1367 'templateswin_height',
1370 'int,0,3000', # 0 pixels - 3000 pixels
1379 'int,0,3000', # 0 pixels - 3000 pixels
1385 'actionswin_height',
1388 'int,0,3000', # 0 pixels - 3000 pixels
1397 'int,0,3000', # 0 pixels - 3000 pixels
1406 'int,0,3000', # 0 pixels - 3000 pixels
1415 'int,0,3000', # 0 pixels - 3000 pixels
1421 'pluginswin_height',
1424 'int,0,3000', # 0 pixels - 3000 pixels
1433 'int,0,3000', # 0 pixels - 3000 pixels
1442 'int,0,3000', # 0 pixels - 3000 pixels
1448 'print_previewwin_width',
1451 'int,0,3000', # 0 pixels - 3000 pixels
1457 'print_previewwin_height',
1460 'int,0,3000', # 0 pixels - 3000 pixels
1467 sub new_winpos_subpage_main() {
1468 return &new_subpage_frame (
1469 &new_vbox_pack_compact (
1471 &new_text_box_for_int (\%pr::win, 'main_x'),
1472 &new_text_box_for_int (\%pr::win, 'main_y')),
1474 &new_text_box_for_int (\%pr::win, 'main_w'),
1475 &new_text_box_for_int (\%pr::win, 'main_h')),
1477 &new_check_button_for (\%pr::win, 'main_fs'),
1478 &new_check_button_for (\%pr::win, 'main_mx'))),
1483 sub new_winpos_subpage_msgs() {
1484 return &new_subpage_frame (
1485 &new_vbox_pack_compact (
1487 &new_text_box_for_int (\%pr::win, 'msgs_x'),
1488 &new_text_box_for_int (\%pr::win, 'msgs_y')),
1490 &new_text_box_for_int (\%pr::win, 'msgs_w'),
1491 &new_text_box_for_int (\%pr::win, 'msgs_h'))),
1496 sub new_winpos_subpage_sendrecv() {
1497 return &new_vbox_pack (
1498 &new_subpage_frame (
1500 &new_text_box_for_int (\%pr::win, 'send_w'),
1501 &new_text_box_for_int (\%pr::win, 'send_h')),
1502 _('Send window'), 'not-packed'),
1503 &new_subpage_frame (
1505 &new_text_box_for_int (\%pr::win, 'recv_w'),
1506 &new_text_box_for_int (\%pr::win, 'recv_h')),
1507 _('Receive window'), 'not-packed')
1511 sub new_winpos_subpage_fold() {
1512 return &new_vbox_pack (
1513 &new_subpage_frame (
1514 &new_vbox_pack_compact (
1516 &new_text_box_for_int (\%pr::win, 'fold_x'),
1517 &new_text_box_for_int (\%pr::win, 'fold_y')),
1519 &new_text_box_for_int (\%pr::win, 'fold_w'),
1520 &new_text_box_for_int (\%pr::win, 'fold_h'))),
1521 _('Folder window'), 'not-packed'),
1522 &new_subpage_frame (
1524 &new_text_box_for_int (\%pr::win, 'fsel_w'),
1525 &new_text_box_for_int (\%pr::win, 'fsel_h')),
1526 _('Folder selection window'), 'not-packed')
1530 sub new_winpos_subpage_addrbook() {
1531 return &new_vbox_pack (
1532 &new_subpage_frame (
1534 &new_text_box_for_int (\%pr::win, 'addr_w'),
1535 &new_text_box_for_int (\%pr::win, 'addr_h')),
1536 _('Addressbook main window'), 'not-packed'),
1537 &new_subpage_frame (
1539 &new_text_box_for_int (\%pr::win, 'adep_w'),
1540 &new_text_box_for_int (\%pr::win, 'adep_h')),
1541 _('Edit person window'), 'not-packed'),
1542 &new_subpage_frame (
1544 &new_text_box_for_int (\%pr::win, 'adeg_w'),
1545 &new_text_box_for_int (\%pr::win, 'adeg_h')),
1546 _('Edit group window'), 'not-packed'),
1547 &new_subpage_frame (
1549 &new_text_box_for_int (\%pr::win, 'adda_w'),
1550 &new_text_box_for_int (\%pr::win, 'adda_h')),
1551 _('Add address window'), 'not-packed'),
1552 &new_subpage_frame (
1554 &new_text_box_for_int (\%pr::win, 'addf_w'),
1555 &new_text_box_for_int (\%pr::win, 'addf_h')),
1556 _('Folder select window'), 'not-packed')
1560 sub new_winpos_subpage_accounts() {
1561 return &new_vbox_pack (
1562 &new_subpage_frame (
1564 &new_text_box_for_int (\%pr::win, 'acco_w'),
1565 &new_text_box_for_int (\%pr::win, 'acco_h')),
1566 _('Accounts window'), 'not-packed'),
1567 &new_subpage_frame (
1569 &new_text_box_for_int (\%pr::win, 'acce_w'),
1570 &new_text_box_for_int (\%pr::win, 'acce_h')),
1571 _('Edit account window'), 'not-packed')
1575 sub new_winpos_subpage_filtering() {
1576 return &new_vbox_pack (
1577 &new_subpage_frame (
1579 &new_text_box_for_int (\%pr::win, 'filt_w'),
1580 &new_text_box_for_int (\%pr::win, 'filt_h')),
1581 _('Filtering window'), 'not-packed'),
1582 &new_subpage_frame (
1584 &new_text_box_for_int (\%pr::win, 'fila_w'),
1585 &new_text_box_for_int (\%pr::win, 'fila_h')),
1586 _('Filtering actions window'), 'not-packed'),
1587 &new_subpage_frame (
1589 &new_text_box_for_int (\%pr::win, 'fild_w'),
1590 &new_text_box_for_int (\%pr::win, 'fild_h')),
1591 _('Filtering debug window'), 'not-packed'),
1592 &new_subpage_frame (
1594 &new_text_box_for_int (\%pr::win, 'matc_w'),
1595 &new_text_box_for_int (\%pr::win, 'matc_h')),
1596 _('Matcher window'), 'not-packed')
1600 sub new_winpos_subpage_prefs() {
1601 return &new_vbox_pack (
1602 &new_subpage_frame (
1604 &new_text_box_for_int (\%pr::win, 'pref_w'),
1605 &new_text_box_for_int (\%pr::win, 'pref_h')),
1606 _('Preferences window'), 'not-packed'),
1607 &new_subpage_frame (
1609 &new_text_box_for_int (\%pr::win, 'temp_w'),
1610 &new_text_box_for_int (\%pr::win, 'temp_h')),
1611 _('Templates window'), 'not-packed'),
1612 &new_subpage_frame (
1614 &new_text_box_for_int (\%pr::win, 'acti_w'),
1615 &new_text_box_for_int (\%pr::win, 'acti_h')),
1616 _('Actions window'), 'not-packed'),
1617 &new_subpage_frame (
1619 &new_text_box_for_int (\%pr::win, 'tags_w'),
1620 &new_text_box_for_int (\%pr::win, 'tags_h')),
1621 _('Tags window'), 'not-packed'),
1622 &new_subpage_frame (
1624 &new_text_box_for_int (\%pr::win, 'plug_w'),
1625 &new_text_box_for_int (\%pr::win, 'plug_h')),
1626 _('Plugins window'), 'not-packed')
1630 sub new_winpos_subpage_misc() {
1631 return &new_vbox_pack (
1632 &new_subpage_frame (
1634 &new_text_box_for_int (\%pr::win, 'logw_w'),
1635 &new_text_box_for_int (\%pr::win, 'logw_h')),
1636 _('Log window'), 'not-packed'),
1637 &new_subpage_frame (
1639 &new_text_box_for_int (\%pr::win, 'prin_w'),
1640 &new_text_box_for_int (\%pr::win, 'prin_h')),
1641 _('Print preview window'), 'not-packed'),
1642 &new_subpage_frame (
1644 &new_text_box_for_int (\%pr::win, 'sour_w'),
1645 &new_text_box_for_int (\%pr::win, 'sour_h')),
1646 _('View source window'), 'not-packed')
1650 sub new_winpos_page() {
1651 my $winbook = Gtk2::Notebook->new;
1652 $winbook->set_tab_pos ('right');
1653 $winbook->append_page (&new_winpos_subpage_main, _('Main'));
1654 $winbook->append_page (&new_winpos_subpage_msgs, _('Message'));
1655 $winbook->append_page (&new_winpos_subpage_sendrecv, _('Send/Receive'));
1656 $winbook->append_page (&new_winpos_subpage_fold, _('Folder'));
1657 $winbook->append_page (&new_winpos_subpage_addrbook, _('Addressbook'));
1658 $winbook->append_page (&new_winpos_subpage_accounts, _('Accounts'));
1659 $winbook->append_page (&new_winpos_subpage_filtering, _('Filtering'));
1660 $winbook->append_page (&new_winpos_subpage_prefs, _('Preferences'));
1661 $winbook->append_page (&new_winpos_subpage_misc, _('Other'));
1666 sub print_version() {
1667 print $xl::s{about_title} . "\n";
1668 print $xl::s{about_version} . " $VERSION\n";
1669 print "Perl-GLib " . $Glib::VERSION;
1670 # version info stuff appeared in 1.040
1671 if ($Glib::VERSION >= 1.040) {
1672 print _(", built for ") . join(".", Glib->GET_VERSION_INFO)
1673 . _(", running with ") . join(".", &Glib::major_version,
1674 &Glib::minor_version, &Glib::micro_version);
1677 print "Perl-GTK2 " . $Gtk2::VERSION;
1678 if ($Gtk2::VERSION >= 1.040) {
1679 print _(", built for ") . join(".", Gtk2->GET_VERSION_INFO)
1680 . _(", running with ") . join(".", &Gtk2::major_version,
1681 &Gtk2::minor_version, &Gtk2::micro_version);
1684 my $clawsver = ($CLAWSV eq "") ?
1685 _("was not found!") :
1686 (_("returned version ") . $CLAWSV);
1687 print "Claws Mail " . $clawsver . "\n";
1690 # the command line help
1692 my $line = '-' x length ($xl::s{about_title}) . "\n";
1694 print $xl::s{about_title} . "\n";
1696 print _("Syntax:\n");
1697 print _(" clawsker [options]\n");
1698 print _("Options:\n");
1699 print _(" --help Prints this help screen.\n");
1700 print _(" --version Prints version infos.\n");
1701 print _(" --verbose More messages on standard output.\n");
1702 print _(" --alternate-config-dir <dir> Uses <dir> as Claws Mail config dir.\n");
1703 print _(" --clawsrc <file> Uses <file> as full resource name.\n");
1706 # handle errors which don't allow to run
1707 sub command_line_fatal() {
1709 my $emsg = $xl::s{e_error} . $reason;
1710 error_dialog ($emsg);
1711 log_message ("$emsg", 'die');
1714 # parse the command line
1715 sub parse_command_line() {
1716 $CLAWSV = &get_claws_version;
1718 while (defined($ARGV[$arg])) {
1732 /--use-claws-version/ && do {
1734 &command_line_fatal ("required version")
1735 unless defined($ARGV[$arg]);
1736 &command_line_fatal ("required a dotted numeric value")
1737 unless ($ARGV[$arg] =~ /[\d\.]+/);
1738 $CLAWSV = $ARGV[$arg];
1741 /--alternate-config-dir/ && do {
1743 &command_line_fatal ($xl::s{e_requireddir})
1744 unless defined($ARGV[$arg]);
1745 &command_line_fatal ($xl::s{e_notadir})
1746 unless -d $ARGV[$arg];
1747 $CONFIGDIR = $ARGV[$arg];
1749 unless ($CONFIGDIR =~ /.*\/$/);
1750 $ALTCONFIGDIR = TRUE;
1755 &command_line_fatal($xl::s{e_requiredfile})
1756 unless defined($ARGV[$arg]);
1757 &command_line_fatal($xl::s{e_notafile})
1758 unless -f $ARGV[$arg];
1759 &set_rc_filename ($ARGV[$arg]);
1762 /.*/ && &command_line_fatal (
1763 _("unknown option '{opt}'.\n", opt => $ARGV[$arg]));
1767 # eveything continues...
1771 # update the hidden preferences status from loaded values
1772 sub init_hidden_preferences() {
1773 foreach my $hash (\%pr::beh, \%pr::col, \%pr::gui, \%pr::oth, \%pr::win) {
1774 foreach my $key (keys %$hash) {
1775 $HPVALUE{${$hash}{$key}[NAME]} = $PREFS{${$hash}{$key}[NAME]};
1781 # load current status from disc
1782 sub load_preferences() {
1783 my $rc = &get_rc_filename;
1784 &log_message ("Loading preferences from $rc\n");
1785 return FALSE unless &check_rc_file ($rc);
1786 return FALSE unless &check_claws_not_running;
1790 if (/^([8a-z_]+)=(.*)$/) {
1798 # save current preferences to disc
1799 sub save_preferences() {
1800 my $rc = &get_rc_filename;
1801 &log_message ("Saving preferences to $rc\n");
1802 return FALSE unless &check_rc_file ($rc);
1803 return FALSE unless &check_claws_not_running;
1804 my $rcbak = "$rc.backup";
1805 rename ($rc, $rcbak);
1807 open (RCB, "<$rcbak");
1810 if (/^([8a-z_]+)=(.*)$/) {
1811 if (defined($HPVALUE{$1})) {
1812 print RCF $1 . "=" . $HPVALUE{$1} . "\n";
1815 print RCF $_ . "\n";
1819 print RCF $_ . "\n";
1828 sub new_notebook() {
1829 my $nb = Gtk2::Notebook->new;
1831 $nb->append_page (&new_behaviour_page, $xl::s{tab_behaviour});
1832 $nb->append_page (&new_colours_page, $xl::s{tab_colours});
1833 $nb->append_page (&new_gui_page, $xl::s{tab_gui});
1834 $nb->append_page (&new_other_page, $xl::s{tab_other});
1835 $nb->append_page (&new_winpos_page, $xl::s{tab_winpos});
1840 # create an about dialog
1841 sub new_about_dialog() {
1843 my $title = $xl::s{about_title};
1844 my $lic = $xl::s{about_license};
1845 my $vers = $xl::s{about_version} . " $VERSION";
1847 "This program is free software: you can redistribute it and/or modify
1848 it under the terms of the GNU General Public License as published by
1849 the Free Software Foundation, either version 3 of the License, or
1850 (at your option) any later version.
1852 This program is distributed in the hope that it will be useful,
1853 but WITHOUT ANY WARRANTY; without even the implied warranty of
1854 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1855 GNU General Public License for more details.
1857 You should have received a copy of the GNU General Public License
1858 along with this program. If not, see <http://www.gnu.org/licenses/>.";
1859 my $year = "2007-2010";
1860 my $holder = "Ricardo Mones <ricardo\@mones.org>";
1861 my $url = "http://www.claws-mail.org/clawsker";
1863 my $dialog = Gtk2::MessageDialog->new_with_markup ($parent,
1864 [qw/modal destroy-with-parent/],
1866 "<span size=\"x-large\" weight=\"bold\">$title</span>\n"
1867 . "<span size=\"large\">$vers</span>\n\n"
1868 . "<span color=\"blue\" size=\"large\">$url</span>\n\n"
1869 . "<span>Copyright $year by $holder</span>\n\n"
1870 . "<span size=\"large\">$lic</span>\n\n"
1871 . "<span size=\"small\">$license</span>");
1872 $dialog->set_title ($xl::s{about});
1877 # create buttons box
1878 sub new_button_box() {
1879 my ($parent, $adlg) = @_;
1880 my $b_about = Gtk2::Button->new_from_stock ('gtk-about');
1881 my $b_exit = Gtk2::Button->new_from_stock ('gtk-quit');
1882 my $b_apply = Gtk2::Button->new_from_stock ('gtk-apply');
1883 # disable button until is really implemented
1884 # my $b_undo = Gtk2::Button->new_from_stock ('gtk-undo');
1885 my $hbox = Gtk2::HBox->new (FALSE, 5);
1887 $b_exit->signal_connect (clicked => sub { Gtk2->main_quit });
1888 $b_apply->signal_connect (clicked => sub { &save_preferences ($parent) });
1889 # $b_undo->signal_connect (clicked => sub { &undo_current_changes });
1890 $b_about->signal_connect (clicked => sub { $adlg->run; $adlg->hide });
1892 $hbox->pack_end ($b_apply, FALSE, FALSE, 0);
1893 $hbox->pack_end ($b_exit, FALSE, FALSE, 0);
1894 # $hbox->pack_end ($b_undo, FALSE, FALSE, 0);
1895 $hbox->pack_start ($b_about, FALSE, FALSE, 0);
1901 $main_window = Gtk2::Window->new ('toplevel');
1902 exit unless &parse_command_line;
1903 exit unless &load_preferences;
1904 exit unless &init_hidden_preferences;
1906 my $box = Gtk2::VBox->new (FALSE, 5);
1907 $box->set_border_width(3);
1908 my $about = &new_about_dialog;
1909 $box->pack_start (&new_notebook, FALSE, FALSE, 0);
1910 $box->pack_end (&new_button_box ($main_window, $about), FALSE, FALSE, 0);
1911 $main_window->signal_connect (delete_event => sub { Gtk2->main_quit });
1912 $main_window->set_title ($xl::s{win_title});
1913 $main_window->add ($box);
1914 $main_window->show_all;