[gtk+] GtkMisc: Keep gtk_misc_set_alignment working



commit aabc356b80fab025d460f61b6c08743b2c10e20d
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri May 23 05:56:52 2014 -0400

    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

 gtk/deprecated/gtkmisc.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/gtk/deprecated/gtkmisc.c b/gtk/deprecated/gtkmisc.c
index 303b5e7..ff4db12 100644
--- a/gtk/deprecated/gtkmisc.c
+++ b/gtk/deprecated/gtkmisc.c
@@ -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)


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