summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2013-01-14 10:24:56 -0500
committerMatthias Clasen <mclasen@redhat.com>2013-02-06 16:06:01 -0500
commitec704ab62f0ad6b96736e04375d9af851c146217 (patch)
tree4c0591b1f7ace18fca3c5e2f20eb03931098eb67
parent3ac77e5d47d023634cd4754681c51f66198c0637 (diff)
downloadgnome-control-center-ec704ab62f0ad6b96736e04375d9af851c146217.tar.gz
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
-rw-r--r--configure.ac13
-rw-r--r--panels/network/cc-network-panel.c21
-rw-r--r--panels/network/connection-editor/net-connection-editor.c2
-rw-r--r--panels/network/net-device-bridge.c4
-rw-r--r--panels/network/net-device-wifi.c2
-rw-r--r--panels/network/panel-common.c41
-rw-r--r--panels/network/panel-common.h1
7 files changed, 81 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 91fe76991..afd05f7cb 100644
--- a/configure.ac
+++ b/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
@@ -183,7 +185,7 @@ PKG_CHECK_MODULES(NETWORK_MANAGER, NetworkManager >= $NETWORK_MANAGER_REQUIRED_V
libnm-glib >= $NETWORK_MANAGER_REQUIRED_VERSION
libnm-glib-vpn >= $NETWORK_MANAGER_REQUIRED_VERSION
libnm-util >= $NETWORK_MANAGER_REQUIRED_VERSION
- libnm-gtk >= $NETWORK_MANAGER_APPLET_REQUIRED_VERSION,
+ libnm-gtk >= $NETWORK_MANAGER_APPLET_REQUIRED_VERSION,
[have_networkmanager=yes], have_networkmanager=no)
if test "x$have_networkmanager" = xno ; then
AC_MSG_WARN(*** Network panel will not be built (NetworkManager $NETWORK_MANAGER_REQUIRED_VERSION or newer not found) ***)
@@ -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
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index ebaee3d7a..c6d512f55 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -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);
diff --git a/panels/network/connection-editor/net-connection-editor.c b/panels/network/connection-editor/net-connection-editor.c
index 9d34d112f..b54e4d845 100644
--- a/panels/network/connection-editor/net-connection-editor.c
+++ b/panels/network/connection-editor/net-connection-editor.c
@@ -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];
diff --git a/panels/network/net-device-bridge.c b/panels/network/net-device-bridge.c
index ad850e9f2..d0a660f78 100644
--- a/panels/network/net-device-bridge.c
+++ b/panels/network/net-device-bridge.c
@@ -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 */
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index 0df70625b..4d9a722f4 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -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,
diff --git a/panels/network/panel-common.c b/panels/network/panel-common.c
index 589b6d203..5b48f9eee 100644
--- a/panels/network/panel-common.c
+++ b/panels/network/panel-common.c
@@ -70,6 +70,47 @@ panel_device_to_icon_name (NMDevice *device)
}
/**
+ * 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:
*
* Try to return order of approximate connection speed.
diff --git a/panels/network/panel-common.h b/panels/network/panel-common.h
index 9288e4fbe..a8d1be188 100644
--- a/panels/network/panel-common.h
+++ b/panels/network/panel-common.h
@@ -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);