gui/playlists/user: Respond to the "edited" signal

We use this to perform user playlist renames with the user-entered text.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2016-10-01 11:39:27 -04:00
parent fac383e9fc
commit 4990d68711
2 changed files with 15 additions and 0 deletions

View File

@ -53,6 +53,20 @@ void __gui_pl_user_editing_started(GtkCellRenderer *renderer,
gtk_entry_set_text(GTK_ENTRY(editable), playlist->pl_name);
}
void __gui_pl_user_edited(GtkCellRendererText *renderer, gchar *path,
gchar *new_name, gpointer data)
{
struct playlist *playlist;
GtkTreeIter iter;
if (!gui_sidebar_iter_from_string(path, &iter))
return;
playlist = gui_sidebar_iter_playlist(&iter);
pl_user_rename(playlist, new_name);
gui_sidebar_iter_update_playlist(&iter, playlist);
}
void gui_pl_user_init()
{
idle_schedule(IDLE_SYNC, __gui_pl_user_init_idle, NULL);

View File

@ -792,6 +792,7 @@ audio-volume-medium</property>
<property name="title" translatable="yes">column</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1">
<signal name="edited" handler="__gui_pl_user_edited" swapped="no"/>
<signal name="editing-started" handler="__gui_pl_user_editing_started" swapped="no"/>
</object>
<attributes>