[gnome-todo] fixup! Introduce GtdWorkspace
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] fixup! Introduce GtdWorkspace
- Date: Tue, 28 Apr 2020 17:00:03 +0000 (UTC)
commit 557fae7a84c032bb9c4cc5407844b8935f0bc0a3
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Apr 27 19:58:59 2020 -0300
fixup! Introduce GtdWorkspace
src/gnome-todo.h | 3 +-
src/interfaces/gtd-workspace.c | 73 ++++++++++++++++++++++++++++++++++++++++++
src/interfaces/gtd-workspace.h | 12 +++++++
3 files changed, 87 insertions(+), 1 deletion(-)
---
diff --git a/src/gnome-todo.h b/src/gnome-todo.h
index f09ac26..2758f80 100644
--- a/src/gnome-todo.h
+++ b/src/gnome-todo.h
@@ -1,6 +1,6 @@
/* gnome-todo.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
@@ -35,5 +35,6 @@
#include "gtd-types.h"
#include "gtd-utils.h"
#include "gtd-window.h"
+#include "gtd-workspace.h"
#endif /* GNOME_TODO_H */
diff --git a/src/interfaces/gtd-workspace.c b/src/interfaces/gtd-workspace.c
index 4d2a9a6..13652ea 100644
--- a/src/interfaces/gtd-workspace.c
+++ b/src/interfaces/gtd-workspace.c
@@ -25,6 +25,29 @@ G_DEFINE_INTERFACE (GtdWorkspace, gtd_workspace, G_TYPE_OBJECT)
static void
gtd_workspace_default_init (GtdWorkspaceInterface *iface)
{
+ /**
+ * GtdWorkspace::icon:
+ *
+ * The icon of the panel.
+ */
+ g_object_interface_install_property (iface,
+ g_param_spec_object ("icon",
+ "Icon of the workspace",
+ "The icon of the workspace",
+ G_TYPE_ICON,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GtdWorkspace::title:
+ *
+ * The user-visible title of the workspace.
+ */
+ g_object_interface_install_property (iface,
+ g_param_spec_string ("title",
+ "The title of the workspace",
+ "The title of the workspace",
+ NULL,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
}
/**
@@ -77,3 +100,53 @@ gtd_workspace_get_priority (GtdWorkspace *self)
return GTD_WORKSPACE_GET_IFACE (self)->get_priority (self);
}
+
+/**
+ * gtd_workspace_get_priority:
+ * @self: a #GtdWorkspace
+ *
+ * Retrieves the icon of @self.
+ *
+ * Returns: (transfer full): a #GIcon
+ */
+GIcon*
+gtd_workspace_get_icon (GtdWorkspace *self)
+{
+ g_return_val_if_fail (GTD_IS_WORKSPACE (self), NULL);
+ g_return_val_if_fail (GTD_WORKSPACE_GET_IFACE (self)->get_icon, NULL);
+
+ return GTD_WORKSPACE_GET_IFACE (self)->get_icon (self);
+}
+
+/**
+ * gtd_workspace_activate:
+ * @self: a #GtdWorkspace
+ *
+ * Activates @self. This happens when the workspace
+ * becomes the active workspace in the main window.
+ */
+void
+gtd_workspace_activate (GtdWorkspace *self)
+{
+ g_return_if_fail (GTD_IS_WORKSPACE (self));
+ g_return_if_fail (GTD_WORKSPACE_GET_IFACE (self)->activate);
+
+ GTD_WORKSPACE_GET_IFACE (self)->activate (self);
+}
+
+/**
+ * gtd_workspace_deactivate:
+ * @self: a #GtdWorkspace
+ *
+ * Deactivates @self. This happens when the workspace
+ * is switched away in the main window.
+ */
+void
+gtd_workspace_deactivate (GtdWorkspace *self)
+{
+ g_return_if_fail (GTD_IS_WORKSPACE (self));
+ g_return_if_fail (GTD_WORKSPACE_GET_IFACE (self)->deactivate);
+
+ GTD_WORKSPACE_GET_IFACE (self)->deactivate (self);
+}
+
diff --git a/src/interfaces/gtd-workspace.h b/src/interfaces/gtd-workspace.h
index 119d5a4..96732f6 100644
--- a/src/interfaces/gtd-workspace.h
+++ b/src/interfaces/gtd-workspace.h
@@ -36,6 +36,12 @@ struct _GtdWorkspaceInterface
const gchar* (*get_title) (GtdWorkspace *self);
gint (*get_priority) (GtdWorkspace *self);
+
+ GIcon* (*get_icon) (GtdWorkspace *self);
+
+ void (*activate) (GtdWorkspace *self);
+
+ void (*deactivate) (GtdWorkspace *self);
};
const gchar* gtd_workspace_get_id (GtdWorkspace *self);
@@ -44,4 +50,10 @@ const gchar* gtd_workspace_get_title (GtdWorkspace
gint gtd_workspace_get_priority (GtdWorkspace *self);
+GIcon* gtd_workspace_get_icon (GtdWorkspace *self);
+
+void gtd_workspace_activate (GtdWorkspace *self);
+
+void gtd_workspace_deactivate (GtdWorkspace *self);
+
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]