Use Layer::get_non_empty_description() instead of checking whether the description...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Fri, 11 Jan 2008 10:11:39 +0000 (10:11 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Fri, 11 Jan 2008 10:11:39 +0000 (10:11 +0000)
git-svn-id: http://svn.voria.com/code@1328 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-studio/trunk/src/gtkmm/layergrouptreestore.cpp
synfig-studio/trunk/src/gtkmm/layerparamtreestore.cpp
synfig-studio/trunk/src/gtkmm/layertreestore.cpp
synfig-studio/trunk/src/synfigapp/actions/layeractivate.cpp
synfig-studio/trunk/src/synfigapp/actions/layerremove.cpp
synfig-studio/trunk/src/synfigapp/actions/valuedescset.cpp

index 003f167..aa84808 100644 (file)
@@ -212,11 +212,7 @@ LayerGroupTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int
                        Glib::Value<Glib::ustring> x;
                        g_value_init(x.gobj(),x.value_type());
 
-
-                       if(!layer->get_description().empty())
-                               x.set(layer->get_description());
-                       else
-                               x.set(layer->get_local_name());
+                       x.set(layer->get_non_empty_description());
 
                        g_value_init(value.gobj(),x.value_type());
                        //g_value_copy(x.gobj(),value.gobj());
index bde9efe..4f6cf01 100644 (file)
@@ -133,11 +133,7 @@ LayerParamTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int
                Glib::Value<Glib::ustring> x;
                g_value_init(x.gobj(),x.value_type());
 
-
-               if(!layer->get_description().empty())
-                       x.set(layer->get_description());
-               else
-                       x.set(layer->get_local_name());
+               x.set(layer->get_non_empty_description());
 
                g_value_init(value.gobj(),x.value_type());
                g_value_copy(x.gobj(),value.gobj());
index 894563c..1e12538 100644 (file)
@@ -198,11 +198,7 @@ LayerTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int colum
                Glib::Value<Glib::ustring> x;
                g_value_init(x.gobj(),x.value_type());
 
-
-               if(!layer->get_description().empty())
-                       x.set(layer->get_description());
-               else
-                       x.set(layer->get_local_name());
+               x.set(layer->get_non_empty_description());
 
                g_value_init(value.gobj(),x.value_type());
                //g_value_copy(x.gobj(),value.gobj());
index 9b69de7..948bc6f 100644 (file)
@@ -68,17 +68,12 @@ Action::LayerActivate::get_local_name()const
 {
        if(!layer)
                return _("Activate Layer");
-       String name;
-       if(layer->get_description().empty())
-               name=layer->get_local_name();
-       else
-               name=layer->get_description();
 
        return strprintf("%s '%s'",
                                         new_status
                                         ? _("Activate Layer")
                                         : _("Deactivate Layer"),
-                                        name.c_str());
+                                        layer->get_non_empty_description().c_str());
 }
 
 Action::ParamVocab
index 6ca5e8a..4f08c3f 100644 (file)
@@ -75,14 +75,10 @@ Action::LayerRemove::get_local_name()const
                                        (layer_list.size() == 1
                                         ? _("Remove Layer")
                                         : _("Remove Layers")),
-                                       (layer_list.begin()->first->get_description().empty()
-                                        ? layer_list.begin()->first->get_local_name()
-                                        : layer_list.begin()->first->get_description()).c_str());
+                                       layer_list.begin()->first->get_non_empty_description().c_str());
 
        for(std::list<std::pair<synfig::Layer::Handle,int> >::const_iterator iter=++layer_list.begin(); iter!=layer_list.end(); ++iter)
-               ret += strprintf(", '%s'", (iter->first->get_description().empty()
-                                                                       ? iter->first->get_local_name()
-                                                                       : iter->first->get_description()).c_str());
+               ret += strprintf(", '%s'", (iter->first->get_non_empty_description().c_str()));
        return ret;
 }
 
index 01f38ae..e5edf2a 100644 (file)
@@ -84,9 +84,7 @@ Action::ValueDescSet::get_local_name()const
        }
        else if(value_desc.parent_is_layer_param())
                name = strprintf(_("'%s' -> %s"),
-                                                (value_desc.get_layer()->get_description().empty()
-                                                 ? value_desc.get_layer()->get_local_name()
-                                                 : value_desc.get_layer()->get_description()).c_str(),
+                                                value_desc.get_layer()->get_non_empty_description().c_str(),
                                                 value_desc.get_param_name().c_str());
        else if(value_desc.parent_is_value_node())
        {
@@ -96,10 +94,8 @@ Action::ValueDescSet::get_local_name()const
                Layer::Handle parent_layer(dynamic_cast<Layer*>(node));
                if(parent_layer)
                        name = strprintf(_("'%s' => %s"),
-                                                        (parent_layer->get_description().empty()
-                                                         ? parent_layer->get_local_name()
-                                                         : parent_layer->get_description()).c_str(),
-                                                        value_node->link_local_name(value_desc.get_index()).c_str()); 
+                                                        parent_layer->get_non_empty_description().c_str(),
+                                                        value_node->link_local_name(value_desc.get_index()).c_str());
                else
                        name = value_node->link_local_name(value_desc.get_index());
        }