summaryrefslogtreecommitdiff
path: root/panels/user-accounts/cc-carousel.c
diff options
context:
space:
mode:
Diffstat (limited to 'panels/user-accounts/cc-carousel.c')
-rw-r--r--panels/user-accounts/cc-carousel.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/panels/user-accounts/cc-carousel.c b/panels/user-accounts/cc-carousel.c
index 70009c240..e1878bb70 100644
--- a/panels/user-accounts/cc-carousel.c
+++ b/panels/user-accounts/cc-carousel.c
@@ -111,6 +111,8 @@ cc_carousel_move_arrow (CcCarousel *self)
GtkStyleContext *context;
gchar *css;
gint end_x;
+ GtkSettings *settings;
+ gboolean animations;
if (!self->selected_item)
return;
@@ -122,13 +124,26 @@ cc_carousel_move_arrow (CcCarousel *self)
gtk_style_context_remove_provider (context, self->provider);
g_clear_object (&self->provider);
- css = g_strdup_printf ("@keyframes arrow_keyframes-%d {\n"
- " from { margin-left: %dpx; }\n"
- " to { margin-left: %dpx; }\n"
- "}\n"
- "* {\n"
- " animation-name: arrow_keyframes-%d;\n"
- "}\n", end_x, self->arrow_start_x, end_x, end_x);
+ settings = gtk_widget_get_settings (GTK_WIDGET (self));
+ g_object_get (settings, "gtk-enable-animations", &animations, NULL);
+
+ /* Animate the arrow movement if animations are enabled. Otherwise,
+ * jump the arrow to the right location instantly. */
+ if (animations)
+ {
+ css = g_strdup_printf ("@keyframes arrow_keyframes-%d {\n"
+ " from { margin-left: %dpx; }\n"
+ " to { margin-left: %dpx; }\n"
+ "}\n"
+ "* {\n"
+ " animation-name: arrow_keyframes-%d;\n"
+ "}\n",
+ end_x, self->arrow_start_x, end_x, end_x);
+ }
+ else
+ {
+ css = g_strdup_printf ("* { margin-left: %dpx }", end_x);
+ }
self->provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (self->provider), css, -1, NULL);