{
GtkWidget *main_menu;
GtkWidget *menubar;
- GList *iter;
+ GList *iter, *children;
/* Create new main menu */
main_menu = gtk_menu_new();
/* Get the menubar from the UI manager */
menubar = gtk_ui_manager_get_widget (ui_manager, "/MenuBar");
- iter = gtk_container_get_children (GTK_CONTAINER (menubar));
+ iter = children = gtk_container_get_children (GTK_CONTAINER (menubar));
while (iter) {
GtkWidget *menu;
menu = GTK_WIDGET (iter->data);
gtk_widget_reparent(menu, main_menu);
-
+
iter = g_list_next (iter);
}
+ g_list_free (children);
+
return main_menu;
}
if (tny_header_get_flags (header) & TNY_HEADER_FLAG_CACHED) {
op_type = MODEST_MAIL_OPERATION_TYPE_OPEN;
} else {
- TnyFolder *folder;
- GtkResponseType response;
-
op_type = MODEST_MAIL_OPERATION_TYPE_RECEIVE;
- /* Ask the user if he wants to download the message */
- response = modest_platform_run_confirmation_dialog (GTK_WINDOW (window),
- _("mcen_nc_get_msg"));
- if (response == GTK_RESPONSE_CANCEL)
- return FALSE;
+ /* Ask the user if he wants to download the message if
+ we're not online */
+ if (!tny_device_is_online (modest_runtime_get_device())) {
+ TnyFolder *folder = NULL;
+ GtkResponseType response;
+
+ response = modest_platform_run_confirmation_dialog (GTK_WINDOW (window),
+ _("mcen_nc_get_msg"));
+ if (response == GTK_RESPONSE_CANCEL)
+ return FALSE;
- /* Offer the connection dialog if necessary */
- /* FIXME: should this stuff go directly to the mail
- operation instead of spread it all over the
- code? */
- folder = tny_header_get_folder (header);
- if (folder) {
- if (!modest_platform_connect_and_wait_if_network_folderstore (NULL, TNY_FOLDER_STORE (folder))) {
+ /* Offer the connection dialog if necessary */
+ folder = tny_header_get_folder (header);
+ if (folder) {
+ if (!modest_platform_connect_and_wait_if_network_folderstore (NULL,
+ TNY_FOLDER_STORE (folder))) {
+ g_object_unref (folder);
+ return FALSE;
+ }
g_object_unref (folder);
- return FALSE;
}
- g_object_unref (folder);
}
}
if (!TNY_IS_MSG (mime_part)) {
gchar *filepath = NULL;
const gchar *att_filename = tny_mime_part_get_filename (mime_part);
- gchar *extension = NULL;
TnyFsStream *temp_stream = NULL;
- if (att_filename) {
- extension = g_strrstr (att_filename, ".");
- if (extension != NULL)
- extension++;
- }
-
- temp_stream = modest_maemo_utils_create_temp_stream (extension, &filepath);
-
+ temp_stream = modest_maemo_utils_create_temp_stream (att_filename, &filepath);
+
if (temp_stream) {
const gchar *content_type;
content_type = tny_mime_part_get_content_type (mime_part);
modest_platform_activate_file (filepath, content_type);
g_object_unref (temp_stream);
g_free (filepath);
- /* TODO: delete temporary file */
+ /* NOTE: files in the temporary area will be automatically
+ * cleaned after some time if they are no longer in use */
}
} else {
/* message attachment */