gpointer user_data);
static gboolean
-download_uncached_messages (TnyList *header_list, GtkWindow *win,
- gboolean reply_fwd);
+download_uncached_messages (TnyList *header_list, GtkWindow *win);
-static gint
+/*static gint
msgs_move_to_confirmation (GtkWindow *win,
TnyFolder *dest_folder,
gboolean delete,
- TnyList *headers);
+ TnyList *headers);*/
/* Show the account creation wizard dialog.
g_return_val_if_fail (MODEST_IS_WINDOW(win), FALSE);
- wizard = modest_easysetup_wizard_dialog_new ();
+ wizard = modest_easysetup_wizard_dialog_new_or_present ();
+
+ /* if wizard == NULL it means there is already a easy setup thingy running;
+ * in that case, don't do anything here; the call above will present it instead */
+ if (!wizard) {
+ g_message ("%s: easysetup wizard already running", __FUNCTION__);
+ return FALSE;
+ }
+
gtk_window_set_transient_for (GTK_WINDOW (wizard), GTK_WINDOW (win));
-
+
/* Don't make this a modal window, because secondary windows will then
* be unusable, freezing the UI: */
/* gtk_window_set_modal (GTK_WINDOW (wizard), TRUE); */
tny_list_get_length(header_list)), desc);
/* Confirmation dialog */
- printf("DEBUG: %s\n", __FUNCTION__);
response = modest_platform_run_confirmation_dialog (GTK_WINDOW (win),
message);
goto cleanup;
}
- if (modest_account_mgr_get_bool (modest_runtime_get_account_mgr (), account_name,
- MODEST_ACCOUNT_USE_SIGNATURE, FALSE)) {
- signature = modest_account_mgr_get_string (modest_runtime_get_account_mgr (), account_name,
- MODEST_ACCOUNT_SIGNATURE, FALSE);
+ gboolean use_signature = FALSE;
+ signature = modest_account_mgr_get_signature (modest_runtime_get_account_mgr (), account_name, &use_signature);
+
+ if (use_signature) {
blank_and_signature = g_strconcat ("\n", signature, NULL);
- g_free (signature);
} else {
blank_and_signature = g_strdup ("");
}
+ g_free (signature);
+
msg = modest_tny_msg_new ("", from_str, "", "", "", blank_and_signature, NULL);
if (!msg) {
g_printerr ("modest: failed to create new msg\n");
/* Create and register edit window */
- /* This is destroyed by TOOD. */
+ /* This is destroyed by TODO. */
msg_win = modest_msg_edit_window_new (msg, account_name, FALSE);
mgr = modest_runtime_get_window_mgr ();
modest_window_mgr_register_window (mgr, msg_win);
g_list_foreach (sel_list, (GFunc) gtk_tree_path_free, NULL);
g_list_free (sel_list);
- win = modest_msg_view_window_new_with_header_model (msg,
- account,
- (const gchar*) uid,
- model,
- row_reference);
+ win = modest_msg_view_window_new_with_header_model (
+ msg, account, (const gchar*) uid,
+ model, row_reference);
gtk_tree_row_reference_free (row_reference);
} else {
- win = modest_msg_view_window_new (msg, account, (const gchar*) uid);
+ win = modest_msg_view_window_new_for_attachment (msg, account, (const gchar*) uid);
}
} else {
- win = modest_msg_view_window_new (msg, account, (const gchar*) uid);
+ win = modest_msg_view_window_new_for_attachment (msg, account, (const gchar*) uid);
}
g_free (uid);
}
*/
static gboolean
download_uncached_messages (TnyList *header_list,
- GtkWindow *win,
- gboolean reply_fwd)
+ GtkWindow *win)
{
TnyIterator *iter;
gboolean retval;
/* Ask for user permission to download the messages */
retval = TRUE;
if (uncached_messages > 0) {
- GtkResponseType response;
- if (reply_fwd)
- response = modest_platform_run_confirmation_dialog (GTK_WINDOW (win),
- _("emev_nc_include_original"));
- else
- response =
+ gboolean download = TRUE;
+ if (!tny_device_is_online (modest_runtime_get_device())) {
+ GtkResponseType response =
modest_platform_run_confirmation_dialog (GTK_WINDOW (win),
ngettext("mcen_nc_get_msg",
"mcen_nc_get_msgs",
uncached_messages));
- if (response == GTK_RESPONSE_CANCEL)
- retval = FALSE;
- else {
+ if (response == GTK_RESPONSE_CANCEL) download = FALSE;
+ }
+ if (download) {
/* If a download will be necessary, make sure that we have a connection: */
retval = modest_platform_connect_and_wait(win, NULL);
+ } else {
+ retval = FALSE;
}
}
return retval;
/* Check that the messages have been previously downloaded */
do_retrieve = (action == ACTION_FORWARD) || (reply_forward_type != MODEST_TNY_MSG_REPLY_TYPE_CITE);
if (do_retrieve)
- continue_download = download_uncached_messages (header_list, GTK_WINDOW (win), TRUE);
+ continue_download = download_uncached_messages (header_list, GTK_WINDOW (win));
if (!continue_download) {
g_object_unref (header_list);
return;
if (!gtk_widget_is_focus (GTK_WIDGET(header_view)))
gtk_widget_grab_focus (GTK_WIDGET(header_view));
- /* Update Main window title */
- if (gtk_widget_is_focus (GTK_WIDGET(header_view))) {
- const gchar *subject = tny_header_get_subject (header);
- if (subject && strlen(subject) > 0)
- gtk_window_set_title (GTK_WINDOW (main_window), subject);
- else
- gtk_window_set_title (GTK_WINDOW (main_window), _("mail_va_no_subject"));
- }
-
/* Update toolbar dimming state */
modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (main_window));
}
ModestMainWindow *win = NULL;
GtkWidget *header_view;
TnyFolder *current_folder;
- gboolean folder_empty = TRUE;
- gboolean all_marked_as_deleted = TRUE;
+ gboolean folder_empty = FALSE;
+ gboolean all_marked_as_deleted = FALSE;
g_return_if_fail (TNY_IS_FOLDER (folder));
gchar *from = modest_account_mgr_get_from_string (account_mgr, account_name);
- /* mail content checks and dialogs */
- if (data->subject == NULL || data->subject[0] == '\0') {
- GtkResponseType response;
- response = modest_platform_run_confirmation_dialog (GTK_WINDOW (edit_window),
- _("mcen_nc_subject_is_empty_send"));
- if (response == GTK_RESPONSE_CANCEL) {
- g_free (account_name);
- return;
- }
- }
-
- if (data->plain_body == NULL || data->plain_body[0] == '\0') {
- GtkResponseType response;
- gchar *note_message;
- gchar *note_subject = data->subject;
- if (note_subject == NULL || note_subject[0] == '\0')
- note_subject = _("mail_va_no_subject");
- note_message = g_strdup_printf (_("emev_ni_ui_smtp_message_null"), note_subject);
- response = modest_platform_run_confirmation_dialog (GTK_WINDOW (edit_window),
- note_message);
- g_free (note_message);
- if (response == GTK_RESPONSE_CANCEL) {
- g_free (account_name);
- return;
- }
- }
-
- modest_platform_information_banner (NULL, NULL, _("mcen_ib_outbox_waiting_to_be_sent"));
+/* modest_platform_information_banner (NULL, NULL, _("mcen_ib_outbox_waiting_to_be_sent")); */
/* Create the mail operation */
ModestMailOperation *mail_operation = modest_mail_operation_new (MODEST_MAIL_OPERATION_TYPE_SEND, G_OBJECT(edit_window));
gchar *folder_name;
gint response;
const gchar *current_name;
+ TnyFolderStore *parent;
current_name = tny_folder_get_name (TNY_FOLDER (folder));
- response = modest_platform_run_rename_folder_dialog (GTK_WINDOW (main_window), NULL,
- current_name, &folder_name);
+ parent = tny_folder_get_folder_store (TNY_FOLDER (folder));
+ response = modest_platform_run_rename_folder_dialog (GTK_WINDOW (main_window),
+ parent, current_name,
+ &folder_name);
+ g_object_unref (parent);
if (response == GTK_RESPONSE_ACCEPT && strlen (folder_name) > 0) {
ModestMailOperation *mail_op;
G_OBJECT(main_window),
modest_ui_actions_rename_folder_error_handler,
main_window);
+
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
mail_op);
/* Check that the messages have been previously downloaded */
gboolean continue_download = TRUE;
if (ask)
- continue_download = download_uncached_messages (header_list, GTK_WINDOW (window), FALSE);
+ continue_download = download_uncached_messages (header_list, GTK_WINDOW (window));
if (continue_download)
modest_header_view_copy_selection (MODEST_HEADER_VIEW (focused_widget));
g_object_unref (header_list);
/* Create folder view */
*tree_view = modest_platform_create_folder_view (NULL);
+/* *tree_view = modest_folder_view_new (NULL); */
g_signal_connect (G_OBJECT (new_button), "clicked", G_CALLBACK(create_move_to_dialog_on_new_folder), *tree_view);
window (msg window for example) after the main window was
closed, so we can not just get the model of the folder
view */
- if (MODEST_IS_FOLDER_VIEW (folder_view))
- gtk_tree_view_set_model (GTK_TREE_VIEW (*tree_view),
- gtk_tree_view_get_model (GTK_TREE_VIEW (folder_view)));
- else
+ if (MODEST_IS_FOLDER_VIEW (folder_view)) {
+ modest_folder_view_copy_model (MODEST_FOLDER_VIEW(folder_view),
+ MODEST_FOLDER_VIEW(*tree_view));
+ } else
modest_folder_view_update_model (MODEST_FOLDER_VIEW (*tree_view),
TNY_ACCOUNT_STORE (modest_runtime_get_account_store ()));
+ /* Hide special folders */
modest_folder_view_show_non_move_folders (MODEST_FOLDER_VIEW (*tree_view), FALSE);
gtk_container_add (GTK_CONTAINER (scroll), *tree_view);
* Returns TRUE if at least one of the headers of the list belongs to
* a message that has been fully retrieved.
*/
+#if 0 /* no longer in use. delete in 2007.10 */
static gboolean
has_retrieved_msgs (TnyList *list)
{
return found;
}
+#endif /* 0 */
+
/*
* Shows a confirmation dialog to the user when we're moving messages
* response. If it's other kind of movement the it always returns
* GTK_RESPONSE_OK
*/
-static gint
+gint
msgs_move_to_confirmation (GtkWindow *win,
TnyFolder *dest_folder,
gboolean delete,
/* If the destination is a local folder (or MMC folder )*/
if (!modest_tny_folder_is_remote_folder (dest_folder)) {
-/* if (modest_tny_folder_is_local_folder (dest_folder)) { */
+
+ gboolean is_online;
+ TnyDevice *device;
+
TnyFolder *src_folder = NULL;
TnyIterator *iter = NULL;
TnyHeader *header = NULL;
+ /* get the device */
+
+ device = modest_runtime_get_device ();
+ if (device)
+ is_online = tny_device_is_online (device);
+ else {
+ g_warning ("failed to get tny device"); /* should not happend */
+ is_online = FALSE;
+ }
+
/* Get source folder */
iter = tny_list_create_iterator (headers);
header = TNY_HEADER (tny_iterator_get_current (iter));
return GTK_RESPONSE_CANCEL;
/* If the source is a remote folder */
-/* if (!modest_tny_folder_is_local_folder (src_folder)) { */
- if (modest_tny_folder_is_remote_folder (src_folder)) {
+ if (!is_online && modest_tny_folder_is_remote_folder (src_folder)) {
+
const gchar *message = NULL;
- gboolean cached = has_retrieved_msgs (headers);
- if (cached)
- message = ngettext ("mcen_nc_move_retrieve", "mcen_nc_move_retrieves",
- tny_list_get_length (headers));
- else
- message = ngettext ("mcen_nc_move_header", "mcen_nc_move_headers",
- tny_list_get_length (headers));
-
- if (cached && !delete)
- response = GTK_RESPONSE_OK;
- else
- response = modest_platform_run_confirmation_dialog (GTK_WINDOW (win),
- (const gchar *) message);
- }
+ message = ngettext ("mcen_nc_get_msg", "mcen_nc_get_msgs",
+ tny_list_get_length (headers));
+ response = modest_platform_run_confirmation_dialog (GTK_WINDOW (win),
+ (const gchar *) message);
+ } else
+ response = GTK_RESPONSE_OK;
g_object_unref (src_folder);
}
dst_account = tny_folder_get_account (TNY_FOLDER (dst_folder));
proto_str = tny_account_get_proto (dst_account);
- dst_is_pop = (modest_protocol_info_get_transport_store_protocol (proto_str) ==
- MODEST_PROTOCOL_STORE_POP);
+
+ /* tinymail will return NULL for local folders it seems */
+ dst_is_pop = proto_str &&
+ (modest_protocol_info_get_transport_store_protocol (proto_str) ==
+ MODEST_PROTOCOL_STORE_POP);
+
g_object_unref (dst_account);
/* Get selected headers */
g_object_unref (headers);
}
-
/*
* UI handler for the "Move to" action when invoked from the
* ModestMainWindow