gui: Rename queue_model variable to gui_model
The concept of queues is going away over the next few releases, so we should rename this variable for consistency. I considered calling it "playlist_model", but I think "gui_model" better matches naming conventions in the gui. Imlements #77: Rename queue_model to playlist_model Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
2431ad104e
commit
fa96def899
30
gui/model.c
30
gui/model.c
|
@ -12,7 +12,7 @@ static gboolean __gui_model_iter_nth_child(GtkTreeModel *, GtkTreeIter *,
|
|||
|
||||
static struct playlist *cur_playlist = NULL;
|
||||
static GObjectClass *parent_class = NULL;
|
||||
static GuiModel *queue_model = NULL;
|
||||
static GuiModel *gui_model = NULL;
|
||||
static GType gui_model_type = 0;
|
||||
|
||||
static GType gui_model_columns[GUI_MODEL_N_COLUMNS] = {
|
||||
|
@ -161,7 +161,7 @@ static gboolean __gui_model_iter_nth_child(GtkTreeModel *model,
|
|||
if (parent || !cur_playlist || n >= queue_size(queue))
|
||||
return FALSE;
|
||||
|
||||
iter->stamp = queue_model->gm_stamp;
|
||||
iter->stamp = gui_model->gm_stamp;
|
||||
iter->user_data = GUINT_TO_POINTER(n);
|
||||
iter->user_data2 = queue_at(queue, n);
|
||||
return TRUE;
|
||||
|
@ -234,15 +234,15 @@ void gui_model_init(void)
|
|||
g_type_add_interface_static(gui_model_type, GTK_TYPE_TREE_MODEL,
|
||||
&gui_tree_model);
|
||||
|
||||
queue_model = g_object_new(gui_model_type, NULL);
|
||||
g_assert(queue_model != NULL);
|
||||
gui_model = g_object_new(gui_model_type, NULL);
|
||||
g_assert(gui_model != NULL);
|
||||
}
|
||||
|
||||
void gui_model_deinit(void)
|
||||
{
|
||||
g_object_unref(queue_model);
|
||||
g_object_unref(gui_model);
|
||||
gui_model_type = 0;
|
||||
queue_model = NULL;
|
||||
gui_model = NULL;
|
||||
cur_playlist = NULL;
|
||||
}
|
||||
|
||||
|
@ -259,7 +259,7 @@ static void __gui_model_set_runtime(void)
|
|||
|
||||
GuiModel *gui_model_get(void)
|
||||
{
|
||||
return queue_model;
|
||||
return gui_model;
|
||||
}
|
||||
|
||||
GType gui_model_get_type()
|
||||
|
@ -276,8 +276,8 @@ void gui_model_add(struct playlist *playlist, unsigned int row)
|
|||
return;
|
||||
|
||||
path = gtk_tree_path_new_from_indices(row, -1);
|
||||
__gui_model_get_iter(GTK_TREE_MODEL(queue_model), &iter, path);
|
||||
gtk_tree_model_row_inserted(GTK_TREE_MODEL(queue_model), path, &iter);
|
||||
__gui_model_get_iter(GTK_TREE_MODEL(gui_model), &iter, path);
|
||||
gtk_tree_model_row_inserted(GTK_TREE_MODEL(gui_model), path, &iter);
|
||||
__gui_model_set_runtime();
|
||||
gtk_tree_path_free(path);
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ void gui_model_remove(struct playlist *playlist, unsigned int row)
|
|||
return;
|
||||
|
||||
path = gtk_tree_path_new_from_indices(row, -1);
|
||||
gtk_tree_model_row_deleted(GTK_TREE_MODEL(queue_model), path);
|
||||
gtk_tree_model_row_deleted(GTK_TREE_MODEL(gui_model), path);
|
||||
__gui_model_set_runtime();
|
||||
gtk_tree_path_free(path);
|
||||
}
|
||||
|
@ -300,12 +300,12 @@ void gui_model_clear(struct playlist *playlist, unsigned int n)
|
|||
GtkTreePath *path;
|
||||
unsigned int i;
|
||||
|
||||
if (!queue_model || cur_playlist != playlist)
|
||||
if (!gui_model || cur_playlist != playlist)
|
||||
return;
|
||||
|
||||
path = gtk_tree_path_new_from_indices(n - 1, -1);
|
||||
for (i = 0; i < n; i++) {
|
||||
gtk_tree_model_row_deleted(GTK_TREE_MODEL(queue_model), path);
|
||||
gtk_tree_model_row_deleted(GTK_TREE_MODEL(gui_model), path);
|
||||
gtk_tree_path_prev(path);
|
||||
}
|
||||
|
||||
|
@ -322,8 +322,8 @@ void gui_model_update(struct playlist *playlist, unsigned int row)
|
|||
return;
|
||||
|
||||
path = gtk_tree_path_new_from_indices(row, -1);
|
||||
__gui_model_get_iter(GTK_TREE_MODEL(queue_model), &iter, path);
|
||||
gtk_tree_model_row_changed(GTK_TREE_MODEL(queue_model), path, &iter);
|
||||
__gui_model_get_iter(GTK_TREE_MODEL(gui_model), &iter, path);
|
||||
gtk_tree_model_row_changed(GTK_TREE_MODEL(gui_model), path, &iter);
|
||||
__gui_model_set_runtime();
|
||||
gtk_tree_path_free(path);
|
||||
}
|
||||
|
@ -349,6 +349,6 @@ struct track * gui_model_path_get_track(GtkTreePath *path)
|
|||
{
|
||||
GtkTreeIter iter;
|
||||
|
||||
__gui_model_get_iter(GTK_TREE_MODEL(queue_model), &iter, path);
|
||||
__gui_model_get_iter(GTK_TREE_MODEL(gui_model), &iter, path);
|
||||
return gui_model_iter_get_track(&iter);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue