[gnome-todo/wip/gbsneto/plugins] activatable: add GtdActivatable interface
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo/wip/gbsneto/plugins] activatable: add GtdActivatable interface
- Date: Sun, 13 Dec 2015 16:46:17 +0000 (UTC)
commit 5016cc06e458b8faff65f374dd6564488deee1f0
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sun Dec 13 14:45:32 2015 -0200
activatable: add GtdActivatable interface
Plugins shall implement this interface in order to
be loaded and executed.
src/gtd-types.h | 1 +
src/interfaces/gtd-activatable.c | 67 ++++++++++++++++++++++++++++++++++++++
src/interfaces/gtd-activatable.h | 46 ++++++++++++++++++++++++++
3 files changed, 114 insertions(+), 0 deletions(-)
---
diff --git a/src/gtd-types.h b/src/gtd-types.h
index d1b3cc9..4d04315 100644
--- a/src/gtd-types.h
+++ b/src/gtd-types.h
@@ -25,6 +25,7 @@
G_BEGIN_DECLS
+typedef struct _GtdActivatable GtdActivatable;
typedef struct _GtdApplication GtdApplication;
typedef struct _GtdInitialSetupWindow GtdInitialSetupWindow;
typedef struct _GtdListView GtdListView;
diff --git a/src/interfaces/gtd-activatable.c b/src/interfaces/gtd-activatable.c
new file mode 100644
index 0000000..6206097
--- /dev/null
+++ b/src/interfaces/gtd-activatable.c
@@ -0,0 +1,67 @@
+/* gtd-activatable.c
+ *
+ * Copyright (C) 2015 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/>.
+ */
+
+#include "gtd-activatable.h"
+
+G_DEFINE_INTERFACE (GtdActivatable, gtd_activatable, PEAS_TYPE_ACTIVATABLE)
+
+static void
+gtd_activatable_default_init (GtdActivatableInterface *iface)
+{
+ /**
+ * GtdActivatable::panels:
+ *
+ * A list of #GtdPanel this plugin carries.
+ */
+ g_object_interface_install_property (iface,
+ g_param_spec_boxed ("panels",
+ "Panels this widget has",
+ "A list of panel this widget has",
+ G_TYPE_POINTER,
+ G_PARAM_READABLE));
+
+ /**
+ * GtdActivatable::providers:
+ *
+ * A list of #GtdProvider this plugin carries.
+ */
+ g_object_interface_install_property (iface,
+ g_param_spec_boxed ("providers",
+ "Providers this widget has",
+ "A list of providers this widget has",
+ G_TYPE_POINTER,
+ G_PARAM_READABLE));
+}
+
+GList*
+gtd_activatable_get_panels (GtdActivatable *activatable)
+{
+ g_return_val_if_fail (GTD_IS_ACTIVATABLE (activatable), NULL);
+ g_return_val_if_fail (GTD_ACTIVATABLE_GET_IFACE (activatable)->get_panels, NULL);
+
+ return GTD_ACTIVATABLE_GET_IFACE (activatable)->get_panels (activatable);
+}
+
+GList*
+gtd_activatable_get_providers (GtdActivatable *activatable)
+{
+ g_return_val_if_fail (GTD_IS_ACTIVATABLE (activatable), NULL);
+ g_return_val_if_fail (GTD_ACTIVATABLE_GET_IFACE (activatable)->get_providers, NULL);
+
+ return GTD_ACTIVATABLE_GET_IFACE (activatable)->get_providers (activatable);
+}
diff --git a/src/interfaces/gtd-activatable.h b/src/interfaces/gtd-activatable.h
new file mode 100644
index 0000000..4a14807
--- /dev/null
+++ b/src/interfaces/gtd-activatable.h
@@ -0,0 +1,46 @@
+/* gtd-activatable.h
+ *
+ * Copyright (C) 2015 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/>.
+ */
+
+#ifndef GTD_ACTIVATABLE_H
+#define GTD_ACTIVATABLE_H
+
+#include <glib.h>
+#include <libpeas/peas.h>
+
+G_BEGIN_DECLS
+
+#define GTD_TYPE_ACTIVATABLE (gtd_activatable_get_type ())
+
+G_DECLARE_INTERFACE (GtdActivatable, gtd_activatable, GTD, ACTIVATABLE, PeasActivatable)
+
+struct _GtdActivatableInterface
+{
+ PeasActivatableInterface parent;
+
+ GList* (*get_panels) (GtdActivatable *activatable);
+
+ GList* (*get_providers) (GtdActivatable *activatable);
+};
+
+GList* gtd_activatable_get_panels (GtdActivatable *activatable);
+
+GList* gtd_activatable_get_providers (GtdActivatable *activatable);
+
+G_END_DECLS
+
+#endif /* GTD_ACTIVATABLE_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]