[gnome-todo] panel: Add new 'activate' method
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] panel: Add new 'activate' method
- Date: Sun, 9 Jun 2019 19:51:56 +0000 (UTC)
commit bbfdd701fba2373130aeedd688c3d4d5f228c7ac
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sun Jun 9 01:01:58 2019 -0300
panel: Add new 'activate' method
This method will be used to activate the panel with the
ability to pass properties.
src/interfaces/gtd-panel.c | 34 +++++++++++++++++++++++++++++++++-
src/interfaces/gtd-panel.h | 6 ++++++
2 files changed, 39 insertions(+), 1 deletion(-)
---
diff --git a/src/interfaces/gtd-panel.c b/src/interfaces/gtd-panel.c
index 923ed8b..5c1b5df 100644
--- a/src/interfaces/gtd-panel.c
+++ b/src/interfaces/gtd-panel.c
@@ -265,7 +265,7 @@ gtd_panel_get_priority (GtdPanel *self)
/**
* gtd_panel_get_subtitle:
- * @panel: a #GtdPanel
+ * @self: a #GtdPanel
*
* Retrieves the subtitle of @panel
*
@@ -279,3 +279,35 @@ gtd_panel_get_subtitle (GtdPanel *self)
return GTD_PANEL_GET_IFACE (self)->get_subtitle (self);
}
+
+/**
+ * gtd_panel_activate:
+ * @self: a #GtdPanel
+ * @parameters: (nullable): parameters of the panel
+ *
+ * Activates the panel with @parameters. The passed parameters
+ * are in free form, to allow panels have any input they want.
+ *
+ * This is an optional vfunc.
+ */
+void
+gtd_panel_activate (GtdPanel *self,
+ GVariant *parameters)
+{
+
+ g_return_if_fail (GTD_IS_PANEL (self));
+
+ if (GTD_PANEL_GET_IFACE (self)->activate)
+ {
+ g_autofree gchar *formatted_params = NULL;
+
+ if (parameters)
+ formatted_params = g_variant_print (parameters, TRUE);
+
+ g_debug ("Activating %s with parameters %s",
+ G_OBJECT_TYPE_NAME (self),
+ formatted_params);
+
+ GTD_PANEL_GET_IFACE (self)->activate (self, parameters);
+ }
+}
diff --git a/src/interfaces/gtd-panel.h b/src/interfaces/gtd-panel.h
index 49cb02c..787a0e3 100644
--- a/src/interfaces/gtd-panel.h
+++ b/src/interfaces/gtd-panel.h
@@ -48,6 +48,9 @@ struct _GtdPanelInterface
guint32 (*get_priority) (GtdPanel *self);
gchar* (*get_subtitle) (GtdPanel *self);
+
+ void (*activate) (GtdPanel *self,
+ GVariant *parameters);
};
const gchar* gtd_panel_get_panel_name (GtdPanel *panel);
@@ -66,6 +69,9 @@ guint32 gtd_panel_get_priority (GtdPanel
gchar* gtd_panel_get_subtitle (GtdPanel *self);
+void gtd_panel_activate (GtdPanel *self,
+ GVariant *parameters);
+
G_END_DECLS
#endif /* GTD_PANEL_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]