Commit fe043ba8 authored by Robert Love's avatar Robert Love Committed by Robert Love
Browse files

2005-10-04 Robert Love <rml@novell.com>

        * gnome/applet/applet-dbus-devices.c, gnome/applet/applet.c,
          gnome/applet/nm-device.c, gnome/applet/nm-device.h,
          gnome/applet/wireless-applet.glade, src/nm-dbus-device.c: Display
          default route in the 'Connection Information' dialog, send primary
          and secondary name servers in in "getProperties" DBUS method, add
          network_device_{get,set}_{primary,secondary}_dns(),  The primary and
          secondary domain name servers are crucial pieces of information
          that a user might need in debugging a network problem.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@991 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent dcf8b763
2005-10-04 Robert Love <rml@novell.com>
* gnome/applet/applet-dbus-devices.c, gnome/applet/applet.c,
gnome/applet/nm-device.c, gnome/applet/nm-device.h,
gnome/applet/wireless-applet.glade, src/nm-dbus-device.c: Display
default route in the 'Connection Information' dialog, send primary
and secondary name servers in in "getProperties" DBUS method, add
network_device_{get,set}_{primary,secondary}_dns(), The primary and
secondary domain name servers are crucial pieces of information
that a user might need in debugging a network problem.
2005-10-04 Robert Love <rml@novell.com>
* gnome/applet/applet-dbus-devices.c, gnome/applet/applet.c,
......
......@@ -663,6 +663,8 @@ static void nmwa_dbus_device_properties_cb (DBusPendingCall *pcall, void *user_d
const char * subnetmask = NULL;
const char * hw_addr = NULL;
const char * route = NULL;
const char * primary_dns = NULL;
const char * secondary_dns = NULL;
dbus_uint32_t mode = 0;
dbus_int32_t strength = -1;
char * active_network_path = NULL;
......@@ -695,6 +697,8 @@ static void nmwa_dbus_device_properties_cb (DBusPendingCall *pcall, void *user_d
DBUS_TYPE_STRING, &broadcast,
DBUS_TYPE_STRING, &hw_addr,
DBUS_TYPE_STRING, &route,
DBUS_TYPE_STRING, &primary_dns,
DBUS_TYPE_STRING, &secondary_dns,
DBUS_TYPE_UINT32, &mode,
DBUS_TYPE_INT32, &strength,
DBUS_TYPE_BOOLEAN,&link_active,
......@@ -716,6 +720,8 @@ static void nmwa_dbus_device_properties_cb (DBusPendingCall *pcall, void *user_d
network_device_set_broadcast (dev, broadcast);
network_device_set_netmask (dev, subnetmask);
network_device_set_route (dev, route);
network_device_set_primary_dns (dev, primary_dns);
network_device_set_secondary_dns (dev, secondary_dns);
/* If the device already exists in our list for some reason, remove it so we
* can add the new one with updated data.
......
......@@ -188,8 +188,8 @@ static void nmwa_show_socket_err (GtkWidget *info_dialog, const char *err)
static gboolean nmwa_update_info (NMWirelessApplet *applet)
{
GtkWidget *info_dialog;
char *addr = NULL, *mask = NULL, *broadcast = NULL;
char *mac = NULL, *iface_and_type = NULL, *route = NULL;
char *addr = NULL, *broadcast = NULL, *primary_dns = NULL, *secondary_dns = NULL;
char *mac = NULL, *iface_and_type = NULL, *route = NULL, *mask = NULL;
GtkWidget *label;
const char *iface = NULL;
NetworkDevice *dev;
......@@ -219,6 +219,8 @@ static gboolean nmwa_update_info (NMWirelessApplet *applet)
addr = (char*) network_device_get_ip4_address (dev);
mask = (char*) network_device_get_netmask (dev);
route = (char*) network_device_get_route (dev);
primary_dns = (char*) network_device_get_primary_dns (dev);
secondary_dns = (char*) network_device_get_secondary_dns (dev);
if (network_device_is_wired (dev))
iface_and_type = g_strdup_printf (_("Wired Ethernet (%s)"), iface);
......@@ -237,12 +239,18 @@ static gboolean nmwa_update_info (NMWirelessApplet *applet)
label = get_label (info_dialog, applet->info_dialog_xml, "label-subnet-mask");
gtk_label_set_text (GTK_LABEL (label), mask);
label = get_label (info_dialog, applet->info_dialog_xml, "label-hardware-address");
gtk_label_set_text (GTK_LABEL (label), mac);
label = get_label (info_dialog, applet->info_dialog_xml, "label-default-route");
gtk_label_set_text (GTK_LABEL (label), route);
label = get_label (info_dialog, applet->info_dialog_xml, "label-primary-dns");
gtk_label_set_text (GTK_LABEL (label), primary_dns);
label = get_label (info_dialog, applet->info_dialog_xml, "label-secondary-dns");
gtk_label_set_text (GTK_LABEL (label), secondary_dns);
label = get_label (info_dialog, applet->info_dialog_xml, "label-hardware-address");
gtk_label_set_text (GTK_LABEL (label), mac);
g_free (iface_and_type);
return TRUE;
......
......@@ -46,6 +46,8 @@ struct NetworkDevice
char * netmask;
char * udi;
char * route;
char * primary_dns;
char * secondary_dns;
gint strength;
GSList * networks;
NMActStage act_stage;
......@@ -492,6 +494,44 @@ void network_device_set_route (NetworkDevice *dev, const char *route)
dev->route = route ? g_strdup (route) : NULL;
}
/*
* Accessors for primary DNS
*/
const char *network_device_get_primary_dns (NetworkDevice *dev)
{
g_return_val_if_fail (dev != NULL, NULL);
return (dev->primary_dns);
}
void network_device_set_primary_dns (NetworkDevice *dev, const char *dns)
{
g_return_if_fail (dev != NULL);
if (dev->primary_dns)
g_free (dev->primary_dns);
dev->primary_dns = dns ? g_strdup (dns) : NULL;
}
/*
* Accessors for secondary DNS
*/
const char *network_device_get_secondary_dns (NetworkDevice *dev)
{
g_return_val_if_fail (dev != NULL, NULL);
return (dev->secondary_dns);
}
void network_device_set_secondary_dns (NetworkDevice *dev, const char *dns)
{
g_return_if_fail (dev != NULL);
if (dev->secondary_dns)
g_free (dev->secondary_dns);
dev->secondary_dns = dns ? g_strdup (dns) : NULL;
}
/*
* Accessors for driver support level
*/
......
......@@ -72,6 +72,12 @@ void network_device_set_ip4_address (NetworkDevice *dev, const char *addr)
const char * network_device_get_route (NetworkDevice *dev);
void network_device_set_route (NetworkDevice *dev, const char *route);
const char * network_device_get_primary_dns (NetworkDevice *dev);
void network_device_set_primary_dns (NetworkDevice *dev, const char *dns);
const char * network_device_get_secondary_dns (NetworkDevice *dev);
void network_device_set_secondary_dns (NetworkDevice *dev, const char *dns);
NMDriverSupportLevel network_device_get_driver_support_level (NetworkDevice *dev);
void network_device_set_driver_support_level (NetworkDevice *dev, NMDriverSupportLevel level);
......
......@@ -1061,7 +1061,7 @@ Hex Key (WEP)</property>
<widget class="GtkTable" id="table1">
<property name="border_width">1</property>
<property name="visible">True</property>
<property name="n_rows">10</property>
<property name="n_rows">12</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">3</property>
......@@ -1489,10 +1489,39 @@ Hex Key (WEP)</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label-default-route">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="label" translatable="yes">Hardware Address:</property>
<property name="label" translatable="yes">Default Route:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
......@@ -1517,6 +1546,34 @@ Hex Key (WEP)</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label20">
<property name="visible">True</property>
<property name="label" translatable="yes">Hardware Address:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">11</property>
<property name="bottom_attach">12</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label-hardware-address">
<property name="visible">True</property>
......@@ -1539,17 +1596,17 @@ Hex Key (WEP)</property>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="top_attach">11</property>
<property name="bottom_attach">12</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label20">
<widget class="GtkLabel" id="label21">
<property name="visible">True</property>
<property name="label" translatable="yes">Default Route:</property>
<property name="label" translatable="yes">Primary DNS:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
......@@ -1575,7 +1632,35 @@ Hex Key (WEP)</property>
</child>
<child>
<widget class="GtkLabel" id="label-default-route">
<widget class="GtkLabel" id="label22">
<property name="visible">True</property>
<property name="label" translatable="yes">Secondary DNS:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label-primary-dns">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes"></property>
......@@ -1602,6 +1687,35 @@ Hex Key (WEP)</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label-secondary-dns">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
......
......@@ -330,6 +330,8 @@ static DBusMessage *nm_dbus_device_get_properties (DBusConnection *connection, D
gchar * broadcast;
gchar * subnetmask;
gchar * route;
gchar * primary_dns;
gchar * secondary_dns;
struct ether_addr hw_addr;
char hw_addr_buf[20];
char * hw_addr_buf_ptr = &hw_addr_buf[0];
......@@ -346,6 +348,8 @@ static DBusMessage *nm_dbus_device_get_properties (DBusConnection *connection, D
guint32 broadcast_addr = 0;
guint32 subnetmask_addr = 0;
guint32 route_addr = 0;
guint32 primary_dns_addr = 0;
guint32 secondary_dns_addr = 0;
nm_device_get_hw_address (dev, &hw_addr);
memset (hw_addr_buf, 0, 20);
......@@ -354,14 +358,24 @@ static DBusMessage *nm_dbus_device_get_properties (DBusConnection *connection, D
ip4config = nm_device_get_ip4_config (dev);
if (ip4config)
{
guint32 nr_nameservers;
broadcast_addr = nm_ip4_config_get_broadcast (ip4config);
subnetmask_addr = nm_ip4_config_get_netmask (ip4config);
route_addr = nm_ip4_config_get_gateway (ip4config);
nr_nameservers = nm_ip4_config_get_num_nameservers (ip4config);
if (nr_nameservers > 1)
secondary_dns_addr = nm_ip4_config_get_nameserver (ip4config, 1);
if (nr_nameservers > 0)
primary_dns_addr = nm_ip4_config_get_nameserver (ip4config, 0);
}
ip4_address = nm_utils_inet_ip4_address_as_string (nm_device_get_ip4_address (dev));
broadcast = nm_utils_inet_ip4_address_as_string (broadcast_addr);
subnetmask = nm_utils_inet_ip4_address_as_string (subnetmask_addr);
route = nm_utils_inet_ip4_address_as_string (route_addr);
primary_dns = nm_utils_inet_ip4_address_as_string (primary_dns_addr);
secondary_dns = nm_utils_inet_ip4_address_as_string (secondary_dns_addr);
if (nm_device_is_wireless (dev))
{
......@@ -416,6 +430,8 @@ static DBusMessage *nm_dbus_device_get_properties (DBusConnection *connection, D
DBUS_TYPE_STRING, &broadcast,
DBUS_TYPE_STRING, &hw_addr_buf_ptr,
DBUS_TYPE_STRING, &route,
DBUS_TYPE_STRING, &primary_dns,
DBUS_TYPE_STRING, &secondary_dns,
DBUS_TYPE_UINT32, &mode,
DBUS_TYPE_INT32, &strength,
DBUS_TYPE_BOOLEAN,&link_active,
......
......@@ -199,7 +199,6 @@ guint32 nm_ip4_config_get_num_nameservers (NMIP4Config *config)
return (g_slist_length (config->nameservers));
}
void nm_ip4_config_add_domain (NMIP4Config *config, const char *domain)
{
g_return_if_fail (config != NULL);
......
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