diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2010-12-06 15:53:31 +0100 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2010-12-06 15:53:31 +0100 |
commit | bc5d2904fd3338455579c77781c357fe85a86913 (patch) | |
tree | 431122ce06b3239d9fa7a4bd86f55ba5a0945121 /src | |
parent | 5fc40adf98a384f4638401d7b7ced79da6ce2b87 (diff) | |
download | nautilus-bc5d2904fd3338455579c77781c357fe85a86913.tar.gz |
notebook: port to GtkStyleContext
Diffstat (limited to 'src')
-rw-r--r-- | src/nautilus-notebook.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/nautilus-notebook.c b/src/nautilus-notebook.c index 4cf6c5241..8663c0835 100644 --- a/src/nautilus-notebook.c +++ b/src/nautilus-notebook.c @@ -81,15 +81,6 @@ nautilus_notebook_class_init (NautilusNotebookClass *klass) container_class->remove = nautilus_notebook_remove; notebook_class->insert_page = nautilus_notebook_insert_page; - - gtk_rc_parse_string ("style \"nautilus-tab-close-button-style\"\n" - "{\n" - "GtkWidget::focus-padding = 0\n" - "GtkWidget::focus-line-width = 0\n" - "xthickness = 0\n" - "ythickness = 0\n" - "}\n" - "widget \"*.nautilus-tab-close-button\" style \"nautilus-tab-close-button-style\""); signals[TAB_CLOSE_REQUEST] = g_signal_new ("tab-close-request", @@ -239,6 +230,29 @@ button_press_cb (NautilusNotebook *notebook, static void nautilus_notebook_init (NautilusNotebook *notebook) { + static const gchar css_custom[] = + "#nautilus-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 NautilusNotebook'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); + 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); |