Index: st2.py ================================================================== --- st2.py +++ st2.py @@ -344,11 +344,11 @@ default_fn = row["title"] + ".m3u" fn = uikit.save_file("Save Stream", None, default_fn, [(".m3u","*m3u"),(".pls","*pls"),(".xspf","*xspf"),(".jspf","*jspf"),(".smil","*smil"),(".asx","*asx"),("all files","*")]) if fn: source = row.get("listformat", self.channel().listformat) dest = (re.findall("\.(m3u|pls|xspf|jspf|json|smil|asx|wpl)8?$", fn) or ["pls"])[0] - action.save_playlist(source=source, multiply=True).save(rows=[row], fn=fn, dest=dest) + action.save_playlist(source=source, multiply=True).file(rows=[row], fn=fn, dest=dest) pass # Save current stream URL into clipboard def menu_copy(self, w): gtk.clipboard_get().set_text(self.selected("url")) Index: uikit.py ================================================================== --- uikit.py +++ uikit.py @@ -377,18 +377,32 @@ for fname,ftype in formats: f = gtk.FileFilter() f.set_name(fname) f.add_pattern(ftype) c.add_filter(f) + # Yes, that's how to retrieve signals for changed filter selections + try: + filterbox = c.get_children()[0].get_children()[0] + filterbox.connect("notify::filter", lambda *w: uikit.save_file_filterchange(c)) + except: pass # Filter handlers don't work either. # Display and wait if c.run(): fn = c.get_filename() # return filaname c.destroy() return fn + + # Callback for changed FileFilter, updates current filename extension + @staticmethod + def save_file_filterchange(c): + fn, ext = c.get_filename(), c.get_filter().get_name() + if fn and ext: + fn = os.path.basename(fn) + c.set_current_name(re.sub(r"\.(m3u|pls|xspf|jspf|asx|json|smil|wpl)$", ext, fn)) + # pass updates from another thread, ensures that it is called just once @staticmethod