[gnome-weather/wip/ewlsh/gtk4: 25/25] Cleanup.




commit fbb9c4f8729ba0cbbf508f40778298fd663e4969
Author: Evan Welsh <contact evanwelsh com>
Date:   Mon Dec 28 00:34:08 2020 -0600

    Cleanup.

 data/application.css      |  2 --
 data/city.ui              |  2 --
 data/day-entry.ui         | 41 ++---------------------------------------
 data/places-popover.ui    | 34 +++-------------------------------
 data/weather-widget.ui    | 43 +++----------------------------------------
 data/window.ui            | 30 ++++--------------------------
 src/app/city.js           | 11 ++++-------
 src/app/dailyForecast.js  |  8 ++++----
 src/app/hourlyForecast.js | 14 ++++----------
 src/app/main.js           |  2 +-
 src/app/window.js         | 22 ++++++----------------
 src/app/world.js          | 37 ++++++++++++++-----------------------
 12 files changed, 45 insertions(+), 201 deletions(-)
---
diff --git a/data/application.css b/data/application.css
index 84604c6..f301f7a 100644
--- a/data/application.css
+++ b/data/application.css
@@ -96,8 +96,6 @@ viewswitchertitle viewswitcher {
 
 button.osd.circular {
   border-radius: 9999px;
-  /* TODO: GTK4 */
-  /* -gtk-outline-radius: 9999px; */
   min-width: 24px;
   min-height: 24px;
 }
diff --git a/data/city.ui b/data/city.ui
index e017717..0fa661b 100644
--- a/data/city.ui
+++ b/data/city.ui
@@ -7,13 +7,11 @@
         <property name="name">loading</property>
         <property name="child">
           <object class="GtkGrid" id="loading-grid">
-            <property name="can_focus">0</property>
             <property name="orientation">vertical</property>
             <property name="halign">center</property>
             <property name="valign">center</property>
             <child>
               <object class="GtkSpinner" id="spinner">
-                <property name="can_focus">0</property>
                 <property name="height_request">128</property>
                 <property name="width_request">128</property>
               </object>
diff --git a/data/day-entry.ui b/data/day-entry.ui
index 18a4959..3e7766c 100644
--- a/data/day-entry.ui
+++ b/data/day-entry.ui
@@ -2,10 +2,8 @@
 <interface>
   <requires lib="gtk" version="4.0"/>
   <object class="GtkPopoverMenu" id="more_menu">
-    <property name="can_focus">0</property>
     <property name="child">
       <object class="GtkGrid">
-        <property name="can_focus">0</property>
         <property name="row_spacing">8</property>
         <property name="column_spacing">16</property>
         <property name="row_homogeneous">1</property>
@@ -15,7 +13,6 @@
         <property name="margin_end">16</property>
         <child>
           <object class="GtkLabel">
-            <property name="can_focus">0</property>
             <property name="halign">end</property>
             <property name="label" translatable="yes">Night</property>
             <layout>
@@ -26,7 +23,6 @@
         </child>
         <child>
           <object class="GtkLabel">
-            <property name="can_focus">0</property>
             <property name="halign">end</property>
             <property name="label" translatable="yes">Morning</property>
             <layout>
@@ -36,8 +32,7 @@
           </object>
         </child>
         <child>
-          <object class="GtkLabel">
-            <property name="can_focus">0</property>
+          <object class="GtkLabel">  
             <property name="halign">end</property>
             <property name="label" translatable="yes">Afternoon</property>
             <layout>
@@ -48,7 +43,6 @@
         </child>
         <child>
           <object class="GtkLabel">
-            <property name="can_focus">0</property>
             <property name="halign">end</property>
             <property name="label" translatable="yes">Evening</property>
             <layout>
@@ -59,7 +53,6 @@
         </child>
         <child>
           <object class="GtkImage" id="nightImage">
-            <property name="can_focus">0</property>
             <property name="icon_name">weather-showers-symbolic</property>
             <layout>
               <property name="column">1</property>
@@ -69,7 +62,6 @@
         </child>
         <child>
           <object class="GtkImage" id="morningImage">
-            <property name="can_focus">0</property>
             <property name="icon_name">weather-showers-symbolic</property>
             <layout>
               <property name="column">1</property>
@@ -79,7 +71,6 @@
         </child>
         <child>
           <object class="GtkImage" id="afternoonImage">
-            <property name="can_focus">0</property>
             <property name="icon_name">weather-showers-symbolic</property>
             <layout>
               <property name="column">1</property>
@@ -89,7 +80,6 @@
         </child>
         <child>
           <object class="GtkImage" id="eveningImage">
-            <property name="can_focus">0</property>
             <property name="icon_name">weather-showers-symbolic</property>
             <layout>
               <property name="column">1</property>
@@ -99,14 +89,12 @@
         </child>
         <child>
           <object class="GtkGrid">
-            <property name="can_focus">0</property>
             <property name="vexpand">1</property>
             <property name="row_spacing">8</property>
             <property name="row_homogeneous">1</property>
             <property name="column_homogeneous">1</property>
             <child>
               <object class="GtkLabel" id="nightTemperatureLabel">
-                <property name="can_focus">0</property>
                 <property name="label">16°</property>
                 <layout>
                   <property name="column">0</property>
@@ -116,7 +104,6 @@
             </child>
             <child>
               <object class="GtkLabel" id="morningTemperatureLabel">
-                <property name="can_focus">0</property>
                 <property name="label">16°</property>
                 <layout>
                   <property name="column">0</property>
@@ -126,7 +113,6 @@
             </child>
             <child>
               <object class="GtkLabel" id="afternoonTemperatureLabel">
-                <property name="can_focus">0</property>
                 <property name="label">16°</property>
                 <layout>
                   <property name="column">0</property>
@@ -136,7 +122,6 @@
             </child>
             <child>
               <object class="GtkLabel" id="eveningTemperatureLabel">
-                <property name="can_focus">0</property>
                 <property name="label">16°</property>
                 <layout>
                   <property name="column">0</property>
@@ -146,7 +131,6 @@
             </child>
             <child>
               <object class="GtkImage">
-                <property name="can_focus">0</property>
                 <property name="icon_name">weather-windy</property>
                 <layout>
                   <property name="column">0</property>
@@ -156,7 +140,6 @@
             </child>
             <child>
               <object class="GtkImage">
-                <property name="can_focus">0</property>
                 <property name="icon_name">weather-windy</property>
                 <layout>
                   <property name="column">1</property>
@@ -166,7 +149,6 @@
             </child>
             <child>
               <object class="GtkImage">
-                <property name="can_focus">0</property>
                 <property name="icon_name">weather-windy</property>
                 <layout>
                   <property name="column">2</property>
@@ -176,7 +158,6 @@
             </child>
             <child>
               <object class="GtkLabel" id="nightHumidity">
-                <property name="can_focus">0</property>
                 <property name="label">2.1 mm</property>
                 <layout>
                   <property name="column">1</property>
@@ -186,7 +167,6 @@
             </child>
             <child>
               <object class="GtkLabel" id="morningHumidity">
-                <property name="can_focus">0</property>
                 <property name="label">2.1 mm</property>
                 <layout>
                   <property name="column">1</property>
@@ -196,7 +176,6 @@
             </child>
             <child>
               <object class="GtkLabel" id="afternoonHumidity">
-                <property name="can_focus">0</property>
                 <property name="label">2.1 mm</property>
                 <layout>
                   <property name="column">1</property>
@@ -206,7 +185,6 @@
             </child>
             <child>
               <object class="GtkLabel" id="eveningHumidity">
-                <property name="can_focus">0</property>
                 <property name="label">2.1 mm</property>
                 <layout>
                   <property name="column">1</property>
@@ -216,7 +194,6 @@
             </child>
             <child>
               <object class="GtkLabel" id="nightWind">
-                <property name="can_focus">0</property>
                 <property name="label">5 m/s</property>
                 <layout>
                   <property name="column">2</property>
@@ -226,7 +203,6 @@
             </child>
             <child>
               <object class="GtkLabel" id="morningWind">
-                <property name="can_focus">0</property>
                 <property name="label">5 m/s</property>
                 <layout>
                   <property name="column">2</property>
@@ -236,7 +212,6 @@
             </child>
             <child>
               <object class="GtkLabel" id="afternoonWind">
-                <property name="can_focus">0</property>
                 <property name="label">5 m/s</property>
                 <layout>
                   <property name="column">2</property>
@@ -246,7 +221,6 @@
             </child>
             <child>
               <object class="GtkLabel" id="eveningWind">
-                <property name="can_focus">0</property>
                 <property name="label">5 m/s</property>
                 <layout>
                   <property name="column">2</property>
@@ -273,28 +247,24 @@
   <template class="Gjs_DayEntry" parent="GtkBox">
     <property name="width_request">100</property>
     <property name="height_request">200</property>
-    <property name="can_focus">0</property>
     <property name="hexpand">1</property>
     <property name="vexpand">1</property>
     <property name="orientation">vertical</property>
     <property name="spacing">18</property>
     <child>
       <object class="GtkLabel" id="nameLabel">
-        <property name="can_focus">0</property>
         <property name="margin_top">8</property>
         <property name="label">Tues</property>
       </object>
     </child>
     <child>
       <object class="GtkLabel" id="dateLabel">
-        <property name="can_focus">0</property>
         <property name="margin_top">8</property>
         <property name="label">7 June</property>
       </object>
     </child>
     <child>
       <object class="GtkImage" id="image">
-        <property name="can_focus">0</property>
         <property name="valign">start</property>
         <property name="vexpand">1</property>
         <property name="pixel_size">32</property>
@@ -303,14 +273,12 @@
     </child>
     <child>
       <object class="GtkLabel" id="maxTemperatureLabel">
-        <property name="can_focus">0</property>
         <property name="margin_top">8</property>
         <property name="label">18°</property>
       </object>
     </child>
     <child>
       <object class="GtkLabel" id="minTemperatureLabel">
-        <property name="can_focus">0</property>
         <property name="margin_top">8</property>
         <property name="label">9°</property>
       </object>
@@ -318,14 +286,9 @@
     <child>
       <object class="GtkMenuButton">
         <property name="halign">center</property>
+        <property name="icon_name">view-more-symbolic</property>
         <property name="valign">center</property>
         <property name="popover">more_menu</property>
-        <child>
-          <object class="GtkImage">
-            <property name="can_focus">0</property>
-            <property name="icon_name">view-more-symbolic</property>
-          </object>
-        </child>
         <style>
           <class name="image-button"/>
           <class name="circular"/>
diff --git a/data/places-popover.ui b/data/places-popover.ui
index 684a596..2dfc286 100644
--- a/data/places-popover.ui
+++ b/data/places-popover.ui
@@ -2,14 +2,12 @@
 <interface>
   <requires lib="gtk" version="4.0"/>
   <object class="GtkGrid" id="popover-grid">
-    <property name="can_focus">0</property>
     <property name="orientation">vertical</property>
     <property name="row_spacing">10</property>
     <property name="margin-start">12</property>
     <property name="margin-end">12</property>
     <property name="margin-top">12</property>
     <property name="margin-bottom">12</property>
-    <property name="vexpand">0</property>
     <child>
       <object class="GtkEntry" id="location-entry">
         <property name="visible">True</property>
@@ -25,7 +23,6 @@
     <child>
       <object class="GtkStack" id="auto-location-stack">
         <property name="can-focus">0</property>
-        <property name="vexpand">0</property>
         <property name="vhomogeneous">0</property>
         <property name="hhomogeneous">0</property>
         <child>
@@ -33,17 +30,14 @@
             <property name="name">auto-location-switch-grid</property>
             <property name="child">
               <object class="GtkGrid" id="auto-location-grid">
-                <property name="can_focus">0</property>
                 <property name="column_homogeneous">1</property>
                 <property name="margin_top">6</property>
                 <property name="margin_bottom">6</property>
-                <property name="vexpand">0</property>
                 <child>
                   <object class="GtkLabel" id="auto-location-label">
                     <property name="can-focus">0</property>
                     <property name="label" translatable="yes">Automatic Location</property>
                     <property name="halign">start</property>
-                    <property name="vexpand">0</property>
                     <attributes>
                       <attribute name="weight" value="PANGO_WEIGHT_BOLD"></attribute>
                     </attributes>
@@ -59,7 +53,6 @@
                 <child>
                   <object class="GtkSwitch" id="auto-location-switch">
                     <property name="halign">end</property>
-                    <property name="vexpand">0</property>
                     <layout>
                       <property name="column">1</property>
                       <property name="row">0</property>
@@ -79,7 +72,6 @@
                 <property name="label" translatable="yes">Locating…</property>
                 <property name="halign">center</property>
                 <property name="valign">center</property>
-                <property name="vexpand">0</property>
               </object>
             </property>
           </object>
@@ -93,32 +85,24 @@
     <child>
       <object class="GtkStack" id="popover-stack">
         <property name="can-focus">0</property>
-        <property name="vexpand">0</property>
         <property name="vhomogeneous">0</property>
         <property name="hhomogeneous">0</property>
         <child>
-          <object class="GtkStackPage">
-            <property name="name">search-grid</property>
-            <property name="child">
-              <object class="GtkGrid" id="search-grid">
+          <object class="GtkGrid" id="search-grid">
                 <property name="name">search-city-grid</property>
-                <property name="can_focus">0</property>
                 <property name="orientation">vertical</property>
                 <property name="margin_top">25</property>
                 <property name="margin_bottom">25</property>
                 <property name="halign">center</property>
                 <property name="valign">center</property>
                 <property name="row_homogeneous">1</property>
-                <property name="vexpand">0</property>
                 <child>
                   <object class="GtkImage" id="search-image">
-                    <property name="can_focus">0</property>
                     <property name="icon_name">edit-find-symbolic</property>
                     <property name="icon_size">2</property>
                     <property name="use_fallback">1</property>
                     <property name="halign">center</property>
                     <property name="valign">center</property>
-                    <property name="vexpand">0</property>
                     <layout>
                       <property name="column">0</property>
                       <property name="row">0</property>
@@ -131,7 +115,6 @@
                     <property name="label" translatable="yes">Search for a city</property>
                     <property name="halign">center</property>
                     <property name="valign">center</property>
-                    <property name="vexpand">0</property>
                     <style>
                       <class name="dim-label"/>
                     </style>
@@ -141,26 +124,18 @@
                     </layout>
                   </object>
                 </child>
-              </object>
-            </property>
           </object>
         </child>
-        <child>
-          <object class="GtkStackPage">
-            <property name="name">locations-grid</property>
-            <property name="child">
-              <object class="GtkGrid" id="locations-grid">
+        <child>     
+          <object class="GtkGrid" id="locations-grid">
                 <property name="name">locations-grid</property>
-                <property name="can_focus">0</property>
                 <property name="orientation">vertical</property>
                 <property name="row_spacing">10</property>
-                <property name="vexpand">0</property>
                 <child>
                   <object class="GtkLabel" id="recently-viewed-label">
                     <property name="can-focus">0</property>
                     <property name="label" translatable="yes">Viewed Recently</property>
                     <property name="halign">start</property>
-                    <property name="vexpand">0</property>
                     <attributes>
                       <attribute name="weight" value="PANGO_WEIGHT_BOLD"></attribute>
                     </attributes>
@@ -182,7 +157,6 @@
                         <property name="name">locations-list-box</property>
                         <property name="can-focus">0</property>
                         <property name="hexpand">1</property>
-                        <property name="vexpand">0</property>
                         <property name="selection-mode">none</property>
                       </object>
                     </property>
@@ -192,8 +166,6 @@
                     </layout>
                   </object>
                 </child>
-              </object>
-            </property>
           </object>
         </child>
         <layout>
diff --git a/data/weather-widget.ui b/data/weather-widget.ui
index c6450f2..58daf09 100644
--- a/data/weather-widget.ui
+++ b/data/weather-widget.ui
@@ -2,22 +2,17 @@
 <interface>
   <requires lib="gtk" version="4.0"/>
   <template class="Gjs_WeatherWidget" parent="GtkFrame">
-    <property name="can_focus">0</property>
     <property name="child">
       <object class="GtkFrame" id="contentFrame">
         <property name="name">weather-page-content-view</property>
-        <property name="can_focus">0</property>
         <property name="child">
           <object class="GtkGrid" id="outerGrid">
-            <property name="can_focus">0</property>
             <property name="vexpand">1</property>
             <child>
               <object class="GtkOverlay" id="forecast-overlay">
-                <property name="can_focus">0</property>
                 <property name="margin_bottom">24</property>
                 <property name="child">
                   <object class="GtkStack" id="forecastStack">
-                    <property name="can_focus">0</property>
                     <child>
                       <object class="GtkStackPage">
                         <property name="name">hourly</property>
@@ -29,7 +24,6 @@
                             <property name="min_content_width">308</property>
                             <property name="child">
                               <object class="GtkViewport" id="forecast-hourly-viewport">
-                                <property name="can_focus">0</property>
                                 <property name="hscroll_policy">natural</property>
                                 <property name="vscroll_policy">natural</property>
                               </object>
@@ -49,7 +43,6 @@
                             <property name="min_content_width">308</property>
                             <property name="child">
                               <object class="GtkViewport" id="forecast-daily-viewport">
-                                <property name="can_focus">0</property>
                                 <property name="hscroll_policy">natural</property>
                                 <property name="vscroll_policy">natural</property>
                               </object>
@@ -68,7 +61,6 @@
                     <property name="margin_end">28</property>
                     <child>
                       <object class="GtkImage" id="right-image">
-                        <property name="can_focus">0</property>
                         <property name="icon_name">go-next-symbolic</property>
                       </object>
                     </child>
@@ -86,7 +78,6 @@
                     <property name="margin_start">28</property>
                     <child>
                       <object class="GtkImage" id="left-image">
-                        <property name="can_focus">0</property>
                         <property name="icon_name">go-previous-symbolic</property>
                         <property name="icon_size">1</property>
                       </object>
@@ -106,12 +97,10 @@
             <child>
               <object class="GtkGrid" id="inner-grid">
                 <property name="name">conditions-grid</property>
-                <property name="can_focus">0</property>
                 <property name="column_spacing">10</property>
                 <child>
                   <object class="GtkImage" id="conditionsImage">
                     <property name="name">conditions-image</property>
-                    <property name="can_focus">0</property>
                     <property name="halign">start</property>
                     <property name="valign">center</property>
                     <property name="pixel_size">84</property>
@@ -131,27 +120,7 @@
                     <property name="receives_default">1</property>
                     <property name="halign">start</property>
                     <property name="valign">start</property>
-                    <child>
-                      <object class="GtkBox" id="placesBox">
-                        <property name="can_focus">0</property>
-                        <property name="spacing">12</property>
-                        <child>
-                          <object class="GtkLabel" id="placesLabel">
-                            <property name="name">places-label</property>
-                            <property name="wrap">1</property>
-                            <property name="wrap-mode">word-char</property>
-                            <property name="can_focus">0</property>
-                            <property name="label" translatable="yes">Places</property>
-                          </object>
-                        </child>
-                        <child>
-                          <object class="GtkImage" id="placesImage">
-                            <property name="can_focus">0</property>
-                            <property name="icon_name">pan-down-symbolic</property>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
+                    <property name="label" translatable="yes">Places</property>
                     <style>
                       <class name="text-button"/>
                       <class name="flat"/>
@@ -163,16 +132,14 @@
                   </object>
                 </child>
                 <child>
-                  <object class="GtkBox" id="temperatureBox">
-                    <property name="can_focus">0</property>
+                  <object class="GtkBox" id="temperatureBox">   
                     <property name="halign">start</property>
                     <property name="valign">start</property>
                     <property name="spacing">8</property>
                     <property name="baseline_position">bottom</property>
                     <child>
                       <object class="GtkLabel" id="temperatureLabel">
-                        <property name="name">temperature-label</property>
-                        <property name="can_focus">0</property>
+                        <property name="name">temperature-label</property>                   
                         <property name="halign">start</property>
                         <property name="valign">baseline</property>
                       </object>
@@ -180,7 +147,6 @@
                     <child>
                       <object class="GtkLabel" id="apparentLabel">
                         <property name="name">apparent-label</property>
-                        <property name="can_focus">0</property>
                         <property name="halign">start</property>
                         <property name="valign">baseline</property>
                       </object>
@@ -199,14 +165,12 @@
             </child>
             <child>
               <object class="GtkGrid">
-                <property name="can_focus">0</property>
                 <property name="margin_start">18</property>
                 <property name="margin_bottom">20</property>
                 <property name="row_spacing">8</property>
                 <child>
                   <object class="GtkLabel" id="updatedTimeLabel">
                     <property name="name">updated-time-label</property>
-                    <property name="can_focus">0</property>
                     <property name="halign">start</property>
                     <layout>
                       <property name="column">0</property>
@@ -217,7 +181,6 @@
                 <child>
                   <object class="GtkLabel" id="attributionLabel">
                     <property name="name">attribution-label</property>
-                    <property name="can_focus">0</property>
                     <property name="use_markup">1</property>
                     <property name="wrap">1</property>
                     <property name="xalign">0</property>
diff --git a/data/window.ui b/data/window.ui
index b0d1dcd..cb72882 100644
--- a/data/window.ui
+++ b/data/window.ui
@@ -13,13 +13,7 @@
           <object class="GtkButton" id="refresh-button">
             <property name="valign">center</property>
             <property name="action_name">win.refresh</property>
-            <child>
-              <object class="GtkImage" id="refresh-button-image">
-                <property name="can_focus">0</property>
-                <property name="icon_name">view-refresh-symbolic</property>
-                <property name="icon_size">1</property>
-              </object>
-            </child>
+            <property name="icon_name">view-refresh-symbolic</property>
             <style>
               <class name="image-button"/>
             </style>
@@ -31,49 +25,37 @@
             <property name="title" translatable="yes">Weather</property>
           </object>
         </child>
-        <child>
+        <child type="end">
           <object class="GtkMenuButton" id="primary-menu-button">
             <property name="valign">center</property>
-            <child>
-              <object class="GtkImage" id="primary-menu-img">
-                <property name="can_focus">0</property>
-                <property name="icon_name">open-menu-symbolic</property>
-                <property name="icon_size">1</property>
-              </object>
-            </child>
+            <property name="halign">end</property>
+            <property name="icon_name">open-menu-symbolic</property>
             <style>
               <class name="image-button"/>
             </style>
           </object>
-
         </child>
       </object>
     </child>
     <child>
       <object class="GtkGrid" id="main-panel">
-        <property name="can_focus">0</property>
         <property name="orientation">vertical</property>
         <child>
           <object class="GtkStack" id="main-stack">
-            <property name="can_focus">0</property>
             <property name="transition_type">crossfade</property>
             <child>
               <object class="GtkGrid" id="initial-grid">
                 <property name="name">initial-grid</property>
-                <property name="can_focus">0</property>
                 <property name="halign">center</property>
                 <property name="valign">center</property>
                 <property name="margin_top">25</property>
                 <property name="margin_bottom">25</property>
-                <property name="vexpand">0</property>
                 <property name="orientation">vertical</property>
                 <property name="row_homogeneous">1</property>
                 <child>
                   <object class="GtkImage" id="mark-location-image">
-                    <property name="can_focus">0</property>
                     <property name="halign">center</property>
                     <property name="valign">center</property>
-                    <property name="vexpand">0</property>
                     <property name="icon_name">mark-location-symbolic</property>
                     <property name="use_fallback">1</property>
                     <property name="icon_size">2</property>
@@ -85,10 +67,8 @@
                 </child>
                 <child>
                   <object class="GtkLabel" id="search-location-label">
-                    <property name="can_focus">0</property>
                     <property name="halign">center</property>
                     <property name="valign">center</property>
-                    <property name="vexpand">0</property>
                     <property name="label" translatable="yes">Search for a location</property>
                     <layout>
                       <property name="column">0</property>
@@ -98,10 +78,8 @@
                 </child>
                 <child>
                   <object class="GtkLabel" id="search-nereby-location-label">
-                    <property name="can_focus">0</property>
                     <property name="halign">center</property>
                     <property name="valign">center</property>
-                    <property name="vexpand">0</property>
                     <property name="wrap">1</property>
                     <property name="label" translatable="yes">To see weather information, enter the name of 
a city.</property>
                     <layout>
diff --git a/src/app/city.js b/src/app/city.js
index 04d6404..b18daa9 100644
--- a/src/app/city.js
+++ b/src/app/city.js
@@ -37,7 +37,7 @@ const UPDATED_TIME_TIMEOUT = 60; //s
 var WeatherWidget = GObject.registerClass({
     Template: 'resource:///org/gnome/Weather/weather-widget.ui',
     InternalChildren: ['contentFrame', 'outerGrid',
-                       'conditionsImage', 'placesButton', 'placesLabel',
+                       'conditionsImage', 'placesButton',
                        'temperatureLabel', 'apparentLabel',
                        'forecastStack','leftButton', 'rightButton',
                        'forecast-hourly', 'forecast-hourly-viewport',
@@ -195,17 +195,14 @@ var WeatherWidget = GObject.registerClass({
             country = country.get_parent();
 
         if (country)
-            this._placesLabel.set_text(city.get_name() + ', ' + country.get_name());
+            this._placesButton.set_label(city.get_name() + ', ' + country.get_name());
         else
-            this._placesLabel.set_text(city.get_name());
+            this._placesButton.set_label(city.get_name());
 
         this._worldView.refilter();
 
-        // TODO: GTK4
-        //const iconTheme = Gtk.IconTheme.get_for_display(Gdk.Display.get_default());
-        //const icon = iconTheme.lookup_icon(), 84, 0);
         this._conditionsImage.set_from_icon_name(info.get_icon_name());
-        this._conditionsImage.set_icon_size(2);
+        this._conditionsImage.set_pixel_size(84);
 
         const [, tempValue] = info.get_value_temp(GWeather.TemperatureUnit.DEFAULT);
         this._temperatureLabel.label = '%.0f°'.format(tempValue);
diff --git a/src/app/dailyForecast.js b/src/app/dailyForecast.js
index 42e3cc9..06cb86f 100644
--- a/src/app/dailyForecast.js
+++ b/src/app/dailyForecast.js
@@ -30,12 +30,10 @@ var DailyForecastFrame = GObject.registerClass(class DailyForecastFrame extends
             halign: Gtk.Align.START,
             margin_start: 20,
             margin_end: 20,
-        //    shadow_type: Gtk.ShadowType.IN,
             name: 'daily-forecast-frame',
         }, params));
 
-        // this.get_accessible().accessible_name = _('Daily Forecast');
-
+        this.update_property([Gtk.AccessibleProperty.LABEL], [_('Daily Forecast')]);
         this._box = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL,
                                   spacing: 0});
         this.set_child(this._box);
@@ -216,7 +214,9 @@ var DailyForecastFrame = GObject.registerClass(class DailyForecastFrame extends
     }
 
     clear() {
-  //      this._box.foreach(function(w) { w.destroy(); });
+        for (const w of Array.from(this._box)) {
+            this._box.remove(w);
+        }
     }
 });
 
diff --git a/src/app/hourlyForecast.js b/src/app/hourlyForecast.js
index ac385e4..b90e9aa 100644
--- a/src/app/hourlyForecast.js
+++ b/src/app/hourlyForecast.js
@@ -36,16 +36,10 @@ var HourlyForecastFrame = GObject.registerClass(class ForecastFrame extends Gtk.
             halign: Gtk.Align.START,
             margin_start: 20,
             margin_end: 20,
-            // TODO: GTK4
-            // Shadow types have been removed, fix up this styling.
-            // shadow_type: Gtk.ShadowType.IN,
             name: 'hourly-forecast-frame',
         }, params));
 
-        // TODO: GTK4
-        // Adapt to the new a11y APIs
-        // this.get_accessible().accessible_name = _('Hourly Forecast');
-
+        this.update_property([Gtk.AccessibleProperty.LABEL], [_('Hourly Forecast')]);
         this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
 
         this._box = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL,
@@ -139,9 +133,9 @@ var HourlyForecastFrame = GObject.registerClass(class ForecastFrame extends Gtk.
     }
 
     clear() {
-      // TODO: GTK4
-      // Figure out the best replacement for this pattern.
-      //  this._box.foreach(function(w) { w.destroy(); });
+      for (const w of Array.from(this._box)) {
+          this._box.remove(w);
+      }
     }
 
     hasForecastInfo() {
diff --git a/src/app/main.js b/src/app/main.js
index fd03b10..d7b25dd 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -194,7 +194,7 @@ const Application = GObject.registerClass(
             let timeoutId;
             let model = this.model;
 
-            timeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 10000, function() {
+            timeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 1000, function() {
                 log('Timeout during model load, perhaps the network is not available?');
                 model.disconnect(notifyId);
                 win.show();
diff --git a/src/app/window.js b/src/app/window.js
index 28d3a68..a33cb4b 100644
--- a/src/app/window.js
+++ b/src/app/window.js
@@ -70,10 +70,10 @@ var MainWindow = GObject.registerClass(
         builder.add_from_resource('/org/gnome/Weather/window.ui');
         builder.add_from_resource('/org/gnome/Weather/primary-menu.ui');
 
-        let grid = builder.get_object('main-panel');
         this._header = builder.get_object('header-bar');
-        // TODO: GTK4
-        // this._header.set_title(_('Select Location'));
+        this._header.set_title_widget(new Gtk.Label({
+            label: _('Select Location')
+        }));
 
         this._model = this.application.model;
 
@@ -110,9 +110,6 @@ var MainWindow = GObject.registerClass(
         let box = builder.get_object('main-box');
 
         this.set_child(box);
-        // TODO: GTK4
-        // Children are now shown by default, verify that everything is visible though.
-        // box.show_all();
 
         for (let i = 0; i < this._pageWidgets[Page.CITY].length; i++)
             this._pageWidgets[Page.CITY][i].hide();
@@ -137,12 +134,10 @@ var MainWindow = GObject.registerClass(
     }
 
     _setTitle(page) {
-        // TODO: GTK4
-        // We need to update all of our headerbar handling.
         if (page == Page.CITY)
-            ;//this._header.set_custom_title(this._forecastStackSwitcher);
+            this._header.set_title_widget(this._forecastStackSwitcher);
         else
-            ;//this._header.set_custom_title(null);
+            this._header.set_title_widget(null);
     }
 
     _goToPage(page) {
@@ -150,11 +145,7 @@ var MainWindow = GObject.registerClass(
             this._pageWidgets[this._currentPage][i].hide();
 
         for (let i = 0; i < this._pageWidgets[page].length; i++) {
-            // TODO: GTK4
-            // I believe this property is no longer relevant
-            // let widget = this._pageWidgets[page][i];
-            // if (!widget.no_show_all)
-                this._pageWidgets[page][i].show();
+            this._pageWidgets[page][i].show();
         }
 
         this._setTitle(page);
@@ -184,7 +175,6 @@ var MainWindow = GObject.registerClass(
     }
 
     showInfo(info, isCurrentLocation) {
-        log(info);
         if (!info) {
             if (isCurrentLocation && this._showingDefault)
                 this.showDefault();
diff --git a/src/app/world.js b/src/app/world.js
index 09efe8a..216a69a 100644
--- a/src/app/world.js
+++ b/src/app/world.js
@@ -35,15 +35,16 @@ var WorldContentView = GObject.registerClass(
             vexpand: false
         }, params));
 
-        // TODO: GTK4
-        //this.get_accessible().accessible_name = _("World view");
-
+        this.update_property([Gtk.AccessibleProperty.LABEL], [_("World view")]);
         let builder = new Gtk.Builder();
         builder.add_from_resource('/org/gnome/Weather/places-popover.ui');
 
         let grid = builder.get_object('popover-grid');
         this.set_child(grid);
 
+        this._searchGrid = builder.get_object('search-grid');
+        this._locationsGrid = builder.get_object('locations-grid');
+
         this.model = application.model;
         this._window = window;
 
@@ -126,9 +127,9 @@ var WorldContentView = GObject.registerClass(
 
     _syncStackPopover() {
         if (this.model.length == 1)
-            this._stackPopover.set_visible_child_name("search-grid");
+            this._stackPopover.set_visible_child(this._searchGrid);
         else
-            this._stackPopover.set_visible_child_name("locations-grid");
+            this._stackPopover.set_visible_child(this._locationsGrid);
     }
 
     _filterListbox(row) {
@@ -150,8 +151,10 @@ var WorldContentView = GObject.registerClass(
 
         let grid = new Gtk.Grid({ orientation: Gtk.Orientation.HORIZONTAL,
                                   column_spacing: 12,
-                                  // TODO: GTK4
-                                  //  margin: 12,
+                                  margin_start: 12,
+                                  margin_end: 12,
+                                  margin_top: 12,
+                                  margin_bottom: 12,
                                   visible: true });
 
         let name = location.get_city_name();
@@ -224,22 +227,10 @@ var WorldContentView = GObject.registerClass(
     }
 
     _onLocationRemoved(model, info) {
-        let i = 0;
-        let row = null;
-        // TODO: GTK4
-        // This seems like the correct way to iterate over rows now.
-        while (row = this._listbox.get_row_at_index(i)) {
-            if (row._info == info) {
-               // TODO: GTK4
-               // row.destroy();
-               delete row._info;
-               this._listbox.remove(row);
-               
-                break;
-            }
-
-            i++;
-        }
+        Array.from(this._listbox).forEach((row) => {
+            delete row._info;
+            this._listbox.remove(row);
+        });
 
         if (info._updatedId) {
             info.disconnect(info._updatedId);


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