aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/apps_evolution_calendar.schemas.in12
-rw-r--r--calendar/gui/calendar-config-keys.h2
-rw-r--r--calendar/gui/calendar-config.c29
-rw-r--r--calendar/gui/calendar-config.h5
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.c11
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.glade19
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.h1
-rw-r--r--calendar/gui/e-week-view.c48
-rw-r--r--calendar/gui/e-week-view.h4
-rw-r--r--calendar/gui/gnome-cal.c2
10 files changed, 127 insertions, 6 deletions
diff --git a/calendar/gui/apps_evolution_calendar.schemas.in b/calendar/gui/apps_evolution_calendar.schemas.in
index acf9550874..48c5100ad8 100644
--- a/calendar/gui/apps_evolution_calendar.schemas.in
+++ b/calendar/gui/apps_evolution_calendar.schemas.in
@@ -538,6 +538,18 @@
</locale>
</schema>
+ <schema>
+ <key>/schemas/apps/evolution/calendar/display/month_scroll_by_week</key>
+ <applyto>/apps/evolution/calendar/display/month_scroll_by_week</applyto>
+ <owner>evolution-calendar</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Scroll Month View by a week</short>
+ <long>Whether to scroll a Month View by a week, not by a month.</long>
+ </locale>
+ </schema>
+
<!-- Date navigator -->
<schema>
diff --git a/calendar/gui/calendar-config-keys.h b/calendar/gui/calendar-config-keys.h
index 691b4f0281..6277f46d31 100644
--- a/calendar/gui/calendar-config-keys.h
+++ b/calendar/gui/calendar-config-keys.h
@@ -46,7 +46,7 @@ G_BEGIN_DECLS
#define CALENDAR_CONFIG_DAY_END_HOUR CALENDAR_CONFIG_PREFIX "/display/day_end_hour"
#define CALENDAR_CONFIG_DAY_END_MINUTE CALENDAR_CONFIG_PREFIX "/display/day_end_minute"
#define CALENDAR_CONFIG_TIME_DIVISIONS CALENDAR_CONFIG_PREFIX "/display/time_divisions"
-#define CALENDAR_CONFIG_TIME_DIVISIONS CALENDAR_CONFIG_PREFIX "/display/time_divisions"
+#define CALENDAR_CONFIG_MONTH_SCROLL_BY_WEEK CALENDAR_CONFIG_PREFIX "/display/month_scroll_by_week"
#define CALENDAR_CONFIG_MARCUS_BAINS_LINE CALENDAR_CONFIG_PREFIX "/display/marcus_bains_line"
#define CALENDAR_CONFIG_MARCUS_BAINS_COLOR_DAYVIEW CALENDAR_CONFIG_PREFIX "/display/marcus_bains_color_dayview"
#define CALENDAR_CONFIG_MARCUS_BAINS_COLOR_TIMEBAR CALENDAR_CONFIG_PREFIX "/display/marcus_bains_color_timebar"
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index 65864ea272..8af8230efd 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -587,6 +587,35 @@ calendar_config_add_notification_time_divisions (GConfClientNotifyFunc func, gpo
return id;
}
+/* Scroll in a month view by a week, not by a month */
+gboolean
+calendar_config_get_month_scroll_by_week (void)
+{
+ calendar_config_init ();
+
+ return gconf_client_get_bool (config, CALENDAR_CONFIG_MONTH_SCROLL_BY_WEEK, NULL);
+}
+
+void
+calendar_config_set_month_scroll_by_week (gboolean value)
+{
+ calendar_config_init ();
+
+ gconf_client_set_bool (config, CALENDAR_CONFIG_MONTH_SCROLL_BY_WEEK, value, NULL);
+}
+
+guint
+calendar_config_add_notification_month_scroll_by_week (GConfClientNotifyFunc func, gpointer data)
+{
+ guint id;
+
+ calendar_config_init ();
+
+ id = gconf_client_notify_add (config, CALENDAR_CONFIG_MONTH_SCROLL_BY_WEEK, func, data, NULL, NULL);
+
+ return id;
+}
+
/* Whether we show the Marcus Bains Line (current time), and in what colors. */
void
calendar_config_get_marcus_bains (gboolean *show_line, const char **dayview_color, const char **timebar_color)
diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h
index 667962e1db..c28077c1ec 100644
--- a/calendar/gui/calendar-config.h
+++ b/calendar/gui/calendar-config.h
@@ -276,4 +276,9 @@ guint calendar_config_add_notification_day_second_zone (GConfClientNotifyFunc
gboolean calendar_config_get_ba_reminder (int *interval, CalUnits *units);
void calendar_config_set_ba_reminder (gboolean *enabled, int *interval, CalUnits *units);
+/* Scroll in a month view by a week, not by a month */
+gboolean calendar_config_get_month_scroll_by_week (void);
+void calendar_config_set_month_scroll_by_week (gboolean value);
+guint calendar_config_add_notification_month_scroll_by_week (GConfClientNotifyFunc func, gpointer data);
+
#endif /* _CALENDAR_CONFIG_H_ */
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c
index 60678d93e1..0e1f0f05d1 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.c
+++ b/calendar/gui/dialogs/cal-prefs-dialog.c
@@ -325,6 +325,12 @@ dview_show_week_no_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs)
}
static void
+month_scroll_by_week_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs)
+{
+ calendar_config_set_month_scroll_by_week (gtk_toggle_button_get_active (toggle));
+}
+
+static void
hide_completed_tasks_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs)
{
gboolean hide;
@@ -528,6 +534,7 @@ setup_changes (CalendarPrefsDialog *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->month_scroll_by_week), "toggled", G_CALLBACK (month_scroll_by_week_toggled), prefs);
g_signal_connect (G_OBJECT (prefs->tasks_hide_completed), "toggled",
G_CALLBACK (hide_completed_tasks_toggled), prefs);
@@ -704,6 +711,9 @@ show_config (CalendarPrefsDialog *prefs)
/* Day/Work Week view - Show Week Number. */
e_dialog_toggle_set (prefs->dview_show_week_no, calendar_config_get_dview_show_week_no ());
+ /* Month View - Scroll by a week */
+ e_dialog_toggle_set (prefs->month_scroll_by_week, calendar_config_get_month_scroll_by_week ());
+
/* Task list */
show_task_list_config (prefs);
@@ -817,6 +827,7 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs)
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->month_scroll_by_week = glade_xml_get_widget (gui, "month_scroll_by_week");
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 867abdbb22..a279ad1107 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.glade
+++ b/calendar/gui/dialogs/cal-prefs-dialog.glade
@@ -1368,6 +1368,25 @@ Days</property>
<property name="fill">False</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkCheckButton" id="month_scroll_by_week">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Sc_roll Month View by a week</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 559eacced7..30b62440e5 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.h
+++ b/calendar/gui/dialogs/cal-prefs-dialog.h
@@ -67,6 +67,7 @@ struct _CalendarPrefsDialog {
GtkWidget *compress_weekend;
GtkWidget *dnav_show_week_no;
GtkWidget *dview_show_week_no;
+ GtkWidget *month_scroll_by_week;
GtkWidget *tasks_due_today_color;
GtkWidget *tasks_overdue_color;
GtkWidget *tasks_hide_completed;
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 3109094d30..3e5c42725f 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -504,6 +504,8 @@ e_week_view_init (EWeekView *week_view)
week_view->spans = NULL;
week_view->multi_week_view = FALSE;
+ week_view->month_scroll_by_week = FALSE;
+ week_view->scroll_by_week_notif_id = 0;
week_view->update_base_date = TRUE;
week_view->weeks_shown = 6;
week_view->rows = 6;
@@ -703,6 +705,11 @@ e_week_view_destroy (GtkObject *object)
week_view->resize_width_cursor = NULL;
}
+ if (week_view->scroll_by_week_notif_id) {
+ calendar_config_remove_notification (week_view->scroll_by_week_notif_id);
+ week_view->scroll_by_week_notif_id = 0;
+ }
+
GTK_OBJECT_CLASS (e_week_view_parent_class)->destroy (object);
}
@@ -1643,6 +1650,19 @@ e_week_view_recalc_day_starts (EWeekView *week_view,
}
}
+static void
+month_scrol_by_week_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
+{
+ EWeekView *week_view = user_data;
+
+ g_return_if_fail (week_view != NULL);
+ g_return_if_fail (E_IS_WEEK_VIEW (week_view));
+
+ if (week_view->multi_week_view && week_view->month_scroll_by_week != calendar_config_get_month_scroll_by_week ()) {
+ week_view->multi_week_view = FALSE;
+ e_week_view_set_multi_week_view (week_view, TRUE);
+ }
+}
gboolean
e_week_view_get_multi_week_view (EWeekView *week_view)
@@ -1669,11 +1689,26 @@ e_week_view_set_multi_week_view (EWeekView *week_view,
if (multi_week_view) {
gtk_widget_show (week_view->titles_canvas);
- page_increment = 4;
- page_size = 5;
+ week_view->month_scroll_by_week = calendar_config_get_month_scroll_by_week ();
+
+ if (!week_view->scroll_by_week_notif_id)
+ week_view->scroll_by_week_notif_id = calendar_config_add_notification_month_scroll_by_week (month_scrol_by_week_changed_cb, week_view);
+
+ if (week_view->month_scroll_by_week) {
+ page_increment = 1;
+ page_size = 1;
+ } else {
+ page_increment = 4;
+ page_size = 5;
+ }
} else {
gtk_widget_hide (week_view->titles_canvas);
page_increment = page_size = 1;
+
+ if (week_view->scroll_by_week_notif_id) {
+ calendar_config_remove_notification (week_view->scroll_by_week_notif_id);
+ week_view->scroll_by_week_notif_id = 0;
+ }
}
adjustment = GTK_RANGE (week_view->vscrollbar)->adjustment;
@@ -1731,8 +1766,13 @@ e_week_view_set_weeks_shown (EWeekView *week_view,
week_view->weeks_shown = weeks_shown;
if (week_view->multi_week_view) {
- page_increment = 4;
- page_size = 5;
+ if (week_view->month_scroll_by_week) {
+ page_increment = 1;
+ page_size = 1;
+ } else {
+ page_increment = 4;
+ page_size = 5;
+ }
adjustment = GTK_RANGE (week_view->vscrollbar)->adjustment;
adjustment->page_increment = page_increment;
diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h
index 132857c712..2458efcdd1 100644
--- a/calendar/gui/e-week-view.h
+++ b/calendar/gui/e-week-view.h
@@ -203,6 +203,10 @@ struct _EWeekView
one week is shown, with a different layout. */
gboolean multi_week_view;
+ /* TRUE when requires scrolling by a week in a multi_week_view */
+ gboolean month_scroll_by_week;
+ guint scroll_by_week_notif_id;
+
gboolean update_base_date;
/* How many weeks we are showing. This is only relevant if
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index c2e4511ce6..87c61bb418 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -710,7 +710,7 @@ get_times_for_views (GnomeCalendar *gcal, GnomeCalendarViewType view_type, time_
/* FIXME We should be using the same day of the week enum every where */
display_start = (E_WEEK_VIEW (priv->views[view_type])->display_start_day + 1) % 7;
- if (!priv->range_selected)
+ if (!priv->range_selected && (!E_WEEK_VIEW (priv->views[view_type])->multi_week_view || !E_WEEK_VIEW (priv->views[view_type])->month_scroll_by_week))
*start_time = time_month_begin_with_zone (*start_time, priv->zone);
*start_time = time_week_begin_with_zone (*start_time, display_start, priv->zone);
*end_time = time_add_week_with_zone (*start_time, shown, priv->zone);