index cc38de24fb495e93f3573755c4b9331fbdc42a6d..e191a93605cd82c582dbad1f415138b83378d37e 100644 (file)
* Lauris Kaplinski <lauris@kaplinski.com>
* Jon Phillips <jon@rejon.org>
* Ralf Stephan <ralf@ark.in-berlin.de> (Gtkmm)
+ * Jon A. Cruz <jon@joncruz.org>
+ * Abhishek Sharma
*
* Copyright (C) 2000 - 2005 Authors
*
#include <gtkmm/entry.h>
#include "inkscape.h"
+#include "sp-object.h"
#include "rdf.h"
#include "ui/widget/registry.h"
}
EntityEntry::EntityEntry (rdf_work_entity_t* ent, Gtk::Tooltips& tt, Registry& wr)
-: _label(Glib::ustring(_(ent->title))+":", 1.0, 0.5), _packable(0),
+: _label(Glib::ustring(_(ent->title)), 1.0, 0.5), _packable(0),
_entity(ent), _tt(&tt), _wr(&wr)
{
}
delete static_cast<Gtk::Entry*>(_packable);
}
-void
-EntityLineEntry::update (SPDocument *doc)
+void EntityLineEntry::update(SPDocument *doc)
{
const char *text = rdf_get_work_entity (doc, _entity);
+ // If RDF title is not set, get the document's <title> and set the RDF:
+ if ( !text && !strcmp(_entity->name, "title") && doc->root ) {
+ text = doc->root->title();
+ rdf_set_work_entity(doc, _entity, text);
+ }
static_cast<Gtk::Entry*>(_packable)->set_text (text ? text : "");
}
_wr->setUpdating (true);
SPDocument *doc = SP_ACTIVE_DOCUMENT;
Glib::ustring text = static_cast<Gtk::Entry*>(_packable)->get_text();
- if (rdf_set_work_entity (doc, _entity, text.c_str()))
- SPDocumentUndo::done (doc, SP_VERB_NONE,
- /* TODO: annotate */ "entity-entry.cpp:101");
+ if (rdf_set_work_entity (doc, _entity, text.c_str())) {
+ DocumentUndo::done(doc, SP_VERB_NONE,
+ /* TODO: annotate */ "entity-entry.cpp:101");
+ }
_wr->setUpdating (false);
}
delete static_cast<Gtk::ScrolledWindow*>(_packable);
}
-void
-EntityMultiLineEntry::update (SPDocument *doc)
+void EntityMultiLineEntry::update(SPDocument *doc)
{
const char *text = rdf_get_work_entity (doc, _entity);
+ // If RDF title is not set, get the document's <title> and set the RDF:
+ if ( !text && !strcmp(_entity->name, "title") && doc->root ) {
+ text = doc->root->title();
+ rdf_set_work_entity(doc, _entity, text);
+ }
Gtk::ScrolledWindow *s = static_cast<Gtk::ScrolledWindow*>(_packable);
Gtk::TextView *tv = static_cast<Gtk::TextView*>(s->get_child());
tv->get_buffer()->set_text (text ? text : "");
Gtk::ScrolledWindow *s = static_cast<Gtk::ScrolledWindow*>(_packable);
Gtk::TextView *tv = static_cast<Gtk::TextView*>(s->get_child());
Glib::ustring text = tv->get_buffer()->get_text();
- if (rdf_set_work_entity (doc, _entity, text.c_str()))
- SPDocumentUndo::done (doc, SP_VERB_NONE,
- /* TODO: annotate */ "entity-entry.cpp:146");
+ if (rdf_set_work_entity (doc, _entity, text.c_str())) {
+ DocumentUndo::done(doc, SP_VERB_NONE,
+ /* TODO: annotate */ "entity-entry.cpp:146");
+ }
_wr->setUpdating (false);
}