1 |
dmorgan |
487 |
#!/usr/bin/perl |
2 |
|
|
|
3 |
|
|
# menudrake2 |
4 |
|
|
|
5 |
|
|
# Copyright (C) 2006,2007 Mandriva |
6 |
|
|
# Thierry Vignaud <tvignaud@mandriva.com> |
7 |
|
|
# |
8 |
|
|
# This program is free software; you can redistribute it and/or modify |
9 |
|
|
# it under the terms of the GNU General Public License as published by |
10 |
|
|
# the Free Software Foundation; either version 2, or (at your option) |
11 |
|
|
# any later version. |
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 |
|
|
use lib qw(/usr/lib/libDrakX); |
24 |
|
|
use strict; |
25 |
|
|
use standalone; |
26 |
|
|
use common; |
27 |
|
|
# i18n: IMPORTANT: to get correct namespace (drakconf instead of libDrakX) |
28 |
|
|
BEGIN { unshift @::textdomains, 'drakmenustyle' } |
29 |
|
|
use ugtk2 qw(:create :dialogs :helpers :wrappers); |
30 |
|
|
$ugtk2::wm_icon = 'drakmenustyle'; |
31 |
|
|
use interactive; |
32 |
|
|
|
33 |
|
|
|
34 |
|
|
my $in = 'interactive'->vnew; |
35 |
|
|
|
36 |
|
|
my %menu_styles = ( |
37 |
|
|
if_($> != 0, use_system_settings => N("Use system administrator settings")), |
38 |
|
|
mageia => N("Mageia menu"), |
39 |
|
|
upstream => N("Original menu (default menu from KDE/GNOME, may not contain all applications)"), |
40 |
|
|
); |
41 |
|
|
|
42 |
|
|
my $cfg_file = $> ? "$ENV{HOME}/.menustyle" : '/etc/sysconfig/menustyle'; |
43 |
|
|
my %h = getVarsFromSh($cfg_file); |
44 |
|
|
|
45 |
|
|
my $default = $> ? 'use_system_settings' : 'mageia'; |
46 |
|
|
my $value = $h{MGA_MENU_STYLE} || $default; |
47 |
|
|
my $old_value = $value; |
48 |
|
|
|
49 |
|
|
$in->ask_from_( |
50 |
|
|
{ title => N("Menu Style Configuration"), |
51 |
|
|
if_(!$::isEmbedded, banner_title => N("Menu Style")), |
52 |
|
|
icon => '/usr/share/icons/large/drakmenustyle.png', |
53 |
|
|
}, |
54 |
|
|
[ |
55 |
|
|
{ label => N("Choose your menu style:"), title => 1 }, |
56 |
|
|
{ list => [ sort { $menu_styles{use_system_settings} cmp $menu_styles{$a} or $menu_styles{$a} cmp $menu_styles{$b} } keys %menu_styles ], type => 'list', format => sub { $menu_styles{$_[0]} }, |
57 |
|
|
gtk => { use_boxradio => 1 }, val => \$value, |
58 |
|
|
}, |
59 |
|
|
], |
60 |
|
|
) or exit(0); |
61 |
|
|
|
62 |
|
|
if ($value eq 'use_system_settings') { |
63 |
|
|
rm_rf($cfg_file) if $> && -e $cfg_file; |
64 |
|
|
} else { |
65 |
|
|
setVarsInSh($cfg_file, { MGA_MENU_STYLE => $value }); |
66 |
|
|
} |
67 |
|
|
|
68 |
|
|
if ($old_value ne $value) { |
69 |
|
|
any::ask_for_X_restart($in); |
70 |
|
|
} |