diff options
author | Milan Crha <mcrha@redhat.com> | 2009-01-19 21:10:36 +0800 |
---|---|---|
committer | Milan Crha <mcrha@src.gnome.org> | 2009-01-19 21:10:36 +0800 |
commit | ae26a9a5fb34beb48e4161c8f145b0fb2d3cb3a9 (patch) | |
tree | e7eaffe89d351ff96ac07acba1d8222abc4c94c0 /calendar/gui/e-day-view.c | |
parent | fe416afe35ea272263dea6a526dd383b5fb24c16 (diff) | |
download | gsoc2013-evolution-ae26a9a5fb34beb48e4161c8f145b0fb2d3cb3a9.tar.gz gsoc2013-evolution-ae26a9a5fb34beb48e4161c8f145b0fb2d3cb3a9.tar.zst gsoc2013-evolution-ae26a9a5fb34beb48e4161c8f145b0fb2d3cb3a9.zip |
** Fix for bug #200254
2009-01-19 Milan Crha <mcrha@redhat.com>
** Fix for bug #200254
* gui/apps_evolution_calendar.schemas.in:
* gui/dialogs/cal-prefs-dialog.glade:
* gui/dialogs/cal-prefs-dialog.h: (struct _CalendarPrefsDialog):
* gui/dialogs/cal-prefs-dialog.c: (dview_show_week_no_toggled),
(setup_changes), (show_config), (calendar_prefs_dialog_construct):
* gui/calendar-config-keys.h:
* gui/calendar-config.h:
* gui/calendar-config.c: (calendar_config_get_dview_show_week_no),
(calendar_config_set_dview_show_week_no),
(calendar_config_add_notification_dview_show_week_no):
New option whether to show week number in Day and Work Week view.
* gui/e-day-view.h: (struct _EDayView),
(e_day_view_get_show_week_number), (e_day_view_set_show_week_number):
* gui/e-day-view.c: (dview_show_week_no_changed_cb), (e_day_view_init),
(e_day_view_destroy), (e_day_view_recalc_day_starts),
(e_day_view_get_show_week_number), (e_day_view_set_show_week_number):
New widget showing week number of the first day in a view.
svn path=/trunk/; revision=37096
Diffstat (limited to 'calendar/gui/e-day-view.c')
-rw-r--r-- | calendar/gui/e-day-view.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 04c258d7fc..d60fd1e5c2 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -702,6 +702,12 @@ timezone_changed_cb (ECalendarView *cal_view, icaltimezone *old_zone, } static void +dview_show_week_no_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data) +{ + e_day_view_set_show_week_number (data, calendar_config_get_dview_show_week_no ()); +} + +static void e_day_view_init (EDayView *day_view) { gint day; @@ -805,6 +811,12 @@ e_day_view_init (EDayView *day_view) day_view->before_click_dtstart = 0; day_view->before_click_dtend = 0; + day_view->week_number_label = gtk_label_new (""); + gtk_table_attach (GTK_TABLE (day_view), day_view->week_number_label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0); + day_view->wn_notif_id = calendar_config_add_notification_dview_show_week_no (dview_show_week_no_changed_cb, day_view); + if (calendar_config_get_dview_show_week_no ()) + gtk_widget_show (day_view->week_number_label); + /* * Top Canvas */ @@ -1081,6 +1093,11 @@ e_day_view_destroy (GtkObject *object) e_day_view_stop_auto_scroll (day_view); + if (day_view->wn_notif_id) { + calendar_config_remove_notification (day_view->wn_notif_id); + day_view->wn_notif_id = 0; + } + if (day_view->large_font_desc) { pango_font_description_free (day_view->large_font_desc); day_view->large_font_desc = NULL; @@ -2281,6 +2298,9 @@ e_day_view_recalc_day_starts (EDayView *day_view, time_t start_time) { gint day; + char *str; + struct icaltimetype tt; + GDate dt; day_view->day_starts[0] = start_time; for (day = 1; day <= day_view->days_shown; day++) { @@ -2294,8 +2314,36 @@ e_day_view_recalc_day_starts (EDayView *day_view, day_view->lower = start_time; day_view->upper = day_view->day_starts[day_view->days_shown]; + + tt = icaltime_from_timet_with_zone (day_view->day_starts[0], FALSE, e_calendar_view_get_timezone (E_CALENDAR_VIEW (day_view))); + g_date_clear (&dt, 1); + g_date_set_dmy (&dt, tt.day, tt.month, tt.year); + /* To Translators: the %d stands for a week number, it's value between 1 and 52/53 */ + str = g_strdup_printf (_("Week %d"), g_date_get_iso8601_week_of_year (&dt)); + gtk_label_set_text (GTK_LABEL (day_view->week_number_label), str); + g_free (str); } +gboolean +e_day_view_get_show_week_number (EDayView *day_view) +{ + g_return_val_if_fail (day_view != NULL, FALSE); + + return GTK_WIDGET_VISIBLE (day_view->week_number_label); +} + +void +e_day_view_set_show_week_number (EDayView *day_view, gboolean show) +{ + g_return_if_fail (day_view != NULL); + + if (e_day_view_get_show_week_number (day_view) != show) { + if (show) + gtk_widget_show (day_view->week_number_label); + else + gtk_widget_hide (day_view->week_number_label); + } +} /* Whether we are displaying a work-week, in which case the display always starts on the first day of the working week. */ |