Index: gtkplug-stub.c
===================================================================
--- gtkplug-stub.c	(revision 21917)
+++ gtkplug-stub.c	(working copy)
@@ -30,7 +30,7 @@
 #include "gtkalias.h"
 
 GdkNativeWindow
-_gtk_plug_windowing_get_id (GtkPlug *plug)
+_gtk_plug_windowing_get_id (GdkWindow *window)
 {
   return 0;
 }
Index: gtkplug-win32.c
===================================================================
--- gtkplug-win32.c	(revision 21917)
+++ gtkplug-win32.c	(working copy)
@@ -43,9 +43,9 @@
 #endif
 
 GdkNativeWindow
-_gtk_plug_windowing_get_id (GtkPlug *plug)
+_gtk_plug_windowing_get_id (GdkWindow * window)
 {
-  return (GdkNativeWindow) GDK_WINDOW_HWND (GTK_WIDGET (plug)->window);
+  return (GdkNativeWindow) GDK_WINDOW_HWND (window);
 }
 
 void
Index: gtkplugprivate.h
===================================================================
--- gtkplugprivate.h	(revision 21917)
+++ gtkplugprivate.h	(working copy)
@@ -39,11 +39,11 @@
 /*
  * _gtk_plug_windowing_get_id:
  *
- * @plug: a #GtkPlug
+ * @window: a #GdkWindow
  *
- * Returns the native window system identifier for the plug's window.
+ * Returns the native window system identifier for a window.
  */
-GdkNativeWindow _gtk_plug_windowing_get_id (GtkPlug *plug);
+GdkNativeWindow _gtk_plug_windowing_get_id (GdkWindow *window);
 
 /*
  * _gtk_plug_windowing_realize_toplevel:
Index: gtkplug-x11.c
===================================================================
--- gtkplug-x11.c	(revision 21917)
+++ gtkplug-x11.c	(working copy)
@@ -40,9 +40,9 @@
 					unsigned long  flags);
 
 GdkNativeWindow
-_gtk_plug_windowing_get_id (GtkPlug *plug)
+_gtk_plug_windowing_get_id (GdkWindow * window)
 {
-  return GDK_WINDOW_XWINDOW (GTK_WIDGET (plug)->window);
+  return GDK_WINDOW_XWINDOW (window);
 }
 
 void
Index: gtkplug.c
===================================================================
--- gtkplug.c	(revision 21917)
+++ gtkplug.c	(working copy)
@@ -40,6 +40,10 @@
 						       guint        prop_id,
 						       GValue      *value,
 						       GParamSpec  *pspec);
+static void            gtk_plug_set_property          (GObject          *object,
+													   guint            prop_id,
+													   const GValue     *value,
+													   GParamSpec * pspec);													   
 static void            gtk_plug_finalize              (GObject          *object);
 static void            gtk_plug_realize               (GtkWidget        *widget);
 static void            gtk_plug_unrealize             (GtkWidget        *widget);
@@ -83,7 +87,32 @@
 
 G_DEFINE_TYPE (GtkPlug, gtk_plug, GTK_TYPE_WINDOW)
 
+
 static void
+gtk_plug_set_property (GObject *object,
+					   guint prop_id,
+					   const GValue *value,
+					   GParamSpec * pspec)
+{
+  GtkPlug *plug = GTK_PLUG(object);
+  switch (prop_id)
+	{
+	case PROP_SOCKET_WINDOW:
+	{
+		g_return_if_fail(plug->socket_window == NULL);
+		
+		gtk_plug_construct_for_display(plug, 
+							           gdk_screen_get_display(gtk_widget_get_screen(GTK_WIDGET(plug))),
+								       _gtk_plug_windowing_get_id(g_value_get_object(value)));
+	}
+	  break;
+	default:
+	  G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+	  break;
+	}
+}
+
+static void
 gtk_plug_get_property (GObject    *object,
 		       guint       prop_id,
 		       GValue     *value,
@@ -116,6 +145,7 @@
   bin_class = g_type_class_peek (GTK_TYPE_BIN);
 
   gobject_class->get_property = gtk_plug_get_property;
+  gobject_class->set_property = gtk_plug_set_property;
   gobject_class->finalize = gtk_plug_finalize;
   
   widget_class->realize = gtk_plug_realize;
@@ -165,7 +195,7 @@
 							P_("Socket Window"),
 							P_("The window of the socket the plug is embedded in"),
 							GDK_TYPE_WINDOW,
-							GTK_PARAM_READABLE));
+							GTK_PARAM_READABLE | GTK_PARAM_WRITABLE));
 
   /**
    * GtkPlug::embedded:
@@ -260,7 +290,7 @@
   if (!GTK_WIDGET_REALIZED (plug))
     gtk_widget_realize (GTK_WIDGET (plug));
 
-  return _gtk_plug_windowing_get_id (plug);
+  return _gtk_plug_windowing_get_id (GTK_WIDGET(plug)->window);
 }
 
 /**
