summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2016-02-25 21:34:44 +0100
committerAlexander Larsson <alexl@redhat.com>2016-02-25 21:34:44 +0100
commit26c2bb1b818911d09c10a2453b8d6d3bba1f4c34 (patch)
treef63bfe0a51e2391395f38201246318cbc657cf27 /lib
parent69890db5f1d5d9b9344076d0909e6c9674e516d8 (diff)
downloadxdg-app-26c2bb1b818911d09c10a2453b8d6d3bba1f4c34.tar.gz
lib: Add xdg_app_bundle_ref_get_installed_size()
Diffstat (limited to 'lib')
-rw-r--r--lib/test-lib.c3
-rw-r--r--lib/xdg-app-bundle-ref.c16
-rw-r--r--lib/xdg-app-bundle-ref.h1
-rw-r--r--lib/xdg-app-installation.c1
4 files changed, 19 insertions, 2 deletions
diff --git a/lib/test-lib.c b/lib/test-lib.c
index 2022529..de90392 100644
--- a/lib/test-lib.c
+++ b/lib/test-lib.c
@@ -103,13 +103,14 @@ main (int argc, char *argv[])
g_autofree char *path = g_file_get_path (xdg_app_bundle_ref_get_file (bundle));
g_autoptr(GBytes) metadata = xdg_app_bundle_ref_get_metadata (bundle);
g_autoptr(GBytes) appdata = xdg_app_bundle_ref_get_appdata (bundle);
- g_print ("%d %s %s %s %s %s\n%s\n",
+ g_print ("%d %s %s %s %s %s %"G_GUINT64_FORMAT"\n%s\n",
xdg_app_ref_get_kind (XDG_APP_REF(bundle)),
xdg_app_ref_get_name (XDG_APP_REF(bundle)),
xdg_app_ref_get_arch (XDG_APP_REF(bundle)),
xdg_app_ref_get_branch (XDG_APP_REF(bundle)),
xdg_app_ref_get_commit (XDG_APP_REF(bundle)),
path,
+ xdg_app_bundle_ref_get_installed_size (bundle),
(char *)g_bytes_get_data (metadata, NULL));
if (appdata != NULL)
diff --git a/lib/xdg-app-bundle-ref.c b/lib/xdg-app-bundle-ref.c
index 85b82ef..69e1743 100644
--- a/lib/xdg-app-bundle-ref.c
+++ b/lib/xdg-app-bundle-ref.c
@@ -35,6 +35,7 @@ struct _XdgAppBundleRefPrivate
GBytes *appdata;
GBytes *icon_64;
GBytes *icon_128;
+ guint64 installed_size;
};
G_DEFINE_TYPE_WITH_PRIVATE (XdgAppBundleRef, xdg_app_bundle_ref, XDG_APP_TYPE_REF)
@@ -197,6 +198,15 @@ xdg_app_bundle_ref_get_icon (XdgAppBundleRef *self,
return NULL;
}
+guint64
+xdg_app_bundle_ref_get_installed_size (XdgAppBundleRef *self)
+{
+ XdgAppBundleRefPrivate *priv = xdg_app_bundle_ref_get_instance_private (self);
+
+ return priv->installed_size;
+}
+
+
XdgAppBundleRef *
xdg_app_bundle_ref_new (GFile *file,
GError **error)
@@ -212,8 +222,10 @@ xdg_app_bundle_ref_new (GFile *file,
g_autoptr(GVariant) appdata = NULL;
g_autoptr(GVariant) icon_64 = NULL;
g_autoptr(GVariant) icon_128 = NULL;
+ guint64 installed_size;
- metadata = xdg_app_bundle_load (file, &commit, &full_ref, NULL, NULL, error);
+ metadata = xdg_app_bundle_load (file, &commit, &full_ref, NULL, &installed_size,
+ NULL, error);
if (metadata == NULL)
return NULL;
@@ -254,5 +266,7 @@ xdg_app_bundle_ref_new (GFile *file,
if (icon_128)
priv->icon_128 = g_variant_get_data_as_bytes (icon_128);
+ priv->installed_size = installed_size;
+
return ref;
}
diff --git a/lib/xdg-app-bundle-ref.h b/lib/xdg-app-bundle-ref.h
index 5959312..0c51200 100644
--- a/lib/xdg-app-bundle-ref.h
+++ b/lib/xdg-app-bundle-ref.h
@@ -51,6 +51,7 @@ XDG_APP_EXTERN GBytes *xdg_app_bundle_ref_get_metadata (XdgAppBundleR
XDG_APP_EXTERN GBytes *xdg_app_bundle_ref_get_appdata (XdgAppBundleRef *self);
XDG_APP_EXTERN GBytes *xdg_app_bundle_ref_get_icon (XdgAppBundleRef *self,
int size);
+XDG_APP_EXTERN guint64 xdg_app_bundle_ref_get_installed_size (XdgAppBundleRef *self);
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
diff --git a/lib/xdg-app-installation.c b/lib/xdg-app-installation.c
index 722c7f2..807f631 100644
--- a/lib/xdg-app-installation.c
+++ b/lib/xdg-app-installation.c
@@ -756,6 +756,7 @@ xdg_app_installation_install_bundle (XdgAppInstallation *self,
metadata = xdg_app_bundle_load (file, &to_checksum,
&ref,
&origin,
+ NULL,
&gpg_data,
error);
if (metadata == NULL)