[gnumeric] GUI: Keep only one gnumeric.css provider around.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] GUI: Keep only one gnumeric.css provider around.
- Date: Fri, 5 Apr 2013 13:20:32 +0000 (UTC)
commit a7f439ac511c85843993c322a97028ee21e5c992
Author: Morten Welinder <terra gnome org>
Date: Fri Apr 5 09:19:44 2013 -0400
GUI: Keep only one gnumeric.css provider around.
...as opposed to one per screen.
ChangeLog | 3 +++
src/wbc-gtk.c | 15 +++++++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c0a1044..b156238 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2013-04-05 Morten Welinder <terra gnome org>
+ * src/wbc-gtk.c (cb_screen_changed): Re-use the css provider for
+ new screens.
+
* src/mathfunc.c (gnm_owent): New function.
2013-04-04 Jean Brefort <jean brefort normalesup org>
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index 50ebeff..b5621db 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -2300,13 +2300,18 @@ cb_screen_changed (GtkWidget *widget)
{
GdkScreen *screen = gtk_widget_get_screen (widget);
const char *key = "wbcg-screen-css";
+ GObject *app = gnm_app_get_app ();
+ const char *app_key = "css-provider";
+ GtkCssProvider *css;
- if (screen && !g_object_get_data (G_OBJECT (screen), key)) {
- GtkCssProvider *css = gtk_css_provider_new ();
+ css = g_object_get_data (app, app_key);
+ if (!css) {
const char *resource = "gnm:gnumeric.css";
const char *csstext = go_rsm_lookup (resource, NULL);
gboolean debug = gnm_debug_flag ("css");
+ css = gtk_css_provider_new ();
+
if (debug)
g_printerr ("Loading style from %s\n", resource);
else
@@ -2315,12 +2320,14 @@ cb_screen_changed (GtkWidget *widget)
NULL);
gtk_css_provider_load_from_data (css, csstext, -1, NULL);
+ g_object_set_data_full (app, app_key, css, g_object_unref);
+ }
+
+ if (screen && !g_object_get_data (G_OBJECT (screen), key)) {
gtk_style_context_add_provider_for_screen
(screen,
GTK_STYLE_PROVIDER (css),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- g_object_unref (css);
-
g_object_set_data (G_OBJECT (screen), key, css);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]