[gnome-todo] eds: make it an embedded plugin



commit 51d53bd0ead3bf2ad0c15f25a91484a401cd8ad0
Author: Saiful B. Khan <saifulbkhan gmail com>
Date:   Thu Mar 3 00:41:23 2016 +0530

    eds: make it an embedded plugin
    
    EDS is the core plugin for gnome-todo and it should be hidden to
    the user. Libpeas added support for embedded plugins (since v0.19)
    and this allows EDS to be loaded as an embedded plugin for ToDo.
    This should prevent the user from modifying EDS from an install
    directory.
    
    EDS resources were added to gresources, to be linked with the
    binary executable. Appropriate changes to add resource search path
    and compilation with Makefiles were done to allow compatibility.
    eds.plugin was added with an 'Embedded' field.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=760847

 Makefile.am                     |    2 +-
 common.am                       |    3 ---
 data/todo.gresource.xml         |    7 +++++++
 plugins/eds/Makefile.am         |   38 ++++++--------------------------------
 plugins/eds/eds.gresource.xml   |    7 -------
 plugins/eds/eds.plugin.in       |    1 +
 plugins/eds/gtd-plugin-eds.c    |    2 +-
 plugins/eds/gtd-plugin-eds.h    |    2 +-
 src/Makefile.am                 |    7 ++++++-
 src/engine/gtd-plugin-manager.c |    3 +++
 10 files changed, 26 insertions(+), 46 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 5a2523c..fa7745f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,7 @@ include $(top_srcdir)/common.am
 
 ACLOCAL_AMFLAGS = --install -I m4 ${ACLOCAL_FLAGS}
 
-SUBDIRS = src data plugins po
+SUBDIRS = plugins src data po
 DIST_SUBDIRS = src data plugins po
 
 INTLTOOL_FILES = \
diff --git a/common.am b/common.am
index 5ebff7f..3f62ae3 100644
--- a/common.am
+++ b/common.am
@@ -7,6 +7,3 @@ GNOME_TODO_PLUGIN_CFLAGS = \
 GNOME_TODO_PLUGIN_WARN_CFLAGS = \
        $(GNOME_TODO_WARN_CFLAGS)
 
-GNOME_TODO_PLUGIN_LDFLAGS = \
-        -avoid-version \
-        -module
diff --git a/data/todo.gresource.xml b/data/todo.gresource.xml
index d41a50c..4e75664 100644
--- a/data/todo.gresource.xml
+++ b/data/todo.gresource.xml
@@ -21,4 +21,11 @@
     <file compressed="true">theme/bg.png</file>
     <file compressed="true">theme/bg.svg</file>
   </gresource>
+
+  <!--EDS Plugin-->
+  <gresource prefix="/org/gnome/todo">
+    <file compressed="true" alias="ui/eds/edit-pane.ui">../plugins/eds/edit-pane.ui</file>
+    <file compressed="true" alias="theme/eds/Adwaita.css">../plugins/eds/theme/Adwaita.css</file>
+    <file alias="plugins/eds/eds.plugin">../plugins/eds/eds.plugin</file>
+  </gresource>
 </gresources>
diff --git a/plugins/eds/Makefile.am b/plugins/eds/Makefile.am
index 2119a0e..1ab9b59 100644
--- a/plugins/eds/Makefile.am
+++ b/plugins/eds/Makefile.am
@@ -1,13 +1,8 @@
 include $(top_srcdir)/common.am
 
-edsplugindir = $(plugindir)/eds
-edsplugin_LTLIBRARIES = libeds.la
-edsplugin_DATA = eds.plugin
+noinst_LTLIBRARIES = libeds.a
 
-BUILT_SOURCES = \
-       gtd-plugin-eds-resources.c
-
-libeds_la_SOURCES = \
+libeds_a_SOURCES = \
        gtd-panel-today.c \
        gtd-panel-today.h \
        gtd-panel-scheduled.c \
@@ -21,35 +16,14 @@ libeds_la_SOURCES = \
        gtd-provider-local.c \
        gtd-provider-local.h \
        gtd-task-list-eds.c \
-       gtd-task-list-eds.h \
-       $(BUILT_SOURCES)
+       gtd-task-list-eds.h
 
-libeds_la_CFLAGS = \
+libeds_a_CFLAGS = \
        $(GNOME_TODO_PLUGIN_CFLAGS) \
        $(GNOME_TODO_PLUGIN_WARN_CFLAGS) \
        -DGOA_API_IS_SUBJECT_TO_CHANGE \
        -DG_LOG_DOMAIN='"EDS"'
 
-libeds_la_LIBADD = \
-       $(GNOME_TODO_LIBS)
-
-libeds_la_LDFLAGS = \
-       $(GNOME_TODO_PLUGIN_LDFLAGS) \
-       $(GNOME_TODO_WARN_LDFLAGS)
-
-# generate binary-bundle resources
-resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies \
-                --sourcedir=$(top_srcdir)/plugins/eds $(top_srcdir)/plugins/eds/eds.gresource.xml)
-
-gtd-plugin-eds-resources.c: $(top_srcdir)/plugins/eds/eds.gresource.xml $(resource_files)
-       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(top_srcdir)/plugins/eds 
--generate-source $<
-
-CLEANFILES = \
-       $(BUILT_SOURCES)
-
 EXTRA_DIST = \
-       $(resource_files) \
-       eds.plugin.in \
-       eds.gresource.xml \
-       edit-pane.ui \
-       theme/Adwaita.css
+       eds.plugin.in
+
diff --git a/plugins/eds/eds.plugin.in b/plugins/eds/eds.plugin.in
index 4b0d1ce..530c459 100644
--- a/plugins/eds/eds.plugin.in
+++ b/plugins/eds/eds.plugin.in
@@ -10,4 +10,5 @@ Builtin = true
 Hidden = true
 License = GPL
 Loader = C
+Embedded = gtd_plugin_eds_register_types
 Depends =
diff --git a/plugins/eds/gtd-plugin-eds.c b/plugins/eds/gtd-plugin-eds.c
index afe723e..5dd1671 100644
--- a/plugins/eds/gtd-plugin-eds.c
+++ b/plugins/eds/gtd-plugin-eds.c
@@ -384,7 +384,7 @@ gtd_plugin_eds_class_finalize (GtdPluginEdsClass *klass)
 }
 
 G_MODULE_EXPORT void
-peas_register_types (PeasObjectModule *module)
+gtd_plugin_eds_register_types (PeasObjectModule *module)
 {
   gtd_plugin_eds_register_type (G_TYPE_MODULE (module));
 
diff --git a/plugins/eds/gtd-plugin-eds.h b/plugins/eds/gtd-plugin-eds.h
index 368be26..66984e7 100644
--- a/plugins/eds/gtd-plugin-eds.h
+++ b/plugins/eds/gtd-plugin-eds.h
@@ -28,7 +28,7 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (GtdPluginEds, gtd_plugin_eds, GTD, PLUGIN_EDS, PeasExtensionBase)
 
-G_MODULE_EXPORT void  peas_register_types                        (PeasObjectModule   *module);
+G_MODULE_EXPORT void  gtd_plugin_eds_register_types                        (PeasObjectModule   *module);
 
 G_END_DECLS
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 701ae54..bceacd3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -94,10 +94,15 @@ gnome_todo_CFLAGS = \
 
 gnome_todo_LDFLAGS = \
        -Wl,--export-dynamic \
+       -u gtd_plugin_eds_register_types \
        $(GNOME_TODO_WARN_LDFLAGS)
 
 gnome_todo_LDADD = \
-       $(GNOME_TODO_LIBS)
+       $(GNOME_TODO_LIBS) \
+       $(top_srcdir)/plugins/eds/libeds.a
+
+gnome_todo_DEPENDENCIES = \
+       $(top_srcdir)/plugins/eds/libeds.a
 
 #
 # Export headers to [PREFIX]/include/gnome-todo
diff --git a/src/engine/gtd-plugin-manager.c b/src/engine/gtd-plugin-manager.c
index d8a9ac5..5a01160 100644
--- a/src/engine/gtd-plugin-manager.c
+++ b/src/engine/gtd-plugin-manager.c
@@ -322,6 +322,9 @@ setup_engine (GtdPluginManager *self)
   peas_engine_add_search_path (engine,
                                plugin_dir,
                                NULL);
+  peas_engine_prepend_search_path (engine,
+                                   "resource:///org/gnome/todo/plugins",
+                                   "resource:///org/gnome/todo/plugins");
 
   g_free (plugin_dir);
 


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