aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-meeting-time-sel.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-11-16 02:45:29 +0800
committerMilan Crha <mcrha@redhat.com>2011-11-16 02:46:22 +0800
commitbadc11edcf5e73bc6148c7b5cdccee739eb9d7ae (patch)
tree6cee87b2569d85f68f6552a4510f673f2af854be /calendar/gui/e-meeting-time-sel.c
parentecf3f2a6e927a5efe8b38622ee884d4c5d88e5f3 (diff)
downloadgsoc2013-evolution-badc11edcf5e73bc6148c7b5cdccee739eb9d7ae.tar
gsoc2013-evolution-badc11edcf5e73bc6148c7b5cdccee739eb9d7ae.tar.gz
gsoc2013-evolution-badc11edcf5e73bc6148c7b5cdccee739eb9d7ae.tar.bz2
gsoc2013-evolution-badc11edcf5e73bc6148c7b5cdccee739eb9d7ae.tar.lz
gsoc2013-evolution-badc11edcf5e73bc6148c7b5cdccee739eb9d7ae.tar.xz
gsoc2013-evolution-badc11edcf5e73bc6148c7b5cdccee739eb9d7ae.tar.zst
gsoc2013-evolution-badc11edcf5e73bc6148c7b5cdccee739eb9d7ae.zip
Bug #661126 - Meeting Free/busy dialog dates don't follow locale
Diffstat (limited to 'calendar/gui/e-meeting-time-sel.c')
-rw-r--r--calendar/gui/e-meeting-time-sel.c49
1 files changed, 21 insertions, 28 deletions
diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c
index 36e7ad7d42..9957be998d 100644
--- a/calendar/gui/e-meeting-time-sel.c
+++ b/calendar/gui/e-meeting-time-sel.c
@@ -41,6 +41,7 @@
#include "misc/e-dateedit.h"
#include "e-util/e-util.h"
+#include "e-util/e-datetime-format.h"
#include "e-meeting-utils.h"
#include "e-meeting-list-view.h"
@@ -2327,10 +2328,11 @@ e_meeting_time_selector_recalc_date_format (EMeetingTimeSelector *mts)
GDate date;
gint max_date_width, longest_weekday_width, longest_month_width, width;
gint day, longest_weekday, month, longest_month;
- gchar buffer[128];
+ gchar buffer[128], *str;
const gchar *name;
PangoContext *pango_context;
PangoLayout *layout;
+ struct tm tm_time;
/* Set up Pango prerequisites */
pango_context = gtk_widget_get_pango_context (GTK_WIDGET (mts));
@@ -2368,28 +2370,6 @@ e_meeting_time_selector_recalc_date_format (EMeetingTimeSelector *mts)
}
}
- /* See if we can use the full date. We want to use a date with a
- * month day > 20 and also the longest weekday. We use a
- * pre-calculated array of days for each month and add on the
- * weekday (which is 1 (Mon) to 7 (Sun). */
- g_date_set_dmy (&date, days[longest_month - 1] + longest_weekday,
- longest_month, 2000);
- /* This is a strftime() format string %A = full weekday name,
- * %B = full month name, %d = month day, %Y = full year. */
- g_date_strftime (buffer, sizeof (buffer), _("%A, %B %d, %Y"), &date);
-
-#if 0
- g_print ("longest_month: %i longest_weekday: %i date: %s\n",
- longest_month, longest_weekday, buffer);
-#endif
-
- pango_layout_set_text (layout, buffer, -1);
- pango_layout_get_pixel_size (layout, &width, NULL);
- if (width < max_date_width) {
- mts->date_format = E_MEETING_TIME_SELECTOR_DATE_FULL;
- return;
- }
-
/* Now try it with abbreviated weekday names. */
longest_weekday_width = 0;
longest_weekday = G_DATE_MONDAY;
@@ -2405,16 +2385,28 @@ e_meeting_time_selector_recalc_date_format (EMeetingTimeSelector *mts)
g_date_set_dmy (&date, days[longest_month - 1] + longest_weekday,
longest_month, 2000);
- /* This is a strftime() format string %a = abbreviated weekday name,
- * %m = month number, %d = month day, %Y = full year. */
- g_date_strftime (buffer, sizeof (buffer), _("%a %m/%d/%Y"), &date);
+
+ g_date_to_struct_tm (&date, &tm_time);
+ str = e_datetime_format_format_tm ("calendar", "table", DTFormatKindDate, &tm_time);
+
+ g_return_if_fail (str != NULL);
+
+ if (!e_datetime_format_includes_day_name ("calendar", "table", DTFormatKindDate)) {
+ gchar *tmp;
+
+ g_date_strftime (buffer, sizeof (buffer), "%a", &date);
+
+ tmp = str;
+ str = g_strconcat (buffer, " ", str, NULL);
+ g_free (tmp);
+ }
#if 0
g_print ("longest_month: %i longest_weekday: %i date: %s\n",
- longest_month, longest_weekday, buffer);
+ longest_month, longest_weekday, str);
#endif
- pango_layout_set_text (layout, buffer, -1);
+ pango_layout_set_text (layout, str, -1);
pango_layout_get_pixel_size (layout, &width, NULL);
if (width < max_date_width)
mts->date_format = E_MEETING_TIME_SELECTOR_DATE_ABBREVIATED_DAY;
@@ -2422,6 +2414,7 @@ e_meeting_time_selector_recalc_date_format (EMeetingTimeSelector *mts)
mts->date_format = E_MEETING_TIME_SELECTOR_DATE_SHORT;
g_object_unref (layout);
+ g_free (str);
}
/* Turn off the background of the canvas windows. This reduces flicker