diff options
author | Milan Crha <mcrha@redhat.com> | 2009-08-04 21:04:02 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-08-12 03:44:27 +0800 |
commit | 50302d03b3ce145b165db2ddef4e92ad190cbef9 (patch) | |
tree | 4a804f72f256ef774d6f0f23c84643e42cc10083 /calendar | |
parent | cd6f86108bfc34db41de71f1e00c7e7768cb4816 (diff) | |
download | gsoc2013-evolution-50302d03b3ce145b165db2ddef4e92ad190cbef9.tar gsoc2013-evolution-50302d03b3ce145b165db2ddef4e92ad190cbef9.tar.gz gsoc2013-evolution-50302d03b3ce145b165db2ddef4e92ad190cbef9.tar.bz2 gsoc2013-evolution-50302d03b3ce145b165db2ddef4e92ad190cbef9.tar.lz gsoc2013-evolution-50302d03b3ce145b165db2ddef4e92ad190cbef9.tar.xz gsoc2013-evolution-50302d03b3ce145b165db2ddef4e92ad190cbef9.tar.zst gsoc2013-evolution-50302d03b3ce145b165db2ddef4e92ad190cbef9.zip |
Bug #205137 - Configurable date formats in components
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/gui/dialogs/cal-prefs-dialog.c | 7 | ||||
-rw-r--r-- | calendar/gui/dialogs/cal-prefs-dialog.glade | 79 | ||||
-rw-r--r-- | calendar/gui/e-cal-list-view.c | 6 | ||||
-rw-r--r-- | calendar/gui/e-calendar-table.c | 5 | ||||
-rw-r--r-- | calendar/gui/e-calendar-view.c | 8 | ||||
-rw-r--r-- | calendar/gui/e-cell-date-edit-text.c | 9 | ||||
-rw-r--r-- | calendar/gui/e-memo-table.c | 5 |
7 files changed, 108 insertions, 11 deletions
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 8f22c98569..1ed8409bd4 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -32,6 +32,7 @@ #include "cal-prefs-dialog.h" #include <widgets/misc/e-dateedit.h> #include <e-util/e-binding.h> +#include <e-util/e-datetime-format.h> #include <e-util/e-dialog-widgets.h> #include <e-util/e-util-private.h> #include <glib/gi18n.h> @@ -581,6 +582,7 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, gint i; GtkWidget *toplevel; GtkWidget *widget; + GtkWidget *table; GSList *l; gchar *gladefile; @@ -769,6 +771,11 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, toplevel = e_config_create_widget ((EConfig *)ec); gtk_container_add (GTK_CONTAINER (prefs), toplevel); + /* date/time format */ + table = glade_xml_get_widget (gui, "datetime_format_table"); + e_datetime_format_add_setup_widget (table, 0, "calendar", "table", DTFormatKindDateTime, _("Time and date:")); + e_datetime_format_add_setup_widget (table, 1, "calendar", "table", DTFormatKindDate, _("Date only:")); + show_config (prefs); /* FIXME: weakref? */ setup_changes (prefs); diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade index 63e9e6092f..984e509b64 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ b/calendar/gui/dialogs/cal-prefs-dialog.glade @@ -1024,6 +1024,85 @@ Days</property> <property name="position">3</property> </packing> </child> + + <child> + <widget class="GtkLabel" id="label65"> + <property name="visible">True</property> + <property name="label" translatable="yes"><span weight="bold">Date/Time Format</span></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkHBox" id="hbox27"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">12</property> + + <child> + <widget class="GtkLabel" id="label66"> + <property name="visible">True</property> + <property name="label" translatable="yes"></property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkTable" id="datetime_format_table"> + <property name="visible">True</property> + <property name="n_rows">1</property> + <property name="n_columns">3</property> + <property name="homogeneous">False</property> + <property name="row_spacing">0</property> + <property name="column_spacing">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> </widget> <packing> <property name="position">1</property> diff --git a/calendar/gui/e-cal-list-view.c b/calendar/gui/e-cal-list-view.c index 5cf64aebf7..1f9ca3fdcc 100644 --- a/calendar/gui/e-cal-list-view.c +++ b/calendar/gui/e-cal-list-view.c @@ -41,6 +41,7 @@ #include <table/e-cell-toggle.h> #include <table/e-cell-text.h> #include <table/e-cell-combo.h> +#include <table/e-cell-date.h> #include <misc/e-popup-menu.h> #include <table/e-cell-date-edit.h> #include <e-util/e-categories-config.h> @@ -269,6 +270,11 @@ setup_e_table (ECalListView *cal_list_view) e_table_extras_add_compare (extras, "date-compare", date_compare_cb); + + /* set proper format component for a default 'date' cell renderer */ + cell = e_table_extras_get_cell (extras, "date"); + e_cell_date_set_format_component (E_CELL_DATE (cell), "calendar"); + /* Create table view */ etspecfile = g_build_filename (EVOLUTION_ETSPECDIR, diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index a61477d081..a904b34d42 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -41,6 +41,7 @@ #include <table/e-cell-toggle.h> #include <table/e-cell-text.h> #include <table/e-cell-combo.h> +#include <table/e-cell-date.h> #include <e-util/e-dialog-utils.h> #include <e-util/e-util-private.h> #include <table/e-cell-date-edit.h> @@ -826,6 +827,10 @@ calendar_table_constructed (GObject *object) e_table_extras_add_pixbuf(extras, "complete", pixbuf); g_object_unref(pixbuf); + /* set proper format component for a default 'date' cell renderer */ + cell = e_table_extras_get_cell (extras, "date"); + e_cell_date_set_format_component (E_CELL_DATE (cell), "calendar"); + /* Create the table */ etspecfile = g_build_filename ( diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 0b7c52fd00..3575c11eda 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -33,6 +33,7 @@ #include <libedataserver/e-time-utils.h> #include <e-util/e-util.h> #include <e-util/e-error.h> +#include <e-util/e-datetime-format.h> #include <e-util/e-dialog-utils.h> #include <e-util/e-icon-factory.h> #include <libecal/e-cal-time-util.h> @@ -2044,16 +2045,11 @@ tooltip_grab (GtkWidget *tooltip, GdkEventKey *event, ECalendarView *view) static gchar * get_label (struct icaltimetype *tt, icaltimezone *f_zone, icaltimezone *t_zone) { - gchar buffer[1000]; struct tm tmp_tm; tmp_tm = icaltimetype_to_tm_with_zone (tt, f_zone, t_zone); - e_time_format_date_and_time (&tmp_tm, - calendar_config_get_24_hour_format (), - FALSE, FALSE, - buffer, 1000); - return g_strdup (buffer); + return e_datetime_format_format_tm ("calendar", "table", DTFormatKindDateTime, &tmp_tm); } void diff --git a/calendar/gui/e-cell-date-edit-text.c b/calendar/gui/e-cell-date-edit-text.c index c99d62d4e9..97dee085ea 100644 --- a/calendar/gui/e-cell-date-edit-text.c +++ b/calendar/gui/e-cell-date-edit-text.c @@ -33,6 +33,7 @@ #include <libedataserver/e-time-utils.h> #include <libedataserver/e-data-server-util.h> #include <e-util/e-util.h> +#include <e-util/e-datetime-format.h> #include <libecal/e-cal-time-util.h> #include "e-cell-date-edit-text.h" @@ -117,7 +118,6 @@ cell_date_edit_text_get_text (ECellText *cell, gboolean use_24_hour_format; icaltimezone *timezone; struct tm tmp_tm; - gchar buffer[64]; if (!dv) return g_strdup (""); @@ -131,10 +131,9 @@ cell_date_edit_text_get_text (ECellText *cell, it will be set to the current timezone. See set_value(). */ tmp_tm = icaltimetype_to_tm_with_zone (&dv->tt, dv->zone, timezone); - e_time_format_date_and_time (&tmp_tm, use_24_hour_format, - !dv->tt.is_date, FALSE, - buffer, sizeof (buffer)); - return g_strdup (buffer); + return e_datetime_format_format_tm ( + "calendar", "table", dv->tt.is_date ? + DTFormatKindDate : DTFormatKindDateTime, &tmp_tm); } static void diff --git a/calendar/gui/e-memo-table.c b/calendar/gui/e-memo-table.c index e23f82108b..d89ca044e4 100644 --- a/calendar/gui/e-memo-table.c +++ b/calendar/gui/e-memo-table.c @@ -41,6 +41,7 @@ #include <table/e-cell-toggle.h> #include <table/e-cell-text.h> #include <table/e-cell-combo.h> +#include <table/e-cell-date.h> #include <e-util/e-dialog-utils.h> #include <e-util/e-util-private.h> #include <table/e-cell-date-edit.h> @@ -606,6 +607,10 @@ memo_table_constructed (GObject *object) e_table_extras_add_cell (extras, "icon", cell); e_table_extras_add_pixbuf (extras, "icon", icon_pixbufs[0]); + /* set proper format component for a default 'date' cell renderer */ + cell = e_table_extras_get_cell (extras, "date"); + e_cell_date_set_format_component (E_CELL_DATE (cell), "calendar"); + /* Create the table */ etspecfile = g_build_filename ( |