Commit dcf8b763 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 default
          route in "getProperties" DBUS method, add network_device_set_route(),
          and network_device_get_route().  The Gateway is a crucial piece of
          connection-related information that a user might need in debugging a
          network problem.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@990 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent d31089eb
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 default
route in "getProperties" DBUS method, add network_device_set_route(),
and network_device_get_route(). The Gateway is a crucial piece of
connection-related information that a user might need in debugging a
network problem.
2005-10-03 Robert Love <rml@novell.com>
* src/backends/NetworkManagerSuSE.c: Fix Glib error, GError must be
......
......@@ -662,6 +662,7 @@ static void nmwa_dbus_device_properties_cb (DBusPendingCall *pcall, void *user_d
const char * broadcast = NULL;
const char * subnetmask = NULL;
const char * hw_addr = NULL;
const char * route = NULL;
dbus_uint32_t mode = 0;
dbus_int32_t strength = -1;
char * active_network_path = NULL;
......@@ -693,6 +694,7 @@ static void nmwa_dbus_device_properties_cb (DBusPendingCall *pcall, void *user_d
DBUS_TYPE_STRING, &subnetmask,
DBUS_TYPE_STRING, &broadcast,
DBUS_TYPE_STRING, &hw_addr,
DBUS_TYPE_STRING, &route,
DBUS_TYPE_UINT32, &mode,
DBUS_TYPE_INT32, &strength,
DBUS_TYPE_BOOLEAN,&link_active,
......@@ -713,6 +715,7 @@ static void nmwa_dbus_device_properties_cb (DBusPendingCall *pcall, void *user_d
network_device_set_ip4_address (dev, ip4_address);
network_device_set_broadcast (dev, broadcast);
network_device_set_netmask (dev, subnetmask);
network_device_set_route (dev, route);
/* If the device already exists in our list for some reason, remove it so we
* can add the new one with updated data.
......
......@@ -189,7 +189,7 @@ static gboolean nmwa_update_info (NMWirelessApplet *applet)
{
GtkWidget *info_dialog;
char *addr = NULL, *mask = NULL, *broadcast = NULL;
char *mac = NULL, *iface_and_type = NULL;
char *mac = NULL, *iface_and_type = NULL, *route = NULL;
GtkWidget *label;
const char *iface = NULL;
NetworkDevice *dev;
......@@ -218,6 +218,7 @@ static gboolean nmwa_update_info (NMWirelessApplet *applet)
broadcast = (char*) network_device_get_broadcast (dev);
addr = (char*) network_device_get_ip4_address (dev);
mask = (char*) network_device_get_netmask (dev);
route = (char*) network_device_get_route (dev);
if (network_device_is_wired (dev))
iface_and_type = g_strdup_printf (_("Wired Ethernet (%s)"), iface);
......@@ -239,6 +240,9 @@ static gboolean nmwa_update_info (NMWirelessApplet *applet)
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);
g_free (iface_and_type);
return TRUE;
......
......@@ -45,6 +45,7 @@ struct NetworkDevice
char * broadcast;
char * netmask;
char * udi;
char * route;
gint strength;
GSList * networks;
NMActStage act_stage;
......@@ -98,6 +99,7 @@ NetworkDevice *network_device_copy (NetworkDevice *src)
dev->driver_support_level = src->driver_support_level;
dev->iface = g_strdup (src->iface);
dev->desc = g_strdup (src->desc);
dev->route = g_strdup (src->route);
dev->udi = g_strdup (src->udi);
dev->active = src->active;
dev->act_stage = src->act_stage;
......@@ -148,6 +150,7 @@ void network_device_unref (NetworkDevice *dev)
network_device_clear_wireless_networks (dev);
g_free (dev->nm_path);
g_free (dev->iface);
g_free (dev->route);
g_free (dev->udi);
g_free (dev->desc);
g_free (dev->addr);
......@@ -470,6 +473,25 @@ void network_device_set_ip4_address (NetworkDevice *dev, const char *addr)
dev->ip4addr = addr ? g_strdup (addr) : NULL;
}
/*
* Accessors for default route
*/
const char *network_device_get_route (NetworkDevice *dev)
{
g_return_val_if_fail (dev != NULL, NULL);
return (dev->route);
}
void network_device_set_route (NetworkDevice *dev, const char *route)
{
g_return_if_fail (dev != NULL);
if (dev->route)
g_free (dev->route);
dev->route = route ? g_strdup (route) : NULL;
}
/*
* Accessors for driver support level
*/
......
......@@ -66,8 +66,11 @@ void network_device_set_broadcast (NetworkDevice *dev, const char *addr);
const char * network_device_get_netmask (NetworkDevice *dev);
void network_device_set_netmask (NetworkDevice *dev, const char *addr);
const char * network_device_get_ip4_address (NetworkDevice *dev);
void network_device_set_ip4_address (NetworkDevice *dev, const char *addr);
const char * network_device_get_ip4_address (NetworkDevice *dev);
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);
NMDriverSupportLevel network_device_get_driver_support_level (NetworkDevice *dev);
void network_device_set_driver_support_level (NetworkDevice *dev, NMDriverSupportLevel level);
......
......@@ -17,6 +17,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
......@@ -172,6 +173,7 @@ You have chosen to log in to the wireless network '%s'. If you are sure that th
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
......@@ -316,6 +318,7 @@ You have chosen to log in to the wireless network '%s'. If you are sure that th
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
......@@ -618,6 +621,7 @@ You have chosen to log in to the wireless network '%s'. If you are sure that th
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">passphrase_entry</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
......@@ -721,6 +725,7 @@ Hex key (WEP)</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
......@@ -974,6 +979,7 @@ Hex Key (WEP)</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
......@@ -1055,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">9</property>
<property name="n_rows">10</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">3</property>
......@@ -1539,6 +1545,63 @@ Hex Key (WEP)</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label20">
<property name="visible">True</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>
<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">9</property>
<property name="bottom_attach">10</property>
<property name="x_options">fill</property>
<property name="y_options"></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">9</property>
<property name="bottom_attach">10</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
......
......@@ -329,6 +329,7 @@ static DBusMessage *nm_dbus_device_get_properties (DBusConnection *connection, D
gchar * ip4_address;
gchar * broadcast;
gchar * subnetmask;
gchar * route;
struct ether_addr hw_addr;
char hw_addr_buf[20];
char * hw_addr_buf_ptr = &hw_addr_buf[0];
......@@ -344,6 +345,7 @@ static DBusMessage *nm_dbus_device_get_properties (DBusConnection *connection, D
NMIP4Config * ip4config;
guint32 broadcast_addr = 0;
guint32 subnetmask_addr = 0;
guint32 route_addr = 0;
nm_device_get_hw_address (dev, &hw_addr);
memset (hw_addr_buf, 0, 20);
......@@ -354,10 +356,12 @@ static DBusMessage *nm_dbus_device_get_properties (DBusConnection *connection, D
{
broadcast_addr = nm_ip4_config_get_broadcast (ip4config);
subnetmask_addr = nm_ip4_config_get_netmask (ip4config);
route_addr = nm_ip4_config_get_gateway (ip4config);
}
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);
if (nm_device_is_wireless (dev))
{
......@@ -369,13 +373,13 @@ static DBusMessage *nm_dbus_device_get_properties (DBusConnection *connection, D
strength = (dbus_int32_t) nm_device_get_signal_strength (dev);
mode = (dbus_uint32_t) nm_device_get_mode (dev);
if (req && (ap = nm_act_request_get_ap (req)))
{
if (req && (ap = nm_act_request_get_ap (req)))
{
NMAccessPoint *tmp_ap;
if ((tmp_ap = nm_device_ap_list_get_ap_by_essid (dev, nm_ap_get_essid (ap))))
active_network_path = nm_dbus_get_object_path_for_network (dev, tmp_ap);
}
}
ap_list = nm_device_ap_list_get (dev);
if (ap_list && (num_networks = nm_ap_list_size (ap_list)))
......@@ -411,6 +415,7 @@ static DBusMessage *nm_dbus_device_get_properties (DBusConnection *connection, D
DBUS_TYPE_STRING, &subnetmask,
DBUS_TYPE_STRING, &broadcast,
DBUS_TYPE_STRING, &hw_addr_buf_ptr,
DBUS_TYPE_STRING, &route,
DBUS_TYPE_UINT32, &mode,
DBUS_TYPE_INT32, &strength,
DBUS_TYPE_BOOLEAN,&link_active,
......@@ -421,6 +426,7 @@ static DBusMessage *nm_dbus_device_get_properties (DBusConnection *connection, D
g_free (op);
g_free (active_network_path);
g_strfreev (networks);
g_free (route);
g_free (ip4_address);
g_free (broadcast);
g_free (subnetmask);
......
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