ocarina: Remove path from the library through settings
Click the button and it's gone!
This commit is contained in:
parent
e6ba5c3139
commit
eb7a8e03a4
|
@ -6,8 +6,9 @@ import libsaria
|
||||||
page = gtk.VBox()
|
page = gtk.VBox()
|
||||||
text = "Library"
|
text = "Library"
|
||||||
|
|
||||||
def remove_path(button, path):
|
def remove_path(button, path, panel):
|
||||||
print "Removing:", path
|
libsaria.sources.library.rm_path(path)
|
||||||
|
page.remove(panel)
|
||||||
|
|
||||||
def add_panel(panel):
|
def add_panel(panel):
|
||||||
full_box = gtk.VBox()
|
full_box = gtk.VBox()
|
||||||
|
@ -15,6 +16,7 @@ def add_panel(panel):
|
||||||
full_box.pack_start(gtk.HSeparator())
|
full_box.pack_start(gtk.HSeparator())
|
||||||
full_box.show_all()
|
full_box.show_all()
|
||||||
page.pack_start(full_box, False, False)
|
page.pack_start(full_box, False, False)
|
||||||
|
return full_box
|
||||||
|
|
||||||
def show_source(path, lib):
|
def show_source(path, lib):
|
||||||
panel = gtk.HBox()
|
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)
|
path_lbl.set_markup("<span size='xx-large' weight='bold'>%s</span>" % path)
|
||||||
count_lbl = gtk.Label()
|
count_lbl = gtk.Label()
|
||||||
count_lbl.set_markup("<span size='large'>%s songs</span>" % len(lib))
|
count_lbl.set_markup("<span size='large'>%s songs</span>" % len(lib))
|
||||||
|
|
||||||
remove_button = gtk.Button("Remove", gtk.STOCK_REMOVE)
|
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(path_lbl)
|
||||||
info_box.pack_start(count_lbl)
|
info_box.pack_start(count_lbl)
|
||||||
panel.pack_start(info_box)
|
panel.pack_start(info_box)
|
||||||
panel.pack_start(remove_button, False, False)
|
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():
|
for path, lib in libsaria.sources.library.list_paths():
|
||||||
show_source(path, lib)
|
show_source(path, lib)
|
||||||
|
|
Loading…
Reference in New Issue