aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/calendar-component.c2
-rw-r--r--calendar/gui/e-cal-model.c11
-rw-r--r--calendar/gui/e-cal-model.h1
-rw-r--r--calendar/gui/e-cal-view.c31
-rw-r--r--calendar/gui/e-cal-view.h2
-rw-r--r--calendar/gui/e-calendar-view.c31
-rw-r--r--calendar/gui/e-calendar-view.h2
-rw-r--r--calendar/gui/e-day-view-time-item.c4
-rw-r--r--calendar/gui/e-day-view-top-item.c4
-rw-r--r--calendar/gui/e-day-view.c40
-rw-r--r--calendar/gui/e-day-view.h8
-rw-r--r--calendar/gui/e-week-view-event-item.c2
-rw-r--r--calendar/gui/e-week-view.c34
-rw-r--r--calendar/gui/e-week-view.h8
14 files changed, 89 insertions, 91 deletions
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index a64d0bc339..6621611b37 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -155,7 +155,7 @@ new_calendar_cb (GtkWidget *widget, ESourceSelector *selector)
static void
fill_popup_menu_callback (ESourceSelector *selector, GtkMenu *menu, CalendarComponent *comp)
{
- add_popup_menu_item (menu, _("_New Calendar"), NULL, G_CALLBACK (new_calendar_cb), selector);
+ add_popup_menu_item (menu, _("New Calendar"), NULL, G_CALLBACK (new_calendar_cb), selector);
}
static void
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index 4fc9285b2a..f23b272bdd 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -974,6 +974,17 @@ e_cal_model_set_default_category (ECalModel *model, const gchar *default_cat)
}
/**
+ * e_cal_model_get_use_24_hour_format
+ */
+gboolean
+e_cal_model_get_use_24_hour_format (ECalModel *model)
+{
+ g_return_val_if_fail (E_IS_CAL_MODEL (model), FALSE);
+
+ return model->priv->use_24_hour_format;
+}
+
+/**
* e_cal_model_set_use_24_hour_format
*/
void
diff --git a/calendar/gui/e-cal-model.h b/calendar/gui/e-cal-model.h
index 6a94414676..6adbe0473f 100644
--- a/calendar/gui/e-cal-model.h
+++ b/calendar/gui/e-cal-model.h
@@ -85,6 +85,7 @@ icaltimezone *e_cal_model_get_timezone (ECalModel *model);
void e_cal_model_set_timezone (ECalModel *model, icaltimezone *zone);
void e_cal_model_set_default_category (ECalModel *model, const gchar *default_cat);
+gboolean e_cal_model_get_use_24_hour_format (ECalModel *model);
void e_cal_model_set_use_24_hour_format (ECalModel *model, gboolean use24);
CalClient *e_cal_model_get_default_client (ECalModel *model);
diff --git a/calendar/gui/e-cal-view.c b/calendar/gui/e-cal-view.c
index 60cbda3e57..7d2ef1c704 100644
--- a/calendar/gui/e-cal-view.c
+++ b/calendar/gui/e-cal-view.c
@@ -593,6 +593,37 @@ e_cal_view_set_default_category (ECalView *cal_view, const char *category)
cal_view->priv->default_category = g_strdup (category);
}
+/**
+ * e_cal_view_get_use_24_hour_format:
+ * @cal_view: A calendar view.
+ *
+ * Gets whether the view is using 24 hour times or not.
+ *
+ * Returns: the 24 hour setting.
+ */
+gboolean
+e_cal_view_get_use_24_hour_format (ECalView *cal_view)
+{
+ g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), FALSE);
+
+ return e_cal_model_get_use_24_hour_format (cal_view->priv->model);
+}
+
+/**
+ * e_cal_view_set_use_24_hour_format
+ * @cal_view: A calendar view.
+ * @use_24_hour: Whether to use 24 hour times or not.
+ *
+ * Sets the 12/24 hour times setting for the given view.
+ */
+void
+e_cal_view_set_use_24_hour_format (ECalView *cal_view, gboolean use_24_hour)
+{
+ g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+
+ e_cal_model_set_use_24_hour_format (cal_view->priv->model, use_24_hour);
+}
+
void
e_cal_view_set_status_message (ECalView *cal_view, const gchar *message)
{
diff --git a/calendar/gui/e-cal-view.h b/calendar/gui/e-cal-view.h
index 0212e28006..0fd829a5f4 100644
--- a/calendar/gui/e-cal-view.h
+++ b/calendar/gui/e-cal-view.h
@@ -98,6 +98,8 @@ icaltimezone *e_cal_view_get_timezone (ECalView *cal_view);
void e_cal_view_set_timezone (ECalView *cal_view, icaltimezone *zone);
const char *e_cal_view_get_default_category (ECalView *cal_view);
void e_cal_view_set_default_category (ECalView *cal_view, const char *category);
+gboolean e_cal_view_get_use_24_hour_format (ECalView *view);
+void e_cal_view_set_use_24_hour_format (ECalView *view, gboolean use_24_hour);
void e_cal_view_set_status_message (ECalView *cal_view, const gchar *message);
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 60cbda3e57..7d2ef1c704 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -593,6 +593,37 @@ e_cal_view_set_default_category (ECalView *cal_view, const char *category)
cal_view->priv->default_category = g_strdup (category);
}
+/**
+ * e_cal_view_get_use_24_hour_format:
+ * @cal_view: A calendar view.
+ *
+ * Gets whether the view is using 24 hour times or not.
+ *
+ * Returns: the 24 hour setting.
+ */
+gboolean
+e_cal_view_get_use_24_hour_format (ECalView *cal_view)
+{
+ g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), FALSE);
+
+ return e_cal_model_get_use_24_hour_format (cal_view->priv->model);
+}
+
+/**
+ * e_cal_view_set_use_24_hour_format
+ * @cal_view: A calendar view.
+ * @use_24_hour: Whether to use 24 hour times or not.
+ *
+ * Sets the 12/24 hour times setting for the given view.
+ */
+void
+e_cal_view_set_use_24_hour_format (ECalView *cal_view, gboolean use_24_hour)
+{
+ g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+
+ e_cal_model_set_use_24_hour_format (cal_view->priv->model, use_24_hour);
+}
+
void
e_cal_view_set_status_message (ECalView *cal_view, const gchar *message)
{
diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h
index 0212e28006..0fd829a5f4 100644
--- a/calendar/gui/e-calendar-view.h
+++ b/calendar/gui/e-calendar-view.h
@@ -98,6 +98,8 @@ icaltimezone *e_cal_view_get_timezone (ECalView *cal_view);
void e_cal_view_set_timezone (ECalView *cal_view, icaltimezone *zone);
const char *e_cal_view_get_default_category (ECalView *cal_view);
void e_cal_view_set_default_category (ECalView *cal_view, const char *category);
+gboolean e_cal_view_get_use_24_hour_format (ECalView *view);
+void e_cal_view_set_use_24_hour_format (ECalView *view, gboolean use_24_hour);
void e_cal_view_set_status_message (ECalView *cal_view, const gchar *message);
diff --git a/calendar/gui/e-day-view-time-item.c b/calendar/gui/e-day-view-time-item.c
index 544d9383cf..6a1e1d4279 100644
--- a/calendar/gui/e-day-view-time-item.c
+++ b/calendar/gui/e-day-view-time-item.c
@@ -364,7 +364,7 @@ e_day_view_time_item_draw (GnomeCanvasItem *canvas_item,
long_line_x1, row_y,
long_line_x2, row_y);
- if (day_view->use_24_hour_format) {
+ if (e_cal_view_get_use_24_hour_format (E_CAL_VIEW (day_view))) {
g_snprintf (buffer, sizeof (buffer), "%i:%02i",
display_hour, minute);
} else {
@@ -416,7 +416,7 @@ e_day_view_time_item_draw (GnomeCanvasItem *canvas_item,
/* In 12-hour format we display 'am' or 'pm'
instead of '00'. */
if (minute == 0
- && !day_view->use_24_hour_format) {
+ && !e_cal_view_get_use_24_hour_format (E_CAL_VIEW (day_view))) {
strcpy (buffer, suffix);
} else {
g_snprintf (buffer, sizeof (buffer),
diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c
index a84e6d5468..39fdc1df1c 100644
--- a/calendar/gui/e-day-view-top-item.c
+++ b/calendar/gui/e-day-view-top-item.c
@@ -476,7 +476,7 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
e_day_view_convert_time_to_display (day_view, hour,
&display_hour,
&suffix, &suffix_width);
- if (day_view->use_24_hour_format) {
+ if (e_cal_view_get_use_24_hour_format (E_CAL_VIEW (day_view))) {
g_snprintf (buffer, sizeof (buffer), "%i:%02i",
display_hour, minute);
} else {
@@ -525,7 +525,7 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
&display_hour,
&suffix,
&suffix_width);
- if (day_view->use_24_hour_format) {
+ if (e_cal_view_get_use_24_hour_format (E_CAL_VIEW (day_view))) {
g_snprintf (buffer, sizeof (buffer),
"%i:%02i", display_hour, minute);
} else {
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index a25b945c43..660957647f 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -1648,7 +1648,7 @@ e_day_view_update_event_label (EDayView *day_view,
&end_suffix,
&end_suffix_width);
- if (day_view->use_24_hour_format) {
+ if (e_cal_view_get_use_24_hour_format (E_CAL_VIEW (day_view))) {
if (day_view->show_event_end_times) {
/* 24 hour format with end time. */
text = g_strdup_printf
@@ -2322,40 +2322,6 @@ e_day_view_set_working_day (EDayView *day_view,
gtk_widget_queue_draw (day_view->main_canvas);
}
-
-/* Whether we use 12-hour of 24-hour format. */
-gboolean
-e_day_view_get_24_hour_format (EDayView *day_view)
-{
- g_return_val_if_fail (E_IS_DAY_VIEW (day_view), FALSE);
-
- return day_view->use_24_hour_format;
-}
-
-
-void
-e_day_view_set_24_hour_format (EDayView *day_view,
- gboolean use_24_hour)
-{
- g_return_if_fail (E_IS_DAY_VIEW (day_view));
-
- if (day_view->use_24_hour_format == use_24_hour)
- return;
-
- day_view->use_24_hour_format = use_24_hour;
-
- /* We need to update all the text in the events since they may contain
- the time in the old format. */
- e_day_view_foreach_event (day_view, e_day_view_set_show_times_cb,
- NULL);
-
- /* FIXME: We need to re-layout the top canvas since the time
- format affects the sizes. */
- gtk_widget_queue_draw (day_view->time_canvas);
- gtk_widget_queue_draw (day_view->top_canvas);
-}
-
-
/* Whether we display event end times in the main canvas. */
gboolean
e_day_view_get_show_event_end_times (EDayView *day_view)
@@ -7182,7 +7148,7 @@ e_day_view_convert_time_to_display (EDayView *day_view,
/* Calculate the actual hour number to display. For 12-hour
format we convert 0-23 to 12-11am/12-11pm. */
*display_hour = hour;
- if (day_view->use_24_hour_format) {
+ if (e_cal_view_get_use_24_hour_format (E_CAL_VIEW (day_view))) {
*suffix = "";
*suffix_width = 0;
} else {
@@ -7209,7 +7175,7 @@ e_day_view_get_time_string_width (EDayView *day_view)
time_width = day_view->digit_width * 4 + day_view->colon_width;
- if (!day_view->use_24_hour_format)
+ if (!e_cal_view_get_use_24_hour_format (E_CAL_VIEW (day_view)))
time_width += MAX (day_view->am_string_width,
day_view->pm_string_width);
diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h
index decd281127..e6f485e8b1 100644
--- a/calendar/gui/e-day-view.h
+++ b/calendar/gui/e-day-view.h
@@ -282,9 +282,6 @@ struct _EDayView
gint work_day_end_hour;
gint work_day_end_minute;
- /* Whether we use 12-hour of 24-hour format. */
- gboolean use_24_hour_format;
-
/* Whether we use show event end times in the main canvas. */
gboolean show_event_end_times;
@@ -506,11 +503,6 @@ void e_day_view_set_working_day (EDayView *day_view,
gint end_hour,
gint end_minute);
-/* Whether we use 12-hour or 24-hour format. */
-gboolean e_day_view_get_24_hour_format (EDayView *day_view);
-void e_day_view_set_24_hour_format (EDayView *day_view,
- gboolean use_24_hour);
-
/* Whether we display event end times in the main canvas. */
gboolean e_day_view_get_show_event_end_times (EDayView *day_view);
void e_day_view_set_show_event_end_times (EDayView *day_view,
diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c
index fd68130bc5..a534943d75 100644
--- a/calendar/gui/e-week-view-event-item.c
+++ b/calendar/gui/e-week-view-event-item.c
@@ -550,7 +550,7 @@ e_week_view_draw_time (EWeekView *week_view,
time_x += week_view->small_digit_width * 2;
/* Draw the 'am'/'pm' suffix, if 12-hour format. */
- if (!week_view->use_24_hour_format) {
+ if (!e_cal_view_get_use_24_hour_format (E_CAL_VIEW (week_view))) {
pango_layout_set_text (layout, suffix, -1);
gdk_draw_layout (drawable, gc,
time_x,
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 4a042f36e3..df1f01c5fc 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -1705,36 +1705,6 @@ e_week_view_set_week_start_day (EWeekView *week_view,
&week_view->first_day_shown);
}
-
-/* Whether we use 12-hour or 24-hour format. */
-gboolean
-e_week_view_get_24_hour_format (EWeekView *week_view)
-{
- g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), FALSE);
-
- return week_view->use_24_hour_format;
-}
-
-
-void
-e_week_view_set_24_hour_format (EWeekView *week_view,
- gboolean use_24_hour)
-{
- g_return_if_fail (E_IS_WEEK_VIEW (week_view));
-
- if (week_view->use_24_hour_format == use_24_hour)
- return;
-
- week_view->use_24_hour_format = use_24_hour;
-
- /* We need to re-layout the events since the time format affects the
- sizes. */
- e_week_view_recalc_cell_sizes (week_view);
- week_view->events_need_reshape = TRUE;
- e_week_view_check_layout (week_view);
- gtk_widget_queue_draw (week_view->main_canvas);
-}
-
static gboolean
e_week_view_recalc_display_start_day (EWeekView *week_view)
{
@@ -3614,7 +3584,7 @@ e_week_view_convert_time_to_display (EWeekView *week_view,
/* Calculate the actual hour number to display. For 12-hour
format we convert 0-23 to 12-11am/12-11pm. */
*display_hour = hour;
- if (week_view->use_24_hour_format) {
+ if (e_cal_view_get_use_24_hour_format (E_CAL_VIEW (week_view))) {
*suffix = "";
*suffix_width = 0;
} else {
@@ -3646,7 +3616,7 @@ e_week_view_get_time_string_width (EWeekView *week_view)
time_width = week_view->digit_width * 4
+ week_view->colon_width;
- if (!week_view->use_24_hour_format)
+ if (!e_cal_view_get_use_24_hour_format (E_CAL_VIEW (week_view)))
time_width += MAX (week_view->am_string_width,
week_view->pm_string_width);
diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h
index 0296c19c42..f36760d76a 100644
--- a/calendar/gui/e-week-view.h
+++ b/calendar/gui/e-week-view.h
@@ -218,9 +218,6 @@ struct _EWeekView
/* The first day of the week, 0 (Monday) to 6 (Sunday). */
gint week_start_day;
- /* Whether we use 12-hour of 24-hour format. */
- gboolean use_24_hour_format;
-
/* The first day of the week we display, 0 (Monday) to 6 (Sunday).
This will usually be week_start_day, but if the weekend is
compressed, and week_start_day is Sunday we have to use Saturday. */
@@ -383,11 +380,6 @@ gint e_week_view_get_week_start_day (EWeekView *week_view);
void e_week_view_set_week_start_day (EWeekView *week_view,
gint week_start_day);
-/* Whether we use 12-hour or 24-hour format. */
-gboolean e_week_view_get_24_hour_format (EWeekView *week_view);
-void e_week_view_set_24_hour_format (EWeekView *week_view,
- gboolean use_24_hour);
-
void e_week_view_delete_occurrence (EWeekView *week_view);
/* Returns the number of selected events (0 or 1 at present). */