aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/gui/e-calendar-view.c30
-rw-r--r--calendar/gui/e-calendar-view.h60
-rw-r--r--calendar/gui/e-day-view.c5
-rw-r--r--calendar/gui/e-week-view-config.c2
-rw-r--r--calendar/gui/e-week-view.c7
-rw-r--r--calendar/gui/e-week-view.h43
-rw-r--r--calendar/gui/ea-calendar.c6
-rw-r--r--calendar/gui/gnome-cal.c48
-rw-r--r--calendar/gui/gnome-cal.h4
-rw-r--r--modules/calendar/e-cal-shell-view-private.c22
10 files changed, 113 insertions, 114 deletions
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 54b7bcb783..67607f8da4 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -92,7 +92,7 @@ enum {
LAST_SIGNAL
};
-static guint e_calendar_view_signals[LAST_SIGNAL] = { 0 };
+static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (ECalendarView, e_calendar_view, GTK_TYPE_TABLE)
@@ -173,7 +173,7 @@ e_calendar_view_class_init (ECalendarViewClass *klass)
G_PARAM_READABLE | G_PARAM_WRITABLE));
/* Create class' signals */
- e_calendar_view_signals[SELECTION_CHANGED] =
+ signals[SELECTION_CHANGED] =
g_signal_new ("selection_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
@@ -181,7 +181,7 @@ e_calendar_view_class_init (ECalendarViewClass *klass)
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- e_calendar_view_signals[SELECTED_TIME_CHANGED] =
+ signals[SELECTED_TIME_CHANGED] =
g_signal_new ("selected_time_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
@@ -189,7 +189,7 @@ e_calendar_view_class_init (ECalendarViewClass *klass)
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- e_calendar_view_signals[TIMEZONE_CHANGED] =
+ signals[TIMEZONE_CHANGED] =
g_signal_new ("timezone_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
@@ -198,7 +198,7 @@ e_calendar_view_class_init (ECalendarViewClass *klass)
e_marshal_VOID__POINTER_POINTER,
G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
- e_calendar_view_signals[EVENT_CHANGED] =
+ signals[EVENT_CHANGED] =
g_signal_new ("event_changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
@@ -208,7 +208,7 @@ e_calendar_view_class_init (ECalendarViewClass *klass)
G_TYPE_NONE, 1,
G_TYPE_POINTER);
- e_calendar_view_signals[EVENT_ADDED] =
+ signals[EVENT_ADDED] =
g_signal_new ("event_added",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
@@ -218,7 +218,7 @@ e_calendar_view_class_init (ECalendarViewClass *klass)
G_TYPE_NONE, 1,
G_TYPE_POINTER);
- e_calendar_view_signals[USER_CREATED] =
+ signals[USER_CREATED] =
g_signal_new ("user_created",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
@@ -227,7 +227,7 @@ e_calendar_view_class_init (ECalendarViewClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- e_calendar_view_signals[OPEN_EVENT] =
+ signals[OPEN_EVENT] =
g_signal_new ("open_event",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
@@ -470,7 +470,7 @@ e_calendar_view_set_timezone (ECalendarView *cal_view, icaltimezone *zone)
return;
e_cal_model_set_timezone (cal_view->priv->model, zone);
- g_signal_emit (G_OBJECT (cal_view), e_calendar_view_signals[TIMEZONE_CHANGED], 0,
+ g_signal_emit (G_OBJECT (cal_view), signals[TIMEZONE_CHANGED], 0,
old_zone, zone);
}
@@ -1992,9 +1992,7 @@ e_calendar_view_new_appointment (ECalendarView *cal_view)
static void
object_created_cb (CompEditor *ce, ECalendarView *cal_view)
{
-#if 0 /* KILL-BONOBO */
- gnome_calendar_emit_user_created_signal (cal_view, e_calendar_view_get_calendar (cal_view), comp_editor_get_client (ce));
-#endif
+ e_calendar_view_emit_user_created (cal_view);
}
CompEditor *
@@ -2505,6 +2503,14 @@ e_calendar_view_get_icalcomponent_summary (ECal *ecal, icalcomponent *icalcomp,
}
void
+e_calendar_view_emit_user_created (ECalendarView *cal_view)
+{
+ g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
+
+ g_signal_emit (cal_view, signals[USER_CREATED], 0);
+}
+
+void
draw_curved_rectangle (cairo_t *cr, double x0, double y0,
double rect_width, double rect_height,
double radius)
diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h
index 6dccf98cd1..5f554720f8 100644
--- a/calendar/gui/e-calendar-view.h
+++ b/calendar/gui/e-calendar-view.h
@@ -20,25 +20,35 @@
*
*/
-#ifndef _E_CALENDAR_VIEW_H_
-#define _E_CALENDAR_VIEW_H_
+#ifndef E_CALENDAR_VIEW_H
+#define E_CALENDAR_VIEW_H
-#include <libecal/e-cal.h>
#include <gtk/gtk.h>
+#include <libecal/e-cal.h>
#include "e-cal-model.h"
#include "gnome-cal.h"
#include "dialogs/comp-editor.h"
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define E_TYPE_CALENDAR_VIEW \
+ (e_calendar_view_get_type ())
+#define E_CALENDAR_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CALENDAR_VIEW, ECalendarView))
+#define E_CALENDAR_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_CALENDAR_VIEW, ECalendarViewClass))
+#define E_IS_CALENDAR_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CALENDAR_VIEW))
+#define E_IS_CALENDAR_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CALENDAR_VIEW))
+#define E_CALENDAR_VIEW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CALENDAR_VIEW, ECalendarViewClass))
-/*
- * EView - base widget class for the calendar views.
- */
-
-#define E_TYPE_CALENDAR_VIEW (e_calendar_view_get_type ())
-#define E_CALENDAR_VIEW(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, e_calendar_view_get_type (), ECalendarView)
-#define E_CALENDAR_VIEW_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, e_calendar_view_get_type (), ECalendarViewClass)
-#define E_IS_CALENDAR_VIEW(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, e_calendar_view_get_type ())
+G_BEGIN_DECLS
typedef enum {
E_CALENDAR_VIEW_POS_OUTSIDE,
@@ -60,13 +70,13 @@ typedef enum {
} ECalViewMoveDirection;
#define E_CALENDAR_VIEW_EVENT_FIELDS \
- GnomeCanvasItem *canvas_item; \
- ECalModelComponent *comp_data; \
- time_t start; \
- time_t end; \
- guint16 start_minute; \
- guint16 end_minute; \
- guint different_timezone : 1; \
+ GnomeCanvasItem *canvas_item; \
+ ECalModelComponent *comp_data; \
+ time_t start; \
+ time_t end; \
+ guint16 start_minute; \
+ guint16 end_minute; \
+ guint different_timezone : 1; \
gboolean is_editable; \
GtkWidget *tooltip; \
gint timeout; \
@@ -77,13 +87,12 @@ typedef struct {
E_CALENDAR_VIEW_EVENT_FIELDS
} ECalendarViewEvent;
-typedef struct _ECalendarView ECalendarView;
-typedef struct _ECalendarViewClass ECalendarViewClass;
+typedef struct _ECalendarView ECalendarView;
+typedef struct _ECalendarViewClass ECalendarViewClass;
typedef struct _ECalendarViewPrivate ECalendarViewPrivate;
struct _ECalendarView {
- GtkTable table;
-
+ GtkTable parent;
gboolean in_focus;
ECalendarViewPrivate *priv;
};
@@ -179,6 +188,9 @@ void e_calendar_view_move_tip (GtkWidget *widget, gint x, gint y);
const gchar *e_calendar_view_get_icalcomponent_summary (ECal *ecal, icalcomponent *icalcomp, gboolean *free_text);
gchar *e_calendar_view_get_attendees_status_info (ECalComponent *comp, ECal *client);
+void e_calendar_view_emit_user_created
+ (ECalendarView *cal_view);
+
void draw_curved_rectangle (cairo_t *cr,
double x0,
double y0,
@@ -190,4 +202,4 @@ GdkColor get_today_background (GdkColor event_background);
G_END_DECLS
-#endif
+#endif /* E_CALENDAR_VIEW_H */
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 871a6d81c7..c3533e629c 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -6304,10 +6304,9 @@ e_day_view_on_editing_stopped (EDayView *day_view,
if (!on_server) {
if (!e_cal_create_object (client, icalcomp, NULL, NULL))
g_message (G_STRLOC ": Could not create the object!");
-#if 0 /* KILL-BONOBO */
else
- gnome_calendar_emit_user_created_signal (day_view, e_calendar_view_get_calendar (E_CALENDAR_VIEW (day_view)), client);
-#endif
+ e_calendar_view_emit_user_created (
+ E_CALENDAR_VIEW (day_view));
/* we remove the object since we either got the update from the server or failed */
e_day_view_remove_event_cb (day_view, day, event_num, NULL);
diff --git a/calendar/gui/e-week-view-config.c b/calendar/gui/e-week-view-config.c
index 423a12a2d9..641857e133 100644
--- a/calendar/gui/e-week-view-config.c
+++ b/calendar/gui/e-week-view-config.c
@@ -108,7 +108,7 @@ e_week_view_config_class_init (EWeekViewConfigClass *klass)
gobject_class->dispose = e_week_view_config_dispose;
gobject_class->finalize = e_week_view_config_finalize;
- spec = g_param_spec_object ("view", NULL, NULL, e_week_view_get_type (),
+ spec = g_param_spec_object ("view", NULL, NULL, E_TYPE_WEEK_VIEW,
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
g_object_class_install_property (gobject_class, PROP_VIEW, spec);
}
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 749b3ed504..dbdb42c6a6 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -656,7 +656,7 @@ e_week_view_new (ECalModel *model)
{
GtkWidget *week_view;
- week_view = GTK_WIDGET (g_object_new (e_week_view_get_type (), NULL));
+ week_view = GTK_WIDGET (g_object_new (E_TYPE_WEEK_VIEW, NULL));
e_calendar_view_set_model ((ECalendarView *) week_view, model);
init_model ((EWeekView *) week_view, model);
@@ -3595,10 +3595,9 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
if (!on_server) {
if (!e_cal_create_object (client, icalcomp, NULL, NULL))
g_message (G_STRLOC ": Could not create the object!");
-#if 0 /* KILL-BONOBO */
else
- gnome_calendar_emit_user_created_signal (week_view, e_calendar_view_get_calendar (E_CALENDAR_VIEW (week_view)), client);
-#endif
+ e_calendar_view_emit_user_created (
+ E_CALENDAR_VIEW (week_view));
/* we remove the object since we either got the update from the server or failed */
e_week_view_remove_event_cb (week_view, event_num, NULL);
diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h
index b536e5d5a3..b3a9ca7be5 100644
--- a/calendar/gui/e-week-view.h
+++ b/calendar/gui/e-week-view.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef _E_WEEK_VIEW_H_
-#define _E_WEEK_VIEW_H_
+#ifndef E_WEEK_VIEW_H
+#define E_WEEK_VIEW_H
#include <gtk/gtk.h>
#include <libgnomecanvas/gnome-canvas.h>
@@ -29,12 +29,29 @@
#include "e-calendar-view.h"
#include "gnome-cal.h"
-G_BEGIN_DECLS
-
/*
* EWeekView - displays the Week & Month views of the calendar.
*/
+/* Standard GObject macros */
+#define E_TYPE_WEEK_VIEW \
+ (e_week_view_get_type ())
+#define E_WEEK_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_WEEK_VIEW, EWeekView))
+#define E_WEEK_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_WEEK_VIEW, EWeekViewClass))
+#define E_IS_WEEK_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_WEEK_VIEW))
+#define E_IS_WEEK_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_WEEK_VIEW))
+#define E_IS_WEEK_VIEW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_WEEK_VIEW, EWeekViewClass))
+
/* The maximum number of weeks we show. 5 is usually enough for 1 month,
but we allow 6 for longer selections. */
#define E_WEEK_VIEW_MAX_WEEKS 6
@@ -91,6 +108,8 @@ G_BEGIN_DECLS
reached anyway. */
#define E_WEEK_VIEW_MAX_ROWS_PER_CELL 127
+G_BEGIN_DECLS
+
/* These index our colors array. */
typedef enum
{
@@ -147,15 +166,10 @@ struct _EWeekViewEvent {
guint8 num_spans;
};
-#define E_WEEK_VIEW(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, e_week_view_get_type (), EWeekView)
-#define E_WEEK_VIEW_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, e_week_view_get_type (), EWeekViewClass)
-#define E_IS_WEEK_VIEW(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, e_week_view_get_type ())
-
-typedef struct _EWeekView EWeekView;
-typedef struct _EWeekViewClass EWeekViewClass;
+typedef struct _EWeekView EWeekView;
+typedef struct _EWeekViewClass EWeekViewClass;
-struct _EWeekView
-{
+struct _EWeekView {
ECalendarView cal_view;
/* The top canvas where the dates are shown. */
@@ -342,8 +356,7 @@ struct _EWeekView
time_t before_click_dtend;
};
-struct _EWeekViewClass
-{
+struct _EWeekViewClass {
ECalendarViewClass parent_class;
};
@@ -448,4 +461,4 @@ void e_week_view_jump_to_button_item (EWeekView *week_view, GnomeCanvasItem *ite
G_END_DECLS
-#endif /* _E_WEEK_VIEW_H_ */
+#endif /* E_WEEK_VIEW_H */
diff --git a/calendar/gui/ea-calendar.c b/calendar/gui/ea-calendar.c
index b5d4b75281..19e5a46cb2 100644
--- a/calendar/gui/ea-calendar.c
+++ b/calendar/gui/ea-calendar.c
@@ -61,7 +61,7 @@ gnome_calendar_a11y_init (void)
e_text_type = g_type_class_ref (E_TYPE_TEXT);
pixbuf_type = g_type_class_ref (GNOME_TYPE_CANVAS_PIXBUF);
e_day_view_type = g_type_class_ref (e_day_view_get_type ());
- e_week_view_type = g_type_class_ref (e_week_view_get_type ());
+ e_week_view_type = g_type_class_ref (E_TYPE_WEEK_VIEW);
e_day_view_main_item_type = g_type_class_ref (e_day_view_main_item_get_type ());
e_week_view_main_item_type = g_type_class_ref (e_week_view_main_item_get_type ());
@@ -80,7 +80,7 @@ gnome_calendar_a11y_init (void)
0, ea_calendar_focus_watcher,
NULL, (GDestroyNotify) NULL);
g_signal_add_emission_hook (g_signal_lookup ("event-after",
- e_week_view_get_type()),
+ E_TYPE_WEEK_VIEW),
0, ea_calendar_focus_watcher,
NULL, (GDestroyNotify) NULL);
g_signal_add_emission_hook (g_signal_lookup ("event",
@@ -112,7 +112,7 @@ e_day_view_main_item_a11y_init (void)
void
e_week_view_a11y_init (void)
{
- EA_SET_FACTORY (e_week_view_get_type(), ea_week_view);
+ EA_SET_FACTORY (E_TYPE_WEEK_VIEW, ea_week_view);
}
void
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index bb95c4d9aa..b245248f33 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -79,11 +79,6 @@
#include "e-cal-popup.h"
#include "e-cal-menu.h"
-/* FIXME glib 2.4 and above has this */
-#ifndef G_MAXINT32
-#define G_MAXINT32 ((gint32) 0x7fffffff)
-#endif
-
#define d(x)
/* hash table define for non intrusive error dialog */
@@ -935,46 +930,6 @@ view_selection_changed_cb (GtkWidget *view, GnomeCalendar *gcal)
g_signal_emit (gcal, gnome_calendar_signals[CALENDAR_SELECTION_CHANGED], 0);
}
-/**
- * gnome_calendar_emit_user_created_signal
- * Emits "user_created" signal on a gcal and use calendar as a store where was event created.
- *
- * @param instance Instance on which emit signal.
- * @param gcal GnomeCalendar, it will store info about used calendar here.
- * @param calendar Used calendar, where was event created.
- **/
-void
-gnome_calendar_emit_user_created_signal (gpointer instance, GnomeCalendar *gcal, ECal *calendar)
-{
- GnomeCalendarPrivate *priv;
-
- g_return_if_fail (gcal != NULL);
-
- priv = gcal->priv;
- priv->user_created_cal = calendar;
- g_signal_emit_by_name (instance, "user_created");
- priv->user_created_cal = NULL;
-}
-
-static void
-user_created_cb (GtkWidget *view, GnomeCalendar *gcal)
-{
- GnomeCalendarPrivate *priv;
- ECal *ecal;
-
- priv = gcal->priv;
- ecal = priv->user_created_cal;
-
- if (!ecal) {
- ECalModel *model;
-
- model = e_calendar_view_get_model (priv->views[priv->current_view_type]);
- ecal = e_cal_model_get_default_client (model);
- }
-
- gnome_calendar_add_source (gcal, E_CAL_SOURCE_TYPE_EVENT, e_cal_get_source (ecal));
-}
-
static void
set_week_start (GnomeCalendar *calendar)
{
@@ -1529,9 +1484,6 @@ setup_widgets (GnomeCalendar *gcal)
gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
GTK_WIDGET (priv->views[i]), gtk_label_new (""));
- g_signal_connect (priv->views[i], "user_created",
- G_CALLBACK (user_created_cb), gcal);
-
gtk_widget_show (GTK_WIDGET (priv->views[i]));
}
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index d904c10aa7..75ae9b1710 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -104,8 +104,6 @@ GtkWidget *gnome_calendar_construct (GnomeCalendar *gcal);
GtkWidget *gnome_calendar_new (void);
-ECalendarTable *gnome_calendar_get_task_pad (GnomeCalendar *gcal);
-
ECalModel *gnome_calendar_get_calendar_model (GnomeCalendar *gcal);
ECal *gnome_calendar_get_default_client (GnomeCalendar *gcal);
@@ -181,8 +179,6 @@ void gnome_calendar_edit_appointment (GnomeCalendar *gcal,
const gchar * comp_uid,
const gchar * comp_rid);
-void gnome_calendar_emit_user_created_signal (gpointer instance, GnomeCalendar *gcal, ECal *calendar);
-
G_END_DECLS
#endif
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index f681a2c2f3..9af8e98740 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -150,6 +150,25 @@ cal_shell_view_taskpad_popup_event_cb (EShellView *shell_view,
}
static void
+cal_shell_view_user_created_cb (ECalShellView *cal_shell_view,
+ ECalendarView *calendar_view)
+{
+ ECalShellSidebar *cal_shell_sidebar;
+ ECalModel *model;
+ ECal *client;
+ ESource *source;
+
+ model = e_calendar_view_get_model (calendar_view);
+ client = e_cal_model_get_default_client (model);
+ source = e_cal_get_source (client);
+
+ cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
+ e_cal_shell_sidebar_add_source (cal_shell_sidebar, source);
+
+ e_cal_model_add_client (model, client);
+}
+
+static void
cal_shell_view_load_view_collection (EShellViewClass *shell_view_class)
{
GalViewCollection *collection;
@@ -272,6 +291,9 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
mini_calendar->calitem, (ECalendarItemGetTimeCallback)
cal_shell_view_get_current_time, cal_shell_view, NULL);
+ /* KILL-BONOBO FIXME -- Need to connect to the "user-created"
+ * signal for each ECalendarView. */
+
#if 0 /* KILL-BONOBO */
g_signal_connect_swapped (
calendar, "dates-shown-changed",