Commit 0225d1a9 authored by Aleksander Morgado's avatar Aleksander Morgado

network: include support for the 'ModemManager1' interface

The control-center will automatically detect whether the modems exposed by
NetworkManager are from the old or the new interface, and if they are from the
new one it will use the libmm-glib support to gather the required information
from them.

The new ModemManager1 interfaces are exposed by ModemManager >= 0.7; and provide
lots of new functionalities, like:
  * Improved connection bearer handling (e.g. multiple bearers at the same time)
  * Location support (GPS, LAC/CI, CDMA BS...)
  * Full SMS support through the new 'Messaging' interface.
  * ...
parent f094cc0e
......@@ -101,6 +101,7 @@ 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
MODEM_MANAGER_REQUIRED_VERSION=0.7
LIBNOTIFY_REQUIRED_VERSION=0.7.3
GNOME_DESKTOP_REQUIRED_VERSION=3.7.5
SCHEMAS_REQUIRED_VERSION=3.7.2.2
......@@ -183,10 +184,11 @@ 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
mm-glib >= $MODEM_MANAGER_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) ***)
AC_MSG_WARN(*** Network panel will not be built (NetworkManager or ModemManager not found) ***)
else
AC_DEFINE(BUILD_NETWORK, 1, [Define to 1 to build the Network panel])
fi
......
......@@ -2,6 +2,7 @@
*
* Copyright (C) 2010-2012 Richard Hughes <richard@hughsie.com>
* Copyright (C) 2012 Thomas Bechtold <thomasbechtold@jpberlin.de>
* Copyright (C) 2013 Aleksander Morgado <aleksander@gnu.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -50,6 +51,8 @@
#include "network-dialogs.h"
#include "connection-editor/net-connection-editor.h"
#include <libmm-glib.h>
CC_PANEL_REGISTER (CcNetworkPanel, cc_network_panel)
#define NETWORK_PANEL_PRIVATE(o) \
......@@ -70,6 +73,7 @@ struct _CcNetworkPanelPrivate
GtkBuilder *builder;
GtkWidget *treeview;
NMClient *client;
MMManager *modem_manager;
NMRemoteSettings *remote_settings;
gboolean updating_device;
guint nm_warning_idle;
......@@ -212,6 +216,7 @@ cc_network_panel_dispose (GObject *object)
g_clear_object (&priv->cancellable);
g_clear_object (&priv->builder);
g_clear_object (&priv->client);
g_clear_object (&priv->modem_manager);
g_clear_object (&priv->remote_settings);
g_clear_object (&priv->kill_switch_header);
g_clear_object (&priv->rfkill);
......@@ -681,6 +686,31 @@ panel_add_device (CcNetworkPanel *panel, NMDevice *device)
"id", nm_device_get_udi (device),
NULL);
if (type == NM_DEVICE_TYPE_MODEM &&
g_str_has_prefix (nm_device_get_udi (device), "/org/freedesktop/ModemManager1/Modem/")) {
GDBusObject *modem_object;
if (priv->modem_manager == NULL) {
g_warning ("Cannot grab information for modem at %s: No ModemManager support",
nm_device_get_udi (device));
goto out;
}
modem_object = g_dbus_object_manager_get_object (G_DBUS_OBJECT_MANAGER (priv->modem_manager),
nm_device_get_udi (device));
if (modem_object == NULL) {
g_warning ("Cannot grab information for modem at %s: Not found",
nm_device_get_udi (device));
goto out;
}
/* Set the modem object in the NetDeviceMobile */
g_object_set (net_device,
"mm-object", modem_object,
NULL);
g_object_unref (modem_object);
}
/* add as a panel */
if (device_g_type != NET_TYPE_DEVICE) {
notebook = GTK_NOTEBOOK (gtk_builder_get_object (panel->priv->builder,
......@@ -1295,6 +1325,7 @@ cc_network_panel_init (CcNetworkPanel *panel)
GtkTreeSelection *selection;
GtkWidget *widget;
GtkWidget *toplevel;
GDBusConnection *system_bus;
panel->priv = NETWORK_PANEL_PRIVATE (panel);
g_resources_register (cc_network_get_resource ());
......@@ -1344,6 +1375,25 @@ cc_network_panel_init (CcNetworkPanel *panel)
g_signal_connect (panel->priv->client, "device-removed",
G_CALLBACK (device_removed_cb), panel);
/* Setup ModemManager client */
system_bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
if (system_bus == NULL) {
g_warning ("Error connecting to system D-Bus: %s",
error->message);
g_clear_error (&error);
} else {
panel->priv->modem_manager = mm_manager_new_sync (system_bus,
G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE,
NULL,
&error);
if (panel->priv->modem_manager == NULL) {
g_warning ("Error connecting to ModemManager: %s",
error->message);
g_clear_error (&error);
}
g_object_unref (system_bus);
}
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"add_toolbutton"));
g_signal_connect (widget, "clicked",
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment