network-manager-applet r666 - in trunk: . src/connection-editor src/gconf-helpers



Author: tambeti
Date: Mon Apr 14 17:23:53 2008
New Revision: 666
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=666&view=rev

Log:
    2008-04-14  Tambet Ingo  <tambet gmail com>

    	* src/connection-editor/ce-page-mobile.glade: Implement.

    	* src/connection-editor/page-mobile.[ch]: Implement.

    	* src/connection-editor/nm-connection-editor.c
    	(nm_connection_editor_set_connection): Handle GSM and CDMA settings.

    	* src/connection-editor/Makefile.am: Add new files to build.

    	* src/gconf-helpers/gconf-helpers.c (nm_gconf_set_string_helper):
    	Allow NULL value, in that case, unset the GConf value. Otherwise,
    	it was not possible to reset string values which already had non-null
    	value.
    	(copy_one_setting_value_to_gconf): Write string to gconf even if it's
    	null to make sure it doesn't have a previous value.
    	(write_one_private_string_value): No need to check for null here,
    	string helper already does that.


Added:
   trunk/src/connection-editor/ce-page-mobile.glade
   trunk/src/connection-editor/page-mobile.c
   trunk/src/connection-editor/page-mobile.h
Modified:
   trunk/ChangeLog
   trunk/src/connection-editor/Makefile.am
   trunk/src/connection-editor/nm-connection-editor.c
   trunk/src/gconf-helpers/gconf-helpers.c

Modified: trunk/src/connection-editor/Makefile.am
==============================================================================
--- trunk/src/connection-editor/Makefile.am	(original)
+++ trunk/src/connection-editor/Makefile.am	Mon Apr 14 17:23:53 2008
@@ -37,7 +37,9 @@
 	page-ip4-address.h \
 	page-ip4-address.c \
 	page-dsl.h \
-	page-dsl.c
+	page-dsl.c \
+	page-mobile.h \
+	page-mobile.c
 
 nm_connection_editor_LDADD = \
 	$(top_builddir)/src/gconf-helpers/libgconf-helpers.la \
@@ -53,7 +55,8 @@
 	ce-page-wireless-security.glade \
 	ce-page-ip4.glade \
 	ce-page-ip4-address.glade \
-	ce-page-dsl.glade
+	ce-page-dsl.glade \
+	ce-page-mobile.glade
 
 CLEANFILES = *.bak *.gladep
 

Added: trunk/src/connection-editor/ce-page-mobile.glade
==============================================================================
--- (empty file)
+++ trunk/src/connection-editor/ce-page-mobile.glade	Mon Apr 14 17:23:53 2008
@@ -0,0 +1,631 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>
+
+<glade-interface>
+
+<widget class="GtkWindow" id="mobile_page_widget">
+  <property name="title" translatable="yes">window1</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
+
+  <child>
+    <widget class="GtkVBox" id="MobilePage">
+      <property name="border_width">6</property>
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">6</property>
+
+      <child>
+	<widget class="GtkVBox" id="mobile_basic_vbox">
+	  <property name="visible">True</property>
+	  <property name="homogeneous">False</property>
+	  <property name="spacing">6</property>
+
+	  <child>
+	    <widget class="GtkLabel" id="mobile_basic_label">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">&lt;b&gt;Basic&lt;/b&gt;</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="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</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="GtkTable" id="table1">
+		  <property name="visible">True</property>
+		  <property name="n_rows">3</property>
+		  <property name="n_columns">2</property>
+		  <property name="homogeneous">False</property>
+		  <property name="row_spacing">6</property>
+		  <property name="column_spacing">6</property>
+
+		  <child>
+		    <widget class="GtkLabel" id="label28">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Number:</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="left_attach">0</property>
+		      <property name="right_attach">1</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="GtkLabel" id="label24">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Username:</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">mobile_username</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">1</property>
+		      <property name="bottom_attach">2</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label25">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Password:</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">mobile_password</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">2</property>
+		      <property name="bottom_attach">3</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkEntry" id="mobile_number">
+		      <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="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkEntry" id="mobile_username">
+		      <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">1</property>
+		      <property name="bottom_attach">2</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkEntry" id="mobile_password">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="editable">True</property>
+		      <property name="visibility">False</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">2</property>
+		      <property name="bottom_attach">3</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+		</widget>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">True</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">True</property>
+	  <property name="fill">True</property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkVBox" id="mobile_advanced_vbox">
+	  <property name="visible">True</property>
+	  <property name="homogeneous">False</property>
+	  <property name="spacing">6</property>
+
+	  <child>
+	    <widget class="GtkLabel" id="mobile_advanced_label">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">&lt;b&gt;Advanced&lt;/b&gt;</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="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</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="GtkTable" id="table2">
+		  <property name="visible">True</property>
+		  <property name="n_rows">6</property>
+		  <property name="n_columns">2</property>
+		  <property name="homogeneous">False</property>
+		  <property name="row_spacing">6</property>
+		  <property name="column_spacing">6</property>
+
+		  <child>
+		    <widget class="GtkLabel" id="label29">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">APN:</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="left_attach">0</property>
+		      <property name="right_attach">1</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="GtkEntry" id="mobile_apn">
+		      <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="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label30">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Network:</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="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">1</property>
+		      <property name="bottom_attach">2</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkEntry" id="mobile_network_id">
+		      <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">1</property>
+		      <property name="bottom_attach">2</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label31">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Type:</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="left_attach">0</property>
+		      <property name="right_attach">1</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>
+
+		  <child>
+		    <widget class="GtkComboBox" id="mobile_network_type">
+		      <property name="visible">True</property>
+		      <property name="items" translatable="yes">Any
+GPRS
+GSM
+Prefer GPRS
+Prefer GSM</property>
+		      <property name="add_tearoffs">False</property>
+		      <property name="focus_on_click">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="x_options">fill</property>
+		      <property name="y_options">fill</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label32">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Band:</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="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">3</property>
+		      <property name="bottom_attach">4</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkComboBox" id="mobile_band">
+		      <property name="visible">True</property>
+		      <property name="add_tearoffs">False</property>
+		      <property name="focus_on_click">True</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="x_options">fill</property>
+		      <property name="y_options">fill</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label33">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">PIN:</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="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">4</property>
+		      <property name="bottom_attach">5</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkEntry" id="mobile_pin">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="editable">True</property>
+		      <property name="visibility">False</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="label34">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">PUK:</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="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="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkEntry" id="mobile_puk">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="editable">True</property>
+		      <property name="visibility">False</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">5</property>
+		      <property name="bottom_attach">6</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+		</widget>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">True</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">True</property>
+	  <property name="fill">True</property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkHBox" id="hbox1">
+	  <property name="visible">True</property>
+	  <property name="homogeneous">False</property>
+	  <property name="spacing">0</property>
+
+	  <child>
+	    <widget class="GtkCheckButton" id="mobile_show_passwords">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label" translatable="yes">Show passwords</property>
+	      <property name="use_underline">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="active">False</property>
+	      <property name="inconsistent">False</property>
+	      <property name="draw_indicator">True</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
+	      <property name="pack_type">GTK_PACK_END</property>
+	    </packing>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">False</property>
+	  <property name="fill">False</property>
+	</packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+</glade-interface>

Modified: trunk/src/connection-editor/nm-connection-editor.c
==============================================================================
--- trunk/src/connection-editor/nm-connection-editor.c	(original)
+++ trunk/src/connection-editor/nm-connection-editor.c	Mon Apr 14 17:23:53 2008
@@ -40,6 +40,8 @@
 #include <nm-setting-wireless-security.h>
 #include <nm-setting-vpn.h>
 #include <nm-setting-pppoe.h>
+#include <nm-setting-gsm.h>
+#include <nm-setting-cdma.h>
 #include <nm-utils.h>
 
 #include "nm-connection-editor.h"
@@ -53,6 +55,7 @@
 #include "page-ip4.h"
 #include "page-ip4-address.h"
 #include "page-dsl.h"
+#include "page-mobile.h"
 
 G_DEFINE_TYPE (NMConnectionEditor, nm_connection_editor, G_TYPE_OBJECT)
 
@@ -392,6 +395,9 @@
 		add_page (editor, CE_PAGE (ce_page_ip4_new (editor->connection)));
 	} else if (!strcmp (s_con->type, NM_SETTING_PPPOE_SETTING_NAME)) {
 		add_page (editor, CE_PAGE (ce_page_dsl_new (editor->connection)));
+	} else if (!strcmp (s_con->type, NM_SETTING_GSM_SETTING_NAME) || 
+			 !strcmp (s_con->type, NM_SETTING_CDMA_SETTING_NAME)) {
+		add_page (editor, CE_PAGE (ce_page_mobile_new (editor->connection)));
 	} else {
 		g_warning ("Unhandled setting type '%s'", s_con->type);
 	}

Added: trunk/src/connection-editor/page-mobile.c
==============================================================================
--- (empty file)
+++ trunk/src/connection-editor/page-mobile.c	Mon Apr 14 17:23:53 2008
@@ -0,0 +1,379 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager Connection editor -- Connection editor for NetworkManager
+ *
+ * Dan Williams <dcbw redhat com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * (C) Copyright 2008 Red Hat, Inc.
+ */
+
+#include <string.h>
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include <nm-setting-connection.h>
+#include <nm-setting-gsm.h>
+#include <nm-setting-cdma.h>
+
+#include "page-mobile.h"
+#include "nm-connection-editor.h"
+
+G_DEFINE_TYPE (CEPageMobile, ce_page_mobile, CE_TYPE_PAGE)
+
+#define CE_PAGE_MOBILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CE_TYPE_PAGE_MOBILE, CEPageMobilePrivate))
+
+typedef struct {
+	NMSetting *setting;
+
+	/* Common to GSM and CDMA */
+	GtkEntry *number;
+	GtkEntry *username;
+	GtkEntry *password;
+
+	/* GSM only */
+	GtkEntry *apn;
+	GtkEntry *network_id;
+	GtkComboBox *network_type;
+	GtkComboBox *band;
+	GtkEntry *pin;
+	GtkEntry *puk;
+
+	gboolean disposed;
+} CEPageMobilePrivate;
+
+#define NET_TYPE_ANY         0
+#define NET_TYPE_GPRS        1
+#define NET_TYPE_GSM         2
+#define NET_TYPE_PREFER_GPRS 3
+#define NET_TYPE_PREFER_GSM  4
+
+static void
+mobile_private_init (CEPageMobile *self)
+{
+	CEPageMobilePrivate *priv = CE_PAGE_MOBILE_GET_PRIVATE (self);
+	GladeXML *xml;
+
+	xml = CE_PAGE (self)->xml;
+
+	priv->number = GTK_ENTRY (glade_xml_get_widget (xml, "mobile_number"));
+	priv->username = GTK_ENTRY (glade_xml_get_widget (xml, "mobile_username"));
+	priv->password = GTK_ENTRY (glade_xml_get_widget (xml, "mobile_password"));
+
+	priv->apn = GTK_ENTRY (glade_xml_get_widget (xml, "mobile_apn"));
+	priv->network_id = GTK_ENTRY (glade_xml_get_widget (xml, "mobile_network_id"));
+	priv->network_type = GTK_COMBO_BOX (glade_xml_get_widget (xml, "mobile_network_type"));
+	priv->band = GTK_COMBO_BOX (glade_xml_get_widget (xml, "mobile_band"));
+
+	priv->pin = GTK_ENTRY (glade_xml_get_widget (xml, "mobile_pin"));
+	priv->puk = GTK_ENTRY (glade_xml_get_widget (xml, "mobile_puk"));
+}
+
+static void
+populate_gsm_ui (CEPageMobile *self)
+{
+	CEPageMobilePrivate *priv = CE_PAGE_MOBILE_GET_PRIVATE (self);
+	NMSettingGsm *setting = NM_SETTING_GSM (priv->setting);
+	int type_idx;
+
+	if (setting->number)
+		gtk_entry_set_text (priv->number, setting->number);
+
+	if (setting->username)
+		gtk_entry_set_text (priv->username, setting->username);
+
+	if (setting->password)
+		gtk_entry_set_text (priv->password, setting->password);
+
+	if (setting->apn)
+		gtk_entry_set_text (priv->apn, setting->apn);
+
+	if (setting->network_id)
+		gtk_entry_set_text (priv->network_id, setting->network_id);
+
+	switch (setting->network_type) {
+	case NM_GSM_NETWORK_GPRS:
+		type_idx = NET_TYPE_GPRS;
+		break;
+	case NM_GSM_NETWORK_GSM:
+		type_idx = NET_TYPE_GSM;
+		break;
+	case NM_GSM_NETWORK_PREFER_GPRS:
+		type_idx = NET_TYPE_PREFER_GPRS;
+		break;
+	case NM_GSM_NETWORK_PREFER_GSM:
+		type_idx = NET_TYPE_PREFER_GSM;
+		break;
+	case NM_GSM_NETWORK_ANY:
+	default:
+		type_idx = NET_TYPE_ANY;
+		break;
+	}
+	gtk_combo_box_set_active (priv->network_type, type_idx);
+
+	/* FIXME:  band */
+
+	if (setting->pin)
+		gtk_entry_set_text (priv->pin, setting->pin);
+
+	if (setting->puk)
+		gtk_entry_set_text (priv->pin, setting->puk);
+}
+
+static void
+populate_cdma_ui (CEPageMobile *self)
+{
+	CEPageMobilePrivate *priv = CE_PAGE_MOBILE_GET_PRIVATE (self);
+	NMSettingCdma *setting = NM_SETTING_CDMA (priv->setting);
+
+	if (setting->number)
+		gtk_entry_set_text (priv->number, setting->number);
+
+	if (setting->username)
+		gtk_entry_set_text (priv->username, setting->username);
+
+	if (setting->password)
+		gtk_entry_set_text (priv->password, setting->password);
+
+	/* Hide GSM specific widgets */
+	gtk_widget_hide (glade_xml_get_widget (CE_PAGE (self)->xml, "mobile_basic_label"));
+	gtk_widget_hide (glade_xml_get_widget (CE_PAGE (self)->xml, "mobile_advanced_vbox"));
+}
+
+static void
+populate_ui (CEPageMobile *self)
+{
+	CEPageMobilePrivate *priv = CE_PAGE_MOBILE_GET_PRIVATE (self);
+
+	if (NM_IS_SETTING_GSM (priv->setting))
+		populate_gsm_ui (self);
+	else if (NM_IS_SETTING_CDMA (priv->setting))
+		populate_cdma_ui (self);
+	else
+		g_error ("Invalid setting");
+}
+
+static void
+stuff_changed (GtkWidget *w, gpointer user_data)
+{
+	ce_page_changed (CE_PAGE (user_data));
+}
+
+static void
+show_passwords (GtkToggleButton *button, gpointer user_data)
+{
+	CEPageMobilePrivate *priv = CE_PAGE_MOBILE_GET_PRIVATE (user_data);
+	gboolean active;
+
+	active = gtk_toggle_button_get_active (button);
+
+	gtk_entry_set_visibility (priv->password, active);
+	gtk_entry_set_visibility (priv->pin, active);
+	gtk_entry_set_visibility (priv->puk, active);
+}
+
+CEPageMobile *
+ce_page_mobile_new (NMConnection *connection)
+{
+	CEPageMobile *self;
+	CEPageMobilePrivate *priv;
+	CEPage *parent;
+	NMSetting *setting;
+	GHashTable *hash;
+
+	self = CE_PAGE_MOBILE (g_object_new (CE_TYPE_PAGE_MOBILE, NULL));
+	parent = CE_PAGE (self);
+
+	parent->xml = glade_xml_new (GLADEDIR "/ce-page-mobile.glade", "MobilePage", NULL);
+	if (!parent->xml) {
+		g_warning ("%s: Couldn't load mobile page glade file.", __func__);
+		g_object_unref (self);
+		return NULL;
+	}
+
+	parent->page = glade_xml_get_widget (parent->xml, "MobilePage");
+	if (!parent->page) {
+		g_warning ("%s: Couldn't load mobile page from glade file.", __func__);
+		g_object_unref (self);
+		return NULL;
+	}
+	g_object_ref_sink (parent->page);
+
+	parent->title = g_strdup (_("Mobile Broadband"));
+
+	mobile_private_init (self);
+	priv = CE_PAGE_MOBILE_GET_PRIVATE (self);
+
+	setting = nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM);
+	if (!setting)
+		setting = nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA);
+
+	if (!setting) {
+		/* FIXME: Support add. */
+		g_warning ("Adding mobile conneciton not supported yet.");
+		g_object_unref (self);
+		return NULL;
+	}
+
+	hash = nm_setting_to_hash (setting);
+	priv->setting = nm_setting_from_hash (G_OBJECT_TYPE (setting), hash);
+	g_hash_table_destroy (hash);
+
+	populate_ui (self);
+
+	g_signal_connect (priv->number, "changed", G_CALLBACK (stuff_changed), self);
+	g_signal_connect (priv->username, "changed", G_CALLBACK (stuff_changed), self);
+	g_signal_connect (priv->password, "changed", G_CALLBACK (stuff_changed), self);
+	g_signal_connect (priv->apn, "changed", G_CALLBACK (stuff_changed), self);
+	g_signal_connect (priv->network_id, "changed", G_CALLBACK (stuff_changed), self);
+	g_signal_connect (priv->network_type, "changed", G_CALLBACK (stuff_changed), self);
+	g_signal_connect (priv->pin, "changed", G_CALLBACK (stuff_changed), self);
+	g_signal_connect (priv->puk, "changed", G_CALLBACK (stuff_changed), self);
+
+	g_signal_connect (glade_xml_get_widget (parent->xml, "mobile_show_passwords"),
+					  "toggled", G_CALLBACK (show_passwords), self);
+
+	return self;
+}
+
+static const char *
+nm_entry_get_text (GtkEntry *entry)
+{
+	const char *txt;
+
+	txt = gtk_entry_get_text (entry);
+	if (txt && strlen (txt) > 0)
+		return txt;
+
+	return NULL;
+}
+
+static void
+gsm_ui_to_setting (CEPageMobile *self)
+{
+	CEPageMobilePrivate *priv = CE_PAGE_MOBILE_GET_PRIVATE (self);
+	int net_type;
+
+	switch (gtk_combo_box_get_active (priv->network_type)) {
+	case NET_TYPE_GPRS:
+		net_type = NM_GSM_NETWORK_GPRS;
+		break;
+	case NET_TYPE_GSM:
+		net_type = NM_GSM_NETWORK_GSM;
+		break;
+	case NET_TYPE_PREFER_GPRS:
+		net_type = NM_GSM_NETWORK_PREFER_GPRS;
+		break;
+	case NET_TYPE_PREFER_GSM:
+		net_type = NM_GSM_NETWORK_PREFER_GSM;
+		break;
+	case NET_TYPE_ANY:
+	default:
+		net_type = NM_GSM_NETWORK_ANY;
+		break;
+	}
+
+	g_object_set (priv->setting,
+				  NM_SETTING_GSM_NUMBER,   nm_entry_get_text (priv->number),
+				  NM_SETTING_GSM_USERNAME, nm_entry_get_text (priv->username),
+				  NM_SETTING_GSM_PASSWORD, nm_entry_get_text (priv->password),
+				  NM_SETTING_GSM_APN, nm_entry_get_text (priv->apn),
+				  NM_SETTING_GSM_NETWORK_ID, nm_entry_get_text (priv->network_id),
+				  NM_SETTING_GSM_NETWORK_TYPE, net_type,
+				  NM_SETTING_GSM_PIN, nm_entry_get_text (priv->pin),
+				  NM_SETTING_GSM_PUK, nm_entry_get_text (priv->puk),
+				  NULL);
+}
+
+static void
+cdma_ui_to_setting (CEPageMobile *self)
+{
+	CEPageMobilePrivate *priv = CE_PAGE_MOBILE_GET_PRIVATE (self);
+
+	g_object_set (priv->setting,
+				  NM_SETTING_CDMA_NUMBER,   nm_entry_get_text (priv->number),
+				  NM_SETTING_CDMA_USERNAME, nm_entry_get_text (priv->username),
+				  NM_SETTING_CDMA_PASSWORD, nm_entry_get_text (priv->password),
+				  NULL);
+}
+
+static void
+ui_to_setting (CEPageMobile *self)
+{
+	CEPageMobilePrivate *priv = CE_PAGE_MOBILE_GET_PRIVATE (self);
+
+	if (NM_IS_SETTING_GSM (priv->setting))
+		gsm_ui_to_setting (self);
+	else if (NM_IS_SETTING_CDMA (priv->setting))
+		cdma_ui_to_setting (self);
+	else
+		g_error ("Invalid setting");
+}
+
+static gboolean
+validate (CEPage *page)
+{
+	CEPageMobile *self = CE_PAGE_MOBILE (page);
+	CEPageMobilePrivate *priv = CE_PAGE_MOBILE_GET_PRIVATE (self);
+
+	ui_to_setting (self);
+	return nm_setting_verify (priv->setting, NULL);
+}
+
+static void
+update_connection (CEPage *page, NMConnection *connection)
+{
+	CEPageMobile *self = CE_PAGE_MOBILE (page);
+	CEPageMobilePrivate *priv = CE_PAGE_MOBILE_GET_PRIVATE (self);
+
+	ui_to_setting (self);
+	g_object_ref (priv->setting); /* Add setting steals the reference. */
+	nm_connection_add_setting (connection, priv->setting);
+}
+
+static void
+ce_page_mobile_init (CEPageMobile *self)
+{
+}
+
+static void
+dispose (GObject *object)
+{
+	CEPageMobilePrivate *priv = CE_PAGE_MOBILE_GET_PRIVATE (object);
+
+	if (priv->disposed)
+		return;
+
+	priv->disposed = TRUE;
+	g_object_unref (priv->setting);
+
+	G_OBJECT_CLASS (ce_page_mobile_parent_class)->dispose (object);
+}
+
+static void
+ce_page_mobile_class_init (CEPageMobileClass *mobile_class)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (mobile_class);
+	CEPageClass *parent_class = CE_PAGE_CLASS (mobile_class);
+
+	g_type_class_add_private (object_class, sizeof (CEPageMobilePrivate));
+
+	/* virtual methods */
+	object_class->dispose = dispose;
+
+	parent_class->validate = validate;
+	parent_class->update_connection = update_connection;
+}

Added: trunk/src/connection-editor/page-mobile.h
==============================================================================
--- (empty file)
+++ trunk/src/connection-editor/page-mobile.h	Mon Apr 14 17:23:53 2008
@@ -0,0 +1,52 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager Connection editor -- Connection editor for NetworkManager
+ *
+ * Dan Williams <dcbw redhat com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * (C) Copyright 2008 Red Hat, Inc.
+ */
+
+#ifndef __PAGE_MOBILE_H__
+#define __PAGE_MOBILE_H__
+
+#include <nm-connection.h>
+
+#include <glib/gtypes.h>
+#include <glib-object.h>
+
+#include "ce-page.h"
+
+#define CE_TYPE_PAGE_MOBILE            (ce_page_mobile_get_type ())
+#define CE_PAGE_MOBILE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), CE_TYPE_PAGE_MOBILE, CEPageMobile))
+#define CE_PAGE_MOBILE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), CE_TYPE_PAGE_MOBILE, CEPageMobileClass))
+#define CE_IS_PAGE_MOBILE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CE_TYPE_PAGE_MOBILE))
+#define CE_IS_PAGE_MOBILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), CE_TYPE_PAGE_MOBILE))
+#define CE_PAGE_MOBILE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), CE_TYPE_PAGE_MOBILE, CEPageMobileClass))
+
+typedef struct {
+	CEPage parent;
+} CEPageMobile;
+
+typedef struct {
+	CEPageClass parent;
+} CEPageMobileClass;
+
+GType ce_page_mobile_get_type (void);
+
+CEPageMobile *ce_page_mobile_new (NMConnection *connection);
+
+#endif  /* __PAGE_MOBILE_H__ */

Modified: trunk/src/gconf-helpers/gconf-helpers.c
==============================================================================
--- trunk/src/gconf-helpers/gconf-helpers.c	(original)
+++ trunk/src/gconf-helpers/gconf-helpers.c	Mon Apr 14 17:23:53 2008
@@ -452,14 +452,18 @@
 
 	g_return_val_if_fail (key != NULL, FALSE);
 	g_return_val_if_fail (network != NULL, FALSE);
-	g_return_val_if_fail (value != NULL, FALSE);
 
 	gc_key = g_strdup_printf ("%s/%s/%s", path, network, key);
 	if (!gc_key) {
 		g_warning ("Not enough memory to create gconf path");
 		return FALSE;
 	}
-	gconf_client_set_string (client, gc_key, value, NULL);
+
+	if (value)
+		gconf_client_set_string (client, gc_key, value, NULL);
+	else
+		gconf_client_unset (client, gc_key, NULL);
+
 	g_free (gc_key);
 	return TRUE;
 }
@@ -952,18 +956,16 @@
 
 	if (type == G_TYPE_STRING) {
 		const char *str_val = g_value_get_string (value);
-		if (str_val) {
-			if (secret) {
-				if (strlen (str_val)) {
-					nm_gconf_add_keyring_item (info->connection_id,
-					                           info->connection_name,
-					                           setting->name,
-					                           key,
-					                           str_val);
-				}
-			} else
-				nm_gconf_set_string_helper (info->client, info->dir, key, setting->name, str_val);
-		}
+
+		if (secret) {
+			if (str_val && strlen (str_val))
+				nm_gconf_add_keyring_item (info->connection_id,
+									  info->connection_name,
+									  setting->name,
+									  key,
+									  str_val);
+		} else
+			nm_gconf_set_string_helper (info->client, info->dir, key, setting->name, str_val);
 	} else if (type == G_TYPE_UINT) {
 		nm_gconf_set_int_helper (info->client, info->dir,
 							key, setting->name,
@@ -1038,17 +1040,9 @@
 	g_return_if_fail (tag != NULL);
 
 	value = g_object_get_data (G_OBJECT (info->connection), tag);
-	if (value) {
-		nm_gconf_set_string_helper (info->client, info->dir, tag,
-		                            NM_SETTING_802_1X_SETTING_NAME,
-		                            value);
-	} else {
-		char *key;
-
-		key = g_strdup_printf ("%s/%s/%s", info->dir, NM_SETTING_802_1X_SETTING_NAME, tag);
-		gconf_client_unset (info->client, key, NULL);
-		g_free (key);
-	}
+	nm_gconf_set_string_helper (info->client, info->dir, tag,
+						   NM_SETTING_802_1X_SETTING_NAME,
+						   value);
 }
 
 static void



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