[gnome-weather/wip/ewlsh/gtk4] Improve spacial layout, start fixing action issues



commit 37de8bb37fd7343c9c4bc8b1d65cacdbdeab49c1
Author: Evan Welsh <contact evanwelsh com>
Date:   Sat Feb 5 04:25:19 2022 -0800

    Improve spacial layout, start fixing action issues

 data/application.css      | 14 ++++++++------
 data/weather-widget.ui    |  6 +++++-
 data/window.ui            |  1 -
 src/app/application.js    |  7 ++-----
 src/app/city.js           |  8 --------
 src/app/hourlyForecast.js |  1 +
 src/app/thermometer.js    |  3 +++
 src/org.gnome.Weather.in  |  2 +-
 8 files changed, 20 insertions(+), 22 deletions(-)
---
diff --git a/data/application.css b/data/application.css
index 32570a4..5403e46 100644
--- a/data/application.css
+++ b/data/application.css
@@ -49,14 +49,16 @@
     border-radius: 6px;
 }
 
-.forecast-frame.right-cutoff {
-    border-top-right-radius: 0;
-    border-bottom-right-radius: 0;
+#conditions-grid,
+#attributionGrid {
+    margin-left: 18px;
+    margin-right: 18px;
 }
 
-.forecast-frame.left-cutoff {
-    border-top-left-radius: 0;
-    border-bottom-left-radius: 0;
+#weather-page .small .forecast-frame {
+    margin-left: 0;
+    margin-right: 0;
+    border-radius: 0;
 }
 
 .forecast-temperature-label {
diff --git a/data/weather-widget.ui b/data/weather-widget.ui
index 401a592..1550c7a 100644
--- a/data/weather-widget.ui
+++ b/data/weather-widget.ui
@@ -5,7 +5,7 @@
     <child>
       <object class="GtkBox" id="outerBox">
         <property name="orientation">vertical</property>
-        <property name="margin-start">18</property>
+        <property name="margin-start">0</property>
         <property name="margin-end">0</property>
         <property name="margin-top">18</property>
         <property name="margin-bottom">18</property>
@@ -202,6 +202,7 @@
         </child>
         <child>
           <object class="GtkGrid">
+            <property name="name">attributionGrid</property>
             <property name="row_spacing">8</property>
             <child>
               <object class="GtkLabel" id="updatedTimeLabel">
@@ -219,6 +220,9 @@
                 <property name="use_markup">1</property>
                 <property name="wrap">1</property>
                 <property name="xalign">0</property>
+                <!-- ellipsize this text so that on small layouts we
+                     don't cause the bottom navigation to overflow -->
+                <property name="ellipsize">end</property>
                 <layout>
                   <property name="column">0</property>
                   <property name="row">1</property>
diff --git a/data/window.ui b/data/window.ui
index dac51af..7ea66bb 100644
--- a/data/window.ui
+++ b/data/window.ui
@@ -81,7 +81,6 @@
             </child>
             <child type="end">
               <object class="GtkMenuButton">
-                <property name="focusable">1</property>
                 <property name="valign">center</property>
                 <property name="menu_model">primary-menu</property>
                 <property name="icon_name">open-menu-symbolic</property>
diff --git a/src/app/application.js b/src/app/application.js
index cacbd14..9587f21 100644
--- a/src/app/application.js
+++ b/src/app/application.js
@@ -148,11 +148,8 @@ export const Application = GObject.registerClass(
                 state: resolveDefaultTemperatureUnit(gwSettings.get_enum('temperature-unit')),
                 parameter_type: new GLib.VariantType('s')
             });
-            temperatureAction.connect('activate', function (action, parameter) {
-                action.change_state(parameter);
-            })
-            temperatureAction.connect('change-state', function (action, state) {
-                gwSettings.set_value('temperature-unit', state);
+            temperatureAction.connect('activate', function (_, parameter) {
+                gwSettings.set_value('temperature-unit', parameter);
             });
             gwSettings.connect('changed::temperature-unit', function () {
                 temperatureAction.state = 
resolveDefaultTemperatureUnit(gwSettings.get_enum('temperature-unit'));
diff --git a/src/app/city.js b/src/app/city.js
index cce8519..4478a85 100644
--- a/src/app/city.js
+++ b/src/app/city.js
@@ -131,23 +131,15 @@ export const WeatherWidget = GObject.registerClass({
         if ((hadjustment.get_upper() - hadjustment.get_lower()) == hadjustment.page_size) {
             this._leftButton.hide();
             this._rightButton.hide();
-            visible_child.remove_css_class('left-cutoff');
-            visible_child.remove_css_class('right-cutoff');
         } else if (hadjustment.value == hadjustment.get_lower()) {
             this._leftButton.hide();
             this._rightButton.show();
-            visible_child.remove_css_class('left-cutoff');
-            visible_child.add_css_class('right-cutoff');
         } else if (hadjustment.value >= (hadjustment.get_upper() - hadjustment.page_size)) {
             this._leftButton.show();
             this._rightButton.hide();
-            visible_child.remove_css_class('right-cutoff');
-            visible_child.add_css_class('left-cutoff');
         } else {
             this._leftButton.show();
             this._rightButton.show();
-            visible_child.add_css_class('left-cutoff');
-            visible_child.add_css_class('right-cutoff');
         }
     }
 
diff --git a/src/app/hourlyForecast.js b/src/app/hourlyForecast.js
index c251fd7..f47cf2c 100644
--- a/src/app/hourlyForecast.js
+++ b/src/app/hourlyForecast.js
@@ -242,4 +242,5 @@ export const HourEntry = GObject.registerClass({
         };
     }
 });
+
 HourEntry.set_layout_manager_type(Gtk.BoxLayout);
\ No newline at end of file
diff --git a/src/app/thermometer.js b/src/app/thermometer.js
index 632d88b..641622a 100644
--- a/src/app/thermometer.js
+++ b/src/app/thermometer.js
@@ -85,6 +85,9 @@ const ThermometerScale = GObject.registerClass({
 
     const { width, height } = this.get_allocation();
 
+    // Don't render when allocation is shorter than 64
+    if (height < 64) return;
+
     const { dailyHigh, dailyLow, weeklyHigh, weeklyLow } = this.range;
 
     const scaleFactor = height / (weeklyHigh - weeklyLow);
diff --git a/src/org.gnome.Weather.in b/src/org.gnome.Weather.in
index 3d3b4bc..901f7d1 100755
--- a/src/org.gnome.Weather.in
+++ b/src/org.gnome.Weather.in
@@ -5,6 +5,6 @@ imports.package.init({ name: "@APP_ID@",
                         libdir: "@libdir@" });
 
 import(`resource:///org/gnome/Weather@profile@/js/app/main.js`).catch(error => {
-    logError(error);
+    console.error(error);
     imports.system.exit(1);
 });


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