[gtksourceview] Background pattern: small code improvements



commit e46d5ec14f743b24165cb07b7f35f4974f09d4a2
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Jan 25 12:05:18 2015 +0100

    Background pattern: small code improvements

 gtksourceview/gtksourceview.c |   11 +++++------
 tests/test-widget.c           |    4 +++-
 2 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index b6d1ae1..100a02a 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -546,7 +546,7 @@ gtk_source_view_class_init (GtkSourceViewClass *klass)
        /**
         * GtkSourceView:background-pattern:
         *
-        * Set to draw a specific background pattern on the view.
+        * Draw a specific background pattern on the view.
         *
         * Since: 3.16
         */
@@ -554,9 +554,9 @@ gtk_source_view_class_init (GtkSourceViewClass *klass)
                                         PROP_BACKGROUND_PATTERN,
                                         g_param_spec_enum ("background-pattern",
                                                            "Background pattern",
-                                                           "Set to draw a specific background pattern on the 
view",
+                                                           "Draw a specific background pattern on the view",
                                                            GTK_SOURCE_TYPE_BACKGROUND_PATTERN_TYPE,
-                                                           0,
+                                                           GTK_SOURCE_BACKGROUND_PATTERN_TYPE_NONE,
                                                            G_PARAM_READWRITE));
 
        signals [UNDO] =
@@ -4756,8 +4756,7 @@ gtk_source_view_get_mark_attributes (GtkSourceView           *view,
 /**
  * gtk_source_view_set_background_pattern:
  * @view: a #GtkSourceView.
- * @background_pattern: #GtkSourceBackgroundPatternType specifing how
- * the background pattern should be be displayed.
+ * @background_pattern: the #GtkSourceBackgroundPatternType.
  *
  * Set if and how the background pattern should be displayed.
  *
@@ -4793,7 +4792,7 @@ gtk_source_view_set_background_pattern (GtkSourceView                  *view,
 GtkSourceBackgroundPatternType
 gtk_source_view_get_background_pattern (GtkSourceView *view)
 {
-       g_return_val_if_fail (GTK_SOURCE_IS_VIEW (view), 0);
+       g_return_val_if_fail (GTK_SOURCE_IS_VIEW (view), GTK_SOURCE_BACKGROUND_PATTERN_TYPE_NONE);
 
        return view->priv->background_pattern;
 }
diff --git a/tests/test-widget.c b/tests/test-widget.c
index 2b06090..1702d3b 100644
--- a/tests/test-widget.c
+++ b/tests/test-widget.c
@@ -925,7 +925,7 @@ on_background_pattern_changed (GtkComboBox *combobox,
 
        text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (combobox));
 
-       if (g_str_equal (text, "Grid"))
+       if (g_strcmp0 (text, "Grid") == 0)
        {
                gtk_source_view_set_background_pattern (self->priv->view,
                                                        GTK_SOURCE_BACKGROUND_PATTERN_TYPE_GRID);
@@ -935,6 +935,8 @@ on_background_pattern_changed (GtkComboBox *combobox,
                gtk_source_view_set_background_pattern (self->priv->view,
                                                        GTK_SOURCE_BACKGROUND_PATTERN_TYPE_NONE);
        }
+
+       g_free (text);
 }
 
 static void


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