[gnome-panel/wip/muktupavels/gweather-4] clock: switch to ClockLocationEntry and ClockTimezoneMenu
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/wip/muktupavels/gweather-4] clock: switch to ClockLocationEntry and ClockTimezoneMenu
- Date: Mon, 28 Feb 2022 10:53:22 +0000 (UTC)
commit 784e641e31af358c91bd114e788d5c3bf011391b
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Mon Feb 28 12:49:08 2022 +0200
clock: switch to ClockLocationEntry and ClockTimezoneMenu
modules/clock/clock-applet.c | 42 ++++++++++++++++++++++--------------------
1 file changed, 22 insertions(+), 20 deletions(-)
---
diff --git a/modules/clock/clock-applet.c b/modules/clock/clock-applet.c
index 81ba8d8f7..7cca6adbe 100644
--- a/modules/clock/clock-applet.c
+++ b/modules/clock/clock-applet.c
@@ -55,8 +55,10 @@
#include "calendar-window.h"
#include "clock-location.h"
+#include "clock-location-entry.h"
#include "clock-location-tile.h"
#include "clock-map.h"
+#include "clock-timezone-menu.h"
#include "clock-utils.h"
enum {
@@ -88,8 +90,8 @@ struct _ClockApplet
GtkWidget *prefs_location_edit_button;
GtkWidget *prefs_location_remove_button;
- GWeatherLocationEntry *location_entry;
- GWeatherTimezoneMenu *zone_combo;
+ ClockLocationEntry *location_entry;
+ ClockTimezoneMenu *zone_combo;
GtkWidget *time_settings_button;
GAppInfo *datetime_appinfo;
@@ -1076,8 +1078,8 @@ edit_clear (ClockApplet *cd)
GtkWidget *lon_combo = _clock_get_widget (cd, "edit-location-longitude-combo");
/* clear out the old data */
- gweather_location_entry_set_location (cd->location_entry, NULL);
- gweather_timezone_menu_set_tzid (cd->zone_combo, NULL);
+ clock_location_entry_set_location (cd->location_entry, NULL);
+ clock_timezone_menu_set_tzid (cd->zone_combo, NULL);
gtk_entry_set_text (GTK_ENTRY (lat_entry), "");
gtk_entry_set_text (GTK_ENTRY (lon_entry), "");
@@ -1152,7 +1154,7 @@ run_prefs_edit_save (GtkButton *button,
g_object_unref (loc);
}
- timezone = gweather_timezone_menu_get_tzid (cd->zone_combo);
+ timezone = clock_timezone_menu_get_tzid (cd->zone_combo);
if (!timezone) {
edit_hide (NULL, cd);
return;
@@ -1162,7 +1164,7 @@ run_prefs_edit_save (GtkButton *button,
weather_code = NULL;
name = NULL;
- gloc = gweather_location_entry_get_location (cd->location_entry);
+ gloc = clock_location_entry_get_location (cd->location_entry);
if (!gloc) {
edit_hide (NULL, cd);
return;
@@ -1174,7 +1176,7 @@ run_prefs_edit_save (GtkButton *button,
weather_code = gweather_location_get_code (station_loc);
gweather_location_unref (station_loc);
- if (gweather_location_entry_has_custom_text (cd->location_entry)) {
+ if (clock_location_entry_has_custom_text (cd->location_entry)) {
name = gtk_editable_get_chars (GTK_EDITABLE (cd->location_entry), 0, -1);
}
@@ -1259,10 +1261,10 @@ fill_timezone_combo_from_location (ClockApplet *cd,
ClockLocation *loc)
{
if (loc != NULL) {
- gweather_timezone_menu_set_tzid (cd->zone_combo,
- clock_location_get_timezone (loc));
+ clock_timezone_menu_set_tzid (cd->zone_combo,
+ clock_location_get_timezone (loc));
} else {
- gweather_timezone_menu_set_tzid (cd->zone_combo, NULL);
+ clock_timezone_menu_set_tzid (cd->zone_combo, NULL);
}
}
@@ -1275,7 +1277,7 @@ location_update_ok_sensitivity (ClockApplet *cd)
ok_button = _clock_get_widget (cd, "edit-location-ok-button");
- timezone = gweather_timezone_menu_get_tzid (cd->zone_combo);
+ timezone = clock_timezone_menu_get_tzid (cd->zone_combo);
name = gtk_editable_get_chars (GTK_EDITABLE (cd->location_entry), 0, -1);
if (timezone && name && name[0] != '\0') {
@@ -1292,13 +1294,13 @@ location_changed (GObject *object,
GParamSpec *param,
ClockApplet *cd)
{
- GWeatherLocationEntry *entry = GWEATHER_LOCATION_ENTRY (object);
+ ClockLocationEntry *entry = CLOCK_LOCATION_ENTRY (object);
GWeatherLocation *gloc;
GWeatherTimezone *zone;
gboolean latlon_valid;
double latitude = 0.0, longitude = 0.0;
- gloc = gweather_location_entry_get_location (entry);
+ gloc = clock_location_entry_get_location (entry);
latlon_valid = gloc && gweather_location_has_coords (gloc);
if (latlon_valid)
@@ -1307,9 +1309,9 @@ location_changed (GObject *object,
zone = gloc ? gweather_location_get_timezone (gloc) : NULL;
if (zone)
- gweather_timezone_menu_set_tzid (cd->zone_combo, gweather_timezone_get_tzid (zone));
+ clock_timezone_menu_set_tzid (cd->zone_combo, gweather_timezone_get_tzid (zone));
else
- gweather_timezone_menu_set_tzid (cd->zone_combo, NULL);
+ clock_timezone_menu_set_tzid (cd->zone_combo, NULL);
if (gloc)
gweather_location_unref (gloc);
@@ -1453,9 +1455,9 @@ edit_tree_row (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpoint
gtk_tree_model_get (model, iter, COL_CITY_LOC, &loc, -1);
- gweather_location_entry_set_city (cd->location_entry,
- clock_location_get_city (loc),
- clock_location_get_weather_code (loc));
+ clock_location_entry_set_city (cd->location_entry,
+ clock_location_get_city (loc),
+ clock_location_get_weather_code (loc));
name = clock_location_get_name (loc);
if (name && name[0]) {
gtk_entry_set_text (GTK_ENTRY (cd->location_entry), name);
@@ -1722,7 +1724,7 @@ ensure_prefs_window_is_created (ClockApplet *cd)
edit_ok_button = _clock_get_widget (cd, "edit-location-ok-button");
location_box = _clock_get_widget (cd, "edit-location-name-box");
- cd->location_entry = GWEATHER_LOCATION_ENTRY (gweather_location_entry_new (cd->world));
+ cd->location_entry = CLOCK_LOCATION_ENTRY (clock_location_entry_new (cd->world));
gtk_widget_show (GTK_WIDGET (cd->location_entry));
gtk_container_add (GTK_CONTAINER (location_box), GTK_WIDGET (cd->location_entry));
gtk_label_set_mnemonic_widget (GTK_LABEL (location_name_label),
@@ -1734,7 +1736,7 @@ ensure_prefs_window_is_created (ClockApplet *cd)
G_CALLBACK (location_name_changed), cd);
zone_box = _clock_get_widget (cd, "edit-location-timezone-box");
- cd->zone_combo = GWEATHER_TIMEZONE_MENU (gweather_timezone_menu_new (cd->world));
+ cd->zone_combo = CLOCK_TIMEZONE_MENU (clock_timezone_menu_new (cd->world));
gtk_widget_show (GTK_WIDGET (cd->zone_combo));
gtk_container_add (GTK_CONTAINER (zone_box), GTK_WIDGET (cd->zone_combo));
gtk_label_set_mnemonic_widget (GTK_LABEL (timezone_label),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]