+/**
+ * gtk_im_multicontext_get_context_id:
+ * @context: a #GtkIMMulticontext
+ *
+ * Gets the id of the currently active slave of the @context.
+ *
+ * Returns: the id of the currently active slave
+ *
+ * Since: 2.16
+ */
+const char *
+gtk_im_multicontext_get_context_id (GtkIMMulticontext *context)
+{
+ g_return_val_if_fail (GTK_IS_IM_MULTICONTEXT (context), NULL);
+
+ return context->priv->context_id;
+}
+
+/**
+ * gtk_im_multicontext_set_context_id:
+ * @context: a #GtkIMMulticontext
+ * @context_id: the id to use
+ *
+ * Sets the context id for @context.
+ *
+ * This causes the currently active slave of @context to be
+ * replaced by the slave corresponding to the new context id.
+ *
+ * Since: 2.16
+ */
+void
+gtk_im_multicontext_set_context_id (GtkIMMulticontext *context,
+ const char *context_id)
+{
+ GtkIMMulticontextPrivate *priv;
+
+ g_return_if_fail (GTK_IS_IM_MULTICONTEXT (context));
+
+ priv = context->priv;
+
+ gtk_im_context_reset (GTK_IM_CONTEXT (context));
+ g_free (priv->context_id_aux);
+ priv->context_id_aux = g_strdup (context_id);
+ gtk_im_multicontext_set_slave (context, NULL, FALSE);
+}
+
+static void
+propagate_purpose (GtkIMMulticontext *context)
+{
+ GtkInputPurpose purpose;
+ GtkInputHints hints;
+
+ if (context->priv->slave == NULL)
+ return;
+
+ g_object_get (context, "input-purpose", &purpose, NULL);
+ g_object_set (context->priv->slave, "input-purpose", purpose, NULL);
+
+ g_object_get (context, "input-hints", &hints, NULL);
+ g_object_set (context->priv->slave, "input-hints", hints, NULL);
+}
+
+static void
+gtk_im_multicontext_notify (GObject *object,
+ GParamSpec *pspec)
+{
+ propagate_purpose (GTK_IM_MULTICONTEXT (object));
+}