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:
Anna Schumaker 2016-11-01 09:18:28 -04:00
parent 2431ad104e
commit fa96def899
1 changed files with 15 additions and 15 deletions

View File

@ -12,7 +12,7 @@ static gboolean __gui_model_iter_nth_child(GtkTreeModel *, GtkTreeIter *,
static struct playlist *cur_playlist = NULL; static struct playlist *cur_playlist = NULL;
static GObjectClass *parent_class = 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_type = 0;
static GType gui_model_columns[GUI_MODEL_N_COLUMNS] = { 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)) if (parent || !cur_playlist || n >= queue_size(queue))
return FALSE; return FALSE;
iter->stamp = queue_model->gm_stamp; iter->stamp = gui_model->gm_stamp;
iter->user_data = GUINT_TO_POINTER(n); iter->user_data = GUINT_TO_POINTER(n);
iter->user_data2 = queue_at(queue, n); iter->user_data2 = queue_at(queue, n);
return TRUE; return TRUE;
@ -234,15 +234,15 @@ void gui_model_init(void)
g_type_add_interface_static(gui_model_type, GTK_TYPE_TREE_MODEL, g_type_add_interface_static(gui_model_type, GTK_TYPE_TREE_MODEL,
&gui_tree_model); &gui_tree_model);
queue_model = g_object_new(gui_model_type, NULL); gui_model = g_object_new(gui_model_type, NULL);
g_assert(queue_model != NULL); g_assert(gui_model != NULL);
} }
void gui_model_deinit(void) void gui_model_deinit(void)
{ {
g_object_unref(queue_model); g_object_unref(gui_model);
gui_model_type = 0; gui_model_type = 0;
queue_model = NULL; gui_model = NULL;
cur_playlist = NULL; cur_playlist = NULL;
} }
@ -259,7 +259,7 @@ static void __gui_model_set_runtime(void)
GuiModel *gui_model_get(void) GuiModel *gui_model_get(void)
{ {
return queue_model; return gui_model;
} }
GType gui_model_get_type() GType gui_model_get_type()
@ -276,8 +276,8 @@ void gui_model_add(struct playlist *playlist, unsigned int row)
return; return;
path = gtk_tree_path_new_from_indices(row, -1); path = gtk_tree_path_new_from_indices(row, -1);
__gui_model_get_iter(GTK_TREE_MODEL(queue_model), &iter, path); __gui_model_get_iter(GTK_TREE_MODEL(gui_model), &iter, path);
gtk_tree_model_row_inserted(GTK_TREE_MODEL(queue_model), path, &iter); gtk_tree_model_row_inserted(GTK_TREE_MODEL(gui_model), path, &iter);
__gui_model_set_runtime(); __gui_model_set_runtime();
gtk_tree_path_free(path); gtk_tree_path_free(path);
} }
@ -290,7 +290,7 @@ void gui_model_remove(struct playlist *playlist, unsigned int row)
return; return;
path = gtk_tree_path_new_from_indices(row, -1); 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(); __gui_model_set_runtime();
gtk_tree_path_free(path); gtk_tree_path_free(path);
} }
@ -300,12 +300,12 @@ void gui_model_clear(struct playlist *playlist, unsigned int n)
GtkTreePath *path; GtkTreePath *path;
unsigned int i; unsigned int i;
if (!queue_model || cur_playlist != playlist) if (!gui_model || cur_playlist != playlist)
return; return;
path = gtk_tree_path_new_from_indices(n - 1, -1); path = gtk_tree_path_new_from_indices(n - 1, -1);
for (i = 0; i < n; i++) { 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); gtk_tree_path_prev(path);
} }
@ -322,8 +322,8 @@ void gui_model_update(struct playlist *playlist, unsigned int row)
return; return;
path = gtk_tree_path_new_from_indices(row, -1); path = gtk_tree_path_new_from_indices(row, -1);
__gui_model_get_iter(GTK_TREE_MODEL(queue_model), &iter, path); __gui_model_get_iter(GTK_TREE_MODEL(gui_model), &iter, path);
gtk_tree_model_row_changed(GTK_TREE_MODEL(queue_model), path, &iter); gtk_tree_model_row_changed(GTK_TREE_MODEL(gui_model), path, &iter);
__gui_model_set_runtime(); __gui_model_set_runtime();
gtk_tree_path_free(path); gtk_tree_path_free(path);
} }
@ -349,6 +349,6 @@ struct track * gui_model_path_get_track(GtkTreePath *path)
{ {
GtkTreeIter iter; 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); return gui_model_iter_get_track(&iter);
} }