diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2018-06-06 22:16:10 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2018-06-19 19:58:03 +0200 |
commit | 37c8d7014705d1593e8e4e57ef12b9a01d0a051c (patch) | |
tree | 0d2d271f95ed8fbcaa88870a5bb1997671b8f7ff | |
parent | 7eb484ecc9c0bbab2ca0033a60fc1fb97ac735c0 (diff) | |
download | network-manager-applet-37c8d7014705d1593e8e4e57ef12b9a01d0a051c.tar.gz |
editor/connection-list: add new-editor signal
This indicates that a new editor window has been opened, for the
purposes of tracking the windows as GtkApplication windows.
-rw-r--r-- | src/connection-editor/nm-connection-list.c | 31 | ||||
-rw-r--r-- | src/connection-editor/nm-connection-list.h | 4 |
2 files changed, 31 insertions, 4 deletions
diff --git a/src/connection-editor/nm-connection-list.c b/src/connection-editor/nm-connection-list.c index 0450c7c8..41a8adce 100644 --- a/src/connection-editor/nm-connection-list.c +++ b/src/connection-editor/nm-connection-list.c @@ -39,6 +39,7 @@ extern gboolean nm_ce_keep_above; enum { EDITING_DONE, + NEW_EDITOR, LIST_LAST_SIGNAL }; @@ -289,6 +290,14 @@ add_response_cb (NMConnectionEditor *editor, GtkResponseType response, gpointer } static void +new_editor_cb (NMConnectionEditor *editor, NMConnectionEditor *new_editor, gpointer user_data) +{ + NMConnectionList *list = user_data; + + g_signal_emit (list, list_signals[NEW_EDITOR], 0, new_editor); +} + +static void really_add_connection (FUNC_TAG_NEW_CONNECTION_RESULT_IMPL, NMConnection *connection, gpointer user_data) @@ -316,6 +325,9 @@ really_add_connection (FUNC_TAG_NEW_CONNECTION_RESULT_IMPL, } g_signal_connect (editor, NM_CONNECTION_EDITOR_DONE, G_CALLBACK (add_response_cb), list); + g_signal_connect (editor, NM_CONNECTION_EDITOR_NEW_EDITOR, G_CALLBACK (new_editor_cb), list); + + g_signal_emit (list, list_signals[NEW_EDITOR], 0, editor); nm_connection_editor_run (editor); } @@ -375,10 +387,14 @@ edit_connection (NMConnectionList *list, NMConnection *connection) editor = nm_connection_editor_new (GTK_WINDOW (list), NM_CONNECTION (connection), priv->client); - if (editor) { - g_signal_connect (editor, NM_CONNECTION_EDITOR_DONE, G_CALLBACK (edit_done_cb), list); - nm_connection_editor_run (editor); - } + if (!editor) + return; + + g_signal_connect (editor, NM_CONNECTION_EDITOR_DONE, G_CALLBACK (edit_done_cb), list); + g_signal_connect (editor, NM_CONNECTION_EDITOR_NEW_EDITOR, G_CALLBACK (new_editor_cb), list); + + g_signal_emit (list, list_signals[NEW_EDITOR], 0, editor); + nm_connection_editor_run (editor); } static void @@ -525,6 +541,13 @@ nm_connection_list_class_init (NMConnectionListClass *klass) NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_INT); + list_signals[NEW_EDITOR] = + g_signal_new (NM_CONNECTION_LIST_NEW_EDITOR, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, NULL, + G_TYPE_NONE, 1, G_TYPE_POINTER); + /* Initialize the widget template */ gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/nm_connection_editor/nm-connection-list.ui"); diff --git a/src/connection-editor/nm-connection-list.h b/src/connection-editor/nm-connection-list.h index 75ecba8d..ad3bae97 100644 --- a/src/connection-editor/nm-connection-list.h +++ b/src/connection-editor/nm-connection-list.h @@ -30,10 +30,14 @@ #include <NetworkManager.h> +#include "nm-connection-editor.h" + #define NM_TYPE_CONNECTION_LIST (nm_connection_list_get_type ()) #define NM_IS_CONNECTION_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_CONNECTION_LIST)) #define NM_CONNECTION_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_CONNECTION_LIST, NMConnectionList)) +#define NM_CONNECTION_LIST_NEW_EDITOR "new-editor" + typedef struct _NMConnectionListPrivate NMConnectionListPrivate; typedef struct { |