~ubuntu-branches/ubuntu/precise/rhythmbox/precise-201203091205

« back to all changes in this revision

Viewing changes to rhythmdb/rhythmdb-property-model.c

Tags: upstream-0.9.5
ImportĀ upstreamĀ versionĀ 0.9.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 *
17
17
 *  You should have received a copy of the GNU General Public License
18
18
 *  along with this program; if not, write to the Free Software
19
 
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
19
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
20
20
 *
21
21
 */
22
22
 
24
24
#include <unistd.h>
25
25
#include <stdlib.h>
26
26
#include <string.h>
27
 
 
28
27
#include <glib/gi18n.h>
 
28
 
29
29
#include "rhythmdb-property-model.h"
30
30
#include "rb-debug.h"
31
31
#include "gsequence.h"
 
32
#include "rb-refstring.h"
32
33
#include "rb-tree-dnd.h"
33
34
 
34
35
static void rhythmdb_property_model_tree_model_init (GtkTreeModelIface *iface);
40
41
                        G_IMPLEMENT_INTERFACE(RB_TYPE_TREE_DRAG_SOURCE,
41
42
                                              rhythmdb_property_model_drag_source_init))
42
43
 
 
44
typedef struct {
 
45
        RBRefString *string;
 
46
        RBRefString *sort_string;
 
47
        guint refcount;
 
48
} RhythmDBPropertyModelEntry;
 
49
 
 
50
 
43
51
static void rhythmdb_property_model_finalize (GObject *object);
44
52
static void rhythmdb_property_model_set_property (GObject *object,
45
53
                                               guint prop_id,
61
69
static void rhythmdb_property_model_entry_removed_cb (RhythmDBQueryModel *model,
62
70
                                                      RhythmDBEntry *entry,
63
71
                                                      RhythmDBPropertyModel *propmodel);
64
 
static void rhythmdb_property_model_insert (RhythmDBPropertyModel *model, RhythmDBEntry *entry);
 
72
static RhythmDBPropertyModelEntry* rhythmdb_property_model_insert (RhythmDBPropertyModel *model,
 
73
                                                                   RhythmDBEntry *entry);
65
74
static void rhythmdb_property_model_delete (RhythmDBPropertyModel *model,
66
75
                                            RhythmDBEntry *entry);
67
76
static void rhythmdb_property_model_delete_prop (RhythmDBPropertyModel *model,
98
107
                                                          GList *paths);
99
108
static gboolean rhythmdb_property_model_row_draggable (RbTreeDragSource *dragsource,
100
109
                                                       GList *paths);
 
110
 
101
111
enum {
102
112
        TARGET_ALBUMS,
103
113
        TARGET_GENRE,
127
137
static GtkTargetList *rhythmdb_property_model_album_drag_target_list = NULL;
128
138
static GtkTargetList *rhythmdb_property_model_artist_drag_target_list = NULL;
129
139
static GtkTargetList *rhythmdb_property_model_genre_drag_target_list = NULL;
130
 
 
131
 
typedef struct {
132
 
        RBRefString *string;
133
 
        RBRefString *sort_string;
134
 
        guint refcount;
135
 
} RhythmDBPropertyModelEntry;
 
140
static GtkTargetList *rhythmdb_property_model_location_drag_target_list = NULL;
136
141
 
137
142
struct RhythmDBPropertyModelPrivate
138
143
{
139
144
        RhythmDB *db;
140
145
 
141
146
        RhythmDBQueryModel *query_model;
 
147
        GHashTable *entries;
142
148
 
143
149
        RhythmDBPropType propid;
144
150
        RhythmDBPropType sort_propid;
168
174
{
169
175
        PROP_0,
170
176
        PROP_RHYTHMDB,
171
 
        PROP_QUERY,
172
177
        PROP_PROP,
173
178
        PROP_QUERY_MODEL,
174
179
};
192
197
                rhythmdb_property_model_genre_drag_target_list =
193
198
                        gtk_target_list_new (targets_genre,
194
199
                                             G_N_ELEMENTS (targets_genre));
 
200
        if (!rhythmdb_property_model_location_drag_target_list)
 
201
                rhythmdb_property_model_location_drag_target_list =
 
202
                        gtk_target_list_new (targets_location,
 
203
                                             G_N_ELEMENTS (targets_location));
195
204
 
196
205
        object_class->set_property = rhythmdb_property_model_set_property;
197
206
        object_class->get_property = rhythmdb_property_model_get_property;
217
226
                                                              G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
218
227
 
219
228
        g_object_class_install_property (object_class,
220
 
                                         PROP_QUERY,
221
 
                                         g_param_spec_pointer ("query",
222
 
                                                              "Query",
223
 
                                                              "RhythmDBQuery",
224
 
                                                              G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
225
 
 
226
 
        g_object_class_install_property (object_class,
227
229
                                         PROP_PROP,
228
230
                                         g_param_spec_int ("prop",
229
231
                                                           "propid",
267
269
        iface->drag_data_get = rhythmdb_property_model_drag_data_get;
268
270
}
269
271
 
 
272
static gboolean
 
273
_remove_entry_cb (RhythmDBEntry *entry,
 
274
                  gpointer unused,
 
275
                  RhythmDBPropertyModel *model)
 
276
{
 
277
        rhythmdb_property_model_delete (model, entry);
 
278
        return TRUE;
 
279
}
 
280
 
 
281
static gboolean
 
282
_add_entry_cb (GtkTreeModel *model,
 
283
               GtkTreePath *path,
 
284
               GtkTreeIter *iter,
 
285
               RhythmDBPropertyModel *propmodel)
 
286
{
 
287
        rhythmdb_property_model_row_inserted_cb (model, path, iter, propmodel);
 
288
        return FALSE;
 
289
}
 
290
 
270
291
static void
271
292
rhythmdb_property_model_set_property (GObject *object,
272
 
                                   guint prop_id,
273
 
                                   const GValue *value,
274
 
                                   GParamSpec *pspec)
 
293
                                      guint prop_id,
 
294
                                      const GValue *value,
 
295
                                      GParamSpec *pspec)
275
296
{
276
297
        RhythmDBPropertyModel *model = RHYTHMDB_PROPERTY_MODEL (object);
277
298
 
281
302
                model->priv->db = g_value_get_object (value);
282
303
                break;
283
304
        }
284
 
        case PROP_QUERY:
285
 
                if (model->priv->query)
286
 
                        rhythmdb_query_free (model->priv->query);
287
 
                model->priv->query = rhythmdb_query_copy (g_value_get_pointer (value));
288
 
                break;
289
305
        case PROP_PROP:
290
306
                model->priv->propid = g_value_get_int (value);
291
307
                switch (model->priv->propid) {
322
338
                        g_signal_handlers_disconnect_by_func (G_OBJECT (model->priv->query_model),
323
339
                                                              G_CALLBACK (rhythmdb_property_model_prop_changed_cb),
324
340
                                                              model);
 
341
                        g_hash_table_foreach_remove (model->priv->entries, (GHRFunc)_remove_entry_cb, model);
325
342
                        g_object_unref (G_OBJECT (model->priv->query_model));
326
343
                }
327
344
                
328
345
                model->priv->query_model = g_value_get_object (value);
 
346
                g_assert (rhythmdb_property_model_iter_n_children (GTK_TREE_MODEL (model), NULL) == 1);
329
347
 
330
348
                if (model->priv->query_model) {
 
349
                        g_object_ref (G_OBJECT (model->priv->query_model));
331
350
                        g_signal_connect_object (G_OBJECT (model->priv->query_model),
332
351
                                                 "row_inserted",
333
352
                                                 G_CALLBACK (rhythmdb_property_model_row_inserted_cb),
343
362
                                                 G_CALLBACK (rhythmdb_property_model_prop_changed_cb),
344
363
                                                 model,
345
364
                                                 0);
346
 
                        g_object_ref (G_OBJECT (model->priv->query_model));
 
365
                        gtk_tree_model_foreach (GTK_TREE_MODEL (model->priv->query_model),
 
366
                                                (GtkTreeModelForeachFunc)_add_entry_cb,
 
367
                                                model);
347
368
                }
348
369
                break;
349
370
        }
365
386
        case PROP_RHYTHMDB:
366
387
                g_value_set_object (value, model->priv->db);
367
388
                break;
368
 
        case PROP_QUERY:
369
 
                g_value_set_pointer (value, model->priv->query);
370
 
                break;
371
389
        case PROP_PROP:
372
390
                g_value_set_int (value, model->priv->propid);
373
391
                break;
389
407
 
390
408
        model->priv->properties = g_sequence_new (NULL);
391
409
        model->priv->reverse_map = g_hash_table_new (g_str_hash, g_str_equal);
 
410
        model->priv->entries = g_hash_table_new (g_direct_hash, g_direct_equal);
392
411
 
393
412
        model->priv->all = g_new0 (RhythmDBPropertyModelEntry, 1);
394
413
        model->priv->all->string = rb_refstring_new (_("All"));
423
442
 
424
443
        g_hash_table_destroy (model->priv->reverse_map);
425
444
        g_sequence_free (model->priv->properties);
 
445
        g_hash_table_destroy (model->priv->entries);
426
446
 
427
447
        if (model->priv->query_model)
428
448
                g_object_unref (G_OBJECT (model->priv->query_model));
436
456
        return g_object_new (RHYTHMDB_TYPE_PROPERTY_MODEL, "db", db, "prop", propid, NULL);
437
457
}
438
458
 
439
 
static inline RhythmDBEntry *
440
 
entry_from_tree_iter (GtkTreeModel *model, GtkTreeIter *iter)
441
 
{
442
 
        RhythmDBEntry *entry;
443
 
        gtk_tree_model_get (model, iter, 0, &entry, -1);
444
 
        return entry;
445
 
}
446
 
 
447
459
static void
448
460
rhythmdb_property_model_row_inserted_cb (GtkTreeModel *model,
449
461
                                         GtkTreePath *path,
450
462
                                         GtkTreeIter *iter,
451
463
                                         RhythmDBPropertyModel *propmodel)
452
464
{
453
 
        RhythmDBEntry *entry = entry_from_tree_iter (model, iter);
454
 
 
455
 
        if (rhythmdb_entry_get_boolean (entry, RHYTHMDB_PROP_HIDDEN) == FALSE) {
456
 
                rhythmdb_property_model_insert (propmodel, entry);
457
 
                rhythmdb_property_model_sync (propmodel);
458
 
        }
 
465
        RhythmDBEntry *entry = rhythmdb_query_model_iter_to_entry (RHYTHMDB_QUERY_MODEL (model), iter);
 
466
        RhythmDBPropertyModelEntry *prop;
 
467
 
 
468
        if (g_hash_table_lookup (propmodel->priv->entries, entry))
 
469
                return;
 
470
 
 
471
 
 
472
        prop = rhythmdb_property_model_insert (propmodel, entry);
 
473
        g_hash_table_insert (propmodel->priv->entries, entry, prop);
 
474
 
 
475
        rhythmdb_property_model_sync (propmodel);
459
476
}
460
477
 
461
478
static void
462
479
rhythmdb_property_model_prop_changed_cb (RhythmDB *db, RhythmDBEntry *entry,
463
 
                                         RhythmDBPropType prop, const GValue *old,
 
480
                                         RhythmDBPropType propid, const GValue *old,
464
481
                                         const GValue *new,
465
482
                                         RhythmDBPropertyModel *propmodel)
466
483
{
467
 
        if (prop == RHYTHMDB_PROP_HIDDEN) {
468
 
                gboolean old_hidden = g_value_get_boolean (old);
469
 
                gboolean new_hidden = g_value_get_boolean (new);
470
 
 
471
 
                if (new_hidden == old_hidden)
472
 
                        return;
473
 
 
474
 
                rb_debug ("recieving hidden-change notification for %s", entry->location);
475
 
 
476
 
                if (new_hidden)
477
 
                        rhythmdb_property_model_delete (propmodel, entry);
478
 
                else
479
 
                        rhythmdb_property_model_insert (propmodel, entry);
480
 
 
481
 
                rhythmdb_property_model_sync (propmodel);
482
 
        } else {        
483
 
                if (prop != propmodel->priv->propid)
484
 
                        return;
485
 
                if (rhythmdb_entry_get_boolean (entry, RHYTHMDB_PROP_HIDDEN))
486
 
                        return;
487
 
 
488
 
                rhythmdb_property_model_delete_prop (propmodel, g_value_get_string (old));
489
 
                rhythmdb_property_model_insert (propmodel, entry);
490
 
                rhythmdb_property_model_sync (propmodel);
 
484
        if (propid == RHYTHMDB_PROP_HIDDEN) {
 
485
                gboolean old_val = g_value_get_boolean (old);
 
486
                gboolean new_val = g_value_get_boolean (new);
 
487
 
 
488
                if (old_val != new_val) {
 
489
                        if (new_val == FALSE) {
 
490
                                RhythmDBPropertyModelEntry *prop;
 
491
 
 
492
                                if (g_hash_table_lookup (propmodel->priv->entries, entry) != NULL)
 
493
                                        return;
 
494
 
 
495
                                prop = rhythmdb_property_model_insert (propmodel, entry);
 
496
                                g_hash_table_insert (propmodel->priv->entries, entry, prop);
 
497
                        } else {
 
498
                                if (g_hash_table_lookup (propmodel->priv->entries, entry) == NULL)
 
499
                                        return;
 
500
 
 
501
                                rhythmdb_property_model_delete (propmodel, entry);
 
502
                                g_hash_table_remove (propmodel->priv->entries, entry);
 
503
                        }
 
504
                }
 
505
        } else {
 
506
                RhythmDBPropertyModelEntry *prop;
 
507
                
 
508
                if (propid != propmodel->priv->propid)
 
509
                        return;
 
510
 
 
511
                if (g_hash_table_lookup (propmodel->priv->entries, entry) == NULL)
 
512
                        return;
 
513
 
 
514
                rhythmdb_property_model_delete (propmodel, entry);
 
515
                prop = rhythmdb_property_model_insert (propmodel, entry);
 
516
                g_hash_table_insert (propmodel->priv->entries, entry, prop);
491
517
        }
 
518
 
 
519
        rhythmdb_property_model_sync (propmodel);
492
520
}
493
521
 
494
522
static void
496
524
                                          RhythmDBEntry *entry,
497
525
                                          RhythmDBPropertyModel *propmodel)
498
526
{
499
 
        if (rhythmdb_entry_get_boolean (entry, RHYTHMDB_PROP_HIDDEN) == FALSE) {
500
 
                rhythmdb_property_model_delete (propmodel, entry);
501
 
                rhythmdb_property_model_sync (propmodel);
502
 
        }
 
527
        if (g_hash_table_lookup (propmodel->priv->entries, entry) == NULL)
 
528
                return;
 
529
 
 
530
        rhythmdb_property_model_delete (propmodel, entry);
 
531
        g_hash_table_remove (propmodel->priv->entries, entry);
 
532
        rhythmdb_property_model_sync (propmodel);
503
533
}
504
534
 
505
535
static gint
513
543
        return strcmp (a_str, b_str);
514
544
}
515
545
 
516
 
static void
 
546
static RhythmDBPropertyModelEntry *
517
547
rhythmdb_property_model_insert (RhythmDBPropertyModel *model, RhythmDBEntry *entry)
518
548
{
519
549
        RhythmDBPropertyModelEntry *prop;
530
560
                prop = g_sequence_ptr_get_data (ptr);
531
561
                prop->refcount++;
532
562
                rb_debug ("adding \"%s\": refcount %d", propstr, prop->refcount);
533
 
                return;
 
563
                return prop;
534
564
        }
 
565
        rb_debug ("adding new property \"%s\"", propstr);
535
566
 
536
567
        prop = g_new0 (RhythmDBPropertyModelEntry, 1);
537
568
        prop->string = rb_refstring_new (propstr);
550
581
        path = rhythmdb_property_model_get_path (GTK_TREE_MODEL (model), &iter);
551
582
        gtk_tree_model_row_inserted (GTK_TREE_MODEL (model), path, &iter);
552
583
        gtk_tree_path_free (path);
 
584
 
 
585
        return prop;
553
586
}
554
587
 
555
 
void
 
588
static void
556
589
rhythmdb_property_model_delete (RhythmDBPropertyModel *model,
557
590
                                RhythmDBEntry *entry)
558
591
{
 
592
        RhythmDBPropertyModelEntry *prop;
559
593
        const char *propstr;
560
594
 
561
 
        propstr = rhythmdb_entry_get_string (entry, model->priv->propid);
 
595
        prop = g_hash_table_lookup (model->priv->entries, entry);
 
596
        propstr = rb_refstring_get (prop->string);
562
597
        rhythmdb_property_model_delete_prop (model, propstr);
563
598
}
564
599
        
602
637
{
603
638
        GSequencePtr ptr;
604
639
 
 
640
        if (name == NULL) {
 
641
                if (iter) {
 
642
                        iter->stamp = model->priv->stamp;
 
643
                        iter->user_data = model->priv->all;
 
644
                }
 
645
                return TRUE;
 
646
        }
 
647
 
605
648
        ptr = g_hash_table_lookup (model->priv->reverse_map, name);
606
 
 
607
649
        if (!ptr)
608
650
                return FALSE;
609
651
 
610
 
        iter->stamp = model->priv->stamp;
611
 
        iter->user_data = ptr;
 
652
        if (iter) {
 
653
                iter->stamp = model->priv->stamp;
 
654
                iter->user_data = ptr;
 
655
        }
612
656
 
613
657
        return TRUE;
614
658
}
871
915
        RhythmDBPropertyModel *model = RHYTHMDB_PROPERTY_MODEL (dragsource);
872
916
        guint target;
873
917
        GtkTargetList *drag_target_list;
874
 
        GCompareDataFunc sort_func = NULL;
875
918
 
876
919
        switch (model->priv->propid) {
877
920
        case RHYTHMDB_PROP_GENRE:
878
921
                drag_target_list = rhythmdb_property_model_genre_drag_target_list;
879
 
                sort_func = (GCompareDataFunc) rhythmdb_query_model_genre_sort_func;
880
922
                break;
881
923
        case RHYTHMDB_PROP_ALBUM:
882
924
                drag_target_list = rhythmdb_property_model_album_drag_target_list;
883
 
                sort_func = (GCompareDataFunc) rhythmdb_query_model_album_sort_func;
884
925
                break;
885
926
        case RHYTHMDB_PROP_ARTIST:
886
927
                drag_target_list = rhythmdb_property_model_artist_drag_target_list;
887
 
                sort_func = (GCompareDataFunc) rhythmdb_query_model_artist_sort_func;
 
928
                break;
 
929
        case RHYTHMDB_PROP_LOCATION:
 
930
                drag_target_list = rhythmdb_property_model_location_drag_target_list;
888
931
                break;
889
932
        default:
890
933
                g_assert_not_reached ();
898
941
 
899
942
        if (target == TARGET_URIS) {
900
943
                RhythmDB *db = model->priv->db;
901
 
                GtkTreeModel* query_model = GTK_TREE_MODEL (rhythmdb_query_model_new_empty (db));
 
944
                RhythmDBQueryModel *query_model;
902
945
                GString* reply = g_string_new ("");
903
946
                GtkTreeIter iter;
904
947
                gboolean is_all;
905
948
                struct QueryModelCbStruct tmp;
906
949
                GtkTreePath *path;
 
950
                GCompareDataFunc sort_func = NULL;
 
951
                gpointer sort_data;
 
952
                gboolean sort_reverse;
907
953
 
 
954
                query_model = rhythmdb_query_model_new_empty (db);
 
955
                /* FIXME the sort order on the query model at this point is usually
 
956
                 * not the user's selected sort order.
 
957
                 */
 
958
                g_object_get (G_OBJECT (model->priv->query_model),
 
959
                              "sort-func", &sort_func,
 
960
                              "sort-data", &sort_data,
 
961
                              "sort-reverse", &sort_reverse,
 
962
                              NULL);
908
963
                rhythmdb_query_model_set_sort_order (RHYTHMDB_QUERY_MODEL (query_model),
909
 
                                                     sort_func, 0, FALSE);
 
964
                                                     sort_func, GUINT_TO_POINTER (sort_data), NULL, sort_reverse);
910
965
 
911
966
                rb_debug ("getting drag data as uri list");
912
967
                /* check if first selected row is 'All' */
917
972
                                    &is_all, -1);
918
973
                gtk_tree_path_free (path);
919
974
                if (is_all) {
920
 
                        /*filter out radios*/
921
 
                        rhythmdb_do_full_query (db, query_model,
922
 
                                                RHYTHMDB_QUERY_PROP_EQUALS,
923
 
                                                RHYTHMDB_PROP_TYPE, 
924
 
                                                RHYTHMDB_ENTRY_TYPE_SONG,
925
 
                                                RHYTHMDB_QUERY_END);
 
975
                        g_object_set (G_OBJECT (query_model), 
 
976
                                      "base-model", model->priv->query_model, 
 
977
                                      NULL);
926
978
                } else {
927
979
                        GList *row;
928
 
                        GPtrArray* subquery = g_ptr_array_new();
 
980
                        GPtrArray *query;
 
981
                        GPtrArray *subquery = g_ptr_array_new ();
929
982
 
930
983
                        for (row = paths; row; row = row->next) {
931
984
                                char* name;
934
987
                                gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
935
988
                                                    RHYTHMDB_PROPERTY_MODEL_COLUMN_TITLE, 
936
989
                                                    &name, -1);
937
 
                                if (row->next) {
 
990
                                if (row == paths) {
938
991
                                        rhythmdb_query_append (db, subquery,
939
992
                                                               RHYTHMDB_QUERY_PROP_EQUALS,
940
993
                                                               model->priv->propid, name,
 
994
                                                               RHYTHMDB_QUERY_END);
 
995
                                } else {
 
996
                                        rhythmdb_query_append (db, subquery,
941
997
                                                               RHYTHMDB_QUERY_DISJUNCTION,
 
998
                                                               RHYTHMDB_QUERY_PROP_EQUALS,
 
999
                                                               model->priv->propid, name,
942
1000
                                                               RHYTHMDB_QUERY_END);
943
 
                                } else {
944
 
                                        rhythmdb_query_append (db, subquery,
945
 
                                                               RHYTHMDB_QUERY_PROP_EQUALS,
946
 
                                                               model->priv->propid, name,
947
 
                                                               RHYTHMDB_QUERY_END);
948
1001
                                }
949
1002
 
950
1003
                                gtk_tree_path_free (path);
951
1004
                                g_free (name);
952
1005
                        }
953
 
                        /*filter out radios*/
954
 
                        rhythmdb_do_full_query (db, query_model,
955
 
                                                RHYTHMDB_QUERY_PROP_EQUALS,
956
 
                                                RHYTHMDB_PROP_TYPE, 
957
 
                                                RHYTHMDB_ENTRY_TYPE_SONG,
958
 
                                                RHYTHMDB_QUERY_SUBQUERY,
959
 
                                                subquery,
960
 
                                                RHYTHMDB_QUERY_END);
 
1006
                        query = rhythmdb_query_parse (db,
 
1007
                                                      RHYTHMDB_QUERY_SUBQUERY, subquery,
 
1008
                                                      RHYTHMDB_QUERY_END);
 
1009
 
 
1010
                        g_object_set (G_OBJECT (query_model), 
 
1011
                                      "query", query,
 
1012
                                      "base-model", model->priv->query_model, 
 
1013
                                      NULL);
 
1014
                        rhythmdb_query_free (query);
961
1015
                }
962
1016
                
963
1017
                tmp.db = db; 
968
1022
                 * and prepare the query using do_full_query_async. The query would be 
969
1023
                 * hooked to the drag context.
970
1024
                 */
971
 
                gtk_tree_model_foreach (query_model,
972
 
                                        (GtkTreeModelForeachFunc)query_model_cb,
 
1025
                gtk_tree_model_foreach (GTK_TREE_MODEL (query_model),
 
1026
                                        (GtkTreeModelForeachFunc) query_model_cb,
973
1027
                                        &tmp);
974
1028
                
975
 
                g_object_unref (query_model);
 
1029
                g_object_unref (query_model);
976
1030
 
977
1031
                gtk_selection_data_set (selection_data,
978
1032
                                        selection_data->target,
1069
1123
        model->priv->syncing_id = g_idle_add ((GSourceFunc)rhythmdb_property_model_perform_sync, model);
1070
1124
}
1071
1125
 
 
1126
/* This should really be standard. */
 
1127
#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
 
1128
 
 
1129
GType
 
1130
rhythmdb_property_model_column_get_type (void)
 
1131
{
 
1132
        static GType etype = 0;
 
1133
 
 
1134
        if (etype == 0) {
 
1135
                static const GEnumValue values[] = {
 
1136
                        ENUM_ENTRY (RHYTHMDB_PROPERTY_MODEL_COLUMN_TITLE, "Property title"),
 
1137
                        ENUM_ENTRY (RHYTHMDB_PROPERTY_MODEL_COLUMN_PRIORITY, "Value priority"),
 
1138
                        ENUM_ENTRY (RHYTHMDB_PROPERTY_MODEL_COLUMN_NUMBER, "Track count"),
 
1139
                        { 0, 0, 0 }
 
1140
                };
 
1141
 
 
1142
                etype = g_enum_register_static ("RhythmDBPropertyModelColumn", values);
 
1143
        }
 
1144
 
 
1145
        return etype;
 
1146
}
 
1147