-static gint
-_compare_monitor_type_by_prio (gconstpointer _a,
- gconstpointer _b,
- gpointer user_data)
-{
- const GType *a = _a, *b = _b;
- int prio_a, prio_b;
- gint ret;
- GQuark private_q;
-
- private_q = g_quark_from_static_string ("gio-prio");
-
- prio_a = GPOINTER_TO_INT (g_type_get_qdata (*a, private_q));
- prio_b = GPOINTER_TO_INT (g_type_get_qdata (*b, private_q));
-
- ret = prio_b - prio_a;
-
- return ret;
-}
-
-static gpointer
-get_default_local_directory_monitor (gpointer data)
-{
- GType *monitor_impls;
- guint n_monitor_impls;
- gint i;
- GLocalDirectoryMonitorClass *chosen_class;
- GLocalDirectoryMonitorClass **ret = data;
-
- _g_io_modules_ensure_loaded ();
-
- monitor_impls = g_type_children (G_TYPE_LOCAL_DIRECTORY_MONITOR,
- &n_monitor_impls);
-
- g_qsort_with_data (monitor_impls,
- n_monitor_impls,
- sizeof (GType),
- _compare_monitor_type_by_prio,
- NULL);
-
- chosen_class = NULL;
- for (i = 0; i < n_monitor_impls; i++)
- {
- GLocalDirectoryMonitorClass *klass;
-
- klass = G_LOCAL_DIRECTORY_MONITOR_CLASS (g_type_class_ref (monitor_impls[i]));
-
- if (klass->is_supported())
- {
- chosen_class = klass;
- break;
- }
- else
- g_type_class_unref (klass);
- }
-
- g_free (monitor_impls);
-
- if (chosen_class)
- {
- *ret = chosen_class;
- return (gpointer)G_TYPE_FROM_CLASS (chosen_class);
- }
- else
- return (gpointer)G_TYPE_INVALID;
-}
-
-/**
- * g_local_directory_monitor_new:
- * @dirname: filename of the directory to monitor.
- * @flags: #GFileMonitorFlags.
- *
- * Returns: new #GFileMonitor for the given @dirname.
- **/