diff options
author | Zeeshan Ali (Khattak) <zeeshanak@gnome.org> | 2016-02-11 15:39:43 +0000 |
---|---|---|
committer | Zeeshan Ali (Khattak) <zeeshanak@gnome.org> | 2016-02-11 15:39:43 +0000 |
commit | e377787a80befa851f3d0526d41376270621f5d1 (patch) | |
tree | 46c8ea44a22970561191c3e786bf25d746774f5b | |
parent | 0925174a6915f2265fadbf5d7a9f9fa4c4ced75f (diff) | |
download | geoclue-wip/xdg-auth.tar.gz |
demo,agent: Show reason when providedwip/xdg-auth
If app provides a reason string in it's desktop file, show that to the
user.
-rw-r--r-- | demo/gclue-service-agent.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/demo/gclue-service-agent.c b/demo/gclue-service-agent.c index 1931ed8..1e214fe 100644 --- a/demo/gclue-service-agent.c +++ b/demo/gclue-service-agent.c @@ -337,11 +337,12 @@ gclue_service_agent_handle_authorize_app (GClueAgent *agent, NotificationData *data; GError *error = NULL; char *desktop_file; - GAppInfo *app_info; + GDesktopAppInfo *app_info; char *msg; + const char *reason; desktop_file = g_strjoin (".", desktop_id, "desktop", NULL); - app_info = G_APP_INFO (g_desktop_app_info_new (desktop_file)); + app_info = g_desktop_app_info_new (desktop_file); if (app_info == NULL) { g_debug ("Failed to find %s", desktop_file); gclue_agent_complete_authorize_app (agent, @@ -354,14 +355,20 @@ gclue_service_agent_handle_authorize_app (GClueAgent *agent, g_free (desktop_file); msg = g_strdup_printf (_("Allow '%s' to access your location information?"), - g_app_info_get_display_name (app_info)); + g_app_info_get_display_name (G_APP_INFO (app_info))); + reason = g_desktop_app_info_get_string (app_info, "X-Geoclue-Reason"); + if (reason != NULL) { + char *tmp = msg; + msg = g_strdup_printf ("%s\n\n%s", msg, reason); + g_free (tmp); + } notification = notify_notification_new (_("Geolocation"), msg, "dialog-question"); g_free (msg); data = g_slice_new0 (NotificationData); data->invocation = invocation; data->notification = notification; - data->app_info = app_info; + data->app_info = G_APP_INFO (app_info); data->accuracy_level = accuracy_level; notify_notification_add_action (notification, |