Mercurial > audlegacy
changeset 2152:7af1ccd0a0ee trunk
[svn] - jump to file: use G_TYPE_UINT to store the song number in the model
author | giacomo |
---|---|
date | Sun, 17 Dec 2006 11:48:12 -0800 |
parents | c4e61038f367 |
children | ba578fefe36a |
files | ChangeLog audacious/mainwin.c |
diffstat | 2 files changed, 28 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Dec 17 10:35:49 2006 -0800 +++ b/ChangeLog Sun Dec 17 11:48:12 2006 -0800 @@ -1,3 +1,11 @@ +2006-12-17 18:35:49 +0000 William Pitcock <nenolod@nenolod.net> + revision [3307] + - ui/Makefile was missing. + + trunk/audacious/ui/Makefile | 9 +++++++++ + 1 file changed, 9 insertions(+) + + 2006-12-17 18:35:32 +0000 William Pitcock <nenolod@nenolod.net> revision [3305] - add XML interface declaration for the playlist editor
--- a/audacious/mainwin.c Sun Dec 17 10:35:49 2006 -0800 +++ b/audacious/mainwin.c Sun Dec 17 11:48:12 2006 -0800 @@ -1738,7 +1738,6 @@ GtkTreeModel *model; GtkTreeSelection *selection; GtkTreeIter iter; - gchar *pos_str; guint pos; model = gtk_tree_view_get_model(treeview); @@ -1747,11 +1746,9 @@ if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) return; - gtk_tree_model_get(model, &iter, 0, &pos_str, -1); - pos = g_ascii_strtoull(pos_str, NULL, 10) - 1; - g_free(pos_str); - - change_song(pos); + gtk_tree_model_get(model, &iter, 0, &pos, -1); + + change_song(pos - 1); /* FIXME: should only hide window */ gtk_widget_destroy(mainwin_jtf); @@ -1783,7 +1780,6 @@ GtkTreeModel *model; GtkTreeSelection *selection; GtkTreeIter iter; - gchar *pos_str; guint pos; treeview = GTK_TREE_VIEW(data); @@ -1793,12 +1789,11 @@ if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) return; - gtk_tree_model_get(model, &iter, 0, &pos_str, -1); - pos = g_ascii_strtoull(pos_str, NULL, 10) - 1; - - playlist_queue_position(playlist_get_active(), pos); - - mainwin_jump_to_file_set_queue_button_label(button, pos); + gtk_tree_model_get(model, &iter, 0, &pos, -1); + + playlist_queue_position(playlist_get_active(), (pos - 1)); + + mainwin_jump_to_file_set_queue_button_label(button, (pos - 1)); } static void @@ -1809,7 +1804,6 @@ GtkTreeModel *model; GtkTreeSelection *selection; GtkTreeIter iter; - gchar *pos_str; guint pos; treeview = gtk_tree_selection_get_tree_view(treesel); @@ -1819,11 +1813,9 @@ if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) return; - gtk_tree_model_get(model, &iter, 0, &pos_str, -1); - pos = g_ascii_strtoull(pos_str, NULL, 10) - 1; - g_free(pos_str); - - mainwin_jump_to_file_set_queue_button_label(GTK_BUTTON(data), pos); + gtk_tree_model_get(model, &iter, 0, &pos, -1); + + mainwin_jump_to_file_set_queue_button_label(GTK_BUTTON(data), (pos - 1)); } static gboolean @@ -1894,7 +1886,7 @@ { /* FIXME: Is not in sync with playlist due to delayed extinfo * reading */ - gint row; + guint row; GList *playlist_glist; gchar *desc_buf = NULL; gchar *row_str; @@ -1923,18 +1915,15 @@ else desc_buf = str_to_utf8(entry->filename); - row_str = g_strdup_printf("%d", row++); - gtk_list_store_append(GTK_LIST_STORE(store), &iter); gtk_list_store_set(GTK_LIST_STORE(store), &iter, - 0, row_str, 1, desc_buf, -1); + 0, row, 1, desc_buf, -1); + row++; if(desc_buf) { g_free(desc_buf); desc_buf = NULL; } - - g_free(row_str); } gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter); @@ -1951,7 +1940,7 @@ GtkListStore *store; - gint song_index = 0; + guint song_index = 0; gchar **words; GList *playlist_glist; Playlist *playlist; @@ -2020,10 +2009,8 @@ match = TRUE; if (match) { - gchar *song_index_str = g_strdup_printf("%d", song_index + 1); gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, 0, song_index_str, 1, title, -1); - g_free(song_index_str); + gtk_list_store_set(store, &iter, 0, song_index + 1 , 1, title, -1); } song_index++; @@ -2069,8 +2056,7 @@ GList *playlist_glist; Playlist *playlist; gchar *desc_buf = NULL; - gchar *row_str; - gint row; + guint row; GtkWidget *treeview; GtkListStore *jtf_store; @@ -2100,7 +2086,7 @@ vbox = gtk_vbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(mainwin_jtf), vbox); - jtf_store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); + jtf_store = gtk_list_store_new(2, G_TYPE_UINT, G_TYPE_STRING); treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(jtf_store)); g_object_unref(jtf_store); @@ -2217,17 +2203,15 @@ else desc_buf = str_to_utf8(entry->filename); - row_str = g_strdup_printf("%d", row++); - gtk_list_store_append(GTK_LIST_STORE(jtf_store), &iter); gtk_list_store_set(GTK_LIST_STORE(jtf_store), &iter, - 0, row_str, 1, desc_buf, -1); + 0, row, 1, desc_buf, -1); + row++; if (desc_buf) { g_free(desc_buf); desc_buf = NULL; } - g_free(row_str); } PLAYLIST_UNLOCK(playlist->mutex);