[gnome-panel] [clock] Remove usage of gmt_time gconf key
- From: Vincent Untz <vuntz src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-panel] [clock] Remove usage of gmt_time gconf key
- Date: Tue, 12 Jan 2010 22:01:51 +0000 (UTC)
commit fe174bb7e97a787d2d841c3a251965b14ccf8b16
Author: Vincent Untz <vuntz gnome org>
Date: Tue Jan 12 19:01:53 2010 +0100
[clock] Remove usage of gmt_time gconf key
Using this key most probably breaks some part of the UI of the clock
applet since quite some time. People can use the GMT timezone instead.
applets/clock/calendar-window.c | 62 ++------------------------------------
applets/clock/calendar-window.h | 3 --
applets/clock/clock.c | 57 +++--------------------------------
applets/clock/clock.schemas.in | 4 ++-
4 files changed, 12 insertions(+), 114 deletions(-)
---
diff --git a/applets/clock/calendar-window.c b/applets/clock/calendar-window.c
index d316e3e..ad27c16 100644
--- a/applets/clock/calendar-window.c
+++ b/applets/clock/calendar-window.c
@@ -84,7 +84,6 @@ struct _CalendarWindowPrivate {
char *prefs_dir;
gboolean invert_order;
- gboolean utc_time;
gboolean show_weeks;
time_t *current_time;
@@ -119,7 +118,6 @@ G_DEFINE_TYPE (CalendarWindow, calendar_window, GTK_TYPE_WINDOW)
enum {
PROP_0,
PROP_INVERTORDER,
- PROP_UTCTIME,
PROP_SHOWWEEKS,
#ifdef HAVE_LIBECAL
PROP_TIMEFORMAT,
@@ -281,8 +279,7 @@ format_time (ClockFormat format,
time_t t,
guint year,
guint month,
- guint day,
- gboolean use_utc)
+ guint day)
{
struct tm *tm;
char *time_format;
@@ -291,10 +288,7 @@ format_time (ClockFormat format,
if (!t)
return NULL;
- if (use_utc)
- tm = gmtime (&t);
- else
- tm = localtime (&t);
+ tm = localtime (&t);
if (!tm)
return NULL;
@@ -975,8 +969,7 @@ handle_appointments_changed (CalendarWindow *calwin)
else
start_text = format_time (calwin->priv->time_format,
appointment->start_time,
- year, month, day,
- calwin->priv->utc_time);
+ year, month, day);
gtk_list_store_append (calwin->priv->appointments_model,
@@ -1544,10 +1537,7 @@ calendar_window_create_calendar (CalendarWindow *calwin)
options &= ~(GTK_CALENDAR_SHOW_WEEK_NUMBERS);
gtk_calendar_set_display_options (GTK_CALENDAR (calendar), options);
- if (calwin->priv->utc_time)
- tm = gmtime (calwin->priv->current_time);
- else
- tm = localtime (calwin->priv->current_time);
+ tm = localtime (calwin->priv->current_time);
gtk_calendar_select_month (GTK_CALENDAR (calendar),
tm->tm_mon,
@@ -1752,10 +1742,6 @@ calendar_window_get_property (GObject *object,
g_value_set_boolean (value,
calendar_window_get_invert_order (calwin));
break;
- case PROP_UTCTIME:
- g_value_set_boolean (value,
- calendar_window_get_utc_time (calwin));
- break;
case PROP_SHOWWEEKS:
g_value_set_boolean (value,
calendar_window_get_show_weeks (calwin));
@@ -1797,10 +1783,6 @@ calendar_window_set_property (GObject *object,
calendar_window_set_invert_order (calwin,
g_value_get_boolean (value));
break;
- case PROP_UTCTIME:
- calendar_window_set_utc_time (calwin,
- g_value_get_boolean (value));
- break;
case PROP_SHOWWEEKS:
calendar_window_set_show_weeks (calwin,
g_value_get_boolean (value));
@@ -1903,15 +1885,6 @@ calendar_window_class_init (CalendarWindowClass *klass)
g_object_class_install_property (
gobject_class,
- PROP_UTCTIME,
- g_param_spec_boolean ("utc-time",
- "UTC Time",
- "Use UTC time as a basis for the calendar",
- FALSE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
- g_object_class_install_property (
- gobject_class,
PROP_SHOWWEEKS,
g_param_spec_boolean ("show-weeks",
"Show Weeks",
@@ -2031,33 +2004,6 @@ calendar_window_set_invert_order (CalendarWindow *calwin,
}
gboolean
-calendar_window_get_utc_time (CalendarWindow *calwin)
-{
- g_return_val_if_fail (CALENDAR_IS_WINDOW (calwin), FALSE);
-
- return calwin->priv->utc_time;
-}
-
-void
-calendar_window_set_utc_time (CalendarWindow *calwin,
- gboolean utc_time)
-{
- g_return_if_fail (CALENDAR_IS_WINDOW (calwin));
-
- if (utc_time == calwin->priv->utc_time)
- return;
-
- calwin->priv->utc_time = utc_time;
-#ifdef HAVE_LIBECAL
- /* Time to display for appointments has changed */
- if (calwin->priv->appointments_model)
- handle_appointments_changed (calwin);
-#endif
-
- g_object_notify (G_OBJECT (calwin), "utc-time");
-}
-
-gboolean
calendar_window_get_show_weeks (CalendarWindow *calwin)
{
g_return_val_if_fail (CALENDAR_IS_WINDOW (calwin), FALSE);
diff --git a/applets/clock/calendar-window.h b/applets/clock/calendar-window.h
index 78b8507..0de882b 100644
--- a/applets/clock/calendar-window.h
+++ b/applets/clock/calendar-window.h
@@ -68,9 +68,6 @@ GtkWidget *calendar_window_get_locations_box (CalendarWindow *calwin);
gboolean calendar_window_get_invert_order (CalendarWindow *calwin);
void calendar_window_set_invert_order (CalendarWindow *calwin,
gboolean invert_order);
-gboolean calendar_window_get_utc_time (CalendarWindow *calwin);
-void calendar_window_set_utc_time (CalendarWindow *calwin,
- gboolean utc_time);
gboolean calendar_window_get_show_weeks (CalendarWindow *calwin);
void calendar_window_set_show_weeks (CalendarWindow *calwin,
gboolean show_weeks);
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index ddbbc16..23dd043 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -75,13 +75,12 @@
#define NEVER_SENSITIVE "never_sensitive"
-#define N_GCONF_PREFS 12 /* Keep this in sync with the number of keys below! */
+#define N_GCONF_PREFS 11 /* Keep this in sync with the number of keys below! */
#define KEY_FORMAT "format"
#define KEY_SHOW_SECONDS "show_seconds"
#define KEY_SHOW_DATE "show_date"
#define KEY_SHOW_WEATHER "show_weather"
#define KEY_SHOW_TEMPERATURE "show_temperature"
-#define KEY_GMT_TIME "gmt_time"
#define KEY_CUSTOM_FORMAT "custom_format"
#define KEY_SHOW_WEEK "show_week_numbers"
#define KEY_CITIES "cities"
@@ -161,7 +160,6 @@ struct _ClockData {
char *custom_format;
gboolean showseconds;
gboolean showdate;
- gboolean gmt_time;
gboolean showweek;
gboolean show_weather;
gboolean show_temperature;
@@ -190,7 +188,6 @@ struct _ClockData {
GtkWidget *showseconds_check;
GtkWidget *showdate_check;
- GtkWidget *gmt_time_check;
GtkWidget *custom_hbox;
GtkWidget *custom_label;
GtkWidget *custom_entry;
@@ -539,10 +536,7 @@ format_time (ClockData *cd)
utf8 = NULL;
- if (cd->gmt_time)
- tm = gmtime (&cd->current_time);
- else
- tm = localtime (&cd->current_time);
+ tm = localtime (&cd->current_time);
if (cd->format == CLOCK_FORMAT_UNIX) {
if (use_two_line_format (cd)) {
@@ -644,10 +638,7 @@ update_tooltip (ClockData * cd)
struct tm now;
char *tip;
- if (cd->gmt_time)
- tm = gmtime (&cd->current_time);
- else
- tm = localtime (&cd->current_time);
+ tm = localtime (&cd->current_time);
utf8 = NULL;
@@ -853,8 +844,6 @@ create_calendar (ClockData *cd)
cd->orient == PANEL_APPLET_ORIENT_UP);
g_free (prefs_dir);
- calendar_window_set_utc_time (CALENDAR_WINDOW (window),
- cd->gmt_time);
calendar_window_set_show_weeks (CALENDAR_WINDOW (window),
cd->showweek);
calendar_window_set_time_format (CALENDAR_WINDOW (window),
@@ -1599,10 +1588,7 @@ copy_time (BonoboUIComponent *uic,
format = g_locale_from_utf8 (_("%H:%M"), -1, NULL, NULL, NULL);
}
- if (cd->gmt_time)
- tm = gmtime (&cd->current_time);
- else
- tm = localtime (&cd->current_time);
+ tm = localtime (&cd->current_time);
if (!format)
strcpy (string, "???");
@@ -1628,10 +1614,7 @@ copy_date (BonoboUIComponent *uic,
char string[256];
char *utf8, *loc;
- if (cd->gmt_time)
- tm = gmtime (&cd->current_time);
- else
- tm = localtime (&cd->current_time);
+ tm = localtime (&cd->current_time);
/* Translators: This is a strftime format string.
* It is used to display a date in the full format (so that people can
@@ -2399,29 +2382,6 @@ speed_unit_changed (GConfClient *client,
}
static void
-gmt_time_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- ClockData *clock)
-{
- gboolean value;
-
- if (!entry->value || entry->value->type != GCONF_VALUE_BOOL)
- return;
-
- value = gconf_value_get_bool (entry->value);
-
- clock->gmt_time = (value != 0);
-
- refresh_clock_timeout (clock);
-
- if (clock->calendar_popup != NULL) {
- calendar_window_set_utc_time (CALENDAR_WINDOW (clock->calendar_popup), clock->gmt_time);
- position_calendar_popup (clock);
- }
-}
-
-static void
custom_format_changed (GConfClient *client,
guint cnxn_id,
GConfEntry *entry,
@@ -2493,7 +2453,6 @@ setup_gconf (ClockData *cd)
{ KEY_SHOW_DATE, (GConfClientNotifyFunc) show_date_changed },
{ KEY_SHOW_WEATHER, (GConfClientNotifyFunc) show_weather_changed },
{ KEY_SHOW_TEMPERATURE, (GConfClientNotifyFunc) show_temperature_changed },
- { KEY_GMT_TIME, (GConfClientNotifyFunc) gmt_time_changed },
{ KEY_CUSTOM_FORMAT, (GConfClientNotifyFunc) custom_format_changed },
{ KEY_SHOW_WEEK, (GConfClientNotifyFunc) show_week_changed },
{ KEY_CITIES, (GConfClientNotifyFunc) cities_changed },
@@ -2580,7 +2539,6 @@ load_gconf_settings (ClockData *cd)
cd->show_weather = panel_applet_gconf_get_bool (applet, KEY_SHOW_WEATHER, NULL);
cd->show_temperature = panel_applet_gconf_get_bool (applet, KEY_SHOW_TEMPERATURE, NULL);
- cd->gmt_time = panel_applet_gconf_get_bool (applet, KEY_GMT_TIME, NULL);
cd->showweek = panel_applet_gconf_get_bool (applet, KEY_SHOW_WEEK, NULL);
cd->timeformat = NULL;
@@ -2756,28 +2714,24 @@ update_properties_for_format (ClockData *cd,
case CLOCK_FORMAT_24:
gtk_widget_set_sensitive (cd->showseconds_check, TRUE);
gtk_widget_set_sensitive (cd->showdate_check, TRUE);
- gtk_widget_set_sensitive (cd->gmt_time_check, TRUE);
gtk_widget_set_sensitive (cd->custom_entry, FALSE);
gtk_widget_set_sensitive (cd->custom_label, FALSE);
break;
case CLOCK_FORMAT_UNIX:
gtk_widget_set_sensitive (cd->showseconds_check, FALSE);
gtk_widget_set_sensitive (cd->showdate_check, FALSE);
- gtk_widget_set_sensitive (cd->gmt_time_check, FALSE);
gtk_widget_set_sensitive (cd->custom_entry, FALSE);
gtk_widget_set_sensitive (cd->custom_label, FALSE);
break;
case CLOCK_FORMAT_INTERNET:
gtk_widget_set_sensitive (cd->showseconds_check, TRUE);
gtk_widget_set_sensitive (cd->showdate_check, FALSE);
- gtk_widget_set_sensitive (cd->gmt_time_check, FALSE);
gtk_widget_set_sensitive (cd->custom_entry, FALSE);
gtk_widget_set_sensitive (cd->custom_label, FALSE);
break;
case CLOCK_FORMAT_CUSTOM:
gtk_widget_set_sensitive (cd->showseconds_check, FALSE);
gtk_widget_set_sensitive (cd->showdate_check, FALSE);
- gtk_widget_set_sensitive (cd->gmt_time_check, TRUE);
gtk_widget_set_sensitive (cd->custom_entry, TRUE);
gtk_widget_set_sensitive (cd->custom_label, TRUE);
break;
@@ -3664,7 +3618,6 @@ display_properties_dialog (ClockData *cd, gboolean start_in_locations_page)
KEY_CUSTOM_FORMAT);
setup_writability_sensitivity (cd, cd->showseconds_check, NULL, KEY_SHOW_SECONDS);
setup_writability_sensitivity (cd, cd->showdate_check, NULL, KEY_SHOW_DATE);
- setup_writability_sensitivity (cd, cd->gmt_time_check, NULL, KEY_GMT_TIME);
gtk_widget_show (cd->props);
#endif
diff --git a/applets/clock/clock.schemas.in b/applets/clock/clock.schemas.in
index 2641e93..90640ad 100644
--- a/applets/clock/clock.schemas.in
+++ b/applets/clock/clock.schemas.in
@@ -121,7 +121,9 @@
<locale name="C">
<short>Use UTC</short>
<long>
- If true, display time in Universal Coordinated Time zone.
+ The use of this key was deprecated in GNOME 2.28 in favour of the
+ use of timezones. The schema is retained for compatibility with
+ older versions.
</long>
</locale>
</schema>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]