aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-08-04 21:04:02 +0800
committerMilan Crha <mcrha@redhat.com>2009-08-04 21:04:02 +0800
commitb6313289303f2263649c70ea477e04aea4a994ec (patch)
tree36b4435a060aca6425e717b1b0ddd29efb8a0712 /calendar
parentbc301a8c3784610a0c55c9fb5056ec63ca574f4d (diff)
downloadgsoc2013-evolution-b6313289303f2263649c70ea477e04aea4a994ec.tar.gz
gsoc2013-evolution-b6313289303f2263649c70ea477e04aea4a994ec.tar.zst
gsoc2013-evolution-b6313289303f2263649c70ea477e04aea4a994ec.zip
Bug #205137 - Configurable date formats in components
Diffstat (limited to 'calendar')
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.c8
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.glade79
-rw-r--r--calendar/gui/e-cal-list-view.c6
-rw-r--r--calendar/gui/e-calendar-table.c5
-rw-r--r--calendar/gui/e-calendar-view.c8
-rw-r--r--calendar/gui/e-cell-date-edit-text.c7
-rw-r--r--calendar/gui/e-memo-table.c5
7 files changed, 106 insertions, 12 deletions
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c
index 2c19acaadd..2fc17202cc 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.c
+++ b/calendar/gui/dialogs/cal-prefs-dialog.c
@@ -31,6 +31,7 @@
#include "../calendar-config.h"
#include "cal-prefs-dialog.h"
#include <widgets/misc/e-dateedit.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>
@@ -779,7 +780,7 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs)
ECalConfig *ec;
ECalConfigTargetPrefs *target;
gint i;
- GtkWidget *toplevel;
+ GtkWidget *toplevel, *table;
GSList *l;
const gchar *working_day_names[] = {
"sun_button",
@@ -859,6 +860,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">&lt;span weight=&quot;bold&quot;&gt;Date/Time Format&lt;/span&gt;</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 0081dc1340..1da7f16037 100644
--- a/calendar/gui/e-cal-list-view.c
+++ b/calendar/gui/e-cal-list-view.c
@@ -40,6 +40,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 <misc/e-cell-date-edit.h>
#include <e-util/e-categories-config.h>
@@ -256,6 +257,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 70f347bae3..284922c029 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -42,6 +42,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 <misc/e-cell-date-edit.h>
@@ -687,6 +688,10 @@ e_calendar_table_init (ECalendarTable *cal_table)
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 (EVOLUTION_ETSPECDIR,
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index cd42454d64..286db6b5f1 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>
@@ -2222,16 +2223,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 64dd48ddf1..5836b8ac66 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"
@@ -63,7 +64,6 @@ ecd_get_text (ECellText *cell, ETableModel *model, gint col, gint row)
ECellDateEditText *ecd = E_CELL_DATE_EDIT_TEXT (cell);
ECellDateEditValue *dv = e_table_model_value_at (model, col, row);
struct tm tmp_tm;
- gchar buffer[64];
if (!dv)
return g_strdup ("");
@@ -74,10 +74,7 @@ ecd_get_text (ECellText *cell, ETableModel *model, gint col, gint row)
it will be set to the current timezone. See set_value(). */
tmp_tm = icaltimetype_to_tm_with_zone (&dv->tt, dv->zone, ecd->zone);
- e_time_format_date_and_time (&tmp_tm, ecd->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 47b3d4410c..50158899ac 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 <widgets/misc/e-cell-date-edit.h>
#include <widgets/misc/e-cell-percent.h>
@@ -255,6 +256,10 @@ e_memo_table_init (EMemoTable *memo_table)
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 (EVOLUTION_ETSPECDIR,