From 34e7b6bfe675389b3e210f07679da75001f7a7cd Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 10 Mar 2005 15:41:55 +0000 Subject: enable to upload the hardware list --- perl-install/standalone/harddrake2 | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'perl-install/standalone/harddrake2') diff --git a/perl-install/standalone/harddrake2 b/perl-install/standalone/harddrake2 index 8621622d2..9d9db96ea 100755 --- a/perl-install/standalone/harddrake2 +++ b/perl-install/standalone/harddrake2 @@ -185,6 +185,7 @@ my %menu_options = ( my @menu_items = ( [ N("/_File"), undef, undef, undef, '' ], + [ N("/_File") . N("/_Upload the hardware list"), undef, \&upload, undef, '' ], [ N("/_File") . N("/_Quit"), N("Q"), \&quit_global, undef, '' ], [ join('', @{$menu_options{PRINTERS_DETECTION}}), undef, sub { $options{PRINTERS_DETECTION} = $check_boxes{PRINTERS_DETECTION}->get_active }, undef, '' ], @@ -519,3 +520,43 @@ sub popup_menu { return 0; }; } + +sub upload { + my $dialog = _create_dialog(N("Upload the hardware list"), + { if_(!$::isEmbedded, transient => $w->{real_window}) }); #, height => 400 + gtkpack($dialog->vbox, + gtkset_markup(Gtk2::Label->new, qq() . N("Upload the system configuration") . "\n"), + create_packtable({ col_spacings => 10, row_spacings => 5, mcc => 1 }, + [ N("Account:"), my $account_w = Gtk2::Entry->new ], + [ N("Password:"), my $password_w = Gtk2::Entry->new ], + [ N("Hostname:"), my $system_name_w = Gtk2::Entry->new ], + ), + ); +$password_w->set_visibility(0); #set_invisible_char('*'); + + my ($password, $account, $name); + gtkadd($dialog->action_area, + create_okcancel( + { + cancel_clicked => sub { $dialog->destroy; Gtk2->main_quit }, + ok_clicked => sub { + $name = $system_name_w->get_text; + $account = $account_w->get_text; + $password = $password_w->get_text; + $dialog->destroy; + Gtk2->main_quit; + }, + }, + undef, undef, '', + ), + ); + + $dialog->set_has_separator(0); + $dialog->show_all; + Gtk2->main; + if ($account) { + local $ENV{HWDB_PASSWD} = $password; + require run_program; + run_program::raw({ detach => 1 }, "/usr/sbin/hwdb_add_system", $account, $name); + } +} -- cgit v1.2.1