tui: rework how editor pages work
Instead of having NmtEditorPage be a widget itself, have it just be an object that returns a list of NmtEditorSections, where NmtEditorSection is a subclass of NmtNewtSection. (This will be important when adding VPN pages, which will be split up into multiple sections, but with the different sections needing to cooperate on updating the NMSettingVpn. This reorganization lets us have an NMPageVpn containing multiple sections, with the NMPageVpn object handling the coordination between the sections.)
This commit is contained in:
@@ -61,6 +61,8 @@ nmtui_SOURCES = \
|
|||||||
nmt-editor-page.h \
|
nmt-editor-page.h \
|
||||||
nmt-editor-page-device.c \
|
nmt-editor-page-device.c \
|
||||||
nmt-editor-page-device.h \
|
nmt-editor-page-device.h \
|
||||||
|
nmt-editor-section.c \
|
||||||
|
nmt-editor-section.h \
|
||||||
nmt-editor.c \
|
nmt-editor.c \
|
||||||
nmt-editor.h \
|
nmt-editor.h \
|
||||||
nmt-ip-entry.c \
|
nmt-ip-entry.c \
|
||||||
|
@@ -45,7 +45,6 @@ enum {
|
|||||||
PROP_0,
|
PROP_0,
|
||||||
|
|
||||||
PROP_DEVICE_ENTRY,
|
PROP_DEVICE_ENTRY,
|
||||||
PROP_SHOW_BY_DEFAULT,
|
|
||||||
|
|
||||||
LAST_PROP
|
LAST_PROP
|
||||||
};
|
};
|
||||||
@@ -73,14 +72,6 @@ nmt_editor_page_device_get_device_entry (NmtEditorPageDevice *page)
|
|||||||
return priv->device_entry;
|
return priv->device_entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
nmt_editor_page_device_show_by_default (NmtEditorPage *page)
|
|
||||||
{
|
|
||||||
NmtEditorPageDevicePrivate *priv = NMT_EDITOR_PAGE_DEVICE_GET_PRIVATE (page);
|
|
||||||
|
|
||||||
return priv->show_by_default;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nmt_editor_page_device_set_property (GObject *object,
|
nmt_editor_page_device_set_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
@@ -93,9 +84,6 @@ nmt_editor_page_device_set_property (GObject *object,
|
|||||||
case PROP_DEVICE_ENTRY:
|
case PROP_DEVICE_ENTRY:
|
||||||
priv->device_entry = g_value_dup_object (value);
|
priv->device_entry = g_value_dup_object (value);
|
||||||
break;
|
break;
|
||||||
case PROP_SHOW_BY_DEFAULT:
|
|
||||||
priv->show_by_default = g_value_get_boolean (value);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -114,9 +102,6 @@ nmt_editor_page_device_get_property (GObject *object,
|
|||||||
case PROP_DEVICE_ENTRY:
|
case PROP_DEVICE_ENTRY:
|
||||||
g_value_set_object (value, priv->device_entry);
|
g_value_set_object (value, priv->device_entry);
|
||||||
break;
|
break;
|
||||||
case PROP_SHOW_BY_DEFAULT:
|
|
||||||
g_value_set_boolean (value, priv->show_by_default);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -127,7 +112,6 @@ static void
|
|||||||
nmt_editor_page_device_class_init (NmtEditorPageDeviceClass *page_device_class)
|
nmt_editor_page_device_class_init (NmtEditorPageDeviceClass *page_device_class)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (page_device_class);
|
GObjectClass *object_class = G_OBJECT_CLASS (page_device_class);
|
||||||
NmtEditorPageClass *page_class = NMT_EDITOR_PAGE_CLASS (page_device_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (page_device_class, sizeof (NmtEditorPageDevicePrivate));
|
g_type_class_add_private (page_device_class, sizeof (NmtEditorPageDevicePrivate));
|
||||||
|
|
||||||
@@ -136,8 +120,6 @@ nmt_editor_page_device_class_init (NmtEditorPageDeviceClass *page_device_class)
|
|||||||
object_class->get_property = nmt_editor_page_device_get_property;
|
object_class->get_property = nmt_editor_page_device_get_property;
|
||||||
object_class->finalize = nmt_editor_page_device_finalize;
|
object_class->finalize = nmt_editor_page_device_finalize;
|
||||||
|
|
||||||
page_class->show_by_default = nmt_editor_page_device_show_by_default;
|
|
||||||
|
|
||||||
/* properties */
|
/* properties */
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(object_class, PROP_DEVICE_ENTRY,
|
(object_class, PROP_DEVICE_ENTRY,
|
||||||
@@ -146,11 +128,4 @@ nmt_editor_page_device_class_init (NmtEditorPageDeviceClass *page_device_class)
|
|||||||
G_PARAM_READWRITE |
|
G_PARAM_READWRITE |
|
||||||
G_PARAM_CONSTRUCT_ONLY |
|
G_PARAM_CONSTRUCT_ONLY |
|
||||||
G_PARAM_STATIC_STRINGS));
|
G_PARAM_STATIC_STRINGS));
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_SHOW_BY_DEFAULT,
|
|
||||||
g_param_spec_boolean ("show-by-default", "", "",
|
|
||||||
TRUE,
|
|
||||||
G_PARAM_READWRITE |
|
|
||||||
G_PARAM_CONSTRUCT_ONLY |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
}
|
}
|
||||||
|
@@ -21,9 +21,7 @@
|
|||||||
* @short_description: An #NmtEditor "page"
|
* @short_description: An #NmtEditor "page"
|
||||||
*
|
*
|
||||||
* #NmtEditorPage is the abstract base class for #NmtEditor "pages".
|
* #NmtEditorPage is the abstract base class for #NmtEditor "pages".
|
||||||
* Note that despite the name, currently all "page" types except
|
* A "page" is a set of related #NmtEditorSections.
|
||||||
* #NmtPageMain are actually displayed as collapsible sections, not
|
|
||||||
* separate tabs/forms.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@@ -32,14 +30,13 @@
|
|||||||
|
|
||||||
#include "nmt-editor-page.h"
|
#include "nmt-editor-page.h"
|
||||||
|
|
||||||
G_DEFINE_ABSTRACT_TYPE (NmtEditorPage, nmt_editor_page, NMT_TYPE_EDITOR_GRID)
|
G_DEFINE_ABSTRACT_TYPE (NmtEditorPage, nmt_editor_page, G_TYPE_OBJECT)
|
||||||
|
|
||||||
#define NMT_EDITOR_PAGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NMT_TYPE_EDITOR_PAGE, NmtEditorPagePrivate))
|
#define NMT_EDITOR_PAGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NMT_TYPE_EDITOR_PAGE, NmtEditorPagePrivate))
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *title;
|
|
||||||
NmtNewtWidget *header_widget;
|
|
||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
|
GSList *sections;
|
||||||
|
|
||||||
} NmtEditorPagePrivate;
|
} NmtEditorPagePrivate;
|
||||||
|
|
||||||
@@ -47,7 +44,6 @@ enum {
|
|||||||
PROP_0,
|
PROP_0,
|
||||||
|
|
||||||
PROP_CONNECTION,
|
PROP_CONNECTION,
|
||||||
PROP_TITLE,
|
|
||||||
|
|
||||||
LAST_PROP
|
LAST_PROP
|
||||||
};
|
};
|
||||||
@@ -55,9 +51,6 @@ enum {
|
|||||||
static void
|
static void
|
||||||
nmt_editor_page_init (NmtEditorPage *page)
|
nmt_editor_page_init (NmtEditorPage *page)
|
||||||
{
|
{
|
||||||
NmtEditorPagePrivate *priv = NMT_EDITOR_PAGE_GET_PRIVATE (page);
|
|
||||||
|
|
||||||
priv->header_widget = g_object_ref_sink (nmt_newt_separator_new ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -65,9 +58,8 @@ nmt_editor_page_finalize (GObject *object)
|
|||||||
{
|
{
|
||||||
NmtEditorPagePrivate *priv = NMT_EDITOR_PAGE_GET_PRIVATE (object);
|
NmtEditorPagePrivate *priv = NMT_EDITOR_PAGE_GET_PRIVATE (object);
|
||||||
|
|
||||||
g_free (priv->title);
|
|
||||||
g_clear_object (&priv->header_widget);
|
|
||||||
g_clear_object (&priv->connection);
|
g_clear_object (&priv->connection);
|
||||||
|
g_slist_free_full (priv->sections, g_object_unref);
|
||||||
|
|
||||||
G_OBJECT_CLASS (nmt_editor_page_parent_class)->finalize (object);
|
G_OBJECT_CLASS (nmt_editor_page_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
@@ -89,81 +81,37 @@ nmt_editor_page_get_connection (NmtEditorPage *page)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nmt_editor_page_set_header_widget:
|
* nmt_editor_page_get_sections:
|
||||||
* @page: the #NmtEditorPage
|
* @page: the #NmtEditorPage
|
||||||
* @widget: an #NmtNewtWidget
|
|
||||||
*
|
*
|
||||||
* Sets the page's header widget. When displayed as a subpage of
|
* Gets the page's list of sections to display.
|
||||||
* #NmtPageMain, this widget will be put into the corresponding
|
|
||||||
* #NmtNewtSection's header.
|
|
||||||
*
|
*
|
||||||
* FIXME: for consistency, this should be a property as well.
|
* Returns: (transfer none): the list of sections; this is the internal list
|
||||||
|
* used by the page and must not be modified or freed.
|
||||||
|
*/
|
||||||
|
GSList *
|
||||||
|
nmt_editor_page_get_sections (NmtEditorPage *page)
|
||||||
|
{
|
||||||
|
NmtEditorPagePrivate *priv = NMT_EDITOR_PAGE_GET_PRIVATE (page);
|
||||||
|
|
||||||
|
return priv->sections;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nmt_editor_page_add_section:
|
||||||
|
* @page: the #NmtEditorPage
|
||||||
|
* @section: the #NmtEditorSection
|
||||||
|
*
|
||||||
|
* Adds a section to the page. This should only be called by #NmtEditorPage
|
||||||
|
* subclasses.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
nmt_editor_page_set_header_widget (NmtEditorPage *page,
|
nmt_editor_page_add_section (NmtEditorPage *page,
|
||||||
NmtNewtWidget *widget)
|
NmtEditorSection *section)
|
||||||
{
|
{
|
||||||
NmtEditorPagePrivate *priv = NMT_EDITOR_PAGE_GET_PRIVATE (page);
|
NmtEditorPagePrivate *priv = NMT_EDITOR_PAGE_GET_PRIVATE (page);
|
||||||
|
|
||||||
g_clear_object (&priv->header_widget);
|
priv->sections = g_slist_append (priv->sections, g_object_ref_sink (section));
|
||||||
|
|
||||||
if (!widget)
|
|
||||||
widget = nmt_newt_separator_new ();
|
|
||||||
priv->header_widget = g_object_ref_sink (widget);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nmt_editor_page_get_header_widget:
|
|
||||||
* @page: the #NmtEditorPage
|
|
||||||
*
|
|
||||||
* Gets the page's header widget. When displayed as a subpage of
|
|
||||||
* #NmtPageMain, this widget will be put into the corresponding
|
|
||||||
* #NmtNewtSection's header.
|
|
||||||
*
|
|
||||||
* Returns: (transfer none): the page's header widget.
|
|
||||||
*/
|
|
||||||
NmtNewtWidget *
|
|
||||||
nmt_editor_page_get_header_widget (NmtEditorPage *page)
|
|
||||||
{
|
|
||||||
NmtEditorPagePrivate *priv = NMT_EDITOR_PAGE_GET_PRIVATE (page);
|
|
||||||
|
|
||||||
return priv->header_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nmt_editor_page_get_title:
|
|
||||||
* @page: the #NmtEditorPage
|
|
||||||
*
|
|
||||||
* Gets the page's title.
|
|
||||||
*
|
|
||||||
* Returns: the page's title
|
|
||||||
*/
|
|
||||||
const char *
|
|
||||||
nmt_editor_page_get_title (NmtEditorPage *page)
|
|
||||||
{
|
|
||||||
NmtEditorPagePrivate *priv = NMT_EDITOR_PAGE_GET_PRIVATE (page);
|
|
||||||
|
|
||||||
return priv->title;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
nmt_editor_page_real_show_by_default (NmtEditorPage *page)
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nmt_editor_page_show_by_default:
|
|
||||||
* @page: the #NmtEditorPage
|
|
||||||
*
|
|
||||||
* Checks if @page should be shown expanded by default
|
|
||||||
*
|
|
||||||
* Returns: %TRUE or %FALSE
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
nmt_editor_page_show_by_default (NmtEditorPage *page)
|
|
||||||
{
|
|
||||||
return NMT_EDITOR_PAGE_GET_CLASS (page)->show_by_default (page);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -178,9 +126,6 @@ nmt_editor_page_set_property (GObject *object,
|
|||||||
case PROP_CONNECTION:
|
case PROP_CONNECTION:
|
||||||
priv->connection = g_value_dup_object (value);
|
priv->connection = g_value_dup_object (value);
|
||||||
break;
|
break;
|
||||||
case PROP_TITLE:
|
|
||||||
priv->title = g_value_dup_string (value);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -199,9 +144,6 @@ nmt_editor_page_get_property (GObject *object,
|
|||||||
case PROP_CONNECTION:
|
case PROP_CONNECTION:
|
||||||
g_value_set_object (value, priv->connection);
|
g_value_set_object (value, priv->connection);
|
||||||
break;
|
break;
|
||||||
case PROP_TITLE:
|
|
||||||
g_value_set_string (value, priv->title);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -220,8 +162,6 @@ nmt_editor_page_class_init (NmtEditorPageClass *page_class)
|
|||||||
object_class->get_property = nmt_editor_page_get_property;
|
object_class->get_property = nmt_editor_page_get_property;
|
||||||
object_class->finalize = nmt_editor_page_finalize;
|
object_class->finalize = nmt_editor_page_finalize;
|
||||||
|
|
||||||
page_class->show_by_default = nmt_editor_page_real_show_by_default;
|
|
||||||
|
|
||||||
/* properties */
|
/* properties */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -236,16 +176,4 @@ nmt_editor_page_class_init (NmtEditorPageClass *page_class)
|
|||||||
G_PARAM_READWRITE |
|
G_PARAM_READWRITE |
|
||||||
G_PARAM_CONSTRUCT_ONLY |
|
G_PARAM_CONSTRUCT_ONLY |
|
||||||
G_PARAM_STATIC_STRINGS));
|
G_PARAM_STATIC_STRINGS));
|
||||||
/**
|
|
||||||
* NmtEditorPage:title:
|
|
||||||
*
|
|
||||||
* The page's title.
|
|
||||||
*/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_TITLE,
|
|
||||||
g_param_spec_string ("title", "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READWRITE |
|
|
||||||
G_PARAM_CONSTRUCT_ONLY |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* Copyright 2013 Red Hat, Inc.
|
* Copyright 2013-2014 Red Hat, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NMT_EDITOR_PAGE_H
|
#ifndef NMT_EDITOR_PAGE_H
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <NetworkManager.h>
|
#include <NetworkManager.h>
|
||||||
|
|
||||||
#include "nmt-editor-grid.h"
|
#include "nmt-editor-grid.h"
|
||||||
|
#include "nmt-editor-section.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
@@ -33,27 +34,24 @@ G_BEGIN_DECLS
|
|||||||
#define NMT_EDITOR_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NMT_TYPE_EDITOR_PAGE, NmtEditorPageClass))
|
#define NMT_EDITOR_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NMT_TYPE_EDITOR_PAGE, NmtEditorPageClass))
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NmtEditorGrid parent;
|
GObject parent;
|
||||||
|
|
||||||
} NmtEditorPage;
|
} NmtEditorPage;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NmtEditorGridClass parent;
|
GObjectClass parent;
|
||||||
|
|
||||||
gboolean (*show_by_default) (NmtEditorPage *);
|
|
||||||
} NmtEditorPageClass;
|
} NmtEditorPageClass;
|
||||||
|
|
||||||
GType nmt_editor_page_get_type (void);
|
GType nmt_editor_page_get_type (void);
|
||||||
|
|
||||||
NMConnection *nmt_editor_page_get_connection (NmtEditorPage *page);
|
NMConnection *nmt_editor_page_get_connection (NmtEditorPage *page);
|
||||||
|
|
||||||
void nmt_editor_page_set_header_widget (NmtEditorPage *page,
|
GSList *nmt_editor_page_get_sections (NmtEditorPage *page);
|
||||||
NmtNewtWidget *widget);
|
|
||||||
NmtNewtWidget *nmt_editor_page_get_header_widget (NmtEditorPage *page);
|
|
||||||
|
|
||||||
const char *nmt_editor_page_get_title (NmtEditorPage *page);
|
/*< protected >*/
|
||||||
|
void nmt_editor_page_add_section (NmtEditorPage *page,
|
||||||
gboolean nmt_editor_page_show_by_default (NmtEditorPage *page);
|
NmtEditorSection *section);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
281
clients/tui/nmt-editor-section.c
Normal file
281
clients/tui/nmt-editor-section.c
Normal file
@@ -0,0 +1,281 @@
|
|||||||
|
/* -*- 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 2013 Red Hat, Inc.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:nmt-editor-section:
|
||||||
|
* @short_description: A section of the #NmtEditor
|
||||||
|
*
|
||||||
|
* #NmtEditorSection is the abstract base class for #NmtEditor sections.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <glib/gi18n-lib.h>
|
||||||
|
|
||||||
|
#include "nmt-editor-section.h"
|
||||||
|
#include "nmt-newt-toggle-button.h"
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (NmtEditorSection, nmt_editor_section, NMT_TYPE_NEWT_SECTION)
|
||||||
|
|
||||||
|
#define NMT_EDITOR_SECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NMT_TYPE_EDITOR_SECTION, NmtEditorSectionPrivate))
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
NmtEditorGrid *header, *body;
|
||||||
|
char *title;
|
||||||
|
NmtNewtWidget *header_widget;
|
||||||
|
NmtNewtWidget *toggle;
|
||||||
|
|
||||||
|
gboolean show_by_default;
|
||||||
|
} NmtEditorSectionPrivate;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PROP_0,
|
||||||
|
|
||||||
|
PROP_TITLE,
|
||||||
|
PROP_SHOW_BY_DEFAULT,
|
||||||
|
PROP_HEADER_WIDGET,
|
||||||
|
|
||||||
|
LAST_PROP
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nmt_editor_section_new:
|
||||||
|
* @title: the section title
|
||||||
|
* @header_widget: (allow-none): the widget to show next to the title
|
||||||
|
* @show_by_default: whether the section should be open by default
|
||||||
|
*
|
||||||
|
* Creates a new #NmtEditorSection.
|
||||||
|
*
|
||||||
|
* Returns: a new #NmtEditorSection
|
||||||
|
*/
|
||||||
|
NmtEditorSection *
|
||||||
|
nmt_editor_section_new (const char *title,
|
||||||
|
NmtNewtWidget *header_widget,
|
||||||
|
gboolean show_by_default)
|
||||||
|
{
|
||||||
|
return g_object_new (NMT_TYPE_EDITOR_SECTION,
|
||||||
|
"title", title,
|
||||||
|
"header-widget", header_widget,
|
||||||
|
"show-by-default", show_by_default,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
rebuild_header (NmtEditorSection *section)
|
||||||
|
{
|
||||||
|
NmtEditorSectionPrivate *priv = NMT_EDITOR_SECTION_GET_PRIVATE (section);
|
||||||
|
|
||||||
|
/* Removing any widget in an NmtEditorGrid removes its whole row, so we can
|
||||||
|
* remove the existing title/widget/toggle by asking to remove toggle.
|
||||||
|
*/
|
||||||
|
nmt_newt_container_remove (NMT_NEWT_CONTAINER (priv->header), priv->toggle);
|
||||||
|
|
||||||
|
nmt_editor_grid_append (priv->header,
|
||||||
|
priv->title,
|
||||||
|
priv->header_widget ? priv->header_widget : nmt_newt_separator_new (),
|
||||||
|
priv->toggle);
|
||||||
|
nmt_editor_grid_set_row_flags (priv->header,
|
||||||
|
priv->toggle,
|
||||||
|
NMT_EDITOR_GRID_ROW_LABEL_ALIGN_LEFT |
|
||||||
|
NMT_EDITOR_GRID_ROW_EXTRA_ALIGN_RIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
nmt_editor_section_init (NmtEditorSection *section)
|
||||||
|
{
|
||||||
|
NmtEditorSectionPrivate *priv = NMT_EDITOR_SECTION_GET_PRIVATE (section);
|
||||||
|
|
||||||
|
priv->header = NMT_EDITOR_GRID (nmt_editor_grid_new ());
|
||||||
|
priv->body = NMT_EDITOR_GRID (nmt_editor_grid_new ());
|
||||||
|
priv->toggle = nmt_newt_toggle_button_new (_("Hide"), _("Show"));
|
||||||
|
g_object_ref_sink (priv->toggle);
|
||||||
|
|
||||||
|
nmt_newt_section_set_header (NMT_NEWT_SECTION (section), NMT_NEWT_WIDGET (priv->header));
|
||||||
|
nmt_newt_section_set_body (NMT_NEWT_SECTION (section), NMT_NEWT_WIDGET (priv->body));
|
||||||
|
|
||||||
|
g_object_bind_property (priv->toggle, "active",
|
||||||
|
section, "open",
|
||||||
|
G_BINDING_SYNC_CREATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
nmt_editor_section_finalize (GObject *object)
|
||||||
|
{
|
||||||
|
NmtEditorSectionPrivate *priv = NMT_EDITOR_SECTION_GET_PRIVATE (object);
|
||||||
|
|
||||||
|
g_free (priv->title);
|
||||||
|
g_clear_object (&priv->header_widget);
|
||||||
|
g_clear_object (&priv->toggle);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (nmt_editor_section_parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nmt_editor_section_get_header_widget:
|
||||||
|
* @section: the #NmtEditorSection
|
||||||
|
*
|
||||||
|
* Gets the section's header widget.
|
||||||
|
*
|
||||||
|
* Returns: the section's header widget.
|
||||||
|
*/
|
||||||
|
NmtNewtWidget *
|
||||||
|
nmt_editor_section_get_header_widget (NmtEditorSection *section)
|
||||||
|
{
|
||||||
|
NmtEditorSectionPrivate *priv = NMT_EDITOR_SECTION_GET_PRIVATE (section);
|
||||||
|
|
||||||
|
return priv->header_widget;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nmt_editor_section_get_body:
|
||||||
|
* @section: the #NmtEditorSection
|
||||||
|
*
|
||||||
|
* Gets the section's body grid, so that you can add things to it.
|
||||||
|
*
|
||||||
|
* Returns: the #NmtEditorGrid used for the section body
|
||||||
|
*/
|
||||||
|
NmtEditorGrid *
|
||||||
|
nmt_editor_section_get_body (NmtEditorSection *section)
|
||||||
|
{
|
||||||
|
NmtEditorSectionPrivate *priv = NMT_EDITOR_SECTION_GET_PRIVATE (section);
|
||||||
|
|
||||||
|
return priv->body;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nmt_editor_section_get_title:
|
||||||
|
* @section: the #NmtEditorSection
|
||||||
|
*
|
||||||
|
* Gets the section's title.
|
||||||
|
*
|
||||||
|
* Returns: the section's title
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
nmt_editor_section_get_title (NmtEditorSection *section)
|
||||||
|
{
|
||||||
|
NmtEditorSectionPrivate *priv = NMT_EDITOR_SECTION_GET_PRIVATE (section);
|
||||||
|
|
||||||
|
return priv->title;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
nmt_editor_section_set_property (GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
const GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
NmtEditorSection *section = NMT_EDITOR_SECTION (object);
|
||||||
|
NmtEditorSectionPrivate *priv = NMT_EDITOR_SECTION_GET_PRIVATE (section);
|
||||||
|
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_TITLE:
|
||||||
|
priv->title = g_value_dup_string (value);
|
||||||
|
rebuild_header (section);
|
||||||
|
break;
|
||||||
|
case PROP_SHOW_BY_DEFAULT:
|
||||||
|
priv->show_by_default = g_value_get_boolean (value);
|
||||||
|
nmt_newt_toggle_button_set_active (NMT_NEWT_TOGGLE_BUTTON (priv->toggle),
|
||||||
|
priv->show_by_default);
|
||||||
|
break;
|
||||||
|
case PROP_HEADER_WIDGET:
|
||||||
|
priv->header_widget = g_value_get_object (value);
|
||||||
|
if (priv->header_widget)
|
||||||
|
g_object_ref_sink (priv->header_widget);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
nmt_editor_section_get_property (GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
NmtEditorSectionPrivate *priv = NMT_EDITOR_SECTION_GET_PRIVATE (object);
|
||||||
|
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_TITLE:
|
||||||
|
g_value_set_string (value, priv->title);
|
||||||
|
break;
|
||||||
|
case PROP_SHOW_BY_DEFAULT:
|
||||||
|
g_value_set_boolean (value, priv->show_by_default);
|
||||||
|
break;
|
||||||
|
case PROP_HEADER_WIDGET:
|
||||||
|
g_value_set_object (value, priv->header_widget);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
nmt_editor_section_class_init (NmtEditorSectionClass *section_class)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (section_class);
|
||||||
|
|
||||||
|
g_type_class_add_private (section_class, sizeof (NmtEditorSectionPrivate));
|
||||||
|
|
||||||
|
/* virtual methods */
|
||||||
|
object_class->set_property = nmt_editor_section_set_property;
|
||||||
|
object_class->get_property = nmt_editor_section_get_property;
|
||||||
|
object_class->finalize = nmt_editor_section_finalize;
|
||||||
|
|
||||||
|
/* properties */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NmtEditorSection:title:
|
||||||
|
*
|
||||||
|
* The section's title.
|
||||||
|
*/
|
||||||
|
g_object_class_install_property
|
||||||
|
(object_class, PROP_TITLE,
|
||||||
|
g_param_spec_string ("title", "", "",
|
||||||
|
NULL,
|
||||||
|
G_PARAM_READWRITE |
|
||||||
|
G_PARAM_CONSTRUCT_ONLY |
|
||||||
|
G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NmtEditorSection:show-by-default:
|
||||||
|
*
|
||||||
|
* Whether the section should be expanded by default.
|
||||||
|
*/
|
||||||
|
g_object_class_install_property
|
||||||
|
(object_class, PROP_SHOW_BY_DEFAULT,
|
||||||
|
g_param_spec_boolean ("show-by-default", "", "",
|
||||||
|
TRUE,
|
||||||
|
G_PARAM_READWRITE |
|
||||||
|
G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NmtEditorSection:header-widget:
|
||||||
|
*
|
||||||
|
* The widget (if any) that appears between the section title and its toggle
|
||||||
|
* button.
|
||||||
|
*/
|
||||||
|
g_object_class_install_property
|
||||||
|
(object_class, PROP_HEADER_WIDGET,
|
||||||
|
g_param_spec_object ("header-widget", "", "",
|
||||||
|
NMT_TYPE_NEWT_WIDGET,
|
||||||
|
G_PARAM_READWRITE |
|
||||||
|
G_PARAM_STATIC_STRINGS));
|
||||||
|
}
|
56
clients/tui/nmt-editor-section.h
Normal file
56
clients/tui/nmt-editor-section.h
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/* -*- 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 2013 Red Hat, Inc.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef NMT_EDITOR_SECTION_H
|
||||||
|
#define NMT_EDITOR_SECTION_H
|
||||||
|
|
||||||
|
#include "nmt-newt-section.h"
|
||||||
|
#include "nmt-editor-grid.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define NMT_TYPE_EDITOR_SECTION (nmt_editor_section_get_type ())
|
||||||
|
#define NMT_EDITOR_SECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMT_TYPE_EDITOR_SECTION, NmtEditorSection))
|
||||||
|
#define NMT_EDITOR_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NMT_TYPE_EDITOR_SECTION, NmtEditorSectionClass))
|
||||||
|
#define NMT_IS_EDITOR_SECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NMT_TYPE_EDITOR_SECTION))
|
||||||
|
#define NMT_IS_EDITOR_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NMT_TYPE_EDITOR_SECTION))
|
||||||
|
#define NMT_EDITOR_SECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NMT_TYPE_EDITOR_SECTION, NmtEditorSectionClass))
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
NmtNewtSection parent;
|
||||||
|
|
||||||
|
} NmtEditorSection;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
NmtNewtSectionClass parent;
|
||||||
|
|
||||||
|
} NmtEditorSectionClass;
|
||||||
|
|
||||||
|
GType nmt_editor_section_get_type (void);
|
||||||
|
|
||||||
|
NmtEditorSection *nmt_editor_section_new (const char *title,
|
||||||
|
NmtNewtWidget *header_widget,
|
||||||
|
gboolean show_by_default);
|
||||||
|
|
||||||
|
const char *nmt_editor_section_get_title (NmtEditorSection *section);
|
||||||
|
NmtNewtWidget *nmt_editor_section_get_header_widget (NmtEditorSection *section);
|
||||||
|
NmtEditorGrid *nmt_editor_section_get_body (NmtEditorSection *section);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* NMT_EDITOR_SECTION_H */
|
@@ -64,6 +64,7 @@ typedef struct {
|
|||||||
|
|
||||||
NMEditorConnectionTypeData *type_data;
|
NMEditorConnectionTypeData *type_data;
|
||||||
|
|
||||||
|
GSList *pages;
|
||||||
NmtNewtWidget *ok, *cancel;
|
NmtNewtWidget *ok, *cancel;
|
||||||
gboolean running;
|
gboolean running;
|
||||||
} NmtEditorPrivate;
|
} NmtEditorPrivate;
|
||||||
@@ -266,42 +267,24 @@ permissions_transform_from_allusers (GBinding *binding,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static NmtNewtWidget *
|
static NmtNewtWidget *
|
||||||
add_section_for_page (NmtEditorGrid *grid, NmtNewtWidget *widget)
|
add_sections_for_page (NmtEditor *editor, NmtEditorGrid *grid, NmtEditorPage *page)
|
||||||
{
|
{
|
||||||
NmtEditorPage *page;
|
NmtEditorPrivate *priv = NMT_EDITOR_GET_PRIVATE (editor);
|
||||||
NmtNewtWidget *section, *header, *toggle;
|
NmtNewtWidget *first_section = NULL;
|
||||||
|
const GSList *sections, *iter;
|
||||||
|
|
||||||
g_return_val_if_fail (NMT_IS_EDITOR_PAGE (widget), NULL);
|
g_return_val_if_fail (NMT_IS_EDITOR_PAGE (page), NULL);
|
||||||
g_return_val_if_fail (nmt_newt_widget_get_parent (widget) == NULL, NULL);
|
|
||||||
|
|
||||||
page = NMT_EDITOR_PAGE (widget);
|
priv->pages = g_slist_prepend (priv->pages, page);
|
||||||
|
|
||||||
section = nmt_newt_section_new (TRUE);
|
sections = nmt_editor_page_get_sections (page);
|
||||||
|
for (iter = sections; iter; iter = iter->next) {
|
||||||
|
if (!first_section)
|
||||||
|
first_section = iter->data;
|
||||||
|
nmt_editor_grid_append (grid, NULL, iter->data, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
toggle = nmt_newt_toggle_button_new (_("Hide"), _("Show"));
|
return first_section;
|
||||||
|
|
||||||
header = nmt_editor_grid_new ();
|
|
||||||
nmt_editor_grid_append (NMT_EDITOR_GRID (header),
|
|
||||||
nmt_editor_page_get_title (page),
|
|
||||||
nmt_editor_page_get_header_widget (page),
|
|
||||||
toggle);
|
|
||||||
nmt_editor_grid_set_row_flags (NMT_EDITOR_GRID (header),
|
|
||||||
nmt_editor_page_get_header_widget (page),
|
|
||||||
NMT_EDITOR_GRID_ROW_LABEL_ALIGN_LEFT |
|
|
||||||
NMT_EDITOR_GRID_ROW_EXTRA_ALIGN_RIGHT);
|
|
||||||
nmt_newt_section_set_header (NMT_NEWT_SECTION (section), header);
|
|
||||||
|
|
||||||
nmt_newt_section_set_body (NMT_NEWT_SECTION (section), widget);
|
|
||||||
|
|
||||||
g_object_bind_property (toggle, "active",
|
|
||||||
section, "open",
|
|
||||||
G_BINDING_SYNC_CREATE);
|
|
||||||
|
|
||||||
if (nmt_editor_page_show_by_default (page) || !nmt_newt_widget_get_valid (section))
|
|
||||||
nmt_newt_toggle_button_set_active (NMT_NEWT_TOGGLE_BUTTON (toggle), TRUE);
|
|
||||||
|
|
||||||
nmt_editor_grid_append (grid, NULL, section, NULL);
|
|
||||||
return section;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -362,43 +345,43 @@ nmt_editor_constructed (GObject *object)
|
|||||||
/* Now add the various pages... */
|
/* Now add the various pages... */
|
||||||
|
|
||||||
if (nm_connection_is_type (priv->edit_connection, NM_SETTING_BOND_SETTING_NAME))
|
if (nm_connection_is_type (priv->edit_connection, NM_SETTING_BOND_SETTING_NAME))
|
||||||
add_section_for_page (grid, nmt_page_bond_new (priv->edit_connection, deventry));
|
add_sections_for_page (editor, grid, nmt_page_bond_new (priv->edit_connection, deventry));
|
||||||
else if (nm_connection_is_type (priv->edit_connection, NM_SETTING_BRIDGE_SETTING_NAME))
|
else if (nm_connection_is_type (priv->edit_connection, NM_SETTING_BRIDGE_SETTING_NAME))
|
||||||
add_section_for_page (grid, nmt_page_bridge_new (priv->edit_connection, deventry));
|
add_sections_for_page (editor, grid, nmt_page_bridge_new (priv->edit_connection, deventry));
|
||||||
else if (nm_connection_is_type (priv->edit_connection, NM_SETTING_INFINIBAND_SETTING_NAME))
|
else if (nm_connection_is_type (priv->edit_connection, NM_SETTING_INFINIBAND_SETTING_NAME))
|
||||||
add_section_for_page (grid, nmt_page_infiniband_new (priv->edit_connection, deventry));
|
add_sections_for_page (editor, grid, nmt_page_infiniband_new (priv->edit_connection, deventry));
|
||||||
else if (nm_connection_is_type (priv->edit_connection, NM_SETTING_PPPOE_SETTING_NAME)) {
|
else if (nm_connection_is_type (priv->edit_connection, NM_SETTING_PPPOE_SETTING_NAME)) {
|
||||||
add_section_for_page (grid, nmt_page_dsl_new (priv->edit_connection));
|
add_sections_for_page (editor, grid, nmt_page_dsl_new (priv->edit_connection));
|
||||||
add_section_for_page (grid, nmt_page_ethernet_new (priv->edit_connection, deventry));
|
add_sections_for_page (editor, grid, nmt_page_ethernet_new (priv->edit_connection, deventry));
|
||||||
add_section_for_page (grid, nmt_page_ppp_new (priv->edit_connection));
|
add_sections_for_page (editor, grid, nmt_page_ppp_new (priv->edit_connection));
|
||||||
} else if (nm_connection_is_type (priv->edit_connection, NM_SETTING_TEAM_SETTING_NAME))
|
} else if (nm_connection_is_type (priv->edit_connection, NM_SETTING_TEAM_SETTING_NAME))
|
||||||
add_section_for_page (grid, nmt_page_team_new (priv->edit_connection, deventry));
|
add_sections_for_page (editor, grid, nmt_page_team_new (priv->edit_connection, deventry));
|
||||||
else if (nm_connection_is_type (priv->edit_connection, NM_SETTING_VLAN_SETTING_NAME))
|
else if (nm_connection_is_type (priv->edit_connection, NM_SETTING_VLAN_SETTING_NAME))
|
||||||
add_section_for_page (grid, nmt_page_vlan_new (priv->edit_connection, deventry));
|
add_sections_for_page (editor, grid, nmt_page_vlan_new (priv->edit_connection, deventry));
|
||||||
else if (nm_connection_is_type (priv->edit_connection, NM_SETTING_WIRED_SETTING_NAME))
|
else if (nm_connection_is_type (priv->edit_connection, NM_SETTING_WIRED_SETTING_NAME))
|
||||||
add_section_for_page (grid, nmt_page_ethernet_new (priv->edit_connection, deventry));
|
add_sections_for_page (editor, grid, nmt_page_ethernet_new (priv->edit_connection, deventry));
|
||||||
else if (nm_connection_is_type (priv->edit_connection, NM_SETTING_WIRELESS_SETTING_NAME))
|
else if (nm_connection_is_type (priv->edit_connection, NM_SETTING_WIRELESS_SETTING_NAME))
|
||||||
add_section_for_page (grid, nmt_page_wifi_new (priv->edit_connection, deventry));
|
add_sections_for_page (editor, grid, nmt_page_wifi_new (priv->edit_connection, deventry));
|
||||||
|
|
||||||
nmt_editor_grid_append (grid, NULL, nmt_newt_separator_new (), NULL);
|
nmt_editor_grid_append (grid, NULL, nmt_newt_separator_new (), NULL);
|
||||||
|
|
||||||
slave_type = nm_setting_connection_get_slave_type (s_con);
|
slave_type = nm_setting_connection_get_slave_type (s_con);
|
||||||
if (slave_type) {
|
if (slave_type) {
|
||||||
if (!strcmp (slave_type, NM_SETTING_BRIDGE_SETTING_NAME))
|
if (!strcmp (slave_type, NM_SETTING_BRIDGE_SETTING_NAME))
|
||||||
add_section_for_page (grid, nmt_page_bridge_port_new (priv->edit_connection));
|
add_sections_for_page (editor, grid, nmt_page_bridge_port_new (priv->edit_connection));
|
||||||
else if (!strcmp (slave_type, NM_SETTING_TEAM_SETTING_NAME))
|
else if (!strcmp (slave_type, NM_SETTING_TEAM_SETTING_NAME))
|
||||||
add_section_for_page (grid, nmt_page_team_port_new (priv->edit_connection));
|
add_sections_for_page (editor, grid, nmt_page_team_port_new (priv->edit_connection));
|
||||||
} else {
|
} else {
|
||||||
NmtNewtWidget *section;
|
NmtNewtWidget *section;
|
||||||
|
|
||||||
section = add_section_for_page (grid, nmt_page_ip4_new (priv->edit_connection));
|
section = add_sections_for_page (editor, grid, nmt_page_ip4_new (priv->edit_connection));
|
||||||
|
|
||||||
/* Add a separator between ip4 and ip6 that's only visible if ip4 is open */
|
/* Add a separator between ip4 and ip6 that's only visible if ip4 is open */
|
||||||
widget = nmt_newt_separator_new ();
|
widget = nmt_newt_separator_new ();
|
||||||
g_object_bind_property (section, "open", widget, "visible", G_BINDING_SYNC_CREATE);
|
g_object_bind_property (section, "open", widget, "visible", G_BINDING_SYNC_CREATE);
|
||||||
nmt_editor_grid_append (grid, NULL, widget, NULL);
|
nmt_editor_grid_append (grid, NULL, widget, NULL);
|
||||||
|
|
||||||
add_section_for_page (grid, nmt_page_ip6_new (priv->edit_connection));
|
add_sections_for_page (editor, grid, nmt_page_ip6_new (priv->edit_connection));
|
||||||
|
|
||||||
nmt_editor_grid_append (grid, NULL, nmt_newt_separator_new (), NULL);
|
nmt_editor_grid_append (grid, NULL, nmt_newt_separator_new (), NULL);
|
||||||
}
|
}
|
||||||
@@ -446,6 +429,8 @@ nmt_editor_finalize (GObject *object)
|
|||||||
g_clear_object (&priv->orig_connection);
|
g_clear_object (&priv->orig_connection);
|
||||||
g_clear_object (&priv->edit_connection);
|
g_clear_object (&priv->edit_connection);
|
||||||
|
|
||||||
|
g_slist_free_full (priv->pages, g_object_unref);
|
||||||
|
|
||||||
g_clear_object (&priv->ok);
|
g_clear_object (&priv->ok);
|
||||||
g_clear_object (&priv->cancel);
|
g_clear_object (&priv->cancel);
|
||||||
|
|
||||||
|
@@ -64,13 +64,12 @@ typedef struct {
|
|||||||
gboolean updating;
|
gboolean updating;
|
||||||
} NmtPageBondPrivate;
|
} NmtPageBondPrivate;
|
||||||
|
|
||||||
NmtNewtWidget *
|
NmtEditorPage *
|
||||||
nmt_page_bond_new (NMConnection *conn,
|
nmt_page_bond_new (NMConnection *conn,
|
||||||
NmtDeviceEntry *deventry)
|
NmtDeviceEntry *deventry)
|
||||||
{
|
{
|
||||||
return g_object_new (NMT_TYPE_PAGE_BOND,
|
return g_object_new (NMT_TYPE_PAGE_BOND,
|
||||||
"connection", conn,
|
"connection", conn,
|
||||||
"title", _("BOND"),
|
|
||||||
"device-entry", deventry,
|
"device-entry", deventry,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
@@ -338,6 +337,7 @@ nmt_page_bond_constructed (GObject *object)
|
|||||||
{
|
{
|
||||||
NmtPageBond *bond = NMT_PAGE_BOND (object);
|
NmtPageBond *bond = NMT_PAGE_BOND (object);
|
||||||
NmtPageBondPrivate *priv = NMT_PAGE_BOND_GET_PRIVATE (bond);
|
NmtPageBondPrivate *priv = NMT_PAGE_BOND_GET_PRIVATE (bond);
|
||||||
|
NmtEditorSection *section;
|
||||||
NmtEditorGrid *grid;
|
NmtEditorGrid *grid;
|
||||||
NMSettingBond *s_bond;
|
NMSettingBond *s_bond;
|
||||||
NmtNewtWidget *widget, *label;
|
NmtNewtWidget *widget, *label;
|
||||||
@@ -351,7 +351,8 @@ nmt_page_bond_constructed (GObject *object)
|
|||||||
}
|
}
|
||||||
priv->s_bond = s_bond;
|
priv->s_bond = s_bond;
|
||||||
|
|
||||||
grid = NMT_EDITOR_GRID (bond);
|
section = nmt_editor_section_new (_("BOND"), NULL, TRUE);
|
||||||
|
grid = nmt_editor_section_get_body (section);
|
||||||
|
|
||||||
widget = nmt_newt_separator_new ();
|
widget = nmt_newt_separator_new ();
|
||||||
nmt_editor_grid_append (grid, _("Slaves"), widget, NULL);
|
nmt_editor_grid_append (grid, _("Slaves"), widget, NULL);
|
||||||
@@ -420,6 +421,8 @@ nmt_page_bond_constructed (GObject *object)
|
|||||||
bond_options_changed (G_OBJECT (s_bond), NULL, bond);
|
bond_options_changed (G_OBJECT (s_bond), NULL, bond);
|
||||||
slaves_changed (G_OBJECT (priv->slaves), NULL, bond);
|
slaves_changed (G_OBJECT (priv->slaves), NULL, bond);
|
||||||
|
|
||||||
|
nmt_editor_page_add_section (NMT_EDITOR_PAGE (bond), section);
|
||||||
|
|
||||||
G_OBJECT_CLASS (nmt_page_bond_parent_class)->constructed (object);
|
G_OBJECT_CLASS (nmt_page_bond_parent_class)->constructed (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ typedef struct {
|
|||||||
|
|
||||||
GType nmt_page_bond_get_type (void);
|
GType nmt_page_bond_get_type (void);
|
||||||
|
|
||||||
NmtNewtWidget *nmt_page_bond_new (NMConnection *conn,
|
NmtEditorPage *nmt_page_bond_new (NMConnection *conn,
|
||||||
NmtDeviceEntry *deventry);
|
NmtDeviceEntry *deventry);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@@ -30,12 +30,11 @@
|
|||||||
|
|
||||||
G_DEFINE_TYPE (NmtPageBridgePort, nmt_page_bridge_port, NMT_TYPE_EDITOR_PAGE)
|
G_DEFINE_TYPE (NmtPageBridgePort, nmt_page_bridge_port, NMT_TYPE_EDITOR_PAGE)
|
||||||
|
|
||||||
NmtNewtWidget *
|
NmtEditorPage *
|
||||||
nmt_page_bridge_port_new (NMConnection *conn)
|
nmt_page_bridge_port_new (NMConnection *conn)
|
||||||
{
|
{
|
||||||
return g_object_new (NMT_TYPE_PAGE_BRIDGE_PORT,
|
return g_object_new (NMT_TYPE_PAGE_BRIDGE_PORT,
|
||||||
"connection", conn,
|
"connection", conn,
|
||||||
"title", _("BRIDGE PORT"),
|
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,6 +47,7 @@ static void
|
|||||||
nmt_page_bridge_port_constructed (GObject *object)
|
nmt_page_bridge_port_constructed (GObject *object)
|
||||||
{
|
{
|
||||||
NmtPageBridgePort *bridge = NMT_PAGE_BRIDGE_PORT (object);
|
NmtPageBridgePort *bridge = NMT_PAGE_BRIDGE_PORT (object);
|
||||||
|
NmtEditorSection *section;
|
||||||
NmtEditorGrid *grid;
|
NmtEditorGrid *grid;
|
||||||
NMSettingBridgePort *s_port;
|
NMSettingBridgePort *s_port;
|
||||||
NmtNewtWidget *widget;
|
NmtNewtWidget *widget;
|
||||||
@@ -60,7 +60,8 @@ nmt_page_bridge_port_constructed (GObject *object)
|
|||||||
s_port = nm_connection_get_setting_bridge_port (conn);
|
s_port = nm_connection_get_setting_bridge_port (conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
grid = NMT_EDITOR_GRID (bridge);
|
section = nmt_editor_section_new (_("BRIDGE PORT"), NULL, TRUE);
|
||||||
|
grid = nmt_editor_section_get_body (section);
|
||||||
|
|
||||||
widget = nmt_newt_entry_numeric_new (10, 0, 63);
|
widget = nmt_newt_entry_numeric_new (10, 0, 63);
|
||||||
g_object_bind_property (s_port, NM_SETTING_BRIDGE_PORT_PRIORITY,
|
g_object_bind_property (s_port, NM_SETTING_BRIDGE_PORT_PRIORITY,
|
||||||
@@ -80,6 +81,8 @@ nmt_page_bridge_port_constructed (GObject *object)
|
|||||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||||
nmt_editor_grid_append (grid, NULL, widget, NULL);
|
nmt_editor_grid_append (grid, NULL, widget, NULL);
|
||||||
|
|
||||||
|
nmt_editor_page_add_section (NMT_EDITOR_PAGE (bridge), section);
|
||||||
|
|
||||||
G_OBJECT_CLASS (nmt_page_bridge_port_parent_class)->constructed (object);
|
G_OBJECT_CLASS (nmt_page_bridge_port_parent_class)->constructed (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ typedef struct {
|
|||||||
|
|
||||||
GType nmt_page_bridge_port_get_type (void);
|
GType nmt_page_bridge_port_get_type (void);
|
||||||
|
|
||||||
NmtNewtWidget *nmt_page_bridge_port_new (NMConnection *conn);
|
NmtEditorPage *nmt_page_bridge_port_new (NMConnection *conn);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@@ -33,13 +33,12 @@
|
|||||||
|
|
||||||
G_DEFINE_TYPE (NmtPageBridge, nmt_page_bridge, NMT_TYPE_EDITOR_PAGE_DEVICE)
|
G_DEFINE_TYPE (NmtPageBridge, nmt_page_bridge, NMT_TYPE_EDITOR_PAGE_DEVICE)
|
||||||
|
|
||||||
NmtNewtWidget *
|
NmtEditorPage *
|
||||||
nmt_page_bridge_new (NMConnection *conn,
|
nmt_page_bridge_new (NMConnection *conn,
|
||||||
NmtDeviceEntry *deventry)
|
NmtDeviceEntry *deventry)
|
||||||
{
|
{
|
||||||
return g_object_new (NMT_TYPE_PAGE_BRIDGE,
|
return g_object_new (NMT_TYPE_PAGE_BRIDGE,
|
||||||
"connection", conn,
|
"connection", conn,
|
||||||
"title", _("BRIDGE"),
|
|
||||||
"device-entry", deventry,
|
"device-entry", deventry,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
@@ -62,6 +61,7 @@ static void
|
|||||||
nmt_page_bridge_constructed (GObject *object)
|
nmt_page_bridge_constructed (GObject *object)
|
||||||
{
|
{
|
||||||
NmtPageBridge *bridge = NMT_PAGE_BRIDGE (object);
|
NmtPageBridge *bridge = NMT_PAGE_BRIDGE (object);
|
||||||
|
NmtEditorSection *section;
|
||||||
NmtEditorGrid *grid;
|
NmtEditorGrid *grid;
|
||||||
NMSettingBridge *s_bridge;
|
NMSettingBridge *s_bridge;
|
||||||
NmtNewtWidget *widget, *label, *stp;
|
NmtNewtWidget *widget, *label, *stp;
|
||||||
@@ -74,7 +74,8 @@ nmt_page_bridge_constructed (GObject *object)
|
|||||||
s_bridge = nm_connection_get_setting_bridge (conn);
|
s_bridge = nm_connection_get_setting_bridge (conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
grid = NMT_EDITOR_GRID (bridge);
|
section = nmt_editor_section_new (_("BRIDGE"), NULL, TRUE);
|
||||||
|
grid = nmt_editor_section_get_body (section);
|
||||||
|
|
||||||
widget = nmt_newt_separator_new ();
|
widget = nmt_newt_separator_new ();
|
||||||
nmt_editor_grid_append (grid, _("Slaves"), widget, NULL);
|
nmt_editor_grid_append (grid, _("Slaves"), widget, NULL);
|
||||||
@@ -135,6 +136,8 @@ nmt_page_bridge_constructed (GObject *object)
|
|||||||
label = nmt_newt_label_new (_("seconds"));
|
label = nmt_newt_label_new (_("seconds"));
|
||||||
nmt_editor_grid_append (grid, _("Max age"), widget, label);
|
nmt_editor_grid_append (grid, _("Max age"), widget, label);
|
||||||
|
|
||||||
|
nmt_editor_page_add_section (NMT_EDITOR_PAGE (bridge), section);
|
||||||
|
|
||||||
G_OBJECT_CLASS (nmt_page_bridge_parent_class)->constructed (object);
|
G_OBJECT_CLASS (nmt_page_bridge_parent_class)->constructed (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ typedef struct {
|
|||||||
|
|
||||||
GType nmt_page_bridge_get_type (void);
|
GType nmt_page_bridge_get_type (void);
|
||||||
|
|
||||||
NmtNewtWidget *nmt_page_bridge_new (NMConnection *conn,
|
NmtEditorPage *nmt_page_bridge_new (NMConnection *conn,
|
||||||
NmtDeviceEntry *deventry);
|
NmtDeviceEntry *deventry);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@@ -31,12 +31,11 @@
|
|||||||
|
|
||||||
G_DEFINE_TYPE (NmtPageDsl, nmt_page_dsl, NMT_TYPE_EDITOR_PAGE)
|
G_DEFINE_TYPE (NmtPageDsl, nmt_page_dsl, NMT_TYPE_EDITOR_PAGE)
|
||||||
|
|
||||||
NmtNewtWidget *
|
NmtEditorPage *
|
||||||
nmt_page_dsl_new (NMConnection *conn)
|
nmt_page_dsl_new (NMConnection *conn)
|
||||||
{
|
{
|
||||||
return g_object_new (NMT_TYPE_PAGE_DSL,
|
return g_object_new (NMT_TYPE_PAGE_DSL,
|
||||||
"connection", conn,
|
"connection", conn,
|
||||||
"title", _("DSL"),
|
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,6 +48,7 @@ static void
|
|||||||
nmt_page_dsl_constructed (GObject *object)
|
nmt_page_dsl_constructed (GObject *object)
|
||||||
{
|
{
|
||||||
NmtPageDsl *dsl = NMT_PAGE_DSL (object);
|
NmtPageDsl *dsl = NMT_PAGE_DSL (object);
|
||||||
|
NmtEditorSection *section;
|
||||||
NmtEditorGrid *grid;
|
NmtEditorGrid *grid;
|
||||||
NMSettingPppoe *s_pppoe;
|
NMSettingPppoe *s_pppoe;
|
||||||
NmtNewtWidget *widget;
|
NmtNewtWidget *widget;
|
||||||
@@ -61,7 +61,8 @@ nmt_page_dsl_constructed (GObject *object)
|
|||||||
s_pppoe = nm_connection_get_setting_pppoe (conn);
|
s_pppoe = nm_connection_get_setting_pppoe (conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
grid = NMT_EDITOR_GRID (dsl);
|
section = nmt_editor_section_new (_("DSL"), NULL, TRUE);
|
||||||
|
grid = nmt_editor_section_get_body (section);
|
||||||
|
|
||||||
widget = nmt_newt_entry_new (40, 0);
|
widget = nmt_newt_entry_new (40, 0);
|
||||||
nmt_editor_grid_append (grid, _("Username"), widget, NULL);
|
nmt_editor_grid_append (grid, _("Username"), widget, NULL);
|
||||||
@@ -81,6 +82,8 @@ nmt_page_dsl_constructed (GObject *object)
|
|||||||
widget, "text",
|
widget, "text",
|
||||||
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
|
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
|
||||||
|
|
||||||
|
nmt_editor_page_add_section (NMT_EDITOR_PAGE (dsl), section);
|
||||||
|
|
||||||
G_OBJECT_CLASS (nmt_page_dsl_parent_class)->constructed (object);
|
G_OBJECT_CLASS (nmt_page_dsl_parent_class)->constructed (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ typedef struct {
|
|||||||
|
|
||||||
GType nmt_page_dsl_get_type (void);
|
GType nmt_page_dsl_get_type (void);
|
||||||
|
|
||||||
NmtNewtWidget *nmt_page_dsl_new (NMConnection *conn);
|
NmtEditorPage *nmt_page_dsl_new (NMConnection *conn);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@@ -32,15 +32,13 @@
|
|||||||
|
|
||||||
G_DEFINE_TYPE (NmtPageEthernet, nmt_page_ethernet, NMT_TYPE_EDITOR_PAGE_DEVICE)
|
G_DEFINE_TYPE (NmtPageEthernet, nmt_page_ethernet, NMT_TYPE_EDITOR_PAGE_DEVICE)
|
||||||
|
|
||||||
NmtNewtWidget *
|
NmtEditorPage *
|
||||||
nmt_page_ethernet_new (NMConnection *conn,
|
nmt_page_ethernet_new (NMConnection *conn,
|
||||||
NmtDeviceEntry *deventry)
|
NmtDeviceEntry *deventry)
|
||||||
{
|
{
|
||||||
return g_object_new (NMT_TYPE_PAGE_ETHERNET,
|
return g_object_new (NMT_TYPE_PAGE_ETHERNET,
|
||||||
"connection", conn,
|
"connection", conn,
|
||||||
"title", _("ETHERNET"),
|
|
||||||
"device-entry", deventry,
|
"device-entry", deventry,
|
||||||
"show-by-default", FALSE,
|
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,6 +52,7 @@ nmt_page_ethernet_constructed (GObject *object)
|
|||||||
{
|
{
|
||||||
NmtPageEthernet *ethernet = NMT_PAGE_ETHERNET (object);
|
NmtPageEthernet *ethernet = NMT_PAGE_ETHERNET (object);
|
||||||
NmtDeviceEntry *deventry;
|
NmtDeviceEntry *deventry;
|
||||||
|
NmtEditorSection *section;
|
||||||
NmtEditorGrid *grid;
|
NmtEditorGrid *grid;
|
||||||
NMSettingWired *s_wired;
|
NMSettingWired *s_wired;
|
||||||
NmtNewtWidget *widget;
|
NmtNewtWidget *widget;
|
||||||
@@ -71,7 +70,8 @@ nmt_page_ethernet_constructed (GObject *object)
|
|||||||
deventry, "mac-address",
|
deventry, "mac-address",
|
||||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||||
|
|
||||||
grid = NMT_EDITOR_GRID (ethernet);
|
section = nmt_editor_section_new (_("ETHERNET"), NULL, FALSE);
|
||||||
|
grid = nmt_editor_section_get_body (section);
|
||||||
|
|
||||||
widget = nmt_mac_entry_new (40, ETH_ALEN);
|
widget = nmt_mac_entry_new (40, ETH_ALEN);
|
||||||
g_object_bind_property (s_wired, NM_SETTING_WIRED_CLONED_MAC_ADDRESS,
|
g_object_bind_property (s_wired, NM_SETTING_WIRED_CLONED_MAC_ADDRESS,
|
||||||
@@ -85,6 +85,8 @@ nmt_page_ethernet_constructed (GObject *object)
|
|||||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||||
nmt_editor_grid_append (grid, _("MTU"), widget, NULL);
|
nmt_editor_grid_append (grid, _("MTU"), widget, NULL);
|
||||||
|
|
||||||
|
nmt_editor_page_add_section (NMT_EDITOR_PAGE (ethernet), section);
|
||||||
|
|
||||||
G_OBJECT_CLASS (nmt_page_ethernet_parent_class)->constructed (object);
|
G_OBJECT_CLASS (nmt_page_ethernet_parent_class)->constructed (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ typedef struct {
|
|||||||
|
|
||||||
GType nmt_page_ethernet_get_type (void);
|
GType nmt_page_ethernet_get_type (void);
|
||||||
|
|
||||||
NmtNewtWidget *nmt_page_ethernet_new (NMConnection *conn,
|
NmtEditorPage *nmt_page_ethernet_new (NMConnection *conn,
|
||||||
NmtDeviceEntry *deventry);
|
NmtDeviceEntry *deventry);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@@ -31,13 +31,12 @@
|
|||||||
|
|
||||||
G_DEFINE_TYPE (NmtPageInfiniband, nmt_page_infiniband, NMT_TYPE_EDITOR_PAGE_DEVICE)
|
G_DEFINE_TYPE (NmtPageInfiniband, nmt_page_infiniband, NMT_TYPE_EDITOR_PAGE_DEVICE)
|
||||||
|
|
||||||
NmtNewtWidget *
|
NmtEditorPage *
|
||||||
nmt_page_infiniband_new (NMConnection *conn,
|
nmt_page_infiniband_new (NMConnection *conn,
|
||||||
NmtDeviceEntry *deventry)
|
NmtDeviceEntry *deventry)
|
||||||
{
|
{
|
||||||
return g_object_new (NMT_TYPE_PAGE_INFINIBAND,
|
return g_object_new (NMT_TYPE_PAGE_INFINIBAND,
|
||||||
"connection", conn,
|
"connection", conn,
|
||||||
"title", _("INFINIBAND"),
|
|
||||||
"device-entry", deventry,
|
"device-entry", deventry,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
@@ -58,6 +57,7 @@ nmt_page_infiniband_constructed (GObject *object)
|
|||||||
{
|
{
|
||||||
NmtPageInfiniband *infiniband = NMT_PAGE_INFINIBAND (object);
|
NmtPageInfiniband *infiniband = NMT_PAGE_INFINIBAND (object);
|
||||||
NmtDeviceEntry *deventry;
|
NmtDeviceEntry *deventry;
|
||||||
|
NmtEditorSection *section;
|
||||||
NmtEditorGrid *grid;
|
NmtEditorGrid *grid;
|
||||||
NMSettingInfiniband *s_ib;
|
NMSettingInfiniband *s_ib;
|
||||||
NmtNewtWidget *widget;
|
NmtNewtWidget *widget;
|
||||||
@@ -81,7 +81,8 @@ nmt_page_infiniband_constructed (GObject *object)
|
|||||||
deventry, "mac-address",
|
deventry, "mac-address",
|
||||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||||
|
|
||||||
grid = NMT_EDITOR_GRID (infiniband);
|
section = nmt_editor_section_new (_("INFINIBAND"), NULL, TRUE);
|
||||||
|
grid = nmt_editor_section_get_body (section);
|
||||||
|
|
||||||
widget = nmt_newt_popup_new (transport_mode);
|
widget = nmt_newt_popup_new (transport_mode);
|
||||||
g_object_bind_property (s_ib, NM_SETTING_INFINIBAND_TRANSPORT_MODE,
|
g_object_bind_property (s_ib, NM_SETTING_INFINIBAND_TRANSPORT_MODE,
|
||||||
@@ -95,6 +96,8 @@ nmt_page_infiniband_constructed (GObject *object)
|
|||||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||||
nmt_editor_grid_append (grid, _("MTU"), widget, NULL);
|
nmt_editor_grid_append (grid, _("MTU"), widget, NULL);
|
||||||
|
|
||||||
|
nmt_editor_page_add_section (NMT_EDITOR_PAGE (infiniband), section);
|
||||||
|
|
||||||
G_OBJECT_CLASS (nmt_page_infiniband_parent_class)->constructed (object);
|
G_OBJECT_CLASS (nmt_page_infiniband_parent_class)->constructed (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ typedef struct {
|
|||||||
|
|
||||||
GType nmt_page_infiniband_get_type (void);
|
GType nmt_page_infiniband_get_type (void);
|
||||||
|
|
||||||
NmtNewtWidget *nmt_page_infiniband_new (NMConnection *conn,
|
NmtEditorPage *nmt_page_infiniband_new (NMConnection *conn,
|
||||||
NmtDeviceEntry *deventry);
|
NmtDeviceEntry *deventry);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@@ -46,29 +46,14 @@ static NmtNewtPopupEntry ip4methods[] = {
|
|||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
NmtNewtWidget *
|
NmtEditorPage *
|
||||||
nmt_page_ip4_new (NMConnection *conn)
|
nmt_page_ip4_new (NMConnection *conn)
|
||||||
{
|
{
|
||||||
return g_object_new (NMT_TYPE_PAGE_IP4,
|
return g_object_new (NMT_TYPE_PAGE_IP4,
|
||||||
"connection", conn,
|
"connection", conn,
|
||||||
"title", _("IPv4 CONFIGURATION"),
|
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
nmt_page_ip4_show_by_default (NmtEditorPage *page)
|
|
||||||
{
|
|
||||||
NMConnection *conn;
|
|
||||||
NMSettingIPConfig *s_ip4;
|
|
||||||
|
|
||||||
conn = nmt_editor_page_get_connection (page);
|
|
||||||
s_ip4 = nm_connection_get_setting_ip4_config (conn);
|
|
||||||
if ( !g_strcmp0 (nm_setting_ip_config_get_method (s_ip4), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)
|
|
||||||
|| nm_setting_ip_config_get_num_addresses (s_ip4))
|
|
||||||
return TRUE;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nmt_page_ip4_init (NmtPageIP4 *ip4)
|
nmt_page_ip4_init (NmtPageIP4 *ip4)
|
||||||
{
|
{
|
||||||
@@ -114,6 +99,8 @@ static void
|
|||||||
nmt_page_ip4_constructed (GObject *object)
|
nmt_page_ip4_constructed (GObject *object)
|
||||||
{
|
{
|
||||||
NmtPageIP4 *ip4 = NMT_PAGE_IP4 (object);
|
NmtPageIP4 *ip4 = NMT_PAGE_IP4 (object);
|
||||||
|
gboolean show_by_default;
|
||||||
|
NmtEditorSection *section;
|
||||||
NmtEditorGrid *grid;
|
NmtEditorGrid *grid;
|
||||||
NMSettingIPConfig *s_ip4;
|
NMSettingIPConfig *s_ip4;
|
||||||
NmtNewtWidget *widget, *button;
|
NmtNewtWidget *widget, *button;
|
||||||
@@ -133,9 +120,16 @@ nmt_page_ip4_constructed (GObject *object)
|
|||||||
g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_METHOD,
|
g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_METHOD,
|
||||||
widget, "active-id",
|
widget, "active-id",
|
||||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||||
nmt_editor_page_set_header_widget (NMT_EDITOR_PAGE (ip4), widget);
|
|
||||||
|
|
||||||
grid = NMT_EDITOR_GRID (ip4);
|
if (!g_strcmp0 (nm_setting_ip_config_get_method (s_ip4), NM_SETTING_IP4_CONFIG_METHOD_MANUAL))
|
||||||
|
show_by_default = TRUE;
|
||||||
|
else if (nm_setting_ip_config_get_num_addresses (s_ip4))
|
||||||
|
show_by_default = TRUE;
|
||||||
|
else
|
||||||
|
show_by_default = FALSE;
|
||||||
|
|
||||||
|
section = nmt_editor_section_new (_("IPv4 CONFIGURATION"), widget, show_by_default);
|
||||||
|
grid = nmt_editor_section_get_body (section);
|
||||||
|
|
||||||
widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP4_WITH_PREFIX);
|
widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP4_WITH_PREFIX);
|
||||||
nm_editor_bind_ip_addresses_with_prefix_to_strv (AF_INET,
|
nm_editor_bind_ip_addresses_with_prefix_to_strv (AF_INET,
|
||||||
@@ -194,6 +188,8 @@ nmt_page_ip4_constructed (GObject *object)
|
|||||||
G_BINDING_INVERT_BOOLEAN);
|
G_BINDING_INVERT_BOOLEAN);
|
||||||
nmt_editor_grid_append (grid, NULL, widget, NULL);
|
nmt_editor_grid_append (grid, NULL, widget, NULL);
|
||||||
|
|
||||||
|
nmt_editor_page_add_section (NMT_EDITOR_PAGE (ip4), section);
|
||||||
|
|
||||||
G_OBJECT_CLASS (nmt_page_ip4_parent_class)->constructed (object);
|
G_OBJECT_CLASS (nmt_page_ip4_parent_class)->constructed (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,9 +197,6 @@ static void
|
|||||||
nmt_page_ip4_class_init (NmtPageIP4Class *ip4_class)
|
nmt_page_ip4_class_init (NmtPageIP4Class *ip4_class)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (ip4_class);
|
GObjectClass *object_class = G_OBJECT_CLASS (ip4_class);
|
||||||
NmtEditorPageClass *page_class = NMT_EDITOR_PAGE_CLASS (ip4_class);
|
|
||||||
|
|
||||||
object_class->constructed = nmt_page_ip4_constructed;
|
object_class->constructed = nmt_page_ip4_constructed;
|
||||||
|
|
||||||
page_class->show_by_default = nmt_page_ip4_show_by_default;
|
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,7 @@ typedef struct {
|
|||||||
|
|
||||||
GType nmt_page_ip4_get_type (void);
|
GType nmt_page_ip4_get_type (void);
|
||||||
|
|
||||||
NmtNewtWidget *nmt_page_ip4_new (NMConnection *conn);
|
NmtEditorPage *nmt_page_ip4_new (NMConnection *conn);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@@ -46,29 +46,14 @@ static NmtNewtPopupEntry ip6methods[] = {
|
|||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
NmtNewtWidget *
|
NmtEditorPage *
|
||||||
nmt_page_ip6_new (NMConnection *conn)
|
nmt_page_ip6_new (NMConnection *conn)
|
||||||
{
|
{
|
||||||
return g_object_new (NMT_TYPE_PAGE_IP6,
|
return g_object_new (NMT_TYPE_PAGE_IP6,
|
||||||
"connection", conn,
|
"connection", conn,
|
||||||
"title", _("IPv6 CONFIGURATION"),
|
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
nmt_page_ip6_show_by_default (NmtEditorPage *page)
|
|
||||||
{
|
|
||||||
NMConnection *conn;
|
|
||||||
NMSettingIPConfig *s_ip6;
|
|
||||||
|
|
||||||
conn = nmt_editor_page_get_connection (page);
|
|
||||||
s_ip6 = nm_connection_get_setting_ip6_config (conn);
|
|
||||||
if ( !g_strcmp0 (nm_setting_ip_config_get_method (s_ip6), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)
|
|
||||||
|| nm_setting_ip_config_get_num_addresses (s_ip6))
|
|
||||||
return TRUE;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nmt_page_ip6_init (NmtPageIP6 *ip6)
|
nmt_page_ip6_init (NmtPageIP6 *ip6)
|
||||||
{
|
{
|
||||||
@@ -114,6 +99,8 @@ static void
|
|||||||
nmt_page_ip6_constructed (GObject *object)
|
nmt_page_ip6_constructed (GObject *object)
|
||||||
{
|
{
|
||||||
NmtPageIP6 *ip6 = NMT_PAGE_IP6 (object);
|
NmtPageIP6 *ip6 = NMT_PAGE_IP6 (object);
|
||||||
|
gboolean show_by_default;
|
||||||
|
NmtEditorSection *section;
|
||||||
NmtEditorGrid *grid;
|
NmtEditorGrid *grid;
|
||||||
NMSettingIPConfig *s_ip6;
|
NMSettingIPConfig *s_ip6;
|
||||||
NmtNewtWidget *widget, *button;
|
NmtNewtWidget *widget, *button;
|
||||||
@@ -133,9 +120,16 @@ nmt_page_ip6_constructed (GObject *object)
|
|||||||
g_object_bind_property (s_ip6, NM_SETTING_IP_CONFIG_METHOD,
|
g_object_bind_property (s_ip6, NM_SETTING_IP_CONFIG_METHOD,
|
||||||
widget, "active-id",
|
widget, "active-id",
|
||||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||||
nmt_editor_page_set_header_widget (NMT_EDITOR_PAGE (ip6), widget);
|
|
||||||
|
|
||||||
grid = NMT_EDITOR_GRID (ip6);
|
if (!g_strcmp0 (nm_setting_ip_config_get_method (s_ip6), NM_SETTING_IP6_CONFIG_METHOD_MANUAL))
|
||||||
|
show_by_default = TRUE;
|
||||||
|
else if (nm_setting_ip_config_get_num_addresses (s_ip6))
|
||||||
|
show_by_default = TRUE;
|
||||||
|
else
|
||||||
|
show_by_default = FALSE;
|
||||||
|
|
||||||
|
section = nmt_editor_section_new (_("IPv6 CONFIGURATION"), widget, show_by_default);
|
||||||
|
grid = nmt_editor_section_get_body (section);
|
||||||
|
|
||||||
widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP6_WITH_PREFIX);
|
widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP6_WITH_PREFIX);
|
||||||
nm_editor_bind_ip_addresses_with_prefix_to_strv (AF_INET6,
|
nm_editor_bind_ip_addresses_with_prefix_to_strv (AF_INET6,
|
||||||
@@ -192,6 +186,8 @@ nmt_page_ip6_constructed (GObject *object)
|
|||||||
G_BINDING_INVERT_BOOLEAN);
|
G_BINDING_INVERT_BOOLEAN);
|
||||||
nmt_editor_grid_append (grid, NULL, widget, NULL);
|
nmt_editor_grid_append (grid, NULL, widget, NULL);
|
||||||
|
|
||||||
|
nmt_editor_page_add_section (NMT_EDITOR_PAGE (ip6), section);
|
||||||
|
|
||||||
G_OBJECT_CLASS (nmt_page_ip6_parent_class)->constructed (object);
|
G_OBJECT_CLASS (nmt_page_ip6_parent_class)->constructed (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,9 +195,6 @@ static void
|
|||||||
nmt_page_ip6_class_init (NmtPageIP6Class *ip6_class)
|
nmt_page_ip6_class_init (NmtPageIP6Class *ip6_class)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (ip6_class);
|
GObjectClass *object_class = G_OBJECT_CLASS (ip6_class);
|
||||||
NmtEditorPageClass *page_class = NMT_EDITOR_PAGE_CLASS (ip6_class);
|
|
||||||
|
|
||||||
object_class->constructed = nmt_page_ip6_constructed;
|
object_class->constructed = nmt_page_ip6_constructed;
|
||||||
|
|
||||||
page_class->show_by_default = nmt_page_ip6_show_by_default;
|
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,7 @@ typedef struct {
|
|||||||
|
|
||||||
GType nmt_page_ip6_get_type (void);
|
GType nmt_page_ip6_get_type (void);
|
||||||
|
|
||||||
NmtNewtWidget *nmt_page_ip6_new (NMConnection *conn);
|
NmtEditorPage *nmt_page_ip6_new (NMConnection *conn);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@@ -41,12 +41,11 @@ typedef struct {
|
|||||||
|
|
||||||
#define NMT_PAGE_PPP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NMT_TYPE_PAGE_PPP, NmtPagePppPrivate))
|
#define NMT_PAGE_PPP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NMT_TYPE_PAGE_PPP, NmtPagePppPrivate))
|
||||||
|
|
||||||
NmtNewtWidget *
|
NmtEditorPage *
|
||||||
nmt_page_ppp_new (NMConnection *conn)
|
nmt_page_ppp_new (NMConnection *conn)
|
||||||
{
|
{
|
||||||
return g_object_new (NMT_TYPE_PAGE_PPP,
|
return g_object_new (NMT_TYPE_PAGE_PPP,
|
||||||
"connection", conn,
|
"connection", conn,
|
||||||
"title", _("PPP CONFIGURATION"),
|
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,11 +110,12 @@ nmt_page_ppp_constructed (GObject *object)
|
|||||||
{
|
{
|
||||||
NmtPagePpp *ppp = NMT_PAGE_PPP (object);
|
NmtPagePpp *ppp = NMT_PAGE_PPP (object);
|
||||||
NmtPagePppPrivate *priv = NMT_PAGE_PPP_GET_PRIVATE (ppp);
|
NmtPagePppPrivate *priv = NMT_PAGE_PPP_GET_PRIVATE (ppp);
|
||||||
|
NmtEditorSection *section;
|
||||||
NmtEditorGrid *grid;
|
NmtEditorGrid *grid;
|
||||||
NMSettingPpp *s_ppp;
|
NMSettingPpp *s_ppp;
|
||||||
NmtNewtWidget *widget, *use_mppe;
|
NmtNewtWidget *widget, *use_mppe;
|
||||||
NmtNewtGrid *auth_grid, *mppe_grid;
|
NmtNewtGrid *auth_grid, *mppe_grid;
|
||||||
NmtNewtSection *section;
|
NmtNewtSection *auth_section, *mppe_section;
|
||||||
NMConnection *conn;
|
NMConnection *conn;
|
||||||
|
|
||||||
conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (ppp));
|
conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (ppp));
|
||||||
@@ -131,20 +131,21 @@ nmt_page_ppp_constructed (GObject *object)
|
|||||||
priv->lcp_echo_failure = 5;
|
priv->lcp_echo_failure = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
grid = NMT_EDITOR_GRID (ppp);
|
section = nmt_editor_section_new (_("PPP CONFIGURATION"), NULL, TRUE);
|
||||||
|
grid = nmt_editor_section_get_body (section);
|
||||||
|
|
||||||
/* Auth methods */
|
/* Auth methods */
|
||||||
widget = nmt_newt_section_new (FALSE);
|
widget = nmt_newt_section_new (FALSE);
|
||||||
section = NMT_NEWT_SECTION (widget);
|
auth_section = NMT_NEWT_SECTION (widget);
|
||||||
g_object_set (section, "open", TRUE, NULL);
|
g_object_set (auth_section, "open", TRUE, NULL);
|
||||||
nmt_editor_grid_append (grid, NULL, widget, NULL);
|
nmt_editor_grid_append (grid, NULL, widget, NULL);
|
||||||
|
|
||||||
widget = nmt_newt_label_new (_("Allowed authentication methods:"));
|
widget = nmt_newt_label_new (_("Allowed authentication methods:"));
|
||||||
nmt_newt_section_set_header (section, widget);
|
nmt_newt_section_set_header (auth_section, widget);
|
||||||
|
|
||||||
widget = nmt_newt_grid_new ();
|
widget = nmt_newt_grid_new ();
|
||||||
auth_grid = NMT_NEWT_GRID (widget);
|
auth_grid = NMT_NEWT_GRID (widget);
|
||||||
nmt_newt_section_set_body (section, widget);
|
nmt_newt_section_set_body (auth_section, widget);
|
||||||
|
|
||||||
widget = nmt_newt_checkbox_new (_("EAP"));
|
widget = nmt_newt_checkbox_new (_("EAP"));
|
||||||
g_object_bind_property (s_ppp, NM_SETTING_PPP_REFUSE_EAP,
|
g_object_bind_property (s_ppp, NM_SETTING_PPP_REFUSE_EAP,
|
||||||
@@ -190,8 +191,8 @@ nmt_page_ppp_constructed (GObject *object)
|
|||||||
|
|
||||||
/* MPPE */
|
/* MPPE */
|
||||||
widget = nmt_newt_section_new (FALSE);
|
widget = nmt_newt_section_new (FALSE);
|
||||||
section = NMT_NEWT_SECTION (widget);
|
mppe_section = NMT_NEWT_SECTION (widget);
|
||||||
g_object_set (section, "open", TRUE, NULL);
|
g_object_set (mppe_section, "open", TRUE, NULL);
|
||||||
nmt_editor_grid_append (grid, NULL, widget, NULL);
|
nmt_editor_grid_append (grid, NULL, widget, NULL);
|
||||||
|
|
||||||
widget = nmt_newt_checkbox_new (_("Use point-to-point encryption (MPPE)"));
|
widget = nmt_newt_checkbox_new (_("Use point-to-point encryption (MPPE)"));
|
||||||
@@ -200,11 +201,11 @@ nmt_page_ppp_constructed (GObject *object)
|
|||||||
G_BINDING_BIDIRECTIONAL |
|
G_BINDING_BIDIRECTIONAL |
|
||||||
G_BINDING_SYNC_CREATE);
|
G_BINDING_SYNC_CREATE);
|
||||||
use_mppe = widget;
|
use_mppe = widget;
|
||||||
nmt_newt_section_set_header (section, widget);
|
nmt_newt_section_set_header (mppe_section, widget);
|
||||||
|
|
||||||
widget = nmt_newt_grid_new ();
|
widget = nmt_newt_grid_new ();
|
||||||
mppe_grid = NMT_NEWT_GRID (widget);
|
mppe_grid = NMT_NEWT_GRID (widget);
|
||||||
nmt_newt_section_set_body (section, widget);
|
nmt_newt_section_set_body (mppe_section, widget);
|
||||||
|
|
||||||
widget = nmt_newt_checkbox_new (_("Require 128-bit encryption"));
|
widget = nmt_newt_checkbox_new (_("Require 128-bit encryption"));
|
||||||
g_object_bind_property (use_mppe, "active",
|
g_object_bind_property (use_mppe, "active",
|
||||||
@@ -271,6 +272,8 @@ nmt_page_ppp_constructed (GObject *object)
|
|||||||
ppp, NULL);
|
ppp, NULL);
|
||||||
nmt_editor_grid_append (grid, NULL, widget, NULL);
|
nmt_editor_grid_append (grid, NULL, widget, NULL);
|
||||||
|
|
||||||
|
nmt_editor_page_add_section (NMT_EDITOR_PAGE (ppp), section);
|
||||||
|
|
||||||
G_OBJECT_CLASS (nmt_page_ppp_parent_class)->constructed (object);
|
G_OBJECT_CLASS (nmt_page_ppp_parent_class)->constructed (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ typedef struct {
|
|||||||
|
|
||||||
GType nmt_page_ppp_get_type (void);
|
GType nmt_page_ppp_get_type (void);
|
||||||
|
|
||||||
NmtNewtWidget *nmt_page_ppp_new (NMConnection *conn);
|
NmtEditorPage *nmt_page_ppp_new (NMConnection *conn);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@@ -37,12 +37,11 @@ typedef struct {
|
|||||||
|
|
||||||
} NmtPageTeamPortPrivate;
|
} NmtPageTeamPortPrivate;
|
||||||
|
|
||||||
NmtNewtWidget *
|
NmtEditorPage *
|
||||||
nmt_page_team_port_new (NMConnection *conn)
|
nmt_page_team_port_new (NMConnection *conn)
|
||||||
{
|
{
|
||||||
return g_object_new (NMT_TYPE_PAGE_TEAM_PORT,
|
return g_object_new (NMT_TYPE_PAGE_TEAM_PORT,
|
||||||
"connection", conn,
|
"connection", conn,
|
||||||
"title", _("TEAM PORT"),
|
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,6 +78,7 @@ nmt_page_team_port_constructed (GObject *object)
|
|||||||
{
|
{
|
||||||
NmtPageTeamPort *team = NMT_PAGE_TEAM_PORT (object);
|
NmtPageTeamPort *team = NMT_PAGE_TEAM_PORT (object);
|
||||||
NmtPageTeamPortPrivate *priv = NMT_PAGE_TEAM_PORT_GET_PRIVATE (team);
|
NmtPageTeamPortPrivate *priv = NMT_PAGE_TEAM_PORT_GET_PRIVATE (team);
|
||||||
|
NmtEditorSection *section;
|
||||||
NmtNewtGrid *grid;
|
NmtNewtGrid *grid;
|
||||||
NMSettingTeamPort *s_port;
|
NMSettingTeamPort *s_port;
|
||||||
NmtNewtWidget *widget;
|
NmtNewtWidget *widget;
|
||||||
@@ -92,8 +92,10 @@ nmt_page_team_port_constructed (GObject *object)
|
|||||||
}
|
}
|
||||||
priv->s_port = s_port;
|
priv->s_port = s_port;
|
||||||
|
|
||||||
|
section = nmt_editor_section_new (_("TEAM PORT"), NULL, TRUE);
|
||||||
|
|
||||||
widget = nmt_newt_grid_new ();
|
widget = nmt_newt_grid_new ();
|
||||||
nmt_editor_grid_append (NMT_EDITOR_GRID (team), NULL, widget, NULL);
|
nmt_editor_grid_append (nmt_editor_section_get_body (section), NULL, widget, NULL);
|
||||||
|
|
||||||
grid = NMT_NEWT_GRID (widget);
|
grid = NMT_NEWT_GRID (widget);
|
||||||
|
|
||||||
@@ -111,6 +113,8 @@ nmt_page_team_port_constructed (GObject *object)
|
|||||||
g_signal_connect (widget, "clicked", G_CALLBACK (edit_clicked), team);
|
g_signal_connect (widget, "clicked", G_CALLBACK (edit_clicked), team);
|
||||||
nmt_newt_grid_add (grid, widget, 0, 4);
|
nmt_newt_grid_add (grid, widget, 0, 4);
|
||||||
|
|
||||||
|
nmt_editor_page_add_section (NMT_EDITOR_PAGE (team), section);
|
||||||
|
|
||||||
G_OBJECT_CLASS (nmt_page_team_port_parent_class)->constructed (object);
|
G_OBJECT_CLASS (nmt_page_team_port_parent_class)->constructed (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ typedef struct {
|
|||||||
|
|
||||||
GType nmt_page_team_port_get_type (void);
|
GType nmt_page_team_port_get_type (void);
|
||||||
|
|
||||||
NmtNewtWidget *nmt_page_team_port_new (NMConnection *conn);
|
NmtEditorPage *nmt_page_team_port_new (NMConnection *conn);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@@ -42,13 +42,12 @@ typedef struct {
|
|||||||
|
|
||||||
} NmtPageTeamPrivate;
|
} NmtPageTeamPrivate;
|
||||||
|
|
||||||
NmtNewtWidget *
|
NmtEditorPage *
|
||||||
nmt_page_team_new (NMConnection *conn,
|
nmt_page_team_new (NMConnection *conn,
|
||||||
NmtDeviceEntry *deventry)
|
NmtDeviceEntry *deventry)
|
||||||
{
|
{
|
||||||
return g_object_new (NMT_TYPE_PAGE_TEAM,
|
return g_object_new (NMT_TYPE_PAGE_TEAM,
|
||||||
"connection", conn,
|
"connection", conn,
|
||||||
"title", _("TEAM"),
|
|
||||||
"device-entry", deventry,
|
"device-entry", deventry,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
@@ -132,6 +131,7 @@ nmt_page_team_constructed (GObject *object)
|
|||||||
{
|
{
|
||||||
NmtPageTeam *team = NMT_PAGE_TEAM (object);
|
NmtPageTeam *team = NMT_PAGE_TEAM (object);
|
||||||
NmtPageTeamPrivate *priv = NMT_PAGE_TEAM_GET_PRIVATE (team);
|
NmtPageTeamPrivate *priv = NMT_PAGE_TEAM_GET_PRIVATE (team);
|
||||||
|
NmtEditorSection *section;
|
||||||
NmtNewtGrid *grid;
|
NmtNewtGrid *grid;
|
||||||
NMSettingTeam *s_team;
|
NMSettingTeam *s_team;
|
||||||
NmtNewtWidget *widget;
|
NmtNewtWidget *widget;
|
||||||
@@ -145,8 +145,10 @@ nmt_page_team_constructed (GObject *object)
|
|||||||
}
|
}
|
||||||
priv->s_team = s_team;
|
priv->s_team = s_team;
|
||||||
|
|
||||||
|
section = nmt_editor_section_new (_("TEAM"), NULL, TRUE);
|
||||||
|
|
||||||
widget = nmt_newt_grid_new ();
|
widget = nmt_newt_grid_new ();
|
||||||
nmt_editor_grid_append (NMT_EDITOR_GRID (team), NULL, widget, NULL);
|
nmt_editor_grid_append (nmt_editor_section_get_body (section), NULL, widget, NULL);
|
||||||
|
|
||||||
grid = NMT_NEWT_GRID (widget);
|
grid = NMT_NEWT_GRID (widget);
|
||||||
|
|
||||||
@@ -175,6 +177,8 @@ nmt_page_team_constructed (GObject *object)
|
|||||||
g_signal_connect (widget, "clicked", G_CALLBACK (edit_clicked), team);
|
g_signal_connect (widget, "clicked", G_CALLBACK (edit_clicked), team);
|
||||||
nmt_newt_grid_add (grid, widget, 0, 4);
|
nmt_newt_grid_add (grid, widget, 0, 4);
|
||||||
|
|
||||||
|
nmt_editor_page_add_section (NMT_EDITOR_PAGE (team), section);
|
||||||
|
|
||||||
G_OBJECT_CLASS (nmt_page_team_parent_class)->constructed (object);
|
G_OBJECT_CLASS (nmt_page_team_parent_class)->constructed (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ typedef struct {
|
|||||||
|
|
||||||
GType nmt_page_team_get_type (void);
|
GType nmt_page_team_get_type (void);
|
||||||
|
|
||||||
NmtNewtWidget *nmt_page_team_new (NMConnection *conn,
|
NmtEditorPage *nmt_page_team_new (NMConnection *conn,
|
||||||
NmtDeviceEntry *deventry);
|
NmtDeviceEntry *deventry);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@@ -42,13 +42,12 @@ typedef struct {
|
|||||||
|
|
||||||
} NmtPageVlanPrivate;
|
} NmtPageVlanPrivate;
|
||||||
|
|
||||||
NmtNewtWidget *
|
NmtEditorPage *
|
||||||
nmt_page_vlan_new (NMConnection *conn,
|
nmt_page_vlan_new (NMConnection *conn,
|
||||||
NmtDeviceEntry *deventry)
|
NmtDeviceEntry *deventry)
|
||||||
{
|
{
|
||||||
return g_object_new (NMT_TYPE_PAGE_VLAN,
|
return g_object_new (NMT_TYPE_PAGE_VLAN,
|
||||||
"connection", conn,
|
"connection", conn,
|
||||||
"title", _("VLAN"),
|
|
||||||
"device-entry", deventry,
|
"device-entry", deventry,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
@@ -72,6 +71,7 @@ nmt_page_vlan_constructed (GObject *object)
|
|||||||
{
|
{
|
||||||
NmtPageVlan *vlan = NMT_PAGE_VLAN (object);
|
NmtPageVlan *vlan = NMT_PAGE_VLAN (object);
|
||||||
NmtPageVlanPrivate *priv = NMT_PAGE_VLAN_GET_PRIVATE (vlan);
|
NmtPageVlanPrivate *priv = NMT_PAGE_VLAN_GET_PRIVATE (vlan);
|
||||||
|
NmtEditorSection *section;
|
||||||
NmtEditorGrid *grid;
|
NmtEditorGrid *grid;
|
||||||
NMSettingWired *s_wired;
|
NMSettingWired *s_wired;
|
||||||
NMSettingVlan *s_vlan;
|
NMSettingVlan *s_vlan;
|
||||||
@@ -94,7 +94,8 @@ nmt_page_vlan_constructed (GObject *object)
|
|||||||
}
|
}
|
||||||
priv->s_wired = g_object_ref_sink (s_wired);
|
priv->s_wired = g_object_ref_sink (s_wired);
|
||||||
|
|
||||||
grid = NMT_EDITOR_GRID (vlan);
|
section = nmt_editor_section_new (_("VLAN"), NULL, TRUE);
|
||||||
|
grid = nmt_editor_section_get_body (section);
|
||||||
|
|
||||||
nm_editor_bind_vlan_name (s_vlan, nm_connection_get_setting_connection (conn));
|
nm_editor_bind_vlan_name (s_vlan, nm_connection_get_setting_connection (conn));
|
||||||
|
|
||||||
@@ -129,6 +130,8 @@ nmt_page_vlan_constructed (GObject *object)
|
|||||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||||
nmt_editor_grid_append (grid, _("MTU"), widget, NULL);
|
nmt_editor_grid_append (grid, _("MTU"), widget, NULL);
|
||||||
|
|
||||||
|
nmt_editor_page_add_section (NMT_EDITOR_PAGE (vlan), section);
|
||||||
|
|
||||||
G_OBJECT_CLASS (nmt_page_vlan_parent_class)->constructed (object);
|
G_OBJECT_CLASS (nmt_page_vlan_parent_class)->constructed (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ typedef struct {
|
|||||||
|
|
||||||
GType nmt_page_vlan_get_type (void);
|
GType nmt_page_vlan_get_type (void);
|
||||||
|
|
||||||
NmtNewtWidget *nmt_page_vlan_new (NMConnection *conn,
|
NmtEditorPage *nmt_page_vlan_new (NMConnection *conn,
|
||||||
NmtDeviceEntry *deventry);
|
NmtDeviceEntry *deventry);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@@ -48,13 +48,12 @@ typedef struct {
|
|||||||
|
|
||||||
} NmtPageWifiPrivate;
|
} NmtPageWifiPrivate;
|
||||||
|
|
||||||
NmtNewtWidget *
|
NmtEditorPage *
|
||||||
nmt_page_wifi_new (NMConnection *conn,
|
nmt_page_wifi_new (NMConnection *conn,
|
||||||
NmtDeviceEntry *deventry)
|
NmtDeviceEntry *deventry)
|
||||||
{
|
{
|
||||||
return g_object_new (NMT_TYPE_PAGE_WIFI,
|
return g_object_new (NMT_TYPE_PAGE_WIFI,
|
||||||
"connection", conn,
|
"connection", conn,
|
||||||
"title", _("WI-FI"),
|
|
||||||
"device-entry", deventry,
|
"device-entry", deventry,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
@@ -184,6 +183,7 @@ nmt_page_wifi_constructed (GObject *object)
|
|||||||
NmtPageWifiPrivate *priv = NMT_PAGE_WIFI_GET_PRIVATE (object);
|
NmtPageWifiPrivate *priv = NMT_PAGE_WIFI_GET_PRIVATE (object);
|
||||||
NmtPageWifi *wifi = NMT_PAGE_WIFI (object);
|
NmtPageWifi *wifi = NMT_PAGE_WIFI (object);
|
||||||
NmtDeviceEntry *deventry;
|
NmtDeviceEntry *deventry;
|
||||||
|
NmtEditorSection *section;
|
||||||
NmtEditorGrid *grid;
|
NmtEditorGrid *grid;
|
||||||
NMSettingWireless *s_wireless;
|
NMSettingWireless *s_wireless;
|
||||||
NMSettingWirelessSecurity *s_wsec;
|
NMSettingWirelessSecurity *s_wsec;
|
||||||
@@ -214,7 +214,8 @@ nmt_page_wifi_constructed (GObject *object)
|
|||||||
deventry, "mac-address",
|
deventry, "mac-address",
|
||||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||||
|
|
||||||
grid = NMT_EDITOR_GRID (wifi);
|
section = nmt_editor_section_new (_("WI-FI"), NULL, TRUE);
|
||||||
|
grid = nmt_editor_section_get_body (section);
|
||||||
|
|
||||||
widget = nmt_newt_entry_new (40, NMT_NEWT_ENTRY_NONEMPTY);
|
widget = nmt_newt_entry_new (40, NMT_NEWT_ENTRY_NONEMPTY);
|
||||||
g_object_bind_property_full (s_wireless, NM_SETTING_WIRELESS_SSID,
|
g_object_bind_property_full (s_wireless, NM_SETTING_WIRELESS_SSID,
|
||||||
@@ -371,6 +372,8 @@ nmt_page_wifi_constructed (GObject *object)
|
|||||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||||
nmt_editor_grid_append (grid, _("MTU"), widget, NULL);
|
nmt_editor_grid_append (grid, _("MTU"), widget, NULL);
|
||||||
|
|
||||||
|
nmt_editor_page_add_section (NMT_EDITOR_PAGE (wifi), section);
|
||||||
|
|
||||||
G_OBJECT_CLASS (nmt_page_wifi_parent_class)->constructed (object);
|
G_OBJECT_CLASS (nmt_page_wifi_parent_class)->constructed (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ typedef struct {
|
|||||||
|
|
||||||
GType nmt_page_wifi_get_type (void);
|
GType nmt_page_wifi_get_type (void);
|
||||||
|
|
||||||
NmtNewtWidget *nmt_page_wifi_new (NMConnection *conn,
|
NmtEditorPage *nmt_page_wifi_new (NMConnection *conn,
|
||||||
NmtDeviceEntry *deventry);
|
NmtDeviceEntry *deventry);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@@ -18,6 +18,7 @@ clients/tui/nm-editor-utils.c
|
|||||||
clients/tui/nmt-connect-connection-list.c
|
clients/tui/nmt-connect-connection-list.c
|
||||||
clients/tui/nmt-device-entry.c
|
clients/tui/nmt-device-entry.c
|
||||||
clients/tui/nmt-edit-connection-list.c
|
clients/tui/nmt-edit-connection-list.c
|
||||||
|
clients/tui/nmt-editor-section.c
|
||||||
clients/tui/nmt-editor.c
|
clients/tui/nmt-editor.c
|
||||||
clients/tui/nmt-mtu-entry.c
|
clients/tui/nmt-mtu-entry.c
|
||||||
clients/tui/nmt-page-bond.c
|
clients/tui/nmt-page-bond.c
|
||||||
|
Reference in New Issue
Block a user