#ifdef MODEST_TOOLKIT_HILDON2
#include <hildon/hildon.h>
+#include <gdk/gdkx.h>
+#include <X11/Xatom.h>
+#include <X11/XKBlib.h>
+#include <X11/Xdmcp.h>
#endif
+
#include <tny-camel-bs-mime-part.h>
#include <tny-camel-bs-msg.h>
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);
/* list my signals */
enum {
MODEST_TYPE_MSG_VIEW_WINDOW, \
ModestMsgViewWindowPrivate))
/* globals */
-static GtkWindowClass *parent_class = NULL;
+static ModestWindowParentClass *parent_class = NULL;
/* uncomment the following if you have defined any signals */
static guint signals[LAST_SIGNAL] = {0};
priv->remove_attachment_banner = NULL;
priv->msg_uid = NULL;
priv->other_body = NULL;
-
+
priv->sighandlers = NULL;
-
+
/* Init window */
init_window (MODEST_MSG_VIEW_WINDOW(obj));
+#ifdef MODEST_TOOLKIT_HILDON2
+ /* Grab the zoom keys, it will be used for Zoom and not for
+ changing volume */
+ g_signal_connect (G_OBJECT (obj), "realize",
+ G_CALLBACK (on_realize),
+ NULL);
+#endif
}
static void
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);
modest_window_mgr_unregister_header (modest_runtime_get_window_mgr (), header);
row_reference = (GtkTreeRowReference *) user_data;
- if (canceled) {
+ self = (ModestMsgViewWindow *) modest_mail_operation_get_source (mail_op);
+ if (canceled || !self || MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self)->msg_view == NULL ) {
if (row_reference)
gtk_tree_row_reference_free (row_reference);
- self = (ModestMsgViewWindow *) modest_mail_operation_get_source (mail_op);
if (self) {
/* Restore window title */
update_window_title (self);
if (!modest_ui_actions_msg_retrieval_check (mail_op, header, msg)) {
if (row_reference)
gtk_tree_row_reference_free (row_reference);
- self = (ModestMsgViewWindow *) modest_mail_operation_get_source (mail_op);
if (self) {
priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self);
/* First we check if the parent is a folder window */
}
/* Get the window */
- self = (ModestMsgViewWindow *) modest_mail_operation_get_source (mail_op);
g_return_if_fail (MODEST_IS_MSG_VIEW_WINDOW (self));
priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self);
}
/* Mark header as read */
- if (!(tny_header_get_flags (header) & TNY_HEADER_FLAG_SEEN))
+ if (!(tny_header_get_flags (header) & TNY_HEADER_FLAG_SEEN)) {
+ gchar *uid;
+
tny_header_set_flag (header, TNY_HEADER_FLAG_SEEN);
+ uid = modest_tny_folder_get_header_unique_id (header);
+ modest_platform_emit_msg_read_changed_signal (uid, TRUE);
+ g_free (uid);
+ }
/* Set new message */
if (priv->msg_view != NULL && TNY_IS_MSG_VIEW (priv->msg_view)) {
account = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr ());
msg = tny_camel_msg_new ();
- tny_camel_msg_parse (msg, file_stream);
+ tny_camel_msg_parse ((TnyCamelMsg *) msg, file_stream);
if (priv->top_msg)
top_msg = g_object_ref (priv->top_msg);
} else {
modest_platform_system_banner (NULL, NULL, _("mail_ib_file_operation_failed"));
}
+ set_progress_hint (info->window, FALSE);
save_mime_part_info_free (info, FALSE);
gdk_threads_leave (); /* CHECKED */
if (written < 0) {
g_warning ("modest: could not save attachment %s: %d (%s)\n", pair->filename, error?error->code:-1, error?error->message:"Unknown error");
- if ((error->domain == TNY_ERROR_DOMAIN) &&
+ if (error && (error->domain == TNY_ERROR_DOMAIN) &&
(error->code == TNY_IO_ERROR_WRITE) &&
(errno == ENOSPC)) {
info->result = GNOME_VFS_ERROR_NO_SPACE;
if (!is_ok) {
save_mime_part_info_free (info, TRUE);
} else {
+ /* Start progress and launch thread */
+ set_progress_hint (info->window, TRUE);
g_thread_create ((GThreadFunc)save_mime_part_to_file, info, FALSE, NULL);
}
g_return_if_fail (MODEST_IS_MSG_VIEW_WINDOW(self));
/* Settings menu buttons */
- modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_viewer_find"), NULL,
- MODEST_WINDOW_MENU_CALLBACK (modest_msg_view_window_show_isearch_toolbar),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_find_in_msg));
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_new_message"), "<Control>n",
+ MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_new_msg),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_new_msg));
modest_window_add_to_menu (MODEST_WINDOW (self),
dngettext(GETTEXT_PACKAGE,
modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_inbox_mark_as_read"), NULL,
MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_mark_as_read),
MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_mark_as_read_msg_in_view));
-
modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_inbox_mark_as_unread"), NULL,
MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_mark_as_unread),
MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_mark_as_unread_msg_in_view));
MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_remove_attachments),
MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_remove_attachments));
- modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_new_message"), "<Control>n",
- MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_new_msg),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_new_msg));
modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_viewer_addtocontacts"), NULL,
MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_add_to_contacts),
MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_add_to_contacts));
modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_ti_message_properties"), NULL,
MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_details),
MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_details));
+
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_viewer_find"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (modest_msg_view_window_show_isearch_toolbar),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_find_in_msg));
}
void
g_object_unref (header);
}
}
+
+#ifdef MODEST_TOOLKIT_HILDON2
+static gboolean
+on_realize (GtkWidget *widget,
+ gpointer userdata)
+{
+ GdkDisplay *display;
+ Atom atom;
+ unsigned long val = 1;
+
+ display = gdk_drawable_get_display (widget->window);
+ atom = gdk_x11_get_xatom_by_name_for_display (display, "_HILDON_ZOOM_KEY_ATOM");
+ XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
+ GDK_WINDOW_XID (widget->window), atom,
+ XA_INTEGER, 32, PropModeReplace,
+ (unsigned char *) &val, 1);
+
+ return FALSE;
+}
+#endif
+
+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;
+}