[gnome-clocks/wip/exalm/libhandy-1: 5/10] world: Split standalone view, add a back swipe



commit 91ae7fb9618737c4ac2309a1ec2d93b0b23215af
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue May 26 22:29:21 2020 +0500

    world: Split standalone view, add a back swipe
    
    Introduce World.Standalone, put it into a HdyDeck inside the main window.
    
    This breaks window title when viewing a location, it will be fixed in
    subsequent commits.

 data/gnome-clocks.gresource.xml |   1 +
 data/ui/window.ui               | 110 +++++++++++++++-------------
 data/ui/world.ui                | 137 ----------------------------------
 data/ui/worldstandalone.ui      | 158 ++++++++++++++++++++++++++++++++++++++++
 src/meson.build                 |   3 +-
 src/window.vala                 |  36 +++++++--
 src/world-standalone.vala       |  72 ++++++++++++++++++
 src/world.vala                  |  65 +----------------
 8 files changed, 326 insertions(+), 256 deletions(-)
---
diff --git a/data/gnome-clocks.gresource.xml b/data/gnome-clocks.gresource.xml
index 3f03601..13b5937 100644
--- a/data/gnome-clocks.gresource.xml
+++ b/data/gnome-clocks.gresource.xml
@@ -8,6 +8,7 @@
     <file preprocess="xml-stripblanks">ui/headerbar.ui</file>
     <file preprocess="xml-stripblanks">ui/worldlocationdialog.ui</file>
     <file preprocess="xml-stripblanks">ui/world.ui</file>
+    <file preprocess="xml-stripblanks">ui/worldstandalone.ui</file>
     <file preprocess="xml-stripblanks">ui/worldtile.ui</file>
     <file preprocess="xml-stripblanks">ui/alarmringing.ui</file>
     <file preprocess="xml-stripblanks">ui/alarmrow.ui</file>
diff --git a/data/ui/window.ui b/data/ui/window.ui
index 09dda47..6038e68 100644
--- a/data/ui/window.ui
+++ b/data/ui/window.ui
@@ -6,76 +6,86 @@
   <template class="ClocksWindow" parent="HdyApplicationWindow">
     <property name="title" bind-source="header_bar" bind-property="title" bind-flags="sync-create" />
     <child>
-      <object class="GtkBox">
+      <object class="HdyDeck" id="world_deck">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="orientation">vertical</property>
+        <property name="can-swipe-back">True</property>
         <child>
-          <object class="ClocksHeaderBar" id="header_bar">
-            <property name="visible">True</property>
-            <property name="stack">stack</property>
-            <property name="switcher_bar">switcher_bar</property>
-            <style>
-              <class name="titlebar"/>
-            </style>
-          </object>
-        </child>
-        <child>
-          <object class="GtkStack" id="stack">
+          <object class="GtkBox" id="main_view">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="hexpand">True</property>
-            <property name="vexpand">True</property>
-            <property name="homogeneous">True</property>
-            <signal name="notify::visible-child" handler="pane_changed" swapped="no"/>
+            <property name="orientation">vertical</property>
             <child>
-              <object class="ClocksWorldFace" id="world">
+              <object class="ClocksHeaderBar" id="header_bar">
                 <property name="visible">True</property>
+                <property name="stack">stack</property>
+                <property name="switcher_bar">switcher_bar</property>
+                <style>
+                  <class name="titlebar"/>
+                </style>
               </object>
-              <packing>
-                <property name="name">world</property>
-                <property name="title" translatable="yes">World</property>
-                <property name="icon-name">globe-symbolic</property>
-              </packing>
             </child>
             <child>
-              <object class="ClocksAlarmFace" id="alarm">
+              <object class="GtkStack" id="stack">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="homogeneous">True</property>
+                <signal name="notify::visible-child" handler="pane_changed" swapped="no"/>
+                <child>
+                  <object class="ClocksWorldFace" id="world">
+                    <property name="visible">True</property>
+                  </object>
+                  <packing>
+                    <property name="name">world</property>
+                    <property name="title" translatable="yes">World</property>
+                    <property name="icon-name">globe-symbolic</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="ClocksAlarmFace" id="alarm">
+                    <property name="visible">True</property>
+                  </object>
+                  <packing>
+                    <property name="name">alarm</property>
+                    <property name="title" translatable="yes">Alarms</property>
+                    <property name="icon-name">alarm-symbolic</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="ClocksStopwatchFace" id="stopwatch">
+                    <property name="visible">True</property>
+                  </object>
+                  <packing>
+                    <property name="name">stopwatch</property>
+                    <property name="title" translatable="yes">Stopwatch</property>
+                    <property name="icon-name">stopwatch-symbolic</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="ClocksTimerFace" id="timer">
+                    <property name="visible">True</property>
+                  </object>
+                  <packing>
+                    <property name="name">timer</property>
+                    <property name="title" translatable="yes">Timer</property>
+                    <property name="icon-name">timer-symbolic</property>
+                  </packing>
+                </child>
               </object>
-              <packing>
-                <property name="name">alarm</property>
-                <property name="title" translatable="yes">Alarms</property>
-                <property name="icon-name">alarm-symbolic</property>
-              </packing>
             </child>
             <child>
-              <object class="ClocksStopwatchFace" id="stopwatch">
+              <object class="HdyViewSwitcherBar" id="switcher_bar">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="stack">stack</property>
               </object>
-              <packing>
-                <property name="name">stopwatch</property>
-                <property name="title" translatable="yes">Stopwatch</property>
-                <property name="icon-name">stopwatch-symbolic</property>
-              </packing>
-            </child>
-            <child>
-              <object class="ClocksTimerFace" id="timer">
-                <property name="visible">True</property>
-              </object>
-              <packing>
-                <property name="name">timer</property>
-                <property name="title" translatable="yes">Timer</property>
-                <property name="icon-name">timer-symbolic</property>
-              </packing>
             </child>
           </object>
         </child>
         <child>
-          <object class="HdyViewSwitcherBar" id="switcher_bar">
+          <object class="ClocksWorldStandalone" id="world_standalone">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="stack">stack</property>
-            <property name="reveal">True</property>
           </object>
         </child>
       </object>
diff --git a/data/ui/world.ui b/data/ui/world.ui
index 9d07156..d2c978d 100644
--- a/data/ui/world.ui
+++ b/data/ui/world.ui
@@ -5,7 +5,6 @@
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="homogeneous">False</property>
-    <signal name="notify::visible-child" handler="visible_child_changed" swapped="no"/>
     <child>
       <object class="GtkGrid" id="empty_view">
         <property name="visible">True</property>
@@ -67,141 +66,5 @@
         </child>
       </object>
     </child>
-    <child>
-      <object class="GtkGrid" id="standalone">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <child>
-          <object class="GtkGrid" id="grid2">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="halign">center</property>
-            <property name="valign">center</property>
-            <property name="margin_start">34</property>
-            <property name="margin_end">34</property>
-            <property name="margin_bottom">12</property>
-            <property name="hexpand">True</property>
-            <property name="vexpand">True</property>
-            <child>
-              <object class="GtkLabel" id="dummy_label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label">  </property>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="standalone_time_label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="justify">center</property>
-                <property name="wrap">True</property>
-                <attributes>
-                  <attribute name="font-features" value="tnum=1"/>
-                </attributes>
-                <style>
-                  <class name="clocks-standalone-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="standalone_day_label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <style>
-                  <class name="clocks-secondary-standalone-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">2</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkGrid" id="grid3">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="halign">center</property>
-            <property name="margin_bottom">24</property>
-            <property name="column_spacing">12</property>
-            <style>
-              <class name="clocks-secondary-standalone-label"/>
-            </style>
-            <child>
-              <object class="GtkLabel" id="label3">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Sunrise</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label4">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Sunset</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="standalone_sunrise_label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label">label</property>
-                <attributes>
-                  <attribute name="font-features" value="tnum=1"/>
-                </attributes>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="standalone_sunset_label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <attributes>
-                  <attribute name="font-features" value="tnum=1"/>
-                </attributes>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">1</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">1</property>
-          </packing>
-        </child>
-      </object>
-    </child>
   </template>
 </interface>
diff --git a/data/ui/worldstandalone.ui b/data/ui/worldstandalone.ui
new file mode 100644
index 0000000..46667d7
--- /dev/null
+++ b/data/ui/worldstandalone.ui
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="3.18"/>
+  <template class="ClocksWorldStandalone" parent="GtkBox">
+    <property name="can_focus">False</property>
+    <property name="orientation">vertical</property>
+    <signal name="notify::location" handler="location_changed"/>
+    <child>
+      <object class="HdyHeaderBar">
+        <property name="visible">True</property>
+        <property name="show-close-button">True</property>
+        <property name="title" bind-source="ClocksWorldStandalone" bind-property="title" 
bind-flags="sync-create" />
+        <property name="subtitle" bind-source="ClocksWorldStandalone" bind-property="subtitle" 
bind-flags="sync-create" />
+        <style>
+          <class name="titlebar"/>
+        </style>
+        <child>
+          <object class="GtkButton">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="action_name">win.back</property>
+            <property name="tooltip-text" translatable="yes">Back</property>
+            <child>
+              <object class="GtkImage">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="icon_name">go-previous-symbolic</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkGrid">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="halign">center</property>
+        <property name="valign">center</property>
+        <property name="margin_start">34</property>
+        <property name="margin_end">34</property>
+        <property name="margin_bottom">12</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">True</property>
+        <child>
+          <object class="GtkLabel" id="dummy_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label">  </property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="time_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="justify">center</property>
+            <property name="wrap">True</property>
+            <attributes>
+              <attribute name="font-features" value="tnum=1"/>
+            </attributes>
+            <style>
+              <class name="clocks-standalone-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="day_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <style>
+              <class name="clocks-secondary-standalone-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkGrid">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="halign">center</property>
+        <property name="margin_bottom">24</property>
+        <property name="column_spacing">12</property>
+        <style>
+          <class name="clocks-secondary-standalone-label"/>
+        </style>
+        <child>
+          <object class="GtkLabel" id="label3">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Sunrise</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label4">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Sunset</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="sunrise_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label">label</property>
+            <attributes>
+              <attribute name="font-features" value="tnum=1"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="sunset_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <attributes>
+              <attribute name="font-features" value="tnum=1"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/src/meson.build b/src/meson.build
index 7e08e15..4e782a4 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -15,7 +15,8 @@ clocks_vala_sources = [
   'utils.vala',
   'widgets.vala',
   'window.vala',
-  'world.vala'
+  'world.vala',
+  'world-standalone.vala'
 ]
 
 clocks_c_sources = [
diff --git a/src/window.vala b/src/window.vala
index d13c562..0a36d27 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -32,12 +32,18 @@ public class Window : Hdy.ApplicationWindow {
     [GtkChild]
     private HeaderBar header_bar;
     [GtkChild]
+    private Hdy.Deck world_deck;
+    [GtkChild]
+    private Gtk.Box main_view;
+    [GtkChild]
     private Gtk.Stack stack;
     [GtkChild]
     private World.Face world;
     [GtkChild]
     private Alarm.Face alarm;
     [GtkChild]
+    private World.Standalone world_standalone;
+    [GtkChild]
     private Stopwatch.Face stopwatch;
     [GtkChild]
     private Timer.Face timer;
@@ -84,8 +90,14 @@ public class Window : Hdy.ApplicationWindow {
         settings.get ("size", "(ii)", out width, out height);
         resize (width, height);
 
+        world.show_standalone.connect ((w, l) => {
+            stack.visible_child = w;
+            world_standalone.location = l;
+            world_deck.navigate (Hdy.NavigationDirection.FORWARD);
+        });
+
         alarm.ring.connect ((w) => {
-            world.reset_view ();
+            close_standalone ();
             stack.visible_child = w;
         });
 
@@ -94,7 +106,7 @@ public class Window : Hdy.ApplicationWindow {
         });
 
         timer.ring.connect ((w) => {
-            world.reset_view ();
+            close_standalone ();
             stack.visible_child = w;
         });
 
@@ -180,11 +192,15 @@ public class Window : Hdy.ApplicationWindow {
     }
 
     private void on_back_activate () {
-        ((Clock) stack.visible_child).activate_back ();
+        if (world_deck.visible_child == main_view) {
+            ((Clock) stack.visible_child).activate_back ();
+        } else {
+            world_deck.navigate (Hdy.NavigationDirection.BACK);
+        }
     }
 
     public void show_world () {
-        world.reset_view ();
+        close_standalone ();
         stack.visible_child = world;
     }
 
@@ -197,7 +213,11 @@ public class Window : Hdy.ApplicationWindow {
         bool handled = false;
 
         if (((Gdk.Event)(event)).get_keyval (out keyval) && keyval == Gdk.Key.Escape) {
-            handled = ((Clock) stack.visible_child).escape_pressed ();
+            if (world_deck.visible_child == main_view) {
+                handled = ((Clock) stack.visible_child).escape_pressed ();
+            } else {
+                world_deck.navigate (Hdy.NavigationDirection.BACK);
+            }
         }
 
         if (handled) {
@@ -212,7 +232,7 @@ public class Window : Hdy.ApplicationWindow {
         uint button;
 
         if (((Gdk.Event) (event)).get_button (out button) && button == BUTTON_BACK) {
-            ((Clock) stack.visible_child).activate_back ();
+            on_back_activate ();
             return true;
         }
 
@@ -339,6 +359,10 @@ public class Window : Hdy.ApplicationWindow {
 
         stack.visible_child.grab_focus ();
     }
+
+    private void close_standalone () {
+        world_deck.visible_child = main_view;
+    }
 }
 
 } // namespace Clocks
diff --git a/src/world-standalone.vala b/src/world-standalone.vala
new file mode 100644
index 0000000..5ad78ac
--- /dev/null
+++ b/src/world-standalone.vala
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2013  Paolo Borelli <pborelli gnome org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+namespace Clocks {
+namespace World {
+
+[GtkTemplate (ui = "/org/gnome/clocks/ui/worldstandalone.ui")]
+public class Standalone : Gtk.Box {
+    public string title { get; set; default = _("Clocks"); }
+    public string subtitle { get; set; }
+    public Item? location { get; set; }
+
+    [GtkChild]
+    private Gtk.Label time_label;
+    [GtkChild]
+    private Gtk.Label day_label;
+    [GtkChild]
+    private Gtk.Label sunrise_label;
+    [GtkChild]
+    private Gtk.Label sunset_label;
+
+    construct {
+        // Start ticking...
+        Utils.WallClock.get_default ().tick.connect (update);
+    }
+
+    private void update () {
+        if (location != null) {
+            time_label.label = ((Item) location).time_label;
+            day_label.label = (string) ((Item) location).day_label;
+            sunrise_label.label = ((Item) location).sunrise_label;
+            sunset_label.label = ((Item) location).sunset_label;
+        }
+    }
+
+    [GtkCallback]
+    private void location_changed () {
+        if (location == null) {
+            return;
+        }
+
+        update ();
+
+        var item = (Item) location;
+
+        if (item.state_name != null) {
+            title = "%s, %s".printf (item.city_name, (string) item.state_name);
+        } else {
+            title = item.city_name;
+        }
+
+        subtitle = (string) item.country_name;
+    }
+}
+
+} // namespace World
+} // namespace Clocks
diff --git a/src/world.vala b/src/world.vala
index 29eb540..ec3b239 100644
--- a/src/world.vala
+++ b/src/world.vala
@@ -591,6 +591,8 @@ private class LocationDialog : Gtk.Dialog {
 
 [GtkTemplate (ui = "/org/gnome/clocks/ui/world.ui")]
 public class Face : Gtk.Stack, Clocks.Clock {
+    public signal void show_standalone (Item location);
+
     public PanelId panel_id { get; construct set; }
     public ButtonMode button_mode { get; set; default = NEW; }
     public ViewMode view_mode { get; set; default = NORMAL; }
@@ -601,23 +603,12 @@ public class Face : Gtk.Stack, Clocks.Clock {
 
     private ContentStore locations;
     private GLib.Settings settings;
-    private Item? standalone_location;
     [GtkChild]
     private Gtk.Widget empty_view;
     [GtkChild]
     private Gtk.ScrolledWindow list_view;
     [GtkChild]
     private Gtk.ListBox listbox;
-    [GtkChild]
-    private Gtk.Widget standalone;
-    [GtkChild]
-    private Gtk.Label standalone_time_label;
-    [GtkChild]
-    private Gtk.Label standalone_day_label;
-    [GtkChild]
-    private Gtk.Label standalone_sunrise_label;
-    [GtkChild]
-    private Gtk.Label standalone_sunset_label;
 
     construct {
         panel_id = WORLD;
@@ -666,7 +657,6 @@ public class Face : Gtk.Stack, Clocks.Clock {
             });
             // TODO Only need to queue what changed
             listbox.queue_draw ();
-            update_standalone ();
         });
     }
 
@@ -675,40 +665,6 @@ public class Face : Gtk.Stack, Clocks.Clock {
         show_standalone (((Tile) row).location);
     }
 
-    [GtkCallback]
-    private void visible_child_changed () {
-        if (visible_child == empty_view || visible_child == list_view) {
-            view_mode = NORMAL;
-            button_mode = NEW;
-            title = _("Clocks");
-            subtitle = (string) null;
-        } else if (visible_child == standalone) {
-            view_mode = STANDALONE;
-            button_mode = BACK;
-        }
-    }
-
-    private void update_standalone () {
-        if (standalone_location != null) {
-            standalone_time_label.label = ((Item) standalone_location).time_label;
-            standalone_day_label.label = (string) ((Item) standalone_location).day_label;
-            standalone_sunrise_label.label = ((Item) standalone_location).sunrise_label;
-            standalone_sunset_label.label = ((Item) standalone_location).sunset_label;
-        }
-    }
-
-    private void show_standalone (Item location) {
-        standalone_location = location;
-        update_standalone ();
-        visible_child = standalone;
-        if (location.state_name != null) {
-            title = "%s, %s".printf (location.city_name, (string) location.state_name);
-        } else {
-            title = location.city_name;
-        }
-        subtitle = (string) location.country_name;
-    }
-
     private void load () {
         locations.deserialize (settings.get_value ("world-clocks"), Item.deserialize);
     }
@@ -775,22 +731,7 @@ public class Face : Gtk.Stack, Clocks.Clock {
         dialog.show ();
     }
 
-    public void activate_back () {
-        reset_view ();
-    }
-
-
-    public bool escape_pressed () {
-        if (visible_child == standalone) {
-            reset_view ();
-            return true;
-        }
-
-        return false;
-    }
-
-    public void reset_view () {
-        standalone_location = null;
+    private void reset_view () {
         visible_child = locations.get_n_items () == 0 ? empty_view : list_view;
     }
 }


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