diff options
author | raveit65 <[email protected]> | 2016-04-15 10:25:20 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2016-04-20 16:04:43 +0200 |
commit | e8be955849664584f1fb697fd904ae9f85945a5e (patch) | |
tree | 879ce9db288821951472b5ae0d217e6104c3ef60 /src | |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/caja-application.c | 29 |
1 files changed, 29 insertions, 0 deletions
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); |