summaryrefslogtreecommitdiff
path: root/applets/clock
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-07-22 21:17:20 +0200
committerlukefromdc <[email protected]>2020-08-01 00:23:57 -0400
commit04e977defeb858ac58ab3d470ec735ec0e2ea922 (patch)
tree32dbb9446743cd0c1c416c279687e8b2d1ce6288 /applets/clock
parent1d14ccccc6a44b348a0e166a947388d41a411e64 (diff)
downloadmate-panel-04e977defeb858ac58ab3d470ec735ec0e2ea922.tar.bz2
mate-panel-04e977defeb858ac58ab3d470ec735ec0e2ea922.tar.xz
clock: Use single-linked lists for locations
Diffstat (limited to 'applets/clock')
-rw-r--r--applets/clock/clock-location.c4
-rw-r--r--applets/clock/clock-location.h2
-rw-r--r--applets/clock/clock-map.c4
-rw-r--r--applets/clock/clock-map.h2
-rw-r--r--applets/clock/clock.c78
5 files changed, 45 insertions, 45 deletions
diff --git a/applets/clock/clock-location.c b/applets/clock/clock-location.c
index a983872c..1808c0dd 100644
--- a/applets/clock/clock-location.c
+++ b/applets/clock/clock-location.c
@@ -67,7 +67,7 @@ static void setup_weather_updates (ClockLocation *loc);
static gchar *clock_location_get_valid_weather_code (const gchar *code);
ClockLocation *
-clock_location_find_and_ref (GList *locations,
+clock_location_find_and_ref (GSList *locations,
const gchar *name,
const gchar *city,
const gchar *timezone,
@@ -75,7 +75,7 @@ clock_location_find_and_ref (GList *locations,
gfloat longitude,
const gchar *code)
{
- GList *l;
+ GSList *l;
ClockLocationPrivate *priv;
for (l = locations; l != NULL; l = l->next) {
diff --git a/applets/clock/clock-location.h b/applets/clock/clock-location.h
index c12072ff..9e56b5ca 100644
--- a/applets/clock/clock-location.h
+++ b/applets/clock/clock-location.h
@@ -39,7 +39,7 @@ ClockLocation *clock_location_new (const gchar *name, const gchar *city,
const gchar *code,
WeatherPrefs *prefs);
-ClockLocation *clock_location_find_and_ref (GList *locations,
+ClockLocation *clock_location_find_and_ref (GSList *locations,
const gchar *name,
const gchar *city,
const gchar *timezone,
diff --git a/applets/clock/clock-map.c b/applets/clock/clock-map.c
index 0c371ca1..1aa2202e 100644
--- a/applets/clock/clock-map.c
+++ b/applets/clock/clock-map.c
@@ -100,7 +100,7 @@ clock_map_class_init (ClockMapClass *this_class)
* The map widget emits this signal when it needs to know which
* locations to display.
*
- * Returns: the handler should return a (GList *) of (ClockLocation *).
+ * Returns: the handler should return a (GSList *) of (ClockLocation *).
* The map widget will not modify this list, so the caller should keep
* it alive.
*/
@@ -429,7 +429,7 @@ static void
clock_map_place_locations (ClockMap *this)
{
ClockMapPrivate *priv = clock_map_get_instance_private (this);
- GList *locs;
+ GSList *locs;
ClockLocation *loc;
if (priv->location_map_pixbuf) {
diff --git a/applets/clock/clock-map.h b/applets/clock/clock-map.h
index 2b662c87..0df4a416 100644
--- a/applets/clock/clock-map.h
+++ b/applets/clock/clock-map.h
@@ -26,7 +26,7 @@ typedef struct
{
GtkWidgetClass parent_class;
- GList *(* need_locations) (ClockMap *map);
+ GSList *(* need_locations) (ClockMap *map);
} ClockMapClass;
GType clock_map_get_type (void);
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index d8368704..4833be06 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -155,8 +155,8 @@ struct _ClockData {
SpeedUnit speed_unit;
/* Locations */
- GList *locations;
- GList *location_tiles;
+ GSList *locations;
+ GSList *location_tiles;
/* runtime data */
time_t current_time;
@@ -527,7 +527,7 @@ set_atk_name_description (GtkWidget *widget,
static void
update_location_tiles (ClockData *cd)
{
- GList *l;
+ GSList *l;
for (l = cd->location_tiles; l; l = l->next) {
ClockLocationTile *tile;
@@ -740,12 +740,12 @@ static void
free_locations (ClockData *cd)
{
if (cd->locations != NULL) {
- GList *l;
+ GSList *l;
for (l = cd->locations; l; l = l->next)
g_object_unref (l->data);
- g_list_free (cd->locations);
+ g_slist_free (cd->locations);
}
cd->locations = NULL;
}
@@ -782,7 +782,7 @@ destroy_clock (GtkWidget * widget, ClockData *cd)
free_locations (cd);
if (cd->location_tiles)
- g_list_free (cd->location_tiles);
+ g_slist_free (cd->location_tiles);
cd->location_tiles = NULL;
if (cd->systz) {
@@ -1020,9 +1020,9 @@ static void
create_cities_store (ClockData *cd)
{
GtkTreeIter iter;
- GList *cities = cd->locations;
- GList *list = NULL;
- GList *l;
+ GSList *cities = cd->locations;
+ GSList *list = NULL;
+ GSList *l;
if (cd->cities_store) {
g_object_unref (G_OBJECT (cd->cities_store));
@@ -1035,8 +1035,8 @@ create_cities_store (ClockData *cd)
G_TYPE_STRING, /* COL_CITY_TZ */
CLOCK_LOCATION_TYPE); /* COL_CITY_LOC */
- list = g_list_copy (cities);
- list = g_list_sort (list, sort_locations_by_name);
+ list = g_slist_copy (cities);
+ list = g_slist_sort (list, sort_locations_by_name);
for (l = list; l; l = l->next) {
ClockLocation *loc = CLOCK_LOCATION (l->data);
@@ -1049,7 +1049,7 @@ create_cities_store (ClockData *cd)
COL_CITY_LOC, loc,
-1);
}
- g_list_free (list);
+ g_slist_free (list);
if (cd->prefs_window) {
@@ -1151,10 +1151,10 @@ location_tile_need_clock_format_cb(ClockLocationTile *tile, gpointer data)
static void
create_cities_section (ClockData *cd)
{
- GList *node;
+ GSList *node;
ClockLocationTile *city;
- GList *cities;
- GList *l;
+ GSList *cities;
+ GSList *l;
if (cd->cities_section) {
gtk_widget_destroy (cd->cities_section);
@@ -1162,14 +1162,14 @@ create_cities_section (ClockData *cd)
}
if (cd->location_tiles)
- g_list_free (cd->location_tiles);
+ g_slist_free (cd->location_tiles);
cd->location_tiles = NULL;
cd->cities_section = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_container_set_border_width (GTK_CONTAINER (cd->cities_section), 0);
cities = cd->locations;
- if (g_list_length (cities) == 0) {
+ if (g_slist_length (cities) == 0) {
/* if the list is empty, don't bother showing the
cities section */
gtk_widget_hide (cd->cities_section);
@@ -1180,7 +1180,7 @@ create_cities_section (ClockData *cd)
node = g_list_copy (cities);
node = g_list_sort (node, sort_locations_by_time_reverse_and_name);
- for (l = node; l; l = g_list_next (l)) {
+ for (l = node; l; l = g_slist_next (l)) {
ClockLocation *loc = l->data;
city = clock_location_tile_new (loc, CLOCK_FACE_SMALL);
@@ -1193,12 +1193,12 @@ create_cities_section (ClockData *cd)
GTK_WIDGET (city),
FALSE, FALSE, 0);
- cd->location_tiles = g_list_prepend (cd->location_tiles, city);
+ cd->location_tiles = g_slist_prepend (cd->location_tiles, city);
clock_location_tile_refresh (city, TRUE);
}
- g_list_free (node);
+ g_slist_free (node);
gtk_box_pack_end (GTK_BOX (cd->clock_vbox),
cd->cities_section, FALSE, FALSE, 0);
@@ -1206,7 +1206,7 @@ create_cities_section (ClockData *cd)
gtk_widget_show_all (cd->cities_section);
}
-static GList *
+static GSList *
map_need_locations_cb (ClockMap *map, gpointer data)
{
ClockData *cd = data;
@@ -1251,7 +1251,7 @@ update_calendar_popup (ClockData *cd)
cd->clock_vbox = NULL;
if (cd->location_tiles)
- g_list_free (cd->location_tiles);
+ g_slist_free (cd->location_tiles);
cd->location_tiles = NULL;
}
update_tooltip (cd);
@@ -1395,7 +1395,7 @@ weather_tooltip (GtkWidget *widget,
GtkTooltip *tooltip,
ClockData *cd)
{
- GList *locations, *l;
+ GSList *locations, *l;
WeatherInfo *info;
locations = cd->locations;
@@ -1979,7 +1979,7 @@ update_panel_weather (ClockData *cd)
gtk_widget_hide (cd->panel_temperature_label);
if ((cd->show_weather || cd->show_temperature) &&
- g_list_length (cd->locations) > 0)
+ g_slist_length (cd->locations) > 0)
gtk_widget_show (cd->weather_obox);
else
gtk_widget_hide (cd->weather_obox);
@@ -2131,7 +2131,7 @@ location_set_current_cb (ClockLocation *loc,
static void
locations_changed (ClockData *cd)
{
- GList *l;
+ GSList *l;
ClockLocation *loc;
glong id;
@@ -2171,7 +2171,7 @@ locations_changed (ClockData *cd)
static void
-set_locations (ClockData *cd, GList *locations)
+set_locations (ClockData *cd, GSList *locations)
{
free_locations (cd);
cd->locations = locations;
@@ -2179,7 +2179,7 @@ set_locations (ClockData *cd, GList *locations)
}
typedef struct {
- GList *cities;
+ GSList *cities;
ClockData *cd;
} LocationParserData;
@@ -2258,7 +2258,7 @@ location_start_element (GMarkupParseContext *context,
if (current && clock_location_is_current_timezone (loc))
clock_location_make_current (loc, NULL, NULL, NULL);
- data->cities = g_list_append (data->cities, loc);
+ data->cities = g_slist_append (data->cities, loc);
}
static GMarkupParser location_parser = {
@@ -2298,7 +2298,7 @@ cities_changed (GSettings *settings,
static void
update_weather_locations (ClockData *cd)
{
- GList *locations, *l;
+ GSList *locations, *l;
WeatherPrefs prefs = {
FORECAST_STATE,
FALSE,
@@ -2429,7 +2429,7 @@ setup_gsettings (ClockData *cd)
g_signal_connect (cd->settings, "changed::" KEY_SPEED_UNIT, G_CALLBACK (speed_unit_changed), cd);
}
-static GList *
+static GSList *
parse_gsettings_cities (ClockData *cd, gchar **values)
{
gint i;
@@ -2456,7 +2456,7 @@ static void
load_gsettings (ClockData *cd)
{
gchar **values;
- GList *cities = NULL;
+ GSList *cities = NULL;
cd->format = g_settings_get_enum (cd->settings, KEY_FORMAT);
@@ -2611,16 +2611,16 @@ loc_to_string (ClockLocation *loc)
static void
save_cities_store (ClockData *cd)
{
- GList *locs = NULL;
- GList *node;
+ GSList *locs = NULL;
+ GSList *node;
for (node = cd->locations; node != NULL; node = node->next) {
- locs = g_list_prepend (locs, loc_to_string (CLOCK_LOCATION (node->data)));
+ locs = g_slist_prepend (locs, loc_to_string (CLOCK_LOCATION (node->data)));
}
- locs = g_list_reverse (locs);
- mate_panel_applet_settings_set_glist (cd->settings, KEY_CITIES, locs);
- g_list_free_full (locs, g_free);
+ locs = g_slist_reverse (locs);
+ mate_panel_applet_settings_set_gslist (cd->settings, KEY_CITIES, locs);
+ g_slist_free_full (locs, g_free);
}
static void
@@ -2691,7 +2691,7 @@ run_prefs_edit_save (GtkButton *button, ClockData *cd)
*/
clock_location_is_current (loc);
- cd->locations = g_list_append (cd->locations, loc);
+ cd->locations = g_slist_append (cd->locations, loc);
}
g_free (name);
g_free (city);
@@ -2892,7 +2892,7 @@ remove_tree_row (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpoi
ClockLocation *loc = NULL;
gtk_tree_model_get (model, iter, COL_CITY_LOC, &loc, -1);
- cd->locations = g_list_remove (cd->locations, loc);
+ cd->locations = g_slist_remove (cd->locations, loc);
g_object_unref (loc);
/* This will update everything related to locations to take into