[gnome-clocks/wip/exalm/libhandy-1: 11/19] window: Update window title for the new subscreens



commit 0f9ff0eb99a34b31da84de598bcf1f489e8d6831
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Sat May 23 01:02:58 2020 +0500

    window: Update window title for the new subscreens
    
    Since the subscreens are now a part of the window instead of their
    respective views, binding the title is no longer useful. Instead,
    reimplement it in a less generic way for these views specifically.

 data/ui/window.ui |  2 ++
 src/window.vala   | 11 +++++++++++
 2 files changed, 13 insertions(+)
---
diff --git a/data/ui/window.ui b/data/ui/window.ui
index f8b392d..5792f72 100644
--- a/data/ui/window.ui
+++ b/data/ui/window.ui
@@ -11,6 +11,7 @@
         <property name="orientation">vertical</property>
         <property name="visible-child">world_deck</property>
         <property name="transition-type">under</property>
+        <signal name="notify::visible-child" handler="visible_child_changed"/>
         <child>
           <object class="ClocksAlarmRingingPanel" id="alarm_ringing_panel">
             <property name="visible">True</property>
@@ -21,6 +22,7 @@
           <object class="HdyDeck" id="world_deck">
             <property name="visible">True</property>
             <property name="can-swipe-back">True</property>
+            <signal name="notify::visible-child" handler="visible_child_changed"/>
             <child>
               <object class="GtkBox" id="main_view">
                 <property name="visible">True</property>
diff --git a/src/window.vala b/src/window.vala
index 4c0de84..d3fab36 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -362,6 +362,17 @@ public class Window : Hdy.ApplicationWindow {
         stack.visible_child.grab_focus ();
     }
 
+    [GtkCallback]
+    private void visible_child_changed () {
+        if (alarm_deck.visible_child == alarm_ringing_panel) {
+            title = _("Alarm");
+        } else if (world_deck.visible_child == world_standalone) {
+            title = world_standalone.title;
+        } else {
+            title = _("Clocks");
+        }
+    }
+
     [GtkCallback]
     private void alarm_dismissed () {
         alarm_deck.visible_child = world_deck;


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