From 0ea00927f0690865c4b2c899bd6bad6cbbdd87f6 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 7 Jun 2007 18:32:44 +0000 Subject: reimport drakmenustyle in SVN as of 0.5 --- drakmenustyle | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100755 drakmenustyle (limited to 'drakmenustyle') 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 +# +# 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); + } +} -- cgit v1.2.1