void Preferences::mergeStyle(Glib::ustring const &pref_path, SPCSSAttr *style) { SPCSSAttr *current = getStyle(pref_path); sp_repr_css_merge(current, style); gchar *css_str = sp_repr_css_write_string(current); _setRawValue(pref_path, css_str); g_free(css_str); sp_repr_css_attr_unref(current); }
void StyleSwatch::setStyle(SPCSSAttr *css) { if (_css) sp_repr_css_attr_unref (_css); if (!css) return; _css = sp_repr_css_attr_new(); sp_repr_css_merge(_css, css); gchar const *css_string = sp_repr_css_write_string (_css); SPStyle *temp_spstyle = sp_style_new(SP_ACTIVE_DOCUMENT); if (css_string) sp_style_merge_from_style_string (temp_spstyle, css_string); setStyle (temp_spstyle); sp_style_unref (temp_spstyle); }