GVariant: add support for single precision floats
[platform/upstream/glib.git] / gio / gfilemonitor.c
index 974bd73..c81f6fc 100644 (file)
@@ -13,9 +13,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  *
  * Author: Alexander Larsson <alexl@redhat.com>
  */
@@ -47,9 +45,9 @@ static void file_change_free (FileChange *change);
  *
  * To get informed about changes to the file or directory you are
  * monitoring, connect to the #GFileMonitor::changed signal. The
- * signal will be emitted in the <link
- * linkend="g-main-context-push-thread-default">thread-default main
- * context</link> of the thread that the monitor was created in
+ * signal will be emitted in the
+ * [thread-default main context][g-main-context-push-thread-default]
+ * of the thread that the monitor was created in
  * (though if the global default main context is blocked, this may
  * cause notifications to be blocked even if the thread-default
  * context is still running).
@@ -89,7 +87,8 @@ struct _GFileMonitorPrivate {
 enum {
   PROP_0,
   PROP_RATE_LIMIT,
-  PROP_CANCELLED
+  PROP_CANCELLED,
+  PROP_CONTEXT
 };
 
 /* work around a limitation of the aliasing foo */
@@ -113,6 +112,12 @@ g_file_monitor_set_property (GObject      *object,
       g_file_monitor_set_rate_limit (monitor, g_value_get_int (value));
       break;
 
+    case PROP_CONTEXT:
+      monitor->priv->context = g_value_dup_boxed (value);
+      if (monitor->priv->context == NULL)
+        monitor->priv->context = g_main_context_ref_thread_default ();
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -260,6 +265,14 @@ g_file_monitor_class_init (GFileMonitorClass *klass)
                                                          FALSE,
                                                          G_PARAM_READABLE|
                                                          G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB));
+
+  g_object_class_install_property (object_class,
+                                   PROP_CONTEXT,
+                                   g_param_spec_boxed ("context",
+                                                       P_("Context"),
+                                                       P_("The main context to dispatch from"),
+                                                       G_TYPE_MAIN_CONTEXT, G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
 }
 
 static void
@@ -269,7 +282,6 @@ g_file_monitor_init (GFileMonitor *monitor)
   monitor->priv->rate_limit_msec = DEFAULT_RATE_LIMIT_MSECS;
   monitor->priv->rate_limiter = g_hash_table_new_full (g_file_hash, (GEqualFunc)g_file_equal,
                                                       NULL, (GDestroyNotify) rate_limiter_free);
-  monitor->priv->context = g_main_context_ref_thread_default ();
   g_mutex_init (&monitor->priv->mutex);
 }
 
@@ -431,6 +443,7 @@ emit_in_idle (GFileMonitor      *monitor,
        * pending idles.
        */
       g_source_set_callback (source, emit_cb, monitor, NULL);
+      g_source_set_name (source, "[gio] emit_cb");
       g_source_attach (source, monitor->priv->context);
     }
   /* We reverse this in the processor */
@@ -658,9 +671,8 @@ update_rate_limiter_timeout (GFileMonitor *monitor,
  * has taken place. Should be called from file monitor 
  * implementations only.
  *
- * The signal will be emitted from an idle handler (in the <link
- * linkend="g-main-context-push-thread-default">thread-default main
- * context</link>).
+ * The signal will be emitted from an idle handler (in the
+ * [thread-default main context][g-main-context-push-thread-default]).
  **/
 void
 g_file_monitor_emit_event (GFileMonitor      *monitor,