st-theme: Make the custom stylesheets have higher priority

https://bugzilla.gnome.org/show_bug.cgi?id=680426
This commit is contained in:
Jasper St. Pierre 2012-07-22 22:15:36 -03:00
parent 414fe75d02
commit 75e49610cb

View File

@ -176,6 +176,9 @@ parse_stylesheet (const char *filename,
return NULL; return NULL;
} }
/* Extension stylesheet */
stylesheet->app_data = GUINT_TO_POINTER (FALSE);
return stylesheet; return stylesheet;
} }
@ -230,6 +233,8 @@ st_theme_load_stylesheet (StTheme *theme,
if (!stylesheet) if (!stylesheet)
return FALSE; return FALSE;
stylesheet->app_data = GUINT_TO_POINTER (TRUE);
insert_stylesheet (theme, path, stylesheet); insert_stylesheet (theme, path, stylesheet);
cr_stylesheet_ref (stylesheet); cr_stylesheet_ref (stylesheet);
theme->custom_stylesheets = g_slist_prepend (theme->custom_stylesheets, stylesheet); theme->custom_stylesheets = g_slist_prepend (theme->custom_stylesheets, stylesheet);
@ -958,6 +963,7 @@ compare_declarations (gconstpointer a,
/* g_ptr_array_sort() is broooken */ /* g_ptr_array_sort() is broooken */
CRDeclaration *decl_a = *(CRDeclaration **) a; CRDeclaration *decl_a = *(CRDeclaration **) a;
CRDeclaration *decl_b = *(CRDeclaration **) b; CRDeclaration *decl_b = *(CRDeclaration **) b;
gboolean a_is_extension_sheet, b_is_extension_sheet;
int origin_a = get_origin (decl_a); int origin_a = get_origin (decl_a);
int origin_b = get_origin (decl_b); int origin_b = get_origin (decl_b);
@ -968,6 +974,12 @@ compare_declarations (gconstpointer a,
if (decl_a->parent_statement->specificity != decl_b->parent_statement->specificity) if (decl_a->parent_statement->specificity != decl_b->parent_statement->specificity)
return decl_a->parent_statement->specificity - decl_b->parent_statement->specificity; return decl_a->parent_statement->specificity - decl_b->parent_statement->specificity;
a_is_extension_sheet = GPOINTER_TO_UINT (decl_a->parent_statement->parent_sheet->app_data);
b_is_extension_sheet = GPOINTER_TO_UINT (decl_b->parent_statement->parent_sheet->app_data);
if (a_is_extension_sheet != b_is_extension_sheet)
return a_is_extension_sheet ? 1 : -1;
return 0; return 0;
} }