[gnome-break-timer] Fixed OverlayArrow blocking buttons in some cases.



commit ee03996a562a121cd3e4804aa64f52162cae59e5
Author: Dylan McCall <dylanmccall ubuntu com>
Date:   Wed Sep 18 21:56:38 2013 -0700

    Fixed OverlayArrow blocking buttons in some cases.
    
    This is achieved by splitting interactive and non-interactive parts of our welcome slideshow into 
different rows of an all-encompassing grid. It's ugly, and hard to keep track of, but it works. We can make 
it nicer when Glade can do GtkOverlay.

 data/settings-panels.ui    |  402 +++++++++++++++++++++-----------------------
 settings/MainWindow.vala   |   33 +++--
 settings/OverlayArrow.vala |    3 +
 3 files changed, 218 insertions(+), 220 deletions(-)
---
diff --git a/data/settings-panels.ui b/data/settings-panels.ui
index 92254d5..8ec8b72 100644
--- a/data/settings-panels.ui
+++ b/data/settings-panels.ui
@@ -5,6 +5,8 @@
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="valign">center</property>
+    <property name="margin_left">30</property>
+    <property name="margin_right">30</property>
     <property name="margin_top">20</property>
     <property name="margin_bottom">20</property>
     <property name="row_spacing">12</property>
@@ -66,6 +68,8 @@
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="valign">center</property>
+    <property name="margin_left">30</property>
+    <property name="margin_right">30</property>
     <property name="margin_top">20</property>
     <property name="margin_bottom">20</property>
     <property name="row_spacing">12</property>
@@ -122,68 +126,27 @@
       </packing>
     </child>
   </object>
-  <object class="GtkGrid" id="welcome_breaks">
+  <object class="GtkAlignment" id="welcome_breaks">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="margin_top">50</property>
-    <property name="margin_bottom">30</property>
-    <property name="row_spacing">16</property>
     <child>
-      <object class="GtkLabel" id="settings_label">
+      <object class="GtkGrid" id="welcome_breaks_inner">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="halign">center</property>
-        <property name="valign">end</property>
-        <property name="margin_top">50</property>
-        <property name="xpad">20</property>
-        <property name="label" translatable="yes">You can change the types of breaks and their timings from 
the settings</property>
-        <style>
-          <class name="_break-status-hint"/>
-        </style>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">1</property>
-        <property name="width">1</property>
-        <property name="height">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkButton" id="welcome_breaks_ok_button">
-        <property name="label" translatable="yes">OK, got it!</property>
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="receives_default">True</property>
-        <property name="halign">center</property>
-        <property name="valign">center</property>
-        <property name="hexpand">True</property>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">2</property>
-        <property name="width">1</property>
-        <property name="height">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkGrid" id="grid2">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="valign">center</property>
         <property name="margin_left">85</property>
         <property name="margin_right">85</property>
-        <property name="hexpand">True</property>
-        <property name="vexpand">True</property>
-        <property name="row_spacing">16</property>
+        <property name="margin_top">30</property>
+        <property name="row_spacing">50</property>
         <child>
-          <object class="GtkLabel" id="label2">
+          <object class="GtkLabel" id="settings_label">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="hexpand">True</property>
-            <property name="ypad">4</property>
-            <property name="label" translatable="yes">Break Timer lets you take small microbreaks as well as 
longer breaks.</property>
+            <property name="halign">center</property>
+            <property name="valign">end</property>
+            <property name="xpad">20</property>
+            <property name="label" translatable="yes">You can change the types of breaks and their timings 
from the settings</property>
             <style>
-              <class name="_break-status-body"/>
+              <class name="_break-status-hint"/>
             </style>
           </object>
           <packing>
@@ -194,50 +157,83 @@
           </packing>
         </child>
         <child>
-          <object class="GtkLabel" id="label3">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="hexpand">True</property>
-            <property name="ypad">4</property>
-            <property name="label" translatable="yes">Microbreaks are a chance to look away from the screen 
and rest your hands.</property>
-            <style>
-              <class name="_break-status-body"/>
-            </style>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">2</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label4">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="hexpand">True</property>
-            <property name="ypad">4</property>
-            <property name="label" translatable="yes">Full breaks are time to get away from the computer and 
move around.</property>
-            <style>
-              <class name="_break-status-body"/>
-            </style>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">3</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label1">
+          <object class="GtkGrid" id="grid2">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="valign">center</property>
             <property name="hexpand">True</property>
-            <property name="label" translatable="yes">Breaks and Microbreaks</property>
-            <style>
-              <class name="_break-status-heading"/>
-            </style>
+            <property name="vexpand">True</property>
+            <property name="row_spacing">16</property>
+            <child>
+              <object class="GtkLabel" id="label2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="ypad">4</property>
+                <property name="label" translatable="yes">Break Timer lets you take small microbreaks as 
well as longer breaks.</property>
+                <style>
+                  <class name="_break-status-body"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="ypad">4</property>
+                <property name="label" translatable="yes">Microbreaks are a chance to look away from the 
screen and rest your hands.</property>
+                <style>
+                  <class name="_break-status-body"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">2</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label4">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="label" translatable="yes">Full breaks are time to get away from the computer 
and move around.</property>
+                <style>
+                  <class name="_break-status-body"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">3</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="label" translatable="yes">Breaks and Microbreaks</property>
+                <style>
+                  <class name="_break-status-heading"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -247,56 +243,61 @@
           </packing>
         </child>
       </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">0</property>
-        <property name="width">1</property>
-        <property name="height">1</property>
-      </packing>
     </child>
   </object>
-  <object class="GtkGrid" id="welcome_ready">
+  <object class="GtkAlignment" id="welcome_ready">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="margin_top">50</property>
-    <property name="margin_bottom">30</property>
-    <property name="row_spacing">16</property>
     <child>
-      <object class="GtkButton" id="welcome_ready_ok_button">
-        <property name="label" translatable="yes">Ready to go</property>
+      <object class="GtkGrid" id="welcome_ready_inner">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="receives_default">True</property>
-        <property name="halign">center</property>
-        <property name="valign">center</property>
-        <property name="margin_top">50</property>
-        <property name="hexpand">True</property>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">1</property>
-        <property name="width">1</property>
-        <property name="height">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkGrid" id="grid8">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="valign">center</property>
         <property name="margin_left">85</property>
         <property name="margin_right">85</property>
-        <property name="vexpand">True</property>
+        <property name="margin_top">30</property>
         <property name="row_spacing">16</property>
         <child>
-          <object class="GtkLabel" id="label6">
+          <object class="GtkGrid" id="grid8">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="hexpand">True</property>
-            <property name="label" translatable="yes">You can leave me to it</property>
-            <style>
-              <class name="_break-status-heading"/>
-            </style>
+            <property name="valign">center</property>
+            <property name="vexpand">True</property>
+            <property name="row_spacing">16</property>
+            <child>
+              <object class="GtkLabel" id="label6">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="label" translatable="yes">You can leave me to it</property>
+                <style>
+                  <class name="_break-status-heading"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="keeps_running_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">center</property>
+                <property name="xpad">20</property>
+                <property name="label" translatable="yes">Break Timer will carry on working in the 
background, even if you close it.</property>
+                <style>
+                  <class name="_break-status-body"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -305,110 +306,93 @@
             <property name="height">1</property>
           </packing>
         </child>
-        <child>
-          <object class="GtkLabel" id="keeps_running_label">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="halign">center</property>
-            <property name="xpad">20</property>
-            <property name="label" translatable="yes">Break Timer will carry on working in the background, 
even if you close it.</property>
-            <style>
-              <class name="_break-status-body"/>
-            </style>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">1</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
       </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">0</property>
-        <property name="width">1</property>
-        <property name="height">1</property>
-      </packing>
     </child>
   </object>
-  <object class="GtkGrid" id="welcome_start">
+  <object class="GtkAlignment" id="welcome_start">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="margin_top">50</property>
-    <property name="margin_bottom">30</property>
-    <property name="row_spacing">16</property>
     <child>
-      <object class="GtkGrid" id="grid7">
+      <object class="GtkGrid" id="welcome_start_inner">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="valign">center</property>
         <property name="margin_left">85</property>
         <property name="margin_right">85</property>
-        <property name="vexpand">True</property>
+        <property name="margin_top">30</property>
         <property name="row_spacing">16</property>
         <child>
-          <object class="GtkLabel" id="label8">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="hexpand">True</property>
-            <property name="label" translatable="yes">Welcome to Break Timer!</property>
-            <style>
-              <class name="_break-status-heading"/>
-            </style>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">0</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label9">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="hexpand">True</property>
-            <property name="label" translatable="yes">Breaks are good for you. We'll help you to take 
them.</property>
-            <style>
-              <class name="_break-status-body"/>
-            </style>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">1</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="switch_on_label">
+          <object class="GtkGrid" id="grid7">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="halign">center</property>
             <property name="valign">center</property>
-            <property name="margin_top">50</property>
+            <property name="margin_left">85</property>
+            <property name="margin_right">85</property>
             <property name="vexpand">True</property>
-            <property name="xpad">20</property>
-            <property name="label" translatable="yes">Just switch me on to get started</property>
-            <style>
-              <class name="_break-status-hint"/>
-            </style>
+            <property name="row_spacing">16</property>
+            <child>
+              <object class="GtkLabel" id="label8">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="label" translatable="yes">Welcome to Break Timer!</property>
+                <style>
+                  <class name="_break-status-heading"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label9">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="label" translatable="yes">Breaks are good for you. We'll help you to take 
them.</property>
+                <style>
+                  <class name="_break-status-body"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="switch_on_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">center</property>
+                <property name="valign">center</property>
+                <property name="margin_top">50</property>
+                <property name="vexpand">True</property>
+                <property name="xpad">20</property>
+                <property name="label" translatable="yes">Just switch me on to get started</property>
+                <style>
+                  <class name="_break-status-hint"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">2</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="left_attach">0</property>
-            <property name="top_attach">2</property>
+            <property name="top_attach">0</property>
             <property name="width">1</property>
             <property name="height">1</property>
           </packing>
         </child>
       </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">0</property>
-        <property name="width">1</property>
-        <property name="height">1</property>
-      </packing>
     </child>
   </object>
 </interface>
diff --git a/settings/MainWindow.vala b/settings/MainWindow.vala
index 8651392..384518f 100644
--- a/settings/MainWindow.vala
+++ b/settings/MainWindow.vala
@@ -85,8 +85,6 @@ public class MainWindow : Gtk.ApplicationWindow {
                this.main_stack = new Stack ();
                content.add (this.main_stack);
                main_stack.set_margin_top (6);
-               main_stack.set_margin_right (20);
-               main_stack.set_margin_left (20);
                main_stack.set_margin_bottom (6);
 
                this.status_panel = new StatusPanel (break_manager, builder);
@@ -119,6 +117,8 @@ public class MainWindow : Gtk.ApplicationWindow {
        private void break_added_cb (BreakType break_type) {
                var info_panel = break_type.info_panel;
                this.main_stack.add (info_panel);
+               info_panel.set_margin_left (20);
+               info_panel.set_margin_right (20);
                info_panel.set_halign (Gtk.Align.CENTER);
                info_panel.set_valign (Gtk.Align.CENTER);
        }
@@ -179,9 +179,9 @@ private class WelcomePanel : Stack {
        }
        private Step current_step;
 
-       private Gtk.Widget start_page;
-       private Gtk.Widget breaks_page;
-       private Gtk.Widget ready_page;
+       private Gtk.Container start_page;
+       private Gtk.Container breaks_page;
+       private Gtk.Container ready_page;
 
        public WelcomePanel (BreakManager break_manager, Gtk.Builder builder, MainWindow main_window) {
                Object ();
@@ -209,10 +209,14 @@ private class WelcomePanel : Stack {
                        builder, "welcome_ready", "keeps_running_label", main_window.get_close_button ());
                this.add (this.ready_page);
 
-               var breaks_ok_button = builder.get_object ("welcome_breaks_ok_button") as Gtk.Button;
+               var breaks_ok_button = new Gtk.Button.with_label (_("OK, got it!"));
+               breaks_ok_button.set_halign (Gtk.Align.CENTER);
+               this.breaks_page.add (breaks_ok_button);
                breaks_ok_button.clicked.connect (this.on_breaks_confirmed);
 
-               var ready_ok_button = builder.get_object ("welcome_ready_ok_button") as Gtk.Button;
+               var ready_ok_button = new Gtk.Button.with_label (_("Ready to go"));
+               ready_ok_button.set_halign (Gtk.Align.CENTER);
+               this.ready_page.add (ready_ok_button);
                ready_ok_button.clicked.connect (this.on_ready_confirmed);
 
                break_manager.notify["master-enabled"].connect (this.on_master_switch_toggled);
@@ -238,15 +242,20 @@ private class WelcomePanel : Stack {
                }
        }
 
-       private Gtk.Widget build_page_with_arrow (Gtk.Builder builder, string page_name, string? 
arrow_source_name, Gtk.Widget? arrow_target) {
-               Gtk.Overlay page_wrapper = new Gtk.Overlay ();
+       private Gtk.Container build_page_with_arrow (Gtk.Builder builder, string page_name, string? 
arrow_source_name, Gtk.Widget? arrow_target) {
+               Gtk.Grid page_wrapper = new Gtk.Grid ();
+               page_wrapper.set_orientation (Gtk.Orientation.VERTICAL);
+               page_wrapper.set_row_spacing (16);
+               page_wrapper.set_margin_bottom (30);
 
-               page_wrapper.add (builder.get_object (page_name) as Gtk.Widget);
+               Gtk.Overlay page_overlay = new Gtk.Overlay ();
+               page_wrapper.add (page_overlay);
 
+               page_overlay.add (builder.get_object (page_name) as Gtk.Widget);
                Gtk.Widget arrow_source = builder.get_object (arrow_source_name) as Gtk.Widget;
                if (arrow_source != null && arrow_target != null) {
                        var arrow = new OverlayArrow (arrow_source, arrow_target);
-                       page_wrapper.add_overlay (arrow);
+                       page_overlay.add_overlay (arrow);
                }
 
                return page_wrapper;
@@ -318,7 +327,9 @@ private class StatusPanel : Stack {
                var status_panel = break_type.status_panel;
                this.breaks_list.add (status_panel);
                status_panel.set_margin_top (18);
+               status_panel.set_margin_right (20);
                status_panel.set_margin_bottom (18);
+               status_panel.set_margin_left (20);
        }
 
        private void status_changed_cb () {
diff --git a/settings/OverlayArrow.vala b/settings/OverlayArrow.vala
index f373c35..1377336 100644
--- a/settings/OverlayArrow.vala
+++ b/settings/OverlayArrow.vala
@@ -24,6 +24,9 @@ public class OverlayArrow : Gtk.Widget {
                Object ();
                this.set_has_window (false);
 
+               this.set_halign (Gtk.Align.FILL);
+               this.set_valign (Gtk.Align.FILL);
+
                this.from_widget = from_widget;
                this.to_widget = to_widget;
        }



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