diff options
author | Colin Walters <walters@verbum.org> | 2013-10-24 09:10:34 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2013-10-24 14:27:13 -0400 |
commit | c65923e64241ddeffbbfe48555150fd4d0ec1a8c (patch) | |
tree | a0cd27dc6a577be18030dc222b9d17f9ab25e97b /src/ostree/ot-admin-builtin-upgrade.c | |
parent | 9aaa29598eb7d54575d5012418fd3f604866d460 (diff) | |
download | ostree-c65923e64241ddeffbbfe48555150fd4d0ec1a8c.tar.gz |
Add OstreeAsyncProgress, use it for ostree_repo_pull
Several APIs in libostree were moved there from the commandline code,
and have hardcoded g_print() for progress and notifications. This
isn't useful for people who want to write PackageKit backends, custom
GUIs and the like.
From what I can tell, there isn't really a winning precedent in GLib
for progress notifications.
PackageKit has the model where the source has GObject properties that
change as async ops execute, which isn't bad...but I'd like something
a bit more general where say you can have multiple outstanding async
ops and sensibly track their state.
So, OstreeAsyncProgress is basically a threadsafe property bag with a
change notification signal.
Use this new API to move the GSConsole usage (i.e. g_print()) out from
libostree/ and into ostree/.
Diffstat (limited to 'src/ostree/ot-admin-builtin-upgrade.c')
-rw-r--r-- | src/ostree/ot-admin-builtin-upgrade.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ostree/ot-admin-builtin-upgrade.c b/src/ostree/ot-admin-builtin-upgrade.c index 3beb7c92..3eeb18a9 100644 --- a/src/ostree/ot-admin-builtin-upgrade.c +++ b/src/ostree/ot-admin-builtin-upgrade.c @@ -24,6 +24,7 @@ #include "ot-admin-builtins.h" #include "ot-admin-functions.h" +#include "ot-builtins-common.h" #include "ostree.h" #include "otutil.h" #include "libgsystem.h" @@ -106,10 +107,16 @@ ot_admin_builtin_upgrade (int argc, char **argv, OstreeSysroot *sysroot, GCancel { OstreeRepoPullFlags pullflags = 0; char *refs_to_fetch[] = { origin_ref, NULL }; + GSConsole *console; + gs_unref_object OstreeAsyncProgress *progress = NULL; + + console = gs_console_get (); + if (console) + progress = ostree_async_progress_new_and_connect (ot_common_pull_progress, console); g_print ("Fetching remote %s ref %s\n", origin_remote, origin_ref); - if (!ostree_repo_pull (repo, origin_remote, refs_to_fetch, pullflags, + if (!ostree_repo_pull (repo, origin_remote, refs_to_fetch, pullflags, progress, cancellable, error)) goto out; } |