summaryrefslogtreecommitdiff
path: root/mission-control-plugins
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-11-14 15:26:18 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-01-29 19:28:30 +0000
commit927db6c1644e8cc5843f0c7ff0a39b4f5736d152 (patch)
treeae8f73f69cc85884b1d0e4abdf32f660c8ec8056 /mission-control-plugins
parentcb5879dda2daedee866f1f516c952c33e4728560 (diff)
mcp_account_storage_set_*: return whether anything changed
The plugins are better-placed to do this than McdStorage: they know their own storage format, after all. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=27727
Diffstat (limited to 'mission-control-plugins')
-rw-r--r--mission-control-plugins/account-storage.c23
-rw-r--r--mission-control-plugins/account-storage.h16
2 files changed, 26 insertions, 13 deletions
diff --git a/mission-control-plugins/account-storage.c b/mission-control-plugins/account-storage.c
index 098e336f..ca9c7fa8 100644
--- a/mission-control-plugins/account-storage.c
+++ b/mission-control-plugins/account-storage.c
@@ -196,7 +196,7 @@ default_get_restrictions (const McpAccountStorage *storage,
return 0;
}
-static gboolean
+static McpAccountStorageSetResult
default_set_attribute (McpAccountStorage *storage,
McpAccountManager *am,
const gchar *account,
@@ -204,10 +204,10 @@ default_set_attribute (McpAccountStorage *storage,
GVariant *value,
McpAttributeFlags flags)
{
- return FALSE;
+ return MCP_ACCOUNT_STORAGE_SET_RESULT_FAILED;
}
-static gboolean
+static McpAccountStorageSetResult
default_set_parameter (McpAccountStorage *storage,
McpAccountManager *am,
const gchar *account,
@@ -215,7 +215,7 @@ default_set_parameter (McpAccountStorage *storage,
GVariant *value,
McpParameterFlags flags)
{
- return FALSE;
+ return MCP_ACCOUNT_STORAGE_SET_RESULT_FAILED;
}
static void
@@ -521,7 +521,7 @@ mcp_account_storage_get (const McpAccountStorage *storage,
*
* Since: 5.15.0
*/
-gboolean
+McpAccountStorageSetResult
mcp_account_storage_set_attribute (McpAccountStorage *storage,
McpAccountManager *am,
const gchar *account,
@@ -532,8 +532,10 @@ mcp_account_storage_set_attribute (McpAccountStorage *storage,
McpAccountStorageIface *iface = MCP_ACCOUNT_STORAGE_GET_IFACE (storage);
SDEBUG (storage, "");
- g_return_val_if_fail (iface != NULL, FALSE);
- g_return_val_if_fail (iface->set_attribute != NULL, FALSE);
+ g_return_val_if_fail (iface != NULL,
+ MCP_ACCOUNT_STORAGE_SET_RESULT_FAILED);
+ g_return_val_if_fail (iface->set_attribute != NULL,
+ MCP_ACCOUNT_STORAGE_SET_RESULT_FAILED);
return iface->set_attribute (storage, am, account, attribute, value, flags);
}
@@ -565,7 +567,7 @@ mcp_account_storage_set_attribute (McpAccountStorage *storage,
*
* Since: 5.15.0
*/
-gboolean
+McpAccountStorageSetResult
mcp_account_storage_set_parameter (McpAccountStorage *storage,
McpAccountManager *am,
const gchar *account,
@@ -577,7 +579,10 @@ mcp_account_storage_set_parameter (McpAccountStorage *storage,
SDEBUG (storage, "");
g_return_val_if_fail (iface != NULL, FALSE);
- g_return_val_if_fail (iface->set_parameter != NULL, FALSE);
+ g_return_val_if_fail (iface != NULL,
+ MCP_ACCOUNT_STORAGE_SET_RESULT_FAILED);
+ g_return_val_if_fail (iface->set_parameter != NULL,
+ MCP_ACCOUNT_STORAGE_SET_RESULT_FAILED);
return iface->set_parameter (storage, am, account, parameter, value, flags);
}
diff --git a/mission-control-plugins/account-storage.h b/mission-control-plugins/account-storage.h
index 44f7bd63..3a8766e3 100644
--- a/mission-control-plugins/account-storage.h
+++ b/mission-control-plugins/account-storage.h
@@ -32,6 +32,12 @@ G_BEGIN_DECLS
#define MCP_ACCOUNT_STORAGE_PLUGIN_PRIO_NORMAL 100
#define MCP_ACCOUNT_STORAGE_PLUGIN_PRIO_KEYRING 10000
+typedef enum {
+ MCP_ACCOUNT_STORAGE_SET_RESULT_FAILED = 0,
+ MCP_ACCOUNT_STORAGE_SET_RESULT_CHANGED,
+ MCP_ACCOUNT_STORAGE_SET_RESULT_UNCHANGED
+} McpAccountStorageSetResult;
+
/* API for plugins to implement */
typedef struct _McpAccountStorage McpAccountStorage;
typedef struct _McpAccountStorageIface McpAccountStorageIface;
@@ -124,13 +130,13 @@ struct _McpAccountStorageIface
McpAccountStorageCreate create;
/* Since 5.15.0 */
- gboolean (*set_attribute) (McpAccountStorage *storage,
+ McpAccountStorageSetResult (*set_attribute) (McpAccountStorage *storage,
McpAccountManager *am,
const gchar *account,
const gchar *attribute,
GVariant *val,
McpAttributeFlags flags);
- gboolean (*set_parameter) (McpAccountStorage *storage,
+ McpAccountStorageSetResult (*set_parameter) (McpAccountStorage *storage,
McpAccountManager *am,
const gchar *account,
const gchar *parameter,
@@ -190,13 +196,15 @@ const gchar *mcp_account_storage_name (const McpAccountStorage *storage);
const gchar *mcp_account_storage_description (const McpAccountStorage *storage);
const gchar *mcp_account_storage_provider (const McpAccountStorage *storage);
-gboolean mcp_account_storage_set_attribute (McpAccountStorage *storage,
+McpAccountStorageSetResult mcp_account_storage_set_attribute (
+ McpAccountStorage *storage,
McpAccountManager *am,
const gchar *account,
const gchar *attribute,
GVariant *value,
McpAttributeFlags flags);
-gboolean mcp_account_storage_set_parameter (McpAccountStorage *storage,
+McpAccountStorageSetResult mcp_account_storage_set_parameter (
+ McpAccountStorage *storage,
McpAccountManager *am,
const gchar *account,
const gchar *parameter,