[gnome-panel] [clock] Update the time when the user clicks to open calendar
- From: Vincent Untz <vuntz src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-panel] [clock] Update the time when the user clicks to open calendar
- Date: Tue, 1 Sep 2009 14:17:32 +0000 (UTC)
commit 8828de3500f88edf9d356902e341bbf984bf04e6
Author: Vincent Untz <vuntz gnome org>
Date: Tue Sep 1 16:14:29 2009 +0200
[clock] Update the time when the user clicks to open calendar
When the time in the clock is not right, the user might want to check
what's going on by clicking on it. It's not a big cost to update the
time if necessary there.
A new function refresh_click_timeout_time_only() to only update the time
if necessary, instead of updating the time format, requesting a new
size, etc. is created and used in other parts of the code where
refresh_clock_timeout() was used before.
Closes: https://bugzilla.novell.com/show_bug.cgi?id=507316
applets/clock/clock.c | 26 ++++++++++++++++++++------
1 files changed, 20 insertions(+), 6 deletions(-)
---
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index c86a2be..7ee7273 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -738,6 +738,18 @@ refresh_clock_timeout(ClockData *cd)
clock_set_timeout (cd, cd->current_time);
}
+/**
+ * This is like refresh_clock_timeout(), except that we only care about whether
+ * the time actually changed. We don't care about the format.
+ */
+static void
+refresh_click_timeout_time_only (ClockData *cd)
+{
+ if (cd->timeout)
+ g_source_remove (cd->timeout);
+ clock_timeout_callback (cd);
+}
+
static void
free_locations (ClockData *cd)
{
@@ -1258,6 +1270,9 @@ static void
toggle_calendar (GtkWidget *button,
ClockData *cd)
{
+ /* if time is wrong, the user might try to fix it by clicking on the
+ * clock */
+ refresh_click_timeout_time_only (cd);
update_calendar_popup (cd);
}
@@ -1731,7 +1746,7 @@ cancel_time_settings (GtkWidget *button, ClockData *cd)
{
gtk_widget_hide (cd->set_time_window);
- refresh_clock_timeout (cd);
+ refresh_click_timeout_time_only (cd);
}
static gboolean
@@ -1871,7 +1886,7 @@ run_time_settings (GtkWidget *unused, ClockData *cd)
gtk_window_present (GTK_WINDOW (cd->set_time_window));
- refresh_clock_timeout (cd);
+ refresh_click_timeout_time_only (cd);
}
static void
@@ -1916,7 +1931,6 @@ format_changed (GConfClient *client,
return;
clock->format = new_format;
- update_timeformat (clock);
refresh_clock_timeout (clock);
if (clock->calendar_popup != NULL) {
@@ -2324,7 +2338,7 @@ clock_timezone_changed (SystemTimezone *systz,
/* This will refresh the current location */
save_cities_store (cd);
- refresh_clock_timeout (cd);
+ refresh_click_timeout_time_only (cd);
}
static void
@@ -3158,7 +3172,7 @@ prefs_hide (GtkWidget *widget, ClockData *cd)
gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree)));
- refresh_clock_timeout (cd);
+ refresh_click_timeout_time_only (cd);
}
static gboolean
@@ -3601,7 +3615,7 @@ display_properties_dialog (ClockData *cd, gboolean start_in_locations_page)
gtk_widget_get_screen (cd->applet));
gtk_window_present (GTK_WINDOW (cd->prefs_window));
- refresh_clock_timeout (cd);
+ refresh_click_timeout_time_only (cd);
/* FMQ: cd->props was the old preferences window; remove references to it */
/* FMQ: connect to the Help button by hand; look at properties_response_cb() for the help code */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]