summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2018-06-19 19:58:12 +0200
committerLubomir Rintel <lkundrak@v3.sk>2018-06-19 19:58:12 +0200
commit75590abc3f26973bcbb96eaed305d372aed8f9bf (patch)
treefe96865bf8fb4556923e1271471eccc81e7f1ddc
parentf950868f7a658b7e4e69ee7b1b4ad30efc7add7c (diff)
parent4cf6e615ce043b275fd3cc372e0a66c19d4d1618 (diff)
downloadnetwork-manager-applet-75590abc3f26973bcbb96eaed305d372aed8f9bf.tar.gz
merge: branch 'lr/app-windows'
https://gitlab.gnome.org/GNOME/network-manager-applet/merge_requests/5
-rw-r--r--src/connection-editor/ce-page.c106
-rw-r--r--src/connection-editor/ce-page.h16
-rw-r--r--src/connection-editor/main.c63
-rw-r--r--src/connection-editor/nm-connection-editor.c26
-rw-r--r--src/connection-editor/nm-connection-editor.h6
-rw-r--r--src/connection-editor/nm-connection-list.c65
-rw-r--r--src/connection-editor/nm-connection-list.h8
-rw-r--r--src/connection-editor/nm-connection-list.ui2
-rw-r--r--src/connection-editor/page-8021x-security.c7
-rw-r--r--src/connection-editor/page-bluetooth.c7
-rw-r--r--src/connection-editor/page-bond.c7
-rw-r--r--src/connection-editor/page-bridge-port.c7
-rw-r--r--src/connection-editor/page-bridge.c7
-rw-r--r--src/connection-editor/page-dcb.c7
-rw-r--r--src/connection-editor/page-dsl.c7
-rw-r--r--src/connection-editor/page-ethernet.c7
-rw-r--r--src/connection-editor/page-general.c10
-rw-r--r--src/connection-editor/page-infiniband.c7
-rw-r--r--src/connection-editor/page-ip-tunnel.c7
-rw-r--r--src/connection-editor/page-ip4.c7
-rw-r--r--src/connection-editor/page-ip6.c7
-rw-r--r--src/connection-editor/page-macsec.c7
-rw-r--r--src/connection-editor/page-master.c65
-rw-r--r--src/connection-editor/page-mobile.c7
-rw-r--r--src/connection-editor/page-ppp.c7
-rw-r--r--src/connection-editor/page-proxy.c7
-rw-r--r--src/connection-editor/page-team-port.c7
-rw-r--r--src/connection-editor/page-team.c7
-rw-r--r--src/connection-editor/page-vlan.c13
-rw-r--r--src/connection-editor/page-vpn.c7
-rw-r--r--src/connection-editor/page-wifi-security.c7
-rw-r--r--src/connection-editor/page-wifi.c7
32 files changed, 203 insertions, 324 deletions
diff --git a/src/connection-editor/ce-page.c b/src/connection-editor/ce-page.c
index 3c2e1118..10d80b4c 100644
--- a/src/connection-editor/ce-page.c
+++ b/src/connection-editor/ce-page.c
@@ -34,7 +34,6 @@ G_DEFINE_ABSTRACT_TYPE (CEPage, ce_page, G_TYPE_OBJECT)
enum {
PROP_0,
PROP_CONNECTION,
- PROP_INITIALIZED,
PROP_PARENT_WINDOW,
LAST_PROP
@@ -43,6 +42,7 @@ enum {
enum {
CHANGED,
INITIALIZED,
+ NEW_EDITOR,
LAST_SIGNAL
};
@@ -660,13 +660,6 @@ ce_page_get_next_available_name (const GPtrArray *connections, const char *forma
return cname;
}
-static void
-emit_initialized (CEPage *self, GError *error)
-{
- self->initialized = TRUE;
- g_signal_emit (self, signals[INITIALIZED], 0, error);
-}
-
void
ce_page_complete_init (CEPage *self,
const char *setting_name,
@@ -676,27 +669,29 @@ ce_page_complete_init (CEPage *self,
GError *update_error = NULL;
GVariant *setting_dict;
char *dbus_err;
- gboolean ignore_error = FALSE;
g_return_if_fail (self != NULL);
g_return_if_fail (CE_IS_PAGE (self));
if (error) {
+ /* Ignore missing settings errors */
dbus_err = g_dbus_error_get_remote_error (error);
- ignore_error = !g_strcmp0 (dbus_err, "org.freedesktop.NetworkManager.Settings.InvalidSetting")
- || !g_strcmp0 (dbus_err, "org.freedesktop.NetworkManager.Settings.Connection.SettingNotFound")
- || !g_strcmp0 (dbus_err, "org.freedesktop.NetworkManager.AgentManager.NoSecrets");
+ if ( g_strcmp0 (dbus_err, "org.freedesktop.NetworkManager.Settings.InvalidSetting") == 0
+ || g_strcmp0 (dbus_err, "org.freedesktop.NetworkManager.Settings.Connection.SettingNotFound") == 0
+ || g_strcmp0 (dbus_err, "org.freedesktop.NetworkManager.AgentManager.NoSecrets") == 0)
+ g_clear_error (&error);
g_free (dbus_err);
}
- /* Ignore missing settings errors */
- if (error && !ignore_error) {
- emit_initialized (self, error);
- return;
- } else if (!setting_name || !secrets || g_variant_n_children (secrets) == 0) {
+ if (error) {
+ g_warning ("Couldn't fetch secrets: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ if (!setting_name || !secrets || g_variant_n_children (secrets) == 0) {
/* Success, no secrets */
- emit_initialized (self, NULL);
- return;
+ goto out;
}
g_assert (setting_name);
@@ -705,28 +700,22 @@ ce_page_complete_init (CEPage *self,
setting_dict = g_variant_lookup_value (secrets, setting_name, NM_VARIANT_TYPE_SETTING);
if (!setting_dict) {
/* Success, no secrets */
- emit_initialized (self, NULL);
- return;
+ goto out;
}
g_variant_unref (setting_dict);
/* Update the connection with the new secrets */
- if (nm_connection_update_secrets (self->connection,
+ if (!nm_connection_update_secrets (self->connection,
setting_name,
secrets,
&update_error)) {
- /* Success */
- emit_initialized (self, NULL);
- return;
+ g_warning ("Couldn't update the secrets: %s", update_error->message);
+ g_error_free (update_error);
+ goto out;
}
- if (!update_error) {
- g_set_error_literal (&update_error, NMA_ERROR, NMA_ERROR_GENERIC,
- _("Failed to update connection secrets due to an unknown error."));
- }
-
- emit_initialized (self, update_error);
- g_clear_error (&update_error);
+out:
+ g_signal_emit (self, signals[INITIALIZED], 0, NULL);
}
static void
@@ -773,14 +762,6 @@ ce_page_get_title (CEPage *self)
return self->title;
}
-gboolean
-ce_page_get_initialized (CEPage *self)
-{
- g_return_val_if_fail (CE_IS_PAGE (self), FALSE);
-
- return self->initialized;
-}
-
void
ce_page_changed (CEPage *self)
{
@@ -789,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)
@@ -799,9 +799,6 @@ get_property (GObject *object, guint prop_id,
case PROP_CONNECTION:
g_value_set_object (value, self->connection);
break;
- case PROP_INITIALIZED:
- g_value_set_boolean (value, self->initialized);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -850,14 +847,6 @@ ce_page_class_init (CEPageClass *page_class)
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property
- (object_class, PROP_INITIALIZED,
- g_param_spec_boolean (CE_PAGE_INITIALIZED,
- "Initialized",
- "Initialized",
- FALSE,
- G_PARAM_READABLE));
-
- g_object_class_install_property
(object_class, PROP_PARENT_WINDOW,
g_param_spec_pointer (CE_PAGE_PARENT_WINDOW,
"Parent window",
@@ -869,16 +858,21 @@ ce_page_class_init (CEPageClass *page_class)
g_signal_new ("changed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CEPageClass, changed),
- NULL, NULL, NULL,
+ 0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
signals[INITIALIZED] =
- g_signal_new ("initialized",
+ g_signal_new (CE_PAGE_INITIALIZED,
+ G_OBJECT_CLASS_TYPE (object_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,
- G_STRUCT_OFFSET (CEPageClass, initialized),
- NULL, NULL, NULL,
+ 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 5cd1c3df..777c76a5 100644
--- a/src/connection-editor/ce-page.h
+++ b/src/connection-editor/ce-page.h
@@ -67,13 +67,15 @@ typedef void (*PageNewConnectionFunc) (FUNC_TAG_PAGE_NEW_CONNECTION_IMPL,
#define CE_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CE_TYPE_PAGE, CEPageClass))
#define CE_PAGE_CONNECTION "connection"
-#define CE_PAGE_INITIALIZED "initialized"
#define CE_PAGE_PARENT_WINDOW "parent-window"
+#define CE_PAGE_CHANGED "changed"
+#define CE_PAGE_INITIALIZED "initialized"
+#define CE_PAGE_NEW_EDITOR "new-editor"
+
typedef struct {
GObject parent;
- gboolean initialized;
gboolean inter_page_change_running;
GtkBuilder *builder;
GtkWidget *page;
@@ -94,10 +96,6 @@ typedef struct {
gboolean (*ce_page_validate_v) (CEPage *self, NMConnection *connection, GError **error);
gboolean (*last_update) (CEPage *self, NMConnection *connection, GError **error);
gboolean (*inter_page_change) (CEPage *self);
-
- /* Signals */
- void (*changed) (CEPage *self);
- void (*initialized) (CEPage *self, GError *error);
} CEPageClass;
@@ -155,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);
@@ -165,8 +167,6 @@ void ce_page_complete_init (CEPage *self,
GVariant *secrets,
GError *error);
-gboolean ce_page_get_initialized (CEPage *self);
-
char *ce_page_get_next_available_name (const GPtrArray *connections, const char *format);
/* Only for subclasses */
diff --git a/src/connection-editor/main.c b/src/connection-editor/main.c
index 92fdbda7..ce214d17 100644
--- a/src/connection-editor/main.c
+++ b/src/connection-editor/main.c
@@ -33,21 +33,12 @@
#include "connection-helpers.h"
#include "vpn-helpers.h"
+#define CONNECTION_LIST_TAG "nm-connection-list"
+
gboolean nm_ce_keep_above;
/*************************************************/
-static NMConnectionList *
-_get_connection_list (GApplication *application)
-{
- GtkApplication *app = GTK_APPLICATION (application);
- GList *windows = gtk_application_get_windows (app);
-
- /* For now, assume we always have a single application window
- * that is the connection list. */
- return NM_CONNECTION_LIST (windows->data);
-}
-
typedef struct {
gboolean create;
NMConnectionList *list;
@@ -87,10 +78,9 @@ handle_arguments (GApplication *application,
gboolean create,
gboolean show,
const char *edit_uuid,
- const char *import,
- gboolean quit_after)
+ const char *import)
{
- NMConnectionList *list = _get_connection_list (application);
+ NMConnectionList *list = g_object_get_data (G_OBJECT (application), CONNECTION_LIST_TAG);
gboolean show_list = TRUE;
GType ctype = 0;
gs_free char *type_tmp = NULL;
@@ -145,13 +135,6 @@ handle_arguments (GApplication *application,
show_list = FALSE;
}
- /* If only editing a single connection, exit when done with that connection */
- if (show_list == FALSE && quit_after == TRUE) {
- g_signal_connect_swapped (list, "editing-done",
- G_CALLBACK (g_application_quit),
- application);
- }
-
return show_list;
}
@@ -171,7 +154,7 @@ create_activated (GSimpleAction *action, GVariant *parameter, gpointer user_data
{
GApplication *application = G_APPLICATION (user_data);
- handle_arguments (application, NULL, TRUE, FALSE, NULL, NULL, FALSE);
+ handle_arguments (application, NULL, TRUE, FALSE, NULL, NULL);
}
static void
@@ -189,6 +172,25 @@ static GActionEntry app_entries[] =
};
static void
+new_editor_cb (NMConnectionList *list, NMConnectionEditor *new_editor, gpointer user_data)
+{
+ GtkApplication *app = GTK_APPLICATION (user_data);
+
+ gtk_application_add_window (app, nm_connection_editor_get_window (new_editor));
+}
+
+static void
+list_visible_cb (NMConnectionList *list, GParamSpec *pspec, gpointer user_data)
+{
+ GtkApplication *app = GTK_APPLICATION (user_data);
+
+ if (gtk_widget_get_visible (GTK_WIDGET (list)))
+ gtk_application_add_window (app, GTK_WINDOW (list));
+ else
+ gtk_application_remove_window (app, GTK_WINDOW (list));
+}
+
+static void
editor_startup (GApplication *application, gpointer user_data)
{
GtkApplication *app = GTK_APPLICATION (application);
@@ -203,13 +205,17 @@ editor_startup (GApplication *application, gpointer user_data)
g_application_quit (application);
return;
}
- gtk_application_add_window (app, GTK_WINDOW (list));
+
+ g_object_set_data_full (G_OBJECT (application), CONNECTION_LIST_TAG, g_object_ref (list), g_object_unref);
+ g_signal_connect_object (list, NM_CONNECTION_LIST_NEW_EDITOR, G_CALLBACK (new_editor_cb), application, 0);
+ g_signal_connect_object (list, "notify::visible", G_CALLBACK (list_visible_cb), application, 0);
+ g_signal_connect (list, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL);
}
static void
editor_activate (GApplication *application, gpointer user_data)
{
- NMConnectionList *list = _get_connection_list (application);
+ NMConnectionList *list = g_object_get_data (G_OBJECT (application), CONNECTION_LIST_TAG);
nm_connection_list_present (list);
}
@@ -224,7 +230,7 @@ editor_command_line (GApplication *application,
GOptionContext *opt_ctx = NULL;
GError *error = NULL;
gs_free char *type = NULL, *uuid = NULL, *import = NULL;
- gboolean create = FALSE, show = FALSE, keepabove = FALSE;
+ gboolean create = FALSE, show = FALSE;
int ret = 1;
GOptionEntry entries[] = {
{ "type", 't', 0, G_OPTION_ARG_STRING, &type, "Type of connection to show or create", NM_SETTING_WIRED_SETTING_NAME },
@@ -232,10 +238,6 @@ editor_command_line (GApplication *application,
{ "show", 's', 0, G_OPTION_ARG_NONE, &show, "Show a given connection type page", NULL },
{ "edit", 'e', 0, G_OPTION_ARG_STRING, &uuid, "Edit an existing connection with a given UUID", "UUID" },
{ "import", 'i', 0, G_OPTION_ARG_STRING, &import, "Import a VPN connection from given file", NULL },
- /* handled in main but may be passed through here, so we need
- * to parse and ignore it
- */
- { "keep-above", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &keepabove, NULL, NULL },
{ NULL }
};
@@ -256,7 +258,7 @@ editor_command_line (GApplication *application,
type = g_strdup (NM_SETTING_GSM_SETTING_NAME);
}
- if (handle_arguments (application, type, create, show, uuid, import, FALSE))
+ if (handle_arguments (application, type, create, show, uuid, import))
g_application_activate (application);
ret = 0;
@@ -286,6 +288,7 @@ main (int argc, char *argv[])
opt_ctx = g_option_context_new (NULL);
g_option_context_add_main_entries (opt_ctx, entries, NULL);
+ g_option_context_set_ignore_unknown_options (opt_ctx, TRUE);
g_option_context_parse (opt_ctx, &argc, &argv, NULL);
g_option_context_free (opt_ctx);
diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index 98f4b5a7..b0c9ab6f 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -72,6 +72,7 @@ G_DEFINE_TYPE (NMConnectionEditor, nm_connection_editor, G_TYPE_OBJECT)
enum {
EDITOR_DONE,
+ NEW_EDITOR,
EDITOR_LAST_SIGNAL
};
@@ -538,12 +539,18 @@ nm_connection_editor_class_init (NMConnectionEditorClass *klass)
/* Signals */
editor_signals[EDITOR_DONE] =
- g_signal_new ("done",
+ g_signal_new (NM_CONNECTION_EDITOR_DONE,
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (NMConnectionEditorClass, done),
- NULL, NULL, NULL,
+ 0, NULL, NULL, NULL,
G_TYPE_NONE, 1, GTK_TYPE_RESPONSE_TYPE);
+
+ editor_signals[NEW_EDITOR] =
+ g_signal_new (NM_CONNECTION_EDITOR_NEW_EDITOR,
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ 0, NULL, NULL, NULL,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
}
NMConnectionEditor *
@@ -789,6 +796,14 @@ page_initialized (CEPage *page, GError *error, gpointer user_data)
recheck_initialization (editor);
}
+static void
+page_new_editor (CEPage *page, NMConnectionEditor *new_editor, gpointer user_data)
+{
+ NMConnectionEditor *self = NM_CONNECTION_EDITOR (user_data);
+
+ g_signal_emit (self, editor_signals[NEW_EDITOR], 0, new_editor);
+}
+
static void request_secrets (GetSecretsInfo *info);
static void
@@ -897,8 +912,9 @@ add_page (NMConnectionEditor *editor,
GINT_TO_POINTER (g_slist_length (editor->initializing_pages)));
editor->initializing_pages = g_slist_append (editor->initializing_pages, page);
- g_signal_connect (page, "changed", G_CALLBACK (page_changed), editor);
- g_signal_connect (page, "initialized", G_CALLBACK (page_initialized), editor);
+ g_signal_connect (page, CE_PAGE_CHANGED, G_CALLBACK (page_changed), editor);
+ g_signal_connect (page, CE_PAGE_INITIALIZED, G_CALLBACK (page_initialized), editor);
+ g_signal_connect (page, CE_PAGE_NEW_EDITOR, G_CALLBACK (page_new_editor), editor);
}
return !!page;
}
diff --git a/src/connection-editor/nm-connection-editor.h b/src/connection-editor/nm-connection-editor.h
index a072f241..31ed635c 100644
--- a/src/connection-editor/nm-connection-editor.h
+++ b/src/connection-editor/nm-connection-editor.h
@@ -32,6 +32,9 @@
#define NM_IS_CONNECTION_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_CONNECTION_EDITOR))
#define NM_CONNECTION_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_CONNECTION_EDITOR, NMConnectionEditor))
+#define NM_CONNECTION_EDITOR_DONE "done"
+#define NM_CONNECTION_EDITOR_NEW_EDITOR "new-editor"
+
typedef struct GetSecretsInfo GetSecretsInfo;
typedef struct {
@@ -77,9 +80,6 @@ typedef struct {
typedef struct {
GObjectClass parent_class;
-
- /* Signals */
- void (*done) (NMConnectionEditor *editor, gint result, GError *error);
} NMConnectionEditorClass;
typedef enum {
diff --git a/src/connection-editor/nm-connection-list.c b/src/connection-editor/nm-connection-list.c
index d864e1f8..c3d886b6 100644
--- a/src/connection-editor/nm-connection-list.c
+++ b/src/connection-editor/nm-connection-list.c
@@ -38,8 +38,7 @@
extern gboolean nm_ce_keep_above;
enum {
- LIST_DONE,
- EDITING_DONE,
+ NEW_EDITOR,
LIST_LAST_SIGNAL
};
@@ -286,7 +285,14 @@ add_response_cb (NMConnectionEditor *editor, GtkResponseType response, gpointer
delete_slaves_of_connection (list, nm_connection_editor_get_connection (editor));
g_object_unref (editor);
- g_signal_emit (list, list_signals[EDITING_DONE], 0, 0);
+}
+
+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
@@ -298,10 +304,8 @@ really_add_connection (FUNC_TAG_NEW_CONNECTION_RESULT_IMPL,
NMConnectionListPrivate *priv = NM_CONNECTION_LIST_GET_PRIVATE (list);
NMConnectionEditor *editor;
- if (!connection) {
- g_signal_emit (list, list_signals[EDITING_DONE], 0, 0);
+ if (!connection)
return;
- }
if (connection_supports_proxy (connection) && !nm_connection_get_setting_proxy (connection))
nm_connection_add_setting (connection, nm_setting_proxy_new ());
@@ -311,12 +315,13 @@ really_add_connection (FUNC_TAG_NEW_CONNECTION_RESULT_IMPL,
nm_connection_add_setting (connection, nm_setting_ip6_config_new ());
editor = nm_connection_editor_new (GTK_WINDOW (list), connection, priv->client);
- if (!editor) {
- g_signal_emit (list, list_signals[EDITING_DONE], 0, 0);
+ if (!editor)
return;
- }
- g_signal_connect (editor, "done", G_CALLBACK (add_response_cb), list);
+ 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);
}
@@ -355,7 +360,6 @@ edit_done_cb (NMConnectionEditor *editor, GtkResponseType response, gpointer use
}
g_object_unref (editor);
- g_signal_emit (list, list_signals[EDITING_DONE], 0, 0);
}
static void
@@ -376,10 +380,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, "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
@@ -449,15 +457,6 @@ selection_changed_cb (GtkTreeSelection *selection, gpointer user_data)
}
}
-static void
-list_close_cb (GtkDialog *dialog, gpointer user_data)
-{
- g_signal_emit (NM_CONNECTION_LIST (user_data),
- list_signals[LIST_DONE],
- 0,
- GTK_RESPONSE_CLOSE);
-}
-
static gboolean
key_press_cb (GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
@@ -527,21 +526,12 @@ nm_connection_list_class_init (NMConnectionListClass *klass)
object_class->dispose = dispose;
/* Signals */
- list_signals[LIST_DONE] =
- g_signal_new ("done",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (NMConnectionListClass, done),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- list_signals[EDITING_DONE] =
- g_signal_new ("editing-done",
+ list_signals[NEW_EDITOR] =
+ g_signal_new (NM_CONNECTION_LIST_NEW_EDITOR,
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (NMConnectionListClass, done),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1, G_TYPE_INT);
+ 0, NULL, NULL, NULL,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
/* Initialize the widget template */
gtk_widget_class_set_template_from_resource (widget_class,
@@ -557,7 +547,6 @@ nm_connection_list_class_init (NMConnectionListClass *klass)
gtk_widget_class_bind_template_callback (widget_class, add_clicked);
gtk_widget_class_bind_template_callback (widget_class, do_edit);
gtk_widget_class_bind_template_callback (widget_class, delete_clicked);
- gtk_widget_class_bind_template_callback (widget_class, list_close_cb);
gtk_widget_class_bind_template_callback (widget_class, selection_changed_cb);
gtk_widget_class_bind_template_callback (widget_class, key_press_cb);
gtk_widget_class_bind_template_callback (widget_class, start_search);
diff --git a/src/connection-editor/nm-connection-list.h b/src/connection-editor/nm-connection-list.h
index 88f5eef4..a4a9cc0a 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 {
@@ -42,10 +46,6 @@ typedef struct {
typedef struct {
GtkApplicationWindowClass parent_class;
-
- /* Signals */
- void (*done) (NMConnectionList *list, gint result);
- void (*editing_done) (NMConnectionList *list, gint result);
} NMConnectionListClass;
GType nm_connection_list_get_type (void);
diff --git a/src/connection-editor/nm-connection-list.ui b/src/connection-editor/nm-connection-list.ui
index c80c5dd0..24f3c31e 100644
--- a/src/connection-editor/nm-connection-list.ui
+++ b/src/connection-editor/nm-connection-list.ui
@@ -9,7 +9,7 @@
<property name="default_width">600</property>
<property name="default_height">400</property>
<property name="gravity">north-east</property>
- <signal name="destroy" handler="list_close_cb" swapped="no"/>
+ <property name="show_menubar">False</property>
<signal name="key-press-event" handler="key_press_cb" swapped="no"/>
<child>
<object class="GtkBox" id="box">
diff --git a/src/connection-editor/page-8021x-security.c b/src/connection-editor/page-8021x-security.c
index 0348f9c9..bbe614bb 100644
--- a/src/connection-editor/page-8021x-security.c
+++ b/src/connection-editor/page-8021x-security.c
@@ -62,15 +62,12 @@ enable_toggled (GtkToggleButton *button, gpointer user_data)
}
static void
-finish_setup (CEPage8021xSecurity *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPage8021xSecurity *self, gpointer user_data)
{
CEPage *parent = CE_PAGE (self);
CEPage8021xSecurityPrivate *priv = CE_PAGE_8021X_SECURITY_GET_PRIVATE (self);
GtkWidget *parent_container;
- if (error)
- return;
-
priv->security = (WirelessSecurity *) ws_wpa_eap_new (parent->connection, TRUE, FALSE);
if (!priv->security) {
g_warning ("Could not load 802.1X user interface.");
@@ -133,7 +130,7 @@ ce_page_8021x_security_new (NMConnectionEditor *editor,
priv->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
if (priv->initial_have_8021x)
*out_secrets_setting_name = NM_SETTING_802_1X_SETTING_NAME;
diff --git a/src/connection-editor/page-bluetooth.c b/src/connection-editor/page-bluetooth.c
index 5d2fa158..f6a25d85 100644
--- a/src/connection-editor/page-bluetooth.c
+++ b/src/connection-editor/page-bluetooth.c
@@ -89,14 +89,11 @@ stuff_changed (GtkEditable *editable, gpointer user_data)
}
static void
-finish_setup (CEPageBluetooth *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageBluetooth *self, gpointer user_data)
{
CEPage *parent = CE_PAGE (self);
CEPageBluetoothPrivate *priv = CE_PAGE_BLUETOOTH_GET_PRIVATE (self);
- if (error)
- return;
-
populate_ui (self, parent->connection);
g_signal_connect (priv->bdaddr, "changed", G_CALLBACK (stuff_changed), self);
@@ -135,7 +132,7 @@ ce_page_bluetooth_new (NMConnectionEditor *editor,
nm_connection_add_setting (connection, NM_SETTING (priv->setting));
}
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
return CE_PAGE (self);
}
diff --git a/src/connection-editor/page-bond.c b/src/connection-editor/page-bond.c
index 76356cbb..111bbb40 100644
--- a/src/connection-editor/page-bond.c
+++ b/src/connection-editor/page-bond.c
@@ -406,13 +406,10 @@ add_slave (CEPageMaster *master, NewConnectionResultFunc result_func)
}
static void
-finish_setup (CEPageBond *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageBond *self, gpointer user_data)
{
CEPageBondPrivate *priv = CE_PAGE_BOND_GET_PRIVATE (self);
- if (error)
- return;
-
populate_ui (self);
g_signal_connect (priv->mode, "changed", G_CALLBACK (stuff_changed), self);
@@ -460,7 +457,7 @@ ce_page_bond_new (NMConnectionEditor *editor,
}
priv->wired = nm_connection_get_setting_wired (connection);
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
return CE_PAGE (self);
}
diff --git a/src/connection-editor/page-bridge-port.c b/src/connection-editor/page-bridge-port.c
index a7ed6491..f76065ea 100644
--- a/src/connection-editor/page-bridge-port.c
+++ b/src/connection-editor/page-bridge-port.c
@@ -70,13 +70,10 @@ populate_ui (CEPageBridgePort *self)
}
static void
-finish_setup (CEPageBridgePort *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageBridgePort *self, gpointer user_data)
{
CEPageBridgePortPrivate *priv = CE_PAGE_BRIDGE_PORT_GET_PRIVATE (self);
- if (error)
- return;
-
populate_ui (self);
g_signal_connect (priv->priority, "value-changed", G_CALLBACK (stuff_changed), self);
@@ -120,7 +117,7 @@ ce_page_bridge_port_new (NMConnectionEditor *editor,
nm_connection_add_setting (connection, NM_SETTING (priv->setting));
}
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
return CE_PAGE (self);
}
diff --git a/src/connection-editor/page-bridge.c b/src/connection-editor/page-bridge.c
index 1f452633..fc7a6a04 100644
--- a/src/connection-editor/page-bridge.c
+++ b/src/connection-editor/page-bridge.c
@@ -204,11 +204,8 @@ add_slave (CEPageMaster *master, NewConnectionResultFunc result_func)
}
static void
-finish_setup (CEPageBridge *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageBridge *self, gpointer user_data)
{
- if (error)
- return;
-
populate_ui (self);
}
@@ -246,7 +243,7 @@ ce_page_bridge_new (NMConnectionEditor *editor,
nm_connection_add_setting (connection, NM_SETTING (priv->setting));
}
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
return CE_PAGE (self);
}
diff --git a/src/connection-editor/page-dcb.c b/src/connection-editor/page-dcb.c
index e0e26bde..ef146b73 100644
--- a/src/connection-editor/page-dcb.c
+++ b/src/connection-editor/page-dcb.c
@@ -586,16 +586,13 @@ enable_toggled (GtkToggleButton *button, gpointer user_data)
}
static void
-finish_setup (CEPageDcb *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageDcb *self, gpointer user_data)
{
CEPage *parent = CE_PAGE (self);
CEPageDcbPrivate *priv = CE_PAGE_DCB_GET_PRIVATE (self);
NMSettingDcb *s_dcb = nm_connection_get_setting_dcb (parent->connection);
guint i;
- if (error)
- return;
-
gtk_toggle_button_set_active (priv->enabled, priv->initial_have_dcb);
g_signal_connect (priv->enabled, "toggled", G_CALLBACK (enable_toggled), self);
gtk_widget_set_sensitive (GTK_WIDGET (priv->box), priv->initial_have_dcb);
@@ -643,7 +640,7 @@ ce_page_dcb_new (NMConnectionEditor *editor,
} else
priv->options = (NMSettingDcb *) nm_setting_dcb_new ();
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
return CE_PAGE (self);
}
diff --git a/src/connection-editor/page-dsl.c b/src/connection-editor/page-dsl.c
index b07a1b5e..b70f106f 100644
--- a/src/connection-editor/page-dsl.c
+++ b/src/connection-editor/page-dsl.c
@@ -178,14 +178,11 @@ show_password (GtkToggleButton *button, gpointer user_data)
}
static void
-finish_setup (CEPageDsl *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageDsl *self, gpointer user_data)
{
CEPage *parent = CE_PAGE (self);
CEPageDslPrivate *priv = CE_PAGE_DSL_GET_PRIVATE (self);
- if (error)
- return;
-
populate_ui (self, parent->connection);
g_signal_connect (priv->parent, "changed", G_CALLBACK (stuff_changed), self);
@@ -232,7 +229,7 @@ ce_page_dsl_new (NMConnectionEditor *editor,
nm_connection_add_setting (connection, NM_SETTING (priv->setting));
}
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
*out_secrets_setting_name = NM_SETTING_PPPOE_SETTING_NAME;
diff --git a/src/connection-editor/page-ethernet.c b/src/connection-editor/page-ethernet.c
index aea7d128..ddd738de 100644
--- a/src/connection-editor/page-ethernet.c
+++ b/src/connection-editor/page-ethernet.c
@@ -291,15 +291,12 @@ populate_ui (CEPageEthernet *self)
}
static void
-finish_setup (CEPageEthernet *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageEthernet *self, gpointer user_data)
{
CEPage *parent = CE_PAGE (self);
CEPageEthernetPrivate *priv = CE_PAGE_ETHERNET_GET_PRIVATE (self);
GtkWidget *widget;
- if (error)
- return;
-
populate_ui (self);
g_signal_connect (priv->linkneg, "changed", G_CALLBACK (link_special_changed_cb), self);
@@ -370,7 +367,7 @@ ce_page_ethernet_new (NMConnectionEditor *editor,
nm_connection_add_setting (connection, NM_SETTING (priv->setting));
}
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
return CE_PAGE (self);
}
diff --git a/src/connection-editor/page-general.c b/src/connection-editor/page-general.c
index 4641e61d..e6aaec21 100644
--- a/src/connection-editor/page-general.c
+++ b/src/connection-editor/page-general.c
@@ -43,7 +43,6 @@ typedef struct {
GtkListStore *dependent_vpn_store;
GtkWidget *autoconnect;
- GtkWidget *autoconnect_prio_label;
GtkSpinButton *autoconnect_prio;
GtkWidget *all_checkbutton;
@@ -167,7 +166,6 @@ general_private_init (CEPageGeneral *self)
priv->dependent_vpn_store = GTK_LIST_STORE (gtk_builder_get_object (builder, "dependent_vpn_model"));
priv->autoconnect = GTK_WIDGET (gtk_builder_get_object (builder, "connection_autoconnect"));
- priv->autoconnect_prio_label = GTK_WIDGET (gtk_builder_get_object (builder, "autoconnect_prio_label"));
priv->autoconnect_prio = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "autoconnect_prio"));
priv->all_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "system_checkbutton"));
priv->metered_combo = GTK_COMBO_BOX (gtk_builder_get_object (builder, "metered_combo"));
@@ -310,7 +308,6 @@ populate_ui (CEPageGeneral *self)
*/
if (priv->is_vpn) {
gtk_widget_hide (priv->autoconnect);
- gtk_widget_hide (priv->autoconnect_prio_label);
gtk_widget_hide (GTK_WIDGET (priv->autoconnect_prio));
}
@@ -326,14 +323,11 @@ populate_ui (CEPageGeneral *self)
}
static void
-finish_setup (CEPageGeneral *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageGeneral *self, gpointer user_data)
{
CEPageGeneralPrivate *priv = CE_PAGE_GENERAL_GET_PRIVATE (self);
gboolean any_dependent_vpn;
- if (error)
- return;
-
priv->setup_finished = TRUE;
populate_ui (self);
@@ -388,7 +382,7 @@ ce_page_general_new (NMConnectionEditor *editor,
priv->is_vpn = nm_connection_is_type (connection, NM_SETTING_VPN_SETTING_NAME);
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
return CE_PAGE (self);
}
diff --git a/src/connection-editor/page-infiniband.c b/src/connection-editor/page-infiniband.c
index fb9a0694..cc5e307c 100644
--- a/src/connection-editor/page-infiniband.c
+++ b/src/connection-editor/page-infiniband.c
@@ -114,13 +114,10 @@ populate_ui (CEPageInfiniband *self)
}
static void
-finish_setup (CEPageInfiniband *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageInfiniband *self, gpointer user_data)
{
CEPageInfinibandPrivate *priv = CE_PAGE_INFINIBAND_GET_PRIVATE (self);
- if (error)
- return;
-
populate_ui (self);
g_signal_connect (priv->transport_mode, "changed", G_CALLBACK (stuff_changed), self);
@@ -161,7 +158,7 @@ ce_page_infiniband_new (NMConnectionEditor *editor,
nm_connection_add_setting (connection, NM_SETTING (priv->setting));
}
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
return CE_PAGE (self);
}
diff --git a/src/connection-editor/page-ip-tunnel.c b/src/connection-editor/page-ip-tunnel.c
index 0a1ec02d..55499906 100644
--- a/src/connection-editor/page-ip-tunnel.c
+++ b/src/connection-editor/page-ip-tunnel.c
@@ -133,14 +133,11 @@ stuff_changed (GtkEditable *editable, gpointer user_data)
}
static void
-finish_setup (CEPageIPTunnel *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageIPTunnel *self, gpointer user_data)
{
CEPage *parent = CE_PAGE (self);
CEPageIPTunnelPrivate *priv = CE_PAGE_IP_TUNNEL_GET_PRIVATE (self);
- if (error)
- return;
-
populate_ui (self, parent->connection);
g_signal_connect (priv->name, "changed", G_CALLBACK (stuff_changed), self);
@@ -188,7 +185,7 @@ ce_page_ip_tunnel_new (NMConnectionEditor *editor,
nm_connection_add_setting (connection, NM_SETTING (priv->setting));
}
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
return CE_PAGE (self);
}
diff --git a/src/connection-editor/page-ip4.c b/src/connection-editor/page-ip4.c
index fa807dfa..94519ab8 100644
--- a/src/connection-editor/page-ip4.c
+++ b/src/connection-editor/page-ip4.c
@@ -1109,7 +1109,7 @@ cell_error_data_func (GtkTreeViewColumn *tree_column,
}
static void
-finish_setup (CEPageIP4 *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageIP4 *self, gpointer user_data)
{
CEPageIP4Private *priv = CE_PAGE_IP4_GET_PRIVATE (self);
GtkTreeSelection *selection;
@@ -1117,9 +1117,6 @@ finish_setup (CEPageIP4 *self, gpointer unused, GError *error, gpointer user_dat
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
- if (error)
- return;
-
populate_ui (self);
/* IP Address column */
@@ -1240,7 +1237,7 @@ ce_page_ip4_new (NMConnectionEditor *editor,
priv->setting = nm_connection_get_setting_ip4_config (connection);
g_assert (priv->setting);
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
return CE_PAGE (self);
}
diff --git a/src/connection-editor/page-ip6.c b/src/connection-editor/page-ip6.c
index 4fce0d9c..b12966fa 100644
--- a/src/connection-editor/page-ip6.c
+++ b/src/connection-editor/page-ip6.c
@@ -1091,7 +1091,7 @@ cell_error_data_func (GtkTreeViewColumn *tree_column,
}
static void
-finish_setup (CEPageIP6 *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageIP6 *self, gpointer user_data)
{
CEPageIP6Private *priv = CE_PAGE_IP6_GET_PRIVATE (self);
GtkTreeSelection *selection;
@@ -1099,9 +1099,6 @@ finish_setup (CEPageIP6 *self, gpointer unused, GError *error, gpointer user_dat
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
- if (error)
- return;
-
populate_ui (self);
/* IP Address column */
@@ -1222,7 +1219,7 @@ ce_page_ip6_new (NMConnectionEditor *editor,
priv->setting = nm_connection_get_setting_ip6_config (connection);
g_assert (priv->setting);
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
return CE_PAGE (self);
}
diff --git a/src/connection-editor/page-macsec.c b/src/connection-editor/page-macsec.c
index a25cbe9d..929bbb88 100644
--- a/src/connection-editor/page-macsec.c
+++ b/src/connection-editor/page-macsec.c
@@ -147,14 +147,11 @@ stuff_changed (GtkEditable *editable, gpointer user_data)
}
static void
-finish_setup (CEPageMacsec *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageMacsec *self, gpointer user_data)
{
CEPage *parent = CE_PAGE (self);
CEPageMacsecPrivate *priv = CE_PAGE_MACSEC_GET_PRIVATE (self);
- if (error)
- return;
-
populate_ui (self, parent->connection);
g_signal_connect (priv->name, "changed", G_CALLBACK (stuff_changed), self);
@@ -202,7 +199,7 @@ ce_page_macsec_new (NMConnectionEditor *editor,
nm_connection_add_setting (connection, NM_SETTING (priv->setting));
}
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
*out_secrets_setting_name = NM_SETTING_MACSEC_SETTING_NAME;
diff --git a/src/connection-editor/page-master.c b/src/connection-editor/page-master.c
index 40820b3f..32025eee 100644
--- a/src/connection-editor/page-master.c
+++ b/src/connection-editor/page-master.c
@@ -46,17 +46,7 @@ typedef struct {
} CEPageMasterPrivate;
-enum {
- CREATE_CONNECTION,
- CONNECTION_ADDED,
- CONNECTION_REMOVED,
-
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-static void finish_setup (CEPageMaster *self, gpointer unused, GError *error, gpointer user_data);
+static void finish_setup (CEPageMaster *self, gpointer user_data);
enum {
COL_CONNECTION,
@@ -84,7 +74,7 @@ constructed (GObject *object)
{
CEPageMaster *self = CE_PAGE_MASTER (object);
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
G_OBJECT_CLASS (ce_page_master_parent_class)->constructed (object);
}
@@ -158,8 +148,6 @@ connection_removed (NMClient *client,
gtk_list_store_remove (GTK_LIST_STORE (priv->connections_model), &iter);
ce_page_changed (CE_PAGE (self));
-
- g_signal_emit (self, signals[CONNECTION_REMOVED], 0, connection);
}
static void
@@ -312,8 +300,6 @@ connection_added (NMClient *client,
G_CALLBACK (connection_removed), self);
g_signal_connect (connection, NM_CONNECTION_CHANGED,
G_CALLBACK (connection_changed), self);
-
- g_signal_emit (self, signals[CONNECTION_ADDED], 0, connection);
}
static void
@@ -393,15 +379,11 @@ add_connection (FUNC_TAG_NEW_CONNECTION_RESULT_IMPL,
NULL);
g_free (name);
- g_signal_emit (self, signals[CREATE_CONNECTION], 0, connection);
-
- 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;
- g_signal_connect (editor, "done", G_CALLBACK (add_response_cb), self);
+ g_signal_connect (editor, NM_CONNECTION_EDITOR_DONE, G_CALLBACK (add_response_cb), self);
nm_connection_editor_run (editor);
}
@@ -460,13 +442,11 @@ 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;
- g_signal_connect (editor, "done", G_CALLBACK (edit_done_cb), self);
+ g_signal_connect (editor, NM_CONNECTION_EDITOR_DONE, G_CALLBACK (edit_done_cb), self);
nm_connection_editor_run (editor);
}
@@ -531,16 +511,13 @@ populate_ui (CEPageMaster *self)
}
static void
-finish_setup (CEPageMaster *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageMaster *self, gpointer user_data)
{
CEPageMasterPrivate *priv = CE_PAGE_MASTER_GET_PRIVATE (self);
GtkTreeSelection *selection;
GtkBuilder *builder;
NMSettingConnection *s_con;
- if (error)
- return;
-
builder = CE_PAGE (self)->builder;
priv->interface_name = GTK_ENTRY (gtk_builder_get_object (builder, "master_interface"));
@@ -675,34 +652,6 @@ ce_page_master_class_init (CEPageMasterClass *master_class)
parent_class->ce_page_validate_v = ce_page_validate_v;
parent_class->last_update = last_update;
-
- /* Signals */
- signals[CREATE_CONNECTION] =
- g_signal_new ("create-connection",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CEPageMasterClass, create_connection),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- NM_TYPE_CONNECTION);
-
- signals[CONNECTION_ADDED] =
- g_signal_new ("connection-added",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CEPageMasterClass, connection_added),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- NM_TYPE_CONNECTION);
-
- signals[CONNECTION_REMOVED] =
- g_signal_new ("connection-removed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CEPageMasterClass, connection_removed),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- NM_TYPE_CONNECTION);
}
gboolean
diff --git a/src/connection-editor/page-mobile.c b/src/connection-editor/page-mobile.c
index 62cdfa58..7cc7202f 100644
--- a/src/connection-editor/page-mobile.c
+++ b/src/connection-editor/page-mobile.c
@@ -250,14 +250,11 @@ apn_filter_cb (GtkEditable *editable,
}
static void
-finish_setup (CEPageMobile *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageMobile *self, gpointer user_data)
{
CEPage *parent = CE_PAGE (self);
CEPageMobilePrivate *priv = CE_PAGE_MOBILE_GET_PRIVATE (self);
- if (error)
- return;
-
if (NM_IS_SETTING_GSM (priv->setting))
populate_gsm_ui (self, parent->connection);
else if (NM_IS_SETTING_CDMA (priv->setting))
@@ -329,7 +326,7 @@ ce_page_mobile_new (NMConnectionEditor *editor,
return NULL;
}
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
return CE_PAGE (self);
}
diff --git a/src/connection-editor/page-ppp.c b/src/connection-editor/page-ppp.c
index 3bd84a47..dac4d159 100644
--- a/src/connection-editor/page-ppp.c
+++ b/src/connection-editor/page-ppp.c
@@ -251,10 +251,9 @@ populate_ui (CEPagePpp *self, NMConnection *connection)
}
static void
-finish_setup (CEPagePpp *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPagePpp *self, gpointer user_data)
{
- if (!error)
- populate_ui (self, CE_PAGE (self)->connection);
+ populate_ui (self, CE_PAGE (self)->connection);
}
CEPage *
@@ -297,7 +296,7 @@ ce_page_ppp_new (NMConnectionEditor *editor,
g_assert (s_con);
priv->connection_id = g_strdup (nm_setting_connection_get_id (s_con));
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
*out_secrets_setting_name = NM_SETTING_PPP_SETTING_NAME;
diff --git a/src/connection-editor/page-proxy.c b/src/connection-editor/page-proxy.c
index 36ff5908..ef048bc7 100644
--- a/src/connection-editor/page-proxy.c
+++ b/src/connection-editor/page-proxy.c
@@ -179,13 +179,10 @@ populate_ui (CEPageProxy *self)
}
static void
-finish_setup (CEPageProxy *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageProxy *self, gpointer user_data)
{
CEPageProxyPrivate *priv = CE_PAGE_PROXY_GET_PRIVATE (self);
- if (error)
- return;
-
populate_ui (self);
method_changed (priv->method, self);
@@ -227,7 +224,7 @@ ce_page_proxy_new (NMConnectionEditor *editor,
priv->setting = nm_connection_get_setting_proxy (connection);
g_assert (priv->setting);
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
return CE_PAGE (self);
}
diff --git a/src/connection-editor/page-team-port.c b/src/connection-editor/page-team-port.c
index c896551e..f29c1519 100644
--- a/src/connection-editor/page-team-port.c
+++ b/src/connection-editor/page-team-port.c
@@ -623,11 +623,8 @@ populate_ui (CEPageTeamPort *self)
}
static void
-finish_setup (CEPageTeamPort *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageTeamPort *self, gpointer user_data)
{
- if (error)
- return;
-
populate_ui (self);
}
@@ -667,7 +664,7 @@ ce_page_team_port_new (NMConnectionEditor *editor,
nm_connection_add_setting (connection, NM_SETTING (priv->setting));
}
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
return CE_PAGE (self);
}
diff --git a/src/connection-editor/page-team.c b/src/connection-editor/page-team.c
index f4d07824..17bb1234 100644
--- a/src/connection-editor/page-team.c
+++ b/src/connection-editor/page-team.c
@@ -998,13 +998,10 @@ add_slave (CEPageMaster *master, NewConnectionResultFunc result_func)
}
static void
-finish_setup (CEPageTeam *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageTeam *self, gpointer user_data)
{
CEPageTeamPrivate *priv = CE_PAGE_TEAM_GET_PRIVATE (self);
- if (error)
- return;
-
populate_ui (self);
g_signal_connect (priv->mtu, "value-changed", G_CALLBACK (stuff_changed), self);
@@ -1045,7 +1042,7 @@ ce_page_team_new (NMConnectionEditor *editor,
}
priv->wired = nm_connection_get_setting_wired (connection);
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
return CE_PAGE (self);
}
diff --git a/src/connection-editor/page-vlan.c b/src/connection-editor/page-vlan.c
index 4d94f13b..c7977934 100644
--- a/src/connection-editor/page-vlan.c
+++ b/src/connection-editor/page-vlan.c
@@ -242,13 +242,11 @@ 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;
- g_signal_connect (editor, "done", G_CALLBACK (edit_parent_cb), self);
+ g_signal_connect (editor, NM_CONNECTION_EDITOR_DONE, G_CALLBACK (edit_parent_cb), self);
nm_connection_editor_run (editor);
}
@@ -565,11 +563,8 @@ populate_ui (CEPageVlan *self)
}
static void
-finish_setup (CEPageVlan *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageVlan *self, gpointer user_data)
{
- if (error)
- return;
-
populate_ui (self);
}
@@ -607,7 +602,7 @@ ce_page_vlan_new (NMConnectionEditor *editor,
}
priv->s_hw = nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
return CE_PAGE (self);
}
diff --git a/src/connection-editor/page-vpn.c b/src/connection-editor/page-vpn.c
index ab407003..da99f7b3 100644
--- a/src/connection-editor/page-vpn.c
+++ b/src/connection-editor/page-vpn.c
@@ -51,15 +51,12 @@ vpn_plugin_changed_cb (NMVpnEditorPlugin *plugin, CEPageVpn *self)
}
static void
-finish_setup (CEPageVpn *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageVpn *self, gpointer user_data)
{
CEPage *parent = CE_PAGE (self);
CEPageVpnPrivate *priv = CE_PAGE_VPN_GET_PRIVATE (self);
GError *local = NULL;
- if (error)
- return;
-
g_return_if_fail (NM_IS_VPN_EDITOR_PLUGIN (priv->plugin));
priv->editor = nm_vpn_editor_plugin_get_editor (priv->plugin, CE_PAGE (self)->connection, &local);
@@ -123,7 +120,7 @@ ce_page_vpn_new (NMConnectionEditor *editor,
}
priv->plugin = g_object_ref (priv->plugin);
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
*out_secrets_setting_name = NM_SETTING_VPN_SETTING_NAME;
diff --git a/src/connection-editor/page-wifi-security.c b/src/connection-editor/page-wifi-security.c
index 20a14646..701126e4 100644
--- a/src/connection-editor/page-wifi-security.c
+++ b/src/connection-editor/page-wifi-security.c
@@ -292,7 +292,7 @@ security_valid (NMUtilsSecurityType sectype, NM80211Mode mode)
}
static void
-finish_setup (CEPageWifiSecurity *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageWifiSecurity *self, gpointer user_data)
{
CEPage *parent = CE_PAGE (self);
CEPageWifiSecurityPrivate *priv = CE_PAGE_WIFI_SECURITY_GET_PRIVATE (self);
@@ -308,9 +308,6 @@ finish_setup (CEPageWifiSecurity *self, gpointer unused, GError *error, gpointer
GtkComboBox *combo;
GtkCellRenderer *renderer;
- if (error)
- return;
-
s_wireless = nm_connection_get_setting_wireless (connection);
g_assert (s_wireless);
@@ -503,7 +500,7 @@ ce_page_wifi_security_new (NMConnectionEditor *editor,
nm_connection_editor_check_unsupported_properties (editor, (NMSetting *) s_wsec, known_wsec_props);
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
return CE_PAGE (self);
}
diff --git a/src/connection-editor/page-wifi.c b/src/connection-editor/page-wifi.c
index d11ff5bc..1aed7780 100644
--- a/src/connection-editor/page-wifi.c
+++ b/src/connection-editor/page-wifi.c
@@ -396,14 +396,11 @@ populate_ui (CEPageWifi *self)
}
static void
-finish_setup (CEPageWifi *self, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageWifi *self, gpointer user_data)
{
CEPage *parent = CE_PAGE (self);
GtkWidget *widget;
- if (error)
- return;
-
populate_ui (self);
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wifi_tx_power_label"));
@@ -452,7 +449,7 @@ ce_page_wifi_new (NMConnectionEditor *editor,
nm_connection_add_setting (connection, NM_SETTING (priv->setting));
}
- g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL);
return CE_PAGE (self);
}