From 75e49610cbed17ae312ddd896f07503842390d27 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sun, 22 Jul 2012 22:15:36 -0300 Subject: [PATCH] st-theme: Make the custom stylesheets have higher priority https://bugzilla.gnome.org/show_bug.cgi?id=680426 --- src/st/st-theme.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/st/st-theme.c b/src/st/st-theme.c index adb29db99..42d75cb9b 100644 --- a/src/st/st-theme.c +++ b/src/st/st-theme.c @@ -176,6 +176,9 @@ parse_stylesheet (const char *filename, return NULL; } + /* Extension stylesheet */ + stylesheet->app_data = GUINT_TO_POINTER (FALSE); + return stylesheet; } @@ -230,6 +233,8 @@ st_theme_load_stylesheet (StTheme *theme, if (!stylesheet) return FALSE; + stylesheet->app_data = GUINT_TO_POINTER (TRUE); + insert_stylesheet (theme, path, stylesheet); cr_stylesheet_ref (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 */ CRDeclaration *decl_a = *(CRDeclaration **) a; CRDeclaration *decl_b = *(CRDeclaration **) b; + gboolean a_is_extension_sheet, b_is_extension_sheet; int origin_a = get_origin (decl_a); 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) 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; }