forked from AuroraMiddleware/gtk
GtkMisc: Keep gtk_misc_set_alignment working
Now that labels and images no longer use x/yalign in their code, we need to make gtk_misc_set_alignment set the h/valign for these widgets, to keep it stumbling along until its final demise. https://bugzilla.gnome.org/show_bug.cgi?id=730613
This commit is contained in:
parent
1008e15414
commit
aabc356b80
@ -27,6 +27,8 @@
|
||||
#include "gtkmisc.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkimage.h"
|
||||
#include "gtklabel.h"
|
||||
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
@ -232,6 +234,28 @@ gtk_misc_set_alignment (GtkMisc *misc,
|
||||
|
||||
priv = misc->priv;
|
||||
|
||||
if (GTK_IS_LABEL (misc) || GTK_IS_IMAGE (misc))
|
||||
{
|
||||
GtkAlign halign, valign;
|
||||
|
||||
if (xalign < 0.4)
|
||||
halign = GTK_ALIGN_START;
|
||||
else if (xalign > 0.6)
|
||||
halign = GTK_ALIGN_END;
|
||||
else
|
||||
halign = GTK_ALIGN_CENTER;
|
||||
|
||||
if (yalign < 0.4)
|
||||
valign = GTK_ALIGN_START;
|
||||
else if (yalign > 0.6)
|
||||
valign = GTK_ALIGN_END;
|
||||
else
|
||||
valign = GTK_ALIGN_CENTER;
|
||||
|
||||
gtk_widget_set_halign (GTK_WIDGET (misc), halign);
|
||||
gtk_widget_set_valign (GTK_WIDGET (misc), valign);
|
||||
}
|
||||
|
||||
if (xalign < 0.0)
|
||||
xalign = 0.0;
|
||||
else if (xalign > 1.0)
|
||||
|
Loading…
Reference in New Issue
Block a user