summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWolfgang Ulbrich <[email protected]>2016-01-07 04:55:59 +0100
committerWolfgang Ulbrich <[email protected]>2016-01-13 15:05:41 +0100
commit5a7203f46bcccc29271058d1f03ed149d6c2860b (patch)
tree57b1f07442a66969a1465f7958ba25ee8ee826d8 /src
parent39ce5849c81c688c53245316584489db5bc354ab (diff)
downloadcaja-5a7203f46bcccc29271058d1f03ed149d6c2860b.tar.bz2
caja-5a7203f46bcccc29271058d1f03ed149d6c2860b.tar.xz
GTK3 notebook: port to GtkStyleContext
taken from: https://git.gnome.org/browse/nautilus/commit/?h=gnome-3-0&id=bc5d290
Diffstat (limited to 'src')
-rw-r--r--src/caja-notebook.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/caja-notebook.c b/src/caja-notebook.c
index b5b6420e..035ef769 100644
--- a/src/caja-notebook.c
+++ b/src/caja-notebook.c
@@ -82,6 +82,7 @@ caja_notebook_class_init (CajaNotebookClass *klass)
notebook_class->insert_page = caja_notebook_insert_page;
+#if !GTK_CHECK_VERSION (3, 0, 0)
gtk_rc_parse_string ("style \"caja-tab-close-button-style\"\n"
"{\n"
"GtkWidget::focus-padding = 0\n"
@@ -90,6 +91,7 @@ caja_notebook_class_init (CajaNotebookClass *klass)
"ythickness = 0\n"
"}\n"
"widget \"*.caja-tab-close-button\" style \"caja-tab-close-button-style\"");
+#endif
signals[TAB_CLOSE_REQUEST] =
g_signal_new ("tab-close-request",
@@ -239,6 +241,31 @@ button_press_cb (CajaNotebook *notebook,
static void
caja_notebook_init (CajaNotebook *notebook)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ static const gchar css_custom[] =
+ "#caja-tab-close-button {"
+ " -GtkWidget-focus-padding : 0;"
+ " -GtkWidget-focus-line-width: 0;"
+ " xthickness: 0;"
+ " ythickness: 0;"
+ "}";
+
+ 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 CajaNotebook'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 (notebook)),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ }
+
+ g_object_unref (provider);
+#endif
+
gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE);
gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);