[geary] Make compatible w/ Vala 0.28 and GTK+ 3.16+



commit 9d281b3a4cb0faaac6dc45fd07c2ba09d9a6bf19
Author: Jim Nelson <jim yorba org>
Date:   Mon Mar 23 12:09:44 2015 -0700

    Make compatible w/ Vala 0.28 and GTK+ 3.16+
    
    GTK+ 3.16 removes Gtk.Misc and its properties, meaning newer versions
    of Vala can't compile with older versions of GTK+ if they reference
    Gtk.Misc's symbols (including "xalign" and "yalign").  This fixes the
    problem until Geary requires 3.16 to run.

 .../account-dialog-edit-alternate-emails-pane.vala |    2 +-
 src/client/util/util-gtk.vala                      |   12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/src/client/accounts/account-dialog-edit-alternate-emails-pane.vala 
b/src/client/accounts/account-dialog-edit-alternate-emails-pane.vala
index e621ee5..fd6e166 100644
--- a/src/client/accounts/account-dialog-edit-alternate-emails-pane.vala
+++ b/src/client/accounts/account-dialog-edit-alternate-emails-pane.vala
@@ -14,7 +14,7 @@ public class AccountDialogEditAlternateEmailsPane : AccountDialogPane {
             label = "<b>%s</b>".printf(Geary.HTML.escape_markup(mailbox.get_full_address()));
             use_markup = true;
             ellipsize = Pango.EllipsizeMode.END;
-            xalign = 0.0f;
+            GtkUtil.set_label_xalign(this, 0.0f);
         }
     }
     
diff --git a/src/client/util/util-gtk.vala b/src/client/util/util-gtk.vala
index 2b89a6e..01d6da0 100644
--- a/src/client/util/util-gtk.vala
+++ b/src/client/util/util-gtk.vala
@@ -126,4 +126,16 @@ void apply_style(Gtk.Widget widget, string style) {
 [CCode(cname = "g_binding_unbind")]
 extern void unbind(Binding binding);
 
+/**
+ * Set xalign property on Gtk.Label in a compatible way.
+ *
+ * GtkMisc is being deprecated in GTK+ 3 and the "xalign" property has been moved to GtkLabel.  This
+ * causes compatibility problems with newer versions of Vala generating code that won't link with
+ * older versions of GTK+.  This is a convenience method until Geary requires GTK+ 3.16 as its
+ * minimum GTK+ version.
+ */
+public void set_label_xalign(Gtk.Label label, float xalign) {
+    label.set("xalign", xalign);
+}
+
 }


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