st: Use StSettings for enable-animations check

Keep a statically allocated one so all widgets will use a single
object.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/317
This commit is contained in:
Carlos Garnacho 2019-01-30 19:48:28 +01:00
parent 036e67049b
commit df3068d9ca

View File

@ -37,6 +37,7 @@
#include "st-label.h" #include "st-label.h"
#include "st-private.h" #include "st-private.h"
#include "st-settings.h"
#include "st-texture-cache.h" #include "st-texture-cache.h"
#include "st-theme-context.h" #include "st-theme-context.h"
#include "st-theme-node-transition.h" #include "st-theme-node-transition.h"
@ -44,7 +45,6 @@
#include "st-widget-accessible.h" #include "st-widget-accessible.h"
#include <gtk/gtk.h>
#include <atk/atk-enum-types.h> #include <atk/atk-enum-types.h>
/* This is set in stone and also hard-coded in GDK. */ /* This is set in stone and also hard-coded in GDK. */
@ -814,7 +814,6 @@ st_widget_real_get_focus_chain (StWidget *widget)
return g_list_reverse (visible); return g_list_reverse (visible);
} }
static void static void
st_widget_class_init (StWidgetClass *klass) st_widget_class_init (StWidgetClass *klass)
{ {
@ -1567,6 +1566,7 @@ st_widget_recompute_style (StWidget *widget,
StWidgetPrivate *priv = st_widget_get_instance_private (widget); StWidgetPrivate *priv = st_widget_get_instance_private (widget);
StThemeNode *new_theme_node = st_widget_get_theme_node (widget); StThemeNode *new_theme_node = st_widget_get_theme_node (widget);
int transition_duration; int transition_duration;
StSettings *settings;
gboolean paint_equal; gboolean paint_equal;
gboolean animations_enabled; gboolean animations_enabled;
@ -1586,9 +1586,8 @@ st_widget_recompute_style (StWidget *widget,
paint_equal = st_theme_node_paint_equal (old_theme_node, new_theme_node); paint_equal = st_theme_node_paint_equal (old_theme_node, new_theme_node);
g_object_get (gtk_settings_get_default (), settings = st_settings_get ();
"gtk-enable-animations", &animations_enabled, g_object_get (settings, "enable-animations", &animations_enabled, NULL);
NULL);
if (animations_enabled && transition_duration > 0) if (animations_enabled && transition_duration > 0)
{ {