Commit e207203b authored by Bastien Nocera's avatar Bastien Nocera Committed by Daniel Drake
Browse files

Add GetDefaultDevice

Gives you the first device listed in GetDevices.
parent ac85e592
......@@ -29,7 +29,8 @@
static gboolean fprint_manager_get_devices(FprintManager *manager,
GPtrArray **devices, GError **error);
static gboolean fprint_manager_get_default_device(FprintManager *manager,
const char **device, GError **error);
#include "manager-dbus-glue.h"
static GObjectClass *parent_class = NULL;
......@@ -176,3 +177,18 @@ static gboolean fprint_manager_get_devices(FprintManager *manager,
return TRUE;
}
static gboolean fprint_manager_get_default_device(FprintManager *manager,
const char **device, GError **error)
{
FprintManagerPrivate *priv = FPRINT_MANAGER_GET_PRIVATE (manager);
GSList *elem = priv->dev_registry;
int num_open = g_slist_length(elem);
if (num_open > 0) {
*device = get_device_path (elem->data);
return TRUE;
} else {
*device = NULL;
return FALSE;
}
}
......@@ -8,6 +8,10 @@
<arg type="ao" name="devices" direction="out" />
</method>
<method name="GetDefaultDevice">
<arg type="o" name="device" direction="out" />
</method>
</interface>
</node>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment