--help
Shows a brief help screen.
+--version
+ Show information about program, Claws Mail and Perl-GTK versions.
+
--verbose
Tells more on the standard output.
=head1 LICENSE
-Copyright (c) 2007-2008 by Ricardo Mones Lastra
+Copyright (c) 2007-2009 by Ricardo Mones Lastra
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
my $LIBDIR = '@LIBDIR@';
my $VERSION = '@VERSION@';
my $VERBOSE = FALSE;
+my $CLAWSV = undef;
my $main_window = undef;
my $locale = (defined($ENV{LC_MESSAGES}) ? $ENV{LC_MESSAGES} : $ENV{LANG});
h_beh_warn_dnd => _('Display a confirmation dialogue on drag \'n\' drop of folders.'),
l_beh_out_ascii => _('Ougoing messages fallback to ASCII'),
h_beh_out_ascii => _('If content allows, ASCII will be used to encode outgoing messages, otherwise the user-defined encoding is enforced always.'),
+ 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_col_emphasis => _('X-Mailer header'),
h_col_emphasis => _('The colour used for the X-Mailer line when its value is Claws Mail.'),
use constant FRAME_SPC => 2;
use constant PAGE_SPC => 5;
+# version functions
+
+sub version_greater() {
+ my ($version, $refvers) = @_;
+ my @version = split (/\./, $version);
+ my @refvers = split (/\./, $refvers);
+ while ($#version < $#refvers) {
+ push (@version, '0');
+ }
+ my $idx = 0;
+ while (($idx <= $#refvers)
+ and (int ($version[$idx]) == int ($refvers[$idx]))) {
+ ++$idx;
+ }
+ return TRUE if (($idx > $#refvers)
+ or (int ($version[$idx]) > int ($refvers[$idx])));
+ return FALSE;
+}
+
+sub get_claws_version() {
+ my @cmbin = (
+ 'claws-mail',
+ );
+ my $res = "";
+ foreach my $bin (@cmbin) {
+ $_ = qx/which $bin/;
+ chomp;
+ last if ($_ ne "");
+ }
+ return "" unless ($_); # not installed
+ $_ = qx/$_ -v/;
+ chomp;
+ my @fver = split (/ /);
+ die "Invalid version string" unless ($fver[2] eq "version");
+ my @ver = split (/\./, $fver[3]);
+ $res .= "$ver[0].";
+ $res .= "$ver[1].";
+ if ($ver[2] =~ /(\d+)cvs(\d+)/) {
+ $res .= "$1.$2";
+ }
+ else {
+ $res .= "$ver[2].0";
+ }
+ return $res;
+}
+
# data handlers and auxiliar functions
sub handle_bool_value {
'1',
undef,
],
+ pp_unsel => [
+ 'primary_paste_unselects',
+ $xl::s{l_beh_pp_unsel},
+ $xl::s{h_beh_pp_unsel},
+ 'bool',
+ '3.6.1.35',
+ '0',
+ undef,
+ ],
);
sub new_behaviour_page() {
my $cb_use_utf8 = &new_check_button_for (\%pr::beh, 'use_utf8');
my $cb_dangerous = &new_check_button_for (\%pr::beh, 'dangerous');
my $cb_out_ascii = &new_check_button_for (\%pr::beh, 'out_ascii');
+ my $cb_pp_unsel = &new_check_button_for (\%pr::beh, 'pp_unsel');
my $vb2 = Gtk2::VBox->new (FALSE, 5);
$vb2->set_border_width (PAGE_SPC);
$vb2->pack_start ($cb_flowed, FALSE, FALSE, 0);
$vb2->pack_start ($cb_use_utf8, FALSE, FALSE, 0);
$vb2->pack_start ($cb_dangerous, FALSE, FALSE, 0);
$vb2->pack_start ($cb_out_ascii, FALSE, FALSE, 0);
+ $vb2->pack_start ($cb_pp_unsel, FALSE, FALSE, 0);
$msgs_frame->add ($vb2);
$bf->pack_start ($dnd_frame, FALSE, FALSE, FRAME_SPC);
return $cf;
}
-# the command line help
-sub print_help() {
- my $line = '-' x length ($xl::s{about_title}) . "\n";
- print $line;
+# version info
+sub print_version() {
print $xl::s{about_title} . "\n";
print $xl::s{about_version} . " $VERSION\n";
print "Perl-GLib " . $Glib::VERSION;
&Gtk2::minor_version, &Gtk2::micro_version);
}
print "\n";
+ my $clawsver = ($CLAWSV eq "") ?
+ _("was not found!") :
+ (_("returned version ") . $CLAWSV);
+ print "Claws Mail " . $clawsver . "\n";
+}
+
+# the command line help
+sub print_help() {
+ my $line = '-' x length ($xl::s{about_title}) . "\n";
+ print $line;
+ print $xl::s{about_title} . "\n";
print $line;
print _("Syntax:\n");
print _(" clawsker [options]\n");
print _("Options:\n");
print _(" --help Prints this help screen.\n");
+ print _(" --version Prints version infos.\n");
print _(" --verbose More messages on standard output.\n");
print _(" --alternate-config-dir <dir> Uses <dir> as Claws Mail config dir.\n");
print _(" --clawsrc <file> Uses <file> as full resource name.\n");
# parse the command line
sub parse_command_line() {
+ $CLAWSV = &get_claws_version;
my $arg = 0;
while (defined($ARGV[$arg])) {
for ($ARGV[$arg]) {
&print_help;
return FALSE;
};
+ /--version/ && do {
+ &print_version;
+ return FALSE;
+ };
/--verbose/ && do {
$VERBOSE = TRUE;
last;
};
+ /--use-claws-version/ && do {
+ ++$arg;
+ &command_line_fatal ("required version")
+ unless defined($ARGV[$arg]);
+ &command_line_fatal ("required a dotted numeric value")
+ unless ($ARGV[$arg] =~ /[\d\.]+/);
+ $CLAWSV = $ARGV[$arg];
+ };
/--alternate-config-dir/ && do {
++$arg;
&command_line_fatal ($xl::s{e_requireddir})
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.";
- my $year = "2007";
+ my $year = "2007-2009";
my $holder = "Ricardo Mones <ricardo\@mones.org>";
my $dialog = Gtk2::MessageDialog->new_with_markup ($parent,