This patch adds a new gst_bus_add_watch_full_with_context function
that can be used to add a watch with a specific main context.

diff -rup gstreamer-0.10.30.orig/gst/gstbus.c gstreamer-0.10.30.new/gst/gstbus.c
--- gstreamer-0.10.30.orig/gst/gstbus.c	2010-07-01 00:59:56.000000000 +0100
+++ gstreamer-0.10.30.new/gst/gstbus.c	2011-03-22 13:35:21.421311192 +0000
@@ -828,7 +828,7 @@ gst_bus_create_watch (GstBus * bus)
 /* must be called with the bus OBJECT LOCK */
 static guint
 gst_bus_add_watch_full_unlocked (GstBus * bus, gint priority,
-    GstBusFunc func, gpointer user_data, GDestroyNotify notify)
+    GstBusFunc func, gpointer user_data, GDestroyNotify notify, GMainContext *context)
 {
   guint id;
   GSource *source;
@@ -846,7 +846,7 @@ gst_bus_add_watch_full_unlocked (GstBus 
 
   g_source_set_callback (source, (GSourceFunc) func, user_data, notify);
 
-  id = g_source_attach (source, NULL);
+  id = g_source_attach (source, context);
   g_source_unref (source);
 
   if (id) {
@@ -890,7 +890,47 @@ gst_bus_add_watch_full (GstBus * bus, gi
   g_return_val_if_fail (GST_IS_BUS (bus), 0);
 
   GST_OBJECT_LOCK (bus);
-  id = gst_bus_add_watch_full_unlocked (bus, priority, func, user_data, notify);
+  id = gst_bus_add_watch_full_unlocked (bus, priority, func, user_data, notify, NULL);
+  GST_OBJECT_UNLOCK (bus);
+
+  return id;
+}
+
+/**
+ * gst_bus_add_watch_full_with_context:
+ * @bus: a #GstBus to create the watch for.
+ * @priority: The priority of the watch.
+ * @func: A function to call when a message is received.
+ * @user_data: user data passed to @func.
+ * @notify: the function to call when the source is removed.
+ * @context: the main context to be used.
+ *
+ * Adds a bus watch to the default main context with the given @priority (e.g.
+ * %G_PRIORITY_DEFAULT).
+ * This function is used to receive asynchronous messages in the main loop.
+ * There can only be a single bus watch per bus, you must remove it before you
+ * can set a new one.
+ *
+ * When @func is called, the message belongs to the caller; if you want to
+ * keep a copy of it, call gst_message_ref() before leaving @func.
+ *
+ * The watch can be removed using g_source_remove() or by returning FALSE
+ * from @func.
+ *
+ * Returns: The event source id.
+ *
+ * MT safe.
+ */
+guint
+gst_bus_add_watch_full_with_context (GstBus * bus, gint priority,
+									 GstBusFunc func, gpointer user_data, GDestroyNotify notify, GMainContext *context)
+{
+  guint id;
+
+  g_return_val_if_fail (GST_IS_BUS (bus), 0);
+
+  GST_OBJECT_LOCK (bus);
+  id = gst_bus_add_watch_full_unlocked (bus, priority, func, user_data, notify, context);
   GST_OBJECT_UNLOCK (bus);
 
   return id;
@@ -1262,7 +1262,7 @@ gst_bus_add_signal_watch_full (GstBus * 
 
   bus->signal_watch_id =
       gst_bus_add_watch_full_unlocked (bus, priority, gst_bus_async_signal_func,
-      NULL, NULL);
+      NULL, NULL, NULL);
 
   if (G_UNLIKELY (bus->signal_watch_id == 0))
     goto add_failed;
diff -rup gstreamer-0.10.30.orig/gst/gstbus.h gstreamer-0.10.30.new/gst/gstbus.h
--- gstreamer-0.10.30.orig/gst/gstbus.h	2010-06-23 01:01:19.000000000 +0100
+++ gstreamer-0.10.30.new/gst/gstbus.h	2011-03-22 13:36:09.805513917 +0000
@@ -165,6 +165,12 @@ guint                   gst_bus_add_watc
                                                          GstBusFunc func,
                                                          gpointer user_data,
                                                          GDestroyNotify notify);
+guint                   gst_bus_add_watch_full_with_context(GstBus * bus,
+                                                         gint priority,
+                                                         GstBusFunc func,
+                                                         gpointer user_data,
+                                                         GDestroyNotify notify,
+                                                         GMainContext *context);
 guint                   gst_bus_add_watch               (GstBus * bus,
                                                          GstBusFunc func,
                                                          gpointer user_data);
