[Aptitude-devel] r3140 - in branches/aptitude-0.3/aptitude: . src

Daniel Burrows dburrows@costa.debian.org
Wed, 27 Apr 2005 12:36:04 +0000


Author: dburrows
Date: Wed Apr 27 12:36:01 2005
New Revision: 3140

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/pkg_item.cc
Log:
Use fragments to display long text in pkg_item.cc.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Wed Apr 27 12:36:01 2005
@@ -1,5 +1,9 @@
 2005-04-27  Daniel Burrows  <dburrows@debian.org>
 
+	* src/pkg_item.cc:
+
+	  Reflow some manually wrapped messages.
+
 	* src/vscreen/vs_util.cc, src/vscreen/vs_util.h:
 
 	  Add a vs_dialog_string variant that allows raw fragments to be

Modified: branches/aptitude-0.3/aptitude/src/pkg_item.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/pkg_item.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/pkg_item.cc	Wed Apr 27 12:36:01 2005
@@ -1,6 +1,6 @@
 // pkg_item.cc
 //
-// Copyright 1999,2000,2001,2002 Daniel Burrows
+// Copyright 1999-2005 Daniel Burrows
 //
 //  This program is free software; you can redistribute it and/or modify
 //  it under the terms of the GNU General Public License as published by
@@ -23,6 +23,7 @@
 
 #include <vscreen/config/column_definition.h>
 #include <vscreen/config/keybindings.h>
+#include <vscreen/fragment.h>
 #include <vscreen/vs_util.h>
 
 #include "download.h"
@@ -76,16 +77,18 @@
   assert((pkg->Flags&pkgCache::Flag::Essential)==pkgCache::Flag::Essential ||
 	 (pkg->Flags&pkgCache::Flag::Important)==pkgCache::Flag::Important);
 
-  char buf[512];
-  snprintf(buf, 512, _("%s is an essential package!\n\nAre you sure you want to remove it?\nType '%s' if you are."), pkg.Name(), _(confirm_str));
+  fragment *f=wrapbox(fragf(_("%s is an essential package!%n%nAre you sure you want to remove it?%nType '%s' if you are."), pkg.Name(), _(confirm_str)));
 
-  vscreen_widget *w=vs_dialog_string(buf,
+  f->set_attr(get_color("DefaultWidgetBackground") | A_REVERSE);
+
+  vscreen_widget *w=vs_dialog_string(f,
 				     "",
 				     arg(sigc::bind(sigc::ptr_fun(try_delete_essential),
 						    pkg, purge)),
 				     NULL,
 				     NULL,
-				     NULL);
+				     NULL,
+				     get_color("DefaultWidgetBackground") | A_REVERSE);
 
   w->show_all();
 
@@ -392,7 +395,7 @@
       else if(access("/bin/su", X_OK)==0)
 	sucmd="/bin/su -c \"/usr/sbin/dpkg-reconfigure '%s'\"";
       else
-	popup_widget(vs_dialog_ok(_("You are not root and I cannot find any way\nto become root.  To reconfigure this package,\ninstall the menu package, the login package,\nor run aptitude as root.")));
+	popup_widget(vs_dialog_ok(text_fragment(_("You are not root and I cannot find any way to become root.  To reconfigure this package, install the menu package, the login package, or run aptitude as root."))));
 
       if(sucmd)
 	{