weather: Rework weather management

This commit brings a few changes that I was too lazy to
split in different commits:

 * Remove a few useless arguments in the GcalWeatherService API
 * Move the weather management code from GcalWindow to GcalWeatherSettings
 * A few style changes
This commit is contained in:
Georges Basile Stavracas Neto
2018-01-27 20:36:29 -02:00
parent ab20672aeb
commit 499db7bfd4
13 changed files with 568 additions and 392 deletions
+1
View File
@@ -16,6 +16,7 @@
<file alias="search-view.ui" compressed="true">ui/search-view.ui</file>
<file alias="source-dialog.ui" compressed="true">ui/source-dialog.ui</file>
<file alias="time-selector.ui" compressed="true">ui/time-selector.ui</file>
<file alias="weather-settings.ui" compressed="true">ui/weather-settings.ui</file>
<file alias="week-header.ui" compressed="true">ui/week-header.ui</file>
<file alias="week-view.ui" compressed="true">ui/week-view.ui</file>
<file alias="window.ui" compressed="true">ui/window.ui</file>
+1
View File
@@ -63,6 +63,7 @@ resource_data = files(
'ui/search-view.ui',
'ui/source-dialog.ui',
'ui/time-selector.ui',
'ui/weather-settings.ui',
'ui/week-header.ui',
'ui/week-view.ui',
'ui/window.ui',
+77
View File
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.14"/>
<template class="GcalWeatherSettings" parent="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="margin">12</property>
<property name="spacing">6</property>
<child>
<object class="GtkModelButton">
<property name="text" translatable="yes">_Weather</property>
<property name="menu-name">main-menu</property>
<property name="inverted">True</property>
<property name="centered">True</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">18</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0.0</property>
<property name="label" translatable="yes">Show Weather</property>
</object>
</child>
<child>
<object class="GtkSwitch" id="show_weather_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="notify::active" handler="on_show_weather_changed_cb" object="GcalWeatherSettings" swapped="no" />
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="weather_auto_location_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">18</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0.0</property>
<property name="label" translatable="yes">Automatic Location</property>
</object>
</child>
<child>
<object class="GtkSwitch" id="weather_auto_location_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="notify::active" handler="on_weather_auto_location_changed_cb" object="GcalWeatherSettings" swapped="no" />
</object>
</child>
</object>
</child>
<child>
<object class="GWeatherLocationEntry" id="weather_location_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
<signal name="changed" handler="on_weather_location_searchbox_changed_cb" object="GcalWeatherSettings" swapped="no" />
<signal name="activate" handler="on_weather_location_searchbox_changed_cb" object="GcalWeatherSettings" swapped="no" />
</object>
</child>
</template>
</interface>
+1 -70
View File
@@ -417,78 +417,9 @@
<!-- Weather -->
<child>
<object class="GtkBox">
<object class="GcalWeatherSettings" id="weather_settings">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="margin">12</property>
<property name="spacing">6</property>
<child>
<object class="GtkModelButton">
<property name="text" translatable="yes">_Weather</property>
<property name="menu-name">main-menu</property>
<property name="inverted">True</property>
<property name="centered">True</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">18</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0.0</property>
<property name="label" translatable="yes">Show Weather</property>
</object>
</child>
<child>
<object class="GtkSwitch" id="show_weather_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="notify::active" handler="on_show_weather_changed_cb" object="GcalWindow" swapped="no" />
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="weather_auto_location_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">18</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0.0</property>
<property name="label" translatable="yes">Automatic Location</property>
</object>
</child>
<child>
<object class="GtkSwitch" id="weather_auto_location_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="notify::active" handler="on_weather_auto_location_changed_cb" object="GcalWindow" swapped="no" />
</object>
</child>
</object>
</child>
<child>
<object class="GWeatherLocationEntry" id="weather_location_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
<signal name="changed" handler="on_weather_location_searchbox_changed_cb" object="GcalWindow" swapped="no" />
<signal name="activate" handler="on_weather_location_searchbox_changed_cb" object="GcalWindow" swapped="no" />
</object>
</child>
</object>
<packing>
<property name="name">weather-menu</property>