* src/maemo/modest-msg-view-window.c:
authorJose Dapena Paz <jdapena@igalia.com>
Fri, 3 Aug 2007 21:45:58 +0000 (21:45 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Fri, 3 Aug 2007 21:45:58 +0000 (21:45 +0000)
        * Now the removing attachments banner is shown after 2 seconds
          of progress of the operation, and not at the end of the
          operation (fixes NB#63026).

pmo-trunk-r2931

src/maemo/modest-msg-view-window.c

index 45cc3f7..ef442c1 100644 (file)
@@ -169,6 +169,9 @@ struct _ModestMsgViewWindowPrivate {
        guint queue_change_handler;
        guint account_removed_handler;
 
        guint queue_change_handler;
        guint account_removed_handler;
 
+       guint purge_timeout;
+       GtkWidget *remove_attachment_banner;
+
        guint progress_bar_timeout;
 
        gchar *msg_uid;
        guint progress_bar_timeout;
 
        gchar *msg_uid;
@@ -271,6 +274,8 @@ modest_msg_view_window_init (ModestMsgViewWindow *obj)
 
        priv->optimized_view  = FALSE;
        priv->progress_bar_timeout = 0;
 
        priv->optimized_view  = FALSE;
        priv->progress_bar_timeout = 0;
+       priv->purge_timeout = 0;
+       priv->remove_attachment_banner = NULL;
        priv->msg_uid = NULL;
 }
 
        priv->msg_uid = NULL;
 }
 
@@ -490,6 +495,17 @@ modest_msg_view_window_finalize (GObject *obj)
                priv->progress_bar_timeout = 0;
        }
 
                priv->progress_bar_timeout = 0;
        }
 
+       if (priv->remove_attachment_banner) {
+               gtk_widget_destroy (priv->remove_attachment_banner);
+               g_object_unref (priv->remove_attachment_banner);
+               priv->remove_attachment_banner = NULL;
+       }
+
+       if (priv->purge_timeout > 0) {
+               g_source_remove (priv->purge_timeout);
+               priv->purge_timeout = 0;
+       }
+
        if (priv->row_reference) {
                gtk_tree_row_reference_free (priv->row_reference);
                priv->row_reference = NULL;
        if (priv->row_reference) {
                gtk_tree_row_reference_free (priv->row_reference);
                priv->row_reference = NULL;
@@ -2054,6 +2070,23 @@ modest_msg_view_window_save_attachments (ModestMsgViewWindow *window, GList *mim
        }
 }
 
        }
 }
 
+static gboolean
+show_remove_attachment_information (gpointer userdata)
+{
+       ModestMsgViewWindow *window = (ModestMsgViewWindow *) userdata;
+       ModestMsgViewWindowPrivate *priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (window);
+
+       if (priv->remove_attachment_banner != NULL) {
+               gtk_widget_destroy (priv->remove_attachment_banner);
+               g_object_unref (priv->remove_attachment_banner);
+       }
+
+       priv->remove_attachment_banner = g_object_ref (
+               hildon_banner_show_animation (NULL, NULL, _("mcen_ib_removing_attachment")));
+
+       return FALSE;
+}
+
 void
 modest_msg_view_window_remove_attachments (ModestMsgViewWindow *window, gboolean get_all)
 {
 void
 modest_msg_view_window_remove_attachments (ModestMsgViewWindow *window, gboolean get_all)
 {
@@ -2117,13 +2150,12 @@ modest_msg_view_window_remove_attachments (ModestMsgViewWindow *window, gboolean
        if (response != GTK_RESPONSE_OK)
                return;
 
        if (response != GTK_RESPONSE_OK)
                return;
 
+       priv->purge_timeout = g_timeout_add (2000, show_remove_attachment_information, window);
 /*     folder = tny_msg_get_folder (msg); */
 /*     tny_msg_uncache_attachments (msg); */
 /*     tny_folder_refresh (folder, NULL); */
 /*     g_object_unref (folder); */
        
 /*     folder = tny_msg_get_folder (msg); */
 /*     tny_msg_uncache_attachments (msg); */
 /*     tny_folder_refresh (folder, NULL); */
 /*     g_object_unref (folder); */
        
-       modest_platform_information_banner (NULL, NULL, _("mcen_ib_removing_attachment"));
-
        for (node = mime_parts; node != NULL; node = g_list_next (node)) {
                tny_mime_part_set_purged (TNY_MIME_PART (node->data));
 /*             modest_msg_view_remove_attachment (MODEST_MSG_VIEW (priv->msg_view), node->data); */
        for (node = mime_parts; node != NULL; node = g_list_next (node)) {
                tny_mime_part_set_purged (TNY_MIME_PART (node->data));
 /*             modest_msg_view_remove_attachment (MODEST_MSG_VIEW (priv->msg_view), node->data); */
@@ -2137,6 +2169,17 @@ modest_msg_view_window_remove_attachments (ModestMsgViewWindow *window, gboolean
        g_list_foreach (mime_parts, (GFunc) g_object_unref, NULL);
        g_list_free (mime_parts);
 
        g_list_foreach (mime_parts, (GFunc) g_object_unref, NULL);
        g_list_free (mime_parts);
 
+       if (priv->purge_timeout > 0) {
+               g_source_remove (priv->purge_timeout);
+               priv->purge_timeout = 0;
+       }
+
+       if (priv->remove_attachment_banner) {
+               gtk_widget_destroy (priv->remove_attachment_banner);
+               g_object_unref (priv->remove_attachment_banner);
+               priv->remove_attachment_banner = NULL;
+       }
+
 
 }
 
 
 }