2014-07-11 12:05:13 -04:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
|
|
|
|
/*
|
|
|
|
|
* 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*
|
|
|
|
|
* Copyright 2014 Red Hat, Inc.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SECTION:nmt-page-dsl
|
|
|
|
|
* @short_description: The editor page for DSL connections
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
2015-07-17 14:38:54 +02:00
|
|
|
#include "nm-default.h"
|
2014-07-11 12:05:13 -04:00
|
|
|
#include "nmt-page-dsl.h"
|
2014-10-31 16:15:48 -04:00
|
|
|
#include "nmt-page-ethernet.h"
|
|
|
|
|
#include "nmt-page-ppp.h"
|
2014-07-11 12:05:13 -04:00
|
|
|
#include "nmt-password-fields.h"
|
|
|
|
|
|
2014-10-31 16:15:48 -04:00
|
|
|
G_DEFINE_TYPE (NmtPageDsl, nmt_page_dsl, NMT_TYPE_EDITOR_PAGE_DEVICE)
|
|
|
|
|
|
|
|
|
|
#define NMT_PAGE_DSL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NMT_TYPE_PAGE_DSL, NmtPageDslPrivate))
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
NmtEditorPage *ethernet_page, *ppp_page;
|
|
|
|
|
|
|
|
|
|
} NmtPageDslPrivate;
|
2014-07-11 12:05:13 -04:00
|
|
|
|
2014-10-31 16:01:27 -04:00
|
|
|
NmtEditorPage *
|
2014-10-31 16:15:48 -04:00
|
|
|
nmt_page_dsl_new (NMConnection *conn,
|
|
|
|
|
NmtDeviceEntry *deventry)
|
2014-07-11 12:05:13 -04:00
|
|
|
{
|
|
|
|
|
return g_object_new (NMT_TYPE_PAGE_DSL,
|
|
|
|
|
"connection", conn,
|
2014-10-31 16:15:48 -04:00
|
|
|
"device-entry", deventry,
|
2014-07-11 12:05:13 -04:00
|
|
|
NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
nmt_page_dsl_init (NmtPageDsl *dsl)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-31 16:15:48 -04:00
|
|
|
static NmtEditorSection *
|
|
|
|
|
build_dsl_section (NmtPageDsl *dsl, NMSettingPppoe *s_pppoe)
|
2014-07-11 12:05:13 -04:00
|
|
|
{
|
2014-10-31 16:01:27 -04:00
|
|
|
NmtEditorSection *section;
|
2014-10-31 13:28:44 -04:00
|
|
|
NmtEditorGrid *grid;
|
2014-07-11 12:05:13 -04:00
|
|
|
NmtNewtWidget *widget;
|
|
|
|
|
|
2014-10-31 16:01:27 -04:00
|
|
|
section = nmt_editor_section_new (_("DSL"), NULL, TRUE);
|
|
|
|
|
grid = nmt_editor_section_get_body (section);
|
2014-07-11 12:05:13 -04:00
|
|
|
|
|
|
|
|
widget = nmt_newt_entry_new (40, 0);
|
2014-10-31 13:28:44 -04:00
|
|
|
nmt_editor_grid_append (grid, _("Username"), widget, NULL);
|
2014-07-11 12:05:13 -04:00
|
|
|
g_object_bind_property (s_pppoe, NM_SETTING_PPPOE_USERNAME,
|
|
|
|
|
widget, "text",
|
|
|
|
|
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
|
|
|
|
|
|
|
|
|
|
widget = nmt_password_fields_new (40, NMT_PASSWORD_FIELDS_SHOW_PASSWORD);
|
|
|
|
|
g_object_bind_property (s_pppoe, NM_SETTING_PPPOE_PASSWORD,
|
|
|
|
|
widget, "password",
|
|
|
|
|
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
|
2014-10-31 13:28:44 -04:00
|
|
|
nmt_editor_grid_append (grid, _("Password"), widget, NULL);
|
2014-07-11 12:05:13 -04:00
|
|
|
|
|
|
|
|
widget = nmt_newt_entry_new (40, 0);
|
2014-10-31 13:28:44 -04:00
|
|
|
nmt_editor_grid_append (grid, _("Service"), widget, NULL);
|
2014-07-11 12:05:13 -04:00
|
|
|
g_object_bind_property (s_pppoe, NM_SETTING_PPPOE_SERVICE,
|
|
|
|
|
widget, "text",
|
|
|
|
|
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
|
|
|
|
|
|
2014-10-31 16:15:48 -04:00
|
|
|
return section;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
nmt_page_dsl_constructed (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
NmtPageDsl *dsl = NMT_PAGE_DSL (object);
|
|
|
|
|
NmtPageDslPrivate *priv = NMT_PAGE_DSL_GET_PRIVATE (dsl);
|
|
|
|
|
NMConnection *conn;
|
|
|
|
|
NMSettingPppoe *s_pppoe;
|
|
|
|
|
NmtEditorSection *section;
|
|
|
|
|
const GSList *sections, *iter;
|
|
|
|
|
|
|
|
|
|
conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (dsl));
|
|
|
|
|
s_pppoe = nm_connection_get_setting_pppoe (conn);
|
|
|
|
|
if (!s_pppoe) {
|
|
|
|
|
nm_connection_add_setting (conn, nm_setting_pppoe_new ());
|
|
|
|
|
s_pppoe = nm_connection_get_setting_pppoe (conn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
section = build_dsl_section (dsl, s_pppoe);
|
2014-10-31 16:01:27 -04:00
|
|
|
nmt_editor_page_add_section (NMT_EDITOR_PAGE (dsl), section);
|
|
|
|
|
|
2014-10-31 16:15:48 -04:00
|
|
|
priv->ethernet_page = nmt_page_ethernet_new (conn, nmt_editor_page_device_get_device_entry (NMT_EDITOR_PAGE_DEVICE (dsl)));
|
|
|
|
|
sections = nmt_editor_page_get_sections (priv->ethernet_page);
|
|
|
|
|
for (iter = sections; iter; iter = iter->next)
|
|
|
|
|
nmt_editor_page_add_section (NMT_EDITOR_PAGE (dsl), iter->data);
|
|
|
|
|
|
|
|
|
|
priv->ppp_page = nmt_page_ppp_new (conn);
|
|
|
|
|
sections = nmt_editor_page_get_sections (priv->ppp_page);
|
|
|
|
|
for (iter = sections; iter; iter = iter->next)
|
|
|
|
|
nmt_editor_page_add_section (NMT_EDITOR_PAGE (dsl), iter->data);
|
|
|
|
|
|
2014-07-11 12:05:13 -04:00
|
|
|
G_OBJECT_CLASS (nmt_page_dsl_parent_class)->constructed (object);
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-31 16:15:48 -04:00
|
|
|
static void
|
|
|
|
|
nmt_page_dsl_finalize (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
NmtPageDsl *dsl = NMT_PAGE_DSL (object);
|
|
|
|
|
NmtPageDslPrivate *priv = NMT_PAGE_DSL_GET_PRIVATE (dsl);
|
|
|
|
|
|
|
|
|
|
g_clear_object (&priv->ethernet_page);
|
|
|
|
|
g_clear_object (&priv->ppp_page);
|
|
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (nmt_page_dsl_parent_class)->finalize (object);
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-11 12:05:13 -04:00
|
|
|
static void
|
|
|
|
|
nmt_page_dsl_class_init (NmtPageDslClass *dsl_class)
|
|
|
|
|
{
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (dsl_class);
|
|
|
|
|
|
tui: fix crash when editing DSL connection
Program received signal SIGSEGV, Segmentation fault.
0x000000000041b3e5 in nmt_page_dsl_constructed (object=0x7fffec0228c0 [NmtPageDsl]) at nmt-page-dsl.c:109
109 priv->ethernet_page = nmt_page_ethernet_new (conn, nmt_editor_page_device_get_device_entry (NMT_EDITOR_PAGE_DEVICE (dsl)));
Missing separate debuginfos, use: debuginfo-install libffi-3.0.10-3.fc18.x86_64 newt-0.52.15-1.fc19.x86_64
(gdb) bt
#0 0x000000000041b3e5 in nmt_page_dsl_constructed (object=0x7fffec0228c0 [NmtPageDsl]) at nmt-page-dsl.c:109
#1 0x0000003e9ac161e3 in g_object_newv (object_type=1, object_type@entry=16203872, n_parameters=n_parameters@entry=2, parameters=parameters@entry=0xf74350)
at gobject.c:1741
#2 0x0000003e9ac16560 in g_object_new_valist (object_type=object_type@entry=16203872, first_property_name=first_property_name@entry=0x42e524 "connection",
var_args=var_args@entry=0x7fffffffcef8) at gobject.c:1830
#3 0x0000003e9ac16894 in g_object_new (object_type=16203872, first_property_name=first_property_name@entry=0x42e524 "connection") at gobject.c:1545
#4 0x000000000041b504 in nmt_page_dsl_new (conn=<optimized out>, deventry=deventry@entry=0x974690 [NmtDeviceEntry]) at nmt-page-dsl.c:47
#5 0x000000000041808e in nmt_editor_constructed (object=<optimized out>) at nmt-editor.c:355
#6 0x0000003e9ac161e3 in g_object_newv (object_type=1, object_type@entry=16174256, n_parameters=n_parameters@entry=4, parameters=parameters@entry=0xf6cec0)
at gobject.c:1741
...
(gdb) p priv
$1 = (NmtPageDslPrivate *) 0x0
2015-01-07 19:29:53 +01:00
|
|
|
g_type_class_add_private (object_class, sizeof (NmtPageDslPrivate));
|
|
|
|
|
|
2014-07-11 12:05:13 -04:00
|
|
|
object_class->constructed = nmt_page_dsl_constructed;
|
2014-10-31 16:15:48 -04:00
|
|
|
object_class->finalize = nmt_page_dsl_finalize;
|
2014-07-11 12:05:13 -04:00
|
|
|
}
|