[Aptitude-svn-commit] r3468 - in branches/aptitude-0.3/aptitude: . src/vscreen

Daniel Burrows dburrows@costa.debian.org
Sun, 26 Jun 2005 17:34:31 +0000


Author: dburrows
Date: Sun Jun 26 17:34:28 2005
New Revision: 3468

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/vscreen/vs_util.cc
   branches/aptitude-0.3/aptitude/src/vscreen/vs_util.h
Log:
Use explicit transcoding in the fallback routines.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Sun Jun 26 17:34:28 2005
@@ -1,5 +1,9 @@
 2005-06-26  Daniel Burrows  <dburrows@debian.org>
 
+	* src/vscreen/vs_util.cc:
+
+	  Add explicit transcoding in the fallback routines.
+
 	* src/vscreen/vs_label.cc, src/vscreen/vs_label.h:
 
 	  Add initializers for wstrings.

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_util.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_util.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_util.cc	Sun Jun 26 17:34:28 2005
@@ -1,5 +1,6 @@
 // vs_util.cc
 
+#include "transcode.h"
 #include "vs_button.h"
 #include "vs_center.h"
 #include "vs_editline.h"
@@ -21,7 +22,7 @@
 
 using namespace std;
 
-vscreen_widget *vs_dialog_ok(vscreen_widget *w, slot0arg okslot, string label,
+vscreen_widget *vs_dialog_ok(vscreen_widget *w, slot0arg okslot, wstring label,
 			     const style &st)
 {
   vs_center *center=new vs_center;
@@ -45,7 +46,7 @@
   return center;
 }
 
-vscreen_widget *vs_dialog_ok(fragment *msg, slot0arg okslot, string label,
+vscreen_widget *vs_dialog_ok(fragment *msg, slot0arg okslot, wstring label,
 			     const style &st, bool scrollbar)
 {
   vscreen_widget *w;
@@ -74,7 +75,7 @@
 
 vscreen_widget *vs_dialog_ok(fragment *msg, slot0arg okslot, const style &st, bool scrollbar)
 {
-  return vs_dialog_ok(msg, okslot, _("Ok"), st, scrollbar);
+  return vs_dialog_ok(msg, okslot, transcode(_("Ok")), st, scrollbar);
 }
 
 vscreen_widget *vs_dialog_ok(fragment *msg, slot0arg okslot, bool scrollbar)
@@ -82,24 +83,24 @@
   return vs_dialog_ok(msg, okslot, style_attrs_flip(A_REVERSE), scrollbar);
 }
 
-vscreen_widget *vs_dialog_ok(string msg, slot0arg okslot,
+vscreen_widget *vs_dialog_ok(wstring msg, slot0arg okslot,
 			     const style &st)
 {
   vscreen_widget *l=new vs_label(msg);
 
-  return vs_dialog_ok(l, okslot, _("Ok"), st);
+  return vs_dialog_ok(l, okslot, transcode(_("Ok")), st);
 }
 
-vscreen_widget *vs_dialog_ok(string msg, slot0arg okslot)
+vscreen_widget *vs_dialog_ok(wstring msg, slot0arg okslot)
 {
   return vs_dialog_ok(msg, okslot, style_attrs_flip(A_REVERSE));
 }
 
 vscreen_widget *vs_dialog_yesno(vscreen_widget *widget,
 				slot0arg yesslot,
-				string yeslabel,
+				wstring yeslabel,
 				slot0arg noslot,
-				string nolabel,
+				wstring nolabel,
 				const style &st,
 				bool deflt)
 {
@@ -143,11 +144,11 @@
   return center;
 }
 
-vscreen_widget *vs_dialog_yesno(string msg,
+vscreen_widget *vs_dialog_yesno(wstring msg,
 				slot0arg yesslot,
-				string yeslabel,
+				wstring yeslabel,
 				slot0arg noslot,
-				string nolabel,
+				wstring nolabel,
 				const style &st,
 				bool deflt)
 {
@@ -156,16 +157,17 @@
   return vs_dialog_yesno(txt, yesslot, yeslabel, noslot, nolabel, st, deflt);
 }
 
-vscreen_widget *vs_dialog_yesno(string msg,
+vscreen_widget *vs_dialog_yesno(wstring msg,
 				slot0arg yesslot,
 				slot0arg noslot,
 				const style &st,
 				bool deflt)
 {
-  return vs_dialog_yesno(msg, yesslot, _("Yes"), noslot, _("No"), st, deflt);
+  return vs_dialog_yesno(msg, yesslot, transcode(_("Yes")),
+			 noslot, transcode(_("No")), st, deflt);
 }
 
-vscreen_widget *vs_dialog_yesno(string msg,
+vscreen_widget *vs_dialog_yesno(wstring msg,
 				slot0arg yesslot,
 				slot0arg noslot,
 				bool deflt)
@@ -199,15 +201,16 @@
 				bool scrollbar,
 				bool deflt)
 {
-  return vs_dialog_yesno(msg, yesslot, _("Yes"), noslot, _("No"), st,
+  return vs_dialog_yesno(msg, yesslot, transcode(_("Yes")),
+			 noslot, transcode(_("No")), st,
 			 scrollbar, deflt);
 }
 
 vscreen_widget *vs_dialog_yesno(fragment *msg,
 				slot0arg yesslot,
-				std::string yeslabel,
+				std::wstring yeslabel,
 				slot0arg noslot,
-				std::string nolabel,
+				std::wstring nolabel,
 				const style &st,
 				bool scrollbar,
 				bool deflt)
@@ -261,7 +264,7 @@
   if(searchslot)
     p->connect_key("Search", &global_bindings, sigc::bind(*searchslot, p));
 
-  return vs_dialog_ok(t, okslot, _("Ok"), st);
+  return vs_dialog_ok(t, okslot, transcode(_("Ok")), st);
 }
 
 vscreen_widget *vs_dialog_fileview(string fn,
@@ -272,30 +275,31 @@
 			    style_attrs_flip(A_REVERSE));
 }
 
-static void do_dialog_string(string s,
+static void do_dialog_string(wstring s,
 			     sigc::slot0<void> realslot)
 {
   realslot();
 }
 
 static void also_do_dialog_string(vs_editline *e,
-				  sigc::slot1<void, string> thestrslot)
+				  sigc::slot1<void, wstring> thestrslot)
 {
   e->add_to_history(e->get_text());
   thestrslot(e->get_text());
 }
 
 vscreen_widget *vs_dialog_string(vscreen_widget *msg,
-				 string deflt,
-				 slotarg<sigc::slot1<void, string> > slot,
+				 wstring deflt,
+				 slotarg<sigc::slot1<void, wstring> > slot,
 				 slotarg<sigc::slot0<void> > cancel_slot,
-				 slotarg<sigc::slot1<void, string> > changed_slot,
+				 slotarg<sigc::slot1<void, wstring> > changed_slot,
 				 vs_editline::history_list *history,
 				 const style &st)
 {
   vs_table *t=new vs_table;
-  vs_editline *e=new vs_editline(rootwin.getmaxx()-6, "", deflt, history);
-  vs_button *bok=new vs_button(_("Ok")), *bcancel=new vs_button(_("Cancel"));
+  vs_editline *e=new vs_editline(rootwin.getmaxx()-6, L"", deflt, history);
+  vs_button *bok=new vs_button(_("Ok"));
+  vs_button *bcancel=new vs_button(_("Cancel"));
   vs_frame *f=new vs_frame(t);
   vs_center *c=new vs_center(f);
 
@@ -331,10 +335,10 @@
 }
 
 vscreen_widget *vs_dialog_string(fragment *msg,
-				 string deflt,
-				 slotarg<sigc::slot1<void, string> > slot,
+				 wstring deflt,
+				 slotarg<sigc::slot1<void, wstring> > slot,
 				 slotarg<sigc::slot0<void> > cancel_slot,
-				 slotarg<sigc::slot1<void, string> > changed_slot,
+				 slotarg<sigc::slot1<void, wstring> > changed_slot,
 				 vs_editline::history_list *history,
 				 const style &st)
 {
@@ -347,11 +351,11 @@
 			  st);
 }
 
-vscreen_widget *vs_dialog_string(string msg,
-				 string deflt,
-				 slotarg<sigc::slot1<void, string> > slot,
+vscreen_widget *vs_dialog_string(wstring msg,
+				 wstring deflt,
+				 slotarg<sigc::slot1<void, wstring> > slot,
 				 slotarg<sigc::slot0<void> > cancel_slot,
-				 slotarg<sigc::slot1<void, string> > changed_slot,
+				 slotarg<sigc::slot1<void, wstring> > changed_slot,
 				 vs_editline::history_list *history,
 				 const style &st)
 {
@@ -364,11 +368,11 @@
 			  st);
 }
 
-vscreen_widget *vs_dialog_string(string msg,
-				 string deflt,
-				 slotarg<sigc::slot1<void, string> > slot,
+vscreen_widget *vs_dialog_string(wstring msg,
+				 wstring deflt,
+				 slotarg<sigc::slot1<void, wstring> > slot,
 				 slotarg<sigc::slot0<void> > cancel_slot,
-				 slotarg<sigc::slot1<void, string> > changed_slot,
+				 slotarg<sigc::slot1<void, wstring> > changed_slot,
 				 vs_editline::history_list *history)
 {
   return vs_dialog_string(msg,

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_util.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_util.h	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_util.h	Sun Jun 26 17:34:28 2005
@@ -32,18 +32,18 @@
  *  box, defaults to reverse-video of DefaultWidgetBackground.
  */
 vscreen_widget *vs_dialog_ok(vscreen_widget *widget,
-			     slot0arg okslot, std::string label,
+			     slot0arg okslot, std::wstring label,
 			     const style &st);
 
 vscreen_widget *vs_dialog_ok(fragment *msg, slot0arg okslot=NULL, bool scrollbar=false);
 vscreen_widget *vs_dialog_ok(fragment *msg, slot0arg okslot, const style &st, bool scrollbar=false);
-vscreen_widget *vs_dialog_ok(fragment *msg, slot0arg okslot, std::string label,
+vscreen_widget *vs_dialog_ok(fragment *msg, slot0arg okslot, std::wstring label,
 			     const style &st, bool scrollbar=false);
 
-vscreen_widget *vs_dialog_ok(std::string msg, slot0arg okslot=NULL);
-vscreen_widget *vs_dialog_ok(std::string msg, slot0arg okslot,
+vscreen_widget *vs_dialog_ok(std::wstring msg, slot0arg okslot=NULL);
+vscreen_widget *vs_dialog_ok(std::wstring msg, slot0arg okslot,
 			     const style &st);
-vscreen_widget *vs_dialog_ok(std::string msg, slot0arg okslot, std::string label,
+vscreen_widget *vs_dialog_ok(std::wstring msg, slot0arg okslot, std::wstring label,
 			     const style &st);
 
 /** Create a dialog box with two buttons, labelled "yes" and "no".
@@ -66,9 +66,9 @@
  */
 vscreen_widget *vs_dialog_yesno(vscreen_widget *widget,
 				slot0arg yesslot,
-				std::string yeslabel,
+				std::wstring yeslabel,
 				slot0arg noslot,
-				std::string nolabel,
+				std::wstring nolabel,
 				const style &st,
 				bool deflt=true);
 
@@ -85,27 +85,27 @@
 				bool deflt=true);
 vscreen_widget *vs_dialog_yesno(fragment *msg,
 				slot0arg yesslot,
-				std::string yeslabel,
+				std::wstring yeslabel,
 				slot0arg noslot,
-				std::string nolabel,
+				std::wstring nolabel,
 				const style &st,
 				bool scrollbar=false,
 				bool deflt=true);
 
-vscreen_widget *vs_dialog_yesno(std::string msg,
+vscreen_widget *vs_dialog_yesno(std::wstring msg,
 				slot0arg yesslot,
 				slot0arg noslot,
 				bool deflt=true);
-vscreen_widget *vs_dialog_yesno(std::string msg,
+vscreen_widget *vs_dialog_yesno(std::wstring msg,
 				slot0arg yesslot,
 				slot0arg noslot,
 				const style &st,
 				bool deflt=true);
-vscreen_widget *vs_dialog_yesno(std::string msg,
+vscreen_widget *vs_dialog_yesno(std::wstring msg,
 				slot0arg yesslot,
-				std::string yeslabel,
+				std::wstring yeslabel,
 				slot0arg noslot,
-				std::string nolabel,
+				std::wstring nolabel,
 				const style &st,
 				bool deflt=true);
 
@@ -119,26 +119,26 @@
 				   const style &st);
 
 vscreen_widget *vs_dialog_string(fragment *msg,
-				 std::string deflt,
-				 slotarg<sigc::slot1<void, std::string> > okslot,
+				 std::wstring deflt,
+				 slotarg<sigc::slot1<void, std::wstring> > okslot,
 				 slotarg<sigc::slot0<void> > cancel_slot,
-				 slotarg<sigc::slot1<void, std::string> > changed_slot,
+				 slotarg<sigc::slot1<void, std::wstring> > changed_slot,
 				 vs_editline::history_list *history,
 				 const style &st);
 
-vscreen_widget *vs_dialog_string(std::string msg,
-				 std::string deflt,
-				 slotarg<sigc::slot1<void, std::string> > okslot,
+vscreen_widget *vs_dialog_string(std::wstring msg,
+				 std::wstring deflt,
+				 slotarg<sigc::slot1<void, std::wstring> > okslot,
 				 slotarg<sigc::slot0<void> > cancel_slot,
-				 slotarg<sigc::slot1<void, std::string> > changed_slot,
+				 slotarg<sigc::slot1<void, std::wstring> > changed_slot,
 				 vs_editline::history_list *history,
 				 const style &st);
 
-vscreen_widget *vs_dialog_string(std::string msg,
-				 std::string deflt,
-				 slotarg<sigc::slot1<void, std::string> > slot,
+vscreen_widget *vs_dialog_string(std::wstring msg,
+				 std::wstring deflt,
+				 slotarg<sigc::slot1<void, std::wstring> > slot,
 				 slotarg<sigc::slot0<void> > cancel_slot,
-				 slotarg<sigc::slot1<void, std::string> > changed_slot,
+				 slotarg<sigc::slot1<void, std::wstring> > changed_slot,
 				 vs_editline::history_list *history);
 
 #endif