summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/Wizcommon.pm95
-rw-r--r--drakwizard.spec1
-rw-r--r--installsrv_wizard/Installsrv.pm3
-rw-r--r--ldap_wizard/ldapdef.pm2
4 files changed, 4 insertions, 97 deletions
diff --git a/common/Wizcommon.pm b/common/Wizcommon.pm
index 676b3138..43971713 100644
--- a/common/Wizcommon.pm
+++ b/common/Wizcommon.pm
@@ -62,99 +62,4 @@ sub test_host_domain {
return 1;
}
-
-sub wizard_progress_bar {
- use lib qw(/usr/lib/libDrakX);
- use ugtk2 qw(:wrappers);
- my ($command, $descr) = @_;
- my ($value, $timer);
- my $my_win = ugtk2->new("");
- my $window1 = $my_win->{window};
- gtkadd($window1,
- gtkpack(Gtk2::VBox->new(0,0),
- gtkpack_(Gtk2::VBox->new(0, 3),
- 0, my $text = Gtk2::Label->new($descr),
- 0, my $text2 = Gtk2::Label->new,
- 0, Gtk2::HSeparator->new,
- 0, my $pbar = Gtk2::ProgressBar->new,
- ),
- ),
- );
- $window1->realize;
- $pbar->set_pulse_step(0.1);
-
- local *TMP;
- open(TMP, "$command 2>&1 |");
- while ($value = <TMP>) {
- $timer = Glib::Timeout->add(10, sub {});
- $pbar->pulse;
- $text2->set_text($value);
- gtkflush();
- next;
- $my_win->main;
- $window1->show_all;
- undef $value;
- }
- close TMP;
- $my_win->destroy;
- return 0;
-}
-
-
-my $timeout;
-sub gtktext_get_log {
- my ($command, $log_w, $log_scroll) = @_;
- my $buffer = $log_w->get_buffer;
- $buffer->delete($buffer->get_start_iter, $buffer->get_end_iter);
-
- my ($prev_scroll, $want_scroll_down) = (0, 1);
- my $pid = open(my $F, "$command 2>&1 |") or return sub { 1 };
- fcntl($F, c::F_SETFL(), c::O_NONBLOCK()) or die "can't fcntl F_SETFL: $!";
- Glib::Source->remove($timeout) if $timeout; $timeout = '';
- $timeout = Glib::Timeout->add(100, sub {
- if ($buffer) {
- my $end = $buffer->get_end_iter;
- while (defined (my $s = <$F>)) {
- $buffer->insert_interactive($end, $s, -1);
- }
- my $new_scroll = $log_scroll->child->get_vadjustment->get_value;
- $want_scroll_down &&= $new_scroll >= $prev_scroll;
- $prev_scroll = $new_scroll;
- $log_w->scroll_to_iter($end, 0, 0, 0, 0) if $want_scroll_down;
- }
- if (waitpid($pid, c::WNOHANG()) > 0) {
- $buffer->insert_interactive($buffer->get_end_iter, "\n" . "#" x 20 . "\n" . " This script has terminated,\nyou can close this window", -1) if $buffer;
- $pid = $timeout = '';
- 0;
- } else {
- 1;
- }
- });
- sub {
- if ($pid) {
- $::in->ask_yesorno('', N("The command is still running. Do you want to kill it and quit the Wizard?")) or return;
- kill 9, $pid+1;
- 1;
- }
- $buffer = '';
- 1;
- };
-}
-
-sub run_command_and_log {
- use lib qw(/usr/lib/libDrakX);
- my ($command, $descr, $when_command_is_over) = @_;
- my $w = ugtk2->new('');
- gtkadd(gtkset_size_request($w->{window}, 800, 400),
- gtkpack_(gtkset_modal(Gtk2::VBox->new, 1),
- 0, $descr,
- 1, my $log_scroll = create_scrolled_window(my $log_w = gtkset_editable(Gtk2::TextView->new, 0)),
- 0, my $close_w = Gtk2::Button->new(N("Close"))),
- );
- my $stop_running = gtktext_get_log($command, $log_w, $log_scroll);
- $close_w->signal_connect(clicked => sub { $stop_running->() and $w->destroy and return 0 });
- $close_w->grab_focus;
- $w->show;
-}
-
1;
diff --git a/drakwizard.spec b/drakwizard.spec
index e0cfda7d..5639b1a2 100644
--- a/drakwizard.spec
+++ b/drakwizard.spec
@@ -58,6 +58,7 @@ rm -rf $RPM_BUILD_DIR/$RPM_PACKAGE_NAME
%{perl_vendorlib}/MDK/Wizard/Postfix.pm
%{perl_vendorlib}/MDK/Wizard/Varspaceval.pm
%{perl_vendorlib}/MDK/Wizard/Wizcommon.pm
+%{perl_vendorlib}/MDK/Wizard/Wizcommon_gtk2.pm
%{perl_vendorlib}/MDK/Wizard/IFCFG.pm
%{perl_vendorlib}/MDK/Wizard/Samba.pm
%{perl_vendorlib}/MDK/Wizard/Sambaprint.pm
diff --git a/installsrv_wizard/Installsrv.pm b/installsrv_wizard/Installsrv.pm
index 8a407a00..620bea02 100644
--- a/installsrv_wizard/Installsrv.pm
+++ b/installsrv_wizard/Installsrv.pm
@@ -28,6 +28,7 @@ use common;
use services;
use MDK::Wizard::Varspaceval;
use MDK::Wizard::Wizcommon;
+use MDK::Wizard::Wizcommon_gtk2;
# test root capa
@@ -152,7 +153,7 @@ sub do_it {
my $D = $o->{var}{DESTDIR};
if (! -d $D) { mkdir_p($D) }
my $command = "cp -av $S/* $D";
- MDK::Wizard::Wizcommon::wizard_progress_bar($command, "Copying Data...");
+ MDK::Wizard::Wizcommon_gtk2::wizard_progress_bar($command, "Copying Data...");
add_install_dir();
add_http_link($o->{var}{DESTDIR});
diff --git a/ldap_wizard/ldapdef.pm b/ldap_wizard/ldapdef.pm
index d731d24f..d1227217 100644
--- a/ldap_wizard/ldapdef.pm
+++ b/ldap_wizard/ldapdef.pm
@@ -56,7 +56,7 @@ sub get_dn {
base => $basedn,
filter => $filter,
scope => "sub",
- #attrs => $attrs
+* #attrs => $attrs
);
#my $entry = "";
#foreach $entry ($mesg->entries) {