patches/gnome-system-tools-03-network.diff
author yippi
Mon, 27 Sep 2010 21:07:51 +0000
changeset 20108 51df67ca9307
parent 15479 12f424889c3c
permissions -rw-r--r--
I had these modules listed as being owned by me, but they are really owned by wangke, correcting.

diff -u gnome-system-tools-2.14.0/interfaces/network.glade.in-orig gnome-system-tools-2.14.0/interfaces/network.glade.in
--- gnome-system-tools-2.14.0/interfaces/network.glade.in-orig	2006-01-31 06:40:32.000000000 +0800
+++ gnome-system-tools-2.14.0/interfaces/network.glade.in	2007-11-14 16:23:54.107510000 +0800
@@ -1240,7 +1240,7 @@
 			<widget class="GtkTable" id="table12">
 			  <property name="border_width">6</property>
 			  <property name="visible">True</property>
-			  <property name="n_rows">2</property>
+			  <property name="n_rows">3</property>
 			  <property name="n_columns">2</property>
 			  <property name="homogeneous">False</property>
 			  <property name="row_spacing">6</property>
@@ -1322,6 +1322,31 @@
 			      <property name="y_options"></property>
 			    </packing>
 			  </child>
+
+			  <child>
+			    <widget class="GtkCheckButton" id="connection_device_onboot">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes" comments="SUN_BRANDING">_Activate on boot</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="focus_on_click">True</property>
+			      <property name="active">True</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			      <accessibility>
+				<atkproperty name="AtkObject::accessible_name" translatable="yes" comments="SUN_BRANDING">Activate this connection on boot</atkproperty>
+			      </accessibility>
+			    </widget>
+			    <packing>
+			      <property name="left_attach">0</property>
+			      <property name="right_attach">2</property>
+			      <property name="top_attach">2</property>
+			      <property name="bottom_attach">3</property>
+			      <property name="x_options">fill</property>
+			      <property name="y_options"></property>
+			    </packing>
+			  </child>
 			</widget>
 		      </child>
 		    </widget>

diff -u gnome-system-tools-2.14.0/src/network/callbacks.c-orig gnome-system-tools-2.14.0/src/network/callbacks.c
--- gnome-system-tools-2.14.0/src/network/callbacks.c-orig	2005-08-09 03:00:02.000000000 +0800
+++ gnome-system-tools-2.14.0/src/network/callbacks.c	2007-11-14 16:27:43.927717000 +0800
@@ -35,7 +35,6 @@
   gboolean   success;
 
   success = gst_iface_enable (iface);
-  gst_iface_set_auto (iface, success);
 
   if (!success)
     {
@@ -170,8 +169,9 @@
   dialog = GST_NETWORK_TOOL (tool)->dialog;
   gtk_widget_hide (dialog->dialog);
 
-  if (dialog->changed)
+  if (dialog->changed || dialog->needsaved)
     {
+      dialog->needsaved = FALSE;
       connection_save (dialog);
       selection = gtk_tree_view_get_selection (GST_NETWORK_TOOL (tool)->interfaces_list);
 
@@ -342,7 +342,6 @@
       else
         {
 	  gst_iface_disable (iface);
-	  gst_iface_set_auto (iface, FALSE);
 	}
 
       ifaces_model_modify_interface_at_iter (&iter);
diff -u gnome-system-tools-2.14.0/src/network/connection.c-orig gnome-system-tools-2.14.0/src/network/connection.c
--- gnome-system-tools-2.14.0/src/network/connection.c-orig	2005-08-09 03:00:02.000000000 +0800
+++ gnome-system-tools-2.14.0/src/network/connection.c	2007-11-14 16:27:52.911896000 +0800
@@ -117,6 +117,7 @@
 {
   g_object_set (G_OBJECT (dialog->iface),
 		"iface-address",   get_entry_text (dialog->address),
+		"iface-address",   get_entry_text (dialog->address),
 		"iface-netmask",   get_entry_text (dialog->netmask),
 		"iface-gateway",   get_entry_text (dialog->gateway),
 		"iface-bootproto", connection_get_bootproto (dialog),
@@ -366,6 +367,7 @@
   gcd = g_new0 (GstConnectionDialog, 1);
 
   gcd->standalone = FALSE;
+  gcd->needsaved = FALSE;
   gcd->iface  = NULL;
   gcd->dialog = gst_dialog_get_widget (tool->main_dialog, "connection_config_dialog");
 
@@ -378,6 +380,7 @@
   gcd->options_page     = gst_dialog_get_widget (tool->main_dialog, "connection_options_page");
 
   gcd->connection_configured = gst_dialog_get_widget (tool->main_dialog, "connection_device_active");
+  gcd->connection_onboot = gst_dialog_get_widget (tool->main_dialog, "connection_device_onboot");
   gcd->connection_device     = gst_dialog_get_widget (tool->main_dialog, "connection_device");
 
   gcd->connection_ppp_configured = gst_dialog_get_widget (tool->main_dialog, "connection_ppp_device_active");
@@ -425,6 +428,7 @@
 connection_dialog_prepare (GstConnectionDialog *dialog, GstIface *iface)
 {
   gboolean active;
+  gboolean onboot;
 
   dialog->iface = g_object_ref (iface);
   active = gst_iface_is_configured (dialog->iface);
@@ -473,6 +477,9 @@
       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->connection_configured),
 				    gst_iface_is_configured (iface));
 
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->connection_onboot),
+			            gst_iface_get_auto (iface));
+
       gtk_label_set_text (GTK_LABEL (dialog->connection_device),
 			  gst_iface_get_dev (iface));
 
@@ -511,7 +518,7 @@
 void
 connection_save (GstConnectionDialog *dialog)
 {
-  gboolean active;
+  gboolean active, onboot;
 
   if (GST_IS_IFACE_MODEM (dialog->iface)
       || GST_IS_IFACE_ISDN (dialog->iface))
@@ -525,6 +532,7 @@
   else
     {
       active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->connection_configured));
+      onboot = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->connection_onboot));
 
       if (GST_IS_IFACE_WIRELESS (dialog->iface))
         {
@@ -536,6 +544,8 @@
         ethernet_dialog_save (dialog);
       else if (GST_IS_IFACE_PLIP (dialog->iface))
         plip_dialog_save (dialog);
+
+      gst_iface_set_auto (dialog->iface, onboot);
     }
 
   gst_iface_set_configured (dialog->iface, active);
@@ -601,10 +611,11 @@
 void
 connection_dialog_set_sensitive (GstConnectionDialog *dialog, gboolean active)
 {
-  gtk_widget_set_sensitive (dialog->wireless_frame, active);
-  gtk_widget_set_sensitive (dialog->ethernet_frame, active);
-  gtk_widget_set_sensitive (dialog->plip_frame,     active);
-  gtk_widget_set_sensitive (dialog->modem_frame,    active);
-  gtk_widget_set_sensitive (dialog->modem_page,     active);
-  gtk_widget_set_sensitive (dialog->options_page,   active);
+  gtk_widget_set_sensitive (dialog->connection_onboot,  active);
+  gtk_widget_set_sensitive (dialog->wireless_frame,     active);
+  gtk_widget_set_sensitive (dialog->ethernet_frame,     active);
+  gtk_widget_set_sensitive (dialog->plip_frame,         active);
+  gtk_widget_set_sensitive (dialog->modem_frame,        active);
+  gtk_widget_set_sensitive (dialog->modem_page,         active);
+  gtk_widget_set_sensitive (dialog->options_page,       active);
 }
diff -u gnome-system-tools-2.14.0/src/network/connection.h-orig gnome-system-tools-2.14.0/src/network/connection.h
--- gnome-system-tools-2.14.0/src/network/connection.h-orig	2005-06-13 00:09:38.000000000 +0800
+++ gnome-system-tools-2.14.0/src/network/connection.h	2007-11-14 16:27:55.839753000 +0800
@@ -29,6 +29,7 @@
   GstIface  *iface;
   gboolean   changed;
   gboolean   standalone;
+  gboolean   needsaved;
   GtkWidget *dialog;
 
   /* notebook pages */
@@ -39,6 +40,7 @@
   GtkWidget *options_page;
 
   GtkWidget *connection_configured;
+  GtkWidget *connection_onboot;
   GtkWidget *connection_device;
   GtkWidget *connection_ppp_configured;
   GtkWidget *connection_ppp_device;
diff -u gnome-system-tools-2.14.0/src/network/main.c-orig gnome-system-tools-2.14.0/src/network/main.c
--- gnome-system-tools-2.14.0/src/network/main.c-orig	2005-08-09 03:00:02.000000000 +0800
+++ gnome-system-tools-2.14.0/src/network/main.c	2007-11-14 16:23:54.109341000 +0800
@@ -60,6 +60,7 @@
   { "connection_address",           "focus-out-event", G_CALLBACK (on_ip_address_focus_out) },
   { "connection_ppp_device_active", "toggled", G_CALLBACK (on_dialog_changed) },
   { "connection_device_active",     "toggled", G_CALLBACK (on_dialog_changed) },
+  { "connection_device_onboot",     "toggled", G_CALLBACK (on_dialog_changed) },
   { "connection_essid",             "changed", G_CALLBACK (on_dialog_changed) },
   { "connection_wep_key_type",      "changed", G_CALLBACK (on_dialog_changed) },
   { "connection_wep_key",           "changed", G_CALLBACK (on_dialog_changed) },
diff -u gnome-system-tools-2.14.0/src/network/network-iface.c-orig gnome-system-tools-2.14.0/src/network/network-iface.c
--- gnome-system-tools-2.14.0/src/network/network-iface.c-orig	2005-07-16 03:53:32.000000000 +0800
+++ gnome-system-tools-2.14.0/src/network/network-iface.c	2007-11-14 16:23:54.109793000 +0800
@@ -281,6 +281,7 @@
 {
   gchar      *dev, *file, *hwaddr;
   gboolean    enabled;
+  gboolean    onboot = FALSE;
   xmlNodePtr  configuration;
 
   g_return_if_fail (iface != NULL);
@@ -291,13 +292,16 @@
   hwaddr = gst_xml_get_child_content (node, "hwaddr");
   enabled = gst_xml_element_get_boolean (node, "enabled");
   configuration = gst_xml_element_find_first (node, "configuration");
+  if ( configuration != NULL ) {
+      onboot = gst_xml_element_get_boolean (configuration, "auto");
+  }
 
   g_object_set (G_OBJECT (iface),
 		"iface-dev",        dev,
 		"iface-file",       file,
 		"iface-hwaddr",     hwaddr,
 		"iface-enabled",    enabled,
-		"iface-auto",       enabled,
+		"iface-auto",       onboot,
 		"iface-configured", (configuration != NULL),
 		NULL);
 
diff -up gnome-system-tools-2.14.0/src/network/network-iface-ethernet.c.orig gnome-system-tools-2.14.0/src/network/network-iface-ethernet.c
--- gnome-system-tools-2.14.0/src/network/network-iface-ethernet.c.orig	2009-03-23 16:29:39.705224535 +0000
+++ gnome-system-tools-2.14.0/src/network/network-iface-ethernet.c	2009-03-23 16:31:13.179379795 +0000
@@ -20,10 +20,13 @@
 
 #include <glib.h>
 #include <glib/gi18n.h>
+#include "gst-network-tool.h"
 #include "network-iface-ethernet.h"
 #include "network-iface.h"
 #include "gst.h"
 
+extern GstTool *tool;
+
 struct _GstIfaceEthernetPriv
 {
   gchar     *address;
@@ -347,8 +350,9 @@ gst_iface_ethernet_set_config_from_xml (
 					xmlNodePtr        node)
 {
   xmlNodePtr configuration;
-  gchar *address, *netmask, *gateway, *bootproto;
+  gchar *address, *netmask, *gateway, *bootproto, *addr, *mask;
   GstBootProto proto;
+  GstNetworkTool *network_tool;
 
   g_return_if_fail (iface != NULL);
   g_return_if_fail (node != NULL);
@@ -362,19 +366,34 @@ gst_iface_ethernet_set_config_from_xml (
 
   bootproto = gst_xml_get_child_content (configuration, "bootproto");
 
-  if (strcmp (bootproto, "none") == 0)
+  if ( bootproto && strcmp (bootproto, "none") == 0)
     {
       proto = GST_BOOTPROTO_STATIC;
       address = gst_xml_get_child_content (configuration, "address");
       netmask = gst_xml_get_child_content (configuration, "netmask");
       gateway = gst_xml_get_child_content (configuration, "gateway");
+      addr = gst_xml_get_child_content (node, "addr");
+      mask = gst_xml_get_child_content (node, "mask");
+      if ((addr != NULL && mask != NULL ) &&
+          (address == NULL || netmask == NULL || strcmp (addr, address) != 0 || strcmp (mask, netmask ) != 0))
+        {
+	  network_tool = GST_NETWORK_TOOL (tool);
+	  network_tool->dialog->needsaved = TRUE;
+	  if ( address != NULL )
+	  	g_free (address);
+	  if ( netmask != NULL )
+	 	g_free (netmask);
+	  address = addr;
+	  netmask = mask;
+        }
     }
   else
     {
       proto = GST_BOOTPROTO_DHCP;
-      address = NULL;
-      netmask = NULL;
-      gateway = NULL;
+      /* Get this info anyway, no harm to display it! */
+      address = gst_xml_get_child_content (configuration, "address");
+      netmask = gst_xml_get_child_content (configuration, "netmask");
+      gateway = gst_xml_get_child_content (configuration, "gateway");
     }
 
   g_object_set (G_OBJECT (iface),

diff -u gnome-system-tools-2.14.0/src/network/network-iface-irlan.c-orig gnome-system-tools-2.14.0/src/network/network-iface-irlan.c
--- gnome-system-tools-2.14.0/src/network/network-iface-irlan.c-orig	2005-08-09 03:00:03.000000000 +0800
+++ gnome-system-tools-2.14.0/src/network/network-iface-irlan.c	2007-11-14 16:23:54.110489000 +0800
@@ -25,6 +25,9 @@
 #include "gst.h"
 
 struct _GstIfaceIrlanPriv {
+#ifdef sun
+    int __dummy;
+#endif
 };
 
 static void gst_iface_irlan_class_init (GstIfaceIrlanClass *class);
diff -u gnome-system-tools-2.14.0/src/network/transfer.c-orig gnome-system-tools-2.14.0/src/network/transfer.c
--- gnome-system-tools-2.14.0/src/network/transfer.c-orig	2004-12-22 00:17:15.000000000 +0800
+++ gnome-system-tools-2.14.0/src/network/transfer.c	2007-11-14 16:23:54.110774000 +0800
@@ -101,10 +101,14 @@
   gchar      *gatewaydev = gateways_combo_get_selected ();
   xmlNodePtr  node       = gst_xml_element_find_first (root, "gatewaydev");
 
-  if (!gatewaydev)
-    gst_xml_element_destroy (node);
-  else
+  if (!gatewaydev) {
+    if ( node != NULL ) {
+        gst_xml_element_destroy (node);
+    }
+  }
+  else if ( node != NULL ) {
     gst_xml_element_set_content (node, gatewaydev);
+  }
 
   g_free (gatewaydev);
 }