[Commits] [SCM] clawsker branch, master, updated. 1.3.8-17-gf8195f8
mones at claws-mail.org
mones at claws-mail.org
Sat Aug 31 10:39:15 UTC 2024
The branch, master has been updated
via f8195f803975b819b04af1989c571fe34576e855 (commit)
from fcc5808502df17c60e0eece4e28747180a9c47f6 (commit)
Summary of changes:
clawsker | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
- Log -----------------------------------------------------------------
commit f8195f803975b819b04af1989c571fe34576e855
Author: Ricardo Mones <ricardo at mones.org>
Date: Sat Aug 31 12:38:49 2024 +0200
Fail better and make it more readable
diff --git a/clawsker b/clawsker
index cd3c9a2..d0fde16 100755
--- a/clawsker
+++ b/clawsker
@@ -39,6 +39,7 @@ my $HIDEDK = FALSE;
my $LOWRES = FALSE;
our $CLAWSV = undef;
my $main_window = undef;
+my $has_display = undef;
sub initialise {
binmode STDOUT, ":encoding(utf8)";
@@ -47,6 +48,7 @@ sub initialise {
setlocale (LC_ALL, $locale);
bindtextdomain ($NAME, catdir ($PREFIX, 'share', 'locale'));
textdomain ($NAME);
+ $has_display = (defined $ENV{DISPLAY} and $ENV{DISPLAY} ne '')? TRUE: FALSE;
return
}
initialise;
@@ -478,7 +480,7 @@ sub message_dialog {
}
sub error_dialog {
- return unless (defined $ENV{'DISPLAY'} and $ENV{'DISPLAY'} ne '');
+ return unless $has_display;
my ($emsg) = @_;
$emsg =~ s/&/&/g;
my $markup = "<span weight=\"bold\" size=\"large\">" . $emsg . "</span>";
@@ -2657,7 +2659,7 @@ sub parse_command_line {
};
if ($@) {
my $msg = _("Error in options: {msg}\n", msg => $@);
- if (defined $ENV{'DISPLAY'} and $ENV{'DISPLAY'} ne '') {
+ if ($has_display) {
eval { Gtk3->init };
error_dialog ($msg) unless $@;
}
@@ -3166,6 +3168,7 @@ sub get_screen_height {
sub main {
my $args = shift;
exit unless parse_command_line ($args);
+ die _("This program needs a GUI: no DISPLAY found\n") unless $has_display;
Gtk3->init;
$main_window = Gtk3::Window->new ('toplevel');
exit unless load_preferences ();
-----------------------------------------------------------------------
hooks/post-receive
--
Hidden preferences editor for Claws Mail
More information about the Commits
mailing list