def shred_paths(self, paths, shred_settings=False, quit_when_done=False): """Shred file or folders When shredding_settings=True: If user confirms to delete, then returns True. If user aborts, returns False. When quit_when_done=True: Always returns False to remove function from the idle queue. """ # create a temporary cleaner object backends['_gui'] = Cleaner.create_simple_cleaner(paths) # preview and confirm operations = {'_gui': ['files']} self.preview_or_run_operations(False, operations) if GuiBasic.delete_confirmation_dialog(self, mention_preview=False, shred_settings=shred_settings): # delete self.preview_or_run_operations(True, operations) if shred_settings: return True if quit_when_done: GLib.idle_add(self.close, priority=GObject.PRIORITY_LOW) # user aborted return False
def run_operations(self, __widget): """Event when the 'delete' toolbar button is clicked.""" # fixme: should present this dialog after finding operations # Disable delete confirmation message. # if the option is selected under preference. if options.get("delete_confirmation"): if not GuiBasic.delete_confirmation_dialog(self, True): return self.preview_or_run_operations(True)
def run_operations(self, __widget): """Event when the 'delete' toolbar button is clicked.""" # fixme: should present this dialog after finding operations # Disable delete confirmation message. # if the option is selected under preference. if options.get("delete_confirmation"): if not GuiBasic.delete_confirmation_dialog(self.window, True): return self.preview_or_run_operations(True)
def cb_run_option(self, widget, really_delete, cleaner_id, option_id): """Callback from context menu to delete/preview a single option""" operations = {cleaner_id: [option_id]} # preview if not really_delete: self.preview_or_run_operations(False, operations) return # delete if GuiBasic.delete_confirmation_dialog(self, mention_preview=False): self.preview_or_run_operations(True, operations) return
def cb_run_option(self, widget, really_delete, cleaner_id, option_id): """Callback from context menu to delete/preview a single option""" operations = {cleaner_id: [option_id]} # preview if not really_delete: self.preview_or_run_operations(False, operations) return # delete if GuiBasic.delete_confirmation_dialog(self.window, mention_preview=False): self.preview_or_run_operations(True, operations) return
def shred_paths(self, paths): """Shred file or folders If user confirms and files are deleted, returns True. If user aborts, returns False. """ # create a temporary cleaner object backends['_gui'] = Cleaner.create_simple_cleaner(paths) # preview and confirm operations = {'_gui': ['files']} self.preview_or_run_operations(False, operations) if GuiBasic.delete_confirmation_dialog(self.window, mention_preview=False): # delete self.preview_or_run_operations(True, operations) return True # user aborted return False
def shred_paths(self, paths): """Shred file or folders If user confirms and files are deleted, returns True. If user aborts, returns False. """ # create a temporary cleaner object backends['_gui'] = Cleaner.create_simple_cleaner(paths) # preview and confirm operations = {'_gui': ['files']} self.preview_or_run_operations(False, operations) if GuiBasic.delete_confirmation_dialog(self, mention_preview=False): # delete self.preview_or_run_operations(True, operations) return True # user aborted return False
def _confirm_delete(self, mention_preview, shred_settings=False): if options.get("delete_confirmation"): return GuiBasic.delete_confirmation_dialog(self, mention_preview, shred_settings=shred_settings) return True