tags 292989 patch
thanks

On Thu, Feb 03, 2005 at 11:06:33PM -0500, Joey Hess wrote:
> Colin Watson wrote:
> > I would agree if the client were using TITLE, but in this case it isn't;
> > it's apt-setup doing 'db_settitle apt-setup/title'. Why would debconf
> > need to create a fake template when the client is already using
> > SETTITLE?
> 
> Oh sure, I agree we should use SETTITLE in that case.

Of course this requires sending some DATA commands too. How about the
attached patch? It results in this passthrough communication for the
beginning of samples/demo in fr_FR.UTF-8:

  CAPB
  TITLE
  TITLE Configuration de 
  DATA demo/title type title
  DATA demo/title description This is my demo title in French (yeah, right)
  SETTITLE demo/title

Cheers,

-- 
Colin Watson                                       [EMAIL PROTECTED]
Index: Debconf/FrontEnd/Passthrough.pm
===================================================================
--- Debconf/FrontEnd/Passthrough.pm     (revision 1801)
+++ Debconf/FrontEnd/Passthrough.pm     (working copy)
@@ -176,6 +176,40 @@
        $this->talk('TITLE', $title);
 }
 
+=head2 settitle
+
+Pass title question name along to the UI agent, along with necessary data
+about it.
+
+=cut
+
+sub settitle
+{
+       my $this = shift;
+       my $question = shift;
+
+       $this->{title} = $question->description;
+
+       my $tag = $question->template->template;
+       my $type = $question->template->type;
+       my $desc = $question->description;
+       my $extdesc = $question->extended_description;
+
+       $this->talk('DATA', $tag, 'type', $type);
+
+       if ($desc) {
+               $desc =~ s/\n/\\n/g;
+               $this->talk('DATA', $tag, 'description', $desc);
+       }
+
+       if ($extdesc) {
+               $extdesc =~ s/\n/\\n/g;
+               $this->talk('DATA', $tag, 'extended_description', $extdesc);
+       }
+
+       $this->talk('SETTITLE', $tag);
+}
+
 =head2 go
 
 Asks the UI agent to display all pending questions, first using the special 
Index: Debconf/ConfModule.pm
===================================================================
--- Debconf/ConfModule.pm       (revision 1801)
+++ Debconf/ConfModule.pm       (working copy)
@@ -408,7 +408,11 @@
        my $question=Debconf::Question->get($question_name) ||
                return $codes{badparams}, "\"$question_name\" doesn't exist";
 
-       $this->frontend->title($question->description);
+       if ($this->frontend->can('settitle')) {
+               $this->frontend->settitle($question);
+       } else {
+               $this->frontend->title($question->description);
+       }
        
        return $codes{success};
 }

Reply via email to