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"
23 GUrl::GUrl(Dialog & parent)
24 : GViewCB<ControlCommand, GViewGladeB>(parent, _("URL"))
31 string const gladeName = findGladeFile("url");
32 xml_ = Gnome::Glade::Xml::create(gladeName);
33 Gtk::Button * restore;
37 xml_->get_widget("Url", url_);
38 xml_->get_widget("Name", name_);
39 xml_->get_widget("Html", htmlType_);
40 xml_->get_widget("Restore", restore);
41 xml_->get_widget("Ok", ok);
42 xml_->get_widget("Apply", apply);
43 xml_->get_widget("Cancel", cancel);
48 bcview().addReadOnly(name_);
49 bcview().addReadOnly(url_);
50 bcview().addReadOnly(htmlType_);
52 url_->signal_changed().connect(
53 SigC::slot(*this, &GUrl::onEntryChanged));
54 name_->signal_changed().connect(
55 SigC::slot(*this, &GUrl::onEntryChanged));
59 void GUrl::onEntryChanged()
61 bc().valid(!url_->get_text().empty() || !name_->get_text().empty());
67 url_->set_text(Glib::locale_to_utf8(
68 controller().params().getContents()));
69 name_->set_text(Glib::locale_to_utf8(
70 controller().params().getOptions()));
71 if (controller().params().getCmdName() == "url")
72 htmlType_->set_active(false);
74 htmlType_->set_active();
80 controller().params().setContents(
81 Glib::locale_to_utf8(url_->get_text()));
82 controller().params().setOptions(
83 Glib::locale_to_utf8(name_->get_text()));
84 if (htmlType_->get_active())
85 controller().params().setCmdName("htmlurl");
87 controller().params().setCmdName("url");