[california] Make main window resizable under Unity: Closes bgo#726705



commit 22fd86d2ec3ee862fa1bba3be39f2414b1fce7e5
Author: Jim Nelson <jim yorba org>
Date:   Wed Mar 12 16:48:14 2014 -0700

    Make main window resizable under Unity: Closes bgo#726705
    
    Unity under Trusty 14.04 simply does not allow the application window
    to be resized if a GtkHeaderBar is set as its titlebar.  No
    combination of related sizing properties for GtkWindow seems to
    change this.
    
    So, for Unity, the --enable-unity configure switch must be used.
    This means the main window's decorations will remain.

 configure.ac                   |   27 +++++++++++++++++++++++++++
 src/Makefile.am                |    7 +++++++
 src/host/host-main-window.vala |    9 ++++++++-
 3 files changed, 42 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e4dd944..4b8777f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,9 +38,36 @@ PKG_CHECK_MODULES(CALIFORNIA, \
 AC_SUBST(CALIFORNIA_CFLAGS)
 AC_SUBST(CALIFORNIA_LIBS)
 
+#
+# configure switches
+#
+# Unity support
+#
+
+AC_MSG_CHECKING([Unity support])
+AC_ARG_ENABLE(
+       unity,
+       [  --enable-unity          enable Unity support [[default=disabled]]],
+       [ unity=$enableval ],
+       [ unity=no ]
+)
+
+AC_MSG_RESULT($unity)
+AM_CONDITIONAL(ENABLE_UNITY, test "x$unity" = "xyes")
+
+#
+# /configure switches
+#
+
 AC_CONFIG_FILES([
        Makefile
        src/Makefile
        po/Makefile.in])
 
 AC_OUTPUT
+
+AC_MSG_RESULT([
+Options:
+       Unity support:          $unity
+])
+
diff --git a/src/Makefile.am b/src/Makefile.am
index 44fa9ba..0effdca 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -91,9 +91,16 @@ california_RC = \
        rc/show-event.ui \
        $(NULL)
 
+california_OPTIONAL_VALAFLAGS =
+
+if ENABLE_UNITY
+california_OPTIONAL_VALAFLAGS += --define ENABLE_UNITY
+endif
+
 california_VALAFLAGS = \
        --fatal-warnings -g --enable-checking --vapidir $(top_srcdir)/vapi --target-glib=2.38 \
        --gresources=california-resources.xml \
+       $(california_OPTIONAL_VALAFLAGS) \
        --pkg gtk+-3.0 \
        --pkg gio-2.0 \
        --pkg posix \
diff --git a/src/host/host-main-window.vala b/src/host/host-main-window.vala
index c4d7619..2b002f6 100644
--- a/src/host/host-main-window.vala
+++ b/src/host/host-main-window.vala
@@ -32,8 +32,12 @@ public class MainWindow : Gtk.ApplicationWindow {
         
         // create GtkHeaderBar and pack it in
         Gtk.HeaderBar headerbar = new Gtk.HeaderBar();
+#if !ENABLE_UNITY
+        // Unity doesn't support GtkHeaderBar-as-title-bar very well yet; when set, the main
+        // window can't be resized no matter what additional GtkWindow properties are set
         headerbar.show_close_button = true;
-        set_titlebar (headerbar);
+        set_titlebar(headerbar);
+#endif
         
         bool rtl = get_direction () == Gtk.TextDirection.RTL;
         
@@ -64,6 +68,9 @@ public class MainWindow : Gtk.ApplicationWindow {
         headerbar.pack_end(new_event);
         
         Gtk.Box layout = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
+#if ENABLE_UNITY
+        layout.pack_start(headerbar, false, true, 0);
+#endif
         layout.pack_end(month_view, true, true, 0);
         
         // current host bindings and signals


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