Merge lp:~abreu-alexandre/bamf/remove-webapps-deps into lp:bamf
- remove-webapps-deps
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Marco Trevisan (Treviño) | ||||
Approved revision: | 600 | ||||
Merged at revision: | 598 | ||||
Proposed branch: | lp:~abreu-alexandre/bamf/remove-webapps-deps | ||||
Merge into: | lp:bamf | ||||
Diff against target: |
1571 lines (+1/-1397) 12 files modified
configure.ac (+0/-17) debian/control (+0/-1) src/Makefile.am (+0/-21) src/bamf-matcher-private.h (+0/-4) src/bamf-matcher.c (+1/-117) src/bamf-unity-webapps-application.c (+0/-339) src/bamf-unity-webapps-application.h (+0/-63) src/bamf-unity-webapps-observer.c (+0/-278) src/bamf-unity-webapps-observer.h (+0/-54) src/bamf-unity-webapps-tab.c (+0/-427) src/bamf-unity-webapps-tab.h (+0/-62) tests/bamfdaemon/Makefile.am (+0/-14) |
||||
To merge this branch: | bzr merge lp:~abreu-alexandre/bamf/remove-webapps-deps | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Marco Trevisan (Treviño) | Approve | ||
David Barth (community) | Approve | ||
Robert Bruce Park (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+214617@code.launchpad.net |
Commit message
Rip out vestigial webapps code (LP: #1280337)
Description of the change
Remove dependancies on libunity-webapps and further usages of this lib.
libunity-webapps is not used anymore since all the old browser tab integration bit has been moved to a standalone container and does not need special treatment from bamf (beside some bits to handle the common webapp launcher).
PS Jenkins bot (ps-jenkins) wrote : | # |
Robert Bruce Park (robru) wrote : | # |
Oh my god, all this red is giving me a nerdgasm! I'm putting this in a silo ASAP
Robert Bruce Park (robru) wrote : | # |
debian/control looks good to me at least. can't speak for the rest of it though
Robert Bruce Park (robru) wrote : | # |
Built this in silo 11, tested, confirmed that with this installed, bamf continues to function, and it's possible to uninstall webbrowser-app without taking out unity with it.
David Barth (dbarth) : | # |
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
All these things must not be removed, othewise chromium web-apps will stop working:
135 -is_web_app_window (BamfLegacyWindow *window)
177 - skip_hint_set = is_libreoffice_
185 {
186 - if (is_web_app_window (window))
187 - {
188 - // This ensures that a new application is created even for unknown webapps
189 - filter_by_wmclass = TRUE;
190 - }
191 - else
192 - {
193 - target_class = class_name;
194 - filter_by_wmclass = bamf_matcher_
195 - }
196 + target_class = class_name;
197 + filter_by_wmclass = bamf_matcher_
As said, also, it would be nice to provide changes for libbamf as well not to make it to do anything, but warn about the fact these APIs are deprecated. And at the same way, deprecate all the methods into the headers, providing also a branch for unity.
Alexandre Abreu (abreu-alexandre) wrote : | # |
> All these things must not be removed, othewise chromium web-apps will stop
> working:
>
> 135 -is_web_app_window (BamfLegacyWindow *window)
>
> 177 - skip_hint_set = is_libreoffice_
> (window) || is_javaws_window (window);
>
> 185 {
> 186 - if (is_web_app_window (window))
> 187 - {
> 188 - // This ensures that a new application is created even for unknown
> webapps
> 189 - filter_by_wmclass = TRUE;
> 190 - }
> 191 - else
> 192 - {
> 193 - target_class = class_name;
> 194 - filter_by_wmclass = bamf_matcher_
> (self, target_class);
> 195 - }
> 196 + target_class = class_name;
> 197 + filter_by_wmclass = bamf_matcher_
> (self, target_class);
>
done
> As said, also, it would be nice to provide changes for libbamf as well not to
> make it to do anything, but warn about the fact these APIs are deprecated. And
> at the same way, deprecate all the methods into the headers, providing also a
> branch for unity.
we agreed, to do it in a second step to lower the risks since we would be playing
w/ libbamf & unity and it is a bit scary at this point in the cycle,
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Ok, it looks fine to me now.
Please, provide an unity branch to remove the unneeded webapp related calls as soon as you can.
Thanks.
Preview Diff
1 | === modified file 'configure.ac' | |||
2 | --- configure.ac 2013-08-30 17:05:52 +0000 | |||
3 | +++ configure.ac 2014-04-08 14:38:15 +0000 | |||
4 | @@ -91,22 +91,6 @@ | |||
5 | 91 | GTK_DOC_CHECK(1.0) | 91 | GTK_DOC_CHECK(1.0) |
6 | 92 | 92 | ||
7 | 93 | ########################### | 93 | ########################### |
8 | 94 | # libunity_webapps | ||
9 | 95 | ########################### | ||
10 | 96 | AC_ARG_ENABLE([webapps], | ||
11 | 97 | AS_HELP_STRING([--enable-webapps], | ||
12 | 98 | [Enable libunity-webapps support]), | ||
13 | 99 | [enable_webapps=$enableval], | ||
14 | 100 | [enable_webapps=yes]) | ||
15 | 101 | if test "x$enable_webapps" = "xyes"; then | ||
16 | 102 | PKG_CHECK_MODULES(LIBUNITY_WEBAPPS, libunity_webapps-0.2) | ||
17 | 103 | AC_DEFINE_UNQUOTED(HAVE_WEBAPPS, , [Use libunity-webapps]) | ||
18 | 104 | fi | ||
19 | 105 | AM_CONDITIONAL([HAVE_WEBAPPS], [test "x$enable_webapps" = "xyes"]) | ||
20 | 106 | AC_SUBST(LIBUNITY_WEBAPPS_CFLAGS) | ||
21 | 107 | AC_SUBST(LIBUNITY_WEBAPPS_LIBS) | ||
22 | 108 | |||
23 | 109 | ########################### | ||
24 | 110 | # gtester2xunit checks # | 94 | # gtester2xunit checks # |
25 | 111 | ########################### | 95 | ########################### |
26 | 112 | 96 | ||
27 | @@ -184,7 +168,6 @@ | |||
28 | 184 | Build Environment | 168 | Build Environment |
29 | 185 | Install Prefix: ${prefix} | 169 | Install Prefix: ${prefix} |
30 | 186 | Introspection: ${enable_introspection} | 170 | Introspection: ${enable_introspection} |
31 | 187 | Unity Webapps: ${enable_webapps} | ||
32 | 188 | Headless tests: ${enable_headless_tests} | 171 | Headless tests: ${enable_headless_tests} |
33 | 189 | Coverage Reporting: ${use_gcov} | 172 | Coverage Reporting: ${use_gcov} |
34 | 190 | 173 | ||
35 | 191 | 174 | ||
36 | === modified file 'debian/control' | |||
37 | --- debian/control 2013-08-21 09:01:10 +0000 | |||
38 | +++ debian/control 2014-04-08 14:38:15 +0000 | |||
39 | @@ -11,7 +11,6 @@ | |||
40 | 11 | libglib2.0-dev (>= 2.32.0), | 11 | libglib2.0-dev (>= 2.32.0), |
41 | 12 | libgtop2-dev, | 12 | libgtop2-dev, |
42 | 13 | libgtk-3-dev (>= 3.0.0), | 13 | libgtk-3-dev (>= 3.0.0), |
43 | 14 | libunity-webapps-dev (>= 2.3.3), | ||
44 | 15 | libwnck-3-dev (>= 3.4.7), | 14 | libwnck-3-dev (>= 3.4.7), |
45 | 16 | libgirepository1.0-dev, | 15 | libgirepository1.0-dev, |
46 | 17 | python-libxslt1, | 16 | python-libxslt1, |
47 | 18 | 17 | ||
48 | === modified file 'src/Makefile.am' | |||
49 | --- src/Makefile.am 2013-06-13 22:19:56 +0000 | |||
50 | +++ src/Makefile.am 2014-04-08 14:38:15 +0000 | |||
51 | @@ -37,30 +37,11 @@ | |||
52 | 37 | bamf-xutils.h \ | 37 | bamf-xutils.h \ |
53 | 38 | $(NULL) | 38 | $(NULL) |
54 | 39 | 39 | ||
55 | 40 | bamfdaemon_webapps_sources = \ | ||
56 | 41 | bamf-unity-webapps-tab.c \ | ||
57 | 42 | bamf-unity-webapps-observer.c \ | ||
58 | 43 | bamf-unity-webapps-application.c \ | ||
59 | 44 | $(NULL) | ||
60 | 45 | |||
61 | 46 | bamfdaemon_webapps_headers = \ | ||
62 | 47 | bamf-unity-webapps-tab.h \ | ||
63 | 48 | bamf-unity-webapps-observer.h \ | ||
64 | 49 | bamf-unity-webapps-application.h \ | ||
65 | 50 | $(NULL) | ||
66 | 51 | |||
67 | 52 | bamfdaemon_SOURCES = \ | 40 | bamfdaemon_SOURCES = \ |
68 | 53 | $(bamfdaemon_sources) \ | 41 | $(bamfdaemon_sources) \ |
69 | 54 | $(bamfdaemon_headers) \ | 42 | $(bamfdaemon_headers) \ |
70 | 55 | $(NULL) | 43 | $(NULL) |
71 | 56 | 44 | ||
72 | 57 | if HAVE_WEBAPPS | ||
73 | 58 | bamfdaemon_SOURCES += \ | ||
74 | 59 | $(bamfdaemon_webapps_sources) \ | ||
75 | 60 | $(bamfdaemon_webapps_headers) \ | ||
76 | 61 | $(NULL) | ||
77 | 62 | endif | ||
78 | 63 | |||
79 | 64 | bamfdaemon_LDADD = \ | 45 | bamfdaemon_LDADD = \ |
80 | 65 | $(LIBBAMF_PRIVATE_LIB) \ | 46 | $(LIBBAMF_PRIVATE_LIB) \ |
81 | 66 | $(X_LIBS) \ | 47 | $(X_LIBS) \ |
82 | @@ -68,7 +49,6 @@ | |||
83 | 68 | $(GTK_LIBS) \ | 49 | $(GTK_LIBS) \ |
84 | 69 | $(WNCK_LIBS) \ | 50 | $(WNCK_LIBS) \ |
85 | 70 | $(GTOP_LIBS) \ | 51 | $(GTOP_LIBS) \ |
86 | 71 | $(LIBUNITY_WEBAPPS_LIBS) \ | ||
87 | 72 | $(NULL) | 52 | $(NULL) |
88 | 73 | 53 | ||
89 | 74 | bamfdaemon_CFLAGS = \ | 54 | bamfdaemon_CFLAGS = \ |
90 | @@ -82,7 +62,6 @@ | |||
91 | 82 | $(GTK_CFLAGS) \ | 62 | $(GTK_CFLAGS) \ |
92 | 83 | $(WNCK_CFLAGS) \ | 63 | $(WNCK_CFLAGS) \ |
93 | 84 | $(GTOP_CFLAGS) \ | 64 | $(GTOP_CFLAGS) \ |
94 | 85 | $(LIBUNITY_WEBAPPS_CFLAGS) \ | ||
95 | 86 | $(COVERAGE_CFLAGS) \ | 65 | $(COVERAGE_CFLAGS) \ |
96 | 87 | $(NULL) | 66 | $(NULL) |
97 | 88 | 67 | ||
98 | 89 | 68 | ||
99 | === modified file 'src/bamf-matcher-private.h' | |||
100 | --- src/bamf-matcher-private.h 2013-08-07 15:51:54 +0000 | |||
101 | +++ src/bamf-matcher-private.h 2014-04-08 14:38:15 +0000 | |||
102 | @@ -25,13 +25,9 @@ | |||
103 | 25 | #include "bamf-application.h" | 25 | #include "bamf-application.h" |
104 | 26 | #include "bamf-window.h" | 26 | #include "bamf-window.h" |
105 | 27 | #include "bamf-legacy-window.h" | 27 | #include "bamf-legacy-window.h" |
106 | 28 | #include "bamf-unity-webapps-observer.h" | ||
107 | 29 | 28 | ||
108 | 30 | struct _BamfMatcherPrivate | 29 | struct _BamfMatcherPrivate |
109 | 31 | { | 30 | { |
110 | 32 | #ifdef HAVE_WEBAPPS | ||
111 | 33 | BamfUnityWebappsObserver *webapps_observer; | ||
112 | 34 | #endif | ||
113 | 35 | GArray * bad_prefixes; | 31 | GArray * bad_prefixes; |
114 | 36 | GArray * good_prefixes; | 32 | GArray * good_prefixes; |
115 | 37 | GHashTable * desktop_id_table; | 33 | GHashTable * desktop_id_table; |
116 | 38 | 34 | ||
117 | === modified file 'src/bamf-matcher.c' | |||
118 | --- src/bamf-matcher.c 2014-03-07 17:22:20 +0000 | |||
119 | +++ src/bamf-matcher.c 2014-04-08 14:38:15 +0000 | |||
120 | @@ -27,10 +27,6 @@ | |||
121 | 27 | #include "bamf-window.h" | 27 | #include "bamf-window.h" |
122 | 28 | #include "bamf-legacy-screen.h" | 28 | #include "bamf-legacy-screen.h" |
123 | 29 | 29 | ||
124 | 30 | #ifdef HAVE_WEBAPPS | ||
125 | 31 | #include "bamf-unity-webapps-application.h" | ||
126 | 32 | #include "bamf-unity-webapps-tab.h" | ||
127 | 33 | #endif | ||
128 | 34 | #include <strings.h> | 30 | #include <strings.h> |
129 | 35 | 31 | ||
130 | 36 | #define BAMF_INDEX_NAME "bamf-2.index" | 32 | #define BAMF_INDEX_NAME "bamf-2.index" |
131 | @@ -1492,7 +1488,7 @@ | |||
132 | 1492 | const char *window_class = bamf_legacy_window_get_class_name (window); | 1488 | const char *window_class = bamf_legacy_window_get_class_name (window); |
133 | 1493 | const char *instance_name = bamf_legacy_window_get_class_instance_name (window); | 1489 | const char *instance_name = bamf_legacy_window_get_class_instance_name (window); |
134 | 1494 | 1490 | ||
136 | 1495 | // Chrome/Chromium uses url wm_class strings to represent its web apps. | 1491 | // Chrome/Chromium uses url wm_class strings to represent its web apps (--app mode). |
137 | 1496 | // These apps will still have the same parent pid and hints as the main chrome | 1492 | // These apps will still have the same parent pid and hints as the main chrome |
138 | 1497 | // window, so we skip the hint check. | 1493 | // window, so we skip the hint check. |
139 | 1498 | // We can tell a window is a chrome web app window if its instance name is | 1494 | // We can tell a window is a chrome web app window if its instance name is |
140 | @@ -2940,103 +2936,6 @@ | |||
141 | 2940 | return TRUE; | 2936 | return TRUE; |
142 | 2941 | } | 2937 | } |
143 | 2942 | 2938 | ||
144 | 2943 | #ifdef HAVE_WEBAPPS | ||
145 | 2944 | static gboolean | ||
146 | 2945 | bamf_matcher_has_tab_with_parent_xid (BamfMatcher *matcher, guint64 xid) | ||
147 | 2946 | { | ||
148 | 2947 | GList *l; | ||
149 | 2948 | g_return_val_if_fail (BAMF_IS_MATCHER (matcher), FALSE); | ||
150 | 2949 | |||
151 | 2950 | for (l = matcher->priv->views; l; l = l->next) | ||
152 | 2951 | { | ||
153 | 2952 | if (!BAMF_IS_TAB (l->data)) | ||
154 | 2953 | continue; | ||
155 | 2954 | |||
156 | 2955 | if (xid == bamf_tab_get_xid (BAMF_TAB (l->data))) | ||
157 | 2956 | return TRUE; | ||
158 | 2957 | } | ||
159 | 2958 | |||
160 | 2959 | return FALSE; | ||
161 | 2960 | } | ||
162 | 2961 | |||
163 | 2962 | static void | ||
164 | 2963 | on_webapp_child_added (BamfView *application, | ||
165 | 2964 | BamfView *child, | ||
166 | 2965 | gpointer user_data) | ||
167 | 2966 | { | ||
168 | 2967 | BamfMatcher *self; | ||
169 | 2968 | BamfLegacyWindow *legacy_window; | ||
170 | 2969 | BamfUnityWebappsTab *webapp_tab; | ||
171 | 2970 | |||
172 | 2971 | g_return_if_fail (BAMF_IS_MATCHER (user_data)); | ||
173 | 2972 | g_return_if_fail (BAMF_IS_UNITY_WEBAPPS_TAB (child)); | ||
174 | 2973 | |||
175 | 2974 | self = BAMF_MATCHER (user_data); | ||
176 | 2975 | webapp_tab = BAMF_UNITY_WEBAPPS_TAB (child); | ||
177 | 2976 | legacy_window = bamf_unity_webapps_tab_get_legacy_window_for (webapp_tab); | ||
178 | 2977 | |||
179 | 2978 | if (legacy_window && is_web_app_window (legacy_window)) | ||
180 | 2979 | { | ||
181 | 2980 | /* If we have a chromeless window, we remove the window from the | ||
182 | 2981 | * application children list, so that it won't be duplicated in launcher */ | ||
183 | 2982 | |||
184 | 2983 | guint tab_xid = bamf_tab_get_xid (BAMF_TAB (webapp_tab)); | ||
185 | 2984 | |||
186 | 2985 | if (!bamf_matcher_has_tab_with_parent_xid (self, tab_xid)) | ||
187 | 2986 | { | ||
188 | 2987 | BamfApplication *old_application = bamf_matcher_get_application_by_xid (self, tab_xid); | ||
189 | 2988 | |||
190 | 2989 | if (BAMF_IS_APPLICATION (old_application)) | ||
191 | 2990 | { | ||
192 | 2991 | BamfWindow *bamf_window = bamf_application_get_window (old_application, tab_xid); | ||
193 | 2992 | |||
194 | 2993 | if (BAMF_IS_VIEW (bamf_window)) | ||
195 | 2994 | bamf_view_remove_child (BAMF_VIEW (old_application), BAMF_VIEW (bamf_window)); | ||
196 | 2995 | } | ||
197 | 2996 | } | ||
198 | 2997 | } | ||
199 | 2998 | |||
200 | 2999 | bamf_matcher_register_view_stealing_ref (self, child); | ||
201 | 3000 | } | ||
202 | 3001 | |||
203 | 3002 | static void on_webapp_child_removed (BamfView *application, | ||
204 | 3003 | BamfView *child, | ||
205 | 3004 | gpointer user_data) | ||
206 | 3005 | { | ||
207 | 3006 | BamfLegacyWindow *legacy_window; | ||
208 | 3007 | BamfUnityWebappsTab *webapp_tab; | ||
209 | 3008 | |||
210 | 3009 | g_return_if_fail (BAMF_IS_UNITY_WEBAPPS_TAB (child)); | ||
211 | 3010 | |||
212 | 3011 | webapp_tab = BAMF_UNITY_WEBAPPS_TAB (child); | ||
213 | 3012 | legacy_window = bamf_unity_webapps_tab_get_legacy_window_for (webapp_tab); | ||
214 | 3013 | |||
215 | 3014 | if (is_web_app_window (legacy_window)) | ||
216 | 3015 | { | ||
217 | 3016 | /* If we have a chromeless window, we re-match it again as soon as the | ||
218 | 3017 | * webapp handler is gone, so that we don't lose its control */ | ||
219 | 3018 | bamf_legacy_window_reopen (legacy_window); | ||
220 | 3019 | } | ||
221 | 3020 | } | ||
222 | 3021 | |||
223 | 3022 | static void | ||
224 | 3023 | on_webapp_appeared (BamfUnityWebappsObserver *observer, | ||
225 | 3024 | BamfApplication *application, | ||
226 | 3025 | gpointer user_data) | ||
227 | 3026 | { | ||
228 | 3027 | BamfMatcher *self; | ||
229 | 3028 | |||
230 | 3029 | self = (BamfMatcher *)user_data; | ||
231 | 3030 | |||
232 | 3031 | bamf_matcher_register_view_stealing_ref (self, (BamfView *)application); | ||
233 | 3032 | |||
234 | 3033 | g_signal_connect (application, "child-added-internal", G_CALLBACK (on_webapp_child_added), self); | ||
235 | 3034 | g_signal_connect (application, "child-removed-internal", G_CALLBACK (on_webapp_child_removed), self); | ||
236 | 3035 | |||
237 | 3036 | bamf_unity_webapps_application_add_existing_interests (BAMF_UNITY_WEBAPPS_APPLICATION (application)); | ||
238 | 3037 | } | ||
239 | 3038 | #endif | ||
240 | 3039 | |||
241 | 3040 | static void | 2939 | static void |
242 | 3041 | bamf_matcher_init (BamfMatcher * self) | 2940 | bamf_matcher_init (BamfMatcher * self) |
243 | 3042 | { | 2941 | { |
244 | @@ -3117,13 +3016,6 @@ | |||
245 | 3117 | 3016 | ||
246 | 3118 | g_signal_connect (self, "handle-window-stack-for-monitor", | 3017 | g_signal_connect (self, "handle-window-stack-for-monitor", |
247 | 3119 | G_CALLBACK (on_dbus_handle_window_stack_for_monitor), self); | 3018 | G_CALLBACK (on_dbus_handle_window_stack_for_monitor), self); |
248 | 3120 | |||
249 | 3121 | #ifdef HAVE_WEBAPPS | ||
250 | 3122 | priv->webapps_observer = bamf_unity_webapps_observer_new (); | ||
251 | 3123 | |||
252 | 3124 | g_signal_connect (priv->webapps_observer, "application-appeared", | ||
253 | 3125 | G_CALLBACK (on_webapp_appeared), self); | ||
254 | 3126 | #endif | ||
255 | 3127 | } | 3019 | } |
256 | 3128 | 3020 | ||
257 | 3129 | static void | 3021 | static void |
258 | @@ -3137,14 +3029,6 @@ | |||
259 | 3137 | bamf_matcher_unregister_view (self, priv->views->data); | 3029 | bamf_matcher_unregister_view (self, priv->views->data); |
260 | 3138 | } | 3030 | } |
261 | 3139 | 3031 | ||
262 | 3140 | #ifdef HAVE_WEBAPPS | ||
263 | 3141 | if (priv->webapps_observer) | ||
264 | 3142 | { | ||
265 | 3143 | g_object_unref (G_OBJECT (priv->webapps_observer)); | ||
266 | 3144 | priv->webapps_observer = NULL; | ||
267 | 3145 | } | ||
268 | 3146 | #endif | ||
269 | 3147 | |||
270 | 3148 | G_OBJECT_CLASS (bamf_matcher_parent_class)->dispose (object); | 3032 | G_OBJECT_CLASS (bamf_matcher_parent_class)->dispose (object); |
271 | 3149 | } | 3033 | } |
272 | 3150 | 3034 | ||
273 | 3151 | 3035 | ||
274 | === removed file 'src/bamf-unity-webapps-application.c' | |||
275 | --- src/bamf-unity-webapps-application.c 2013-07-31 00:11:27 +0000 | |||
276 | +++ src/bamf-unity-webapps-application.c 1970-01-01 00:00:00 +0000 | |||
277 | @@ -1,339 +0,0 @@ | |||
278 | 1 | /* | ||
279 | 2 | * Copyright (C) 2010-2011 Canonical Ltd | ||
280 | 3 | * | ||
281 | 4 | * This program is free software: you can redistribute it and/or modify | ||
282 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
283 | 6 | * published by the Free Software Foundation. | ||
284 | 7 | * | ||
285 | 8 | * This program is distributed in the hope that it will be useful, | ||
286 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
287 | 10 | * MERCHANAPPLICATIONILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
288 | 11 | * GNU General Public License for more details. | ||
289 | 12 | * | ||
290 | 13 | * You should have received a copy of the GNU General Public License | ||
291 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
292 | 15 | * | ||
293 | 16 | * Authored by: | ||
294 | 17 | * Robert Carr <racarr@canonical.com> | ||
295 | 18 | * | ||
296 | 19 | */ | ||
297 | 20 | |||
298 | 21 | #include <stdlib.h> | ||
299 | 22 | |||
300 | 23 | |||
301 | 24 | #include "bamf-unity-webapps-application.h" | ||
302 | 25 | #include "bamf-unity-webapps-tab.h" | ||
303 | 26 | #include "bamf-matcher.h" | ||
304 | 27 | |||
305 | 28 | #include <unity-webapps-context.h> | ||
306 | 29 | |||
307 | 30 | #define BAMF_UNITY_WEBAPPS_APPLICATION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE(obj, \ | ||
308 | 31 | BAMF_TYPE_UNITY_WEBAPPS_APPLICATION, BamfUnityWebappsApplicationPrivate)) | ||
309 | 32 | |||
310 | 33 | G_DEFINE_TYPE(BamfUnityWebappsApplication, bamf_unity_webapps_application, BAMF_TYPE_APPLICATION); | ||
311 | 34 | |||
312 | 35 | enum | ||
313 | 36 | { | ||
314 | 37 | PROP_0, | ||
315 | 38 | PROP_CONTEXT, | ||
316 | 39 | }; | ||
317 | 40 | |||
318 | 41 | struct _BamfUnityWebappsApplicationPrivate | ||
319 | 42 | { | ||
320 | 43 | UnityWebappsContext *context; | ||
321 | 44 | }; | ||
322 | 45 | |||
323 | 46 | |||
324 | 47 | static void | ||
325 | 48 | bamf_unity_webapps_application_get_application_menu (BamfApplication *application, | ||
326 | 49 | gchar **name, | ||
327 | 50 | gchar **path) | ||
328 | 51 | { | ||
329 | 52 | BamfUnityWebappsApplication *self; | ||
330 | 53 | |||
331 | 54 | self = (BamfUnityWebappsApplication *)application; | ||
332 | 55 | |||
333 | 56 | *name = g_strdup (unity_webapps_context_get_context_name (self->priv->context)); | ||
334 | 57 | *path = g_strdup (UNITY_WEBAPPS_CONTEXT_MENU_PATH); | ||
335 | 58 | } | ||
336 | 59 | |||
337 | 60 | static void | ||
338 | 61 | bamf_unity_webapps_application_get_property (GObject *object, guint property_id, GValue *gvalue, GParamSpec *pspec) | ||
339 | 62 | { | ||
340 | 63 | BamfUnityWebappsApplication *self; | ||
341 | 64 | |||
342 | 65 | self = BAMF_UNITY_WEBAPPS_APPLICATION (object); | ||
343 | 66 | |||
344 | 67 | switch (property_id) | ||
345 | 68 | { | ||
346 | 69 | case PROP_CONTEXT: | ||
347 | 70 | g_value_set_object (gvalue, self->priv->context); | ||
348 | 71 | break; | ||
349 | 72 | default: | ||
350 | 73 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); | ||
351 | 74 | } | ||
352 | 75 | } | ||
353 | 76 | |||
354 | 77 | static BamfUnityWebappsTab * | ||
355 | 78 | bamf_unity_webapps_application_find_child_by_interest (BamfUnityWebappsApplication *application, | ||
356 | 79 | gint interest_id) | ||
357 | 80 | { | ||
358 | 81 | GList *children, *walk; | ||
359 | 82 | BamfUnityWebappsTab *child; | ||
360 | 83 | |||
361 | 84 | children = bamf_view_get_children (BAMF_VIEW (application)); | ||
362 | 85 | |||
363 | 86 | for (walk = children; walk != NULL; walk = walk->next) | ||
364 | 87 | { | ||
365 | 88 | child = BAMF_UNITY_WEBAPPS_TAB (walk->data); | ||
366 | 89 | |||
367 | 90 | if (interest_id == bamf_unity_webapps_tab_get_interest_id (child)) | ||
368 | 91 | { | ||
369 | 92 | return child; | ||
370 | 93 | } | ||
371 | 94 | } | ||
372 | 95 | |||
373 | 96 | return NULL; | ||
374 | 97 | } | ||
375 | 98 | |||
376 | 99 | static BamfView * | ||
377 | 100 | bamf_unity_webapps_application_get_focusable_child (BamfApplication *application) | ||
378 | 101 | { | ||
379 | 102 | BamfUnityWebappsApplication *self; | ||
380 | 103 | gint focus_interest; | ||
381 | 104 | |||
382 | 105 | self = BAMF_UNITY_WEBAPPS_APPLICATION (application); | ||
383 | 106 | |||
384 | 107 | focus_interest = unity_webapps_context_get_focus_interest (self->priv->context); | ||
385 | 108 | |||
386 | 109 | if (focus_interest == -1) | ||
387 | 110 | return NULL; | ||
388 | 111 | |||
389 | 112 | return (BamfView *)bamf_unity_webapps_application_find_child_by_interest (self, focus_interest); | ||
390 | 113 | } | ||
391 | 114 | |||
392 | 115 | |||
393 | 116 | static void | ||
394 | 117 | bamf_unity_webapps_application_interest_appeared (UnityWebappsContext *context, | ||
395 | 118 | gint interest_id, | ||
396 | 119 | gpointer user_data) | ||
397 | 120 | { | ||
398 | 121 | BamfUnityWebappsApplication *self; | ||
399 | 122 | BamfUnityWebappsTab *child; | ||
400 | 123 | |||
401 | 124 | self = BAMF_UNITY_WEBAPPS_APPLICATION (user_data); | ||
402 | 125 | |||
403 | 126 | child = bamf_unity_webapps_application_find_child_by_interest (self, interest_id); | ||
404 | 127 | |||
405 | 128 | if (child != NULL) | ||
406 | 129 | { | ||
407 | 130 | return; | ||
408 | 131 | } | ||
409 | 132 | |||
410 | 133 | child = bamf_unity_webapps_tab_new (context, interest_id); | ||
411 | 134 | bamf_view_add_child (BAMF_VIEW (self), BAMF_VIEW (child)); | ||
412 | 135 | |||
413 | 136 | // It's possible that the context had become lonely (i.e. no children) but not yet shut down. | ||
414 | 137 | // however, if we gain an interest we are always running and "mapped". | ||
415 | 138 | bamf_view_set_running (BAMF_VIEW (self), TRUE); | ||
416 | 139 | bamf_view_set_user_visible (BAMF_VIEW (self), TRUE); | ||
417 | 140 | } | ||
418 | 141 | |||
419 | 142 | static void | ||
420 | 143 | bamf_unity_webapps_application_interest_vanished (UnityWebappsContext *context, | ||
421 | 144 | gint interest_id, | ||
422 | 145 | gpointer user_data) | ||
423 | 146 | { | ||
424 | 147 | BamfUnityWebappsApplication *self; | ||
425 | 148 | BamfUnityWebappsTab *child; | ||
426 | 149 | |||
427 | 150 | self = (BamfUnityWebappsApplication *)user_data; | ||
428 | 151 | |||
429 | 152 | child = bamf_unity_webapps_application_find_child_by_interest (self, interest_id); | ||
430 | 153 | |||
431 | 154 | if (child == NULL) | ||
432 | 155 | { | ||
433 | 156 | return; | ||
434 | 157 | } | ||
435 | 158 | |||
436 | 159 | bamf_view_remove_child (BAMF_VIEW (self), BAMF_VIEW (child)); | ||
437 | 160 | } | ||
438 | 161 | |||
439 | 162 | /* It doesn't make any sense for a BamfUnityWebappsTab to live without it's assosciated context. | ||
440 | 163 | * so when our children are removed, dispose of them. */ | ||
441 | 164 | static void | ||
442 | 165 | bamf_unity_webapps_application_child_removed (BamfView *view, BamfView *child) | ||
443 | 166 | { | ||
444 | 167 | // Chain up first before we destroy the object. | ||
445 | 168 | BAMF_VIEW_CLASS (bamf_unity_webapps_application_parent_class)->child_removed (view, child); | ||
446 | 169 | |||
447 | 170 | bamf_view_set_running (child, FALSE); | ||
448 | 171 | bamf_view_close (BAMF_VIEW (child)); | ||
449 | 172 | } | ||
450 | 173 | |||
451 | 174 | void | ||
452 | 175 | bamf_unity_webapps_application_add_existing_interests (BamfUnityWebappsApplication *self) | ||
453 | 176 | { | ||
454 | 177 | GVariant *interests, *interest_variant; | ||
455 | 178 | GVariantIter *variant_iter; | ||
456 | 179 | |||
457 | 180 | interests = unity_webapps_context_list_interests (self->priv->context); | ||
458 | 181 | |||
459 | 182 | if (interests == NULL) | ||
460 | 183 | { | ||
461 | 184 | return; | ||
462 | 185 | } | ||
463 | 186 | |||
464 | 187 | variant_iter = g_variant_iter_new (interests); | ||
465 | 188 | |||
466 | 189 | while ((interest_variant = g_variant_iter_next_value (variant_iter))) | ||
467 | 190 | { | ||
468 | 191 | gint interest_id; | ||
469 | 192 | |||
470 | 193 | interest_id = g_variant_get_int32 (interest_variant); | ||
471 | 194 | |||
472 | 195 | bamf_unity_webapps_application_interest_appeared (self->priv->context, interest_id, self); | ||
473 | 196 | } | ||
474 | 197 | } | ||
475 | 198 | |||
476 | 199 | static void | ||
477 | 200 | bamf_unity_webapps_application_context_set (BamfUnityWebappsApplication *self) | ||
478 | 201 | { | ||
479 | 202 | bamf_application_set_desktop_file_from_id (BAMF_APPLICATION (self), | ||
480 | 203 | unity_webapps_context_get_desktop_name (self->priv->context)); | ||
481 | 204 | |||
482 | 205 | unity_webapps_context_on_interest_appeared (self->priv->context, bamf_unity_webapps_application_interest_appeared, self); | ||
483 | 206 | unity_webapps_context_on_interest_vanished (self->priv->context, bamf_unity_webapps_application_interest_vanished, self); | ||
484 | 207 | } | ||
485 | 208 | |||
486 | 209 | static void | ||
487 | 210 | bamf_unity_webapps_application_set_property (GObject *object, guint property_id, const GValue *gvalue, GParamSpec *pspec) | ||
488 | 211 | { | ||
489 | 212 | BamfUnityWebappsApplication *self; | ||
490 | 213 | |||
491 | 214 | self = BAMF_UNITY_WEBAPPS_APPLICATION (object); | ||
492 | 215 | |||
493 | 216 | switch (property_id) | ||
494 | 217 | { | ||
495 | 218 | case PROP_CONTEXT: | ||
496 | 219 | g_assert (self->priv->context == NULL); | ||
497 | 220 | self->priv->context = g_value_get_object (gvalue); | ||
498 | 221 | |||
499 | 222 | bamf_unity_webapps_application_context_set (self); | ||
500 | 223 | break; | ||
501 | 224 | default: | ||
502 | 225 | G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); | ||
503 | 226 | } | ||
504 | 227 | } | ||
505 | 228 | |||
506 | 229 | static gchar * | ||
507 | 230 | bamf_unity_webapps_application_get_stable_bus_name (BamfView *view) | ||
508 | 231 | { | ||
509 | 232 | const gchar *desktop_file; | ||
510 | 233 | |||
511 | 234 | desktop_file = bamf_application_get_desktop_file (BAMF_APPLICATION (view)); | ||
512 | 235 | |||
513 | 236 | if (desktop_file) | ||
514 | 237 | { | ||
515 | 238 | return g_strdup_printf ("webapp/%i", abs (g_str_hash (desktop_file))); | ||
516 | 239 | } | ||
517 | 240 | |||
518 | 241 | return g_strdup_printf ("webapp/%p", view); | ||
519 | 242 | } | ||
520 | 243 | |||
521 | 244 | |||
522 | 245 | static void | ||
523 | 246 | bamf_unity_webapps_application_finalize (GObject *object) | ||
524 | 247 | { | ||
525 | 248 | BamfUnityWebappsApplication *self = BAMF_UNITY_WEBAPPS_APPLICATION (object); | ||
526 | 249 | |||
527 | 250 | g_object_unref (self->priv->context); | ||
528 | 251 | |||
529 | 252 | G_OBJECT_CLASS (bamf_unity_webapps_application_parent_class)->finalize (object); | ||
530 | 253 | } | ||
531 | 254 | |||
532 | 255 | static void | ||
533 | 256 | on_accept_data_changed (UnityWebappsContext *context, const gchar **file, gpointer user_data) | ||
534 | 257 | { | ||
535 | 258 | BamfUnityWebappsApplication *self = BAMF_UNITY_WEBAPPS_APPLICATION (user_data); | ||
536 | 259 | |||
537 | 260 | g_signal_emit_by_name (self, "supported-mimes-changed", file); | ||
538 | 261 | } | ||
539 | 262 | |||
540 | 263 | static void | ||
541 | 264 | bamf_unity_webapps_application_constructed (GObject *object) | ||
542 | 265 | { | ||
543 | 266 | BamfUnityWebappsApplication *self; | ||
544 | 267 | |||
545 | 268 | self = (BamfUnityWebappsApplication *)object; | ||
546 | 269 | |||
547 | 270 | g_signal_connect (self->priv->context, "accept-data-changed", G_CALLBACK (on_accept_data_changed), self); | ||
548 | 271 | } | ||
549 | 272 | |||
550 | 273 | |||
551 | 274 | static void | ||
552 | 275 | bamf_unity_webapps_application_init (BamfUnityWebappsApplication *self) | ||
553 | 276 | { | ||
554 | 277 | self->priv = BAMF_UNITY_WEBAPPS_APPLICATION_GET_PRIVATE (self); | ||
555 | 278 | |||
556 | 279 | bamf_application_set_application_type (BAMF_APPLICATION (self), BAMF_APPLICATION_WEB); | ||
557 | 280 | |||
558 | 281 | } | ||
559 | 282 | |||
560 | 283 | static char ** | ||
561 | 284 | bamf_unity_webapps_application_get_supported_mime_types (BamfApplication *application) | ||
562 | 285 | { | ||
563 | 286 | BamfUnityWebappsApplication *self = BAMF_UNITY_WEBAPPS_APPLICATION (application); | ||
564 | 287 | |||
565 | 288 | return unity_webapps_context_get_application_accept_data (self->priv->context); | ||
566 | 289 | } | ||
567 | 290 | |||
568 | 291 | static gboolean | ||
569 | 292 | bamf_unity_webapps_application_get_close_when_empty (BamfApplication *application) | ||
570 | 293 | { | ||
571 | 294 | // Sometimes we might have no children for a short period (for example, the page is reloading), in the case | ||
572 | 295 | // Unity Webapps will keep the context alive for a while. Allowing for new children to appear...before eventually | ||
573 | 296 | // shutting it down. So we use this flag to ensure BAMF will not shut us down prematurely. | ||
574 | 297 | return FALSE; | ||
575 | 298 | } | ||
576 | 299 | |||
577 | 300 | static void | ||
578 | 301 | bamf_unity_webapps_application_class_init (BamfUnityWebappsApplicationClass * klass) | ||
579 | 302 | { | ||
580 | 303 | GParamSpec *pspec; | ||
581 | 304 | GObjectClass *object_class = G_OBJECT_CLASS (klass); | ||
582 | 305 | BamfApplicationClass *bamf_application_class = BAMF_APPLICATION_CLASS (klass); | ||
583 | 306 | BamfViewClass *bamf_view_class = BAMF_VIEW_CLASS (klass); | ||
584 | 307 | |||
585 | 308 | object_class->get_property = bamf_unity_webapps_application_get_property; | ||
586 | 309 | object_class->set_property = bamf_unity_webapps_application_set_property; | ||
587 | 310 | object_class->finalize = bamf_unity_webapps_application_finalize; | ||
588 | 311 | object_class->constructed = bamf_unity_webapps_application_constructed; | ||
589 | 312 | |||
590 | 313 | bamf_view_class->stable_bus_name = bamf_unity_webapps_application_get_stable_bus_name; | ||
591 | 314 | bamf_view_class->child_removed = bamf_unity_webapps_application_child_removed; | ||
592 | 315 | |||
593 | 316 | bamf_application_class->get_application_menu = bamf_unity_webapps_application_get_application_menu; | ||
594 | 317 | bamf_application_class->get_focusable_child = bamf_unity_webapps_application_get_focusable_child; | ||
595 | 318 | bamf_application_class->get_supported_mime_types = bamf_unity_webapps_application_get_supported_mime_types; | ||
596 | 319 | bamf_application_class->get_close_when_empty = bamf_unity_webapps_application_get_close_when_empty; | ||
597 | 320 | |||
598 | 321 | pspec = g_param_spec_object("context", "Context", "The Unity Webapps Context assosciated with the Application", | ||
599 | 322 | UNITY_WEBAPPS_TYPE_CONTEXT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); | ||
600 | 323 | g_object_class_install_property (object_class, PROP_CONTEXT, pspec); | ||
601 | 324 | |||
602 | 325 | g_type_class_add_private (klass, sizeof (BamfUnityWebappsApplicationPrivate)); | ||
603 | 326 | } | ||
604 | 327 | |||
605 | 328 | |||
606 | 329 | BamfApplication * | ||
607 | 330 | bamf_unity_webapps_application_new (UnityWebappsContext *context) | ||
608 | 331 | { | ||
609 | 332 | return (BamfApplication *)g_object_new (BAMF_TYPE_UNITY_WEBAPPS_APPLICATION, "context", context, NULL); | ||
610 | 333 | } | ||
611 | 334 | |||
612 | 335 | UnityWebappsContext * | ||
613 | 336 | bamf_unity_webapps_application_get_context (BamfUnityWebappsApplication *application) | ||
614 | 337 | { | ||
615 | 338 | return application->priv->context; | ||
616 | 339 | } | ||
617 | 340 | 0 | ||
618 | === removed file 'src/bamf-unity-webapps-application.h' | |||
619 | --- src/bamf-unity-webapps-application.h 2012-08-21 22:01:48 +0000 | |||
620 | +++ src/bamf-unity-webapps-application.h 1970-01-01 00:00:00 +0000 | |||
621 | @@ -1,63 +0,0 @@ | |||
622 | 1 | /* | ||
623 | 2 | * Copyright (C) 2010-2011 Canonical Ltd | ||
624 | 3 | * | ||
625 | 4 | * This program is free software: you can redistribute it and/or modify | ||
626 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
627 | 6 | * published by the Free Software Foundation. | ||
628 | 7 | * | ||
629 | 8 | * This program is distributed in the hope that it will be useful, | ||
630 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
631 | 10 | * MERCHANAPPLICATIONILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
632 | 11 | * GNU General Public License for more details. | ||
633 | 12 | * | ||
634 | 13 | * You should have received a copy of the GNU General Public License | ||
635 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
636 | 15 | * | ||
637 | 16 | * Authored by: Jason Smith <jason.smith@canonical.com> | ||
638 | 17 | * Marco Trevisan (Treviño) <3v1n0@ubuntu.com> | ||
639 | 18 | * | ||
640 | 19 | */ | ||
641 | 20 | |||
642 | 21 | #ifndef __BAMF_UNITY_WEBAPPS_APPLICATION_H__ | ||
643 | 22 | #define __BAMF_UNITY_WEBAPPS_APPLICATION_H__ | ||
644 | 23 | |||
645 | 24 | #include <unity-webapps-context.h> | ||
646 | 25 | |||
647 | 26 | #include "bamf-application.h" | ||
648 | 27 | |||
649 | 28 | |||
650 | 29 | #define BAMF_TYPE_UNITY_WEBAPPS_APPLICATION (bamf_unity_webapps_application_get_type ()) | ||
651 | 30 | #define BAMF_UNITY_WEBAPPS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAMF_TYPE_UNITY_WEBAPPS_APPLICATION, BamfUnityWebappsApplication)) | ||
652 | 31 | #define BAMF_IS_UNITY_WEBAPPS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAMF_TYPE_UNITY_WEBAPPS_APPLICATION)) | ||
653 | 32 | #define BAMF_UNITY_WEBAPPS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BAMF_TYPE_UNITY_WEBAPPS_APPLICATION, BamfUnityWebappsApplicationClass)) | ||
654 | 33 | #define BAMF_IS_UNITY_WEBAPPS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BAMF_TYPE_UNITY_WEBAPPS_APPLICATION)) | ||
655 | 34 | #define BAMF_UNITY_WEBAPPS_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BAMF_TYPE_UNITY_WEBAPPS_APPLICATION, BamfUnityWebappsUnityWebappsApplicationClass)) | ||
656 | 35 | |||
657 | 36 | typedef struct _BamfUnityWebappsApplication BamfUnityWebappsApplication; | ||
658 | 37 | typedef struct _BamfUnityWebappsApplicationClass BamfUnityWebappsApplicationClass; | ||
659 | 38 | typedef struct _BamfUnityWebappsApplicationPrivate BamfUnityWebappsApplicationPrivate; | ||
660 | 39 | |||
661 | 40 | struct _BamfUnityWebappsApplicationClass | ||
662 | 41 | { | ||
663 | 42 | BamfApplicationClass parent; | ||
664 | 43 | }; | ||
665 | 44 | |||
666 | 45 | struct _BamfUnityWebappsApplication | ||
667 | 46 | { | ||
668 | 47 | BamfApplication parent; | ||
669 | 48 | |||
670 | 49 | /* private */ | ||
671 | 50 | BamfUnityWebappsApplicationPrivate *priv; | ||
672 | 51 | }; | ||
673 | 52 | |||
674 | 53 | GType bamf_unity_webapps_application_get_type (void) G_GNUC_CONST; | ||
675 | 54 | |||
676 | 55 | BamfApplication *bamf_unity_webapps_application_new (UnityWebappsContext *context); | ||
677 | 56 | UnityWebappsContext *bamf_unity_webapps_application_get_context (BamfUnityWebappsApplication *application); | ||
678 | 57 | |||
679 | 58 | void | ||
680 | 59 | bamf_unity_webapps_application_add_existing_interests (BamfUnityWebappsApplication *self); | ||
681 | 60 | |||
682 | 61 | |||
683 | 62 | |||
684 | 63 | #endif | ||
685 | 64 | 0 | ||
686 | === removed file 'src/bamf-unity-webapps-observer.c' | |||
687 | --- src/bamf-unity-webapps-observer.c 2013-07-30 23:56:55 +0000 | |||
688 | +++ src/bamf-unity-webapps-observer.c 1970-01-01 00:00:00 +0000 | |||
689 | @@ -1,278 +0,0 @@ | |||
690 | 1 | /* | ||
691 | 2 | * bamf-unity-webapps-observer.c | ||
692 | 3 | * Copyright (C) Canonical LTD 2012 | ||
693 | 4 | * | ||
694 | 5 | * Author: Robert Carr <racarr@canonical.com> | ||
695 | 6 | * | ||
696 | 7 | * This program is free software: you can redistribute it and/or modify it | ||
697 | 8 | * under the terms of the GNU Lesser General Public License as published | ||
698 | 9 | * by the Free Software Foundation, either version 3 of the License, or | ||
699 | 10 | * (at your option) any later version. | ||
700 | 11 | * | ||
701 | 12 | * unity-webapps is distributed in the hope that it will be useful, but | ||
702 | 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
703 | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
704 | 15 | * See the GNU Lesser General Public License for more details. | ||
705 | 16 | * | ||
706 | 17 | * You should have received a copy of the GNU Lesser General Public License | ||
707 | 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>."; | ||
708 | 19 | */ | ||
709 | 20 | |||
710 | 21 | #include "bamf-unity-webapps-tab.h" | ||
711 | 22 | #include "bamf-unity-webapps-observer.h" | ||
712 | 23 | #include "bamf-unity-webapps-application.h" | ||
713 | 24 | #include "bamf-matcher.h" | ||
714 | 25 | |||
715 | 26 | struct _BamfUnityWebappsObserverPrivate { | ||
716 | 27 | UnityWebappsService *service; | ||
717 | 28 | |||
718 | 29 | GHashTable *applications_by_context_name; | ||
719 | 30 | |||
720 | 31 | guint service_watch_id; | ||
721 | 32 | }; | ||
722 | 33 | |||
723 | 34 | G_DEFINE_TYPE(BamfUnityWebappsObserver, bamf_unity_webapps_observer, G_TYPE_OBJECT) | ||
724 | 35 | |||
725 | 36 | enum | ||
726 | 37 | { | ||
727 | 38 | APPLICATION_APPEARED, | ||
728 | 39 | LAST_SIGNAL | ||
729 | 40 | }; | ||
730 | 41 | |||
731 | 42 | static guint webapps_observer_signals[LAST_SIGNAL] = { 0 }; | ||
732 | 43 | |||
733 | 44 | |||
734 | 45 | #define BAMF_UNITY_WEBAPPS_OBSERVER_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), BAMF_TYPE_UNITY_WEBAPPS_OBSERVER, BamfUnityWebappsObserverPrivate)) | ||
735 | 46 | |||
736 | 47 | static void | ||
737 | 48 | bamf_unity_webapps_observer_context_vanished (UnityWebappsService *service, | ||
738 | 49 | const gchar *name, | ||
739 | 50 | gpointer user_data) | ||
740 | 51 | { | ||
741 | 52 | BamfUnityWebappsObserver *observer; | ||
742 | 53 | BamfApplication *application; | ||
743 | 54 | |||
744 | 55 | observer = (BamfUnityWebappsObserver *)user_data; | ||
745 | 56 | |||
746 | 57 | application = g_hash_table_lookup (observer->priv->applications_by_context_name, name); | ||
747 | 58 | |||
748 | 59 | if (application == NULL) | ||
749 | 60 | return; | ||
750 | 61 | |||
751 | 62 | bamf_view_set_running (BAMF_VIEW (application), FALSE); | ||
752 | 63 | bamf_view_close (BAMF_VIEW (application)); | ||
753 | 64 | |||
754 | 65 | g_hash_table_remove (observer->priv->applications_by_context_name, name); | ||
755 | 66 | |||
756 | 67 | } | ||
757 | 68 | |||
758 | 69 | static void | ||
759 | 70 | bamf_unity_webapps_application_closed (BamfView *view, | ||
760 | 71 | gpointer user_data) | ||
761 | 72 | { | ||
762 | 73 | BamfUnityWebappsObserver *observer; | ||
763 | 74 | BamfUnityWebappsApplication *application; | ||
764 | 75 | UnityWebappsContext *context; | ||
765 | 76 | const gchar *context_name; | ||
766 | 77 | |||
767 | 78 | observer = (BamfUnityWebappsObserver *)user_data; | ||
768 | 79 | |||
769 | 80 | application = BAMF_UNITY_WEBAPPS_APPLICATION (view); | ||
770 | 81 | |||
771 | 82 | context = bamf_unity_webapps_application_get_context (application); | ||
772 | 83 | context_name = unity_webapps_context_get_context_name (context); | ||
773 | 84 | |||
774 | 85 | g_hash_table_remove (observer->priv->applications_by_context_name, context_name); | ||
775 | 86 | } | ||
776 | 87 | |||
777 | 88 | static void | ||
778 | 89 | bamf_unity_webapps_observer_context_appeared (UnityWebappsService *service, | ||
779 | 90 | const gchar *name, | ||
780 | 91 | gpointer user_data) | ||
781 | 92 | { | ||
782 | 93 | BamfUnityWebappsObserver *observer; | ||
783 | 94 | UnityWebappsContext *context; | ||
784 | 95 | BamfApplication *application; | ||
785 | 96 | |||
786 | 97 | if (name == NULL || name[0] == '\0') | ||
787 | 98 | return; | ||
788 | 99 | |||
789 | 100 | observer = (BamfUnityWebappsObserver *)user_data; | ||
790 | 101 | |||
791 | 102 | if (g_hash_table_lookup (observer->priv->applications_by_context_name, name) != NULL) | ||
792 | 103 | return; | ||
793 | 104 | |||
794 | 105 | context = unity_webapps_context_new_for_context_name (observer->priv->service, name); | ||
795 | 106 | |||
796 | 107 | application = bamf_unity_webapps_application_new (context); | ||
797 | 108 | |||
798 | 109 | g_signal_connect (G_OBJECT (application), "closed-internal", G_CALLBACK (bamf_unity_webapps_application_closed), | ||
799 | 110 | observer); | ||
800 | 111 | |||
801 | 112 | g_hash_table_insert (observer->priv->applications_by_context_name, g_strdup (name), application); | ||
802 | 113 | |||
803 | 114 | g_signal_emit (observer, webapps_observer_signals[APPLICATION_APPEARED], 0, application); | ||
804 | 115 | } | ||
805 | 116 | |||
806 | 117 | static void | ||
807 | 118 | bamf_unity_webapps_observer_register_existing_contexts (BamfUnityWebappsObserver *observer, | ||
808 | 119 | UnityWebappsService *service) | ||
809 | 120 | { | ||
810 | 121 | gchar **contexts; | ||
811 | 122 | gint i, len; | ||
812 | 123 | |||
813 | 124 | contexts = unity_webapps_service_list_contexts (service); | ||
814 | 125 | |||
815 | 126 | if (contexts == NULL) | ||
816 | 127 | return; | ||
817 | 128 | |||
818 | 129 | len = g_strv_length (contexts); | ||
819 | 130 | |||
820 | 131 | if (len == 0) | ||
821 | 132 | return; | ||
822 | 133 | |||
823 | 134 | for (i = 0; i < len; i++) | ||
824 | 135 | { | ||
825 | 136 | bamf_unity_webapps_observer_context_appeared (service, contexts[i], observer); | ||
826 | 137 | } | ||
827 | 138 | |||
828 | 139 | g_strfreev (contexts); | ||
829 | 140 | } | ||
830 | 141 | |||
831 | 142 | static void | ||
832 | 143 | bamf_unity_webapps_observer_service_appeared (GDBusConnection *connection, | ||
833 | 144 | const gchar *name, | ||
834 | 145 | const gchar *name_owner, | ||
835 | 146 | gpointer user_data) | ||
836 | 147 | { | ||
837 | 148 | BamfUnityWebappsObserver *observer; | ||
838 | 149 | |||
839 | 150 | observer = (BamfUnityWebappsObserver *)user_data; | ||
840 | 151 | |||
841 | 152 | observer->priv->service = unity_webapps_service_new (); | ||
842 | 153 | |||
843 | 154 | unity_webapps_service_on_context_appeared (observer->priv->service, bamf_unity_webapps_observer_context_appeared, observer); | ||
844 | 155 | unity_webapps_service_on_context_vanished (observer->priv->service, bamf_unity_webapps_observer_context_vanished, observer); | ||
845 | 156 | |||
846 | 157 | bamf_unity_webapps_observer_register_existing_contexts (observer, observer->priv->service); | ||
847 | 158 | } | ||
848 | 159 | |||
849 | 160 | static void | ||
850 | 161 | bamf_unity_webapps_observer_close_all (BamfUnityWebappsObserver *observer) | ||
851 | 162 | { | ||
852 | 163 | GList *names, *walk; | ||
853 | 164 | |||
854 | 165 | names = g_hash_table_get_keys (observer->priv->applications_by_context_name); | ||
855 | 166 | |||
856 | 167 | for (walk = names; walk != NULL; walk = walk->next) | ||
857 | 168 | { | ||
858 | 169 | bamf_unity_webapps_observer_context_vanished (observer->priv->service, (const gchar *)walk->data, | ||
859 | 170 | observer); | ||
860 | 171 | } | ||
861 | 172 | |||
862 | 173 | g_list_free (names); | ||
863 | 174 | |||
864 | 175 | |||
865 | 176 | } | ||
866 | 177 | |||
867 | 178 | static void | ||
868 | 179 | bamf_unity_webapps_observer_service_vanished (GDBusConnection *connection, | ||
869 | 180 | const gchar *name, | ||
870 | 181 | gpointer user_data) | ||
871 | 182 | { | ||
872 | 183 | BamfUnityWebappsObserver *observer; | ||
873 | 184 | observer = (BamfUnityWebappsObserver *)user_data; | ||
874 | 185 | |||
875 | 186 | if (observer->priv->service == NULL) | ||
876 | 187 | { | ||
877 | 188 | return; | ||
878 | 189 | } | ||
879 | 190 | |||
880 | 191 | bamf_unity_webapps_observer_close_all (observer); | ||
881 | 192 | |||
882 | 193 | g_object_unref (G_OBJECT (observer->priv->service)); | ||
883 | 194 | observer->priv->service = NULL; | ||
884 | 195 | } | ||
885 | 196 | |||
886 | 197 | static void | ||
887 | 198 | bamf_unity_webapps_observer_finalize (GObject *object) | ||
888 | 199 | { | ||
889 | 200 | BamfUnityWebappsObserver *observer; | ||
890 | 201 | |||
891 | 202 | observer = BAMF_UNITY_WEBAPPS_OBSERVER (object); | ||
892 | 203 | |||
893 | 204 | g_hash_table_destroy (observer->priv->applications_by_context_name); | ||
894 | 205 | |||
895 | 206 | if (observer->priv->service_watch_id) | ||
896 | 207 | { | ||
897 | 208 | g_bus_unwatch_name (observer->priv->service_watch_id); | ||
898 | 209 | } | ||
899 | 210 | |||
900 | 211 | if (observer->priv->service) | ||
901 | 212 | { | ||
902 | 213 | g_object_unref (G_OBJECT (observer->priv->service)); | ||
903 | 214 | } | ||
904 | 215 | |||
905 | 216 | G_OBJECT_CLASS (bamf_unity_webapps_observer_parent_class)->finalize (object); | ||
906 | 217 | } | ||
907 | 218 | |||
908 | 219 | static void | ||
909 | 220 | bamf_unity_webapps_observer_constructed (GObject *object) | ||
910 | 221 | { | ||
911 | 222 | BamfUnityWebappsObserver *observer; | ||
912 | 223 | |||
913 | 224 | observer = (BamfUnityWebappsObserver *)object; | ||
914 | 225 | if (G_OBJECT_CLASS (bamf_unity_webapps_observer_parent_class)->constructed) | ||
915 | 226 | { | ||
916 | 227 | G_OBJECT_CLASS (bamf_unity_webapps_observer_parent_class)->constructed (object); | ||
917 | 228 | } | ||
918 | 229 | |||
919 | 230 | if (g_strcmp0 (g_getenv ("BAMF_TEST_MODE"), "TRUE") == 0) | ||
920 | 231 | return; | ||
921 | 232 | |||
922 | 233 | observer->priv->service_watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION, | ||
923 | 234 | "com.canonical.Unity.Webapps.Service", | ||
924 | 235 | G_BUS_NAME_WATCHER_FLAGS_NONE, | ||
925 | 236 | bamf_unity_webapps_observer_service_appeared, | ||
926 | 237 | bamf_unity_webapps_observer_service_vanished, | ||
927 | 238 | observer, NULL /* User data free func */); | ||
928 | 239 | |||
929 | 240 | } | ||
930 | 241 | |||
931 | 242 | static void | ||
932 | 243 | bamf_unity_webapps_observer_class_init (BamfUnityWebappsObserverClass *klass) | ||
933 | 244 | { | ||
934 | 245 | GObjectClass *object_class = G_OBJECT_CLASS (klass); | ||
935 | 246 | |||
936 | 247 | object_class->finalize = bamf_unity_webapps_observer_finalize; | ||
937 | 248 | object_class->constructed = bamf_unity_webapps_observer_constructed; | ||
938 | 249 | |||
939 | 250 | g_type_class_add_private (object_class, sizeof(BamfUnityWebappsObserverPrivate)); | ||
940 | 251 | |||
941 | 252 | webapps_observer_signals [APPLICATION_APPEARED] = | ||
942 | 253 | g_signal_new ("application-appeared", | ||
943 | 254 | G_OBJECT_CLASS_TYPE (klass), | ||
944 | 255 | 0, 0, NULL, NULL, NULL, | ||
945 | 256 | G_TYPE_NONE, 1, | ||
946 | 257 | BAMF_TYPE_APPLICATION); | ||
947 | 258 | } | ||
948 | 259 | |||
949 | 260 | |||
950 | 261 | |||
951 | 262 | static void | ||
952 | 263 | bamf_unity_webapps_observer_init (BamfUnityWebappsObserver *observer) | ||
953 | 264 | { | ||
954 | 265 | observer->priv = BAMF_UNITY_WEBAPPS_OBSERVER_GET_PRIVATE (observer); | ||
955 | 266 | |||
956 | 267 | observer->priv->service = NULL; | ||
957 | 268 | |||
958 | 269 | observer->priv->applications_by_context_name = g_hash_table_new_full (g_str_hash, g_str_equal, | ||
959 | 270 | g_free, NULL); | ||
960 | 271 | } | ||
961 | 272 | |||
962 | 273 | BamfUnityWebappsObserver * | ||
963 | 274 | bamf_unity_webapps_observer_new () | ||
964 | 275 | { | ||
965 | 276 | return g_object_new (BAMF_TYPE_UNITY_WEBAPPS_OBSERVER, NULL); | ||
966 | 277 | } | ||
967 | 278 | |||
968 | 279 | 0 | ||
969 | === removed file 'src/bamf-unity-webapps-observer.h' | |||
970 | --- src/bamf-unity-webapps-observer.h 2013-06-13 17:08:07 +0000 | |||
971 | +++ src/bamf-unity-webapps-observer.h 1970-01-01 00:00:00 +0000 | |||
972 | @@ -1,54 +0,0 @@ | |||
973 | 1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ | ||
974 | 2 | /* | ||
975 | 3 | * bamf-unity-webapps-observer.h | ||
976 | 4 | * Copyright (C) Canonical LTD 2011 | ||
977 | 5 | * | ||
978 | 6 | * Author: Robert Carr <racarr@canonical.com> | ||
979 | 7 | * | ||
980 | 8 | * This program is free software: you can redistribute it and/or modify it | ||
981 | 9 | * under the terms of the GNU Lesser General Public License as published | ||
982 | 10 | * by the Free Software Foundation, either version 3 of the License, or | ||
983 | 11 | * (at your option) any later version. | ||
984 | 12 | * | ||
985 | 13 | * unity-webapps is distributed in the hope that it will be useful, but | ||
986 | 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
987 | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
988 | 16 | * See the GNU Lesser General Public License for more details. | ||
989 | 17 | * | ||
990 | 18 | * You should have received a copy of the GNU Lesser General Public License | ||
991 | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>."; | ||
992 | 20 | */ | ||
993 | 21 | |||
994 | 22 | |||
995 | 23 | #ifndef __BAMF_UNITY_WEBAPPS_OBSERVER_H | ||
996 | 24 | #define __BAMF_UNITY_WEBAPPS_OBSERVER_H | ||
997 | 25 | |||
998 | 26 | |||
999 | 27 | #define BAMF_TYPE_UNITY_WEBAPPS_OBSERVER (bamf_unity_webapps_observer_get_type()) | ||
1000 | 28 | #define BAMF_UNITY_WEBAPPS_OBSERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), BAMF_TYPE_UNITY_WEBAPPS_OBSERVER, BamfUnityWebappsObserver)) | ||
1001 | 29 | #define BAMF_UNITY_WEBAPPS_OBSERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), BAMF_TYPE_UNITY_WEBAPPS_OBSERVER, BamfUnityWebappsObserverClass)) | ||
1002 | 30 | #define BAMF_IS_UNITY_WEBAPPS_OBSERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), BAMF_TYPE_UNITY_WEBAPPS_OBSERVER)) | ||
1003 | 31 | #define BAMF_IS_UNITY_WEBAPPS_OBSERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BAMF_TYPE_UNITY_WEBAPPS_OBSERVER)) | ||
1004 | 32 | #define BAMF_UNITY_WEBAPPS_OBSERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), BAMF_TYPE_UNITY_WEBAPPS_OBSERVER, BamfUnityWebappsObserverClass)) | ||
1005 | 33 | |||
1006 | 34 | typedef struct _BamfUnityWebappsObserverPrivate BamfUnityWebappsObserverPrivate; | ||
1007 | 35 | typedef struct _BamfUnityWebappsObserverClass BamfUnityWebappsObserverClass; | ||
1008 | 36 | typedef struct _BamfUnityWebappsObserver BamfUnityWebappsObserver; | ||
1009 | 37 | |||
1010 | 38 | |||
1011 | 39 | struct _BamfUnityWebappsObserver { | ||
1012 | 40 | GObject object; | ||
1013 | 41 | |||
1014 | 42 | BamfUnityWebappsObserverPrivate *priv; | ||
1015 | 43 | }; | ||
1016 | 44 | |||
1017 | 45 | |||
1018 | 46 | struct _BamfUnityWebappsObserverClass { | ||
1019 | 47 | GObjectClass parent_class; | ||
1020 | 48 | }; | ||
1021 | 49 | |||
1022 | 50 | GType bamf_unity_webapps_observer_get_type (void) G_GNUC_CONST; | ||
1023 | 51 | |||
1024 | 52 | BamfUnityWebappsObserver *bamf_unity_webapps_observer_new (); | ||
1025 | 53 | |||
1026 | 54 | #endif | ||
1027 | 55 | 0 | ||
1028 | === removed file 'src/bamf-unity-webapps-tab.c' | |||
1029 | --- src/bamf-unity-webapps-tab.c 2013-06-13 18:40:56 +0000 | |||
1030 | +++ src/bamf-unity-webapps-tab.c 1970-01-01 00:00:00 +0000 | |||
1031 | @@ -1,427 +0,0 @@ | |||
1032 | 1 | /* | ||
1033 | 2 | * Copyright (C) 2010-2011 Canonical Ltd | ||
1034 | 3 | * | ||
1035 | 4 | * This program is free software: you can redistribute it and/or modify | ||
1036 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
1037 | 6 | * published by the Free Software Foundation. | ||
1038 | 7 | * | ||
1039 | 8 | * This program is distributed in the hope that it will be useful, | ||
1040 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1041 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1042 | 11 | * GNU General Public License for more details. | ||
1043 | 12 | * | ||
1044 | 13 | * You should have received a copy of the GNU General Public License | ||
1045 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1046 | 15 | * | ||
1047 | 16 | * Authored by: | ||
1048 | 17 | * Robert Carr <racarr@canonical.com> | ||
1049 | 18 | * | ||
1050 | 19 | */ | ||
1051 | 20 | |||
1052 | 21 | #include "bamf-unity-webapps-tab.h" | ||
1053 | 22 | #include "bamf-matcher.h" | ||
1054 | 23 | |||
1055 | 24 | #include "bamf-legacy-window.h" | ||
1056 | 25 | #include "bamf-legacy-screen.h" | ||
1057 | 26 | |||
1058 | 27 | #include <unity-webapps-service.h> | ||
1059 | 28 | #include <unity-webapps-context.h> | ||
1060 | 29 | |||
1061 | 30 | #define BAMF_UNITY_WEBAPPS_TAB_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE(obj, \ | ||
1062 | 31 | BAMF_TYPE_UNITY_WEBAPPS_TAB, BamfUnityWebappsTabPrivate)) | ||
1063 | 32 | |||
1064 | 33 | G_DEFINE_TYPE(BamfUnityWebappsTab, bamf_unity_webapps_tab, BAMF_TYPE_TAB); | ||
1065 | 34 | |||
1066 | 35 | enum | ||
1067 | 36 | { | ||
1068 | 37 | PROP_0, | ||
1069 | 38 | PROP_CONTEXT, | ||
1070 | 39 | PROP_INTEREST_ID | ||
1071 | 40 | }; | ||
1072 | 41 | |||
1073 | 42 | struct _BamfUnityWebappsTabPrivate | ||
1074 | 43 | { | ||
1075 | 44 | UnityWebappsContext *context; | ||
1076 | 45 | BamfLegacyWindow *legacy_window; | ||
1077 | 46 | gint interest_id; | ||
1078 | 47 | gboolean tab_active; | ||
1079 | 48 | }; | ||
1080 | 49 | |||
1081 | 50 | static void | ||
1082 | 51 | bamf_unity_webapps_tab_ensure_flags (BamfUnityWebappsTab *self) | ||
1083 | 52 | { | ||
1084 | 53 | gboolean window_active; | ||
1085 | 54 | |||
1086 | 55 | // If we don't have a toplevel window assosciated with UnityWebappsContext | ||
1087 | 56 | // determine if it's active. Safer to go with no. | ||
1088 | 57 | if (self->priv->legacy_window == NULL) | ||
1089 | 58 | { | ||
1090 | 59 | bamf_view_set_active (BAMF_VIEW (self), FALSE); | ||
1091 | 60 | return; | ||
1092 | 61 | } | ||
1093 | 62 | |||
1094 | 63 | window_active = bamf_legacy_window_is_active (self->priv->legacy_window); | ||
1095 | 64 | |||
1096 | 65 | bamf_view_set_active (BAMF_VIEW (self), window_active && self->priv->tab_active); | ||
1097 | 66 | } | ||
1098 | 67 | |||
1099 | 68 | static void | ||
1100 | 69 | bamf_unity_webapps_tab_active_window_changed (BamfLegacyScreen *screen, BamfUnityWebappsTab *tab) | ||
1101 | 70 | { | ||
1102 | 71 | bamf_unity_webapps_tab_ensure_flags (tab); | ||
1103 | 72 | } | ||
1104 | 73 | |||
1105 | 74 | static void | ||
1106 | 75 | on_window_closed (BamfLegacyWindow *window, gpointer data) | ||
1107 | 76 | { | ||
1108 | 77 | BamfUnityWebappsTab *self = data; | ||
1109 | 78 | |||
1110 | 79 | g_signal_handlers_disconnect_by_data (self->priv->legacy_window, self); | ||
1111 | 80 | self->priv->legacy_window = NULL; | ||
1112 | 81 | } | ||
1113 | 82 | |||
1114 | 83 | static void | ||
1115 | 84 | bamf_unity_webapps_tab_set_bamf_window (BamfUnityWebappsTab *self, gulong xid) | ||
1116 | 85 | { | ||
1117 | 86 | GList *l; | ||
1118 | 87 | BamfLegacyScreen *screen; | ||
1119 | 88 | |||
1120 | 89 | if (xid == 0) | ||
1121 | 90 | return; | ||
1122 | 91 | |||
1123 | 92 | if (self->priv->legacy_window != NULL) | ||
1124 | 93 | { | ||
1125 | 94 | if (bamf_legacy_window_get_xid (self->priv->legacy_window) == xid) | ||
1126 | 95 | return; | ||
1127 | 96 | |||
1128 | 97 | g_signal_handlers_disconnect_by_data (self->priv->legacy_window, self); | ||
1129 | 98 | self->priv->legacy_window = NULL; | ||
1130 | 99 | } | ||
1131 | 100 | |||
1132 | 101 | screen = bamf_legacy_screen_get_default (); | ||
1133 | 102 | |||
1134 | 103 | for (l = bamf_legacy_screen_get_windows (screen); l; l = l->next) | ||
1135 | 104 | { | ||
1136 | 105 | if (!BAMF_IS_LEGACY_WINDOW (l->data)) | ||
1137 | 106 | continue; | ||
1138 | 107 | |||
1139 | 108 | if (bamf_legacy_window_get_xid (BAMF_LEGACY_WINDOW (l->data)) == xid) | ||
1140 | 109 | { | ||
1141 | 110 | self->priv->legacy_window = l->data; | ||
1142 | 111 | g_signal_connect (self->priv->legacy_window, "closed", (GCallback) on_window_closed, self); | ||
1143 | 112 | break; | ||
1144 | 113 | } | ||
1145 | 114 | } | ||
1146 | 115 | } | ||
1147 | 116 | |||
1148 | 117 | static void | ||
1149 | 118 | bamf_unity_webapps_tab_location_changed (UnityWebappsContext *context, | ||
1150 | 119 | gint interest_id, | ||
1151 | 120 | const gchar *location, | ||
1152 | 121 | gpointer user_data) | ||
1153 | 122 | { | ||
1154 | 123 | BamfUnityWebappsTab *self; | ||
1155 | 124 | |||
1156 | 125 | self = (BamfUnityWebappsTab *)user_data; | ||
1157 | 126 | |||
1158 | 127 | if ((self->priv->interest_id != interest_id) || (self->priv->interest_id == -1)) | ||
1159 | 128 | { | ||
1160 | 129 | return; | ||
1161 | 130 | } | ||
1162 | 131 | |||
1163 | 132 | g_object_set (self, "location", location, NULL); | ||
1164 | 133 | } | ||
1165 | 134 | |||
1166 | 135 | static void | ||
1167 | 136 | bamf_unity_webapps_tab_window_changed (UnityWebappsContext *context, | ||
1168 | 137 | gint interest_id, | ||
1169 | 138 | guint64 xid, | ||
1170 | 139 | gpointer user_data) | ||
1171 | 140 | { | ||
1172 | 141 | BamfUnityWebappsTab *self; | ||
1173 | 142 | |||
1174 | 143 | self = (BamfUnityWebappsTab *)user_data; | ||
1175 | 144 | |||
1176 | 145 | if ((self->priv->interest_id != interest_id) || (self->priv->interest_id == -1)) | ||
1177 | 146 | { | ||
1178 | 147 | return; | ||
1179 | 148 | } | ||
1180 | 149 | |||
1181 | 150 | g_object_set (self, "xid", xid, NULL); | ||
1182 | 151 | |||
1183 | 152 | bamf_unity_webapps_tab_set_bamf_window (self, xid); | ||
1184 | 153 | bamf_unity_webapps_tab_ensure_flags (self); | ||
1185 | 154 | } | ||
1186 | 155 | |||
1187 | 156 | /* | ||
1188 | 157 | * The activity signal from unity-webapps signifies the visibility of the tab WITHIN its toplevel XID. | ||
1189 | 158 | * we have to mask this with window activity. | ||
1190 | 159 | */ | ||
1191 | 160 | static void | ||
1192 | 161 | bamf_unity_webapps_tab_active_changed (UnityWebappsContext *context, | ||
1193 | 162 | gint interest_id, | ||
1194 | 163 | gboolean is_active, | ||
1195 | 164 | gpointer user_data) | ||
1196 | 165 | { | ||
1197 | 166 | BamfUnityWebappsTab *self; | ||
1198 | 167 | |||
1199 | 168 | self = (BamfUnityWebappsTab *)user_data; | ||
1200 | 169 | |||
1201 | 170 | if ((self->priv->interest_id != interest_id) || (self->priv->interest_id == -1)) | ||
1202 | 171 | { | ||
1203 | 172 | return; | ||
1204 | 173 | } | ||
1205 | 174 | |||
1206 | 175 | self->priv->tab_active = is_active; | ||
1207 | 176 | bamf_unity_webapps_tab_ensure_flags (self); | ||
1208 | 177 | |||
1209 | 178 | g_object_set (G_OBJECT (self), "is-foreground-tab", is_active, NULL); | ||
1210 | 179 | } | ||
1211 | 180 | |||
1212 | 181 | static void | ||
1213 | 182 | bamf_unity_webapps_tab_initialize_properties (BamfUnityWebappsTab *self) | ||
1214 | 183 | { | ||
1215 | 184 | gchar *location; | ||
1216 | 185 | guint64 xid; | ||
1217 | 186 | gboolean is_active; | ||
1218 | 187 | |||
1219 | 188 | location = unity_webapps_context_get_view_location (self->priv->context, self->priv->interest_id); | ||
1220 | 189 | xid = unity_webapps_context_get_view_window (self->priv->context, self->priv->interest_id); | ||
1221 | 190 | is_active = unity_webapps_context_get_view_is_active (self->priv->context, self->priv->interest_id); | ||
1222 | 191 | |||
1223 | 192 | g_object_set (self, "location", location, "xid", xid, "is-foreground-tab", is_active, NULL); | ||
1224 | 193 | |||
1225 | 194 | self->priv->tab_active = is_active; | ||
1226 | 195 | bamf_unity_webapps_tab_set_bamf_window (self, xid); | ||
1227 | 196 | bamf_unity_webapps_tab_ensure_flags (self); | ||
1228 | 197 | |||
1229 | 198 | g_free (location); | ||
1230 | 199 | } | ||
1231 | 200 | |||
1232 | 201 | |||
1233 | 202 | static void | ||
1234 | 203 | bamf_unity_webapps_tab_interest_id_set (BamfUnityWebappsTab *self) | ||
1235 | 204 | { | ||
1236 | 205 | unity_webapps_context_on_view_location_changed (self->priv->context, bamf_unity_webapps_tab_location_changed, | ||
1237 | 206 | self); | ||
1238 | 207 | unity_webapps_context_on_view_window_changed (self->priv->context, bamf_unity_webapps_tab_window_changed, | ||
1239 | 208 | self); | ||
1240 | 209 | unity_webapps_context_on_view_is_active_changed (self->priv->context, bamf_unity_webapps_tab_active_changed, | ||
1241 | 210 | self); | ||
1242 | 211 | |||
1243 | 212 | bamf_unity_webapps_tab_initialize_properties (self); | ||
1244 | 213 | |||
1245 | 214 | bamf_view_set_running (BAMF_VIEW (self), TRUE); | ||
1246 | 215 | |||
1247 | 216 | // We don't really use user_visible here, it's not clear to me if we should or not. Maybe it could be used in stead of the internal | ||
1248 | 217 | // tab is active flag...this would let Unity do the masking. Current behavior works well for the current way the pips are specced though. | ||
1249 | 218 | bamf_view_set_user_visible (BAMF_VIEW (self), TRUE); | ||
1250 | 219 | } | ||
1251 | 220 | |||
1252 | 221 | |||
1253 | 222 | static void | ||
1254 | 223 | bamf_unity_webapps_tab_get_property (GObject *object, guint property_id, GValue *gvalue, GParamSpec *pspec) | ||
1255 | 224 | { | ||
1256 | 225 | BamfUnityWebappsTab *self; | ||
1257 | 226 | |||
1258 | 227 | self = BAMF_UNITY_WEBAPPS_TAB (object); | ||
1259 | 228 | |||
1260 | 229 | switch (property_id) | ||
1261 | 230 | { | ||
1262 | 231 | case PROP_CONTEXT: | ||
1263 | 232 | g_value_set_object (gvalue, self->priv->context); | ||
1264 | 233 | break; | ||
1265 | 234 | case PROP_INTEREST_ID: | ||
1266 | 235 | g_value_set_int (gvalue, self->priv->interest_id); | ||
1267 | 236 | break; | ||
1268 | 237 | default: | ||
1269 | 238 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); | ||
1270 | 239 | } | ||
1271 | 240 | } | ||
1272 | 241 | |||
1273 | 242 | static void | ||
1274 | 243 | bamf_unity_webapps_tab_set_property (GObject *object, guint property_id, const GValue *gvalue, GParamSpec *pspec) | ||
1275 | 244 | { | ||
1276 | 245 | BamfUnityWebappsTab *self; | ||
1277 | 246 | |||
1278 | 247 | self = BAMF_UNITY_WEBAPPS_TAB (object); | ||
1279 | 248 | |||
1280 | 249 | switch (property_id) | ||
1281 | 250 | { | ||
1282 | 251 | case PROP_CONTEXT: | ||
1283 | 252 | g_assert (self->priv->context == NULL); | ||
1284 | 253 | self->priv->context = g_value_get_object (gvalue); | ||
1285 | 254 | self->priv->context = unity_webapps_context_new_for_context_name (unity_webapps_context_get_service (self->priv->context), | ||
1286 | 255 | unity_webapps_context_get_context_name (self->priv->context)); | ||
1287 | 256 | break; | ||
1288 | 257 | case PROP_INTEREST_ID: | ||
1289 | 258 | g_assert (self->priv->interest_id == 0); | ||
1290 | 259 | self->priv->interest_id = g_value_get_int (gvalue); | ||
1291 | 260 | bamf_unity_webapps_tab_interest_id_set (self); | ||
1292 | 261 | break; | ||
1293 | 262 | default: | ||
1294 | 263 | G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); | ||
1295 | 264 | } | ||
1296 | 265 | } | ||
1297 | 266 | |||
1298 | 267 | |||
1299 | 268 | static void | ||
1300 | 269 | bamf_unity_webapps_tab_dispose (GObject *object) | ||
1301 | 270 | { | ||
1302 | 271 | BamfUnityWebappsTab *self = BAMF_UNITY_WEBAPPS_TAB (object); | ||
1303 | 272 | |||
1304 | 273 | g_signal_handlers_disconnect_by_data (bamf_legacy_screen_get_default (), self); | ||
1305 | 274 | |||
1306 | 275 | if (self->priv->legacy_window) | ||
1307 | 276 | { | ||
1308 | 277 | g_signal_handlers_disconnect_by_data (self->priv->legacy_window, self); | ||
1309 | 278 | self->priv->legacy_window = NULL; | ||
1310 | 279 | } | ||
1311 | 280 | |||
1312 | 281 | G_OBJECT_CLASS (bamf_unity_webapps_tab_parent_class)->dispose (object); | ||
1313 | 282 | } | ||
1314 | 283 | |||
1315 | 284 | static void | ||
1316 | 285 | bamf_unity_webapps_tab_finalize (GObject *object) | ||
1317 | 286 | { | ||
1318 | 287 | BamfUnityWebappsTab *self = BAMF_UNITY_WEBAPPS_TAB (object); | ||
1319 | 288 | |||
1320 | 289 | g_object_unref (G_OBJECT (self->priv->context)); | ||
1321 | 290 | |||
1322 | 291 | G_OBJECT_CLASS (bamf_unity_webapps_tab_parent_class)->finalize (object); | ||
1323 | 292 | } | ||
1324 | 293 | |||
1325 | 294 | static void | ||
1326 | 295 | bamf_unity_webapps_tab_init (BamfUnityWebappsTab *self) | ||
1327 | 296 | { | ||
1328 | 297 | self->priv = BAMF_UNITY_WEBAPPS_TAB_GET_PRIVATE (self); | ||
1329 | 298 | |||
1330 | 299 | self->priv->tab_active = FALSE; | ||
1331 | 300 | self->priv->legacy_window = NULL; | ||
1332 | 301 | |||
1333 | 302 | g_signal_connect (G_OBJECT (bamf_legacy_screen_get_default ()), "active-window-changed", | ||
1334 | 303 | (GCallback) bamf_unity_webapps_tab_active_window_changed, self); | ||
1335 | 304 | |||
1336 | 305 | } | ||
1337 | 306 | |||
1338 | 307 | static void | ||
1339 | 308 | bamf_unity_webapps_tab_raise (BamfTab *tab) | ||
1340 | 309 | { | ||
1341 | 310 | BamfUnityWebappsTab *self = BAMF_UNITY_WEBAPPS_TAB (tab); | ||
1342 | 311 | |||
1343 | 312 | if (self->priv->interest_id == -1) | ||
1344 | 313 | { | ||
1345 | 314 | return; | ||
1346 | 315 | } | ||
1347 | 316 | |||
1348 | 317 | unity_webapps_context_raise_interest (self->priv->context, self->priv->interest_id); | ||
1349 | 318 | } | ||
1350 | 319 | |||
1351 | 320 | static void | ||
1352 | 321 | bamf_unity_webapps_tab_close (BamfTab *tab) | ||
1353 | 322 | { | ||
1354 | 323 | BamfUnityWebappsTab *self = BAMF_UNITY_WEBAPPS_TAB (tab); | ||
1355 | 324 | |||
1356 | 325 | if (self->priv->interest_id == -1) | ||
1357 | 326 | { | ||
1358 | 327 | return; | ||
1359 | 328 | } | ||
1360 | 329 | |||
1361 | 330 | unity_webapps_context_close_interest (self->priv->context, self->priv->interest_id); | ||
1362 | 331 | } | ||
1363 | 332 | |||
1364 | 333 | typedef struct _bamf_unity_webapps_preview_data { | ||
1365 | 334 | BamfUnityWebappsTab *tab; | ||
1366 | 335 | BamfTabPreviewReadyCallback callback; | ||
1367 | 336 | gpointer user_data; | ||
1368 | 337 | } bamf_unity_webapps_preview_data; | ||
1369 | 338 | |||
1370 | 339 | static void | ||
1371 | 340 | bamf_unity_webapps_tab_preview_ready (UnityWebappsContext *context, | ||
1372 | 341 | gint interest_id, | ||
1373 | 342 | const gchar *preview_data, | ||
1374 | 343 | gpointer user_data) | ||
1375 | 344 | { | ||
1376 | 345 | bamf_unity_webapps_preview_data *data; | ||
1377 | 346 | |||
1378 | 347 | data = (bamf_unity_webapps_preview_data *)user_data; | ||
1379 | 348 | |||
1380 | 349 | data->callback ((BamfTab *)data->tab, preview_data, data->user_data); | ||
1381 | 350 | |||
1382 | 351 | g_slice_free1 (sizeof (bamf_unity_webapps_preview_data), data); | ||
1383 | 352 | } | ||
1384 | 353 | |||
1385 | 354 | static void | ||
1386 | 355 | bamf_unity_webapps_tab_request_preview (BamfTab *tab, | ||
1387 | 356 | BamfTabPreviewReadyCallback callback, | ||
1388 | 357 | gpointer user_data) | ||
1389 | 358 | { | ||
1390 | 359 | BamfUnityWebappsTab *self; | ||
1391 | 360 | bamf_unity_webapps_preview_data *data; | ||
1392 | 361 | |||
1393 | 362 | self = BAMF_UNITY_WEBAPPS_TAB (tab); | ||
1394 | 363 | |||
1395 | 364 | data = g_slice_alloc0 (sizeof (bamf_unity_webapps_preview_data)); | ||
1396 | 365 | |||
1397 | 366 | data->tab = self; | ||
1398 | 367 | data->callback = callback; | ||
1399 | 368 | data->user_data = user_data; | ||
1400 | 369 | |||
1401 | 370 | unity_webapps_context_request_preview (self->priv->context, | ||
1402 | 371 | self->priv->interest_id, | ||
1403 | 372 | bamf_unity_webapps_tab_preview_ready, | ||
1404 | 373 | data); | ||
1405 | 374 | |||
1406 | 375 | } | ||
1407 | 376 | |||
1408 | 377 | static void | ||
1409 | 378 | bamf_unity_webapps_tab_class_init (BamfUnityWebappsTabClass * klass) | ||
1410 | 379 | { | ||
1411 | 380 | GParamSpec *pspec; | ||
1412 | 381 | GObjectClass *object_class = G_OBJECT_CLASS (klass); | ||
1413 | 382 | BamfTabClass *bamf_tab_class = BAMF_TAB_CLASS (klass); | ||
1414 | 383 | |||
1415 | 384 | object_class->get_property = bamf_unity_webapps_tab_get_property; | ||
1416 | 385 | object_class->set_property = bamf_unity_webapps_tab_set_property; | ||
1417 | 386 | object_class->dispose = bamf_unity_webapps_tab_dispose; | ||
1418 | 387 | object_class->finalize = bamf_unity_webapps_tab_finalize; | ||
1419 | 388 | |||
1420 | 389 | bamf_tab_class->raise = bamf_unity_webapps_tab_raise; | ||
1421 | 390 | bamf_tab_class->close = bamf_unity_webapps_tab_close; | ||
1422 | 391 | bamf_tab_class->request_preview = bamf_unity_webapps_tab_request_preview; | ||
1423 | 392 | |||
1424 | 393 | pspec = g_param_spec_object("context", "Context", "The Unity Webapps Context assosciated with the Tab", | ||
1425 | 394 | UNITY_WEBAPPS_TYPE_CONTEXT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); | ||
1426 | 395 | g_object_class_install_property (object_class, PROP_CONTEXT, pspec); | ||
1427 | 396 | |||
1428 | 397 | pspec = g_param_spec_int("interest-id", "Interest ID", "The Interest ID (unique to Context) for this Tab", | ||
1429 | 398 | G_MININT, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); | ||
1430 | 399 | g_object_class_install_property (object_class, PROP_INTEREST_ID, pspec); | ||
1431 | 400 | |||
1432 | 401 | g_type_class_add_private (klass, sizeof (BamfUnityWebappsTabPrivate)); | ||
1433 | 402 | } | ||
1434 | 403 | |||
1435 | 404 | |||
1436 | 405 | gint | ||
1437 | 406 | bamf_unity_webapps_tab_get_interest_id (BamfUnityWebappsTab *tab) | ||
1438 | 407 | { | ||
1439 | 408 | g_return_val_if_fail(tab != NULL, -1); | ||
1440 | 409 | g_return_val_if_fail(BAMF_IS_UNITY_WEBAPPS_TAB(tab), -1); | ||
1441 | 410 | return tab->priv->interest_id; | ||
1442 | 411 | } | ||
1443 | 412 | |||
1444 | 413 | BamfLegacyWindow* | ||
1445 | 414 | bamf_unity_webapps_tab_get_legacy_window_for (BamfUnityWebappsTab *tab) | ||
1446 | 415 | { | ||
1447 | 416 | g_return_val_if_fail(tab != NULL, NULL); | ||
1448 | 417 | g_return_val_if_fail(BAMF_IS_UNITY_WEBAPPS_TAB(tab), NULL); | ||
1449 | 418 | return tab->priv->legacy_window; | ||
1450 | 419 | } | ||
1451 | 420 | |||
1452 | 421 | BamfUnityWebappsTab * | ||
1453 | 422 | bamf_unity_webapps_tab_new (UnityWebappsContext *context, gint interest_id) | ||
1454 | 423 | { | ||
1455 | 424 | return (BamfUnityWebappsTab *)g_object_new (BAMF_TYPE_UNITY_WEBAPPS_TAB, "context", context, "interest-id", interest_id, NULL); | ||
1456 | 425 | } | ||
1457 | 426 | |||
1458 | 427 | |||
1459 | 428 | 0 | ||
1460 | === removed file 'src/bamf-unity-webapps-tab.h' | |||
1461 | --- src/bamf-unity-webapps-tab.h 2013-02-21 15:27:58 +0000 | |||
1462 | +++ src/bamf-unity-webapps-tab.h 1970-01-01 00:00:00 +0000 | |||
1463 | @@ -1,62 +0,0 @@ | |||
1464 | 1 | /* | ||
1465 | 2 | * Copyright (C) 2010-2011 Canonical Ltd | ||
1466 | 3 | * | ||
1467 | 4 | * This program is free software: you can redistribute it and/or modify | ||
1468 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
1469 | 6 | * published by the Free Software Foundation. | ||
1470 | 7 | * | ||
1471 | 8 | * This program is distributed in the hope that it will be useful, | ||
1472 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1473 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1474 | 11 | * GNU General Public License for more details. | ||
1475 | 12 | * | ||
1476 | 13 | * You should have received a copy of the GNU General Public License | ||
1477 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1478 | 15 | * | ||
1479 | 16 | * Authored by: Jason Smith <jason.smith@canonical.com> | ||
1480 | 17 | * Marco Trevisan (Treviño) <3v1n0@ubuntu.com> | ||
1481 | 18 | * | ||
1482 | 19 | */ | ||
1483 | 20 | |||
1484 | 21 | #ifndef __BAMF_UNITY_WEBAPPS_TAB_H__ | ||
1485 | 22 | #define __BAMF_UNITY_WEBAPPS_TAB_H__ | ||
1486 | 23 | |||
1487 | 24 | #include <unity-webapps-context.h> | ||
1488 | 25 | |||
1489 | 26 | #include "bamf-legacy-window.h" | ||
1490 | 27 | #include "bamf-tab.h" | ||
1491 | 28 | |||
1492 | 29 | |||
1493 | 30 | #define BAMF_TYPE_UNITY_WEBAPPS_TAB (bamf_unity_webapps_tab_get_type ()) | ||
1494 | 31 | #define BAMF_UNITY_WEBAPPS_TAB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAMF_TYPE_UNITY_WEBAPPS_TAB, BamfUnityWebappsTab)) | ||
1495 | 32 | #define BAMF_IS_UNITY_WEBAPPS_TAB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAMF_TYPE_UNITY_WEBAPPS_TAB)) | ||
1496 | 33 | #define BAMF_UNITY_WEBAPPS_TAB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BAMF_TYPE_UNITY_WEBAPPS_TAB, BamfUnityWebappsTabClass)) | ||
1497 | 34 | #define BAMF_IS_UNITY_WEBAPPS_TAB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BAMF_TYPE_UNITY_WEBAPPS_TAB)) | ||
1498 | 35 | #define BAMF_UNITY_WEBAPPS_TAB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BAMF_TYPE_UNITY_WEBAPPS_TAB, BamfUnityWebappsUnityWebappsTabClass)) | ||
1499 | 36 | |||
1500 | 37 | typedef struct _BamfUnityWebappsTab BamfUnityWebappsTab; | ||
1501 | 38 | typedef struct _BamfUnityWebappsTabClass BamfUnityWebappsTabClass; | ||
1502 | 39 | typedef struct _BamfUnityWebappsTabPrivate BamfUnityWebappsTabPrivate; | ||
1503 | 40 | |||
1504 | 41 | struct _BamfUnityWebappsTabClass | ||
1505 | 42 | { | ||
1506 | 43 | BamfTabClass parent; | ||
1507 | 44 | }; | ||
1508 | 45 | |||
1509 | 46 | struct _BamfUnityWebappsTab | ||
1510 | 47 | { | ||
1511 | 48 | BamfTab parent; | ||
1512 | 49 | |||
1513 | 50 | /* private */ | ||
1514 | 51 | BamfUnityWebappsTabPrivate *priv; | ||
1515 | 52 | }; | ||
1516 | 53 | |||
1517 | 54 | GType bamf_unity_webapps_tab_get_type (void) G_GNUC_CONST; | ||
1518 | 55 | |||
1519 | 56 | BamfUnityWebappsTab *bamf_unity_webapps_tab_new (UnityWebappsContext *context, gint interest_id); | ||
1520 | 57 | |||
1521 | 58 | gint bamf_unity_webapps_tab_get_interest_id (BamfUnityWebappsTab *tab); | ||
1522 | 59 | BamfLegacyWindow* bamf_unity_webapps_tab_get_legacy_window_for(BamfUnityWebappsTab *tab); | ||
1523 | 60 | |||
1524 | 61 | |||
1525 | 62 | #endif | ||
1526 | 63 | 0 | ||
1527 | === modified file 'tests/bamfdaemon/Makefile.am' | |||
1528 | --- tests/bamfdaemon/Makefile.am 2013-06-13 22:19:56 +0000 | |||
1529 | +++ tests/bamfdaemon/Makefile.am 2014-04-08 14:38:15 +0000 | |||
1530 | @@ -30,12 +30,6 @@ | |||
1531 | 30 | $(top_srcdir)/src/bamf-xutils.h \ | 30 | $(top_srcdir)/src/bamf-xutils.h \ |
1532 | 31 | $(NULL) | 31 | $(NULL) |
1533 | 32 | 32 | ||
1534 | 33 | bamf_test_webapps_sources = \ | ||
1535 | 34 | $(top_srcdir)/src/bamf-unity-webapps-tab.c \ | ||
1536 | 35 | $(top_srcdir)/src/bamf-unity-webapps-observer.c \ | ||
1537 | 36 | $(top_srcdir)/src/bamf-unity-webapps-application.c \ | ||
1538 | 37 | $(NULL) | ||
1539 | 38 | |||
1540 | 39 | test_bamf_SOURCES = \ | 33 | test_bamf_SOURCES = \ |
1541 | 40 | $(bamf_test_extra_sources) \ | 34 | $(bamf_test_extra_sources) \ |
1542 | 41 | $(bamf_test_extra_headers) \ | 35 | $(bamf_test_extra_headers) \ |
1543 | @@ -45,12 +39,6 @@ | |||
1544 | 45 | test-window.c \ | 39 | test-window.c \ |
1545 | 46 | test-matcher.c | 40 | test-matcher.c |
1546 | 47 | 41 | ||
1547 | 48 | if HAVE_WEBAPPS | ||
1548 | 49 | test_bamf_SOURCES += \ | ||
1549 | 50 | $(bamf_test_webapps_sources) \ | ||
1550 | 51 | $(NULL) | ||
1551 | 52 | endif | ||
1552 | 53 | |||
1553 | 54 | test_bamf_CFLAGS = \ | 42 | test_bamf_CFLAGS = \ |
1554 | 55 | -I$(top_srcdir)/src \ | 43 | -I$(top_srcdir)/src \ |
1555 | 56 | -I$(top_srcdir)/lib \ | 44 | -I$(top_srcdir)/lib \ |
1556 | @@ -62,7 +50,6 @@ | |||
1557 | 62 | $(GLIB_CFLAGS) \ | 50 | $(GLIB_CFLAGS) \ |
1558 | 63 | $(GTK_CFLAGS) \ | 51 | $(GTK_CFLAGS) \ |
1559 | 64 | $(GTOP_CFLAGS) \ | 52 | $(GTOP_CFLAGS) \ |
1560 | 65 | $(LIBUNITY_WEBAPPS_CFLAGS) \ | ||
1561 | 66 | $(MAINTAINER_CFLAGS) \ | 53 | $(MAINTAINER_CFLAGS) \ |
1562 | 67 | $(WNCK_CFLAGS) \ | 54 | $(WNCK_CFLAGS) \ |
1563 | 68 | $(X_CFLAGS) \ | 55 | $(X_CFLAGS) \ |
1564 | @@ -73,7 +60,6 @@ | |||
1565 | 73 | $(GLIB_LIBS) \ | 60 | $(GLIB_LIBS) \ |
1566 | 74 | $(GTK_LIBS) \ | 61 | $(GTK_LIBS) \ |
1567 | 75 | $(GTOP_LIBS) \ | 62 | $(GTOP_LIBS) \ |
1568 | 76 | $(LIBUNITY_WEBAPPS_LIBS) \ | ||
1569 | 77 | $(WNCK_LIBS) \ | 63 | $(WNCK_LIBS) \ |
1570 | 78 | $(X_LIBS) \ | 64 | $(X_LIBS) \ |
1571 | 79 | $(NULL) | 65 | $(NULL) |
PASSED: Continuous integration, rev:598 jenkins. qa.ubuntu. com/job/ bamf-ci/ 102/ jenkins. qa.ubuntu. com/job/ bamf-trusty- amd64-ci/ 10 jenkins. qa.ubuntu. com/job/ bamf-trusty- armhf-ci/ 10 jenkins. qa.ubuntu. com/job/ bamf-trusty- armhf-ci/ 10/artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/bamf- ci/102/ rebuild
http://