Skip to content

Commit

Permalink
Port MATE Screensaver to GSettings
Browse files Browse the repository at this point in the history
  • Loading branch information
raveit committed Nov 3, 2012
1 parent ce7da34 commit 8d80642
Show file tree
Hide file tree
Showing 9 changed files with 433 additions and 862 deletions.
16 changes: 9 additions & 7 deletions configure.ac
Expand Up @@ -35,17 +35,21 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of default gettext

AM_GLIB_GNU_GETTEXT

dnl
dnl Enable gsettigns schema macros
dnl

GLIB_GSETTINGS

# Dependencies

DBUS_REQUIRED_VERSION=0.30
GLIB_REQUIRED_VERSION=2.15.0
MATECONF_REQUIRED_VERSION=1.1.0
GDK_REQUIRED_VERSION=2.14.0
GTK_REQUIRED_VERSION=2.11.5
X11_REQUIRED_VERSION=1.0
LIBMATE_MENU_REQUIRED_VERSION=1.1.0
MATE_DESKTOP_REQUIRED_VERSION=1.1.0

LIBMATEKBDUI_REQUIRED_VERSION=1.1.0

AC_CHECK_HEADERS(unistd.h)
Expand All @@ -60,22 +64,21 @@ PKG_CHECK_MODULES(MATE_SCREENSAVER,
x11 >= $X11_REQUIRED_VERSION
gtk+-2.0 >= $GTK_REQUIRED_VERSION
dbus-glib-1 >= $DBUS_REQUIRED_VERSION
mateconf-2.0 >= $MATECONF_REQUIRED_VERSION
gio-2.0 >= $GLIB_REQUIRED_VERSION
mate-desktop-2.0 >= $MATE_DESKTOP_REQUIRED_VERSION
libmate-menu >= $LIBMATE_MENU_REQUIRED_VERSION)
AC_SUBST(MATE_SCREENSAVER_CFLAGS)
AC_SUBST(MATE_SCREENSAVER_LIBS)

PKG_CHECK_MODULES(MATE_SCREENSAVER_DIALOG,
mateconf-2.0 >= $MATECONF_REQUIRED_VERSION
gio-2.0 >= $GLIB_REQUIRED_VERSION
gthread-2.0
gtk+-2.0 >= $GTK_REQUIRED_VERSION)
AC_SUBST(MATE_SCREENSAVER_DIALOG_CFLAGS)
AC_SUBST(MATE_SCREENSAVER_DIALOG_LIBS)

PKG_CHECK_MODULES(MATE_SCREENSAVER_CAPPLET,
gio-2.0 >= $GLIB_REQUIRED_VERSION
mateconf-2.0 >= $MATECONF_REQUIRED_VERSION
gtk+-2.0 >= $GTK_REQUIRED_VERSION
libmate-menu >= $LIBMATE_MENU_REQUIRED_VERSION)
AC_SUBST(MATE_SCREENSAVER_CAPPLET_CFLAGS)
Expand All @@ -93,9 +96,7 @@ ALL_X_LIBS="$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS"
SAVER_LIBS="$ALL_X_LIBS"

AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
AC_PATH_PROG(MATECONFTOOL, mateconftool-2)

AM_MATECONF_SOURCE_2

MATE_COMPILE_WARNINGS(yes)

Expand Down Expand Up @@ -1074,6 +1075,7 @@ data/Makefile
data/mate-screensavers.menu
data/mate-screensaver.pc
data/org.mate.ScreenSaver.service
data/org.mate.screensaver.gschema.xml
data/images/Makefile
data/images/cosmos/Makefile
savers/Makefile
Expand Down
34 changes: 13 additions & 21 deletions data/Makefile.am
Expand Up @@ -9,12 +9,6 @@ man_MANS = \
mate-screensaver-preferences.1 \
$(NULL)

@INTLTOOL_SCHEMAS_RULE@

schemasdir = @MATECONF_SCHEMA_FILE_DIR@
schemas_in_files = mate-screensaver.schemas.in
schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)

@INTLTOOL_DESKTOP_RULE@

desktopdir = $(datadir)/applications
Expand Down Expand Up @@ -46,8 +40,17 @@ pkgconfig_DATA = mate-screensaver.pc
dbussessionservicedir = $(DBUS_SESSION_SERVICE_DIR)
dbussessionservice_DATA = org.mate.ScreenSaver.service

@GSETTINGS_RULES@
@INTLTOOL_XML_NOMERGE_RULE@

gsettings_SCHEMAS = org.mate.screensaver.gschema.xml

migrationdir = $(datadir)/MateConf/gsettings
dist_migration_DATA = org.mate.screensaver.gschema.migrate


EXTRA_DIST = \
$(schemas_in_files) \
$(gsettings_SCHEMAS:.xml=.xml.in.in) \
$(desktop_in_files) \
$(directory_in_files) \
$(gtkbuilder_DATA) \
Expand All @@ -60,26 +63,15 @@ EXTRA_DIST = \
$(NULL)

DISTCLEANFILES = \
$(schemas_DATA) \
$(gsettings_SCHEMAS)
$(desktop_DATA) \
$(directory_DATA) \
$(NULL)

MAINTAINERCLEANFILES = \
*~ \
Makefile.in

if MATECONF_SCHEMAS_INSTALL
# don't do this if we are building in eg. rpm
install-data-local: $(schemas_DATA)
if test -z "$(DESTDIR)" ; then \
for p in $(schemas_DATA) ; do \
MATECONF_CONFIG_SOURCE=$(MATECONF_SCHEMA_CONFIG_SOURCE) $(MATECONFTOOL) --makefile-install-rule $(top_builddir)/data/$$p ; \
done \
fi
else
install-data-local:
endif
Makefile.in \
$(gsettings_SCHEMAS:.xml=.valid)

install-data-hook:
@system=`uname`; \
Expand Down
16 changes: 16 additions & 0 deletions data/org.mate.screensaver.gschema.migrate
@@ -0,0 +1,16 @@
[org.mate.screensaver]
idle-activation-enabled = /apps/mate-screensaver/idle_activation_enabled
lock-enabled = /apps/mate-screensaver/lock_enabled
mode = /apps/mate-screensaver/mode
themes = /apps/mate-screensaver/themes
idle-delay = /apps/mate-screensaver/idle_delay
power-management-delay = /apps/mate-screensaver/power_management_delay
cycle-delay = /apps/mate-screensaver/cycle_delay
lock-delay = /apps/mate-screensaver/lock_delay
embedded-keyboard-enabled = /apps/mate-screensaver/embedded_keyboard_enabled
embedded-keyboard-command = /apps/mate-screensaver/embedded_keyboard_command
logout-enabled = /apps/mate-screensaver/logout_enabled
logout-delay = /apps/mate-screensaver/logout_delay
logout-command = /apps/mate-screensaver/logout_command
user-switch-enabled = /apps/mate-screensaver/user_switch_enabled
status-message-enabled = /apps/mate-screensaver/status_message_enabled
85 changes: 85 additions & 0 deletions data/org.mate.screensaver.gschema.xml.in
@@ -0,0 +1,85 @@
<schemalist>
<enum id="org.mate.screensaver.Mode">
<value nick="blank-only" value="0"/>
<value nick="random" value="1"/>
<value nick="single" value="2"/>
</enum>
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org.mate.screensaver" path="/org/mate-screensaver/">
<key name="idle-activation-enabled" type="b">
<default>true</default>
<summary>Activate when idle</summary>
<description>Set this to TRUE to activate the screensaver when the session is idle.</description>
</key>
<key name="lock-enabled" type="b">
<default>true</default>
<summary>Lock on activation</summary>
<description>Set this to TRUE to lock the screen when the screensaver goes active.</description>
</key>
<key name="mode" enum="org.mate.screensaver.Mode">
<default>'blank-only'</default>
<summary>Screensaver theme selection mode</summary>
<description>The selection mode used by screensaver. May be "blank-only" to enable the screensaver without using any theme on activation, "single" to enable screensaver using only one theme on activation (specified in "themes" key), and "random" to enable the screensaver using a random theme on activation.</description>
</key>
<key name="themes" type="as">
<default>[]</default>
<summary>Screensaver themes</summary>
<description>This key specifies the list of themes to be used by the screensaver. It's ignored when "mode" key is "blank-only", should provide the theme name when "mode" is "single", and should provide a list of themes when "mode" is "random".</description>
</key>
<key name="idle-delay" type="i">
<default>10</default>
<summary>Time before session is considered idle</summary>
<description>The number of minutes of inactivity before the session is considered idle.</description>
</key>
<key name="power-management-delay" type="i">
<default>30</default>
<summary>Time before power management baseline</summary>
<description>The number of seconds of inactivity before signalling to power management. This key is set and maintained by the session power management agent.</description>
</key>
<key name="cycle-delay" type="i">
<default>10</default>
<summary>Time before theme change</summary>
<description>The number of minutes to run before changing the screensaver theme.</description>
</key>
<key name="lock-delay" type="i">
<default>0</default>
<summary>Time before locking</summary>
<description>The number of minutes after screensaver activation before locking the screen.</description>
</key>
<key name="embedded-keyboard-enabled" type="b">
<default>false</default>
<summary>Allow embedding a keyboard into the window</summary>
<description>Set this to TRUE to allow embedding a keyboard into the window when trying to unlock. The "keyboard_command" key must be set with the appropriate command.</description>
</key>
<key name="embedded-keyboard-command" type="s">
<default>''</default>
<summary>Embedded keyboard command</summary>
<description>The command that will be run, if the "embedded_keyboard_enabled" key is set to TRUE, to embed a keyboard widget into the window. This command should implement an XEMBED plug interface and output a window XID on the standard output.</description>
</key>
<key name="logout-enabled" type="b">
<default>false</default>
<summary>Allow logout</summary>
<description>Set this to TRUE to offer an option in the unlock dialog to allow logging out after a delay. The delay is specified in the "logout_delay" key.</description>
</key>
<key name="logout-delay" type="i">
<default>120</default>
<summary>Time before logout option</summary>
<description>The number of minutes after the screensaver activation before a logout option will appear in the unlock dialog. This key has effect only if the "logout_enable" key is set to TRUE.</description>
</key>
<key name="logout-command" type="s">
<default>''</default>
<summary>Logout command</summary>
<description>The command to invoke when the logout button is clicked. This command should simply log the user out without any interaction. This key has effect only if the "logout_enable" key is set to TRUE.</description>
</key>
<key name="user-switch-enabled" type="b">
<default>true</default>
<summary>Allow user switching</summary>
<description>Set this to TRUE to offer an option in the unlock dialog to switch to a different user account.</description>
</key>
<key name="status-message-enabled" type="b">
<default>true</default>
<summary>Allow the session status message to be displayed</summary>
<description>Allow the session status message to be displayed when the screen is locked.</description>
</key>
</schema>
</schemalist>

3 changes: 1 addition & 2 deletions po/POTFILES.in
Expand Up @@ -3,9 +3,8 @@
data/mate-screensaver-preferences.desktop.in
[type: gettext/glade]data/mate-screensaver-preferences.ui
data/mate-screensaver.directory.in
data/mate-screensaver.schemas.in
[type: gettext/glade]data/lock-dialog-default.ui
data/images/cosmos/cosmos.xml.in.in
data/org.gnome.screensaver.gschema.xml
savers/cosmos-slideshow.desktop.in.in
savers/footlogo-floaters.desktop.in.in
savers/personal-slideshow.desktop.in.in
Expand Down
12 changes: 7 additions & 5 deletions src/gs-lock-plug.c
Expand Up @@ -37,7 +37,7 @@
#include <gdk/gdkx.h>
#include <X11/XKBlib.h>
#include <gtk/gtk.h>
#include <mateconf/mateconf-client.h>
#include <gio/gio.h>

#ifdef WITH_KBD_LAYOUT_INDICATOR
#include <libmatekbd/matekbd-indicator.h>
Expand All @@ -51,6 +51,8 @@

#include "gs-debug.h"

#define GSETTINGS_SCHEMA "org.mate.ScreenSaver"

#define KEY_LOCK_DIALOG_THEME "/apps/mate-screensaver/lock_dialog_theme"

#define MDM_FLEXISERVER_COMMAND "mdmflexiserver"
Expand Down Expand Up @@ -1757,11 +1759,11 @@ static char *
get_dialog_theme_name (GSLockPlug *plug)
{
char *name;
MateConfClient *client;
GSettings *settings;

client = mateconf_client_get_default ();
name = mateconf_client_get_string (client, KEY_LOCK_DIALOG_THEME, NULL);
g_object_unref (client);
settings = g_settings_new (GSETTINGS_SCHEMA);
name = g_settings_get_string (settings, KEY_LOCK_DIALOG_THEME);
g_object_unref (settings);

return name;
}
Expand Down

0 comments on commit 8d80642

Please sign in to comment.