List all the fingerprints for all the users

When listing, list all the fingerprints for all the users mentioned on
the command-line for each connected device, rather than just the
default one.
This commit is contained in:
Bastien Nocera
2008-11-20 10:33:59 +00:00
committed by Daniel Drake
parent 1e43720c15
commit ac85e5927e

View File

@ -39,41 +39,6 @@ static void create_manager(void)
"net.reactivated.Fprint.Manager");
}
static DBusGProxy *open_device(void)
{
GError *error = NULL;
GPtrArray *devices;
gchar *path;
DBusGProxy *dev;
guint i;
if (!net_reactivated_Fprint_Manager_get_devices(manager, &devices, &error))
g_error("list_devices failed: %s", error->message);
if (devices->len == 0) {
g_print("No devices found\n");
exit(1);
}
g_print("found %d devices\n", devices->len);
for (i = 0; i < devices->len; i++) {
path = g_ptr_array_index(devices, i);
g_print("Device at %s\n", path);
}
path = g_ptr_array_index(devices, 0);
g_print("Using device %s\n", path);
/* FIXME use for_name_owner?? */
dev = dbus_g_proxy_new_for_name(connection, "net.reactivated.Fprint",
path, "net.reactivated.Fprint.Device");
g_ptr_array_foreach(devices, (GFunc) g_free, NULL);
g_ptr_array_free(devices, TRUE);
return dev;
}
static void list_fingerprints(DBusGProxy *dev, const char *username)
{
GError *error = NULL;
@ -102,11 +67,51 @@ static void list_fingerprints(DBusGProxy *dev, const char *username)
g_strfreev (fingers);
}
static void process_devices(char **argv)
{
GError *error = NULL;
GPtrArray *devices;
char *path;
guint i;
if (!net_reactivated_Fprint_Manager_get_devices(manager, &devices, &error))
g_error("list_devices failed: %s", error->message);
if (devices->len == 0) {
g_print("No devices found\n");
exit(1);
}
g_print("found %d devices\n", devices->len);
for (i = 0; i < devices->len; i++) {
path = g_ptr_array_index(devices, i);
g_print("Device at %s\n", path);
}
for (i = 0; i < devices->len; i++) {
guint j;
DBusGProxy *dev;
path = g_ptr_array_index(devices, 0);
g_print("Using device %s\n", path);
/* FIXME use for_name_owner?? */
dev = dbus_g_proxy_new_for_name(connection, "net.reactivated.Fprint",
path, "net.reactivated.Fprint.Device");
for (j = 1; argv[j] != NULL; j++)
list_fingerprints (dev, argv[j]);
g_object_unref (dev);
}
g_ptr_array_foreach(devices, (GFunc) g_free, NULL);
g_ptr_array_free(devices, TRUE);
}
int main(int argc, char **argv)
{
GMainLoop *loop;
DBusGProxy *dev;
guint32 i;
g_type_init();
loop = g_main_loop_new(NULL, FALSE);
@ -117,10 +122,7 @@ int main(int argc, char **argv)
return 1;
}
dev = open_device();
for (i = 1; argv[i] != NULL; i++) {
list_fingerprints (dev, argv[i]);
}
process_devices (argv);
return 0;
}