summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2017-02-20 19:06:37 +0100
committerLubomir Rintel <lkundrak@v3.sk>2017-02-27 11:17:39 +0100
commitc8969dbf8068d7e930fe1f556e1ff3c899c61cc2 (patch)
treebdc58bad4a490264a032f6ee206a8b396a1f6213
parent8fce72360e36cef4551936c64e079fd666f6fd96 (diff)
downloadNetworkManager-c8969dbf8068d7e930fe1f556e1ff3c899c61cc2.tar.gz
tui/editor: notify the pages after the connection is saved
This will make it possible for the pages to commit slave connections when the master connection is saved.
-rw-r--r--clients/tui/nmt-editor-page.c17
-rw-r--r--clients/tui/nmt-editor-page.h3
-rw-r--r--clients/tui/nmt-editor.c12
3 files changed, 32 insertions, 0 deletions
diff --git a/clients/tui/nmt-editor-page.c b/clients/tui/nmt-editor-page.c
index 44abe27317..99475a9199 100644
--- a/clients/tui/nmt-editor-page.c
+++ b/clients/tui/nmt-editor-page.c
@@ -112,6 +112,23 @@ nmt_editor_page_add_section (NmtEditorPage *page,
priv->sections = g_slist_append (priv->sections, g_object_ref_sink (section));
}
+/**
+ * nmt_editor_page_saved:
+ * @page: the #NmtEditorPage
+ *
+ * This method is called when the user saves the connection. It gives
+ * the page a chance to do save its data outside the connections (such as
+ * recommit the slave connections).
+ */
+void
+nmt_editor_page_saved (NmtEditorPage *page)
+{
+ NmtEditorPageClass *editor_page_class = NMT_EDITOR_PAGE_GET_CLASS (page);
+
+ if (editor_page_class->saved)
+ editor_page_class->saved (page);
+}
+
static void
nmt_editor_page_set_property (GObject *object,
guint prop_id,
diff --git a/clients/tui/nmt-editor-page.h b/clients/tui/nmt-editor-page.h
index 8da5ea9f51..ae55128ac6 100644
--- a/clients/tui/nmt-editor-page.h
+++ b/clients/tui/nmt-editor-page.h
@@ -39,6 +39,7 @@ typedef struct {
typedef struct {
GObjectClass parent;
+ void (*saved) (NmtEditorPage *page);
} NmtEditorPageClass;
GType nmt_editor_page_get_type (void);
@@ -47,6 +48,8 @@ NMConnection *nmt_editor_page_get_connection (NmtEditorPage *page);
GSList *nmt_editor_page_get_sections (NmtEditorPage *page);
+void nmt_editor_page_saved (NmtEditorPage *page);
+
/*< protected >*/
void nmt_editor_page_add_section (NmtEditorPage *page,
NmtEditorSection *section);
diff --git a/clients/tui/nmt-editor.c b/clients/tui/nmt-editor.c
index 395e661ae4..515e347171 100644
--- a/clients/tui/nmt-editor.c
+++ b/clients/tui/nmt-editor.c
@@ -146,6 +146,15 @@ connection_added (GObject *client,
}
static void
+page_saved (gpointer data, gpointer user_data)
+{
+ NmtEditorPage *page = data;
+
+ nmt_editor_page_saved (page);
+}
+
+
+static void
save_connection_and_exit (NmtNewtButton *button,
gpointer user_data)
{
@@ -183,6 +192,9 @@ save_connection_and_exit (NmtNewtButton *button,
}
}
+ /* Let the page know that it was saved. */
+ g_slist_foreach (priv->pages, page_saved, NULL);
+
nmt_newt_form_quit (NMT_NEWT_FORM (editor));
}