[gnome-calendar] date-selector: always use 4 digits entry for years
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] date-selector: always use 4 digits entry for years
- Date: Wed, 24 Dec 2014 20:17:37 +0000 (UTC)
commit cf69b68288c136d0aba460607f06dcdc88d54e82
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Wed Dec 24 13:27:35 2014 -0500
date-selector: always use 4 digits entry for years
Since GtkCalendar widget is a bit clunky to navigate fast between years,
using a four years digits it's better because we are still
very close to the change of the century.
src/gcal-date-selector.c | 27 +--------------------------
1 files changed, 1 insertions(+), 26 deletions(-)
---
diff --git a/src/gcal-date-selector.c b/src/gcal-date-selector.c
index d48d2d8..7db6e77 100644
--- a/src/gcal-date-selector.c
+++ b/src/gcal-date-selector.c
@@ -50,7 +50,6 @@ struct _GcalDateSelectorPrivate
guint day_pos;
guint month_pos;
guint year_pos;
- gboolean have_long_year;
};
enum
@@ -132,23 +131,6 @@ parse_entries (GcalDateSelector *selector)
month = atoi (gtk_entry_get_text (GTK_ENTRY (priv->entries[MONTH])));
year = atoi (gtk_entry_get_text (GTK_ENTRY (priv->entries[YEAR])));
- /* Fix year if neccessary */
- if (!priv->have_long_year)
- {
- GDateTime *dt;
- gint suffix;
-
- dt = g_date_time_new_now_local ();
- suffix = g_date_time_get_year (dt) % 100;
-
- if (year > suffix)
- year += g_date_time_get_year (dt) - suffix - 100; /* last century */
- else
- year += g_date_time_get_year (dt) - suffix; /* this century */
-
- g_date_time_unref (dt);
- }
-
/* select the date */
g_signal_handlers_block_by_func (priv->calendar, calendar_day_selected, selector);
@@ -282,7 +264,6 @@ gcal_date_selector_init (GcalDateSelector *self)
case 'Y':
priv->year_pos = d_index++;
- priv->have_long_year = TRUE;
break;
}
}
@@ -356,9 +337,6 @@ gcal_date_selector_constructed (GObject *object)
priv->entries[YEAR] = (GtkWidget*) gtk_builder_get_object (builder, entry_name);
- if (! priv->have_long_year)
- gtk_entry_set_max_length (GTK_ENTRY (priv->entries[YEAR]), 2);
-
g_free (entry_name);
label = gtk_label_new (_("Year"));
@@ -455,10 +433,7 @@ gcal_date_selector_set_date (GcalDateSelector *selector,
g_free (label);
/* year entry */
- if (priv->have_long_year)
- label = g_strdup_printf ("%.4d", year);
- else
- label = g_strdup_printf ("%.2d", year % 100);
+ label = g_strdup_printf ("%.4d", year);
gtk_entry_set_text (GTK_ENTRY (priv->entries[YEAR]), label);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]