Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

CRStatement* cr_statement_new_ruleset ( CRStyleSheet a_sheet,
CRSelector *  a_sel_list,
CRDeclaration a_decl_list,
CRStatement *  a_parent_media_rule 

Creates a new instance of CRStatement of type CRRulSet.

a_sel_list the list of CRSimpleSel (selectors) the rule applies to.
a_decl_list the list of instances of CRDeclaration that composes the ruleset.
a_media_types a list of instances of GString that describe the media list this ruleset applies to.
the new instance of CRStatement or NULL if something went wrong.

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

References AT_MEDIA_RULE_STMT, cr_statement_append(), cr_statement_set_parent_sheet(), and cr_utils_trace_info.

        CRStatement *result = NULL;

        g_return_val_if_fail (a_sel_list, NULL);

        if (a_parent_media_rule) {
                        (a_parent_media_rule->type == AT_MEDIA_RULE_STMT,
                g_return_val_if_fail (a_parent_media_rule->kind.media_rule,

        result = g_try_malloc (sizeof (CRStatement));

        if (!result) {
                cr_utils_trace_info ("Out of memory");
                return NULL;

        memset (result, 0, sizeof (CRStatement));
        result->type = RULESET_STMT;
        result->kind.ruleset = g_try_malloc (sizeof (CRRuleSet));

        if (!result->kind.ruleset) {
                cr_utils_trace_info ("Out of memory");
                if (result)
                        g_free (result);
                return NULL;

        memset (result->kind.ruleset, 0, sizeof (CRRuleSet));
        result->kind.ruleset->sel_list = a_sel_list;
        if (a_sel_list)
                cr_selector_ref (a_sel_list);
        result->kind.ruleset->decl_list = a_decl_list;

        if (a_parent_media_rule) {
                result->kind.ruleset->parent_media_rule = a_parent_media_rule;
                a_parent_media_rule->kind.media_rule->rulesets =

        cr_statement_set_parent_sheet (result, a_sheet);

        return result;

Generated by  Doxygen 1.6.0   Back to index