def add_drive_cb(button): """Callback for adding a drive""" title = _("Choose a folder") pathname = GuiBasic.browse_folder(self.parent, title, multiple=False, stock_button=gtk.STOCK_ADD) if pathname: liststore.append([pathname]) pathnames.append(pathname) options.set_list('shred_drives', pathnames)
def cb_wipe_free_space(self, action): """callback to wipe free space in arbitrary folder""" path = GuiBasic.browse_folder(self.window, _("Choose a folder"), multiple=False, stock_button=gtk.STOCK_OK) if not path: # user cancelled return backends["_gui"] = Cleaner.create_wipe_cleaner(path) # execute operations = {"_gui": ["free_disk_space"]} self.preview_or_run_operations(True, operations)
def add_custom_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_custom_paths(pathnames)
def cb_wipe_free_space(self, action): """callback to wipe free space in arbitrary folder""" path = GuiBasic.browse_folder(self.window, _("Choose a folder"), multiple=False, stock_button=gtk.STOCK_OK) if not path: # user cancelled return backends['_gui'] = Cleaner.create_wipe_cleaner(path) # execute operations = {'_gui': ['free_disk_space']} self.preview_or_run_operations(True, operations)
def cb_shred_file(self, action): """Callback for shredding a file or folder""" # get list of files if "ShredFiles" == action.get_name(): paths = GuiBasic.browse_files(self.window, _("Choose files to shred")) elif "ShredFolders" == action.get_name(): paths = GuiBasic.browse_folder( self.window, _("Choose folder to shred"), multiple=True, stock_button=gtk.STOCK_DELETE ) else: raise RuntimeError("Unexpected kind in cb_shred_file") if not paths: return self.shred_paths(paths)
def cb_shred_file(self, action): """Callback for shredding a file or folder""" # get list of files if 'ShredFiles' == action.get_name(): paths = GuiBasic.browse_files(self.window, _("Choose files to shred")) elif 'ShredFolders' == action.get_name(): paths = GuiBasic.browse_folder(self.window, _("Choose folder to shred"), multiple=True, stock_button=gtk.STOCK_DELETE) else: raise RuntimeError("Unexpected kind in cb_shred_file") if not paths: return self.shred_paths(paths)