mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-20 23:58:54 +02:00
Add a GMount::pre-unmount signal
This is the per-mount analogon to GVolumeMonitor::mount-pre-unmount.
This commit is contained in:
committed by
Matthias Clasen
parent
4ecec3b1c2
commit
d89cc0d7cb
16
gio/gmount.c
16
gio/gmount.c
@@ -141,6 +141,22 @@ g_mount_base_init (gpointer g_class)
|
|||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__VOID,
|
g_cclosure_marshal_VOID__VOID,
|
||||||
G_TYPE_NONE, 0);
|
G_TYPE_NONE, 0);
|
||||||
|
/**
|
||||||
|
* GMount::pre-unmount:
|
||||||
|
* @mount: the object on which the signal is emitted
|
||||||
|
*
|
||||||
|
* This signal is emitted when the #GMount is about to be
|
||||||
|
* unmounted.
|
||||||
|
*
|
||||||
|
* Since: 2.22.
|
||||||
|
**/
|
||||||
|
g_signal_new (I_("pre-unmount"),
|
||||||
|
G_TYPE_MOUNT,
|
||||||
|
G_SIGNAL_RUN_LAST,
|
||||||
|
G_STRUCT_OFFSET (GMountIface, pre_unmount),
|
||||||
|
NULL, NULL,
|
||||||
|
g_cclosure_marshal_VOID__VOID,
|
||||||
|
G_TYPE_NONE, 0);
|
||||||
|
|
||||||
initialized = TRUE;
|
initialized = TRUE;
|
||||||
}
|
}
|
||||||
|
@@ -126,6 +126,9 @@ struct _GMountIface
|
|||||||
gboolean force_rescan,
|
gboolean force_rescan,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
/* yet more signals */
|
||||||
|
void (* pre_unmount) (GMount *mount);
|
||||||
};
|
};
|
||||||
|
|
||||||
GType g_mount_get_type (void) G_GNUC_CONST;
|
GType g_mount_get_type (void) G_GNUC_CONST;
|
||||||
|
@@ -394,6 +394,8 @@ eject_unmount_do (GMount *mount,
|
|||||||
if (unix_mount->volume_monitor != NULL)
|
if (unix_mount->volume_monitor != NULL)
|
||||||
g_signal_emit_by_name (unix_mount->volume_monitor, "mount-pre-unmount", mount);
|
g_signal_emit_by_name (unix_mount->volume_monitor, "mount-pre-unmount", mount);
|
||||||
|
|
||||||
|
g_signal_emit_by_name (mount, "pre-unmount", 0);
|
||||||
|
|
||||||
g_timeout_add (500, (GSourceFunc) eject_unmount_do_cb, data);
|
g_timeout_add (500, (GSourceFunc) eject_unmount_do_cb, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user