Logo Search packages:      
Sourcecode: inkscape version File versions

CRStatement* cr_statement_new_at_media_rule ( CRStyleSheet a_sheet,
CRStatement *  a_rulesets,
GList *  a_media 

Instanciates an instance of CRStatement of type AT_MEDIA_RULE_STMT ( ruleset).

a_ruleset the ruleset statements contained in the rule.
a_media,the media string list. A list of GString pointers.

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

References AT_MEDIA_RULE_STMT, cr_statement_set_parent_sheet(), and cr_utils_trace_info.

        CRStatement *cur = NULL;

        if (a_rulesets)
                g_return_val_if_fail (a_rulesets->type == RULESET_STMT, NULL);

        CRStatement *result = (CRStatement *)g_try_malloc (sizeof (CRStatement));

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

        memset (result, 0, sizeof (CRStatement));
        result->type = AT_MEDIA_RULE_STMT;

        result->kind.media_rule = (CRAtMediaRule *)g_try_malloc (sizeof (CRAtMediaRule));
        if (!result->kind.media_rule) {
                cr_utils_trace_info ("Out of memory");
                g_free (result);
                return NULL;
        memset (result->kind.media_rule, 0, sizeof (CRAtMediaRule));
        result->kind.media_rule->rulesets = a_rulesets;
        for (cur = a_rulesets; cur; cur = cur->next) {
                if (cur->type != RULESET_STMT || !cur->kind.ruleset) {
                        cr_utils_trace_info ("Bad parameter a_rulesets. "
                                             "It should be a list of "
                                             "correct ruleset statement only !");
                        goto error;
                cur->kind.ruleset->parent_media_rule = result;

        result->kind.media_rule->media_list = a_media;
        if (a_sheet) {
                cr_statement_set_parent_sheet (result, a_sheet);

        return result;

        return NULL;

Generated by  Doxygen 1.6.0   Back to index