* Set the edit and delete buttons as insensitive only if there is no account selected
authorSergio Villar Senin <svillar@igalia.com>
Mon, 12 May 2008 10:03:55 +0000 (10:03 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Mon, 12 May 2008 10:03:55 +0000 (10:03 +0000)
pmo-trunk-r4513

src/maemo/modest-account-view-window.c
src/widgets/modest-account-view.h

index 100ad77..1ba48c6 100644 (file)
@@ -432,8 +432,15 @@ button_box_new (ModestAccountViewWindow *self)
        gtk_box_pack_start (GTK_BOX(button_box), priv->delete_button, FALSE, FALSE,2);
        gtk_box_pack_start (GTK_BOX(button_box), priv->close_button, FALSE, FALSE,2);
 
-       gtk_widget_set_sensitive (priv->edit_button, FALSE);
-       gtk_widget_set_sensitive (priv->delete_button, FALSE);  
+       /* Should has been created by window_vbox_new */
+       if (priv->account_view) {
+               GtkTreeSelection *sel;
+               sel = gtk_tree_view_get_selection (GTK_TREE_VIEW(priv->account_view));
+               if (gtk_tree_selection_count_selected_rows (sel) == 0) {
+                       gtk_widget_set_sensitive (priv->edit_button, FALSE);
+                       gtk_widget_set_sensitive (priv->delete_button, FALSE);  
+               }
+       }
 
        gtk_widget_show_all (button_box);
        return button_box;
index 2fb5950..aa16dd2 100644 (file)
@@ -87,18 +87,6 @@ ModestAccountView*   modest_account_view_new         (ModestAccountMgr *account_
  **/
 gchar*   modest_account_view_get_selected_account    (ModestAccountView *account_view);
 
-/**
- * modest_account_view_set_selected_account:
- * @account_view: a #ModestAccountView
- * @account_name: The name of the account to select.
- * 
- * Sets the currently selected account.
- **/
-/* Not used outside:
-void modest_account_view_select_account (ModestAccountView *account_view, 
-       const gchar* account_name);
-*/
-
 G_END_DECLS
 
 #endif /* __MODEST_ACCOUNT_VIEW_H__ */