Merge lp:~justinmcp/libunity-webapps/matching-fixes-13.10 into lp:libunity-webapps/13.10

Proposed by Justin McPherson
Status: Merged
Approved by: Robert Bruce Park
Approved revision: 1240
Merged at revision: 1238
Proposed branch: lp:~justinmcp/libunity-webapps/matching-fixes-13.10
Merge into: lp:libunity-webapps/13.10
Diff against target: 60 lines (+19/-10)
1 file modified
src/context-daemon/unity-webapps-application-info.c (+19/-10)
To merge this branch: bzr merge lp:~justinmcp/libunity-webapps/matching-fixes-13.10
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
WebApps Pending
Review via email: mp+206346@code.launchpad.net

Commit message

Fix some of the matching problems.

Description of the change

Fix some of the matching problems.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
David Barth (dbarth) wrote :

Good sanity checks.

Could you add a unit test for that to: tests/context-daemon/test-application-info.c
(the chmod call can be mocked up)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/context-daemon/unity-webapps-application-info.c'
2--- src/context-daemon/unity-webapps-application-info.c 2013-09-24 12:42:42 +0000
3+++ src/context-daemon/unity-webapps-application-info.c 2014-02-14 07:16:36 +0000
4@@ -20,6 +20,7 @@
5
6 #include <string.h>
7 #include <gio/gio.h>
8+#include <glib/gstdio.h>
9 #include <libsoup/soup.h>
10
11 #include "unity-webapps-application-info.h"
12@@ -300,14 +301,18 @@
13 gchar *
14 unity_webapps_application_info_get_desktop_icon_name (UnityWebappsApplicationInfo *info, gboolean check_themed)
15 {
16- gchar *canonical_name, *icon_name;
17-
18- canonical_name = unity_webapps_application_info_get_canonical_name (info);
19-
20- icon_name = g_strdup_printf("%s-%s", canonical_name, info->priv->domain);
21-
22- g_free (canonical_name);
23-
24+ gchar *icon_name;
25+
26+ // Strip icon://
27+ if (g_str_has_prefix(info->priv->icon_url, "icon://"))
28+ {
29+ icon_name = g_strdup(info->priv->icon_url + 7); // sizeof(icon://)
30+ }
31+ else
32+ {
33+ icon_name = g_strdup(info->priv->icon_url);
34+ }
35+
36 return icon_name;
37 }
38
39@@ -344,7 +349,7 @@
40 gchar **labels, **pages, **il, **ip;
41 gchar *contents, *icon_name, *mime_types;
42 gchar *name = unity_webapps_string_utils_canonicalize_string (info->priv->name, TRUE);
43- gchar *base64_name = g_base64_encode ((guchar*)info->priv->name, strlen (info->priv->name) + 1);
44+ gchar *base64_name = g_base64_encode ((guchar*)info->priv->name, strlen (info->priv->name));
45 gchar *domain = info->priv->domain ? info->priv->domain : "";
46 gchar *desktop_id = unity_webapps_desktop_infos_build_desktop_basename (name, domain);
47
48@@ -409,7 +414,11 @@
49 desktop_file_contents = unity_webapps_application_info_get_desktop_file_contents (info);
50
51 success = g_file_set_contents (desktop_file_path, desktop_file_contents, -1, error);
52-
53+ if (success == TRUE)
54+ {
55+ g_chmod(desktop_file_path, 0744);
56+ }
57+
58 UNITY_WEBAPPS_NOTE (APPLICATION_INFO, "Wrote desktop file: %s", desktop_file_path);
59
60 g_free (desktop_file_contents);

Subscribers

People subscribed via source and target branches

to all changes: