aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/dialogs
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2008-07-19 00:23:26 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-07-19 00:23:26 +0800
commit0597b877c5bf4d21ac4048742ddf6b11e24877ba (patch)
tree74501a98fdec4d2c11d26a1f1d7d43a3058ad6f5 /calendar/gui/dialogs
parent68d73b10b22a2ba0e022b812321bc435e04c4867 (diff)
downloadgsoc2013-evolution-0597b877c5bf4d21ac4048742ddf6b11e24877ba.tar.gz
gsoc2013-evolution-0597b877c5bf4d21ac4048742ddf6b11e24877ba.tar.zst
gsoc2013-evolution-0597b877c5bf4d21ac4048742ddf6b11e24877ba.zip
** Fixes bug #542125
2008-07-18 Matthew Barnes <mbarnes@redhat.com> ** Fixes bug #542125 ** This set of changes migrates CompEditor, CompEditorPage and the various subclasses from using BonoboUI to GtkUIManager for menus and toolbars. It also substantially cleans up the code and streamlines the CompEditorPage API, making more effective use of GObject properties. Core changes: * gui/dialogs/comp-editor-page.c: * gui/dialogs/comp-editor-page.h: * gui/dialogs/comp-editor.c: * gui/dialogs/comp-editor.h: * gui/dialogs/event-editor.c: * gui/dialogs/event-editor.h: * gui/dialogs/event-page.c: * gui/dialogs/event-page.h: * gui/dialogs/memo-editor.c: * gui/dialogs/memo-editor.h: * gui/dialogs/memo-page.c: * gui/dialogs/memo-page.h: * gui/dialogs/recurrence-page.c: * gui/dialogs/recurrence-page.h: * gui/dialogs/schedule-page.c: * gui/dialogs/schedule-page.h: * gui/dialogs/task-details-page.c: * gui/dialogs/task-details-page.h: * gui/dialogs/task-editor.c: * gui/dialogs/task-editor.h: * gui/dialogs/task-page.c: * gui/dialogs/task-page.h: Supporting changes: * gui/calendar-component.c: * gui/comp-editor-factory.c: * gui/e-cal-popup.c: * gui/e-calendar-table.c: * gui/e-calendar-view.c: * gui/e-comp-editor-registry.c: * gui/e-memo-table.c: * gui/e-tasks.c: * gui/gnome-cal.c: * gui/memos-component.c: * gui/tasks-component.c: * gui/dialogs/alarm-dialog.c: * gui/dialogs/comp-editor-util.c: * art/Makefile.am: Move query-free-busy.png to data/icons. svn path=/trunk/; revision=35753
Diffstat (limited to 'calendar/gui/dialogs')
-rw-r--r--calendar/gui/dialogs/alarm-dialog.c3
-rw-r--r--calendar/gui/dialogs/comp-editor-page.c487
-rw-r--r--calendar/gui/dialogs/comp-editor-page.h123
-rw-r--r--calendar/gui/dialogs/comp-editor-util.c3
-rw-r--r--calendar/gui/dialogs/comp-editor.c2343
-rw-r--r--calendar/gui/dialogs/comp-editor.h174
-rw-r--r--calendar/gui/dialogs/event-editor.c945
-rw-r--r--calendar/gui/dialogs/event-editor.h38
-rw-r--r--calendar/gui/dialogs/event-page.c810
-rw-r--r--calendar/gui/dialogs/event-page.h106
-rw-r--r--calendar/gui/dialogs/memo-editor.c276
-rw-r--r--calendar/gui/dialogs/memo-editor.h36
-rw-r--r--calendar/gui/dialogs/memo-page.c733
-rw-r--r--calendar/gui/dialogs/memo-page.h58
-rw-r--r--calendar/gui/dialogs/recurrence-page.c613
-rw-r--r--calendar/gui/dialogs/recurrence-page.h51
-rw-r--r--calendar/gui/dialogs/schedule-page.c166
-rw-r--r--calendar/gui/dialogs/schedule-page.h60
-rw-r--r--calendar/gui/dialogs/task-details-page.c197
-rw-r--r--calendar/gui/dialogs/task-details-page.h51
-rw-r--r--calendar/gui/dialogs/task-editor.c686
-rw-r--r--calendar/gui/dialogs/task-editor.h40
-rw-r--r--calendar/gui/dialogs/task-page.c692
-rw-r--r--calendar/gui/dialogs/task-page.h92
24 files changed, 4024 insertions, 4759 deletions
diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c
index 8804518458..9a57a9c8e5 100644
--- a/calendar/gui/dialogs/alarm-dialog.c
+++ b/calendar/gui/dialogs/alarm-dialog.c
@@ -31,9 +31,6 @@
#include <string.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-widget.h>
#include <glade/glade.h>
#include <libedataserver/e-time-utils.h>
#include "e-util/e-dialog-widgets.h"
diff --git a/calendar/gui/dialogs/comp-editor-page.c b/calendar/gui/dialogs/comp-editor-page.c
index d05e0eed74..4a48611d01 100644
--- a/calendar/gui/dialogs/comp-editor-page.c
+++ b/calendar/gui/dialogs/comp-editor-page.c
@@ -23,84 +23,111 @@
#endif
#include <glib/gi18n.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
+#include "comp-editor.h"
#include "comp-editor-page.h"
-
+#define COMP_EDITOR_PAGE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), TYPE_COMP_EDITOR_PAGE, CompEditorPagePrivate))
-static void comp_editor_page_class_init (CompEditorPageClass *class);
-static void comp_editor_page_init (CompEditorPage *page);
-static void comp_editor_page_dispose (GObject *object);
-
-static gpointer parent_class;
+struct _CompEditorPagePrivate {
+ CompEditor *editor; /* not referenced */
+ gboolean updating;
+};
-/* Signal IDs */
+enum {
+ PROP_0,
+ PROP_EDITOR,
+ PROP_UPDATING
+};
enum {
- CHANGED,
- NEEDS_SEND,
- SUMMARY_CHANGED,
DATES_CHANGED,
- CLIENT_CHANGED,
- FOCUS_IN,
- FOCUS_OUT,
LAST_SIGNAL
};
+static gpointer parent_class;
static guint comp_editor_page_signals[LAST_SIGNAL];
-#define CLASS(page) (COMP_EDITOR_PAGE_CLASS (G_OBJECT_GET_CLASS (page)))
+static void
+comp_editor_page_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ CompEditorPagePrivate *priv;
+
+ priv = COMP_EDITOR_PAGE_GET_PRIVATE (object);
-
+ switch (property_id) {
+ case PROP_EDITOR:
+ priv->editor = g_value_get_object (value);
+ return;
-/**
- * comp_editor_page_get_type:
- *
- * Registers the #CompEditorPage class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the #CompEditorPage class.
- **/
-GType
-comp_editor_page_get_type (void)
+ case PROP_UPDATING:
+ comp_editor_page_set_updating (
+ COMP_EDITOR_PAGE (object),
+ g_value_get_boolean (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+comp_editor_page_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- static GType type = 0;
+ switch (property_id) {
+ case PROP_EDITOR:
+ g_value_set_object (
+ value, comp_editor_page_get_editor (
+ COMP_EDITOR_PAGE (object)));
+ return;
+
+ case PROP_UPDATING:
+ g_value_set_boolean (
+ value, comp_editor_page_get_updating (
+ COMP_EDITOR_PAGE (object)));
+ }
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (CompEditorPageClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) comp_editor_page_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (CompEditorPage),
- 0, /* n_preallocs */
- (GInstanceInitFunc) comp_editor_page_init,
- NULL /* value_table */
- };
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
- type = g_type_register_static (
- G_TYPE_OBJECT, "CompEditorPage", &type_info, 0);
+static void
+comp_editor_page_dispose (GObject *object)
+{
+ CompEditorPage *page;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (IS_COMP_EDITOR_PAGE (object));
+
+ page = COMP_EDITOR_PAGE (object);
+
+ if (page->accel_group) {
+ g_object_unref (page->accel_group);
+ page->accel_group = NULL;
}
- return type;
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
-/* Class initialization function for the abstract editor page */
static void
comp_editor_page_class_init (CompEditorPageClass *class)
{
GObjectClass *object_class;
parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (CompEditorPagePrivate));
object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = comp_editor_page_set_property;
+ object_class->get_property = comp_editor_page_get_property;
object_class->dispose = comp_editor_page_dispose;
- class->changed = NULL;
- class->summary_changed = NULL;
class->dates_changed = NULL;
class->get_widget = NULL;
@@ -108,35 +135,28 @@ comp_editor_page_class_init (CompEditorPageClass *class)
class->fill_widgets = NULL;
class->fill_component = NULL;
class->fill_timezones = NULL;
- class->set_summary = NULL;
class->set_dates = NULL;
- comp_editor_page_signals[CHANGED] =
- g_signal_new ("changed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CompEditorPageClass, changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- comp_editor_page_signals[NEEDS_SEND] =
- g_signal_new ("needs_send",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CompEditorPageClass, needs_send),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- comp_editor_page_signals[SUMMARY_CHANGED] =
- g_signal_new ("summary_changed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CompEditorPageClass, summary_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
+ g_object_class_install_property (
+ object_class,
+ PROP_EDITOR,
+ g_param_spec_object (
+ "editor",
+ NULL,
+ NULL,
+ TYPE_COMP_EDITOR,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_UPDATING,
+ g_param_spec_boolean (
+ "updating",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
comp_editor_page_signals[DATES_CHANGED] =
g_signal_new ("dates_changed",
@@ -146,66 +166,57 @@ comp_editor_page_class_init (CompEditorPageClass *class)
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
-
- comp_editor_page_signals[CLIENT_CHANGED] =
- g_signal_new ("client_changed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CompEditorPageClass, client_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1, G_TYPE_OBJECT);
- comp_editor_page_signals[FOCUS_IN] =
- g_signal_new ("focus_in",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CompEditorPageClass, focus_in),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
- comp_editor_page_signals[FOCUS_OUT] =
- g_signal_new ("focus_out",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CompEditorPageClass, focus_out),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
}
-
-
static void
comp_editor_page_init (CompEditorPage *page)
{
- page->client = NULL;
+ page->priv = COMP_EDITOR_PAGE_GET_PRIVATE (page);
+
page->accel_group = NULL;
}
-
-static void
-comp_editor_page_dispose (GObject *object)
+GType
+comp_editor_page_get_type (void)
{
- CompEditorPage *page;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_COMP_EDITOR_PAGE (object));
-
- page = COMP_EDITOR_PAGE (object);
+ static GType type = 0;
- if (page->client) {
- g_object_unref (page->client);
- page->client = NULL;
- }
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (CompEditorPageClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) comp_editor_page_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (CompEditorPage),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) comp_editor_page_init,
+ NULL /* value_table */
+ };
- if (page->accel_group) {
- g_object_unref (page->accel_group);
- page->accel_group = NULL;
+ type = g_type_register_static (
+ G_TYPE_OBJECT, "CompEditorPage", &type_info, 0);
}
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ return type;
}
+/**
+ * comp_editor_page_get_editor:
+ * @page: a #CompEditorPage
+ *
+ * Returns the #CompEditor to which @page belongs.
+ *
+ * Returns: the parent #CompEditor
+ **/
+CompEditor *
+comp_editor_page_get_editor (CompEditorPage *page)
+{
+ g_return_val_if_fail (IS_COMP_EDITOR_PAGE (page), NULL);
+
+ return page->priv->editor;
+}
/**
* comp_editor_page_get_widget:
@@ -219,11 +230,50 @@ comp_editor_page_dispose (GObject *object)
GtkWidget *
comp_editor_page_get_widget (CompEditorPage *page)
{
- g_return_val_if_fail (page != NULL, NULL);
+ CompEditorPageClass *class;
+
g_return_val_if_fail (IS_COMP_EDITOR_PAGE (page), NULL);
- g_return_val_if_fail (CLASS (page)->get_widget != NULL, NULL);
- return (* CLASS (page)->get_widget) (page);
+ class = COMP_EDITOR_PAGE_GET_CLASS (page);
+ g_return_val_if_fail (class->get_widget != NULL, NULL);
+
+ return class->get_widget (page);
+}
+
+gboolean
+comp_editor_page_get_updating (CompEditorPage *page)
+{
+ g_return_val_if_fail (IS_COMP_EDITOR_PAGE (page), FALSE);
+
+ return page->priv->updating;
+}
+
+void
+comp_editor_page_set_updating (CompEditorPage *page,
+ gboolean updating)
+{
+ g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
+
+ page->priv->updating = updating;
+
+ g_object_notify (G_OBJECT (page), "updating");
+}
+
+void
+comp_editor_page_changed (CompEditorPage *page)
+{
+ CompEditor *editor;
+
+ g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
+
+ /* Block change notifications if the page is updating. This right
+ * here is why we have an 'updating' flag. It's up to subclasses
+ * to set and clear it at appropriate times. */
+ if (page->priv->updating)
+ return;
+
+ editor = comp_editor_page_get_editor (page);
+ comp_editor_set_changed (editor, TRUE);
}
/**
@@ -237,11 +287,14 @@ comp_editor_page_get_widget (CompEditorPage *page)
void
comp_editor_page_focus_main_widget (CompEditorPage *page)
{
- g_return_if_fail (page != NULL);
+ CompEditorPageClass *class;
+
g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
- g_return_if_fail (CLASS (page)->focus_main_widget != NULL);
- (* CLASS (page)->focus_main_widget) (page);
+ class = COMP_EDITOR_PAGE_GET_CLASS (page);
+ g_return_if_fail (class->focus_main_widget != NULL);
+
+ class->focus_main_widget (page);
}
/**
@@ -252,13 +305,23 @@ comp_editor_page_focus_main_widget (CompEditorPage *page)
* Fills the widgets of an editor page with the data from a calendar component.
**/
gboolean
-comp_editor_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
+comp_editor_page_fill_widgets (CompEditorPage *page,
+ ECalComponent *comp)
{
+ CompEditorPageClass *class;
+ gboolean success;
+
g_return_val_if_fail (IS_COMP_EDITOR_PAGE (page), FALSE);
g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), FALSE);
- g_return_val_if_fail (CLASS (page)->fill_widgets != NULL, FALSE);
- return (* CLASS (page)->fill_widgets) (page, comp);
+ class = COMP_EDITOR_PAGE_GET_CLASS (page);
+ g_return_val_if_fail (class->fill_widgets != NULL, FALSE);
+
+ comp_editor_page_set_updating (page, TRUE);
+ success = class->fill_widgets (page, comp);
+ comp_editor_page_set_updating (page, FALSE);
+
+ return success;
}
/**
@@ -275,12 +338,15 @@ comp_editor_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
gboolean
comp_editor_page_fill_component (CompEditorPage *page, ECalComponent *comp)
{
- g_return_val_if_fail (page != NULL, FALSE);
+ CompEditorPageClass *class;
+
g_return_val_if_fail (IS_COMP_EDITOR_PAGE (page), FALSE);
g_return_val_if_fail (comp != NULL, FALSE);
- if (CLASS (page)->fill_component != NULL)
- return (* CLASS (page)->fill_component) (page, comp);
+ class = COMP_EDITOR_PAGE_GET_CLASS (page);
+
+ if (class->fill_component != NULL)
+ return class->fill_component (page, comp);
return TRUE;
}
@@ -298,90 +364,20 @@ comp_editor_page_fill_component (CompEditorPage *page, ECalComponent *comp)
gboolean
comp_editor_page_fill_timezones (CompEditorPage *page, GHashTable *timezones)
{
+ CompEditorPageClass *class;
+
g_return_val_if_fail (IS_COMP_EDITOR_PAGE (page), FALSE);
g_return_val_if_fail (timezones != NULL, FALSE);
- if (CLASS (page)->fill_timezones != NULL)
- return (* CLASS (page)->fill_timezones) (page, timezones);
-
- return TRUE;
-}
-
-/**
- * comp_editor_page_set_e_cal:
- * @page: An editor page
- * @client: A #ECal object
- *
- * Sets the #ECal for the dialog page to use.
- **/
-void
-comp_editor_page_set_e_cal (CompEditorPage *page, ECal *client)
-{
- g_return_if_fail (page != NULL);
- g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
-
- if (client == page->client)
- return;
-
- if (page->client)
- g_object_unref (page->client);
-
- page->client = client;
- if (page->client)
- g_object_ref (client);
-}
-
-/**
- * comp_editor_page_set_summary:
- * @page: An editor page
- * @summary: The text of the new summary value
- *
- * Sets the summary value for this group of widgets
- **/
-void
-comp_editor_page_set_summary (CompEditorPage *page, const char *summary)
-{
- g_return_if_fail (page != NULL);
- g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
-
- if (CLASS (page)->set_summary != NULL)
- (* CLASS (page)->set_summary) (page, summary);
-}
-
-/**
- * comp_editor_page_unset_focused_widget
- * @page: An editor page
- * @widget: The widget that has the current focus
-**/
-void
-comp_editor_page_unset_focused_widget (CompEditorPage *page, GtkWidget *widget)
-{
- g_return_if_fail (page!= NULL);
- g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
+ class = COMP_EDITOR_PAGE_GET_CLASS (page);
- g_signal_emit (page,
- comp_editor_page_signals[FOCUS_OUT], 0,
- widget);
+ if (class->fill_timezones != NULL)
+ return class->fill_timezones (page, timezones);
+ return TRUE;
}
/**
- * comp_editor_page_set_focussed_widget:
- * @page: An editor page
- * @widget: The widget that has the current focus
-**/
-void
-comp_editor_page_set_focused_widget (CompEditorPage *page, GtkWidget *widget)
-{
- g_return_if_fail (page!= NULL);
- g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
-
- g_signal_emit (page,
- comp_editor_page_signals[FOCUS_IN], 0,
- widget);
-
-}
-/**
* comp_editor_page_set_dates:
* @page: An editor page
* @dates: A collection of various dates in time_t format
@@ -391,62 +387,14 @@ comp_editor_page_set_focused_widget (CompEditorPage *page, GtkWidget *widget)
void
comp_editor_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates)
{
- g_return_if_fail (page != NULL);
- g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
-
- if (CLASS (page)->set_dates != NULL)
- (* CLASS (page)->set_dates) (page, dates);
-}
-
-/**
- * comp_editor_page_notify_changed:
- * @page: An editor page.
- *
- * Makes an editor page emit the "changed" signal. This is meant to be
- * used only by page implementations.
- **/
-void
-comp_editor_page_notify_changed (CompEditorPage *page)
-{
- g_return_if_fail (page != NULL);
- g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
-
- g_signal_emit (page, comp_editor_page_signals[CHANGED], 0);
-}
-
-/**
- * comp_editor_page_notify_needs_send:
- * @page:
- *
- *
- **/
-void
-comp_editor_page_notify_needs_send (CompEditorPage *page)
-{
- g_return_if_fail (page != NULL);
- g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
+ CompEditorPageClass *class;
- g_signal_emit (page, comp_editor_page_signals[NEEDS_SEND], 0);
-}
-
-/**
- * comp_editor_page_notify_summary_changed:
- * @page: An editor page.
- *
- * Makes an editor page emit the "summary_changed" signal. This is meant to be
- * used only by page implementations.
- **/
-void
-comp_editor_page_notify_summary_changed (CompEditorPage *page,
- const char *summary)
-{
- g_return_if_fail (page != NULL);
g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
+ class = COMP_EDITOR_PAGE_GET_CLASS (page);
- g_signal_emit (page,
- comp_editor_page_signals[SUMMARY_CHANGED], 0,
- summary);
+ if (class->set_dates != NULL)
+ class->set_dates (page, dates);
}
/**
@@ -460,7 +408,6 @@ void
comp_editor_page_notify_dates_changed (CompEditorPage *page,
CompEditorPageDates *dates)
{
- g_return_if_fail (page != NULL);
g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
g_signal_emit (page,
@@ -469,26 +416,6 @@ comp_editor_page_notify_dates_changed (CompEditorPage *page,
}
/**
- * comp_editor_page_notify_client_changed:
- * @page: An editor page.
- *
- * Makes an editor page emit the "client_changed" signal. This is meant to be
- * used only by page implementations.
- **/
-void
-comp_editor_page_notify_client_changed (CompEditorPage *page,
- ECal *client)
-{
- g_return_if_fail (page != NULL);
- g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
-
- comp_editor_page_set_e_cal (page, client);
- g_signal_emit (page,
- comp_editor_page_signals[CLIENT_CHANGED], 0,
- client);
-}
-
-/**
* comp_editor_page_display_validation_error:
* @page: An editor page.
* @msg: Error message to display.
diff --git a/calendar/gui/dialogs/comp-editor-page.h b/calendar/gui/dialogs/comp-editor-page.h
index 950b38fd6a..736ca1c8dc 100644
--- a/calendar/gui/dialogs/comp-editor-page.h
+++ b/calendar/gui/dialogs/comp-editor-page.h
@@ -26,15 +26,33 @@
#include <libecal/e-cal-component.h>
#include <libecal/e-cal.h>
+/* Standard GObject macros */
+#define TYPE_COMP_EDITOR_PAGE \
+ (comp_editor_page_get_type ())
+#define COMP_EDITOR_PAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), TYPE_COMP_EDITOR_PAGE, CompEditorPage))
+#define COMP_EDITOR_PAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), TYPE_COMP_EDITOR_PAGE, CompEditorPageClass))
+#define IS_COMP_EDITOR_PAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), TYPE_COMP_EDITOR_PAGE))
+#define IS_COMP_EDITOR_PAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((obj), TYPE_COMP_EDITOR_PAGE))
+#define COMP_EDITOR_PAGE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), TYPE_COMP_EDITOR_PAGE, CompEditorPageClass))
+
G_BEGIN_DECLS
-
+/* Use a forward declaration to avoid a circular reference. */
+struct _CompEditor;
-#define TYPE_COMP_EDITOR_PAGE (comp_editor_page_get_type ())
-#define COMP_EDITOR_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COMP_EDITOR_PAGE, CompEditorPage))
-#define COMP_EDITOR_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COMP_EDITOR_PAGE, CompEditorPageClass))
-#define IS_COMP_EDITOR_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COMP_EDITOR_PAGE))
-#define IS_COMP_EDITOR_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), TYPE_COMP_EDITOR_PAGE))
+typedef struct _CompEditorPage CompEditorPage;
+typedef struct _CompEditorPageClass CompEditorPageClass;
+typedef struct _CompEditorPagePrivate CompEditorPagePrivate;
typedef struct {
ECalComponentDateTime *start;
@@ -43,45 +61,25 @@ typedef struct {
struct icaltimetype *complete;
} CompEditorPageDates;
-typedef enum {
- COMP_EDITOR_PAGE_NEW_ITEM = 1<<0,
- COMP_EDITOR_PAGE_MEETING = 1<<1,
- COMP_EDITOR_PAGE_DELEGATE = 1<<2,
- COMP_EDITOR_PAGE_USER_ORG = 1<<3,
- COMP_EDITOR_PAGE_IS_ASSIGNED = 1<<4,
- COMP_EDITOR_PAGE_IS_SHARED = 1<<5
-} CompEditorPageFlags;
-
-typedef struct {
+struct _CompEditorPage {
GObject object;
- /* Some of the pages need the ECal to access timezone data. Also,
- * the event page needs to know it to fill the source option menu. */
- ECal *client;
-
/* The GtkAccelGroup for the page. We install this when the page is
mapped, and uninstall when it is unmapped. libglade would do this
normally, but we create our pages individually so have to do it
ourselves. */
GtkAccelGroup *accel_group;
- CompEditorPageFlags flags;
+ CompEditorPagePrivate *priv;
+};
-} CompEditorPage;
-
-typedef struct {
+struct _CompEditorPageClass {
GObjectClass parent_class;
/* Notification signals */
- void (* changed) (CompEditorPage *page);
- void (* needs_send) (CompEditorPage *page);
-
- void (* summary_changed) (CompEditorPage *page, const char *summary);
void (* dates_changed) (CompEditorPage *page, const char *dates);
- void (* client_changed) (CompEditorPage *page, ECal *client);
- void (* focus_in) (CompEditorPage *page, GtkWidget *widget);
- void (* focus_out) (CompEditorPage *page, GtkWidget *widget);
+
/* Virtual methods */
GtkWidget *(* get_widget) (CompEditorPage *page);
@@ -91,42 +89,35 @@ typedef struct {
gboolean (* fill_component) (CompEditorPage *page, ECalComponent *comp);
gboolean (* fill_timezones) (CompEditorPage *page, GHashTable *timezones);
- void (* set_summary) (CompEditorPage *page, const char *summary);
void (* set_dates) (CompEditorPage *page, CompEditorPageDates *dates);
-} CompEditorPageClass;
-
-GType comp_editor_page_get_type (void);
-GtkWidget *comp_editor_page_get_widget (CompEditorPage *page);
-void comp_editor_page_focus_main_widget (CompEditorPage *page);
-void comp_editor_page_unset_focused_widget (CompEditorPage *page, GtkWidget *widget);
-void comp_editor_page_set_focused_widget (CompEditorPage *page, GtkWidget *widget);
-gboolean comp_editor_page_fill_widgets (CompEditorPage *page,
- ECalComponent *comp);
-gboolean comp_editor_page_fill_component (CompEditorPage *page,
- ECalComponent *comp);
-gboolean comp_editor_page_fill_timezones (CompEditorPage *page,
- GHashTable *timezones);
-void comp_editor_page_set_e_cal (CompEditorPage *page,
- ECal *client);
-void comp_editor_page_set_summary (CompEditorPage *page,
- const char *summary);
-void comp_editor_page_set_dates (CompEditorPage *page,
- CompEditorPageDates *dates);
-void comp_editor_page_notify_changed (CompEditorPage *page);
-void comp_editor_page_notify_needs_send (CompEditorPage *page);
-void comp_editor_page_notify_summary_changed (CompEditorPage *page,
- const char *summary);
-void comp_editor_page_notify_dates_changed (CompEditorPage *page,
- CompEditorPageDates *dates);
-void comp_editor_page_notify_client_changed (CompEditorPage *page,
- ECal *client);
-void comp_editor_page_display_validation_error (CompEditorPage *page,
- const char *msg,
- GtkWidget *field);
-
-
-
+};
+
+GType comp_editor_page_get_type (void);
+struct _CompEditor *
+ comp_editor_page_get_editor (CompEditorPage *page);
+GtkWidget * comp_editor_page_get_widget (CompEditorPage *page);
+gboolean comp_editor_page_get_updating (CompEditorPage *page);
+void comp_editor_page_set_updating (CompEditorPage *page,
+ gboolean updating);
+void comp_editor_page_changed (CompEditorPage *page);
+void comp_editor_page_focus_main_widget
+ (CompEditorPage *page);
+gboolean comp_editor_page_fill_widgets (CompEditorPage *page,
+ ECalComponent *comp);
+gboolean comp_editor_page_fill_component (CompEditorPage *page,
+ ECalComponent *comp);
+gboolean comp_editor_page_fill_timezones (CompEditorPage *page,
+ GHashTable *timezones);
+void comp_editor_page_set_dates (CompEditorPage *page,
+ CompEditorPageDates *dates);
+void comp_editor_page_notify_dates_changed
+ (CompEditorPage *page,
+ CompEditorPageDates *dates);
+void comp_editor_page_display_validation_error
+ (CompEditorPage *page,
+ const char *msg,
+ GtkWidget *field);
G_END_DECLS
-#endif
+#endif /* COMP_EDITOR_PAGE_H */
diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c
index 215d3c6cde..ea0441709c 100644
--- a/calendar/gui/dialogs/comp-editor-util.c
+++ b/calendar/gui/dialogs/comp-editor-util.c
@@ -26,9 +26,6 @@
#include <string.h>
#include <libical/ical.h>
#include <glib/gi18n.h>
-#include <bonobo-activation/bonobo-activation.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-widget.h>
#include <libedataserver/e-time-utils.h>
#include <libecal/e-cal-time-util.h>
#include "../calendar-config.h"
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index d42aa9891c..840ffc9d9d 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -30,16 +30,10 @@
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <gdk/gdkkeysyms.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-widget.h>
#include <libgnome/libgnome.h>
-#include <libgnomeui/gnome-uidefs.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
-#include <libgnomeui/gnome-messagebox.h>
#include <e-util/e-dialog-utils.h>
-#include <e-util/e-icon-factory.h>
#include <e-util/e-util-private.h>
+#include <e-util/gconf-bridge.h>
#include <evolution-shell-component-utils.h>
#include <camel/camel-url.h>
@@ -62,16 +56,18 @@
#include "recur-comp.h"
#include "comp-editor.h"
#include "../e-cal-popup.h"
+#include "../calendar-config-keys.h"
#include "cal-attachment-select-file.h"
#include "e-attachment-bar.h"
#include "misc/e-expander.h"
#include "e-util/e-error.h"
+#define COMP_EDITOR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), TYPE_COMP_EDITOR, CompEditorPrivate))
-#define d(x) x
-
-
+#define d(x)
/* Private part of the CompEditor structure */
struct _CompEditorPrivate {
@@ -93,9 +89,6 @@ struct _CompEditorPrivate {
/* Notebook to hold the pages */
GtkNotebook *notebook;
- /* Focussed Widget*/
- GtkWidget *focused_entry;
-
/* Attachment handling */
GtkWidget *attachment_bar;
GtkWidget *attachment_scrolled_window;
@@ -104,6 +97,11 @@ struct _CompEditorPrivate {
GtkWidget *attachment_expander_icon;
GtkWidget *attachment_expander_num;
+ /* Manages menus and toolbars */
+ GtkUIManager *manager;
+
+ gchar *summary;
+
guint32 attachment_bar_visible : 1;
/* TODO use this flags for setting all the boolean variables
@@ -120,35 +118,63 @@ struct _CompEditorPrivate {
gboolean is_group_item;
gboolean warned;
+};
- char *help_section;
+enum {
+ PROP_0,
+ PROP_CHANGED,
+ PROP_CLIENT,
+ PROP_FLAGS,
+ PROP_SUMMARY
};
-
+static const gchar *ui =
+"<ui>"
+" <menubar action='main-menu'>"
+" <menu action='file-menu'>"
+" <menuitem action='save'/>"
+" <menuitem action='close'/>"
+" </menu>"
+" <menu action='edit-menu'>"
+" <menuitem action='cut'/>"
+" <menuitem action='copy'/>"
+" <menuitem action='paste'/>"
+" <separator/>"
+" <menuitem action='select-all'/>"
+" </menu>"
+" <menu action='view-menu'/>"
+" <menu action='insert-menu'>"
+" <menuitem action='attach'/>"
+" <menuitem action='attach-recent'/>"
+" </menu>"
+" <menu action='options-menu'/>"
+" <menu action='help-menu'>"
+" <menuitem action='help'/>"
+" </menu>"
+" </menubar>"
+" <toolbar name='main-toolbar'>"
+" <toolitem action='save'/>"
+" <toolitem action='close'/>"
+" <separator/>"
+" <toolitem action='attach'/>"
+" </toolbar>"
+"</ui>";
-static gint comp_editor_key_press_event (GtkWidget *d, GdkEventKey *e);
-static void comp_editor_finalize (GObject *object);
static void comp_editor_show_help (CompEditor *editor);
+static void setup_widgets (CompEditor *editor);
-static void real_set_e_cal (CompEditor *editor, ECal *client);
static void real_edit_comp (CompEditor *editor, ECalComponent *comp);
static gboolean real_send_comp (CompEditor *editor, ECalComponentItipMethod method);
static gboolean prompt_and_save_changes (CompEditor *editor, gboolean send);
-static void delete_comp (CompEditor *editor);
static void close_dialog (CompEditor *editor);
-static void page_changed_cb (GtkObject *obj, gpointer data);
-static void needs_send_cb (GtkObject *obj, gpointer data);
-static void page_summary_changed_cb (GtkObject *obj, const char *summary, gpointer data);
-static void page_dates_changed_cb (GtkObject *obj, CompEditorPageDates *dates, gpointer data);
-static void page_focus_in_widget_cb (GtkObject *obj, GtkWidget *widget, gpointer data);
-static void page_focus_out_widget_cb (GtkObject *obj, GtkWidget *widget, gpointer data);
+static void page_dates_changed_cb (CompEditor *editor, CompEditorPageDates *dates, CompEditorPage *page);
static void obj_modified_cb (ECal *client, GList *objs, gpointer data);
static void obj_removed_cb (ECal *client, GList *uids, gpointer data);
static gboolean open_attachment (EAttachmentBar *bar, CompEditor *editor);
-G_DEFINE_TYPE (CompEditor, comp_editor, BONOBO_TYPE_WINDOW)
+G_DEFINE_TYPE (CompEditor, comp_editor, GTK_TYPE_WINDOW)
enum {
DND_TYPE_MESSAGE_RFC822,
@@ -535,98 +561,28 @@ drag_motion(GObject *o, GdkDragContext *context, gint x, gint y, guint time, Com
return action != 0;
}
-/* Class initialization function for the calendar component editor */
static void
-comp_editor_class_init (CompEditorClass *klass)
+add_to_bar (CompEditor *editor, GPtrArray *file_list, int is_inline)
{
- GObjectClass *object_class;
- GtkWidgetClass *widget_class;
+ CompEditorPrivate *priv = editor->priv;
int i;
- for (i=0;i<sizeof(drag_info)/sizeof(drag_info[0]);i++)
- drag_info[i].atom = gdk_atom_intern(drag_info[i].target, FALSE);
-
- object_class = G_OBJECT_CLASS (klass);
- widget_class = GTK_WIDGET_CLASS (klass);
-
- klass->set_e_cal = real_set_e_cal;
- klass->edit_comp = real_edit_comp;
- klass->send_comp = real_send_comp;
- klass->object_created = NULL;
-
- comp_editor_signals[OBJECT_CREATED] =
- g_signal_new ("object_created",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CompEditorClass, object_created),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- widget_class->key_press_event = comp_editor_key_press_event;
- object_class->finalize = comp_editor_finalize;
-}
-
-static void
-listen_for_changes (CompEditor *editor)
-{
- CompEditorPrivate *priv;
- const char *uid = NULL;
-
- priv = editor->priv;
-
- /* Discard change listener */
- if (priv->view) {
- g_signal_handlers_disconnect_matched (G_OBJECT (priv->view),
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL,
- editor);
-
- g_object_unref (priv->view);
- priv->view = NULL;
- }
-
- /* Listen for changes */
- if (priv->comp)
- e_cal_component_get_uid (priv->comp, &uid);
-
- if (uid) {
- char *query;
-
- query = g_strdup_printf ("(uid? \"%s\")", uid);
- e_cal_get_query (priv->source_client, query, &priv->view, NULL);
- g_free (query);
- }
+ for (i = 0; i < file_list->len; i++) {
+ CamelURL *url;
- if (priv->view) {
- g_signal_connect (priv->view, "objects_modified",
- G_CALLBACK (obj_modified_cb), editor);
+ if (!(url = camel_url_new (file_list->pdata[i], NULL)))
+ continue;
- g_signal_connect((priv->view), "objects_removed",
- G_CALLBACK (obj_removed_cb), editor);
+ if (!g_ascii_strcasecmp (url->protocol, "file")) {
+ e_attachment_bar_attach((EAttachmentBar *)priv->attachment_bar, url->path, is_inline ? "inline" : "attachment");
+ } else {
+ e_attachment_bar_attach_remote_file ((EAttachmentBar *)priv->attachment_bar, file_list->pdata[i], is_inline ? "inline" : "attachment");
+ }
- e_cal_view_start (priv->view);
+ camel_url_free (url);
}
}
-/* This sets the focus to the toplevel, so any field being edited is committed.
- FIXME: In future we may also want to check some of the fields are valid,
- e.g. the EDateEdit fields. */
-static void
-commit_all_fields (CompEditor *editor)
-{
- gtk_window_set_focus (GTK_WINDOW (editor), NULL);
-}
-
-static void
-send_timezone (gpointer key, gpointer value, gpointer user_data)
-{
- icaltimezone *zone = value;
- CompEditor *editor = user_data;
-
- e_cal_add_timezone (editor->priv->client, zone, NULL);
-}
-
static GSList *
get_attachment_list (CompEditor *editor)
{
@@ -701,10 +657,72 @@ get_attachment_list (CompEditor *editor)
return list;
}
+/* This sets the focus to the toplevel, so any field being edited is committed.
+ FIXME: In future we may also want to check some of the fields are valid,
+ e.g. the EDateEdit fields. */
+static void
+commit_all_fields (CompEditor *editor)
+{
+ gtk_window_set_focus (GTK_WINDOW (editor), NULL);
+}
+
+static void
+listen_for_changes (CompEditor *editor)
+{
+ CompEditorPrivate *priv;
+ const char *uid = NULL;
+
+ priv = editor->priv;
+
+ /* Discard change listener */
+ if (priv->view) {
+ g_signal_handlers_disconnect_matched (G_OBJECT (priv->view),
+ G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL,
+ editor);
+
+ g_object_unref (priv->view);
+ priv->view = NULL;
+ }
+
+ /* Listen for changes */
+ if (priv->comp)
+ e_cal_component_get_uid (priv->comp, &uid);
+
+ if (uid) {
+ char *query;
+
+ query = g_strdup_printf ("(uid? \"%s\")", uid);
+ e_cal_get_query (priv->source_client, query, &priv->view, NULL);
+ g_free (query);
+ }
+
+ if (priv->view) {
+ g_signal_connect (
+ priv->view, "objects_modified",
+ G_CALLBACK (obj_modified_cb), editor);
+ g_signal_connect (
+ priv->view, "objects_removed",
+ G_CALLBACK (obj_removed_cb), editor);
+
+ e_cal_view_start (priv->view);
+ }
+}
+
+static void
+send_timezone (gpointer key, gpointer value, gpointer user_data)
+{
+ icaltimezone *zone = value;
+ CompEditor *editor = user_data;
+
+ e_cal_add_timezone (editor->priv->client, zone, NULL);
+}
+
static gboolean
save_comp (CompEditor *editor)
{
CompEditorPrivate *priv;
+ CompEditorFlags flags;
ECalComponent *clone;
GList *l;
gboolean result;
@@ -718,6 +736,8 @@ save_comp (CompEditor *editor)
if (!priv->changed)
return TRUE;
+ flags = comp_editor_get_flags (editor);
+
/* Stop listening because we are about to change things */
if (priv->view) {
g_signal_handlers_disconnect_matched (G_OBJECT (priv->view),
@@ -781,7 +801,7 @@ save_comp (CompEditor *editor)
if (result && priv->mod == CALOBJ_MOD_THIS) {
/* FIXME do we really need to do this ? */
- if ((priv->flags & COMP_EDITOR_DELEGATE) || !e_cal_component_has_organizer (clone) || itip_organizer_is_user (clone, priv->client) || itip_sentby_is_user (clone))
+ if ((flags & COMP_EDITOR_DELEGATE) || !e_cal_component_has_organizer (clone) || itip_organizer_is_user (clone, priv->client) || itip_sentby_is_user (clone))
e_cal_component_commit_sequence (clone);
else
e_cal_component_abort_sequence (clone);
@@ -857,13 +877,15 @@ static gboolean
save_comp_with_send (CompEditor *editor)
{
CompEditorPrivate *priv;
+ CompEditorFlags flags;
gboolean send;
gboolean delegate;
priv = editor->priv;
+ flags = comp_editor_get_flags (editor);
send = priv->changed && priv->needs_send;
- delegate = priv->flags & COMP_EDITOR_DELEGATE;
+ delegate = flags & COMP_EDITOR_DELEGATE;
if (delegate) {
icalcomponent *icalcomp = e_cal_component_get_icalcomponent (priv->comp);
@@ -895,6 +917,892 @@ save_comp_with_send (CompEditor *editor)
return TRUE;
}
+static void
+update_window_border (CompEditor *editor,
+ const gchar *description)
+{
+ const gchar *icon_name;
+ const gchar *format;
+ gchar *title;
+
+ if (editor->priv->comp == NULL) {
+ title = g_strdup (_("Edit Appointment"));
+ icon_name = "stock_calendar";
+ goto exit;
+
+ } else switch (e_cal_component_get_vtype (editor->priv->comp)) {
+ case E_CAL_COMPONENT_EVENT:
+ if (editor->priv->is_group_item)
+ format = _("Meeting - %s");
+ else
+ format = _("Appointment - %s");
+ icon_name = "appointment-new";
+ break;
+
+ case E_CAL_COMPONENT_TODO:
+ if (editor->priv->is_group_item)
+ format = _("Assigned Task - %s");
+ else
+ format = _("Task - %s");
+ icon_name = "stock_task";
+ break;
+
+ case E_CAL_COMPONENT_JOURNAL:
+ format = _("Memo - %s");
+ icon_name = "stock_insert-note";
+ break;
+
+ default:
+ g_return_if_reached ();
+ }
+
+ if (description == NULL || *description == '\0') {
+ ECalComponentText text;
+
+ e_cal_component_get_summary (editor->priv->comp, &text);
+ description = text.value;
+ }
+
+ if (description == NULL || *description == '\0')
+ description = _("No Summary");
+
+ title = g_strdup_printf (format, description);
+
+exit:
+ gtk_window_set_icon_name (GTK_WINDOW (editor), icon_name);
+ gtk_window_set_title (GTK_WINDOW (editor), title);
+
+ g_free (title);
+}
+
+static void
+action_attach_cb (GtkAction *action,
+ CompEditor *editor)
+{
+ GPtrArray *file_list;
+ gboolean is_inline = FALSE;
+ int i;
+
+ file_list = comp_editor_select_file_attachments (editor, &is_inline);
+
+ if (file_list) {
+ add_to_bar (editor, file_list, is_inline);
+
+ for (i = 0; i < file_list->len; i++)
+ g_free (file_list->pdata[i]);
+
+ g_ptr_array_free (file_list, TRUE);
+ }
+}
+
+static void
+action_close_cb (GtkAction *action,
+ CompEditor *editor)
+{
+ commit_all_fields (editor);
+
+ if (prompt_and_save_changes (editor, TRUE))
+ close_dialog (editor);
+}
+
+static void
+action_copy_cb (GtkAction *action,
+ CompEditor *editor)
+{
+ GtkWidget *focus;
+
+ focus = gtk_window_get_focus (GTK_WINDOW (editor));
+
+ if (GTK_IS_ENTRY (focus))
+ gtk_editable_copy_clipboard (GTK_EDITABLE (focus));
+
+ if (GTK_IS_TEXT_VIEW (focus))
+ g_signal_emit_by_name (focus, "copy-clipboard");
+}
+
+static void
+action_cut_cb (GtkAction *action,
+ CompEditor *editor)
+{
+ GtkWidget *focus;
+
+ focus = gtk_window_get_focus (GTK_WINDOW (editor));
+
+ if (GTK_IS_ENTRY (focus))
+ gtk_editable_cut_clipboard (GTK_EDITABLE (focus));
+
+ if (GTK_IS_TEXT_VIEW (focus))
+ g_signal_emit_by_name (focus, "cut-clipboard");
+}
+
+static void
+action_help_cb (GtkAction *action,
+ CompEditor *editor)
+{
+ comp_editor_show_help (editor);
+}
+
+static void
+action_paste_cb (GtkAction *action,
+ CompEditor *editor)
+{
+ GtkWidget *focus;
+
+ focus = gtk_window_get_focus (GTK_WINDOW (editor));
+
+ if (GTK_IS_ENTRY (focus))
+ gtk_editable_paste_clipboard (GTK_EDITABLE (focus));
+
+ if (GTK_IS_TEXT_VIEW (focus))
+ g_signal_emit_by_name (focus, "paste-clipboard");
+}
+
+static void
+action_print_cb (GtkAction *action,
+ CompEditor *editor)
+{
+ CompEditorPrivate *priv = editor->priv;
+ ECalComponent *comp;
+ GList *l;
+ icalcomponent *icalcomp = e_cal_component_get_icalcomponent (priv->comp);
+
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
+
+ for (l = priv->pages; l != NULL; l = l->next)
+ comp_editor_page_fill_component (l->data, comp);
+
+ print_comp (comp, priv->client, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
+
+ g_object_unref (comp);
+}
+
+static void
+action_print_preview_cb (GtkAction *action,
+ CompEditor *editor)
+{
+ CompEditorPrivate *priv = editor->priv;
+ ECalComponent *comp;
+ GList *l;
+ icalcomponent *icalcomp = e_cal_component_get_icalcomponent (priv->comp);
+
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
+ for (l = priv->pages; l != NULL; l = l->next)
+ comp_editor_page_fill_component (l->data, comp);
+ print_comp (comp, priv->client, TRUE);
+
+ g_object_unref (comp);
+}
+
+static void
+action_save_cb (GtkAction *action,
+ CompEditor *editor)
+{
+ CompEditorPrivate *priv = editor->priv;
+ ECalComponentText text;
+ gboolean delegated = FALSE;
+ gboolean read_only, correct = FALSE;
+ ECalComponent *comp;
+
+ if (e_attachment_bar_get_download_count (E_ATTACHMENT_BAR (editor->priv->attachment_bar)) ){
+ gboolean response = 1;
+ /*FIXME: Cannot use mail functions from calendar!!!! */
+#if 0
+ ECalComponentVType vtype = e_cal_component_get_vtype(editor->priv->comp);
+
+ if (vtype == E_CAL_COMPONENT_EVENT)
+ response = em_utils_prompt_user((GtkWindow *)widget,
+ NULL,
+ "calendar:ask-send-event-pending-download",
+ NULL);
+ else
+ response = em_utils_prompt_user((GtkWindow *)widget,
+ NULL,
+ "calendar:ask-send-task-pending-download",
+ NULL);
+#endif
+ if (!response)
+ return;
+ }
+
+ if (!e_cal_is_read_only (priv->client, &read_only, NULL) || read_only) {
+ e_error_run ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (editor)), "calendar:prompt-read-only-cal-editor", e_source_peek_name (e_cal_get_source (priv->client)), NULL);
+ return;
+ }
+
+ commit_all_fields (editor);
+ if (e_cal_component_is_instance (priv->comp))
+ if (!recur_component_dialog (priv->client, priv->comp, &priv->mod, GTK_WINDOW (editor), delegated))
+ return;
+
+ comp = comp_editor_get_current_comp (editor, &correct);
+ e_cal_component_get_summary (comp, &text);
+ g_object_unref (comp);
+
+ if (!correct)
+ return;
+
+ if (!text.value)
+ if (!send_component_prompt_subject ((GtkWindow *) editor, priv->client, priv->comp))
+ return;
+ if (save_comp_with_send (editor))
+ close_dialog (editor);
+
+}
+
+static void
+action_select_all_cb (GtkAction *action,
+ CompEditor *editor)
+{
+ GtkWidget *focus;
+
+ focus = gtk_window_get_focus (GTK_WINDOW (editor));
+
+ if (GTK_IS_ENTRY (focus)) {
+ gtk_editable_set_position (GTK_EDITABLE (focus), -1);
+ gtk_editable_select_region (GTK_EDITABLE (focus), 0, -1);
+ }
+
+ if (GTK_IS_TEXT_VIEW (focus))
+ g_signal_emit_by_name (focus, "select-all", TRUE);
+}
+
+static void
+action_view_categories_cb (GtkToggleAction *action,
+ CompEditor *editor)
+{
+ CompEditorClass *class;
+ gboolean active;
+
+ class = COMP_EDITOR_GET_CLASS (editor);
+ active = gtk_toggle_action_get_active (action);
+
+ if (class->show_categories != NULL)
+ class->show_categories (editor, active);
+}
+
+static void
+action_view_role_cb (GtkToggleAction *action,
+ CompEditor *editor)
+{
+ CompEditorClass *class;
+ gboolean active;
+
+ class = COMP_EDITOR_GET_CLASS (editor);
+ active = gtk_toggle_action_get_active (action);
+
+ if (class->show_role != NULL)
+ class->show_role (editor, active);
+}
+
+static void
+action_view_rsvp_cb (GtkToggleAction *action,
+ CompEditor *editor)
+{
+ CompEditorClass *class;
+ gboolean active;
+
+ class = COMP_EDITOR_GET_CLASS (editor);
+ active = gtk_toggle_action_get_active (action);
+
+ if (class->show_rsvp != NULL)
+ class->show_rsvp (editor, active);
+}
+
+static void
+action_view_status_cb (GtkToggleAction *action,
+ CompEditor *editor)
+{
+ CompEditorClass *class;
+ gboolean active;
+
+ class = COMP_EDITOR_GET_CLASS (editor);
+ active = gtk_toggle_action_get_active (action);
+
+ if (class->show_status != NULL)
+ class->show_status (editor, active);
+}
+
+static void
+action_view_time_zone_cb (GtkToggleAction *action,
+ CompEditor *editor)
+{
+ CompEditorClass *class;
+ gboolean active;
+
+ class = COMP_EDITOR_GET_CLASS (editor);
+ active = gtk_toggle_action_get_active (action);
+
+ if (class->show_time_zone != NULL)
+ class->show_time_zone (editor, active);
+}
+
+static void
+action_view_type_cb (GtkToggleAction *action,
+ CompEditor *editor)
+{
+ CompEditorClass *class;
+ gboolean active;
+
+ class = COMP_EDITOR_GET_CLASS (editor);
+ active = gtk_toggle_action_get_active (action);
+
+ if (class->show_type != NULL)
+ class->show_type (editor, active);
+}
+
+static GtkActionEntry core_entries[] = {
+
+ { "close",
+ GTK_STOCK_CLOSE,
+ NULL,
+ NULL,
+ N_("Click here to close the current window"),
+ G_CALLBACK (action_close_cb) },
+
+ { "copy",
+ GTK_STOCK_COPY,
+ NULL,
+ NULL,
+ N_("Copy selected text to the clipboard"),
+ G_CALLBACK (action_copy_cb) },
+
+ { "cut",
+ GTK_STOCK_CUT,
+ NULL,
+ NULL,
+ N_("Cut selected text to the clipboard"),
+ G_CALLBACK (action_cut_cb) },
+
+ { "help",
+ GTK_STOCK_HELP,
+ NULL,
+ NULL,
+ N_("Click here to view help available"),
+ G_CALLBACK (action_help_cb) },
+
+ { "paste",
+ GTK_STOCK_PASTE,
+ NULL,
+ NULL,
+ N_("Paste text from the clipboard"),
+ G_CALLBACK (action_paste_cb) },
+
+ { "print",
+ GTK_STOCK_PRINT,
+ NULL,
+ NULL,
+ NULL,
+ G_CALLBACK (action_print_cb) },
+
+ { "print-preview",
+ GTK_STOCK_PRINT_PREVIEW,
+ NULL,
+ NULL,
+ NULL,
+ G_CALLBACK (action_print_preview_cb) },
+
+ { "save",
+ GTK_STOCK_SAVE,
+ NULL,
+ NULL,
+ N_("Click here to save the current window"),
+ G_CALLBACK (action_save_cb) },
+
+ { "select-all",
+ GTK_STOCK_SELECT_ALL,
+ NULL,
+ NULL,
+ N_("Select all text"),
+ G_CALLBACK (action_select_all_cb) },
+
+ /* Menus */
+
+ { "classification-menu",
+ NULL,
+ N_("_Classification"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "edit-menu",
+ NULL,
+ N_("_Edit"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "file-menu",
+ NULL,
+ N_("_File"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "help-menu",
+ NULL,
+ N_("_Help"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "insert-menu",
+ NULL,
+ N_("_Insert"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "options-menu",
+ NULL,
+ N_("_Options"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "view-menu",
+ NULL,
+ N_("_View"),
+ NULL,
+ NULL,
+ NULL }
+};
+
+static GtkActionEntry individual_entries[] = {
+
+ { "attach",
+ "mail-attachment",
+ N_("_Attachment..."),
+ "<Control>m",
+ N_("Click here to attach a file"),
+ G_CALLBACK (action_attach_cb) }
+};
+
+static GtkToggleActionEntry individual_toggle_entries[] = {
+
+ { "view-categories",
+ NULL,
+ N_("_Categories"),
+ NULL,
+ N_("Toggles whether to display categories"),
+ G_CALLBACK (action_view_categories_cb),
+ FALSE },
+
+ { "view-time-zone",
+ "stock_timezone",
+ N_("Time _Zone"),
+ NULL,
+ N_("Toggles whether the time zone is displayed"),
+ G_CALLBACK (action_view_time_zone_cb),
+ FALSE }
+};
+
+static GtkRadioActionEntry classification_radio_entries[] = {
+
+ { "classify-public",
+ NULL,
+ N_("Pu_blic"),
+ NULL,
+ N_("Classify as public"),
+ E_CAL_COMPONENT_CLASS_PUBLIC },
+
+ { "classify-private",
+ NULL,
+ N_("_Private"),
+ NULL,
+ N_("Classify as private"),
+ E_CAL_COMPONENT_CLASS_PRIVATE },
+
+ { "classify-confidential",
+ NULL,
+ N_("_Confidential"),
+ NULL,
+ N_("Classify as confidential"),
+ E_CAL_COMPONENT_CLASS_CONFIDENTIAL }
+};
+
+static GtkToggleActionEntry coordinated_toggle_entries[] = {
+
+ { "view-role",
+ NULL,
+ N_("R_ole Field"),
+ NULL,
+ N_("Toggles whether the Role field is displayed"),
+ G_CALLBACK (action_view_role_cb),
+ FALSE },
+
+ { "view-rsvp",
+ NULL,
+ N_("_RSVP"),
+ NULL,
+ N_("Toggles whether the RSVP field is displayed"),
+ G_CALLBACK (action_view_rsvp_cb),
+ FALSE },
+
+ { "view-status",
+ NULL,
+ N_("_Status Field"),
+ NULL,
+ N_("Toggles whether the Status field is displayed"),
+ G_CALLBACK (action_view_status_cb),
+ FALSE },
+
+ { "view-type",
+ NULL,
+ N_("_Type Field"),
+ NULL,
+ N_("Toggles whether the Attendee Type is displayed"),
+ G_CALLBACK (action_view_type_cb),
+ FALSE }
+};
+
+static void
+comp_editor_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CHANGED:
+ comp_editor_set_changed (
+ COMP_EDITOR (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_CLIENT:
+ comp_editor_set_client (
+ COMP_EDITOR (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_FLAGS:
+ comp_editor_set_flags (
+ COMP_EDITOR (object),
+ g_value_get_int (value));
+ return;
+
+ case PROP_SUMMARY:
+ comp_editor_set_summary (
+ COMP_EDITOR (object),
+ g_value_get_string (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+comp_editor_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CHANGED:
+ g_value_set_boolean (
+ value, comp_editor_get_changed (
+ COMP_EDITOR (object)));
+ return;
+
+ case PROP_CLIENT:
+ g_value_set_object (
+ value, comp_editor_get_client (
+ COMP_EDITOR (object)));
+ return;
+
+ case PROP_FLAGS:
+ g_value_set_int (
+ value, comp_editor_get_flags (
+ COMP_EDITOR (object)));
+ return;
+
+ case PROP_SUMMARY:
+ g_value_set_string (
+ value, comp_editor_get_summary (
+ COMP_EDITOR (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+comp_editor_dispose (GObject *object)
+{
+ CompEditorPrivate *priv;
+
+ priv = COMP_EDITOR_GET_PRIVATE (object);
+
+ if (priv->client) {
+ g_object_unref (priv->client);
+ priv->client = NULL;
+ }
+
+ if (priv->source_client) {
+ g_object_unref (priv->source_client);
+ priv->source_client = NULL;
+ }
+
+ if (priv->view) {
+ g_signal_handlers_disconnect_matched (G_OBJECT (priv->view),
+ G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL,
+ object);
+
+ g_object_unref (priv->view);
+ priv->view = NULL;
+ }
+
+ /* We want to destroy the pages after the widgets get destroyed,
+ since they have lots of signal handlers connected to the widgets
+ with the pages as the data. */
+ g_list_foreach (priv->pages, (GFunc) g_object_unref, NULL);
+ g_list_free (priv->pages);
+ priv->pages = NULL;
+
+ if (priv->comp) {
+ g_object_unref (priv->comp);
+ priv->comp = NULL;
+ }
+
+ if (priv->manager != NULL) {
+ g_object_unref (priv->manager);
+ priv->manager = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (comp_editor_parent_class)->dispose (object);
+}
+
+static void
+comp_editor_finalize (GObject *object)
+{
+ CompEditorPrivate *priv;
+
+ priv = COMP_EDITOR_GET_PRIVATE (object);
+
+ g_free (priv->summary);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (comp_editor_parent_class)->finalize (object);
+}
+
+static void
+comp_editor_map (GtkWidget *widget)
+{
+ CompEditor *editor = COMP_EDITOR (widget);
+ GConfBridge *bridge = gconf_bridge_get ();
+ GtkAction *action;
+
+ /* Give subclasses a chance to construct their pages before
+ * we fiddle with their widgets. That's why we don't do this
+ * until after object construction. */
+
+ action = comp_editor_get_action (editor, "view-categories");
+ gconf_bridge_bind_property (
+ bridge, CALENDAR_CONFIG_SHOW_CATEGORIES,
+ G_OBJECT (action), "active");
+
+ action = comp_editor_get_action (editor, "view-role");
+ gconf_bridge_bind_property (
+ bridge, CALENDAR_CONFIG_SHOW_ROLE,
+ G_OBJECT (action), "active");
+
+ action = comp_editor_get_action (editor, "view-rsvp");
+ gconf_bridge_bind_property (
+ bridge, CALENDAR_CONFIG_SHOW_RSVP,
+ G_OBJECT (action), "active");
+
+ action = comp_editor_get_action (editor, "view-status");
+ gconf_bridge_bind_property (
+ bridge, CALENDAR_CONFIG_SHOW_STATUS,
+ G_OBJECT (action), "active");
+
+ action = comp_editor_get_action (editor, "view-time-zone");
+ gconf_bridge_bind_property (
+ bridge, CALENDAR_CONFIG_SHOW_TIMEZONE,
+ G_OBJECT (action), "active");
+
+ action = comp_editor_get_action (editor, "view-type");
+ gconf_bridge_bind_property (
+ bridge, CALENDAR_CONFIG_SHOW_TYPE,
+ G_OBJECT (action), "active");
+
+ /* Chain up to parent's map() method. */
+ GTK_WIDGET_CLASS (comp_editor_parent_class)->map (widget);
+}
+
+static void
+comp_editor_class_init (CompEditorClass *class)
+{
+ GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+ int i;
+
+ for (i = 0; i < G_N_ELEMENTS (drag_info); i++)
+ drag_info[i].atom = gdk_atom_intern(drag_info[i].target, FALSE);
+
+ g_type_class_add_private (class, sizeof (CompEditorPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = comp_editor_set_property;
+ object_class->get_property = comp_editor_get_property;
+ object_class->dispose = comp_editor_dispose;
+ object_class->finalize = comp_editor_finalize;
+
+ widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->map = comp_editor_map;
+
+ class->help_section = "usage-calendar";
+ class->edit_comp = real_edit_comp;
+ class->send_comp = real_send_comp;
+ class->object_created = NULL;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CHANGED,
+ g_param_spec_boolean (
+ "changed",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CLIENT,
+ g_param_spec_object (
+ "client",
+ NULL,
+ NULL,
+ E_TYPE_CAL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ /* FIXME: Use a proper flags type instead of int. */
+ g_object_class_install_property (
+ object_class,
+ PROP_FLAGS,
+ g_param_spec_int (
+ "flags",
+ NULL,
+ NULL,
+ G_MININT,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SUMMARY,
+ g_param_spec_string (
+ "summary",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
+
+ comp_editor_signals[OBJECT_CREATED] =
+ g_signal_new ("object_created",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (CompEditorClass, object_created),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+}
+
+static void
+comp_editor_init (CompEditor *editor)
+{
+ CompEditorPrivate *priv;
+ GtkActionGroup *action_group;
+ GtkAction *action;
+ GError *error = NULL;
+
+ editor->priv = priv = COMP_EDITOR_GET_PRIVATE (editor);
+
+ priv->pages = NULL;
+ priv->changed = FALSE;
+ priv->needs_send = FALSE;
+ priv->mod = CALOBJ_MOD_ALL;
+ priv->existing_org = FALSE;
+ priv->user_org = FALSE;
+ priv->warned = FALSE;
+ priv->is_group_item = FALSE;
+
+ priv->attachment_bar = e_attachment_bar_new (NULL);
+ priv->manager = gtk_ui_manager_new ();
+
+ action_group = gtk_action_group_new ("core");
+ gtk_action_group_set_translation_domain (
+ action_group, GETTEXT_PACKAGE);
+ gtk_action_group_add_actions (
+ action_group, core_entries,
+ G_N_ELEMENTS (core_entries), editor);
+ gtk_ui_manager_insert_action_group (
+ priv->manager, action_group, 0);
+ g_object_unref (action_group);
+
+ action_group = gtk_action_group_new ("individual");
+ gtk_action_group_set_translation_domain (
+ action_group, GETTEXT_PACKAGE);
+ gtk_action_group_add_actions (
+ action_group, individual_entries,
+ G_N_ELEMENTS (individual_entries), editor);
+ gtk_action_group_add_toggle_actions (
+ action_group, individual_toggle_entries,
+ G_N_ELEMENTS (individual_toggle_entries), editor);
+ gtk_action_group_add_radio_actions (
+ action_group, classification_radio_entries,
+ G_N_ELEMENTS (classification_radio_entries),
+ E_CAL_COMPONENT_CLASS_PUBLIC,
+ NULL, NULL); /* no callback */
+ action = e_attachment_bar_recent_action_new (
+ E_ATTACHMENT_BAR (priv->attachment_bar),
+ "attach-recent", _("Recent Docu_ments"));
+ gtk_action_group_add_action (action_group, action);
+ gtk_ui_manager_insert_action_group (
+ priv->manager, action_group, 0);
+ g_object_unref (action_group);
+
+ action_group = gtk_action_group_new ("coordinated");
+ gtk_action_group_set_translation_domain (
+ action_group, GETTEXT_PACKAGE);
+ gtk_action_group_add_toggle_actions (
+ action_group, coordinated_toggle_entries,
+ G_N_ELEMENTS (coordinated_toggle_entries), editor);
+ gtk_ui_manager_insert_action_group (
+ priv->manager, action_group, 0);
+ g_object_unref (action_group);
+
+ /* Fine Tuning */
+
+ action = comp_editor_get_action (editor, "attach");
+ g_object_set (G_OBJECT (action), "short-label", _("Attach"), NULL);
+
+ /* Desensitize the "save" action. */
+ action = comp_editor_get_action (editor, "save");
+ gtk_action_set_sensitive (action, FALSE);
+
+ gtk_ui_manager_add_ui_from_string (priv->manager, ui, -1, &error);
+ if (error != NULL) {
+ g_warning ("%s: %s", G_STRFUNC, error->message);
+ g_error_free (error);
+ }
+
+ setup_widgets (editor);
+
+ /* DND support */
+ gtk_drag_dest_set (GTK_WIDGET (editor), GTK_DEST_DEFAULT_ALL, drop_types, num_drop_types, GDK_ACTION_COPY|GDK_ACTION_ASK|GDK_ACTION_MOVE);
+ g_signal_connect(editor, "drag_data_received", G_CALLBACK (drag_data_received), NULL);
+ g_signal_connect(editor, "drag-motion", G_CALLBACK(drag_motion), editor);
+
+ gtk_window_set_type_hint (GTK_WINDOW (editor), GDK_WINDOW_TYPE_HINT_NORMAL);
+}
+
static gboolean
prompt_and_save_changes (CompEditor *editor, gboolean send)
{
@@ -1195,18 +2103,19 @@ cab_popup(EAttachmentBar *bar, GdkEventButton *event, int id)
/* GtkWidget methods. */
static gboolean
-popup_menu_event (GtkWidget *widget)
+popup_menu_event (EAttachmentBar *bar)
{
- cab_popup((EAttachmentBar *)widget, NULL, -1);
+ cab_popup (bar, NULL, -1);
+
return TRUE;
}
static int
-button_press_event (GtkWidget *widget, GdkEventButton *event)
+button_press_event (EAttachmentBar *bar,
+ GdkEventButton *event)
{
- EAttachmentBar *bar = (EAttachmentBar *)widget;
- GnomeIconList *icon_list = GNOME_ICON_LIST(widget);
+ GnomeIconList *icon_list = GNOME_ICON_LIST (bar);
int icon_number = -1;
if (event->button != 3)
@@ -1226,9 +2135,9 @@ button_press_event (GtkWidget *widget, GdkEventButton *event)
}
static gint
-key_press_event(GtkWidget *widget, GdkEventKey *event)
+key_press_event (EAttachmentBar *bar,
+ GdkEventKey *event)
{
- EAttachmentBar *bar = (EAttachmentBar *)widget;
if (event->keyval == GDK_Delete) {
e_attachment_bar_remove_selected (bar);
return TRUE;
@@ -1238,7 +2147,8 @@ key_press_event(GtkWidget *widget, GdkEventKey *event)
}
static gint
-editor_key_press_event(GtkWidget *widget, GdkEventKey *event, CompEditor *editor)
+editor_key_press_event (CompEditor *editor,
+ GdkEventKey *event)
{
if (event->keyval == GDK_Escape) {
commit_all_fields (editor);
@@ -1251,315 +2161,40 @@ editor_key_press_event(GtkWidget *widget, GdkEventKey *event, CompEditor *editor
return FALSE;
}
-/* Menu callbacks */
-static void
-menu_file_save_cb (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- CompEditor *editor = (CompEditor *) data;
- CompEditorPrivate *priv = editor->priv;
- ECalComponentText text;
- gboolean delegated = FALSE;
- gboolean read_only, correct = FALSE;
- ECalComponent *comp;
-
- if (e_attachment_bar_get_download_count (E_ATTACHMENT_BAR (editor->priv->attachment_bar)) ){
- gboolean response = 1;
- /*FIXME: Cannot use mail functions from calendar!!!! */
-#if 0
- ECalComponentVType vtype = e_cal_component_get_vtype(editor->priv->comp);
-
- if (vtype == E_CAL_COMPONENT_EVENT)
- response = em_utils_prompt_user((GtkWindow *)widget,
- NULL,
- "calendar:ask-send-event-pending-download",
- NULL);
- else
- response = em_utils_prompt_user((GtkWindow *)widget,
- NULL,
- "calendar:ask-send-task-pending-download",
- NULL);
-#endif
- if (!response)
- return;
- }
-
- if (!e_cal_is_read_only (priv->client, &read_only, NULL) || read_only) {
- e_error_run ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (editor)), "calendar:prompt-read-only-cal-editor", e_source_peek_name (e_cal_get_source (priv->client)), NULL);
- return;
- }
-
- commit_all_fields (editor);
- if (e_cal_component_is_instance (priv->comp))
- if (!recur_component_dialog (priv->client, priv->comp, &priv->mod, GTK_WINDOW (editor), delegated))
- return;
-
- comp = comp_editor_get_current_comp (editor, &correct);
- e_cal_component_get_summary (comp, &text);
- g_object_unref (comp);
-
- if (!correct)
- return;
-
- if (!text.value)
- if (!send_component_prompt_subject ((GtkWindow *) editor, priv->client, priv->comp))
- return;
- if (save_comp_with_send (editor))
- close_dialog (editor);
-
-}
-
-static void
-menu_file_print_cb (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- CompEditor *editor = (CompEditor *) data;
- CompEditorPrivate *priv = editor->priv;
- ECalComponent *comp;
- GList *l;
- icalcomponent *icalcomp = e_cal_component_get_icalcomponent (priv->comp);
-
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
-
- for (l = priv->pages; l != NULL; l = l->next)
- comp_editor_page_fill_component (l->data, comp);
-
- print_comp (comp, priv->client, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
-
- g_object_unref (comp);
-}
-static void
-menu_file_print_preview_cb (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- CompEditor *editor = (CompEditor *) data;
- CompEditorPrivate *priv = editor->priv;
- ECalComponent *comp;
- GList *l;
- icalcomponent *icalcomp = e_cal_component_get_icalcomponent (priv->comp);
-
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
- for (l = priv->pages; l != NULL; l = l->next)
- comp_editor_page_fill_component (l->data, comp);
- print_comp (comp, priv->client, TRUE);
-
- g_object_unref (comp);
-}
-
-static void
-menu_file_close_cb (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- CompEditor *editor = (CompEditor *) data;
-
- commit_all_fields (editor);
-
- if (prompt_and_save_changes (editor, TRUE))
- close_dialog (editor);
-}
-
-static void
-menu_edit_copy_cb (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- CompEditor *editor = (CompEditor *) data;
- CompEditorPrivate *priv = editor->priv;
-
- if (GTK_IS_ENTRY (priv->focused_entry))
- gtk_editable_copy_clipboard (GTK_EDITABLE (priv->focused_entry));
- if (GTK_IS_TEXT_VIEW (priv->focused_entry))
- g_signal_emit_by_name (priv->focused_entry, "copy-clipboard");
-}
-
-static void
-menu_edit_paste_cb (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- CompEditor *editor = (CompEditor *) data;
- CompEditorPrivate *priv = editor->priv;
-
- if (GTK_IS_ENTRY (priv->focused_entry))
- gtk_editable_paste_clipboard (GTK_EDITABLE (priv->focused_entry));
- if (GTK_IS_TEXT_VIEW (priv->focused_entry))
- g_signal_emit_by_name (priv->focused_entry, "paste-clipboard");
-
-
-}
-
-static void
-menu_edit_selectall_cb (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- CompEditor *editor = (CompEditor *) data;
- CompEditorPrivate *priv = editor->priv;
-
- if (GTK_IS_ENTRY (priv->focused_entry)) {
- gtk_editable_set_position (GTK_EDITABLE (priv->focused_entry), -1);
- gtk_editable_select_region (GTK_EDITABLE (priv->focused_entry), 0, -1);
- }
- if (GTK_IS_TEXT_VIEW (priv->focused_entry))
- g_signal_emit_by_name (priv->focused_entry, "select-all", TRUE);
-}
-
-static void
-menu_edit_cut_cb (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- CompEditor *editor = data;
- CompEditorPrivate *priv = editor->priv;
-
- if (GTK_IS_ENTRY (priv->focused_entry))
- gtk_editable_cut_clipboard (GTK_EDITABLE (priv->focused_entry));
- if (GTK_IS_TEXT_VIEW (priv->focused_entry))
- g_signal_emit_by_name (priv->focused_entry, "cut-clipboard");
-
-
-}
-
-static void
-add_to_bar (CompEditor *editor, GPtrArray *file_list, int is_inline)
-{
- CompEditorPrivate *priv = editor->priv;
- int i;
-
- for (i = 0; i < file_list->len; i++) {
- CamelURL *url;
-
- if (!(url = camel_url_new (file_list->pdata[i], NULL)))
- continue;
-
- if (!g_ascii_strcasecmp (url->protocol, "file")) {
- e_attachment_bar_attach((EAttachmentBar *)priv->attachment_bar, url->path, is_inline ? "inline" : "attachment");
- } else {
- e_attachment_bar_attach_remote_file ((EAttachmentBar *)priv->attachment_bar, file_list->pdata[i], is_inline ? "inline" : "attachment");
- }
-
- camel_url_free (url);
- }
-}
-
-static void
-menu_insert_attachment_cb (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- CompEditor *editor = (CompEditor *) data;
- GPtrArray *file_list;
- gboolean is_inline = FALSE;
- int i;
-
- file_list = comp_editor_select_file_attachments (editor, &is_inline);
-
- if (file_list) {
- add_to_bar (editor, file_list, is_inline);
-
- for (i = 0; i < file_list->len; i++)
- g_free (file_list->pdata[i]);
-
- g_ptr_array_free (file_list, TRUE);
- }
-}
-
-static void
-menu_insert_attach_recent_docs_cb (BonoboUIComponent *uic,
- gpointer user_data,
- const char *cname)
-{
- CompEditor *editor = (CompEditor *) user_data;
- gchar *command = NULL, *uri = NULL;
- GPtrArray *file_list = g_ptr_array_new ();
- int i;
-
- command = g_strdup_printf ("/commands/%s", cname);
- uri = bonobo_ui_component_get_prop (editor->uic, command, "uri", NULL);
- g_free (command);
-
- if (uri && *uri) {
- g_ptr_array_add (file_list, uri);
- add_to_bar (editor, file_list, FALSE);
- }
-
- for (i = 0; i < file_list->len; i++)
- g_free (file_list->pdata[i]);
- g_ptr_array_free (file_list, TRUE);
-}
-
-static void
-menu_help_cb (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- CompEditor *editor = (CompEditor *) data;
-
- comp_editor_show_help (editor);
-}
-
-static BonoboUIVerb verbs [] = {
-
- BONOBO_UI_VERB ("FileSave", menu_file_save_cb),
- BONOBO_UI_VERB ("CalendarPrint", menu_file_print_cb),
- BONOBO_UI_VERB ("CalendarPrintPreview", menu_file_print_preview_cb),
- BONOBO_UI_VERB ("FileClose", menu_file_close_cb),
-
- BONOBO_UI_VERB ("EditCopy", menu_edit_copy_cb),
- BONOBO_UI_VERB ("EditPaste", menu_edit_paste_cb),
- BONOBO_UI_VERB ("EditCut", menu_edit_cut_cb),
- BONOBO_UI_VERB ("EditSelectAll", menu_edit_selectall_cb),
- BONOBO_UI_VERB ("InsertAttachments", menu_insert_attachment_cb),
-
- BONOBO_UI_VERB ("Help", menu_help_cb),
-
- BONOBO_UI_VERB_END
-};
-
-static EPixmap pixmaps[] = {
- E_PIXMAP ("/commands/FileSave", "document-save", E_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/FileClose", "window-close", E_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/EditCut", "edit-cut", E_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/EditCopy", "edit-copy", E_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/EditPaste", "edit-paste", E_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/InsertAttachments", "mail-attachment", E_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/Help", "help-contents", E_ICON_SIZE_MENU),
-
- E_PIXMAP ("/Toolbar/FileSave", "document-save", E_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/FileClose", "window-close", E_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/InsertAttachments", "mail-attachment", E_ICON_SIZE_LARGE_TOOLBAR),
-
- E_PIXMAP_END
-};
+/* Menu callbacks */
-/* Creates the basic in the editor */
static void
setup_widgets (CompEditor *editor)
{
CompEditorPrivate *priv;
- GtkWidget *expander_hbox, *vbox;
- GdkPixbuf *attachment_pixbuf;
+ GtkWidget *expander_hbox;
+ GtkWidget *widget;
+ GtkWidget *vbox;
priv = editor->priv;
/* Useful vbox */
vbox = gtk_vbox_new (FALSE, 0);
- bonobo_window_set_contents (BONOBO_WINDOW (editor), vbox);
+ gtk_container_add (GTK_CONTAINER (editor), vbox);
gtk_widget_show (vbox);
+ /* Main Menu */
+ widget = comp_editor_get_managed_widget (editor, "/main-menu");
+ gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ /* Main Toolbar */
+ widget = comp_editor_get_managed_widget (editor, "/main-toolbar");
+ gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
/* Notebook */
- priv->notebook = GTK_NOTEBOOK (gtk_notebook_new ());
- gtk_widget_show (GTK_WIDGET (priv->notebook));
- gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (priv->notebook),
- TRUE, TRUE, 0);
- gtk_notebook_set_show_tabs (priv->notebook, FALSE);
+ widget = gtk_notebook_new ();
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
+ gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, TRUE, 0);
+ gtk_widget_show (widget);
+ priv->notebook = GTK_NOTEBOOK (widget);
g_signal_connect (editor, "delete_event", G_CALLBACK (delete_event_cb), editor);
g_signal_connect (editor, "key_press_event", G_CALLBACK (editor_key_press_event), editor);
@@ -1571,8 +2206,6 @@ setup_widgets (CompEditor *editor)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->attachment_scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- priv->attachment_bar = e_attachment_bar_new (NULL);
-
g_signal_connect (priv->attachment_bar, "button_press_event", G_CALLBACK (button_press_event), NULL);
g_signal_connect (priv->attachment_bar, "key_press_event", G_CALLBACK (key_press_event), NULL);
g_signal_connect (priv->attachment_bar, "popup-menu", G_CALLBACK (popup_menu_event), NULL);
@@ -1593,11 +2226,9 @@ setup_widgets (CompEditor *editor)
gtk_misc_set_alignment (GTK_MISC (priv->attachment_expander_num), 1.0, 0.5);
expander_hbox = gtk_hbox_new (FALSE, 0);
- attachment_pixbuf = e_icon_factory_get_icon ("mail-attachment", E_ICON_SIZE_MENU);
- priv->attachment_expander_icon = gtk_image_new_from_pixbuf (attachment_pixbuf);
+ priv->attachment_expander_icon = gtk_image_new_from_icon_name ("mail-attachment", GTK_ICON_SIZE_MENU);
gtk_misc_set_alignment (GTK_MISC (priv->attachment_expander_icon), 1, 0.5);
gtk_widget_set_size_request (priv->attachment_expander_icon, 100, -1);
- g_object_unref (attachment_pixbuf);
gtk_box_pack_start (GTK_BOX (expander_hbox), priv->attachment_expander_label,
TRUE, TRUE, 0);
@@ -1614,151 +2245,24 @@ setup_widgets (CompEditor *editor)
atk_object_set_description (gtk_widget_get_accessible (priv->attachment_expander), _("Press space key to toggle attachment bar"));
gtk_container_add (GTK_CONTAINER (priv->attachment_expander), priv->attachment_scrolled_window);
- gtk_box_pack_start (GTK_BOX (vbox), priv->attachment_expander, FALSE, FALSE, GNOME_PAD_SMALL);
+ gtk_box_pack_start (GTK_BOX (vbox), priv->attachment_expander, FALSE, FALSE, 4);
gtk_widget_show (priv->attachment_expander);
e_expander_set_expanded (E_EXPANDER (priv->attachment_expander), FALSE);
g_signal_connect_after (priv->attachment_expander, "activate",
G_CALLBACK (attachment_expander_activate_cb), editor);
}
-/* Object initialization function for the calendar component editor */
-static void
-comp_editor_init (CompEditor *editor)
-{
- CompEditorPrivate *priv;
- BonoboUIContainer *container;
- char *xmlfile;
-
- priv = g_new0 (CompEditorPrivate, 1);
- editor->priv = priv;
-
- setup_widgets (editor);
-
- priv->focused_entry = NULL;
- priv->pages = NULL;
- priv->changed = FALSE;
- priv->needs_send = FALSE;
- priv->mod = CALOBJ_MOD_ALL;
- priv->existing_org = FALSE;
- priv->user_org = FALSE;
- priv->warned = FALSE;
- priv->is_group_item = FALSE;
- priv->help_section = g_strdup ("usage-calendar");
-
- container = bonobo_window_get_ui_container (BONOBO_WINDOW (editor));
- editor->uic = bonobo_ui_component_new_default ();
- /* FIXME: handle bonobo exceptions */
- bonobo_ui_component_set_container (editor->uic, bonobo_object_corba_objref (BONOBO_OBJECT (container)), NULL);
-
- bonobo_ui_component_add_verb_list_with_data (editor->uic, verbs, editor);
-
- bonobo_ui_component_freeze (editor->uic, NULL);
-
- xmlfile = g_build_filename (EVOLUTION_UIDIR,
- "evolution-editor.xml",
- NULL);
- bonobo_ui_util_set_ui (editor->uic, PREFIX,
- xmlfile,
- "evolution-editor", NULL);
- g_free (xmlfile);
-
- e_pixmaps_update (editor->uic, pixmaps);
- bonobo_ui_component_thaw (editor->uic, NULL);
-
- bonobo_ui_component_set_prop (editor->uic, "/commands/FileSave", "sensitive", "0", NULL);
-
- /* FIXME: this should have been setup_widgets, but editor->uic is uninitialized then */
- e_attachment_bar_bonobo_ui_populate_with_recent (editor->uic, "/menu/Insert/RecentDocsPlaceholder",
- E_ATTACHMENT_BAR (priv->attachment_bar),
- menu_insert_attach_recent_docs_cb, editor);
-
- /* DND support */
- gtk_drag_dest_set (GTK_WIDGET (editor), GTK_DEST_DEFAULT_ALL, drop_types, num_drop_types, GDK_ACTION_COPY|GDK_ACTION_ASK|GDK_ACTION_MOVE);
- g_signal_connect(editor, "drag_data_received", G_CALLBACK (drag_data_received), NULL);
- g_signal_connect(editor, "drag-motion", G_CALLBACK(drag_motion), editor);
-
- gtk_window_set_type_hint (GTK_WINDOW (editor), GDK_WINDOW_TYPE_HINT_NORMAL);
-}
-
-
-static gint
-comp_editor_key_press_event (GtkWidget *d, GdkEventKey *e)
-{
-#if 0
- if (e->keyval == GDK_Escape) {
- if (prompt_and_save_changes (COMP_EDITOR (d), TRUE))
- close_dialog (COMP_EDITOR (d));
- return TRUE;
- }
-#endif
-
- if (GTK_WIDGET_CLASS (comp_editor_parent_class)->key_press_event)
- return (* GTK_WIDGET_CLASS (comp_editor_parent_class)->key_press_event) (d, e);
-
- return FALSE;
-}
-
-/* Destroy handler for the calendar component editor */
-static void
-comp_editor_finalize (GObject *object)
-{
- CompEditor *editor;
- CompEditorPrivate *priv;
- GList *l;
-
- editor = COMP_EDITOR (object);
- priv = editor->priv;
-
- g_free (priv->help_section);
-
- if (priv->client) {
- g_object_unref (priv->client);
- priv->client = NULL;
- }
-
- if (priv->source_client) {
- g_object_unref (priv->source_client);
- priv->source_client = NULL;
- }
-
- if (priv->view) {
- g_signal_handlers_disconnect_matched (G_OBJECT (priv->view),
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL,
- editor);
-
- g_object_unref (priv->view);
- priv->view = NULL;
- }
-
- /* We want to destroy the pages after the widgets get destroyed,
- since they have lots of signal handlers connected to the widgets
- with the pages as the data. */
- for (l = priv->pages; l != NULL; l = l->next)
- g_object_unref (l->data);
-
- if (priv->comp) {
- g_object_unref (priv->comp);
- priv->comp = NULL;
- }
-
- g_free (priv);
- editor->priv = NULL;
-
- if (G_OBJECT_CLASS (comp_editor_parent_class)->finalize)
- (* G_OBJECT_CLASS (comp_editor_parent_class)->finalize) (object);
-}
static void
comp_editor_show_help (CompEditor *editor)
{
+ CompEditorClass *class;
GError *error = NULL;
- CompEditorPrivate *priv;
- priv = editor->priv;
+ class = COMP_EDITOR_GET_CLASS (editor);
+ g_return_if_fail (class->help_section != NULL);
- gnome_help_display (
- "evolution.xml", priv->help_section, &error);
+ gnome_help_display ("evolution.xml", class->help_section, &error);
if (error != NULL) {
g_warning ("%s", error->message);
g_error_free (error);
@@ -1766,30 +2270,11 @@ comp_editor_show_help (CompEditor *editor)
}
-static void
-delete_comp (CompEditor *editor)
-{
- CompEditorPrivate *priv;
- const char *uid;
-
- priv = editor->priv;
-
- e_cal_component_get_uid (priv->comp, &uid);
- if (e_cal_component_is_instance (priv->comp)|| e_cal_component_has_recurrences (priv->comp))
- e_cal_remove_object_with_mod (priv->client, uid, NULL,
- CALOBJ_MOD_ALL, NULL);
- else
- e_cal_remove_object (priv->client, uid, NULL);
- close_dialog (editor);
-}
-
/* Closes the dialog box and emits the appropriate signals */
static void
close_dialog (CompEditor *editor)
{
- CompEditorPrivate *priv;
-
- priv = editor->priv;
+ CompEditorPrivate *priv = editor->priv;
/* FIXME Unfortunately we do this here because otherwise corba
calls happen during destruction and we might get a change
@@ -1806,79 +2291,122 @@ close_dialog (CompEditor *editor)
void
comp_editor_set_existing_org (CompEditor *editor, gboolean existing_org)
{
- CompEditorPrivate *priv;
-
- g_return_if_fail (editor != NULL);
g_return_if_fail (IS_COMP_EDITOR (editor));
- priv = editor->priv;
-
- priv->existing_org = existing_org;
+ editor->priv->existing_org = existing_org;
}
gboolean
comp_editor_get_existing_org (CompEditor *editor)
{
- CompEditorPrivate *priv;
-
- g_return_val_if_fail (editor != NULL, FALSE);
g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE);
- priv = editor->priv;
-
- return priv->existing_org;
+ return editor->priv->existing_org;
}
void
-comp_editor_set_user_org (CompEditor *editor, gboolean user_org)
+comp_editor_set_user_org (CompEditor *editor,
+ gboolean user_org)
{
- CompEditorPrivate *priv;
-
- g_return_if_fail (editor != NULL);
g_return_if_fail (IS_COMP_EDITOR (editor));
- priv = editor->priv;
-
- priv->user_org = user_org;
+ editor->priv->user_org = user_org;
}
gboolean
comp_editor_get_user_org (CompEditor *editor)
{
- CompEditorPrivate *priv;
-
- g_return_val_if_fail (editor != NULL, FALSE);
g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE);
- priv = editor->priv;
+ return editor->priv->user_org;
+}
+
+void
+comp_editor_set_group_item (CompEditor *editor,
+ gboolean group_item)
+{
+ g_return_if_fail (IS_COMP_EDITOR (editor));
+
+ editor->priv->is_group_item = group_item;
+}
- return priv->user_org;
+gboolean
+comp_editor_get_group_item (CompEditor *editor)
+{
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE);
+
+ return editor->priv->is_group_item;
}
void
-comp_editor_set_group_item (CompEditor *editor, gboolean group_item)
+comp_editor_set_classification (CompEditor *editor,
+ ECalComponentClassification classification)
{
- CompEditorPrivate *priv;
+ GtkAction *action;
- g_return_if_fail (editor != NULL);
g_return_if_fail (IS_COMP_EDITOR (editor));
- priv = editor->priv;
+ switch (classification) {
+ case E_CAL_COMPONENT_CLASS_PUBLIC:
+ case E_CAL_COMPONENT_CLASS_PRIVATE:
+ case E_CAL_COMPONENT_CLASS_CONFIDENTIAL:
+ break;
+ default:
+ classification = E_CAL_COMPONENT_CLASS_PUBLIC;
+ break;
+ }
- priv->is_group_item = group_item;
+ action = comp_editor_get_action (editor, "classify-public");
+ gtk_radio_action_set_current_value (
+ GTK_RADIO_ACTION (action), classification);
}
-gboolean
-comp_editor_get_group_item (CompEditor *editor)
+ECalComponentClassification
+comp_editor_get_classification (CompEditor *editor)
{
- CompEditorPrivate *priv;
+ GtkAction *action;
- g_return_val_if_fail (editor != NULL, FALSE);
- g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE);
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), 0);
- priv = editor->priv;
+ action = comp_editor_get_action (editor, "classify-public");
+ return gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
+}
+
+void
+comp_editor_set_summary (CompEditor *editor,
+ const gchar *summary)
+{
+ gboolean show_warning;
+
+ g_return_if_fail (IS_COMP_EDITOR (editor));
+
+ g_free (editor->priv->summary);
+ editor->priv->summary = g_strdup (summary);
+
+ show_warning =
+ !editor->priv->warned &&
+ editor->priv->existing_org &&
+ !editor->priv->user_org;
+
+ if (show_warning) {
+ e_notice (
+ editor->priv->notebook, GTK_MESSAGE_INFO,
+ _("Changes made to this item may be "
+ "discarded if an update arrives"));
+ editor->priv->warned = TRUE;
+ }
+
+ update_window_border (editor, summary);
- return priv->is_group_item;
+ g_object_notify (G_OBJECT (editor), "summary");
+}
+
+const gchar *
+comp_editor_get_summary (CompEditor *editor)
+{
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL);
+
+ return editor->priv->summary;
}
/**
@@ -1889,16 +2417,33 @@ comp_editor_get_group_item (CompEditor *editor)
* Set the dialog changed state to the given value
**/
void
-comp_editor_set_changed (CompEditor *editor, gboolean changed)
+comp_editor_set_changed (CompEditor *editor,
+ gboolean changed)
{
- CompEditorPrivate *priv;
+ GtkAction *action;
+ gboolean show_warning;
- priv = editor->priv;
+ g_return_if_fail (IS_COMP_EDITOR (editor));
+
+ editor->priv->changed = changed;
- priv->changed = changed;
+ action = comp_editor_get_action (editor, "save");
+ g_return_if_fail (action != NULL);
+ gtk_action_set_sensitive (action, changed);
- bonobo_ui_component_set_prop (editor->uic, "/commands/FileSave", "sensitive", changed ? "1" : "0"
- , NULL);
+ show_warning =
+ changed && !editor->priv->warned &&
+ editor->priv->existing_org && !editor->priv->user_org;
+
+ if (show_warning) {
+ e_notice (
+ editor->priv->notebook, GTK_MESSAGE_INFO,
+ _("Changes made to this item may be "
+ "discarded if an update arrives"));
+ editor->priv->warned = TRUE;
+ }
+
+ g_object_notify (G_OBJECT (editor), "changed");
}
/**
@@ -1913,40 +2458,100 @@ comp_editor_set_changed (CompEditor *editor, gboolean changed)
gboolean
comp_editor_get_changed (CompEditor *editor)
{
- CompEditorPrivate *priv;
-
- priv = editor->priv;
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE);
- return priv->changed;
+ return editor->priv->changed;
}
void
-comp_editor_set_flags (CompEditor *editor, CompEditorFlags flags)
+comp_editor_set_flags (CompEditor *editor,
+ CompEditorFlags flags)
{
-
- CompEditorPrivate *priv;
-
- g_return_if_fail (editor != NULL);
g_return_if_fail (IS_COMP_EDITOR (editor));
- priv = editor->priv;
+ editor->priv->flags = flags;
- priv->flags = flags;
+ g_object_notify (G_OBJECT (editor), "flags");
}
CompEditorFlags
comp_editor_get_flags (CompEditor *editor)
{
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE);
- CompEditorPrivate *priv;
+ return editor->priv->flags;
+}
- g_return_val_if_fail (editor != NULL, FALSE);
- g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE);
+GtkUIManager *
+comp_editor_get_ui_manager (CompEditor *editor)
+{
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL);
- priv = editor->priv;
+ return editor->priv->manager;
+}
+
+GtkAction *
+comp_editor_get_action (CompEditor *editor,
+ const gchar *action_name)
+{
+ GtkAction *action = NULL;
+ GList *iter;
+
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL);
+ g_return_val_if_fail (action_name != NULL, NULL);
- return priv->flags;
+ iter = gtk_ui_manager_get_action_groups (editor->priv->manager);
+ while (iter != NULL && action == NULL) {
+ GtkActionGroup *action_group = iter->data;
+
+ action = gtk_action_group_get_action (
+ action_group, action_name);
+ iter = g_list_next (iter);
+ }
+ g_return_val_if_fail (action != NULL, NULL);
+
+ return action;
+}
+
+GtkActionGroup *
+comp_editor_get_action_group (CompEditor *editor,
+ const gchar *group_name)
+{
+ GList *iter;
+
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL);
+ g_return_val_if_fail (group_name != NULL, NULL);
+
+ iter = gtk_ui_manager_get_action_groups (editor->priv->manager);
+ while (iter != NULL) {
+ GtkActionGroup *action_group = iter->data;
+ const gchar *name;
+
+ name = gtk_action_group_get_name (action_group);
+ if (strcmp (name, group_name) == 0)
+ return action_group;
+ iter = g_list_next (iter);
+ }
+
+ g_return_val_if_reached (NULL);
+}
+
+GtkWidget *
+comp_editor_get_managed_widget (CompEditor *editor,
+ const gchar *widget_path)
+{
+ GtkUIManager *manager;
+ GtkWidget *widget;
+
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL);
+ g_return_val_if_fail (widget_path != NULL, NULL);
+
+ manager = comp_editor_get_ui_manager (editor);
+ widget = gtk_ui_manager_get_widget (manager, widget_path);
+ g_return_val_if_fail (widget != NULL, NULL);
+
+ return widget;
}
/**
@@ -1957,13 +2562,12 @@ comp_editor_get_flags (CompEditor *editor)
* Set the dialog needs send state to the given value
**/
void
-comp_editor_set_needs_send (CompEditor *editor, gboolean needs_send)
+comp_editor_set_needs_send (CompEditor *editor,
+ gboolean needs_send)
{
- CompEditorPrivate *priv;
-
- priv = editor->priv;
+ g_return_if_fail (IS_COMP_EDITOR (editor));
- priv->needs_send = needs_send;
+ editor->priv->needs_send = needs_send;
}
/**
@@ -1978,15 +2582,14 @@ comp_editor_set_needs_send (CompEditor *editor, gboolean needs_send)
gboolean
comp_editor_get_needs_send (CompEditor *editor)
{
- CompEditorPrivate *priv;
-
- priv = editor->priv;
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE);
- return priv->needs_send;
+ return editor->priv->needs_send;
}
-static void page_mapped_cb (GtkWidget *page_widget,
- CompEditorPage *page)
+static void
+page_mapped_cb (GtkWidget *page_widget,
+ CompEditorPage *page)
{
GtkWidget *toplevel;
@@ -2000,8 +2603,9 @@ static void page_mapped_cb (GtkWidget *page_widget,
}
}
-static void page_unmapped_cb (GtkWidget *page_widget,
- CompEditorPage *page)
+static void
+page_unmapped_cb (GtkWidget *page_widget,
+ CompEditorPage *page)
{
GtkWidget *toplevel;
@@ -2036,18 +2640,13 @@ comp_editor_append_page (CompEditor *editor,
GtkWidget *label_widget = NULL;
gboolean is_first_page;
- g_return_if_fail (editor != NULL);
g_return_if_fail (IS_COMP_EDITOR (editor));
- g_return_if_fail (page != NULL);
g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
priv = editor->priv;
g_object_ref (page);
- /* set the flags */
- page->flags = priv->flags;
-
/* If we are editing something, fill the widgets with current info */
if (priv->comp != NULL) {
ECalComponent *comp;
@@ -2071,24 +2670,18 @@ comp_editor_append_page (CompEditor *editor,
gtk_notebook_append_page (priv->notebook, page_widget, label_widget);
/* Listen for things happening on the page */
- g_signal_connect(page, "changed",
- G_CALLBACK (page_changed_cb), editor);
- g_signal_connect(page, "needs_send",
- G_CALLBACK (needs_send_cb), editor);
- g_signal_connect(page, "summary_changed",
- G_CALLBACK (page_summary_changed_cb), editor);
- g_signal_connect(page, "dates_changed",
- G_CALLBACK (page_dates_changed_cb), editor);
- g_signal_connect(page, "focus_in",
- G_CALLBACK (page_focus_in_widget_cb), editor);
- g_signal_connect(page, "focus_out",
- G_CALLBACK (page_focus_out_widget_cb), editor);
+ g_signal_connect_swapped (
+ page, "dates_changed",
+ G_CALLBACK (page_dates_changed_cb), editor);
+
/* Listen for when the page is mapped/unmapped so we can
install/uninstall the appropriate GtkAccelGroup. */
- g_signal_connect((page_widget), "map",
- G_CALLBACK (page_mapped_cb), page);
- g_signal_connect((page_widget), "unmap",
- G_CALLBACK (page_unmapped_cb), page);
+ g_signal_connect (
+ page_widget, "map",
+ G_CALLBACK (page_mapped_cb), page);
+ g_signal_connect(
+ page_widget, "unmap",
+ G_CALLBACK (page_unmapped_cb), page);
/* The first page is the main page of the editor, so we ask it to focus
* its main widget.
@@ -2111,9 +2704,7 @@ comp_editor_remove_page (CompEditor *editor, CompEditorPage *page)
GtkWidget *page_widget;
gint page_num;
- g_return_if_fail (editor != NULL);
g_return_if_fail (IS_COMP_EDITOR (editor));
- g_return_if_fail (page != NULL);
g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
priv = editor->priv;
@@ -2147,9 +2738,7 @@ comp_editor_show_page (CompEditor *editor, CompEditorPage *page)
GtkWidget *page_widget;
gint page_num;
- g_return_if_fail (editor != NULL);
g_return_if_fail (IS_COMP_EDITOR (editor));
- g_return_if_fail (page != NULL);
g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
priv = editor->priv;
@@ -2160,28 +2749,35 @@ comp_editor_show_page (CompEditor *editor, CompEditorPage *page)
}
/**
- * comp_editor_set_e_cal:
+ * comp_editor_set_client:
* @editor: A component editor
* @client: The calendar client to use
*
* Sets the calendar client used by the editor to update components
**/
void
-comp_editor_set_e_cal (CompEditor *editor, ECal *client)
+comp_editor_set_client (CompEditor *editor,
+ ECal *client)
{
- CompEditorClass *klass;
-
- g_return_if_fail (editor != NULL);
g_return_if_fail (IS_COMP_EDITOR (editor));
+ g_return_if_fail (client == NULL || E_IS_CAL (client));
+
+ if (client != NULL)
+ g_object_ref (client);
+
+ if (editor->priv->client != NULL)
+ g_object_unref (editor->priv->client);
- klass = COMP_EDITOR_CLASS (G_OBJECT_GET_CLASS (editor));
+ editor->priv->client = client;
- if (klass->set_e_cal)
- klass->set_e_cal (editor, client);
+ if (editor->priv->source_client == NULL && client != NULL)
+ editor->priv->source_client = g_object_ref (client);
+
+ g_object_notify (G_OBJECT (editor), "client");
}
/**
- * comp_editor_get_e_cal:
+ * comp_editor_get_client:
* @editor: A component editor
*
* Returns the calendar client of the editor
@@ -2189,177 +2785,11 @@ comp_editor_set_e_cal (CompEditor *editor, ECal *client)
* Return value: The calendar client of the editor
**/
ECal *
-comp_editor_get_e_cal (CompEditor *editor)
+comp_editor_get_client (CompEditor *editor)
{
- CompEditorPrivate *priv;
-
- g_return_val_if_fail (editor != NULL, NULL);
g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL);
- priv = editor->priv;
-
- return priv->client;
-}
-
-void
-comp_editor_set_help_section (CompEditor *editor, const char *section)
-{
- CompEditorPrivate *priv;
-
- priv = editor->priv;
-
- g_free (priv->help_section);
- priv->help_section = g_strdup (section);
-}
-
-/* Creates an appropriate title for the event editor dialog */
-static char *
-make_title_from_comp (ECalComponent *comp, gboolean is_group_item)
-{
- char *title;
- const char *type_string;
- ECalComponentVType type;
- ECalComponentText text;
-
- if (!comp)
- return g_strdup (_("Edit Appointment"));
-
- type = e_cal_component_get_vtype (comp);
- switch (type) {
- case E_CAL_COMPONENT_EVENT:
- if (is_group_item)
- type_string = _("Meeting - %s");
- else
- type_string = _("Appointment - %s");
- break;
- case E_CAL_COMPONENT_TODO:
- if (is_group_item)
- type_string = _("Assigned Task - %s");
- else
- type_string = _("Task - %s");
- break;
- case E_CAL_COMPONENT_JOURNAL:
- type_string = _("Memo - %s");
- break;
- default:
- g_message ("make_title_from_comp(): Cannot handle object of type %d", type);
- return NULL;
- }
-
- e_cal_component_get_summary (comp, &text);
- if (text.value) {
- title = g_strdup_printf (type_string, text.value);
- } else {
- title = g_strdup_printf (type_string, _("No summary"));
- }
-
- return title;
-}
-
-/* Creates an appropriate title for the event editor dialog */
-static char *
-make_title_from_string (ECalComponent *comp, const char *str, gboolean is_group_item)
-{
- char *title;
- const char *type_string;
- ECalComponentVType type;
-
- if (!comp)
- return g_strdup (_("Edit Appointment"));
-
- type = e_cal_component_get_vtype (comp);
- switch (type) {
- case E_CAL_COMPONENT_EVENT:
- if (is_group_item)
- type_string = _("Meeting - %s");
- else
- type_string = _("Appointment - %s");
- break;
- case E_CAL_COMPONENT_TODO:
- if (is_group_item)
- type_string = _("Assigned Task - %s");
- else
- type_string = _("Task - %s");
- break;
- case E_CAL_COMPONENT_JOURNAL:
- type_string = _("Memo - %s");
- break;
- default:
- g_message ("make_title_from_string(): Cannot handle object of type %d", type);
- return NULL;
- }
-
- if (str) {
- title = g_strdup_printf (type_string, str);
- } else {
- title = g_strdup_printf (type_string, _("No summary"));
- }
-
- return title;
-}
-
-static const char *
-make_icon_from_comp (ECalComponent *comp)
-{
- ECalComponentVType type;
-
- if (!comp)
- return "stock_calendar";
-
- type = e_cal_component_get_vtype (comp);
- switch (type) {
- case E_CAL_COMPONENT_EVENT:
- return "appointment-new";
- case E_CAL_COMPONENT_TODO:
- return "stock_task";
- case E_CAL_COMPONENT_JOURNAL:
- return "stock_insert-note";
- default:
- return "stock_calendar";
- }
-}
-
-/* Sets the event editor's window title from a calendar component */
-static void
-set_title_from_comp (CompEditor *editor)
-{
- CompEditorPrivate *priv;
- char *title;
-
- priv = editor->priv;
- title = make_title_from_comp (priv->comp, priv->is_group_item);
- gtk_window_set_title (GTK_WINDOW (editor), title);
- g_free (title);
-}
-
-static void
-set_title_from_string (CompEditor *editor, const char *str)
-{
- CompEditorPrivate *priv;
- char *title;
-
- priv = editor->priv;
- title = make_title_from_string (priv->comp, str, priv->is_group_item);
- gtk_window_set_title (GTK_WINDOW (editor), title);
- g_free (title);
-}
-
-static void
-set_icon_from_comp (CompEditor *editor)
-{
- CompEditorPrivate *priv;
- const char *icon_name;
- GList *icon_list;
-
- priv = editor->priv;
- icon_name = make_icon_from_comp (priv->comp);
-
- icon_list = e_icon_factory_get_icon_list (icon_name);
- if (icon_list) {
- gtk_window_set_icon_list (GTK_WINDOW (editor), icon_list);
- g_list_foreach (icon_list, (GFunc) g_object_unref, NULL);
- g_list_free (icon_list);
- }
+ return editor->priv->client;
}
static void
@@ -2479,45 +2909,11 @@ fill_widgets (CompEditor *editor)
}
static void
-real_set_e_cal (CompEditor *editor, ECal *client)
-{
- CompEditorPrivate *priv;
- GList *elem;
-
- g_return_if_fail (editor != NULL);
- g_return_if_fail (IS_COMP_EDITOR (editor));
-
- priv = editor->priv;
-
- if (client == priv->client)
- return;
-
- if (client) {
- g_return_if_fail (E_IS_CAL (client));
- g_return_if_fail (e_cal_get_load_state (client) ==
- E_CAL_LOAD_LOADED);
- g_object_ref (client);
- }
-
- if (priv->client)
- g_object_unref (priv->client);
-
- priv->client = client;
- if (!priv->source_client)
- priv->source_client = g_object_ref (client);
-
- /* Pass the client to any pages that need it. */
- for (elem = priv->pages; elem; elem = elem->next)
- comp_editor_page_set_e_cal (elem->data, client);
-}
-
-static void
real_edit_comp (CompEditor *editor, ECalComponent *comp)
{
CompEditorPrivate *priv;
const char *uid;
- g_return_if_fail (editor != NULL);
g_return_if_fail (IS_COMP_EDITOR (editor));
priv = editor->priv;
@@ -2534,8 +2930,7 @@ real_edit_comp (CompEditor *editor, ECalComponent *comp)
priv->user_org = (itip_organizer_is_user (comp, priv->client) || itip_sentby_is_user (comp));
priv->warned = FALSE;
- set_title_from_comp (editor);
- set_icon_from_comp (editor);
+ update_window_border (editor, NULL);
e_cal_component_get_uid (comp, &uid);
fill_widgets (editor);
@@ -2607,14 +3002,15 @@ static gboolean
real_send_comp (CompEditor *editor, ECalComponentItipMethod method)
{
CompEditorPrivate *priv;
+ CompEditorFlags flags;
ECalComponent *send_comp = NULL;
char *address = NULL;
GList *users = NULL;
- g_return_val_if_fail (editor != NULL, FALSE);
g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE);
priv = editor->priv;
+ flags = comp_editor_get_flags (editor);
if (priv->mod == CALOBJ_MOD_ALL && e_cal_component_is_instance (priv->comp)) {
/* Ensure we send the master object, not the instance only */
@@ -2639,7 +3035,7 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method)
get_users_from_memo_comp (send_comp, &users);
/* The user updates the delegated status to the Organizer, so remove all other attendees */
- if ((priv->flags & COMP_EDITOR_DELEGATE)) {
+ if (flags & COMP_EDITOR_DELEGATE) {
address = itip_get_comp_attendee (send_comp, priv->client);
if (address)
@@ -2695,30 +3091,23 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method)
void
comp_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
{
- CompEditorClass *klass;
+ CompEditorClass *class;
- g_return_if_fail (editor != NULL);
g_return_if_fail (IS_COMP_EDITOR (editor));
- g_return_if_fail (comp != NULL);
g_return_if_fail (E_IS_CAL_COMPONENT (comp));
- klass = COMP_EDITOR_CLASS (G_OBJECT_GET_CLASS (editor));
+ class = COMP_EDITOR_GET_CLASS (editor);
- if (klass->edit_comp)
- klass->edit_comp (editor, comp);
+ if (class->edit_comp)
+ class->edit_comp (editor, comp);
}
ECalComponent *
comp_editor_get_comp (CompEditor *editor)
{
- CompEditorPrivate *priv;
-
- g_return_val_if_fail (editor != NULL, NULL);
g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL);
- priv = editor->priv;
-
- return priv->comp;
+ return editor->priv->comp;
}
/**
@@ -2737,7 +3126,6 @@ comp_editor_get_current_comp (CompEditor *editor, gboolean *correct)
GList *l;
gboolean all_ok = TRUE;
- g_return_val_if_fail (editor != NULL, NULL);
g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL);
priv = editor->priv;
@@ -2775,7 +3163,20 @@ comp_editor_save_comp (CompEditor *editor, gboolean send)
void
comp_editor_delete_comp (CompEditor *editor)
{
- delete_comp (editor);
+ CompEditorPrivate *priv;
+ const char *uid;
+
+ g_return_if_fail (IS_COMP_EDITOR (editor));
+
+ priv = editor->priv;
+
+ e_cal_component_get_uid (priv->comp, &uid);
+ if (e_cal_component_is_instance (priv->comp)|| e_cal_component_has_recurrences (priv->comp))
+ e_cal_remove_object_with_mod (priv->client, uid, NULL,
+ CALOBJ_MOD_ALL, NULL);
+ else
+ e_cal_remove_object (priv->client, uid, NULL);
+ close_dialog (editor);
}
/**
@@ -2788,15 +3189,14 @@ comp_editor_delete_comp (CompEditor *editor)
gboolean
comp_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method)
{
- CompEditorClass *klass;
+ CompEditorClass *class;
- g_return_val_if_fail (editor != NULL, FALSE);
g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE);
- klass = COMP_EDITOR_CLASS (G_OBJECT_GET_CLASS (editor));
+ class = COMP_EDITOR_GET_CLASS (editor);
- if (klass->send_comp)
- return klass->send_comp (editor, method);
+ if (class->send_comp)
+ return class->send_comp (editor, method);
return FALSE;
}
@@ -2806,7 +3206,6 @@ comp_editor_close (CompEditor *editor)
{
gboolean close;
- g_return_val_if_fail (editor != NULL, FALSE);
g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE);
commit_all_fields (editor);
@@ -2870,150 +3269,16 @@ comp_editor_get_mime_attach_list (CompEditor *editor)
return attach_list;
}
-/* Brings attention to a window by raising it and giving it focus */
static void
-raise_and_focus (GtkWidget *widget)
-{
- g_return_if_fail (GTK_WIDGET_REALIZED (widget));
- gdk_window_show (widget->window);
- gtk_widget_grab_focus (widget);
-}
-
-/**
- * comp_editor_focus:
- * @editor: A component editor
- *
- * Brings the editor window to the front and gives it focus
- **/
-void
-comp_editor_focus (CompEditor *editor)
-{
- g_return_if_fail (editor != NULL);
- g_return_if_fail (IS_COMP_EDITOR (editor));
-
- gtk_widget_show (GTK_WIDGET (editor));
- raise_and_focus (GTK_WIDGET (editor));
-}
-
-/**
- * comp_editor_notify_client_changed:
- * @editor: A component editor.
- *
- * Makes an editor emit the "client_changed" signal.
- **/
-void
-comp_editor_notify_client_changed (CompEditor *editor, ECal *client)
-{
- GList *l;
- CompEditorPrivate *priv;
- gboolean read_only;
-
- g_return_if_fail (editor != NULL);
- g_return_if_fail (IS_COMP_EDITOR (editor));
-
- priv = editor->priv;
-
- priv->changed = TRUE;
-
- g_object_unref (priv->client);
- priv->client = client;
-
- comp_editor_set_e_cal (editor, client);
- for (l = priv->pages; l != NULL; l = l->next)
- comp_editor_page_notify_client_changed (COMP_EDITOR_PAGE (l->data), client);
-
- if (!e_cal_is_read_only (client, &read_only, NULL))
- read_only = TRUE;
-
- /* FIXME: SRINI: Disable widgets */
-}
-
-static void
-page_changed_cb (GtkObject *obj, gpointer data)
-{
- CompEditor *editor = COMP_EDITOR (data);
- CompEditorPrivate *priv;
-
- priv = editor->priv;
-
- comp_editor_set_changed (editor, TRUE);
-
- if (!priv->warned && priv->existing_org && !priv->user_org) {
- e_notice (priv->notebook, GTK_MESSAGE_INFO,
- _("Changes made to this item may be discarded if an update arrives"));
- priv->warned = TRUE;
- }
-
-}
-
-static void
-needs_send_cb (GtkObject *obj, gpointer data)
-{
- CompEditor *editor = COMP_EDITOR (data);
-
- comp_editor_set_needs_send (editor, TRUE);
-}
-
-/* Focus out widget callback */
-static void
-page_focus_out_widget_cb (GtkObject *obj, GtkWidget *widget, gpointer data)
-{
- CompEditor *editor = COMP_EDITOR (data);
- CompEditorPrivate *priv;
-
- priv = editor->priv;
-
- priv->focused_entry = NULL;
-}
-
-/* Focus in widget callback*/
-static void
-page_focus_in_widget_cb (GtkObject *obj, GtkWidget *widget, gpointer data)
-{
-
- CompEditor *editor = COMP_EDITOR (data);
- CompEditorPrivate *priv;
-
- priv = editor->priv;
-
- priv->focused_entry = widget;
-}
-/* Page signal callbacks */
-static void
-page_summary_changed_cb (GtkObject *obj, const char *summary, gpointer data)
-{
- CompEditor *editor = COMP_EDITOR (data);
- CompEditorPrivate *priv;
- GList *l;
-
- priv = editor->priv;
-
- for (l = priv->pages; l != NULL; l = l->next)
- if (obj != l->data)
- comp_editor_page_set_summary (l->data, summary);
-
- if (!priv->warned && priv->existing_org && !priv->user_org) {
- e_notice (priv->notebook, GTK_MESSAGE_INFO,
- _("Changes made to this item may be discarded if an update arrives"));
- priv->warned = TRUE;
- }
-
- set_title_from_string (editor, summary);
-}
-
-static void
-page_dates_changed_cb (GtkObject *obj,
+page_dates_changed_cb (CompEditor *editor,
CompEditorPageDates *dates,
- gpointer data)
+ CompEditorPage *page)
{
- CompEditor *editor = COMP_EDITOR (data);
- CompEditorPrivate *priv;
+ CompEditorPrivate *priv = editor->priv;
GList *l;
- priv = editor->priv;
-
for (l = priv->pages; l != NULL; l = l->next)
- if (obj != l->data)
+ if (page != (CompEditorPage *) l->data)
comp_editor_page_set_dates (l->data, dates);
if (!priv->warned && priv->existing_org && !priv->user_org) {
diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h
index 4c445dfe5f..786c937d98 100644
--- a/calendar/gui/dialogs/comp-editor.h
+++ b/calendar/gui/dialogs/comp-editor.h
@@ -22,42 +22,56 @@
#define COMP_EDITOR_H
#include <gtk/gtk.h>
-#include <bonobo/bonobo-window.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-widget.h>
#include <libecal/e-cal.h>
#include "../itip-utils.h"
#include "comp-editor-page.h"
-G_BEGIN_DECLS
-
-
+/* Standard GObject macros */
+#define TYPE_COMP_EDITOR \
+ (comp_editor_get_type ())
+#define COMP_EDITOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), TYPE_COMP_EDITOR, CompEditor))
+#define COMP_EDITOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), TYPE_COMP_EDITOR, CompEditorClass))
+#define IS_COMP_EDITOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), TYPE_COMP_EDITOR))
+#define IS_COMP_EDITOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), TYPE_COMP_EDITOR))
+#define COMP_EDITOR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), TYPE_COMP_EDITOR, CompEditorClass))
-#define TYPE_COMP_EDITOR (comp_editor_get_type ())
-#define COMP_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COMP_EDITOR, CompEditor))
-#define COMP_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COMP_EDITOR, CompEditorClass))
-#define IS_COMP_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COMP_EDITOR))
-#define IS_COMP_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COMP_EDITOR))
+G_BEGIN_DECLS
+typedef struct _CompEditor CompEditor;
+typedef struct _CompEditorClass CompEditorClass;
typedef struct _CompEditorPrivate CompEditorPrivate;
-typedef struct {
- BonoboWindow object;
-
- /* Private data */
+struct _CompEditor {
+ GtkWindow parent;
CompEditorPrivate *priv;
- BonoboUIComponent *uic;
-} CompEditor;
+};
-typedef struct {
- BonoboWindowClass parent_class;
+struct _CompEditorClass {
+ GtkWindowClass parent_class;
+ const gchar *help_section;
/* Virtual functions */
- void (* set_e_cal) (CompEditor *page, ECal *client);
- void (* edit_comp) (CompEditor *page, ECalComponent *comp);
- void (* object_created) (CompEditor *page);
- gboolean (* send_comp) (CompEditor *page, ECalComponentItipMethod method);
-} CompEditorClass;
+ void (*edit_comp) (CompEditor *page, ECalComponent *comp);
+ void (*object_created) (CompEditor *page);
+ gboolean (*send_comp) (CompEditor *page, ECalComponentItipMethod method);
+
+ void (*show_categories) (CompEditor *editor, gboolean visible);
+ void (*show_role) (CompEditor *editor, gboolean visible);
+ void (*show_rsvp) (CompEditor *editor, gboolean visible);
+ void (*show_status) (CompEditor *editor, gboolean visible);
+ void (*show_time_zone) (CompEditor *editor, gboolean visible);
+ void (*show_type) (CompEditor *editor, gboolean visible);
+};
typedef enum {
COMP_EDITOR_NEW_ITEM = 1<<0,
@@ -68,55 +82,69 @@ typedef enum {
COMP_EDITOR_IS_SHARED = 1 << 5
} CompEditorFlags;
-GType comp_editor_get_type (void);
-void comp_editor_set_changed (CompEditor *editor,
- gboolean changed);
-gboolean comp_editor_get_changed (CompEditor *editor);
-void comp_editor_set_needs_send (CompEditor *editor,
- gboolean needs_send);
-gboolean comp_editor_get_needs_send (CompEditor *editor);
-void comp_editor_set_existing_org (CompEditor *editor,
- gboolean existing_org);
-gboolean comp_editor_get_existing_org (CompEditor *editor);
-void comp_editor_set_user_org (CompEditor *editor,
- gboolean user_org);
-gboolean comp_editor_get_user_org (CompEditor *editor);
-void comp_editor_set_group_item (CompEditor *editor,
- gboolean is_group_item);
-gboolean comp_editor_get_group_item (CompEditor *editor);
-void comp_editor_append_page (CompEditor *editor,
- CompEditorPage *page,
- const char *label,
- gboolean add);
-void comp_editor_remove_page (CompEditor *editor,
- CompEditorPage *page);
-void comp_editor_show_page (CompEditor *editor,
- CompEditorPage *page);
-void comp_editor_set_e_cal (CompEditor *editor,
- ECal *client);
-void comp_editor_set_help_section (CompEditor *editor,
- const char *section);
-ECal *comp_editor_get_e_cal (CompEditor *editor);
-void comp_editor_edit_comp (CompEditor *ee,
- ECalComponent *comp);
-ECalComponent *comp_editor_get_comp (CompEditor *editor);
-ECalComponent *comp_editor_get_current_comp (CompEditor *editor,
- gboolean *correct);
-gboolean comp_editor_save_comp (CompEditor *editor,
- gboolean send);
-void comp_editor_delete_comp (CompEditor *editor);
-gboolean comp_editor_send_comp (CompEditor *editor,
- ECalComponentItipMethod method);
-GSList *comp_editor_get_mime_attach_list (CompEditor *editor);
-gboolean comp_editor_close (CompEditor *editor);
-void comp_editor_focus (CompEditor *editor);
-
-void comp_editor_notify_client_changed (CompEditor *editor, ECal *client);
-
-void comp_editor_sensitize_attachment_bar (CompEditor *editor, gboolean set);
-void comp_editor_set_flags (CompEditor *editor, CompEditorFlags flags);
-CompEditorFlags comp_editor_get_flags (CompEditor *editor);
-
+GType comp_editor_get_type (void);
+void comp_editor_set_changed (CompEditor *editor,
+ gboolean changed);
+gboolean comp_editor_get_changed (CompEditor *editor);
+void comp_editor_set_needs_send (CompEditor *editor,
+ gboolean needs_send);
+gboolean comp_editor_get_needs_send (CompEditor *editor);
+void comp_editor_set_existing_org (CompEditor *editor,
+ gboolean existing_org);
+gboolean comp_editor_get_existing_org (CompEditor *editor);
+void comp_editor_set_user_org (CompEditor *editor,
+ gboolean user_org);
+gboolean comp_editor_get_user_org (CompEditor *editor);
+void comp_editor_set_group_item (CompEditor *editor,
+ gboolean is_group_item);
+gboolean comp_editor_get_group_item (CompEditor *editor);
+void comp_editor_set_classification (CompEditor *editor,
+ ECalComponentClassification classification);
+ECalComponentClassification
+ comp_editor_get_classification (CompEditor *editor);
+void comp_editor_set_summary (CompEditor *editor,
+ const gchar *summary);
+const gchar * comp_editor_get_summary (CompEditor *editor);
+void comp_editor_append_page (CompEditor *editor,
+ CompEditorPage *page,
+ const gchar *label,
+ gboolean add);
+void comp_editor_remove_page (CompEditor *editor,
+ CompEditorPage *page);
+void comp_editor_show_page (CompEditor *editor,
+ CompEditorPage *page);
+void comp_editor_set_client (CompEditor *editor,
+ ECal *client);
+ECal * comp_editor_get_client (CompEditor *editor);
+void comp_editor_edit_comp (CompEditor *ee,
+ ECalComponent *comp);
+ECalComponent * comp_editor_get_comp (CompEditor *editor);
+ECalComponent * comp_editor_get_current_comp (CompEditor *editor,
+ gboolean *correct);
+gboolean comp_editor_save_comp (CompEditor *editor,
+ gboolean send);
+void comp_editor_delete_comp (CompEditor *editor);
+gboolean comp_editor_send_comp (CompEditor *editor,
+ ECalComponentItipMethod method);
+GSList * comp_editor_get_mime_attach_list(CompEditor *editor);
+gboolean comp_editor_close (CompEditor *editor);
+
+
+void comp_editor_sensitize_attachment_bar
+ (CompEditor *editor,
+ gboolean set);
+void comp_editor_set_flags (CompEditor *editor,
+ CompEditorFlags flags);
+CompEditorFlags
+ comp_editor_get_flags (CompEditor *editor);
+GtkUIManager * comp_editor_get_ui_manager (CompEditor *editor);
+GtkAction * comp_editor_get_action (CompEditor *editor,
+ const gchar *action_name);
+GtkActionGroup *
+ comp_editor_get_action_group (CompEditor *editor,
+ const gchar *group_name);
+GtkWidget * comp_editor_get_managed_widget (CompEditor *editor,
+ const gchar *widget_path);
G_END_DECLS
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index 4b739565b7..1547a67f0e 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -30,16 +30,22 @@
#include <string.h>
#include <glade/glade.h>
#include <glib/gi18n.h>
+
#include <misc/e-dateedit.h>
#include <e-util/e-icon-factory.h>
+#include <e-util/e-plugin-ui.h>
#include <e-util/e-util-private.h>
#include <evolution-shell-component-utils.h>
+
#include "event-page.h"
#include "recurrence-page.h"
#include "schedule-page.h"
#include "cancel-comp.h"
#include "event-editor.h"
-#include "../calendar-config.h"
+
+#define EVENT_EDITOR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), TYPE_EVENT_EDITOR, EventEditorPrivate))
struct _EventEditorPrivate {
EventPage *event_page;
@@ -49,620 +55,465 @@ struct _EventEditorPrivate {
GtkWidget *sched_window;
EMeetingStore *model;
- gboolean is_meeting;
gboolean meeting_shown;
gboolean updating;
};
-
+/* Extends the UI definition in CompEditor */
+static const gchar *ui =
+"<ui>"
+" <menubar action='main-menu'>"
+" <menu action='view-menu'>"
+" <menuitem action='view-type'/>"
+" <menuitem action='view-status'/>"
+" <menuitem action='view-role'/>"
+" <menuitem action='view-rsvp'/>"
+" <separator/>"
+" <menuitem action='view-time-zone'/>"
+" <menuitem action='view-categories'/>"
+" </menu>"
+" <menu action='insert-menu'>"
+" <menuitem action='send-options'/>"
+" </menu>"
+" <menu action='options-menu'>"
+" <menuitem action='alarms'/>"
+" <menuitem action='show-time-busy'/>"
+" <menuitem action='all-day-event'/>"
+" <menu action='classification-menu'>"
+" <menuitem action='classify-public'/>"
+" <menuitem action='classify-private'/>"
+" <menuitem action='classify-confidential'/>"
+" </menu>"
+" <menuitem action='recurrence'/>"
+" <menuitem action='free-busy'/>"
+" </menu>"
+" </menubar>"
+" <toolbar name='main-toolbar'>"
+" <toolitem action='alarms'/>"
+" <toolitem action='all-day-event'/>"
+" <toolitem action='recurrence'/>"
+" <toolitem action='free-busy'/>"
+" </toolbar>"
+"</ui>";
-static void event_editor_set_e_cal (CompEditor *editor, ECal *client);
static void event_editor_edit_comp (CompEditor *editor, ECalComponent *comp);
static gboolean event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method);
-static void event_editor_finalize (GObject *object);
-
-static void model_row_change_insert_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data);
-static void model_row_delete_cb (GtkTreeModel *model, GtkTreePath *path, gpointer data);
-static gboolean window_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data);
-static void create_schedule_page (EventEditor *ee);
G_DEFINE_TYPE (EventEditor, event_editor, TYPE_COMP_EDITOR)
-/* Class initialization function for the event editor */
static void
-event_editor_class_init (EventEditorClass *klass)
+create_schedule_page (CompEditor *editor)
{
- GObjectClass *gobject_class;
- CompEditorClass *editor_class;
+ EventEditorPrivate *priv;
+ ENameSelector *name_selector;
+ CompEditorPage *page;
- gobject_class = (GObjectClass *) klass;
- editor_class = (CompEditorClass *) klass;
+ priv = EVENT_EDITOR_GET_PRIVATE (editor);
- editor_class->set_e_cal = event_editor_set_e_cal;
- editor_class->edit_comp = event_editor_edit_comp;
- editor_class->send_comp = event_editor_send_comp;
+ priv->sched_window = gtk_dialog_new_with_buttons (
+ _("Free/Busy"), GTK_WINDOW (editor), GTK_DIALOG_MODAL,
+ GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
- gobject_class->finalize = event_editor_finalize;
-}
+ g_signal_connect (
+ priv->sched_window, "response",
+ G_CALLBACK (gtk_widget_hide), NULL);
+ g_signal_connect (
+ priv->sched_window, "delete-event",
+ G_CALLBACK (gtk_widget_hide_on_delete), NULL);
-static void
-init_widgets (EventEditor *ee)
-{
- EventEditorPrivate *priv;
+ priv->sched_page = schedule_page_new (priv->model, editor);
+ page = COMP_EDITOR_PAGE (priv->sched_page);
+ g_object_ref_sink (priv->sched_page);
+ gtk_container_add (
+ GTK_CONTAINER (GTK_DIALOG (priv->sched_window)->vbox),
+ comp_editor_page_get_widget (page));
- priv = ee->priv;
+ name_selector = event_page_get_name_selector (priv->event_page);
+ schedule_page_set_name_selector (priv->sched_page, name_selector);
- g_signal_connect((priv->model), "row_changed",
- G_CALLBACK (model_row_change_insert_cb), ee);
- g_signal_connect((priv->model), "row_inserted",
- G_CALLBACK (model_row_change_insert_cb), ee);
- g_signal_connect((priv->model), "row_deleted",
- G_CALLBACK (model_row_delete_cb), ee);
-}
+ comp_editor_append_page (editor, page, NULL, FALSE);
+ schedule_page_update_free_busy (priv->sched_page);
-static void
-client_changed_cb (CompEditorPage *page, ECal *client, gpointer user_data)
-{
- //set_menu_sens (EVENT_EDITOR (user_data));
+ gtk_widget_show_all (priv->sched_window);
}
static void
-menu_view_role_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+action_alarms_cb (GtkAction *action,
+ EventEditor *editor)
{
- EventEditor *ee = (EventEditor *) user_data;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
- event_page_set_view_role (ee->priv->event_page, atoi(state));
- calendar_config_set_show_role (atoi(state));
+ event_page_show_alarm (editor->priv->event_page);
}
static void
-menu_view_status_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+action_all_day_event_cb (GtkToggleAction *action,
+ EventEditor *editor)
{
- EventEditor *ee = (EventEditor *) user_data;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
+ gboolean active;
- event_page_set_view_status (ee->priv->event_page, atoi(state));
- calendar_config_set_show_status (atoi(state));
+ active = gtk_toggle_action_get_active (action);
+ event_page_set_all_day_event (editor->priv->event_page, active);
}
static void
-menu_view_type_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+action_free_busy_cb (GtkAction *action,
+ EventEditor *editor)
{
- EventEditor *ee = (EventEditor *) user_data;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
- event_page_set_view_type (ee->priv->event_page, atoi(state));
- calendar_config_set_show_type (atoi(state));
+ if (editor->priv->sched_window == NULL)
+ create_schedule_page (COMP_EDITOR (editor));
+ else
+ gtk_widget_show (editor->priv->sched_window);
}
static void
-menu_view_rsvp_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+action_recurrence_cb (GtkAction *action,
+ EventEditor *editor)
{
- EventEditor *ee = (EventEditor *) user_data;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
- event_page_set_view_rsvp (ee->priv->event_page, atoi(state));
- calendar_config_set_show_rsvp (atoi(state));
+ gtk_widget_show (editor->priv->recur_window);
}
static void
-menu_action_alarm_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+action_send_options_cb (GtkAction *action,
+ EventEditor *editor)
{
- EventEditor *ee = (EventEditor *) user_data;
-
- event_page_show_alarm (ee->priv->event_page);
+ event_page_sendoptions_clicked_cb (editor->priv->event_page);
}
static void
-menu_show_time_busy_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+action_show_time_busy_cb (GtkToggleAction *action,
+ EventEditor *editor)
{
- EventEditor *ee = (EventEditor *) user_data;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
+ gboolean active;
- event_page_set_show_time_busy (ee->priv->event_page, atoi(state));
+ active = gtk_toggle_action_get_active (action);
+ event_page_set_show_time_busy (editor->priv->event_page, active);
}
-static void
-menu_all_day_event_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
-{
- EventEditor *ee = (EventEditor *) user_data;
+static GtkActionEntry event_entries[] = {
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
- event_page_set_all_day_event (ee->priv->event_page, atoi(state));
-}
+ { "alarms",
+ "appointment-soon",
+ N_("_Alarms"),
+ NULL,
+ N_("Click here to set or unset alarms for this event"),
+ G_CALLBACK (action_alarms_cb) },
-static void
-menu_show_time_zone_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
-{
- EventEditor *ee = (EventEditor *) user_data;
+ { "recurrence",
+ "stock_task-recurring",
+ N_("_Recurrence"),
+ NULL,
+ N_("Make this a recurring event"),
+ G_CALLBACK (action_recurrence_cb) },
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
- event_page_set_show_timezone (ee->priv->event_page, atoi(state));
- calendar_config_set_show_timezone (atoi(state));
-}
+ { "send-options",
+ NULL,
+ N_("Send Options"),
+ NULL,
+ N_("Insert advanced send options"),
+ G_CALLBACK (action_send_options_cb) }
+};
-static void
-menu_show_categories_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
-{
- EventEditor *ee = (EventEditor *) user_data;
+static GtkToggleActionEntry event_toggle_entries[] = {
+
+ { "all-day-event",
+ "stock_new-24h-appointment",
+ N_("All _Day Event"),
+ NULL,
+ N_("Toggles whether to have All Day Event"),
+ G_CALLBACK (action_all_day_event_cb),
+ FALSE },
+
+ { "show-time-busy",
+ NULL,
+ N_("Show Time as _Busy"),
+ NULL,
+ N_("Toggles whether to show time as busy"),
+ G_CALLBACK (action_show_time_busy_cb),
+ FALSE }
+};
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
+static GtkActionEntry meeting_entries[] = {
- event_page_set_show_categories (ee->priv->event_page, atoi(state));
- calendar_config_set_show_categories (atoi(state));
-}
+ { "free-busy",
+ "query-free-busy",
+ N_("_Free/Busy"),
+ NULL,
+ N_("Query free / busy information for the attendees"),
+ G_CALLBACK (action_free_busy_cb) }
+};
static void
-menu_class_public_cb (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+event_editor_client_changed_cb (EventEditor *ee)
{
- EventEditor *ee = (EventEditor *) user_data;
- if (state[0] == '0')
- return;
-
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (ee->priv->event_page));
+ ECal *client;
- event_page_set_classification (ee->priv->event_page, E_CAL_COMPONENT_CLASS_PUBLIC);
+ client = comp_editor_get_client (COMP_EDITOR (ee));
+ e_meeting_store_set_e_cal (ee->priv->model, client);
}
static void
-menu_class_private_cb (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+event_editor_model_changed_cb (EventEditor *ee)
{
- EventEditor *ee = (EventEditor *) user_data;
- if (state[0] == '0')
- return;
-
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (ee->priv->event_page));
-
- event_page_set_classification (ee->priv->event_page, E_CAL_COMPONENT_CLASS_PRIVATE);
+ if (!ee->priv->updating) {
+ comp_editor_set_changed (COMP_EDITOR (ee), TRUE);
+ comp_editor_set_needs_send (COMP_EDITOR (ee), TRUE);
+ }
}
-static void
-menu_class_confidential_cb (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+static GObject *
+event_editor_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties)
{
- EventEditor *ee = (EventEditor *) user_data;
- if (state[0] == '0')
- return;
-
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (ee->priv->event_page));
-
- event_page_set_classification (ee->priv->event_page, E_CAL_COMPONENT_CLASS_CONFIDENTIAL);
-}
+ GObject *object;
+ CompEditor *editor;
+ CompEditorFlags flags;
+ CompEditorPage *page;
+ EventEditorPrivate *priv;
+ GtkActionGroup *action_group;
+ ECal *client;
+ gboolean is_meeting;
-static void
-menu_action_recurrence_cb (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
-{
- EventEditor *ee = (EventEditor *) user_data;
+ /* Chain up to parent's constructor() method. */
+ object = G_OBJECT_CLASS (event_editor_parent_class)->constructor (
+ type, n_construct_properties, construct_properties);
- gtk_widget_show (ee->priv->recur_window);
-}
+ editor = COMP_EDITOR (object);
+ priv = EVENT_EDITOR_GET_PRIVATE (object);
-static void
-menu_action_freebusy_cb (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
-{
- EventEditor *ee = (EventEditor *) user_data;
+ client = comp_editor_get_client (editor);
+ flags = comp_editor_get_flags (editor);
+ action_group = comp_editor_get_action_group (editor, "coordinated");
- if (!ee->priv->sched_window)
- create_schedule_page (ee);
- else
- gtk_widget_show (ee->priv->sched_window);
-}
+ is_meeting = flags & COMP_EDITOR_MEETING;
-static void
-menu_action_alarm_cmd (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- EventEditor *ee = (EventEditor *) data;
+ gtk_action_group_set_visible (action_group, is_meeting);
- event_page_show_alarm (ee->priv->event_page);
-}
+ priv->event_page = event_page_new (priv->model, editor);
+ g_object_ref_sink (priv->event_page);
+ comp_editor_append_page (
+ editor, COMP_EDITOR_PAGE (priv->event_page),
+ _("Appoint_ment"), TRUE);
+
+ priv->recur_window = gtk_dialog_new_with_buttons (
+ _("Recurrence"), GTK_WINDOW (editor), GTK_DIALOG_MODAL,
+ GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
+ g_signal_connect (
+ priv->recur_window, "response",
+ G_CALLBACK (gtk_widget_hide), NULL);
+ g_signal_connect (
+ priv->recur_window, "delete-event",
+ G_CALLBACK(gtk_widget_hide_on_delete), NULL);
+
+ priv->recur_page = recurrence_page_new (editor);
+ page = COMP_EDITOR_PAGE (priv->recur_page);
+ g_object_ref_sink (priv->recur_page);
+ gtk_container_add (
+ GTK_CONTAINER ((GTK_DIALOG (priv->recur_window)->vbox)),
+ comp_editor_page_get_widget (page));
+ gtk_widget_show_all (gtk_bin_get_child (GTK_BIN (priv->recur_window)));
+ comp_editor_append_page (editor, page, NULL, FALSE);
-static void
-menu_all_day_event_cmd (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- /* TODO
- EventEditor *ee = (EventEditor *) data;
+ if (is_meeting) {
- event_page_set_all_day_event (ee->priv->event_page, atoi(state));*/
-}
+ if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS))
+ event_page_show_options (priv->event_page);
-static void
-menu_show_time_zone_cmd (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- /* TODO
- EventEditor *ee = (EventEditor *) data;
+ comp_editor_set_group_item (editor, TRUE);
+ if (!((flags & COMP_EDITOR_USER_ORG) || (flags & COMP_EDITOR_DELEGATE)|| (flags & COMP_EDITOR_NEW_ITEM))) {
+ GtkAction *action;
- event_page_set_show_timezone (ee->priv->event_page, atoi(state));
- calendar_config_set_show_timezone (atoi(state)); */
-}
+ action = comp_editor_get_action (editor, "free-busy");
+ gtk_action_set_visible (action, FALSE);
+ }
-static void
-menu_action_recurrence_cmd (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- EventEditor *ee = (EventEditor *) data;
+ event_page_set_meeting (priv->event_page, TRUE);
+ priv->meeting_shown=TRUE;
+ }
- gtk_widget_show (ee->priv->recur_window);
+ return object;
}
static void
-create_schedule_page (EventEditor *ee)
+event_editor_dispose (GObject *object)
{
- ENameSelector *name_selector;
EventEditorPrivate *priv;
- ECal *ecal = NULL;
- priv = ee->priv;
+ priv = EVENT_EDITOR_GET_PRIVATE (object);
- priv->sched_window = gtk_dialog_new_with_buttons (_("Free/Busy"),
- (GtkWindow *) ee, GTK_DIALOG_MODAL,
- "gtk-close", GTK_RESPONSE_CLOSE,
- NULL);
- priv->sched_page = schedule_page_new (priv->model);
- g_object_ref_sink (priv->sched_page);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG(priv->sched_window)->vbox), comp_editor_page_get_widget (COMP_EDITOR_PAGE (priv->sched_page)));
+ if (priv->event_page) {
+ g_object_unref (priv->event_page);
+ priv->event_page = NULL;
+ }
- g_signal_connect (priv->sched_window, "response", G_CALLBACK(gtk_widget_hide), NULL);
- g_signal_connect ((GtkWidget *) priv->sched_window, "delete-event", G_CALLBACK(window_delete_event), NULL);
- name_selector = event_page_get_name_selector (priv->event_page);
- schedule_page_set_name_selector (priv->sched_page, name_selector);
+ if (priv->recur_page) {
+ g_object_unref (priv->recur_page);
+ priv->recur_page = NULL;
+ }
- ecal = comp_editor_get_e_cal (COMP_EDITOR (ee));
- comp_editor_page_set_e_cal (COMP_EDITOR_PAGE (priv->sched_page), ecal);
- comp_editor_append_page (COMP_EDITOR (ee), COMP_EDITOR_PAGE (priv->sched_page), NULL, FALSE);
- schedule_page_update_free_busy (priv->sched_page);
+ if (priv->sched_page) {
+ g_object_unref (priv->sched_page);
+ priv->sched_page = NULL;
+ }
- gtk_widget_show_all (priv->sched_window);
+ if (priv->model) {
+ g_object_unref (priv->model);
+ priv->model = NULL;
+ }
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (event_editor_parent_class)->dispose (object);
}
static void
-menu_action_freebusy_cmd (BonoboUIComponent *uic,
- void *data,
- const char *path)
+event_editor_show_categories (CompEditor *editor,
+ gboolean visible)
{
- EventEditor *ee = (EventEditor *) data;
+ EventEditorPrivate *priv;
- if (!ee->priv->sched_window)
- create_schedule_page (ee);
- else
- gtk_widget_show (ee->priv->sched_window);
+ priv = EVENT_EDITOR_GET_PRIVATE (editor);
+
+ event_page_set_show_categories (priv->event_page, visible);
}
static void
-menu_insert_send_options_cmd (BonoboUIComponent *uic,
- void *data,
- const char *path)
+event_editor_show_role (CompEditor *editor,
+ gboolean visible)
{
- EventEditor *ee = (EventEditor *) data;
+ EventEditorPrivate *priv;
- event_page_sendoptions_clicked_cb (ee->priv->event_page);
+ priv = EVENT_EDITOR_GET_PRIVATE (editor);
+
+ event_page_set_view_role (priv->event_page, visible);
}
-static BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("ActionAlarm", menu_action_alarm_cmd),
- BONOBO_UI_VERB ("ActionAllDayEvent", menu_all_day_event_cmd),
- BONOBO_UI_VERB ("ViewTimeZone", menu_show_time_zone_cmd),
- BONOBO_UI_VERB ("ActionRecurrence", menu_action_recurrence_cmd),
- BONOBO_UI_VERB ("ActionFreeBusy", menu_action_freebusy_cmd),
- BONOBO_UI_VERB ("InsertSendOptions", menu_insert_send_options_cmd),
+static void
+event_editor_show_rsvp (CompEditor *editor,
+ gboolean visible)
+{
+ EventEditorPrivate *priv;
- BONOBO_UI_VERB_END
-};
+ priv = EVENT_EDITOR_GET_PRIVATE (editor);
-static EPixmap pixmaps[] = {
- /* NOTE: If adding removing elements in this array, make sure
- * the indexes of the two elements where the pathname to the
- * icons is filled in at run-time in event_editor_init() are
- * updated, too.
- */
- E_PIXMAP ("/commands/ActionAlarm", "stock_alarm", E_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ActionRecurrence", "stock_task-recurring", E_ICON_SIZE_MENU),
-
- E_PIXMAP ("/Toolbar/ActionAlarm", "stock_alarm", E_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/ActionAllDayEvent", "stock_new-24h-appointment", E_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/ViewTimeZone", "stock_timezone", E_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/ActionRecurrence", "stock_task-recurring", E_ICON_SIZE_LARGE_TOOLBAR),
-
- /* These two will have an absolute path to the png file filled
- * in at run-time, see event_editor_init().
- */
- E_PIXMAP ("/Toolbar/ActionFreeBusy", NULL, E_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/commands/ActionFreeBusy", NULL, E_ICON_SIZE_MENU),
- E_PIXMAP_END
-};
+ event_page_set_view_rsvp (priv->event_page, visible);
+}
-/* Object initialization function for the event editor */
static void
-event_editor_init (EventEditor *ee)
+event_editor_show_status (CompEditor *editor,
+ gboolean visible)
{
EventEditorPrivate *priv;
- CompEditor *editor = COMP_EDITOR(ee);
- gboolean status;
- char *xmlfile;
-
- priv = g_new0 (EventEditorPrivate, 1);
- ee->priv = priv;
-
- priv->model = E_MEETING_STORE (e_meeting_store_new ());
- priv->meeting_shown = TRUE;
- priv->updating = FALSE;
- priv->is_meeting = FALSE;
-
- bonobo_ui_component_freeze (editor->uic, NULL);
-
- bonobo_ui_component_add_verb_list_with_data (editor->uic, verbs, ee);
-
- xmlfile = g_build_filename (EVOLUTION_UIDIR,
- "evolution-event-editor.xml",
- NULL);
- bonobo_ui_util_set_ui (editor->uic, PREFIX,
- xmlfile,
- "evolution-event-editor", NULL);
- g_free (xmlfile);
-
- /* Hide send options */
- bonobo_ui_component_set_prop (
- editor->uic, "/commands/InsertSendOptions",
- "hidden", "1", NULL);
-
- /* Show hide the status fields */
- status = calendar_config_get_show_status ();
- bonobo_ui_component_set_prop (
- editor->uic, "/commands/ViewStatus",
- "state", status ? "1" : "0", NULL);
- bonobo_ui_component_add_listener (
- editor->uic, "ViewStatus",
- menu_view_status_cb, editor);
-
- /* Show hide the type fields */
- status = calendar_config_get_show_type ();
- bonobo_ui_component_set_prop (
- editor->uic, "/commands/ViewType",
- "state", status ? "1" : "0", NULL);
- bonobo_ui_component_add_listener (
- editor->uic, "ViewType",
- menu_view_type_cb, editor);
-
- /* Show hide the role fields */
- status = calendar_config_get_show_role ();
- bonobo_ui_component_set_prop (
- editor->uic, "/commands/ViewRole",
- "state", status ? "1" : "0", NULL);
- bonobo_ui_component_add_listener (
- editor->uic, "ViewRole",
- menu_view_role_cb, editor);
-
- /* Show hide the rsvp fields */
- status = calendar_config_get_show_rsvp ();
- bonobo_ui_component_set_prop (
- editor->uic, "/commands/ViewRSVP",
- "state", status ? "1" : "0", NULL);
- bonobo_ui_component_add_listener (
- editor->uic, "ViewRSVP",
- menu_view_rsvp_cb, editor);
-
- bonobo_ui_component_add_listener (
- editor->uic, "ActionAlarm",
- menu_action_alarm_cb, editor);
-
- bonobo_ui_component_add_listener (
- editor->uic, "ActionAllDayEvent",
- menu_all_day_event_cb, editor);
-
- bonobo_ui_component_add_listener (
- editor->uic, "ActionShowTimeBusy",
- menu_show_time_busy_cb, editor);
-
- status = calendar_config_get_show_timezone ();
- bonobo_ui_component_set_prop (
- editor->uic, "/commands/ViewTimeZone",
- "state", status ? "1" : "0", NULL);
- bonobo_ui_component_add_listener (
- editor->uic, "ViewTimeZone",
- menu_show_time_zone_cb, editor);
-
- status = calendar_config_get_show_categories ();
- bonobo_ui_component_set_prop (
- editor->uic, "/commands/ViewCategories",
- "state", status ? "1" : "0", NULL);
- bonobo_ui_component_add_listener (
- editor->uic, "ViewCategories",
- menu_show_categories_cb, editor);
-
- bonobo_ui_component_set_prop (
- editor->uic, "/commands/ActionClassPublic",
- "state", "1", NULL);
- bonobo_ui_component_add_listener (
- editor->uic, "ActionClassPublic",
- menu_class_public_cb, editor);
- bonobo_ui_component_add_listener (
- editor->uic, "ActionClassPrivate",
- menu_class_private_cb, editor);
- bonobo_ui_component_add_listener (
- editor->uic, "ActionClassConfidential",
- menu_class_confidential_cb, editor);
-
- bonobo_ui_component_add_listener (
- editor->uic, "ActionRecurrence",
- menu_action_recurrence_cb, editor);
- bonobo_ui_component_add_listener (
- editor->uic, "ActionFreeBusy",
- menu_action_freebusy_cb, editor);
-
- /* NOTE: Make sure the 6 and 7 below correspond to the correct
- * elements in the pixmaps array.
- */
- if (!pixmaps[6].name) {
- pixmaps[6].name = g_build_filename (EVOLUTION_ICONSDIR, "query-free-busy.png", NULL);
- pixmaps[7].name = g_build_filename (EVOLUTION_ICONSDIR, "query-free-busy.png", NULL);
- }
- e_pixmaps_update (editor->uic, pixmaps);
- bonobo_ui_component_thaw (editor->uic, NULL);
+ priv = EVENT_EDITOR_GET_PRIVATE (editor);
- comp_editor_set_help_section (COMP_EDITOR (ee), "usage-calendar-apts");
+ event_page_set_view_status (priv->event_page, visible);
}
-/* Handler for the delete event. It hides the window without destroying it.
- Connected to the recur dialog and Free busy dialog */
-static gboolean
-window_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data)
+static void
+event_editor_show_time_zone (CompEditor *editor,
+ gboolean visible)
{
- gtk_widget_hide (widget);
+ EventEditorPrivate *priv;
+
+ priv = EVENT_EDITOR_GET_PRIVATE (editor);
- return TRUE;
+ event_page_set_show_timezone (priv->event_page, visible);
}
-EventEditor *
-event_editor_construct (EventEditor *ee, ECal *client)
+static void
+event_editor_show_type (CompEditor *editor,
+ gboolean visible)
{
EventEditorPrivate *priv;
- CompEditor *editor = COMP_EDITOR (ee);
- guint32 flags = comp_editor_get_flags (editor);
-
- priv = ee->priv;
- priv->event_page = event_page_new (priv->model, client, COMP_EDITOR(ee)->uic);
- g_object_ref_sink (priv->event_page);
- comp_editor_append_page (COMP_EDITOR (ee),
- COMP_EDITOR_PAGE (priv->event_page),
- _("Appoint_ment"), TRUE);
- g_signal_connect (G_OBJECT (priv->event_page), "client_changed",
- G_CALLBACK (client_changed_cb), ee);
-
- priv->recur_window = gtk_dialog_new_with_buttons (_("Recurrence"),
- (GtkWindow *) ee, GTK_DIALOG_MODAL,
- "gtk-close", GTK_RESPONSE_CLOSE,
- NULL);
- g_signal_connect (priv->recur_window, "response", G_CALLBACK (gtk_widget_hide), NULL);
- g_signal_connect ((GtkWidget *) priv->recur_window, "delete-event", G_CALLBACK(window_delete_event), NULL);
- priv->recur_page = recurrence_page_new ();
- g_object_ref_sink (priv->recur_page);
- gtk_container_add ((GtkContainer *) (GTK_DIALOG (priv->recur_window)->vbox),
- comp_editor_page_get_widget (COMP_EDITOR_PAGE (priv->recur_page)));
- gtk_widget_show_all (gtk_bin_get_child (GTK_BIN (priv->recur_window)));
- comp_editor_append_page (COMP_EDITOR (ee), COMP_EDITOR_PAGE (priv->recur_page), NULL, FALSE);
- if (priv->is_meeting) {
-
- if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS))
- event_page_show_options (priv->event_page);
+ priv = EVENT_EDITOR_GET_PRIVATE (editor);
- comp_editor_set_group_item (COMP_EDITOR (ee), TRUE);
- if (!((flags & COMP_EDITOR_USER_ORG) || (flags & COMP_EDITOR_DELEGATE)|| (flags & COMP_EDITOR_NEW_ITEM)))
- bonobo_ui_component_set_prop (editor->uic, "/commands/ActionFreeBusy", "hidden", "1", NULL);
+ event_page_set_view_type (priv->event_page, visible);
+}
- event_page_set_meeting (priv->event_page, TRUE);
- priv->meeting_shown=TRUE;
- } else {
- bonobo_ui_component_set_prop (editor->uic, "/commands/ActionFreeBusy", "hidden", "1", NULL);
- bonobo_ui_component_set_prop (editor->uic, "/commands/ViewAttendee", "hidden", "1", NULL);
- bonobo_ui_component_set_prop (editor->uic, "/commands/ViewRole", "hidden", "1", NULL);
- bonobo_ui_component_set_prop (editor->uic, "/commands/ViewRSVP", "hidden", "1", NULL);
- bonobo_ui_component_set_prop (editor->uic, "/commands/ViewType", "hidden", "1", NULL);
- bonobo_ui_component_set_prop (editor->uic, "/commands/ViewStatus", "hidden", "1", NULL);
- bonobo_ui_component_set_prop (editor->uic, "/menu/View/AttendeeOptions/timezonesep", "hidden", "1", NULL);
- }
+static void
+event_editor_class_init (EventEditorClass *class)
+{
+ GObjectClass *object_class;
+ CompEditorClass *editor_class;
- comp_editor_set_e_cal (COMP_EDITOR (ee), client);
+ g_type_class_add_private (class, sizeof (EventEditorPrivate));
- init_widgets (ee);
- gtk_window_set_default_size (GTK_WINDOW (ee), 300, 225);
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructor = event_editor_constructor;
+ object_class->dispose = event_editor_dispose;
- return ee;
+ editor_class = COMP_EDITOR_CLASS (class);
+ editor_class->help_section = "usage-calendar-apts";
+ editor_class->edit_comp = event_editor_edit_comp;
+ editor_class->send_comp = event_editor_send_comp;
+ editor_class->show_categories = event_editor_show_categories;
+ editor_class->show_role = event_editor_show_role;
+ editor_class->show_rsvp = event_editor_show_rsvp;
+ editor_class->show_status = event_editor_show_status;;
+ editor_class->show_time_zone = event_editor_show_time_zone;
+ editor_class->show_type = event_editor_show_type;
}
static void
-event_editor_set_e_cal (CompEditor *editor, ECal *client)
+event_editor_init (EventEditor *ee)
{
- EventEditor *ee;
- EventEditorPrivate *priv;
+ CompEditor *editor = COMP_EDITOR (ee);
+ GtkUIManager *manager;
+ GtkActionGroup *action_group;
+ GtkAction *action;
+ GError *error = NULL;
+
+ ee->priv = EVENT_EDITOR_GET_PRIVATE (ee);
+ ee->priv->model = E_MEETING_STORE (e_meeting_store_new ());
+ ee->priv->meeting_shown = TRUE;
+ ee->priv->updating = FALSE;
+
+ action_group = comp_editor_get_action_group (editor, "individual");
+ gtk_action_group_add_actions (
+ action_group, event_entries,
+ G_N_ELEMENTS (event_entries), ee);
+ gtk_action_group_add_toggle_actions (
+ action_group, event_toggle_entries,
+ G_N_ELEMENTS (event_toggle_entries), ee);
+
+ action_group = comp_editor_get_action_group (editor, "coordinated");
+ gtk_action_group_add_actions (
+ action_group, meeting_entries,
+ G_N_ELEMENTS (meeting_entries), ee);
+
+ manager = comp_editor_get_ui_manager (editor);
+ gtk_ui_manager_add_ui_from_string (manager, ui, -1, &error);
+ e_plugin_ui_register_manager ("event-editor", manager, ee);
+
+ if (error != NULL) {
+ g_critical ("%s: %s", G_STRFUNC, error->message);
+ g_error_free (error);
+ }
+
+ /* Hide send options. */
+ action = comp_editor_get_action (editor, "send-options");
+ gtk_action_set_visible (action, FALSE);
- ee = EVENT_EDITOR (editor);
- priv = ee->priv;
+ g_signal_connect (
+ ee, "notify::client",
+ G_CALLBACK (event_editor_client_changed_cb), NULL);
- e_meeting_store_set_e_cal (priv->model, client);
+ g_signal_connect_swapped (
+ ee->priv->model, "row_changed",
+ G_CALLBACK (event_editor_model_changed_cb), ee);
+ g_signal_connect_swapped (
+ ee->priv->model, "row_inserted",
+ G_CALLBACK (event_editor_model_changed_cb), ee);
+ g_signal_connect_swapped (
+ ee->priv->model, "row_deleted",
+ G_CALLBACK (event_editor_model_changed_cb), ee);
- if (COMP_EDITOR_CLASS (event_editor_parent_class)->set_e_cal)
- COMP_EDITOR_CLASS (event_editor_parent_class)->set_e_cal (editor, client);
+ gtk_window_set_default_size (GTK_WINDOW (ee), 300, 225);
}
static void
event_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
{
- EventEditor *ee;
EventEditorPrivate *priv;
ECalComponentOrganizer organizer;
gboolean delegate;
@@ -670,8 +521,7 @@ event_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
ECal *client;
GSList *attendees = NULL;
- ee = EVENT_EDITOR (editor);
- priv = ee->priv;
+ priv = EVENT_EDITOR_GET_PRIVATE (editor);
priv->updating = TRUE;
delegate = (comp_editor_get_flags (COMP_EDITOR (editor)) & COMP_EDITOR_DELEGATE);
@@ -689,7 +539,7 @@ event_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
if (COMP_EDITOR_CLASS (event_editor_parent_class)->edit_comp)
COMP_EDITOR_CLASS (event_editor_parent_class)->edit_comp (editor, comp);
- client = comp_editor_get_e_cal (COMP_EDITOR (editor));
+ client = comp_editor_get_client (editor);
/* Get meeting related stuff */
e_cal_component_get_organizer (comp, &organizer);
@@ -703,7 +553,10 @@ event_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
user_email = itip_get_comp_attendee (comp, client);
if (!priv->meeting_shown) {
- bonobo_ui_component_set_prop (editor->uic, "/commands/ActionFreeBusy", "hidden", "0", NULL);
+ GtkAction *action;
+
+ action = comp_editor_get_action (editor, "free-busy");
+ gtk_action_set_visible (action, TRUE);
}
if (!(delegate && e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY))) {
@@ -756,7 +609,7 @@ event_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
}
e_cal_component_free_attendee_list (attendees);
- comp_editor_set_needs_send (COMP_EDITOR (ee), priv->meeting_shown && (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp)));
+ comp_editor_set_needs_send (editor, priv->meeting_shown && (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp)));
priv->updating = FALSE;
}
@@ -764,11 +617,10 @@ event_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
static gboolean
event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method)
{
- EventEditor *ee = EVENT_EDITOR (editor);
EventEditorPrivate *priv;
ECalComponent *comp = NULL;
- priv = ee->priv;
+ priv = EVENT_EDITOR_GET_PRIVATE (editor);
/* Don't cancel more than once or when just publishing */
if (method == E_CAL_COMPONENT_METHOD_PUBLISH ||
@@ -785,10 +637,7 @@ event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method)
client, NULL, NULL, NULL);
g_object_unref (comp);
- if (!result)
- return FALSE;
- else
- return TRUE;
+ return result;
}
parent:
@@ -798,45 +647,6 @@ event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method)
return FALSE;
}
-/* Destroy handler for the event editor */
-static void
-event_editor_finalize (GObject *object)
-{
- EventEditor *ee;
- EventEditorPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_EVENT_EDITOR (object));
-
- ee = EVENT_EDITOR (object);
- priv = ee->priv;
-
- if (priv->event_page) {
- g_object_unref (priv->event_page);
- priv->event_page = NULL;
- }
-
- if (priv->recur_page) {
- g_object_unref (priv->recur_page);
- priv->recur_page = NULL;
- }
-
- if (priv->sched_page) {
- g_object_unref (priv->sched_page);
- priv->sched_page = NULL;
- }
-
- if (priv->model) {
- g_object_unref (priv->model);
- priv->model = NULL;
- }
-
- g_free (priv);
-
- if (G_OBJECT_CLASS (event_editor_parent_class)->finalize)
- (* G_OBJECT_CLASS (event_editor_parent_class)->finalize) (object);
-}
-
/**
* event_editor_new:
* @client: a ECal
@@ -846,67 +656,40 @@ event_editor_finalize (GObject *object)
* Return value: A newly-created event editor dialog, or NULL if the event
* editor could not be created.
**/
-EventEditor *
+CompEditor *
event_editor_new (ECal *client, CompEditorFlags flags)
{
- EventEditor *ee;
+ g_return_val_if_fail (E_IS_CAL (client), NULL);
- ee = EVENT_EDITOR (g_object_new (TYPE_EVENT_EDITOR, NULL));
- ee->priv->is_meeting = flags & COMP_EDITOR_MEETING;
- comp_editor_set_flags (COMP_EDITOR (ee), flags);
- return event_editor_construct (ee, client);
+ return g_object_new (
+ TYPE_EVENT_EDITOR,
+ "flags", flags, "client", client, NULL);
}
-static void
-show_meeting (EventEditor *ee)
+void
+event_editor_show_meeting (EventEditor *ee)
{
- EventEditorPrivate *priv;
- CompEditor *editor = COMP_EDITOR (ee);
- CompEditorFlags flags = comp_editor_get_flags (editor);
-
- priv = ee->priv;
-
- event_page_set_meeting (priv->event_page, TRUE);
- if (!priv->meeting_shown) {
- bonobo_ui_component_set_prop (editor->uic, "/commands/ActionFreeBusy", "hidden", "0", NULL);
+ CompEditor *editor;
+ CompEditorFlags flags;
- priv->meeting_shown = TRUE;
+ g_return_if_fail (IS_EVENT_EDITOR (ee));
- comp_editor_set_changed (COMP_EDITOR (ee), FALSE);
- comp_editor_set_needs_send (COMP_EDITOR (ee), priv->meeting_shown);
- }
+ editor = COMP_EDITOR (ee);
+ flags = comp_editor_get_flags (editor);
- if (!(flags & COMP_EDITOR_NEW_ITEM) && !(flags & COMP_EDITOR_USER_ORG))
- gtk_drag_dest_unset (GTK_WIDGET (editor));
-}
+ event_page_set_meeting (ee->priv->event_page, TRUE);
+ if (!ee->priv->meeting_shown) {
+ GtkAction *action;
-void
-event_editor_show_meeting (EventEditor *ee)
-{
- g_return_if_fail (ee != NULL);
- g_return_if_fail (IS_EVENT_EDITOR (ee));
+ action = comp_editor_get_action (editor, "free-busy");
+ gtk_action_set_visible (action, TRUE);
- show_meeting (ee);
-}
+ ee->priv->meeting_shown = TRUE;
-static void
-model_changed (EventEditor *ee)
-{
- if (!ee->priv->updating) {
- comp_editor_set_changed (COMP_EDITOR (ee), TRUE);
- comp_editor_set_needs_send (COMP_EDITOR (ee), TRUE);
+ comp_editor_set_changed (editor, FALSE);
+ comp_editor_set_needs_send (editor, TRUE);
}
-}
-static void
-model_row_change_insert_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
-{
- model_changed (EVENT_EDITOR (data));
-}
-
-static void
-model_row_delete_cb (GtkTreeModel *model, GtkTreePath *path, gpointer data)
-{
- model_changed (EVENT_EDITOR (data));
+ if (!(flags & COMP_EDITOR_NEW_ITEM) && !(flags & COMP_EDITOR_USER_ORG))
+ gtk_drag_dest_unset (GTK_WIDGET (editor));
}
-
diff --git a/calendar/gui/dialogs/event-editor.h b/calendar/gui/dialogs/event-editor.h
index e45e9940e2..aa50466a02 100644
--- a/calendar/gui/dialogs/event-editor.h
+++ b/calendar/gui/dialogs/event-editor.h
@@ -27,13 +27,26 @@
#include <gtk/gtk.h>
#include "comp-editor.h"
-
+/* Standard GObject macros */
+#define TYPE_EVENT_EDITOR \
+ (event_editor_get_type ())
+#define EVENT_EDITOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), TYPE_EVENT_EDITOR, EventEditor))
+#define EVENT_EDITOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), TYPE_EVENT_EDITOR, EventEditorClass))
+#define IS_EVENT_EDITOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), TYPE_EVENT_EDITOR))
+#define IS_EVENT_EDITOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), TYPE_EVENT_EDITOR))
+#define EVENT_EDITOR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), TYPE_EVENT_EDITOR, EventEditorClass))
-#define TYPE_EVENT_EDITOR (event_editor_get_type ())
-#define EVENT_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_EVENT_EDITOR, EventEditor))
-#define EVENT_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_EVENT_EDITOR, EventEditorClass))
-#define IS_EVENT_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_EVENT_EDITOR))
-#define IS_EVENT_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_EVENT_EDITOR))
+G_BEGIN_DECLS
typedef struct _EventEditor EventEditor;
typedef struct _EventEditorClass EventEditorClass;
@@ -41,8 +54,6 @@ typedef struct _EventEditorPrivate EventEditorPrivate;
struct _EventEditor {
CompEditor parent;
-
- /* Private data */
EventEditorPrivate *priv;
};
@@ -50,12 +61,11 @@ struct _EventEditorClass {
CompEditorClass parent_class;
};
-GType event_editor_get_type (void);
-EventEditor *event_editor_construct (EventEditor *ee,
- ECal *client);
-EventEditor *event_editor_new (ECal *client, CompEditorFlags flags);
-void event_editor_show_meeting (EventEditor *ee);
+GType event_editor_get_type (void);
+CompEditor * event_editor_new (ECal *client,
+ CompEditorFlags flags);
+void event_editor_show_meeting (EventEditor *ee);
-
+G_END_DECLS
#endif /* __EVENT_EDITOR_H__ */
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index cf2a8e5c9e..bc75992c3e 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -56,16 +56,17 @@
#include "event-page.h"
#include "e-send-options-utils.h"
-
+#define EVENT_PAGE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), TYPE_EVENT_PAGE, EventPagePrivate))
/* Private part of the EventPage structure */
struct _EventPagePrivate {
/* Glade XML data */
GladeXML *xml;
- /* Widgets from the Glade file */
+ /* Widgets from the Glade file */
GtkWidget *main;
- BonoboUIComponent *uic;
/* Generic informative messages placeholder */
GtkWidget *info_hbox;
@@ -107,8 +108,6 @@ struct _EventPagePrivate {
GtkWidget *description;
- ECalComponentClassification classification;
-
gboolean show_time_as_busy;
GtkWidget *alarm_dialog;
@@ -133,14 +132,12 @@ struct _EventPagePrivate {
/* ListView stuff */
EMeetingStore *model;
- ECal *client;
EMeetingListView *list_view;
gint row;
/* For handling who the organizer is */
gboolean user_org;
gboolean existing;
- gboolean updating;
EAlarmList *alarm_list_store;
@@ -160,16 +157,11 @@ struct _EventPagePrivate {
GtkWidget *alarm_list_dlg_widget;
};
-
-
-static void event_page_finalize (GObject *object);
-
static GtkWidget *event_page_get_widget (CompEditorPage *page);
static void event_page_focus_main_widget (CompEditorPage *page);
static gboolean event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp);
static gboolean event_page_fill_component (CompEditorPage *page, ECalComponent *comp);
static gboolean event_page_fill_timezones (CompEditorPage *page, GHashTable *timezones);
-static void event_page_set_summary (CompEditorPage *page, const char *summary);
static void event_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates);
static void notify_dates_changed (EventPage *epage, struct icaltimetype *start_tt, struct icaltimetype *end_tt);
static gboolean check_start_before_end (struct icaltimetype *start_tt, icaltimezone *start_zone,
@@ -184,159 +176,91 @@ static void set_subscriber_info_string (EventPage *epage, const char *backend_ad
G_DEFINE_TYPE (EventPage, event_page, TYPE_COMP_EDITOR_PAGE);
-/* Class initialization function for the event page */
-static void
-event_page_class_init (EventPageClass *class)
-{
- CompEditorPageClass *editor_page_class;
- GObjectClass *object_class;
-
- editor_page_class = (CompEditorPageClass *) class;
- object_class = (GObjectClass *) class;
-
- editor_page_class->get_widget = event_page_get_widget;
- editor_page_class->focus_main_widget = event_page_focus_main_widget;
- editor_page_class->fill_widgets = event_page_fill_widgets;
- editor_page_class->fill_component = event_page_fill_component;
- editor_page_class->fill_timezones = event_page_fill_timezones;
- editor_page_class->set_summary = event_page_set_summary;
- editor_page_class->set_dates = event_page_set_dates;
-
- object_class->finalize = event_page_finalize;
-}
-
-/* Object initialization function for the event page */
static void
-event_page_init (EventPage *epage)
+event_page_dispose (GObject *object)
{
EventPagePrivate *priv;
- priv = g_new0 (EventPagePrivate, 1);
- epage->priv = priv;
-
- priv->xml = NULL;
- priv->uic = NULL;
-
- priv->main = NULL;
- priv->summary = NULL;
- priv->summary_label = NULL;
- priv->location = NULL;
- priv->location_label = NULL;
- priv->start_time = NULL;
- priv->end_time = NULL;
- priv->start_timezone = NULL;
- priv->end_timezone = NULL;
- priv->timezone_label = NULL;
- priv->all_day_event = FALSE;
- priv->status_icons = NULL;
- priv->alarm_icon = NULL;
- priv->recur_icon = NULL;
- priv->description = NULL;
- priv->classification = E_CAL_COMPONENT_CLASS_NONE;
- priv->show_time_as_busy = FALSE;
- priv->alarm_dialog = NULL;
- priv->alarm_time = NULL;
- priv->alarm_box = NULL;
- priv->categories_btn = NULL;
- priv->categories = NULL;
- priv->sod = NULL;
-
- priv->info_hbox = NULL;
- priv->info_icon = NULL;
- priv->info_string = NULL;
-
- priv->deleted_attendees = g_ptr_array_new ();
-
- priv->comp = NULL;
-
- priv->accounts = NULL;
- priv->address_strings = NULL;
- priv->ia = NULL;
- priv->invite = NULL;
-
- priv->model = NULL;
- priv->list_view = NULL;
+ priv = EVENT_PAGE_GET_PRIVATE (object);
- priv->updating = FALSE;
+ if (priv->comp != NULL) {
+ g_object_unref (priv->comp);
+ priv->comp = NULL;
+ }
- priv->alarm_interval = -1;
+ if (priv->main != NULL) {
+ g_object_unref (priv->main);
+ priv->main = NULL;
+ }
- priv->sendoptions_shown = FALSE;
- priv->is_meeting = FALSE;
- priv->sync_timezones = FALSE;
+ if (priv->xml != NULL) {
+ g_object_unref (priv->xml);
+ priv->xml = NULL;
+ }
- priv->alarm_list_dlg_widget = NULL;
-}
+ if (priv->alarm_list_store != NULL) {
+ g_object_unref (priv->alarm_list_store);
+ priv->alarm_list_store = NULL;
+ }
-static void
-cleanup_attendees (GPtrArray *attendees)
-{
- int i;
+ if (priv->sod != NULL) {
+ g_object_unref (priv->sod);
+ priv->sod = NULL;
+ }
- for (i = 0; i < attendees->len; i++)
- g_object_unref (g_ptr_array_index (attendees, i));
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (event_page_parent_class)->dispose (object);
}
-/* Destroy handler for the event page */
static void
event_page_finalize (GObject *object)
{
- EventPage *epage;
EventPagePrivate *priv;
- GList *l;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_EVENT_PAGE (object));
- epage = EVENT_PAGE (object);
- priv = epage->priv;
+ priv = EVENT_PAGE_GET_PRIVATE (object);
- for (l = priv->address_strings; l != NULL; l = l->next)
- g_free (l->data);
+ g_list_foreach (priv->address_strings, (GFunc) g_free, NULL);
g_list_free (priv->address_strings);
- if (priv->comp != NULL)
- g_object_unref (priv->comp);
-
- cleanup_attendees (priv->deleted_attendees);
+ g_ptr_array_foreach (
+ priv->deleted_attendees, (GFunc) g_object_unref, NULL);
g_ptr_array_free (priv->deleted_attendees, TRUE);
- if (priv->main)
- g_object_unref (priv->main);
+ g_free (priv->old_summary);
- if (priv->xml) {
- g_object_unref (priv->xml);
- priv->xml = NULL;
- }
+ priv->alarm_list_dlg_widget = NULL;
- if (priv->alarm_list_store) {
- g_object_unref (priv->alarm_list_store);
- priv->alarm_list_store = NULL;
- }
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (event_page_parent_class)->finalize (object);
+}
- if (priv->sod) {
- g_object_unref (priv->sod);
- priv->sod = NULL;
- }
- g_free (priv->old_summary);
+static void
+event_page_class_init (EventPageClass *class)
+{
+ GObjectClass *object_class;
+ CompEditorPageClass *editor_page_class;
- priv->alarm_list_dlg_widget = NULL;
+ g_type_class_add_private (class, sizeof (EventPagePrivate));
- g_free (priv);
- epage->priv = NULL;
+ object_class = G_OBJECT_CLASS (class);
+ object_class->finalize = event_page_finalize;
- if (G_OBJECT_CLASS (event_page_parent_class)->finalize)
- (* G_OBJECT_CLASS (event_page_parent_class)->finalize) (object);
+ editor_page_class = COMP_EDITOR_PAGE_CLASS (class);
+ editor_page_class->get_widget = event_page_get_widget;
+ editor_page_class->focus_main_widget = event_page_focus_main_widget;
+ editor_page_class->fill_widgets = event_page_fill_widgets;
+ editor_page_class->fill_component = event_page_fill_component;
+ editor_page_class->fill_timezones = event_page_fill_timezones;
+ editor_page_class->set_dates = event_page_set_dates;
}
-
-
-static const int classification_map[] = {
- E_CAL_COMPONENT_CLASS_PUBLIC,
- E_CAL_COMPONENT_CLASS_PRIVATE,
- E_CAL_COMPONENT_CLASS_CONFIDENTIAL,
- -1
-};
+static void
+event_page_init (EventPage *epage)
+{
+ epage->priv = EVENT_PAGE_GET_PRIVATE (epage);
+ epage->priv->deleted_attendees = g_ptr_array_new ();
+ epage->priv->alarm_interval = -1;
+}
enum {
ALARM_NONE,
@@ -358,62 +282,45 @@ static const int alarm_map[] = {
};
static void
-set_classification_menu (EventPage *epage, gint class)
-{
- bonobo_ui_component_freeze (epage->priv->uic, NULL);
- switch (class) {
- case E_CAL_COMPONENT_CLASS_PUBLIC:
- bonobo_ui_component_set_prop (
- epage->priv->uic, "/commands/ActionClassPublic",
- "state", "1", NULL);
- break;
- case E_CAL_COMPONENT_CLASS_CONFIDENTIAL:
- bonobo_ui_component_set_prop (
- epage->priv->uic, "/commands/ActionClassConfidential",
- "state", "1", NULL);
- break;
- case E_CAL_COMPONENT_CLASS_PRIVATE:
- bonobo_ui_component_set_prop (
- epage->priv->uic, "/commands/ActionClassPrivate",
- "state", "1", NULL);
- break;
- }
- bonobo_ui_component_thaw (epage->priv->uic, NULL);
-}
-
-static void
-set_busy_time_menu (EventPage *epage, gboolean status)
+set_busy_time_menu (EventPage *epage, gboolean active)
{
- bonobo_ui_component_set_prop (
- epage->priv->uic, "/commands/ActionShowTimeBusy",
- "state", status ? "1" : "0", NULL);
+ CompEditor *editor;
+ GtkAction *action;
+
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+ action = comp_editor_get_action (editor, "show-time-busy");
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active);
}
static void
-enable_busy_time_menu (EventPage *epage, gboolean state)
+enable_busy_time_menu (EventPage *epage, gboolean sensitive)
{
- bonobo_ui_component_set_prop (
- epage->priv->uic, "/commands/ActionShowTimeBusy",
- "sensitive", state ? "1" : "0", NULL);
+ CompEditor *editor;
+ GtkAction *action;
+
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+ action = comp_editor_get_action (editor, "show-time-busy");
+ gtk_action_set_sensitive (action, sensitive);
}
static void
-set_all_day_event_menu (EventPage *epage, gboolean status)
+set_all_day_event_menu (EventPage *epage, gboolean active)
{
- bonobo_ui_component_set_prop (
- epage->priv->uic, "/commands/ActionAllDayEvent",
- "state", status ? "1" : "0", NULL);
+ CompEditor *editor;
+ GtkAction *action;
+
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+ action = comp_editor_get_action (editor, "all-day-event");
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active);
}
/* get_widget handler for the event page */
static GtkWidget *
event_page_get_widget (CompEditorPage *page)
{
- EventPage *epage;
EventPagePrivate *priv;
- epage = EVENT_PAGE (page);
- priv = epage->priv;
+ priv = EVENT_PAGE_GET_PRIVATE (page);
return priv->main;
}
@@ -422,11 +329,9 @@ event_page_get_widget (CompEditorPage *page)
static void
event_page_focus_main_widget (CompEditorPage *page)
{
- EventPage *epage;
EventPagePrivate *priv;
- epage = EVENT_PAGE (page);
- priv = epage->priv;
+ priv = EVENT_PAGE_GET_PRIVATE (page);
gtk_widget_grab_focus (priv->summary);
}
@@ -455,12 +360,15 @@ set_all_day (EventPage *epage, gboolean all_day)
static void
update_time (EventPage *epage, ECalComponentDateTime *start_date, ECalComponentDateTime *end_date)
{
- EventPagePrivate *priv;
+ EventPagePrivate *priv = epage->priv;
+ CompEditor *editor;
+ ECal *client;
struct icaltimetype *start_tt, *end_tt, implied_tt;
icaltimezone *start_zone = NULL, *def_zone = NULL;
gboolean all_day_event, homezone=TRUE;
- priv = epage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+ client = comp_editor_get_client (editor);
/* Note that if we are creating a new event, the timezones may not be
on the server, so we try to get the builtin timezone with the TZID
@@ -468,8 +376,7 @@ update_time (EventPage *epage, ECalComponentDateTime *start_date, ECalComponentD
start_zone = icaltimezone_get_builtin_timezone_from_tzid (start_date->tzid);
if (!start_zone) {
/* FIXME: Handle error better. */
- if (!e_cal_get_timezone (COMP_EDITOR_PAGE (epage)->client,
- start_date->tzid, &start_zone, NULL)) {
+ if (!e_cal_get_timezone (client, start_date->tzid, &start_zone, NULL)) {
g_warning ("Couldn't get timezone from server: %s",
start_date->tzid ? start_date->tzid : "");
}
@@ -545,9 +452,10 @@ update_time (EventPage *epage, ECalComponentDateTime *start_date, ECalComponentD
static void
clear_widgets (EventPage *epage)
{
- EventPagePrivate *priv;
+ EventPagePrivate *priv = epage->priv;
+ CompEditor *editor;
- priv = epage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
/* Summary, description */
e_dialog_editable_set (priv->summary, NULL);
@@ -568,8 +476,7 @@ clear_widgets (EventPage *epage)
set_all_day (epage, FALSE);
/* Classification */
- priv->classification = E_CAL_COMPONENT_CLASS_PUBLIC;
- set_classification_menu (epage, priv->classification);
+ comp_editor_set_classification (editor, E_CAL_COMPONENT_CLASS_PUBLIC);
/* Show Time As (Transparency) */
priv->show_time_as_busy = TRUE;
@@ -774,12 +681,6 @@ event_page_set_view_rsvp (EventPage *epage, gboolean state)
e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_RSVP_COL, state);
}
-void
-event_page_set_classification (EventPage *epage, ECalComponentClassification class)
-{
- epage->priv->classification = class;
-}
-
static GtkWidget *
create_image_event_box (const char *image_text, const char *tip_text)
{
@@ -798,18 +699,27 @@ create_image_event_box (const char *image_text, const char *tip_text)
static void
sensitize_widgets (EventPage *epage)
{
+ ECal *client;
+ CompEditor *editor;
+ CompEditorFlags flags;
+ GtkActionGroup *action_group;
+ GtkAction *action;
gboolean read_only, custom, alarm, sens = TRUE, sensitize;
EventPagePrivate *priv;
gboolean delegate;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+ client = comp_editor_get_client (editor);
+ flags = comp_editor_get_flags (editor);
+
priv = epage->priv;
- if (COMP_EDITOR_PAGE (epage)->flags & COMP_EDITOR_MEETING)
- sens = COMP_EDITOR_PAGE (epage)->flags & COMP_EDITOR_PAGE_USER_ORG;
+ if (flags & COMP_EDITOR_MEETING)
+ sens = flags & COMP_EDITOR_USER_ORG;
- if (!e_cal_is_read_only (COMP_EDITOR_PAGE (epage)->client, &read_only, NULL))
+ if (!e_cal_is_read_only (client, &read_only, NULL))
read_only = TRUE;
- delegate = COMP_EDITOR_PAGE (epage)->flags & COMP_EDITOR_PAGE_DELEGATE;
+ delegate = flags & COMP_EDITOR_DELEGATE;
sensitize = !read_only && sens;
@@ -838,7 +748,7 @@ sensitize_widgets (EventPage *epage)
gtk_widget_set_sensitive (priv->alarm_time, !read_only);
gtk_widget_set_sensitive (priv->categories_btn, !read_only);
/*TODO implement the for portion of the end time selector */
- if ( (COMP_EDITOR_PAGE(epage)->flags) & COMP_EDITOR_PAGE_NEW_ITEM ) {
+ if (flags & COMP_EDITOR_NEW_ITEM) {
if (priv->all_day_event)
gtk_option_menu_set_history (GTK_OPTION_MENU (priv->end_time_selector), 1);
else
@@ -863,28 +773,11 @@ sensitize_widgets (EventPage *epage)
gtk_widget_set_sensitive (priv->invite, (!read_only && sens) || delegate);
gtk_widget_set_sensitive (GTK_WIDGET (priv->list_view), !read_only);
- bonobo_ui_component_set_prop (priv->uic, "/commands/InsertAttachments", "sensitive", sensitize ? "1" : "0"
- , NULL);
- bonobo_ui_component_set_prop (priv->uic, "/commands/ActionAllDayEvent", "sensitive", sensitize ? "1" : "0"
- , NULL);
- bonobo_ui_component_set_prop (priv->uic, "/commands/ActionShowTimeBusy", "sensitive", !read_only ? "1" : "0"
- , NULL);
- bonobo_ui_component_set_prop (priv->uic, "/commands/ActionAlarm", "sensitive", !read_only ? "1" : "0"
- , NULL);
- bonobo_ui_component_set_prop (priv->uic, "/commands/ActionClassPublic", "sensitive", sensitize ? "1" : "0"
- , NULL);
- bonobo_ui_component_set_prop (priv->uic, "/commands/ActionClassPrivate", "sensitive", sensitize ? "1" : "0"
- , NULL);
- bonobo_ui_component_set_prop (priv->uic, "/commands/ActionClassConfidential", "sensitive",
- sensitize ? "1" : "0", NULL);
- bonobo_ui_component_set_prop (priv->uic, "/commands/InsertSendOptions", "sensitive", sensitize ? "1" : "0"
- , NULL);
- bonobo_ui_component_set_prop (priv->uic, "/commands/ActionRecurrence", "sensitive", sensitize ? "1" : "0", NULL);
- bonobo_ui_component_set_prop (priv->uic, "/commands/ActionFreeBusy", "sensitive", sensitize ? "1" : "0", NULL);
-
- bonobo_ui_component_set_prop (priv->uic, "/commands/ViewCategories", "sensitive", "1", NULL);
- bonobo_ui_component_set_prop (priv->uic, "/commands/ViewTimeZone", "sensitive", "1", NULL);
+ action_group = comp_editor_get_action_group (editor, "individual");
+ gtk_action_group_set_sensitive (action_group, sensitize);
+ action = comp_editor_get_action (editor, "free-busy");
+ gtk_action_set_sensitive (action, sensitize);
if (!priv->is_meeting) {
gtk_widget_hide (priv->calendar_label);
@@ -906,19 +799,27 @@ sensitize_widgets (EventPage *epage)
void
event_page_hide_options (EventPage *page)
{
+ CompEditor *editor;
+ GtkAction *action;
+
g_return_if_fail (IS_EVENT_PAGE (page));
- bonobo_ui_component_set_prop (page->priv->uic, "/commands/InsertSendOptions", "hidden", "1", NULL);
- page->priv->sendoptions_shown = FALSE;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
+ action = comp_editor_get_action (editor, "send-options");
+ gtk_action_set_visible (action, FALSE);
}
void
event_page_show_options (EventPage *page)
{
+ CompEditor *editor;
+ GtkAction *action;
+
g_return_if_fail (IS_EVENT_PAGE (page));
- bonobo_ui_component_set_prop (page->priv->uic, "/commands/InsertSendOptions", "hidden", "0", NULL);
- page->priv->sendoptions_shown = TRUE;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
+ action = comp_editor_get_action (editor, "send-options");
+ gtk_action_set_visible (action, TRUE);
}
void
@@ -976,6 +877,9 @@ get_current_account (EventPage *epage)
static gboolean
event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
{
+ ECal *client;
+ CompEditor *editor;
+ CompEditorFlags flags;
EventPage *epage;
EventPagePrivate *priv;
ECalComponentText text;
@@ -988,23 +892,25 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
GSList *l;
gboolean validated = TRUE;
- g_return_val_if_fail (page->client != NULL, FALSE);
-
epage = EVENT_PAGE (page);
priv = epage->priv;
- if (!e_cal_component_has_organizer (comp))
- page->flags |= COMP_EDITOR_PAGE_USER_ORG;
+ editor = comp_editor_page_get_editor (page);
+ client = comp_editor_get_client (editor);
+ flags = comp_editor_get_flags (editor);
- /* Don't send off changes during this time */
- priv->updating = TRUE;
+ if (!e_cal_component_has_organizer (comp)) {
+ flags |= COMP_EDITOR_USER_ORG;
+ comp_editor_set_flags (editor, flags);
+ }
/* Clean out old data */
if (priv->comp != NULL)
g_object_unref (priv->comp);
priv->comp = NULL;
- cleanup_attendees (priv->deleted_attendees);
+ g_ptr_array_foreach (
+ priv->deleted_attendees, (GFunc) g_object_unref, NULL);
g_ptr_array_set_size (priv->deleted_attendees, 0);
/* Clean the page */
@@ -1032,13 +938,13 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
}
e_cal_component_free_text_list (l);
- e_cal_get_cal_address (COMP_EDITOR_PAGE (epage)->client, &backend_addr, NULL);
+ e_cal_get_cal_address (client, &backend_addr, NULL);
set_subscriber_info_string (epage, backend_addr);
if (priv->is_meeting) {
ECalComponentOrganizer organizer;
- priv->user_add = itip_get_comp_attendee (comp, COMP_EDITOR_PAGE (epage)->client);
+ priv->user_add = itip_get_comp_attendee (comp, client);
/* Organizer strings */
event_page_select_organizer (epage, backend_addr);
@@ -1051,14 +957,14 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
gchar *string;
GList *list = NULL;
- if (itip_organizer_is_user (comp, page->client) || itip_sentby_is_user (comp)) {
+ if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp)) {
if (e_cal_get_static_capability (
- page->client,
+ client,
CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS))
priv->user_org = TRUE;
} else {
if (e_cal_get_static_capability (
- page->client,
+ client,
CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS))
gtk_widget_set_sensitive (priv->invite, FALSE);
gtk_widget_set_sensitive (priv->add, FALSE);
@@ -1067,7 +973,7 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
priv->user_org = FALSE;
}
- if (e_cal_get_static_capability (COMP_EDITOR_PAGE (epage)->client, CAL_STATIC_CAPABILITY_NO_ORGANIZER) && (COMP_EDITOR_PAGE (epage)->flags & COMP_EDITOR_PAGE_DELEGATE))
+ if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_ORGANIZER) && (flags & COMP_EDITOR_DELEGATE))
string = g_strdup (backend_addr);
else if ( organizer.cn != NULL)
string = g_strdup_printf ("%s <%s>", organizer.cn, strip);
@@ -1089,9 +995,6 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
a = get_current_account (epage);
if (a != NULL) {
- /* Reuse earlier declared *page, or rename this to avoid confusion? */
- CompEditorPage *page = (CompEditorPage *) epage;
-
priv->ia = e_meeting_store_add_attendee_with_defaults (priv->model);
g_object_ref (priv->ia);
@@ -1103,7 +1006,7 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
e_meeting_attendee_set_sentby (priv->ia, g_strdup_printf ("MAILTO:%s", a->id->address));
}
- if (page->client && e_cal_get_organizer_must_accept (page->client))
+ if (client && e_cal_get_organizer_must_accept (client))
e_meeting_attendee_set_status (priv->ia, ICAL_PARTSTAT_NEEDSACTION);
else
e_meeting_attendee_set_status (priv->ia, ICAL_PARTSTAT_ACCEPTED);
@@ -1134,17 +1037,7 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
update_end_time_selector (epage);
/* Classification */
e_cal_component_get_classification (comp, &cl);
- switch (cl) {
- case E_CAL_COMPONENT_CLASS_PUBLIC:
- case E_CAL_COMPONENT_CLASS_PRIVATE:
- case E_CAL_COMPONENT_CLASS_CONFIDENTIAL:
- break;
- default:
- cl = E_CAL_COMPONENT_CLASS_PUBLIC;
- break;
- }
- set_classification_menu (epage, cl);
- priv->classification = cl;
+ comp_editor_set_classification (editor, cl);
/* Show Time As (Transparency) */
e_cal_component_get_transparency (comp, &transparency);
@@ -1160,7 +1053,7 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
break;
}
- if (e_cal_get_static_capability (page->client, CAL_STATIC_CAPABILITY_NO_TRANSPARENCY))
+ if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_TRANSPARENCY))
enable_busy_time_menu (epage, FALSE);
else
enable_busy_time_menu (epage, TRUE);
@@ -1201,16 +1094,14 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
/* Source */
e_source_combo_box_set_active (
E_SOURCE_COMBO_BOX (priv->source_selector),
- e_cal_get_source (page->client));
+ e_cal_get_source (client));
e_cal_component_get_uid (comp, &uid);
- if (!(COMP_EDITOR_PAGE (epage)->flags & COMP_EDITOR_PAGE_DELEGATE)
- && !(COMP_EDITOR_PAGE (epage)->flags && COMP_EDITOR_PAGE_NEW_ITEM)) {
+ if (!(flags & COMP_EDITOR_DELEGATE)
+ && !(flags && COMP_EDITOR_NEW_ITEM)) {
event_page_hide_options (epage);
}
- priv->updating = FALSE;
-
sensitize_widgets (epage);
return validated;
@@ -1220,8 +1111,12 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
static gboolean
event_page_fill_component (CompEditorPage *page, ECalComponent *comp)
{
+ CompEditor *editor;
+ CompEditorFlags flags;
+ ECal *client;
EventPage *epage;
EventPagePrivate *priv;
+ ECalComponentClassification classification;
ECalComponentDateTime start_date, end_date;
struct icaltimetype start_tt, end_tt;
gboolean all_day_event, start_date_set, end_date_set, busy;
@@ -1231,6 +1126,11 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp)
epage = EVENT_PAGE (page);
priv = epage->priv;
+
+ editor = comp_editor_page_get_editor (page);
+ client = comp_editor_get_client (editor);
+ flags = comp_editor_get_flags (editor);
+
text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->description));
/* Summary */
@@ -1363,7 +1263,8 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp)
g_free (str);
/* Classification */
- e_cal_component_set_classification (comp, priv->classification);
+ classification = comp_editor_get_classification (editor);
+ e_cal_component_set_classification (comp, classification);
/* Show Time As (Transparency) */
busy = priv->show_time_as_busy;
@@ -1489,7 +1390,7 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp)
EAccount *a;
gchar *backend_addr = NULL, *org_addr = NULL, *sentby = NULL;
- e_cal_get_cal_address (priv->client, &backend_addr, NULL);
+ e_cal_get_cal_address (client, &backend_addr, NULL);
/* Find the identity for the organizer or sentby field */
a = get_current_account (epage);
@@ -1533,7 +1434,7 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp)
}
- if (COMP_EDITOR_PAGE (epage)->flags & COMP_EDITOR_PAGE_DELEGATE ) {
+ if (flags & COMP_EDITOR_DELEGATE) {
GSList *attendee_list, *l;
int i;
const GPtrArray *attendees = e_meeting_store_get_attendees (priv->model);
@@ -1597,13 +1498,6 @@ event_page_fill_timezones (CompEditorPage *page, GHashTable *timezones)
return TRUE;
}
-/* set_summary handler for the event page */
-static void
-event_page_set_summary (CompEditorPage *page, const char *summary)
-{
- /* nothing */
-}
-
static void
event_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates)
{
@@ -1673,13 +1567,13 @@ void update_end_time_selector (EventPage *epage)
void
static hour_sel_changed (GtkSpinButton *widget, EventPage *epage)
{
- hour_minute_changed(epage);
+ hour_minute_changed (epage);
}
void
static minute_sel_changed (GtkSpinButton *widget, EventPage *epage)
{
- hour_minute_changed ( epage);
+ hour_minute_changed (epage);
}
void
@@ -1735,11 +1629,16 @@ edit_clicked_cb (GtkButton *btn, EventPage *epage)
static void
add_clicked_cb (GtkButton *btn, EventPage *epage)
{
+ CompEditor *editor;
+ CompEditorFlags flags;
EMeetingAttendee *attendee;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+ flags = comp_editor_get_flags (editor);
+
attendee = e_meeting_store_add_attendee_with_defaults (epage->priv->model);
- if (COMP_EDITOR_PAGE (epage)->flags & COMP_EDITOR_PAGE_DELEGATE) {
+ if (flags & COMP_EDITOR_DELEGATE) {
e_meeting_attendee_set_delfrom (attendee, g_strdup_printf ("MAILTO:%s", epage->priv->user_add));
}
@@ -1785,11 +1684,16 @@ existing_attendee (EMeetingAttendee *ia, ECalComponent *comp)
static void
remove_attendee (EventPage *epage, EMeetingAttendee *ia)
{
- EventPagePrivate *priv;
+ EventPagePrivate *priv = epage->priv;
+ CompEditor *editor;
+ CompEditorFlags flags;
int pos = 0;
- gboolean delegate = (COMP_EDITOR_PAGE (epage)->flags & COMP_EDITOR_PAGE_DELEGATE);
+ gboolean delegate;
- priv = epage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+ flags = comp_editor_get_flags (editor);
+
+ delegate = (flags & COMP_EDITOR_DELEGATE);
/* If the user deletes the organizer attendee explicitly,
assume they no longer want the organizer showing up */
@@ -1903,19 +1807,24 @@ invite_cb (GtkWidget *widget, gpointer data)
}
static void
-attendee_added_cb (EMeetingListView *emlv, EMeetingAttendee *ia, gpointer user_data)
+attendee_added_cb (EMeetingListView *emlv,
+ EMeetingAttendee *ia,
+ EventPage *epage)
{
- EventPage *epage = EVENT_PAGE (user_data);
- EventPagePrivate *priv;
- gboolean delegate = (COMP_EDITOR_PAGE (epage)->flags & COMP_EDITOR_PAGE_DELEGATE);
+ EventPagePrivate *priv = epage->priv;
+ CompEditor *editor;
+ CompEditorFlags flags;
+ ECal *client;
- priv = epage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+ client = comp_editor_get_client (editor);
+ flags = comp_editor_get_flags (editor);
- if (delegate) {
+ if (flags & COMP_EDITOR_DELEGATE) {
if (existing_attendee (ia, priv->comp))
e_meeting_store_remove_attendee (priv->model, ia);
else {
- if (!e_cal_get_static_capability (COMP_EDITOR_PAGE(epage)->client,
+ if (!e_cal_get_static_capability (client,
CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY)) {
const char *delegator_id = e_meeting_attendee_get_delfrom (ia);
EMeetingAttendee *delegator;
@@ -1930,7 +1839,7 @@ attendee_added_cb (EMeetingListView *emlv, EMeetingAttendee *ia, gpointer user_d
gtk_widget_set_sensitive (priv->edit, FALSE);
}
}
- }
+}
}
@@ -1972,7 +1881,9 @@ context_popup_free(EPopup *ep, GSList *items, void *data)
static gint
button_press_event (GtkWidget *widget, GdkEventButton *event, EventPage *epage)
{
- EventPagePrivate *priv;
+ EventPagePrivate *priv = epage->priv;
+ CompEditor *editor;
+ CompEditorFlags flags;
GtkMenu *menu;
EMeetingAttendee *ia;
GtkTreePath *path;
@@ -1982,12 +1893,14 @@ button_press_event (GtkWidget *widget, GdkEventButton *event, EventPage *epage)
GSList *menus = NULL;
ECalPopup *ep;
int i;
- priv = epage->priv;
/* only process right-clicks */
if (event->button != 3 || event->type != GDK_BUTTON_PRESS)
return FALSE;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+ flags = comp_editor_get_flags (editor);
+
/* only if we right-click on an attendee */
if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (priv->list_view), event->x, event->y, &path, NULL, NULL, NULL)) {
GtkTreeSelection *selection;
@@ -2011,7 +1924,7 @@ button_press_event (GtkWidget *widget, GdkEventButton *event, EventPage *epage)
if (GTK_WIDGET_IS_SENSITIVE(priv->add))
disable_mask &= ~ATTENDEE_CAN_ADD;
- else if (COMP_EDITOR_PAGE (epage)->flags & COMP_EDITOR_PAGE_USER_ORG)
+ else if (flags & COMP_EDITOR_USER_ORG)
disable_mask &= ~ATTENDEE_CAN_ADD;
ep = e_cal_popup_new("org.gnome.evolution.calendar.meeting.popup");
@@ -2029,14 +1942,19 @@ button_press_event (GtkWidget *widget, GdkEventButton *event, EventPage *epage)
static gboolean
list_view_event (EMeetingListView *list_view, GdkEvent *event, EventPage *epage) {
- EventPagePrivate *priv= epage->priv;
+ EventPagePrivate *priv = epage->priv;
+ CompEditor *editor;
+ CompEditorFlags flags;
+
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+ flags = comp_editor_get_flags (editor);
- if (event->type == GDK_2BUTTON_PRESS && COMP_EDITOR_PAGE (epage)->flags & COMP_EDITOR_PAGE_USER_ORG) {
+ if (event->type == GDK_2BUTTON_PRESS && flags & COMP_EDITOR_USER_ORG) {
EMeetingAttendee *attendee;
attendee = e_meeting_store_add_attendee_with_defaults (priv->model);
- if (COMP_EDITOR_PAGE (epage)->flags & COMP_EDITOR_PAGE_DELEGATE) {
+ if (flags & COMP_EDITOR_DELEGATE) {
e_meeting_attendee_set_delfrom (attendee, g_strdup_printf ("MAILTO:%s", epage->priv->user_add));
}
@@ -2071,8 +1989,12 @@ event_page_set_all_day_event (EventPage *epage, gboolean all_day)
EventPagePrivate *priv = epage->priv;
struct icaltimetype start_tt = icaltime_null_time();
struct icaltimetype end_tt = icaltime_null_time();
+ CompEditor *editor;
+ GtkAction *action;
gboolean date_set;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+
epage->priv->all_day_event = all_day;
e_date_edit_set_show_time (E_DATE_EDIT (priv->start_time), !all_day);
e_date_edit_set_show_time (E_DATE_EDIT (priv->end_time), !all_day);
@@ -2102,9 +2024,10 @@ event_page_set_all_day_event (EventPage *epage, gboolean all_day)
else
gtk_option_menu_set_history (GTK_OPTION_MENU (priv->end_time_selector), 0);
- if (all_day) {
- bonobo_ui_component_set_prop (epage->priv->uic, "/commands/ViewTimeZone", "sensitive", "0", NULL);
+ action = comp_editor_get_action (editor, "view-time-zone");
+ gtk_action_set_sensitive (action, !all_day);
+ if (all_day) {
/* Round down to the start of the day. */
start_tt.hour = 0;
start_tt.minute = 0;
@@ -2121,8 +2044,6 @@ event_page_set_all_day_event (EventPage *epage, gboolean all_day)
} else {
icaltimezone *start_zone;
- bonobo_ui_component_set_prop (epage->priv->uic, "/commands/ViewTimeZone", "sensitive", "1", NULL);
-
if (end_tt.year == start_tt.year
&& end_tt.month == start_tt.month
&& end_tt.day == start_tt.day) {
@@ -2169,18 +2090,14 @@ event_page_set_all_day_event (EventPage *epage, gboolean all_day)
/* Notify upstream */
notify_dates_changed (epage, &start_tt, &end_tt);
- if (!priv->updating)
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (epage));
-
+ comp_editor_page_changed (COMP_EDITOR_PAGE (epage));
}
void
event_page_set_show_time_busy (EventPage *epage, gboolean state)
{
epage->priv->show_time_as_busy = state;
- if (!epage->priv->updating)
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (epage));
-
+ comp_editor_page_changed (COMP_EDITOR_PAGE (epage));
}
void
@@ -2336,47 +2253,19 @@ get_widgets (EventPage *epage)
&& priv->description );
}
-/* sets the current focused widget */
-static gboolean
-widget_focus_in_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data)
-{
- EventPage *epage;
- epage = EVENT_PAGE (data);
-
- comp_editor_page_set_focused_widget (COMP_EDITOR_PAGE (epage), widget);
-
- return FALSE;
-}
-
-/* unset the current focused widget */
-static gboolean
-widget_focus_out_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data)
-{
- EventPage *epage;
- epage = EVENT_PAGE (data);
-
- comp_editor_page_unset_focused_widget (COMP_EDITOR_PAGE (epage), widget);
-
- return FALSE;
-}
-
-/* Callback used when the summary changes; we emit the notification signal. */
static void
-summary_changed_cb (GtkEditable *editable, gpointer data)
+summary_changed_cb (GtkEditable *editable,
+ CompEditorPage *page)
{
- EventPage *epage;
- EventPagePrivate *priv;
+ CompEditor *editor;
gchar *summary;
- epage = EVENT_PAGE (data);
- priv = epage->priv;
-
- if (priv->updating)
+ if (comp_editor_page_get_updating (page))
return;
+ editor = comp_editor_page_get_editor (page);
summary = e_dialog_editable_get (GTK_WIDGET (editable));
- comp_editor_page_notify_summary_changed (COMP_EDITOR_PAGE (epage),
- summary);
+ comp_editor_set_summary (editor, summary);
g_free (summary);
}
@@ -2481,7 +2370,7 @@ times_updated (EventPage *epage, gboolean adjust_end_time)
priv = epage->priv;
- if (priv->updating)
+ if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (epage)))
return;
/* Fetch the start and end times and timezones from the widgets. */
@@ -2605,11 +2494,11 @@ start_timezone_changed_cb (GtkWidget *widget, gpointer data)
if (priv->sync_timezones) {
zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone));
- priv->updating = TRUE;
+ comp_editor_page_set_updating (COMP_EDITOR_PAGE (epage), TRUE);
/*the earlier method caused an infinite recursion*/
priv->end_timezone=priv->start_timezone;
gtk_widget_show_all (priv->end_timezone);
- priv->updating = FALSE;
+ comp_editor_page_set_updating (COMP_EDITOR_PAGE (epage), FALSE);
}
times_updated (epage, TRUE);
@@ -2636,10 +2525,14 @@ void
event_page_sendoptions_clicked_cb (EventPage *epage)
{
EventPagePrivate *priv;
+ CompEditor *editor;
GtkWidget *toplevel;
ESource *source;
+ ECal *client;
priv = epage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+ client = comp_editor_get_client (editor);
if (!priv->sod) {
priv->sod = e_sendoptions_dialog_new ();
@@ -2649,8 +2542,7 @@ event_page_sendoptions_clicked_cb (EventPage *epage)
priv->sod->data->initialized = TRUE;
}
- if (e_cal_get_static_capability (COMP_EDITOR_PAGE (epage)->client,
- CAL_STATIC_CAPABILITY_NO_GEN_OPTIONS)) {
+ if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_GEN_OPTIONS)) {
e_sendoptions_set_need_general_options (priv->sod, FALSE);
}
@@ -2658,89 +2550,81 @@ event_page_sendoptions_clicked_cb (EventPage *epage)
e_sendoptions_dialog_run (priv->sod, toplevel, E_ITEM_CALENDAR);
}
-/* This is called when any field is changed; it notifies upstream. */
-static void
-field_changed_cb (GtkWidget *widget, gpointer data)
-{
- EventPage *epage;
- EventPagePrivate *priv;
-
- epage = EVENT_PAGE (data);
- priv = epage->priv;
-
- if (!priv->updating)
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (epage));
-}
-
static void
source_changed_cb (ESourceComboBox *source_combo_box, EventPage *epage)
{
EventPagePrivate *priv = epage->priv;
+ CompEditor *editor;
ESource *source;
+ ECal *client;
+
+ if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (epage)))
+ return;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+ client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_EVENT);
source = e_source_combo_box_get_active (source_combo_box);
- if (!priv->updating) {
- ECal *client;
+ if (client) {
+ icaltimezone *zone;
- client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_EVENT);
- if (client) {
- icaltimezone *zone;
+ zone = calendar_config_get_icaltimezone ();
+ e_cal_set_default_timezone (client, zone, NULL);
+ }
- zone = calendar_config_get_icaltimezone ();
- e_cal_set_default_timezone (client, zone, NULL);
- }
+ if (!client || !e_cal_open (client, FALSE, NULL)) {
+ GtkWidget *dialog;
+ ECal *old_client;
- if (!client || !e_cal_open (client, FALSE, NULL)) {
- GtkWidget *dialog;
+ old_client = comp_editor_get_client (editor);
- if (client)
- g_object_unref (client);
+ if (client)
+ g_object_unref (client);
- e_source_combo_box_set_active (
- E_SOURCE_COMBO_BOX (priv->source_selector),
- e_cal_get_source (COMP_EDITOR_PAGE (epage)->client));
+ e_source_combo_box_set_active (
+ E_SOURCE_COMBO_BOX (priv->source_selector),
+ e_cal_get_source (old_client));
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
- GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
- _("Unable to open the calendar '%s'."),
- e_source_peek_name (source));
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
- } else {
- comp_editor_notify_client_changed (
- COMP_EDITOR (gtk_widget_get_toplevel (priv->main)),
- client);
- if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS) && priv->is_meeting)
- event_page_show_options (epage);
- else
- event_page_hide_options (epage);
+ dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
+ GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
+ _("Unable to open the calendar '%s'."),
+ e_source_peek_name (source));
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ } else {
+ comp_editor_set_client (editor, client);
+ if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS) && priv->is_meeting)
+ event_page_show_options (epage);
+ else
+ event_page_hide_options (epage);
- if (client) {
- gchar *backend_addr = NULL;
+ if (client) {
+ gchar *backend_addr = NULL;
- e_cal_get_cal_address(client, &backend_addr, NULL);
+ e_cal_get_cal_address(client, &backend_addr, NULL);
- if (priv->is_meeting)
- event_page_select_organizer (epage, backend_addr);
+ if (priv->is_meeting)
+ event_page_select_organizer (epage, backend_addr);
- set_subscriber_info_string (epage, backend_addr);
- g_free (backend_addr);
- }
+ set_subscriber_info_string (epage, backend_addr);
+ g_free (backend_addr);
+ }
- sensitize_widgets (epage);
+ sensitize_widgets (epage);
- alarm_list_dialog_set_client (priv->alarm_list_dlg_widget, client);
- }
+ alarm_list_dialog_set_client (priv->alarm_list_dlg_widget, client);
}
}
static void
set_subscriber_info_string (EventPage *epage, const char *backend_address)
{
- ECal *client = COMP_EDITOR_PAGE (epage)->client;
+ CompEditor *editor;
+ ECal *client;
ESource *source;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+ client = comp_editor_get_client (editor);
source = e_cal_get_source (client);
if (e_source_get_property (source, "subscriber"))
@@ -2841,38 +2725,22 @@ alarm_changed_cb (GtkWidget *widget, gpointer data)
sensitize_widgets (epage);
}
-static void
-alarm_store_inserted_cb (EAlarmList *alarm_list_store, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
-{
- field_changed_cb (NULL, data);
-}
-
-static void
-alarm_store_deleted_cb (EAlarmList *alarm_list_store, GtkTreePath *path, gpointer data)
-{
- field_changed_cb (NULL, data);
-}
-
-static void
-alarm_store_changed_cb (EAlarmList *alarm_list_store, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
-{
- field_changed_cb (NULL, data);
-}
-
#if 0
static void
-alarm_custom_clicked_cb (GtkWidget *widget, gpointer data)
+alarm_custom_clicked_cb (GtkWidget *widget,
+ EventPage *epage)
{
- EventPage *epage;
- EventPagePrivate *priv;
+ EventPagePrivate *priv = epage->priv;
EAlarmList *temp_list_store;
+ CompEditor *editor;
GtkTreeModel *model;
GtkTreeIter iter;
gboolean valid_iter;
GtkWidget *toplevel;
+ ECal *client;
- epage = EVENT_PAGE (data);
- priv = epage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+ client = comp_editor_get_client (editor);
/* Make a copy of the list store in case the user cancels */
temp_list_store = e_alarm_list_new ();
@@ -2892,11 +2760,11 @@ alarm_custom_clicked_cb (GtkWidget *widget, gpointer data)
}
toplevel = gtk_widget_get_toplevel (priv->main);
- if (alarm_list_dialog_run (toplevel, COMP_EDITOR_PAGE (epage)->client, temp_list_store)) {
+ if (alarm_list_dialog_run (toplevel, client, temp_list_store)) {
g_object_unref (priv->alarm_list_store);
priv->alarm_list_store = temp_list_store;
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (epage));
+ comp_editor_set_changed (editor, TRUE);
} else {
g_object_unref (temp_list_store);
}
@@ -2912,14 +2780,17 @@ alarm_custom_clicked_cb (GtkWidget *widget, gpointer data)
static gboolean
init_widgets (EventPage *epage)
{
- EventPagePrivate *priv;
+ EventPagePrivate *priv = epage->priv;
+ CompEditor *editor;
GtkTextBuffer *text_buffer;
icaltimezone *zone;
char *menu_label = NULL;
GtkTreeSelection *selection;
GtkWidget *cus_item, *menu;
+ ECal *client;
- priv = epage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+ client = comp_editor_get_client (editor);
/* Make sure the EDateEdit widgets use our timezones to get the
current time. */
@@ -2936,20 +2807,12 @@ init_widgets (EventPage *epage)
/* Summary */
g_signal_connect((priv->summary), "changed",
G_CALLBACK (summary_changed_cb), epage);
- g_signal_connect(priv->summary, "focus-in-event",
- G_CALLBACK (widget_focus_in_cb), epage);
- g_signal_connect(priv->summary, "focus-out-event",
- G_CALLBACK (widget_focus_out_cb), epage);
/* Description */
text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->description));
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (priv->description), GTK_WRAP_WORD);
- g_signal_connect(priv->description, "focus-in-event",
- G_CALLBACK (widget_focus_in_cb), epage);
- g_signal_connect(priv->description, "focus-out-event",
- G_CALLBACK (widget_focus_out_cb), epage);
/* Start and end times */
g_signal_connect((priv->start_time), "changed",
@@ -2966,12 +2829,15 @@ init_widgets (EventPage *epage)
G_CALLBACK (source_changed_cb), epage);
/* Alarms */
priv->alarm_list_store = e_alarm_list_new ();
- g_signal_connect((GtkTreeModel *)(priv->alarm_list_store), "row-inserted",
- G_CALLBACK (alarm_store_inserted_cb), epage);
- g_signal_connect((GtkTreeModel *)(priv->alarm_list_store), "row-deleted",
- G_CALLBACK (alarm_store_deleted_cb), epage);
- g_signal_connect((GtkTreeModel *)(priv->alarm_list_store), "row-changed",
- G_CALLBACK (alarm_store_changed_cb), epage);
+ g_signal_connect_swapped (
+ priv->alarm_list_store, "row-inserted",
+ G_CALLBACK (comp_editor_page_changed), epage);
+ g_signal_connect_swapped (
+ priv->alarm_list_store, "row-deleted",
+ G_CALLBACK (comp_editor_page_changed), epage);
+ g_signal_connect_swapped (
+ priv->alarm_list_store, "row-changed",
+ G_CALLBACK (comp_editor_page_changed), epage);
/* Timezone changed */
g_signal_connect((priv->start_timezone), "changed",
@@ -3005,7 +2871,7 @@ init_widgets (EventPage *epage)
/* Alarm dialog */
g_signal_connect (GTK_DIALOG (priv->alarm_dialog), "response", G_CALLBACK (gtk_widget_hide), priv->alarm_dialog);
g_signal_connect (GTK_DIALOG (priv->alarm_dialog), "delete-event", G_CALLBACK (gtk_widget_hide), priv->alarm_dialog);
- priv->alarm_list_dlg_widget = alarm_list_dialog_peek (priv->client, priv->alarm_list_store);
+ priv->alarm_list_dlg_widget = alarm_list_dialog_peek (client, priv->alarm_list_store);
gtk_widget_reparent (priv->alarm_list_dlg_widget, priv->alarm_box);
gtk_widget_show_all (priv->alarm_list_dlg_widget);
gtk_widget_hide (priv->alarm_dialog);
@@ -3080,35 +2946,38 @@ init_widgets (EventPage *epage)
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->alarm_time));
gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), cus_item);
- g_signal_connect (priv->alarm_time, "changed",
- G_CALLBACK (field_changed_cb), epage);
- g_signal_connect (priv->alarm_time, "changed",
- G_CALLBACK (alarm_changed_cb), epage);
+ g_signal_connect_swapped (
+ priv->alarm_time, "changed",
+ G_CALLBACK (comp_editor_page_changed), epage);
+ g_signal_connect (
+ priv->alarm_time, "changed",
+ G_CALLBACK (alarm_changed_cb), epage);
/* Belongs to priv->description */
- g_signal_connect((text_buffer), "changed",
- G_CALLBACK (field_changed_cb), epage);
-
- g_signal_connect((priv->summary), "changed",
- G_CALLBACK (field_changed_cb), epage);
- g_signal_connect((priv->location), "changed",
- G_CALLBACK (field_changed_cb), epage);
- g_signal_connect((priv->location), "focus-in-event",
- G_CALLBACK (widget_focus_in_cb), epage);
- g_signal_connect((priv->location), "focus-out-event",
- G_CALLBACK (widget_focus_out_cb), epage);
- g_signal_connect((priv->start_time), "changed",
- G_CALLBACK (field_changed_cb), epage);
- g_signal_connect((priv->end_time), "changed",
- G_CALLBACK (field_changed_cb), epage);
- g_signal_connect((priv->categories), "changed",
- G_CALLBACK (field_changed_cb), epage);
-
- /* emit signal when the group is changed */
- g_signal_connect((priv->source_selector),"changed",G_CALLBACK(field_changed_cb),epage);
-
- /*call the field_changed_cb when the timezone is changed*/
- g_signal_connect((priv->start_timezone), "changed",G_CALLBACK (field_changed_cb), epage);
+ g_signal_connect_swapped (
+ text_buffer, "changed",
+ G_CALLBACK (comp_editor_page_changed), epage);
+ g_signal_connect_swapped (
+ priv->summary, "changed",
+ G_CALLBACK (comp_editor_page_changed), epage);
+ g_signal_connect_swapped (
+ priv->location, "changed",
+ G_CALLBACK (comp_editor_page_changed), epage);
+ g_signal_connect_swapped (
+ priv->start_time, "changed",
+ G_CALLBACK (comp_editor_page_changed), epage);
+ g_signal_connect_swapped (
+ priv->end_time, "changed",
+ G_CALLBACK (comp_editor_page_changed), epage);
+ g_signal_connect_swapped (
+ priv->categories, "changed",
+ G_CALLBACK (comp_editor_page_changed), epage);
+ g_signal_connect_swapped (
+ priv->source_selector, "changed",
+ G_CALLBACK (comp_editor_page_changed), epage);
+ g_signal_connect_swapped (
+ priv->start_timezone, "changed",
+ G_CALLBACK (comp_editor_page_changed), epage);
/* Set the default timezone, so the timezone entry may be hidden. */
zone = calendar_config_get_icaltimezone ();
@@ -3125,8 +2994,10 @@ init_widgets (EventPage *epage)
static void
event_page_select_organizer (EventPage *epage, const char *backend_address)
{
- EventPagePrivate *priv;
+ EventPagePrivate *priv = epage->priv;
+ CompEditor *editor;
GList *l;
+ ECal *client;
EAccount *def_account;
gchar *def_address = NULL;
const char *default_address;
@@ -3138,9 +3009,11 @@ event_page_select_organizer (EventPage *epage, const char *backend_address)
if (def_account && def_account->enabled)
def_address = g_strdup_printf("%s <%s>", def_account->id->name, def_account->id->address);
- priv = epage->priv;
- if (COMP_EDITOR_PAGE (epage)->client)
- source = e_cal_get_source (COMP_EDITOR_PAGE (epage)->client);
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
+ client = comp_editor_get_client (editor);
+
+ if (client)
+ source = e_cal_get_source (client);
if (source)
user_addr = e_source_get_property (source, "subscriber");
@@ -3182,7 +3055,7 @@ event_page_select_organizer (EventPage *epage, const char *backend_address)
* created.
**/
EventPage *
-event_page_construct (EventPage *epage, EMeetingStore *model, ECal *client)
+event_page_construct (EventPage *epage, EMeetingStore *model)
{
EventPagePrivate *priv;
EIterator *it;
@@ -3192,7 +3065,6 @@ event_page_construct (EventPage *epage, EMeetingStore *model, ECal *client)
priv = epage->priv;
g_object_ref (model);
priv->model = model;
- priv->client = client;
gladefile = g_build_filename (EVOLUTION_GLADEDIR,
"event-page.glade",
@@ -3254,18 +3126,16 @@ event_page_construct (EventPage *epage, EMeetingStore *model, ECal *client)
* not be created.
**/
EventPage *
-event_page_new (EMeetingStore *model, ECal *client, BonoboUIComponent *uic)
+event_page_new (EMeetingStore *model, CompEditor *editor)
{
EventPage *epage;
- epage = g_object_new (TYPE_EVENT_PAGE, NULL);
- if (!event_page_construct (epage, model, client)) {
+ epage = g_object_new (TYPE_EVENT_PAGE, "editor", editor, NULL);
+ if (!event_page_construct (epage, model)) {
g_object_unref (epage);
- return NULL;
+ g_return_val_if_reached (NULL);
}
- epage->priv->uic = uic;
-
return epage;
}
diff --git a/calendar/gui/dialogs/event-page.h b/calendar/gui/dialogs/event-page.h
index 26e4dea9dd..2f61631960 100644
--- a/calendar/gui/dialogs/event-page.h
+++ b/calendar/gui/dialogs/event-page.h
@@ -24,62 +24,86 @@
#ifndef EVENT_PAGE_H
#define EVENT_PAGE_H
-#include <bonobo/bonobo-window.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-widget.h>
+#include "comp-editor.h"
#include "comp-editor-page.h"
#include "../e-meeting-attendee.h"
#include "../e-meeting-store.h"
#include "../e-meeting-list-view.h"
-G_BEGIN_DECLS
-
-
+/* Standard GObject macros */
+#define TYPE_EVENT_PAGE \
+ (event_page_get_type ())
+#define EVENT_PAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), TYPE_EVENT_PAGE, EventPage))
+#define EVENT_PAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), TYPE_EVENT_PAGE, EventPageClass))
+#define IS_EVENT_PAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), TYPE_EVENT_PAGE))
+#define IS_EVENT_PAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((obj), TYPE_EVENT_PAGE))
+#define EVENT_PAGE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), TYPE_EVENT_PAGE, EventPageClass))
-#define TYPE_EVENT_PAGE (event_page_get_type ())
-#define EVENT_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_EVENT_PAGE, EventPage))
-#define EVENT_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_EVENT_PAGE, EventPageClass))
-#define IS_EVENT_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_EVENT_PAGE))
-#define IS_EVENT_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), TYPE_EVENT_PAGE))
+G_BEGIN_DECLS
+typedef struct _EventPage EventPage;
+typedef struct _EventPageClass EventPageClass;
typedef struct _EventPagePrivate EventPagePrivate;
-typedef struct {
+struct _EventPage {
CompEditorPage page;
-
- /* Private data */
EventPagePrivate *priv;
-} EventPage;
+};
-typedef struct {
+struct _EventPageClass {
CompEditorPageClass parent_class;
-} EventPageClass;
-
+};
-GType event_page_get_type (void);
-EventPage *event_page_construct (EventPage *epage, EMeetingStore *model, ECal *client);
-EventPage *event_page_new (EMeetingStore *model, ECal *client, BonoboUIComponent *uic);
-ECalComponent *event_page_get_cancel_comp (EventPage *page);
-void event_page_show_options (EventPage *page);
-void event_page_hide_options (EventPage *page);
-void event_page_sendoptions_clicked_cb (EventPage *epage);
-void event_page_set_meeting (EventPage *page, gboolean set);
-void event_page_set_show_timezone (EventPage *epage, gboolean state);
-void event_page_set_view_rsvp (EventPage *epage, gboolean state);
-void event_page_set_classification (EventPage *epage, ECalComponentClassification class);
-void event_page_set_delegate (EventPage *page, gboolean set);
-void event_page_set_all_day_event (EventPage *epage, gboolean all_day);
-void event_page_set_show_categories (EventPage *epage, gboolean state);
-void event_page_set_show_time_busy (EventPage *epage, gboolean state);
-void event_page_show_alarm (EventPage *epage);
-void event_page_set_info_string (EventPage *epage, const gchar *icon, const gchar *msg);
+GType event_page_get_type (void);
+EventPage * event_page_construct (EventPage *epage,
+ EMeetingStore *model);
+EventPage * event_page_new (EMeetingStore *model,
+ CompEditor *editor);
+ECalComponent * event_page_get_cancel_comp (EventPage *page);
+void event_page_show_options (EventPage *page);
+void event_page_hide_options (EventPage *page);
+void event_page_sendoptions_clicked_cb
+ (EventPage *epage);
+void event_page_set_meeting (EventPage *page,
+ gboolean set);
+void event_page_set_show_timezone (EventPage *epage,
+ gboolean state);
+void event_page_set_view_rsvp (EventPage *epage,
+ gboolean state);
+void event_page_set_delegate (EventPage *page,
+ gboolean set);
+void event_page_set_all_day_event (EventPage *epage,
+ gboolean all_day);
+void event_page_set_show_categories (EventPage *epage,
+ gboolean state);
+void event_page_set_show_time_busy (EventPage *epage,
+ gboolean state);
+void event_page_show_alarm (EventPage *epage);
+void event_page_set_info_string (EventPage *epage,
+ const gchar *icon,
+ const gchar *msg);
-void event_page_set_view_role (EventPage *epage, gboolean state);
-void event_page_set_view_status (EventPage *epage, gboolean state);
-void event_page_set_view_type (EventPage *epage, gboolean state);
-void event_page_set_view_rvsp (EventPage *epage, gboolean state);
-ENameSelector *event_page_get_name_selector (EventPage *epage);
-void event_page_add_attendee (EventPage *epage, EMeetingAttendee *attendee);
+void event_page_set_view_role (EventPage *epage,
+ gboolean state);
+void event_page_set_view_status (EventPage *epage,
+ gboolean state);
+void event_page_set_view_type (EventPage *epage,
+ gboolean state);
+void event_page_set_view_rvsp (EventPage *epage,
+ gboolean state);
+ENameSelector * event_page_get_name_selector (EventPage *epage);
+void event_page_add_attendee (EventPage *epage,
+ EMeetingAttendee *attendee);
G_END_DECLS
diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c
index f3f211d430..a4c73e8dee 100644
--- a/calendar/gui/dialogs/memo-editor.c
+++ b/calendar/gui/dialogs/memo-editor.c
@@ -32,252 +32,113 @@
#include <glade/glade.h>
#include <glib/gi18n.h>
-#include <evolution-shell-component-utils.h>
+#include <e-util/e-plugin-ui.h>
#include <e-util/e-util-private.h>
+#include <evolution-shell-component-utils.h>
+
#include "memo-page.h"
#include "cancel-comp.h"
-#include "../calendar-config.h"
#include "memo-editor.h"
+#define MEMO_EDITOR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), TYPE_MEMO_EDITOR, MemoEditorPrivate))
+
struct _MemoEditorPrivate {
MemoPage *memo_page;
gboolean updating;
};
-static void memo_editor_set_e_cal (CompEditor *editor, ECal *client);
-static void memo_editor_edit_comp (CompEditor *editor, ECalComponent *comp);
-static gboolean memo_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method);
-static void memo_editor_finalize (GObject *object);
+/* Extends the UI definition in CompEditor */
+static const gchar *ui =
+"<ui>"
+" <menubar action='main-menu'>"
+" <menu action='view-menu'>"
+" <menuitem action='view-categories'/>"
+" </menu>"
+" <menu action='options-menu'>"
+" <menu action='classification-menu'>"
+" <menuitem action='classify-public'/>"
+" <menuitem action='classify-private'/>"
+" <menuitem action='classify-confidential'/>"
+" </menu>"
+" </menu>"
+" </menubar>"
+"</ui>";
G_DEFINE_TYPE (MemoEditor, memo_editor, TYPE_COMP_EDITOR)
-
-
-/**
- * memo_editor_get_type:
- *
- * Registers the #MemoEditor class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the #MemoEditor class.
- **/
-
-/* Class initialization function for the event editor */
static void
-memo_editor_class_init (MemoEditorClass *klass)
+memo_editor_show_categories (CompEditor *editor,
+ gboolean visible)
{
- GObjectClass *object_class;
- CompEditorClass *editor_class;
-
- object_class = (GObjectClass *) klass;
- editor_class = (CompEditorClass *) klass;
-
- editor_class->set_e_cal = memo_editor_set_e_cal;
- editor_class->edit_comp = memo_editor_edit_comp;
- editor_class->send_comp = memo_editor_send_comp;
+ MemoEditorPrivate *priv;
- object_class->finalize = memo_editor_finalize;
-}
+ priv = MEMO_EDITOR_GET_PRIVATE (editor);
-static void
-init_widgets (MemoEditor *me)
-{
+ memo_page_set_show_categories (priv->memo_page, visible);
}
static void
-client_changed_cb (CompEditorPage *page, ECal *client, gpointer user_data)
+memo_editor_dispose (GObject *object)
{
-/* set_menu_sens (MEMO_EDITOR (user_data)); */
-}
-
-static void
-menu_show_categories_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
-{
- MemoEditor *me = (MemoEditor *) user_data;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
-
- memo_page_set_show_categories (me->priv->memo_page, atoi(state));
- calendar_config_set_show_categories (atoi(state));
-}
+ MemoEditorPrivate *priv;
-static void
-menu_class_public_cb (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
-{
- MemoEditor *me = (MemoEditor *) user_data;
+ priv = MEMO_EDITOR_GET_PRIVATE (object);
- if (state[0] == '0')
- return;
+ if (priv->memo_page) {
+ g_object_unref (priv->memo_page);
+ priv->memo_page = NULL;
+ }
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (me->priv->memo_page));
- memo_page_set_classification (me->priv->memo_page, E_CAL_COMPONENT_CLASS_PUBLIC);
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (memo_editor_parent_class)->dispose (object);
}
static void
-menu_class_private_cb (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+memo_editor_class_init (MemoEditorClass *class)
{
- MemoEditor *me = (MemoEditor *) user_data;
- if (state[0] == '0')
- return;
+ GObjectClass *object_class;
+ CompEditorClass *editor_class;
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (me->priv->memo_page));
- memo_page_set_classification (me->priv->memo_page, E_CAL_COMPONENT_CLASS_PRIVATE);
-}
+ g_type_class_add_private (class, sizeof (MemoEditorPrivate));
-static void
-menu_class_confidential_cb (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
-{
- MemoEditor *me = (MemoEditor *) user_data;
- if (state[0] == '0')
- return;
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = memo_editor_dispose;
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (me->priv->memo_page));
- memo_page_set_classification (me->priv->memo_page, E_CAL_COMPONENT_CLASS_CONFIDENTIAL);
+ /* TODO Add a help section for memos. */
+ editor_class = COMP_EDITOR_CLASS (class);
+ /*editor_class->help_section = "usage-calendar-memo";*/
+ editor_class->show_categories = memo_editor_show_categories;
}
/* Object initialization function for the memo editor */
static void
memo_editor_init (MemoEditor *me)
{
- MemoEditorPrivate *priv;
- CompEditor *editor = COMP_EDITOR(me);
- gboolean status;
- char *xmlfile;
-
- priv = g_new0 (MemoEditorPrivate, 1);
- me->priv = priv;
-
- priv->updating = FALSE;
-
- bonobo_ui_component_freeze (editor->uic, NULL);
-
- xmlfile = g_build_filename (EVOLUTION_UIDIR, "evolution-memo-editor.xml", NULL);
- bonobo_ui_util_set_ui (editor->uic, PREFIX,
- xmlfile,
- "evolution-memo-editor", NULL);
- g_free (xmlfile);
-
- status = calendar_config_get_show_categories ();
- bonobo_ui_component_set_prop (
- editor->uic, "/commands/ViewCategories",
- "state", status ? "1" : "0", NULL);
- bonobo_ui_component_add_listener (
- editor->uic, "ViewCategories",
- menu_show_categories_cb, editor);
-
- bonobo_ui_component_set_prop (
- editor->uic, "/commands/ActionClassPublic",
- "state", "1", NULL);
- bonobo_ui_component_add_listener (
- editor->uic, "ActionClassPublic",
- menu_class_public_cb, editor);
- bonobo_ui_component_add_listener (
- editor->uic, "ActionClassPrivate",
- menu_class_private_cb, editor);
- bonobo_ui_component_add_listener (
- editor->uic, "ActionClassConfidential",
- menu_class_confidential_cb, editor);
-
- bonobo_ui_component_thaw (editor->uic, NULL);
-
- /* TODO add help stuff */
-/* comp_editor_set_help_section (COMP_EDITOR (me), "usage-calendar-memo"); */
-}
-
-MemoEditor *
-memo_editor_construct (MemoEditor *me, ECal *client)
-{
- MemoEditorPrivate *priv;
CompEditor *editor = COMP_EDITOR (me);
- gboolean read_only = FALSE;
- guint32 flags = comp_editor_get_flags (editor);
-
- priv = me->priv;
-
- priv->memo_page = memo_page_new (editor->uic, flags);
- g_object_ref_sink (priv->memo_page);
- comp_editor_append_page (COMP_EDITOR (me),
- COMP_EDITOR_PAGE (priv->memo_page),
- _("Memo"), TRUE);
- g_signal_connect (G_OBJECT (priv->memo_page), "client_changed",
- G_CALLBACK (client_changed_cb), me);
-
- if (!e_cal_is_read_only (client, &read_only, NULL))
- read_only = TRUE;
-
- bonobo_ui_component_set_prop (editor->uic, "/Toolbar/ecal3", "hidden", "1", NULL);
- comp_editor_set_e_cal (COMP_EDITOR (me), client);
-
-
-
- init_widgets (me);
-
- return me;
-}
-
-static void
-memo_editor_set_e_cal (CompEditor *editor, ECal *client)
-{
- if (COMP_EDITOR_CLASS (memo_editor_parent_class)->set_e_cal)
- COMP_EDITOR_CLASS (memo_editor_parent_class)->set_e_cal (editor, client);
-}
-
-static void
-memo_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
-{
- if (COMP_EDITOR_CLASS (memo_editor_parent_class)->edit_comp)
- COMP_EDITOR_CLASS (memo_editor_parent_class)->edit_comp (editor, comp);
-}
-
-static gboolean
-memo_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method)
-{
- if (COMP_EDITOR_CLASS (memo_editor_parent_class)->send_comp)
- return COMP_EDITOR_CLASS (memo_editor_parent_class)->send_comp (editor, method);
-
- return FALSE;
-}
-
-/* Destroy handler for the event editor */
-static void
-memo_editor_finalize (GObject *object)
-{
- MemoEditor *me;
- MemoEditorPrivate *priv;
+ GtkUIManager *manager;
+ GError *error = NULL;
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_MEMO_EDITOR (object));
+ me->priv = MEMO_EDITOR_GET_PRIVATE (me);
+ me->priv->updating = FALSE;
- me = MEMO_EDITOR (object);
- priv = me->priv;
+ manager = comp_editor_get_ui_manager (editor);
+ gtk_ui_manager_add_ui_from_string (manager, ui, -1, &error);
+ e_plugin_ui_register_manager ("memo-editor", manager, me);
- if (priv->memo_page) {
- g_object_unref (priv->memo_page);
- priv->memo_page = NULL;
+ if (error != NULL) {
+ g_critical ("%s: %s", G_STRFUNC, error->message);
+ g_error_free (error);
}
- g_free (priv);
-
- if (G_OBJECT_CLASS (memo_editor_parent_class)->finalize)
- (* G_OBJECT_CLASS (memo_editor_parent_class)->finalize) (object);
+ me->priv->memo_page = memo_page_new (editor);
+ g_object_ref_sink (me->priv->memo_page);
+ comp_editor_append_page (
+ COMP_EDITOR (me),
+ COMP_EDITOR_PAGE (me->priv->memo_page),
+ _("Memo"), TRUE);
}
/**
@@ -289,13 +150,12 @@ memo_editor_finalize (GObject *object)
* Return value: A newly-created event editor dialog, or NULL if the event
* editor could not be created.
**/
-MemoEditor *
+CompEditor *
memo_editor_new (ECal *client, CompEditorFlags flags)
{
- MemoEditor *me;
+ g_return_val_if_fail (E_IS_CAL (client), NULL);
- me = g_object_new (TYPE_MEMO_EDITOR, NULL);
- comp_editor_set_flags (COMP_EDITOR (me), flags);
- return memo_editor_construct (me, client);
+ return g_object_new (
+ TYPE_MEMO_EDITOR,
+ "flags", flags, "client", client, NULL);
}
-
diff --git a/calendar/gui/dialogs/memo-editor.h b/calendar/gui/dialogs/memo-editor.h
index 76f8ccb5df..ab229584e5 100644
--- a/calendar/gui/dialogs/memo-editor.h
+++ b/calendar/gui/dialogs/memo-editor.h
@@ -28,12 +28,26 @@
#include <gtk/gtk.h>
#include "comp-editor.h"
-#define TYPE_MEMO_EDITOR (memo_editor_get_type ())
-#define MEMO_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MEMO_EDITOR, MemoEditor))
-#define MEMO_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MEMO_EDITOR, \
- MemoEditorClass))
-#define IS_MEMO_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MEMO_EDITOR))
-#define IS_MEMO_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MEMO_EDITOR))
+/* Standard GObject macros */
+#define TYPE_MEMO_EDITOR \
+ (memo_editor_get_type ())
+#define MEMO_EDITOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), TYPE_MEMO_EDITOR, MemoEditor))
+#define MEMO_EDITOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), TYPE_MEMO_EDITOR, MemoEditorClass))
+#define IS_MEMO_EDITOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), TYPE_MEMO_EDITOR))
+#define IS_MEMO_EDITOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), TYPE_MEMO_EDITOR))
+#define MEMO_EDITOR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), TYPE_MEMO_EDITOR, MemoEditorClass))
+
+G_BEGIN_DECLS
typedef struct _MemoEditor MemoEditor;
typedef struct _MemoEditorClass MemoEditorClass;
@@ -41,8 +55,6 @@ typedef struct _MemoEditorPrivate MemoEditorPrivate;
struct _MemoEditor {
CompEditor parent;
-
- /* Private data */
MemoEditorPrivate *priv;
};
@@ -50,10 +62,10 @@ struct _MemoEditorClass {
CompEditorClass parent_class;
};
-GType memo_editor_get_type (void);
-MemoEditor *memo_editor_construct (MemoEditor *te,
- ECal *client);
-MemoEditor *memo_editor_new (ECal *client, CompEditorFlags flags);
+GType memo_editor_get_type (void);
+CompEditor * memo_editor_new (ECal *client,
+ CompEditorFlags flags);
+G_END_DECLS
#endif /* __MEMO_EDITOR_H__ */
diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c
index e5aacb2937..9f3e5d85d4 100644
--- a/calendar/gui/dialogs/memo-page.c
+++ b/calendar/gui/dialogs/memo-page.c
@@ -47,8 +47,11 @@
#include "e-send-options-utils.h"
#include "memo-page.h"
+#define MEMO_PAGE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), TYPE_MEMO_PAGE, MemoPagePrivate))
-/* Private part of the TaskPage structure */
+/* Private part of the MemoPage structure */
struct _MemoPagePrivate {
/* Glade XML data */
GladeXML *xml;
@@ -60,11 +63,6 @@ struct _MemoPagePrivate {
EAccountList *accounts;
- /* Bonobo Controller for the menu/toolbar */
- BonoboUIComponent *uic;
-
- ECalComponentClassification classification;
-
/* Generic informative messages placeholder */
GtkWidget *info_hbox;
GtkWidget *info_icon;
@@ -95,278 +93,100 @@ struct _MemoPagePrivate {
GList *address_strings;
ENameSelector *name_selector;
-
- gboolean updating;
-};
-
-static const int classification_map[] = {
- E_CAL_COMPONENT_CLASS_PUBLIC,
- E_CAL_COMPONENT_CLASS_PRIVATE,
- E_CAL_COMPONENT_CLASS_CONFIDENTIAL,
- -1
};
-
-
-static void memo_page_finalize (GObject *object);
-
-static GtkWidget *memo_page_get_widget (CompEditorPage *page);
-static void memo_page_focus_main_widget (CompEditorPage *page);
-static gboolean memo_page_fill_widgets (CompEditorPage *page, ECalComponent *comp);
+static void set_subscriber_info_string (MemoPage *mpage, const gchar *backend_address);
+static const char * get_recipients (ECalComponent *comp);
+static void sensitize_widgets (MemoPage *mpage);
static gboolean memo_page_fill_component (CompEditorPage *page, ECalComponent *comp);
static void memo_page_select_organizer (MemoPage *mpage, const char *backend_address);
-static void set_subscriber_info_string (MemoPage *mpage, const char *backend_address);
G_DEFINE_TYPE (MemoPage, memo_page, TYPE_COMP_EDITOR_PAGE)
-
-
-/**
- * memo_page_get_type:
- *
- * Registers the #TaskPage class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the #TaskPage class.
- **/
-
-/* Class initialization function for the memo page */
+/* Fills the widgets with default values */
static void
-memo_page_class_init (MemoPageClass *klass)
+clear_widgets (MemoPage *mpage)
{
- CompEditorPageClass *editor_page_class;
- GObjectClass *object_class;
+ GtkTextBuffer *buffer;
+ GtkTextView *view;
+ CompEditor *editor;
- editor_page_class = (CompEditorPageClass *) klass;
- object_class = (GObjectClass *) klass;
+ /* Summary */
+ e_dialog_editable_set (mpage->priv->summary_entry, NULL);
- editor_page_class->get_widget = memo_page_get_widget;
- editor_page_class->focus_main_widget = memo_page_focus_main_widget;
- editor_page_class->fill_widgets = memo_page_fill_widgets;
- editor_page_class->fill_component = memo_page_fill_component;
+ /* Description */
+ view = GTK_TEXT_VIEW (mpage->priv->memo_content);
+ buffer = gtk_text_view_get_buffer (view);
+ gtk_text_buffer_set_text (buffer, "", 0);
- object_class->finalize = memo_page_finalize;
+ /* Classification */
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage));
+ comp_editor_set_classification (editor, E_CAL_COMPONENT_CLASS_PRIVATE);
+
+ /* Categories */
+ e_dialog_editable_set (mpage->priv->categories, NULL);
}
-/* Object initialization function for the memo page */
static void
-memo_page_init (MemoPage *mpage)
+memo_page_dispose (GObject *object)
{
MemoPagePrivate *priv;
- priv = g_new0 (MemoPagePrivate, 1);
- mpage->priv = priv;
-
- priv->xml = NULL;
-
- priv->main = NULL;
- priv->memo_content = NULL;
- priv->classification = E_CAL_COMPONENT_CLASS_NONE;
- priv->categories_btn = NULL;
- priv->categories = NULL;
+ priv = MEMO_PAGE_GET_PRIVATE (object);
- priv->info_hbox = NULL;
- priv->info_icon = NULL;
- priv->info_string = NULL;
-
- priv->updating = FALSE;
+ g_list_foreach (priv->address_strings, (GFunc) g_free, NULL);
+ g_list_free (priv->address_strings);
- priv->address_strings = NULL;
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (memo_page_parent_class)->dispose (object);
}
-/* Destroy handler for the memo page */
static void
memo_page_finalize (GObject *object)
{
- MemoPage *mpage;
MemoPagePrivate *priv;
- GList *l;
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_MEMO_PAGE (object));
-
- mpage = MEMO_PAGE (object);
- priv = mpage->priv;
+ priv = MEMO_PAGE_GET_PRIVATE (object);
- for (l = priv->address_strings; l != NULL; l = l->next)
- g_free (l->data);
- g_list_free (priv->address_strings);
-
- if (priv->main)
+ if (priv->main != NULL) {
g_object_unref (priv->main);
+ priv->main = NULL;
+ }
if (priv->xml) {
g_object_unref (priv->xml);
priv->xml = NULL;
}
- g_free (priv);
- mpage->priv = NULL;
-
- if (G_OBJECT_CLASS (memo_page_parent_class)->finalize)
- (* G_OBJECT_CLASS (memo_page_parent_class)->finalize) (object);
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (memo_page_parent_class)->finalize (object);
}
-static void
-set_classification_menu (MemoPage *page, gint class)
-{
- bonobo_ui_component_freeze (page->priv->uic, NULL);
- switch (class) {
- case E_CAL_COMPONENT_CLASS_PUBLIC:
- bonobo_ui_component_set_prop (
- page->priv->uic, "/commands/ActionClassPublic",
- "state", "1", NULL);
- break;
- case E_CAL_COMPONENT_CLASS_CONFIDENTIAL:
- bonobo_ui_component_set_prop (
- page->priv->uic, "/commands/ActionClassConfidential",
- "state", "1", NULL);
- break;
- case E_CAL_COMPONENT_CLASS_PRIVATE:
- bonobo_ui_component_set_prop (
- page->priv->uic, "/commands/ActionClassPrivate",
- "state", "1", NULL);
- break;
- }
- bonobo_ui_component_thaw (page->priv->uic, NULL);
-}
-
-/* get_widget handler for the task page */
static GtkWidget *
memo_page_get_widget (CompEditorPage *page)
{
- MemoPage *mpage;
- MemoPagePrivate *priv;
-
- mpage = MEMO_PAGE (page);
- priv = mpage->priv;
+ MemoPagePrivate *priv = MEMO_PAGE_GET_PRIVATE (page);
return priv->main;
}
-/* focus_main_widget handler for the memo page */
static void
memo_page_focus_main_widget (CompEditorPage *page)
{
- MemoPage *mpage;
- MemoPagePrivate *priv;
-
- mpage = MEMO_PAGE (page);
- priv = mpage->priv;
+ MemoPagePrivate *priv = MEMO_PAGE_GET_PRIVATE (page);
gtk_widget_grab_focus (priv->summary_entry);
}
-/* Fills the widgets with default values */
-static void
-clear_widgets (MemoPage *mpage)
-{
- MemoPagePrivate *priv;
-
- priv = mpage->priv;
-
- /* Summary */
- e_dialog_editable_set (priv->summary_entry, NULL);
-
- /* memo content */
- gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->memo_content)), "", 0);
-
- /* Classification */
- priv->classification = E_CAL_COMPONENT_CLASS_PRIVATE;
- set_classification_menu (mpage, priv->classification);
-
- /* Categories */
- e_dialog_editable_set (priv->categories, NULL);
-}
-
-void
-memo_page_set_classification (MemoPage *page, ECalComponentClassification class)
-{
- page->priv->classification = class;
-}
-
-static void
-sensitize_widgets (MemoPage *mpage)
-{
- gboolean read_only, sens = FALSE, sensitize;
- MemoPagePrivate *priv;
-
- priv = mpage->priv;
-
- if (!e_cal_is_read_only (COMP_EDITOR_PAGE (mpage)->client, &read_only, NULL))
- read_only = TRUE;
-
- if (COMP_EDITOR_PAGE (mpage)->flags & COMP_EDITOR_IS_SHARED)
- sens = COMP_EDITOR_PAGE (mpage)->flags & COMP_EDITOR_PAGE_USER_ORG;
- else
- sens = TRUE;
-
- sensitize = (!read_only && sens);
-
- priv = mpage->priv;
-
- /* The list of organizers is set to be non-editable. Otherwise any
- * change in the displayed list causes an 'Account not found' error.
- */
- gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (priv->org_combo)->entry), FALSE);
-
- gtk_text_view_set_editable (GTK_TEXT_VIEW (priv->memo_content), sensitize);
- gtk_widget_set_sensitive (priv->start_date, sensitize);
- gtk_widget_set_sensitive (priv->categories_btn, !read_only);
- gtk_editable_set_editable (GTK_EDITABLE (priv->categories), !read_only);
- gtk_editable_set_editable (GTK_EDITABLE (priv->summary_entry), sensitize);
-
- if (COMP_EDITOR_PAGE (mpage)->flags & COMP_EDITOR_IS_SHARED) {
- if (priv->to_entry) {
- gtk_editable_set_editable (GTK_EDITABLE (priv->to_entry), !read_only);
- gtk_widget_grab_focus (priv->to_entry);
- }
- }
-
- bonobo_ui_component_set_prop (priv->uic, "/commands/ActionClassPublic", "sensitive", sensitize ? "1" : "0"
- , NULL);
- bonobo_ui_component_set_prop (priv->uic, "/commands/ActionClassPrivate", "sensitive", sensitize ? "1" : "0"
- , NULL);
- bonobo_ui_component_set_prop (priv->uic, "/commands/ActionClassConfidential", "sensitive",
- sensitize ? "1" : "0", NULL);
- bonobo_ui_component_set_prop (priv->uic, "/commands/InsertAttachments", "sensitive", sensitize ? "1" : "0"
- , NULL);
-}
-
-/* returns empty string rather than NULL because of simplicity of usage */
-static const char *
-get_recipients (ECalComponent *comp)
-{
- icalcomponent *icalcomp;
- icalproperty *icalprop;
-
- g_return_val_if_fail (comp != NULL, "");
-
- icalcomp = e_cal_component_get_icalcomponent (comp);
-
- /* first look if we have there such property */
- for (icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
- icalprop;
- icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY)) {
- const char *xname = icalproperty_get_x_name (icalprop);
-
- if (xname && strcmp (xname, "X-EVOLUTION-RECIPIENTS") == 0)
- break;
- }
-
- if (icalprop)
- return icalproperty_get_x (icalprop);
-
- return "";
-}
-
-
-/* fill_widgets handler for the memo page */
static gboolean
-memo_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
+memo_page_fill_widgets (CompEditorPage *page,
+ ECalComponent *comp)
{
MemoPage *mpage;
MemoPagePrivate *priv;
+ CompEditor *editor;
+ CompEditorFlags flags;
+ ECal *client;
ECalComponentClassification cl;
ECalComponentText text;
ECalComponentDateTime d;
@@ -377,7 +197,9 @@ memo_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
mpage = MEMO_PAGE (page);
priv = mpage->priv;
- priv->updating = TRUE;
+ editor = comp_editor_page_get_editor (page);
+ client = comp_editor_get_client (editor);
+ flags = comp_editor_get_flags (editor);
/* Clean the screen */
clear_widgets (mpage);
@@ -406,41 +228,19 @@ memo_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
e_date_edit_set_date (E_DATE_EDIT (priv->start_date),
start_tt->year, start_tt->month,
start_tt->day);
- } else if (!(page->flags & COMP_EDITOR_PAGE_NEW_ITEM))
+ } else if (!(flags & COMP_EDITOR_NEW_ITEM))
e_date_edit_set_time (E_DATE_EDIT (priv->start_date), -1);
e_cal_component_free_datetime (&d);
/* Classification. */
e_cal_component_get_classification (comp, &cl);
-
- switch (cl) {
- case E_CAL_COMPONENT_CLASS_PUBLIC:
- {
- cl = E_CAL_COMPONENT_CLASS_PUBLIC;
- break;
- }
- case E_CAL_COMPONENT_CLASS_PRIVATE:
- {
- cl = E_CAL_COMPONENT_CLASS_PRIVATE;
- break;
- }
- case E_CAL_COMPONENT_CLASS_CONFIDENTIAL:
- {
- cl = E_CAL_COMPONENT_CLASS_CONFIDENTIAL;
- break;
- }
- default:
- /* default to PUBLIC */
- cl = E_CAL_COMPONENT_CLASS_PUBLIC;
- break;
- }
- set_classification_menu (mpage, cl);
+ comp_editor_set_classification (editor, cl);
/* Categories */
e_cal_component_get_categories (comp, &categories);
e_dialog_editable_set (priv->categories, categories);
- e_cal_get_cal_address (COMP_EDITOR_PAGE (mpage)->client, &backend_addr, NULL);
+ e_cal_get_cal_address (client, &backend_addr, NULL);
set_subscriber_info_string (mpage, backend_addr);
if (e_cal_component_has_organizer (comp)) {
@@ -457,7 +257,7 @@ memo_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
else
string = g_strdup (strip);
- if (itip_organizer_is_user (comp, page->client) || itip_sentby_is_user (comp)) {
+ if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp)) {
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->org_combo)->entry), string);
} else {
list = g_list_append (list, string);
@@ -475,18 +275,117 @@ memo_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
/* Source */
e_source_combo_box_set_active (
E_SOURCE_COMBO_BOX (priv->source_selector),
- e_cal_get_source (page->client));
+ e_cal_get_source (client));
- if (priv->to_entry && (page->flags & COMP_EDITOR_PAGE_IS_SHARED) && !(page->flags & COMP_EDITOR_PAGE_NEW_ITEM))
+ if (priv->to_entry && (flags & COMP_EDITOR_IS_SHARED) && !(flags & COMP_EDITOR_NEW_ITEM))
gtk_entry_set_text (GTK_ENTRY (priv->to_entry), get_recipients (comp));
- priv->updating = FALSE;
-
sensitize_widgets (mpage);
return TRUE;
}
+static void
+memo_page_class_init (MemoPageClass *class)
+{
+ CompEditorPageClass *editor_page_class;
+ GObjectClass *object_class;
+
+ g_type_class_add_private (class, sizeof (MemoPagePrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = memo_page_dispose;
+ object_class->finalize = memo_page_finalize;
+
+ editor_page_class = COMP_EDITOR_PAGE_CLASS (class);
+ editor_page_class->get_widget = memo_page_get_widget;
+ editor_page_class->focus_main_widget = memo_page_focus_main_widget;
+ editor_page_class->fill_widgets = memo_page_fill_widgets;
+ editor_page_class->fill_component = memo_page_fill_component;
+}
+
+static void
+memo_page_init (MemoPage *mpage)
+{
+ mpage->priv = MEMO_PAGE_GET_PRIVATE (mpage);
+}
+
+static void
+sensitize_widgets (MemoPage *mpage)
+{
+ GtkActionGroup *action_group;
+ gboolean read_only, sens = FALSE, sensitize;
+ CompEditor *editor;
+ CompEditorFlags flags;
+ MemoPagePrivate *priv;
+ ECal *client;
+
+ priv = mpage->priv;
+
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage));
+ client = comp_editor_get_client (editor);
+ flags = comp_editor_get_flags (editor);
+
+ if (!e_cal_is_read_only (client, &read_only, NULL))
+ read_only = TRUE;
+
+ if (flags & COMP_EDITOR_IS_SHARED)
+ sens = flags & COMP_EDITOR_USER_ORG;
+ else
+ sens = TRUE;
+
+ sensitize = (!read_only && sens);
+
+ /* The list of organizers is set to be non-editable. Otherwise any
+ * change in the displayed list causes an 'Account not found' error.
+ */
+ gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (priv->org_combo)->entry), FALSE);
+
+ gtk_text_view_set_editable (GTK_TEXT_VIEW (priv->memo_content), sensitize);
+ gtk_widget_set_sensitive (priv->start_date, sensitize);
+ gtk_widget_set_sensitive (priv->categories_btn, !read_only);
+ gtk_editable_set_editable (GTK_EDITABLE (priv->categories), !read_only);
+ gtk_editable_set_editable (GTK_EDITABLE (priv->summary_entry), sensitize);
+
+ if (flags & COMP_EDITOR_IS_SHARED) {
+ if (priv->to_entry) {
+ gtk_editable_set_editable (GTK_EDITABLE (priv->to_entry), !read_only);
+ gtk_widget_grab_focus (priv->to_entry);
+ }
+ }
+
+ action_group = comp_editor_get_action_group (editor, "individual");
+ gtk_action_group_set_sensitive (action_group, sensitize);
+}
+
+/* returns empty string rather than NULL because of simplicity of usage */
+static const char *
+get_recipients (ECalComponent *comp)
+{
+ icalcomponent *icalcomp;
+ icalproperty *icalprop;
+
+ g_return_val_if_fail (comp != NULL, "");
+
+ icalcomp = e_cal_component_get_icalcomponent (comp);
+
+ /* first look if we have there such property */
+ for (icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
+ icalprop;
+ icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY)) {
+ const char *xname = icalproperty_get_x_name (icalprop);
+
+ if (xname && strcmp (xname, "X-EVOLUTION-RECIPIENTS") == 0)
+ break;
+ }
+
+ if (icalprop)
+ return icalproperty_get_x (icalprop);
+
+ return "";
+}
+
+
static gboolean
fill_comp_with_recipients (ENameSelector *name_selector, ECalComponent *comp)
{
@@ -607,12 +506,10 @@ fill_comp_with_recipients (ENameSelector *name_selector, ECalComponent *comp)
static EAccount *
get_current_account (MemoPage *page)
{
- MemoPagePrivate *priv;
+ MemoPagePrivate *priv = page->priv;
EIterator *it;
const char *str;
- priv = page->priv;
-
str = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (priv->org_combo)->entry));
if (!str)
return NULL;
@@ -637,10 +534,15 @@ get_current_account (MemoPage *page)
/* fill_component handler for the memo page */
static gboolean
-memo_page_fill_component (CompEditorPage *page, ECalComponent *comp)
+memo_page_fill_component (CompEditorPage *page,
+ ECalComponent *comp)
{
MemoPage *mpage;
MemoPagePrivate *priv;
+ CompEditor *editor;
+ CompEditorFlags flags;
+ ECal *client;
+ ECalComponentClassification classification;
ECalComponentDateTime start_date;
struct icaltimetype start_tt;
char *cat, *str;
@@ -650,6 +552,11 @@ memo_page_fill_component (CompEditorPage *page, ECalComponent *comp)
mpage = MEMO_PAGE (page);
priv = mpage->priv;
+
+ editor = comp_editor_page_get_editor (page);
+ client = comp_editor_get_client (editor);
+ flags = comp_editor_get_flags (editor);
+
text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->memo_content));
/* Summary */
@@ -738,7 +645,8 @@ memo_page_fill_component (CompEditorPage *page, ECalComponent *comp)
e_cal_component_set_dtstart (comp, NULL);
/* Classification. */
- e_cal_component_set_classification (comp, priv->classification);
+ classification = comp_editor_get_classification (editor);
+ e_cal_component_set_classification (comp, classification);
/* Categories */
cat = e_dialog_editable_get (priv->categories);
@@ -752,13 +660,13 @@ memo_page_fill_component (CompEditorPage *page, ECalComponent *comp)
g_free (str);
/* change recipients only when creating new item, after that no such action is available */
- if ((page->flags & COMP_EDITOR_PAGE_IS_SHARED) && (page->flags & COMP_EDITOR_PAGE_NEW_ITEM) && fill_comp_with_recipients (priv->name_selector, comp)) {
+ if ((flags & COMP_EDITOR_IS_SHARED) && (flags & COMP_EDITOR_NEW_ITEM) && fill_comp_with_recipients (priv->name_selector, comp)) {
ECalComponentOrganizer organizer = {NULL, NULL, NULL, NULL};
EAccount *a;
gchar *backend_addr = NULL, *org_addr = NULL, *sentby = NULL;
- e_cal_get_cal_address (page->client, &backend_addr, NULL);
+ e_cal_get_cal_address (client, &backend_addr, NULL);
/* Find the identity for the organizer or sentby field */
a = get_current_account (mpage);
@@ -789,8 +697,8 @@ memo_page_fill_component (CompEditorPage *page, ECalComponent *comp)
e_cal_component_set_organizer (comp, &organizer);
- if (page->flags & COMP_EDITOR_PAGE_NEW_ITEM)
- comp_editor_page_notify_needs_send (page);
+ if (flags & COMP_EDITOR_NEW_ITEM)
+ comp_editor_set_needs_send (editor, TRUE);
g_free (backend_addr);
g_free (org_addr);
@@ -893,89 +801,82 @@ get_widgets (MemoPage *mpage)
* category list dialog.
*/
static void
-categories_clicked_cb (GtkWidget *button, gpointer data)
-{
- MemoPage *mpage;
- MemoPagePrivate *priv;
- GtkWidget *entry;
-
- mpage = MEMO_PAGE (data);
- priv = mpage->priv;
-
- entry = priv->categories;
- e_categories_config_open_dialog_for_entry (GTK_ENTRY (entry));
-}
-
-/* This is called when any field is changed; it notifies upstream. */
-static void
-field_changed_cb (GtkWidget *widget, gpointer data)
+categories_clicked_cb (GtkWidget *button,
+ MemoPage *mpage)
{
- MemoPage *mpage;
- MemoPagePrivate *priv;
-
- mpage = MEMO_PAGE (data);
- priv = mpage->priv;
+ GtkEntry *entry;
- if (!priv->updating)
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (mpage));
+ entry = GTK_ENTRY (mpage->priv->categories);
+ e_categories_config_open_dialog_for_entry (entry);
}
static void
-source_changed_cb (ESourceComboBox *source_combo_box, MemoPage *mpage)
+source_changed_cb (ESourceComboBox *source_combo_box,
+ MemoPage *mpage)
{
MemoPagePrivate *priv = mpage->priv;
+ CompEditor *editor;
+ CompEditorFlags flags;
ESource *source;
+ ECal *client;
- source = e_source_combo_box_get_active (source_combo_box);
+ if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (mpage)))
+ return;
- if (!priv->updating) {
- ECal *client;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage));
+ flags = comp_editor_get_flags (editor);
- client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_JOURNAL);
- if (!client || !e_cal_open (client, FALSE, NULL)) {
- GtkWidget *dialog;
+ client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_JOURNAL);
+ source = e_source_combo_box_get_active (source_combo_box);
- if (client)
- g_object_unref (client);
+ if (!client || !e_cal_open (client, FALSE, NULL)) {
+ GtkWidget *dialog;
+ ECal *old_client;
- e_source_combo_box_set_active (
- E_SOURCE_COMBO_BOX (priv->source_selector),
- e_cal_get_source (COMP_EDITOR_PAGE (mpage)->client));
+ old_client = comp_editor_get_client (editor);
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
- GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
- _("Unable to open memos in '%s'."),
- e_source_peek_name (source));
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
- } else {
- comp_editor_notify_client_changed (
- COMP_EDITOR (gtk_widget_get_toplevel (priv->main)),
- client);
+ if (client)
+ g_object_unref (client);
- if (client) {
- gchar *backend_addr = NULL;
+ e_source_combo_box_set_active (
+ E_SOURCE_COMBO_BOX (priv->source_selector),
+ e_cal_get_source (old_client));
- e_cal_get_cal_address(client, &backend_addr, NULL);
+ dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
+ GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
+ _("Unable to open memos in '%s'."),
+ e_source_peek_name (source));
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ } else {
+ comp_editor_set_client (editor, client);
- if (COMP_EDITOR_PAGE (mpage)->flags & COMP_EDITOR_PAGE_IS_SHARED)
- memo_page_select_organizer (mpage, backend_addr);
+ if (client) {
+ gchar *backend_addr = NULL;
- set_subscriber_info_string (mpage, backend_addr);
- g_free (backend_addr);
- }
+ e_cal_get_cal_address(client, &backend_addr, NULL);
+
+ if (flags & COMP_EDITOR_IS_SHARED)
+ memo_page_select_organizer (mpage, backend_addr);
- sensitize_widgets (mpage);
+ set_subscriber_info_string (mpage, backend_addr);
+ g_free (backend_addr);
}
+
+ sensitize_widgets (mpage);
}
}
static void
-set_subscriber_info_string (MemoPage *mpage, const char *backend_address)
+set_subscriber_info_string (MemoPage *mpage,
+ const gchar *backend_address)
{
- ECal *client = COMP_EDITOR_PAGE (mpage)->client;
+ CompEditor *editor;
+ ECal *client;
ESource *source;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage));
+ client = comp_editor_get_client (editor);
source = e_cal_get_source (client);
if (e_source_get_property (source, "subscriber"))
@@ -987,136 +888,106 @@ set_subscriber_info_string (MemoPage *mpage, const char *backend_address)
memo_page_set_info_string (mpage, NULL, NULL);
}
-/*sets the current focused widget */
-static gboolean
-widget_focus_in_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data)
-{
- MemoPage *mpage;
- mpage = MEMO_PAGE (data);
-
- comp_editor_page_set_focused_widget (COMP_EDITOR_PAGE (mpage), widget);
-
- return FALSE;
-}
-
-/*unset the current focused widget */
-static gboolean
-widget_focus_out_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data)
-{
- MemoPage *mpage;
- mpage = MEMO_PAGE (data);
-
- comp_editor_page_unset_focused_widget (COMP_EDITOR_PAGE (mpage), widget);
-
- return FALSE;
-}
-
-/* Callback used when the summary changes; we emit the notification signal. */
static void
-summary_changed_cb (GtkEditable *editable, gpointer data)
+summary_changed_cb (GtkEditable *editable,
+ CompEditorPage *page)
{
- MemoPage *mpage;
- MemoPagePrivate *priv;
+ CompEditor *editor;
gchar *summary;
- mpage = MEMO_PAGE (data);
- priv = mpage->priv;
-
- if (priv->updating)
+ if (comp_editor_page_get_updating (page))
return;
+ editor = comp_editor_page_get_editor (page);
summary = e_dialog_editable_get (GTK_WIDGET (editable));
- comp_editor_page_notify_summary_changed (COMP_EDITOR_PAGE (mpage),
- summary);
+ comp_editor_set_summary (editor, summary);
g_free (summary);
}
static void
-to_button_clicked_cb (GtkButton *button, gpointer data)
+to_button_clicked_cb (GtkButton *button,
+ MemoPage *mpage)
{
- MemoPage *page = data;
- MemoPagePrivate *priv = page->priv;
ENameSelectorDialog *name_selector_dialog;
- name_selector_dialog = e_name_selector_peek_dialog (priv->name_selector);
+ name_selector_dialog = e_name_selector_peek_dialog (
+ mpage->priv->name_selector);
gtk_widget_show (GTK_WIDGET (name_selector_dialog));
}
-static void
-response_cb (ENameSelectorDialog *name_selector_dialog, gint response, gpointer user_data)
-{
- gtk_widget_hide (GTK_WIDGET (name_selector_dialog));
-}
-
/* Hooks the widget signals */
static gboolean
init_widgets (MemoPage *mpage)
{
- MemoPagePrivate *priv;
- GtkTextBuffer *text_buffer;
-
- priv = mpage->priv;
+ MemoPagePrivate *priv = mpage->priv;
+ GtkTextBuffer *buffer;
+ GtkTextView *view;
/* Generic informative messages */
gtk_widget_hide (priv->info_hbox);
/* Summary */
- g_signal_connect((priv->summary_entry), "changed",
- G_CALLBACK (summary_changed_cb), mpage);
- g_signal_connect(priv->summary_entry, "focus-in-event",
- G_CALLBACK (widget_focus_in_cb), mpage);
- g_signal_connect(priv->summary_entry, "focus-out-event",
- G_CALLBACK (widget_focus_out_cb), mpage);
+ g_signal_connect (
+ priv->summary_entry, "changed",
+ G_CALLBACK (summary_changed_cb), mpage);
/* Memo Content */
- text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->memo_content));
-
- gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (priv->memo_content), GTK_WRAP_WORD);
-
- g_signal_connect(priv->memo_content, "focus-in-event",
- G_CALLBACK (widget_focus_in_cb), mpage);
- g_signal_connect(priv->memo_content, "focus-out-event",
- G_CALLBACK (widget_focus_out_cb), mpage);
+ view = GTK_TEXT_VIEW (priv->memo_content);
+ buffer = gtk_text_view_get_buffer (view);
+ gtk_text_view_set_wrap_mode (view, GTK_WRAP_WORD);
/* Categories button */
- g_signal_connect((priv->categories_btn), "clicked",
- G_CALLBACK (categories_clicked_cb), mpage);
+ g_signal_connect(
+ priv->categories_btn, "clicked",
+ G_CALLBACK (categories_clicked_cb), mpage);
/* Source selector */
- g_signal_connect((priv->source_selector), "changed",
- G_CALLBACK (source_changed_cb), mpage);
+ g_signal_connect (
+ priv->source_selector, "changed",
+ G_CALLBACK (source_changed_cb), mpage);
/* Connect the default signal handler to use to make sure the "changed"
field gets set whenever a field is changed. */
/* Belongs to priv->memo_content */
- g_signal_connect ((text_buffer), "changed",
- G_CALLBACK (field_changed_cb), mpage);
+ g_signal_connect_swapped (
+ buffer, "changed",
+ G_CALLBACK (comp_editor_page_changed), mpage);
- g_signal_connect((priv->categories), "changed",
- G_CALLBACK (field_changed_cb), mpage);
+ g_signal_connect_swapped (
+ priv->categories, "changed",
+ G_CALLBACK (comp_editor_page_changed), mpage);
- g_signal_connect((priv->summary_entry), "changed",
- G_CALLBACK (field_changed_cb), mpage);
+ g_signal_connect_swapped (
+ priv->summary_entry, "changed",
+ G_CALLBACK (comp_editor_page_changed), mpage);
- g_signal_connect((priv->source_selector), "changed",
- G_CALLBACK (field_changed_cb), mpage);
+ g_signal_connect_swapped (
+ priv->source_selector, "changed",
+ G_CALLBACK (comp_editor_page_changed), mpage);
- g_signal_connect((priv->start_date), "changed",
- G_CALLBACK (field_changed_cb), mpage);
+ g_signal_connect_swapped (
+ priv->start_date, "changed",
+ G_CALLBACK (comp_editor_page_changed), mpage);
if (priv->name_selector) {
ENameSelectorDialog *name_selector_dialog;
name_selector_dialog = e_name_selector_peek_dialog (priv->name_selector);
- g_signal_connect (name_selector_dialog, "response",
- G_CALLBACK (response_cb), mpage);
- g_signal_connect ((priv->to_button), "clicked", G_CALLBACK (to_button_clicked_cb), mpage);
- g_signal_connect ((priv->to_entry), "changed", G_CALLBACK (field_changed_cb), mpage);
+ g_signal_connect (
+ name_selector_dialog, "response",
+ G_CALLBACK (gtk_widget_hide), NULL);
+ g_signal_connect (
+ priv->to_button, "clicked",
+ G_CALLBACK (to_button_clicked_cb), mpage);
+ g_signal_connect_swapped (
+ priv->to_entry, "changed",
+ G_CALLBACK (comp_editor_page_changed), mpage);
}
- memo_page_set_show_categories (mpage, calendar_config_get_show_categories());
+ memo_page_set_show_categories (
+ mpage, calendar_config_get_show_categories());
return TRUE;
}
@@ -1138,7 +1009,10 @@ static void
memo_page_select_organizer (MemoPage *mpage, const char *backend_address)
{
MemoPagePrivate *priv;
+ CompEditor *editor;
+ CompEditorFlags flags;
GList *l;
+ ECal *client;
EAccount *def_account;
gchar *def_address = NULL;
const char *default_address;
@@ -1151,8 +1025,12 @@ memo_page_select_organizer (MemoPage *mpage, const char *backend_address)
def_address = g_strdup_printf("%s <%s>", def_account->id->name, def_account->id->address);
priv = mpage->priv;
- if (COMP_EDITOR_PAGE (mpage)->client)
- source = e_cal_get_source (COMP_EDITOR_PAGE (mpage)->client);
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage));
+ client = comp_editor_get_client (editor);
+ flags = comp_editor_get_flags (editor);
+
+ if (client)
+ source = e_cal_get_source (client);
if (source)
user_addr = e_source_get_property (source, "subscriber");
@@ -1173,7 +1051,7 @@ memo_page_select_organizer (MemoPage *mpage, const char *backend_address)
default_address = def_address;
if (default_address) {
- if (COMP_EDITOR_PAGE (mpage)->flags & COMP_EDITOR_PAGE_NEW_ITEM) {
+ if (flags & COMP_EDITOR_NEW_ITEM) {
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->org_combo)->entry), default_address);
/* FIXME: Use accessor functions to access private members of a GtkCombo widget */
gtk_widget_set_sensitive (GTK_WIDGET (GTK_COMBO (priv->org_combo)->button), !subscribed_cal);
@@ -1196,13 +1074,15 @@ memo_page_select_organizer (MemoPage *mpage, const char *backend_address)
MemoPage *
memo_page_construct (MemoPage *mpage)
{
- MemoPagePrivate *priv;
+ MemoPagePrivate *priv = mpage->priv;
+ CompEditor *editor;
+ CompEditorFlags flags;
EIterator *it;
char *gladefile;
EAccount *a;
- CompEditorPageFlags flags = COMP_EDITOR_PAGE (mpage)->flags;
- priv = mpage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage));
+ flags = comp_editor_get_flags (editor);
gladefile = g_build_filename (EVOLUTION_GLADEDIR,
"memo-page.glade",
@@ -1222,7 +1102,7 @@ memo_page_construct (MemoPage *mpage)
return NULL;
}
- if (flags & COMP_EDITOR_PAGE_IS_SHARED) {
+ if (flags & COMP_EDITOR_IS_SHARED) {
priv->accounts = itip_addresses_get ();
for (it = e_list_get_iterator((EList *)priv->accounts);
e_iterator_is_valid(it);
@@ -1257,7 +1137,7 @@ memo_page_construct (MemoPage *mpage)
gtk_widget_show (priv->to_entry);
gtk_widget_show (priv->to_button);
- if (!(flags & COMP_EDITOR_PAGE_NEW_ITEM)) {
+ if (!(flags & COMP_EDITOR_NEW_ITEM)) {
gtk_widget_set_sensitive (priv->to_button, FALSE);
gtk_widget_set_sensitive (priv->to_entry, FALSE);
}
@@ -1281,17 +1161,17 @@ memo_page_construct (MemoPage *mpage)
* not be created.
**/
MemoPage *
-memo_page_new (BonoboUIComponent *uic, CompEditorPageFlags flags)
+memo_page_new (CompEditor *editor)
{
MemoPage *mpage;
- mpage = g_object_new (TYPE_MEMO_PAGE, NULL);
- mpage->priv->uic = uic;
- COMP_EDITOR_PAGE (mpage)->flags = flags;
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL);
+
+ mpage = g_object_new (TYPE_MEMO_PAGE, "editor", editor, NULL);
if (!memo_page_construct (mpage)) {
g_object_unref (mpage);
- return NULL;
+ g_return_val_if_reached (NULL);
}
return mpage;
@@ -1302,13 +1182,13 @@ GtkWidget *memo_page_create_date_edit (void);
GtkWidget *
memo_page_create_date_edit (void)
{
- GtkWidget *dedit;
+ GtkWidget *widget;
- dedit = comp_editor_new_date_edit (TRUE, FALSE, TRUE);
- e_date_edit_set_allow_no_date_set (E_DATE_EDIT (dedit), TRUE);
- gtk_widget_show (dedit);
+ widget = comp_editor_new_date_edit (TRUE, FALSE, TRUE);
+ e_date_edit_set_allow_no_date_set (E_DATE_EDIT (widget), TRUE);
+ gtk_widget_show (widget);
- return dedit;
+ return widget;
}
GtkWidget *memo_page_create_source_combo_box (void);
@@ -1316,18 +1196,19 @@ GtkWidget *memo_page_create_source_combo_box (void);
GtkWidget *
memo_page_create_source_combo_box (void)
{
- GtkWidget *combo_box;
- GConfClient *gconf_client;
+ GtkWidget *widget;
+ GConfClient *client;
ESourceList *source_list;
- gconf_client = gconf_client_get_default ();
+ client = gconf_client_get_default ();
source_list = e_source_list_new_for_gconf (
- gconf_client, "/apps/evolution/memos/sources");
+ client, "/apps/evolution/memos/sources");
+
+ widget = e_source_combo_box_new (source_list);
+ gtk_widget_show (widget);
- combo_box = e_source_combo_box_new (source_list);
g_object_unref (source_list);
- g_object_unref (gconf_client);
+ g_object_unref (client);
- gtk_widget_show (combo_box);
- return combo_box;
+ return widget;
}
diff --git a/calendar/gui/dialogs/memo-page.h b/calendar/gui/dialogs/memo-page.h
index 9e62214d00..c96eba9999 100644
--- a/calendar/gui/dialogs/memo-page.h
+++ b/calendar/gui/dialogs/memo-page.h
@@ -24,38 +24,52 @@
#ifndef MEMO_PAGE_H
#define MEMO_PAGE_H
-#include <bonobo/bonobo-window.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-widget.h>
+#include "comp-editor.h"
#include "comp-editor-page.h"
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define TYPE_MEMO_PAGE \
+ (memo_page_get_type ())
+#define MEMO_PAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), TYPE_MEMO_PAGE, MemoPage))
+#define MEMO_PAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), TYPE_MEMO_PAGE, MemoPageClass))
+#define IS_MEMO_PAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), TYPE_MEMO_PAGE))
+#define IS_MEMO_PAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((obj), TYPE_MEMO_PAGE))
+#define MEMO_PAGE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), TYPE_MEMO_PAGE, MemoPageClass))
-#define TYPE_MEMO_PAGE (memo_page_get_type ())
-#define MEMO_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MEMO_PAGE, MemoPage))
-#define MEMO_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MEMO_PAGE, MemoPageClass))
-#define IS_MEMO_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MEMO_PAGE))
-#define IS_MEMO_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), TYPE_MEMO_PAGE))
+G_BEGIN_DECLS
+typedef struct _MemoPage MemoPage;
+typedef struct _MemoPageClass MemoPageClass;
typedef struct _MemoPagePrivate MemoPagePrivate;
-typedef struct {
+struct _MemoPage {
CompEditorPage page;
-
- /* Private data */
MemoPagePrivate *priv;
-} MemoPage;
+};
-typedef struct {
+struct _MemoPageClass {
CompEditorPageClass parent_class;
-} MemoPageClass;
-
-GType memo_page_get_type (void);
-MemoPage *memo_page_construct (MemoPage *epage);
-MemoPage *memo_page_new (BonoboUIComponent *uic, CompEditorPageFlags flags);
-void memo_page_set_classification (MemoPage *page, ECalComponentClassification class);
-void memo_page_set_show_categories (MemoPage *page, gboolean state);
-void memo_page_set_info_string (MemoPage *mpage, const gchar *icon, const gchar *msg);
+};
+
+GType memo_page_get_type (void);
+MemoPage * memo_page_construct (MemoPage *epage);
+MemoPage * memo_page_new (CompEditor *editor);
+void memo_page_set_show_categories (MemoPage *page,
+ gboolean state);
+void memo_page_set_info_string (MemoPage *mpage,
+ const gchar *icon,
+ const gchar *msg);
+
G_END_DECLS
#endif
diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c
index 9165ba38d3..062d0ad0c0 100644
--- a/calendar/gui/dialogs/recurrence-page.c
+++ b/calendar/gui/dialogs/recurrence-page.c
@@ -45,7 +45,9 @@
#include "../e-mini-calendar-config.h"
#include "recurrence-page.h"
-
+#define RECURRENCE_PAGE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), TYPE_RECURRENCE_PAGE, RecurrencePagePrivate))
enum month_num_options {
MONTH_NUM_FIRST,
@@ -183,146 +185,208 @@ struct _RecurrencePagePrivate {
/* For the recurrence preview, the actual widget */
GtkWidget *preview_calendar;
EMiniCalendarConfig *preview_calendar_config;
-
- gboolean updating;
};
static void recurrence_page_finalize (GObject *object);
+static gboolean fill_component (RecurrencePage *rpage, ECalComponent *comp);
static GtkWidget *recurrence_page_get_widget (CompEditorPage *page);
static void recurrence_page_focus_main_widget (CompEditorPage *page);
static gboolean recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp);
static gboolean recurrence_page_fill_component (CompEditorPage *page, ECalComponent *comp);
static void recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates);
-static void preview_date_range_changed_cb (ECalendarItem *item, gpointer data);
-static void interval_selection_done_cb (GtkOptionMenu *menu, gpointer data);
-static void ending_selection_done_cb (GtkOptionMenu *menu, gpointer data);
+static void preview_date_range_changed_cb (ECalendarItem *item, RecurrencePage *rpage);
-static void field_changed (RecurrencePage *apage);
static void make_ending_count_special (RecurrencePage *rpage);
static void make_ending_special (RecurrencePage *rpage);
G_DEFINE_TYPE (RecurrencePage, recurrence_page, TYPE_COMP_EDITOR_PAGE)
-/* Class initialization function for the recurrence page */
+/* Re-tags the recurrence preview calendar based on the current information of
+ * the widgets in the recurrence page.
+ */
static void
-recurrence_page_class_init (RecurrencePageClass *class)
+preview_recur (RecurrencePage *rpage)
{
- CompEditorPageClass *editor_page_class;
- GObjectClass *object_class;
+ RecurrencePagePrivate *priv = rpage->priv;
+ CompEditor *editor;
+ ECal *client;
+ ECalComponent *comp;
+ ECalComponentDateTime cdt;
+ GSList *l;
+ icaltimezone *zone = NULL;
- editor_page_class = (CompEditorPageClass *) class;
- object_class = (GObjectClass *) class;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage));
+ client = comp_editor_get_client (editor);
- editor_page_class->get_widget = recurrence_page_get_widget;
- editor_page_class->focus_main_widget = recurrence_page_focus_main_widget;
- editor_page_class->fill_widgets = recurrence_page_fill_widgets;
- editor_page_class->fill_component = recurrence_page_fill_component;
- editor_page_class->set_dates = recurrence_page_set_dates;
+ /* If our component has not been set yet through ::fill_widgets(), we
+ * cannot preview the recurrence.
+ */
+ if (!priv || !priv->comp || e_cal_component_is_instance (priv->comp))
+ return;
- object_class->finalize = recurrence_page_finalize;
+ /* Create a scratch component with the start/end and
+ * recurrence/exception information from the one we are editing.
+ */
+
+ comp = e_cal_component_new ();
+ e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT);
+
+ e_cal_component_get_dtstart (priv->comp, &cdt);
+ if (cdt.tzid != NULL) {
+ /* FIXME Will e_cal_get_timezone really not return builtin zones? */
+ if (!e_cal_get_timezone (client, cdt.tzid, &zone, NULL))
+ zone = icaltimezone_get_builtin_timezone_from_tzid (cdt.tzid);
+ }
+ e_cal_component_set_dtstart (comp, &cdt);
+ e_cal_component_free_datetime (&cdt);
+
+ e_cal_component_get_dtend (priv->comp, &cdt);
+ e_cal_component_set_dtend (comp, &cdt);
+ e_cal_component_free_datetime (&cdt);
+
+ e_cal_component_get_exdate_list (priv->comp, &l);
+ e_cal_component_set_exdate_list (comp, l);
+ e_cal_component_free_exdate_list (l);
+
+ e_cal_component_get_exrule_list (priv->comp, &l);
+ e_cal_component_set_exrule_list (comp, l);
+ e_cal_component_free_recur_list (l);
+
+ e_cal_component_get_rdate_list (priv->comp, &l);
+ e_cal_component_set_rdate_list (comp, l);
+ e_cal_component_free_period_list (l);
+
+ e_cal_component_get_rrule_list (priv->comp, &l);
+ e_cal_component_set_rrule_list (comp, l);
+ e_cal_component_free_recur_list (l);
+
+ fill_component (rpage, comp);
+
+ tag_calendar_by_comp (E_CALENDAR (priv->preview_calendar), comp,
+ client, zone, TRUE, FALSE);
+ g_object_unref(comp);
}
-/* Object initialization function for the recurrence page */
-static void
-recurrence_page_init (RecurrencePage *rpage)
+static GObject *
+recurrence_page_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties)
{
- RecurrencePagePrivate *priv;
+ GObject *object;
+ CompEditor *editor;
- priv = g_new0 (RecurrencePagePrivate, 1);
- rpage->priv = priv;
+ /* Chain up to parent's constructor() method. */
+ object = G_OBJECT_CLASS (recurrence_page_parent_class)->constructor (
+ type, n_construct_properties, construct_properties);
- priv->xml = NULL;
+ /* Keep the calendar updated as the user twizzles widgets. */
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (object));
- priv->main = NULL;
- priv->recurs = NULL;
- priv->custom = FALSE;
- priv->params = NULL;
- priv->interval_value = NULL;
- priv->interval_unit = NULL;
- priv->special = NULL;
- priv->ending_menu = NULL;
- priv->ending_special = NULL;
- priv->custom_warning_bin = NULL;
- priv->weekday_picker = NULL;
- priv->month_day_menu = NULL;
- priv->month_num_menu = NULL;
- priv->ending_date_edit = NULL;
- priv->ending_count_spin = NULL;
- priv->exception_list = NULL;
- priv->exception_add = NULL;
- priv->exception_modify = NULL;
- priv->exception_delete = NULL;
- priv->preview_bin = NULL;
- priv->preview_calendar = NULL;
-
- priv->comp = NULL;
+ g_signal_connect_swapped (
+ editor, "notify::changed",
+ G_CALLBACK (preview_recur), object);
+
+ return object;
}
-/* Destroy handler for the recurrence page */
static void
-recurrence_page_finalize (GObject *object)
+recurrence_page_dispose (GObject *object)
{
- RecurrencePage *rpage;
RecurrencePagePrivate *priv;
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_RECURRENCE_PAGE (object));
+ priv = RECURRENCE_PAGE_GET_PRIVATE (object);
- rpage = RECURRENCE_PAGE (object);
- priv = rpage->priv;
-
- g_signal_handlers_disconnect_matched (E_CALENDAR (priv->preview_calendar)->calitem, G_SIGNAL_MATCH_FUNC,
- 0, 0, NULL, preview_date_range_changed_cb, NULL);
-
- g_signal_handlers_disconnect_by_func (GTK_OPTION_MENU (priv->interval_unit),
- G_CALLBACK (interval_selection_done_cb), rpage);
- g_signal_handlers_disconnect_by_func (GTK_OPTION_MENU (priv->ending_menu),
- G_CALLBACK (ending_selection_done_cb), rpage);
-
- if (priv->main)
+ if (priv->main != NULL) {
g_object_unref (priv->main);
+ priv->main = NULL;
+ }
- if (priv->xml) {
+ if (priv->xml != NULL) {
g_object_unref (priv->xml);
priv->xml = NULL;
}
- if (priv->comp) {
+ if (priv->comp != NULL) {
g_object_unref (priv->comp);
priv->comp = NULL;
}
- if (priv->exception_list_store) {
+ if (priv->exception_list_store != NULL) {
g_object_unref (priv->exception_list_store);
priv->exception_list_store = NULL;
}
- if (priv->preview_calendar_config) {
+ if (priv->preview_calendar_config != NULL) {
g_object_unref (priv->preview_calendar_config);
priv->preview_calendar_config = NULL;
}
- g_free (priv);
- rpage->priv = NULL;
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (recurrence_page_parent_class)->dispose (object);
+}
+
+static void
+recurrence_page_finalize (GObject *object)
+{
+ RecurrencePagePrivate *priv;
+
+ priv = RECURRENCE_PAGE_GET_PRIVATE (object);
+
+ g_signal_handlers_disconnect_matched (
+ E_CALENDAR (priv->preview_calendar)->calitem,
+ G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
+ preview_date_range_changed_cb, NULL);
+
+ g_signal_handlers_disconnect_matched (
+ priv->interval_unit, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, object);
+
+ g_signal_handlers_disconnect_matched (
+ priv->ending_menu, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, object);
- if (G_OBJECT_CLASS (recurrence_page_parent_class)->finalize)
- (* G_OBJECT_CLASS (recurrence_page_parent_class)->finalize) (object);
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (recurrence_page_parent_class)->finalize (object);
}
-
+static void
+recurrence_page_class_init (RecurrencePageClass *class)
+{
+ GObjectClass *object_class;
+ CompEditorPageClass *editor_page_class;
+
+ g_type_class_add_private (class, sizeof (RecurrencePagePrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructor = recurrence_page_constructor;
+ object_class->dispose = recurrence_page_dispose;
+ object_class->finalize = recurrence_page_finalize;
+
+ editor_page_class = COMP_EDITOR_PAGE_CLASS (class);
+ editor_page_class->get_widget = recurrence_page_get_widget;
+ editor_page_class->focus_main_widget = recurrence_page_focus_main_widget;
+ editor_page_class->fill_widgets = recurrence_page_fill_widgets;
+ editor_page_class->fill_component = recurrence_page_fill_component;
+ editor_page_class->set_dates = recurrence_page_set_dates;
+
+}
+
+static void
+recurrence_page_init (RecurrencePage *rpage)
+{
+ rpage->priv = RECURRENCE_PAGE_GET_PRIVATE (rpage);
+}
/* get_widget handler for the recurrence page */
static GtkWidget *
recurrence_page_get_widget (CompEditorPage *page)
{
- RecurrencePage *rpage;
RecurrencePagePrivate *priv;
- rpage = RECURRENCE_PAGE (page);
- priv = rpage->priv;
+ priv = RECURRENCE_PAGE_GET_PRIVATE (page);
return priv->main;
}
@@ -331,11 +395,9 @@ recurrence_page_get_widget (CompEditorPage *page)
static void
recurrence_page_focus_main_widget (CompEditorPage *page)
{
- RecurrencePage *rpage;
RecurrencePagePrivate *priv;
- rpage = RECURRENCE_PAGE (page);
- priv = rpage->priv;
+ priv = RECURRENCE_PAGE_GET_PRIVATE (page);
gtk_widget_grab_focus (priv->recurs);
}
@@ -468,14 +530,17 @@ set_special_defaults (RecurrencePage *rpage)
static void
sensitize_recur_widgets (RecurrencePage *rpage)
{
- RecurrencePagePrivate *priv;
+ RecurrencePagePrivate *priv = rpage->priv;
+ CompEditor *editor;
+ CompEditorFlags flags;
gboolean recurs, sens = TRUE;
GtkWidget *label;
- priv = rpage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage));
+ flags = comp_editor_get_flags (editor);
- if (COMP_EDITOR_PAGE (rpage)->flags & COMP_EDITOR_PAGE_MEETING)
- sens = COMP_EDITOR_PAGE (rpage)->flags & COMP_EDITOR_PAGE_USER_ORG;
+ if (flags & COMP_EDITOR_MEETING)
+ sens = flags & COMP_EDITOR_USER_ORG;
recurs = e_dialog_toggle_get (priv->recurs);
@@ -512,26 +577,35 @@ sensitize_recur_widgets (RecurrencePage *rpage)
static void
sensitize_buttons (RecurrencePage *rpage)
{
+ RecurrencePagePrivate *priv = rpage->priv;
+ CompEditor *editor;
+ CompEditorFlags flags;
gboolean read_only, sensitize = TRUE;
gint selected_rows;
- RecurrencePagePrivate *priv;
icalcomponent *icalcomp;
+ ECal *client;
const char *uid;
- priv = rpage->priv;
- if (COMP_EDITOR_PAGE (rpage)->flags & COMP_EDITOR_PAGE_MEETING)
- sensitize = COMP_EDITOR_PAGE (rpage)->flags & COMP_EDITOR_PAGE_USER_ORG;
+ if (priv->comp == NULL)
+ return;
+
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage));
+ client = comp_editor_get_client (editor);
+ flags = comp_editor_get_flags (editor);
+
+ if (flags & COMP_EDITOR_MEETING)
+ sensitize = flags & COMP_EDITOR_USER_ORG;
selected_rows = gtk_tree_selection_count_selected_rows (
gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->exception_list)));
- if (!e_cal_is_read_only (COMP_EDITOR_PAGE (rpage)->client, &read_only, NULL))
+ if (!e_cal_is_read_only (client, &read_only, NULL))
read_only = TRUE;
if (!read_only) {
e_cal_component_get_uid (priv->comp, &uid);
- if (e_cal_get_static_capability (COMP_EDITOR_PAGE (rpage)->client, CAL_STATIC_CAPABILITY_NO_CONV_TO_RECUR) && e_cal_get_object(COMP_EDITOR_PAGE (rpage)->client, uid, NULL, &icalcomp, NULL)) {
+ if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_CONV_TO_RECUR) && e_cal_get_object (client, uid, NULL, &icalcomp, NULL)) {
read_only = TRUE;
icalcomponent_free (icalcomp);
}
@@ -540,7 +614,7 @@ sensitize_buttons (RecurrencePage *rpage)
GList *list;
/* see if we have detached instances */
- if (e_cal_get_objects_for_uid (COMP_EDITOR_PAGE (rpage)->client, uid, &list, NULL)) {
+ if (e_cal_get_objects_for_uid (client, uid, &list, NULL)) {
if (list && g_list_length (list) > 1)
read_only = TRUE;
@@ -830,81 +904,6 @@ fill_component (RecurrencePage *rpage, ECalComponent *comp)
return TRUE;
}
-/* Re-tags the recurrence preview calendar based on the current information of
- * the widgets in the recurrence page.
- */
-static void
-preview_recur (RecurrencePage *rpage)
-{
- RecurrencePagePrivate *priv;
- ECalComponent *comp;
- ECalComponentDateTime cdt;
- GSList *l;
- icaltimezone *zone = NULL;
-
- priv = rpage->priv;
-
- /* If our component has not been set yet through ::fill_widgets(), we
- * cannot preview the recurrence.
- */
- if (!priv || !priv->comp || e_cal_component_is_instance (priv->comp))
- return;
-
- /* Create a scratch component with the start/end and
- * recurrence/exception information from the one we are editing.
- */
-
- comp = e_cal_component_new ();
- e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT);
-
- e_cal_component_get_dtstart (priv->comp, &cdt);
- if (cdt.tzid != NULL) {
- /* FIXME Will e_cal_get_timezone really not return builtin zones? */
- if (!e_cal_get_timezone (COMP_EDITOR_PAGE (rpage)->client, cdt.tzid, &zone, NULL))
- zone = icaltimezone_get_builtin_timezone_from_tzid (cdt.tzid);
- }
- e_cal_component_set_dtstart (comp, &cdt);
- e_cal_component_free_datetime (&cdt);
-
- e_cal_component_get_dtend (priv->comp, &cdt);
- e_cal_component_set_dtend (comp, &cdt);
- e_cal_component_free_datetime (&cdt);
-
- e_cal_component_get_exdate_list (priv->comp, &l);
- e_cal_component_set_exdate_list (comp, l);
- e_cal_component_free_exdate_list (l);
-
- e_cal_component_get_exrule_list (priv->comp, &l);
- e_cal_component_set_exrule_list (comp, l);
- e_cal_component_free_recur_list (l);
-
- e_cal_component_get_rdate_list (priv->comp, &l);
- e_cal_component_set_rdate_list (comp, l);
- e_cal_component_free_period_list (l);
-
- e_cal_component_get_rrule_list (priv->comp, &l);
- e_cal_component_set_rrule_list (comp, l);
- e_cal_component_free_recur_list (l);
-
- fill_component (rpage, comp);
-
- tag_calendar_by_comp (E_CALENDAR (priv->preview_calendar), comp,
- COMP_EDITOR_PAGE (rpage)->client, zone, TRUE, FALSE);
- g_object_unref(comp);
-}
-
-/* Callback used when the recurrence weekday picker changes */
-static void
-weekday_picker_changed_cb (WeekdayPicker *wp, gpointer data)
-{
- RecurrencePage *rpage;
-
- rpage = RECURRENCE_PAGE (data);
-
- field_changed (rpage);
- preview_recur (rpage);
-}
-
/* Creates the special contents for weekly recurrences */
static void
make_weekly_special (RecurrencePage *rpage)
@@ -941,9 +940,9 @@ make_weekly_special (RecurrencePage *rpage)
weekday_picker_set_week_start_day (wp, calendar_config_get_week_start_day ());
weekday_picker_set_days (wp, priv->weekday_day_mask);
- g_signal_connect((wp), "changed",
- G_CALLBACK (weekday_picker_changed_cb),
- rpage);
+ g_signal_connect_swapped (
+ wp, "changed",
+ G_CALLBACK (comp_editor_page_changed), rpage);
}
@@ -1111,14 +1110,13 @@ make_recur_month_menu (void)
}
static void
-month_num_menu_selection_done_cb (GtkMenuShell *menu_shell, gpointer data)
+month_num_menu_selection_done_cb (GtkMenuShell *menu_shell,
+ RecurrencePage *rpage)
{
- RecurrencePage *rpage;
RecurrencePagePrivate *priv;
enum month_num_options month_num;
enum month_day_options month_day;
- rpage = RECURRENCE_PAGE (data);
priv = rpage->priv;
month_num = e_dialog_option_menu_get (priv->month_num_menu,
@@ -1150,8 +1148,8 @@ month_num_menu_selection_done_cb (GtkMenuShell *menu_shell, gpointer data)
e_dialog_option_menu_set (priv->month_day_menu,
MONTH_DAY_MON,
month_num_options_map);
- field_changed (rpage);
- preview_recur (rpage);
+
+ comp_editor_page_changed (COMP_EDITOR_PAGE (rpage));
}
/* Callback used when the monthly day selection menu changes. We need
@@ -1159,14 +1157,13 @@ month_num_menu_selection_done_cb (GtkMenuShell *menu_shell, gpointer data)
* are 1-31 while a Sunday is the 1st through 5th.
*/
static void
-month_day_menu_selection_done_cb (GtkMenuShell *menu_shell, gpointer data)
+month_day_menu_selection_done_cb (GtkMenuShell *menu_shell,
+ RecurrencePage *rpage)
{
- RecurrencePage *rpage;
RecurrencePagePrivate *priv;
enum month_num_options month_num;
enum month_day_options month_day;
- rpage = RECURRENCE_PAGE (data);
priv = rpage->priv;
month_num = e_dialog_option_menu_get (priv->month_num_menu,
@@ -1181,20 +1178,8 @@ month_day_menu_selection_done_cb (GtkMenuShell *menu_shell, gpointer data)
e_dialog_option_menu_set (priv->month_num_menu,
MONTH_NUM_FIRST,
month_num_options_map);
- field_changed (rpage);
- preview_recur (rpage);
-}
-/* Callback used when the month index value changes. */
-static void
-month_index_value_changed_cb (GtkAdjustment *adj, gpointer data)
-{
- RecurrencePage *rpage;
-
- rpage = RECURRENCE_PAGE (data);
-
- field_changed (rpage);
- preview_recur (rpage);
+ comp_editor_page_changed (COMP_EDITOR_PAGE (rpage));
}
/* Creates the special contents for monthly recurrences */
@@ -1243,8 +1228,9 @@ make_monthly_special (RecurrencePage *rpage)
priv->month_day,
month_day_options_map);
- g_signal_connect((adj), "value_changed", G_CALLBACK (month_index_value_changed_cb),
- rpage);
+ g_signal_connect_swapped (
+ adj, "value-changed",
+ G_CALLBACK (comp_editor_page_changed), rpage);
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->month_num_menu));
g_signal_connect((menu), "selection_done",
@@ -1321,30 +1307,22 @@ count_by_xxx (short *field, int max_elements)
return i;
}
-/* Callback used when the ending-until date editor changes */
-static void
-ending_until_changed_cb (EDateEdit *de, gpointer data)
-{
- RecurrencePage *rpage;
-
- rpage = RECURRENCE_PAGE (data);
- field_changed (rpage);
- preview_recur (rpage);
-}
-
/* Creates the special contents for "ending until" (end date) recurrences */
static void
make_ending_until_special (RecurrencePage *rpage)
{
- RecurrencePagePrivate *priv;
+ RecurrencePagePrivate *priv = rpage->priv;
+ CompEditor *editor;
+ CompEditorFlags flags;
EDateEdit *de;
ECalComponentDateTime dt_start;
- priv = rpage->priv;
-
g_return_if_fail (GTK_BIN (priv->ending_special)->child == NULL);
g_return_if_fail (priv->ending_date_edit == NULL);
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage));
+ flags = comp_editor_get_flags (editor);
+
/* Create the widget */
priv->ending_date_edit = comp_editor_new_date_edit (TRUE, FALSE,
@@ -1357,7 +1335,7 @@ make_ending_until_special (RecurrencePage *rpage)
/* Set the value */
- if (COMP_EDITOR_PAGE (rpage)->flags & COMP_EDITOR_PAGE_NEW_ITEM) {
+ if (flags & COMP_EDITOR_NEW_ITEM) {
e_cal_component_get_dtstart (priv->comp, &dt_start);
/* Setting the default until time to 2 weeks */
icaltime_adjust (dt_start.value, 14, 0, 0, 0);
@@ -1367,8 +1345,9 @@ make_ending_until_special (RecurrencePage *rpage)
e_date_edit_set_date (de, priv->ending_date_tt.year, priv->ending_date_tt.month, priv->ending_date_tt.day);
}
- g_signal_connect((de), "changed",
- G_CALLBACK (ending_until_changed_cb), rpage);
+ g_signal_connect_swapped (
+ de, "changed",
+ G_CALLBACK (comp_editor_page_changed), rpage);
/* Make sure the EDateEdit widget uses our timezones to get the
current time. */
@@ -1377,17 +1356,6 @@ make_ending_until_special (RecurrencePage *rpage)
rpage, NULL);
}
-/* Callback used when the ending-count value changes */
-static void
-ending_count_value_changed_cb (GtkAdjustment *adj, gpointer data)
-{
- RecurrencePage *rpage;
-
- rpage = RECURRENCE_PAGE (data);
- field_changed (rpage);
- preview_recur (rpage);
-}
-
/* Creates the special contents for the occurrence count case */
static void
make_ending_count_special (RecurrencePage *rpage)
@@ -1422,9 +1390,9 @@ make_ending_count_special (RecurrencePage *rpage)
e_dialog_spin_set (priv->ending_count_spin, priv->ending_count);
- g_signal_connect((adj), "value_changed",
- G_CALLBACK (ending_count_value_changed_cb),
- rpage);
+ g_signal_connect_swapped (
+ adj, "value-changed",
+ G_CALLBACK (comp_editor_page_changed), rpage);
}
/* Changes the recurrence-ending-special widget to match the ending date option
@@ -1477,10 +1445,13 @@ make_ending_special (RecurrencePage *rpage)
static void
fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r)
{
- RecurrencePagePrivate *priv;
+ RecurrencePagePrivate *priv = rpage->priv;
+ CompEditor *editor;
GtkWidget *menu;
+ ECal *client;
- priv = rpage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage));
+ client = comp_editor_get_client (editor);
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->ending_menu));
g_signal_handlers_block_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage);
@@ -1496,7 +1467,6 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r)
/* Ending date */
if (!r->until.is_date) {
- ECal *client = COMP_EDITOR_PAGE (rpage)->client;
ECalComponentDateTime dt;
icaltimezone *from_zone, *to_zone;
@@ -1552,6 +1522,8 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
RecurrencePage *rpage;
RecurrencePagePrivate *priv;
ECalComponentText text;
+ CompEditor *editor;
+ CompEditorFlags flags;
CompEditorPageDates dates;
GSList *rrule_list;
int len;
@@ -1565,6 +1537,9 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
rpage = RECURRENCE_PAGE (page);
priv = rpage->priv;
+ editor = comp_editor_page_get_editor (page);
+ flags = comp_editor_get_flags (editor);
+
/* Keep a copy of the component so that we can expand the recurrence
* set for the preview.
*/
@@ -1574,11 +1549,10 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
priv->comp = e_cal_component_clone (comp);
- if (!e_cal_component_has_organizer (comp))
- page->flags |= COMP_EDITOR_PAGE_USER_ORG;
-
- /* Don't send off changes during this time */
- priv->updating = TRUE;
+ if (!e_cal_component_has_organizer (comp)) {
+ flags |= COMP_EDITOR_USER_ORG;
+ comp_editor_set_flags (editor, flags);
+ }
/* Clean the page */
clear_widgets (rpage);
@@ -1609,7 +1583,6 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
sensitize_buttons (rpage);
preview_recur (rpage);
- priv->updating = FALSE;
return TRUE;
}
@@ -1896,8 +1869,6 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
e_cal_component_free_recur_list (rrule_list);
preview_recur (rpage);
- priv->updating = FALSE;
-
return TRUE;
}
@@ -1918,12 +1889,17 @@ recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates)
RecurrencePage *rpage;
RecurrencePagePrivate *priv;
ECalComponentDateTime dt;
+ CompEditor *editor;
+ CompEditorFlags flags;
struct icaltimetype icaltime;
guint8 mask;
rpage = RECURRENCE_PAGE (page);
priv = rpage->priv;
+ editor = comp_editor_page_get_editor (page);
+ flags = comp_editor_get_flags (editor);
+
/* Copy the dates to our component */
if (!priv->comp)
@@ -1957,7 +1933,7 @@ recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates)
}
}
- if (COMP_EDITOR_PAGE (rpage)->flags & COMP_EDITOR_PAGE_NEW_ITEM) {
+ if (flags & COMP_EDITOR_NEW_ITEM) {
ECalendar *ecal;
GDate *start, *end;
@@ -2044,11 +2020,9 @@ get_widgets (RecurrencePage *rpage)
* calendar changes.
*/
static void
-preview_date_range_changed_cb (ECalendarItem *item, gpointer data)
+preview_date_range_changed_cb (ECalendarItem *item,
+ RecurrencePage *rpage)
{
- RecurrencePage *rpage;
-
- rpage = RECURRENCE_PAGE (data);
preview_recur (rpage);
}
@@ -2056,23 +2030,22 @@ preview_date_range_changed_cb (ECalendarItem *item, gpointer data)
* enable or disable the recurrence parameters.
*/
static void
-type_toggled_cb (GtkToggleButton *toggle, gpointer data)
+type_toggled_cb (GtkToggleButton *toggle,
+ RecurrencePage *rpage)
{
- RecurrencePage *rpage;
- RecurrencePagePrivate *priv;
+ RecurrencePagePrivate *priv = rpage->priv;
+ CompEditor *editor;
+ ECal *client;
gboolean read_only;
- rpage = RECURRENCE_PAGE (data);
-
- priv = rpage->priv;
-
- field_changed (rpage);
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage));
+ client = comp_editor_get_client (editor);
+ comp_editor_page_changed (COMP_EDITOR_PAGE (rpage));
sensitize_buttons (rpage);
- preview_recur (rpage);
/* enable/disable the 'Add' button */
- if (!e_cal_is_read_only (COMP_EDITOR_PAGE (rpage)->client, &read_only, NULL))
+ if (!e_cal_is_read_only (client, &read_only, NULL))
read_only = TRUE;
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->recurs)) || read_only)
@@ -2081,47 +2054,6 @@ type_toggled_cb (GtkToggleButton *toggle, gpointer data)
gtk_widget_set_sensitive (priv->exception_add, TRUE);
}
-/* Callback used when the recurrence interval value spin button changes. */
-static void
-interval_value_changed_cb (GtkAdjustment *adj, gpointer data)
-{
- RecurrencePage *rpage;
-
- rpage = RECURRENCE_PAGE (data);
-
- field_changed (rpage);
- preview_recur (rpage);
-}
-
-/* Callback used when the recurrence interval option menu changes. We need to
- * change the contents of the recurrence special widget.
- */
-static void
-interval_selection_done_cb (GtkOptionMenu *menu, gpointer data)
-{
- RecurrencePage *rpage;
-
- rpage = RECURRENCE_PAGE (data);
-
- field_changed (rpage);
- make_recurrence_special (rpage);
- preview_recur (rpage);
-}
-
-/* Callback used when the recurrence ending option menu changes. We need to
- * change the contents of the ending special widget.
- */
-static void
-ending_selection_done_cb (GtkOptionMenu *menu, gpointer data)
-{
- RecurrencePage *rpage;
-
- rpage = RECURRENCE_PAGE (data);
- field_changed (rpage);
- make_ending_special (rpage);
- preview_recur (rpage);
-}
-
static GtkWidget *
create_exception_dialog (RecurrencePage *rpage, const char *title, GtkWidget **date_edit)
{
@@ -2146,22 +2078,18 @@ create_exception_dialog (RecurrencePage *rpage, const char *title, GtkWidget **d
/* Callback for the "add exception" button */
static void
-exception_add_cb (GtkWidget *widget, gpointer data)
+exception_add_cb (GtkWidget *widget,
+ RecurrencePage *rpage)
{
- RecurrencePage *rpage;
GtkWidget *dialog, *date_edit;
gboolean date_set;
- rpage = RECURRENCE_PAGE (data);
-
dialog = create_exception_dialog (rpage, _("Add exception"), &date_edit);
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
ECalComponentDateTime dt;
struct icaltimetype icaltime = icaltime_null_time ();
- field_changed (rpage);
-
dt.value = &icaltime;
/* We use DATE values for exceptions, so we don't need a TZID. */
@@ -2175,7 +2103,8 @@ exception_add_cb (GtkWidget *widget, gpointer data)
g_return_if_fail (date_set);
append_exception (rpage, &dt);
- preview_recur (rpage);
+
+ comp_editor_page_changed (COMP_EDITOR_PAGE (rpage));
}
gtk_widget_destroy (dialog);
@@ -2183,16 +2112,15 @@ exception_add_cb (GtkWidget *widget, gpointer data)
/* Callback for the "modify exception" button */
static void
-exception_modify_cb (GtkWidget *widget, gpointer data)
+exception_modify_cb (GtkWidget *widget,
+ RecurrencePage *rpage)
{
- RecurrencePage *rpage;
RecurrencePagePrivate *priv;
GtkWidget *dialog, *date_edit;
const ECalComponentDateTime *current_dt;
GtkTreeSelection *selection;
GtkTreeIter iter;
- rpage = RECURRENCE_PAGE (data);
priv = rpage->priv;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->exception_list));
@@ -2212,8 +2140,6 @@ exception_modify_cb (GtkWidget *widget, gpointer data)
struct icaltimetype icaltime = icaltime_null_time ();
struct icaltimetype *tt;
- field_changed (rpage);
-
dt.value = &icaltime;
tt = dt.value;
e_date_edit_get_date (E_DATE_EDIT (date_edit),
@@ -2227,7 +2153,8 @@ exception_modify_cb (GtkWidget *widget, gpointer data)
dt.tzid = NULL;
e_date_time_list_set_date_time (priv->exception_list_store, &iter, &dt);
- preview_recur (rpage);
+
+ comp_editor_page_changed (COMP_EDITOR_PAGE (rpage));
}
gtk_widget_destroy (dialog);
@@ -2235,16 +2162,15 @@ exception_modify_cb (GtkWidget *widget, gpointer data)
/* Callback for the "delete exception" button */
static void
-exception_delete_cb (GtkWidget *widget, gpointer data)
+exception_delete_cb (GtkWidget *widget,
+ RecurrencePage *rpage)
{
- RecurrencePage *rpage;
RecurrencePagePrivate *priv;
GtkTreeSelection *selection;
GtkTreeIter iter;
GtkTreePath *path;
gboolean valid_iter;
- rpage = RECURRENCE_PAGE (data);
priv = rpage->priv;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->exception_list));
@@ -2253,8 +2179,6 @@ exception_delete_cb (GtkWidget *widget, gpointer data)
return;
}
- field_changed (rpage);
-
path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->exception_list_store), &iter);
e_date_time_list_remove (priv->exception_list_store, &iter);
@@ -2269,7 +2193,8 @@ exception_delete_cb (GtkWidget *widget, gpointer data)
gtk_tree_selection_select_iter (selection, &iter);
gtk_tree_path_free (path);
- preview_recur (rpage);
+
+ comp_editor_page_changed (COMP_EDITOR_PAGE (rpage));
}
/* Callback used when a row is selected in the list of exception
@@ -2277,13 +2202,12 @@ exception_delete_cb (GtkWidget *widget, gpointer data)
* exception's value.
*/
static void
-exception_selection_changed_cb (GtkTreeSelection *selection, gpointer data)
+exception_selection_changed_cb (GtkTreeSelection *selection,
+ RecurrencePage *rpage)
{
- RecurrencePage *rpage;
RecurrencePagePrivate *priv;
GtkTreeIter iter;
- rpage = RECURRENCE_PAGE (data);
priv = rpage->priv;
if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) {
@@ -2296,18 +2220,6 @@ exception_selection_changed_cb (GtkTreeSelection *selection, gpointer data)
gtk_widget_set_sensitive (priv->exception_delete, TRUE);
}
-/* This is called when any field is changed; it notifies upstream. */
-static void
-field_changed (RecurrencePage *rpage)
-{
- RecurrencePagePrivate *priv;
-
- priv = rpage->priv;
-
- if (!priv->updating)
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (rpage));
-}
-
/* Hooks the widget signals */
static void
init_widgets (RecurrencePage *rpage)
@@ -2344,20 +2256,27 @@ init_widgets (RecurrencePage *rpage)
/* Recurrence interval */
adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (priv->interval_value));
- g_signal_connect((adj), "value_changed",
- G_CALLBACK (interval_value_changed_cb),
- rpage);
+ g_signal_connect_swapped (
+ adj, "value-changed",
+ G_CALLBACK (comp_editor_page_changed), rpage);
/* Recurrence units */
- g_signal_connect(GTK_OPTION_MENU (priv->interval_unit), "changed",
- G_CALLBACK (interval_selection_done_cb),
- rpage);
+ g_signal_connect_swapped (
+ priv->interval_unit, "changed",
+ G_CALLBACK (comp_editor_page_changed), rpage);
+ g_signal_connect_swapped (
+ priv->interval_unit, "changed",
+ G_CALLBACK (make_recurrence_special), rpage);
/* Recurrence ending */
- g_signal_connect(GTK_OPTION_MENU (priv->ending_menu), "changed",
- G_CALLBACK (ending_selection_done_cb), rpage);
+ g_signal_connect_swapped (
+ priv->ending_menu, "changed",
+ G_CALLBACK (comp_editor_page_changed), rpage);
+ g_signal_connect_swapped (
+ priv->ending_menu, "changed",
+ G_CALLBACK (make_ending_special), rpage);
/* Exception buttons */
@@ -2390,16 +2309,6 @@ init_widgets (RecurrencePage *rpage)
G_CALLBACK (exception_selection_changed_cb), rpage);
}
-
-
-static void
-client_changed_cb (CompEditorPage *page, ECal *client, gpointer user_data)
-{
- RecurrencePage *rpage = RECURRENCE_PAGE (page);
-
- sensitize_buttons (rpage);
-}
-
/**
* recurrence_page_construct:
* @rpage: A recurrence page.
@@ -2412,10 +2321,11 @@ client_changed_cb (CompEditorPage *page, ECal *client, gpointer user_data)
RecurrencePage *
recurrence_page_construct (RecurrencePage *rpage)
{
- RecurrencePagePrivate *priv;
+ RecurrencePagePrivate *priv = rpage->priv;
+ CompEditor *editor;
char *gladefile;
- priv = rpage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage));
gladefile = g_build_filename (EVOLUTION_GLADEDIR,
"recurrence-page.glade",
@@ -2437,8 +2347,9 @@ recurrence_page_construct (RecurrencePage *rpage)
init_widgets (rpage);
- g_signal_connect_after (G_OBJECT (rpage), "client_changed",
- G_CALLBACK (client_changed_cb), NULL);
+ g_signal_connect_swapped (
+ editor, "notify::client",
+ G_CALLBACK (sensitize_buttons), rpage);
return rpage;
}
@@ -2452,14 +2363,16 @@ recurrence_page_construct (RecurrencePage *rpage)
* be created.
**/
RecurrencePage *
-recurrence_page_new (void)
+recurrence_page_new (CompEditor *editor)
{
RecurrencePage *rpage;
- rpage = g_object_new (TYPE_RECURRENCE_PAGE, NULL);
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL);
+
+ rpage = g_object_new (TYPE_RECURRENCE_PAGE, "editor", editor, NULL);
if (!recurrence_page_construct (rpage)) {
g_object_unref (rpage);
- return NULL;
+ g_return_val_if_reached (NULL);
}
return rpage;
diff --git a/calendar/gui/dialogs/recurrence-page.h b/calendar/gui/dialogs/recurrence-page.h
index 4f7d1047e5..f4d19effb4 100644
--- a/calendar/gui/dialogs/recurrence-page.h
+++ b/calendar/gui/dialogs/recurrence-page.h
@@ -25,38 +25,47 @@
#ifndef RECURRENCE_PAGE_H
#define RECURRENCE_PAGE_H
+#include "comp-editor.h"
#include "comp-editor-page.h"
-G_BEGIN_DECLS
-
-
+/* Standard GObject macros */
+#define TYPE_RECURRENCE_PAGE \
+ (recurrence_page_get_type ())
+#define RECURRENCE_PAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), TYPE_RECURRENCE_PAGE, RecurrencePage))
+#define RECURRENCE_PAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), TYPE_RECURRENCE_PAGE, RecurrencePageClass))
+#define IS_RECURRENCE_PAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), TYPE_RECURRENCE_PAGE))
+#define IS_RECURRENCE_PAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((obj), TYPE_RECURRENCE_PAGE))
+#define RECURRENCE_PAGE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), TYPE_RECURRENCE_PAGE, RecurrencePageClass))
-#define TYPE_RECURRENCE_PAGE (recurrence_page_get_type ())
-#define RECURRENCE_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RECURRENCE_PAGE, RecurrencePage))
-#define RECURRENCE_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RECURRENCE_PAGE, RecurrencePageClass))
-#define IS_RECURRENCE_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RECURRENCE_PAGE))
-#define IS_RECURRENCE_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), TYPE_RECURRENCE_PAGE))
+G_BEGIN_DECLS
+typedef struct _RecurrencePage RecurrencePage;
+typedef struct _RecurrencePageClass RecurrencePageClass;
typedef struct _RecurrencePagePrivate RecurrencePagePrivate;
-typedef struct {
+struct _RecurrencePage {
CompEditorPage page;
-
- /* Private data */
RecurrencePagePrivate *priv;
-} RecurrencePage;
+};
-typedef struct {
+struct _RecurrencePageClass {
CompEditorPageClass parent_class;
-} RecurrencePageClass;
-
-
-GType recurrence_page_get_type (void);
-RecurrencePage *recurrence_page_construct (RecurrencePage *rpage);
-RecurrencePage *recurrence_page_new (void);
+};
-
+GType recurrence_page_get_type (void);
+RecurrencePage *recurrence_page_construct (RecurrencePage *rpage);
+RecurrencePage *recurrence_page_new (CompEditor *editor);
G_END_DECLS
-#endif
+#endif /* RECURRENCE_PAGE_H */
diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c
index 425b191c5f..57af4ecf87 100644
--- a/calendar/gui/dialogs/schedule-page.c
+++ b/calendar/gui/dialogs/schedule-page.c
@@ -39,7 +39,9 @@
#include "e-delegate-dialog.h"
#include "schedule-page.h"
-
+#define SCHEDULE_PAGE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), TYPE_SCHEDULE_PAGE, SchedulePagePrivate))
/* Private part of the SchedulePage structure */
struct _SchedulePagePrivate {
@@ -59,93 +61,68 @@ struct _SchedulePagePrivate {
start and end date. We convert the end date if it is passed in in
another timezone. */
icaltimezone *zone;
-
- gboolean updating;
};
-
-
-static void schedule_page_finalize (GObject *object);
-
static GtkWidget *schedule_page_get_widget (CompEditorPage *page);
static void schedule_page_focus_main_widget (CompEditorPage *page);
static gboolean schedule_page_fill_widgets (CompEditorPage *page, ECalComponent *comp);
static gboolean schedule_page_fill_component (CompEditorPage *page, ECalComponent *comp);
static void schedule_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates);
-static void times_changed_cb (GtkWidget *widget, gpointer data);
+static void times_changed_cb (GtkWidget *widget, SchedulePage *spage);
G_DEFINE_TYPE (SchedulePage, schedule_page, TYPE_COMP_EDITOR_PAGE)
-/* Class initialization function for the schedule page */
static void
-schedule_page_class_init (SchedulePageClass *class)
-{
- CompEditorPageClass *editor_page_class;
- GObjectClass *object_class;
-
- editor_page_class = (CompEditorPageClass *) class;
- object_class = (GObjectClass *) class;
-
- editor_page_class->get_widget = schedule_page_get_widget;
- editor_page_class->focus_main_widget = schedule_page_focus_main_widget;
- editor_page_class->fill_widgets = schedule_page_fill_widgets;
- editor_page_class->fill_component = schedule_page_fill_component;
- editor_page_class->set_summary = NULL;
- editor_page_class->set_dates = schedule_page_set_dates;
-
- object_class->finalize = schedule_page_finalize;
-}
-
-/* Object initialization function for the schedule page */
-static void
-schedule_page_init (SchedulePage *spage)
+schedule_page_dispose (GObject *object)
{
SchedulePagePrivate *priv;
- priv = g_new0 (SchedulePagePrivate, 1);
- spage->priv = priv;
+ priv = SCHEDULE_PAGE_GET_PRIVATE (object);
- priv->xml = NULL;
+ if (priv->main != NULL) {
+ g_object_unref (priv->main);
+ priv->main = NULL;
+ }
- priv->main = NULL;
+ if (priv->xml != NULL) {
+ g_object_unref (priv->xml);
+ priv->xml = NULL;
+ }
- priv->zone = NULL;
+ if (priv->model != NULL) {
+ g_object_unref (priv->model);
+ priv->model = NULL;
+ }
- priv->updating = FALSE;
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (schedule_page_parent_class)->dispose (object);
}
-/* Destroy handler for the schedule page */
static void
-schedule_page_finalize (GObject *object)
+schedule_page_class_init (SchedulePageClass *class)
{
- SchedulePage *spage;
- SchedulePagePrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_SCHEDULE_PAGE (object));
-
- spage = SCHEDULE_PAGE (object);
- priv = spage->priv;
-
- if (priv->main)
- g_object_unref (priv->main);
-
- if (priv->xml) {
- g_object_unref (priv->xml);
- priv->xml = NULL;
- }
+ GObjectClass *object_class;
+ CompEditorPageClass *editor_page_class;
- g_object_unref(priv->model);
+ g_type_class_add_private (class, sizeof (SchedulePagePrivate));
- g_free (priv);
- spage->priv = NULL;
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = schedule_page_dispose;
- if (G_OBJECT_CLASS (schedule_page_parent_class)->finalize)
- (* G_OBJECT_CLASS (schedule_page_parent_class)->finalize) (object);
+ editor_page_class = COMP_EDITOR_PAGE_CLASS (class);
+ editor_page_class->get_widget = schedule_page_get_widget;
+ editor_page_class->focus_main_widget = schedule_page_focus_main_widget;
+ editor_page_class->fill_widgets = schedule_page_fill_widgets;
+ editor_page_class->fill_component = schedule_page_fill_component;
+ editor_page_class->set_dates = schedule_page_set_dates;
}
-
+static void
+schedule_page_init (SchedulePage *spage)
+{
+ spage->priv = SCHEDULE_PAGE_GET_PRIVATE (spage);
+}
/* get_widget handler for the schedule page */
static GtkWidget *
@@ -176,41 +153,40 @@ schedule_page_focus_main_widget (CompEditorPage *page)
static void
sensitize_widgets (SchedulePage *spage)
{
- gboolean read_only;
SchedulePagePrivate *priv = spage->priv;
+ CompEditor *editor;
+ ECal *client;
+ gboolean read_only;
- if (!e_cal_is_read_only (COMP_EDITOR_PAGE (spage)->client, &read_only, NULL))
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (spage));
+ client = comp_editor_get_client (editor);
+
+ if (!e_cal_is_read_only (client, &read_only, NULL))
read_only = TRUE;
e_meeting_time_selector_set_read_only (priv->sel, read_only);
}
-static void
-client_changed_cb (CompEditorPage *page, ECal *client, gpointer user_data)
-{
- SchedulePage *spage = SCHEDULE_PAGE (page);
-
- sensitize_widgets (spage);
-}
-
/* Set date/time */
static void
update_time (SchedulePage *spage, ECalComponentDateTime *start_date, ECalComponentDateTime *end_date)
{
- SchedulePagePrivate *priv;
+ SchedulePagePrivate *priv = spage->priv;
+ CompEditor *editor;
struct icaltimetype start_tt, end_tt;
icaltimezone *start_zone = NULL, *end_zone = NULL;
+ ECal *client;
gboolean all_day;
- priv = spage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (spage));
+ client = comp_editor_get_client (editor);
/* Note that if we are creating a new event, the timezones may not be
on the server, so we try to get the builtin timezone with the TZID
first. */
start_zone = icaltimezone_get_builtin_timezone_from_tzid (start_date->tzid);
if (!start_zone) {
- if (!e_cal_get_timezone (COMP_EDITOR_PAGE (spage)->client,
- start_date->tzid, &start_zone, NULL)) {
+ if (!e_cal_get_timezone (client, start_date->tzid, &start_zone, NULL)) {
/* FIXME: Handle error better. */
g_warning ("Couldn't get timezone from server: %s",
start_date->tzid ? start_date->tzid : "");
@@ -219,8 +195,7 @@ update_time (SchedulePage *spage, ECalComponentDateTime *start_date, ECalCompone
end_zone = icaltimezone_get_builtin_timezone_from_tzid (end_date->tzid);
if (!end_zone) {
- if (!e_cal_get_timezone (COMP_EDITOR_PAGE (spage)->client,
- end_date->tzid, &end_zone, NULL)) {
+ if (!e_cal_get_timezone (client, end_date->tzid, &end_zone, NULL)) {
/* FIXME: Handle error better. */
g_warning ("Couldn't get timezone from server: %s",
end_date->tzid ? end_date->tzid : "");
@@ -283,8 +258,6 @@ schedule_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
spage = SCHEDULE_PAGE (page);
priv = spage->priv;
- priv->updating = TRUE;
-
/* Clean the screen */
clear_widgets (spage);
@@ -301,8 +274,6 @@ schedule_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
e_cal_component_free_datetime (&start_date);
e_cal_component_free_datetime (&end_date);
- priv->updating = FALSE;
-
sensitize_widgets (spage);
return validated;
@@ -324,11 +295,9 @@ schedule_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates)
spage = SCHEDULE_PAGE (page);
priv = spage->priv;
- priv->updating = TRUE;
-
+ comp_editor_page_set_updating (page, TRUE);
update_time (spage, dates->start, dates->end);
-
- priv->updating = FALSE;
+ comp_editor_page_set_updating (page, FALSE);
}
@@ -413,10 +382,11 @@ schedule_page_set_meeting_time (SchedulePage *spage, icaltimetype *start_tt, ica
SchedulePage *
schedule_page_construct (SchedulePage *spage, EMeetingStore *ems)
{
- SchedulePagePrivate *priv;
+ SchedulePagePrivate *priv = spage->priv;
+ CompEditor *editor;
char *gladefile;
- priv = spage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (spage));
gladefile = g_build_filename (EVOLUTION_GLADEDIR,
"schedule-page.glade",
@@ -457,8 +427,10 @@ schedule_page_construct (SchedulePage *spage, EMeetingStore *ems)
return NULL;
}
- g_signal_connect_after (G_OBJECT (spage), "client_changed",
- G_CALLBACK (client_changed_cb), NULL);
+ g_signal_connect_swapped (
+ editor, "notify::client",
+ G_CALLBACK (sensitize_widgets), spage);
+
return spage;
}
@@ -471,14 +443,15 @@ schedule_page_construct (SchedulePage *spage, EMeetingStore *ems)
* not be created.
**/
SchedulePage *
-schedule_page_new (EMeetingStore *ems)
+schedule_page_new (EMeetingStore *ems,
+ CompEditor *editor)
{
SchedulePage *spage;
- spage = g_object_new (TYPE_SCHEDULE_PAGE, NULL);
+ spage = g_object_new (TYPE_SCHEDULE_PAGE, "editor", editor, NULL);
if (!schedule_page_construct (spage, ems)) {
g_object_unref (spage);
- return NULL;
+ g_return_val_if_reached (NULL);
}
return spage;
@@ -511,20 +484,23 @@ schedule_page_set_name_selector (SchedulePage *spage, ENameSelector *name_select
}
static void
-times_changed_cb (GtkWidget *widget, gpointer data)
+times_changed_cb (GtkWidget *widget,
+ SchedulePage *spage)
{
- SchedulePage *spage = data;
SchedulePagePrivate *priv;
CompEditorPageDates dates;
+ CompEditor *editor;
ECalComponentDateTime start_dt, end_dt;
struct icaltimetype start_tt = icaltime_null_time ();
struct icaltimetype end_tt = icaltime_null_time ();
priv = spage->priv;
- if (priv->updating)
+ if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (spage)))
return;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (spage));
+
e_date_edit_get_date (E_DATE_EDIT (priv->sel->start_date_edit),
&start_tt.year,
&start_tt.month,
@@ -563,5 +539,5 @@ times_changed_cb (GtkWidget *widget, gpointer data)
dates.complete = NULL;
comp_editor_page_notify_dates_changed (COMP_EDITOR_PAGE (spage), &dates);
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (spage));
+ comp_editor_set_changed (editor, TRUE);
}
diff --git a/calendar/gui/dialogs/schedule-page.h b/calendar/gui/dialogs/schedule-page.h
index 16ad1a4af2..1bc1825856 100644
--- a/calendar/gui/dialogs/schedule-page.h
+++ b/calendar/gui/dialogs/schedule-page.h
@@ -22,41 +22,57 @@
#define SCHEDULE_PAGE_H
#include "../e-meeting-store.h"
+#include "comp-editor.h"
#include "comp-editor-page.h"
#include <libedataserverui/e-name-selector.h>
-G_BEGIN_DECLS
-
-
+/* Standard GObject macros */
+#define TYPE_SCHEDULE_PAGE \
+ (schedule_page_get_type ())
+#define SCHEDULE_PAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), TYPE_SCHEDULE_PAGE, SchedulePage))
+#define SCHEDULE_PAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), TYPE_SCHEDULE_PAGE, SchedulePageClass))
+#define IS_SCHEDULE_PAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), TYPE_SCHEDULE_PAGE))
+#define IS_SCHEDULE_PAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((obj), TYPE_SCHEDULE_PAGE))
+#define SCHEDULE_PAGE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), TYPE_SCHEDULE_PAGE, SchedulePageClass))
-#define TYPE_SCHEDULE_PAGE (schedule_page_get_type ())
-#define SCHEDULE_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SCHEDULE_PAGE, SchedulePage))
-#define SCHEDULE_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SCHEDULE_PAGE, SchedulePageClass))
-#define IS_SCHEDULE_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SCHEDULE_PAGE))
-#define IS_SCHEDULE_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), TYPE_SCHEDULE_PAGE))
+G_BEGIN_DECLS
+typedef struct _SchedulePage SchedulePage;
+typedef struct _SchedulePageClass SchedulePageClass;
typedef struct _SchedulePagePrivate SchedulePagePrivate;
-typedef struct {
+struct _SchedulePage {
CompEditorPage page;
-
- /* Private data */
SchedulePagePrivate *priv;
-} SchedulePage;
+};
-typedef struct {
+struct _SchedulePageClass {
CompEditorPageClass parent_class;
-} SchedulePageClass;
+};
-GType schedule_page_get_type (void);
-SchedulePage *schedule_page_construct (SchedulePage *mpage, EMeetingStore *ems);
-SchedulePage *schedule_page_new (EMeetingStore *ems);
-void schedule_page_set_name_selector (SchedulePage *spage, ENameSelector *name_selector);
-void schedule_page_set_meeting_time (SchedulePage *spage, icaltimetype *start_tt, icaltimetype *end_tt);
-void schedule_page_update_free_busy (SchedulePage *spage);
-
+GType schedule_page_get_type (void);
+SchedulePage * schedule_page_construct (SchedulePage *mpage,
+ EMeetingStore *ems);
+SchedulePage * schedule_page_new (EMeetingStore *ems,
+ CompEditor *editor);
+void schedule_page_set_name_selector (SchedulePage *spage,
+ ENameSelector *name_selector);
+void schedule_page_set_meeting_time (SchedulePage *spage,
+ icaltimetype *start_tt,
+ icaltimetype *end_tt);
+void schedule_page_update_free_busy (SchedulePage *spage);
G_END_DECLS
-#endif
+#endif /* SCHEDULE_PAGE_H */
diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c
index 6e882ee26c..4b2a6491b6 100644
--- a/calendar/gui/dialogs/task-details-page.c
+++ b/calendar/gui/dialogs/task-details-page.c
@@ -37,9 +37,10 @@
#include "comp-editor-util.h"
#include "task-details-page.h"
-
+#define TASK_DETAILS_PAGE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), TYPE_TASK_DETAILS_PAGE, TaskDetailsPagePrivate))
-/* Private part of the TaskDetailsPage structure */
struct _TaskDetailsPagePrivate {
/* Glade XML data */
GladeXML *xml;
@@ -57,8 +58,6 @@ struct _TaskDetailsPagePrivate {
GtkWidget *url_label;
GtkWidget *url_entry;
GtkWidget *url;
-
- gboolean updating;
};
/* Note that these two arrays must match. */
@@ -85,10 +84,6 @@ static const int priority_map[] = {
-1
};
-
-
-static void task_details_page_finalize (GObject *object);
-
static GtkWidget *task_details_page_get_widget (CompEditorPage *page);
static void task_details_page_focus_main_widget (CompEditorPage *page);
static gboolean task_details_page_fill_widgets (CompEditorPage *page, ECalComponent *comp);
@@ -97,82 +92,52 @@ static gboolean task_details_page_fill_timezones (CompEditorPage *page, GHashTab
G_DEFINE_TYPE (TaskDetailsPage, task_details_page, TYPE_COMP_EDITOR_PAGE)
-/* Class initialization function for the task page */
static void
-task_details_page_class_init (TaskDetailsPageClass *class)
+task_details_page_dispose (GObject *object)
{
- CompEditorPageClass *editor_page_class;
- GObjectClass *object_class;
+ TaskDetailsPagePrivate *priv;
- editor_page_class = (CompEditorPageClass *) class;
- object_class = (GObjectClass *) class;
+ priv = TASK_DETAILS_PAGE_GET_PRIVATE (object);
- editor_page_class->get_widget = task_details_page_get_widget;
- editor_page_class->focus_main_widget = task_details_page_focus_main_widget;
- editor_page_class->fill_widgets = task_details_page_fill_widgets;
- editor_page_class->fill_component = task_details_page_fill_component;
- editor_page_class->fill_timezones = task_details_page_fill_timezones;
+ if (priv->main != NULL) {
+ g_object_unref (priv->main);
+ priv->main = NULL;
+ }
+
+ if (priv->xml != NULL) {
+ g_object_unref (priv->xml);
+ priv->xml = NULL;
+ }
- object_class->finalize = task_details_page_finalize;
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (task_details_page_parent_class)->dispose (object);
}
-/* Object initialization function for the task page */
static void
-task_details_page_init (TaskDetailsPage *tdpage)
+task_details_page_class_init (TaskDetailsPageClass *class)
{
- TaskDetailsPagePrivate *priv;
-
- priv = g_new0 (TaskDetailsPagePrivate, 1);
- tdpage->priv = priv;
-
- priv->xml = NULL;
-
- priv->main = NULL;
-
- priv->status = NULL;
- priv->priority = NULL;
- priv->percent_complete = NULL;
+ GObjectClass *object_class;
+ CompEditorPageClass *editor_page_class;
- priv->date_completed_label = NULL;
- priv->completed_date = NULL;
+ g_type_class_add_private (class, sizeof (TaskDetailsPagePrivate));
- priv->url_label = NULL;
- priv->url_entry = NULL;
- priv->url = NULL;
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = task_details_page_dispose;
- priv->updating = FALSE;
+ editor_page_class = COMP_EDITOR_PAGE_CLASS (class);
+ editor_page_class->get_widget = task_details_page_get_widget;
+ editor_page_class->focus_main_widget = task_details_page_focus_main_widget;
+ editor_page_class->fill_widgets = task_details_page_fill_widgets;
+ editor_page_class->fill_component = task_details_page_fill_component;
+ editor_page_class->fill_timezones = task_details_page_fill_timezones;
}
-/* Destroy handler for the task page */
static void
-task_details_page_finalize (GObject *object)
+task_details_page_init (TaskDetailsPage *tdpage)
{
- TaskDetailsPage *tdpage;
- TaskDetailsPagePrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_TASK_DETAILS_PAGE (object));
-
- tdpage = TASK_DETAILS_PAGE (object);
- priv = tdpage->priv;
-
- if (priv->main)
- g_object_unref (priv->main);
-
- if (priv->xml) {
- g_object_unref (priv->xml);
- priv->xml = NULL;
- }
-
- g_free (priv);
- tdpage->priv = NULL;
-
- if (G_OBJECT_CLASS (task_details_page_parent_class)->finalize)
- (* G_OBJECT_CLASS (task_details_page_parent_class)->finalize) (object);
+ tdpage->priv = TASK_DETAILS_PAGE_GET_PRIVATE (tdpage);
}
-
-
/* get_widget handler for the task page */
static GtkWidget *
task_details_page_get_widget (CompEditorPage *page)
@@ -261,12 +226,15 @@ clear_widgets (TaskDetailsPage *tdpage)
static void
sensitize_widgets (TaskDetailsPage *tdpage)
{
+ TaskDetailsPagePrivate *priv = tdpage->priv;
+ CompEditor *editor;
+ ECal *client;
gboolean read_only;
- TaskDetailsPagePrivate *priv;
- priv = tdpage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tdpage));
+ client = comp_editor_get_client (editor);
- if (!e_cal_is_read_only (COMP_EDITOR_PAGE (tdpage)->client, &read_only, NULL))
+ if (!e_cal_is_read_only (client, &read_only, NULL))
read_only = TRUE;
gtk_widget_set_sensitive (priv->status, !read_only);
@@ -292,8 +260,6 @@ task_details_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
tdpage = TASK_DETAILS_PAGE (page);
priv = tdpage->priv;
- priv->updating = TRUE;
-
/* Clean the screen */
clear_widgets (tdpage);
@@ -361,8 +327,6 @@ task_details_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
e_cal_component_get_url (comp, &url);
e_dialog_editable_set (priv->url, url);
- priv->updating = FALSE;
-
sensitize_widgets (tdpage);
return TRUE;
@@ -561,10 +525,10 @@ date_changed_cb (EDateEdit *dedit, gpointer data)
tdpage = TASK_DETAILS_PAGE (data);
priv = tdpage->priv;
- if (priv->updating)
+ if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (tdpage)))
return;
- priv->updating = TRUE;
+ comp_editor_page_set_updating (COMP_EDITOR_PAGE (tdpage), TRUE);
date_set = e_date_edit_get_date (E_DATE_EDIT (priv->completed_date),
&completed_tt.year,
@@ -593,7 +557,7 @@ date_changed_cb (EDateEdit *dedit, gpointer data)
e_dialog_spin_set (priv->percent_complete, 100);
}
- priv->updating = FALSE;
+ comp_editor_page_set_updating (COMP_EDITOR_PAGE (tdpage), FALSE);
/* Notify upstream */
dates.complete = &completed_tt;
@@ -605,14 +569,17 @@ status_changed (GtkMenu *menu, TaskDetailsPage *tdpage)
{
TaskDetailsPagePrivate *priv;
icalproperty_status status;
+ CompEditor *editor;
time_t ctime = -1;
priv = tdpage->priv;
- if (priv->updating)
+ if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (tdpage)))
return;
- priv->updating = TRUE;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tdpage));
+
+ comp_editor_page_set_updating (COMP_EDITOR_PAGE (tdpage), TRUE);
status = e_dialog_option_menu_get (priv->status, status_map);
if (status == ICAL_STATUS_NONE) {
@@ -633,9 +600,9 @@ status_changed (GtkMenu *menu, TaskDetailsPage *tdpage)
complete_date_changed (tdpage, ctime, TRUE);
}
- priv->updating = FALSE;
+ comp_editor_page_set_updating (COMP_EDITOR_PAGE (tdpage), FALSE);
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (tdpage));
+ comp_editor_set_changed (editor, TRUE);
}
static void
@@ -644,15 +611,18 @@ percent_complete_changed (GtkAdjustment *adj, TaskDetailsPage *tdpage)
TaskDetailsPagePrivate *priv;
gint percent;
icalproperty_status status;
+ CompEditor *editor;
gboolean complete;
time_t ctime = -1;
priv = tdpage->priv;
- if (priv->updating)
+ if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (tdpage)))
return;
- priv->updating = TRUE;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tdpage));
+
+ comp_editor_page_set_updating (COMP_EDITOR_PAGE (tdpage), TRUE);
percent = e_dialog_spin_get_int (priv->percent_complete);
if (percent == 100) {
@@ -672,23 +642,9 @@ percent_complete_changed (GtkAdjustment *adj, TaskDetailsPage *tdpage)
e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), ctime);
complete_date_changed (tdpage, ctime, complete);
- priv->updating = FALSE;
-
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (tdpage));
-}
-
-/* This is called when any field is changed; it notifies upstream. */
-static void
-field_changed_cb (GtkWidget *widget, gpointer data)
-{
- TaskDetailsPage *tdpage;
- TaskDetailsPagePrivate *priv;
+ comp_editor_page_set_updating (COMP_EDITOR_PAGE (tdpage), FALSE);
- tdpage = TASK_DETAILS_PAGE (data);
- priv = tdpage->priv;
-
- if (!priv->updating)
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (tdpage));
+ comp_editor_set_changed (editor, TRUE);
}
/* Hooks the widget signals */
@@ -721,27 +677,22 @@ init_widgets (TaskDetailsPage *tdpage)
G_CALLBACK (percent_complete_changed), tdpage);
/* Priority */
- g_signal_connect((GTK_OPTION_MENU (priv->priority)->menu),
- "deactivate",
- G_CALLBACK (field_changed_cb), tdpage);
+ g_signal_connect_swapped (
+ GTK_OPTION_MENU (priv->priority)->menu, "deactivate",
+ G_CALLBACK (comp_editor_page_changed), tdpage);
/* Completed Date */
- g_signal_connect((priv->completed_date), "changed",
- G_CALLBACK (date_changed_cb), tdpage);
- g_signal_connect (priv->completed_date, "changed",
- G_CALLBACK (field_changed_cb), tdpage);
+ g_signal_connect (
+ priv->completed_date, "changed",
+ G_CALLBACK (date_changed_cb), tdpage);
+ g_signal_connect_swapped (
+ priv->completed_date, "changed",
+ G_CALLBACK (comp_editor_page_changed), tdpage);
/* URL */
- g_signal_connect((priv->url), "changed",
- G_CALLBACK (field_changed_cb), tdpage);
-}
-
-static void
-client_changed_cb (CompEditorPage *page, ECal *client, gpointer user_data)
-{
- TaskDetailsPage *tdpage = TASK_DETAILS_PAGE (page);
-
- sensitize_widgets (tdpage);
+ g_signal_connect_swapped (
+ priv->url, "changed",
+ G_CALLBACK (comp_editor_page_changed), tdpage);
}
/**
@@ -756,10 +707,11 @@ client_changed_cb (CompEditorPage *page, ECal *client, gpointer user_data)
TaskDetailsPage *
task_details_page_construct (TaskDetailsPage *tdpage)
{
- TaskDetailsPagePrivate *priv;
+ TaskDetailsPagePrivate *priv = tdpage->priv;
+ CompEditor *editor;
char *gladefile;
- priv = tdpage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tdpage));
gladefile = g_build_filename (EVOLUTION_GLADEDIR,
"task-details-page.glade",
@@ -781,8 +733,9 @@ task_details_page_construct (TaskDetailsPage *tdpage)
init_widgets (tdpage);
- g_signal_connect_after (G_OBJECT (tdpage), "client_changed",
- G_CALLBACK (client_changed_cb), NULL);
+ g_signal_connect_swapped (
+ editor, "notify::client",
+ G_CALLBACK (sensitize_widgets), tdpage);
return tdpage;
}
@@ -796,14 +749,14 @@ task_details_page_construct (TaskDetailsPage *tdpage)
* not be created.
**/
TaskDetailsPage *
-task_details_page_new (void)
+task_details_page_new (CompEditor *editor)
{
TaskDetailsPage *tdpage;
- tdpage = g_object_new (TYPE_TASK_DETAILS_PAGE, NULL);
+ tdpage = g_object_new (TYPE_TASK_DETAILS_PAGE, "editor", editor, NULL);
if (!task_details_page_construct (tdpage)) {
g_object_unref (tdpage);
- return NULL;
+ g_return_val_if_reached (NULL);
}
return tdpage;
diff --git a/calendar/gui/dialogs/task-details-page.h b/calendar/gui/dialogs/task-details-page.h
index f7c2c57fa9..797b87fc9d 100644
--- a/calendar/gui/dialogs/task-details-page.h
+++ b/calendar/gui/dialogs/task-details-page.h
@@ -24,38 +24,47 @@
#ifndef TASK_DETAILS_PAGE_H
#define TASK_DETAILS_PAGE_H
+#include "comp-editor.h"
#include "comp-editor-page.h"
-G_BEGIN_DECLS
-
-
+/* Standard GObject macros */
+#define TYPE_TASK_DETAILS_PAGE \
+ (task_details_page_get_type ())
+#define TASK_DETAILS_PAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), TYPE_TASK_DETAILS_PAGE, TaskDetailsPage))
+#define TASK_DETAILS_PAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), TYPE_TASK_DETAILS_PAGE, TaskDetailsPageClass))
+#define IS_TASK_DETAILS_PAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), TYPE_TASK_DETAILS_PAGE))
+#define IS_TASK_DETAILS_PAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((obj), TYPE_TASK_DETAILS_PAGE))
+#define TASK_DETAILS_PAGE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), TYPE_TASK_DETAILS_PAGE, TaskDetailsPageClass))
-#define TYPE_TASK_DETAILS_PAGE (task_details_page_get_type ())
-#define TASK_DETAILS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TASK_DETAILS_PAGE, TaskDetailsPage))
-#define TASK_DETAILS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TASK_DETAILS_PAGE, TaskDetailsPageClass))
-#define IS_TASK_DETAILS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TASK_DETAILS_PAGE))
-#define IS_TASK_DETAILS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), TYPE_TASK_DETAILS_PAGE))
+G_BEGIN_DECLS
+typedef struct _TaskDetailsPage TaskDetailsPage;
+typedef struct _TaskDetailsPageClass TaskDetailsPageClass;
typedef struct _TaskDetailsPagePrivate TaskDetailsPagePrivate;
-typedef struct {
+struct _TaskDetailsPage {
CompEditorPage page;
-
- /* Private data */
TaskDetailsPagePrivate *priv;
-} TaskDetailsPage;
+};
-typedef struct {
+struct _TaskDetailsPageClass {
CompEditorPageClass parent_class;
-} TaskDetailsPageClass;
-
-
-GType task_details_page_get_type (void);
-TaskDetailsPage *task_details_page_construct (TaskDetailsPage *tdpage);
-TaskDetailsPage *task_details_page_new (void);
+};
-
+GType task_details_page_get_type (void);
+TaskDetailsPage *task_details_page_construct (TaskDetailsPage *tdpage);
+TaskDetailsPage *task_details_page_new (CompEditor *editor);
G_END_DECLS
-#endif
+#endif /* TASK_DETAILS_PAGE_H */
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index 9a02617b31..7e2994499a 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -32,476 +32,359 @@
#include <glib/gi18n.h>
#include <e-util/e-icon-factory.h>
+#include <e-util/e-plugin-ui.h>
#include <e-util/e-util-private.h>
#include <evolution-shell-component-utils.h>
#include "task-page.h"
#include "task-details-page.h"
#include "cancel-comp.h"
-#include "../calendar-config.h"
#include "task-editor.h"
+#define TASK_EDITOR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), TYPE_TASK_EDITOR, TaskEditorPrivate))
+
struct _TaskEditorPrivate {
TaskPage *task_page;
TaskDetailsPage *task_details_page;
-
GtkWidget *task_details_window;
- EMeetingStore *model;
+ EMeetingStore *model;
gboolean assignment_shown;
- gboolean is_assigned;
gboolean updating;
};
-
+/* Extends the UI definition in CompEditor */
+static const gchar *ui =
+"<ui>"
+" <menubar action='main-menu'>"
+" <menu action='view-menu'>"
+" <menuitem action='view-type'/>"
+" <menuitem action='view-status'/>"
+" <menuitem action='view-role'/>"
+" <menuitem action='view-rsvp'/>"
+" <separator/>"
+" <menuitem action='view-time-zone'/>"
+" <menuitem action='view-categories'/>"
+" </menu>"
+" <menu action='insert-menu'>"
+" <menuitem action='send-options'/>"
+" </menu>"
+" <menu action='options-menu'>"
+" <menu action='classification-menu'>"
+" <menuitem action='classify-public'/>"
+" <menuitem action='classify-private'/>"
+" <menuitem action='classify-confidential'/>"
+" </menu>"
+" <menuitem action='option-status'/>"
+" </menu>"
+" </menubar>"
+" <toolbar name='main-toolbar'>"
+" <toolitem action='view-time-zone'/>"
+" <toolitem action='option-status'/>"
+" </toolbar>"
+"</ui>";
-static void task_editor_set_e_cal (CompEditor *editor, ECal *client);
static void task_editor_edit_comp (CompEditor *editor, ECalComponent *comp);
static gboolean task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method);
-static void task_editor_finalize (GObject *object);
-
-static void model_row_change_insert_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data);
-static void model_row_delete_cb (GtkTreeModel *model, GtkTreePath *path, gpointer data);
G_DEFINE_TYPE (TaskEditor, task_editor, TYPE_COMP_EDITOR)
-/* Class initialization function for the event editor */
static void
-task_editor_class_init (TaskEditorClass *klass)
+action_option_status_cb (GtkAction *action,
+ TaskEditor *editor)
{
- GObjectClass *object_class;
- CompEditorClass *editor_class;
-
- object_class = (GObjectClass *) klass;
- editor_class = (CompEditorClass *) klass;
-
- editor_class->set_e_cal = task_editor_set_e_cal;
- editor_class->edit_comp = task_editor_edit_comp;
- editor_class->send_comp = task_editor_send_comp;
-
- object_class->finalize = task_editor_finalize;
+ gtk_widget_show (editor->priv->task_details_window);
}
static void
-init_widgets (TaskEditor *te)
+action_send_options_cb (GtkAction *action,
+ TaskEditor *editor)
{
- TaskEditorPrivate *priv;
+ task_page_sendoptions_clicked_cb (editor->priv->task_page);
+}
- priv = te->priv;
+static GtkActionEntry task_entries[] = {
- g_signal_connect((priv->model), "row_changed",
- G_CALLBACK (model_row_change_insert_cb), te);
- g_signal_connect((priv->model), "row_inserted",
- G_CALLBACK (model_row_change_insert_cb), te);
- g_signal_connect((priv->model), "row_deleted",
- G_CALLBACK (model_row_delete_cb), te);
-}
+ { "option-status",
+ "stock_view-details",
+ N_("_Status Details"),
+ "<Control>t",
+ N_("Click to change or view the status details of the task"),
+ G_CALLBACK (action_option_status_cb) }
+};
-static void
-client_changed_cb (CompEditorPage *page, ECal *client, gpointer user_data)
-{
-// set_menu_sens (TASK_EDITOR (user_data));
-}
+static GtkActionEntry assigned_task_entries[] = {
+
+ { "send-options",
+ NULL,
+ N_("_Send Options"),
+ NULL,
+ N_("Insert advanced send options"),
+ G_CALLBACK (action_send_options_cb) }
+};
static void
-menu_view_role_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+task_editor_client_changed_cb (TaskEditor *te)
{
- TaskEditor *te = (TaskEditor *) user_data;
+ ECal *client;
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
- task_page_set_view_role (te->priv->task_page, atoi(state));
- calendar_config_set_show_role (atoi(state));
+ client = comp_editor_get_client (COMP_EDITOR (te));
+ e_meeting_store_set_e_cal (te->priv->model, client);
}
static void
-menu_view_status_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+task_editor_model_changed_cb (TaskEditor *te)
{
- TaskEditor *te = (TaskEditor *) user_data;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
-
- task_page_set_view_status (te->priv->task_page, atoi(state));
- calendar_config_set_show_status (atoi(state));
+ if (!te->priv->updating) {
+ comp_editor_set_changed (COMP_EDITOR (te), TRUE);
+ comp_editor_set_needs_send (COMP_EDITOR (te), TRUE);
+ }
}
-static void
-menu_view_type_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+static GObject *
+task_editor_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties)
{
- TaskEditor *te = (TaskEditor *) user_data;
+ GObject *object;
+ CompEditor *editor;
+ CompEditorFlags flags;
+ TaskEditorPrivate *priv;
+ GtkActionGroup *action_group;
+ ECal *client;
+ gboolean is_assigned;
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
- task_page_set_view_type (te->priv->task_page, atoi(state));
- calendar_config_set_show_type (atoi(state));
-}
+ /* Chain up to parent's constructor() method. */
+ object = G_OBJECT_CLASS (task_editor_parent_class)->constructor (
+ type, n_construct_properties, construct_properties);
-static void
-menu_view_rsvp_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
-{
- TaskEditor *te = (TaskEditor *) user_data;
+ editor = COMP_EDITOR (object);
+ priv = TASK_EDITOR_GET_PRIVATE (object);
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
- task_page_set_view_rsvp (te->priv->task_page, atoi(state));
- calendar_config_set_show_rsvp (atoi(state));
-}
+ client = comp_editor_get_client (editor);
+ flags = comp_editor_get_flags (editor);
+ action_group = comp_editor_get_action_group (editor, "coordinated");
-static void
-menu_show_time_zone_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
-{
- TaskEditor *te = (TaskEditor *) user_data;
+ is_assigned = flags & COMP_EDITOR_IS_ASSIGNED;
+
+ task_page_set_assignment (priv->task_page, is_assigned);
+ gtk_action_group_set_visible (action_group, is_assigned);
+
+ if (is_assigned) {
+ if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS))
+ task_page_show_options (priv->task_page);
+ comp_editor_set_group_item (editor, TRUE);
+ }
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
- task_page_set_show_timezone (te->priv->task_page, atoi(state));
- calendar_config_set_show_timezone (atoi(state));
+ return object;
}
static void
-menu_show_categories_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+task_editor_dispose (GObject *object)
{
- TaskEditor *te = (TaskEditor *) user_data;
+ TaskEditorPrivate *priv;
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
+ priv = TASK_EDITOR_GET_PRIVATE (object);
- task_page_set_show_categories (te->priv->task_page, atoi(state));
- calendar_config_set_show_categories (atoi(state));
-}
+ if (priv->task_page) {
+ g_object_unref (priv->task_page);
+ priv->task_page = NULL;
+ }
-static void
-menu_class_public_cb (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
-{
- TaskEditor *te = (TaskEditor *) user_data;
+ if (priv->task_details_page) {
+ g_object_unref (priv->task_details_page);
+ priv->task_details_page = NULL;
+ }
- if (state[0] == '0')
- return;
+ if (priv->model) {
+ g_object_unref (priv->model);
+ priv->model = NULL;
+ }
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (te->priv->task_page));
- task_page_set_classification (te->priv->task_page, E_CAL_COMPONENT_CLASS_PUBLIC);
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (task_editor_parent_class)->dispose (object);
}
static void
-menu_class_private_cb (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+task_editor_show_categories (CompEditor *editor,
+ gboolean visible)
{
- TaskEditor *te = (TaskEditor *) user_data;
- if (state[0] == '0')
- return;
+ TaskEditorPrivate *priv;
+
+ priv = TASK_EDITOR_GET_PRIVATE (editor);
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (te->priv->task_page));
- task_page_set_classification (te->priv->task_page, E_CAL_COMPONENT_CLASS_PRIVATE);
+ task_page_set_show_categories (priv->task_page, visible);
}
static void
-menu_class_confidential_cb (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+task_editor_show_role (CompEditor *editor,
+ gboolean visible)
{
- TaskEditor *te = (TaskEditor *) user_data;
- if (state[0] == '0')
- return;
+ TaskEditorPrivate *priv;
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (te->priv->task_page));
- task_page_set_classification (te->priv->task_page, E_CAL_COMPONENT_CLASS_CONFIDENTIAL);
-}
+ priv = TASK_EDITOR_GET_PRIVATE (editor);
+ task_page_set_view_role (priv->task_page, visible);
+}
static void
-menu_option_status_cb (BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+task_editor_show_rsvp (CompEditor *editor,
+ gboolean visible)
{
- TaskEditor *te = (TaskEditor *) user_data;
+ TaskEditorPrivate *priv;
- gtk_widget_show (te->priv->task_details_window);
+ priv = TASK_EDITOR_GET_PRIVATE (editor);
+
+ task_page_set_view_rsvp (priv->task_page, visible);
}
static void
-menu_insert_send_options_cmd (BonoboUIComponent *uic,
- void *data,
- const char *path)
+task_editor_show_status (CompEditor *editor,
+ gboolean visible)
{
- TaskEditor *te = (TaskEditor *) data;
+ TaskEditorPrivate *priv;
- task_page_sendoptions_clicked_cb (te->priv->task_page);
-}
+ priv = TASK_EDITOR_GET_PRIVATE (editor);
-static void
-menu_show_time_zone_cmd (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{ /* TODO implement it
- TaskEditor *te = (TaskEditor *) data;
-
- task_page_set_show_timezone (te->priv->task_page, atoi(state));
- calendar_config_set_show_timezone (atoi(state)); */
+ task_page_set_view_status (priv->task_page, visible);
}
static void
-menu_option_status_cmd (BonoboUIComponent *uic,
- void *data,
- const char *path)
+task_editor_show_time_zone (CompEditor *editor,
+ gboolean visible)
{
- TaskEditor *te = (TaskEditor *) data;
-
- gtk_widget_show (te->priv->task_details_window);
-}
-
-static BonoboUIVerb verbs [] = {
-
- BONOBO_UI_VERB ("ViewTimeZone", menu_show_time_zone_cmd),
- BONOBO_UI_VERB ("OptionStatus", menu_option_status_cmd),
- BONOBO_UI_VERB ("InsertSendOptions", menu_insert_send_options_cmd),
- BONOBO_UI_VERB_END
-};
-
-static EPixmap pixmaps[] = {
- E_PIXMAP ("/commands/OptionStatus", "stock_view-details", E_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ViewTimeZone", "stock_timezone", E_ICON_SIZE_MENU),
+ TaskEditorPrivate *priv;
- E_PIXMAP ("/Toolbar/ViewTimeZone", "stock_timezone", E_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/OptionStatus", "stock_view-details", E_ICON_SIZE_LARGE_TOOLBAR),
-
- E_PIXMAP_END
-};
+ priv = TASK_EDITOR_GET_PRIVATE (editor);
+ task_page_set_show_timezone (priv->task_page, visible);
+}
-/* Object initialization function for the task editor */
static void
-task_editor_init (TaskEditor *te)
+task_editor_show_type (CompEditor *editor,
+ gboolean visible)
{
TaskEditorPrivate *priv;
- CompEditor *editor = COMP_EDITOR(te);
- gboolean status;
- char *xmlfile;
- priv = g_new0 (TaskEditorPrivate, 1);
- te->priv = priv;
+ priv = TASK_EDITOR_GET_PRIVATE (editor);
- priv->model = E_MEETING_STORE (e_meeting_store_new ());
- priv->assignment_shown = TRUE;
- priv->updating = FALSE;
- priv->is_assigned = FALSE;
-
- bonobo_ui_component_freeze (editor->uic, NULL);
-
- bonobo_ui_component_add_verb_list_with_data (editor->uic, verbs, te);
-
- xmlfile = g_build_filename (EVOLUTION_UIDIR,
- "evolution-task-editor.xml",
- NULL);
- bonobo_ui_util_set_ui (editor->uic, PREFIX,
- xmlfile,
- "evolution-task-editor", NULL);
- g_free (xmlfile);
-
- /* Show hide the status fields */
- status = calendar_config_get_show_status ();
- bonobo_ui_component_set_prop (
- editor->uic, "/commands/ViewStatus",
- "state", status ? "1" : "0", NULL);
- bonobo_ui_component_add_listener (
- editor->uic, "ViewStatus",
- menu_view_status_cb, editor);
-
- /* Show hide the type fields */
- status = calendar_config_get_show_type ();
- bonobo_ui_component_set_prop (
- editor->uic, "/commands/ViewType",
- "state", status ? "1" : "0", NULL);
- bonobo_ui_component_add_listener (
- editor->uic, "ViewType",
- menu_view_type_cb, editor);
-
- /* Show hide the role fields */
- status = calendar_config_get_show_role ();
- bonobo_ui_component_set_prop (
- editor->uic, "/commands/ViewRole",
- "state", status ? "1" : "0", NULL);
- bonobo_ui_component_add_listener (
- editor->uic, "ViewRole",
- menu_view_role_cb, editor);
-
- /* Show hide the rsvp fields */
- status = calendar_config_get_show_rsvp ();
- bonobo_ui_component_set_prop (
- editor->uic, "/commands/ViewRSVP",
- "state", status ? "1" : "0", NULL);
- bonobo_ui_component_add_listener (
- editor->uic, "ViewRSVP",
- menu_view_rsvp_cb, editor);
-
- status = calendar_config_get_show_timezone ();
- bonobo_ui_component_set_prop (
- editor->uic, "/commands/ViewTimeZone",
- "state", status ? "1" : "0", NULL);
- bonobo_ui_component_add_listener (
- editor->uic, "ViewTimeZone",
- menu_show_time_zone_cb, editor);
-
- status = calendar_config_get_show_categories ();
- bonobo_ui_component_set_prop (
- editor->uic, "/commands/ViewCategories",
- "state", status ? "1" : "0", NULL);
- bonobo_ui_component_add_listener (
- editor->uic, "ViewCategories",
- menu_show_categories_cb, editor);
-
- bonobo_ui_component_set_prop (
- editor->uic, "/commands/ActionClassPublic",
- "state", "1", NULL);
- bonobo_ui_component_add_listener (
- editor->uic, "ActionClassPublic",
- menu_class_public_cb, editor);
- bonobo_ui_component_add_listener (
- editor->uic, "ActionClassPrivate",
- menu_class_private_cb, editor);
- bonobo_ui_component_add_listener (
- editor->uic, "ActionClassConfidential",
- menu_class_confidential_cb, editor);
-
- bonobo_ui_component_add_listener (
- editor->uic, "OptionStatus",
- menu_option_status_cb, editor);
-
- e_pixmaps_update (editor->uic, pixmaps);
-
- bonobo_ui_component_thaw (editor->uic, NULL);
-
-
- comp_editor_set_help_section (COMP_EDITOR (te), "usage-calendar-todo");
+ task_page_set_view_type (priv->task_page, visible);
}
-TaskEditor *
-task_editor_construct (TaskEditor *te, ECal *client)
+static void
+task_editor_class_init (TaskEditorClass *class)
{
- TaskEditorPrivate *priv;
- gboolean read_only = FALSE;
- CompEditor *editor = COMP_EDITOR (te);
-
- priv = te->priv;
-
- priv->task_page = task_page_new (priv->model, client, editor->uic);
- g_object_ref_sink (priv->task_page);
- comp_editor_append_page (COMP_EDITOR (te),
- COMP_EDITOR_PAGE (priv->task_page),
- _("_Task"), TRUE);
- g_signal_connect (G_OBJECT (priv->task_page), "client_changed",
- G_CALLBACK (client_changed_cb), te);
-
- priv->task_details_window = gtk_dialog_new_with_buttons (_("Task Details"),
- (GtkWindow *) te, GTK_DIALOG_MODAL,
- "gtk-close", GTK_RESPONSE_CLOSE,
- NULL);
- g_signal_connect (priv->task_details_window, "response", G_CALLBACK(gtk_widget_hide), NULL);
- g_signal_connect (priv->task_details_window, "delete-event", G_CALLBACK(gtk_widget_hide), NULL);
-
- priv->task_details_page = task_details_page_new ();
- g_object_ref_sink (priv->task_details_page);
- gtk_container_add ((GtkContainer *) GTK_DIALOG(priv->task_details_window)->vbox,
- comp_editor_page_get_widget ((CompEditorPage *)priv->task_details_page));
- gtk_widget_show_all (gtk_bin_get_child (GTK_BIN (priv->task_details_window) ) );
- /* gtk_widget_hide (priv->task_details_window); */
- comp_editor_append_page (editor, COMP_EDITOR_PAGE (priv->task_details_page), NULL, FALSE);
-
- if (!e_cal_is_read_only (client, &read_only, NULL))
- read_only = TRUE;
-
- if (priv->is_assigned) {
- if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS))
- task_page_show_options (priv->task_page);
-
- task_page_set_assignment (priv->task_page, TRUE);
- comp_editor_set_group_item (COMP_EDITOR (te), TRUE);
- } else {
- task_page_set_assignment (priv->task_page, FALSE);
-
- bonobo_ui_component_set_prop (editor->uic, "/commands/InsertSendOptions", "hidden", "1", NULL);
- bonobo_ui_component_set_prop (editor->uic, "/commands/ViewRole", "hidden", "1", NULL);
- bonobo_ui_component_set_prop (editor->uic, "/commands/ViewRSVP", "hidden", "1", NULL);
- bonobo_ui_component_set_prop (editor->uic, "/commands/ViewType", "hidden", "1", NULL);
- bonobo_ui_component_set_prop (editor->uic, "/commands/ViewStatus", "hidden", "1", NULL);
- bonobo_ui_component_set_prop (editor->uic, "/menu/View/AttendeeOptions/timezonesep", "hidden", "1", NULL);
- }
+ GObjectClass *object_class;
+ CompEditorClass *editor_class;
- comp_editor_set_e_cal (COMP_EDITOR (te), client);
+ g_type_class_add_private (class, sizeof (TaskEditorPrivate));
- init_widgets (te);
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructor = task_editor_constructor;
+ object_class->dispose = task_editor_dispose;
- return te;
+ editor_class = COMP_EDITOR_CLASS (class);
+ editor_class->help_section = "usage-calendar-todo";
+ editor_class->edit_comp = task_editor_edit_comp;
+ editor_class->send_comp = task_editor_send_comp;
+ editor_class->show_categories = task_editor_show_categories;
+ editor_class->show_role = task_editor_show_role;
+ editor_class->show_rsvp = task_editor_show_rsvp;
+ editor_class->show_status = task_editor_show_status;
+ editor_class->show_time_zone = task_editor_show_time_zone;
+ editor_class->show_type = task_editor_show_type;
}
static void
-task_editor_set_e_cal (CompEditor *editor, ECal *client)
+task_editor_init (TaskEditor *te)
{
- TaskEditor *te;
- TaskEditorPrivate *priv;
-
- te = TASK_EDITOR (editor);
- priv = te->priv;
-
- e_meeting_store_set_e_cal (priv->model, client);
+ CompEditor *editor = COMP_EDITOR (te);
+ GtkUIManager *manager;
+ GtkActionGroup *action_group;
+ GError *error = NULL;
+
+ te->priv = TASK_EDITOR_GET_PRIVATE (te);
+ te->priv->model = E_MEETING_STORE (e_meeting_store_new ());
+ te->priv->assignment_shown = TRUE;
+ te->priv->updating = FALSE;
+
+ te->priv->task_page = task_page_new (te->priv->model, editor);
+ g_object_ref_sink (te->priv->task_page);
+ comp_editor_append_page (
+ editor, COMP_EDITOR_PAGE (te->priv->task_page),
+ _("_Task"), TRUE);
+
+ te->priv->task_details_window = gtk_dialog_new_with_buttons (
+ _("Task Details"), GTK_WINDOW (te), GTK_DIALOG_MODAL,
+ GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
+ g_signal_connect (
+ te->priv->task_details_window, "response",
+ G_CALLBACK (gtk_widget_hide), NULL);
+ g_signal_connect (
+ te->priv->task_details_window, "delete-event",
+ G_CALLBACK(gtk_widget_hide), NULL);
+
+ te->priv->task_details_page = task_details_page_new (editor);
+ g_object_ref_sink (te->priv->task_details_page);
+ gtk_container_add (
+ GTK_CONTAINER (GTK_DIALOG (te->priv->task_details_window)->vbox),
+ comp_editor_page_get_widget ((CompEditorPage *) te->priv->task_details_page));
+ gtk_widget_show_all (gtk_bin_get_child (GTK_BIN (te->priv->task_details_window)));
+ comp_editor_append_page (
+ editor, COMP_EDITOR_PAGE (te->priv->task_details_page), NULL, FALSE);
+
+ action_group = comp_editor_get_action_group (editor, "individual");
+ gtk_action_group_add_actions (
+ action_group, task_entries,
+ G_N_ELEMENTS (task_entries), te);
+
+ action_group = comp_editor_get_action_group (editor, "coordinated");
+ gtk_action_group_add_actions (
+ action_group, assigned_task_entries,
+ G_N_ELEMENTS (assigned_task_entries), te);
+
+ manager = comp_editor_get_ui_manager (editor);
+ gtk_ui_manager_add_ui_from_string (manager, ui, -1, &error);
+ e_plugin_ui_register_manager ("task-editor", manager, te);
+
+ if (error != NULL) {
+ g_critical ("%s: %s", G_STRFUNC, error->message);
+ g_error_free (error);
+ }
- if (COMP_EDITOR_CLASS (task_editor_parent_class)->set_e_cal)
- COMP_EDITOR_CLASS (task_editor_parent_class)->set_e_cal (editor, client);
+ g_signal_connect (
+ te, "notify::client",
+ G_CALLBACK (task_editor_client_changed_cb), NULL);
+
+ g_signal_connect_swapped (
+ te->priv->model, "row_changed",
+ G_CALLBACK (task_editor_model_changed_cb), te);
+ g_signal_connect_swapped (
+ te->priv->model, "row_inserted",
+ G_CALLBACK (task_editor_model_changed_cb), te);
+ g_signal_connect_swapped (
+ te->priv->model, "row_deleted",
+ G_CALLBACK (task_editor_model_changed_cb), te);
}
static void
task_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
{
- TaskEditor *te;
TaskEditorPrivate *priv;
ECalComponentOrganizer organizer;
ECal *client;
GSList *attendees = NULL;
- te = TASK_EDITOR (editor);
- priv = te->priv;
+ priv = TASK_EDITOR_GET_PRIVATE (editor);
priv->updating = TRUE;
if (COMP_EDITOR_CLASS (task_editor_parent_class)->edit_comp)
COMP_EDITOR_CLASS (task_editor_parent_class)->edit_comp (editor, comp);
- client = comp_editor_get_e_cal (COMP_EDITOR (editor));
+ client = comp_editor_get_client (editor);
/* Get meeting related stuff */
e_cal_component_get_organizer (comp, &organizer);
@@ -553,12 +436,12 @@ task_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
}
- comp_editor_set_group_item (COMP_EDITOR (te), TRUE);
+ comp_editor_set_group_item (editor, TRUE);
priv->assignment_shown = TRUE;
}
e_cal_component_free_attendee_list (attendees);
- comp_editor_set_needs_send (COMP_EDITOR (te), priv->assignment_shown && itip_organizer_is_user (comp, client));
+ comp_editor_set_needs_send (editor, priv->assignment_shown && itip_organizer_is_user (comp, client));
priv->updating = FALSE;
}
@@ -566,11 +449,10 @@ task_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
static gboolean
task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method)
{
- TaskEditor *te = TASK_EDITOR (editor);
TaskEditorPrivate *priv;
ECalComponent *comp = NULL;
- priv = te->priv;
+ priv = TASK_EDITOR_GET_PRIVATE (editor);
/* Don't cancel more than once or when just publishing */
if (method == E_CAL_COMPONENT_METHOD_PUBLISH ||
@@ -598,40 +480,6 @@ task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method)
return FALSE;
}
-/* Destroy handler for the event editor */
-static void
-task_editor_finalize (GObject *object)
-{
- TaskEditor *te;
- TaskEditorPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_TASK_EDITOR (object));
-
- te = TASK_EDITOR (object);
- priv = te->priv;
-
- if (priv->task_page) {
- g_object_unref (priv->task_page);
- priv->task_page = NULL;
- }
-
- if (priv->task_details_page) {
- g_object_unref (priv->task_details_page);
- priv->task_details_page = NULL;
- }
-
- if (priv->model) {
- g_object_unref (priv->model);
- priv->model = NULL;
- }
-
- g_free (priv);
-
- if (G_OBJECT_CLASS (task_editor_parent_class)->finalize)
- (* G_OBJECT_CLASS (task_editor_parent_class)->finalize) (object);
-}
-
/**
* task_editor_new:
* @client: a ECal
@@ -641,61 +489,31 @@ task_editor_finalize (GObject *object)
* Return value: A newly-created event editor dialog, or NULL if the event
* editor could not be created.
**/
-TaskEditor *
+CompEditor *
task_editor_new (ECal *client, CompEditorFlags flags)
{
- TaskEditor *te;
-
- te = g_object_new (TYPE_TASK_EDITOR, NULL);
- te->priv->is_assigned = flags & COMP_EDITOR_IS_ASSIGNED;
- comp_editor_set_flags (COMP_EDITOR (te), flags);
-
- return task_editor_construct (te, client);
-}
-
-static void
-show_assignment (TaskEditor *te)
-{
- TaskEditorPrivate *priv;
-
- priv = te->priv;
-
- task_page_set_assignment (priv->task_page, TRUE);
- if (!priv->assignment_shown) {
- priv->assignment_shown = TRUE;
-
- comp_editor_set_needs_send (COMP_EDITOR (te), priv->assignment_shown);
- comp_editor_set_changed (COMP_EDITOR (te), FALSE);
- }
+ g_return_val_if_fail (E_IS_CAL (client), NULL);
+ return g_object_new (
+ TYPE_TASK_EDITOR,
+ "flags", flags, "client", client, NULL);
}
void
task_editor_show_assignment (TaskEditor *te)
{
- g_return_if_fail (te != NULL);
+ CompEditor *editor;
+
g_return_if_fail (IS_TASK_EDITOR (te));
- show_assignment (te);
-}
+ editor = COMP_EDITOR (te);
-static void
-model_changed (TaskEditor *te)
-{
- if (!te->priv->updating) {
- comp_editor_set_changed (COMP_EDITOR (te), TRUE);
- comp_editor_set_needs_send (COMP_EDITOR (te), TRUE);
+ task_page_set_assignment (te->priv->task_page, TRUE);
+ if (!te->priv->assignment_shown) {
+ te->priv->assignment_shown = TRUE;
+ comp_editor_set_needs_send (editor, TRUE);
+ comp_editor_set_changed (editor, FALSE);
}
-}
-static void
-model_row_change_insert_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
-{
- model_changed (TASK_EDITOR (data));
}
-static void
-model_row_delete_cb (GtkTreeModel *model, GtkTreePath *path, gpointer data)
-{
- model_changed (TASK_EDITOR (data));
-}
diff --git a/calendar/gui/dialogs/task-editor.h b/calendar/gui/dialogs/task-editor.h
index 63c4b24081..2f8330d8e4 100644
--- a/calendar/gui/dialogs/task-editor.h
+++ b/calendar/gui/dialogs/task-editor.h
@@ -27,14 +27,26 @@
#include <gtk/gtk.h>
#include "comp-editor.h"
-
+/* Standard GObject macros */
+#define TYPE_TASK_EDITOR \
+ (task_editor_get_type ())
+#define TASK_EDITOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), TYPE_TASK_EDITOR, TaskEditor))
+#define TASK_EDITOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), TYPE_TASK_EDITOR, TaskEditorClass))
+#define IS_TASK_EDITOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), TYPE_TASK_EDITOR))
+#define IS_TASK_EDITOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), TYPE_TASK_EDITOR))
+#define TASK_EDITOR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), TYPE_TASK_EDITOR, TaskEditorClass))
-#define TYPE_TASK_EDITOR (task_editor_get_type ())
-#define TASK_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TASK_EDITOR, TaskEditor))
-#define TASK_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TASK_EDITOR, \
- TaskEditorClass))
-#define IS_TASK_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TASK_EDITOR))
-#define IS_TASK_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TASK_EDITOR))
+G_BEGIN_DECLS
typedef struct _TaskEditor TaskEditor;
typedef struct _TaskEditorClass TaskEditorClass;
@@ -42,8 +54,6 @@ typedef struct _TaskEditorPrivate TaskEditorPrivate;
struct _TaskEditor {
CompEditor parent;
-
- /* Private data */
TaskEditorPrivate *priv;
};
@@ -51,11 +61,11 @@ struct _TaskEditorClass {
CompEditorClass parent_class;
};
-GType task_editor_get_type (void);
-TaskEditor *task_editor_construct (TaskEditor *te,
- ECal *client);
-TaskEditor *task_editor_new (ECal *client, CompEditorFlags flags);
-void task_editor_show_assignment(TaskEditor *te);
-
+GType task_editor_get_type (void);
+CompEditor * task_editor_new (ECal *client,
+ CompEditorFlags flags);
+void task_editor_show_assignment (TaskEditor *te);
+
+G_END_DECLS
#endif /* __TASK_EDITOR_H__ */
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index e62f691219..87142a7671 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -49,16 +49,16 @@
#include "../e-meeting-store.h"
#include "../e-meeting-list-view.h"
#include "../e-cal-popup.h"
-
+
+#define TASK_PAGE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), TYPE_TASK_PAGE, TaskPagePrivate))
/* Private part of the TaskPage structure */
struct _TaskPagePrivate {
/* Glade XML data */
GladeXML *xml;
- /* Bonobo Controller for the menu/toolbar */
- BonoboUIComponent *uic;
-
/* Widgets from the Glade file */
GtkWidget *main;
@@ -91,8 +91,6 @@ struct _TaskPagePrivate {
GtkWidget *description;
- ECalComponentClassification classification;
-
GtkWidget *categories_btn;
GtkWidget *categories;
@@ -118,7 +116,6 @@ struct _TaskPagePrivate {
gboolean user_org;
gboolean existing;
- gboolean updating;
gboolean sendoptions_shown;
gboolean is_assignment;
@@ -141,159 +138,87 @@ static void task_page_focus_main_widget (CompEditorPage *page);
static gboolean task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp);
static gboolean task_page_fill_component (CompEditorPage *page, ECalComponent *comp);
static gboolean task_page_fill_timezones (CompEditorPage *page, GHashTable *timezones);
-static void task_page_set_summary (CompEditorPage *page, const char *summary);
-static void task_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates);
static void task_page_select_organizer (TaskPage *tpage, const char *backend_address);
static void set_subscriber_info_string (TaskPage *tpage, const char *backend_address);
G_DEFINE_TYPE (TaskPage, task_page, TYPE_COMP_EDITOR_PAGE)
-/* Class initialization function for the task page */
static void
-task_page_class_init (TaskPageClass *class)
-{
- CompEditorPageClass *editor_page_class;
- GObjectClass *object_class;
-
- editor_page_class = (CompEditorPageClass *) class;
- object_class = (GObjectClass *) class;
-
- editor_page_class->get_widget = task_page_get_widget;
- editor_page_class->focus_main_widget = task_page_focus_main_widget;
- editor_page_class->fill_widgets = task_page_fill_widgets;
- editor_page_class->fill_component = task_page_fill_component;
- editor_page_class->fill_timezones = task_page_fill_timezones;
- editor_page_class->set_summary = task_page_set_summary;
- editor_page_class->set_dates = task_page_set_dates;
-
- object_class->finalize = task_page_finalize;
-}
-
-/* Object initialization function for the task page */
-static void
-task_page_init (TaskPage *tpage)
+task_page_dispose (GObject *object)
{
TaskPagePrivate *priv;
- priv = g_new0 (TaskPagePrivate, 1);
- tpage->priv = priv;
-
- priv->xml = NULL;
- priv->uic = NULL;
-
- priv->main = NULL;
- priv->summary = NULL;
- priv->summary_label = NULL;
- priv->due_date = NULL;
- priv->start_date = NULL;
- priv->timezone = NULL;
- priv->description = NULL;
- priv->classification = E_CAL_COMPONENT_CLASS_NONE;
- priv->categories_btn = NULL;
- priv->categories = NULL;
- priv->sendoptions_shown = FALSE;
- priv->sod = NULL;
-
- priv->info_hbox = NULL;
- priv->info_icon = NULL;
- priv->info_string = NULL;
+ priv = TASK_PAGE_GET_PRIVATE (object);
- priv->updating = FALSE;
- priv->sendoptions_shown = FALSE;
- priv->is_assignment = FALSE;
-
- priv->deleted_attendees = g_ptr_array_new ();
-
- priv->comp = NULL;
+ if (priv->main != NULL) {
+ g_object_unref (priv->main);
+ priv->main = NULL;
+ }
- priv->accounts = NULL;
- priv->address_strings = NULL;
- priv->ia = NULL;
- priv->invite = NULL;
+ if (priv->xml != NULL) {
+ g_object_unref (priv->xml);
+ priv->xml = NULL;
+ }
- priv->model = NULL;
- priv->list_view = NULL;
-}
+ if (priv->sod != NULL) {
+ g_object_unref (priv->sod);
+ priv->sod = NULL;
+ }
-static void
-cleanup_attendees (GPtrArray *attendees)
-{
- int i;
+ if (priv->comp != NULL) {
+ g_object_unref (priv->comp);
+ priv->comp = NULL;
+ }
- for (i = 0; i < attendees->len; i++)
- g_object_unref (g_ptr_array_index (attendees, i));
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (task_page_parent_class)->dispose (object);
}
-/* Destroy handler for the task page */
static void
task_page_finalize (GObject *object)
{
- TaskPage *tpage;
TaskPagePrivate *priv;
- GList *l;
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_TASK_PAGE (object));
+ priv = TASK_PAGE_GET_PRIVATE (object);
- tpage = TASK_PAGE (object);
- priv = tpage->priv;
-
- for (l = priv->address_strings; l != NULL; l = l->next)
- g_free (l->data);
+ g_list_foreach (priv->address_strings, (GFunc) g_free, NULL);
g_list_free (priv->address_strings);
- if (priv->main)
- g_object_unref (priv->main);
-
- if (priv->xml) {
- g_object_unref (priv->xml);
- priv->xml = NULL;
- }
+ g_ptr_array_foreach (
+ priv->deleted_attendees, (GFunc) g_object_unref, NULL);
+ g_ptr_array_free (priv->deleted_attendees, TRUE);
- if (priv->sod) {
- g_object_unref (priv->sod);
- priv->sod = NULL;
- }
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (task_page_parent_class)->finalize (object);
+}
- if (priv->comp != NULL)
- g_object_unref (priv->comp);
+static void
+task_page_class_init (TaskPageClass *class)
+{
+ GObjectClass *object_class;
+ CompEditorPageClass *editor_page_class;
- cleanup_attendees (priv->deleted_attendees);
- g_ptr_array_free (priv->deleted_attendees, TRUE);
+ g_type_class_add_private (class, sizeof (TaskPagePrivate));
- g_free (priv);
- tpage->priv = NULL;
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = task_page_dispose;
+ object_class->finalize = task_page_finalize;
- if (G_OBJECT_CLASS (task_page_parent_class)->finalize)
- (* G_OBJECT_CLASS (task_page_parent_class)->finalize) (object);
+ editor_page_class = COMP_EDITOR_PAGE_CLASS (class);
+ editor_page_class->get_widget = task_page_get_widget;
+ editor_page_class->focus_main_widget = task_page_focus_main_widget;
+ editor_page_class->fill_widgets = task_page_fill_widgets;
+ editor_page_class->fill_component = task_page_fill_component;
+ editor_page_class->fill_timezones = task_page_fill_timezones;
}
static void
-set_classification_menu (TaskPage *page, gint class)
+task_page_init (TaskPage *tpage)
{
- bonobo_ui_component_freeze (page->priv->uic, NULL);
- switch (class) {
- case E_CAL_COMPONENT_CLASS_PUBLIC:
- bonobo_ui_component_set_prop (
- page->priv->uic, "/commands/ActionClassPublic",
- "state", "1", NULL);
- break;
- case E_CAL_COMPONENT_CLASS_CONFIDENTIAL:
- bonobo_ui_component_set_prop (
- page->priv->uic, "/commands/ActionClassConfidential",
- "state", "1", NULL);
- break;
- case E_CAL_COMPONENT_CLASS_PRIVATE:
- bonobo_ui_component_set_prop (
- page->priv->uic, "/commands/ActionClassPrivate",
- "state", "1", NULL);
- break;
- }
- bonobo_ui_component_thaw (page->priv->uic, NULL);
+ tpage->priv = TASK_PAGE_GET_PRIVATE (tpage);
+ tpage->priv->deleted_attendees = g_ptr_array_new ();
}
-
-
/* get_widget handler for the task page */
static GtkWidget *
task_page_get_widget (CompEditorPage *page)
@@ -324,9 +249,10 @@ task_page_focus_main_widget (CompEditorPage *page)
static void
clear_widgets (TaskPage *tpage)
{
- TaskPagePrivate *priv;
+ TaskPagePrivate *priv = tpage->priv;
+ CompEditor *editor;
- priv = tpage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage));
/* Summary, description */
e_dialog_editable_set (priv->summary, NULL);
@@ -337,8 +263,7 @@ clear_widgets (TaskPage *tpage)
e_date_edit_set_time (E_DATE_EDIT (priv->due_date), 0);
/* Classification */
- priv->classification = E_CAL_COMPONENT_CLASS_PUBLIC;
- set_classification_menu (tpage, priv->classification);
+ comp_editor_set_classification (editor, E_CAL_COMPONENT_CLASS_PUBLIC);
/* Categories */
e_dialog_editable_set (priv->categories, NULL);
@@ -376,25 +301,26 @@ task_page_set_view_rsvp (TaskPage *page, gboolean state)
e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_RSVP_COL, state);
}
-void
-task_page_set_classification (TaskPage *page, ECalComponentClassification class)
-{
- page->priv->classification = class;
-}
-
static void
sensitize_widgets (TaskPage *tpage)
{
+ TaskPagePrivate *priv = tpage->priv;
+ CompEditor *editor;
+ CompEditorFlags flags;
+ ECal *client;
+ GtkActionGroup *action_group;
+ GtkAction *action;
gboolean read_only, sens = TRUE, sensitize;
- TaskPagePrivate *priv;
- priv = tpage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage));
+ client = comp_editor_get_client (editor);
+ flags = comp_editor_get_flags (editor);
- if (!e_cal_is_read_only (COMP_EDITOR_PAGE (tpage)->client, &read_only, NULL))
+ if (!e_cal_is_read_only (client, &read_only, NULL))
read_only = TRUE;
- if (COMP_EDITOR_PAGE (tpage)->flags & COMP_EDITOR_IS_ASSIGNED)
- sens = COMP_EDITOR_PAGE (tpage)->flags & COMP_EDITOR_PAGE_USER_ORG;
+ if (flags & COMP_EDITOR_IS_ASSIGNED)
+ sens = flags & COMP_EDITOR_USER_ORG;
sensitize = (!read_only && sens);
@@ -419,23 +345,11 @@ sensitize_widgets (TaskPage *tpage)
gtk_widget_set_sensitive (priv->invite, (!read_only && sens));
gtk_widget_set_sensitive (GTK_WIDGET (priv->list_view), !read_only);
- bonobo_ui_component_set_prop (priv->uic, "/commands/InsertAttachments", "sensitive", sensitize ? "1" : "0"
- , NULL);
- bonobo_ui_component_set_prop (priv->uic, "/commands/ViewTimeZone", "sensitive", sensitize ? "1" : "0"
- , NULL);
- bonobo_ui_component_set_prop (priv->uic, "/commands/ActionClassPublic", "sensitive", sensitize ? "1" : "0"
- , NULL);
- bonobo_ui_component_set_prop (priv->uic, "/commands/ActionClassPrivate", "sensitive", sensitize ? "1" : "0"
- , NULL);
- bonobo_ui_component_set_prop (priv->uic, "/commands/ActionClassConfidential", "sensitive",
- sensitize ? "1" : "0", NULL);
- bonobo_ui_component_set_prop (priv->uic, "/commands/ViewCategories", "sensitive", sensitize ? "1" : "0"
- , NULL);
- bonobo_ui_component_set_prop (priv->uic, "/commands/InsertSendOptions", "sensitive", sensitize ? "1" : "0"
- , NULL);
- bonobo_ui_component_set_prop (priv->uic, "/commands/OptionStatus", "sensitive", sensitize ? "1" : "0"
- , NULL);
+ action_group = comp_editor_get_action_group (editor, "individual");
+ gtk_action_group_set_sensitive (action_group, sensitize);
+ action = comp_editor_get_action (editor, "send-options");
+ gtk_action_set_sensitive (action, sensitize);
if (!priv->is_assignment) {
gtk_widget_hide (priv->calendar_label);
@@ -458,20 +372,27 @@ sensitize_widgets (TaskPage *tpage)
void
task_page_hide_options (TaskPage *page)
{
- g_return_if_fail (IS_TASK_PAGE (page));
-
+ CompEditor *editor;
+ GtkAction *action;
- bonobo_ui_component_set_prop (page->priv->uic, "/commands/InsertSendOptions", "hidden", "1", NULL);
- page->priv->sendoptions_shown = FALSE;
+ g_return_if_fail (IS_TASK_PAGE (page));
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
+ action = comp_editor_get_action (editor, "send-options");
+ gtk_action_set_visible (action, FALSE);
}
+
void
task_page_show_options (TaskPage *page)
{
+ CompEditor *editor;
+ GtkAction *action;
+
g_return_if_fail (IS_TASK_PAGE (page));
- bonobo_ui_component_set_prop (page->priv->uic, "/commands/InsertSendOptions", "hidden", "0", NULL);
- page->priv->sendoptions_shown = TRUE;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
+ action = comp_editor_get_action (editor, "send-options");
+ gtk_action_set_visible (action, TRUE);
}
void
@@ -523,6 +444,9 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
ECalComponentText text;
ECalComponentDateTime d;
ECalComponentClassification cl;
+ CompEditor *editor;
+ CompEditorFlags flags;
+ ECal *client;
GSList *l;
icalcomponent *icalcomp;
const char *categories, *uid;
@@ -532,14 +456,17 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
tpage = TASK_PAGE (page);
priv = tpage->priv;
- priv->updating = TRUE;
+ editor = comp_editor_page_get_editor (page);
+ client = comp_editor_get_client (editor);
+ flags = comp_editor_get_flags (editor);
/* Clean out old data */
if (priv->comp != NULL)
g_object_unref (priv->comp);
priv->comp = NULL;
- cleanup_attendees (priv->deleted_attendees);
+ g_ptr_array_foreach (
+ priv->deleted_attendees, (GFunc) g_object_unref, NULL);
g_ptr_array_set_size (priv->deleted_attendees, 0);
/* Component for cancellation */
@@ -548,7 +475,7 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
/* Clean the screen */
clear_widgets (tpage);
- priv->user_add = itip_get_comp_attendee (comp, page->client);
+ priv->user_add = itip_get_comp_attendee (comp, client);
/* Summary, description(s) */
e_cal_component_get_summary (comp, &text);
@@ -598,7 +525,7 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
on the server, so we try to get the builtin timezone with the TZID
first. */
if (!zone && d.tzid) {
- if (!e_cal_get_timezone (page->client, d.tzid, &zone, NULL))
+ if (!e_cal_get_timezone (client, d.tzid, &zone, NULL))
/* FIXME: Handle error better. */
g_warning ("Couldn't get timezone from server: %s",
d.tzid ? d.tzid : "");
@@ -608,10 +535,12 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
zone ? zone : default_zone);
task_page_set_show_timezone (tpage, calendar_config_get_show_timezone());
- if (!(COMP_EDITOR_PAGE (tpage)->flags & COMP_EDITOR_PAGE_NEW_ITEM) && !zone) {
- task_page_set_show_timezone (tpage, FALSE);
- bonobo_ui_component_set_prop (priv->uic, "/commands/ViewTimeZone",
- "state", "0", NULL);
+ if (!(flags & COMP_EDITOR_NEW_ITEM) && !zone) {
+ GtkAction *action;
+
+ task_page_set_show_timezone (tpage, FALSE);
+ action = comp_editor_get_action (editor, "view-time-zone");
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), FALSE);
}
e_cal_component_free_datetime (&d);
@@ -646,22 +575,10 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
/* Classification. */
e_cal_component_get_classification (comp, &cl);
-
- switch (cl) {
- case E_CAL_COMPONENT_CLASS_PUBLIC:
- case E_CAL_COMPONENT_CLASS_PRIVATE:
- case E_CAL_COMPONENT_CLASS_CONFIDENTIAL:
- break;
- default:
- /* default to PUBLIC */
- cl = E_CAL_COMPONENT_CLASS_PUBLIC;
- break;
- }
- set_classification_menu (tpage, cl);
- priv->classification = cl;
+ comp_editor_set_classification (editor, cl);
e_cal_component_get_uid (comp, &uid);
- if (e_cal_get_object (COMP_EDITOR_PAGE (tpage)->client, uid, NULL, &icalcomp, NULL)) {
+ if (e_cal_get_object (client, uid, NULL, &icalcomp, NULL)) {
icalcomponent_free (icalcomp);
task_page_hide_options (tpage);
}
@@ -673,15 +590,15 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
/* Source */
e_source_combo_box_set_active (
E_SOURCE_COMBO_BOX (priv->source_selector),
- e_cal_get_source (page->client));
+ e_cal_get_source (client));
- e_cal_get_cal_address (COMP_EDITOR_PAGE (tpage)->client, &backend_addr, NULL);
+ e_cal_get_cal_address (client, &backend_addr, NULL);
set_subscriber_info_string (tpage, backend_addr);
if (priv->is_assignment) {
ECalComponentOrganizer organizer;
- priv->user_add = itip_get_comp_attendee (comp, COMP_EDITOR_PAGE (tpage)->client);
+ priv->user_add = itip_get_comp_attendee (comp, client);
/* Organizer strings */
task_page_select_organizer (tpage, backend_addr);
@@ -694,14 +611,14 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
gchar *string;
GList *list = NULL;
- if (itip_organizer_is_user (comp, page->client) || itip_sentby_is_user (comp)) {
+ if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp)) {
if (e_cal_get_static_capability (
- page->client,
+ client,
CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS))
priv->user_org = TRUE;
} else {
if (e_cal_get_static_capability (
- page->client,
+ client,
CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS))
gtk_widget_set_sensitive (priv->invite, FALSE);
gtk_widget_set_sensitive (priv->add, FALSE);
@@ -710,7 +627,7 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
priv->user_org = FALSE;
}
- if (e_cal_get_static_capability (COMP_EDITOR_PAGE (tpage)->client, CAL_STATIC_CAPABILITY_NO_ORGANIZER) && (COMP_EDITOR_PAGE (tpage)->flags & COMP_EDITOR_PAGE_DELEGATE))
+ if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_ORGANIZER) && (flags & COMP_EDITOR_DELEGATE))
string = g_strdup (priv->user_add);
else if ( organizer.cn != NULL)
string = g_strdup_printf ("%s <%s>", organizer.cn, strip);
@@ -732,9 +649,6 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
a = get_current_account (tpage);
if (a != NULL) {
- /* Reuse *page declared further up? */
- CompEditorPage *page = (CompEditorPage *) tpage;
-
priv->ia = e_meeting_store_add_attendee_with_defaults (priv->model);
g_object_ref (priv->ia);
@@ -746,7 +660,7 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
e_meeting_attendee_set_sentby (priv->ia, g_strdup_printf ("MAILTO:%s", a->id->address));
}
- if (page->client && e_cal_get_organizer_must_accept (page->client))
+ if (client && e_cal_get_organizer_must_accept (client))
e_meeting_attendee_set_status (priv->ia, ICAL_PARTSTAT_NEEDSACTION);
else
e_meeting_attendee_set_status (priv->ia, ICAL_PARTSTAT_ACCEPTED);
@@ -758,8 +672,6 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
if (backend_addr)
g_free (backend_addr);
- priv->updating = FALSE;
-
sensitize_widgets (tpage);
return TRUE;
@@ -795,7 +707,11 @@ task_page_fill_component (CompEditorPage *page, ECalComponent *comp)
{
TaskPage *tpage;
TaskPagePrivate *priv;
+ ECalComponentClassification classification;
ECalComponentDateTime date;
+ CompEditor *editor;
+ CompEditorFlags flags;
+ ECal *client;
struct icaltimetype start_tt, due_tt;
char *cat, *str;
gboolean start_date_set, due_date_set, time_set;
@@ -808,6 +724,10 @@ task_page_fill_component (CompEditorPage *page, ECalComponent *comp)
priv = tpage->priv;
text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->description));
+ editor = comp_editor_page_get_editor (page);
+ client = comp_editor_get_client (editor);
+ flags = comp_editor_get_flags (editor);
+
/* Summary. */
str = e_dialog_editable_get (priv->summary);
@@ -912,7 +832,8 @@ task_page_fill_component (CompEditorPage *page, ECalComponent *comp)
}
/* Classification. */
- e_cal_component_set_classification (comp, priv->classification);
+ classification = comp_editor_get_classification (editor);
+ e_cal_component_set_classification (comp, classification);
/* send options */
if (priv->sendoptions_shown && priv->sod)
@@ -936,7 +857,7 @@ task_page_fill_component (CompEditorPage *page, ECalComponent *comp)
EAccount *a;
gchar *backend_addr = NULL, *org_addr = NULL, *sentby = NULL;
- e_cal_get_cal_address (page->client, &backend_addr, NULL);
+ e_cal_get_cal_address (client, &backend_addr, NULL);
/* Find the identity for the organizer or sentby field */
a = get_current_account (tpage);
@@ -979,7 +900,7 @@ task_page_fill_component (CompEditorPage *page, ECalComponent *comp)
}
- if (COMP_EDITOR_PAGE (tpage)->flags & COMP_EDITOR_PAGE_DELEGATE ) {
+ if (flags & COMP_EDITOR_DELEGATE ) {
GSList *attendee_list, *l;
int i;
const GPtrArray *attendees = e_meeting_store_get_attendees (priv->model);
@@ -1019,10 +940,15 @@ static void
add_clicked_cb (GtkButton *btn, TaskPage *page)
{
EMeetingAttendee *attendee;
+ CompEditor *editor;
+ CompEditorFlags flags;
+
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
+ flags = comp_editor_get_flags (editor);
attendee = e_meeting_store_add_attendee_with_defaults (page->priv->model);
- if (COMP_EDITOR_PAGE (page)->flags & COMP_EDITOR_PAGE_DELEGATE) {
+ if (flags & COMP_EDITOR_DELEGATE) {
e_meeting_attendee_set_delfrom (attendee, g_strdup_printf ("MAILTO:%s", page->priv->user_add));
}
@@ -1085,11 +1011,13 @@ existing_attendee (EMeetingAttendee *ia, ECalComponent *comp)
static void
remove_attendee (TaskPage *page, EMeetingAttendee *ia)
{
- TaskPagePrivate *priv;
+ TaskPagePrivate *priv = page->priv;
+ CompEditor *editor;
+ CompEditorFlags flags;
int pos = 0;
- gboolean delegate = (COMP_EDITOR_PAGE (page)->flags & COMP_EDITOR_PAGE_DELEGATE);
- priv = page->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
+ flags = comp_editor_get_flags (editor);
/* If the user deletes the organizer attendee explicitly,
assume they no longer want the organizer showing up */
@@ -1106,7 +1034,7 @@ remove_attendee (TaskPage *page, EMeetingAttendee *ia)
if (ib != NULL) {
e_meeting_attendee_set_delto (ib, NULL);
- if (!delegate)
+ if (!(flags & COMP_EDITOR_DELEGATE))
e_meeting_attendee_set_edit_level (ib, E_MEETING_ATTENDEE_EDIT_FULL);
}
}
@@ -1203,34 +1131,38 @@ invite_cb (GtkWidget *widget, gpointer data)
}
static void
-attendee_added_cb (EMeetingListView *emlv, EMeetingAttendee *ia, gpointer user_data)
+attendee_added_cb (EMeetingListView *emlv,
+ EMeetingAttendee *ia,
+ TaskPage *page)
{
- TaskPage *page = TASK_PAGE (user_data);
- TaskPagePrivate *priv;
- gboolean delegate = (COMP_EDITOR_PAGE (page)->flags & COMP_EDITOR_PAGE_DELEGATE);
-
- priv = page->priv;
-
- if (delegate) {
- if (existing_attendee (ia, priv->comp))
- e_meeting_store_remove_attendee (priv->model, ia);
- else {
- if (!e_cal_get_static_capability (COMP_EDITOR_PAGE(page)->client,
- CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY)) {
- const char *delegator_id = e_meeting_attendee_get_delfrom (ia);
- EMeetingAttendee *delegator;
-
- delegator = e_meeting_store_find_attendee (priv->model, delegator_id, NULL);
- e_meeting_attendee_set_delto (delegator,
- g_strdup (e_meeting_attendee_get_address (ia)));
-
- gtk_widget_set_sensitive (priv->invite, FALSE);
- gtk_widget_set_sensitive (priv->add, FALSE);
- gtk_widget_set_sensitive (priv->edit, FALSE);
- }
- }
- }
+ TaskPagePrivate *priv = page->priv;
+ CompEditor *editor;
+ CompEditorFlags flags;
+ ECal *client;
+
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
+ client = comp_editor_get_client (editor);
+ flags = comp_editor_get_flags (editor);
+ if (!(flags & COMP_EDITOR_DELEGATE))
+ return;
+
+ if (existing_attendee (ia, priv->comp))
+ e_meeting_store_remove_attendee (priv->model, ia);
+ else {
+ if (!e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY)) {
+ const char *delegator_id = e_meeting_attendee_get_delfrom (ia);
+ EMeetingAttendee *delegator;
+
+ delegator = e_meeting_store_find_attendee (priv->model, delegator_id, NULL);
+ e_meeting_attendee_set_delto (delegator,
+ g_strdup (e_meeting_attendee_get_address (ia)));
+
+ gtk_widget_set_sensitive (priv->invite, FALSE);
+ gtk_widget_set_sensitive (priv->add, FALSE);
+ gtk_widget_set_sensitive (priv->edit, FALSE);
+ }
+ }
}
/* Callbacks for list view*/
@@ -1271,7 +1203,9 @@ context_popup_free(EPopup *ep, GSList *items, void *data)
static gint
button_press_event (GtkWidget *widget, GdkEventButton *event, TaskPage *page)
{
- TaskPagePrivate *priv;
+ TaskPagePrivate *priv = page->priv;
+ CompEditor *editor;
+ CompEditorFlags flags;
GtkMenu *menu;
EMeetingAttendee *ia;
GtkTreePath *path;
@@ -1282,12 +1216,13 @@ button_press_event (GtkWidget *widget, GdkEventButton *event, TaskPage *page)
ECalPopup *ep;
int i;
- priv = page->priv;
-
/* only process right-clicks */
if (event->button != 3 || event->type != GDK_BUTTON_PRESS)
return FALSE;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
+ flags = comp_editor_get_flags (editor);
+
/* only if we right-click on an attendee */
if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (priv->list_view), event->x, event->y, &path, NULL, NULL, NULL)) {
GtkTreeSelection *selection;
@@ -1311,7 +1246,7 @@ button_press_event (GtkWidget *widget, GdkEventButton *event, TaskPage *page)
if (GTK_WIDGET_IS_SENSITIVE(priv->add))
disable_mask &= ~ATTENDEE_CAN_ADD;
- else if (COMP_EDITOR_PAGE (page)->flags & COMP_EDITOR_PAGE_USER_ORG)
+ else if (flags & COMP_EDITOR_USER_ORG)
disable_mask &= ~ATTENDEE_CAN_ADD;
ep = e_cal_popup_new("org.gnome.evolution.calendar.task.popup");
@@ -1330,13 +1265,18 @@ static gboolean
list_view_event (EMeetingListView *list_view, GdkEvent *event, TaskPage *page) {
TaskPagePrivate *priv= page->priv;
+ CompEditor *editor;
+ CompEditorFlags flags;
+
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page));
+ flags = comp_editor_get_flags (editor);
- if (event->type == GDK_2BUTTON_PRESS && COMP_EDITOR_PAGE (page)->flags & COMP_EDITOR_PAGE_USER_ORG) {
+ if (event->type == GDK_2BUTTON_PRESS && flags & COMP_EDITOR_USER_ORG) {
EMeetingAttendee *attendee;
attendee = e_meeting_store_add_attendee_with_defaults (priv->model);
- if (COMP_EDITOR_PAGE (page)->flags & COMP_EDITOR_PAGE_DELEGATE) {
+ if (flags & COMP_EDITOR_DELEGATE) {
e_meeting_attendee_set_delfrom (attendee, g_strdup_printf ("MAILTO:%s", page->priv->user_add));
}
@@ -1428,28 +1368,6 @@ task_page_set_info_string (TaskPage *tpage, const gchar *icon, const gchar *msg)
gtk_widget_hide (priv->info_hbox);
}
-/* set_summary handler for the task page */
-static void
-task_page_set_summary (CompEditorPage *page, const char *summary)
-{
- /* nothing */
-}
-
-static void
-task_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates)
-{
- TaskPage *tpage;
- TaskPagePrivate *priv;
-
- tpage = TASK_PAGE (page);
- priv = tpage->priv;
-
- if (priv->updating)
- return;
-}
-
-
-
/* Gets the widgets from the XML file and returns if they are all available. */
static gboolean
get_widgets (TaskPage *tpage)
@@ -1539,23 +1457,19 @@ get_widgets (TaskPage *tpage)
);
}
-/* Callback used when the summary changes; we emit the notification signal. */
static void
-summary_changed_cb (GtkEditable *editable, gpointer data)
+summary_changed_cb (GtkEditable *editable,
+ CompEditorPage *page)
{
- TaskPage *tpage;
- TaskPagePrivate *priv;
+ CompEditor *editor;
gchar *summary;
- tpage = TASK_PAGE (data);
- priv = tpage->priv;
-
- if (priv->updating)
+ if (comp_editor_page_get_updating (page))
return;
+ editor = comp_editor_page_get_editor (page);
summary = e_dialog_editable_get (GTK_WIDGET (editable));
- comp_editor_page_notify_summary_changed (COMP_EDITOR_PAGE (tpage),
- summary);
+ comp_editor_set_summary (editor, summary);
g_free (summary);
}
@@ -1576,7 +1490,7 @@ date_changed_cb (EDateEdit *dedit, gpointer data)
tpage = TASK_PAGE (data);
priv = tpage->priv;
- if (priv->updating)
+ if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (tpage)))
return;
date_set = e_date_edit_get_date (E_DATE_EDIT (priv->start_date),
@@ -1660,41 +1574,6 @@ categories_clicked_cb (GtkWidget *button, gpointer data)
entry = priv->categories;
e_categories_config_open_dialog_for_entry (GTK_ENTRY (entry));
}
-/* sets the current focused widget */
-static gboolean
-widget_focus_in_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data)
-{
- TaskPage *tpage;
- tpage = TASK_PAGE (data);
-
- comp_editor_page_set_focused_widget (COMP_EDITOR_PAGE(tpage), widget);
-
- return FALSE;
-}
-/* unsets the current focused widget */
-static gboolean
-widget_focus_out_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data)
-{
- TaskPage *tpage;
- tpage = TASK_PAGE (data);
-
- comp_editor_page_unset_focused_widget (COMP_EDITOR_PAGE(tpage), widget);
-
- return FALSE;
-}
-/* This is called when any field is changed; it notifies upstream. */
-static void
-field_changed_cb (GtkWidget *widget, gpointer data)
-{
- TaskPage *tpage;
- TaskPagePrivate *priv;
-
- tpage = TASK_PAGE (data);
- priv = tpage->priv;
-
- if (!priv->updating)
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (tpage));
-}
static gboolean
check_start_before_end (struct icaltimetype *start_tt,
@@ -1758,7 +1637,7 @@ times_updated (TaskPage *tpage, gboolean adjust_end_time)
priv = tpage->priv;
- if (priv->updating)
+ if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (tpage)))
return;
date_set = e_date_edit_get_date (E_DATE_EDIT (priv->start_date),
@@ -1821,99 +1700,90 @@ times_updated (TaskPage *tpage, gboolean adjust_end_time)
}
static void
-start_date_changed_cb (GtkWidget *widget, gpointer data)
+start_date_changed_cb (TaskPage *tpage)
{
- TaskPage *tpage;
-
- tpage = TASK_PAGE (data);
-
- if (!tpage->priv->updating) {
- field_changed_cb (widget, data);
- times_updated (tpage, TRUE);
- }
+ times_updated (tpage, TRUE);
}
static void
-due_date_changed_cb (GtkWidget *widget, gpointer data)
+due_date_changed_cb (TaskPage *tpage)
{
- TaskPage *tpage;
-
- tpage = TASK_PAGE (data);
-
- if (!tpage->priv->updating) {
- field_changed_cb (widget, data);
- times_updated (tpage, FALSE);
- }
+ times_updated (tpage, FALSE);
}
static void
source_changed_cb (ESourceComboBox *source_combo_box, TaskPage *tpage)
{
TaskPagePrivate *priv = tpage->priv;
+ CompEditor *editor;
ESource *source;
+ ECal *client;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage));
source = e_source_combo_box_get_active (source_combo_box);
- if (!priv->updating) {
- ECal *client;
+ if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (tpage)))
+ return;
- client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_TODO);
- if (client) {
- icaltimezone *zone;
+ client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_TODO);
+ if (client) {
+ icaltimezone *zone;
- zone = calendar_config_get_icaltimezone ();
- e_cal_set_default_timezone (client, zone, NULL);
- }
+ zone = calendar_config_get_icaltimezone ();
+ e_cal_set_default_timezone (client, zone, NULL);
+ }
- if (!client || !e_cal_open (client, FALSE, NULL)) {
- GtkWidget *dialog;
+ if (!client || !e_cal_open (client, FALSE, NULL)) {
+ GtkWidget *dialog;
- if (client)
- g_object_unref (client);
+ if (client)
+ g_object_unref (client);
- e_source_combo_box_set_active (
- E_SOURCE_COMBO_BOX (priv->source_selector),
- e_cal_get_source (COMP_EDITOR_PAGE (tpage)->client));
+ client = comp_editor_get_client (editor);
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
- GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
- _("Unable to open tasks in '%s'."),
- e_source_peek_name (source));
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
- } else {
- comp_editor_notify_client_changed (
- COMP_EDITOR (gtk_widget_get_toplevel (priv->main)),
- client);
- field_changed_cb (GTK_WIDGET (source_combo_box), tpage);
- if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS) && priv->is_assignment)
- task_page_show_options (tpage);
- else
- task_page_hide_options (tpage);
+ e_source_combo_box_set_active (
+ E_SOURCE_COMBO_BOX (priv->source_selector),
+ e_cal_get_source (client));
- if (client) {
- gchar *backend_addr = NULL;
+ dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
+ GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
+ _("Unable to open tasks in '%s'."),
+ e_source_peek_name (source));
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ } else {
+ comp_editor_set_client (editor, client);
+ comp_editor_page_changed (COMP_EDITOR_PAGE (tpage));
+ if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS) && priv->is_assignment)
+ task_page_show_options (tpage);
+ else
+ task_page_hide_options (tpage);
- e_cal_get_cal_address(client, &backend_addr, NULL);
+ if (client) {
+ gchar *backend_addr = NULL;
- if (priv->is_assignment)
- task_page_select_organizer (tpage, backend_addr);
+ e_cal_get_cal_address(client, &backend_addr, NULL);
- set_subscriber_info_string (tpage, backend_addr);
- g_free (backend_addr);
- }
+ if (priv->is_assignment)
+ task_page_select_organizer (tpage, backend_addr);
- sensitize_widgets (tpage);
+ set_subscriber_info_string (tpage, backend_addr);
+ g_free (backend_addr);
}
+
+ sensitize_widgets (tpage);
}
}
static void
set_subscriber_info_string (TaskPage *tpage, const char *backend_address)
{
- ECal *client = COMP_EDITOR_PAGE (tpage)->client;
+ CompEditor *editor;
+ ECal *client;
ESource *source;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage));
+ client = comp_editor_get_client (editor);
source = e_cal_get_source (client);
if (e_source_get_property (source, "subscriber"))
@@ -1928,11 +1798,14 @@ set_subscriber_info_string (TaskPage *tpage, const char *backend_address)
void
task_page_sendoptions_clicked_cb (TaskPage *tpage)
{
- TaskPagePrivate *priv;
+ TaskPagePrivate *priv = tpage->priv;
+ CompEditor *editor;
GtkWidget *toplevel;
ESource *source;
+ ECal *client;
- priv = tpage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage));
+ client = comp_editor_get_client (editor);
if (!priv->sod) {
priv->sod = e_sendoptions_dialog_new ();
@@ -1942,8 +1815,7 @@ task_page_sendoptions_clicked_cb (TaskPage *tpage)
e_sendoptions_utils_set_default_data (priv->sod, source, "task");
}
- if (e_cal_get_static_capability (COMP_EDITOR_PAGE (tpage)->client,
- CAL_STATIC_CAPABILITY_NO_GEN_OPTIONS)) {
+ if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_GEN_OPTIONS)) {
e_sendoptions_set_need_general_options (priv->sod, FALSE);
}
@@ -2001,35 +1873,41 @@ init_widgets (TaskPage *tpage)
/* Connect the default signal handler to use to make sure the "changed"
field gets set whenever a field is changed. */
- /* Set the current focus entry */
- g_signal_connect (priv->summary, "focus-in-event",
- G_CALLBACK (widget_focus_in_cb), tpage);
- g_signal_connect (priv->summary, "focus-out-event",
- G_CALLBACK (widget_focus_out_cb), tpage);
-
- g_signal_connect (priv->description, "focus-in-event",
- G_CALLBACK (widget_focus_in_cb), tpage);
- g_signal_connect (priv->description, "focus-out-event",
- G_CALLBACK (widget_focus_out_cb), tpage);
-
-
/* Belongs to priv->description */
- g_signal_connect ((text_buffer), "changed",
- G_CALLBACK (field_changed_cb), tpage);
-
- g_signal_connect((priv->summary), "changed",
- G_CALLBACK (field_changed_cb), tpage);
- g_signal_connect (priv->start_date, "changed",
- G_CALLBACK (start_date_changed_cb), tpage);
- g_signal_connect (priv->due_date, "changed",
- G_CALLBACK (due_date_changed_cb), tpage);
- g_signal_connect((priv->timezone), "changed",
- G_CALLBACK (field_changed_cb), tpage);
- g_signal_connect((priv->categories), "changed",
- G_CALLBACK (field_changed_cb), tpage);
- g_signal_connect (G_OBJECT (priv->list_view), "button_press_event", G_CALLBACK (button_press_event), tpage);
- g_signal_connect (G_OBJECT (priv->list_view), "event", G_CALLBACK (list_view_event), tpage);
- g_signal_connect (priv->list_view, "key_press_event", G_CALLBACK (list_key_press), tpage);
+ g_signal_connect_swapped (
+ text_buffer, "changed",
+ G_CALLBACK (comp_editor_page_changed), tpage);
+ g_signal_connect_swapped (
+ priv->summary, "changed",
+ G_CALLBACK (comp_editor_page_changed), tpage);
+ g_signal_connect_swapped (
+ priv->start_date, "changed",
+ G_CALLBACK (start_date_changed_cb), tpage);
+ g_signal_connect_swapped (
+ priv->start_date, "changed",
+ G_CALLBACK (comp_editor_page_changed), tpage);
+ g_signal_connect_swapped (
+ priv->due_date, "changed",
+ G_CALLBACK (due_date_changed_cb), tpage);
+ g_signal_connect_swapped (
+ priv->due_date, "changed",
+ G_CALLBACK (comp_editor_page_changed), tpage);
+ g_signal_connect_swapped (
+ priv->timezone, "changed",
+ G_CALLBACK (comp_editor_page_changed), tpage);
+ g_signal_connect_swapped (
+ priv->categories, "changed",
+ G_CALLBACK (comp_editor_page_changed), tpage);
+
+ g_signal_connect (
+ priv->list_view, "button_press_event",
+ G_CALLBACK (button_press_event), tpage);
+ g_signal_connect (
+ priv->list_view, "event",
+ G_CALLBACK (list_view_event), tpage);
+ g_signal_connect (
+ priv->list_view, "key_press_event",
+ G_CALLBACK (list_key_press), tpage);
/* Add attendee button */
g_signal_connect (priv->add, "clicked", G_CALLBACK (add_clicked_cb), tpage);
@@ -2068,22 +1946,26 @@ init_widgets (TaskPage *tpage)
static void
task_page_select_organizer (TaskPage *tpage, const char *backend_address)
{
- TaskPagePrivate *priv;
+ TaskPagePrivate *priv = tpage->priv;
+ CompEditor *editor;
GList *l;
EAccount *def_account;
gchar *def_address = NULL;
const char *default_address;
gboolean subscribed_cal = FALSE;
ESource *source = NULL;
+ ECal *client;
const char *user_addr = NULL;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage));
+ client = comp_editor_get_client (editor);
+
def_account = itip_addresses_get_default();
if (def_account && def_account->enabled)
def_address = g_strdup_printf("%s <%s>", def_account->id->name, def_account->id->address);
- priv = tpage->priv;
- if (COMP_EDITOR_PAGE (tpage)->client)
- source = e_cal_get_source (COMP_EDITOR_PAGE (tpage)->client);
+ if (client)
+ source = e_cal_get_source (client);
if (source)
user_addr = e_source_get_property (source, "subscriber");
@@ -2197,18 +2079,18 @@ task_page_construct (TaskPage *tpage, EMeetingStore *model, ECal *client)
* not be created.
**/
TaskPage *
-task_page_new (EMeetingStore *model, ECal *client, BonoboUIComponent *uic)
+task_page_new (EMeetingStore *model, CompEditor *editor)
{
TaskPage *tpage;
+ ECal *client;
- tpage = g_object_new (TYPE_TASK_PAGE, NULL);
+ tpage = g_object_new (TYPE_TASK_PAGE, "editor", editor, NULL);
+ client = comp_editor_get_client (editor);
if (!task_page_construct (tpage, model, client)) {
g_object_unref (tpage);
- return NULL;
+ g_return_val_if_reached (NULL);
}
- tpage->priv->uic = uic;
-
return tpage;
}
diff --git a/calendar/gui/dialogs/task-page.h b/calendar/gui/dialogs/task-page.h
index 85e80069a6..243506929e 100644
--- a/calendar/gui/dialogs/task-page.h
+++ b/calendar/gui/dialogs/task-page.h
@@ -24,55 +24,75 @@
#ifndef TASK_PAGE_H
#define TASK_PAGE_H
-#include <bonobo/bonobo-window.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-widget.h>
- #include "comp-editor-page.h"
+#include "comp-editor.h"
+#include "comp-editor-page.h"
#include "../e-meeting-attendee.h"
#include "../e-meeting-store.h"
#include "../e-meeting-list-view.h"
-G_BEGIN_DECLS
-
-
+/* Standard GObject macros */
+#define TYPE_TASK_PAGE \
+ (task_page_get_type ())
+#define TASK_PAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), TYPE_TASK_PAGE, TaskPage))
+#define TASK_PAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), TYPE_TASK_PAGE, TaskPageClass))
+#define IS_TASK_PAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), TYPE_TASK_PAGE))
+#define IS_TASK_PAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((obj), TYPE_TASK_PAGE))
+#define TASK_PAGE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), TYPE_TASK_PAGE, TaskPageClass))
-#define TYPE_TASK_PAGE (task_page_get_type ())
-#define TASK_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TASK_PAGE, TaskPage))
-#define TASK_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TASK_PAGE, TaskPageClass))
-#define IS_TASK_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TASK_PAGE))
-#define IS_TASK_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), TYPE_TASK_PAGE))
+G_BEGIN_DECLS
+typedef struct _TaskPage TaskPage;
+typedef struct _TaskPageClass TaskPageClass;
typedef struct _TaskPagePrivate TaskPagePrivate;
-typedef struct {
+struct _TaskPage {
CompEditorPage page;
-
- /* Private data */
TaskPagePrivate *priv;
-} TaskPage;
+};
-typedef struct {
+struct _TaskPageClass {
CompEditorPageClass parent_class;
-} TaskPageClass;
+};
-GType task_page_get_type (void);
-TaskPage *task_page_construct (TaskPage *epage, EMeetingStore *model, ECal *client);
-TaskPage *task_page_new (EMeetingStore *model, ECal *client, BonoboUIComponent *uic);
-ECalComponent * task_page_get_cancel_comp (TaskPage *page);
-void task_page_show_options (TaskPage *page);
-void task_page_hide_options (TaskPage *page);
-void task_page_set_assignment (TaskPage *page, gboolean set);
-void task_page_sendoptions_clicked_cb (TaskPage *tpage);
-void task_page_set_view_role (TaskPage *page, gboolean state);
-void task_page_set_view_status (TaskPage *page, gboolean state);
-void task_page_set_view_type (TaskPage *page, gboolean state);
-void task_page_set_view_rsvp (TaskPage *page, gboolean state);
-void task_page_set_classification (TaskPage *page, ECalComponentClassification class);
-void task_page_set_show_timezone (TaskPage *page, gboolean state);
-void task_page_set_show_categories (TaskPage *page, gboolean state);
-void task_page_set_info_string (TaskPage *tpage, const gchar *icon, const gchar *msg);
-void task_page_add_attendee (TaskPage *tpage, EMeetingAttendee *attendee);
-
+GType task_page_get_type (void);
+TaskPage * task_page_construct (TaskPage *epage,
+ EMeetingStore *model,
+ ECal *client);
+TaskPage * task_page_new (EMeetingStore *model,
+ CompEditor *editor);
+ECalComponent * task_page_get_cancel_comp (TaskPage *page);
+void task_page_show_options (TaskPage *page);
+void task_page_hide_options (TaskPage *page);
+void task_page_set_assignment (TaskPage *page,
+ gboolean set);
+void task_page_sendoptions_clicked_cb(TaskPage *tpage);
+void task_page_set_view_role (TaskPage *page,
+ gboolean state);
+void task_page_set_view_status (TaskPage *page,
+ gboolean state);
+void task_page_set_view_type (TaskPage *page,
+ gboolean state);
+void task_page_set_view_rsvp (TaskPage *page,
+ gboolean state);
+void task_page_set_show_timezone (TaskPage *page,
+ gboolean state);
+void task_page_set_show_categories (TaskPage *page,
+ gboolean state);
+void task_page_set_info_string (TaskPage *tpage,
+ const gchar *icon,
+ const gchar *msg);
+void task_page_add_attendee (TaskPage *tpage,
+ EMeetingAttendee *attendee);
G_END_DECLS