Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
libfprint
fprintd
Commits
e29806cd
Commit
e29806cd
authored
Nov 03, 2008
by
Bastien Nocera
Committed by
Daniel Drake
Nov 03, 2008
Browse files
Add an action property
Add an action property and notify listeners when the action changes.
parent
f43ea8f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/device.c
View file @
e29806cd
...
...
@@ -102,6 +102,7 @@ typedef struct FprintDevicePrivate FprintDevicePrivate;
enum
fprint_device_properties
{
FPRINT_DEVICE_CONSTRUCT_DDEV
=
1
,
FPRINT_DEVICE_ACTION
,
};
enum
fprint_device_signals
{
...
...
@@ -136,6 +137,33 @@ static void fprint_device_set_property(GObject *object, guint property_id,
}
}
static
void
fprint_device_get_property
(
GObject
*
object
,
guint
property_id
,
GValue
*
value
,
GParamSpec
*
pspec
)
{
FprintDevice
*
self
=
(
FprintDevice
*
)
object
;
FprintDevicePrivate
*
priv
=
DEVICE_GET_PRIVATE
(
self
);
switch
(
property_id
)
{
case
FPRINT_DEVICE_ACTION
:
g_value_set_int
(
value
,
priv
->
current_action
);
break
;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID
(
object
,
property_id
,
pspec
);
break
;
}
}
static
void
fprint_device_set_action
(
FprintDevice
*
device
,
FprintDeviceAction
action
)
{
FprintDevicePrivate
*
priv
=
DEVICE_GET_PRIVATE
(
device
);
if
(
priv
->
current_action
==
action
)
return
;
priv
->
current_action
=
action
;
g_object_notify
(
G_OBJECT
(
device
),
"action"
);
}
static
void
fprint_device_class_init
(
FprintDeviceClass
*
klass
)
{
GObjectClass
*
gobject_class
=
G_OBJECT_CLASS
(
klass
);
...
...
@@ -147,6 +175,7 @@ static void fprint_device_class_init(FprintDeviceClass *klass)
gobject_class
->
finalize
=
fprint_device_finalize
;
gobject_class
->
set_property
=
fprint_device_set_property
;
gobject_class
->
get_property
=
fprint_device_get_property
;
g_type_class_add_private
(
klass
,
sizeof
(
FprintDevicePrivate
));
pspec
=
g_param_spec_pointer
(
"discovered-dev"
,
"Discovered device"
,
...
...
@@ -154,6 +183,11 @@ static void fprint_device_class_init(FprintDeviceClass *klass)
G_PARAM_CONSTRUCT_ONLY
|
G_PARAM_WRITABLE
);
g_object_class_install_property
(
gobject_class
,
FPRINT_DEVICE_CONSTRUCT_DDEV
,
pspec
);
pspec
=
g_param_spec_int
(
"action"
,
"Current device action"
,
"The current device action"
,
ACTION_NONE
,
ACTION_ENROLL
,
ACTION_NONE
,
G_PARAM_READABLE
);
g_object_class_install_property
(
gobject_class
,
FPRINT_DEVICE_ACTION
,
pspec
);
signals
[
SIGNAL_VERIFY_STATUS
]
=
g_signal_new
(
"verify-status"
,
G_TYPE_FROM_CLASS
(
gobject_class
),
G_SIGNAL_RUN_LAST
,
0
,
NULL
,
NULL
,
...
...
@@ -612,13 +646,13 @@ static void fprint_device_verify_start(FprintDevice *rdev,
g_message
(
"NO GALLERY"
);
return
;
}
pri
v
->
curren
t_action
=
ACTION_IDENTIFY
;
f
pri
nt_device_se
t_action
(
rdev
,
ACTION_IDENTIFY
)
;
g_message
(
"start identification device %d"
,
priv
->
id
);
//FIXME we're supposed to free the gallery here?
r
=
fp_async_identify_start
(
priv
->
dev
,
gallery
,
identify_cb
,
rdev
);
}
else
{
pri
v
->
curren
t_action
=
ACTION_VERIFY
;
f
pri
nt_device_se
t_action
(
rdev
,
ACTION_VERIFY
)
;
g_message
(
"start verification device %d finger %d"
,
priv
->
id
,
finger_num
);
...
...
@@ -705,7 +739,7 @@ static void fprint_device_verify_stop(FprintDevice *rdev,
g_error_free
(
error
);
}
pri
v
->
curren
t_action
=
ACTION_NONE
;
f
pri
nt_device_se
t_action
(
rdev
,
ACTION_NONE
)
;
}
static
void
enroll_stage_cb
(
struct
fp_dev
*
dev
,
int
result
,
...
...
@@ -770,7 +804,7 @@ static void fprint_device_enroll_start(FprintDevice *rdev,
return
;
}
pri
v
->
curren
t_action
=
ACTION_ENROLL
;
f
pri
nt_device_se
t_action
(
rdev
,
ACTION_ENROLL
)
;
dbus_g_method_return
(
context
);
}
...
...
@@ -813,7 +847,7 @@ static void fprint_device_enroll_stop(FprintDevice *rdev,
g_error_free
(
error
);
}
pri
v
->
curren
t_action
=
ACTION_NONE
;
f
pri
nt_device_se
t_action
(
rdev
,
ACTION_NONE
)
;
}
static
void
fprint_device_list_enrolled_fingers
(
FprintDevice
*
rdev
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment