Skip to content

Commit

Permalink
app: Tweak transaction DBus helper function
Browse files Browse the repository at this point in the history
Take an RPMOSTreeSysroot object instead of a GDBusConnection in
rpmostree_transaction_get_response_sync().  Makes the API slightly
more convenient.
  • Loading branch information
mbarnes committed Aug 5, 2015
1 parent 3678134 commit 4de915f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 14 deletions.
5 changes: 1 addition & 4 deletions src/app/rpmostree-builtin-rebase.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ rpmostree_builtin_rebase (int argc,
glnx_unref_object RPMOSTreeSysroot *sysroot_proxy = NULL;
g_autofree char *transaction_object_path = NULL;
g_autoptr (GVariant) variant_args = NULL;
GDBusConnection *connection;

if (!rpmostree_option_context_parse (context,
option_entries,
Expand Down Expand Up @@ -100,9 +99,7 @@ rpmostree_builtin_rebase (int argc,
error))
goto out;

connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (sysroot_proxy));

if (!rpmostree_transaction_get_response_sync (connection,
if (!rpmostree_transaction_get_response_sync (sysroot_proxy,
transaction_object_path,
cancellable,
error))
Expand Down
5 changes: 1 addition & 4 deletions src/app/rpmostree-builtin-rollback.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ rpmostree_builtin_rollback (int argc,
glnx_unref_object RPMOSTreeOS *os_proxy = NULL;
glnx_unref_object RPMOSTreeSysroot *sysroot_proxy = NULL;
g_autofree char *transaction_object_path = NULL;
GDBusConnection *connection;

if (!rpmostree_option_context_parse (context,
option_entries,
Expand All @@ -71,9 +70,7 @@ rpmostree_builtin_rollback (int argc,
error))
goto out;

connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (sysroot_proxy));

if (!rpmostree_transaction_get_response_sync (connection,
if (!rpmostree_transaction_get_response_sync (sysroot_proxy,
transaction_object_path,
cancellable,
error))
Expand Down
5 changes: 1 addition & 4 deletions src/app/rpmostree-builtin-upgrade.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ rpmostree_builtin_upgrade (int argc,
glnx_unref_object RPMOSTreeSysroot *sysroot_proxy = NULL;
g_autofree char *transaction_object_path = NULL;
g_autoptr (GVariant) default_deployment = NULL;
GDBusConnection *connection;

if (!rpmostree_option_context_parse (context,
option_entries,
Expand Down Expand Up @@ -117,9 +116,7 @@ rpmostree_builtin_upgrade (int argc,
goto out;
}

connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (sysroot_proxy));

if (!rpmostree_transaction_get_response_sync (connection,
if (!rpmostree_transaction_get_response_sync (sysroot_proxy,
transaction_object_path,
cancellable,
error))
Expand Down
5 changes: 4 additions & 1 deletion src/app/rpmostree-dbus-helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,11 +493,12 @@ cancelled_handler (GCancellable *cancellable,


gboolean
rpmostree_transaction_get_response_sync (GDBusConnection *connection,
rpmostree_transaction_get_response_sync (RPMOSTreeSysroot *sysroot_proxy,
const gchar *object_path,
GCancellable *cancellable,
GError **error)
{
GDBusConnection *connection;
glnx_unref_object GDBusObjectManager *object_manager = NULL;
glnx_unref_object RPMOSTreeTransaction *transaction = NULL;

Expand All @@ -509,6 +510,8 @@ rpmostree_transaction_get_response_sync (GDBusConnection *connection,
gulong signal_handler = 0;
gboolean success = FALSE;

connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (sysroot_proxy));

if (g_dbus_connection_get_unique_name (connection) != NULL)
bus_name = BUS_NAME;

Expand Down
2 changes: 1 addition & 1 deletion src/app/rpmostree-dbus-helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ rpmostree_load_os_proxy (RPMOSTreeSysroot *sysroot_proxy,
GError **error);

gboolean
rpmostree_transaction_get_response_sync (GDBusConnection *out_connection,
rpmostree_transaction_get_response_sync (RPMOSTreeSysroot *sysroot_proxy,
const gchar *object_path,
GCancellable *cancellable,
GError **error);
Expand Down

0 comments on commit 4de915f

Please sign in to comment.