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"
27 GUrl::GUrl(Dialog & parent)
28 : GViewCB<ControlCommand, GViewGladeB>(parent, _("URL"))
35 string const gladeName = findGladeFile("url");
36 xml_ = Gnome::Glade::Xml::create(gladeName);
37 Gtk::Button * restore;
41 xml_->get_widget("Url", url_);
42 xml_->get_widget("Name", name_);
43 xml_->get_widget("Html", htmlType_);
44 xml_->get_widget("Restore", restore);
45 xml_->get_widget("Ok", ok);
46 xml_->get_widget("Apply", apply);
47 xml_->get_widget("Cancel", cancel);
52 bcview().addReadOnly(name_);
53 bcview().addReadOnly(url_);
54 bcview().addReadOnly(htmlType_);
56 url_->signal_changed().connect(
57 SigC::slot(*this, &GUrl::onEntryChanged));
58 name_->signal_changed().connect(
59 SigC::slot(*this, &GUrl::onEntryChanged));
63 void GUrl::onEntryChanged()
65 bc().valid(!url_->get_text().empty() || !name_->get_text().empty());
71 url_->set_text(Glib::locale_to_utf8(
72 controller().params().getContents()));
73 name_->set_text(Glib::locale_to_utf8(
74 controller().params().getOptions()));
75 if (controller().params().getCmdName() == "url")
76 htmlType_->set_active(false);
78 htmlType_->set_active();
84 controller().params().setContents(
85 Glib::locale_to_utf8(url_->get_text()));
86 controller().params().setOptions(
87 Glib::locale_to_utf8(name_->get_text()));
88 if (htmlType_->get_active())
89 controller().params().setCmdName("htmlurl");
91 controller().params().setCmdName("url");
94 } // namespace frontend