summaryrefslogtreecommitdiff
path: root/applets/clock/clock-location-tile.c
diff options
context:
space:
mode:
Diffstat (limited to 'applets/clock/clock-location-tile.c')
-rw-r--r--applets/clock/clock-location-tile.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/applets/clock/clock-location-tile.c b/applets/clock/clock-location-tile.c
index 4e0d71a2..385d0da1 100644
--- a/applets/clock/clock-location-tile.c
+++ b/applets/clock/clock-location-tile.c
@@ -82,7 +82,7 @@ clock_location_tile_new (ClockLocation *loc,
g_signal_connect (priv->weather_icon, "query-tooltip",
G_CALLBACK (weather_tooltip), this);
- priv->location_weather_updated_id = g_signal_connect (G_OBJECT (loc), "weather-updated",
+ priv->location_weather_updated_id = g_signal_connect (loc, "weather-updated",
G_CALLBACK (update_weather_icon), this);
return this;
@@ -140,22 +140,22 @@ clock_location_tile_finalize (GObject *g_obj)
priv = clock_location_tile_get_instance_private (this);
if (priv->location) {
- g_signal_handler_disconnect (priv->location, priv->location_weather_updated_id);
- priv->location_weather_updated_id = 0;
-
- g_object_unref (priv->location);
- priv->location = NULL;
- }
+#if GLIB_CHECK_VERSION(2,62,0)
+ g_clear_signal_handler (&priv->location_weather_updated_id,
+ priv->location);
+#else
+ if (priv->location_weather_updated_id != 0) {
+ g_signal_handler_disconnect (priv->location,
+ priv->location_weather_updated_id);
+ priv->location_weather_updated_id = 0;
+ }
+#endif
- if (priv->button_group) {
- g_object_unref (priv->button_group);
- priv->button_group = NULL;
+ g_clear_object (&priv->location);
}
- if (priv->current_group) {
- g_object_unref (priv->current_group);
- priv->current_group = NULL;
- }
+ g_clear_object (&priv->button_group);
+ g_clear_object (&priv->current_group);
G_OBJECT_CLASS (clock_location_tile_parent_class)->finalize (g_obj);
}
@@ -173,14 +173,12 @@ press_on_tile (GtkWidget *widget,
static void
make_current_cb (gpointer data, GError *error)
{
- GtkWidget *dialog;
-
if (error) {
- dialog = gtk_message_dialog_new (NULL,
- 0,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("Failed to set the system timezone"));
+ GtkWidget *dialog = gtk_message_dialog_new (NULL,
+ 0,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ _("Failed to set the system timezone"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", error->message);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
@@ -436,7 +434,7 @@ format_time (struct tm *now,
* weekday differs from the weekday at the location
* (the %A expands to the weekday). The %p expands to
* am/pm. */
- format = _("%l:%M <small>%p (%A)</small>");
+ format = _("%_I:%M <small>%p (%A)</small>");
}
else {
/* Translators: This is a strftime format string.
@@ -453,7 +451,7 @@ format_time (struct tm *now,
* It is used to display the time in 12-hours format
* (eg, like in the US: 8:10 am). The %p expands to
* am/pm. */
- format = _("%l:%M <small>%p</small>");
+ format = _("%_I:%M <small>%p</small>");
}
else {
/* Translators: This is a strftime format string.
@@ -499,7 +497,7 @@ convert_time_to_str (time_t now, ClockFormat clock_format)
* It is used to display the time in 12-hours format (eg, like
* in the US: 8:10 am). The %p expands to am/pm.
*/
- format = _("%l:%M %p");
+ format = _("%_I:%M %p");
}
else {
/* Translators: This is a strftime format string.