From 0597b877c5bf4d21ac4048742ddf6b11e24877ba Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 18 Jul 2008 16:23:26 +0000 Subject: ** Fixes bug #542125 2008-07-18 Matthew Barnes ** 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 --- calendar/gui/dialogs/alarm-dialog.c | 3 - calendar/gui/dialogs/comp-editor-page.c | 487 +++--- calendar/gui/dialogs/comp-editor-page.h | 123 +- calendar/gui/dialogs/comp-editor-util.c | 3 - calendar/gui/dialogs/comp-editor.c | 2589 ++++++++++++++++-------------- calendar/gui/dialogs/comp-editor.h | 174 +- calendar/gui/dialogs/event-editor.c | 945 +++++------ calendar/gui/dialogs/event-editor.h | 38 +- calendar/gui/dialogs/event-page.c | 810 ++++------ calendar/gui/dialogs/event-page.h | 106 +- calendar/gui/dialogs/memo-editor.c | 276 +--- calendar/gui/dialogs/memo-editor.h | 36 +- calendar/gui/dialogs/memo-page.c | 733 ++++----- calendar/gui/dialogs/memo-page.h | 58 +- calendar/gui/dialogs/recurrence-page.c | 613 +++---- calendar/gui/dialogs/recurrence-page.h | 51 +- calendar/gui/dialogs/schedule-page.c | 166 +- calendar/gui/dialogs/schedule-page.h | 60 +- calendar/gui/dialogs/task-details-page.c | 197 +-- calendar/gui/dialogs/task-details-page.h | 51 +- calendar/gui/dialogs/task-editor.c | 686 +++----- calendar/gui/dialogs/task-editor.h | 40 +- calendar/gui/dialogs/task-page.c | 692 ++++---- calendar/gui/dialogs/task-page.h | 92 +- 24 files changed, 4147 insertions(+), 4882 deletions(-) (limited to 'calendar/gui/dialogs') 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 #include #include -#include -#include -#include #include #include #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 -#include -#include +#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,89 +364,19 @@ 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 @@ -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, @@ -468,26 +415,6 @@ comp_editor_page_notify_dates_changed (CompEditorPage *page, dates); } -/** - * 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. 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 #include +/* 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 #include #include -#include -#include -#include #include #include #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 #include #include -#include -#include #include -#include -#include -#include -#include #include -#include #include +#include #include #include @@ -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 = +"" +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +""; -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;iset_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,113 +917,999 @@ save_comp_with_send (CompEditor *editor) return TRUE; } -static gboolean -prompt_and_save_changes (CompEditor *editor, gboolean send) -{ - CompEditorPrivate *priv; - gboolean read_only, correct = FALSE; - ECalComponent *comp; - ECalComponentText text; +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; - priv = editor->priv; + case E_CAL_COMPONENT_TODO: + if (editor->priv->is_group_item) + format = _("Assigned Task - %s"); + else + format = _("Task - %s"); + icon_name = "stock_task"; + break; - if (!priv->changed) - return TRUE; + case E_CAL_COMPONENT_JOURNAL: + format = _("Memo - %s"); + icon_name = "stock_insert-note"; + break; - switch (save_component_dialog (GTK_WINDOW(editor), priv->comp)) { - case GTK_RESPONSE_YES: /* Save */ - 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); - /* don't discard changes when selected readonly calendar */ - return FALSE; - } + default: + g_return_if_reached (); + } - comp = comp_editor_get_current_comp (editor, &correct); - e_cal_component_get_summary (comp, &text); - g_object_unref (comp); + if (description == NULL || *description == '\0') { + ECalComponentText text; - if (!correct) - return FALSE; + e_cal_component_get_summary (editor->priv->comp, &text); + description = text.value; + } - if (!text.value) - if (!send_component_prompt_subject ((GtkWindow *) editor, priv->client, priv->comp)) - return FALSE; + if (description == NULL || *description == '\0') + description = _("No Summary"); - if (e_cal_component_is_instance (priv->comp)) - if (!recur_component_dialog (priv->client, priv->comp, &priv->mod, GTK_WINDOW (editor), FALSE)) - return FALSE; + title = g_strdup_printf (format, description); - if (send && save_comp_with_send (editor)) - return TRUE; - else if (!send && save_comp (editor)) - return TRUE; - else - return FALSE; - case GTK_RESPONSE_NO: /* Discard */ - return TRUE; - case GTK_RESPONSE_CANCEL: /* Cancel */ - default: - return FALSE; - } +exit: + gtk_window_set_icon_name (GTK_WINDOW (editor), icon_name); + gtk_window_set_title (GTK_WINDOW (editor), title); + + g_free (title); } -static int -delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) +static void +action_attach_cb (GtkAction *action, + CompEditor *editor) { - CompEditor *editor = COMP_EDITOR (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 +action_close_cb (GtkAction *action, + CompEditor *editor) +{ commit_all_fields (editor); if (prompt_and_save_changes (editor, TRUE)) close_dialog (editor); - - return TRUE; } static void -attachment_bar_changed_cb (EAttachmentBar *bar, - void *data) +action_copy_cb (GtkAction *action, + CompEditor *editor) { - CompEditor *editor = COMP_EDITOR (data); + GtkWidget *focus; - guint attachment_num = e_attachment_bar_get_num_attachments ( - E_ATTACHMENT_BAR (editor->priv->attachment_bar)); - if (attachment_num) { - gchar *num_text = g_strdup_printf ( - ngettext ("%d Attachment", "%d Attachments", attachment_num), - attachment_num); - gtk_label_set_markup (GTK_LABEL (editor->priv->attachment_expander_num), - num_text); - g_free (num_text); + focus = gtk_window_get_focus (GTK_WINDOW (editor)); - gtk_widget_show (editor->priv->attachment_expander_icon); - e_expander_set_expanded(E_EXPANDER(editor->priv->attachment_expander),TRUE); + if (GTK_IS_ENTRY (focus)) + gtk_editable_copy_clipboard (GTK_EDITABLE (focus)); - } else { - gtk_label_set_text (GTK_LABEL (editor->priv->attachment_expander_num), ""); - gtk_widget_hide (editor->priv->attachment_expander_icon); - e_expander_set_expanded(E_EXPANDER(editor->priv->attachment_expander),FALSE); - } + 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)); - /* Mark the editor as changed so it prompts about unsaved - changes on close */ - comp_editor_set_changed (editor, TRUE); + 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 -attachment_expander_activate_cb (EExpander *expander, - void *data) +action_help_cb (GtkAction *action, + CompEditor *editor) { - CompEditor *editor = COMP_EDITOR (data); - gboolean show = e_expander_get_expanded (expander); + comp_editor_show_help (editor); +} - /* Update the expander label */ - if (show) - gtk_label_set_text_with_mnemonic (GTK_LABEL (editor->priv->attachment_expander_label), - _("Hide Attachment _Bar")); - else +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..."), + "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) +{ + CompEditorPrivate *priv; + gboolean read_only, correct = FALSE; + ECalComponent *comp; + ECalComponentText text; + + priv = editor->priv; + + if (!priv->changed) + return TRUE; + + switch (save_component_dialog (GTK_WINDOW(editor), priv->comp)) { + case GTK_RESPONSE_YES: /* Save */ + 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); + /* don't discard changes when selected readonly calendar */ + return FALSE; + } + + comp = comp_editor_get_current_comp (editor, &correct); + e_cal_component_get_summary (comp, &text); + g_object_unref (comp); + + if (!correct) + return FALSE; + + if (!text.value) + if (!send_component_prompt_subject ((GtkWindow *) editor, priv->client, priv->comp)) + return FALSE; + + if (e_cal_component_is_instance (priv->comp)) + if (!recur_component_dialog (priv->client, priv->comp, &priv->mod, GTK_WINDOW (editor), FALSE)) + return FALSE; + + if (send && save_comp_with_send (editor)) + return TRUE; + else if (!send && save_comp (editor)) + return TRUE; + else + return FALSE; + case GTK_RESPONSE_NO: /* Discard */ + return TRUE; + case GTK_RESPONSE_CANCEL: /* Cancel */ + default: + return FALSE; + } +} + +static int +delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) +{ + CompEditor *editor = COMP_EDITOR (data); + + commit_all_fields (editor); + + if (prompt_and_save_changes (editor, TRUE)) + close_dialog (editor); + + return TRUE; +} + +static void +attachment_bar_changed_cb (EAttachmentBar *bar, + void *data) +{ + CompEditor *editor = COMP_EDITOR (data); + + guint attachment_num = e_attachment_bar_get_num_attachments ( + E_ATTACHMENT_BAR (editor->priv->attachment_bar)); + if (attachment_num) { + gchar *num_text = g_strdup_printf ( + ngettext ("%d Attachment", "%d Attachments", attachment_num), + attachment_num); + gtk_label_set_markup (GTK_LABEL (editor->priv->attachment_expander_num), + num_text); + g_free (num_text); + + gtk_widget_show (editor->priv->attachment_expander_icon); + e_expander_set_expanded(E_EXPANDER(editor->priv->attachment_expander),TRUE); + + } else { + gtk_label_set_text (GTK_LABEL (editor->priv->attachment_expander_num), ""); + gtk_widget_hide (editor->priv->attachment_expander_icon); + e_expander_set_expanded(E_EXPANDER(editor->priv->attachment_expander),FALSE); + } + + + /* Mark the editor as changed so it prompts about unsaved + changes on close */ + comp_editor_set_changed (editor, TRUE); + +} + +static void +attachment_expander_activate_cb (EExpander *expander, + void *data) +{ + CompEditor *editor = COMP_EDITOR (data); + gboolean show = e_expander_get_expanded (expander); + + /* Update the expander label */ + if (show) + gtk_label_set_text_with_mnemonic (GTK_LABEL (editor->priv->attachment_expander_label), + _("Hide Attachment _Bar")); + else gtk_label_set_text_with_mnemonic (GTK_LABEL (editor->priv->attachment_expander_label), _("Show Attachment _Bar")); } @@ -1178,388 +2086,115 @@ cab_popup(EAttachmentBar *bar, GdkEventButton *event, int id) * @Class: org.gnome.evolution.mail.popup:1.0 * @Target: ECalPopupTargetAttachments * - * This is the context menu on the calendar attachment bar. - */ - ecp = e_cal_popup_new("org.gnome.evolution.calendar.attachmentbar.popup"); - e_popup_add_items((EPopup *)ecp, menus, NULL, cab_popups_free, bar); - t = e_cal_popup_target_new_attachments(ecp, editor, attachments); - t->target.widget = (GtkWidget *)bar; - menu = e_popup_create_menu_once((EPopup *)ecp, (EPopupTarget *)t, 0); - - if (event == NULL) - gtk_menu_popup(menu, NULL, NULL, cab_popup_position, bar, 0, gtk_get_current_event_time()); - else - gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event->button, event->time); -} - -/* GtkWidget methods. */ - -static gboolean -popup_menu_event (GtkWidget *widget) -{ - cab_popup((EAttachmentBar *)widget, NULL, -1); - return TRUE; -} - - -static int -button_press_event (GtkWidget *widget, GdkEventButton *event) -{ - EAttachmentBar *bar = (EAttachmentBar *)widget; - GnomeIconList *icon_list = GNOME_ICON_LIST(widget); - int icon_number = -1; - - if (event->button != 3) - return FALSE; - - if (!gnome_icon_list_get_selection (icon_list)) { - icon_number = gnome_icon_list_get_icon_at (icon_list, event->x, event->y); - if (icon_number >= 0) { - gnome_icon_list_unselect_all(icon_list); - gnome_icon_list_select_icon (icon_list, icon_number); - } - } - - cab_popup(bar, event, icon_number); - - return TRUE; -} - -static gint -key_press_event(GtkWidget *widget, GdkEventKey *event) -{ - EAttachmentBar *bar = (EAttachmentBar *)widget; - if (event->keyval == GDK_Delete) { - e_attachment_bar_remove_selected (bar); - return TRUE; - } - - return FALSE; -} - -static gint -editor_key_press_event(GtkWidget *widget, GdkEventKey *event, CompEditor *editor) -{ - if (event->keyval == GDK_Escape) { - commit_all_fields (editor); - - if (prompt_and_save_changes (editor, TRUE)) - close_dialog (editor); - - return TRUE; - } - - 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; + * This is the context menu on the calendar attachment bar. + */ + ecp = e_cal_popup_new("org.gnome.evolution.calendar.attachmentbar.popup"); + e_popup_add_items((EPopup *)ecp, menus, NULL, cab_popups_free, bar); + t = e_cal_popup_target_new_attachments(ecp, editor, attachments); + t->target.widget = (GtkWidget *)bar; + menu = e_popup_create_menu_once((EPopup *)ecp, (EPopupTarget *)t, 0); - file_list = comp_editor_select_file_attachments (editor, &is_inline); + if (event == NULL) + gtk_menu_popup(menu, NULL, NULL, cab_popup_position, bar, 0, gtk_get_current_event_time()); + else + gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event->button, event->time); +} - if (file_list) { - add_to_bar (editor, file_list, is_inline); +/* GtkWidget methods. */ - for (i = 0; i < file_list->len; i++) - g_free (file_list->pdata[i]); +static gboolean +popup_menu_event (EAttachmentBar *bar) +{ + cab_popup (bar, NULL, -1); - g_ptr_array_free (file_list, TRUE); - } + return TRUE; } -static void -menu_insert_attach_recent_docs_cb (BonoboUIComponent *uic, - gpointer user_data, - const char *cname) + +static int +button_press_event (EAttachmentBar *bar, + GdkEventButton *event) { - CompEditor *editor = (CompEditor *) user_data; - gchar *command = NULL, *uri = NULL; - GPtrArray *file_list = g_ptr_array_new (); - int i; + GnomeIconList *icon_list = GNOME_ICON_LIST (bar); + int icon_number = -1; - command = g_strdup_printf ("/commands/%s", cname); - uri = bonobo_ui_component_get_prop (editor->uic, command, "uri", NULL); - g_free (command); + if (event->button != 3) + return FALSE; - if (uri && *uri) { - g_ptr_array_add (file_list, uri); - add_to_bar (editor, file_list, FALSE); + if (!gnome_icon_list_get_selection (icon_list)) { + icon_number = gnome_icon_list_get_icon_at (icon_list, event->x, event->y); + if (icon_number >= 0) { + gnome_icon_list_unselect_all(icon_list); + gnome_icon_list_select_icon (icon_list, icon_number); + } } - for (i = 0; i < file_list->len; i++) - g_free (file_list->pdata[i]); - g_ptr_array_free (file_list, TRUE); + cab_popup(bar, event, icon_number); + + return TRUE; } -static void -menu_help_cb (BonoboUIComponent *uic, - void *data, - const char *path) +static gint +key_press_event (EAttachmentBar *bar, + GdkEventKey *event) { - CompEditor *editor = (CompEditor *) data; + if (event->keyval == GDK_Delete) { + e_attachment_bar_remove_selected (bar); + return TRUE; + } - comp_editor_show_help (editor); + return FALSE; } -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), +static gint +editor_key_press_event (CompEditor *editor, + GdkEventKey *event) +{ + if (event->keyval == GDK_Escape) { + commit_all_fields (editor); - BONOBO_UI_VERB_END -}; + if (prompt_and_save_changes (editor, TRUE)) + close_dialog (editor); -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), + return TRUE; + } - 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), + return FALSE; +} - 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); + + g_object_notify (G_OBJECT (editor), "summary"); +} - return priv->is_group_item; +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; + + action = comp_editor_get_action (editor, "save"); + g_return_if_fail (action != NULL); + gtk_action_set_sensitive (action, changed); - priv->changed = changed; + show_warning = + changed && !editor->priv->warned && + editor->priv->existing_org && !editor->priv->user_org; - bonobo_ui_component_set_prop (editor->uic, "/commands/FileSave", "sensitive", changed ? "1" : "0" - , NULL); + 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; + g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); + + return editor->priv->changed; +} + +void +comp_editor_set_flags (CompEditor *editor, + CompEditorFlags flags) +{ + g_return_if_fail (IS_COMP_EDITOR (editor)); + + editor->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); + + return editor->priv->flags; +} - priv = editor->priv; +GtkUIManager * +comp_editor_get_ui_manager (CompEditor *editor) +{ + g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); - return priv->changed; + return editor->priv->manager; } -void -comp_editor_set_flags (CompEditor *editor, CompEditorFlags flags) +GtkAction * +comp_editor_get_action (CompEditor *editor, + const gchar *action_name) { + GtkAction *action = NULL; + GList *iter; - CompEditorPrivate *priv; + g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); + g_return_val_if_fail (action_name != NULL, NULL); - g_return_if_fail (editor != NULL); - g_return_if_fail (IS_COMP_EDITOR (editor)); + iter = gtk_ui_manager_get_action_groups (editor->priv->manager); + while (iter != NULL && action == NULL) { + GtkActionGroup *action_group = iter->data; - priv = editor->priv; + action = gtk_action_group_get_action ( + action_group, action_name); + iter = g_list_next (iter); + } + g_return_val_if_fail (action != NULL, NULL); - priv->flags = flags; + return action; } - -CompEditorFlags -comp_editor_get_flags (CompEditor *editor) +GtkActionGroup * +comp_editor_get_action_group (CompEditor *editor, + const gchar *group_name) { + GList *iter; - CompEditorPrivate *priv; + g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); + g_return_val_if_fail (group_name != NULL, NULL); - g_return_val_if_fail (editor != NULL, FALSE); - g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); + iter = gtk_ui_manager_get_action_groups (editor->priv->manager); + while (iter != NULL) { + GtkActionGroup *action_group = iter->data; + const gchar *name; - priv = editor->priv; + 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); - return priv->flags; + 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); - klass = COMP_EDITOR_CLASS (G_OBJECT_GET_CLASS (editor)); + if (editor->priv->client != NULL) + g_object_unref (editor->priv->client); - if (klass->set_e_cal) - klass->set_e_cal (editor, client); + editor->priv->client = 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 @@ -2478,46 +2908,12 @@ fill_widgets (CompEditor *editor) comp_editor_page_fill_widgets (l->data, priv->comp); } -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 -#include -#include -#include #include #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 #include #include + #include #include +#include #include #include + #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 = +"" +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +""; -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 #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 -#include -#include +#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 #include -#include +#include #include +#include + #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 = +"" +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +""; 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 #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 -#include -#include +#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 -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 #include +#include #include #include #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 = +"" +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +""; -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"), + "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 #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 -#include -#include - #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 -- cgit v1.2.3 From 9e103067db1fed4d749ac4cbca852aff8ed8f0d2 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 18 Jul 2008 16:37:06 +0000 Subject: Forgot to add event_page_dispose() to the vtable. svn path=/trunk/; revision=35755 --- calendar/gui/dialogs/event-page.c | 1 + 1 file changed, 1 insertion(+) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index bc75992c3e..749951de93 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -243,6 +243,7 @@ event_page_class_init (EventPageClass *class) g_type_class_add_private (class, sizeof (EventPagePrivate)); object_class = G_OBJECT_CLASS (class); + object_class->dispose = event_page_dispose; object_class->finalize = event_page_finalize; editor_page_class = COMP_EDITOR_PAGE_CLASS (class); -- cgit v1.2.3 From e3627ebef641dfb700b1bbc713c0855a771aa384 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 3 Aug 2008 03:12:49 +0000 Subject: ** Fixes bug #546057 2008-08-02 Matthew Barnes ** Fixes bug #546057 * gui/component/GNOME_Evolution_Addressbook.server.in.in: * gui/contact-list-editor/contact-list-editor.glade: Use "x-office-address-book" icon name instead of "stock_addressbook". * gui/GNOME_Evolution_Calendar.server.in.in: * gui/calendar-component.c: * gui/e-calendar-view.c: * gui/dialogs/alarm-dialog.c: * gui/dialogs/alarm-list-dialog.c: * gui/dialogs/changed-comp.c: * gui/dialogs/comp-editor.c: * gui/dialogs/delete-error.c: * gui/dialogs/select-source-dialog.c: Use "x-office-calendar" icon name instead of "stock_calendar". svn path=/trunk/; revision=35892 --- calendar/gui/dialogs/alarm-dialog.c | 2 +- calendar/gui/dialogs/alarm-list-dialog.c | 2 +- calendar/gui/dialogs/changed-comp.c | 2 +- calendar/gui/dialogs/comp-editor.c | 2 +- calendar/gui/dialogs/delete-error.c | 2 +- calendar/gui/dialogs/select-source-dialog.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c index 9a57a9c8e5..48402bbab3 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -1178,7 +1178,7 @@ alarm_dialog_run (GtkWidget *parent, ECal *ecal, ECalComponentAlarm *alarm) gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog.toplevel)->vbox), 0); gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog.toplevel)->action_area), 12); - icon_list = e_icon_factory_get_icon_list ("stock_calendar"); + icon_list = e_icon_factory_get_icon_list ("x-office-calendar"); if (icon_list) { gtk_window_set_icon_list (GTK_WINDOW (dialog.toplevel), icon_list); g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); diff --git a/calendar/gui/dialogs/alarm-list-dialog.c b/calendar/gui/dialogs/alarm-list-dialog.c index 99230f667e..8bce8f0eaa 100644 --- a/calendar/gui/dialogs/alarm-list-dialog.c +++ b/calendar/gui/dialogs/alarm-list-dialog.c @@ -293,7 +293,7 @@ alarm_list_dialog_run (GtkWidget *parent, ECal *ecal, EAlarmList *list_store) gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog.toplevel)->vbox), 0); gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog.toplevel)->action_area), 12); - icon_list = e_icon_factory_get_icon_list ("stock_calendar"); + icon_list = e_icon_factory_get_icon_list ("x-office-calendar"); if (icon_list) { gtk_window_set_icon_list (GTK_WINDOW (dialog.toplevel), icon_list); g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); diff --git a/calendar/gui/dialogs/changed-comp.c b/calendar/gui/dialogs/changed-comp.c index c2d5f4e365..c994fb6303 100644 --- a/calendar/gui/dialogs/changed-comp.c +++ b/calendar/gui/dialogs/changed-comp.c @@ -105,7 +105,7 @@ changed_component_dialog (GtkWindow *parent, ECalComponent *comp, gboolean delet GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s", str); - icon_list = e_icon_factory_get_icon_list ("stock_calendar"); + icon_list = e_icon_factory_get_icon_list ("x-office-calendar"); if (icon_list) { gtk_window_set_icon_list (GTK_WINDOW (dialog), icon_list); g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 840ffc9d9d..fa7054d942 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -927,7 +927,7 @@ update_window_border (CompEditor *editor, if (editor->priv->comp == NULL) { title = g_strdup (_("Edit Appointment")); - icon_name = "stock_calendar"; + icon_name = "x-office-calendar"; goto exit; } else switch (e_cal_component_get_vtype (editor->priv->comp)) { diff --git a/calendar/gui/dialogs/delete-error.c b/calendar/gui/dialogs/delete-error.c index 6c5462837d..d1280da16a 100644 --- a/calendar/gui/dialogs/delete-error.c +++ b/calendar/gui/dialogs/delete-error.c @@ -106,7 +106,7 @@ delete_error_dialog (GError *error, ECalComponentVType vtype) GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", str); if (vtype == E_CAL_COMPONENT_EVENT) - icon_list = e_icon_factory_get_icon_list ("stock_calendar"); + icon_list = e_icon_factory_get_icon_list ("x-office-calendar"); else if (vtype == E_CAL_COMPONENT_TODO) icon_list = e_icon_factory_get_icon_list ("stock_todo"); diff --git a/calendar/gui/dialogs/select-source-dialog.c b/calendar/gui/dialogs/select-source-dialog.c index 624cfe90fe..a669dfcafc 100644 --- a/calendar/gui/dialogs/select-source-dialog.c +++ b/calendar/gui/dialogs/select-source-dialog.c @@ -58,7 +58,7 @@ select_source_dialog (GtkWindow *parent, ECalSourceType obj_type) dialog = e_source_selector_dialog_new (parent, source_list); if (obj_type == E_CAL_SOURCE_TYPE_EVENT) - icon_list = e_icon_factory_get_icon_list ("stock_calendar"); + icon_list = e_icon_factory_get_icon_list ("x-office-calendar"); else if (obj_type == E_CAL_SOURCE_TYPE_TODO) icon_list = e_icon_factory_get_icon_list ("stock_todo"); else if (obj_type == E_CAL_SOURCE_TYPE_JOURNAL) -- cgit v1.2.3 From 434bc25ed6b3f458f3bf119e76bd8b2bcffe5178 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 11 Aug 2008 17:04:32 +0000 Subject: ** Fixes bug #546892 2008-08-11 Matthew Barnes ** Fixes bug #546892 * e-util/e-icon-factory.c (e_icon_factory_get_image): Kill this function. Use gtk_image_new_from_icon_name(). * e-util/e-icon-factory.c (e_icon_factory_get_icon_list): Kill this function. Use gtk_window_set_icon_name(). * widgets/misc/e-activity-handler.c: * widgets/misc/e-task-widget.c: Purge the GdkPixbuf arguments from the API. We've been ignoring them since the spinner icon was added. * addressbook/gui/contact-editor/e-contact-editor-fullname.c: * addressbook/gui/contact-editor/e-contact-editor-im.c: * addressbook/gui/contact-editor/e-contact-editor-address.c: * calendar/gui/alarm-notify/alarm-notify-dialog.c: * calendar/gui/dialogs/alarm-dialog.c: * calendar/gui/dialogs/alarm-list-dialog.c: * calendar/gui/dialogs/cal-attachment-select-file.c: * calendar/gui/dialogs/changed-comp.c: * calendar/gui/dialogs/delete-error.c: * calendar/gui/dialogs/select-source-dialog.c: * mail/mail-send-recv.c: * mail/message-tag-followup.c: * widgets/misc/e-combo-button.c: * widgets/misc/e-info-label.c: * widgets/misc/e-url-entry.c: * widgets/misc/e-task-widget.c: Prefer gtk_window_set_icon_name() over gtk_window_set_icon_list(). * addressbook/gui/contact-editor/e-contact-editor-im.c: * calendar/gui/dialogs/event-page.c: * calendar/gui/e-timezone-entry.c: * e-util/e-gui-utils.c: * e-util/e-popup.c: * plugins/import-ics-attachments/icsimporter.c: * plugins/itip-formatter/itip-view.c: * mail/em-folder-browser.c: * mail/em-format-html-display.c: * mail/mail-send-recv.c: * mail/message-tag-followup.c: Prefer gtk_image_new_from_icon_name() over e_icon_factory_get_image(). * calendar/gui/alarm-notify/alarm-queue.c: * plugins/mail-notification/mail-notification.c: Prefer gtk_status_icon_set_from_icon_name() over gtk_status_icon_set_from_pixbuf(). * addressbook/gui/component/addressbook-view.c: * calendar/gui/e-calendar-table.c: * calendar/gui/e-calendar-view.c: * calendar/gui/e-memo-table.c: * mail/mail-mt.c: e_activity_handler_operation_started() no longer takes a GdkPixbuf. It was ignoring the pixbuf anyway ever since we added a spinner icon. svn path=/trunk/; revision=35958 --- calendar/gui/dialogs/alarm-dialog.c | 10 ++-------- calendar/gui/dialogs/alarm-list-dialog.c | 10 ++-------- calendar/gui/dialogs/cal-attachment-select-file.c | 9 +-------- calendar/gui/dialogs/cancel-comp.c | 1 - calendar/gui/dialogs/changed-comp.c | 9 +-------- calendar/gui/dialogs/delete-comp.c | 1 - calendar/gui/dialogs/delete-error.c | 14 +++++--------- calendar/gui/dialogs/event-editor.c | 1 - calendar/gui/dialogs/event-page.c | 3 +-- calendar/gui/dialogs/select-source-dialog.c | 16 ++++++---------- calendar/gui/dialogs/task-editor.c | 1 - 11 files changed, 18 insertions(+), 57 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c index 48402bbab3..11642e3e47 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -37,7 +37,6 @@ #include #include #include "e-util/e-dialog-widgets.h" -#include "e-util/e-icon-factory.h" #include "e-util/e-util-private.h" #include #include @@ -1142,7 +1141,6 @@ alarm_dialog_run (GtkWidget *parent, ECal *ecal, ECalComponentAlarm *alarm) { Dialog dialog; int response_id; - GList *icon_list; char *gladefile; g_return_val_if_fail (alarm != NULL, FALSE); @@ -1178,12 +1176,8 @@ alarm_dialog_run (GtkWidget *parent, ECal *ecal, ECalComponentAlarm *alarm) gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog.toplevel)->vbox), 0); gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog.toplevel)->action_area), 12); - icon_list = e_icon_factory_get_icon_list ("x-office-calendar"); - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (dialog.toplevel), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } + gtk_window_set_icon_name ( + GTK_WINDOW (dialog.toplevel), "x-office-calendar"); gtk_window_set_transient_for (GTK_WINDOW (dialog.toplevel), GTK_WINDOW (parent)); diff --git a/calendar/gui/dialogs/alarm-list-dialog.c b/calendar/gui/dialogs/alarm-list-dialog.c index 8bce8f0eaa..8066061993 100644 --- a/calendar/gui/dialogs/alarm-list-dialog.c +++ b/calendar/gui/dialogs/alarm-list-dialog.c @@ -37,7 +37,6 @@ #include #include #include "e-util/e-dialog-widgets.h" -#include "e-util/e-icon-factory.h" #include "e-util/e-util-private.h" #include "alarm-dialog.h" #include "alarm-list-dialog.h" @@ -263,7 +262,6 @@ alarm_list_dialog_run (GtkWidget *parent, ECal *ecal, EAlarmList *list_store) { Dialog dialog; int response_id; - GList *icon_list; char *gladefile; dialog.ecal = ecal; @@ -293,12 +291,8 @@ alarm_list_dialog_run (GtkWidget *parent, ECal *ecal, EAlarmList *list_store) gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog.toplevel)->vbox), 0); gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog.toplevel)->action_area), 12); - icon_list = e_icon_factory_get_icon_list ("x-office-calendar"); - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (dialog.toplevel), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } + gtk_window_set_icon_name ( + GTK_WINDOW (dialog.toplevel), "x-office-calendar"); gtk_window_set_transient_for (GTK_WINDOW (dialog.toplevel), GTK_WINDOW (parent)); diff --git a/calendar/gui/dialogs/cal-attachment-select-file.c b/calendar/gui/dialogs/cal-attachment-select-file.c index 2f08acbf07..2d2acb359e 100644 --- a/calendar/gui/dialogs/cal-attachment-select-file.c +++ b/calendar/gui/dialogs/cal-attachment-select-file.c @@ -36,7 +36,6 @@ #include #include "cal-attachment-select-file.h" -#include enum { SELECTOR_MODE_MULTI = (1 << 0), @@ -49,7 +48,6 @@ run_selector(CompEditor *editor, const char *title, guint32 flags, gboolean *sho GtkWidget *selection; GtkWidget *showinline = NULL; char *path; - GList *icon_list; path = g_object_get_data ((GObject *) editor, "attach_path"); @@ -90,12 +88,7 @@ run_selector(CompEditor *editor, const char *title, guint32 flags, gboolean *sho gtk_window_set_wmclass ((GtkWindow *) selection, "fileselection", "Evolution:editor"); gtk_window_set_modal ((GtkWindow *) selection, TRUE); - icon_list = e_icon_factory_get_icon_list ("mail-message-new"); - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (selection), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } + gtk_window_set_icon_name (GTK_WINDOW (selection), "mail-message-new"); if (gtk_dialog_run ((GtkDialog *) selection) == GTK_RESPONSE_OK) { if (showinline_p) diff --git a/calendar/gui/dialogs/cancel-comp.c b/calendar/gui/dialogs/cancel-comp.c index c0cd28f6c0..4e81e79f44 100644 --- a/calendar/gui/dialogs/cancel-comp.c +++ b/calendar/gui/dialogs/cancel-comp.c @@ -25,7 +25,6 @@ #include #include #include -#include #include "e-util/e-error.h" #include "cancel-comp.h" diff --git a/calendar/gui/dialogs/changed-comp.c b/calendar/gui/dialogs/changed-comp.c index c994fb6303..5f62e54624 100644 --- a/calendar/gui/dialogs/changed-comp.c +++ b/calendar/gui/dialogs/changed-comp.c @@ -24,7 +24,6 @@ #include #include -#include #include "changed-comp.h" @@ -48,7 +47,6 @@ changed_component_dialog (GtkWindow *parent, ECalComponent *comp, gboolean delet ECalComponentVType vtype; char *str; gint response; - GList *icon_list; vtype = e_cal_component_get_vtype (comp); @@ -105,12 +103,7 @@ changed_component_dialog (GtkWindow *parent, ECalComponent *comp, gboolean delet GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s", str); - icon_list = e_icon_factory_get_icon_list ("x-office-calendar"); - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (dialog), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } + gtk_window_set_icon_name (GTK_WINDOW (dialog), "x-office-calendar"); response = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); diff --git a/calendar/gui/dialogs/delete-comp.c b/calendar/gui/dialogs/delete-comp.c index b87a01a58e..228e84f464 100644 --- a/calendar/gui/dialogs/delete-comp.c +++ b/calendar/gui/dialogs/delete-comp.c @@ -23,7 +23,6 @@ #endif #include -#include #include "e-util/e-error.h" #include "../calendar-config.h" #include "delete-comp.h" diff --git a/calendar/gui/dialogs/delete-error.c b/calendar/gui/dialogs/delete-error.c index d1280da16a..7c264d0638 100644 --- a/calendar/gui/dialogs/delete-error.c +++ b/calendar/gui/dialogs/delete-error.c @@ -25,7 +25,6 @@ #include #include #include -#include #include "delete-error.h" @@ -39,9 +38,9 @@ void delete_error_dialog (GError *error, ECalComponentVType vtype) { - GList *icon_list = NULL; GtkWidget *dialog; const char *str; + const gchar *icon_name = NULL; if (!error) return; @@ -106,15 +105,12 @@ delete_error_dialog (GError *error, ECalComponentVType vtype) GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", str); if (vtype == E_CAL_COMPONENT_EVENT) - icon_list = e_icon_factory_get_icon_list ("x-office-calendar"); + icon_name = "x-office-calendar"; else if (vtype == E_CAL_COMPONENT_TODO) - icon_list = e_icon_factory_get_icon_list ("stock_todo"); + icon_name = "stock_todo"; - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (dialog), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } + if (icon_name) + gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 1547a67f0e..ca1b581ee6 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -32,7 +32,6 @@ #include #include -#include #include #include #include diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 749951de93..3f30617be6 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -42,7 +42,6 @@ #include "../e-timezone-entry.h" #include #include -#include #include #include "../e-meeting-attendee.h" @@ -688,7 +687,7 @@ create_image_event_box (const char *image_text, const char *tip_text) GtkWidget *image, *box; box = gtk_event_box_new (); - image = e_icon_factory_get_image (image_text, E_ICON_SIZE_MENU); + image = gtk_image_new_from_icon_name (image_text, GTK_ICON_SIZE_MENU); gtk_container_add ((GtkContainer *) box, image); gtk_widget_show_all (box); diff --git a/calendar/gui/dialogs/select-source-dialog.c b/calendar/gui/dialogs/select-source-dialog.c index a669dfcafc..9cc6c57fe3 100644 --- a/calendar/gui/dialogs/select-source-dialog.c +++ b/calendar/gui/dialogs/select-source-dialog.c @@ -23,7 +23,6 @@ #endif #include -#include #include #include "select-source-dialog.h" @@ -40,7 +39,7 @@ select_source_dialog (GtkWindow *parent, ECalSourceType obj_type) ESource *selected_source = NULL; const char *gconf_key; GConfClient *conf_client; - GList *icon_list = NULL; + const gchar *icon_name = NULL; if (obj_type == E_CAL_SOURCE_TYPE_EVENT) gconf_key = "/apps/evolution/calendar/sources"; @@ -58,17 +57,14 @@ select_source_dialog (GtkWindow *parent, ECalSourceType obj_type) dialog = e_source_selector_dialog_new (parent, source_list); if (obj_type == E_CAL_SOURCE_TYPE_EVENT) - icon_list = e_icon_factory_get_icon_list ("x-office-calendar"); + icon_name = "x-office-calendar"; else if (obj_type == E_CAL_SOURCE_TYPE_TODO) - icon_list = e_icon_factory_get_icon_list ("stock_todo"); + icon_name = "stock_todo"; else if (obj_type == E_CAL_SOURCE_TYPE_JOURNAL) - icon_list = e_icon_factory_get_icon_list ("stock_journal"); + icon_name = "stock_journal"; - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (dialog), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } + if (icon_name) + gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name); if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) { selected_source = e_source_selector_dialog_peek_primary_selection (E_SOURCE_SELECTOR_DIALOG (dialog)); diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 7e2994499a..1d947ead13 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -31,7 +31,6 @@ #include #include -#include #include #include #include -- cgit v1.2.3 From da1641b0298bb60ececf1ffab681802c4cd3d378 Mon Sep 17 00:00:00 2001 From: Dmitrijs Ledkovs Date: Tue, 12 Aug 2008 09:00:27 +0000 Subject: ** Fixes bug #498095 2008-08-12 Dmitrijs Ledkovs ** Fixes bug #498095 * gui/dialogs/event-page.glade: "D_escription" -> "_Description" * gui/dialogs/task-page.glade: As above and "_Due Date" -> "D_ue Date" Change mnemonics to resolve clash with "_Edit". * gui/dialogs/memo-page.glade: Set proper mnemonic widget for description label. svn path=/trunk/; revision=35965 --- calendar/gui/dialogs/event-page.glade | 2 +- calendar/gui/dialogs/memo-page.glade | 1 + calendar/gui/dialogs/task-page.glade | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/event-page.glade b/calendar/gui/dialogs/event-page.glade index f593357a65..f0f1d2e090 100644 --- a/calendar/gui/dialogs/event-page.glade +++ b/calendar/gui/dialogs/event-page.glade @@ -159,7 +159,7 @@ True - D_escription: + _Description: True False GTK_JUSTIFY_CENTER diff --git a/calendar/gui/dialogs/memo-page.glade b/calendar/gui/dialogs/memo-page.glade index 93bc1a9b5c..6b65a053d5 100644 --- a/calendar/gui/dialogs/memo-page.glade +++ b/calendar/gui/dialogs/memo-page.glade @@ -159,6 +159,7 @@ True _Description: + memo_content True False GTK_JUSTIFY_CENTER diff --git a/calendar/gui/dialogs/task-page.glade b/calendar/gui/dialogs/task-page.glade index a5eb1e271e..d106381f8f 100644 --- a/calendar/gui/dialogs/task-page.glade +++ b/calendar/gui/dialogs/task-page.glade @@ -169,7 +169,7 @@ True - _Due date: + D_ue date: True False GTK_JUSTIFY_CENTER @@ -274,7 +274,7 @@ True - De_scription: + _Description: True False GTK_JUSTIFY_CENTER -- cgit v1.2.3 From 63376bd6f23bd75e29c8bdeec521cca8e24f1cd5 Mon Sep 17 00:00:00 2001 From: Chenthill Palanisamy Date: Thu, 14 Aug 2008 09:10:01 +0000 Subject: Fixed some warnings. 2008-08-17 Chenthill Palanisamy * gui/dialogs/event-page.c: (source_changed_cb): * gui/dialogs/memo-page.c: (source_changed_cb): * gui/e-cal-model.c: (e_cal_model_set_timezone), (e_cal_view_done_cb): * gui/e-day-view-config.c: Fixed some warnings. svn path=/trunk/; revision=35987 --- calendar/gui/dialogs/event-page.c | 2 +- calendar/gui/dialogs/memo-page.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 3f30617be6..81d5878932 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -2562,8 +2562,8 @@ source_changed_cb (ESourceComboBox *source_combo_box, EventPage *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); + client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_EVENT); if (client) { icaltimezone *zone; diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index 9f3e5d85d4..b8822cee15 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -826,8 +826,8 @@ source_changed_cb (ESourceComboBox *source_combo_box, 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); source = e_source_combo_box_get_active (source_combo_box); + client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_JOURNAL); if (!client || !e_cal_open (client, FALSE, NULL)) { GtkWidget *dialog; -- cgit v1.2.3 From 09cfe5d5690a75e8f79c94b052980dd191965054 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 14 Aug 2008 19:21:10 +0000 Subject: New convenience function for launching help from Evolution. Displays an 2008-08-14 Matthew Barnes * e-util/e-util.c (e_display_help): New convenience function for launching help from Evolution. Displays an error dialog over the given parent window if an error occurs. * addressbook/gui/contact-editor/e-contact-editor.c: * calendar/gui/dialogs/comp-editor.c: * plugins/email-custom-header/gui/contact-editor/e-contact-editor.c: * plugins/exchange-operations/exchange-send-options.c: * widgets/misc/e-multi-config-dialog.c: * widgets/misc/e-send-options.c: Use e_display_help() for displaying help. svn path=/trunk/; revision=35991 --- calendar/gui/dialogs/comp-editor.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index fa7054d942..18d2431d2b 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -2257,16 +2258,11 @@ static void comp_editor_show_help (CompEditor *editor) { CompEditorClass *class; - GError *error = NULL; class = COMP_EDITOR_GET_CLASS (editor); g_return_if_fail (class->help_section != NULL); - gnome_help_display ("evolution.xml", class->help_section, &error); - if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); - } + e_display_help (GTK_WINDOW (editor), class->help_section); } -- cgit v1.2.3 From 1bad915150e2d5e97cbbf1a77f7a85e338c07f28 Mon Sep 17 00:00:00 2001 From: Sankarasivasubramanian Pasupathilingam Date: Wed, 27 Aug 2008 10:33:22 +0000 Subject: License Changes svn path=/trunk/; revision=36116 --- calendar/gui/dialogs/alarm-dialog.h | 35 +++++++++++++---------- calendar/gui/dialogs/alarm-list-dialog.h | 35 +++++++++++++---------- calendar/gui/dialogs/cal-attachment-select-file.h | 26 ++++++++--------- calendar/gui/dialogs/calendar-setup.h | 24 +++++++++------- calendar/gui/dialogs/cancel-comp.h | 27 ++++++++++------- calendar/gui/dialogs/comp-editor-page.c | 27 ++++++++++------- calendar/gui/dialogs/copy-source-dialog.h | 27 ++++++++++------- calendar/gui/dialogs/delete-comp.h | 27 ++++++++++------- calendar/gui/dialogs/delete-error.h | 27 ++++++++++------- calendar/gui/dialogs/e-delegate-dialog.h | 27 +++++++++-------- calendar/gui/dialogs/memo-editor.h | 34 ++++++++++++---------- calendar/gui/dialogs/memo-page.h | 33 +++++++++++---------- calendar/gui/dialogs/recurrence-page.h | 35 +++++++++++++---------- calendar/gui/dialogs/save-comp.c | 28 +++++++++--------- calendar/gui/dialogs/save-comp.h | 30 ++++++++++--------- calendar/gui/dialogs/select-source-dialog.c | 27 +++++++++-------- calendar/gui/dialogs/select-source-dialog.h | 27 ++++++++++------- calendar/gui/dialogs/send-comp.h | 27 +++++++++-------- calendar/gui/dialogs/task-details-page.h | 33 ++++++++++++--------- calendar/gui/dialogs/task-page.h | 33 ++++++++++++--------- 20 files changed, 334 insertions(+), 255 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/alarm-dialog.h b/calendar/gui/dialogs/alarm-dialog.h index 3de343d66c..0cdee744c9 100644 --- a/calendar/gui/dialogs/alarm-dialog.h +++ b/calendar/gui/dialogs/alarm-dialog.h @@ -1,25 +1,30 @@ -/* Evolution calendar - Alarm page of the calendar component dialogs +/* * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Federico Mena-Quintero - * Miguel de Icaza - * Seth Alves - * JP Rosevear - * Hans Petter Jansson + * Evolution calendar - Alarm page of the calendar component dialogs * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * Miguel de Icaza + * Seth Alves + * JP Rosevear + * Hans Petter Jansson + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef ALARM_DIALOG_H diff --git a/calendar/gui/dialogs/alarm-list-dialog.h b/calendar/gui/dialogs/alarm-list-dialog.h index f221e65d04..6a55f03000 100644 --- a/calendar/gui/dialogs/alarm-list-dialog.h +++ b/calendar/gui/dialogs/alarm-list-dialog.h @@ -1,25 +1,30 @@ -/* Evolution calendar - Alarm page of the calendar component dialogs +/* * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Federico Mena-Quintero - * Miguel de Icaza - * Seth Alves - * JP Rosevear - * Hans Petter Jansson + * Evolution calendar - Alarm page of the calendar component dialogs * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * Miguel de Icaza + * Seth Alves + * JP Rosevear + * Hans Petter Jansson + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef ALARM_LIST_DIALOG_H diff --git a/calendar/gui/dialogs/cal-attachment-select-file.h b/calendar/gui/dialogs/cal-attachment-select-file.h index 97f02b8944..3c39fed125 100644 --- a/calendar/gui/dialogs/cal-attachment-select-file.h +++ b/calendar/gui/dialogs/cal-attachment-select-file.h @@ -1,24 +1,24 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* cal-attachment-select-file.c - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) +/* * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * published by the Free Software Foundation; either version 2 of the - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. * - * Author: Harish K + * Authors: + * Harish K + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * */ #ifndef E_MSG_COMPOSER_SELECT_FILE_H diff --git a/calendar/gui/dialogs/calendar-setup.h b/calendar/gui/dialogs/calendar-setup.h index 6e02ab193c..3898467595 100644 --- a/calendar/gui/dialogs/calendar-setup.h +++ b/calendar/gui/dialogs/calendar-setup.h @@ -1,21 +1,23 @@ /* - * Authors: David Trowbridge - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Authors: + * David Trowbridge + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * */ diff --git a/calendar/gui/dialogs/cancel-comp.h b/calendar/gui/dialogs/cancel-comp.h index 070e76ba4d..3566a7548e 100644 --- a/calendar/gui/dialogs/cancel-comp.h +++ b/calendar/gui/dialogs/cancel-comp.h @@ -1,21 +1,26 @@ -/* Evolution calendar - Send calendar component dialog +/* * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: JP Rosevear + * Evolution calendar - Send calendar component dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef CANCEL_COMP_H diff --git a/calendar/gui/dialogs/comp-editor-page.c b/calendar/gui/dialogs/comp-editor-page.c index 4a48611d01..a86465d5d7 100644 --- a/calendar/gui/dialogs/comp-editor-page.c +++ b/calendar/gui/dialogs/comp-editor-page.c @@ -1,21 +1,26 @@ -/* Evolution calendar - Base class for calendar component editor pages +/* * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Federico Mena-Quintero + * Evolution calendar - Base class for calendar component editor pages * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H diff --git a/calendar/gui/dialogs/copy-source-dialog.h b/calendar/gui/dialogs/copy-source-dialog.h index d5211bc4e6..ba3169a1b8 100644 --- a/calendar/gui/dialogs/copy-source-dialog.h +++ b/calendar/gui/dialogs/copy-source-dialog.h @@ -1,21 +1,26 @@ -/* Evolution calendar - Copy source dialog +/* * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: Rodrigo Moya + * Evolution calendar - Copy source dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Rodrigo Moya + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef COPY_SOURCE_DIALOG_H diff --git a/calendar/gui/dialogs/delete-comp.h b/calendar/gui/dialogs/delete-comp.h index bce1d084a7..a2f85301a0 100644 --- a/calendar/gui/dialogs/delete-comp.h +++ b/calendar/gui/dialogs/delete-comp.h @@ -1,21 +1,26 @@ -/* Evolution calendar - Delete calendar component dialog +/* * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: Federico Mena-Quintero + * Evolution calendar - Delete calendar component dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef DELETE_COMP_H diff --git a/calendar/gui/dialogs/delete-error.h b/calendar/gui/dialogs/delete-error.h index c757f9c982..cb0a7d9294 100644 --- a/calendar/gui/dialogs/delete-error.h +++ b/calendar/gui/dialogs/delete-error.h @@ -1,21 +1,26 @@ -/* Evolution calendar - Send calendar component dialog +/* * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: JP Rosevear + * Evolution calendar - Send calendar component dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef DELETE_ERROR_H diff --git a/calendar/gui/dialogs/e-delegate-dialog.h b/calendar/gui/dialogs/e-delegate-dialog.h index f2cf85bc4c..553b7c1576 100644 --- a/calendar/gui/dialogs/e-delegate-dialog.h +++ b/calendar/gui/dialogs/e-delegate-dialog.h @@ -1,21 +1,24 @@ -/* Evolution calendar - Delegate selector dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: JP Rosevear +/* * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __E_DELEGATE_DIALOG_H__ diff --git a/calendar/gui/dialogs/memo-editor.h b/calendar/gui/dialogs/memo-editor.h index ab229584e5..b45edd18ce 100644 --- a/calendar/gui/dialogs/memo-editor.h +++ b/calendar/gui/dialogs/memo-editor.h @@ -1,25 +1,29 @@ -/* Evolution calendar - Task editor dialog +/* * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Miguel de Icaza - * Federico Mena-Quintero - * Seth Alves - * Nathan Owens + * Evolution calendar - Task editor dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Miguel de Icaza + * Federico Mena-Quintero + * Seth Alves + * Nathan Owens + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __MEMO_EDITOR_H__ diff --git a/calendar/gui/dialogs/memo-page.h b/calendar/gui/dialogs/memo-page.h index c96eba9999..cfe4cb0a17 100644 --- a/calendar/gui/dialogs/memo-page.h +++ b/calendar/gui/dialogs/memo-page.h @@ -1,24 +1,27 @@ -/* Evolution calendar - Main page of the memo editor dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Federico Mena-Quintero - * Miguel de Icaza - * Seth Alves - * JP Rosevear +/* * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * Miguel de Icaza + * Seth Alves + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef MEMO_PAGE_H diff --git a/calendar/gui/dialogs/recurrence-page.h b/calendar/gui/dialogs/recurrence-page.h index f4d19effb4..f3bff613ee 100644 --- a/calendar/gui/dialogs/recurrence-page.h +++ b/calendar/gui/dialogs/recurrence-page.h @@ -1,25 +1,30 @@ -/* Evolution calendar - Recurrence page of the calendar component dialogs +/* * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Federico Mena-Quintero - * Miguel de Icaza - * Seth Alves - * JP Rosevear - * Hans Petter Jansson + * Evolution calendar - Recurrence page of the calendar component dialogs * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * Miguel de Icaza + * Seth Alves + * JP Rosevear + * Hans Petter Jansson + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef RECURRENCE_PAGE_H diff --git a/calendar/gui/dialogs/save-comp.c b/calendar/gui/dialogs/save-comp.c index e1d575cdb1..cb178e0dce 100644 --- a/calendar/gui/dialogs/save-comp.c +++ b/calendar/gui/dialogs/save-comp.c @@ -1,22 +1,24 @@ -/* Evolution calendar - Delete calendar component dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: Federico Mena-Quintero +/* * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H diff --git a/calendar/gui/dialogs/save-comp.h b/calendar/gui/dialogs/save-comp.h index a06d7182e6..123a4a8587 100644 --- a/calendar/gui/dialogs/save-comp.h +++ b/calendar/gui/dialogs/save-comp.h @@ -1,22 +1,26 @@ -/* Evolution calendar - Delete calendar component dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: Federico Mena-Quintero +/* * + * Evolution calendar - Delete calendar component dialog + * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef SAVE_COMP_H diff --git a/calendar/gui/dialogs/select-source-dialog.c b/calendar/gui/dialogs/select-source-dialog.c index 9cc6c57fe3..e9fc7d0d9f 100644 --- a/calendar/gui/dialogs/select-source-dialog.c +++ b/calendar/gui/dialogs/select-source-dialog.c @@ -1,21 +1,24 @@ -/* Evolution calendar - Select source dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: Rodrigo Moya +/* * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Rodrigo Moya + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H diff --git a/calendar/gui/dialogs/select-source-dialog.h b/calendar/gui/dialogs/select-source-dialog.h index 1df04fba1c..3ca3cec041 100644 --- a/calendar/gui/dialogs/select-source-dialog.h +++ b/calendar/gui/dialogs/select-source-dialog.h @@ -1,21 +1,26 @@ -/* Evolution calendar - Select source dialog +/* * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: Rodrigo Moya + * Evolution calendar - Select source dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Rodrigo Moya + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef SELECT_SOURCE_DIALOG_H diff --git a/calendar/gui/dialogs/send-comp.h b/calendar/gui/dialogs/send-comp.h index c01612c79b..4a1a6c55ab 100644 --- a/calendar/gui/dialogs/send-comp.h +++ b/calendar/gui/dialogs/send-comp.h @@ -1,21 +1,24 @@ -/* Evolution calendar - Send calendar component dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: JP Rosevear +/* * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef SEND_COMP_H diff --git a/calendar/gui/dialogs/task-details-page.h b/calendar/gui/dialogs/task-details-page.h index 797b87fc9d..9fbfcd4af6 100644 --- a/calendar/gui/dialogs/task-details-page.h +++ b/calendar/gui/dialogs/task-details-page.h @@ -1,24 +1,29 @@ -/* Evolution calendar - Main page of the task editor dialog +/* * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Federico Mena-Quintero - * Miguel de Icaza - * Seth Alves - * JP Rosevear + * Evolution calendar - Main page of the task editor dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * Miguel de Icaza + * Seth Alves + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef TASK_DETAILS_PAGE_H diff --git a/calendar/gui/dialogs/task-page.h b/calendar/gui/dialogs/task-page.h index 243506929e..77ec68fa1d 100644 --- a/calendar/gui/dialogs/task-page.h +++ b/calendar/gui/dialogs/task-page.h @@ -1,24 +1,29 @@ -/* Evolution calendar - Main page of the task editor dialog +/* * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Federico Mena-Quintero - * Miguel de Icaza - * Seth Alves - * JP Rosevear + * Evolution calendar - Main page of the task editor dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * Miguel de Icaza + * Seth Alves + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef TASK_PAGE_H -- cgit v1.2.3 From 14fa5c8a8cf736e3207b9d9e414586d9ff3a623f Mon Sep 17 00:00:00 2001 From: Sankarasivasubramanian Pasupathilingam Date: Tue, 2 Sep 2008 16:25:53 +0000 Subject: Change License from GPL to LGPL. 2nd batch. More changes to come. svn path=/trunk/; revision=36247 --- calendar/gui/dialogs/alarm-dialog.c | 38 +++++++++++------------ calendar/gui/dialogs/alarm-list-dialog.c | 38 ++++++++++++----------- calendar/gui/dialogs/cal-attachment-select-file.c | 28 ++++++++--------- calendar/gui/dialogs/cancel-comp.c | 28 ++++++++++------- calendar/gui/dialogs/changed-comp.h | 28 +++++++++-------- calendar/gui/dialogs/comp-editor-page.h | 28 ++++++++++------- calendar/gui/dialogs/comp-editor-util.c | 28 ++++++++++------- calendar/gui/dialogs/comp-editor-util.h | 28 ++++++++++------- calendar/gui/dialogs/comp-editor.h | 28 ++++++++++------- calendar/gui/dialogs/e-delegate-dialog.c | 29 +++++++++-------- calendar/gui/dialogs/e-send-options-utils.h | 27 +++++++++------- calendar/gui/dialogs/event-editor.c | 36 +++++++++++---------- calendar/gui/dialogs/event-editor.h | 33 +++++++++++--------- calendar/gui/dialogs/event-page.h | 34 +++++++++++--------- calendar/gui/dialogs/memo-editor.c | 38 +++++++++++------------ calendar/gui/dialogs/recur-comp.h | 28 ++++++++++------- calendar/gui/dialogs/schedule-page.c | 34 +++++++++++--------- calendar/gui/dialogs/schedule-page.h | 28 ++++++++++------- calendar/gui/dialogs/send-comp.c | 28 ++++++++++------- calendar/gui/dialogs/task-details-page.c | 34 +++++++++++--------- calendar/gui/dialogs/task-editor.c | 36 +++++++++++---------- calendar/gui/dialogs/task-editor.h | 33 +++++++++++--------- 22 files changed, 377 insertions(+), 313 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c index 11642e3e47..a5f13ccb51 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -1,27 +1,27 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* Evolution calendar - Alarm page of the calendar component dialogs - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Federico Mena-Quintero - * Miguel de Icaza - * Seth Alves - * JP Rosevear - * Hans Petter Jansson - * +/* * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * Miguel de Icaza + * Seth Alves + * JP Rosevear + * Hans Petter Jansson + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H diff --git a/calendar/gui/dialogs/alarm-list-dialog.c b/calendar/gui/dialogs/alarm-list-dialog.c index 8066061993..b078e3123b 100644 --- a/calendar/gui/dialogs/alarm-list-dialog.c +++ b/calendar/gui/dialogs/alarm-list-dialog.c @@ -1,27 +1,29 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* Evolution calendar - Alarm page of the calendar component dialogs - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Federico Mena-Quintero - * Miguel de Icaza - * Seth Alves - * JP Rosevear - * Hans Petter Jansson +/* + * Evolution calendar - Alarm page of the calendar component dialogs * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * Miguel de Icaza + * Seth Alves + * JP Rosevear + * Hans Petter Jansson + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H diff --git a/calendar/gui/dialogs/cal-attachment-select-file.c b/calendar/gui/dialogs/cal-attachment-select-file.c index 2d2acb359e..8d968a84a9 100644 --- a/calendar/gui/dialogs/cal-attachment-select-file.c +++ b/calendar/gui/dialogs/cal-attachment-select-file.c @@ -1,22 +1,22 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* - * Authors: Harish Krishnaswamy + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * Authors: + * Harish Krishnaswamy + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * */ diff --git a/calendar/gui/dialogs/cancel-comp.c b/calendar/gui/dialogs/cancel-comp.c index 4e81e79f44..547f70348e 100644 --- a/calendar/gui/dialogs/cancel-comp.c +++ b/calendar/gui/dialogs/cancel-comp.c @@ -1,21 +1,25 @@ -/* Evolution calendar - Send calendar component dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: JP Rosevear +/* + * Evolution calendar - Send calendar component dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H diff --git a/calendar/gui/dialogs/changed-comp.h b/calendar/gui/dialogs/changed-comp.h index 911c3cf44f..7a8bcb30f5 100644 --- a/calendar/gui/dialogs/changed-comp.h +++ b/calendar/gui/dialogs/changed-comp.h @@ -1,21 +1,23 @@ -/* Evolution calendar - Changed calendar component dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: JP Rosevear - * +/* * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef CHANGED_COMP_H diff --git a/calendar/gui/dialogs/comp-editor-page.h b/calendar/gui/dialogs/comp-editor-page.h index 736ca1c8dc..f8b9db23f3 100644 --- a/calendar/gui/dialogs/comp-editor-page.h +++ b/calendar/gui/dialogs/comp-editor-page.h @@ -1,21 +1,25 @@ -/* Evolution calendar - Base class for calendar component editor pages - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Federico Mena-Quintero +/* + * Evolution calendar - Base class for calendar component editor pages * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef COMP_EDITOR_PAGE_H diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index ea0441709c..6547731776 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -1,21 +1,25 @@ -/* Evolution calendar - Widget utilities - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: Federico Mena-Quintero +/* + * Evolution calendar - Widget utilities * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H diff --git a/calendar/gui/dialogs/comp-editor-util.h b/calendar/gui/dialogs/comp-editor-util.h index c20faf1ec4..565feeaea5 100644 --- a/calendar/gui/dialogs/comp-editor-util.h +++ b/calendar/gui/dialogs/comp-editor-util.h @@ -1,21 +1,25 @@ -/* Evolution calendar - Widget utilities - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: JP Rosevear +/* + * Evolution calendar - Widget utilities * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _COMP_EDITOR_UTIL_H_ diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 786c937d98..9289b9ced7 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -1,21 +1,25 @@ -/* Evolution calendar - Framework for a calendar component editor dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: Federico Mena-Quintero +/* + * Evolution calendar - Framework for a calendar component editor dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef COMP_EDITOR_H diff --git a/calendar/gui/dialogs/e-delegate-dialog.c b/calendar/gui/dialogs/e-delegate-dialog.c index 6eb771622b..31c4631ca9 100644 --- a/calendar/gui/dialogs/e-delegate-dialog.c +++ b/calendar/gui/dialogs/e-delegate-dialog.c @@ -1,22 +1,25 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* Evolution calendar - Delegate selector dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Damon Chaplin +/* + * Evolution calendar - Delegate selector dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Damon Chaplin + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H diff --git a/calendar/gui/dialogs/e-send-options-utils.h b/calendar/gui/dialogs/e-send-options-utils.h index 885d57fd1b..cae3131c00 100644 --- a/calendar/gui/dialogs/e-send-options-utils.h +++ b/calendar/gui/dialogs/e-send-options-utils.h @@ -1,22 +1,25 @@ -/* Evolution calendar - Timezone selector dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Damon Chaplin +/* + * Evolution calendar - Timezone selector dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Damon Chaplin + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. */ #ifndef __E_SENDOPTIONS_UTILS_H__ diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index ca1b581ee6..5f7f14ca11 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -1,26 +1,28 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* Evolution calendar - Event editor dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Miguel de Icaza - * Federico Mena-Quintero - * Seth Alves +/* + * Evolution calendar - Event editor dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Miguel de Icaza + * Federico Mena-Quintero + * Seth Alves + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H diff --git a/calendar/gui/dialogs/event-editor.h b/calendar/gui/dialogs/event-editor.h index aa50466a02..c050b92dfb 100644 --- a/calendar/gui/dialogs/event-editor.h +++ b/calendar/gui/dialogs/event-editor.h @@ -1,24 +1,27 @@ -/* Evolution calendar - Event editor dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Miguel de Icaza - * Federico Mena-Quintero - * Seth Alves +/* + * Evolution calendar - Event editor dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Miguel de Icaza + * Federico Mena-Quintero + * Seth Alves + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __EVENT_EDITOR_H__ diff --git a/calendar/gui/dialogs/event-page.h b/calendar/gui/dialogs/event-page.h index 2f61631960..7c868f1d3d 100644 --- a/calendar/gui/dialogs/event-page.h +++ b/calendar/gui/dialogs/event-page.h @@ -1,24 +1,28 @@ -/* Evolution calendar - Main page of the event editor dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Federico Mena-Quintero - * Miguel de Icaza - * Seth Alves - * JP Rosevear +/* + * Evolution calendar - Main page of the event editor dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * Miguel de Icaza + * Seth Alves + * JP Rosevear * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef EVENT_PAGE_H diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c index a4c73e8dee..410aad156e 100644 --- a/calendar/gui/dialogs/memo-editor.c +++ b/calendar/gui/dialogs/memo-editor.c @@ -1,27 +1,27 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* Evolution calendar - Memo editor dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Miguel de Icaza - * Federico Mena-Quintero - * Seth Alves - * JP Rosevear - * Nathan Owens - * +/* * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Miguel de Icaza + * Federico Mena-Quintero + * Seth Alves + * JP Rosevear + * Nathan Owens + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H diff --git a/calendar/gui/dialogs/recur-comp.h b/calendar/gui/dialogs/recur-comp.h index 88de66c651..e4666772f7 100644 --- a/calendar/gui/dialogs/recur-comp.h +++ b/calendar/gui/dialogs/recur-comp.h @@ -1,21 +1,25 @@ -/* Evolution calendar - Recurring calendar component dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: JP Rosevear +/* + * Evolution calendar - Recurring calendar component dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef RECUR_COMP_H diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c index 57af4ecf87..534923a853 100644 --- a/calendar/gui/dialogs/schedule-page.c +++ b/calendar/gui/dialogs/schedule-page.c @@ -1,24 +1,28 @@ -/* Evolution calendar - Scheduling page - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Federico Mena-Quintero - * Miguel de Icaza - * Seth Alves - * JP Rosevear +/* + * Evolution calendar - Scheduling page * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * Miguel de Icaza + * Seth Alves + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H diff --git a/calendar/gui/dialogs/schedule-page.h b/calendar/gui/dialogs/schedule-page.h index 1bc1825856..8ffbb43c71 100644 --- a/calendar/gui/dialogs/schedule-page.h +++ b/calendar/gui/dialogs/schedule-page.h @@ -1,21 +1,25 @@ -/* Evolution calendar - Scheduling page - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: JP Rosevear +/* + * Evolution calendar - Scheduling page * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef SCHEDULE_PAGE_H diff --git a/calendar/gui/dialogs/send-comp.c b/calendar/gui/dialogs/send-comp.c index 90e07592b0..11d6e74757 100644 --- a/calendar/gui/dialogs/send-comp.c +++ b/calendar/gui/dialogs/send-comp.c @@ -1,21 +1,25 @@ -/* Evolution calendar - Send calendar component dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: JP Rosevear +/* + * Evolution calendar - Send calendar component dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index 4b2a6491b6..af137761d5 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -1,24 +1,28 @@ -/* Evolution calendar - task details page - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Federico Mena-Quintero - * Miguel de Icaza - * Seth Alves - * JP Rosevear +/* + * Evolution calendar - task details page * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * Miguel de Icaza + * Seth Alves + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 1d947ead13..59b9303428 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -1,26 +1,28 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* Evolution calendar - Task editor dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Miguel de Icaza - * Federico Mena-Quintero - * Seth Alves - * JP Rosevear +/* + * Evolution calendar - Task editor dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Miguel de Icaza + * Federico Mena-Quintero + * Seth Alves + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H diff --git a/calendar/gui/dialogs/task-editor.h b/calendar/gui/dialogs/task-editor.h index 2f8330d8e4..9376b4149a 100644 --- a/calendar/gui/dialogs/task-editor.h +++ b/calendar/gui/dialogs/task-editor.h @@ -1,24 +1,27 @@ -/* Evolution calendar - Task editor dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Miguel de Icaza - * Federico Mena-Quintero - * Seth Alves +/* + * Evolution calendar - Task editor dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Miguel de Icaza + * Federico Mena-Quintero + * Seth Alves + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __TASK_EDITOR_H__ -- cgit v1.2.3 From 76dbf9df1f0126d695925c3c012387976951452d Mon Sep 17 00:00:00 2001 From: Sankarasivasubramanian Pasupathilingam Date: Thu, 4 Sep 2008 14:56:39 +0000 Subject: License changes. Changed license from GPL to LGPL. More to come. svn path=/trunk/; revision=36255 --- calendar/gui/dialogs/calendar-setup.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c index 816a76d98e..f7ab2ee846 100644 --- a/calendar/gui/dialogs/calendar-setup.c +++ b/calendar/gui/dialogs/calendar-setup.c @@ -1,21 +1,22 @@ /* - * Authors: David Trowbridge - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Authors: + * David Trowbridge + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * */ -- cgit v1.2.3 From c6c63d16d8e69359fcd8cd74eb62c2422d3c4421 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 6 Sep 2008 16:12:51 +0000 Subject: ** Fixes bug #549968 2008-09-06 Matthew Barnes ** Fixes bug #549968 * calendar/gui/dialogs/comp-editor.c (comp_editor_init): Use the same mnemonic for "Recent Documents" as composer. * widgets/misc/e-attachment-bar.c (e_attachment_bar_bonobo_ui_populate_with): Use the same mnemonic for "Recent Documents" as composer. svn path=/trunk/; revision=36266 --- calendar/gui/dialogs/comp-editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 18d2431d2b..f4ecb85f24 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1763,7 +1763,7 @@ comp_editor_init (CompEditor *editor) NULL, NULL); /* no callback */ action = e_attachment_bar_recent_action_new ( E_ATTACHMENT_BAR (priv->attachment_bar), - "attach-recent", _("Recent Docu_ments")); + "attach-recent", _("Recent _Documents")); gtk_action_group_add_action (action_group, action); gtk_ui_manager_insert_action_group ( priv->manager, action_group, 0); -- cgit v1.2.3 From b7fc5caefe4aded8d0ffd7088ecbbf1f370b995e Mon Sep 17 00:00:00 2001 From: Sankarasivasubramanian Pasupathilingam Date: Fri, 12 Sep 2008 16:19:36 +0000 Subject: License Changes from GPL to LGPL svn path=/trunk/; revision=36313 --- calendar/gui/dialogs/cal-prefs-dialog.h | 29 ++++++++++++++--------------- calendar/gui/dialogs/recur-comp.c | 28 ++++++++++++++++------------ 2 files changed, 30 insertions(+), 27 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 46eff11cef..815080ea06 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -1,24 +1,23 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - /* - * Author : - * David Trowbridge - * Damon Chaplin - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * David Trowbridge + * Damon Chaplin + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * */ diff --git a/calendar/gui/dialogs/recur-comp.c b/calendar/gui/dialogs/recur-comp.c index 6556d1c708..e90cfd237f 100644 --- a/calendar/gui/dialogs/recur-comp.c +++ b/calendar/gui/dialogs/recur-comp.c @@ -1,21 +1,25 @@ -/* Evolution calendar - Recurring calendar component dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: JP Rosevear +/* + * Evolution calendar - Recurring calendar component dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -- cgit v1.2.3 From 498ef8c49931037ae506093df4fff819fae6f8a4 Mon Sep 17 00:00:00 2001 From: Paul Bolle Date: Sat, 13 Sep 2008 00:06:32 +0000 Subject: ** Fix for bug #551895 2008-09-12 Paul Bolle ** Fix for bug #551895 * gui/dialogs/alarm-list-dialog.c: (edit_clicked_cb): Copy paste error. svn path=/trunk/; revision=36315 --- calendar/gui/dialogs/alarm-list-dialog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/alarm-list-dialog.c b/calendar/gui/dialogs/alarm-list-dialog.c index b078e3123b..07395a4782 100644 --- a/calendar/gui/dialogs/alarm-list-dialog.c +++ b/calendar/gui/dialogs/alarm-list-dialog.c @@ -160,7 +160,7 @@ edit_clicked_cb (GtkButton *button, gpointer data) selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->list)); if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) { - g_warning ("Could not get a selection to delete."); + g_warning ("Could not get a selection to edit."); return; } -- cgit v1.2.3 From 79d878670a311644f188f671cbc4e60193100558 Mon Sep 17 00:00:00 2001 From: Sankarasivasubramanian Pasupathilingam Date: Tue, 16 Sep 2008 10:52:29 +0000 Subject: License changes from GPL to LGPL svn path=/trunk/; revision=36344 --- calendar/gui/dialogs/changed-comp.c | 28 ++++++++++++++++------------ calendar/gui/dialogs/copy-source-dialog.c | 28 ++++++++++++++++------------ calendar/gui/dialogs/delete-error.c | 28 ++++++++++++++++------------ 3 files changed, 48 insertions(+), 36 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/changed-comp.c b/calendar/gui/dialogs/changed-comp.c index 5f62e54624..ae215463be 100644 --- a/calendar/gui/dialogs/changed-comp.c +++ b/calendar/gui/dialogs/changed-comp.c @@ -1,21 +1,25 @@ -/* Evolution calendar - Send calendar component dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: JP Rosevear +/* + * Evolution calendar - Send calendar component dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H diff --git a/calendar/gui/dialogs/copy-source-dialog.c b/calendar/gui/dialogs/copy-source-dialog.c index c4863cede1..5bb970433b 100644 --- a/calendar/gui/dialogs/copy-source-dialog.c +++ b/calendar/gui/dialogs/copy-source-dialog.c @@ -1,21 +1,25 @@ -/* Evolution calendar - Copy source dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: Rodrigo Moya +/* + * Evolution calendar - Copy source dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Rodrigo Moya + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H diff --git a/calendar/gui/dialogs/delete-error.c b/calendar/gui/dialogs/delete-error.c index 7c264d0638..d42ef1af91 100644 --- a/calendar/gui/dialogs/delete-error.c +++ b/calendar/gui/dialogs/delete-error.c @@ -1,21 +1,25 @@ -/* Evolution calendar - Send calendar component dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: JP Rosevear +/* + * Evolution calendar - Send calendar component dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -- cgit v1.2.3 From 044925165fcc12e33d7c67df79021679aefb5dc4 Mon Sep 17 00:00:00 2001 From: Sankarasivasubramanian Pasupathilingam Date: Wed, 24 Sep 2008 09:12:38 +0000 Subject: License changes from GPL to LGPL svn path=/trunk/; revision=36440 --- calendar/gui/dialogs/delete-comp.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/delete-comp.c b/calendar/gui/dialogs/delete-comp.c index 228e84f464..3508f38f02 100644 --- a/calendar/gui/dialogs/delete-comp.c +++ b/calendar/gui/dialogs/delete-comp.c @@ -1,21 +1,25 @@ -/* Evolution calendar - Delete calendar component dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: Federico Mena-Quintero +/* + * Evolution calendar - Delete calendar component dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -- cgit v1.2.3 From 762ac32d75dc9ad72e66969afda09766592fd42f Mon Sep 17 00:00:00 2001 From: Sankarasivasubramanian Pasupathilingam Date: Wed, 24 Sep 2008 11:02:48 +0000 Subject: Change License from GPL to LGPL svn path=/trunk/; revision=36443 --- calendar/gui/dialogs/cal-prefs-dialog.c | 31 ++++++++++++------------- calendar/gui/dialogs/e-send-options-utils.c | 28 ++++++++++++---------- calendar/gui/dialogs/event-page.c | 34 +++++++++++++++------------ calendar/gui/dialogs/memo-page.c | 36 ++++++++++++++++------------- calendar/gui/dialogs/task-page.c | 34 +++++++++++++++------------ 5 files changed, 89 insertions(+), 74 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index c5fab53133..8ba51259e5 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -1,25 +1,24 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - /* - * Authors : - * Damon Chaplin - * Ettore Perazzoli - * David Trowbridge - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Damon Chaplin + * Ettore Perazzoli + * David Trowbridge + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * */ diff --git a/calendar/gui/dialogs/e-send-options-utils.c b/calendar/gui/dialogs/e-send-options-utils.c index 08df95b1b2..fde53ca336 100644 --- a/calendar/gui/dialogs/e-send-options-utils.c +++ b/calendar/gui/dialogs/e-send-options-utils.c @@ -1,23 +1,27 @@ -/* Evolution calendar - Timezone selector dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Damon Chaplin +/* + * Evolution calendar - Timezone selector dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Damon Chaplin + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. */ + #include "e-send-options-utils.h" #include "../calendar-config.h" #include diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 81d5878932..4a36f8ced3 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -1,24 +1,28 @@ -/* Evolution calendar - Main page of the event editor dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Federico Mena-Quintero - * Miguel de Icaza - * Seth Alves - * JP Rosevear +/* + * Evolution calendar - Main page of the event editor dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * Miguel de Icaza + * Seth Alves + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index b8822cee15..421fdcf56b 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -1,25 +1,29 @@ -/* Evolution calendar - Main page of the memo editor dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Federico Mena-Quintero - * Miguel de Icaza - * Seth Alves - * JP Rosevear - * Nathan Owens +/* + * Evolution calendar - Main page of the memo editor dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * Miguel de Icaza + * Seth Alves + * JP Rosevear + * Nathan Owens + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 87142a7671..99dc9bac38 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -1,24 +1,28 @@ -/* Evolution calendar - Main page of the task editor dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Federico Mena-Quintero - * Miguel de Icaza - * Seth Alves - * JP Rosevear +/* + * Evolution calendar - Main page of the task editor dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * Miguel de Icaza + * Seth Alves + * JP Rosevear + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -- cgit v1.2.3 From 3b318d5cbf08f6a42088df23db27fcfa55502591 Mon Sep 17 00:00:00 2001 From: Sankarasivasubramanian Pasupathilingam Date: Wed, 1 Oct 2008 09:24:41 +0000 Subject: Change License from GPL to LGPL. svn path=/trunk/; revision=36520 --- calendar/gui/dialogs/recurrence-page.c | 38 ++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 062d0ad0c0..6c879ae8e3 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -1,27 +1,29 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* Evolution calendar - Recurrence page of the calendar component dialogs - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Federico Mena-Quintero - * Miguel de Icaza - * Seth Alves - * JP Rosevear - * Hans Petter Jansson +/* + * Evolution calendar - Recurrence page of the calendar component dialogs * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * Miguel de Icaza + * Seth Alves + * JP Rosevear + * Hans Petter Jansson + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -- cgit v1.2.3 From 77ff19dd8394167cdc9765af20a62bdaed18e308 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 1 Oct 2008 12:29:46 +0000 Subject: ** Fix for bug #554418 2008-10-01 Milan Crha ** Fix for bug #554418 * e-util/e-util.h: (e_util_guess_mime_type): * e-util/e-util.c: (e_util_guess_mime_type): Guess mime_type based on the file content only when permitted by the caller, otherwise check based on the filename only, where it fallbacks if file content guess fails. * mail/em-utils.c: (em_utils_snoop_type): * mail/em-popup.c: (emp_standard_menu_factory): Guess mime_type based on the filename only. * composer/e-msg-composer.c: (handle_uri), (e_msg_composer_add_inline_image_from_file): Guess mime_type based on the file content, if failed, then on the filename. * widgets/misc/e-attachment.c: (attachment_guess_mime_type): Allow guessing mime_type based on the file content. * calendar/gui/dialogs/comp-editor.c: (set_attachment_list): * calendar/gui/e-cal-popup.c: (ecalp_standard_menu_factory): Allow/disallow guessing of the mime_type based on the file content. svn path=/trunk/; revision=36529 --- calendar/gui/dialogs/comp-editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index f4ecb85f24..0f3a62cfe8 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -2843,7 +2843,7 @@ set_attachment_list (CompEditor *editor, GSList *attach_list) return; } - mime_type = e_util_guess_mime_type (file_name); + mime_type = e_util_guess_mime_type (file_name, TRUE); if (mime_type) { if (!g_ascii_strcasecmp (mime_type, "message/rfc822")) { wrapper = (CamelDataWrapper *) camel_mime_message_new (); -- cgit v1.2.3 From 48edab7b48fc3965701cda4a5d743a7d7053114f Mon Sep 17 00:00:00 2001 From: Sankarasivasubramanian Pasupathilingam Date: Wed, 8 Oct 2008 11:06:15 +0000 Subject: Change License from GPL to LGPL. svn path=/trunk/; revision=36576 --- calendar/gui/dialogs/comp-editor.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 0f3a62cfe8..cbd6b3f778 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1,21 +1,25 @@ -/* Evolution calendar - Framework for a calendar component editor dialog - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Author: Federico Mena-Quintero +/* + * Evolution calendar - Framework for a calendar component editor dialog * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Federico Mena-Quintero + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -- cgit v1.2.3 From a3b38ef1293fa8c8f162be5310e5b3dec8782a2e Mon Sep 17 00:00:00 2001 From: Suman Manjunath Date: Mon, 13 Oct 2008 10:24:07 +0000 Subject: Fix for bug #424818 (bugzilla.novell.com) - Integrate the mark-calendar-offline plugin into the main code as we already have a similar per-calendar option which does the same thing. svn path=/trunk/; revision=36610 --- calendar/gui/dialogs/calendar-setup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c index f7ab2ee846..724206a072 100644 --- a/calendar/gui/dialogs/calendar-setup.c +++ b/calendar/gui/dialogs/calendar-setup.c @@ -259,7 +259,8 @@ eccp_general_offline (EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, GtkWidget *offline_setting = NULL; const char *offline_sync; int row; - gboolean is_local = g_str_has_prefix (e_source_group_peek_base_uri (sdialog->source_group), "file:"); + const char *base_uri = e_source_group_peek_base_uri (sdialog->source_group); + gboolean is_local = base_uri && (g_str_has_prefix (base_uri, "file://") || g_str_has_prefix (base_uri, "contacts://")); offline_sync = e_source_get_property (sdialog->source, "offline_sync"); if (old) return old; -- cgit v1.2.3 From 0031f7a894a5498d985e438af3527dc6905c4b70 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 20 Oct 2008 15:56:38 +0000 Subject: ** Fixes bug #555958 (patch by Anis Elleuch) 2008-10-20 Matthew Barnes ** Fixes bug #555958 (patch by Anis Elleuch) * calendar/gui/dialogs/comp-editor.c (comp_editor_init): Add the UI manager's accelerator group to the editor window so that menu shortcut keys work. svn path=/trunk/; revision=36667 --- calendar/gui/dialogs/comp-editor.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index cbd6b3f778..16bdb979e1 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1741,6 +1741,10 @@ comp_editor_init (CompEditor *editor) priv->attachment_bar = e_attachment_bar_new (NULL); priv->manager = gtk_ui_manager_new (); + gtk_window_add_accel_group ( + GTK_WINDOW (editor), + gtk_ui_manager_get_accel_group (priv->manager)); + action_group = gtk_action_group_new ("core"); gtk_action_group_set_translation_domain ( action_group, GETTEXT_PACKAGE); -- cgit v1.2.3 From 0d04eeb781f3c28e1a2405410d9b054c4e3c66e5 Mon Sep 17 00:00:00 2001 From: Suman Manjunath Date: Mon, 10 Nov 2008 10:29:30 +0000 Subject: Fix for bug #443190 (bugzilla.novell.com) - Block signals from attachment-bar while still filling the widgets. svn path=/trunk/; revision=36769 --- calendar/gui/dialogs/comp-editor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 16bdb979e1..198d60356c 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -2903,7 +2903,9 @@ fill_widgets (CompEditor *editor) if (e_cal_component_has_attachments (priv->comp)) { GSList *attachment_list = NULL; e_cal_component_get_attachment_list (priv->comp, &attachment_list); + g_signal_handlers_block_by_func(priv->attachment_bar, G_CALLBACK (attachment_bar_changed_cb), editor); set_attachment_list (editor, attachment_list); + g_signal_handlers_unblock_by_func(priv->attachment_bar, G_CALLBACK (attachment_bar_changed_cb), editor); g_slist_foreach (attachment_list, (GFunc)g_free, NULL); g_slist_free (attachment_list); } @@ -2916,7 +2918,6 @@ static void real_edit_comp (CompEditor *editor, ECalComponent *comp) { CompEditorPrivate *priv; - const char *uid; g_return_if_fail (IS_COMP_EDITOR (editor)); @@ -2935,7 +2936,6 @@ real_edit_comp (CompEditor *editor, ECalComponent *comp) priv->warned = FALSE; update_window_border (editor, NULL); - e_cal_component_get_uid (comp, &uid); fill_widgets (editor); -- cgit v1.2.3 From 4f015ce67a104d6c9476356394dc78443d6eb06f Mon Sep 17 00:00:00 2001 From: Suman Manjunath Date: Fri, 28 Nov 2008 08:04:21 +0000 Subject: Fix for bug #561467 - some changes in the core code needed for evolution-mapi. svn path=/trunk/; revision=36818 --- calendar/gui/dialogs/comp-editor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 198d60356c..4067861fc2 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -3046,7 +3046,8 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method) set_attendees_for_delegation (send_comp, address, method); } - if (!e_cal_component_has_attachments (priv->comp)) { + if (!e_cal_component_has_attachments (priv->comp) + || e_cal_get_static_capability (priv->client, CAL_STATIC_CAPABILITY_CREATE_MESSAGES)) { if (itip_send_comp (method, send_comp, priv->client, NULL, NULL, users)) { g_object_unref (send_comp); -- cgit v1.2.3 From 4bec962f7b5cd2a65bed33de3e8f56f3b2b4bad7 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 2 Dec 2008 16:41:24 +0000 Subject: ** Fixes part of bug #348299 2008-12-02 Matthew Barnes ** Fixes part of bug #348299 * addressbook/gui/contact-editor/e-contact-editor.c (e_contact_editor_init): * calendar/gui/dialogs/event-page.c (get_widgets): * calendar/gui/dialogs/memo-page.c (get_widgets): * calendar/gui/dialogs/task-page.c (get_widgets): Use category completion in the Categories field. * calendar/gui/dialogs/event-editor.c: * calendar/gui/dialogs/memo-editor.c: * calendar/gui/dialogs/task-editor.c: Fix some reference count leaks. svn path=/trunk/; revision=36826 --- calendar/gui/dialogs/event-editor.c | 3 --- calendar/gui/dialogs/event-page.c | 6 ++++++ calendar/gui/dialogs/memo-editor.c | 1 - calendar/gui/dialogs/memo-page.c | 6 ++++++ calendar/gui/dialogs/task-editor.c | 2 -- calendar/gui/dialogs/task-page.c | 6 ++++++ 6 files changed, 18 insertions(+), 6 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 5f7f14ca11..815ee76312 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -124,7 +124,6 @@ create_schedule_page (CompEditor *editor) 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)); @@ -290,7 +289,6 @@ event_editor_constructor (GType type, gtk_action_group_set_visible (action_group, is_meeting); 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); @@ -307,7 +305,6 @@ event_editor_constructor (GType type, 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)); diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 4a36f8ced3..ca42dd92fb 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include "common/authentication.h" #include "e-util/e-categories-config.h" @@ -2157,6 +2158,7 @@ static gboolean get_widgets (EventPage *epage) { CompEditorPage *page = COMP_EDITOR_PAGE (epage); + GtkEntryCompletion *completion; EventPagePrivate *priv; GSList *accel_groups; GtkWidget *toplevel; @@ -2250,6 +2252,10 @@ get_widgets (EventPage *epage) #undef GW + completion = e_category_completion_new (); + gtk_entry_set_completion (GTK_ENTRY (priv->categories), completion); + g_object_unref (completion); + return (priv->summary && priv->location && priv->start_time diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c index 410aad156e..89016f8c91 100644 --- a/calendar/gui/dialogs/memo-editor.c +++ b/calendar/gui/dialogs/memo-editor.c @@ -134,7 +134,6 @@ memo_editor_init (MemoEditor *me) } 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), diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index 421fdcf56b..362a8b0e9a 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -746,6 +747,7 @@ static gboolean get_widgets (MemoPage *mpage) { CompEditorPage *page = COMP_EDITOR_PAGE (mpage); + GtkEntryCompletion *completion; MemoPagePrivate *priv; GSList *accel_groups; GtkWidget *toplevel; @@ -795,6 +797,10 @@ get_widgets (MemoPage *mpage) #undef GW + completion = e_category_completion_new (); + gtk_entry_set_completion (GTK_ENTRY (priv->categories), completion); + g_object_unref (completion); + return (priv->memo_content && priv->categories_btn && priv->categories diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 59b9303428..ca6959640b 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -312,7 +312,6 @@ task_editor_init (TaskEditor *te) 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); @@ -328,7 +327,6 @@ task_editor_init (TaskEditor *te) 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)); diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 99dc9bac38..7f2969abd2 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -1377,6 +1378,7 @@ static gboolean get_widgets (TaskPage *tpage) { CompEditorPage *page = COMP_EDITOR_PAGE (tpage); + GtkEntryCompletion *completion; TaskPagePrivate *priv; GSList *accel_groups; GtkWidget *toplevel; @@ -1449,6 +1451,10 @@ get_widgets (TaskPage *tpage) #undef GW + completion = e_category_completion_new (); + gtk_entry_set_completion (GTK_ENTRY (priv->categories), completion); + g_object_unref (completion); + return (priv->summary && priv->summary_label && priv->due_date -- cgit v1.2.3 From 7223655df2828370ab19f14953ecd22a30a4b55f Mon Sep 17 00:00:00 2001 From: Suman Manjunath Date: Mon, 8 Dec 2008 04:02:47 +0000 Subject: Patch from Paul Bolle : Fix for bug #551599 (Do not fallback to default 15 minutes alarm offset if alarm is triggered at start (or end) of appointment). svn path=/trunk/; revision=36837 --- calendar/gui/dialogs/alarm-dialog.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c index a5f13ccb51..7e429a28b2 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -623,19 +623,18 @@ populate_widgets_from_alarm (Dialog *dialog) break; } - if ( trigger->u.rel_duration.hours ) { + if ( trigger->u.rel_duration.days ) { + e_dialog_option_menu_set (dialog->value_units, DAYS, value_map); + e_dialog_spin_set (dialog->interval_value, trigger->u.rel_duration.days); + } else if ( trigger->u.rel_duration.hours ) { e_dialog_option_menu_set (dialog->value_units, HOURS, value_map); e_dialog_spin_set (dialog->interval_value, trigger->u.rel_duration.hours); - } - - if ( trigger->u.rel_duration.minutes ){ + } else if ( trigger->u.rel_duration.minutes ) { e_dialog_option_menu_set (dialog->value_units, MINUTES, value_map); e_dialog_spin_set (dialog->interval_value, trigger->u.rel_duration.minutes); - } - - if ( trigger->u.rel_duration.days ){ - e_dialog_option_menu_set (dialog->value_units, DAYS, value_map); - e_dialog_spin_set (dialog->interval_value, trigger->u.rel_duration.days); + } else { + e_dialog_option_menu_set (dialog->value_units, MINUTES, value_map); + e_dialog_spin_set (dialog->interval_value, 0); } /* Repeat options */ -- cgit v1.2.3 From 0694086ab958a0ab21448c5afca1e29091686ed6 Mon Sep 17 00:00:00 2001 From: Suman Manjunath Date: Mon, 8 Dec 2008 09:39:03 +0000 Subject: Patch from Jennifer Newman : Fix for bug #555371 (Added print menu option to task, memo and event editors). svn path=/trunk/; revision=36848 --- calendar/gui/dialogs/comp-editor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 4067861fc2..518abd055e 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -138,6 +138,7 @@ static const gchar *ui = " " " " " " +" " " " " " " " @@ -159,6 +160,7 @@ static const gchar *ui = " " " " " " +" " " " " " " " @@ -1297,7 +1299,7 @@ static GtkActionEntry core_entries[] = { { "print", GTK_STOCK_PRINT, NULL, - NULL, + "p", NULL, G_CALLBACK (action_print_cb) }, -- cgit v1.2.3 From 14ed95aaafdf590495c951a46234894acfd14157 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 9 Dec 2008 12:53:32 +0000 Subject: ** Fix for bug #563669 2008-12-09 Milan Crha ** Fix for bug #563669 * addressbook/gui/component/ldap-config.glade: * addressbook/printing/e-contact-print.glade: * mail/mail-config.glade: * filter/filter.glade: * widgets/misc/e-send-options.glade: * calendar/gui/dialogs/recurrence-page.glade: * calendar/gui/dialogs/alarm-dialog.glade: * calendar/gui/dialogs/event-page.glade: * calendar/gui/dialogs/task-details-page.glade: * calendar/gui/dialogs/cal-prefs-dialog.glade: * calendar/gui/alarm-notify/alarm-notify.glade: * calendar/gui/goto-dialog.glade: Use zero GtkSpinButton's PageSize, as Gtk+ requires. svn path=/trunk/; revision=36855 --- calendar/gui/dialogs/alarm-dialog.glade | 6 +++--- calendar/gui/dialogs/cal-prefs-dialog.glade | 4 ++-- calendar/gui/dialogs/event-page.glade | 4 ++-- calendar/gui/dialogs/recurrence-page.glade | 2 +- calendar/gui/dialogs/task-details-page.glade | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/alarm-dialog.glade b/calendar/gui/dialogs/alarm-dialog.glade index 4e32374928..5a5d4ef291 100644 --- a/calendar/gui/dialogs/alarm-dialog.glade +++ b/calendar/gui/dialogs/alarm-dialog.glade @@ -197,7 +197,7 @@ GTK_UPDATE_ALWAYS False False - 1 0 999 1 10 10 + 1 0 999 1 10 0 0 @@ -431,7 +431,7 @@ GTK_UPDATE_ALWAYS False False - 1 1 999 1 10 10 + 1 1 999 1 10 0 0 @@ -475,7 +475,7 @@ GTK_UPDATE_ALWAYS False False - 5 0 999 1 10 10 + 5 0 999 1 10 0 0 diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade index c24321e0a2..d3003bdb6f 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ b/calendar/gui/dialogs/cal-prefs-dialog.glade @@ -808,7 +808,7 @@ Sunday GTK_UPDATE_ALWAYS False False - 0 0 9999 1 10 10 + 0 0 9999 1 10 0 0 @@ -1312,7 +1312,7 @@ Days GTK_UPDATE_ALWAYS False False - 1 0 9999 1 10 10 + 1 0 9999 1 10 0 0 diff --git a/calendar/gui/dialogs/event-page.glade b/calendar/gui/dialogs/event-page.glade index f0f1d2e090..c7d00dda94 100644 --- a/calendar/gui/dialogs/event-page.glade +++ b/calendar/gui/dialogs/event-page.glade @@ -451,7 +451,7 @@ GTK_UPDATE_ALWAYS False False - 1 0 0 1 1 1 + 1 0 0 1 1 0 0 @@ -495,7 +495,7 @@ GTK_UPDATE_ALWAYS False False - 0 0 59 5 10 10 + 0 0 59 5 10 0 0 diff --git a/calendar/gui/dialogs/recurrence-page.glade b/calendar/gui/dialogs/recurrence-page.glade index 62654322b0..14d6c2fa04 100644 --- a/calendar/gui/dialogs/recurrence-page.glade +++ b/calendar/gui/dialogs/recurrence-page.glade @@ -141,7 +141,7 @@ GTK_UPDATE_ALWAYS False False - 1 1 10000 1 10 10 + 1 1 10000 1 10 0 0 diff --git a/calendar/gui/dialogs/task-details-page.glade b/calendar/gui/dialogs/task-details-page.glade index bca7da4a08..aac90876ed 100644 --- a/calendar/gui/dialogs/task-details-page.glade +++ b/calendar/gui/dialogs/task-details-page.glade @@ -297,7 +297,7 @@ GTK_UPDATE_ALWAYS False False - 0 0 100 1 10 10 + 0 0 100 1 10 0 1 -- cgit v1.2.3 From 7365be40fe5adb231140711487e798438ff8777a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 15 Dec 2008 11:46:53 +0000 Subject: ** Part of fix for bug #563669 2008-12-15 Milan Crha ** Part of fix for bug #563669 * mail/em-account-editor.c: (emae_option_checkspin): * filter/filter-int.c: (get_widget): * calendar/gui/dialogs/recurrence-page.c: (make_ending_count_special): * calendar/conduits/todo/todo-conduit.c: (e_todo_gui_new): Use zero GtkSpinButton's PageSize, as Gtk+ requires. svn path=/trunk/; revision=36892 --- calendar/gui/dialogs/recurrence-page.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 6c879ae8e3..8a93c4dfee 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -1377,7 +1377,7 @@ make_ending_count_special (RecurrencePage *rpage) hbox = gtk_hbox_new (FALSE, 2); gtk_container_add (GTK_CONTAINER (priv->ending_special), hbox); - adj = GTK_ADJUSTMENT (gtk_adjustment_new (1, 1, 10000, 1, 10, 10)); + adj = GTK_ADJUSTMENT (gtk_adjustment_new (1, 1, 10000, 1, 10, 0)); priv->ending_count_spin = gtk_spin_button_new (adj, 1, 0); gtk_spin_button_set_numeric ((GtkSpinButton *)priv->ending_count_spin, TRUE); gtk_box_pack_start (GTK_BOX (hbox), priv->ending_count_spin, -- cgit v1.2.3 From a7c7fdc59813ca956e8eef75f54b1b582e47e19a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 15 Dec 2008 11:52:50 +0000 Subject: ** Part of fix for bug #564229 2008-12-15 Milan Crha ** Part of fix for bug #564229 * gui/dialogs/alarm-dialog.c: (populate_widgets_from_alarm): Cast to proper object. * gui/alarm-notify/alarm-queue.c: (free_tray_icon_data): Do not leak. svn path=/trunk/; revision=36893 --- calendar/gui/dialogs/alarm-dialog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c index 7e429a28b2..bf78f70011 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -642,7 +642,7 @@ populate_widgets_from_alarm (Dialog *dialog) /* Alarm options */ e_dialog_option_menu_set (dialog->action, *action, action_map); - action_selection_done_cb (GTK_MENU_SHELL (dialog->action), dialog); + action_selection_done_cb (GTK_MENU_SHELL (gtk_option_menu_get_menu (GTK_OPTION_MENU (dialog->action))), dialog); switch (*action) { case E_CAL_COMPONENT_ALARM_AUDIO: -- cgit v1.2.3 From b24fc3e455eca8d5dcb9119ce8a47af83dec494f Mon Sep 17 00:00:00 2001 From: Bharath Acharya Date: Mon, 29 Dec 2008 05:57:28 +0000 Subject: ** Fix for bug #439998 (bnc) 2008-12-29 Bharath Acharya ** Fix for bug #439998 (bnc) * gui/dialogs/comp-editor.c: (remove_event_dialog), (action_save_cb): Ask the user if he wants to remove the delegated events or keep a copy. svn path=/trunk/; revision=36940 --- calendar/gui/dialogs/comp-editor.c | 46 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 518abd055e..04f910745b 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1102,6 +1102,24 @@ action_print_preview_cb (GtkAction *action, g_object_unref (comp); } +static gboolean +remove_event_dialog (ECal *client, + ECalComponent *comp, + GtkWindow *parent) +{ + GtkWidget *dialog; + gboolean ret; + + g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), TRUE); + + dialog = gtk_message_dialog_new (parent, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s", _("Keep original item?")); + gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE); + ret = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES; + gtk_widget_destroy (dialog); + + return ret; +} + static void action_save_cb (GtkAction *action, CompEditor *editor) @@ -1153,9 +1171,33 @@ action_save_cb (GtkAction *action, if (!text.value) if (!send_component_prompt_subject ((GtkWindow *) editor, priv->client, priv->comp)) return; - if (save_comp_with_send (editor)) - close_dialog (editor); + if (save_comp_with_send (editor)) { + CompEditorFlags flags; + gboolean delegate; + + flags = comp_editor_get_flags (editor); + delegate = flags & COMP_EDITOR_DELEGATE; + + if (delegate && !remove_event_dialog (priv->client, priv->comp, GTK_WINDOW (editor))) { + const char *uid = NULL; + GError *error = NULL; + + e_cal_component_get_uid (priv->comp, &uid); + + if (e_cal_component_is_instance (priv->comp) || e_cal_component_has_recurrences (priv->comp)) { + gchar *rid; + rid = e_cal_component_get_recurid_as_string (priv->comp); + e_cal_remove_object_with_mod (priv->client, uid, rid, priv->mod, &error); + g_free (rid); + } else + e_cal_remove_object (priv->client, uid, &error); + + g_clear_error (&error); + } + } + + close_dialog (editor); } static void -- cgit v1.2.3 From 0a836b1b03d9059d00ff6bb3454f3b5907052a17 Mon Sep 17 00:00:00 2001 From: Suman Manjunath Date: Wed, 31 Dec 2008 05:29:45 +0000 Subject: Matthew Barnes ** Fix for bug #562091 - Create MemoPage after the base class object has been created and initialized. svn path=/trunk/; revision=36948 --- calendar/gui/dialogs/memo-editor.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c index 89016f8c91..4fbf35d916 100644 --- a/calendar/gui/dialogs/memo-editor.c +++ b/calendar/gui/dialogs/memo-editor.c @@ -96,6 +96,21 @@ memo_editor_dispose (GObject *object) G_OBJECT_CLASS (memo_editor_parent_class)->dispose (object); } +static void +memo_editor_constructed (GObject *object) +{ + MemoEditorPrivate *priv; + CompEditor *editor; + + priv = MEMO_EDITOR_GET_PRIVATE (object); + editor = COMP_EDITOR (object); + + priv->memo_page = memo_page_new (editor); + comp_editor_append_page ( + editor, COMP_EDITOR_PAGE (priv->memo_page), + _("Memo"), TRUE); +} + static void memo_editor_class_init (MemoEditorClass *class) { @@ -106,6 +121,7 @@ memo_editor_class_init (MemoEditorClass *class) object_class = G_OBJECT_CLASS (class); object_class->dispose = memo_editor_dispose; + object_class->constructed = memo_editor_constructed; /* TODO Add a help section for memos. */ editor_class = COMP_EDITOR_CLASS (class); @@ -132,12 +148,6 @@ memo_editor_init (MemoEditor *me) g_critical ("%s: %s", G_STRFUNC, error->message); g_error_free (error); } - - me->priv->memo_page = memo_page_new (editor); - comp_editor_append_page ( - COMP_EDITOR (me), - COMP_EDITOR_PAGE (me->priv->memo_page), - _("Memo"), TRUE); } /** -- cgit v1.2.3 From d8ae130852f29e722a52af48d8e1aaaea4b8d69a Mon Sep 17 00:00:00 2001 From: Suman Manjunath Date: Mon, 5 Jan 2009 07:44:23 +0000 Subject: Patch from Ashish Shrivastava ** Fix for bug #458153 (bugzilla.novell.com) - Provide a 'Show time as busy' button in the toolbar (like the other items in the 'Options' menu). svn path=/trunk/; revision=36988 --- calendar/gui/dialogs/comp-editor.c | 1 + calendar/gui/dialogs/event-editor.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 04f910745b..c69ad004cc 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -164,6 +164,7 @@ static const gchar *ui = " " " " " " +" " " " ""; diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 815ee76312..161ed598b7 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -79,20 +79,21 @@ static const gchar *ui = " " " " " " +" " " " +" " " " " " " " " " " " -" " -" " " " " " " " " " -" " +" " " " +" " " " " " ""; @@ -149,9 +150,15 @@ action_all_day_event_cb (GtkToggleAction *action, EventEditor *editor) { gboolean active; + GtkAction *action_show_busy; + CompEditor *comp_editor = COMP_EDITOR (editor); active = gtk_toggle_action_get_active (action); event_page_set_all_day_event (editor->priv->event_page, active); + + action_show_busy = comp_editor_get_action (comp_editor, "show-time-busy"); + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action_show_busy), !active); + event_page_set_show_time_busy (editor->priv->event_page, !active); } static void @@ -223,7 +230,7 @@ static GtkToggleActionEntry event_toggle_entries[] = { FALSE }, { "show-time-busy", - NULL, + GTK_STOCK_DIALOG_ERROR, N_("Show Time as _Busy"), NULL, N_("Toggles whether to show time as busy"), -- cgit v1.2.3 From 410c784fb55bcb019c33fd4f3c5cb1ecdce59e94 Mon Sep 17 00:00:00 2001 From: Suman Manjunath Date: Tue, 6 Jan 2009 09:01:01 +0000 Subject: Fix for bug #458968 (bugzilla.novell.com) - Don't warn the user about changes being lost if he is trying to delegate the meeting. svn path=/trunk/; revision=36997 --- calendar/gui/dialogs/comp-editor.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index c69ad004cc..99d49349fd 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -2434,6 +2434,7 @@ comp_editor_set_summary (CompEditor *editor, show_warning = !editor->priv->warned && + !(editor->priv->flags & COMP_EDITOR_DELEGATE) && editor->priv->existing_org && !editor->priv->user_org; @@ -2482,6 +2483,7 @@ comp_editor_set_changed (CompEditor *editor, show_warning = changed && !editor->priv->warned && + !(editor->priv->flags & COMP_EDITOR_DELEGATE) && editor->priv->existing_org && !editor->priv->user_org; if (show_warning) { -- cgit v1.2.3 From 607ce3802eabee692e55d89aacefd06390819e07 Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Fri, 9 Jan 2009 07:36:29 +0000 Subject: Reviewed by Matthew Barnes 2009-01-09 Takao Fujiwara Reviewed by Matthew Barnes * Fix for bug #566011 * addressbook/gui/component/Makefile.am: * addressbook/gui/component/addressbook-component.c (addressbook_component_class_init): Include instead of and add bindtextdomain(). * calendar/gui/Makefile.am: * calendar/gui/calendar-component.c (calendar_component_class_init): * calendar/gui/dialogs/comp-editor.c: * calendar/gui/memos-component.c (memos_component_class_init): * calendar/gui/tasks-component.c (tasks_component_class_init): Include instead of and add bindtextdomain(). * composer/e-composer-header-table.c: * composer/e-composer-private.h: Include instead of . * mail/mail-component.c (mail_component_class_init): Include instead of and add bindtextdomain(). * shell/e-user-creatable-items-handler.c (e_user_creatable_items_handler_class_ini): Include instead of and add bindtextdomain(). * widgets/misc/e-charset-picker.c: * widgets/misc/e-signature-combo-box.c: Include instead of . svn path=/trunk/; revision=37021 --- calendar/gui/dialogs/comp-editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 99d49349fd..c7db81e8bb 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include -- cgit v1.2.3 From 97e48e352419d360934a46a05c944d604fd968e9 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 10 Jan 2009 23:41:27 +0000 Subject: ** Fixes bug #567276 2009-01-10 Matthew Barnes ** Fixes bug #567276 * addressbook/gui/widgets/e-addressbook-view.c: * addressbook/printing/test-print.c: * calendar/gui/calendar-commands.c: * calendar/gui/control-factory.c: * calendar/gui/e-itip-control.c: * calendar/gui/gnome-cal.c: * calendar/gui/goto.c: * calendar/gui/memos-control.c: * calendar/gui/print.c: * calendar/gui/tasks-control.c: * calendar/gui/alarm-notify/alarm-queue.c: * calendar/gui/dialogs/schedule-page.c: * widgets/menus/gal-view-menus.c: Remove unneeded #include . * calendar/gui/calendar-config.c: * calendar/gui/calendar-config.h: Removed unused function calendar_config_check_timezone_set(). * widgets/misc/test-color.c: We don't ship this. Remove it. svn path=/trunk/; revision=37030 --- calendar/gui/dialogs/schedule-page.c | 1 - 1 file changed, 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c index 534923a853..e1137be3a0 100644 --- a/calendar/gui/dialogs/schedule-page.c +++ b/calendar/gui/dialogs/schedule-page.c @@ -31,7 +31,6 @@ #include #include -#include #include #include #include -- cgit v1.2.3 From b20c8370f1d894f4f971c0da9cdd132843f50934 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 11 Jan 2009 03:34:52 +0000 Subject: Remove unneeded #include . Remove unneeded 2009-01-10 Matthew Barnes * addressbook/gui/component/addressbook-view.c: * addressbook/gui/contact-editor/e-contact-editor.h: * addressbook/gui/contact-editor/e-contact-quick-add.c: * addressbook/gui/contact-editor/eab-editor.h: * addressbook/gui/contact-list-editor/e-contact-list-editor.h: * mail/mail-autofilter.c: Remove unneeded #include . Remove unneeded #include * calendar/gui/calendar-commands.c: * calendar/gui/e-cell-date-edit-text.c: * calendar/gui/e-itip-control.c: * calendar/gui/memos-control.c: * calendar/gui/print.c: * calendar/gui/tasks-control.c: * widgets/misc/test-dropdown-button.c: Remove unneeded #include . * calendar/gui/alarm-notify/alarm-queue.c: * calendar/gui/dialogs/cal-attachment-select-file.c: * calendar/gui/dialogs/cancel-comp.c: * calendar/gui/dialogs/changed-comp.c: * calendar/gui/dialogs/delete-error.c: * calendar/gui/dialogs/recur-comp.c: * calendar/gui/e-itip-control.c: * calendar/gui/print.c: Remove unneeded #include . svn path=/trunk/; revision=37035 --- calendar/gui/dialogs/cal-attachment-select-file.c | 1 - calendar/gui/dialogs/cancel-comp.c | 1 - calendar/gui/dialogs/changed-comp.c | 1 - calendar/gui/dialogs/delete-error.c | 1 - calendar/gui/dialogs/recur-comp.c | 1 - 5 files changed, 5 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/cal-attachment-select-file.c b/calendar/gui/dialogs/cal-attachment-select-file.c index 8d968a84a9..5de8ea669b 100644 --- a/calendar/gui/dialogs/cal-attachment-select-file.c +++ b/calendar/gui/dialogs/cal-attachment-select-file.c @@ -32,7 +32,6 @@ #include -#include #include #include "cal-attachment-select-file.h" diff --git a/calendar/gui/dialogs/cancel-comp.c b/calendar/gui/dialogs/cancel-comp.c index 547f70348e..2548d5ba2d 100644 --- a/calendar/gui/dialogs/cancel-comp.c +++ b/calendar/gui/dialogs/cancel-comp.c @@ -28,7 +28,6 @@ #include #include -#include #include "e-util/e-error.h" #include "cancel-comp.h" diff --git a/calendar/gui/dialogs/changed-comp.c b/calendar/gui/dialogs/changed-comp.c index ae215463be..9a0665d763 100644 --- a/calendar/gui/dialogs/changed-comp.c +++ b/calendar/gui/dialogs/changed-comp.c @@ -27,7 +27,6 @@ #endif #include -#include #include "changed-comp.h" diff --git a/calendar/gui/dialogs/delete-error.c b/calendar/gui/dialogs/delete-error.c index d42ef1af91..b151ef8068 100644 --- a/calendar/gui/dialogs/delete-error.c +++ b/calendar/gui/dialogs/delete-error.c @@ -28,7 +28,6 @@ #include #include -#include #include "delete-error.h" diff --git a/calendar/gui/dialogs/recur-comp.c b/calendar/gui/dialogs/recur-comp.c index e90cfd237f..e57c0c8aa7 100644 --- a/calendar/gui/dialogs/recur-comp.c +++ b/calendar/gui/dialogs/recur-comp.c @@ -27,7 +27,6 @@ #endif #include -#include #include "recur-comp.h" -- cgit v1.2.3 From 2b820fc4e2d6404ca281e279761cd5f877fdbf54 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 11 Jan 2009 13:55:04 +0000 Subject: New convenience function calls gtk_show_uri() and displays an error dialog 2009-01-11 Matthew Barnes * e-util/e-util.c (e_show_uri): New convenience function calls gtk_show_uri() and displays an error dialog if the URI cannot be shown. * addressbook/gui/widgets/eab-contact-display.c (eab_uri_popup_link_open), (on_link_clicked): * calendar/gui/e-cal-component-preview (on_link_clicked): * calendar/gui/e-cal-component-memo-preview (on_link_clicked): * calendar/gui/e-memo-table.c (open_url_cb): * calendar/gui/dialogs/comp-editor.c (open_attachment): * composer/e-msg-composer.c (msg_composer_link_clicked): * mail/em-folder-view.c (emfv_format_link_clicked): * mail/em-popup.c (emp_uri_popup_link_open): * plugins/mailing-list-actions/mailing-list-actions.c (emla_list_action_do): * shell/e-shell-window-commands.c (command_open_faq): * widgets/misc/e-attachment-bar.c (eab_icon_clicked_cb): * widgets/misc/e-url-entry.c (button_clicked_cb): Call e_show_uri() instead of gnome_url_show(). * e-util/e-error.c (ee_response): Call e_display_help() instead of gnome_url_show(). * mail/em-config.c: * mail/em-menu.c: Remove unneeded #include svn path=/trunk/; revision=37037 --- calendar/gui/dialogs/comp-editor.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index c7db81e8bb..c3e0e38fed 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -26,6 +26,7 @@ #include #endif +#include #include #include #include @@ -34,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -1975,7 +1975,6 @@ open_attachment (EAttachmentBar *bar, CompEditor *editor) GList *p; int num; char *attach_file_url; - GError *error = NULL; if (E_IS_ATTACHMENT_BAR (bar)) { icon_list = GNOME_ICON_LIST (bar); @@ -2000,11 +1999,7 @@ open_attachment (EAttachmentBar *bar, CompEditor *editor) attach_file_url = g_build_path ("/", local_store, filename, NULL); /* launch the url now */ - /* TODO should send GError and handle error conditions - * here */ - gnome_url_show (attach_file_url, &error); - if (error) - g_message ("DEBUG: gnome_url_show(%s) failed\n", attach_file_url); + e_show_uri (GTK_WINDOW (editor), attach_file_url); g_free (filename); g_free (attach_file_url); } -- cgit v1.2.3 From 1df00c7d517794881faefd45b3ae230a6b0d8204 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 12 Jan 2009 14:49:16 +0000 Subject: ** Fix for bug #563364 2009-01-12 Milan Crha ** Fix for bug #563364 * gui/e-day-view-time-item.h: (EDayViewTimeItem): * gui/e-day-view-time-item.c: (e_day_view_time_item_class_init), (e_day_view_time_item_init), (e_day_view_time_item_finalize), (e_day_view_time_item_get_column_width), (edvti_draw_zone), (e_day_view_time_item_draw), (edvti_second_zone_changed_cb), (edvti_on_select_zone), (edvti_on_set_zone), (e_day_view_time_item_show_popup_menu): Show two timezones in the day view's time column. * gui/apps_evolution_calendar.schemas.in: * gui/calendar-config-keys.h: * gui/calendar-config.h: * gui/calendar-config.c: (calendar_config_get_day_second_zones), (calendar_config_free_day_second_zones), (calendar_config_set_day_second_zone), (calendar_config_get_day_second_zone), (calendar_config_select_day_second_zone), (calendar_config_add_notification_day_second_zone): Access configuration for the second day time zone. * gui/dialogs/cal-prefs-dialog.glade: * gui/dialogs/cal-prefs-dialog.h: (struct _CalendarPrefsDialog): * gui/dialogs/cal-prefs-dialog.c: (update_day_second_zone_caption), (on_set_day_second_zone), (on_select_day_second_zone), (day_second_zone_clicked), (setup_changes), (show_config), (calendar_prefs_dialog_construct): Manage the second day zone in a Preferences dialog. svn path=/trunk/; revision=37060 --- calendar/gui/dialogs/cal-prefs-dialog.c | 100 +++++++++++++++ calendar/gui/dialogs/cal-prefs-dialog.glade | 188 ++++++++++++++++++++-------- calendar/gui/dialogs/cal-prefs-dialog.h | 1 + 3 files changed, 238 insertions(+), 51 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 8ba51259e5..38871c2f89 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -131,6 +131,101 @@ timezone_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) calendar_config_set_timezone (icaltimezone_get_location (zone)); } +static void +update_day_second_zone_caption (CalendarPrefsDialog *prefs) +{ + char *location; + const char *caption; + icaltimezone *zone; + + g_return_if_fail (prefs != NULL); + + caption = _("None"); + + location = calendar_config_get_day_second_zone (); + if (location && *location) { + zone = icaltimezone_get_builtin_timezone (location); + if (zone && icaltimezone_get_display_name (zone)) { + caption = icaltimezone_get_display_name (zone); + } + } + g_free (location); + + gtk_button_set_label (GTK_BUTTON (prefs->day_second_zone), caption); +} + +static void +on_set_day_second_zone (GtkWidget *item, CalendarPrefsDialog *prefs) +{ + if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item))) + return; + + calendar_config_set_day_second_zone (g_object_get_data (G_OBJECT (item), "timezone")); + update_day_second_zone_caption (prefs); +} + +static void +on_select_day_second_zone (GtkWidget *item, CalendarPrefsDialog *prefs) +{ + g_return_if_fail (prefs != NULL); + + calendar_config_select_day_second_zone (); + update_day_second_zone_caption (prefs); +} + +static void +day_second_zone_clicked (GtkWidget *widget, CalendarPrefsDialog *prefs) +{ + GtkWidget *menu, *item; + GSList *group = NULL, *recent_zones, *s; + char *location; + icaltimezone *zone, *second_zone = NULL; + + menu = gtk_menu_new (); + + location = calendar_config_get_day_second_zone (); + if (location && *location) + second_zone = icaltimezone_get_builtin_timezone (location); + g_free (location); + + group = NULL; + item = gtk_radio_menu_item_new_with_label (group, _("None")); + group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item)); + if (!second_zone) + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + g_signal_connect (item, "toggled", G_CALLBACK (on_set_day_second_zone), prefs); + + recent_zones = calendar_config_get_day_second_zones (); + for (s = recent_zones; s != NULL; s = s->next) { + zone = icaltimezone_get_builtin_timezone (s->data); + if (!zone) + continue; + + item = gtk_radio_menu_item_new_with_label (group, icaltimezone_get_display_name (zone)); + group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item)); + /* both comes from builtin, thus no problem to compare pointers */ + if (zone == second_zone) + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + g_object_set_data_full (G_OBJECT (item), "timezone", g_strdup (s->data), g_free); + g_signal_connect (item, "toggled", G_CALLBACK (on_set_day_second_zone), prefs); + } + calendar_config_free_day_second_zones (recent_zones); + + item = gtk_separator_menu_item_new (); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + + item = gtk_menu_item_new_with_label (_("Select...")); + g_signal_connect (item, "activate", G_CALLBACK (on_select_day_second_zone), prefs); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + + gtk_widget_show_all (menu); + + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, + 0, gtk_get_current_event_time ()); +} + static void daylight_saving_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) { @@ -373,6 +468,7 @@ setup_changes (CalendarPrefsDialog *prefs) g_signal_connect (G_OBJECT (prefs->working_days[i]), "toggled", G_CALLBACK (working_days_changed), prefs); g_signal_connect (G_OBJECT (prefs->timezone), "changed", G_CALLBACK (timezone_changed), prefs); + g_signal_connect (G_OBJECT (prefs->day_second_zone), "clicked", G_CALLBACK (day_second_zone_clicked), prefs); g_signal_connect (G_OBJECT (prefs->daylight_saving), "toggled", G_CALLBACK (daylight_saving_changed), prefs); g_signal_connect (G_OBJECT (prefs->start_of_day), "changed", G_CALLBACK (start_of_day_changed), prefs); @@ -513,6 +609,9 @@ show_config (CalendarPrefsDialog *prefs) set = calendar_config_get_daylight_saving (); gtk_toggle_button_set_active ((GtkToggleButton *) prefs->daylight_saving, set); + /* Day's second zone */ + update_day_second_zone_caption (prefs); + /* Working Days. */ working_days = calendar_config_get_working_days (); mask = 1 << 0; @@ -637,6 +736,7 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs) /* General tab */ prefs->timezone = glade_xml_get_widget (gui, "timezone"); + prefs->day_second_zone = glade_xml_get_widget (gui, "day_second_zone"); prefs->daylight_saving = glade_xml_get_widget (gui, "daylight_cb"); for (i = 0; i < 7; i++) prefs->working_days[i] = glade_xml_get_widget (gui, working_day_names[i]); diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade index d3003bdb6f..0282d17d4d 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ b/calendar/gui/dialogs/cal-prefs-dialog.glade @@ -6,7 +6,7 @@ True - window1 + window1 GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False @@ -96,46 +96,37 @@ True - 3 + 4 2 False 6 6 - + True - Time _zone: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - timezone - PANGO_ELLIPSIZE_NONE - -1 - False - 0 + make_timezone_entry + 0 + 0 + Thu, 13 Jan 2005 04:18:03 GMT + + + - 0 - 1 + 1 + 2 0 1 - fill - + fill - + True - Time format: - False + Time _zone: + True False GTK_JUSTIFY_LEFT False @@ -144,6 +135,7 @@ 0.5 0 0 + timezone PANGO_ELLIPSIZE_NONE -1 False @@ -152,30 +144,32 @@ 0 1 - 2 - 3 + 0 + 1 fill - + True - make_timezone_entry - 0 - 0 - Thu, 13 Jan 2005 04:18:03 GMT - - - + True + Adjust for daylight sa_ving time + True + GTK_RELIEF_NORMAL + True + False + False + True 1 2 - 0 - 1 - fill + 1 + 2 + fill + @@ -235,24 +229,116 @@ - + True - True - Adjust for daylight sa_ving time + Time format: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + Se_cond zone: True - GTK_RELIEF_NORMAL - True - False - False - True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + day_second_zone + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 3 + 4 + fill + + + + + + + True + False + 0 + + + + True + True + None + True + GTK_RELIEF_NORMAL + True + + + 0 + True + True + + + + + + True + (Shown in a Day View) + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 6 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + 1 2 - 1 - 2 + 3 + 4 fill - + fill @@ -348,7 +434,7 @@ 0.5 0 0 - week_start_day + week_start_day PANGO_ELLIPSIZE_NONE -1 False @@ -405,7 +491,7 @@ 0.5 0 0 - start_of_day + start_of_day PANGO_ELLIPSIZE_NONE -1 False diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 815080ea06..24682a6cc7 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -44,6 +44,7 @@ struct _CalendarPrefsDialog { /* General tab */ GtkWidget *timezone; + GtkWidget *day_second_zone; GtkWidget *daylight_saving; GtkWidget *working_days[7]; GtkWidget *week_start_day; -- cgit v1.2.3 From 158dea659db463a9bb7c4552e2f009b22b092e65 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 13 Jan 2009 12:24:47 +0000 Subject: ** Fix for bug #489437 2009-01-13 Milan Crha ** Fix for bug #489437 * gui/dialogs/recurrence-page.c: (fill_component): Check whether the 'until' date is in the future, and report error if not. svn path=/trunk/; revision=37066 --- calendar/gui/dialogs/recurrence-page.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 8a93c4dfee..15171d52ed 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -903,6 +903,37 @@ fill_component (RecurrencePage *rpage, ECalComponent *comp) e_cal_component_set_exdate_list (comp, list); e_cal_component_free_exdate_list (list); + if (GTK_WIDGET_VISIBLE (priv->ending_menu) && GTK_WIDGET_IS_SENSITIVE (priv->ending_menu) && + e_dialog_option_menu_get (priv->ending_menu, ending_types_map) == ENDING_UNTIL) { + /* check whether the "until" date is in the future */ + struct icaltimetype tt; + gboolean ok = TRUE; + + if (e_date_edit_get_date (E_DATE_EDIT (priv->ending_date_edit), &tt.year, &tt.month, &tt.day)) { + ECalComponentDateTime dtstart; + + /* the dtstart should be set already */ + e_cal_component_get_dtstart (comp, &dtstart); + + tt.is_date = 1; + tt.zone = NULL; + + if (dtstart.value && icaltime_is_valid_time (*dtstart.value)) { + ok = icaltime_compare_date_only (*dtstart.value, tt) <= 0; + + if (!ok) + e_date_edit_set_date (E_DATE_EDIT (priv->ending_date_edit), dtstart.value->year, dtstart.value->month, dtstart.value->day); + } + + e_cal_component_free_datetime (&dtstart); + } + + if (!ok) { + comp_editor_page_display_validation_error (COMP_EDITOR_PAGE (rpage), _("End time of the recurrence was before event's start"), priv->ending_date_edit); + return FALSE; + } + } + return TRUE; } -- cgit v1.2.3 From ae26a9a5fb34beb48e4161c8f145b0fb2d3cb3a9 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 19 Jan 2009 13:10:36 +0000 Subject: ** Fix for bug #200254 2009-01-19 Milan Crha ** Fix for bug #200254 * gui/apps_evolution_calendar.schemas.in: * gui/dialogs/cal-prefs-dialog.glade: * gui/dialogs/cal-prefs-dialog.h: (struct _CalendarPrefsDialog): * gui/dialogs/cal-prefs-dialog.c: (dview_show_week_no_toggled), (setup_changes), (show_config), (calendar_prefs_dialog_construct): * gui/calendar-config-keys.h: * gui/calendar-config.h: * gui/calendar-config.c: (calendar_config_get_dview_show_week_no), (calendar_config_set_dview_show_week_no), (calendar_config_add_notification_dview_show_week_no): New option whether to show week number in Day and Work Week view. * gui/e-day-view.h: (struct _EDayView), (e_day_view_get_show_week_number), (e_day_view_set_show_week_number): * gui/e-day-view.c: (dview_show_week_no_changed_cb), (e_day_view_init), (e_day_view_destroy), (e_day_view_recalc_day_starts), (e_day_view_get_show_week_number), (e_day_view_set_show_week_number): New widget showing week number of the first day in a view. svn path=/trunk/; revision=37096 --- calendar/gui/dialogs/cal-prefs-dialog.c | 11 +++++++++++ calendar/gui/dialogs/cal-prefs-dialog.glade | 18 ++++++++++++++++++ calendar/gui/dialogs/cal-prefs-dialog.h | 1 + 3 files changed, 30 insertions(+) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 38871c2f89..8cec102e4a 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -332,6 +332,12 @@ dnav_show_week_no_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) calendar_config_set_dnav_show_week_no (gtk_toggle_button_get_active (toggle)); } +static void +dview_show_week_no_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) +{ + calendar_config_set_dview_show_week_no (gtk_toggle_button_get_active (toggle)); +} + static void hide_completed_tasks_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) { @@ -483,6 +489,7 @@ setup_changes (CalendarPrefsDialog *prefs) g_signal_connect (G_OBJECT (prefs->show_end_times), "toggled", G_CALLBACK (show_end_times_toggled), prefs); g_signal_connect (G_OBJECT (prefs->compress_weekend), "toggled", G_CALLBACK (compress_weekend_toggled), prefs); g_signal_connect (G_OBJECT (prefs->dnav_show_week_no), "toggled", G_CALLBACK (dnav_show_week_no_toggled), prefs); + g_signal_connect (G_OBJECT (prefs->dview_show_week_no), "toggled", G_CALLBACK (dview_show_week_no_toggled), prefs); g_signal_connect (G_OBJECT (prefs->tasks_hide_completed), "toggled", G_CALLBACK (hide_completed_tasks_toggled), prefs); @@ -654,6 +661,9 @@ show_config (CalendarPrefsDialog *prefs) /* Date Navigator - Show Week Numbers. */ e_dialog_toggle_set (prefs->dnav_show_week_no, calendar_config_get_dnav_show_week_no ()); + /* Day/Work Week view - Show Week Number. */ + e_dialog_toggle_set (prefs->dview_show_week_no, calendar_config_get_dview_show_week_no ()); + /* Task list */ show_task_list_config (prefs); @@ -755,6 +765,7 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs) prefs->show_end_times = glade_xml_get_widget (gui, "show_end_times"); prefs->compress_weekend = glade_xml_get_widget (gui, "compress_weekend"); prefs->dnav_show_week_no = glade_xml_get_widget (gui, "dnav_show_week_no"); + prefs->dview_show_week_no = glade_xml_get_widget (gui, "dview_show_week_no"); prefs->tasks_due_today_color = glade_xml_get_widget (gui, "tasks_due_today_color"); prefs->tasks_overdue_color = glade_xml_get_widget (gui, "tasks_overdue_color"); prefs->tasks_hide_completed = glade_xml_get_widget (gui, "tasks_hide_completed"); diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade index 0282d17d4d..9f7f6a8092 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ b/calendar/gui/dialogs/cal-prefs-dialog.glade @@ -1176,6 +1176,24 @@ Days False + + + True + True + Show week n_umber in Day and Work Week View + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + 0 diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 24682a6cc7..512d5d06c6 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -62,6 +62,7 @@ struct _CalendarPrefsDialog { GtkWidget *show_end_times; GtkWidget *compress_weekend; GtkWidget *dnav_show_week_no; + GtkWidget *dview_show_week_no; GtkWidget *tasks_due_today_color; GtkWidget *tasks_overdue_color; GtkWidget *tasks_hide_completed; -- cgit v1.2.3 From 2be7cd3b2ab50047820da4a1e873785b53f41acd Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 19 Jan 2009 13:56:42 +0000 Subject: ** Fix for bug #225712 2009-01-19 Milan Crha ** Fix for bug #225712 * calendar/gui/dialogs/comp-editor.h: (CompEditorClass::send_comp), (comp_editor_send_comp): Changed function prototypes. * calendar/gui/dialogs/comp-editor.c: (real_send_comp), (save_comp_with_send), (comp_editor_send_comp): Strip alarms based on user's choice. * calendar/gui/dialogs/send-comp.h: (send_component_dialog): * calendar/gui/dialogs/send-comp.c: (have_nonprocedural_alarm), (send_component_dialog): Show option "Send my alarms with this event" when prompting to send event or not, but only if have any non-procedure alarms and if it the caller want to know user's opinion. Default is to strip all alarms. Procedure alarms are always strip out. * calendar/gui/dialogs/event-editor.c: (event_editor_send_comp): * calendar/gui/dialogs/task-editor.c: (task_editor_send_comp): Honor function prototype changes and use new parameter strip_alarms. * calendar/gui/itip-utils.h: (itip_send_comp): * calendar/gui/itip-utils.c: (comp_compliant), (itip_send_comp), (reply_to_calendar_comp): New parameter to strip all alarms or only procedure alarms. * calendar/gui/tasks-control.c: (tasks_control_forward_cmd): * calendar/gui/e-itip-control.c: (send_item), (send_freebusy), (ok_clicked_cb): * calendar/gui/e-calendar-table.c: (e_calendar_table_on_forward): * calendar/gui/e-memo-table.c: (e_memo_table_on_forward): * calendar/gui/e-calendar-view.c: (e_calendar_view_cut_clipboard), (delete_event), (e_calendar_view_delete_selected_occurrence), (on_forward): Always strip alarms when sending component. * calendar/gui/e-calendar-view.c: (e_calendar_view_add_event), (e_calendar_view_modify_and_send): * calendar/gui/e-cal-model-calendar.c: (ecmc_set_value_at): Strip alarms based on user's choice. * plugins/itip-formatter/itip-view.h: * plugins/itip-formatter/itip-view.c: (itip_view_set_show_keep_alarm_check), (itip_view_get_keep_alarm_check_state), (itip_view_set_show_inherit_alarm_check), (itip_view_get_inherit_alarm_check_state): New functions to new options to either inherit reminder from the incoming event or to preserve users reminders in already existing event in the calendar. * plugins/itip-formatter/itip-view.c: (struct _ItipViewPrivate), (alarm_check_toggled_cb), (itip_view_init): Properly initialize new option's members. * plugins/itip-formatter/itip-formatter.c: (find_cal_opened_cb), (update_item), (send_comp_to_attendee), (update_attendee_status), (send_item), (extract_itip_data), (view_response_cb), (format_itip_object): Setup new options based on the actual data. svn path=/trunk/; revision=37097 --- calendar/gui/dialogs/comp-editor.c | 23 +++++++------ calendar/gui/dialogs/comp-editor.h | 5 +-- calendar/gui/dialogs/event-editor.c | 8 ++--- calendar/gui/dialogs/send-comp.c | 68 ++++++++++++++++++++++++++++++++++--- calendar/gui/dialogs/send-comp.h | 2 +- calendar/gui/dialogs/task-editor.c | 8 ++--- 6 files changed, 87 insertions(+), 27 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index c3e0e38fed..4799895b84 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -172,7 +172,7 @@ static void comp_editor_show_help (CompEditor *editor); static void setup_widgets (CompEditor *editor); static void real_edit_comp (CompEditor *editor, ECalComponent *comp); -static gboolean real_send_comp (CompEditor *editor, ECalComponentItipMethod method); +static gboolean real_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean strip_alarms); static gboolean prompt_and_save_changes (CompEditor *editor, gboolean send); static void close_dialog (CompEditor *editor); @@ -888,6 +888,7 @@ save_comp_with_send (CompEditor *editor) CompEditorFlags flags; gboolean send; gboolean delegate; + gboolean strip_alarms = TRUE; priv = editor->priv; @@ -907,18 +908,18 @@ save_comp_with_send (CompEditor *editor) if (!save_comp (editor)) return FALSE; - if ((delegate && !e_cal_get_save_schedules (priv->client)) || (send && send_component_dialog ((GtkWindow *) editor, priv->client, priv->comp, !priv->existing_org))) { + if ((delegate && !e_cal_get_save_schedules (priv->client)) || (send && send_component_dialog ((GtkWindow *) editor, priv->client, priv->comp, !priv->existing_org, &strip_alarms))) { if ((itip_organizer_is_user (priv->comp, priv->client) || itip_sentby_is_user (priv->comp))) { if (e_cal_component_get_vtype (priv->comp) == E_CAL_COMPONENT_JOURNAL) - return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_PUBLISH); + return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_PUBLISH, strip_alarms); else - return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REQUEST); + return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REQUEST, strip_alarms); } else { - if (!comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REQUEST)) + if (!comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REQUEST, strip_alarms)) return FALSE; if (delegate) - return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REPLY); + return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REPLY, strip_alarms); } } @@ -3045,7 +3046,7 @@ get_users_from_memo_comp (ECalComponent *comp, GList **users) } static gboolean -real_send_comp (CompEditor *editor, ECalComponentItipMethod method) +real_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean strip_alarms) { CompEditorPrivate *priv; CompEditorFlags flags; @@ -3091,7 +3092,7 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method) if (!e_cal_component_has_attachments (priv->comp) || e_cal_get_static_capability (priv->client, CAL_STATIC_CAPABILITY_CREATE_MESSAGES)) { if (itip_send_comp (method, send_comp, priv->client, - NULL, NULL, users)) { + NULL, NULL, users, strip_alarms)) { g_object_unref (send_comp); return TRUE; } @@ -3112,7 +3113,7 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method) /* mime_attach_list is freed by itip_send_comp */ mime_attach_list = comp_editor_get_mime_attach_list (editor); if (itip_send_comp (method, send_comp, priv->client, - NULL, mime_attach_list, users)) { + NULL, mime_attach_list, users, strip_alarms)) { save_comp (editor); g_object_unref (send_comp); return TRUE; @@ -3234,7 +3235,7 @@ comp_editor_delete_comp (CompEditor *editor) * **/ gboolean -comp_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method) +comp_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean strip_alarms) { CompEditorClass *class; @@ -3243,7 +3244,7 @@ comp_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method) class = COMP_EDITOR_GET_CLASS (editor); if (class->send_comp) - return class->send_comp (editor, method); + return class->send_comp (editor, method, strip_alarms); return FALSE; } diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 9289b9ced7..ab277febf7 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -67,7 +67,7 @@ struct _CompEditorClass { /* Virtual functions */ void (*edit_comp) (CompEditor *page, ECalComponent *comp); void (*object_created) (CompEditor *page); - gboolean (*send_comp) (CompEditor *page, ECalComponentItipMethod method); + gboolean (*send_comp) (CompEditor *page, ECalComponentItipMethod method, gboolean strip_alarms); void (*show_categories) (CompEditor *editor, gboolean visible); void (*show_role) (CompEditor *editor, gboolean visible); @@ -129,7 +129,8 @@ 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); + ECalComponentItipMethod method, + gboolean strip_alarms); GSList * comp_editor_get_mime_attach_list(CompEditor *editor); gboolean comp_editor_close (CompEditor *editor); diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 161ed598b7..e3d3448f6c 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -99,7 +99,7 @@ static const gchar *ui = ""; static void event_editor_edit_comp (CompEditor *editor, ECalComponent *comp); -static gboolean event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method); +static gboolean event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean strip_alarms); G_DEFINE_TYPE (EventEditor, event_editor, TYPE_COMP_EDITOR) @@ -620,7 +620,7 @@ event_editor_edit_comp (CompEditor *editor, ECalComponent *comp) } static gboolean -event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method) +event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean strip_alarms) { EventEditorPrivate *priv; ECalComponent *comp = NULL; @@ -639,7 +639,7 @@ event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method) client = e_meeting_store_get_e_cal (priv->model); result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, - client, NULL, NULL, NULL); + client, NULL, NULL, NULL, strip_alarms); g_object_unref (comp); return result; @@ -647,7 +647,7 @@ event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method) parent: if (COMP_EDITOR_CLASS (event_editor_parent_class)->send_comp) - return COMP_EDITOR_CLASS (event_editor_parent_class)->send_comp (editor, method); + return COMP_EDITOR_CLASS (event_editor_parent_class)->send_comp (editor, method, strip_alarms); return FALSE; } diff --git a/calendar/gui/dialogs/send-comp.c b/calendar/gui/dialogs/send-comp.c index 11d6e74757..a7d87c47f4 100644 --- a/calendar/gui/dialogs/send-comp.c +++ b/calendar/gui/dialogs/send-comp.c @@ -26,11 +26,44 @@ #include #endif +#include #include "e-util/e-error.h" #include "send-comp.h" +static gboolean +have_nonprocedural_alarm (ECalComponent *comp) +{ + GList *uids, *l; + + g_return_val_if_fail (comp != NULL, FALSE); + + uids = e_cal_component_get_alarm_uids (comp); + + for (l = uids; l; l = l->next) { + ECalComponentAlarm *alarm; + ECalComponentAlarmAction action = E_CAL_COMPONENT_ALARM_UNKNOWN; + + alarm = e_cal_component_get_alarm (comp, (const char *)l->data); + if (alarm) { + e_cal_component_alarm_get_action (alarm, &action); + e_cal_component_alarm_free (alarm); + + if (action != E_CAL_COMPONENT_ALARM_NONE && + action != E_CAL_COMPONENT_ALARM_PROCEDURE && + action != E_CAL_COMPONENT_ALARM_UNKNOWN) { + cal_obj_uid_list_free (uids); + return TRUE; + } + } + } + + cal_obj_uid_list_free (uids); + + return FALSE; +} + /** * send_component_dialog: * @@ -40,11 +73,14 @@ * Return value: TRUE if the user clicked Yes, FALSE otherwise. **/ gboolean -send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean new) +send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean new, gboolean *strip_alarms) { ECalComponentVType vtype; const char *id; + if (strip_alarms) + *strip_alarms = TRUE; + if (e_cal_get_save_schedules (client)) return FALSE; @@ -72,10 +108,32 @@ send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gbo return FALSE; } - if (e_error_run (parent, id, NULL) == GTK_RESPONSE_YES) - return TRUE; - else - return FALSE; + if (strip_alarms && have_nonprocedural_alarm (comp)) { + GtkWidget *dialog, *checkbox, *align; + gboolean res; + + dialog = e_error_new (parent, id, NULL); + checkbox = gtk_check_button_new_with_label (_("Send my alarms with this event")); + align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); + gtk_container_add (GTK_CONTAINER (align), checkbox); + gtk_widget_show (checkbox); + gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->vbox), align, TRUE, TRUE, 6); + gtk_widget_show (align); + + res = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES; + + if (res) + *strip_alarms = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)); + + gtk_widget_destroy (GTK_WIDGET (dialog)); + + return res; + } else { + if (e_error_run (parent, id, NULL) == GTK_RESPONSE_YES) + return TRUE; + else + return FALSE; + } } gboolean diff --git a/calendar/gui/dialogs/send-comp.h b/calendar/gui/dialogs/send-comp.h index 4a1a6c55ab..21b310947a 100644 --- a/calendar/gui/dialogs/send-comp.h +++ b/calendar/gui/dialogs/send-comp.h @@ -28,7 +28,7 @@ #include #include -gboolean send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean new); +gboolean send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean new, gboolean *strip_alarms); gboolean send_component_prompt_subject (GtkWindow *parent, ECal *client, ECalComponent *comp); #endif diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index ca6959640b..4b8f8698b9 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -88,7 +88,7 @@ static const gchar *ui = ""; static void task_editor_edit_comp (CompEditor *editor, ECalComponent *comp); -static gboolean task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method); +static gboolean task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean strip_alarms); G_DEFINE_TYPE (TaskEditor, task_editor, TYPE_COMP_EDITOR) @@ -446,7 +446,7 @@ task_editor_edit_comp (CompEditor *editor, ECalComponent *comp) } static gboolean -task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method) +task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean strip_alarms) { TaskEditorPrivate *priv; ECalComponent *comp = NULL; @@ -465,7 +465,7 @@ task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method) client = e_meeting_store_get_e_cal (priv->model); result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, - client, NULL, NULL, NULL); + client, NULL, NULL, NULL, strip_alarms); g_object_unref (comp); if (!result) @@ -474,7 +474,7 @@ task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method) parent: if (COMP_EDITOR_CLASS (task_editor_parent_class)->send_comp) - return COMP_EDITOR_CLASS (task_editor_parent_class)->send_comp (editor, method); + return COMP_EDITOR_CLASS (task_editor_parent_class)->send_comp (editor, method, strip_alarms); return FALSE; } -- cgit v1.2.3 From d63754acb1a37037ce09251c00fefa5e689f780b Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 19 Jan 2009 14:14:56 +0000 Subject: ** Part of fix for bug #260853 2009-01-19 Milan Crha ** Part of fix for bug #260853 * gui/calendar-config-keys.h: * gui/calendar-config.h: (calendar_config_get_ba_reminder), (calendar_config_set_ba_reminder): * gui/calendar-config.c: (calendar_config_get_ba_reminder), (calendar_config_set_ba_reminder), (string_to_units), (calendar_config_get_default_reminder_units): * gui/dialogs/cal-prefs-dialog.glade: * gui/dialogs/cal-prefs-dialog.h: (struct _CalendarPrefsDialog): * gui/dialogs/cal-prefs-dialog.c: (ba_reminder_toggled), (ba_reminder_interval_changed), (ba_reminder_units_changed), (setup_changes), (show_config), (calendar_prefs_dialog_construct): User interface and related function to allow use change setup of the alarm for Birthdays and Anniversaries calendar. svn path=/trunk/; revision=37098 --- calendar/gui/dialogs/cal-prefs-dialog.c | 46 +++++++++++++++ calendar/gui/dialogs/cal-prefs-dialog.glade | 92 +++++++++++++++++++++++++++++ calendar/gui/dialogs/cal-prefs-dialog.h | 3 + 3 files changed, 141 insertions(+) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 8cec102e4a..21ace5aea4 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -49,6 +49,7 @@ static const int hide_completed_units_map[] = { CAL_MINUTES, CAL_HOURS, CAL_DAYS, -1 }; +/* same is used for Birthdays & Anniversaries calendar */ static const int default_reminder_units_map[] = { CAL_MINUTES, CAL_HOURS, CAL_DAYS, -1 }; @@ -413,6 +414,34 @@ default_reminder_units_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) e_dialog_combo_box_get (prefs->default_reminder_units, default_reminder_units_map)); } +static void +ba_reminder_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) +{ + gboolean enabled = gtk_toggle_button_get_active (toggle); + + calendar_config_set_ba_reminder (&enabled, NULL, NULL); +} + +static void +ba_reminder_interval_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) +{ + const gchar *str; + int value; + + str = gtk_entry_get_text (GTK_ENTRY (widget)); + value = (int) g_ascii_strtod (str, NULL); + + calendar_config_set_ba_reminder (NULL, &value, NULL); +} + +static void +ba_reminder_units_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) +{ + CalUnits units = e_dialog_combo_box_get (prefs->ba_reminder_units, default_reminder_units_map); + + calendar_config_set_ba_reminder (NULL, NULL, &units); +} + static void alarms_selection_changed (ESourceSelector *selector, CalendarPrefsDialog *prefs) { @@ -507,6 +536,11 @@ setup_changes (CalendarPrefsDialog *prefs) G_CALLBACK (default_reminder_interval_changed), prefs); g_signal_connect (G_OBJECT (prefs->default_reminder_units), "changed", G_CALLBACK (default_reminder_units_changed), prefs); + g_signal_connect (G_OBJECT (prefs->ba_reminder), "toggled", G_CALLBACK (ba_reminder_toggled), prefs); + g_signal_connect (G_OBJECT (prefs->ba_reminder_interval), "changed", + G_CALLBACK (ba_reminder_interval_changed), prefs); + g_signal_connect (G_OBJECT (prefs->ba_reminder_units), "changed", G_CALLBACK (ba_reminder_units_changed), prefs); + g_signal_connect (G_OBJECT (prefs->alarm_list_widget), "selection_changed", G_CALLBACK (alarms_selection_changed), prefs); @@ -600,6 +634,8 @@ show_config (CalendarPrefsDialog *prefs) gboolean sensitive, set = FALSE; icalcomponent *icalcomp, *dl_comp; char *location; + CalUnits units; + int interval; /* Timezone. */ location = calendar_config_get_timezone (); @@ -678,6 +714,13 @@ show_config (CalendarPrefsDialog *prefs) e_dialog_toggle_set (prefs->default_reminder, calendar_config_get_use_default_reminder ()); e_dialog_spin_set (prefs->default_reminder_interval, calendar_config_get_default_reminder_interval ()); e_dialog_combo_box_set (prefs->default_reminder_units, calendar_config_get_default_reminder_units (), default_reminder_units_map); + + /* Birthdays & Anniversaries reminder */ + set = calendar_config_get_ba_reminder (&interval, &units); + + e_dialog_toggle_set (prefs->ba_reminder, set); + e_dialog_spin_set (prefs->ba_reminder_interval, interval); + e_dialog_combo_box_set (prefs->ba_reminder_units, units, default_reminder_units_map); } /* plugin meta-data */ @@ -759,6 +802,9 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs) prefs->default_reminder = glade_xml_get_widget (gui, "default_reminder"); prefs->default_reminder_interval = glade_xml_get_widget (gui, "default_reminder_interval"); prefs->default_reminder_units = glade_xml_get_widget (gui, "default_reminder_units"); + prefs->ba_reminder = glade_xml_get_widget (gui, "ba_reminder"); + prefs->ba_reminder_interval = glade_xml_get_widget (gui, "ba_reminder_interval"); + prefs->ba_reminder_units = glade_xml_get_widget (gui, "ba_reminder_units"); /* Display tab */ prefs->time_divisions = glade_xml_get_widget (gui, "time_divisions"); diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade index 9f7f6a8092..b8947b4c44 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ b/calendar/gui/dialogs/cal-prefs-dialog.glade @@ -950,6 +950,98 @@ Days True + + + + True + False + 4 + + + + True + True + Show a _reminder + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + 1 + 0 + False + GTK_UPDATE_ALWAYS + False + False + 0 0 9999 1 10 10 + + + 0 + True + True + + + + + + True + Minutes +Hours +Days + False + True + + + 0 + True + True + + + + + + True + before every anniversary/birthday + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + 0 + True + True + + 0 diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 512d5d06c6..3c006b8711 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -56,6 +56,9 @@ struct _CalendarPrefsDialog { GtkWidget *default_reminder; GtkWidget *default_reminder_interval; GtkWidget *default_reminder_units; + GtkWidget *ba_reminder; + GtkWidget *ba_reminder_interval; + GtkWidget *ba_reminder_units; /* Display tab */ GtkWidget *time_divisions; -- cgit v1.2.3 From 1e637bac617f25bc77e9d1128b3c7d6e7afaca67 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 20 Jan 2009 18:07:51 +0000 Subject: ** Fix for bug #568331 2009-01-20 Milan Crha ** Fix for bug #568331 * gui/dialogs/comp-editor.c: (classification_changed_cb), (comp_editor_init): Notify changes of the classification. * gui/dialogs/comp-editor.c: (fill_widgets): Block classification change signal when filling widgets with values from a component. svn path=/trunk/; revision=37108 --- calendar/gui/dialogs/comp-editor.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 4799895b84..dcdff0947e 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1765,6 +1765,14 @@ comp_editor_class_init (CompEditorClass *class) G_TYPE_NONE, 0); } +static void +classification_changed_cb (GtkRadioAction *action, GtkRadioAction *current, CompEditor *editor) +{ + g_return_if_fail (IS_COMP_EDITOR (editor)); + + comp_editor_set_changed (editor, TRUE); +} + static void comp_editor_init (CompEditor *editor) { @@ -1814,7 +1822,7 @@ comp_editor_init (CompEditor *editor) action_group, classification_radio_entries, G_N_ELEMENTS (classification_radio_entries), E_CAL_COMPONENT_CLASS_PUBLIC, - NULL, NULL); /* no callback */ + G_CALLBACK (classification_changed_cb), editor); action = e_attachment_bar_recent_action_new ( E_ATTACHMENT_BAR (priv->attachment_bar), "attach-recent", _("Recent _Documents")); @@ -2939,6 +2947,7 @@ fill_widgets (CompEditor *editor) { CompEditorPrivate *priv; GList *l; + GtkAction *action; priv = editor->priv; @@ -2953,8 +2962,13 @@ fill_widgets (CompEditor *editor) g_slist_free (attachment_list); } + action = comp_editor_get_action (editor, "classify-public"); + g_signal_handlers_block_by_func (action, G_CALLBACK (classification_changed_cb), editor); + for (l = priv->pages; l != NULL; l = l->next) comp_editor_page_fill_widgets (l->data, priv->comp); + + g_signal_handlers_unblock_by_func (action, G_CALLBACK (classification_changed_cb), editor); } static void -- cgit v1.2.3 From 708696127f3702bdf1bdb424dce490d679420842 Mon Sep 17 00:00:00 2001 From: Suman Manjunath Date: Wed, 21 Jan 2009 06:42:45 +0000 Subject: ** Fix for bug #541209 2009-01-21 Suman Manjunath ** Fix for bug #541209 ** Adapt to the new APIs from upstream libical. Changes made include using the "_r" counterpart for the following APIs: + icalproperty_as_ical_string () + icalvalue_as_ical_string () + icalcomponent_as_ical_string () + icalparameter_as_ical_string () + icaldurationtype_as_ical_string () + icalenum_reqstat_code () + icallangbind_property_eval_string () + icallangbind_quote_as_ical () + icalmime_text_end_part () + icalperiodtype_as_ical_string () + icalproperty_enum_to_string () + icalproperty_get_parameter_as_string () + icalproperty_get_value_as_string () + icalproperty_get_property_name () + icalrecurrencetype_as_string () + icaltime_as_ical_string () + icalreqstattype_as_string () + icalvalue_binary_as_ical_string () + icalvalue_int_as_ical_string () + icalvalue_utcoffset_as_ical_string () + icalvalue_string_as_ical_string () + icalvalue_recur_as_ical_string () + icalvalue_text_as_ical_string () + icalvalue_attach_as_ical_string () + icalvalue_duration_as_ical_string () + icalvalue_date_as_ical_string () + icalvalue_datetime_as_ical_string () + icalvalue_float_as_ical_string () + icalvalue_geo_as_ical_string () + icalvalue_datetimeperiod_as_ical_string () + icalvalue_period_as_ical_string () + icalvalue_trigger_as_ical_string () + icalvalue_as_ical_string () svn path=/trunk/; revision=37113 --- calendar/gui/dialogs/e-send-options-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/e-send-options-utils.c b/calendar/gui/dialogs/e-send-options-utils.c index fde53ca336..52f73aed02 100644 --- a/calendar/gui/dialogs/e-send-options-utils.c +++ b/calendar/gui/dialogs/e-send-options-utils.c @@ -192,7 +192,7 @@ e_sendoptions_utils_fill_component (ESendOptionsDialog *sod, ECalComponent *comp icaltimezone *zone = calendar_config_get_icaltimezone (); temp = icaltime_from_timet_with_zone (gopts->delay_until, FALSE, zone); - str = icaltime_as_ical_string (temp); + str = icaltime_as_ical_string_r (temp); prop = icalproperty_new_x (str); g_free (str); icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-DELAY"); -- cgit v1.2.3 From a8abd0060bdec73f774c665dd0488623dd4932ba Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 23 Jan 2009 11:41:55 +0000 Subject: ** Fix for bug #442869 2009-01-23 Milan Crha ** Fix for bug #442869 * gui/dialogs/task-page.c: (attendee_added_cb): * gui/dialogs/event-page.c: (attendee_added_cb): Do not work with NULL delegator and do not set 'delfrom' with two MAILTO. * gui/e-meeting-list-view.c: (name_selector_dialog_close_cb): Delete attendee only if we have enough rights for it. svn path=/trunk/; revision=37123 --- calendar/gui/dialogs/event-page.c | 41 ++++++++++++++++++++------------------- calendar/gui/dialogs/task-page.c | 5 ++++- 2 files changed, 25 insertions(+), 21 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index ca42dd92fb..ffbd37d850 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -1825,27 +1825,28 @@ attendee_added_cb (EMeetingListView *emlv, client = comp_editor_get_client (editor); flags = comp_editor_get_flags (editor); - 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 (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))); - - e_meeting_attendee_set_delfrom (ia, g_strdup_printf ("MAILTO:%s", delegator_id)); - gtk_widget_set_sensitive (priv->invite, FALSE); - gtk_widget_set_sensitive (priv->add, FALSE); - gtk_widget_set_sensitive (priv->edit, FALSE); - } - } -} + 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); + + g_return_if_fail (delegator != NULL); + + e_meeting_attendee_set_delto (delegator, g_strdup (e_meeting_attendee_get_address (ia))); + + e_meeting_attendee_set_delfrom (ia, g_strdup (delegator_id)); + 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*/ diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 7f2969abd2..c00a42f4bc 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -1160,8 +1160,11 @@ attendee_added_cb (EMeetingListView *emlv, EMeetingAttendee *delegator; delegator = e_meeting_store_find_attendee (priv->model, delegator_id, NULL); + + g_return_if_fail (delegator != NULL); + e_meeting_attendee_set_delto (delegator, - g_strdup (e_meeting_attendee_get_address (ia))); + g_strdup (e_meeting_attendee_get_address (ia))); gtk_widget_set_sensitive (priv->invite, FALSE); gtk_widget_set_sensitive (priv->add, FALSE); -- cgit v1.2.3 From dfdaafa8816cf75e3a9a482c1bcbf4b54c331935 Mon Sep 17 00:00:00 2001 From: Suman Manjunath Date: Fri, 30 Jan 2009 09:38:57 +0000 Subject: Fix for bug #450554 (bugzilla.novell.com) - Remove all attendees from the list-view and name-selector before populating it on 'event_changed' callback. svn path=/trunk/; revision=37191 --- calendar/gui/dialogs/event-editor.c | 2 ++ calendar/gui/dialogs/event-page.c | 20 ++++++++++++++++++++ calendar/gui/dialogs/event-page.h | 1 + 3 files changed, 23 insertions(+) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index e3d3448f6c..a297765fa6 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -565,6 +565,8 @@ event_editor_edit_comp (CompEditor *editor, ECalComponent *comp) } if (!(delegate && e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY))) { + event_page_remove_all_attendees (priv->event_page); + for (l = attendees; l != NULL; l = l->next) { ECalComponentAttendee *ca = l->data; EMeetingAttendee *ia; diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index ffbd37d850..d0e6cad470 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -3273,3 +3273,23 @@ event_page_add_attendee (EventPage *epage, EMeetingAttendee *attendee) e_meeting_store_add_attendee (priv->model, attendee); e_meeting_list_view_add_attendee_to_name_selector (E_MEETING_LIST_VIEW (priv->list_view), attendee); } + +/** + * event_page_remove_all_attendees + * Removes all attendees from the meeting store and name selector. + * @param epage EventPage. + **/ +void +event_page_remove_all_attendees (EventPage *epage) +{ + EventPagePrivate *priv; + + g_return_if_fail (epage != NULL); + g_return_if_fail (IS_EVENT_PAGE (epage)); + + priv = epage->priv; + + e_meeting_store_remove_all_attendees (priv->model); + e_meeting_list_view_remove_all_attendees_from_name_selector (E_MEETING_LIST_VIEW (priv->list_view)); +} + diff --git a/calendar/gui/dialogs/event-page.h b/calendar/gui/dialogs/event-page.h index 7c868f1d3d..63c0bd2306 100644 --- a/calendar/gui/dialogs/event-page.h +++ b/calendar/gui/dialogs/event-page.h @@ -108,6 +108,7 @@ void event_page_set_view_rvsp (EventPage *epage, ENameSelector * event_page_get_name_selector (EventPage *epage); void event_page_add_attendee (EventPage *epage, EMeetingAttendee *attendee); +void event_page_remove_all_attendees (EventPage *epage); G_END_DECLS -- cgit v1.2.3 From 38c8ce1aac739a3e74448ff5ed7fa2e003a9cc28 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 2 Feb 2009 03:39:24 +0000 Subject: Fix compiler warnings. svn path=/trunk/; revision=37206 --- calendar/gui/dialogs/event-page.c | 4 ++-- calendar/gui/dialogs/task-details-page.c | 2 +- calendar/gui/dialogs/task-page.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index d0e6cad470..4ea1bbde7b 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -1490,14 +1490,14 @@ event_page_fill_timezones (CompEditorPage *page, GHashTable *timezones) zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone)); if (zone) { if (!g_hash_table_lookup (timezones, icaltimezone_get_tzid (zone))) - g_hash_table_insert (timezones, icaltimezone_get_tzid (zone), zone); + g_hash_table_insert (timezones, (gpointer) icaltimezone_get_tzid (zone), zone); } /* add end date timezone */ zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone)); if (zone) { if (!g_hash_table_lookup (timezones, icaltimezone_get_tzid (zone))) - g_hash_table_insert (timezones, icaltimezone_get_tzid (zone), zone); + g_hash_table_insert (timezones, (gpointer) icaltimezone_get_tzid (zone), zone); } return TRUE; diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index af137761d5..a2be1381a6 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -430,7 +430,7 @@ task_details_page_fill_timezones (CompEditorPage *page, GHashTable *timezones) zone = icaltimezone_get_utc_timezone (); if (zone) { if (!g_hash_table_lookup (timezones, icaltimezone_get_tzid (zone))) - g_hash_table_insert (timezones, icaltimezone_get_tzid (zone), zone); + g_hash_table_insert (timezones, (gpointer) icaltimezone_get_tzid (zone), zone); } return TRUE; diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index c00a42f4bc..091a7b50d2 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -1353,7 +1353,7 @@ task_page_fill_timezones (CompEditorPage *page, GHashTable *timezones) zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->timezone)); if (zone) { if (!g_hash_table_lookup (timezones, icaltimezone_get_tzid (zone))) - g_hash_table_insert (timezones, icaltimezone_get_tzid (zone), zone); + g_hash_table_insert (timezones, (gpointer) icaltimezone_get_tzid (zone), zone); } return TRUE; -- cgit v1.2.3 From 669813dadf0c79a0248085097bfcdcc142978ff6 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 9 Feb 2009 11:53:12 +0000 Subject: Do not use non-zero page size in an adjustment, it's deprecated now. 2009-02-09 Milan Crha * gui/dialogs/cal-prefs-dialog.glade: Do not use non-zero page size in an adjustment, it's deprecated now. svn path=/trunk/; revision=37237 --- calendar/gui/dialogs/cal-prefs-dialog.glade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade index b8947b4c44..f3509e4f8f 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ b/calendar/gui/dialogs/cal-prefs-dialog.glade @@ -986,7 +986,7 @@ Days GTK_UPDATE_ALWAYS False False - 0 0 9999 1 10 10 + 0 0 9999 1 10 0 0 -- cgit v1.2.3 From 9cc64a2009458355ed1e404ca4e15ede10acd920 Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Wed, 11 Feb 2009 16:06:24 +0000 Subject: Substitute some deprecated gtk+ functions. 2009-02-11 Andre Klapper * addressbook/gui/component/addressbook-migrate.c: * calendar/gui/migration.c: * calendar/gui/dialogs/alarm-dialog.c: * mail/em-folder-browser.c: * mail/em-migrate.c: * plugins/audio-inline/audio-inline.c: Substitute some deprecated gtk+ functions. svn path=/trunk/; revision=37249 --- calendar/gui/dialogs/alarm-dialog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c index bf78f70011..2f1393d70f 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -863,7 +863,7 @@ setup_select_names (Dialog *dialog) dialog->malarm_addresses = GTK_WIDGET (e_name_selector_peek_section_entry (dialog->name_selector, section_name)); gtk_widget_show (dialog->malarm_addresses); - gtk_box_pack_end_defaults (GTK_BOX (dialog->malarm_address_group), dialog->malarm_addresses); + gtk_box_pack_end (GTK_BOX (dialog->malarm_address_group), dialog->malarm_addresses, TRUE, TRUE, 0); g_signal_connect (G_OBJECT (dialog->malarm_addressbook), "clicked", G_CALLBACK (addressbook_clicked_cb), dialog); -- cgit v1.2.3 From bd8d2c529fe15e979dd2d33be2fa36c2358f0a96 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 4 Mar 2009 15:41:36 +0000 Subject: ** Fix for bug #573122 2009-03-04 Milan Crha ** Fix for bug #573122 * gui/dialogs/cal-prefs-dialog.c: (timezone_changed), (show_config): * gui/calendar-config.c: (calendar_config_get_icaltimezone): * gui/e-cal-model.c: (ecm_value_at): Do not pass NULL to icalcomponent_get_first_component. svn path=/trunk/; revision=37366 --- calendar/gui/dialogs/cal-prefs-dialog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 21ace5aea4..81e182ac54 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -124,7 +124,7 @@ timezone_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (prefs->timezone)); icalcomp = icaltimezone_get_component (zone); - if (!(dl_comp = icalcomponent_get_first_component (icalcomp, ICAL_XDAYLIGHT_COMPONENT))) + if (!icalcomp || !(dl_comp = icalcomponent_get_first_component (icalcomp, ICAL_XDAYLIGHT_COMPONENT))) gtk_widget_set_sensitive ((GtkWidget *) prefs->daylight_saving, FALSE); else gtk_widget_set_sensitive ((GtkWidget *) prefs->daylight_saving, TRUE); @@ -644,7 +644,7 @@ show_config (CalendarPrefsDialog *prefs) g_free (location); icalcomp = icaltimezone_get_component (zone); - if (!(dl_comp = icalcomponent_get_first_component (icalcomp, ICAL_XDAYLIGHT_COMPONENT))) + if (!icalcomp || !(dl_comp = icalcomponent_get_first_component (icalcomp, ICAL_XDAYLIGHT_COMPONENT))) gtk_widget_set_sensitive ((GtkWidget *) prefs->daylight_saving, FALSE); else gtk_widget_set_sensitive ((GtkWidget *) prefs->daylight_saving, TRUE); -- cgit v1.2.3 From 1353535f0bc0420886825fc8a4ae33b5235f1486 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 4 Mar 2009 16:03:06 +0000 Subject: ** Fix for bug #573119 2009-03-04 Milan Crha ** Fix for bug #573119 * gui/dialogs/comp-editor.c: (set_attendees_for_delegation): * gui/e-cal-popup.c: (is_delegated), (needs_to_accept): Do not ask value of not included (NULL) parameters. svn path=/trunk/; revision=37368 --- calendar/gui/dialogs/comp-editor.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index dcdff0947e..61331e97f7 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -3015,10 +3015,11 @@ set_attendees_for_delegation (ECalComponent *comp, const char *address, ECalComp prop; prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) { const char *attendee = icalproperty_get_attendee (prop); - const char *delfrom; + const char *delfrom = NULL; param = icalproperty_get_first_parameter(prop, ICAL_DELEGATEDFROM_PARAMETER); - delfrom = icalparameter_get_delegatedfrom (param); + if (param) + delfrom = icalparameter_get_delegatedfrom (param); if (!(g_str_equal (itip_strip_mailto (attendee), address) || ((delfrom && *delfrom) && g_str_equal (itip_strip_mailto (delfrom), address)))) { -- cgit v1.2.3 From f04e4e06d22dc1ab0dd25501d9199d7e5014dbf9 Mon Sep 17 00:00:00 2001 From: Chenthill Palanisamy Date: Thu, 5 Mar 2009 10:29:43 +0000 Subject: Fixes #435455 (bnc) svn path=/trunk/; revision=37375 --- calendar/gui/dialogs/comp-editor.c | 8 ++++---- calendar/gui/dialogs/event-editor.c | 2 +- calendar/gui/dialogs/event-page.c | 2 +- calendar/gui/dialogs/memo-page.c | 2 +- calendar/gui/dialogs/task-page.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 61331e97f7..93ae0c6549 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -774,7 +774,7 @@ save_comp (CompEditor *editor) } /* If we are not the organizer, we don't update the sequence number */ - if (!e_cal_component_has_organizer (clone) || itip_organizer_is_user (clone, priv->client) || itip_sentby_is_user (clone)) + if (!e_cal_component_has_organizer (clone) || itip_organizer_is_user (clone, priv->client) || itip_sentby_is_user (clone, priv->client)) e_cal_component_commit_sequence (clone); else e_cal_component_abort_sequence (clone); @@ -809,7 +809,7 @@ save_comp (CompEditor *editor) if (result && priv->mod == CALOBJ_MOD_THIS) { /* FIXME do we really need to do this ? */ - if ((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, priv->client)) e_cal_component_commit_sequence (clone); else e_cal_component_abort_sequence (clone); @@ -909,7 +909,7 @@ save_comp_with_send (CompEditor *editor) return FALSE; if ((delegate && !e_cal_get_save_schedules (priv->client)) || (send && send_component_dialog ((GtkWindow *) editor, priv->client, priv->comp, !priv->existing_org, &strip_alarms))) { - if ((itip_organizer_is_user (priv->comp, priv->client) || itip_sentby_is_user (priv->comp))) { + if ((itip_organizer_is_user (priv->comp, priv->client) || itip_sentby_is_user (priv->comp, priv->client))) { if (e_cal_component_get_vtype (priv->comp) == E_CAL_COMPONENT_JOURNAL) return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_PUBLISH, strip_alarms); else @@ -2989,7 +2989,7 @@ real_edit_comp (CompEditor *editor, ECalComponent *comp) priv->comp = e_cal_component_clone (comp); priv->existing_org = e_cal_component_has_organizer (comp); - priv->user_org = (itip_organizer_is_user (comp, priv->client) || itip_sentby_is_user (comp)); + priv->user_org = (itip_organizer_is_user (comp, priv->client) || itip_sentby_is_user (comp, priv->client)); priv->warned = FALSE; update_window_border (editor, NULL); diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index a297765fa6..b95493b7f7 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -616,7 +616,7 @@ event_editor_edit_comp (CompEditor *editor, ECalComponent *comp) } e_cal_component_free_attendee_list (attendees); - comp_editor_set_needs_send (editor, 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, client))); priv->updating = FALSE; } diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 4ea1bbde7b..03447bf3a2 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -962,7 +962,7 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) gchar *string; GList *list = NULL; - if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp)) { + if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp, client)) { if (e_cal_get_static_capability ( client, CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS)) diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index 362a8b0e9a..9277a3c111 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -262,7 +262,7 @@ memo_page_fill_widgets (CompEditorPage *page, else string = g_strdup (strip); - if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp)) { + if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp, client)) { gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->org_combo)->entry), string); } else { list = g_list_append (list, string); diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 091a7b50d2..d9078c61b7 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -616,7 +616,7 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) gchar *string; GList *list = NULL; - if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp)) { + if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp, client)) { if (e_cal_get_static_capability ( client, CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS)) -- cgit v1.2.3 From 3ac551e993179c2e0af41cbfde49cd118c9a11a5 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 6 Mar 2009 10:50:49 +0000 Subject: ** Fix for bug #401346 2009-03-06 Milan Crha ** Fix for bug #401346 * gui/e-meeting-time-sel.c: (e_meeting_time_selector_destroy): Do not remove notification twice. * gui/dialogs/event-editor.c: (create_schedule_page), (action_free_busy_cb): Do not show Free/Busy dialog modal. svn path=/trunk/; revision=37376 --- calendar/gui/dialogs/event-editor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index b95493b7f7..a579d77348 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -113,7 +113,7 @@ create_schedule_page (CompEditor *editor) priv = EVENT_EDITOR_GET_PRIVATE (editor); priv->sched_window = gtk_dialog_new_with_buttons ( - _("Free/Busy"), GTK_WINDOW (editor), GTK_DIALOG_MODAL, + _("Free/Busy"), GTK_WINDOW (editor), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); g_signal_connect ( @@ -168,7 +168,7 @@ action_free_busy_cb (GtkAction *action, if (editor->priv->sched_window == NULL) create_schedule_page (COMP_EDITOR (editor)); else - gtk_widget_show (editor->priv->sched_window); + gtk_window_present (GTK_WINDOW (editor->priv->sched_window)); } static void -- cgit v1.2.3 From 075eec29600290b43cd8a37710888a9aa5c2ae0b Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 2 Apr 2009 14:32:12 +0000 Subject: ** Fix for bug #577717 2009-04-02 Milan Crha ** Fix for bug #577717 * gui/dialogs/alarm-dialog.c: (alarm_to_dialog), (malarm_widgets_to_alarm): Fill some default values to mandatory properties of ECalComponentAttendee. svn path=/trunk/; revision=37489 --- calendar/gui/dialogs/alarm-dialog.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c index 2f1393d70f..984c1b756f 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -220,6 +220,9 @@ alarm_to_dialog (Dialog *dialog) a = g_new0 (ECalComponentAttendee, 1); a->value = email; + a->cutype = ICAL_CUTYPE_INDIVIDUAL; + a->status = ICAL_PARTSTAT_NEEDSACTION; + a->role = ICAL_ROLE_REQPARTICIPANT; attendee_list.data = a; attendee_list.next = NULL; e_cal_component_alarm_set_attendee_list (dialog->alarm, &attendee_list); @@ -429,6 +432,9 @@ malarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm) a = g_new0 (ECalComponentAttendee, 1); a->value = e_destination_get_email (dest); a->cn = e_destination_get_name (dest); + a->cutype = ICAL_CUTYPE_INDIVIDUAL; + a->status = ICAL_PARTSTAT_NEEDSACTION; + a->role = ICAL_ROLE_REQPARTICIPANT; attendee_list = g_slist_append (attendee_list, a); } -- cgit v1.2.3 From 9896e4f7db7817087b7c18793682a4ab5f7c63e2 Mon Sep 17 00:00:00 2001 From: Chenthill Palanisamy Date: Mon, 13 Apr 2009 09:03:38 +0000 Subject: Fixes #561312 2009-04-13 Chenthill Palanisamy Fixes #561312 * calendar/gui/comp-util.c: * calendar/gui/comp-util.h: Added a new function to sanitize master recurrence event before modifying all instances. * calendar/gui/dialogs/comp-editor.c: * calendar/gui/e-day-view.c: * calendar/gui/e-week-view.c: Used the new util api. Do not invoke recurrence dialog while modifying detached instances. svn path=/trunk/; revision=37518 --- calendar/gui/dialogs/comp-editor.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 93ae0c6549..7a083a37a1 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -799,6 +799,11 @@ save_comp (CompEditor *editor) if (result) g_signal_emit_by_name (editor, "object_created"); } else { + + if (e_cal_component_has_recurrences (priv->comp) && priv->mod == CALOBJ_MOD_ALL) + comp_util_sanitize_recurrence_master (priv->comp, priv->client); + + if (priv->mod == CALOBJ_MOD_THIS) { e_cal_component_set_rdate_list (priv->comp, NULL); e_cal_component_set_rrule_list (priv->comp, NULL); @@ -1159,11 +1164,15 @@ action_save_cb (GtkAction *action, } commit_all_fields (editor); - if (e_cal_component_is_instance (priv->comp)) + if (e_cal_component_has_recurrences (priv->comp)) { if (!recur_component_dialog (priv->client, priv->comp, &priv->mod, GTK_WINDOW (editor), delegated)) return; + } else if (e_cal_component_is_instance (priv->comp)) + priv->mod = CALOBJ_MOD_THIS; + comp = comp_editor_get_current_comp (editor, &correct); + e_cal_component_get_summary (comp, &text); g_object_unref (comp); -- cgit v1.2.3 From 8a072ffc7c0ddcde472877a51ace0bb14f86fb0a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 24 Apr 2009 11:45:21 +0200 Subject: GN-bug #572348 - Removed deprecated Gtk+ symbols Some still left, because those gone in kill-bonobo branch. --- calendar/gui/dialogs/Makefile.am | 1 - calendar/gui/dialogs/alarm-dialog.c | 151 ++++++---- calendar/gui/dialogs/alarm-dialog.glade | 182 ++---------- calendar/gui/dialogs/event-page.c | 141 +++++----- calendar/gui/dialogs/event-page.glade | 108 ++----- calendar/gui/dialogs/meeting-page.glade | 407 --------------------------- calendar/gui/dialogs/memo-page.c | 32 ++- calendar/gui/dialogs/memo-page.glade | 60 ++-- calendar/gui/dialogs/recurrence-page.c | 326 ++++++++++----------- calendar/gui/dialogs/recurrence-page.glade | 141 ++++------ calendar/gui/dialogs/task-details-page.c | 44 +-- calendar/gui/dialogs/task-details-page.glade | 190 ++++++------- calendar/gui/dialogs/task-page.c | 36 ++- calendar/gui/dialogs/task-page.glade | 33 +-- 14 files changed, 581 insertions(+), 1271 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am index 6dd8a4cd77..c6d61101a8 100644 --- a/calendar/gui/dialogs/Makefile.am +++ b/calendar/gui/dialogs/Makefile.am @@ -89,7 +89,6 @@ glade_DATA = \ cal-prefs-dialog.glade \ e-delegate-dialog.glade \ event-page.glade \ - meeting-page.glade \ memo-page.glade \ recurrence-page.glade \ schedule-page.glade \ diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c index 984c1b756f..3881c85106 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -60,18 +60,18 @@ typedef struct { /* Toplevel */ GtkWidget *toplevel; - GtkWidget *action; + GtkWidget *action_combo; GtkWidget *interval_value; - GtkWidget *value_units; - GtkWidget *relative; - GtkWidget *time; + GtkWidget *value_units_combo; + GtkWidget *relative_combo; + GtkWidget *time_combo; /* Alarm repeat widgets */ GtkWidget *repeat_toggle; GtkWidget *repeat_group; GtkWidget *repeat_quantity; GtkWidget *repeat_value; - GtkWidget *repeat_unit; + GtkWidget *repeat_unit_combo; GtkWidget *option_notebook; @@ -118,7 +118,7 @@ enum { DAYS }; -/* Option menu maps */ +/* Combo box maps */ static const int action_map[] = { E_CAL_COMPONENT_ALARM_DISPLAY, E_CAL_COMPONENT_ALARM_AUDIO, @@ -167,18 +167,18 @@ static const int duration_units_map[] = { }; static void populate_widgets_from_alarm (Dialog *dialog); -static void action_selection_done_cb (GtkMenuShell *menu_shell, gpointer data); +static void action_changed_cb (GtkWidget *action_combo, gpointer data); /* Fills the widgets with default values */ static void clear_widgets (Dialog *dialog) { /* Sane defaults */ - e_dialog_option_menu_set (dialog->action, E_CAL_COMPONENT_ALARM_DISPLAY, action_map); + e_dialog_combo_box_set (dialog->action_combo, E_CAL_COMPONENT_ALARM_DISPLAY, action_map); e_dialog_spin_set (dialog->interval_value, 15); - e_dialog_option_menu_set (dialog->value_units, MINUTES, value_map); - e_dialog_option_menu_set (dialog->relative, BEFORE, relative_map); - e_dialog_option_menu_set (dialog->time, E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START, time_map); + e_dialog_combo_box_set (dialog->value_units_combo, MINUTES, value_map); + e_dialog_combo_box_set (dialog->relative_combo, BEFORE, relative_map); + e_dialog_combo_box_set (dialog->time_combo, E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START, time_map); gtk_widget_set_sensitive (dialog->repeat_group, FALSE); gtk_widget_set_sensitive (dialog->dalarm_group, FALSE); @@ -192,8 +192,9 @@ clear_widgets (Dialog *dialog) static void alarm_to_dialog (Dialog *dialog) { - GtkWidget *menu; - GList *l; + GtkTreeModel *model; + GtkTreeIter iter; + gboolean valid; gboolean repeat; ECalComponentAlarmAction action; char *email; @@ -203,12 +204,15 @@ alarm_to_dialog (Dialog *dialog) clear_widgets (dialog); /* Alarm types */ - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (dialog->action)); - for (i = 0, l = GTK_MENU_SHELL (menu)->children; action_map[i] != -1; i++, l = l->next) { - if (e_cal_get_static_capability (dialog->ecal, action_map_cap[i])) - gtk_widget_set_sensitive (l->data, FALSE); - else - gtk_widget_set_sensitive (l->data, TRUE); + model = gtk_combo_box_get_model (GTK_COMBO_BOX (dialog->action_combo)); + valid = gtk_tree_model_get_iter_first (model, &iter); + for (i = 0; valid && action_map[i] != -1; i++) { + gtk_list_store_set ( + GTK_LIST_STORE (model), &iter, + 1, !e_cal_get_static_capability (dialog->ecal, action_map_cap[i]), + -1); + + valid = gtk_tree_model_iter_next (model, &iter); } /* Set a default address if possible */ @@ -255,17 +259,17 @@ alarm_to_repeat_widgets (Dialog *dialog, ECalComponentAlarm *alarm) return; if ( repeat.duration.minutes ) { - e_dialog_option_menu_set (dialog->repeat_unit, DUR_MINUTES, duration_units_map); + e_dialog_combo_box_set (dialog->repeat_unit_combo, DUR_MINUTES, duration_units_map); e_dialog_spin_set (dialog->repeat_value, repeat.duration.minutes); } if ( repeat.duration.hours ) { - e_dialog_option_menu_set (dialog->repeat_unit, DUR_HOURS, duration_units_map); + e_dialog_combo_box_set (dialog->repeat_unit_combo, DUR_HOURS, duration_units_map); e_dialog_spin_set (dialog->repeat_value, repeat.duration.hours); } if ( repeat.duration.days ) { - e_dialog_option_menu_set (dialog->repeat_unit, DUR_DAYS, duration_units_map); + e_dialog_combo_box_set (dialog->repeat_unit_combo, DUR_DAYS, duration_units_map); e_dialog_spin_set (dialog->repeat_value, repeat.duration.days); } } @@ -285,7 +289,7 @@ repeat_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm) repeat.repetitions = e_dialog_spin_get_int (dialog->repeat_quantity); memset (&repeat.duration, 0, sizeof (repeat.duration)); - switch (e_dialog_option_menu_get (dialog->repeat_unit, duration_units_map)) { + switch (e_dialog_combo_box_get (dialog->repeat_unit_combo, duration_units_map)) { case DUR_MINUTES: repeat.duration.minutes = e_dialog_spin_get_int (dialog->repeat_value); break; @@ -609,11 +613,11 @@ populate_widgets_from_alarm (Dialog *dialog) /* Alarm Types */ switch ( trigger->type ) { case E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START: - e_dialog_option_menu_set (dialog->time, E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START, time_map); + e_dialog_combo_box_set (dialog->time_combo, E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START, time_map); break; case E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_END: - e_dialog_option_menu_set (dialog->time, E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_END, time_map); + e_dialog_combo_box_set (dialog->time_combo, E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_END, time_map); break; default: g_warning ("%s: Unexpected alarm type (%d)", G_STRLOC, trigger->type); @@ -621,25 +625,25 @@ populate_widgets_from_alarm (Dialog *dialog) switch ( trigger->u.rel_duration.is_neg ){ case 1: - e_dialog_option_menu_set (dialog->relative, BEFORE, relative_map); + e_dialog_combo_box_set (dialog->relative_combo, BEFORE, relative_map); break; case 0: - e_dialog_option_menu_set (dialog->relative, AFTER, relative_map); + e_dialog_combo_box_set (dialog->relative_combo, AFTER, relative_map); break; } if ( trigger->u.rel_duration.days ) { - e_dialog_option_menu_set (dialog->value_units, DAYS, value_map); + e_dialog_combo_box_set (dialog->value_units_combo, DAYS, value_map); e_dialog_spin_set (dialog->interval_value, trigger->u.rel_duration.days); } else if ( trigger->u.rel_duration.hours ) { - e_dialog_option_menu_set (dialog->value_units, HOURS, value_map); + e_dialog_combo_box_set (dialog->value_units_combo, HOURS, value_map); e_dialog_spin_set (dialog->interval_value, trigger->u.rel_duration.hours); } else if ( trigger->u.rel_duration.minutes ) { - e_dialog_option_menu_set (dialog->value_units, MINUTES, value_map); + e_dialog_combo_box_set (dialog->value_units_combo, MINUTES, value_map); e_dialog_spin_set (dialog->interval_value, trigger->u.rel_duration.minutes); } else { - e_dialog_option_menu_set (dialog->value_units, MINUTES, value_map); + e_dialog_combo_box_set (dialog->value_units_combo, MINUTES, value_map); e_dialog_spin_set (dialog->interval_value, 0); } @@ -647,8 +651,8 @@ populate_widgets_from_alarm (Dialog *dialog) alarm_to_repeat_widgets (dialog, dialog->alarm); /* Alarm options */ - e_dialog_option_menu_set (dialog->action, *action, action_map); - action_selection_done_cb (GTK_MENU_SHELL (gtk_option_menu_get_menu (GTK_OPTION_MENU (dialog->action))), dialog); + e_dialog_combo_box_set (dialog->action_combo, *action, action_map); + action_changed_cb (dialog->action_combo, dialog); switch (*action) { case E_CAL_COMPONENT_ALARM_AUDIO: @@ -680,13 +684,13 @@ dialog_to_alarm (Dialog *dialog) /* Fill out the alarm */ memset (&trigger, 0, sizeof (ECalComponentAlarmTrigger)); - trigger.type = e_dialog_option_menu_get (dialog->time, time_map); - if (e_dialog_option_menu_get (dialog->relative, relative_map) == BEFORE) + trigger.type = e_dialog_combo_box_get (dialog->time_combo, time_map); + if (e_dialog_combo_box_get (dialog->relative_combo, relative_map) == BEFORE) trigger.u.rel_duration.is_neg = 1; else trigger.u.rel_duration.is_neg = 0; - switch (e_dialog_option_menu_get (dialog->value_units, value_map)) { + switch (e_dialog_combo_box_get (dialog->value_units_combo, value_map)) { case MINUTES: trigger.u.rel_duration.minutes = e_dialog_spin_get_int (dialog->interval_value); @@ -707,7 +711,7 @@ dialog_to_alarm (Dialog *dialog) } e_cal_component_alarm_set_trigger (dialog->alarm, trigger); - action = e_dialog_option_menu_get (dialog->action, action_map); + action = e_dialog_combo_box_get (dialog->action_combo, action_map); e_cal_component_alarm_set_action (dialog->alarm, action); /* Repeat stuff */ @@ -753,17 +757,17 @@ get_widgets (Dialog *dialog) if (!dialog->toplevel) return FALSE; - dialog->action = GW ("action"); + dialog->action_combo = GW ("action-combobox"); dialog->interval_value = GW ("interval-value"); - dialog->value_units = GW ("value-units"); - dialog->relative = GW ("relative"); - dialog->time = GW ("time"); + dialog->value_units_combo = GW ("value-units-combobox"); + dialog->relative_combo = GW ("relative-combobox"); + dialog->time_combo = GW ("time-combobox"); dialog->repeat_toggle = GW ("repeat-toggle"); dialog->repeat_group = GW ("repeat-group"); dialog->repeat_quantity = GW ("repeat-quantity"); dialog->repeat_value = GW ("repeat-value"); - dialog->repeat_unit = GW ("repeat-unit"); + dialog->repeat_unit_combo = GW ("repeat-unit-combobox"); dialog->option_notebook = GW ("option-notebook"); @@ -787,16 +791,57 @@ get_widgets (Dialog *dialog) #undef GW - return (dialog->action + if (dialog->action_combo) { + const char *actions[] = { + N_("Pop up an alert"), + N_("Play a sound"), + N_("Run a program"), + N_("Send an email") + }; + + GtkComboBox *combo = (GtkComboBox*)dialog->action_combo; + GtkCellRenderer *cell; + GtkListStore *store; + gint i; + + g_return_val_if_fail (combo != NULL, FALSE); + g_return_val_if_fail (GTK_IS_COMBO_BOX (combo), FALSE); + + store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_BOOLEAN); + gtk_combo_box_set_model (combo, GTK_TREE_MODEL (store)); + g_object_unref (store); + + gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo)); + + cell = gtk_cell_renderer_text_new (); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE); + gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell, + "text", 0, + "sensitive", 1, + NULL); + + for (i = 0; i < G_N_ELEMENTS (actions); i++) { + GtkTreeIter iter; + + gtk_list_store_append (store, &iter); + gtk_list_store_set ( + store, &iter, + 0, _(actions[i]), + 1, TRUE, + -1); + } + } + + return (dialog->action_combo && dialog->interval_value - && dialog->value_units - && dialog->relative - && dialog->time + && dialog->value_units_combo + && dialog->relative_combo + && dialog->time_combo && dialog->repeat_toggle && dialog->repeat_group && dialog->repeat_quantity && dialog->repeat_value - && dialog->repeat_unit + && dialog->repeat_unit_combo && dialog->option_notebook && dialog->dalarm_group && dialog->dalarm_message @@ -823,7 +868,7 @@ show_options (Dialog *dialog) char *email; e_cal_component_alarm_set_action (dialog->alarm, - e_dialog_option_menu_get (dialog->action, action_map)); + e_dialog_combo_box_get (dialog->action_combo, action_map)); repeat = !e_cal_get_static_capability (dialog->ecal, CAL_STATIC_CAPABILITY_NO_ALARM_REPEAT); @@ -1052,14 +1097,14 @@ malarm_description_changed_cb (GtkWidget *widget, gpointer data) } static void -action_selection_done_cb (GtkMenuShell *menu_shell, gpointer data) +action_changed_cb (GtkWidget *action_combo, gpointer data) { Dialog *dialog = data; char *dir; ECalComponentAlarmAction action; int page = 0, i; - action = e_dialog_option_menu_get (dialog->action, action_map); + action = e_dialog_combo_box_get (dialog->action_combo, action_map); for (i = 0; action_map[i] != -1 ; i++) { if (action == action_map[i]) { page = i; @@ -1102,12 +1147,10 @@ action_selection_done_cb (GtkMenuShell *menu_shell, gpointer data) static void init_widgets (Dialog *dialog) { - GtkWidget *menu; GtkTextBuffer *text_buffer; - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (dialog->action)); - g_signal_connect (menu, "selection_done", - G_CALLBACK (action_selection_done_cb), + g_signal_connect (dialog->action_combo, "changed", + G_CALLBACK (action_changed_cb), dialog); g_signal_connect (G_OBJECT (dialog->repeat_toggle), "toggled", diff --git a/calendar/gui/dialogs/alarm-dialog.glade b/calendar/gui/dialogs/alarm-dialog.glade index 5a5d4ef291..91b23c5e6d 100644 --- a/calendar/gui/dialogs/alarm-dialog.glade +++ b/calendar/gui/dialogs/alarm-dialog.glade @@ -137,48 +137,10 @@ 6 - + True - True - 0 - - - - True - - - - True - Pop up an alert - True - - - - - - True - Play a sound - True - - - - - - True - Run a program - True - - - - - - True - Send an email - True - - - - + False + True 0 @@ -207,40 +169,13 @@ - + True - True - 0 - - - - True - - - - True - minute(s) - True - - - - - - True - hour(s) - True - - - - - - True - day(s) - True - - - - + minute(s) +hour(s) +day(s) + False + True 0 @@ -250,32 +185,12 @@ - + True - True - 0 - - - - True - - - - True - before - True - - - - - - True - after - True - - - - + before +after + False + True 0 @@ -285,32 +200,12 @@ - + True - True - 0 - - - - True - - - - True - start of appointment - True - - - - - - True - end of appointment - True - - - - + start of appointment +end of appointment + False + True 0 @@ -485,40 +380,13 @@ - + True - True - 0 - - - - True - - - - True - minutes - True - - - - - - True - hours - True - - - - - - True - days - True - - - - + minutes +hours +days + False + True 0 diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 03447bf3a2..2644afb05b 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -98,7 +98,7 @@ struct _EventPagePrivate { GtkWidget *start_time; GtkWidget *end_time; - GtkWidget *end_time_selector; + GtkWidget *end_time_combo; GtkWidget *time_hour; GtkWidget *hour_selector; GtkWidget *minute_selector; @@ -115,7 +115,7 @@ struct _EventPagePrivate { gboolean show_time_as_busy; GtkWidget *alarm_dialog; - GtkWidget *alarm_time; + GtkWidget *alarm_time_combo; GtkWidget *alarm_warning; GtkWidget *alarm_box; @@ -174,7 +174,7 @@ static void set_attendees (ECalComponent *comp, const GPtrArray *attendees); static void hour_sel_changed ( GtkSpinButton *widget, EventPage *epage); static void minute_sel_changed ( GtkSpinButton *widget, EventPage *epage); static void hour_minute_changed ( EventPage *epage); -static void update_end_time_selector( EventPage *epage); +static void update_end_time_combo ( EventPage *epage); static void event_page_select_organizer (EventPage *epage, const char *backend_address); static void set_subscriber_info_string (EventPage *epage, const char *backend_address); @@ -354,8 +354,8 @@ set_all_day (EventPage *epage, gboolean all_day) /* TODO implement for in end time selector */ if (all_day) - gtk_option_menu_set_history (GTK_OPTION_MENU (priv->end_time_selector), 1); - gtk_widget_set_sensitive (priv->end_time_selector, !all_day); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->end_time_combo), 1); + gtk_widget_set_sensitive (priv->end_time_combo, !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); @@ -450,7 +450,7 @@ update_time (EventPage *epage, ECalComponentDateTime *start_date, ECalComponentD priv->sync_timezones = TRUE; - update_end_time_selector (epage); + update_end_time_combo (epage); } /* Fills the widgets with default values */ @@ -488,7 +488,7 @@ clear_widgets (EventPage *epage) set_busy_time_menu (epage, TRUE); /* Alarm */ - e_dialog_option_menu_set (priv->alarm_time, ALARM_NONE, alarm_map); + e_dialog_combo_box_set (priv->alarm_time_combo, ALARM_NONE, alarm_map); /* Categories */ e_dialog_editable_set (priv->categories, NULL); @@ -728,9 +728,9 @@ sensitize_widgets (EventPage *epage) sensitize = !read_only && sens; - alarm = e_dialog_option_menu_get (priv->alarm_time, alarm_map) != ALARM_NONE; + alarm = e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map) != ALARM_NONE; custom = is_custom_alarm_store (priv->alarm_list_store, priv->old_summary, priv->alarm_units, priv->alarm_interval, NULL) || - e_dialog_option_menu_get (priv->alarm_time, alarm_map) == ALARM_CUSTOM ? TRUE:FALSE; + e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map) == ALARM_CUSTOM ? TRUE:FALSE; if (alarm && !priv->alarm_icon) { priv->alarm_icon = create_image_event_box ("stock_bell", _("This event has alarms")); @@ -740,7 +740,7 @@ sensitize_widgets (EventPage *epage) /* 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->organizer)->entry), FALSE); + gtk_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (priv->organizer))), FALSE); gtk_editable_set_editable (GTK_EDITABLE (priv->summary), !read_only); gtk_editable_set_editable (GTK_EDITABLE (priv->location), sensitize); @@ -750,16 +750,16 @@ sensitize_widgets (EventPage *epage) gtk_widget_set_sensitive (priv->end_time, sensitize); gtk_widget_set_sensitive (priv->end_timezone, sensitize); gtk_text_view_set_editable (GTK_TEXT_VIEW (priv->description), !read_only); - gtk_widget_set_sensitive (priv->alarm_time, !read_only); + gtk_widget_set_sensitive (priv->alarm_time_combo, !read_only); gtk_widget_set_sensitive (priv->categories_btn, !read_only); /*TODO implement the for portion of the end time selector */ if (flags & COMP_EDITOR_NEW_ITEM) { if (priv->all_day_event) - gtk_option_menu_set_history (GTK_OPTION_MENU (priv->end_time_selector), 1); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->end_time_combo), 1); else - gtk_option_menu_set_history (GTK_OPTION_MENU (priv->end_time_selector), 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->end_time_combo), 0); } else - gtk_option_menu_set_history (GTK_OPTION_MENU (priv->end_time_selector), 1); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->end_time_combo), 1); gtk_widget_set_sensitive (priv->hour_selector, sensitize); gtk_widget_set_sensitive (priv->minute_selector, sensitize); @@ -856,7 +856,7 @@ get_current_account (EventPage *epage) priv = epage->priv; - str = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (priv->organizer)->entry)); + str = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->organizer)))); if (!str) return NULL; @@ -960,7 +960,6 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) if (organizer.value != NULL) { const gchar *strip = itip_strip_mailto (organizer.value); gchar *string; - GList *list = NULL; if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp, client)) { if (e_cal_get_static_capability ( @@ -986,13 +985,15 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) string = g_strdup (strip); if (!priv->user_org) { - list = g_list_append (list, string); - gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), list); - gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (priv->organizer)->entry), FALSE); + gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->organizer)))); + gtk_combo_box_append_text (GTK_COMBO_BOX (priv->organizer), string); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->organizer), 0); + gtk_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (priv->organizer))), FALSE); + } else { + gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->organizer))), string); } g_free (string); - g_list_free (list); priv->existing = TRUE; } } else { @@ -1039,7 +1040,7 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) e_cal_component_free_datetime (&start_date); e_cal_component_free_datetime (&end_date); - update_end_time_selector (epage); + update_end_time_combo (epage); /* Classification */ e_cal_component_get_classification (comp, &cl); comp_editor_set_classification (editor, cl); @@ -1064,7 +1065,7 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) enable_busy_time_menu (epage, TRUE); /* Alarms */ - g_signal_handlers_block_matched (priv->alarm_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); + g_signal_handlers_block_matched (priv->alarm_time_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); g_signal_handlers_block_matched (priv->alarm_list_store, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); if (e_cal_component_has_alarms (comp)) { @@ -1073,9 +1074,9 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) alarms = e_cal_component_get_alarm_uids (comp); if (!is_custom_alarm_uid_list (comp, alarms, priv->old_summary, priv->alarm_units, priv->alarm_interval, &alarm_type)) - e_dialog_option_menu_set (priv->alarm_time, alarm_type, alarm_map); + e_dialog_combo_box_set (priv->alarm_time_combo, alarm_type, alarm_map); else - e_dialog_option_menu_set (priv->alarm_time, ALARM_CUSTOM, alarm_map); + e_dialog_combo_box_set (priv->alarm_time_combo, ALARM_CUSTOM, alarm_map); for (list = alarms; list != NULL; list = list->next) { ECalComponentAlarm *ca; @@ -1087,9 +1088,9 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) cal_obj_uid_list_free (alarms); } else { - e_dialog_option_menu_set (priv->alarm_time, ALARM_NONE, alarm_map); + e_dialog_combo_box_set (priv->alarm_time_combo, ALARM_NONE, alarm_map); } - g_signal_handlers_unblock_matched (priv->alarm_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); + g_signal_handlers_unblock_matched (priv->alarm_time_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); g_signal_handlers_unblock_matched (priv->alarm_list_store, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); /* Categories */ @@ -1281,8 +1282,8 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) /* Alarm */ e_cal_component_remove_all_alarms (comp); - if (e_dialog_option_menu_get (priv->alarm_time, alarm_map) != ALARM_NONE) { - if (e_dialog_option_menu_get (priv->alarm_time, alarm_map) == ALARM_CUSTOM) { + if (e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map) != ALARM_NONE) { + if (e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map) == ALARM_CUSTOM) { GtkTreeModel *model; GtkTreeIter iter; gboolean valid_iter; @@ -1349,7 +1350,7 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) trigger.type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START; trigger.u.rel_duration.is_neg = 1; - alarm_type = e_dialog_option_menu_get (priv->alarm_time, alarm_map); + alarm_type = e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map); switch (alarm_type) { case ALARM_15_MINUTES: trigger.u.rel_duration.minutes = 15; @@ -1512,10 +1513,10 @@ event_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates) static void -time_sel_changed (GtkOptionMenu *widget, EventPage *epage) +time_sel_changed (GtkComboBox *combo, EventPage *epage) { EventPagePrivate *priv; - int selection = gtk_option_menu_get_history (widget); + int selection = gtk_combo_box_get_active (combo); priv = epage->priv; @@ -1528,12 +1529,12 @@ time_sel_changed (GtkOptionMenu *widget, EventPage *epage) gtk_widget_show (priv->time_hour); gtk_widget_hide (priv->end_time); - update_end_time_selector ( epage); + update_end_time_combo ( epage); } } static -void update_end_time_selector (EventPage *epage) +void update_end_time_combo (EventPage *epage) { EventPagePrivate *priv; struct icaltimetype start_tt = icaltime_null_time(); @@ -2024,11 +2025,11 @@ event_page_set_all_day_event (EventPage *epage, gboolean all_day) g_return_if_fail (date_set); /* TODO implement the for portion in end time selector */ - gtk_widget_set_sensitive (priv->end_time_selector, !all_day); + gtk_widget_set_sensitive (priv->end_time_combo, !all_day); if (all_day) - gtk_option_menu_set_history (GTK_OPTION_MENU (priv->end_time_selector), 1); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->end_time_combo), 1); else - gtk_option_menu_set_history (GTK_OPTION_MENU (priv->end_time_selector), 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->end_time_combo), 0); action = comp_editor_get_action (editor, "view-time-zone"); gtk_action_set_sensitive (action, !all_day); @@ -2181,7 +2182,7 @@ get_widgets (EventPage *epage) page->accel_group = g_object_ref (accel_groups->data); priv->alarm_dialog = GW ("alarm-dialog"); priv->alarm_box = GW ("custom_box"); - priv->alarm_time = GW ("alarm-time"); + priv->alarm_time_combo = GW ("alarm-time-combobox"); priv->timezone_label = GW ("timezone-label"); priv->start_timezone = GW ("start-timezone"); @@ -2204,7 +2205,10 @@ get_widgets (EventPage *epage) priv->categories = GW ("categories"); priv->categories_btn = GW ("categories-button"); + priv->organizer = GW ("organizer"); + gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->organizer)))); + priv->summary = GW ("summary"); priv->summary_label = GW ("summary-label"); priv->location = GW ("location"); @@ -2241,7 +2245,7 @@ get_widgets (EventPage *epage) priv->time_hour = GW ("time-hour"); priv->hour_selector = GW ("hour_selector"); priv->minute_selector = GW ("minute_selector"); - priv->end_time_selector = GW ("end-time-selector"); + priv->end_time_combo = GW ("end-time-combobox"); priv->end_time = GW ("end-time"); gtk_widget_show_all (priv->time_hour); @@ -2656,7 +2660,7 @@ alarm_changed_cb (GtkWidget *widget, gpointer data) epage = EVENT_PAGE (data); priv = epage->priv; - if (e_dialog_option_menu_get (priv->alarm_time, alarm_map) != ALARM_NONE) { + if (e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map) != ALARM_NONE) { ECalComponentAlarm *ca; ECalComponentAlarmTrigger trigger; icalcomponent *icalcomp; @@ -2671,7 +2675,7 @@ alarm_changed_cb (GtkWidget *widget, gpointer data) trigger.type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START; trigger.u.rel_duration.is_neg = 1; - alarm_type = e_dialog_option_menu_get (priv->alarm_time, alarm_map); + alarm_type = e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map); switch (alarm_type) { case ALARM_15_MINUTES: e_alarm_list_clear (priv->alarm_list_store); @@ -2795,9 +2799,8 @@ init_widgets (EventPage *epage) CompEditor *editor; GtkTextBuffer *text_buffer; icaltimezone *zone; - char *menu_label = NULL; + char *combo_label = NULL; GtkTreeSelection *selection; - GtkWidget *cus_item, *menu; ECal *client; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage)); @@ -2903,11 +2906,11 @@ init_widgets (EventPage *epage) } /* End time selector */ - gtk_option_menu_set_history (GTK_OPTION_MENU (priv->end_time_selector), 1); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->end_time_combo), 1); gtk_widget_hide (priv->time_hour); gtk_widget_show (priv->end_time); - g_signal_connect (priv->end_time_selector, "changed", G_CALLBACK (time_sel_changed), epage); - update_end_time_selector ( epage); + g_signal_connect (priv->end_time_combo, "changed", G_CALLBACK (time_sel_changed), epage); + update_end_time_combo ( epage); /* Hour and Minute selector */ gtk_spin_button_set_range( (GtkSpinButton*) priv->hour_selector, 0, G_MAXINT); @@ -2918,50 +2921,40 @@ init_widgets (EventPage *epage) priv->alarm_units = calendar_config_get_default_reminder_units (); priv->alarm_interval = calendar_config_get_default_reminder_interval (); - menu_label = ""; + combo_label = NULL; switch (priv->alarm_units) { case CAL_DAYS: if (priv->alarm_interval != 1) { - menu_label = g_strdup_printf (ngettext("%d day before appointment", "%d days before appointment", priv->alarm_interval), priv->alarm_interval); + combo_label = g_strdup_printf (ngettext("%d day before appointment", "%d days before appointment", priv->alarm_interval), priv->alarm_interval); } break; case CAL_HOURS: if (priv->alarm_interval != 1) { - menu_label = g_strdup_printf (ngettext("%d hour before appointment", "%d hours before appointment", priv->alarm_interval), priv->alarm_interval); + combo_label = g_strdup_printf (ngettext("%d hour before appointment", "%d hours before appointment", priv->alarm_interval), priv->alarm_interval); } break; case CAL_MINUTES: if (priv->alarm_interval != 15) { - menu_label = g_strdup_printf (ngettext("%d minute before appointment", "%d minutes before appointment", priv->alarm_interval), priv->alarm_interval); + combo_label = g_strdup_printf (ngettext("%d minute before appointment", "%d minutes before appointment", priv->alarm_interval), priv->alarm_interval); } break; } - cus_item = gtk_menu_item_new_with_label (menu_label); - if(menu_label[0] != '\0') { - gtk_widget_show (cus_item); + if (combo_label) { + gtk_combo_box_append_text (GTK_COMBO_BOX (priv->alarm_time_combo), combo_label); + g_free (combo_label); } - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->alarm_time)); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), cus_item); - - cus_item = gtk_menu_item_new_with_label (_("Customize")); - gtk_widget_show (cus_item); - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->alarm_time)); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), cus_item); - - cus_item = gtk_menu_item_new_with_label (_("None")); - gtk_widget_show (cus_item); - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->alarm_time)); - gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), cus_item); + gtk_combo_box_append_text (GTK_COMBO_BOX (priv->alarm_time_combo), _("Customize")); + gtk_combo_box_append_text (GTK_COMBO_BOX (priv->alarm_time_combo), _("None")); g_signal_connect_swapped ( - priv->alarm_time, "changed", + priv->alarm_time_combo, "changed", G_CALLBACK (comp_editor_page_changed), epage); g_signal_connect ( - priv->alarm_time, "changed", + priv->alarm_time_combo, "changed", G_CALLBACK (alarm_changed_cb), epage); /* Belongs to priv->description */ @@ -3046,9 +3039,8 @@ event_page_select_organizer (EventPage *epage, const char *backend_address) if (default_address) { if (!priv->comp || !e_cal_component_has_organizer (priv->comp)) { - gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->organizer)->entry), default_address); - /* FIXME: Use accessor functions to access private members of a GtkCombo widget */ - gtk_widget_set_sensitive (GTK_WIDGET (GTK_COMBO (priv->organizer)->button), !subscribed_cal); + gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->organizer))), default_address); + gtk_widget_set_sensitive (priv->organizer, !subscribed_cal); } } else g_warning ("No potential organizers!"); @@ -3114,9 +3106,14 @@ event_page_construct (EventPage *epage, EMeetingStore *model) g_object_unref(it); - if (priv->address_strings) - gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), priv->address_strings); - else + if (priv->address_strings) { + GList *l; + + for (l = priv->address_strings; l; l = l->next) + gtk_combo_box_append_text (GTK_COMBO_BOX (priv->organizer), l->data); + + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->organizer), 0); + } else g_warning ("No potential organizers!"); if (!init_widgets (epage)) { diff --git a/calendar/gui/dialogs/event-page.glade b/calendar/gui/dialogs/event-page.glade index c7d00dda94..7a57f6b716 100644 --- a/calendar/gui/dialogs/event-page.glade +++ b/calendar/gui/dialogs/event-page.glade @@ -198,7 +198,6 @@ 0.5 0 0 - organizer-entry PANGO_ELLIPSIZE_NONE -1 False @@ -392,34 +391,12 @@ 0 - - 24 + True - True - 0 - - - - - - - True - for - True - - - - - - - True - until - True - - - - - + for +until + False + True 12 @@ -756,34 +733,13 @@ 0 - + True - False - True - False - True - False - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - + a +b + False + True + True 0 @@ -1090,7 +1046,6 @@ 0.5 0 0 - alarm-time PANGO_ELLIPSIZE_NONE -1 False @@ -1104,42 +1059,13 @@ - + True - True - 0 - - - - - - - True - 15 minutes before appointment - True - - - - - - - True - 1 hour before appointment - True - - - - - - - True - 1 day before appointment - True - - - - - + 15 minutes before appointment +1 hour before appointment +1 day before appointment + False + True 4 diff --git a/calendar/gui/dialogs/meeting-page.glade b/calendar/gui/dialogs/meeting-page.glade index c332d081ca..e69de29bb2 100644 --- a/calendar/gui/dialogs/meeting-page.glade +++ b/calendar/gui/dialogs/meeting-page.glade @@ -1,407 +0,0 @@ - - - - - - - window1 - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - - - - 12 - True - False - 6 - - - - True - False - 6 - - - - True - False - 12 - - - - True - Or_ganizer: - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - organizer-entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - True - False - False - True - False - - Organizer - - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - True - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - True - False - 12 - - - - True - Organizer: - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - organizer-entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - None - False - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - True - C_hange Organizer - True - GTK_RELIEF_NORMAL - True - - - 0 - False - False - - - - - 0 - True - True - - - - - 0 - False - False - - - - - - True - <b>Att_endees</b> - True - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - 12 - - - - True - GTK_BUTTONBOX_START - 6 - - - - True - True - True - gtk-add - True - GTK_RELIEF_NORMAL - True - - - - - - True - True - True - gtk-remove - True - GTK_RELIEF_NORMAL - True - - - - - - True - True - True - GTK_RELIEF_NORMAL - True - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-jump-to - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - Co_ntacts... - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - 0 - True - True - - - - - - - diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index 9277a3c111..4f8c37c0a3 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -255,7 +255,6 @@ memo_page_fill_widgets (CompEditorPage *page, if (organizer.value != NULL) { const gchar *strip = itip_strip_mailto (organizer.value); gchar *string; - GList *list = NULL; if ( organizer.cn != NULL) string = g_strdup_printf ("%s <%s>", organizer.cn, strip); @@ -263,14 +262,14 @@ memo_page_fill_widgets (CompEditorPage *page, string = g_strdup (strip); if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp, client)) { - gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->org_combo)->entry), string); + gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->org_combo))), string); } else { - list = g_list_append (list, string); - gtk_combo_set_popdown_strings (GTK_COMBO (priv->org_combo), list); - gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (priv->org_combo)->entry), FALSE); + gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->org_combo)))); + gtk_combo_box_append_text (GTK_COMBO_BOX (priv->org_combo), string); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->org_combo), 0); + gtk_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (priv->org_combo))), FALSE); } g_free (string); - g_list_free (list); } } @@ -344,7 +343,7 @@ sensitize_widgets (MemoPage *mpage) /* 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_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (priv->org_combo))), FALSE); gtk_text_view_set_editable (GTK_TEXT_VIEW (priv->memo_content), sensitize); gtk_widget_set_sensitive (priv->start_date, sensitize); @@ -515,7 +514,7 @@ get_current_account (MemoPage *page) EIterator *it; const char *str; - str = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (priv->org_combo)->entry)); + str = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->org_combo)))); if (!str) return NULL; @@ -778,6 +777,7 @@ get_widgets (MemoPage *mpage) priv->org_label = GW ("org-label"); priv->org_combo = GW ("org-combo"); + gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->org_combo)))); priv->to_button = GW ("to-button"); priv->to_hbox = GW ("to-hbox"); @@ -1062,9 +1062,8 @@ memo_page_select_organizer (MemoPage *mpage, const char *backend_address) if (default_address) { 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); + gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->org_combo))), default_address); + gtk_widget_set_sensitive (priv->org_combo, !subscribed_cal); } } else g_warning ("No potential organizers!"); @@ -1132,9 +1131,14 @@ memo_page_construct (MemoPage *mpage) g_object_unref(it); - if (priv->address_strings) - gtk_combo_set_popdown_strings (GTK_COMBO (priv->org_combo), priv->address_strings); - else + if (priv->address_strings) { + GList *l; + + for (l = priv->address_strings; l; l = l->next) + gtk_combo_box_append_text (GTK_COMBO_BOX (priv->org_combo), l->data); + + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->org_combo), 0); + } else g_warning ("No potential organizers!"); gtk_widget_show (priv->org_label); diff --git a/calendar/gui/dialogs/memo-page.glade b/calendar/gui/dialogs/memo-page.glade index 6b65a053d5..b1ff10f3f4 100644 --- a/calendar/gui/dialogs/memo-page.glade +++ b/calendar/gui/dialogs/memo-page.glade @@ -159,7 +159,6 @@ True _Description: - memo_content True False GTK_JUSTIFY_CENTER @@ -169,6 +168,7 @@ 0 0 0 + memo_content PANGO_ELLIPSIZE_NONE -1 False @@ -285,7 +285,6 @@ 0.5 0 0 - combo-entry1 PANGO_ELLIPSIZE_NONE -1 False @@ -427,44 +426,6 @@ - - - False - True - False - True - False - - - - True - True - True - True - 0 - - True - - False - - - - - - True - GTK_SELECTION_BROWSE - - - - - 1 - 2 - 0 - 1 - - - - False @@ -485,6 +446,25 @@ fill + + + + True + a +b + False + True + True + + + 1 + 2 + 0 + 1 + fill + fill + + 0 diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 15171d52ed..c85a0ae0f2 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -145,9 +145,9 @@ struct _RecurrencePagePrivate { GtkWidget *params; GtkWidget *interval_value; - GtkWidget *interval_unit; + GtkWidget *interval_unit_combo; GtkWidget *special; - GtkWidget *ending_menu; + GtkWidget *ending_combo; GtkWidget *ending_special; GtkWidget *custom_warning_bin; @@ -159,10 +159,10 @@ struct _RecurrencePagePrivate { /* For monthly recurrences, created by hand */ int month_index; - GtkWidget *month_day_menu; + GtkWidget *month_day_combo; enum month_day_options month_day; - GtkWidget *month_num_menu; + GtkWidget *month_num_combo; enum month_num_options month_num; /* For ending date, created by hand */ @@ -343,11 +343,11 @@ recurrence_page_finalize (GObject *object) preview_date_range_changed_cb, NULL); g_signal_handlers_disconnect_matched ( - priv->interval_unit, G_SIGNAL_MATCH_DATA, + priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, object); g_signal_handlers_disconnect_matched ( - priv->ending_menu, G_SIGNAL_MATCH_DATA, + priv->ending_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, object); /* Chain up to parent's finalize() method. */ @@ -410,7 +410,6 @@ clear_widgets (RecurrencePage *rpage) { RecurrencePagePrivate *priv; GtkAdjustment *adj; - GtkWidget *menu; priv = rpage->priv; @@ -431,22 +430,20 @@ clear_widgets (RecurrencePage *rpage) e_dialog_spin_set (priv->interval_value, 1); g_signal_handlers_unblock_matched (adj, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->interval_unit)); - g_signal_handlers_block_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_option_menu_set (priv->interval_unit, + g_signal_handlers_block_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + e_dialog_combo_box_set (priv->interval_unit_combo, ICAL_DAILY_RECURRENCE, freq_map); - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + g_signal_handlers_unblock_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); priv->ending_date_tt = icaltime_today (); priv->ending_count = 1; - 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); - e_dialog_option_menu_set (priv->ending_menu, + g_signal_handlers_block_matched (priv->ending_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + e_dialog_combo_box_set (priv->ending_combo, ENDING_FOR, ending_types_map); - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + g_signal_handlers_unblock_matched (priv->ending_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); make_ending_special (rpage); /* Exceptions list */ e_date_time_list_clear (priv->exception_list_store); @@ -668,7 +665,7 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) /* Frequency, interval, week start */ - r.freq = e_dialog_option_menu_get (priv->interval_unit, freq_map); + r.freq = e_dialog_combo_box_get (priv->interval_unit_combo, freq_map); r.interval = e_dialog_spin_get_int (priv->interval_value); r.week_start = ICAL_SUNDAY_WEEKDAY + calendar_config_get_week_start_day (); @@ -721,14 +718,14 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) enum month_day_options month_day; g_return_if_fail (GTK_BIN (priv->special)->child != NULL); - g_return_if_fail (priv->month_day_menu != NULL); - g_return_if_fail (GTK_IS_OPTION_MENU (priv->month_day_menu)); - g_return_if_fail (priv->month_num_menu != NULL); - g_return_if_fail (GTK_IS_OPTION_MENU (priv->month_num_menu)); + g_return_if_fail (priv->month_day_combo != NULL); + g_return_if_fail (GTK_IS_COMBO_BOX (priv->month_day_combo)); + g_return_if_fail (priv->month_num_combo != NULL); + g_return_if_fail (GTK_IS_COMBO_BOX (priv->month_num_combo)); - month_num = e_dialog_option_menu_get (priv->month_num_menu, + month_num = e_dialog_combo_box_get (priv->month_num_combo, month_num_options_map ); - month_day = e_dialog_option_menu_get (priv->month_day_menu, + month_day = e_dialog_combo_box_get (priv->month_day_combo, month_day_options_map); if (month_num == MONTH_NUM_LAST) @@ -799,8 +796,7 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) /* Ending date */ - ending_type = e_dialog_option_menu_get (priv->ending_menu, - ending_types_map); + ending_type = e_dialog_combo_box_get (priv->ending_combo, ending_types_map); switch (ending_type) { case ENDING_FOR: @@ -903,8 +899,8 @@ fill_component (RecurrencePage *rpage, ECalComponent *comp) e_cal_component_set_exdate_list (comp, list); e_cal_component_free_exdate_list (list); - if (GTK_WIDGET_VISIBLE (priv->ending_menu) && GTK_WIDGET_IS_SENSITIVE (priv->ending_menu) && - e_dialog_option_menu_get (priv->ending_menu, ending_types_map) == ENDING_UNTIL) { + if (GTK_WIDGET_VISIBLE (priv->ending_combo) && GTK_WIDGET_IS_SENSITIVE (priv->ending_combo) && + e_dialog_combo_box_get (priv->ending_combo, ending_types_map) == ENDING_UNTIL) { /* check whether the "until" date is in the future */ struct icaltimetype tt; gboolean ok = TRUE; @@ -978,44 +974,37 @@ make_weekly_special (RecurrencePage *rpage) G_CALLBACK (comp_editor_page_changed), rpage); } - +/* Creates the subtree for the monthly recurrence number */ static void -month_num_submenu_selection_done_cb (GtkMenuShell *menu_shell, gpointer data) -{ - GtkWidget *item; - int month_index; - - item = gtk_menu_get_active (GTK_MENU (menu_shell)); - item = gtk_menu_get_active (GTK_MENU (gtk_menu_item_get_submenu (GTK_MENU_ITEM (item)))); - - month_index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "data")); - g_object_set_data (G_OBJECT (data), "data", GINT_TO_POINTER (month_index)); -} - -/* Creates the option menu for the monthly recurrence number */ -static GtkWidget * -make_recur_month_num_submenu (const char *title, int start, int end) +make_recur_month_num_subtree (GtkTreeStore *store, GtkTreeIter *par, const char *title, int start, int end) { - GtkWidget *submenu, *item; + GtkTreeIter iter, parent; int i; - submenu = gtk_menu_new (); + gtk_tree_store_append (store, &parent, par); + gtk_tree_store_set (store, &parent, 0, _(title), 1, -1, -1); + for (i = start; i < end; i++) { - item = gtk_menu_item_new_with_label (_(e_cal_recur_nth[i])); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item); - g_object_set_data (G_OBJECT (item), "data", GINT_TO_POINTER (i + 1)); - gtk_widget_show (item); + gtk_tree_store_append (store, &iter, &parent); + gtk_tree_store_set (store, &iter, 0, _(e_cal_recur_nth[i]), 1, i + 1, -1); } +} +static void +only_leaf_sensitive (GtkCellLayout *cell_layout, + GtkCellRenderer *cell, + GtkTreeModel *tree_model, + GtkTreeIter *iter, + gpointer data) +{ + gboolean sensitive; - item = gtk_menu_item_new_with_label (_(title)); - gtk_widget_show (item); - gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu); + sensitive = !gtk_tree_model_iter_has_child (tree_model, iter); - return item; + g_object_set (cell, "sensitive", sensitive, NULL); } static GtkWidget * -make_recur_month_num_menu (int month_index) +make_recur_month_num_combo (int month_index) { static const char *options[] = { /* TRANSLATORS: Entire string is for example: This appointment recurs/Every [x] month(s) on the [first] [Monday] [forever]' @@ -1046,67 +1035,65 @@ make_recur_month_num_menu (int month_index) N_("last") }; - GtkWidget *menu, *submenu, *item, *submenu_item; - GtkWidget *omenu; int i; + GtkTreeStore *store; + GtkTreeIter iter; + GtkWidget *combo; + GtkCellRenderer *cell; - menu = gtk_menu_new (); + store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_INT); /* Relation */ for (i = 0; i < sizeof (options) / sizeof (options[0]); i++) { - item = gtk_menu_item_new_with_label (_(options[i])); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - gtk_widget_show (item); + gtk_tree_store_append (store, &iter, NULL); + gtk_tree_store_set (store, &iter, 0, _(options [i]), 1, month_num_options_map [i], -1); } /* Current date */ - item = gtk_menu_item_new_with_label (_(e_cal_recur_nth[month_index - 1])); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - gtk_widget_show (item); - - /* Other Submenu */ - submenu = gtk_menu_new (); + gtk_tree_store_append (store, &iter, NULL); + gtk_tree_store_set (store, &iter, 0, _(e_cal_recur_nth[month_index - 1]), 1, MONTH_NUM_DAY, -1); + gtk_tree_store_append (store, &iter, NULL); /* TRANSLATORS: Entire string is for example: This appointment recurs/Every [x] month(s) on the [Other date] [11th to 20th] [17th] [forever]' * (dropdown menu options are in [square brackets]). */ - submenu_item = gtk_menu_item_new_with_label (_("Other Date")); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), submenu_item); - gtk_widget_show (submenu_item); + gtk_tree_store_set (store, &iter, 0, _("Other Date"), 1, MONTH_NUM_OTHER, -1); /* TRANSLATORS: This is a submenu option string to split the date range into three submenus to choose the exact day of * the month to setup an appointment recurrence. The entire string is for example: This appointment recurs/Every [x] month(s) * on the [Other date] [1st to 10th] [7th] [forever]' (dropdown menu options are in [square brackets]). */ - item = make_recur_month_num_submenu (_("1st to 10th"), 0, 10); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item); + make_recur_month_num_subtree (store, &iter, _("1st to 10th"), 0, 10); + /* TRANSLATORS: This is a submenu option string to split the date range into three submenus to choose the exact day of * the month to setup an appointment recurrence. The entire string is for example: This appointment recurs/Every [x] month(s) * on the [Other date] [11th to 20th] [17th] [forever]' (dropdown menu options are in [square brackets]). */ - item = make_recur_month_num_submenu (_("11th to 20th"), 10, 20); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item); + make_recur_month_num_subtree (store, &iter, _("11th to 20th"), 10, 20); + /* TRANSLATORS: This is a submenu option string to split the date range into three submenus to choose the exact day of * the month to setup an appointment recurrence. The entire string is for example: This appointment recurs/Every [x] month(s) * on the [Other date] [21th to 31th] [27th] [forever]' (dropdown menu options are in [square brackets]). */ - item = make_recur_month_num_submenu (_("21st to 31st"), 20, 31); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item); + make_recur_month_num_subtree (store, &iter, _("21st to 31st"), 20, 31); + + combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); + g_object_unref (store); - gtk_menu_item_set_submenu (GTK_MENU_ITEM (submenu_item), submenu); - g_object_set_data (G_OBJECT (submenu_item), "data", GINT_TO_POINTER (month_index)); - g_signal_connect((submenu), "selection_done", - G_CALLBACK (month_num_submenu_selection_done_cb), - submenu_item); + cell = gtk_cell_renderer_text_new (); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE); + gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell, "text", 0, NULL); - omenu = gtk_option_menu_new (); - gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu); + gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo), + cell, + only_leaf_sensitive, + NULL, NULL); - return omenu; + return combo; } -/* Creates the option menu for the monthly recurrence days */ +/* Creates the combo box for the monthly recurrence days */ static GtkWidget * -make_recur_month_menu (void) +make_recur_month_combobox (void) { static const char *options[] = { /* For Translator : 'day' is part of the sentence of the form 'appointment recurs/Every [x] month(s) on the [first] [day] [forever]' @@ -1122,76 +1109,80 @@ make_recur_month_menu (void) N_("Sunday") }; - GtkWidget *menu; - GtkWidget *omenu; + GtkWidget *combo; int i; - menu = gtk_menu_new (); + combo = gtk_combo_box_new_text (); for (i = 0; i < sizeof (options) / sizeof (options[0]); i++) { - GtkWidget *item; - - item = gtk_menu_item_new_with_label (_(options[i])); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - gtk_widget_show (item); + gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _(options[i])); } - omenu = gtk_option_menu_new (); - gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu); - - return omenu; + return combo; } static void -month_num_menu_selection_done_cb (GtkMenuShell *menu_shell, - RecurrencePage *rpage) +month_num_combo_changed_cb (GtkComboBox *combo, RecurrencePage *rpage) { + GtkTreeIter iter; RecurrencePagePrivate *priv; enum month_num_options month_num; enum month_day_options month_day; priv = rpage->priv; - month_num = e_dialog_option_menu_get (priv->month_num_menu, - month_num_options_map); - month_day = e_dialog_option_menu_get (priv->month_day_menu, + month_day = e_dialog_combo_box_get (priv->month_day_combo, month_day_options_map); - if (month_num == MONTH_NUM_OTHER) { - GtkWidget *label, *item; + if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->month_num_combo), &iter)) { + gint value; + GtkTreeIter parent; + GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->month_num_combo)); + + gtk_tree_model_get (model, &iter, 1, &value, -1); - item = gtk_menu_get_active (GTK_MENU (menu_shell)); - priv->month_index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "data")); + if (value == -1) { + return; + } + + if (gtk_tree_model_iter_parent (model, &parent, &iter)) { + /* it's a leaf, thus the day number */ + month_num = MONTH_NUM_DAY; + priv->month_index = value; - month_num = MONTH_NUM_DAY; - e_dialog_option_menu_set (priv->month_num_menu, month_num, month_num_options_map); + g_return_if_fail (gtk_tree_model_iter_nth_child (model, &iter, NULL, month_num)); - label = GTK_BIN (priv->month_num_menu)->child; - gtk_label_set_text (GTK_LABEL (label), _(e_cal_recur_nth[priv->month_index - 1])); + gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 0, _(e_cal_recur_nth[priv->month_index - 1]), -1); + gtk_combo_box_set_active_iter (GTK_COMBO_BOX (priv->month_num_combo), &iter); + } else { + /* top level node */ + month_num = value; - e_dialog_option_menu_set (priv->month_num_menu, 0, month_num_options_map); - e_dialog_option_menu_set (priv->month_num_menu, month_num, month_num_options_map); + if (month_num == MONTH_NUM_OTHER) + month_num = MONTH_NUM_DAY; + } + } else { + month_num = 0; } if (month_num == MONTH_NUM_DAY && month_day != MONTH_DAY_NTH) - e_dialog_option_menu_set (priv->month_day_menu, + e_dialog_combo_box_set (priv->month_day_combo, MONTH_DAY_NTH, month_day_options_map); else if (month_num != MONTH_NUM_DAY && month_num != MONTH_NUM_LAST && month_day == MONTH_DAY_NTH) - e_dialog_option_menu_set (priv->month_day_menu, + e_dialog_combo_box_set (priv->month_day_combo, MONTH_DAY_MON, month_num_options_map); comp_editor_page_changed (COMP_EDITOR_PAGE (rpage)); } -/* Callback used when the monthly day selection menu changes. We need +/* Callback used when the monthly day selection changes. We need * to change the valid range of the day index spin button; e.g. days * are 1-31 while a Sunday is the 1st through 5th. */ static void -month_day_menu_selection_done_cb (GtkMenuShell *menu_shell, - RecurrencePage *rpage) +month_day_combo_changed_cb (GtkComboBox *combo, RecurrencePage *rpage) { RecurrencePagePrivate *priv; enum month_num_options month_num; @@ -1199,16 +1190,16 @@ month_day_menu_selection_done_cb (GtkMenuShell *menu_shell, priv = rpage->priv; - month_num = e_dialog_option_menu_get (priv->month_num_menu, + month_num = e_dialog_combo_box_get (priv->month_num_combo, month_num_options_map); - month_day = e_dialog_option_menu_get (priv->month_day_menu, + month_day = e_dialog_combo_box_get (priv->month_day_combo, month_day_options_map); if (month_day == MONTH_DAY_NTH && month_num != MONTH_NUM_LAST && month_num != MONTH_NUM_DAY) - e_dialog_option_menu_set (priv->month_num_menu, + e_dialog_combo_box_set (priv->month_num_combo, MONTH_NUM_DAY, month_num_options_map); else if (month_day != MONTH_DAY_NTH && month_num == MONTH_NUM_DAY) - e_dialog_option_menu_set (priv->month_num_menu, + e_dialog_combo_box_set (priv->month_num_combo, MONTH_NUM_FIRST, month_num_options_map); @@ -1223,12 +1214,11 @@ make_monthly_special (RecurrencePage *rpage) GtkWidget *hbox; GtkWidget *label; GtkAdjustment *adj; - GtkWidget *menu; priv = rpage->priv; g_return_if_fail (GTK_BIN (priv->special)->child == NULL); - g_return_if_fail (priv->month_day_menu == NULL); + g_return_if_fail (priv->month_day_combo == NULL); /* Create the widgets */ @@ -1243,21 +1233,21 @@ make_monthly_special (RecurrencePage *rpage) adj = GTK_ADJUSTMENT (gtk_adjustment_new (1, 1, 31, 1, 10, 10)); - priv->month_num_menu = make_recur_month_num_menu (priv->month_index); - gtk_box_pack_start (GTK_BOX (hbox), priv->month_num_menu, + priv->month_num_combo = make_recur_month_num_combo (priv->month_index); + gtk_box_pack_start (GTK_BOX (hbox), priv->month_num_combo, FALSE, FALSE, 6); - priv->month_day_menu = make_recur_month_menu (); - gtk_box_pack_start (GTK_BOX (hbox), priv->month_day_menu, + priv->month_day_combo = make_recur_month_combobox (); + gtk_box_pack_start (GTK_BOX (hbox), priv->month_day_combo, FALSE, FALSE, 6); gtk_widget_show_all (hbox); /* Set the options */ - e_dialog_option_menu_set (priv->month_num_menu, + e_dialog_combo_box_set (priv->month_num_combo, priv->month_num, month_num_options_map); - e_dialog_option_menu_set (priv->month_day_menu, + e_dialog_combo_box_set (priv->month_day_combo, priv->month_day, month_day_options_map); @@ -1265,14 +1255,8 @@ make_monthly_special (RecurrencePage *rpage) 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", - G_CALLBACK (month_num_menu_selection_done_cb), - rpage); - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->month_day_menu)); - g_signal_connect((menu), "selection_done", - G_CALLBACK (month_day_menu_selection_done_cb), - rpage); + g_signal_connect (priv->month_num_combo, "changed", G_CALLBACK (month_num_combo_changed_cb), rpage); + g_signal_connect (priv->month_day_combo, "changed", G_CALLBACK (month_day_combo_changed_cb), rpage); } /* Changes the recurrence-special widget to match the interval units. @@ -1290,18 +1274,18 @@ make_recurrence_special (RecurrencePage *rpage) priv = rpage->priv; - if (priv->month_num_menu != NULL) { - gtk_widget_destroy (priv->month_num_menu); - priv->month_num_menu = NULL; + if (priv->month_num_combo != NULL) { + gtk_widget_destroy (priv->month_num_combo); + priv->month_num_combo = NULL; } if (GTK_BIN (priv->special)->child != NULL) { gtk_widget_destroy (GTK_BIN (priv->special)->child); priv->weekday_picker = NULL; - priv->month_day_menu = NULL; + priv->month_day_combo = NULL; } - frequency = e_dialog_option_menu_get (priv->interval_unit, freq_map); + frequency = e_dialog_combo_box_get (priv->interval_unit_combo, freq_map); switch (frequency) { case ICAL_DAILY_RECURRENCE: @@ -1449,8 +1433,7 @@ make_ending_special (RecurrencePage *rpage) priv->ending_count_spin = NULL; } - ending_type = e_dialog_option_menu_get (priv->ending_menu, - ending_types_map); + ending_type = e_dialog_combo_box_get (priv->ending_combo, ending_types_map); switch (ending_type) { case ENDING_FOR: @@ -1480,20 +1463,18 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r) { RecurrencePagePrivate *priv = rpage->priv; CompEditor *editor; - GtkWidget *menu; ECal *client; 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); + g_signal_handlers_block_matched (priv->ending_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); if (r->count == 0) { if (r->until.year == 0) { /* Forever */ - e_dialog_option_menu_set (priv->ending_menu, + e_dialog_combo_box_set (priv->ending_combo, ENDING_FOREVER, ending_types_map); } else { @@ -1526,7 +1507,7 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r) } priv->ending_date_tt = r->until; - e_dialog_option_menu_set (priv->ending_menu, + e_dialog_combo_box_set (priv->ending_combo, ENDING_UNTIL, ending_types_map); } @@ -1534,12 +1515,12 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r) /* Count of occurrences */ priv->ending_count = r->count; - e_dialog_option_menu_set (priv->ending_menu, + e_dialog_combo_box_set (priv->ending_combo, ENDING_FOR, ending_types_map); } - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + g_signal_handlers_unblock_matched (priv->ending_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); make_ending_special (rpage); } @@ -1564,7 +1545,6 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) int n_by_second, n_by_minute, n_by_hour; int n_by_day, n_by_month_day, n_by_year_day; int n_by_week_no, n_by_month, n_by_set_pos; - GtkWidget *menu; GtkAdjustment *adj; rpage = RECURRENCE_PAGE (page); @@ -1673,12 +1653,11 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) || n_by_set_pos != 0) goto custom; - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->interval_unit)); - g_signal_handlers_block_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_option_menu_set (priv->interval_unit, + g_signal_handlers_block_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + e_dialog_combo_box_set (priv->interval_unit_combo, ICAL_DAILY_RECURRENCE, freq_map); - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + g_signal_handlers_unblock_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); break; case ICAL_WEEKLY_RECURRENCE: { @@ -1740,12 +1719,11 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) priv->weekday_day_mask = day_mask; - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->interval_unit)); - g_signal_handlers_block_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_option_menu_set (priv->interval_unit, + g_signal_handlers_block_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + e_dialog_combo_box_set (priv->interval_unit_combo, ICAL_WEEKLY_RECURRENCE, freq_map); - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + g_signal_handlers_unblock_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); break; } @@ -1840,12 +1818,11 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) } else goto custom; - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->interval_unit)); - g_signal_handlers_block_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_option_menu_set (priv->interval_unit, + g_signal_handlers_block_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + e_dialog_combo_box_set (priv->interval_unit_combo, ICAL_MONTHLY_RECURRENCE, freq_map); - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + g_signal_handlers_unblock_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); break; case ICAL_YEARLY_RECURRENCE: @@ -1857,12 +1834,11 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) || n_by_set_pos != 0) goto custom; - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->interval_unit)); - g_signal_handlers_block_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_option_menu_set (priv->interval_unit, + g_signal_handlers_block_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + e_dialog_combo_box_set (priv->interval_unit_combo, ICAL_YEARLY_RECURRENCE, freq_map); - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + g_signal_handlers_unblock_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); break; default: @@ -2019,9 +1995,9 @@ get_widgets (RecurrencePage *rpage) priv->params = GW ("params"); priv->interval_value = GW ("interval-value"); - priv->interval_unit = GW ("interval-unit"); + priv->interval_unit_combo = GW ("interval-unit-combobox"); priv->special = GW ("special"); - priv->ending_menu = GW ("ending-menu"); + priv->ending_combo = GW ("ending-combobox"); priv->ending_special = GW ("ending-special"); priv->custom_warning_bin = GW ("custom-warning-bin"); @@ -2037,9 +2013,9 @@ get_widgets (RecurrencePage *rpage) return (priv->recurs && priv->params && priv->interval_value - && priv->interval_unit + && priv->interval_unit_combo && priv->special - && priv->ending_menu + && priv->ending_combo && priv->ending_special && priv->custom_warning_bin && priv->exception_list @@ -2296,19 +2272,19 @@ init_widgets (RecurrencePage *rpage) /* Recurrence units */ g_signal_connect_swapped ( - priv->interval_unit, "changed", + priv->interval_unit_combo, "changed", G_CALLBACK (comp_editor_page_changed), rpage); g_signal_connect_swapped ( - priv->interval_unit, "changed", + priv->interval_unit_combo, "changed", G_CALLBACK (make_recurrence_special), rpage); /* Recurrence ending */ g_signal_connect_swapped ( - priv->ending_menu, "changed", + priv->ending_combo, "changed", G_CALLBACK (comp_editor_page_changed), rpage); g_signal_connect_swapped ( - priv->ending_menu, "changed", + priv->ending_combo, "changed", G_CALLBACK (make_ending_special), rpage); /* Exception buttons */ diff --git a/calendar/gui/dialogs/recurrence-page.glade b/calendar/gui/dialogs/recurrence-page.glade index 14d6c2fa04..5cec3f8494 100644 --- a/calendar/gui/dialogs/recurrence-page.glade +++ b/calendar/gui/dialogs/recurrence-page.glade @@ -4,7 +4,7 @@ - window1 + window1 GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False @@ -15,6 +15,8 @@ False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST + True + False @@ -36,6 +38,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -63,6 +69,10 @@ 0.5 12 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -81,8 +91,7 @@ True True - This appointment rec_urs + This appointment rec_urs True GTK_RELIEF_NORMAL True @@ -112,8 +121,7 @@ True - Every + Every False False GTK_JUSTIFY_CENTER @@ -123,6 +131,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -151,52 +163,15 @@ - + True - True - 0 - - - - True - - - - True - day(s) - True - - - - - - True - week(s) - True - - - - - - True - month(s) - True - - - - - - True - year(s) - True - - - - + day(s) +week(s) +month(s) +year(s) + False + True 0 @@ -229,43 +204,14 @@ - + True - True - 0 - - - - True - - - - True - for - True - - - - - - True - until - True - - - - - - True - forever - True - - - - + for +until +forever + False + True 0 @@ -361,6 +307,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -388,6 +338,10 @@ 0.5 12 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -418,6 +372,9 @@ False False True + False + False + False @@ -502,6 +459,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -562,6 +523,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -589,6 +554,10 @@ 0.5 12 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index a2be1381a6..959c275443 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -52,8 +52,8 @@ struct _TaskDetailsPagePrivate { /* Widgets from the Glade file */ GtkWidget *main; - GtkWidget *status; - GtkWidget *priority; + GtkWidget *status_combo; + GtkWidget *priority_combo; GtkWidget *percent_complete; GtkWidget *date_completed_label; @@ -165,7 +165,7 @@ task_details_page_focus_main_widget (CompEditorPage *page) tdpage = TASK_DETAILS_PAGE (page); priv = tdpage->priv; - gtk_widget_grab_focus (priv->status); + gtk_widget_grab_focus (priv->status_combo); } @@ -241,8 +241,8 @@ sensitize_widgets (TaskDetailsPage *tdpage) if (!e_cal_is_read_only (client, &read_only, NULL)) read_only = TRUE; - gtk_widget_set_sensitive (priv->status, !read_only); - gtk_widget_set_sensitive (priv->priority, !read_only); + gtk_widget_set_sensitive (priv->status_combo, !read_only); + gtk_widget_set_sensitive (priv->priority_combo, !read_only); gtk_widget_set_sensitive (priv->percent_complete, !read_only); gtk_widget_set_sensitive (priv->completed_date, !read_only); gtk_widget_set_sensitive (priv->url_label, !read_only); @@ -290,7 +290,7 @@ task_details_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) } else status = ICAL_STATUS_NONE; } - e_dialog_option_menu_set (priv->status, status, status_map); + e_dialog_combo_box_set (priv->status_combo, status, status_map); if (percent) e_cal_component_free_percent (percent); @@ -325,7 +325,7 @@ task_details_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) } else { priority = PRIORITY_UNDEFINED; } - e_dialog_option_menu_set (priv->priority, priority, priority_map); + e_dialog_combo_box_set (priv->priority_combo, priority, priority_map); /* URL */ e_cal_component_get_url (comp, &url); @@ -358,11 +358,11 @@ task_details_page_fill_component (CompEditorPage *page, ECalComponent *comp) e_cal_component_set_percent (comp, &percent); /* Status. */ - status = e_dialog_option_menu_get (priv->status, status_map); + status = e_dialog_combo_box_get (priv->status_combo, status_map); e_cal_component_set_status (comp, status); /* Priority. */ - priority = e_dialog_option_menu_get (priv->priority, priority_map); + priority = e_dialog_combo_box_get (priv->priority_combo, priority_map); priority_value = priority_index_to_value (priority); e_cal_component_set_priority (comp, &priority_value); @@ -465,8 +465,8 @@ get_widgets (TaskDetailsPage *tdpage) g_object_ref (priv->main); gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main); - priv->status = GW ("status"); - priv->priority = GW ("priority"); + priv->status_combo = GW ("status-combobox"); + priv->priority_combo = GW ("priority-combobox"); priv->percent_complete = GW ("percent-complete"); priv->date_completed_label = GW ("date_completed_label"); @@ -483,8 +483,8 @@ get_widgets (TaskDetailsPage *tdpage) #undef GW - return (priv->status - && priv->priority + return (priv->status_combo + && priv->priority_combo && priv->percent_complete && priv->date_completed_label && priv->completed_date @@ -542,19 +542,19 @@ date_changed_cb (EDateEdit *dedit, gpointer data) &completed_tt.hour, &completed_tt.minute); - status = e_dialog_option_menu_get (priv->status, status_map); + status = e_dialog_combo_box_get (priv->status_combo, status_map); if (!date_set) { completed_tt = icaltime_null_time (); if (status == ICAL_STATUS_COMPLETED) { - e_dialog_option_menu_set (priv->status, + e_dialog_combo_box_set (priv->status_combo, ICAL_STATUS_NONE, status_map); e_dialog_spin_set (priv->percent_complete, 0); } } else { if (status != ICAL_STATUS_COMPLETED) { - e_dialog_option_menu_set (priv->status, + e_dialog_combo_box_set (priv->status_combo, ICAL_STATUS_COMPLETED, status_map); } @@ -569,7 +569,7 @@ date_changed_cb (EDateEdit *dedit, gpointer data) } static void -status_changed (GtkMenu *menu, TaskDetailsPage *tdpage) +status_changed (GtkWidget *combo, TaskDetailsPage *tdpage) { TaskDetailsPagePrivate *priv; icalproperty_status status; @@ -585,7 +585,7 @@ status_changed (GtkMenu *menu, TaskDetailsPage *tdpage) comp_editor_page_set_updating (COMP_EDITOR_PAGE (tdpage), TRUE); - status = e_dialog_option_menu_get (priv->status, status_map); + status = e_dialog_combo_box_get (priv->status_combo, status_map); if (status == ICAL_STATUS_NONE) { e_dialog_spin_set (priv->percent_complete, 0); e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), ctime); @@ -642,7 +642,7 @@ percent_complete_changed (GtkAdjustment *adj, TaskDetailsPage *tdpage) status = ICAL_STATUS_INPROCESS; } - e_dialog_option_menu_set (priv->status, status, status_map); + e_dialog_combo_box_set (priv->status_combo, status, status_map); e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), ctime); complete_date_changed (tdpage, ctime, complete); @@ -672,8 +672,8 @@ init_widgets (TaskDetailsPage *tdpage) /* Connect signals. The Status, Percent Complete & Date Completed properties are closely related so whenever one changes we may need to update the other 2. */ - g_signal_connect((GTK_OPTION_MENU (priv->status)->menu), - "deactivate", + g_signal_connect (GTK_COMBO_BOX (priv->status_combo), + "changed", G_CALLBACK (status_changed), tdpage); g_signal_connect((GTK_SPIN_BUTTON (priv->percent_complete)->adjustment), @@ -682,7 +682,7 @@ init_widgets (TaskDetailsPage *tdpage) /* Priority */ g_signal_connect_swapped ( - GTK_OPTION_MENU (priv->priority)->menu, "deactivate", + GTK_COMBO_BOX (priv->priority_combo), "changed", G_CALLBACK (comp_editor_page_changed), tdpage); /* Completed Date */ diff --git a/calendar/gui/dialogs/task-details-page.glade b/calendar/gui/dialogs/task-details-page.glade index aac90876ed..44fc3b2fbb 100644 --- a/calendar/gui/dialogs/task-details-page.glade +++ b/calendar/gui/dialogs/task-details-page.glade @@ -4,7 +4,7 @@ - window1 + window1 GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False @@ -15,6 +15,8 @@ False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST + True + False @@ -36,6 +38,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -63,6 +69,10 @@ 0.5 12 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -93,7 +103,10 @@ 0.5 0 0 - status + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -119,6 +132,10 @@ 0 0 percent-complete + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -143,7 +160,10 @@ 0.5 0 0 - priority + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -168,6 +188,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -179,114 +203,6 @@ - - - True - True - 0 - - - - True - - - - True - High - True - - - - - - True - Normal - True - - - - - - True - Low - True - - - - - - True - Undefined - True - - - - - - - 1 - 2 - 2 - 3 - fill - - - - - - - True - True - 0 - - - - True - - - - True - Not Started - True - - - - - - True - In Progress - True - - - - - - True - Completed - True - - - - - - True - Canceled - True - - - - - - - 1 - 2 - 0 - 1 - fill - - - - True @@ -329,6 +245,46 @@ + + + + True + High +Normal +Low +Undefined + False + True + + + 1 + 2 + 2 + 3 + fill + fill + + + + + + True + Not Started +In Progress +Completed +Canceled + False + True + + + 1 + 2 + 0 + 1 + fill + fill + + 0 @@ -357,6 +313,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -384,6 +344,10 @@ 0.5 12 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -415,6 +379,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index d9078c61b7..c3a8e34ba0 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -332,7 +332,7 @@ sensitize_widgets (TaskPage *tpage) /* 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->organizer)->entry), FALSE); + gtk_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (priv->organizer))), FALSE); gtk_editable_set_editable (GTK_EDITABLE (priv->summary), !read_only); gtk_widget_set_sensitive (priv->due_date, !read_only); @@ -371,7 +371,7 @@ sensitize_widgets (TaskPage *tpage) gtk_widget_show (priv->attendee_box); gtk_widget_show (priv->organizer); gtk_label_set_text_with_mnemonic (GTK_LABEL (priv->org_cal_label), _("Organi_zer:")); - gtk_label_set_mnemonic_widget (GTK_LABEL (priv->org_cal_label), GTK_COMBO (priv->organizer)->entry); + gtk_label_set_mnemonic_widget (GTK_LABEL (priv->org_cal_label), priv->organizer); } } void @@ -418,7 +418,7 @@ get_current_account (TaskPage *page) priv = page->priv; - str = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (priv->organizer)->entry)); + str = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->organizer)))); if (!str) return NULL; @@ -614,7 +614,6 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) if (organizer.value != NULL) { const gchar *strip = itip_strip_mailto (organizer.value); gchar *string; - GList *list = NULL; if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp, client)) { if (e_cal_get_static_capability ( @@ -640,13 +639,15 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) string = g_strdup (strip); if (!priv->user_org) { - list = g_list_append (list, string); - gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), list); - gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (priv->organizer)->entry), FALSE); + gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->organizer)))); + gtk_combo_box_append_text (GTK_COMBO_BOX (priv->organizer), string); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->organizer), 0); + gtk_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (priv->organizer))), FALSE); + } else { + gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->organizer))), string); } g_free (string); - g_list_free (list); priv->existing = TRUE; } } else { @@ -1425,7 +1426,10 @@ get_widgets (TaskPage *tpage) priv->description = GW ("description"); priv->categories_btn = GW ("categories-button"); priv->categories = GW ("categories"); + priv->organizer = GW ("organizer"); + gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->organizer)))); + priv->invite = GW ("invite"); priv->add = GW ("add-attendee"); priv->edit = GW ("edit-attendee"); @@ -2000,9 +2004,8 @@ task_page_select_organizer (TaskPage *tpage, const char *backend_address) if (default_address) { if (!priv->comp || !e_cal_component_has_organizer (priv->comp)) { - gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->organizer)->entry), default_address); - /* FIXME: Use accessor functions to access private members of a GtkCombo widget */ - gtk_widget_set_sensitive (GTK_WIDGET (GTK_COMBO (priv->organizer)->button), !subscribed_cal); + gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->organizer))), default_address); + gtk_widget_set_sensitive (priv->organizer, !subscribed_cal); } } else g_warning ("No potential organizers!"); @@ -2069,9 +2072,14 @@ task_page_construct (TaskPage *tpage, EMeetingStore *model, ECal *client) g_object_unref(it); - if (priv->address_strings) - gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), priv->address_strings); - else + if (priv->address_strings) { + GList *l; + + for (l = priv->address_strings; l; l = l->next) + gtk_combo_box_append_text (GTK_COMBO_BOX (priv->organizer), l->data); + + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->organizer), 0); + } else g_warning ("No potential organizers!"); if (!init_widgets (tpage)) { diff --git a/calendar/gui/dialogs/task-page.glade b/calendar/gui/dialogs/task-page.glade index d106381f8f..72beb68f21 100644 --- a/calendar/gui/dialogs/task-page.glade +++ b/calendar/gui/dialogs/task-page.glade @@ -600,34 +600,13 @@ 6 - + True - False - True - False - True - False - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - + a +b + False + True + True 0 -- cgit v1.2.3 From cd26e8a609574335e684df2f1eef55f2a11c2bdf Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 24 Apr 2009 13:35:59 +0200 Subject: Remove unused files I forgot to remove unused files from sources in the commit for GN-bug #572348 --- calendar/gui/dialogs/meeting-page.glade | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 calendar/gui/dialogs/meeting-page.glade (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/meeting-page.glade b/calendar/gui/dialogs/meeting-page.glade deleted file mode 100644 index e69de29bb2..0000000000 -- cgit v1.2.3 From 501da8aa29d496ef765a3afb5ac1b3fc1361c7e2 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 24 Apr 2009 16:58:15 +0200 Subject: Get rid of "Adjust for daylight saving time" option ** Fix for bug #577615 * gui/dialogs/cal-prefs-dialog.h: (struct _CalendarPrefsDialog): * gui/dialogs/cal-prefs-dialog.c: (timezone_changed), (daylight_saving_changed), (setup_changes), (show_config), (calendar_prefs_dialog_construct): * gui/dialogs/cal-prefs-dialog.glade: * gui/apps_evolution_calendar.schemas.in: * gui/calendar-config-keys.h: * gui/calendar-config.h: * gui/calendar-config.c: (set_standard_offsets), (calendar_config_get_icaltimezone), (calendar_config_get_daylight_saving), (calendar_config_set_daylight_saving), (calendar_config_add_notification_daylight_saving): Get rid of "Adjust for daylight saving time" option. --- calendar/gui/dialogs/cal-prefs-dialog.c | 27 --------------------------- calendar/gui/dialogs/cal-prefs-dialog.glade | 22 ---------------------- calendar/gui/dialogs/cal-prefs-dialog.h | 1 - 3 files changed, 50 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 81e182ac54..edb802fd10 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -119,15 +119,8 @@ static void timezone_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) { icaltimezone *zone; - icalcomponent *icalcomp, *dl_comp; zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (prefs->timezone)); - icalcomp = icaltimezone_get_component (zone); - - if (!icalcomp || !(dl_comp = icalcomponent_get_first_component (icalcomp, ICAL_XDAYLIGHT_COMPONENT))) - gtk_widget_set_sensitive ((GtkWidget *) prefs->daylight_saving, FALSE); - else - gtk_widget_set_sensitive ((GtkWidget *) prefs->daylight_saving, TRUE); calendar_config_set_timezone (icaltimezone_get_location (zone)); } @@ -227,14 +220,6 @@ day_second_zone_clicked (GtkWidget *widget, CalendarPrefsDialog *prefs) 0, gtk_get_current_event_time ()); } -static void -daylight_saving_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) -{ - gboolean set = gtk_toggle_button_get_active ((GtkToggleButton *) prefs->daylight_saving); - calendar_config_set_daylight_saving (set); - timezone_changed (widget, prefs); -} - static void start_of_day_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) { @@ -504,7 +489,6 @@ setup_changes (CalendarPrefsDialog *prefs) g_signal_connect (G_OBJECT (prefs->timezone), "changed", G_CALLBACK (timezone_changed), prefs); g_signal_connect (G_OBJECT (prefs->day_second_zone), "clicked", G_CALLBACK (day_second_zone_clicked), prefs); - g_signal_connect (G_OBJECT (prefs->daylight_saving), "toggled", G_CALLBACK (daylight_saving_changed), prefs); g_signal_connect (G_OBJECT (prefs->start_of_day), "changed", G_CALLBACK (start_of_day_changed), prefs); g_signal_connect (G_OBJECT (prefs->end_of_day), "changed", G_CALLBACK (end_of_day_changed), prefs); @@ -632,7 +616,6 @@ show_config (CalendarPrefsDialog *prefs) gint mask, day, week_start_day, time_divisions; icaltimezone *zone; gboolean sensitive, set = FALSE; - icalcomponent *icalcomp, *dl_comp; char *location; CalUnits units; int interval; @@ -643,15 +626,6 @@ show_config (CalendarPrefsDialog *prefs) e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (prefs->timezone), zone); g_free (location); - icalcomp = icaltimezone_get_component (zone); - if (!icalcomp || !(dl_comp = icalcomponent_get_first_component (icalcomp, ICAL_XDAYLIGHT_COMPONENT))) - gtk_widget_set_sensitive ((GtkWidget *) prefs->daylight_saving, FALSE); - else - gtk_widget_set_sensitive ((GtkWidget *) prefs->daylight_saving, TRUE); - - set = calendar_config_get_daylight_saving (); - gtk_toggle_button_set_active ((GtkToggleButton *) prefs->daylight_saving, set); - /* Day's second zone */ update_day_second_zone_caption (prefs); @@ -790,7 +764,6 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs) /* General tab */ prefs->timezone = glade_xml_get_widget (gui, "timezone"); prefs->day_second_zone = glade_xml_get_widget (gui, "day_second_zone"); - prefs->daylight_saving = glade_xml_get_widget (gui, "daylight_cb"); for (i = 0; i < 7; i++) prefs->working_days[i] = glade_xml_get_widget (gui, working_day_names[i]); prefs->week_start_day = glade_xml_get_widget (gui, "week_start_day"); diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade index f3509e4f8f..23406d5963 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ b/calendar/gui/dialogs/cal-prefs-dialog.glade @@ -151,28 +151,6 @@ - - - True - True - Adjust for daylight sa_ving time - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 1 - 2 - 1 - 2 - fill - - - - True diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 3c006b8711..945c1d6e16 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -45,7 +45,6 @@ struct _CalendarPrefsDialog { /* General tab */ GtkWidget *timezone; GtkWidget *day_second_zone; - GtkWidget *daylight_saving; GtkWidget *working_days[7]; GtkWidget *week_start_day; GtkWidget *start_of_day; -- cgit v1.2.3 From c33335bc72d9db97248ea5c5dc6da9cbfdb16e2c Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 24 Apr 2009 19:11:03 +0200 Subject: Use system timezone in Evolution ** Fix for bug #381132 --- calendar/gui/dialogs/cal-prefs-dialog.c | 34 ++++- calendar/gui/dialogs/cal-prefs-dialog.glade | 206 +++++++++++++++++++++------- calendar/gui/dialogs/cal-prefs-dialog.h | 2 + 3 files changed, 190 insertions(+), 52 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index edb802fd10..60678d93e1 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -479,6 +479,30 @@ template_url_changed (GtkEntry *entry, CalendarPrefsDialog *prefs) calendar_config_set_free_busy_template (gtk_entry_get_text (entry)); } +static void +update_system_tz_widgets (CalendarPrefsDialog *prefs) +{ + icaltimezone *zone; + + zone = e_cal_util_get_system_timezone (); + if (zone) { + char *tmp = g_strdup_printf ("(%s)", icaltimezone_get_display_name (zone)); + gtk_label_set_text (GTK_LABEL (prefs->system_tz_label), tmp); + g_free (tmp); + } else { + gtk_label_set_text (GTK_LABEL (prefs->system_tz_label), "(UTC)"); + } + + gtk_widget_set_sensitive (prefs->timezone, !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prefs->use_system_tz_check))); +} + +static void +use_system_tz_changed (GtkWidget *check, CalendarPrefsDialog *prefs) +{ + calendar_config_set_use_system_timezone (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check))); + update_system_tz_widgets (prefs); +} + static void setup_changes (CalendarPrefsDialog *prefs) { @@ -487,6 +511,7 @@ setup_changes (CalendarPrefsDialog *prefs) for (i = 0; i < 7; i ++) g_signal_connect (G_OBJECT (prefs->working_days[i]), "toggled", G_CALLBACK (working_days_changed), prefs); + g_signal_connect (G_OBJECT (prefs->use_system_tz_check), "toggled", G_CALLBACK (use_system_tz_changed), prefs); g_signal_connect (G_OBJECT (prefs->timezone), "changed", G_CALLBACK (timezone_changed), prefs); g_signal_connect (G_OBJECT (prefs->day_second_zone), "clicked", G_CALLBACK (day_second_zone_clicked), prefs); @@ -620,8 +645,13 @@ show_config (CalendarPrefsDialog *prefs) CalUnits units; int interval; + /* Use system timezone */ + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->use_system_tz_check), calendar_config_get_use_system_timezone ()); + gtk_widget_set_sensitive (prefs->system_tz_label, FALSE); + update_system_tz_widgets (prefs); + /* Timezone. */ - location = calendar_config_get_timezone (); + location = calendar_config_get_timezone_stored (); zone = icaltimezone_get_builtin_timezone (location); e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (prefs->timezone), zone); g_free (location); @@ -762,6 +792,8 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs) e_config_add_items ((EConfig *) ec, l, NULL, NULL, eccp_free, prefs); /* General tab */ + prefs->use_system_tz_check = glade_xml_get_widget (gui, "use-system-tz-check"); + prefs->system_tz_label = glade_xml_get_widget (gui, "system-tz-label"); prefs->timezone = glade_xml_get_widget (gui, "timezone"); prefs->day_second_zone = glade_xml_get_widget (gui, "day_second_zone"); for (i = 0; i < 7; i++) diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade index 23406d5963..867abdbb22 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ b/calendar/gui/dialogs/cal-prefs-dialog.glade @@ -96,37 +96,103 @@ True - 4 + 5 2 False 6 6 - + True - make_timezone_entry - 0 - 0 - Thu, 13 Jan 2005 04:18:03 GMT - - - + Se_cond zone: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + day_second_zone + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 4 + 5 + fill + + + + + + + True + False + 0 + + + + True + True + None + True + GTK_RELIEF_NORMAL + True + + + 0 + True + True + + + + + + True + (Shown in a Day View) + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 6 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + 1 2 - 0 - 1 + 4 + 5 + fill fill - + True - Time _zone: - True + Time format: + False False GTK_JUSTIFY_LEFT False @@ -135,7 +201,6 @@ 0.5 0 0 - timezone PANGO_ELLIPSIZE_NONE -1 False @@ -144,8 +209,30 @@ 0 1 - 0 - 1 + 3 + 4 + fill + + + + + + + True + True + Adjust for daylight sa_ving time + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 1 + 2 + 1 + 2 fill @@ -199,34 +286,28 @@ 1 2 - 2 - 3 + 3 + 4 fill fill - + True - Time format: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 + True + Adjust for daylight sa_ving time + True + GTK_RELIEF_NORMAL + True + False + False + True - 0 - 1 + 1 + 2 2 3 fill @@ -235,9 +316,29 @@ - + True - Se_cond zone: + make_timezone_entry + 0 + 0 + Thu, 13 Jan 2005 04:18:03 GMT + + + + + + 1 + 2 + 1 + 2 + fill + + + + + + True + Time _zone: True False GTK_JUSTIFY_LEFT @@ -247,7 +348,7 @@ 0.5 0 0 - day_second_zone + timezone PANGO_ELLIPSIZE_NONE -1 False @@ -256,39 +357,42 @@ 0 1 - 3 - 4 + 0 + 1 fill - + True False 0 - + True True - None + Use s_ystem time zone True GTK_RELIEF_NORMAL True + False + False + True 0 - True + False True - + True - (Shown in a Day View) + (system/tz) False False GTK_JUSTIFY_LEFT @@ -296,7 +400,7 @@ False 0.5 0.5 - 6 + 5 0 PANGO_ELLIPSIZE_NONE -1 @@ -313,10 +417,9 @@ 1 2 - 3 - 4 + 0 + 1 fill - fill @@ -1246,6 +1349,7 @@ Days False + True diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 945c1d6e16..559eacced7 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -43,6 +43,8 @@ struct _CalendarPrefsDialog { GConfClient *gconf; /* General tab */ + GtkWidget *use_system_tz_check; + GtkWidget *system_tz_label; GtkWidget *timezone; GtkWidget *day_second_zone; GtkWidget *working_days[7]; -- cgit v1.2.3