[gtksourceview/wip/chergert/snippets: 103/119] view: use new gutter creation widgets



commit 72d6855fb1b387bdb8de49cb4a9171067d782e2e
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 15 15:40:43 2020 -0800

    view: use new gutter creation widgets
    
    And warn if we get something we don't support.

 gtksourceview/gtksourceview.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 3b4895bd..b4ef6a7d 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -4807,20 +4807,28 @@ gtk_source_view_get_gutter (GtkSourceView     *view,
        {
                if (priv->left_gutter == NULL)
                {
-                       priv->left_gutter = _gtk_source_gutter_new (view, window_type);
+                       priv->left_gutter = _gtk_source_gutter_new (window_type);
+                       gtk_text_view_set_gutter (GTK_TEXT_VIEW (view),
+                                                 GTK_TEXT_WINDOW_LEFT,
+                                                 GTK_WIDGET (priv->left_gutter));
                }
 
                return priv->left_gutter;
        }
-       else
+       else if (window_type == GTK_TEXT_WINDOW_RIGHT)
        {
                if (priv->right_gutter == NULL)
                {
-                       priv->right_gutter = _gtk_source_gutter_new (view, window_type);
+                       priv->right_gutter = _gtk_source_gutter_new (window_type);
+                       gtk_text_view_set_gutter (GTK_TEXT_VIEW (view),
+                                                 GTK_TEXT_WINDOW_RIGHT,
+                                                 GTK_WIDGET (priv->right_gutter));
                }
 
                return priv->right_gutter;
        }
+
+       g_return_val_if_reached (NULL);
 }
 
 /**


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