[gimp] app: Use more proper API in gimp_statusbar_init()



commit a81dc5ead39ddc71de7a77ee5f6c01ac85022523
Author: Martin Nordholts <martinn src gnome org>
Date:   Mon Nov 30 22:55:31 2009 +0100

    app: Use more proper API in gimp_statusbar_init()
    
    Use more proper API in gimp_statusbar_init() when we rearrange widgets
    to get rid of warnings. Requires an up to date GTK+, max 2 weeks old
    or so, for gtk_statusbar_get_message_area().
    
    This makes app/tests run again since there are no warnings about wrong
    widget parent.

 app/display/gimpstatusbar.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/app/display/gimpstatusbar.c b/app/display/gimpstatusbar.c
index 42e7778..4e192b3 100644
--- a/app/display/gimpstatusbar.c
+++ b/app/display/gimpstatusbar.c
@@ -162,6 +162,8 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
   GtkWidget     *hbox;
   GtkWidget     *image;
   GimpUnitStore *store;
+  GtkWidget     *message_area;
+  GtkWidget     *message_area_parent;
 
   statusbar->shell          = NULL;
   statusbar->messages       = NULL;
@@ -179,12 +181,13 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
   statusbar->progress_active      = FALSE;
   statusbar->progress_shown       = FALSE;
 
-  /* remove the label and insert a hbox */
-  gtk_container_remove (GTK_CONTAINER (GTK_STATUSBAR (statusbar)->frame),
-                        g_object_ref (GTK_STATUSBAR (statusbar)->label));
+  /* remove the message area and insert a hbox */
+  message_area = gtk_statusbar_get_message_area (GTK_STATUSBAR (statusbar));
+  message_area_parent = gtk_widget_get_parent (message_area);
+  gtk_container_remove (GTK_CONTAINER (message_area_parent), g_object_ref (message_area));
 
   hbox = gtk_hbox_new (FALSE, 1);
-  gtk_container_add (GTK_CONTAINER (GTK_STATUSBAR (statusbar)->frame), hbox);
+  gtk_container_add (GTK_CONTAINER (message_area_parent), hbox);
   gtk_widget_show (hbox);
 
   statusbar->cursor_label = gtk_label_new ("8888, 8888");
@@ -219,10 +222,9 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
                     G_CALLBACK (gimp_statusbar_scale_activated),
                     statusbar);
 
-  /*  put the label back into our hbox  */
-  gtk_box_pack_start (GTK_BOX (hbox),
-                      GTK_STATUSBAR (statusbar)->label, TRUE, TRUE, 1);
-  g_object_unref (GTK_STATUSBAR (statusbar)->label);
+  /*  put the message area back into our hbox  */
+  gtk_box_pack_start (GTK_BOX (hbox), message_area, TRUE, TRUE, 1);
+  g_object_unref (message_area);
 
   g_signal_connect_after (GTK_STATUSBAR (statusbar)->label, "expose-event",
                           G_CALLBACK (gimp_statusbar_label_expose),



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