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

Daniel Burrows dburrows@costa.debian.org
Sat, 02 Jul 2005 13:51:30 +0000


Author: dburrows
Date: Sat Jul  2 13:51:28 2005
New Revision: 3531

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/pkg_subtree.cc
   branches/aptitude-0.3/aptitude/src/pkg_subtree.h
Log:
Fix the pkg_subtree class for wide characters.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Sat Jul  2 13:51:28 2005
@@ -1,5 +1,9 @@
 2005-07-02  Daniel Burrows  <dburrows@debian.org>
 
+	* src/pkg_subtree.cc, src/pkg_subtree.h:
+
+	  Convert the pkg_subtree class to wide characters.
+
 	* src/pkg_node.cc, src/pkg_node.h:
 
 	  Convert the core package node class to wide characters.

Modified: branches/aptitude-0.3/aptitude/src/pkg_subtree.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/pkg_subtree.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/pkg_subtree.cc	Sat Jul  2 13:51:28 2005
@@ -33,22 +33,22 @@
   vs_subtree<pkg_tree_node>::paint(win, y, hierarchical, name);
 }
 
-const char *pkg_subtree::tag() const
+const wchar_t *pkg_subtree::tag()
 {
   return name.c_str();
 }
 
-const char *pkg_subtree::label() const
+const wchar_t *pkg_subtree::label()
 {
   return name.c_str();
 }
 
-bool pkg_subtree::dispatch_char(chtype ch, vs_tree *owner)
+bool pkg_subtree::dispatch_key(const key &k, vs_tree *owner)
 {
-  if(pkg_tree_node::dispatch_char(ch, owner))
+  if(pkg_tree_node::dispatch_key(k, owner))
     return true;
   else
-    return vs_subtree<pkg_tree_node>::dispatch_char(ch, owner);
+    return vs_subtree<pkg_tree_node>::dispatch_key(k, owner);
 }
 
 void pkg_subtree::select(undo_group *undo)
@@ -124,11 +124,11 @@
 void pkg_subtree::highlighted(vs_tree *win)
 {
   if(info_signal)
-    (*info_signal)(string(description));
+    (*info_signal)(description);
 }
 
 void pkg_subtree::unhighlighted(vs_tree *win)
 {
   if(info_signal)
-    (*info_signal)("");
+    (*info_signal)(L"");
 }

Modified: branches/aptitude-0.3/aptitude/src/pkg_subtree.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/pkg_subtree.h	(original)
+++ branches/aptitude-0.3/aptitude/src/pkg_subtree.h	Sat Jul  2 13:51:28 2005
@@ -29,30 +29,30 @@
 class pkg_subtree:public vs_subtree<pkg_tree_node>,
 		  public pkg_tree_node
 {
-  std::string name;
-  std::string description; // This is like a Description: field.
+  std::wstring name;
+  std::wstring description; // This is like a Description: field.
 
-  sigc::signal1<void, std::string> *info_signal;
+  sigc::signal1<void, std::wstring> *info_signal;
 protected:
-  void set_label(std::string _name) {name=_name;}
+  void set_label(const std::wstring &_name) {name=_name;}
 public:
-  pkg_subtree(std::string _name, std::string _description="",
-	      sigc::signal1<void, std::string> *_info_signal=NULL,
+  pkg_subtree(std::wstring _name, std::wstring _description=L"",
+	      sigc::signal1<void, std::wstring> *_info_signal=NULL,
 	      bool _expanded=false):
     vs_subtree<pkg_tree_node>(_expanded), name(_name),
     description(_description), info_signal(_info_signal)
   {}
 
-  pkg_subtree(std::string _name, bool _expanded):
+  pkg_subtree(std::wstring _name, bool _expanded):
     vs_subtree<pkg_tree_node>(_expanded), name(_name),
-    description(""), info_signal(NULL)
+    description(L""), info_signal(NULL)
   {
   }
 
   virtual void paint(vs_tree *win, int y, bool hierarchical,
 		     const style &st);
-  virtual const char *tag() const;
-  virtual const char *label() const;
+  virtual const wchar_t *tag();
+  virtual const wchar_t *label();
 
   virtual void select(undo_group *undo);
   virtual void hold(undo_group *undo);
@@ -65,10 +65,10 @@
   virtual void highlighted(vs_tree *win);
   virtual void unhighlighted(vs_tree *win);
 
-  std::string get_name() {return name;}
-  std::string get_description() {return description;}
+  std::wstring get_name() {return name;}
+  std::wstring get_description() {return description;}
 
-  bool dispatch_char(chtype ch, vs_tree *owner);
+  bool dispatch_key(const key &k, vs_tree *owner);
 };
 
 #endif