[Xfce4-commits] [apps/xfce4-screensaver] 01/05: simplify some lock-plug code
noreply at xfce.org
noreply at xfce.org
Mon Jul 22 01:49:38 CEST 2019
This is an automated email from the git hooks/post-receive script.
b l u e s a b r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/xfce4-screensaver.
commit d87f199c2f25120f6d8b6398ed5b7e2702488ef2
Author: Alexander Butenko <a.butenka at gmail.com>
Date: Sun Jul 7 14:30:28 2019 -0400
simplify some lock-plug code
Signed-off-by: Sean Davis <smd.seandavis at gmail.com>
---
src/gs-lock-plug.c | 59 +++++++++++++++++-------------------------------------
1 file changed, 18 insertions(+), 41 deletions(-)
diff --git a/src/gs-lock-plug.c b/src/gs-lock-plug.c
index d3291d7..26b245d 100644
--- a/src/gs-lock-plug.c
+++ b/src/gs-lock-plug.c
@@ -59,12 +59,8 @@
#define GDM_FLEXISERVER_COMMAND "gdmflexiserver"
#define GDM_FLEXISERVER_ARGS "--startnew Standard"
-enum {
- AUTH_PAGE = 0,
-};
-
#define FACE_ICON_SIZE 48
-#define DIALOG_TIMEOUT_MSEC 60000
+#define DIALOG_TIMEOUT_SEC 60
static void gs_lock_plug_finalize (GObject *object);
@@ -98,8 +94,6 @@ struct GSLockPlugPrivate {
char *logout_command;
char *status_message;
- guint timeout;
-
guint datetime_timeout_id;
guint cancel_timeout_id;
guint auth_check_idle_id;
@@ -334,15 +328,11 @@ remove_response_idle (GSLockPlug *plug) {
static void
gs_lock_plug_response (GSLockPlug *plug,
gint response_id) {
- int new_response;
-
- new_response = response_id;
-
g_return_if_fail (GS_IS_LOCK_PLUG (plug));
/* Act only on response IDs we recognize */
- if (!(response_id == GS_LOCK_PLUG_RESPONSE_OK
- || response_id == GS_LOCK_PLUG_RESPONSE_CANCEL)) {
+ if (!(response_id == GS_LOCK_PLUG_RESPONSE_OK ||
+ response_id == GS_LOCK_PLUG_RESPONSE_CANCEL)) {
return;
}
@@ -353,10 +343,7 @@ gs_lock_plug_response (GSLockPlug *plug,
gtk_entry_set_text (GTK_ENTRY (plug->priv->auth_prompt_entry), "");
}
- g_signal_emit (plug,
- lock_plug_signals[RESPONSE],
- 0,
- new_response);
+ g_signal_emit (plug, lock_plug_signals[RESPONSE], 0, response_id);
}
static gboolean
@@ -406,25 +393,21 @@ capslock_update (GSLockPlug *plug,
static gboolean
is_capslock_on (void) {
GdkKeymap *keymap;
- gboolean res;
-
- res = FALSE;
keymap = gdk_keymap_get_for_display (gdk_display_get_default());;
- if (keymap != NULL) {
- res = gdk_keymap_get_caps_lock_state (keymap);
- }
+ if (keymap == NULL)
+ return FALSE;
- return res;
+ return gdk_keymap_get_caps_lock_state (keymap);
}
static void
restart_cancel_timeout (GSLockPlug *plug) {
remove_cancel_timeout (plug);
-
- plug->priv->cancel_timeout_id = g_timeout_add (plug->priv->timeout,
- (GSourceFunc)dialog_timed_out,
- plug);
+ plug->priv->cancel_timeout_id = g_timeout_add_seconds (
+ DIALOG_TIMEOUT_SEC,
+ (GSourceFunc)dialog_timed_out,
+ plug);
}
void
@@ -664,20 +647,16 @@ get_user_icon_from_accounts_service (void) {
static gboolean
set_face_image (GSLockPlug *plug) {
- GdkPixbuf *pixbuf = get_user_icon_from_accounts_service ();
+ char *path;
+ GError *error = NULL;
+ GdkPixbuf *pixbuf;
+ pixbuf = get_user_icon_from_accounts_service ();
if (pixbuf == NULL) {
- const char *homedir;
- char *path;
- GError *error = NULL;
- homedir = g_get_home_dir ();
- path = g_build_filename (homedir, ".face", NULL);
-
- pixbuf = gdk_pixbuf_new_from_file_at_scale (path, 80, 80, FALSE,
- &error);
+ path = g_build_filename (g_get_home_dir(), ".face", NULL);
+ pixbuf = gdk_pixbuf_new_from_file_at_scale (path, 80, 80, FALSE, &error);
if (pixbuf == NULL) {
- g_warning ("Could not load the user avatar: %s",
- error->message);
+ g_warning ("Could not load the user avatar: %s", error->message);
g_error_free (error);
return FALSE;
}
@@ -1610,8 +1589,6 @@ gs_lock_plug_init (GSLockPlug *plug) {
}
}
- plug->priv->timeout = DIALOG_TIMEOUT_MSEC;
-
g_signal_connect (plug, "key_press_event",
G_CALLBACK (entry_key_press), plug);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list