Skip to content

Commit

Permalink
Some attempted optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
wivlaro committed Jun 6, 2016
1 parent 29164dd commit 90b118d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
8 changes: 6 additions & 2 deletions GtkAbstractInspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ void GtkAbstractInspector::inspectAsMain(const char* name, Inspectable& object)
auto& frame = childPopulator.ensureChild<GtkObjectFrame>();
std::string label = object.getName();
if (name && strlen(name)) label = std::string(name) + ": " + label;
frame.set_label(label);
if (frame.get_label() != label) {
frame.set_label(label);
}
frame.childPopulator.reset();
object.onInspect(frame);
frame.childPopulator.pruneRemaining();
Expand All @@ -108,7 +110,9 @@ void GtkAbstractInspector::inspectAsMain(const char* name, Inspectable& object)
auto& frame = childPopulator.ensureChild<GtkObjectFrame>();
std::string label = getNameAndType(*component);
if (name && strlen(name)) label = std::string(name) + ": " + label;
frame.set_label(label);
if (frame.get_label() != label) {
frame.set_label(label);
}
frame.childPopulator.reset();
component->onInspect(frame);
frame.childPopulator.pruneRemaining();
Expand Down
4 changes: 3 additions & 1 deletion GtkAbstractInspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ class GtkAbstractInspector : public Inspector
FieldValueWidget& addField(const char* name)
{
GtkInspectionField& field = childPopulator.ensureChild<GtkInspectionField>();
field.getLabel().set_text(name);
if (field.getLabel().get_text() != name) {
field.getLabel().set_text(name);
}
return field.ensureChild<FieldValueWidget>();
}

Expand Down
8 changes: 6 additions & 2 deletions GtkAbstractInspector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ inline void GtkAbstractInspector::editable(const char* name, Inspectable* i) {
frame.childPopulator.reset();
std::string label = i->getName() + " (" + demangle(typeid(*i).name()) + ")";
if (name && strlen(name)) label = std::string(name) + ": " + label;
frame.set_label(label);
if (frame.get_label() != label) {
frame.set_label(label);
}
i->onInspect(frame);
frame.childPopulator.pruneRemaining();
}
Expand All @@ -182,7 +184,9 @@ inline void GtkAbstractInspector::readonly(const char* name, Inspectable* i) {
frame.childPopulator.reset();
std::string label = i->getName() + " (" + demangle(typeid(*i).name()) + ")";
if (name && strlen(name)) label = std::string(name) + ": " + label;
frame.set_label(label);
if (frame.get_label() != label) {
frame.set_label(label);
}
i->onInspect(frame);
frame.childPopulator.pruneRemaining();
}
Expand Down

0 comments on commit 90b118d

Please sign in to comment.