[evolution-rss] Bug 752197 - Teach cache-reaper of 3rd-party private directories



commit 96fd27bdf1a2dc06f25e9600d01cc8f7d2bc1cdc
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jul 14 16:30:01 2015 +0200

    Bug 752197 - Teach cache-reaper of 3rd-party private directories

 configure.ac         |   10 +++++
 src/Makefile.am      |   20 +++++++++-
 src/module-eds-rss.c |  105 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 134 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b13d42d..4322827 100644
--- a/configure.ac
+++ b/configure.ac
@@ -352,6 +352,12 @@ fi
 
 AM_CONDITIONAL([HAVE_BONOBO], [test "x$have_bonobo" = "xyes"])
 
+have_evolution_31704=no
+if test $evolution_int_version -ge 31704; then
+       have_evolution_31704=yes
+fi
+AM_CONDITIONAL([HAVE_EVOLUTION_31704], [test "x$have_evolution_31704" = "xyes"])
+
 dnl I18n stuff
 AC_PATH_PROG(GETTEXT, gettext, no)
 if test "x$GETTEXT" = "xno"; then
@@ -388,6 +394,10 @@ AC_SUBST(privdatadir)
 uidir="$privdatadir/ui"
 AC_SUBST(uidir)
 
+edsprivlibdir=`$PKG_CONFIG --variable=privlibdir libedataserver-1.2`
+edsmoduledir="$edsprivlibdir/registry-modules"
+AC_SUBST(edsmoduledir)
+
 if test $evolution_int_version -ge 31306; then
 privlibdir=`$PKG_CONFIG --variable=privlibdir evolution-shell-3.0`
 else
diff --git a/src/Makefile.am b/src/Makefile.am
index c0c6ecd..b6e3a42 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -136,11 +136,29 @@ evolution_module_rss_la_LIBADD =                  \
         $(EVOLUTION_RSS_EPLUGIN_LIBS)                  \
        $(DATASERVER_LIBS)
 
+evolution_module_rss_la_LDFLAGS =              \
+        -avoid-version -module $(NO_UNDEFINED)
 
+if HAVE_EVOLUTION_31704
 
-evolution_module_rss_la_LDFLAGS =              \
+edsmodule_LTLIBRARIES = module-eds-rss.la
+
+module_eds_rss_la_SOURCES =            \
+       module-eds-rss.c
+
+module_eds_rss_la_CPPFLAGS =           \
+        $(AM_CPPFLAGS)                 \
+        -I$(top_srcdir)                        \
+        -DG_LOG_DOMAIN=\"module-eds-rss\"
+
+module_eds_rss_la_LIBADD =             \
+       $(DATASERVER_LIBS)
+
+module_eds_rss_la_LDFLAGS =            \
         -avoid-version -module $(NO_UNDEFINED)
 
+endif
+
 @EVO_SERVER_RULE@
 
 gsettings_SCHEMAS =                            \
diff --git a/src/module-eds-rss.c b/src/module-eds-rss.c
new file mode 100644
index 0000000..2bf26bd
--- /dev/null
+++ b/src/module-eds-rss.c
@@ -0,0 +1,105 @@
+/*
+ *  Copyright (C) 2015 Red Hat Inc. <www.redhat.com>
+ *
+ *  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, Fifth Floor, Boston, MA
+ *  02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gmodule.h>
+
+#include <libedataserver/libedataserver.h>
+#include <cache-reaper/e-cache-reaper.h>
+
+/* Standard GObject macros */
+#define E_TYPE_RSS_CACHE_REAPER_EXT \
+       (e_cache_reaper_get_type ())
+#define E_RSS_CACHE_REAPER_EXT(obj) \
+       (G_TYPE_CHECK_INSTANCE_CAST \
+       ((obj), E_TYPE_RSS_CACHE_REAPER_EXT, ERSSCacheReaperExt))
+#define E_IS_RSS_CACHE_REAPER_EXT(obj) \
+       (G_TYPE_CHECK_INSTANCE_TYPE \
+       ((obj), E_TYPE_RSS_CACHE_REAPER_EXT))
+
+typedef struct _ERSSCacheReaperExt ERSSCacheReaperExt;
+typedef struct _ERSSCacheReaperExtClass ERSSCacheReaperExtClass;
+
+GType e_rss_cache_reaper_ext_get_type (void);
+
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
+
+struct _ERSSCacheReaperExt {
+       EExtension parent;
+};
+
+struct _ERSSCacheReaperExtClass {
+       EExtensionClass parent_class;
+};
+
+G_DEFINE_DYNAMIC_TYPE (ERSSCacheReaperExt, e_rss_cache_reaper_ext, E_TYPE_EXTENSION)
+
+static void
+e_rss_cache_reaper_ext_constructed (GObject *object)
+{
+       EExtension *extension;
+       EExtensible *extensible;
+
+       extension = E_EXTENSION (object);
+       extensible = e_extension_get_extensible (extension);
+
+       e_cache_reaper_add_private_directory (E_CACHE_REAPER (extensible), "rss");
+
+       /* Chain up to parent's constructed() method. */
+       G_OBJECT_CLASS (e_rss_cache_reaper_ext_parent_class)->constructed (object);
+}
+
+static void
+e_rss_cache_reaper_ext_class_init (ERSSCacheReaperExtClass *class)
+{
+       GObjectClass *object_class;
+       EExtensionClass *extension_class;
+
+       object_class = G_OBJECT_CLASS (class);
+       object_class->constructed = e_rss_cache_reaper_ext_constructed;
+
+       extension_class = E_EXTENSION_CLASS (class);
+       extension_class->extensible_type = E_TYPE_CACHE_REAPER;
+}
+
+static void
+e_rss_cache_reaper_ext_class_finalize (ERSSCacheReaperExtClass *class)
+{
+}
+
+static void
+e_rss_cache_reaper_ext_init (ERSSCacheReaperExt *extension)
+{
+}
+
+G_MODULE_EXPORT void
+e_module_load (GTypeModule *type_module)
+{
+       /* Register dynamically loaded types. */
+       e_rss_cache_reaper_ext_register_type (type_module);
+}
+
+G_MODULE_EXPORT void
+e_module_unload (GTypeModule *type_module)
+{
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]