app: Check for API availability in gimp_statusbar_init()
This commit is contained in:
@ -162,8 +162,8 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *image;
|
||||
GimpUnitStore *store;
|
||||
GtkWidget *message_area;
|
||||
GtkWidget *message_area_parent;
|
||||
GtkWidget *original_child;
|
||||
GtkWidget *original_child_parent;
|
||||
|
||||
statusbar->shell = NULL;
|
||||
statusbar->messages = NULL;
|
||||
@ -181,13 +181,17 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
|
||||
statusbar->progress_active = FALSE;
|
||||
statusbar->progress_shown = FALSE;
|
||||
|
||||
/* 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));
|
||||
/* remove the message area or label and insert a hbox */
|
||||
#if GTK_CHECK_VERSION (2, 19, 1)
|
||||
original_child = gtk_statusbar_get_message_area (GTK_STATUSBAR (statusbar));
|
||||
#else
|
||||
original_child = GTK_STATUSBAR (statusbar)->label;
|
||||
#endif
|
||||
original_child_parent = gtk_widget_get_parent (original_child);
|
||||
gtk_container_remove (GTK_CONTAINER (original_child_parent), g_object_ref (original_child));
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 1);
|
||||
gtk_container_add (GTK_CONTAINER (message_area_parent), hbox);
|
||||
gtk_container_add (GTK_CONTAINER (original_child_parent), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
statusbar->cursor_label = gtk_label_new ("8888, 8888");
|
||||
@ -222,9 +226,9 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
|
||||
G_CALLBACK (gimp_statusbar_scale_activated),
|
||||
statusbar);
|
||||
|
||||
/* 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);
|
||||
/* put the message area or label back into our hbox */
|
||||
gtk_box_pack_start (GTK_BOX (hbox), original_child, TRUE, TRUE, 1);
|
||||
g_object_unref (original_child);
|
||||
|
||||
g_signal_connect_after (GTK_STATUSBAR (statusbar)->label, "expose-event",
|
||||
G_CALLBACK (gimp_statusbar_label_expose),
|
||||
|
Reference in New Issue
Block a user