evolution r37096 - in trunk/calendar: . gui gui/dialogs
- From: mcrha svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution r37096 - in trunk/calendar: . gui gui/dialogs
- Date: Mon, 19 Jan 2009 13:10:36 +0000 (UTC)
Author: mcrha
Date: Mon Jan 19 13:10:36 2009
New Revision: 37096
URL: http://svn.gnome.org/viewvc/evolution?rev=37096&view=rev
Log:
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.
Modified:
trunk/calendar/ChangeLog
trunk/calendar/gui/apps_evolution_calendar.schemas.in
trunk/calendar/gui/calendar-config-keys.h
trunk/calendar/gui/calendar-config.c
trunk/calendar/gui/calendar-config.h
trunk/calendar/gui/dialogs/cal-prefs-dialog.c
trunk/calendar/gui/dialogs/cal-prefs-dialog.glade
trunk/calendar/gui/dialogs/cal-prefs-dialog.h
trunk/calendar/gui/e-day-view.c
trunk/calendar/gui/e-day-view.h
Modified: trunk/calendar/gui/apps_evolution_calendar.schemas.in
==============================================================================
--- trunk/calendar/gui/apps_evolution_calendar.schemas.in (original)
+++ trunk/calendar/gui/apps_evolution_calendar.schemas.in Mon Jan 19 13:10:36 2009
@@ -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>
Modified: trunk/calendar/gui/calendar-config-keys.h
==============================================================================
--- trunk/calendar/gui/calendar-config-keys.h (original)
+++ trunk/calendar/gui/calendar-config-keys.h Mon Jan 19 13:10:36 2009
@@ -61,6 +61,7 @@
#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"
Modified: trunk/calendar/gui/calendar-config.c
==============================================================================
--- trunk/calendar/gui/calendar-config.c (original)
+++ trunk/calendar/gui/calendar-config.c Mon Jan 19 13:10:36 2009
@@ -678,6 +678,36 @@
*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)
Modified: trunk/calendar/gui/calendar-config.h
==============================================================================
--- trunk/calendar/gui/calendar-config.h (original)
+++ trunk/calendar/gui/calendar-config.h Mon Jan 19 13:10:36 2009
@@ -154,6 +154,11 @@
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);
Modified: trunk/calendar/gui/dialogs/cal-prefs-dialog.c
==============================================================================
--- trunk/calendar/gui/dialogs/cal-prefs-dialog.c (original)
+++ trunk/calendar/gui/dialogs/cal-prefs-dialog.c Mon Jan 19 13:10:36 2009
@@ -333,6 +333,12 @@
}
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 @@
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 @@
/* 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 @@
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");
Modified: trunk/calendar/gui/dialogs/cal-prefs-dialog.glade
==============================================================================
--- trunk/calendar/gui/dialogs/cal-prefs-dialog.glade (original)
+++ trunk/calendar/gui/dialogs/cal-prefs-dialog.glade Mon Jan 19 13:10:36 2009
@@ -1176,6 +1176,24 @@
<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>
Modified: trunk/calendar/gui/dialogs/cal-prefs-dialog.h
==============================================================================
--- trunk/calendar/gui/dialogs/cal-prefs-dialog.h (original)
+++ trunk/calendar/gui/dialogs/cal-prefs-dialog.h Mon Jan 19 13:10:36 2009
@@ -62,6 +62,7 @@
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;
Modified: trunk/calendar/gui/e-day-view.c
==============================================================================
--- trunk/calendar/gui/e-day-view.c (original)
+++ trunk/calendar/gui/e-day-view.c Mon Jan 19 13:10:36 2009
@@ -702,6 +702,12 @@
}
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 @@
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_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 @@
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 @@
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. */
Modified: trunk/calendar/gui/e-day-view.h
==============================================================================
--- trunk/calendar/gui/e-day-view.h (original)
+++ trunk/calendar/gui/e-day-view.h Mon Jan 19 13:10:36 2009
@@ -220,6 +220,11 @@
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 @@
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_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]