Skip to content

Commit

Permalink
Use new GIO API for async operations
Browse files Browse the repository at this point in the history
  • Loading branch information
kra-mo committed Mar 25, 2024
1 parent 2e47cc8 commit 3b5bbc9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 2 additions & 4 deletions hyperplane/new_file_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

from hyperplane import shared
from hyperplane.file_properties import DOT_IS_NOT_EXTENSION
from hyperplane.utils.files import validate_name
from hyperplane.utils.files import copy, validate_name
from hyperplane.utils.symbolics import get_color_for_symbolic, get_symbolic


Expand Down Expand Up @@ -184,9 +184,7 @@ def __copy_active_gfile(self, *_args: Any) -> None:
logging.error("Cannot create template file: %s", error)
return

self.active_gfile.copy_async(
child, Gio.FileCopyFlags.NONE, GLib.PRIORITY_DEFAULT
)
copy(self.active_gfile, child)

def __file_selected(
self,
Expand Down
8 changes: 6 additions & 2 deletions hyperplane/utils/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def g_copy_cb(gfile: Gio.File, result: Gio.AsyncResult) -> None:
dst,
Gio.FileCopyFlags.NOFOLLOW_SYMLINKS,
GLib.PRIORITY_DEFAULT,
callback=g_copy_cb,
None,
None,
g_copy_cb,
)
return

Expand Down Expand Up @@ -176,7 +178,9 @@ def move_cb(_gfile: Gio.File, result: Gio.Task = None):
dst,
Gio.FileCopyFlags.NOFOLLOW_SYMLINKS,
GLib.PRIORITY_DEFAULT,
callback=move_cb,
None,
None,
move_cb,
)


Expand Down

0 comments on commit 3b5bbc9

Please sign in to comment.