3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 // Too hard to make concept checks work with this file
14 #ifdef _GLIBCPP_CONCEPT_CHECKS
15 #undef _GLIBCPP_CONCEPT_CHECKS
18 #include "ControlCommand.h"
22 #include "support/lstrings.h"
25 #include <libglademm.h>
33 GUrl::GUrl(Dialog & parent)
34 : GViewCB<ControlCommand, GViewGladeB>(parent, _("URL"))
41 string const gladeName = findGladeFile("url");
42 xml_ = Gnome::Glade::Xml::create(gladeName);
43 Gtk::Button * restore;
47 xml_->get_widget("Url", url_);
48 xml_->get_widget("Name", name_);
49 xml_->get_widget("Html", htmlType_);
50 xml_->get_widget("Restore", restore);
51 xml_->get_widget("Ok", ok);
52 xml_->get_widget("Apply", apply);
53 xml_->get_widget("Cancel", cancel);
58 bcview().addReadOnly(name_);
59 bcview().addReadOnly(url_);
60 bcview().addReadOnly(htmlType_);
62 url_->signal_changed().connect(
63 sigc::mem_fun(*this, &GUrl::onEntryChanged));
64 name_->signal_changed().connect(
65 sigc::mem_fun(*this, &GUrl::onEntryChanged));
69 void GUrl::onEntryChanged()
71 bc().valid(!url_->get_text().empty() || !name_->get_text().empty());
77 url_->set_text(Glib::locale_to_utf8(
78 controller().params().getContents()));
79 name_->set_text(Glib::locale_to_utf8(
80 controller().params().getOptions()));
81 if (controller().params().getCmdName() == "url")
82 htmlType_->set_active(false);
84 htmlType_->set_active();
90 controller().params().setContents(
91 Glib::locale_to_utf8(url_->get_text()));
92 controller().params().setOptions(
93 Glib::locale_to_utf8(name_->get_text()));
94 if (htmlType_->get_active())
95 controller().params().setCmdName("htmlurl");
97 controller().params().setCmdName("url");
100 } // namespace frontend