chiark / gitweb /
Correct playlist delete button sensitivity
authorRichard Kettlewell <rjk@greenend.org.uk>
Thu, 26 Nov 2009 20:27:37 +0000 (20:27 +0000)
committerRichard Kettlewell <rjk@greenend.org.uk>
Thu, 26 Nov 2009 20:27:37 +0000 (20:27 +0000)
disobedience/playlists.c

index fca50ad..0ca0aec 100644 (file)
@@ -643,10 +643,15 @@ static void playlist_picker_selection_changed(GtkTreeSelection attribute((unused
   } else
     selected = 0;
   /* Set button sensitivity according to the new state */
-  if(selected)
-    gtk_widget_set_sensitive(playlist_picker_delete_button, 1);
-  else
-    gtk_widget_set_sensitive(playlist_picker_delete_button, 0);
+  int deletable = FALSE;
+  if(selected) {
+    if(strchr(selected, '.')) {
+      if(!strncmp(selected, config->username, strlen(config->username)))
+        deletable = TRUE;
+    } else
+      deletable = TRUE;
+  }
+  gtk_widget_set_sensitive(playlist_picker_delete_button, deletable);
   /* TODO delete should not be sensitive for public playlists owned by other
    * users */
   /* Eliminate no-change cases */