Fixing move async, small cleanup

This commit is contained in:
itdominator 2022-11-27 16:38:39 -06:00
parent 95f790a7a4
commit da9a8c024b
2 changed files with 10 additions and 11 deletions

View File

@ -86,8 +86,11 @@ class GridMixin:
info = gio_file.query_info('standard::icon' , 0, None) info = gio_file.query_info('standard::icon' , 0, None)
icon = info.get_icon().get_names()[0] icon = info.get_icon().get_names()[0]
icon_path = self.icon_theme.lookup_icon(icon , size , 0).get_filename() icon_path = self.icon_theme.lookup_icon(icon , size , 0).get_filename()
return GdkPixbuf.Pixbuf.new_from_file(icon_path) return GdkPixbuf.Pixbuf.new_from_file(icon_path)
except Exception as e: except Exception:
...
return None return None

View File

@ -320,11 +320,6 @@ class WidgetFileActionMixin:
if action == "move" or action == "rename": if action == "move" or action == "rename":
tab.move_file(fPath, tPath) tab.move_file(fPath, tPath)
else: else:
# if action == "copy":
# file.copy(target, flags=Gio.FileCopyFlags.BACKUP, cancellable=None)
# if action == "move" or action == "rename":
# file.move(target, flags=Gio.FileCopyFlags.BACKUP, cancellable=None)
if action == "copy": if action == "copy":
container, cancle_eve, update_progress, finish_callback = self.create_io_widget(action, file) container, cancle_eve, update_progress, finish_callback = self.create_io_widget(action, file)
file.copy_async(destination=target, flags=Gio.FileCopyFlags.BACKUP, file.copy_async(destination=target, flags=Gio.FileCopyFlags.BACKUP,
@ -333,8 +328,9 @@ class WidgetFileActionMixin:
self.builder.get_object("io_list").add(container) self.builder.get_object("io_list").add(container)
if action == "move" or action == "rename": if action == "move" or action == "rename":
container, cancle_eve, update_progress, finish_callback = self.create_io_widget(action, file) container, cancle_eve, update_progress, finish_callback = self.create_io_widget(action, file)
file.move(destination=target, flags=Gio.FileCopyFlags.BACKUP, file.move_async(destination=target, flags=Gio.FileCopyFlags.BACKUP,
cancellable=cancle_eve, progress_callback=update_progress) io_priority=100, cancellable=cancle_eve,
progress_callback=None) # NOTE: progress_callback causes seg fault when set
self.builder.get_object("io_list").add(container) self.builder.get_object("io_list").add(container)
@ -353,7 +349,7 @@ class WidgetFileActionMixin:
label = Gtk.Label() label = Gtk.Label()
progress = Gtk.ProgressBar() progress = Gtk.ProgressBar()
cncl_button = Gtk.Button(label="Cancel") cncl_button = Gtk.Button(label="Cancel")
del_button = Gtk.Button(label="Delete") del_button = Gtk.Button(label="Clear")
io_list = self.builder.get_object("io_list") io_list = self.builder.get_object("io_list")
label.set_label(file.get_basename()) label.set_label(file.get_basename())
@ -379,7 +375,7 @@ class WidgetFileActionMixin:
io_list.remove(container) io_list.remove(container)
if not action == "move": if not action in ("create", "rename"):
stats.pack_end(cncl_button, False, False, 5) stats.pack_end(cncl_button, False, False, 5)
cncl_button.connect("clicked", do_cancel, *(container, cancle_eve)) cncl_button.connect("clicked", do_cancel, *(container, cancle_eve))
else: else: