[gtkhtml] GtkhtmlComboBox: Fix runtime warnings with GTK3.



commit e0929e77e0dcc2e771a020650e61a91a3fc05d6d
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat Jan 8 15:07:39 2011 -0500

    GtkhtmlComboBox: Fix runtime warnings with GTK3.
    
    GtkComboBox changed some implementation details, apparently.

 components/editor/gtkhtml-combo-box.c |   47 ++++++++++++++++++++------------
 1 files changed, 29 insertions(+), 18 deletions(-)
---
diff --git a/components/editor/gtkhtml-combo-box.c b/components/editor/gtkhtml-combo-box.c
index 5a9b96d..e6bad02 100644
--- a/components/editor/gtkhtml-combo-box.c
+++ b/components/editor/gtkhtml-combo-box.c
@@ -279,6 +279,34 @@ combo_box_finalize (GObject *object)
 }
 
 static void
+combo_box_constructed (GObject *object)
+{
+	GtkComboBox *combo_box;
+	GtkCellRenderer *renderer;
+
+	combo_box = GTK_COMBO_BOX (object);
+
+	/* This needs to happen after constructor properties are set
+	 * so that GtkCellLayout.get_area() returns something valid. */
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (
+		GTK_CELL_LAYOUT (combo_box), renderer, FALSE);
+	gtk_cell_layout_set_cell_data_func (
+		GTK_CELL_LAYOUT (combo_box), renderer,
+		(GtkCellLayoutDataFunc) combo_box_render_pixbuf,
+		combo_box, NULL);
+
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (
+		GTK_CELL_LAYOUT (combo_box), renderer, TRUE);
+	gtk_cell_layout_set_cell_data_func (
+		GTK_CELL_LAYOUT (combo_box), renderer,
+		(GtkCellLayoutDataFunc) combo_box_render_text,
+		combo_box, NULL);
+}
+
+static void
 combo_box_changed (GtkComboBox *combo_box)
 {
 	GtkRadioAction *action;
@@ -311,6 +339,7 @@ combo_box_class_init (GtkhtmlComboBoxClass *class)
 	object_class->get_property = combo_box_get_property;
 	object_class->dispose = combo_box_dispose;
 	object_class->finalize = combo_box_finalize;
+	object_class->constructed = combo_box_constructed;
 
 	combo_box_class = GTK_COMBO_BOX_CLASS (class);
 	combo_box_class->changed = combo_box_changed;
@@ -329,26 +358,8 @@ combo_box_class_init (GtkhtmlComboBoxClass *class)
 static void
 combo_box_init (GtkhtmlComboBox *combo_box)
 {
-	GtkCellRenderer *renderer;
-
 	combo_box->priv = GTKHTML_COMBO_BOX_GET_PRIVATE (combo_box);
 
-	renderer = gtk_cell_renderer_pixbuf_new ();
-	gtk_cell_layout_pack_start (
-		GTK_CELL_LAYOUT (combo_box), renderer, FALSE);
-	gtk_cell_layout_set_cell_data_func (
-		GTK_CELL_LAYOUT (combo_box), renderer,
-		(GtkCellLayoutDataFunc) combo_box_render_pixbuf,
-		combo_box, NULL);
-
-	renderer = gtk_cell_renderer_text_new ();
-	gtk_cell_layout_pack_start (
-		GTK_CELL_LAYOUT (combo_box), renderer, TRUE);
-	gtk_cell_layout_set_cell_data_func (
-		GTK_CELL_LAYOUT (combo_box), renderer,
-		(GtkCellLayoutDataFunc) combo_box_render_text,
-		combo_box, NULL);
-
 	combo_box->priv->index = g_hash_table_new_full (
 		g_direct_hash, g_direct_equal,
 		(GDestroyNotify) NULL,



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