From 020116114abce7854183d211076e0986f8ecb67c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Dapena=20Paz?= Date: Thu, 17 Dec 2009 17:29:43 +0100 Subject: [PATCH] Pass to account protocol request to handle the calendar --- src/hildon2/modest-msg-view-window.c | 28 ++++++++++++++++++++++++++++ src/modest-account-protocol.c | 25 +++++++++++++++++++++++++ src/modest-account-protocol.h | 24 +++++++++++++++++++++++- 3 files changed, 76 insertions(+), 1 deletion(-) diff --git a/src/hildon2/modest-msg-view-window.c b/src/hildon2/modest-msg-view-window.c index fefb87f..9749443 100644 --- a/src/hildon2/modest-msg-view-window.c +++ b/src/hildon2/modest-msg-view-window.c @@ -240,6 +240,8 @@ static gboolean _modest_msg_view_window_map_event (GtkWidget *widget, gpointer userdata); static void update_branding (ModestMsgViewWindow *self); static void sync_flags (ModestMsgViewWindow *self); +static gboolean on_handle_calendar (ModestMsgView *msgview, TnyMimePart *calendar_part, + GtkContainer *container, ModestMsgViewWindow *self); static gboolean on_realize (GtkWidget *widget, gpointer userdata); @@ -819,6 +821,8 @@ modest_msg_view_window_construct (ModestMsgViewWindow *self, G_CALLBACK (modest_ui_actions_on_msg_link_contextual), obj); g_signal_connect (G_OBJECT(priv->msg_view), "limit_error", G_CALLBACK (modest_ui_actions_on_limit_error), obj); + g_signal_connect (G_OBJECT(priv->msg_view), "handle_calendar", + G_CALLBACK (on_handle_calendar), obj); g_signal_connect (G_OBJECT (priv->msg_view), "fetch_image", G_CALLBACK (on_fetch_image), obj); @@ -4119,3 +4123,27 @@ on_realize (GtkWidget *widget, return FALSE; } + +static gboolean +on_handle_calendar (ModestMsgView *msgview, TnyMimePart *calendar_part, GtkContainer *container, ModestMsgViewWindow *self) +{ + const gchar *account_name; + ModestProtocolType proto_type; + ModestProtocol *protocol; + gboolean retval = FALSE; + + account_name = modest_window_get_active_account (MODEST_WINDOW (self)); + + /* Get proto */ + proto_type = modest_account_mgr_get_store_protocol (modest_runtime_get_account_mgr (), + account_name); + protocol = + modest_protocol_registry_get_protocol_by_type (modest_runtime_get_protocol_registry (), + proto_type); + + if (MODEST_IS_ACCOUNT_PROTOCOL (protocol)) { + retval = modest_account_protocol_handle_calendar (MODEST_ACCOUNT_PROTOCOL (protocol), MODEST_WINDOW (self), + calendar_part, container); + } + return retval; +} diff --git a/src/modest-account-protocol.c b/src/modest-account-protocol.c index a995db2..850be4e 100644 --- a/src/modest-account-protocol.c +++ b/src/modest-account-protocol.c @@ -133,6 +133,11 @@ static void modest_account_protocol_save_remote_draft_default (ModestAccountProt TnyMsg *old_msg, ModestAccountProtocolSaveRemoteDraftCallback callback, gpointer userdata); +static gboolean +modest_account_protocol_handle_calendar_default (ModestAccountProtocol *self, + ModestWindow *window, + TnyMimePart *calendar_part, + GtkContainer *container); /* globals */ static GObjectClass *parent_class = NULL; @@ -242,6 +247,8 @@ modest_account_protocol_class_init (ModestAccountProtocolClass *klass) modest_account_protocol_get_service_icon_default; account_class->save_remote_draft = modest_account_protocol_save_remote_draft_default; + account_class->handle_calendar = + modest_account_protocol_handle_calendar_default; } @@ -903,3 +910,21 @@ modest_account_protocol_save_remote_draft_default (ModestAccountProtocol *self, } } +gboolean +modest_account_protocol_handle_calendar (ModestAccountProtocol *self, + ModestWindow *window, + TnyMimePart *calendar_part, + GtkContainer *container) +{ + return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->handle_calendar (self, window, + calendar_part, container); +} + +static gboolean +modest_account_protocol_handle_calendar_default (ModestAccountProtocol *self, + ModestWindow *window, + TnyMimePart *calendar_part, + GtkContainer *container) +{ + return FALSE; +} diff --git a/src/modest-account-protocol.h b/src/modest-account-protocol.h index f773f61..16e8e44 100644 --- a/src/modest-account-protocol.h +++ b/src/modest-account-protocol.h @@ -35,6 +35,7 @@ #include "widgets/modest-account-settings-dialog.h" #include "modest-protocol.h" +#include "widgets/modest-window.h" #include "widgets/modest-wizard-dialog.h" #include "modest-pair.h" #include @@ -114,8 +115,12 @@ struct _ModestAccountProtocolClass { TnyStatusCallback status_callback, gpointer user_data); + gboolean (*handle_calendar) (ModestAccountProtocol *protocol, + ModestWindow *window, + TnyMimePart *calendar_part, + GtkContainer *container); + /* Padding for future expansions */ - void (*_reserved8) (void); void (*_reserved9) (void); void (*_reserved10) (void); void (*_reserved11) (void); @@ -545,6 +550,23 @@ gboolean modest_account_protocol_decode_part_to_stream_async (ModestAccountProto TnyStatusCallback status_callback, gpointer user_data); +/** + * modest_account_protocol_handle_calendar: + * @self: a #ModestAccountProtocol + * @window: the #ModestWindow requesting to handle calendar + * @calendar_part: a #TnyMimePart + * @container: a #GtkContainer (a #GtkVBox now) + * + * Instruct the account protocol to handle a calendar mime part. The account protocol + * will fill @container with the controls to handle the @calendar invitation. + * + * Returns: %TRUE if account protocol handles the calendar request, %FALSE otherwise + */ +gboolean modest_account_protocol_handle_calendar (ModestAccountProtocol *self, + ModestWindow *window, + TnyMimePart *calendar_part, + GtkContainer *container); + G_END_DECLS -- 1.7.9.5