[tepl] utils: add TEPL_UTILS_STYLE_PROVIDER_PRIORITY_LIBRARY



commit 128dfd1afa25ba59dacea2d8b3c57d9e68d3d8ed
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Tue Nov 24 02:45:29 2020 +0100

    utils: add TEPL_UTILS_STYLE_PROVIDER_PRIORITY_LIBRARY
    
    To avoid code duplication.

 docs/reference/tepl-sections.txt |  1 +
 tepl/tepl-goto-line-bar.c        |  3 +--
 tepl/tepl-utils.c                |  3 +--
 tepl/tepl-utils.h                | 17 +++++++++++++++++
 4 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/docs/reference/tepl-sections.txt b/docs/reference/tepl-sections.txt
index cc0b1c2..914247f 100644
--- a/docs/reference/tepl-sections.txt
+++ b/docs/reference/tepl-sections.txt
@@ -559,6 +559,7 @@ tepl_notebook_get_type
 
 <SECTION>
 <FILE>utils</FILE>
+TEPL_UTILS_STYLE_PROVIDER_PRIORITY_LIBRARY
 tepl_utils_str_middle_truncate
 tepl_utils_str_end_truncate
 tepl_utils_str_replace
diff --git a/tepl/tepl-goto-line-bar.c b/tepl/tepl-goto-line-bar.c
index e1d8416..e526a1a 100644
--- a/tepl/tepl-goto-line-bar.c
+++ b/tepl/tepl-goto-line-bar.c
@@ -215,8 +215,7 @@ apply_style (TeplGotoLineBar *bar)
        gtk_css_provider_load_from_data (css_provider, css, -1, NULL);
        gtk_style_context_add_provider (style_context,
                                        GTK_STYLE_PROVIDER (css_provider),
-                                       /* Priority "library". */
-                                       GTK_STYLE_PROVIDER_PRIORITY_APPLICATION - 1);
+                                       TEPL_UTILS_STYLE_PROVIDER_PRIORITY_LIBRARY);
        g_object_unref (css_provider);
 }
 
diff --git a/tepl/tepl-utils.c b/tepl/tepl-utils.c
index ca01eae..480e888 100644
--- a/tepl/tepl-utils.c
+++ b/tepl/tepl-utils.c
@@ -1079,8 +1079,7 @@ tepl_utils_override_font (GtkWidget   *widget,
        gtk_css_provider_load_from_data (css_provider, css_rule_set, -1, NULL);
        gtk_style_context_add_provider (style_context,
                                        GTK_STYLE_PROVIDER (css_provider),
-                                       /* Priority "library". */
-                                       GTK_STYLE_PROVIDER_PRIORITY_APPLICATION - 1);
+                                       TEPL_UTILS_STYLE_PROVIDER_PRIORITY_LIBRARY);
 
        pango_font_description_free (font_description);
        g_free (css_declarations);
diff --git a/tepl/tepl-utils.h b/tepl/tepl-utils.h
index f7ea05d..6436d5a 100644
--- a/tepl/tepl-utils.h
+++ b/tepl/tepl-utils.h
@@ -14,6 +14,23 @@
 
 G_BEGIN_DECLS
 
+/* Macros */
+
+/**
+ * TEPL_UTILS_STYLE_PROVIDER_PRIORITY_LIBRARY:
+ *
+ * A priority that can be used when adding a #GtkStyleProvider for
+ * library-specific style information.
+ *
+ * Has a higher priority than %GTK_STYLE_PROVIDER_PRIORITY_SETTINGS and a lower
+ * priority than %GTK_STYLE_PROVIDER_PRIORITY_APPLICATION.
+ *
+ * The Tepl library uses this priority for its #GtkStyleProvider's.
+ *
+ * Since: 6.0
+ */
+#define TEPL_UTILS_STYLE_PROVIDER_PRIORITY_LIBRARY (GTK_STYLE_PROVIDER_PRIORITY_APPLICATION - 1)
+
 /* String utilities */
 
 _TEPL_EXTERN


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]