File: | capplets/about-me/cafe-about-me-fingerprint.c |
Warning: | line 99, column 6 Null pointer passed to 1st parameter expecting 'nonnull' |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* cafe-about-me-fingerprint.h | |||
2 | * Copyright (C) 2008 Bastien Nocera <hadess@hadess.net> | |||
3 | * | |||
4 | * This program is free software; you can redistribute it and/or modify | |||
5 | * it under the terms of the GNU General Public License as published by | |||
6 | * the Free Software Foundation; either version 2, or (at your option) | |||
7 | * any later version. | |||
8 | * | |||
9 | * This program is distributed in the hope that it will be useful, | |||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
12 | * GNU General Public License for more details. | |||
13 | * | |||
14 | * You should have received a copy of the GNU General Public License | |||
15 | * along with this program; if not, write to the Free Software | |||
16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |||
17 | * 02110-1301, USA. | |||
18 | */ | |||
19 | ||||
20 | #include <glib/gi18n.h> | |||
21 | #include <ctk/ctk.h> | |||
22 | #include <dbus/dbus-glib-bindings.h> | |||
23 | ||||
24 | #include "fingerprint-strings.h" | |||
25 | #include "capplet-util.h" | |||
26 | ||||
27 | /* This must match the number of images on the 2nd page in the UI file */ | |||
28 | #define MAX_ENROLL_STAGES5 5 | |||
29 | ||||
30 | /* Translate fprintd strings */ | |||
31 | #define TR(s)dgettext("fprintd", s) dgettext("fprintd", s) | |||
32 | ||||
33 | static DBusGProxy *manager = NULL((void*)0); | |||
34 | static DBusGConnection *connection = NULL((void*)0); | |||
35 | static gboolean is_disable = FALSE(0); | |||
36 | ||||
37 | enum { | |||
38 | STATE_NONE, | |||
39 | STATE_CLAIMED, | |||
40 | STATE_ENROLLING | |||
41 | }; | |||
42 | ||||
43 | typedef struct { | |||
44 | CtkWidget *enable; | |||
45 | CtkWidget *disable; | |||
46 | ||||
47 | CtkWidget *ass; | |||
48 | CtkBuilder *dialog; | |||
49 | ||||
50 | DBusGProxy *device; | |||
51 | gboolean is_swipe; | |||
52 | int num_enroll_stages; | |||
53 | int num_stages_done; | |||
54 | char *name; | |||
55 | const char *finger; | |||
56 | gint state; | |||
57 | } EnrollData; | |||
58 | ||||
59 | static void create_manager (void) | |||
60 | { | |||
61 | GError *error = NULL((void*)0); | |||
62 | ||||
63 | connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); | |||
64 | if (connection == NULL((void*)0)) { | |||
65 | g_warning ("Failed to connect to session bus: %s", error->message); | |||
66 | return; | |||
67 | } | |||
68 | ||||
69 | manager = dbus_g_proxy_new_for_name (connection, | |||
70 | "net.reactivated.Fprint", | |||
71 | "/net/reactivated/Fprint/Manager", | |||
72 | "net.reactivated.Fprint.Manager"); | |||
73 | } | |||
74 | ||||
75 | static DBusGProxy * | |||
76 | get_first_device (void) | |||
77 | { | |||
78 | DBusGProxy *device; | |||
79 | char *device_str; | |||
80 | ||||
81 | if (!dbus_g_proxy_call (manager, "GetDefaultDevice", NULL((void*)0), G_TYPE_INVALID((GType) ((0) << (2))), | |||
82 | DBUS_TYPE_G_OBJECT_PATH(dbus_g_object_path_get_g_type ()), &device_str, G_TYPE_INVALID((GType) ((0) << (2))))) { | |||
83 | return NULL((void*)0); | |||
84 | } | |||
85 | ||||
86 | device = dbus_g_proxy_new_for_name(connection, | |||
87 | "net.reactivated.Fprint", | |||
88 | device_str, | |||
89 | "net.reactivated.Fprint.Device"); | |||
90 | ||||
91 | g_free (device_str); | |||
92 | ||||
93 | return device; | |||
94 | } | |||
95 | ||||
96 | static const char * | |||
97 | get_reason_for_error (const char *dbus_error) | |||
98 | { | |||
99 | if (g_str_equal (dbus_error, "net.reactivated.Fprint.Error.PermissionDenied")(strcmp ((const char *) (dbus_error), (const char *) ("net.reactivated.Fprint.Error.PermissionDenied" )) == 0)) | |||
| ||||
100 | return N_("You are not allowed to access the device. Contact your system administrator.")("You are not allowed to access the device. Contact your system administrator." ); | |||
101 | if (g_str_equal (dbus_error, "net.reactivated.Fprint.Error.AlreadyInUse")(strcmp ((const char *) (dbus_error), (const char *) ("net.reactivated.Fprint.Error.AlreadyInUse" )) == 0)) | |||
102 | return N_("The device is already in use.")("The device is already in use."); | |||
103 | if (g_str_equal (dbus_error, "net.reactivated.Fprint.Error.Internal")(strcmp ((const char *) (dbus_error), (const char *) ("net.reactivated.Fprint.Error.Internal" )) == 0)) | |||
104 | return N_("An internal error occurred")("An internal error occurred"); | |||
105 | ||||
106 | return NULL((void*)0); | |||
107 | } | |||
108 | ||||
109 | static CtkWidget * | |||
110 | get_error_dialog (const char *title, | |||
111 | const char *dbus_error, | |||
112 | CtkWindow *parent) | |||
113 | { | |||
114 | CtkWidget *error_dialog; | |||
115 | const char *reason; | |||
116 | ||||
117 | if (dbus_error == NULL((void*)0)) | |||
118 | g_warning ("get_error_dialog called with reason == NULL"); | |||
119 | ||||
120 | error_dialog = | |||
121 | ctk_message_dialog_new (parent, | |||
122 | CTK_DIALOG_MODAL, | |||
123 | CTK_MESSAGE_ERROR, | |||
124 | CTK_BUTTONS_OK, | |||
125 | "%s", title); | |||
126 | reason = get_reason_for_error (dbus_error); | |||
127 | ctk_message_dialog_format_secondary_text | |||
128 | (CTK_MESSAGE_DIALOG (error_dialog)((((CtkMessageDialog*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((error_dialog)), ((ctk_message_dialog_get_type ())))))), "%s", reason ? _(reason)gettext (reason) : _(dbus_error)gettext (dbus_error)); | |||
129 | ||||
130 | ctk_window_set_title (CTK_WINDOW (error_dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((error_dialog)), ((ctk_window_get_type ())))))), ""); /* as per HIG */ | |||
131 | ctk_container_set_border_width (CTK_CONTAINER (error_dialog)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((error_dialog)), ((ctk_container_get_type ())))))), 5); | |||
132 | ctk_dialog_set_default_response (CTK_DIALOG (error_dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((error_dialog)), ((ctk_dialog_get_type ())))))), | |||
133 | CTK_RESPONSE_OK); | |||
134 | ctk_window_set_modal (CTK_WINDOW (error_dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((error_dialog)), ((ctk_window_get_type ())))))), TRUE(!(0))); | |||
135 | ctk_window_set_position (CTK_WINDOW (error_dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((error_dialog)), ((ctk_window_get_type ())))))), CTK_WIN_POS_CENTER_ON_PARENT); | |||
136 | ||||
137 | return error_dialog; | |||
138 | } | |||
139 | ||||
140 | void | |||
141 | set_fingerprint_label (CtkWidget *enable, CtkWidget *disable) | |||
142 | { | |||
143 | char **fingers; | |||
144 | DBusGProxy *device; | |||
145 | GError *error = NULL((void*)0); | |||
146 | ||||
147 | ctk_widget_set_no_show_all (enable, TRUE(!(0))); | |||
148 | ctk_widget_set_no_show_all (disable, TRUE(!(0))); | |||
149 | ||||
150 | if (manager == NULL((void*)0)) { | |||
151 | create_manager (); | |||
152 | if (manager == NULL((void*)0)) { | |||
153 | ctk_widget_hide (enable); | |||
154 | ctk_widget_hide (disable); | |||
155 | return; | |||
156 | } | |||
157 | } | |||
158 | ||||
159 | device = get_first_device (); | |||
160 | if (device == NULL((void*)0)) { | |||
161 | ctk_widget_hide (enable); | |||
162 | ctk_widget_hide (disable); | |||
163 | return; | |||
164 | } | |||
165 | ||||
166 | if (!dbus_g_proxy_call (device, "ListEnrolledFingers", &error, G_TYPE_STRING((GType) ((16) << (2))), "", G_TYPE_INVALID((GType) ((0) << (2))), | |||
167 | G_TYPE_STRV(g_strv_get_type ()), &fingers, G_TYPE_INVALID((GType) ((0) << (2))))) { | |||
168 | if (dbus_g_error_has_name (error, "net.reactivated.Fprint.Error.NoEnrolledPrints") == FALSE(0)) { | |||
169 | ctk_widget_hide (enable); | |||
170 | ctk_widget_hide (disable); | |||
171 | g_object_unref (device); | |||
172 | return; | |||
173 | } | |||
174 | fingers = NULL((void*)0); | |||
175 | } | |||
176 | ||||
177 | if (fingers == NULL((void*)0) || g_strv_length (fingers) == 0) { | |||
178 | ctk_widget_hide (disable); | |||
179 | ctk_widget_show (enable); | |||
180 | is_disable = FALSE(0); | |||
181 | } else { | |||
182 | ctk_widget_hide (enable); | |||
183 | ctk_widget_show (disable); | |||
184 | is_disable = TRUE(!(0)); | |||
185 | } | |||
186 | ||||
187 | g_strfreev (fingers); | |||
188 | g_object_unref (device); | |||
189 | } | |||
190 | ||||
191 | static void | |||
192 | delete_fingerprints (void) | |||
193 | { | |||
194 | DBusGProxy *device; | |||
195 | ||||
196 | if (manager == NULL((void*)0)) { | |||
197 | create_manager (); | |||
198 | if (manager == NULL((void*)0)) | |||
199 | return; | |||
200 | } | |||
201 | ||||
202 | device = get_first_device (); | |||
203 | if (device == NULL((void*)0)) | |||
204 | return; | |||
205 | ||||
206 | dbus_g_proxy_call (device, "DeleteEnrolledFingers", NULL((void*)0), G_TYPE_STRING((GType) ((16) << (2))), "", G_TYPE_INVALID((GType) ((0) << (2))), G_TYPE_INVALID((GType) ((0) << (2)))); | |||
207 | ||||
208 | g_object_unref (device); | |||
209 | } | |||
210 | ||||
211 | static void | |||
212 | delete_fingerprints_question (CtkBuilder *dialog, CtkWidget *enable, CtkWidget *disable) | |||
213 | { | |||
214 | CtkWidget *question; | |||
215 | CtkWidget *button; | |||
216 | ||||
217 | question = ctk_message_dialog_new (CTK_WINDOW (WID ("about-me-dialog"))((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "about-me-dialog"))), (( ctk_widget_get_type ())))))))), ((ctk_window_get_type ()))))) ), | |||
218 | CTK_DIALOG_MODAL, | |||
219 | CTK_MESSAGE_QUESTION, | |||
220 | CTK_BUTTONS_NONE, | |||
221 | _("Delete registered fingerprints?")gettext ("Delete registered fingerprints?")); | |||
222 | ctk_dialog_add_button (CTK_DIALOG (question)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((question)), ((ctk_dialog_get_type ())))))), "ctk-cancel", CTK_RESPONSE_CANCEL); | |||
223 | ||||
224 | button = ctk_button_new_with_mnemonic (_("_Delete Fingerprints")gettext ("_Delete Fingerprints")); | |||
225 | ctk_button_set_image (CTK_BUTTON (button)((((CtkButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((button)), ((ctk_button_get_type ())))))), ctk_image_new_from_icon_name ("edit-delete", CTK_ICON_SIZE_BUTTON)); | |||
226 | ctk_widget_set_can_default (button, TRUE(!(0))); | |||
227 | ctk_widget_show (button); | |||
228 | ctk_dialog_add_action_widget (CTK_DIALOG (question)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((question)), ((ctk_dialog_get_type ())))))), button, CTK_RESPONSE_OK); | |||
229 | ||||
230 | ctk_message_dialog_format_secondary_text (CTK_MESSAGE_DIALOG (question)((((CtkMessageDialog*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((question)), ((ctk_message_dialog_get_type ( ))))))), | |||
231 | _("Do you want to delete your registered fingerprints so fingerprint login is disabled?")gettext ("Do you want to delete your registered fingerprints so fingerprint login is disabled?" )); | |||
232 | ctk_container_set_border_width (CTK_CONTAINER (question)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((question)), ((ctk_container_get_type ())))))), 5); | |||
233 | ctk_dialog_set_default_response (CTK_DIALOG (question)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((question)), ((ctk_dialog_get_type ())))))), CTK_RESPONSE_OK); | |||
234 | ctk_window_set_position (CTK_WINDOW (question)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((question)), ((ctk_window_get_type ())))))), CTK_WIN_POS_CENTER_ON_PARENT); | |||
235 | ctk_window_set_modal (CTK_WINDOW (question)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((question)), ((ctk_window_get_type ())))))), TRUE(!(0))); | |||
236 | ||||
237 | if (ctk_dialog_run (CTK_DIALOG (question)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((question)), ((ctk_dialog_get_type ()))))))) == CTK_RESPONSE_OK) { | |||
238 | delete_fingerprints (); | |||
239 | set_fingerprint_label (enable, disable); | |||
240 | } | |||
241 | ||||
242 | ctk_widget_destroy (question); | |||
243 | } | |||
244 | ||||
245 | static void | |||
246 | enroll_data_destroy (EnrollData *data) | |||
247 | { | |||
248 | switch (data->state) { | |||
249 | case STATE_ENROLLING: | |||
250 | dbus_g_proxy_call(data->device, "EnrollStop", NULL((void*)0), G_TYPE_INVALID((GType) ((0) << (2))), G_TYPE_INVALID((GType) ((0) << (2)))); | |||
251 | /* fall-through */ | |||
252 | case STATE_CLAIMED: | |||
253 | dbus_g_proxy_call(data->device, "Release", NULL((void*)0), G_TYPE_INVALID((GType) ((0) << (2))), G_TYPE_INVALID((GType) ((0) << (2)))); | |||
254 | /* fall-through */ | |||
255 | case STATE_NONE: | |||
256 | g_free (data->name); | |||
257 | g_object_unref (data->device); | |||
258 | g_object_unref (data->dialog); | |||
259 | ctk_widget_destroy (data->ass); | |||
260 | ||||
261 | g_free (data); | |||
262 | } | |||
263 | } | |||
264 | ||||
265 | static const char * | |||
266 | selected_finger (CtkBuilder *dialog) | |||
267 | { | |||
268 | int index; | |||
269 | ||||
270 | if (ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (WID ("radiobutton1"))((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "radiobutton1"))), ((ctk_widget_get_type ())))))))), ((ctk_toggle_button_get_type ())))))))) { | |||
271 | ctk_widget_set_sensitive (WID ("finger_combobox")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "finger_combobox"))), (( ctk_widget_get_type ())))))), FALSE(0)); | |||
272 | return "right-index-finger"; | |||
273 | } | |||
274 | if (ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (WID ("radiobutton2"))((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "radiobutton2"))), ((ctk_widget_get_type ())))))))), ((ctk_toggle_button_get_type ())))))))) { | |||
275 | ctk_widget_set_sensitive (WID ("finger_combobox")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "finger_combobox"))), (( ctk_widget_get_type ())))))), FALSE(0)); | |||
276 | return "left-index-finger"; | |||
277 | } | |||
278 | ctk_widget_set_sensitive (WID ("finger_combobox")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "finger_combobox"))), (( ctk_widget_get_type ())))))), TRUE(!(0))); | |||
279 | index = ctk_combo_box_get_active (CTK_COMBO_BOX (WID ("finger_combobox"))((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "finger_combobox"))), (( ctk_widget_get_type ())))))))), ((ctk_combo_box_get_type ())) ))))); | |||
280 | switch (index) { | |||
281 | case 0: | |||
282 | return "left-thumb"; | |||
283 | case 1: | |||
284 | return "left-middle-finger"; | |||
285 | case 2: | |||
286 | return "left-ring-finger"; | |||
287 | case 3: | |||
288 | return "left-little-finger"; | |||
289 | case 4: | |||
290 | return "right-thumb"; | |||
291 | case 5: | |||
292 | return "right-middle-finger"; | |||
293 | case 6: | |||
294 | return "right-ring-finger"; | |||
295 | case 7: | |||
296 | return "right-little-finger"; | |||
297 | default: | |||
298 | g_assert_not_reached ()do { g_assertion_message_expr ("about-me-properties", "cafe-about-me-fingerprint.c" , 298, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
299 | } | |||
300 | ||||
301 | return NULL((void*)0); | |||
302 | } | |||
303 | ||||
304 | static void | |||
305 | finger_radio_button_toggled (CtkToggleButton *button, EnrollData *data) | |||
306 | { | |||
307 | CtkBuilder *dialog = data->dialog; | |||
308 | char *msg; | |||
309 | ||||
310 | data->finger = selected_finger (data->dialog); | |||
311 | ||||
312 | msg = g_strdup_printf (TR(finger_str_to_msg (data->finger, data->is_swipe))dgettext("fprintd", finger_str_to_msg (data->finger, data-> is_swipe)), data->name); | |||
313 | ctk_label_set_text (CTK_LABEL (WID("enroll-label"))((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "enroll-label"))), ((ctk_widget_get_type ())))))))), ((ctk_label_get_type ())))))), msg); | |||
314 | g_free (msg); | |||
315 | } | |||
316 | ||||
317 | static void | |||
318 | finger_combobox_changed (CtkComboBox *combobox, EnrollData *data) | |||
319 | { | |||
320 | CtkBuilder *dialog = data->dialog; | |||
321 | char *msg; | |||
322 | ||||
323 | data->finger = selected_finger (data->dialog); | |||
324 | ||||
325 | msg = g_strdup_printf (TR(finger_str_to_msg (data->finger, data->is_swipe))dgettext("fprintd", finger_str_to_msg (data->finger, data-> is_swipe)), data->name); | |||
326 | ctk_label_set_text (CTK_LABEL (WID("enroll-label"))((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "enroll-label"))), ((ctk_widget_get_type ())))))))), ((ctk_label_get_type ())))))), msg); | |||
327 | g_free (msg); | |||
328 | } | |||
329 | ||||
330 | static void | |||
331 | assistant_cancelled (CtkAssistant *ass, EnrollData *data) | |||
332 | { | |||
333 | CtkWidget *enable, *disable; | |||
334 | ||||
335 | enable = data->enable; | |||
336 | disable = data->disable; | |||
337 | ||||
338 | enroll_data_destroy (data); | |||
339 | set_fingerprint_label (enable, disable); | |||
340 | } | |||
341 | ||||
342 | static void | |||
343 | enroll_result (GObject *object, const char *result, gboolean done, EnrollData *data) | |||
344 | { | |||
345 | CtkBuilder *dialog = data->dialog; | |||
346 | char *msg; | |||
347 | ||||
348 | if (g_str_equal (result, "enroll-completed")(strcmp ((const char *) (result), (const char *) ("enroll-completed" )) == 0) || g_str_equal (result, "enroll-stage-passed")(strcmp ((const char *) (result), (const char *) ("enroll-stage-passed" )) == 0)) { | |||
349 | char *name, *path; | |||
350 | ||||
351 | data->num_stages_done++; | |||
352 | name = g_strdup_printf ("image%d", data->num_stages_done); | |||
353 | path = g_build_filename (CAFECC_PIXMAP_DIR"/usr/local/share/cafe-control-center/pixmaps", "print_ok.png", NULL((void*)0)); | |||
354 | ctk_image_set_from_file (CTK_IMAGE (WID (name))((((CtkImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, name))), ((ctk_widget_get_type ())))))))), ((ctk_image_get_type ())))))), path); | |||
355 | g_free (name); | |||
356 | g_free (path); | |||
357 | } | |||
358 | if (g_str_equal (result, "enroll-completed")(strcmp ((const char *) (result), (const char *) ("enroll-completed" )) == 0)) { | |||
359 | ctk_label_set_text (CTK_LABEL (WID ("status-label"))((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "status-label"))), ((ctk_widget_get_type ())))))))), ((ctk_label_get_type ())))))), _("Done!")gettext ("Done!")); | |||
360 | ctk_assistant_set_page_complete (CTK_ASSISTANT (data->ass)((((CtkAssistant*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((data->ass)), ((ctk_assistant_get_type ())))))), WID ("page2")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "page2"))), ((ctk_widget_get_type ())))))), TRUE(!(0))); | |||
361 | } | |||
362 | ||||
363 | if (done != FALSE(0)) { | |||
364 | dbus_g_proxy_call(data->device, "EnrollStop", NULL((void*)0), G_TYPE_INVALID((GType) ((0) << (2))), G_TYPE_INVALID((GType) ((0) << (2)))); | |||
365 | data->state = STATE_CLAIMED; | |||
366 | if (g_str_equal (result, "enroll-completed")(strcmp ((const char *) (result), (const char *) ("enroll-completed" )) == 0) == FALSE(0)) { | |||
367 | /* The enrollment failed, restart it */ | |||
368 | dbus_g_proxy_call(data->device, "EnrollStart", NULL((void*)0), G_TYPE_STRING((GType) ((16) << (2))), data->finger, G_TYPE_INVALID((GType) ((0) << (2))), G_TYPE_INVALID((GType) ((0) << (2)))); | |||
369 | data->state = STATE_ENROLLING; | |||
370 | result = "enroll-retry-scan"; | |||
371 | } else { | |||
372 | return; | |||
373 | } | |||
374 | } | |||
375 | ||||
376 | msg = g_strdup_printf (TR(enroll_result_str_to_msg (result, data->is_swipe))dgettext("fprintd", enroll_result_str_to_msg (result, data-> is_swipe)), data->name); | |||
377 | ctk_label_set_text (CTK_LABEL (WID ("status-label"))((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "status-label"))), ((ctk_widget_get_type ())))))))), ((ctk_label_get_type ())))))), msg); | |||
378 | g_free (msg); | |||
379 | } | |||
380 | ||||
381 | static void | |||
382 | assistant_prepare (CtkAssistant *ass, CtkWidget *page, EnrollData *data) | |||
383 | { | |||
384 | const char *name; | |||
385 | ||||
386 | name = g_object_get_data (G_OBJECT (page)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((page)), (((GType) ((20) << (2)))))))), "name"); | |||
387 | if (name == NULL((void*)0)) | |||
| ||||
388 | return; | |||
389 | ||||
390 | if (g_str_equal (name, "enroll")(strcmp ((const char *) (name), (const char *) ("enroll")) == 0)) { | |||
391 | DBusGProxy *p; | |||
392 | GError *error = NULL((void*)0); | |||
393 | CtkBuilder *dialog = data->dialog; | |||
394 | char *path; | |||
395 | guint i; | |||
396 | GValue value = { 0, }; | |||
397 | ||||
398 | if (!dbus_g_proxy_call (data->device, "Claim", &error, G_TYPE_STRING((GType) ((16) << (2))), "", G_TYPE_INVALID((GType) ((0) << (2))), G_TYPE_INVALID((GType) ((0) << (2))))) { | |||
399 | CtkWidget *d; | |||
400 | char *msg; | |||
401 | ||||
402 | /* translators: | |||
403 | * The variable is the name of the device, for example: | |||
404 | * "Could you not access "Digital Persona U.are.U 4000/4000B" device */ | |||
405 | msg = g_strdup_printf (_("Could not access '%s' device")gettext ("Could not access '%s' device"), data->name); | |||
406 | d = get_error_dialog (msg, dbus_g_error_get_name (error), CTK_WINDOW (data->ass)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((data->ass)), ((ctk_window_get_type ()))))))); | |||
407 | g_error_free (error); | |||
408 | ctk_dialog_run (CTK_DIALOG (d)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((d)), ((ctk_dialog_get_type ()))))))); | |||
409 | ctk_widget_destroy (d); | |||
410 | g_free (msg); | |||
411 | ||||
412 | enroll_data_destroy (data); | |||
413 | ||||
414 | return; | |||
415 | } | |||
416 | data->state = STATE_CLAIMED; | |||
417 | ||||
418 | p = dbus_g_proxy_new_from_proxy (data->device, "org.freedesktop.DBus.Properties", NULL((void*)0)); | |||
419 | if (!dbus_g_proxy_call (p, "Get", NULL((void*)0), G_TYPE_STRING((GType) ((16) << (2))), "net.reactivated.Fprint.Device", G_TYPE_STRING((GType) ((16) << (2))), "num-enroll-stages", G_TYPE_INVALID((GType) ((0) << (2))), | |||
420 | G_TYPE_VALUE(g_value_get_type ()), &value, G_TYPE_INVALID((GType) ((0) << (2)))) || g_value_get_int (&value) < 1) { | |||
421 | CtkWidget *d; | |||
422 | char *msg; | |||
423 | ||||
424 | /* translators: | |||
425 | * The variable is the name of the device, for example: | |||
426 | * "Could you not access "Digital Persona U.are.U 4000/4000B" device */ | |||
427 | msg = g_strdup_printf (_("Could not access '%s' device")gettext ("Could not access '%s' device"), data->name); | |||
428 | d = get_error_dialog (msg, "net.reactivated.Fprint.Error.Internal", CTK_WINDOW (data->ass)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((data->ass)), ((ctk_window_get_type ()))))))); | |||
429 | ctk_dialog_run (CTK_DIALOG (d)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((d)), ((ctk_dialog_get_type ()))))))); | |||
430 | ctk_widget_destroy (d); | |||
431 | g_free (msg); | |||
432 | ||||
433 | enroll_data_destroy (data); | |||
434 | ||||
435 | g_object_unref (p); | |||
436 | return; | |||
437 | } | |||
438 | g_object_unref (p); | |||
439 | ||||
440 | data->num_enroll_stages = g_value_get_int (&value); | |||
441 | ||||
442 | /* Hide the extra "bulbs" if not needed */ | |||
443 | for (i = MAX_ENROLL_STAGES5; i > data->num_enroll_stages; i--) { | |||
444 | char *name; | |||
445 | ||||
446 | name = g_strdup_printf ("image%d", i); | |||
447 | ctk_widget_hide (WID (name)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, name))), ((ctk_widget_get_type ()))))))); | |||
448 | g_free (name); | |||
449 | } | |||
450 | /* And set the right image */ | |||
451 | { | |||
452 | char *filename; | |||
453 | ||||
454 | filename = g_strdup_printf ("%s.png", data->finger); | |||
455 | path = g_build_filename (CAFECC_PIXMAP_DIR"/usr/local/share/cafe-control-center/pixmaps", filename, NULL((void*)0)); | |||
456 | g_free (filename); | |||
457 | } | |||
458 | for (i = 1; i <= data->num_enroll_stages; i++) { | |||
459 | char *name; | |||
460 | name = g_strdup_printf ("image%d", i); | |||
461 | ctk_image_set_from_file (CTK_IMAGE (WID (name))((((CtkImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, name))), ((ctk_widget_get_type ())))))))), ((ctk_image_get_type ())))))), path); | |||
462 | g_free (name); | |||
463 | } | |||
464 | g_free (path); | |||
465 | ||||
466 | dbus_g_proxy_add_signal(data->device, "EnrollStatus", G_TYPE_STRING((GType) ((16) << (2))), G_TYPE_BOOLEAN((GType) ((5) << (2))), NULL((void*)0)); | |||
467 | dbus_g_proxy_connect_signal(data->device, "EnrollStatus", G_CALLBACK(enroll_result)((GCallback) (enroll_result)), data, NULL((void*)0)); | |||
468 | ||||
469 | if (!dbus_g_proxy_call(data->device, "EnrollStart", &error, G_TYPE_STRING((GType) ((16) << (2))), data->finger, G_TYPE_INVALID((GType) ((0) << (2))), G_TYPE_INVALID((GType) ((0) << (2))))) { | |||
470 | CtkWidget *d; | |||
471 | char *msg; | |||
472 | ||||
473 | /* translators: | |||
474 | * The variable is the name of the device, for example: | |||
475 | * "Could you not access "Digital Persona U.are.U 4000/4000B" device */ | |||
476 | msg = g_strdup_printf (_("Could not start finger capture on '%s' device")gettext ("Could not start finger capture on '%s' device"), data->name); | |||
477 | d = get_error_dialog (msg, dbus_g_error_get_name (error), CTK_WINDOW (data->ass)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((data->ass)), ((ctk_window_get_type ()))))))); | |||
478 | g_error_free (error); | |||
479 | ctk_dialog_run (CTK_DIALOG (d)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((d)), ((ctk_dialog_get_type ()))))))); | |||
480 | ctk_widget_destroy (d); | |||
481 | g_free (msg); | |||
482 | ||||
483 | enroll_data_destroy (data); | |||
484 | ||||
485 | return; | |||
486 | } | |||
487 | data->state = STATE_ENROLLING;; | |||
488 | } else { | |||
489 | if (data->state == STATE_ENROLLING) { | |||
490 | dbus_g_proxy_call(data->device, "EnrollStop", NULL((void*)0), G_TYPE_INVALID((GType) ((0) << (2))), G_TYPE_INVALID((GType) ((0) << (2)))); | |||
491 | data->state = STATE_CLAIMED; | |||
492 | } | |||
493 | if (data->state == STATE_CLAIMED) { | |||
494 | dbus_g_proxy_call(data->device, "Release", NULL((void*)0), G_TYPE_INVALID((GType) ((0) << (2))), G_TYPE_INVALID((GType) ((0) << (2)))); | |||
495 | data->state = STATE_NONE; | |||
496 | } | |||
497 | } | |||
498 | } | |||
499 | ||||
500 | static void | |||
501 | enroll_fingerprints (CtkWindow *parent, CtkWidget *enable, CtkWidget *disable) | |||
502 | { | |||
503 | DBusGProxy *device, *p; | |||
504 | GHashTable *props; | |||
505 | CtkBuilder *dialog; | |||
506 | EnrollData *data; | |||
507 | CtkWidget *ass; | |||
508 | char *msg; | |||
509 | GError *error = NULL((void*)0); | |||
510 | ||||
511 | device = NULL((void*)0); | |||
512 | ||||
513 | if (manager == NULL((void*)0)) { | |||
514 | create_manager (); | |||
515 | if (manager != NULL((void*)0)) | |||
516 | device = get_first_device (); | |||
517 | } else { | |||
518 | device = get_first_device (); | |||
519 | } | |||
520 | ||||
521 | if (manager == NULL((void*)0) || device == NULL((void*)0)) { | |||
522 | CtkWidget *d; | |||
523 | ||||
524 | d = get_error_dialog (_("Could not access any fingerprint readers")gettext ("Could not access any fingerprint readers"), | |||
525 | _("Please contact your system administrator for help.")gettext ("Please contact your system administrator for help." ), | |||
526 | parent); | |||
527 | ctk_dialog_run (CTK_DIALOG (d)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((d)), ((ctk_dialog_get_type ()))))))); | |||
528 | ctk_widget_destroy (d); | |||
529 | return; | |||
530 | } | |||
531 | ||||
532 | data = g_new0 (EnrollData, 1)((EnrollData *) g_malloc0_n ((1), sizeof (EnrollData))); | |||
533 | data->device = device; | |||
534 | data->enable = enable; | |||
535 | data->disable = disable; | |||
536 | ||||
537 | /* Get some details about the device */ | |||
538 | p = dbus_g_proxy_new_from_proxy (device, "org.freedesktop.DBus.Properties", NULL((void*)0)); | |||
539 | if (dbus_g_proxy_call (p, "GetAll", NULL((void*)0), G_TYPE_STRING((GType) ((16) << (2))), "net.reactivated.Fprint.Device", G_TYPE_INVALID((GType) ((0) << (2))), | |||
540 | dbus_g_type_get_map ("GHashTable", G_TYPE_STRING((GType) ((16) << (2))), G_TYPE_VALUE(g_value_get_type ())), &props, G_TYPE_INVALID((GType) ((0) << (2))))) { | |||
541 | const char *scan_type; | |||
542 | data->name = g_value_dup_string (g_hash_table_lookup (props, "name")); | |||
543 | scan_type = g_value_dup_string (g_hash_table_lookup (props, "scan-type")); | |||
544 | if (g_str_equal (scan_type, "swipe")(strcmp ((const char *) (scan_type), (const char *) ("swipe") ) == 0)) | |||
545 | data->is_swipe = TRUE(!(0)); | |||
546 | g_hash_table_destroy (props); | |||
547 | } | |||
548 | g_object_unref (p); | |||
549 | ||||
550 | dialog = ctk_builder_new (); | |||
551 | if (ctk_builder_add_from_resource (dialog, "/org/cafe/ccc/am/cafe-about-me-fingerprint.ui", &error) == 0) | |||
552 | { | |||
553 | g_warning ("Could not parse UI definition: %s", error->message); | |||
554 | g_error_free (error); | |||
555 | } | |||
556 | data->dialog = dialog; | |||
557 | ||||
558 | ass = WID ("assistant")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "assistant"))), ((ctk_widget_get_type ())))))); | |||
559 | ctk_window_set_title (CTK_WINDOW (ass)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ass)), ((ctk_window_get_type ())))))), _("Enable Fingerprint Login")gettext ("Enable Fingerprint Login")); | |||
560 | ctk_window_set_transient_for (CTK_WINDOW (ass)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ass)), ((ctk_window_get_type ())))))), parent); | |||
561 | ctk_window_set_position (CTK_WINDOW (ass)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ass)), ((ctk_window_get_type ())))))), CTK_WIN_POS_CENTER_ON_PARENT); | |||
562 | g_signal_connect (G_OBJECT (ass), "cancel",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((ass)), (((GType) ((20) << (2)))))) ))), ("cancel"), (((GCallback) (assistant_cancelled))), (data ), ((void*)0), (GConnectFlags) 0) | |||
563 | G_CALLBACK (assistant_cancelled), data)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((ass)), (((GType) ((20) << (2)))))) ))), ("cancel"), (((GCallback) (assistant_cancelled))), (data ), ((void*)0), (GConnectFlags) 0); | |||
564 | g_signal_connect (G_OBJECT (ass), "close",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((ass)), (((GType) ((20) << (2)))))) ))), ("close"), (((GCallback) (assistant_cancelled))), (data) , ((void*)0), (GConnectFlags) 0) | |||
565 | G_CALLBACK (assistant_cancelled), data)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((ass)), (((GType) ((20) << (2)))))) ))), ("close"), (((GCallback) (assistant_cancelled))), (data) , ((void*)0), (GConnectFlags) 0); | |||
566 | g_signal_connect (G_OBJECT (ass), "prepare",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((ass)), (((GType) ((20) << (2)))))) ))), ("prepare"), (((GCallback) (assistant_prepare))), (data) , ((void*)0), (GConnectFlags) 0) | |||
567 | G_CALLBACK (assistant_prepare), data)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((ass)), (((GType) ((20) << (2)))))) ))), ("prepare"), (((GCallback) (assistant_prepare))), (data) , ((void*)0), (GConnectFlags) 0); | |||
568 | ||||
569 | /* Page 1 */ | |||
570 | ctk_combo_box_set_active (CTK_COMBO_BOX (WID ("finger_combobox"))((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "finger_combobox"))), (( ctk_widget_get_type ())))))))), ((ctk_combo_box_get_type ())) )))), 0); | |||
571 | ||||
572 | g_signal_connect (G_OBJECT (WID ("radiobutton1")), "toggled",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((ctk_builder_get_object (dialog, "radiobutton1" ))), ((ctk_widget_get_type ())))))))), (((GType) ((20) << (2))))))))), ("toggled"), (((GCallback) (finger_radio_button_toggled ))), (data), ((void*)0), (GConnectFlags) 0) | |||
573 | G_CALLBACK (finger_radio_button_toggled), data)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((ctk_builder_get_object (dialog, "radiobutton1" ))), ((ctk_widget_get_type ())))))))), (((GType) ((20) << (2))))))))), ("toggled"), (((GCallback) (finger_radio_button_toggled ))), (data), ((void*)0), (GConnectFlags) 0); | |||
574 | g_signal_connect (G_OBJECT (WID ("radiobutton2")), "toggled",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((ctk_builder_get_object (dialog, "radiobutton2" ))), ((ctk_widget_get_type ())))))))), (((GType) ((20) << (2))))))))), ("toggled"), (((GCallback) (finger_radio_button_toggled ))), (data), ((void*)0), (GConnectFlags) 0) | |||
575 | G_CALLBACK (finger_radio_button_toggled), data)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((ctk_builder_get_object (dialog, "radiobutton2" ))), ((ctk_widget_get_type ())))))))), (((GType) ((20) << (2))))))))), ("toggled"), (((GCallback) (finger_radio_button_toggled ))), (data), ((void*)0), (GConnectFlags) 0); | |||
576 | g_signal_connect (G_OBJECT (WID ("radiobutton3")), "toggled",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((ctk_builder_get_object (dialog, "radiobutton3" ))), ((ctk_widget_get_type ())))))))), (((GType) ((20) << (2))))))))), ("toggled"), (((GCallback) (finger_radio_button_toggled ))), (data), ((void*)0), (GConnectFlags) 0) | |||
577 | G_CALLBACK (finger_radio_button_toggled), data)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((ctk_builder_get_object (dialog, "radiobutton3" ))), ((ctk_widget_get_type ())))))))), (((GType) ((20) << (2))))))))), ("toggled"), (((GCallback) (finger_radio_button_toggled ))), (data), ((void*)0), (GConnectFlags) 0); | |||
578 | g_signal_connect (G_OBJECT (WID ("finger_combobox")), "changed",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((ctk_builder_get_object (dialog, "finger_combobox" ))), ((ctk_widget_get_type ())))))))), (((GType) ((20) << (2))))))))), ("changed"), (((GCallback) (finger_combobox_changed ))), (data), ((void*)0), (GConnectFlags) 0) | |||
579 | G_CALLBACK (finger_combobox_changed), data)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((ctk_builder_get_object (dialog, "finger_combobox" ))), ((ctk_widget_get_type ())))))))), (((GType) ((20) << (2))))))))), ("changed"), (((GCallback) (finger_combobox_changed ))), (data), ((void*)0), (GConnectFlags) 0); | |||
580 | ||||
581 | data->finger = selected_finger (dialog); | |||
582 | ||||
583 | g_object_set_data (G_OBJECT (WID("page1"))((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "page1"))), ((ctk_widget_get_type ())))))))), (((GType) ((20) << (2)))))))), "name", "intro"); | |||
584 | ||||
585 | /* translators: | |||
586 | * The variable is the name of the device, for example: | |||
587 | * "To enable fingerprint login, you need to save one of your fingerprints, using the | |||
588 | * 'Digital Persona U.are.U 4000/4000B' device." */ | |||
589 | msg = g_strdup_printf (_("To enable fingerprint login, you need to save one of your fingerprints, using the '%s' device.")gettext ("To enable fingerprint login, you need to save one of your fingerprints, using the '%s' device." ), | |||
590 | data->name); | |||
591 | ctk_label_set_text (CTK_LABEL (WID("intro-label"))((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "intro-label"))), ((ctk_widget_get_type ())))))))), ((ctk_label_get_type ())))))), msg); | |||
592 | g_free (msg); | |||
593 | ||||
594 | ctk_assistant_set_page_complete (CTK_ASSISTANT (ass)((((CtkAssistant*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ass)), ((ctk_assistant_get_type ())))))), WID("page1")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "page1"))), ((ctk_widget_get_type ())))))), TRUE(!(0))); | |||
595 | ||||
596 | /* Page 2 */ | |||
597 | if (data->is_swipe != FALSE(0)) | |||
598 | ctk_assistant_set_page_title (CTK_ASSISTANT (ass)((((CtkAssistant*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ass)), ((ctk_assistant_get_type ())))))), WID("page2")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "page2"))), ((ctk_widget_get_type ())))))), _("Swipe finger on reader")gettext ("Swipe finger on reader")); | |||
599 | else | |||
600 | ctk_assistant_set_page_title (CTK_ASSISTANT (ass)((((CtkAssistant*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ass)), ((ctk_assistant_get_type ())))))), WID("page2")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "page2"))), ((ctk_widget_get_type ())))))), _("Place finger on reader")gettext ("Place finger on reader")); | |||
601 | ||||
602 | g_object_set_data (G_OBJECT (WID("page2"))((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "page2"))), ((ctk_widget_get_type ())))))))), (((GType) ((20) << (2)))))))), "name", "enroll"); | |||
603 | ||||
604 | msg = g_strdup_printf (TR(finger_str_to_msg (data->finger, data->is_swipe))dgettext("fprintd", finger_str_to_msg (data->finger, data-> is_swipe)), data->name); | |||
605 | ctk_label_set_text (CTK_LABEL (WID("enroll-label"))((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "enroll-label"))), ((ctk_widget_get_type ())))))))), ((ctk_label_get_type ())))))), msg); | |||
606 | g_free (msg); | |||
607 | ||||
608 | /* Page 3 */ | |||
609 | g_object_set_data (G_OBJECT (WID("page3"))((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "page3"))), ((ctk_widget_get_type ())))))))), (((GType) ((20) << (2)))))))), "name", "summary"); | |||
610 | ||||
611 | data->ass = ass; | |||
612 | ctk_widget_show_all (ass); | |||
613 | } | |||
614 | ||||
615 | void | |||
616 | fingerprint_button_clicked (CtkBuilder *dialog, | |||
617 | CtkWidget *enable, | |||
618 | CtkWidget *disable) | |||
619 | { | |||
620 | bindtextdomain ("fprintd", CAFELOCALEDIR"/usr/local/share/locale"); | |||
621 | bind_textdomain_codeset ("fprintd", "UTF-8"); | |||
622 | ||||
623 | if (is_disable != FALSE(0)) { | |||
624 | delete_fingerprints_question (dialog, enable, disable); | |||
625 | } else { | |||
626 | enroll_fingerprints (CTK_WINDOW (WID ("about-me-dialog"))((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (dialog, "about-me-dialog"))), (( ctk_widget_get_type ())))))))), ((ctk_window_get_type ()))))) ), enable, disable); | |||
627 | } | |||
628 | } | |||
629 |