* Do not try to select accounts in Fremantle
[modest] / src / widgets / modest-account-view.c
index 6afd0b5..b4e4765 100644 (file)
@@ -63,11 +63,14 @@ static void on_display_name_changed            (ModestAccountMgr *self,
                                                const gchar *account,
                                                gpointer user_data);
 
+#ifndef MODEST_TOOLKIT_HILDON2
 static void modest_account_view_select_first_account (ModestAccountView *account_view);
+#endif
 
 static void on_account_updated (ModestAccountMgr* mgr, gchar* account_name,
                     gpointer user_data);
 static void update_account_view (ModestAccountMgr *account_mgr, ModestAccountView *view);
+static void on_notify_style (GObject *obj, GParamSpec *spec, gpointer userdata);
 
 typedef enum {
        MODEST_ACCOUNT_VIEW_NAME_COLUMN,
@@ -160,6 +163,7 @@ modest_account_view_init (ModestAccountView *obj)
                             "widget_class \"*<HildonPannableArea>.ModestAccountView\" style :highest \"fremantle-modest-account-view\"");
        
 #endif
+       g_signal_connect (G_OBJECT (obj), "notify::style", G_CALLBACK (on_notify_style), (gpointer) obj);
 }
 
 static void
@@ -318,7 +322,9 @@ update_account_view (ModestAccountMgr *account_mgr, ModestAccountView *view)
                modest_account_view_select_account (view, selected_name);
                g_free (selected_name);
        } else {
+#ifndef MODEST_TOOLKIT_HILDON2
                modest_account_view_select_first_account (view);
+#endif
        }
 }
 
@@ -413,8 +419,10 @@ on_account_removed (TnyAccountStore *account_store,
        
        selected_name = modest_account_view_get_selected_account (self);
        if (selected_name == NULL) {
+#ifndef MODEST_TOOLKIT_HILDON2
                /* we select the first account if none is selected */
-               modest_account_view_select_first_account (self);                
+               modest_account_view_select_first_account (self);
+#endif
        } else {
                g_free (selected_name);
        }
@@ -797,6 +805,7 @@ modest_account_view_select_account (ModestAccountView *account_view,
        g_free (state);
 }
 
+#ifndef MODEST_TOOLKIT_HILDON2
 static void
 modest_account_view_select_first_account (ModestAccountView *account_view)
 {
@@ -805,10 +814,11 @@ modest_account_view_select_first_account (ModestAccountView *account_view)
 
        if (gtk_tree_model_get_iter_first (model, &iter)) {
                GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (account_view));
-       
+
                gtk_tree_selection_select_iter (selection, &iter);
        }
 }
+#endif
 
 static void
 on_default_account_changed (ModestAccountMgr *mgr,
@@ -857,3 +867,12 @@ on_display_name_changed (ModestAccountMgr *mgr,
        /* Update the view */
        update_account_view (mgr, MODEST_ACCOUNT_VIEW (user_data));
 }
+
+static void 
+on_notify_style (GObject *obj, GParamSpec *spec, gpointer userdata)
+{
+       if (strcmp ("style", spec->name) == 0) {
+               gtk_widget_queue_draw (GTK_WIDGET (obj));
+       } 
+}
+