24#include <gtkmm/entry.h>
25#include <gtkmm/checkbutton.h>
38 {_(
"Proprietary"),
"",
nullptr};
41 {Q_(
"MetadataLicence|Other"),
"",
nullptr};
43class LicenseItem final :
public Gtk::CheckButton {
45 LicenseItem (
struct rdf_license_t const* license, EntityEntry* entity, Registry &wr, Gtk::CheckButton *group);
46 [[nodiscard]]
rdf_license_t const *get_license()
const {
return _lic; }
49 void on_toggled() final;
55LicenseItem::LicenseItem (struct
rdf_license_t const* license, EntityEntry* entity, Registry &wr,
Gtk::CheckButton *group)
56:
Gtk::CheckButton(_(license->
name)), _lic(license), _eep(entity), _wr(wr)
64void LicenseItem::on_toggled()
66 if (_wr.isUpdating() || !_wr.desktop())
69 _wr.setUpdating (
true);
70 SPDocument *doc = _wr.desktop()->getDocument();
75 _wr.setUpdating (
false);
76 static_cast<Gtk::Entry*
>(_eep->_packable)->set_text (_lic->
uri);
96 item->set_active(
true);
107 auto const box = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL);
114 Gtk::CheckButton *
const group)
117 auto const item = Gtk::make_managed<LicenseItem>(&license,
_eentry.get(), wr, group);
129 constexpr bool read_only =
false;
134 [=](
auto const item){ return item->get_license() == license; });
137 (*item)->set_active(
true);
static void done(SPDocument *document, Glib::ustring const &event_description, Glib::ustring const &undo_icon, unsigned int object_modified_tag=0)
static EntityEntry * create(rdf_work_entity_t *ent, Registry &wr)
Typed SVG document implementation.
void update(SPCtx *ctx, unsigned int flags) override
Editable view implementation.
TODO: insert short description here.
Widget for specifying a document's license; part of document preferences dialog.
void pack_start(Gtk::Box &box, Gtk::Widget &child, bool const expand, bool const fill, unsigned const padding)
Adds child to box, packed with reference to the start of box.
static void append(std::vector< T > &target, std::vector< T > &&source)
Helpers for using Gtk::Boxes, encapsulating large changes between GTK3 & GTK4.
struct rdf_license_t rdf_licenses[]
struct rdf_work_entity_t * rdf_find_entity(gchar const *name)
Retrieves a known RDF/Work entity by name.
struct rdf_license_t * rdf_get_license(SPDocument *document, bool read_only)
Attempts to match and retrieve a known RDF/License from the document XML.
void rdf_set_license(SPDocument *doc, struct rdf_license_t const *license)
Stores an RDF/License XML in the document XML.
Holds license name and RDF information.
struct rdf_double_t * details
Holds known RDF/Work tags.