[nautilus] theming: add a CSS file for nautilus, and initialize it at startup



commit dad5d12770817aa739ab9980faa66972144008a7
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Dec 15 19:35:38 2010 +0100

    theming: add a CSS file for nautilus, and initialize it at startup

 data/Makefile.am           |    2 ++
 data/nautilus.css          |   19 +++++++++++++++++++
 src/nautilus-application.c |   25 +++++++++++++++++++++++++
 3 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index c5d57f1..66dc339 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -23,11 +23,13 @@ nautilusdatadir = $(datadir)/nautilus
 nautilusdata_DATA = \
 	nautilus-extras.placeholder 	\
 	nautilus-suggested.placeholder 	\
+	nautilus.css			\
 	$(NULL)
 
 EXTRA_DIST = $(nautilusdata_DATA) 	\
 	nautilus.desktop		\
 	nautilus.desktop.in		\
+	nautilus.css			\
 	$(xml_in_files) 		\
 	$(desktop_in_files)		\
 	$(NULL)
diff --git a/data/nautilus.css b/data/nautilus.css
new file mode 100644
index 0000000..48f67f1
--- /dev/null
+++ b/data/nautilus.css
@@ -0,0 +1,19 @@
+
+GtkTreeView.NautilusSidebar {
+    background-color: #f6f6f4;
+}
+
+#statusbar-no-border {
+    -GtkStatusbar-shadow-type: none;
+}
+
+#nautilus-extra-view-widget {
+    background-color: #a7c6e1;
+}
+
+#nautilus-tab-close-button {
+    -GtkWidget-focus-padding : 0;
+    -GtkWidget-focus-line-width: 0;
+    xthickness: 0;
+    ythickness: 0;
+}
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index dbafa3c..fd9e107 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -1500,6 +1500,28 @@ nautilus_application_command_line (GApplication *app,
 }
 
 static void
+init_css (void)
+{
+	GtkCssProvider *provider;
+	GError *error = NULL;
+
+	provider = gtk_css_provider_new ();
+	gtk_css_provider_load_from_path (provider,
+					 NAUTILUS_DATADIR G_DIR_SEPARATOR_S "nautilus.css", &error);
+
+	if (error != NULL) {
+		g_warning ("Can't parse NautilusPlacesSidebar's CSS custom description: %s\n", error->message);
+		g_error_free (error);
+	} else {
+		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
 nautilus_application_startup (GApplication *app)
 {
 	NautilusApplication *self = NAUTILUS_APPLICATION (app);
@@ -1534,6 +1556,9 @@ nautilus_application_startup (GApplication *app)
 	/* register property pages */
 	nautilus_image_properties_page_register ();
 
+	/* initialize CSS theming */
+	init_css ();
+
 	/* initialize search path for custom icons */
 	gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
 					   NAUTILUS_DATADIR G_DIR_SEPARATOR_S "icons");



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