aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2003-07-18 18:37:44 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2003-07-18 18:37:44 +0800
commit9480887536f318abc6f8540ca2a8d9114becc6e3 (patch)
tree05c8412a6191402351b5034462504c850dd6829d
parent451cc1a07a7010fba205ffebfb7778b284f524cf (diff)
downloadgsoc2013-evolution-9480887536f318abc6f8540ca2a8d9114becc6e3.tar
gsoc2013-evolution-9480887536f318abc6f8540ca2a8d9114becc6e3.tar.gz
gsoc2013-evolution-9480887536f318abc6f8540ca2a8d9114becc6e3.tar.bz2
gsoc2013-evolution-9480887536f318abc6f8540ca2a8d9114becc6e3.tar.lz
gsoc2013-evolution-9480887536f318abc6f8540ca2a8d9114becc6e3.tar.xz
gsoc2013-evolution-9480887536f318abc6f8540ca2a8d9114becc6e3.tar.zst
gsoc2013-evolution-9480887536f318abc6f8540ca2a8d9114becc6e3.zip
moved duplicated code to...
2003-07-18 Rodrigo Moya <rodrigo@ximian.com> * gui/e-day-view.[ch]: * gui/e-week-view.[ch]: moved duplicated code to... * gui/e-cal-view.[ch]: ...here. (e_cal_view_get_calendar, e_cal_view_set_calendar): new functions. * gui/e-week-view-event-item.c (e_week_event_item_double_click): * gui/gnome-cal.c (setup_widgets): adapted to changes in views. svn path=/trunk/; revision=21865
-rw-r--r--calendar/ChangeLog11
-rw-r--r--calendar/gui/Makefile.am2
-rw-r--r--calendar/gui/e-cal-view.c39
-rw-r--r--calendar/gui/e-cal-view.h10
-rw-r--r--calendar/gui/e-calendar-view.c39
-rw-r--r--calendar/gui/e-calendar-view.h10
-rw-r--r--calendar/gui/e-day-view.c98
-rw-r--r--calendar/gui/e-day-view.h6
-rw-r--r--calendar/gui/e-week-view-event-item.c6
-rw-r--r--calendar/gui/e-week-view.c94
-rw-r--r--calendar/gui/e-week-view.h6
-rw-r--r--calendar/gui/gnome-cal.c8
12 files changed, 191 insertions, 138 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 5bb769a8b6..8cb52cd12e 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,14 @@
+2003-07-18 Rodrigo Moya <rodrigo@ximian.com>
+
+ * gui/e-day-view.[ch]:
+ * gui/e-week-view.[ch]: moved duplicated code to...
+
+ * gui/e-cal-view.[ch]: ...here.
+ (e_cal_view_get_calendar, e_cal_view_set_calendar): new functions.
+
+ * gui/e-week-view-event-item.c (e_week_event_item_double_click):
+ * gui/gnome-cal.c (setup_widgets): adapted to changes in views.
+
2003-07-17 Rodrigo Moya <rodrigo@ximian.com>
* gui/e-cal-view.[ch]: new base class for calendar views.
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 0293eb2a11..09d1db57f8 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -114,6 +114,8 @@ libevolution_calendar_la_SOURCES = \
control-factory.h \
e-alarm-list.c \
e-alarm-list.h \
+ e-cal-view.c \
+ e-cal-view.h \
e-calendar-table.h \
e-calendar-table.c \
e-cell-date-edit-text.h \
diff --git a/calendar/gui/e-cal-view.c b/calendar/gui/e-cal-view.c
index af2223bbff..3c35995a60 100644
--- a/calendar/gui/e-cal-view.c
+++ b/calendar/gui/e-cal-view.c
@@ -26,6 +26,8 @@
#include "e-cal-view.h"
struct _ECalViewPrivate {
+ /* The GnomeCalendar we are associated to */
+ GnomeCalendar *calendar;
};
static void e_cal_view_class_init (ECalViewClass *klass);
@@ -34,6 +36,14 @@ static void e_cal_view_destroy (GtkObject *object);
static GObjectClass *parent_class = NULL;
+/* Signal IDs */
+enum {
+ SELECTION_CHANGED,
+ LAST_SIGNAL
+};
+
+static guint e_cal_view_signals[LAST_SIGNAL] = { 0 };
+
static void
e_cal_view_class_init (ECalViewClass *klass)
{
@@ -41,7 +51,20 @@ e_cal_view_class_init (ECalViewClass *klass)
parent_class = g_type_class_peek_parent (klass);
+ /* Create class' signals */
+ e_cal_view_signals[SELECTION_CHANGED] =
+ g_signal_new ("selection_changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECalViewClass, selection_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ /* Method override */
object_class->destroy = e_cal_view_destroy;
+
+ klass->selection_changed = NULL;
}
static void
@@ -68,3 +91,19 @@ e_cal_view_destroy (GtkObject *object)
E_MAKE_TYPE (e_cal_view, "ECalView", ECalView, e_cal_view_class_init,
e_cal_view_init, GTK_TYPE_TABLE);
+
+GnomeCalendar *
+e_cal_view_get_calendar (ECalView *cal_view)
+{
+ g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), NULL);
+
+ return cal_view->priv->calendar;
+}
+
+void
+e_cal_view_set_calendar (ECalView *cal_view, GnomeCalendar *calendar)
+{
+ g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+
+ cal_view->priv->calendar = calendar;
+}
diff --git a/calendar/gui/e-cal-view.h b/calendar/gui/e-cal-view.h
index bbcfbc8990..275798b43a 100644
--- a/calendar/gui/e-cal-view.h
+++ b/calendar/gui/e-cal-view.h
@@ -23,7 +23,9 @@
#ifndef _E_CAL_VIEW_H_
#define _E_CAL_VIEW_H_
+#include <cal-client/cal-client.h>
#include <gtk/gtktable.h>
+#include "gnome-cal.h"
G_BEGIN_DECLS
@@ -46,9 +48,15 @@ struct _ECalView {
struct _ECalViewClass {
GtkTableClass parent_class;
+
+ /* Notification signals */
+ void (* selection_changed) (ECalView *cal_view);
};
-GType e_cal_view_get_type (void);
+GType e_cal_view_get_type (void);
+
+GnomeCalendar *e_cal_view_get_calendar (ECalView *cal_view);
+void e_cal_view_set_calendar (ECalView *cal_view, GnomeCalendar *calendar);
G_END_DECLS
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index af2223bbff..3c35995a60 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -26,6 +26,8 @@
#include "e-cal-view.h"
struct _ECalViewPrivate {
+ /* The GnomeCalendar we are associated to */
+ GnomeCalendar *calendar;
};
static void e_cal_view_class_init (ECalViewClass *klass);
@@ -34,6 +36,14 @@ static void e_cal_view_destroy (GtkObject *object);
static GObjectClass *parent_class = NULL;
+/* Signal IDs */
+enum {
+ SELECTION_CHANGED,
+ LAST_SIGNAL
+};
+
+static guint e_cal_view_signals[LAST_SIGNAL] = { 0 };
+
static void
e_cal_view_class_init (ECalViewClass *klass)
{
@@ -41,7 +51,20 @@ e_cal_view_class_init (ECalViewClass *klass)
parent_class = g_type_class_peek_parent (klass);
+ /* Create class' signals */
+ e_cal_view_signals[SELECTION_CHANGED] =
+ g_signal_new ("selection_changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECalViewClass, selection_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ /* Method override */
object_class->destroy = e_cal_view_destroy;
+
+ klass->selection_changed = NULL;
}
static void
@@ -68,3 +91,19 @@ e_cal_view_destroy (GtkObject *object)
E_MAKE_TYPE (e_cal_view, "ECalView", ECalView, e_cal_view_class_init,
e_cal_view_init, GTK_TYPE_TABLE);
+
+GnomeCalendar *
+e_cal_view_get_calendar (ECalView *cal_view)
+{
+ g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), NULL);
+
+ return cal_view->priv->calendar;
+}
+
+void
+e_cal_view_set_calendar (ECalView *cal_view, GnomeCalendar *calendar)
+{
+ g_return_if_fail (E_IS_CAL_VIEW (cal_view));
+
+ cal_view->priv->calendar = calendar;
+}
diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h
index bbcfbc8990..275798b43a 100644
--- a/calendar/gui/e-calendar-view.h
+++ b/calendar/gui/e-calendar-view.h
@@ -23,7 +23,9 @@
#ifndef _E_CAL_VIEW_H_
#define _E_CAL_VIEW_H_
+#include <cal-client/cal-client.h>
#include <gtk/gtktable.h>
+#include "gnome-cal.h"
G_BEGIN_DECLS
@@ -46,9 +48,15 @@ struct _ECalView {
struct _ECalViewClass {
GtkTableClass parent_class;
+
+ /* Notification signals */
+ void (* selection_changed) (ECalView *cal_view);
};
-GType e_cal_view_get_type (void);
+GType e_cal_view_get_type (void);
+
+GnomeCalendar *e_cal_view_get_calendar (ECalView *cal_view);
+void e_cal_view_set_calendar (ECalView *cal_view, GnomeCalendar *calendar);
G_END_DECLS
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index f40417ec50..e731193b4f 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -111,14 +111,6 @@
#define EVOLUTION_CALENDAR_PROGRESS_IMAGE "evolution-calendar-mini.png"
static GdkPixbuf *progress_icon[2] = { NULL, NULL };
-/* Signal IDs */
-enum {
- SELECTION_CHANGED,
- LAST_SIGNAL
-};
-static guint e_day_view_signals[LAST_SIGNAL] = { 0 };
-
-
/* Drag and Drop stuff. */
enum {
TARGET_CALENDAR_EVENT,
@@ -512,15 +504,6 @@ e_day_view_class_init (EDayViewClass *class)
object_class = (GtkObjectClass *) class;
widget_class = (GtkWidgetClass *) class;
- e_day_view_signals[SELECTION_CHANGED] =
- gtk_signal_new ("selection_changed",
- GTK_RUN_LAST,
- G_TYPE_FROM_CLASS (object_class),
- GTK_SIGNAL_OFFSET (EDayViewClass, selection_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
-
/* Method override */
object_class->destroy = e_day_view_destroy;
@@ -534,8 +517,6 @@ e_day_view_class_init (EDayViewClass *class)
widget_class->focus = e_day_view_focus;
widget_class->popup_menu = e_day_view_popup_menu;
- class->selection_changed = NULL;
-
/* clipboard atom */
if (!clipboard_atom)
clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
@@ -550,7 +531,6 @@ e_day_view_init (EDayView *day_view)
GTK_WIDGET_SET_FLAGS (day_view, GTK_CAN_FOCUS);
- day_view->calendar = NULL;
day_view->client = NULL;
day_view->sexp = g_strdup ("#t"); /* match all by default */
day_view->query = NULL;
@@ -1505,17 +1485,6 @@ e_day_view_focus_out (GtkWidget *widget, GdkEventFocus *event)
return FALSE;
}
-
-void
-e_day_view_set_calendar (EDayView *day_view,
- GnomeCalendar *calendar)
-{
- g_return_if_fail (E_IS_DAY_VIEW (day_view));
-
- day_view->calendar = calendar;
-}
-
-
/* Callback used when a component is updated in the live query */
static void
query_obj_updated_cb (CalQuery *query, const char *uid,
@@ -3068,7 +3037,7 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget,
e_day_view_get_selected_time_range (day_view, &dtstart,
&dtend);
- gnome_calendar_new_appointment_for (day_view->calendar,
+ gnome_calendar_new_appointment_for (e_cal_view_get_calendar (E_CAL_VIEW (day_view)),
dtstart, dtend,
TRUE, FALSE);
return TRUE;
@@ -3190,7 +3159,7 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget,
e_day_view_get_selected_time_range (day_view, &dtstart,
&dtend);
- gnome_calendar_new_appointment_for (day_view->calendar,
+ gnome_calendar_new_appointment_for (e_cal_view_get_calendar (E_CAL_VIEW (day_view)),
dtstart, dtend,
FALSE, FALSE);
return TRUE;
@@ -3642,10 +3611,13 @@ e_day_view_on_event_double_click (EDayView *day_view,
e_day_view_stop_editing_event (day_view);
if (!destroyed) {
+ GnomeCalendar *calendar;
+
g_object_weak_unref ((GObject *) event->comp, comp_destroy_cb, &destroyed);
- if (day_view->calendar)
- gnome_calendar_edit_object (day_view->calendar, event->comp, FALSE);
+ calendar = e_cal_view_get_calendar (E_CAL_VIEW (day_view));
+ if (calendar)
+ gnome_calendar_edit_object (calendar, event->comp, FALSE);
else
g_warning ("Calendar not set");
}
@@ -3770,7 +3742,8 @@ free_view_popup (GtkWidget *widget, gpointer data)
if (day_view->view_menu == NULL)
return;
- gnome_calendar_discard_view_popup (day_view->calendar, day_view->view_menu);
+ gnome_calendar_discard_view_popup (e_cal_view_get_calendar (E_CAL_VIEW (day_view)),
+ day_view->view_menu);
day_view->view_menu = NULL;
}
@@ -3801,7 +3774,8 @@ e_day_view_show_popup_menu (EDayView *day_view,
&& day_view->selection_start_day != -1;
if (event_num == -1) {
- day_view->view_menu = gnome_calendar_setup_view_popup (day_view->calendar);
+ day_view->view_menu = gnome_calendar_setup_view_popup (
+ e_cal_view_get_calendar (E_CAL_VIEW (day_view)));
main_items[9].submenu = day_view->view_menu;
context_menu = main_items;
} else {
@@ -3891,7 +3865,7 @@ e_day_view_on_new_appointment (GtkWidget *widget, gpointer data)
}
gnome_calendar_new_appointment_for (
- day_view->calendar, dtstart, dtend, FALSE, FALSE);
+ e_cal_view_get_calendar (E_CAL_VIEW (day_view)), dtstart, dtend, FALSE, FALSE);
}
static void
@@ -3902,7 +3876,7 @@ e_day_view_on_new_event (GtkWidget *widget, gpointer data)
e_day_view_get_selected_time_range (day_view, &dtstart, &dtend);
gnome_calendar_new_appointment_for (
- day_view->calendar, dtstart, dtend, TRUE, FALSE);
+ e_cal_view_get_calendar (E_CAL_VIEW (day_view)), dtstart, dtend, TRUE, FALSE);
}
static void
@@ -3932,7 +3906,7 @@ e_day_view_on_new_meeting (GtkWidget *widget, gpointer data)
}
gnome_calendar_new_appointment_for (
- day_view->calendar, dtstart, dtend, FALSE, TRUE);
+ e_cal_view_get_calendar (E_CAL_VIEW (day_view)), dtstart, dtend, FALSE, TRUE);
}
static void
@@ -3940,7 +3914,7 @@ e_day_view_on_new_task (GtkWidget *widget, gpointer data)
{
EDayView *day_view = E_DAY_VIEW (data);
- gnome_calendar_new_task (day_view->calendar);
+ gnome_calendar_new_task (e_cal_view_get_calendar (E_CAL_VIEW (day_view)));
}
static void
@@ -3948,7 +3922,7 @@ e_day_view_on_goto_date (GtkWidget *widget, gpointer data)
{
EDayView *day_view = E_DAY_VIEW (data);
- goto_dialog (day_view->calendar);
+ goto_dialog (e_cal_view_get_calendar (E_CAL_VIEW (day_view)));
}
static void
@@ -3956,7 +3930,7 @@ e_day_view_on_goto_today (GtkWidget *widget, gpointer data)
{
EDayView *day_view = E_DAY_VIEW (data);
- calendar_goto_today (day_view->calendar);
+ calendar_goto_today (e_cal_view_get_calendar (E_CAL_VIEW (day_view)));
}
static void
@@ -3964,6 +3938,7 @@ e_day_view_on_edit_appointment (GtkWidget *widget, gpointer data)
{
EDayView *day_view;
EDayViewEvent *event;
+ GnomeCalendar *calendar;
day_view = E_DAY_VIEW (data);
@@ -3971,8 +3946,9 @@ e_day_view_on_edit_appointment (GtkWidget *widget, gpointer data)
if (event == NULL)
return;
- if (day_view->calendar)
- gnome_calendar_edit_object (day_view->calendar, event->comp, FALSE);
+ calendar = e_cal_view_get_calendar (E_CAL_VIEW (day_view));
+ if (calendar)
+ gnome_calendar_edit_object (calendar, event->comp, FALSE);
else
g_warning ("Calendar not set");
}
@@ -4023,8 +3999,8 @@ e_day_view_on_print (GtkWidget *widget, gpointer data)
day_view = E_DAY_VIEW (data);
- gnome_calendar_get_current_time_range (day_view->calendar, &start, NULL);
- view_type = gnome_calendar_get_view (day_view->calendar);
+ gnome_calendar_get_current_time_range (e_cal_view_get_calendar (E_CAL_VIEW (day_view)), &start, NULL);
+ view_type = gnome_calendar_get_view (e_cal_view_get_calendar (E_CAL_VIEW (day_view)));
switch (view_type) {
case GNOME_CAL_DAY_VIEW:
@@ -4040,7 +4016,7 @@ e_day_view_on_print (GtkWidget *widget, gpointer data)
return;
}
- print_calendar (day_view->calendar, FALSE, start, print_view);
+ print_calendar (e_cal_view_get_calendar (E_CAL_VIEW (day_view)), FALSE, start, print_view);
}
static void
@@ -4063,6 +4039,7 @@ e_day_view_on_meeting (GtkWidget *widget, gpointer data)
{
EDayView *day_view;
EDayViewEvent *event;
+ GnomeCalendar *calendar;
day_view = E_DAY_VIEW (data);
@@ -4070,8 +4047,9 @@ e_day_view_on_meeting (GtkWidget *widget, gpointer data)
if (event == NULL)
return;
- if (day_view->calendar)
- gnome_calendar_edit_object (day_view->calendar, event->comp, TRUE);
+ e_cal_view_get_calendar (E_CAL_VIEW (day_view));
+ if (calendar)
+ gnome_calendar_edit_object (calendar, event->comp, TRUE);
else
g_warning ("Calendar not set");
}
@@ -4129,7 +4107,7 @@ e_day_view_on_settings (GtkWidget *widget, gpointer data)
day_view = E_DAY_VIEW (data);
- control_util_show_settings (day_view->calendar);
+ control_util_show_settings (e_cal_view_get_calendar (E_CAL_VIEW (day_view)));
}
static void
@@ -4468,6 +4446,7 @@ static void
e_day_view_update_calendar_selection_time (EDayView *day_view)
{
time_t start, end;
+ GnomeCalendar *calendar;
e_day_view_get_selected_time_range (day_view, &start, &end);
@@ -4476,8 +4455,9 @@ e_day_view_update_calendar_selection_time (EDayView *day_view)
g_print ("End : %s", ctime (&end));
#endif
- if (day_view->calendar)
- gnome_calendar_set_selected_time_range (day_view->calendar,
+ calendar = e_cal_view_get_calendar (E_CAL_VIEW (day_view));
+ if (calendar)
+ gnome_calendar_set_selected_time_range (calendar,
start, end);
}
@@ -6241,8 +6221,7 @@ static void
e_day_view_cursor_key_left (EDayView *day_view, GdkEventKey *event)
{
if (day_view->selection_start_day == 0) {
- if (day_view->calendar)
- gnome_calendar_previous (day_view->calendar);
+ gnome_calendar_previous (e_cal_view_get_calendar (E_CAL_VIEW (day_view)));
} else {
day_view->selection_start_day--;
day_view->selection_end_day--;
@@ -6260,8 +6239,7 @@ static void
e_day_view_cursor_key_right (EDayView *day_view, GdkEventKey *event)
{
if (day_view->selection_end_day == day_view->days_shown - 1) {
- if (day_view->calendar)
- gnome_calendar_next (day_view->calendar);
+ gnome_calendar_next (e_cal_view_get_calendar (E_CAL_VIEW (day_view)));
} else {
day_view->selection_start_day++;
day_view->selection_end_day++;
@@ -6540,8 +6518,7 @@ e_day_view_on_editing_started (EDayView *day_view,
g_object_set (item, "handle_popup", TRUE, NULL);
- gtk_signal_emit (GTK_OBJECT (day_view),
- e_day_view_signals[SELECTION_CHANGED]);
+ g_signal_emit_by_name (day_view, "selection_changed");
}
static void
@@ -6650,8 +6627,7 @@ e_day_view_on_editing_stopped (EDayView *day_view,
g_free (text);
- gtk_signal_emit (GTK_OBJECT (day_view),
- e_day_view_signals[SELECTION_CHANGED]);
+ g_signal_emit_by_name (day_view, "selection_changed");
}
diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h
index f8889ac26b..07bbf672da 100644
--- a/calendar/gui/e-day-view.h
+++ b/calendar/gui/e-day-view.h
@@ -240,9 +240,6 @@ struct _EDayView
GtkWidget *vscrollbar;
- /* The calendar we are associated with. */
- GnomeCalendar *calendar;
-
/* Calendar client object we are monitoring */
CalClient *client;
@@ -508,9 +505,6 @@ struct _EDayView
struct _EDayViewClass
{
ECalViewClass parent_class;
-
- /* Notification signals */
- void (* selection_changed) (EDayView *day_view);
};
diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c
index 749bcbad65..741ec913f5 100644
--- a/calendar/gui/e-week-view-event-item.c
+++ b/calendar/gui/e-week-view-event-item.c
@@ -856,6 +856,7 @@ e_week_view_event_item_double_click (EWeekViewEventItem *wveitem,
EWeekView *week_view;
EWeekViewEvent *event;
GnomeCanvasItem *item;
+ GnomeCalendar *calendar;
item = GNOME_CANVAS_ITEM (wveitem);
@@ -867,8 +868,9 @@ e_week_view_event_item_double_click (EWeekViewEventItem *wveitem,
e_week_view_stop_editing_event (week_view);
- if (week_view->calendar)
- gnome_calendar_edit_object (week_view->calendar, event->comp, FALSE);
+ calendar = e_cal_view_get_calendar (E_CAL_VIEW (week_view));
+ if (calendar)
+ gnome_calendar_edit_object (calendar, event->comp, FALSE);
else
g_warning ("Calendar not set");
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 120c494583..9cdd928f28 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -90,13 +90,6 @@
#define EVOLUTION_CALENDAR_PROGRESS_IMAGE "evolution-calendar-mini.png"
static GdkPixbuf *progress_icon[2] = { NULL, NULL };
-/* Signal IDs */
-enum {
- SELECTION_CHANGED,
- LAST_SIGNAL
-};
-static guint e_week_view_signals[LAST_SIGNAL] = { 0 };
-
static void e_week_view_class_init (EWeekViewClass *class);
static void e_week_view_init (EWeekView *week_view);
@@ -266,14 +259,6 @@ e_week_view_class_init (EWeekViewClass *class)
object_class = (GtkObjectClass *) class;
widget_class = (GtkWidgetClass *) class;
- e_week_view_signals[SELECTION_CHANGED] =
- gtk_signal_new ("selection_changed",
- GTK_RUN_LAST,
- G_TYPE_FROM_CLASS (object_class),
- GTK_SIGNAL_OFFSET (EWeekViewClass, selection_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
/* Method override */
object_class->destroy = e_week_view_destroy;
@@ -288,8 +273,6 @@ e_week_view_class_init (EWeekViewClass *class)
widget_class->expose_event = e_week_view_expose_event;
widget_class->focus = e_week_view_focus;
- class->selection_changed = NULL;
-
/* clipboard atom */
if (!clipboard_atom)
clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
@@ -306,7 +289,6 @@ e_week_view_init (EWeekView *week_view)
GTK_WIDGET_SET_FLAGS (week_view, GTK_CAN_FOCUS);
- week_view->calendar = NULL;
week_view->client = NULL;
week_view->sexp = g_strdup ("#t"); /* match all by default */
week_view->query = NULL;
@@ -1136,19 +1118,10 @@ e_week_view_new_appointment (EWeekView *week_view, gboolean meeting)
all_day = TRUE;
}
- gnome_calendar_new_appointment_for (week_view->calendar, dtstart, dtend, all_day, meeting);
-}
-
-void
-e_week_view_set_calendar (EWeekView *week_view,
- GnomeCalendar *calendar)
-{
- g_return_if_fail (E_IS_WEEK_VIEW (week_view));
-
- week_view->calendar = calendar;
+ gnome_calendar_new_appointment_for (e_cal_view_get_calendar (E_CAL_VIEW (week_view)),
+ dtstart, dtend, all_day, meeting);
}
-
/* Callback used when a component is updated in the live query */
static void
query_obj_updated_cb (CalQuery *query, const char *uid,
@@ -2379,8 +2352,8 @@ e_week_view_on_button_release (GtkWidget *widget,
start = week_view->day_starts[week_view->selection_start_day];
end = week_view->day_starts[week_view->selection_end_day + 1];
- if (week_view->calendar)
- gnome_calendar_set_selected_time_range (week_view->calendar, start, end);
+ gnome_calendar_set_selected_time_range (e_cal_view_get_calendar (E_CAL_VIEW (week_view)),
+ start, end);
}
return FALSE;
@@ -3060,8 +3033,8 @@ e_week_view_on_adjustment_changed (GtkAdjustment *adjustment,
if (week_view->selection_start_day != -1) {
start = week_view->day_starts[week_view->selection_start_day];
end = week_view->day_starts[week_view->selection_end_day + 1];
- if (week_view->calendar)
- gnome_calendar_set_selected_time_range (week_view->calendar, start, end);
+ gnome_calendar_set_selected_time_range (e_cal_view_get_calendar (E_CAL_VIEW (week_view)),
+ start, end);
}
}
@@ -3177,11 +3150,14 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
{
EWeekViewEvent *event;
gint event_num, span_num;
+ GnomeCalendar *calendar;
#if 0
g_print ("In e_week_view_on_text_item_event\n");
#endif
+ calendar = e_cal_view_get_calendar (E_CAL_VIEW (week_view));
+
switch (gdkevent->type) {
case GDK_KEY_PRESS:
if (gdkevent && gdkevent->key.keyval == GDK_Return) {
@@ -3210,9 +3186,8 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
event = &g_array_index (week_view->events, EWeekViewEvent,
event_num);
- if (week_view->calendar)
- gnome_calendar_edit_object (week_view->calendar,
- event->comp, FALSE);
+ if (calendar)
+ gnome_calendar_edit_object (calendar, event->comp, FALSE);
else
g_warning ("Calendar not set");
@@ -3341,8 +3316,7 @@ e_week_view_on_editing_started (EWeekView *week_view,
g_object_set (item, "handle_popup", TRUE, NULL);
- gtk_signal_emit (GTK_OBJECT (week_view),
- e_week_view_signals[SELECTION_CHANGED]);
+ g_signal_emit_by_name (week_view, "selection_changed");
}
@@ -3435,8 +3409,7 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
g_free (text);
- gtk_signal_emit (GTK_OBJECT (week_view),
- e_week_view_signals[SELECTION_CHANGED]);
+ g_signal_emit_by_name (week_view, "selection_changed");
}
@@ -3738,7 +3711,8 @@ free_view_popup (GtkWidget *widget, gpointer data)
if (week_view->view_menu == NULL)
return;
- gnome_calendar_discard_view_popup (week_view->calendar, week_view->view_menu);
+ gnome_calendar_discard_view_popup (e_cal_view_get_calendar (E_CAL_VIEW (week_view)),
+ week_view->view_menu);
week_view->view_menu = NULL;
}
@@ -3765,7 +3739,7 @@ e_week_view_show_popup_menu (EWeekView *week_view,
being_edited = FALSE;
if (event_num == -1) {
- week_view->view_menu = gnome_calendar_setup_view_popup (week_view->calendar);
+ week_view->view_menu = gnome_calendar_setup_view_popup (e_cal_view_get_calendar (E_CAL_VIEW (week_view)));
main_items[9].submenu = week_view->view_menu;
context_menu = main_items;
} else {
@@ -3828,7 +3802,7 @@ e_week_view_on_new_event (GtkWidget *widget, gpointer data)
dtstart = week_view->day_starts[week_view->selection_start_day];
dtend = week_view->day_starts[week_view->selection_end_day + 1];
gnome_calendar_new_appointment_for (
- week_view->calendar, dtstart, dtend, TRUE, FALSE);
+ e_cal_view_get_calendar (E_CAL_VIEW (week_view)), dtstart, dtend, TRUE, FALSE);
}
static void
@@ -3844,7 +3818,7 @@ e_week_view_on_new_task (GtkWidget *widget, gpointer data)
{
EWeekView *week_view = E_WEEK_VIEW (data);
- gnome_calendar_new_task (week_view->calendar);
+ gnome_calendar_new_task (e_cal_view_get_calendar (E_CAL_VIEW (week_view)));
}
static void
@@ -3852,7 +3826,7 @@ e_week_view_on_goto_date (GtkWidget *widget, gpointer data)
{
EWeekView *week_view = E_WEEK_VIEW (data);
- goto_dialog (week_view->calendar);
+ goto_dialog (e_cal_view_get_calendar (E_CAL_VIEW (week_view)));
}
static void
@@ -3860,7 +3834,7 @@ e_week_view_on_goto_today (GtkWidget *widget, gpointer data)
{
EWeekView *week_view = E_WEEK_VIEW (data);
- calendar_goto_today (week_view->calendar);
+ calendar_goto_today (e_cal_view_get_calendar (E_CAL_VIEW (week_view)));
}
static void
@@ -3868,6 +3842,7 @@ e_week_view_on_edit_appointment (GtkWidget *widget, gpointer data)
{
EWeekView *week_view;
EWeekViewEvent *event;
+ GnomeCalendar *calendar;
week_view = E_WEEK_VIEW (data);
@@ -3877,9 +3852,9 @@ e_week_view_on_edit_appointment (GtkWidget *widget, gpointer data)
event = &g_array_index (week_view->events, EWeekViewEvent,
week_view->popup_event_num);
- if (week_view->calendar)
- gnome_calendar_edit_object (week_view->calendar, event->comp,
- FALSE);
+ calendar = e_cal_view_get_calendar (E_CAL_VIEW (week_view));
+ if (calendar)
+ gnome_calendar_edit_object (calendar, event->comp, FALSE);
else
g_warning ("Calendar not set");
}
@@ -3894,8 +3869,8 @@ e_week_view_on_print (GtkWidget *widget, gpointer data)
week_view = E_WEEK_VIEW (data);
- gnome_calendar_get_current_time_range (week_view->calendar, &start, NULL);
- view_type = gnome_calendar_get_view (week_view->calendar);
+ gnome_calendar_get_current_time_range (e_cal_view_get_calendar (E_CAL_VIEW (week_view)), &start, NULL);
+ view_type = gnome_calendar_get_view (e_cal_view_get_calendar (E_CAL_VIEW (week_view)));
switch (view_type) {
case GNOME_CAL_WEEK_VIEW:
@@ -3911,7 +3886,7 @@ e_week_view_on_print (GtkWidget *widget, gpointer data)
return;
}
- print_calendar (week_view->calendar, FALSE, start, print_view);
+ print_calendar (e_cal_view_get_calendar (E_CAL_VIEW (week_view)), FALSE, start, print_view);
}
static void
@@ -3974,6 +3949,7 @@ e_week_view_on_meeting (GtkWidget *widget, gpointer data)
{
EWeekView *week_view;
EWeekViewEvent *event;
+ GnomeCalendar *calendar;
week_view = E_WEEK_VIEW (data);
@@ -3983,8 +3959,9 @@ e_week_view_on_meeting (GtkWidget *widget, gpointer data)
event = &g_array_index (week_view->events, EWeekViewEvent,
week_view->popup_event_num);
- if (week_view->calendar)
- gnome_calendar_edit_object (week_view->calendar, event->comp, TRUE);
+ calendar = e_cal_view_get_calendar (E_CAL_VIEW (week_view));
+ if (calendar)
+ gnome_calendar_edit_object (calendar, event->comp, TRUE);
else
g_warning ("Calendar not set");
}
@@ -4044,7 +4021,7 @@ e_week_view_on_settings (GtkWidget *widget, gpointer data)
week_view = E_WEEK_VIEW (data);
- control_util_show_settings (week_view->calendar);
+ control_util_show_settings (e_cal_view_get_calendar (E_CAL_VIEW (week_view)));
}
static void
@@ -4295,9 +4272,12 @@ e_week_view_on_jump_button_event (GnomeCanvasItem *item,
if (event->type == GDK_BUTTON_PRESS) {
for (day = 0; day < E_WEEK_VIEW_MAX_WEEKS * 7; day++) {
if (item == week_view->jump_buttons[day]) {
- if (week_view->calendar)
+ GnomeCalendar *calendar;
+
+ calendar = e_cal_view_get_calendar (E_CAL_VIEW (week_view));
+ if (calendar)
gnome_calendar_dayjump
- (week_view->calendar,
+ (calendar,
week_view->day_starts[day]);
else
g_warning ("Calendar not set");
diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h
index c1379f6728..73e9c1697a 100644
--- a/calendar/gui/e-week-view.h
+++ b/calendar/gui/e-week-view.h
@@ -193,9 +193,6 @@ struct _EWeekView
GtkWidget *vscrollbar;
- /* The calendar we are associated with. */
- GnomeCalendar *calendar;
-
/* Calendar client object we are monitoring */
CalClient *client;
@@ -376,9 +373,6 @@ struct _EWeekView
struct _EWeekViewClass
{
ECalViewClass parent_class;
-
- /* Notification signals */
- void (* selection_changed) (EWeekView *week_view);
};
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index f9c612ccd9..75dbf8df59 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -907,7 +907,7 @@ setup_widgets (GnomeCalendar *gcal)
/* The Day View. */
priv->day_view = e_day_view_new ();
- e_day_view_set_calendar (E_DAY_VIEW (priv->day_view), gcal);
+ e_cal_view_set_calendar (E_CAL_VIEW (priv->day_view), gcal);
gtk_widget_show (priv->day_view);
gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
priv->day_view, gtk_label_new (""));
@@ -921,7 +921,7 @@ setup_widgets (GnomeCalendar *gcal)
e_day_view_set_work_week_view (E_DAY_VIEW (priv->work_week_view),
TRUE);
e_day_view_set_days_shown (E_DAY_VIEW (priv->work_week_view), 5);
- e_day_view_set_calendar (E_DAY_VIEW (priv->work_week_view), gcal);
+ e_cal_view_set_calendar (E_CAL_VIEW (priv->work_week_view), gcal);
gtk_widget_show (priv->work_week_view);
gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
priv->work_week_view, gtk_label_new (""));
@@ -932,7 +932,7 @@ setup_widgets (GnomeCalendar *gcal)
/* The Week View. */
priv->week_view = e_week_view_new ();
- e_week_view_set_calendar (E_WEEK_VIEW (priv->week_view), gcal);
+ e_cal_view_set_calendar (E_CAL_VIEW (priv->week_view), gcal);
gtk_widget_show (priv->week_view);
gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
priv->week_view, gtk_label_new (""));
@@ -943,7 +943,7 @@ setup_widgets (GnomeCalendar *gcal)
/* The Month View. */
priv->month_view = e_week_view_new ();
- e_week_view_set_calendar (E_WEEK_VIEW (priv->month_view), gcal);
+ e_cal_view_set_calendar (E_CAL_VIEW (priv->month_view), gcal);
e_week_view_set_multi_week_view (E_WEEK_VIEW (priv->month_view), TRUE);
gtk_widget_show (priv->month_view);
gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),