pidgin: 10ead468: Support new connection states and signal...

qulogic at pidgin.im qulogic at pidgin.im
Thu Dec 22 04:41:04 EST 2011


----------------------------------------------------------------------
Revision: 10ead4688e3af4132d454fa3bc241480500651c9
Parent:   adb5993fd26854de08af6ca2864eeb3fe1fc8c1d
Author:   dcbw at redhat.com
Date:     12/21/11 19:50:40
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/10ead4688e3af4132d454fa3bc241480500651c9

Changelog: 

Support new connection states and signals for NetworkManager 0.9+.

Fixes #13859.

Changes against parent adb5993fd26854de08af6ca2864eeb3fe1fc8c1d

  patched  ChangeLog
  patched  libpurple/network.c

-------------- next part --------------
============================================================
--- ChangeLog	e582a89e99f22ce7c6a9db55c17c9a0ce2aea15e
+++ ChangeLog	b5861617d2f1ed8abc36c32f0c798793b2485308
@@ -1,6 +1,10 @@ version 3.0.0 (??/??/????):
 Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul
 
 version 3.0.0 (??/??/????):
+	libpurple:
+	* Support new connection states and signals for NetworkManager 0.9+.
+	  (Dan Williams) (#13859)
+
 	AIM and ICQ:
 	* Make buddy list management code more efficient. (Oliver) (#4816)
 	* Don't try to format ICQ usernames entered as email addresses.
============================================================
--- libpurple/network.c	d97e5b18399b91ec3352209717aaff0ab5ac60c4
+++ libpurple/network.c	b278d275420201ae15ddcef7a617dbe73ac1fd74
@@ -811,8 +811,20 @@ purple_network_is_available(void)
 			purple_debug_warning("network", "NetworkManager not active. Assuming connection exists.\n");
 	}
 
-	if (nm_state == NM_STATE_UNKNOWN || nm_state == NM_STATE_CONNECTED)
-		return TRUE;
+	switch (nm_state)
+	{
+		case NM_STATE_UNKNOWN:
+#if NM_CHECK_VERSION(0,8,992)
+		case NM_STATE_CONNECTED_LOCAL:
+		case NM_STATE_CONNECTED_SITE:
+		case NM_STATE_CONNECTED_GLOBAL:
+#else
+		case NM_STATE_CONNECTED:
+#endif
+			return TRUE;
+		default:
+			break;
+	}
 
 	return FALSE;
 
@@ -1149,9 +1161,14 @@ purple_network_init(void)
 		                                     NM_DBUS_SERVICE,
 		                                     NM_DBUS_PATH,
 		                                     NM_DBUS_INTERFACE);
+		/* NM 0.6 signal */
 		dbus_g_proxy_add_signal(nm_proxy, "StateChange", G_TYPE_UINT, G_TYPE_INVALID);
 		dbus_g_proxy_connect_signal(nm_proxy, "StateChange",
 		                            G_CALLBACK(nm_state_change_cb), NULL, NULL);
+		/* NM 0.7 and later signal */
+		dbus_g_proxy_add_signal(nm_proxy, "StateChanged", G_TYPE_UINT, G_TYPE_INVALID);
+		dbus_g_proxy_connect_signal(nm_proxy, "StateChanged",
+		                            G_CALLBACK(nm_state_change_cb), NULL, NULL);
 
 		dbus_proxy = dbus_g_proxy_new_for_name(nm_conn,
 		                                       DBUS_SERVICE_DBUS,
@@ -1186,6 +1203,7 @@ purple_network_uninit(void)
 #ifdef HAVE_NETWORKMANAGER
 	if (nm_proxy) {
 		dbus_g_proxy_disconnect_signal(nm_proxy, "StateChange", G_CALLBACK(nm_state_change_cb), NULL);
+		dbus_g_proxy_disconnect_signal(nm_proxy, "StateChanged", G_CALLBACK(nm_state_change_cb), NULL);
 		g_object_unref(G_OBJECT(nm_proxy));
 	}
 	if (dbus_proxy) {


More information about the Commits mailing list