diff options
author | Eugeni Dodonov <eugeni@mandriva.org> | 2009-08-14 15:31:39 +0000 |
---|---|---|
committer | Eugeni Dodonov <eugeni@mandriva.org> | 2009-08-14 15:31:39 +0000 |
commit | cc65b8d0cc6c0ced59285cf34f6c3c8f8ef17fdd (patch) | |
tree | daeeeae2020dc5dad57024da41bc546dc554f59c /bin | |
parent | 6626fd4c393477c4686a7823c03660a983c3accf (diff) | |
download | drakx-net-cc65b8d0cc6c0ced59285cf34f6c3c8f8ef17fdd.tar drakx-net-cc65b8d0cc6c0ced59285cf34f6c3c8f8ef17fdd.tar.gz drakx-net-cc65b8d0cc6c0ced59285cf34f6c3c8f8ef17fdd.tar.bz2 drakx-net-cc65b8d0cc6c0ced59285cf34f6c3c8f8ef17fdd.tar.xz drakx-net-cc65b8d0cc6c0ced59285cf34f6c3c8f8ef17fdd.zip |
Implemented netprofile module management.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/draknetprofile | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/bin/draknetprofile b/bin/draknetprofile index d226648..f938698 100755 --- a/bin/draknetprofile +++ b/bin/draknetprofile @@ -62,6 +62,23 @@ Gtk2::SimpleList->add_column_type( attr => 'active', ); +my $modules_list = Gtk2::SimpleList->new( + N("Module") => 'hidden', + N("Enabled") => 'bool', + N("Description") => 'text', +); + +my @r = $modules_list->get_column(0)->get_cell_renderers; +$r[0]->signal_connect('toggled' => sub { + my ($_renderer, $row, $_col) = @_; + if ($modules_list->{data}[$row][1]) { + network::network::netprofile_module_enable($modules_list->{data}[$row][0]); + } else { + network::network::netprofile_module_disable($modules_list->{data}[$row][0]); + } + }); + + my $profiles_list = Gtk2::SimpleList->new( "" => 'hidden', N("Profile") => 'text', @@ -74,6 +91,17 @@ $profiles_list->get_selection->signal_connect('changed' => sub { } }); +sub load_netprofile_modules() { + my @modules = network::network::netprofile_modules(); + foreach (@modules) { + push @{$modules_list->{data}}, [ + $_->{module}, + $_->{enabled}, + $_->{description}, + ]; + } +} + sub get_selected_profile() { my ($index) = $profiles_list->get_selected_indices; if (not $index ) { @@ -164,7 +192,9 @@ sub delete_selected_profile() { gtkadd($w->{window}, gtknew('VBox', spacing => 5, children => [ $::isEmbedded ? () : (0, Gtk2::Banner->new('draknetprofile', $title)), - 0, gtknew('WrappedLabel', text => N("This tool allows to activate an existing network profile, and to manage (clone, delete) profiles.") . "\n\n" . N("To modify a profile, you have to activate it first.")), + 0, gtknew('WrappedLabel', text => N("This tool allows to control network profiles.")), + 1, gtknew('ScrolledWindow', width => 300, height => 150, child => $modules_list), + 0, gtknew('WrappedLabel', text => N("Select a network profile:")), 1, gtknew('ScrolledWindow', width => 300, height => 150, child => $profiles_list), 0, gtknew('HButtonBox', children_loose => [ $buttons{activate} = gtknew('Button', text => N("Activate"), clicked => \&set_selected_profile, sensitive => 0), @@ -175,5 +205,6 @@ gtkadd($w->{window}, ]), ); +load_netprofile_modules(); update_profiles(); $w->main; |