summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWolfgang Ulbrich <[email protected]>2016-01-07 05:03:27 +0100
committerWolfgang Ulbrich <[email protected]>2016-01-13 15:05:41 +0100
commitda1e7f715a4eb882abe97837eef02c7d38bd5e54 (patch)
treef975a15e443fe2bf2f102c5096bfd31b991c6c9a /src
parent20dd53f7822de644ca60cc200f5286a90d3b28b3 (diff)
downloadcaja-da1e7f715a4eb882abe97837eef02c7d38bd5e54.tar.bz2
caja-da1e7f715a4eb882abe97837eef02c7d38bd5e54.tar.xz
GTK3 window: port to GtkStyleContext
taken from: https://git.gnome.org/browse/nautilus/commit/?h=gnome-3-0&id=076886e
Diffstat (limited to 'src')
-rw-r--r--src/caja-window.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/caja-window.c b/src/caja-window.c
index c460ae98..6188a2bd 100644
--- a/src/caja-window.c
+++ b/src/caja-window.c
@@ -141,6 +141,28 @@ caja_window_init (CajaWindow *window)
GtkWidget *menu;
GtkWidget *statusbar;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ static const gchar css_custom[] =
+ "#statusbar-no-border {"
+ " -GtkStatusbar-shadow-type: none;"
+ "}"
+ "#caja-extra-view-widget {"
+ " background-color: " EXTRA_VIEW_WIDGETS_BACKGROUND ";"
+ "}";
+
+ GError *error = NULL;
+ GtkCssProvider *provider = gtk_css_provider_new ();
+ gtk_css_provider_load_from_data (provider, css_custom, -1, &error);
+
+ if (error != NULL) {
+ g_warning ("Can't parse CajaWindow's CSS custom description: %s\n", error->message);
+ g_error_free (error);
+ } else {
+ gtk_style_context_add_provider (gtk_widget_get_style_context (GTK_WIDGET (window)),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ }
+#endif
window->details = G_TYPE_INSTANCE_GET_PRIVATE (window, CAJA_TYPE_WINDOW, CajaWindowDetails);
window->details->panes = NULL;
@@ -148,6 +170,7 @@ caja_window_init (CajaWindow *window)
window->details->show_hidden_files_mode = CAJA_WINDOW_SHOW_HIDDEN_FILES_DEFAULT;
+#if !GTK_CHECK_VERSION (3, 0, 0)
/* Remove Top border on GtkStatusBar */
gtk_rc_parse_string (
"style \"statusbar-no-border\"\n"
@@ -155,6 +178,7 @@ caja_window_init (CajaWindow *window)
" GtkStatusbar::shadow_type = GTK_SHADOW_NONE\n"
"}\n"
"widget \"*.statusbar-noborder\" style \"statusbar-no-border\"");
+#endif
/* Set initial window title */
gtk_window_set_title (GTK_WINDOW (window), _("Caja"));
@@ -2238,6 +2262,7 @@ caja_window_class_init (CajaWindowClass *class)
class->reload = caja_window_reload;
class->go_up = caja_window_go_up_signal;
+#if !GTK_CHECK_VERSION (3,0,0)
/* Allow to set the colors of the extra view widgets */
gtk_rc_parse_string ("\n"
" style \"caja-extra-view-widgets-style-internal\"\n"
@@ -2247,6 +2272,7 @@ caja_window_class_init (CajaWindowClass *class)
"\n"
" widget \"*.caja-extra-view-widget\" style:rc \"caja-extra-view-widgets-style-internal\" \n"
"\n");
+#endif
g_type_class_add_private (G_OBJECT_CLASS (class), sizeof (CajaWindowDetails));
}