* modest-folder-view.[ch]:
authorDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Mon, 29 Jan 2007 20:26:28 +0000 (20:26 +0000)
committerDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Mon, 29 Jan 2007 20:26:28 +0000 (20:26 +0000)
- add some function documentation
- automatically expand root items
* modest-header-view.c:
- enable search functionality

pmo-trunk-r760

src/widgets/modest-folder-view.c
src/widgets/modest-folder-view.h
src/widgets/modest-header-view.c

index 804c74d..923f4a3 100644 (file)
@@ -72,7 +72,6 @@ enum {
 
 typedef struct _ModestFolderViewPrivate ModestFolderViewPrivate;
 struct _ModestFolderViewPrivate {
-
        TnyAccountStore     *account_store;
        TnyFolder           *cur_folder;
 
@@ -481,6 +480,22 @@ update_store_account_handlers (ModestFolderView *self, TnyList *account_list)
 
 
 
+/* this feels dirty; any other way to expand all the root items? */
+static void
+expand_root_items (ModestFolderView *self)
+{
+       GtkTreePath *path;
+       path = gtk_tree_path_new_first ();
+
+       /* all folders should have child items, so.. */
+       while (gtk_tree_view_expand_row (GTK_TREE_VIEW(self), path, FALSE))
+               gtk_tree_path_next (path);
+       
+       gtk_tree_path_free (path);
+}
+
+
+
 static gboolean
 update_model (ModestFolderView *self, ModestTnyAccountStore *account_store)
 {
@@ -500,9 +515,7 @@ update_model (ModestFolderView *self, ModestTnyAccountStore *account_store)
 
        tny_account_store_get_accounts (TNY_ACCOUNT_STORE(account_store),
                                        account_list,
-                                       TNY_ACCOUNT_STORE_STORE_ACCOUNTS);
-
-       
+                                       TNY_ACCOUNT_STORE_STORE_ACCOUNTS);      
        if (account_list) {
                sortable = gtk_tree_model_sort_new_with_model (model);
                gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE(sortable),
@@ -512,6 +525,8 @@ update_model (ModestFolderView *self, ModestTnyAccountStore *account_store)
                                                 TNY_GTK_FOLDER_STORE_TREE_MODEL_NAME_COLUMN, 
                                                 cmp_rows, NULL, NULL);
                gtk_tree_view_set_model (GTK_TREE_VIEW(self), sortable);
+               expand_root_items (self); /* expand all account folders */
+       
                update_store_account_handlers (self, account_list);
        }
        
index 3df70c4..da31e4b 100644 (file)
@@ -112,6 +112,14 @@ void          modest_folder_view_set_title       (ModestFolderView *self,
 TnyFolder*    modest_folder_view_get_selected    (ModestFolderView *self);
 
 
+/**
+ * modest_folder_view_update_model:
+ * @self: a #ModestFolderView
+ * 
+ * returns a new reference to the #TnyFolder that is already selected
+ * 
+ * Returns: the selected folder or NULL if none is selected
+ **/
 gboolean      modest_folder_view_update_model    (ModestFolderView *self,
                                                  TnyAccountStore *account_store);
 
index bf131f5..ee25180 100644 (file)
@@ -390,7 +390,8 @@ modest_header_view_new (TnyFolder *folder, ModestHeaderViewStyle style)
 
        gtk_tree_view_columns_autosize (GTK_TREE_VIEW(obj));
        gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW(obj),TRUE);
-
+       gtk_tree_view_set_enable_search (GTK_TREE_VIEW(obj), TRUE);
+       
        gtk_tree_view_set_rules_hint (GTK_TREE_VIEW(obj),
                                      TRUE); /* alternating row colors */
        sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(self));