X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fwidgets%2Fmodest-folder-view.h;h=e8845ef6d7bd688f057ae07cf6623d9e1de02181;hp=22c443c75bc3f173e9debe3b002e5dcb158ada3b;hb=f79c54cc84510e27b99e5e9082af8e77d6b7bb49;hpb=bc7bfc2a42a7fb701a57365c8dfc4b6faa9a03a1 diff --git a/src/widgets/modest-folder-view.h b/src/widgets/modest-folder-view.h index 22c443c..e8845ef 100644 --- a/src/widgets/modest-folder-view.h +++ b/src/widgets/modest-folder-view.h @@ -30,9 +30,10 @@ #ifndef __MODEST_FOLDER_VIEW_H__ #define __MODEST_FOLDER_VIEW_H__ -#include -#include #include +#include +#include +#include G_BEGIN_DECLS @@ -44,6 +45,11 @@ G_BEGIN_DECLS #define MODEST_IS_FOLDER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_FOLDER_VIEW)) #define MODEST_FOLDER_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_FOLDER_VIEW,ModestFolderViewClass)) +typedef enum _ModestFolderViewStyle { + MODEST_FOLDER_VIEW_STYLE_SHOW_ALL, + MODEST_FOLDER_VIEW_STYLE_SHOW_ONE +} ModestFolderViewStyle; + typedef struct _ModestFolderView ModestFolderView; typedef struct _ModestFolderViewClass ModestFolderViewClass; @@ -55,15 +61,16 @@ struct _ModestFolderView { struct _ModestFolderViewClass { GtkTreeViewClass parent_class; - /* emitted when a folder is clicked */ - void (*folder_selected) (ModestFolderView* self, - TnyFolder *folder, - gpointer user_data); - - gboolean (*update_model) (ModestFolderView *self, - TnyAccountStore *account_store); -}; + /* emitted when a folder is selected or unselected */ + void (*folder_selection_changed) (ModestFolderView* self, + TnyFolder *folder, + gboolean selected, + gpointer user_data); + void (*folder_display_name_changed) (ModestFolderView* self, + const gchar *display_name, + gpointer user_data); +}; /** * modest_folder_view_get_type: @@ -72,34 +79,108 @@ struct _ModestFolderViewClass { * * Returns: the GType */ -GType modest_folder_view_get_type (void) G_GNUC_CONST; +GType modest_folder_view_get_type (void) G_GNUC_CONST; + /** * modest_folder_view_new: - * @iface: a ModestTnyAccountStore instance + * @query: a #TnyFolderStoreQuery that specifies the folders to show * - * create a new ModestFolderView instance, based on an account store + * create a new #ModestFolderView instance * - * Returns: a new GtkWidget (a GtkTreeView-subclass) + * Returns: a new #GtkWidget (a #GtkTreeView subclass) */ -GtkWidget* modest_folder_view_new (ModestTnyAccountStore *account_store, - TnyFolderStoreQuery *query); - +GtkWidget* modest_folder_view_new (TnyFolderStoreQuery *query); /** - * modest_folder_view_is_empty: + * modest_folder_view_set_title: * @self: a ModestFolderView instance + * @title: the new title * - * check to see of the view is empty. Note that when it is empty, - * there will still be one item, telling "(empty)" or similar - * - * Returns: TRUE if the tree view is empty, FALSE otherwise + * set the title for the folder view; if title is NULL, the title column + * header will be hidden */ -gboolean modest_folder_view_is_empty (ModestFolderView *self); +void modest_folder_view_set_title (ModestFolderView *self, + const gchar *title); + + +/** + * modest_folder_view_get_selected: + * @self: a #ModestFolderView + * + * gets a new reference to the #TnyFolderStore that is already + * selected. The caller must free this reference + * + * Returns: the selected #TnyFolderStore or NULL if none is selected + **/ +TnyFolderStore* modest_folder_view_get_selected (ModestFolderView *self); + + +/** + * modest_folder_view_update_model: + * @self: a #ModestFolderView + * + * refresh the current model + * + * Returns: TRUE if the model was succesfully updated + **/ +gboolean modest_folder_view_update_model (ModestFolderView *self, + TnyAccountStore *account_store); + +/** + * modest_folder_view_get_selected_display_name: + * @self: a #ModestFolderView + * + * returns a the display name of the currently selected + * #TnyFolder. Note that it could be different to the name returned by + * the #TnyFolder that could be get using + * modest_folder_view_get_selected, because it for example could + * contain the unread messages between brackets + * + * Returns: the display name of the currently selected #TnyFolder or + * NULL if none is selected + **/ +const gchar* modest_folder_view_get_selected_display_name (ModestFolderView *self); + + +/** + * modest_folder_view_set_style: + * @self: a #ModestFolderView + * @style: a #ModestFolderViewStyle + * + * Sets the folder view style. There are currently two available, + * MODEST_FOLDER_VIEW_STYLE_SHOW_ALL shows all the active accounts, + * and MODEST_FOLDER_VIEW_STYLE_SHOW_ONE (Maemo style) shows the local + * account the mmc and only one of the available active server + * accounts + **/ +void modest_folder_view_set_style (ModestFolderView *self, + ModestFolderViewStyle style); + +/** + * modest_folder_view_set_account_id_of_visible_server_account: + * @self: a #ModestFolderView + * @account_id: the remote server account id + * + * sets the server account id (value returned by tny_account_get_id()) + * to the string passed as argument. The remote server with the + * specified id will be the unique visible account if the folder view + * is configured in MODEST_FOLDER_VIEW_STYLE_SHOW_ONE + **/ +void modest_folder_view_set_account_id_of_visible_server_account (ModestFolderView *self, + const gchar *account_id); -const gchar* modest_folder_view_get_selected_account (ModestFolderView *self); +/** + * modest_folder_view_get_account_id_of_visible_server_account: + * @self: a #ModestFolderView + * + * gets the account id of the currently visible server account id + * + * Return value: the visible server account id or NULL if none set + **/ +const gchar* modest_folder_view_get_account_id_of_visible_server_account (ModestFolderView *self); G_END_DECLS