def add_whitelist_file_cb(button): """Callback for adding a file""" title = _("Choose a file") pathname = GuiBasic.browse_file(self.parent, title) if pathname: for this_pathname in pathnames: if pathname == this_pathname[1]: print "warning: '%s' already exists in whitelist" % pathname return liststore.append([_('File'), pathname]) pathnames.append(['file', pathname]) options.set_whitelist_paths(pathnames)
def remove_whitelist_path_cb(button): """Callback for removing a path""" treeselection = treeview.get_selection() (model, _iter) = treeselection.get_selected() if None == _iter: # nothing selected return pathname = model[_iter][1] liststore.remove(_iter) for this_pathname in pathnames: if this_pathname[1] == pathname: pathnames.remove(this_pathname) options.set_whitelist_paths(pathnames)
def add_whitelist_folder_cb(button): """Callback for adding a folder""" title = _("Choose a folder") pathname = GuiBasic.browse_folder(self.parent, title, multiple=False, stock_button=gtk.STOCK_ADD) if pathname: for this_pathname in pathnames: if pathname == this_pathname[1]: print "warning: '%s' already exists in whitelist" % pathname return liststore.append([_('Folder'), pathname]) pathnames.append(['folder', pathname]) options.set_whitelist_paths(pathnames)