if (tny_list_get_length (att_list) == 0) {
hildon_banner_show_information (NULL, NULL, _("TODO: no attachments selected to remove"));
} else {
- GtkWidget *confirmation_dialog = NULL;
gboolean dialog_response;
gchar *message = NULL;
gchar *filename = NULL;
message = g_strdup_printf (ngettext("emev_nc_delete_attachment", "emev_nc_delete_attachments",
tny_list_get_length (att_list)), filename);
g_free (filename);
- confirmation_dialog = hildon_note_new_confirmation (GTK_WINDOW (window), message);
+
+ dialog_response = modest_platform_run_confirmation_dialog (GTK_WINDOW (window), message);
g_free (message);
- dialog_response = (gtk_dialog_run (GTK_DIALOG (confirmation_dialog))==GTK_RESPONSE_OK);
- gtk_widget_destroy (confirmation_dialog);
- if (!dialog_response) {
+
+ if (dialog_response != GTK_RESPONSE_OK) {
g_object_unref (att_list);
return;
}
}
-
void
modest_msg_view_window_save_attachments (ModestMsgViewWindow *window, TnyList *mime_parts)
{
gint n_attachments;
TnyMsg *msg;
TnyIterator *iter;
-/* TnyFolder *folder; */
g_return_if_fail (MODEST_IS_MSG_VIEW_WINDOW (window));
priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (window);
}
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); */
iter = tny_list_create_iterator (mime_parts);
while (!tny_iterator_is_done (iter)) {
part = (TnyMimePart *) tny_iterator_get_current (iter);
tny_mime_part_set_purged (TNY_MIME_PART (part));
-/* modest_msg_view_remove_attachment (MODEST_MSG_VIEW (priv->msg_view), node->data); */
g_object_unref (part);
tny_iterator_next (iter);
}
static void
-on_destroy_dialog (GtkDialog *dialog)
+on_destroy_dialog (GtkWidget *dialog)
{
- gtk_widget_destroy (GTK_WIDGET(dialog));
+ /* This could happen when the dialogs get programatically
+ hidden or destroyed (for example when closing the
+ application while a dialog is being shown) */
+ if (!GTK_IS_WIDGET (dialog))
+ return;
+
+ gtk_widget_destroy (dialog);
+
if (gtk_events_pending ())
gtk_main_iteration ();
}
response = gtk_dialog_run (GTK_DIALOG (dialog));
- on_destroy_dialog (GTK_DIALOG(dialog));
-
- while (gtk_events_pending ())
- gtk_main_iteration ();
+ on_destroy_dialog (dialog);
return response;
}
response = gtk_dialog_run (GTK_DIALOG (dialog));
- on_destroy_dialog (GTK_DIALOG(dialog));
-
- while (gtk_events_pending ())
- gtk_main_iteration ();
+ on_destroy_dialog (dialog);
return response;
}
modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (dialog));
response = gtk_dialog_run (GTK_DIALOG (dialog));
- on_destroy_dialog (GTK_DIALOG(dialog));
-
- while (gtk_events_pending ())
- gtk_main_iteration ();
+ on_destroy_dialog (dialog);
return response;
}
if (block) {
gtk_dialog_run (GTK_DIALOG (note));
- on_destroy_dialog (GTK_DIALOG (note));
-
- while (gtk_events_pending ())
- gtk_main_iteration ();
+ on_destroy_dialog (note);
} else {
g_signal_connect_swapped (note,
"response",
}
/* Free */
- on_destroy_dialog (GTK_DIALOG(dialog));
+ on_destroy_dialog (dialog);
}
GTK_WINDOW (note));
response = gtk_dialog_run(GTK_DIALOG(note));
- on_destroy_dialog (GTK_DIALOG(note));
+ on_destroy_dialog (note);
g_free (question);
return response == GTK_RESPONSE_OK;
const int response = gtk_dialog_run (GTK_DIALOG (dialog));
retval = (response == GTK_RESPONSE_YES) || (response == GTK_RESPONSE_OK);
- on_destroy_dialog (GTK_DIALOG(dialog));
+ on_destroy_dialog (dialog);
} else {
/* Just show the error text and use the default response: */
modest_platform_run_information_dialog (GTK_WINDOW (main_win),