[california] Arrange GtkHeaderBar button order by GTK version: Bug #731316



commit 1e6ade85a855317e698949434920078684ddaaab
Author: Yosef Or Boczko <yoseforb src gnome org>
Date:   Fri Jun 13 11:56:40 2014 -0700

    Arrange GtkHeaderBar button order by GTK version: Bug #731316
    
    A bug fix in 3.12 changes pack_end() ordering, but since California
    still supports 3.10, need to conditionally compile this in.

 configure.ac                   |    4 ++++
 src/Makefile.am                |    4 ++++
 src/host/host-main-window.vala |    9 ++++++++-
 3 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 8cdcbe2..d307d82 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,6 +44,10 @@ PKG_CHECK_MODULES(CALIFORNIA, [
        goa-1.0 >= $GOA_REQUIRED
        gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED
 ])
+
+# Look for GTK+ 3.12 or better
+AM_CONDITIONAL(IS_GTK_312, pkg-config --exists 'gtk+-3.0 >= 3.12')
+
 AC_SUBST(CALIFORNIA_CFLAGS)
 AC_SUBST(CALIFORNIA_LIBS)
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 20b2634..2d87178 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -184,6 +184,10 @@ if ENABLE_UNITY
 california_OPTIONAL_VALAFLAGS += --define ENABLE_UNITY
 endif
 
+if IS_GTK_312
+california_OPTIONAL_VALAFLAGS += --define GTK_312
+endif
+
 california_VALAFLAGS = \
        --fatal-warnings --debug --enable-checking --vapidir $(top_srcdir)/vapi --target-glib=2.38 \
        --enable-deprecated \
diff --git a/src/host/host-main-window.vala b/src/host/host-main-window.vala
index f542eee..cf95a5a 100644
--- a/src/host/host-main-window.vala
+++ b/src/host/host-main-window.vala
@@ -222,10 +222,17 @@ public class MainWindow : Gtk.ApplicationWindow {
         size.add_widget(calendars);
         size.add_widget(window_menu);
         
-        // pack right-side of window
+        // pack right-side of window ... note that this was fixed in 3.12, reversing the order of
+        // how widgets need to be packed at the end
+#if GTK_312
+        headerbar.pack_end(window_menu);
+        headerbar.pack_end(calendars);
+        headerbar.pack_end(quick_add_button);
+#else
         headerbar.pack_end(quick_add_button);
         headerbar.pack_end(calendars);
         headerbar.pack_end(window_menu);
+#endif
         
         Gtk.Box layout = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
         // if on Unity, since headerbar is not the titlebar, need to pack it like any other widget


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