gnome-main-menu r456 - in trunk: . main-menu/src
- From: tambeti svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-main-menu r456 - in trunk: . main-menu/src
- Date: Tue, 13 May 2008 06:48:13 +0100 (BST)
Author: tambeti
Date: Tue May 13 05:48:13 2008
New Revision: 456
URL: http://svn.gnome.org/viewvc/gnome-main-menu?rev=456&view=rev
Log:
2008-05-12 Tambet Ingo <tambet gmail com>
* main-menu/src/network-status-agent.c (nm_get_device_info):
Fix another NetworkManager API breakage.
Modified:
trunk/ChangeLog
trunk/main-menu/src/network-status-agent.c
Modified: trunk/main-menu/src/network-status-agent.c
==============================================================================
--- trunk/main-menu/src/network-status-agent.c (original)
+++ trunk/main-menu/src/network-status-agent.c Tue May 13 05:48:13 2008
@@ -25,6 +25,7 @@
#include <NetworkManager.h>
#include <libnm-glib/nm-device-802-11-wireless.h>
#include <libnm-glib/nm-device-802-3-ethernet.h>
+#include <nm-setting-ip4-config.h>
#include <nm-utils.h>
#include <arpa/inet.h>
#include <dbus/dbus.h>
@@ -199,6 +200,8 @@
{
NetworkStatusInfo *info = g_object_new (NETWORK_STATUS_INFO_TYPE, NULL);
const GArray *array;
+ NMSettingIP4Address *def_addr;
+ guint32 hostmask, network, bcast;
info->iface = g_strdup (nm_device_get_iface (device));
info->driver = g_strdup (nm_device_get_driver (device));
@@ -208,6 +211,19 @@
NMIP4Config * cfg = nm_device_get_ip4_config (device);
if(! cfg)
return info;
+
+ def_addr = nm_ip4_config_get_addresses (cfg);
+ if (def_addr) {
+ info->ip4_addr = ip4_address_as_string (def_addr->address);
+ info->subnet_mask = ip4_address_as_string (def_addr->netmask);
+ info->route = ip4_address_as_string (def_addr->gateway);
+
+ network = ntohl (def_addr->address) & ntohl (def_addr->netmask);
+ hostmask = ~ntohl (def_addr->netmask);
+ bcast = htonl (network | hostmask);
+ info->broadcast = ip4_address_as_string (bcast);
+ }
+
info->ip4_addr = ip4_address_as_string (nm_ip4_config_get_address (cfg));
info->subnet_mask = ip4_address_as_string (nm_ip4_config_get_netmask (cfg));
info->broadcast = ip4_address_as_string (nm_ip4_config_get_broadcast (cfg));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]