[Aptitude-svn-commit] r3517 - in branches/aptitude-0.3/aptitude: . src
Daniel Burrows
dburrows@costa.debian.org
Sat, 02 Jul 2005 03:07:20 +0000
Author: dburrows
Date: Sat Jul 2 03:07:17 2005
New Revision: 3517
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/apt_config_widgets.cc
branches/aptitude-0.3/aptitude/src/apt_config_widgets.h
Log:
Convert the apt config widgets to support 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 03:07:17 2005
@@ -1,3 +1,9 @@
+2005-07-01 Daniel Burrows <dburrows@debian.org>
+
+ * src/apt_config_widgets.cc, src/apt_config_widgets.h:
+
+ Convert the apt config widgets to support wide characters.
+
2005-06-30 Daniel Burrows <dburrows@debian.org>
* src/mine/cmine.cc, src/mine/cmine.h:
Modified: branches/aptitude-0.3/aptitude/src/apt_config_widgets.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/apt_config_widgets.cc (original)
+++ branches/aptitude-0.3/aptitude/src/apt_config_widgets.cc Sat Jul 2 03:07:17 2005
@@ -1,6 +1,21 @@
// apt_config_widgets.cc
//
-// Copyright 2000 Daniel Burrows
+// Copyright 2000, 2001, 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 the Free Software Foundation; either version 2 of
+// the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
#include "apt_config_widgets.h"
#include <generic/apt.h>
@@ -8,10 +23,19 @@
#include <vscreen/config/colors.h>
#include <vscreen/fragment.h>
+#include <vscreen/transcode.h>
using namespace std;
-apt_bool_widget::apt_bool_widget(string _label, string _item, bool _default)
+apt_bool_widget::apt_bool_widget(const wstring &_label,
+ const string &_item, bool _default)
+ :vs_checkbutton(flowbox(text_fragment(_label)), aptcfg->FindB(_item, _default)),
+ item(_item), my_default(_default)
+{
+}
+
+apt_bool_widget::apt_bool_widget(const string &_label,
+ const string &_item, bool _default)
:vs_checkbutton(flowbox(text_fragment(_label)), aptcfg->FindB(_item, _default)),
item(_item), my_default(_default)
{
@@ -25,7 +49,8 @@
aptcfg->Set(item, get_checked()?"true":"false");
}
-apt_string_widget::apt_string_widget(string _item, string _default)
+apt_string_widget::apt_string_widget(const string &_item,
+ const string &_default)
:vs_editline("", aptcfg->Find(_item, _default.c_str())),
item(_item), my_default(_default)
{
@@ -33,14 +58,16 @@
void apt_string_widget::commit()
{
+ string text=transcode(get_text());
+
if(aptcfg->ExistsUser(item) ||
- aptcfg->Find(item, my_default.c_str())!=get_text())
- aptcfg->Set(item, get_text());
+ aptcfg->Find(item, my_default.c_str())!=text)
+ aptcfg->Set(item, text);
}
-apt_radio_widget::apt_radio_widget(string _item,
+apt_radio_widget::apt_radio_widget(const string &_item,
const vector<string> &_choices,
- string _default)
+ const string &_default)
:item(_item), choices(_choices), my_default(_default)
{
}
Modified: branches/aptitude-0.3/aptitude/src/apt_config_widgets.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/apt_config_widgets.h (original)
+++ branches/aptitude-0.3/aptitude/src/apt_config_widgets.h Sat Jul 2 03:07:17 2005
@@ -1,6 +1,21 @@
// apt_config_widgets.h -*-c++-*-
//
-// Copyright 2000 Daniel Burrows
+// Copyright 2000, 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 the Free Software Foundation; either version 2 of
+// the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
//
// Our friends the "apt config widgets". These little fellas know how to
// get their state from the libapt configuration and how to set the
@@ -36,7 +51,10 @@
bool my_default;
public:
- apt_bool_widget(std::string _label, std::string _item, bool _default);
+ apt_bool_widget(const std::wstring &_label,
+ const std::string &_item, bool _default);
+ apt_bool_widget(const std::string &_label,
+ const std::string &_item, bool _default);
void commit();
};
@@ -47,7 +65,8 @@
std::string my_default;
public:
- apt_string_widget(std::string _item, std::string _default);
+ apt_string_widget(const std::string &_item,
+ const std::string &_default);
void commit();
};
@@ -64,9 +83,9 @@
std::string my_default;
public:
- apt_radio_widget(std::string _item,
+ apt_radio_widget(const std::string &_item,
const std::vector<std::string> &choices,
- std::string _default);
+ const std::string &_default);
void commit();
};