~snaggen/rhythmbox/bpm

« back to all changes in this revision

Viewing changes to widgets/rb-entry-view.c

  • Committer: Mattias Eriksson
  • Date: 2010-05-25 11:37:08 UTC
  • Revision ID: mattias.eriksson@vizrt.com-20100525113708-d6529lfzckfxtdca
Re add bpm tag

Show diffs side-by-side

added added

removed removed

Lines of Context:
742
742
        rhythmdb_entry_unref (entry);
743
743
}
744
744
 
 
745
#ifdef ENABLE_BPM
 
746
static void
 
747
rb_entry_view_bpm_cell_data_func (GtkTreeViewColumn *column,
 
748
                                   GtkCellRenderer *renderer,
 
749
                                   GtkTreeModel *tree_model,
 
750
                                   GtkTreeIter *iter,
 
751
                                   struct RBEntryViewCellDataFuncData *data)
 
752
{
 
753
        RhythmDBEntry *entry;
 
754
        char *str;
 
755
        gdouble val;
 
756
 
 
757
        entry = rhythmdb_query_model_iter_to_entry (data->view->priv->model, iter);
 
758
 
 
759
        val = rhythmdb_entry_get_double (entry, data->propid);
 
760
 
 
761
        if (val > 0)
 
762
                str = g_strdup_printf ("%.2f", val);
 
763
        else
 
764
                str = g_strdup ("");
 
765
 
 
766
        g_object_set (renderer, "text", str, NULL);
 
767
        g_free (str);
 
768
        rhythmdb_entry_unref (entry);
 
769
}
 
770
#endif
 
771
 
745
772
static void
746
773
rb_entry_view_long_cell_data_func (GtkTreeViewColumn *column,
747
774
                                   GtkCellRenderer *renderer,
1248
1275
                key = "Location";
1249
1276
                ellipsize = TRUE;
1250
1277
                break;
 
1278
        case RB_ENTRY_VIEW_COL_BPM:
 
1279
#ifdef ENABLE_BPM
 
1280
                propid = RHYTHMDB_PROP_BPM;
 
1281
                cell_data->propid = propid;
 
1282
                cell_data_func = (GtkTreeCellDataFunc) rb_entry_view_bpm_cell_data_func;
 
1283
                sort_func = (GCompareDataFunc) rhythmdb_query_model_double_ceiling_sort_func;
 
1284
                title = _("BPM");
 
1285
                key = "BPM";
 
1286
                strings[0] = title;
 
1287
                strings[1] = "999.99";
 
1288
#else
 
1289
                return;
 
1290
#endif
 
1291
                break;
1251
1292
        case RB_ENTRY_VIEW_COL_ERROR:
1252
1293
                propid = RHYTHMDB_PROP_PLAYBACK_ERROR;
1253
1294
                cell_data->propid = RHYTHMDB_PROP_PLAYBACK_ERROR;
2152
2193
                        ENUM_ENTRY (RB_ENTRY_VIEW_COL_FIRST_SEEN, "First Seen"),
2153
2194
                        ENUM_ENTRY (RB_ENTRY_VIEW_COL_LAST_SEEN, "Last Seen"),
2154
2195
                        ENUM_ENTRY (RB_ENTRY_VIEW_COL_LOCATION, "Location"),
 
2196
                        ENUM_ENTRY (RB_ENTRY_VIEW_COL_BPM, "BPM"),
2155
2197
                        ENUM_ENTRY (RB_ENTRY_VIEW_COL_ERROR, "Error"),
2156
2198
                        { 0, 0, 0 }
2157
2199
                };