Merge lp:~abreu-alexandre/bamf/remove-webapps-deps into lp:bamf

Proposed by Alexandre Abreu
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
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).

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
Robert Bruce Park (robru) wrote :

Oh my god, all this red is giving me a nerdgasm! I'm putting this in a silo ASAP

Revision history for this message
Robert Bruce Park (robru) wrote :

debian/control looks good to me at least. can't speak for the rest of it though

review: Approve (packaging)
Revision history for this message
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.

review: Approve
Revision history for this message
David Barth (dbarth) :
review: Approve
Revision history for this message
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_window (window) || is_web_app_window (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_has_instance_class_desktop_file (self, target_class);
195 - }
196 + target_class = class_name;
197 + filter_by_wmclass = bamf_matcher_has_instance_class_desktop_file (self, target_class);

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.

review: Needs Fixing
Revision history for this message
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 (window) || is_web_app_window
> (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_has_instance_class_desktop_file
> (self, target_class);
> 195 - }
> 196 + target_class = class_name;
> 197 + filter_by_wmclass = bamf_matcher_has_instance_class_desktop_file
> (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,

Revision history for this message
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.

review: Approve

Preview Diff

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

Subscribers

People subscribed via source and target branches

to all changes: