summaryrefslogtreecommitdiff
path: root/browse_model.h
blob: 1070d74558a69d0d522fcd85210f0f17b9c5e517 (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
#ifndef _BROWSE_MODEL_H_
#define _BROWSE_MODEL_H_

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

#include "db.h"

#define MODEL_TYPE_BROWSE			(browse_model_get_type())
#define BROWSE_MODEL(obj)			(G_TYPE_CHECK_INSTANCE_CAST((obj), MODEL_TYPE_BROWSE, BrowseModel))
#define BROWSE_MODEL_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST((klass), MODEL_TYPE_BROWSE, BrowseModelClass))
#define MODEL_IS_BROWSE(obj)			(G_TYPE_CHECK_INSTANCE_TYPE((obj), MODEL_TYPE_BROWSE))
#define MODEL_IS_BROWSE_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE((klass), MODEL_TYPE_BROWSE))
#define BROWSE_MODEL_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS((obj), MODEL_TYPE_BROWSE, BrowseModelClass))

enum {
	BROWSE_MODEL_COL_NAME = 0,
	BROWSE_MODEL_N_COLUMNS,
};

typedef struct _BrowseModelRecord BrowseModelRecord;
typedef struct _BrowseModel BrowseModel;
typedef struct _BrowseModelClass BrowseModelClass;

struct _BrowseModelRecord {
	struct directory_t dir;
	BrowseModelRecord *parent;
	GArray *children;
	guint pos;
};

struct _BrowseModel {
	GObject parent;

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

struct _BrowseModelClass {
	GObjectClass parent_class;
};

GType browse_model_get_type();
BrowseModel *browse_model_new();
void browse_model_get_dir_record(GtkTreeModel*, GtkTreeIter*, struct directory_t**);

#endif