diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2018-06-06 22:07:22 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2018-06-19 19:58:03 +0200 |
commit | 35cd05ebb99d32537d6f7bf41c129d09827704d5 (patch) | |
tree | 3e55eed9b2a336ee763ba7fa174c9884c4a98134 | |
parent | c8e90ecd2a88fb077a1a059f061a7abaac7716a2 (diff) | |
download | network-manager-applet-35cd05ebb99d32537d6f7bf41c129d09827704d5.tar.gz |
editor/page: add new-editor signal
This communicates that the page has spawned a new editor (e.g. for editing
slave connections). This will allow the GtkApplication to track the editor
windows.
-rw-r--r-- | src/connection-editor/ce-page.c | 27 | ||||
-rw-r--r-- | src/connection-editor/ce-page.h | 5 | ||||
-rw-r--r-- | src/connection-editor/page-master.c | 8 | ||||
-rw-r--r-- | src/connection-editor/page-vlan.c | 4 |
4 files changed, 35 insertions, 9 deletions
diff --git a/src/connection-editor/ce-page.c b/src/connection-editor/ce-page.c index ee5a74b0..10d80b4c 100644 --- a/src/connection-editor/ce-page.c +++ b/src/connection-editor/ce-page.c @@ -42,6 +42,7 @@ enum { enum { CHANGED, INITIALIZED, + NEW_EDITOR, LAST_SIGNAL }; @@ -769,6 +770,25 @@ ce_page_changed (CEPage *self) g_signal_emit (self, signals[CHANGED], 0); } +NMConnectionEditor * +ce_page_new_editor (CEPage *self, + GtkWindow *parent_window, + NMConnection *connection) +{ + NMConnectionEditor *editor; + + g_return_val_if_fail (CE_IS_PAGE (self), NULL); + + editor = nm_connection_editor_new (parent_window, + connection, + self->client); + if (!editor) + return NULL; + + g_signal_emit (self, signals[NEW_EDITOR], 0, editor); + return editor; +} + static void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) @@ -847,6 +867,13 @@ ce_page_class_init (CEPageClass *page_class) G_SIGNAL_RUN_FIRST, 0, NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_POINTER); + + signals[NEW_EDITOR] = + g_signal_new (CE_PAGE_NEW_EDITOR, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, NULL, + G_TYPE_NONE, 1, G_TYPE_POINTER); } diff --git a/src/connection-editor/ce-page.h b/src/connection-editor/ce-page.h index d02138d1..777c76a5 100644 --- a/src/connection-editor/ce-page.h +++ b/src/connection-editor/ce-page.h @@ -71,6 +71,7 @@ typedef void (*PageNewConnectionFunc) (FUNC_TAG_PAGE_NEW_CONNECTION_IMPL, #define CE_PAGE_CHANGED "changed" #define CE_PAGE_INITIALIZED "initialized" +#define CE_PAGE_NEW_EDITOR "new-editor" typedef struct { GObject parent; @@ -152,6 +153,10 @@ gboolean ce_page_cloned_mac_combo_valid (GtkComboBoxText *combo, int type, const void ce_page_changed (CEPage *self); +NMConnectionEditor *ce_page_new_editor (CEPage *self, + GtkWindow *parent_window, + NMConnection *connection); + void ce_spin_automatic_val (GtkSpinButton *spin, int defvalue); void ce_spin_default_val (GtkSpinButton *spin, int defvalue); diff --git a/src/connection-editor/page-master.c b/src/connection-editor/page-master.c index 118d4d44..26ac5b6c 100644 --- a/src/connection-editor/page-master.c +++ b/src/connection-editor/page-master.c @@ -379,9 +379,7 @@ add_connection (FUNC_TAG_NEW_CONNECTION_RESULT_IMPL, NULL); g_free (name); - editor = nm_connection_editor_new (priv->toplevel, - connection, - CE_PAGE (self)->client); + editor = ce_page_new_editor (CE_PAGE (self), priv->toplevel, connection); if (!editor) return; @@ -444,9 +442,7 @@ edit_clicked (GtkButton *button, gpointer user_data) return; } - editor = nm_connection_editor_new (priv->toplevel, - NM_CONNECTION (connection), - CE_PAGE (self)->client); + editor = ce_page_new_editor (CE_PAGE (self), priv->toplevel, NM_CONNECTION (connection)); if (!editor) return; diff --git a/src/connection-editor/page-vlan.c b/src/connection-editor/page-vlan.c index 18742c23..199a97c1 100644 --- a/src/connection-editor/page-vlan.c +++ b/src/connection-editor/page-vlan.c @@ -242,9 +242,7 @@ edit_parent (FUNC_TAG_NEW_CONNECTION_RESULT_IMPL, NULL); - editor = nm_connection_editor_new (priv->toplevel, - connection, - CE_PAGE (self)->client); + editor = ce_page_new_editor (CE_PAGE (self), priv->toplevel, connection); if (!editor) return; |