summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2014-07-10 08:57:27 -0400
committerMatthias Clasen <mclasen@redhat.com>2014-07-11 23:22:15 -0400
commit3fd7e847d531fbbfc4ebba24864bdd0f8b81c750 (patch)
treeda49e65b60e9876e8a23720bf3575c997ff768d1
parentbec805a7596f6de500adfc0a751496b5661abf1f (diff)
downloadnautilus-3fd7e847d531fbbfc4ebba24864bdd0f8b81c750.tar.gz
Add application-specific theme extensions
This used to live in gnome-themes-standard, but with the move of Adwaita to GTK+, it needs to find a new home. https://bugzilla.gnome.org/show_bug.cgi?id=732995
-rw-r--r--src/Adwaita.css95
-rw-r--r--src/nautilus-application.c52
-rw-r--r--src/nautilus.gresource.xml1
3 files changed, 148 insertions, 0 deletions
diff --git a/src/Adwaita.css b/src/Adwaita.css
new file mode 100644
index 000000000..60003ff9d
--- /dev/null
+++ b/src/Adwaita.css
@@ -0,0 +1,95 @@
+.nautilus-canvas-item {
+ border-radius: 5px;
+}
+
+.nautilus-desktop.nautilus-canvas-item {
+ color: @theme_selected_fg_color;
+ text-shadow: 1px 1px black;
+}
+
+.nautilus-desktop.nautilus-canvas-item:active {
+ color: @theme_text_color;
+}
+
+.nautilus-desktop.nautilus-canvas-item:selected {
+ color: @theme_selected_fg_color;
+}
+
+.nautilus-desktop.nautilus-canvas-item:active,
+.nautilus-desktop.nautilus-canvas-item:prelight,
+.nautilus-desktop.nautilus-canvas-item:selected {
+ text-shadow: none;
+}
+
+.nautilus-desktop.nautilus-canvas-item:selected:backdrop {
+ color: @theme_unfocused_selected_fg_color;
+}
+
+NautilusWindow .sidebar .frame {
+ border-style: none;
+}
+
+NautilusWindow > GtkGrid > .pane-separator,
+NautilusWindow > GtkGrid > .pane-separator:hover {
+ border-width: 0 1px 0 0;
+ border-style: solid;
+ border-color: @borders;
+ background-color: @sidebar_bg;
+ color: shade (@theme_bg_color, 0.9);
+}
+
+NautilusWindow > GtkGrid > .pane-separator:backdrop,
+NautilusWindow > GtkGrid > .pane-separator:hover:backdrop {
+ border-color: @unfocused_borders;
+ background-color: @sidebar_bg_unfocused;
+}
+
+NautilusNotebook.notebook {
+ border-right-width: 0;
+ border-left-width: 0;
+ border-bottom-width: 0;
+}
+
+NautilusNotebook .frame {
+ border-width: 0;
+}
+
+NautilusToolbar .button {
+ icon-shadow: 0 1px @button_text_shadow;
+}
+
+NautilusToolbar .button:active {
+ icon-shadow: 0 1px @button_active_text_shadow;
+}
+
+NautilusToolbar .button:insensitive,
+NautilusToolbar .button:active *:insensitive {
+ icon-shadow: none;
+}
+
+NautilusQueryEditor .search-bar.toolbar {
+ border-top-width: 0;
+ border-bottom-width: 0;
+}
+
+NautilusQueryEditor .toolbar {
+ padding-top: 3px;
+ padding-bottom: 2px;
+
+ border-width: 1px 0 0 0;
+ border-style: solid;
+}
+
+NautilusQueryEditor .toolbar:nth-child(2) {
+ border-color: @borders;
+}
+
+NautilusQueryEditor .toolbar:last-child,
+NautilusQueryEditor .search-bar.toolbar:only-child {
+ border-bottom-width: 1px;
+ border-bottom-color: @borders;
+}
+
+NautilusQueryEditor .toolbar:backdrop:nth-child(2) {
+ border-color: @unfocused_borders;
+}
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 7137d5ed9..88ed0f5dd 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -1154,6 +1154,56 @@ init_gtk_accels (void)
}
static void
+theme_changed (GtkSettings *settings)
+{
+ static GtkCssProvider *provider = NULL;
+ gchar *theme;
+ GdkScreen *screen;
+
+ g_object_get (settings, "gtk-theme-name", &theme, NULL);
+ screen = gdk_screen_get_default ();
+
+ 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/Adwaita.css");
+ gtk_css_provider_load_from_file (provider, file, NULL);
+ g_object_unref (file);
+ }
+
+ gtk_style_context_add_provider_for_screen (screen,
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ }
+ else if (provider != NULL)
+ {
+ gtk_style_context_remove_provider_for_screen (screen,
+ GTK_STYLE_PROVIDER (provider));
+ g_clear_object (&provider);
+ }
+
+ g_free (theme);
+}
+
+static void
+setup_theme_extensions (void)
+{
+ GtkSettings *settings;
+
+ /* Set up a handler to load our custom css for Adwaita.
+ * See https://bugzilla.gnome.org/show_bug.cgi?id=732959
+ * for a more automatic solution that is still under discussion.
+ */
+ settings = gtk_settings_get_default ();
+ g_signal_connect (settings, "notify::gtk-theme-name", G_CALLBACK (theme_changed), NULL);
+ theme_changed (settings);
+}
+
+static void
nautilus_application_startup (GApplication *app)
{
NautilusApplication *self = NAUTILUS_APPLICATION (app);
@@ -1167,6 +1217,8 @@ nautilus_application_startup (GApplication *app)
gtk_window_set_default_icon_name ("system-file-manager");
+ setup_theme_extensions ();
+
/* create DBus manager */
self->priv->fdb_manager = nautilus_freedesktop_dbus_new ();
diff --git a/src/nautilus.gresource.xml b/src/nautilus.gresource.xml
index 15287d506..37a5bbf7f 100644
--- a/src/nautilus.gresource.xml
+++ b/src/nautilus.gresource.xml
@@ -12,5 +12,6 @@
<file alias="icons/thumbnail_frame.png">../icons/thumbnail_frame.png</file>
<file alias="icons/filmholes.png">../icons/filmholes.png</file>
<file alias="icons/knob.png">../icons/knob.png</file>
+ <file>Adwaita.css</file>
</gresource>
</gresources>