1 |
package tmp::compssUsers; |
2 |
|
3 |
use common; |
4 |
|
5 |
my $low_resources = detect_devices::has_low_resources(); |
6 |
my $netbook_desktop = detect_devices::is_netbook_nettop(); |
7 |
my $light_desktop = detect_devices::need_light_desktop(); |
8 |
my $meta_class = $::o->{meta_class}; |
9 |
my $powerpack = $meta_class eq 'powerpack'; |
10 |
my $server = $meta_class eq 'server'; |
11 |
|
12 |
my $h = { |
13 |
N_("Workstation") => |
14 |
[ |
15 |
{ label => N_("Office Workstation"), |
16 |
descr => |
17 |
N_("Office programs: wordprocessors (OpenOffice.org Writer, Kword), spreadsheets (OpenOffice.org Calc, Kspread), PDF viewers, etc"), |
18 |
flags => [ qw(OFFICE SPELLCHECK PIM ARCHIVING ), if_(!$light_desktop, qw(PUBLISHING)) ], |
19 |
default_selected => 1, |
20 |
}, |
21 |
if_(!$server, |
22 |
{ label => N_("Game station"), |
23 |
descr => N_("Amusement programs: arcade, boards, strategy, etc"), |
24 |
flags => [ qw(GAMES) ], |
25 |
}, |
26 |
{ label => N_("Multimedia station"), |
27 |
descr => N_("Sound and video playing/editing programs"), |
28 |
flags => [ qw(AUDIO VIDEO GRAPHICS VIDEO_EDITING) ], |
29 |
default_selected => 1, |
30 |
}, |
31 |
), |
32 |
{ label => N_("Internet station"), |
33 |
descr => N_("Set of tools to read and send mail and news (mutt, tin..) and to browse the Web"), |
34 |
flags => [ qw(NETWORKING_WWW NETWORKING_MAIL NETWORKING_NEWS COMMUNICATIONS NETWORKING_CHAT NETWORKING_FILE_TRANSFER NETWORKING_IRC NETWORKING_INSTANT_MESSAGING NETWORKING_DNS) ], |
35 |
default_selected => 1, |
36 |
}, |
37 |
if_(!$server, |
38 |
{ label => N_("Network Computer (client)"), |
39 |
descr => N_("Clients for different protocols including ssh"), |
40 |
flags => [ qw(NETWORKING_REMOTE_ACCESS NETWORKING_FILE) ], |
41 |
default_selected => $powerpack, |
42 |
}, |
43 |
{ label => N_("Configuration"), |
44 |
descr => N_("Tools to ease the configuration of your computer"), |
45 |
flags => [ qw(CONFIG) ], |
46 |
default_selected => 1, |
47 |
}, |
48 |
{ label => N_("Console Tools"), |
49 |
descr => N_("Editors, shells, file tools, terminals"), |
50 |
flags => [ qw(EDITORS TERMINALS TEXT_TOOLS SHELLS FILE_TOOLS) ], |
51 |
default_selected => 1, |
52 |
}, |
53 |
{ label => N_("Development"), |
54 |
descr => N_("C and C++ development libraries, programs and include files"), |
55 |
flags => [ qw(DEVELOPMENT EDITORS) ], |
56 |
}, |
57 |
{ label => N_("Documentation"), |
58 |
descr => N_("Books and Howto's on Linux and Free Software"), |
59 |
flags => [ qw(BOOKS) ], |
60 |
default_selected => !$light_desktop, |
61 |
}, |
62 |
{ label => N_("LSB"), |
63 |
descr => N_("Linux Standard Base. Third party applications support"), |
64 |
flags => [ qw(LSB) ], |
65 |
}, |
66 |
), |
67 |
], |
68 |
|
69 |
N_("Server") => |
70 |
[ |
71 |
$server ? ( |
72 |
{ label => N_("Web Server"), |
73 |
descr => N_("Apache"), |
74 |
flags => [ qw(NETWORKING_WWW_SERVER) ], |
75 |
}, |
76 |
{ label => N_("Groupware"), |
77 |
descr => N_("Kolab Server"), |
78 |
flags => [ qw(NETWORKING_GROUPWARE_SERVER) ], |
79 |
}, |
80 |
{ label => N_("Firewall/Router"), |
81 |
descr => N_("Internet gateway"), |
82 |
flags => [ qw(NETWORKING_FIREWALLING_SERVER) ], |
83 |
}, |
84 |
{ label => N_("Mail/News"), |
85 |
descr => N_("Postfix mail server, Inn news server"), |
86 |
flags => [ qw(NETWORKING_MAIL_SERVER NETWORKING_NEWS_SERVER) ], |
87 |
}, |
88 |
{ label => N_("Directory Server"), |
89 |
descr => N_("LDAP Server"), |
90 |
flags => [ qw(NETWORKING_LDAP_SERVER) ], |
91 |
}, |
92 |
{ label => N_("FTP Server"), |
93 |
descr => N_("ProFTPd"), |
94 |
flags => [ qw(NETWORKING_FILE_TRANSFER_SERVER) ], |
95 |
}, |
96 |
{ label => N_("DNS/NIS"), |
97 |
descr => N_("Domain Name and Network Information Server"), |
98 |
flags => [ qw(NIS_SERVER NETWORKING_DNS_SERVER) ], |
99 |
}, |
100 |
{ label => N_("File and Printer Sharing Server"), |
101 |
descr => N_("NFS Server, Samba server"), |
102 |
flags => [ qw(NETWORKING_FILE_SERVER PRINTER) ], |
103 |
}, |
104 |
{ label => N_("Database"), |
105 |
descr => N_("PostgreSQL and MySQL Database Server"), |
106 |
flags => [ qw(DATABASES DATABASES_SERVER) ], |
107 |
}, |
108 |
) : ( |
109 |
{ label => N_("Web/FTP"), |
110 |
descr => N_("Apache, Pro-ftpd"), |
111 |
flags => [ qw(NETWORKING_WWW_SERVER NETWORKING_FILE_TRANSFER_SERVER) ], |
112 |
}, |
113 |
{ label => N_("Mail"), |
114 |
descr => N_("Postfix mail server"), |
115 |
flags => [ qw(NETWORKING_MAIL_SERVER) ], |
116 |
}, |
117 |
{ label => N_("Database"), |
118 |
descr => N_("PostgreSQL or MySQL database server"), |
119 |
flags => [ qw(DATABASES DATABASES_SERVER) ], |
120 |
}, |
121 |
{ label => N_("Firewall/Router"), |
122 |
descr => N_("Internet gateway"), |
123 |
flags => [ qw(NETWORKING_FIREWALLING_SERVER) ], |
124 |
}, |
125 |
{ label => N_("Network Computer server"), |
126 |
descr => N_("NFS server, SMB server, Proxy server, ssh server"), |
127 |
flags => [ qw(NETWORKING_FILE_SERVER NETWORKING_REMOTE_ACCESS_SERVER) ], |
128 |
}, |
129 |
), |
130 |
], |
131 |
|
132 |
N_("Graphical Environment") => |
133 |
[ |
134 |
{ label => N_("KDE Workstation"), |
135 |
descr => N_("The K Desktop Environment, the basic graphical environment with a collection of accompanying tools"), |
136 |
flags => [ qw(KDE X ACCESSIBILITY THEMES) ], |
137 |
default_selected => !$light_desktop, |
138 |
}, |
139 |
{ label => N_("GNOME Workstation"), |
140 |
descr => N_("A graphical environment with user-friendly set of applications and desktop tools"), |
141 |
flags => [ qw(GNOME X THEMES), if_(!$light_desktop, qw(ACCESSIBILITY)) ], |
142 |
default_selected => $netbook_desktop, |
143 |
}, |
144 |
{ label => N_("LXDE Desktop"), |
145 |
flags => [ qw(LXDE X ACCESSIBILITY) ], |
146 |
descr => N_("A lightweight & fast graphical environment with user-friendly set of applications and desktop tools"), |
147 |
default_selected => $low_resources, |
148 |
}, |
149 |
{ label => N_("Other Graphical Desktops"), |
150 |
descr => N_("Window Maker, Enlightenment, Fvwm, etc"), |
151 |
flags => [ qw(GRAPHICAL_DESKTOP X ACCESSIBILITY E17) ], |
152 |
}, |
153 |
], |
154 |
|
155 |
if_($server, |
156 |
N_("Development") => |
157 |
[ |
158 |
{ label => N_("Development"), |
159 |
descr => N_("C and C++ development libraries, programs and include files"), |
160 |
flags => [ qw(DEVELOPMENT EDITORS) ], |
161 |
default_selected => 1, |
162 |
}, |
163 |
{ label => N_("Documentation"), |
164 |
descr => N_("Books and Howto's on Linux and Free Software"), |
165 |
flags => [ qw(BOOKS) ], |
166 |
}, |
167 |
{ label => N_("LSB"), |
168 |
descr => N_("Linux Standard Base. Third party applications support"), |
169 |
flags => [ qw(LSB) ], |
170 |
}, |
171 |
], |
172 |
|
173 |
N_("Utilities") => |
174 |
[ |
175 |
{ label => N_("SSH Server"), |
176 |
descr => N_("SSH Server"), |
177 |
flags => [ qw(NETWORKING_REMOTE_ACCESS_SERVER) ], |
178 |
default_selected => 1, |
179 |
}, |
180 |
{ label => N_("Webmin"), |
181 |
descr => N_("Webmin Remote Configuration Server"), |
182 |
flags => [ qw(WEBMIN) ], |
183 |
default_selected => 1, |
184 |
}, |
185 |
{ label => N_("Network Utilities/Monitoring"), |
186 |
descr => N_("Monitoring tools, processes accounting, tcpdump, nmap, ..."), |
187 |
flags => [ qw(MONITORING NETWORKING_FILE) ], |
188 |
default_selected => 1, |
189 |
}, |
190 |
{ label => N_("Mageia Wizards"), |
191 |
descr => N_("Wizards to configure server"), |
192 |
flags => [ qw(WIZARDS) ], |
193 |
default_selected => 1, |
194 |
}, |
195 |
], |
196 |
), |
197 |
}; |
198 |
|
199 |
foreach my $path (keys %$h) { |
200 |
foreach (@{$h->{$path}}) { |
201 |
$_->{path} = $path; |
202 |
$_->{uid} = join('|', $path, $_->{label}); |
203 |
} |
204 |
} |
205 |
|
206 |
my $compssUsers = [ map { @$_ } values %$h ]; |
207 |
|
208 |
my $gtk_display_compssUsers = sub { |
209 |
my ($entry) = @_; |
210 |
|
211 |
require ugtk2; |
212 |
ugtk2->import(qw(:helpers :wrappers :create)); |
213 |
require mygtk2; |
214 |
mygtk2->import(qw(gtknew)); |
215 |
|
216 |
my $entries_in_path = sub { |
217 |
my ($path) = @_; |
218 |
my @items = map { $entry->($_) } @{$h->{$path}}; |
219 |
|
220 |
# ensure we have an even number of items: |
221 |
if (@items % 2) { |
222 |
my @last_items = (pop @items, gtknew('Label')); |
223 |
# RTL support: |
224 |
@last_items = reverse @last_items if lang::text_direction_rtl(); |
225 |
push @items, @last_items; |
226 |
} |
227 |
|
228 |
gtknew('Title2', label => mygtk2::asteriskize(translate($path))), |
229 |
gtknew('Table', children => [ group_by2(@items) ], homogeneous => 1), |
230 |
Gtk2::HSeparator->new; |
231 |
}; |
232 |
|
233 |
gtkpack__(Gtk2::VBox->new, |
234 |
$entries_in_path->('Workstation'), |
235 |
$server ? $entries_in_path->('Server') : (), |
236 |
$server ? ( |
237 |
$entries_in_path->('Graphical Environment'), |
238 |
$entries_in_path->('Development'), |
239 |
$entries_in_path->('Utilities'), |
240 |
) : ( |
241 |
$entries_in_path->('Server'), |
242 |
$entries_in_path->('Graphical Environment'), |
243 |
), |
244 |
); |
245 |
}; |
246 |
|
247 |
$compssUsers, $gtk_display_compssUsers; |