static GType get_default_native_class (gpointer data) { GNativeVolumeMonitorClass *klass, *native_class, **native_class_out; const char *use_this; GIOExtensionPoint *ep; GIOExtension *extension; GList *l; native_class_out = data; use_this = g_getenv ("GIO_USE_VOLUME_MONITOR"); /* Ensure vfs in modules loaded */ _g_io_modules_ensure_loaded (); ep = g_io_extension_point_lookup (G_NATIVE_VOLUME_MONITOR_EXTENSION_POINT_NAME); native_class = NULL; if (use_this) { extension = g_io_extension_point_get_extension_by_name (ep, use_this); if (extension) { klass = G_NATIVE_VOLUME_MONITOR_CLASS (g_io_extension_ref_class (extension)); if (G_VOLUME_MONITOR_CLASS (klass)->is_supported()) native_class = klass; else g_type_class_unref (klass); } } if (native_class == NULL) { for (l = g_io_extension_point_get_extensions (ep); l != NULL; l = l->next) { extension = l->data; klass = G_NATIVE_VOLUME_MONITOR_CLASS (g_io_extension_ref_class (extension)); if (G_VOLUME_MONITOR_CLASS (klass)->is_supported()) { native_class = klass; break; } else g_type_class_unref (klass); } } if (native_class) { *native_class_out = native_class; return G_TYPE_FROM_CLASS (native_class); } else return G_TYPE_INVALID; }
static void populate_union_monitor (GUnionVolumeMonitor *union_monitor) { GVolumeMonitor *monitor; GNativeVolumeMonitorClass *native_class; GVolumeMonitorClass *klass; GIOExtensionPoint *ep; GIOExtension *extension; GList *l; native_class = get_native_class (); if (native_class != NULL) { monitor = g_object_new (G_TYPE_FROM_CLASS (native_class), NULL); g_union_volume_monitor_add_monitor (union_monitor, monitor); g_object_unref (monitor); g_type_class_unref (native_class); } ep = g_io_extension_point_lookup (G_VOLUME_MONITOR_EXTENSION_POINT_NAME); for (l = g_io_extension_point_get_extensions (ep); l != NULL; l = l->next) { extension = l->data; klass = G_VOLUME_MONITOR_CLASS (g_io_extension_ref_class (extension)); if (klass->is_supported == NULL || klass->is_supported()) { monitor = g_object_new (g_io_extension_get_type (extension), NULL); g_union_volume_monitor_add_monitor (union_monitor, monitor); g_object_unref (monitor); } g_type_class_unref (klass); } }
static void g_udisks_volume_monitor_class_init(GUDisksVolumeMonitorClass *klass) { GObjectClass *g_object_class = G_OBJECT_CLASS(klass); GNativeVolumeMonitorClass *parent_class = G_NATIVE_VOLUME_MONITOR_CLASS(klass); GVolumeMonitorClass *monitor_class = G_VOLUME_MONITOR_CLASS (klass); g_object_class->finalize = g_udisks_volume_monitor_finalize; parent_class->get_mount_for_mount_path = get_mount_for_mount_path; monitor_class->get_mounts = get_mounts; monitor_class->get_volumes = get_volumes; monitor_class->get_connected_drives = get_connected_drives; monitor_class->get_volume_for_uuid = get_volume_for_uuid; monitor_class->get_mount_for_uuid = get_mount_for_uuid; monitor_class->is_supported = is_supported; monitor_class->drive_eject_button = drive_eject_button; sig_drive_changed = g_signal_lookup("drive-changed", G_TYPE_VOLUME_MONITOR); sig_drive_connected = g_signal_lookup("drive-connected", G_TYPE_VOLUME_MONITOR); sig_drive_disconnected = g_signal_lookup("drive-disconnected", G_TYPE_VOLUME_MONITOR); sig_drive_eject_button = g_signal_lookup("drive-eject-button", G_TYPE_VOLUME_MONITOR); sig_mount_added = g_signal_lookup("mount-added", G_TYPE_VOLUME_MONITOR); sig_mount_changed = g_signal_lookup("mount-changed", G_TYPE_VOLUME_MONITOR); sig_mount_premount = g_signal_lookup("mount-premount", G_TYPE_VOLUME_MONITOR); sig_mount_removed = g_signal_lookup("mount-removed", G_TYPE_VOLUME_MONITOR); sig_volume_added = g_signal_lookup("volume-added", G_TYPE_VOLUME_MONITOR); sig_volume_changed = g_signal_lookup("volume-changed", G_TYPE_VOLUME_MONITOR); sig_volume_removed = g_signal_lookup("volume-removed", G_TYPE_VOLUME_MONITOR); }
static void g_union_volume_monitor_class_init (GUnionVolumeMonitorClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GVolumeMonitorClass *monitor_class = G_VOLUME_MONITOR_CLASS (klass); gobject_class->finalize = g_union_volume_monitor_finalize; gobject_class->dispose = g_union_volume_monitor_dispose; monitor_class->get_connected_drives = get_connected_drives; monitor_class->get_volumes = get_volumes; monitor_class->get_mounts = get_mounts; monitor_class->get_volume_for_uuid = get_volume_for_uuid; monitor_class->get_mount_for_uuid = get_mount_for_uuid; }
static void g_win32_volume_monitor_class_init (GWin32VolumeMonitorClass *klass) { GVolumeMonitorClass *monitor_class = G_VOLUME_MONITOR_CLASS (klass); GNativeVolumeMonitorClass *native_class = G_NATIVE_VOLUME_MONITOR_CLASS (klass); monitor_class->get_mounts = get_mounts; monitor_class->get_volumes = get_volumes; monitor_class->get_connected_drives = get_connected_drives; monitor_class->get_volume_for_uuid = get_volume_for_uuid; monitor_class->get_mount_for_uuid = get_mount_for_uuid; monitor_class->is_supported = is_supported; native_class->get_mount_for_mount_path = get_mount_for_mount_path; }
static void g_unix_volume_monitor_class_init (GUnixVolumeMonitorClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GVolumeMonitorClass *monitor_class = G_VOLUME_MONITOR_CLASS (klass); GNativeVolumeMonitorClass *native_class = G_NATIVE_VOLUME_MONITOR_CLASS (klass); gobject_class->finalize = g_unix_volume_monitor_finalize; monitor_class->get_mounts = get_mounts; monitor_class->get_volumes = get_volumes; monitor_class->get_connected_drives = get_connected_drives; monitor_class->get_volume_for_uuid = get_volume_for_uuid; monitor_class->get_mount_for_uuid = get_mount_for_uuid; monitor_class->is_supported = is_supported; native_class->get_mount_for_mount_path = get_mount_for_mount_path; }