By default scrollables don't show shadow
[modest] / src / modest-ui-dimming-rules.c
index e8d2c5c..9090c23 100644 (file)
@@ -52,7 +52,7 @@
 #include <gtkhtml/gtkhtml.h>
 #include <modest-runtime.h>
 #include <widgets/modest-header-window.h>
-#include <modest-folder-window.h>
+#include <widgets/modest-folder-window.h>
 
 
 static gboolean _invalid_attach_selected (ModestWindow *win, 
@@ -206,7 +206,11 @@ modest_ui_dimming_rules_on_delete (ModestWindow *win, gpointer user_data)
        rule = MODEST_DIMMING_RULE (user_data);
 
        if (MODEST_IS_FOLDER_WINDOW (win)) {
+#ifdef MODEST_TOOLKIT_HILDON2
                dimmed = modest_ui_dimming_rules_on_folder_window_delete (win, user_data);
+#else
+               dimmed = FALSE;
+#endif
        } else if (MODEST_IS_HEADER_WINDOW (win)) {
 
                if (!dimmed)
@@ -542,9 +546,17 @@ modest_ui_dimming_rules_on_move_to (ModestWindow *win, gpointer user_data)
        rule = MODEST_DIMMING_RULE (user_data);
 
        if (MODEST_IS_HEADER_WINDOW (win))
+#ifdef MODEST_TOOLKIT_HILDON2
                dimmed = modest_ui_dimming_rules_on_header_window_move_to (win, user_data);
+#else
+       dimmed = TRUE;
+#endif
        else if (MODEST_IS_FOLDER_WINDOW (win))
+#ifdef MODEST_TOOLKIT_HILDON2
                dimmed = modest_ui_dimming_rules_on_folder_window_move_to (win, user_data);
+#else
+       dimmed = TRUE;
+#endif
        else if (MODEST_IS_MSG_VIEW_WINDOW (win)) 
                 dimmed = modest_ui_dimming_rules_on_view_window_move_to (win, user_data);
 
@@ -555,14 +567,34 @@ modest_ui_dimming_rules_on_move_to (ModestWindow *win, gpointer user_data)
 static gboolean
 _forbid_outgoing_xfers (ModestWindow *window)
 {
-       const gchar *account_name;
-       TnyAccount *account;
+       const gchar *account_name = NULL;
+       TnyAccount *account = NULL;
        gboolean dimmed = FALSE;
 
-       account_name = modest_window_get_active_account (window);
-       account = modest_tny_account_store_get_server_account (modest_runtime_get_account_store (),
-                                                              account_name,
-                                                              TNY_ACCOUNT_TYPE_STORE);
+#ifdef MODEST_TOOLKIT_HILDON2
+       /* We cannot just get the active account because the active
+          account of a header window that shows the headers of a
+          local account is the ID of the remote account */
+       if (MODEST_IS_HEADER_WINDOW (window)) {
+               ModestHeaderView *header_view;
+               TnyFolder *folder;
+
+               header_view = modest_header_window_get_header_view ((ModestHeaderWindow *) window);
+               folder = modest_header_view_get_folder (header_view);
+
+               if (folder) {
+                       account = modest_tny_folder_get_account (folder);
+                       g_object_unref (folder);
+               }
+       }
+#endif
+
+       if (!account) {
+               account_name = modest_window_get_active_account (window);
+               account = modest_tny_account_store_get_server_account (modest_runtime_get_account_store (),
+                                                                      account_name,
+                                                                      TNY_ACCOUNT_TYPE_STORE);
+       }
 
        if (account) {
                ModestProtocolType protocol_type;
@@ -728,7 +760,6 @@ modest_ui_dimming_rules_on_view_attachments (ModestWindow *win, gpointer user_da
        return dimmed;
 }
 
-#ifdef MODEST_TOOLKIT_HILDON2
 static gboolean
 _not_valid_attachments (ModestWindow *win, gboolean save_not_remove)
 {
@@ -788,7 +819,6 @@ _not_valid_attachments (ModestWindow *win, gboolean save_not_remove)
        return result;
 
 }
-#endif
 
 gboolean 
 modest_ui_dimming_rules_on_save_attachments (ModestWindow *win, gpointer user_data)
@@ -1214,7 +1244,7 @@ modest_ui_dimming_rules_on_send_receive_all (ModestWindow *win, gpointer user_da
 gboolean
 modest_ui_dimming_rules_on_add_to_contacts (ModestWindow *win, gpointer user_data)
 {
-       GSList *recipients;
+       GSList *recipients = NULL;
        gboolean has_recipients_to_add;
 
        g_return_val_if_fail (MODEST_IS_DIMMING_RULE (user_data), FALSE);