Commit 3fd7e847 authored by Matthias Clasen's avatar Matthias Clasen

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
parent bec805a7
.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;
}
......@@ -1153,6 +1153,56 @@ init_gtk_accels (void)
g_free (old_scripts_directory_path);
}
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)
{
......@@ -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 ();
......
......@@ -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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment