1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
3 * arch-tag: Header for RhythmDB query result GtkTreeModel impl.
5 * Copyright (C) 2003 Colin Walters <walters@rhythmbox.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24 #include <glib-object.h>
30 #ifndef RHYTHMDB_QUERY_MODEL_H
31 #define RHYTHMDB_QUERY_MODEL_H
35 #define RHYTHMDB_TYPE_QUERY_MODEL (rhythmdb_query_model_get_type ())
36 #define RHYTHMDB_QUERY_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), RHYTHMDB_TYPE_QUERY_MODEL, RhythmDBQueryModel))
37 #define RHYTHMDB_QUERY_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), RHYTHMDB_TYPE_QUERY_MODEL, RhythmDBQueryModelClass))
38 #define RHYTHMDB_IS_QUERY_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), RHYTHMDB_TYPE_QUERY_MODEL))
39 #define RHYTHMDB_IS_QUERY_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), RHYTHMDB_TYPE_QUERY_MODEL))
40 #define RHYTHMDB_QUERY_MODEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), RHYTHMDB_TYPE_QUERY_MODEL, RhythmDBQueryModelClass))
42 GType
rhythmdb_query_model_limit_type_get_type (void);
43 #define RHYTHMDB_TYPE_QUERY_MODEL_LIMIT_TYPE (rhythmdb_query_model_limit_type_get_type ())
46 RHYTHMDB_QUERY_MODEL_LIMIT_NONE
,
47 RHYTHMDB_QUERY_MODEL_LIMIT_COUNT
,
48 RHYTHMDB_QUERY_MODEL_LIMIT_SIZE
,
49 RHYTHMDB_QUERY_MODEL_LIMIT_TIME
,
50 } RhythmDBQueryModelLimitType
;
52 typedef struct RhythmDBQueryModelPrivate RhythmDBQueryModelPrivate
;
54 #define RHYTHMDB_QUERY_MODEL_SUGGESTED_UPDATE_CHUNK 32
60 RhythmDBQueryModelPrivate
*priv
;
68 void (*complete
) (RhythmDBQueryModel
*model
);
69 void (*entry_prop_changed
) (RhythmDBQueryModel
*model
,
71 RhythmDBPropType prop
,
73 const GValue
*new_value
);
74 void (*non_entry_dropped
) (RhythmDBQueryModel
*model
,
77 void (*entry_removed
) (RhythmDBQueryModel
*model
,
78 RhythmDBEntry
*entry
);
79 void (*post_entry_delete
) (RhythmDBQueryModel
*model
,
80 RhythmDBEntry
*entry
);
82 } RhythmDBQueryModelClass
;
84 GType
rhythmdb_query_model_get_type (void);
86 RhythmDBQueryModel
* rhythmdb_query_model_new (RhythmDB
*db
,
88 GCompareDataFunc sort_func
,
90 GDestroyNotify sort_data_destroy
,
91 gboolean sort_reverse
);
93 RhythmDBQueryModel
* rhythmdb_query_model_new_empty (RhythmDB
*db
);
95 void rhythmdb_query_model_copy_contents (RhythmDBQueryModel
*dest
,
96 RhythmDBQueryModel
*src
);
98 void rhythmdb_query_model_chain (RhythmDBQueryModel
*child
,
99 RhythmDBQueryModel
*base
,
100 gboolean import_entries
);
102 void rhythmdb_query_model_add_entry (RhythmDBQueryModel
*model
,
103 RhythmDBEntry
*entry
,
106 gboolean
rhythmdb_query_model_remove_entry (RhythmDBQueryModel
*model
,
107 RhythmDBEntry
*entry
);
109 void rhythmdb_query_model_move_entry (RhythmDBQueryModel
*model
,
110 RhythmDBEntry
*entry
,
113 guint64
rhythmdb_query_model_get_size (RhythmDBQueryModel
*model
);
115 long rhythmdb_query_model_get_duration (RhythmDBQueryModel
*model
);
117 gboolean
rhythmdb_query_model_entry_to_iter (RhythmDBQueryModel
*model
,
118 RhythmDBEntry
*entry
,
121 gboolean
rhythmdb_query_model_has_pending_changes (RhythmDBQueryModel
*model
);
123 RhythmDBEntry
* rhythmdb_query_model_tree_path_to_entry (RhythmDBQueryModel
*model
,
125 RhythmDBEntry
* rhythmdb_query_model_iter_to_entry (RhythmDBQueryModel
*model
,
126 GtkTreeIter
*entry_iter
);
127 RhythmDBEntry
* rhythmdb_query_model_get_next_from_entry (RhythmDBQueryModel
*model
,
128 RhythmDBEntry
*entry
);
129 RhythmDBEntry
* rhythmdb_query_model_get_previous_from_entry (RhythmDBQueryModel
*model
,
130 RhythmDBEntry
*entry
);
131 char * rhythmdb_query_model_compute_status_normal (RhythmDBQueryModel
*model
,
132 const char *singular
,
135 void rhythmdb_query_model_set_sort_order (RhythmDBQueryModel
*model
,
136 GCompareDataFunc sort_func
,
138 GDestroyNotify sort_data_destroy
,
139 gboolean sort_reverse
);
141 void rhythmdb_query_model_reapply_query (RhythmDBQueryModel
*model
,
144 gint
rhythmdb_query_model_location_sort_func (RhythmDBEntry
*a
,
148 gint
rhythmdb_query_model_string_sort_func (RhythmDBEntry
*a
,
152 gint
rhythmdb_query_model_title_sort_func (RhythmDBEntry
*a
,
156 gint
rhythmdb_query_model_album_sort_func (RhythmDBEntry
*a
,
160 gint
rhythmdb_query_model_artist_sort_func (RhythmDBEntry
*a
,
164 gint
rhythmdb_query_model_genre_sort_func (RhythmDBEntry
*a
,
168 gint
rhythmdb_query_model_track_sort_func (RhythmDBEntry
*a
,
172 gint
rhythmdb_query_model_double_ceiling_sort_func (RhythmDBEntry
*a
,
176 gint
rhythmdb_query_model_ulong_sort_func (RhythmDBEntry
*a
,
180 gint
rhythmdb_query_model_date_sort_func (RhythmDBEntry
*a
,
185 #endif /* __RHYTHMDB_QUERY_MODEL_H */