[gnome-todo] provider: Add "refresh" vfunc
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] provider: Add "refresh" vfunc
- Date: Sun, 31 Mar 2019 00:12:39 +0000 (UTC)
commit 78a15ecd4972c7f8cc21d26f3a9ca08128dddcb4
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sat Mar 30 20:38:31 2019 -0300
provider: Add "refresh" vfunc
This is an optional vfunc that forces a refresh
on the provider.
src/interfaces/gtd-provider.c | 20 ++++++++++++++++++++
src/interfaces/gtd-provider.h | 4 ++++
2 files changed, 24 insertions(+)
---
diff --git a/src/interfaces/gtd-provider.c b/src/interfaces/gtd-provider.c
index 619724a..85d0279 100644
--- a/src/interfaces/gtd-provider.c
+++ b/src/interfaces/gtd-provider.c
@@ -287,6 +287,26 @@ gtd_provider_get_enabled (GtdProvider *provider)
return GTD_PROVIDER_GET_IFACE (provider)->get_enabled (provider);
}
+/**
+ * gtd_provider_refresh:
+ * @provider: a #GtdProvider
+ *
+ * Asks the provider to refresh. Online providers may want to
+ * synchronize tasks and tasklists, credentials, etc, when this
+ * is called.
+ *
+ * This is an optional feature. Providers that do not implement
+ * the "refresh" vfunc will be ignored.
+ */
+void
+gtd_provider_refresh (GtdProvider *provider)
+{
+ g_return_if_fail (GTD_IS_PROVIDER (provider));
+
+ if (GTD_PROVIDER_GET_IFACE (provider)->refresh)
+ GTD_PROVIDER_GET_IFACE (provider)->refresh (provider);
+}
+
/**
* gtd_provider_get_icon:
* @provider: a #GtdProvider
diff --git a/src/interfaces/gtd-provider.h b/src/interfaces/gtd-provider.h
index 90cf24b..ce77a57 100644
--- a/src/interfaces/gtd-provider.h
+++ b/src/interfaces/gtd-provider.h
@@ -46,6 +46,8 @@ struct _GtdProviderInterface
gboolean (*get_enabled) (GtdProvider *provider);
+ void (*refresh) (GtdProvider *provider);
+
/* Customs */
GIcon* (*get_icon) (GtdProvider *provider);
@@ -89,6 +91,8 @@ const gchar* gtd_provider_get_description (GtdProvider
gboolean gtd_provider_get_enabled (GtdProvider *provider);
+void gtd_provider_refresh (GtdProvider *provider);
+
GIcon* gtd_provider_get_icon (GtdProvider *provider);
void gtd_provider_create_task (GtdProvider *provider,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]