Commit e0f2d0be authored by Zeeshan Ali's avatar Zeeshan Ali

config: Ability to mark app as system component

If set to 'true', it means that app is more a part of system than an
app-app. You know what I mean. :)

Also mark gnome-datetime-panel as system component.
parent c3f55aae
......@@ -44,18 +44,24 @@ submission-nick=geoclue
# # Allowed access to location information?
# allowed=true|false
#
# # Is application a system component?
# system=true|false
#
# # List of UIDs of all users for which this application is allowed location
# # info access, separate by ';'. Keep it empty for allowing it for all users.
# users=
[gnome-datetime-panel]
allowed=true
system=true
users=
[epiphany]
allowed=true
system=false
users=
[firefox]
allowed=true
system=false
users=
......@@ -34,6 +34,7 @@ typedef struct
{
char *id;
gboolean allowed;
gboolean system;
int* users;
gsize num_users;
} AppConfig;
......@@ -123,7 +124,7 @@ load_app_configs (GClueConfig *config)
AppConfig *app_config;
int* users;
gsize num_users = 0, j;
gboolean allowed;
gboolean allowed, system;
gboolean ignore = FALSE;
GError *error = NULL;
......@@ -144,6 +145,13 @@ load_app_configs (GClueConfig *config)
if (error != NULL)
goto error_out;
system = g_key_file_get_boolean (priv->key_file,
groups[i],
"system",
&error);
if (error != NULL)
goto error_out;
users = g_key_file_get_integer_list (priv->key_file,
groups[i],
"users",
......@@ -155,6 +163,7 @@ load_app_configs (GClueConfig *config)
app_config = g_slice_new0 (AppConfig);
app_config->id = g_strdup (groups[i]);
app_config->allowed = allowed;
app_config->system = system;
app_config->users = users;
app_config->num_users = num_users;
......@@ -315,6 +324,27 @@ gclue_config_is_app_allowed (GClueConfig *config,
return FALSE;
}
gboolean
gclue_config_is_system_component (GClueConfig *config,
const char *desktop_id)
{
GClueConfigPrivate *priv = config->priv;
GList *node;
AppConfig *app_config = NULL;
g_return_val_if_fail (desktop_id != NULL, FALSE);
for (node = priv->app_configs; node != NULL; node = node->next) {
if (strcmp (((AppConfig *) node->data)->id, desktop_id) == 0) {
app_config = (AppConfig *) node->data;
break;
}
}
return (app_config != NULL || app_config->system);
}
const char *
gclue_config_get_wifi_url (GClueConfig *config)
{
......
......@@ -64,6 +64,8 @@ gboolean gclue_config_is_agent_allowed (GClueConfig *config,
gboolean gclue_config_is_app_allowed (GClueConfig *config,
const char *desktop_id,
GClueClientInfo *app_info);
gboolean gclue_config_is_system_component (GClueConfig *config,
const char *desktop_id);
const char * gclue_config_get_wifi_url (GClueConfig *config);
const char * gclue_config_get_wifi_submit_url (GClueConfig *config);
const char * gclue_config_get_wifi_submit_nick (GClueConfig *config);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment