diff options
Diffstat (limited to 'mate-session/gsm-inhibit-dialog.c')
-rw-r--r-- | mate-session/gsm-inhibit-dialog.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/mate-session/gsm-inhibit-dialog.c b/mate-session/gsm-inhibit-dialog.c index a4e86e8..791a7b3 100644 --- a/mate-session/gsm-inhibit-dialog.c +++ b/mate-session/gsm-inhibit-dialog.c @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2008 William Jon McCann <[email protected]> + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -91,13 +92,25 @@ G_DEFINE_TYPE (GsmInhibitDialog, gsm_inhibit_dialog, GTK_TYPE_DIALOG) static void lock_screen (GsmInhibitDialog *dialog) { - GError *error; - error = NULL; - g_spawn_command_line_async ("mate-screensaver-command --lock", &error); - if (error != NULL) { - g_warning ("Couldn't lock screen: %s", error->message); - g_error_free (error); + gchar **screen_locker_command; + + if ((screen_locker_command = gsm_get_screen_locker_command ()) != NULL) { + GError *error = NULL; + + g_spawn_async (NULL, screen_locker_command, NULL, + G_SPAWN_DEFAULT | G_SPAWN_SEARCH_PATH, + NULL, NULL, NULL, &error); + + if (error != NULL) { + g_warning ("Couldn't lock screen: %s", error->message); + g_error_free (error); + } + + } else { + g_warning ("Couldn't find any screen locker"); } + + g_strfreev (screen_locker_command); } static void @@ -268,7 +281,6 @@ _load_icon (GtkIconTheme *icon_theme, return retval; } - static GdkPixbuf * scale_pixbuf (GdkPixbuf *pixbuf, int max_width, @@ -296,8 +308,8 @@ scale_pixbuf (GdkPixbuf *pixbuf, /* always scale down, allow to disable scaling up */ if (scale_factor < 1.0 || !no_stretch_hint) { - int scale_x = (int) (pw * scale_factor); - int scale_y = (int) (ph * scale_factor); + int scale_x = (int) (scale_factor * (float) pw); + int scale_y = (int) (scale_factor * (float) ph); g_debug ("Scaling to %dx%d", scale_x, scale_y); return gdk_pixbuf_scale_simple (pixbuf, scale_x, @@ -721,7 +733,6 @@ gsm_inhibit_dialog_set_inhibitor_store (GsmInhibitDialog *dialog, g_object_unref (dialog->inhibitors); } - g_debug ("GsmInhibitDialog: setting store %p", store); dialog->inhibitors = store; |