summaryrefslogtreecommitdiffstats
path: root/drakmenustyle
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2007-06-07 18:32:44 +0000
committerThierry Vignaud <tv@mandriva.org>2007-06-07 18:32:44 +0000
commit0ea00927f0690865c4b2c899bd6bad6cbbdd87f6 (patch)
treeb0e63f3c2cdd85121f406ee084b12c3d9560ead5 /drakmenustyle
parentc2ef129b23220c1d0dfd6d6bde9f645687b9e0c4 (diff)
downloaddrakmenustyle-0ea00927f0690865c4b2c899bd6bad6cbbdd87f6.tar
drakmenustyle-0ea00927f0690865c4b2c899bd6bad6cbbdd87f6.tar.gz
drakmenustyle-0ea00927f0690865c4b2c899bd6bad6cbbdd87f6.tar.bz2
drakmenustyle-0ea00927f0690865c4b2c899bd6bad6cbbdd87f6.tar.xz
drakmenustyle-0ea00927f0690865c4b2c899bd6bad6cbbdd87f6.zip
reimport drakmenustyle in SVN as of 0.5
Diffstat (limited to 'drakmenustyle')
-rwxr-xr-xdrakmenustyle77
1 files changed, 77 insertions, 0 deletions
diff --git a/drakmenustyle b/drakmenustyle
new file mode 100755
index 0000000..22934d5
--- /dev/null
+++ b/drakmenustyle
@@ -0,0 +1,77 @@
+#!/usr/bin/perl
+
+# menudrake2
+
+# Copyright (C) 2006 Mandriva
+# Thierry Vignaud <tvignaud@mandriva.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+use lib qw(/usr/lib/libDrakX);
+use strict;
+use standalone;
+use common;
+# i18n: IMPORTANT: to get correct namespace (drakconf instead of libDrakX)
+BEGIN { unshift @::textdomains, 'drakmenustyle' }
+use ugtk2 qw(:create :dialogs :helpers :wrappers);
+$ugtk2::wm_icon = 'drakmenustyle';
+use interactive;
+
+
+my $in = 'interactive'->vnew;
+
+my %menu_styles = (
+ if_($> != 0, use_system_settings => N("Use system administrator settings")),
+ mandriva => N("Mandriva menu"),
+ discovery => N("Discovery menu"),
+ upstream => N("Original menu (default menu from KDE/GNOME, may not contain all applications)"),
+);
+
+my $cfg_file = $> ? "$ENV{HOME}/.menustyle" : '/etc/sysconfig/menustyle';
+my %h = getVarsFromSh($cfg_file);
+
+my $default = $> ? 'use_system_settings' : 'mandriva';
+my $value = $h{MDV_MENU_STYLE} || $default;
+my $old_value = $value;
+
+$in->ask_from_(
+ { title => N("Menu Style Configuration"),
+ if_(!$::isEmbedded, banner_title => N("Menu Style")),
+ icon => '/usr/share/icons/large/drakmenustyle.png',
+ },
+ [
+ { label => N("Choose your menu style:"), title => 1 },
+ { 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]} },
+ gtk => { use_boxradio => 1 }, val => \$value,
+ },
+ ],
+) or exit(0);
+
+if ($value eq 'use_system_settings') {
+ rm_rf($cfg_file) if $> && -e $cfg_file;
+} else {
+ setVarsInSh($cfg_file, { MDV_MENU_STYLE => $value });
+}
+
+my $msg = N("The change is done, but to be effective you must logout");
+if ($old_value ne $value) {
+ if (my $wm = $> && any::running_window_manager()) {
+ $in->ask_yesorno('', $msg, 1)
+ and any::ask_window_manager_to_logout($wm);
+ } else {
+ $in->ask_warn('', $msg);
+ }
+}