summaryrefslogtreecommitdiff
path: root/tag_model.h
blob: 43e59a10b784e9347690cb68c5593232be609509 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef _TAG_MODEL_H_
#define _TAG_MODEL_H_

#include <gtk/gtk.h>
#include <glib.h>

#include "db.h"

#define MODEL_TYPE_TAG			(tag_model_get_type())
#define TAG_MODEL(obj)			(G_TYPE_CHECK_INSTANCE_CAST((obj), MODEL_TYPE_TAG, TagModel))
#define TAG_MODEL_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST((klass), MODEL_TYPE_TAG, TagModelClass))
#define MODEL_IS_TAG(obj)			(G_TYPE_CHECK_INSTANCE_TYPE((obj), MODEL_TYPE_TAG))
#define MODEL_IS_TAG_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE((klass), MODEL_TYPE_TAG))
#define TAG_MODEL_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS((obj), MODEL_TYPE_TAG, TagModelClass))

enum {
	TAG_MODEL_COL_CHECKED = 0,
	TAG_MODEL_COL_INCONSISTENT,
	TAG_MODEL_COL_NAME,
	TAG_MODEL_N_COLUMNS,
};

typedef struct _TagModelRecord TagModelRecord;
typedef struct _TagModel TagModel;
typedef struct _TagModelClass TagModelClass;

struct _TagModelRecord {
	struct tag_t tag;
	gboolean checked;
	gboolean inconsistent;
	TagModelRecord *parent;
	GArray *children;
	guint pos;
};

struct _TagModel {
	GObject parent;

	guint num_rows;
	GArray *rows;
	gint n_columns;
	GType column_types[TAG_MODEL_N_COLUMNS];
	gint stamp;
};

struct _TagModelClass {
	GObjectClass parent_class;
};

GType tag_model_get_type();
TagModel *tag_model_new();
void tag_model_get_tag_record(GtkTreeModel*, GtkTreeIter*, struct tag_t**);
gboolean tag_model_get_checked(GtkTreeModel*, GtkTreeIter*);
void tag_model_set_checked(GtkTreeModel*, GtkTreeIter*, gboolean);
gboolean tag_model_get_inconsistent(GtkTreeModel*, GtkTreeIter*);
void tag_model_set_inconsistent(GtkTreeModel*, GtkTreeIter*, gboolean);

#endif