- static GOptionEntry options[] = {
- { "debug", 'd', 0, G_OPTION_ARG_NONE, &debug,
- "Run in debug mode", NULL},
- { "mailto", 'm', 0, G_OPTION_ARG_STRING, &mailto,
- "New email to <addresses> (comma-separated)", NULL},
- { "subject", 's', 0, G_OPTION_ARG_STRING, &subject,
- "Subject for a new mail", NULL},
- { "body", 'b', 0, G_OPTION_ARG_STRING, &body,
- "Body for a new email", NULL},
- { "cc", 'c', 0, G_OPTION_ARG_STRING, &cc,
- "Cc: addresses for a new mail (comma-separated)", NULL},
- { "bcc", 'x', 0, G_OPTION_ARG_STRING, &bcc,
- "Bcc: addresses for a new mail (comma-separated)", NULL},
- { "batch", 'y', 0, G_OPTION_ARG_NONE, &batch,
- "Run in batch mode (don't show UI)", NULL},
- { NULL, 0, 0, 0, NULL, NULL, NULL }
- };
+ /* Exit if the queue is empty and there are no more
+ windows. We can exit as well if the main window is hidden
+ and it's the only one */
+ if (modest_window_mgr_num_windows (mgr) == 0)
+ g_idle_add_full (G_PRIORITY_LOW, on_idle_exit_modest, user_data, g_free);
+}