Update potfile
[clawsker.git] / clawsker
index 720d59cf3a91be90bae1d445fb15f9cb40583121..0b8dc165eadb327671462a1529d0eefa43b5b527 100755 (executable)
--- a/clawsker
+++ b/clawsker
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 #
 # Clawsker :: A Claws Mail Tweaker
-# Copyright 2007-2014 Ricardo Mones <ricardo@mones.org>
+# Copyright 2007-2016 Ricardo Mones <ricardo@mones.org>
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -27,6 +27,7 @@ use Getopt::Long;
 my $NAME = 'clawsker';
 my $PREFIX = '@PREFIX@';
 my $LIBDIR = '@LIBDIR@';
+my $DATADIR = '@DATADIR@';
 my $VERSION = '@VERSION@';
 my $VERBOSE = FALSE;
 my $CLAWSV = undef;
@@ -82,6 +83,7 @@ sub _ {
     compo_frame => _('Compose window'),
     netm_frame => _('NetworkManager'),
     diff_frame => _('Viewing patches'),
+    mpass_frame => _('Master passphrase'),
 
     l_oth_use_dlg => _('Use detached address book edit dialogue'),
     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.'),
@@ -91,10 +93,12 @@ sub _ {
     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.'),
     l_oth_use_netm => _('Use NetworkManager'),
     h_oth_use_netm => _('Use NetworkManager to switch offline automatically.'),
+    l_oth_mp_rounds => _('Rounds for PBKDF2 function'),
+    h_oth_mp_rounds => _('Specify the number of iterations the key derivation function will be applied on master passphrase computation. Does not modify currently stored passphrase, only master passphrases computed after changing this value are affected.'),
     
     l_gui_b_unread => _('Show unread messages with bold font'),
     h_gui_b_unread => _('Show unread messages in the Message List using a bold font.'),
-    l_gui_no_markup => _('Don\'t use markup in compose window'),
+    l_gui_no_markup => _('Don\'t use markup'),
     h_gui_no_markup => _('Don\'t use bold and italic text in Compose dialogue\'s account selector.'),
     l_gui_dot_lines => _('Use dotted lines in tree view components'),
     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.'),
@@ -108,7 +112,7 @@ sub _ {
     l_gui_v_scroll_auto => _('Automatic'),
     l_gui_v_scroll_hide => _('Hide always'),
     l_gui_from_show => _('From column displays'),
-    h_gui_from_show => _('Selects the data displayed in the From column of the Message List: name, address or both'),
+    h_gui_from_show => _('Selects the data displayed in the From column of the Message List: name, address or both.'),
     l_gui_from_show_name => _('Name only'),
     l_gui_from_show_addr => _('Address only'),
     l_gui_from_show_both => _('Both name and address'),
@@ -124,12 +128,16 @@ sub _ {
     h_gui_strip_sum => _('Enable alternately coloured lines in Message List and Folder List.'),
     l_gui_two_line_v => _('2 lines per Message List item in 3-column layout'),
     h_gui_two_line_v => _('Spread Message List information over two lines when using the three column mode.'),
-    l_gui_margin_co => _('Show compose margin'),
+    l_gui_margin_co => _('Show margin'),
     h_gui_margin_co => _('Shows a small margin in the Compose View.'),
     l_gui_mview_date => _('Don\'t display localized date'),
-    h_gui_mview_date => _('Toggles localization of date format in Message View'),
+    h_gui_mview_date => _('Toggles localization of date format in Message View.'),
     l_gui_zero_char => _('Zero replacement character'),
-    h_gui_zero_char => _('Replaces \'0\' with the given character in Folder List'),
+    h_gui_zero_char => _('Replaces \'0\' with the given character in Folder List.'),
+    l_gui_type_any => _('Editable headers'),
+    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.'),
+    l_gui_next_del => _('Select next message on delete'),
+    h_gui_next_del => _('When deleting a message, toggles between selecting the next one (newer message) or the previous one (older message).'),
 
     l_beh_hover_t => _('Drag \'n\' drop hover timeout (ms)'),
     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.'),
@@ -156,11 +164,11 @@ sub _ {
     l_beh_pp_unsel => _('Primary paste unselects selection'),
     h_beh_pp_unsel => _('Controls how pasting using middle-click changes the selected text and insertion point.'),
     l_beh_inline_at => _('Show inline attachments'),
-    h_beh_inline_at => _('Allows hiding inline attachments already shown in mail structure view'),
+    h_beh_inline_at => _('Allows hiding inline attachments already shown in mail structure view.'),
     l_beh_addr_swc => _('Address search in compose window matches any'),
-    h_beh_addr_swc => _('On Tab-key completion, address text will match any part of the string or only the from the start'),
+    h_beh_addr_swc => _('On Tab-key completion, address text will match any part of the string or only the from the start.'),
     l_beh_fold_swc => _('Folder search in folder selector matches any'),
-    h_beh_fold_swc => _('On folder name completion text will match any part of the string or only from the start'),
+    h_beh_fold_swc => _('On folder name completion text will match any part of the string or only from the start.'),
 
     l_col_emphasis => _('X-Mailer header'),
     h_col_emphasis => _('The colour used for the X-Mailer line when its value is Claws Mail.'),
@@ -261,7 +269,7 @@ sub get_claws_version {
     my @ver = split (/\./, $fver[3]);
     $res .= "$ver[0].";
     $res .= "$ver[1].";
-    if ($ver[2] =~ /(\d+)cvs(\d+)/) {
+    if ($ver[2] =~ /(\d+)git(\d+)/) {
         $res .= "$1.$2";
     }
     else {
@@ -362,7 +370,7 @@ sub error_dialog {
     my ($emsg) = @_;
     my $markup = "<span weight=\"bold\" size=\"large\">" . $emsg . "</span>";
     my $errordlg = Gtk2::MessageDialog->new_with_markup ($main_window, 'modal', 'error', 'cancel', $markup);
-    $errordlg->set_title (_('Error message'));
+    $errordlg->set_title (_('Clawsker error'));
     $errordlg->run;
     $errordlg->destroy;
 }
@@ -375,11 +383,13 @@ sub claws_is_running {
 }
 
 sub check_claws_not_running {
-    my $socket = (not $ALTCONFIGDIR)? "/tmp/": $CONFIGDIR;
-    $socket .= "claws-mail-$<";
+    my $tmpdir = (defined $ENV{TMPDIR})? $ENV{TMPDIR}: '/tmp';
+    $tmpdir = '/tmp' if ($tmpdir eq '');
+    my $socket = (not $ALTCONFIGDIR)? $tmpdir: $CONFIGDIR;
+    $socket .= "/claws-mail-$<";
     -S $socket and return claws_is_running ();
     # since 3.9.0cvs36
-    my $lockdir = "/tmp/claws-mail-$<";
+    my $lockdir = "$tmpdir/claws-mail-$<";
     -d $lockdir and do { 
        $_ = $CONFIGDIR;
        s/\/$//;
@@ -626,6 +636,15 @@ sub new_subpage_frame {
         '1',
         undef,
     ],
+    mp_rounds => [
+        'master_passphrase_pbkdf2_rounds',
+        $xl::s{l_oth_mp_rounds},
+        $xl::s{h_oth_mp_rounds},
+        'int,50000,1000000',
+        '3.13.2.110',
+        '50000',
+        undef,
+    ],
 );
 
 sub new_other_page() {
@@ -642,7 +661,11 @@ sub new_other_page() {
                new_subpage_frame (
                    new_vbox_pack (
                        new_check_button_for(\%pr::oth, 'use_netm')),
-                   $xl::s{netm_frame}, 'not-packed')
+                   $xl::s{netm_frame}, 'not-packed'),
+               new_subpage_frame (
+                   new_vbox_pack (
+                       new_text_box_for_int(\%pr::oth, 'mp_rounds')),
+                   $xl::s{mpass_frame}, 'not-packed')
            );
 }
 
@@ -791,6 +814,24 @@ sub new_other_page() {
         '0',
         undef,
     ],
+    type_any => [
+        'type_any_header',
+        $xl::s{l_gui_type_any},
+        $xl::s{h_gui_type_any},
+        'bool',
+        '3.12.0.44',
+        '0',
+        undef,
+    ],
+    next_del => [
+        'next_on_delete',
+        $xl::s{l_gui_next_del},
+        $xl::s{h_gui_next_del},
+        'bool',
+        '3.13.0.5',
+        '0',
+        undef,
+    ],
 );
 
 sub new_gui_page() {
@@ -813,6 +854,7 @@ sub new_gui_page() {
                              new_check_button_for (\%pr::gui, 'b_unread'),
                              new_check_button_for (\%pr::gui, 'swp_from'),
                              new_check_button_for (\%pr::gui, 'two_linev'),
+                             new_check_button_for (\%pr::gui, 'next_del'),
                              new_selection_box_for (\%pr::gui, 'from_show')),
                          $xl::s{mlist_frame}, 'not-packed'), 
                      FALSE, FALSE, FRAME_SPC);
@@ -825,7 +867,8 @@ sub new_gui_page() {
     $gf->pack_start (new_subpage_frame (
                          new_hbox_pack (
                              new_check_button_for (\%pr::gui, 'no_markup'),
-                             new_check_button_for (\%pr::gui, 'margin_co')),
+                             new_check_button_for (\%pr::gui, 'margin_co'),
+                             new_check_button_for (\%pr::gui, 'type_any')),
                          $xl::s{compo_frame}, 'not-packed'), 
                      FALSE, FALSE, FRAME_SPC);
     $gf->pack_start ($cb_dot_lines, FALSE, FALSE, 0);
@@ -1903,7 +1946,14 @@ sub parse_command_line {
             'r|clawsrc=s' => \&opt_clawsrc)
         or die _("try -h or --help for syntax.\n");
     };
-    die _("Error in options: {msg}\n", msg => $@) if $@;
+    if ($@) {
+        my $msg = _("Error in options: {msg}\n", msg => $@);
+        if (defined $ENV{'DISPLAY'} and $ENV{'DISPLAY'} ne '') {
+            eval { Gtk2->init };
+            error_dialog ($msg) unless $@;
+        }
+        die $msg;
+    }
     return $cont;
 }
 
@@ -1925,7 +1975,7 @@ sub opt_alternate_config_dir {
 
 sub opt_clawsrc {
     my ($name, $value) = @_;
-    die _("Error: '{value}' is not a file or does not exist", value => $value)
+    die _("Error: '{value}' is not a file or does not exist\n", value => $value)
         unless -f $value;
     set_rc_filename ($value);
 }
@@ -2018,7 +2068,7 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.";
-    my $year = "2007-2014";
+    my $year = "2007-2016";
     my $holder = "Ricardo Mones &lt;ricardo\@mones.org&gt;";
     my $url = "http://www.claws-mail.org/clawsker.php";
 
@@ -2059,6 +2109,20 @@ sub new_button_box {
     return $hbox;
 }
 
+sub get_app_icons {
+    my $dir = $DATADIR . '/icons/hicolor';
+    my @names = map {
+      join ('/', ($dir, , $_ . 'x' . $_, 'apps', $NAME . '.png'))
+    } (64, 128);
+    my @icons = ();
+    foreach (@names) {
+        my $icon = undef;
+        $icon = Gtk2::Gdk::Pixbuf->new_from_file($_) if (-f $_);
+        push @icons, $icon if ($icon);
+    }
+    return @icons;
+}
+
 # initialise
 exit unless parse_command_line ();
 Gtk2->init;
@@ -2073,6 +2137,7 @@ $box->pack_start (new_notebook (), FALSE, FALSE, 0);
 $box->pack_end (new_button_box ($main_window, $about), FALSE, FALSE, 0);
 $main_window->signal_connect (delete_event => sub { Gtk2->main_quit });
 $main_window->set_title ($xl::s{win_title});
+$main_window->set_icon_list (get_app_icons ());
 $main_window->add ($box);
 $main_window->show_all;
 Gtk2->main;