File 0004-Fallback.patch of Package NetworkManager-gnome

From ddd8d9a55035ff9f386ec99ba267d35d54983e6a Mon Sep 17 00:00:00 2001
From: Tambet Ingo <tambet@gmail.com>
Date: Tue, 13 Jan 2009 13:36:59 +0200
Subject: [PATCH] Fallback.


diff --git a/src/connection-editor/ce-page-wireless.glade b/src/connection-editor/ce-page-wireless.glade
index 44ffb7a..8f2a89a 100644
--- a/src/connection-editor/ce-page-wireless.glade
+++ b/src/connection-editor/ce-page-wireless.glade
@@ -1,335 +1,353 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--*- mode: xml -*-->
+<?xml version="1.0"?>
 <glade-interface>
+  <requires-version lib="gtk+" version="2.12"/>
   <widget class="GtkWindow" id="wireless_page_widget">
     <property name="title" translatable="yes">window2</property>
     <child>
       <widget class="GtkTable" id="WirelessPage">
         <property name="visible">True</property>
         <property name="border_width">12</property>
-        <property name="n_rows">9</property>
+        <property name="n_rows">10</property>
         <property name="n_columns">2</property>
         <property name="column_spacing">12</property>
         <property name="row_spacing">6</property>
         <child>
-          <widget class="GtkHBox" id="wireless_mtu_hbox">
+          <widget class="GtkCheckButton" id="wireless_fallback">
             <property name="visible">True</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="adjustment">0 0 10000 1 10 10</property>
-                <property name="climb_rate">1</property>
-              </widget>
-            </child>
-            <child>
-              <widget class="GtkLabel" id="mtu_units">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">bytes</property>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
+            <property name="can_focus">True</property>
+            <property name="label" translatable="yes">Fallback</property>
+            <property name="xalign">0</property>
+            <property name="response_id">0</property>
+            <property name="draw_indicator">True</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="top_attach">9</property>
+            <property name="bottom_attach">10</property>
             <property name="x_options">GTK_FILL</property>
-            <property name="y_options">GTK_FILL</property>
+            <property name="y_options"></property>
           </packing>
         </child>
         <child>
-          <widget class="GtkLabel" id="wireless_mtu_label">
+          <placeholder/>
+        </child>
+        <child>
+          <widget class="GtkLabel" id="wireless_ssid_label">
             <property name="visible">True</property>
             <property name="xalign">0</property>
-            <property name="label" translatable="yes">MT_U:</property>
+            <property name="label" translatable="yes">_SSID:</property>
             <property name="use_underline">True</property>
-            <property name="mnemonic_widget">wireless_mtu</property>
+            <property name="mnemonic_widget">wireless_ssid</property>
           </widget>
           <packing>
-            <property name="top_attach">8</property>
-            <property name="bottom_attach">9</property>
             <property name="x_options">GTK_FILL</property>
             <property name="y_options"></property>
           </packing>
         </child>
         <child>
-          <widget class="GtkEntry" id="wireless_mac">
+          <widget class="GtkLabel" id="wireless_mode_label">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="tooltip_text">This option locks this connection to the network device specified by the MAC address entered here.  Example: 00:11:22:33:44:55</property>
+            <property name="xalign">0</property>
+            <property name="label" translatable="yes">M_ode:</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">wireless_mode</property>
+          </widget>
+          <packing>
+            <property name="top_attach">1</property>
+            <property name="bottom_attach">2</property>
+            <property name="x_options">GTK_FILL</property>
+            <property name="y_options"></property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkComboBox" id="wireless_mode">
+            <property name="visible">True</property>
+            <property name="items" translatable="yes">Infrastructure
+Ad-hoc</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"></property>
+            <property name="top_attach">1</property>
+            <property name="bottom_attach">2</property>
+            <property name="x_options">GTK_FILL</property>
+            <property name="y_options">GTK_FILL</property>
           </packing>
         </child>
         <child>
-          <widget class="GtkLabel" id="wireless_mac_label">
+          <widget class="GtkLabel" id="wireless_band_label">
             <property name="visible">True</property>
             <property name="xalign">0</property>
-            <property name="label" translatable="yes">_MAC address:</property>
+            <property name="label" translatable="yes">Ban_d:</property>
             <property name="use_underline">True</property>
-            <property name="mnemonic_widget">wireless_mac</property>
+            <property name="mnemonic_widget">wireless_band</property>
           </widget>
           <packing>
-            <property name="top_attach">7</property>
-            <property name="bottom_attach">8</property>
+            <property name="top_attach">2</property>
+            <property name="bottom_attach">3</property>
             <property name="x_options">GTK_FILL</property>
             <property name="y_options"></property>
           </packing>
         </child>
         <child>
-          <widget class="GtkHBox" id="wireless_tx_power_hbox">
+          <widget class="GtkComboBox" id="wireless_band">
             <property name="visible">True</property>
-            <property name="spacing">6</property>
-            <child>
-              <widget class="GtkSpinButton" id="wireless_tx_power">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="adjustment">0 0 500 1 10 10</property>
-                <property name="climb_rate">1</property>
-              </widget>
-            </child>
-            <child>
-              <widget class="GtkLabel" id="tx_power_units">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">mW</property>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
+            <property name="items" translatable="yes">Automatic
+A (5 GHz)
+B/G (2.4 GHz)</property>
           </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">2</property>
+            <property name="bottom_attach">3</property>
             <property name="x_options">GTK_FILL</property>
             <property name="y_options">GTK_FILL</property>
           </packing>
         </child>
         <child>
-          <widget class="GtkLabel" id="wireless_tx_power_label">
+          <widget class="GtkLabel" id="wireless_channel_label">
             <property name="visible">True</property>
             <property name="xalign">0</property>
-            <property name="label" translatable="yes">Transmission po_wer:</property>
+            <property name="label" translatable="yes">C_hannel:</property>
             <property name="use_underline">True</property>
-            <property name="mnemonic_widget">wireless_tx_power</property>
+            <property name="mnemonic_widget">wireless_channel</property>
           </widget>
           <packing>
-            <property name="top_attach">6</property>
-            <property name="bottom_attach">7</property>
+            <property name="top_attach">3</property>
+            <property name="bottom_attach">4</property>
             <property name="x_options">GTK_FILL</property>
             <property name="y_options"></property>
           </packing>
         </child>
         <child>
-          <widget class="GtkHBox" id="wireless_rate_hbox">
+          <widget class="GtkSpinButton" id="wireless_channel">
             <property name="visible">True</property>
-            <property name="spacing">6</property>
-            <child>
-              <widget class="GtkSpinButton" id="wireless_rate">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="adjustment">0 0 500 1 10 10</property>
-                <property name="climb_rate">1</property>
-              </widget>
-            </child>
-            <child>
-              <widget class="GtkLabel" id="rate_units">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">Mb/s</property>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
+            <property name="can_focus">True</property>
+            <property name="adjustment">0 0 196 1 10 10</property>
+            <property name="climb_rate">1</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">GTK_FILL</property>
-            <property name="y_options">GTK_FILL</property>
+            <property name="top_attach">3</property>
+            <property name="bottom_attach">4</property>
+            <property name="y_options"></property>
           </packing>
         </child>
         <child>
-          <widget class="GtkLabel" id="wireless_rate_label">
+          <widget class="GtkLabel" id="wireless_bssid_label">
             <property name="visible">True</property>
             <property name="xalign">0</property>
-            <property name="label" translatable="yes">_Rate:</property>
+            <property name="label" translatable="yes">_BSSID:</property>
             <property name="use_underline">True</property>
-            <property name="mnemonic_widget">wireless_rate</property>
+            <property name="mnemonic_widget">wireless_bssid</property>
           </widget>
           <packing>
-            <property name="top_attach">5</property>
-            <property name="bottom_attach">6</property>
+            <property name="top_attach">4</property>
+            <property name="bottom_attach">5</property>
             <property name="x_options">GTK_FILL</property>
             <property name="y_options"></property>
           </packing>
         </child>
         <child>
-          <widget class="GtkEntry" id="wireless_bssid">
+          <widget class="GtkEntry" id="wireless_ssid">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="tooltip_text">This option locks this connection to the wireless access point (AP) specified by the BSSID entered here.  Example: 00:11:22:33:44:55</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_ssid">
+          <widget class="GtkEntry" id="wireless_bssid">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="tooltip_text">This option locks this connection to the wireless access point (AP) specified by the BSSID entered here.  Example: 00:11:22:33:44:55</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="wireless_bssid_label">
+          <widget class="GtkLabel" id="wireless_rate_label">
             <property name="visible">True</property>
             <property name="xalign">0</property>
-            <property name="label" translatable="yes">_BSSID:</property>
+            <property name="label" translatable="yes">_Rate:</property>
             <property name="use_underline">True</property>
-            <property name="mnemonic_widget">wireless_bssid</property>
+            <property name="mnemonic_widget">wireless_rate</property>
           </widget>
           <packing>
-            <property name="top_attach">4</property>
-            <property name="bottom_attach">5</property>
+            <property name="top_attach">5</property>
+            <property name="bottom_attach">6</property>
             <property name="x_options">GTK_FILL</property>
             <property name="y_options"></property>
           </packing>
         </child>
         <child>
-          <widget class="GtkSpinButton" id="wireless_channel">
+          <widget class="GtkHBox" id="wireless_rate_hbox">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="adjustment">0 0 196 1 10 10</property>
-            <property name="climb_rate">1</property>
+            <property name="spacing">6</property>
+            <child>
+              <widget class="GtkSpinButton" id="wireless_rate">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="adjustment">0 0 500 1 10 10</property>
+                <property name="climb_rate">1</property>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="rate_units">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Mb/s</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
           </widget>
           <packing>
             <property name="left_attach">1</property>
             <property name="right_attach">2</property>
-            <property name="top_attach">3</property>
-            <property name="bottom_attach">4</property>
-            <property name="y_options"></property>
+            <property name="top_attach">5</property>
+            <property name="bottom_attach">6</property>
+            <property name="x_options">GTK_FILL</property>
+            <property name="y_options">GTK_FILL</property>
           </packing>
         </child>
         <child>
-          <widget class="GtkLabel" id="wireless_channel_label">
+          <widget class="GtkLabel" id="wireless_tx_power_label">
             <property name="visible">True</property>
             <property name="xalign">0</property>
-            <property name="label" translatable="yes">C_hannel:</property>
+            <property name="label" translatable="yes">Transmission po_wer:</property>
             <property name="use_underline">True</property>
-            <property name="mnemonic_widget">wireless_channel</property>
+            <property name="mnemonic_widget">wireless_tx_power</property>
           </widget>
           <packing>
-            <property name="top_attach">3</property>
-            <property name="bottom_attach">4</property>
+            <property name="top_attach">6</property>
+            <property name="bottom_attach">7</property>
             <property name="x_options">GTK_FILL</property>
             <property name="y_options"></property>
           </packing>
         </child>
         <child>
-          <widget class="GtkComboBox" id="wireless_band">
+          <widget class="GtkHBox" id="wireless_tx_power_hbox">
             <property name="visible">True</property>
-            <property name="items" translatable="yes">Automatic
-A (5 GHz)
-B/G (2.4 GHz)</property>
+            <property name="spacing">6</property>
+            <child>
+              <widget class="GtkSpinButton" id="wireless_tx_power">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="adjustment">0 0 500 1 10 10</property>
+                <property name="climb_rate">1</property>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="tx_power_units">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">mW</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
           </widget>
           <packing>
             <property name="left_attach">1</property>
             <property name="right_attach">2</property>
-            <property name="top_attach">2</property>
-            <property name="bottom_attach">3</property>
+            <property name="top_attach">6</property>
+            <property name="bottom_attach">7</property>
             <property name="x_options">GTK_FILL</property>
             <property name="y_options">GTK_FILL</property>
           </packing>
         </child>
         <child>
-          <widget class="GtkLabel" id="wireless_band_label">
+          <widget class="GtkLabel" id="wireless_mac_label">
             <property name="visible">True</property>
             <property name="xalign">0</property>
-            <property name="label" translatable="yes">Ban_d:</property>
+            <property name="label" translatable="yes">_MAC address:</property>
             <property name="use_underline">True</property>
-            <property name="mnemonic_widget">wireless_band</property>
+            <property name="mnemonic_widget">wireless_mac</property>
           </widget>
           <packing>
-            <property name="top_attach">2</property>
-            <property name="bottom_attach">3</property>
+            <property name="top_attach">7</property>
+            <property name="bottom_attach">8</property>
             <property name="x_options">GTK_FILL</property>
             <property name="y_options"></property>
           </packing>
         </child>
         <child>
-          <widget class="GtkComboBox" id="wireless_mode">
+          <widget class="GtkEntry" id="wireless_mac">
             <property name="visible">True</property>
-            <property name="items" translatable="yes">Infrastructure
-Ad-hoc</property>
+            <property name="can_focus">True</property>
+            <property name="tooltip_text">This option locks this connection to the network device specified by the MAC address entered here.  Example: 00:11:22:33:44:55</property>
           </widget>
           <packing>
             <property name="left_attach">1</property>
             <property name="right_attach">2</property>
-            <property name="top_attach">1</property>
-            <property name="bottom_attach">2</property>
-            <property name="x_options">GTK_FILL</property>
-            <property name="y_options">GTK_FILL</property>
+            <property name="top_attach">7</property>
+            <property name="bottom_attach">8</property>
+            <property name="y_options"></property>
           </packing>
         </child>
         <child>
-          <widget class="GtkLabel" id="wireless_mode_label">
+          <widget class="GtkLabel" id="wireless_mtu_label">
             <property name="visible">True</property>
             <property name="xalign">0</property>
-            <property name="label" translatable="yes">M_ode:</property>
+            <property name="label" translatable="yes">MT_U:</property>
             <property name="use_underline">True</property>
-            <property name="mnemonic_widget">wireless_mode</property>
+            <property name="mnemonic_widget">wireless_mtu</property>
           </widget>
           <packing>
-            <property name="top_attach">1</property>
-            <property name="bottom_attach">2</property>
+            <property name="top_attach">8</property>
+            <property name="bottom_attach">9</property>
             <property name="x_options">GTK_FILL</property>
             <property name="y_options"></property>
           </packing>
         </child>
         <child>
-          <widget class="GtkLabel" id="wireless_ssid_label">
+          <widget class="GtkHBox" id="wireless_mtu_hbox">
             <property name="visible">True</property>
-            <property name="xalign">0</property>
-            <property name="label" translatable="yes">_SSID:</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">wireless_ssid</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="adjustment">0 0 10000 1 10 10</property>
+                <property name="climb_rate">1</property>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="mtu_units">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">bytes</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
           </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">GTK_FILL</property>
-            <property name="y_options"></property>
+            <property name="y_options">GTK_FILL</property>
           </packing>
         </child>
       </widget>
diff --git a/src/connection-editor/page-wireless.c b/src/connection-editor/page-wireless.c
index 74c5997..7585e92 100644
--- a/src/connection-editor/page-wireless.c
+++ b/src/connection-editor/page-wireless.c
@@ -49,6 +49,7 @@ typedef struct {
 	GtkSpinButton *rate;
 	GtkSpinButton *tx_power;
 	GtkSpinButton *mtu;
+	GtkToggleButton *fallback;
 
 	GtkSizeGroup *group;
 
@@ -85,6 +86,8 @@ wireless_private_init (CEPageWireless *self)
 	priv->mtu      = GTK_SPIN_BUTTON (glade_xml_get_widget (xml, "wireless_mtu"));
 	widget = glade_xml_get_widget (xml, "mtu_units");
 	gtk_size_group_add_widget (priv->group, widget);
+
+	priv->fallback = GTK_TOGGLE_BUTTON (glade_xml_get_widget (xml, "wireless_fallback"));
 }
 
 static gboolean
@@ -293,6 +296,9 @@ populate_ui (CEPageWireless *self)
 	gtk_spin_button_set_value (priv->rate, (gdouble) nm_setting_wireless_get_rate (setting));
 	gtk_spin_button_set_value (priv->tx_power, (gdouble) nm_setting_wireless_get_tx_power (setting));
 	gtk_spin_button_set_value (priv->mtu, (gdouble) nm_setting_wireless_get_mtu (setting));
+
+	gtk_toggle_button_set_active (priv->fallback, nm_setting_wireless_get_fallback (setting));
+       g_signal_connect_swapped (priv->fallback, "toggled", G_CALLBACK (ce_page_changed), self);
 }
 
 static void
@@ -441,6 +447,7 @@ ui_to_setting (CEPageWireless *self)
 				  NM_SETTING_WIRELESS_RATE, gtk_spin_button_get_value_as_int (priv->rate),
 				  NM_SETTING_WIRELESS_TX_POWER, gtk_spin_button_get_value_as_int (priv->tx_power),
 				  NM_SETTING_WIRELESS_MTU, gtk_spin_button_get_value_as_int (priv->mtu),
+				  NM_SETTING_WIRELESS_FALLBACK, gtk_toggle_button_get_active (priv->fallback),
 				  NULL);
 
 	if (ssid)
-- 
1.6.0.2

openSUSE Build Service is sponsored by