File: | rc/gs-lock-plug.c |
Warning: | line 188, column 13 Null pointer passed to 1st parameter expecting 'nonnull' |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- | |||
2 | * | |||
3 | * Copyright (C) 2004-2006 William Jon McCann <mccann@jhu.edu> | |||
4 | * | |||
5 | * This program is free software; you can redistribute it and/or modify | |||
6 | * it under the terms of the GNU General Public License as published by | |||
7 | * the Free Software Foundation; either version 2 of the License, or | |||
8 | * (at your option) any later version. | |||
9 | * | |||
10 | * This program is distributed in the hope that it will be useful, | |||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
13 | * GNU General Public License for more details. | |||
14 | * | |||
15 | * You should have received a copy of the GNU General Public License | |||
16 | * along with this program; if not, write to the Free Software | |||
17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |||
18 | * | |||
19 | * Authors: William Jon McCann <mccann@jhu.edu> | |||
20 | * | |||
21 | */ | |||
22 | ||||
23 | #include "config.h" | |||
24 | ||||
25 | #include <stdlib.h> | |||
26 | #include <unistd.h> | |||
27 | #include <string.h> | |||
28 | #include <errno(*__errno_location ()).h> | |||
29 | #include <time.h> | |||
30 | #include <unistd.h> | |||
31 | #include <sys/utsname.h> | |||
32 | ||||
33 | #include <glib/gprintf.h> | |||
34 | #include <glib/gstdio.h> | |||
35 | #include <glib/gi18n.h> | |||
36 | #include <cdk/cdkkeysyms.h> | |||
37 | #include <cdk/cdkx.h> | |||
38 | #include <ctk/ctk.h> | |||
39 | #include <ctk/ctkx.h> | |||
40 | #include <gio/gio.h> | |||
41 | ||||
42 | #define CAFE_DESKTOP_USE_UNSTABLE_API | |||
43 | #include <libcafe-desktop/cafe-desktop-utils.h> | |||
44 | ||||
45 | #ifdef WITH_KBD_LAYOUT_INDICATOR1 | |||
46 | #include <libcafekbd/cafekbd-indicator.h> | |||
47 | #endif | |||
48 | ||||
49 | #ifdef WITH_LIBNOTIFY1 | |||
50 | #include <libnotify/notify.h> | |||
51 | #endif | |||
52 | ||||
53 | #include "gs-lock-plug.h" | |||
54 | ||||
55 | #include "gs-debug.h" | |||
56 | ||||
57 | #define GSETTINGS_SCHEMA"org.cafe.screensaver" "org.cafe.screensaver" | |||
58 | ||||
59 | #define KEY_LOCK_DIALOG_THEME"lock-dialog-theme" "lock-dialog-theme" | |||
60 | ||||
61 | #define MDM_FLEXISERVER_COMMAND"mdmflexiserver" "mdmflexiserver" | |||
62 | #define MDM_FLEXISERVER_ARGS"--startnew Standard" "--startnew Standard" | |||
63 | ||||
64 | #define GDM_FLEXISERVER_COMMAND"gdmflexiserver" "gdmflexiserver" | |||
65 | #define GDM_FLEXISERVER_ARGS"--startnew Standard" "--startnew Standard" | |||
66 | ||||
67 | /* same as SMS ;) */ | |||
68 | #define NOTE_BUFFER_MAX_CHARS160 160 | |||
69 | ||||
70 | enum | |||
71 | { | |||
72 | AUTH_PAGE = 0, | |||
73 | }; | |||
74 | ||||
75 | #define FACE_ICON_SIZE48 48 | |||
76 | #define DIALOG_TIMEOUT_MSEC60000 60000 | |||
77 | ||||
78 | static void gs_lock_plug_finalize (GObject *object); | |||
79 | ||||
80 | struct GSLockPlugPrivate | |||
81 | { | |||
82 | CtkWidget *vbox; | |||
83 | CtkWidget *auth_action_area; | |||
84 | ||||
85 | CtkWidget *notebook; | |||
86 | CtkWidget *auth_face_image; | |||
87 | CtkWidget *auth_time_label; | |||
88 | CtkWidget *auth_date_label; | |||
89 | CtkWidget *auth_realname_label; | |||
90 | CtkWidget *auth_username_label; | |||
91 | CtkWidget *auth_prompt_label; | |||
92 | CtkWidget *auth_prompt_entry; | |||
93 | CtkWidget *auth_prompt_box; | |||
94 | CtkWidget *auth_capslock_label; | |||
95 | CtkWidget *auth_message_label; | |||
96 | CtkWidget *status_message_label; | |||
97 | ||||
98 | CtkWidget *auth_unlock_button; | |||
99 | CtkWidget *auth_switch_button; | |||
100 | CtkWidget *auth_cancel_button; | |||
101 | CtkWidget *auth_logout_button; | |||
102 | CtkWidget *auth_note_button; | |||
103 | CtkWidget *note_tab; | |||
104 | CtkWidget *note_tab_label; | |||
105 | CtkWidget *note_text_view; | |||
106 | CtkWidget *note_ok_button; | |||
107 | CtkWidget *note_cancel_button; | |||
108 | ||||
109 | CtkWidget *auth_prompt_kbd_layout_indicator; | |||
110 | ||||
111 | gboolean caps_lock_on; | |||
112 | gboolean switch_enabled; | |||
113 | gboolean leave_note_enabled; | |||
114 | gboolean logout_enabled; | |||
115 | char *logout_command; | |||
116 | char *status_message; | |||
117 | ||||
118 | guint timeout; | |||
119 | ||||
120 | guint datetime_timeout_id; | |||
121 | guint cancel_timeout_id; | |||
122 | guint auth_check_idle_id; | |||
123 | guint response_idle_id; | |||
124 | ||||
125 | GList *key_events; | |||
126 | }; | |||
127 | ||||
128 | typedef struct _ResponseData ResponseData; | |||
129 | ||||
130 | struct _ResponseData | |||
131 | { | |||
132 | gint response_id; | |||
133 | }; | |||
134 | ||||
135 | ||||
136 | enum | |||
137 | { | |||
138 | RESPONSE, | |||
139 | CLOSE, | |||
140 | LAST_SIGNAL | |||
141 | }; | |||
142 | ||||
143 | enum | |||
144 | { | |||
145 | PROP_0, | |||
146 | PROP_LOGOUT_ENABLED, | |||
147 | PROP_LOGOUT_COMMAND, | |||
148 | PROP_SWITCH_ENABLED, | |||
149 | PROP_STATUS_MESSAGE | |||
150 | }; | |||
151 | ||||
152 | static guint lock_plug_signals [LAST_SIGNAL] = { 0 }; | |||
153 | ||||
154 | G_DEFINE_TYPE_WITH_PRIVATE (GSLockPlug, gs_lock_plug, CTK_TYPE_PLUG)static void gs_lock_plug_init (GSLockPlug *self); static void gs_lock_plug_class_init (GSLockPlugClass *klass); static GType gs_lock_plug_get_type_once (void); static gpointer gs_lock_plug_parent_class = ((void*)0); static gint GSLockPlug_private_offset; static void gs_lock_plug_class_intern_init (gpointer klass) { gs_lock_plug_parent_class = g_type_class_peek_parent (klass); if (GSLockPlug_private_offset != 0) g_type_class_adjust_private_offset (klass, &GSLockPlug_private_offset ); gs_lock_plug_class_init ((GSLockPlugClass*) klass); } __attribute__ ((__unused__)) static inline gpointer gs_lock_plug_get_instance_private (GSLockPlug *self) { return (((gpointer) ((guint8*) (self) + (glong) (GSLockPlug_private_offset)))); } GType gs_lock_plug_get_type (void) { static GType static_g_define_type_id = 0; if ((__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer), "Expression evaluates to false"); (void) ( 0 ? (gpointer) * (&static_g_define_type_id) : ((void*)0)) ; (!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id ) == sizeof (gpointer), "Expression evaluates to false"); __typeof__ (*(&static_g_define_type_id)) gapg_temp_newval; __typeof__ ((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id ); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5) ; gapg_temp_newval; })) && g_once_init_enter_pointer ( &static_g_define_type_id)); })) ) { GType g_define_type_id = gs_lock_plug_get_type_once (); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer) , "Expression evaluates to false"); 0 ? (void) (*(&static_g_define_type_id ) = (g_define_type_id)) : (void) 0; g_once_init_leave_pointer ((&static_g_define_type_id), (gpointer) (guintptr) (g_define_type_id )); })) ; } return static_g_define_type_id; } __attribute__ ( (__noinline__)) static GType gs_lock_plug_get_type_once (void ) { GType g_define_type_id = g_type_register_static_simple (( ctk_plug_get_type ()), g_intern_static_string ("GSLockPlug"), sizeof (GSLockPlugClass), (GClassInitFunc)(void (*)(void)) gs_lock_plug_class_intern_init , sizeof (GSLockPlug), (GInstanceInitFunc)(void (*)(void)) gs_lock_plug_init , (GTypeFlags) 0); { {{ GSLockPlug_private_offset = g_type_add_instance_private (g_define_type_id, sizeof (GSLockPlugPrivate)); };} } return g_define_type_id; } | |||
155 | ||||
156 | static void | |||
157 | gs_lock_plug_style_set (CtkWidget *widget, | |||
158 | CtkStyle *previous_style) | |||
159 | { | |||
160 | GSLockPlug *plug; | |||
161 | ||||
162 | if (CTK_WIDGET_CLASS (gs_lock_plug_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((gs_lock_plug_parent_class)), ((ctk_widget_get_type ()))) )))->style_set) | |||
163 | { | |||
164 | CTK_WIDGET_CLASS (gs_lock_plug_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((gs_lock_plug_parent_class)), ((ctk_widget_get_type ()))) )))->style_set (widget, previous_style); | |||
165 | } | |||
166 | ||||
167 | plug = GS_LOCK_PLUG (widget)((((GSLockPlug*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((gs_lock_plug_get_type ())))))); | |||
168 | ||||
169 | if (! plug->priv->vbox) | |||
170 | { | |||
171 | return; | |||
172 | } | |||
173 | ||||
174 | ctk_container_set_border_width (CTK_CONTAINER (plug->priv->vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->vbox)), ((ctk_container_get_type ()))) ))), 12); | |||
175 | ctk_box_set_spacing (CTK_BOX (plug->priv->vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->vbox)), ((ctk_box_get_type ())))))), 12); | |||
176 | ||||
177 | ctk_container_set_border_width (CTK_CONTAINER (plug->priv->auth_action_area)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_action_area)), ((ctk_container_get_type ())))))), 0); | |||
178 | ctk_box_set_spacing (CTK_BOX (plug->priv->auth_action_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_action_area)), ((ctk_box_get_type ())))))), 5); | |||
179 | } | |||
180 | ||||
181 | static gboolean | |||
182 | process_is_running (const char * name) | |||
183 | { | |||
184 | int num_processes; | |||
185 | gchar *command = g_strdup_printf ("pidof %s | wc -l", name); | |||
186 | FILE *fp = popen(command, "r"); | |||
187 | ||||
188 | if (fscanf(fp, "%d", &num_processes) != 1) | |||
| ||||
189 | num_processes = 0; | |||
190 | ||||
191 | pclose(fp); | |||
192 | g_free (command); | |||
193 | ||||
194 | if (num_processes > 0) { | |||
195 | return TRUE(!(0)); | |||
196 | } else { | |||
197 | return FALSE(0); | |||
198 | } | |||
199 | } | |||
200 | ||||
201 | static void | |||
202 | do_user_switch (GSLockPlug *plug) | |||
203 | { | |||
204 | GError *error; | |||
205 | gboolean res; | |||
206 | char *command; | |||
207 | ||||
208 | if (process_is_running ("mdm")) | |||
209 | { | |||
210 | /* MDM */ | |||
211 | command = g_strdup_printf ("%s %s", | |||
212 | MDM_FLEXISERVER_COMMAND"mdmflexiserver", | |||
213 | MDM_FLEXISERVER_ARGS"--startnew Standard"); | |||
214 | ||||
215 | error = NULL((void*)0); | |||
216 | res = cafe_cdk_spawn_command_line_on_screen (cdk_screen_get_default (), | |||
217 | command, | |||
218 | &error); | |||
219 | ||||
220 | g_free (command); | |||
221 | ||||
222 | if (! res) | |||
223 | { | |||
224 | gs_debug ("Unable to start MDM greeter: %s", error->message)gs_debug_real (__func__, "gs-lock-plug.c", 224, "Unable to start MDM greeter: %s" , error->message); | |||
225 | g_error_free (error); | |||
226 | } | |||
227 | } | |||
228 | else if (process_is_running ("gdm") || process_is_running("gdm3") || process_is_running("gdm-binary")) | |||
229 | { | |||
230 | /* GDM */ | |||
231 | command = g_strdup_printf ("%s %s", | |||
232 | GDM_FLEXISERVER_COMMAND"gdmflexiserver", | |||
233 | GDM_FLEXISERVER_ARGS"--startnew Standard"); | |||
234 | ||||
235 | error = NULL((void*)0); | |||
236 | res = cafe_cdk_spawn_command_line_on_screen (cdk_screen_get_default (), | |||
237 | command, | |||
238 | &error); | |||
239 | ||||
240 | g_free (command); | |||
241 | ||||
242 | if (! res) { | |||
243 | gs_debug ("Unable to start GDM greeter: %s", error->message)gs_debug_real (__func__, "gs-lock-plug.c", 243, "Unable to start GDM greeter: %s" , error->message); | |||
244 | g_error_free (error); | |||
245 | } | |||
246 | } | |||
247 | else if (g_getenv ("XDG_SEAT_PATH") != NULL((void*)0)) | |||
248 | { | |||
249 | /* LightDM */ | |||
250 | GDBusProxyFlags flags = G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START; | |||
251 | GDBusProxy *proxy = NULL((void*)0); | |||
252 | ||||
253 | error = NULL((void*)0); | |||
254 | proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM, | |||
255 | flags, | |||
256 | NULL((void*)0), | |||
257 | "org.freedesktop.DisplayManager", | |||
258 | g_getenv ("XDG_SEAT_PATH"), | |||
259 | "org.freedesktop.DisplayManager.Seat", | |||
260 | NULL((void*)0), | |||
261 | &error); | |||
262 | if (proxy != NULL((void*)0)) { | |||
263 | g_dbus_proxy_call_sync (proxy, | |||
264 | "SwitchToGreeter", | |||
265 | g_variant_new ("()"), | |||
266 | G_DBUS_CALL_FLAGS_NONE, | |||
267 | -1, | |||
268 | NULL((void*)0), | |||
269 | NULL((void*)0)); | |||
270 | g_object_unref (proxy); | |||
271 | } | |||
272 | else { | |||
273 | gs_debug ("Unable to start LightDM greeter: %s", error->message)gs_debug_real (__func__, "gs-lock-plug.c", 273, "Unable to start LightDM greeter: %s" , error->message); | |||
274 | g_error_free (error); | |||
275 | } | |||
276 | } | |||
277 | ||||
278 | } | |||
279 | ||||
280 | static void | |||
281 | set_status_text (GSLockPlug *plug, | |||
282 | const char *text) | |||
283 | { | |||
284 | if (plug->priv->auth_message_label != NULL((void*)0)) | |||
285 | { | |||
286 | ctk_label_set_text (CTK_LABEL (plug->priv->auth_message_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_message_label)), ((ctk_label_get_type ())))))), text); | |||
287 | } | |||
288 | } | |||
289 | ||||
290 | static void | |||
291 | date_time_update (GSLockPlug *plug) | |||
292 | { | |||
293 | GDateTime *datetime; | |||
294 | gchar *time; | |||
295 | gchar *date; | |||
296 | gchar *str; | |||
297 | ||||
298 | datetime = g_date_time_new_now_local (); | |||
299 | time = g_date_time_format (datetime, "%X"); | |||
300 | /* Translators: Date format, see https://developer.gnome.org/glib/stable/glib-GDateTime.html#g-date-time-format */ | |||
301 | date = g_date_time_format (datetime, _("%A, %B %e")gettext ("%A, %B %e")); | |||
302 | ||||
303 | str = g_strdup_printf ("<span size=\"xx-large\" weight=\"ultrabold\">%s</span>", time); | |||
304 | ctk_label_set_text (CTK_LABEL (plug->priv->auth_time_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_time_label)), ((ctk_label_get_type ())))))), str); | |||
305 | ctk_label_set_use_markup (CTK_LABEL (plug->priv->auth_time_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_time_label)), ((ctk_label_get_type ())))))), TRUE(!(0))); | |||
306 | g_free (str); | |||
307 | ||||
308 | str = g_strdup_printf ("<span size=\"large\">%s</span>", date); | |||
309 | ctk_label_set_markup (CTK_LABEL (plug->priv->auth_date_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_date_label)), ((ctk_label_get_type ())))))), str); | |||
310 | ctk_label_set_use_markup (CTK_LABEL (plug->priv->auth_date_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_date_label)), ((ctk_label_get_type ())))))), TRUE(!(0))); | |||
311 | g_free (str); | |||
312 | ||||
313 | g_free (time); | |||
314 | g_free (date); | |||
315 | g_date_time_unref (datetime); | |||
316 | } | |||
317 | ||||
318 | void | |||
319 | gs_lock_plug_set_sensitive (GSLockPlug *plug, | |||
320 | gboolean sensitive) | |||
321 | { | |||
322 | g_return_if_fail (GS_IS_LOCK_PLUG (plug))do{ (void)0; }while (0); | |||
323 | ||||
324 | ctk_widget_set_sensitive (plug->priv->auth_prompt_entry, sensitive); | |||
325 | ctk_widget_set_sensitive (plug->priv->auth_action_area, sensitive); | |||
326 | ctk_widget_set_can_focus (plug->priv->auth_prompt_entry, sensitive); | |||
327 | ctk_widget_set_can_focus (plug->priv->auth_action_area, sensitive); | |||
328 | } | |||
329 | ||||
330 | static void | |||
331 | remove_datetime_timeout (GSLockPlug *plug) | |||
332 | { | |||
333 | if (plug->priv->datetime_timeout_id > 0) | |||
334 | { | |||
335 | g_source_remove (plug->priv->datetime_timeout_id); | |||
336 | plug->priv->datetime_timeout_id = 0; | |||
337 | } | |||
338 | } | |||
339 | ||||
340 | static void | |||
341 | remove_cancel_timeout (GSLockPlug *plug) | |||
342 | { | |||
343 | if (plug->priv->cancel_timeout_id > 0) | |||
344 | { | |||
345 | g_source_remove (plug->priv->cancel_timeout_id); | |||
346 | plug->priv->cancel_timeout_id = 0; | |||
347 | } | |||
348 | } | |||
349 | ||||
350 | static void | |||
351 | remove_response_idle (GSLockPlug *plug) | |||
352 | { | |||
353 | if (plug->priv->response_idle_id > 0) | |||
354 | { | |||
355 | g_source_remove (plug->priv->response_idle_id); | |||
356 | plug->priv->response_idle_id = 0; | |||
357 | } | |||
358 | } | |||
359 | ||||
360 | static void | |||
361 | gs_lock_plug_response (GSLockPlug *plug, | |||
362 | gint response_id) | |||
363 | { | |||
364 | int new_response; | |||
365 | ||||
366 | new_response = response_id; | |||
367 | ||||
368 | g_return_if_fail (GS_IS_LOCK_PLUG (plug))do{ (void)0; }while (0); | |||
369 | ||||
370 | /* Act only on response IDs we recognize */ | |||
371 | if (!(response_id == GS_LOCK_PLUG_RESPONSE_OK | |||
372 | || response_id == GS_LOCK_PLUG_RESPONSE_CANCEL)) | |||
373 | { | |||
374 | return; | |||
375 | } | |||
376 | ||||
377 | remove_cancel_timeout (plug); | |||
378 | remove_response_idle (plug); | |||
379 | ||||
380 | if (response_id == GS_LOCK_PLUG_RESPONSE_CANCEL) | |||
381 | { | |||
382 | ctk_entry_set_text (CTK_ENTRY (plug->priv->auth_prompt_entry)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_prompt_entry)), ((ctk_entry_get_type ())))))), ""); | |||
383 | } | |||
384 | ||||
385 | g_signal_emit (plug, | |||
386 | lock_plug_signals [RESPONSE], | |||
387 | 0, | |||
388 | new_response); | |||
389 | } | |||
390 | ||||
391 | static gboolean | |||
392 | response_cancel_idle_cb (GSLockPlug *plug) | |||
393 | { | |||
394 | plug->priv->response_idle_id = 0; | |||
395 | ||||
396 | gs_lock_plug_response (plug, GS_LOCK_PLUG_RESPONSE_CANCEL); | |||
397 | ||||
398 | return FALSE(0); | |||
399 | } | |||
400 | ||||
401 | static gboolean | |||
402 | dialog_timed_out (GSLockPlug *plug) | |||
403 | { | |||
404 | gs_lock_plug_set_sensitive (plug, FALSE(0)); | |||
405 | set_status_text (plug, _("Time has expired.")gettext ("Time has expired.")); | |||
406 | ||||
407 | if (plug->priv->response_idle_id != 0) | |||
408 | { | |||
409 | g_warning ("Response idle ID already set but shouldn't be"); | |||
410 | } | |||
411 | ||||
412 | remove_response_idle (plug); | |||
413 | ||||
414 | plug->priv->response_idle_id = g_timeout_add (2000, | |||
415 | (GSourceFunc)response_cancel_idle_cb, | |||
416 | plug); | |||
417 | return FALSE(0); | |||
418 | } | |||
419 | ||||
420 | ||||
421 | static void | |||
422 | capslock_update (GSLockPlug *plug, | |||
423 | gboolean is_on) | |||
424 | { | |||
425 | ||||
426 | plug->priv->caps_lock_on = is_on; | |||
427 | ||||
428 | if (plug->priv->auth_capslock_label == NULL((void*)0)) | |||
429 | { | |||
430 | return; | |||
431 | } | |||
432 | ||||
433 | if (is_on) | |||
434 | { | |||
435 | ctk_label_set_text (CTK_LABEL (plug->priv->auth_capslock_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_capslock_label)), ((ctk_label_get_type ())))))), | |||
436 | _("You have the Caps Lock key on.")gettext ("You have the Caps Lock key on.")); | |||
437 | } | |||
438 | else | |||
439 | { | |||
440 | ctk_label_set_text (CTK_LABEL (plug->priv->auth_capslock_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_capslock_label)), ((ctk_label_get_type ())))))), | |||
441 | ""); | |||
442 | } | |||
443 | } | |||
444 | ||||
445 | static gboolean | |||
446 | is_capslock_on (void) | |||
447 | { | |||
448 | CdkKeymap *keymap; | |||
449 | gboolean res; | |||
450 | ||||
451 | res = FALSE(0); | |||
452 | ||||
453 | keymap = cdk_keymap_get_for_display (cdk_display_get_default ()); | |||
454 | if (keymap != NULL((void*)0)) { | |||
455 | res = cdk_keymap_get_caps_lock_state (keymap); | |||
456 | } | |||
457 | ||||
458 | return res; | |||
459 | } | |||
460 | ||||
461 | static void | |||
462 | restart_cancel_timeout (GSLockPlug *plug) | |||
463 | { | |||
464 | remove_cancel_timeout (plug); | |||
465 | ||||
466 | plug->priv->cancel_timeout_id = g_timeout_add (plug->priv->timeout, | |||
467 | (GSourceFunc)dialog_timed_out, | |||
468 | plug); | |||
469 | } | |||
470 | ||||
471 | void | |||
472 | gs_lock_plug_get_text (GSLockPlug *plug, | |||
473 | char **text) | |||
474 | { | |||
475 | const char *typed_text; | |||
476 | char *null_text; | |||
477 | char *local_text; | |||
478 | ||||
479 | typed_text = ctk_entry_get_text (CTK_ENTRY (plug->priv->auth_prompt_entry)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_prompt_entry)), ((ctk_entry_get_type ()))))))); | |||
480 | local_text = g_locale_from_utf8 (typed_text, strlen (typed_text), NULL((void*)0), NULL((void*)0), NULL((void*)0)); | |||
481 | ||||
482 | null_text = g_strnfill (strlen (typed_text) + 1, '\b'); | |||
483 | ctk_entry_set_text (CTK_ENTRY (plug->priv->auth_prompt_entry)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_prompt_entry)), ((ctk_entry_get_type ())))))), null_text); | |||
484 | ctk_entry_set_text (CTK_ENTRY (plug->priv->auth_prompt_entry)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_prompt_entry)), ((ctk_entry_get_type ())))))), ""); | |||
485 | g_free (null_text); | |||
486 | ||||
487 | if (text != NULL((void*)0)) | |||
488 | { | |||
489 | *text = local_text; | |||
490 | } | |||
491 | else | |||
492 | { | |||
493 | g_free (local_text); | |||
494 | } | |||
495 | } | |||
496 | ||||
497 | typedef struct | |||
498 | { | |||
499 | GSLockPlug *plug; | |||
500 | gint response_id; | |||
501 | GMainLoop *loop; | |||
502 | gboolean destroyed; | |||
503 | } RunInfo; | |||
504 | ||||
505 | static void | |||
506 | shutdown_loop (RunInfo *ri) | |||
507 | { | |||
508 | if (g_main_loop_is_running (ri->loop)) | |||
509 | g_main_loop_quit (ri->loop); | |||
510 | } | |||
511 | ||||
512 | static void | |||
513 | run_unmap_handler (GSLockPlug *plug, | |||
514 | gpointer data) | |||
515 | { | |||
516 | RunInfo *ri = data; | |||
517 | ||||
518 | shutdown_loop (ri); | |||
519 | } | |||
520 | ||||
521 | static void | |||
522 | run_response_handler (GSLockPlug *plug, | |||
523 | gint response_id, | |||
524 | gpointer data) | |||
525 | { | |||
526 | RunInfo *ri; | |||
527 | ||||
528 | ri = data; | |||
529 | ||||
530 | ri->response_id = response_id; | |||
531 | ||||
532 | shutdown_loop (ri); | |||
533 | } | |||
534 | ||||
535 | static gint | |||
536 | run_delete_handler (GSLockPlug *plug, | |||
537 | CdkEventAny *event, | |||
538 | gpointer data) | |||
539 | { | |||
540 | RunInfo *ri = data; | |||
541 | ||||
542 | shutdown_loop (ri); | |||
543 | ||||
544 | return TRUE(!(0)); /* Do not destroy */ | |||
545 | } | |||
546 | ||||
547 | static void | |||
548 | run_destroy_handler (GSLockPlug *plug, | |||
549 | gpointer data) | |||
550 | { | |||
551 | RunInfo *ri = data; | |||
552 | ||||
553 | /* shutdown_loop will be called by run_unmap_handler */ | |||
554 | ri->destroyed = TRUE(!(0)); | |||
555 | } | |||
556 | ||||
557 | static void | |||
558 | run_keymap_handler (CdkKeymap *keymap, | |||
559 | GSLockPlug *plug) | |||
560 | { | |||
561 | capslock_update (plug, is_capslock_on ()); | |||
562 | } | |||
563 | ||||
564 | /* adapted from CTK+ ctkdialog.c */ | |||
565 | int | |||
566 | gs_lock_plug_run (GSLockPlug *plug) | |||
567 | { | |||
568 | RunInfo ri = { NULL((void*)0), CTK_RESPONSE_NONE, NULL((void*)0), FALSE(0) }; | |||
569 | gboolean was_modal; | |||
570 | gulong response_handler; | |||
571 | gulong unmap_handler; | |||
572 | gulong destroy_handler; | |||
573 | gulong delete_handler; | |||
574 | gulong keymap_handler; | |||
575 | CdkKeymap *keymap; | |||
576 | ||||
577 | g_return_val_if_fail (GS_IS_LOCK_PLUG (plug), -1)do{ (void)0; }while (0); | |||
578 | ||||
579 | g_object_ref (plug)((__typeof__ (plug)) (g_object_ref) (plug)); | |||
580 | ||||
581 | was_modal = ctk_window_get_modal (CTK_WINDOW (plug)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((ctk_window_get_type ()))))))); | |||
582 | if (!was_modal) | |||
583 | { | |||
584 | ctk_window_set_modal (CTK_WINDOW (plug)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((ctk_window_get_type ())))))), TRUE(!(0))); | |||
585 | } | |||
586 | ||||
587 | if (!ctk_widget_get_visible (CTK_WIDGET (plug)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((ctk_widget_get_type ())))))))) | |||
588 | { | |||
589 | ctk_widget_show (CTK_WIDGET (plug)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((ctk_widget_get_type ()))))))); | |||
590 | } | |||
591 | ||||
592 | keymap = cdk_keymap_get_for_display (ctk_widget_get_display (CTK_WIDGET (plug)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((ctk_widget_get_type ())))))))); | |||
593 | ||||
594 | keymap_handler = | |||
595 | g_signal_connect (keymap,g_signal_connect_data ((keymap), ("state-changed"), (((GCallback ) (run_keymap_handler))), (plug), ((void*)0), (GConnectFlags) 0) | |||
596 | "state-changed",g_signal_connect_data ((keymap), ("state-changed"), (((GCallback ) (run_keymap_handler))), (plug), ((void*)0), (GConnectFlags) 0) | |||
597 | G_CALLBACK (run_keymap_handler),g_signal_connect_data ((keymap), ("state-changed"), (((GCallback ) (run_keymap_handler))), (plug), ((void*)0), (GConnectFlags) 0) | |||
598 | plug)g_signal_connect_data ((keymap), ("state-changed"), (((GCallback ) (run_keymap_handler))), (plug), ((void*)0), (GConnectFlags) 0); | |||
599 | ||||
600 | response_handler = | |||
601 | g_signal_connect (plug,g_signal_connect_data ((plug), ("response"), (((GCallback) (run_response_handler ))), (&ri), ((void*)0), (GConnectFlags) 0) | |||
602 | "response",g_signal_connect_data ((plug), ("response"), (((GCallback) (run_response_handler ))), (&ri), ((void*)0), (GConnectFlags) 0) | |||
603 | G_CALLBACK (run_response_handler),g_signal_connect_data ((plug), ("response"), (((GCallback) (run_response_handler ))), (&ri), ((void*)0), (GConnectFlags) 0) | |||
604 | &ri)g_signal_connect_data ((plug), ("response"), (((GCallback) (run_response_handler ))), (&ri), ((void*)0), (GConnectFlags) 0); | |||
605 | ||||
606 | unmap_handler = | |||
607 | g_signal_connect (plug,g_signal_connect_data ((plug), ("unmap"), (((GCallback) (run_unmap_handler ))), (&ri), ((void*)0), (GConnectFlags) 0) | |||
608 | "unmap",g_signal_connect_data ((plug), ("unmap"), (((GCallback) (run_unmap_handler ))), (&ri), ((void*)0), (GConnectFlags) 0) | |||
609 | G_CALLBACK (run_unmap_handler),g_signal_connect_data ((plug), ("unmap"), (((GCallback) (run_unmap_handler ))), (&ri), ((void*)0), (GConnectFlags) 0) | |||
610 | &ri)g_signal_connect_data ((plug), ("unmap"), (((GCallback) (run_unmap_handler ))), (&ri), ((void*)0), (GConnectFlags) 0); | |||
611 | ||||
612 | delete_handler = | |||
613 | g_signal_connect (plug,g_signal_connect_data ((plug), ("delete_event"), (((GCallback ) (run_delete_handler))), (&ri), ((void*)0), (GConnectFlags ) 0) | |||
614 | "delete_event",g_signal_connect_data ((plug), ("delete_event"), (((GCallback ) (run_delete_handler))), (&ri), ((void*)0), (GConnectFlags ) 0) | |||
615 | G_CALLBACK (run_delete_handler),g_signal_connect_data ((plug), ("delete_event"), (((GCallback ) (run_delete_handler))), (&ri), ((void*)0), (GConnectFlags ) 0) | |||
616 | &ri)g_signal_connect_data ((plug), ("delete_event"), (((GCallback ) (run_delete_handler))), (&ri), ((void*)0), (GConnectFlags ) 0); | |||
617 | ||||
618 | destroy_handler = | |||
619 | g_signal_connect (plug,g_signal_connect_data ((plug), ("destroy"), (((GCallback) (run_destroy_handler ))), (&ri), ((void*)0), (GConnectFlags) 0) | |||
620 | "destroy",g_signal_connect_data ((plug), ("destroy"), (((GCallback) (run_destroy_handler ))), (&ri), ((void*)0), (GConnectFlags) 0) | |||
621 | G_CALLBACK (run_destroy_handler),g_signal_connect_data ((plug), ("destroy"), (((GCallback) (run_destroy_handler ))), (&ri), ((void*)0), (GConnectFlags) 0) | |||
622 | &ri)g_signal_connect_data ((plug), ("destroy"), (((GCallback) (run_destroy_handler ))), (&ri), ((void*)0), (GConnectFlags) 0); | |||
623 | ||||
624 | ri.loop = g_main_loop_new (NULL((void*)0), FALSE(0)); | |||
625 | ||||
626 | g_main_loop_run (ri.loop); | |||
627 | ||||
628 | g_main_loop_unref (ri.loop); | |||
629 | ||||
630 | ri.loop = NULL((void*)0); | |||
631 | ||||
632 | if (!ri.destroyed) | |||
633 | { | |||
634 | if (! was_modal) | |||
635 | { | |||
636 | ctk_window_set_modal (CTK_WINDOW (plug)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((ctk_window_get_type ())))))), FALSE(0)); | |||
637 | } | |||
638 | ||||
639 | g_signal_handler_disconnect (plug, response_handler); | |||
640 | g_signal_handler_disconnect (plug, unmap_handler); | |||
641 | g_signal_handler_disconnect (plug, delete_handler); | |||
642 | g_signal_handler_disconnect (plug, destroy_handler); | |||
643 | g_signal_handler_disconnect (keymap, keymap_handler); | |||
644 | } | |||
645 | ||||
646 | g_object_unref (plug); | |||
647 | ||||
648 | return ri.response_id; | |||
649 | } | |||
650 | ||||
651 | ||||
652 | static cairo_surface_t * | |||
653 | surface_from_pixbuf (GdkPixbuf *pixbuf) | |||
654 | { | |||
655 | cairo_surface_t *surface; | |||
656 | cairo_t *cr; | |||
657 | ||||
658 | surface = cairo_image_surface_create (gdk_pixbuf_get_has_alpha (pixbuf) ? | |||
659 | CAIRO_FORMAT_ARGB32 : CAIRO_FORMAT_RGB24, | |||
660 | gdk_pixbuf_get_width (pixbuf), | |||
661 | gdk_pixbuf_get_height (pixbuf)); | |||
662 | cr = cairo_create (surface); | |||
663 | cdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); | |||
664 | cairo_paint (cr); | |||
665 | cairo_destroy (cr); | |||
666 | ||||
667 | return surface; | |||
668 | } | |||
669 | ||||
670 | static void | |||
671 | rounded_rectangle (cairo_t *cr, | |||
672 | gdouble aspect, | |||
673 | gdouble x, | |||
674 | gdouble y, | |||
675 | gdouble corner_radius, | |||
676 | gdouble width, | |||
677 | gdouble height) | |||
678 | { | |||
679 | gdouble radius; | |||
680 | gdouble degrees; | |||
681 | ||||
682 | radius = corner_radius / aspect; | |||
683 | degrees = G_PI3.1415926535897932384626433832795028841971693993751 / 180.0; | |||
684 | ||||
685 | cairo_new_sub_path (cr); | |||
686 | cairo_arc (cr, | |||
687 | x + width - radius, | |||
688 | y + radius, | |||
689 | radius, | |||
690 | -90 * degrees, | |||
691 | 0 * degrees); | |||
692 | cairo_arc (cr, | |||
693 | x + width - radius, | |||
694 | y + height - radius, | |||
695 | radius, | |||
696 | 0 * degrees, | |||
697 | 90 * degrees); | |||
698 | cairo_arc (cr, | |||
699 | x + radius, | |||
700 | y + height - radius, | |||
701 | radius, | |||
702 | 90 * degrees, | |||
703 | 180 * degrees); | |||
704 | cairo_arc (cr, | |||
705 | x + radius, | |||
706 | y + radius, | |||
707 | radius, | |||
708 | 180 * degrees, | |||
709 | 270 * degrees); | |||
710 | cairo_close_path (cr); | |||
711 | } | |||
712 | ||||
713 | /* copied from gnome-screensaver 3.x */ | |||
714 | ||||
715 | /** | |||
716 | * go_cairo_convert_data_to_pixbuf: | |||
717 | * @src: a pointer to pixel data in cairo format | |||
718 | * @dst: a pointer to pixel data in pixbuf format | |||
719 | * @width: image width | |||
720 | * @height: image height | |||
721 | * @rowstride: data rowstride | |||
722 | * | |||
723 | * Converts the pixel data stored in @src in CAIRO_FORMAT_ARGB32 cairo format | |||
724 | * to GDK_COLORSPACE_RGB pixbuf format and move them | |||
725 | * to @dst. If @src == @dst, pixel are converted in place. | |||
726 | **/ | |||
727 | ||||
728 | static void | |||
729 | go_cairo_convert_data_to_pixbuf (unsigned char *dst, | |||
730 | unsigned char const *src, | |||
731 | int width, | |||
732 | int height, | |||
733 | int rowstride) | |||
734 | { | |||
735 | int i,j; | |||
736 | unsigned int t; | |||
737 | unsigned char a, b, c; | |||
738 | ||||
739 | g_return_if_fail (dst != NULL)do{ (void)0; }while (0); | |||
740 | ||||
741 | #define MULT(d,c,a,t) G_STMT_STARTdo { t = (a)? c * 255 / a: 0; d = t;} G_STMT_ENDwhile (0) | |||
742 | ||||
743 | if (src == dst || src == NULL((void*)0)) { | |||
744 | for (i = 0; i < height; i++) { | |||
745 | for (j = 0; j < width; j++) { | |||
746 | #if G_BYTE_ORDER1234 == G_LITTLE_ENDIAN1234 | |||
747 | MULT(a, dst[2], dst[3], t); | |||
748 | MULT(b, dst[1], dst[3], t); | |||
749 | MULT(c, dst[0], dst[3], t); | |||
750 | dst[0] = a; | |||
751 | dst[1] = b; | |||
752 | dst[2] = c; | |||
753 | #else | |||
754 | MULT(a, dst[1], dst[0], t); | |||
755 | MULT(b, dst[2], dst[0], t); | |||
756 | MULT(c, dst[3], dst[0], t); | |||
757 | dst[3] = dst[0]; | |||
758 | dst[0] = a; | |||
759 | dst[1] = b; | |||
760 | dst[2] = c; | |||
761 | #endif | |||
762 | dst += 4; | |||
763 | } | |||
764 | dst += rowstride - width * 4; | |||
765 | } | |||
766 | } else { | |||
767 | for (i = 0; i < height; i++) { | |||
768 | for (j = 0; j < width; j++) { | |||
769 | #if G_BYTE_ORDER1234 == G_LITTLE_ENDIAN1234 | |||
770 | MULT(dst[0], src[2], src[3], t); | |||
771 | MULT(dst[1], src[1], src[3], t); | |||
772 | MULT(dst[2], src[0], src[3], t); | |||
773 | dst[3] = src[3]; | |||
774 | #else | |||
775 | MULT(dst[0], src[1], src[0], t); | |||
776 | MULT(dst[1], src[2], src[0], t); | |||
777 | MULT(dst[2], src[3], src[0], t); | |||
778 | dst[3] = src[0]; | |||
779 | #endif | |||
780 | src += 4; | |||
781 | dst += 4; | |||
782 | } | |||
783 | src += rowstride - width * 4; | |||
784 | dst += rowstride - width * 4; | |||
785 | } | |||
786 | } | |||
787 | #undef MULT | |||
788 | } | |||
789 | ||||
790 | static void | |||
791 | cairo_to_pixbuf (guint8 *src_data, | |||
792 | GdkPixbuf *dst_pixbuf) | |||
793 | { | |||
794 | unsigned char *src; | |||
795 | unsigned char *dst; | |||
796 | guint w; | |||
797 | guint h; | |||
798 | guint rowstride; | |||
799 | ||||
800 | w = gdk_pixbuf_get_width (dst_pixbuf); | |||
801 | h = gdk_pixbuf_get_height (dst_pixbuf); | |||
802 | rowstride = gdk_pixbuf_get_rowstride (dst_pixbuf); | |||
803 | ||||
804 | dst = gdk_pixbuf_get_pixels (dst_pixbuf); | |||
805 | src = src_data; | |||
806 | ||||
807 | go_cairo_convert_data_to_pixbuf (dst, src, w, h, rowstride); | |||
808 | } | |||
809 | ||||
810 | static GdkPixbuf * | |||
811 | frame_pixbuf (GdkPixbuf *source) | |||
812 | { | |||
813 | GdkPixbuf *dest; | |||
814 | cairo_t *cr; | |||
815 | cairo_surface_t *surface; | |||
816 | guint w; | |||
817 | guint h; | |||
818 | guint rowstride; | |||
819 | int frame_width; | |||
820 | double radius; | |||
821 | guint8 *data; | |||
822 | ||||
823 | frame_width = 5; | |||
824 | ||||
825 | w = gdk_pixbuf_get_width (source) + frame_width * 2; | |||
826 | h = gdk_pixbuf_get_height (source) + frame_width * 2; | |||
827 | radius = w / 10; | |||
828 | ||||
829 | dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, | |||
830 | TRUE(!(0)), | |||
831 | 8, | |||
832 | w, | |||
833 | h); | |||
834 | rowstride = gdk_pixbuf_get_rowstride (dest); | |||
835 | ||||
836 | ||||
837 | data = g_new0 (guint8, h * rowstride)((guint8 *) g_malloc0_n ((h * rowstride), sizeof (guint8))); | |||
838 | ||||
839 | surface = cairo_image_surface_create_for_data (data, | |||
840 | CAIRO_FORMAT_ARGB32, | |||
841 | w, | |||
842 | h, | |||
843 | rowstride); | |||
844 | cr = cairo_create (surface); | |||
845 | cairo_surface_destroy (surface); | |||
846 | ||||
847 | /* set up image */ | |||
848 | cairo_rectangle (cr, 0, 0, w, h); | |||
849 | cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0); | |||
850 | cairo_fill (cr); | |||
851 | ||||
852 | rounded_rectangle (cr, | |||
853 | 1.0, | |||
854 | frame_width + 0.5, | |||
855 | frame_width + 0.5, | |||
856 | radius, | |||
857 | w - frame_width * 2 - 1, | |||
858 | h - frame_width * 2 - 1); | |||
859 | cairo_set_source_rgba (cr, 0.5, 0.5, 0.5, 0.3); | |||
860 | cairo_fill_preserve (cr); | |||
861 | ||||
862 | surface = surface_from_pixbuf (source); | |||
863 | cairo_set_source_surface (cr, surface, frame_width, frame_width); | |||
864 | cairo_fill (cr); | |||
865 | cairo_surface_destroy (surface); | |||
866 | ||||
867 | cairo_to_pixbuf (data, dest); | |||
868 | ||||
869 | cairo_destroy (cr); | |||
870 | g_free (data); | |||
871 | ||||
872 | return dest; | |||
873 | } | |||
874 | ||||
875 | /* end copied from gdm-user.c */ | |||
876 | ||||
877 | static void | |||
878 | image_set_from_pixbuf (CtkImage *image, | |||
879 | GdkPixbuf *source) | |||
880 | { | |||
881 | GdkPixbuf *pixbuf; | |||
882 | ||||
883 | pixbuf = frame_pixbuf (source); | |||
884 | ctk_image_set_from_pixbuf (image, pixbuf); | |||
885 | g_object_unref (pixbuf); | |||
886 | } | |||
887 | ||||
888 | static gboolean | |||
889 | check_user_file (const gchar *filename, | |||
890 | uid_t user, | |||
891 | gssize max_file_size, | |||
892 | gboolean relax_group, | |||
893 | gboolean relax_other) | |||
894 | { | |||
895 | struct stat fileinfo; | |||
896 | ||||
897 | if (max_file_size < 0) | |||
898 | { | |||
899 | max_file_size = G_MAXSIZE(9223372036854775807L *2UL+1UL); | |||
900 | } | |||
901 | ||||
902 | /* Exists/Readable? */ | |||
903 | if (g_statstat (filename, &fileinfo) < 0) | |||
904 | { | |||
905 | return FALSE(0); | |||
906 | } | |||
907 | ||||
908 | /* Is a regular file */ | |||
909 | if (G_UNLIKELY (!S_ISREG (fileinfo.st_mode))(!((((fileinfo.st_mode)) & 0170000) == (0100000)))) | |||
910 | { | |||
911 | return FALSE(0); | |||
912 | } | |||
913 | ||||
914 | /* Owned by user? */ | |||
915 | if (G_UNLIKELY (fileinfo.st_uid != user)(fileinfo.st_uid != user)) | |||
916 | { | |||
917 | return FALSE(0); | |||
918 | } | |||
919 | ||||
920 | /* Group not writable or relax_group? */ | |||
921 | if (G_UNLIKELY ((fileinfo.st_mode & S_IWGRP) == S_IWGRP && !relax_group)((fileinfo.st_mode & (0200 >> 3)) == (0200 >> 3) && !relax_group)) | |||
922 | { | |||
923 | return FALSE(0); | |||
924 | } | |||
925 | ||||
926 | /* Other not writable or relax_other? */ | |||
927 | if (G_UNLIKELY ((fileinfo.st_mode & S_IWOTH) == S_IWOTH && !relax_other)((fileinfo.st_mode & ((0200 >> 3) >> 3)) == ( (0200 >> 3) >> 3) && !relax_other)) | |||
928 | { | |||
929 | return FALSE(0); | |||
930 | } | |||
931 | ||||
932 | /* Size is kosher? */ | |||
933 | if (G_UNLIKELY (fileinfo.st_size > max_file_size)(fileinfo.st_size > max_file_size)) | |||
934 | { | |||
935 | return FALSE(0); | |||
936 | } | |||
937 | ||||
938 | return TRUE(!(0)); | |||
939 | } | |||
940 | ||||
941 | static gboolean | |||
942 | set_face_image (GSLockPlug *plug) | |||
943 | { | |||
944 | GdkPixbuf *pixbuf; | |||
945 | const char *homedir; | |||
946 | char *path; | |||
947 | int icon_size = 96; | |||
948 | gsize user_max_file = 65536; | |||
949 | uid_t uid; | |||
950 | ||||
951 | homedir = g_get_home_dir (); | |||
952 | uid = getuid (); | |||
953 | ||||
954 | path = g_build_filename (homedir, ".face", NULL((void*)0)); | |||
955 | ||||
956 | pixbuf = NULL((void*)0); | |||
957 | if (check_user_file (path, uid, user_max_file, 0, 0)) | |||
958 | { | |||
959 | pixbuf = gdk_pixbuf_new_from_file_at_size (path, | |||
960 | icon_size, | |||
961 | icon_size, | |||
962 | NULL((void*)0)); | |||
963 | } | |||
964 | ||||
965 | g_free (path); | |||
966 | ||||
967 | if (pixbuf == NULL((void*)0)) | |||
968 | { | |||
969 | return FALSE(0); | |||
970 | } | |||
971 | ||||
972 | image_set_from_pixbuf (CTK_IMAGE (plug->priv->auth_face_image)((((CtkImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_face_image)), ((ctk_image_get_type ())))))), pixbuf); | |||
973 | ||||
974 | g_object_unref (pixbuf); | |||
975 | ||||
976 | return TRUE(!(0)); | |||
977 | } | |||
978 | ||||
979 | #if !CTK_CHECK_VERSION (3, 23, 0)((3) > (3) || ((3) == (3) && (25) > (23)) || (( 3) == (3) && (25) == (23) && (6) >= (0))) | |||
980 | static void | |||
981 | gs_lock_plug_get_preferred_width (CtkWidget *widget, gint *minimum_width, gint *natural_width) | |||
982 | { | |||
983 | gint scale; | |||
984 | ||||
985 | CTK_WIDGET_CLASS (gs_lock_plug_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((gs_lock_plug_parent_class)), ((ctk_widget_get_type ()))) )))->get_preferred_width (widget, minimum_width, natural_width); | |||
986 | ||||
987 | scale = ctk_widget_get_scale_factor (widget); | |||
988 | *minimum_width /= scale; | |||
989 | *natural_width /= scale; | |||
990 | } | |||
991 | ||||
992 | static void | |||
993 | gs_lock_plug_get_preferred_height_for_width (CtkWidget *widget, gint width, gint *minimum_height, gint *natural_height) | |||
994 | { | |||
995 | gint scale; | |||
996 | ||||
997 | CTK_WIDGET_CLASS (gs_lock_plug_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((gs_lock_plug_parent_class)), ((ctk_widget_get_type ()))) )))->get_preferred_height_for_width (widget, width, minimum_height, natural_height); | |||
998 | ||||
999 | scale = ctk_widget_get_scale_factor (widget); | |||
1000 | *minimum_height /= scale; | |||
1001 | *natural_height /= scale; | |||
1002 | } | |||
1003 | #endif | |||
1004 | ||||
1005 | static void | |||
1006 | gs_lock_plug_show (CtkWidget *widget) | |||
1007 | { | |||
1008 | GSLockPlug *plug = GS_LOCK_PLUG (widget)((((GSLockPlug*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((gs_lock_plug_get_type ())))))); | |||
1009 | ||||
1010 | gs_profile_start (NULL); | |||
1011 | ||||
1012 | gs_profile_start ("parent"); | |||
1013 | if (CTK_WIDGET_CLASS (gs_lock_plug_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((gs_lock_plug_parent_class)), ((ctk_widget_get_type ()))) )))->show) | |||
1014 | { | |||
1015 | CTK_WIDGET_CLASS (gs_lock_plug_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((gs_lock_plug_parent_class)), ((ctk_widget_get_type ()))) )))->show (widget); | |||
1016 | } | |||
1017 | ||||
1018 | gs_profile_end ("parent"); | |||
1019 | ||||
1020 | ||||
1021 | if (plug->priv->auth_face_image) | |||
1022 | { | |||
1023 | set_face_image (plug); | |||
1024 | } | |||
1025 | ||||
1026 | capslock_update (plug, is_capslock_on ()); | |||
1027 | ||||
1028 | restart_cancel_timeout (plug); | |||
1029 | ||||
1030 | gs_profile_end (NULL); | |||
1031 | } | |||
1032 | ||||
1033 | static void | |||
1034 | gs_lock_plug_hide (CtkWidget *widget) | |||
1035 | { | |||
1036 | if (CTK_WIDGET_CLASS (gs_lock_plug_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((gs_lock_plug_parent_class)), ((ctk_widget_get_type ()))) )))->hide) | |||
1037 | { | |||
1038 | CTK_WIDGET_CLASS (gs_lock_plug_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((gs_lock_plug_parent_class)), ((ctk_widget_get_type ()))) )))->hide (widget); | |||
1039 | } | |||
1040 | } | |||
1041 | ||||
1042 | static void | |||
1043 | queue_key_event (GSLockPlug *plug, | |||
1044 | CdkEventKey *event) | |||
1045 | { | |||
1046 | CdkEvent *saved_event; | |||
1047 | ||||
1048 | saved_event = cdk_event_copy ((CdkEvent *)event); | |||
1049 | plug->priv->key_events = g_list_prepend (plug->priv->key_events, | |||
1050 | saved_event); | |||
1051 | } | |||
1052 | ||||
1053 | static void | |||
1054 | forward_key_events (GSLockPlug *plug) | |||
1055 | { | |||
1056 | plug->priv->key_events = g_list_reverse (plug->priv->key_events); | |||
1057 | while (plug->priv->key_events != NULL((void*)0)) | |||
1058 | { | |||
1059 | CdkEventKey *event = plug->priv->key_events->data; | |||
1060 | ||||
1061 | ctk_window_propagate_key_event (CTK_WINDOW (plug)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((ctk_window_get_type ())))))), event); | |||
1062 | ||||
1063 | cdk_event_free ((CdkEvent *)event); | |||
1064 | ||||
1065 | plug->priv->key_events = g_list_delete_link (plug->priv->key_events, | |||
1066 | plug->priv->key_events); | |||
1067 | } | |||
1068 | } | |||
1069 | ||||
1070 | static void | |||
1071 | gs_lock_plug_set_logout_enabled (GSLockPlug *plug, | |||
1072 | gboolean logout_enabled) | |||
1073 | { | |||
1074 | g_return_if_fail (GS_LOCK_PLUG (plug))do{ (void)0; }while (0); | |||
1075 | ||||
1076 | if (plug->priv->logout_enabled == logout_enabled) | |||
1077 | { | |||
1078 | return; | |||
1079 | } | |||
1080 | ||||
1081 | plug->priv->logout_enabled = logout_enabled; | |||
1082 | g_object_notify (G_OBJECT (plug)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), (((GType) ((20) << (2)))))))), "logout-enabled"); | |||
1083 | ||||
1084 | if (plug->priv->auth_logout_button == NULL((void*)0)) | |||
1085 | { | |||
1086 | return; | |||
1087 | } | |||
1088 | ||||
1089 | if (logout_enabled) | |||
1090 | { | |||
1091 | ctk_widget_show (plug->priv->auth_logout_button); | |||
1092 | } | |||
1093 | else | |||
1094 | { | |||
1095 | ctk_widget_hide (plug->priv->auth_logout_button); | |||
1096 | } | |||
1097 | } | |||
1098 | ||||
1099 | static void | |||
1100 | gs_lock_plug_set_logout_command (GSLockPlug *plug, | |||
1101 | const char *command) | |||
1102 | { | |||
1103 | g_return_if_fail (GS_LOCK_PLUG (plug))do{ (void)0; }while (0); | |||
1104 | ||||
1105 | g_free (plug->priv->logout_command); | |||
1106 | ||||
1107 | if (command) | |||
1108 | { | |||
1109 | plug->priv->logout_command = g_strdup (command)g_strdup_inline (command); | |||
1110 | } | |||
1111 | else | |||
1112 | { | |||
1113 | plug->priv->logout_command = NULL((void*)0); | |||
1114 | } | |||
1115 | } | |||
1116 | ||||
1117 | static void | |||
1118 | gs_lock_plug_set_status_message (GSLockPlug *plug, | |||
1119 | const char *status_message) | |||
1120 | { | |||
1121 | g_return_if_fail (GS_LOCK_PLUG (plug))do{ (void)0; }while (0); | |||
1122 | ||||
1123 | g_free (plug->priv->status_message); | |||
1124 | plug->priv->status_message = g_strdup (status_message)g_strdup_inline (status_message); | |||
1125 | ||||
1126 | if (plug->priv->status_message_label) | |||
1127 | { | |||
1128 | if (plug->priv->status_message) | |||
1129 | { | |||
1130 | ctk_label_set_text (CTK_LABEL (plug->priv->status_message_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->status_message_label)), ((ctk_label_get_type ())))))), | |||
1131 | plug->priv->status_message); | |||
1132 | ctk_widget_show (plug->priv->status_message_label); | |||
1133 | } | |||
1134 | else | |||
1135 | { | |||
1136 | ctk_widget_hide (plug->priv->status_message_label); | |||
1137 | } | |||
1138 | } | |||
1139 | } | |||
1140 | ||||
1141 | static void | |||
1142 | gs_lock_plug_get_property (GObject *object, | |||
1143 | guint prop_id, | |||
1144 | GValue *value, | |||
1145 | GParamSpec *pspec) | |||
1146 | { | |||
1147 | GSLockPlug *self; | |||
1148 | ||||
1149 | self = GS_LOCK_PLUG (object)((((GSLockPlug*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((object)), ((gs_lock_plug_get_type ())))))); | |||
1150 | ||||
1151 | switch (prop_id) | |||
1152 | { | |||
1153 | case PROP_LOGOUT_ENABLED: | |||
1154 | g_value_set_boolean (value, self->priv->logout_enabled); | |||
1155 | break; | |||
1156 | case PROP_LOGOUT_COMMAND: | |||
1157 | g_value_set_string (value, self->priv->logout_command); | |||
1158 | break; | |||
1159 | case PROP_SWITCH_ENABLED: | |||
1160 | g_value_set_boolean (value, self->priv->switch_enabled); | |||
1161 | break; | |||
1162 | case PROP_STATUS_MESSAGE: | |||
1163 | g_value_set_string (value, self->priv->status_message); | |||
1164 | break; | |||
1165 | default: | |||
1166 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec *_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id = ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'" , "gs-lock-plug.c", 1166, ("property"), _glib__property_id, _glib__pspec ->name, g_type_name ((((((GTypeClass*) (((GTypeInstance*) ( _glib__pspec))->g_class))->g_type)))), (g_type_name ((( (((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class ))->g_type)))))); } while (0); | |||
1167 | break; | |||
1168 | } | |||
1169 | } | |||
1170 | ||||
1171 | static void | |||
1172 | gs_lock_plug_set_switch_enabled (GSLockPlug *plug, | |||
1173 | gboolean switch_enabled) | |||
1174 | { | |||
1175 | g_return_if_fail (GS_LOCK_PLUG (plug))do{ (void)0; }while (0); | |||
1176 | ||||
1177 | if (plug->priv->switch_enabled == switch_enabled) | |||
1178 | { | |||
1179 | return; | |||
1180 | } | |||
1181 | ||||
1182 | plug->priv->switch_enabled = switch_enabled; | |||
1183 | g_object_notify (G_OBJECT (plug)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), (((GType) ((20) << (2)))))))), "switch-enabled"); | |||
1184 | ||||
1185 | if (plug->priv->auth_switch_button == NULL((void*)0)) | |||
1186 | { | |||
1187 | return; | |||
1188 | } | |||
1189 | ||||
1190 | if (switch_enabled) | |||
1191 | { | |||
1192 | if (process_is_running ("mdm")) | |||
1193 | { | |||
1194 | /* MDM */ | |||
1195 | ctk_widget_show (plug->priv->auth_switch_button); | |||
1196 | } | |||
1197 | else if (process_is_running ("gdm") || process_is_running("gdm3") || process_is_running("gdm-binary")) | |||
1198 | { | |||
1199 | /* GDM */ | |||
1200 | ctk_widget_show (plug->priv->auth_switch_button); | |||
1201 | } | |||
1202 | else if (g_getenv ("XDG_SEAT_PATH") != NULL((void*)0)) | |||
1203 | { | |||
1204 | /* LightDM */ | |||
1205 | ctk_widget_show (plug->priv->auth_switch_button); | |||
1206 | } | |||
1207 | else | |||
1208 | { | |||
1209 | gs_debug ("Warning: Unknown DM for switch button")gs_debug_real (__func__, "gs-lock-plug.c", 1209, "Warning: Unknown DM for switch button" ); | |||
1210 | ctk_widget_hide (plug->priv->auth_switch_button); | |||
1211 | } | |||
1212 | } | |||
1213 | else | |||
1214 | { | |||
1215 | ctk_widget_hide (plug->priv->auth_switch_button); | |||
1216 | } | |||
1217 | } | |||
1218 | ||||
1219 | static void | |||
1220 | gs_lock_plug_set_property (GObject *object, | |||
1221 | guint prop_id, | |||
1222 | const GValue *value, | |||
1223 | GParamSpec *pspec) | |||
1224 | { | |||
1225 | GSLockPlug *self; | |||
1226 | ||||
1227 | self = GS_LOCK_PLUG (object)((((GSLockPlug*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((object)), ((gs_lock_plug_get_type ())))))); | |||
1228 | ||||
1229 | switch (prop_id) | |||
1230 | { | |||
1231 | case PROP_LOGOUT_ENABLED: | |||
1232 | gs_lock_plug_set_logout_enabled (self, g_value_get_boolean (value)); | |||
1233 | break; | |||
1234 | case PROP_LOGOUT_COMMAND: | |||
1235 | gs_lock_plug_set_logout_command (self, g_value_get_string (value)); | |||
1236 | break; | |||
1237 | case PROP_STATUS_MESSAGE: | |||
1238 | gs_lock_plug_set_status_message (self, g_value_get_string (value)); | |||
1239 | break; | |||
1240 | case PROP_SWITCH_ENABLED: | |||
1241 | gs_lock_plug_set_switch_enabled (self, g_value_get_boolean (value)); | |||
1242 | break; | |||
1243 | default: | |||
1244 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec *_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id = ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'" , "gs-lock-plug.c", 1244, ("property"), _glib__property_id, _glib__pspec ->name, g_type_name ((((((GTypeClass*) (((GTypeInstance*) ( _glib__pspec))->g_class))->g_type)))), (g_type_name ((( (((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class ))->g_type)))))); } while (0); | |||
1245 | break; | |||
1246 | } | |||
1247 | } | |||
1248 | ||||
1249 | static void | |||
1250 | gs_lock_plug_close (GSLockPlug *plug) | |||
1251 | { | |||
1252 | /* Synthesize delete_event to close dialog. */ | |||
1253 | ||||
1254 | CtkWidget *widget = CTK_WIDGET (plug)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((ctk_widget_get_type ())))))); | |||
1255 | CdkEvent *event; | |||
1256 | ||||
1257 | event = cdk_event_new (CDK_DELETE); | |||
1258 | event->any.window = g_object_ref (ctk_widget_get_window(widget))((__typeof__ (ctk_widget_get_window(widget))) (g_object_ref) ( ctk_widget_get_window(widget))); | |||
1259 | event->any.send_event = TRUE(!(0)); | |||
1260 | ||||
1261 | ctk_main_do_event (event); | |||
1262 | cdk_event_free (event); | |||
1263 | } | |||
1264 | ||||
1265 | static void | |||
1266 | gs_lock_plug_class_init (GSLockPlugClass *klass) | |||
1267 | { | |||
1268 | GObjectClass *object_class = G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((klass)), (((GType) ((20) << (2)))))))); | |||
1269 | CtkWidgetClass *widget_class = CTK_WIDGET_CLASS (klass)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((klass)), ((ctk_widget_get_type ())))))); | |||
1270 | CtkBindingSet *binding_set; | |||
1271 | ||||
1272 | object_class->finalize = gs_lock_plug_finalize; | |||
1273 | object_class->get_property = gs_lock_plug_get_property; | |||
1274 | object_class->set_property = gs_lock_plug_set_property; | |||
1275 | ||||
1276 | widget_class->style_set = gs_lock_plug_style_set; | |||
1277 | widget_class->show = gs_lock_plug_show; | |||
1278 | widget_class->hide = gs_lock_plug_hide; | |||
1279 | #if !CTK_CHECK_VERSION (3, 23, 0)((3) > (3) || ((3) == (3) && (25) > (23)) || (( 3) == (3) && (25) == (23) && (6) >= (0))) | |||
1280 | widget_class->get_preferred_width = gs_lock_plug_get_preferred_width; | |||
1281 | widget_class->get_preferred_height_for_width = gs_lock_plug_get_preferred_height_for_width; | |||
1282 | #endif | |||
1283 | ||||
1284 | klass->close = gs_lock_plug_close; | |||
1285 | ||||
1286 | lock_plug_signals [RESPONSE] = g_signal_new ("response", | |||
1287 | G_OBJECT_CLASS_TYPE (klass)((((GTypeClass*) (klass))->g_type)), | |||
1288 | G_SIGNAL_RUN_LAST, | |||
1289 | G_STRUCT_OFFSET (GSLockPlugClass, response)((glong) __builtin_offsetof(GSLockPlugClass, response)), | |||
1290 | NULL((void*)0), NULL((void*)0), | |||
1291 | g_cclosure_marshal_VOID__INT, | |||
1292 | G_TYPE_NONE((GType) ((1) << (2))), 1, | |||
1293 | G_TYPE_INT((GType) ((6) << (2)))); | |||
1294 | lock_plug_signals [CLOSE] = g_signal_new ("close", | |||
1295 | G_OBJECT_CLASS_TYPE (klass)((((GTypeClass*) (klass))->g_type)), | |||
1296 | G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, | |||
1297 | G_STRUCT_OFFSET (GSLockPlugClass, close)((glong) __builtin_offsetof(GSLockPlugClass, close)), | |||
1298 | NULL((void*)0), NULL((void*)0), | |||
1299 | g_cclosure_marshal_VOID__VOID, | |||
1300 | G_TYPE_NONE((GType) ((1) << (2))), 0); | |||
1301 | ||||
1302 | g_object_class_install_property (object_class, | |||
1303 | PROP_LOGOUT_ENABLED, | |||
1304 | g_param_spec_boolean ("logout-enabled", | |||
1305 | NULL((void*)0), | |||
1306 | NULL((void*)0), | |||
1307 | FALSE(0), | |||
1308 | G_PARAM_READWRITE)); | |||
1309 | g_object_class_install_property (object_class, | |||
1310 | PROP_LOGOUT_COMMAND, | |||
1311 | g_param_spec_string ("logout-command", | |||
1312 | NULL((void*)0), | |||
1313 | NULL((void*)0), | |||
1314 | NULL((void*)0), | |||
1315 | G_PARAM_READWRITE)); | |||
1316 | g_object_class_install_property (object_class, | |||
1317 | PROP_STATUS_MESSAGE, | |||
1318 | g_param_spec_string ("status-message", | |||
1319 | NULL((void*)0), | |||
1320 | NULL((void*)0), | |||
1321 | NULL((void*)0), | |||
1322 | G_PARAM_READWRITE)); | |||
1323 | g_object_class_install_property (object_class, | |||
1324 | PROP_SWITCH_ENABLED, | |||
1325 | g_param_spec_boolean ("switch-enabled", | |||
1326 | NULL((void*)0), | |||
1327 | NULL((void*)0), | |||
1328 | FALSE(0), | |||
1329 | G_PARAM_READWRITE)); | |||
1330 | ||||
1331 | binding_set = ctk_binding_set_by_class (klass); | |||
1332 | ||||
1333 | ctk_binding_entry_add_signal (binding_set, CDK_KEY_Escape0xff1b, 0, | |||
1334 | "close", 0); | |||
1335 | } | |||
1336 | ||||
1337 | static void | |||
1338 | clear_clipboards (GSLockPlug *plug) | |||
1339 | { | |||
1340 | CtkClipboard *clipboard; | |||
1341 | ||||
1342 | clipboard = ctk_widget_get_clipboard (CTK_WIDGET (plug)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((ctk_widget_get_type ())))))), CDK_SELECTION_PRIMARY((CdkAtom)((gpointer) (gulong) (1)))); | |||
1343 | ctk_clipboard_clear (clipboard); | |||
1344 | ctk_clipboard_set_text (clipboard, "", -1); | |||
1345 | clipboard = ctk_widget_get_clipboard (CTK_WIDGET (plug)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((ctk_widget_get_type ())))))), CDK_SELECTION_CLIPBOARD((CdkAtom)((gpointer) (gulong) (69)))); | |||
1346 | ctk_clipboard_clear (clipboard); | |||
1347 | ctk_clipboard_set_text (clipboard, "", -1); | |||
1348 | } | |||
1349 | ||||
1350 | static void | |||
1351 | take_note (CtkButton *button, | |||
1352 | GSLockPlug *plug) | |||
1353 | { | |||
1354 | int page; | |||
1355 | ||||
1356 | page = ctk_notebook_page_num (CTK_NOTEBOOK (plug->priv->notebook)((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->notebook)), ((ctk_notebook_get_type () )))))), plug->priv->note_tab); | |||
1357 | ctk_notebook_set_current_page (CTK_NOTEBOOK (plug->priv->notebook)((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->notebook)), ((ctk_notebook_get_type () )))))), page); | |||
1358 | /* this counts as activity so restart the timer */ | |||
1359 | restart_cancel_timeout (plug); | |||
1360 | } | |||
1361 | ||||
1362 | static void | |||
1363 | submit_note (CtkButton *button, | |||
1364 | GSLockPlug *plug) | |||
1365 | { | |||
1366 | #ifdef WITH_LIBNOTIFY1 | |||
1367 | char *text; | |||
1368 | char summary[128]; | |||
1369 | char *escaped_text; | |||
1370 | CtkTextBuffer *buffer; | |||
1371 | CtkTextIter start, end; | |||
1372 | time_t t; | |||
1373 | struct tm *tmp; | |||
1374 | NotifyNotification *note; | |||
1375 | ||||
1376 | ctk_notebook_set_current_page (CTK_NOTEBOOK (plug->priv->notebook)((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->notebook)), ((ctk_notebook_get_type () )))))), AUTH_PAGE); | |||
1377 | buffer = ctk_text_view_get_buffer (CTK_TEXT_VIEW (plug->priv->note_text_view)((((CtkTextView*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->note_text_view)), ((ctk_text_view_get_type ()))))))); | |||
1378 | ctk_text_buffer_get_bounds (buffer, &start, &end); | |||
1379 | text = ctk_text_buffer_get_text (buffer, &start, &end, FALSE(0)); | |||
1380 | ctk_text_buffer_set_text (buffer, "", 0); | |||
1381 | escaped_text = g_markup_escape_text (text, -1); | |||
1382 | ||||
1383 | t = time (NULL((void*)0)); | |||
1384 | tmp = localtime (&t); | |||
1385 | strftime (summary, 128, "%X", tmp); | |||
1386 | ||||
1387 | note = notify_notification_new (summary, escaped_text, NULL((void*)0)); | |||
1388 | notify_notification_set_timeout (note, NOTIFY_EXPIRES_NEVER0); | |||
1389 | notify_notification_show (note, NULL((void*)0)); | |||
1390 | g_object_unref (note); | |||
1391 | ||||
1392 | g_free (text); | |||
1393 | g_free (escaped_text); | |||
1394 | ||||
1395 | gs_lock_plug_response (plug, GS_LOCK_PLUG_RESPONSE_CANCEL); | |||
1396 | #endif /* WITH_LIBNOTIFY */ | |||
1397 | } | |||
1398 | ||||
1399 | static void | |||
1400 | cancel_note (CtkButton *button, | |||
1401 | GSLockPlug *plug) | |||
1402 | { | |||
1403 | CtkTextBuffer *buffer; | |||
1404 | ||||
1405 | ctk_notebook_set_current_page (CTK_NOTEBOOK (plug->priv->notebook)((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->notebook)), ((ctk_notebook_get_type () )))))), AUTH_PAGE); | |||
1406 | buffer = ctk_text_view_get_buffer (CTK_TEXT_VIEW (plug->priv->note_text_view)((((CtkTextView*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->note_text_view)), ((ctk_text_view_get_type ()))))))); | |||
1407 | ctk_text_buffer_set_text (buffer, "", 0); | |||
1408 | ||||
1409 | /* this counts as activity so restart the timer */ | |||
1410 | restart_cancel_timeout (plug); | |||
1411 | ||||
1412 | ctk_window_set_default (CTK_WINDOW (plug)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((ctk_window_get_type ())))))), plug->priv->auth_unlock_button); | |||
1413 | ||||
1414 | clear_clipboards (plug); | |||
1415 | } | |||
1416 | ||||
1417 | static void | |||
1418 | logout_button_clicked (CtkButton *button, | |||
1419 | GSLockPlug *plug) | |||
1420 | { | |||
1421 | char **argv = NULL((void*)0); | |||
1422 | GError *error = NULL((void*)0); | |||
1423 | gboolean res; | |||
1424 | ||||
1425 | if (! plug->priv->logout_command) | |||
1426 | { | |||
1427 | return; | |||
1428 | } | |||
1429 | ||||
1430 | res = g_shell_parse_argv (plug->priv->logout_command, NULL((void*)0), &argv, &error); | |||
1431 | ||||
1432 | if (! res) | |||
1433 | { | |||
1434 | g_warning ("Could not parse logout command: %s", error->message); | |||
1435 | g_error_free (error); | |||
1436 | return; | |||
1437 | } | |||
1438 | ||||
1439 | g_spawn_async (g_get_home_dir (), | |||
1440 | argv, | |||
1441 | NULL((void*)0), | |||
1442 | G_SPAWN_SEARCH_PATH, | |||
1443 | NULL((void*)0), | |||
1444 | NULL((void*)0), | |||
1445 | NULL((void*)0), | |||
1446 | &error); | |||
1447 | ||||
1448 | g_strfreev (argv); | |||
1449 | ||||
1450 | if (error) | |||
1451 | { | |||
1452 | g_warning ("Could not run logout command: %s", error->message); | |||
1453 | g_error_free (error); | |||
1454 | } | |||
1455 | } | |||
1456 | ||||
1457 | void | |||
1458 | gs_lock_plug_set_busy (GSLockPlug *plug) | |||
1459 | { | |||
1460 | CdkDisplay *display; | |||
1461 | CdkCursor *cursor; | |||
1462 | CtkWidget *top_level; | |||
1463 | ||||
1464 | top_level = ctk_widget_get_toplevel (CTK_WIDGET (plug)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((ctk_widget_get_type ()))))))); | |||
1465 | ||||
1466 | display = ctk_widget_get_display (CTK_WIDGET (plug)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((ctk_widget_get_type ()))))))); | |||
1467 | cursor = cdk_cursor_new_for_display (display, CDK_WATCH); | |||
1468 | ||||
1469 | cdk_window_set_cursor (ctk_widget_get_window (top_level), cursor); | |||
1470 | g_object_unref (cursor); | |||
1471 | } | |||
1472 | ||||
1473 | void | |||
1474 | gs_lock_plug_set_ready (GSLockPlug *plug) | |||
1475 | { | |||
1476 | CdkDisplay *display; | |||
1477 | CdkCursor *cursor; | |||
1478 | CtkWidget *top_level; | |||
1479 | ||||
1480 | top_level = ctk_widget_get_toplevel (CTK_WIDGET (plug)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((ctk_widget_get_type ()))))))); | |||
1481 | ||||
1482 | display = ctk_widget_get_display (CTK_WIDGET (plug)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((ctk_widget_get_type ()))))))); | |||
1483 | cursor = cdk_cursor_new_for_display (display, CDK_LEFT_PTR); | |||
1484 | cdk_window_set_cursor (ctk_widget_get_window (top_level), cursor); | |||
1485 | g_object_unref (cursor); | |||
1486 | } | |||
1487 | ||||
1488 | void | |||
1489 | gs_lock_plug_enable_prompt (GSLockPlug *plug, | |||
1490 | const char *message, | |||
1491 | gboolean visible) | |||
1492 | { | |||
1493 | g_return_if_fail (GS_IS_LOCK_PLUG (plug))do{ (void)0; }while (0); | |||
1494 | ||||
1495 | gs_debug ("Setting prompt to: %s", message)gs_debug_real (__func__, "gs-lock-plug.c", 1495, "Setting prompt to: %s" , message); | |||
1496 | ||||
1497 | ctk_widget_set_sensitive (plug->priv->auth_unlock_button, TRUE(!(0))); | |||
1498 | ctk_widget_show (plug->priv->auth_unlock_button); | |||
1499 | ctk_widget_grab_default (plug->priv->auth_unlock_button); | |||
1500 | ctk_label_set_text (CTK_LABEL (plug->priv->auth_prompt_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_prompt_label)), ((ctk_label_get_type ())))))), message); | |||
1501 | ctk_widget_show (plug->priv->auth_prompt_label); | |||
1502 | ctk_entry_set_visibility (CTK_ENTRY (plug->priv->auth_prompt_entry)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_prompt_entry)), ((ctk_entry_get_type ())))))), visible); | |||
1503 | ctk_widget_set_sensitive (plug->priv->auth_prompt_entry, TRUE(!(0))); | |||
1504 | ctk_widget_set_can_focus (plug->priv->auth_prompt_entry, TRUE(!(0))); | |||
1505 | ctk_widget_show (plug->priv->auth_prompt_entry); | |||
1506 | ||||
1507 | if (! ctk_widget_has_focus (plug->priv->auth_prompt_entry)) | |||
1508 | { | |||
1509 | ctk_widget_grab_focus (plug->priv->auth_prompt_entry); | |||
1510 | } | |||
1511 | ||||
1512 | /* were there any key events sent to the plug while the | |||
1513 | * entry wasnt ready? If so, forward them along | |||
1514 | */ | |||
1515 | forward_key_events (plug); | |||
1516 | ||||
1517 | restart_cancel_timeout (plug); | |||
1518 | } | |||
1519 | ||||
1520 | void | |||
1521 | gs_lock_plug_disable_prompt (GSLockPlug *plug) | |||
1522 | { | |||
1523 | g_return_if_fail (GS_IS_LOCK_PLUG (plug))do{ (void)0; }while (0); | |||
1524 | ||||
1525 | /* ctk_widget_hide (plug->priv->auth_prompt_entry); */ | |||
1526 | /* ctk_widget_hide (plug->priv->auth_prompt_label); */ | |||
1527 | ctk_widget_set_sensitive (plug->priv->auth_unlock_button, FALSE(0)); | |||
1528 | ctk_widget_set_sensitive (plug->priv->auth_prompt_entry, FALSE(0)); | |||
1529 | /* ctk_widget_hide (plug->priv->auth_unlock_button); */ | |||
1530 | ||||
1531 | ctk_widget_grab_default (plug->priv->auth_cancel_button); | |||
1532 | } | |||
1533 | ||||
1534 | void | |||
1535 | gs_lock_plug_show_message (GSLockPlug *plug, | |||
1536 | const char *message) | |||
1537 | { | |||
1538 | g_return_if_fail (GS_IS_LOCK_PLUG (plug))do{ (void)0; }while (0); | |||
1539 | ||||
1540 | set_status_text (plug, message ? message : ""); | |||
1541 | } | |||
1542 | ||||
1543 | /* button press handler used to inhibit popup menu */ | |||
1544 | static gint | |||
1545 | entry_button_press (CtkWidget *widget, | |||
1546 | CdkEventButton *event) | |||
1547 | { | |||
1548 | if (event->button == 3 && event->type == CDK_BUTTON_PRESS) | |||
1549 | { | |||
1550 | return TRUE(!(0)); | |||
1551 | } | |||
1552 | ||||
1553 | return FALSE(0); | |||
1554 | } | |||
1555 | ||||
1556 | static gint | |||
1557 | entry_key_press (CtkWidget *widget, | |||
1558 | CdkEventKey *event, | |||
1559 | GSLockPlug *plug) | |||
1560 | { | |||
1561 | restart_cancel_timeout (plug); | |||
1562 | ||||
1563 | /* if the input widget is visible and ready for input | |||
1564 | * then just carry on as usual | |||
1565 | */ | |||
1566 | if (ctk_widget_get_visible (plug->priv->auth_prompt_entry) && | |||
1567 | ctk_widget_is_sensitive (plug->priv->auth_prompt_entry)) | |||
1568 | { | |||
1569 | return FALSE(0); | |||
1570 | } | |||
1571 | ||||
1572 | if (strcmp (event->string, "") == 0) | |||
1573 | { | |||
1574 | return FALSE(0); | |||
1575 | } | |||
1576 | ||||
1577 | queue_key_event (plug, event); | |||
1578 | ||||
1579 | return TRUE(!(0)); | |||
1580 | } | |||
1581 | ||||
1582 | /* adapted from ctk_dialog_add_button */ | |||
1583 | static CtkWidget * | |||
1584 | gs_lock_plug_add_button (GSLockPlug *plug, | |||
1585 | CtkWidget *action_area, | |||
1586 | const gchar *button_text) | |||
1587 | { | |||
1588 | CtkWidget *button; | |||
1589 | ||||
1590 | g_return_val_if_fail (GS_IS_LOCK_PLUG (plug), NULL)do{ (void)0; }while (0); | |||
1591 | g_return_val_if_fail (button_text != NULL, NULL)do{ (void)0; }while (0); | |||
1592 | ||||
1593 | button = CTK_WIDGET (g_object_new (CTK_TYPE_BUTTON,((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((g_object_new ((ctk_button_get_type ()), "label", button_text , "use-stock", (!(0)), "use-underline", (!(0)), ((void*)0)))) , ((ctk_widget_get_type ())))))) | |||
1594 | "label", button_text,((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((g_object_new ((ctk_button_get_type ()), "label", button_text , "use-stock", (!(0)), "use-underline", (!(0)), ((void*)0)))) , ((ctk_widget_get_type ())))))) | |||
1595 | "use-stock", TRUE,((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((g_object_new ((ctk_button_get_type ()), "label", button_text , "use-stock", (!(0)), "use-underline", (!(0)), ((void*)0)))) , ((ctk_widget_get_type ())))))) | |||
1596 | "use-underline", TRUE,((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((g_object_new ((ctk_button_get_type ()), "label", button_text , "use-stock", (!(0)), "use-underline", (!(0)), ((void*)0)))) , ((ctk_widget_get_type ())))))) | |||
1597 | NULL))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((g_object_new ((ctk_button_get_type ()), "label", button_text , "use-stock", (!(0)), "use-underline", (!(0)), ((void*)0)))) , ((ctk_widget_get_type ())))))); | |||
1598 | ||||
1599 | ctk_widget_set_can_default (button, TRUE(!(0))); | |||
1600 | ||||
1601 | ctk_widget_show (button); | |||
1602 | ||||
1603 | ctk_box_pack_end (CTK_BOX (action_area)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((action_area)), ((ctk_box_get_type ())))))), | |||
1604 | button, | |||
1605 | FALSE(0), TRUE(!(0)), 0); | |||
1606 | ||||
1607 | return button; | |||
1608 | } | |||
1609 | ||||
1610 | static char * | |||
1611 | get_user_display_name (void) | |||
1612 | { | |||
1613 | const char *name; | |||
1614 | char *utf8_name; | |||
1615 | ||||
1616 | name = g_get_real_name (); | |||
1617 | ||||
1618 | if (name == NULL((void*)0) || g_strcmp0 (name, "") == 0 || | |||
1619 | g_strcmp0 (name, "Unknown") == 0) | |||
1620 | { | |||
1621 | name = g_get_user_name (); | |||
1622 | } | |||
1623 | ||||
1624 | utf8_name = NULL((void*)0); | |||
1625 | ||||
1626 | if (name != NULL((void*)0)) | |||
1627 | { | |||
1628 | utf8_name = g_locale_to_utf8 (name, -1, NULL((void*)0), NULL((void*)0), NULL((void*)0)); | |||
1629 | } | |||
1630 | ||||
1631 | return utf8_name; | |||
1632 | } | |||
1633 | ||||
1634 | static char * | |||
1635 | get_user_name (void) | |||
1636 | { | |||
1637 | const char *name; | |||
1638 | char *utf8_name; | |||
1639 | ||||
1640 | name = g_get_user_name (); | |||
1641 | ||||
1642 | utf8_name = NULL((void*)0); | |||
1643 | if (name != NULL((void*)0)) | |||
1644 | { | |||
1645 | utf8_name = g_locale_to_utf8 (name, -1, NULL((void*)0), NULL((void*)0), NULL((void*)0)); | |||
1646 | } | |||
1647 | ||||
1648 | return utf8_name; | |||
1649 | } | |||
1650 | ||||
1651 | static void | |||
1652 | create_page_one_buttons (GSLockPlug *plug) | |||
1653 | { | |||
1654 | ||||
1655 | gs_profile_start ("page one buttons"); | |||
1656 | ||||
1657 | plug->priv->auth_switch_button = gs_lock_plug_add_button (GS_LOCK_PLUG (plug)((((GSLockPlug*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((gs_lock_plug_get_type ())))))), | |||
1658 | plug->priv->auth_action_area, | |||
1659 | _("S_witch User...")gettext ("S_witch User...")); | |||
1660 | ctk_button_box_set_child_secondary (CTK_BUTTON_BOX (plug->priv->auth_action_area)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_action_area)), ((ctk_button_box_get_type ())))))), | |||
1661 | plug->priv->auth_switch_button, | |||
1662 | TRUE(!(0))); | |||
1663 | ctk_widget_set_focus_on_click (CTK_WIDGET (plug->priv->auth_switch_button)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_switch_button)), ((ctk_widget_get_type ())))))), FALSE(0)); | |||
1664 | ctk_widget_set_no_show_all (plug->priv->auth_switch_button, TRUE(!(0))); | |||
1665 | ||||
1666 | plug->priv->auth_logout_button = gs_lock_plug_add_button (GS_LOCK_PLUG (plug)((((GSLockPlug*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((gs_lock_plug_get_type ())))))), | |||
1667 | plug->priv->auth_action_area, | |||
1668 | _("Log _Out")gettext ("Log _Out")); | |||
1669 | ctk_widget_set_focus_on_click (CTK_WIDGET (plug->priv->auth_logout_button)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_logout_button)), ((ctk_widget_get_type ())))))), FALSE(0)); | |||
1670 | ctk_widget_set_no_show_all (plug->priv->auth_logout_button, TRUE(!(0))); | |||
1671 | ||||
1672 | plug->priv->auth_cancel_button = gs_lock_plug_add_button (GS_LOCK_PLUG (plug)((((GSLockPlug*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((gs_lock_plug_get_type ())))))), | |||
1673 | plug->priv->auth_action_area, | |||
1674 | "ctk-cancel"); | |||
1675 | ctk_widget_set_focus_on_click (CTK_WIDGET (plug->priv->auth_cancel_button)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_cancel_button)), ((ctk_widget_get_type ())))))), FALSE(0)); | |||
1676 | ||||
1677 | plug->priv->auth_unlock_button = gs_lock_plug_add_button (GS_LOCK_PLUG (plug)((((GSLockPlug*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((gs_lock_plug_get_type ())))))), | |||
1678 | plug->priv->auth_action_area, | |||
1679 | _("_Unlock")gettext ("_Unlock")); | |||
1680 | ctk_widget_set_focus_on_click (CTK_WIDGET (plug->priv->auth_unlock_button)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_unlock_button)), ((ctk_widget_get_type ())))))), FALSE(0)); | |||
1681 | ||||
1682 | ctk_window_set_default (CTK_WINDOW (plug)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((ctk_window_get_type ())))))), plug->priv->auth_unlock_button); | |||
1683 | ||||
1684 | gs_profile_end ("page one buttons"); | |||
1685 | } | |||
1686 | ||||
1687 | /* adapted from MDM */ | |||
1688 | static char * | |||
1689 | expand_string (const char *text) | |||
1690 | { | |||
1691 | GString *str; | |||
1692 | const char *p; | |||
1693 | char *username; | |||
1694 | int i; | |||
1695 | int n_chars; | |||
1696 | struct utsname name; | |||
1697 | ||||
1698 | str = g_string_sized_new (strlen (text)); | |||
1699 | ||||
1700 | p = text; | |||
1701 | n_chars = g_utf8_strlen (text, -1); | |||
1702 | i = 0; | |||
1703 | ||||
1704 | while (i < n_chars) | |||
1705 | { | |||
1706 | gunichar ch; | |||
1707 | ||||
1708 | ch = g_utf8_get_char (p); | |||
1709 | ||||
1710 | /* Backslash commands */ | |||
1711 | if (ch == '\\') | |||
1712 | { | |||
1713 | p = g_utf8_next_char (p)((p) + g_utf8_skip[*(const guchar *)(p)]); | |||
1714 | i++; | |||
1715 | ch = g_utf8_get_char (p); | |||
1716 | ||||
1717 | if (i >= n_chars || ch == '\0') | |||
1718 | { | |||
1719 | g_warning ("Unescaped \\ at end of text\n"); | |||
1720 | goto bail; | |||
1721 | } | |||
1722 | else if (ch == 'n') | |||
1723 | { | |||
1724 | g_string_append_unichar (str, '\n'); | |||
1725 | } | |||
1726 | else | |||
1727 | { | |||
1728 | g_string_append_unichar (str, ch); | |||
1729 | } | |||
1730 | } | |||
1731 | else if (ch == '%') | |||
1732 | { | |||
1733 | p = g_utf8_next_char (p)((p) + g_utf8_skip[*(const guchar *)(p)]); | |||
1734 | i++; | |||
1735 | ch = g_utf8_get_char (p); | |||
1736 | ||||
1737 | if (i >= n_chars || ch == '\0') | |||
1738 | { | |||
1739 | g_warning ("Unescaped %% at end of text\n"); | |||
1740 | goto bail; | |||
1741 | } | |||
1742 | ||||
1743 | switch (ch) | |||
1744 | { | |||
1745 | case '%': | |||
1746 | g_string_append (str, "%")(__builtin_constant_p ("%") ? __extension__ ({ const char * const __val = ("%"); g_string_append_len_inline (str, __val, (__val != ((void*)0)) ? (gssize) strlen (((__val) + !(__val))) : (gssize ) -1); }) : g_string_append_len_inline (str, "%", (gssize) -1 )); | |||
1747 | break; | |||
1748 | case 'c': | |||
1749 | /* clock */ | |||
1750 | break; | |||
1751 | case 'd': | |||
1752 | /* display */ | |||
1753 | g_string_append (str, g_getenv ("DISPLAY"))(__builtin_constant_p (g_getenv ("DISPLAY")) ? __extension__ ( { const char * const __val = (g_getenv ("DISPLAY")); g_string_append_len_inline (str, __val, (__val != ((void*)0)) ? (gssize) strlen (((__val ) + !(__val))) : (gssize) -1); }) : g_string_append_len_inline (str, g_getenv ("DISPLAY"), (gssize) -1)); | |||
1754 | break; | |||
1755 | case 'h': | |||
1756 | /* hostname */ | |||
1757 | g_string_append (str, g_get_host_name ())(__builtin_constant_p (g_get_host_name ()) ? __extension__ ({ const char * const __val = (g_get_host_name ()); g_string_append_len_inline (str, __val, (__val != ((void*)0)) ? (gssize) strlen (((__val ) + !(__val))) : (gssize) -1); }) : g_string_append_len_inline (str, g_get_host_name (), (gssize) -1)); | |||
1758 | break; | |||
1759 | case 'm': | |||
1760 | /* machine name */ | |||
1761 | uname (&name); | |||
1762 | g_string_append (str, name.machine)(__builtin_constant_p (name.machine) ? __extension__ ({ const char * const __val = (name.machine); g_string_append_len_inline (str, __val, (__val != ((void*)0)) ? (gssize) strlen (((__val ) + !(__val))) : (gssize) -1); }) : g_string_append_len_inline (str, name.machine, (gssize) -1)); | |||
1763 | break; | |||
1764 | case 'n': | |||
1765 | /* nodename */ | |||
1766 | uname (&name); | |||
1767 | g_string_append (str, name.nodename)(__builtin_constant_p (name.nodename) ? __extension__ ({ const char * const __val = (name.nodename); g_string_append_len_inline (str, __val, (__val != ((void*)0)) ? (gssize) strlen (((__val ) + !(__val))) : (gssize) -1); }) : g_string_append_len_inline (str, name.nodename, (gssize) -1)); | |||
1768 | break; | |||
1769 | case 'r': | |||
1770 | /* release */ | |||
1771 | uname (&name); | |||
1772 | g_string_append (str, name.release)(__builtin_constant_p (name.release) ? __extension__ ({ const char * const __val = (name.release); g_string_append_len_inline (str, __val, (__val != ((void*)0)) ? (gssize) strlen (((__val ) + !(__val))) : (gssize) -1); }) : g_string_append_len_inline (str, name.release, (gssize) -1)); | |||
1773 | break; | |||
1774 | case 'R': | |||
1775 | /* Real name */ | |||
1776 | username = get_user_display_name (); | |||
1777 | g_string_append (str, username)(__builtin_constant_p (username) ? __extension__ ({ const char * const __val = (username); g_string_append_len_inline (str, __val, (__val != ((void*)0)) ? (gssize) strlen (((__val) + ! (__val))) : (gssize) -1); }) : g_string_append_len_inline (str , username, (gssize) -1)); | |||
1778 | g_free (username); | |||
1779 | break; | |||
1780 | case 's': | |||
1781 | /* system name */ | |||
1782 | uname (&name); | |||
1783 | g_string_append (str, name.sysname)(__builtin_constant_p (name.sysname) ? __extension__ ({ const char * const __val = (name.sysname); g_string_append_len_inline (str, __val, (__val != ((void*)0)) ? (gssize) strlen (((__val ) + !(__val))) : (gssize) -1); }) : g_string_append_len_inline (str, name.sysname, (gssize) -1)); | |||
1784 | break; | |||
1785 | case 'U': | |||
1786 | /* Username */ | |||
1787 | username = get_user_name (); | |||
1788 | g_string_append (str, username)(__builtin_constant_p (username) ? __extension__ ({ const char * const __val = (username); g_string_append_len_inline (str, __val, (__val != ((void*)0)) ? (gssize) strlen (((__val) + ! (__val))) : (gssize) -1); }) : g_string_append_len_inline (str , username, (gssize) -1)); | |||
1789 | g_free (username); | |||
1790 | break; | |||
1791 | default: | |||
1792 | if (ch < 127) | |||
1793 | { | |||
1794 | g_warning ("unknown escape code %%%c in text\n", (char)ch); | |||
1795 | } | |||
1796 | else | |||
1797 | { | |||
1798 | g_warning ("unknown escape code %%(U%x) in text\n", (int)ch); | |||
1799 | } | |||
1800 | } | |||
1801 | } | |||
1802 | else | |||
1803 | { | |||
1804 | g_string_append_unichar (str, ch); | |||
1805 | } | |||
1806 | p = g_utf8_next_char (p)((p) + g_utf8_skip[*(const guchar *)(p)]); | |||
1807 | i++; | |||
1808 | } | |||
1809 | ||||
1810 | bail: | |||
1811 | ||||
1812 | return g_string_free (str, FALSE)(__builtin_constant_p ((0)) ? (((0)) ? (g_string_free) ((str) , ((0))) : g_string_free_and_steal (str)) : (g_string_free) ( (str), ((0)))); | |||
1813 | } | |||
1814 | ||||
1815 | static void | |||
1816 | expand_string_for_label (CtkWidget *label) | |||
1817 | { | |||
1818 | const char *template; | |||
1819 | char *str; | |||
1820 | ||||
1821 | template = ctk_label_get_label (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((label)), ((ctk_label_get_type ()))))))); | |||
1822 | str = expand_string (template); | |||
1823 | ctk_label_set_label (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((label)), ((ctk_label_get_type ())))))), str); | |||
1824 | g_free (str); | |||
1825 | } | |||
1826 | ||||
1827 | static void | |||
1828 | create_page_one (GSLockPlug *plug) | |||
1829 | { | |||
1830 | CtkWidget *vbox; | |||
1831 | CtkWidget *vbox2; | |||
1832 | CtkWidget *hbox; | |||
1833 | char *str; | |||
1834 | ||||
1835 | gs_profile_start ("page one"); | |||
1836 | ||||
1837 | vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 12); | |||
1838 | ctk_widget_set_halign (CTK_WIDGET (vbox)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((vbox)), ((ctk_widget_get_type ())))))), | |||
1839 | CTK_ALIGN_CENTER); | |||
1840 | ctk_widget_set_valign (CTK_WIDGET (vbox)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((vbox)), ((ctk_widget_get_type ())))))), | |||
1841 | CTK_ALIGN_CENTER); | |||
1842 | ctk_notebook_append_page (CTK_NOTEBOOK (plug->priv->notebook)((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->notebook)), ((ctk_notebook_get_type () )))))), vbox, NULL((void*)0)); | |||
1843 | ||||
1844 | vbox2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0); | |||
1845 | ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((vbox)), ((ctk_box_get_type ())))))), vbox2, FALSE(0), FALSE(0), 0); | |||
1846 | ||||
1847 | str = g_strdup ("<span size=\"xx-large\" weight=\"ultrabold\">%s</span>")g_strdup_inline ("<span size=\"xx-large\" weight=\"ultrabold\">%s</span>" ); | |||
1848 | plug->priv->auth_time_label = ctk_label_new (str); | |||
1849 | g_free (str); | |||
1850 | ctk_label_set_xalign (CTK_LABEL (plug->priv->auth_time_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_time_label)), ((ctk_label_get_type ())))))), 0.5); | |||
1851 | ctk_label_set_yalign (CTK_LABEL (plug->priv->auth_time_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_time_label)), ((ctk_label_get_type ())))))), 0.5); | |||
1852 | ctk_label_set_use_markup (CTK_LABEL (plug->priv->auth_time_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_time_label)), ((ctk_label_get_type ())))))), TRUE(!(0))); | |||
1853 | ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((vbox2)), ((ctk_box_get_type ())))))), plug->priv->auth_time_label, FALSE(0), FALSE(0), 0); | |||
1854 | ||||
1855 | str = g_strdup ("<span size=\"large\">%s</span>")g_strdup_inline ("<span size=\"large\">%s</span>" ); | |||
1856 | plug->priv->auth_date_label = ctk_label_new (str); | |||
1857 | g_free (str); | |||
1858 | ctk_label_set_xalign (CTK_LABEL (plug->priv->auth_date_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_date_label)), ((ctk_label_get_type ())))))), 0.5); | |||
1859 | ctk_label_set_yalign (CTK_LABEL (plug->priv->auth_date_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_date_label)), ((ctk_label_get_type ())))))), 0.5); | |||
1860 | ctk_label_set_use_markup (CTK_LABEL (plug->priv->auth_date_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_date_label)), ((ctk_label_get_type ())))))), TRUE(!(0))); | |||
1861 | ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((vbox2)), ((ctk_box_get_type ())))))), plug->priv->auth_date_label, FALSE(0), FALSE(0), 0); | |||
1862 | ||||
1863 | plug->priv->auth_face_image = ctk_image_new (); | |||
1864 | ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((vbox)), ((ctk_box_get_type ())))))), plug->priv->auth_face_image, TRUE(!(0)), TRUE(!(0)), 0); | |||
1865 | ctk_widget_set_halign (plug->priv->auth_face_image, CTK_ALIGN_CENTER); | |||
1866 | ctk_widget_set_valign (plug->priv->auth_face_image, CTK_ALIGN_END); | |||
1867 | ||||
1868 | vbox2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0); | |||
1869 | ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((vbox)), ((ctk_box_get_type ())))))), vbox2, FALSE(0), FALSE(0), 0); | |||
1870 | ||||
1871 | str = g_strdup ("<span size=\"x-large\">%R</span>")g_strdup_inline ("<span size=\"x-large\">%R</span>" ); | |||
1872 | plug->priv->auth_realname_label = ctk_label_new (str); | |||
1873 | g_free (str); | |||
1874 | expand_string_for_label (plug->priv->auth_realname_label); | |||
1875 | ctk_label_set_xalign (CTK_LABEL (plug->priv->auth_realname_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_realname_label)), ((ctk_label_get_type ())))))), 0.5); | |||
1876 | ctk_label_set_yalign (CTK_LABEL (plug->priv->auth_realname_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_realname_label)), ((ctk_label_get_type ())))))), 0.5); | |||
1877 | ctk_label_set_use_markup (CTK_LABEL (plug->priv->auth_realname_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_realname_label)), ((ctk_label_get_type ())))))), TRUE(!(0))); | |||
1878 | ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((vbox2)), ((ctk_box_get_type ())))))), plug->priv->auth_realname_label, FALSE(0), FALSE(0), 0); | |||
1879 | ||||
1880 | /* To translators: This expands to USERNAME on HOSTNAME */ | |||
1881 | str = g_strdup_printf ("<span size=\"small\">%s</span>", _("%U on %h")gettext ("%U on %h")); | |||
1882 | plug->priv->auth_username_label = ctk_label_new (str); | |||
1883 | g_free (str); | |||
1884 | expand_string_for_label (plug->priv->auth_username_label); | |||
1885 | ctk_label_set_xalign (CTK_LABEL (plug->priv->auth_realname_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_realname_label)), ((ctk_label_get_type ())))))), 0.5); | |||
1886 | ctk_label_set_yalign (CTK_LABEL (plug->priv->auth_realname_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_realname_label)), ((ctk_label_get_type ())))))), 0.5); | |||
1887 | ctk_label_set_use_markup (CTK_LABEL (plug->priv->auth_username_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_username_label)), ((ctk_label_get_type ())))))), TRUE(!(0))); | |||
1888 | ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((vbox2)), ((ctk_box_get_type ())))))), plug->priv->auth_username_label, FALSE(0), FALSE(0), 0); | |||
1889 | ||||
1890 | vbox2 = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0); | |||
1891 | ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((vbox)), ((ctk_box_get_type ())))))), vbox2, TRUE(!(0)), TRUE(!(0)), 0); | |||
1892 | ||||
1893 | hbox = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 6); | |||
1894 | ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((vbox2)), ((ctk_box_get_type ())))))), hbox, FALSE(0), FALSE(0), 0); | |||
1895 | ||||
1896 | plug->priv->auth_prompt_label = ctk_label_new_with_mnemonic (_("_Password:")gettext ("_Password:")); | |||
1897 | ctk_label_set_xalign (CTK_LABEL (plug->priv->auth_prompt_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_prompt_label)), ((ctk_label_get_type ())))))), 0.0); | |||
1898 | ctk_label_set_yalign (CTK_LABEL (plug->priv->auth_prompt_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_prompt_label)), ((ctk_label_get_type ())))))), 0.5); | |||
1899 | ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((hbox)), ((ctk_box_get_type ())))))), plug->priv->auth_prompt_label, FALSE(0), FALSE(0), 0); | |||
1900 | ||||
1901 | plug->priv->auth_prompt_entry = ctk_entry_new (); | |||
1902 | ctk_box_pack_start (CTK_BOX (hbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((hbox)), ((ctk_box_get_type ())))))), plug->priv->auth_prompt_entry, TRUE(!(0)), TRUE(!(0)), 0); | |||
1903 | ||||
1904 | ctk_label_set_mnemonic_widget (CTK_LABEL (plug->priv->auth_prompt_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_prompt_label)), ((ctk_label_get_type ())))))), | |||
1905 | plug->priv->auth_prompt_entry); | |||
1906 | ||||
1907 | plug->priv->auth_capslock_label = ctk_label_new (""); | |||
1908 | ctk_label_set_xalign (CTK_LABEL (plug->priv->auth_capslock_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_capslock_label)), ((ctk_label_get_type ())))))), 0.5); | |||
1909 | ctk_label_set_yalign (CTK_LABEL (plug->priv->auth_capslock_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_capslock_label)), ((ctk_label_get_type ())))))), 0.5); | |||
1910 | ctk_box_pack_start (CTK_BOX (vbox2)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((vbox2)), ((ctk_box_get_type ())))))), plug->priv->auth_capslock_label, FALSE(0), FALSE(0), 0); | |||
1911 | ||||
1912 | /* Status text */ | |||
1913 | ||||
1914 | plug->priv->auth_message_label = ctk_label_new (NULL((void*)0)); | |||
1915 | ctk_box_pack_start (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((vbox)), ((ctk_box_get_type ())))))), plug->priv->auth_message_label, | |||
1916 | FALSE(0), FALSE(0), 0); | |||
1917 | /* Buttons */ | |||
1918 | plug->priv->auth_action_area = ctk_button_box_new (CTK_ORIENTATION_HORIZONTAL); | |||
1919 | ||||
1920 | ctk_button_box_set_layout (CTK_BUTTON_BOX (plug->priv->auth_action_area)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_action_area)), ((ctk_button_box_get_type ())))))), | |||
1921 | CTK_BUTTONBOX_END); | |||
1922 | ||||
1923 | ctk_box_pack_end (CTK_BOX (vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((vbox)), ((ctk_box_get_type ())))))), plug->priv->auth_action_area, | |||
1924 | FALSE(0), TRUE(!(0)), 0); | |||
1925 | ctk_widget_show (plug->priv->auth_action_area); | |||
1926 | ||||
1927 | create_page_one_buttons (plug); | |||
1928 | ||||
1929 | gs_profile_end ("page one"); | |||
1930 | } | |||
1931 | ||||
1932 | static void | |||
1933 | unlock_button_clicked (CtkButton *button, | |||
1934 | GSLockPlug *plug) | |||
1935 | { | |||
1936 | gs_lock_plug_response (plug, GS_LOCK_PLUG_RESPONSE_OK); | |||
1937 | } | |||
1938 | ||||
1939 | static void | |||
1940 | cancel_button_clicked (CtkButton *button, | |||
1941 | GSLockPlug *plug) | |||
1942 | { | |||
1943 | gs_lock_plug_response (plug, GS_LOCK_PLUG_RESPONSE_CANCEL); | |||
1944 | } | |||
1945 | ||||
1946 | static void | |||
1947 | switch_user_button_clicked (CtkButton *button, | |||
1948 | GSLockPlug *plug) | |||
1949 | { | |||
1950 | ||||
1951 | remove_response_idle (plug); | |||
1952 | ||||
1953 | gs_lock_plug_set_sensitive (plug, FALSE(0)); | |||
1954 | ||||
1955 | plug->priv->response_idle_id = g_timeout_add (2000, | |||
1956 | (GSourceFunc)response_cancel_idle_cb, | |||
1957 | plug); | |||
1958 | ||||
1959 | gs_lock_plug_set_busy (plug); | |||
1960 | do_user_switch (plug); | |||
| ||||
1961 | } | |||
1962 | ||||
1963 | static char * | |||
1964 | get_dialog_theme_name (GSLockPlug *plug) | |||
1965 | { | |||
1966 | char *name; | |||
1967 | GSettings *settings; | |||
1968 | ||||
1969 | settings = g_settings_new (GSETTINGS_SCHEMA"org.cafe.screensaver"); | |||
1970 | name = g_settings_get_string (settings, KEY_LOCK_DIALOG_THEME"lock-dialog-theme"); | |||
1971 | g_object_unref (settings); | |||
1972 | ||||
1973 | return name; | |||
1974 | } | |||
1975 | ||||
1976 | static gboolean | |||
1977 | load_theme (GSLockPlug *plug) | |||
1978 | { | |||
1979 | char *theme; | |||
1980 | char *filename; | |||
1981 | char *ctkbuilder; | |||
1982 | char *css; | |||
1983 | CtkBuilder *builder; | |||
1984 | CtkWidget *lock_dialog; | |||
1985 | GError *error=NULL((void*)0); | |||
1986 | ||||
1987 | theme = get_dialog_theme_name (plug); | |||
1988 | if (theme == NULL((void*)0)) | |||
1989 | { | |||
1990 | return FALSE(0); | |||
1991 | } | |||
1992 | ||||
1993 | filename = g_strdup_printf ("lock-dialog-%s.ui", theme); | |||
1994 | ctkbuilder = g_build_filename (CTKBUILDERDIR"/usr/share/cafe-screensaver", filename, NULL((void*)0)); | |||
1995 | g_free (filename); | |||
1996 | if (! g_file_test (ctkbuilder, G_FILE_TEST_IS_REGULAR)) | |||
1997 | { | |||
1998 | g_free (ctkbuilder); | |||
1999 | g_free (theme); | |||
2000 | return FALSE(0); | |||
2001 | } | |||
2002 | ||||
2003 | filename = g_strdup_printf ("lock-dialog-%s.css", theme); | |||
2004 | g_free (theme); | |||
2005 | css = g_build_filename (CTKBUILDERDIR"/usr/share/cafe-screensaver", filename, NULL((void*)0)); | |||
2006 | g_free (filename); | |||
2007 | if (g_file_test (css, G_FILE_TEST_IS_REGULAR)) | |||
2008 | { | |||
2009 | static CtkCssProvider *style_provider = NULL((void*)0); | |||
2010 | ||||
2011 | if (style_provider == NULL((void*)0)) | |||
2012 | { | |||
2013 | style_provider = ctk_css_provider_new (); | |||
2014 | ||||
2015 | ctk_style_context_add_provider_for_screen (cdk_screen_get_default(), | |||
2016 | CTK_STYLE_PROVIDER (style_provider)((((CtkStyleProvider*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((style_provider)), ((ctk_style_provider_get_type ())))))), | |||
2017 | CTK_STYLE_PROVIDER_PRIORITY_USER800); | |||
2018 | } | |||
2019 | ||||
2020 | ctk_css_provider_load_from_path (style_provider, css, NULL((void*)0)); | |||
2021 | } | |||
2022 | g_free (css); | |||
2023 | ||||
2024 | builder = ctk_builder_new(); | |||
2025 | if (!ctk_builder_add_from_file (builder,ctkbuilder,&error)) | |||
2026 | { | |||
2027 | g_warning ("Couldn't load builder file '%s': %s", ctkbuilder, error->message); | |||
2028 | g_error_free(error); | |||
2029 | g_free (ctkbuilder); | |||
2030 | return FALSE(0); | |||
2031 | } | |||
2032 | g_free (ctkbuilder); | |||
2033 | ||||
2034 | lock_dialog = CTK_WIDGET (ctk_builder_get_object(builder, "lock-dialog"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "lock-dialog"))), ((ctk_widget_get_type ())))))); | |||
2035 | ctk_container_add (CTK_CONTAINER (plug)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((ctk_container_get_type ())))))), lock_dialog); | |||
2036 | ||||
2037 | plug->priv->vbox = NULL((void*)0); | |||
2038 | plug->priv->notebook = CTK_WIDGET (ctk_builder_get_object(builder, "notebook"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "notebook"))), ((ctk_widget_get_type ())))))); | |||
2039 | ||||
2040 | plug->priv->auth_face_image = CTK_WIDGET (ctk_builder_get_object(builder, "auth-face-image"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "auth-face-image"))), (( ctk_widget_get_type ())))))); | |||
2041 | plug->priv->auth_action_area = CTK_WIDGET (ctk_builder_get_object(builder, "auth-action-area"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "auth-action-area"))), ( (ctk_widget_get_type ())))))); | |||
2042 | plug->priv->auth_time_label = CTK_WIDGET (ctk_builder_get_object(builder, "auth-time-label"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "auth-time-label"))), (( ctk_widget_get_type ())))))); | |||
2043 | plug->priv->auth_date_label = CTK_WIDGET (ctk_builder_get_object(builder, "auth-date-label"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "auth-date-label"))), (( ctk_widget_get_type ())))))); | |||
2044 | plug->priv->auth_realname_label = CTK_WIDGET (ctk_builder_get_object(builder, "auth-realname-label"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "auth-realname-label"))) , ((ctk_widget_get_type ())))))); | |||
2045 | plug->priv->auth_username_label = CTK_WIDGET (ctk_builder_get_object(builder, "auth-username-label"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "auth-username-label"))) , ((ctk_widget_get_type ())))))); | |||
2046 | plug->priv->auth_prompt_label = CTK_WIDGET (ctk_builder_get_object(builder, "auth-prompt-label"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "auth-prompt-label"))), ( (ctk_widget_get_type ())))))); | |||
2047 | plug->priv->auth_prompt_entry = CTK_WIDGET (ctk_builder_get_object(builder, "auth-prompt-entry"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "auth-prompt-entry"))), ( (ctk_widget_get_type ())))))); | |||
2048 | plug->priv->auth_prompt_box = CTK_WIDGET (ctk_builder_get_object(builder, "auth-prompt-box"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "auth-prompt-box"))), (( ctk_widget_get_type ())))))); | |||
2049 | plug->priv->auth_capslock_label = CTK_WIDGET (ctk_builder_get_object(builder, "auth-capslock-label"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "auth-capslock-label"))) , ((ctk_widget_get_type ())))))); | |||
2050 | plug->priv->auth_message_label = CTK_WIDGET (ctk_builder_get_object(builder, "auth-status-label"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "auth-status-label"))), ( (ctk_widget_get_type ())))))); | |||
2051 | plug->priv->auth_unlock_button = CTK_WIDGET (ctk_builder_get_object(builder, "auth-unlock-button"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "auth-unlock-button"))), ((ctk_widget_get_type ())))))); | |||
2052 | plug->priv->auth_cancel_button = CTK_WIDGET (ctk_builder_get_object(builder, "auth-cancel-button"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "auth-cancel-button"))), ((ctk_widget_get_type ())))))); | |||
2053 | plug->priv->auth_logout_button = CTK_WIDGET (ctk_builder_get_object(builder, "auth-logout-button"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "auth-logout-button"))), ((ctk_widget_get_type ())))))); | |||
2054 | plug->priv->auth_switch_button = CTK_WIDGET (ctk_builder_get_object(builder, "auth-switch-button"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "auth-switch-button"))), ((ctk_widget_get_type ())))))); | |||
2055 | plug->priv->auth_note_button = CTK_WIDGET (ctk_builder_get_object(builder, "auth-note-button"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "auth-note-button"))), ( (ctk_widget_get_type ())))))); | |||
2056 | plug->priv->note_tab = CTK_WIDGET (ctk_builder_get_object(builder, "note-tab"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "note-tab"))), ((ctk_widget_get_type ())))))); | |||
2057 | plug->priv->note_tab_label = CTK_WIDGET (ctk_builder_get_object(builder, "note-tab-label"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "note-tab-label"))), ((ctk_widget_get_type ())))))); | |||
2058 | plug->priv->note_ok_button = CTK_WIDGET (ctk_builder_get_object(builder, "note-ok-button"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "note-ok-button"))), ((ctk_widget_get_type ())))))); | |||
2059 | plug->priv->note_text_view = CTK_WIDGET (ctk_builder_get_object(builder, "note-text-view"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "note-text-view"))), ((ctk_widget_get_type ())))))); | |||
2060 | plug->priv->note_cancel_button = CTK_WIDGET (ctk_builder_get_object(builder, "note-cancel-button"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "note-cancel-button"))), ((ctk_widget_get_type ())))))); | |||
2061 | ||||
2062 | /* Placeholder for the keyboard indicator */ | |||
2063 | plug->priv->auth_prompt_kbd_layout_indicator = CTK_WIDGET (ctk_builder_get_object(builder, "auth-prompt-kbd-layout-indicator"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "auth-prompt-kbd-layout-indicator" ))), ((ctk_widget_get_type ())))))); | |||
2064 | if (plug->priv->auth_logout_button != NULL((void*)0)) | |||
2065 | { | |||
2066 | ctk_widget_set_no_show_all (plug->priv->auth_logout_button, TRUE(!(0))); | |||
2067 | } | |||
2068 | if (plug->priv->auth_switch_button != NULL((void*)0)) | |||
2069 | { | |||
2070 | ctk_widget_set_no_show_all (plug->priv->auth_switch_button, TRUE(!(0))); | |||
2071 | } | |||
2072 | if (plug->priv->auth_note_button != NULL((void*)0)) | |||
2073 | { | |||
2074 | ctk_widget_set_no_show_all (plug->priv->auth_note_button, TRUE(!(0))); | |||
2075 | } | |||
2076 | ||||
2077 | date_time_update (plug); | |||
2078 | ctk_widget_show_all (lock_dialog); | |||
2079 | ||||
2080 | plug->priv->status_message_label = CTK_WIDGET (ctk_builder_get_object(builder, "status-message-label"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object(builder, "status-message-label")) ), ((ctk_widget_get_type ())))))); | |||
2081 | ||||
2082 | return TRUE(!(0)); | |||
2083 | } | |||
2084 | ||||
2085 | static int | |||
2086 | delete_handler (GSLockPlug *plug, | |||
2087 | CdkEventAny *event, | |||
2088 | gpointer data) | |||
2089 | { | |||
2090 | gs_lock_plug_response (plug, GS_LOCK_PLUG_RESPONSE_CANCEL); | |||
2091 | ||||
2092 | return TRUE(!(0)); /* Do not destroy */ | |||
2093 | } | |||
2094 | ||||
2095 | static void | |||
2096 | on_note_text_buffer_changed (CtkTextBuffer *buffer, | |||
2097 | GSLockPlug *plug) | |||
2098 | { | |||
2099 | int len; | |||
2100 | ||||
2101 | len = ctk_text_buffer_get_char_count (buffer); | |||
2102 | ctk_widget_set_sensitive (plug->priv->note_ok_button, len <= NOTE_BUFFER_MAX_CHARS160); | |||
2103 | } | |||
2104 | ||||
2105 | static void | |||
2106 | gs_lock_plug_init (GSLockPlug *plug) | |||
2107 | { | |||
2108 | gs_profile_start (NULL); | |||
2109 | ||||
2110 | plug->priv = gs_lock_plug_get_instance_private (plug); | |||
2111 | ||||
2112 | clear_clipboards (plug); | |||
2113 | ||||
2114 | #ifdef WITH_LIBNOTIFY1 | |||
2115 | notify_init ("cafe-screensaver-dialog"); | |||
2116 | plug->priv->leave_note_enabled = TRUE(!(0)); | |||
2117 | #else | |||
2118 | plug->priv->leave_note_enabled = FALSE(0); | |||
2119 | #endif | |||
2120 | ||||
2121 | CtkStyleContext *context; | |||
2122 | ||||
2123 | context = ctk_widget_get_style_context (CTK_WIDGET (plug)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((ctk_widget_get_type ()))))))); | |||
2124 | ctk_style_context_add_class (context, "lock-dialog"); | |||
2125 | ||||
2126 | if (! load_theme (plug)) | |||
2127 | { | |||
2128 | gs_debug ("Unable to load theme!")gs_debug_real (__func__, "gs-lock-plug.c", 2128, "Unable to load theme!" ); | |||
2129 | ||||
2130 | plug->priv->vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0); | |||
2131 | ctk_container_add (CTK_CONTAINER (plug)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug)), ((ctk_container_get_type ())))))), plug->priv->vbox); | |||
2132 | ||||
2133 | /* Notebook */ | |||
2134 | ||||
2135 | plug->priv->notebook = ctk_notebook_new (); | |||
2136 | ctk_notebook_set_show_tabs (CTK_NOTEBOOK (plug->priv->notebook)((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->notebook)), ((ctk_notebook_get_type () )))))), FALSE(0)); | |||
2137 | ctk_notebook_set_show_border (CTK_NOTEBOOK (plug->priv->notebook)((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->notebook)), ((ctk_notebook_get_type () )))))), FALSE(0)); | |||
2138 | ctk_box_pack_start (CTK_BOX (plug->priv->vbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->vbox)), ((ctk_box_get_type ())))))), plug->priv->notebook, TRUE(!(0)), TRUE(!(0)), 0); | |||
2139 | ||||
2140 | /* Page 1 */ | |||
2141 | ||||
2142 | create_page_one (plug); | |||
2143 | ||||
2144 | date_time_update (plug); | |||
2145 | ctk_widget_show_all (plug->priv->vbox); | |||
2146 | } | |||
2147 | plug->priv->datetime_timeout_id = g_timeout_add_seconds (1, (GSourceFunc) date_time_update, plug); | |||
2148 | ||||
2149 | if (plug->priv->note_text_view != NULL((void*)0)) | |||
2150 | { | |||
2151 | CtkTextBuffer *buffer; | |||
2152 | buffer = ctk_text_view_get_buffer (CTK_TEXT_VIEW (plug->priv->note_text_view)((((CtkTextView*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->note_text_view)), ((ctk_text_view_get_type ()))))))); | |||
2153 | g_signal_connect (buffer, "changed", G_CALLBACK (on_note_text_buffer_changed), plug)g_signal_connect_data ((buffer), ("changed"), (((GCallback) ( on_note_text_buffer_changed))), (plug), ((void*)0), (GConnectFlags ) 0); | |||
2154 | } | |||
2155 | ||||
2156 | /* Layout indicator */ | |||
2157 | #ifdef WITH_KBD_LAYOUT_INDICATOR1 | |||
2158 | if (plug->priv->auth_prompt_kbd_layout_indicator != NULL((void*)0)) | |||
2159 | { | |||
2160 | XklEngine *engine; | |||
2161 | ||||
2162 | engine = xkl_engine_get_instance (CDK_DISPLAY_XDISPLAY (cdk_display_get_default ())(cdk_x11_display_get_xdisplay (cdk_display_get_default ()))); | |||
2163 | if (xkl_engine_get_num_groups (engine) > 1) | |||
2164 | { | |||
2165 | CtkWidget *layout_indicator; | |||
2166 | ||||
2167 | layout_indicator = cafekbd_indicator_new (); | |||
2168 | cafekbd_indicator_set_parent_tooltips (CAFEKBD_INDICATOR (layout_indicator)((((CafekbdIndicator*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((layout_indicator)), ((cafekbd_indicator_get_type ())))))), TRUE(!(0))); | |||
2169 | ctk_box_pack_start (CTK_BOX (plug->priv->auth_prompt_kbd_layout_indicator)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_prompt_kbd_layout_indicator)), (( ctk_box_get_type ())))))), | |||
2170 | layout_indicator, | |||
2171 | FALSE(0), | |||
2172 | FALSE(0), | |||
2173 | 6); | |||
2174 | ||||
2175 | ctk_widget_show_all (layout_indicator); | |||
2176 | ctk_widget_show (plug->priv->auth_prompt_kbd_layout_indicator); | |||
2177 | } | |||
2178 | else | |||
2179 | { | |||
2180 | ctk_widget_hide (plug->priv->auth_prompt_kbd_layout_indicator); | |||
2181 | } | |||
2182 | ||||
2183 | g_object_unref (engine); | |||
2184 | } | |||
2185 | #endif | |||
2186 | ||||
2187 | if (plug->priv->auth_note_button != NULL((void*)0)) | |||
2188 | { | |||
2189 | if (plug->priv->leave_note_enabled) | |||
2190 | { | |||
2191 | ctk_widget_show_all (plug->priv->auth_note_button); | |||
2192 | } | |||
2193 | else | |||
2194 | { | |||
2195 | ctk_widget_hide (plug->priv->auth_note_button); | |||
2196 | } | |||
2197 | } | |||
2198 | if (plug->priv->auth_switch_button != NULL((void*)0)) | |||
2199 | { | |||
2200 | if (plug->priv->switch_enabled) | |||
2201 | { | |||
2202 | ctk_widget_show_all (plug->priv->auth_switch_button); | |||
2203 | } | |||
2204 | else | |||
2205 | { | |||
2206 | ctk_widget_hide (plug->priv->auth_switch_button); | |||
2207 | } | |||
2208 | } | |||
2209 | ||||
2210 | ctk_widget_grab_default (plug->priv->auth_unlock_button); | |||
2211 | ||||
2212 | if (plug->priv->auth_username_label != NULL((void*)0)) | |||
2213 | { | |||
2214 | expand_string_for_label (plug->priv->auth_username_label); | |||
2215 | } | |||
2216 | ||||
2217 | if (plug->priv->auth_realname_label != NULL((void*)0)) | |||
2218 | { | |||
2219 | expand_string_for_label (plug->priv->auth_realname_label); | |||
2220 | } | |||
2221 | ||||
2222 | if (! plug->priv->logout_enabled || ! plug->priv->logout_command) | |||
2223 | { | |||
2224 | if (plug->priv->auth_logout_button != NULL((void*)0)) | |||
2225 | { | |||
2226 | ctk_widget_hide (plug->priv->auth_logout_button); | |||
2227 | } | |||
2228 | } | |||
2229 | ||||
2230 | plug->priv->timeout = DIALOG_TIMEOUT_MSEC60000; | |||
2231 | ||||
2232 | g_signal_connect (plug, "key_press_event",g_signal_connect_data ((plug), ("key_press_event"), (((GCallback ) (entry_key_press))), (plug), ((void*)0), (GConnectFlags) 0) | |||
2233 | G_CALLBACK (entry_key_press), plug)g_signal_connect_data ((plug), ("key_press_event"), (((GCallback ) (entry_key_press))), (plug), ((void*)0), (GConnectFlags) 0); | |||
2234 | ||||
2235 | /* button press handler used to inhibit popup menu */ | |||
2236 | g_signal_connect (plug->priv->auth_prompt_entry, "button_press_event",g_signal_connect_data ((plug->priv->auth_prompt_entry), ("button_press_event"), (((GCallback) (entry_button_press))) , (((void*)0)), ((void*)0), (GConnectFlags) 0) | |||
2237 | G_CALLBACK (entry_button_press), NULL)g_signal_connect_data ((plug->priv->auth_prompt_entry), ("button_press_event"), (((GCallback) (entry_button_press))) , (((void*)0)), ((void*)0), (GConnectFlags) 0); | |||
2238 | ctk_entry_set_activates_default (CTK_ENTRY (plug->priv->auth_prompt_entry)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_prompt_entry)), ((ctk_entry_get_type ())))))), TRUE(!(0))); | |||
2239 | ctk_entry_set_visibility (CTK_ENTRY (plug->priv->auth_prompt_entry)((((CtkEntry*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->auth_prompt_entry)), ((ctk_entry_get_type ())))))), FALSE(0)); | |||
2240 | ||||
2241 | g_signal_connect (plug->priv->auth_unlock_button, "clicked",g_signal_connect_data ((plug->priv->auth_unlock_button) , ("clicked"), (((GCallback) (unlock_button_clicked))), (plug ), ((void*)0), (GConnectFlags) 0) | |||
2242 | G_CALLBACK (unlock_button_clicked), plug)g_signal_connect_data ((plug->priv->auth_unlock_button) , ("clicked"), (((GCallback) (unlock_button_clicked))), (plug ), ((void*)0), (GConnectFlags) 0); | |||
2243 | ||||
2244 | g_signal_connect (plug->priv->auth_cancel_button, "clicked",g_signal_connect_data ((plug->priv->auth_cancel_button) , ("clicked"), (((GCallback) (cancel_button_clicked))), (plug ), ((void*)0), (GConnectFlags) 0) | |||
2245 | G_CALLBACK (cancel_button_clicked), plug)g_signal_connect_data ((plug->priv->auth_cancel_button) , ("clicked"), (((GCallback) (cancel_button_clicked))), (plug ), ((void*)0), (GConnectFlags) 0); | |||
2246 | ||||
2247 | if (plug->priv->status_message_label) | |||
2248 | { | |||
2249 | if (plug->priv->status_message) | |||
2250 | { | |||
2251 | ctk_label_set_text (CTK_LABEL (plug->priv->status_message_label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((plug->priv->status_message_label)), ((ctk_label_get_type ())))))), | |||
2252 | plug->priv->status_message); | |||
2253 | } | |||
2254 | else | |||
2255 | { | |||
2256 | ctk_widget_hide (plug->priv->status_message_label); | |||
2257 | } | |||
2258 | } | |||
2259 | ||||
2260 | if (plug->priv->auth_switch_button != NULL((void*)0)) | |||
2261 | { | |||
2262 | g_signal_connect (plug->priv->auth_switch_button, "clicked",g_signal_connect_data ((plug->priv->auth_switch_button) , ("clicked"), (((GCallback) (switch_user_button_clicked))), ( plug), ((void*)0), (GConnectFlags) 0) | |||
2263 | G_CALLBACK (switch_user_button_clicked), plug)g_signal_connect_data ((plug->priv->auth_switch_button) , ("clicked"), (((GCallback) (switch_user_button_clicked))), ( plug), ((void*)0), (GConnectFlags) 0); | |||
2264 | } | |||
2265 | ||||
2266 | if (plug->priv->auth_note_button != NULL((void*)0)) | |||
2267 | { | |||
2268 | g_signal_connect (plug->priv->auth_note_button, "clicked",g_signal_connect_data ((plug->priv->auth_note_button), ( "clicked"), (((GCallback) (take_note))), (plug), ((void*)0), ( GConnectFlags) 0) | |||
2269 | G_CALLBACK (take_note), plug)g_signal_connect_data ((plug->priv->auth_note_button), ( "clicked"), (((GCallback) (take_note))), (plug), ((void*)0), ( GConnectFlags) 0); | |||
2270 | g_signal_connect (plug->priv->note_ok_button, "clicked",g_signal_connect_data ((plug->priv->note_ok_button), ("clicked" ), (((GCallback) (submit_note))), (plug), ((void*)0), (GConnectFlags ) 0) | |||
2271 | G_CALLBACK (submit_note), plug)g_signal_connect_data ((plug->priv->note_ok_button), ("clicked" ), (((GCallback) (submit_note))), (plug), ((void*)0), (GConnectFlags ) 0); | |||
2272 | g_signal_connect (plug->priv->note_cancel_button, "clicked",g_signal_connect_data ((plug->priv->note_cancel_button) , ("clicked"), (((GCallback) (cancel_note))), (plug), ((void* )0), (GConnectFlags) 0) | |||
2273 | G_CALLBACK (cancel_note), plug)g_signal_connect_data ((plug->priv->note_cancel_button) , ("clicked"), (((GCallback) (cancel_note))), (plug), ((void* )0), (GConnectFlags) 0); | |||
2274 | } | |||
2275 | ||||
2276 | if (plug->priv->note_tab_label != NULL((void*)0)) | |||
2277 | { | |||
2278 | expand_string_for_label (plug->priv->note_tab_label); | |||
2279 | } | |||
2280 | ||||
2281 | if (plug->priv->auth_logout_button != NULL((void*)0)) | |||
2282 | { | |||
2283 | g_signal_connect (plug->priv->auth_logout_button, "clicked",g_signal_connect_data ((plug->priv->auth_logout_button) , ("clicked"), (((GCallback) (logout_button_clicked))), (plug ), ((void*)0), (GConnectFlags) 0) | |||
2284 | G_CALLBACK (logout_button_clicked), plug)g_signal_connect_data ((plug->priv->auth_logout_button) , ("clicked"), (((GCallback) (logout_button_clicked))), (plug ), ((void*)0), (GConnectFlags) 0); | |||
2285 | } | |||
2286 | ||||
2287 | g_signal_connect (plug, "delete_event", G_CALLBACK (delete_handler), NULL)g_signal_connect_data ((plug), ("delete_event"), (((GCallback ) (delete_handler))), (((void*)0)), ((void*)0), (GConnectFlags ) 0); | |||
2288 | ||||
2289 | gs_profile_end (NULL); | |||
2290 | } | |||
2291 | ||||
2292 | static void | |||
2293 | gs_lock_plug_finalize (GObject *object) | |||
2294 | { | |||
2295 | GSLockPlug *plug; | |||
2296 | ||||
2297 | g_return_if_fail (object != NULL)do{ (void)0; }while (0); | |||
2298 | g_return_if_fail (GS_IS_LOCK_PLUG (object))do{ (void)0; }while (0); | |||
2299 | ||||
2300 | plug = GS_LOCK_PLUG (object)((((GSLockPlug*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((object)), ((gs_lock_plug_get_type ())))))); | |||
2301 | ||||
2302 | g_return_if_fail (plug->priv != NULL)do{ (void)0; }while (0); | |||
2303 | ||||
2304 | g_free (plug->priv->logout_command); | |||
2305 | ||||
2306 | remove_response_idle (plug); | |||
2307 | remove_cancel_timeout (plug); | |||
2308 | remove_datetime_timeout (plug); | |||
2309 | #ifdef WITH_LIBNOTIFY1 | |||
2310 | notify_uninit (); | |||
2311 | #endif | |||
2312 | ||||
2313 | G_OBJECT_CLASS (gs_lock_plug_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((gs_lock_plug_parent_class)), (((GType) ((20) << (2 ))))))))->finalize (object); | |||
2314 | } | |||
2315 | ||||
2316 | CtkWidget * | |||
2317 | gs_lock_plug_new (void) | |||
2318 | { | |||
2319 | CtkWidget *result; | |||
2320 | ||||
2321 | result = g_object_new (GS_TYPE_LOCK_PLUG(gs_lock_plug_get_type ()), NULL((void*)0)); | |||
2322 | ||||
2323 | ctk_window_set_focus_on_map (CTK_WINDOW (result)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((result)), ((ctk_window_get_type ())))))), TRUE(!(0))); | |||
2324 | ||||
2325 | return result; | |||
2326 | } |