Re: glib gio usage of the library outside of GNOME



On ons, 2012-10-24 at 18:41 +0200, Michael Weimann wrote:
> Hello,
> 
> I'm curently working with the gio library. Especially with the 
> GVolumeMonitor. My problem ist, that the GVolumeMonitor doesn't seem to 
> work outside of GNOME (e.g. on a terminal only).
> 
> I created a test code:
> g_type_init();
> GVolumeMonitor *vmon = g_volume_monitor_get();
> GList *drives = g_volume_monitor_get_connected_drives(vmon);
> printf("DRIVES: %p\n", drives);
> 
> Inside of GNOME I receive a valid entry for drives, outside nil.
> 
> Is there any special thing, e.g. initialize gio, to get this working?

Inside gio there is a default implementation of GVolumeMonitor that is
very much a "traditional unix" style thing. It only looks at /etc/mtab
and /etc/fstab and does some magic matching to guess what is what. This
is clearly not going to get you everything that a "modern" desktop
needs. For instance, there is no concept of a "drive" in such a setup
(for unix, an entry in mtab is a mount, and an entry in fstab is a
volume), nor do we know much about the properties of the volumes.

In order to get more information from the volume monitior you need:

a) gvfs installed, with at least one native volume monitor
implementation (and its dependencies) built. We currently ship a hal
one, a gnome-disk-utils one and a udisk2 one.
b) A session dbus running. This is on by default in an X session, but
you can launch your own with dbus-launch in a terminal if you want.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]