Commit 35cd05eb authored by Lubomir Rintel's avatar Lubomir Rintel

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.
parent c8e90ecd
......@@ -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);
}
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment