[gnome-todo] project: move the Today panel to a plugin of its own



commit af7c89c8ade16e2678efa6a9a7bb01318131e024
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Oct 6 17:59:00 2016 -0300

    project: move the Today panel to a plugin of its own

 configure.ac                                       |    6 +-
 data/org.gnome.todo.gschema.xml                    |    2 +-
 data/todo.gresource.xml                            |    5 +
 plugins/Makefile.am                                |    2 +-
 plugins/eds/Makefile.am                            |    2 -
 plugins/eds/gtd-plugin-eds.c                       |    2 -
 plugins/today-panel/Makefile.am                    |   19 +++
 plugins/{eds => today-panel}/gtd-panel-today.c     |    0
 plugins/{eds => today-panel}/gtd-panel-today.h     |    0
 plugins/today-panel/gtd-plugin-today-panel.c       |  158 ++++++++++++++++++++
 .../gtd-plugin-today-panel.h}                      |   19 ++-
 plugins/today-panel/today-panel.plugin.in          |   13 ++
 po/POTFILES.in                                     |    2 +-
 src/Makefile.am                                    |    7 +-
 14 files changed, 217 insertions(+), 20 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 14fe46b..a104b13 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,6 +89,7 @@ dnl ================================================================
 GNOME_TODO_ADD_PLUGIN([eds], [Evolution-Data-Server], [yes])
 GNOME_TODO_ADD_PLUGIN([dark-theme], [Dark theme], [yes])
 GNOME_TODO_ADD_PLUGIN([score], [Score], [yes])
+GNOME_TODO_ADD_PLUGIN([today-panel], [Today Panel], [yes])
 GNOME_TODO_ADD_PLUGIN([unscheduled-panel], [Unscheduled Tasks Panel], [yes])
 
 AC_CONFIG_FILES([
@@ -116,8 +117,9 @@ echo "
         release:       ${ax_is_release}
 
     Plugins:
-        Score.................... ${enable_score_plugin}
-        Unscheduled panel........ ${enable_unscheduled_panel_plugin}
+        Score ................... ${enable_score_plugin}
+        Today ................... ${enable_today_plugin}
+        Unscheduled panel ....... ${enable_unscheduled_panel_plugin}
 
         Now type 'make' to build $PACKAGE
 "
diff --git a/data/org.gnome.todo.gschema.xml b/data/org.gnome.todo.gschema.xml
index cd9feac..15f9e6a 100644
--- a/data/org.gnome.todo.gschema.xml
+++ b/data/org.gnome.todo.gschema.xml
@@ -27,7 +27,7 @@
             <description>The identifier of the default provider to add new lists to</description>
         </key>
         <key name="active-extensions" type="as">
-            <default>["eds"]</default>
+            <default>["eds", "today-panel"]</default>
             <summary>List of active extensions</summary>
             <description>The list of active extensions</description>
         </key>
diff --git a/data/todo.gresource.xml b/data/todo.gresource.xml
index 03bc7ba..eda32a8 100644
--- a/data/todo.gresource.xml
+++ b/data/todo.gresource.xml
@@ -30,4 +30,9 @@
     <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>
+
+  <!--Today panel-->
+  <gresource prefix="/org/gnome/todo">
+    <file alias="plugins/today-panel/today-panel.plugin">../plugins/today-panel/today-panel.plugin</file>
+  </gresource>
 </gresources>
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 101ee08..a1c8d4b 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = eds dark-theme
+SUBDIRS = eds dark-theme today-panel
 
 if BUILD_SCORE_PLUGIN
 SUBDIRS += score
diff --git a/plugins/eds/Makefile.am b/plugins/eds/Makefile.am
index 8b6265b..a38a589 100644
--- a/plugins/eds/Makefile.am
+++ b/plugins/eds/Makefile.am
@@ -3,8 +3,6 @@ include $(top_srcdir)/common.am
 noinst_LTLIBRARIES = libeds.la
 
 libeds_la_SOURCES = \
-       gtd-panel-today.c \
-       gtd-panel-today.h \
        gtd-panel-scheduled.c \
        gtd-panel-scheduled.h \
        gtd-plugin-eds.c \
diff --git a/plugins/eds/gtd-plugin-eds.c b/plugins/eds/gtd-plugin-eds.c
index 042d2f3..10654af 100644
--- a/plugins/eds/gtd-plugin-eds.c
+++ b/plugins/eds/gtd-plugin-eds.c
@@ -18,7 +18,6 @@
 
 #define G_LOG_DOMAIN "Evolution Data Server"
 
-#include "gtd-panel-today.h"
 #include "gtd-panel-scheduled.h"
 #include "gtd-plugin-eds.h"
 #include "gtd-provider-goa.h"
@@ -351,7 +350,6 @@ gtd_plugin_eds_init (GtdPluginEds *self)
   GError *error = NULL;
   GFile* css_file;
 
-  self->panels = g_list_append (NULL, gtd_panel_today_new ());
   self->panels = g_list_append (self->panels, gtd_panel_scheduled_new ());
 
   /* load the source registry */
diff --git a/plugins/today-panel/Makefile.am b/plugins/today-panel/Makefile.am
new file mode 100644
index 0000000..c8938a9
--- /dev/null
+++ b/plugins/today-panel/Makefile.am
@@ -0,0 +1,19 @@
+include $(top_srcdir)/common.am
+
+NULL=
+
+noinst_LTLIBRARIES = libtodaypanel.la
+
+libtodaypanel_la_SOURCES = \
+       gtd-panel-today.c \
+       gtd-panel-today.h \
+       gtd-plugin-today-panel.c \
+       gtd-plugin-today-panel.h \
+       $(NULL)
+
+libtodaypanel_la_CFLAGS = \
+       $(GNOME_TODO_PLUGIN_CFLAGS) \
+       $(GNOME_TODO_PLUGIN_WARN_CFLAGS)
+
+EXTRA_DIST = \
+       today-panel.plugin.in
diff --git a/plugins/eds/gtd-panel-today.c b/plugins/today-panel/gtd-panel-today.c
similarity index 100%
rename from plugins/eds/gtd-panel-today.c
rename to plugins/today-panel/gtd-panel-today.c
diff --git a/plugins/eds/gtd-panel-today.h b/plugins/today-panel/gtd-panel-today.h
similarity index 100%
copy from plugins/eds/gtd-panel-today.h
copy to plugins/today-panel/gtd-panel-today.h
diff --git a/plugins/today-panel/gtd-plugin-today-panel.c b/plugins/today-panel/gtd-plugin-today-panel.c
new file mode 100644
index 0000000..adb5811
--- /dev/null
+++ b/plugins/today-panel/gtd-plugin-today-panel.c
@@ -0,0 +1,158 @@
+/* gtd-plugin-today-panel.c
+ *
+ * Copyright (C) 2016 Georges Basile Stavracas Neto <georges stavracas gmail 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#define G_LOG_DOMAIN "Today"
+
+#include "gtd-panel-today.h"
+#include "gtd-plugin-today-panel.h"
+
+#include <glib/gi18n.h>
+#include <glib-object.h>
+
+struct _GtdPluginTodayPanel
+{
+  PeasExtensionBase   parent;
+
+  GList              *panels;
+};
+
+static void          gtd_activatable_iface_init                  (GtdActivatableInterface  *iface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (GtdPluginTodayPanel, gtd_plugin_today_panel, PEAS_TYPE_EXTENSION_BASE,
+                                0,
+                                G_IMPLEMENT_INTERFACE_DYNAMIC (GTD_TYPE_ACTIVATABLE,
+                                                               gtd_activatable_iface_init))
+
+enum {
+  PROP_0,
+  PROP_PREFERENCES_PANEL,
+  N_PROPS
+};
+
+/*
+ * GtdActivatable interface implementation
+ */
+static void
+gtd_plugin_today_panel_activate (GtdActivatable *activatable)
+{
+  ;
+}
+
+static void
+gtd_plugin_today_panel_deactivate (GtdActivatable *activatable)
+{
+  ;
+}
+
+static GList*
+gtd_plugin_today_panel_get_header_widgets (GtdActivatable *activatable)
+{
+  return NULL;
+}
+
+static GtkWidget*
+gtd_plugin_today_panel_get_preferences_panel (GtdActivatable *activatable)
+{
+  return NULL;
+}
+
+static GList*
+gtd_plugin_today_panel_get_panels (GtdActivatable *activatable)
+{
+  GtdPluginTodayPanel *plugin = GTD_PLUGIN_TODAY_PANEL (activatable);
+
+  return plugin->panels;
+}
+
+static GList*
+gtd_plugin_today_panel_get_providers (GtdActivatable *activatable)
+{
+  return NULL;
+}
+
+static void
+gtd_activatable_iface_init (GtdActivatableInterface *iface)
+{
+  iface->activate = gtd_plugin_today_panel_activate;
+  iface->deactivate = gtd_plugin_today_panel_deactivate;
+  iface->get_header_widgets = gtd_plugin_today_panel_get_header_widgets;
+  iface->get_preferences_panel = gtd_plugin_today_panel_get_preferences_panel;
+  iface->get_panels = gtd_plugin_today_panel_get_panels;
+  iface->get_providers = gtd_plugin_today_panel_get_providers;
+}
+
+static void
+gtd_plugin_today_panel_finalize (GObject *object)
+{
+  GtdPluginTodayPanel *self = (GtdPluginTodayPanel *)object;
+
+  g_list_free (self->panels);
+
+  G_OBJECT_CLASS (gtd_plugin_today_panel_parent_class)->finalize (object);
+}
+
+static void
+gtd_plugin_today_panel_get_property (GObject    *object,
+                                     guint       prop_id,
+                                     GValue     *value,
+                                     GParamSpec *pspec)
+{
+  switch (prop_id)
+    {
+    case PROP_PREFERENCES_PANEL:
+      g_value_set_object (value, NULL);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+gtd_plugin_today_panel_class_init (GtdPluginTodayPanelClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = gtd_plugin_today_panel_finalize;
+  object_class->get_property = gtd_plugin_today_panel_get_property;
+
+  g_object_class_override_property (object_class,
+                                    PROP_PREFERENCES_PANEL,
+                                    "preferences-panel");
+}
+
+static void
+gtd_plugin_today_panel_init (GtdPluginTodayPanel *self)
+{
+  self->panels = g_list_append (NULL, gtd_panel_today_new ());
+}
+
+static void
+gtd_plugin_today_panel_class_finalize (GtdPluginTodayPanelClass *klass)
+{
+}
+
+G_MODULE_EXPORT void
+gtd_plugin_today_panel_register_types (PeasObjectModule *module)
+{
+  gtd_plugin_today_panel_register_type (G_TYPE_MODULE (module));
+
+  peas_object_module_register_extension_type (module,
+                                              GTD_TYPE_ACTIVATABLE,
+                                              GTD_TYPE_PLUGIN_TODAY_PANEL);
+}
diff --git a/plugins/eds/gtd-panel-today.h b/plugins/today-panel/gtd-plugin-today-panel.h
similarity index 59%
rename from plugins/eds/gtd-panel-today.h
rename to plugins/today-panel/gtd-plugin-today-panel.h
index 135e67a..a30c6b8 100644
--- a/plugins/eds/gtd-panel-today.h
+++ b/plugins/today-panel/gtd-plugin-today-panel.h
@@ -1,6 +1,6 @@
-/* gtd-panel-today.h
+/* gtd-plugin-today-panel.h
  *
- * Copyright (C) 2015 Georges Basile Stavracas Neto <georges stavracas gmail com>
+ * Copyright (C) 2016 Georges Basile Stavracas Neto <georges stavracas gmail 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
@@ -16,20 +16,21 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef GTD_PANEL_TODAY_H
-#define GTD_PANEL_TODAY_H
+#ifndef GTD_PLUGIN_TODAY_PANEL_H
+#define GTD_PLUGIN_TODAY_PANEL_H
 
 #include <glib.h>
-#include <gtk/gtk.h>
+#include <gnome-todo.h>
 
 G_BEGIN_DECLS
 
-#define GTD_TYPE_PANEL_TODAY (gtd_panel_today_get_type())
+#define GTD_TYPE_PLUGIN_TODAY_PANEL (gtd_plugin_today_panel_get_type())
 
-G_DECLARE_FINAL_TYPE (GtdPanelToday, gtd_panel_today, GTD, PANEL_TODAY, GtkBox)
+G_DECLARE_FINAL_TYPE (GtdPluginTodayPanel, gtd_plugin_today_panel, GTD, PLUGIN_TODAY_PANEL, 
PeasExtensionBase)
 
-GtkWidget*           gtd_panel_today_new                         (void);
+G_MODULE_EXPORT void gtd_plugin_today_panel_register_types       (PeasObjectModule   *module);
 
 G_END_DECLS
 
-#endif /* GTD_PANEL_TODAY_H */
+#endif /* GTD_PLUGIN_TODAY_PANEL_H */
+
diff --git a/plugins/today-panel/today-panel.plugin.in b/plugins/today-panel/today-panel.plugin.in
new file mode 100644
index 0000000..38a8083
--- /dev/null
+++ b/plugins/today-panel/today-panel.plugin.in
@@ -0,0 +1,13 @@
+[Plugin]
+Name = Today tasks
+Module = today-panel
+Description = A panel to show tasks scheduled for today
+Version = @VERSION@
+Authors = Georges Basile Stavracas Neto <gbsneto gnome org>
+Copyright = Copyleft © The To Do maintainers
+Website = https://wiki.gnome.org/Apps/Todo
+Builtin = true
+License = GPL
+Loader = C
+Embedded = gtd_plugin_today_panel_register_types
+Depends =
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e07d0b0..47b8f44 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -15,12 +15,12 @@ data/org.gnome.todo.gschema.xml
 [type: gettext/glade]data/ui/window.ui
 [type: gettext/glade]plugins/eds/edit-pane.ui
 plugins/eds/gtd-panel-scheduled.c
-plugins/eds/gtd-panel-today.c
 plugins/eds/gtd-plugin-eds.c
 plugins/eds/gtd-provider-eds.c
 plugins/eds/gtd-provider-local.c
 plugins/eds/gtd-task-list-eds.c
 plugins/score/score/__init__.py
+plugins/today-panel/gtd-panel-today.c
 plugins/unscheduled-panel/unscheduled-panel/__init__.py
 src/gtd-application.c
 src/gtd-edit-pane.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 1cd7b9a..db19b2f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -94,16 +94,19 @@ gnome_todo_LDFLAGS = \
        -Wl,--export-dynamic \
        -Wl,--undefined=gtd_plugin_eds_register_types \
        -Wl,--undefined=gtd_plugin_dark_theme_register_types \
+       -Wl,--undefined=gtd_plugin_today_panel_register_types \
        $(GNOME_TODO_WARN_LDFLAGS)
 
 gnome_todo_LDADD = \
        $(GNOME_TODO_LIBS) \
        $(top_builddir)/plugins/eds/libeds.la \
-       $(top_builddir)/plugins/dark-theme/libdarktheme.la
+       $(top_builddir)/plugins/dark-theme/libdarktheme.la \
+       $(top_builddir)/plugins/today-panel/libtodaypanel.la
 
 gnome_todo_DEPENDENCIES = \
        $(top_builddir)/plugins/eds/libeds.la \
-       $(top_builddir)/plugins/dark-theme/libdarktheme.la
+       $(top_builddir)/plugins/dark-theme/libdarktheme.la \
+       $(top_builddir)/plugins/today-panel/libtodaypanel.la
 
 #
 # Export headers to [PREFIX]/include/gnome-todo


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