From: Murray Cumming Date: Thu, 12 Jul 2007 07:59:04 +0000 (+0000) Subject: 2007-07-12 Murray Cumming X-Git-Tag: git_migration_finished~2819 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=703965f6f52fab28c9762f1b5603c6feeec5a680 2007-07-12 Murray Cumming * src/dbus_api/modest-dbus-callbacks.c: (on_idle_open_message), Pass the modest account name, not the TnyAccount display name to modest_msg_view_window_new() so that the reply feature works, fixing projects.maemo.org bug NB#62892. * src/gnome/modest-msg-view-window.c: (modest_msg_view_window_new), (modest_msg_view_window_new_with_header_model): * src/maemo/modest-msg-view-window.c: (modest_msg_view_window_new_with_header_model), (modest_msg_view_window_new): * src/modest-ui-actions.c: (reply_forward): * src/widgets/modest-msg-view-window.h: * src/widgets/modest-window.c: (modest_window_set_active_account): Rename an account parameter to modest_account_name to make this clearer. 2007-07-11 Murray Cumming * src/modest-ui-actions.h: * src/modest-ui-actions.c: (headers_action_delete): Moved some code into modest_do_message_delete(). * src/dbus_api/modest-dbus-callbacks.c: (on_idle_delete_message): Call modest_do_message_delete(), hoping that this would cause messages to be really deleted from search instead of just marked with strike through. Does not seem to help. pmo-trunk-r2719 --- diff --git a/ChangeLog b/ChangeLog index acb6b92..48f7a59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1 +1 @@ -* please check the svn log instead + please check the svn log instead diff --git a/ChangeLog2 b/ChangeLog2 index 31215c2..279b479 100644 --- a/ChangeLog2 +++ b/ChangeLog2 @@ -1,3 +1,30 @@ +2007-07-12 Murray Cumming + + * src/dbus_api/modest-dbus-callbacks.c: (on_idle_open_message), + Pass the modest account name, not the TnyAccount display name to + modest_msg_view_window_new() so that the reply feature works, + fixing projects.maemo.org bug NB#62892. + + * src/gnome/modest-msg-view-window.c: (modest_msg_view_window_new), + (modest_msg_view_window_new_with_header_model): + * src/maemo/modest-msg-view-window.c: + (modest_msg_view_window_new_with_header_model), + (modest_msg_view_window_new): + * src/modest-ui-actions.c: (reply_forward): + * src/widgets/modest-msg-view-window.h: + * src/widgets/modest-window.c: (modest_window_set_active_account): + Rename an account parameter to modest_account_name to make this clearer. + +2007-07-11 Murray Cumming + + * src/modest-ui-actions.h: + * src/modest-ui-actions.c: (headers_action_delete): Moved some code into + modest_do_message_delete(). + * src/dbus_api/modest-dbus-callbacks.c: (on_idle_delete_message): + Call modest_do_message_delete(), hoping that this would cause messages + to be really deleted from search instead of just marked with strike through. + Does not seem to help. + 2007-07-11 Armin Burgmeier * src/widgets/maemo-folder-view.c (modest_folder_view_on_map): Set diff --git a/src/dbus_api/modest-dbus-callbacks.c b/src/dbus_api/modest-dbus-callbacks.c index 92bc33d..b7c9af3 100644 --- a/src/dbus_api/modest-dbus-callbacks.c +++ b/src/dbus_api/modest-dbus-callbacks.c @@ -520,13 +520,12 @@ static gboolean on_idle_open_message (gpointer user_data) { ModestWindow *msg_view = NULL; - TnyMsg *msg; + TnyMsg *msg = NULL; TnyAccount *account = NULL; - TnyHeader *header; - const char *msg_uid; - const char *account_name; - char *uri; - ModestWindowMgr *win_mgr; + TnyHeader *header = NULL; + const char *msg_uid = NULL; + char *uri = NULL; + ModestWindowMgr *win_mgr = NULL; TnyFolder *folder = NULL; uri = (char *) user_data; @@ -547,7 +546,7 @@ on_idle_open_message (gpointer user_data) } header = tny_msg_get_header (msg); - account_name = tny_account_get_name (account); + msg_uid = modest_tny_folder_get_header_unique_id(header); /* FIXME: modest_tny_folder_get_header_unique_id warns against this */ win_mgr = modest_runtime_get_window_mgr (); @@ -564,7 +563,10 @@ on_idle_open_message (gpointer user_data) } else { /* g_debug ("creating new window for this msg"); */ modest_window_mgr_register_header (win_mgr, header); - msg_view = modest_msg_view_window_new (msg,account_name, + + const gchar *modest_account_name = + modest_tny_account_get_parent_modest_account_name_for_server_account (account); + msg_view = modest_msg_view_window_new (msg, modest_account_name, msg_uid); modest_window_mgr_register_window (win_mgr, msg_view); gtk_widget_show_all (GTK_WIDGET (msg_view)); @@ -679,15 +681,17 @@ on_idle_delete_message (gpointer user_data) error = NULL; res = OSSO_OK; - tny_folder_remove_msg (folder, header, &error); - tny_header_set_flags (header, TNY_HEADER_FLAG_SEEN); + + gdk_threads_enter (); + ModestWindow *win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr ()); + modest_do_message_delete (header, win); if (error != NULL) { res = OSSO_ERROR; g_error_free (error); } - gdk_threads_enter (); + ModestWindowMgr *win_mgr = modest_runtime_get_window_mgr (); ModestWindow *msg_view = NULL; diff --git a/src/gnome/modest-msg-view-window.c b/src/gnome/modest-msg-view-window.c index 6b6258d..9d2a788 100644 --- a/src/gnome/modest-msg-view-window.c +++ b/src/gnome/modest-msg-view-window.c @@ -223,7 +223,7 @@ on_delete_event (GtkWidget *widget, GdkEvent *event, ModestMsgViewWindow *self) ModestWindow * modest_msg_view_window_new (TnyMsg *msg, - const gchar *account, + const gchar *modest_account_name, const gchar *msg_uid) { GObject *obj; @@ -336,7 +336,7 @@ modest_msg_view_window_get_message_uid (ModestMsgViewWindow *self) ModestWindow* modest_msg_view_window_new_with_header_model (TnyMsg *msg, - const gchar *account, + const gchar *modest_account_name, const gchar *msg_uid, GtkTreeModel *model, GtkTreeRowReference *row_reference) diff --git a/src/maemo/modest-msg-view-window.c b/src/maemo/modest-msg-view-window.c index 7e39bf7..bbc2bc5 100644 --- a/src/maemo/modest-msg-view-window.c +++ b/src/maemo/modest-msg-view-window.c @@ -513,7 +513,7 @@ select_next_valid_row (GtkTreeModel *model, ModestWindow * modest_msg_view_window_new_with_header_model (TnyMsg *msg, - const gchar *account_name, + const gchar *modest_account_name, const gchar *msg_uid, GtkTreeModel *model, GtkTreeRowReference *row_reference) @@ -521,7 +521,7 @@ modest_msg_view_window_new_with_header_model (TnyMsg *msg, ModestMsgViewWindow *window = NULL; ModestMsgViewWindowPrivate *priv = NULL; - window = MODEST_MSG_VIEW_WINDOW(modest_msg_view_window_new (msg, account_name, msg_uid)); + window = MODEST_MSG_VIEW_WINDOW(modest_msg_view_window_new (msg, modest_account_name, msg_uid)); g_return_val_if_fail (MODEST_IS_MSG_VIEW_WINDOW (window), NULL); priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (window); @@ -543,7 +543,7 @@ modest_msg_view_window_new_with_header_model (TnyMsg *msg, ModestWindow * modest_msg_view_window_new (TnyMsg *msg, - const gchar *account_name, + const gchar *modest_account_name, const gchar *msg_uid) { ModestMsgViewWindow *self = NULL; @@ -665,7 +665,7 @@ modest_msg_view_window_new (TnyMsg *msg, G_CALLBACK (on_queue_changed), obj); - modest_window_set_active_account (MODEST_WINDOW(obj), account_name); + modest_window_set_active_account (MODEST_WINDOW(obj), modest_account_name); priv->last_search = NULL; diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index 430f185..ddf9368 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -237,23 +237,31 @@ headers_action_mark_as_unread (TnyHeader *header, } } - -static void -headers_action_delete (TnyHeader *header, - ModestWindow *win, - gpointer user_data) +/** A convenience method, because deleting a message is + * otherwise complicated, and it's best to change it in one place + * when we change it. + */ +void modest_do_message_delete (TnyHeader *header, ModestWindow *win) { ModestMailOperation *mail_op = NULL; - - mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_TYPE_DELETE, G_OBJECT(win)); + mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_TYPE_DELETE, + win ? G_OBJECT(win) : NULL); modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op); /* Always delete. TODO: Move to trash still not supported */ modest_mail_operation_remove_msg (mail_op, header, FALSE); g_object_unref (G_OBJECT (mail_op)); +} - /* refilter treemodel to hide marked-as-deleted rows */ +static void +headers_action_delete (TnyHeader *header, + ModestWindow *win, + gpointer user_data) +{ + modest_do_message_delete (header, win); + +/* refilter treemodel to hide marked-as-deleted rows */ /* if (MODEST_IS_HEADER_VIEW (user_data)) */ /* modest_header_view_refilter (MODEST_HEADER_VIEW (user_data)); */ } @@ -1202,6 +1210,7 @@ reply_forward (ReplyForwardAction action, ModestWindow *win) rf_helper->reply_forward_type = reply_forward_type; rf_helper->action = action; rf_helper->account_name = g_strdup (modest_window_get_active_account (win)); + if ((win != NULL) && (MODEST_IS_WINDOW (win))) rf_helper->parent_window = GTK_WIDGET (win); if (!rf_helper->account_name) diff --git a/src/modest-ui-actions.h b/src/modest-ui-actions.h index 93a874c..e20b93a 100644 --- a/src/modest-ui-actions.h +++ b/src/modest-ui-actions.h @@ -444,6 +444,11 @@ gboolean modest_ui_actions_msg_retrieval_check (ModestMailOperati void modest_ui_actions_get_msgs_full_error_handler (ModestMailOperation *mail_op, gpointer user_data); +/** A convenience method, because deleting a message is + * otherwise complicated, and it's best to change it in one place + * when we change it. + **/ +void modest_do_message_delete (TnyHeader *header, ModestWindow *win); G_END_DECLS #endif /* __MODEST_UI_ACTIONS_H__ */ diff --git a/src/widgets/modest-msg-view-window.h b/src/widgets/modest-msg-view-window.h index d2c9f0b..f8c523a 100644 --- a/src/widgets/modest-msg-view-window.h +++ b/src/widgets/modest-msg-view-window.h @@ -71,7 +71,7 @@ GType modest_msg_view_window_get_type (void) G_GNUC_CONST; /** * modest_msg_view_window_new: * @msg: an #TnyMsg instance - * @account: the account name + * @modest_account_name: the account name * * instantiates a new #ModestMsgViewWindow widget. The account name is used to * set the proper account when choosing reply/forward from the msg view window @@ -79,7 +79,7 @@ GType modest_msg_view_window_get_type (void) G_GNUC_CONST; * Returns: a new #ModestMsgViewWindow, or NULL in case of error */ ModestWindow* modest_msg_view_window_new (TnyMsg *msg, - const gchar *account, + const gchar *modest_account_name, const gchar *msg_uid); /** @@ -97,7 +97,7 @@ ModestWindow* modest_msg_view_window_new (TnyMsg *msg, * Returns: a new #ModestMsgViewWindow, or NULL in case of error */ ModestWindow* modest_msg_view_window_new_with_header_model (TnyMsg *msg, - const gchar *account, + const gchar *modest_account_name, const gchar *msg_uid, GtkTreeModel *model, GtkTreeRowReference *row_reference); diff --git a/src/widgets/modest-window.c b/src/widgets/modest-window.c index eef669d..94f82a0 100644 --- a/src/widgets/modest-window.c +++ b/src/widgets/modest-window.c @@ -164,6 +164,8 @@ modest_window_get_active_account (ModestWindow *self) void modest_window_set_active_account (ModestWindow *self, const gchar *active_account) { + printf ("DEBUG: %s: active_account=%s\n", __FUNCTION__, active_account); + ModestWindowPrivate *priv; priv = MODEST_WINDOW_GET_PRIVATE(self);