- /* Show/hide toolbar & fullscreen */
- key = get_show_toolbar_key (G_TYPE_FROM_INSTANCE (window), priv->fullscreen_mode);
- modest_window_show_toolbar (window, modest_conf_get_bool (modest_runtime_get_conf (), key, NULL));
-}
-
-static gboolean
-on_window_destroy (ModestWindow *window,
- GdkEvent *event,
- ModestWindowMgr *self)
-{
- gint dialog_response = GTK_RESPONSE_NONE;
-
- /* Specific stuff first */
- if (MODEST_IS_MAIN_WINDOW (window)) {
- ModestWindowMgrPrivate *priv;
- priv = MODEST_WINDOW_MGR_GET_PRIVATE (self);
-
- /* If more than one window already opened */
- if (g_list_length (priv->window_list) > 1) {
-
- /* Present the window if it's not visible now */
- if (!gtk_window_has_toplevel_focus (GTK_WINDOW (window)))
- gtk_window_present (GTK_WINDOW (window));
- /* Create the confirmation dialog MSG-NOT308 */
- dialog_response = modest_platform_run_confirmation_dialog (
- GTK_WINDOW (window), _("emev_nc_close_windows"));
-
- /* If the user wants to close all the windows */
- if ((dialog_response == GTK_RESPONSE_OK)
- || (dialog_response == GTK_RESPONSE_ACCEPT)
- || (dialog_response == GTK_RESPONSE_YES))
- {
- GList *iter = priv->window_list;
- do {
- if (iter->data != window) {
- GList *tmp = iter->next;
- on_window_destroy (MODEST_WINDOW (iter->data),
- event,
- self);
- iter = tmp;
- } else {
- iter = g_list_next (iter);
- }
- } while (iter);
- }
- else
- {
- return TRUE;
- }
- }
- }
- else {
- if (MODEST_IS_MSG_EDIT_WINDOW (window)) {
- gboolean sent = FALSE;
- gint response = GTK_RESPONSE_ACCEPT;
- sent = modest_msg_edit_window_get_sent (MODEST_MSG_EDIT_WINDOW (window));
- /* Save currently edited message to Drafts if it was not sent */
- if (!sent && modest_msg_edit_window_is_modified (MODEST_MSG_EDIT_WINDOW (window))) {
-
- /* Raise the window if it's minimized */
- if (!gtk_window_has_toplevel_focus (GTK_WINDOW (window)))
- gtk_window_present (GTK_WINDOW (window));
-
- response =
- modest_platform_run_confirmation_dialog (GTK_WINDOW (window),
- _("mcen_nc_no_email_message_modified_save_changes"));
- /* Save to drafts */
- if (response != GTK_RESPONSE_CANCEL)
- modest_ui_actions_on_save_to_drafts (NULL, MODEST_MSG_EDIT_WINDOW (window));
- }
- }
- }
-
- /* Unregister window */
- modest_window_mgr_unregister_window (self, window);
-
- return FALSE;
-}
-
-static void
-disconnect_msg_changed (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- guint handler_id;
- handler_id = GPOINTER_TO_UINT(value);
-
- if (key && G_IS_OBJECT(key))
- g_signal_handler_disconnect (G_OBJECT (key), handler_id);