summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2011-01-23 03:43:44 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2011-01-24 13:24:28 +0100
commit4c012cf3db721351d7dee3fba0ed498aaea26be3 (patch)
tree21db77fdd4e57991a45b45484751d32c4f827b95
parentf4d19b3427b8f27fe9bda94c6120379d79b13547 (diff)
gtk: add SpiceMainChannel::migration-started
With this signal, it is possible for the client to provide sockets to a migrating session.
-rw-r--r--gtk/channel-main.c27
-rw-r--r--gtk/spice-session.c17
2 files changed, 44 insertions, 0 deletions
diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 992f999..1ec5193 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -104,6 +104,7 @@ enum {
SPICE_MAIN_CLIPBOARD_GRAB,
SPICE_MAIN_CLIPBOARD_REQUEST,
SPICE_MAIN_CLIPBOARD_RELEASE,
+ SPICE_MIGRATION_STARTED,
SPICE_MAIN_LAST_SIGNAL,
};
@@ -454,6 +455,29 @@ static void spice_main_channel_class_init(SpiceMainChannelClass *klass)
G_TYPE_NONE,
0);
+ /**
+ * SpiceMainChannel::migration-started:
+ * @main: the #SpiceMainChannel that emitted the signal
+ * @session: a migration #SpiceSession
+ *
+ * Inform when migration is starting. Application wishing to make
+ * connections themself can set the #SpiceSession:client-sockets
+ * to @TRUE, then follow #SpiceSession::channel-new creation, and
+ * use spice_channel_open_fd() once the socket is created.
+ *
+ **/
+ signals[SPICE_MIGRATION_STARTED] =
+ g_signal_new("migration-started",
+ G_OBJECT_CLASS_TYPE(gobject_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_OBJECT);
+
+
g_type_class_add_private(klass, sizeof(spice_main_channel));
}
@@ -1153,6 +1177,9 @@ static gboolean migrate_connect(gpointer data)
g_signal_connect(mig->session, "channel-new",
G_CALLBACK(migrate_channel_new_cb), mig);
+ g_signal_emit(mig->channel, signals[SPICE_MIGRATION_STARTED], 0,
+ mig->session);
+
/* the migration process is in 2 steps, first the main channel and
then the rest of the channels */
migrate_channel_connect(mig, SPICE_CHANNEL_MAIN, 0);
diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index 47d6004..c5b48ce 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -102,6 +102,7 @@ enum {
PROP_IPV6,
PROP_PROTOCOL,
PROP_URI,
+ PROP_CLIENT_SOCKETS,
};
/* signals */
@@ -269,6 +270,9 @@ static void spice_session_get_property(GObject *gobject,
len = spice_uri_create(session, buf, sizeof(buf));
g_value_set_string(value, len ? buf : NULL);
break;
+ case PROP_CLIENT_SOCKETS:
+ g_value_set_boolean(value, s->client_provided_sockets);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
break;
@@ -318,6 +322,9 @@ static void spice_session_set_property(GObject *gobject,
if (str != NULL)
spice_uri_parse(session, str);
break;
+ case PROP_CLIENT_SOCKETS:
+ s->client_provided_sockets = g_value_get_boolean(value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
break;
@@ -417,6 +424,16 @@ static void spice_session_class_init(SpiceSessionClass *klass)
G_PARAM_STATIC_NICK |
G_PARAM_STATIC_BLURB));
+ g_object_class_install_property
+ (gobject_class, PROP_CLIENT_SOCKETS,
+ g_param_spec_boolean("client-sockets",
+ "Client sockets",
+ "Sockets are provided by the client",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
/**
* SpiceSession::channel-new:
* @session: the session that emitted the signal