diff options
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/apps_evolution_calendar.schemas.in | 12 | ||||
-rw-r--r-- | calendar/gui/calendar-config-keys.h | 1 | ||||
-rw-r--r-- | calendar/gui/calendar-config.c | 30 | ||||
-rw-r--r-- | calendar/gui/calendar-config.h | 5 | ||||
-rw-r--r-- | calendar/gui/dialogs/cal-prefs-dialog.c | 11 | ||||
-rw-r--r-- | calendar/gui/dialogs/cal-prefs-dialog.glade | 18 | ||||
-rw-r--r-- | calendar/gui/dialogs/cal-prefs-dialog.h | 1 | ||||
-rw-r--r-- | calendar/gui/e-day-view.c | 48 | ||||
-rw-r--r-- | calendar/gui/e-day-view.h | 10 |
9 files changed, 135 insertions, 1 deletions
diff --git a/calendar/gui/apps_evolution_calendar.schemas.in b/calendar/gui/apps_evolution_calendar.schemas.in index 7da667a165..1bc91840d2 100644 --- a/calendar/gui/apps_evolution_calendar.schemas.in +++ b/calendar/gui/apps_evolution_calendar.schemas.in @@ -526,6 +526,18 @@ </locale> </schema> + <schema> + <key>/schemas/apps/evolution/calendar/display/day_view_show_week_number</key> + <applyto>/apps/evolution/calendar/display/day_view_show_week_number</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Show week number in Day and Work Week View</short> + <long>Whether to show week number in the Day and Work Week View.</long> + </locale> + </schema> + <!-- Date navigator --> <schema> diff --git a/calendar/gui/calendar-config-keys.h b/calendar/gui/calendar-config-keys.h index 9d50d21c86..6706c65cdc 100644 --- a/calendar/gui/calendar-config-keys.h +++ b/calendar/gui/calendar-config-keys.h @@ -61,6 +61,7 @@ G_BEGIN_DECLS #define CALENDAR_CONFIG_COMPRESS_WEEKEND CALENDAR_CONFIG_PREFIX "/display/compress_weekend" #define CALENDAR_CONFIG_SHOW_EVENT_END CALENDAR_CONFIG_PREFIX "/display/show_event_end" #define CALENDAR_CONFIG_WORKING_DAYS CALENDAR_CONFIG_PREFIX "/display/working_days" +#define CALENDAR_CONFIG_DV_WEEK_NUMBER CALENDAR_CONFIG_PREFIX "/display/day_view_show_week_number" #define CALENDAR_CONFIG_DAY_SECOND_ZONE CALENDAR_CONFIG_PREFIX "/display/day_second_zone" #define CALENDAR_CONFIG_DAY_SECOND_ZONES_LIST CALENDAR_CONFIG_PREFIX "/display/day_second_zones" #define CALENDAR_CONFIG_DAY_SECOND_ZONES_MAX CALENDAR_CONFIG_PREFIX "/display/day_second_zones_max" diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index f4efd7e95e..4e6f853db0 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -678,6 +678,36 @@ calendar_config_add_notification_marcus_bains (GConfClientNotifyFunc func, gpoin *not_tcolor = gconf_client_notify_add (config, CALENDAR_CONFIG_MARCUS_BAINS_COLOR_TIMEBAR, func, data, NULL, NULL); } +/* Whether we show week number in the Day View. */ +gboolean +calendar_config_get_dview_show_week_no (void) +{ + calendar_config_init (); + + return gconf_client_get_bool (config, CALENDAR_CONFIG_DV_WEEK_NUMBER, NULL); +} + + +void +calendar_config_set_dview_show_week_no (gboolean show_week_no) +{ + calendar_config_init (); + + gconf_client_set_bool (config, CALENDAR_CONFIG_DV_WEEK_NUMBER, show_week_no, NULL); +} + +guint +calendar_config_add_notification_dview_show_week_no (GConfClientNotifyFunc func, gpointer data) +{ + guint id; + + calendar_config_init (); + + id = gconf_client_notify_add (config, CALENDAR_CONFIG_DV_WEEK_NUMBER, func, data, NULL, NULL); + + return id; +} + /* Whether we show week numbers in the Date Navigator. */ gboolean calendar_config_get_dnav_show_week_no (void) diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h index 495b5c591b..09973e1329 100644 --- a/calendar/gui/calendar-config.h +++ b/calendar/gui/calendar-config.h @@ -154,6 +154,11 @@ gboolean calendar_config_get_dnav_show_week_no (void); void calendar_config_set_dnav_show_week_no (gboolean show_week_no); guint calendar_config_add_notification_dnav_show_week_no (GConfClientNotifyFunc func, gpointer data); +/* Whether we show week number in the day view. */ +gboolean calendar_config_get_dview_show_week_no (void); +void calendar_config_set_dview_show_week_no (gboolean show_week_no); +guint calendar_config_add_notification_dview_show_week_no (GConfClientNotifyFunc func, gpointer data); + /* The positions of the panes in the normal and month views. */ gint calendar_config_get_hpane_pos (void); void calendar_config_set_hpane_pos (gint hpane_pos); diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 38871c2f89..8cec102e4a 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -333,6 +333,12 @@ dnav_show_week_no_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) } static void +dview_show_week_no_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) +{ + calendar_config_set_dview_show_week_no (gtk_toggle_button_get_active (toggle)); +} + +static void hide_completed_tasks_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) { gboolean hide; @@ -483,6 +489,7 @@ setup_changes (CalendarPrefsDialog *prefs) g_signal_connect (G_OBJECT (prefs->show_end_times), "toggled", G_CALLBACK (show_end_times_toggled), prefs); g_signal_connect (G_OBJECT (prefs->compress_weekend), "toggled", G_CALLBACK (compress_weekend_toggled), prefs); g_signal_connect (G_OBJECT (prefs->dnav_show_week_no), "toggled", G_CALLBACK (dnav_show_week_no_toggled), prefs); + g_signal_connect (G_OBJECT (prefs->dview_show_week_no), "toggled", G_CALLBACK (dview_show_week_no_toggled), prefs); g_signal_connect (G_OBJECT (prefs->tasks_hide_completed), "toggled", G_CALLBACK (hide_completed_tasks_toggled), prefs); @@ -654,6 +661,9 @@ show_config (CalendarPrefsDialog *prefs) /* Date Navigator - Show Week Numbers. */ e_dialog_toggle_set (prefs->dnav_show_week_no, calendar_config_get_dnav_show_week_no ()); + /* Day/Work Week view - Show Week Number. */ + e_dialog_toggle_set (prefs->dview_show_week_no, calendar_config_get_dview_show_week_no ()); + /* Task list */ show_task_list_config (prefs); @@ -755,6 +765,7 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs) prefs->show_end_times = glade_xml_get_widget (gui, "show_end_times"); prefs->compress_weekend = glade_xml_get_widget (gui, "compress_weekend"); prefs->dnav_show_week_no = glade_xml_get_widget (gui, "dnav_show_week_no"); + prefs->dview_show_week_no = glade_xml_get_widget (gui, "dview_show_week_no"); prefs->tasks_due_today_color = glade_xml_get_widget (gui, "tasks_due_today_color"); prefs->tasks_overdue_color = glade_xml_get_widget (gui, "tasks_overdue_color"); prefs->tasks_hide_completed = glade_xml_get_widget (gui, "tasks_hide_completed"); diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade index 0282d17d4d..9f7f6a8092 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ b/calendar/gui/dialogs/cal-prefs-dialog.glade @@ -1176,6 +1176,24 @@ Days</property> <property name="fill">False</property> </packing> </child> + <child> + <widget class="GtkCheckButton" id="dview_show_week_no"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Show week n_umber in Day and Work Week View</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> </widget> <packing> <property name="padding">0</property> diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 24682a6cc7..512d5d06c6 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -62,6 +62,7 @@ struct _CalendarPrefsDialog { GtkWidget *show_end_times; GtkWidget *compress_weekend; GtkWidget *dnav_show_week_no; + GtkWidget *dview_show_week_no; GtkWidget *tasks_due_today_color; GtkWidget *tasks_overdue_color; GtkWidget *tasks_hide_completed; 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. */ diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h index 3a357e332d..1f518198fa 100644 --- a/calendar/gui/e-day-view.h +++ b/calendar/gui/e-day-view.h @@ -220,6 +220,11 @@ struct _EDayView GtkWidget *vscrollbar; + /* label showing week number in upper-left corner */ + GtkWidget *week_number_label; + /* option change notification id for week number */ + guint wn_notif_id; + /* S-expression for query and the query object */ ECalView *query; @@ -607,9 +612,12 @@ void e_day_view_ensure_rows_visible (EDayView *day_view, gint start_row, gint end_row); - void e_day_view_update_marcus_bains (EDayView *day_view); +/* Week number in upper-left corner of the day view widget */ +gboolean e_day_view_get_show_week_number (EDayView *day_view); +void e_day_view_set_show_week_number (EDayView *day_view, gboolean show); + G_END_DECLS #endif /* _E_DAY_VIEW_H_ */ |