[gnome-shell/gnome-3-36] st/theme-context: Add a getter for the scale-factor property



commit 0368ad29e9420fecdb9eb250f5586d0386db6cdc
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Apr 6 11:15:38 2020 -0300

    st/theme-context: Add a getter for the scale-factor property
    
    Will be used by the next commit to avoid going through the GObject
    machinery when retrieving the scale factor.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1176

 src/st/st-theme-context.c | 16 ++++++++++++++++
 src/st/st-theme-context.h |  2 ++
 2 files changed, 18 insertions(+)
---
diff --git a/src/st/st-theme-context.c b/src/st/st-theme-context.c
index bc0f89a4e2..55e856f265 100644
--- a/src/st/st-theme-context.c
+++ b/src/st/st-theme-context.c
@@ -469,3 +469,19 @@ st_theme_context_intern_node (StThemeContext *context,
   g_hash_table_add (context->nodes, g_object_ref (node));
   return node;
 }
+
+/**
+ * st_theme_context_get_scale_factor:
+ * @context: a #StThemeContext
+ *
+ * Return the current scale factor of @context.
+ *
+ * Return value: a scale factor
+ */
+int
+st_theme_context_get_scale_factor (StThemeContext *context)
+{
+  g_return_val_if_fail (ST_IS_THEME_CONTEXT (context), -1);
+
+  return context->scale_factor;
+}
diff --git a/src/st/st-theme-context.h b/src/st/st-theme-context.h
index efb3531e26..165ce25f19 100644
--- a/src/st/st-theme-context.h
+++ b/src/st/st-theme-context.h
@@ -58,6 +58,8 @@ StThemeNode *               st_theme_context_get_root_node  (StThemeContext
 StThemeNode *               st_theme_context_intern_node    (StThemeContext             *context,
                                                              StThemeNode                *node);
 
+int st_theme_context_get_scale_factor (StThemeContext *context);
+
 G_END_DECLS
 
 #endif /* __ST_THEME_CONTEXT_H__ */


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