#!/usr/bin/perl

use lib qw(/usr/lib/libDrakX);
use strict;

use standalone;     #- warning, standalone must be loaded very first, for 'explanations'
use interactive;
use common;

local $_ = join '', @ARGV;

/-h/ and die "usage: drakxconf\n";
/-version/ and die 'version: $Id$\n';

my $in = 'interactive'->vnew('su', 'default');

my @l = map {
    my $path;
    foreach my $i (split (":", $ENV{PATH})) { 
        my $j = "$i/$_->{cmd}";
        $path = $j if -x $j;
    }
    { des => $_->{des}, cmd => $path };
} (
   { des => N("Display Configuration"), cmd => 'XFdrake' },
   { des => N("KeyBoard Configuration"), cmd => 'keyboarddrake' },
   { des => N("Mouse Configuration"), cmd => 'mousedrake' },
   { des => N("Internet & Network"), cmd => 'drakconnect' },
   { des => N("Add new users"), cmd => 'adduserdrake' },
   { des => N("Service Configuration"), cmd => 'drakxservices' },
   { des => N("Firewall"), cmd => 'tinyfirewall' },
   { des => N("Boot Configuration"), cmd => 'drakboot' },
   { des => N("Auto Install"), cmd => 'drakautoinst' },
   { des => N("Connection Sharing"), cmd => 'drakgw' },
   { des => N("Disk Partionning"), cmd => 'diskdrake' }
   );

my $choice = $in->ask_from_listf(N("Control Center"), N("Choose the tool you want to use"), sub { $_[0]{des} }, \@l)
    or $in->exit(1);
$in->end;

exec $choice->{cmd}, @ARGV or $in->exit(1);