if (g_ascii_strcasecmp (method, MODEST_DBUS_METHOD_MAIL_TO) == 0) {
if (arguments->len != MODEST_DBUS_MAIL_TO_ARGS_COUNT)
goto param_error;
- modest_runtime_set_allow_shutdown (TRUE);
return on_mail_to (arguments, data, retval);
} else if (g_ascii_strcasecmp (method, MODEST_DBUS_METHOD_OPEN_MESSAGE) == 0) {
if (arguments->len != MODEST_DBUS_OPEN_MESSAGE_ARGS_COUNT)
goto param_error;
- modest_runtime_set_allow_shutdown (TRUE);
return on_open_message (arguments, data, retval);
} else if (g_ascii_strcasecmp (method, MODEST_DBUS_METHOD_OPEN_ACCOUNT) == 0) {
if (arguments->len != MODEST_DBUS_OPEN_ACCOUNT_ARGS_COUNT)
goto param_error;
- modest_runtime_set_allow_shutdown (TRUE);
return on_open_account (arguments, data, retval);
} else if (g_ascii_strcasecmp (method, MODEST_DBUS_METHOD_SEND_RECEIVE) == 0) {
if (arguments->len != 0)
} else if (g_ascii_strcasecmp (method, MODEST_DBUS_METHOD_COMPOSE_MAIL) == 0) {
if (arguments->len != MODEST_DBUS_COMPOSE_MAIL_ARGS_COUNT)
goto param_error;
- modest_runtime_set_allow_shutdown (TRUE);
return on_compose_mail (arguments, data, retval);
} else if (g_ascii_strcasecmp (method, MODEST_DBUS_METHOD_DELETE_MESSAGE) == 0) {
if (arguments->len != MODEST_DBUS_DELETE_MESSAGE_ARGS_COUNT)
} else if (g_ascii_strcasecmp (method, MODEST_DBUS_METHOD_OPEN_DEFAULT_INBOX) == 0) {
if (arguments->len != 0)
goto param_error;
- modest_runtime_set_allow_shutdown (TRUE);
return on_open_default_inbox (arguments, data, retval);
} else if (g_ascii_strcasecmp (method, MODEST_DBUS_METHOD_TOP_APPLICATION) == 0) {
if (arguments->len != 0)
goto param_error;
- modest_runtime_set_allow_shutdown (TRUE);
return on_top_application (arguments, data, retval);
} else if (g_ascii_strcasecmp (method, MODEST_DBUS_METHOD_OPEN_EDIT_ACCOUNTS_DIALOG) == 0) {
if (arguments->len != 0)
goto param_error;
- modest_runtime_set_allow_shutdown (TRUE);
return on_open_edit_accounts_dialog (arguments, data, retval);
} else {
/* We need to return INVALID here so
[D-BUS Service]
Name=com.nokia.modest
-Exec=@prefix@/bin/modest -t 30
+Exec=@prefix@/bin/modest
Type=Application
Name=mcen_ap_name
Comment=mcen_ap_name_thumb
-Exec=@prefix@/bin/modest -t 30
+Exec=@prefix@/bin/modest
X-Text-Domain=modest
X-Osso-Service=com.nokia.modest
#include "modest-ui-actions.h"
static gboolean show_ui = FALSE;
-static gint shutdown_timeout = 0;
static GOptionEntry option_entries [] =
{
{ "show-ui", 's', 0, G_OPTION_ARG_NONE, &show_ui, "Show UI immediately, so no wait for DBUS activation", NULL },
- { "shutdown-timeout", 't', 0, G_OPTION_ARG_INT, &shutdown_timeout, "Timeout in minutes for running Modest in prestart mode", NULL },
{ NULL }
};
-static guint shutdown_timeout_id = 0;
-
typedef struct {
gulong queue_handler;
gulong window_list_handler;
g_idle_add_full (G_PRIORITY_LOW, on_idle_exit_modest, user_data, NULL);
}
-static gboolean
-shutdown_timeout_handler (gpointer userdata)
-{
- modest_runtime_set_allow_shutdown (TRUE);
- return FALSE;
-}
-
int
main (int argc, char *argv[])
{
* because we wait for the top_application D-Bus method to
* be called. But that's annoying when starting from the
* command line.: */
- gboolean show_ui_without_top_application_method = FALSE;
int retval = 0;
MainSignalHandlers *handlers;
ModestTnyAccountStore *acc_store;
}
g_option_context_free (context);
- show_ui_without_top_application_method = show_ui;
-
- if (!show_ui_without_top_application_method) {
+ if (!show_ui) {
g_print ("modest: use 'modest -s' to start from cmdline with UI\n");
}
* The UI will be shown later (or just after starting if no otehr D-Bus method was used),
* when we receive the "top_application" D-Bus method.
*/
- if (show_ui_without_top_application_method) {
+ if (show_ui) {
ModestWindow *window;
- modest_runtime_set_allow_shutdown (TRUE);
mgr = modest_runtime_get_window_mgr();
window = modest_window_mgr_show_initial_window (mgr);
if (!window) {
}
/* Remove new mail notifications if exist */
modest_platform_remove_new_mail_notifications (FALSE);
- } else {
- if (shutdown_timeout > 0) {
- modest_runtime_set_allow_shutdown (FALSE);
- shutdown_timeout_id = g_timeout_add_seconds (shutdown_timeout * 60, shutdown_timeout_handler, NULL);
- }
}
gtk_main ();
static GSList *_sig_handlers = NULL;
/* will modest shut down when window list and mail op queue are empty? */
-static gboolean _allow_shutdown = TRUE;
+static gboolean _allow_shutdown = FALSE;
/*
* private functions declared in modest-runtime-priv.h -
ModestWindow *window,
ModestWindow *parent)
{
- /* If this is the first registered window then reset the
- status of the TnyDevice as it might be forced to be offline
- when modest is running in the background (see
- modest_tny_account_store_new()) */
- if (modest_window_mgr_get_num_windows (self) == 0) {
+ gboolean no_windows, retval;
+
+ no_windows = (modest_window_mgr_get_num_windows (self) == 0);
+
+ retval = MODEST_WINDOW_MGR_GET_CLASS (self)->register_window (self, window, parent);
+
+ if (no_windows) {
+ /* If this is the first registered window then reset the
+ status of the TnyDevice as it might be forced to be offline
+ when modest is running in the background (see
+ modest_tny_account_store_new()) */
if (tny_device_is_forced (modest_runtime_get_device ()))
tny_device_reset (modest_runtime_get_device ());
- }
- return MODEST_WINDOW_MGR_GET_CLASS (self)->register_window (self, window, parent);
+ /* Do also allow modest to shutdown when the
+ application is closed */
+ modest_runtime_set_allow_shutdown (TRUE);
+ }
+ return retval;
}
static gboolean