glibmm 2.86.0

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | List of all members
Gio::VolumeMonitor Class Reference

Monitors a file or directory for changes. More...

`#include <giomm/volumemonitor.h>`

Inheritance diagram for Gio::VolumeMonitor:
[legend]

## Public Member Functions
| VolumeMonitor (VolumeMonitor && src) noexcept
VolumeMonitor & | operator= (VolumeMonitor && src) noexcept
| ~VolumeMonitor () noexcept override
GVolumeMonitor * | gobj ()
| Provides access to the underlying C GObject.
const GVolumeMonitor * | gobj () const
| Provides access to the underlying C GObject.
GVolumeMonitor * | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
std::vector< Glib::RefPtr< Drive > > | get_connected_drives ()
| Gets a list of drives connected to the system.
std::vector< Glib::RefPtr< Volume > > | get_volumes ()
| Gets a list of the volumes on the system.
std::vector< Glib::RefPtr< Mount > > | get_mounts ()
| Gets a list of the mounts on the system.
Glib::RefPtr< Volume > | get_volume_for_uuid (const std::string & uuid)
| Finds a Volume object by its UUID (see g_volume_get_uuid()).
Glib::RefPtr< Mount > | get_mount_for_uuid (const std::string & uuid)
| Finds a Mount object by its UUID (see g_mount_get_uuid()).
Glib::SignalProxy< void(const Glib::RefPtr< Volume > &)> | signal_volume_added ()
Glib::SignalProxy< void(const Glib::RefPtr< Volume > &)> | signal_volume_removed ()
Glib::SignalProxy< void(const Glib::RefPtr< Volume > &)> | signal_volume_changed ()
Glib::SignalProxy< void(const Glib::RefPtr< Mount > &)> | signal_mount_added ()
Glib::SignalProxy< void(const Glib::RefPtr< Mount > &)> | signal_mount_removed ()
Glib::SignalProxy< void(const Glib::RefPtr< Mount > &)> | signal_mount_pre_unmount ()
Glib::SignalProxy< void(const Glib::RefPtr< Mount > &)> | signal_mount_changed ()
Glib::SignalProxy< void(const Glib::RefPtr< Drive > &)> | signal_drive_connected ()
Glib::SignalProxy< void(const Glib::RefPtr< Drive > &)> | signal_drive_disconnected ()
Glib::SignalProxy< void(const Glib::RefPtr< Drive > &)> | signal_drive_changed ()
Glib::SignalProxy< void(const Glib::RefPtr< Drive > &)> | signal_drive_eject_button ()
Glib::SignalProxy< void(const Glib::RefPtr< Drive > &)> | signal_drive_stop_button ()
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object && src) noexcept
Object & | operator= (Object && src) noexcept
void * | get_data (const QueryQuark & key)
void | set_data (const Quark & key, void * data)
void | set_data_with_c_callback (const Quark & key, void * data, GDestroyNotify notify)
void | set_data (const Quark & key, void * data, DestroyNotify notify)
| Prefer set_data_with_c_callback() with a callback with C linkage.
void | remove_data (const QueryQuark & quark)
void * | steal_data (const QueryQuark & quark)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring & property_name, const Glib::ValueBase & value)
| You probably want to use a specific property_*() accessor method instead.
void | get_property_value (const Glib::ustring & property_name, Glib::ValueBase & value) const
| You probably want to use a specific property_*() accessor method instead.
template<class PropertyType>
void | set_property (const Glib::ustring & property_name, const PropertyType & value)
| You probably want to use a specific property_*() accessor method instead.
template<class PropertyType>
void | get_property (const Glib::ustring & property_name, PropertyType & value) const
| You probably want to use a specific property_*() accessor method instead.
template<class PropertyType>
PropertyType | get_property (const Glib::ustring & property_name) const
| You probably want to use a specific property_*() accessor method instead.
sigc::connection | connect_property_changed (const Glib::ustring & property_name, const sigc::slot< void()> & slot)
| You can use the signal_changed() signal of the property proxy instead.
sigc::connection | connect_property_changed (const Glib::ustring & property_name, sigc::slot< void()> && slot)
| You can use the signal_changed() signal of the property proxy instead.
void | freeze_notify ()
| Increases the freeze count on object.
void | thaw_notify ()
| Reverts the effect of a previous call to freeze_notify().
virtual void | reference () const
| Increment the reference count for this object.
virtual void | unreference () const
| Decrement the reference count for this object.
GObject * | gobj ()
| Provides access to the underlying C GObject.
const GObject * | gobj () const
| Provides access to the underlying C GObject.
GObject * | gobj_copy () const
| Give a ref-ed copy to someone. Use for direct struct access.

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.
static Glib::RefPtr< VolumeMonitor > | get ()
| Gets the volume monitor used by gio.

## Protected Member Functions
virtual void | on_volume_added (const Glib::RefPtr< Volume > & volume)
| This is a default handler for the signal signal_volume_added().
virtual void | on_volume_removed (const Glib::RefPtr< Volume > & volume)
| This is a default handler for the signal signal_volume_removed().
virtual void | on_volume_changed (const Glib::RefPtr< Volume > & volume)
| This is a default handler for the signal signal_volume_changed().
virtual void | on_mount_added (const Glib::RefPtr< Mount > & mount)
| This is a default handler for the signal signal_mount_added().
virtual void | on_mount_removed (const Glib::RefPtr< Mount > & mount)
| This is a default handler for the signal signal_mount_removed().
virtual void | on_mount_pre_unmount (const Glib::RefPtr< Mount > & mount)
| This is a default handler for the signal signal_mount_pre_unmount().
virtual void | on_mount_changed (const Glib::RefPtr< Mount > & mount)
| This is a default handler for the signal signal_mount_changed().
virtual void | on_drive_connected (const Glib::RefPtr< Drive > & drive)
| This is a default handler for the signal signal_drive_connected().
virtual void | on_drive_disconnected (const Glib::RefPtr< Drive > & drive)
| This is a default handler for the signal signal_drive_disconnected().
virtual void | on_drive_changed (const Glib::RefPtr< Drive > & drive)
| This is a default handler for the signal signal_drive_changed().
virtual void | on_drive_eject_button (const Glib::RefPtr< Drive > & drive)
| This is a default handler for the signal signal_drive_eject_button().
virtual void | on_drive_stop_button (const Glib::RefPtr< Drive > & drive)
| This is a default handler for the signal signal_drive_stop_button().
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams & construct_params)
| Object (GObject * castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| This default constructor is called implicitly from the constructor of user-derived classes, even if, for instance, Gtk::Button calls a different ObjectBase constructor.
| ObjectBase (const char * custom_type_name)
| A derived constructor always overrides this choice.
| ObjectBase (const std::type_info & custom_type_info)
| This constructor is a special feature to allow creation of derived types on the fly, without having to use g_object_new() manually.
| ObjectBase (ObjectBase && src) noexcept
ObjectBase & | operator= (ObjectBase && src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject * castitem)
void | initialize_move (GObject * castitem, Glib::ObjectBase * previous_wrapper)

## Related Symbols
(Note that these are not member symbols.)
Glib::RefPtr< Gio::VolumeMonitor > | wrap (GVolumeMonitor * object, bool take_copy=false)
| A Glib::wrap() method for this object.
Related Symbols inherited from Glib::Object
Glib::RefPtr< Glib::Object > | wrap (GObject * object, bool take_copy=false)

## Additional Inherited Members
Public Types inherited from Glib::Object
using | DestroyNotify = void (*)(gpointer data)

## Detailed Description

Monitors a file or directory for changes.

VolumeMonitor is for listing the user-interesting devices and volumes on the computer. In other words, what a file selector or file manager would show in a sidebar.

Since glibmm 2.16

## Constructor & Destructor Documentation

## ◆ VolumeMonitor()

Gio::VolumeMonitor::VolumeMonitor | ( | VolumeMonitor && | src | ) |
| noexcept

## ◆ ~VolumeMonitor()

Gio::VolumeMonitor::~VolumeMonitor | ( |  | ) |
| override noexcept

## Member Function Documentation

## ◆ get()

Glib::RefPtr< VolumeMonitor > Gio::VolumeMonitor::get | ( |  | ) |
| static

Gets the volume monitor used by gio.

Returns
  A reference to the VolumeMonitor used by gio. Call Glib::object_unref() when done with it, after disconnecting any signal handlers.

## ◆ get_connected_drives()

std::vector< Glib::RefPtr< Drive > > Gio::VolumeMonitor::get_connected_drives | ( |  | ) |

Gets a list of drives connected to the system.

Returns
  A List of connected Drive objects.

## ◆ get_mount_for_uuid()

Glib::RefPtr< Mount > Gio::VolumeMonitor::get_mount_for_uuid | ( | const std::string & | uuid | ) |

Finds a Mount object by its UUID (see g_mount_get_uuid()).

Parameters

  uuid | The UUID to look for.

Returns
  A Mount or nullptr if no such mount is available. Free the returned object with Glib::object_unref().

## ◆ get_mounts()

std::vector< Glib::RefPtr< Mount > > Gio::VolumeMonitor::get_mounts | ( |  | ) |

Gets a list of the mounts on the system.

Returns
  A List of Mount objects.

## ◆ get_type()

GType Gio::VolumeMonitor::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ get_volume_for_uuid()

Glib::RefPtr< Volume > Gio::VolumeMonitor::get_volume_for_uuid | ( | const std::string & | uuid | ) |

Finds a Volume object by its UUID (see g_volume_get_uuid()).

Parameters

  uuid | The UUID to look for.

Returns
  A Volume or nullptr if no such volume is available. Free the returned object with Glib::object_unref().

## ◆ get_volumes()

std::vector< Glib::RefPtr< Volume > > Gio::VolumeMonitor::get_volumes | ( |  | ) |

Gets a list of the volumes on the system.

Returns
  A List of Volume objects.

## ◆ gobj() [1/2]

GVolumeMonitor * Gio::VolumeMonitor::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GVolumeMonitor * Gio::VolumeMonitor::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GVolumeMonitor * Gio::VolumeMonitor::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## ◆ on_drive_changed()

virtual void Gio::VolumeMonitor::on_drive_changed | ( | const Glib::RefPtr< Drive > & | drive | ) |
| protected virtual

This is a default handler for the signal signal_drive_changed().

## ◆ on_drive_connected()

virtual void Gio::VolumeMonitor::on_drive_connected | ( | const Glib::RefPtr< Drive > & | drive | ) |
| protected virtual

This is a default handler for the signal signal_drive_connected().

## ◆ on_drive_disconnected()

virtual void Gio::VolumeMonitor::on_drive_disconnected | ( | const Glib::RefPtr< Drive > & | drive | ) |
| protected virtual

This is a default handler for the signal signal_drive_disconnected().

## ◆ on_drive_eject_button()

virtual void Gio::VolumeMonitor::on_drive_eject_button | ( | const Glib::RefPtr< Drive > & | drive | ) |
| protected virtual

This is a default handler for the signal signal_drive_eject_button().

## ◆ on_drive_stop_button()

virtual void Gio::VolumeMonitor::on_drive_stop_button | ( | const Glib::RefPtr< Drive > & | drive | ) |
| protected virtual

This is a default handler for the signal signal_drive_stop_button().

## ◆ on_mount_added()

virtual void Gio::VolumeMonitor::on_mount_added | ( | const Glib::RefPtr< Mount > & | mount | ) |
| protected virtual

This is a default handler for the signal signal_mount_added().

## ◆ on_mount_changed()

virtual void Gio::VolumeMonitor::on_mount_changed | ( | const Glib::RefPtr< Mount > & | mount | ) |
| protected virtual

This is a default handler for the signal signal_mount_changed().

## ◆ on_mount_pre_unmount()

virtual void Gio::VolumeMonitor::on_mount_pre_unmount | ( | const Glib::RefPtr< Mount > & | mount | ) |
| protected virtual

This is a default handler for the signal signal_mount_pre_unmount().

## ◆ on_mount_removed()

virtual void Gio::VolumeMonitor::on_mount_removed | ( | const Glib::RefPtr< Mount > & | mount | ) |
| protected virtual

This is a default handler for the signal signal_mount_removed().

## ◆ on_volume_added()

virtual void Gio::VolumeMonitor::on_volume_added | ( | const Glib::RefPtr< Volume > & | volume | ) |
| protected virtual

This is a default handler for the signal signal_volume_added().

## ◆ on_volume_changed()

virtual void Gio::VolumeMonitor::on_volume_changed | ( | const Glib::RefPtr< Volume > & | volume | ) |
| protected virtual

This is a default handler for the signal signal_volume_changed().

## ◆ on_volume_removed()

virtual void Gio::VolumeMonitor::on_volume_removed | ( | const Glib::RefPtr< Volume > & | volume | ) |
| protected virtual

This is a default handler for the signal signal_volume_removed().

## ◆ operator=()

VolumeMonitor & Gio::VolumeMonitor::operator= | ( | VolumeMonitor && | src | ) |
| noexcept

## ◆ signal_drive_changed()

Glib::SignalProxy< void(const Glib::RefPtr< Drive > &)> Gio::VolumeMonitor::signal_drive_changed | ( |  | ) |

Slot Prototype:
  void on_my_drive_changed(const Glib::RefPtr<Drive>& drive)

Flags: Run Last

Emitted when a drive changes.

Parameters

  drive | The drive that changed.

## ◆ signal_drive_connected()

Glib::SignalProxy< void(const Glib::RefPtr< Drive > &)> Gio::VolumeMonitor::signal_drive_connected | ( |  | ) |

Slot Prototype:
  void on_my_drive_connected(const Glib::RefPtr<Drive>& drive)

Flags: Run Last

Emitted when a drive is connected to the system.

Parameters

  drive | A Drive that was connected.

## ◆ signal_drive_disconnected()

Glib::SignalProxy< void(const Glib::RefPtr< Drive > &)> Gio::VolumeMonitor::signal_drive_disconnected | ( |  | ) |

Slot Prototype:
  void on_my_drive_disconnected(const Glib::RefPtr<Drive>& drive)

Flags: Run Last

Emitted when a drive is disconnected from the system.

Parameters

  drive | A Drive that was disconnected.

## ◆ signal_drive_eject_button()

Glib::SignalProxy< void(const Glib::RefPtr< Drive > &)> Gio::VolumeMonitor::signal_drive_eject_button | ( |  | ) |

Slot Prototype:
  void on_my_drive_eject_button(const Glib::RefPtr<Drive>& drive)

Flags: Run Last

Emitted when the eject button is pressed on drive.

Since glibmm 2.18

Parameters

  drive | The drive where the eject button was pressed.

## ◆ signal_drive_stop_button()

Glib::SignalProxy< void(const Glib::RefPtr< Drive > &)> Gio::VolumeMonitor::signal_drive_stop_button | ( |  | ) |

Slot Prototype:
  void on_my_drive_stop_button(const Glib::RefPtr<Drive>& drive)

Flags: Run Last

Emitted when the stop button is pressed on drive.

Since glibmm 2.22

Parameters

  drive | The drive where the stop button was pressed.

## ◆ signal_mount_added()

Glib::SignalProxy< void(const Glib::RefPtr< Mount > &)> Gio::VolumeMonitor::signal_mount_added | ( |  | ) |

Slot Prototype:
  void on_my_mount_added(const Glib::RefPtr<Mount>& mount)

Flags: Run Last

Emitted when a mount is added.

Parameters

  mount | A Mount that was added.

## ◆ signal_mount_changed()

Glib::SignalProxy< void(const Glib::RefPtr< Mount > &)> Gio::VolumeMonitor::signal_mount_changed | ( |  | ) |

Slot Prototype:
  void on_my_mount_changed(const Glib::RefPtr<Mount>& mount)

Flags: Run Last

Emitted when a mount changes.

Parameters

  mount | A Mount that changed.

## ◆ signal_mount_pre_unmount()

Glib::SignalProxy< void(const Glib::RefPtr< Mount > &)> Gio::VolumeMonitor::signal_mount_pre_unmount | ( |  | ) |

Slot Prototype:
  void on_my_mount_pre_unmount(const Glib::RefPtr<Mount>& mount)

Flags: Run Last

May be emitted when a mount is about to be removed.

This signal depends on the backend and is only emitted if GIO was used to unmount.

Parameters

  mount | A Mount that is being unmounted.

## ◆ signal_mount_removed()

Glib::SignalProxy< void(const Glib::RefPtr< Mount > &)> Gio::VolumeMonitor::signal_mount_removed | ( |  | ) |

Slot Prototype:
  void on_my_mount_removed(const Glib::RefPtr<Mount>& mount)

Flags: Run Last

Emitted when a mount is removed.

Parameters

  mount | A Mount that was removed.

## ◆ signal_volume_added()

Glib::SignalProxy< void(const Glib::RefPtr< Volume > &)> Gio::VolumeMonitor::signal_volume_added | ( |  | ) |

Slot Prototype:
  void on_my_volume_added(const Glib::RefPtr<Volume>& volume)

Flags: Run Last

Emitted when a mountable volume is added to the system.

Parameters

  volume | A Volume that was added.

## ◆ signal_volume_changed()

Glib::SignalProxy< void(const Glib::RefPtr< Volume > &)> Gio::VolumeMonitor::signal_volume_changed | ( |  | ) |

Slot Prototype:
  void on_my_volume_changed(const Glib::RefPtr<Volume>& volume)

Flags: Run Last

Emitted when mountable volume is changed.

Parameters

  volume | A Volume that changed.

## ◆ signal_volume_removed()

Glib::SignalProxy< void(const Glib::RefPtr< Volume > &)> Gio::VolumeMonitor::signal_volume_removed | ( |  | ) |

Slot Prototype:
  void on_my_volume_removed(const Glib::RefPtr<Volume>& volume)

Flags: Run Last

Emitted when a mountable volume is removed from the system.

Parameters

  volume | A Volume that was removed.

## Friends And Related Symbol Documentation

## ◆ wrap()

Glib::RefPtr< Gio::VolumeMonitor > wrap | ( | GVolumeMonitor * | object,
|  | bool | take_copy = false )
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.