specified, open the account wizard
* make sure the editor cannot be opened with a NULL account
* Fixes: NB#55368
pmo-trunk-r2221
TNY_ACCOUNT_STORE (modest_runtime_get_account_store ()));
TNY_ACCOUNT_STORE (modest_runtime_get_account_store ()));
+
+ wrap_in_scrolled_window (folder_win, GTK_WIDGET(priv->folder_view));
+ wrap_in_scrolled_window (priv->contents_widget, GTK_WIDGET(priv->header_view));
+
+ /* Load previous osso state, for instance if we are being restored from
+ * hibernation: */
+ modest_osso_load_state();
+
+ /* Restore window & widget settings */
+
+ restore_settings (MODEST_MAIN_WINDOW(self), TRUE);
+
/* Check if accounts exist and show the account wizard if not */
gboolean accounts_exist =
modest_account_mgr_has_accounts(modest_runtime_get_account_mgr(), TRUE);
/* Check if accounts exist and show the account wizard if not */
gboolean accounts_exist =
modest_account_mgr_has_accounts(modest_runtime_get_account_mgr(), TRUE);
-
- if (!accounts_exist)
- {
/* This is necessary to have the main window shown behind the dialog
It's an ugly hack... jschmid */
gtk_widget_show_all(GTK_WIDGET(self));
modest_ui_actions_on_accounts (NULL, MODEST_WINDOW(self));
}
/* This is necessary to have the main window shown behind the dialog
It's an ugly hack... jschmid */
gtk_widget_show_all(GTK_WIDGET(self));
modest_ui_actions_on_accounts (NULL, MODEST_WINDOW(self));
}
- wrap_in_scrolled_window (folder_win, GTK_WIDGET(priv->folder_view));
- wrap_in_scrolled_window (priv->contents_widget, GTK_WIDGET(priv->header_view));
-
- /* Load previous osso state, for instance if we are being restored from
- * hibernation: */
- modest_osso_load_state();
-
- /* Restore window & widget settings */
-
- restore_settings (MODEST_MAIN_WINDOW(self), TRUE);
G_CALLBACK (on_hildon_program_is_topmost_notify), self);
g_signal_connect (G_OBJECT(self), "show",
G_CALLBACK (on_hildon_program_is_topmost_notify), self);
g_signal_connect (G_OBJECT(self), "show",
- G_CALLBACK (modest_main_window_on_show), folder_win);
+ G_CALLBACK (modest_main_window_on_show), folder_win);
restore_settings (MODEST_MAIN_WINDOW(self), FALSE);
restore_settings (MODEST_MAIN_WINDOW(self), FALSE);
gint file_format;
g_return_val_if_fail (msg, NULL);
gint file_format;
g_return_val_if_fail (msg, NULL);
+ g_return_val_if_fail (account_name, NULL);
obj = g_object_new(MODEST_TYPE_MSG_EDIT_WINDOW, NULL);
obj = g_object_new(MODEST_TYPE_MSG_EDIT_WINDOW, NULL);
g_object_unref (action_group);
/* Load the UI definition */
g_object_unref (action_group);
/* Load the UI definition */
- gtk_ui_manager_add_ui_from_file (parent_priv->ui_manager, MODEST_UIDIR "modest-msg-edit-window-ui.xml", &error);
+ gtk_ui_manager_add_ui_from_file (parent_priv->ui_manager, MODEST_UIDIR "modest-msg-edit-window-ui.xml",
+ &error);
if (error != NULL) {
g_warning ("Could not merge modest-msg-edit-window-ui.xml: %s", error->message);
g_clear_error (&error);
if (error != NULL) {
g_warning ("Could not merge modest-msg-edit-window-ui.xml: %s", error->message);
g_clear_error (&error);
+static void
+run_account_setup_wizard (ModestWindow *win)
+{
+ ModestEasysetupWizardDialog *wizard;
+
+ g_return_if_fail (MODEST_IS_WINDOW(win));
+
+ wizard = modest_easysetup_wizard_dialog_new ();
+ gtk_window_set_transient_for (GTK_WINDOW (wizard), GTK_WINDOW (win));
+ gtk_dialog_run (GTK_DIALOG (wizard));
+ gtk_widget_destroy (GTK_WIDGET (wizard));
+}
+
+
void
modest_ui_actions_on_about (GtkAction *action, ModestWindow *win)
{
void
modest_ui_actions_on_about (GtkAction *action, ModestWindow *win)
{
void
modest_ui_actions_on_accounts (GtkAction *action, ModestWindow *win)
{
void
modest_ui_actions_on_accounts (GtkAction *action, ModestWindow *win)
{
- /* This is currently only implemented for Maemo,
- * because it requires a providers preset file which is not publically available.
- */
+ /* This is currently only implemented for Maemo */
#ifdef MODEST_PLATFORM_MAEMO /* Defined in config.h */
#ifdef MODEST_PLATFORM_MAEMO /* Defined in config.h */
- gboolean accounts_exist = modest_account_mgr_has_accounts(
- modest_runtime_get_account_mgr(), TRUE);
-
- if (!accounts_exist) {
- /* If there are no accounts yet, just show the easy-setup wizard, as per the UI spec: */
- ModestEasysetupWizardDialog *wizard = modest_easysetup_wizard_dialog_new ();
- gtk_window_set_transient_for (GTK_WINDOW (wizard), GTK_WINDOW (win));
- gtk_dialog_run (GTK_DIALOG (wizard));
- gtk_widget_destroy (GTK_WIDGET (wizard));
+ if (!modest_account_mgr_has_accounts(modest_runtime_get_account_mgr(), TRUE)) {
+ run_account_setup_wizard (win);
+ return;
} else {
/* Show the list of accounts: */
GtkDialog *account_win = GTK_DIALOG(modest_account_view_window_new ());
} else {
/* Show the list of accounts: */
GtkDialog *account_win = GTK_DIALOG(modest_account_view_window_new ());
gtk_widget_destroy (GTK_WIDGET (window));
}
gtk_widget_destroy (GTK_WIDGET (window));
}
void
modest_ui_actions_on_smtp_servers (GtkAction *action, ModestWindow *win)
{
void
modest_ui_actions_on_smtp_servers (GtkAction *action, ModestWindow *win)
{
TnyAccount *account = NULL;
ModestWindowMgr *mgr;
gchar *signature = NULL, *blank_and_signature = NULL;
TnyAccount *account = NULL;
ModestWindowMgr *mgr;
gchar *signature = NULL, *blank_and_signature = NULL;
+
+ /* if there are no accounts yet, just show the wizard */
+ if (!modest_account_mgr_has_accounts (modest_runtime_get_account_mgr(), TRUE)) {
+ run_account_setup_wizard (win);
+ return;
+ }
account_name = g_strdup(modest_window_get_active_account (win));
if (!account_name)
account_name = g_strdup(modest_window_get_active_account (win));
if (!account_name)
-/* tny_folder_add_msg (folder, msg, &err); */
-/* if (err) { */
-/* g_printerr ("modest: error adding msg to Drafts folder: %s", */
-/* err->message); */
-/* g_error_free (err); */
-/* goto cleanup; */
-/* } */
/* Create and register edit window */
/* This is destroyed by TOOD. */
/* Create and register edit window */
/* This is destroyed by TOOD. */
/* If the header is in the drafts folder then open the editor,
else the message view window */
if (folder_type == TNY_FOLDER_TYPE_DRAFTS) {
/* If the header is in the drafts folder then open the editor,
else the message view window */
if (folder_type == TNY_FOLDER_TYPE_DRAFTS) {
+ /* we cannot edit without a valid account... */
+ if (!modest_account_mgr_has_accounts(modest_runtime_get_account_mgr(), TRUE)) {
+ run_account_setup_wizard(parent_win);
+ goto cleanup;
+ }
win = modest_msg_edit_window_new (msg, account);
} else {
gchar *uid = modest_tny_folder_get_header_unique_id (header);
win = modest_msg_edit_window_new (msg, account);
} else {
gchar *uid = modest_tny_folder_get_header_unique_id (header);
gtk_widget_show_all (GTK_WIDGET(win));
}
gtk_widget_show_all (GTK_WIDGET(win));
}
/* Free */
g_free(account);
g_object_unref (msg);
/* Free */
g_free(account);
g_object_unref (msg);
g_return_if_fail (MODEST_IS_WINDOW(win));
g_return_if_fail (MODEST_IS_WINDOW(win));
+ /* we need an account when editing */
+ if (!modest_account_mgr_has_accounts(modest_runtime_get_account_mgr(), TRUE)) {
+ run_account_setup_wizard (win);
+ return;
+ }
+
header_list = get_selected_headers (win);
if (!header_list)
return;
header_list = get_selected_headers (win);
if (!header_list)
return;
G_CALLBACK (on_nonhibernating_window_hide), self);
}
G_CALLBACK (on_nonhibernating_window_hide), self);
}
-void modest_window_mgr_prevent_hibernation_while_window_is_shown (ModestWindowMgr *self, GtkWindow *window)
+void modest_window_mgr_prevent_hibernation_while_window_is_shown (ModestWindowMgr *self,
+ GtkWindow *window)
{
g_return_if_fail (MODEST_IS_WINDOW_MGR (self));
if (GTK_WIDGET_VISIBLE(window)) {
on_nonhibernating_window_show (GTK_WIDGET (window), self);
{
g_return_if_fail (MODEST_IS_WINDOW_MGR (self));
if (GTK_WIDGET_VISIBLE(window)) {
on_nonhibernating_window_show (GTK_WIDGET (window), self);
/* Wait for it to be shown: */
g_signal_connect (window, "show",
G_CALLBACK (on_nonhibernating_window_show), self);
/* Wait for it to be shown: */
g_signal_connect (window, "show",
G_CALLBACK (on_nonhibernating_window_show), self);