diff options
author | raveit65 <chat-to-me@raveit.de> | 2016-04-15 10:25:20 +0200 |
---|---|---|
committer | raveit65 <chat-to-me@raveit.de> | 2016-04-20 16:04:43 +0200 |
commit | e8be955849664584f1fb697fd904ae9f85945a5e (patch) | |
tree | 879ce9db288821951472b5ae0d217e6104c3ef60 | |
parent | e8ec81e2da654f5f07d94dc3f767d42f90fd12b4 (diff) | |
download | caja-e8be955849664584f1fb697fd904ae9f85945a5e.tar.bz2 caja-e8be955849664584f1fb697fd904ae9f85945a5e.tar.xz |
GTK+-3 theming: add a CSS file for caja, and initialize it at startup
inspired by:
https://git.gnome.org/browse/nautilus/commit/?id=dad5d12
-rw-r--r-- | data/Makefile.am | 2 | ||||
-rw-r--r-- | data/caja.css | 23 | ||||
-rw-r--r-- | src/caja-application.c | 29 |
3 files changed, 54 insertions, 0 deletions
diff --git a/data/Makefile.am b/data/Makefile.am index 2d79e780..0342a34c 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -33,6 +33,7 @@ cajadata_DATA = \ browser.xml \ caja-extras.placeholder \ caja-suggested.placeholder \ + caja.css \ $(NULL) # app data file @@ -43,6 +44,7 @@ appdata_DATA = $(appdata_in_files:.xml.in=.xml) EXTRA_DIST = $(cajadata_DATA) \ caja.desktop \ caja.desktop.in \ + caja.css \ freedesktop-dbus-interfaces.xml \ $(xml_in_files) \ $(desktop_in_files) \ diff --git a/data/caja.css b/data/caja.css new file mode 100644 index 00000000..360a4f52 --- /dev/null +++ b/data/caja.css @@ -0,0 +1,23 @@ + + +.caja-canvas-item { + border-radius: 3px; +} + +/* desktop mode */ +.caja-desktop.caja-canvas-item { + color: #ffffff; + text-shadow: 1px 1px alpha (#000000, 0.8); +} + +.caja-desktop.caja-canvas-item:selected, +.caja-desktop.caja-canvas-item:active, +.caja-desktop.caja-canvas-item:hover { + text-shadow: none; +} + +.caja-desktop EelEditableLabel.entry { + border-image: none; + border-width: 1px; + text-shadow: none; +} diff --git a/src/caja-application.c b/src/caja-application.c index 3d2d87bf..b179643f 100644 --- a/src/caja-application.c +++ b/src/caja-application.c @@ -1015,6 +1015,30 @@ desktop_changed_callback_connect (CajaApplication *application) return FALSE; } +#if GTK_CHECK_VERSION (3, 0, 0) +static void +init_css (void) +{ + GtkCssProvider *provider; + GError *error = NULL; + + provider = gtk_css_provider_new (); + gtk_css_provider_load_from_path (provider, + CAJA_DATADIR G_DIR_SEPARATOR_S "caja.css", &error); + + if (error != NULL) { + g_warning ("Failed to load application css file: %s", 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); +} +#endif + void caja_application_startup (CajaApplication *application, gboolean kill_shell, @@ -1072,6 +1096,11 @@ caja_application_startup (CajaApplication *application, g_signal_connect (application->unique_app, "message-received", G_CALLBACK (message_received_cb), application); } +#if GTK_CHECK_VERSION (3, 0, 0) + /* initialize CSS theming */ + init_css (); +#endif + /* Start the File Manager DBus Interface */ fdb_manager = caja_freedesktop_dbus_new (application); |