network-manager-applet r820 - in trunk: . src/connection-editor



Author: dcbw
Date: Tue Aug  5 17:28:47 2008
New Revision: 820
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=820&view=rev

Log:
2008-08-04  Dan Williams  <dcbw redhat com>

	* src/connection-editor/page-ip4.c
	  src/connection-editor/ce-page-ip4.glade
		- De-sensitize all widgets that don't make sense for a given IP4 method
		- Add a 'routes' button
		- Make the examples tooltips rather than widgets



Modified:
   trunk/ChangeLog
   trunk/src/connection-editor/ce-page-ip4.glade
   trunk/src/connection-editor/page-ip4.c

Modified: trunk/src/connection-editor/ce-page-ip4.glade
==============================================================================
--- trunk/src/connection-editor/ce-page-ip4.glade	(original)
+++ trunk/src/connection-editor/ce-page-ip4.glade	Tue Aug  5 17:28:47 2008
@@ -47,7 +47,7 @@
             <property name="visible">True</property>
             <property name="spacing">6</property>
             <child>
-              <widget class="GtkLabel" id="label37">
+              <widget class="GtkLabel" id="ip4_addr_label">
                 <property name="visible">True</property>
                 <property name="xalign">0</property>
                 <property name="label" translatable="yes">&lt;b&gt;Addresses&lt;/b&gt;</property>
@@ -78,6 +78,7 @@
                             <property name="height_request">100</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
+                            <property name="tooltip_text">IP addresses identify your computer on the network.  Click the "Add" button to add an IP address.</property>
                             <property name="rules_hint">True</property>
                           </widget>
                         </child>
@@ -127,6 +128,7 @@
             </child>
           </widget>
           <packing>
+            <property name="expand">False</property>
             <property name="position">1</property>
           </packing>
         </child>
@@ -134,67 +136,56 @@
           <widget class="GtkTable" id="table8">
             <property name="visible">True</property>
             <property name="border_width">6</property>
-            <property name="n_rows">5</property>
+            <property name="n_rows">3</property>
             <property name="n_columns">2</property>
             <property name="column_spacing">6</property>
             <property name="row_spacing">6</property>
             <child>
-              <widget class="GtkEntry" id="dhcp_client_id_entry">
+              <widget class="GtkEntry" id="ip4_dhcp_client_id_entry">
                 <property name="visible">True</property>
                 <property name="can_focus">True</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="top_attach">2</property>
+                <property name="bottom_attach">3</property>
               </packing>
             </child>
             <child>
-              <widget class="GtkLabel" id="dhcp_client_id_label">
+              <widget class="GtkEntry" id="ip4_dns_searches_entry">
                 <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">DHCP Client ID:</property>
+                <property name="can_focus">True</property>
+                <property name="tooltip_text">Example: lab.gnome.org, gnome.org</property>
               </widget>
               <packing>
-                <property name="top_attach">4</property>
-                <property name="bottom_attach">5</property>
-                <property name="x_options">GTK_FILL</property>
+                <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="y_options"></property>
               </packing>
             </child>
             <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <widget class="GtkLabel" id="label44">
+              <widget class="GtkLabel" id="ip4_dhcp_client_id_label">
                 <property name="visible">True</property>
                 <property name="xalign">0</property>
-                <property name="label" translatable="yes">&lt;span style="italic"&gt;Example: lab.gnome.org, gnome.org&lt;/span&gt;</property>
-                <property name="use_markup">True</property>
+                <property name="label" translatable="yes">DHCP Client ID:</property>
               </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="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="GtkLabel" id="ip4_dns_servers_label">
+              <widget class="GtkLabel" id="ip4_dns_searches_label">
                 <property name="visible">True</property>
                 <property name="xalign">0</property>
-                <property name="label" translatable="yes">&lt;span style="italic"&gt;Example: 10.10.10.1, 10.10.10.2&lt;/span&gt;</property>
-                <property name="use_markup">True</property>
+                <property name="label" translatable="yes">Search Domains:</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>
@@ -202,27 +193,12 @@
               </packing>
             </child>
             <child>
-              <widget class="GtkEntry" id="ip4_dns_searches_entry">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-              </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="y_options"></property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkLabel" id="label40">
+              <widget class="GtkLabel" id="ip4_dns_servers_label">
                 <property name="visible">True</property>
                 <property name="xalign">0</property>
-                <property name="label" translatable="yes">Search Domains:</property>
+                <property name="label" translatable="yes">DNS Servers:</property>
               </widget>
               <packing>
-                <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>
@@ -231,6 +207,7 @@
               <widget class="GtkEntry" id="ip4_dns_servers_entry">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <property name="tooltip_text">Example: 10.0.0.1, 10.0.0.2</property>
               </widget>
               <packing>
                 <property name="left_attach">1</property>
@@ -238,21 +215,69 @@
                 <property name="y_options"></property>
               </packing>
             </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkHBox" id="hbox3">
+            <property name="visible">True</property>
             <child>
-              <widget class="GtkLabel" id="label39">
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <widget class="GtkButton" id="ip4_routes_button">
                 <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">DNS Servers:</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="response_id">0</property>
+                <child>
+                  <widget class="GtkHBox" id="hbox4">
+                    <property name="visible">True</property>
+                    <property name="spacing">3</property>
+                    <child>
+                      <widget class="GtkImage" id="image1">
+                        <property name="visible">True</property>
+                        <property name="stock">gtk-preferences</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label1">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Routes...</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </widget>
+                </child>
               </widget>
               <packing>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options"></property>
+                <property name="expand">False</property>
+                <property name="padding">6</property>
+                <property name="pack_type">GTK_PACK_END</property>
+                <property name="position">3</property>
               </packing>
             </child>
           </widget>
           <packing>
             <property name="expand">False</property>
-            <property name="position">2</property>
+            <property name="pack_type">GTK_PACK_END</property>
+            <property name="position">3</property>
           </packing>
         </child>
       </widget>

Modified: trunk/src/connection-editor/page-ip4.c
==============================================================================
--- trunk/src/connection-editor/page-ip4.c	(original)
+++ trunk/src/connection-editor/page-ip4.c	Tue Aug  5 17:28:47 2008
@@ -47,19 +47,24 @@
 	GtkListStore *method_store;
 
 	/* Addresses */
+	GtkWidget *addr_label;
 	GtkButton *addr_add;
 	GtkButton *addr_delete;
 	GtkTreeView *addr_list;
 
 	/* DNS servers */
+	GtkWidget *dns_servers_label;
 	GtkEntry *dns_servers;
 
 	/* Search domains */
+	GtkWidget *dns_searches_label;
 	GtkEntry *dns_searches;
 
 	/* DHCP stuff */
 	GtkWidget *dhcp_client_id_label;
-	GtkEntry *dhcp_client_id_entry;
+	GtkEntry *dhcp_client_id;
+
+	GtkButton *routes_button;
 
 	gboolean disposed;
 } CEPageIP4Private;
@@ -125,15 +130,21 @@
 
 	gtk_combo_box_set_model (priv->method, GTK_TREE_MODEL (priv->method_store));
 
+	priv->addr_label = glade_xml_get_widget (xml, "ip4_addr_label");
 	priv->addr_add = GTK_BUTTON (glade_xml_get_widget (xml, "ip4_addr_add_button"));
 	priv->addr_delete = GTK_BUTTON (glade_xml_get_widget (xml, "ip4_addr_delete_button"));
 	priv->addr_list = GTK_TREE_VIEW (glade_xml_get_widget (xml, "ip4_addresses"));
 
+	priv->dns_servers_label = glade_xml_get_widget (xml, "ip4_dns_servers_label");
 	priv->dns_servers = GTK_ENTRY (glade_xml_get_widget (xml, "ip4_dns_servers_entry"));
+
+	priv->dns_searches_label = glade_xml_get_widget (xml, "ip4_dns_searches_label");
 	priv->dns_searches = GTK_ENTRY (glade_xml_get_widget (xml, "ip4_dns_searches_entry"));
 
-	priv->dhcp_client_id_label = GTK_WIDGET (glade_xml_get_widget (xml, "dhcp_client_id_label"));
-	priv->dhcp_client_id_entry = GTK_ENTRY (glade_xml_get_widget (xml, "dhcp_client_id_entry"));
+	priv->dhcp_client_id_label = glade_xml_get_widget (xml, "ip4_dhcp_client_id_label");
+	priv->dhcp_client_id = GTK_ENTRY (glade_xml_get_widget (xml, "ip4_dhcp_client_id_entry"));
+
+	priv->routes_button = GTK_BUTTON (glade_xml_get_widget (xml, "ip4_routes_button"));
 }
 
 static void
@@ -143,6 +154,8 @@
 	guint32 method = IP4_METHOD_AUTO;
 	gboolean addr_enabled = FALSE;
 	gboolean dns_enabled = FALSE;
+	gboolean dhcp_enabled = FALSE;
+	gboolean routes_enabled = FALSE;
 	GtkTreeIter iter;
 
 	if (gtk_combo_box_get_active_iter (priv->method, &iter)) {
@@ -151,17 +164,21 @@
 	}
 
 	switch (method) {
+	case IP4_METHOD_AUTO:
+		dhcp_enabled = routes_enabled = TRUE;
+		break;
 	case IP4_METHOD_AUTO_MANUAL_DNS:
 		addr_enabled = FALSE;
-		dns_enabled = TRUE;
+		dns_enabled = dhcp_enabled = routes_enabled = TRUE;
 		break;
 	case IP4_METHOD_MANUAL:
-		addr_enabled = dns_enabled = TRUE;
+		addr_enabled = dns_enabled = routes_enabled = TRUE;
 		break;
 	default:
 		break;
 	}
 
+	gtk_widget_set_sensitive (priv->addr_label, addr_enabled);
 	gtk_widget_set_sensitive (GTK_WIDGET (priv->addr_add), addr_enabled);
 	gtk_widget_set_sensitive (GTK_WIDGET (priv->addr_delete), addr_enabled);
 	gtk_widget_set_sensitive (GTK_WIDGET (priv->addr_list), addr_enabled);
@@ -172,21 +189,22 @@
 		gtk_list_store_clear (store);
 	}
 
+	gtk_widget_set_sensitive (priv->dns_servers_label, dns_enabled);
 	gtk_widget_set_sensitive (GTK_WIDGET (priv->dns_servers), dns_enabled);
 	if (!dns_enabled)
 		gtk_entry_set_text (priv->dns_servers, "");
 
+	gtk_widget_set_sensitive (priv->dns_searches_label, dns_enabled);
 	gtk_widget_set_sensitive (GTK_WIDGET (priv->dns_searches), dns_enabled);
 	if (!dns_enabled)
 		gtk_entry_set_text (priv->dns_searches, "");
 
-	if ((method == IP4_METHOD_AUTO) || (method == IP4_METHOD_AUTO_MANUAL_DNS)) {
-		gtk_widget_show (priv->dhcp_client_id_label);
-		gtk_widget_show (GTK_WIDGET (priv->dhcp_client_id_entry));
-	} else {
-		gtk_widget_hide (priv->dhcp_client_id_label);
-		gtk_widget_hide (GTK_WIDGET (priv->dhcp_client_id_entry));
-	}
+	gtk_widget_set_sensitive (priv->dhcp_client_id_label, dhcp_enabled);
+	gtk_widget_set_sensitive (GTK_WIDGET (priv->dhcp_client_id), dhcp_enabled);
+	if (!dhcp_enabled)
+		gtk_entry_set_text (priv->dhcp_client_id, "");
+
+	gtk_widget_set_sensitive (GTK_WIDGET (priv->routes_button), routes_enabled);
 
 	ce_page_changed (CE_PAGE (user_data));
 }
@@ -305,7 +323,7 @@
 
 	if ((method == IP4_METHOD_AUTO) || (method = IP4_METHOD_AUTO_MANUAL_DNS)) {
 		if (setting->dhcp_client_id)
-			gtk_entry_set_text (priv->dhcp_client_id_entry, setting->dhcp_client_id);
+			gtk_entry_set_text (priv->dhcp_client_id, setting->dhcp_client_id);
 	}
 }
 
@@ -564,7 +582,7 @@
 	method_changed (priv->method, self);
 	g_signal_connect (priv->method, "changed", G_CALLBACK (method_changed), self);
 
-	g_signal_connect_swapped (priv->dhcp_client_id_entry, "changed", G_CALLBACK (ce_page_changed), self);
+	g_signal_connect_swapped (priv->dhcp_client_id, "changed", G_CALLBACK (ce_page_changed), self);
 
 	return self;
 }
@@ -717,7 +735,7 @@
 
 	/* DHCP client ID */
 	if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
-		dhcp_client_id = gtk_entry_get_text (priv->dhcp_client_id_entry);
+		dhcp_client_id = gtk_entry_get_text (priv->dhcp_client_id);
 		if (dhcp_client_id && !strlen (dhcp_client_id))
 			dhcp_client_id = NULL;
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]