aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-08-13 04:43:04 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-08-13 06:30:19 +0800
commit88aa930c58ad27858453a2109cc899f34df21056 (patch)
treea21905314aaca29dd2c17c4f4954995f6071b3c3 /modules/calendar
parent6575bf9d46f183b553885b5a47c206255f45bed6 (diff)
downloadgsoc2013-evolution-88aa930c58ad27858453a2109cc899f34df21056.tar
gsoc2013-evolution-88aa930c58ad27858453a2109cc899f34df21056.tar.gz
gsoc2013-evolution-88aa930c58ad27858453a2109cc899f34df21056.tar.bz2
gsoc2013-evolution-88aa930c58ad27858453a2109cc899f34df21056.tar.lz
gsoc2013-evolution-88aa930c58ad27858453a2109cc899f34df21056.tar.xz
gsoc2013-evolution-88aa930c58ad27858453a2109cc899f34df21056.tar.zst
gsoc2013-evolution-88aa930c58ad27858453a2109cc899f34df21056.zip
Make switching between calendar views work.
Diffstat (limited to 'modules/calendar')
-rw-r--r--modules/calendar/e-cal-shell-content.c33
-rw-r--r--modules/calendar/e-cal-shell-view-private.c9
-rw-r--r--modules/calendar/e-cal-shell-view.c9
-rw-r--r--modules/calendar/e-cal-shell-view.h3
4 files changed, 39 insertions, 15 deletions
diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c
index 4409c1fc08..eccd146ba6 100644
--- a/modules/calendar/e-cal-shell-content.c
+++ b/modules/calendar/e-cal-shell-content.c
@@ -74,7 +74,6 @@ cal_shell_content_display_view_cb (ECalShellContent *cal_shell_content,
GalView *gal_view)
{
GnomeCalendar *calendar;
- CalendarView *gal_calendar_view;
GnomeCalendarViewType view_type;
/* XXX This is confusing: we have CalendarView and ECalendarView.
@@ -99,6 +98,8 @@ cal_shell_content_display_view_cb (ECalShellContent *cal_shell_content,
view_type = calendar_view_get_view_type (
CALENDAR_VIEW (gal_view));
}
+
+ gnome_calendar_display_view (calendar, view_type);
}
static void
@@ -389,6 +390,10 @@ cal_shell_content_constructed (GObject *object)
gtk_widget_show (GTK_WIDGET (calendar_view));
}
+ e_binding_new (
+ G_OBJECT (priv->calendar), "view",
+ G_OBJECT (priv->notebook), "page");
+
container = priv->vpaned;
widget = gtk_vbox_new (FALSE, 0);
@@ -448,7 +453,8 @@ cal_shell_content_constructed (GObject *object)
view_instance, "display-view",
G_CALLBACK (cal_shell_content_display_view_cb),
object);
- gal_view_instance_load (view_instance);
+ /* XXX Actually, don't load the view instance just yet.
+ * The GtkWidget::map() callback below explains why. */
priv->view_instance = view_instance;
g_signal_connect_swapped (
@@ -469,9 +475,29 @@ cal_shell_content_constructed (GObject *object)
}
static void
+cal_shell_content_map (GtkWidget *widget)
+{
+ ECalShellContentPrivate *priv;
+ GalViewInstance *view_instance;
+
+ /* XXX Delay loading the GalViewInstance until after ECalShellView
+ * has a chance to install the sidebar's date navigator into
+ * GnomeCalendar, since loading the GalViewInstance triggers a
+ * callback in GnomeCalendar that requires the date navigator.
+ * Ordinarily we would do this at the end of constructed(), but
+ * that's too soon in this case. (This feels kind of kludgy.) */
+ priv = E_CAL_SHELL_CONTENT_GET_PRIVATE (widget);
+ gal_view_instance_load (priv->view_instance);
+
+ /* Chain up to parent's map() method. */
+ GTK_WIDGET_CLASS (parent_class)->map (widget);
+}
+
+static void
cal_shell_content_class_init (ECalShellContentClass *class)
{
GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (ECalShellContentPrivate));
@@ -482,6 +508,9 @@ cal_shell_content_class_init (ECalShellContentClass *class)
object_class->dispose = cal_shell_content_dispose;
object_class->finalize = cal_shell_content_finalize;
object_class->constructed = cal_shell_content_constructed;
+
+ widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->map = cal_shell_content_map;
}
static void
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index 063e7461ed..60ec3c77ab 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -368,6 +368,11 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
e_cal_shell_view_update_sidebar (cal_shell_view);
e_cal_shell_view_update_search_filter (cal_shell_view);
e_cal_shell_view_update_timezone (cal_shell_view);
+
+ /* Keep the toolbar view buttons in sync with the calendar. */
+ e_mutual_binding_new (
+ G_OBJECT (calendar), "view",
+ G_OBJECT (ACTION (CALENDAR_VIEW_DAY)), "current-value");
}
void
@@ -658,6 +663,7 @@ e_cal_shell_view_update_sidebar (ECalShellView *cal_shell_view)
{
EShellView *shell_view;
EShellSidebar *shell_sidebar;
+ ECalShellContent *cal_shell_content;
GnomeCalendar *calendar;
GnomeCalendarViewType view;
time_t start_time, end_time;
@@ -672,7 +678,8 @@ e_cal_shell_view_update_sidebar (ECalShellView *cal_shell_view)
shell_view = E_SHELL_VIEW (cal_shell_view);
shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
- calendar = e_cal_shell_view_get_calendar (cal_shell_view);
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
gnome_calendar_get_visible_time_range (
calendar, &start_time, &end_time);
diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c
index 2c977e7553..d9d21799b9 100644
--- a/modules/calendar/e-cal-shell-view.c
+++ b/modules/calendar/e-cal-shell-view.c
@@ -217,12 +217,3 @@ e_cal_shell_view_register_type (GTypeModule *type_module)
type_module, E_TYPE_SHELL_VIEW,
"ECalShellView", &type_info, 0);
}
-
-GnomeCalendar *
-e_cal_shell_view_get_calendar (ECalShellView *cal_shell_view)
-{
- g_return_val_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view), NULL);
-
- /* FIXME */
- return NULL;
-}
diff --git a/modules/calendar/e-cal-shell-view.h b/modules/calendar/e-cal-shell-view.h
index 67fa15220c..0cd7382012 100644
--- a/modules/calendar/e-cal-shell-view.h
+++ b/modules/calendar/e-cal-shell-view.h
@@ -23,8 +23,6 @@
#define E_CAL_SHELL_VIEW_H
#include <shell/e-shell-view.h>
-#include <calendar/gui/gnome-cal.h>
-#include <libedataserver/e-source-list.h>
/* Standard GObject macros */
#define E_TYPE_CAL_SHELL_VIEW \
@@ -62,7 +60,6 @@ struct _ECalShellViewClass {
GType e_cal_shell_view_get_type (void);
void e_cal_shell_view_register_type (GTypeModule *type_module);
-GnomeCalendar * e_cal_shell_view_get_calendar (ECalShellView *cal_shell_view);
G_END_DECLS