Commit 291f1f12 authored by Tambet Ingo's avatar Tambet Ingo Committed by Tambet Ingo
Browse files

src/connection-editor/ce-page.c src/connection-editor/ce-page.h

2008-06-20  Tambet Ingo  <tambet@gmail.com>

	* src/connection-editor/ce-page.c
	src/connection-editor/ce-page.h
	src/connection-editor/nm-connection-editor.c
	src/connection-editor/nm-connection-editor.h
	src/connection-editor/nm-connection-list.c
	src/connection-editor/page-dsl.c
	src/connection-editor/page-ip4.c
	src/connection-editor/page-mobile.c
	src/connection-editor/page-ppp.c
	src/connection-editor/page-vpn.c
	src/connection-editor/page-wired-security.c
	src/connection-editor/page-wired.c
	src/connection-editor/page-wireless-security.c
	src/connection-editor/page-wireless-security.h
	src/connection-editor/page-wireless.c

	Use a copy of the real connection in the connection editor. Fixes issues
	where the connection is updated but writing it fails for some reason.
	Keep the connection that's been edited updated after every UI change so
	that pages can act on changes to other pages.

svn path=/trunk/; revision=760
parent e1a21dbb
2008-06-20 Tambet Ingo <tambet@gmail.com>
* src/connection-editor/ce-page.c
src/connection-editor/ce-page.h
src/connection-editor/nm-connection-editor.c
src/connection-editor/nm-connection-editor.h
src/connection-editor/nm-connection-list.c
src/connection-editor/page-dsl.c
src/connection-editor/page-ip4.c
src/connection-editor/page-mobile.c
src/connection-editor/page-ppp.c
src/connection-editor/page-vpn.c
src/connection-editor/page-wired-security.c
src/connection-editor/page-wired.c
src/connection-editor/page-wireless-security.c
src/connection-editor/page-wireless-security.h
src/connection-editor/page-wireless.c
Use a copy of the real connection in the connection editor. Fixes issues
where the connection is updated but writing it fails for some reason.
Keep the connection that's been edited updated after every UI change so
that pages can act on changes to other pages.
2008-06-17 Dan Williams <dcbw@redhat.com> 2008-06-17 Dan Williams <dcbw@redhat.com>
* src/vpn-properties/* * src/vpn-properties/*
......
...@@ -39,20 +39,17 @@ enum { ...@@ -39,20 +39,17 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 }; static guint signals[LAST_SIGNAL] = { 0 };
gboolean gboolean
ce_page_validate (CEPage *self, GError **error) ce_page_validate (CEPage *self, NMConnection *connection, GError **error)
{ {
g_return_val_if_fail (CE_IS_PAGE (self), FALSE);
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
if (CE_PAGE_GET_CLASS (self)->validate) if (CE_PAGE_GET_CLASS (self)->validate)
return CE_PAGE_GET_CLASS (self)->validate (self, error); return CE_PAGE_GET_CLASS (self)->validate (self, connection, error);
return TRUE; return TRUE;
} }
void
ce_page_update_connection (CEPage *self, NMConnection *connection)
{
CE_PAGE_GET_CLASS (self)->update_connection (self, connection);
}
void void
ce_page_mac_to_entry (GByteArray *mac, GtkEntry *entry) ce_page_mac_to_entry (GByteArray *mac, GtkEntry *entry)
{ {
......
...@@ -53,8 +53,7 @@ typedef struct { ...@@ -53,8 +53,7 @@ typedef struct {
GObjectClass parent; GObjectClass parent;
/* Virtual functions */ /* Virtual functions */
gboolean (*validate) (CEPage *self, GError **error); gboolean (*validate) (CEPage *self, NMConnection *connection, GError **error);
void (*update_connection) (CEPage *self, NMConnection *connection);
/* Signals */ /* Signals */
void (*changed) (CEPage *self); void (*changed) (CEPage *self);
...@@ -66,9 +65,7 @@ GtkWidget * ce_page_get_page (CEPage *self); ...@@ -66,9 +65,7 @@ GtkWidget * ce_page_get_page (CEPage *self);
const char * ce_page_get_title (CEPage *self); const char * ce_page_get_title (CEPage *self);
gboolean ce_page_validate (CEPage *self, GError **error); gboolean ce_page_validate (CEPage *self, NMConnection *connection, GError **error);
void ce_page_update_connection (CEPage *self, NMConnection *connection);
void ce_page_changed (CEPage *self); void ce_page_changed (CEPage *self);
......
...@@ -71,7 +71,7 @@ enum { ...@@ -71,7 +71,7 @@ enum {
static guint editor_signals[EDITOR_LAST_SIGNAL] = { 0 }; static guint editor_signals[EDITOR_LAST_SIGNAL] = { 0 };
static void nm_connection_editor_set_connection (NMConnectionEditor *editor, static void nm_connection_editor_set_connection (NMConnectionEditor *editor,
NMExportedConnection *exported); NMConnection *connection);
static void static void
dialog_response_cb (GtkDialog *dialog, guint response, gpointer user_data) dialog_response_cb (GtkDialog *dialog, guint response, gpointer user_data)
...@@ -147,7 +147,7 @@ connection_editor_validate (NMConnectionEditor *editor) ...@@ -147,7 +147,7 @@ connection_editor_validate (NMConnectionEditor *editor)
for (iter = editor->pages; iter; iter = g_slist_next (iter)) { for (iter = editor->pages; iter; iter = g_slist_next (iter)) {
GError *error = NULL; GError *error = NULL;
if (!ce_page_validate (CE_PAGE (iter->data), &error)) { if (!ce_page_validate (CE_PAGE (iter->data), editor->connection, &error)) {
/* FIXME: use the error to indicate which UI widgets are invalid */ /* FIXME: use the error to indicate which UI widgets are invalid */
if (error) if (error)
g_error_free (error); g_error_free (error);
...@@ -233,8 +233,8 @@ dispose (GObject *object) ...@@ -233,8 +233,8 @@ dispose (GObject *object)
g_slist_free (editor->pages); g_slist_free (editor->pages);
editor->pages = NULL; editor->pages = NULL;
if (editor->exported) if (editor->connection)
g_object_unref (editor->exported); g_object_unref (editor->connection);
gtk_widget_destroy (editor->dialog); gtk_widget_destroy (editor->dialog);
g_object_unref (editor->xml); g_object_unref (editor->xml);
...@@ -262,24 +262,24 @@ nm_connection_editor_class_init (NMConnectionEditorClass *klass) ...@@ -262,24 +262,24 @@ nm_connection_editor_class_init (NMConnectionEditorClass *klass)
} }
NMConnectionEditor * NMConnectionEditor *
nm_connection_editor_new (NMExportedConnection *exported) nm_connection_editor_new (NMConnection *connection)
{ {
NMConnectionEditor *editor; NMConnectionEditor *editor;
g_return_val_if_fail (NM_IS_EXPORTED_CONNECTION (exported), NULL); g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
editor = g_object_new (NM_TYPE_CONNECTION_EDITOR, NULL); editor = g_object_new (NM_TYPE_CONNECTION_EDITOR, NULL);
nm_connection_editor_set_connection (editor, exported); nm_connection_editor_set_connection (editor, connection);
return editor; return editor;
} }
NMExportedConnection * NMConnection *
nm_connection_editor_get_connection (NMConnectionEditor *editor) nm_connection_editor_get_connection (NMConnectionEditor *editor)
{ {
g_return_val_if_fail (NM_IS_CONNECTION_EDITOR (editor), NULL); g_return_val_if_fail (NM_IS_CONNECTION_EDITOR (editor), NULL);
return editor->exported; return editor->connection;
} }
gint gint
...@@ -356,20 +356,18 @@ add_page (NMConnectionEditor *editor, CEPage *page) ...@@ -356,20 +356,18 @@ add_page (NMConnectionEditor *editor, CEPage *page)
} }
static void static void
nm_connection_editor_set_connection (NMConnectionEditor *editor, NMExportedConnection *exported) nm_connection_editor_set_connection (NMConnectionEditor *editor, NMConnection *connection)
{ {
NMSettingConnection *s_con; NMSettingConnection *s_con;
g_return_if_fail (NM_IS_CONNECTION_EDITOR (editor)); g_return_if_fail (NM_IS_CONNECTION_EDITOR (editor));
g_return_if_fail (NM_IS_EXPORTED_CONNECTION (exported)); g_return_if_fail (NM_IS_CONNECTION (connection));
/* clean previous connection */ /* clean previous connection */
if (editor->exported) if (editor->connection)
g_object_unref (editor->exported); g_object_unref (editor->connection);
editor->exported = g_object_ref (exported);
editor->connection = nm_exported_connection_get_connection (exported);
editor->connection = g_object_ref (connection);
nm_connection_editor_update_title (editor); nm_connection_editor_update_title (editor);
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (editor->connection, NM_TYPE_SETTING_CONNECTION)); s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (editor->connection, NM_TYPE_SETTING_CONNECTION));
...@@ -380,15 +378,8 @@ nm_connection_editor_set_connection (NMConnectionEditor *editor, NMExportedConne ...@@ -380,15 +378,8 @@ nm_connection_editor_set_connection (NMConnectionEditor *editor, NMExportedConne
add_page (editor, CE_PAGE (ce_page_wired_security_new (editor->connection))); add_page (editor, CE_PAGE (ce_page_wired_security_new (editor->connection)));
add_page (editor, CE_PAGE (ce_page_ip4_new (editor->connection))); add_page (editor, CE_PAGE (ce_page_ip4_new (editor->connection)));
} else if (!strcmp (s_con->type, NM_SETTING_WIRELESS_SETTING_NAME)) { } else if (!strcmp (s_con->type, NM_SETTING_WIRELESS_SETTING_NAME)) {
CEPageWireless *wireless_page; add_page (editor, CE_PAGE (ce_page_wireless_new (editor->connection)));
CEPageWirelessSecurity *wireless_security_page; add_page (editor, CE_PAGE (ce_page_wireless_security_new (editor->connection)));
wireless_page = ce_page_wireless_new (editor->connection);
add_page (editor, CE_PAGE (wireless_page));
wireless_security_page = ce_page_wireless_security_new (editor->connection, wireless_page);
add_page (editor, CE_PAGE (wireless_security_page));
add_page (editor, CE_PAGE (ce_page_ip4_new (editor->connection))); add_page (editor, CE_PAGE (ce_page_ip4_new (editor->connection)));
} else if (!strcmp (s_con->type, NM_SETTING_VPN_SETTING_NAME)) { } else if (!strcmp (s_con->type, NM_SETTING_VPN_SETTING_NAME)) {
add_page (editor, CE_PAGE (ce_page_vpn_new (editor->connection))); add_page (editor, CE_PAGE (ce_page_vpn_new (editor->connection)));
...@@ -417,12 +408,6 @@ nm_connection_editor_present (NMConnectionEditor *editor) ...@@ -417,12 +408,6 @@ nm_connection_editor_present (NMConnectionEditor *editor)
gtk_window_present (GTK_WINDOW (editor->dialog)); gtk_window_present (GTK_WINDOW (editor->dialog));
} }
static void
update_one_page (gpointer data, gpointer user_data)
{
ce_page_update_connection (CE_PAGE (data), NM_CONNECTION (user_data));
}
static void static void
connection_editor_update_connection (NMConnectionEditor *editor) connection_editor_update_connection (NMConnectionEditor *editor)
{ {
...@@ -448,8 +433,6 @@ connection_editor_update_connection (NMConnectionEditor *editor) ...@@ -448,8 +433,6 @@ connection_editor_update_connection (NMConnectionEditor *editor)
nm_connection_set_scope (editor->connection, NM_CONNECTION_SCOPE_SYSTEM); nm_connection_set_scope (editor->connection, NM_CONNECTION_SCOPE_SYSTEM);
else else
nm_connection_set_scope (editor->connection, NM_CONNECTION_SCOPE_USER); nm_connection_set_scope (editor->connection, NM_CONNECTION_SCOPE_USER);
g_slist_foreach (editor->pages, update_one_page, editor->connection);
} }
static void static void
......
...@@ -25,9 +25,7 @@ ...@@ -25,9 +25,7 @@
#include <glib-object.h> #include <glib-object.h>
#include <glade/glade-xml.h> #include <glade/glade-xml.h>
#include <gtk/gtksizegroup.h>
#include <gtk/gtkspinbutton.h> #include <gtk/gtkspinbutton.h>
#include <gconf/gconf-client.h>
#include <nm-settings.h> #include <nm-settings.h>
#define NM_TYPE_CONNECTION_EDITOR (nm_connection_editor_get_type ()) #define NM_TYPE_CONNECTION_EDITOR (nm_connection_editor_get_type ())
...@@ -38,7 +36,6 @@ typedef struct { ...@@ -38,7 +36,6 @@ typedef struct {
GObject parent; GObject parent;
/* private data */ /* private data */
NMExportedConnection *exported;
NMConnection *connection; NMConnection *connection;
GSList *pages; GSList *pages;
...@@ -55,11 +52,11 @@ typedef struct { ...@@ -55,11 +52,11 @@ typedef struct {
} NMConnectionEditorClass; } NMConnectionEditorClass;
GType nm_connection_editor_get_type (void); GType nm_connection_editor_get_type (void);
NMConnectionEditor *nm_connection_editor_new (NMExportedConnection *exported); NMConnectionEditor *nm_connection_editor_new (NMConnection *connection);
void nm_connection_editor_present (NMConnectionEditor *editor); void nm_connection_editor_present (NMConnectionEditor *editor);
void nm_connection_editor_run (NMConnectionEditor *editor); void nm_connection_editor_run (NMConnectionEditor *editor);
NMExportedConnection *nm_connection_editor_get_connection (NMConnectionEditor *editor); NMConnection *nm_connection_editor_get_connection (NMConnectionEditor *editor);
gint ce_spin_output_with_default (GtkSpinButton *spin, gpointer user_data); gint ce_spin_output_with_default (GtkSpinButton *spin, gpointer user_data);
......
This diff is collapsed.
...@@ -39,7 +39,6 @@ G_DEFINE_TYPE (CEPageDsl, ce_page_dsl, CE_TYPE_PAGE) ...@@ -39,7 +39,6 @@ G_DEFINE_TYPE (CEPageDsl, ce_page_dsl, CE_TYPE_PAGE)
typedef struct { typedef struct {
NMSettingPPPOE *setting; NMSettingPPPOE *setting;
NMConnection *connection; /* ugh */
GtkEntry *username; GtkEntry *username;
GtkEntry *password; GtkEntry *password;
...@@ -80,7 +79,7 @@ populate_ui (CEPageDsl *self, NMConnection *connection) ...@@ -80,7 +79,7 @@ populate_ui (CEPageDsl *self, NMConnection *connection)
GValue *value; GValue *value;
secrets = nm_gconf_get_keyring_items (connection, connection_id, secrets = nm_gconf_get_keyring_items (connection, connection_id,
nm_setting_get_name (NM_SETTING (priv->setting)), nm_setting_get_name (NM_SETTING (setting)),
FALSE, FALSE,
&error); &error);
if (secrets) { if (secrets) {
...@@ -121,7 +120,6 @@ ce_page_dsl_new (NMConnection *connection) ...@@ -121,7 +120,6 @@ ce_page_dsl_new (NMConnection *connection)
CEPageDsl *self; CEPageDsl *self;
CEPageDslPrivate *priv; CEPageDslPrivate *priv;
CEPage *parent; CEPage *parent;
NMSettingPPPOE *s_pppoe;
self = CE_PAGE_DSL (g_object_new (CE_TYPE_PAGE_DSL, NULL)); self = CE_PAGE_DSL (g_object_new (CE_TYPE_PAGE_DSL, NULL));
parent = CE_PAGE (self); parent = CE_PAGE (self);
...@@ -146,13 +144,11 @@ ce_page_dsl_new (NMConnection *connection) ...@@ -146,13 +144,11 @@ ce_page_dsl_new (NMConnection *connection)
dsl_private_init (self); dsl_private_init (self);
priv = CE_PAGE_DSL_GET_PRIVATE (self); priv = CE_PAGE_DSL_GET_PRIVATE (self);
s_pppoe = (NMSettingPPPOE *) nm_connection_get_setting (connection, NM_TYPE_SETTING_PPPOE); priv->setting = (NMSettingPPPOE *) nm_connection_get_setting (connection, NM_TYPE_SETTING_PPPOE);
if (s_pppoe) if (!priv->setting) {
priv->setting = NM_SETTING_PPPOE (nm_setting_duplicate (NM_SETTING (s_pppoe)));
else
priv->setting = NM_SETTING_PPPOE (nm_setting_pppoe_new ()); priv->setting = NM_SETTING_PPPOE (nm_setting_pppoe_new ());
nm_connection_add_setting (connection, NM_SETTING (priv->setting));
priv->connection = connection; }
populate_ui (self, connection); populate_ui (self, connection);
...@@ -194,7 +190,7 @@ ui_to_setting (CEPageDsl *self) ...@@ -194,7 +190,7 @@ ui_to_setting (CEPageDsl *self)
} }
static gboolean static gboolean
validate (CEPage *page, GError **error) validate (CEPage *page, NMConnection *connection, GError **error)
{ {
CEPageDsl *self = CE_PAGE_DSL (page); CEPageDsl *self = CE_PAGE_DSL (page);
CEPageDslPrivate *priv = CE_PAGE_DSL_GET_PRIVATE (self); CEPageDslPrivate *priv = CE_PAGE_DSL_GET_PRIVATE (self);
...@@ -203,43 +199,18 @@ validate (CEPage *page, GError **error) ...@@ -203,43 +199,18 @@ validate (CEPage *page, GError **error)
ui_to_setting (self); ui_to_setting (self);
foo = g_slist_append (NULL, nm_connection_get_setting (priv->connection, NM_TYPE_SETTING_PPP)); foo = g_slist_append (NULL, nm_connection_get_setting (connection, NM_TYPE_SETTING_PPP));
valid = nm_setting_verify (NM_SETTING (priv->setting), foo, error); valid = nm_setting_verify (NM_SETTING (priv->setting), foo, error);
g_slist_free (foo); g_slist_free (foo);
return valid; return valid;
} }
static void
update_connection (CEPage *page, NMConnection *connection)
{
CEPageDsl *self = CE_PAGE_DSL (page);
CEPageDslPrivate *priv = CE_PAGE_DSL_GET_PRIVATE (self);
ui_to_setting (self);
g_object_ref (priv->setting); /* Add setting steals the reference. */
nm_connection_add_setting (connection, NM_SETTING (priv->setting));
}
static void static void
ce_page_dsl_init (CEPageDsl *self) ce_page_dsl_init (CEPageDsl *self)
{ {
} }
static void
dispose (GObject *object)
{
CEPageDslPrivate *priv = CE_PAGE_DSL_GET_PRIVATE (object);
if (priv->disposed)
return;
priv->disposed = TRUE;
g_object_unref (priv->setting);
G_OBJECT_CLASS (ce_page_dsl_parent_class)->dispose (object);
}
static void static void
ce_page_dsl_class_init (CEPageDslClass *dsl_class) ce_page_dsl_class_init (CEPageDslClass *dsl_class)
{ {
...@@ -249,8 +220,5 @@ ce_page_dsl_class_init (CEPageDslClass *dsl_class) ...@@ -249,8 +220,5 @@ ce_page_dsl_class_init (CEPageDslClass *dsl_class)
g_type_class_add_private (object_class, sizeof (CEPageDslPrivate)); g_type_class_add_private (object_class, sizeof (CEPageDslPrivate));
/* virtual methods */ /* virtual methods */
object_class->dispose = dispose;
parent_class->validate = validate; parent_class->validate = validate;
parent_class->update_connection = update_connection;
} }
...@@ -428,7 +428,6 @@ ce_page_ip4_new (NMConnection *connection) ...@@ -428,7 +428,6 @@ ce_page_ip4_new (NMConnection *connection)
CEPageIP4 *self; CEPageIP4 *self;
CEPageIP4Private *priv; CEPageIP4Private *priv;
CEPage *parent; CEPage *parent;
NMSettingIP4Config *s_ip4;
GtkTreeSelection *selection; GtkTreeSelection *selection;
gint offset; gint offset;
GtkTreeViewColumn *column; GtkTreeViewColumn *column;
...@@ -458,11 +457,11 @@ ce_page_ip4_new (NMConnection *connection) ...@@ -458,11 +457,11 @@ ce_page_ip4_new (NMConnection *connection)
ip4_private_init (self); ip4_private_init (self);
priv = CE_PAGE_IP4_GET_PRIVATE (self); priv = CE_PAGE_IP4_GET_PRIVATE (self);
s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG); priv->setting = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
if (s_ip4) if (!priv->setting) {
priv->setting = NM_SETTING_IP4_CONFIG (nm_setting_duplicate (NM_SETTING (s_ip4)));
else
priv->setting = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); priv->setting = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
nm_connection_add_setting (connection, NM_SETTING (priv->setting));
}
populate_ui (self); populate_ui (self);
...@@ -675,7 +674,7 @@ next: ...@@ -675,7 +674,7 @@ next:
} }
static gboolean static gboolean
validate (CEPage *page, GError **error) validate (CEPage *page, NMConnection *connection, GError **error)
{ {
CEPageIP4 *self = CE_PAGE_IP4 (page); CEPageIP4 *self = CE_PAGE_IP4 (page);
CEPageIP4Private *priv = CE_PAGE_IP4_GET_PRIVATE (self); CEPageIP4Private *priv = CE_PAGE_IP4_GET_PRIVATE (self);
...@@ -684,36 +683,11 @@ validate (CEPage *page, GError **error) ...@@ -684,36 +683,11 @@ validate (CEPage *page, GError **error)
return nm_setting_verify (NM_SETTING (priv->setting), NULL, error); return nm_setting_verify (NM_SETTING (priv->setting), NULL, error);
} }
static void
update_connection (CEPage *page, NMConnection *connection)
{
CEPageIP4 *self = CE_PAGE_IP4 (page);
CEPageIP4Private *priv = CE_PAGE_IP4_GET_PRIVATE (page);
ui_to_setting (self);
g_object_ref (priv->setting); /* Add setting steals the reference. */
nm_connection_add_setting (connection, NM_SETTING (priv->setting));
}
static void static void
ce_page_ip4_init (CEPageIP4 *self) ce_page_ip4_init (CEPageIP4 *self)
{ {
} }
static void
dispose (GObject *object)
{
CEPageIP4Private *priv = CE_PAGE_IP4_GET_PRIVATE (object);
if (priv->disposed)
return;
priv->disposed = TRUE;
g_object_unref (priv->setting);
G_OBJECT_CLASS (ce_page_ip4_parent_class)->dispose (object);
}
static void static void
ce_page_ip4_class_init (CEPageIP4Class *ip4_class) ce_page_ip4_class_init (CEPageIP4Class *ip4_class)
{ {
...@@ -723,8 +697,5 @@ ce_page_ip4_class_init (CEPageIP4Class *ip4_class) ...@@ -723,8 +697,5 @@ ce_page_ip4_class_init (CEPageIP4Class *ip4_class)
g_type_class_add_private (object_class, sizeof (CEPageIP4Private)); g_type_class_add_private (object_class, sizeof (CEPageIP4Private));
/* virtual methods */ /* virtual methods */
object_class->dispose = dispose;
parent_class->validate = validate; parent_class->validate = validate;
parent_class->update_connection = update_connection;
} }
...@@ -247,7 +247,6 @@ ce_page_mobile_new (NMConnection *connection) ...@@ -247,7 +247,6 @@ ce_page_mobile_new (NMConnection *connection)
CEPageMobile *self; CEPageMobile *self;
CEPageMobilePrivate *priv; CEPageMobilePrivate *priv;
CEPage *parent; CEPage *parent;
NMSetting *setting;
self = CE_PAGE_MOBILE (g_object_new (CE_TYPE_PAGE_MOBILE, NULL)); self = CE_PAGE_MOBILE (g_object_new (CE_TYPE_PAGE_MOBILE, NULL));
parent = CE_PAGE (self); parent = CE_PAGE (self);
...@@ -272,18 +271,17 @@ ce_page_mobile_new (NMConnection *connection) ...@@ -272,18 +271,17 @@ ce_page_mobile_new (NMConnection *connection)
mobile_private_init (self); mobile_private_init (self);
priv = CE_PAGE_MOBILE_GET_PRIVATE (self); priv = CE_PAGE_MOBILE_GET_PRIVATE (self);
setting = nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM); priv->setting = nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM);
if (!setting) if (!priv->setting)
setting = nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA); priv->setting = nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA);
if (!setting) { if (!priv->setting) {
/* FIXME: Support add. */ /* FIXME: Support add. */
g_warning ("Adding mobile conneciton not supported yet."); g_warning ("Adding mobile conneciton not supported yet.");
g_object_unref (self); g_object_unref (self);
return NULL;