Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wireplumber
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pkg
wireplumber
Commits
7ba93fa3
Commit
7ba93fa3
authored
4 years ago
by
Julian Bouzas
Browse files
Options
Downloads
Patches
Plain Diff
dbus-device-reservation: use the Get method when requesting a property
parent
882b6276
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/module-device-activation/dbus-device-reservation.c
+48
-17
48 additions, 17 deletions
modules/module-device-activation/dbus-device-reservation.c
with
48 additions
and
17 deletions
modules/module-device-activation/dbus-device-reservation.c
+
48
−
17
View file @
7ba93fa3
...
...
@@ -437,37 +437,37 @@ wp_dbus_device_reservation_request_release (WpDbusDeviceReservation *self,
}
static
void
on_
proxy_done_
request_property
(
GObject
*
obj
,
GAsyncResult
*
res
,
gpointer
data
)
on_request_property
_done
(
GObject
*
proxy
,
GAsyncResult
*
res
,
gpointer
data
)
{
WpDbusDeviceReservation
*
self
=
data
;
g_autoptr
(
WpOrgFreedesktopReserveDevice1
)
proxy
=
NULL
;
g_autoptr
(
GError
)
error
=
NULL
;
g_autoptr
(
GTask
)
task
=
g_steal_pointer
(
&
self
->
pending_task
);
g_autoptr
(
GVariant
)
ret
=
NULL
;
g_autoptr
(
GVariant
)
var
=
NULL
;
g_return_if_fail
(
task
);
/* Finish */
proxy
=
wp_org_freedesktop_reserve_device1_proxy_new_for_bus_finish
(
res
,
&
error
);
if
(
error
)
{
g_task_return_error
(
task
,
g_steal_pointer
(
&
error
));
return
;
ret
=
g_dbus_proxy_call_finish
(
G_DBUS_PROXY
(
proxy
),
res
,
&
error
);
if
(
!
ret
)
{
GError
*
error
=
g_error_new
(
WP_DOMAIN_LIBRARY
,
WP_LIBRARY_ERROR_OPERATION_FAILED
,
"failed to get property '%s' on proxy"
,
self
->
pending_property_name
);
g_task_return_error
(
task
,
error
);
}
/* Request the property */
g_return_if_fail
(
proxy
);
g_return_if_fail
(
self
->
pending_property_name
);
/* Get the property value */
g_variant_get
(
ret
,
"(v)"
,
&
var
);
g_return_if_fail
(
var
);
if
(
g_strcmp0
(
self
->
pending_property_name
,
"ApplicationName"
)
==
0
)
{
char
*
v
=
wp_org_freedesktop_reserve_device1_dup_application_name
(
proxy
);
g_task_return_pointer
(
task
,
v
,
g_free
);
g_task_return_pointer
(
task
,
g_variant_dup_string
(
var
,
NULL
),
NULL
);
}
else
if
(
g_strcmp0
(
self
->
pending_property_name
,
"ApplicationDeviceName"
)
==
0
)
{
char
*
v
=
wp_org_freedesktop_reserve_device1_dup_application_device_name
(
proxy
);
g_task_return_pointer
(
task
,
v
,
g_free
);
gchar
*
v
=
NULL
;
g_variant_get
(
ret
,
"(v)"
,
&
v
);
g_task_return_pointer
(
task
,
g_variant_dup_string
(
var
,
NULL
),
NULL
);
}
else
if
(
g_strcmp0
(
self
->
pending_property_name
,
"Priority"
)
==
0
)
{
gint
v
=
wp_org_freedesktop_reserve_device1_get_priority
(
proxy
);
g_task_return_pointer
(
task
,
GINT_TO_POINTER
(
v
),
NULL
);
g_task_return_pointer
(
task
,
GINT_TO_POINTER
(
g_variant_get_int32
(
var
)),
NULL
);
}
else
{
GError
*
error
=
g_error_new
(
WP_DOMAIN_LIBRARY
,
...
...
@@ -477,6 +477,37 @@ on_proxy_done_request_property (GObject *obj, GAsyncResult *res, gpointer data)
}
}
static
void
on_proxy_done_request_property
(
GObject
*
obj
,
GAsyncResult
*
res
,
gpointer
data
)
{
WpDbusDeviceReservation
*
self
=
data
;
g_autoptr
(
WpOrgFreedesktopReserveDevice1
)
proxy
=
NULL
;
g_autoptr
(
GError
)
error
=
NULL
;
g_return_if_fail
(
self
->
pending_task
);
/* Finish */
proxy
=
wp_org_freedesktop_reserve_device1_proxy_new_for_bus_finish
(
res
,
&
error
);
if
(
error
)
{
g_autoptr
(
GTask
)
task
=
g_steal_pointer
(
&
self
->
pending_task
);
g_task_return_error
(
task
,
g_steal_pointer
(
&
error
));
return
;
}
/* Request the property call the Get method */
g_return_if_fail
(
proxy
);
g_return_if_fail
(
self
->
pending_property_name
);
g_dbus_proxy_call
(
G_DBUS_PROXY
(
proxy
),
"org.freedesktop.DBus.Properties.Get"
,
g_variant_new
(
"(ss)"
,
"org.freedesktop.ReserveDevice1"
,
self
->
pending_property_name
),
G_DBUS_CALL_FLAGS_NONE
,
-
1
,
NULL
,
on_request_property_done
,
self
);
}
gboolean
wp_dbus_device_reservation_request_property
(
WpDbusDeviceReservation
*
self
,
const
char
*
name
,
GCancellable
*
cancellable
,
GAsyncReadyCallback
callback
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment