network-manager-applet r701 - in trunk: . src/connection-editor src/utils
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: network-manager-applet r701 - in trunk: . src/connection-editor src/utils
- Date: Sun, 27 Apr 2008 17:47:17 +0100 (BST)
Author: dcbw
Date: Sun Apr 27 16:47:17 2008
New Revision: 701
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=701&view=rev
Log:
2008-04-27 Dan Williams <dcbw redhat com>
* src/utils/utils.c
src/utils/utils.h
- (utils_ether_ntop, utils_mac_valid): new functions
* src/connection-editor/ce-page.c
src/connection-editor/ce-page.h
- (ce_page_mac_to_entry, ce_page_entry_to_mac): new functions
* src/connection-editor/ce-page-wireless.glade
src/connection-editor/page-wireless.c
- Hook up BSSID and MAC address entries
- Hide widgets for settings NM doesn't yet support
* src/connection-editor/ce-page-wired.glade
src/connection-editor/page-wired.c
- Hook up MAC address entry
- Hide widgets for settings NM doesn't yet support
Modified:
trunk/ChangeLog
trunk/src/connection-editor/ce-page-wired.glade
trunk/src/connection-editor/ce-page-wireless.glade
trunk/src/connection-editor/ce-page.c
trunk/src/connection-editor/ce-page.h
trunk/src/connection-editor/page-wired.c
trunk/src/connection-editor/page-wireless.c
trunk/src/utils/utils.c
trunk/src/utils/utils.h
Modified: trunk/src/connection-editor/ce-page-wired.glade
==============================================================================
--- trunk/src/connection-editor/ce-page-wired.glade (original)
+++ trunk/src/connection-editor/ce-page-wired.glade Sun Apr 27 16:47:17 2008
@@ -22,14 +22,14 @@
<widget class="GtkTable" id="WiredPage">
<property name="border_width">12</property>
<property name="visible">True</property>
- <property name="n_rows">6</property>
+ <property name="n_rows">7</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
- <widget class="GtkLabel" id="label24">
+ <widget class="GtkLabel" id="wired_port_label">
<property name="visible">True</property>
<property name="label" translatable="yes">_Port:</property>
<property name="use_underline">True</property>
@@ -78,7 +78,7 @@
</child>
<child>
- <widget class="GtkLabel" id="label25">
+ <widget class="GtkLabel" id="wired_speed_label">
<property name="visible">True</property>
<property name="label" translatable="yes">_Speed:</property>
<property name="use_underline">True</property>
@@ -183,7 +183,6 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">wired_mac_address</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@@ -221,32 +220,14 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="Custom" id="wired_mac_address">
- <property name="visible">True</property>
- <property name="creation_function">create_byte_array_editor</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Wed, 29 Aug 2007 12:24:08 GMT</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="x_options">expand|shrink|fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
@@ -299,10 +280,58 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="wired_mac">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label29">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><span style="italic">Example: 00:11:22:33:44:55</span></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</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.5</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">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
- <property name="y_options">fill</property>
+ <property name="y_options"></property>
</packing>
</child>
</widget>
Modified: trunk/src/connection-editor/ce-page-wireless.glade
==============================================================================
--- trunk/src/connection-editor/ce-page-wireless.glade (original)
+++ trunk/src/connection-editor/ce-page-wireless.glade Sun Apr 27 16:47:17 2008
@@ -22,14 +22,14 @@
<widget class="GtkTable" id="WirelessPage">
<property name="border_width">12</property>
<property name="visible">True</property>
- <property name="n_rows">9</property>
+ <property name="n_rows">11</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
- <widget class="GtkLabel" id="label28">
+ <widget class="GtkLabel" id="wireless_ssid_label">
<property name="visible">True</property>
<property name="label" translatable="yes">_SSID:</property>
<property name="use_underline">True</property>
@@ -58,7 +58,7 @@
</child>
<child>
- <widget class="GtkLabel" id="label29">
+ <widget class="GtkLabel" id="wireless_mode_label">
<property name="visible">True</property>
<property name="label" translatable="yes">M_ode:</property>
<property name="use_underline">True</property>
@@ -105,7 +105,7 @@
</child>
<child>
- <widget class="GtkLabel" id="label30">
+ <widget class="GtkLabel" id="wireless_band_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Ban_d:</property>
<property name="use_underline">True</property>
@@ -153,7 +153,7 @@
</child>
<child>
- <widget class="GtkLabel" id="label31">
+ <widget class="GtkLabel" id="wireless_channel_label">
<property name="visible">True</property>
<property name="label" translatable="yes">C_hannel:</property>
<property name="use_underline">True</property>
@@ -203,7 +203,7 @@
</child>
<child>
- <widget class="GtkLabel" id="label32">
+ <widget class="GtkLabel" id="wireless_bssid_label">
<property name="visible">True</property>
<property name="label" translatable="yes">_BSSID:</property>
<property name="use_underline">True</property>
@@ -232,38 +232,29 @@
</child>
<child>
- <widget class="GtkLabel" id="label33">
+ <widget class="GtkEntry" id="wireless_ssid">
<property name="visible">True</property>
- <property name="label" translatable="yes">_Rate:</property>
- <property name="use_underline">True</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.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">wireless_rate</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>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="activates_default">False</property>
</widget>
<packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
- <property name="x_options">fill</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label34">
+ <widget class="GtkLabel" id="wireless_mtu_label">
<property name="visible">True</property>
- <property name="label" translatable="yes">Transmission po_wer:</property>
+ <property name="label" translatable="yes">MT_U:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -273,7 +264,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">wireless_tx_power</property>
+ <property name="mnemonic_widget">wireless_mtu</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@@ -282,15 +273,75 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</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="label35">
+ <widget class="GtkHBox" id="wireless_mtu_hbox">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkSpinButton" id="wireless_mtu">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">0 0 10000 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="mtu_units">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">bytes</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.5</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="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </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">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="wireless_mac_label">
<property name="visible">True</property>
<property name="label" translatable="yes">_MAC address:</property>
<property name="use_underline">True</property>
@@ -302,7 +353,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">wireless_mac_address</property>
+ <property name="mnemonic_widget">wireless_mac</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@@ -311,17 +362,17 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</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="label36">
+ <widget class="GtkLabel" id="wireless_tx_power_label">
<property name="visible">True</property>
- <property name="label" translatable="yes">MT_U:</property>
+ <property name="label" translatable="yes">Transmission po_wer:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -331,7 +382,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">wireless_mtu</property>
+ <property name="mnemonic_widget">wireless_tx_power</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@@ -340,75 +391,21 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</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="Custom" id="wireless_bssid">
- <property name="visible">True</property>
- <property name="creation_function">create_byte_array_editor</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Wed, 29 Aug 2007 12:26:46 GMT</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="Custom" id="wireless_mac_address">
- <property name="visible">True</property>
- <property name="creation_function">create_byte_array_editor</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Wed, 29 Aug 2007 12:29:27 GMT</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="wireless_ssid">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox2">
+ <widget class="GtkHBox" id="wireless_tx_power_hbox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkSpinButton" id="wireless_rate">
+ <widget class="GtkSpinButton" id="wireless_tx_power">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
@@ -427,9 +424,9 @@
</child>
<child>
- <widget class="GtkLabel" id="rate_units">
+ <widget class="GtkLabel" id="tx_power_units">
<property name="visible">True</property>
- <property name="label" translatable="yes">Mb/s</property>
+ <property name="label" translatable="yes">mW</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -454,21 +451,50 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox3">
+ <widget class="GtkLabel" id="wireless_rate_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Rate:</property>
+ <property name="use_underline">True</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.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">wireless_rate</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">6</property>
+ <property name="bottom_attach">7</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="wireless_rate_hbox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkSpinButton" id="wireless_mtu">
+ <widget class="GtkSpinButton" id="wireless_rate">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
@@ -477,7 +503,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">0 0 10000 1 10 10</property>
+ <property name="adjustment">0 0 500 1 10 10</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -487,9 +513,9 @@
</child>
<child>
- <widget class="GtkLabel" id="mtu_units">
+ <widget class="GtkLabel" id="rate_units">
<property name="visible">True</property>
- <property name="label" translatable="yes">bytes</property>
+ <property name="label" translatable="yes">Mb/s</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -514,44 +540,113 @@
<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">6</property>
+ <property name="bottom_attach">7</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox1">
+ <widget class="GtkEntry" id="wireless_bssid">
<property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="wireless_mac">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="activates_default">False</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="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">0</property>
<child>
- <widget class="GtkSpinButton" id="wireless_tx_power">
+ <widget class="GtkLabel" id="label37">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="climb_rate">1</property>
- <property name="digits">0</property>
- <property name="numeric">False</property>
- <property name="update_policy">GTK_UPDATE_ALWAYS</property>
- <property name="snap_to_ticks">False</property>
+ <property name="label" translatable="yes"><span style="italic">Example: 00:11:22:33:44:55</span></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
- <property name="adjustment">0 0 500 1 10 10</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</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="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
</child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">0</property>
<child>
- <widget class="GtkLabel" id="tx_power_units">
+ <widget class="GtkLabel" id="label38">
<property name="visible">True</property>
- <property name="label" translatable="yes">mW</property>
+ <property name="label" translatable="yes"><span style="italic">Example: 00:11:22:33:44:55</span></property>
<property name="use_underline">False</property>
- <property name="use_markup">False</property>
+ <property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
@@ -564,18 +659,13 @@
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
+ <property name="top_attach">9</property>
+ <property name="bottom_attach">10</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
Modified: trunk/src/connection-editor/ce-page.c
==============================================================================
--- trunk/src/connection-editor/ce-page.c (original)
+++ trunk/src/connection-editor/ce-page.c Sun Apr 27 16:47:17 2008
@@ -20,7 +20,13 @@
* (C) Copyright 2008 Red Hat, Inc.
*/
+#include <net/ethernet.h>
+#include <netinet/ether.h>
+#include <string.h>
+#include <stdlib.h>
+
#include "ce-page.h"
+#include "utils.h"
G_DEFINE_ABSTRACT_TYPE (CEPage, ce_page, G_TYPE_OBJECT)
@@ -47,6 +53,53 @@
CE_PAGE_GET_CLASS (self)->update_connection (self, connection);
}
+void
+ce_page_mac_to_entry (GByteArray *mac, GtkEntry *entry)
+{
+ struct ether_addr addr;
+ char *str_addr;
+
+ g_return_if_fail (entry != NULL);
+ g_return_if_fail (GTK_IS_ENTRY (entry));
+
+ if (!mac || !mac->len)
+ return;
+
+ memcpy (addr.ether_addr_octet, mac->data, ETH_ALEN);
+ str_addr = utils_ether_ntop (&addr);
+ gtk_entry_set_text (entry, str_addr);
+ g_free (str_addr);
+}
+
+GByteArray *
+ce_page_entry_to_mac (GtkEntry *entry, gboolean *invalid)
+{
+ struct ether_addr *ether;
+ const char *temp;
+ GByteArray *mac;
+
+ g_return_val_if_fail (entry != NULL, NULL);
+ g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
+
+ if (invalid)
+ g_return_val_if_fail (*invalid == FALSE, NULL);
+
+ temp = gtk_entry_get_text (entry);
+ if (!temp || !strlen (temp))
+ return NULL;
+
+ ether = ether_aton (temp);
+ if (!ether || !utils_mac_valid (ether)) {
+ if (invalid)
+ *invalid = TRUE;
+ return NULL;
+ }
+
+ mac = g_byte_array_sized_new (ETH_ALEN);
+ g_byte_array_append (mac, (const guint8 *) ether->ether_addr_octet, ETH_ALEN);
+ return mac;
+}
+
static void
ce_page_init (CEPage *self)
{
Modified: trunk/src/connection-editor/ce-page.h
==============================================================================
--- trunk/src/connection-editor/ce-page.h (original)
+++ trunk/src/connection-editor/ce-page.h Sun Apr 27 16:47:17 2008
@@ -27,6 +27,7 @@
#include <glib-object.h>
#include <gtk/gtkwidget.h>
+#include <gtk/gtkentry.h>
#include <glade/glade.h>
#include <nm-connection.h>
@@ -71,5 +72,9 @@
void ce_page_changed (CEPage *self);
+void ce_page_mac_to_entry (GByteArray *mac, GtkEntry *entry);
+
+GByteArray *ce_page_entry_to_mac (GtkEntry *entry, gboolean *invalid);
+
#endif /* __CE_PAGE_H__ */
Modified: trunk/src/connection-editor/page-wired.c
==============================================================================
--- trunk/src/connection-editor/page-wired.c (original)
+++ trunk/src/connection-editor/page-wired.c Sun Apr 27 16:47:17 2008
@@ -21,6 +21,7 @@
*/
#include <string.h>
+#include <net/ethernet.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
@@ -38,6 +39,7 @@
typedef struct {
NMSettingWired *setting;
+ GtkEntry *mac;
GtkComboBox *port;
GtkComboBox *speed;
GtkToggleButton *duplex;
@@ -67,6 +69,7 @@
xml = CE_PAGE (self)->xml;
+ priv->mac = GTK_ENTRY (glade_xml_get_widget (xml, "wired_mac"));
priv->port = GTK_COMBO_BOX (glade_xml_get_widget (xml, "wired_port"));
priv->speed = GTK_COMBO_BOX (glade_xml_get_widget (xml, "wired_speed"));
priv->duplex = GTK_TOGGLE_BUTTON (glade_xml_get_widget (xml, "wired_duplex"));
@@ -75,6 +78,12 @@
}
static void
+stuff_changed (GtkWidget *w, gpointer user_data)
+{
+ ce_page_changed (CE_PAGE (user_data));
+}
+
+static void
populate_ui (CEPageWired *self)
{
CEPageWiredPrivate *priv = CE_PAGE_WIRED_GET_PRIVATE (self);
@@ -125,7 +134,9 @@
/* Autonegotiate */
gtk_toggle_button_set_active (priv->autonegotiate, setting->auto_negotiate);
- /* FIXME: MAC address */
+ /* MAC address */
+ ce_page_mac_to_entry (setting->mac_address, priv->mac);
+ g_signal_connect (priv->mac, "changed", G_CALLBACK (stuff_changed), self);
/* MTU */
mtu_def = ce_get_property_default (NM_SETTING (setting), NM_SETTING_WIRED_MTU);
@@ -136,12 +147,6 @@
gtk_spin_button_set_value (priv->mtu, (gdouble) setting->mtu);
}
-static void
-stuff_changed (GtkWidget *w, gpointer user_data)
-{
- ce_page_changed (CE_PAGE (user_data));
-}
-
CEPageWired *
ce_page_wired_new (NMConnection *connection)
{
@@ -149,6 +154,7 @@
CEPageWiredPrivate *priv;
CEPage *parent;
NMSettingWired *s_wired;
+ GtkWidget *widget;
self = CE_PAGE_WIRED (g_object_new (CE_TYPE_PAGE_WIRED, NULL));
parent = CE_PAGE (self);
@@ -187,6 +193,22 @@
g_signal_connect (priv->autonegotiate, "toggled", G_CALLBACK (stuff_changed), self);
g_signal_connect (priv->mtu, "value-changed", G_CALLBACK (stuff_changed), self);
+ /* Hide widgets we don't yet support */
+ widget = glade_xml_get_widget (parent->xml, "wired_port_label");
+ gtk_widget_hide (widget);
+ widget = glade_xml_get_widget (parent->xml, "wired_port");
+ gtk_widget_hide (widget);
+
+ widget = glade_xml_get_widget (parent->xml, "wired_speed_label");
+ gtk_widget_hide (widget);
+ widget = glade_xml_get_widget (parent->xml, "wired_speed");
+ gtk_widget_hide (widget);
+
+ widget = glade_xml_get_widget (parent->xml, "wired_duplex");
+ gtk_widget_hide (widget);
+ widget = glade_xml_get_widget (parent->xml, "wired_autonegotiate");
+ gtk_widget_hide (widget);
+
return self;
}
@@ -196,6 +218,7 @@
CEPageWiredPrivate *priv = CE_PAGE_WIRED_GET_PRIVATE (self);
const char *port;
guint32 speed;
+ GByteArray *mac = NULL;
/* Port */
switch (gtk_combo_box_get_active (priv->port)) {
@@ -235,13 +258,19 @@
break;
}
+ mac = ce_page_entry_to_mac (priv->mac, NULL);
+
g_object_set (priv->setting,
+ NM_SETTING_WIRED_MAC_ADDRESS, mac,
NM_SETTING_WIRED_PORT, port,
NM_SETTING_WIRED_SPEED, speed,
NM_SETTING_WIRED_DUPLEX, gtk_toggle_button_get_active (priv->duplex) ? "full" : "half",
NM_SETTING_WIRED_AUTO_NEGOTIATE, gtk_toggle_button_get_active (priv->autonegotiate),
NM_SETTING_WIRED_MTU, (guint32) gtk_spin_button_get_value_as_int (priv->mtu),
NULL);
+
+ if (mac)
+ g_byte_array_free (mac, TRUE);
}
static gboolean
@@ -249,6 +278,12 @@
{
CEPageWired *self = CE_PAGE_WIRED (page);
CEPageWiredPrivate *priv = CE_PAGE_WIRED_GET_PRIVATE (self);
+ gboolean invalid = FALSE;
+ GByteArray *ignore;
+
+ ignore = ce_page_entry_to_mac (priv->mac, &invalid);
+ if (invalid)
+ return FALSE;
ui_to_setting (self);
return nm_setting_verify (NM_SETTING (priv->setting), NULL);
Modified: trunk/src/connection-editor/page-wireless.c
==============================================================================
--- trunk/src/connection-editor/page-wireless.c (original)
+++ trunk/src/connection-editor/page-wireless.c Sun Apr 27 16:47:17 2008
@@ -42,6 +42,8 @@
NMSettingWireless *setting;
GtkEntry *ssid;
+ GtkEntry *bssid;
+ GtkEntry *mac;
GtkComboBox *mode;
GtkComboBox *band;
GtkSpinButton *channel;
@@ -67,6 +69,8 @@
priv->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
priv->ssid = GTK_ENTRY (glade_xml_get_widget (xml, "wireless_ssid"));
+ priv->bssid = GTK_ENTRY (glade_xml_get_widget (xml, "wireless_bssid"));
+ priv->mac = GTK_ENTRY (glade_xml_get_widget (xml, "wireless_mac"));
priv->mode = GTK_COMBO_BOX (glade_xml_get_widget (xml, "wireless_mode"));
priv->band = GTK_COMBO_BOX (glade_xml_get_widget (xml, "wireless_band"));
priv->channel = GTK_SPIN_BUTTON (glade_xml_get_widget (xml, "wireless_channel"));
@@ -271,8 +275,13 @@
priv->last_channel = setting->channel;
gtk_spin_button_set_value (priv->channel, (gdouble) setting->channel);
- /* FIXME: BSSID */
- /* FIXME: MAC address */
+ /* BSSID */
+ ce_page_mac_to_entry (setting->bssid, priv->bssid);
+ g_signal_connect (priv->bssid, "changed", G_CALLBACK (entry_changed), self);
+
+ /* MAC address */
+ ce_page_mac_to_entry (setting->mac_address, priv->mac);
+ g_signal_connect (priv->mac, "changed", G_CALLBACK (entry_changed), self);
gtk_spin_button_set_value (priv->rate, (gdouble) setting->rate);
gtk_spin_button_set_value (priv->tx_power, (gdouble) setting->tx_power);
@@ -286,6 +295,7 @@
CEPageWirelessPrivate *priv;
CEPage *parent;
NMSettingWireless *s_wireless;
+ GtkWidget *widget;
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
@@ -320,6 +330,27 @@
populate_ui (self);
+ /* Hide widgets we don't yet support */
+ widget = glade_xml_get_widget (parent->xml, "wireless_band_label");
+ gtk_widget_hide (widget);
+ widget = glade_xml_get_widget (parent->xml, "wireless_band");
+ gtk_widget_hide (widget);
+
+ widget = glade_xml_get_widget (parent->xml, "wireless_channel_label");
+ gtk_widget_hide (widget);
+ widget = glade_xml_get_widget (parent->xml, "wireless_channel");
+ gtk_widget_hide (widget);
+
+ widget = glade_xml_get_widget (parent->xml, "wireless_tx_power_label");
+ gtk_widget_hide (widget);
+ widget = glade_xml_get_widget (parent->xml, "wireless_tx_power_hbox");
+ gtk_widget_hide (widget);
+
+ widget = glade_xml_get_widget (parent->xml, "wireless_rate_label");
+ gtk_widget_hide (widget);
+ widget = glade_xml_get_widget (parent->xml, "wireless_rate_hbox");
+ gtk_widget_hide (widget);
+
return self;
}
@@ -348,6 +379,8 @@
{
CEPageWirelessPrivate *priv = CE_PAGE_WIRELESS_GET_PRIVATE (self);
GByteArray *ssid;
+ GByteArray *bssid = NULL;
+ GByteArray *mac = NULL;
const char *mode;
const char *band;
@@ -371,8 +404,13 @@
break;
}
+ bssid = ce_page_entry_to_mac (priv->bssid, NULL);
+ mac = ce_page_entry_to_mac (priv->mac, NULL);
+
g_object_set (priv->setting,
NM_SETTING_WIRELESS_SSID, ssid,
+ NM_SETTING_WIRELESS_BSSID, bssid,
+ NM_SETTING_WIRELESS_MAC_ADDRESS, mac,
NM_SETTING_WIRELESS_MODE, mode,
NM_SETTING_WIRELESS_BAND, band,
NM_SETTING_WIRELESS_CHANNEL, gtk_spin_button_get_value_as_int (priv->channel),
@@ -383,6 +421,10 @@
if (ssid)
g_byte_array_free (ssid, TRUE);
+ if (mac)
+ g_byte_array_free (mac, TRUE);
+ if (bssid)
+ g_byte_array_free (bssid, TRUE);
}
static gboolean
@@ -392,6 +434,16 @@
CEPageWirelessPrivate *priv = CE_PAGE_WIRELESS_GET_PRIVATE (self);
char *security;
gboolean success;
+ gboolean invalid = FALSE;
+ GByteArray *ignore;
+
+ ignore = ce_page_entry_to_mac (priv->bssid, &invalid);
+ if (invalid)
+ return FALSE;
+
+ ignore = ce_page_entry_to_mac (priv->mac, &invalid);
+ if (invalid)
+ return FALSE;
ui_to_setting (self);
Modified: trunk/src/utils/utils.c
==============================================================================
--- trunk/src/utils/utils.c (original)
+++ trunk/src/utils/utils.c Sun Apr 27 16:47:17 2008
@@ -729,3 +729,44 @@
return filtered;
}
+gboolean
+utils_mac_valid (const struct ether_addr *addr)
+{
+ guint8 invalid1[ETH_ALEN] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+ guint8 invalid2[ETH_ALEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ guint8 invalid3[ETH_ALEN] = {0x44, 0x44, 0x44, 0x44, 0x44, 0x44};
+ guint8 invalid4[ETH_ALEN] = {0x00, 0x30, 0xb4, 0x00, 0x00, 0x00}; /* prism54 dummy MAC */
+
+ g_return_val_if_fail (addr != NULL, FALSE);
+
+ /* Compare the AP address the card has with invalid ethernet MAC addresses. */
+ if (!memcmp (addr->ether_addr_octet, &invalid1, ETH_ALEN))
+ return FALSE;
+
+ if (!memcmp (addr->ether_addr_octet, &invalid2, ETH_ALEN))
+ return FALSE;
+
+ if (!memcmp (addr->ether_addr_octet, &invalid3, ETH_ALEN))
+ return FALSE;
+
+ if (!memcmp (addr->ether_addr_octet, &invalid4, ETH_ALEN))
+ return FALSE;
+
+ if (addr->ether_addr_octet[0] & 1) /* Multicast addresses */
+ return FALSE;
+
+ return TRUE;
+}
+
+char *
+utils_ether_ntop (const struct ether_addr *mac)
+{
+ /* we like leading zeros and all-caps, instead
+ * of what glibc's ether_ntop() gives us
+ */
+ return g_strdup_printf ("%02X:%02X:%02X:%02X:%02X:%02X",
+ mac->ether_addr_octet[0], mac->ether_addr_octet[1],
+ mac->ether_addr_octet[2], mac->ether_addr_octet[3],
+ mac->ether_addr_octet[4], mac->ether_addr_octet[5]);
+}
+
Modified: trunk/src/utils/utils.h
==============================================================================
--- trunk/src/utils/utils.h (original)
+++ trunk/src/utils/utils.h Sun Apr 27 16:47:17 2008
@@ -55,5 +55,9 @@
GSList *utils_filter_connections_for_device (NMDevice *device, GSList *connections);
+char *utils_ether_ntop (const struct ether_addr *mac);
+
+gboolean utils_mac_valid (const struct ether_addr *addr);
+
#endif /* UTILS_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]