[gnome-todo] Introduce GtdWorkspace
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] Introduce GtdWorkspace
- Date: Tue, 28 Apr 2020 16:59:47 +0000 (UTC)
commit 902485b41a7ba8a988201bb350cc9debcbce76c5
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Apr 27 01:24:05 2020 -0300
Introduce GtdWorkspace
A workspace is a container to a set of widgetries,
and is in a higher level than panels. GNOME To Do
will ship a default task list workspace, plugins
will be able to add more with incoming GtdManager
API.
src/gtd-types.h | 3 +-
src/interfaces/gtd-workspace.c | 79 ++++++++++++++++++++++++++++++++++++++++++
src/interfaces/gtd-workspace.h | 47 +++++++++++++++++++++++++
src/meson.build | 4 +++
4 files changed, 132 insertions(+), 1 deletion(-)
---
diff --git a/src/gtd-types.h b/src/gtd-types.h
index 9d91b5e..47f441f 100644
--- a/src/gtd-types.h
+++ b/src/gtd-types.h
@@ -1,6 +1,6 @@
/* gtd-types.h
*
- * Copyright (C) 2015 Georges Basile Stavracas Neto <georges stavracas gmail com>
+ * Copyright (C) 2015-2020 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
@@ -48,6 +48,7 @@ typedef struct _GtdTaskList GtdTaskList;
typedef struct _GtdTaskListItem GtdTaskListItem;
typedef struct _GtdTaskRow GtdTaskRow;
typedef struct _GtdWindow GtdWindow;
+typedef struct _GtdWorkspace GtdWorkspace;
G_END_DECLS
diff --git a/src/interfaces/gtd-workspace.c b/src/interfaces/gtd-workspace.c
new file mode 100644
index 0000000..4d2a9a6
--- /dev/null
+++ b/src/interfaces/gtd-workspace.c
@@ -0,0 +1,79 @@
+/* gtd-workspace.c
+ *
+ * Copyright 2020 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/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#include "gtd-workspace.h"
+
+G_DEFINE_INTERFACE (GtdWorkspace, gtd_workspace, G_TYPE_OBJECT)
+
+static void
+gtd_workspace_default_init (GtdWorkspaceInterface *iface)
+{
+}
+
+/**
+ * gtd_workspace_get_id:
+ * @self: a #GtdWorkspace
+ *
+ * Retrieves the id of @self.
+ *
+ * Returns: the id of @self
+ */
+const gchar*
+gtd_workspace_get_id (GtdWorkspace *self)
+{
+ g_return_val_if_fail (GTD_IS_WORKSPACE (self), NULL);
+ g_return_val_if_fail (GTD_WORKSPACE_GET_IFACE (self)->get_id, NULL);
+
+ return GTD_WORKSPACE_GET_IFACE (self)->get_id (self);
+}
+
+/**
+ * gtd_workspace_get_title:
+ * @self: a #GtdWorkspace
+ *
+ * Retrieves the title of @self.
+ *
+ * Returns: the title of @self
+ */
+const gchar*
+gtd_workspace_get_title (GtdWorkspace *self)
+{
+ g_return_val_if_fail (GTD_IS_WORKSPACE (self), NULL);
+ g_return_val_if_fail (GTD_WORKSPACE_GET_IFACE (self)->get_title, NULL);
+
+ return GTD_WORKSPACE_GET_IFACE (self)->get_title (self);
+}
+
+/**
+ * gtd_workspace_get_priority:
+ * @self: a #GtdWorkspace
+ *
+ * Retrieves the priority of @self.
+ *
+ * Returns: the priority of @self
+ */
+gint
+gtd_workspace_get_priority (GtdWorkspace *self)
+{
+ g_return_val_if_fail (GTD_IS_WORKSPACE (self), 0);
+ g_return_val_if_fail (GTD_WORKSPACE_GET_IFACE (self)->get_priority, 0);
+
+ return GTD_WORKSPACE_GET_IFACE (self)->get_priority (self);
+}
diff --git a/src/interfaces/gtd-workspace.h b/src/interfaces/gtd-workspace.h
new file mode 100644
index 0000000..119d5a4
--- /dev/null
+++ b/src/interfaces/gtd-workspace.h
@@ -0,0 +1,47 @@
+/* gtd-workspace.h
+ *
+ * Copyright 2020 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/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GTD_TYPE_WORKSPACE (gtd_workspace_get_type ())
+G_DECLARE_INTERFACE (GtdWorkspace, gtd_workspace, GTD, WORKSPACE, GtkWidget)
+
+struct _GtdWorkspaceInterface
+{
+ GTypeInterface parent;
+
+ const gchar* (*get_id) (GtdWorkspace *self);
+
+ const gchar* (*get_title) (GtdWorkspace *self);
+
+ gint (*get_priority) (GtdWorkspace *self);
+};
+
+const gchar* gtd_workspace_get_id (GtdWorkspace *self);
+
+const gchar* gtd_workspace_get_title (GtdWorkspace *self);
+
+gint gtd_workspace_get_priority (GtdWorkspace *self);
+
+G_END_DECLS
diff --git a/src/meson.build b/src/meson.build
index 9b28171..80e1a1a 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -19,6 +19,7 @@ headers = enum_headers + files(
'interfaces/gtd-activatable.h',
'interfaces/gtd-panel.h',
'interfaces/gtd-provider.h',
+ 'interfaces/gtd-workspace.h',
'models/gtd-list-model-filter.h',
'models/gtd-list-store.h',
'notification/gtd-notification.h',
@@ -46,6 +47,7 @@ sources = files(
'interfaces/gtd-activatable.c',
'interfaces/gtd-panel.c',
'interfaces/gtd-provider.c',
+ 'interfaces/gtd-workspace.c',
'logging/gtd-log.c',
'models/gtd-list-model-filter.c',
'models/gtd-list-model-sort.c',
@@ -233,6 +235,8 @@ if get_option('introspection')
'interfaces/gtd-panel.h',
'interfaces/gtd-provider.c',
'interfaces/gtd-provider.h',
+ 'interfaces/gtd-workspace.c',
+ 'interfaces/gtd-workspace.h',
'models/gtd-list-model-filter.c',
'models/gtd-list-model-filter.h',
'models/gtd-list-store.c',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]