From ac0c655f3f2a8e47b0cca877aabae66421c58187 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 15 Jul 2008 18:34:59 +0000 Subject: Migrate CompEditor, CompEditorPage, and the various subclasses from BonoboUI to GtkUIManager. See bug #542125. svn path=/branches/kill-bonobo/; revision=35746 --- 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 | 2599 ++++++++++++++++-------------- 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 | 869 +++++----- 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 | 206 +-- 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 | 739 ++++----- calendar/gui/dialogs/task-page.h | 92 +- 24 files changed, 4188 insertions(+), 4966 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..ae56633d85 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 void obj_modified_cb (ECal *client, GList *objs, CompEditor *editor); +static void obj_removed_cb (ECal *client, GList *uids, CompEditor *editor); 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,115 +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; - /* Mark the editor as changed so it prompts about unsaved - changes on close */ - comp_editor_set_changed (editor, TRUE); + focus = gtk_window_get_focus (GTK_WINDOW (editor)); + if (GTK_IS_ENTRY (focus)) + gtk_editable_cut_clipboard (GTK_EDITABLE (focus)); + + if (GTK_IS_TEXT_VIEW (focus)) + g_signal_emit_by_name (focus, "cut-clipboard"); } static void -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); - - /* 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")); + comp_editor_show_help (editor); +} + +static void +action_paste_cb (GtkAction *action, + CompEditor *editor) +{ + GtkWidget *focus; + + focus = gtk_window_get_focus (GTK_WINDOW (editor)); + + if (GTK_IS_ENTRY (focus)) + gtk_editable_paste_clipboard (GTK_EDITABLE (focus)); + + if (GTK_IS_TEXT_VIEW (focus)) + g_signal_emit_by_name (focus, "paste-clipboard"); +} + +static void +action_print_cb (GtkAction *action, + CompEditor *editor) +{ + CompEditorPrivate *priv = editor->priv; + ECalComponent *comp; + GList *l; + icalcomponent *icalcomp = e_cal_component_get_icalcomponent (priv->comp); + + comp = e_cal_component_new (); + e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp)); + + for (l = priv->pages; l != NULL; l = l->next) + comp_editor_page_fill_component (l->data, comp); + + print_comp (comp, priv->client, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG); + + g_object_unref (comp); +} + +static void +action_print_preview_cb (GtkAction *action, + CompEditor *editor) +{ + CompEditorPrivate *priv = editor->priv; + ECalComponent *comp; + GList *l; + icalcomponent *icalcomp = e_cal_component_get_icalcomponent (priv->comp); + + comp = e_cal_component_new (); + e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp)); + for (l = priv->pages; l != NULL; l = l->next) + comp_editor_page_fill_component (l->data, comp); + print_comp (comp, priv->client, TRUE); + + g_object_unref (comp); +} + +static void +action_save_cb (GtkAction *action, + CompEditor *editor) +{ + CompEditorPrivate *priv = editor->priv; + ECalComponentText text; + gboolean delegated = FALSE; + gboolean read_only, correct = FALSE; + ECalComponent *comp; + + if (e_attachment_bar_get_download_count (E_ATTACHMENT_BAR (editor->priv->attachment_bar)) ){ + gboolean response = 1; + /*FIXME: Cannot use mail functions from calendar!!!! */ +#if 0 + ECalComponentVType vtype = e_cal_component_get_vtype(editor->priv->comp); + + if (vtype == E_CAL_COMPONENT_EVENT) + response = em_utils_prompt_user((GtkWindow *)widget, + NULL, + "calendar:ask-send-event-pending-download", + NULL); + else + response = em_utils_prompt_user((GtkWindow *)widget, + NULL, + "calendar:ask-send-task-pending-download", + NULL); +#endif + if (!response) + return; + } + + if (!e_cal_is_read_only (priv->client, &read_only, NULL) || read_only) { + e_error_run ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (editor)), "calendar:prompt-read-only-cal-editor", e_source_peek_name (e_cal_get_source (priv->client)), NULL); + return; + } + + commit_all_fields (editor); + if (e_cal_component_is_instance (priv->comp)) + if (!recur_component_dialog (priv->client, priv->comp, &priv->mod, GTK_WINDOW (editor), delegated)) + return; + + comp = comp_editor_get_current_comp (editor, &correct); + e_cal_component_get_summary (comp, &text); + g_object_unref (comp); + + if (!correct) + return; + + if (!text.value) + if (!send_component_prompt_subject ((GtkWindow *) editor, priv->client, priv->comp)) + return; + if (save_comp_with_send (editor)) + close_dialog (editor); + +} + +static void +action_select_all_cb (GtkAction *action, + CompEditor *editor) +{ + GtkWidget *focus; + + focus = gtk_window_get_focus (GTK_WINDOW (editor)); + + if (GTK_IS_ENTRY (focus)) { + gtk_editable_set_position (GTK_EDITABLE (focus), -1); + gtk_editable_select_region (GTK_EDITABLE (focus), 0, -1); + } + + if (GTK_IS_TEXT_VIEW (focus)) + g_signal_emit_by_name (focus, "select-all", TRUE); +} + +static void +action_view_categories_cb (GtkToggleAction *action, + CompEditor *editor) +{ + CompEditorClass *class; + gboolean active; + + class = COMP_EDITOR_GET_CLASS (editor); + active = gtk_toggle_action_get_active (action); + + if (class->show_categories != NULL) + class->show_categories (editor, active); +} + +static void +action_view_role_cb (GtkToggleAction *action, + CompEditor *editor) +{ + CompEditorClass *class; + gboolean active; + + class = COMP_EDITOR_GET_CLASS (editor); + active = gtk_toggle_action_get_active (action); + + if (class->show_role != NULL) + class->show_role (editor, active); +} + +static void +action_view_rsvp_cb (GtkToggleAction *action, + CompEditor *editor) +{ + CompEditorClass *class; + gboolean active; + + class = COMP_EDITOR_GET_CLASS (editor); + active = gtk_toggle_action_get_active (action); + + if (class->show_rsvp != NULL) + class->show_rsvp (editor, active); +} + +static void +action_view_status_cb (GtkToggleAction *action, + CompEditor *editor) +{ + CompEditorClass *class; + gboolean active; + + class = COMP_EDITOR_GET_CLASS (editor); + active = gtk_toggle_action_get_active (action); + + if (class->show_status != NULL) + class->show_status (editor, active); +} + +static void +action_view_time_zone_cb (GtkToggleAction *action, + CompEditor *editor) +{ + CompEditorClass *class; + gboolean active; + + class = COMP_EDITOR_GET_CLASS (editor); + active = gtk_toggle_action_get_active (action); + + if (class->show_time_zone != NULL) + class->show_time_zone (editor, active); +} + +static void +action_view_type_cb (GtkToggleAction *action, + CompEditor *editor) +{ + CompEditorClass *class; + gboolean active; + + class = COMP_EDITOR_GET_CLASS (editor); + active = gtk_toggle_action_get_active (action); + + if (class->show_type != NULL) + class->show_type (editor, active); +} + +static GtkActionEntry core_entries[] = { + + { "close", + GTK_STOCK_CLOSE, + NULL, + NULL, + N_("Click here to close the current window"), + G_CALLBACK (action_close_cb) }, + + { "copy", + GTK_STOCK_COPY, + NULL, + NULL, + N_("Copy selected text to the clipboard"), + G_CALLBACK (action_copy_cb) }, + + { "cut", + GTK_STOCK_CUT, + NULL, + NULL, + N_("Cut selected text to the clipboard"), + G_CALLBACK (action_cut_cb) }, + + { "help", + GTK_STOCK_HELP, + NULL, + NULL, + N_("Click here to view help available"), + G_CALLBACK (action_help_cb) }, + + { "paste", + GTK_STOCK_PASTE, + NULL, + NULL, + N_("Paste text from the clipboard"), + G_CALLBACK (action_paste_cb) }, + + { "print", + GTK_STOCK_PRINT, + NULL, + NULL, + NULL, + G_CALLBACK (action_print_cb) }, + + { "print-preview", + GTK_STOCK_PRINT_PREVIEW, + NULL, + NULL, + NULL, + G_CALLBACK (action_print_preview_cb) }, + + { "save", + GTK_STOCK_SAVE, + NULL, + NULL, + N_("Click here to save the current window"), + G_CALLBACK (action_save_cb) }, + + { "select-all", + GTK_STOCK_SELECT_ALL, + NULL, + NULL, + N_("Select all text"), + G_CALLBACK (action_select_all_cb) }, + + /* Menus */ + + { "classification-menu", + NULL, + N_("_Classification"), + NULL, + NULL, + NULL }, + + { "edit-menu", + NULL, + N_("_Edit"), + NULL, + NULL, + NULL }, + + { "file-menu", + NULL, + N_("_File"), + NULL, + NULL, + NULL }, + + { "help-menu", + NULL, + N_("_Help"), + NULL, + NULL, + NULL }, + + { "insert-menu", + NULL, + N_("_Insert"), + NULL, + NULL, + NULL }, + + { "options-menu", + NULL, + N_("_Options"), + NULL, + NULL, + NULL }, + + { "view-menu", + NULL, + N_("_View"), + NULL, + NULL, + NULL } +}; + +static GtkActionEntry individual_entries[] = { + + { "attach", + "mail-attachment", + N_("_Attachment..."), + "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, + 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, + CompEditor *editor) +{ + 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")); } static gboolean @@ -1186,380 +2092,107 @@ cab_popup(EAttachmentBar *bar, GdkEventButton *event, int id) 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; - - 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 +2204,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 +2224,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 +2243,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 +2268,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 +2289,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)); +} - return priv->is_group_item; +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"); +} + +const gchar * +comp_editor_get_summary (CompEditor *editor) +{ + g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); + + return editor->priv->summary; } /** @@ -1889,16 +2415,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 +2456,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; +} + +GtkUIManager * +comp_editor_get_ui_manager (CompEditor *editor) +{ + g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); + + return editor->priv->manager; +} + +GtkAction * +comp_editor_get_action (CompEditor *editor, + const gchar *action_name) +{ + GtkAction *action = NULL; + GList *iter; - priv = editor->priv; + g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); + g_return_val_if_fail (action_name != NULL, NULL); + + iter = gtk_ui_manager_get_action_groups (editor->priv->manager); + while (iter != NULL && action == NULL) { + GtkActionGroup *action_group = iter->data; + + action = gtk_action_group_get_action ( + action_group, action_name); + iter = g_list_next (iter); + } + g_return_val_if_fail (action != NULL, NULL); - return priv->changed; + return action; } -void -comp_editor_set_flags (CompEditor *editor, CompEditorFlags flags) +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_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) { + 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); + } - priv->flags = flags; + g_return_val_if_reached (NULL); } - -CompEditorFlags -comp_editor_get_flags (CompEditor *editor) +GtkWidget * +comp_editor_get_managed_widget (CompEditor *editor, + const gchar *widget_path) { + GtkUIManager *manager; + GtkWidget *widget; - CompEditorPrivate *priv; - - 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), NULL); + g_return_val_if_fail (widget_path != NULL, NULL); - priv = editor->priv; + 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 priv->flags; + return widget; } /** @@ -1957,13 +2560,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 +2580,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 +2601,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 +2638,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 +2668,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 +2702,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 +2736,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 +2747,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)); - klass = COMP_EDITOR_CLASS (G_OBJECT_GET_CLASS (editor)); + if (client != NULL) + g_object_ref (client); + + if (editor->priv->client != NULL) + g_object_unref (editor->priv->client); + + editor->priv->client = client; + + if (editor->priv->source_client == NULL && client != NULL) + editor->priv->source_client = g_object_ref (client); - if (klass->set_e_cal) - klass->set_e_cal (editor, 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 +2783,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 +2906,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 +2928,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 +3000,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 +3033,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 +3089,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 +3124,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 +3161,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 +3187,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 +3204,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 +3267,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) { @@ -3024,9 +3287,10 @@ page_dates_changed_cb (GtkObject *obj, } static void -obj_modified_cb (ECal *client, GList *objects, gpointer data) +obj_modified_cb (ECal *client, + GList *objects, + CompEditor *editor) { - CompEditor *editor = COMP_EDITOR (data); CompEditorPrivate *priv; ECalComponent *comp = NULL; @@ -3059,12 +3323,11 @@ obj_modified_cb (ECal *client, GList *objects, gpointer data) } static void -obj_removed_cb (ECal *client, GList *uids, gpointer data) +obj_removed_cb (ECal *client, + GList *uids, + CompEditor *editor) { - CompEditor *editor = COMP_EDITOR (data); - CompEditorPrivate *priv; - - priv = editor->priv; + CompEditorPrivate *priv = editor->priv; if (changed_component_dialog ((GtkWindow *) editor, priv->comp, TRUE, priv->changed)) close_dialog (editor); 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..ef103ac0c0 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,92 @@ 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->dispose = event_page_dispose; + 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 +283,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 +330,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 +361,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 +377,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 +453,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 +477,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 +682,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 +700,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 +749,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 +774,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 +800,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 +878,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 +893,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 +939,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 +958,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 +974,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 +996,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 +1007,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 +1038,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 +1054,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 +1095,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 +1112,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 +1127,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 +1264,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 +1391,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 +1435,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 +1499,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 +1568,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 +1630,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 +1685,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 */ @@ -1891,31 +1796,31 @@ remove_clicked_cb (GtkButton *btn, EventPage *epage) } static void -invite_cb (GtkWidget *widget, gpointer data) +invite_cb (GtkWidget *widget, + EventPage *page) { - EventPage *page; - EventPagePrivate *priv; - - page = EVENT_PAGE (data); - priv = page->priv; - - e_meeting_list_view_invite_others_dialog (priv->list_view); + e_meeting_list_view_invite_others_dialog (page->priv->list_view); } 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 +1835,7 @@ attendee_added_cb (EMeetingListView *emlv, EMeetingAttendee *ia, gpointer user_d gtk_widget_set_sensitive (priv->edit, FALSE); } } - } +} } @@ -1972,7 +1877,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 +1889,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 +1920,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 +1938,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 +1985,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 +2020,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 +2040,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 +2086,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 +2249,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 +2366,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. */ @@ -2565,14 +2450,10 @@ times_updated (EventPage *epage, gboolean adjust_end_time) * start date < end date and we set the "all day event" button as appropriate. */ static void -start_date_changed_cb (GtkWidget *dedit, gpointer data) +start_date_changed_cb (GtkWidget *dedit, + EventPage *epage) { - EventPage *epage; - - epage = EVENT_PAGE (data); - hour_minute_changed (epage); - times_updated (epage, TRUE); } @@ -2580,12 +2461,9 @@ start_date_changed_cb (GtkWidget *dedit, gpointer data) * start date < end date and we set the "all day event" button as appropriate. */ static void -end_date_changed_cb (GtkWidget *dedit, gpointer data) +end_date_changed_cb (GtkWidget *dedit, + EventPage *epage) { - EventPage *epage; - - epage = EVENT_PAGE (data); - times_updated (epage, FALSE); } @@ -2594,22 +2472,19 @@ end_date_changed_cb (GtkWidget *dedit, gpointer data) * labels on the other notebook pages. */ static void -start_timezone_changed_cb (GtkWidget *widget, gpointer data) +start_timezone_changed_cb (GtkWidget *widget, + EventPage *epage) { - EventPage *epage; - EventPagePrivate *priv; + EventPagePrivate *priv = epage->priv; icaltimezone *zone; - epage = EVENT_PAGE (data); - priv = epage->priv; - 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); @@ -2619,27 +2494,27 @@ start_timezone_changed_cb (GtkWidget *widget, gpointer data) * category list dialog. */ static void -categories_clicked_cb (GtkWidget *button, gpointer data) +categories_clicked_cb (GtkWidget *button, + EventPage *epage) { - EventPage *epage; - EventPagePrivate *priv; - GtkWidget *entry; - - epage = EVENT_PAGE (data); - priv = epage->priv; + GtkEntry *entry; - entry = priv->categories; - e_categories_config_open_dialog_for_entry (GTK_ENTRY (entry)); + entry = GTK_ENTRY (epage->priv->categories); + e_categories_config_open_dialog_for_entry (entry); } 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 +2524,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 +2532,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")) @@ -2753,13 +2619,10 @@ set_subscriber_info_string (EventPage *epage, const char *backend_address) } static void -alarm_changed_cb (GtkWidget *widget, gpointer data) +alarm_changed_cb (GtkWidget *widget, + EventPage *epage) { - EventPage *epage; - EventPagePrivate *priv; - - epage = EVENT_PAGE (data); - priv = epage->priv; + EventPagePrivate *priv = epage->priv; if (e_dialog_option_menu_get (priv->alarm_time, alarm_map) != ALARM_NONE) { ECalComponentAlarm *ca; @@ -2841,38 +2704,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 +2739,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 +2759,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 +2786,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 +2808,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 +2850,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 +2925,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 +2973,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 +2988,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 +3034,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 +3044,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 +3105,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..bfc0a12e2d 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_dispose (GObject *object) +{ + TaskDetailsPagePrivate *priv; + + priv = TASK_DETAILS_PAGE_GET_PRIVATE (object); + + if (priv->main != NULL) { + g_object_unref (priv->main); + priv->main = NULL; + } + + if (priv->xml != NULL) { + g_object_unref (priv->xml); + priv->xml = NULL; + } + + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (task_details_page_parent_class)->dispose (object); +} + static void task_details_page_class_init (TaskDetailsPageClass *class) { - CompEditorPageClass *editor_page_class; GObjectClass *object_class; + CompEditorPageClass *editor_page_class; + + g_type_class_add_private (class, sizeof (TaskDetailsPagePrivate)); - editor_page_class = (CompEditorPageClass *) class; - object_class = (GObjectClass *) class; + object_class = G_OBJECT_CLASS (class); + object_class->dispose = task_details_page_dispose; + 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; - - object_class->finalize = task_details_page_finalize; } -/* Object initialization function for the task page */ static void task_details_page_init (TaskDetailsPage *tdpage) { - 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; - - priv->date_completed_label = NULL; - priv->completed_date = NULL; - - priv->url_label = NULL; - priv->url_entry = NULL; - priv->url = NULL; - - priv->updating = FALSE; + tdpage->priv = TASK_DETAILS_PAGE_GET_PRIVATE (tdpage); } -/* Destroy handler for the task page */ -static void -task_details_page_finalize (GObject *object) -{ - 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); -} - - - /* 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; @@ -549,22 +513,19 @@ complete_date_changed (TaskDetailsPage *tdpage, time_t ctime, gboolean complete) } static void -date_changed_cb (EDateEdit *dedit, gpointer data) +date_changed_cb (EDateEdit *dedit, + TaskDetailsPage *tdpage) { - TaskDetailsPage *tdpage; - TaskDetailsPagePrivate *priv; + TaskDetailsPagePrivate *priv = tdpage->priv; CompEditorPageDates dates = {NULL, NULL, NULL, NULL}; struct icaltimetype completed_tt = icaltime_null_time (); icalproperty_status status; gboolean date_set; - 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 +554,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 +566,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 +597,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 +608,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 +639,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_set_updating (COMP_EDITOR_PAGE (tdpage), 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; - - 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 +674,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 +704,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 +730,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 +746,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..7c5400568c 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->updating = FALSE; - priv->sendoptions_shown = FALSE; - priv->is_assignment = FALSE; - - priv->deleted_attendees = g_ptr_array_new (); + priv = TASK_PAGE_GET_PRIVATE (object); - 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); } } @@ -1191,46 +1119,45 @@ remove_clicked_cb (GtkButton *btn, TaskPage *page) } static void -invite_cb (GtkWidget *widget, gpointer data) +invite_cb (GtkWidget *widget, + TaskPage *page) { - TaskPage *page; - TaskPagePrivate *priv; - - page = TASK_PAGE (data); - priv = page->priv; - - e_meeting_list_view_invite_others_dialog (priv->list_view); + e_meeting_list_view_invite_others_dialog (page->priv->list_view); } 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 +1198,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 +1211,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 +1241,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 +1260,18 @@ static gboolean list_view_event (EMeetingListView *list_view, GdkEvent *event, TaskPage *page) { TaskPagePrivate *priv= page->priv; + CompEditor *editor; + CompEditorFlags flags; - if (event->type == GDK_2BUTTON_PRESS && COMP_EDITOR_PAGE (page)->flags & COMP_EDITOR_PAGE_USER_ORG) { + editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page)); + flags = comp_editor_get_flags (editor); + + 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 +1363,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 +1452,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); } @@ -1563,20 +1472,17 @@ summary_changed_cb (GtkEditable *editable, gpointer data) * other pages in the task editor, so they can update any labels. */ static void -date_changed_cb (EDateEdit *dedit, gpointer data) +date_changed_cb (EDateEdit *dedit, + TaskPage *tpage) { - TaskPage *tpage; - TaskPagePrivate *priv; + TaskPagePrivate *priv = tpage->priv; CompEditorPageDates dates; gboolean date_set, time_set; ECalComponentDateTime start_dt, due_dt; struct icaltimetype start_tt = icaltime_null_time(); struct icaltimetype due_tt = icaltime_null_time(); - 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), @@ -1632,68 +1538,24 @@ date_changed_cb (EDateEdit *dedit, gpointer data) } static void -timezone_changed_cb (EDateEdit *dedit, gpointer data) +timezone_changed_cb (EDateEdit *dedit, + TaskPage *tpage) { - TaskPage *tpage; - TaskPagePrivate *priv; - - tpage = TASK_PAGE (data); - priv = tpage->priv; - - date_changed_cb ((EDateEdit *) priv->start_date, tpage); - date_changed_cb ((EDateEdit *) priv->due_date, tpage); + date_changed_cb ((EDateEdit *) tpage->priv->start_date, tpage); + date_changed_cb ((EDateEdit *) tpage->priv->due_date, tpage); } /* Callback used when the categories button is clicked; we must bring up the * category list dialog. */ static void -categories_clicked_cb (GtkWidget *button, gpointer data) -{ - TaskPage *tpage; - TaskPagePrivate *priv; - GtkWidget *entry; - - tpage = TASK_PAGE (data); - priv = tpage->priv; - - 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) +categories_clicked_cb (GtkWidget *button, + TaskPage *tpage) { - TaskPage *tpage; - TaskPagePrivate *priv; + GtkEntry *entry; - tpage = TASK_PAGE (data); - priv = tpage->priv; - - if (!priv->updating) - comp_editor_page_notify_changed (COMP_EDITOR_PAGE (tpage)); + entry = GTK_ENTRY (tpage->priv->categories); + e_categories_config_open_dialog_for_entry (entry); } static gboolean @@ -1758,7 +1620,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 +1683,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 +1781,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 +1798,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 +1856,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 +1929,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 +2062,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 cea054cd54d84479352a43bbabc19c9ce9af5efb Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 8 Aug 2008 04:26:12 +0000 Subject: Merge revisions 35747:35930 from trunk. svn path=/branches/kill-bonobo/; revision=35931 --- 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 +- calendar/gui/dialogs/task-details-page.c | 3 +++ calendar/gui/dialogs/task-page.c | 3 +++ 8 files changed, 12 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 ae56633d85..9a08009b6c 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) diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index bfc0a12e2d..487ed4e9c5 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -522,6 +522,9 @@ date_changed_cb (EDateEdit *dedit, icalproperty_status status; gboolean date_set; + tdpage = TASK_DETAILS_PAGE (data); + priv = tdpage->priv; + if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (tdpage))) return; diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 7c5400568c..31c10b5dc2 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -1482,6 +1482,9 @@ date_changed_cb (EDateEdit *dedit, struct icaltimetype start_tt = icaltime_null_time(); struct icaltimetype due_tt = icaltime_null_time(); + tpage = TASK_PAGE (data); + priv = tpage->priv; + if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (tpage))) return; -- cgit v1.2.3 From 7ade227e6409c98a4010992450e111cf7bb10520 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 14 Aug 2008 20:19:12 +0000 Subject: Merge revisions 35951:35992 from trunk. svn path=/branches/kill-bonobo/; revision=35994 --- 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/comp-editor.c | 8 ++------ 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 | 5 ++--- calendar/gui/dialogs/event-page.glade | 2 +- calendar/gui/dialogs/memo-page.c | 2 +- calendar/gui/dialogs/memo-page.glade | 1 + calendar/gui/dialogs/select-source-dialog.c | 16 ++++++---------- calendar/gui/dialogs/task-editor.c | 1 - calendar/gui/dialogs/task-page.glade | 4 ++-- 16 files changed, 26 insertions(+), 68 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/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 9a08009b6c..3ae846ac79 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 @@ -2255,16 +2256,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); } 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 ef103ac0c0..9737d08fca 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); @@ -2544,8 +2543,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/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.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; 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/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 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 06c449751cab10e94281911a4dba703616754c52 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 30 Aug 2008 22:11:55 +0000 Subject: ** Fixes bug #549968 2008-08-30 Matthew Barnes ** Fixes bug #549968 * calendar/gui/dialogs/comp-editor.c (comp_editor_init): * widgets/misc/e-attachment-bar.c (e_attachment_bar_bonobo_ui_populate_with): Use the same mnemonic for "Recent Documents" as composer. svn path=/branches/kill-bonobo/; revision=36226 --- 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 3ae846ac79..441358adc8 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 6545899a2972546a035da4d73c3625b9e8bb7438 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 11 Sep 2008 04:42:53 +0000 Subject: Add menu and toolbar UI for calendars, memos and tasks. svn path=/branches/kill-bonobo/; revision=36299 --- calendar/gui/dialogs/cal-prefs-dialog.h | 1 - calendar/gui/dialogs/comp-editor.c | 1 - calendar/gui/dialogs/event-editor.c | 1 - calendar/gui/dialogs/memo-editor.c | 1 - calendar/gui/dialogs/task-details-page.c | 1 - calendar/gui/dialogs/task-editor.c | 1 - calendar/gui/dialogs/task-page.c | 1 - 7 files changed, 7 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..9ab4ebefd9 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -29,7 +29,6 @@ #include #include #include -#include "evolution-config-control.h" G_BEGIN_DECLS diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 441358adc8..ee5ad096d0 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index ca1b581ee6..99750b27c5 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -34,7 +34,6 @@ #include #include #include -#include #include "event-page.h" #include "recurrence-page.h" diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c index a4c73e8dee..692e1fc256 100644 --- a/calendar/gui/dialogs/memo-editor.c +++ b/calendar/gui/dialogs/memo-editor.c @@ -34,7 +34,6 @@ #include #include -#include #include "memo-page.h" #include "cancel-comp.h" diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index 487ed4e9c5..ffd3be6c6e 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -522,7 +522,6 @@ date_changed_cb (EDateEdit *dedit, icalproperty_status status; gboolean date_set; - tdpage = TASK_DETAILS_PAGE (data); priv = tdpage->priv; if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (tdpage))) diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 1d947ead13..17339e31b5 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -33,7 +33,6 @@ #include #include -#include #include "task-page.h" #include "task-details-page.h" diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 31c10b5dc2..29f443c0d6 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -1482,7 +1482,6 @@ date_changed_cb (EDateEdit *dedit, struct icaltimetype start_tt = icaltime_null_time(); struct icaltimetype due_tt = icaltime_null_time(); - tpage = TASK_PAGE (data); priv = tpage->priv; if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (tpage))) -- cgit v1.2.3 From c0a255eb90769638d57ae4122932f75c46e4e531 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 11 Sep 2008 15:34:29 +0000 Subject: Merge revisions 36016:36303 from trunk. svn path=/branches/kill-bonobo/; revision=36307 --- calendar/gui/dialogs/alarm-dialog.c | 38 +++++++++++------------ calendar/gui/dialogs/alarm-dialog.h | 35 ++++++++++++--------- calendar/gui/dialogs/alarm-list-dialog.c | 38 ++++++++++++----------- calendar/gui/dialogs/alarm-list-dialog.h | 35 ++++++++++++--------- calendar/gui/dialogs/cal-attachment-select-file.c | 28 ++++++++--------- calendar/gui/dialogs/cal-attachment-select-file.h | 26 ++++++++-------- calendar/gui/dialogs/calendar-setup.c | 25 ++++++++------- calendar/gui/dialogs/calendar-setup.h | 24 +++++++------- calendar/gui/dialogs/cancel-comp.c | 28 ++++++++++------- calendar/gui/dialogs/cancel-comp.h | 27 +++++++++------- calendar/gui/dialogs/changed-comp.h | 28 +++++++++-------- calendar/gui/dialogs/comp-editor-page.c | 27 +++++++++------- 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/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.c | 29 +++++++++-------- calendar/gui/dialogs/e-delegate-dialog.h | 27 +++++++++------- 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/memo-editor.h | 34 +++++++++++--------- calendar/gui/dialogs/memo-page.h | 33 +++++++++++--------- calendar/gui/dialogs/recur-comp.h | 28 ++++++++++------- calendar/gui/dialogs/recurrence-page.h | 35 ++++++++++++--------- calendar/gui/dialogs/save-comp.c | 28 +++++++++-------- calendar/gui/dialogs/save-comp.h | 30 ++++++++++-------- calendar/gui/dialogs/schedule-page.c | 34 +++++++++++--------- calendar/gui/dialogs/schedule-page.h | 28 ++++++++++------- calendar/gui/dialogs/select-source-dialog.c | 27 +++++++++------- calendar/gui/dialogs/select-source-dialog.h | 27 +++++++++------- calendar/gui/dialogs/send-comp.c | 28 ++++++++++------- calendar/gui/dialogs/send-comp.h | 27 +++++++++------- calendar/gui/dialogs/task-details-page.c | 34 +++++++++++--------- calendar/gui/dialogs/task-details-page.h | 33 +++++++++++--------- calendar/gui/dialogs/task-editor.c | 36 +++++++++++---------- calendar/gui/dialogs/task-editor.h | 33 +++++++++++--------- calendar/gui/dialogs/task-page.h | 33 +++++++++++--------- 43 files changed, 724 insertions(+), 580 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-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.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/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.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/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.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) * */ 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.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/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/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.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/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/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.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-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/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 99750b27c5..c4393b0174 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 692e1fc256..377cceef84 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/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/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/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/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/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.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/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.c b/calendar/gui/dialogs/task-details-page.c index ffd3be6c6e..81358901ba 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-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-editor.c b/calendar/gui/dialogs/task-editor.c index 17339e31b5..57a4063755 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__ 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 9515b98403f2f7ef77dc6c51f82505fccef08c2b Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 24 Sep 2008 22:53:30 +0000 Subject: Saving progress. Experimenting with directory layout. Saving progress. Experimenting with directory layout. svn path=/branches/kill-bonobo/; revision=36446 --- calendar/gui/dialogs/comp-editor.c | 41 +++++++++++++++++++++++++++++++++++--- calendar/gui/dialogs/comp-editor.h | 3 +++ 2 files changed, 41 insertions(+), 3 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index ee5ad096d0..430b559948 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -214,7 +214,15 @@ enum { LAST_SIGNAL }; -static guint comp_editor_signals[LAST_SIGNAL] = { 0 }; +static guint signals[LAST_SIGNAL]; +static GList *active_editors; + +static void +comp_editor_weak_notify_cb (gpointer unused, + GObject *where_the_object_was) +{ + active_editors = g_list_remove (active_editors, where_the_object_was); +} static void attach_message(CompEditor *editor, CamelMimeMessage *msg) @@ -1704,7 +1712,7 @@ comp_editor_class_init (CompEditorClass *class) NULL, G_PARAM_READWRITE)); - comp_editor_signals[OBJECT_CREATED] = + signals[OBJECT_CREATED] = g_signal_new ("object_created", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, @@ -1724,6 +1732,12 @@ comp_editor_init (CompEditor *editor) editor->priv = priv = COMP_EDITOR_GET_PRIVATE (editor); + g_object_weak_ref ( + G_OBJECT (editor), (GWeakNotify) + comp_editor_weak_notify_cb, NULL); + + active_editors = g_list_prepend (active_editors, editor); + priv->pages = NULL; priv->changed = FALSE; priv->needs_send = FALSE; @@ -2279,7 +2293,18 @@ close_dialog (CompEditor *editor) gtk_widget_destroy (GTK_WIDGET (editor)); } - +gint +comp_editor_compare (CompEditor *editor_a, + CompEditor *editor_b) +{ + const gchar *uid_a = NULL; + const gchar *uid_b = NULL; + + e_cal_component_get_uid (editor_a->priv->comp, &uid_a); + e_cal_component_get_uid (editor_b->priv->comp, &uid_b); + + return g_strcmp0 (uid_a, uid_b); +} void comp_editor_set_existing_org (CompEditor *editor, gboolean existing_org) @@ -2547,6 +2572,16 @@ comp_editor_get_managed_widget (CompEditor *editor, return widget; } +CompEditor * +comp_editor_find_instance (const gchar *uid) +{ + g_return_val_if_fail (uid != NULL, NULL); + + return g_list_find_custom ( + active_editors, uid, + (GCompareFunc) comp_editor_compare); +} + /** * comp_editor_set_needs_send: * @editor: A component editor diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 9289b9ced7..23a8d3acea 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -87,6 +87,8 @@ typedef enum { } CompEditorFlags; GType comp_editor_get_type (void); +gint comp_editor_compare (CompEditor *editor_a, + CompEditor *editor_b); void comp_editor_set_changed (CompEditor *editor, gboolean changed); gboolean comp_editor_get_changed (CompEditor *editor); @@ -149,6 +151,7 @@ GtkActionGroup * const gchar *group_name); GtkWidget * comp_editor_get_managed_widget (CompEditor *editor, const gchar *widget_path); +CompEditor * comp_editor_find_instance (const gchar *uid); G_END_DECLS -- cgit v1.2.3 From 098ea8aad8d3249d9faca5df5b4fe67b94ba660f Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 29 Sep 2008 16:14:46 +0000 Subject: Get Memos to come up. Doesn't really work yet, but the widgets are all there. svn path=/branches/kill-bonobo/; revision=36491 --- 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 430b559948..14d20b1b86 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -274,6 +274,7 @@ struct _drop_data { static void drop_action(CompEditor *editor, GdkDragContext *context, guint32 action, GtkSelectionData *selection, guint info, guint time) { +#if 0 /* KILL-BONOBO */ char *tmp, *str, **urls; CamelMimePart *mime_part; CamelStream *stream; @@ -460,6 +461,7 @@ drop_action(CompEditor *editor, GdkDragContext *context, guint32 action, GtkSele printf("Drag finished, success %d delete %d\n", success, delete); gtk_drag_finish(context, success, delete, time); +#endif } static void -- cgit v1.2.3 From b2cda1d0c6d44f53f71bad9e256f41188677dfba Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 1 Oct 2008 20:56:04 +0000 Subject: Merge revisions 36016:36533 from trunk. svn path=/branches/kill-bonobo/; revision=36534 --- calendar/gui/dialogs/alarm-list-dialog.c | 2 +- calendar/gui/dialogs/cal-prefs-dialog.c | 31 ++++++++++++----------- calendar/gui/dialogs/cal-prefs-dialog.h | 29 +++++++++++----------- calendar/gui/dialogs/changed-comp.c | 28 ++++++++++++--------- calendar/gui/dialogs/comp-editor.c | 2 +- calendar/gui/dialogs/copy-source-dialog.c | 28 ++++++++++++--------- calendar/gui/dialogs/delete-comp.c | 28 ++++++++++++--------- calendar/gui/dialogs/delete-error.c | 28 ++++++++++++--------- 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/recur-comp.c | 28 ++++++++++++--------- calendar/gui/dialogs/recurrence-page.c | 38 +++++++++++++++-------------- calendar/gui/dialogs/task-page.c | 34 ++++++++++++++------------ 14 files changed, 205 insertions(+), 169 deletions(-) (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; } 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/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 9ab4ebefd9..49d4c56482 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/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/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 14d20b1b86..5e19e690eb 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -2877,7 +2877,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 (); 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-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 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 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 9737d08fca..2855113e92 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/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 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 diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 29f443c0d6..a4bc4816a3 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 85b2913a380c69f14ae0254ad23b10fabfb33667 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 24 Oct 2008 23:52:05 +0000 Subject: Merge revisions 36534:36684 from trunk. svn path=/branches/kill-bonobo/; revision=36685 --- calendar/gui/dialogs/calendar-setup.c | 3 ++- calendar/gui/dialogs/comp-editor.c | 32 ++++++++++++++++++++------------ 2 files changed, 22 insertions(+), 13 deletions(-) (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; diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 5e19e690eb..c1f123e836 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 @@ -1752,6 +1756,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 4f4615a46d5ba518c1e6a0c2412b1edf1e268d99 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 24 Nov 2008 05:14:44 +0000 Subject: Merge revisions 36737:36810 from trunk. svn path=/branches/kill-bonobo/; revision=36811 --- 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 c1f123e836..41e245ceef 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -2937,7 +2937,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); } @@ -2950,7 +2952,6 @@ static void real_edit_comp (CompEditor *editor, ECalComponent *comp) { CompEditorPrivate *priv; - const char *uid; g_return_if_fail (IS_COMP_EDITOR (editor)); @@ -2969,7 +2970,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 d158af8cdfa6e4bf85c1e74769e8d61bc469494c Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 10 Dec 2008 18:30:29 +0000 Subject: Merge revisions 36811:36865 from trunk. svn path=/branches/kill-bonobo/; revision=36867 --- calendar/gui/dialogs/alarm-dialog.c | 17 ++++++++--------- calendar/gui/dialogs/alarm-dialog.glade | 6 +++--- calendar/gui/dialogs/cal-prefs-dialog.glade | 4 ++-- calendar/gui/dialogs/comp-editor.c | 7 +++++-- calendar/gui/dialogs/event-editor.c | 3 --- calendar/gui/dialogs/event-page.c | 6 ++++++ calendar/gui/dialogs/event-page.glade | 4 ++-- calendar/gui/dialogs/memo-editor.c | 1 - calendar/gui/dialogs/memo-page.c | 6 ++++++ calendar/gui/dialogs/recurrence-page.glade | 2 +- calendar/gui/dialogs/task-details-page.glade | 2 +- calendar/gui/dialogs/task-editor.c | 2 -- calendar/gui/dialogs/task-page.c | 6 ++++++ 13 files changed, 40 insertions(+), 26 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 */ 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/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 41e245ceef..f3d9eb7b34 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -137,6 +137,7 @@ static const gchar *ui = " " " " " " +" " " " " " " " @@ -158,6 +159,7 @@ static const gchar *ui = " " " " " " +" " " " " " " " @@ -1306,7 +1308,7 @@ static GtkActionEntry core_entries[] = { { "print", GTK_STOCK_PRINT, NULL, - NULL, + "p", NULL, G_CALLBACK (action_print_cb) }, @@ -3080,7 +3082,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); diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index c4393b0174..2a4883cdfd 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -123,7 +123,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)); @@ -289,7 +288,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); @@ -306,7 +304,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 2855113e92..53707432d9 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" @@ -2152,6 +2153,7 @@ static gboolean get_widgets (EventPage *epage) { CompEditorPage *page = COMP_EDITOR_PAGE (epage); + GtkEntryCompletion *completion; EventPagePrivate *priv; GSList *accel_groups; GtkWidget *toplevel; @@ -2245,6 +2247,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/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/memo-editor.c b/calendar/gui/dialogs/memo-editor.c index 377cceef84..c76c96b94c 100644 --- a/calendar/gui/dialogs/memo-editor.c +++ b/calendar/gui/dialogs/memo-editor.c @@ -133,7 +133,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/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 diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 57a4063755..3ef5b4bcf2 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -311,7 +311,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); @@ -327,7 +326,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 a4bc4816a3..7d674d20a0 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 @@ -1372,6 +1373,7 @@ static gboolean get_widgets (TaskPage *tpage) { CompEditorPage *page = COMP_EDITOR_PAGE (tpage); + GtkEntryCompletion *completion; TaskPagePrivate *priv; GSList *accel_groups; GtkWidget *toplevel; @@ -1444,6 +1446,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 e0610b2e0cea191f631dc825cdc8023cdcd9433d Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 11 Jan 2009 14:20:50 +0000 Subject: Continue chipping away at EMFolderView and EMFolderBrowser. Migrate from gnome_url_show() to e_show_uri(). svn path=/branches/kill-bonobo/; revision=37038 --- calendar/gui/dialogs/comp-editor.c | 13 ++++++------- 1 file changed, 6 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 f3d9eb7b34..3b7f2c5385 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1945,7 +1945,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); @@ -1970,11 +1969,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); } @@ -2587,11 +2582,15 @@ comp_editor_get_managed_widget (CompEditor *editor, CompEditor * comp_editor_find_instance (const gchar *uid) { + GList *link; + g_return_val_if_fail (uid != NULL, NULL); - return g_list_find_custom ( + link = g_list_find_custom ( active_editors, uid, (GCompareFunc) comp_editor_compare); + + return (link != NULL) ? link->data : NULL; } /** -- cgit v1.2.3 From c7d3c9f95609123035ebaa267f9d2e6ecfa8c2e8 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 12 Jan 2009 04:12:01 +0000 Subject: Merge revisions 36866:37046 from trunk. svn path=/branches/kill-bonobo/; revision=37050 --- calendar/gui/dialogs/alarm-dialog.c | 2 +- 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/comp-editor.c | 53 +++++++++++++++++++++-- calendar/gui/dialogs/delete-error.c | 1 - calendar/gui/dialogs/event-editor.c | 15 +++++-- calendar/gui/dialogs/memo-editor.c | 22 +++++++--- calendar/gui/dialogs/recur-comp.c | 1 - calendar/gui/dialogs/recurrence-page.c | 2 +- calendar/gui/dialogs/schedule-page.c | 1 - 11 files changed, 78 insertions(+), 22 deletions(-) (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: 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/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 3b7f2c5385..5d9298cd18 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -26,15 +26,15 @@ #include #endif +#include #include #include #include #include #include -#include +#include #include #include -#include #include #include #include @@ -163,6 +163,7 @@ static const gchar *ui = " " " " " " +" " " " ""; @@ -1111,6 +1112,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) @@ -1162,9 +1181,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 @@ -2410,6 +2453,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; @@ -2458,6 +2502,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) { 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/event-editor.c b/calendar/gui/dialogs/event-editor.c index 2a4883cdfd..ef94f631d0 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -78,20 +78,21 @@ static const gchar *ui = " " " " " " +" " " " +" " " " " " " " " " " " -" " -" " " " " " " " " " -" " +" " " " +" " " " " " ""; @@ -148,9 +149,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 @@ -222,7 +229,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"), diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c index c76c96b94c..90c77f2349 100644 --- a/calendar/gui/dialogs/memo-editor.c +++ b/calendar/gui/dialogs/memo-editor.c @@ -95,6 +95,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) { @@ -105,6 +120,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); @@ -131,12 +147,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); } /** 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" 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, 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 2e3a3cf26e4d1894707703b15340529b8874466c Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 15 Jan 2009 03:39:43 +0000 Subject: Merge revisions 37047:37074 from trunk. svn path=/branches/kill-bonobo/; revision=37075 --- calendar/gui/dialogs/cal-prefs-dialog.c | 100 +++++++++++++++ calendar/gui/dialogs/cal-prefs-dialog.glade | 188 ++++++++++++++++++++-------- calendar/gui/dialogs/cal-prefs-dialog.h | 1 + calendar/gui/dialogs/recurrence-page.c | 31 +++++ 4 files changed, 269 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 49d4c56482..bb51d9d50d 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -43,6 +43,7 @@ struct _CalendarPrefsDialog { /* General tab */ GtkWidget *timezone; + GtkWidget *day_second_zone; GtkWidget *daylight_saving; GtkWidget *working_days[7]; GtkWidget *week_start_day; 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 ab00f5b08adb1d74a0c70d935a32ffd982e86f34 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 21 Jan 2009 02:52:05 +0000 Subject: Merge revisions 37075:37107 from trunk. svn path=/branches/kill-bonobo/; revision=37112 --- calendar/gui/dialogs/cal-prefs-dialog.c | 57 ++++++++++++++ calendar/gui/dialogs/cal-prefs-dialog.glade | 110 ++++++++++++++++++++++++++++ calendar/gui/dialogs/cal-prefs-dialog.h | 4 + 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 +- 9 files changed, 258 insertions(+), 27 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 38871c2f89..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 }; @@ -332,6 +333,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) { @@ -407,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) { @@ -483,6 +518,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); @@ -500,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); @@ -593,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 (); @@ -654,6 +697,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); @@ -668,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 */ @@ -749,12 +802,16 @@ 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"); 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..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 @@ -1176,6 +1268,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 bb51d9d50d..895a263986 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -55,12 +55,16 @@ 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; 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; diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 5d9298cd18..e9967eccaf 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -171,7 +171,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); @@ -897,6 +897,7 @@ save_comp_with_send (CompEditor *editor) CompEditorFlags flags; gboolean send; gboolean delegate; + gboolean strip_alarms = TRUE; priv = editor->priv; @@ -916,18 +917,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); } } @@ -3083,7 +3084,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; @@ -3129,7 +3130,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; } @@ -3150,7 +3151,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; @@ -3272,7 +3273,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; @@ -3281,7 +3282,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 23a8d3acea..7fdc17ba16 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); @@ -131,7 +131,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 ef94f631d0..72cbf37823 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -98,7 +98,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) @@ -619,7 +619,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; @@ -638,7 +638,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; @@ -646,7 +646,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 3ef5b4bcf2..656e7b4836 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -87,7 +87,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) @@ -445,7 +445,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; @@ -464,7 +464,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) @@ -473,7 +473,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 3c7a575407bef757d434808904a4c4dc1ba60cb3 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 21 Jan 2009 21:03:14 +0000 Subject: Fix some runtime warnings. Copy that nasty message list scrolling hack to EMailShellContent. Remember the scrollbar position for each folder. Now I just have to make it select a message automatically. svn path=/branches/kill-bonobo/; revision=37119 --- 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 bd9f473a896496b95b9896d30940f2ab27493432 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 23 Jan 2009 21:41:01 +0000 Subject: Redesign EPluginUI to accommodate merging and unmerging shell views. Get the "mark-all-read" and "plugin-manager" plugins working. svn path=/branches/kill-bonobo/; revision=37125 --- calendar/gui/dialogs/event-editor.c | 6 +++++- calendar/gui/dialogs/memo-editor.c | 6 +++++- calendar/gui/dialogs/task-editor.c | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 72cbf37823..620600369e 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -465,6 +465,7 @@ event_editor_init (EventEditor *ee) GtkUIManager *manager; GtkActionGroup *action_group; GtkAction *action; + const gchar *id; GError *error = NULL; ee->priv = EVENT_EDITOR_GET_PRIVATE (ee); @@ -487,7 +488,10 @@ event_editor_init (EventEditor *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); + + id = "org.gnome.evolution.event-editor"; + e_plugin_ui_register_manager (manager, id, ee); + e_plugin_ui_enable_manager (manager, id); if (error != NULL) { g_critical ("%s: %s", G_STRFUNC, error->message); diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c index 90c77f2349..5e01327703 100644 --- a/calendar/gui/dialogs/memo-editor.c +++ b/calendar/gui/dialogs/memo-editor.c @@ -134,6 +134,7 @@ memo_editor_init (MemoEditor *me) { CompEditor *editor = COMP_EDITOR (me); GtkUIManager *manager; + const gchar *id; GError *error = NULL; me->priv = MEMO_EDITOR_GET_PRIVATE (me); @@ -141,7 +142,10 @@ memo_editor_init (MemoEditor *me) 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); + + id = "org.gnome.evolution.memo-editor"; + e_plugin_ui_register_manager (manager, id, me); + e_plugin_ui_enable_manager (manager, id); if (error != NULL) { g_critical ("%s: %s", G_STRFUNC, error->message); diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 656e7b4836..773dea4a47 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -303,6 +303,7 @@ task_editor_init (TaskEditor *te) CompEditor *editor = COMP_EDITOR (te); GtkUIManager *manager; GtkActionGroup *action_group; + const gchar *id; GError *error = NULL; te->priv = TASK_EDITOR_GET_PRIVATE (te); @@ -345,7 +346,10 @@ task_editor_init (TaskEditor *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); + + id = "org.gnome.evolution.task-editor"; + e_plugin_ui_register_manager (manager, id, te); + e_plugin_ui_enable_manager (manager, id); if (error != NULL) { g_critical ("%s: %s", G_STRFUNC, error->message); -- cgit v1.2.3 From 70fce0bbb0712dc70a15c481c0b65d68a98a4ff7 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 28 Jan 2009 22:28:57 +0000 Subject: When invoking Evolution with URIs on the command-line (e.g. mailto:), terminate after all the windows for those URIs have been closed. svn path=/branches/kill-bonobo/; revision=37157 --- calendar/gui/dialogs/comp-editor.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index e9967eccaf..3e6fc65aad 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -1780,6 +1781,7 @@ comp_editor_init (CompEditor *editor) CompEditorPrivate *priv; GtkActionGroup *action_group; GtkAction *action; + EShell *shell; GError *error = NULL; editor->priv = priv = COMP_EDITOR_GET_PRIVATE (editor); @@ -1871,6 +1873,10 @@ comp_editor_init (CompEditor *editor) g_signal_connect(editor, "drag-motion", G_CALLBACK(drag_motion), editor); gtk_window_set_type_hint (GTK_WINDOW (editor), GDK_WINDOW_TYPE_HINT_NORMAL); + + /* FIXME Shell should be passed in. */ + shell = e_shell_get_default (); + e_shell_watch_window (shell, GTK_WINDOW (editor)); } static gboolean -- cgit v1.2.3 From fee5916b60c605ff5086d8fdc2a85c5ea21351f6 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 31 Jan 2009 19:03:12 +0000 Subject: Merge revisions 37108:37199 from trunk. svn path=/branches/kill-bonobo/; revision=37200 --- calendar/gui/dialogs/e-send-options-utils.c | 2 +- calendar/gui/dialogs/event-editor.c | 2 + calendar/gui/dialogs/event-page.c | 57 ++++++++++++++++++++--------- calendar/gui/dialogs/event-page.h | 1 + calendar/gui/dialogs/task-page.c | 5 ++- 5 files changed, 47 insertions(+), 20 deletions(-) (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"); diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 620600369e..e2ca71c5cb 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -568,6 +568,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 53707432d9..2faed38a39 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -1820,27 +1820,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; + 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))); + delegator = e_meeting_store_find_attendee (priv->model, delegator_id, NULL); - 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); - } - } -} + 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*/ @@ -3250,3 +3251,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 diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 7d674d20a0..b81119c5cf 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -1155,8 +1155,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 f7e298665b02f72890c6681e6d21ef5601beccbb Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 15 Feb 2009 03:27:31 +0000 Subject: Merge revisions 37200:3266 from trunk. svn path=/branches/kill-bonobo/; revision=37270 --- calendar/gui/dialogs/alarm-dialog.c | 2 +- calendar/gui/dialogs/event-page.c | 4 ++-- calendar/gui/dialogs/task-details-page.c | 2 +- calendar/gui/dialogs/task-page.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (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); diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 2faed38a39..1f09663c53 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 81358901ba..8212864a31 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 b81119c5cf..88b753b9db 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -1348,7 +1348,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 f963cc39a7d21f64f578dae50fd08c44181a3bf6 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 9 Mar 2009 03:31:24 +0000 Subject: Cleaning up the attachment bar, centralizing its popup menu, and converting everything to GtkUIManager/GtkActions. Saving progress mid-stream... not sure about the MIME part utilities yet. Also, add some EActivity subclasses. Considering an EFileActivity subclass for asynchronous GIO operations (loading/saving attachments, etc.), but still ironing out details. svn path=/branches/kill-bonobo/; revision=37389 --- calendar/gui/dialogs/comp-editor.c | 233 +------------------------------------ 1 file changed, 1 insertion(+), 232 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 3e6fc65aad..4e1bf9972f 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -180,7 +180,6 @@ static void page_dates_changed_cb (CompEditor *editor, CompEditorPageDates *date static void obj_modified_cb (ECal *client, GList *objs, CompEditor *editor); static void obj_removed_cb (ECal *client, GList *uids, CompEditor *editor); -static gboolean open_attachment (EAttachmentBar *bar, CompEditor *editor); G_DEFINE_TYPE (CompEditor, comp_editor, GTK_TYPE_WINDOW) @@ -1801,7 +1800,7 @@ comp_editor_init (CompEditor *editor) priv->warned = FALSE; priv->is_group_item = FALSE; - priv->attachment_bar = e_attachment_bar_new (NULL); + priv->attachment_bar = e_attachment_bar_new (); priv->manager = gtk_ui_manager_new (); gtk_window_add_accel_group ( @@ -1988,233 +1987,9 @@ attachment_expander_activate_cb (EExpander *expander, _("Show Attachment _Bar")); } -static gboolean -open_attachment (EAttachmentBar *bar, CompEditor *editor) -{ - GnomeIconList *icon_list; - GList *p; - int num; - char *attach_file_url; - - if (E_IS_ATTACHMENT_BAR (bar)) { - icon_list = GNOME_ICON_LIST (bar); - p = gnome_icon_list_get_selection (icon_list); - if (p) { - EAttachment *attachment; - GSList *list; - const char *comp_uid = NULL; - char *filename = NULL; - const char *local_store = e_cal_get_local_attachment_store (editor->priv->client); - - e_cal_component_get_uid (editor->priv->comp, &comp_uid); - num = GPOINTER_TO_INT (p->data); - list = e_attachment_bar_get_attachment (bar, num); - attachment = list->data; - g_slist_free (list); - - filename = g_strdup_printf ("%s-%s", - comp_uid, - camel_mime_part_get_filename(attachment->body)); - - attach_file_url = g_build_path ("/", local_store, filename, NULL); - - /* launch the url now */ - e_show_uri (GTK_WINDOW (editor), attach_file_url); - - g_free (filename); - g_free (attach_file_url); } - return TRUE; - } else - return FALSE; -} - -static gboolean -attachment_bar_icon_clicked_cb (EAttachmentBar *bar, GdkEvent *event, CompEditor *editor) -{ - if (E_IS_ATTACHMENT_BAR (bar) && event->type == GDK_2BUTTON_PRESS) - if (open_attachment (bar, editor)) - return TRUE; - return FALSE; -} - -/* Callbacks. */ - -static void -cab_open(EPopup *ep, EPopupItem *item, void *data) -{ - EAttachmentBar *bar = data; - CompEditor *editor = COMP_EDITOR (gtk_widget_get_toplevel (GTK_WIDGET (bar))); - - if (!open_attachment (bar, editor)) - g_message ("\n Open failed"); -} - -static void -cab_add(EPopup *ep, EPopupItem *item, void *data) -{ - EAttachmentBar *bar = data; - CompEditor *editor = COMP_EDITOR (gtk_widget_get_toplevel (GTK_WIDGET (bar))); - GPtrArray *file_list; - gboolean is_inline = FALSE; - int i; - - file_list = comp_editor_select_file_attachments (editor, &is_inline); - /*TODO add a good implementation here */ - if (!file_list) - return; - for (i = 0; i < file_list->len; i++) { - CamelURL *url; - - url = camel_url_new (file_list->pdata[i], NULL); - if (url == NULL) - continue; - - if (!g_ascii_strcasecmp (url->protocol, "file")) - e_attachment_bar_attach (bar, url->path, is_inline ? "inline" : "attachment"); - else - e_attachment_bar_attach_remote_file (bar, file_list->pdata[i], is_inline ? "inline" : "attachment"); - g_free (file_list->pdata[i]); - camel_url_free (url); - } - - g_ptr_array_free (file_list, TRUE); -} - -static void -cab_properties(EPopup *ep, EPopupItem *item, void *data) -{ - EAttachmentBar *bar = data; - - e_attachment_bar_edit_selected(bar); -} - -static void -cab_remove(EPopup *ep, EPopupItem *item, void *data) -{ - EAttachmentBar *bar = data; - - e_attachment_bar_remove_selected(bar); -} - -/* Popup menu handling. */ -static EPopupItem cab_popups[] = { - { E_POPUP_ITEM, "10.attach", N_("_Open"), cab_open, NULL, GTK_STOCK_OPEN, E_CAL_POPUP_ATTACHMENTS_ONE}, - { E_POPUP_ITEM, "20.attach", N_("_Remove"), cab_remove, NULL, GTK_STOCK_REMOVE, E_CAL_POPUP_ATTACHMENTS_MANY | E_CAL_POPUP_ATTACHMENTS_MODIFY }, - { E_POPUP_ITEM, "30.attach", N_("_Properties"), cab_properties, NULL, GTK_STOCK_PROPERTIES, E_CAL_POPUP_ATTACHMENTS_ONE }, - { E_POPUP_BAR, "40.attach.00", NULL, NULL, NULL, NULL, E_CAL_POPUP_ATTACHMENTS_MANY|E_CAL_POPUP_ATTACHMENTS_ONE }, - { E_POPUP_ITEM, "40.attach.01", N_("_Add attachment..."), cab_add, NULL, GTK_STOCK_ADD, E_CAL_POPUP_ATTACHMENTS_MODIFY}, -}; - -static void -cab_popup_position(GtkMenu *menu, int *x, int *y, gboolean *push_in, gpointer user_data) -{ - EAttachmentBar *bar = user_data; - GnomeIconList *icon_list = user_data; - GList *selection; - GnomeCanvasPixbuf *image; - - gdk_window_get_origin (((GtkWidget*) bar)->window, x, y); - - selection = gnome_icon_list_get_selection (icon_list); - if (selection == NULL) - return; - - image = gnome_icon_list_get_icon_pixbuf_item (icon_list, GPOINTER_TO_INT(selection->data)); - if (image == NULL) - return; - - /* Put menu to the center of icon. */ - *x += (int)(image->item.x1 + image->item.x2) / 2; - *y += (int)(image->item.y1 + image->item.y2) / 2; -} - -static void -cab_popups_free(EPopup *ep, GSList *l, void *data) -{ - g_slist_free(l); -} - -/* if id != -1, then use it as an index for target of the popup */ -static void -cab_popup(EAttachmentBar *bar, GdkEventButton *event, int id) -{ - GSList *attachments = NULL, *menus = NULL; - int i; - ECalPopup *ecp; - ECalPopupTargetAttachments *t; - GtkMenu *menu; - CompEditor *editor = COMP_EDITOR (gtk_widget_get_toplevel (GTK_WIDGET (bar))); - - attachments = e_attachment_bar_get_attachment(bar, id); - - for (i=0;itarget.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 (EAttachmentBar *bar) -{ - cab_popup (bar, NULL, -1); - - return TRUE; -} - - -static int -button_press_event (EAttachmentBar *bar, - GdkEventButton *event) -{ - GnomeIconList *icon_list = GNOME_ICON_LIST (bar); - 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 (EAttachmentBar *bar, - GdkEventKey *event) -{ - if (event->keyval == GDK_Delete) { - e_attachment_bar_remove_selected (bar); - return TRUE; - } - - return FALSE; -} - static gint editor_key_press_event (CompEditor *editor, GdkEventKey *event) @@ -2275,18 +2050,12 @@ setup_widgets (CompEditor *editor) gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->attachment_scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - 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); - GTK_WIDGET_SET_FLAGS (priv->attachment_bar, GTK_CAN_FOCUS); gtk_container_add (GTK_CONTAINER (priv->attachment_scrolled_window), priv->attachment_bar); gtk_widget_show (priv->attachment_bar); g_signal_connect (priv->attachment_bar, "changed", G_CALLBACK (attachment_bar_changed_cb), editor); - g_signal_connect (GNOME_ICON_LIST (priv->attachment_bar), "event", - G_CALLBACK (attachment_bar_icon_clicked_cb), editor); priv->attachment_expander_label = gtk_label_new_with_mnemonic (_("Show Attachment _Bar")); priv->attachment_expander_num = gtk_label_new (""); -- cgit v1.2.3 From 7a92d9cc82b7775a0f5cb1fde233119d435a79b6 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 10 Mar 2009 01:06:18 +0000 Subject: Add e_lookup_action() and e_lookup_action_group() to e-util, so I don't have to keep writing the algorithm over and over again. Add EFileActivity, which provides a GCancellable for GIO operations. Cancelling the activity cancels the GIO operation, and vice versa. Also provides a handy GFileProgressCallback function which updates the activity's "percent" property. svn path=/branches/kill-bonobo/; revision=37396 --- calendar/gui/dialogs/comp-editor.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 4e1bf9972f..7be36d043b 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -2341,46 +2341,28 @@ GtkAction * comp_editor_get_action (CompEditor *editor, const gchar *action_name) { - GtkAction *action = NULL; - GList *iter; + GtkUIManager *ui_manager; g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); g_return_val_if_fail (action_name != NULL, NULL); - iter = gtk_ui_manager_get_action_groups (editor->priv->manager); - while (iter != NULL && action == NULL) { - GtkActionGroup *action_group = iter->data; + ui_manager = comp_editor_get_ui_manager (editor); - action = gtk_action_group_get_action ( - action_group, action_name); - iter = g_list_next (iter); - } - g_return_val_if_fail (action != NULL, NULL); - - return action; + return e_lookup_action (ui_manager, action_name); } GtkActionGroup * comp_editor_get_action_group (CompEditor *editor, const gchar *group_name) { - GList *iter; + GtkUIManager *ui_manager; g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); g_return_val_if_fail (group_name != NULL, NULL); - iter = gtk_ui_manager_get_action_groups (editor->priv->manager); - while (iter != NULL) { - GtkActionGroup *action_group = iter->data; - const gchar *name; - - name = gtk_action_group_get_name (action_group); - if (strcmp (name, group_name) == 0) - return action_group; - iter = g_list_next (iter); - } + ui_manager = comp_editor_get_ui_manager (editor); - g_return_val_if_reached (NULL); + return e_lookup_action_group (ui_manager, group_name); } GtkWidget * -- cgit v1.2.3 From 4cec9fc7169dc3b810321555a70cda916720867d Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 20 Mar 2009 19:06:59 +0000 Subject: Saving progress on a massive attachment handling rewrite. svn path=/branches/kill-bonobo/; revision=37465 --- calendar/gui/dialogs/comp-editor.c | 860 ++++++++++--------------------------- 1 file changed, 220 insertions(+), 640 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 7be36d043b..e3b1bac053 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -63,9 +63,8 @@ #include "../e-cal-popup.h" #include "../calendar-config-keys.h" #include "cal-attachment-select-file.h" +#include "widgets/misc/e-attachment-paned.h" -#include "e-attachment-bar.h" -#include "misc/e-expander.h" #include "e-util/e-error.h" #define COMP_EDITOR_GET_PRIVATE(obj) \ @@ -95,12 +94,7 @@ struct _CompEditorPrivate { GtkNotebook *notebook; /* Attachment handling */ - GtkWidget *attachment_bar; - GtkWidget *attachment_scrolled_window; - GtkWidget *attachment_expander; - GtkWidget *attachment_expander_label; - GtkWidget *attachment_expander_icon; - GtkWidget *attachment_expander_num; + GtkWidget *attachment_paned; /* Manages menus and toolbars */ GtkUIManager *manager; @@ -169,7 +163,6 @@ static const gchar *ui = ""; 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, gboolean strip_alarms); @@ -232,391 +225,82 @@ comp_editor_weak_notify_cb (gpointer unused, } static void -attach_message(CompEditor *editor, CamelMimeMessage *msg) +drag_data_received (CompEditor *editor, + GdkDragContext *context, + gint x, + gint y, + GtkSelectionData *selection, + guint info, + guint time) { - CamelMimePart *mime_part; - const char *subject; - guint i; - char *filename = NULL; + EAttachmentPaned *paned; + EAttachmentView *view; - mime_part = camel_mime_part_new(); - camel_mime_part_set_disposition(mime_part, "inline"); - subject = camel_mime_message_get_subject(msg); - if (subject) { - char *desc = g_strdup_printf(_("Attached message - %s"), subject); + paned = E_ATTACHMENT_PANED (editor->priv->attachment_paned); + view = e_attachment_paned_get_view (paned); - camel_mime_part_set_description(mime_part, desc); - g_free(desc); - } else - camel_mime_part_set_description(mime_part, _("Attached message")); - - i = e_attachment_bar_get_num_attachments (E_ATTACHMENT_BAR (editor->priv->attachment_bar)); - i++; - filename = g_strdup_printf ("email%d",i); - camel_mime_part_set_filename (mime_part, filename); - - camel_medium_set_content_object((CamelMedium *)mime_part, (CamelDataWrapper *)msg); - camel_mime_part_set_content_type(mime_part, "message/rfc822"); - e_attachment_bar_attach_mime_part(E_ATTACHMENT_BAR(editor->priv->attachment_bar), mime_part); - camel_object_unref(mime_part); - g_free (filename); -} - -struct _drop_data { - CompEditor *editor; - - GdkDragContext *context; - /* Only selection->data and selection->length are valid */ - GtkSelectionData *selection; - - guint32 action; - guint info; - guint time; - - unsigned int move:1; - unsigned int moved:1; - unsigned int aborted:1; -}; - -static void -drop_action(CompEditor *editor, GdkDragContext *context, guint32 action, GtkSelectionData *selection, guint info, guint time) -{ -#if 0 /* KILL-BONOBO */ - char *tmp, *str, **urls; - CamelMimePart *mime_part; - CamelStream *stream; - CamelURL *url; - CamelMimeMessage *msg; - char *content_type; - int i, success=FALSE, delete=FALSE; - - switch (info) { - case DND_TYPE_MESSAGE_RFC822: - d(printf ("dropping a message/rfc822\n")); - /* write the message(s) out to a CamelStream so we can use it */ - stream = camel_stream_mem_new (); - camel_stream_write (stream, (char *)selection->data, selection->length); - camel_stream_reset (stream); - - msg = camel_mime_message_new (); - if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)msg, stream) != -1) { - attach_message(editor, msg); - success = TRUE; - delete = action == GDK_ACTION_MOVE; - } - - camel_object_unref(msg); - camel_object_unref(stream); - break; - case DND_TYPE_TEXT_URI_LIST: - case DND_TYPE_NETSCAPE_URL: - d(printf ("dropping a text/uri-list\n")); - tmp = g_strndup ((char *)selection->data, selection->length); - urls = g_strsplit (tmp, "\n", 0); - g_free (tmp); - - for (i = 0; urls[i] != NULL; i++) { - str = g_strstrip (urls[i]); - if (urls[i][0] == '#') - continue; - - if (!g_ascii_strncasecmp (str, "mailto:", 7)) { - /* TODO does not handle mailto now */ - } else { - url = camel_url_new (str, NULL); - - if (url == NULL) - continue; - - if (!g_ascii_strcasecmp (url->protocol, "file")) - e_attachment_bar_attach - (E_ATTACHMENT_BAR (editor->priv->attachment_bar), - url->path, - "attachment"); - else - e_attachment_bar_attach_remote_file - (E_ATTACHMENT_BAR (editor->priv->attachment_bar), - str, "attachment"); - - camel_url_free (url); - } - } - - g_strfreev (urls); - success = TRUE; - break; - case DND_TYPE_TEXT_VCARD: - case DND_TYPE_TEXT_CALENDAR: - content_type = gdk_atom_name (selection->type); - d(printf ("dropping a %s\n", content_type)); - - mime_part = camel_mime_part_new (); - camel_mime_part_set_content (mime_part, (char *)selection->data, selection->length, content_type); - camel_mime_part_set_disposition (mime_part, "inline"); - - e_attachment_bar_attach_mime_part - (E_ATTACHMENT_BAR (editor->priv->attachment_bar), - mime_part); - - camel_object_unref (mime_part); - g_free (content_type); - - success = TRUE; - break; - case DND_TYPE_X_UID_LIST: { - GPtrArray *uids; - char *inptr, *inend; - CamelFolder *folder; - CamelException ex = CAMEL_EXCEPTION_INITIALISER; - - /* NB: This all runs synchronously, could be very slow/hang/block the ui */ - - uids = g_ptr_array_new(); - - inptr = (char *)selection->data; - inend = (char *)(selection->data + selection->length); - while (inptr < inend) { - char *start = inptr; - - while (inptr < inend && *inptr) - inptr++; - - if (start > (char *)selection->data) - g_ptr_array_add(uids, g_strndup(start, inptr-start)); - - inptr++; - } - - if (uids->len > 0) { - folder = mail_tool_uri_to_folder((char *)selection->data, 0, &ex); - if (folder) { - if (uids->len == 1) { - msg = camel_folder_get_message(folder, uids->pdata[0], &ex); - if (msg == NULL) - goto fail; - attach_message(editor, msg); - } else { - CamelMultipart *mp = camel_multipart_new(); - char *desc; - char *filename = NULL; - guint num; - - camel_data_wrapper_set_mime_type((CamelDataWrapper *)mp, "multipart/digest"); - camel_multipart_set_boundary(mp, NULL); - for (i=0;ilen;i++) { - - msg = camel_folder_get_message(folder, uids->pdata[i], &ex); - if (msg) { - mime_part = camel_mime_part_new(); - camel_mime_part_set_disposition(mime_part, "inline"); - camel_medium_set_content_object((CamelMedium *)mime_part, (CamelDataWrapper *)msg); - camel_mime_part_set_content_type(mime_part, "message/rfc822"); - camel_multipart_add_part(mp, mime_part); - camel_object_unref(mime_part); - camel_object_unref(msg); - } else { - camel_object_unref(mp); - goto fail; - } - } - mime_part = camel_mime_part_new(); - camel_medium_set_content_object((CamelMedium *)mime_part, (CamelDataWrapper *)mp); - /* translators, this count will always be >1 */ - desc = g_strdup_printf(ngettext("Attached message", "%d attached messages", uids->len), uids->len); - camel_mime_part_set_description(mime_part, desc); - g_free(desc); - - num = e_attachment_bar_get_num_attachments (E_ATTACHMENT_BAR (editor->priv->attachment_bar)); - num++; - filename = g_strdup_printf ("email%d", num); - camel_mime_part_set_filename (mime_part, filename); - - e_attachment_bar_attach_mime_part - (E_ATTACHMENT_BAR(editor->priv->attachment_bar), mime_part); - camel_object_unref(mime_part); - camel_object_unref(mp); - g_free (filename); - } - success = TRUE; - delete = action == GDK_ACTION_MOVE; - fail: - if (camel_exception_is_set(&ex)) { - char *name; - - camel_object_get(folder, NULL, CAMEL_FOLDER_NAME, &name, NULL); - e_error_run((GtkWindow *)editor, "mail-editor:attach-nomessages", - name?name:(char *)selection->data, camel_exception_get_description(&ex), NULL); - camel_object_free(folder, CAMEL_FOLDER_NAME, name); - } - camel_object_unref(folder); - } else { - e_error_run((GtkWindow *)editor, "mail-editor:attach-nomessages", - (char *)selection->data, camel_exception_get_description(&ex), NULL); - } - - camel_exception_clear(&ex); - } - - g_ptr_array_free(uids, TRUE); - - break; } - default: - d(printf ("dropping an unknown\n")); - break; - } - - printf("Drag finished, success %d delete %d\n", success, delete); - - gtk_drag_finish(context, success, delete, time); -#endif -} - -static void -drop_popup_copy (EPopup *ep, EPopupItem *item, void *data) -{ - struct _drop_data *m = data; - drop_action(m->editor, m->context, GDK_ACTION_COPY, m->selection, m->info, m->time); -} - -static void -drop_popup_move (EPopup *ep, EPopupItem *item, void *data) -{ - struct _drop_data *m = data; - drop_action(m->editor, m->context, GDK_ACTION_MOVE, m->selection, m->info, m->time); -} - -static void -drop_popup_cancel(EPopup *ep, EPopupItem *item, void *data) -{ - struct _drop_data *m = data; - gtk_drag_finish(m->context, FALSE, FALSE, m->time); -} - -static EPopupItem drop_popup_menu[] = { - { E_POPUP_ITEM, "00.emc.02", N_("_Copy"), drop_popup_copy, NULL, "mail-copy", 0 }, - { E_POPUP_ITEM, "00.emc.03", N_("_Move"), drop_popup_move, NULL, "mail-move", 0 }, - { E_POPUP_BAR, "10.emc" }, - { E_POPUP_ITEM, "99.emc.00", N_("Cancel _Drag"), drop_popup_cancel, NULL, NULL, 0 }, -}; - -static void -drop_popup_free(EPopup *ep, GSList *items, void *data) -{ - struct _drop_data *m = data; - - g_slist_free(items); - - g_object_unref(m->context); - g_object_unref(m->editor); - g_free(m->selection->data); - g_free(m->selection); - g_free(m); -} - -static void -drag_data_received (CompEditor *editor, GdkDragContext *context, - int x, int y, GtkSelectionData *selection, - guint info, guint time) -{ - if (selection->data == NULL || selection->length == -1) - return; - - if (context->action == GDK_ACTION_ASK) { - ECalPopup *ecp; - GSList *menus = NULL; - GtkMenu *menu; - int i; - struct _drop_data *m; - - m = g_malloc0(sizeof(*m)); - m->context = context; - g_object_ref(context); - m->editor = editor; - g_object_ref(editor); - m->action = context->action; - m->info = info; - m->time = time; - m->selection = g_malloc0(sizeof(*m->selection)); - m->selection->data = g_malloc(selection->length); - memcpy(m->selection->data, selection->data, selection->length); - m->selection->length = selection->length; - - ecp = e_cal_popup_new("org.gnome.evolution.calendar.editor.popup.drop"); - for (i=0;iaction, selection, info, time); - } + e_attachment_view_drag_data_received ( + view, context, x, y, selection, info, time); } static gboolean -drag_motion(GObject *o, GdkDragContext *context, gint x, gint y, guint time, CompEditor *editor) -{ - GList *targets; - GdkDragAction action, actions = 0; - - for (targets = context->targets; targets; targets = targets->next) { - int i; - - for (i=0;idata == (void *)drag_info[i].atom) - actions |= drag_info[i].actions; - } - - actions &= context->actions; - action = context->suggested_action; - /* we default to copy */ - if (action == GDK_ACTION_ASK && (actions & (GDK_ACTION_MOVE|GDK_ACTION_COPY)) != (GDK_ACTION_MOVE|GDK_ACTION_COPY)) - action = GDK_ACTION_COPY; - - gdk_drag_status(context, action, time); - - return action != 0; -} - -static void -add_to_bar (CompEditor *editor, GPtrArray *file_list, int is_inline) +drag_motion (CompEditor *editor, + GdkDragContext *context, + gint x, + gint y, + guint time) { - CompEditorPrivate *priv = editor->priv; - int i; - - for (i = 0; i < file_list->len; i++) { - CamelURL *url; + EAttachmentPaned *paned; + EAttachmentView *view; - if (!(url = camel_url_new (file_list->pdata[i], NULL))) - continue; + paned = E_ATTACHMENT_PANED (editor->priv->attachment_paned); + view = e_attachment_paned_get_view (paned); - 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); - } + return e_attachment_view_drag_motion (view, context, x, y, time); } static GSList * get_attachment_list (CompEditor *editor) { + EAttachmentPaned *paned; + EAttachmentStore *store; + EAttachmentView *view; + GtkTreeModel *model; + GtkTreeIter iter; GSList *parts = NULL, *list = NULL, *p = NULL; const char *comp_uid = NULL; const char *local_store = e_cal_get_local_attachment_store (editor->priv->client); + gboolean valid; int ticker=0; + e_cal_component_get_uid (editor->priv->comp, &comp_uid); - parts = e_attachment_bar_get_parts((EAttachmentBar *)editor->priv->attachment_bar); + paned = E_ATTACHMENT_PANED (editor->priv->attachment_paned); + view = e_attachment_paned_get_view (paned); + store = e_attachment_view_get_store (view); - for (p = parts; p!=NULL ; p = p->next) { + model = GTK_TREE_MODEL (store); + valid = gtk_tree_model_get_iter_first (model, &iter); + + while (valid) { + EAttachment *attachment; CamelDataWrapper *wrapper; + CamelMimePart *mime_part; CamelStream *stream; char *attach_file_url; char *safe_fname, *utf8_safe_fname; char *filename; + gint column_id; + + column_id = E_ATTACHMENT_STORE_COLUMN_ATTACHMENT; + gtk_tree_model_get (model, &iter, column_id, &attachment, -1); + mime_part = e_attachment_get_mime_part (attachment); + g_object_unref (attachment); + + valid = gtk_tree_model_iter_next (model, &iter); + + if (mime_part == NULL) + continue; wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (p->data)); @@ -997,20 +681,15 @@ static void action_attach_cb (GtkAction *action, CompEditor *editor) { - GPtrArray *file_list; - gboolean is_inline = FALSE; - int i; - - file_list = comp_editor_select_file_attachments (editor, &is_inline); + EAttachmentPaned *paned; + EAttachmentStore *store; + EAttachmentView *view; - if (file_list) { - add_to_bar (editor, file_list, is_inline); + paned = E_ATTACHMENT_PANED (editor->priv->attachment_paned); + view = e_attachment_paned_get_view (paned); + store = e_attachment_view_get_store (view); - for (i = 0; i < file_list->len; i++) - g_free (file_list->pdata[i]); - - g_ptr_array_free (file_list, TRUE); - } + e_attachment_store_run_load_dialog (store, GTK_WINDOW (editor)); } static void @@ -1136,12 +815,19 @@ action_save_cb (GtkAction *action, CompEditor *editor) { CompEditorPrivate *priv = editor->priv; + EAttachmentPaned *paned; + EAttachmentStore *store; + EAttachmentView *view; 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)) ){ + paned = E_ATTACHMENT_PANED (priv->attachment_paned); + view = e_attachment_paned_get_view (paned); + store = e_attachment_view_get_store (view); + + if (e_attachment_store_get_num_downloading (store) > 0) { gboolean response = 1; /*FIXME: Cannot use mail functions from calendar!!!! */ #if 0 @@ -1693,6 +1379,44 @@ comp_editor_map (GtkWidget *widget) GTK_WIDGET_CLASS (comp_editor_parent_class)->map (widget); } +static gboolean +comp_editor_delete_event (GtkWidget *widget, + GdkEventAny *event) +{ + CompEditor *editor; + + editor = COMP_EDITOR (widget); + + commit_all_fields (editor); + + if (prompt_and_save_changes (editor, TRUE)) + close_dialog (editor); + + return TRUE; +} + +static gboolean +comp_editor_key_press_event (GtkWidget *widget, + GdkEventKey *event) +{ + CompEditor *editor; + + editor = COMP_EDITOR (editor); + + if (event->keyval == GDK_Escape) { + commit_all_fields (editor); + + if (prompt_and_save_changes (editor, TRUE)) + close_dialog (editor); + + return TRUE; + } + + /* Chain up to parent's key_press_event() method. */ + return GTK_WIDGET_CLASS (comp_editor_parent_class)-> + key_press_event (widget, event); +} + static void comp_editor_class_init (CompEditorClass *class) { @@ -1713,6 +1437,8 @@ comp_editor_class_init (CompEditorClass *class) widget_class = GTK_WIDGET_CLASS (class); widget_class->map = comp_editor_map; + widget_class->delete_event = comp_editor_delete_event; + widget_class->key_press_event = comp_editor_key_press_event; class->help_section = "usage-calendar"; class->edit_comp = real_edit_comp; @@ -1778,8 +1504,12 @@ static void comp_editor_init (CompEditor *editor) { CompEditorPrivate *priv; + EAttachmentPaned *paned; + EAttachmentView *view; GtkActionGroup *action_group; GtkAction *action; + GtkWidget *container; + GtkWidget *widget; EShell *shell; GError *error = NULL; @@ -1795,17 +1525,18 @@ comp_editor_init (CompEditor *editor) priv->changed = FALSE; priv->needs_send = FALSE; priv->mod = CALOBJ_MOD_ALL; - priv->existing_org = FALSE; - priv->user_org = FALSE; - priv->warned = FALSE; + priv->existing_org = FALSE; + priv->user_org = FALSE; + priv->warned = FALSE; priv->is_group_item = FALSE; - priv->attachment_bar = e_attachment_bar_new (); priv->manager = gtk_ui_manager_new (); - gtk_window_add_accel_group ( - GTK_WINDOW (editor), - gtk_ui_manager_get_accel_group (priv->manager)); + gtk_window_add_accel_group ( + GTK_WINDOW (editor), + gtk_ui_manager_get_accel_group (priv->manager)); + + /* Setup Action Groups */ action_group = gtk_action_group_new ("core"); gtk_action_group_set_translation_domain ( @@ -1831,10 +1562,6 @@ comp_editor_init (CompEditor *editor) 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 _Documents")); - gtk_action_group_add_action (action_group, action); gtk_ui_manager_insert_action_group ( priv->manager, action_group, 0); g_object_unref (action_group); @@ -1864,12 +1591,52 @@ comp_editor_init (CompEditor *editor) g_error_free (error); } - setup_widgets (editor); + /* Setup Widgets */ + + container = GTK_WIDGET (editor); + + widget = gtk_vbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (container), widget); + gtk_widget_show (widget); + + container = widget; + + widget = comp_editor_get_managed_widget (editor, "/main-menu"); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + widget = comp_editor_get_managed_widget (editor, "/main-toolbar"); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + widget = e_attachment_paned_new (); + gtk_container_set_border_width (GTK_CONTAINER (widget), 6); + gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); + priv->attachment_paned = g_object_ref (widget); + gtk_widget_show (widget); + + container = e_attachment_paned_get_content_area ( + E_ATTACHMENT_PANED (priv->attachment_paned)); + + widget = gtk_notebook_new (); + gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE); + gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); + priv->notebook = GTK_NOTEBOOK (widget); + gtk_widget_show (widget); + + /* Add a GtkRecentAction to the "individual" action group. */ + action_group = comp_editor_get_action_group (editor, "individual"); + paned = E_ATTACHMENT_PANED (priv->attachment_paned); + view = e_attachment_paned_get_view (paned); + action = e_attachment_view_recent_action_new ( + view, "attach-recent", _("Recent _Documents")); + gtk_action_group_add_action (action_group, action); + g_object_unref (action); /* 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); + g_signal_connect(editor, "drag-motion", G_CALLBACK(drag_motion), NULL); gtk_window_set_type_hint (GTK_WINDOW (editor), GDK_WINDOW_TYPE_HINT_NORMAL); @@ -1928,169 +1695,16 @@ prompt_and_save_changes (CompEditor *editor, gboolean send) } } -static int -delete_event_cb (GtkWidget *widget, - GdkEvent *event, - 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, - CompEditor *editor) +attachment_store_changed_cb (CompEditor *editor) { - 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")); -} - - -/* GtkWidget methods. */ - -static gint -editor_key_press_event (CompEditor *editor, - GdkEventKey *event) -{ - 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 -setup_widgets (CompEditor *editor) -{ - CompEditorPrivate *priv; - GtkWidget *expander_hbox; - GtkWidget *widget; - GtkWidget *vbox; - - priv = editor->priv; - - /* Useful vbox */ - vbox = gtk_vbox_new (FALSE, 0); - 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 */ - 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); - - /*Attachments */ - priv->attachment_scrolled_window = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (priv->attachment_scrolled_window), - GTK_SHADOW_IN); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->attachment_scrolled_window), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - - GTK_WIDGET_SET_FLAGS (priv->attachment_bar, GTK_CAN_FOCUS); - gtk_container_add (GTK_CONTAINER (priv->attachment_scrolled_window), - priv->attachment_bar); - gtk_widget_show (priv->attachment_bar); - g_signal_connect (priv->attachment_bar, "changed", - G_CALLBACK (attachment_bar_changed_cb), editor); - priv->attachment_expander_label = - gtk_label_new_with_mnemonic (_("Show Attachment _Bar")); - priv->attachment_expander_num = gtk_label_new (""); - gtk_label_set_use_markup (GTK_LABEL (priv->attachment_expander_num), TRUE); - gtk_misc_set_alignment (GTK_MISC (priv->attachment_expander_label), 0.0, 0.5); - gtk_misc_set_alignment (GTK_MISC (priv->attachment_expander_num), 1.0, 0.5); - expander_hbox = gtk_hbox_new (FALSE, 0); - - 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); - - gtk_box_pack_start (GTK_BOX (expander_hbox), priv->attachment_expander_label, - TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (expander_hbox), priv->attachment_expander_icon, - TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (expander_hbox), priv->attachment_expander_num, - TRUE, TRUE, 0); - gtk_widget_show_all (expander_hbox); - gtk_widget_hide (priv->attachment_expander_icon); - - priv->attachment_expander = e_expander_new (""); - e_expander_set_label_widget (E_EXPANDER (priv->attachment_expander), expander_hbox); - atk_object_set_name (gtk_widget_get_accessible (priv->attachment_expander), _("Show Attachments")); - 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, 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); -} - - static void comp_editor_show_help (CompEditor *editor) { @@ -2637,12 +2251,16 @@ comp_editor_get_client (CompEditor *editor) static void set_attachment_list (CompEditor *editor, GSList *attach_list) { - GSList *p = NULL; - const char *comp_uid= NULL; + EAttachmentPaned *paned; + EAttachmentStore *store; + EAttachmentView *view; + GSList *iter = NULL; - e_cal_component_get_uid (editor->priv->comp, &comp_uid); + paned = E_ATTACHMENT_PANED (editor->priv->attachment_paned); + view = e_attachment_paned_get_view (paned); + store = e_attachment_view_get_store (view); - if (e_attachment_bar_get_num_attachments (E_ATTACHMENT_BAR (editor->priv->attachment_bar))) { + if (e_attachment_store_get_num_attachments (store) > 0) { /* To prevent repopulating the * bar due to redraw functions in fill_widget. * Assumes it can be set only once. @@ -2650,100 +2268,42 @@ set_attachment_list (CompEditor *editor, GSList *attach_list) return; } - for (p = attach_list; p != NULL; p = p->next) { - char *attach_filename; - CamelMimePart *part; - CamelDataWrapper *wrapper; - CamelStream *stream; - struct stat statbuf; - char *mime_type, *file_name; - char *ptr; - - attach_filename = (char *) p->data; - /* should we assert if g_str_has_prefix (attach_filename, "file://")) - * here - */ - /* get url sans protocol and add it to the bar. - * how to set the filename properly */ - file_name = g_filename_from_uri (attach_filename, NULL, NULL); - if (!file_name) - continue; - - if (g_stat (file_name, &statbuf) < 0) { - g_warning ("Cannot attach file %s: %s", file_name, g_strerror (errno)); - g_free (file_name); - continue; - } - - /* return if it's not a regular file */ - if (!S_ISREG (statbuf.st_mode)) { - g_warning ("Cannot attach file %s: not a regular file", file_name); - g_free (file_name); - return; - } + for (iter = attach_list; iter != NULL; iter = iter->next) { + EAttachment *attachment; + const gchar *uri = iter->data; - stream = camel_stream_fs_new_with_name (file_name, O_RDONLY, 0); - if (!stream) { - g_warning ("Cannot attach file %s: %s", file_name, g_strerror (errno)); - g_free (file_name); - return; - } - - 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 (); - } else { - wrapper = camel_data_wrapper_new (); - } - - camel_data_wrapper_construct_from_stream (wrapper, stream); - camel_data_wrapper_set_mime_type (wrapper, mime_type); - g_free (mime_type); - } else { - wrapper = camel_data_wrapper_new (); - camel_data_wrapper_construct_from_stream (wrapper, stream); - camel_data_wrapper_set_mime_type (wrapper, "application/octet-stream"); - } - - camel_object_unref (stream); - - part = camel_mime_part_new (); - camel_medium_set_content_object (CAMEL_MEDIUM (part), wrapper); - camel_object_unref (wrapper); - - camel_mime_part_set_disposition (part, "attachment"); - - ptr = strstr (file_name, comp_uid); - if (ptr) { - ptr += strlen(comp_uid); - if (*ptr++ == '-') - camel_mime_part_set_filename (part, ptr); - } - g_free (file_name); - - e_attachment_bar_attach_mime_part ((EAttachmentBar *) editor->priv->attachment_bar, part); - e_expander_set_expanded (E_EXPANDER (editor->priv->attachment_expander), TRUE); - - camel_object_unref (part); + attachment = e_attachment_new_for_uri (uri); + e_attachment_store_add_attachment (store, attachment); + g_object_unref (attachment); } } static void fill_widgets (CompEditor *editor) { + EAttachmentPaned *paned; + EAttachmentStore *store; + EAttachmentView *view; CompEditorPrivate *priv; GList *l; + paned = E_ATTACHMENT_PANED (editor->priv->attachment_paned); + view = e_attachment_paned_get_view (paned); + store = e_attachment_view_get_store (view); + priv = editor->priv; /*Check if attachments are available here and set them*/ 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); + g_signal_handlers_block_by_func ( + store, G_CALLBACK (attachment_store_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_signal_handlers_unblock_by_func( + store, G_CALLBACK (attachment_store_changed_cb), + editor); g_slist_foreach (attachment_list, (GFunc)g_free, NULL); g_slist_free (attachment_list); } @@ -3068,20 +2628,43 @@ comp_editor_close (CompEditor *editor) GSList * comp_editor_get_mime_attach_list (CompEditor *editor) { + EAttachmentPaned *paned; + EAttachmentStore *store; + EAttachmentView *view; + GtkTreeModel *model; + GtkTreeIter iter; struct CalMimeAttach *cal_mime_attach; - GSList *attach_list = NULL, *l, *parts; + GSList *attach_list = NULL; + gboolean valid; + + paned = E_ATTACHMENT_PANED (editor->priv->attachment_paned); + view = e_attachment_paned_get_view (paned); + store = e_attachment_view_get_store (view); - /* TODO assert sanity of bar */ - parts = e_attachment_bar_get_parts (E_ATTACHMENT_BAR (editor->priv->attachment_bar)); - for (l = parts; l ; l = l->next) { + model = GTK_TREE_MODEL (store); + valid = gtk_tree_model_get_iter_first (model, &iter); + while (valid) { + EAttachment *attachment; CamelDataWrapper *wrapper; + CamelMimePart *mime_part; CamelStreamMem *mstream; unsigned char *buffer = NULL; const char *desc, *disp; + gint column_id; + + column_id = E_ATTACHMENT_STORE_COLUMN_ATTACHMENT; + gtk_tree_model_get (model, &iter, column_id, &attachment, -1); + mime_part = e_attachment_get_mime_part (attachment); + g_object_unref (attachment); + + valid = gtk_tree_model_iter_next (model, &iter); + + if (mime_part == NULL) + continue; cal_mime_attach = g_malloc0 (sizeof (struct CalMimeAttach)); - wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (l->data)); + wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part)); mstream = (CamelStreamMem *) camel_stream_mem_new (); camel_data_wrapper_decode_to_stream (wrapper, (CamelStream *) mstream); @@ -3089,15 +2672,14 @@ comp_editor_get_mime_attach_list (CompEditor *editor) cal_mime_attach->encoded_data = (char *)buffer; cal_mime_attach->length = mstream->buffer->len; - cal_mime_attach->filename = g_strdup (camel_mime_part_get_filename - ((CamelMimePart *) l->data)); - desc = camel_mime_part_get_description ((CamelMimePart *) l->data); + cal_mime_attach->filename = g_strdup (camel_mime_part_get_filename (mime_part)); + desc = camel_mime_part_get_description (mime_part); if (!desc || *desc == '\0') desc = _("attachment"); cal_mime_attach->description = g_strdup (desc); cal_mime_attach->content_type = g_strdup (camel_data_wrapper_get_mime_type (wrapper)); - disp = camel_mime_part_get_disposition ((CamelMimePart *)l->data); + disp = camel_mime_part_get_disposition (mime_part); if (disp && !g_ascii_strcasecmp(disp, "inline")) cal_mime_attach->disposition = TRUE; @@ -3107,8 +2689,6 @@ comp_editor_get_mime_attach_list (CompEditor *editor) } - g_slist_free (parts); - return attach_list; } -- cgit v1.2.3 From 6e163b39c75dbba470d073b4f79a897aa6fb0e54 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 24 Mar 2009 02:05:26 +0000 Subject: Saving progress again on the attachment rewrite. svn path=/branches/kill-bonobo/; revision=37470 --- calendar/gui/dialogs/comp-editor.c | 39 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index e3b1bac053..7e51411002 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -63,6 +63,7 @@ #include "../e-cal-popup.h" #include "../calendar-config-keys.h" #include "cal-attachment-select-file.h" +#include "widgets/misc/e-attachment-view.h" #include "widgets/misc/e-attachment-paned.h" #include "e-util/e-error.h" @@ -233,11 +234,9 @@ drag_data_received (CompEditor *editor, guint info, guint time) { - EAttachmentPaned *paned; EAttachmentView *view; - paned = E_ATTACHMENT_PANED (editor->priv->attachment_paned); - view = e_attachment_paned_get_view (paned); + view = E_ATTACHMENT_VIEW (editor->priv->attachment_paned); e_attachment_view_drag_data_received ( view, context, x, y, selection, info, time); @@ -250,11 +249,9 @@ drag_motion (CompEditor *editor, gint y, guint time) { - EAttachmentPaned *paned; EAttachmentView *view; - paned = E_ATTACHMENT_PANED (editor->priv->attachment_paned); - view = e_attachment_paned_get_view (paned); + view = E_ATTACHMENT_VIEW (editor->priv->attachment_paned); return e_attachment_view_drag_motion (view, context, x, y, time); } @@ -262,7 +259,6 @@ drag_motion (CompEditor *editor, static GSList * get_attachment_list (CompEditor *editor) { - EAttachmentPaned *paned; EAttachmentStore *store; EAttachmentView *view; GtkTreeModel *model; @@ -275,8 +271,7 @@ get_attachment_list (CompEditor *editor) e_cal_component_get_uid (editor->priv->comp, &comp_uid); - paned = E_ATTACHMENT_PANED (editor->priv->attachment_paned); - view = e_attachment_paned_get_view (paned); + view = E_ATTACHMENT_VIEW (editor->priv->attachment_paned); store = e_attachment_view_get_store (view); model = GTK_TREE_MODEL (store); @@ -681,12 +676,10 @@ static void action_attach_cb (GtkAction *action, CompEditor *editor) { - EAttachmentPaned *paned; EAttachmentStore *store; EAttachmentView *view; - paned = E_ATTACHMENT_PANED (editor->priv->attachment_paned); - view = e_attachment_paned_get_view (paned); + view = E_ATTACHMENT_VIEW (editor->priv->attachment_paned); store = e_attachment_view_get_store (view); e_attachment_store_run_load_dialog (store, GTK_WINDOW (editor)); @@ -815,7 +808,6 @@ action_save_cb (GtkAction *action, CompEditor *editor) { CompEditorPrivate *priv = editor->priv; - EAttachmentPaned *paned; EAttachmentStore *store; EAttachmentView *view; ECalComponentText text; @@ -823,11 +815,10 @@ action_save_cb (GtkAction *action, gboolean read_only, correct = FALSE; ECalComponent *comp; - paned = E_ATTACHMENT_PANED (priv->attachment_paned); - view = e_attachment_paned_get_view (paned); + view = E_ATTACHMENT_VIEW (priv->attachment_paned); store = e_attachment_view_get_store (view); - if (e_attachment_store_get_num_downloading (store) > 0) { + if (e_attachment_store_get_num_loading (store) > 0) { gboolean response = 1; /*FIXME: Cannot use mail functions from calendar!!!! */ #if 0 @@ -1504,7 +1495,6 @@ static void comp_editor_init (CompEditor *editor) { CompEditorPrivate *priv; - EAttachmentPaned *paned; EAttachmentView *view; GtkActionGroup *action_group; GtkAction *action; @@ -1626,8 +1616,7 @@ comp_editor_init (CompEditor *editor) /* Add a GtkRecentAction to the "individual" action group. */ action_group = comp_editor_get_action_group (editor, "individual"); - paned = E_ATTACHMENT_PANED (priv->attachment_paned); - view = e_attachment_paned_get_view (paned); + view = E_ATTACHMENT_VIEW (priv->attachment_paned); action = e_attachment_view_recent_action_new ( view, "attach-recent", _("Recent _Documents")); gtk_action_group_add_action (action_group, action); @@ -2251,13 +2240,11 @@ comp_editor_get_client (CompEditor *editor) static void set_attachment_list (CompEditor *editor, GSList *attach_list) { - EAttachmentPaned *paned; EAttachmentStore *store; EAttachmentView *view; GSList *iter = NULL; - paned = E_ATTACHMENT_PANED (editor->priv->attachment_paned); - view = e_attachment_paned_get_view (paned); + view = E_ATTACHMENT_VIEW (editor->priv->attachment_paned); store = e_attachment_view_get_store (view); if (e_attachment_store_get_num_attachments (store) > 0) { @@ -2281,14 +2268,12 @@ set_attachment_list (CompEditor *editor, GSList *attach_list) static void fill_widgets (CompEditor *editor) { - EAttachmentPaned *paned; EAttachmentStore *store; EAttachmentView *view; CompEditorPrivate *priv; GList *l; - paned = E_ATTACHMENT_PANED (editor->priv->attachment_paned); - view = e_attachment_paned_get_view (paned); + view = E_ATTACHMENT_VIEW (editor->priv->attachment_paned); store = e_attachment_view_get_store (view); priv = editor->priv; @@ -2628,7 +2613,6 @@ comp_editor_close (CompEditor *editor) GSList * comp_editor_get_mime_attach_list (CompEditor *editor) { - EAttachmentPaned *paned; EAttachmentStore *store; EAttachmentView *view; GtkTreeModel *model; @@ -2637,8 +2621,7 @@ comp_editor_get_mime_attach_list (CompEditor *editor) GSList *attach_list = NULL; gboolean valid; - paned = E_ATTACHMENT_PANED (editor->priv->attachment_paned); - view = e_attachment_paned_get_view (paned); + view = E_ATTACHMENT_VIEW (editor->priv->attachment_paned); store = e_attachment_view_get_store (view); model = GTK_TREE_MODEL (store); -- cgit v1.2.3 From c05c973cff53769ef575bfc5257a2a414117b323 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 26 Mar 2009 04:48:21 +0000 Subject: Saving progress again on the attachment rewrite. svn path=/branches/kill-bonobo/; revision=37476 --- calendar/gui/dialogs/comp-editor.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 7e51411002..ce53f8f79f 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -2261,6 +2261,9 @@ set_attachment_list (CompEditor *editor, GSList *attach_list) attachment = e_attachment_new_for_uri (uri); e_attachment_store_add_attachment (store, attachment); + e_attachment_load_async ( + attachment, (GAsyncReadyCallback) + e_attachment_load_handle_error, editor); g_object_unref (attachment); } } -- cgit v1.2.3 From 8a1f639a670696e71daac8305ae0823668d29a14 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 30 Mar 2009 03:38:36 +0000 Subject: Saving progress again on the attachment rewrite. svn path=/branches/kill-bonobo/; revision=37482 --- calendar/gui/dialogs/comp-editor.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index ce53f8f79f..d2226e4d2a 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -158,8 +158,6 @@ static const gchar *ui = " " " " " " -" " -" " " " ""; -- cgit v1.2.3 From 942cdf2df9091e347e09c25d62015e77775f38b6 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 11 Apr 2009 00:14:51 +0000 Subject: Bug fixes and formerly unfinished bits of the attachment rewrite. svn path=/branches/kill-bonobo/; revision=37513 --- calendar/gui/dialogs/comp-editor.c | 24 ++++++++++++------------ 1 file changed, 12 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 d2226e4d2a..9926b8cea2 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -95,7 +95,7 @@ struct _CompEditorPrivate { GtkNotebook *notebook; /* Attachment handling */ - GtkWidget *attachment_paned; + GtkWidget *attachment_view; /* Manages menus and toolbars */ GtkUIManager *manager; @@ -234,7 +234,7 @@ drag_data_received (CompEditor *editor, { EAttachmentView *view; - view = E_ATTACHMENT_VIEW (editor->priv->attachment_paned); + view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); e_attachment_view_drag_data_received ( view, context, x, y, selection, info, time); @@ -249,7 +249,7 @@ drag_motion (CompEditor *editor, { EAttachmentView *view; - view = E_ATTACHMENT_VIEW (editor->priv->attachment_paned); + view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); return e_attachment_view_drag_motion (view, context, x, y, time); } @@ -269,7 +269,7 @@ get_attachment_list (CompEditor *editor) e_cal_component_get_uid (editor->priv->comp, &comp_uid); - view = E_ATTACHMENT_VIEW (editor->priv->attachment_paned); + view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); store = e_attachment_view_get_store (view); model = GTK_TREE_MODEL (store); @@ -677,7 +677,7 @@ action_attach_cb (GtkAction *action, EAttachmentStore *store; EAttachmentView *view; - view = E_ATTACHMENT_VIEW (editor->priv->attachment_paned); + view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); store = e_attachment_view_get_store (view); e_attachment_store_run_load_dialog (store, GTK_WINDOW (editor)); @@ -813,7 +813,7 @@ action_save_cb (GtkAction *action, gboolean read_only, correct = FALSE; ECalComponent *comp; - view = E_ATTACHMENT_VIEW (priv->attachment_paned); + view = E_ATTACHMENT_VIEW (priv->attachment_view); store = e_attachment_view_get_store (view); if (e_attachment_store_get_num_loading (store) > 0) { @@ -1600,11 +1600,11 @@ comp_editor_init (CompEditor *editor) widget = e_attachment_paned_new (); gtk_container_set_border_width (GTK_CONTAINER (widget), 6); gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); - priv->attachment_paned = g_object_ref (widget); + priv->attachment_view = g_object_ref (widget); gtk_widget_show (widget); container = e_attachment_paned_get_content_area ( - E_ATTACHMENT_PANED (priv->attachment_paned)); + E_ATTACHMENT_PANED (priv->attachment_view)); widget = gtk_notebook_new (); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE); @@ -1614,7 +1614,7 @@ comp_editor_init (CompEditor *editor) /* Add a GtkRecentAction to the "individual" action group. */ action_group = comp_editor_get_action_group (editor, "individual"); - view = E_ATTACHMENT_VIEW (priv->attachment_paned); + view = E_ATTACHMENT_VIEW (priv->attachment_view); action = e_attachment_view_recent_action_new ( view, "attach-recent", _("Recent _Documents")); gtk_action_group_add_action (action_group, action); @@ -2242,7 +2242,7 @@ set_attachment_list (CompEditor *editor, GSList *attach_list) EAttachmentView *view; GSList *iter = NULL; - view = E_ATTACHMENT_VIEW (editor->priv->attachment_paned); + view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); store = e_attachment_view_get_store (view); if (e_attachment_store_get_num_attachments (store) > 0) { @@ -2274,7 +2274,7 @@ fill_widgets (CompEditor *editor) CompEditorPrivate *priv; GList *l; - view = E_ATTACHMENT_VIEW (editor->priv->attachment_paned); + view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); store = e_attachment_view_get_store (view); priv = editor->priv; @@ -2622,7 +2622,7 @@ comp_editor_get_mime_attach_list (CompEditor *editor) GSList *attach_list = NULL; gboolean valid; - view = E_ATTACHMENT_VIEW (editor->priv->attachment_paned); + view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); store = e_attachment_view_get_store (view); model = GTK_TREE_MODEL (store); -- cgit v1.2.3 From 611ed0f3cfe8cfe29d8ed8e0830905cef96d9082 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 24 Apr 2009 10:19:11 -0400 Subject: Fix the "Recent Documents" menu in CompEditor. --- calendar/gui/dialogs/comp-editor.c | 45 ++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 9 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 9926b8cea2..65e5e71183 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -146,7 +146,7 @@ static const gchar *ui = " " " " " " -" " +" " " " " " " " @@ -1192,6 +1192,40 @@ static GtkToggleActionEntry coordinated_toggle_entries[] = { FALSE } }; +static void +comp_editor_setup_recent_menu (CompEditor *editor) +{ + EAttachmentView *view; + GtkUIManager *ui_manager; + GtkAction *action; + GtkActionGroup *action_group; + const gchar *action_name; + const gchar *path; + guint merge_id; + + ui_manager = editor->priv->manager; + view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); + action_group = comp_editor_get_action_group (editor, "individual"); + merge_id = gtk_ui_manager_new_merge_id (ui_manager); + path = "/main-menu/insert-menu/recent-placeholder"; + action_name = "recent-menu"; + + action = e_attachment_view_recent_action_new ( + view, action_name, _("Recent _Documents")); + + if (action != NULL) { + gtk_action_group_add_action (action_group, action); + g_object_unref (action); + + gtk_ui_manager_add_ui ( + ui_manager, merge_id, path, + action_name, action_name, + GTK_UI_MANAGER_AUTO, FALSE); + } + + gtk_ui_manager_ensure_update (ui_manager); +} + static void comp_editor_set_property (GObject *object, guint property_id, @@ -1493,7 +1527,6 @@ static void comp_editor_init (CompEditor *editor) { CompEditorPrivate *priv; - EAttachmentView *view; GtkActionGroup *action_group; GtkAction *action; GtkWidget *container; @@ -1612,13 +1645,7 @@ comp_editor_init (CompEditor *editor) priv->notebook = GTK_NOTEBOOK (widget); gtk_widget_show (widget); - /* Add a GtkRecentAction to the "individual" action group. */ - action_group = comp_editor_get_action_group (editor, "individual"); - view = E_ATTACHMENT_VIEW (priv->attachment_view); - action = e_attachment_view_recent_action_new ( - view, "attach-recent", _("Recent _Documents")); - gtk_action_group_add_action (action_group, action); - g_object_unref (action); + comp_editor_setup_recent_menu (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); -- cgit v1.2.3 From faf1c14c11f3e6026f786e9587715c10b13c723e Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 25 Apr 2009 10:16:00 -0400 Subject: Manual conflict resolution --- calendar/gui/dialogs/comp-editor.c | 19 ++++--------------- calendar/gui/dialogs/task-page.c | 4 ++-- 2 files changed, 6 insertions(+), 17 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 9405663a9b..e1a7a26f4d 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -102,11 +102,6 @@ struct _CompEditorPrivate { gchar *summary; - /* Manages menus and toolbars */ - GtkUIManager *manager; - - gchar *summary; - guint32 attachment_bar_visible : 1; /* TODO use this flags for setting all the boolean variables @@ -167,7 +162,6 @@ static const gchar *ui = ""; 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, gboolean strip_alarms); @@ -506,7 +500,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); @@ -1959,11 +1953,10 @@ comp_editor_set_flags (CompEditor *editor, g_object_notify (G_OBJECT (editor), "flags"); } -GtkActionGroup * -comp_editor_get_action_group (CompEditor *editor, - const gchar *group_name) +CompEditorFlags +comp_editor_get_flags (CompEditor *editor) { - g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); + g_return_val_if_fail (IS_COMP_EDITOR (editor), 0); return editor->priv->flags; } @@ -2311,7 +2304,6 @@ fill_widgets (CompEditor *editor) EAttachmentView *view; CompEditorPrivate *priv; GList *l; - GtkAction *action; view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); store = e_attachment_view_get_store (view); @@ -2333,9 +2325,6 @@ 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); } diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 486b86ea34..4c5a5536ea 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -1573,8 +1573,8 @@ categories_clicked_cb (GtkWidget *button, { GtkEntry *entry; - entry = priv->categories; - e_categories_config_open_dialog_for_entry (GTK_ENTRY (entry)); + entry = GTK_ENTRY (tpage->priv->categories); + e_categories_config_open_dialog_for_entry (entry); } static gboolean -- cgit v1.2.3 From dc7efb1311d23c32a76a9a8092f734223ce3207e Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 25 Apr 2009 10:49:45 -0400 Subject: Use consistent variable names for GtkUIManager --- calendar/gui/dialogs/comp-editor.c | 30 +++++++++++++++--------------- calendar/gui/dialogs/event-editor.c | 10 +++++----- calendar/gui/dialogs/memo-editor.c | 10 +++++----- calendar/gui/dialogs/task-editor.c | 10 +++++----- 4 files changed, 30 insertions(+), 30 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index e1a7a26f4d..4cf74613cf 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -98,7 +98,7 @@ struct _CompEditorPrivate { GtkWidget *attachment_view; /* Manages menus and toolbars */ - GtkUIManager *manager; + GtkUIManager *ui_manager; gchar *summary; @@ -1208,7 +1208,7 @@ comp_editor_setup_recent_menu (CompEditor *editor) const gchar *path; guint merge_id; - ui_manager = editor->priv->manager; + ui_manager = editor->priv->ui_manager; view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); action_group = comp_editor_get_action_group (editor, "individual"); merge_id = gtk_ui_manager_new_merge_id (ui_manager); @@ -1340,9 +1340,9 @@ comp_editor_dispose (GObject *object) priv->comp = NULL; } - if (priv->manager != NULL) { - g_object_unref (priv->manager); - priv->manager = NULL; + if (priv->ui_manager != NULL) { + g_object_unref (priv->ui_manager); + priv->ui_manager = NULL; } /* Chain up to parent's dispose() method. */ @@ -1556,11 +1556,11 @@ comp_editor_init (CompEditor *editor) priv->warned = FALSE; priv->is_group_item = FALSE; - priv->manager = gtk_ui_manager_new (); + priv->ui_manager = gtk_ui_manager_new (); gtk_window_add_accel_group ( GTK_WINDOW (editor), - gtk_ui_manager_get_accel_group (priv->manager)); + gtk_ui_manager_get_accel_group (priv->ui_manager)); /* Setup Action Groups */ @@ -1571,7 +1571,7 @@ comp_editor_init (CompEditor *editor) action_group, core_entries, G_N_ELEMENTS (core_entries), editor); gtk_ui_manager_insert_action_group ( - priv->manager, action_group, 0); + priv->ui_manager, action_group, 0); g_object_unref (action_group); action_group = gtk_action_group_new ("individual"); @@ -1589,7 +1589,7 @@ comp_editor_init (CompEditor *editor) E_CAL_COMPONENT_CLASS_PUBLIC, NULL, NULL); /* no callback */ gtk_ui_manager_insert_action_group ( - priv->manager, action_group, 0); + priv->ui_manager, action_group, 0); g_object_unref (action_group); action_group = gtk_action_group_new ("coordinated"); @@ -1599,7 +1599,7 @@ comp_editor_init (CompEditor *editor) action_group, coordinated_toggle_entries, G_N_ELEMENTS (coordinated_toggle_entries), editor); gtk_ui_manager_insert_action_group ( - priv->manager, action_group, 0); + priv->ui_manager, action_group, 0); g_object_unref (action_group); /* Fine Tuning */ @@ -1611,7 +1611,7 @@ comp_editor_init (CompEditor *editor) 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); + gtk_ui_manager_add_ui_from_string (priv->ui_manager, ui, -1, &error); if (error != NULL) { g_warning ("%s: %s", G_STRFUNC, error->message); g_error_free (error); @@ -1966,7 +1966,7 @@ comp_editor_get_ui_manager (CompEditor *editor) { g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); - return editor->priv->manager; + return editor->priv->ui_manager; } GtkAction * @@ -2001,14 +2001,14 @@ GtkWidget * comp_editor_get_managed_widget (CompEditor *editor, const gchar *widget_path) { - GtkUIManager *manager; + GtkUIManager *ui_manager; GtkWidget *widget; g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); g_return_val_if_fail (widget_path != NULL, NULL); - manager = comp_editor_get_ui_manager (editor); - widget = gtk_ui_manager_get_widget (manager, widget_path); + ui_manager = comp_editor_get_ui_manager (editor); + widget = gtk_ui_manager_get_widget (ui_manager, widget_path); g_return_val_if_fail (widget != NULL, NULL); return widget; diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 812575ef4c..c39e25acd5 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -462,7 +462,7 @@ static void event_editor_init (EventEditor *ee) { CompEditor *editor = COMP_EDITOR (ee); - GtkUIManager *manager; + GtkUIManager *ui_manager; GtkActionGroup *action_group; GtkAction *action; const gchar *id; @@ -486,12 +486,12 @@ event_editor_init (EventEditor *ee) 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); + ui_manager = comp_editor_get_ui_manager (editor); + gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error); id = "org.gnome.evolution.event-editor"; - e_plugin_ui_register_manager (manager, id, ee); - e_plugin_ui_enable_manager (manager, id); + e_plugin_ui_register_manager (ui_manager, id, ee); + e_plugin_ui_enable_manager (ui_manager, id); if (error != NULL) { g_critical ("%s: %s", G_STRFUNC, error->message); diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c index 5e01327703..ec7ab841c9 100644 --- a/calendar/gui/dialogs/memo-editor.c +++ b/calendar/gui/dialogs/memo-editor.c @@ -133,19 +133,19 @@ static void memo_editor_init (MemoEditor *me) { CompEditor *editor = COMP_EDITOR (me); - GtkUIManager *manager; + GtkUIManager *ui_manager; const gchar *id; GError *error = NULL; me->priv = MEMO_EDITOR_GET_PRIVATE (me); me->priv->updating = FALSE; - manager = comp_editor_get_ui_manager (editor); - gtk_ui_manager_add_ui_from_string (manager, ui, -1, &error); + ui_manager = comp_editor_get_ui_manager (editor); + gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error); id = "org.gnome.evolution.memo-editor"; - e_plugin_ui_register_manager (manager, id, me); - e_plugin_ui_enable_manager (manager, id); + e_plugin_ui_register_manager (ui_manager, id, me); + e_plugin_ui_enable_manager (ui_manager, id); if (error != NULL) { g_critical ("%s: %s", G_STRFUNC, error->message); diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 773dea4a47..b7edd0a566 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -301,7 +301,7 @@ static void task_editor_init (TaskEditor *te) { CompEditor *editor = COMP_EDITOR (te); - GtkUIManager *manager; + GtkUIManager *ui_manager; GtkActionGroup *action_group; const gchar *id; GError *error = NULL; @@ -344,12 +344,12 @@ task_editor_init (TaskEditor *te) 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); + ui_manager = comp_editor_get_ui_manager (editor); + gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error); id = "org.gnome.evolution.task-editor"; - e_plugin_ui_register_manager (manager, id, te); - e_plugin_ui_enable_manager (manager, id); + e_plugin_ui_register_manager (ui_manager, id, te); + e_plugin_ui_enable_manager (ui_manager, id); if (error != NULL) { g_critical ("%s: %s", G_STRFUNC, error->message); -- cgit v1.2.3 From d261d0b2e46d4793c2d54540782552846535eb60 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 25 Apr 2009 19:37:21 -0400 Subject: Begin migrating calendar settings to EShellSettings. Begin dismantling calendar-config.c and migrating calendar settings to EShellSettings. EShellSettings utilizes GObject properties instead of separate get/set/notify functions for each setting. --- calendar/gui/dialogs/cal-prefs-dialog.c | 53 ++++++++++++--------- calendar/gui/dialogs/cal-prefs-dialog.h | 31 ++++++++++--- calendar/gui/dialogs/comp-editor.c | 81 +++++++++++++++++++++++++-------- calendar/gui/dialogs/comp-editor.h | 2 + calendar/gui/dialogs/event-editor.c | 7 ++- calendar/gui/dialogs/event-editor.h | 1 + calendar/gui/dialogs/event-page.c | 55 ++++++++++++++++++---- calendar/gui/dialogs/memo-editor.c | 7 ++- calendar/gui/dialogs/memo-editor.h | 1 + calendar/gui/dialogs/memo-page.c | 10 +++- calendar/gui/dialogs/task-editor.c | 7 ++- calendar/gui/dialogs/task-editor.h | 1 + calendar/gui/dialogs/task-page.c | 47 +++++++++++++++---- 13 files changed, 230 insertions(+), 73 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 70058bcd89..6d50a406b3 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -31,6 +31,7 @@ #include "../calendar-config.h" #include "cal-prefs-dialog.h" #include +#include #include #include #include @@ -480,7 +481,9 @@ template_url_changed (GtkEntry *entry, CalendarPrefsDialog *prefs) } static void -update_system_tz_widgets (CalendarPrefsDialog *prefs) +update_system_tz_widgets (EShellSettings *shell_settings, + GParamSpec *pspec, + CalendarPrefsDialog *prefs) { icaltimezone *zone; @@ -492,15 +495,6 @@ update_system_tz_widgets (CalendarPrefsDialog *prefs) } 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 @@ -511,7 +505,6 @@ 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); @@ -645,11 +638,6 @@ 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_stored (); zone = icaltimezone_get_builtin_timezone (location); @@ -752,13 +740,16 @@ eccp_free (EConfig *ec, GSList *items, void *data) } static void -calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs) +calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, + EShell *shell) { GladeXML *gui; ECalConfig *ec; ECalConfigTargetPrefs *target; + EShellSettings *shell_settings; int i; GtkWidget *toplevel; + GtkWidget *widget; GSList *l; const char *working_day_names[] = { "sun_button", @@ -771,6 +762,8 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs) }; char *gladefile; + shell_settings = e_shell_get_shell_settings (shell); + gladefile = g_build_filename (EVOLUTION_GLADEDIR, "cal-prefs-dialog.glade", NULL); @@ -794,8 +787,20 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs) l = g_slist_prepend (l, &eccp_items[i]); e_config_add_items ((EConfig *) ec, l, NULL, NULL, eccp_free, prefs); + widget = glade_xml_get_widget (gui, "use-system-tz-check"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-use-system-timezone", + G_OBJECT (widget), "active"); + g_signal_connect ( + G_OBJECT (shell_settings), "notify::cal-use-system-timezone", + G_CALLBACK (update_system_tz_widgets), prefs); + + widget = glade_xml_get_widget (gui, "timezone"); + e_mutual_binding_new_with_negation ( + G_OBJECT (shell_settings), "cal-use-system-timezone", + G_OBJECT (widget), "sensitive"); + /* 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"); @@ -865,14 +870,18 @@ calendar_prefs_dialog_get_type (void) } GtkWidget * -calendar_prefs_dialog_new (void) +calendar_prefs_dialog_new (EShell *shell) { CalendarPrefsDialog *dialog; - dialog = (CalendarPrefsDialog *) g_object_new (calendar_prefs_dialog_get_type (), NULL); - calendar_prefs_dialog_construct (dialog); + g_return_val_if_fail (E_IS_SHELL (shell), NULL); + + dialog = g_object_new (CALENDAR_TYPE_PREFS_DIALOG, NULL); + + /* FIXME Kill this function. */ + calendar_prefs_dialog_construct (dialog, shell); - return (GtkWidget *) dialog; + return GTK_WIDGET (dialog); } /* called by libglade to create our custom EDateEdit widgets. */ diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 0ef1e4a667..84c1873e9a 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -21,13 +21,33 @@ * */ -#ifndef _CAL_PREFS_DIALOG_H_ -#define _CAL_PREFS_DIALOG_H_ +#ifndef CAL_PREFS_DIALOG_H +#define CAL_PREFS_DIALOG_H #include #include #include #include +#include + +/* Standard GObject macros */ +#define CALENDAR_TYPE_PREFS_DIALOG \ + (calendar_prefs_dialog_get_type ()) +#define CALENDAR_PREFS_DIALOG(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), CALENDAR_TYPE_PREFS_DIALOG, CalendarPrefsDialog)) +#define CALENDAR_PREFS_DIALOG_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), CALENDAR_TYPE_PREFS_DIALOG, CalendarPrefsDialogClass)) +#define CALENDAR_IS_PREFS_DIALOG(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), CALENDAR_TYPE_PREFS_DIALOG)) +#define CALENDAR_IS_PREFS_DIALOG_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), CALENDAR_TYPE_PREFS_DIALOG)) +#define CALENDAR_PREFS_DIALOG_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), CALENDAR_TYPE_PREFS_DIALOG, CalendarPrefsDialogClass)) G_BEGIN_DECLS @@ -42,7 +62,6 @@ struct _CalendarPrefsDialog { GConfClient *gconf; /* General tab */ - GtkWidget *use_system_tz_check; GtkWidget *system_tz_label; GtkWidget *timezone; GtkWidget *day_second_zone; @@ -93,9 +112,9 @@ struct _CalendarPrefsDialogClass { GtkVBoxClass parent; }; -GType calendar_prefs_dialog_get_type (void); -GtkWidget *calendar_prefs_dialog_new (void); +GType calendar_prefs_dialog_get_type (void); +GtkWidget * calendar_prefs_dialog_new (EShell *shell); G_END_DECLS -#endif /* _CAL_PREFS_DIALOG_H_ */ +#endif /* CAL_PREFS_DIALOG_H */ diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 4cf74613cf..4db6c66b12 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -76,6 +76,9 @@ /* Private part of the CompEditor structure */ struct _CompEditorPrivate { + + gpointer shell; /* weak pointer */ + /* Client to use */ ECal *client; @@ -125,6 +128,7 @@ enum { PROP_CHANGED, PROP_CLIENT, PROP_FLAGS, + PROP_SHELL, PROP_SUMMARY }; @@ -1231,6 +1235,17 @@ comp_editor_setup_recent_menu (CompEditor *editor) gtk_ui_manager_ensure_update (ui_manager); } +static void +comp_editor_set_shell (CompEditor *editor, + EShell *shell) +{ + g_return_if_fail (editor->priv->shell == NULL); + + editor->priv->shell = shell; + + g_object_add_weak_pointer (G_OBJECT (shell), &editor->priv->shell); +} + static void comp_editor_set_property (GObject *object, guint property_id, @@ -1256,6 +1271,12 @@ comp_editor_set_property (GObject *object, g_value_get_int (value)); return; + case PROP_SHELL: + comp_editor_set_shell ( + COMP_EDITOR (object), + g_value_get_object (value)); + return; + case PROP_SUMMARY: comp_editor_set_summary ( COMP_EDITOR (object), @@ -1291,6 +1312,12 @@ comp_editor_get_property (GObject *object, COMP_EDITOR (object))); return; + case PROP_SHELL: + g_value_set_object ( + value, comp_editor_get_shell ( + COMP_EDITOR (object))); + return; + case PROP_SUMMARY: g_value_set_string ( value, comp_editor_get_summary ( @@ -1366,42 +1393,39 @@ static void comp_editor_map (GtkWidget *widget) { CompEditor *editor = COMP_EDITOR (widget); - GConfBridge *bridge = gconf_bridge_get (); + GConfBridge *bridge; GtkAction *action; + const gchar *key; + + bridge = gconf_bridge_get (); /* 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. */ + key = "/apps/evolution/calendar/display/show_categories"; action = comp_editor_get_action (editor, "view-categories"); - gconf_bridge_bind_property ( - bridge, CALENDAR_CONFIG_SHOW_CATEGORIES, - G_OBJECT (action), "active"); + gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + key = "/apps/evolution/calendar/display/show_role"; action = comp_editor_get_action (editor, "view-role"); - gconf_bridge_bind_property ( - bridge, CALENDAR_CONFIG_SHOW_ROLE, - G_OBJECT (action), "active"); + gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + key = "/apps/evolution/calendar/display/show_rsvp"; action = comp_editor_get_action (editor, "view-rsvp"); - gconf_bridge_bind_property ( - bridge, CALENDAR_CONFIG_SHOW_RSVP, - G_OBJECT (action), "active"); + gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + key = "/apps/evolution/calendar/display/show_status"; action = comp_editor_get_action (editor, "view-status"); - gconf_bridge_bind_property ( - bridge, CALENDAR_CONFIG_SHOW_STATUS, - G_OBJECT (action), "active"); + gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + key = "/apps/evolution/calendar/display/show_timezone"; action = comp_editor_get_action (editor, "view-time-zone"); - gconf_bridge_bind_property ( - bridge, CALENDAR_CONFIG_SHOW_TIMEZONE, - G_OBJECT (action), "active"); + gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + key = "/apps/evolution/calendar/display/show_type"; action = comp_editor_get_action (editor, "view-type"); - gconf_bridge_bind_property ( - bridge, CALENDAR_CONFIG_SHOW_TYPE, - G_OBJECT (action), "active"); + gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); /* Chain up to parent's map() method. */ GTK_WIDGET_CLASS (comp_editor_parent_class)->map (widget); @@ -1508,6 +1532,17 @@ comp_editor_class_init (CompEditorClass *class) G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_object_class_install_property ( + object_class, + PROP_SHELL, + g_param_spec_object ( + "shell", + NULL, + NULL, + E_TYPE_SHELL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property ( object_class, PROP_SUMMARY, @@ -1849,6 +1884,14 @@ comp_editor_get_classification (CompEditor *editor) return gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action)); } +EShell * +comp_editor_get_shell (CompEditor *editor) +{ + g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); + + return editor->priv->shell; +} + void comp_editor_set_summary (CompEditor *editor, const gchar *summary) diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 7fdc17ba16..a6231d55b5 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -29,6 +29,7 @@ #include #include "../itip-utils.h" #include "comp-editor-page.h" +#include /* Standard GObject macros */ #define TYPE_COMP_EDITOR \ @@ -108,6 +109,7 @@ void comp_editor_set_classification (CompEditor *editor, ECalComponentClassification classification); ECalComponentClassification comp_editor_get_classification (CompEditor *editor); +EShell * comp_editor_get_shell (CompEditor *editor); void comp_editor_set_summary (CompEditor *editor, const gchar *summary); const gchar * comp_editor_get_summary (CompEditor *editor); diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index c39e25acd5..be12f71ab8 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -667,13 +667,16 @@ event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboo * editor could not be created. **/ CompEditor * -event_editor_new (ECal *client, CompEditorFlags flags) +event_editor_new (ECal *client, + EShell *shell, + CompEditorFlags flags) { g_return_val_if_fail (E_IS_CAL (client), NULL); + g_return_val_if_fail (E_IS_SHELL (client), NULL); return g_object_new ( TYPE_EVENT_EDITOR, - "flags", flags, "client", client, NULL); + "client", client, "flags", flags, "shell", shell, NULL); } void diff --git a/calendar/gui/dialogs/event-editor.h b/calendar/gui/dialogs/event-editor.h index c050b92dfb..c2dde76673 100644 --- a/calendar/gui/dialogs/event-editor.h +++ b/calendar/gui/dialogs/event-editor.h @@ -66,6 +66,7 @@ struct _EventEditorClass { GType event_editor_get_type (void); CompEditor * event_editor_new (ECal *client, + EShell *shell, CompEditorFlags flags); void event_editor_show_meeting (EventEditor *ee); diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index b0fcdc4632..7c548797ab 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -368,9 +368,11 @@ update_time (EventPage *epage, ECalComponentDateTime *start_date, ECalComponentD EventPagePrivate *priv = epage->priv; CompEditor *editor; ECal *client; + GtkAction *action; struct icaltimetype *start_tt, *end_tt, implied_tt; icaltimezone *start_zone = NULL, *def_zone = NULL; gboolean all_day_event, homezone=TRUE; + gboolean show_timezone; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage)); client = comp_editor_get_client (editor); @@ -442,7 +444,9 @@ update_time (EventPage *epage, ECalComponentDateTime *start_date, ECalComponentD if (!def_zone || !start_zone || strcmp (icaltimezone_get_tzid(def_zone), icaltimezone_get_tzid (start_zone))) homezone = FALSE; - event_page_set_show_timezone (epage, (calendar_config_get_show_timezone()|| !homezone) & !all_day_event); + action = comp_editor_get_action (editor, "view-time-zone"); + show_timezone = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + event_page_set_show_timezone (epage, (show_timezone || !homezone) & !all_day_event); /*unblock the endtimezone widget*/ g_signal_handlers_unblock_matched (priv->end_timezone, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); @@ -1994,6 +1998,7 @@ event_page_set_all_day_event (EventPage *epage, gboolean all_day) CompEditor *editor; GtkAction *action; gboolean date_set; + gboolean active; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage)); @@ -2072,7 +2077,10 @@ event_page_set_all_day_event (EventPage *epage, gboolean all_day) TRUE); } - event_page_set_show_timezone (epage, calendar_config_get_show_timezone() & !all_day); + action = comp_editor_get_action (editor, "view-time-zone"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + event_page_set_show_timezone (epage, active & !all_day); + g_signal_handlers_block_matched (priv->start_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); g_signal_handlers_block_matched (priv->end_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); @@ -2154,10 +2162,12 @@ event_page_set_info_string (EventPage *epage, const gchar *icon, const gchar *ms static gboolean get_widgets (EventPage *epage) { + CompEditor *editor; CompEditorPage *page = COMP_EDITOR_PAGE (epage); GtkEntryCompletion *completion; EventPagePrivate *priv; GSList *accel_groups; + GtkAction *action; GtkWidget *toplevel; GtkWidget *sw; @@ -2165,6 +2175,8 @@ get_widgets (EventPage *epage) #define GW(name) glade_xml_get_widget (priv->xml, name) + editor = comp_editor_page_get_editor (page); + priv->main = GW ("event-page"); if (!priv->main) return FALSE; @@ -2186,7 +2198,8 @@ get_widgets (EventPage *epage) gtk_widget_show (priv->status_icons); - if (!calendar_config_get_show_timezone()) { + action = comp_editor_get_action (editor, "view-time-zone"); + if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) { gtk_widget_hide (priv->timezone_label); gtk_widget_hide (priv->start_timezone); } else { @@ -2778,7 +2791,9 @@ init_widgets (EventPage *epage) GtkTextBuffer *text_buffer; icaltimezone *zone; char *combo_label = NULL; + GtkAction *action; GtkTreeSelection *selection; + gboolean active; ECal *client; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage)); @@ -2835,11 +2850,28 @@ init_widgets (EventPage *epage) g_signal_connect((priv->start_timezone), "changed", G_CALLBACK (start_timezone_changed_cb), epage); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_ATTENDEE_COL, TRUE); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_ROLE_COL, calendar_config_get_show_role ()); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_RSVP_COL, calendar_config_get_show_rsvp ()); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_STATUS_COL, calendar_config_get_show_status ()); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_TYPE_COL, calendar_config_get_show_type ()); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_ATTENDEE_COL, TRUE); + + action = comp_editor_get_action (editor, "view-role"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_ROLE_COL, active); + + action = comp_editor_get_action (editor, "view-rsvp"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_RSVP_COL, active); + + action = comp_editor_get_action (editor, "view-status"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_STATUS_COL, active); + + action = comp_editor_get_action (editor, "view-type"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_TYPE_COL, active); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->list_view)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); @@ -2875,7 +2907,8 @@ init_widgets (EventPage *epage) gtk_widget_show (GTK_WIDGET (priv->list_view)); /* categories */ - if (!calendar_config_get_show_categories()) { + action = comp_editor_get_action (editor, "view-categories"); + if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) { gtk_widget_hide (priv->categories_btn); gtk_widget_hide (priv->categories); } else { @@ -2966,7 +2999,9 @@ init_widgets (EventPage *epage) e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->start_timezone), zone); e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->end_timezone), zone); - event_page_set_show_timezone (epage, calendar_config_get_show_timezone()); + action = comp_editor_get_action (editor, "view-time-zone"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + event_page_set_show_timezone (epage, active); return TRUE; } diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c index ec7ab841c9..8de23430c9 100644 --- a/calendar/gui/dialogs/memo-editor.c +++ b/calendar/gui/dialogs/memo-editor.c @@ -163,11 +163,14 @@ memo_editor_init (MemoEditor *me) * editor could not be created. **/ CompEditor * -memo_editor_new (ECal *client, CompEditorFlags flags) +memo_editor_new (ECal *client, + EShell *shell, + CompEditorFlags flags) { g_return_val_if_fail (E_IS_CAL (client), NULL); + g_return_val_if_fail (E_IS_SHELL (shell), NULL); return g_object_new ( TYPE_MEMO_EDITOR, - "flags", flags, "client", client, NULL); + "client", client, "flags", flags, "shell", shell, NULL); } diff --git a/calendar/gui/dialogs/memo-editor.h b/calendar/gui/dialogs/memo-editor.h index b45edd18ce..34db230121 100644 --- a/calendar/gui/dialogs/memo-editor.h +++ b/calendar/gui/dialogs/memo-editor.h @@ -68,6 +68,7 @@ struct _MemoEditorClass { GType memo_editor_get_type (void); CompEditor * memo_editor_new (ECal *client, + EShell *shell, CompEditorFlags flags); G_END_DECLS diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index 4f8c37c0a3..a15c1b1f88 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -929,9 +929,14 @@ to_button_clicked_cb (GtkButton *button, static gboolean init_widgets (MemoPage *mpage) { + CompEditor *editor; MemoPagePrivate *priv = mpage->priv; GtkTextBuffer *buffer; GtkTextView *view; + GtkAction *action; + gboolean active; + + editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage)); /* Generic informative messages */ gtk_widget_hide (priv->info_hbox); @@ -996,8 +1001,9 @@ init_widgets (MemoPage *mpage) G_CALLBACK (comp_editor_page_changed), mpage); } - memo_page_set_show_categories ( - mpage, calendar_config_get_show_categories()); + action = comp_editor_get_action (editor, "view-categories"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + memo_page_set_show_categories (mpage, active); return TRUE; } diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index b7edd0a566..9ee3f02a17 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -492,13 +492,16 @@ task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gbool * editor could not be created. **/ CompEditor * -task_editor_new (ECal *client, CompEditorFlags flags) +task_editor_new (ECal *client, + EShell *shell, + CompEditorFlags flags) { g_return_val_if_fail (E_IS_CAL (client), NULL); + g_return_val_if_fail (E_IS_SHELL (shell), NULL); return g_object_new ( TYPE_TASK_EDITOR, - "flags", flags, "client", client, NULL); + "client", client, "flags", flags, "shell", shell, NULL); } void diff --git a/calendar/gui/dialogs/task-editor.h b/calendar/gui/dialogs/task-editor.h index 9376b4149a..64180ec1fb 100644 --- a/calendar/gui/dialogs/task-editor.h +++ b/calendar/gui/dialogs/task-editor.h @@ -66,6 +66,7 @@ struct _TaskEditorClass { GType task_editor_get_type (void); CompEditor * task_editor_new (ECal *client, + EShell *shell, CompEditorFlags flags); void task_editor_show_assignment (TaskEditor *te); diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 4c5a5536ea..d020d5cd4f 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -451,12 +451,14 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) ECalComponentClassification cl; CompEditor *editor; CompEditorFlags flags; + GtkAction *action; ECal *client; GSList *l; icalcomponent *icalcomp; const char *categories, *uid; icaltimezone *zone, *default_zone; gchar *backend_addr = NULL; + gboolean active; tpage = TASK_PAGE (page); priv = tpage->priv; @@ -538,7 +540,10 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->timezone), zone ? zone : default_zone); - task_page_set_show_timezone (tpage, calendar_config_get_show_timezone()); + + action = comp_editor_get_action (editor, "view-time-zone"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + task_page_set_show_timezone (tpage, active); if (!(flags & COMP_EDITOR_NEW_ITEM) && !zone) { GtkAction *action; @@ -1829,12 +1834,17 @@ task_page_sendoptions_clicked_cb (TaskPage *tpage) static gboolean init_widgets (TaskPage *tpage) { + CompEditor *editor; TaskPagePrivate *priv; + GtkAction *action; GtkTextBuffer *text_buffer; icaltimezone *zone; + gboolean active; priv = tpage->priv; + editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage)); + /* Make sure the EDateEdit widgets use our timezones to get the current time. */ e_date_edit_set_get_time_callback (E_DATE_EDIT (priv->start_date), @@ -1930,15 +1940,36 @@ init_widgets (TaskPage *tpage) zone = calendar_config_get_icaltimezone (); e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->timezone), zone); - task_page_set_show_timezone (tpage, calendar_config_get_show_timezone()); + action = comp_editor_get_action (editor, "view-time-zone"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + task_page_set_show_timezone (tpage, active); + + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_ATTENDEE_COL, TRUE); + + action = comp_editor_get_action (editor, "view-role"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_ROLE_COL, active); + + action = comp_editor_get_action (editor, "view-rsvp"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_RSVP_COL, active); + + action = comp_editor_get_action (editor, "view-status"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_STATUS_COL, active); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_ATTENDEE_COL, TRUE); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_ROLE_COL, calendar_config_get_show_role ()); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_RSVP_COL, calendar_config_get_show_rsvp ()); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_STATUS_COL, calendar_config_get_show_status ()); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_TYPE_COL, calendar_config_get_show_type ()); + action = comp_editor_get_action (editor, "view-type"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_TYPE_COL, active); - task_page_set_show_categories (tpage, calendar_config_get_show_categories()); + action = comp_editor_get_action (editor, "view-categories"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + task_page_set_show_categories (tpage, active); return TRUE; } -- cgit v1.2.3 From d36734fb447805f8aff516b512b032207d5c17c3 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 24 Apr 2009 20:53:03 +0200 Subject: Calendar - do not close editor after error ** Fix for bug #573704 --- calendar/gui/dialogs/comp-editor.c | 20 +++++++++++++------- 1 file changed, 13 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 4db6c66b12..5d1f7a25d6 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -890,9 +890,11 @@ action_save_cb (GtkAction *action, g_clear_error (&error); } - } + } else + correct = FALSE; - close_dialog (editor); + if (correct) + close_dialog (editor); } static void @@ -2505,14 +2507,13 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean str set_attendees_for_delegation (send_comp, address, method); } - if (!e_cal_component_has_attachments (priv->comp) - || e_cal_get_static_capability (priv->client, CAL_STATIC_CAPABILITY_CREATE_MESSAGES)) { + 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, strip_alarms)) { g_object_unref (send_comp); return TRUE; } - } else { /* Clone the component with attachments set to CID:... */ int num_attachments, i; @@ -2530,9 +2531,14 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean str mime_attach_list = comp_editor_get_mime_attach_list (editor); if (itip_send_comp (method, send_comp, priv->client, NULL, mime_attach_list, users, strip_alarms)) { - save_comp (editor); + gboolean saved = save_comp (editor); + g_object_unref (send_comp); - return TRUE; + + if (!saved) + comp_editor_set_changed (editor, TRUE); + + return saved; } } -- cgit v1.2.3 From 0d3ef53bd7c1d7d96906f0f8348151a453e79078 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 27 Apr 2009 15:36:19 -0400 Subject: Commit the rest of the attachment UI rewrite Oops, last commit only included the -new- files. This also removes EExpander, which is no longer used. --- calendar/gui/dialogs/comp-editor.c | 53 +++++++++---------------------------- calendar/gui/dialogs/event-editor.c | 2 -- 2 files changed, 13 insertions(+), 42 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 5d1f7a25d6..ceab3d3068 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -179,39 +179,6 @@ static void obj_removed_cb (ECal *client, GList *uids, CompEditor *editor); G_DEFINE_TYPE (CompEditor, comp_editor, GTK_TYPE_WINDOW) -enum { - DND_TYPE_MESSAGE_RFC822, - DND_TYPE_X_UID_LIST, - DND_TYPE_TEXT_URI_LIST, - DND_TYPE_NETSCAPE_URL, - DND_TYPE_TEXT_VCARD, - DND_TYPE_TEXT_CALENDAR, -}; - -static GtkTargetEntry drop_types[] = { - { "message/rfc822", 0, DND_TYPE_MESSAGE_RFC822 }, - { "x-uid-list", 0, DND_TYPE_X_UID_LIST }, - { "text/uri-list", 0, DND_TYPE_TEXT_URI_LIST }, - { "_NETSCAPE_URL", 0, DND_TYPE_NETSCAPE_URL }, - { "text/x-vcard", 0, DND_TYPE_TEXT_VCARD }, - { "text/calendar", 0, DND_TYPE_TEXT_CALENDAR }, -}; - -#define num_drop_types (sizeof (drop_types) / sizeof (drop_types[0])) - -static struct { - char *target; - GdkAtom atom; - guint32 actions; -} drag_info[] = { - { "message/rfc822", NULL, GDK_ACTION_COPY }, - { "x-uid-list", NULL, GDK_ACTION_ASK|GDK_ACTION_MOVE|GDK_ACTION_COPY }, - { "text/uri-list", NULL, GDK_ACTION_COPY }, - { "_NETSCAPE_URL", NULL, GDK_ACTION_COPY }, - { "text/x-vcard", NULL, GDK_ACTION_COPY }, - { "text/calendar", NULL, GDK_ACTION_COPY }, -}; - enum { OBJECT_CREATED, LAST_SIGNAL @@ -299,12 +266,15 @@ get_attachment_list (CompEditor *editor) if (mime_part == NULL) continue; - wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (p->data)); + if (mime_part == NULL) + continue; + + wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part)); /* Extract the content from the stream and write it down * as a mime part file into the directory denoting the * calendar source */ - utf8_safe_fname = camel_file_util_safe_filename (camel_mime_part_get_filename ((CamelMimePart *) p->data)); + utf8_safe_fname = camel_file_util_safe_filename (camel_mime_part_get_filename (mime_part)); /* It is absolutely fine to get a NULL from the filename of * mime part. We assume that it is named "Attachment" @@ -1455,7 +1425,7 @@ comp_editor_key_press_event (GtkWidget *widget, { CompEditor *editor; - editor = COMP_EDITOR (editor); + editor = COMP_EDITOR (widget); if (event->keyval == GDK_Escape) { commit_all_fields (editor); @@ -1476,10 +1446,6 @@ 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)); @@ -1569,6 +1535,10 @@ static void comp_editor_init (CompEditor *editor) { CompEditorPrivate *priv; + EAttachmentView *view; + GdkDragAction drag_actions; + GtkTargetList *target_list; + GtkTargetEntry *targets; GtkActionGroup *action_group; GtkAction *action; GtkWidget *container; @@ -2353,6 +2323,9 @@ fill_widgets (CompEditor *editor) view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); store = e_attachment_view_get_store (view); + view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); + store = e_attachment_view_get_store (view); + priv = editor->priv; /*Check if attachments are available here and set them*/ diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index be12f71ab8..830bbeb0ad 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -515,8 +515,6 @@ event_editor_init (EventEditor *ee) g_signal_connect_swapped ( ee->priv->model, "row_deleted", G_CALLBACK (event_editor_model_changed_cb), ee); - - gtk_window_set_default_size (GTK_WINDOW (ee), 300, 225); } static void -- cgit v1.2.3 From 6f2f7292a7934a93e18d36594a8b9ef8dc4454e7 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 28 Apr 2009 10:57:05 -0400 Subject: Resolve some differences between this branch and master. --- calendar/gui/dialogs/comp-editor.c | 129 ++++++++++++++++++++++++------------- 1 file changed, 83 insertions(+), 46 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index ceab3d3068..466973d88e 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -194,37 +194,6 @@ comp_editor_weak_notify_cb (gpointer unused, active_editors = g_list_remove (active_editors, where_the_object_was); } -static void -drag_data_received (CompEditor *editor, - GdkDragContext *context, - gint x, - gint y, - GtkSelectionData *selection, - guint info, - guint time) -{ - EAttachmentView *view; - - view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); - - e_attachment_view_drag_data_received ( - view, context, x, y, selection, info, time); -} - -static gboolean -drag_motion (CompEditor *editor, - GdkDragContext *context, - gint x, - gint y, - guint time) -{ - EAttachmentView *view; - - view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); - - return e_attachment_view_drag_motion (view, context, x, y, time); -} - static GSList * get_attachment_list (CompEditor *editor) { @@ -232,7 +201,7 @@ get_attachment_list (CompEditor *editor) EAttachmentView *view; GtkTreeModel *model; GtkTreeIter iter; - GSList *parts = NULL, *list = NULL, *p = NULL; + GSList *parts = NULL, *list = NULL; const char *comp_uid = NULL; const char *local_store = e_cal_get_local_attachment_store (editor->priv->client); gboolean valid; @@ -263,9 +232,6 @@ get_attachment_list (CompEditor *editor) valid = gtk_tree_model_iter_next (model, &iter); - if (mime_part == NULL) - continue; - if (mime_part == NULL) continue; @@ -662,6 +628,14 @@ action_attach_cb (GtkAction *action, e_attachment_store_run_load_dialog (store, GTK_WINDOW (editor)); } +static void +action_classification_cb (GtkRadioAction *action, + GtkRadioAction *current, + CompEditor *editor) +{ + comp_editor_set_changed (editor, TRUE); +} + static void action_close_cb (GtkAction *action, CompEditor *editor) @@ -822,9 +796,11 @@ 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); @@ -1441,6 +1417,46 @@ comp_editor_key_press_event (GtkWidget *widget, key_press_event (widget, event); } +static gboolean +comp_editor_drag_motion (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + guint time) +{ + CompEditorPrivate *priv; + EAttachmentView *view; + + priv = COMP_EDITOR_GET_PRIVATE (widget); + view = E_ATTACHMENT_VIEW (priv->attachment_view); + + return e_attachment_view_drag_motion (view, context, x, y, time); +} + +static void +comp_editor_drag_data_received (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + GtkSelectionData *selection, + guint info, + guint time) +{ + CompEditorPrivate *priv; + EAttachmentView *view; + + priv = COMP_EDITOR_GET_PRIVATE (widget); + view = E_ATTACHMENT_VIEW (priv->attachment_view); + + /* Forward the data to the attachment view. Note that calling + * e_attachment_view_drag_data_received() will not work because + * that function only handles the case where all the other drag + * handlers have failed. */ + e_attachment_paned_drag_data_received ( + E_ATTACHMENT_PANED (view), + context, x, y, selection, info, time); +} + static void comp_editor_class_init (CompEditorClass *class) { @@ -1459,6 +1475,8 @@ comp_editor_class_init (CompEditorClass *class) widget_class->map = comp_editor_map; widget_class->delete_event = comp_editor_delete_event; widget_class->key_press_event = comp_editor_key_press_event; + widget_class->drag_motion = comp_editor_drag_motion; + widget_class->drag_data_received = comp_editor_drag_data_received; class->help_section = "usage-calendar"; class->edit_comp = real_edit_comp; @@ -1544,6 +1562,7 @@ comp_editor_init (CompEditor *editor) GtkWidget *container; GtkWidget *widget; EShell *shell; + gint n_targets; GError *error = NULL; editor->priv = priv = COMP_EDITOR_GET_PRIVATE (editor); @@ -1594,7 +1613,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 (action_classification_cb), editor); gtk_ui_manager_insert_action_group ( priv->ui_manager, action_group, 0); g_object_unref (action_group); @@ -1659,12 +1678,22 @@ comp_editor_init (CompEditor *editor) comp_editor_setup_recent_menu (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), NULL); + /* Drag-and-Drop Support */ + + view = E_ATTACHMENT_VIEW (priv->attachment_view); + target_list = e_attachment_view_get_target_list (view); + drag_actions = e_attachment_view_get_drag_actions (view); + + targets = gtk_target_table_new_from_list (target_list, &n_targets); + + gtk_drag_dest_set ( + GTK_WIDGET (editor), GTK_DEST_DEFAULT_ALL, + targets, n_targets, drag_actions); - gtk_window_set_type_hint (GTK_WINDOW (editor), GDK_WINDOW_TYPE_HINT_NORMAL); + gtk_target_table_free (targets, n_targets); + + gtk_window_set_type_hint ( + GTK_WINDOW (editor), GDK_WINDOW_TYPE_HINT_NORMAL); /* FIXME Shell should be passed in. */ shell = e_shell_get_default (); @@ -2318,7 +2347,8 @@ fill_widgets (CompEditor *editor) EAttachmentStore *store; EAttachmentView *view; CompEditorPrivate *priv; - GList *l; + GtkAction *action; + GList *iter; view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); store = e_attachment_view_get_store (view); @@ -2336,15 +2366,22 @@ fill_widgets (CompEditor *editor) store, G_CALLBACK (attachment_store_changed_cb), editor); set_attachment_list (editor, attachment_list); - g_signal_handlers_unblock_by_func( + g_signal_handlers_unblock_by_func ( store, G_CALLBACK (attachment_store_changed_cb), editor); g_slist_foreach (attachment_list, (GFunc)g_free, NULL); g_slist_free (attachment_list); } - for (l = priv->pages; l != NULL; l = l->next) - comp_editor_page_fill_widgets (l->data, priv->comp); + action = comp_editor_get_action (editor, "classify-public"); + g_signal_handlers_block_by_func ( + action, G_CALLBACK (action_classification_cb), editor); + + for (iter = priv->pages; iter != NULL; iter = iter->next) + comp_editor_page_fill_widgets (iter->data, priv->comp); + + g_signal_handlers_unblock_by_func ( + action, G_CALLBACK (action_classification_cb), editor); } static void -- cgit v1.2.3 From 5f55aba5b052fb7284973f50009f8b369334d084 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 1 May 2009 06:44:36 -0400 Subject: Merge in changes from master. --- calendar/gui/dialogs/cal-prefs-dialog.c | 11 +++++++++++ calendar/gui/dialogs/cal-prefs-dialog.glade | 19 +++++++++++++++++++ calendar/gui/dialogs/cal-prefs-dialog.h | 1 + calendar/gui/dialogs/calendar-setup.c | 1 - 4 files changed, 31 insertions(+), 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 6d50a406b3..cdef86eb5a 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -325,6 +325,12 @@ dview_show_week_no_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) calendar_config_set_dview_show_week_no (gtk_toggle_button_get_active (toggle)); } +static void +month_scroll_by_week_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) +{ + calendar_config_set_month_scroll_by_week (gtk_toggle_button_get_active (toggle)); +} + static void hide_completed_tasks_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) { @@ -521,6 +527,7 @@ setup_changes (CalendarPrefsDialog *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->month_scroll_by_week), "toggled", G_CALLBACK (month_scroll_by_week_toggled), prefs); g_signal_connect (G_OBJECT (prefs->tasks_hide_completed), "toggled", G_CALLBACK (hide_completed_tasks_toggled), prefs); @@ -695,6 +702,9 @@ show_config (CalendarPrefsDialog *prefs) /* Day/Work Week view - Show Week Number. */ e_dialog_toggle_set (prefs->dview_show_week_no, calendar_config_get_dview_show_week_no ()); + /* Month View - Scroll by a week */ + e_dialog_toggle_set (prefs->month_scroll_by_week, calendar_config_get_month_scroll_by_week ()); + /* Task list */ show_task_list_config (prefs); @@ -825,6 +835,7 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, 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->month_scroll_by_week = glade_xml_get_widget (gui, "month_scroll_by_week"); 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 867abdbb22..a279ad1107 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ b/calendar/gui/dialogs/cal-prefs-dialog.glade @@ -1368,6 +1368,25 @@ Days False + + + + True + True + Sc_roll Month View by a week + 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 84c1873e9a..ba1bf607ea 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -85,6 +85,7 @@ struct _CalendarPrefsDialog { GtkWidget *compress_weekend; GtkWidget *dnav_show_week_no; GtkWidget *dview_show_week_no; + GtkWidget *month_scroll_by_week; GtkWidget *tasks_due_today_color; GtkWidget *tasks_overdue_color; GtkWidget *tasks_hide_completed; diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c index 724206a072..b182f9cc78 100644 --- a/calendar/gui/dialogs/calendar-setup.c +++ b/calendar/gui/dialogs/calendar-setup.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include "calendar-setup.h" #include "../e-cal-config.h" -- cgit v1.2.3 From 15af330cacae649e86d4d89a7a8c7f1795baa7ca Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 2 May 2009 00:23:30 -0400 Subject: Add a "Print Preview" menu item to CompEditor. --- calendar/gui/dialogs/comp-editor.c | 27 +++++++++++++++++++++------ 1 file changed, 21 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 9d7e2f38ef..cf8d77668c 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -137,7 +137,10 @@ static const gchar *ui = " " " " " " +" " +" " " " +" " " " " " " " @@ -703,17 +706,22 @@ action_print_cb (GtkAction *action, CompEditor *editor) { CompEditorPrivate *priv = editor->priv; + GtkPrintOperationAction print_action; ECalComponent *comp; GList *l; - icalcomponent *icalcomp = e_cal_component_get_icalcomponent (priv->comp); + icalcomponent *component; + icalcomponent *clone; comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp)); + component = e_cal_component_get_icalcomponent (priv->comp); + clone = icalcomponent_new_clone (component); + e_cal_component_set_icalcomponent (comp, clone); 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); + print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG; + print_comp (comp, priv->client, print_action); g_object_unref (comp); } @@ -723,15 +731,22 @@ action_print_preview_cb (GtkAction *action, CompEditor *editor) { CompEditorPrivate *priv = editor->priv; + GtkPrintOperationAction print_action; ECalComponent *comp; GList *l; - icalcomponent *icalcomp = e_cal_component_get_icalcomponent (priv->comp); + icalcomponent *component; + icalcomponent *clone; comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp)); + component = e_cal_component_get_icalcomponent (priv->comp); + clone = icalcomponent_new_clone (component); + e_cal_component_set_icalcomponent (comp, clone); + for (l = priv->pages; l != NULL; l = l->next) comp_editor_page_fill_component (l->data, comp); - print_comp (comp, priv->client, TRUE); + + print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW; + print_comp (comp, priv->client, print_action); g_object_unref (comp); } -- cgit v1.2.3 From 504642b7984f5fed0db6284e2f4da6b1c9b8d1e0 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 2 May 2009 11:09:30 -0400 Subject: Use Behdad's brilliant git.mk to generate .gitignore files. --- calendar/gui/dialogs/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am index c6d61101a8..8e7a1bf916 100644 --- a/calendar/gui/dialogs/Makefile.am +++ b/calendar/gui/dialogs/Makefile.am @@ -102,3 +102,5 @@ dist-hook: EXTRA_DIST = \ $(glade_DATA) + +-include $(top_srcdir)/git.mk -- cgit v1.2.3 From 5395bd3308e25f3ca2ac1b35460ba6df1d294f4b Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 3 May 2009 09:10:09 -0400 Subject: =?UTF-8?q?Bug=20575122=20=E2=80=93=20"before=20every=20anniversar?= =?UTF-8?q?y/birthday"=20is=20missing=20translator=20comment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calendar/gui/dialogs/cal-prefs-dialog.glade | 3186 +++++++++++---------------- 1 file changed, 1226 insertions(+), 1960 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade index a279ad1107..87e69d74c5 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ b/calendar/gui/dialogs/cal-prefs-dialog.glade @@ -1,1978 +1,1244 @@ - - - + - - - - True - window1 - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - False - - - - True - True - True - True - GTK_POS_TOP - False - False - - - - 12 - True - False - 12 - - - - True - <span weight="bold">Time</span> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - 12 - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - 5 - 2 - False - 6 - 6 - - - - True - 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 - 4 - 5 - fill - fill - - - - - - True - Time format: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 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 - - - - - - - True - False - 6 - - - - True - True - _12 hour (AM/PM) - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - _24 hour - True - GTK_RELIEF_NORMAL - True - False - False - True - use_12_hour - - - 0 - False - False - - - - - 1 - 2 - 3 - 4 - fill - fill - - - - - - True - True - Adjust for daylight sa_ving time - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 1 - 2 - 2 - 3 - fill - - - - - - - True - 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 - False - False - 0 - 0.5 - 0 - 0 - timezone - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - False - 0 - - - - True - True - Use s_ystem time zone - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - True - - - - - - True - (system/tz) - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 5 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - 1 - 2 - 0 - 1 - fill - - - - - 0 - True - True - - - - - 0 - False - True - - - - - - True - <span weight="bold">Work Week</span> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - 12 - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - 4 - 2 - False - 6 - 6 - - - - True - Wee_k starts on: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - week_start_day - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - Work days: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - _Day begins: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - start_of_day - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 2 - 3 - fill - - - - - - - True - Day _ends: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - end_of_day - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 3 - 4 - fill - - - - - - - True - cal_prefs_dialog_create_time_edit - 0 - 0 - Thu, 13 Jan 2005 04:23:55 GMT - - - 1 - 2 - 2 - 3 - fill - - - - - - True - cal_prefs_dialog_create_time_edit - 0 - 0 - Thu, 13 Jan 2005 04:24:06 GMT - - - 1 - 2 - 3 - 4 - fill - fill - - - - - - True - False - 6 - - - - True - True - _Mon - True - GTK_RELIEF_NORMAL - True - False - False - True - - Monday - - - - 0 - False - False - - - - - - True - True - _Tue - True - GTK_RELIEF_NORMAL - True - False - False - True - - Tuesday - - - - 0 - False - False - - - - - - True - True - _Wed - True - GTK_RELIEF_NORMAL - True - False - False - True - - Wednesday - - - - 0 - False - False - - - - - - True - True - T_hu - True - GTK_RELIEF_NORMAL - True - False - False - True - - Thursday - - - - 0 - False - False - - - - - - True - True - _Fri - True - GTK_RELIEF_NORMAL - True - False - False - True - - Friday - - - - 0 - False - False - - - - - - True - True - _Sat - True - GTK_RELIEF_NORMAL - True - False - False - True - - Saturday - - - - 0 - False - False - - - - - - True - True - S_un - True - GTK_RELIEF_NORMAL - True - False - False - True - - Sunday - - - - 0 - False - False - - - - - 1 - 2 - 1 - 2 - fill - fill - - - - - - True - Monday + + + + True + window1 + + + True + True + + + True + 12 + 12 + + + True + 0 + <span weight="bold">Time</span> + True + + + False + False + 0 + + + + + True + 12 + + + True + + + False + False + 0 + + + + + True + 5 + 2 + 6 + 6 + + + True + 0 + Se_cond zone: + True + day_second_zone + + + 4 + 5 + GTK_FILL + + + + + + True + + + None + True + True + False + True + + + 0 + + + + + True + 6 + (Shown in a Day View) + + + False + False + 1 + + + + + 1 + 2 + 4 + 5 + GTK_FILL + GTK_FILL + + + + + True + 0 + Time format: + + + 3 + 4 + GTK_FILL + + + + + + Adjust for daylight sa_ving time + True + True + False + True + True + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + + True + 6 + + + _12 hour (AM/PM) + True + True + False + True + True + + + False + False + 0 + + + + + _24 hour + True + True + False + True + True + use_12_hour + + + False + False + 1 + + + + + 1 + 2 + 3 + 4 + GTK_FILL + GTK_FILL + + + + + Adjust for daylight sa_ving time + True + True + False + True + True + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + + True + make_timezone_entry + + + + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + 0 + Time _zone: + True + timezone + + + GTK_FILL + + + + + + True + + + Use s_ystem time zone + True + True + False + True + True + + + False + 0 + + + + + True + 5 + (system/tz) + + + False + False + 1 + + + + + 1 + 2 + GTK_FILL + + + + + + + + + + + 1 + + + + + False + 1 + + + + + True + 0 + <span weight="bold">Work Week</span> + True + + + False + False + 2 + + + + + True + 12 + + + True + + + False + False + 0 + + + + + True + 4 + 2 + 6 + 6 + + + True + 0 + Wee_k starts on: + True + week_start_day + + + GTK_FILL + + + + + + True + 0 + Work days: + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + _Day begins: + True + start_of_day + + + 2 + 3 + GTK_FILL + + + + + + True + 0 + Day _ends: + True + end_of_day + + + 3 + 4 + GTK_FILL + + + + + + True + cal_prefs_dialog_create_time_edit + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + True + cal_prefs_dialog_create_time_edit + + + 1 + 2 + 3 + 4 + GTK_FILL + GTK_FILL + + + + + True + 6 + + + _Mon + True + True + False + True + True + + Monday + + + + False + False + 0 + + + + + _Tue + True + True + False + True + True + + Tuesday + + + + False + False + 1 + + + + + _Wed + True + True + False + True + True + + Wednesday + + + + False + False + 2 + + + + + T_hu + True + True + False + True + True + + Thursday + + + + False + False + 3 + + + + + _Fri + True + True + False + True + True + + Friday + + + + False + False + 4 + + + + + _Sat + True + True + False + True + True + + Saturday + + + + False + False + 5 + + + + + S_un + True + True + False + True + True + + Sunday + + + + False + False + 6 + + + + + 1 + 2 + 1 + 2 + GTK_FILL + GTK_FILL + + + + + True + Monday Tuesday Wednesday Thursday Friday Saturday Sunday - False - True - - - 1 - 2 - 0 - 1 - fill - fill - - - - - 0 - True - True - - - - - 0 - False - True - - - - - - True - <span weight="bold">Alerts</span> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - 12 - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - 6 - - - - True - True - _Ask for confirmation when deleting items - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - False - 4 - - - - True - True - Sh_ow 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 0 - - - 0 - True - True - - - - - - True - Minutes + + + 1 + 2 + GTK_FILL + GTK_FILL + + + + + 1 + + + + + False + 3 + + + + + True + 0 + <span weight="bold">Alerts</span> + True + + + False + False + 4 + + + + + True + 12 + + + True + + + False + False + 0 + + + + + True + 6 + + + _Ask for confirmation when deleting items + True + True + False + True + True + + + False + False + 0 + + + + + True + 4 + + + Sh_ow a reminder + True + True + False + True + True + + + False + False + 0 + + + + + True + True + 0 0 9999 1 10 0 + 1 + + + 1 + + + + + True + Minutes Hours Days - False - True - - - 0 - True - True - - - - - - True - before every appointment - 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 - - - - - - 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 0 - - - 0 - True - True - - - - - - True - Minutes + + + 2 + + + + + True + before every appointment + + + False + False + 3 + + + + + 1 + + + + + True + 4 + + + Show a _reminder + True + True + False + True + True + + + False + False + 0 + + + + + True + True + 0 0 9999 1 10 0 + 1 + + + 1 + + + + + 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 - True - True - - - - - 0 - False - True - - - - - False - True - - - - - - True - General - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - 12 - True - False - 12 - - - - True - <span weight="bold">General</span> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - 12 - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - 6 - - - - True - False - 6 - - - - True - _Time divisions: - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - time_divisions - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - 60 minutes + + + 2 + + + + + True + before every anniversary/birthday + + + False + False + 3 + + + + + 2 + + + + + 1 + + + + + False + 5 + + + + + + + True + General + + + False + tab + + + + + True + 12 + 12 + + + True + 0 + <span weight="bold">General</span> + True + + + False + False + 0 + + + + + True + 12 + + + True + + + False + False + 0 + + + + + True + 6 + + + True + 6 + + + True + _Time divisions: + True + time_divisions + + + False + False + 0 + + + + + True + 60 minutes 30 minutes 15 minutes 10 minutes 05 minutes - False - True - - - 0 - True - True - - - - - 0 - True - True - - - - - - True - True - _Show appointment end times in week and month view - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - _Compress weekends in month view - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - Show week _numbers in date navigator - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - Show week n_umber in Day and Work Week View - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - Sc_roll Month View by a week - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - 0 - True - True - - - - - 0 - False - True - - - - - - True - <span weight="bold">Task List</span> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - 12 - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - 6 - - - - True - 2 - 2 - False - 6 - 6 - - - - True - T_asks due today: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - tasks_due_today_color - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - _Overdue tasks: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - tasks_overdue_color - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - True - False - Pick a color - True - - - 1 - 2 - 0 - 1 - - - - - - - - True - True - False - Pick a color - True - - - 1 - 2 - 1 - 2 - - - - - - - 0 - True - True - - - - - - True - False - 6 - - - - True - True - _Hide completed tasks after - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 1 0 9999 1 10 0 - - - 0 - True - True - - - - - - True - Minutes + + + 1 + + + + + 0 + + + + + _Show appointment end times in week and month view + True + True + False + True + True + + + False + False + 1 + + + + + _Compress weekends in month view + True + True + False + True + True + + + False + False + 2 + + + + + Show week _numbers in date navigator + True + True + False + True + True + + + False + False + 3 + + + + + Show week n_umber in Day and Work Week View + True + True + False + True + True + + + False + False + 4 + + + + + Sc_roll Month View by a week + True + True + False + True + True + + + False + False + 5 + + + + + 1 + + + + + False + 1 + + + + + True + 0 + <span weight="bold">Task List</span> + True + + + False + False + 2 + + + + + True + 12 + + + True + + + False + False + 0 + + + + + True + 6 + + + True + 2 + 2 + 6 + 6 + + + True + 0 + T_asks due today: + True + tasks_due_today_color + + + GTK_FILL + + + + + + True + 0 + _Overdue tasks: + True + tasks_overdue_color + + + 1 + 2 + GTK_FILL + + + + + + True + True + False + Pick a color + + + 1 + 2 + + + + + + + True + True + False + Pick a color + + + 1 + 2 + 1 + 2 + + + + + + + 0 + + + + + True + 6 + + + _Hide completed tasks after + True + True + False + True + True + + + False + False + 0 + + + + + True + True + 1 0 9999 1 10 0 + 1 + + + 1 + + + + + True + Minutes Hours Days - False - True - - - 0 - True - True - - - - - 0 - True - True - - - - - 0 - True - True - - - - - 0 - False - True - - - - - False - True - - - - - - True - Display - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - 12 - True - False - 6 - - - - True - False - 0 - - - - True - Select the calendars for alarm notification - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - 0 - False - False - - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - - - - 0 - True - True - - - - - False - True - - - - - - True - Alarms - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - 12 - True - False - 12 - - - - True - <span weight="bold">Default Free/Busy Server</span> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - 12 - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - 6 - - - - True - False - 6 - - - - True - Template: - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - True - True - True - 0 - - True - * - False - - - 0 - True - True - - - - - 0 - True - True - - - - - - True - <i>%u and %d will be replaced by user and domain from the email address.</i> - False - True - GTK_JUSTIFY_LEFT - True - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - 0 - True - True - - - - - 0 - False - True - - - - - False - True - - - - - - True - Free/Busy - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - + + + 2 + + + + + 1 + + + + + 1 + + + + + False + 3 + + + + + 1 + + + + + True + Display + + + 1 + False + tab + + + + + True + 12 + 6 + + + True + + + True + Select the calendars for alarm notification + + + False + False + 0 + + + + + False + False + 0 + + + + + True + True + automatic + automatic + in + + + + + + 1 + + + + + 2 + + + + + True + Alarms + + + 2 + False + tab + + + + + True + 12 + 12 + + + True + 0 + <span weight="bold">Default Free/Busy Server</span> + True + + + False + False + 0 + + + + + True + 12 + + + True + + + False + False + 0 + + + + + True + 6 + + + True + 6 + + + True + Template: + + + False + False + 0 + + + + + True + True + + + 1 + + + + + 0 + + + + + True + <i>%u and %d will be replaced by user and domain from the email address.</i> + True + True + + + False + False + 1 + + + + + 1 + + + + + False + 1 + + + + + 3 + + + + + True + Free/Busy + + + 3 + False + tab + + + + + -- cgit v1.2.3 From 1df3152d0a2001d0a85cdc960a38e2cbcb395bb9 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 13 May 2009 17:27:50 -0400 Subject: Remove an unnecessary variable from get_attachment_list(). --- calendar/gui/dialogs/comp-editor.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 440cf35388..bee9daf99a 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -212,7 +212,7 @@ get_attachment_list (CompEditor *editor) EAttachmentView *view; GtkTreeModel *model; GtkTreeIter iter; - GSList *parts = NULL, *list = NULL; + GSList *list = NULL; const char *comp_uid = NULL; const char *local_store = e_cal_get_local_attachment_store (editor->priv->client); gboolean valid; @@ -297,8 +297,6 @@ get_attachment_list (CompEditor *editor) g_free (filename); } - if (parts) - g_slist_free (parts); return list; } -- cgit v1.2.3 From bf16cd18b646b018a005b9d1d5b72deaeede8d27 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 14 May 2009 20:04:35 +0200 Subject: Bug 582626 - Remove forgotten widgets from a glade file --- calendar/gui/dialogs/cal-prefs-dialog.glade | 36 ----------------------------- 1 file changed, 36 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade index 87e69d74c5..9f2617db04 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ b/calendar/gui/dialogs/cal-prefs-dialog.glade @@ -113,24 +113,6 @@ - - - Adjust for daylight sa_ving time - True - True - False - True - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - True @@ -176,24 +158,6 @@ GTK_FILL - - - Adjust for daylight sa_ving time - True - True - False - True - True - - - 1 - 2 - 2 - 3 - GTK_FILL - - - True -- cgit v1.2.3 From a538f3f3100dbdbae1ea172ae3b8344e650d529d Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 16 May 2009 12:11:55 -0400 Subject: Fix several types of pedantic compiler warnings. --- 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 c7b6050d3e..ec2f26a045 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -209,7 +209,7 @@ 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); -G_DEFINE_TYPE (EventPage, event_page, TYPE_COMP_EDITOR_PAGE); +G_DEFINE_TYPE (EventPage, event_page, TYPE_COMP_EDITOR_PAGE) static void event_page_dispose (GObject *object) @@ -1884,7 +1884,7 @@ enum { ATTENDEE_CAN_DELEGATE = 1<<1, ATTENDEE_CAN_DELETE = 1<<2, ATTENDEE_CAN_ADD = 1<<3, - ATTENDEE_LAST = 1<<4, + ATTENDEE_LAST = 1<<4 }; static EPopupItem context_menu_items[] = { diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index 82fb75564a..b6cbd3e7dc 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -77,7 +77,7 @@ typedef enum { PRIORITY_HIGH, PRIORITY_NORMAL, PRIORITY_LOW, - PRIORITY_UNDEFINED, + PRIORITY_UNDEFINED } TaskEditorPriority; static const int priority_map[] = { diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index d020d5cd4f..bd568e2e6a 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -1195,7 +1195,7 @@ enum { ATTENDEE_CAN_DELEGATE = 1<<1, ATTENDEE_CAN_DELETE = 1<<2, ATTENDEE_CAN_ADD = 1<<3, - ATTENDEE_LAST = 1<<4, + ATTENDEE_LAST = 1<<4 }; static EPopupItem context_menu_items[] = { -- cgit v1.2.3 From e4afd3f9fb962ea1295a0657ec9f83a427829171 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 26 May 2009 23:21:02 -0400 Subject: Remove trailing whitespace, again. --- calendar/gui/dialogs/alarm-dialog.c | 2 +- calendar/gui/dialogs/alarm-dialog.h | 2 +- calendar/gui/dialogs/alarm-list-dialog.c | 2 +- calendar/gui/dialogs/alarm-list-dialog.h | 2 +- calendar/gui/dialogs/cal-attachment-select-file.c | 2 +- calendar/gui/dialogs/cal-attachment-select-file.h | 2 +- calendar/gui/dialogs/cal-prefs-dialog.c | 2 +- calendar/gui/dialogs/cal-prefs-dialog.h | 2 +- calendar/gui/dialogs/calendar-setup.c | 4 ++-- calendar/gui/dialogs/calendar-setup.h | 2 +- calendar/gui/dialogs/cancel-comp.c | 2 +- calendar/gui/dialogs/cancel-comp.h | 2 +- calendar/gui/dialogs/changed-comp.c | 2 +- calendar/gui/dialogs/changed-comp.h | 2 +- calendar/gui/dialogs/comp-editor-page.c | 2 +- calendar/gui/dialogs/comp-editor-page.h | 2 +- calendar/gui/dialogs/comp-editor-util.c | 2 +- calendar/gui/dialogs/comp-editor-util.h | 2 +- calendar/gui/dialogs/comp-editor.c | 10 +++++----- calendar/gui/dialogs/comp-editor.h | 2 +- calendar/gui/dialogs/copy-source-dialog.c | 2 +- calendar/gui/dialogs/copy-source-dialog.h | 2 +- calendar/gui/dialogs/delete-comp.c | 2 +- calendar/gui/dialogs/delete-comp.h | 2 +- calendar/gui/dialogs/delete-error.c | 2 +- calendar/gui/dialogs/delete-error.h | 2 +- calendar/gui/dialogs/e-delegate-dialog.c | 2 +- calendar/gui/dialogs/e-delegate-dialog.h | 2 +- calendar/gui/dialogs/e-send-options-utils.c | 2 +- calendar/gui/dialogs/e-send-options-utils.h | 2 +- calendar/gui/dialogs/event-editor.c | 2 +- calendar/gui/dialogs/event-editor.h | 4 ++-- calendar/gui/dialogs/event-page.c | 6 +++--- calendar/gui/dialogs/event-page.h | 2 +- calendar/gui/dialogs/memo-editor.c | 2 +- calendar/gui/dialogs/memo-editor.h | 2 +- calendar/gui/dialogs/memo-page.c | 2 +- calendar/gui/dialogs/memo-page.h | 2 +- calendar/gui/dialogs/recur-comp.c | 2 +- calendar/gui/dialogs/recur-comp.h | 2 +- calendar/gui/dialogs/recurrence-page.c | 2 +- calendar/gui/dialogs/recurrence-page.h | 2 +- calendar/gui/dialogs/save-comp.c | 2 +- calendar/gui/dialogs/save-comp.h | 4 ++-- calendar/gui/dialogs/schedule-page.c | 2 +- calendar/gui/dialogs/schedule-page.h | 2 +- calendar/gui/dialogs/select-source-dialog.c | 2 +- calendar/gui/dialogs/select-source-dialog.h | 2 +- calendar/gui/dialogs/send-comp.c | 2 +- calendar/gui/dialogs/send-comp.h | 2 +- calendar/gui/dialogs/task-details-page.c | 2 +- calendar/gui/dialogs/task-details-page.h | 2 +- calendar/gui/dialogs/task-editor.c | 2 +- calendar/gui/dialogs/task-editor.h | 2 +- calendar/gui/dialogs/task-page.c | 4 ++-- calendar/gui/dialogs/task-page.h | 2 +- 56 files changed, 66 insertions(+), 66 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c index 3881c85106..73bfde30cc 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -10,7 +10,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/alarm-dialog.h b/calendar/gui/dialogs/alarm-dialog.h index 0cdee744c9..b5560f9ff4 100644 --- a/calendar/gui/dialogs/alarm-dialog.h +++ b/calendar/gui/dialogs/alarm-dialog.h @@ -13,7 +13,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/alarm-list-dialog.c b/calendar/gui/dialogs/alarm-list-dialog.c index 07395a4782..8520b3727b 100644 --- a/calendar/gui/dialogs/alarm-list-dialog.c +++ b/calendar/gui/dialogs/alarm-list-dialog.c @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/alarm-list-dialog.h b/calendar/gui/dialogs/alarm-list-dialog.h index 6a55f03000..7d58fcb0af 100644 --- a/calendar/gui/dialogs/alarm-list-dialog.h +++ b/calendar/gui/dialogs/alarm-list-dialog.h @@ -13,7 +13,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/cal-attachment-select-file.c b/calendar/gui/dialogs/cal-attachment-select-file.c index 5de8ea669b..9c502153d3 100644 --- a/calendar/gui/dialogs/cal-attachment-select-file.c +++ b/calendar/gui/dialogs/cal-attachment-select-file.c @@ -10,7 +10,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/cal-attachment-select-file.h b/calendar/gui/dialogs/cal-attachment-select-file.h index 3c39fed125..0f965e6c9b 100644 --- a/calendar/gui/dialogs/cal-attachment-select-file.h +++ b/calendar/gui/dialogs/cal-attachment-select-file.h @@ -11,7 +11,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index b2763ca479..f00adc0f0d 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -10,7 +10,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 30b62440e5..647df417df 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -10,7 +10,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c index 3ee589406b..95820b8247 100644 --- a/calendar/gui/dialogs/calendar-setup.c +++ b/calendar/gui/dialogs/calendar-setup.c @@ -10,7 +10,7 @@ * 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 + * License along with the program; if not, see * * * Authors: @@ -258,7 +258,7 @@ eccp_general_offline (EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, GtkWidget *offline_setting = NULL; const char *offline_sync; int row; - const char *base_uri = e_source_group_peek_base_uri (sdialog->source_group); + 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) diff --git a/calendar/gui/dialogs/calendar-setup.h b/calendar/gui/dialogs/calendar-setup.h index 3898467595..4ec9980532 100644 --- a/calendar/gui/dialogs/calendar-setup.h +++ b/calendar/gui/dialogs/calendar-setup.h @@ -11,7 +11,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/cancel-comp.c b/calendar/gui/dialogs/cancel-comp.c index 2548d5ba2d..cddd4f8d8d 100644 --- a/calendar/gui/dialogs/cancel-comp.c +++ b/calendar/gui/dialogs/cancel-comp.c @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/cancel-comp.h b/calendar/gui/dialogs/cancel-comp.h index 3566a7548e..5f1261f1f5 100644 --- a/calendar/gui/dialogs/cancel-comp.h +++ b/calendar/gui/dialogs/cancel-comp.h @@ -13,7 +13,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/changed-comp.c b/calendar/gui/dialogs/changed-comp.c index 9a0665d763..d1abc1724d 100644 --- a/calendar/gui/dialogs/changed-comp.c +++ b/calendar/gui/dialogs/changed-comp.c @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/changed-comp.h b/calendar/gui/dialogs/changed-comp.h index 7a8bcb30f5..6bb20210dd 100644 --- a/calendar/gui/dialogs/changed-comp.h +++ b/calendar/gui/dialogs/changed-comp.h @@ -10,7 +10,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/comp-editor-page.c b/calendar/gui/dialogs/comp-editor-page.c index a86465d5d7..93b9cd9304 100644 --- a/calendar/gui/dialogs/comp-editor-page.c +++ b/calendar/gui/dialogs/comp-editor-page.c @@ -13,7 +13,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/comp-editor-page.h b/calendar/gui/dialogs/comp-editor-page.h index f8b9db23f3..819ea74ccc 100644 --- a/calendar/gui/dialogs/comp-editor-page.h +++ b/calendar/gui/dialogs/comp-editor-page.h @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index f09024eba0..4666058b51 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/comp-editor-util.h b/calendar/gui/dialogs/comp-editor-util.h index 565feeaea5..5516fe4cc4 100644 --- a/calendar/gui/dialogs/comp-editor-util.h +++ b/calendar/gui/dialogs/comp-editor-util.h @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 545fca4448..cd2dac7a9e 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: @@ -238,7 +238,7 @@ get_attachment_list (CompEditor *editor) * calendar source */ utf8_safe_fname = camel_file_util_safe_filename (camel_mime_part_get_filename (mime_part)); - /* It is absolutely fine to get a NULL from the filename of + /* It is absolutely fine to get a NULL from the filename of * mime part. We assume that it is named "Attachment" * in mailer. I'll do that with a ticker */ if (!utf8_safe_fname) @@ -798,7 +798,7 @@ action_save_cb (GtkAction *action, priv->mod = CALOBJ_MOD_THIS; comp = comp_editor_get_current_comp (editor, &correct); - + e_cal_component_get_summary (comp, &text); g_object_unref (comp); @@ -817,7 +817,7 @@ action_save_cb (GtkAction *action, delegate = flags & COMP_EDITOR_DELEGATE; if (delegate && !remove_event_dialog (priv->client, priv->comp, GTK_WINDOW (editor))) { - const char *uid = NULL; + const char *uid = NULL; GError *error = NULL; e_cal_component_get_uid (priv->comp, &uid); @@ -2440,7 +2440,7 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean str 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, strip_alarms)) { diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index ab277febf7..22167cb78f 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/copy-source-dialog.c b/calendar/gui/dialogs/copy-source-dialog.c index 5bb970433b..92444678be 100644 --- a/calendar/gui/dialogs/copy-source-dialog.c +++ b/calendar/gui/dialogs/copy-source-dialog.c @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/copy-source-dialog.h b/calendar/gui/dialogs/copy-source-dialog.h index ba3169a1b8..4c6f5b19c8 100644 --- a/calendar/gui/dialogs/copy-source-dialog.h +++ b/calendar/gui/dialogs/copy-source-dialog.h @@ -13,7 +13,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/delete-comp.c b/calendar/gui/dialogs/delete-comp.c index e5ae1e6cdc..ae371aabb2 100644 --- a/calendar/gui/dialogs/delete-comp.c +++ b/calendar/gui/dialogs/delete-comp.c @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/delete-comp.h b/calendar/gui/dialogs/delete-comp.h index bb4b5983d9..c619e28b98 100644 --- a/calendar/gui/dialogs/delete-comp.h +++ b/calendar/gui/dialogs/delete-comp.h @@ -13,7 +13,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/delete-error.c b/calendar/gui/dialogs/delete-error.c index b151ef8068..f8df587aa4 100644 --- a/calendar/gui/dialogs/delete-error.c +++ b/calendar/gui/dialogs/delete-error.c @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/delete-error.h b/calendar/gui/dialogs/delete-error.h index cb0a7d9294..dab620541f 100644 --- a/calendar/gui/dialogs/delete-error.h +++ b/calendar/gui/dialogs/delete-error.h @@ -13,7 +13,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/e-delegate-dialog.c b/calendar/gui/dialogs/e-delegate-dialog.c index 31c4631ca9..8e060832df 100644 --- a/calendar/gui/dialogs/e-delegate-dialog.c +++ b/calendar/gui/dialogs/e-delegate-dialog.c @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/e-delegate-dialog.h b/calendar/gui/dialogs/e-delegate-dialog.h index 553b7c1576..e4f474781a 100644 --- a/calendar/gui/dialogs/e-delegate-dialog.h +++ b/calendar/gui/dialogs/e-delegate-dialog.h @@ -11,7 +11,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/e-send-options-utils.c b/calendar/gui/dialogs/e-send-options-utils.c index d9a55ac47a..fd6bf245c2 100644 --- a/calendar/gui/dialogs/e-send-options-utils.c +++ b/calendar/gui/dialogs/e-send-options-utils.c @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/e-send-options-utils.h b/calendar/gui/dialogs/e-send-options-utils.h index 568ef5be3b..01cf3ed2e9 100644 --- a/calendar/gui/dialogs/e-send-options-utils.h +++ b/calendar/gui/dialogs/e-send-options-utils.h @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 7755894f6c..cff9d75950 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/event-editor.h b/calendar/gui/dialogs/event-editor.h index c050b92dfb..03afd6448a 100644 --- a/calendar/gui/dialogs/event-editor.h +++ b/calendar/gui/dialogs/event-editor.h @@ -1,5 +1,5 @@ /* - * Evolution calendar - Event editor dialog + * Evolution calendar - Event editor dialog * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index b225cdd6bd..b2ac6b55db 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: @@ -3281,7 +3281,7 @@ event_page_add_attendee (EventPage *epage, EMeetingAttendee *attendee) g_return_if_fail (epage != NULL); g_return_if_fail (IS_EVENT_PAGE (epage)); - + priv = epage->priv; e_meeting_store_add_attendee (priv->model, attendee); @@ -3300,7 +3300,7 @@ event_page_remove_all_attendees (EventPage *epage) 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); diff --git a/calendar/gui/dialogs/event-page.h b/calendar/gui/dialogs/event-page.h index 63c0bd2306..5bd377c075 100644 --- a/calendar/gui/dialogs/event-page.h +++ b/calendar/gui/dialogs/event-page.h @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c index b90bd6fb3c..cf3781a3c2 100644 --- a/calendar/gui/dialogs/memo-editor.c +++ b/calendar/gui/dialogs/memo-editor.c @@ -10,7 +10,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/memo-editor.h b/calendar/gui/dialogs/memo-editor.h index b45edd18ce..2e431b507f 100644 --- a/calendar/gui/dialogs/memo-editor.h +++ b/calendar/gui/dialogs/memo-editor.h @@ -13,7 +13,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index 4f8c37c0a3..957b8f695c 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/memo-page.h b/calendar/gui/dialogs/memo-page.h index cfe4cb0a17..115d8aafb7 100644 --- a/calendar/gui/dialogs/memo-page.h +++ b/calendar/gui/dialogs/memo-page.h @@ -11,7 +11,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/recur-comp.c b/calendar/gui/dialogs/recur-comp.c index e57c0c8aa7..8d8dabbaf2 100644 --- a/calendar/gui/dialogs/recur-comp.c +++ b/calendar/gui/dialogs/recur-comp.c @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/recur-comp.h b/calendar/gui/dialogs/recur-comp.h index e4666772f7..47236ef8cd 100644 --- a/calendar/gui/dialogs/recur-comp.h +++ b/calendar/gui/dialogs/recur-comp.h @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index c85a0ae0f2..f89993154f 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/recurrence-page.h b/calendar/gui/dialogs/recurrence-page.h index f3bff613ee..1dce00d2c9 100644 --- a/calendar/gui/dialogs/recurrence-page.h +++ b/calendar/gui/dialogs/recurrence-page.h @@ -13,7 +13,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/save-comp.c b/calendar/gui/dialogs/save-comp.c index cb178e0dce..3f47312d22 100644 --- a/calendar/gui/dialogs/save-comp.c +++ b/calendar/gui/dialogs/save-comp.c @@ -11,7 +11,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/save-comp.h b/calendar/gui/dialogs/save-comp.h index 123a4a8587..5105e4af7f 100644 --- a/calendar/gui/dialogs/save-comp.h +++ b/calendar/gui/dialogs/save-comp.h @@ -1,7 +1,7 @@ /* * * Evolution calendar - Delete calendar component dialog - * + * * 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 @@ -13,7 +13,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c index e1137be3a0..4baa22ab8a 100644 --- a/calendar/gui/dialogs/schedule-page.c +++ b/calendar/gui/dialogs/schedule-page.c @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/schedule-page.h b/calendar/gui/dialogs/schedule-page.h index 8ffbb43c71..71eec02763 100644 --- a/calendar/gui/dialogs/schedule-page.h +++ b/calendar/gui/dialogs/schedule-page.h @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/select-source-dialog.c b/calendar/gui/dialogs/select-source-dialog.c index e9fc7d0d9f..f73af156b0 100644 --- a/calendar/gui/dialogs/select-source-dialog.c +++ b/calendar/gui/dialogs/select-source-dialog.c @@ -11,7 +11,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/select-source-dialog.h b/calendar/gui/dialogs/select-source-dialog.h index 3ca3cec041..850eddd610 100644 --- a/calendar/gui/dialogs/select-source-dialog.h +++ b/calendar/gui/dialogs/select-source-dialog.h @@ -13,7 +13,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/send-comp.c b/calendar/gui/dialogs/send-comp.c index a7d87c47f4..4eca089435 100644 --- a/calendar/gui/dialogs/send-comp.c +++ b/calendar/gui/dialogs/send-comp.c @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/send-comp.h b/calendar/gui/dialogs/send-comp.h index 21b310947a..63644bd52a 100644 --- a/calendar/gui/dialogs/send-comp.h +++ b/calendar/gui/dialogs/send-comp.h @@ -11,7 +11,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index 86a39aad24..7fb4679047 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/task-details-page.h b/calendar/gui/dialogs/task-details-page.h index 9fbfcd4af6..585ab0ba23 100644 --- a/calendar/gui/dialogs/task-details-page.h +++ b/calendar/gui/dialogs/task-details-page.h @@ -13,7 +13,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index eef1d64468..fbab8b0581 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/task-editor.h b/calendar/gui/dialogs/task-editor.h index 9376b4149a..57ab33b54f 100644 --- a/calendar/gui/dialogs/task-editor.h +++ b/calendar/gui/dialogs/task-editor.h @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index f371e60cdb..b088fb4ff1 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -12,7 +12,7 @@ * 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 + * License along with the program; if not, see * * * Authors: @@ -2180,7 +2180,7 @@ task_page_add_attendee (TaskPage *tpage, EMeetingAttendee *attendee) g_return_if_fail (tpage != NULL); g_return_if_fail (IS_TASK_PAGE (tpage)); - + priv = tpage->priv; e_meeting_store_add_attendee (priv->model, attendee); diff --git a/calendar/gui/dialogs/task-page.h b/calendar/gui/dialogs/task-page.h index 77ec68fa1d..b8a49f8286 100644 --- a/calendar/gui/dialogs/task-page.h +++ b/calendar/gui/dialogs/task-page.h @@ -13,7 +13,7 @@ * 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 + * License along with the program; if not, see * * * Authors: -- cgit v1.2.3 From 948235c3d1076dbe6ed2e57a24c16a083bbd9f01 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 27 May 2009 10:29:19 -0400 Subject: Prefer GLib basic types over C types. --- calendar/gui/dialogs/alarm-dialog.c | 62 ++++++++-------- calendar/gui/dialogs/alarm-list-dialog.c | 6 +- calendar/gui/dialogs/cal-attachment-select-file.c | 10 +-- calendar/gui/dialogs/cal-attachment-select-file.h | 4 +- calendar/gui/dialogs/cal-prefs-dialog.c | 46 ++++++------ calendar/gui/dialogs/calendar-setup.c | 46 ++++++------ calendar/gui/dialogs/cancel-comp.c | 2 +- calendar/gui/dialogs/changed-comp.c | 2 +- calendar/gui/dialogs/comp-editor-page.c | 2 +- calendar/gui/dialogs/comp-editor-page.h | 4 +- calendar/gui/dialogs/comp-editor-util.c | 20 +++--- calendar/gui/dialogs/comp-editor-util.h | 2 +- calendar/gui/dialogs/comp-editor.c | 50 ++++++------- calendar/gui/dialogs/copy-source-dialog.c | 6 +- calendar/gui/dialogs/delete-comp.c | 12 ++-- calendar/gui/dialogs/delete-comp.h | 4 +- calendar/gui/dialogs/delete-error.c | 2 +- calendar/gui/dialogs/e-delegate-dialog.c | 16 ++--- calendar/gui/dialogs/e-delegate-dialog.h | 14 ++-- calendar/gui/dialogs/e-send-options-utils.c | 24 +++---- calendar/gui/dialogs/event-editor.c | 4 +- calendar/gui/dialogs/event-page.c | 88 +++++++++++------------ calendar/gui/dialogs/memo-page.c | 40 +++++------ calendar/gui/dialogs/recur-comp.c | 2 +- calendar/gui/dialogs/recurrence-page.c | 58 +++++++-------- calendar/gui/dialogs/schedule-page.c | 2 +- calendar/gui/dialogs/select-source-dialog.c | 6 +- calendar/gui/dialogs/send-comp.c | 6 +- calendar/gui/dialogs/task-details-page.c | 18 ++--- calendar/gui/dialogs/task-editor.c | 2 +- calendar/gui/dialogs/task-page.c | 54 +++++++------- 31 files changed, 307 insertions(+), 307 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c index 73bfde30cc..ca8a58d528 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -86,7 +86,7 @@ typedef struct { GtkWidget *aalarm_file_chooser; /* Mail alarm widgets */ - const char *email; + const gchar *email; GtkWidget *malarm_group; GtkWidget *malarm_address_group; GtkWidget *malarm_addresses; @@ -103,7 +103,7 @@ typedef struct { ENameSelector *name_selector; } Dialog; -static const char *section_name = "Send To"; +static const gchar *section_name = "Send To"; /* "relative" types */ enum { @@ -119,7 +119,7 @@ enum { }; /* Combo box maps */ -static const int action_map[] = { +static const gint action_map[] = { E_CAL_COMPONENT_ALARM_DISPLAY, E_CAL_COMPONENT_ALARM_AUDIO, E_CAL_COMPONENT_ALARM_PROCEDURE, @@ -127,27 +127,27 @@ static const int action_map[] = { -1 }; -static const char *action_map_cap[] = { +static const gchar *action_map_cap[] = { CAL_STATIC_CAPABILITY_NO_DISPLAY_ALARMS, CAL_STATIC_CAPABILITY_NO_AUDIO_ALARMS, CAL_STATIC_CAPABILITY_NO_PROCEDURE_ALARMS, CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS }; -static const int value_map[] = { +static const gint value_map[] = { MINUTES, HOURS, DAYS, -1 }; -static const int relative_map[] = { +static const gint relative_map[] = { BEFORE, AFTER, -1 }; -static const int time_map[] = { +static const gint time_map[] = { E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START, E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_END, -1 @@ -159,7 +159,7 @@ enum duration_units { DUR_DAYS }; -static const int duration_units_map[] = { +static const gint duration_units_map[] = { DUR_MINUTES, DUR_HOURS, DUR_DAYS, @@ -197,8 +197,8 @@ alarm_to_dialog (Dialog *dialog) gboolean valid; gboolean repeat; ECalComponentAlarmAction action; - char *email; - int i; + gchar *email; + gint i; /* Clean the page */ clear_widgets (dialog); @@ -314,7 +314,7 @@ repeat_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm) static void aalarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm) { - char *url; + gchar *url; icalattach *attach; if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->aalarm_sound))) @@ -333,7 +333,7 @@ aalarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm) static void alarm_to_aalarm_widgets (Dialog *dialog, ECalComponentAlarm *alarm) { - const char *url; + const gchar *url; icalattach *attach; e_cal_component_alarm_get_attach (alarm, (&attach)); @@ -368,7 +368,7 @@ alarm_to_dalarm_widgets (Dialog *dialog, ECalComponentAlarm *alarm ) static void dalarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm) { - char *str; + gchar *str; ECalComponentText description; GtkTextBuffer *text_buffer; GtkTextIter text_iter_start, text_iter_end; @@ -394,7 +394,7 @@ dalarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm) icalcomp = e_cal_component_alarm_get_icalcomponent (alarm); icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY); while (icalprop) { - const char *x_name; + const gchar *x_name; x_name = icalproperty_get_x_name (icalprop); if (!strcmp (x_name, "X-EVOLUTION-NEEDS-DESCRIPTION")) { @@ -410,7 +410,7 @@ dalarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm) static void malarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm) { - char *str; + gchar *str; ECalComponentText description; GSList *attendee_list = NULL; GtkTextBuffer *text_buffer; @@ -468,7 +468,7 @@ malarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm) icalcomp = e_cal_component_alarm_get_icalcomponent (alarm); icalprop = icalcomponent_get_first_property(icalcomp, ICAL_X_PROPERTY); while (icalprop) { - const char *x_name; + const gchar *x_name; x_name = icalproperty_get_x_name (icalprop); if (!strcmp (x_name, "X-EVOLUTION-NEEDS-DESCRIPTION")) { @@ -489,7 +489,7 @@ alarm_to_malarm_widgets (Dialog *dialog, ECalComponentAlarm *alarm ) ECalComponentText description; GtkTextBuffer *text_buffer; GSList *attendee_list, *l; - int len; + gint len; /* Attendees */ name_selector_model = e_name_selector_peek_model (dialog->name_selector); @@ -531,7 +531,7 @@ static void alarm_to_palarm_widgets (Dialog *dialog, ECalComponentAlarm *alarm) { ECalComponentText description; - const char *url; + const gchar *url; icalattach *attach; e_cal_component_alarm_get_attach (alarm, (&attach)); @@ -551,9 +551,9 @@ alarm_to_palarm_widgets (Dialog *dialog, ECalComponentAlarm *alarm) static void palarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm) { - char *program; + gchar *program; icalattach *attach; - char *str; + gchar *str; ECalComponentText description; icalcomponent *icalcomp; icalproperty *icalprop; @@ -579,7 +579,7 @@ palarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm) icalcomp = e_cal_component_alarm_get_icalcomponent (alarm); icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY); while (icalprop) { - const char *x_name; + const gchar *x_name; x_name = icalproperty_get_x_name (icalprop); if (!strcmp (x_name, "X-EVOLUTION-NEEDS-DESCRIPTION")) { @@ -792,7 +792,7 @@ get_widgets (Dialog *dialog) #undef GW if (dialog->action_combo) { - const char *actions[] = { + const gchar *actions[] = { N_("Pop up an alert"), N_("Play a sound"), N_("Run a program"), @@ -865,7 +865,7 @@ static void show_options (Dialog *dialog) { gboolean repeat; - char *email; + gchar *email; e_cal_component_alarm_set_action (dialog->alarm, e_dialog_combo_box_get (dialog->action_combo, action_map)); @@ -943,7 +943,7 @@ repeat_toggle_toggled_cb (GtkToggleButton *toggle, gpointer data) static void check_custom_sound (Dialog *dialog) { - char *str, *dir; + gchar *str, *dir; gboolean sens; str = gtk_file_chooser_get_filename ( @@ -985,7 +985,7 @@ aalarm_attach_changed_cb (GtkWidget *widget, gpointer data) static void check_custom_message (Dialog *dialog) { - char *str; + gchar *str; GtkTextBuffer *text_buffer; GtkTextIter text_iter_start, text_iter_end; gboolean sens; @@ -1024,7 +1024,7 @@ dalarm_description_changed_cb (GtkWidget *widget, gpointer data) static void check_custom_program (Dialog *dialog) { - char *str; + gchar *str; gboolean sens; str = e_dialog_editable_get (dialog->palarm_program); @@ -1044,7 +1044,7 @@ palarm_program_changed_cb (GtkWidget *widget, gpointer data) static void check_custom_email (Dialog *dialog) { - char *str; + gchar *str; GtkTextBuffer *text_buffer; GtkTextIter text_iter_start, text_iter_end; ENameSelectorModel *name_selector_model; @@ -1100,9 +1100,9 @@ static void action_changed_cb (GtkWidget *action_combo, gpointer data) { Dialog *dialog = data; - char *dir; + gchar *dir; ECalComponentAlarmAction action; - int page = 0, i; + gint page = 0, i; action = e_dialog_combo_box_get (dialog->action_combo, action_map); for (i = 0; action_map[i] != -1 ; i++) { @@ -1188,8 +1188,8 @@ gboolean alarm_dialog_run (GtkWidget *parent, ECal *ecal, ECalComponentAlarm *alarm) { Dialog dialog; - int response_id; - char *gladefile; + gint response_id; + gchar *gladefile; g_return_val_if_fail (alarm != NULL, FALSE); diff --git a/calendar/gui/dialogs/alarm-list-dialog.c b/calendar/gui/dialogs/alarm-list-dialog.c index 8520b3727b..882f3fd0cc 100644 --- a/calendar/gui/dialogs/alarm-list-dialog.c +++ b/calendar/gui/dialogs/alarm-list-dialog.c @@ -263,8 +263,8 @@ gboolean alarm_list_dialog_run (GtkWidget *parent, ECal *ecal, EAlarmList *list_store) { Dialog dialog; - int response_id; - char *gladefile; + gint response_id; + gchar *gladefile; dialog.ecal = ecal; dialog.list_store = list_store; @@ -312,7 +312,7 @@ GtkWidget * alarm_list_dialog_peek (ECal *ecal, EAlarmList *list_store) { Dialog *dialog; - char *gladefile; + gchar *gladefile; dialog = (Dialog *)g_new (Dialog, 1); dialog->ecal = ecal; diff --git a/calendar/gui/dialogs/cal-attachment-select-file.c b/calendar/gui/dialogs/cal-attachment-select-file.c index 9c502153d3..b33753c42e 100644 --- a/calendar/gui/dialogs/cal-attachment-select-file.c +++ b/calendar/gui/dialogs/cal-attachment-select-file.c @@ -42,11 +42,11 @@ enum { }; static GtkWidget* -run_selector(CompEditor *editor, const char *title, guint32 flags, gboolean *showinline_p) +run_selector(CompEditor *editor, const gchar *title, guint32 flags, gboolean *showinline_p) { GtkWidget *selection; GtkWidget *showinline = NULL; - char *path; + gchar *path; path = g_object_get_data ((GObject *) editor, "attach_path"); @@ -117,12 +117,12 @@ run_selector(CompEditor *editor, const char *title, guint32 flags, gboolean *sho * Return value: the selected filename, or %NULL if the user * cancelled. **/ -char * -comp_editor_select_file (CompEditor *editor, const char *title, gboolean save_mode) +gchar * +comp_editor_select_file (CompEditor *editor, const gchar *title, gboolean save_mode) { guint32 flags = save_mode ? SELECTOR_MODE_SAVE : SELECTOR_MODE_MULTI; GtkWidget *selection; - char *name = NULL; + gchar *name = NULL; selection = run_selector (editor, title, flags, NULL); if (selection) { diff --git a/calendar/gui/dialogs/cal-attachment-select-file.h b/calendar/gui/dialogs/cal-attachment-select-file.h index 0f965e6c9b..b69a741007 100644 --- a/calendar/gui/dialogs/cal-attachment-select-file.h +++ b/calendar/gui/dialogs/cal-attachment-select-file.h @@ -26,8 +26,8 @@ #include "comp-editor.h" -char *comp_editor_select_file (CompEditor *editor, - const char *title, +gchar *comp_editor_select_file (CompEditor *editor, + const gchar *title, gboolean save_mode); GPtrArray *comp_editor_select_file_attachments (CompEditor *editor, diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 097c91907f..9ddd9af6cb 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -37,21 +37,21 @@ #include #include -static const int week_start_day_map[] = { +static const gint week_start_day_map[] = { 1, 2, 3, 4, 5, 6, 0, -1 }; -static const int time_division_map[] = { +static const gint time_division_map[] = { 60, 30, 15, 10, 5, -1 }; /* The following two are kept separate in case we need to re-order each menu individually */ -static const int hide_completed_units_map[] = { +static const gint 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[] = { +static const gint default_reminder_units_map[] = { CAL_MINUTES, CAL_HOURS, CAL_DAYS, -1 }; @@ -93,7 +93,7 @@ calendar_prefs_dialog_init (CalendarPrefsDialog *dialog) } static GtkWidget * -eccp_widget_glade (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, void *data) +eccp_widget_glade (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data) { CalendarPrefsDialog *prefs = data; @@ -105,7 +105,7 @@ working_days_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) { CalWeekdays working_days = 0; guint32 mask = 1; - int day; + gint day; for (day = 0; day < 7; day++) { if (e_dialog_toggle_get (prefs->working_days[day])) @@ -129,8 +129,8 @@ timezone_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) static void update_day_second_zone_caption (CalendarPrefsDialog *prefs) { - char *location; - const char *caption; + gchar *location; + const gchar *caption; icaltimezone *zone; g_return_if_fail (prefs != NULL); @@ -173,7 +173,7 @@ day_second_zone_clicked (GtkWidget *widget, CalendarPrefsDialog *prefs) { GtkWidget *menu, *item; GSList *group = NULL, *recent_zones, *s; - char *location; + gchar *location; icaltimezone *zone, *second_zone = NULL; menu = gtk_menu_new (); @@ -224,7 +224,7 @@ day_second_zone_clicked (GtkWidget *widget, CalendarPrefsDialog *prefs) static void start_of_day_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) { - int start_hour, start_minute, end_hour, end_minute; + gint start_hour, start_minute, end_hour, end_minute; EDateEdit *start, *end; start = E_DATE_EDIT (prefs->start_of_day); @@ -249,7 +249,7 @@ start_of_day_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) static void end_of_day_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) { - int start_hour, start_minute, end_hour, end_minute; + gint start_hour, start_minute, end_hour, end_minute; EDateEdit *start, *end; start = E_DATE_EDIT (prefs->start_of_day); @@ -273,7 +273,7 @@ end_of_day_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) static void week_start_day_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) { - int week_start_day; + gint week_start_day; week_start_day = e_dialog_combo_box_get (prefs->week_start_day, week_start_day_map); calendar_config_set_week_start_day (week_start_day); @@ -295,7 +295,7 @@ use_24_hour_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) static void time_divisions_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) { - int time_divisions; + gint time_divisions; time_divisions = e_dialog_combo_box_get (prefs->time_divisions, time_division_map); calendar_config_set_time_divisions (time_divisions); @@ -418,7 +418,7 @@ static void ba_reminder_interval_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) { const gchar *str; - int value; + gint value; str = gtk_entry_get_text (GTK_ENTRY (widget)); value = (int) g_ascii_strtod (str, NULL); @@ -495,7 +495,7 @@ update_system_tz_widgets (EShellSettings *shell_settings, zone = e_cal_util_get_system_timezone (); if (zone) { - char *tmp = g_strdup_printf ("(%s)", icaltimezone_get_display_name (zone)); + gchar *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 { @@ -506,7 +506,7 @@ update_system_tz_widgets (EShellSettings *shell_settings, static void setup_changes (CalendarPrefsDialog *prefs) { - int i; + gint i; for (i = 0; i < 7; i ++) g_signal_connect (G_OBJECT (prefs->working_days[i]), "toggled", G_CALLBACK (working_days_changed), prefs); @@ -610,7 +610,7 @@ initialize_selection (ESourceSelector *selector, ESourceList *source_list) GSList *sources; for (sources = e_source_group_peek_sources (group); sources; sources = sources->next) { ESource *source = E_SOURCE (sources->data); - const char *completion = e_source_get_property (source, "alarm"); + const gchar *completion = e_source_get_property (source, "alarm"); if (!completion || !g_ascii_strcasecmp (completion, "true")) { if (!completion) e_source_set_property (E_SOURCE (source), "alarm", "true"); @@ -641,9 +641,9 @@ show_config (CalendarPrefsDialog *prefs) gint mask, day, week_start_day, time_divisions; icaltimezone *zone; gboolean sensitive, set = FALSE; - char *location; + gchar *location; CalUnits units; - int interval; + gint interval; /* Timezone. */ location = calendar_config_get_timezone_stored (); @@ -744,7 +744,7 @@ static ECalConfigItem eccp_items[] = { }; static void -eccp_free (EConfig *ec, GSList *items, void *data) +eccp_free (EConfig *ec, GSList *items, gpointer data) { g_slist_free (items); } @@ -757,11 +757,11 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, ECalConfig *ec; ECalConfigTargetPrefs *target; EShellSettings *shell_settings; - int i; + gint i; GtkWidget *toplevel; GtkWidget *widget; GSList *l; - const char *working_day_names[] = { + const gchar *working_day_names[] = { "sun_button", "mon_button", "tue_button", @@ -770,7 +770,7 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, "fri_button", "sat_button", }; - char *gladefile; + gchar *gladefile; shell_settings = e_shell_get_shell_settings (shell); diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c index 95820b8247..32fbc9bd68 100644 --- a/calendar/gui/dialogs/calendar-setup.c +++ b/calendar/gui/dialogs/calendar-setup.c @@ -58,11 +58,11 @@ struct _CalendarSourceDialog { }; static gboolean -eccp_check_complete (EConfig *ec, const char *pageid, void *data) +eccp_check_complete (EConfig *ec, const gchar *pageid, gpointer data) { CalendarSourceDialog *sdialog = data; gboolean valid = TRUE; - const char *tmp; + const gchar *tmp; ESource *source; tmp = e_source_peek_name (sdialog->source); @@ -72,7 +72,7 @@ eccp_check_complete (EConfig *ec, const char *pageid, void *data) } static void -eccp_commit (EConfig *ec, GSList *items, void *data) +eccp_commit (EConfig *ec, GSList *items, gpointer data) { CalendarSourceDialog *sdialog = data; xmlNodePtr xml; @@ -80,7 +80,7 @@ eccp_commit (EConfig *ec, GSList *items, void *data) if (sdialog->original_source) { const gchar *color_spec; - xml = xmlNewNode (NULL, (const unsigned char *)"dummy"); + xml = xmlNewNode (NULL, (const guchar *)"dummy"); e_source_dump_to_xml_node (sdialog->source, xml); e_source_update_from_xml_node (sdialog->original_source, xml->children, NULL); xmlFreeNode (xml); @@ -95,7 +95,7 @@ eccp_commit (EConfig *ec, GSList *items, void *data) } static void -eccp_free (EConfig *ec, GSList *items, void *data) +eccp_free (EConfig *ec, GSList *items, gpointer data) { CalendarSourceDialog *sdialog = data; @@ -113,7 +113,7 @@ eccp_free (EConfig *ec, GSList *items, void *data) static void eccp_type_changed (GtkComboBox *dropdown, CalendarSourceDialog *sdialog) { - int id = gtk_combo_box_get_active (dropdown); + gint id = gtk_combo_box_get_active (dropdown); GtkTreeModel *model; GtkTreeIter iter; @@ -134,15 +134,15 @@ eccp_type_changed (GtkComboBox *dropdown, CalendarSourceDialog *sdialog) } static GtkWidget * -eccp_get_source_type (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, void *data) +eccp_get_source_type (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data) { static GtkWidget *label, *type; - int row; + gint row; CalendarSourceDialog *sdialog = data; ECalConfigTargetSource *t = (ECalConfigTargetSource *) ec->target; ESource *source = t->source; ESourceGroup *group = e_source_peek_group (source); - char *markup; + gchar *markup; if (old) gtk_widget_destroy (label); @@ -164,7 +164,7 @@ eccp_get_source_type (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidg GtkListStore *store; GtkTreeIter iter; GSList *l; - int active = 0, i = 0; + gint active = 0, i = 0; label = gtk_label_new_with_mnemonic(_("_Type:")); @@ -211,10 +211,10 @@ name_changed (GtkEntry *entry, ECalConfigTargetSource *t) } static GtkWidget * -eccp_get_source_name (EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, struct _GtkWidget *old, void *data) +eccp_get_source_name (EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, struct _GtkWidget *old, gpointer data) { static GtkWidget *label, *entry; - int row; + gint row; ECalConfigTargetSource *t = (ECalConfigTargetSource *) ec->target; ESource *source = t->source; @@ -252,13 +252,13 @@ offline_status_changed_cb (GtkWidget *widget, CalendarSourceDialog *sdialog) } static GtkWidget * -eccp_general_offline (EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, struct _GtkWidget *old, void *data) +eccp_general_offline (EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, struct _GtkWidget *old, gpointer data) { CalendarSourceDialog *sdialog = data; GtkWidget *offline_setting = NULL; - const char *offline_sync; - int row; - const char *base_uri = e_source_group_peek_base_uri (sdialog->source_group); + const gchar *offline_sync; + gint row; + const gchar *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) @@ -318,7 +318,7 @@ choose_initial_color (void) } static GtkWidget * -eccp_get_source_color (EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, struct _GtkWidget *old, void *data) +eccp_get_source_color (EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, struct _GtkWidget *old, gpointer data) { CalendarSourceDialog *sdialog = data; static GtkWidget *label, *color_button; @@ -434,9 +434,9 @@ void calendar_setup_edit_calendar (struct _GtkWindow *parent, ESource *source, ESourceGroup *group) { CalendarSourceDialog *sdialog = g_new0 (CalendarSourceDialog, 1); - char *xml; + gchar *xml; ECalConfig *ec; - int i; + gint i; GSList *items = NULL; ECalConfigTargetSource *target; @@ -491,9 +491,9 @@ void calendar_setup_edit_task_list (struct _GtkWindow *parent, ESource *source) { CalendarSourceDialog *sdialog = g_new0 (CalendarSourceDialog, 1); - char *xml; + gchar *xml; ECalConfig *ec; - int i; + gint i; GSList *items = NULL; ECalConfigTargetSource *target; @@ -547,9 +547,9 @@ void calendar_setup_edit_memo_list (struct _GtkWindow *parent, ESource *source) { CalendarSourceDialog *sdialog = g_new0 (CalendarSourceDialog, 1); - char *xml; + gchar *xml; ECalConfig *ec; - int i; + gint i; GSList *items = NULL; ECalConfigTargetSource *target; diff --git a/calendar/gui/dialogs/cancel-comp.c b/calendar/gui/dialogs/cancel-comp.c index cddd4f8d8d..cdb388e7b9 100644 --- a/calendar/gui/dialogs/cancel-comp.c +++ b/calendar/gui/dialogs/cancel-comp.c @@ -67,7 +67,7 @@ gboolean cancel_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean deleting) { ECalComponentVType vtype; - const char *id; + const gchar *id; if (deleting && e_cal_get_save_schedules (client)) return TRUE; diff --git a/calendar/gui/dialogs/changed-comp.c b/calendar/gui/dialogs/changed-comp.c index d1abc1724d..5fb0240037 100644 --- a/calendar/gui/dialogs/changed-comp.c +++ b/calendar/gui/dialogs/changed-comp.c @@ -48,7 +48,7 @@ changed_component_dialog (GtkWindow *parent, ECalComponent *comp, gboolean delet { GtkWidget *dialog; ECalComponentVType vtype; - char *str; + gchar *str; gint response; vtype = e_cal_component_get_vtype (comp); diff --git a/calendar/gui/dialogs/comp-editor-page.c b/calendar/gui/dialogs/comp-editor-page.c index 93b9cd9304..2281e5d0fc 100644 --- a/calendar/gui/dialogs/comp-editor-page.c +++ b/calendar/gui/dialogs/comp-editor-page.c @@ -432,7 +432,7 @@ comp_editor_page_notify_dates_changed (CompEditorPage *page, */ void comp_editor_page_display_validation_error (CompEditorPage *page, - const char *msg, + const gchar *msg, GtkWidget *field) { GtkWidget *dialog; diff --git a/calendar/gui/dialogs/comp-editor-page.h b/calendar/gui/dialogs/comp-editor-page.h index 819ea74ccc..a58da9b804 100644 --- a/calendar/gui/dialogs/comp-editor-page.h +++ b/calendar/gui/dialogs/comp-editor-page.h @@ -82,7 +82,7 @@ struct _CompEditorPageClass { /* Notification signals */ - void (* dates_changed) (CompEditorPage *page, const char *dates); + void (* dates_changed) (CompEditorPage *page, const gchar *dates); /* Virtual methods */ @@ -119,7 +119,7 @@ void comp_editor_page_notify_dates_changed CompEditorPageDates *dates); void comp_editor_page_display_validation_error (CompEditorPage *page, - const char *msg, + const gchar *msg, GtkWidget *field); G_END_DECLS diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index 4666058b51..e9661db372 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -121,7 +121,7 @@ write_label_piece (struct icaltimetype *tt, { struct tm tmp_tm = { 0 }; struct icaltimetype tt_copy = *tt; - int len; + gint len; /* FIXME: May want to convert the time to an appropriate zone. */ @@ -166,7 +166,7 @@ write_label_piece (struct icaltimetype *tt, void comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label) { - char buffer[1024]; + gchar buffer[1024]; gboolean start_set = FALSE, end_set = FALSE; gboolean complete_set = FALSE, due_set = FALSE; @@ -290,13 +290,13 @@ comp_editor_get_current_time (GtkObject *object, gpointer data) * Return value: The category names stripped of surrounding whitespace * and separated with commas. **/ -char * -comp_editor_strip_categories (const char *categories) +gchar * +comp_editor_strip_categories (const gchar *categories) { - char *new_categories; - const char *start, *end; - const char *p; - char *new_p; + gchar *new_categories; + const gchar *start, *end; + const gchar *p; + gchar *new_p; if (!categories) return NULL; @@ -314,7 +314,7 @@ comp_editor_strip_categories (const char *categories) if (g_unichar_isspace (c)) continue; else if (c == ',') { - int len; + gint len; if (!start) continue; @@ -337,7 +337,7 @@ comp_editor_strip_categories (const char *categories) } if (start) { - int len; + gint len; g_return_val_if_fail (start <= end, NULL); diff --git a/calendar/gui/dialogs/comp-editor-util.h b/calendar/gui/dialogs/comp-editor-util.h index 5516fe4cc4..3bf8921291 100644 --- a/calendar/gui/dialogs/comp-editor-util.h +++ b/calendar/gui/dialogs/comp-editor-util.h @@ -39,6 +39,6 @@ GtkWidget *comp_editor_new_date_edit (gboolean show_date, gboolean show_time, struct tm comp_editor_get_current_time (GtkObject *object, gpointer data); -char *comp_editor_strip_categories (const char *categories); +gchar *comp_editor_strip_categories (const gchar *categories); #endif diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 06fd724680..c01ca844c9 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -213,10 +213,10 @@ get_attachment_list (CompEditor *editor) GtkTreeModel *model; GtkTreeIter iter; GSList *list = NULL; - const char *comp_uid = NULL; - const char *local_store = e_cal_get_local_attachment_store (editor->priv->client); + const gchar *comp_uid = NULL; + const gchar *local_store = e_cal_get_local_attachment_store (editor->priv->client); gboolean valid; - int ticker=0; + gint ticker=0; e_cal_component_get_uid (editor->priv->comp, &comp_uid); @@ -231,9 +231,9 @@ get_attachment_list (CompEditor *editor) CamelDataWrapper *wrapper; CamelMimePart *mime_part; CamelStream *stream; - char *attach_file_url; - char *safe_fname, *utf8_safe_fname; - char *filename; + gchar *attach_file_url; + gchar *safe_fname, *utf8_safe_fname; + gchar *filename; gint column_id; column_id = E_ATTACHMENT_STORE_COLUMN_ATTACHMENT; @@ -259,7 +259,7 @@ get_attachment_list (CompEditor *editor) if (!utf8_safe_fname) safe_fname = g_strdup_printf ("%s-%d", _("attachment"), ticker++); else { - safe_fname = g_filename_from_utf8 ((const char *) utf8_safe_fname, -1, NULL, NULL, NULL); + safe_fname = g_filename_from_utf8 ((const gchar *) utf8_safe_fname, -1, NULL, NULL, NULL); g_free (utf8_safe_fname); } filename = g_strdup_printf ("%s-%s", comp_uid, safe_fname); @@ -313,7 +313,7 @@ static void listen_for_changes (CompEditor *editor) { CompEditorPrivate *priv; - const char *uid = NULL; + const gchar *uid = NULL; priv = editor->priv; @@ -333,7 +333,7 @@ listen_for_changes (CompEditor *editor) e_cal_component_get_uid (priv->comp, &uid); if (uid) { - char *query; + gchar *query; query = g_strdup_printf ("(uid? \"%s\")", uid); e_cal_get_query (priv->source_client, query, &priv->view, NULL); @@ -371,7 +371,7 @@ save_comp (CompEditor *editor) gboolean result; GError *error = NULL; GHashTable *timezones; - const char *orig_uid; + const gchar *orig_uid; icalcomponent *icalcomp; priv = editor->priv; @@ -464,7 +464,7 @@ save_comp (CompEditor *editor) icalproperty *icalprop; icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY); while (icalprop) { - const char *x_name; + const gchar *x_name; x_name = icalproperty_get_x_name (icalprop); if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-DELAY")) { @@ -842,7 +842,7 @@ action_save_cb (GtkAction *action, delegate = flags & COMP_EDITOR_DELEGATE; if (delegate && !remove_event_dialog (priv->client, priv->comp, GTK_WINDOW (editor))) { - const char *uid = NULL; + const gchar *uid = NULL; GError *error = NULL; e_cal_component_get_uid (priv->comp, &uid); @@ -2177,7 +2177,7 @@ page_unmapped_cb (GtkWidget *page_widget, void comp_editor_append_page (CompEditor *editor, CompEditorPage *page, - const char *label, + const gchar *label, gboolean add) { CompEditorPrivate *priv; @@ -2446,7 +2446,7 @@ real_edit_comp (CompEditor *editor, ECalComponent *comp) /* TODO These functions should be available in e-cal-component.c */ static void -set_attendees_for_delegation (ECalComponent *comp, const char *address, ECalComponentItipMethod method) +set_attendees_for_delegation (ECalComponent *comp, const gchar *address, ECalComponentItipMethod method) { icalproperty *prop; icalparameter *param; @@ -2457,8 +2457,8 @@ set_attendees_for_delegation (ECalComponent *comp, const char *address, ECalComp for (prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY); prop; prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) { - const char *attendee = icalproperty_get_attendee (prop); - const char *delfrom = NULL; + const gchar *attendee = icalproperty_get_attendee (prop); + const gchar *delfrom = NULL; param = icalproperty_get_first_parameter(prop, ICAL_DELEGATEDFROM_PARAMETER); if (param) @@ -2478,8 +2478,8 @@ get_users_from_memo_comp (ECalComponent *comp, GList **users) { icalcomponent *icalcomp; icalproperty *icalprop; - const char *attendees = NULL; - char **emails, **iter; + const gchar *attendees = NULL; + gchar **emails, **iter; icalcomp = e_cal_component_get_icalcomponent (comp); @@ -2509,7 +2509,7 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean str CompEditorPrivate *priv; CompEditorFlags flags; ECalComponent *send_comp = NULL; - char *address = NULL; + gchar *address = NULL; GList *users = NULL; g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); @@ -2520,7 +2520,7 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean str if (priv->mod == CALOBJ_MOD_ALL && e_cal_component_is_instance (priv->comp)) { /* Ensure we send the master object, not the instance only */ icalcomponent *icalcomp = NULL; - const char *uid = NULL; + const gchar *uid = NULL; e_cal_component_get_uid (priv->comp, &uid); if (e_cal_get_object (priv->client, uid, NULL, &icalcomp, NULL) && icalcomp) { @@ -2556,7 +2556,7 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean str } } else { /* Clone the component with attachments set to CID:... */ - int num_attachments, i; + gint num_attachments, i; GSList *attach_list = NULL; GSList *mime_attach_list; @@ -2674,7 +2674,7 @@ void comp_editor_delete_comp (CompEditor *editor) { CompEditorPrivate *priv; - const char *uid; + const gchar *uid; g_return_if_fail (IS_COMP_EDITOR (editor)); @@ -2754,8 +2754,8 @@ comp_editor_get_mime_attach_list (CompEditor *editor) CamelDataWrapper *wrapper; CamelMimePart *mime_part; CamelStreamMem *mstream; - unsigned char *buffer = NULL; - const char *desc, *disp; + guchar *buffer = NULL; + const gchar *desc, *disp; gint column_id; column_id = E_ATTACHMENT_STORE_COLUMN_ATTACHMENT; @@ -2775,7 +2775,7 @@ comp_editor_get_mime_attach_list (CompEditor *editor) camel_data_wrapper_decode_to_stream (wrapper, (CamelStream *) mstream); buffer = g_memdup (mstream->buffer->data, mstream->buffer->len); - cal_mime_attach->encoded_data = (char *)buffer; + cal_mime_attach->encoded_data = (gchar *)buffer; cal_mime_attach->length = mstream->buffer->len; cal_mime_attach->filename = g_strdup (camel_mime_part_get_filename (mime_part)); desc = camel_mime_part_get_description (mime_part); diff --git a/calendar/gui/dialogs/copy-source-dialog.c b/calendar/gui/dialogs/copy-source-dialog.c index 92444678be..49cf8b3ce4 100644 --- a/calendar/gui/dialogs/copy-source-dialog.c +++ b/calendar/gui/dialogs/copy-source-dialog.c @@ -38,7 +38,7 @@ typedef struct { } CopySourceDialogData; static void -show_error (GtkWindow *parent, const char *msg) +show_error (GtkWindow *parent, const gchar *msg) { GtkWidget *dialog; @@ -82,7 +82,7 @@ copy_source (CopySourceDialogData *csdd) } else { if (e_cal_get_object_list (source_client, "#t", &obj_list, NULL)) { GList *l; - const char *uid; + const gchar *uid; icalcomponent *icalcomp; for (l = obj_list; l != NULL; l = l->next) { @@ -93,7 +93,7 @@ copy_source (CopySourceDialogData *csdd) e_cal_modify_object (dest_client, l->data, CALOBJ_MOD_ALL, NULL); icalcomponent_free (icalcomp); } else { - e_cal_create_object (dest_client, l->data, (char **) &uid, NULL); + e_cal_create_object (dest_client, l->data, (gchar **) &uid, NULL); g_free ((gpointer) uid); } } diff --git a/calendar/gui/dialogs/delete-comp.c b/calendar/gui/dialogs/delete-comp.c index ae371aabb2..1a004272d1 100644 --- a/calendar/gui/dialogs/delete-comp.c +++ b/calendar/gui/dialogs/delete-comp.c @@ -58,12 +58,12 @@ gboolean delete_component_dialog (ECalComponent *comp, gboolean consider_as_untitled, - int n_comps, ECalComponentVType vtype, + gint n_comps, ECalComponentVType vtype, GtkWidget *widget) { - const char *id; - char *arg0 = NULL; - int response; + const gchar *id; + gchar *arg0 = NULL; + gint response; if (comp) { g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), FALSE); @@ -167,9 +167,9 @@ cb_toggled_cb (GtkWidget *toggle, gpointer data) } gboolean -prompt_retract_dialog (ECalComponent *comp, char **retract_text, GtkWidget *parent, gboolean *retract) +prompt_retract_dialog (ECalComponent *comp, gchar **retract_text, GtkWidget *parent, gboolean *retract) { - char *message = NULL; + gchar *message = NULL; ECalComponentVType type = E_CAL_COMPONENT_NO_TYPE; GtkMessageDialog *dialog = NULL; GtkWidget *cb, *label, *entry, *vbox, *sw, *frame; diff --git a/calendar/gui/dialogs/delete-comp.h b/calendar/gui/dialogs/delete-comp.h index c619e28b98..9123dcc479 100644 --- a/calendar/gui/dialogs/delete-comp.h +++ b/calendar/gui/dialogs/delete-comp.h @@ -31,8 +31,8 @@ gboolean delete_component_dialog (ECalComponent *comp, gboolean consider_as_untitled, - int n_comps, ECalComponentVType vtype, + gint n_comps, ECalComponentVType vtype, GtkWidget *widget); -gboolean prompt_retract_dialog (ECalComponent *comp, char **retract_text, GtkWidget *parent, gboolean *retract); +gboolean prompt_retract_dialog (ECalComponent *comp, gchar **retract_text, GtkWidget *parent, gboolean *retract); #endif diff --git a/calendar/gui/dialogs/delete-error.c b/calendar/gui/dialogs/delete-error.c index f8df587aa4..c312e16ada 100644 --- a/calendar/gui/dialogs/delete-error.c +++ b/calendar/gui/dialogs/delete-error.c @@ -42,7 +42,7 @@ void delete_error_dialog (GError *error, ECalComponentVType vtype) { GtkWidget *dialog; - const char *str; + const gchar *str; const gchar *icon_name = NULL; if (!error) diff --git a/calendar/gui/dialogs/e-delegate-dialog.c b/calendar/gui/dialogs/e-delegate-dialog.c index 8e060832df..87fb164e6a 100644 --- a/calendar/gui/dialogs/e-delegate-dialog.c +++ b/calendar/gui/dialogs/e-delegate-dialog.c @@ -36,8 +36,8 @@ #include "e-delegate-dialog.h" struct _EDelegateDialogPrivate { - char *name; - char *address; + gchar *name; + gchar *address; /* Glade XML data */ GladeXML *xml; @@ -51,7 +51,7 @@ struct _EDelegateDialogPrivate { GtkWidget *entry; }; -static const char *section_name = "Delegate To"; +static const gchar *section_name = "Delegate To"; static void e_delegate_dialog_finalize (GObject *object); @@ -116,14 +116,14 @@ e_delegate_dialog_finalize (GObject *object) EDelegateDialog * -e_delegate_dialog_construct (EDelegateDialog *edd, const char *name, const char *address) +e_delegate_dialog_construct (EDelegateDialog *edd, const gchar *name, const gchar *address) { EDelegateDialogPrivate *priv; EDestinationStore *destination_store; EDestination *dest; ENameSelectorModel *name_selector_model; ENameSelectorDialog *name_selector_dialog; - char *gladefile; + gchar *gladefile; g_return_val_if_fail (edd != NULL, NULL); g_return_val_if_fail (E_IS_DELEGATE_DIALOG (edd), NULL); @@ -234,7 +234,7 @@ addressbook_response_cb (GtkWidget *widget, gint response, gpointer data) * editor could not be created. **/ EDelegateDialog * -e_delegate_dialog_new (const char *name, const char *address) +e_delegate_dialog_new (const gchar *name, const gchar *address) { EDelegateDialog *edd; @@ -242,7 +242,7 @@ e_delegate_dialog_new (const char *name, const char *address) return e_delegate_dialog_construct (E_DELEGATE_DIALOG (edd), name, address); } -char * +gchar * e_delegate_dialog_get_delegate (EDelegateDialog *edd) { EDelegateDialogPrivate *priv; @@ -274,7 +274,7 @@ e_delegate_dialog_get_delegate (EDelegateDialog *edd) } -char * +gchar * e_delegate_dialog_get_delegate_name (EDelegateDialog *edd) { EDelegateDialogPrivate *priv; diff --git a/calendar/gui/dialogs/e-delegate-dialog.h b/calendar/gui/dialogs/e-delegate-dialog.h index e4f474781a..6ff872e7e4 100644 --- a/calendar/gui/dialogs/e-delegate-dialog.h +++ b/calendar/gui/dialogs/e-delegate-dialog.h @@ -54,18 +54,18 @@ struct _EDelegateDialogClass { GType e_delegate_dialog_get_type (void); EDelegateDialog* e_delegate_dialog_construct (EDelegateDialog *etd, - const char *name, - const char *address); + const gchar *name, + const gchar *address); -EDelegateDialog* e_delegate_dialog_new (const char *name, - const char *address); +EDelegateDialog* e_delegate_dialog_new (const gchar *name, + const gchar *address); -char* e_delegate_dialog_get_delegate (EDelegateDialog *etd); +gchar * e_delegate_dialog_get_delegate (EDelegateDialog *etd); -char* e_delegate_dialog_get_delegate_name (EDelegateDialog *etd); +gchar * e_delegate_dialog_get_delegate_name (EDelegateDialog *etd); void e_delegate_dialog_set_delegate (EDelegateDialog *etd, - const char *address); + const gchar *address); GtkWidget* e_delegate_dialog_get_toplevel (EDelegateDialog *etd); diff --git a/calendar/gui/dialogs/e-send-options-utils.c b/calendar/gui/dialogs/e-send-options-utils.c index fd6bf245c2..5af9d4bc43 100644 --- a/calendar/gui/dialogs/e-send-options-utils.c +++ b/calendar/gui/dialogs/e-send-options-utils.c @@ -34,8 +34,8 @@ e_sendoptions_utils_set_default_data (ESendOptionsDialog *sod, ESource *source, ESendOptionsStatusTracking *sopts; GConfClient *gconf = gconf_client_get_default (); ESourceList *source_list; - const char *uid; - const char *value; + const gchar *uid; + const gchar *value; gopts = sod->data->gopts; sopts = sod->data->sopts; @@ -153,7 +153,7 @@ e_sendoptions_utils_set_default_data (ESendOptionsDialog *sod, ESource *source, void e_sendoptions_utils_fill_component (ESendOptionsDialog *sod, ECalComponent *comp) { - int i = 1; + gint i = 1; icalproperty *prop; icalcomponent *icalcomp; ESendOptionsGeneral *gopts; @@ -166,7 +166,7 @@ e_sendoptions_utils_fill_component (ESendOptionsDialog *sod, ECalComponent *comp icalcomp = e_cal_component_get_icalcomponent (comp); if (e_sendoptions_get_need_general_options (sod)) { - prop = icalproperty_new_x ((const char *) g_strdup_printf ("%d", gopts->priority)); + prop = icalproperty_new_x ((const gchar *) g_strdup_printf ("%d", gopts->priority)); icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-PRIORITY"); icalcomponent_add_property (icalcomp, prop); @@ -174,20 +174,20 @@ e_sendoptions_utils_fill_component (ESendOptionsDialog *sod, ECalComponent *comp if (gopts->reply_convenient) prop = icalproperty_new_x ("convenient"); else - prop = icalproperty_new_x ((const char *) g_strdup_printf ( "%d", gopts->reply_within)); + prop = icalproperty_new_x ((const gchar *) g_strdup_printf ( "%d", gopts->reply_within)); icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-REPLY"); icalcomponent_add_property (icalcomp, prop); } if (gopts->expiration_enabled && gopts->expire_after) { - prop = icalproperty_new_x ((const char *) g_strdup_printf ( "%d", gopts->expire_after)); + prop = icalproperty_new_x ((const gchar *) g_strdup_printf ( "%d", gopts->expire_after)); icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-EXPIRE"); icalcomponent_add_property (icalcomp, prop); } if (gopts->delay_enabled) { struct icaltimetype temp; - char *str; + gchar *str; icaltimezone *zone = calendar_config_get_icaltimezone (); temp = icaltime_from_timet_with_zone (gopts->delay_until, FALSE, zone); @@ -201,7 +201,7 @@ e_sendoptions_utils_fill_component (ESendOptionsDialog *sod, ECalComponent *comp } if (sopts->tracking_enabled) - prop = icalproperty_new_x ((const char *) g_strdup_printf ( "%d", sopts->track_when)); + prop = icalproperty_new_x ((const gchar *) g_strdup_printf ( "%d", sopts->track_when)); else prop = icalproperty_new_x ("0"); @@ -209,19 +209,19 @@ e_sendoptions_utils_fill_component (ESendOptionsDialog *sod, ECalComponent *comp icalcomponent_add_property (icalcomp, prop); - prop = icalproperty_new_x ((const char *) g_strdup_printf ("%d", sopts->opened)); + prop = icalproperty_new_x ((const gchar *) g_strdup_printf ("%d", sopts->opened)); icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-OPENED"); icalcomponent_add_property (icalcomp, prop); - prop = icalproperty_new_x ((const char *) g_strdup_printf ("%d", sopts->accepted)); + prop = icalproperty_new_x ((const gchar *) g_strdup_printf ("%d", sopts->accepted)); icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-ACCEPTED"); icalcomponent_add_property (icalcomp, prop); - prop = icalproperty_new_x ((const char *) g_strdup_printf ("%d", sopts->declined)); + prop = icalproperty_new_x ((const gchar *) g_strdup_printf ("%d", sopts->declined)); icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-DECLINED"); icalcomponent_add_property (icalcomp, prop); - prop = icalproperty_new_x ((const char *) g_strdup_printf ("%d", sopts->completed)); + prop = icalproperty_new_x ((const gchar *) g_strdup_printf ("%d", sopts->completed)); icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-COMPLETED"); icalcomponent_add_property (icalcomp, prop); } diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 987c716b6f..ee34590941 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -554,8 +554,8 @@ event_editor_edit_comp (CompEditor *editor, ECalComponent *comp) /* Set up the attendees */ if (attendees != NULL) { GSList *l; - int row; - char *user_email; + gint row; + gchar *user_email; user_email = itip_get_comp_attendee (comp, client); if (!priv->meeting_shown) { diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index fa1faa2f79..928d159292 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -73,7 +73,7 @@ enum { ALARM_CUSTOM }; -static const int alarm_map_with_user_time[] = { +static const gint alarm_map_with_user_time[] = { ALARM_NONE, ALARM_15_MINUTES, ALARM_1_HOUR, @@ -83,7 +83,7 @@ static const int alarm_map_with_user_time[] = { -1 }; -static const int alarm_map_without_user_time[] = { +static const gint alarm_map_without_user_time[] = { ALARM_NONE, ALARM_15_MINUTES, ALARM_1_HOUR, @@ -113,7 +113,7 @@ struct _EventPagePrivate { EAccountList *accounts; GList *address_strings; EMeetingAttendee *ia; - char *user_add; + gchar *user_add; ECalComponent *comp; /* For meeting/event */ @@ -176,9 +176,9 @@ struct _EventPagePrivate { gboolean sendoptions_shown; ESendOptionsDialog *sod; - char *old_summary; + gchar *old_summary; CalUnits alarm_units; - int alarm_interval; + gint alarm_interval; /* This is TRUE if both the start & end timezone are the same. If the start timezone is then changed, we updated the end timezone to the @@ -189,7 +189,7 @@ struct _EventPagePrivate { GtkWidget *alarm_list_dlg_widget; /* either with-user-time or without it */ - const int *alarm_map; + const gint *alarm_map; }; static GtkWidget *event_page_get_widget (CompEditorPage *page); @@ -206,8 +206,8 @@ 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_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); +static void event_page_select_organizer (EventPage *epage, const gchar *backend_address); +static void set_subscriber_info_string (EventPage *epage, const gchar *backend_address); G_DEFINE_TYPE (EventPage, event_page, TYPE_COMP_EDITOR_PAGE) @@ -512,7 +512,7 @@ clear_widgets (EventPage *epage) } static gboolean -is_custom_alarm (ECalComponentAlarm *ca, char *old_summary, CalUnits user_units, int user_interval, int *alarm_type) +is_custom_alarm (ECalComponentAlarm *ca, gchar *old_summary, CalUnits user_units, gint user_interval, gint *alarm_type) { ECalComponentAlarmTrigger trigger; ECalComponentAlarmRepeat repeat; @@ -534,7 +534,7 @@ is_custom_alarm (ECalComponentAlarm *ca, char *old_summary, CalUnits user_units, icalcomp = e_cal_component_alarm_get_icalcomponent (ca); icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY); while (icalprop) { - const char *x_name; + const gchar *x_name; x_name = icalproperty_get_x_name (icalprop); if (!strcmp (x_name, "X-EVOLUTION-NEEDS-DESCRIPTION")) @@ -631,7 +631,7 @@ is_custom_alarm (ECalComponentAlarm *ca, char *old_summary, CalUnits user_units, } static gboolean -is_custom_alarm_uid_list (ECalComponent *comp, GList *alarms, char *old_summary, CalUnits user_units, int user_interval, int *alarm_type) +is_custom_alarm_uid_list (ECalComponent *comp, GList *alarms, gchar *old_summary, CalUnits user_units, gint user_interval, gint *alarm_type) { ECalComponentAlarm *ca; gboolean result; @@ -647,7 +647,7 @@ is_custom_alarm_uid_list (ECalComponent *comp, GList *alarms, char *old_summary, } static gboolean -is_custom_alarm_store (EAlarmList *alarm_list_store, char *old_summary, CalUnits user_units, int user_interval, int *alarm_type) +is_custom_alarm_store (EAlarmList *alarm_list_store, gchar *old_summary, CalUnits user_units, gint user_interval, gint *alarm_type) { const ECalComponentAlarm *alarm; GtkTreeModel *model; @@ -704,7 +704,7 @@ event_page_set_view_rsvp (EventPage *epage, gboolean state) } static GtkWidget * -create_image_event_box (const char *image_text, const char *tip_text) +create_image_event_box (const gchar *image_text, const gchar *tip_text) { GtkWidget *image, *box; @@ -870,7 +870,7 @@ get_current_account (EventPage *epage) { EventPagePrivate *priv; EIterator *it; - const char *str; + const gchar *str; priv = epage->priv; @@ -880,7 +880,7 @@ get_current_account (EventPage *epage) for (it = e_list_get_iterator((EList *)priv->accounts); e_iterator_is_valid(it); e_iterator_next(it)) { EAccount *a = (EAccount *)e_iterator_get(it); - char *full = g_strdup_printf("%s <%s>", a->id->name, a->id->address); + gchar *full = g_strdup_printf("%s <%s>", a->id->name, a->id->address); if (!g_ascii_strcasecmp (full, str)) { g_free (full); @@ -909,8 +909,8 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) ECalComponentClassification cl; ECalComponentTransparency transparency; ECalComponentDateTime start_date, end_date; - const char *location, *uid = NULL; - const char *categories; + const gchar *location, *uid = NULL; + const gchar *categories; gchar *backend_addr = NULL; GSList *l; gboolean validated = TRUE; @@ -1088,7 +1088,7 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) if (e_cal_component_has_alarms (comp)) { GList *alarms, *list; - int alarm_type; + gint alarm_type; 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)) @@ -1144,7 +1144,7 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) ECalComponentDateTime start_date, end_date; struct icaltimetype start_tt, end_tt; gboolean all_day_event, start_date_set, end_date_set, busy; - char *cat, *str; + gchar *cat, *str; GtkTextBuffer *text_buffer; GtkTextIter text_iter_start, text_iter_end; @@ -1326,7 +1326,7 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) icalcomp = e_cal_component_alarm_get_icalcomponent (alarm); icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY); while (icalprop) { - const char *x_name; + const gchar *x_name; ECalComponentText summary; x_name = icalproperty_get_x_name (icalprop); @@ -1353,7 +1353,7 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) ECalComponentAlarm *ca; ECalComponentText summary; ECalComponentAlarmTrigger trigger; - int alarm_type; + gint alarm_type; ca = e_cal_component_alarm_new (); @@ -1460,7 +1460,7 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) if (flags & COMP_EDITOR_DELEGATE) { GSList *attendee_list, *l; - int i; + gint i; const GPtrArray *attendees = e_meeting_store_get_attendees (priv->model); e_cal_component_get_attendee_list (priv->comp, &attendee_list); @@ -1534,7 +1534,7 @@ static void time_sel_changed (GtkComboBox *combo, EventPage *epage) { EventPagePrivate *priv; - int selection = gtk_combo_box_get_active (combo); + gint selection = gtk_combo_box_get_active (combo); priv = epage->priv; @@ -1687,8 +1687,8 @@ existing_attendee (EMeetingAttendee *ia, ECalComponent *comp) for (l = attendees; l; l = l->next) { ECalComponentAttendee *attendee = l->data; - const char *address; - const char *sentby = NULL; + const gchar *address; + const gchar *sentby = NULL; address = itip_strip_mailto (attendee->value); if (attendee->sentby) @@ -1711,7 +1711,7 @@ remove_attendee (EventPage *epage, EMeetingAttendee *ia) EventPagePrivate *priv = epage->priv; CompEditor *editor; CompEditorFlags flags; - int pos = 0; + gint pos = 0; gboolean delegate; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage)); @@ -1771,7 +1771,7 @@ remove_clicked_cb (GtkButton *btn, EventPage *epage) GtkTreePath *path = NULL; GtkTreeModel *model = NULL; gboolean valid_iter; - char *address; + gchar *address; priv = epage->priv; @@ -1846,7 +1846,7 @@ attendee_added_cb (EMeetingListView *emlv, 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); + const gchar *delegator_id = e_meeting_attendee_get_delfrom (ia); EMeetingAttendee *delegator; delegator = e_meeting_store_find_attendee (priv->model, delegator_id, NULL); @@ -1865,7 +1865,7 @@ attendee_added_cb (EMeetingListView *emlv, /* Callbacks for list view*/ static void -popup_add_cb (EPopup *ep, EPopupItem *pitem, void *data) +popup_add_cb (EPopup *ep, EPopupItem *pitem, gpointer data) { EventPage *epage = data; @@ -1873,7 +1873,7 @@ popup_add_cb (EPopup *ep, EPopupItem *pitem, void *data) } static void -popup_delete_cb (EPopup *ep, EPopupItem *pitem, void *data) +popup_delete_cb (EPopup *ep, EPopupItem *pitem, gpointer data) { EventPage *epage = data; @@ -1893,7 +1893,7 @@ static EPopupItem context_menu_items[] = { }; static void -context_popup_free(EPopup *ep, GSList *items, void *data) +context_popup_free(EPopup *ep, GSList *items, gpointer data) { g_slist_free(items); } @@ -1908,11 +1908,11 @@ button_press_event (GtkWidget *widget, GdkEventButton *event, EventPage *epage) EMeetingAttendee *ia; GtkTreePath *path; GtkTreeIter iter; - char *address; + gchar *address; guint32 disable_mask = ~0; GSList *menus = NULL; ECalPopup *ep; - int i; + gint i; /* only process right-clicks */ if (event->button != 3 || event->type != GDK_BUTTON_PRESS) @@ -2356,7 +2356,7 @@ check_start_before_end (struct icaltimetype *start_tt, gboolean adjust_end_time) { struct icaltimetype end_tt_copy; - int cmp; + gint cmp; /* Convert the end time to the same timezone as the start time. */ end_tt_copy = *end_tt; @@ -2428,7 +2428,7 @@ times_updated (EventPage *epage, gboolean adjust_end_time) if (all_day_event) { /* All Day Events are simple. We just compare the dates and if start > end we copy one of them to the other. */ - int cmp = icaltime_compare_date_only (start_tt, end_tt); + gint cmp = icaltime_compare_date_only (start_tt, end_tt); if (cmp > 0) { if (adjust_end_time) { end_tt = start_tt; @@ -2640,7 +2640,7 @@ source_changed_cb (ESourceComboBox *source_combo_box, EventPage *epage) } static void -set_subscriber_info_string (EventPage *epage, const char *backend_address) +set_subscriber_info_string (EventPage *epage, const gchar *backend_address) { CompEditor *editor; ECal *client; @@ -2670,7 +2670,7 @@ alarm_changed_cb (GtkWidget *widget, ECalComponentAlarmTrigger trigger; icalcomponent *icalcomp; icalproperty *icalprop; - int alarm_type; + gint alarm_type; ca = e_cal_component_alarm_new (); @@ -2804,7 +2804,7 @@ init_widgets (EventPage *epage) CompEditor *editor; GtkTextBuffer *text_buffer; icaltimezone *zone; - char *combo_label = NULL; + gchar *combo_label = NULL; GtkAction *action; GtkTreeSelection *selection; gboolean active; @@ -3026,7 +3026,7 @@ init_widgets (EventPage *epage) static void -event_page_select_organizer (EventPage *epage, const char *backend_address) +event_page_select_organizer (EventPage *epage, const gchar *backend_address) { EventPagePrivate *priv = epage->priv; CompEditor *editor; @@ -3034,10 +3034,10 @@ event_page_select_organizer (EventPage *epage, const char *backend_address) ECal *client; EAccount *def_account; gchar *def_address = NULL; - const char *default_address; + const gchar *default_address; gboolean subscribed_cal = FALSE; ESource *source = NULL; - const char *user_addr = NULL; + const gchar *user_addr = NULL; def_account = itip_addresses_get_default(); if (def_account && def_account->enabled) @@ -3060,7 +3060,7 @@ event_page_select_organizer (EventPage *epage, const char *backend_address) if (user_addr) for (l = priv->address_strings; l != NULL; l = l->next) if (g_strrstr ((gchar *) l->data, user_addr) != NULL) { - default_address = (const char *) l->data; + default_address = (const gchar *) l->data; break; } @@ -3093,7 +3093,7 @@ event_page_construct (EventPage *epage, EMeetingStore *model) EventPagePrivate *priv; EIterator *it; EAccount *a; - char *gladefile; + gchar *gladefile; priv = epage->priv; g_object_ref (model); @@ -3230,7 +3230,7 @@ static void set_attendees (ECalComponent *comp, const GPtrArray *attendees) { GSList *comp_attendees = NULL, *l; - int i; + gint i; for (i = 0; i < attendees->len; i++) { EMeetingAttendee *ia = g_ptr_array_index (attendees, i); diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index f8ce1bece2..4903f8f29e 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -101,10 +101,10 @@ struct _MemoPagePrivate { }; static void set_subscriber_info_string (MemoPage *mpage, const gchar *backend_address); -static const char * get_recipients (ECalComponent *comp); +static const gchar * 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 memo_page_select_organizer (MemoPage *mpage, const gchar *backend_address); G_DEFINE_TYPE (MemoPage, memo_page, TYPE_COMP_EDITOR_PAGE) @@ -196,7 +196,7 @@ memo_page_fill_widgets (CompEditorPage *page, ECalComponentText text; ECalComponentDateTime d; GSList *l; - const char *categories; + const gchar *categories; gchar *backend_addr = NULL; mpage = MEMO_PAGE (page); @@ -363,7 +363,7 @@ sensitize_widgets (MemoPage *mpage) } /* returns empty string rather than NULL because of simplicity of usage */ -static const char * +static const gchar * get_recipients (ECalComponent *comp) { icalcomponent *icalcomp; @@ -377,7 +377,7 @@ get_recipients (ECalComponent *comp) 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); + const gchar *xname = icalproperty_get_x_name (icalprop); if (xname && strcmp (xname, "X-EVOLUTION-RECIPIENTS") == 0) break; @@ -420,7 +420,7 @@ fill_comp_with_recipients (ENameSelector *name_selector, ECalComponent *comp) ENameSelectorDialog *dialog; EContactStore *c_store; GList *books, *l; - char *uri = e_contact_get (contact, E_CONTACT_BOOK_URI); + gchar *uri = e_contact_get (contact, E_CONTACT_BOOK_URI); dialog = e_name_selector_peek_dialog (name_selector); c_store = dialog->name_selector_model->contact_store; @@ -437,11 +437,11 @@ fill_comp_with_recipients (ENameSelector *name_selector, ECalComponent *comp) if (book) { GList *contacts = NULL; EContact *n_con = NULL; - char *qu; + gchar *qu; EBookQuery *query; qu = g_strdup_printf ("(is \"full_name\" \"%s\")", - (char *) e_contact_get (contact, E_CONTACT_FULL_NAME)); + (gchar *) e_contact_get (contact, E_CONTACT_FULL_NAME)); query = e_book_query_from_string (qu); if (!e_book_get_contacts (book, query, &contacts, NULL)) { @@ -471,7 +471,7 @@ fill_comp_with_recipients (ENameSelector *name_selector, ECalComponent *comp) for (l = list_dests; l; l = l->next) { EDestination *dest = l->data; - const char *name, *attendee = NULL; + const gchar *name, *attendee = NULL; name = e_destination_get_name (dest); @@ -512,7 +512,7 @@ get_current_account (MemoPage *page) { MemoPagePrivate *priv = page->priv; EIterator *it; - const char *str; + const gchar *str; str = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->org_combo)))); if (!str) @@ -520,7 +520,7 @@ get_current_account (MemoPage *page) for (it = e_list_get_iterator((EList *)priv->accounts); e_iterator_is_valid(it); e_iterator_next(it)) { EAccount *a = (EAccount *)e_iterator_get(it); - char *full = g_strdup_printf("%s <%s>", a->id->name, a->id->address); + gchar *full = g_strdup_printf("%s <%s>", a->id->name, a->id->address); if (!g_ascii_strcasecmp (full, str)) { g_free (full); @@ -549,8 +549,8 @@ memo_page_fill_component (CompEditorPage *page, ECalComponentClassification classification; ECalComponentDateTime start_date; struct icaltimetype start_tt; - char *cat, *str; - int i; + gchar *cat, *str; + gint i; GtkTextBuffer *text_buffer; GtkTextIter text_iter_start, text_iter_end; @@ -591,10 +591,10 @@ memo_page_fill_component (CompEditorPage *page, e_cal_component_set_description_list (comp, NULL); } else { - int idxToUse = 1; + gint idxToUse = 1; GSList l; ECalComponentText text, sumText; - char *txt, *p; + gchar *txt, *p; gunichar uc; for(i = 0, p = str, uc = g_utf8_get_char_validated (p, -1); @@ -1022,7 +1022,7 @@ get_to_entry (ENameSelector *name_selector) } static void -memo_page_select_organizer (MemoPage *mpage, const char *backend_address) +memo_page_select_organizer (MemoPage *mpage, const gchar *backend_address) { MemoPagePrivate *priv; CompEditor *editor; @@ -1031,10 +1031,10 @@ memo_page_select_organizer (MemoPage *mpage, const char *backend_address) ECal *client; EAccount *def_account; gchar *def_address = NULL; - const char *default_address; + const gchar *default_address; gboolean subscribed_cal = FALSE; ESource *source = NULL; - const char *user_addr = NULL; + const gchar *user_addr = NULL; def_account = itip_addresses_get_default(); if (def_account && def_account->enabled) @@ -1059,7 +1059,7 @@ memo_page_select_organizer (MemoPage *mpage, const char *backend_address) if (user_addr) for (l = priv->address_strings; l != NULL; l = l->next) if (g_strrstr ((gchar *) l->data, user_addr) != NULL) { - default_address = (const char *) l->data; + default_address = (const gchar *) l->data; break; } @@ -1093,7 +1093,7 @@ memo_page_construct (MemoPage *mpage) CompEditor *editor; CompEditorFlags flags; EIterator *it; - char *gladefile; + gchar *gladefile; EAccount *a; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage)); diff --git a/calendar/gui/dialogs/recur-comp.c b/calendar/gui/dialogs/recur-comp.c index 8d8dabbaf2..1323755cb1 100644 --- a/calendar/gui/dialogs/recur-comp.c +++ b/calendar/gui/dialogs/recur-comp.c @@ -37,7 +37,7 @@ recur_component_dialog (ECal *client, CalObjModType *mod, GtkWindow *parent, gboolean delegated) { - char *str; + gchar *str; GtkWidget *dialog, *rb_this, *rb_prior, *rb_future, *rb_all, *hbox; GtkWidget *placeholder, *vbox; ECalComponentVType vtype; diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index f89993154f..5e24495b5c 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -61,7 +61,7 @@ enum month_num_options { MONTH_NUM_OTHER }; -static const int month_num_options_map[] = { +static const gint month_num_options_map[] = { MONTH_NUM_FIRST, MONTH_NUM_SECOND, MONTH_NUM_THIRD, @@ -83,7 +83,7 @@ enum month_day_options { MONTH_DAY_SUN }; -static const int month_day_options_map[] = { +static const gint month_day_options_map[] = { MONTH_DAY_NTH, MONTH_DAY_MON, MONTH_DAY_TUE, @@ -101,14 +101,14 @@ enum recur_type { RECUR_CUSTOM }; -static const int type_map[] = { +static const gint type_map[] = { RECUR_NONE, RECUR_SIMPLE, RECUR_CUSTOM, -1 }; -static const int freq_map[] = { +static const gint freq_map[] = { ICAL_DAILY_RECURRENCE, ICAL_WEEKLY_RECURRENCE, ICAL_MONTHLY_RECURRENCE, @@ -122,7 +122,7 @@ enum ending_type { ENDING_FOREVER }; -static const int ending_types_map[] = { +static const gint ending_types_map[] = { ENDING_FOR, ENDING_UNTIL, ENDING_FOREVER, @@ -157,7 +157,7 @@ struct _RecurrencePagePrivate { guint8 weekday_blocked_day_mask; /* For monthly recurrences, created by hand */ - int month_index; + gint month_index; GtkWidget *month_day_combo; enum month_day_options month_day; @@ -171,7 +171,7 @@ struct _RecurrencePagePrivate { /* For ending count of occurrences, created by hand */ GtkWidget *ending_count_spin; - int ending_count; + gint ending_count; /* More widgets from the Glade file */ GtkWidget *exception_list; /* This is a GtkTreeView now */ @@ -583,7 +583,7 @@ sensitize_buttons (RecurrencePage *rpage) gint selected_rows; icalcomponent *icalcomp; ECal *client; - const char *uid; + const gchar *uid; if (priv->comp == NULL) return; @@ -639,7 +639,7 @@ sensitize_buttons (RecurrencePage *rpage) * icalrecurrencetype.by_day. Not needed at present. */ static short -nth_weekday (int pos, icalrecurrencetype_weekday weekday) +nth_weekday (gint pos, icalrecurrencetype_weekday weekday) { g_assert (pos > 0 && pos <= 5); @@ -679,7 +679,7 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) case ICAL_WEEKLY_RECURRENCE: { guint8 day_mask; - int i; + gint i; g_return_if_fail (GTK_BIN (priv->special)->child != NULL); g_return_if_fail (priv->weekday_picker != NULL); @@ -976,10 +976,10 @@ make_weekly_special (RecurrencePage *rpage) /* Creates the subtree for the monthly recurrence number */ static void -make_recur_month_num_subtree (GtkTreeStore *store, GtkTreeIter *par, const char *title, int start, int end) +make_recur_month_num_subtree (GtkTreeStore *store, GtkTreeIter *par, const gchar *title, gint start, gint end) { GtkTreeIter iter, parent; - int i; + gint i; gtk_tree_store_append (store, &parent, par); gtk_tree_store_set (store, &parent, 0, _(title), 1, -1, -1); @@ -1004,9 +1004,9 @@ only_leaf_sensitive (GtkCellLayout *cell_layout, } static GtkWidget * -make_recur_month_num_combo (int month_index) +make_recur_month_num_combo (gint month_index) { - static const char *options[] = { + static const gchar *options[] = { /* TRANSLATORS: Entire string is for example: This appointment recurs/Every [x] month(s) on the [first] [Monday] [forever]' * (dropdown menu options are in [square brackets]). This means that after 'first', either the string 'day' or * the name of a week day (like 'Monday' or 'Friday') always follow. @@ -1035,7 +1035,7 @@ make_recur_month_num_combo (int month_index) N_("last") }; - int i; + gint i; GtkTreeStore *store; GtkTreeIter iter; GtkWidget *combo; @@ -1095,7 +1095,7 @@ make_recur_month_num_combo (int month_index) static GtkWidget * make_recur_month_combobox (void) { - static const char *options[] = { + static const gchar *options[] = { /* For Translator : 'day' is part of the sentence of the form 'appointment recurs/Every [x] month(s) on the [first] [day] [forever]' (dropdown menu options are in [square brackets]). This means that after 'first', either the string 'day' or the name of a week day (like 'Monday' or 'Friday') always follow. */ @@ -1110,7 +1110,7 @@ make_recur_month_combobox (void) }; GtkWidget *combo; - int i; + gint i; combo = gtk_combo_box_new_text (); @@ -1313,9 +1313,9 @@ make_recurrence_special (RecurrencePage *rpage) /* Counts the elements in the by_xxx fields of an icalrecurrencetype */ static int -count_by_xxx (short *field, int max_elements) +count_by_xxx (short *field, gint max_elements) { - int i; + gint i; for (i = 0; i < max_elements; i++) if (field[i] == ICAL_RECURRENCE_ARRAY_MAX) @@ -1540,11 +1540,11 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) CompEditorFlags flags; CompEditorPageDates dates; GSList *rrule_list; - int len; + gint len; struct icalrecurrencetype *r; - 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; + gint n_by_second, n_by_minute, n_by_hour; + gint n_by_day, n_by_month_day, n_by_year_day; + gint n_by_week_no, n_by_month, n_by_set_pos; GtkAdjustment *adj; rpage = RECURRENCE_PAGE (page); @@ -1661,7 +1661,7 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) break; case ICAL_WEEKLY_RECURRENCE: { - int i; + gint i; guint8 day_mask; if (n_by_month_day != 0 @@ -1675,7 +1675,7 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) for (i = 0; i < 8 && r->by_day[i] != ICAL_RECURRENCE_ARRAY_MAX; i++) { enum icalrecurrencetype_weekday weekday; - int pos; + gint pos; weekday = icalrecurrencetype_day_day_of_week (r->by_day[i]); pos = icalrecurrencetype_day_position (r->by_day[i]); @@ -1735,7 +1735,7 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) goto custom; if (n_by_month_day == 1) { - int nth; + gint nth; if (n_by_set_pos != 0) goto custom; @@ -1759,7 +1759,7 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) } else if (n_by_day == 1) { enum icalrecurrencetype_weekday weekday; - int pos; + gint pos; enum month_day_options month_day; /* Outlook 2000 uses BYDAY=TU;BYSETPOS=2, and will not @@ -2064,7 +2064,7 @@ type_toggled_cb (GtkToggleButton *toggle, } static GtkWidget * -create_exception_dialog (RecurrencePage *rpage, const char *title, GtkWidget **date_edit) +create_exception_dialog (RecurrencePage *rpage, const gchar *title, GtkWidget **date_edit) { RecurrencePagePrivate *priv; GtkWidget *dialog, *toplevel; @@ -2332,7 +2332,7 @@ recurrence_page_construct (RecurrencePage *rpage) { RecurrencePagePrivate *priv = rpage->priv; CompEditor *editor; - char *gladefile; + gchar *gladefile; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c index 4baa22ab8a..c85ccbb4fe 100644 --- a/calendar/gui/dialogs/schedule-page.c +++ b/calendar/gui/dialogs/schedule-page.c @@ -387,7 +387,7 @@ schedule_page_construct (SchedulePage *spage, EMeetingStore *ems) { SchedulePagePrivate *priv = spage->priv; CompEditor *editor; - char *gladefile; + gchar *gladefile; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (spage)); diff --git a/calendar/gui/dialogs/select-source-dialog.c b/calendar/gui/dialogs/select-source-dialog.c index f73af156b0..462ed7d82a 100644 --- a/calendar/gui/dialogs/select-source-dialog.c +++ b/calendar/gui/dialogs/select-source-dialog.c @@ -40,7 +40,7 @@ select_source_dialog (GtkWindow *parent, ECalSourceType obj_type) GtkWidget *dialog; ESourceList *source_list; ESource *selected_source = NULL; - const char *gconf_key; + const gchar *gconf_key; GConfClient *conf_client; const gchar *icon_name = NULL; @@ -72,12 +72,12 @@ select_source_dialog (GtkWindow *parent, ECalSourceType obj_type) if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) { selected_source = e_source_selector_dialog_peek_primary_selection (E_SOURCE_SELECTOR_DIALOG (dialog)); if (selected_source) { - char *absolute_uri; + gchar *absolute_uri; /* set the absolute URI on the source we keep around, since the group will be unrefed */ absolute_uri = e_source_build_absolute_uri (selected_source); - e_source_set_absolute_uri (selected_source, (const char *) absolute_uri); + e_source_set_absolute_uri (selected_source, (const gchar *) absolute_uri); g_object_ref (selected_source); g_free (absolute_uri); diff --git a/calendar/gui/dialogs/send-comp.c b/calendar/gui/dialogs/send-comp.c index 4eca089435..c11dadf853 100644 --- a/calendar/gui/dialogs/send-comp.c +++ b/calendar/gui/dialogs/send-comp.c @@ -45,7 +45,7 @@ have_nonprocedural_alarm (ECalComponent *comp) ECalComponentAlarm *alarm; ECalComponentAlarmAction action = E_CAL_COMPONENT_ALARM_UNKNOWN; - alarm = e_cal_component_get_alarm (comp, (const char *)l->data); + alarm = e_cal_component_get_alarm (comp, (const gchar *)l->data); if (alarm) { e_cal_component_alarm_get_action (alarm, &action); e_cal_component_alarm_free (alarm); @@ -76,7 +76,7 @@ gboolean send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean new, gboolean *strip_alarms) { ECalComponentVType vtype; - const char *id; + const gchar *id; if (strip_alarms) *strip_alarms = TRUE; @@ -140,7 +140,7 @@ gboolean send_component_prompt_subject (GtkWindow *parent, ECal *client, ECalComponent *comp) { ECalComponentVType vtype; - const char *id; + const gchar *id; vtype = e_cal_component_get_vtype (comp); diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index 95764cde48..67aee1ecab 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -65,7 +65,7 @@ struct _TaskDetailsPagePrivate { }; /* Note that these two arrays must match. */ -static const int status_map[] = { +static const gint status_map[] = { ICAL_STATUS_NONE, ICAL_STATUS_INPROCESS, ICAL_STATUS_COMPLETED, @@ -80,7 +80,7 @@ typedef enum { PRIORITY_UNDEFINED } TaskEditorPriority; -static const int priority_map[] = { +static const gint priority_map[] = { PRIORITY_HIGH, PRIORITY_NORMAL, PRIORITY_LOW, @@ -170,7 +170,7 @@ task_details_page_focus_main_widget (CompEditorPage *page) static TaskEditorPriority -priority_value_to_index (int priority_value) +priority_value_to_index (gint priority_value) { TaskEditorPriority retval; @@ -189,7 +189,7 @@ priority_value_to_index (int priority_value) static int priority_index_to_value (TaskEditorPriority priority) { - int retval; + gint retval; switch (priority) { case PRIORITY_UNDEFINED: @@ -255,10 +255,10 @@ task_details_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) { TaskDetailsPage *tdpage; TaskDetailsPagePrivate *priv; - int *priority_value, *percent = NULL; + gint *priority_value, *percent = NULL; TaskEditorPriority priority; icalproperty_status status; - const char *url; + const gchar *url; struct icaltimetype *completed = NULL; tdpage = TASK_DETAILS_PAGE (page); @@ -345,8 +345,8 @@ task_details_page_fill_component (CompEditorPage *page, ECalComponent *comp) struct icaltimetype icalcomplete, icaltoday; icalproperty_status status; TaskEditorPriority priority; - int priority_value, percent; - char *url; + gint priority_value, percent; + gchar *url; gboolean date_set; icaltimezone *zone = calendar_config_get_icaltimezone (); @@ -712,7 +712,7 @@ task_details_page_construct (TaskDetailsPage *tdpage) { TaskDetailsPagePrivate *priv = tdpage->priv; CompEditor *editor; - char *gladefile; + gchar *gladefile; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tdpage)); diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 8926ac720b..5acc509f8c 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -394,7 +394,7 @@ task_editor_edit_comp (CompEditor *editor, ECalComponent *comp) if (attendees != NULL) { GSList *l; - int row; + gint row; task_page_hide_options (priv->task_page); task_page_set_assignment (priv->task_page, TRUE); diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index a3700f5bf7..90eee6dcf4 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -70,7 +70,7 @@ struct _TaskPagePrivate { EAccountList *accounts; GList *address_strings; EMeetingAttendee *ia; - char *user_add; + gchar *user_add; ECalComponent *comp; /* For meeting/event */ @@ -127,7 +127,7 @@ struct _TaskPagePrivate { ESendOptionsDialog *sod; }; -static const int classification_map[] = { +static const gint classification_map[] = { E_CAL_COMPONENT_CLASS_PUBLIC, E_CAL_COMPONENT_CLASS_PRIVATE, E_CAL_COMPONENT_CLASS_CONFIDENTIAL, @@ -143,8 +143,8 @@ 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_select_organizer (TaskPage *tpage, const char *backend_address); -static void set_subscriber_info_string (TaskPage *tpage, const char *backend_address); +static void task_page_select_organizer (TaskPage *tpage, const gchar *backend_address); +static void set_subscriber_info_string (TaskPage *tpage, const gchar *backend_address); G_DEFINE_TYPE (TaskPage, task_page, TYPE_COMP_EDITOR_PAGE) @@ -414,7 +414,7 @@ get_current_account (TaskPage *page) { TaskPagePrivate *priv; EIterator *it; - const char *str; + const gchar *str; priv = page->priv; @@ -424,7 +424,7 @@ get_current_account (TaskPage *page) for (it = e_list_get_iterator((EList *)priv->accounts); e_iterator_is_valid(it); e_iterator_next(it)) { EAccount *a = (EAccount *)e_iterator_get(it); - char *full = g_strdup_printf("%s <%s>", a->id->name, a->id->address); + gchar *full = g_strdup_printf("%s <%s>", a->id->name, a->id->address); if (!g_ascii_strcasecmp (full, str)) { g_free (full); @@ -455,7 +455,7 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) ECal *client; GSList *l; icalcomponent *icalcomp; - const char *categories, *uid; + const gchar *categories, *uid; icaltimezone *zone, *default_zone; gchar *backend_addr = NULL; gboolean active; @@ -692,7 +692,7 @@ static void set_attendees (ECalComponent *comp, const GPtrArray *attendees) { GSList *comp_attendees = NULL, *l; - int i; + gint i; for (i = 0; i < attendees->len; i++) { EMeetingAttendee *ia = g_ptr_array_index (attendees, i); @@ -724,7 +724,7 @@ task_page_fill_component (CompEditorPage *page, ECalComponent *comp) CompEditorFlags flags; ECal *client; struct icaltimetype start_tt, due_tt; - char *cat, *str; + gchar *cat, *str; gboolean start_date_set, due_date_set, time_set; GtkTextBuffer *text_buffer; GtkTextIter text_iter_start, text_iter_end; @@ -913,7 +913,7 @@ task_page_fill_component (CompEditorPage *page, ECalComponent *comp) if (flags & COMP_EDITOR_DELEGATE ) { GSList *attendee_list, *l; - int i; + gint i; const GPtrArray *attendees = e_meeting_store_get_attendees (priv->model); e_cal_component_get_attendee_list (priv->comp, &attendee_list); @@ -1001,8 +1001,8 @@ existing_attendee (EMeetingAttendee *ia, ECalComponent *comp) for (l = attendees; l; l = l->next) { ECalComponentAttendee *attendee = l->data; - const char *address; - const char *sentby = NULL; + const gchar *address; + const gchar *sentby = NULL; address = itip_strip_mailto (attendee->value); if (attendee->sentby) @@ -1025,7 +1025,7 @@ remove_attendee (TaskPage *page, EMeetingAttendee *ia) TaskPagePrivate *priv = page->priv; CompEditor *editor; CompEditorFlags flags; - int pos = 0; + gint pos = 0; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page)); flags = comp_editor_get_flags (editor); @@ -1082,7 +1082,7 @@ remove_clicked_cb (GtkButton *btn, TaskPage *page) GtkTreePath *path = NULL; GtkTreeModel *model = NULL; gboolean valid_iter; - char *address; + gchar *address; priv = page->priv; @@ -1157,7 +1157,7 @@ attendee_added_cb (EMeetingListView *emlv, 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); + const gchar *delegator_id = e_meeting_attendee_get_delfrom (ia); EMeetingAttendee *delegator; delegator = e_meeting_store_find_attendee (priv->model, delegator_id, NULL); @@ -1176,7 +1176,7 @@ attendee_added_cb (EMeetingListView *emlv, /* Callbacks for list view*/ static void -popup_add_cb (EPopup *ep, EPopupItem *pitem, void *data) +popup_add_cb (EPopup *ep, EPopupItem *pitem, gpointer data) { TaskPage *page = data; @@ -1184,7 +1184,7 @@ popup_add_cb (EPopup *ep, EPopupItem *pitem, void *data) } static void -popup_delete_cb (EPopup *ep, EPopupItem *pitem, void *data) +popup_delete_cb (EPopup *ep, EPopupItem *pitem, gpointer data) { TaskPage *page = data; @@ -1204,7 +1204,7 @@ static EPopupItem context_menu_items[] = { }; static void -context_popup_free(EPopup *ep, GSList *items, void *data) +context_popup_free(EPopup *ep, GSList *items, gpointer data) { g_slist_free(items); } @@ -1219,11 +1219,11 @@ button_press_event (GtkWidget *widget, GdkEventButton *event, TaskPage *page) EMeetingAttendee *ia; GtkTreePath *path; GtkTreeIter iter; - char *address; + gchar *address; guint32 disable_mask = ~0; GSList *menus = NULL; ECalPopup *ep; - int i; + gint i; /* only process right-clicks */ if (event->button != 3 || event->type != GDK_BUTTON_PRESS) @@ -1591,7 +1591,7 @@ check_start_before_end (struct icaltimetype *start_tt, gboolean adjust_by_hour) { struct icaltimetype end_tt_copy; - int cmp; + gint cmp; /* Convert the end time to the same timezone as the start time. */ end_tt_copy = *end_tt; @@ -1783,7 +1783,7 @@ source_changed_cb (ESourceComboBox *source_combo_box, TaskPage *tpage) } static void -set_subscriber_info_string (TaskPage *tpage, const char *backend_address) +set_subscriber_info_string (TaskPage *tpage, const gchar *backend_address) { CompEditor *editor; ECal *client; @@ -1977,18 +1977,18 @@ init_widgets (TaskPage *tpage) static void -task_page_select_organizer (TaskPage *tpage, const char *backend_address) +task_page_select_organizer (TaskPage *tpage, const gchar *backend_address) { TaskPagePrivate *priv = tpage->priv; CompEditor *editor; GList *l; EAccount *def_account; gchar *def_address = NULL; - const char *default_address; + const gchar *default_address; gboolean subscribed_cal = FALSE; ESource *source = NULL; ECal *client; - const char *user_addr = NULL; + const gchar *user_addr = NULL; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage)); client = comp_editor_get_client (editor); @@ -2011,7 +2011,7 @@ task_page_select_organizer (TaskPage *tpage, const char *backend_address) if (user_addr) for (l = priv->address_strings; l != NULL; l = l->next) if (g_strrstr ((gchar *) l->data, user_addr) != NULL) { - default_address = (const char *) l->data; + default_address = (const gchar *) l->data; break; } @@ -2044,7 +2044,7 @@ task_page_construct (TaskPage *tpage, EMeetingStore *model, ECal *client) TaskPagePrivate *priv; EIterator *it; EAccount *a; - char *gladefile; + gchar *gladefile; priv = tpage->priv; g_object_ref (model); -- cgit v1.2.3 From 14f8eee012382f04090ea9277e9567d5f32e8bf0 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 28 May 2009 13:06:29 -0400 Subject: Whitespace cleanup. --- calendar/gui/dialogs/alarm-dialog.c | 8 ++++---- calendar/gui/dialogs/comp-editor.c | 18 +++++++++--------- calendar/gui/dialogs/comp-editor.h | 2 +- calendar/gui/dialogs/e-send-options-utils.c | 2 +- calendar/gui/dialogs/event-editor.c | 6 +++--- calendar/gui/dialogs/event-page.c | 20 ++++++++++---------- calendar/gui/dialogs/event-page.h | 2 +- calendar/gui/dialogs/memo-page.c | 6 +++--- calendar/gui/dialogs/task-editor.c | 2 +- calendar/gui/dialogs/task-page.c | 6 +++--- 10 files changed, 36 insertions(+), 36 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c index ca8a58d528..5284656d1d 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -612,7 +612,7 @@ populate_widgets_from_alarm (Dialog *dialog) /* Alarm Types */ switch ( trigger->type ) { - case E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START: + case E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START: e_dialog_combo_box_set (dialog->time_combo, E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START, time_map); break; @@ -1212,9 +1212,9 @@ alarm_dialog_run (GtkWidget *parent, ECal *ecal, ECalComponentAlarm *alarm) } if (!setup_select_names (&dialog)) { - g_object_unref (dialog.xml); - return FALSE; - } + g_object_unref (dialog.xml); + return FALSE; + } init_widgets (&dialog); diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index c01ca844c9..ff08b7656c 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -116,11 +116,11 @@ struct _CompEditorPrivate { CalObjModType mod; - gboolean existing_org; - gboolean user_org; + gboolean existing_org; + gboolean user_org; gboolean is_group_item; - gboolean warned; + gboolean warned; }; enum { @@ -549,8 +549,8 @@ 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, priv->client))) { - if (e_cal_component_get_vtype (priv->comp) == E_CAL_COMPONENT_JOURNAL) + 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 return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REQUEST, strip_alarms); @@ -561,7 +561,7 @@ save_comp_with_send (CompEditor *editor) if (delegate) return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REPLY, strip_alarms); } - } + } return TRUE; } @@ -2431,9 +2431,9 @@ real_edit_comp (CompEditor *editor, ECalComponent *comp) if (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->client)); - priv->warned = FALSE; + 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->client)); + priv->warned = FALSE; update_window_border (editor, NULL); diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 278501b9ba..6a8f8e4f93 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -151,7 +151,7 @@ GtkAction * comp_editor_get_action (CompEditor *editor, const gchar *action_name); GtkActionGroup * comp_editor_get_action_group (CompEditor *editor, - const gchar *group_name); + const gchar *group_name); GtkWidget * comp_editor_get_managed_widget (CompEditor *editor, const gchar *widget_path); CompEditor * comp_editor_find_instance (const gchar *uid); diff --git a/calendar/gui/dialogs/e-send-options-utils.c b/calendar/gui/dialogs/e-send-options-utils.c index 5af9d4bc43..87f4584133 100644 --- a/calendar/gui/dialogs/e-send-options-utils.c +++ b/calendar/gui/dialogs/e-send-options-utils.c @@ -131,7 +131,7 @@ e_sendoptions_utils_set_default_data (ESendOptionsDialog *sod, ESource *source, sopts->accepted = E_RETURN_NOTIFY_MAIL; } - value = e_source_get_property (source, "return-decline"); + value = e_source_get_property (source, "return-decline"); if (value) { if (!strcmp (value, "none")) sopts->declined = E_RETURN_NOTIFY_NONE; diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index ee34590941..6f0f338bf4 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -323,7 +323,7 @@ event_editor_constructor (GType type, event_page_show_options (priv->event_page); comp_editor_set_group_item (editor, TRUE); - if (!((flags & COMP_EDITOR_USER_ORG) || (flags & COMP_EDITOR_DELEGATE)|| (flags & COMP_EDITOR_NEW_ITEM))) { + if (!((flags & COMP_EDITOR_USER_ORG) || (flags & COMP_EDITOR_DELEGATE)|| (flags & COMP_EDITOR_NEW_ITEM))) { GtkAction *action; action = comp_editor_get_action (editor, "free-busy"); @@ -345,7 +345,7 @@ event_editor_dispose (GObject *object) priv = EVENT_EDITOR_GET_PRIVATE (object); if (priv->event_page) { - g_object_unref (priv->event_page); + g_object_unref (priv->event_page); priv->event_page = NULL; } @@ -697,7 +697,7 @@ event_editor_show_meeting (EventEditor *ee) ee->priv->meeting_shown = TRUE; - comp_editor_set_changed (editor, FALSE); + comp_editor_set_changed (editor, FALSE); comp_editor_set_needs_send (editor, TRUE); } diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 928d159292..29e5e1da76 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -736,7 +736,7 @@ sensitize_widgets (EventPage *epage) priv = epage->priv; if (flags & COMP_EDITOR_MEETING) - sens = flags & COMP_EDITOR_USER_ORG; + sens = flags & COMP_EDITOR_USER_ORG; if (!e_cal_is_read_only (client, &read_only, NULL)) read_only = TRUE; @@ -1567,15 +1567,15 @@ void update_end_time_combo (EventPage *epage) &start_tt.month, &start_tt.day); e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_time), - &start_tt.hour, - &start_tt.minute); + &start_tt.hour, + &start_tt.minute); e_date_edit_get_date (E_DATE_EDIT (priv->end_time), &end_tt.year, &end_tt.month, &end_tt.day); e_date_edit_get_time_of_day (E_DATE_EDIT (priv->end_time), - &end_tt.hour, - &end_tt.minute); + &end_tt.hour, + &end_tt.minute); end_timet = icaltime_as_timet (end_tt); start_timet = icaltime_as_timet (start_tt); @@ -1623,10 +1623,10 @@ hour_minute_changed (EventPage *epage) icaltime_adjust (&end_tt, 0, for_hours, for_minutes, 0); e_date_edit_set_date_and_time_of_day (E_DATE_EDIT (priv->end_time), - end_tt.year, + end_tt.year, end_tt.month, end_tt.day, - end_tt.hour, + end_tt.hour, end_tt.minute); } @@ -1936,8 +1936,8 @@ button_press_event (GtkWidget *widget, GdkEventButton *event, EventPage *epage) gtk_tree_selection_unselect_all (selection); gtk_tree_selection_select_path (selection, path); - if (e_meeting_attendee_get_edit_level (ia) == E_MEETING_ATTENDEE_EDIT_FULL) - disable_mask &= ~ATTENDEE_CAN_DELETE; + if (e_meeting_attendee_get_edit_level (ia) == E_MEETING_ATTENDEE_EDIT_FULL) + disable_mask &= ~ATTENDEE_CAN_DELETE; } } } @@ -3054,7 +3054,7 @@ event_page_select_organizer (EventPage *epage, const gchar *backend_address) if (user_addr) subscribed_cal = TRUE; else - user_addr = (backend_address && *backend_address) ? backend_address : NULL; + user_addr = (backend_address && *backend_address) ? backend_address : NULL; default_address = NULL; if (user_addr) diff --git a/calendar/gui/dialogs/event-page.h b/calendar/gui/dialogs/event-page.h index 5bd377c075..ab43c0f7ba 100644 --- a/calendar/gui/dialogs/event-page.h +++ b/calendar/gui/dialogs/event-page.h @@ -108,7 +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); +void event_page_remove_all_attendees (EventPage *epage); G_END_DECLS diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index 4903f8f29e..4254dce774 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -334,15 +334,15 @@ sensitize_widgets (MemoPage *mpage) read_only = TRUE; if (flags & COMP_EDITOR_IS_SHARED) - sens = flags & COMP_EDITOR_USER_ORG; + 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. - */ + * change in the displayed list causes an 'Account not found' error. + */ 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); diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 5acc509f8c..c74ed46db3 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -406,7 +406,7 @@ task_editor_edit_comp (CompEditor *editor, ECalComponent *comp) ia = E_MEETING_ATTENDEE (e_meeting_attendee_new_from_e_cal_component_attendee (ca)); /* If we aren't the organizer or the attendee is just delegating, don't allow editing */ if (!comp_editor_get_user_org (editor) || e_meeting_attendee_is_set_delto (ia)) - e_meeting_attendee_set_edit_level (ia, E_MEETING_ATTENDEE_EDIT_NONE); + e_meeting_attendee_set_edit_level (ia, E_MEETING_ATTENDEE_EDIT_NONE); task_page_add_attendee (priv->task_page, ia); g_object_unref (ia); diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 90eee6dcf4..3cdbe344e9 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -325,7 +325,7 @@ sensitize_widgets (TaskPage *tpage) read_only = TRUE; if (flags & COMP_EDITOR_IS_ASSIGNED) - sens = flags & COMP_EDITOR_USER_ORG; + sens = flags & COMP_EDITOR_USER_ORG; sensitize = (!read_only && sens); @@ -1247,8 +1247,8 @@ button_press_event (GtkWidget *widget, GdkEventButton *event, TaskPage *page) gtk_tree_selection_unselect_all (selection); gtk_tree_selection_select_path (selection, path); - if (e_meeting_attendee_get_edit_level (ia) == E_MEETING_ATTENDEE_EDIT_FULL) - disable_mask &= ~ATTENDEE_CAN_DELETE; + if (e_meeting_attendee_get_edit_level (ia) == E_MEETING_ATTENDEE_EDIT_FULL) + disable_mask &= ~ATTENDEE_CAN_DELETE; } } } -- cgit v1.2.3 From 433eac7844481b8ceda0bae8bf08f6bb623185b0 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 1 Jun 2009 19:09:19 -0400 Subject: More code cleanup. --- calendar/gui/dialogs/alarm-dialog.c | 2 +- calendar/gui/dialogs/cal-prefs-dialog.c | 2 +- calendar/gui/dialogs/comp-editor.c | 2 +- calendar/gui/dialogs/recurrence-page.c | 4 ++-- calendar/gui/dialogs/task-details-page.c | 2 +- 5 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 5284656d1d..ab411f9e7b 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -1105,7 +1105,7 @@ action_changed_cb (GtkWidget *action_combo, gpointer data) gint page = 0, i; action = e_dialog_combo_box_get (dialog->action_combo, action_map); - for (i = 0; action_map[i] != -1 ; i++) { + for (i = 0; action_map[i] != -1; i++) { if (action == action_map[i]) { page = i; break; diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 9ddd9af6cb..af4c4b8e1a 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -421,7 +421,7 @@ ba_reminder_interval_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) gint value; str = gtk_entry_get_text (GTK_ENTRY (widget)); - value = (int) g_ascii_strtod (str, NULL); + value = (gint) g_ascii_strtod (str, NULL); calendar_config_set_ba_reminder (NULL, &value, NULL); } diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index ff08b7656c..e644a127a9 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -2562,7 +2562,7 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean str num_attachments = e_cal_component_get_num_attachments (send_comp); - for (i = 0; i < num_attachments ; i++) { + for (i = 0; i < num_attachments; i++) { attach_list = g_slist_append (attach_list, g_strdup ("CID:...")); } e_cal_component_set_attachment_list (send_comp, attach_list); diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 5e24495b5c..5fbf69df74 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -643,7 +643,7 @@ nth_weekday (gint pos, icalrecurrencetype_weekday weekday) { g_assert (pos > 0 && pos <= 5); - return (pos << 3) | (int) weekday; + return (pos << 3) | (gint) weekday; } #endif @@ -1312,7 +1312,7 @@ make_recurrence_special (RecurrencePage *rpage) } /* Counts the elements in the by_xxx fields of an icalrecurrencetype */ -static int +static gint count_by_xxx (short *field, gint max_elements) { gint i; diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index 67aee1ecab..eeacc0774f 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -186,7 +186,7 @@ priority_value_to_index (gint priority_value) return retval; } -static int +static gint priority_index_to_value (TaskEditorPriority priority) { gint retval; -- cgit v1.2.3 From abf31aee9f84cc700f9947425bf575165d96c77b Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 14 May 2009 13:39:23 -0400 Subject: =?UTF-8?q?Bug=20581280=20=E2=80=93=20Wrong=20attachment=20name=20?= =?UTF-8?q?in=20event?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calendar/gui/dialogs/comp-editor.c | 220 +++++++++++++++++++++++-------------- 1 file changed, 139 insertions(+), 81 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index e644a127a9..794184d24b 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -205,99 +205,109 @@ attachment_store_changed_cb (CompEditor *editor) comp_editor_set_changed (editor, TRUE); } +static void +attachment_save_finished (EAttachmentStore *store, + GAsyncResult *result, + gpointer user_data) +{ + GtkWidget *dialog; + const gchar *primary_text; + gchar **uris; + GError *error = NULL; + + struct { + gchar **uris; + gboolean done; + GtkWindow *parent; + } *status = user_data; + + uris = e_attachment_store_save_finish (store, result, &error); + + status->uris = uris; + status->done = TRUE; + + if (uris != NULL) + goto exit; + + /* Ignore cancellations. */ + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + goto exit; + + primary_text = _("Could not save attachments"); + + dialog = gtk_message_dialog_new_with_markup ( + status->parent, GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + "%s", primary_text); + + gtk_message_dialog_format_secondary_text ( + GTK_MESSAGE_DIALOG (dialog), "%s", error->message); + + gtk_dialog_run (GTK_DIALOG (dialog)); + + gtk_widget_destroy (dialog); + +exit: + if (error != NULL) + g_error_free (error); + + g_object_unref (status->parent); +} + static GSList * get_attachment_list (CompEditor *editor) { EAttachmentStore *store; EAttachmentView *view; - GtkTreeModel *model; - GtkTreeIter iter; + GFile *destination; GSList *list = NULL; - const gchar *comp_uid = NULL; - const gchar *local_store = e_cal_get_local_attachment_store (editor->priv->client); - gboolean valid; - gint ticker=0; + const char *comp_uid = NULL; + const char *local_store; + gchar *uri; + gint ii; - e_cal_component_get_uid (editor->priv->comp, &comp_uid); + struct { + gchar **uris; + gboolean done; + GtkWindow *parent; + } status; + + status.uris = NULL; + status.done = FALSE; + status.parent = g_object_ref (editor); view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); store = e_attachment_view_get_store (view); - model = GTK_TREE_MODEL (store); - valid = gtk_tree_model_get_iter_first (model, &iter); - - while (valid) { - EAttachment *attachment; - CamelDataWrapper *wrapper; - CamelMimePart *mime_part; - CamelStream *stream; - gchar *attach_file_url; - gchar *safe_fname, *utf8_safe_fname; - gchar *filename; - gint column_id; - - column_id = E_ATTACHMENT_STORE_COLUMN_ATTACHMENT; - gtk_tree_model_get (model, &iter, column_id, &attachment, -1); - mime_part = e_attachment_get_mime_part (attachment); - g_object_unref (attachment); - - valid = gtk_tree_model_iter_next (model, &iter); + local_store = e_cal_get_local_attachment_store (editor->priv->client); + e_cal_component_get_uid (editor->priv->comp, &comp_uid); + uri = g_build_path ("/", local_store, comp_uid, NULL); + destination = g_file_new_for_uri (uri); + g_free (uri); - if (mime_part == NULL) - continue; + e_attachment_store_save_async ( + store, destination, (GAsyncReadyCallback) + attachment_save_finished, &status); - wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part)); + g_object_unref (destination); - /* Extract the content from the stream and write it down - * as a mime part file into the directory denoting the - * calendar source */ - utf8_safe_fname = camel_file_util_safe_filename (camel_mime_part_get_filename (mime_part)); - - /* It is absolutely fine to get a NULL from the filename of - * mime part. We assume that it is named "Attachment" - * in mailer. I'll do that with a ticker */ - if (!utf8_safe_fname) - safe_fname = g_strdup_printf ("%s-%d", _("attachment"), ticker++); - else { - safe_fname = g_filename_from_utf8 ((const gchar *) utf8_safe_fname, -1, NULL, NULL, NULL); - g_free (utf8_safe_fname); - } - filename = g_strdup_printf ("%s-%s", comp_uid, safe_fname); - - attach_file_url = g_build_path ("/", local_store, filename, NULL); - - g_free (filename); - g_free (safe_fname); - - /* do not overwrite existing files, this will result in truncation */ - filename = g_filename_from_uri (attach_file_url, NULL, NULL); - if (!g_file_test (filename, G_FILE_TEST_EXISTS)) { - stream = camel_stream_fs_new_with_name(filename, O_RDWR|O_CREAT|O_TRUNC, 0600); - if (!stream) { - /* TODO handle error conditions */ - g_message ("DEBUG: could not open the file to write\n"); - g_free (attach_file_url); - g_free (filename); - continue; - } + /* We can't return until we have results, so crank + * the main loop until the callback gets triggered. */ + while (!status.done) + gtk_main_iteration (); - if (camel_data_wrapper_decode_to_stream (wrapper, (CamelStream *) stream) == -1) { - g_free (attach_file_url); - camel_stream_close (stream); - camel_object_unref (stream); - g_message ("DEBUG: could not write to file\n"); - } + if (status.uris == NULL) + return NULL; - camel_stream_close (stream); - camel_object_unref (stream); - } - - list = g_slist_append (list, g_strdup (attach_file_url)); - g_free (attach_file_url); - g_free (filename); + /* Transfer the URI strings to the GSList. */ + for (ii = 0; status.uris[ii] != NULL; ii++) { + list = g_slist_prepend (list, status.uris[ii]); + status.uris[ii] = NULL; } - return list; + g_free (status.uris); + + return g_slist_reverse (list); } /* This sets the focus to the toplevel, so any field being edited is committed. @@ -2338,11 +2348,52 @@ comp_editor_get_client (CompEditor *editor) } static void -set_attachment_list (CompEditor *editor, GSList *attach_list) +attachment_loaded_cb (EAttachment *attachment, + GAsyncResult *result, + GtkWindow *parent) +{ + GFileInfo *file_info; + const gchar *display_name; + const gchar *uid; + + /* Prior to 2.27.2, attachment files were named: + * + * '-' + * ------------------------------------- + * (one long filename) + * + * Here we fix the display name if this form is detected so we + * don't show the component UID in the user interface. If the + * user saves changes in the editor, the attachment will be + * written to disk as: + * + * / + * --------------- ----------------- + * (directory) (original name) + * + * So this is a lazy migration from the old form to the new. + */ + + file_info = e_attachment_get_file_info (attachment); + display_name = g_file_info_get_display_name (file_info); + uid = g_object_get_data (G_OBJECT (attachment), "uid"); + + if (g_str_has_prefix (display_name, uid)) { + g_file_info_set_display_name ( + file_info, display_name + strlen (uid) + 1); + g_object_notify (G_OBJECT (attachment), "file-info"); + } + + e_attachment_load_handle_error (attachment, result, parent); +} + +static void +set_attachment_list (CompEditor *editor, GSList *uri_list) { EAttachmentStore *store; EAttachmentView *view; - GSList *iter = NULL; + const gchar *uid = NULL; + GSList *iter; view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); store = e_attachment_view_get_store (view); @@ -2355,15 +2406,22 @@ set_attachment_list (CompEditor *editor, GSList *attach_list) return; } - for (iter = attach_list; iter != NULL; iter = iter->next) { + /* XXX What an awkward API this is. Takes a return location + * for a constant string instead of just returning it. */ + e_cal_component_get_uid (editor->priv->comp, &uid); + + for (iter = uri_list; iter != NULL; iter = iter->next) { EAttachment *attachment; - const gchar *uri = iter->data; - attachment = e_attachment_new_for_uri (uri); + attachment = e_attachment_new_for_uri (iter->data); e_attachment_store_add_attachment (store, attachment); + g_object_set_data_full ( + G_OBJECT (attachment), + "uid", g_strdup (uid), + (GDestroyNotify) g_free); e_attachment_load_async ( attachment, (GAsyncReadyCallback) - e_attachment_load_handle_error, editor); + attachment_loaded_cb, editor); g_object_unref (attachment); } } -- cgit v1.2.3 From dc0ab70f11e998c5d038fe1f078768b8dc071dc7 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 13 Jun 2009 22:06:45 -0400 Subject: Fix coding style. --- 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 794184d24b..268f61ac03 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -261,8 +261,8 @@ get_attachment_list (CompEditor *editor) EAttachmentView *view; GFile *destination; GSList *list = NULL; - const char *comp_uid = NULL; - const char *local_store; + const gchar *comp_uid = NULL; + const gchar *local_store; gchar *uri; gint ii; -- cgit v1.2.3 From 00d56cd32c5d0a7f49567d5241ba0d6fd80940bb Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 18 Jun 2009 10:50:51 -0400 Subject: Use G_BEGIN_DECLS / G_END_DECLS macros. --- calendar/gui/dialogs/calendar-setup.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/calendar-setup.h b/calendar/gui/dialogs/calendar-setup.h index 4ec9980532..d92993c1a6 100644 --- a/calendar/gui/dialogs/calendar-setup.h +++ b/calendar/gui/dialogs/calendar-setup.h @@ -27,10 +27,7 @@ struct _GtkWindow; struct _ESource; -#ifdef __cplusplus -extern "C" { -#pragma } -#endif +G_BEGIN_DECLS void calendar_setup_edit_calendar (struct _GtkWindow *parent, struct _ESource *source, struct _ESourceGroup *group); void calendar_setup_new_calendar (struct _GtkWindow *parent); @@ -41,8 +38,6 @@ void calendar_setup_new_task_list (struct _GtkWindow *parent); void calendar_setup_edit_memo_list (struct _GtkWindow *parent, ESource *source); void calendar_setup_new_memo_list (struct _GtkWindow *parent); -#ifdef __cplusplus -} -#endif +G_END_DECLS #endif /* __CALENDAR_SETUP_H__ */ -- cgit v1.2.3 From c0d998229d5a3d2b65445b9025de7b23112f4063 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 18 Jun 2009 15:26:21 -0400 Subject: Stop abusing forward declarations. --- calendar/gui/dialogs/calendar-setup.c | 18 +++++++++--------- calendar/gui/dialogs/calendar-setup.h | 17 +++++++++-------- 2 files changed, 18 insertions(+), 17 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c index 32fbc9bd68..de7025fd96 100644 --- a/calendar/gui/dialogs/calendar-setup.c +++ b/calendar/gui/dialogs/calendar-setup.c @@ -211,7 +211,7 @@ name_changed (GtkEntry *entry, ECalConfigTargetSource *t) } static GtkWidget * -eccp_get_source_name (EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, struct _GtkWidget *old, gpointer data) +eccp_get_source_name (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data) { static GtkWidget *label, *entry; gint row; @@ -252,7 +252,7 @@ offline_status_changed_cb (GtkWidget *widget, CalendarSourceDialog *sdialog) } static GtkWidget * -eccp_general_offline (EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, struct _GtkWidget *old, gpointer data) +eccp_general_offline (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data) { CalendarSourceDialog *sdialog = data; GtkWidget *offline_setting = NULL; @@ -318,7 +318,7 @@ choose_initial_color (void) } static GtkWidget * -eccp_get_source_color (EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, struct _GtkWidget *old, gpointer data) +eccp_get_source_color (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data) { CalendarSourceDialog *sdialog = data; static GtkWidget *label, *color_button; @@ -431,7 +431,7 @@ cs_load_sources (CalendarSourceDialog *sdialog, const gchar *conf_key, ESourceGr * Show calendar properties for @source. **/ void -calendar_setup_edit_calendar (struct _GtkWindow *parent, ESource *source, ESourceGroup *group) +calendar_setup_edit_calendar (GtkWindow *parent, ESource *source, ESourceGroup *group) { CalendarSourceDialog *sdialog = g_new0 (CalendarSourceDialog, 1); gchar *xml; @@ -482,13 +482,13 @@ calendar_setup_edit_calendar (struct _GtkWindow *parent, ESource *source, ESourc } void -calendar_setup_new_calendar (struct _GtkWindow *parent) +calendar_setup_new_calendar (GtkWindow *parent) { calendar_setup_edit_calendar (parent, NULL, NULL); } void -calendar_setup_edit_task_list (struct _GtkWindow *parent, ESource *source) +calendar_setup_edit_task_list (GtkWindow *parent, ESource *source) { CalendarSourceDialog *sdialog = g_new0 (CalendarSourceDialog, 1); gchar *xml; @@ -538,13 +538,13 @@ calendar_setup_edit_task_list (struct _GtkWindow *parent, ESource *source) } void -calendar_setup_new_task_list (struct _GtkWindow *parent) +calendar_setup_new_task_list (GtkWindow *parent) { calendar_setup_edit_task_list (parent, NULL); } void -calendar_setup_edit_memo_list (struct _GtkWindow *parent, ESource *source) +calendar_setup_edit_memo_list (GtkWindow *parent, ESource *source) { CalendarSourceDialog *sdialog = g_new0 (CalendarSourceDialog, 1); gchar *xml; @@ -594,7 +594,7 @@ calendar_setup_edit_memo_list (struct _GtkWindow *parent, ESource *source) } void -calendar_setup_new_memo_list (struct _GtkWindow *parent) +calendar_setup_new_memo_list (GtkWindow *parent) { calendar_setup_edit_memo_list (parent, NULL); } diff --git a/calendar/gui/dialogs/calendar-setup.h b/calendar/gui/dialogs/calendar-setup.h index d92993c1a6..18dc042848 100644 --- a/calendar/gui/dialogs/calendar-setup.h +++ b/calendar/gui/dialogs/calendar-setup.h @@ -24,19 +24,20 @@ #ifndef __CALENDAR_SETUP_H__ #define __CALENDAR_SETUP_H__ -struct _GtkWindow; -struct _ESource; +#include +#include +#include G_BEGIN_DECLS -void calendar_setup_edit_calendar (struct _GtkWindow *parent, struct _ESource *source, struct _ESourceGroup *group); -void calendar_setup_new_calendar (struct _GtkWindow *parent); +void calendar_setup_edit_calendar (GtkWindow *parent, ESource *source, ESourceGroup *group); +void calendar_setup_new_calendar (GtkWindow *parent); -void calendar_setup_edit_task_list (struct _GtkWindow *parent, struct _ESource *source); -void calendar_setup_new_task_list (struct _GtkWindow *parent); +void calendar_setup_edit_task_list (GtkWindow *parent, ESource *source); +void calendar_setup_new_task_list (GtkWindow *parent); -void calendar_setup_edit_memo_list (struct _GtkWindow *parent, ESource *source); -void calendar_setup_new_memo_list (struct _GtkWindow *parent); +void calendar_setup_edit_memo_list (GtkWindow *parent, ESource *source); +void calendar_setup_new_memo_list (GtkWindow *parent); G_END_DECLS -- cgit v1.2.3 From f4d748a85c534cb8a693b6a1f1b3353adfd73b5b Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 19 Jun 2009 18:43:29 -0400 Subject: Fix similar weak pointer issues throughout. --- calendar/gui/dialogs/comp-editor.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 268f61ac03..64f80b4557 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1314,6 +1314,12 @@ comp_editor_dispose (GObject *object) priv = COMP_EDITOR_GET_PRIVATE (object); + if (priv->shell != NULL) { + g_object_remove_weak_pointer ( + G_OBJECT (priv->shell), &priv->shell); + priv->shell = NULL; + } + if (priv->client) { g_object_unref (priv->client); priv->client = NULL; -- cgit v1.2.3 From bfc5ba2511dc5fd9f5aa9868946c8860afad81bf Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 30 Jun 2009 18:34:08 -0400 Subject: Fix "make distcheck" errors and other build cleanups. --- calendar/gui/dialogs/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am index 8e7a1bf916..a9c752701d 100644 --- a/calendar/gui/dialogs/Makefile.am +++ b/calendar/gui/dialogs/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES = \ +AM_CPPFLAGS = \ -DG_LOG_DOMAIN=\"calendar-gui\" \ -I$(top_srcdir) \ -I$(top_srcdir)/widgets \ -- cgit v1.2.3 From 374bd42f69aca2e132fd854c9619f3d7491f1f96 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 12 Jul 2009 23:33:07 -0400 Subject: Fix excessive whitespace. --- calendar/gui/dialogs/cal-attachment-select-file.c | 1 - calendar/gui/dialogs/cal-prefs-dialog.c | 5 ----- calendar/gui/dialogs/comp-editor-util.c | 5 ----- calendar/gui/dialogs/comp-editor-util.h | 1 - calendar/gui/dialogs/comp-editor.c | 4 ---- calendar/gui/dialogs/comp-editor.h | 1 - calendar/gui/dialogs/e-delegate-dialog.c | 2 -- calendar/gui/dialogs/e-delegate-dialog.h | 2 -- calendar/gui/dialogs/e-send-options-utils.c | 1 - calendar/gui/dialogs/event-page.c | 9 --------- calendar/gui/dialogs/memo-page.c | 1 - calendar/gui/dialogs/recur-comp.c | 1 - calendar/gui/dialogs/recurrence-page.c | 1 - calendar/gui/dialogs/schedule-page.c | 1 - calendar/gui/dialogs/schedule-page.h | 1 - calendar/gui/dialogs/task-details-page.c | 2 -- calendar/gui/dialogs/task-editor.c | 1 - calendar/gui/dialogs/task-page.c | 4 ---- 18 files changed, 43 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 b33753c42e..b303a763ce 100644 --- a/calendar/gui/dialogs/cal-attachment-select-file.c +++ b/calendar/gui/dialogs/cal-attachment-select-file.c @@ -25,7 +25,6 @@ * specific to the calendar component have been flagged by some comments * fwiw */ - #ifdef HAVE_CONFIG_H #include #endif diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index b7b6e33fcf..09f6d104b6 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -59,8 +59,6 @@ static GtkVBoxClass *parent_class = NULL; GtkWidget *cal_prefs_dialog_create_time_edit (void); - - static void calendar_prefs_dialog_finalize (GObject *obj) { @@ -565,7 +563,6 @@ setup_changes (CalendarPrefsDialog *prefs) g_signal_connect (G_OBJECT (prefs->notify_with_tray), "toggled", G_CALLBACK (notify_with_tray_toggled), prefs); g_signal_connect (G_OBJECT (prefs->alarm_list_widget), "selection_changed", G_CALLBACK (alarms_selection_changed), prefs); - g_signal_connect (G_OBJECT (prefs->template_url), "changed", G_CALLBACK (template_url_changed), prefs); } @@ -703,7 +700,6 @@ show_config (CalendarPrefsDialog *prefs) gtk_widget_set_sensitive (prefs->use_12_hour, sensitive); gtk_widget_set_sensitive (prefs->use_24_hour, sensitive); - /* Time Divisions. */ time_divisions = calendar_config_get_time_divisions (); e_dialog_combo_box_set (prefs->time_divisions, time_divisions, time_division_map); @@ -860,7 +856,6 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, prefs->tasks_hide_completed_interval = glade_xml_get_widget (gui, "tasks_hide_completed_interval"); prefs->tasks_hide_completed_units = glade_xml_get_widget (gui, "tasks_hide_completed_units"); - /* Alarms tab */ prefs->notify_with_tray = glade_xml_get_widget (gui, "notify_with_tray"); prefs->scrolled_window = glade_xml_get_widget (gui, "calendar-source-scrolled-window"); diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index e9661db372..e330a7f9d4 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -81,7 +81,6 @@ comp_editor_dates (CompEditorPageDates *dates, ECalComponent *comp) e_cal_component_get_completed (comp, &dates->complete); } - /* This frees the dates in the CompEditorPageDates struct. But it doesn't free * the struct (as that is usually static). */ @@ -109,7 +108,6 @@ comp_editor_free_dates (CompEditorPageDates *dates) e_cal_component_free_icaltimetype (dates->complete); } - /* dtstart is only passed in if tt is the dtend. */ static void write_label_piece (struct icaltimetype *tt, @@ -249,7 +247,6 @@ comp_editor_new_date_edit (gboolean show_date, gboolean show_time, return GTK_WIDGET (dedit); } - /* Returns the current time, for EDateEdit widgets and ECalendar items in the dialogs. FIXME: Should probably use the timezone from somewhere in the component @@ -278,8 +275,6 @@ comp_editor_get_current_time (GtkObject *object, gpointer data) return tmp_tm; } - - /** * comp_editor_strip_categories: * @categories: A string of category names entered by the user. diff --git a/calendar/gui/dialogs/comp-editor-util.h b/calendar/gui/dialogs/comp-editor-util.h index 3bf8921291..c2b5a052a3 100644 --- a/calendar/gui/dialogs/comp-editor-util.h +++ b/calendar/gui/dialogs/comp-editor-util.h @@ -38,7 +38,6 @@ GtkWidget *comp_editor_new_date_edit (gboolean show_date, gboolean show_time, struct tm comp_editor_get_current_time (GtkObject *object, gpointer data); - gchar *comp_editor_strip_categories (const gchar *categories); #endif diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 64f80b4557..3ed798a6f0 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -448,7 +448,6 @@ save_comp (CompEditor *editor) 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); @@ -1813,7 +1812,6 @@ comp_editor_show_help (CompEditor *editor) e_display_help (GTK_WINDOW (editor), class->help_section); } - /* Closes the dialog box and emits the appropriate signals */ static void close_dialog (CompEditor *editor) @@ -2654,7 +2652,6 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean str } - /** * comp_editor_edit_comp: * @editor: A component editor @@ -2791,7 +2788,6 @@ comp_editor_close (CompEditor *editor) return close; } - /* Utility function to get the mime-attachment list from the attachment * bar for sending the comp via itip. The list and its contents must * be freed by the caller. diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 6a8f8e4f93..6753635b1a 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -138,7 +138,6 @@ gboolean comp_editor_send_comp (CompEditor *editor, 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); diff --git a/calendar/gui/dialogs/e-delegate-dialog.c b/calendar/gui/dialogs/e-delegate-dialog.c index 87fb164e6a..284076a7bc 100644 --- a/calendar/gui/dialogs/e-delegate-dialog.c +++ b/calendar/gui/dialogs/e-delegate-dialog.c @@ -114,7 +114,6 @@ e_delegate_dialog_finalize (GObject *object) (* G_OBJECT_CLASS (e_delegate_dialog_parent_class)->finalize) (object); } - EDelegateDialog * e_delegate_dialog_construct (EDelegateDialog *edd, const gchar *name, const gchar *address) { @@ -273,7 +272,6 @@ e_delegate_dialog_get_delegate (EDelegateDialog *edd) return g_strdup (priv->address); } - gchar * e_delegate_dialog_get_delegate_name (EDelegateDialog *edd) { diff --git a/calendar/gui/dialogs/e-delegate-dialog.h b/calendar/gui/dialogs/e-delegate-dialog.h index 6ff872e7e4..a70488a0ea 100644 --- a/calendar/gui/dialogs/e-delegate-dialog.h +++ b/calendar/gui/dialogs/e-delegate-dialog.h @@ -35,7 +35,6 @@ #define E_IS_DELEGATE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_DELEGATE_DIALOG)) #define E_IS_DELEGATE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_DELEGATE_DIALOG)) - typedef struct _EDelegateDialog EDelegateDialog; typedef struct _EDelegateDialogClass EDelegateDialogClass; typedef struct _EDelegateDialogPrivate EDelegateDialogPrivate; @@ -69,7 +68,6 @@ void e_delegate_dialog_set_delegate (EDelegateDialog *etd, GtkWidget* e_delegate_dialog_get_toplevel (EDelegateDialog *etd); - #endif /* __E_DELEGATE_DIALOG_H__ */ diff --git a/calendar/gui/dialogs/e-send-options-utils.c b/calendar/gui/dialogs/e-send-options-utils.c index 87f4584133..c4ed13f2cb 100644 --- a/calendar/gui/dialogs/e-send-options-utils.c +++ b/calendar/gui/dialogs/e-send-options-utils.c @@ -208,7 +208,6 @@ e_sendoptions_utils_fill_component (ESendOptionsDialog *sod, ECalComponent *comp icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-TRACKINFO"); icalcomponent_add_property (icalcomp, prop); - prop = icalproperty_new_x ((const gchar *) g_strdup_printf ("%d", sopts->opened)); icalproperty_set_x_name (prop, "X-EVOLUTION-OPTIONS-OPENED"); icalcomponent_add_property (icalcomp, prop); diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 29e5e1da76..a133904b65 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -1273,7 +1273,6 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) e_cal_component_set_dtstart (comp, &start_date); e_cal_component_set_dtend (comp, &end_date); - /* Categories */ cat = e_dialog_editable_get (priv->categories); @@ -1457,7 +1456,6 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) return FALSE; } - if (flags & COMP_EDITOR_DELEGATE) { GSList *attendee_list, *l; gint i; @@ -1985,7 +1983,6 @@ list_view_event (EMeetingListView *list_view, GdkEvent *event, EventPage *epage) return FALSE; } - static gboolean list_key_press (EMeetingListView *list_view, GdkEventKey *event, EventPage *epage) { @@ -2259,7 +2256,6 @@ get_widgets (EventPage *epage) gtk_container_add (GTK_CONTAINER (sw), GTK_WIDGET (priv->list_view)); gtk_box_pack_start (GTK_BOX (priv->list_box), sw, TRUE, TRUE, 0); - /* Glade's visibility flag doesn't seem to work for custom widgets */ priv->start_time = GW ("start-time"); gtk_widget_show (priv->start_time); @@ -2306,7 +2302,6 @@ summary_changed_cb (GtkEditable *editable, g_free (summary); } - /* Note that this assumes that the start_tt and end_tt passed to it are the dates visible to the user. For DATE values, we have to add 1 day to the end_tt before emitting the signal. */ @@ -2347,7 +2342,6 @@ notify_dates_changed (EventPage *epage, struct icaltimetype *start_tt, &dates); } - static gboolean check_start_before_end (struct icaltimetype *start_tt, icaltimezone *start_zone, @@ -2385,7 +2379,6 @@ check_start_before_end (struct icaltimetype *start_tt, return FALSE; } - /* * This is called whenever the start or end dates or timezones is changed. * It makes sure that the start date < end date. It also emits the notification @@ -2463,7 +2456,6 @@ times_updated (EventPage *epage, gboolean adjust_end_time) } } - if (set_start_date) { g_signal_handlers_block_matched (priv->start_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); e_date_edit_set_date (E_DATE_EDIT (priv->start_time), @@ -2829,7 +2821,6 @@ init_widgets (EventPage *epage) g_signal_connect((priv->summary), "changed", G_CALLBACK (summary_changed_cb), epage); - /* Description */ text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->description)); diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index 4254dce774..fd218a8ec1 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -389,7 +389,6 @@ get_recipients (ECalComponent *comp) return ""; } - static gboolean fill_comp_with_recipients (ENameSelector *name_selector, ECalComponent *comp) { diff --git a/calendar/gui/dialogs/recur-comp.c b/calendar/gui/dialogs/recur-comp.c index 1323755cb1..0d9197546b 100644 --- a/calendar/gui/dialogs/recur-comp.c +++ b/calendar/gui/dialogs/recur-comp.c @@ -68,7 +68,6 @@ recur_component_dialog (ECal *client, return FALSE; } - dialog = gtk_message_dialog_new (parent, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, "%s", str); g_free (str); gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE); diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 5fbf69df74..092a44db15 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -2387,7 +2387,6 @@ recurrence_page_new (CompEditor *editor) return rpage; } - GtkWidget *make_exdate_date_edit (void); GtkWidget * diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c index c85ccbb4fe..712d2708b9 100644 --- a/calendar/gui/dialogs/schedule-page.c +++ b/calendar/gui/dialogs/schedule-page.c @@ -242,7 +242,6 @@ update_time (SchedulePage *spage, ECalComponentDateTime *start_date, ECalCompone } - /* Fills the widgets with default values */ static void clear_widgets (SchedulePage *spage) diff --git a/calendar/gui/dialogs/schedule-page.h b/calendar/gui/dialogs/schedule-page.h index 71eec02763..59b97c754f 100644 --- a/calendar/gui/dialogs/schedule-page.h +++ b/calendar/gui/dialogs/schedule-page.h @@ -64,7 +64,6 @@ struct _SchedulePageClass { CompEditorPageClass parent_class; }; - GType schedule_page_get_type (void); SchedulePage * schedule_page_construct (SchedulePage *mpage, EMeetingStore *ems); diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index eeacc0774f..e6104ee2d0 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -168,7 +168,6 @@ task_details_page_focus_main_widget (CompEditorPage *page) gtk_widget_grab_focus (priv->status_combo); } - static TaskEditorPriority priority_value_to_index (gint priority_value) { @@ -492,7 +491,6 @@ get_widgets (TaskDetailsPage *tdpage) && priv->url); } - static void complete_date_changed (TaskDetailsPage *tdpage, time_t ctime, gboolean complete) { diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index c74ed46db3..2829def666 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -437,7 +437,6 @@ task_editor_edit_comp (CompEditor *editor, ECalComponent *comp) e_meeting_attendee_set_edit_level (ia, E_MEETING_ATTENDEE_EDIT_NONE); } - comp_editor_set_group_item (editor, TRUE); priv->assignment_shown = TRUE; } diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 3cdbe344e9..8a273c2944 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -910,7 +910,6 @@ task_page_fill_component (CompEditorPage *page, ECalComponent *comp) return FALSE; } - if (flags & COMP_EDITOR_DELEGATE ) { GSList *attendee_list, *l; gint i; @@ -982,7 +981,6 @@ static void edit_clicked_cb (GtkButton *btn, TaskPage *tpage) gtk_tree_path_free (path); } - static gboolean existing_attendee (EMeetingAttendee *ia, ECalComponent *comp) { @@ -1296,7 +1294,6 @@ list_view_event (EMeetingListView *list_view, GdkEvent *event, TaskPage *page) { return FALSE; } - static gboolean list_key_press (EMeetingListView *list_view, GdkEventKey *event, TaskPage *page) { @@ -1684,7 +1681,6 @@ times_updated (TaskPage *tpage, gboolean adjust_end_time) set_start_date = TRUE; } - if (set_start_date) { g_signal_handlers_block_matched (priv->start_date, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, tpage); e_date_edit_set_date (E_DATE_EDIT (priv->start_date), start_tt.year, start_tt.month, start_tt.day); -- cgit v1.2.3 From fa360fde289f9b850191f89059d1a5e6d67c07c7 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 18 Jul 2009 14:07:42 -0400 Subject: More whitespace cleanup. --- calendar/gui/dialogs/alarm-dialog.c | 2 +- calendar/gui/dialogs/calendar-setup.c | 2 +- calendar/gui/dialogs/event-page.c | 2 +- calendar/gui/dialogs/memo-page.c | 6 +++--- calendar/gui/dialogs/save-comp.c | 2 +- calendar/gui/dialogs/select-source-dialog.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c index ab411f9e7b..5ac97f7a13 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -623,7 +623,7 @@ populate_widgets_from_alarm (Dialog *dialog) g_warning ("%s: Unexpected alarm type (%d)", G_STRLOC, trigger->type); } - switch ( trigger->u.rel_duration.is_neg ){ + switch ( trigger->u.rel_duration.is_neg ) { case 1: e_dialog_combo_box_set (dialog->relative_combo, BEFORE, relative_map); break; diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c index de7025fd96..9b396ce2cf 100644 --- a/calendar/gui/dialogs/calendar-setup.c +++ b/calendar/gui/dialogs/calendar-setup.c @@ -270,7 +270,7 @@ eccp_general_offline (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidg offline_setting = gtk_check_button_new_with_mnemonic (_("Cop_y calendar contents locally for offline operation")); else if (sdialog->source_type == E_CAL_SOURCE_TYPE_TODO) offline_setting = gtk_check_button_new_with_mnemonic (_("Cop_y task list contents locally for offline operation")); - else if(sdialog->source_type == E_CAL_SOURCE_TYPE_JOURNAL) + else if (sdialog->source_type == E_CAL_SOURCE_TYPE_JOURNAL) offline_setting = gtk_check_button_new_with_mnemonic (_("Cop_y memo list contents locally for offline operation")); gtk_widget_show (offline_setting); diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index a133904b65..ed31badd11 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -1541,7 +1541,7 @@ time_sel_changed (GtkComboBox *combo, EventPage *epage) gtk_widget_show (priv->end_time); hour_sel_changed (GTK_SPIN_BUTTON (priv->hour_selector), epage); minute_sel_changed (GTK_SPIN_BUTTON (priv->minute_selector), epage); - } else if (!selection){ + } else if (!selection) { gtk_widget_show (priv->time_hour); gtk_widget_hide (priv->end_time); diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index fd218a8ec1..1edee08466 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -586,7 +586,7 @@ memo_page_fill_component (CompEditorPage *page, gtk_text_buffer_get_end_iter (text_buffer, &text_iter_end); str = gtk_text_buffer_get_text (text_buffer, &text_iter_start, &text_iter_end, FALSE); - if (!str || strlen (str) == 0){ + if (!str || strlen (str) == 0) { e_cal_component_set_description_list (comp, NULL); } else { @@ -596,7 +596,7 @@ memo_page_fill_component (CompEditorPage *page, gchar *txt, *p; gunichar uc; - for(i = 0, p = str, uc = g_utf8_get_char_validated (p, -1); + for (i = 0, p = str, uc = g_utf8_get_char_validated (p, -1); i < 50 && p && uc < (gunichar)-2; i++, p = g_utf8_next_char (p), uc = g_utf8_get_char_validated (p, -1)) { idxToUse = p - str; @@ -755,7 +755,7 @@ get_widgets (MemoPage *mpage) #define GW(name) glade_xml_get_widget (priv->xml, name) priv->main = GW ("memo-page"); - if (!priv->main){ + if (!priv->main) { g_warning("couldn't find memo-page!"); return FALSE; } diff --git a/calendar/gui/dialogs/save-comp.c b/calendar/gui/dialogs/save-comp.c index 3f47312d22..7284f1d0d5 100644 --- a/calendar/gui/dialogs/save-comp.c +++ b/calendar/gui/dialogs/save-comp.c @@ -45,7 +45,7 @@ save_component_dialog (GtkWindow *parent, ECalComponent *comp) { ECalComponentVType vtype = e_cal_component_get_vtype(comp); - switch(vtype) { + switch (vtype) { case E_CAL_COMPONENT_EVENT: return e_error_run (parent, "calendar:prompt-save-appointment", NULL); case E_CAL_COMPONENT_TODO: diff --git a/calendar/gui/dialogs/select-source-dialog.c b/calendar/gui/dialogs/select-source-dialog.c index 462ed7d82a..bae86827b9 100644 --- a/calendar/gui/dialogs/select-source-dialog.c +++ b/calendar/gui/dialogs/select-source-dialog.c @@ -48,7 +48,7 @@ select_source_dialog (GtkWindow *parent, ECalSourceType obj_type) gconf_key = "/apps/evolution/calendar/sources"; else if (obj_type == E_CAL_SOURCE_TYPE_TODO) gconf_key = "/apps/evolution/tasks/sources"; - else if(obj_type == E_CAL_SOURCE_TYPE_JOURNAL) + else if (obj_type == E_CAL_SOURCE_TYPE_JOURNAL) gconf_key = "/apps/evolution/memos/sources"; else return NULL; -- cgit v1.2.3 From c9e803d8e6d16134cb7feccd5686cff00e171b2b Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 23 Jul 2009 15:07:20 -0400 Subject: Some minor fixes before I dive into calendar again. --- calendar/gui/dialogs/event-editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 6f0f338bf4..e7d602c335 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -670,7 +670,7 @@ event_editor_new (ECal *client, CompEditorFlags flags) { g_return_val_if_fail (E_IS_CAL (client), NULL); - g_return_val_if_fail (E_IS_SHELL (client), NULL); + g_return_val_if_fail (E_IS_SHELL (shell), NULL); return g_object_new ( TYPE_EVENT_EDITOR, -- cgit v1.2.3 From de85e3c7862100da10fe860aef2b651245a1fdbf Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 1 Aug 2009 07:29:41 -0400 Subject: Replace more "config" classes with property bindings. --- calendar/gui/dialogs/cal-prefs-dialog.c | 293 ++++++++++++------------------- calendar/gui/dialogs/cal-prefs-dialog.h | 4 - calendar/gui/dialogs/comp-editor-util.c | 30 ++-- calendar/gui/dialogs/comp-editor-util.h | 7 +- calendar/gui/dialogs/event-page.c | 8 +- calendar/gui/dialogs/memo-page.c | 7 +- calendar/gui/dialogs/recurrence-page.c | 51 ++++-- calendar/gui/dialogs/task-details-page.c | 7 +- calendar/gui/dialogs/task-page.c | 7 +- 9 files changed, 200 insertions(+), 214 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 09f6d104b6..5c56d69007 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -37,10 +37,6 @@ #include #include -static const gint week_start_day_map[] = { - 1, 2, 3, 4, 5, 6, 0, -1 -}; - static const gint time_division_map[] = { 60, 30, 15, 10, 5, -1 }; @@ -98,22 +94,6 @@ eccp_widget_glade (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget return glade_xml_get_widget (prefs->gui, item->label); } -static void -working_days_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) -{ - CalWeekdays working_days = 0; - guint32 mask = 1; - gint day; - - for (day = 0; day < 7; day++) { - if (e_dialog_toggle_get (prefs->working_days[day])) - working_days |= mask; - mask <<= 1; - } - - calendar_config_set_working_days (working_days); -} - static void timezone_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) { @@ -268,27 +248,6 @@ end_of_day_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) calendar_config_set_day_end_hour (end_hour); calendar_config_set_day_end_minute (end_minute); } -static void -week_start_day_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) -{ - gint week_start_day; - - week_start_day = e_dialog_combo_box_get (prefs->week_start_day, week_start_day_map); - calendar_config_set_week_start_day (week_start_day); -} - -static void -use_24_hour_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) -{ - gboolean use_24_hour; - - use_24_hour = gtk_toggle_button_get_active (toggle); - - e_date_edit_set_use_24_hour_format (E_DATE_EDIT (prefs->start_of_day), use_24_hour); - e_date_edit_set_use_24_hour_format (E_DATE_EDIT (prefs->end_of_day), use_24_hour); - - calendar_config_set_24_hour_format (use_24_hour); -} static void time_divisions_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) @@ -299,30 +258,6 @@ time_divisions_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) calendar_config_set_time_divisions (time_divisions); } -static void -show_end_times_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) -{ - calendar_config_set_show_event_end (gtk_toggle_button_get_active (toggle)); -} - -static void -compress_weekend_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) -{ - calendar_config_set_compress_weekend (gtk_toggle_button_get_active (toggle)); -} - -static void -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 month_scroll_by_week_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) { @@ -355,30 +290,6 @@ hide_completed_tasks_units_changed (GtkWidget *widget, CalendarPrefsDialog *pref e_dialog_combo_box_get (prefs->tasks_hide_completed_units, hide_completed_units_map)); } -static void -tasks_due_today_set_color (GtkColorButton *color_button, CalendarPrefsDialog *prefs) -{ - GdkColor color; - - gtk_color_button_get_color (color_button, &color); - calendar_config_set_tasks_due_today_color (&color); -} - -static void -tasks_overdue_set_color (GtkColorButton *color_button, CalendarPrefsDialog *prefs) -{ - GdkColor color; - - gtk_color_button_get_color (color_button, &color); - calendar_config_set_tasks_overdue_color (&color); -} - -static void -confirm_delete_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) -{ - calendar_config_set_confirm_delete (gtk_toggle_button_get_active (toggle)); -} - static void default_reminder_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) { @@ -516,27 +427,14 @@ update_system_tz_widgets (EShellSettings *shell_settings, static void setup_changes (CalendarPrefsDialog *prefs) { - gint i; - - 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->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->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); - g_signal_connect (G_OBJECT (prefs->week_start_day), "changed", G_CALLBACK (week_start_day_changed), prefs); - - g_signal_connect (G_OBJECT (prefs->use_24_hour), "toggled", G_CALLBACK (use_24_hour_toggled), prefs); - g_signal_connect (G_OBJECT (prefs->time_divisions), "changed", G_CALLBACK (time_divisions_changed), 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->month_scroll_by_week), "toggled", G_CALLBACK (month_scroll_by_week_toggled), prefs); g_signal_connect (G_OBJECT (prefs->tasks_hide_completed), "toggled", @@ -544,12 +442,7 @@ setup_changes (CalendarPrefsDialog *prefs) g_signal_connect (G_OBJECT (prefs->tasks_hide_completed_interval), "value-changed", G_CALLBACK (hide_completed_tasks_changed), prefs); g_signal_connect (G_OBJECT (prefs->tasks_hide_completed_units), "changed", G_CALLBACK (hide_completed_tasks_units_changed), prefs); - g_signal_connect (G_OBJECT (prefs->tasks_due_today_color), "color-set", - G_CALLBACK (tasks_due_today_set_color), prefs); - g_signal_connect (G_OBJECT (prefs->tasks_overdue_color), "color-set", - G_CALLBACK (tasks_overdue_set_color), prefs); - g_signal_connect (G_OBJECT (prefs->confirm_delete), "toggled", G_CALLBACK (confirm_delete_toggled), prefs); g_signal_connect (G_OBJECT (prefs->default_reminder), "toggled", G_CALLBACK (default_reminder_toggled), prefs); g_signal_connect (G_OBJECT (prefs->default_reminder_interval), "changed", G_CALLBACK (default_reminder_interval_changed), prefs); @@ -582,19 +475,9 @@ show_fb_config (CalendarPrefsDialog *prefs) static void show_task_list_config (CalendarPrefsDialog *prefs) { - GtkColorButton *color_button; - GdkColor color; CalUnits units; gboolean hide_completed_tasks; - color_button = GTK_COLOR_BUTTON (prefs->tasks_due_today_color); - calendar_config_get_tasks_due_today_color (&color); - gtk_color_button_set_color (color_button, &color); - - color_button = GTK_COLOR_BUTTON (prefs->tasks_overdue_color); - calendar_config_get_tasks_overdue_color (&color); - gtk_color_button_set_color (color_button, &color); - /* Hide Completed Tasks. */ hide_completed_tasks = calendar_config_get_hide_completed_tasks (); e_dialog_toggle_set (prefs->tasks_hide_completed, hide_completed_tasks); @@ -652,8 +535,7 @@ show_alarms_config (CalendarPrefsDialog *prefs) static void show_config (CalendarPrefsDialog *prefs) { - CalWeekdays working_days; - gint mask, day, week_start_day, time_divisions; + gint mask, day, time_divisions; icaltimezone *zone; gboolean sensitive, set = FALSE; gchar *location; @@ -672,50 +554,16 @@ show_config (CalendarPrefsDialog *prefs) /* Day's second zone */ update_day_second_zone_caption (prefs); - /* Working Days. */ - working_days = calendar_config_get_working_days (); - mask = 1 << 0; - for (day = 0; day < 7; day++) { - e_dialog_toggle_set (prefs->working_days[day], (working_days & mask) ? TRUE : FALSE); - mask <<= 1; - } - - /* Week Start Day. */ - week_start_day = calendar_config_get_week_start_day (); - e_dialog_combo_box_set (prefs->week_start_day, week_start_day, week_start_day_map); - /* Start of Day. */ e_date_edit_set_time_of_day (E_DATE_EDIT (prefs->start_of_day), calendar_config_get_day_start_hour (), calendar_config_get_day_start_minute ()); /* End of Day. */ e_date_edit_set_time_of_day (E_DATE_EDIT (prefs->end_of_day), calendar_config_get_day_end_hour (), calendar_config_get_day_end_minute ()); - /* 12/24 Hour Format. */ - if (calendar_config_get_24_hour_format ()) - e_dialog_toggle_set (prefs->use_24_hour, TRUE); - else - e_dialog_toggle_set (prefs->use_12_hour, TRUE); - - sensitive = calendar_config_locale_supports_12_hour_format (); - gtk_widget_set_sensitive (prefs->use_12_hour, sensitive); - gtk_widget_set_sensitive (prefs->use_24_hour, sensitive); - /* Time Divisions. */ time_divisions = calendar_config_get_time_divisions (); e_dialog_combo_box_set (prefs->time_divisions, time_divisions, time_division_map); - /* Show Appointment End Times. */ - e_dialog_toggle_set (prefs->show_end_times, calendar_config_get_show_event_end ()); - - /* Compress Weekend. */ - e_dialog_toggle_set (prefs->compress_weekend, calendar_config_get_compress_weekend ()); - - /* 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 ()); - /* Month View - Scroll by a week */ e_dialog_toggle_set (prefs->month_scroll_by_week, calendar_config_get_month_scroll_by_week ()); @@ -729,7 +577,6 @@ show_config (CalendarPrefsDialog *prefs) show_fb_config (prefs); /* Other page */ - e_dialog_toggle_set (prefs->confirm_delete, calendar_config_get_confirm_delete ()); 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); @@ -771,23 +618,18 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, ECalConfig *ec; ECalConfigTargetPrefs *target; EShellSettings *shell_settings; + gboolean locale_supports_12_hour_format; gint i; GtkWidget *toplevel; GtkWidget *widget; GSList *l; - const gchar *working_day_names[] = { - "sun_button", - "mon_button", - "tue_button", - "wed_button", - "thu_button", - "fri_button", - "sat_button", - }; gchar *gladefile; shell_settings = e_shell_get_shell_settings (shell); + locale_supports_12_hour_format = + calendar_config_locale_supports_12_hour_format (); + gladefile = g_build_filename (EVOLUTION_GLADEDIR, "cal-prefs-dialog.glade", NULL); @@ -828,14 +670,78 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, 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++) - 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"); - prefs->start_of_day = glade_xml_get_widget (gui, "start_of_day"); - prefs->end_of_day = glade_xml_get_widget (gui, "end_of_day"); - prefs->use_12_hour = glade_xml_get_widget (gui, "use_12_hour"); - prefs->use_24_hour = glade_xml_get_widget (gui, "use_24_hour"); - prefs->confirm_delete = glade_xml_get_widget (gui, "confirm_delete"); + + widget = glade_xml_get_widget (gui, "sun_button"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-working-days-sunday", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "mon_button"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-working-days-monday", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "tue_button"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-working-days-tuesday", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "wed_button"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-working-days-wednesday", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "thu_button"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-working-days-thursday", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "fri_button"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-working-days-friday", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "sat_button"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-working-days-saturday", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "week_start_day"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-week-start-day", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "start_of_day"); + prefs->start_of_day = widget; /* XXX delete this */ + if (locale_supports_12_hour_format) + e_binding_new ( + G_OBJECT (shell_settings), "cal-use-24-hour-format", + G_OBJECT (widget), "use-24-hour-format"); + + widget = glade_xml_get_widget (gui, "end_of_day"); + prefs->end_of_day = widget; /* XXX delete this */ + if (locale_supports_12_hour_format) + e_binding_new ( + G_OBJECT (shell_settings), "cal-use-24-hour-format", + G_OBJECT (widget), "use-24-hour-format"); + + widget = glade_xml_get_widget (gui, "use_12_hour"); + gtk_widget_set_sensitive (widget, locale_supports_12_hour_format); + e_mutual_binding_new_with_negation ( + G_OBJECT (shell_settings), "cal-use-24-hour-format", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "use_24_hour"); + gtk_widget_set_sensitive (widget, locale_supports_12_hour_format); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-use-24-hour-format", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "confirm_delete"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-confirm-delete", + G_OBJECT (widget), "active"); + 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"); @@ -845,13 +751,45 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, /* Display tab */ prefs->time_divisions = glade_xml_get_widget (gui, "time_divisions"); - 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"); + + widget = glade_xml_get_widget (gui, "show_end_times"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-show-event-end-times", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "compress_weekend"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-compress-weekend", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "dnav_show_week_no"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-date-navigator-show-week-numbers", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "dview_show_week_no"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-day-view-show-week-numbers", + G_OBJECT (widget), "active"); + prefs->month_scroll_by_week = glade_xml_get_widget (gui, "month_scroll_by_week"); - 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"); + + widget = glade_xml_get_widget (gui, "tasks_due_today_color"); + e_mutual_binding_new_full ( + G_OBJECT (shell_settings), "cal-tasks-color-due-today", + G_OBJECT (widget), "color", + e_binding_transform_string_to_color, + e_binding_transform_color_to_string, + (GDestroyNotify) NULL, NULL); + + widget = glade_xml_get_widget (gui, "tasks_overdue_color"); + e_mutual_binding_new_full ( + G_OBJECT (shell_settings), "cal-tasks-color-overdue", + G_OBJECT (widget), "color", + e_binding_transform_string_to_color, + e_binding_transform_color_to_string, + (GDestroyNotify) NULL, NULL); + prefs->tasks_hide_completed = glade_xml_get_widget (gui, "tasks_hide_completed"); prefs->tasks_hide_completed_interval = glade_xml_get_widget (gui, "tasks_hide_completed_interval"); prefs->tasks_hide_completed_units = glade_xml_get_widget (gui, "tasks_hide_completed_units"); @@ -918,7 +856,6 @@ cal_prefs_dialog_create_time_edit (void) dedit = e_date_edit_new (); gtk_widget_show (GTK_WIDGET (dedit)); - e_date_edit_set_use_24_hour_format (E_DATE_EDIT (dedit), calendar_config_get_24_hour_format ()); e_date_edit_set_time_popup_range (E_DATE_EDIT (dedit), 0, 24); e_date_edit_set_show_date (E_DATE_EDIT (dedit), FALSE); diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 0889a395bf..5d0a3716a6 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -69,8 +69,6 @@ struct _CalendarPrefsDialog { GtkWidget *week_start_day; GtkWidget *start_of_day; GtkWidget *end_of_day; - GtkWidget *use_12_hour; - GtkWidget *use_24_hour; GtkWidget *confirm_delete; GtkWidget *default_reminder; GtkWidget *default_reminder_interval; @@ -86,8 +84,6 @@ struct _CalendarPrefsDialog { GtkWidget *dnav_show_week_no; GtkWidget *dview_show_week_no; GtkWidget *month_scroll_by_week; - GtkWidget *tasks_due_today_color; - GtkWidget *tasks_overdue_color; GtkWidget *tasks_hide_completed; GtkWidget *tasks_hide_completed_interval; GtkWidget *tasks_hide_completed_units; diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index e330a7f9d4..cfe4139708 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -32,8 +32,9 @@ #include #include #include +#include "e-util/e-binding.h" +#include "widgets/misc/e-dateedit.h" #include "../calendar-config.h" -#include "../e-date-edit-config.h" #include "comp-editor-util.h" @@ -204,16 +205,9 @@ comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label) gtk_label_set_text (GTK_LABEL (label), buffer); } -static void -date_edit_destroy_cb (EDateEdit *date_edit, gpointer data) -{ - EDateEditConfig *config = data; - - g_object_unref (config); -} - /** * comp_editor_new_date_edit: + * @shell_settings: an #EShellSettings * @show_date: Whether to show a date picker in the widget. * @show_time: Whether to show a time picker in the widget. * @make_time_insensitive: Whether the time field is made insensitive rather @@ -225,11 +219,14 @@ date_edit_destroy_cb (EDateEdit *date_edit, gpointer data) * Return value: A newly-created #EDateEdit widget. **/ GtkWidget * -comp_editor_new_date_edit (gboolean show_date, gboolean show_time, - gboolean make_time_insensitive) +comp_editor_new_date_edit (EShellSettings *shell_settings, + gboolean show_date, + gboolean show_time, + gboolean make_time_insensitive) { EDateEdit *dedit; - EDateEditConfig *config; + + g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), NULL); dedit = E_DATE_EDIT (e_date_edit_new ()); @@ -241,8 +238,13 @@ comp_editor_new_date_edit (gboolean show_date, gboolean show_time, e_date_edit_set_make_time_insensitive (dedit, FALSE); #endif - config = e_date_edit_config_new (dedit); - g_signal_connect (G_OBJECT (dedit), "destroy", G_CALLBACK (date_edit_destroy_cb), config); + e_binding_new ( + G_OBJECT (shell_settings), "cal-date-navigator-show-week-numbers", + G_OBJECT (dedit), "show-week-numbers"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-week-start-day", + G_OBJECT (dedit), "week-start-day"); return GTK_WIDGET (dedit); } diff --git a/calendar/gui/dialogs/comp-editor-util.h b/calendar/gui/dialogs/comp-editor-util.h index c2b5a052a3..96638aabd0 100644 --- a/calendar/gui/dialogs/comp-editor-util.h +++ b/calendar/gui/dialogs/comp-editor-util.h @@ -26,6 +26,7 @@ #define _COMP_EDITOR_UTIL_H_ #include +#include #include "comp-editor-page.h" void comp_editor_dates (CompEditorPageDates *date, ECalComponent *comp); @@ -33,8 +34,10 @@ void comp_editor_free_dates (CompEditorPageDates *dates); void comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label); -GtkWidget *comp_editor_new_date_edit (gboolean show_date, gboolean show_time, - gboolean make_time_insensitive); +GtkWidget * comp_editor_new_date_edit (EShellSettings *shell_settings, + gboolean show_date, + gboolean show_time, + gboolean make_time_insensitive); struct tm comp_editor_get_current_time (GtkObject *object, gpointer data); diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index ed31badd11..de62e687a8 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -3173,7 +3173,13 @@ GtkWidget *make_date_edit (void); GtkWidget * make_date_edit (void) { - return comp_editor_new_date_edit (TRUE, TRUE, TRUE); + EShell *shell; + EShellSettings *shell_settings; + + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + + return comp_editor_new_date_edit (shell_settings, TRUE, TRUE, TRUE); } GtkWidget *make_timezone_entry (void); diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index 1edee08466..a510328af6 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -1201,9 +1201,14 @@ GtkWidget *memo_page_create_date_edit (void); GtkWidget * memo_page_create_date_edit (void) { + EShell *shell; + EShellSettings *shell_settings; GtkWidget *widget; - widget = comp_editor_new_date_edit (TRUE, FALSE, TRUE); + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + + widget = comp_editor_new_date_edit (shell_settings, TRUE, FALSE, TRUE); e_date_edit_set_allow_no_date_set (E_DATE_EDIT (widget), TRUE); gtk_widget_show (widget); diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 092a44db15..66f21522b5 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -44,7 +45,6 @@ #include "../weekday-picker.h" #include "comp-editor-util.h" #include "../e-date-time-list.h" -#include "../e-mini-calendar-config.h" #include "recurrence-page.h" #define RECURRENCE_PAGE_GET_PRIVATE(obj) \ @@ -186,7 +186,6 @@ struct _RecurrencePagePrivate { /* For the recurrence preview, the actual widget */ GtkWidget *preview_calendar; - EMiniCalendarConfig *preview_calendar_config; }; @@ -321,11 +320,6 @@ recurrence_page_dispose (GObject *object) priv->exception_list_store = NULL; } - if (priv->preview_calendar_config != NULL) { - g_object_unref (priv->preview_calendar_config); - priv->preview_calendar_config = NULL; - } - /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (recurrence_page_parent_class)->dispose (object); } @@ -1329,6 +1323,8 @@ static void make_ending_until_special (RecurrencePage *rpage) { RecurrencePagePrivate *priv = rpage->priv; + EShell *shell; + EShellSettings *shell_settings; CompEditor *editor; CompEditorFlags flags; EDateEdit *de; @@ -1340,10 +1336,13 @@ make_ending_until_special (RecurrencePage *rpage) editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); flags = comp_editor_get_flags (editor); + shell = comp_editor_get_shell (editor); + shell_settings = e_shell_get_shell_settings (shell); + /* Create the widget */ - priv->ending_date_edit = comp_editor_new_date_edit (TRUE, FALSE, - FALSE); + priv->ending_date_edit = comp_editor_new_date_edit ( + shell_settings, TRUE, FALSE, FALSE); de = E_DATE_EDIT (priv->ending_date_edit); gtk_container_add (GTK_CONTAINER (priv->ending_special), @@ -2068,9 +2067,16 @@ create_exception_dialog (RecurrencePage *rpage, const gchar *title, GtkWidget ** { RecurrencePagePrivate *priv; GtkWidget *dialog, *toplevel; + CompEditor *editor; + EShell *shell; + EShellSettings *shell_settings; priv = rpage->priv; + editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); + shell = comp_editor_get_shell (editor); + shell_settings = e_shell_get_shell_settings (shell); + toplevel = gtk_widget_get_toplevel (priv->main); dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (toplevel), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, @@ -2078,7 +2084,7 @@ create_exception_dialog (RecurrencePage *rpage, const gchar *title, GtkWidget ** GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - *date_edit = comp_editor_new_date_edit (TRUE, FALSE, TRUE); + *date_edit = comp_editor_new_date_edit (shell_settings, TRUE, FALSE, TRUE); gtk_widget_show (*date_edit); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), *date_edit, FALSE, TRUE, 6); @@ -2234,6 +2240,9 @@ static void init_widgets (RecurrencePage *rpage) { RecurrencePagePrivate *priv; + EShell *shell; + EShellSettings *shell_settings; + CompEditor *editor; ECalendar *ecal; GtkAdjustment *adj; GtkTreeViewColumn *column; @@ -2241,11 +2250,23 @@ init_widgets (RecurrencePage *rpage) priv = rpage->priv; + editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); + shell = comp_editor_get_shell (editor); + shell_settings = e_shell_get_shell_settings (shell); + /* Recurrence preview */ priv->preview_calendar = e_calendar_new (); ecal = E_CALENDAR (priv->preview_calendar); - priv->preview_calendar_config = e_mini_calendar_config_new (ecal); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-date-navigator-show-week-numbers", + G_OBJECT (ecal->calitem), "show-week-numbers"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-week-start-day", + G_OBJECT (ecal->calitem), "week-start-day"); + g_signal_connect((ecal->calitem), "date_range_changed", G_CALLBACK (preview_date_range_changed_cb), rpage); @@ -2392,6 +2413,12 @@ GtkWidget *make_exdate_date_edit (void); GtkWidget * make_exdate_date_edit (void) { - return comp_editor_new_date_edit (TRUE, TRUE, FALSE); + EShell *shell; + EShellSettings *shell_settings; + + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + + return comp_editor_new_date_edit (shell_settings, TRUE, TRUE, FALSE); } diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index e6104ee2d0..38faa99c0b 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -768,9 +768,14 @@ GtkWidget *task_details_page_create_date_edit (void); GtkWidget * task_details_page_create_date_edit (void) { + EShell *shell; + EShellSettings *shell_settings; GtkWidget *dedit; - dedit = comp_editor_new_date_edit (TRUE, TRUE, FALSE); + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + + dedit = comp_editor_new_date_edit (shell_settings, TRUE, TRUE, FALSE); e_date_edit_set_allow_no_date_set (E_DATE_EDIT (dedit), TRUE); return dedit; diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 8a273c2944..08bcedc7e7 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -2150,9 +2150,14 @@ GtkWidget *task_page_create_date_edit (void); GtkWidget * task_page_create_date_edit (void) { + EShell *shell; + EShellSettings *shell_settings; GtkWidget *dedit; - dedit = comp_editor_new_date_edit (TRUE, TRUE, TRUE); + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + + dedit = comp_editor_new_date_edit (shell_settings, TRUE, TRUE, TRUE); e_date_edit_set_allow_no_date_set (E_DATE_EDIT (dedit), TRUE); return dedit; -- cgit v1.2.3 From 3b0699fc304d0f4aecb261d19869de221f5d6abf Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 7 Aug 2009 21:43:09 -0400 Subject: More refactoring of settings management. --- calendar/gui/dialogs/cal-prefs-dialog.c | 52 +++++---------------------------- calendar/gui/dialogs/cal-prefs-dialog.h | 1 - calendar/gui/dialogs/comp-editor-util.c | 2 +- calendar/gui/dialogs/event-editor.c | 41 +++++++++++++++++--------- calendar/gui/dialogs/recurrence-page.c | 2 +- calendar/gui/dialogs/schedule-page.c | 18 +++++++++++- calendar/gui/dialogs/task-editor.c | 41 +++++++++++++++++--------- 7 files changed, 81 insertions(+), 76 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 5c56d69007..8f22c98569 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -94,16 +94,6 @@ eccp_widget_glade (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget return glade_xml_get_widget (prefs->gui, item->label); } -static void -timezone_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) -{ - icaltimezone *zone; - - zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (prefs->timezone)); - - calendar_config_set_timezone (icaltimezone_get_location (zone)); -} - static void update_day_second_zone_caption (CalendarPrefsDialog *prefs) { @@ -401,12 +391,6 @@ alarms_selection_changed (ESourceSelector *selector, CalendarPrefsDialog *prefs) e_source_list_sync (source_list, NULL); } -static void -template_url_changed (GtkEntry *entry, CalendarPrefsDialog *prefs) -{ - calendar_config_set_free_busy_template (gtk_entry_get_text (entry)); -} - static void update_system_tz_widgets (EShellSettings *shell_settings, GParamSpec *pspec, @@ -427,7 +411,6 @@ update_system_tz_widgets (EShellSettings *shell_settings, static void 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->start_of_day), "changed", G_CALLBACK (start_of_day_changed), prefs); @@ -455,20 +438,6 @@ setup_changes (CalendarPrefsDialog *prefs) g_signal_connect (G_OBJECT (prefs->notify_with_tray), "toggled", G_CALLBACK (notify_with_tray_toggled), prefs); g_signal_connect (G_OBJECT (prefs->alarm_list_widget), "selection_changed", G_CALLBACK (alarms_selection_changed), prefs); - - g_signal_connect (G_OBJECT (prefs->template_url), "changed", G_CALLBACK (template_url_changed), prefs); -} - -/* Shows the current Free/Busy settings in the dialog */ -static void -show_fb_config (CalendarPrefsDialog *prefs) -{ - gchar *template_url; - - template_url = calendar_config_get_free_busy_template (); - gtk_entry_set_text (GTK_ENTRY (prefs->template_url), (template_url ? template_url : "")); - - g_free (template_url); } /* Shows the current task list settings in the dialog */ @@ -538,16 +507,9 @@ show_config (CalendarPrefsDialog *prefs) gint mask, day, time_divisions; icaltimezone *zone; gboolean sensitive, set = FALSE; - gchar *location; CalUnits units; gint interval; - /* 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); - /* Day's second zone */ update_day_second_zone_caption (prefs); @@ -573,9 +535,6 @@ show_config (CalendarPrefsDialog *prefs) /* Alarms list*/ show_alarms_config (prefs); - /* Free/Busy */ - show_fb_config (prefs); - /* Other page */ 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 ()); @@ -662,13 +621,15 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, G_CALLBACK (update_system_tz_widgets), prefs); widget = glade_xml_get_widget (gui, "timezone"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-timezone", + G_OBJECT (widget), "timezone"); e_mutual_binding_new_with_negation ( G_OBJECT (shell_settings), "cal-use-system-timezone", G_OBJECT (widget), "sensitive"); /* General tab */ 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"); widget = glade_xml_get_widget (gui, "sun_button"); @@ -764,7 +725,7 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, widget = glade_xml_get_widget (gui, "dnav_show_week_no"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "cal-date-navigator-show-week-numbers", + G_OBJECT (shell_settings), "cal-show-week-numbers", G_OBJECT (widget), "active"); widget = glade_xml_get_widget (gui, "dview_show_week_no"); @@ -799,7 +760,10 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, prefs->scrolled_window = glade_xml_get_widget (gui, "calendar-source-scrolled-window"); /* Free/Busy tab */ - prefs->template_url = glade_xml_get_widget (gui, "template_url"); + widget = glade_xml_get_widget (gui, "template_url"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-free-busy-template", + G_OBJECT (widget), "text"); target = e_cal_config_target_new_prefs (ec, prefs->gconf); e_config_set_target ((EConfig *)ec, (EConfigTarget *) target); toplevel = e_config_create_widget ((EConfig *)ec); diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 5d0a3716a6..ceaa379474 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -63,7 +63,6 @@ struct _CalendarPrefsDialog { /* General tab */ GtkWidget *system_tz_label; - GtkWidget *timezone; GtkWidget *day_second_zone; GtkWidget *working_days[7]; GtkWidget *week_start_day; diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index cfe4139708..697e8bda7f 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -239,7 +239,7 @@ comp_editor_new_date_edit (EShellSettings *shell_settings, #endif e_binding_new ( - G_OBJECT (shell_settings), "cal-date-navigator-show-week-numbers", + G_OBJECT (shell_settings), "cal-show-week-numbers", G_OBJECT (dedit), "show-week-numbers"); e_binding_new ( diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index e7d602c335..94006a961c 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -247,15 +247,6 @@ static GtkActionEntry meeting_entries[] = { G_CALLBACK (action_free_busy_cb) } }; -static void -event_editor_client_changed_cb (EventEditor *ee) -{ - ECal *client; - - client = comp_editor_get_client (COMP_EDITOR (ee)); - e_meeting_store_set_e_cal (ee->priv->model, client); -} - static void event_editor_model_changed_cb (EventEditor *ee) { @@ -368,6 +359,31 @@ event_editor_dispose (GObject *object) G_OBJECT_CLASS (event_editor_parent_class)->dispose (object); } +static void +event_editor_constructed (GObject *object) +{ + EventEditorPrivate *priv; + EShellSettings *shell_settings; + EShell *shell; + + priv = EVENT_EDITOR_GET_PRIVATE (object); + + shell = comp_editor_get_shell (COMP_EDITOR (object)); + shell_settings = e_shell_get_shell_settings (shell); + + e_binding_new ( + G_OBJECT (object), "client", + G_OBJECT (priv->model), "client"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-free-busy-template", + G_OBJECT (priv->model), "free-busy-template"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-timezone", + G_OBJECT (priv->model), "timezone"); +} + static void event_editor_show_categories (CompEditor *editor, gboolean visible) @@ -445,6 +461,7 @@ event_editor_class_init (EventEditorClass *class) object_class = G_OBJECT_CLASS (class); object_class->constructor = event_editor_constructor; object_class->dispose = event_editor_dispose; + object_class->constructed = event_editor_constructed; editor_class = COMP_EDITOR_CLASS (class); editor_class->help_section = "usage-calendar-apts"; @@ -502,10 +519,6 @@ event_editor_init (EventEditor *ee) action = comp_editor_get_action (editor, "send-options"); gtk_action_set_visible (action, FALSE); - g_signal_connect ( - ee, "notify::client", - G_CALLBACK (event_editor_client_changed_cb), NULL); - g_signal_connect_swapped ( ee->priv->model, "row_changed", G_CALLBACK (event_editor_model_changed_cb), ee); @@ -640,7 +653,7 @@ event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboo ECal *client; gboolean result; - client = e_meeting_store_get_e_cal (priv->model); + client = e_meeting_store_get_client (priv->model); result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL, NULL, NULL, strip_alarms); g_object_unref (comp); diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 66f21522b5..bd9152afc7 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -2260,7 +2260,7 @@ init_widgets (RecurrencePage *rpage) ecal = E_CALENDAR (priv->preview_calendar); e_binding_new ( - G_OBJECT (shell_settings), "cal-date-navigator-show-week-numbers", + G_OBJECT (shell_settings), "cal-show-week-numbers", G_OBJECT (ecal->calitem), "show-week-numbers"); e_binding_new ( diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c index 712d2708b9..979e182a8c 100644 --- a/calendar/gui/dialogs/schedule-page.c +++ b/calendar/gui/dialogs/schedule-page.c @@ -218,7 +218,7 @@ update_time (SchedulePage *spage, ECalComponentDateTime *start_date, ECalCompone if (start_zone != end_zone) { icaltimezone_convert_time (&end_tt, end_zone, start_zone); } - e_meeting_store_set_zone (priv->model, priv->zone); + e_meeting_store_set_timezone (priv->model, priv->zone); all_day = (start_tt.is_date && end_tt.is_date) ? TRUE : FALSE; @@ -385,10 +385,14 @@ SchedulePage * schedule_page_construct (SchedulePage *spage, EMeetingStore *ems) { SchedulePagePrivate *priv = spage->priv; + EShellSettings *shell_settings; + EShell *shell; CompEditor *editor; gchar *gladefile; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (spage)); + shell = comp_editor_get_shell (editor); + shell_settings = e_shell_get_shell_settings (shell); gladefile = g_build_filename (EVOLUTION_GLADEDIR, "schedule-page.glade", @@ -423,6 +427,18 @@ schedule_page_construct (SchedulePage *spage, EMeetingStore *ems) gtk_widget_show (GTK_WIDGET (priv->sel)); gtk_box_pack_start (GTK_BOX (priv->main), GTK_WIDGET (priv->sel), TRUE, TRUE, 6); + e_binding_new ( + G_OBJECT (shell_settings), "cal-show-week-numbers", + G_OBJECT (priv->sel), "show-week-numbers"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-use-24-hour-format", + G_OBJECT (priv->sel), "use-24-hour-format"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-week-start-day", + G_OBJECT (priv->sel), "week-start-day"); + if (!init_widgets (spage)) { g_message ("schedule_page_construct(): " "Could not initialize the widgets!"); diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 2829def666..a309a51d91 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -125,15 +125,6 @@ static GtkActionEntry assigned_task_entries[] = { G_CALLBACK (action_send_options_cb) } }; -static void -task_editor_client_changed_cb (TaskEditor *te) -{ - ECal *client; - - client = comp_editor_get_client (COMP_EDITOR (te)); - e_meeting_store_set_e_cal (te->priv->model, client); -} - static void task_editor_model_changed_cb (TaskEditor *te) { @@ -207,6 +198,31 @@ task_editor_dispose (GObject *object) G_OBJECT_CLASS (task_editor_parent_class)->dispose (object); } +static void +task_editor_constructed (GObject *object) +{ + TaskEditorPrivate *priv; + EShellSettings *shell_settings; + EShell *shell; + + priv = TASK_EDITOR_GET_PRIVATE (object); + + shell = comp_editor_get_shell (COMP_EDITOR (object)); + shell_settings = e_shell_get_shell_settings (shell); + + e_binding_new ( + G_OBJECT (object), "client", + G_OBJECT (priv->model), "client"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-free-busy-template", + G_OBJECT (priv->model), "free-busy-template"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-timezone", + G_OBJECT (priv->model), "timezone"); +} + static void task_editor_show_categories (CompEditor *editor, gboolean visible) @@ -284,6 +300,7 @@ task_editor_class_init (TaskEditorClass *class) object_class = G_OBJECT_CLASS (class); object_class->constructor = task_editor_constructor; object_class->dispose = task_editor_dispose; + object_class->constructed = task_editor_constructed; editor_class = COMP_EDITOR_CLASS (class); editor_class->help_section = "usage-calendar-todo"; @@ -356,10 +373,6 @@ task_editor_init (TaskEditor *te) g_error_free (error); } - 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); @@ -465,7 +478,7 @@ task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gbool ECal *client; gboolean result; - client = e_meeting_store_get_e_cal (priv->model); + client = e_meeting_store_get_client (priv->model); result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL, NULL, NULL, strip_alarms); g_object_unref (comp); -- cgit v1.2.3 From 78c34e905d5689f72276c323cc06c12fc65d9cc1 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 28 Jul 2009 19:56:11 +0200 Subject: Bug #314599 - Recurrence Tab Should Not Default To Forever --- 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 bd9152afc7..272be77cd9 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -431,7 +431,7 @@ clear_widgets (RecurrencePage *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; + priv->ending_count = calendar_config_get_default_count (); 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, -- cgit v1.2.3 From 854c2cd5c84a7c6a38ecf2fc86efb6e474aa32fa Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 30 Jul 2009 11:31:14 +0200 Subject: Bug #273535 - Meeting request with attachments has bogus CID value --- calendar/gui/dialogs/comp-editor.c | 24 ++++++++++++++++-------- 1 file changed, 16 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 7aa242f18e..6f74f73248 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -2618,19 +2618,24 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean str } } else { /* Clone the component with attachments set to CID:... */ - gint num_attachments, i; GSList *attach_list = NULL; - GSList *mime_attach_list; + GSList *mime_attach_list, *attach; - num_attachments = e_cal_component_get_num_attachments (send_comp); + /* mime_attach_list is freed by itip_send_comp */ + mime_attach_list = comp_editor_get_mime_attach_list (editor); + + for (attach = mime_attach_list; attach; attach = attach->next) { + struct CalMimeAttach *cma = (struct CalMimeAttach *) attach->data; - for (i = 0; i < num_attachments; i++) { - attach_list = g_slist_append (attach_list, g_strdup ("CID:...")); + attach_list = g_slist_append (attach_list, cma->content_id); + } + + if (attach_list) { + e_cal_component_set_attachment_list (send_comp, attach_list); + + g_slist_free (attach_list); } - e_cal_component_set_attachment_list (send_comp, attach_list); - /* 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, strip_alarms)) { gboolean saved = save_comp (editor); @@ -2835,6 +2840,8 @@ comp_editor_get_mime_attach_list (CompEditor *editor) camel_data_wrapper_decode_to_stream (wrapper, (CamelStream *) mstream); buffer = g_memdup (mstream->buffer->data, mstream->buffer->len); + camel_mime_part_set_content_id (mime_part, NULL); + cal_mime_attach->encoded_data = (gchar *)buffer; cal_mime_attach->length = mstream->buffer->len; cal_mime_attach->filename = g_strdup (camel_mime_part_get_filename (mime_part)); @@ -2843,6 +2850,7 @@ comp_editor_get_mime_attach_list (CompEditor *editor) desc = _("attachment"); cal_mime_attach->description = g_strdup (desc); cal_mime_attach->content_type = g_strdup (camel_data_wrapper_get_mime_type (wrapper)); + cal_mime_attach->content_id = g_strdup (camel_mime_part_get_content_id (mime_part)); disp = camel_mime_part_get_disposition (mime_part); if (disp && !g_ascii_strcasecmp(disp, "inline")) -- cgit v1.2.3 From b00f5d61da4b67b2c2569f6868b7b87879f9dc4e Mon Sep 17 00:00:00 2001 From: Marcel Stimberg Date: Fri, 31 Jul 2009 14:17:41 +0200 Subject: Bug #328361 - Support for "Fifth Sunday *of the month*" --- calendar/gui/dialogs/recurrence-page.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 272be77cd9..4368e98209 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -56,6 +56,7 @@ enum month_num_options { MONTH_NUM_SECOND, MONTH_NUM_THIRD, MONTH_NUM_FOURTH, + MONTH_NUM_FIFTH, MONTH_NUM_LAST, MONTH_NUM_DAY, MONTH_NUM_OTHER @@ -66,6 +67,7 @@ static const gint month_num_options_map[] = { MONTH_NUM_SECOND, MONTH_NUM_THIRD, MONTH_NUM_FOURTH, + MONTH_NUM_FIFTH, MONTH_NUM_LAST, MONTH_NUM_DAY, MONTH_NUM_OTHER, @@ -1022,6 +1024,11 @@ make_recur_month_num_combo (gint month_index) * the name of a week day (like 'Monday' or 'Friday') always follow. */ N_("fourth"), + /* TRANSLATORS: Entire string is for example: This appointment recurs/Every [x] month(s) on the [fifth] [Monday] [forever]' + * (dropdown menu options are in [square brackets]). This means that after 'fifth', either the string 'day' or + * the name of a week day (like 'Monday' or 'Friday') always follow. + */ + N_("fifth"), /* TRANSLATORS: Entire string is for example: This appointment recurs/Every [x] month(s) on the [last] [Monday] [forever]' * (dropdown menu options are in [square brackets]). This means that after 'last', either the string 'day' or * the name of a week day (like 'Monday' or 'Friday') always follow. -- cgit v1.2.3 From 8d32cc325ad6ce115c683342b7741816a69f41fa Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 3 Aug 2009 13:32:55 +0200 Subject: Bug #314599 - Recurrence Tab Should Not Default To Forever Added a GConf schema key definition. Special value, -1, means forever. --- calendar/gui/dialogs/recurrence-page.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 4368e98209..ca53a41737 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -437,9 +437,11 @@ clear_widgets (RecurrencePage *rpage) 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, + priv->ending_count == -1 ? ENDING_FOREVER : ENDING_FOR, ending_types_map); g_signal_handlers_unblock_matched (priv->ending_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); + if (priv->ending_count == -1) + priv->ending_count = 2; make_ending_special (rpage); /* Exceptions list */ e_date_time_list_clear (priv->exception_list_store); -- cgit v1.2.3 From 1295772b1ee9c3c106d1418884f6874d9ca06714 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 3 Aug 2009 18:13:25 +0200 Subject: Bug #320071 - Unclear why you can't edit appointment in calendar --- calendar/gui/dialogs/event-page.c | 30 +++++++++++++++++++++++++----- calendar/gui/dialogs/memo-page.c | 30 +++++++++++++++++++++++++----- calendar/gui/dialogs/task-page.c | 31 ++++++++++++++++++++++++++----- 3 files changed, 76 insertions(+), 15 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index de62e687a8..caafdf1ab1 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -104,6 +104,7 @@ struct _EventPagePrivate { GtkWidget *info_hbox; GtkWidget *info_icon; GtkWidget *info_string; + gchar *subscriber_info_text; GtkWidget *summary; GtkWidget *summary_label; @@ -262,6 +263,7 @@ event_page_finalize (GObject *object) g_ptr_array_free (priv->deleted_attendees, TRUE); g_free (priv->old_summary); + g_free (priv->subscriber_info_text); priv->alarm_list_dlg_widget = NULL; @@ -745,6 +747,18 @@ sensitize_widgets (EventPage *epage) sensitize = !read_only && sens; + if (read_only) { + gchar *tmp = g_strconcat ("", _("Event cannot be edited, because the selected calendar is read only"), "", NULL); + event_page_set_info_string (epage, GTK_STOCK_DIALOG_INFO, tmp); + g_free (tmp); + } else if (!sens) { + gchar *tmp = g_strconcat ("", _("Event cannot be fully edited, because you are not the organizer"), "", NULL); + event_page_set_info_string (epage, GTK_STOCK_DIALOG_INFO, tmp); + g_free (tmp); + } else { + event_page_set_info_string (epage, priv->subscriber_info_text ? GTK_STOCK_DIALOG_INFO : NULL, priv->subscriber_info_text); + } + alarm = e_dialog_combo_box_get (priv->alarm_time_combo, priv->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_combo_box_get (priv->alarm_time_combo, priv->alarm_map) == ALARM_CUSTOM ? TRUE:FALSE; @@ -2161,7 +2175,7 @@ event_page_set_info_string (EventPage *epage, const gchar *icon, const gchar *ms priv = epage->priv; gtk_image_set_from_stock (GTK_IMAGE (priv->info_icon), icon, GTK_ICON_SIZE_BUTTON); - gtk_label_set_text (GTK_LABEL(priv->info_string), msg); + gtk_label_set_markup (GTK_LABEL(priv->info_string), msg); if (msg && icon) gtk_widget_show (priv->info_hbox); @@ -2642,13 +2656,19 @@ set_subscriber_info_string (EventPage *epage, const gchar *backend_address) client = comp_editor_get_client (editor); source = e_cal_get_source (client); - if (e_source_get_property (source, "subscriber")) + if (e_source_get_property (source, "subscriber")) { + g_free (epage->priv->subscriber_info_text); /* Translators: This string is used when we are creating an Event (meeting or appointment) on behalf of some other user */ - event_page_set_info_string (epage, GTK_STOCK_DIALOG_INFO, - g_strdup_printf(_("You are acting on behalf of %s"), backend_address)); - else + epage->priv->subscriber_info_text = g_markup_printf_escaped (_("You are acting on behalf of %s"), backend_address); + + event_page_set_info_string (epage, GTK_STOCK_DIALOG_INFO, epage->priv->subscriber_info_text); + } else { + g_free (epage->priv->subscriber_info_text); + epage->priv->subscriber_info_text = NULL; + event_page_set_info_string (epage, NULL, NULL); + } } static void diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index a510328af6..8e1c2b233b 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -72,6 +72,7 @@ struct _MemoPagePrivate { GtkWidget *info_hbox; GtkWidget *info_icon; GtkWidget *info_string; + gchar *subscriber_info_text; /* Organizer */ GtkWidget *org_label; @@ -163,6 +164,8 @@ memo_page_finalize (GObject *object) priv->xml = NULL; } + g_free (priv->subscriber_info_text); + /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (memo_page_parent_class)->finalize (object); } @@ -340,6 +343,18 @@ sensitize_widgets (MemoPage *mpage) sensitize = (!read_only && sens); + if (read_only) { + gchar *tmp = g_strconcat ("", _("Memo cannot be edited, because the selected memo list is read only"), "", NULL); + memo_page_set_info_string (mpage, GTK_STOCK_DIALOG_INFO, tmp); + g_free (tmp); + } else if (!sens) { + gchar *tmp = g_strconcat ("", _("Memo cannot be fully edited, because you are not the organizer"), "", NULL); + memo_page_set_info_string (mpage, GTK_STOCK_DIALOG_INFO, tmp); + g_free (tmp); + } else { + memo_page_set_info_string (mpage, priv->subscriber_info_text ? GTK_STOCK_DIALOG_INFO : NULL, priv->subscriber_info_text); + } + /* The list of organizers is set to be non-editable. Otherwise any * change in the displayed list causes an 'Account not found' error. */ @@ -732,7 +747,7 @@ memo_page_set_info_string (MemoPage *mpage, const gchar *icon, const gchar *msg) priv = mpage->priv; gtk_image_set_from_stock (GTK_IMAGE (priv->info_icon), icon, GTK_ICON_SIZE_BUTTON); - gtk_label_set_text (GTK_LABEL(priv->info_string), msg); + gtk_label_set_markup (GTK_LABEL(priv->info_string), msg); if (msg && icon) gtk_widget_show (priv->info_hbox); @@ -888,13 +903,18 @@ set_subscriber_info_string (MemoPage *mpage, client = comp_editor_get_client (editor); source = e_cal_get_source (client); - if (e_source_get_property (source, "subscriber")) + if (e_source_get_property (source, "subscriber")) { + g_free (mpage->priv->subscriber_info_text); /* Translators: This string is used when we are creating a Memo on behalf of some other user */ - memo_page_set_info_string (mpage, GTK_STOCK_DIALOG_INFO, - g_strdup_printf(_("You are acting on behalf of %s"), backend_address)); - else + mpage->priv->subscriber_info_text = g_markup_printf_escaped (_("You are acting on behalf of %s"), backend_address); + memo_page_set_info_string (mpage, GTK_STOCK_DIALOG_INFO, mpage->priv->subscriber_info_text); + } else { + g_free (mpage->priv->subscriber_info_text); + mpage->priv->subscriber_info_text = NULL; + memo_page_set_info_string (mpage, NULL, NULL); + } } static void diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 08bcedc7e7..2e60ff5069 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -85,6 +85,7 @@ struct _TaskPagePrivate { GtkWidget *info_hbox; GtkWidget *info_icon; GtkWidget *info_string; + gchar *subscriber_info_text; GtkWidget *summary; GtkWidget *summary_label; @@ -193,6 +194,8 @@ task_page_finalize (GObject *object) priv->deleted_attendees, (GFunc) g_object_unref, NULL); g_ptr_array_free (priv->deleted_attendees, TRUE); + g_free (priv->subscriber_info_text); + /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (task_page_parent_class)->finalize (object); } @@ -329,6 +332,18 @@ sensitize_widgets (TaskPage *tpage) sensitize = (!read_only && sens); + if (read_only) { + gchar *tmp = g_strconcat ("", _("Task cannot be edited, because the selected task list is read only"), "", NULL); + task_page_set_info_string (tpage, GTK_STOCK_DIALOG_INFO, tmp); + g_free (tmp); + } else if (!sens) { + gchar *tmp = g_strconcat ("", _("Task cannot be fully edited, because you are not the organizer"), "", NULL); + task_page_set_info_string (tpage, GTK_STOCK_DIALOG_INFO, tmp); + g_free (tmp); + } else { + task_page_set_info_string (tpage, priv->subscriber_info_text ? GTK_STOCK_DIALOG_INFO : NULL, priv->subscriber_info_text); + } + /* The list of organizers is set to be non-editable. Otherwise any * change in the displayed list causes an 'Account not found' error. */ @@ -1366,7 +1381,7 @@ task_page_set_info_string (TaskPage *tpage, const gchar *icon, const gchar *msg) priv = tpage->priv; gtk_image_set_from_stock (GTK_IMAGE (priv->info_icon), icon, GTK_ICON_SIZE_BUTTON); - gtk_label_set_text (GTK_LABEL(priv->info_string), msg); + gtk_label_set_markup (GTK_LABEL(priv->info_string), msg); if (msg && icon) gtk_widget_show (priv->info_hbox); @@ -1789,13 +1804,19 @@ set_subscriber_info_string (TaskPage *tpage, const gchar *backend_address) client = comp_editor_get_client (editor); source = e_cal_get_source (client); - if (e_source_get_property (source, "subscriber")) + if (e_source_get_property (source, "subscriber")) { + g_free (tpage->priv->subscriber_info_text); /* Translators: This string is used when we are creating a Task on behalf of some other user */ - task_page_set_info_string (tpage, GTK_STOCK_DIALOG_INFO, - g_strdup_printf(_("You are acting on behalf of %s"), backend_address)); - else + tpage->priv->subscriber_info_text = g_markup_printf_escaped (_("You are acting on behalf of %s"), backend_address); + + task_page_set_info_string (tpage, GTK_STOCK_DIALOG_INFO, tpage->priv->subscriber_info_text); + } else { + g_free (tpage->priv->subscriber_info_text); + tpage->priv->subscriber_info_text = NULL; + task_page_set_info_string (tpage, NULL, NULL); + } } void -- cgit v1.2.3 From 5e5e1de764de6b705c12275dc652b1a36ba98fdd Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 27 Jul 2009 17:34:13 +0200 Subject: Bug #420513 - Be able to notify about meeting only new attendees --- calendar/gui/dialogs/comp-editor-util.c | 132 ++++++++++++++++++++++++++++++++ calendar/gui/dialogs/comp-editor-util.h | 6 ++ calendar/gui/dialogs/comp-editor.c | 23 ++++-- calendar/gui/dialogs/comp-editor.h | 3 +- calendar/gui/dialogs/event-editor.c | 5 +- calendar/gui/dialogs/event-page.c | 15 +++- calendar/gui/dialogs/send-comp.c | 81 ++++++++++++++------ calendar/gui/dialogs/send-comp.h | 2 +- calendar/gui/dialogs/task-editor.c | 2 +- calendar/gui/dialogs/task-page.c | 10 ++- 10 files changed, 240 insertions(+), 39 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index 697e8bda7f..d8e05ca0df 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -35,6 +35,8 @@ #include "e-util/e-binding.h" #include "widgets/misc/e-dateedit.h" #include "../calendar-config.h" +#include "../e-date-edit-config.h" +#include "../itip-utils.h" #include "comp-editor-util.h" @@ -347,3 +349,133 @@ comp_editor_strip_categories (const gchar *categories) return new_categories; } + +static GSList * +manage_new_attendees (const GSList *lst, const gchar *eml, gboolean add) +{ + GSList *copy = NULL; + const GSList *l; + gboolean found = FALSE; + + g_return_val_if_fail (eml != NULL, NULL); + + for (l = lst; l; l = l->next) { + const gchar *eml2 = l->data; + + if (!eml2) + continue; + + if (g_ascii_strcasecmp (eml, eml2) == 0) { + found = TRUE; + if (add) + copy = g_slist_append (copy, g_strdup (eml2)); + } else { + copy = g_slist_append (copy, g_strdup (eml2)); + } + } + + if (!found && add) { + copy = g_slist_append (copy, g_strdup (eml)); + } + + return copy; +} + +static void +free_slist_strs (gpointer data) +{ + GSList *lst = data; + + if (lst) { + g_slist_foreach (lst, (GFunc) g_free, NULL); + g_slist_free (lst); + } +} + +/** + * comp_editor_manage_new_attendees: + * Manages the 'new-attendees' string of new attendees of the component. + * @param comp: The component. + * @param ma: An attendee. + * @param add: TRUE to add attendee's email to new-attendees, FALSE to remove from it. + * + * @note The list is just string of emails separated by ';' + **/ +void +comp_editor_manage_new_attendees (ECalComponent *comp, EMeetingAttendee *ma, gboolean add) +{ + const gchar *eml; + + g_return_if_fail (comp != NULL); + g_return_if_fail (ma != NULL); + + eml = e_meeting_attendee_get_address (ma); + if (eml) + eml = itip_strip_mailto (eml); + g_return_if_fail (eml != NULL); + + g_object_set_data_full (G_OBJECT (comp), "new-attendees", manage_new_attendees (g_object_get_data (G_OBJECT (comp), "new-attendees"), eml, add), free_slist_strs); +} + +/** + * comp_editor_copy_new_attendees: + * Copies "new-attendees" information from src to des component. + * @param des: Component, to copy to. + * @param src: Component, to copy from. + **/ +void +comp_editor_copy_new_attendees (ECalComponent *des, ECalComponent *src) +{ + GSList *copy = NULL, *l; + + g_return_if_fail (src != NULL); + g_return_if_fail (des != NULL); + + for (l = g_object_get_data (G_OBJECT (src), "new-attendees"); l; l = l->next) { + copy = g_slist_append (copy, g_strdup (l->data)); + } + + g_object_set_data_full (G_OBJECT (des), "new-attendees", copy, free_slist_strs); +} + +/** + * comp_editor_have_in_new_attendees: + * @param comp: Component with the "new-attendees" possibly set. + * @param ma: Meeting attendee to check. + * @return Whether ma is present in the list of new attendees of the comp. + **/ +gboolean +comp_editor_have_in_new_attendees (ECalComponent *comp, EMeetingAttendee *ma) +{ + const gchar *eml; + + g_return_val_if_fail (comp != NULL, FALSE); + g_return_val_if_fail (ma != NULL, FALSE); + + eml = e_meeting_attendee_get_address (ma); + if (eml) + eml = itip_strip_mailto (eml); + g_return_val_if_fail (eml != NULL, FALSE); + + return comp_editor_have_in_new_attendees_lst (g_object_get_data (G_OBJECT (comp), "new-attendees"), eml); +} + +/** + * comp_editor_have_in_new_attendees_lst: + * Same as @ref comp_editor_have_in_new_attendees only parameters are direct GSList and string. + **/ +gboolean +comp_editor_have_in_new_attendees_lst (const GSList *new_attendees, const gchar *eml) +{ + const GSList *l; + + if (!eml) + return FALSE; + + for (l = new_attendees; l; l = l->next) { + if (l->data && g_ascii_strcasecmp (eml, l->data) == 0) + return TRUE; + } + + return FALSE; +} diff --git a/calendar/gui/dialogs/comp-editor-util.h b/calendar/gui/dialogs/comp-editor-util.h index 96638aabd0..ec481fa457 100644 --- a/calendar/gui/dialogs/comp-editor-util.h +++ b/calendar/gui/dialogs/comp-editor-util.h @@ -28,6 +28,7 @@ #include #include #include "comp-editor-page.h" +#include "../e-meeting-attendee.h" void comp_editor_dates (CompEditorPageDates *date, ECalComponent *comp); void comp_editor_free_dates (CompEditorPageDates *dates); @@ -43,4 +44,9 @@ struct tm comp_editor_get_current_time (GtkObject *object, gpointer data); gchar *comp_editor_strip_categories (const gchar *categories); +void comp_editor_manage_new_attendees (ECalComponent *comp, EMeetingAttendee *ma, gboolean add); +void comp_editor_copy_new_attendees (ECalComponent *des, ECalComponent *src); +gboolean comp_editor_have_in_new_attendees (ECalComponent *comp, EMeetingAttendee *ma); +gboolean comp_editor_have_in_new_attendees_lst (const GSList *new_attendees, const gchar *eml); + #endif diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 6f74f73248..100a1615fb 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -60,6 +60,7 @@ #include "cancel-comp.h" #include "recur-comp.h" #include "comp-editor.h" +#include "comp-editor-util.h" #include "../e-cal-popup.h" #include "../calendar-config-keys.h" #include "cal-attachment-select-file.h" @@ -406,6 +407,7 @@ save_comp (CompEditor *editor) timezones = g_hash_table_new (g_str_hash, g_str_equal); clone = e_cal_component_clone (priv->comp); + comp_editor_copy_new_attendees (clone, priv->comp); for (l = priv->pages; l != NULL; l = l->next) { if (!comp_editor_page_fill_component (l->data, clone)) { g_object_unref (clone); @@ -535,7 +537,7 @@ save_comp_with_send (CompEditor *editor) { CompEditorPrivate *priv; CompEditorFlags flags; - gboolean send; + gboolean send, delegated, only_new_attendees = FALSE; gboolean delegate; gboolean strip_alarms = TRUE; @@ -557,7 +559,13 @@ 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, &strip_alarms))) { + delegated = delegate && !e_cal_get_save_schedules (priv->client); + if (delegated || (send && send_component_dialog ((GtkWindow *) editor, priv->client, priv->comp, !priv->existing_org, &strip_alarms, !priv->existing_org ? NULL : &only_new_attendees))) { + if (delegated) + only_new_attendees = FALSE; + + comp_editor_set_flags (editor, (comp_editor_get_flags (editor) & (~COMP_EDITOR_SEND_TO_NEW_ATTENDEES_ONLY)) | (only_new_attendees ? COMP_EDITOR_SEND_TO_NEW_ATTENDEES_ONLY : 0)); + 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); @@ -2491,8 +2499,10 @@ real_edit_comp (CompEditor *editor, ECalComponent *comp) priv->comp = NULL; } - if (comp) + if (comp) { priv->comp = e_cal_component_clone (comp); + comp_editor_copy_new_attendees (priv->comp, comp); + } priv->existing_org = e_cal_component_has_organizer (comp); priv->warned = FALSE; @@ -2598,6 +2608,8 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean str if (!send_comp) send_comp = e_cal_component_clone (priv->comp); + comp_editor_copy_new_attendees (send_comp, priv->comp); + if (e_cal_component_get_vtype (send_comp) == E_CAL_COMPONENT_JOURNAL) get_users_from_memo_comp (send_comp, &users); @@ -2612,7 +2624,7 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean str 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, strip_alarms)) { + NULL, NULL, users, strip_alarms, priv->flags & COMP_EDITOR_SEND_TO_NEW_ATTENDEES_ONLY)) { g_object_unref (send_comp); return TRUE; } @@ -2637,7 +2649,7 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean str } if (itip_send_comp (method, send_comp, priv->client, - NULL, mime_attach_list, users, strip_alarms)) { + NULL, mime_attach_list, users, strip_alarms, priv->flags & COMP_EDITOR_SEND_TO_NEW_ATTENDEES_ONLY)) { gboolean saved = save_comp (editor); g_object_unref (send_comp); @@ -2707,6 +2719,7 @@ comp_editor_get_current_comp (CompEditor *editor, gboolean *correct) priv = editor->priv; comp = e_cal_component_clone (priv->comp); + comp_editor_copy_new_attendees (comp, priv->comp); if (priv->changed) { for (l = priv->pages; l != NULL; l = l->next) all_ok = comp_editor_page_fill_component (l->data, comp) && all_ok; diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 6753635b1a..0edb2cc8eb 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -84,7 +84,8 @@ typedef enum { COMP_EDITOR_DELEGATE = 1<<2, COMP_EDITOR_USER_ORG = 1<<3, COMP_EDITOR_IS_ASSIGNED = 1<<4, - COMP_EDITOR_IS_SHARED = 1 << 5 + COMP_EDITOR_IS_SHARED = 1 << 5, + COMP_EDITOR_SEND_TO_NEW_ATTENDEES_ONLY = 1 << 6 } CompEditorFlags; GType comp_editor_get_type (void); diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 94006a961c..c4908158d6 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -655,10 +655,11 @@ event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboo client = e_meeting_store_get_client (priv->model); result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, - client, NULL, NULL, NULL, strip_alarms); + client, NULL, NULL, NULL, strip_alarms, FALSE); g_object_unref (comp); - return result; + if (!result) + return result; } parent: diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index caafdf1ab1..c48fe3cb79 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -957,6 +957,7 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) /* Component for cancellation */ priv->comp = e_cal_component_clone (comp); + comp_editor_copy_new_attendees (priv->comp, comp); e_cal_component_get_summary (comp, &text); e_dialog_editable_set (priv->summary, text.value); @@ -1171,6 +1172,8 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->description)); + comp_editor_copy_new_attendees (comp, priv->comp); + /* Summary */ str = e_dialog_editable_get (priv->summary); @@ -1706,7 +1709,7 @@ existing_attendee (EMeetingAttendee *ia, ECalComponent *comp) if (attendee->sentby) sentby = itip_strip_mailto (attendee->sentby); - if ((address && !g_ascii_strcasecmp (ia_address, address)) || (sentby && !g_ascii_strcasecmp (ia_sentby, sentby))) { + if ((address && !g_ascii_strcasecmp (ia_address, address)) || (sentby && ia_sentby&& !g_ascii_strcasecmp (ia_sentby, sentby))) { e_cal_component_free_attendee_list (attendees); return TRUE; } @@ -1755,7 +1758,8 @@ remove_attendee (EventPage *epage, EMeetingAttendee *ia) while (ia != NULL) { EMeetingAttendee *ib = NULL; - if (existing_attendee (ia, priv->comp)) { + /* do not add to deleted_attendees if user removed new attendee */ + if (existing_attendee (ia, priv->comp) && !comp_editor_have_in_new_attendees (priv->comp, ia)) { g_object_ref (ia); g_ptr_array_add (priv->deleted_attendees, ia); } @@ -1763,6 +1767,7 @@ remove_attendee (EventPage *epage, EMeetingAttendee *ia) if (e_meeting_attendee_get_delto (ia) != NULL) ib = e_meeting_store_find_attendee (priv->model, e_meeting_attendee_get_delto (ia), NULL); + comp_editor_manage_new_attendees (priv->comp, ia, FALSE); e_meeting_list_view_remove_attendee_from_name_selector (priv->list_view, ia); e_meeting_store_remove_attendee (priv->model, ia); @@ -1851,8 +1856,10 @@ attendee_added_cb (EMeetingListView *emlv, client = comp_editor_get_client (editor); flags = comp_editor_get_flags (editor); - if (!(flags & COMP_EDITOR_DELEGATE)) + if (!(flags & COMP_EDITOR_DELEGATE)) { + comp_editor_manage_new_attendees (priv->comp, ia, TRUE); return; + } if (existing_attendee (ia, priv->comp)) { e_meeting_store_remove_attendee (priv->model, ia); @@ -1867,7 +1874,7 @@ attendee_added_cb (EMeetingListView *emlv, e_meeting_attendee_set_delto (delegator, g_strdup (e_meeting_attendee_get_address (ia))); - e_meeting_attendee_set_delfrom (ia, g_strdup (delegator_id)); + 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); diff --git a/calendar/gui/dialogs/send-comp.c b/calendar/gui/dialogs/send-comp.c index c11dadf853..64e0ce0d84 100644 --- a/calendar/gui/dialogs/send-comp.c +++ b/calendar/gui/dialogs/send-comp.c @@ -32,6 +32,17 @@ +static gboolean +component_has_new_attendees (ECalComponent *comp) +{ + g_return_val_if_fail (comp != NULL, FALSE); + + if (!e_cal_component_has_attendees (comp)) + return FALSE; + + return g_object_get_data (G_OBJECT (comp), "new-attendees") != NULL; +} + static gboolean have_nonprocedural_alarm (ECalComponent *comp) { @@ -64,6 +75,25 @@ have_nonprocedural_alarm (ECalComponent *comp) return FALSE; } +static GtkWidget * +add_checkbox (GtkBox *where, const gchar *caption) +{ + GtkWidget *checkbox, *align; + + g_return_val_if_fail (where != NULL, NULL); + g_return_val_if_fail (caption != NULL, NULL); + + checkbox = gtk_check_button_new_with_mnemonic (caption); + align = gtk_alignment_new (0.0, 0.5, 0.0, 0.0); + gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 0, 12, 12); + gtk_container_add (GTK_CONTAINER (align), checkbox); + gtk_widget_show (checkbox); + gtk_box_pack_start (where, align, TRUE, TRUE, 2); + gtk_widget_show (align); + + return checkbox; +} + /** * send_component_dialog: * @@ -73,10 +103,12 @@ have_nonprocedural_alarm (ECalComponent *comp) * Return value: TRUE if the user clicked Yes, FALSE otherwise. **/ gboolean -send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean new, gboolean *strip_alarms) +send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean new, gboolean *strip_alarms, gboolean *only_new_attendees) { ECalComponentVType vtype; const gchar *id; + GtkWidget *dialog, *sa_checkbox = NULL, *ona_checkbox = NULL; + gboolean res; if (strip_alarms) *strip_alarms = TRUE; @@ -108,32 +140,37 @@ send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gbo return FALSE; } - if (strip_alarms && have_nonprocedural_alarm (comp)) { - GtkWidget *dialog, *checkbox, *align; - gboolean res; + if (only_new_attendees && !component_has_new_attendees (comp)) { + /* do not show the check if there is no new attendee and + set as all attendees are required to be notified */ + *only_new_attendees = FALSE; - 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); + /* pretend it as being passed NULL to simplify code below */ + only_new_attendees = NULL; + } - res = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES; + if (strip_alarms && !have_nonprocedural_alarm (comp)) { + /* pretend it as being passed NULL to simplify code below */ + strip_alarms = NULL; + } - if (res) - *strip_alarms = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)); + dialog = e_error_new (parent, id, NULL); - gtk_widget_destroy (GTK_WIDGET (dialog)); + if (strip_alarms) + sa_checkbox = add_checkbox (GTK_BOX (GTK_DIALOG (dialog)->vbox), _("Send my alarms with this event")); + if (only_new_attendees) + ona_checkbox = add_checkbox (GTK_BOX (GTK_DIALOG (dialog)->vbox), _("Notify new attendees _only")); - return res; - } else { - if (e_error_run (parent, id, NULL) == GTK_RESPONSE_YES) - return TRUE; - else - return FALSE; - } + res = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES; + + if (res && strip_alarms) + *strip_alarms = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (sa_checkbox)); + if (only_new_attendees) + *only_new_attendees = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ona_checkbox)); + + gtk_widget_destroy (GTK_WIDGET (dialog)); + + return res; } gboolean diff --git a/calendar/gui/dialogs/send-comp.h b/calendar/gui/dialogs/send-comp.h index 63644bd52a..83f356b142 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 *strip_alarms); +gboolean send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean new, gboolean *strip_alarms, gboolean *only_new_attendees); 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 a309a51d91..37cf357fe9 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -480,7 +480,7 @@ task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gbool client = e_meeting_store_get_client (priv->model); result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, - client, NULL, NULL, NULL, strip_alarms); + client, NULL, NULL, NULL, strip_alarms, FALSE); g_object_unref (comp); if (!result) diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 2e60ff5069..90a9f46b8c 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -493,6 +493,7 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) /* Component for cancellation */ priv->comp = e_cal_component_clone (comp); + comp_editor_copy_new_attendees (priv->comp, comp); /* Clean the screen */ clear_widgets (tpage); @@ -1021,7 +1022,7 @@ existing_attendee (EMeetingAttendee *ia, ECalComponent *comp) if (attendee->sentby) sentby = itip_strip_mailto (attendee->sentby); - if ((address && !g_ascii_strcasecmp (ia_address, address)) || (sentby && !g_ascii_strcasecmp (ia_sentby, sentby))) { + if ((address && !g_ascii_strcasecmp (ia_address, address)) || (sentby && ia_sentby && !g_ascii_strcasecmp (ia_sentby, sentby))) { e_cal_component_free_attendee_list (attendees); return TRUE; } @@ -1067,7 +1068,7 @@ remove_attendee (TaskPage *page, EMeetingAttendee *ia) while (ia != NULL) { EMeetingAttendee *ib = NULL; - if (existing_attendee (ia, priv->comp)) { + if (existing_attendee (ia, priv->comp) && !comp_editor_have_in_new_attendees (priv->comp, ia)) { g_object_ref (ia); g_ptr_array_add (priv->deleted_attendees, ia); } @@ -1075,6 +1076,7 @@ remove_attendee (TaskPage *page, EMeetingAttendee *ia) if (e_meeting_attendee_get_delto (ia) != NULL) ib = e_meeting_store_find_attendee (priv->model, e_meeting_attendee_get_delto (ia), NULL); + comp_editor_manage_new_attendees (priv->comp, ia, FALSE); e_meeting_list_view_remove_attendee_from_name_selector (priv->list_view, ia); e_meeting_store_remove_attendee (priv->model, ia); @@ -1163,8 +1165,10 @@ attendee_added_cb (EMeetingListView *emlv, client = comp_editor_get_client (editor); flags = comp_editor_get_flags (editor); - if (!(flags & COMP_EDITOR_DELEGATE)) + if (!(flags & COMP_EDITOR_DELEGATE)) { + comp_editor_manage_new_attendees (priv->comp, ia, TRUE); return; + } if (existing_attendee (ia, priv->comp)) e_meeting_store_remove_attendee (priv->model, ia); -- cgit v1.2.3 From 741d49c900ecc01002513060826b43dc26d4e55d Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 27 Jul 2009 17:43:02 +0200 Subject: Bug #203853 - Cut/Copy key bindings don't work in day and week views --- calendar/gui/dialogs/comp-editor-util.c | 1 - 1 file changed, 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index d8e05ca0df..6fc05d4a92 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -35,7 +35,6 @@ #include "e-util/e-binding.h" #include "widgets/misc/e-dateedit.h" #include "../calendar-config.h" -#include "../e-date-edit-config.h" #include "../itip-utils.h" #include "comp-editor-util.h" -- cgit v1.2.3 From 50302d03b3ce145b165db2ddef4e92ad190cbef9 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 4 Aug 2009 15:04:02 +0200 Subject: Bug #205137 - Configurable date formats in components --- calendar/gui/dialogs/cal-prefs-dialog.c | 7 +++ calendar/gui/dialogs/cal-prefs-dialog.glade | 79 +++++++++++++++++++++++++++++ 2 files changed, 86 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 8f22c98569..1ed8409bd4 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -32,6 +32,7 @@ #include "cal-prefs-dialog.h" #include #include +#include #include #include #include @@ -581,6 +582,7 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, gint i; GtkWidget *toplevel; GtkWidget *widget; + GtkWidget *table; GSList *l; gchar *gladefile; @@ -769,6 +771,11 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, toplevel = e_config_create_widget ((EConfig *)ec); gtk_container_add (GTK_CONTAINER (prefs), toplevel); + /* date/time format */ + table = glade_xml_get_widget (gui, "datetime_format_table"); + e_datetime_format_add_setup_widget (table, 0, "calendar", "table", DTFormatKindDateTime, _("Time and date:")); + e_datetime_format_add_setup_widget (table, 1, "calendar", "table", DTFormatKindDate, _("Date only:")); + show_config (prefs); /* FIXME: weakref? */ setup_changes (prefs); diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade index 63e9e6092f..984e509b64 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ b/calendar/gui/dialogs/cal-prefs-dialog.glade @@ -1024,6 +1024,85 @@ Days 3 + + + + True + <span weight="bold">Date/Time Format</span> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + False + 12 + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + 1 + 3 + False + 0 + 0 + + + 0 + True + True + + + + + 0 + True + True + + 1 -- cgit v1.2.3 From 46cc80aa8c6579a8badb79e719bd9aec29220e9f Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Fri, 7 Aug 2009 09:02:17 +0530 Subject: Changes for having a light version of calendar. --- calendar/gui/dialogs/comp-editor.c | 75 ++++++++++++++++++++++++++++++++--- calendar/gui/dialogs/comp-editor.h | 2 + calendar/gui/dialogs/event-page.c | 7 ++++ calendar/gui/dialogs/event-page.glade | 23 ++++++++++- 4 files changed, 100 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 100a1615fb..0b9dfba93c 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -75,6 +75,8 @@ #define d(x) +static gboolean comp_lite = FALSE; + /* Private part of the CompEditor structure */ struct _CompEditorPrivate { @@ -1606,6 +1608,7 @@ comp_editor_init (CompEditor *editor) GtkAction *action; GtkWidget *container; GtkWidget *widget; + GtkWidget *scroll; EShell *shell; gint n_targets; GError *error = NULL; @@ -1628,7 +1631,9 @@ comp_editor_init (CompEditor *editor) priv->is_group_item = FALSE; priv->ui_manager = gtk_ui_manager_new (); - + + if (comp_lite) + gtk_window_set_default_size ((GtkWindow *) editor, 800, 450); gtk_window_add_accel_group ( GTK_WINDOW (editor), gtk_ui_manager_get_accel_group (priv->ui_manager)); @@ -1702,9 +1707,11 @@ comp_editor_init (CompEditor *editor) gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); gtk_widget_show (widget); - widget = comp_editor_get_managed_widget (editor, "/main-toolbar"); - gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); - gtk_widget_show (widget); + if (!comp_lite) { + widget = comp_editor_get_managed_widget (editor, "/main-toolbar"); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + } widget = e_attachment_paned_new (); gtk_container_set_border_width (GTK_CONTAINER (widget), 6); @@ -1712,15 +1719,60 @@ comp_editor_init (CompEditor *editor) priv->attachment_view = g_object_ref (widget); gtk_widget_show (widget); + if (comp_lite) { + GtkWidget *tmp, *tmp1, *tmp_box, *cont; + GtkWidget *combo; + + e_attachment_paned_set_expanded (E_ATTACHMENT_PANED (widget), TRUE); + e_attachment_paned_set_expanded (E_ATTACHMENT_PANED (widget), FALSE); + + combo = e_attachment_paned_get_view_combo ( + E_ATTACHMENT_PANED (widget)); + gtk_widget_hide (combo); + cont = e_attachment_paned_get_controls_container ( + E_ATTACHMENT_PANED (widget)); + + tmp_box = gtk_hbox_new (FALSE, 0); + tmp = gtk_hbox_new (FALSE, 0); + tmp1 = gtk_image_new_from_stock (GTK_STOCK_SAVE, GTK_ICON_SIZE_BUTTON); + gtk_box_pack_start ((GtkBox *)tmp, tmp1, FALSE, FALSE, 0); + tmp1 = gtk_label_new_with_mnemonic (_("Save")); + gtk_box_pack_start ((GtkBox *)tmp, tmp1, FALSE, FALSE, 3); + gtk_widget_show_all(tmp); + + combo = gtk_ui_manager_get_widget (priv->ui_manager, "/main-toolbar/save"); + gtk_widget_reparent (combo, tmp_box); + gtk_box_set_child_packing ((GtkBox *)tmp_box, combo, FALSE, FALSE, 6, GTK_PACK_END); + gtk_tool_item_set_is_important (GTK_TOOL_ITEM (combo), TRUE); + combo = gtk_bin_get_child ((GtkBin *)combo); + gtk_container_remove((GtkContainer *)combo, gtk_bin_get_child ((GtkBin *)combo)); + gtk_container_add((GtkContainer *)combo, tmp); + gtk_button_set_relief ((GtkButton *)combo, GTK_RELIEF_NORMAL); + + gtk_widget_show(tmp_box); + gtk_box_pack_end (GTK_BOX (cont), tmp_box, FALSE, FALSE, 4); + + } container = e_attachment_paned_get_content_area ( E_ATTACHMENT_PANED (priv->attachment_view)); + if (comp_lite) { + scroll = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy ((GtkScrolledWindow *)scroll, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_widget_show(scroll); + gtk_box_pack_start (GTK_BOX (container), scroll, TRUE, TRUE, 0); + } + widget = gtk_notebook_new (); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE); - gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); + if (!comp_lite) + gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); + else + gtk_scrolled_window_add_with_viewport ((GtkScrolledWindow *) scroll, widget); priv->notebook = GTK_NOTEBOOK (widget); gtk_widget_show (widget); - + if (comp_lite) + gtk_widget_set_size_request (scroll, 300, -1); comp_editor_setup_recent_menu (editor); /* Drag-and-Drop Support */ @@ -2944,3 +2996,14 @@ obj_removed_cb (ECal *client, close_dialog (editor); } +gboolean +comp_editor_get_lite () +{ + return comp_lite; +} + +void +comp_editor_set_lite (gboolean status) +{ + comp_lite = status; +} diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 0edb2cc8eb..157343bcac 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -156,6 +156,8 @@ GtkWidget * comp_editor_get_managed_widget (CompEditor *editor, const gchar *widget_path); CompEditor * comp_editor_find_instance (const gchar *uid); +void comp_editor_set_lite (gboolean status); +gboolean comp_editor_get_lite (void); G_END_DECLS #endif diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index c48fe3cb79..4b0962228b 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -161,6 +161,7 @@ struct _EventPagePrivate { GtkWidget *remove; GtkWidget *edit; GtkWidget *invite; + GtkWidget *invite_label; GtkWidget *attendees_label; /* ListView stuff */ @@ -2259,6 +2260,12 @@ get_widgets (EventPage *epage) priv->info_string = GW ("generic-info-msgs"); priv->invite = GW ("invite"); + priv->invite_label = GW ("invite-label"); + if (comp_editor_get_lite ()) + gtk_widget_hide (priv->invite); + else + gtk_widget_hide (priv->invite_label); + priv->add = GW ("add-attendee"); priv->remove = GW ("remove-attendee"); priv->edit = GW ("edit-attendee"); diff --git a/calendar/gui/dialogs/event-page.glade b/calendar/gui/dialogs/event-page.glade index 7a57f6b716..f1bb4e15dc 100644 --- a/calendar/gui/dialogs/event-page.glade +++ b/calendar/gui/dialogs/event-page.glade @@ -898,7 +898,28 @@ b - + + True + Attendees + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + -- cgit v1.2.3 From b5a2e47cb53aa92be37b469d3d9d625ea8477416 Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Fri, 7 Aug 2009 09:02:32 +0530 Subject: Allow calendar to be written as a external app and split the huge .so to a share private lib and component lib. --- calendar/gui/dialogs/Makefile.am | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am index a9c752701d..87d640a6b2 100644 --- a/calendar/gui/dialogs/Makefile.am +++ b/calendar/gui/dialogs/Makefile.am @@ -17,7 +17,35 @@ ecalendarincludedir = $(privincludedir)/calendar/gui/dialogs ecalendarinclude_HEADERS = \ comp-editor-page.h \ - comp-editor.h + comp-editor.h \ + alarm-dialog.h \ + alarm-list-dialog.h \ + cal-attachment-select-file.h \ + cal-prefs-dialog.h \ + calendar-setup.h \ + cancel-comp.h \ + changed-comp.h \ + comp-editor.h \ + comp-editor-page.h \ + comp-editor-util.h \ + copy-source-dialog.h \ + delete-comp.h \ + delete-error.h \ + e-delegate-dialog.h \ + e-send-options-utils.h \ + event-editor.h \ + event-page.h \ + memo-editor.h \ + memo-page.h \ + recurrence-page.h \ + recur-comp.h \ + save-comp.h \ + schedule-page.h \ + select-source-dialog.h \ + send-comp.h \ + task-editor.h \ + task-details-page.h \ + task-page.h noinst_LTLIBRARIES = libcal-dialogs.la -- cgit v1.2.3 From 4356a64199e5f86b01f7f10ef8cad16e295233bd Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Fri, 7 Aug 2009 15:24:54 +0530 Subject: Fix a duplicate install file. --- calendar/gui/dialogs/Makefile.am | 2 -- 1 file changed, 2 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am index 87d640a6b2..99c33e449a 100644 --- a/calendar/gui/dialogs/Makefile.am +++ b/calendar/gui/dialogs/Makefile.am @@ -25,8 +25,6 @@ ecalendarinclude_HEADERS = \ calendar-setup.h \ cancel-comp.h \ changed-comp.h \ - comp-editor.h \ - comp-editor-page.h \ comp-editor-util.h \ copy-source-dialog.h \ delete-comp.h \ -- cgit v1.2.3 From f594ec520342f88c0870dabd7205073aa72654cb Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 11 Aug 2009 22:37:08 -0400 Subject: Remove unnecessary includes. --- calendar/gui/dialogs/comp-editor.c | 1 - 1 file changed, 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 0b9dfba93c..cb3ff42438 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -61,7 +61,6 @@ #include "recur-comp.h" #include "comp-editor.h" #include "comp-editor-util.h" -#include "../e-cal-popup.h" #include "../calendar-config-keys.h" #include "cal-attachment-select-file.h" #include "widgets/misc/e-attachment-view.h" -- cgit v1.2.3 From 672adf12a0923437e90d08ab7925bd9329fcce0d Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 16 Aug 2009 11:25:08 -0400 Subject: Fix compiler warnings and deprecated GTK+ API usage. --- calendar/gui/dialogs/cal-prefs-dialog.c | 5 ++--- calendar/gui/dialogs/event-editor.c | 1 + calendar/gui/dialogs/schedule-page.c | 1 + calendar/gui/dialogs/task-editor.c | 5 +++-- 4 files changed, 7 insertions(+), 5 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 1ed8409bd4..6fccf0cea1 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -505,9 +505,8 @@ show_alarms_config (CalendarPrefsDialog *prefs) static void show_config (CalendarPrefsDialog *prefs) { - gint mask, day, time_divisions; - icaltimezone *zone; - gboolean sensitive, set = FALSE; + gint time_divisions; + gboolean set = FALSE; CalUnits units; gint interval; diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index c4908158d6..91c879928c 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -34,6 +34,7 @@ #include #include +#include #include #include diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c index 979e182a8c..5a7277084b 100644 --- a/calendar/gui/dialogs/schedule-page.c +++ b/calendar/gui/dialogs/schedule-page.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 37cf357fe9..edd54859d6 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -33,8 +33,9 @@ #include #include -#include -#include +#include "e-util/e-binding.h" +#include "e-util/e-plugin-ui.h" +#include "e-util/e-util-private.h" #include "task-page.h" #include "task-details-page.h" -- cgit v1.2.3 From 4a762fe27a1174ebfded03c11df821c16169008f Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 22 Aug 2009 20:08:53 -0400 Subject: Remove the popup menu from EMeetingListView. Will restore this later, but the code is too messy to deal with right now. ECalPopup must die. --- calendar/gui/dialogs/event-page.c | 98 -------------------------------------- calendar/gui/dialogs/task-page.c | 99 --------------------------------------- 2 files changed, 197 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 4b0962228b..3e74fbe28a 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -52,7 +52,6 @@ #include "../e-meeting-attendee.h" #include "../e-meeting-store.h" #include "../e-meeting-list-view.h" -#include "../e-cal-popup.h" #include "comp-editor.h" #include "comp-editor-util.h" #include "../e-alarm-list.h" @@ -1883,102 +1882,6 @@ attendee_added_cb (EMeetingListView *emlv, } } -/* Callbacks for list view*/ -static void -popup_add_cb (EPopup *ep, EPopupItem *pitem, gpointer data) -{ - EventPage *epage = data; - - add_clicked_cb (NULL, epage); -} - -static void -popup_delete_cb (EPopup *ep, EPopupItem *pitem, gpointer data) -{ - EventPage *epage = data; - - remove_clicked_cb (NULL, epage); -} - -enum { - ATTENDEE_CAN_DELEGATE = 1<<1, - ATTENDEE_CAN_DELETE = 1<<2, - ATTENDEE_CAN_ADD = 1<<3, - ATTENDEE_LAST = 1<<4 -}; - -static EPopupItem context_menu_items[] = { - { E_POPUP_ITEM, (gchar *) "10.delete", (gchar *) N_("_Remove"), popup_delete_cb, NULL, (gchar *) GTK_STOCK_REMOVE, ATTENDEE_CAN_DELETE }, - { E_POPUP_ITEM, (gchar *) "15.add", (gchar *) N_("_Add "), popup_add_cb, NULL, (gchar *) GTK_STOCK_ADD, ATTENDEE_CAN_ADD }, -}; - -static void -context_popup_free(EPopup *ep, GSList *items, gpointer data) -{ - g_slist_free(items); -} - -static gint -button_press_event (GtkWidget *widget, GdkEventButton *event, EventPage *epage) -{ - EventPagePrivate *priv = epage->priv; - CompEditor *editor; - CompEditorFlags flags; - GtkMenu *menu; - EMeetingAttendee *ia; - GtkTreePath *path; - GtkTreeIter iter; - gchar *address; - guint32 disable_mask = ~0; - GSList *menus = NULL; - ECalPopup *ep; - gint i; - - /* 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; - - if (gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->model), &iter, path)) { - - gtk_tree_model_get (GTK_TREE_MODEL (priv->model), &iter, E_MEETING_STORE_ADDRESS_COL, &address, -1); - ia = e_meeting_store_find_attendee (priv->model, address, &priv->row); - g_free (address); - - if (ia) { - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->list_view)); - gtk_tree_selection_unselect_all (selection); - gtk_tree_selection_select_path (selection, path); - - if (e_meeting_attendee_get_edit_level (ia) == E_MEETING_ATTENDEE_EDIT_FULL) - disable_mask &= ~ATTENDEE_CAN_DELETE; - } - } - } - - if (GTK_WIDGET_IS_SENSITIVE(priv->add)) - disable_mask &= ~ATTENDEE_CAN_ADD; - else if (flags & COMP_EDITOR_USER_ORG) - disable_mask &= ~ATTENDEE_CAN_ADD; - - ep = e_cal_popup_new("org.gnome.evolution.calendar.meeting.popup"); - - for (i=0;ibutton, event->time); - - return TRUE; -} - static gboolean list_view_event (EMeetingListView *list_view, GdkEvent *event, EventPage *epage) { @@ -2915,7 +2818,6 @@ init_widgets (EventPage *epage) selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->list_view)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); - g_signal_connect (G_OBJECT (priv->list_view), "button_press_event", G_CALLBACK (button_press_event), epage); g_signal_connect (G_OBJECT (priv->list_view), "event", G_CALLBACK (list_view_event), epage); g_signal_connect (priv->list_view, "key_press_event", G_CALLBACK (list_key_press), epage); diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 90a9f46b8c..7498f9825b 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -1191,102 +1191,6 @@ attendee_added_cb (EMeetingListView *emlv, } } -/* Callbacks for list view*/ -static void -popup_add_cb (EPopup *ep, EPopupItem *pitem, gpointer data) -{ - TaskPage *page = data; - - add_clicked_cb (NULL, page); -} - -static void -popup_delete_cb (EPopup *ep, EPopupItem *pitem, gpointer data) -{ - TaskPage *page = data; - - remove_clicked_cb (NULL, page); -} - -enum { - ATTENDEE_CAN_DELEGATE = 1<<1, - ATTENDEE_CAN_DELETE = 1<<2, - ATTENDEE_CAN_ADD = 1<<3, - ATTENDEE_LAST = 1<<4 -}; - -static EPopupItem context_menu_items[] = { - { E_POPUP_ITEM, (gchar *) "10.delete", (gchar *) N_("_Remove"), popup_delete_cb, NULL, (gchar *) GTK_STOCK_REMOVE, ATTENDEE_CAN_DELETE }, - { E_POPUP_ITEM, (gchar *) "15.add", (gchar *) N_("_Add "), popup_add_cb, NULL, (gchar *) GTK_STOCK_ADD, ATTENDEE_CAN_ADD }, -}; - -static void -context_popup_free(EPopup *ep, GSList *items, gpointer data) -{ - g_slist_free(items); -} - -static gint -button_press_event (GtkWidget *widget, GdkEventButton *event, TaskPage *page) -{ - TaskPagePrivate *priv = page->priv; - CompEditor *editor; - CompEditorFlags flags; - GtkMenu *menu; - EMeetingAttendee *ia; - GtkTreePath *path; - GtkTreeIter iter; - gchar *address; - guint32 disable_mask = ~0; - GSList *menus = NULL; - ECalPopup *ep; - gint i; - - /* 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; - - if (gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->model), &iter, path)) { - - gtk_tree_model_get (GTK_TREE_MODEL (priv->model), &iter, E_MEETING_STORE_ADDRESS_COL, &address, -1); - ia = e_meeting_store_find_attendee (priv->model, address, &priv->row); - g_free (address); - - if (ia) { - selection = gtk_tree_view_get_selection ((GtkTreeView *) priv->list_view); - gtk_tree_selection_unselect_all (selection); - gtk_tree_selection_select_path (selection, path); - - if (e_meeting_attendee_get_edit_level (ia) == E_MEETING_ATTENDEE_EDIT_FULL) - disable_mask &= ~ATTENDEE_CAN_DELETE; - } - } - } - - if (GTK_WIDGET_IS_SENSITIVE(priv->add)) - disable_mask &= ~ATTENDEE_CAN_ADD; - else if (flags & COMP_EDITOR_USER_ORG) - disable_mask &= ~ATTENDEE_CAN_ADD; - - ep = e_cal_popup_new("org.gnome.evolution.calendar.task.popup"); - - for (i=0;ibutton, event->time); - - return TRUE; -} - static gboolean list_view_event (EMeetingListView *list_view, GdkEvent *event, TaskPage *page) { @@ -1932,9 +1836,6 @@ init_widgets (TaskPage *tpage) 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); -- cgit v1.2.3 From c83b2b819578571d9d5f346eb01dc416ccafe3a5 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 22 Aug 2009 20:15:25 -0400 Subject: Kill ECalPopup. --- calendar/gui/dialogs/task-page.c | 1 - 1 file changed, 1 deletion(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 7498f9825b..632cc52e2f 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -53,7 +53,6 @@ #include "../e-meeting-attendee.h" #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 \ -- cgit v1.2.3 From b5725a7a07acdd5231125adb70b519e4dcde08c2 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 22 Aug 2009 20:20:08 -0400 Subject: Kill EPopup. --- calendar/gui/dialogs/event-page.c | 1 - calendar/gui/dialogs/task-page.c | 1 - 2 files changed, 2 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 3e74fbe28a..07e74bc11f 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -39,7 +39,6 @@ #include "common/authentication.h" #include "e-util/e-categories-config.h" #include "e-util/e-dialog-widgets.h" -#include "e-util/e-popup.h" #include "misc/e-dateedit.h" #include "misc/e-send-options.h" #include diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 632cc52e2f..2f0c258f3a 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -39,7 +39,6 @@ #include #include #include "common/authentication.h" -#include "e-util/e-popup.h" #include "e-util/e-dialog-widgets.h" #include "e-util/e-categories-config.h" #include "e-util/e-util-private.h" -- cgit v1.2.3 From 0f7f4cfe38b3c4cd83efbe9922ae15c5aee00317 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 30 Aug 2009 00:48:57 -0400 Subject: Coding style and whitespace cleanup. --- calendar/gui/dialogs/comp-editor.c | 10 +++++----- calendar/gui/dialogs/comp-editor.h | 3 ++- calendar/gui/dialogs/event-page.c | 2 +- 3 files changed, 8 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 cb3ff42438..8995b0eddc 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1630,7 +1630,7 @@ comp_editor_init (CompEditor *editor) priv->is_group_item = FALSE; priv->ui_manager = gtk_ui_manager_new (); - + if (comp_lite) gtk_window_set_default_size ((GtkWindow *) editor, 800, 450); gtk_window_add_accel_group ( @@ -1721,7 +1721,7 @@ comp_editor_init (CompEditor *editor) if (comp_lite) { GtkWidget *tmp, *tmp1, *tmp_box, *cont; GtkWidget *combo; - + e_attachment_paned_set_expanded (E_ATTACHMENT_PANED (widget), TRUE); e_attachment_paned_set_expanded (E_ATTACHMENT_PANED (widget), FALSE); @@ -1738,7 +1738,7 @@ comp_editor_init (CompEditor *editor) tmp1 = gtk_label_new_with_mnemonic (_("Save")); gtk_box_pack_start ((GtkBox *)tmp, tmp1, FALSE, FALSE, 3); gtk_widget_show_all(tmp); - + combo = gtk_ui_manager_get_widget (priv->ui_manager, "/main-toolbar/save"); gtk_widget_reparent (combo, tmp_box); gtk_box_set_child_packing ((GtkBox *)tmp_box, combo, FALSE, FALSE, 6, GTK_PACK_END); @@ -1746,11 +1746,11 @@ comp_editor_init (CompEditor *editor) combo = gtk_bin_get_child ((GtkBin *)combo); gtk_container_remove((GtkContainer *)combo, gtk_bin_get_child ((GtkBin *)combo)); gtk_container_add((GtkContainer *)combo, tmp); - gtk_button_set_relief ((GtkButton *)combo, GTK_RELIEF_NORMAL); + gtk_button_set_relief ((GtkButton *)combo, GTK_RELIEF_NORMAL); gtk_widget_show(tmp_box); gtk_box_pack_end (GTK_BOX (cont), tmp_box, FALSE, FALSE, 4); - + } container = e_attachment_paned_get_content_area ( E_ATTACHMENT_PANED (priv->attachment_view)); diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 157343bcac..454f02b2e6 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -156,8 +156,9 @@ GtkWidget * comp_editor_get_managed_widget (CompEditor *editor, const gchar *widget_path); CompEditor * comp_editor_find_instance (const gchar *uid); -void comp_editor_set_lite (gboolean status); +void comp_editor_set_lite (gboolean status); gboolean comp_editor_get_lite (void); + G_END_DECLS #endif diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 07e74bc11f..5a9b8ec47a 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -2167,7 +2167,7 @@ get_widgets (EventPage *epage) gtk_widget_hide (priv->invite); else gtk_widget_hide (priv->invite_label); - + priv->add = GW ("add-attendee"); priv->remove = GW ("remove-attendee"); priv->edit = GW ("edit-attendee"); -- cgit v1.2.3