new package: cinnamon-settings-daemon (close #2205)

With tiny changes from @vcunat.
This commit is contained in:
Roelof Wobben 2014-04-13 11:19:02 +02:00 committed by Vladimír Čunát
parent 6989b9a3f9
commit 0096bb677a
6 changed files with 5798 additions and 1 deletions

View File

@ -0,0 +1,448 @@
diff -Naur cinnamon-settings-daemon-2.0.1.orig/data/org.cinnamon.settings-daemon.plugins.gschema.xml.in.in cinnamon-settings-daemon-2.0.1/data/org.cinnamon.settings-daemon.plugins.gschema.xml.in.in
--- cinnamon-settings-daemon-2.0.6.orig/data/org.cinnamon.settings-daemon.plugins.gschema.xml.in.in 2013-11-03 10:50:04.000000000 -0500
+++ cinnamon-settings-daemon-2.0.6/data/org.cinnamon.settings-daemon.plugins.gschema.xml.in.in 2013-11-05 15:33:21.112912392 -0500
@@ -2,6 +2,7 @@
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org.cinnamon.settings-daemon.plugins" path="/org/cinnamon/settings-daemon/plugins/">
<child name="a11y-keyboard" schema="org.cinnamon.settings-daemon.plugins.a11y-keyboard"/>
<child name="a11y-settings" schema="org.cinnamon.settings-daemon.plugins.a11y-settings"/>
+ <child name="automount" schema="org.cinnamon.settings-daemon.plugins.automount"/>
<child name="clipboard" schema="org.cinnamon.settings-daemon.plugins.clipboard"/>
<child name="color" schema="org.cinnamon.settings-daemon.plugins.color"/>
<child name="cursor" schema="org.cinnamon.settings-daemon.plugins.cursor"/>
@@ -42,6 +43,18 @@
<_summary>Priority to use for this plugin</_summary>
<_description>Priority to use for this plugin in cinnamon-settings-daemon startup queue</_description>
</key>
+ </schema>
+ <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.cinnamon.settings-daemon.plugins.automount" path="/org/cinnamon/settings-daemon/plugins/automount/">
+ <key name="active" type="b">
+ <default>true</default>
+ <_summary>Activation of this plugin</_summary>
+ <_description>Whether this plugin would be activated by cinnamon-settings-daemon or not</_description>
+ </key>
+ <key name="priority" type="i">
+ <default>97</default>
+ <_summary>Priority to use for this plugin</_summary>
+ <_description>Priority to use for this plugin in cinnamon-settings-daemon startup queue</_description>
+ </key>
</schema>
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org.cinnamon.settings-daemon.plugins.clipboard" path="/org/cinnamon/settings-daemon/plugins/clipboard/">
<key name="active" type="b">
diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/automount.cinnamon-settings-plugin.in cinnamon-settings-daemon-2.0.1/plugins/automount/automount.cinnamon-settings-plugin.in
--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/automount.cinnamon-settings-plugin.in 1970-01-01 01:00:00.000000000 +0100
+++ cinnamon-settings-daemon-2.0.1/plugins/automount/automount.cinnamon-settings-plugin.in 2013-10-08 22:35:10.771472456 +0200
@@ -0,0 +1,8 @@
+[Cinnamon Settings Plugin]
+Module=automount
+IAge=0
+_Name=Automount
+_Description=Automounter plugin
+Authors=Tomas Bzatek
+Copyright=Copyright © 2010 Red Hat, Inc.
+Website=
diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/cinnamon-fallback-mount-helper.c cinnamon-settings-daemon-2.0.1/plugins/automount/cinnamon-fallback-mount-helper.c
--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/cinnamon-fallback-mount-helper.c 2013-10-02 16:13:56.000000000 +0200
+++ cinnamon-settings-daemon-2.0.1/plugins/automount/cinnamon-fallback-mount-helper.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,65 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2010 Red Hat, Inc.
- *
- * 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
- *
- * Author: Tomas Bzatek <tbzatek@redhat.com>
- */
-
-#include "config.h"
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <unistd.h>
-#include <gtk/gtk.h>
-
-#include "csd-automount-manager.h"
-
-int
-main (int argc,
- char **argv)
-{
- GMainLoop *loop;
- CsdAutomountManager *manager;
- GError *error = NULL;
-
- g_type_init ();
- gtk_init (&argc, &argv);
-
- bindtextdomain (GETTEXT_PACKAGE, CINNAMON_SETTINGS_LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
- loop = g_main_loop_new (NULL, FALSE);
- manager = csd_automount_manager_new ();
-
- csd_automount_manager_start (manager, &error);
-
- if (error != NULL) {
- g_printerr ("Unable to start the mount manager: %s",
- error->message);
-
- g_error_free (error);
- _exit (1);
- }
-
- g_main_loop_run (loop);
-
- csd_automount_manager_stop (manager);
- g_main_loop_unref (loop);
-
- return 0;
-}
diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/cinnamon-fallback-mount-helper.desktop.in.in cinnamon-settings-daemon-2.0.1/plugins/automount/cinnamon-fallback-mount-helper.desktop.in.in
--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/cinnamon-fallback-mount-helper.desktop.in.in 2013-10-02 16:13:56.000000000 +0200
+++ cinnamon-settings-daemon-2.0.1/plugins/automount/cinnamon-fallback-mount-helper.desktop.in.in 1970-01-01 01:00:00.000000000 +0100
@@ -1,12 +0,0 @@
-[Desktop Entry]
-_Name=Mount Helper
-_Comment=Automount and autorun plugged devices
-Exec=@LIBEXECDIR@/cinnamon-fallback-mount-helper
-Icon=drive-optical
-Terminal=false
-Type=Application
-Categories=
-NoDisplay=true
-OnlyShowIn=GNOME;
-X-GNOME-Autostart-Notify=true
-
diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/csd-automount-plugin.c cinnamon-settings-daemon-2.0.1/plugins/automount/csd-automount-plugin.c
--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/csd-automount-plugin.c 1970-01-01 01:00:00.000000000 +0100
+++ cinnamon-settings-daemon-2.0.1/plugins/automount/csd-automount-plugin.c 2013-10-08 22:35:10.771472456 +0200
@@ -0,0 +1,106 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Tomas Bzatek <tbzatek@redhat.com>
+ */
+
+#include "config.h"
+
+#include <glib/gi18n-lib.h>
+#include <gmodule.h>
+
+#include "cinnamon-settings-plugin.h"
+#include "csd-automount-plugin.h"
+#include "csd-automount-manager.h"
+
+struct CsdAutomountPluginPrivate {
+ CsdAutomountManager *manager;
+};
+
+#define CSD_AUTOMOUNT_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), CSD_TYPE_AUTOMOUNT_PLUGIN, CsdAutomountPluginPrivate))
+
+CINNAMON_SETTINGS_PLUGIN_REGISTER (CsdAutomountPlugin, csd_automount_plugin)
+
+static void
+csd_automount_plugin_init (CsdAutomountPlugin *plugin)
+{
+ plugin->priv = CSD_AUTOMOUNT_PLUGIN_GET_PRIVATE (plugin);
+
+ g_debug ("Automount plugin initializing");
+
+ plugin->priv->manager = csd_automount_manager_new ();
+}
+
+static void
+csd_automount_plugin_finalize (GObject *object)
+{
+ CsdAutomountPlugin *plugin;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (CSD_IS_AUTOMOUNT_PLUGIN (object));
+
+ g_debug ("Automount plugin finalizing");
+
+ plugin = CSD_AUTOMOUNT_PLUGIN (object);
+
+ g_return_if_fail (plugin->priv != NULL);
+
+ if (plugin->priv->manager != NULL) {
+ g_object_unref (plugin->priv->manager);
+ }
+
+ G_OBJECT_CLASS (csd_automount_plugin_parent_class)->finalize (object);
+}
+
+static void
+impl_activate (CinnamonSettingsPlugin *plugin)
+{
+ gboolean res;
+ GError *error;
+
+ g_debug ("Activating automount plugin");
+
+ error = NULL;
+ res = csd_automount_manager_start (CSD_AUTOMOUNT_PLUGIN (plugin)->priv->manager, &error);
+ if (! res) {
+ g_warning ("Unable to start automount manager: %s", error->message);
+ g_error_free (error);
+ }
+}
+
+static void
+impl_deactivate (CinnamonSettingsPlugin *plugin)
+{
+ g_debug ("Deactivating automount plugin");
+ csd_automount_manager_stop (CSD_AUTOMOUNT_PLUGIN (plugin)->priv->manager);
+}
+
+static void
+csd_automount_plugin_class_init (CsdAutomountPluginClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ CinnamonSettingsPluginClass *plugin_class = CINNAMON_SETTINGS_PLUGIN_CLASS (klass);
+
+ object_class->finalize = csd_automount_plugin_finalize;
+
+ plugin_class->activate = impl_activate;
+ plugin_class->deactivate = impl_deactivate;
+
+ g_type_class_add_private (klass, sizeof (CsdAutomountPluginPrivate));
+}
+
diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/csd-automount-plugin.h cinnamon-settings-daemon-2.0.1/plugins/automount/csd-automount-plugin.h
--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/csd-automount-plugin.h 1970-01-01 01:00:00.000000000 +0100
+++ cinnamon-settings-daemon-2.0.1/plugins/automount/csd-automount-plugin.h 2013-10-08 22:35:10.771472456 +0200
@@ -0,0 +1,60 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Tomas Bzatek <tbzatek@redhat.com>
+ */
+
+#ifndef __CSD_AUTOMOUNT_PLUGIN_H__
+#define __CSD_AUTOMOUNT_PLUGIN_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gmodule.h>
+
+#include "cinnamon-settings-plugin.h"
+
+G_BEGIN_DECLS
+
+#define CSD_TYPE_AUTOMOUNT_PLUGIN (csd_automount_plugin_get_type ())
+#define CSD_AUTOMOUNT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CSD_TYPE_AUTOMOUNT_PLUGIN, CsdAutomountPlugin))
+#define CSD_AUTOMOUNT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CSD_TYPE_AUTOMOUNT_PLUGIN, CsdAutomountPluginClass))
+#define CSD_IS_AUTOMOUNT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CSD_TYPE_AUTOMOUNT_PLUGIN))
+#define CSD_IS_AUTOMOUNT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CSD_TYPE_AUTOMOUNT_PLUGIN))
+#define CSD_AUTOMOUNT_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CSD_TYPE_AUTOMOUNT_PLUGIN, CsdAutomountPluginClass))
+
+typedef struct CsdAutomountPluginPrivate CsdAutomountPluginPrivate;
+
+typedef struct
+{
+ CinnamonSettingsPlugin parent;
+ CsdAutomountPluginPrivate *priv;
+} CsdAutomountPlugin;
+
+typedef struct
+{
+ CinnamonSettingsPluginClass parent_class;
+} CsdAutomountPluginClass;
+
+GType csd_automount_plugin_get_type (void) G_GNUC_CONST;
+
+/* All the plugins must implement this function */
+G_MODULE_EXPORT GType register_cinnamon_settings_plugin (GTypeModule *module);
+
+G_END_DECLS
+
+#endif /* __CSD_AUTOMOUNT_PLUGIN_H__ */
diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/Makefile.am cinnamon-settings-daemon-2.0.1/plugins/automount/Makefile.am
--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/Makefile.am 2013-10-02 16:13:56.000000000 +0200
+++ cinnamon-settings-daemon-2.0.1/plugins/automount/Makefile.am 2013-10-08 22:48:19.240865461 +0200
@@ -1,38 +1,87 @@
-libexec_PROGRAMS = cinnamon-fallback-mount-helper
+NULL =
-cinnamon_fallback_mount_helper_SOURCES = \
- cinnamon-fallback-mount-helper.c \
- csd-automount-manager.c \
- csd-automount-manager.h \
- csd-autorun.c \
- csd-autorun.h
+plugin_name = automount
-cinnamon_fallback_mount_helper_CPPFLAGS = \
+libexec_PROGRAMS = csd-test-automount
+
+csd_test_automount_SOURCES = \
+ test-automount.c \
+ csd-automount-manager.h \
+ csd-automount-manager.c \
+ csd-autorun.c \
+ csd-autorun.h \
+ $(NULL)
+
+csd_test_automount_CPPFLAGS = \
-I$(top_srcdir)/cinnamon-settings-daemon \
+ -I$(top_srcdir)/plugins/common \
-DCINNAMON_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
$(AM_CPPFLAGS)
-cinnamon_fallback_mount_helper_CFLAGS = \
+csd_test_automount_CFLAGS = \
+ $(PLUGIN_CFLAGS) \
$(SETTINGS_PLUGIN_CFLAGS) \
$(SYSTEMD_CFLAGS) \
$(AUTOMOUNT_CFLAGS)
+ $(AM_CFLAGS)
+
+csd_test_automount_LDADD = \
+ $(top_builddir)/cinnamon-settings-daemon/libcsd.la \
+ $(SETTINGS_PLUGIN_LIBS) \
+ $(SYSTEMD_LIBS) \
+ $(AUTOMOUNT_LIBS) \
+ $(NULL)
+
+plugin_LTLIBRARIES = \
+ libautomount.la \
+ $(NULL)
+
+libautomount_la_SOURCES = \
+ csd-automount-plugin.h \
+ csd-automount-plugin.c \
+ csd-automount-manager.h \
+ csd-automount-manager.c \
+ csd-autorun.c \
+ csd-autorun.h \
+ $(NULL)
+
+libautomount_la_CPPFLAGS = \
+ -I$(top_srcdir)/cinnamon-settings-daemon \
+ -DCINNAMON_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
+ $(AM_CPPFLAGS)
+
+libautomount_la_CFLAGS = \
+ $(SETTINGS_PLUGIN_CFLAGS) \
+ $(SYSTEMD_CFLAGS) \
+ $(AUTOMOUNT_CFLAGS) \
+ $(AM_CFLAGS)
+
+libautomount_la_LDFLAGS = \
+ $(CSD_PLUGIN_LDFLAGS) \
+ $(NULL)
-cinnamon_fallback_mount_helper_LDADD = \
+libautomount_la_LIBADD = \
$(SETTINGS_PLUGIN_LIBS) \
$(SYSTEMD_LIBS) \
$(AUTOMOUNT_LIBS) \
- $(top_builddir)/cinnamon-settings-daemon/libcsd.la
+ $(NULL)
-autostartdir = $(datadir)/applications
-autostart_in_files = cinnamon-fallback-mount-helper.desktop.in
-autostart_in_in_files = cinnamon-fallback-mount-helper.desktop.in.in
-autostart_DATA = $(autostart_in_files:.desktop.in=.desktop)
+plugin_in_files = \
+ automount.cinnamon-settings-plugin.in \
+ $(NULL)
-$(autostart_in_files): $(autostart_in_in_files)
- @sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@
+plugin_DATA = $(plugin_in_files:.cinnamon-settings-plugin.in=.cinnamon-settings-plugin)
-@INTLTOOL_DESKTOP_RULE@
+EXTRA_DIST = \
+ $(plugin_in_files) \
+ $(NULL)
-EXTRA_DIST = $(autostart_in_in_files)
+CLEANFILES = \
+ $(plugin_DATA) \
+ $(NULL)
-CLEANFILES = $(autostart_DATA) $(autostart_in_files)
+DISTCLEANFILES = \
+ $(plugin_DATA) \
+ $(NULL)
+
+@CSD_INTLTOOL_PLUGIN_RULE@
diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/test-automount.c cinnamon-settings-daemon-2.0.1/plugins/automount/test-automount.c
--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/test-automount.c 1970-01-01 01:00:00.000000000 +0100
+++ cinnamon-settings-daemon-2.0.1/plugins/automount/test-automount.c 2013-10-08 22:42:53.759486525 +0200
@@ -0,0 +1,7 @@
+#define NEW csd_automount_manager_new
+#define START csd_automount_manager_start
+#define STOP csd_automount_manager_stop
+#define MANAGER CsdAutomountManager
+#include "csd-automount-manager.h"
+
+#include "test-plugin.h"
diff -Naur cinnamon-settings-daemon-2.0.1.orig/po/POTFILES.in cinnamon-settings-daemon-2.0.1/po/POTFILES.in
--- cinnamon-settings-daemon-2.0.1.orig/po/POTFILES.in 2013-10-02 16:13:56.000000000 +0200
+++ cinnamon-settings-daemon-2.0.1/po/POTFILES.in 2013-10-08 22:35:10.771472456 +0200
@@ -18,8 +18,9 @@
plugins/a11y-keyboard/csd-a11y-preferences-dialog.c
[type: gettext/glade]plugins/a11y-keyboard/csd-a11y-preferences-dialog.ui
[type: gettext/ini]plugins/a11y-settings/a11y-settings.cinnamon-settings-plugin.in
-plugins/automount/cinnamon-fallback-mount-helper.desktop.in.in
+[type: gettext/ini]plugins/automount/automount.cinnamon-settings-plugin.in
plugins/automount/csd-automount-manager.c
+plugins/automount/csd-automount-plugin.c
plugins/automount/csd-autorun.c
[type: gettext/ini]plugins/background/background.cinnamon-settings-plugin.in
[type: gettext/ini]plugins/clipboard/clipboard.cinnamon-settings-plugin.in
diff -Naur cinnamon-settings-daemon-2.0.1.orig/po/POTFILES.skip cinnamon-settings-daemon-2.0.1/po/POTFILES.skip
--- cinnamon-settings-daemon-2.0.1.orig/po/POTFILES.skip 2013-10-02 16:13:56.000000000 +0200
+++ cinnamon-settings-daemon-2.0.1/po/POTFILES.skip 2013-10-08 22:37:20.224645009 +0200
@@ -20,6 +20,5 @@
data/org.cinnamon.settings-daemon.plugins.updates.gschema.xml.in
data/org.cinnamon.settings-daemon.plugins.xrandr.gschema.xml.in
data/org.cinnamon.settings-daemon.plugins.xsettings.gschema.xml.in
-plugins/automount/gnome-fallback-mount-helper.desktop.in
plugins/power/org.cinnamon.settings-daemon.plugins.power.policy.in
plugins/wacom/org.cinnamon.settings-daemon.plugins.wacom.policy.in

View File

@ -0,0 +1,52 @@
{ stdenv, fetchurl, pkgconfig, autoreconfHook, glib, gettext, gnome_common, cinnamon-desktop, intltool, gtk3,
libnotify, lcms2, libxklavier, libgnomekbd, libcanberra, pulseaudio, upower, libcanberra_gtk3, colord,
systemd, libxslt, docbook_xsl, makeWrapper, gsettings_desktop_schemas}:
let
version = "2.0.10";
in
stdenv.mkDerivation {
name = "cinnamon-settings-daemon-${version}";
src = fetchurl {
url = "http://github.com/linuxmint/cinnamon-settings-daemon/archive/${version}.tar.gz";
sha256 = "10r75xsngb7ipv9fy07dyfb256bqybzcxbwny60sgjhrksk3v9mg";
};
NIX_CFLAGS_COMPILE = "-I${glib}/include/gio-unix-2.0";
configureFlags = "--enable-systemd" ;
patches = [ ./systemd-support.patch ./automount-plugin.patch ./dpms.patch];
buildInputs = [
pkgconfig autoreconfHook
glib gettext gnome_common
intltool gtk3 libnotify lcms2
libgnomekbd libxklavier colord
libcanberra pulseaudio upower
libcanberra_gtk3 cinnamon-desktop
systemd libxslt docbook_xsl makeWrapper
gsettings_desktop_schemas
];
preBuild = "patchShebangs ./scripts";
#ToDo: missing org.cinnamon.gschema.xml, probably not packaged yet
postFixup = ''
for f in "$out"/libexec/*; do
wrapProgram "$f" --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
done
'';
meta = {
homepage = "http://cinnamon.linuxmint.com";
description = "The cinnamon session files" ;
platforms = stdenv.lib.platforms.linux;
maintainers = [ stdenv.lib.maintainers.roelof ];
};
}

View File

@ -0,0 +1,30 @@
-- a/plugins/power/csd-power-manager.c
+++ b/plugins/power/csd-power-manager.c
@@ -33,6 +33,8 @@
#include <libnotify/notify.h>
#include <canberra-gtk.h>
+#include <X11/extensions/dpms.h>
+
#define GNOME_DESKTOP_USE_UNSTABLE_API
#include <libcinnamon-desktop/gnome-rr.h>
@@ -3967,6 +3790,17 @@ csd_power_manager_start (CsdPowerManager
/* set the initial dim time that can adapt for the user */
refresh_idle_dim_settings (manager);
+ /* Make sure that Xorg's DPMS extension never gets in our way. The defaults seem to have changed in Xorg 1.14
+ * being "0" by default to being "600" by default
+ * https://bugzilla.gnome.org/show_bug.cgi?id=709114
+ */
+ gdk_error_trap_push ();
+ int dummy;
+ if (DPMSQueryExtension(GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &dummy, &dummy)) {
+ DPMSSetTimeouts (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), 0, 0, 0);
+ }
+ gdk_error_trap_pop_ignored ();
+
manager->priv->xscreensaver_watchdog_timer_id = g_timeout_add_seconds (XSCREENSAVER_WATCHDOG_TIMEOUT,
disable_builtin_screensaver,
NULL);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,536 @@
diff --git a/plugins/media-keys/csd-media-keys-manager.c b/plugins/media-keys/csd-media-keys-manager.c
index 02930a3..7c1c519 100644
--- a/plugins/media-keys/csd-media-keys-manager.c
+++ b/plugins/media-keys/csd-media-keys-manager.c
@@ -39,6 +39,7 @@
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <gio/gdesktopappinfo.h>
+#include <gio/gunixfdlist.h>
#ifdef HAVE_GUDEV
#include <gudev/gudev.h>
@@ -121,6 +122,10 @@ static const gchar kb_introspection_xml[] =
#define VOLUME_STEP 5 /* percents for one volume button press */
#define MAX_VOLUME 65536.0
+#define SYSTEMD_DBUS_NAME "org.freedesktop.login1"
+#define SYSTEMD_DBUS_PATH "/org/freedesktop/login1"
+#define SYSTEMD_DBUS_INTERFACE "org.freedesktop.login1.Manager"
+
#define CSD_MEDIA_KEYS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CSD_TYPE_MEDIA_KEYS_MANAGER, CsdMediaKeysManagerPrivate))
typedef struct {
@@ -167,6 +172,10 @@ struct CsdMediaKeysManagerPrivate
GDBusProxy *power_screen_proxy;
GDBusProxy *power_keyboard_proxy;
+ /* systemd stuff */
+ GDBusProxy *logind_proxy;
+ gint inhibit_keys_fd;
+
/* Multihead stuff */
GdkScreen *current_screen;
GSList *screens;
@@ -2213,6 +2222,11 @@ csd_media_keys_manager_stop (CsdMediaKeysManager *manager)
}
#endif /* HAVE_GUDEV */
+ if (priv->logind_proxy) {
+ g_object_unref (priv->logind_proxy);
+ priv->logind_proxy = NULL;
+ }
+
if (priv->settings) {
g_object_unref (priv->settings);
priv->settings = NULL;
@@ -2356,9 +2370,85 @@ csd_media_keys_manager_class_init (CsdMediaKeysManagerClass *klass)
}
static void
+inhibit_done (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ GDBusProxy *proxy = G_DBUS_PROXY (source);
+ CsdMediaKeysManager *manager = CSD_MEDIA_KEYS_MANAGER (user_data);
+ GError *error = NULL;
+ GVariant *res;
+ GUnixFDList *fd_list = NULL;
+ gint idx;
+
+ res = g_dbus_proxy_call_with_unix_fd_list_finish (proxy, &fd_list, result, &error);
+ if (res == NULL) {
+ g_warning ("Unable to inhibit keypresses: %s", error->message);
+ g_error_free (error);
+ } else {
+ g_variant_get (res, "(h)", &idx);
+ manager->priv->inhibit_keys_fd = g_unix_fd_list_get (fd_list, idx, &error);
+ if (manager->priv->inhibit_keys_fd == -1) {
+ g_warning ("Failed to receive system inhibitor fd: %s", error->message);
+ g_error_free (error);
+ }
+ g_debug ("System inhibitor fd is %d", manager->priv->inhibit_keys_fd);
+ g_object_unref (fd_list);
+ g_variant_unref (res);
+ }
+}
+
+static void
csd_media_keys_manager_init (CsdMediaKeysManager *manager)
{
+ GError *error;
+ GDBusConnection *bus;
+
+ error = NULL;
manager->priv = CSD_MEDIA_KEYS_MANAGER_GET_PRIVATE (manager);
+
+ bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (bus == NULL) {
+ g_warning ("Failed to connect to system bus: %s",
+ error->message);
+ g_error_free (error);
+ return;
+ }
+
+ manager->priv->logind_proxy =
+ g_dbus_proxy_new_sync (bus,
+ 0,
+ NULL,
+ SYSTEMD_DBUS_NAME,
+ SYSTEMD_DBUS_PATH,
+ SYSTEMD_DBUS_INTERFACE,
+ NULL,
+ &error);
+
+ if (manager->priv->logind_proxy == NULL) {
+ g_warning ("Failed to connect to systemd: %s",
+ error->message);
+ g_error_free (error);
+ }
+
+ g_object_unref (bus);
+
+ g_debug ("Adding system inhibitors for power keys");
+ manager->priv->inhibit_keys_fd = -1;
+ g_dbus_proxy_call_with_unix_fd_list (manager->priv->logind_proxy,
+ "Inhibit",
+ g_variant_new ("(ssss)",
+ "handle-power-key:handle-suspend-key:handle-hibernate-key",
+ g_get_user_name (),
+ "Cinnamon handling keypresses",
+ "block"),
+ 0,
+ G_MAXINT,
+ NULL,
+ NULL,
+ inhibit_done,
+ manager);
+
}
static void
@@ -2375,6 +2465,8 @@ csd_media_keys_manager_finalize (GObject *object)
if (media_keys_manager->priv->start_idle_id != 0)
g_source_remove (media_keys_manager->priv->start_idle_id);
+ if (media_keys_manager->priv->inhibit_keys_fd != -1)
+ close (media_keys_manager->priv->inhibit_keys_fd);
G_OBJECT_CLASS (csd_media_keys_manager_parent_class)->finalize (object);
}
diff --git a/plugins/power/csd-power-manager.c b/plugins/power/csd-power-manager.c
index b54cb5b..b9c5429 100644
--- a/plugins/power/csd-power-manager.c
+++ b/plugins/power/csd-power-manager.c
@@ -32,6 +32,7 @@
#include <libupower-glib/upower.h>
#include <libnotify/notify.h>
#include <canberra-gtk.h>
+#include <gio/gunixfdlist.h>
#include <X11/extensions/dpms.h>
@@ -79,6 +80,10 @@
#define CSD_POWER_MANAGER_CRITICAL_ALERT_TIMEOUT 5 /* seconds */
#define CSD_POWER_MANAGER_LID_CLOSE_SAFETY_TIMEOUT 30 /* seconds */
+#define SYSTEMD_DBUS_NAME "org.freedesktop.login1"
+#define SYSTEMD_DBUS_PATH "/org/freedesktop/login1"
+#define SYSTEMD_DBUS_INTERFACE "org.freedesktop.login1.Manager"
+
/* Keep this in sync with gnome-shell */
#define SCREENSAVER_FADE_TIME 10 /* seconds */
@@ -203,6 +208,13 @@ struct CsdPowerManagerPrivate
GtkStatusIcon *status_icon;
guint xscreensaver_watchdog_timer_id;
gboolean is_virtual_machine;
+
+ /* systemd stuff */
+ GDBusProxy *logind_proxy;
+ gint inhibit_lid_switch_fd;
+ gboolean inhibit_lid_switch_taken;
+ gint inhibit_suspend_fd;
+ gboolean inhibit_suspend_taken;
};
enum {
@@ -3350,30 +3362,6 @@ lock_screensaver (CsdPowerManager *manager)
if (!do_lock)
return;
- /* connect to the screensaver first */
- g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
- G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
- NULL,
- GS_DBUS_NAME,
- GS_DBUS_PATH,
- GS_DBUS_INTERFACE,
- NULL,
- sleep_cb_screensaver_proxy_ready_cb,
- manager);
-}
-
-static void
-upower_notify_sleep_cb (UpClient *client,
- UpSleepKind sleep_kind,
- CsdPowerManager *manager)
-{
- gboolean do_lock;
-
- do_lock = g_settings_get_boolean (manager->priv->settings,
- "lock-on-suspend");
- if (!do_lock)
- return;
-
/* connect to the screensaver first */
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
@@ -3384,46 +3372,6 @@ upower_notify_sleep_cb (UpClient *client,
NULL,
sleep_cb_screensaver_proxy_ready_cb,
manager);
-
-}
-
-static void
-upower_notify_resume_cb (UpClient *client,
- UpSleepKind sleep_kind,
- CsdPowerManager *manager)
-{
- gboolean ret;
- GError *error = NULL;
-
- /* this displays the unlock dialogue so the user doesn't have
- * to move the mouse or press any key before the window comes up */
- if (manager->priv->screensaver_proxy != NULL) {
- g_dbus_proxy_call (manager->priv->screensaver_proxy,
- "SimulateUserActivity",
- NULL,
- G_DBUS_CALL_FLAGS_NONE,
- -1, NULL, NULL, NULL);
- }
-
- if (manager->priv->screensaver_proxy != NULL) {
- g_object_unref (manager->priv->screensaver_proxy);
- manager->priv->screensaver_proxy = NULL;
- }
-
- /* close existing notifications on resume, the system power
- * state is probably different now */
- notify_close_if_showing (manager->priv->notification_low);
- notify_close_if_showing (manager->priv->notification_discharging);
-
- /* ensure we turn the panel back on after resume */
- ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen,
- GNOME_RR_DPMS_ON,
- &error);
- if (!ret) {
- g_warning ("failed to turn the panel on after resume: %s",
- error->message);
- g_error_free (error);
- }
}
static void
@@ -3582,6 +3530,219 @@ disable_builtin_screensaver (gpointer unused)
return TRUE;
}
+static void
+inhibit_lid_switch_done (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ GDBusProxy *proxy = G_DBUS_PROXY (source);
+ CsdPowerManager *manager = CSD_POWER_MANAGER (user_data);
+ GError *error = NULL;
+ GVariant *res;
+ GUnixFDList *fd_list = NULL;
+ gint idx;
+
+ res = g_dbus_proxy_call_with_unix_fd_list_finish (proxy, &fd_list, result, &error);
+ if (res == NULL) {
+ g_warning ("Unable to inhibit lid switch: %s", error->message);
+ g_error_free (error);
+ } else {
+ g_variant_get (res, "(h)", &idx);
+ manager->priv->inhibit_lid_switch_fd = g_unix_fd_list_get (fd_list, idx, &error);
+ if (manager->priv->inhibit_lid_switch_fd == -1) {
+ g_warning ("Failed to receive system inhibitor fd: %s", error->message);
+ g_error_free (error);
+ }
+ g_debug ("System inhibitor fd is %d", manager->priv->inhibit_lid_switch_fd);
+ g_object_unref (fd_list);
+ g_variant_unref (res);
+ }
+}
+
+static void
+inhibit_lid_switch (CsdPowerManager *manager)
+{
+ GVariant *params;
+
+ if (manager->priv->inhibit_lid_switch_taken) {
+ g_debug ("already inhibited lid-switch");
+ return;
+ }
+ g_debug ("Adding lid switch system inhibitor");
+ manager->priv->inhibit_lid_switch_taken = TRUE;
+
+ params = g_variant_new ("(ssss)",
+ "handle-lid-switch",
+ g_get_user_name (),
+ "Multiple displays attached",
+ "block");
+ g_dbus_proxy_call_with_unix_fd_list (manager->priv->logind_proxy,
+ "Inhibit",
+ params,
+ 0,
+ G_MAXINT,
+ NULL,
+ NULL,
+ inhibit_lid_switch_done,
+ manager);
+}
+
+static void
+inhibit_suspend_done (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ GDBusProxy *proxy = G_DBUS_PROXY (source);
+ CsdPowerManager *manager = CSD_POWER_MANAGER (user_data);
+ GError *error = NULL;
+ GVariant *res;
+ GUnixFDList *fd_list = NULL;
+ gint idx;
+
+ res = g_dbus_proxy_call_with_unix_fd_list_finish (proxy, &fd_list, result, &error);
+ if (res == NULL) {
+ g_warning ("Unable to inhibit suspend: %s", error->message);
+ g_error_free (error);
+ } else {
+ g_variant_get (res, "(h)", &idx);
+ manager->priv->inhibit_suspend_fd = g_unix_fd_list_get (fd_list, idx, &error);
+ if (manager->priv->inhibit_suspend_fd == -1) {
+ g_warning ("Failed to receive system inhibitor fd: %s", error->message);
+ g_error_free (error);
+ }
+ g_debug ("System inhibitor fd is %d", manager->priv->inhibit_suspend_fd);
+ g_object_unref (fd_list);
+ g_variant_unref (res);
+ }
+}
+
+/* We take a delay inhibitor here, which causes logind to send a
+ * PrepareToSleep signal, which gives us a chance to lock the screen
+ * and do some other preparations.
+ */
+static void
+inhibit_suspend (CsdPowerManager *manager)
+{
+ if (manager->priv->inhibit_suspend_taken) {
+ g_debug ("already inhibited lid-switch");
+ return;
+ }
+ g_debug ("Adding suspend delay inhibitor");
+ manager->priv->inhibit_suspend_taken = TRUE;
+ g_dbus_proxy_call_with_unix_fd_list (manager->priv->logind_proxy,
+ "Inhibit",
+ g_variant_new ("(ssss)",
+ "sleep",
+ g_get_user_name (),
+ "Cinnamon needs to lock the screen",
+ "delay"),
+ 0,
+ G_MAXINT,
+ NULL,
+ NULL,
+ inhibit_suspend_done,
+ manager);
+}
+
+static void
+uninhibit_suspend (CsdPowerManager *manager)
+{
+ if (manager->priv->inhibit_suspend_fd == -1) {
+ g_debug ("no suspend delay inhibitor");
+ return;
+ }
+ g_debug ("Removing suspend delay inhibitor");
+ close (manager->priv->inhibit_suspend_fd);
+ manager->priv->inhibit_suspend_fd = -1;
+ manager->priv->inhibit_suspend_taken = FALSE;
+}
+
+static void
+handle_suspend_actions (CsdPowerManager *manager)
+{
+ gboolean do_lock;
+
+ do_lock = g_settings_get_boolean (manager->priv->settings,
+ "lock-on-suspend");
+ if (do_lock)
+ lock_screensaver (manager);
+
+ /* lift the delay inhibit, so logind can proceed */
+ uninhibit_suspend (manager);
+}
+
+static void
+handle_resume_actions (CsdPowerManager *manager)
+{
+ gboolean ret;
+ GError *error = NULL;
+
+ /* this displays the unlock dialogue so the user doesn't have
+ * to move the mouse or press any key before the window comes up */
+ g_dbus_connection_call (manager->priv->connection,
+ GS_DBUS_NAME,
+ GS_DBUS_PATH,
+ GS_DBUS_INTERFACE,
+ "SimulateUserActivity",
+ NULL, NULL,
+ G_DBUS_CALL_FLAGS_NONE, -1,
+ NULL, NULL, NULL);
+
+ /* close existing notifications on resume, the system power
+ * state is probably different now */
+ notify_close_if_showing (manager->priv->notification_low);
+ notify_close_if_showing (manager->priv->notification_discharging);
+
+ /* ensure we turn the panel back on after resume */
+ ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen,
+ GNOME_RR_DPMS_ON,
+ &error);
+ if (!ret) {
+ g_warning ("failed to turn the panel on after resume: %s",
+ error->message);
+ g_error_free (error);
+ }
+
+ /* set up the delay again */
+ inhibit_suspend (manager);
+}
+
+static void
+upower_notify_sleep_cb (UpClient *client,
+ UpSleepKind sleep_kind,
+ CsdPowerManager *manager)
+{
+ handle_suspend_actions (manager);
+}
+
+static void
+upower_notify_resume_cb (UpClient *client,
+ UpSleepKind sleep_kind,
+ CsdPowerManager *manager)
+{
+ handle_resume_actions (manager);
+}
+
+static void
+logind_proxy_signal_cb (GDBusProxy *proxy,
+ const gchar *sender_name,
+ const gchar *signal_name,
+ GVariant *parameters,
+ gpointer user_data)
+{
+ CsdPowerManager *manager = CSD_POWER_MANAGER (user_data);
+ gboolean is_about_to_suspend;
+
+ if (g_strcmp0 (signal_name, "PrepareForSleep") != 0)
+ return;
+ g_variant_get (parameters, "(b)", &is_about_to_suspend);
+ if (is_about_to_suspend) {
+ handle_suspend_actions (manager);
+ } else {
+ handle_resume_actions (manager);
+ }
+}
+
static gboolean
is_hardware_a_virtual_machine (void)
{
@@ -3647,6 +3808,26 @@ csd_power_manager_start (CsdPowerManager *manager,
if (manager->priv->x11_screen == NULL)
return FALSE;
+ /* Set up the logind proxy */
+ manager->priv->logind_proxy =
+ g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+ 0,
+ NULL,
+ SYSTEMD_DBUS_NAME,
+ SYSTEMD_DBUS_PATH,
+ SYSTEMD_DBUS_INTERFACE,
+ NULL,
+ error);
+ g_signal_connect (manager->priv->logind_proxy, "g-signal",
+ G_CALLBACK (logind_proxy_signal_cb),
+ manager);
+
+ /* Set up a delay inhibitor to be informed about suspend attempts */
+ inhibit_suspend (manager);
+
+ /* Disable logind's lid handling while g-s-d is active */
+ inhibit_lid_switch (manager);
+
/* track the active session */
manager->priv->session = cinnamon_settings_session_new ();
g_signal_connect (manager->priv->session, "notify::state",
@@ -3856,6 +4037,22 @@ csd_power_manager_stop (CsdPowerManager *manager)
manager->priv->up_client = NULL;
}
+ if (manager->priv->inhibit_lid_switch_fd != -1) {
+ close (manager->priv->inhibit_lid_switch_fd);
+ manager->priv->inhibit_lid_switch_fd = -1;
+ manager->priv->inhibit_lid_switch_taken = FALSE;
+ }
+ if (manager->priv->inhibit_suspend_fd != -1) {
+ close (manager->priv->inhibit_suspend_fd);
+ manager->priv->inhibit_suspend_fd = -1;
+ manager->priv->inhibit_suspend_taken = FALSE;
+ }
+
+ if (manager->priv->logind_proxy != NULL) {
+ g_object_unref (manager->priv->logind_proxy);
+ manager->priv->logind_proxy = NULL;
+ }
+
if (manager->priv->x11_screen != NULL) {
g_object_unref (manager->priv->x11_screen);
manager->priv->x11_screen = NULL;
@@ -3928,6 +4125,8 @@ static void
csd_power_manager_init (CsdPowerManager *manager)
{
manager->priv = CSD_POWER_MANAGER_GET_PRIVATE (manager);
+ manager->priv->inhibit_lid_switch_fd = -1;
+ manager->priv->inhibit_suspend_fd = -1;
}
static void

View File

@ -9885,7 +9885,9 @@ let
cinnamon = recurseIntoAttrs rec {
callPackage = newScope pkgs.cinnamon;
inherit (gnome3) gnome_common;
inherit (gnome3) gnome_common libgnomekbd;
cinnamon-settings-daemon = callPackage ../desktops/cinnamon/cinnamon-settings-daemon.nix{ };
cinnamon-session = callPackage ../desktops/cinnamon/cinnamon-session.nix{ } ;