+2007-05-04 Murray Cumming <murrayc@murrayc.com>
+
+ * src/maemo/Makefile.am:
+ * src/maemo/modest-osso-state-saving.c:
+ * src/maemo/modest-osso-state-saving.h: Added
+ modest_osso_load_state() and modest_osso_save_state() though they do
+ nothing now. They should iterate through all the open windows and load/save
+ their state.
+ * src/modest-ui-actions.c: (modest_ui_actions_on_quit): For Mameo,
+ save state when closing.
+
+ * src/maemo/modest-main-window.c:
+ (on_hildon_program_is_topmost_notify), (modest_main_window_new):
+ Add a notification handler for the HildonProgram::is-topmost property,
+ so we can allow hibernation when the application goes into the background.
+ But we still need to detect when the accounts setup windows are open so
+ we can stop hibernation when they are open.
+ To do this, I also added the main window the HildonProgram. This might have
+ other side-effects/benefits, and should maybe be done for other windows.
+
+ * src/maemo/modest-osso-autosave-callbacks.h:
+ * src/maemo/modest-osso-autosave-callbacks.c:
+ (modest_on_osso_application_autosave): Add a libosso auto-save callback,
+ though it does not do anything yet, and we might never need this to do
+ anything. For instance, we already save drafts.
+
+ * src/maemo/modest-platform.c: (modest_platform_init):
+ Specify the libosso auto-save callback.
+
2007-05-03 Murray Cumming <murrayc@murrayc.com>
* src/maemo/modest-platform.c:
modest-connection-specific-smtp-edit-window.h \
modest-connection-specific-smtp-edit-window.c \
modest-progress-bar-widget.c \
- modest-progress-bar-widget.h
+ modest-progress-bar-widget.h \
+ modest-osso-autosave-callbacks.c \
+ modest-osso-autosave-callbacks.h \
+ modest-osso-state-saving.c \
+ modest-osso-state-saving.h
libmodest_ui_la_LIBADD = \
#include "modest-mail-operation.h"
#include "modest-icon-names.h"
#include "modest-progress-bar-widget.h"
+#include <hildon-widgets/hildon-program.h>
+#include "maemo/modest-osso-state-saving.h"
/* 'private'/'protected' functions */
static void modest_main_window_class_init (ModestMainWindowClass *klass);
return FALSE; /* Do not call this idle handler again. */
}
+static void on_hildon_program_is_topmost_notify(GObject *self,
+ GParamSpec *propert_param, gpointer user_data)
+{
+ HildonProgram *app = HILDON_PROGRAM (self);
+
+ /*
+ ModestWindow* self = MODEST_WINDOW(user_data);
+ */
+
+ /* Note that use of hildon_program_set_can_hibernate()
+ * is generally referred to as "setting the killable flag",
+ * though hibernation does not seem equal to death.
+ * murrayc */
+
+ if (hildon_program_get_is_topmost (app)) {
+ /* Prevent hibernation when the progam comes to the foreground,
+ * because hibernation should only happen when the application
+ * is in the background: */
+ hildon_program_set_can_hibernate (app, FALSE);
+ } else {
+ /* Allow hibernation if the program has gone to the background: */
+
+ /* However, prevent hibernation while the settings are being changed: */
+ gboolean settings_dialog_is_open = FALSE;
+
+ if (settings_dialog_is_open)
+ hildon_program_set_can_hibernate (app, FALSE);
+ else {
+
+ /* Allow hibernation, after saving the state: */
+ modest_osso_save_state();
+ hildon_program_set_can_hibernate (app, TRUE);
+ }
+ }
+
+}
+
+
ModestWindow*
modest_main_window_new (void)
/* do send & receive when we are idle */
g_idle_add ((GSourceFunc)sync_accounts_cb, self);
+
+ HildonProgram *app = hildon_program_get_instance ();
+ hildon_program_add_window (app, HILDON_WINDOW (self));
+
+ /* Register HildonProgram signal handlers: */
+ /* These are apparently deprecated, according to the
+ * "HildonApp/HildonAppView to HildonProgram/HildonWindow migration guide",
+ * though the API reference does not mention that:
+ *
+ g_signal_connect (G_OBJECT(app), "topmost_status_lose",
+ G_CALLBACK (on_hildon_program_save_state), self);
+ g_signal_connect (G_OBJECT(app), "topmost_status_acquire",
+ G_CALLBACK (on_hildon_program_status_acquire), self);
+ */
+ g_signal_connect (G_OBJECT(app), "notify::is-topmost",
+ G_CALLBACK (on_hildon_program_is_topmost_notify), self);
+
+ /* Load previous osso state, for instance if we are being restored from
+ * hibernation: */
+ modest_osso_load_state();
+
return MODEST_WINDOW(self);
}
--- /dev/null
+/* Copyright (c) 2007, Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Nokia Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include <maemo/modest-osso-autosave-callbacks.h>
+
+void modest_on_osso_application_autosave(gpointer data)
+{
+
+}
+
+
+
+
--- /dev/null
+/* Copyright (c) 2007, Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Nokia Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#ifndef __MODEST_OSSO_AUTOSAVE_CALLBACKS_H__
+#define __MODEST_OSSO_AUTOSAVE_CALLBACKS_H__
+
+#include <glib.h>
+#include <libosso.h>
+
+void modest_on_osso_application_autosave(gpointer data);
+
+
+#endif /* __MODEST_OSSO_AUTOSAVE_CALLBACKS_H__ */
--- /dev/null
+/* Copyright (c) 2007, Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Nokia Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include <maemo/modest-osso-state-saving.h>
+#include <libosso.h>
+
+void modest_osso_load_state()
+{
+ /* We don't need to call osso_state_read()
+ * - we use our general widget-state-saving technique instead. */
+}
+
+void modest_osso_save_state()
+{
+ /* We don't need to call osso_state_write()
+ * - we use our general widget-state-saving technique instead. */
+}
+
+
+
+
--- /dev/null
+/* Copyright (c) 2007, Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Nokia Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#ifndef __MODEST_OSSO_STATE_SAVING_H__
+#define __MODEST_OSSO_STATE_SAVING_H__
+
+#include <glib.h>
+
+void modest_osso_load_state();
+
+void modest_osso_save_state();
+
+#endif /* __MODEST_OSSO_STATE_SAVING_H__ */
#include <modest-hildon-includes.h>
#include <dbus_api/modest-dbus-callbacks.h>
+#include <maemo/modest-osso-autosave-callbacks.h>
#include <libosso.h>
#include <alarmd/alarm_event.h> /* For alarm_event_add(), etc. */
#include <tny-maemo-conic-device.h>
/* Register hardware event dbus callback: */
osso_hw_set_event_cb(osso_context, NULL, modest_osso_cb_hw_state_handler, NULL);
+ /* Register osso auto-save callbacks: */
+ result = osso_application_set_autosave_cb (osso_context,
+ modest_on_osso_application_autosave, NULL /* user_data */);
+ if (result != OSSO_OK) {
+ g_warning ("osso_application_set_autosave_cb() failed.");
+ }
+
+
/* TODO: Get the actual update interval from gconf,
* when that preferences dialog has been implemented.
* And make sure that this is called again whenever that is changed. */
#include "modest-tny-platform-factory.h"
#include "modest-platform.h"
+#ifdef MODEST_PLATFORM_MAEMO
+#include "maemo/modest-osso-state-saving.h"
+#endif /* MODEST_PLATFORM_MAEMO */
+
+
#include <widgets/modest-main-window.h>
#include <widgets/modest-msg-view-window.h>
#include <widgets/modest-account-view-window.h>
#ifdef MODEST_HAVE_EASYSETUP
#include "easysetup/modest-easysetup-wizard.h"
-#endif /*MODEST_HAVE_EASYSETUP*/
+#endif /* MODEST_HAVE_EASYSETUP */
#include <modest-widget-memory.h>
#include <tny-error.h>
void
modest_ui_actions_on_quit (GtkAction *action, ModestWindow *win)
{
+ #ifdef MODEST_PLATFORM_MAEMO
+ modest_osso_save_state();
+ #endif /* MODEST_PLATFORM_MAEMO */
+
gtk_main_quit ();
}
* @self: the #ModestWindowMgr
* @window: a #ModestWindow
*
- * Unegisters a given window from the window manager. The window
+ * Unregisters a given window from the window manager. The window
* manager will free its reference to it.
**/
void modest_window_mgr_unregister_window (ModestWindowMgr *self,