[nautilus] css: load css that nautilus always need



commit f3ea3f0260f62426947238a28cbef79c1242ab9b
Author: Carlos Soriano <csoriano gnome org>
Date:   Thu Jan 21 10:37:16 2016 +0100

    css: load css that nautilus always need
    
    There is some css that nautilus wants to always use regarding
    of the theme that is used.
    
    An example of this is the recently css added for making the desktop
    backgrund transparent.
    Additionally, the "round button" css is also always wanted.
    
    For that, create a new css file that will have the css we want
    to always load and load it in the application initialization.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=760790

 src/nautilus-application.c           |   10 ++++++++--
 src/nautilus-desktop-window.c        |   17 -----------------
 src/resources/css/Adwaita.css        |    6 +-----
 src/resources/css/nautilus.css       |    9 +++++++++
 src/resources/nautilus.gresource.xml |    1 +
 5 files changed, 19 insertions(+), 24 deletions(-)
---
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index f1e017c..f9ae2cf 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -1101,16 +1101,22 @@ theme_changed (GtkSettings *settings)
        static GtkCssProvider *provider = NULL;
        gchar *theme;
        GdkScreen *screen;
+       GFile *file;
 
        g_object_get (settings, "gtk-theme-name", &theme, NULL);
        screen = gdk_screen_get_default ();
 
+       /* CSS we want to always load for any theme */
+       provider = gtk_css_provider_new ();
+       file = g_file_new_for_uri ("resource:///org/gnome/nautilus/css/nautilus.css");
+       gtk_css_provider_load_from_file (provider, file, NULL);
+       g_object_unref (file);
+
+       /* CSS that themes can override */
        if (g_str_equal (theme, "Adwaita"))
        {
                if (provider == NULL)
                {
-                       GFile *file;
-
                        provider = gtk_css_provider_new ();
                        file = g_file_new_for_uri ("resource:///org/gnome/nautilus/css/Adwaita.css");
                        gtk_css_provider_load_from_file (provider, file, NULL);
diff --git a/src/nautilus-desktop-window.c b/src/nautilus-desktop-window.c
index 6714903..910d150 100644
--- a/src/nautilus-desktop-window.c
+++ b/src/nautilus-desktop-window.c
@@ -215,25 +215,8 @@ nautilus_desktop_window_constructed (GObject *obj)
 static void
 nautilus_desktop_window_init (NautilusDesktopWindow *window)
 {
-       const gchar *css;
-       GtkCssProvider *provider;
-
        window->details = G_TYPE_INSTANCE_GET_PRIVATE (window, NAUTILUS_TYPE_DESKTOP_WINDOW,
                                                       NautilusDesktopWindowDetails);
-
-       css = "nautilus-desktop-window,"
-             "nautilus-desktop-window notebook {"
-             "    background: transparent;"
-             "}";
-
-       provider = gtk_css_provider_new ();
-       gtk_css_provider_load_from_data (provider, css, -1, NULL);
-
-       gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
-                                                  GTK_STYLE_PROVIDER (provider),
-                                                  GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-
-       g_object_unref (provider);
 }
 
 static void
diff --git a/src/resources/css/Adwaita.css b/src/resources/css/Adwaita.css
index aba4a22..92e8d77 100644
--- a/src/resources/css/Adwaita.css
+++ b/src/resources/css/Adwaita.css
@@ -35,11 +35,6 @@
     color: @theme_unfocused_selected_fg_color;
 }
 
-.nautilus-circular-button {
-  border-radius: 20px;
-  -gtk-outline-radius: 20px;
-}
-
 /* Toolbar */
 
 /* Here we use the .button background-image colors from Adwaita, but ligthen them,
@@ -51,6 +46,7 @@
     90% {background-image: linear-gradient(to bottom, @theme_base_color); border-color: @theme_fg_color; }
     100% {background-image: linear-gradient(to bottom, #fafafa, #ededed 40%,  #e0e0e0); border-color: 
@borders; }
 }
+
 .nautilus-operations-button-needs-attention {
   animation: needs_attention_keyframes 2s ease-in-out;
 }
diff --git a/src/resources/css/nautilus.css b/src/resources/css/nautilus.css
new file mode 100644
index 0000000..c8a8fd0
--- /dev/null
+++ b/src/resources/css/nautilus.css
@@ -0,0 +1,9 @@
+.nautilus-circular-button {
+  border-radius: 20px;
+  -gtk-outline-radius: 20px;
+}
+
+nautilus-desktop-window,
+nautilus-desktop-window notebook {
+    background-color: transparent;
+}
diff --git a/src/resources/nautilus.gresource.xml b/src/resources/nautilus.gresource.xml
index 460e40d..1e668f8 100644
--- a/src/resources/nautilus.gresource.xml
+++ b/src/resources/nautilus.gresource.xml
@@ -23,5 +23,6 @@
     <file alias="icons/filmholes.png">../../icons/filmholes.png</file>
     <file alias="icons/knob.png">../../icons/knob.png</file>
     <file>css/Adwaita.css</file>
+    <file>css/nautilus.css</file>
   </gresource>
 </gresources>


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