712 changes: 11 additions & 701 deletions configure.ac

Large diffs are not rendered by default.

53 changes: 4 additions & 49 deletions data/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,63 +1,18 @@
NULL =

man_MANS = \
cinnamon-screensaver.1 \
cinnamon-screensaver-command.1 \
$(NULL)

@INTLTOOL_XML_NOMERGE_RULE@

dbussessionservicedir = $(DBUS_SESSION_SERVICE_DIR)
dbussessionservice_DATA = org.cinnamon.ScreenSaver.service
dbussessionservice_DATA = org.cinnamon.ScreenSaver.service \
org.cinnamon.ScreenSaver.PAMHelper.service

SUBDIRS = screensavers

EXTRA_DIST = \
$(man_MANS) \
cinnamon-screensaver \
org.cinnamon.ScreenSaver.service.in\
$(NULL)

DISTCLEANFILES = \
$(desktop_DATA) \
org.cinnamon.ScreenSaver.service.in \
org.cinnamon.ScreenSaver.PAMHelper.service.in
$(NULL)

MAINTAINERCLEANFILES = \
*~ \
Makefile.in

install-data-hook:
@system=`uname`; \
if test -f /usr/include/security/pam_appl.h; then \
if test '!' -d $(DESTDIR)$(PAM_PREFIX)/pam.d; then \
$(mkinstalldirs) $(DESTDIR)$(PAM_PREFIX)/pam.d; \
chmod 755 $(DESTDIR)$(PAM_PREFIX)/pam.d; \
fi; \
if test $$system = Linux; then \
if test '!' -f $(DESTDIR)$(PAM_PREFIX)/pam.d/cinnamon-screensaver; then \
$(INSTALL_DATA) cinnamon-screensaver $(DESTDIR)$(PAM_PREFIX)/pam.d/cinnamon-screensaver; \
fi; \
if test "x$(PAM_PREFIX)" != "x/etc/pam.d"; then \
echo "***" ; \
echo "*** Warning: cinnamon-screensaver has been compiled with support for" ; \
echo "*** Pluggable Authentication Modules (PAM). However, you may need to" ; \
echo "*** manually install $(PAM_PREFIX)/pam.d/cinnamon-screensaver" ; \
echo "*** to /etc/pam.d/cinnamon-screensaver. Otherwise, unlocking might" ; \
echo "*** not work." ; \
echo "***" ; \
echo "*** Note: If you are using SuSE/Novell you may have to modify this file." ; \
echo "***" ; \
fi; \
fi; \
if test $$system = SunOS; then \
echo "***" ; \
echo "*** Warning: cinnamon-screensaver has been compiled with support for" ; \
echo "*** Pluggable Authentication Modules (PAM). However, you" ; \
echo "*** need to manually add authentication for cinnamon-screensaver in" ; \
echo "*** $(PAM_PREFIX)/pam.conf or /etc/pam.conf." ; \
echo "*** Otherwise, unlocking might not work." ; \
echo "***" ; \
fi; \
fi

-include $(top_srcdir)/git.mk
15 changes: 0 additions & 15 deletions data/cinnamon-screensaver

This file was deleted.

54 changes: 0 additions & 54 deletions data/cinnamon-screensaver-command.1

This file was deleted.

41 changes: 0 additions & 41 deletions data/cinnamon-screensaver.1

This file was deleted.

23 changes: 0 additions & 23 deletions data/cinnamon-screensaver.xml

This file was deleted.

23 changes: 0 additions & 23 deletions data/cinnamon-screensaver.xml.in

This file was deleted.

3 changes: 3 additions & 0 deletions data/org.cinnamon.ScreenSaver.PAMHelper.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[D-BUS Service]
Name=org.cinnamon.ScreenSaver.PAMHelper
Exec=@EXPANDED_BINDIR@/cinnamon-screensaver-pam-helper
13 changes: 0 additions & 13 deletions debian/README.Debian

This file was deleted.

6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
cinnamon-screensaver (3.1) UNRELEASED; urgency=medium

* Rewrite

-- Michael Webster <miketwebster@gmail.com> Sat, 09 Jul 2016 23:50:39 -0400

cinnamon-screensaver (3.0.1) sarah; urgency=medium

[ JosephMcc ]
Expand Down
1 change: 0 additions & 1 deletion debian/cinnamon-screensaver.docs

This file was deleted.

2 changes: 0 additions & 2 deletions debian/cinnamon-screensaver.pam

This file was deleted.

32 changes: 4 additions & 28 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,25 @@ Build-Depends: debhelper (>= 9),
dh-autoreconf,
dh-python,
gnome-common,
gnome-pkg-tools (>= 0.10),
libcinnamon-desktop-dev (>= 2.6.3),
libdbus-glib-1-dev (>= 0.78),
libglib2.0-dev (>= 2.37.3),
libgnomekbd-dev (>= 3.6.0),
libgtk-3-dev (>= 3.1.4),
libpam0g-dev,
libsystemd-login-dev [linux-any] | libsystemd-dev [linux-any],
libwebkit2gtk-3.0-dev,
libx11-dev,
libxext-dev,
libxklavier-dev,
libxss-dev,
libxxf86vm-dev,
x11proto-scrnsaver-dev,
x11proto-xext-dev,
x11proto-xf86vidmode-dev
gnome-pkg-tools (>= 0.10)
Standards-Version: 3.9.6

Package: cinnamon-screensaver
Architecture: any
Pre-Depends: ${misc:Pre-Depends}
Depends: cinnamon-desktop-data (>= 2.6.3),
Depends: cinnamon-desktop-data (>= 3.0.0),
dbus-x11,
gir1.2-webkit2-3.0,
gnome-icon-theme (>= 2.15.90),
python,
python3,
${misc:Depends},
${python:Depends},
${shlibs:Depends}
Recommends: cinnamon-common,
gnome-power-manager | xfce4-power-manager,
libpam-gnome-keyring,
Recommends: libpam-gnome-keyring,
xscreensaver-data,
xscreensaver-data-extra,
xscreensaver-gl,
xscreensaver-gl-extra
Description: Cinnamon screen saver and locker
cinnamon-screensaver is a screen saver and locker that aims to have simple,
sane and secure defaults, and be well integrated with the Cinnamon desktop.
.
It is designed to support, among other things:
.
* the ability to lock down configuration settings
* translation into other languages
* user switching
80 changes: 1 addition & 79 deletions debian/copyright
Original file line number Diff line number Diff line change
Expand Up @@ -4,83 +4,5 @@ Upstream-Contact: Linux Mint Project <root@linuxmint.com>
Source: https://github.com/linuxmint/cinnamon-screensaver.git

Files: *
Copyright: 2003, Bill Nottingham <notting@redhat.com>
1989-1991, Free Software Foundation, Inc
1991-2004, Jamie Zawinski <jwz@jwz.org>
2005-2006, Ray Strode <rstrode@redhat.com>
2008-2011, Red Hat, Inc
2010, Saleem Abdulrasool <compnerd@compnerd.org>
2004-2009, William Jon McCann <mccann@jhu.edu>
Copyright: 2016
License: GPL-2+

Files: COPYING.LIB
src/gnome-datetime-source.c
src/gnome-datetime-source.h
src/gnome-wall-clock.c
src/gnome-wall-clock.h
Copyright: 2008,2010,2011, Red Hat, Inc
License: LGPL-2+

Files: src/setuid.c
src/setuid.h
src/subprocs.c
src/subprocs.h
Copyright: 1993-2004 Jamie Zawinski <jwz@jwz.org>
2004 William Jon McCann <mccann@jhu.edu>
License: MIT/X11
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation. No representations are made about the suitability of this
software for any purpose. It is provided "as is" without express or
implied warranty.

Files: po/Makefile.in.in
Copyright: 2004-2008, Rodney Dawes <dobey.pwns@gmail.com>
1995-1997, Ulrich Drepper <drepper@gnu.ai.mit.edu>
License: Permissive
This file may be copied and used freely without restrictions. It may
be used in projects which are not available under a GNU Public License,
but which still want to provide support for the GNU gettext functionality.

Files: debian/*
Copyright: 2014, Maximiliano Curia <maxy@debian.org>
License: LGPL-2+

License: GPL-2+
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 Street - Suite 500, Boston, MA
02110-1335, USA.
.
On Debian systems, the complete text of the GNU General Public License
version 2 can be found in `/usr/share/common-licenses/GPL-2'.

License: LGPL-2+
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Library 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 Library General Public License for
more details.
.
You should have received a copy of the GNU Library General Public License
along with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street - Suite 500, Boston, MA 02110-1335, USA.
.
On Debian systems, the complete text of the GNU Library General Public License
version 2 can be found in `/usr/share/common-licenses/LGPL-2'.
15 changes: 5 additions & 10 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
#!/usr/bin/make -f

export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

%:
dh $@ --parallel --with=autoreconf,gnome

override_dh_gnome_clean:
dh_gnome_clean --no-control

override_dh_auto_configure:
dh_auto_configure -- \
--enable-locking \
--libexecdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)/cinnamon-screensaver
DEB_CONFIGURE_SCRIPT_ENV += PYTHON="/usr/bin/python3"

DEB_MAKE_EXTRA_ARGS += pythondir=/usr/share/cinnamon-screensaver

override_dh_install:
dh_install --list-missing
rm -rf debian/cinnamon-screensaver/usr/share/doc/cinnamon-screensaver-*
install/cinnamon-screensaver::
dh_python3 -p$(cdbs_curpkg)
2 changes: 1 addition & 1 deletion makepot
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
xgettext --language=C --from-code=UTF-8 --keyword=_ --output=cinnamon-screensaver.pot src/*.c
xgettext --language=Python --from-code=UTF-8 --keyword=_ --output=cinnamon-screensaver.pot src/*.py
11 changes: 5 additions & 6 deletions po/Makefile.in.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ exec_prefix = @exec_prefix@
datadir = @datadir@
datarootdir = @datarootdir@
libdir = @libdir@
DATADIRNAME = @DATADIRNAME@
itlocaledir = $(prefix)/$(DATADIRNAME)/locale
localedir = @localedir@
subdir = po
install_sh = @install_sh@
# Automake >= 1.8 provides @mkdir_p@.
Expand Down Expand Up @@ -80,7 +79,7 @@ INTLTOOL__v_MSGFMT_0 = @echo " MSGFMT" $@;

.po.pox:
$(MAKE) $(GETTEXT_PACKAGE).pot
$(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox
$(MSGMERGE) $* $(GETTEXT_PACKAGE).pot -o $*.pox

.po.mo:
$(INTLTOOL_V_MSGFMT)$(MSGFMT) -o $@ $<
Expand Down Expand Up @@ -108,7 +107,7 @@ install-data-no: all
install-data-yes: all
linguas="$(USE_LINGUAS)"; \
for lang in $$linguas; do \
dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \
dir=$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES; \
$(mkdir_p) $$dir; \
if test -r $$lang.gmo; then \
$(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
Expand Down Expand Up @@ -142,8 +141,8 @@ install-exec installcheck:
uninstall:
linguas="$(USE_LINGUAS)"; \
for lang in $$linguas; do \
rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \
done

check: all $(GETTEXT_PACKAGE).pot
Expand Down
10 changes: 2 additions & 8 deletions po/POTFILES.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
# List of source files containing translatable strings.
# Please keep this file sorted alphabetically.
src/cinnamon-screensaver-command.c
src/cinnamon-screensaver-dialog.c
src/cinnamon-screensaver.c
src/cinnamon-screensaver.desktop.in.in
src/gs-auth-pam.c
src/gs-listener-dbus.c
src/gs-lock-plug.c
src/gs-window-x11.c
src/clock.py
src/lock.py
289 changes: 62 additions & 227 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,237 +3,72 @@ AUTOMAKE_OPTIONS = 1.7

NULL =

saverdir = $(libexecdir)/cinnamon-screensaver

INCLUDES = \
-I. \
-I$(srcdir) \
$(CINNAMON_SCREENSAVER_CFLAGS) \
$(CINNAMON_SCREENSAVER_DIALOG_CFLAGS) \
$(CINNAMON_SCREENSAVER_CAPPLET_CFLAGS) \
$(DISABLE_DEPRECATED_CFLAGS) \
-DPREFIX=\""$(prefix)"\" \
-DBINDIR=\""$(bindir)"\" \
-DLIBDIR=\""$(libdir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DDATADIR=\""$(datadir)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-DSAVERDIR=\""$(saverdir)"\" \
-DGTKBUILDERDIR=\"$(pkgdatadir)\" \
-DPAM_SERVICE_NAME=\""cinnamon-screensaver"\" \
$(WARN_CFLAGS) \
$(AUTH_CFLAGS) \
$(DEBUG_CFLAGS) \
$(DBUS_CFLAGS) \
$(LIBGNOMEKBDUI_CFLAGS) \
$(LIBNOTIFY_CFLAGS) \
$(LOGIND_CFLAGS) \
$(NULL)

bin_PROGRAMS = \
cinnamon-screensaver \
cinnamon-screensaver-command \
$(NULL)

libexec_PROGRAMS = \
cinnamon-screensaver-dialog \
$(NULL)

noinst_PROGRAMS = \
test-fade \
test-passwd \
test-watcher \
test-window \
$(NULL)

desktopdir = $(datadir)/applications
desktop_in_files = cinnamon-screensaver.desktop.in
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
@INTLTOOL_DESKTOP_RULE@

cinnamon_screensaver_command_SOURCES = \
bus.h \
cinnamon-screensaver-command.c \
$(NULL)

cinnamon_screensaver_command_LDADD = \
$(CINNAMON_SCREENSAVER_COMMAND_LIBS) \
$(NULL)

AUTH_SOURCES = \
gs-auth-@AUTH_SCHEME@.c \
$(NULL)

test_fade_SOURCES = \
test-fade.c \
gs-fade.c \
gs-fade.h \
gs-debug.c \
gs-debug.h \
$(NULL)

test_fade_LDADD = \
$(CINNAMON_SCREENSAVER_LIBS) \
$(SAVER_LIBS) \
$(NULL)

test_passwd_SOURCES = \
test-passwd.c \
gs-auth.h \
$(AUTH_SOURCES) \
setuid.c \
setuid.h \
subprocs.c \
subprocs.h \
$(NULL)

test_passwd_LDADD = \
$(CINNAMON_SCREENSAVER_DIALOG_LIBS)\
$(AUTH_LIBS) \
$(NULL)

test_watcher_SOURCES = \
bus.h \
test-watcher.c \
gs-watcher.h \
gs-watcher-x11.c \
gs-marshal.c \
gs-marshal.h \
gs-debug.c \
gs-debug.h \
$(NULL)

test_watcher_LDADD = \
$(CINNAMON_SCREENSAVER_LIBS) \
$(SAVER_LIBS) \
$(NULL)

test_window_SOURCES = \
test-window.c \
gs-lock-socket.c \
gs-lock-socket.h \
gs-window.h \
gs-window-x11.c \
gs-grab-x11.c \
gs-grab.h \
gs-marshal.c \
gs-marshal.h \
gs-debug.c \
gs-debug.h \
subprocs.c \
subprocs.h \
$(NULL)

test_window_LDADD = \
$(CINNAMON_SCREENSAVER_LIBS) \
$(SAVER_LIBS) \
$(NULL)

cinnamon_screensaver_dialog_SOURCES = \
cinnamon-screensaver-dialog.c \
gs-lock-plug.c \
gs-lock-plug.h \
gs-debug.c \
gs-debug.h \
setuid.c \
setuid.h \
subprocs.c \
subprocs.h \
gs-auth.h \
$(AUTH_SOURCES) \
$(NULL)

cinnamon_screensaver_dialog_LDADD = \
$(CINNAMON_SCREENSAVER_DIALOG_LIBS)\
$(SAVER_LIBS) \
$(AUTH_LIBS) \
$(LIBGNOMEKBDUI_LIBS) \
$(LIBNOTIFY_LIBS) \
$(NULL)

BUILT_SOURCES = \
gs-marshal.c \
gs-marshal.h \
$(NULL)

gs-marshal.c: gs-marshal.list
echo "#include \"gs-marshal.h\"" > $@ && \
@GLIB_GENMARSHAL@ $< --prefix=gs_marshal --body >> $@

gs-marshal.h: gs-marshal.list
@GLIB_GENMARSHAL@ $< --prefix=gs_marshal --header > $@

cinnamon_screensaver_SOURCES = \
bus.h \
cinnamon-screensaver.c \
cinnamon-screensaver.h \
gs-monitor.c \
gs-monitor.h \
gs-watcher-x11.c \
gs-watcher.h \
gs-listener-dbus.c \
gs-listener-dbus.h \
gs-lock-socket.c \
gs-lock-socket.h \
gs-manager.c \
gs-manager.h \
gs-window-x11.c \
gs-window.h \
gs-prefs.c \
gs-prefs.h \
gs-debug.c \
gs-debug.h \
subprocs.c \
subprocs.h \
gs-grab-x11.c \
gs-grab.h \
gs-fade.c \
gs-fade.h \
gnome-datetime-source.c \
gnome-datetime-source.h \
gnome-wall-clock.c \
gnome-wall-clock.h \
$(BUILT_SOURCES) \
$(NULL)

cinnamon_screensaver_LDADD = \
$(CINNAMON_SCREENSAVER_LIBS) \
$(SAVER_LIBS) \
$(LOGIND_LIBS) \
$(NULL)

cinnamon_screensaver_LDFLAGS = -export-dynamic

EXTRA_DIST = \
debug-screensaver.sh \
gs-marshal.list \
cinnamon-screensaver.desktop.in \
$(NULL)

CLEANFILES = \
$(desktop_DATA) \
cinnamon-screensaver.desktop.in \
$(BUILT_SOURCES)

MAINTAINERCLEANFILES = \
*~ \
Makefile.in

install-exec-hook:
@if [ "x@NEED_SETUID@" = "xyes" ]; then \
echo "***" ; \
echo "*** Warning: cinnamon-screensaver has been compiled with support for" ; \
echo "*** bsdauth(3) and must be installed as a setuid root" ; \
echo "*** program in order for locking to work. To do this, you" ; \
echo "*** must run:" ; \
echo "***" ; \
echo "*** chown root $(DESTDIR)$(libexecdir)/cinnamon-screensaver-dialog" ; \
echo "*** chmod +s $(DESTDIR)$(libexecdir)/cinnamon-screensaver-dialog" ; \
echo "***" ; \
echo "*** For now, it will be installed non-setuid, which" ; \
echo "*** means that locking might not work." ; \
echo "***" ; \
fi
appdir = $(datadir)/cinnamon-screensaver

app_PYTHON = \
__init__.py \
authenticator.py \
baseWindow.py \
config.py \
clock.py \
constants.py \
lock.py \
manager.py \
overlay.py \
service.py \
trackers.py \
utils.py \
window.py

app_SCRIPTS = cinnamon-screensaver-main.py pam-helper-service.py

cinnamon-screensaver: cinnamon-screensaver.in
$(AM_V_GEN)sed \
-e s!\@datadir\@!$(datadir)! \
< $< > $@
cinnamon-screensaver: Makefile

cinnamon-screensaver-pam-helper: cinnamon-screensaver-pam-helper.in
$(AM_V_GEN)sed \
-e s!\@datadir\@!$(datadir)! \
< $< > $@
cinnamon-screensaver-pam-helper: Makefile

config.py: config.py.in
$(AM_V_GEN)sed \
-e s!\@prefix\@!$(prefix)! \
-e s!\@datadir\@!$(datadir)! \
-e s!\@pkgdatadir\@!$(pkgdatadir)! \
-e s!\@libexecdir\@!$(libexecdir)! \
-e s!\@libdir\@!$(libdir)! \
-e s!\@PACKAGE\@!$(PACKAGE)! \
-e s!\@VERSION\@!$(VERSION)! \
-e s!\@GETTEXT_PACKAGE\@!$(GETTEXT_PACKAGE)! \
< $< > $@
config.py: Makefile

all-local: config.py cinnamon-screensaver cinnamon-screensaver-pam-helper

bin_SCRIPTS = cinnamon-screensaver cinnamon-screensaver-pam-helper

EXTRA_DIST = \
debug-screensaver.sh \
cinnamon-screensaver.desktop.in \
config.py.in \
cinnamon-screensaver.in \
cinnamon-screensaver-pam-helper.in \
$(NULL)

CLEANFILES = \
cinnamon-screensaver.desktop.in

MAINTAINERCLEANFILES = \
*~ \
Makefile.in

-include $(top_srcdir)/git.mk
Empty file added src/__init__.py
Empty file.
95 changes: 95 additions & 0 deletions src/authenticator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#! /usr/bin/python3

import PAM

from gi.repository import Gio, GObject
import threading
import dbus
import constants as c

class PAMServiceProxy:
def __init__(self):
self.callback = None
self.proxy = None

try:
Gio.DBusProxy.new_for_bus(Gio.BusType.SESSION, Gio.DBusProxyFlags.NONE, None,
c.PAM_SERVICE, c.PAM_PATH, c.PAM_SERVICE,
None, self._onProxyReady, None)
except dbus.exceptions.DBusException as e:
print(e)
self.proxy = None

def _onProxyReady(self, object, result, data=None):
self.proxy = Gio.DBusProxy.new_for_bus_finish(result)

def check_password(self, username, password, callback):
self.callback = callback

if self.proxy:
thread = threading.Thread(target=self.check_password_thread, args=(username, password, callback))
thread.start()
else:
success, msg = self.check_password_fallback(username, password)
GObject.idle_add(self.idle_callback_and_clear, success, msg)

def check_password_thread(self, username, password, callback):
if self.proxy:
try:
success, msg = self.proxy.authenticate('(ss)', username, password)
except Exception as e:
print(str(e))
success, msg = self.check_password_fallback(username, password)
else:
success, msg = self.check_password_fallback(username, password)

GObject.idle_add(self.idle_callback_and_clear, success, msg)

def check_password_fallback(self, username, password):
print("PAM Helper service unavailable, using sync method")
success, msg = real_check_password(username, password)

return (success, msg)

def idle_callback_and_clear(self, success, msg):
self.callback(success, msg)
self.callback = None

return False

def real_check_password(username, password):
ret = None

pam_auth = PAM.pam()

pam_auth.start("cinnamon-screensaver")
pam_auth.set_item(PAM.PAM_USER, username)

def _pam_conv(auth, query_list, user_data = None):
resp = []
for i in range(len(query_list)):
query, qtype = query_list[i]
if qtype == PAM.PAM_PROMPT_ECHO_ON:
resp.append((username, 0))
elif qtype == PAM.PAM_PROMPT_ECHO_OFF:
resp.append((password, 0))
else:
return None
return resp

pam_auth.set_item(PAM.PAM_CONV, _pam_conv)

try:
pam_auth.authenticate()
pam_auth.acct_mgmt()
except PAM.error as res:
ret = (False, res.args[0])
except Exception as e:
log.warn("Error with PAM: %s" % str(e))
ret = (False, e)
else:
ret = (True, "")

return ret


42 changes: 42 additions & 0 deletions src/baseWindow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#! /usr/bin/python3

from gi.repository import Gtk, GObject
import trackers

class BaseWindow(Gtk.Revealer):
REVEALER_DURATION = 250

def __init__(self):
super(BaseWindow, self).__init__()

self.set_transition_type(Gtk.RevealerTransitionType.CROSSFADE)
self.set_transition_duration(self.REVEALER_DURATION)

def reveal(self):
GObject.idle_add(self.set_reveal_child, True)

def unreveal(self):
GObject.idle_add(self.set_reveal_child, False)

def blink(self):
self.set_reveal_child(False)
GObject.timeout_add(self.REVEALER_DURATION + 10, self._blink_callback)

def _blink_callback(self):
self.set_reveal_child(True)

return False

def destroy_window(self):
trackers.con_tracker_get().connect_after(self,
"notify::child-revealed",
self.destroy_after_hiding)

self.unreveal()

def destroy_after_hiding(self, pspec, data):
trackers.con_tracker_get().disconnect(self,
"notify::child-revealed",
self.destroy_after_hiding)

self.destroy()
63 changes: 0 additions & 63 deletions src/bus.h

This file was deleted.

401 changes: 0 additions & 401 deletions src/cinnamon-screensaver-command.c

This file was deleted.

589 changes: 0 additions & 589 deletions src/cinnamon-screensaver-dialog.c

This file was deleted.

50 changes: 50 additions & 0 deletions src/cinnamon-screensaver-main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#! /usr/bin/python3

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

import dbus
from dbus.mainloop.glib import DBusGMainLoop

import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)

import gettext
import os
import sys
import argparse

import config
from service import ScreensaverService

gettext.install("cinnamon-screensaver", "/usr/share/locale")

class Main:
def __init__(self):
parser = argparse.ArgumentParser(description='Cinnamon Screensaver')
parser.add_argument('--version', dest='version', action='store_true',
help='Display the current version')
parser.add_argument('--no-daemon', dest='no_daemon', action='store_true',
help="Don't become a daemon")
args = parser.parse_args()

if args.version:
print("cinnamon-screensaver %s" % (config.VERSION))
quit()

if args.no_daemon:
print("FIX ME no daemon")
quit()

service = ScreensaverService()
Gtk.main()


if __name__ == "__main__":
DBusGMainLoop(set_as_default=True)

main = Main()



3 changes: 3 additions & 0 deletions src/cinnamon-screensaver-pam-helper.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#! /bin/sh

exec @datadir@/cinnamon-screensaver/pam-helper-service.py "$@"
114 changes: 0 additions & 114 deletions src/cinnamon-screensaver.c

This file was deleted.

32 changes: 0 additions & 32 deletions src/cinnamon-screensaver.h

This file was deleted.

3 changes: 3 additions & 0 deletions src/cinnamon-screensaver.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#! /bin/sh

exec @datadir@/cinnamon-screensaver/cinnamon-screensaver-main.py "$@"
165 changes: 165 additions & 0 deletions src/clock.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
#! /usr/bin/python3

from gi.repository import CinnamonDesktop, GLib, Gtk, Gio, GObject
import utils
import random
from baseWindow import BaseWindow
import trackers

CLOCK_POSITIONING_TIMEOUT = 5
ALIGNMENTS = [int(Gtk.Align.START), int(Gtk.Align.END), int(Gtk.Align.CENTER)]

class ClockWidget(BaseWindow):
def __init__(self, away_message=None, initial_monitor=0):
super(ClockWidget, self).__init__()

self.set_halign(Gtk.Align.CENTER)
self.set_valign(Gtk.Align.CENTER)

self.set_margin_start(200)
self.set_margin_end(200)
self.set_margin_top(100)
self.set_margin_bottom(100)

self.current_monitor = initial_monitor

self.away_message = away_message

self.label = Gtk.Label()
self.label.show()
self.add(self.label)

self.clock_tracker = CinnamonDesktop.WallClock()
self.ss_settings = Gio.Settings("org.cinnamon.desktop.screensaver")
self.iface_settings = Gio.Settings("org.cinnamon.desktop.interface")

trackers.con_tracker_get().connect(self.clock_tracker,
"notify::clock",
self.on_clock_changed)
trackers.con_tracker_get().connect(self.ss_settings,
"changed",
self.on_settings_changed)
trackers.con_tracker_get().connect(self.iface_settings,
"changed",
self.on_settings_changed)

tz = Gio.File.new_for_path(path="/etc/localtime")
self.tz_monitor = tz.monitor_file(0, None)

trackers.con_tracker_get().connect(self.tz_monitor,
"changed",
self.on_tz_changed)

self.settings = utils.Settings()
self.fetch_settings()
self.update_clock()

def on_clock_changed(self, clock, pspec):
self.update_clock()

def on_settings_changed(self, settings, key):
self.update_clock()

def on_tz_changed(self, monitor, file, other, event):
self.update_clock()

def get_clock_string(self):
date_value = ""
time_value = ""

now = GLib.DateTime.new_now_local()

if not self.settings.use_custom_format:
if self.settings.show_date:
date_value = now.format(_("%A, %B %e"))
else:
date_value = ""

if self.settings.use_24h:
time_value = now.format("%H:%M").lstrip()
else:
time_value = now.format("%l:%M %p").lstrip()
else:
date_value = now.format(self.settings.custom_date)
time_value = now.format(self.settings.custom_time)

clock_string = ('<b><span font_desc=\"%s\" foreground=\"#FFFFFF\">%s</span></b>\n' +\
'<b><span font_desc=\"%s\" foreground=\"#FFFFFF\">%s</span></b>')\
% (self.settings.font_time, time_value, self.settings.font_date, date_value)

return clock_string

def update_clock(self):
default_message = GLib.markup_escape_text (self.settings.default_message, -1)
font_message = self.settings.font_message

if self.away_message and self.away_message != "":
user_name = utils.get_user_display_name()
markup = ('%s\n\n<b><span font_desc=\"Ubuntu 14\" foreground=\"#CCCCCC\">%s</span></b>' +\
'\n<b><span font_desc=\"Ubuntu 10\" foreground=\"#ACACAC\"> ~ %s</span></b>') %\
(self.get_clock_string(), self.away_message, user_name)
else:
markup = '%s\n\n<b><span font_desc=\"%s\" foreground=\"#CCCCCC\">%s</span></b>' %\
(self.get_clock_string(), font_message, default_message)

self.label.set_markup(markup)
self.label.set_line_wrap(True)
self.label.set_alignment(0.5, 0.5)

def fetch_settings(self):
self.settings.default_message = self.ss_settings.get_string("default-message")
self.settings.font_message = self.ss_settings.get_string("font-message")

self.settings.use_custom_format = self.ss_settings.get_boolean("use-custom-format")
self.settings.custom_time = self.ss_settings.get_string("time-format")
self.settings.custom_date = self.ss_settings.get_string("date-format")
self.settings.font_time = self.ss_settings.get_string("font-time")
self.settings.font_date = self.ss_settings.get_string("font-date")

self.settings.show_date = self.iface_settings.get_boolean("clock-show-date")
self.settings.use_24h = self.iface_settings.get_boolean("clock-use-24h")

def start_positioning(self):
trackers.timer_tracker_get().cancel("clock-positioning")
trackers.timer_tracker_get().start_seconds("clock-positioning",
CLOCK_POSITIONING_TIMEOUT,
self.positioning_callback)

def stop_positioning(self):
trackers.timer_tracker_get().cancel("clock-positioning")

def positioning_callback(self):
self.unreveal()
self.queue_draw()

trackers.timer_tracker_get().start("align-clock-timeout",
self.REVEALER_DURATION + 10,
self.align_clock)

return True

def align_clock(self):
current_halign = int(self.get_halign())
horizontal = current_halign

current_valign = int(self.get_valign())
vertical = current_valign

while horizontal == current_halign:
horizontal = ALIGNMENTS[random.randint(0, 2)]
while vertical == current_valign:
vertical = ALIGNMENTS[random.randint(0, 2)]

self.set_halign(Gtk.Align(horizontal))
self.set_valign(Gtk.Align(vertical))

self.queue_draw()

self.reveal()

trackers.timer_tracker_get().cancel("align-clock-timeout")

return False



9 changes: 9 additions & 0 deletions src/config.py.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
prefix="@prefix@"
datadir="@datadir@"
localedir=datadir+"/locale"
pkgdatadir="@pkgdatadir@"
libdir="@libdir@"
libexecdir="@libexecdir@"
PACKAGE="@PACKAGE@"
VERSION="@VERSION@"
GETTEXT_PACKAGE="@GETTEXT_PACKAGE@"
42 changes: 42 additions & 0 deletions src/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

# /* logind */
LOGIND_SERVICE = "org.freedesktop.login1"
LOGIND_PATH = "/org/freedesktop/login1"
LOGIND_INTERFACE = "org.freedesktop.login1.Manager"

LOGIND_SESSION_INTERFACE = "org.freedesktop.login1.Session"
LOGIND_SESSION_PATH = "/org/freedesktop/login1/session"

# /* ConsoleKit */
CK_SERVICE = "org.freedesktop.ConsoleKit"
CK_PATH = "/org/freedesktop/ConsoleKit"
CK_INTERFACE = "org.freedesktop.ConsoleKit"

CK_MANAGER_PATH = CK_PATH + "/Manager"
CK_MANAGER_INTERFACE = CK_INTERFACE + ".Manager"

CK_SESSION_PATH = CK_PATH + "/Session"
CK_SESSION_INTERFACE = CK_INTERFACE + ".Session"

# /* DBus */
DBUS_SERVICE = "org.freedesktop.DBus"
DBUS_PATH = "/org/freedesktop/DBus"
DBUS_INTERFACE = "org.freedesktop.DBus"

# /* Cinnamon Screensaver */
SS_SERVICE = "org.cinnamon.ScreenSaver"
SS_PATH = "/org/cinnamon/ScreenSaver"
SS_INTERFACE = "org.cinnamon.ScreenSaver"

# PAM Helper service
PAM_SERVICE = "org.cinnamon.ScreenSaver.PAMHelper"
PAM_PATH = "/org/cinnamon/ScreenSaver/PAMHelper"
PAM_INTERFACE = "org.cinnamon.ScreenSaver.PAMHelper"

# /* Gnome Session Manager */
GSM_SERVICE = "org.gnome.SessionManager"
GSM_PATH = "/org/gnome/SessionManager"
GSM_INTERFACE = "org.gnome.SessionManager"

GSM_PRESENCE_PATH = GSM_PATH + "/Presence"
GSM_PRESENCE_INTERFACE = GSM_INTERFACE + ".Presence"
58 changes: 58 additions & 0 deletions src/fullscreen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#! /usr/bin/python3

from gi.repository import Gtk, Gdk, GObject
import utils

# FullscreenWindow is just a dummy OR window that takes care of putting
# us in fullscreen mode for all monitors.

class FullscreenWindow(Gtk.Window):
def __init__(self, screen, index):
super(FullscreenWindow, self).__init__(type=Gtk.WindowType.POPUP,
decorated=False,
skip_taskbar_hint=True,
skip_pager_hint=True)

self.screen = screen
self.monitor_index = index

c = self.get_style_context()
c.remove_class("background")

self.update_geometry()

self.connect("realize", self.on_realized)
self.connect("map", self.on_mapped)

self.show()

self.set_opacity(.1)

def do_get_preferred_height(self):
if self.get_realized():
self.get_window().move(self.rect.x, self.rect.y)
return self.rect.height, self.rect.height
else:
return 0, 0

def do_get_preferred_width(self):
if self.get_realized():
self.get_window().move(self.rect.x, self.rect.y)
return self.rect.width, self.rect.width
else:
return 0, 0

def on_realized(self, widget):
self.get_window().move_resize(self.rect.x, self.rect.y, self.rect.width, self.rect.height)
utils.override_user_time(self.get_window())
self.fullscreen_on_monitor(self.screen, self.monitor_index)

def on_mapped(self, widget):
window = widget.get_window()
# window.fullscreen()
window.lower()

def update_geometry(self):
self.rect = rect = self.screen.get_monitor_geometry(self.monitor_index)
print(rect.x, rect.y, rect.width, rect.height)

285 changes: 0 additions & 285 deletions src/gnome-datetime-source.c

This file was deleted.

35 changes: 0 additions & 35 deletions src/gnome-datetime-source.h

This file was deleted.

266 changes: 0 additions & 266 deletions src/gnome-wall-clock.c

This file was deleted.

62 changes: 0 additions & 62 deletions src/gnome-wall-clock.h

This file was deleted.

774 changes: 0 additions & 774 deletions src/gs-auth-pam.c

This file was deleted.

65 changes: 0 additions & 65 deletions src/gs-auth.h

This file was deleted.

156 changes: 0 additions & 156 deletions src/gs-debug.c

This file was deleted.

71 changes: 0 additions & 71 deletions src/gs-debug.h

This file was deleted.

935 changes: 0 additions & 935 deletions src/gs-fade.c

This file was deleted.

77 changes: 0 additions & 77 deletions src/gs-fade.h

This file was deleted.

659 changes: 0 additions & 659 deletions src/gs-grab-x11.c

This file was deleted.

79 changes: 0 additions & 79 deletions src/gs-grab.h

This file was deleted.

1,542 changes: 0 additions & 1,542 deletions src/gs-listener-dbus.c

This file was deleted.

87 changes: 0 additions & 87 deletions src/gs-listener-dbus.h

This file was deleted.

Loading