nmt-editor-page.h \
nmt-editor-page-device.c \
nmt-editor-page-device.h \
+ nmt-editor-section.c \
+ nmt-editor-section.h \
nmt-editor.c \
nmt-editor.h \
nmt-ip-entry.c \
PROP_0,
PROP_DEVICE_ENTRY,
- PROP_SHOW_BY_DEFAULT,
LAST_PROP
};
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
nmt_editor_page_device_set_property (GObject *object,
guint prop_id,
case PROP_DEVICE_ENTRY:
priv->device_entry = g_value_dup_object (value);
break;
- case PROP_SHOW_BY_DEFAULT:
- priv->show_by_default = g_value_get_boolean (value);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case PROP_DEVICE_ENTRY:
g_value_set_object (value, priv->device_entry);
break;
- case PROP_SHOW_BY_DEFAULT:
- g_value_set_boolean (value, priv->show_by_default);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
nmt_editor_page_device_class_init (NmtEditorPageDeviceClass *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));
object_class->get_property = nmt_editor_page_device_get_property;
object_class->finalize = nmt_editor_page_device_finalize;
- page_class->show_by_default = nmt_editor_page_device_show_by_default;
-
/* properties */
g_object_class_install_property
(object_class, PROP_DEVICE_ENTRY,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
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));
}
* @short_description: An #NmtEditor "page"
*
* #NmtEditorPage is the abstract base class for #NmtEditor "pages".
- * Note that despite the name, currently all "page" types except
- * #NmtPageMain are actually displayed as collapsible sections, not
- * separate tabs/forms.
+ * A "page" is a set of related #NmtEditorSections.
*/
#include "config.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))
typedef struct {
- char *title;
- NmtNewtWidget *header_widget;
NMConnection *connection;
+ GSList *sections;
} NmtEditorPagePrivate;
PROP_0,
PROP_CONNECTION,
- PROP_TITLE,
LAST_PROP
};
static void
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
{
NmtEditorPagePrivate *priv = NMT_EDITOR_PAGE_GET_PRIVATE (object);
- g_free (priv->title);
- g_clear_object (&priv->header_widget);
g_clear_object (&priv->connection);
+ g_slist_free_full (priv->sections, g_object_unref);
G_OBJECT_CLASS (nmt_editor_page_parent_class)->finalize (object);
}
}
/**
- * nmt_editor_page_set_header_widget:
+ * nmt_editor_page_get_sections:
* @page: the #NmtEditorPage
- * @widget: an #NmtNewtWidget
*
- * Sets the page's header widget. When displayed as a subpage of
- * #NmtPageMain, this widget will be put into the corresponding
- * #NmtNewtSection's header.
+ * Gets the page's list of sections to display.
*
- * 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.
*/
-void
-nmt_editor_page_set_header_widget (NmtEditorPage *page,
- NmtNewtWidget *widget)
+GSList *
+nmt_editor_page_get_sections (NmtEditorPage *page)
{
NmtEditorPagePrivate *priv = NMT_EDITOR_PAGE_GET_PRIVATE (page);
- g_clear_object (&priv->header_widget);
-
- if (!widget)
- widget = nmt_newt_separator_new ();
- priv->header_widget = g_object_ref_sink (widget);
+ return priv->sections;
}
/**
- * nmt_editor_page_get_header_widget:
+ * nmt_editor_page_add_section:
* @page: the #NmtEditorPage
+ * @section: the #NmtEditorSection
*
- * 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.
+ * Adds a section to the page. This should only be called by #NmtEditorPage
+ * subclasses.
*/
-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)
+void
+nmt_editor_page_add_section (NmtEditorPage *page,
+ NmtEditorSection *section)
{
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);
+ priv->sections = g_slist_append (priv->sections, g_object_ref_sink (section));
}
static void
case PROP_CONNECTION:
priv->connection = g_value_dup_object (value);
break;
- case PROP_TITLE:
- priv->title = g_value_dup_string (value);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case PROP_CONNECTION:
g_value_set_object (value, priv->connection);
break;
- case PROP_TITLE:
- g_value_set_string (value, priv->title);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
object_class->get_property = nmt_editor_page_get_property;
object_class->finalize = nmt_editor_page_finalize;
- page_class->show_by_default = nmt_editor_page_real_show_by_default;
-
/* properties */
/**
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
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));
}
* 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.
+ * Copyright 2013-2014 Red Hat, Inc.
*/
#ifndef NMT_EDITOR_PAGE_H
#include <NetworkManager.h>
#include "nmt-editor-grid.h"
+#include "nmt-editor-section.h"
G_BEGIN_DECLS
#define NMT_EDITOR_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NMT_TYPE_EDITOR_PAGE, NmtEditorPageClass))
typedef struct {
- NmtEditorGrid parent;
+ GObject parent;
} NmtEditorPage;
typedef struct {
- NmtEditorGridClass parent;
+ GObjectClass parent;
- gboolean (*show_by_default) (NmtEditorPage *);
} NmtEditorPageClass;
GType nmt_editor_page_get_type (void);
NMConnection *nmt_editor_page_get_connection (NmtEditorPage *page);
-void nmt_editor_page_set_header_widget (NmtEditorPage *page,
- NmtNewtWidget *widget);
-NmtNewtWidget *nmt_editor_page_get_header_widget (NmtEditorPage *page);
+GSList *nmt_editor_page_get_sections (NmtEditorPage *page);
-const char *nmt_editor_page_get_title (NmtEditorPage *page);
-
-gboolean nmt_editor_page_show_by_default (NmtEditorPage *page);
+/*< protected >*/
+void nmt_editor_page_add_section (NmtEditorPage *page,
+ NmtEditorSection *section);
G_END_DECLS
--- /dev/null
+/* -*- 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));
+}
--- /dev/null
+/* -*- 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 */
NMEditorConnectionTypeData *type_data;
+ GSList *pages;
NmtNewtWidget *ok, *cancel;
gboolean running;
} NmtEditorPrivate;
}
static NmtNewtWidget *
-add_section_for_page (NmtEditorGrid *grid, NmtNewtWidget *widget)
+add_sections_for_page (NmtEditor *editor, NmtEditorGrid *grid, NmtEditorPage *page)
{
- NmtEditorPage *page;
- NmtNewtWidget *section, *header, *toggle;
-
- g_return_val_if_fail (NMT_IS_EDITOR_PAGE (widget), NULL);
- g_return_val_if_fail (nmt_newt_widget_get_parent (widget) == NULL, NULL);
-
- page = NMT_EDITOR_PAGE (widget);
-
- section = nmt_newt_section_new (TRUE);
-
- toggle = nmt_newt_toggle_button_new (_("Hide"), _("Show"));
-
- 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);
+ NmtEditorPrivate *priv = NMT_EDITOR_GET_PRIVATE (editor);
+ NmtNewtWidget *first_section = NULL;
+ const GSList *sections, *iter;
- nmt_newt_section_set_body (NMT_NEWT_SECTION (section), widget);
+ g_return_val_if_fail (NMT_IS_EDITOR_PAGE (page), NULL);
- g_object_bind_property (toggle, "active",
- section, "open",
- G_BINDING_SYNC_CREATE);
+ priv->pages = g_slist_prepend (priv->pages, page);
- 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);
+ 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);
+ }
- nmt_editor_grid_append (grid, NULL, section, NULL);
- return section;
+ return first_section;
}
static void
/* Now add the various pages... */
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))
- 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))
- 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)) {
- add_section_for_page (grid, nmt_page_dsl_new (priv->edit_connection));
- add_section_for_page (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_dsl_new (priv->edit_connection));
+ add_sections_for_page (editor, grid, nmt_page_ethernet_new (priv->edit_connection, deventry));
+ 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))
- 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))
- 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))
- 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))
- 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);
slave_type = nm_setting_connection_get_slave_type (s_con);
if (slave_type) {
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))
- 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 {
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 */
widget = nmt_newt_separator_new ();
g_object_bind_property (section, "open", widget, "visible", G_BINDING_SYNC_CREATE);
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);
}
g_clear_object (&priv->orig_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->cancel);
gboolean updating;
} NmtPageBondPrivate;
-NmtNewtWidget *
+NmtEditorPage *
nmt_page_bond_new (NMConnection *conn,
NmtDeviceEntry *deventry)
{
return g_object_new (NMT_TYPE_PAGE_BOND,
"connection", conn,
- "title", _("BOND"),
"device-entry", deventry,
NULL);
}
{
NmtPageBond *bond = NMT_PAGE_BOND (object);
NmtPageBondPrivate *priv = NMT_PAGE_BOND_GET_PRIVATE (bond);
+ NmtEditorSection *section;
NmtEditorGrid *grid;
NMSettingBond *s_bond;
NmtNewtWidget *widget, *label;
}
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 ();
nmt_editor_grid_append (grid, _("Slaves"), widget, NULL);
bond_options_changed (G_OBJECT (s_bond), 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);
}
GType nmt_page_bond_get_type (void);
-NmtNewtWidget *nmt_page_bond_new (NMConnection *conn,
+NmtEditorPage *nmt_page_bond_new (NMConnection *conn,
NmtDeviceEntry *deventry);
G_END_DECLS
G_DEFINE_TYPE (NmtPageBridgePort, nmt_page_bridge_port, NMT_TYPE_EDITOR_PAGE)
-NmtNewtWidget *
+NmtEditorPage *
nmt_page_bridge_port_new (NMConnection *conn)
{
return g_object_new (NMT_TYPE_PAGE_BRIDGE_PORT,
"connection", conn,
- "title", _("BRIDGE PORT"),
NULL);
}
nmt_page_bridge_port_constructed (GObject *object)
{
NmtPageBridgePort *bridge = NMT_PAGE_BRIDGE_PORT (object);
+ NmtEditorSection *section;
NmtEditorGrid *grid;
NMSettingBridgePort *s_port;
NmtNewtWidget *widget;
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);
g_object_bind_property (s_port, NM_SETTING_BRIDGE_PORT_PRIORITY,
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
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);
}
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_DEFINE_TYPE (NmtPageBridge, nmt_page_bridge, NMT_TYPE_EDITOR_PAGE_DEVICE)
-NmtNewtWidget *
+NmtEditorPage *
nmt_page_bridge_new (NMConnection *conn,
NmtDeviceEntry *deventry)
{
return g_object_new (NMT_TYPE_PAGE_BRIDGE,
"connection", conn,
- "title", _("BRIDGE"),
"device-entry", deventry,
NULL);
}
nmt_page_bridge_constructed (GObject *object)
{
NmtPageBridge *bridge = NMT_PAGE_BRIDGE (object);
+ NmtEditorSection *section;
NmtEditorGrid *grid;
NMSettingBridge *s_bridge;
NmtNewtWidget *widget, *label, *stp;
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 ();
nmt_editor_grid_append (grid, _("Slaves"), widget, NULL);
label = nmt_newt_label_new (_("seconds"));
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);
}
GType nmt_page_bridge_get_type (void);
-NmtNewtWidget *nmt_page_bridge_new (NMConnection *conn,
+NmtEditorPage *nmt_page_bridge_new (NMConnection *conn,
NmtDeviceEntry *deventry);
G_END_DECLS
G_DEFINE_TYPE (NmtPageDsl, nmt_page_dsl, NMT_TYPE_EDITOR_PAGE)
-NmtNewtWidget *
+NmtEditorPage *
nmt_page_dsl_new (NMConnection *conn)
{
return g_object_new (NMT_TYPE_PAGE_DSL,
"connection", conn,
- "title", _("DSL"),
NULL);
}
nmt_page_dsl_constructed (GObject *object)
{
NmtPageDsl *dsl = NMT_PAGE_DSL (object);
+ NmtEditorSection *section;
NmtEditorGrid *grid;
NMSettingPppoe *s_pppoe;
NmtNewtWidget *widget;
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);
nmt_editor_grid_append (grid, _("Username"), widget, NULL);
widget, "text",
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);
}
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_DEFINE_TYPE (NmtPageEthernet, nmt_page_ethernet, NMT_TYPE_EDITOR_PAGE_DEVICE)
-NmtNewtWidget *
+NmtEditorPage *
nmt_page_ethernet_new (NMConnection *conn,
NmtDeviceEntry *deventry)
{
return g_object_new (NMT_TYPE_PAGE_ETHERNET,
"connection", conn,
- "title", _("ETHERNET"),
"device-entry", deventry,
- "show-by-default", FALSE,
NULL);
}
{
NmtPageEthernet *ethernet = NMT_PAGE_ETHERNET (object);
NmtDeviceEntry *deventry;
+ NmtEditorSection *section;
NmtEditorGrid *grid;
NMSettingWired *s_wired;
NmtNewtWidget *widget;
deventry, "mac-address",
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);
g_object_bind_property (s_wired, NM_SETTING_WIRED_CLONED_MAC_ADDRESS,
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
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);
}
GType nmt_page_ethernet_get_type (void);
-NmtNewtWidget *nmt_page_ethernet_new (NMConnection *conn,
+NmtEditorPage *nmt_page_ethernet_new (NMConnection *conn,
NmtDeviceEntry *deventry);
G_END_DECLS
G_DEFINE_TYPE (NmtPageInfiniband, nmt_page_infiniband, NMT_TYPE_EDITOR_PAGE_DEVICE)
-NmtNewtWidget *
+NmtEditorPage *
nmt_page_infiniband_new (NMConnection *conn,
NmtDeviceEntry *deventry)
{
return g_object_new (NMT_TYPE_PAGE_INFINIBAND,
"connection", conn,
- "title", _("INFINIBAND"),
"device-entry", deventry,
NULL);
}
{
NmtPageInfiniband *infiniband = NMT_PAGE_INFINIBAND (object);
NmtDeviceEntry *deventry;
+ NmtEditorSection *section;
NmtEditorGrid *grid;
NMSettingInfiniband *s_ib;
NmtNewtWidget *widget;
deventry, "mac-address",
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);
g_object_bind_property (s_ib, NM_SETTING_INFINIBAND_TRANSPORT_MODE,
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
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);
}
GType nmt_page_infiniband_get_type (void);
-NmtNewtWidget *nmt_page_infiniband_new (NMConnection *conn,
+NmtEditorPage *nmt_page_infiniband_new (NMConnection *conn,
NmtDeviceEntry *deventry);
G_END_DECLS
{ NULL, NULL }
};
-NmtNewtWidget *
+NmtEditorPage *
nmt_page_ip4_new (NMConnection *conn)
{
return g_object_new (NMT_TYPE_PAGE_IP4,
"connection", conn,
- "title", _("IPv4 CONFIGURATION"),
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
nmt_page_ip4_init (NmtPageIP4 *ip4)
{
nmt_page_ip4_constructed (GObject *object)
{
NmtPageIP4 *ip4 = NMT_PAGE_IP4 (object);
+ gboolean show_by_default;
+ NmtEditorSection *section;
NmtEditorGrid *grid;
NMSettingIPConfig *s_ip4;
NmtNewtWidget *widget, *button;
g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_METHOD,
widget, "active-id",
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);
nm_editor_bind_ip_addresses_with_prefix_to_strv (AF_INET,
G_BINDING_INVERT_BOOLEAN);
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);
}
nmt_page_ip4_class_init (NmtPageIP4Class *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;
-
- page_class->show_by_default = nmt_page_ip4_show_by_default;
}
GType nmt_page_ip4_get_type (void);
-NmtNewtWidget *nmt_page_ip4_new (NMConnection *conn);
+NmtEditorPage *nmt_page_ip4_new (NMConnection *conn);
G_END_DECLS
{ NULL, NULL }
};
-NmtNewtWidget *
+NmtEditorPage *
nmt_page_ip6_new (NMConnection *conn)
{
return g_object_new (NMT_TYPE_PAGE_IP6,
"connection", conn,
- "title", _("IPv6 CONFIGURATION"),
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
nmt_page_ip6_init (NmtPageIP6 *ip6)
{
nmt_page_ip6_constructed (GObject *object)
{
NmtPageIP6 *ip6 = NMT_PAGE_IP6 (object);
+ gboolean show_by_default;
+ NmtEditorSection *section;
NmtEditorGrid *grid;
NMSettingIPConfig *s_ip6;
NmtNewtWidget *widget, *button;
g_object_bind_property (s_ip6, NM_SETTING_IP_CONFIG_METHOD,
widget, "active-id",
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);
nm_editor_bind_ip_addresses_with_prefix_to_strv (AF_INET6,
G_BINDING_INVERT_BOOLEAN);
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);
}
nmt_page_ip6_class_init (NmtPageIP6Class *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;
-
- page_class->show_by_default = nmt_page_ip6_show_by_default;
}
GType nmt_page_ip6_get_type (void);
-NmtNewtWidget *nmt_page_ip6_new (NMConnection *conn);
+NmtEditorPage *nmt_page_ip6_new (NMConnection *conn);
G_END_DECLS
#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)
{
return g_object_new (NMT_TYPE_PAGE_PPP,
"connection", conn,
- "title", _("PPP CONFIGURATION"),
NULL);
}
{
NmtPagePpp *ppp = NMT_PAGE_PPP (object);
NmtPagePppPrivate *priv = NMT_PAGE_PPP_GET_PRIVATE (ppp);
+ NmtEditorSection *section;
NmtEditorGrid *grid;
NMSettingPpp *s_ppp;
NmtNewtWidget *widget, *use_mppe;
NmtNewtGrid *auth_grid, *mppe_grid;
- NmtNewtSection *section;
+ NmtNewtSection *auth_section, *mppe_section;
NMConnection *conn;
conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (ppp));
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 */
widget = nmt_newt_section_new (FALSE);
- section = NMT_NEWT_SECTION (widget);
- g_object_set (section, "open", TRUE, NULL);
+ auth_section = NMT_NEWT_SECTION (widget);
+ g_object_set (auth_section, "open", TRUE, NULL);
nmt_editor_grid_append (grid, NULL, widget, NULL);
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 ();
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"));
g_object_bind_property (s_ppp, NM_SETTING_PPP_REFUSE_EAP,
/* MPPE */
widget = nmt_newt_section_new (FALSE);
- section = NMT_NEWT_SECTION (widget);
- g_object_set (section, "open", TRUE, NULL);
+ mppe_section = NMT_NEWT_SECTION (widget);
+ g_object_set (mppe_section, "open", TRUE, NULL);
nmt_editor_grid_append (grid, NULL, widget, NULL);
widget = nmt_newt_checkbox_new (_("Use point-to-point encryption (MPPE)"));
G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE);
use_mppe = widget;
- nmt_newt_section_set_header (section, widget);
+ nmt_newt_section_set_header (mppe_section, widget);
widget = nmt_newt_grid_new ();
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"));
g_object_bind_property (use_mppe, "active",
ppp, 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);
}
GType nmt_page_ppp_get_type (void);
-NmtNewtWidget *nmt_page_ppp_new (NMConnection *conn);
+NmtEditorPage *nmt_page_ppp_new (NMConnection *conn);
G_END_DECLS
} NmtPageTeamPortPrivate;
-NmtNewtWidget *
+NmtEditorPage *
nmt_page_team_port_new (NMConnection *conn)
{
return g_object_new (NMT_TYPE_PAGE_TEAM_PORT,
"connection", conn,
- "title", _("TEAM PORT"),
NULL);
}
{
NmtPageTeamPort *team = NMT_PAGE_TEAM_PORT (object);
NmtPageTeamPortPrivate *priv = NMT_PAGE_TEAM_PORT_GET_PRIVATE (team);
+ NmtEditorSection *section;
NmtNewtGrid *grid;
NMSettingTeamPort *s_port;
NmtNewtWidget *widget;
}
priv->s_port = s_port;
+ section = nmt_editor_section_new (_("TEAM PORT"), NULL, TRUE);
+
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);
g_signal_connect (widget, "clicked", G_CALLBACK (edit_clicked), team);
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);
}
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
} NmtPageTeamPrivate;
-NmtNewtWidget *
+NmtEditorPage *
nmt_page_team_new (NMConnection *conn,
NmtDeviceEntry *deventry)
{
return g_object_new (NMT_TYPE_PAGE_TEAM,
"connection", conn,
- "title", _("TEAM"),
"device-entry", deventry,
NULL);
}
{
NmtPageTeam *team = NMT_PAGE_TEAM (object);
NmtPageTeamPrivate *priv = NMT_PAGE_TEAM_GET_PRIVATE (team);
+ NmtEditorSection *section;
NmtNewtGrid *grid;
NMSettingTeam *s_team;
NmtNewtWidget *widget;
}
priv->s_team = s_team;
+ section = nmt_editor_section_new (_("TEAM"), NULL, TRUE);
+
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);
g_signal_connect (widget, "clicked", G_CALLBACK (edit_clicked), team);
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);
}
GType nmt_page_team_get_type (void);
-NmtNewtWidget *nmt_page_team_new (NMConnection *conn,
+NmtEditorPage *nmt_page_team_new (NMConnection *conn,
NmtDeviceEntry *deventry);
G_END_DECLS
} NmtPageVlanPrivate;
-NmtNewtWidget *
+NmtEditorPage *
nmt_page_vlan_new (NMConnection *conn,
NmtDeviceEntry *deventry)
{
return g_object_new (NMT_TYPE_PAGE_VLAN,
"connection", conn,
- "title", _("VLAN"),
"device-entry", deventry,
NULL);
}
{
NmtPageVlan *vlan = NMT_PAGE_VLAN (object);
NmtPageVlanPrivate *priv = NMT_PAGE_VLAN_GET_PRIVATE (vlan);
+ NmtEditorSection *section;
NmtEditorGrid *grid;
NMSettingWired *s_wired;
NMSettingVlan *s_vlan;
}
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));
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
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);
}
GType nmt_page_vlan_get_type (void);
-NmtNewtWidget *nmt_page_vlan_new (NMConnection *conn,
+NmtEditorPage *nmt_page_vlan_new (NMConnection *conn,
NmtDeviceEntry *deventry);
G_END_DECLS
} NmtPageWifiPrivate;
-NmtNewtWidget *
+NmtEditorPage *
nmt_page_wifi_new (NMConnection *conn,
NmtDeviceEntry *deventry)
{
return g_object_new (NMT_TYPE_PAGE_WIFI,
"connection", conn,
- "title", _("WI-FI"),
"device-entry", deventry,
NULL);
}
NmtPageWifiPrivate *priv = NMT_PAGE_WIFI_GET_PRIVATE (object);
NmtPageWifi *wifi = NMT_PAGE_WIFI (object);
NmtDeviceEntry *deventry;
+ NmtEditorSection *section;
NmtEditorGrid *grid;
NMSettingWireless *s_wireless;
NMSettingWirelessSecurity *s_wsec;
deventry, "mac-address",
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);
g_object_bind_property_full (s_wireless, NM_SETTING_WIRELESS_SSID,
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
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);
}
GType nmt_page_wifi_get_type (void);
-NmtNewtWidget *nmt_page_wifi_new (NMConnection *conn,
+NmtEditorPage *nmt_page_wifi_new (NMConnection *conn,
NmtDeviceEntry *deventry);
G_END_DECLS
clients/tui/nmt-connect-connection-list.c
clients/tui/nmt-device-entry.c
clients/tui/nmt-edit-connection-list.c
+clients/tui/nmt-editor-section.c
clients/tui/nmt-editor.c
clients/tui/nmt-mtu-entry.c
clients/tui/nmt-page-bond.c