[geary] Fix GtkHeaderBar button placement under GTK 3.12: Bug #731111



commit 64b1818e7f5fce63b5ca7740950128e07d032bcc
Author: Robert Schroll <rschroll gmail com>
Date:   Tue Jun 17 12:52:24 2014 -0700

    Fix GtkHeaderBar button placement under GTK 3.12: Bug #731111

 CMakeLists.txt                          |    2 ++
 src/CMakeLists.txt                      |    9 +++++++++
 src/client/components/main-toolbar.vala |   22 ++++++++++++++++++----
 3 files changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f38456c..275f645 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -61,6 +61,8 @@ pkg_check_modules(WEBKITGTK22X QUIET webkitgtk-3.0>=2.2.0 webkitgtk-3.0<=2.2.100
 pkg_check_modules(WEBKITGTK20X QUIET webkitgtk-3.0>=2.0.0 webkitgtk-3.0<=2.0.100)
 pkg_check_modules(WEBKITGTK110X QUIET webkitgtk-3.0>=1.10.0 webkitgtk-3.0<=1.10.2)
 
+pkg_check_modules(GTK312X QUIET gtk+-3.0>=3.12.0)
+
 # intl
 include(Gettext)
 if (XGETTEXT_FOUND)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 90742f1..d08f30a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -503,6 +503,15 @@ else ()
     message(FATAL_ERROR "WebKitGTK not installed / unknown version detected")
 endif ()
 
+if (GTK312X_FOUND)
+    message(STATUS "GTK+ 3.12 support: ON")
+    
+    set(EXTRA_VALA_OPTIONS
+        ${EXTRA_VALA_OPTIONS}
+        -D GTK_3_12
+    )
+endif ()
+
 if (NO_FATAL_WARNINGS)
     message(STATUS "Vala fatal warnings: OFF")
 else ()
diff --git a/src/client/components/main-toolbar.vala b/src/client/components/main-toolbar.vala
index 34e9894..07c60c9 100644
--- a/src/client/components/main-toolbar.vala
+++ b/src/client/components/main-toolbar.vala
@@ -68,10 +68,10 @@ public class MainToolbar : PillHeaderbar {
         insert.clear();
         insert.add(archive_button = create_toolbar_button(null, GearyController.ACTION_ARCHIVE_MESSAGE, 
true));
         insert.add(trash_buttons[0] = create_toolbar_button(null, GearyController.ACTION_TRASH_MESSAGE, 
true));
-        add_end(create_pill_buttons(insert));
+        Gtk.Box trash_archive = create_pill_buttons(insert);
         insert.clear();
         insert.add(trash_buttons[1] = create_toolbar_button(null, GearyController.ACTION_TRASH_MESSAGE, 
true));
-        add_end(create_pill_buttons(insert, false));
+        Gtk.Box trash = create_pill_buttons(insert, false);
         
         // Search bar.
         search_entry.width_chars = 28;
@@ -80,14 +80,20 @@ public class MainToolbar : PillHeaderbar {
         search_entry.key_press_event.connect(on_search_key_press);
         on_search_entry_changed(); // set initial state
         search_entry.has_focus = true;
-        add_end(search_upgrade_progress_bar);
-        add_end(search_entry);
         
         // Search upgrade progress bar.
         search_upgrade_progress_bar.margin_top = 3;
         search_upgrade_progress_bar.margin_bottom = 3;
         search_upgrade_progress_bar.show_text = true;
         
+        // pack_end() ordering is reversed in GtkHeaderBar in 3.12 and above
+#if !GTK_3_12
+        add_end(trash_archive);
+        add_end(trash);
+        add_end(search_upgrade_progress_bar);
+        add_end(search_entry);
+#endif
+        
         // Application button.  If we exported an app menu, we don't need this.
         if (!Gtk.Settings.get_default().gtk_shell_shows_app_menu) {
             insert.clear();
@@ -95,6 +101,14 @@ public class MainToolbar : PillHeaderbar {
             add_end(create_pill_buttons(insert));
         }
         
+        // pack_end() ordering is reversed in GtkHeaderBar in 3.12 and above
+#if GTK_3_12
+        add_end(search_entry);
+        add_end(search_upgrade_progress_bar);
+        add_end(trash);
+        add_end(trash_archive);
+#endif
+        
         set_search_placeholder_text(DEFAULT_SEARCH_TEXT);
     }
     


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