Logo Search packages:      
Sourcecode: inkscape version File versions

static gchar* cr_statement_media_rule_to_string ( CRStatement *  a_this,
gulong  a_indent 
) [static]

Serializes an statement.

Parameters:
a_this the current instance of CRStatement
a_indent the number of spaces of indentation.
Returns:
the serialized statement. Must be freed by the caller using g_free().

Definition at line 796 of file cr-statement.c.

References AT_MEDIA_RULE_STMT.

Referenced by cr_statement_dump_media_rule(), and cr_statement_to_string().

{
        gchar *str = NULL ;
        GString *stringue = NULL ;
        GList *cur = NULL;

        g_return_val_if_fail (a_this->type == AT_MEDIA_RULE_STMT,
                              NULL);

        if (a_this->kind.media_rule) {
                stringue = (GString *)g_string_new (NULL) ;                
                cr_utils_dump_n_chars2 (' ', stringue, a_indent);
                g_string_append (stringue, "@media");

                for (cur = a_this->kind.media_rule->media_list; cur;
                     cur = cur->next) {
                        if (cur->data) {
                                gchar *str = cr_string_dup2
                                        ((CRString *) cur->data);

                                if (str) {
                                        if (cur->prev) {
                                                g_string_append
                                                        (stringue, 
                                                         ",");
                                        }
                                        g_string_append_printf 
                                                (stringue, 
                                                 " %s", str);
                                        g_free (str);
                                        str = NULL;
                                }
                        }
                }
                g_string_append (stringue, " {\n");
                str = cr_statement_list_to_string
                        (a_this->kind.media_rule->rulesets,
                         a_indent + DECLARATION_INDENT_NB) ;
                if (str) {
                        g_string_append (stringue, str) ;
                        g_free (str) ;
                        str = NULL ;
                }
                g_string_append (stringue, "\n}");
        }
        if (stringue) {
                str = stringue->str ;
                g_string_free (stringue, FALSE) ;
        }
        return str ;
}


Generated by  Doxygen 1.6.0   Back to index