[vte/vte-next: 73/114] Make 'allow-bold' a style property



commit a5ff80c84c655e7b80f2d00c887d5faeec67dda7
Author: Christian Persch <chpe gnome org>
Date:   Tue May 17 21:24:47 2011 +0200

    Make 'allow-bold' a style property

 doc/reference/vte-sections.txt |    2 -
 src/vte.c                      |   96 +++++++++++----------------------------
 src/vte.h                      |    2 -
 3 files changed, 27 insertions(+), 73 deletions(-)
---
diff --git a/doc/reference/vte-sections.txt b/doc/reference/vte-sections.txt
index 183deae..67278f3 100644
--- a/doc/reference/vte-sections.txt
+++ b/doc/reference/vte-sections.txt
@@ -23,8 +23,6 @@ vte_terminal_set_audible_bell
 vte_terminal_get_audible_bell
 vte_terminal_set_visible_bell
 vte_terminal_get_visible_bell
-vte_terminal_set_allow_bold
-vte_terminal_get_allow_bold
 vte_terminal_set_scroll_on_output
 vte_terminal_set_scroll_on_keystroke
 vte_terminal_set_color_bold_rgba
diff --git a/src/vte.c b/src/vte.c
index 5bbe9b3..d021b36 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -137,7 +137,6 @@ enum {
         PROP_VADJUSTMENT,
         PROP_HSCROLL_POLICY,
         PROP_VSCROLL_POLICY,
-        PROP_ALLOW_BOLD,
         PROP_AUDIBLE_BELL,
         PROP_BACKGROUND_PATTERN,
         PROP_BACKSPACE_BINDING,
@@ -4238,11 +4237,21 @@ vte_terminal_update_style(VteTerminal *terminal)
         VteTerminalPrivate *pvt = terminal->pvt;
         GtkWidget *widget = &terminal->widget;
         float aspect;
+        gboolean allow_bold;
 
         vte_terminal_set_font(terminal, pvt->fontdesc);
         vte_terminal_set_padding(terminal);
 
-        gtk_widget_style_get(widget, "cursor-aspect-ratio", &aspect, NULL);
+        gtk_widget_style_get(widget,
+                             "allow-bold", &allow_bold,
+                             "cursor-aspect-ratio", &aspect,
+                             NULL);
+
+        if (allow_bold != pvt->allow_bold) {
+                pvt->allow_bold = allow_bold;
+                _vte_invalidate_all (terminal);
+        }
+
         if (aspect != pvt->cursor_aspect_ratio) {
                 pvt->cursor_aspect_ratio = aspect;
                 _vte_invalidate_cursor_once(terminal, FALSE);
@@ -10553,9 +10562,6 @@ vte_terminal_get_property (GObject *object,
                 case PROP_VSCROLL_POLICY:
                         g_value_set_enum (value, pvt->vscroll_policy);
                         break;
-                case PROP_ALLOW_BOLD:
-                        g_value_set_boolean (value, vte_terminal_get_allow_bold (terminal));
-                        break;
                 case PROP_AUDIBLE_BELL:
                         g_value_set_boolean (value, vte_terminal_get_audible_bell (terminal));
                         break;
@@ -10645,9 +10651,6 @@ vte_terminal_set_property (GObject *object,
                         pvt->vscroll_policy = g_value_get_enum (value);
                         gtk_widget_queue_resize_no_redraw (GTK_WIDGET (terminal));
                         break;
-                case PROP_ALLOW_BOLD:
-                        vte_terminal_set_allow_bold (terminal, g_value_get_boolean (value));
-                        break;
                 case PROP_AUDIBLE_BELL:
                         vte_terminal_set_audible_bell (terminal, g_value_get_boolean (value));
                         break;
@@ -11309,22 +11312,6 @@ vte_terminal_class_init(VteTerminalClass *klass)
 			     G_TYPE_NONE, 0);
 
         /**
-         * VteTerminal:allow-bold:
-         *
-         * Controls whether or not the terminal will attempt to draw bold text.
-         * This may happen either by using a bold font variant, or by
-         * repainting text with a different offset.
-         * 
-         * Since: 0.20
-         */
-        g_object_class_install_property
-                (gobject_class,
-                 PROP_ALLOW_BOLD,
-                 g_param_spec_boolean ("allow-bold", NULL, NULL,
-                                       TRUE,
-                                       G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-     
-        /**
          * VteTerminal:audible-bell:
          *
          * Controls whether or not the terminal will beep when the child outputs the
@@ -11629,6 +11616,21 @@ vte_terminal_class_init(VteTerminalClass *klass)
 
         /* Style properties */
 
+        /**
+         * VteTerminal:allow-bold:
+         *
+         * Controls whether or not the terminal will attempt to draw bold text.
+         * This may happen either by using a bold font variant, or by
+         * repainting text with a different offset.
+         *
+         * Since: 0.30
+         */
+        gtk_widget_class_install_style_property
+                (widget_class,
+                 g_param_spec_boolean ("allow-bold", NULL, NULL,
+                                       TRUE,
+                                       G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
         /* Keybindings */
 	binding_set = gtk_binding_set_by_class(klass);
 
@@ -11645,6 +11647,7 @@ vte_terminal_class_init(VteTerminalClass *klass)
         gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (klass->priv->style_provider),
                                          "VteTerminal {\n"
                                            "padding: 1 1 1 1;\n"
+                                           "-VteTerminal-allow-bold: true;\n"
                                          "}\n",
                                          -1, NULL);
 }
@@ -11737,51 +11740,6 @@ vte_terminal_get_visible_bell(VteTerminal *terminal)
 }
 
 /**
- * vte_terminal_set_allow_bold:
- * @terminal: a #VteTerminal
- * @allow_bold: %TRUE if the terminal should attempt to draw bold text
- *
- * Controls whether or not the terminal will attempt to draw bold text,
- * either by using a bold font variant or by repainting text with a different
- * offset.
- *
- */
-void
-vte_terminal_set_allow_bold(VteTerminal *terminal, gboolean allow_bold)
-{
-        VteTerminalPrivate *pvt;
-
-	g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
-        pvt = terminal->pvt;
-
-        allow_bold = allow_bold != FALSE;
-        if (allow_bold == pvt->allow_bold)
-                return;
-
-	pvt->allow_bold = allow_bold;
-        g_object_notify (G_OBJECT (terminal), "allow-bold");
-
-	_vte_invalidate_all (terminal);
-}
-
-/**
- * vte_terminal_get_allow_bold:
- * @terminal: a #VteTerminal
- *
- * Checks whether or not the terminal will attempt to draw bold text by
- * repainting text with a one-pixel offset.
- *
- * Returns: %TRUE if bolding is enabled, %FALSE if not
- */
-gboolean
-vte_terminal_get_allow_bold(VteTerminal *terminal)
-{
-	g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE);
-	return terminal->pvt->allow_bold;
-}
-
-/**
  * vte_terminal_set_scroll_background:
  * @terminal: a #VteTerminal
  * @scroll: whether the terminal should scroll the background image along with
diff --git a/src/vte.h b/src/vte.h
index 1679f56..3d2782d 100644
--- a/src/vte.h
+++ b/src/vte.h
@@ -276,8 +276,6 @@ void vte_terminal_set_font(VteTerminal *terminal,
 			   const PangoFontDescription *font_desc);
 void vte_terminal_set_font_from_string(VteTerminal *terminal, const char *name);
 const PangoFontDescription *vte_terminal_get_font(VteTerminal *terminal);
-void vte_terminal_set_allow_bold(VteTerminal *terminal, gboolean allow_bold);
-gboolean vte_terminal_get_allow_bold(VteTerminal *terminal);
 
 /* Check if the terminal is the current selection owner. */
 gboolean vte_terminal_get_has_selection(VteTerminal *terminal);



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