X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fprop%2Fstring.cpp;h=511fe6c4352de19356c36604b5d1479e8ab46319;hb=e8d009288de28cb194bc7964f96677c2baf900c9;hp=c2b2c67c26a5c97377dff2b853759206ef65ffe7;hpb=4e5a4405482a296ebb6014e627298ad156c78d55;p=pulseview.git diff --git a/pv/prop/string.cpp b/pv/prop/string.cpp index c2b2c67..511fe6c 100644 --- a/pv/prop/string.cpp +++ b/pv/prop/string.cpp @@ -25,8 +25,9 @@ #include "string.h" -using namespace std; -using namespace boost; +using std::string; + +using Glib::ustring; namespace pv { namespace prop { @@ -44,14 +45,18 @@ QWidget* String::get_widget(QWidget *parent, bool auto_commit) if (_line_edit) return _line_edit; - _line_edit = new QLineEdit(parent); + if (!_getter) + return NULL; + + Glib::VariantBase variant = _getter(); + if (!variant.gobj()) + return NULL; - GVariant *const value = _getter ? _getter() : NULL; - if (value) { - _line_edit->setText(QString( - g_variant_get_string(value, NULL))); - g_variant_unref(value); - } + string value = Glib::VariantBase::cast_dynamic>( + variant).get(); + + _line_edit = new QLineEdit(parent); + _line_edit->setText(QString::fromStdString(value)); if (auto_commit) connect(_line_edit, SIGNAL(textEdited(const QString&)), @@ -68,7 +73,7 @@ void String::commit() return; QByteArray ba = _line_edit->text().toLocal8Bit(); - _setter(g_variant_new_string(ba.data())); + _setter(Glib::Variant::create(ba.data())); } void String::on_text_edited(const QString&)