[gtksourceview/wip/chergert/gsv-gtk4: 121/189] view: use new gutter creation widgets



commit 62fb76dd14b004b4167b86ec0a6de7308ca9bd9d
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]