gboolean
modest_ui_actions_run_account_setup_wizard (ModestWindow *win)
{
- gboolean result = FALSE;
+ gboolean result = FALSE;
GtkWindow *wizard;
gint dialog_response;
- /* there is no such wizard yet */
+ /* there is no such wizard yet */
wizard = GTK_WINDOW (modest_platform_get_account_settings_wizard ());
modest_window_mgr_set_modal (modest_runtime_get_window_mgr(), GTK_WINDOW (wizard), (GtkWindow *) win);
if (!win)
win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr(),
TRUE); /* create if not existent */
-
+
gtk_window_set_transient_for (GTK_WINDOW (wizard), GTK_WINDOW (win));
/* make sure the mainwindow is visible. We need to present the
gtk_window_present (GTK_WINDOW (win));
gtk_window_present (GTK_WINDOW (wizard));
#endif
-
+
dialog_response = gtk_dialog_run (GTK_DIALOG (wizard));
gtk_widget_destroy (GTK_WIDGET (wizard));
if (gtk_events_pending ())
ModestTnyAccountStore *store = modest_runtime_get_account_store();
GnomeVFSFileSize total_size, allowed_size;
- /* we check for low-mem; in that case, show a warning, and don't allow
- * composing a message with attachments
- */
- if (attachments && modest_platform_check_memory_low (win, TRUE))
+ /* we check for low-mem */
+ if (modest_platform_check_memory_low (win, TRUE))
goto cleanup;
#ifdef MODEST_TOOLKIT_HILDON2
if (traccount) {
ModestTnySendQueue *send_queue = NULL;
ModestTnySendQueueStatus status;
- char *msg_id;
+ gchar *msg_id;
account = g_strdup(modest_tny_account_get_parent_modest_account_name_for_server_account(
TNY_ACCOUNT(traccount)));
send_queue = modest_runtime_get_send_queue(traccount, TRUE);
ModestMainWindow *main_window)
{
TnyList *headers;
- GtkWidget *open_widget;
g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
return;
modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (main_window));
- open_widget = modest_window_get_action_widget (MODEST_WINDOW (main_window), "/MenuBar/EmailMenu/EmailOpenMenu");
- if (!GTK_WIDGET_IS_SENSITIVE (open_widget))
- return;
headers = modest_header_view_get_selected_headers (header_view);
return;
if (TNY_IS_FOLDER (folder)) {
- gchar *folder_name;
+ gchar *folder_name = NULL;
gint response;
const gchar *current_name;
TnyFolderStore *parent;
"username in the get_password() callback.\n", __FUNCTION__);
}
} else {
+ g_free (*username);
+ *username = NULL;
/* Show error */
modest_platform_information_banner (GTK_WIDGET (dialog), NULL,
_("mcen_ib_username_pw_incorrect"));
*remember = FALSE;
*/
+ g_free (initial_username);
gtk_widget_destroy (dialog);
g_slice_free (PasswordDialogFields, fields);
gtk_text_buffer_paste_clipboard (buffer, clipboard, NULL, TRUE);
} else if (MODEST_IS_MSG_EDIT_WINDOW (window)) {
ModestMailOperation *mail_op;
- TnyFolder *src_folder;
- TnyList *data;
+ TnyFolder *src_folder = NULL;
+ TnyList *data = NULL;
gboolean delete;
PasteAsAttachmentHelper *helper = g_new0 (PasteAsAttachmentHelper, 1);
helper->window = MODEST_MSG_EDIT_WINDOW (window);
helper,
paste_as_attachment_free);
}
+ /* Free */
+ if (data)
+ g_object_unref (data);
+ if (src_folder)
+ g_object_unref (src_folder);
+
}
} else if (MODEST_IS_FOLDER_VIEW (focused_widget)) {
ModestEmailClipboard *clipboard = NULL;
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (toggle));
- /* Check if we want to toggle the toolbar vuew in fullscreen
+ /* Check if we want to toggle the toolbar view in fullscreen
or normal mode */
if (!strcmp (gtk_action_get_name (GTK_ACTION (toggle)),
"ViewShowToolbarFullScreen")) {
return msg;
}
+
+gboolean
+modest_ui_actions_on_delete_account (GtkWindow *parent_window,
+ const gchar *account_name,
+ const gchar *account_title)
+{
+ ModestAccountMgr *account_mgr;
+ gchar *txt = NULL;
+ gint response;
+ ModestProtocol *protocol;
+ gboolean removed = FALSE;
+
+ g_return_val_if_fail (account_name, FALSE);
+ g_return_val_if_fail (account_title, FALSE);
+
+ account_mgr = modest_runtime_get_account_mgr();
+
+ /* The warning text depends on the account type: */
+ protocol = modest_protocol_registry_get_protocol_by_type (modest_runtime_get_protocol_registry (),
+ modest_account_mgr_get_store_protocol (account_mgr,
+ account_name));
+ txt = modest_protocol_get_translation (protocol,
+ MODEST_PROTOCOL_TRANSLATION_DELETE_MAILBOX,
+ account_title);
+ if (txt == NULL)
+ txt = g_strdup_printf (_("emev_nc_delete_mailbox"), account_title);
+
+ response = modest_platform_run_confirmation_dialog (parent_window, txt);
+ g_free (txt);
+ txt = NULL;
+
+ if (response == GTK_RESPONSE_OK) {
+ /* Remove account. If it succeeds then it also removes
+ the account from the ModestAccountView: */
+ gboolean is_default = FALSE;
+ gchar *default_account_name = modest_account_mgr_get_default_account (account_mgr);
+ if (default_account_name && (strcmp (default_account_name, account_name) == 0))
+ is_default = TRUE;
+ g_free (default_account_name);
+
+ removed = modest_account_mgr_remove_account (account_mgr, account_name);
+ if (!removed)
+ g_warning ("%s: modest_account_mgr_remove_account() failed.\n", __FUNCTION__);
+ }
+ return removed;
+}