repo: Make OSTreeCommitModifier introspectable
Callbacks need GDestroyNotifies to be usable from bindings. https://bugzilla.gnome.org/show_bug.cgi?id=707644
This commit is contained in:
parent
f5f7fe5e9a
commit
b36e61f813
|
|
@ -1846,6 +1846,7 @@ struct OstreeRepoCommitModifier {
|
|||
OstreeRepoCommitModifierFlags flags;
|
||||
OstreeRepoCommitFilter filter;
|
||||
gpointer user_data;
|
||||
GDestroyNotify destroy_notify;
|
||||
};
|
||||
|
||||
static OstreeRepoCommitFilterResult
|
||||
|
|
@ -2192,13 +2193,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);
|
||||
|
||||
|
|
@ -2206,6 +2209,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;
|
||||
}
|
||||
|
|
@ -2225,6 +2229,9 @@ ostree_repo_commit_modifier_unref (OstreeRepoCommitModifier *modifier)
|
|||
if (!g_atomic_int_dec_and_test (&modifier->refcount))
|
||||
return;
|
||||
|
||||
if (modifier->destroy_notify)
|
||||
modifier->destroy_notify (modifier->user_data);
|
||||
|
||||
g_free (modifier);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Reference in New Issue