[recipes] Make the dialog fully translatable



commit 37fa24d5db38d1742d3e1d959427f681c47fc7e6
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jul 14 20:21:32 2017 -0400

    Make the dialog fully translatable
    
    Move the YEARS STRONG text from the image to a label,
    and fiddle around a bit to make it look as before.

 src/gr-window.c        |    6 ++++++
 src/recipe-surprise.ui |   16 +++++++++++++++-
 src/recipes.css        |    5 +++++
 3 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/src/gr-window.c b/src/gr-window.c
index 355743d..ca54f18 100644
--- a/src/gr-window.c
+++ b/src/gr-window.c
@@ -1567,6 +1567,9 @@ should_show_surprise (void)
         g_autoptr(GDateTime) start = NULL;
         g_autoptr(GDateTime) end = NULL;
 
+        if (g_getenv ("SHOW_SURPRISE"))
+                return TRUE;
+
         if (!g_settings_get_boolean (gr_settings_get (), "show-surprise-dialog"))
                 return FALSE;
 
@@ -1616,15 +1619,18 @@ gr_window_show_surprise (GrWindow *window)
         g_autoptr(GtkBuilder) builder = NULL;
         GtkWindow *dialog;
         GtkWidget *button;
+        GtkWidget *label;
 
         if (!should_show_surprise ())
                 return;
 
         builder = gtk_builder_new_from_resource ("/org/gnome/Recipes/recipe-surprise.ui");
         dialog = GTK_WINDOW (gtk_builder_get_object (builder, "dialog"));
+        label = GTK_WIDGET (gtk_builder_get_object (builder, "label"));
         button = GTK_WIDGET (gtk_builder_get_object (builder, "close_button"));
         g_signal_connect_swapped (button, "clicked", G_CALLBACK (surprise_dialog_closed), dialog);
         gtk_window_set_transient_for (dialog, GTK_WINDOW (window));
         gr_window_present_dialog (window, dialog);
+        pango_layout_set_spacing (gtk_label_get_layout (GTK_LABEL (label)), - pango_units_from_double 
(10.0));
         play_tada_sound (dialog);
 }
diff --git a/src/recipe-surprise.ui b/src/recipe-surprise.ui
index 64c2b4c..99b9e9f 100644
--- a/src/recipe-surprise.ui
+++ b/src/recipe-surprise.ui
@@ -36,7 +36,21 @@
         <child>
           <object class="GtkImage">
             <property name="visible">1</property>
-            <property name="resource">/org/gnome/Recipes/surprise.jpg</property>
+            <property name="resource">/org/gnome/Recipes/surprise2.jpg</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label">
+            <property name="visible">1</property>
+            <property name="xalign">0</property>
+            <property name="yalign">0</property>
+            <property name="label" translatable="yes">YEARS
+STRONG</property>
+            <property name="margin-start">75</property>
+            <property name="margin-bottom">10</property>
+            <style>
+              <class name="surprise"/>
+            </style>
           </object>
         </child>
         <child>
diff --git a/src/recipes.css b/src/recipes.css
index fd179c3..8be9b6e 100644
--- a/src/recipes.css
+++ b/src/recipes.css
@@ -492,3 +492,8 @@ row.drag-hover-top {
 row.drag-hover-bottom {
   border-bottom: 1px solid #4e9a06;
 }
+
+label.surprise {
+  color: #008bc5;
+  font: 40px Source Sans Pro Light;
+}


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