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