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.
14 #include <libglademm.h>
16 #include "ControlCommand.h"
19 #include "support/lstrings.h"
26 GUrl::GUrl(Dialog & parent)
27 : GViewCB<ControlCommand, GViewGladeB>(parent, _("URL"))
34 string const gladeName = findGladeFile("url");
35 xml_ = Gnome::Glade::Xml::create(gladeName);
36 Gtk::Button * restore;
40 xml_->get_widget("Url", url_);
41 xml_->get_widget("Name", name_);
42 xml_->get_widget("Html", htmlType_);
43 xml_->get_widget("Restore", restore);
44 xml_->get_widget("Ok", ok);
45 xml_->get_widget("Apply", apply);
46 xml_->get_widget("Cancel", cancel);
51 bcview().addReadOnly(name_);
52 bcview().addReadOnly(url_);
53 bcview().addReadOnly(htmlType_);
55 url_->signal_changed().connect(
56 SigC::slot(*this, &GUrl::onEntryChanged));
57 name_->signal_changed().connect(
58 SigC::slot(*this, &GUrl::onEntryChanged));
62 void GUrl::onEntryChanged()
64 bc().valid(!url_->get_text().empty() || !name_->get_text().empty());
70 url_->set_text(Glib::locale_to_utf8(
71 controller().params().getContents()));
72 name_->set_text(Glib::locale_to_utf8(
73 controller().params().getOptions()));
74 if (controller().params().getCmdName() == "url")
75 htmlType_->set_active(false);
77 htmlType_->set_active();
83 controller().params().setContents(
84 Glib::locale_to_utf8(url_->get_text()));
85 controller().params().setOptions(
86 Glib::locale_to_utf8(name_->get_text()));
87 if (htmlType_->get_active())
88 controller().params().setCmdName("htmlurl");
90 controller().params().setCmdName("url");
93 } // namespace frontend