summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNathan Lee <2431820-nathanal@users.noreply.gitlab.com>2019-11-05 22:37:05 +0000
committerNathan Lee <2431820-nathanal@users.noreply.gitlab.com>2019-11-10 23:12:10 +0000
commit5b22a003be75c72b07ae9ed90496be9f5bee4992 (patch)
treef1e3367055f1aea84e0996cef7bbbd6ae981ecda /src
parentUpdated es.po with a few new strings from the source code (diff)
downloadinkscape-5b22a003be75c72b07ae9ed90496be9f5bee4992.tar.gz
inkscape-5b22a003be75c72b07ae9ed90496be9f5bee4992.zip
Use same label for Layers and Objects dialogs
Also prevent crash for unset ids in Object Properties Fix https://gitlab.com/inkscape/inbox/issues/1129
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/layers.cpp4
-rw-r--r--src/ui/dialog/object-properties.cpp2
-rw-r--r--src/ui/dialog/objects.cpp18
3 files changed, 8 insertions, 16 deletions
diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp
index 06af29a6e..a2684267b 100644
--- a/src/ui/dialog/layers.cpp
+++ b/src/ui/dialog/layers.cpp
@@ -312,9 +312,9 @@ bool LayersPanel::_checkForUpdated(const Gtk::TreePath &/*path*/, const Gtk::Tre
* with the correct value (sp-object bug?). So use the inkscape:label attribute instead which
* has the correct value (bug #168351)
*/
- //row[_model->_colLabel] = layer->label() ? layer->label() : layer->getId();
+ //row[_model->_colLabel] = layer->label() ? layer->label() : layer->defaultLabel();
gchar const *label = layer->getAttribute("inkscape:label");
- row[_model->_colLabel] = label ? label : layer->getId();
+ row[_model->_colLabel] = label ? label : layer->defaultLabel();
row[_model->_colVisible] = SP_IS_ITEM(layer) ? !SP_ITEM(layer)->isHidden() : false;
row[_model->_colLocked] = SP_IS_ITEM(layer) ? SP_ITEM(layer)->isLocked() : false;
diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp
index fdf48ed53..b0a074dd3 100644
--- a/src/ui/dialog/object-properties.cpp
+++ b/src/ui/dialog/object-properties.cpp
@@ -342,7 +342,7 @@ void ObjectProperties::update()
SPObject *obj = static_cast<SPObject*>(item);
/* ID */
- _entry_id.set_text(obj->getId());
+ _entry_id.set_text(obj->getId() ? obj->getId() : "");
_entry_id.set_sensitive(TRUE);
_label_id.set_markup_with_mnemonic(_("_ID:") + Glib::ustring(" "));
diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp
index 730ad48c0..62b2bd94a 100644
--- a/src/ui/dialog/objects.cpp
+++ b/src/ui/dialog/objects.cpp
@@ -408,14 +408,8 @@ void ObjectsPanel::_addObject(SPItem* item, const Gtk::TreeModel::Row &row, bool
SPGroup * group = SP_IS_GROUP(item) ? SP_GROUP(item) : nullptr;
row[_model->_colObject] = item;
-
- //this seems to crash on convert stroke to path then undo (probably no ID?)
- try {
- row[_model->_colLabel] = item->label() ? item->label() : item->getId();
- } catch (...) {
- row[_model->_colLabel] = Glib::ustring("getId_failure");
- g_critical("item->getId() failed, using \"getId_failure\"");
- }
+ gchar const * label = item->label() ? item->label() : item->getId();
+ row[_model->_colLabel] = label ? label : item->defaultLabel();
row[_model->_colVisible] = !item->isHidden();
row[_model->_colLocked] = !item->isSensitive();
row[_model->_colType] = group ? (group->layerMode() == SPGroup::LAYER ? 2 : 1) : 0;
@@ -446,11 +440,9 @@ void ObjectsPanel::_updateObject( SPObject *obj, bool recurse ) {
//We found our item in the tree; now update it!
SPItem * item = SP_IS_ITEM(obj) ? SP_ITEM(obj) : nullptr;
SPGroup * group = SP_IS_GROUP(obj) ? SP_GROUP(obj) : nullptr;
- gchar const * id = obj->getId();
- if (!id) {
- id = _("no-id");
- }
- row[_model->_colLabel] = obj->label() ? obj->label() : id;
+
+ gchar const * label = obj->label() ? obj->label() : obj->getId();
+ row[_model->_colLabel] = label ? label : obj->defaultLabel();
row[_model->_colVisible] = item ? !item->isHidden() : false;
row[_model->_colLocked] = item ? !item->isSensitive() : false;
row[_model->_colType] = group ? (group->layerMode() == SPGroup::LAYER ? 2 : 1) : 0;