Logo Search packages:      
Sourcecode: inkscape version File versions

const gchar* sp_xml_ns_uri_prefix ( gchar const *  uri,
gchar const *  suggested 
)

Though SPRepr provides "signals" for notification when individual nodes change, there is no mechanism to receive notification for overall document changes.

However, with the addition of the transactions code, it would not be very hard to implement if you wanted it.

SPRepr itself doesn't use GObject signals at present -- SPReprs maintain lists of SPReprEventVectors (added via sp_repr_add_listener), which are used to specify callbacks when something changes.

Here are the current callbacks in an event vector (they may be NULL):

void (* child_added) (SPRepr *repr, SPRepr *child, SPRepr *ref, void *data);

Called once a child has been added.

void (* child_removed) (SPRepr *repr, SPRepr *child, SPRepr ref, void *data);

Called after a child is removed; ref is the child that used to precede the removed child.

void (* attr_changed) (SPRepr *repr, gchar const *key, gchar const *oldval, gchar const *newval, void *data);

Called after an attribute has been changed.

void (* content_changed) (SPRepr *repr, gchar const *oldcontent, gchar const *newcontent, void *data);

Called after an element's content has been changed.

void (* order_changed) (SPRepr *repr, SPRepr *child, SPRepr oldref, SPRepr *newref, void *data);

Called once the child has been moved to its new position in the child order.

Definition at line 214 of file repr-util.cpp.

{
    SPXMLNs *iter;
    const char *prefix;

    if (!uri) return NULL;

    if (!namespaces) {
        sp_xml_ns_register_defaults ();
    }

    GQuark const key = g_quark_from_string (uri);
    prefix = NULL;
    for ( iter = namespaces ; iter ; iter = iter->next ) {
        if ( iter->uri == key ) {
            prefix = g_quark_to_string (iter->prefix);
            break;
        }
    }
    if (!prefix) {
        const char *new_prefix;
        SPXMLNs *ns;
        if (suggested) {
            new_prefix = suggested;
        } else {
            new_prefix = sp_xml_ns_auto_prefix (uri);
        }
        ns = g_new (SPXMLNs, 1);
        if (ns) {
            ns->uri = g_quark_from_string (uri);
            ns->prefix = g_quark_from_string (new_prefix);
            ns->next = namespaces;
            namespaces = ns;
            prefix = g_quark_to_string (ns->prefix);
        }
        if (!suggested) {
            g_free ((char *)new_prefix);
        }
    }
    return prefix;
}


Generated by  Doxygen 1.6.0   Back to index