File size: 2,929 Bytes
7578e9d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
###################################################
#
#  Copyright (C) 2008-2013 Mario Kemper <mario.kemper@gmail.com>
#
#  This file is part of Shutter.
#
#  Shutter is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 3 of the License, or
#  (at your option) any later version.
#
#  Shutter is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with Shutter; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#
###################################################

package Shutter::App::AboutDialog;

#modules
#--------------------------------------
use utf8;
use strict;
use warnings;
use Gtk3;

#Glib
use Glib qw/TRUE FALSE/;

#--------------------------------------

sub new {
	my $class = shift;

	#constructor
	my $self = {_sc => shift};

	bless $self, $class;
	return $self;
}

sub show {
	my $self = shift;

	my $shf          = Shutter::App::HelperFunctions->new($self->{_sc});
	my $shutter_root = $self->{_sc}->get_root;
	my $d            = $self->{_sc}->get_gettext;

	#everything is stored in external files, so it is easier to maintain
	my $all_hint = "";
	open(GPL_HINT, "$shutter_root/share/shutter/resources/license/gplv3_hint")
		or die $!;
	while (my $hint = <GPL_HINT>) {
		utf8::decode $hint;
		$all_hint .= $hint;
	}
	close(GPL_HINT);

	my $all_gpl = "";
	open(GPL, "$shutter_root/share/shutter/resources/license/gplv3")
		or die $!;
	while (my $gpl = <GPL>) {
		utf8::decode $gpl;
		$all_gpl .= $gpl;
	}
	close(GPL);

	my @all_dev;
	open(DEVCREDITS, "$shutter_root/share/shutter/resources/credits/dev")
		or die $!;
	while (my $dev = <DEVCREDITS>) {
		chomp $dev;
		utf8::decode $dev;
		push @all_dev, $dev;
	}
	close(DEVCREDITS);

	my @all_art;
	open(ARTCREDITS, "$shutter_root/share/shutter/resources/credits/art")
		or die $!;
	while (my $art = <ARTCREDITS>) {
		chomp $art;
		utf8::decode $art;
		push @all_art, $art;
	}
	close(ARTCREDITS);

	my $about = Gtk3::AboutDialog->new;
	$about->set_logo_icon_name('shutter');
	$about->set_program_name($self->{_sc}->get_appname);
	$about->set_version($self->{_sc}->get_version);

	#~ $about->set_website_label("Shutter-Website");
	$about->set_website("https://shutter-project.org");
	$about->set_authors(\@all_dev);
	$about->set_artists(\@all_art);
	$about->set_translator_credits($d->get("translator-credits"));
	$about->set_copyright($all_hint);
	$about->set_license($all_gpl);
	$about->set_comments($self->{_sc}->get_rev);
	$about->show_all;
	$about->signal_connect('response' => sub { $about->destroy });
}

1;