-
Notifications
You must be signed in to change notification settings - Fork 0
/
Icons.pm
82 lines (74 loc) · 2.97 KB
/
Icons.pm
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
# ClamTk, copyright (C) 2004-2019 Dave M
#
# This file is part of ClamTk
# (https://gitlab.com/dave_m/clamtk-gtk3/).
#
# ClamTk is free software; you can redistribute it and/or modify it
# under the terms of either:
#
# a) the GNU General Public License as published by the Free Software
# Foundation; either version 1, or (at your option) any later version, or
#
# b) the "Artistic License".
package ClamTk::Icons;
# use strict;
# use warnings;
# $| = 1;
sub get_image() {
my ( $self, $wanted ) = @_;
# warn "wanted: >$wanted<\n";
my $use_image = '';
my %table;
# These need to be scrubbed again
$table{ 'alarm' } = 'gtk-properties';
$table{ 'document-new' } = 'gtk-file';
$table{ 'document-save' } = 'gtk-apply';
$table{ 'document-save-as' } = 'gtk-save-as';
$table{ 'document-send' } = 'gtk-index';
$table{ 'edit-delete' } = 'gtk-delete';
$table{ 'edit-find' } = 'gtk-find';
$table{ 'edit-select' } = 'gtk-find';
$table{ 'edit-undo' } = 'gtk-undelete';
$table{ 'emblem-important' } = 'gtk-no';
$table{ 'emblem-ok' } = 'gtk-yes';
$table{ 'folder-documents' } = 'gtk-directory';
$table{ 'go-previous' } = 'gtk-go-back';
$table{ 'help-about' } = 'gtk-about';
$table{ 'image-missing' } = 'gtk-missing-image';
$table{ 'list-add' } = 'gtk-add';
$table{ 'list-remove' } = 'gtk-remove';
$table{ 'preferences-system' } = 'gtk-preferences';
$table{ 'preferences-system-network' } = 'gtk-network';
$table{ 'process-stop' } = 'gtk-cancel';
$table{ 'security-high' } = 'gtk-new';
$table{ 'software-update-available' } = 'gtk-ok';
$table{ 'system-help' } = 'gtk-about';
$table{ 'system-lock-screen' } = 'gtk-refresh';
$table{ 'system-search' } = 'gtk-find';
$table{ 'text-x-preview' } = 'gtk-select-all';
$table{ 'user-trash-full' } = 'gtk-refresh';
$table{ 'view-list' } = 'gtk-edit';
$table{ 'window-close' } = 'gtk-close';
my $theme = Gtk3::IconTheme::get_default();
if ( exists $table{ $wanted } ) {
if ( $theme->has_icon( $wanted ) ) {
$use_image = $wanted;
} elsif ( $theme->has_icon( $table{ $wanted } ) ) {
$use_image = $table{ $wanted };
} else {
if ( $theme->has_icon( 'image-missing' ) ) {
$use_image = 'image-missing';
} else {
$use_image = $table{ 'image-missing' };
}
}
} else {
if ( $theme->has_icon( 'image-missing' ) ) {
$use_image = 'image-missing';
} else {
$use_image = $table{ 'image-missing' };
}
}
return $use_image;
}
1;