[gtksourceview/wip/chergert/gsv-gtk4: 108/197] completion: remove GtkSourceCompletionContainer



commit 3981c3ea4c594b06c2c85757b1b655338f97db13
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 15 14:16:44 2020 -0800

    completion: remove GtkSourceCompletionContainer
    
    This is unfortunate, but we cannot subclass GtkScrolledWindow anymore. We
    might bring this back, but more likely is that we'll reintroduce the
    sizing feature as part of a modernized completion API using newer GLib
    features such as GListModel.
    
    The fallout from this is tight control over the completion window height
    is temporarily lost until the new API lands.

 gtksourceview/gtksourcecompletion.c                |   7 -
 gtksourceview/gtksourcecompletion.ui               |   6 +-
 .../gtksourcecompletioncontainer-private.h         |  37 ----
 gtksourceview/gtksourcecompletioncontainer.c       | 222 ---------------------
 gtksourceview/gtksourcetypes-private.h             |   1 -
 gtksourceview/meson.build                          |   1 -
 6 files changed, 5 insertions(+), 269 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index 5ff8a582..1d6c6eaf 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -108,7 +108,6 @@
 #include "gtksourcecompletioninfo-private.h"
 #include "gtksourcecompletionproposal.h"
 #include "gtksourcecompletionprovider.h"
-#include "gtksourcecompletioncontainer-private.h"
 #include "gtksourcecompletioncontext-private.h"
 #include "gtksourcebuffer.h"
 #include "gtksource-marshal.h"
@@ -2241,14 +2240,9 @@ gtk_source_completion_constructed (GObject *object)
        GtkSourceCompletion *completion = GTK_SOURCE_COMPLETION (object);
        GError *error = NULL;
        GtkBuilder *builder = gtk_builder_new ();
-       GtkSourceCompletionContainer *container = _gtk_source_completion_container_new ();
-       g_object_ref_sink (container);
 
        gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
 
-       /* GtkSourceCompletionContainer is a private type. */
-       gtk_builder_expose_object (builder, "completion_container", G_OBJECT (container));
-
        gtk_builder_add_from_resource (builder,
                                       "/org/gnome/gtksourceview/ui/gtksourcecompletion.ui",
                                       &error);
@@ -2264,7 +2258,6 @@ gtk_source_completion_constructed (GObject *object)
        connect_style_context (completion);
 
        g_object_unref (builder);
-       g_object_unref (container);
 
        G_OBJECT_CLASS (gtk_source_completion_parent_class)->constructed (object);
 }
diff --git a/gtksourceview/gtksourcecompletion.ui b/gtksourceview/gtksourcecompletion.ui
index 39763974..7de346ce 100644
--- a/gtksourceview/gtksourcecompletion.ui
+++ b/gtksourceview/gtksourcecompletion.ui
@@ -36,8 +36,12 @@ along with this library; if not, see <http://www.gnu.org/licenses/>.
         <property name="visible">True</property>
         <property name="orientation">vertical</property>
         <child>
-          <object class="GtkSourceCompletionContainer" id="completion_container">
+          <object class="GtkScrolledWindow" id="completion_container">
             <property name="visible">True</property>
+            <!-- TODO: this will need more work with a gtk4 port -->
+            <property name="propagate-natural-height">True</property>
+            <property name="propagate-natural-width">True</property>
+            <property name="max-content-height">250</property>
             <property name="can_focus">False</property>
             <child>
               <object class="GtkTreeView" id="tree_view_proposals">
diff --git a/gtksourceview/gtksourcetypes-private.h b/gtksourceview/gtksourcetypes-private.h
index 7748aadf..5d0570db 100644
--- a/gtksourceview/gtksourcetypes-private.h
+++ b/gtksourceview/gtksourcetypes-private.h
@@ -25,7 +25,6 @@ G_BEGIN_DECLS
 
 typedef struct _GtkSourceBufferInputStream      GtkSourceBufferInputStream;
 typedef struct _GtkSourceBufferOutputStream     GtkSourceBufferOutputStream;
-typedef struct _GtkSourceCompletionContainer    GtkSourceCompletionContainer;
 typedef struct _GtkSourceCompletionModel        GtkSourceCompletionModel;
 typedef struct _GtkSourceContextEngine          GtkSourceContextEngine;
 typedef struct _GtkSourceEngine                 GtkSourceEngine;
diff --git a/gtksourceview/meson.build b/gtksourceview/meson.build
index 3ed3d3c5..e0f3945d 100644
--- a/gtksourceview/meson.build
+++ b/gtksourceview/meson.build
@@ -90,7 +90,6 @@ core_private_c = files([
   'gtksourcebufferinputstream.c',
   'gtksourcebufferinternal.c',
   'gtksourcebufferoutputstream.c',
-  'gtksourcecompletioncontainer.c',
   'gtksourcecompletionmodel.c',
   'gtksourcecontextengine.c',
   'gtksourceengine.c',


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