nixpkgs/pkgs/desktops/cinnamon/automount-plugin.patch
Roelof Wobben 0096bb677a new package: cinnamon-settings-daemon (close #2205)
With tiny changes from @vcunat.
2014-04-13 11:57:12 +02:00

449 lines
18 KiB
Diff

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