[gnome-clocks] Initial commit of GTK 4 port
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks] Initial commit of GTK 4 port
- Date: Fri, 7 Jan 2022 17:23:44 +0000 (UTC)
commit f00482ea365e1c81b050a301544efb013e2e1c74
Author: Maximiliano Sandoval R <msandova gnome org>
Date: Mon Dec 13 01:24:49 2021 +0100
Initial commit of GTK 4 port
build-aux/flatpak/org.gnome.clocks.json | 16 ++--
data/css/gnome-clocks.css | 5 +-
data/ui/alarm-day-picker-row.ui | 2 +-
data/ui/alarm-face.ui | 89 ++++++++++-----------
data/ui/alarm-ringing-panel.ui | 13 ++--
data/ui/alarm-row.ui | 4 +-
data/ui/alarm-setup-dialog.ui | 10 +--
data/ui/header-bar.ui | 126 +++++++++++++++---------------
data/ui/stopwatch-face.ui | 9 +--
data/ui/timer-face.ui | 133 ++++++++++++++++----------------
data/ui/timer-row.ui | 8 +-
data/ui/timer-setup.ui | 3 +-
data/ui/window.ui | 13 ++--
data/ui/world-face.ui | 101 ++++++++++++------------
data/ui/world-location-dialog.ui | 7 +-
data/ui/world-row.ui | 2 +-
data/ui/world-standalone.ui | 3 +-
meson.build | 26 +------
src/alarm-face.vala | 6 +-
src/alarm-setup-dialog.vala | 25 +++---
src/application.vala | 12 +--
src/geocoding.vala | 58 +++++++-------
src/header-bar.vala | 2 +-
src/meson.build | 2 +-
src/search-provider.vala | 32 ++++----
src/timer-face.vala | 12 +--
src/utils.vala | 3 +-
src/world-face.vala | 21 ++---
src/world-location-dialog-row.vala | 23 +++---
src/world-location-dialog.vala | 33 ++++----
30 files changed, 397 insertions(+), 402 deletions(-)
---
diff --git a/build-aux/flatpak/org.gnome.clocks.json b/build-aux/flatpak/org.gnome.clocks.json
index 43371ed6..d16a75f8 100644
--- a/build-aux/flatpak/org.gnome.clocks.json
+++ b/build-aux/flatpak/org.gnome.clocks.json
@@ -6,6 +6,7 @@
"command": "gnome-clocks",
"tags": ["nightly"],
"finish-args": [
+ "--device=dri",
"--share=ipc",
"--socket=fallback-x11",
"--socket=wayland",
@@ -44,8 +45,8 @@
"sources": [
{
"type": "git",
- "url": "https://gitlab.gnome.org/mlundblad/libgweather.git",
- "branch": "wip/mlundblad/no-gtk"
+ "url": "https://gitlab.gnome.org/GNOME/libgweather.git",
+ "branch": "main"
}
]
},
@@ -56,13 +57,14 @@
"-Ddebug_tools=false",
"-Dudev=disabled",
"-Dgtk_doc=false",
- "-Ddesktop_docs=false"
+ "-Ddesktop_docs=false",
+ "-Dlegacy_library=false",
+ "-Dbuild_gtk4=false"
],
"sources": [
{
"type": "git",
- "url": "https://gitlab.gnome.org/GNOME/gnome-desktop.git",
- "branch": "wip/gtk4"
+ "url": "https://gitlab.gnome.org/GNOME/gnome-desktop.git"
}
]
},
@@ -125,8 +127,8 @@
],
"sources": [
{
- "type": "git",
- "url": "https://gitlab.gnome.org/GNOME/gnome-clocks.git"
+ "type": "dir",
+ "path": "../../"
}
]
}
diff --git a/data/css/gnome-clocks.css b/data/css/gnome-clocks.css
index 13f089ef..35ecd71d 100644
--- a/data/css/gnome-clocks.css
+++ b/data/css/gnome-clocks.css
@@ -26,9 +26,8 @@ label.destructive-action {
padding: 4px;
}
-.pill-button, .circular.flat {
+.circular.flat {
border-radius: 9999px;
- -gtk-outline-radius: 9999px;
}
/* alarms */
@@ -110,7 +109,7 @@ spinbutton.clocks-timer-label button {
}
.timer-panel .small-button {
- padding: 5px 9px
+ padding: 5px 9px;
}
.timer-panel .large-button {
diff --git a/data/ui/alarm-day-picker-row.ui b/data/ui/alarm-day-picker-row.ui
index 9313f181..652cb6d5 100644
--- a/data/ui/alarm-day-picker-row.ui
+++ b/data/ui/alarm-day-picker-row.ui
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <template class="ClocksAlarmDayPickerRow" parent="HdyActionRow">
+ <template class="ClocksAlarmDayPickerRow" parent="AdwActionRow">
<property name="visible">True</property>
<property name="title" translatable="yes">_Repeat</property>
<property name="use-underline">True</property>
diff --git a/data/ui/alarm-face.ui b/data/ui/alarm-face.ui
index 22eb3cf0..74400126 100644
--- a/data/ui/alarm-face.ui
+++ b/data/ui/alarm-face.ui
@@ -1,59 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="3.18"/>
- <template class="ClocksAlarmFace" parent="GtkStack">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="homogeneous">False</property>
+ <template class="ClocksAlarmFace" parent="AdwBin">
<child>
- <object class="GtkBox" id="empty_view">
+ <object class="GtkStack" id="stack">
<property name="visible">True</property>
- <property name="halign">center</property>
- <property name="valign">center</property>
- <property name="spacing">36</property>
- <property name="orientation">vertical</property>
+ <property name="can_focus">False</property>
+ <property name="homogeneous">False</property>
<child>
- <object class="GtkImage">
+ <object class="GtkBox" id="empty_view">
<property name="visible">True</property>
- <property name="icon_name">alarm-centered-symbolic</property>
- <property name="pixel-size">128</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkButton">
- <property name="visible">True</property>
- <property name="action-name">win.new</property>
- <property name="label" translatable="yes">Add A_larm</property>
- <property name="use-underline">True</property>
<property name="halign">center</property>
- <style>
- <class name="suggested-action"/>
- <class name="large-button"/>
- <class name="pill-button"/>
- </style>
+ <property name="valign">center</property>
+ <property name="spacing">36</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon_name">alarm-centered-symbolic</property>
+ <property name="pixel-size">128</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton">
+ <property name="visible">True</property>
+ <property name="action-name">win.new</property>
+ <property name="label" translatable="yes">Add A_larm</property>
+ <property name="use-underline">True</property>
+ <property name="halign">center</property>
+ <style>
+ <class name="suggested-action"/>
+ <class name="large-button"/>
+ <class name="pill"/>
+ </style>
+ </object>
+ </child>
</object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="list_view">
- <property name="visible">True</property>
<child>
- <object class="HdyClamp">
+ <object class="GtkScrolledWindow" id="list_view">
<property name="visible">True</property>
<child>
- <object class="GtkListBox" id="listbox">
+ <object class="AdwClamp">
<property name="visible">True</property>
- <property name="valign">start</property>
- <property name="selection-mode">none</property>
- <property name="activate-on-single-click">True</property>
- <style>
- <class name="content"/>
- <class name="clocks-list"/>
- </style>
+ <child>
+ <object class="GtkListBox" id="listbox">
+ <property name="visible">True</property>
+ <property name="valign">start</property>
+ <property name="selection-mode">none</property>
+ <property name="activate-on-single-click">True</property>
+ <style>
+ <class name="content"/>
+ <class name="clocks-list"/>
+ </style>
+ </object>
+ </child>
</object>
</child>
</object>
diff --git a/data/ui/alarm-ringing-panel.ui b/data/ui/alarm-ringing-panel.ui
index df04bc70..32d89f73 100644
--- a/data/ui/alarm-ringing-panel.ui
+++ b/data/ui/alarm-ringing-panel.ui
@@ -1,17 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
- <requires lib="gtk+" version="3.20"/>
- <template class="ClocksAlarmRingingPanel" parent="GtkBin">
+ <template class="ClocksAlarmRingingPanel" parent="AdwBin">
<child>
- <object class="HdyWindowHandle">
+ <object class="GtkWindowHandle">
<property name="visible">True</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="margin_left">6</property>
- <property name="margin_right">6</property>
+ <property name="margin_start">6</property>
+ <property name="margin_end">6</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="hexpand">True</property>
@@ -36,7 +35,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<style>
- <class name="pill-button"/>
+ <class name="pill"/>
<class name="large-button"/>
<class name="destructive-action"/>
</style>
@@ -54,7 +53,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<style>
- <class name="pill-button"/>
+ <class name="pill"/>
<class name="large-button"/>
</style>
</object>
diff --git a/data/ui/alarm-row.ui b/data/ui/alarm-row.ui
index 5ab7676c..8b23785b 100644
--- a/data/ui/alarm-row.ui
+++ b/data/ui/alarm-row.ui
@@ -12,8 +12,8 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
- <property name="margin_left">12</property>
- <property name="margin_right">12</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="hexpand">True</property>
diff --git a/data/ui/alarm-setup-dialog.ui b/data/ui/alarm-setup-dialog.ui
index f332c4a5..56d1ed11 100644
--- a/data/ui/alarm-setup-dialog.ui
+++ b/data/ui/alarm-setup-dialog.ui
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="3.20"/>
- <requires lib="libhandy" version="0.0"/>
<object class="GtkAdjustment" id="h_adjustment">
<property name="upper">100</property>
<property name="step_increment">1</property>
@@ -26,7 +24,7 @@
<object class="GtkBox">
<property name="visible">True</property>
<child>
- <object class="HdyClamp">
+ <object class="AdwClamp">
<property name="visible">True</property>
<property name="maximum-size">450</property>
<child>
@@ -136,7 +134,7 @@
</object>
</child>
<child>
- <object class="HdyActionRow">
+ <object class="AdwActionRow">
<property name="visible">True</property>
<property name="activatable">False</property>
<property name="selectable">False</property>
@@ -154,7 +152,7 @@
</object>
</child>
<child>
- <object class="HdyComboRow" id="ring_duration">
+ <object class="AdwComboRow" id="ring_duration">
<property name="visible">True</property>
<property name="activatable">False</property>
<property name="selectable">False</property>
@@ -162,7 +160,7 @@
</object>
</child>
<child>
- <object class="HdyComboRow" id="snooze_duration">
+ <object class="AdwComboRow" id="snooze_duration">
<property name="visible">True</property>
<property name="activatable">False</property>
<property name="selectable">False</property>
diff --git a/data/ui/header-bar.ui b/data/ui/header-bar.ui
index 58584469..cce17f62 100644
--- a/data/ui/header-bar.ui
+++ b/data/ui/header-bar.ui
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="3.20"/>
- <requires lib="libhandy" version="0.0"/>
<menu id="primary-menu">
<section>
<item>
@@ -18,94 +16,98 @@
</item>
</section>
</menu>
- <template class="ClocksHeaderBar" parent="HdyHeaderBar">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="centering_policy">strict</property>
- <property name="show_close_button">True</property>
- <child type="title">
- <object class="HdyViewSwitcherTitle" id="view_switcher_title">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Clocks</property>
- <property name="stack" bind-source="ClocksHeaderBar" bind-property="stack"
bind-flags="sync-create">ignore-me</property>
- <signal name="notify::title-visible" handler="title_visible_changed"/>
- </object>
- </child>
+ <template class="ClocksHeaderBar" parent="AdwBin">
<child>
- <object class="GtkStack" id="start_button_stack">
+ <object class="AdwHeaderBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="transition_type">crossfade</property>
+ <property name="centering_policy">strict</property>
+ <property name="show_close_button">True</property>
+ <child type="title">
+ <object class="AdwViewSwitcherTitle" id="view_switcher_title">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Clocks</property>
+ <property name="stack" bind-source="ClocksHeaderBar" bind-property="stack"
bind-flags="sync-create">ignore-me</property>
+ <signal name="notify::title-visible" handler="title_visible_changed"/>
+ </object>
+ </child>
<child>
- <object class="GtkButton">
+ <object class="GtkStack" id="start_button_stack">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="action_name">win.new</property>
- <property name="tooltip-text" bind-source="ClocksHeaderBar" bind-property="new-label"
bind-flags="sync-create" />
+ <property name="can_focus">False</property>
+ <property name="transition_type">crossfade</property>
<child>
- <object class="GtkImage">
+ <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.new</property>
+ <property name="tooltip-text" bind-source="ClocksHeaderBar" bind-property="new-label"
bind-flags="sync-create" />
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">list-add-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="name">new</property>
+ </packing>
+ </child>
+ <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>
+ <packing>
+ <property name="name">back</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="icon_name">list-add-symbolic</property>
+ <property name="orientation">vertical</property>
</object>
+ <packing>
+ <property name="name">empty</property>
+ </packing>
</child>
</object>
- <packing>
- <property name="name">new</property>
- </packing>
</child>
<child>
- <object class="GtkButton">
+ <object class="GtkMenuButton">
<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>
+ <property name="action_name">win.show-primary-menu</property>
+ <property name="tooltip-text" translatable="yes">Menu</property>
+ <property name="menu_model">primary-menu</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="icon_name">go-previous-symbolic</property>
+ <property name="icon_name">open-menu-symbolic</property>
</object>
</child>
</object>
<packing>
- <property name="name">back</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- </object>
- <packing>
- <property name="name">empty</property>
+ <property name="pack_type">end</property>
</packing>
</child>
</object>
</child>
- <child>
- <object class="GtkMenuButton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="action_name">win.show-primary-menu</property>
- <property name="tooltip-text" translatable="yes">Menu</property>
- <property name="menu_model">primary-menu</property>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">open-menu-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
- </child>
</template>
<object class="GtkStack" id="ignore-me"></object>
</interface>
diff --git a/data/ui/stopwatch-face.ui b/data/ui/stopwatch-face.ui
index c36fa5b4..9b9061dd 100644
--- a/data/ui/stopwatch-face.ui
+++ b/data/ui/stopwatch-face.ui
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.2 -->
<interface>
- <requires lib="gtk+" version="3.16"/>
- <requires lib="libhandy" version="0.0"/>
<template class="ClocksStopwatchFace" parent="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -13,7 +10,7 @@
<property name="can_focus">True</property>
<property name="min_content_width">300</property>
<child>
- <object class="HdyClamp">
+ <object class="AdwClamp">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="maximum_size">380</property>
@@ -180,7 +177,7 @@
<style>
<class name="suggested-action"/>
<class name="large-button"/>
- <class name="pill-button"/>
+ <class name="pill"/>
</style>
</object>
<packing>
@@ -199,7 +196,7 @@
<signal name="clicked" handler="on_clear_btn_clicked" swapped="no"/>
<style>
<class name="large-button"/>
- <class name="pill-button"/>
+ <class name="pill"/>
</style>
</object>
<packing>
diff --git a/data/ui/timer-face.ui b/data/ui/timer-face.ui
index 123a8c59..08d49410 100644
--- a/data/ui/timer-face.ui
+++ b/data/ui/timer-face.ui
@@ -1,105 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.1 -->
<interface>
- <requires lib="gtk+" version="3.18"/>
- <requires lib="libhandy" version="0.0"/>
- <template class="ClocksTimerFace" parent="GtkStack">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <template class="ClocksTimerFace" parent="AdwBin">
<child>
- <object class="GtkBox" id="no_timer_container">
+ <object class="GtkStack" id="stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="halign">center</property>
- <property name="valign">center</property>
- <property name="orientation">vertical</property>
- <property name="spacing">18</property>
<child>
- <object class="GtkLabel">
+ <object class="GtkBox" id="no_timer_container">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Select Duration</property>
- <style>
- <class name="timer-header"/>
- </style>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="start_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">18</property>
<child>
- <object class="GtkImage">
+ <object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="label" translatable="yes">Select Duration</property>
+ <style>
+ <class name="timer-header"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="start_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
- <property name="icon_name">media-playback-start-symbolic</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="icon_name">media-playback-start-symbolic</property>
+ </object>
+ </child>
+ <style>
+ <class name="pill"/>
+ <class name="large-button"/>
+ <class name="suggested-action"/>
+ </style>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
- <style>
- <class name="pill-button"/>
- <class name="large-button"/>
- <class name="suggested-action"/>
- </style>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
+ <property name="name">empty</property>
</packing>
</child>
- </object>
- <packing>
- <property name="name">empty</property>
- </packing>
- </child>
- <child>
- <object class="GtkScrolledWindow">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
<child>
- <object class="GtkViewport">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="shadow_type">none</property>
+ <property name="can_focus">True</property>
<child>
- <object class="HdyClamp">
+ <object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="shadow_type">none</property>
<child>
- <object class="GtkListBox" id="timers_list">
+ <object class="AdwClamp">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="valign">start</property>
- <property name="selection_mode">none</property>
- <property name="activate_on_single_click">False</property>
- <style>
- <class name="content"/>
- <class name="clocks-list"/>
- </style>
+ <child>
+ <object class="GtkListBox" id="timers_list">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">start</property>
+ <property name="selection_mode">none</property>
+ <property name="activate_on_single_click">False</property>
+ <style>
+ <class name="content"/>
+ <class name="clocks-list"/>
+ </style>
+ </object>
+ </child>
</object>
</child>
</object>
</child>
</object>
+ <packing>
+ <property name="name">timers</property>
+ <property name="position">1</property>
+ </packing>
</child>
+ <style>
+ <class name="timer-panel"/>
+ </style>
</object>
- <packing>
- <property name="name">timers</property>
- <property name="position">1</property>
- </packing>
</child>
- <style>
- <class name="timer-panel"/>
- </style>
</template>
</interface>
diff --git a/data/ui/timer-row.ui b/data/ui/timer-row.ui
index d9fdece5..fc0ae48e 100644
--- a/data/ui/timer-row.ui
+++ b/data/ui/timer-row.ui
@@ -101,7 +101,7 @@
</object>
</child>
<style>
- <class name="pill-button"/>
+ <class name="pill"/>
<class name="large-button"/>
</style>
</object>
@@ -126,7 +126,7 @@
</child>
<style>
<class name="suggested-action"/>
- <class name="pill-button"/>
+ <class name="pill"/>
<class name="large-button"/>
</style>
</object>
@@ -161,7 +161,7 @@
</object>
</child>
<style>
- <class name="pill-button"/>
+ <class name="pill"/>
<class name="small-button"/>
</style>
</object>
@@ -204,7 +204,7 @@
</object>
</child>
<style>
- <class name="pill-button"/>
+ <class name="pill"/>
<class name="small-button"/>
</style>
</object>
diff --git a/data/ui/timer-setup.ui b/data/ui/timer-setup.ui
index 8a2f3b18..752ba543 100644
--- a/data/ui/timer-setup.ui
+++ b/data/ui/timer-setup.ui
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<requires lib="libhandy" version="0.0"/>
@@ -23,7 +22,7 @@
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
- <object class="HdyClamp">
+ <object class="AdwClamp">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="expand">True</property>
diff --git a/data/ui/window.ui b/data/ui/window.ui
index 5792f724..5a6b4fc8 100644
--- a/data/ui/window.ui
+++ b/data/ui/window.ui
@@ -1,12 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <!-- interface-requires gtk+ 3.20 -->
- <requires lib="gtk+" version="3.20"/>
- <requires lib="libhandy" version="0.0"/>
- <template class="ClocksWindow" parent="HdyApplicationWindow">
+ <template class="ClocksWindow" parent="AdwApplicationWindow">
<property name="title" bind-source="header_bar" bind-property="title" bind-flags="sync-create" />
<child>
- <object class="HdyDeck" id="alarm_deck">
+ <object class="AdwLeaflet" id="alarm_leaflet">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="visible-child">world_deck</property>
@@ -19,9 +16,9 @@
</object>
</child>
<child>
- <object class="HdyDeck" id="world_deck">
+ <object class="AdwLeaflet" id="world_leaflet">
<property name="visible">True</property>
- <property name="can-swipe-back">True</property>
+ <property name="can-navigate-back">True</property>
<signal name="notify::visible-child" handler="visible_child_changed"/>
<child>
<object class="GtkBox" id="main_view">
@@ -87,7 +84,7 @@
</object>
</child>
<child>
- <object class="HdyViewSwitcherBar" id="switcher_bar">
+ <object class="AdwViewSwitcherBar" id="switcher_bar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stack">stack</property>
diff --git a/data/ui/world-face.ui b/data/ui/world-face.ui
index 4dea032d..dc5e5f68 100644
--- a/data/ui/world-face.ui
+++ b/data/ui/world-face.ui
@@ -1,67 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="3.18"/>
- <template class="ClocksWorldFace" parent="GtkStack">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="homogeneous">False</property>
+ <template class="ClocksWorldFace" parent="AdwBin">
<child>
- <object class="GtkBox" id="empty_view">
+ <object class="GtkStack" id="stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="halign">center</property>
- <property name="valign">center</property>
- <property name="spacing">36</property>
+ <property name="homogeneous">False</property>
<child>
- <object class="GtkImage">
+ <object class="GtkBox" id="empty_view">
<property name="visible">True</property>
- <property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="icon_name">globe-centered-symbolic</property>
- <property name="pixel_size">128</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton">
- <property name="visible">True</property>
- <property name="action-name">win.new</property>
- <property name="label" translatable="yes">Add World Clock</property>
+ <property name="orientation">vertical</property>
<property name="halign">center</property>
- <style>
- <class name="suggested-action"/>
- <class name="large-button"/>
- <class name="pill-button"/>
- </style>
+ <property name="valign">center</property>
+ <property name="spacing">36</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">globe-centered-symbolic</property>
+ <property name="pixel_size">128</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton">
+ <property name="visible">True</property>
+ <property name="action-name">win.new</property>
+ <property name="label" translatable="yes">Add World Clock</property>
+ <property name="halign">center</property>
+ <style>
+ <class name="suggested-action"/>
+ <class name="large-button"/>
+ <class name="pill"/>
+ </style>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
- <packing>
- <property name="position">1</property>
- </packing>
</child>
- </object>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="list_view">
- <property name="visible">True</property>
<child>
- <object class="HdyClamp">
+ <object class="GtkScrolledWindow" id="list_view">
<property name="visible">True</property>
<child>
- <object class="GtkListBox" id="listbox">
+ <object class="AdwClamp">
<property name="visible">True</property>
- <property name="valign">start</property>
- <property name="selection-mode">none</property>
- <signal name="row-activated" handler="item_activated" swapped="no"/>
- <style>
- <class name="content"/>
- <class name="clocks-list"/>
- </style>
+ <child>
+ <object class="GtkListBox" id="listbox">
+ <property name="visible">True</property>
+ <property name="valign">start</property>
+ <property name="selection-mode">none</property>
+ <signal name="row-activated" handler="item_activated" swapped="no"/>
+ <style>
+ <class name="content"/>
+ <class name="clocks-list"/>
+ </style>
+ </object>
+ </child>
</object>
</child>
</object>
diff --git a/data/ui/world-location-dialog.ui b/data/ui/world-location-dialog.ui
index 48e46c37..fea18688 100644
--- a/data/ui/world-location-dialog.ui
+++ b/data/ui/world-location-dialog.ui
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.36.0 -->
<interface>
- <requires lib="gtk+" version="3.22"/>
- <requires lib="libhandy" version="0.0"/>
<template class="ClocksWorldLocationDialog" parent="GtkDialog">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Add World Clock</property>
@@ -18,7 +15,7 @@
<object class="GtkHeaderBar" id="dialog-header-bar">
<property name="visible">True</property>
<property name="title" translatable="yes">Add a New World Clock</property>
- <property name="show_close_button">False</property>
+ <property name="show_title_buttons">False</property>
<child>
<object class="GtkButton" id="button1">
<property name="label" translatable="yes">_Cancel</property>
@@ -78,7 +75,7 @@
<property name="hscrollbar_policy">never</property>
<property name="height_request">250</property>
<child>
- <object class="HdyClamp">
+ <object class="AdwClamp">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="width_request">300</property>
diff --git a/data/ui/world-row.ui b/data/ui/world-row.ui
index 234f9ffa..d6cc3419 100644
--- a/data/ui/world-row.ui
+++ b/data/ui/world-row.ui
@@ -10,7 +10,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
- <property name="margin_left">12</property>
+ <property name="margin_end">12</property>
<property name="margin_right">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
diff --git a/data/ui/world-standalone.ui b/data/ui/world-standalone.ui
index 46667d7d..9c36a684 100644
--- a/data/ui/world-standalone.ui
+++ b/data/ui/world-standalone.ui
@@ -1,12 +1,11 @@
<?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">
+ <object class="AdwHeaderBar">
<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" />
diff --git a/meson.build b/meson.build
index 2c738e67..d46079b0 100644
--- a/meson.build
+++ b/meson.build
@@ -13,34 +13,14 @@ python3 = import('python3')
glib = dependency('glib-2.0', version: '>= 2.68')
gio = dependency('gio-2.0', version: '>= 2.58')
gobject = dependency('gobject-2.0', version: '>= 2.58')
-gtk = dependency('gtk4')
+gtk = dependency('gtk4', version: '>= 4.5')
gsound = dependency('gsound', version: '>=0.98')
-gweather = dependency('gweather-4.0')
-gnomedesktop = dependency('gnome-desktop-4.0')
+gweather = dependency('gweather4')
+gnomedesktop = dependency('gnome-desktop-4')
geocodeglib = dependency('geocode-glib-1.0', version: '>=1.0')
libgeoclue = dependency('libgeoclue-2.0', version: '>=2.4')
libadwaita = dependency ('libadwaita-1', version: '>=1.0')
-# libhandy_subproj = libhandy
-# if not libhandy.found()
-# libhandy_subproj = subproject(
-# 'libhandy',
-# default_options: [
-# 'examples=false',
-# 'glade_catalog=disabled',
-# 'tests=false',
-# ]
-# )
-
- # When using libhandy as subproject, make sure we get the VAPI file
-# libhandy = declare_dependency(
-# dependencies: [
-# libhandy_subproj.get_variable('libhandy_dep'),
-# libhandy_subproj.get_variable('libhandy_vapi'),
-# ]
-# )
-# endif
-
cc = meson.get_compiler('c')
math = cc.find_library('m', required: false)
diff --git a/src/alarm-face.vala b/src/alarm-face.vala
index 866eb37f..04728ab3 100644
--- a/src/alarm-face.vala
+++ b/src/alarm-face.vala
@@ -21,7 +21,7 @@ namespace Clocks {
namespace Alarm {
[GtkTemplate (ui = "/org/gnome/clocks/ui/alarm-face.ui")]
-public class Face : Gtk.Stack, Clocks.Clock {
+public class Face : Adw.Bin, Clocks.Clock {
public PanelId panel_id { get; construct set; }
public ButtonMode button_mode { get; set; default = NEW; }
// Translators: Tooltip for the + button
@@ -35,6 +35,8 @@ public class Face : Gtk.Stack, Clocks.Clock {
private unowned Gtk.ListBox listbox;
[GtkChild]
private unowned Gtk.ScrolledWindow list_view;
+ [GtkChild]
+ private unowned Gtk.Stack stack;
construct {
panel_id = ALARM;
@@ -133,7 +135,7 @@ public class Face : Gtk.Stack, Clocks.Clock {
}
private void reset_view () {
- visible_child = alarms.get_n_items () == 0 ? empty_view : list_view;
+ stack.visible_child = alarms.get_n_items () == 0 ? empty_view : list_view;
}
public void activate_new () {
diff --git a/src/alarm-setup-dialog.vala b/src/alarm-setup-dialog.vala
index 96cd63cf..b53543a4 100644
--- a/src/alarm-setup-dialog.vala
+++ b/src/alarm-setup-dialog.vala
@@ -129,13 +129,16 @@ private class SetupDialog : Gtk.Dialog {
duration_model = new DurationModel ();
- ring_duration.bind_name_model (duration_model, (item) => {
- return ((Duration) item).label;
- });
+ ring_duration.set_model (duration_model);
+ snooze_duration.set_model (duration_model);
- snooze_duration.bind_name_model (duration_model, (item) => {
- return ((Duration) item).label;
- });
+ // ring_duration.bind_name_model (duration_model, (item) => {
+ // return ((Duration) item).label;
+ // });
+
+ // snooze_duration.bind_name_model (duration_model, (item) => {
+ // return ((Duration) item).label;
+ // });
// Force LTR since we do not want to reverse [hh] : [mm]
time_grid.set_direction (Gtk.TextDirection.LTR);
@@ -154,7 +157,7 @@ private class SetupDialog : Gtk.Dialog {
am_pm_button.vexpand = false;
am_pm_button.halign = Gtk.Align.CENTER;
am_pm_button.valign = Gtk.Align.CENTER;
- am_pm_stack.add (am_pm_button);
+ am_pm_stack.add_child (am_pm_button);
am_pm_stack.visible_child = am_pm_button;
}
@@ -204,8 +207,8 @@ private class SetupDialog : Gtk.Dialog {
hour = 12;
}
}
- ring_duration.set_selected_index (duration_model.find_by_duration (ring_minutes));
- snooze_duration.set_selected_index (duration_model.find_by_duration (snooze_minutes));
+ ring_duration.set_selected (duration_model.find_by_duration (ring_minutes));
+ snooze_duration.set_selected (duration_model.find_by_duration (snooze_minutes));
h_spinbutton.set_value (hour);
m_spinbutton.set_value (minute);
@@ -223,8 +226,8 @@ private class SetupDialog : Gtk.Dialog {
var name = name_entry.get_text ();
var hour = h_spinbutton.get_value_as_int ();
var minute = m_spinbutton.get_value_as_int ();
- var snooze_item = (Duration) duration_model.get_item (snooze_duration.get_selected_index ());
- var ring_item = (Duration) duration_model.get_item (ring_duration.get_selected_index ());
+ var snooze_item = (Duration) duration_model.get_item (snooze_duration.get_selected ());
+ var ring_item = (Duration) duration_model.get_item (ring_duration.get_selected ());
if (format == Utils.WallClock.Format.TWELVE) {
var choice = am_pm_button.choice;
diff --git a/src/application.vala b/src/application.vala
index b7512872..337b6018 100644
--- a/src/application.vala
+++ b/src/application.vala
@@ -98,11 +98,11 @@ public class Application : Gtk.Application {
var win = ensure_window ();
win.present ();
- win.focus_in_event.connect (() => {
- withdraw_notifications ();
-
- return false;
- });
+ // TODO GTK 4
+ // win.focus_in_event.connect (() => {
+ // withdraw_notifications ();
+ // return false;
+ // });
}
private void update_theme (Gtk.Settings settings) {
@@ -121,7 +121,7 @@ public class Application : Gtk.Application {
set_resource_base_path ("/org/gnome/clocks/");
- var theme = Gtk.IconTheme.get_default ();
+ var theme = Gtk.IconTheme.get_for_display (Gdk.Display.get_default ());
theme.add_resource_path ("/org/gnome/clocks/icons");
var settings = (Gtk.Settings) Gtk.Settings.get_default ();
diff --git a/src/geocoding.vala b/src/geocoding.vala
index 11d47065..ba6d6a92 100644
--- a/src/geocoding.vala
+++ b/src/geocoding.vala
@@ -102,27 +102,28 @@ public class Info : Object {
}
}
- var locations = location.get_children ();
- for (int i = 0; i < locations.length; i++) {
- if (locations[i].get_level () == GWeather.LocationLevel.CITY) {
- if (locations[i].has_coords ()) {
- double latitude, longitude, distance;
-
- locations[i].get_coords (out latitude, out longitude);
- distance = get_distance (((GClue.Location) geo_location).latitude,
- ((GClue.Location) geo_location).longitude,
- latitude,
- longitude);
-
- if (distance < minimal_distance) {
- found_location = locations[i];
- minimal_distance = distance;
- }
- }
- }
-
- yield search_locations (locations[i]);
- }
+ // TODO GTK 4
+ // var locations = location.get_children ();
+ // for (int i = 0; i < locations.length; i++) {
+ // if (locations[i].get_level () == GWeather.LocationLevel.CITY) {
+ // if (locations[i].has_coords ()) {
+ // double latitude, longitude, distance;
+ //
+ // locations[i].get_coords (out latitude, out longitude);
+ // distance = get_distance (((GClue.Location) geo_location).latitude,
+ // ((GClue.Location) geo_location).longitude,
+ // latitude,
+ // longitude);
+ //
+ // if (distance < minimal_distance) {
+ // found_location = locations[i];
+ // minimal_distance = distance;
+ // }
+ // }
+ // }
+ //
+ // yield search_locations (locations[i]);
+ // }
}
public bool is_location_similar (GWeather.Location location) {
@@ -133,13 +134,14 @@ public class Info : Object {
var timezone = location.get_timezone ();
var found_timezone = ((GWeather.Location) found_location).get_timezone ();
- if (timezone != null && found_timezone != null) {
- var tzid = ((GWeather.Timezone) timezone).get_tzid ();
- var found_tzid = ((GWeather.Timezone) found_timezone).get_tzid ();
- if (tzid == found_tzid) {
- return true;
- }
- }
+ // TODO GTK 4
+ // if (timezone != null && found_timezone != null) {
+ // var tzid = ((GWeather.Timezone) timezone).get_tzid ();
+ // var found_tzid = ((GWeather.Timezone) found_timezone).get_tzid ();
+ // if (tzid == found_tzid) {
+ // return true;
+ // }
+ // }
}
}
diff --git a/src/header-bar.vala b/src/header-bar.vala
index fc908850..86ea0411 100644
--- a/src/header-bar.vala
+++ b/src/header-bar.vala
@@ -25,7 +25,7 @@ public enum Clocks.ButtonMode {
}
[GtkTemplate (ui = "/org/gnome/clocks/ui/header-bar.ui")]
-public class Clocks.HeaderBar : Adw.HeaderBar {
+public class Clocks.HeaderBar : Adw.Bin {
public ButtonMode button_mode {
get {
return _button_mode;
diff --git a/src/meson.build b/src/meson.build
index fb3397e2..61bf1abd 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -51,7 +51,7 @@ clocks_vala_args = [
'--target-glib', '2.58',
'--vapidir', meson.current_source_dir(),
'--gresources', resource_files,
- '--enable-experimental-non-null',
+ # '--enable-experimental-non-null',
'--disable-since-check',
]
diff --git a/src/search-provider.vala b/src/search-provider.vala
index f2d2f929..31b4bd36 100644
--- a/src/search-provider.vala
+++ b/src/search-provider.vala
@@ -75,17 +75,18 @@ public class SearchProvider : Object {
private async void search_locations_recurse (GWeather.Location location, string[] normalized_terms,
GenericArray<GWeather.Location> matches) {
- var locations = location.get_children ();
- foreach (var child_location in locations) {
- var level = child_location.get_level ();
- if (level == CITY || level == NAMED_TIMEZONE) {
- if (location_matches (child_location, normalized_terms)) {
- matches.add (child_location);
- }
- }
-
- yield search_locations_recurse (child_location, normalized_terms, matches);
- }
+ // TODO GTK 4
+ // var locations = location.get_children ();
+ // foreach (var child_location in locations) {
+ // var level = child_location.get_level ();
+ // if (level == CITY || level == NAMED_TIMEZONE) {
+ // if (location_matches (child_location, normalized_terms)) {
+ // matches.add (child_location);
+ // }
+ // }
+ //
+ // yield search_locations_recurse (child_location, normalized_terms, matches);
+ // }
}
private async string[] search_locations (string[] normalized_terms) {
@@ -103,10 +104,11 @@ public class SearchProvider : Object {
string[] result = {};
matches.foreach ((location) => {
// FIXME: Avoid cities without children locations
- if (location.get_level () == GWeather.LocationLevel.CITY &&
- location.get_children ().length == 0) {
- return;
- }
+ // TODO GTK 4
+ // if (location.get_level () == GWeather.LocationLevel.CITY &&
+ // location.get_children ().length == 0) {
+ // return;
+ // }
// HACK: the search provider interface does not currently allow variants as result IDs
result += serialize_location (location);
});
diff --git a/src/timer-face.vala b/src/timer-face.vala
index 2a89687d..09bc6b47 100644
--- a/src/timer-face.vala
+++ b/src/timer-face.vala
@@ -21,7 +21,7 @@ namespace Clocks {
namespace Timer {
[GtkTemplate (ui = "/org/gnome/clocks/ui/timer-face.ui")]
-public class Face : Gtk.Stack, Clocks.Clock {
+public class Face : Adw.Bin, Clocks.Clock {
private Setup timer_setup;
[GtkChild]
private unowned Gtk.ListBox timers_list;
@@ -29,6 +29,8 @@ public class Face : Gtk.Stack, Clocks.Clock {
private unowned Gtk.Box no_timer_container;
[GtkChild]
private unowned Gtk.Button start_button;
+ [GtkChild]
+ private unowned Gtk.Stack stack;
public PanelId panel_id { get; construct set; }
public ButtonMode button_mode { get; set; default = NONE; }
@@ -43,7 +45,7 @@ public class Face : Gtk.Stack, Clocks.Clock {
construct {
panel_id = TIMER;
- transition_type = CROSSFADE;
+ stack.transition_type = CROSSFADE;
timer_setup = new Setup ();
settings = new GLib.Settings ("org.gnome.clocks");
@@ -62,10 +64,10 @@ public class Face : Gtk.Stack, Clocks.Clock {
timers.items_changed.connect ( (added, removed, position) => {
if (this.timers.get_n_items () > 0) {
- this.visible_child_name = "timers";
+ stack.visible_child_name = "timers";
this.button_mode = NEW;
} else {
- this.visible_child_name = "empty";
+ stack.visible_child_name = "empty";
this.button_mode = NONE;
}
save ();
@@ -78,7 +80,7 @@ public class Face : Gtk.Stack, Clocks.Clock {
var no_timer_container_first_child = no_timer_container.get_first_child ();
no_timer_container.insert_child_after (timer_setup, no_timer_container_first_child);
- set_visible_child_name ("empty");
+ stack.set_visible_child_name ("empty");
start_button.set_sensitive (false);
timer_setup.duration_changed.connect ((duration) => {
diff --git a/src/utils.vala b/src/utils.vala
index bfe5db56..78842082 100644
--- a/src/utils.vala
+++ b/src/utils.vala
@@ -40,10 +40,11 @@ public void load_css (string css) {
var provider = new Gtk.CssProvider ();
try {
var data = resources_lookup_data ("/org/gnome/clocks/css/" + css + ".css", NONE);
- provider.load_from_data ((string) data.get_data ());
+ provider.load_from_data (data.get_data ());
Gtk.StyleContext.add_provider_for_display (Gdk.Display.get_default (),
provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
+
} catch (ResourceError.NOT_FOUND e) {
/* Ignore */
} catch (Error e) {
diff --git a/src/world-face.vala b/src/world-face.vala
index cb94af68..13f3baa1 100644
--- a/src/world-face.vala
+++ b/src/world-face.vala
@@ -20,7 +20,7 @@ namespace Clocks {
namespace World {
[GtkTemplate (ui = "/org/gnome/clocks/ui/world-face.ui")]
-public class Face : Gtk.Stack, Clocks.Clock {
+public class Face : Adw.Bin, Clocks.Clock {
public signal void show_standalone (Item location);
public PanelId panel_id { get; construct set; }
@@ -36,21 +36,24 @@ public class Face : Gtk.Stack, Clocks.Clock {
private unowned Gtk.ScrolledWindow list_view;
[GtkChild]
private unowned Gtk.ListBox listbox;
+ [GtkChild]
+ private unowned Gtk.Stack stack;
construct {
panel_id = WORLD;
- transition_type = CROSSFADE;
+ stack.transition_type = CROSSFADE;
locations = new ContentStore ();
settings = new GLib.Settings ("org.gnome.clocks");
locations.set_sorting ((item1, item2) => {
- var offset1 = ((GWeather.Timezone) ((Item) item1).location.get_timezone ()).get_offset ();
- var offset2 = ((GWeather.Timezone) ((Item) item2).location.get_timezone ()).get_offset ();
- if (offset1 < offset2)
- return -1;
- if (offset1 > offset2)
- return 1;
+ // TODO GTK 4
+ // var offset1 = ((GWeather.Timezone) ((Item) item1).location.get_timezone ()).get_offset ();
+ // var offset2 = ((GWeather.Timezone) ((Item) item2).location.get_timezone ()).get_offset ();
+ // if (offset1 < offset2)
+ // return -1;
+ // if (offset1 > offset2)
+ // return 1;
return 0;
});
@@ -161,7 +164,7 @@ public class Face : Gtk.Stack, Clocks.Clock {
}
private void reset_view () {
- visible_child = locations.get_n_items () == 0 ? empty_view : list_view;
+ stack.visible_child = locations.get_n_items () == 0 ? empty_view : list_view;
}
}
diff --git a/src/world-location-dialog-row.vala b/src/world-location-dialog-row.vala
index 0babc988..47dd8686 100644
--- a/src/world-location-dialog-row.vala
+++ b/src/world-location-dialog-row.vala
@@ -38,17 +38,18 @@ private class LocationDialogRow : Gtk.ListBoxRow {
var local_time = wallclock.date_time;
var weather_time_zone = data.location.get_timezone ();
if (weather_time_zone != null) {
- var time_zone = new TimeZone.identifier (((GWeather.Timezone) weather_time_zone).get_tzid ());
- var date_time = local_time.to_timezone (time_zone);
- var local_offset = local_time.get_utc_offset () - date_time.get_utc_offset ();
- var time_diff_message = Utils.get_time_difference_message (local_offset);
- var time_zone_name = ((GWeather.Timezone) weather_time_zone).get_name ();
-
- if ((string?) time_zone_name != null) {
- clock_description = "%s • %s".printf (time_zone_name, time_diff_message);
- } else {
- clock_description = "%s".printf (time_diff_message);
- }
+ // TODO GTK 4
+ // var time_zone = new TimeZone.identifier (((GWeather.Timezone) weather_time_zone).get_tzid ());
+ // var date_time = local_time.to_timezone (time_zone);
+ // var local_offset = local_time.get_utc_offset () - date_time.get_utc_offset ();
+ // var time_diff_message = Utils.get_time_difference_message (local_offset);
+ // var time_zone_name = ((GWeather.Timezone) weather_time_zone).get_name ();
+ //
+ // if ((string?) time_zone_name != null) {
+ // clock_description = "%s • %s".printf (time_zone_name, time_diff_message);
+ // } else {
+ // clock_description = "%s".printf (time_diff_message);
+ // }
} else {
clock_description = null;
}
diff --git a/src/world-location-dialog.vala b/src/world-location-dialog.vala
index 86ca7cc5..7e288052 100644
--- a/src/world-location-dialog.vala
+++ b/src/world-location-dialog.vala
@@ -58,11 +58,12 @@ private class LocationDialog : Gtk.Dialog {
public LocationDialog (Gtk.Window parent, Face world_face) {
Object (transient_for: parent, use_header_bar: 1);
- key_press_event.connect ((event) => {
- if (event.keyval == Gdk.Key.Tab)
- return Gdk.EVENT_PROPAGATE;
- return location_entry.handle_event (event);
- });
+ // TODO GTK 4
+ // key_press_event.connect ((event) => {
+ // if (event.keyval == Gdk.Key.Tab)
+ // return Gdk.EVENT_PROPAGATE;
+ // return location_entry.handle_event (event);
+ // });
world = world_face;
@@ -143,10 +144,11 @@ private class LocationDialog : Gtk.Dialog {
string? timezone_name = null;
var timezone = location.get_timezone ();
if (timezone != null) {
- timezone_name = ((GWeather.Timezone) timezone).get_name ();
- if (timezone_name != null) {
- timezone_name = ((string) timezone_name).normalize ().casefold ();
- }
+ // TODO GTK 4
+ // timezone_name = ((GWeather.Timezone) timezone).get_name ();
+ // if (timezone_name != null) {
+ // timezone_name = ((string) timezone_name).normalize ().casefold ();
+ // }
}
var contains_timezone_name = timezone_name != null && ((string) timezone_name).contains
(search);
@@ -164,12 +166,13 @@ private class LocationDialog : Gtk.Dialog {
default:
break;
}
- foreach (var child in location.get_children ()) {
- query_locations (child, search);
- if (locations.get_n_items () >= RESULT_COUNT_LIMIT) {
- return;
- }
- }
+ // TODO GTK 4
+ // foreach (var child in location.get_children ()) {
+ // query_locations (child, search);
+ // if (locations.get_n_items () >= RESULT_COUNT_LIMIT) {
+ // return;
+ // }
+ // }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]