Implement this function by moving bits from glocalfileinfo.c
2008-02-21 David Zeuthen <davidz@redhat.com>
* glocalfileinfo.c: (_g_local_file_info_get):
* gcontenttype.c:
(g_content_type_get_icon): Implement this function by
moving bits from glocalfileinfo.c
(g_content_type_get_description): Unalias before getting
description (#517687)
* gfile.c: (g_file_class_init),
(g_file_query_filesystem_info_async),
(g_file_query_filesystem_info_finish),
(query_filesystem_info_data_free),
(query_filesystem_info_async_thread),
(g_file_real_query_filesystem_info_async),
(g_file_real_query_filesystem_info_finish):
* gfile.h: Implement async version of
g_file_query_filesystem_info()
* gfileinfo.h: Add new attributes for filesystem::use-preview
* gio.symbols: Update
* gthemedicon.c: (g_themed_icon_append_name):
* gthemedicon.h: Add new new convenience function.
* gunionvolumemonitor.c: (g_union_volume_monitor_dispose),
(get_mounts), (get_volumes), (get_connected_drives),
(get_volume_for_uuid), (get_mount_for_uuid),
(g_union_volume_monitor_init), (populate_union_monitor),
(g_volume_monitor_get), (_g_mount_get_for_mount_path),
(g_volume_monitor_adopt_orphan_mount):
* gvolumemonitor.c:
* gvolumemonitor.h: Use recursive locks so it's safe for volume
monitor implementations to call into the main volume monitor. Also
separate object initialization and volume monitor initialization
such that non-native volume monitors can properly adopt their
mounts away.
svn path=/trunk/; revision=6550
2008-02-21 13:35:05 +01:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
2007-11-26 17:13:05 +01:00
|
|
|
/* GIO - GLib Input, Output and Streaming Library
|
2008-09-02 21:05:58 +02:00
|
|
|
*
|
2007-11-26 17:13:05 +01:00
|
|
|
* Copyright (C) 2006-2007 Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General
|
2014-01-23 12:58:29 +01:00
|
|
|
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
2007-11-26 17:13:05 +01:00
|
|
|
*
|
|
|
|
* Author: Alexander Larsson <alexl@redhat.com>
|
Rework how volumes, drives and volume monitoring is done. Previosly the
2007-12-11 David Zeuthen <davidz@redhat.com>
Rework how volumes, drives and volume monitoring is
done. Previosly the model was
GDrive <1-1> GVolume
where a GDrive instance represented a mount point and a GVolume
instance represented a mounted file system. This patch changes it
the model to
GDrive <1-N> GVolume <1-1> GMount
where GMount now serves the purpose of the old GVolume and the new
GVolume serves the purpose of the old GDrive. In addition the new
GDrive interface is used to represent a collection of GVolume
instances (typically partitions) and also contains utility to query
the state of the physical drive the GDrive object represents (such
as checking for media, polling the drive, ejecting the media etc.).
Also implement mounting and unmounting in the Unix volume monitor
backend. A subquent patch will introduce GDrive support for ejection
of media.
* Makefile.am:
* gdrive.c: (g_drive_is_media_check_automatic),
(g_drive_is_media_removable), (g_drive_has_media),
(g_drive_can_poll_for_media), (g_drive_eject),
(g_drive_eject_finish), (g_drive_poll_for_media),
(g_drive_poll_for_media_finish):
* gdrive.h:
* gfile.c: (g_file_find_enclosing_mount):
* gfile.h:
* gio.symbols:
* glocaldirectorymonitor.c:
(g_local_directory_monitor_constructor), (mounts_changed):
* glocalfile.c: (get_mount_info),
(g_local_file_find_enclosing_mount),
(g_local_file_file_iface_init):
* gnativevolumemonitor.h:
* gunionvolumemonitor.c: (get_mounts), (get_volumes),
(get_connected_drives), (g_union_volume_monitor_class_init),
(child_volume_added), (child_volume_removed),
(child_volume_changed), (child_mount_added), (child_mount_removed),
(child_mount_pre_unmount), (child_mount_changed),
(child_drive_changed), (g_union_volume_monitor_add_monitor),
(g_union_volume_monitor_remove_monitor),
(_g_mount_get_for_mount_path):
* gunixmounts.c: (g_unix_is_mount_path_system_internal),
(guess_system_internal), (_g_get_unix_mounts),
(_g_get_unix_mount_points), (g_get_unix_mount_at),
(g_unix_mount_free), (g_unix_mount_compare),
(g_unix_mount_get_mount_path), (g_unix_mount_get_device_path),
(g_unix_mount_get_fs_type), (g_unix_mount_is_readonly),
(g_unix_mount_is_system_internal), (g_unix_mount_guess_type),
(type_to_icon), (g_unix_mount_guess_name),
(g_unix_mount_guess_icon), (g_unix_mount_point_guess_name),
(g_unix_mount_point_guess_icon), (_canonicalize_filename),
(_resolve_symlink), (_resolve_dev_root):
* gunixmounts.h:
* gunixvolume.c: (g_unix_volume_finalize), (_g_unix_volume_new),
(_g_unix_volume_disconnected), (_g_unix_volume_set_mount),
(_g_unix_volume_unset_mount), (g_unix_volume_get_icon),
(g_unix_volume_get_name), (g_unix_volume_can_mount),
(g_unix_volume_get_drive), (g_unix_volume_get_mount),
(_g_unix_volume_has_mount_path), (mount_cb), (mount_read_error),
(g_unix_volume_mount), (g_unix_volume_mount_finish),
(g_unix_volume_volume_iface_init):
* gunixvolume.h:
* gunixvolumemonitor.c: (g_unix_volume_monitor_finalize),
(get_mounts), (get_volumes), (get_connected_drives),
(get_mount_for_mount_path), (g_unix_volume_monitor_class_init),
(mountpoints_changed), (mounts_changed),
(g_unix_volume_monitor_init),
(_g_unix_volume_monitor_lookup_volume_for_mount_path),
(find_mount_by_mountpath), (update_volumes), (update_mounts):
* gunixvolumemonitor.h:
* gvolume.c: (g_volume_get_mount), (g_volume_can_mount),
(g_volume_mount), (g_volume_mount_finish):
* gvolume.h:
* gvolumemonitor.c: (g_volume_monitor_class_init),
(g_volume_monitor_get_connected_drives),
(g_volume_monitor_get_volumes), (g_volume_monitor_get_mounts):
* gvolumemonitor.h:
svn path=/trunk/; revision=6095
2007-12-11 22:23:55 +01:00
|
|
|
* David Zeuthen <davidz@redhat.com>
|
2007-11-26 17:13:05 +01:00
|
|
|
*/
|
|
|
|
|
2012-12-28 05:43:14 +01:00
|
|
|
#ifndef __G_VOLUME_MONITOR_H__
|
|
|
|
#define __G_VOLUME_MONITOR_H__
|
|
|
|
|
2007-12-14 11:35:24 +01:00
|
|
|
#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
|
|
|
|
#error "Only <gio/gio.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
2008-07-01 08:32:35 +02:00
|
|
|
#include <gio/giotypes.h>
|
2007-11-26 17:13:05 +01:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
#define G_TYPE_VOLUME_MONITOR (g_volume_monitor_get_type ())
|
|
|
|
#define G_VOLUME_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_VOLUME_MONITOR, GVolumeMonitor))
|
|
|
|
#define G_VOLUME_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_VOLUME_MONITOR, GVolumeMonitorClass))
|
|
|
|
#define G_VOLUME_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_VOLUME_MONITOR, GVolumeMonitorClass))
|
|
|
|
#define G_IS_VOLUME_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_VOLUME_MONITOR))
|
|
|
|
#define G_IS_VOLUME_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_VOLUME_MONITOR))
|
|
|
|
|
2008-02-11 08:17:48 +01:00
|
|
|
/**
|
|
|
|
* G_VOLUME_MONITOR_EXTENSION_POINT_NAME:
|
|
|
|
*
|
|
|
|
* Extension point for volume monitor functionality.
|
2014-04-15 16:18:59 +02:00
|
|
|
* See [Extending GIO][extending-gio].
|
2008-02-11 08:17:48 +01:00
|
|
|
*/
|
2008-01-28 20:43:10 +01:00
|
|
|
#define G_VOLUME_MONITOR_EXTENSION_POINT_NAME "gio-volume-monitor"
|
|
|
|
|
2007-11-27 15:00:13 +01:00
|
|
|
/**
|
|
|
|
* GVolumeMonitor:
|
|
|
|
*
|
|
|
|
* A Volume Monitor that watches for volume events.
|
|
|
|
**/
|
2007-11-26 17:13:05 +01:00
|
|
|
typedef struct _GVolumeMonitorClass GVolumeMonitorClass;
|
|
|
|
|
2008-09-02 21:05:58 +02:00
|
|
|
struct _GVolumeMonitor
|
|
|
|
{
|
2007-12-12 15:33:20 +01:00
|
|
|
GObject parent_instance;
|
2007-11-27 15:00:13 +01:00
|
|
|
|
|
|
|
/*< private >*/
|
2007-11-26 17:13:05 +01:00
|
|
|
gpointer priv;
|
|
|
|
};
|
|
|
|
|
2008-09-02 21:05:58 +02:00
|
|
|
struct _GVolumeMonitorClass
|
|
|
|
{
|
2007-11-26 17:13:05 +01:00
|
|
|
GObjectClass parent_class;
|
|
|
|
|
|
|
|
/*< public >*/
|
|
|
|
/* signals */
|
2008-09-02 21:05:58 +02:00
|
|
|
void (* volume_added) (GVolumeMonitor *volume_monitor,
|
|
|
|
GVolume *volume);
|
|
|
|
void (* volume_removed) (GVolumeMonitor *volume_monitor,
|
|
|
|
GVolume *volume);
|
|
|
|
void (* volume_changed) (GVolumeMonitor *volume_monitor,
|
|
|
|
GVolume *volume);
|
|
|
|
|
|
|
|
void (* mount_added) (GVolumeMonitor *volume_monitor,
|
|
|
|
GMount *mount);
|
|
|
|
void (* mount_removed) (GVolumeMonitor *volume_monitor,
|
|
|
|
GMount *mount);
|
|
|
|
void (* mount_pre_unmount) (GVolumeMonitor *volume_monitor,
|
|
|
|
GMount *mount);
|
|
|
|
void (* mount_changed) (GVolumeMonitor *volume_monitor,
|
|
|
|
GMount *mount);
|
|
|
|
|
|
|
|
void (* drive_connected) (GVolumeMonitor *volume_monitor,
|
|
|
|
GDrive *drive);
|
|
|
|
void (* drive_disconnected) (GVolumeMonitor *volume_monitor,
|
|
|
|
GDrive *drive);
|
|
|
|
void (* drive_changed) (GVolumeMonitor *volume_monitor,
|
|
|
|
GDrive *drive);
|
2007-11-26 17:13:05 +01:00
|
|
|
|
|
|
|
/* Vtable */
|
|
|
|
|
2008-09-02 21:05:58 +02:00
|
|
|
gboolean (* is_supported) (void);
|
2007-12-19 17:08:55 +01:00
|
|
|
|
2008-09-02 21:05:58 +02:00
|
|
|
GList * (* get_connected_drives) (GVolumeMonitor *volume_monitor);
|
|
|
|
GList * (* get_volumes) (GVolumeMonitor *volume_monitor);
|
|
|
|
GList * (* get_mounts) (GVolumeMonitor *volume_monitor);
|
2007-11-26 17:13:05 +01:00
|
|
|
|
2008-09-02 21:05:58 +02:00
|
|
|
GVolume * (* get_volume_for_uuid) (GVolumeMonitor *volume_monitor,
|
|
|
|
const char *uuid);
|
Provide eject() on both GMount and GVolume and utility functions to guess
2007-12-14 David Zeuthen <davidz@redhat.com>
* Makefile.am:
* gio.symbols:
* gmount.c: (g_mount_get_uuid), (g_mount_can_eject),
(g_mount_eject), (g_mount_eject_finish):
* gmount.h:
* gunionvolumemonitor.c: (g_union_volume_monitor_finalize),
(get_volume_for_uuid), (get_mount_for_uuid),
(g_union_volume_monitor_class_init),
(get_default_native_type_with_exclude), (get_default_native_type),
(get_native_type), (update_native_type),
(g_union_volume_monitor_init), (_g_mount_get_for_mount_path):
* gunixmount.c: (_g_unix_mount_new), (g_unix_mount_get_uuid),
(g_unix_mount_can_eject), (eject_unmount_cb),
(eject_unmount_read_error), (eject_unmount_do),
(g_unix_mount_unmount), (g_unix_mount_eject),
(g_unix_mount_eject_finish), (g_unix_mount_mount_iface_init):
* gunixmounts.c: (g_unix_mount_guess_can_eject),
(g_unix_mount_point_guess_can_eject):
* gunixmounts.h:
* gunixvolume.c: (_g_unix_volume_new), (g_unix_volume_get_uuid),
(g_unix_volume_can_eject), (g_unix_volume_get_drive),
(eject_mount_cb), (eject_mount_read_error), (eject_mount_do),
(g_unix_volume_mount), (g_unix_volume_eject),
(g_unix_volume_eject_finish), (g_unix_volume_volume_iface_init):
* gunixvolumemonitor.c: (get_volume_for_uuid),
(get_mount_for_uuid), (g_unix_volume_monitor_class_init),
(update_mounts):
* gvolume.c: (g_volume_get_uuid), (g_volume_can_eject),
(g_volume_eject), (g_volume_eject_finish):
* gvolume.h:
* gvolumemonitor.c: (g_volume_monitor_get_volume_for_uuid),
(g_volume_monitor_get_mount_for_uuid):
* gvolumemonitor.h:
Provide eject() on both GMount and GVolume and utility functions
to guess whether a GUnixMountPoint or GUnixMountEntry should be
ejected. Introduce the concept of UUID's and wire it into GVolume
and GMount and provide API on GVolumeMonitor to find such
instances. Also handle the case where an external
GNativeVolumeMonitor fails to initialize. Lock around the
_g_get_mount_for_mount_path() function such that volume monitor
implementations won't have to do locking themselves.
svn path=/trunk/; revision=6140
2007-12-17 10:31:08 +01:00
|
|
|
|
2008-09-02 21:05:58 +02:00
|
|
|
GMount * (* get_mount_for_uuid) (GVolumeMonitor *volume_monitor,
|
|
|
|
const char *uuid);
|
Provide eject() on both GMount and GVolume and utility functions to guess
2007-12-14 David Zeuthen <davidz@redhat.com>
* Makefile.am:
* gio.symbols:
* gmount.c: (g_mount_get_uuid), (g_mount_can_eject),
(g_mount_eject), (g_mount_eject_finish):
* gmount.h:
* gunionvolumemonitor.c: (g_union_volume_monitor_finalize),
(get_volume_for_uuid), (get_mount_for_uuid),
(g_union_volume_monitor_class_init),
(get_default_native_type_with_exclude), (get_default_native_type),
(get_native_type), (update_native_type),
(g_union_volume_monitor_init), (_g_mount_get_for_mount_path):
* gunixmount.c: (_g_unix_mount_new), (g_unix_mount_get_uuid),
(g_unix_mount_can_eject), (eject_unmount_cb),
(eject_unmount_read_error), (eject_unmount_do),
(g_unix_mount_unmount), (g_unix_mount_eject),
(g_unix_mount_eject_finish), (g_unix_mount_mount_iface_init):
* gunixmounts.c: (g_unix_mount_guess_can_eject),
(g_unix_mount_point_guess_can_eject):
* gunixmounts.h:
* gunixvolume.c: (_g_unix_volume_new), (g_unix_volume_get_uuid),
(g_unix_volume_can_eject), (g_unix_volume_get_drive),
(eject_mount_cb), (eject_mount_read_error), (eject_mount_do),
(g_unix_volume_mount), (g_unix_volume_eject),
(g_unix_volume_eject_finish), (g_unix_volume_volume_iface_init):
* gunixvolumemonitor.c: (get_volume_for_uuid),
(get_mount_for_uuid), (g_unix_volume_monitor_class_init),
(update_mounts):
* gvolume.c: (g_volume_get_uuid), (g_volume_can_eject),
(g_volume_eject), (g_volume_eject_finish):
* gvolume.h:
* gvolumemonitor.c: (g_volume_monitor_get_volume_for_uuid),
(g_volume_monitor_get_mount_for_uuid):
* gvolumemonitor.h:
Provide eject() on both GMount and GVolume and utility functions
to guess whether a GUnixMountPoint or GUnixMountEntry should be
ejected. Introduce the concept of UUID's and wire it into GVolume
and GMount and provide API on GVolumeMonitor to find such
instances. Also handle the case where an external
GNativeVolumeMonitor fails to initialize. Lock around the
_g_get_mount_for_mount_path() function such that volume monitor
implementations won't have to do locking themselves.
svn path=/trunk/; revision=6140
2007-12-17 10:31:08 +01:00
|
|
|
|
2007-12-19 10:39:50 +01:00
|
|
|
|
2008-10-12 19:05:17 +02:00
|
|
|
/* These arguments are unfortunately backwards by mistake (bug #520169). Deprecated in 2.20. */
|
2008-09-02 21:05:58 +02:00
|
|
|
GVolume * (* adopt_orphan_mount) (GMount *mount,
|
|
|
|
GVolumeMonitor *volume_monitor);
|
2008-07-07 04:23:52 +02:00
|
|
|
|
|
|
|
/* signal added in 2.17 */
|
2008-09-02 21:05:58 +02:00
|
|
|
void (* drive_eject_button) (GVolumeMonitor *volume_monitor,
|
|
|
|
GDrive *drive);
|
2008-07-07 04:23:52 +02:00
|
|
|
|
2009-06-15 16:53:41 +02:00
|
|
|
/* signal added in 2.21 */
|
|
|
|
void (* drive_stop_button) (GVolumeMonitor *volume_monitor,
|
|
|
|
GDrive *drive);
|
|
|
|
|
2007-11-27 15:00:13 +01:00
|
|
|
/*< private >*/
|
2007-11-26 17:13:05 +01:00
|
|
|
/* Padding for future expansion */
|
|
|
|
void (*_g_reserved1) (void);
|
|
|
|
void (*_g_reserved2) (void);
|
|
|
|
void (*_g_reserved3) (void);
|
|
|
|
void (*_g_reserved4) (void);
|
|
|
|
void (*_g_reserved5) (void);
|
|
|
|
void (*_g_reserved6) (void);
|
|
|
|
};
|
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2008-09-02 21:05:58 +02:00
|
|
|
GType g_volume_monitor_get_type (void) G_GNUC_CONST;
|
2007-11-26 17:13:05 +01:00
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2008-09-02 21:05:58 +02:00
|
|
|
GVolumeMonitor *g_volume_monitor_get (void);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2008-09-02 21:05:58 +02:00
|
|
|
GList * g_volume_monitor_get_connected_drives (GVolumeMonitor *volume_monitor);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2008-09-02 21:05:58 +02:00
|
|
|
GList * g_volume_monitor_get_volumes (GVolumeMonitor *volume_monitor);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2008-09-02 21:05:58 +02:00
|
|
|
GList * g_volume_monitor_get_mounts (GVolumeMonitor *volume_monitor);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2008-09-02 21:05:58 +02:00
|
|
|
GVolume * g_volume_monitor_get_volume_for_uuid (GVolumeMonitor *volume_monitor,
|
|
|
|
const char *uuid);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2008-09-02 21:05:58 +02:00
|
|
|
GMount * g_volume_monitor_get_mount_for_uuid (GVolumeMonitor *volume_monitor,
|
|
|
|
const char *uuid);
|
2007-11-26 17:13:05 +01:00
|
|
|
|
2011-11-03 05:16:41 +01:00
|
|
|
GLIB_DEPRECATED
|
2008-09-02 21:05:58 +02:00
|
|
|
GVolume * g_volume_monitor_adopt_orphan_mount (GMount *mount);
|
2007-12-19 10:39:50 +01:00
|
|
|
|
2007-11-26 17:13:05 +01:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __G_VOLUME_MONITOR_H__ */
|