ocarina: Remove path from the library through settings

Click the button and it's gone!
This commit is contained in:
Bryan Schumaker 2011-06-18 11:22:57 -04:00
parent e6ba5c3139
commit eb7a8e03a4
1 changed files with 6 additions and 5 deletions

View File

@ -6,8 +6,9 @@ import libsaria
page = gtk.VBox()
text = "Library"
def remove_path(button, path):
print "Removing:", path
def remove_path(button, path, panel):
libsaria.sources.library.rm_path(path)
page.remove(panel)
def add_panel(panel):
full_box = gtk.VBox()
@ -15,6 +16,7 @@ def add_panel(panel):
full_box.pack_start(gtk.HSeparator())
full_box.show_all()
page.pack_start(full_box, False, False)
return full_box
def show_source(path, lib):
panel = gtk.HBox()
@ -24,15 +26,14 @@ def show_source(path, lib):
path_lbl.set_markup("<span size='xx-large' weight='bold'>%s</span>" % path)
count_lbl = gtk.Label()
count_lbl.set_markup("<span size='large'>%s songs</span>" % len(lib))
remove_button = gtk.Button("Remove", gtk.STOCK_REMOVE)
remove_button.connect("clicked", remove_path, path)
info_box.pack_start(path_lbl)
info_box.pack_start(count_lbl)
panel.pack_start(info_box)
panel.pack_start(remove_button, False, False)
add_panel(panel)
full = add_panel(panel)
remove_button.connect("clicked", remove_path, path, full)
for path, lib in libsaria.sources.library.list_paths():
show_source(path, lib)