Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions bin/shutter
Original file line number Diff line number Diff line change
Expand Up @@ -4167,8 +4167,7 @@ sub STARTUP {
}

#check mime type
my ($mime_type) = Glib::Object::Introspection->invoke('Gio', undef, 'content_type_guess', $giofile->get_path);
$mime_type =~ s/image\/x\-apple\-ios\-png/image\/png/; #FIXME
my $mime_type = fct_get_mime_type($giofile);
if ($mime_type =~ m/(pdf|ps|svg)/ig) {

#not a supported mime type
Expand Down Expand Up @@ -5245,8 +5244,7 @@ sub STARTUP {
my @valid_files;
foreach my $file (@files) {
my $giofile = Glib::IO::File::new_for_uri($file);
my ($mime_type) = Glib::Object::Introspection->invoke('Gio', undef, 'content_type_guess', $giofile->get_path);
$mime_type =~ s/image\/x\-apple\-ios\-png/image\/png/; #FIXME
my $mime_type = fct_get_mime_type($giofile);
if ($mime_type && fct_check_valid_mime_type($mime_type)) {
push @valid_files, $file;
}
Expand All @@ -5262,6 +5260,13 @@ sub STARTUP {
return FALSE;
}
}

sub fct_get_mime_type {
my $giofile = shift;
my ($mime_type) = Glib::Object::Introspection->invoke('Gio', undef, 'content_type_guess', $giofile->get_path);
$mime_type =~ s/image\/x\-apple\-ios\-png/image\/png/; #FIXME
return $mime_type;
}

sub fct_check_valid_mime_type {
my $mime_type = shift;
Expand Down Expand Up @@ -7508,8 +7513,7 @@ sub STARTUP {
$session_screens{$key}->{'name'} =~ s/\.$session_screens{$key}->{'filetype'}//g;

#mime type
my ($mime_type) = Glib::Object::Introspection->invoke('Gio', undef, 'content_type_guess', $session_screens{$key}->{'giofile'}->get_path);
$mime_type =~ s/image\/x\-apple\-ios\-png/image\/png/; #FIXME
my $mime_type = fct_get_mime_type($session_screens{$key}->{'giofile'});
$session_screens{$key}->{'mime_type'} = $mime_type;

#TAB PREVIEW IMAGE
Expand Down
Loading