2007-08-15 Murray Cumming <murrayc@murrayc.com>
+ * src/modest-ui-actions.h:
+ * src/modest-ui-actions.c: Renamed modest_run_account_setup_wizard()
+ to modest_run_account_setup_wizard() and made it public.
+ * src/dbus_api/modest-dbus-callbacks.c:
+ (check_and_offer_account_creation), (on_idle_mail_to),
+ (on_idle_compose_mail), (on_idle_open_default_inbox):
+ Offer account creation if necessary, fixing projects.maemo.org
+ bug NB#63713.
+
+2007-08-15 Murray Cumming <murrayc@murrayc.com>
+
+ * src/modest-ui-actions.c: (run_account_setup_wizard):
+ Return a gboolean to indicate success.
+ (modest_ui_actions_on_new_msg), (open_msg_cb), (reply_forward),
+ (modest_ui_actions_on_send): When offering account creation, only
+ give up (return) if account creation failed. Otherwise continue
+ with the original request. This fixed projects.maemo.org bug
+ NB#64317.
+
+2007-08-15 Murray Cumming <murrayc@murrayc.com>
+
* src/widgets/modest-recpt-editor.c:
(modest_recpt_editor_instance_init): Turn off hildon auto-capitalization,
to fix projects.maemo.org bug NB#63789.
}
static gboolean
+check_and_offer_account_creation()
+{
+ if (!modest_account_mgr_has_accounts(modest_runtime_get_account_mgr(), TRUE)) {
+ const gboolean created = modest_run_account_setup_wizard (NULL);
+ if (!created) {
+ g_debug ("modest: %s: No account exists even after offering.\n", __FUNCTION__);
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+
+static gboolean
on_idle_mail_to(gpointer user_data)
{
/* This is based on the implemenation of main.c:start_uil(): */
+ if (!check_and_offer_account_creation ())
+ return FALSE;
+
gchar *uri = (gchar*)user_data;
GSList *list_names_and_values = NULL;
- gchar *to = uri_parse_mailto (uri, &list_names_and_values);
/* Get the TnyTransportAccount so we can instantiate a mail operation: */
ModestAccountMgr *account_mgr = modest_runtime_get_account_mgr();
}
/* Create the message: */
+ gchar *to = uri_parse_mailto (uri, &list_names_and_values);
TnyMsg *msg = modest_tny_msg_new (to, from,
cc, bcc, subject, body,
NULL /* attachments */);
+ g_free(to);
+ to = NULL;
if (!msg) {
g_printerr ("modest: failed to create message\n");
if (list_names_and_values)
g_slist_foreach (list_names_and_values, (GFunc)g_free, NULL);
g_slist_free (list_names_and_values);
-
- g_free(to);
g_free(uri);
static gboolean
on_idle_compose_mail(gpointer user_data)
{
+ if (!check_and_offer_account_creation ())
+ return FALSE;
+
ComposeMailIdleData *idle_data = (ComposeMailIdleData*)user_data;
gchar **list = NULL;
gint i = 0;
static gboolean
on_idle_open_default_inbox(gpointer user_data)
{
-
+ if (!check_and_offer_account_creation ())
+ return FALSE;
+
/* This is a GDK lock because we are an idle callback and
* the code below is or does Gtk+ code */
TnyList *headers);
-static void
-run_account_setup_wizard (ModestWindow *win)
+/* Show the account creation wizard dialog.
+ * returns: TRUE if an account was created. FALSE if the user cancelled.
+ */
+gboolean
+modest_run_account_setup_wizard (ModestWindow *win)
{
+ gboolean result = FALSE;
ModestEasysetupWizardDialog *wizard;
- g_return_if_fail (MODEST_IS_WINDOW(win));
+ if (!win)
+ win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr ());
+
+ g_return_val_if_fail (MODEST_IS_WINDOW(win), FALSE);
wizard = modest_easysetup_wizard_dialog_new ();
gtk_window_set_transient_for (GTK_WINDOW (wizard), GTK_WINDOW (win));
* be unusable, freezing the UI: */
/* gtk_window_set_modal (GTK_WINDOW (wizard), TRUE); */
- gtk_dialog_run (GTK_DIALOG (wizard));
+ gint dialog_response = gtk_dialog_run (GTK_DIALOG (wizard));
+ if (dialog_response == GTK_RESPONSE_CANCEL)
+ result = FALSE;
+ else {
+ /* Check whether an account was created: */
+ result = modest_account_mgr_has_accounts(modest_runtime_get_account_mgr(), TRUE);
+ }
+
gtk_widget_destroy (GTK_WIDGET (wizard));
+
+ return result;
}
/* This is currently only implemented for Maemo */
#ifdef MODEST_PLATFORM_MAEMO /* Defined in config.h */
if (!modest_account_mgr_has_accounts(modest_runtime_get_account_mgr(), TRUE)) {
- run_account_setup_wizard (win);
+ modest_run_account_setup_wizard (win);
return;
} else {
/* Show the list of accounts: */
/* 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;
+ const gboolean created = modest_run_account_setup_wizard (win);
+ if (!created)
+ return;
}
account_name = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr ());
(folder_type == TNY_FOLDER_TYPE_OUTBOX)) {
/* 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;
+ const gboolean created = modest_run_account_setup_wizard(parent_win);
+ if (!created)
+ goto cleanup;
}
win = modest_msg_edit_window_new (msg, account, TRUE);
/* we need an account when editing */
if (!modest_account_mgr_has_accounts(modest_runtime_get_account_mgr(), TRUE)) {
- run_account_setup_wizard (win);
- return;
+ const gboolean created = modest_run_account_setup_wizard (win);
+ if (!created)
+ return;
}
header_list = get_selected_headers (win);
if (!account_name) {
/* Run account setup wizard */
- run_account_setup_wizard(MODEST_WINDOW(edit_window));
- return;
+ const gboolean created = modest_run_account_setup_wizard(MODEST_WINDOW(edit_window));
+ if (!created)
+ return;
}
MsgData *data = modest_msg_edit_window_get_msg_data (edit_window);
account_name));
if (!transport_account) {
/* Run account setup wizard */
- run_account_setup_wizard(MODEST_WINDOW(edit_window));
- return;
+ const gboolean created = modest_run_account_setup_wizard(MODEST_WINDOW(edit_window));
+ if (!created)
+ return;
}
gchar *from = modest_account_mgr_get_from_string (account_mgr, account_name);
**/
void modest_do_message_delete (TnyHeader *header, ModestWindow *win);
+/* Show the account creation wizard dialog.
+ * returns: TRUE if an account was created. FALSE if the user cancelled.
+ */
+gboolean modest_run_account_setup_wizard (ModestWindow *win);
+
G_END_DECLS
#endif /* __MODEST_UI_ACTIONS_H__ */