summaryrefslogtreecommitdiff
diff options
authorAlexandre Abreu <alexandre.abreu@canonical.com>2014-04-07 17:31:21 -0400
committerAlexandre Abreu <alexandre.abreu@canonical.com>2014-04-07 17:31:21 -0400
commit1b1096ca0cd92ad87fc6c2407f992a0f1c6f5893 (patch)
tree16a5efed664dc8173086be9d806dc7165e801201
parenta876bdd121c6952e957af0f97827652bc87eb6bb (diff)
remove libunity-webapp deps
(bzr r597.1.1)
-rw-r--r--configure.ac17
-rw-r--r--debian/control1
-rw-r--r--src/Makefile.am21
-rw-r--r--src/bamf-matcher-private.h4
-rw-r--r--src/bamf-matcher.c165
-rw-r--r--src/bamf-unity-webapps-application.c339
-rw-r--r--src/bamf-unity-webapps-application.h63
-rw-r--r--src/bamf-unity-webapps-observer.c278
-rw-r--r--src/bamf-unity-webapps-observer.h54
-rw-r--r--src/bamf-unity-webapps-tab.c427
-rw-r--r--src/bamf-unity-webapps-tab.h62
-rw-r--r--tests/bamfdaemon/Makefile.am14
12 files changed, 3 insertions, 1442 deletions
diff --git a/configure.ac b/configure.ac
index d11a59a1..371fa4f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -91,22 +91,6 @@ fi
GTK_DOC_CHECK(1.0)
###########################
-# libunity_webapps
-###########################
-AC_ARG_ENABLE([webapps],
- AS_HELP_STRING([--enable-webapps],
- [Enable libunity-webapps support]),
- [enable_webapps=$enableval],
- [enable_webapps=yes])
-if test "x$enable_webapps" = "xyes"; then
- PKG_CHECK_MODULES(LIBUNITY_WEBAPPS, libunity_webapps-0.2)
- AC_DEFINE_UNQUOTED(HAVE_WEBAPPS, , [Use libunity-webapps])
-fi
-AM_CONDITIONAL([HAVE_WEBAPPS], [test "x$enable_webapps" = "xyes"])
-AC_SUBST(LIBUNITY_WEBAPPS_CFLAGS)
-AC_SUBST(LIBUNITY_WEBAPPS_LIBS)
-
-###########################
# gtester2xunit checks #
###########################
@@ -184,7 +168,6 @@ ${PACKAGE}-${VERSION}
Build Environment
Install Prefix: ${prefix}
Introspection: ${enable_introspection}
- Unity Webapps: ${enable_webapps}
Headless tests: ${enable_headless_tests}
Coverage Reporting: ${use_gcov}
diff --git a/debian/control b/debian/control
index bab31f4a..27ba342c 100644
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,6 @@ Build-Depends: dbus-x11,
libglib2.0-dev (>= 2.32.0),
libgtop2-dev,
libgtk-3-dev (>= 3.0.0),
- libunity-webapps-dev (>= 2.3.3),
libwnck-3-dev (>= 3.4.7),
libgirepository1.0-dev,
python-libxslt1,
diff --git a/src/Makefile.am b/src/Makefile.am
index 1e0bf252..39983efa 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -37,30 +37,11 @@ bamfdaemon_headers = \
bamf-xutils.h \
$(NULL)
-bamfdaemon_webapps_sources = \
- bamf-unity-webapps-tab.c \
- bamf-unity-webapps-observer.c \
- bamf-unity-webapps-application.c \
- $(NULL)
-
-bamfdaemon_webapps_headers = \
- bamf-unity-webapps-tab.h \
- bamf-unity-webapps-observer.h \
- bamf-unity-webapps-application.h \
- $(NULL)
-
bamfdaemon_SOURCES = \
$(bamfdaemon_sources) \
$(bamfdaemon_headers) \
$(NULL)
-if HAVE_WEBAPPS
-bamfdaemon_SOURCES += \
- $(bamfdaemon_webapps_sources) \
- $(bamfdaemon_webapps_headers) \
- $(NULL)
-endif
-
bamfdaemon_LDADD = \
$(LIBBAMF_PRIVATE_LIB) \
$(X_LIBS) \
@@ -68,7 +49,6 @@ bamfdaemon_LDADD = \
$(GTK_LIBS) \
$(WNCK_LIBS) \
$(GTOP_LIBS) \
- $(LIBUNITY_WEBAPPS_LIBS) \
$(NULL)
bamfdaemon_CFLAGS = \
@@ -82,7 +62,6 @@ bamfdaemon_CFLAGS = \
$(GTK_CFLAGS) \
$(WNCK_CFLAGS) \
$(GTOP_CFLAGS) \
- $(LIBUNITY_WEBAPPS_CFLAGS) \
$(COVERAGE_CFLAGS) \
$(NULL)
diff --git a/src/bamf-matcher-private.h b/src/bamf-matcher-private.h
index bbe90980..20a7d039 100644
--- a/src/bamf-matcher-private.h
+++ b/src/bamf-matcher-private.h
@@ -25,13 +25,9 @@
#include "bamf-application.h"
#include "bamf-window.h"
#include "bamf-legacy-window.h"
-#include "bamf-unity-webapps-observer.h"
struct _BamfMatcherPrivate
{
-#ifdef HAVE_WEBAPPS
- BamfUnityWebappsObserver *webapps_observer;
-#endif
GArray * bad_prefixes;
GArray * good_prefixes;
GHashTable * desktop_id_table;
diff --git a/src/bamf-matcher.c b/src/bamf-matcher.c
index 97ffda0a..15a9089b 100644
--- a/src/bamf-matcher.c
+++ b/src/bamf-matcher.c
@@ -27,10 +27,6 @@
#include "bamf-window.h"
#include "bamf-legacy-screen.h"
-#ifdef HAVE_WEBAPPS
-#include "bamf-unity-webapps-application.h"
-#include "bamf-unity-webapps-tab.h"
-#endif
#include <strings.h>
#define BAMF_INDEX_NAME "bamf-2.index"
@@ -1487,41 +1483,6 @@ is_libreoffice_window (BamfLegacyWindow * window)
}
static gboolean
-is_web_app_window (BamfLegacyWindow *window)
-{
- const char *window_class = bamf_legacy_window_get_class_name (window);
- const char *instance_name = bamf_legacy_window_get_class_instance_name (window);
-
- // Chrome/Chromium uses url wm_class strings to represent its web apps.
- // These apps will still have the same parent pid and hints as the main chrome
- // window, so we skip the hint check.
- // We can tell a window is a chrome web app window if its instance name is
- // not google-chrome but its window class is Google-chrome
- // We can tell a window is chromium web app window if its instance name is
- // not chromium-browser but its window class is Chromium Browser
-
- gboolean valid_app = FALSE;
-
- if (instance_name && window_class)
- {
- if (g_strcmp0 (window_class, "Google-chrome") == 0 &&
- g_strcmp0 (instance_name, "google-chrome") != 0 &&
- !g_str_has_prefix (instance_name, "Google-chrome"))
- {
- valid_app = TRUE;
- }
- else if (g_strcmp0 (window_class, "Chromium-browser") == 0 &&
- g_strcmp0 (instance_name, "chromium-browser") != 0 &&
- !g_str_has_prefix (instance_name, "Chromium-browser"))
- {
- valid_app = TRUE;
- }
- }
-
- return valid_app;
-}
-
-static gboolean
is_javaws_window (BamfLegacyWindow *window)
{
const char *window_class = bamf_legacy_window_get_class_name (window);
@@ -1541,7 +1502,7 @@ bamf_matcher_window_skips_hint_set (BamfMatcher *self, BamfLegacyWindow *window)
gboolean skip_hint_set;
g_return_val_if_fail (BAMF_IS_MATCHER (self), TRUE);
- skip_hint_set = is_libreoffice_window (window) || is_web_app_window (window) || is_javaws_window (window);
+ skip_hint_set = is_libreoffice_window (window) || is_javaws_window (window);
return skip_hint_set;
}
@@ -1648,16 +1609,8 @@ bamf_matcher_possible_applications_for_window (BamfMatcher *self,
if (!filter_by_wmclass)
{
- if (is_web_app_window (window))
- {
- // This ensures that a new application is created even for unknown webapps
- filter_by_wmclass = TRUE;
- }
- else
- {
- target_class = class_name;
- filter_by_wmclass = bamf_matcher_has_instance_class_desktop_file (self, target_class);
- }
+ target_class = class_name;
+ filter_by_wmclass = bamf_matcher_has_instance_class_desktop_file (self, target_class);
}
if (desktop_file)
@@ -2940,103 +2893,6 @@ on_dbus_handle_window_stack_for_monitor (BamfDBusMatcher *interface,
return TRUE;
}
-#ifdef HAVE_WEBAPPS
-static gboolean
-bamf_matcher_has_tab_with_parent_xid (BamfMatcher *matcher, guint64 xid)
-{
- GList *l;
- g_return_val_if_fail (BAMF_IS_MATCHER (matcher), FALSE);
-
- for (l = matcher->priv->views; l; l = l->next)
- {
- if (!BAMF_IS_TAB (l->data))
- continue;
-
- if (xid == bamf_tab_get_xid (BAMF_TAB (l->data)))
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-on_webapp_child_added (BamfView *application,
- BamfView *child,
- gpointer user_data)
-{
- BamfMatcher *self;
- BamfLegacyWindow *legacy_window;
- BamfUnityWebappsTab *webapp_tab;
-
- g_return_if_fail (BAMF_IS_MATCHER (user_data));
- g_return_if_fail (BAMF_IS_UNITY_WEBAPPS_TAB (child));
-
- self = BAMF_MATCHER (user_data);
- webapp_tab = BAMF_UNITY_WEBAPPS_TAB (child);
- legacy_window = bamf_unity_webapps_tab_get_legacy_window_for (webapp_tab);
-
- if (legacy_window && is_web_app_window (legacy_window))
- {
- /* If we have a chromeless window, we remove the window from the
- * application children list, so that it won't be duplicated in launcher */
-
- guint tab_xid = bamf_tab_get_xid (BAMF_TAB (webapp_tab));
-
- if (!bamf_matcher_has_tab_with_parent_xid (self, tab_xid))
- {
- BamfApplication *old_application = bamf_matcher_get_application_by_xid (self, tab_xid);
-
- if (BAMF_IS_APPLICATION (old_application))
- {
- BamfWindow *bamf_window = bamf_application_get_window (old_application, tab_xid);
-
- if (BAMF_IS_VIEW (bamf_window))
- bamf_view_remove_child (BAMF_VIEW (old_application), BAMF_VIEW (bamf_window));
- }
- }
- }
-
- bamf_matcher_register_view_stealing_ref (self, child);
-}
-
-static void on_webapp_child_removed (BamfView *application,
- BamfView *child,
- gpointer user_data)
-{
- BamfLegacyWindow *legacy_window;
- BamfUnityWebappsTab *webapp_tab;
-
- g_return_if_fail (BAMF_IS_UNITY_WEBAPPS_TAB (child));
-
- webapp_tab = BAMF_UNITY_WEBAPPS_TAB (child);
- legacy_window = bamf_unity_webapps_tab_get_legacy_window_for (webapp_tab);
-
- if (is_web_app_window (legacy_window))
- {
- /* If we have a chromeless window, we re-match it again as soon as the
- * webapp handler is gone, so that we don't lose its control */
- bamf_legacy_window_reopen (legacy_window);
- }
-}
-
-static void
-on_webapp_appeared (BamfUnityWebappsObserver *observer,
- BamfApplication *application,
- gpointer user_data)
-{
- BamfMatcher *self;
-
- self = (BamfMatcher *)user_data;
-
- bamf_matcher_register_view_stealing_ref (self, (BamfView *)application);
-
- g_signal_connect (application, "child-added-internal", G_CALLBACK (on_webapp_child_added), self);
- g_signal_connect (application, "child-removed-internal", G_CALLBACK (on_webapp_child_removed), self);
-
- bamf_unity_webapps_application_add_existing_interests (BAMF_UNITY_WEBAPPS_APPLICATION (application));
-}
-#endif
-
static void
bamf_matcher_init (BamfMatcher * self)
{
@@ -3117,13 +2973,6 @@ bamf_matcher_init (BamfMatcher * self)
g_signal_connect (self, "handle-window-stack-for-monitor",
G_CALLBACK (on_dbus_handle_window_stack_for_monitor), self);
-
-#ifdef HAVE_WEBAPPS
- priv->webapps_observer = bamf_unity_webapps_observer_new ();
-
- g_signal_connect (priv->webapps_observer, "application-appeared",
- G_CALLBACK (on_webapp_appeared), self);
-#endif
}
static void
@@ -3137,14 +2986,6 @@ bamf_matcher_dispose (GObject *object)
bamf_matcher_unregister_view (self, priv->views->data);
}
-#ifdef HAVE_WEBAPPS
- if (priv->webapps_observer)
- {
- g_object_unref (G_OBJECT (priv->webapps_observer));
- priv->webapps_observer = NULL;
- }
-#endif
-
G_OBJECT_CLASS (bamf_matcher_parent_class)->dispose (object);
}
diff --git a/src/bamf-unity-webapps-application.c b/src/bamf-unity-webapps-application.c
deleted file mode 100644
index e5c00fde..00000000
--- a/src/bamf-unity-webapps-application.c
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * Copyright (C) 2010-2011 Canonical Ltd
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANAPPLICATIONILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authored by:
- * Robert Carr <racarr@canonical.com>
- *
- */
-
-#include <stdlib.h>
-
-
-#include "bamf-unity-webapps-application.h"
-#include "bamf-unity-webapps-tab.h"
-#include "bamf-matcher.h"
-
-#include <unity-webapps-context.h>
-
-#define BAMF_UNITY_WEBAPPS_APPLICATION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE(obj, \
-BAMF_TYPE_UNITY_WEBAPPS_APPLICATION, BamfUnityWebappsApplicationPrivate))
-
-G_DEFINE_TYPE(BamfUnityWebappsApplication, bamf_unity_webapps_application, BAMF_TYPE_APPLICATION);
-
-enum
-{
- PROP_0,
- PROP_CONTEXT,
-};
-
-struct _BamfUnityWebappsApplicationPrivate
-{
- UnityWebappsContext *context;
-};
-
-
-static void
-bamf_unity_webapps_application_get_application_menu (BamfApplication *application,
- gchar **name,
- gchar **path)
-{
- BamfUnityWebappsApplication *self;
-
- self = (BamfUnityWebappsApplication *)application;
-
- *name = g_strdup (unity_webapps_context_get_context_name (self->priv->context));
- *path = g_strdup (UNITY_WEBAPPS_CONTEXT_MENU_PATH);
-}
-
-static void
-bamf_unity_webapps_application_get_property (GObject *object, guint property_id, GValue *gvalue, GParamSpec *pspec)
-{
- BamfUnityWebappsApplication *self;
-
- self = BAMF_UNITY_WEBAPPS_APPLICATION (object);
-
- switch (property_id)
- {
- case PROP_CONTEXT:
- g_value_set_object (gvalue, self->priv->context);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- }
-}
-
-static BamfUnityWebappsTab *
-bamf_unity_webapps_application_find_child_by_interest (BamfUnityWebappsApplication *application,
- gint interest_id)
-{
- GList *children, *walk;
- BamfUnityWebappsTab *child;
-
- children = bamf_view_get_children (BAMF_VIEW (application));
-
- for (walk = children; walk != NULL; walk = walk->next)
- {
- child = BAMF_UNITY_WEBAPPS_TAB (walk->data);
-
- if (interest_id == bamf_unity_webapps_tab_get_interest_id (child))
- {
- return child;
- }
- }
-
- return NULL;
-}
-
-static BamfView *
-bamf_unity_webapps_application_get_focusable_child (BamfApplication *application)
-{
- BamfUnityWebappsApplication *self;
- gint focus_interest;
-
- self = BAMF_UNITY_WEBAPPS_APPLICATION (application);
-
- focus_interest = unity_webapps_context_get_focus_interest (self->priv->context);
-
- if (focus_interest == -1)
- return NULL;
-
- return (BamfView *)bamf_unity_webapps_application_find_child_by_interest (self, focus_interest);
-}
-
-
-static void
-bamf_unity_webapps_application_interest_appeared (UnityWebappsContext *context,
- gint interest_id,
- gpointer user_data)
-{
- BamfUnityWebappsApplication *self;
- BamfUnityWebappsTab *child;
-
- self = BAMF_UNITY_WEBAPPS_APPLICATION (user_data);
-
- child = bamf_unity_webapps_application_find_child_by_interest (self, interest_id);
-
- if (child != NULL)
- {
- return;
- }
-
- child = bamf_unity_webapps_tab_new (context, interest_id);
- bamf_view_add_child (BAMF_VIEW (self), BAMF_VIEW (child));
-
- // It's possible that the context had become lonely (i.e. no children) but not yet shut down.
- // however, if we gain an interest we are always running and "mapped".
- bamf_view_set_running (BAMF_VIEW (self), TRUE);
- bamf_view_set_user_visible (BAMF_VIEW (self), TRUE);
-}
-
-static void
-bamf_unity_webapps_application_interest_vanished (UnityWebappsContext *context,
- gint interest_id,
- gpointer user_data)
-{
- BamfUnityWebappsApplication *self;
- BamfUnityWebappsTab *child;
-
- self = (BamfUnityWebappsApplication *)user_data;
-
- child = bamf_unity_webapps_application_find_child_by_interest (self, interest_id);
-
- if (child == NULL)
- {
- return;
- }
-
- bamf_view_remove_child (BAMF_VIEW (self), BAMF_VIEW (child));
-}
-
-/* It doesn't make any sense for a BamfUnityWebappsTab to live without it's assosciated context.
- * so when our children are removed, dispose of them. */
-static void
-bamf_unity_webapps_application_child_removed (BamfView *view, BamfView *child)
-{
- // Chain up first before we destroy the object.
- BAMF_VIEW_CLASS (bamf_unity_webapps_application_parent_class)->child_removed (view, child);
-
- bamf_view_set_running (child, FALSE);
- bamf_view_close (BAMF_VIEW (child));
-}
-
-void
-bamf_unity_webapps_application_add_existing_interests (BamfUnityWebappsApplication *self)
-{
- GVariant *interests, *interest_variant;
- GVariantIter *variant_iter;
-
- interests = unity_webapps_context_list_interests (self->priv->context);
-
- if (interests == NULL)
- {
- return;
- }
-
- variant_iter = g_variant_iter_new (interests);
-
- while ((interest_variant = g_variant_iter_next_value (variant_iter)))
- {
- gint interest_id;
-
- interest_id = g_variant_get_int32 (interest_variant);
-
- bamf_unity_webapps_application_interest_appeared (self->priv->context, interest_id, self);
- }
-}
-
-static void
-bamf_unity_webapps_application_context_set (BamfUnityWebappsApplication *self)
-{
- bamf_application_set_desktop_file_from_id (BAMF_APPLICATION (self),
- unity_webapps_context_get_desktop_name (self->priv->context));
-
- unity_webapps_context_on_interest_appeared (self->priv->context, bamf_unity_webapps_application_interest_appeared, self);
- unity_webapps_context_on_interest_vanished (self->priv->context, bamf_unity_webapps_application_interest_vanished, self);
-}
-
-static void
-bamf_unity_webapps_application_set_property (GObject *object, guint property_id, const GValue *gvalue, GParamSpec *pspec)
-{
- BamfUnityWebappsApplication *self;
-
- self = BAMF_UNITY_WEBAPPS_APPLICATION (object);
-
- switch (property_id)
- {
- case PROP_CONTEXT:
- g_assert (self->priv->context == NULL);
- self->priv->context = g_value_get_object (gvalue);
-
- bamf_unity_webapps_application_context_set (self);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
- }
-}
-
-static gchar *
-bamf_unity_webapps_application_get_stable_bus_name (BamfView *view)
-{
- const gchar *desktop_file;
-
- desktop_file = bamf_application_get_desktop_file (BAMF_APPLICATION (view));
-
- if (desktop_file)
- {
- return g_strdup_printf ("webapp/%i", abs (g_str_hash (desktop_file)));
- }
-
- return g_strdup_printf ("webapp/%p", view);
-}
-
-
-static void
-bamf_unity_webapps_application_finalize (GObject *object)
-{
- BamfUnityWebappsApplication *self = BAMF_UNITY_WEBAPPS_APPLICATION (object);
-
- g_object_unref (self->priv->context);
-
- G_OBJECT_CLASS (bamf_unity_webapps_application_parent_class)->finalize (object);
-}
-
-static void
-on_accept_data_changed (UnityWebappsContext *context, const gchar **file, gpointer user_data)
-{
- BamfUnityWebappsApplication *self = BAMF_UNITY_WEBAPPS_APPLICATION (user_data);
-
- g_signal_emit_by_name (self, "supported-mimes-changed", file);
-}
-
-static void
-bamf_unity_webapps_application_constructed (GObject *object)
-{
- BamfUnityWebappsApplication *self;
-
- self = (BamfUnityWebappsApplication *)object;
-
- g_signal_connect (self->priv->context, "accept-data-changed", G_CALLBACK (on_accept_data_changed), self);
-}
-
-
-static void
-bamf_unity_webapps_application_init (BamfUnityWebappsApplication *self)
-{
- self->priv = BAMF_UNITY_WEBAPPS_APPLICATION_GET_PRIVATE (self);
-
- bamf_application_set_application_type (BAMF_APPLICATION (self), BAMF_APPLICATION_WEB);
-
-}
-
-static char **
-bamf_unity_webapps_application_get_supported_mime_types (BamfApplication *application)
-{
- BamfUnityWebappsApplication *self = BAMF_UNITY_WEBAPPS_APPLICATION (application);
-
- return unity_webapps_context_get_application_accept_data (self->priv->context);
-}
-
-static gboolean
-bamf_unity_webapps_application_get_close_when_empty (BamfApplication *application)
-{
- // Sometimes we might have no children for a short period (for example, the page is reloading), in the case
- // Unity Webapps will keep the context alive for a while. Allowing for new children to appear...before eventually
- // shutting it down. So we use this flag to ensure BAMF will not shut us down prematurely.
- return FALSE;
-}
-
-static void
-bamf_unity_webapps_application_class_init (BamfUnityWebappsApplicationClass * klass)
-{
- GParamSpec *pspec;
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- BamfApplicationClass *bamf_application_class = BAMF_APPLICATION_CLASS (klass);
- BamfViewClass *bamf_view_class = BAMF_VIEW_CLASS (klass);
-
- object_class->get_property = bamf_unity_webapps_application_get_property;
- object_class->set_property = bamf_unity_webapps_application_set_property;
- object_class->finalize = bamf_unity_webapps_application_finalize;
- object_class->constructed = bamf_unity_webapps_application_constructed;
-
- bamf_view_class->stable_bus_name = bamf_unity_webapps_application_get_stable_bus_name;
- bamf_view_class->child_removed = bamf_unity_webapps_application_child_removed;
-
- bamf_application_class->get_application_menu = bamf_unity_webapps_application_get_application_menu;
- bamf_application_class->get_focusable_child = bamf_unity_webapps_application_get_focusable_child;
- bamf_application_class->get_supported_mime_types = bamf_unity_webapps_application_get_supported_mime_types;
- bamf_application_class->get_close_when_empty = bamf_unity_webapps_application_get_close_when_empty;
-
- pspec = g_param_spec_object("context", "Context", "The Unity Webapps Context assosciated with the Application",
- UNITY_WEBAPPS_TYPE_CONTEXT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_property (object_class, PROP_CONTEXT, pspec);
-
- g_type_class_add_private (klass, sizeof (BamfUnityWebappsApplicationPrivate));
-}
-
-
-BamfApplication *
-bamf_unity_webapps_application_new (UnityWebappsContext *context)
-{
- return (BamfApplication *)g_object_new (BAMF_TYPE_UNITY_WEBAPPS_APPLICATION, "context", context, NULL);
-}
-
-UnityWebappsContext *
-bamf_unity_webapps_application_get_context (BamfUnityWebappsApplication *application)
-{
- return application->priv->context;
-}
diff --git a/src/bamf-unity-webapps-application.h b/src/bamf-unity-webapps-application.h
deleted file mode 100644
index 7c63b6f7..00000000
--- a/src/bamf-unity-webapps-application.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2010-2011 Canonical Ltd
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANAPPLICATIONILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authored by: Jason Smith <jason.smith@canonical.com>
- * Marco Trevisan (Treviño) <3v1n0@ubuntu.com>
- *
- */
-
-#ifndef __BAMF_UNITY_WEBAPPS_APPLICATION_H__
-#define __BAMF_UNITY_WEBAPPS_APPLICATION_H__
-
-#include <unity-webapps-context.h>
-
-#include "bamf-application.h"
-
-
-#define BAMF_TYPE_UNITY_WEBAPPS_APPLICATION (bamf_unity_webapps_application_get_type ())
-#define BAMF_UNITY_WEBAPPS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAMF_TYPE_UNITY_WEBAPPS_APPLICATION, BamfUnityWebappsApplication))
-#define BAMF_IS_UNITY_WEBAPPS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAMF_TYPE_UNITY_WEBAPPS_APPLICATION))
-#define BAMF_UNITY_WEBAPPS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BAMF_TYPE_UNITY_WEBAPPS_APPLICATION, BamfUnityWebappsApplicationClass))
-#define BAMF_IS_UNITY_WEBAPPS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BAMF_TYPE_UNITY_WEBAPPS_APPLICATION))
-#define BAMF_UNITY_WEBAPPS_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BAMF_TYPE_UNITY_WEBAPPS_APPLICATION, BamfUnityWebappsUnityWebappsApplicationClass))
-
-typedef struct _BamfUnityWebappsApplication BamfUnityWebappsApplication;
-typedef struct _BamfUnityWebappsApplicationClass BamfUnityWebappsApplicationClass;
-typedef struct _BamfUnityWebappsApplicationPrivate BamfUnityWebappsApplicationPrivate;
-
-struct _BamfUnityWebappsApplicationClass
-{
- BamfApplicationClass parent;
-};
-
-struct _BamfUnityWebappsApplication
-{
- BamfApplication parent;
-
- /* private */
- BamfUnityWebappsApplicationPrivate *priv;
-};
-
-GType bamf_unity_webapps_application_get_type (void) G_GNUC_CONST;
-
-BamfApplication *bamf_unity_webapps_application_new (UnityWebappsContext *context);
-UnityWebappsContext *bamf_unity_webapps_application_get_context (BamfUnityWebappsApplication *application);
-
-void
-bamf_unity_webapps_application_add_existing_interests (BamfUnityWebappsApplication *self);
-
-
-
-#endif
diff --git a/src/bamf-unity-webapps-observer.c b/src/bamf-unity-webapps-observer.c
deleted file mode 100644
index 4f22f0e1..00000000
--- a/src/bamf-unity-webapps-observer.c
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * bamf-unity-webapps-observer.c
- * Copyright (C) Canonical LTD 2012
- *
- * Author: Robert Carr <racarr@canonical.com>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * unity-webapps is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.";
- */
-
-#include "bamf-unity-webapps-tab.h"
-#include "bamf-unity-webapps-observer.h"
-#include "bamf-unity-webapps-application.h"
-#include "bamf-matcher.h"
-
-struct _BamfUnityWebappsObserverPrivate {
- UnityWebappsService *service;
-
- GHashTable *applications_by_context_name;
-
- guint service_watch_id;
-};
-
-G_DEFINE_TYPE(BamfUnityWebappsObserver, bamf_unity_webapps_observer, G_TYPE_OBJECT)
-
-enum
-{
- APPLICATION_APPEARED,
- LAST_SIGNAL
-};
-
-static guint webapps_observer_signals[LAST_SIGNAL] = { 0 };
-
-
-#define BAMF_UNITY_WEBAPPS_OBSERVER_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), BAMF_TYPE_UNITY_WEBAPPS_OBSERVER, BamfUnityWebappsObserverPrivate))
-
-static void
-bamf_unity_webapps_observer_context_vanished (UnityWebappsService *service,
- const gchar *name,
- gpointer user_data)
-{
- BamfUnityWebappsObserver *observer;
- BamfApplication *application;
-
- observer = (BamfUnityWebappsObserver *)user_data;
-
- application = g_hash_table_lookup (observer->priv->applications_by_context_name, name);
-
- if (application == NULL)
- return;
-
- bamf_view_set_running (BAMF_VIEW (application), FALSE);
- bamf_view_close (BAMF_VIEW (application));
-
- g_hash_table_remove (observer->priv->applications_by_context_name, name);
-
-}
-
-static void
-bamf_unity_webapps_application_closed (BamfView *view,
- gpointer user_data)
-{
- BamfUnityWebappsObserver *observer;
- BamfUnityWebappsApplication *application;
- UnityWebappsContext *context;
- const gchar *context_name;
-
- observer = (BamfUnityWebappsObserver *)user_data;
-
- application = BAMF_UNITY_WEBAPPS_APPLICATION (view);
-
- context = bamf_unity_webapps_application_get_context (application);
- context_name = unity_webapps_context_get_context_name (context);
-
- g_hash_table_remove (observer->priv->applications_by_context_name, context_name);
-}
-
-static void
-bamf_unity_webapps_observer_context_appeared (UnityWebappsService *service,
- const gchar *name,
- gpointer user_data)
-{
- BamfUnityWebappsObserver *observer;
- UnityWebappsContext *context;
- BamfApplication *application;
-
- if (name == NULL || name[0] == '\0')
- return;
-
- observer = (BamfUnityWebappsObserver *)user_data;
-
- if (g_hash_table_lookup (observer->priv->applications_by_context_name, name) != NULL)
- return;
-
- context = unity_webapps_context_new_for_context_name (observer->priv->service, name);
-
- application = bamf_unity_webapps_application_new (context);
-
- g_signal_connect (G_OBJECT (application), "closed-internal", G_CALLBACK (bamf_unity_webapps_application_closed),
- observer);
-
- g_hash_table_insert (observer->priv->applications_by_context_name, g_strdup (name), application);
-
- g_signal_emit (observer, webapps_observer_signals[APPLICATION_APPEARED], 0, application);
-}
-
-static void
-bamf_unity_webapps_observer_register_existing_contexts (BamfUnityWebappsObserver *observer,
- UnityWebappsService *service)
-{
- gchar **contexts;
- gint i, len;
-
- contexts = unity_webapps_service_list_contexts (service);
-
- if (contexts == NULL)
- return;
-
- len = g_strv_length (contexts);
-
- if (len == 0)
- return;
-
- for (i = 0; i < len; i++)
- {
- bamf_unity_webapps_observer_context_appeared (service, contexts[i], observer);
- }
-
- g_strfreev (contexts);
-}
-
-static void
-bamf_unity_webapps_observer_service_appeared (GDBusConnection *connection,
- const gchar *name,
- const gchar *name_owner,
- gpointer user_data)
-{
- BamfUnityWebappsObserver *observer;
-
- observer = (BamfUnityWebappsObserver *)user_data;
-
- observer->priv->service = unity_webapps_service_new ();
-
- unity_webapps_service_on_context_appeared (observer->priv->service, bamf_unity_webapps_observer_context_appeared, observer);
- unity_webapps_service_on_context_vanished (observer->priv->service, bamf_unity_webapps_observer_context_vanished, observer);
-
- bamf_unity_webapps_observer_register_existing_contexts (observer, observer->priv->service);
-}
-
-static void
-bamf_unity_webapps_observer_close_all (BamfUnityWebappsObserver *observer)
-{
- GList *names, *walk;
-
- names = g_hash_table_get_keys (observer->priv->applications_by_context_name);
-
- for (walk = names; walk != NULL; walk = walk->next)
- {
- bamf_unity_webapps_observer_context_vanished (observer->priv->service, (const gchar *)walk->data,
- observer);
- }
-
- g_list_free (names);
-
-
-}
-
-static void
-bamf_unity_webapps_observer_service_vanished (GDBusConnection *connection,
- const gchar *name,
- gpointer user_data)
-{
- BamfUnityWebappsObserver *observer;
- observer = (BamfUnityWebappsObserver *)user_data;
-
- if (observer->priv->service == NULL)
- {
- return;
- }
-
- bamf_unity_webapps_observer_close_all (observer);
-
- g_object_unref (G_OBJECT (observer->priv->service));
- observer->priv->service = NULL;
-}
-
-static void
-bamf_unity_webapps_observer_finalize (GObject *object)
-{
- BamfUnityWebappsObserver *observer;
-
- observer = BAMF_UNITY_WEBAPPS_OBSERVER (object);
-
- g_hash_table_destroy (observer->priv->applications_by_context_name);
-
- if (observer->priv->service_watch_id)
- {
- g_bus_unwatch_name (observer->priv->service_watch_id);
- }
-
- if (observer->priv->service)
- {
- g_object_unref (G_OBJECT (observer->priv->service));
- }
-
- G_OBJECT_CLASS (bamf_unity_webapps_observer_parent_class)->finalize (object);
-}
-
-static void
-bamf_unity_webapps_observer_constructed (GObject *object)
-{
- BamfUnityWebappsObserver *observer;
-
- observer = (BamfUnityWebappsObserver *)object;
- if (G_OBJECT_CLASS (bamf_unity_webapps_observer_parent_class)->constructed)
- {
- G_OBJECT_CLASS (bamf_unity_webapps_observer_parent_class)->constructed (object);
- }
-
- if (g_strcmp0 (g_getenv ("BAMF_TEST_MODE"), "TRUE") == 0)
- return;
-
- observer->priv->service_watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
- "com.canonical.Unity.Webapps.Service",
- G_BUS_NAME_WATCHER_FLAGS_NONE,
- bamf_unity_webapps_observer_service_appeared,
- bamf_unity_webapps_observer_service_vanished,
- observer, NULL /* User data free func */);
-
-}
-
-static void
-bamf_unity_webapps_observer_class_init (BamfUnityWebappsObserverClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = bamf_unity_webapps_observer_finalize;
- object_class->constructed = bamf_unity_webapps_observer_constructed;
-
- g_type_class_add_private (object_class, sizeof(BamfUnityWebappsObserverPrivate));
-
- webapps_observer_signals [APPLICATION_APPEARED] =
- g_signal_new ("application-appeared",
- G_OBJECT_CLASS_TYPE (klass),
- 0, 0, NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- BAMF_TYPE_APPLICATION);
-}
-
-
-
-static void
-bamf_unity_webapps_observer_init (BamfUnityWebappsObserver *observer)
-{
- observer->priv = BAMF_UNITY_WEBAPPS_OBSERVER_GET_PRIVATE (observer);
-
- observer->priv->service = NULL;
-
- observer->priv->applications_by_context_name = g_hash_table_new_full (g_str_hash, g_str_equal,
- g_free, NULL);
-}
-
-BamfUnityWebappsObserver *
-bamf_unity_webapps_observer_new ()
-{
- return g_object_new (BAMF_TYPE_UNITY_WEBAPPS_OBSERVER, NULL);
-}
-
diff --git a/src/bamf-unity-webapps-observer.h b/src/bamf-unity-webapps-observer.h
deleted file mode 100644
index 0679974d..00000000
--- a/src/bamf-unity-webapps-observer.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
-/*
- * bamf-unity-webapps-observer.h
- * Copyright (C) Canonical LTD 2011
- *
- * Author: Robert Carr <racarr@canonical.com>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * unity-webapps is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.";
- */
-
-
-#ifndef __BAMF_UNITY_WEBAPPS_OBSERVER_H
-#define __BAMF_UNITY_WEBAPPS_OBSERVER_H
-
-
-#define BAMF_TYPE_UNITY_WEBAPPS_OBSERVER (bamf_unity_webapps_observer_get_type())
-#define BAMF_UNITY_WEBAPPS_OBSERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), BAMF_TYPE_UNITY_WEBAPPS_OBSERVER, BamfUnityWebappsObserver))
-#define BAMF_UNITY_WEBAPPS_OBSERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), BAMF_TYPE_UNITY_WEBAPPS_OBSERVER, BamfUnityWebappsObserverClass))
-#define BAMF_IS_UNITY_WEBAPPS_OBSERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), BAMF_TYPE_UNITY_WEBAPPS_OBSERVER))
-#define BAMF_IS_UNITY_WEBAPPS_OBSERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BAMF_TYPE_UNITY_WEBAPPS_OBSERVER))
-#define BAMF_UNITY_WEBAPPS_OBSERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), BAMF_TYPE_UNITY_WEBAPPS_OBSERVER, BamfUnityWebappsObserverClass))
-
-typedef struct _BamfUnityWebappsObserverPrivate BamfUnityWebappsObserverPrivate;
-typedef struct _BamfUnityWebappsObserverClass BamfUnityWebappsObserverClass;
-typedef struct _BamfUnityWebappsObserver BamfUnityWebappsObserver;
-
-
-struct _BamfUnityWebappsObserver {
- GObject object;
-
- BamfUnityWebappsObserverPrivate *priv;
-};
-
-
-struct _BamfUnityWebappsObserverClass {
- GObjectClass parent_class;
-};
-
-GType bamf_unity_webapps_observer_get_type (void) G_GNUC_CONST;
-
-BamfUnityWebappsObserver *bamf_unity_webapps_observer_new ();
-
-#endif
diff --git a/src/bamf-unity-webapps-tab.c b/src/bamf-unity-webapps-tab.c
deleted file mode 100644
index 77cd2565..00000000
--- a/src/bamf-unity-webapps-tab.c
+++ /dev/null
@@ -1,427 +0,0 @@
-/*
- * Copyright (C) 2010-2011 Canonical Ltd
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authored by:
- * Robert Carr <racarr@canonical.com>
- *
- */
-
-#include "bamf-unity-webapps-tab.h"
-#include "bamf-matcher.h"
-
-#include "bamf-legacy-window.h"
-#include "bamf-legacy-screen.h"
-
-#include <unity-webapps-service.h>
-#include <unity-webapps-context.h>
-
-#define BAMF_UNITY_WEBAPPS_TAB_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE(obj, \
-BAMF_TYPE_UNITY_WEBAPPS_TAB, BamfUnityWebappsTabPrivate))
-
-G_DEFINE_TYPE(BamfUnityWebappsTab, bamf_unity_webapps_tab, BAMF_TYPE_TAB);
-
-enum
-{
- PROP_0,
- PROP_CONTEXT,
- PROP_INTEREST_ID
-};
-
-struct _BamfUnityWebappsTabPrivate
-{
- UnityWebappsContext *context;
- BamfLegacyWindow *legacy_window;
- gint interest_id;
- gboolean tab_active;
-};
-
-static void
-bamf_unity_webapps_tab_ensure_flags (BamfUnityWebappsTab *self)
-{
- gboolean window_active;
-
- // If we don't have a toplevel window assosciated with UnityWebappsContext
- // determine if it's active. Safer to go with no.
- if (self->priv->legacy_window == NULL)
- {
- bamf_view_set_active (BAMF_VIEW (self), FALSE);
- return;
- }
-
- window_active = bamf_legacy_window_is_active (self->priv->legacy_window);
-
- bamf_view_set_active (BAMF_VIEW (self), window_active && self->priv->tab_active);
-}
-
-static void
-bamf_unity_webapps_tab_active_window_changed (BamfLegacyScreen *screen, BamfUnityWebappsTab *tab)
-{
- bamf_unity_webapps_tab_ensure_flags (tab);
-}
-
-static void
-on_window_closed (BamfLegacyWindow *window, gpointer data)
-{
- BamfUnityWebappsTab *self = data;
-
- g_signal_handlers_disconnect_by_data (self->priv->legacy_window, self);
- self->priv->legacy_window = NULL;
-}
-
-static void
-bamf_unity_webapps_tab_set_bamf_window (BamfUnityWebappsTab *self, gulong xid)
-{
- GList *l;
- BamfLegacyScreen *screen;
-
- if (xid == 0)
- return;
-
- if (self->priv->legacy_window != NULL)
- {
- if (bamf_legacy_window_get_xid (self->priv->legacy_window) == xid)
- return;
-
- g_signal_handlers_disconnect_by_data (self->priv->legacy_window, self);
- self->priv->legacy_window = NULL;
- }
-
- screen = bamf_legacy_screen_get_default ();
-
- for (l = bamf_legacy_screen_get_windows (screen); l; l = l->next)
- {
- if (!BAMF_IS_LEGACY_WINDOW (l->data))
- continue;
-
- if (bamf_legacy_window_get_xid (BAMF_LEGACY_WINDOW (l->data)) == xid)
- {
- self->priv->legacy_window = l->data;
- g_signal_connect (self->priv->legacy_window, "closed", (GCallback) on_window_closed, self);
- break;
- }
- }
-}
-
-static void
-bamf_unity_webapps_tab_location_changed (UnityWebappsContext *context,
- gint interest_id,
- const gchar *location,
- gpointer user_data)
-{
- BamfUnityWebappsTab *self;
-
- self = (BamfUnityWebappsTab *)user_data;
-
- if ((self->priv->interest_id != interest_id) || (self->priv->interest_id == -1))
- {
- return;
- }
-
- g_object_set (self, "location", location, NULL);
-}
-
-static void
-bamf_unity_webapps_tab_window_changed (UnityWebappsContext *context,
- gint interest_id,
- guint64 xid,
- gpointer user_data)
-{
- BamfUnityWebappsTab *self;
-
- self = (BamfUnityWebappsTab *)user_data;
-
- if ((self->priv->interest_id != interest_id) || (self->priv->interest_id == -1))
- {
- return;
- }
-
- g_object_set (self, "xid", xid, NULL);
-
- bamf_unity_webapps_tab_set_bamf_window (self, xid);
- bamf_unity_webapps_tab_ensure_flags (self);
-}
-
-/*
- * The activity signal from unity-webapps signifies the visibility of the tab WITHIN its toplevel XID.
- * we have to mask this with window activity.
- */
-static void
-bamf_unity_webapps_tab_active_changed (UnityWebappsContext *context,
- gint interest_id,
- gboolean is_active,
- gpointer user_data)
-{
- BamfUnityWebappsTab *self;
-
- self = (BamfUnityWebappsTab *)user_data;
-
- if ((self->priv->interest_id != interest_id) || (self->priv->interest_id == -1))
- {
- return;
- }
-
- self->priv->tab_active = is_active;
- bamf_unity_webapps_tab_ensure_flags (self);
-
- g_object_set (G_OBJECT (self), "is-foreground-tab", is_active, NULL);
-}
-
-static void
-bamf_unity_webapps_tab_initialize_properties (BamfUnityWebappsTab *self)
-{
- gchar *location;
- guint64 xid;
- gboolean is_active;
-
- location = unity_webapps_context_get_view_location (self->priv->context, self->priv->interest_id);
- xid = unity_webapps_context_get_view_window (self->priv->context, self->priv->interest_id);
- is_active = unity_webapps_context_get_view_is_active (self->priv->context, self->priv->interest_id);
-
- g_object_set (self, "location", location, "xid", xid, "is-foreground-tab", is_active, NULL);
-
- self->priv->tab_active = is_active;
- bamf_unity_webapps_tab_set_bamf_window (self, xid);
- bamf_unity_webapps_tab_ensure_flags (self);
-
- g_free (location);
-}
-
-
-static void
-bamf_unity_webapps_tab_interest_id_set (BamfUnityWebappsTab *self)
-{
- unity_webapps_context_on_view_location_changed (self->priv->context, bamf_unity_webapps_tab_location_changed,
- self);
- unity_webapps_context_on_view_window_changed (self->priv->context, bamf_unity_webapps_tab_window_changed,
- self);
- unity_webapps_context_on_view_is_active_changed (self->priv->context, bamf_unity_webapps_tab_active_changed,
- self);
-
- bamf_unity_webapps_tab_initialize_properties (self);
-
- bamf_view_set_running (BAMF_VIEW (self), TRUE);
-
- // 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
- // tab is active flag...this would let Unity do the masking. Current behavior works well for the current way the pips are specced though.
- bamf_view_set_user_visible (BAMF_VIEW (self), TRUE);
-}
-
-
-static void
-bamf_unity_webapps_tab_get_property (GObject *object, guint property_id, GValue *gvalue, GParamSpec *pspec)
-{
- BamfUnityWebappsTab *self;
-
- self = BAMF_UNITY_WEBAPPS_TAB (object);
-
- switch (property_id)
- {
- case PROP_CONTEXT:
- g_value_set_object (gvalue, self->priv->context);
- break;
- case PROP_INTEREST_ID:
- g_value_set_int (gvalue, self->priv->interest_id);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- }
-}
-
-static void
-bamf_unity_webapps_tab_set_property (GObject *object, guint property_id, const GValue *gvalue, GParamSpec *pspec)
-{
- BamfUnityWebappsTab *self;
-
- self = BAMF_UNITY_WEBAPPS_TAB (object);
-
- switch (property_id)
- {
- case PROP_CONTEXT:
- g_assert (self->priv->context == NULL);
- self->priv->context = g_value_get_object (gvalue);
- self->priv->context = unity_webapps_context_new_for_context_name (unity_webapps_context_get_service (self->priv->context),
- unity_webapps_context_get_context_name (self->priv->context));
- break;
- case PROP_INTEREST_ID:
- g_assert (self->priv->interest_id == 0);
- self->priv->interest_id = g_value_get_int (gvalue);
- bamf_unity_webapps_tab_interest_id_set (self);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
- }
-}
-
-
-static void
-bamf_unity_webapps_tab_dispose (GObject *object)
-{
- BamfUnityWebappsTab *self = BAMF_UNITY_WEBAPPS_TAB (object);
-
- g_signal_handlers_disconnect_by_data (bamf_legacy_screen_get_default (), self);
-
- if (self->priv->legacy_window)
- {
- g_signal_handlers_disconnect_by_data (self->priv->legacy_window, self);
- self->priv->legacy_window = NULL;
- }
-
- G_OBJECT_CLASS (bamf_unity_webapps_tab_parent_class)->dispose (object);
-}
-
-static void
-bamf_unity_webapps_tab_finalize (GObject *object)
-{
- BamfUnityWebappsTab *self = BAMF_UNITY_WEBAPPS_TAB (object);
-
- g_object_unref (G_OBJECT (self->priv->context));
-
- G_OBJECT_CLASS (bamf_unity_webapps_tab_parent_class)->finalize (object);
-}
-
-static void
-bamf_unity_webapps_tab_init (BamfUnityWebappsTab *self)
-{
- self->priv = BAMF_UNITY_WEBAPPS_TAB_GET_PRIVATE (self);
-
- self->priv->tab_active = FALSE;
- self->priv->legacy_window = NULL;
-
- g_signal_connect (G_OBJECT (bamf_legacy_screen_get_default ()), "active-window-changed",
- (GCallback) bamf_unity_webapps_tab_active_window_changed, self);
-
-}
-
-static void
-bamf_unity_webapps_tab_raise (BamfTab *tab)
-{
- BamfUnityWebappsTab *self = BAMF_UNITY_WEBAPPS_TAB (tab);
-
- if (self->priv->interest_id == -1)
- {
- return;
- }
-
- unity_webapps_context_raise_interest (self->priv->context, self->priv->interest_id);
-}
-
-static void
-bamf_unity_webapps_tab_close (BamfTab *tab)
-{
- BamfUnityWebappsTab *self = BAMF_UNITY_WEBAPPS_TAB (tab);
-
- if (self->priv->interest_id == -1)
- {
- return;
- }
-
- unity_webapps_context_close_interest (self->priv->context, self->priv->interest_id);
-}
-
-typedef struct _bamf_unity_webapps_preview_data {
- BamfUnityWebappsTab *tab;
- BamfTabPreviewReadyCallback callback;
- gpointer user_data;
-} bamf_unity_webapps_preview_data;
-
-static void
-bamf_unity_webapps_tab_preview_ready (UnityWebappsContext *context,
- gint interest_id,
- const gchar *preview_data,
- gpointer user_data)
-{
- bamf_unity_webapps_preview_data *data;
-
- data = (bamf_unity_webapps_preview_data *)user_data;
-
- data->callback ((BamfTab *)data->tab, preview_data, data->user_data);
-
- g_slice_free1 (sizeof (bamf_unity_webapps_preview_data), data);
-}
-
-static void
-bamf_unity_webapps_tab_request_preview (BamfTab *tab,
- BamfTabPreviewReadyCallback callback,
- gpointer user_data)
-{
- BamfUnityWebappsTab *self;
- bamf_unity_webapps_preview_data *data;
-
- self = BAMF_UNITY_WEBAPPS_TAB (tab);
-
- data = g_slice_alloc0 (sizeof (bamf_unity_webapps_preview_data));
-
- data->tab = self;
- data->callback = callback;
- data->user_data = user_data;
-
- unity_webapps_context_request_preview (self->priv->context,
- self->priv->interest_id,
- bamf_unity_webapps_tab_preview_ready,
- data);
-
-}
-
-static void
-bamf_unity_webapps_tab_class_init (BamfUnityWebappsTabClass * klass)
-{
- GParamSpec *pspec;
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- BamfTabClass *bamf_tab_class = BAMF_TAB_CLASS (klass);
-
- object_class->get_property = bamf_unity_webapps_tab_get_property;
- object_class->set_property = bamf_unity_webapps_tab_set_property;
- object_class->dispose = bamf_unity_webapps_tab_dispose;
- object_class->finalize = bamf_unity_webapps_tab_finalize;
-
- bamf_tab_class->raise = bamf_unity_webapps_tab_raise;
- bamf_tab_class->close = bamf_unity_webapps_tab_close;
- bamf_tab_class->request_preview = bamf_unity_webapps_tab_request_preview;
-
- pspec = g_param_spec_object("context", "Context", "The Unity Webapps Context assosciated with the Tab",
- UNITY_WEBAPPS_TYPE_CONTEXT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_property (object_class, PROP_CONTEXT, pspec);
-
- pspec = g_param_spec_int("interest-id", "Interest ID", "The Interest ID (unique to Context) for this Tab",
- G_MININT, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_property (object_class, PROP_INTEREST_ID, pspec);
-
- g_type_class_add_private (klass, sizeof (BamfUnityWebappsTabPrivate));
-}
-
-
-gint
-bamf_unity_webapps_tab_get_interest_id (BamfUnityWebappsTab *tab)
-{
- g_return_val_if_fail(tab != NULL, -1);
- g_return_val_if_fail(BAMF_IS_UNITY_WEBAPPS_TAB(tab), -1);
- return tab->priv->interest_id;
-}
-
-BamfLegacyWindow*
-bamf_unity_webapps_tab_get_legacy_window_for (BamfUnityWebappsTab *tab)
-{
- g_return_val_if_fail(tab != NULL, NULL);
- g_return_val_if_fail(BAMF_IS_UNITY_WEBAPPS_TAB(tab), NULL);
- return tab->priv->legacy_window;
-}
-
-BamfUnityWebappsTab *
-bamf_unity_webapps_tab_new (UnityWebappsContext *context, gint interest_id)
-{
- return (BamfUnityWebappsTab *)g_object_new (BAMF_TYPE_UNITY_WEBAPPS_TAB, "context", context, "interest-id", interest_id, NULL);
-}
-
-
diff --git a/src/bamf-unity-webapps-tab.h b/src/bamf-unity-webapps-tab.h
deleted file mode 100644
index 080477ba..00000000
--- a/src/bamf-unity-webapps-tab.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2010-2011 Canonical Ltd
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authored by: Jason Smith <jason.smith@canonical.com>
- * Marco Trevisan (Treviño) <3v1n0@ubuntu.com>
- *
- */
-
-#ifndef __BAMF_UNITY_WEBAPPS_TAB_H__
-#define __BAMF_UNITY_WEBAPPS_TAB_H__
-
-#include <unity-webapps-context.h>
-
-#include "bamf-legacy-window.h"
-#include "bamf-tab.h"
-
-
-#define BAMF_TYPE_UNITY_WEBAPPS_TAB (bamf_unity_webapps_tab_get_type ())
-#define BAMF_UNITY_WEBAPPS_TAB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAMF_TYPE_UNITY_WEBAPPS_TAB, BamfUnityWebappsTab))
-#define BAMF_IS_UNITY_WEBAPPS_TAB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAMF_TYPE_UNITY_WEBAPPS_TAB))
-#define BAMF_UNITY_WEBAPPS_TAB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BAMF_TYPE_UNITY_WEBAPPS_TAB, BamfUnityWebappsTabClass))
-#define BAMF_IS_UNITY_WEBAPPS_TAB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BAMF_TYPE_UNITY_WEBAPPS_TAB))
-#define BAMF_UNITY_WEBAPPS_TAB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BAMF_TYPE_UNITY_WEBAPPS_TAB, BamfUnityWebappsUnityWebappsTabClass))
-
-typedef struct _BamfUnityWebappsTab BamfUnityWebappsTab;
-typedef struct _BamfUnityWebappsTabClass BamfUnityWebappsTabClass;
-typedef struct _BamfUnityWebappsTabPrivate BamfUnityWebappsTabPrivate;
-
-struct _BamfUnityWebappsTabClass
-{
- BamfTabClass parent;
-};
-
-struct _BamfUnityWebappsTab
-{
- BamfTab parent;
-
- /* private */
- BamfUnityWebappsTabPrivate *priv;
-};
-
-GType bamf_unity_webapps_tab_get_type (void) G_GNUC_CONST;
-
-BamfUnityWebappsTab *bamf_unity_webapps_tab_new (UnityWebappsContext *context, gint interest_id);
-
-gint bamf_unity_webapps_tab_get_interest_id (BamfUnityWebappsTab *tab);
-BamfLegacyWindow* bamf_unity_webapps_tab_get_legacy_window_for(BamfUnityWebappsTab *tab);
-
-
-#endif
diff --git a/tests/bamfdaemon/Makefile.am b/tests/bamfdaemon/Makefile.am
index e8f94e05..e64df3ac 100644
--- a/tests/bamfdaemon/Makefile.am
+++ b/tests/bamfdaemon/Makefile.am
@@ -30,12 +30,6 @@ bamf_test_extra_headers = \
$(top_srcdir)/src/bamf-xutils.h \
$(NULL)
-bamf_test_webapps_sources = \
- $(top_srcdir)/src/bamf-unity-webapps-tab.c \
- $(top_srcdir)/src/bamf-unity-webapps-observer.c \
- $(top_srcdir)/src/bamf-unity-webapps-application.c \
- $(NULL)
-
test_bamf_SOURCES = \
$(bamf_test_extra_sources) \
$(bamf_test_extra_headers) \
@@ -45,12 +39,6 @@ test_bamf_SOURCES = \
test-window.c \
test-matcher.c
-if HAVE_WEBAPPS
-test_bamf_SOURCES += \
- $(bamf_test_webapps_sources) \
- $(NULL)
-endif
-
test_bamf_CFLAGS = \
-I$(top_srcdir)/src \
-I$(top_srcdir)/lib \
@@ -62,7 +50,6 @@ test_bamf_CFLAGS = \
$(GLIB_CFLAGS) \
$(GTK_CFLAGS) \
$(GTOP_CFLAGS) \
- $(LIBUNITY_WEBAPPS_CFLAGS) \
$(MAINTAINER_CFLAGS) \
$(WNCK_CFLAGS) \
$(X_CFLAGS) \
@@ -73,7 +60,6 @@ test_bamf_LDADD = \
$(GLIB_LIBS) \
$(GTK_LIBS) \
$(GTOP_LIBS) \
- $(LIBUNITY_WEBAPPS_LIBS) \
$(WNCK_LIBS) \
$(X_LIBS) \
$(NULL)