[ostree/wip/transaction: 3/9] repo: Make OSTreeCommitModifier introspectable



commit a7acc4e62cfa8d322d611755e49d337725cc6d73
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Sep 5 15:10:54 2013 -0400

    repo: Make OSTreeCommitModifier introspectable

 src/libostree/ostree-repo.c    |    8 +++++++-
 src/libostree/ostree-repo.h    |    3 ++-
 src/ostree/ot-builtin-commit.c |    2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 9ff3019..f5f1671 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -1839,6 +1839,7 @@ struct OstreeRepoCommitModifier {
   OstreeRepoCommitModifierFlags flags;
   OstreeRepoCommitFilter filter;
   gpointer user_data;
+  GDestroyNotify destroy_notify;
 };
 
 static OstreeRepoCommitFilterResult
@@ -2185,13 +2186,15 @@ ostree_repo_stage_mtree (OstreeRepo           *self,
  * @flags: Control options for filter
  * @commit_filter: (allow-none): Function that can inspect individual files
  * @user_data: (allow-none): User data
+ * @destroy_notify: A #GDestroyNotify
  *
  * Returns: (transfer full): A new commit modifier.
  */
 OstreeRepoCommitModifier *
 ostree_repo_commit_modifier_new (OstreeRepoCommitModifierFlags  flags,
                                  OstreeRepoCommitFilter         commit_filter,
-                                 gpointer                       user_data)
+                                 gpointer                       user_data,
+                                 GDestroyNotify                 destroy_notify)
 {
   OstreeRepoCommitModifier *modifier = g_new0 (OstreeRepoCommitModifier, 1);
 
@@ -2199,6 +2202,7 @@ ostree_repo_commit_modifier_new (OstreeRepoCommitModifierFlags  flags,
   modifier->flags = flags;
   modifier->filter = commit_filter;
   modifier->user_data = user_data;
+  modifier->destroy_notify = destroy_notify;
 
   return modifier;
 }
@@ -2218,6 +2222,8 @@ ostree_repo_commit_modifier_unref (OstreeRepoCommitModifier *modifier)
   if (!g_atomic_int_dec_and_test (&modifier->refcount))
     return;
 
+  modifier->destroy_notify (modifier->user_data);
+
   g_free (modifier);
   return;
 }
diff --git a/src/libostree/ostree-repo.h b/src/libostree/ostree-repo.h
index 94e11e9..05678d2 100644
--- a/src/libostree/ostree-repo.h
+++ b/src/libostree/ostree-repo.h
@@ -272,7 +272,8 @@ typedef struct OstreeRepoCommitModifier OstreeRepoCommitModifier;
 
 OstreeRepoCommitModifier *ostree_repo_commit_modifier_new (OstreeRepoCommitModifierFlags  flags,
                                                            OstreeRepoCommitFilter         commit_filter,
-                                                           gpointer                       user_data);
+                                                           gpointer                       user_data,
+                                                           GDestroyNotify                 destroy_notify);
 
 GType ostree_repo_commit_modifier_get_type (void);
 
diff --git a/src/ostree/ot-builtin-commit.c b/src/ostree/ot-builtin-commit.c
index c26d265..43f1e83 100644
--- a/src/ostree/ot-builtin-commit.c
+++ b/src/ostree/ot-builtin-commit.c
@@ -269,7 +269,7 @@ ostree_builtin_commit (int argc, char **argv, OstreeRepo *repo, GCancellable *ca
       OstreeRepoCommitModifierFlags flags = 0;
       if (opt_no_xattrs)
         flags |= OSTREE_REPO_COMMIT_MODIFIER_FLAGS_SKIP_XATTRS;
-      modifier = ostree_repo_commit_modifier_new (flags, commit_filter, mode_adds);
+      modifier = ostree_repo_commit_modifier_new (flags, commit_filter, mode_adds, NULL);
     }
 
   if (!ostree_repo_resolve_rev (repo, opt_branch, TRUE, &parent, error))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]