[Patch] New backend reporting scheme



I've implemented a scheme (actually a small protocol) by which the backends
communicate their activities to any frontend that might be listening. The
frontends currently display these activities in a messagebox underneath the
progress bar.

Run the backends with the --report, --progress or --verbose flags (in any
combination) to see how it looks.

Take a look at the code for any one of the backends to see how it works.
Making a backend is quite a bit easier than before, and will get easier. Also
it involves a lot less c/p now.

In case you wanna get down with the changes, yo, I'm attaching the patch. By
the time you're reading this, it should be committed.


Related TODO
------------

- Add more (and more correct) report messages to all the backends.

- Make the frontend progress window have a [Details >>] button that expands
  to a vertical list of the messages as they come in. This list might also
  have a [Save to file] button.

- Do a 5-second countdown before closing the progress window. If the user
  shows any interface before or during this interval, stop the countdown and
  require her to press a [Close] button before continuing.

- Show a similar progress window when updating (saving) the configuration,
  and add progress and reports to the "set" methods in all backends.

- Make a uniform --help text for the backends, with hooks for a short
  per-backend description. Arturo's recommendation.

I'm taking care of these.


Backend coding guidelines
-------------------------

Messaging from backends is now done differently - instead of checking the
verbose flag and printing to STDERR, you call the appropriate backend
function with a two-digit decimal number (00-99), which represents the
message's ID, and a human-readable string describing the message.

Allocate your message IDs from the bottom (0, 1, ...). The common functions
allocate their IDs from the top (99, 98, ...). The info, warning, error and
fatal ID spaces are separate.

Perl functions added:

be_report_info(id, text);
be_report_warning(id, text);
be_report_error(id, text);
be_report_fatal(id, text);

be_init(@ARGV);  # Call at beginning of program. Also parses your arguments.
be_end();        # Call after processing, but before printing any XML.


--
Hans Petter
? out
? helix-setup-tools-0.2.1.tar.gz
? configure.in.temp
? backends/test.pl
? backends/REFORM
? doc/nameresolution/dns.html
? doc/nameresolution/gpl.html
? doc/nameresolution/identification.html
? doc/nameresolution/index.html
? doc/nameresolution/intro.html
? doc/nameresolution/searchdomains.html
? doc/nameresolution/staticnames.html
? doc/nameresolution/wins.html
? doc/networking/gpl.html
? doc/networking/index.html
? doc/networking/intro.html
? doc/networking/primary.html
? doc/shares/exporting.html
? doc/shares/gpl.html
? doc/shares/importing.html
? doc/shares/index.html
? doc/shares/intro.html
? src/disks/disks.desktop.menu
? src/disks/disks.desktop.cc
? src/disks/disks.security
? src/memory/memory.desktop.menu
? src/memory/memory.desktop.cc
? src/memory/memory.security
? src/nameresolution/nameresolution.desktop.menu
? src/nameresolution/nameresolution.desktop.cc
? src/nameresolution/nameresolution.security
? src/networking/networking.desktop.menu
? src/networking/networking.desktop.cc
? src/networking/networking.security
? src/shares/shares.desktop.menu
? src/shares/shares.desktop.cc
? src/shares/shares.security
? src/time/time.desktop.menu
? src/time/time.desktop.cc
? src/time/time.security
Index: backends/be.pl
===================================================================
RCS file: /cvs/gnome/helix-setup-tools/backends/be.pl,v
retrieving revision 1.15
diff -r1.15 be.pl
33d32
< $be_progress = 0;
41a41,42
> $be_progress_current = 0;  # Compat with old $progress_max use.
> $be_progress_last_percentage = 0;
43c44
< sub be_print_progress
---
> sub be_progress
45c46,96
<   if ($be_progress) { print "."; }
---
>   $prc = @_[0];
> 
>   if ($prc < $be_progress_last_percentage)
>   {
>     # Don't go backwards.
>     $prc = $be_progress_last_percentage;
>   }
> 
>   if ($prc >= 100)
>   {
>     # Don't go above 99%.
>     $prc = 99;
>   }
> 
>   if ($be_progress) { printf "%03d percent done.\n", $prc; }
> 
>   $be_progress_last_percentage = $prc;
> }
> 
> sub be_progress_begin { be_progress(0); }
> 
> sub be_progress_end { be_progress(99); }
> 
> sub be_print_progress  # Compat with old $progress_max use.
> {
>   my $prc;
> 
>   $be_progress_current++;
>   be_progress(($be_progress_current * 100) / $progress_max);
> }
> 
> 
> # --- Report printing --- #
> 
> sub be_report
> {
>   if ($be_reporting)
>   {
>     printf "%1d%02d %s.\n", @_[0], @_[1], @_[2];
>   }
> }
> 
> sub be_report_begin
> {
>   be_report(1, 00, "Start of work report");
> }
> 
> sub be_report_end
> {
>   be_report(1, 01, "End of work report");
>   print "\n";
47a99,139
> sub be_report_info
> {
>   if ($be_verbose)
>   {
>     printf STDERR "%s.\n", @_[1];
>   }
> 
>   be_report(2, @_[0], @_[1]);
> }
> 
> sub be_report_warning
> {
>   if ($be_verbose)
>   {
>     printf STDERR "Warning: %s.\n", @_[1];
>   }
> 
>   be_report(3, @_[0], @_[1]);
> }
> 
> sub be_report_error
> {
>   if ($be_verbose)
>   {
>     printf STDERR "Error: %s.\n", @_[1];
>   }
> 
>   be_report(4, @_[0], @_[1]);
> }
> 
> sub be_report_fatal
> {
>   if ($be_verbose)
>   {
>     printf STDERR "Fatal error: %s.\n", @_[1];
>   }
> 
>   be_report(5, @_[0], @_[1]);
> }
> 
> 
314,321c406,408
<   {
<     local *FILE;
<     my $fname = "";
<     
<     foreach $name (@_)
<       {
< 	if (open(FILE, "$be_prefix/$name")) { $fname = $name; last; }
<       }
---
> {
>   local *FILE;
>   my $fname = "";
323,325c410,413
<     if ($be_verbose)
<       {
< 	(my $fullname = "$be_prefix/$fname") =~ tr/\//\//s;  # '//' -> '/'	
---
>   foreach $name (@_)
>   {
>     if (open(FILE, "$be_prefix/$name")) { $fname = $name; last; }
>   }
327,337c415,423
< 	if ($fname ne "") 
< 	  { 
< 	    print STDERR "Reading options from \"$fullname\".\n"; 
< 	  }
< 	else 
< 	  { 
< 	    print STDERR "Could not read \[@_\].\n"; 
< 	  }
<       }
<     
<     return *FILE;
---
>   (my $fullname = "$be_prefix/$fname") =~ tr/\//\//s;  # '//' -> '/'	
> 
>   if ($fname ne "") 
>   { 
>     be_report_info(99, "Reading options from \"$fullname\"");
>   }
>   else 
>   { 
>     be_report_warning(99, "Could not read \[@_\]");
338a425,427
>     
>   return *FILE;
> }
360c449
< 	    if ($be_verbose) { print STDERR "No file to replace: \[@_\].\n"; }
---
> 	    be_report_warning(98, "No file to replace: \[@_\]");
366,370c455,456
< 	    if ($be_verbose)
< 	      {
< 		(my $fullname = "$be_prefix/$name") =~ tr/\//\//s;
< 		print STDERR "Could not find \[@_\]. Writing to \"$fullname\".\n";
< 	      }
---
> 	    (my $fullname = "$be_prefix/$name") =~ tr/\//\//s;
> 	    be_report_warning(97, "Could not find \[@_\]. Writing to \"$fullname\"");
373c459
<     elsif ($be_verbose)
---
>     else
376c462
< 	print STDERR "Found \"$name\". Writing to \"$fullname\".\n";
---
> 	be_report_info(98, "Found \"$name\". Writing to \"$fullname\".\n");
397c483
< 	print STDERR "Error: Failed to write to \"$name\". Are you root?\n";
---
> 	be_report_error(99, "Failed to write to \"$name\"");
423c509
< 	    if ($be_verbose) { print STDERR "No file to patch: \[@_\].\n"; }
---
> 	    be_report_warning(98, "No file to patch: \[@_\]");
429,433c515,516
< 	    if ($be_verbose)
< 	      {
< 		(my $fullname = "$be_prefix/$name") =~ tr/\//\//s;
< 		print STDERR "Could not find \[@_\]. Patching \"$fullname\".\n";
< 	      }
---
> 	    (my $fullname = "$be_prefix/$name") =~ tr/\//\//s;
> 	    be_report_warning(97, "Could not find \[@_\]. Patching \"$fullname\"");
436c519
<     elsif ($be_verbose)
---
>     else
439c522
< 	print STDERR "Found \"$name\". Patching \"$fullname\".\n";
---
> 	be_report_info(98, "Found \"$name\". Patching \"$fullname\"");
464c547
< 	print STDERR "Error: Failed to write to \"$name\". Are you root?\n";
---
> 	be_report_error(99, "Failed to write to \"$name\"");
572c655
< # --- Others ---
---
> # --- Others --- #
574c657
< $be_operation = "";		# Major operation user wants to perform. [get | set | filter]
---
> $be_operation = "";  # Major operation user wants to perform. [get | set | filter]
589c672,677
< 1;
---
> sub be_begin
> {
>   $| = 1;
>   be_report_begin();
>   be_progress_begin();
> }
590a679,734
> sub be_end
> {
>   be_progress_end();
>   be_report_end();
> }
> 
> 
> # --- Argument parsing --- #
> 
> sub be_init()
> {
>   my @args = @_;
> 
>   while (@args)
>   {
>     if    ($args[0] eq "--get"    || $args[0] eq "-g") { be_set_operation("get"); }
>     elsif ($args[0] eq "--set"    || $args[0] eq "-s") { be_set_operation("set"); }
>     elsif ($args[0] eq "--filter" || $args[0] eq "-f") { be_set_operation("filter"); }
>     elsif ($args[0] eq "--help"   || $args[0] eq "-h") { print $Usage; exit(0); }
>     elsif ($args[0] eq "--version")                    { print "$version\n"; exit(0); }
>     elsif ($args[0] eq "--prefix" || $args[0] eq "-p")
>     {
>       if ($be_prefix ne "")
>       {
>         print STDERR "Error: You may specify --prefix only once.\n\n";
>         print STDERR $Usage; exit(1);
>       }
> 
>       $be_prefix = $args[1];
> 
>       if ($be_prefix eq "")
>       {
>         print STDERR "Error: You must specify an argument to the --prefix option.\n\n";
>         print STDERR $Usage; exit(1);
>       }
> 
>       shift @args;  # For the argument.
>     }
>     elsif ($args[0] eq "--disable-immediate")           { $be_do_immediate = 0; }
>     elsif ($args[0] eq "--verbose" || $args[0] eq "-v") { $be_verbose = 1; }
>     elsif ($args[0] eq "--progress")                    { $be_progress = 1; }
>     elsif ($args[0] eq "--report")                      { $be_reporting = 1; }
>     else
>     {
>       print STDERR "Error: Unrecognized option '$args[0]'.\n\n";
>       print STDERR $Usage; exit(1);
>     }
> 
>     shift @args;
>   }
> 
>   be_begin();
> }
> 
> 
> 1;
Index: backends/disks-conf.in
===================================================================
RCS file: /cvs/gnome/helix-setup-tools/backends/disks-conf.in,v
retrieving revision 1.13
diff -r1.13 disks-conf.in
454,457c454
<         if ($be_verbose)
<         {
<           print STDERR "Adding " . $cf_disks[$i]->{partitions}[$j]->{device} . " to fstab.\n";
<         }
---
>         be_report_info(01, "Adding " . $cf_disks[$i]->{partitions}[$j]->{device} . " to fstab");
535c532
<     if ($be_verbose) { print STDERR "Looking for partitions on $dev.\n"; }
---
>     be_report_info(02, "Looking for partitions on $dev");
575c572
<     if ($be_verbose) { print STDERR "Querying size of $dev.\n"; }
---
>     be_report_info(03, "Querying size of $dev");
775,778d771
<   if ($be_progress) { $| = 1; print $progress_max . "\n"; }
< 
<   if ($be_verbose) { print STDERR "Getting system configuration, generating XML output.\n"; }
< 
782,783c775
<   if ($be_verbose) { print STDERR "Printing XML.\n"; }
<   if ($be_progress) { print "\n"; }
---
>   be_end();
811,814c803
<           if ($be_verbose)
<           {
<             print STDERR "Mounting " . $cf_disks[$i]->{partitions}[$j]->{device} . ".\n";
<           }
---
>           be_report_info(04, "Mounting " . $cf_disks[$i]->{partitions}[$j]->{device});
820,823c809
<           if ($be_verbose)
<           {
<             print STDERR "Unmounting " . $cf_disks[$i]->{partitions}[$j]->{device} . ".\n";
<           }
---
>           be_report_info("Unmounting " . $cf_disks[$i]->{partitions}[$j]->{device});
831c817
<     if ($be_verbose) { print STDERR "Warning: Could not find mount tools. No mounting done.\n"; }
---
>     be_report_error(01, "Could not find mount tools. No mounting done");
838,840d823
<   if ($be_verbose) { print STDERR "Setting system configuration from XML input.\n"; }
< 
<   if ($be_verbose) { print STDERR "Parsing XML.\n"; }
847d829
<     if ($be_verbose) { print STDERR "Changing running configuration via local utilities.\n"; }
849a832,833
>   
>   be_end();
858a843
>   be_end();
865,903c850
< # Process options.
< 
< while (@ARGV)
< {
<   if    ($ARGV[0] eq "--get"    || $ARGV[0] eq "-g") { be_set_operation("get"); }
<   elsif ($ARGV[0] eq "--set"    || $ARGV[0] eq "-s") { be_set_operation("set"); }
<   elsif ($ARGV[0] eq "--filter" || $ARGV[0] eq "-f") { be_set_operation("filter"); }
<   elsif ($ARGV[0] eq "--help"   || $ARGV[0] eq "-h") { print $Usage; exit(0); }
<   elsif ($ARGV[0] eq "--version")                    { print "$version\n"; exit(0); }
<   elsif ($ARGV[0] eq "--prefix" || $ARGV[0] eq "-p")
<   {
<     if ($be_prefix ne "")
<     {
<       print STDERR "Error: You may specify --prefix only once.\n\n";
<       print STDERR $Usage; exit(1);
<     }
< 
<     $be_prefix = $ARGV[1];
< 
<     if ($be_prefix eq "")
<     {
<       print STDERR "Error: You must specify an argument to the --prefix option.\n\n";
<       print STDERR $Usage; exit(1);
<     }
< 
<     shift @ARGV;  # For the argument.
<   }
<   elsif ($ARGV[0] eq "--disable-immediate")           { $be_do_immediate = 0; }
<   elsif ($ARGV[0] eq "--verbose" || $ARGV[0] eq "-v") { $be_verbose = 1; }
<   elsif ($ARGV[0] eq "--progress")                    { $be_progress = 1; }
<   else
<   {
<     print STDERR "Error: Unrecognized option '$ARGV[0]'.\n\n";
<     print STDERR $Usage; exit(1);
<   }
< 
<   shift @ARGV;
< }
< 
---
> be_init(@ARGV);
915d861
< 
Index: backends/memory-conf.in
===================================================================
RCS file: /cvs/gnome/helix-setup-tools/backends/memory-conf.in,v
retrieving revision 1.14
diff -r1.14 memory-conf.in
313c313
<     if ($be_verbose) { print STDERR "Looking for partitions on $dev.\n"; }
---
>     be_report_info(01, "Looking for partitions on $dev");
345c345
<     if ($be_verbose) { print STDERR "Querying size of $dev.\n"; }
---
>     be_report_info(02, "Querying size of $dev");
394,398c394
<     if (not *FSTAB_FILE) 
<       {
< 	print STDERR "Could not find file.\n";
< 	return; 
<       }
---
>     if (not *FSTAB_FILE) { return; }
412c408
< 	if ($be_verbose) { print STDERR "Found swap entry:\n$_"; }
---
> 	be_report_info(03, "Found swap entry $device");
452,459c448
<     if ($be_progress) { $| = 1; print $progress_max . "\n"; }
< 
<     if ($be_verbose) 
<       { 
< 	print STDERR "Getting system configuration, generating XML output.\n";
<       }
<     
<     if ($be_verbose) { print STDERR "Getting swap entries.\n"; }
---
>     be_report_info(04, "Getting swap entries");
465,466c454
<     if ($be_verbose) { print STDERR "Printing XML.\n"; }
<     if ($be_progress) { print "\n"; }
---
>     be_end();
557,562d544
<     if ($be_verbose) 
<       { 
< 	print STDERR "Setting system configuration from XML input.\n"; 
<       }
< 
<     if ($be_verbose) { print STDERR "Parsing XML.\n"; }
567,571d548
< 	if ($be_verbose) 
< 	  { 
< 	    print STDERR 
< 	      "Changing running configuration via local utilities.\n"; 
< 	  }
574a552,553
> 
>     be_end();
583a563
>     be_end();
590,628c570
< # Process options.
< 
< while (@ARGV)
<   {
<     if    ($ARGV[0] eq "--get"    || $ARGV[0] eq "-g") { be_set_operation("get"); }
<     elsif ($ARGV[0] eq "--set"    || $ARGV[0] eq "-s") { be_set_operation("set"); }
<     elsif ($ARGV[0] eq "--filter" || $ARGV[0] eq "-f") { be_set_operation("filter"); }
<     elsif ($ARGV[0] eq "--help"   || $ARGV[0] eq "-h") { print $Usage; exit(0); }
<     elsif ($ARGV[0] eq "--version")                    { print "$version\n"; exit(0); }
<     elsif ($ARGV[0] eq "--prefix" || $ARGV[0] eq "-p")
<       {
< 	if ($be_prefix ne "")
< 	  {
< 	    print STDERR "Error: You may specify --prefix only once.\n\n";
< 	    print STDERR $Usage; exit(1);
< 	  }
< 	
< 	$be_prefix = $ARGV[1];
< 	
< 	if ($be_prefix eq "")
< 	  {
< 	    print STDERR "Error: You must specify an argument to the --prefix option.\n\n";
< 	    print STDERR $Usage; exit(1);
< 	  }
< 	
< 	shift @ARGV;		# For the argument.
<       }
<     elsif ($ARGV[0] eq "--disable-immediate")           { $be_do_immediate = 0; }
<     elsif ($ARGV[0] eq "--verbose" || $ARGV[0] eq "-v") { $be_verbose = 1; }
<     elsif ($ARGV[0] eq "--progress")                    { $be_progress = 1; }
<     else
<       {
< 	print STDERR "Error: Unrecognized option '$ARGV[0]'.\n\n";
< 	print STDERR $Usage; exit(1);
<       }
< 
<     shift @ARGV;
<   }
< 
---
> be_init(@ARGV);
Index: backends/nameresolution-conf.in
===================================================================
RCS file: /cvs/gnome/helix-setup-tools/backends/nameresolution-conf.in,v
retrieving revision 1.12
diff -r1.12 nameresolution-conf.in
1082c1082
<     if ($be_verbose) { print STDERR "Warning: Couldn't find a configured network device.\n"; }
---
>     be_report_warning(01, "Couldn't find a configured network device");
1093c1093
<   if (($cf_domain_reverse eq "" || $cf_hostname_reverse eq "") && $be_verbose)
---
>   if (($cf_domain_reverse eq "" || $cf_hostname_reverse eq ""))
1095c1095
<     print STDERR "Warning: Couldn't get reverse names for this host.\n";
---
>     be_report_warning(02, "Couldn't get reverse names for this host");
1102,1105d1101
<   if ($be_progress) { $| = 1; print $progress_max . "\n"; }
< 
<   if ($be_verbose) { print STDERR "Getting system configuration, generating XML output.\n"; }
< 
1114,1115d1109
< 
<   if ($be_verbose) { print STDERR "Getting reverse names.\n"; }
1118,1119c1112
<   if ($be_verbose) { print STDERR "Printing XML.\n"; }
<   if ($be_progress) { print "\n"; }
---
>   be_end();
1139c1132
< 	if ($be_verbose) { print STDERR "Warning: Failed to set runtime hostname. Are you root?\n"; }
---
> 	be_report_warning(03, "Failed to set runtime hostname");
1141c1134
<       elsif ($be_verbose)
---
>       else
1143c1136
<         print STDERR "Runtime hostname set.\n";
---
>         be_report_info(01, "Runtime hostname set");
1146c1139
<     elsif ($be_verbose)
---
>     else
1148c1141
<       print STDERR "Warning: No hostname specified; runtime hostname not set.\n";
---
>       be_report_warning("No hostname specified; runtime hostname not set");
1151c1144
<   elsif ($be_verbose)
---
>   else
1153c1146
<     print STDERR "Warning: No hostname command found; runtime hostname not set.\n";
---
>     be_report_warning("No hostname command found; runtime hostname not set");
1182,1184d1174
<   if ($be_verbose) { print STDERR "Setting system configuration from XML input.\n"; }
< 
<   if ($be_verbose) { print STDERR "Parsing XML.\n"; }
1198d1187
<     if ($be_verbose) { print STDERR "Changing running configuration via local utilities.\n"; }
1200a1190,1191
>   
>   be_end();
1209a1201
>   be_end();
1216,1254c1208
< # Process options.
< 
< while (@ARGV)
< {
<   if    ($ARGV[0] eq "--get"     || $ARGV[0] eq "-g") { be_set_operation("get"); }
<   elsif ($ARGV[0] eq "--set"     || $ARGV[0] eq "-s") { be_set_operation("set"); }
<   elsif ($ARGV[0] eq "--filter"  || $ARGV[0] eq "-f") { be_set_operation("filter"); }
<   elsif ($ARGV[0] eq "--help"    || $ARGV[0] eq "-h") { print $Usage; exit(0); }
<   elsif ($ARGV[0] eq "--version")                     { print "$version\n"; exit(0); }
<   elsif ($ARGV[0] eq "--prefix"  || $ARGV[0] eq "-p")
<   {
<     if ($be_prefix ne "")
<     {
<       print STDERR "Error: You may specify --prefix only once.\n\n";
<       print STDERR $Usage; exit(1);
<     }
< 
<     $be_prefix = $ARGV[1];
< 
<     if ($be_prefix eq "")
<     {
<       print STDERR "Error: You must specify an argument to the --prefix option.\n\n";
<       print STDERR $Usage; exit(1);
<     }
< 
<     shift @ARGV;  # For the argument.
<   }
<   elsif ($ARGV[0] eq "--disable-immediate")           { $be_do_immediate = 0; }
<   elsif ($ARGV[0] eq "--verbose" || $ARGV[0] eq "-v") { $be_verbose = 1; }
<   elsif ($ARGV[0] eq "--progress")                    { $be_progress = 1; }
<   else
<   {
<     print STDERR "Error: Unrecognized option '$ARGV[0]'.\n\n";
<     print STDERR $Usage; exit(1);
<   }
< 
<   shift @ARGV;
< }
< 
---
> be_init(@ARGV);
Index: backends/networking-conf.in
===================================================================
RCS file: /cvs/gnome/helix-setup-tools/backends/networking-conf.in,v
retrieving revision 1.12
diff -r1.12 networking-conf.in
308,309c308,309
<         if ($verbose) { print STDERR "Warning: $line[1] isn't an available, " .
<                             "configured interface.\n"; }
---
>         be_report_warning(01, "$line[1] isn't an available, " .
>                               "configured interface");
319,320c319,320
<         if ($verbose) { print STDERR "Warning: Interface $line[1] has no " .
<                             "config method.\n"; }
---
>         be_report_warning(02, "Warning: Interface $line[1] has no " .
>                               "config method");
383c383
<   if ( scalar(keys(%ifaces)) == 1 )
---
>   if (scalar(keys(%ifaces)) == 1)
387,389c387,388
<     if ( $verbose )
<     { print STDERR "Only one interface, $chosen_name, exists.  It is being " .
<           "selected as the \"primary\" interface.\n"; }
---
>     be_report_info(03, "Only one interface, $chosen_name, exists.  It is being " .
>                        "selected as the primary interface");
392,393c391,392
<   # For that matter, do any interfaces exist at all.
<   elsif ( scalar(keys(%ifaces)) == 0 )
---
>   # For that matter, do any interfaces exist at all?
>   elsif (scalar(keys(%ifaces)) == 0)
395d393
<     if ($verbose) { print STDERR "Warning: No interfaces found!\n"; }
405c403
<     if ( $chosen_name eq "" )
---
>     if ($chosen_name eq "")
411c409
<     if ( $chosen_name eq "" )
---
>     if ($chosen_name eq "")
901c899
<   elsif ($be_verbose) { print STDERR "Warning: No primary interface specified - config unwritten.\n"; }
---
>   else { be_report_warning(04, "No primary interface specified - config unwritten"); }
1355c1353
<     if ($be_verbose) { print STDERR "Warning: Couldn't find any network devices.\n"; }
---
>     be_report_warning(05, "Could not find any network devices");
1370,1374c1368
<   if ($be_progress) { $| = 1; print $progress_max . "\n"; }
< 
<   if ($be_verbose) { print STDERR "Getting system configuration, generating XML output.\n"; }
< 
<   if ($be_verbose) { print STDERR "Finding interfaces.\n"; }
---
>   be_report_info(01, "Finding interfaces");
1383,1384c1377
<   if ($be_verbose) { print STDERR "Printing XML.\n"; }
<   if ($be_progress) { print "\n"; }
---
>   be_end();
1411c1404
<         if ($be_verbose) { print STDERR "Warning: Could not configure interface. Are you root?\n"; }
---
>         be_report_warning(05, "Could not configure network interface");
1413c1406
<       elsif ($be_verbose)
---
>       else
1415c1408
<         print STDERR "Primary interface configured.\n";
---
>         be_report_info(03, "Primary interface configured");
1418c1411
<     elsif ($be_verbose)
---
>     else
1420c1413
<       print STDERR "Warning: No primary interface given.\n";
---
>       be_report_warning(06, "No primary interface given");
1423c1416
<   elsif ($be_verbose)
---
>   else
1425c1418
<     print STDERR "Warning: No interface control utilities found.\n";
---
>     be_report_warning(07, "No interface control utilities found");
1432,1434d1424
<   if ($be_verbose) { print STDERR "Setting system configuration from XML input.\n"; }
< 
<   if ($be_verbose) { print STDERR "Parsing XML.\n"; }
1450d1439
<     if ($be_verbose) { print STDERR "Changing running configuration via local utilities.\n"; }
1452a1442,1443
>   
>   be_end();
1461a1453
>   be_end();
1468,1506c1460
< # Process options.
< 
< while (@ARGV)
< {
<   if    ($ARGV[0] eq "--get"    || $ARGV[0] eq "-g") { be_set_operation("get"); }
<   elsif ($ARGV[0] eq "--set"    || $ARGV[0] eq "-s") { be_set_operation("set"); }
<   elsif ($ARGV[0] eq "--filter" || $ARGV[0] eq "-f") { be_set_operation("filter"); }
<   elsif ($ARGV[0] eq "--help"   || $ARGV[0] eq "-h") { print $Usage; exit(0); }
<   elsif ($ARGV[0] eq "--version")                    { print "$version\n"; exit(0); }
<   elsif ($ARGV[0] eq "--prefix" || $ARGV[0] eq "-p")
<   {
<     if ($be_prefix ne "")
<     {
<       print STDERR "Error: You may specify --prefix only once.\n\n";
<       print STDERR $Usage; exit(1);
<     }
< 
<     $be_prefix = $ARGV[1];
< 
<     if ($be_prefix eq "")
<     {
<       print STDERR "Error: You must specify an argument to the --prefix option.\n\n";
<       print STDERR $Usage; exit(1);
<     }
< 
<     shift @ARGV;  # For the argument.
<   }
<   elsif ($ARGV[0] eq "--disable-immediate")           { $be_do_immediate = 0; }
<   elsif ($ARGV[0] eq "--verbose" || $ARGV[0] eq "-v") { $be_verbose = 1; }
<   elsif ($ARGV[0] eq "--progress")                    { $be_progress = 1; }
<   else
<   {
<     print STDERR "Error: Unrecognized option '$ARGV[0]'.\n\n";
<     print STDERR $Usage; exit(1);
<   }
< 
<   shift @ARGV;
< }
< 
---
> be_init(@ARGV);
Index: backends/shares-conf.in
===================================================================
RCS file: /cvs/gnome/helix-setup-tools/backends/shares-conf.in,v
retrieving revision 1.18
diff -r1.18 shares-conf.in
1394c1394
<     if ($be_verbose) { print STDERR "Warning: Couldn't find any network devices.\n"; }
---
>     be_report_warning(01, "Could not find any network devices");
1450c1450
<   if ($be_verbose) { print STDERR "Subnet ping found ", $#hosts + 1, " hosts.\n"; }
---
>   be_report_info(1, "Subnet ping found " . ($#hosts + 1) . " hosts");
1457c1457
<     if ($be_verbose) { print STDERR "Can't locate showmount - NFS scan skipped.\n"; }
---
>     be_report_error(1, "Can't locate showmount - NFS scan skipped");
1488c1488
<     if ($be_verbose) { print STDERR "Found $j NFS exports on $i hosts.\n"; }
---
>     be_report_info(02, "Found $j NFS exports on $i hosts");
1499c1499
<     if ($be_verbose) { print STDERR "Doing SMB detection in workgroup $cf_workgroup.\n"; }
---
>     be_report_info(03, "Doing SMB detection in workgroup $cf_workgroup");
1522c1522
<       if ($be_verbose) { print STDERR "Workgroup master is $smb_master_name ($smb_master_ip).\n"; }
---
>       be_report_info(04, "Workgroup master is $smb_master_name ($smb_master_ip)");
1541,1542c1541,1542
<         if ($#smb_hosts + 1) { print STDERR "Master reported ", $#smb_hosts + 1, " hosts in workgroup.\n"; }
<         else { print STDERR "No hosts reported by master - asking others.\n"; }
---
>         if ($#smb_hosts + 1) { be_report_info(05, "Master reported " . ($#smb_hosts + 1) . " hosts in workgroup"); }
>         else { be_report_info(06, "No hosts reported by master - asking others"); }
1545c1545
<     elsif ($be_verbose) { print STDERR "No workgroup master found.\n"; }
---
>     else { be_report_warning(02, "No workgroup master found"); }
1561c1561
<         if ($be_verbose) { print STDERR "Asking $host for host list"; }
---
>         be_report_info(07, "Asking $host for host list");
1578c1578
<           if ($be_verbose) { print STDERR " - got ", $#smb_hosts + 1, " hosts.\n"; }
---
>           be_report_info(8, "Got " . ($#smb_hosts + 1) . " SMB hosts");
1581c1581
<         elsif ($be_verbose) { print STDERR " - failed.\n"; }
---
>         else { be_report_warning(9, "No SMB hosts found"); }
1622c1622
<     if ($be_verbose) { print STDERR "Found $j SMB exports on $i hosts.\n"; }
---
>     be_report_info(10, "Found $j SMB exports on $i hosts");
1625c1625
<   elsif ($be_verbose) { print STDERR "No workgroup configured - SMB scan skipped.\n"; }
---
>   else { be_report_warning("No workgroup configured - SMB scan skipped"); }
1631,1634c1631
<   if ($be_progress) { $| = 1; print $progress_max . "\n"; }
< 
<   if ($be_verbose) { print STDERR "Getting system configuration, generating XML output.\n"; }
<   if ($be_verbose) { print STDERR "Finding interfaces.\n"; }
---
>   be_report_info(20, "Finding interfaces");
1645,1646c1642
<   if ($be_verbose) { print STDERR "Printing XML.\n"; }
<   if ($be_progress) { print "\n"; }
---
>   be_end();
1670c1666
<       if ($be_verbose) { print STDERR "Warning: SMB restart failed.\n"; }
---
>       be_report_error(2, "SMB restart failed");
1672c1668
<     elsif ($be_verbose)
---
>     else
1674c1670
<       print STDERR "SMB restarted with new configuration.\n";
---
>       be_report_info(11, "SMB restarted with new configuration");
1677c1673
<   elsif ($be_verbose)
---
>   else
1679c1675
<     print STDERR "Warning: Could not find a way to restart SMB services.\n";
---
>     be_report_error(3, "Could not find a way to restart SMB services");
1684c1680
<     if ($be_verbose) { print STDERR "Warning: Could not reload NFS export tables.\n"; }
---
>     be_report_error(4, "Could not reload NFS export tables");
1689c1685
<     if ($be_verbose) { print STDERR "NFS export tables reloaded.\n"; }
---
>     be_report_info(12, "NFS export tables reloaded");
1704c1700
<           if ($be_verbose) { print STDERR "Mounting $shares[8].\n"; }
---
>           be_report_info(13, "Mounting $shares[8]");
1709c1705
<           if ($be_verbose) { print STDERR "Unmounting $shares[8].\n"; }
---
>           be_report_info(14, "Unmounting $shares[8]");
1721c1717
<     if ($be_verbose) { print STDERR "Warning: Could not find mount tools. No mounting done.\n"; }
---
>     be_report_error(6, "Could not find mount tools. No mounting done");
1729,1731d1724
<   if ($be_verbose) { print STDERR "Setting system configuration from XML input.\n"; }
< 
<   if ($be_verbose) { print STDERR "Parsing XML.\n"; }
1740d1732
<     if ($be_verbose) { print STDERR "Changing running configuration via local utilities.\n"; }
1742a1735,1736
>   
>   be_end();
1751a1746
>   be_end();
1758,1796c1753
< # Process options.
< 
< while (@ARGV)
< {
<   if    ($ARGV[0] eq "--get"    || $ARGV[0] eq "-g") { be_set_operation("get"); }
<   elsif ($ARGV[0] eq "--set"    || $ARGV[0] eq "-s") { be_set_operation("set"); }
<   elsif ($ARGV[0] eq "--filter" || $ARGV[0] eq "-f") { be_set_operation("filter"); }
<   elsif ($ARGV[0] eq "--help"   || $ARGV[0] eq "-h") { print $Usage; exit(0); }
<   elsif ($ARGV[0] eq "--version")                    { print "$version\n"; exit(0); }
<   elsif ($ARGV[0] eq "--prefix" || $ARGV[0] eq "-p")
<   {
<     if ($be_prefix ne "")
<     {
<       print STDERR "Error: You may specify --prefix only once.\n\n";
<       print STDERR $Usage; exit(1);
<     }
< 
<     $be_prefix = $ARGV[1];
< 
<     if ($be_prefix eq "")
<     {
<       print STDERR "Error: You must specify an argument to the --prefix option.\n\n";
<       print STDERR $Usage; exit(1);
<     }
< 
<     shift @ARGV;  # For the argument.
<   }
<   elsif ($ARGV[0] eq "--disable-immediate")           { $be_do_immediate = 0; }
<   elsif ($ARGV[0] eq "--verbose" || $ARGV[0] eq "-v") { $be_verbose = 1; }
<   elsif ($ARGV[0] eq "--progress")                    { $be_progress = 1; }
<   else
<   {
<     print STDERR "Error: Unrecognized option '$ARGV[0]'.\n\n";
<     print STDERR $Usage; exit(1);
<   }
< 
<   shift @ARGV;
< }
< 
---
> be_init(@ARGV);
1808d1764
< 
Index: backends/time-conf.in
===================================================================
RCS file: /cvs/gnome/helix-setup-tools/backends/time-conf.in,v
retrieving revision 1.12
diff -r1.12 time-conf.in
254,258c254,255
<     if ($be_verbose)
<     {
<       (my $fullname = "$prefix/$name") =~ tr/\//\//s;  # '//' -> '/'
<       print STDERR "Writing timezone configuration to \"$fullname\".\n";
<     }
---
>     (my $fullname = "$prefix/$name") =~ tr/\//\//s;  # '//' -> '/'
>     be_report_info(1, "Writing timezone configuration to \"$fullname\"");
459c456
<       if ($be_verbose) { print STDERR "Found XNTPD enabled.\n"; }
---
>       be_report_info(2, "Found XNTPD enabled");
461c458
<     elsif ($be_verbose)
---
>     else
464c461
<       print STDERR "Found XNTPD disabled.\n";
---
>       be_report_info(3, "Found XNTPD disabled");
467c464
<   elsif ($be_verbose)
---
>   else
469c466
<     print STDERR "Warning: Could not find a way to check XNTPD status.\n";
---
>     be_report_warning(1, "Could not find a way to check XNTPD status");
476,480d472
<   if ($be_progress) { $| = 1; print $progress_max . "\n"; }
< 
<   if ($be_verbose) { print STDERR "Getting system configuration, generating XML output.\n"; }
<   if ($be_verbose) { print STDERR "Getting time, date and timezone.\n"; }
< 
486,487c478
<   if ($be_verbose) { print STDERR "Printing XML.\n"; }
<   if ($be_progress) { print "\n"; }
---
>   be_end();
510c501
<         if ($be_verbose) { print STDERR "Warning: XNTPD restart failed.\n"; }
---
>         be_report_warning(2, "XNTPD restart failed");
512c503
<       elsif ($be_verbose)
---
>       else
514c505
<         print STDERR "XNTPD restarted with new configuration.\n";
---
>         be_report_info(4, "XNTPD restarted with new configuration");
520c511
<       if ($be_verbose) { print STDERR "XNTPD stopped.\n"; }
---
>       be_report_info(5, "XNTPD stopped");
523c514
<   elsif ($be_verbose)
---
>   else
525c516
<     print STDERR "Warning: Could not find a way to restart XNTPD service.\n";
---
>     be_report_warning(3, "Could not find a way to restart XNTPD service");
532,534d522
<   if ($be_verbose) { print STDERR "Setting system configuration from XML input.\n"; }
< 
<   if ($be_verbose) { print STDERR "Parsing XML.\n"; }
543d530
<     if ($be_verbose) { print STDERR "Changing running configuration via local utilities.\n"; }
546a534,535
>   
>   be_end();
555a545
>   be_end();
562,600c552
< # Process options.
< 
< while (@ARGV)
< {
<   if    ($ARGV[0] eq "--get"    || $ARGV[0] eq "-g") { be_set_operation("get"); }
<   elsif ($ARGV[0] eq "--set"    || $ARGV[0] eq "-s") { be_set_operation("set"); }
<   elsif ($ARGV[0] eq "--filter" || $ARGV[0] eq "-f") { be_set_operation("filter"); }
<   elsif ($ARGV[0] eq "--help"   || $ARGV[0] eq "-h") { print $Usage; exit(0); }
<   elsif ($ARGV[0] eq "--version")                    { print "$version\n"; exit(0); }
<   elsif ($ARGV[0] eq "--prefix" || $ARGV[0] eq "-p")
<   {
<     if ($be_prefix ne "")
<     {
<       print STDERR "Error: You may specify --prefix only once.\n\n";
<       print STDERR $Usage; exit(1);
<     }
< 
<     $be_prefix = $ARGV[1];
< 
<     if ($be_prefix eq "")
<     {
<       print STDERR "Error: You must specify an argument to the --prefix option.\n\n";
<       print STDERR $Usage; exit(1);
<     }
< 
<     shift @ARGV;  # For the argument.
<   }
<   elsif ($ARGV[0] eq "--disable-immediate")           { $be_do_immediate = 0; }
<   elsif ($ARGV[0] eq "--verbose" || $ARGV[0] eq "-v") { $be_verbose = 1; }
<   elsif ($ARGV[0] eq "--progress")                    { $be_progress = 1; }
<   else
<   {
<     print STDERR "Error: Unrecognized option '$ARGV[0]'.\n\n";
<     print STDERR $Usage; exit(1);
<   }
< 
<   shift @ARGV;
< }
< 
---
> be_init(@ARGV);
Index: backends/users-conf.in
===================================================================
RCS file: /cvs/gnome/helix-setup-tools/backends/users-conf.in,v
retrieving revision 1.19
diff -r1.19 users-conf.in
564c564
< 		elsif ($be_verbose)
---
> 		else
566c566
< 		  print STDERR "Unexpected tag " . $$tree[0] . " while parsing users.\n"
---
> 		  be_report_warning(1, "Unexpected tag " . $$tree[0] . " while parsing users");
586c586
< 		elsif ($be_verbose)
---
> 		else
588c588
< 		  print STDERR "Unexpected tag " . $$tree[0] . " while parsing logindefs.\n"
---
> 		  be_report_warning(2, "Unexpected tag " . $$tree[0] . " while parsing logindefs");
602c602
< 	print STDERR "passwd_last_modified tag contents is not PCDATA only.\n" if ($$tree[0] ne "0" && $be_verbose);
---
> 	be_report_warning(3, "passwd_last_modified tag contents is not PCDATA only") if ($$tree[0] ne "0");
612c612
< 	print STDERR "group_last_modified tag contents is not PCDATA only.\n" if ($$tree[0] ne "0" && $be_verbose);
---
> 	be_report_warning(4, "group_last_modified tag contents is not PCDATA only") if ($$tree[0] ne "0");
625c625
< 		elsif ($be_verbose)
---
> 		else
627c627
< 		  print STDERR "Unexpected tag " . $$tree[0] . " while parsing userdb.\n"
---
> 		  be_report_warning(5, "Unexpected tag " . $$tree[0] . " while parsing userdb");
648c648
< 		elsif ($be_verbose)
---
> 		else
650c650
< 		  print STDERR "Unexpected tag " . $$tree[0] . " while parsing user.\n"
---
> 		  be_report_warning(6, "Unexpected tag " . $$tree[0] . " while parsing user");
672c672
< 		  print STDERR "Unexpected tag " . $$tree[0] . " while parsing groupdb.\n"
---
> 		  be_report_warning(7, "Unexpected tag " . $$tree[0] . " while parsing groupdb");
694c694
< 		elsif ($be_verbose)
---
> 		else
696c696
< 		  print STDERR "Unexpected tag " . $$tree[0] . " while parsing group.\n"
---
> 		  be_report_warning("Unexpected tag " . $$tree[0] . " while parsing group");
710c710
< 		elsif ($be_verbose)
---
> 		else
712c712
< 		  print STDERR "Unexpected tag " . $$a[0] . " while parsing users.\n"
---
> 		  be_report_warning(8, "Unexpected tag " . $$a[0] . " while parsing users");
821,824c821
<   if ($be_progress) { $| = 1; print $progress_max . "\n"; }
< 
<   if ($be_verbose) { print STDERR "Getting system configuration, generating XML output.\n"; }
<   if ($be_verbose) { print STDERR "Getting user database.\n"; }
---
>   be_report_info(1, "Getting user database");
830,831c827
<   if ($be_verbose) { print STDERR "Printing XML.\n"; }
<   if ($be_progress) { print "\n"; }
---
>   &be_end();
837,839d832
<   if ($be_verbose) { print STDERR "Setting system configuration from XML input.\n"; }
< 
<   if ($be_verbose) { print STDERR "Parsing XML.\n"; }
844d836
<     if ($be_verbose) { print STDERR "Changing running configuration via local utilities.\n"; }
846a839,840
>   
>   &be_end();
855a850
>   &be_end();
862,899c857
< # Process options.
< 
< while (@ARGV)
< {
<   if    ($ARGV[0] eq "--get"    || $ARGV[0] eq "-g") { be_set_operation("get"); }
<   elsif ($ARGV[0] eq "--set"    || $ARGV[0] eq "-s") { be_set_operation("set"); }
<   elsif ($ARGV[0] eq "--filter" || $ARGV[0] eq "-f") { be_set_operation("filter"); }
<   elsif ($ARGV[0] eq "--help"   || $ARGV[0] eq "-h") { print $Usage; exit(0); }
<   elsif ($ARGV[0] eq "--version")                    { print "$version\n"; exit(0); }
<   elsif ($ARGV[0] eq "--prefix" || $ARGV[0] eq "-p")
<   {
<     if ($be_prefix ne "")
<     {
<       print STDERR "Error: You may specify --prefix only once.\n\n";
<       print STDERR $Usage; exit(1);
<     }
< 
<     $be_prefix = $ARGV[1];
< 
<     if ($be_prefix eq "")
<     {
<       print STDERR "Error: You must specify an argument to the --prefix option.\n\n";
<       print STDERR $Usage; exit(1);
<     }
< 
<     shift @ARGV;  # For the argument.
<   }
<   elsif ($ARGV[0] eq "--verbose" || $ARGV[0] eq "-v") { $be_verbose = 1; }
<   elsif ($ARGV[0] eq "--progress")                    { $be_progress = 1; }
<   else
<   {
<     print STDERR "Error: Unrecognized option '$ARGV[0]'.\n\n";
<     print STDERR $Usage; exit(1);
<   }
< 
<   shift @ARGV;
< }
< 
---
> &be_init(@ARGV);
Index: interfaces/common.glade.h
===================================================================
RCS file: /cvs/gnome/helix-setup-tools/interfaces/common.glade.h,v
retrieving revision 1.2
diff -r1.2 common.glade.h
7c7
< gchar *s = N_("Name Resolution Administration");
---
> gchar *s = N_("Helix Setup Tools");
8a9,11
> gchar *s = N_("%P %%");
> gchar *s = N_("Helix Setup Tools");
> gchar *s = N_("Updating your system configuration.");
Index: interfaces/common.glade.in
===================================================================
RCS file: /cvs/gnome/helix-setup-tools/interfaces/common.glade.in,v
retrieving revision 1.1
diff -r1.1 common.glade.in
22c22
<   <title>Name Resolution Administration</title>
---
>   <title>Helix Setup Tools</title>
37,39c37,39
<       <class>GtkHBox</class>
<       <name>hbox6</name>
<       <border_width>10</border_width>
---
>       <class>GtkVBox</class>
>       <name>vbox4</name>
>       <border_width>4</border_width>
41c41
<       <spacing>16</spacing>
---
>       <spacing>0</spacing>
44,45c44,46
< 	<class>GtkVBox</class>
< 	<name>reading_box</name>
---
> 	<class>GtkHBox</class>
> 	<name>hbox6</name>
> 	<border_width>6</border_width>
47c48
< 	<spacing>0</spacing>
---
> 	<spacing>16</spacing>
50,51c51,52
< 	  <expand>False</expand>
< 	  <fill>False</fill>
---
> 	  <expand>True</expand>
> 	  <fill>True</fill>
55c56,117
< 	  <class>Placeholder</class>
---
> 	  <class>GtkVBox</class>
> 	  <name>reading_box</name>
> 	  <homogeneous>False</homogeneous>
> 	  <spacing>0</spacing>
> 	  <child>
> 	    <padding>0</padding>
> 	    <expand>False</expand>
> 	    <fill>False</fill>
> 	  </child>
> 
> 	  <widget>
> 	    <class>Placeholder</class>
> 	  </widget>
> 	</widget>
> 
> 	<widget>
> 	  <class>GtkVBox</class>
> 	  <name>vbox1</name>
> 	  <homogeneous>False</homogeneous>
> 	  <spacing>4</spacing>
> 	  <child>
> 	    <padding>0</padding>
> 	    <expand>False</expand>
> 	    <fill>False</fill>
> 	  </child>
> 
> 	  <widget>
> 	    <class>GtkLabel</class>
> 	    <name>label49</name>
> 	    <label>Scanning your system configuration.</label>
> 	    <justify>GTK_JUSTIFY_CENTER</justify>
> 	    <wrap>False</wrap>
> 	    <xalign>0.5</xalign>
> 	    <yalign>0.5</yalign>
> 	    <xpad>0</xpad>
> 	    <ypad>0</ypad>
> 	    <child>
> 	      <padding>0</padding>
> 	      <expand>True</expand>
> 	      <fill>True</fill>
> 	    </child>
> 	  </widget>
> 
> 	  <widget>
> 	    <class>GtkProgressBar</class>
> 	    <name>read_progress</name>
> 	    <value>0</value>
> 	    <lower>0</lower>
> 	    <upper>100</upper>
> 	    <bar_style>GTK_PROGRESS_CONTINUOUS</bar_style>
> 	    <orientation>GTK_PROGRESS_LEFT_TO_RIGHT</orientation>
> 	    <activity_mode>False</activity_mode>
> 	    <show_text>False</show_text>
> 	    <format>%P %%</format>
> 	    <text_xalign>0.5</text_xalign>
> 	    <text_yalign>0.5</text_yalign>
> 	    <child>
> 	      <padding>0</padding>
> 	      <expand>True</expand>
> 	      <fill>True</fill>
> 	    </child>
> 	  </widget>
60,61c122,168
< 	<class>GtkVBox</class>
< 	<name>vbox1</name>
---
> 	<class>GtkEntry</class>
> 	<name>read_report</name>
> 	<sensitive>False</sensitive>
> 	<can_focus>True</can_focus>
> 	<editable>False</editable>
> 	<text_visible>True</text_visible>
> 	<text_max_length>0</text_max_length>
> 	<text></text>
> 	<child>
> 	  <padding>0</padding>
> 	  <expand>True</expand>
> 	  <fill>True</fill>
> 	</child>
>       </widget>
>     </widget>
>   </widget>
> </widget>
> 
> <widget>
>   <class>GtkWindow</class>
>   <name>writing</name>
>   <visible>False</visible>
>   <title>Helix Setup Tools</title>
>   <type>GTK_WINDOW_POPUP</type>
>   <position>GTK_WIN_POS_CENTER</position>
>   <modal>True</modal>
>   <allow_shrink>False</allow_shrink>
>   <allow_grow>False</allow_grow>
>   <auto_shrink>False</auto_shrink>
> 
>   <widget>
>     <class>GtkFrame</class>
>     <name>frame5</name>
>     <label_xalign>0</label_xalign>
>     <shadow_type>GTK_SHADOW_OUT</shadow_type>
> 
>     <widget>
>       <class>GtkVBox</class>
>       <name>vbox5</name>
>       <border_width>4</border_width>
>       <homogeneous>False</homogeneous>
>       <spacing>0</spacing>
> 
>       <widget>
> 	<class>GtkHBox</class>
> 	<name>hbox7</name>
> 	<border_width>6</border_width>
63c170
< 	<spacing>4</spacing>
---
> 	<spacing>16</spacing>
66,67c173,174
< 	  <expand>False</expand>
< 	  <fill>False</fill>
---
> 	  <expand>True</expand>
> 	  <fill>True</fill>
71,79c178,181
< 	  <class>GtkLabel</class>
< 	  <name>label49</name>
< 	  <label>Scanning your system configuration.</label>
< 	  <justify>GTK_JUSTIFY_CENTER</justify>
< 	  <wrap>False</wrap>
< 	  <xalign>0.5</xalign>
< 	  <yalign>0.5</yalign>
< 	  <xpad>0</xpad>
< 	  <ypad>0</ypad>
---
> 	  <class>GtkVBox</class>
> 	  <name>vbox6</name>
> 	  <homogeneous>False</homogeneous>
> 	  <spacing>0</spacing>
82,83c184,185
< 	    <expand>True</expand>
< 	    <fill>True</fill>
---
> 	    <expand>False</expand>
> 	    <fill>False</fill>
84a187,190
> 
> 	  <widget>
> 	    <class>Placeholder</class>
> 	  </widget>
88,99c194,197
< 	  <class>GtkProgressBar</class>
< 	  <name>progress</name>
< 	  <value>0</value>
< 	  <lower>0</lower>
< 	  <upper>100</upper>
< 	  <bar_style>GTK_PROGRESS_CONTINUOUS</bar_style>
< 	  <orientation>GTK_PROGRESS_LEFT_TO_RIGHT</orientation>
< 	  <activity_mode>False</activity_mode>
< 	  <show_text>False</show_text>
< 	  <format>%P %%</format>
< 	  <text_xalign>0.5</text_xalign>
< 	  <text_yalign>0.5</text_yalign>
---
> 	  <class>GtkVBox</class>
> 	  <name>vbox7</name>
> 	  <homogeneous>False</homogeneous>
> 	  <spacing>4</spacing>
102,103c200,201
< 	    <expand>True</expand>
< 	    <fill>True</fill>
---
> 	    <expand>False</expand>
> 	    <fill>False</fill>
104a203,239
> 
> 	  <widget>
> 	    <class>GtkLabel</class>
> 	    <name>label50</name>
> 	    <label>Updating your system configuration.</label>
> 	    <justify>GTK_JUSTIFY_CENTER</justify>
> 	    <wrap>False</wrap>
> 	    <xalign>0.5</xalign>
> 	    <yalign>0.5</yalign>
> 	    <xpad>0</xpad>
> 	    <ypad>0</ypad>
> 	    <child>
> 	      <padding>0</padding>
> 	      <expand>True</expand>
> 	      <fill>True</fill>
> 	    </child>
> 	  </widget>
> 
> 	  <widget>
> 	    <class>GtkProgressBar</class>
> 	    <name>write_progress</name>
> 	    <value>0</value>
> 	    <lower>0</lower>
> 	    <upper>100</upper>
> 	    <bar_style>GTK_PROGRESS_CONTINUOUS</bar_style>
> 	    <orientation>GTK_PROGRESS_LEFT_TO_RIGHT</orientation>
> 	    <activity_mode>False</activity_mode>
> 	    <show_text>False</show_text>
> 	    <format>%P %%</format>
> 	    <text_xalign>0.5</text_xalign>
> 	    <text_yalign>0.5</text_yalign>
> 	    <child>
> 	      <padding>0</padding>
> 	      <expand>True</expand>
> 	      <fill>True</fill>
> 	    </child>
> 	  </widget>
105a241,256
>       </widget>
> 
>       <widget>
> 	<class>GtkEntry</class>
> 	<name>write_report</name>
> 	<sensitive>False</sensitive>
> 	<can_focus>True</can_focus>
> 	<editable>False</editable>
> 	<text_visible>True</text_visible>
> 	<text_max_length>0</text_max_length>
> 	<text></text>
> 	<child>
> 	  <padding>0</padding>
> 	  <expand>True</expand>
> 	  <fill>True</fill>
> 	</child>
Index: src/common/tool.c
===================================================================
RCS file: /cvs/gnome/helix-setup-tools/src/common/tool.c,v
retrieving revision 1.19
diff -r1.19 tool.c
175c175
< 	GtkWidget *bar;
---
> 	GtkWidget *bar, *report;
176a177,178
> 	static char *line = NULL;
> 	static int line_len = 0;
178,181c180,235
< 	bar = tool_widget_get_common("progress");
<   
< 	if (read(fd, &c, 1) < 1) return;
<   
---
> 	bar = tool_widget_get_common("read_progress");
> 	report = tool_widget_get_common("read_report");
> 	if (!line)
> 	{
> 		line = malloc(1);
> 		line[0] = '\0';
> 	}
> 
> 	/* NOTE: The read() being done here is inefficient, but we're not
> 	 * going to handle any large amount of data */
> 	
> 	if (read (fd, &c, 1) > 0)
> 	{
> 		if (c == '\n')
> 		{
> 			/* End of line. Take action. */
> 			
> 			if (line_len < 3)
> 			{
> 				/* End of headers. We're done. */
> 				
> 				gtk_main_quit ();
> 			}
> 			else
> 			{
> 				if (line[0] == '0')
> 				{
> 					/* Progress update */
> 
> 					gtk_progress_set_percentage (GTK_PROGRESS(bar),
> 								     (gfloat) ((line[1] - '0') * 0.1) +
> 								              (line[2] - '0') * 0.01);
> 				}
> 				else
> 				{
> 					/* Report line */
> 					
> 					gtk_entry_set_text(GTK_ENTRY(report),
> 							   line + 4);
> 				}
> 			}
> 
> 			line[0] = '\0';
> 			line_len = 0;
> 		}
> 		else
> 		{
> 			/* Add character to end of current line */
> 			
> 			line = realloc(line, line_len + 2);
> 			line[line_len] = c;
> 			line_len++;
> 			line[line_len] = '\0';
> 		}
> 	}
> #if 0  
209a264
> #endif
228,232c283,287
<   gtk_progress_set_percentage (GTK_PROGRESS (tool_widget_get_common ("progress")),
<                                1.0);
<   cb_id = gtk_timeout_add (500, (GtkFunction) gtk_main_quit, NULL);
<   gtk_main ();
<   gtk_timeout_remove (cb_id);
---
> 	gtk_progress_set_percentage (GTK_PROGRESS (tool_widget_get_common ("read_progress")),
> 				     1.0);
> 	cb_id = gtk_timeout_add (500, (GtkFunction) gtk_main_quit, NULL);
> 	gtk_main ();
> 	gtk_timeout_remove (cb_id);
246c301
< 	char *argv[] = { 0, "--get", "--progress", 0 };
---
> 	char *argv[] = { 0, "--get", "--progress", "--report", 0 };
499,500c554,555
<   reply = val;
<   gtk_main_quit ();
---
> 	reply = val;
> 	gtk_main_quit ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]