/[soft]/rpmdrake/trunk/Rpmdrake/icon.pm
ViewVC logotype

Contents of /rpmdrake/trunk/Rpmdrake/icon.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 535 - (show annotations) (download)
Mon Feb 14 00:37:56 2011 UTC (13 years, 1 month ago) by dmorgan
File size: 10410 byte(s)
Import cleaned rpmdrake
1 package Rpmdrake::icon;
2 #*****************************************************************************
3 #
4 # Copyright (c) 2002 Guillaume Cottenceau
5 # Copyright (c) 2002-2007 Thierry Vignaud <tvignaud@mandriva.com>
6 # Copyright (c) 2003, 2004, 2005 MandrakeSoft SA
7 # Copyright (c) 2005-2007 Mandriva SA
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License version 2, as
11 # published by the Free Software Foundation.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #
22 #*****************************************************************************
23 #
24 # $Id: icon.pm 237459 2008-02-26 14:20:47Z tv $
25
26 use strict;
27 our @ISA = qw(Exporter);
28 use lib qw(/usr/lib/libDrakX);
29 use common;
30 use mygtk2 qw(gtknew); #- do not import anything else, especially gtkadd() which conflicts with ugtk2 one
31
32 our @EXPORT = qw(get_icon);
33 #- /usr/share/rpmlint/config (duplicates are normal, so that we are not too far away from .py)
34 my %group_icons = (
35 N("All") => 'system_section',
36 N("Accessibility") => 'accessibility_section',
37 N("Archiving") => 'archiving_section',
38 join('|', N("Archiving"), N("Backup")) => 'backup_section',
39 join('|', N("Archiving"), N("Cd burning")) => 'cd_burning_section',
40 join('|', N("Archiving"), N("Compression")) => 'compression_section',
41 join('|', N("Archiving"), N("Other")) => 'other_archiving',
42 N("Books") => 'documentation_section',
43 join('|', N("Books"), N("Computer books")) => 'documentation_section',
44 join('|', N("Books"), N("Faqs")) => 'documentation_section',
45 join('|', N("Books"), N("Howtos")) => 'documentation_section',
46 join('|', N("Books"), N("Literature")) => 'documentation_section',
47 join('|', N("Books"), N("Other")) => 'education_other_section',
48 N("Communications") => 'communications_section',
49 N("Databases") => 'databases_section',
50 N("Development") => 'development_section',
51 join('|', N("Development"), N("C")) => '',
52 join('|', N("Development"), N("C++")) => '',
53 join('|', N("Development"), N("Databases")) => 'databases_section',
54 join('|', N("Development"), N("GNOME and GTK+")) => 'gnome_section',
55 join('|', N("Development"), N("Java")) => '',
56 join('|', N("Development"), N("KDE and Qt")) => 'kde_section',
57 join('|', N("Development"), N("Kernel")) => 'hardware_configuration_section',
58 join('|', N("Development"), N("Other")) => 'development_tools_section',
59 join('|', N("Development"), N("Perl")) => '',
60 join('|', N("Development"), N("PHP")) => '',
61 join('|', N("Development"), N("Python")) => '',
62 join('|', N("Development"), N("X11")) => 'office_section',
63 N("Editors") => 'emulators_section',
64 N("Education") => 'education_section',
65 N("Emulators") => 'emulators_section',
66 N("File tools") => 'file_tools_section',
67 N("Games") => 'amusement_section',
68 join('|', N("Games"), N("Adventure")) => 'adventure_section',
69 join('|', N("Games"), N("Arcade")) => 'arcade_section',
70 join('|', N("Games"), N("Boards")) => 'boards_section',
71 join('|', N("Games"), N("Cards")) => 'cards_section',
72 join('|', N("Games"), N("Other")) => 'other_amusement',
73 join('|', N("Games"), N("Puzzles")) => 'puzzle_section',
74 join('|', N("Games"), N("Sports")) => 'sport_section',
75 join('|', N("Games"), N("Strategy")) => 'strategy_section',
76 N("Graphical desktop") => 'office_section',
77 join('|', N("Graphical desktop"),
78 #-PO: This is a package/product name. Only translate it if needed:
79 N("Enlightenment")) => '',
80 join('|', N("Graphical desktop"), N("FVWM based")) => '',
81 join('|', N("Graphical desktop"),
82 #-PO: This is a package/product name. Only translate it if needed:
83 N("GNOME")) => 'gnome_section',
84 join('|', N("Graphical desktop"),
85 #-PO: This is a package/product name. Only translate it if needed:
86 N("Icewm")) => '',
87 join('|', N("Graphical desktop"),
88 #-PO: This is a package/product name. Only translate it if needed:
89 N("KDE")) => 'kde_section',
90 join('|', N("Graphical desktop"), N("Other")) => 'more_applications_other_section',
91 join('|', N("Graphical desktop"),
92 #-PO: This is a package/product name. Only translate it if needed:
93 N("Sawfish")) => '',
94 join('|', N("Graphical desktop"),
95 #-PO: This is a package/product name. Only translate it if needed:
96 N("WindowMaker")) => '',
97 join('|', N("Graphical desktop"),
98 #-PO: This is a package/product name. Only translate it if needed:
99 N("Xfce")) => '',
100 N("Graphics") => 'graphics_section',
101 N("Monitoring") => 'monitoring_section',
102 N("Multimedia") => 'multimedia_section',
103 join('|', N("Multimedia"), N("Video")) => 'video_section',
104 N("Networking") => 'networking_section',
105 join('|', N("Networking"), N("Chat")) => 'chat_section',
106 join('|', N("Networking"), N("File transfer")) => 'file_transfer_section',
107 join('|', N("Networking"), N("IRC")) => 'irc_section',
108 join('|', N("Networking"), N("Instant messaging")) => 'instant_messaging_section',
109 join('|', N("Networking"), N("Mail")) => 'mail_section',
110 join('|', N("Networking"), N("News")) => 'news_section',
111 join('|', N("Networking"), N("Other")) => 'other_networking',
112 join('|', N("Networking"), N("Remote access")) => 'remote_access_section',
113 join('|', N("Networking"), N("WWW")) => 'networking_www_section',
114 N("Office") => 'office_section',
115 N("Public Keys") => 'packaging_section',
116 N("Publishing") => 'publishing_section',
117 N("Sciences") => 'sciences_section',
118 join('|', N("Sciences"), N("Astronomy")) => 'astronomy_section',
119 join('|', N("Sciences"), N("Biology")) => 'biology_section',
120 join('|', N("Sciences"), N("Chemistry")) => 'chemistry_section',
121 join('|', N("Sciences"), N("Computer science")) => 'computer_science_section',
122 join('|', N("Sciences"), N("Geosciences")) => 'geosciences_section',
123 join('|', N("Sciences"), N("Mathematics")) => 'mathematics_section',
124 join('|', N("Sciences"), N("Other")) => 'other_sciences',
125 join('|', N("Sciences"), N("Physics")) => 'physics_section',
126 N("Shells") => 'shells_section',
127 N("Sound") => 'sound_section',
128 N("System") => 'system_section',
129 join('|', N("System"), N("Base")) => 'system_section',
130 join('|', N("System"), N("Cluster")) => 'parallel_computing_section',
131 join('|', N("System"), N("Configuration")) => 'configuration_section',
132 join('|', N("System"), N("Configuration"), N("Boot and Init")) => 'boot_init_section',
133 join('|', N("System"), N("Configuration"), N("Hardware")) => 'hardware_configuration_section',
134 join('|', N("System"), N("Configuration"), N("Networking")) => 'networking_configuration_section',
135 join('|', N("System"), N("Configuration"), N("Other")) => 'system_other_section',
136 join('|', N("System"), N("Configuration"), N("Packaging")) => 'packaging_section',
137 join('|', N("System"), N("Configuration"), N("Printing")) => 'printing_section',
138 join('|', N("System"), N("Fonts")) => 'chinese_section',
139 join('|', N("System"), N("Fonts"), N("Console")) => 'interpreters_section',
140 join('|', N("System"), N("Fonts"), N("True type")) => '',
141 join('|', N("System"), N("Fonts"), N("Type1")) => '',
142 join('|', N("System"), N("Fonts"), N("X11 bitmap")) => '',
143 join('|', N("System"), N("Internationalization")) => 'chinese_section',
144 join('|', N("System"), N("Kernel and hardware")) => 'hardware_configuration_section',
145 join('|', N("System"), N("Libraries")) => '',
146 join('|', N("System"), N("Printing")) => 'printing_section',
147 join('|', N("System"), N("Servers")) => '',
148 join('|', N("System"),
149 #-PO: This is a package/product name. Only translate it if needed:
150 N("X11")) => 'office_section',
151 N("Terminals") => 'terminals_section',
152 N("Text tools") => 'text_tools_section',
153 N("Toys") => 'toys_section',
154 N("Video") => 'video_section',
155
156 # for Mageia Choice:
157 N("Workstation") => 'office_section',
158 join('|', N("Workstation"), N("Configuration")) => 'configuration_section',
159 join('|', N("Workstation"), N("Console Tools")) => 'interpreters_section',
160 join('|', N("Workstation"), N("Documentation")) => 'documentation_section',
161 join('|', N("Workstation"), N("Game station")) => 'amusement_section',
162 join('|', N("Workstation"), N("Internet station")) => 'networking_section',
163 join('|', N("Workstation"), N("Multimedia station")) => 'multimedia_section',
164 join('|', N("Workstation"), N("Network Computer (client)")) => 'other_networking',
165 join('|', N("Workstation"), N("Office Workstation")) => 'office_section',
166 join('|', N("Workstation"), N("Scientific Workstation")) => 'sciences_section',
167 N("Graphical Environment") => 'office_section',
168
169 join('|', N("Graphical Environment"), N("GNOME Workstation")) => 'gnome_section',
170 join('|', N("Graphical Environment"), N("IceWm Desktop")) => 'icewm',
171 join('|', N("Graphical Environment"), N("KDE Workstation")) => 'kde_section',
172 join('|', N("Graphical Environment"), N("Other Graphical Desktops")) => 'more_applications_other_section',
173 N("Development") => 'development_section',
174 join('|', N("Development"), N("Development")) => 'development_section',
175 join('|', N("Development"), N("Documentation")) => 'documentation_section',
176 N("Server") => 'archiving_section',
177 join('|', N("Server"), N("DNS/NIS")) => 'networking_section',
178 join('|', N("Server"), N("Database")) => 'databases_section',
179 join('|', N("Server"), N("Firewall/Router")) => 'networking_section',
180 join('|', N("Server"), N("Mail")) => 'mail_section',
181 join('|', N("Server"), N("Mail/Groupware/News")) => 'mail_section',
182 join('|', N("Server"), N("Network Computer server")) => 'networking_section',
183 join('|', N("Server"), N("Web/FTP")) => 'networking_www_section',
184
185 );
186
187 sub get_icon {
188 my ($group, $parent) = @_;
189 my $pixbuf;
190 my $path = $group =~ /\|/ ? '/usr/share/icons/mini/' : '/usr/share/icons/';
191 my $create_pixbuf = sub { eval { gtknew('Pixbuf', file => join('', $path, $_[0], '.png')) } };
192 $pixbuf = $create_pixbuf->($group_icons{$group});
193 $pixbuf ||= $create_pixbuf->($group_icons{$parent}) if $parent;
194 $pixbuf ||= $create_pixbuf->('applications_section');
195 }
196
197 1;

  ViewVC Help
Powered by ViewVC 1.1.30