[vte/vte-next] fixup! Use the background pattern from the style



commit 19c57d5072b64141eaf8a181a323c13a4b42d3db
Author: Christian Persch <chpe gnome org>
Date:   Mon May 23 18:15:28 2011 +0200

    fixup! Use the background pattern from the style

 src/vte.c |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/src/vte.c b/src/vte.c
index 8c7f9f3..c3cd50a 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -69,6 +69,8 @@ typedef gunichar wint_t;
 #define howmany(x, y) (((x) + ((y) - 1)) / (y))
 #endif
 
+#define CAIRO_GOBJECT_TYPE_PATTERN (g_type_from_name("CairoPattern"))
+
 static void vte_terminal_set_visibility (VteTerminal *terminal, GdkVisibilityState state);
 static void vte_terminal_set_termcap(VteTerminal *terminal, const char *path,
 				     gboolean reset);
@@ -4242,20 +4244,10 @@ static void
 vte_terminal_update_background_style(VteTerminal *terminal)
 {
         VteTerminalPrivate *pvt = terminal->pvt;
-        GtkStyleContext *context;
         cairo_pattern_t *pattern;
 
-        context = gtk_widget_get_style_context(&terminal->widget);
-        gtk_style_context_get(context,
-                              GTK_STATE_FLAG_NORMAL,
-                              GTK_STYLE_PROPERTY_BACKGROUND_IMAGE, &pattern,
-                              NULL);
-
-        if (pattern && cairo_pattern_get_extend(pattern) == CAIRO_EXTEND_NONE) {
-                g_warning ("Pattern extend is wrong\n");
-                cairo_pattern_destroy(pattern);
-                return;
-        }
+        gtk_widget_style_get(&terminal->widget, "background-pattern", &pattern, NULL);
+        g_return_if_fail (pattern == NULL || cairo_pattern_get_extend(pattern) != CAIRO_EXTEND_NONE);
 
         _vte_debug_print(VTE_DEBUG_MISC | VTE_DEBUG_STYLE,
                          "%s background pattern.\n",
@@ -11498,6 +11490,20 @@ vte_terminal_class_init(VteTerminalClass *klass)
                                        G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
         /**
+         * VteTerminal:background-pattern:
+         *
+         * A #cairo_pattern_t to use as background.
+         * Must not have extends %CAIRO_EXTEND_NONE.
+         *
+         * Since: 0.30
+         */
+        gtk_widget_class_install_style_property
+                (widget_class,
+                 g_param_spec_boxed ("background-pattern", NULL, NULL,
+                                     CAIRO_GOBJECT_TYPE_PATTERN,
+                                     G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+        /**
          * VteTerminal:cursor-blink-mode:
          *
          * Sets whether or not the cursor will blink. Using %VTE_CURSOR_BLINK_SYSTEM



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]