diff options
Diffstat (limited to 'applets/clock')
-rw-r--r-- | applets/clock/Makefile.am | 10 | ||||
-rw-r--r-- | applets/clock/calendar-window.c | 24 | ||||
-rw-r--r-- | applets/clock/clock-face.c | 17 | ||||
-rw-r--r-- | applets/clock/clock-face.h | 1 | ||||
-rw-r--r-- | applets/clock/clock-location-tile.c | 28 | ||||
-rw-r--r-- | applets/clock/clock-location.c | 69 | ||||
-rw-r--r-- | applets/clock/clock-map.c | 27 | ||||
-rw-r--r-- | applets/clock/clock-map.h | 1 | ||||
-rw-r--r-- | applets/clock/clock-sunpos.c | 1 | ||||
-rw-r--r-- | applets/clock/clock.c | 579 | ||||
-rw-r--r-- | applets/clock/clock.ui | 640 | ||||
-rw-r--r-- | applets/clock/system-timezone.c | 39 | ||||
-rw-r--r-- | applets/clock/system-timezone.h | 1 |
13 files changed, 785 insertions, 652 deletions
diff --git a/applets/clock/Makefile.am b/applets/clock/Makefile.am index 55f94e93..e145dd5f 100644 --- a/applets/clock/Makefile.am +++ b/applets/clock/Makefile.am @@ -67,6 +67,14 @@ libclock_applet_la_LIBADD = $(CLOCK_LDADD) libclock_applet_la_LDFLAGS = -module -avoid-version libclock_applet_la_CFLAGS = $(AM_CFLAGS) $(libclock_applet_la_OBJECTS): $(BUILT_SOURCES) + +if ENABLE_WAYLAND +libclock_applet_la_LIBADD += \ + $(WAYLAND_LIBS) + +AM_CPPFLAGS += \ + $(WAYLAND_CFLAGS) +endif else APPLET_IN_PROCESS = false APPLET_LOCATION = $(libexecdir)/clock-applet @@ -138,9 +146,9 @@ $(applet_in_files): $(applet_in_files).in Makefile $(applet_DATA): $(applet_in_files) $(AM_V_GEN) $(MSGFMT) --desktop --keyword= --keyword=Name --keyword=Description --template $< -d $(top_srcdir)/po -o $@ +service_in_files = org.mate.panel.applet.ClockAppletFactory.service.in if !CLOCK_INPROCESS servicedir = $(datadir)/dbus-1/services -service_in_files = org.mate.panel.applet.ClockAppletFactory.service.in service_DATA = $(service_in_files:.service.in=.service) org.mate.panel.applet.ClockAppletFactory.service: $(service_in_files) diff --git a/applets/clock/calendar-window.c b/applets/clock/calendar-window.c index 8fe2c77c..b4157344 100644 --- a/applets/clock/calendar-window.c +++ b/applets/clock/calendar-window.c @@ -93,10 +93,10 @@ static void calendar_mark_today(GtkCalendar *calendar) gtk_calendar_get_date(calendar, &year, &month, &day); time(&now); localtime_r (&now, &tm1); - if ((tm1.tm_mon == month) && (tm1.tm_year + 1900 == year)) { - gtk_calendar_mark_day (GTK_CALENDAR (calendar), tm1.tm_mday); + if ((tm1.tm_mon == (int) month) && (tm1.tm_year + 1900 == (int) year)) { + gtk_calendar_mark_day (GTK_CALENDAR (calendar), (guint) tm1.tm_mday); } else { - gtk_calendar_unmark_day (GTK_CALENDAR (calendar), tm1.tm_mday); + gtk_calendar_unmark_day (GTK_CALENDAR (calendar), (guint) tm1.tm_mday); } } @@ -131,8 +131,8 @@ calendar_window_create_calendar (CalendarWindow *calwin) localtime_r (calwin->priv->current_time, &tm1); gtk_calendar_select_month (GTK_CALENDAR (calendar), - tm1.tm_mon, tm1.tm_year + 1900); - gtk_calendar_select_day (GTK_CALENDAR (calendar), tm1.tm_mday); + (guint) tm1.tm_mon, (guint) (tm1.tm_year + 1900)); + gtk_calendar_select_day (GTK_CALENDAR (calendar), (guint) tm1.tm_mday); calendar_mark_today (GTK_CALENDAR(calendar)); g_signal_connect(calendar, "month-changed", @@ -403,6 +403,8 @@ calendar_window_dispose (GObject *object) calwin = CALENDAR_WINDOW (object); + g_clear_pointer (&calwin->priv->prefs_path, g_free); + if (calwin->priv->settings) g_object_unref (calwin->priv->settings); calwin->priv->settings = NULL; @@ -541,8 +543,6 @@ void calendar_window_set_show_weeks (CalendarWindow *calwin, gboolean show_weeks) { - GtkCalendarDisplayOptions options; - g_return_if_fail (CALENDAR_IS_WINDOW (calwin)); if (show_weeks == calwin->priv->show_weeks) @@ -551,6 +551,8 @@ calendar_window_set_show_weeks (CalendarWindow *calwin, calwin->priv->show_weeks = show_weeks; if (calwin->priv->calendar) { + GtkCalendarDisplayOptions options; + options = gtk_calendar_get_display_options (GTK_CALENDAR (calwin->priv->calendar)); if (show_weeks) @@ -617,17 +619,15 @@ calendar_window_set_prefs_path (CalendarWindow *calwin, !strcmp (calwin->priv->prefs_path, prefs_path)) return; - if (calwin->priv->prefs_path) - g_free (calwin->priv->prefs_path); - calwin->priv->prefs_path = NULL; - + g_free (calwin->priv->prefs_path); if (prefs_path && prefs_path [0]) calwin->priv->prefs_path = g_strdup (prefs_path); + else + calwin->priv->prefs_path = NULL; g_object_notify (G_OBJECT (calwin), "prefs-path"); if (calwin->priv->settings) g_object_unref (calwin->priv->settings); - calwin->priv->settings = g_settings_new_with_path (CLOCK_SCHEMA, calwin->priv->prefs_path); } diff --git a/applets/clock/clock-face.c b/applets/clock/clock-face.c index a30afd13..7340c8a8 100644 --- a/applets/clock/clock-face.c +++ b/applets/clock/clock-face.c @@ -369,20 +369,9 @@ clock_face_finalize (GObject *obj) { ClockFacePrivate *priv = clock_face_get_instance_private (CLOCK_FACE(obj)); - if (priv->location) { - g_object_unref (priv->location); - priv->location = NULL; - } - - if (priv->face_pixbuf) { - g_object_unref (priv->face_pixbuf); - priv->face_pixbuf = NULL; - } - - if (priv->size_widget) { - g_object_unref (priv->size_widget); - priv->size_widget = NULL; - } + g_clear_object (&priv->location); + g_clear_object (&priv->face_pixbuf); + g_clear_object (&priv->size_widget); G_OBJECT_CLASS (clock_face_parent_class)->finalize (obj); diff --git a/applets/clock/clock-face.h b/applets/clock/clock-face.h index 3c665c63..00106ca4 100644 --- a/applets/clock/clock-face.h +++ b/applets/clock/clock-face.h @@ -56,7 +56,6 @@ GtkWidget *clock_face_new_with_location (ClockFaceSize size, GtkWidget *size_widget); gboolean clock_face_refresh (ClockFace *this); - #ifdef __cplusplus } #endif diff --git a/applets/clock/clock-location-tile.c b/applets/clock/clock-location-tile.c index 55bc749a..e9260a31 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); } diff --git a/applets/clock/clock-location.c b/applets/clock/clock-location.c index 9dc25e4b..637d834d 100644 --- a/applets/clock/clock-location.c +++ b/applets/clock/clock-location.c @@ -92,7 +92,7 @@ clock_location_find_and_ref (GSList *locations, } if (l != NULL) - return g_object_ref (CLOCK_LOCATION (l->data)); + return CLOCK_LOCATION (l->data); else return NULL; } @@ -210,35 +210,14 @@ clock_location_finalize (GObject *g_obj) G_CALLBACK (network_changed), CLOCK_LOCATION (g_obj)); - if (priv->name) { - g_free (priv->name); - priv->name = NULL; - } - - if (priv->city) { - g_free (priv->city); - priv->city = NULL; - } + g_clear_pointer (&priv->name, g_free); + g_clear_pointer (&priv->city, g_free); - if (priv->systz) { - g_object_unref (priv->systz); - priv->systz = NULL; - } + g_clear_object (&priv->systz); - if (priv->timezone) { - g_free (priv->timezone); - priv->timezone = NULL; - } - - if (priv->tzname) { - g_free (priv->tzname); - priv->tzname = NULL; - } - - if (priv->weather_code) { - g_free (priv->weather_code); - priv->weather_code = NULL; - } + g_clear_pointer (&priv->timezone, g_free); + g_clear_pointer (&priv->tzname, g_free); + g_clear_pointer (&priv->weather_code, g_free); if (priv->weather_info) { weather_info_free (priv->weather_info); @@ -277,11 +256,7 @@ clock_location_set_name (ClockLocation *loc, const gchar *name) { ClockLocationPrivate *priv = clock_location_get_instance_private (loc); - if (priv->name) { - g_free (priv->name); - priv->name = NULL; - } - + g_free (priv->name); priv->name = g_strdup (name); } @@ -298,11 +273,7 @@ clock_location_set_city (ClockLocation *loc, const gchar *city) { ClockLocationPrivate *priv = clock_location_get_instance_private (loc); - if (priv->city) { - g_free (priv->city); - priv->city = NULL; - } - + g_free (priv->city); priv->city = g_strdup (city); } @@ -319,11 +290,7 @@ clock_location_set_timezone (ClockLocation *loc, const gchar *timezone) { ClockLocationPrivate *priv = clock_location_get_instance_private (loc); - if (priv->timezone) { - g_free (priv->timezone); - priv->timezone = NULL; - } - + g_free (priv->timezone); priv->timezone = g_strdup (timezone); } @@ -360,16 +327,11 @@ clock_location_set_tzname (ClockLocation *this, const char *tzname) { ClockLocationPrivate *priv = clock_location_get_instance_private (CLOCK_LOCATION(this)); - if (priv->tzname) { - if (strcmp (priv->tzname, tzname) == 0) { - return; - } - - g_free (priv->tzname); - priv->tzname = NULL; - } + if (priv->tzname && strcmp (priv->tzname, tzname) == 0) + return; - if (tzname) { + g_free (priv->tzname); + if (tzname && *tzname != '\0') { priv->tzname = g_strdup (tzname); } else { priv->tzname = NULL; @@ -472,7 +434,6 @@ clock_location_is_current (ClockLocation *loc) return FALSE; } - glong clock_location_get_offset (ClockLocation *loc) { @@ -596,7 +557,7 @@ clock_location_make_current (ClockLocation *loc, static gchar * clock_location_get_valid_weather_code (const gchar *code) { - if (!code || code[0] == '\0') + if (!code || *code == '\0') return g_strdup (WEATHER_EMPTY_CODE); else return g_strdup (code); diff --git a/applets/clock/clock-map.c b/applets/clock/clock-map.c index fc096c60..97441c62 100644 --- a/applets/clock/clock-map.c +++ b/applets/clock/clock-map.c @@ -150,32 +150,15 @@ clock_map_finalize (GObject *g_obj) priv->highlight_timeout_id = 0; } - if (priv->stock_map_pixbuf) { - g_object_unref (priv->stock_map_pixbuf); - priv->stock_map_pixbuf = NULL; - } + g_clear_object (&priv->stock_map_pixbuf); for (i = 0; i < MARKER_NB; i++) { - if (priv->location_marker_pixbuf[i]) { - g_object_unref (priv->location_marker_pixbuf[i]); - priv->location_marker_pixbuf[i] = NULL; - } + g_clear_object (&priv->location_marker_pixbuf[i]); } - if (priv->location_map_pixbuf) { - g_object_unref (priv->location_map_pixbuf); - priv->location_map_pixbuf = NULL; - } - - if (priv->shadow_pixbuf) { - g_object_unref (priv->shadow_pixbuf); - priv->shadow_pixbuf = NULL; - } - - if (priv->shadow_map_pixbuf) { - g_object_unref (priv->shadow_map_pixbuf); - priv->shadow_map_pixbuf = NULL; - } + g_clear_object (&priv->location_map_pixbuf); + g_clear_object (&priv->shadow_pixbuf); + g_clear_object (&priv->shadow_map_pixbuf); G_OBJECT_CLASS (clock_map_parent_class)->finalize (g_obj); } diff --git a/applets/clock/clock-map.h b/applets/clock/clock-map.h index 0df4a416..d400fa9b 100644 --- a/applets/clock/clock-map.h +++ b/applets/clock/clock-map.h @@ -36,7 +36,6 @@ void clock_map_refresh (ClockMap *this); void clock_map_update_time (ClockMap *this); void clock_map_blink_location (ClockMap *this, ClockLocation *loc); - #ifdef __cplusplus } #endif diff --git a/applets/clock/clock-sunpos.c b/applets/clock/clock-sunpos.c index 20a7b619..7b3ee86a 100644 --- a/applets/clock/clock-sunpos.c +++ b/applets/clock/clock-sunpos.c @@ -170,7 +170,6 @@ sun_position (time_t unix_time, gdouble *lat, gdouble *lon) *lon = ra; } - #if 0 int main (int argc, char *argv[]) diff --git a/applets/clock/clock.c b/applets/clock/clock.c index 28b28ac7..f97e56af 100644 --- a/applets/clock/clock.c +++ b/applets/clock/clock.c @@ -51,6 +51,11 @@ #include <gdk/gdkkeysyms.h> #include <gio/gio.h> +#if defined (CLOCK_INPROCESS) && defined (HAVE_WAYLAND) +#include <gdk/gdkwayland.h> +#include <gtk-layer-shell/gtk-layer-shell.h> +#endif + #ifdef HAVE_X11 #include <gdk/gdkx.h> #endif @@ -85,6 +90,18 @@ #define KEY_TEMPERATURE_UNIT "temperature-unit" #define KEY_SPEED_UNIT "speed-unit" +/* For watching for when the system resumes from sleep mode (e.g. suspend) + * and updating the clock as soon as that happens. */ +#define LOGIND_RUNNING() (access("/run/systemd/seats/", F_OK) >= 0) +#define SYSTEMD_LOGIND_SERVICE "org.freedesktop.login1" +#define SYSTEMD_LOGIND_PATH "/org/freedesktop/login1" +#define SYSTEMD_LOGIND_INTERFACE "org.freedesktop.login1.Manager" +#define CK_SERVICE "org.freedesktop.ConsoleKit" +#define CK_MANAGER_PATH "/org/freedesktop/ConsoleKit/Manager" +#define CK_MANAGER_INTERFACE "org.freedesktop.ConsoleKit.Manager" + +#define _clock_get_widget(x,y) (GTK_WIDGET (gtk_builder_get_object ((x)->builder, (y)))) + enum { COL_CITY_NAME = 0, COL_CITY_TZ, @@ -184,6 +201,8 @@ struct _ClockData { GSettings *settings; const gchar *weather_icon_name; + + GDBusProxy *system_manager_proxy; }; /* Used to count the number of clock instances. It's there to know when we @@ -241,13 +260,6 @@ clock_box_class_init (ClockBoxClass *klass) /* Clock */ -static inline GtkWidget * -_clock_get_widget (ClockData *cd, - const char *name) -{ - return GTK_WIDGET (gtk_builder_get_object (cd->builder, name)); -} - static void unfix_size (ClockData *cd) { @@ -373,7 +385,7 @@ calculate_minimum_height (GtkWidget *widget, { GtkStateFlags state; GtkStyleContext *style_context; - const PangoFontDescription *font_desc; + PangoFontDescription *font_desc; GtkBorder padding; PangoContext *pango_context; PangoFontMetrics *metrics; @@ -394,6 +406,7 @@ calculate_minimum_height (GtkWidget *widget, descent = pango_font_metrics_get_descent (metrics); pango_font_metrics_unref (metrics); + pango_font_description_free (font_desc); gtk_style_context_get_padding (style_context, state, &padding); @@ -499,8 +512,7 @@ get_updated_timeformat (ClockData *cd) static void update_timeformat (ClockData *cd) { - if (cd->timeformat) - g_free (cd->timeformat); + g_free (cd->timeformat); cd->timeformat = get_updated_timeformat (cd); } @@ -752,6 +764,12 @@ free_locations (ClockData *cd) static void destroy_clock (GtkWidget * widget, ClockData *cd) { + if (cd->system_manager_proxy) + { + g_signal_handlers_disconnect_by_data (cd->system_manager_proxy, cd); + g_object_unref (cd->system_manager_proxy); + } + if (cd->settings) g_signal_handlers_disconnect_by_data( cd->settings, cd); @@ -855,9 +873,9 @@ create_calendar (ClockData *cd) g_signal_connect (window, "edit-locations", G_CALLBACK (edit_locations_cb), cd); - g_signal_connect (window, "delete_event", + g_signal_connect (window, "delete-event", G_CALLBACK (delete_event), cd->panel_button); - g_signal_connect (window, "key_press_event", + g_signal_connect (window, "key-press-event", G_CALLBACK (close_on_escape), cd->panel_button); /*Name this window so the default theme can be overridden in panel theme, @@ -875,105 +893,204 @@ create_calendar (ClockData *cd) static void position_calendar_popup (ClockData *cd) { -#ifdef HAVE_X11 - GtkRequisition req; - GtkAllocation allocation; - GdkDisplay *display; - GdkScreen *screen; - GdkRectangle monitor; - GdkGravity gravity = GDK_GRAVITY_NORTH_WEST; - int button_w, button_h; - int x, y; - int w, h; - int i, n; - gboolean found_monitor = FALSE; - - if (!GDK_IS_X11_DISPLAY (gdk_display_get_default ())) - return; +#if defined(HAVE_X11) && defined(GDK_WINDOWING_X11) + if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) + { + GtkRequisition req; + GtkAllocation allocation; + GdkDisplay *display; + GdkScreen *screen; + GdkRectangle monitor; + GdkGravity gravity = GDK_GRAVITY_NORTH_WEST; + int button_w, button_h; + int x, y; + int w, h; + int i, n; + gboolean found_monitor = FALSE; + + + /* Get root origin of the toggle button, and position above that. */ + gdk_window_get_origin (gtk_widget_get_window (cd->panel_button), + &x, &y); + + gtk_window_get_size (GTK_WINDOW (cd->calendar_popup), &w, &h); + gtk_widget_get_preferred_size (cd->calendar_popup, &req, NULL); + w = req.width; + h = req.height; + + gtk_widget_get_allocation (cd->panel_button, &allocation); + button_w = allocation.width; + button_h = allocation.height; + + screen = gtk_window_get_screen (GTK_WINDOW (cd->calendar_popup)); + display = gdk_screen_get_display (screen); + + n = gdk_display_get_n_monitors (display); + for (i = 0; i < n; i++) { + gdk_monitor_get_geometry (gdk_display_get_monitor (display, i), &monitor); + if (x >= monitor.x && x <= monitor.x + monitor.width && + y >= monitor.y && y <= monitor.y + monitor.height) { + found_monitor = TRUE; + break; + } + } - /* Get root origin of the toggle button, and position above that. */ - gdk_window_get_origin (gtk_widget_get_window (cd->panel_button), - &x, &y); + if (!found_monitor) { + /* eek, we should be on one of those xinerama + monitors */ + monitor.x = 0; + monitor.y = 0; + monitor.width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen)); + monitor.height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen)); + } - gtk_window_get_size (GTK_WINDOW (cd->calendar_popup), &w, &h); - gtk_widget_get_preferred_size (cd->calendar_popup, &req, NULL); - w = req.width; - h = req.height; + /* Based on panel orientation, position the popup. + * Ignore window gravity since the window is undecorated. + * The orientations are all named backward from what + * I expected. + */ + switch (cd->orient) { + case MATE_PANEL_APPLET_ORIENT_RIGHT: + x += button_w; + if ((y + h) > monitor.y + monitor.height) + y -= (y + h) - (monitor.y + monitor.height); + + if ((y + h) > (monitor.height / 2)) + gravity = GDK_GRAVITY_SOUTH_WEST; + else + gravity = GDK_GRAVITY_NORTH_WEST; - gtk_widget_get_allocation (cd->panel_button, &allocation); - button_w = allocation.width; - button_h = allocation.height; - - screen = gtk_window_get_screen (GTK_WINDOW (cd->calendar_popup)); - display = gdk_screen_get_display (screen); - - n = gdk_display_get_n_monitors (display); - for (i = 0; i < n; i++) { - gdk_monitor_get_geometry (gdk_display_get_monitor (display, i), &monitor); - if (x >= monitor.x && x <= monitor.x + monitor.width && - y >= monitor.y && y <= monitor.y + monitor.height) { - found_monitor = TRUE; break; - } - } + case MATE_PANEL_APPLET_ORIENT_LEFT: + x -= w; + if ((y + h) > monitor.y + monitor.height) + y -= (y + h) - (monitor.y + monitor.height); - if (!found_monitor) { - /* eek, we should be on one of those xinerama - monitors */ - monitor.x = 0; - monitor.y = 0; - monitor.width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen)); - monitor.height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen)); - } + if ((y + h) > (monitor.height / 2)) + gravity = GDK_GRAVITY_SOUTH_EAST; + else + gravity = GDK_GRAVITY_NORTH_EAST; - /* Based on panel orientation, position the popup. - * Ignore window gravity since the window is undecorated. - * The orientations are all named backward from what - * I expected. - */ - switch (cd->orient) { - case MATE_PANEL_APPLET_ORIENT_RIGHT: - x += button_w; - if ((y + h) > monitor.y + monitor.height) - y -= (y + h) - (monitor.y + monitor.height); + break; + case MATE_PANEL_APPLET_ORIENT_DOWN: + y += button_h; + if ((x + w) > monitor.x + monitor.width) + x -= (x + w) - (monitor.x + monitor.width); - if ((y + h) > (monitor.height / 2)) - gravity = GDK_GRAVITY_SOUTH_WEST; - else gravity = GDK_GRAVITY_NORTH_WEST; - break; - case MATE_PANEL_APPLET_ORIENT_LEFT: - x -= w; - if ((y + h) > monitor.y + monitor.height) - y -= (y + h) - (monitor.y + monitor.height); + break; + case MATE_PANEL_APPLET_ORIENT_UP: + y -= h; + if ((x + w) > monitor.x + monitor.width) + x -= (x + w) - (monitor.x + monitor.width); - if ((y + h) > (monitor.height / 2)) - gravity = GDK_GRAVITY_SOUTH_EAST; - else - gravity = GDK_GRAVITY_NORTH_EAST; + gravity = GDK_GRAVITY_SOUTH_WEST; - break; - case MATE_PANEL_APPLET_ORIENT_DOWN: - y += button_h; - if ((x + w) > monitor.x + monitor.width) - x -= (x + w) - (monitor.x + monitor.width); + break; + } - gravity = GDK_GRAVITY_NORTH_WEST; + gtk_window_move (GTK_WINDOW (cd->calendar_popup), x, y); + gtk_window_set_gravity (GTK_WINDOW (cd->calendar_popup), gravity); + } +#endif - break; - case MATE_PANEL_APPLET_ORIENT_UP: - y -= h; - if ((x + w) > monitor.x + monitor.width) - x -= (x + w) - (monitor.x + monitor.width); + /*Only build wayland support when building in process*/ +#if defined(CLOCK_INPROCESS) && defined(HAVE_WAYLAND) && defined(GDK_WINDOWING_WAYLAND) + if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ())) + { + GtkWindow *window; + GdkWindow *panelwin; + GtkWidget *toplevel; + int x, y, w, h, panel_w, panel_h; + + /*Get the calendar window dimensions*/ + window = (GTK_WINDOW (cd->calendar_popup)); + gtk_window_get_size (window, &w, &h); + /*Find the position of the applet*/ + gdk_window_get_origin (gtk_widget_get_window (cd->panel_button), + &x, &y); + + /*Get the panel dimensions*/ + toplevel = gtk_widget_get_toplevel (cd->applet); + panelwin = gtk_widget_get_window (toplevel); + gdk_window_get_geometry (panelwin, NULL, NULL, &panel_w, &panel_h); + + /*Set up GTK Layer Shell*/ + gtk_layer_init_for_window (window); + gtk_layer_set_layer (window, GTK_LAYER_SHELL_LAYER_TOP); + + switch (cd->orient) { + case MATE_PANEL_APPLET_ORIENT_RIGHT: + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_LEFT, TRUE); + gtk_layer_set_margin (window, GTK_LAYER_SHELL_EDGE_LEFT, 0); + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_RIGHT, FALSE); + if (y < (panel_h - h)) + { + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_TOP, TRUE); + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_BOTTOM, FALSE); + gtk_layer_set_margin (window, GTK_LAYER_SHELL_EDGE_TOP, y); + } + else + { + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_BOTTOM, TRUE); + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_TOP, FALSE); + } + break; - gravity = GDK_GRAVITY_SOUTH_WEST; + case MATE_PANEL_APPLET_ORIENT_LEFT: + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_RIGHT, TRUE); + gtk_layer_set_margin (window, GTK_LAYER_SHELL_EDGE_RIGHT, 0); + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_LEFT, FALSE); + if (y < (panel_h - h)) + { + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_TOP, TRUE); + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_BOTTOM, FALSE); + gtk_layer_set_margin (window, GTK_LAYER_SHELL_EDGE_TOP, y); + } + else + { + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_BOTTOM, TRUE); + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_TOP, FALSE); + } + break; - break; - } + case MATE_PANEL_APPLET_ORIENT_DOWN: + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_TOP, TRUE); + gtk_layer_set_margin (window, GTK_LAYER_SHELL_EDGE_TOP, 0); + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_BOTTOM, FALSE); + if (x < (panel_w - w)) + { + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_LEFT, TRUE); + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_RIGHT, FALSE); + gtk_layer_set_margin (window, GTK_LAYER_SHELL_EDGE_LEFT, x); + } + else + { + gtk_layer_set_anchor(window, GTK_LAYER_SHELL_EDGE_RIGHT, TRUE); + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_LEFT, FALSE); + } + break; - gtk_window_move (GTK_WINDOW (cd->calendar_popup), x, y); - gtk_window_set_gravity (GTK_WINDOW (cd->calendar_popup), gravity); + case MATE_PANEL_APPLET_ORIENT_UP: + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_BOTTOM, TRUE); + gtk_layer_set_margin (window, GTK_LAYER_SHELL_EDGE_BOTTOM, 0); + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_TOP, FALSE); + if (x < (panel_w - w)) + { + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_LEFT, TRUE); + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_RIGHT, FALSE); + gtk_layer_set_margin (window, GTK_LAYER_SHELL_EDGE_LEFT, x); + } + else + { + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_RIGHT, TRUE); + gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_LEFT, FALSE); + } + break; + } + return; + } #endif } @@ -1050,7 +1167,6 @@ create_cities_store (ClockData *cd) } g_slist_free (list); - if (cd->prefs_window) { GtkWidget *widget = _clock_get_widget (cd, "cities_list"); gtk_tree_view_set_model (GTK_TREE_VIEW (widget), @@ -1071,35 +1187,17 @@ sort_locations_by_time (gconstpointer a, gconstpointer b) clock_location_localtime (loc_a, &tm_a); clock_location_localtime (loc_b, &tm_b); - ret = (tm_a.tm_year == tm_b.tm_year) ? 0 : 1; - if (ret) { - return (tm_a.tm_year < tm_b.tm_year) ? -1 : 1; - } - - ret = (tm_a.tm_mon == tm_b.tm_mon) ? 0 : 1; - if (ret) { - return (tm_a.tm_mon < tm_b.tm_mon) ? -1 : 1; - } - - ret = (tm_a.tm_mday == tm_b.tm_mday) ? 0 : 1; - if (ret) { - return (tm_a.tm_mday < tm_b.tm_mday) ? -1 : 1; - } - - ret = (tm_a.tm_hour == tm_b.tm_hour) ? 0 : 1; - if (ret) { - return (tm_a.tm_hour < tm_b.tm_hour) ? -1 : 1; - } - - ret = (tm_a.tm_min == tm_b.tm_min) ? 0 : 1; - if (ret) { - return (tm_a.tm_min < tm_b.tm_min) ? -1 : 1; - } - - ret = (tm_a.tm_sec == tm_b.tm_sec) ? 0 : 1; - if (ret) { - return (tm_a.tm_sec < tm_b.tm_sec) ? -1 : 1; - } + ret = tm_a.tm_year - tm_b.tm_year; + if (! ret) + ret = tm_a.tm_mon - tm_b.tm_mon; + if (! ret) + ret = tm_a.tm_mday - tm_b.tm_mday; + if (! ret) + ret = tm_a.tm_hour - tm_b.tm_hour; + if (! ret) + ret = tm_a.tm_min - tm_b.tm_min; + if (! ret) + ret = tm_a.tm_sec - tm_b.tm_sec; return ret; } @@ -1289,7 +1387,7 @@ do_not_eat_button_press (GtkWidget *widget, GdkEventButton *event) { if (event->button != 1) - g_signal_stop_emission_by_name (widget, "button_press_event"); + g_signal_stop_emission_by_name (widget, "button-press-event"); return FALSE; } @@ -1343,7 +1441,6 @@ force_no_button_vertical_padding (GtkWidget *widget) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (provider); - gtk_widget_set_name (widget, "clock-applet-button"); } @@ -1368,11 +1465,11 @@ create_main_clock_label (ClockData *cd) label = gtk_label_new (NULL); /*Fixme-this is invalid for labels with any recent GTK3 version, maybe all of them*/ /* - g_signal_connect (label, "size_request", + g_signal_connect (label, "size-request", G_CALLBACK (clock_size_request), cd); */ - g_signal_connect_swapped (label, "style_set", + g_signal_connect_swapped (label, "style-set", G_CALLBACK (unfix_size), cd); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER); @@ -1418,11 +1515,11 @@ create_clock_widget (ClockData *cd) { /* Main toggle button */ cd->panel_button = create_main_clock_button (); - g_signal_connect (cd->panel_button, "button_press_event", + g_signal_connect (cd->panel_button, "button-press-event", G_CALLBACK (do_not_eat_button_press), NULL); g_signal_connect (cd->panel_button, "toggled", G_CALLBACK (toggle_calendar), cd); - g_signal_connect (G_OBJECT (cd->panel_button), "destroy", + g_signal_connect (cd->panel_button, "destroy", G_CALLBACK (destroy_clock), cd); gtk_widget_show (cd->panel_button); @@ -1827,11 +1924,11 @@ output_cb (GtkSpinButton *spin, { GtkAdjustment *adj; gchar *text; - int value; + gdouble value; adj = gtk_spin_button_get_adjustment (spin); - value = (int) gtk_adjustment_get_value (adj); - text = g_strdup_printf ("%02d", value); + value = gtk_adjustment_get_value (adj); + text = g_strdup_printf ("%02.0f", value); gtk_entry_set_text (GTK_ENTRY (spin), text); g_free (text); @@ -1847,7 +1944,7 @@ ensure_time_settings_window_is_created (ClockData *cd) return; cd->set_time_window = _clock_get_widget (cd, "set-time-window"); - g_signal_connect (cd->set_time_window, "delete_event", + g_signal_connect (cd->set_time_window, "delete-event", G_CALLBACK (delete_time_settings), cd); cd->calendar = _clock_get_widget (cd, "calendar"); @@ -1855,12 +1952,6 @@ ensure_time_settings_window_is_created (ClockData *cd) cd->minutes_spin = _clock_get_widget (cd, "minutes_spin"); cd->seconds_spin = _clock_get_widget (cd, "seconds_spin"); - gtk_entry_set_width_chars (GTK_ENTRY (cd->hours_spin), 2); - gtk_entry_set_width_chars (GTK_ENTRY (cd->minutes_spin), 2); - gtk_entry_set_width_chars (GTK_ENTRY (cd->seconds_spin), 2); - gtk_entry_set_alignment (GTK_ENTRY (cd->hours_spin), 1.0); - gtk_entry_set_alignment (GTK_ENTRY (cd->minutes_spin), 1.0); - gtk_entry_set_alignment (GTK_ENTRY (cd->seconds_spin), 1.0); g_signal_connect (cd->seconds_spin, "wrapped", G_CALLBACK (wrap_cb), cd); g_signal_connect (cd->minutes_spin, "wrapped", G_CALLBACK (wrap_cb), cd); g_signal_connect (cd->hours_spin, "wrapped", G_CALLBACK (wrap_cb), cd); @@ -1924,7 +2015,8 @@ format_changed (GSettings *settings, gchar *key, ClockData *clock) { - int new_format; + ClockFormat new_format; + new_format = g_settings_get_enum (settings, key); if (!clock->can_handle_format_12 && new_format == CLOCK_FORMAT_12) @@ -2127,9 +2219,6 @@ location_set_current_cb (ClockLocation *loc, static void locations_changed (ClockData *cd) { - GSList *l; - glong id; - if (!cd->locations) { if (cd->weather_obox) gtk_widget_hide (cd->weather_obox); @@ -2144,8 +2233,9 @@ locations_changed (ClockData *cd) gtk_widget_show (cd->weather_obox); } - for (l = cd->locations; l; l = l->next) { + for (GSList *l = cd->locations; l; l = l->next) { ClockLocation *loc = l->data; + glong id; id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (loc), "weather-updated")); if (id == 0) { @@ -2164,7 +2254,6 @@ locations_changed (ClockData *cd) create_cities_section (cd); } - static void set_locations (ClockData *cd, GSList *locations) { @@ -2253,7 +2342,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_slist_append (data->cities, loc); + data->cities = g_slist_append (data->cities, g_object_ref (loc)); } static GMarkupParser location_parser = { @@ -2325,21 +2414,25 @@ clock_timezone_changed (SystemTimezone *systz, refresh_click_timeout_time_only (cd); } +#define unit_combo_box_set_active(x,y) (gtk_combo_box_set_active (GTK_COMBO_BOX (gtk_builder_get_object (cd->builder, (x))), (y))) + static void temperature_unit_changed (GSettings *settings, gchar *key, ClockData *cd) { - cd->temperature_unit = g_settings_get_enum (settings, key); - if (cd->temperature_unit > 0) - { - GtkWidget *widget; - gint oldvalue; - widget = _clock_get_widget (cd, "temperature_combo"); - oldvalue = gtk_combo_box_get_active (GTK_COMBO_BOX (widget)) + 2; - if (oldvalue != cd->speed_unit) - gtk_combo_box_set_active (GTK_COMBO_BOX (widget), cd->temperature_unit - 2); - } + TempUnit temperature_unit = g_settings_get_enum (settings, key); + + if (cd->temperature_unit == temperature_unit) + return; + + /* TEMP_UNIT_INVALID = 0 */ + if (temperature_unit == TEMP_UNIT_INVALID) + return; + + unit_combo_box_set_active ("temperature_combo", + ((int) temperature_unit) - 2); + cd->temperature_unit = temperature_unit; update_weather_locations (cd); } @@ -2348,16 +2441,18 @@ speed_unit_changed (GSettings *settings, gchar *key, ClockData *cd) { - cd->speed_unit = g_settings_get_enum (settings, key); - if (cd->speed_unit > 0) - { - GtkWidget *widget; - gint oldvalue; - widget = _clock_get_widget (cd, "wind_speed_combo"); - oldvalue = gtk_combo_box_get_active (GTK_COMBO_BOX (widget)) + 2; - if (oldvalue != cd->speed_unit) - gtk_combo_box_set_active (GTK_COMBO_BOX (widget), cd->speed_unit - 2); - } + SpeedUnit speed_unit = g_settings_get_enum (settings, key); + + if (cd->speed_unit == speed_unit) + return; + + /* SPEED_UNIT_INVALID = 0 */ + if (speed_unit == SPEED_UNIT_INVALID) + return; + + unit_combo_box_set_active ("wind_speed_combo", + ((int) speed_unit) - 2); + cd->speed_unit = speed_unit; update_weather_locations (cd); } @@ -2402,16 +2497,6 @@ setup_gsettings (ClockData *cd) { cd->settings = mate_panel_applet_settings_new (MATE_PANEL_APPLET (cd->applet), CLOCK_SCHEMA); - /* hack to allow users to set custom format in dconf-editor */ - gint format; - gchar *custom_format; - format = g_settings_get_enum (cd->settings, KEY_FORMAT); - custom_format = g_settings_get_string (cd->settings, KEY_CUSTOM_FORMAT); - g_settings_set_enum (cd->settings, KEY_FORMAT, format); - g_settings_set_string (cd->settings, KEY_CUSTOM_FORMAT, custom_format); - if (custom_format != NULL) - g_free (custom_format); - g_signal_connect (cd->settings, "changed::" KEY_FORMAT, G_CALLBACK (format_changed), cd); g_signal_connect (cd->settings, "changed::" KEY_SHOW_SECONDS, G_CALLBACK (show_seconds_changed), cd); g_signal_connect (cd->settings, "changed::" KEY_SHOW_DATE, G_CALLBACK (show_date_changed), cd); @@ -2427,7 +2512,6 @@ setup_gsettings (ClockData *cd) static GSList * parse_gsettings_cities (ClockData *cd, gchar **values) { - gint i; LocationParserData data; GMarkupParseContext *context; @@ -2437,7 +2521,7 @@ parse_gsettings_cities (ClockData *cd, gchar **values) context = g_markup_parse_context_new (&location_parser, 0, &data, NULL); if (values) { - for (i = 0; values[i]; i++) { + for (gint i = 0; values[i]; i++) { g_markup_parse_context_parse (context, values[i], strlen(values[i]), NULL); } } @@ -2485,6 +2569,86 @@ load_gsettings (ClockData *cd) set_locations (cd, cities); } +/* When the system manager (ConsoleKit or systemd-logind) reports that + * the system has just resumed from sleep mode (e.g. suspend/hibernate), + * update the clock and the weather/temperature readings. That way, if + * the user suspended the system for an hour and then wakes the system up, + * the user will immediately see the current time and (if possible) + * updated weather data. Without this extra code, the user would most + * likely wake the system up and see the weather from an hour ago, and if + * the clock is set to not display seconds (only minutes), the clock may + * show an inaccurate time for up to a minute after resume. + */ +static void +system_manager_signal_cb (GDBusProxy *proxy, + gchar *sender_name, + gchar *signal_name, + GVariant *parameters, + ClockData *cd) +{ + if (g_strcmp0 (signal_name, "PrepareForSleep") == 0) + { + GVariant *variant; + gboolean active; + + variant = g_variant_get_child_value (parameters, 0); + active = g_variant_get_boolean (variant); + g_variant_unref (variant); + + /* The PrepareForSleep signal is emitted by ConsoleKit2 and + * logind, both before sleep mode is entered, and + * immediately after the system has resumed from sleep mode. + * Listeners of this signal distinguish between the two + * states by checking the parameter to this signal. If the + * parameter is TRUE, the system is about to enter sleep + * mode; if FALSE, the system has resumed from sleep mode. + * We only care about updating the clock after resumption, + * so test if the parameter is FALSE. + */ + if (active == FALSE) + { + update_clock (cd); + update_weather_locations (cd); + } + } +} + +static void +setup_monitor_for_resume (ClockData *cd) +{ + gboolean logind_running; + const char * service; + const char * path; + const char * interface; + + /* If logind is running, connect to logind; otherwise use ConsoleKit. + */ + logind_running = LOGIND_RUNNING (); + if (logind_running) { + service = SYSTEMD_LOGIND_SERVICE; + path = SYSTEMD_LOGIND_PATH; + interface = SYSTEMD_LOGIND_INTERFACE; + } else { + service = CK_SERVICE; + path = CK_MANAGER_PATH; + interface = CK_MANAGER_INTERFACE; + } + + cd->system_manager_proxy = g_dbus_proxy_new_for_bus_sync + (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, + NULL, + service, path, interface, + NULL, NULL); + + if (cd->system_manager_proxy != NULL) { + g_signal_connect (cd->system_manager_proxy, + "g-signal", + G_CALLBACK (system_manager_signal_cb), + cd); + } +} + static gboolean fill_clock_applet (MatePanelApplet *applet) { @@ -2518,19 +2682,14 @@ fill_clock_applet (MatePanelApplet *applet) /* we have to bind change_orient before we do applet_widget_add since we need to get an initial change_orient signal to set our initial oriantation, and we get that during the _add call */ - g_signal_connect (G_OBJECT (cd->applet), - "change_orient", + g_signal_connect (cd->applet, "change-orient", G_CALLBACK (applet_change_orient), cd); - g_signal_connect (G_OBJECT (cd->panel_button), - "size_allocate", + g_signal_connect (cd->panel_button, "size-allocate", G_CALLBACK (panel_button_change_pixel_size), cd); - mate_panel_applet_set_background_widget (MATE_PANEL_APPLET (cd->applet), - GTK_WIDGET (cd->applet)); - action_group = gtk_action_group_new ("ClockApplet Menu Actions"); gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions (action_group, @@ -2559,10 +2718,15 @@ fill_clock_applet (MatePanelApplet *applet) /* Make sure the weather icon gets updated when the panel size changes*/ g_signal_connect (cd->applet, - "change_size", + "change-size", G_CALLBACK (weather_icon_updated_cb), cd); + /* If ConsoleKit or systemd-logind is available, set up to update + * the clock if/when the system resumes from sleep (e.g. suspend/ + * hibernate). */ + setup_monitor_for_resume (cd); + return TRUE; } @@ -2686,7 +2850,7 @@ run_prefs_edit_save (GtkButton *button, ClockData *cd) */ clock_location_is_current (loc); - cd->locations = g_slist_append (cd->locations, loc); + cd->locations = g_slist_append (cd->locations, g_object_ref (loc)); } g_free (name); g_free (city); @@ -2916,7 +3080,7 @@ run_prefs_locations_add (GtkButton *button, ClockData *cd) if (g_object_get_data (G_OBJECT (edit_window), "delete-handler") == NULL) { g_object_set_data (G_OBJECT (edit_window), "delete-handler", - GINT_TO_POINTER (g_signal_connect (edit_window, "delete_event", G_CALLBACK (edit_delete), cd))); + GINT_TO_POINTER (g_signal_connect (edit_window, "delete-event", G_CALLBACK (edit_delete), cd))); } location_update_ok_sensitivity (cd); @@ -3045,7 +3209,6 @@ speed_combo_changed (GtkComboBox *combo, ClockData *cd) g_settings_set_enum (cd->settings, KEY_SPEED_UNIT, value); } - static void fill_prefs_window (ClockData *cd) { @@ -3199,36 +3362,35 @@ ensure_prefs_window_is_created (ClockData *cd) location_name_label = _clock_get_widget (cd, "location-name-label"); timezone_label = _clock_get_widget (cd, "timezone-label"); - if (!clock_locale_supports_am_pm ()) gtk_widget_hide (clock_options); selection = gtk_tree_view_get_selection (cd->prefs_locations); - g_signal_connect (G_OBJECT (selection), "changed", + g_signal_connect (selection, "changed", G_CALLBACK (prefs_locations_changed), cd); - g_signal_connect (G_OBJECT (cd->prefs_window), "delete_event", + g_signal_connect (cd->prefs_window, "delete-event", G_CALLBACK (prefs_hide_event), cd); - g_signal_connect (G_OBJECT (prefs_close_button), "clicked", + g_signal_connect (prefs_close_button, "clicked", G_CALLBACK (prefs_hide), cd); - g_signal_connect (G_OBJECT (prefs_help_button), "clicked", + g_signal_connect (prefs_help_button, "clicked", G_CALLBACK (prefs_help), cd); cd->prefs_location_remove_button = _clock_get_widget (cd, "prefs-locations-remove-button"); - g_signal_connect (G_OBJECT (cd->prefs_location_remove_button), "clicked", + g_signal_connect (cd->prefs_location_remove_button, "clicked", G_CALLBACK (run_prefs_locations_remove), cd); cd->prefs_location_add_button = _clock_get_widget (cd, "prefs-locations-add-button"); - g_signal_connect (G_OBJECT (cd->prefs_location_add_button), "clicked", + g_signal_connect (cd->prefs_location_add_button, "clicked", G_CALLBACK (run_prefs_locations_add), cd); cd->prefs_location_edit_button = _clock_get_widget (cd, "prefs-locations-edit-button"); - g_signal_connect (G_OBJECT (cd->prefs_location_edit_button), "clicked", + g_signal_connect (cd->prefs_location_edit_button, "clicked", G_CALLBACK (run_prefs_locations_edit), cd); edit_window = _clock_get_widget (cd, "edit-location-window"); @@ -3236,7 +3398,7 @@ ensure_prefs_window_is_created (ClockData *cd) gtk_window_set_transient_for (GTK_WINDOW (edit_window), GTK_WINDOW (cd->prefs_window)); - g_signal_connect (G_OBJECT (edit_window), "delete_event", + g_signal_connect (edit_window, "delete-event", G_CALLBACK (edit_hide_event), cd); edit_cancel_button = _clock_get_widget (cd, "edit-location-cancel-button"); @@ -3252,9 +3414,9 @@ ensure_prefs_window_is_created (ClockData *cd) gtk_label_set_mnemonic_widget (GTK_LABEL (location_name_label), GTK_WIDGET (cd->location_entry)); - g_signal_connect (G_OBJECT (cd->location_entry), "notify::location", + g_signal_connect (cd->location_entry, "notify::location", G_CALLBACK (location_changed), cd); - g_signal_connect (G_OBJECT (cd->location_entry), "changed", + g_signal_connect (cd->location_entry, "changed", G_CALLBACK (location_name_changed), cd); zone_box = _clock_get_widget (cd, "edit-location-timezone-box"); @@ -3264,15 +3426,15 @@ ensure_prefs_window_is_created (ClockData *cd) gtk_label_set_mnemonic_widget (GTK_LABEL (timezone_label), GTK_WIDGET (cd->zone_combo)); - g_signal_connect (G_OBJECT (cd->zone_combo), "notify::tzid", + g_signal_connect (cd->zone_combo, "notify::tzid", G_CALLBACK (location_timezone_changed), cd); mateweather_location_unref (world); - g_signal_connect (G_OBJECT (edit_cancel_button), "clicked", + g_signal_connect (edit_cancel_button, "clicked", G_CALLBACK (edit_hide), cd); - g_signal_connect (G_OBJECT (edit_ok_button), "clicked", + g_signal_connect (edit_ok_button, "clicked", G_CALLBACK (run_prefs_edit_save), cd); /* Set up the time setting section */ @@ -3350,8 +3512,7 @@ display_properties_dialog (ClockData *cd, gboolean start_in_locations_page) GtkWidget *notebook = _clock_get_widget (cd, "notebook"); gtk_widget_add_events (notebook, GDK_SCROLL_MASK); - g_signal_connect (GTK_NOTEBOOK (notebook), - "scroll-event", + g_signal_connect (notebook, "scroll-event", G_CALLBACK (on_notebook_scroll_event), NULL); @@ -3401,12 +3562,12 @@ static void display_about_dialog(GtkAction* action, ClockData* cd) "authors", authors, "comments", _("The Clock displays the current time and date"), "copyright", _("Copyright \xc2\xa9 1998-2004 Free Software Foundation, Inc.\n" - "Copyright \xc2\xa9 2012-2020 MATE developers"), + "Copyright \xc2\xa9 2012-2021 MATE developers"), "documenters", documenters, "logo-icon-name", CLOCK_ICON, "translator-credits", _("translator-credits"), "version", VERSION, - "website", "http://mate-desktop.org/", + "website", PACKAGE_URL, NULL); } diff --git a/applets/clock/clock.ui b/applets/clock/clock.ui index 822aca0b..fb62507c 100644 --- a/applets/clock/clock.ui +++ b/applets/clock/clock.ui @@ -1,55 +1,55 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.22.0 --> +<!-- Generated with glade 3.38.2 --> <interface> <requires lib="gtk+" version="3.22"/> <object class="GtkAdjustment" id="adjustment1"> <property name="upper">59</property> <property name="value">59</property> - <property name="step_increment">1</property> - <property name="page_increment">30</property> + <property name="step-increment">1</property> + <property name="page-increment">30</property> </object> <object class="GtkAdjustment" id="adjustment2"> <property name="upper">59</property> <property name="value">59</property> - <property name="step_increment">1</property> - <property name="page_increment">30</property> + <property name="step-increment">1</property> + <property name="page-increment">30</property> </object> <object class="GtkAdjustment" id="adjustment3"> <property name="upper">23</property> <property name="value">23</property> - <property name="step_increment">1</property> - <property name="page_increment">12</property> + <property name="step-increment">1</property> + <property name="page-increment">12</property> </object> <object class="GtkImage" id="image1"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">process-stop</property> + <property name="can-focus">False</property> + <property name="icon-name">process-stop</property> </object> <object class="GtkDialog" id="set-time-window"> - <property name="can_focus">False</property> - <property name="border_width">5</property> + <property name="can-focus">False</property> + <property name="border-width">5</property> <property name="title" translatable="yes">Time & Date</property> <property name="resizable">False</property> - <property name="type_hint">dialog</property> + <property name="type-hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox2"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area2"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="homogeneous">True</property> <child> <object class="GtkButton" id="cancel-set-time-button"> <property name="label" translatable="yes">_Cancel</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> + <property name="can-focus">True</property> + <property name="can-default">True</property> + <property name="receives-default">False</property> <property name="image">image1</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> @@ -61,9 +61,9 @@ <object class="GtkButton" id="set-time-button"> <property name="label" translatable="yes">_Set System Time</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> @@ -75,28 +75,28 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="pack_type">end</property> + <property name="pack-type">end</property> <property name="position">0</property> </packing> </child> <child> <object class="GtkAlignment" id="alignment1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="yscale">0</property> - <property name="top_padding">7</property> - <property name="bottom_padding">6</property> - <property name="left_padding">7</property> - <property name="right_padding">7</property> + <property name="top-padding">7</property> + <property name="bottom-padding">6</property> + <property name="left-padding">7</property> + <property name="right-padding">7</property> <child> <object class="GtkBox" id="time_settings_box"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="spacing">12</property> <child> <object class="GtkCalendar" id="calendar"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="year">2009</property> <property name="month">5</property> <property name="day">3</property> @@ -108,23 +108,26 @@ </packing> </child> <child> + <!-- n-columns=3 n-rows=3 --> <object class="GtkGrid" id="table1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">start</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> + <property name="row-spacing">6</property> + <property name="column-spacing">12</property> <child> <object class="GtkBox" id="hbox61"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <child> <object class="GtkSpinButton" id="hours_spin"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> + <property name="can-focus">True</property> + <property name="invisible-char">●</property> + <property name="width-chars">2</property> + <property name="xalign">1</property> <property name="adjustment">adjustment3</property> - <property name="climb_rate">1</property> + <property name="climb-rate">1</property> <property name="numeric">True</property> <property name="wrap">True</property> </object> @@ -137,10 +140,12 @@ <child> <object class="GtkSpinButton" id="minutes_spin"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> + <property name="can-focus">True</property> + <property name="invisible-char">●</property> + <property name="width-chars">2</property> + <property name="xalign">1</property> <property name="adjustment">adjustment2</property> - <property name="climb_rate">1</property> + <property name="climb-rate">1</property> <property name="numeric">True</property> <property name="wrap">True</property> </object> @@ -153,10 +158,12 @@ <child> <object class="GtkSpinButton" id="seconds_spin"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> + <property name="can-focus">True</property> + <property name="invisible-char">●</property> + <property name="width-chars">2</property> + <property name="xalign">1</property> <property name="adjustment">adjustment1</property> - <property name="climb_rate">1</property> + <property name="climb-rate">1</property> <property name="numeric">True</property> <property name="wrap">True</property> </object> @@ -168,48 +175,63 @@ </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="left-attach">1</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkLabel" id="current_time_label"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label">23:59:59</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> + <property name="left-attach">1</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkLabel" id="label236"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">_Time:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">hours_spin</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">hours_spin</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="left-attach">0</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkLabel" id="label235"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">Current Time:</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="left-attach">0</property> + <property name="top-attach">0</property> </packing> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="expand">False</property> @@ -232,71 +254,68 @@ <action-widget response="0">cancel-set-time-button</action-widget> <action-widget response="0">set-time-button</action-widget> </action-widgets> - <child> - <placeholder/> - </child> </object> <object class="GtkImage" id="image2"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">gtk-ok</property> + <property name="can-focus">False</property> + <property name="icon-name">gtk-ok</property> </object> <object class="GtkImage" id="image3"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">process-stop</property> + <property name="can-focus">False</property> + <property name="icon-name">process-stop</property> </object> <object class="GtkImage" id="image4"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">help-browser</property> + <property name="can-focus">False</property> + <property name="icon-name">help-browser</property> </object> <object class="GtkImage" id="image5"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">window-close</property> + <property name="can-focus">False</property> + <property name="icon-name">window-close</property> </object> <object class="GtkImage" id="image6"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">list-add</property> + <property name="can-focus">False</property> + <property name="icon-name">list-add</property> </object> <object class="GtkImage" id="image7"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">gtk-edit</property> + <property name="can-focus">False</property> + <property name="icon-name">gtk-edit</property> </object> <object class="GtkImage" id="image8"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">list-remove</property> + <property name="can-focus">False</property> + <property name="icon-name">list-remove</property> </object> <object class="GtkDialog" id="prefs-window"> - <property name="can_focus">False</property> - <property name="border_width">5</property> + <property name="can-focus">False</property> + <property name="border-width">5</property> <property name="title" translatable="yes">Clock Preferences</property> <property name="resizable">False</property> - <property name="window_position">center</property> - <property name="type_hint">dialog</property> + <property name="window-position">center</property> + <property name="type-hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <property name="spacing">2</property> <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <child> <object class="GtkButton" id="prefs-help-button"> <property name="label" translatable="yes">_Help</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> + <property name="can-focus">True</property> + <property name="can-default">True</property> + <property name="receives-default">False</property> <property name="image">image4</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> @@ -308,10 +327,10 @@ <object class="GtkButton" id="time-settings-button"> <property name="label" translatable="yes">Time _Settings</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> + <property name="can-focus">True</property> + <property name="can-default">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> @@ -323,12 +342,12 @@ <object class="GtkButton" id="prefs-close-button"> <property name="label" translatable="yes">_Close</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="receives_default">False</property> + <property name="can-focus">True</property> + <property name="can-default">True</property> + <property name="has-default">True</property> + <property name="receives-default">False</property> <property name="image">image5</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> @@ -340,32 +359,32 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="pack_type">end</property> + <property name="pack-type">end</property> <property name="position">0</property> </packing> </child> <child> <object class="GtkNotebook" id="notebook"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="border_width">5</property> + <property name="can-focus">True</property> + <property name="border-width">5</property> <child> <object class="GtkBox" id="vbox17"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="border_width">12</property> + <property name="can-focus">False</property> + <property name="border-width">12</property> <property name="orientation">vertical</property> <property name="spacing">18</property> <child> <object class="GtkBox" id="clock-options"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <property name="spacing">6</property> <child> <object class="GtkLabel" id="label210"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">Clock Format</property> <property name="xalign">0</property> <attributes> @@ -381,21 +400,21 @@ <child> <object class="GtkAlignment" id="alignment32"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="left_padding">12</property> + <property name="can-focus">False</property> + <property name="left-padding">12</property> <child> <object class="GtkBox" id="hbox49"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="spacing">13</property> <child> <object class="GtkRadioButton" id="12hr_radio"> <property name="label" translatable="yes">_12 hour format</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> </object> <packing> <property name="expand">False</property> @@ -407,10 +426,10 @@ <object class="GtkRadioButton" id="24hr_radio"> <property name="label" translatable="yes">_24 hour format</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> <property name="group">12hr_radio</property> </object> <packing> @@ -438,13 +457,13 @@ <child> <object class="GtkBox" id="vbox29"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <property name="spacing">6</property> <child> <object class="GtkLabel" id="label229"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">Panel Display</property> <property name="xalign">0</property> <attributes> @@ -460,22 +479,22 @@ <child> <object class="GtkAlignment" id="alignment33"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="left_padding">12</property> + <property name="can-focus">False</property> + <property name="left-padding">12</property> <child> <object class="GtkBox" id="vbox30"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <property name="spacing">6</property> <child> <object class="GtkCheckButton" id="date_check"> <property name="label" translatable="yes">Show the _date</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> </object> <packing> <property name="expand">False</property> @@ -487,10 +506,10 @@ <object class="GtkCheckButton" id="seconds_check"> <property name="label" translatable="yes">Show seco_nds</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> </object> <packing> <property name="expand">False</property> @@ -502,10 +521,10 @@ <object class="GtkCheckButton" id="weeks_check"> <property name="label" translatable="yes">Show wee_k numbers in calendar</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> </object> <packing> <property name="expand">False</property> @@ -517,10 +536,10 @@ <object class="GtkCheckButton" id="weather_check"> <property name="label" translatable="yes">Show _weather</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> </object> <packing> <property name="expand">False</property> @@ -532,10 +551,10 @@ <object class="GtkCheckButton" id="temperature_check"> <property name="label" translatable="yes">Show _temperature</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> </object> <packing> <property name="expand">False</property> @@ -564,38 +583,38 @@ <child type="tab"> <object class="GtkLabel" id="label209"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">General</property> </object> <packing> - <property name="tab_fill">False</property> + <property name="tab-fill">False</property> </packing> </child> <child> <object class="GtkBox" id="vbox24"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="border_width">12</property> + <property name="can-focus">False</property> + <property name="border-width">12</property> <property name="orientation">vertical</property> <property name="spacing">18</property> <child> <object class="GtkBox" id="hbox54"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="spacing">6</property> <child> <object class="GtkScrolledWindow" id="scrolledwindow10"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">never</property> - <property name="vscrollbar_policy">never</property> - <property name="shadow_type">in</property> + <property name="can-focus">True</property> + <property name="hscrollbar-policy">never</property> + <property name="vscrollbar-policy">never</property> + <property name="shadow-type">in</property> <child> <object class="GtkTreeView" id="cities_list"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="headers_visible">False</property> - <property name="hover_expand">True</property> + <property name="can-focus">True</property> + <property name="headers-visible">False</property> + <property name="hover-expand">True</property> <child internal-child="selection"> <object class="GtkTreeSelection"/> </child> @@ -611,19 +630,19 @@ <child> <object class="GtkButtonBox" id="vbuttonbox2"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <property name="spacing">6</property> - <property name="layout_style">start</property> + <property name="layout-style">start</property> <child> <object class="GtkButton" id="prefs-locations-add-button"> <property name="label" translatable="yes">_Add</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> + <property name="can-focus">True</property> + <property name="can-default">True</property> + <property name="receives-default">False</property> <property name="image">image6</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> @@ -635,11 +654,11 @@ <object class="GtkButton" id="prefs-locations-edit-button"> <property name="label" translatable="yes">_Edit</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> + <property name="can-focus">True</property> + <property name="can-default">True</property> + <property name="receives-default">False</property> <property name="image">image7</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> @@ -651,11 +670,11 @@ <object class="GtkButton" id="prefs-locations-remove-button"> <property name="label" translatable="yes">_Remove</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> + <property name="can-focus">True</property> + <property name="can-default">True</property> + <property name="receives-default">False</property> <property name="image">image8</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> @@ -685,31 +704,31 @@ <child type="tab"> <object class="GtkLabel" id="label220"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">Locations</property> </object> <packing> <property name="position">1</property> - <property name="tab_fill">False</property> + <property name="tab-fill">False</property> </packing> </child> <child> <object class="GtkBox" id="vbox27"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="border_width">12</property> + <property name="can-focus">False</property> + <property name="border-width">12</property> <property name="orientation">vertical</property> <property name="spacing">18</property> <child> <object class="GtkBox" id="vbox28"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <property name="spacing">6</property> <child> <object class="GtkLabel" id="label224"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">Display</property> <property name="xalign">0</property> <attributes> @@ -725,107 +744,120 @@ <child> <object class="GtkAlignment" id="alignment34"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="left_padding">12</property> + <property name="can-focus">False</property> + <property name="left-padding">12</property> <child> + <!-- n-columns=3 n-rows=4 --> <object class="GtkGrid" id="table25"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> - <property name="column_homogeneous">True</property> + <property name="can-focus">False</property> + <property name="row-spacing">6</property> + <property name="column-spacing">12</property> + <property name="column-homogeneous">True</property> <child> <object class="GtkComboBox" id="visibility_combo"> - <property name="can_focus">False</property> + <property name="can-focus">False</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> + <property name="left-attach">1</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkLabel" id="label232"> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">_Visibility unit:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">visibility_combo</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">visibility_combo</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> + <property name="left-attach">0</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkComboBox" id="pressure_combo"> - <property name="can_focus">False</property> + <property name="can-focus">False</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> + <property name="left-attach">1</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkLabel" id="label231"> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">_Pressure unit:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">pressure_combo</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">pressure_combo</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> + <property name="left-attach">0</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkComboBox" id="wind_speed_combo"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="left-attach">1</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkComboBox" id="temperature_combo"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> + <property name="left-attach">1</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkLabel" id="label228"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">_Wind speed unit:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">wind_speed_combo</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">wind_speed_combo</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="left-attach">0</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkLabel" id="label227"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">_Temperature unit:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">temperature_combo</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">temperature_combo</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="left-attach">0</property> + <property name="top-attach">0</property> </packing> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> </child> </object> @@ -850,12 +882,12 @@ <child type="tab"> <object class="GtkLabel" id="label223"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">Weather</property> </object> <packing> <property name="position">2</property> - <property name="tab_fill">False</property> + <property name="tab-fill">False</property> </packing> </child> </object> @@ -872,9 +904,6 @@ <action-widget response="0">time-settings-button</action-widget> <action-widget response="-7">prefs-close-button</action-widget> </action-widgets> - <child> - <placeholder/> - </child> </object> <object class="GtkListStore" id="liststore1"> <columns> @@ -905,28 +934,28 @@ </data> </object> <object class="GtkDialog" id="edit-location-window"> - <property name="can_focus">False</property> - <property name="border_width">5</property> + <property name="can-focus">False</property> + <property name="border-width">5</property> <property name="resizable">False</property> - <property name="type_hint">dialog</property> + <property name="type-hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox3"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area3"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <child> <object class="GtkButton" id="edit-location-cancel-button"> <property name="label" translatable="yes">_Cancel</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> + <property name="can-focus">True</property> + <property name="can-default">True</property> + <property name="receives-default">False</property> <property name="image">image3</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> @@ -938,11 +967,11 @@ <object class="GtkButton" id="edit-location-ok-button"> <property name="label" translatable="yes">_OK</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> + <property name="can-focus">True</property> + <property name="can-default">True</property> + <property name="receives-default">False</property> <property name="image">image2</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> @@ -954,37 +983,38 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="pack_type">end</property> + <property name="pack-type">end</property> <property name="position">0</property> </packing> </child> <child> + <!-- n-columns=3 n-rows=3 --> <object class="GtkGrid" id="table26"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> + <property name="can-focus">False</property> + <property name="row-spacing">6</property> + <property name="column-spacing">6</property> <child> <object class="GtkBox" id="vbox34"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <property name="spacing">6</property> <child> <object class="GtkScrolledWindow" id="scrolledwindow12"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">never</property> - <property name="vscrollbar_policy">never</property> + <property name="can-focus">True</property> + <property name="hscrollbar-policy">never</property> + <property name="vscrollbar-policy">never</property> <child> <object class="GtkViewport" id="viewport3"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="shadow_type">none</property> + <property name="can-focus">False</property> + <property name="shadow-type">none</property> <child> <object class="GtkImage" id="image30"> - <property name="can_focus">False</property> - <property name="icon_name">image-missing</property> + <property name="can-focus">False</property> + <property name="icon-name">image-missing</property> </object> </child> </object> @@ -997,102 +1027,103 @@ </packing> </child> <child> + <!-- n-columns=4 n-rows=5 --> <object class="GtkGrid" id="table27"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="border_width">5</property> + <property name="can-focus">False</property> + <property name="border-width">5</property> <property name="orientation">vertical</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> + <property name="row-spacing">6</property> + <property name="column-spacing">6</property> <child> <object class="GtkLabel" id="label243"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="vexpand">True</property> <property name="label" translatable="yes" comments="Languages that have a single word that translates as either "state" or "province" should use that instead of "region"."><small><i>Type a city, region, or country name and then select a match from the pop-up.</i></small></property> - <property name="use_markup">True</property> + <property name="use-markup">True</property> <property name="wrap">True</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="left-attach">1</property> + <property name="top-attach">1</property> <property name="width">3</property> </packing> </child> <child> <object class="GtkBox" id="edit-location-name-box"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <child> <placeholder/> </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> + <property name="left-attach">1</property> + <property name="top-attach">0</property> <property name="width">3</property> </packing> </child> <child> <object class="GtkBox" id="edit-location-timezone-box"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <child> <placeholder/> </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> + <property name="left-attach">1</property> + <property name="top-attach">2</property> <property name="width">3</property> </packing> </child> <child> <object class="GtkLabel" id="timezone-label"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">_Timezone:</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> + <property name="left-attach">0</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkLabel" id="location-name-label"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">_Location Name:</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="left-attach">0</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkEntry" id="edit-location-latitude-entry"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="valign">center</property> <property name="hexpand">True</property> - <property name="invisible_char">•</property> + <property name="invisible-char">•</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> + <property name="left-attach">1</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkComboBox" id="edit-location-latitude-combo"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="model">liststore2</property> <child> <object class="GtkCellRendererText" id="cellrenderertext2"/> @@ -1102,42 +1133,42 @@ </child> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">3</property> + <property name="left-attach">2</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkLabel" id="label240"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="label" translatable="yes"><i>(optional)</i></property> - <property name="use_markup">True</property> + <property name="use-markup">True</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">3</property> - <property name="top_attach">3</property> + <property name="left-attach">3</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkLabel" id="label239"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="valign">center</property> <property name="label" translatable="yes"><i>(optional)</i></property> - <property name="use_markup">True</property> + <property name="use-markup">True</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">3</property> - <property name="top_attach">4</property> + <property name="left-attach">3</property> + <property name="top-attach">4</property> </packing> </child> <child> <object class="GtkComboBox" id="edit-location-longitude-combo"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="model">liststore1</property> <child> <object class="GtkCellRendererText" id="cellrenderertext1"/> @@ -1147,51 +1178,51 @@ </child> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">4</property> + <property name="left-attach">2</property> + <property name="top-attach">4</property> </packing> </child> <child> <object class="GtkEntry" id="edit-location-longitude-entry"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="valign">center</property> <property name="hexpand">True</property> - <property name="invisible_char">•</property> + <property name="invisible-char">•</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">4</property> + <property name="left-attach">1</property> + <property name="top-attach">4</property> </packing> </child> <child> <object class="GtkLabel" id="label238"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">L_ongitude:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">edit-location-longitude-entry</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">edit-location-longitude-entry</property> <property name="xalign">0</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">4</property> + <property name="left-attach">0</property> + <property name="top-attach">4</property> </packing> </child> <child> <object class="GtkBox" id="vbox35"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <property name="spacing">6</property> <property name="homogeneous">True</property> <child> <object class="GtkLabel" id="label237"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">L_atitude:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">edit-location-latitude-entry</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">edit-location-latitude-entry</property> <property name="xalign">0</property> </object> <packing> @@ -1202,8 +1233,8 @@ </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> + <property name="left-attach">0</property> + <property name="top-attach">3</property> </packing> </child> <child> @@ -1218,10 +1249,34 @@ </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="left-attach">0</property> + <property name="top-attach">0</property> </packing> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="expand">False</property> @@ -1235,8 +1290,5 @@ <action-widget response="-6">edit-location-cancel-button</action-widget> <action-widget response="-5">edit-location-ok-button</action-widget> </action-widgets> - <child> - <placeholder/> - </child> </object> </interface> diff --git a/applets/clock/system-timezone.c b/applets/clock/system-timezone.c index b1755aa9..a6f9c75d 100644 --- a/applets/clock/system-timezone.c +++ b/applets/clock/system-timezone.c @@ -213,8 +213,7 @@ system_timezone_constructor (GType type, g_object_unref (file); if (priv->monitors[i]) - g_signal_connect (G_OBJECT (priv->monitors[i]), - "changed", + g_signal_connect (priv->monitors [i], "changed", G_CALLBACK (system_timezone_monitor_changed), obj); } @@ -234,20 +233,11 @@ system_timezone_finalize (GObject *obj) systz = SYSTEM_TIMEZONE (obj); priv = system_timezone_get_instance_private (systz); - if (priv->tz) { - g_free (priv->tz); - priv->tz = NULL; - } - - if (priv->env_tz) { - g_free (priv->env_tz); - priv->env_tz = NULL; - } + g_clear_pointer (&priv->tz, g_free); + g_clear_pointer (&priv->env_tz, g_free); for (i = 0; i < CHECK_NB; i++) { - if (priv->monitors[i]) - g_object_unref (priv->monitors[i]); - priv->monitors[i] = NULL; + g_clear_object (&priv->monitors[i]); } G_OBJECT_CLASS (system_timezone_parent_class)->finalize (obj); @@ -265,9 +255,10 @@ system_timezone_monitor_changed (GFileMonitor *handle, gpointer user_data) { SystemTimezonePrivate *priv; - priv = system_timezone_get_instance_private (user_data); char *new_tz; + priv = system_timezone_get_instance_private (user_data); + if (event != G_FILE_MONITOR_EVENT_CHANGED && event != G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT && event != G_FILE_MONITOR_EVENT_DELETED && @@ -280,16 +271,15 @@ system_timezone_monitor_changed (GFileMonitor *handle, if (strcmp (priv->tz, new_tz) != 0) { g_free (priv->tz); - priv->tz = new_tz; + priv->tz = g_strdup (new_tz); g_signal_emit (G_OBJECT (user_data), system_timezone_signals[CHANGED], 0, priv->tz); - } else - g_free (new_tz); + } + g_free (new_tz); } - /* * Code to deal with the system timezone on all distros. * There's no dependency on the SystemTimezone GObject here. @@ -378,7 +368,6 @@ system_timezone_write_etc_timezone (const char *tz, return retval; } - /* Read a file that looks like a key-file (but there's no need for groups) * and get the last value for a specific key */ static char * @@ -413,16 +402,12 @@ system_timezone_read_key_file (const char *filename, if (value[0] == '\"') { if (value[len - 1] == '\"') { - if (retval) - g_free (retval); - + g_free (retval); retval = g_strndup (value + 1, len - 2); } } else { - if (retval) - g_free (retval); - + g_free (retval); retval = g_strdup (line + strlen (key_eq)); } @@ -720,7 +705,6 @@ recursive_compare (struct stat *localtime_stat, return NULL; } - static gboolean files_are_identical_inode (struct stat *a_stat, struct stat *b_stat, @@ -731,7 +715,6 @@ files_are_identical_inode (struct stat *a_stat, return (a_stat->st_ino == b_stat->st_ino); } - /* Determine if /etc/localtime is a hard link to some file, by looking at * the inodes */ static char * diff --git a/applets/clock/system-timezone.h b/applets/clock/system-timezone.h index 0ede8976..8a2c22ef 100644 --- a/applets/clock/system-timezone.h +++ b/applets/clock/system-timezone.h @@ -35,7 +35,6 @@ extern "C" { #define SYSTEM_ZONEINFODIR "/usr/share/zoneinfo" #endif - #define SYSTEM_TIMEZONE_TYPE (system_timezone_get_type ()) #define SYSTEM_TIMEZONE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SYSTEM_TIMEZONE_TYPE, SystemTimezone)) #define SYSTEM_TIMEZONE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), SYSTEM_TIMEZONE_TYPE, SystemTimezoneClass)) |