LImit the number of changes for correcting scroll to avoid infinite loop.
[modest] / src / maemo / modest-main-window.c
index 727682c..ce89897 100644 (file)
@@ -64,6 +64,9 @@
 #include "maemo/modest-osso-state-saving.h"
 #include "modest-text-utils.h"
 #include "modest-signal-mgr.h"
+#ifdef MODEST_USE_LIBTIME
+#include <clockd/libtime.h>
+#endif
 
 #define MODEST_MAIN_WINDOW_ACTION_GROUP_ADDITIONS "ModestMainWindowActionAdditions"
 
@@ -1114,7 +1117,8 @@ modest_main_window_on_show (GtkWidget *self, gpointer user_data)
        ShowHelper *helper = (ShowHelper *) user_data;
        GtkWidget *folder_win = helper->folder_win;
        ModestMainWindowPrivate *priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
-       
+       ModestAccountMgr *mgr;
+
        priv->folder_view = MODEST_FOLDER_VIEW (modest_platform_create_folder_view (NULL));
        wrap_in_scrolled_window (folder_win, GTK_WIDGET(priv->folder_view));
 
@@ -1136,18 +1140,10 @@ modest_main_window_on_show (GtkWidget *self, gpointer user_data)
        restore_settings (MODEST_MAIN_WINDOW(self), TRUE);
        priv->wait_for_settings = FALSE;
 
-       /* Check if accounts exist and show the account wizard if not */
-       gboolean accounts_exist = 
-               modest_account_mgr_has_accounts(modest_runtime_get_account_mgr(), TRUE);
-
-       if (!accounts_exist) {
-               /* This is necessary to have the main window shown behind the dialog 
-               It's an ugly hack... jschmid */
-               gtk_widget_show_all(GTK_WIDGET(self));
-               modest_ui_actions_on_accounts (NULL, MODEST_WINDOW(self));
-       } else {
+       /* Update the menus if there are accounts */
+       mgr = modest_runtime_get_account_mgr();
+       if (modest_account_mgr_has_accounts(mgr, TRUE))
                update_menus (MODEST_MAIN_WINDOW (self));
-       }
 
        /* Never call this function again (NOTE that it could happen
           as we hide the main window instead of closing it while
@@ -2035,6 +2031,16 @@ create_details_widget (GtkWidget *styled_widget, TnyAccount *account)
                last_updated = modest_account_mgr_get_last_updated (modest_runtime_get_account_mgr (), 
                                                                    tny_account_get_id (account));
 
+#ifdef MODEST_USE_LIBTIME
+               /* If we use libtime, we are storing the time in UTC so we have to convert to currently
+                * selected time */
+               time_t now;
+               struct tm *localtime_tm;
+               time (&now);
+               localtime_tm = localtime (&now);
+               last_updated -= time_get_utc_offset (localtime_tm->tm_zone);
+#endif
+
                if (last_updated > 0) 
                        last_updated_string = modest_text_utils_get_display_date(last_updated);
                else
@@ -2245,6 +2251,10 @@ modest_main_window_set_contents_style (ModestMainWindow *self,
 
        /* Show */
        gtk_widget_show_all (priv->contents_widget);
+
+       /* Recompute dimming rules */
+        modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (self));
+       modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (self));
 }
 
 ModestMainWindowContentsStyle
@@ -2768,7 +2778,8 @@ on_zoom_minus_plus_not_implemented (ModestWindow *window)
 {
        g_return_val_if_fail (MODEST_IS_MAIN_WINDOW (window), FALSE);
 
-       hildon_banner_show_information (NULL, NULL, dgettext("hildon-common-strings", "ckct_ib_cannot_zoom_here"));
+       hildon_banner_show_information (NULL, NULL, 
+                                       _CS("ckct_ib_cannot_zoom_here"));
        return FALSE;
 
 }