[gtk/wip/carlosg/text-handle-natives: 4/6] gtktexthandle: Add parent argument to GtkTextHandleWidget



commit 0a35be2cc8f5386241be62005824b2d63b119808
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Feb 3 16:18:20 2020 +0100

    gtktexthandle: Add parent argument to GtkTextHandleWidget
    
    This will be used in the future.

 gtk/gtktexthandle.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c
index 97d948a2bd..74a22a1d7d 100644
--- a/gtk/gtktexthandle.c
+++ b/gtk/gtktexthandle.c
@@ -49,6 +49,7 @@ enum {
 struct _GtkTextHandleWidget
 {
   GtkWidget parent_instance;
+  GtkWidget *parent;
 };
 
 struct _TextHandle
@@ -115,11 +116,16 @@ gtk_text_handle_widget_init (GtkTextHandleWidget *widget)
 }
 
 static GtkWidget *
-gtk_text_handle_widget_new (void)
+gtk_text_handle_widget_new (GtkWidget *parent)
 {
-  return g_object_new (gtk_text_handle_widget_get_type (),
-                       "css-name", I_("cursor-handle"),
-                       NULL);
+  GtkTextHandleWidget *handle;
+
+  handle = g_object_new (gtk_text_handle_widget_get_type (),
+                         "css-name", I_("cursor-handle"),
+                         NULL);
+  handle->parent = parent;
+
+  return GTK_WIDGET (handle);
 }
 
 static void _gtk_text_handle_update (GtkTextHandle         *handle,
@@ -235,7 +241,7 @@ _gtk_text_handle_ensure_widget (GtkTextHandle         *handle,
       GtkStyleContext *context;
       GtkEventController *controller;
 
-      widget = gtk_text_handle_widget_new ();
+      widget = gtk_text_handle_widget_new (priv->parent);
 
       gtk_widget_set_direction (widget, priv->handles[pos].dir);
 


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