[gnome-photos] export-dialog, theme: Animate the progress message and size options



commit 5b4e0a46b1caf15f102ba0304f0088865b50ca98
Author: Debarshi Ray <debarshir gnome org>
Date:   Sat Jan 30 17:12:15 2016 +0100

    export-dialog, theme: Animate the progress message and size options

 data/Adwaita.css           |   10 ++++++++++
 src/photos-export-dialog.c |   33 +++++++++++++++++++++++----------
 2 files changed, 33 insertions(+), 10 deletions(-)
---
diff --git a/data/Adwaita.css b/data/Adwaita.css
index 11f455b..876a778 100644
--- a/data/Adwaita.css
+++ b/data/Adwaita.css
@@ -103,6 +103,16 @@ GdMainIconView.content-view.cell:active {
     background-image: url("sidebar-radio-selected-prelight.svg");
 }
 
+.photos-fade-in {
+    opacity: 1.0;
+    transition: opacity 0.2s ease-out;
+}
+
+.photos-fade-out {
+    opacity: 0.0;
+    transition: opacity 0.2s ease-out;
+}
+
 .photos-collection-icon {
     background-color: @photos_collection_bg;
     border-radius: 8px;
diff --git a/src/photos-export-dialog.c b/src/photos-export-dialog.c
index d6d70fa..b6fcfe2 100644
--- a/src/photos-export-dialog.c
+++ b/src/photos-export-dialog.c
@@ -83,32 +83,45 @@ photos_export_dialog_create_size_str (gint height, gint width, guint64 size)
 static void
 photos_export_dialog_show_size_options (PhotosExportDialog *self, gboolean progress)
 {
-  gdouble progress_opacity;
-  gdouble progress_opacity_invert;
+  GtkStyleContext *context;
+  const gchar *progress_class_name;
+  const gchar *progress_invert_class_name;
 
   gtk_widget_set_margin_bottom (self->dir_entry, 6);
   gtk_widget_set_margin_bottom (self->folder_name_label, 6);
 
-  progress_opacity = progress ? 1.0 : 0.0;
-  progress_opacity_invert = !progress ? 1.0 : 0.0;
+  progress_class_name = progress ? "photos-fade-in" : "photos-fade-out";
+  progress_invert_class_name = !progress ? "photos-fade-in" : "photos-fade-out";
 
   gtk_widget_show (self->progress_label);
-  gtk_widget_set_opacity (self->progress_label, progress_opacity);
+  context = gtk_widget_get_style_context (self->progress_label);
+  gtk_style_context_remove_class (context, progress_invert_class_name);
+  gtk_style_context_add_class (context, progress_class_name);
 
   gtk_widget_show (self->full_label);
-  gtk_widget_set_opacity (self->full_label, progress_opacity_invert);
+  context = gtk_widget_get_style_context (self->full_label);
+  gtk_style_context_remove_class (context, progress_class_name);
+  gtk_style_context_add_class (context, progress_invert_class_name);
 
   gtk_widget_show (self->full_button);
-  gtk_widget_set_opacity (self->full_button, progress_opacity_invert);
+  context = gtk_widget_get_style_context (self->full_button);
+  gtk_style_context_remove_class (context, progress_class_name);
+  gtk_style_context_add_class (context, progress_invert_class_name);
 
   gtk_widget_show (self->reduced_button);
-  gtk_widget_set_opacity (self->reduced_button, progress_opacity_invert);
+  context = gtk_widget_get_style_context (self->reduced_button);
+  gtk_style_context_remove_class (context, progress_class_name);
+  gtk_style_context_add_class (context, progress_invert_class_name);
 
   gtk_widget_show (self->reduced_label);
-  gtk_widget_set_opacity (self->reduced_label, progress_opacity_invert);
+  context = gtk_widget_get_style_context (self->reduced_label);
+  gtk_style_context_remove_class (context, progress_class_name);
+  gtk_style_context_add_class (context, progress_invert_class_name);
 
   gtk_widget_show (self->size_label);
-  gtk_widget_set_opacity (self->size_label, progress_opacity_invert);
+  context = gtk_widget_get_style_context (self->size_label);
+  gtk_style_context_remove_class (context, progress_class_name);
+  gtk_style_context_add_class (context, progress_invert_class_name);
 }
 
 


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