static void
device_state_changed (NMDevice *device,
                      NMDeviceState new_state,
                      NMDeviceState old_state,
                      NMDeviceStateReason reason,
                      NMApplet *applet)
{
	NMConnection *connection;
	NMSettingConnection *s_con = NULL;
	char *str = NULL;

	if (new_state != NM_DEVICE_STATE_ACTIVATED)
		return;

	connection = applet_find_active_connection_for_device (device, applet, NULL);
	if (connection) {
		const char *id;

		s_con = nm_connection_get_setting_connection (connection);
		id = s_con ? nm_setting_connection_get_id (s_con) : NULL;
		if (id)
			str = g_strdup_printf (_("You are now connected to '%s'."), id);
	}

	applet_do_notify_with_pref (applet,
	                            _("Connection Established"),
	                            str ? str : _("You are now connected to the Mobile Broadband network."),
	                            "nm-device-wwan",
	                            PREF_DISABLE_CONNECTED_NOTIFICATIONS);
	g_free (str);
}
static void
device_state_changed (NMDevice *device,
                      NMDeviceState new_state,
                      NMDeviceState old_state,
                      NMDeviceStateReason reason,
                      NMApplet *applet)
{
	NMConnection *connection;
	NMSettingConnection *s_con = NULL;
	const char *str = NULL;

	if (new_state != NM_DEVICE_STATE_ACTIVATED)
		return;

	connection = applet_find_active_connection_for_device (device, applet, NULL);
	if (connection) {
		s_con = nm_connection_get_setting_connection (connection);
		str = s_con ? nm_setting_connection_get_id (s_con) : NULL;
	}

	applet_do_notify_with_pref (applet,
	                            _("Connected"),
	                            str ? str : _("Mobile Broadband network"),
	                            "nm-device-wwan",
	                            PREF_DISABLE_CONNECTED_NOTIFICATIONS);
}
static void
notify_user_of_cdma_reg_change (CdmaDeviceInfo *info)
{
	guint32 mb_state = cdma_state_to_mb_state (info);

	if (mb_state == MB_STATE_HOME) {
		applet_do_notify_with_pref (info->applet,
		                            _("CDMA network."),
		                            _("You are now registered on the home network."),
		                            "nm-signal-100",
		                            PREF_DISABLE_CONNECTED_NOTIFICATIONS);
	} else if (mb_state == MB_STATE_ROAMING) {
		applet_do_notify_with_pref (info->applet,
		                            _("CDMA network."),
		                            _("You are now registered on a roaming network."),
		                            "nm-signal-100",
		                            PREF_DISABLE_CONNECTED_NOTIFICATIONS);
	}
}
static void
bt_notify_connected (NMDevice *device,
                     const char *msg,
                     NMApplet *applet)
{
	applet_do_notify_with_pref (applet,
	                            _("Connection Established"),
	                            msg ? msg : _("You are now connected to the mobile broadband network."),
	                            "nm-device-wwan",
	                            PREF_DISABLE_CONNECTED_NOTIFICATIONS);
}
Exemplo n.º 5
0
static void
vlan_notify_connected (NMDevice *device,
                       const char *msg,
                       NMApplet *applet)
{
	applet_do_notify_with_pref (applet,
	                            _("Connection Established"),
	                            msg ? msg : _("You are now connected to the VLAN."),
	                            "nm-device-wired",
	                            PREF_DISABLE_CONNECTED_NOTIFICATIONS);
}
static void
cdma_device_state_changed (NMDevice *device,
                           NMDeviceState new_state,
                           NMDeviceState old_state,
                           NMDeviceStateReason reason,
                           NMApplet *applet)
{
	CdmaDeviceInfo *info;

	if (new_state == NM_DEVICE_STATE_ACTIVATED) {
		NMConnection *connection;
		NMSettingConnection *s_con = NULL;
		char *str = NULL;

		connection = applet_find_active_connection_for_device (device, applet, NULL);
		if (connection) {
			const char *id;

			s_con = nm_connection_get_setting_connection (connection);
			id = s_con ? nm_setting_connection_get_id (s_con) : NULL;
			if (id)
				str = g_strdup_printf (_("You are now connected to '%s'."), id);
		}

		applet_do_notify_with_pref (applet,
		                            _("Connection Established"),
		                            str ? str : _("You are now connected to the CDMA network."),
		                            "nm-device-wwan",
		                            PREF_DISABLE_CONNECTED_NOTIFICATIONS);
		g_free (str);
	}

	/* Start/stop polling of quality and registration when device state changes */
	info = g_object_get_data (G_OBJECT (device), "devinfo");
	check_start_polling (info);
}