[gnome-boxes/wip/exalm/swipe: 4/7] welcome-tutorial-page: Make color a Gdk.RGBA instead of string



commit 205c955848fe085a0e0bc97c39f04a494caa6ef4
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Wed Feb 19 19:02:30 2020 +0500

    welcome-tutorial-page: Make color a Gdk.RGBA instead of string
    
    This will be required to interpolate the colors in the following commits.

 data/ui/welcome-tutorial.ui    |  8 ++++----
 src/welcome-tutorial-page.vala | 10 ++++------
 2 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/data/ui/welcome-tutorial.ui b/data/ui/welcome-tutorial.ui
index cd0b03d2..44fa7c0d 100644
--- a/data/ui/welcome-tutorial.ui
+++ b/data/ui/welcome-tutorial.ui
@@ -30,7 +30,7 @@
                   <object class="BoxesWelcomeTutorialPage">
                     <property name="title" translatable="yes">Welcome to Boxes</property>
                     <property name="description" translatable="yes">Boxes makes it easy to install and run 
virtual machines. You can also use it to remotely access other computers, using SPICE, VNC, RDP or Secure 
Shell connections.</property>
-                    <property name="color">613583</property>
+                    <property name="color">#613583</property>
                     <property name="image">/org/gnome/Boxes/welcome-tutorial/welcome.svg</property>
                   </object>
                 </child>
@@ -39,7 +39,7 @@
                   <object class="BoxesWelcomeTutorialPage">
                     <property name="title" translatable="yes">Express Installation</property>
                     <property name="description" translatable="yes">With express installation, Boxes will 
set the install options for a new virtual machine. Just start the installation and everything will be taken 
care of for you.</property>
-                    <property name="color">26a269</property>
+                    <property name="color">#26a269</property>
                     <property name="image">/org/gnome/Boxes/welcome-tutorial/express-install.svg</property>
                   </object>
                 </child>
@@ -48,7 +48,7 @@
                   <object class="BoxesWelcomeTutorialPage">
                     <property name="title" translatable="yes">Easy Downloads</property>
                     <property name="description" translatable="yes">With Boxes, you don't need to download 
an operating system to create a virtual machine. Instead, just pick the operating system you want to setup, 
and Boxes will automatically download it for you.</property>
-                    <property name="color">e66100</property>
+                    <property name="color">#e66100</property>
                     <property name="image">/org/gnome/Boxes/welcome-tutorial/easy-downloads.svg</property>
                   </object>
                 </child>
@@ -57,7 +57,7 @@
                   <object class="BoxesWelcomeTutorialPage">
                     <property name="title" translatable="yes">Drag and Drop</property>
                     <property name="description" translatable="yes">Sharing files is as simple as dropping 
them onto your virtual machine. They will appear in your Downloads folder.</property>
-                    <property name="color">1c71d8</property>
+                    <property name="color">#1c71d8</property>
                     <property name="image">/org/gnome/Boxes/welcome-tutorial/drag-and-drop.svg</property>
                   </object>
                 </child>
diff --git a/src/welcome-tutorial-page.vala b/src/welcome-tutorial-page.vala
index c3065c93..cbce473e 100644
--- a/src/welcome-tutorial-page.vala
+++ b/src/welcome-tutorial-page.vala
@@ -25,7 +25,7 @@
         }
     }
 
-    public string color { set; get; }
+    public Gdk.RGBA color { set; get; }
     public string image { set; get; }
 
     [GtkCallback]
@@ -33,14 +33,12 @@ private void load_css () {
         var provider = new CssProvider ();
         var css = """
           .tutorial-page {
-            background-color: #%s;
+            background-color: %s;
             background-image: url("resource://%s");
           }
-        """.printf (color, image);
+        """.printf (color.to_string (), image);
 
         provider.load_from_data (css);
-        Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (),
-                                                  provider,
-                                                  STYLE_PROVIDER_PRIORITY_APPLICATION);
+        get_style_context ().add_provider (provider, STYLE_PROVIDER_PRIORITY_APPLICATION);
     }
 }


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