TnyGtkAccountListModel

TnyGtkAccountListModel — A tree model for account instances

Synopsis




#define             TNY_TYPE_GTK_ACCOUNT_LIST_MODEL_COLUMN
                    TnyGtkAccountListModel;
GType               tny_gtk_account_list_model_column_get_type
                                                        (void);
GtkTreeModel*       tny_gtk_account_list_model_new      (void);

Object Hierarchy


  GObject
   +----GtkListStore
         +----TnyGtkAccountListModel

Implemented Interfaces

TnyGtkAccountListModel implements GtkBuildable, GtkTreeModel, TnyList, GtkTreeDragSource, GtkTreeDragDest and GtkTreeSortable.

Description

A GtkTreeModel implementation for storing TnyStoreAccount instances.

The implementation inherits the GtkTreeStore, implements GtkTreeModel and TnyList. It can for example be used to display the accounts in a GtkComboBox or GtkTreeView. If, however, you want to show both the account names and the folder names in a tree view style, consider using the TnyGtkAccountTreeModel in stead.

It's very important to unreference the instance you will get when doing something like this:

TnyAccount *account;
gtk_tree_model_get (model, &iter,
  TNY_ACCOUNT_LIST_MODEL_INSTANCE_COLUMN,
  &account, -1);
/* use account */
g_object_unref (G_OBJECT(account));

The column is indeed a G_TYPE_OBJECT column and getting it from the GtkTreeModel will indeed add a reference.

Details

TNY_TYPE_GTK_ACCOUNT_LIST_MODEL_COLUMN

#define TNY_TYPE_GTK_ACCOUNT_LIST_MODEL_COLUMN (tny_gtk_account_list_model_column_get_type())


TnyGtkAccountListModel

typedef struct _TnyGtkAccountListModel TnyGtkAccountListModel;

A GtkTreeModel for TnyAccount instances

Note that a TnyGtkAccountListModel is a TnyList too. You can use the TnyList API on instances of this type too.

Note that you must make sure that you unreference TnyAccount instances that you get out of the instance column of this type using the GtkTreeModel API gtk_tree_model_get().

free-function: g_object_unref


tny_gtk_account_list_model_column_get_type ()

GType               tny_gtk_account_list_model_column_get_type
                                                        (void);

GType system helper function

Returns : a GType

tny_gtk_account_list_model_new ()

GtkTreeModel*       tny_gtk_account_list_model_new      (void);

Create a new GtkTreeModel suitable for showing a list of accounts. Note that when using gtk_combo_box_set_model() or gtk_tree_view_set_model(), the view will add its reference to your model instance. If you want the view to become the owner, you must get rid of your initial reference.

Example:

GtkTreeModel *model = tny_gtk_account_list_model_new ();
GtkTreeView *view = ...;
tny_account_store_get_accounts (accstore, TNY_LIST (model), ...);
gtk_tree_view_set_model (view, model);
g_object_unref (model);

Returns : (caller-owns): a new GtkTreeModel for accounts

Since 1.0 audience: application-developer