summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am17
-rw-r--r--src/gs-auth-helper.c202
-rw-r--r--src/gs-auth-pam.c29
-rw-r--r--src/gs-auth-pam.h54
-rw-r--r--src/gs-auth-pwent.c1
-rw-r--r--src/gs-fade.c54
-rw-r--r--src/gs-grab-x11.c4
-rw-r--r--src/gs-listener-dbus.c22
-rw-r--r--src/gs-lock-plug.c10
-rw-r--r--src/gs-manager.c15
-rw-r--r--src/gs-prefs.c66
-rw-r--r--src/gs-theme-manager.c14
-rw-r--r--src/gs-watcher-x11.c15
-rw-r--r--src/gs-window-x11.c33
-rw-r--r--src/mate-screensaver-command.c2
-rw-r--r--src/mate-screensaver-dialog.c4
-rw-r--r--src/mate-screensaver-preferences.c252
-rw-r--r--src/mate-screensaver.c2
-rw-r--r--src/setuid.c2
-rw-r--r--src/subprocs.c2
-rw-r--r--src/test-passwd.c1
21 files changed, 406 insertions, 395 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index f26612b..df8280c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS = 1.7
NULL =
-saverdir = $(libexecdir)/mate-screensaver
+saverdir = $(pkglibexecdir)
themesdir = $(pkgdatadir)/themes
AM_CPPFLAGS = \
@@ -21,9 +21,11 @@ AM_CPPFLAGS = \
-DDATADIR=\""$(datadir)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DMATELOCALEDIR=\""$(datadir)/locale"\" \
+ -DPKGLIBEXECDIR=\""$(pkglibexecdir)"\" \
-DSAVERDIR=\""$(saverdir)"\" \
-DTHEMESDIR=\""$(themesdir)"\" \
-DGTKBUILDERDIR=\"$(pkgdatadir)\" \
+ -DMATE_SCREENSAVER_GL_HELPER_PATH=\""$(libexecdir)/mate-screensaver-gl-helper"\" \
-DPAM_SERVICE_NAME=\""mate-screensaver"\" \
$(WARN_CFLAGS) \
$(AUTH_CFLAGS) \
@@ -69,6 +71,7 @@ mate_screensaver_command_LDADD = \
AUTH_SOURCES = \
gs-auth.h \
+ gs-auth-pam.h \
gs-auth-@[email protected] \
$(NULL)
@@ -99,6 +102,11 @@ test_passwd_LDADD = \
$(AUTH_LIBS) \
$(NULL)
+if HAVE_PASSWD_HELPER
+test_passwd_LDADD += \
+ ../helper/libhelper-proto.a
+endif
+
test_watcher_SOURCES = \
test-watcher.c \
gs-watcher.h \
@@ -161,6 +169,13 @@ mate_screensaver_dialog_LDADD = \
$(LIBNOTIFY_LIBS) \
$(NULL)
+if HAVE_PASSWD_HELPER
+mate_screensaver_dialog_LDADD += \
+ ../helper/libhelper-proto.a
+../helper/libhelper-proto.a:
+ $(MAKE) -C ../helper
+endif
+
BUILT_SOURCES = \
gs-marshal.c \
gs-marshal.h \
diff --git a/src/gs-auth-helper.c b/src/gs-auth-helper.c
index acc6958..8396135 100644
--- a/src/gs-auth-helper.c
+++ b/src/gs-auth-helper.c
@@ -51,6 +51,9 @@
#include "gs-auth.h"
#include "subprocs.h"
+#include "../helper/helper_proto.h"
+#define MAXLEN 1024
+
static gboolean verbose_enabled = FALSE;
GQuark
@@ -79,85 +82,105 @@ gs_auth_get_verbose (void)
static gboolean
ext_run (const char *user,
- const char *typed_passwd,
- gboolean verbose)
+ GSAuthMessageFunc func,
+ gpointer data)
{
- int pfd[2], status;
- pid_t pid;
-
- if (pipe (pfd) < 0)
- {
- return 0;
- }
-
- if (verbose)
- {
- g_message ("ext_run (%s, %s)",
- PASSWD_HELPER_PROGRAM, user);
- }
-
- block_sigchld ();
-
- if ((pid = fork ()) < 0)
- {
- close (pfd [0]);
- close (pfd [1]);
- return FALSE;
- }
-
- if (pid == 0)
- {
- close (pfd [1]);
- if (pfd [0] != 0)
- {
- dup2 (pfd [0], 0);
- }
-
- /* Helper is invoked as helper service-name [user] */
- execlp (PASSWD_HELPER_PROGRAM, PASSWD_HELPER_PROGRAM, "mate-screensaver", user, NULL);
- if (verbose)
- {
- g_message ("%s: %s", PASSWD_HELPER_PROGRAM, g_strerror (errno));
- }
-
- exit (1);
- }
-
- close (pfd [0]);
-
- /* Write out password to helper process */
- if (!typed_passwd)
- {
- typed_passwd = "";
- }
- write (pfd [1], typed_passwd, strlen (typed_passwd));
- close (pfd [1]);
-
- while (waitpid (pid, &status, 0) < 0)
- {
- if (errno == EINTR)
- {
- continue;
- }
-
- if (verbose)
- {
- g_message ("ext_run: waitpid failed: %s\n",
- g_strerror (errno));
- }
-
- unblock_sigchld ();
- return FALSE;
- }
-
- unblock_sigchld ();
-
- if (! WIFEXITED (status) || WEXITSTATUS (status) != 0)
- {
- return FALSE;
- }
-
- return TRUE;
+ int pfd[2], r_pfd[2], status;
+ pid_t pid;
+ gboolean verbose = gs_auth_get_verbose ();
+
+ if (pipe (pfd) < 0 || pipe (r_pfd) < 0)
+ {
+ return FALSE;
+ }
+
+ if (verbose)
+ {
+ g_message ("ext_run (%s, %s)",
+ PASSWD_HELPER_PROGRAM, user);
+ }
+
+ block_sigchld ();
+
+ if ((pid = fork ()) < 0)
+ {
+ close (pfd [0]);
+ close (pfd [1]);
+ close (r_pfd [0]);
+ close (r_pfd [1]);
+ return FALSE;
+ }
+
+ if (pid == 0)
+ {
+ close (pfd [1]);
+ close (r_pfd [0]);
+ if (pfd [0] != 0)
+ {
+ dup2 (pfd [0], 0);
+ }
+ if (r_pfd [1] != 1)
+ {
+ dup2 (r_pfd [1], 1);
+ }
+
+ /* Helper is invoked as helper service-name [user] */
+ execlp (PASSWD_HELPER_PROGRAM, PASSWD_HELPER_PROGRAM, "mate-screensaver", user, NULL);
+ if (verbose)
+ {
+ g_message ("%s: %s", PASSWD_HELPER_PROGRAM, g_strerror (errno));
+ }
+
+ exit (1);
+ }
+
+ close (pfd [0]);
+ close (r_pfd [1]);
+
+ gboolean ret = FALSE;
+ while (waitpid (pid, &status, WNOHANG) == 0)
+ {
+ int msg_type;
+ char buf[MAXLEN];
+ size_t msg_len = MAXLEN;
+
+ msg_type = read_prompt (r_pfd [0], buf, &msg_len);
+ if (0 == msg_type) continue;
+ if (msg_type < 0)
+ {
+ g_message ("Error reading prompt (%d)", msg_type);
+ ret = FALSE;
+ goto exit;
+ }
+
+ char *input = NULL;
+ func (msg_type, buf, &input, data);
+
+ unsigned int input_len = input ? strlen (input) : 0;
+ ssize_t wt;
+
+ wt = write_msg (pfd [1], input, input_len);
+ if (wt < 0)
+ {
+ g_message ("Error writing prompt reply (%li)", wt);
+ ret = FALSE;
+ goto exit;
+ }
+ }
+
+ close (pfd [1]);
+ close (r_pfd [0]);
+ unblock_sigchld ();
+
+ if (! WIFEXITED (status) || WEXITSTATUS (status) != 0)
+ {
+ ret = FALSE;
+ }
+ else
+ ret = TRUE;
+
+ exit:
+ return ret;
}
gboolean
@@ -167,28 +190,7 @@ gs_auth_verify_user (const char *username,
gpointer data,
GError **error)
{
- gboolean res = FALSE;
- char *password;
-
- password = NULL;
-
- /* ask for the password for user */
- if (func != NULL)
- {
- func (GS_AUTH_MESSAGE_PROMPT_ECHO_OFF,
- "Password: ",
- &password,
- data);
- }
-
- if (password == NULL)
- {
- return FALSE;
- }
-
- res = ext_run (username, password, gs_auth_get_verbose ());
-
- return res;
+ return ext_run (username, func, data);
}
gboolean
diff --git a/src/gs-auth-pam.c b/src/gs-auth-pam.c
index bad98af..0420b9e 100644
--- a/src/gs-auth-pam.c
+++ b/src/gs-auth-pam.c
@@ -46,6 +46,7 @@
#include <gtk/gtk.h>
#include "gs-auth.h"
+#include "gs-auth-pam.h"
#include "subprocs.h"
@@ -64,7 +65,6 @@
# define PAM_NO_DELAY(pamh) /* */
#endif /* !HAVE_PAM_FAIL_DELAY */
-
/* On SunOS 5.6, and on Linux with PAM 0.64, pam_strerror() takes two args.
On some other Linux systems with some other version of PAM (e.g.,
whichever Debian release comes with a 2.2.5 kernel) it takes one arg.
@@ -126,33 +126,6 @@ gs_auth_get_verbose (void)
return verbose_enabled;
}
-static GSAuthMessageStyle
-pam_style_to_gs_style (int pam_style)
-{
- GSAuthMessageStyle style;
-
- switch (pam_style)
- {
- case PAM_PROMPT_ECHO_ON:
- style = GS_AUTH_MESSAGE_PROMPT_ECHO_ON;
- break;
- case PAM_PROMPT_ECHO_OFF:
- style = GS_AUTH_MESSAGE_PROMPT_ECHO_OFF;
- break;
- case PAM_ERROR_MSG:
- style = GS_AUTH_MESSAGE_ERROR_MSG;
- break;
- case PAM_TEXT_INFO:
- style = GS_AUTH_MESSAGE_TEXT_INFO;
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-
- return style;
-}
-
static gboolean
auth_message_handler (GSAuthMessageStyle style,
const char *msg,
diff --git a/src/gs-auth-pam.h b/src/gs-auth-pam.h
new file mode 100644
index 0000000..1d8a66f
--- /dev/null
+++ b/src/gs-auth-pam.h
@@ -0,0 +1,54 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (c) 2019 Paul Wolneykien <[email protected]>
+ *
+ * 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 the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ */
+
+#ifndef __GS_AUTH_PAM_H
+#define __GS_AUTH_PAM_H
+
+#include "gs-auth.h"
+
+G_BEGIN_DECLS
+
+static inline GSAuthMessageStyle
+pam_style_to_gs_style (int pam_style)
+{
+ GSAuthMessageStyle style;
+
+ switch (pam_style)
+ {
+ case PAM_PROMPT_ECHO_ON:
+ style = GS_AUTH_MESSAGE_PROMPT_ECHO_ON;
+ break;
+ case PAM_PROMPT_ECHO_OFF:
+ style = GS_AUTH_MESSAGE_PROMPT_ECHO_OFF;
+ break;
+ case PAM_ERROR_MSG:
+ style = GS_AUTH_MESSAGE_ERROR_MSG;
+ break;
+ default /* PAM_TEXT_INFO */:
+ style = GS_AUTH_MESSAGE_TEXT_INFO;
+ }
+
+ return style;
+}
+
+G_END_DECLS
+
+#endif /* __GS_AUTH_PAM_H */
diff --git a/src/gs-auth-pwent.c b/src/gs-auth-pwent.c
index b954caa..377e5cd 100644
--- a/src/gs-auth-pwent.c
+++ b/src/gs-auth-pwent.c
@@ -213,7 +213,6 @@ gs_auth_priv_init (void)
}
}
-
gboolean
gs_auth_init (void)
{
diff --git a/src/gs-fade.c b/src/gs-fade.c
index 960dbfa..5f162d3 100644
--- a/src/gs-fade.c
+++ b/src/gs-fade.c
@@ -48,7 +48,6 @@
/* XFree86 4.x+ Gamma fading */
-
#ifdef HAVE_XF86VMODE_GAMMA
#include <X11/extensions/xf86vmode.h>
@@ -225,9 +224,9 @@ xf86_whack_gamma (int screen,
for (i = 0; i < gamma_info->size; i++)
{
- r[i] = gamma_info->r[i] * ratio;
- g[i] = gamma_info->g[i] * ratio;
- b[i] = gamma_info->b[i] * ratio;
+ r[i] = (unsigned short) (ratio * (float) gamma_info->r[i]);
+ g[i] = (unsigned short) (ratio * (float) gamma_info->g[i]);
+ b[i] = (unsigned short) (ratio * (float) gamma_info->b[i]);
}
status = XF86VidModeSetGammaRamp (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), screen, gamma_info->size, r, g, b);
@@ -257,7 +256,6 @@ xf86_whack_gamma (int screen,
# define XF86_VIDMODE_GAMMA_RAMP_MIN_MAJOR 2
# define XF86_VIDMODE_GAMMA_RAMP_MIN_MINOR 1
-
gboolean
gs_fade_get_enabled (GSFade *fade)
{
@@ -274,7 +272,7 @@ gs_fade_set_enabled (GSFade *fade,
if (fade->priv->enabled != enabled)
{
- fade->priv->enabled = enabled;
+ fade->priv->enabled = (enabled != FALSE);
}
}
@@ -307,7 +305,6 @@ gamma_fade_setup (GSFade *fade)
{
/* have ramps */
-
res = XF86VidModeGetGammaRampSize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
GDK_SCREEN_XNUMBER (gdk_screen_get_default ()),
&screen_priv->info->size);
@@ -549,9 +546,9 @@ static void xrandr_crtc_whack_gamma (MateRRCrtc *crtc,
for (i = 0; i < gamma_info->size; i++)
{
- r[i] = gamma_info->r[i] * ratio;
- g[i] = gamma_info->g[i] * ratio;
- b[i] = gamma_info->b[i] * ratio;
+ r[i] = (unsigned short) (ratio * (float) gamma_info->r[i]);
+ g[i] = (unsigned short) (ratio * (float) gamma_info->g[i]);
+ b[i] = (unsigned short) (ratio * (float) gamma_info->b[i]);
}
mate_rr_crtc_set_gamma (crtc, gamma_info->size,
@@ -655,7 +652,7 @@ gs_fade_out_iter (GSFade *fade)
static gboolean
gs_fade_stop (GSFade *fade)
{
- if (fade->priv->timer_id > 0)
+ if (fade->priv->timer_id != 0)
{
g_source_remove (fade->priv->timer_id);
fade->priv->timer_id = 0;
@@ -722,41 +719,28 @@ static void
gs_fade_start (GSFade *fade,
guint timeout)
{
- guint steps_per_sec = 60;
- guint msecs_per_step;
- gboolean active_fade, res;
-
g_return_if_fail (GS_IS_FADE (fade));
- if (fade->priv->screen_priv.fade_type != FADE_TYPE_NONE)
- {
- res = fade->priv->screen_priv.fade_setup (fade);
- if (res == FALSE)
- return;
- }
+ if ((fade->priv->screen_priv.fade_type != FADE_TYPE_NONE) &&
+ (fade->priv->screen_priv.fade_setup (fade) == FALSE))
+ return;
- if (fade->priv->timer_id > 0)
- {
+ if (fade->priv->timer_id != 0)
gs_fade_stop (fade);
- }
fade->priv->active = TRUE;
-
gs_fade_set_timeout (fade, timeout);
- active_fade = FALSE;
if (fade->priv->screen_priv.fade_type != FADE_TYPE_NONE)
- active_fade = TRUE;
-
- if (active_fade)
{
- guint num_steps;
-
- num_steps = (fade->priv->timeout / 1000.0) * steps_per_sec;
- msecs_per_step = 1000 / steps_per_sec;
- fade->priv->alpha_per_iter = 1.0 / (gdouble)num_steps;
+ double steps_per_sec = 60.0;
+ double msecs_per_step = 1000.0 / steps_per_sec;
+ double num_steps = ((double) fade->priv->timeout) / msecs_per_step;
- fade->priv->timer_id = g_timeout_add (msecs_per_step, (GSourceFunc)fade_out_timer, fade);
+ fade->priv->alpha_per_iter = 1.0 / num_steps;
+ fade->priv->timer_id = g_timeout_add ((guint) msecs_per_step,
+ (GSourceFunc) fade_out_timer,
+ fade);
}
else
{
diff --git a/src/gs-grab-x11.c b/src/gs-grab-x11.c
index cef6b15..733a01f 100644
--- a/src/gs-grab-x11.c
+++ b/src/gs-grab-x11.c
@@ -149,8 +149,8 @@ gs_grab_get (GSGrab *grab,
(gpointer *) &grab->priv->grab_window);
grab->priv->grab_display = display;
- grab->priv->no_pointer_grab = no_pointer_grab;
- grab->priv->hide_cursor = hide_cursor;
+ grab->priv->no_pointer_grab = (no_pointer_grab != FALSE);
+ grab->priv->hide_cursor = (hide_cursor != FALSE);
}
g_object_unref (G_OBJECT (cursor));
diff --git a/src/gs-listener-dbus.c b/src/gs-listener-dbus.c
index 21aa898..520926d 100644
--- a/src/gs-listener-dbus.c
+++ b/src/gs-listener-dbus.c
@@ -106,7 +106,7 @@ typedef struct
char *connection;
guint32 cookie;
guint32 foreign_cookie;
- GTimeVal since;
+ gint64 since;
} GSListenerRefEntry;
enum
@@ -363,7 +363,7 @@ gs_listener_set_throttle (GSListener *listener,
{
gs_debug ("Changing throttle status: %d", throttled);
- listener->priv->throttled = throttled;
+ listener->priv->throttled = (throttled != FALSE);
g_signal_emit (listener, signals [THROTTLE_CHANGED], 0, throttled);
}
@@ -390,7 +390,7 @@ static gboolean
listener_set_session_idle_internal (GSListener *listener,
gboolean idle)
{
- listener->priv->session_idle = idle;
+ listener->priv->session_idle = (idle != FALSE);
if (idle)
{
@@ -408,7 +408,7 @@ static gboolean
listener_set_active_internal (GSListener *listener,
gboolean active)
{
- listener->priv->active = active;
+ listener->priv->active = (active != FALSE);
/* if idle not in sync with active, change it */
if (listener->priv->session_idle != active)
@@ -496,7 +496,7 @@ gs_listener_set_session_idle (GSListener *listener,
}
}
- listener->priv->session_idle = idle;
+ listener->priv->session_idle = (idle != FALSE);
res = listener_check_activation (listener);
/* if activation fails then don't set idle */
@@ -541,7 +541,7 @@ gs_listener_set_activation_enabled (GSListener *listener,
if (listener->priv->activation_enabled != enabled)
{
- listener->priv->activation_enabled = enabled;
+ listener->priv->activation_enabled = (enabled != FALSE);
}
}
@@ -830,10 +830,12 @@ accumulate_ref_entry (gpointer key,
GSListenerRefEntry *entry,
DBusMessageIter *iter)
{
+ GDateTime *dt;
char *description;
char *time;
- time = g_time_val_to_iso8601 (&entry->since);
+ dt = g_date_time_new_from_unix_utc (entry->since);
+ time = g_date_time_format_iso8601 (dt);
description = g_strdup_printf ("Application=\"%s\"; Since=\"%s\"; Reason=\"%s\";",
entry->application,
@@ -844,6 +846,7 @@ accumulate_ref_entry (gpointer key,
g_free (description);
g_free (time);
+ g_date_time_unref (dt);
}
static DBusHandlerResult
@@ -906,7 +909,7 @@ listener_add_ck_ref_entry (GSListener *listener,
entry->cookie = listener_generate_unique_key (listener, entry_type);
entry->application = g_strdup ("ConsoleKit");
entry->reason = g_strdup ("Session is not active");
- g_get_current_time (&entry->since);
+ entry->since = g_get_real_time () / G_USEC_PER_SEC;
/* takes ownership of entry */
listener_add_ref_entry (listener, entry_type, entry);
@@ -973,7 +976,7 @@ listener_dbus_add_ref_entry (GSListener *listener,
entry->cookie = listener_generate_unique_key (listener, entry_type);
entry->application = g_strdup (application);
entry->reason = g_strdup (reason);
- g_get_current_time (&entry->since);
+ entry->since = g_get_real_time () / G_USEC_PER_SEC;
listener_add_ref_entry (listener, entry_type, entry);
@@ -2208,7 +2211,6 @@ gs_listener_class_init (GSListenerClass *klass)
G_PARAM_READWRITE));
}
-
static gboolean
screensaver_is_running (DBusConnection *connection)
{
diff --git a/src/gs-lock-plug.c b/src/gs-lock-plug.c
index 5e09f9c..bcb6a86 100644
--- a/src/gs-lock-plug.c
+++ b/src/gs-lock-plug.c
@@ -62,7 +62,6 @@
#define KEY_LOCK_DIALOG_T_FMT "lock-dialog-time-format"
#define KEY_LOCK_DIALOG_D_FMT "lock-dialog-date-format"
-
#define MDM_FLEXISERVER_COMMAND "mdmflexiserver"
#define MDM_FLEXISERVER_ARGS "--startnew Standard"
@@ -137,7 +136,6 @@ struct _ResponseData
gint response_id;
};
-
enum
{
RESPONSE,
@@ -456,7 +454,6 @@ dialog_timed_out (gpointer user_data)
return FALSE;
}
-
static void
capslock_update (GSLockPlug *plug,
gboolean is_on)
@@ -687,7 +684,6 @@ gs_lock_plug_run (GSLockPlug *plug)
return ri.response_id;
}
-
static cairo_surface_t *
surface_from_pixbuf (GdkPixbuf *pixbuf)
{
@@ -872,7 +868,6 @@ frame_pixbuf (GdkPixbuf *source)
h);
rowstride = gdk_pixbuf_get_rowstride (dest);
-
data = g_new0 (guint8, h * rowstride);
surface = cairo_image_surface_create_for_data (data,
@@ -1056,7 +1051,6 @@ gs_lock_plug_show (GtkWidget *widget)
gs_profile_end ("parent");
-
if (plug->priv->auth_face_image)
{
set_face_image (plug);
@@ -1729,8 +1723,8 @@ expand_string (const char *text)
GString *str;
const char *p;
char *username;
- int i;
- int n_chars;
+ glong i;
+ glong n_chars;
struct utsname name;
str = g_string_sized_new (strlen (text));
diff --git a/src/gs-manager.c b/src/gs-manager.c
index 8b67846..96b54fb 100644
--- a/src/gs-manager.c
+++ b/src/gs-manager.c
@@ -267,7 +267,6 @@ manager_select_theme_for_job (GSManager *manager,
gs_job_set_command (job, command);
-
if (info != NULL)
{
gs_theme_info_unref (info);
@@ -419,7 +418,7 @@ gs_manager_set_throttled (GSManager *manager,
{
GSList *l;
- manager->priv->throttled = throttled;
+ manager->priv->throttled = (throttled != FALSE);
if (! manager->priv->dialog_up)
{
@@ -463,7 +462,7 @@ gs_manager_set_lock_active (GSManager *manager,
{
GSList *l;
- manager->priv->lock_active = lock_active;
+ manager->priv->lock_active = (lock_active != FALSE);
for (l = manager->priv->windows; l; l = l->next)
{
gs_window_set_lock_enabled (l->data, lock_active);
@@ -496,7 +495,7 @@ gs_manager_set_lock_enabled (GSManager *manager,
if (manager->priv->lock_enabled != lock_enabled)
{
- manager->priv->lock_enabled = lock_enabled;
+ manager->priv->lock_enabled = (lock_enabled != FALSE);
}
}
@@ -510,7 +509,7 @@ gs_manager_set_logout_enabled (GSManager *manager,
{
GSList *l;
- manager->priv->logout_enabled = logout_enabled;
+ manager->priv->logout_enabled = (logout_enabled != FALSE);
for (l = manager->priv->windows; l; l = l->next)
{
gs_window_set_logout_enabled (l->data, logout_enabled);
@@ -528,7 +527,7 @@ gs_manager_set_keyboard_enabled (GSManager *manager,
{
GSList *l;
- manager->priv->keyboard_enabled = enabled;
+ manager->priv->keyboard_enabled = (enabled != FALSE);
for (l = manager->priv->windows; l; l = l->next)
{
gs_window_set_keyboard_enabled (l->data, enabled);
@@ -546,7 +545,7 @@ gs_manager_set_user_switch_enabled (GSManager *manager,
{
GSList *l;
- manager->priv->user_switch_enabled = user_switch_enabled;
+ manager->priv->user_switch_enabled = (user_switch_enabled != FALSE);
for (l = manager->priv->windows; l; l = l->next)
{
gs_window_set_user_switch_enabled (l->data, user_switch_enabled);
@@ -1075,7 +1074,6 @@ remove_unfade_idle (GSManager *manager)
}
}
-
static gboolean
window_deactivated_idle (gpointer data)
{
@@ -1230,7 +1228,6 @@ unfade_idle (GSManager *manager)
return FALSE;
}
-
static void
add_unfade_idle (GSManager *manager)
{
diff --git a/src/gs-prefs.c b/src/gs-prefs.c
index 2599223..0d2bea0 100644
--- a/src/gs-prefs.c
+++ b/src/gs-prefs.c
@@ -56,6 +56,15 @@ static void gs_prefs_finalize (GObject *object);
#define KEY_KEYBOARD_COMMAND "embedded-keyboard-command"
#define KEY_STATUS_MESSAGE_ENABLED "status-message-enabled"
+#define _gs_prefs_set_idle_activation_enabled(x,y) ((x)->idle_activation_enabled = ((y) != FALSE))
+#define _gs_prefs_set_lock_enabled(x,y) ((x)->lock_enabled = ((y) != FALSE))
+#define _gs_prefs_set_lock_disabled(x,y) ((x)->lock_disabled = ((y) != FALSE))
+#define _gs_prefs_set_user_switch_disabled(x,y) ((x)->user_switch_disabled = ((y) != FALSE))
+#define _gs_prefs_set_keyboard_enabled(x,y) ((x)->keyboard_enabled = ((y) != FALSE))
+#define _gs_prefs_set_status_message_enabled(x,y) ((x)->status_message_enabled = ((y) != FALSE))
+#define _gs_prefs_set_logout_enabled(x,y) ((x)->logout_enabled = ((y) != FALSE))
+#define _gs_prefs_set_user_switch_enabled(x,y) ((x)->user_switch_enabled = ((y) != FALSE))
+
struct GSPrefsPrivate
{
GSettings *settings;
@@ -115,7 +124,6 @@ gs_prefs_class_init (GSPrefsClass *klass)
object_class->get_property = gs_prefs_get_property;
object_class->set_property = gs_prefs_set_property;
-
signals [CHANGED] =
g_signal_new ("changed",
G_TYPE_FROM_CLASS (object_class),
@@ -213,41 +221,6 @@ _gs_prefs_set_themes (GSPrefs *prefs,
}
static void
-_gs_prefs_set_idle_activation_enabled (GSPrefs *prefs,
- gboolean value)
-{
- prefs->idle_activation_enabled = value;
-}
-
-static void
-_gs_prefs_set_lock_enabled (GSPrefs *prefs,
- gboolean value)
-{
- prefs->lock_enabled = value;
-}
-
-static void
-_gs_prefs_set_lock_disabled (GSPrefs *prefs,
- gboolean value)
-{
- prefs->lock_disabled = value;
-}
-
-static void
-_gs_prefs_set_user_switch_disabled (GSPrefs *prefs,
- gboolean value)
-{
- prefs->user_switch_disabled = value;
-}
-
-static void
-_gs_prefs_set_keyboard_enabled (GSPrefs *prefs,
- gboolean value)
-{
- prefs->keyboard_enabled = value;
-}
-
-static void
_gs_prefs_set_keyboard_command (GSPrefs *prefs,
const char *value)
{
@@ -263,20 +236,6 @@ _gs_prefs_set_keyboard_command (GSPrefs *prefs,
}
static void
-_gs_prefs_set_status_message_enabled (GSPrefs *prefs,
- gboolean enabled)
-{
- prefs->status_message_enabled = enabled;
-}
-
-static void
-_gs_prefs_set_logout_enabled (GSPrefs *prefs,
- gboolean value)
-{
- prefs->logout_enabled = value;
-}
-
-static void
_gs_prefs_set_logout_command (GSPrefs *prefs,
const char *value)
{
@@ -307,13 +266,6 @@ _gs_prefs_set_logout_timeout (GSPrefs *prefs,
}
static void
-_gs_prefs_set_user_switch_enabled (GSPrefs *prefs,
- gboolean value)
-{
- prefs->user_switch_enabled = value;
-}
-
-static void
gs_prefs_load_from_settings (GSPrefs *prefs)
{
glong value;
diff --git a/src/gs-theme-manager.c b/src/gs-theme-manager.c
index 6033563..da622a9 100644
--- a/src/gs-theme-manager.c
+++ b/src/gs-theme-manager.c
@@ -393,11 +393,25 @@ get_themes_tree (void)
}
static void
+on_applications_changed (MateMenuTree *menu_tree)
+{
+ GError *error = NULL;
+
+ if (!matemenu_tree_load_sync (menu_tree, &error)) {
+ g_debug ("Load matemenu tree got error: %s\n", error->message);
+ g_error_free (error);
+ }
+}
+
+static void
gs_theme_manager_init (GSThemeManager *theme_manager)
{
theme_manager->priv = gs_theme_manager_get_instance_private (theme_manager);
theme_manager->priv->menu_tree = get_themes_tree ();
+ g_signal_connect (theme_manager->priv->menu_tree, "changed",
+ G_CALLBACK (on_applications_changed),
+ NULL);
}
static void
diff --git a/src/gs-watcher-x11.c b/src/gs-watcher-x11.c
index 418d15c..f3f44e1 100644
--- a/src/gs-watcher-x11.c
+++ b/src/gs-watcher-x11.c
@@ -89,11 +89,11 @@ remove_watchdog_timer (GSWatcher *watcher)
static void
add_watchdog_timer (GSWatcher *watcher,
- glong timeout)
+ guint timeout)
{
watcher->priv->watchdog_timer_id = g_timeout_add (timeout,
- (GSourceFunc)watchdog_timer,
- watcher);
+ (GSourceFunc)watchdog_timer,
+ watcher);
}
static void
@@ -203,7 +203,7 @@ _gs_watcher_set_session_idle_notice (GSWatcher *watcher,
{
gs_debug ("Changing idle notice state: %d", in_effect);
- watcher->priv->idle_notice = in_effect;
+ watcher->priv->idle_notice = (in_effect != FALSE);
}
else
{
@@ -230,7 +230,7 @@ _gs_watcher_set_session_idle (GSWatcher *watcher,
{
gs_debug ("Changing idle state: %d", is_idle);
- watcher->priv->idle = is_idle;
+ watcher->priv->idle = (is_idle != FALSE);
}
else
{
@@ -269,7 +269,7 @@ _gs_watcher_set_active_internal (GSWatcher *watcher,
/* reset state */
_gs_watcher_reset_state (watcher);
- watcher->priv->active = active;
+ watcher->priv->active = (active != FALSE);
}
return TRUE;
@@ -309,7 +309,7 @@ gs_watcher_set_enabled (GSWatcher *watcher,
{
gboolean is_active = gs_watcher_get_active (watcher);
- watcher->priv->enabled = enabled;
+ watcher->priv->enabled = (enabled != FALSE);
/* if we are disabling the watcher and we are
active shut it down */
@@ -642,7 +642,6 @@ disable_builtin_screensaver (GSWatcher *watcher,
}
}
-
/* This timer goes off every few minutes, whether the user is idle or not,
to try and clean up anything that has gone wrong.
diff --git a/src/gs-window-x11.c b/src/gs-window-x11.c
index 218a37e..7d6c530 100644
--- a/src/gs-window-x11.c
+++ b/src/gs-window-x11.c
@@ -56,6 +56,7 @@ enum
#define MAX_QUEUED_EVENTS 16
#define INFO_BAR_SECONDS 30
+#define MATE_SCREENSAVER_DIALOG_PATH LIBEXECDIR "/mate-screensaver-dialog"
struct GSWindowPrivate
{
@@ -506,7 +507,6 @@ static GdkVisual *
get_best_visual_for_display (GdkDisplay *display)
{
GdkScreen *screen;
- char *command;
char *std_output;
int exit_status;
GError *error;
@@ -518,19 +518,18 @@ get_best_visual_for_display (GdkDisplay *display)
visual = NULL;
screen = gdk_display_get_default_screen (display);
- command = g_build_filename (LIBEXECDIR, "mate-screensaver-gl-helper", NULL);
-
error = NULL;
std_output = NULL;
res = spawn_command_line_on_display_sync (display,
- command,
+ MATE_SCREENSAVER_GL_HELPER_PATH,
&std_output,
NULL,
&exit_status,
&error);
if (! res)
{
- gs_debug ("Could not run command '%s': %s", command, error->message);
+ gs_debug ("Could not run command '%s': %s",
+ MATE_SCREENSAVER_GL_HELPER_PATH, error->message);
g_error_free (error);
goto out;
}
@@ -551,7 +550,6 @@ get_best_visual_for_display (GdkDisplay *display)
}
out:
g_free (std_output);
- g_free (command);
return g_object_ref (visual);
}
@@ -617,11 +615,11 @@ remove_watchdog_timer (GSWindow *window)
static void
add_watchdog_timer (GSWindow *window,
- glong timeout)
+ guint timeout)
{
window->priv->watchdog_timer_id = g_timeout_add (timeout,
- (GSourceFunc)watchdog_timer,
- window);
+ (GSourceFunc)watchdog_timer,
+ window);
}
static void
@@ -1535,7 +1533,7 @@ window_set_dialog_up (GSWindow *window,
return;
}
- window->priv->dialog_up = dialog_up;
+ window->priv->dialog_up = (dialog_up != FALSE);
g_object_notify (G_OBJECT (window), "dialog-up");
}
@@ -1697,14 +1695,11 @@ static void
popup_dialog (GSWindow *window)
{
gboolean result;
- char *tmp;
GString *command;
gs_debug ("Popping up dialog");
- tmp = g_build_filename (LIBEXECDIR, "mate-screensaver-dialog", NULL);
- command = g_string_new (tmp);
- g_free (tmp);
+ command = g_string_new (MATE_SCREENSAVER_DIALOG_PATH);
if (is_logout_enabled (window))
{
@@ -1819,7 +1814,7 @@ gs_window_set_lock_enabled (GSWindow *window,
return;
}
- window->priv->lock_enabled = lock_enabled;
+ window->priv->lock_enabled = (lock_enabled != FALSE);
g_object_notify (G_OBJECT (window), "lock-enabled");
}
@@ -1837,7 +1832,7 @@ gs_window_set_keyboard_enabled (GSWindow *window,
{
g_return_if_fail (GS_IS_WINDOW (window));
- window->priv->keyboard_enabled = enabled;
+ window->priv->keyboard_enabled = (enabled != FALSE);
}
void
@@ -1864,7 +1859,7 @@ gs_window_set_logout_enabled (GSWindow *window,
{
g_return_if_fail (GS_IS_WINDOW (window));
- window->priv->logout_enabled = logout_enabled;
+ window->priv->logout_enabled = (logout_enabled != FALSE);
}
void
@@ -1873,7 +1868,7 @@ gs_window_set_user_switch_enabled (GSWindow *window,
{
g_return_if_fail (GS_IS_WINDOW (window));
- window->priv->user_switch_enabled = user_switch_enabled;
+ window->priv->user_switch_enabled = (user_switch_enabled != FALSE);
}
void
@@ -2283,7 +2278,7 @@ window_set_obscured (GSWindow *window,
return;
}
- window->priv->obscured = obscured;
+ window->priv->obscured = (obscured != FALSE);
g_object_notify (G_OBJECT (window), "obscured");
}
diff --git a/src/mate-screensaver-command.c b/src/mate-screensaver-command.c
index af78d89..a233ebe 100644
--- a/src/mate-screensaver-command.c
+++ b/src/mate-screensaver-command.c
@@ -108,7 +108,7 @@ static GOptionEntry entries [] =
"version", 'V', 0, G_OPTION_ARG_NONE, &do_version,
N_("Version of this application"), NULL
},
- { NULL }
+ { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
};
static GMainLoop *loop = NULL;
diff --git a/src/mate-screensaver-dialog.c b/src/mate-screensaver-dialog.c
index d1dc21c..567d094 100644
--- a/src/mate-screensaver-dialog.c
+++ b/src/mate-screensaver-dialog.c
@@ -62,7 +62,7 @@ static GOptionEntry entries[] = {
{"enable-switch", 0, 0, G_OPTION_ARG_NONE, &enable_switch, N_("Show the switch user button"), NULL},
{"status-message", 0, 0, G_OPTION_ARG_STRING, &status_message, N_("Message to show in the dialog"), N_("MESSAGE")},
{"away-message", 0, 0, G_OPTION_ARG_STRING, &away_message, N_("Not used"), N_("MESSAGE")},
- {NULL}
+ {NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL}
};
static char* get_id_string(GtkWidget* widget)
@@ -421,7 +421,6 @@ static gboolean popup_dialog_idle(gpointer data)
return FALSE;
}
-
/*
* Copyright (c) 1991-2004 Jamie Zawinski <[email protected]>
* Copyright (c) 2005 William Jon McCann <[email protected]>
@@ -466,7 +465,6 @@ privileged_initialization (int* argc, char** argv)
return ret;
}
-
/*
* Copyright (c) 1991-2004 Jamie Zawinski <[email protected]>
* Copyright (c) 2005 William Jon McCann <[email protected]>
diff --git a/src/mate-screensaver-preferences.c b/src/mate-screensaver-preferences.c
index 3c7621a..1bcdcaf 100644
--- a/src/mate-screensaver-preferences.c
+++ b/src/mate-screensaver-preferences.c
@@ -93,10 +93,10 @@ static GSettings *session_settings = NULL;
static GSettings *lockdown_settings = NULL;
static MateDesktopThumbnailFactory *thumb_factory = NULL;
-static gint32
+static gdouble
config_get_activate_delay (gboolean *is_writable)
{
- gint32 delay;
+ gint delay;
if (is_writable)
{
@@ -104,14 +104,12 @@ config_get_activate_delay (gboolean *is_writable)
KEY_IDLE_DELAY);
}
- delay = g_settings_get_int (session_settings, KEY_IDLE_DELAY);
-
- if (delay < 1)
+ if ((delay = g_settings_get_int (session_settings, KEY_IDLE_DELAY)) < 1)
{
- delay = 1;
+ return 1.0;
}
- return delay;
+ return (gdouble) delay;
}
static void
@@ -120,6 +118,31 @@ config_set_activate_delay (gint32 timeout)
g_settings_set_int (session_settings, KEY_IDLE_DELAY, timeout);
}
+static gdouble
+config_get_lock_delay (gboolean *is_writable)
+{
+ gint delay;
+
+ if (is_writable)
+ {
+ *is_writable = g_settings_is_writable (screensaver_settings,
+ KEY_LOCK_DELAY);
+ }
+
+ if ((delay = g_settings_get_int (screensaver_settings, KEY_LOCK_DELAY)) < 1)
+ {
+ return 0.0;
+ }
+
+ return (gdouble) delay;
+}
+
+static void
+config_set_lock_delay (gint32 timeout)
+{
+ g_settings_set_int (screensaver_settings, KEY_LOCK_DELAY, timeout);
+}
+
static int
config_get_mode (gboolean *is_writable)
{
@@ -578,6 +601,16 @@ activate_delay_value_changed_cb (GtkRange *range,
config_set_activate_delay ((gint32)value);
}
+static void
+lock_delay_value_changed_cb (GtkRange *range,
+ gpointer user_data)
+{
+ gdouble value;
+
+ value = gtk_range_get_value (range);
+ config_set_lock_delay ((gint32)value);
+}
+
static int
compare_theme_names (char *name_a,
char *name_b,
@@ -663,19 +696,20 @@ separator_func (GtkTreeModel *model,
GtkTreeIter *iter,
gpointer data)
{
- int column = GPOINTER_TO_INT (data);
- char *text;
+ int column = GPOINTER_TO_INT (data);
+ gboolean res = FALSE;
+ char *text;
gtk_tree_model_get (model, iter, column, &text, -1);
if (text != NULL && strcmp (text, "__separator") == 0)
{
- return TRUE;
+ res = TRUE;
}
g_free (text);
- return FALSE;
+ return res;
}
static void
@@ -721,7 +755,7 @@ setup_treeview (GtkWidget *tree,
select = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
gtk_tree_selection_set_mode (select, GTK_SELECTION_SINGLE);
- g_signal_connect (G_OBJECT (select), "changed",
+ g_signal_connect (select, "changed",
G_CALLBACK (tree_selection_changed_cb),
preview);
@@ -934,10 +968,8 @@ drag_data_received_cb (GtkWidget *widget,
static char *
time_to_string_text (long time)
{
- char *secs, *mins, *hours, *string;
- int sec, min, hour;
-
- int n, inc_len, len_minutes;
+ char *secs, *mins, *hours, *string;
+ int sec, min, hour;
sec = time % 60;
time = time - sec;
@@ -954,60 +986,17 @@ time_to_string_text (long time)
secs = g_strdup_printf (ngettext ("%d second",
"%d seconds", sec), sec);
- inc_len = strlen (g_strdup_printf (_("%s %s"),
- g_strdup_printf (ngettext ("%d hour",
- "%d hours", 1), 1),
- g_strdup_printf (ngettext ("%d minute",
- "%d minutes", 59), 59))) - 1;
-
- len_minutes = 0;
-
- for (n = 2; n < 60; n++)
- {
- if (n < 10)
- {
- if ((strlen (g_str_to_ascii (g_strdup_printf (ngettext ("%d minute",
- "%d minutes", n), n), NULL)) - 2) > len_minutes)
-
- len_minutes = strlen (g_str_to_ascii (g_strdup_printf (ngettext ("%d minute",
- "%d minutes", n), n), NULL)) - 2;
- }
- else
- {
- if ((strlen (g_str_to_ascii (g_strdup_printf (ngettext ("%d minute",
- "%d minutes", n), n), NULL)) - 3) > len_minutes)
-
- len_minutes = strlen (g_str_to_ascii (g_strdup_printf (ngettext ("%d minute",
- "%d minutes", n), n), NULL)) - 3;
- }
- }
-
- if ((strlen (g_str_to_ascii (g_strdup_printf (ngettext ("%d minute",
- "%d minutes", 1), 1), NULL)) - 2) > len_minutes)
-
- len_minutes = strlen (g_str_to_ascii (g_strdup_printf (ngettext ("%d minute",
- "%d minutes", 1), 1), NULL)) - 2;
-
- if (len_minutes < 1)
- len_minutes = 1;
-
if (hour > 0)
{
if (sec > 0)
- {
/* hour:minutes:seconds */
string = g_strdup_printf (_("%s %s %s"), hours, mins, secs);
- }
else if (min > 0)
- {
/* hour:minutes */
string = g_strdup_printf (_("%s %s"), hours, mins);
- }
else
- {
/* hour */
string = g_strdup_printf (_("%s"), hours);
- }
}
else if (min > 0)
{
@@ -1020,36 +1009,6 @@ time_to_string_text (long time)
{
/* minutes */
string = g_strdup_printf (_("%s"), mins);
-
- if (min < 10)
- {
- if (min == 1)
- while (strlen (string) != (len_minutes + inc_len + 3))
- {
- if (strlen (string) % 2 == 0)
- string = g_strconcat (string, " ", NULL);
- else
- string = g_strconcat (" " , string, NULL);
- }
- else
- while (strlen (string) != (len_minutes + inc_len))
- {
- if (strlen (string) % 2 == 0)
- string = g_strconcat (string, " ", NULL);
- else
- string = g_strconcat (" " , string, NULL);
- }
- }
- else
- {
- while (strlen (string) != (len_minutes + inc_len - 1))
- {
- if (strlen (string) % 2 == 0)
- string = g_strconcat (string, " ", NULL);
- else
- string = g_strconcat (" " , string, NULL);
- }
- }
}
}
else
@@ -1069,10 +1028,70 @@ static char *
format_value_callback_time (GtkScale *scale,
gdouble value)
{
+ gchar *time_str, *big_time_str;
+ GtkAdjustment *adj;
+ gdouble lower, range, delta;
+ gint pad_size;
+
+ /* get the value representation as a string */
if (value == 0)
- return g_strdup_printf (_("Never"));
+ time_str = g_strdup (_("Never"));
+ else
+ time_str = time_to_string_text ((long) (value * 60.0));
+
+ /* Now, adjust the string so the representation for the bounds are the
+ * longest ones, and try and adjust the length as smoothly as possible.
+ * The issue here is that GTK is using the lower and upper value
+ * representations to compute the largest expected value's bounding box,
+ * so those need to be bigger than anything else we might represent,
+ * otherwise layout gets messed up (wraps and overflows). To achieve this,
+ * we pad the values near each bound so its length is at least the same as
+ * the biggest actual value. We cannot really do anything perfect here
+ * because what matters is the pango layout size for the largest value, but
+ * we don't have access to enough information to create one matching what
+ * GTK will actually use, and even so it'd be trial-and-error until the
+ * layout is big enough. So the silly assumptions below are probably good
+ * enough. */
+ adj = gtk_range_get_adjustment (GTK_RANGE (scale));
+ lower = gtk_adjustment_get_lower (adj);
+ range = gtk_adjustment_get_upper (adj) - lower;
+ delta = range / 2 - (value - lower);
+ /* the largest (character-wise) time string we expect */
+ big_time_str = time_to_string_text (7199 /* 1:59:59 */);
+ pad_size = ((g_utf8_strlen (big_time_str, -1) * (ABS (delta) / range)) -
+ g_utf8_strlen (time_str, -1));
+ g_free (big_time_str);
+ if (pad_size > 0)
+ {
+ /* pad string with EM SPACE (U+2003) */
+ GString *padded = g_string_new (NULL);
+
+ /* adjust pad side in RTL locales that aren't actually translated, as
+ * a properly translated one would have text drawn RTL already */
+ if (gtk_widget_get_direction (GTK_WIDGET (scale)) == GTK_TEXT_DIR_RTL)
+ {
+ const gchar *msg_plural = "%d minutes";
+ if (ngettext ("%d minute", msg_plural, 2) == msg_plural)
+ delta *= -1;
+ }
- return time_to_string_text (value * 60.0);
+ if (delta < 0)
+ {
+ for (gint i = 0; i < pad_size; i++)
+ g_string_append_unichar (padded, 0x2003);
+ g_string_append (padded, time_str);
+ }
+ else
+ {
+ g_string_append (padded, time_str);
+ for (gint i = 0; i < pad_size; i++)
+ g_string_append_unichar (padded, 0x2003);
+ }
+ g_free (time_str);
+ time_str = g_string_free (padded, FALSE);
+ }
+
+ return time_str;
}
static void
@@ -1090,7 +1109,11 @@ enabled_checkbox_toggled (GtkToggleButton *button, gpointer user_data)
static void
picture_filename_changed (GtkFileChooserButton *button, gpointer user_data)
{
- g_settings_set_string (screensaver_settings, "picture-filename", gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (button)));
+ char *picture_filename;
+
+ picture_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (button));
+ g_settings_set_string (screensaver_settings, "picture-filename", picture_filename);
+ g_free (picture_filename);
}
static void
@@ -1150,11 +1173,11 @@ ui_set_enabled (gboolean enabled)
}
static void
-ui_set_delay (int delay)
+ui_set_delay (const char *name, gdouble delay)
{
GtkWidget *widget;
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "activate_delay_hscale"));
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, name));
gtk_range_set_value (GTK_RANGE (widget), delay);
}
@@ -1197,8 +1220,14 @@ key_changed_cb (GSettings *settings, const gchar *key, gpointer data)
int delay;
delay = g_settings_get_int (settings, key);
- ui_set_delay (delay);
+ ui_set_delay ("activate_delay_hscale", (gdouble) delay);
+ }
+ else if (strcmp (key, KEY_LOCK_DELAY) == 0)
+ {
+ int delay;
+ delay = g_settings_get_int (settings, key);
+ ui_set_delay ("lock_delay_hscale", (gdouble) delay);
}
else
{
@@ -1420,12 +1449,10 @@ spawn_command_line_on_display_sync (GdkDisplay *display,
return retval;
}
-
static GdkVisual *
get_best_visual_for_display (GdkDisplay *display)
{
GdkScreen *screen;
- char *command;
char *std_output;
int exit_status;
GError *error;
@@ -1437,19 +1464,18 @@ get_best_visual_for_display (GdkDisplay *display)
visual = NULL;
screen = gdk_display_get_default_screen (display);
- command = g_build_filename (LIBEXECDIR, "mate-screensaver-gl-helper", NULL);
-
error = NULL;
std_output = NULL;
res = spawn_command_line_on_display_sync (display,
- command,
+ MATE_SCREENSAVER_GL_HELPER_PATH,
&std_output,
NULL,
&exit_status,
&error);
if (! res)
{
- gs_debug ("Could not run command '%s': %s", command, error->message);
+ gs_debug ("Could not run command '%s': %s",
+ MATE_SCREENSAVER_GL_HELPER_PATH, error->message);
g_error_free (error);
goto out;
}
@@ -1470,12 +1496,10 @@ get_best_visual_for_display (GdkDisplay *display)
}
out:
g_free (std_output);
- g_free (command);
return visual;
}
-
static void
widget_set_best_visual (GtkWidget *widget)
{
@@ -1599,7 +1623,7 @@ init_capplet (void)
GtkWidget *treeview;
GtkWidget *list_scroller;
GtkWidget *activate_delay_hscale;
- GtkWidget *activate_delay_hbox;
+ GtkWidget *lock_delay_hscale;
GtkWidget *label;
GtkWidget *enabled_checkbox;
GtkWidget *lock_checkbox;
@@ -1648,7 +1672,7 @@ init_capplet (void)
treeview = GTK_WIDGET (gtk_builder_get_object (builder, "savers_treeview"));
list_scroller = GTK_WIDGET (gtk_builder_get_object (builder, "themes_scrolled_window"));
activate_delay_hscale = GTK_WIDGET (gtk_builder_get_object (builder, "activate_delay_hscale"));
- activate_delay_hbox = GTK_WIDGET (gtk_builder_get_object (builder, "activate_delay_hbox"));
+ lock_delay_hscale = GTK_WIDGET (gtk_builder_get_object (builder, "lock_delay_hscale"));
enabled_checkbox = GTK_WIDGET (gtk_builder_get_object (builder, "enable_checkbox"));
lock_checkbox = GTK_WIDGET (gtk_builder_get_object (builder, "lock_checkbox"));
root_warning_label = GTK_WIDGET (gtk_builder_get_object (builder, "root_warning_label"));
@@ -1663,6 +1687,8 @@ init_capplet (void)
label = GTK_WIDGET (gtk_builder_get_object (builder, "activate_delay_label"));
gtk_label_set_mnemonic_widget (GTK_LABEL (label), activate_delay_hscale);
+ label = GTK_WIDGET (gtk_builder_get_object (builder, "lock_delay_label"));
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), lock_delay_hscale);
label = GTK_WIDGET (gtk_builder_get_object (builder, "savers_label"));
gtk_label_set_mnemonic_widget (GTK_LABEL (label), treeview);
@@ -1694,14 +1720,23 @@ init_capplet (void)
NULL);
activate_delay = config_get_activate_delay (&is_writable);
- ui_set_delay (activate_delay);
+ ui_set_delay ("activate_delay_hscale", activate_delay);
if (! is_writable)
{
- gtk_widget_set_sensitive (activate_delay_hbox, FALSE);
+ gtk_widget_set_sensitive (activate_delay_hscale, FALSE);
}
g_signal_connect (activate_delay_hscale, "format-value",
G_CALLBACK (format_value_callback_time), NULL);
+ activate_delay = config_get_lock_delay (&is_writable);
+ ui_set_delay ("lock_delay_hscale", activate_delay);
+ if (! is_writable)
+ {
+ gtk_widget_set_sensitive (lock_delay_hscale, FALSE);
+ }
+ g_signal_connect (lock_delay_hscale, "format-value",
+ G_CALLBACK (format_value_callback_time), NULL);
+
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lock_checkbox), config_get_lock (&is_writable));
if (! is_writable)
{
@@ -1773,6 +1808,9 @@ init_capplet (void)
g_signal_connect (activate_delay_hscale, "value-changed",
G_CALLBACK (activate_delay_value_changed_cb), NULL);
+ g_signal_connect (lock_delay_hscale, "value-changed",
+ G_CALLBACK (lock_delay_value_changed_cb), NULL);
+
g_signal_connect (dialog, "response",
G_CALLBACK (response_cb), NULL);
diff --git a/src/mate-screensaver.c b/src/mate-screensaver.c
index 926dd68..e2f8b3a 100644
--- a/src/mate-screensaver.c
+++ b/src/mate-screensaver.c
@@ -56,7 +56,7 @@ int main(int argc, char **argv)
{"version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Version of this application"), NULL},
{"no-daemon", 0, 0, G_OPTION_ARG_NONE, &no_daemon, N_("Don't become a daemon"), NULL},
{"debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL},
- {NULL}
+ {NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL}
};
#ifdef ENABLE_NLS
diff --git a/src/setuid.c b/src/setuid.c
index b40e750..5784230 100644
--- a/src/setuid.c
+++ b/src/setuid.c
@@ -156,7 +156,6 @@ set_ids_by_number (uid_t uid,
return FALSE;
}
-
/* If we've been run as setuid or setgid to someone else (most likely root)
turn off the extra permissions so that random user-specified programs
don't get special privileges. (On some systems it is necessary to install
@@ -229,7 +228,6 @@ hack_uid (char **nolock_reason,
}
}
-
/* Locking can't work when running as root, because we have no way of
knowing what the user id of the logged in user is (so we don't know
whose password to prompt for.)
diff --git a/src/subprocs.c b/src/subprocs.c
index 344f311..969375c 100644
--- a/src/subprocs.c
+++ b/src/subprocs.c
@@ -51,7 +51,6 @@
*/
static int block_sigchld_handler = 0;
-
#ifdef HAVE_SIGACTION
sigset_t
#else /* !HAVE_SIGACTION */
@@ -157,7 +156,6 @@ await_dying_children (int pid,
}
}
-
#else /* VMS */
static void await_dying_children (saver_info *si)
{
diff --git a/src/test-passwd.c b/src/test-passwd.c
index a4313ad..debfb21 100644
--- a/src/test-passwd.c
+++ b/src/test-passwd.c
@@ -73,7 +73,6 @@ privileged_initialization (void)
return ret;
}
-
/* Figure out what locking mechanisms are supported.
*/
static gboolean