summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/objects.cpp
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/ui/dialog/objects.cpp
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/ui/dialog/objects.cpp')
-rw-r--r--src/ui/dialog/objects.cpp18
1 files changed, 5 insertions, 13 deletions
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;