diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2003-08-13 11:35:43 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2003-08-13 11:35:43 +0000 |
commit | fd577d80dd00461f3830b23a9f0a124a0bcd8a3d (patch) | |
tree | cb7844f55bae64085645aebbd398f68e1417b738 /edit-urpm-sources.pl | |
parent | 7d686bd9f790ea56f3f49555b10b05bb6df30aa3 (diff) | |
download | rpmdrake-fd577d80dd00461f3830b23a9f0a124a0bcd8a3d.tar rpmdrake-fd577d80dd00461f3830b23a9f0a124a0bcd8a3d.tar.gz rpmdrake-fd577d80dd00461f3830b23a9f0a124a0bcd8a3d.tar.bz2 rpmdrake-fd577d80dd00461f3830b23a9f0a124a0bcd8a3d.tar.xz rpmdrake-fd577d80dd00461f3830b23a9f0a124a0bcd8a3d.zip |
finish off "manage keys"
Diffstat (limited to 'edit-urpm-sources.pl')
-rwxr-xr-x | edit-urpm-sources.pl | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/edit-urpm-sources.pl b/edit-urpm-sources.pl index 4927f7ac..ed6ba11c 100755 --- a/edit-urpm-sources.pl +++ b/edit-urpm-sources.pl @@ -478,13 +478,15 @@ sub keys_callback { }; my $write = sub { $urpm->write_config; - $urpm = urpm->new; - $urpm->read_config; + $urpm = urpm->new; + $urpm->read_config; $read_conf->(); + $media_list->get_selection->signal_emit('changed'); }; $read_conf->(); my $key_name = sub { - $urpm->{keys}{$_[0] || {}}{name} || N("no name found"); + exists $urpm->{keys}{$_[0]} ? $urpm->{keys}{$_[0]}{name} + : N("no name found, key doesn't exist in rpm keyring!"); }; $media_list_ls->append_set([ 0 => $_->{name} ]) foreach @{$urpm->{media}}; @@ -498,6 +500,31 @@ sub keys_callback { }); my $add_key = sub { + my $w = ugtk2->new(N("Add a key")); + my $available_keyz_ls = Gtk2::ListStore->new("Glib::String", "Glib::String"); + my $available_keyz = Gtk2::TreeView->new_with_model($available_keyz_ls); + $available_keyz->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0)); + $available_keyz->set_headers_visible(0); + $available_keyz->get_selection->set_mode('browse'); + $available_keyz_ls->append_set([ 0 => sprintf("%s (%s)", $_, $key_name->($_)), 1 => $_ ]) foreach keys %{$urpm->{keys}}; + my $key; + gtkadd($w->{window}, + gtkpack__(Gtk2::VBox->new(0, 5), + Gtk2::Label->new(N("Choose a key for adding to the medium %s", $current_medium)), + $available_keyz, + Gtk2::HSeparator->new, + gtkpack(create_hbox(), + gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => sub { + my ($model, $iter) = $available_keyz->get_selection->get_selected; + $model && $iter and $key = $model->get($iter, 1); + Gtk2->main_quit; + }), + gtksignal_connect(Gtk2::Button->new(N("Cancel")), clicked => sub { Gtk2->main_quit })))); + $w->main; + if (defined $key) { + $urpm->{media}[$current_medium_nb]{'key-ids'} = join(',', sort(uniq(@{$keys[$current_medium_nb]}, $key))); + $write->(); + } }; my $remove_key = sub { @@ -510,7 +537,6 @@ sub keys_callback { yesno => 1) or return; $urpm->{media}[$current_medium_nb]{'key-ids'} = join(',', difference2(\@{$keys[$current_medium_nb]}, [ $key ])); $write->(); - $media_list->get_selection->signal_emit('changed'); }; gtkadd($w->{window}, |