shell/util: Add touch_file_async() helper

Add a small helper method to asynchronously "touch" a file and return
whether the file was created or not.

As g_file_make_directory_with_parents() doesn't have an async variant,
we need a C helper to make the entire operation non-blocking.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2432
This commit is contained in:
Florian Müllner
2020-03-23 17:57:38 +01:00
committed by Florian Müllner
parent e6a814fac8
commit f52574bd28
2 changed files with 69 additions and 0 deletions

View File

@ -30,6 +30,13 @@ gboolean shell_write_string_to_stream (GOutputStream *stream,
char *shell_get_file_contents_utf8_sync (const char *path,
GError **error);
void shell_util_touch_file_async (GFile *file,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean shell_util_touch_file_finish (GFile *file,
GAsyncResult *res,
GError **error);
gboolean shell_util_wifexited (int status,
int *exit);