[rhythmbox/gobject-introspection: 39/41] convert gtkrcstyle hackery into gtkcssprovider hackery
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox/gobject-introspection: 39/41] convert gtkrcstyle hackery into gtkcssprovider hackery
- Date: Sun, 12 Dec 2010 10:01:25 +0000 (UTC)
commit f4e5dff95e2fb5f467432599f4a0aee6b31e4d4f
Author: Jonathan Matthew <jonathan d14n org>
Date: Sun Dec 12 18:24:54 2010 +1000
convert gtkrcstyle hackery into gtkcssprovider hackery
plugins/audiocd/rb-audiocd-source.c | 25 +++++++++++++------------
shell/rb-source-header.c | 30 +++++++++++++++---------------
2 files changed, 28 insertions(+), 27 deletions(-)
---
diff --git a/plugins/audiocd/rb-audiocd-source.c b/plugins/audiocd/rb-audiocd-source.c
index a0dbcaa..81f36ea 100644
--- a/plugins/audiocd/rb-audiocd-source.c
+++ b/plugins/audiocd/rb-audiocd-source.c
@@ -278,20 +278,21 @@ rb_audiocd_source_dispose (GObject *object)
static inline void
force_no_spacing (GtkWidget *widget)
{
- static gboolean first_time = TRUE;
- if (first_time) {
- gtk_rc_parse_string ("\n"
- " style \"audiocd-extract-header-style\"\n"
- " {\n"
- " GtkCheckButton::indicator-spacing=0\n"
- " }\n"
- "\n"
- " widget \"*.audiocd-extract-header\" style \"audiocd-extract-header-style\"\n"
- "\n");
- first_time = FALSE;
+ static GtkCssProvider *provider = NULL;
+
+ if (provider == NULL) {
+ const char *style =
+ "GtkCheckButton {\n"
+ " -GtkCheckButton-indicator-spacing: 0\n"
+ "}\n";
+
+ provider = gtk_css_provider_new ();
+ gtk_css_provider_load_from_data (provider, style, -1, NULL);
}
- gtk_widget_set_name (widget, "audiocd-extract-header");
+ gtk_style_context_add_provider (gtk_widget_get_style_context (widget),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
static void
diff --git a/shell/rb-source-header.c b/shell/rb-source-header.c
index 7f4d3d1..14ee713 100644
--- a/shell/rb-source-header.c
+++ b/shell/rb-source-header.c
@@ -156,21 +156,21 @@ G_DEFINE_TYPE (RBSourceHeader, rb_source_header, GTK_TYPE_TABLE)
static inline void
force_no_shadow (GtkWidget *widget)
{
- gboolean first_time = TRUE;
-
- if (first_time) {
- gtk_rc_parse_string ("\n"
- " style \"search-toolbar-style\"\n"
- " {\n"
- " GtkToolbar::shadow-type=GTK_SHADOW_NONE\n"
- " }\n"
- "\n"
- " widget \"*.search-toolbar\" style \"search-toolbar-style\"\n"
- "\n");
- first_time = FALSE;
- }
-
- gtk_widget_set_name (widget, "search-toolbar");
+ static GtkCssProvider *provider = NULL;
+ if (provider == NULL) {
+ const char *style =
+ "GtkToolbar {\n"
+ " -GtkToolbar-shadow-type: none\n"
+ "}";
+
+ provider = gtk_css_provider_new ();
+ gtk_css_provider_load_from_data (provider, style, -1, NULL);
+ }
+
+ /*
+ gtk_style_context_add_provider (gtk_widget_get_style_context (widget),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); */
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]