network: Allow compiling against NM 0.9.6
NM 0.9.7 has still not been released, even as a tarball, so allow compiling against 0.9.6 (without certain bits of new functionality). https://bugzilla.gnome.org/show_bug.cgi?id=691721
This commit is contained in:
parent
3ac77e5d47
commit
ec704ab62f
7 changed files with 81 additions and 3 deletions
11
configure.ac
11
configure.ac
|
@ -99,8 +99,10 @@ CANBERRA_REQUIRED_VERSION=0.13
|
|||
GDKPIXBUF_REQUIRED_VERSION=2.23.0
|
||||
POLKIT_REQUIRED_VERSION=0.103
|
||||
GSD_REQUIRED_VERSION=3.7.3
|
||||
NETWORK_MANAGER_REQUIRED_VERSION=0.9.7.995
|
||||
NETWORK_MANAGER_APPLET_REQUIRED_VERSION=0.9.7.995
|
||||
NETWORK_MANAGER_REQUIRED_VERSION=0.9.6.4
|
||||
NETWORK_MANAGER_DESIRED_VERSION=0.9.7.995
|
||||
NETWORK_MANAGER_APPLET_REQUIRED_VERSION=0.9.6
|
||||
NETWORK_MANAGER_APPLET_DESIRED_VERSION=0.9.7.995
|
||||
LIBNOTIFY_REQUIRED_VERSION=0.7.3
|
||||
GNOME_DESKTOP_REQUIRED_VERSION=3.7.5
|
||||
SCHEMAS_REQUIRED_VERSION=3.7.2.2
|
||||
|
@ -197,6 +199,11 @@ if test x${have_networkmanager} = xyes; then
|
|||
NM_VPN_MODULE_DIR=`$PKG_CONFIG --variable plugindir NetworkManager`
|
||||
AC_SUBST(NM_VPN_CONFIG_DIR)
|
||||
AC_SUBST(NM_VPN_MODULE_DIR)
|
||||
|
||||
PKG_CHECK_MODULES(NM_UNSTABLE, NetworkManager >= $NETWORK_MANAGER_DESIRED_VERSION
|
||||
libnm-gtk >= $NETWORK_MANAGER_APPLET_DESIRED_VERSION,
|
||||
[AC_DEFINE(HAVE_NM_UNSTABLE, 1, [Define if using NetworkManager and network-manager-applet from git master])],
|
||||
[:])
|
||||
fi
|
||||
|
||||
# Check for gnome-bluetooth
|
||||
|
|
|
@ -30,7 +30,9 @@
|
|||
#include "nm-client.h"
|
||||
#include "nm-device.h"
|
||||
#include "nm-device-modem.h"
|
||||
#ifdef HAVE_NM_UNSTABLE
|
||||
#include "nm-ui-utils.h"
|
||||
#endif
|
||||
|
||||
#include "net-device.h"
|
||||
#include "net-device-mobile.h"
|
||||
|
@ -484,6 +486,7 @@ cc_network_panel_get_devices (CcNetworkPanel *panel)
|
|||
static void
|
||||
panel_refresh_device_titles (CcNetworkPanel *panel)
|
||||
{
|
||||
#ifdef HAVE_NM_UNSTABLE
|
||||
GPtrArray *ndarray, *nmdarray;
|
||||
NetDevice **devices;
|
||||
NMDevice **nm_devices;
|
||||
|
@ -512,8 +515,10 @@ panel_refresh_device_titles (CcNetworkPanel *panel)
|
|||
g_free (titles);
|
||||
g_ptr_array_free (ndarray, TRUE);
|
||||
g_ptr_array_free (nmdarray, TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
handle_argv_for_device (CcNetworkPanel *panel,
|
||||
NMDevice *device,
|
||||
|
@ -627,6 +632,7 @@ state_changed_cb (NMDevice *device,
|
|||
static gboolean
|
||||
panel_add_device (CcNetworkPanel *panel, NMDevice *device)
|
||||
{
|
||||
const gchar *title;
|
||||
GtkListStore *liststore_devices;
|
||||
GtkTreeIter iter;
|
||||
NMDeviceType type;
|
||||
|
@ -657,7 +663,9 @@ panel_add_device (CcNetworkPanel *panel, NMDevice *device)
|
|||
device_g_type = NET_TYPE_DEVICE_WIFI;
|
||||
break;
|
||||
case NM_DEVICE_TYPE_BOND:
|
||||
#ifdef HAVE_NM_UNSTABLE
|
||||
case NM_DEVICE_TYPE_BRIDGE:
|
||||
#endif
|
||||
case NM_DEVICE_TYPE_VLAN:
|
||||
goto out;
|
||||
default:
|
||||
|
@ -666,6 +674,7 @@ panel_add_device (CcNetworkPanel *panel, NMDevice *device)
|
|||
}
|
||||
|
||||
/* create device */
|
||||
title = panel_device_to_localized_string (device);
|
||||
net_device = g_object_new (device_g_type,
|
||||
"panel", panel,
|
||||
"removable", FALSE,
|
||||
|
@ -674,6 +683,7 @@ panel_add_device (CcNetworkPanel *panel, NMDevice *device)
|
|||
"remote-settings", panel->priv->remote_settings,
|
||||
"nm-device", device,
|
||||
"id", nm_device_get_udi (device),
|
||||
"title", title,
|
||||
NULL);
|
||||
|
||||
/* add as a panel */
|
||||
|
@ -1082,8 +1092,10 @@ panel_add_virtual_device (CcNetworkPanel *panel, NMConnection *connection)
|
|||
connection_type = nm_setting_connection_get_connection_type (s_con);
|
||||
if (!strcmp (connection_type, NM_SETTING_BOND_SETTING_NAME))
|
||||
device_g_type = NET_TYPE_DEVICE_BOND;
|
||||
#ifdef HAVE_NM_UNSTABLE
|
||||
else if (!strcmp (connection_type, NM_SETTING_BRIDGE_SETTING_NAME))
|
||||
device_g_type = NET_TYPE_DEVICE_BRIDGE;
|
||||
#endif
|
||||
else
|
||||
device_g_type = NET_TYPE_VIRTUAL_DEVICE;
|
||||
|
||||
|
@ -1109,7 +1121,16 @@ panel_add_virtual_device (CcNetworkPanel *panel, NMConnection *connection)
|
|||
|
||||
liststore_devices = GTK_LIST_STORE (gtk_builder_get_object (panel->priv->builder,
|
||||
"liststore_devices"));
|
||||
#ifdef HAVE_NM_UNSTABLE
|
||||
title = nma_utils_get_connection_device_name (connection);
|
||||
#else
|
||||
if (!strcmp (connection_type, NM_SETTING_BOND_SETTING_NAME))
|
||||
title = g_strdup (_("Bond"));
|
||||
else if (!strcmp (connection_type, NM_SETTING_VLAN_SETTING_NAME))
|
||||
title = g_strdup (_("VLAN"));
|
||||
else
|
||||
title = g_strdup (_("Unknown"));
|
||||
#endif
|
||||
|
||||
net_object_set_title (NET_OBJECT (net_virt), title);
|
||||
gtk_list_store_append (liststore_devices, &iter);
|
||||
|
|
|
@ -582,7 +582,9 @@ typedef struct {
|
|||
static const NetConnectionType connection_types[] = {
|
||||
{ N_("VPN"), nm_setting_vpn_get_type },
|
||||
{ N_("Bond"), nm_setting_bond_get_type },
|
||||
#ifdef HAVE_NM_UNSTABLE
|
||||
{ N_("Bridge"), nm_setting_bridge_get_type },
|
||||
#endif
|
||||
{ N_("VLAN"), nm_setting_vlan_get_type }
|
||||
};
|
||||
static const NetConnectionType *vpn_connection_type = &connection_types[0];
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_NM_UNSTABLE
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
|
@ -188,3 +190,5 @@ net_device_bridge_init (NetDeviceBridge *device_bridge)
|
|||
{
|
||||
device_bridge->priv = NET_DEVICE_BRIDGE_GET_PRIVATE (device_bridge);
|
||||
}
|
||||
|
||||
#endif /* HAVE_NM_UNSTABLE */
|
||||
|
|
|
@ -1018,10 +1018,12 @@ start_shared_connection (NetDeviceWifi *device_wifi)
|
|||
|
||||
sw = (NMSettingWireless *)nm_setting_wireless_new ();
|
||||
|
||||
#ifdef HAVE_NM_UNSTABLE
|
||||
/* Use real AP mode if the device supports it */
|
||||
if (nm_device_wifi_get_capabilities (NM_DEVICE_WIFI (device)) & NM_WIFI_DEVICE_CAP_AP)
|
||||
mode = NM_SETTING_WIRELESS_MODE_AP;
|
||||
else
|
||||
#endif
|
||||
mode = NM_SETTING_WIRELESS_MODE_ADHOC;
|
||||
|
||||
g_object_set (sw,
|
||||
|
|
|
@ -69,6 +69,47 @@ panel_device_to_icon_name (NMDevice *device)
|
|||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_device_to_localized_string:
|
||||
**/
|
||||
const gchar *
|
||||
panel_device_to_localized_string (NMDevice *device)
|
||||
{
|
||||
const gchar *value = NULL;
|
||||
NMDeviceModemCapabilities caps;
|
||||
switch (nm_device_get_device_type (device)) {
|
||||
case NM_DEVICE_TYPE_ETHERNET:
|
||||
/* TRANSLATORS: device type */
|
||||
value = _("Wired");
|
||||
break;
|
||||
case NM_DEVICE_TYPE_WIFI:
|
||||
/* TRANSLATORS: device type */
|
||||
value = _("Wi-Fi");
|
||||
break;
|
||||
case NM_DEVICE_TYPE_MODEM:
|
||||
caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (device));
|
||||
if ((caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS) ||
|
||||
(caps & NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO)) {
|
||||
/* TRANSLATORS: device type */
|
||||
value = _("Mobile broadband");
|
||||
}
|
||||
break;
|
||||
case NM_DEVICE_TYPE_BT:
|
||||
/* TRANSLATORS: device type */
|
||||
value = _("Bluetooth");
|
||||
break;
|
||||
case NM_DEVICE_TYPE_OLPC_MESH:
|
||||
/* TRANSLATORS: device type */
|
||||
value = _("Mesh");
|
||||
break;
|
||||
default:
|
||||
/* TRANSLATORS: device type */
|
||||
value = _("Unknown");
|
||||
break;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_device_to_sortable_string:
|
||||
*
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
G_BEGIN_DECLS
|
||||
|
||||
const gchar *panel_device_to_icon_name (NMDevice *device);
|
||||
const gchar *panel_device_to_localized_string (NMDevice *device);
|
||||
const gchar *panel_device_to_sortable_string (NMDevice *device);
|
||||
const gchar *panel_ap_mode_to_localized_string (NM80211Mode mode);
|
||||
const gchar *panel_device_state_to_localized_string (NMDevice *device);
|
||||
|
|
Loading…
Add table
Reference in a new issue