[packagekit] [PATCH] Send correct network state for connman end

Zhang Qiang qiang.z.zhang at intel.com
Mon Sep 20 19:16:57 PDT 2010


Currently, packagekitd accept a bool type of connman network state, and
this patch transfer the correct connman network state (offline/online) to
packagekitd. Without this patch packagekitd/application will get the incorrect
network state notification.
---
 src/pk-network-stack-connman.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/pk-network-stack-connman.c b/src/pk-network-stack-connman.c
index a05b1d8..f28150c 100644
--- a/src/pk-network-stack-connman.c
+++ b/src/pk-network-stack-connman.c
@@ -179,7 +179,7 @@ static void
 pk_network_stack_connman_state_changed (DBusGProxy *proxy, const char *property,
 					GValue *value, gpointer user_data)
 {
-	gboolean ret;
+	PkNetworkEnum network_state;
 	PkNetworkStackConnman *nstack_connman = (PkNetworkStackConnman *) user_data;
 
 	g_return_if_fail (PK_IS_NETWORK_STACK_CONNMAN (nstack_connman));
@@ -189,12 +189,11 @@ pk_network_stack_connman_state_changed (DBusGProxy *proxy, const char *property,
 
 		state = g_value_dup_string (value);
 		if (g_str_equal (state, "online") == TRUE)
-			ret = TRUE;
+			network_state = PK_NETWORK_ENUM_ONLINE;
 		else
-			ret = FALSE;
-		/* TODO: this is a PkNetworkState, not a gboolean */
-		egg_debug ("emitting network-state-changed: %s", pk_network_enum_to_string (ret));
-		g_signal_emit_by_name (PK_NETWORK_STACK (nstack_connman), "state-changed", ret);
+			network_state = PK_NETWORK_ENUM_OFFLINE;
+		egg_debug ("emitting network-state-changed: %s", pk_network_enum_to_string (network_state));
+		g_signal_emit_by_name (PK_NETWORK_STACK (nstack_connman), "state-changed", network_state);
 	}
 
 }
-- 
1.7.2.2




More information about the PackageKit mailing list