Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
DLNA-RUI
gupnp
Commits
abf30ba4
Commit
abf30ba4
authored
Jan 25, 2011
by
Zeeshan Ali (Khattak)
Browse files
Refactor device activation handling code
parent
cb948609
Changes
1
Hide whitespace changes
Inline
Side-by-side
libgupnp/gupnp-network-manager.c
View file @
abf30ba4
...
...
@@ -189,6 +189,20 @@ create_context_for_device (NMDevice *nm_device, const char *iface)
nm_device
->
context
);
}
static
void
on_device_activated
(
NMDevice
*
nm_device
)
{
GVariant
*
value
;
value
=
g_dbus_proxy_get_cached_property
(
nm_device
->
proxy
,
"Interface"
);
create_context_for_device
(
nm_device
,
g_variant_get_string
(
value
,
NULL
));
g_variant_unref
(
value
);
}
static
void
on_device_signal
(
GDBusProxy
*
proxy
,
char
*
sender_name
,
...
...
@@ -205,17 +219,9 @@ on_device_signal (GDBusProxy *proxy,
nm_device
=
(
NMDevice
*
)
user_data
;
g_variant_get_child
(
parameters
,
0
,
"u"
,
&
new_state
);
if
(
new_state
==
NM_DEVICE_STATE_ACTIVATED
)
{
GVariant
*
value
;
value
=
g_dbus_proxy_get_cached_property
(
nm_device
->
proxy
,
"Interface"
);
create_context_for_device
(
nm_device
,
g_variant_get_string
(
value
,
NULL
));
g_variant_unref
(
value
);
}
else
if
(
nm_device
->
context
!=
NULL
)
{
if
(
new_state
==
NM_DEVICE_STATE_ACTIVATED
)
on_device_activated
(
nm_device
);
else
if
(
nm_device
->
context
!=
NULL
)
{
/* For all other states we just destroy the context */
g_signal_emit_by_name
(
nm_device
->
manager
,
"context-unavailable"
,
...
...
@@ -245,15 +251,8 @@ use_new_device (GUPnPNetworkManager *manager,
state
=
g_variant_get_uint32
(
value
);
g_variant_unref
(
value
);
if
(
state
==
NM_DEVICE_STATE_ACTIVATED
)
{
value
=
g_dbus_proxy_get_cached_property
(
nm_device
->
proxy
,
"Interface"
);
create_context_for_device
(
nm_device
,
g_variant_get_string
(
value
,
NULL
));
g_variant_unref
(
value
);
}
if
(
state
==
NM_DEVICE_STATE_ACTIVATED
)
on_device_activated
(
nm_device
);
}
static
void
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment