~ubuntu-branches/debian/sid/inkscape/sid

« back to all changes in this revision

Viewing changes to src/extension/param/string.cpp

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2013-06-21 15:13:32 UTC
  • mfrom: (10.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130621151332-uo22shomzjut843h
Tags: 0.48.4-1
* Upload to unstable
* debian/control: added myself to Uploaders
* debian/patches/: patchset updated
  - 04-Fix_FTBFS_on_gcc-4.8.patch added (Closes: #701297)

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
{
47
47
    if (in == NULL) return NULL; /* Can't have NULL string */
48
48
 
49
 
    if (_value != NULL)
 
49
    if (_value != NULL){
50
50
        g_free(_value);
 
51
        }
51
52
    _value = g_strdup(in);
52
53
 
53
54
    gchar * prefname = this->pref_name();
74
75
    Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), _value(NULL)
75
76
{
76
77
    const char * defaultval = NULL;
77
 
    if (sp_repr_children(xml) != NULL)
 
78
    if (sp_repr_children(xml) != NULL) {
78
79
        defaultval = sp_repr_children(xml)->content();
79
 
 
 
80
        }
 
81
                
80
82
    gchar * pref_name = this->pref_name();
81
83
    Inkscape::Preferences *prefs = Inkscape::Preferences::get();
82
84
    Glib::ustring paramval = prefs->getString(extension_pref_root + pref_name);
83
85
    g_free(pref_name);
84
86
 
85
 
    if (!paramval.empty())
 
87
    if (!paramval.empty()) {
86
88
        defaultval = paramval.data();
87
 
    if (defaultval != NULL)
88
 
        _value = g_strdup(defaultval);
 
89
        }
 
90
    if (defaultval != NULL) {
 
91
        char const * chname = xml->name();
 
92
        if (!strcmp(chname, INKSCAPE_EXTENSION_NS "_param")) {
 
93
            if (xml->attribute("msgctxt") != NULL) {
 
94
                _value =  g_strdup(g_dpgettext2(NULL, xml->attribute("msgctxt"), defaultval));
 
95
            } else {
 
96
                _value = g_strdup(_(defaultval));
 
97
            }
 
98
        } else {
 
99
            _value = g_strdup(defaultval);
 
100
        }
 
101
        }
89
102
    
90
103
    _max_length = 0;
91
104