[gtk+] Create a buffer in init() so subclasses can use the entry in their init()



commit b664c328b4288f65bd4585900ad9233791d3772f
Author: Michael Natterer <mitch gimp org>
Date:   Fri Jul 10 20:27:33 2009 +0200

    Create a buffer in init() so subclasses can use the entry in their init()

 gtk/gtkentry.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index f147b3f..de10f0d 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -2280,7 +2280,8 @@ static void
 gtk_entry_init (GtkEntry *entry)
 {
   GtkEntryPrivate *priv = GTK_ENTRY_GET_PRIVATE (entry);
-  
+  GtkEntryBuffer *buffer;
+
   GTK_WIDGET_SET_FLAGS (entry, GTK_CAN_FOCUS);
 
   entry->editable = TRUE;
@@ -2318,6 +2319,14 @@ gtk_entry_init (GtkEntry *entry)
 		    G_CALLBACK (gtk_entry_retrieve_surrounding_cb), entry);
   g_signal_connect (entry->im_context, "delete-surrounding",
 		    G_CALLBACK (gtk_entry_delete_surrounding_cb), entry);
+
+  /* need to set a buffer here, so GtkEntry subclasses can do anything
+   * in their init() functions, just as it used to be before
+   * GtkEntryBuffer
+   */
+  buffer = gtk_entry_buffer_new (NULL, 0);
+  gtk_entry_set_buffer (entry, buffer);
+  g_object_unref (buffer);
 }
 
 static gint



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