Merge lp:~ted/url-dispatcher/searchable-packages into lp:url-dispatcher/13.10

Proposed by Ted Gould
Status: Merged
Approved by: Ted Gould
Approved revision: 54
Merged at revision: 36
Proposed branch: lp:~ted/url-dispatcher/searchable-packages
Merge into: lp:url-dispatcher/13.10
Prerequisite: lp:~ted/url-dispatcher/app-id-url
Diff against target: 159 lines (+41/-3)
3 files modified
service/dispatcher.c (+29/-1)
tests/CMakeLists.txt (+4/-1)
tests/app-id-test.cc (+8/-1)
To merge this branch: bzr merge lp:~ted/url-dispatcher/searchable-packages
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Charles Kerr (community) Approve
Review via email: mp+189437@code.launchpad.net

Commit message

Allow custom URIs to have variable based package specifications

Description of the change

Makes it so that we can use the AppId style URL searching along with custom URIs.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
54. By Ted Gould

Merge trunk to resolve conflicts

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'service/dispatcher.c'
2--- service/dispatcher.c 2013-10-08 16:56:54 +0000
3+++ service/dispatcher.c 2013-10-08 19:18:22 +0000
4@@ -337,22 +337,37 @@
5 gchar * regex_patern;
6 GRegex * regex_object;
7 gchar * app_id;
8+ gchar * package;
9+ gchar * application;
10+ gchar * version;
11 };
12
13 #define USERNAME_REGEX "[a-zA-Z0-9_\\-]*"
14
15 /* TODO: Make these come from registrations, but this works for now */
16 url_type_t url_types[] = {
17+#ifdef APP_ID_TEST_URI
18+ {
19+ .regex_patern = "^appidtest:///",
20+ .regex_object = NULL,
21+ .package = "com.test.good",
22+ .application = "first-listed-app",
23+ .version = "current-user-version",
24+ .app_id = NULL
25+ },
26+#endif
27 /* Alarms */
28 {
29 .regex_patern = "^alarm:///",
30 .regex_object = NULL,
31+ .package = NULL, .application = NULL, .version = NULL,
32 .app_id = "ubuntu-clock-app"
33 },
34 /* Address Book */
35 {
36 .regex_patern = "^addressbook:///",
37 .regex_object = NULL,
38+ .package = NULL, .application = NULL, .version = NULL,
39 .app_id = "address-book-app"
40 },
41 /* Calendar */
42@@ -365,53 +380,62 @@
43 {
44 .regex_patern = "^message:///",
45 .regex_object = NULL,
46+ .package = NULL, .application = NULL, .version = NULL,
47 .app_id = "messaging-app"
48 },
49 /* Music */
50 {
51 .regex_patern = "^music:///",
52 .regex_object = NULL,
53+ .package = NULL, .application = NULL, .version = NULL,
54 .app_id = "music-app"
55 },
56 {
57 /* TODO: This is temporary for 13.10, we expect to be smarter in the future */
58 .regex_patern = "^file:///home/" USERNAME_REGEX "/Music/",
59 .regex_object = NULL,
60+ .package = NULL, .application = NULL, .version = NULL,
61 .app_id = "music-app"
62 },
63 /* Phone Numbers */
64 {
65 .regex_patern = "^tel:///[\\d\\.+x,\\(\\)-]*$",
66 .regex_object = NULL,
67+ .package = NULL, .application = NULL, .version = NULL,
68 .app_id = "dialer-app"
69 },
70 /* Settings */
71 {
72 .regex_patern = "^settings:///system/",
73 .regex_object = NULL,
74+ .package = NULL, .application = NULL, .version = NULL,
75 .app_id = "ubuntu-system-settings"
76 },
77 /* Video */
78 {
79 .regex_patern = "^video:///",
80 .regex_object = NULL,
81+ .package = NULL, .application = NULL, .version = NULL,
82 .app_id = "mediaplayer-app"
83 },
84 {
85 /* TODO: This is temporary for 13.10, we expect to be smarter in the future */
86 .regex_patern = "^file:///home/" USERNAME_REGEX "/Videos/",
87 .regex_object = NULL,
88+ .package = NULL, .application = NULL, .version = NULL,
89 .app_id = "mediaplayer-app"
90 },
91 /* Web Stuff */
92 {
93 .regex_patern = "^http://",
94 .regex_object = NULL,
95+ .package = NULL, .application = NULL, .version = NULL,
96 .app_id = "webbrowser-app"
97 },
98 {
99 .regex_patern = "^https://",
100 .regex_object = NULL,
101+ .package = NULL, .application = NULL, .version = NULL,
102 .app_id = "webbrowser-app"
103 }
104 };
105@@ -477,7 +501,11 @@
106 }
107
108 if (g_regex_match(url_types[i].regex_object, url, 0, NULL)) {
109- pass_url_to_app(url_types[i].app_id, url);
110+ if (url_types[i].app_id != NULL) {
111+ pass_url_to_app(url_types[i].app_id, url);
112+ } else {
113+ app_id_discover(url_types[i].package, url_types[i].application, url_types[i].version, url);
114+ }
115
116 return TRUE;
117 }
118
119=== modified file 'tests/CMakeLists.txt'
120--- tests/CMakeLists.txt 2013-09-26 19:56:16 +0000
121+++ tests/CMakeLists.txt 2013-10-08 19:18:22 +0000
122@@ -42,9 +42,12 @@
123 # App ID URL test
124 ###########################
125
126+include_directories("${CMAKE_BINARY_DIR}/service")
127+
128 add_definitions ( -DCMAKE_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}" )
129+add_definitions ( -DAPP_ID_TEST_URI=1 )
130
131-add_executable (app-id-test app-id-test.cc)
132+add_executable (app-id-test app-id-test.cc "${CMAKE_SOURCE_DIR}/service/dispatcher.c")
133 target_link_libraries (app-id-test
134 dispatcher-lib
135 mock-lib
136
137=== modified file 'tests/app-id-test.cc'
138--- tests/app-id-test.cc 2013-09-26 20:46:56 +0000
139+++ tests/app-id-test.cc 2013-10-08 19:18:22 +0000
140@@ -119,6 +119,14 @@
141 return;
142 }
143
144+TEST_F(AppIdTest, CustomUri)
145+{
146+ /* Good sanity check */
147+ ASSERT_TRUE(dispatch_url("appidtest:///foo"));
148+ ASSERT_STREQ("com.test.good_app1_1.2.3", upstart_app_launch_mock_get_last_app_id());
149+ upstart_app_launch_mock_clear_last_app_id();
150+}
151+
152 TEST_F(AppIdTest, BadDirectory)
153 {
154 g_setenv("URL_DISPATCHER_TEST_CLICK_DIR", CMAKE_SOURCE_DIR "/not-a-real-directory/", TRUE);
155@@ -138,4 +146,3 @@
156 ASSERT_TRUE(NULL == upstart_app_launch_mock_get_last_app_id());
157 upstart_app_launch_mock_clear_last_app_id();
158 }
159-

Subscribers

People subscribed via source and target branches