aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-extensions-manager.c
diff options
context:
space:
mode:
authorAdam Hooper <adamh@src.gnome.org>2004-12-18 02:03:35 +0800
committerAdam Hooper <adamh@src.gnome.org>2004-12-18 02:03:35 +0800
commit9bf71295e9a4e5cdfe9dc4380343616c49b161c6 (patch)
tree6b3aa6ef7d872a5cdc84da940b240e723b93c800 /src/ephy-extensions-manager.c
parentc5b4d13e2e64dd3e28de75b17f6a436f339d5dc2 (diff)
downloadgsoc2013-epiphany-9bf71295e9a4e5cdfe9dc4380343616c49b161c6.tar
gsoc2013-epiphany-9bf71295e9a4e5cdfe9dc4380343616c49b161c6.tar.gz
gsoc2013-epiphany-9bf71295e9a4e5cdfe9dc4380343616c49b161c6.tar.bz2
gsoc2013-epiphany-9bf71295e9a4e5cdfe9dc4380343616c49b161c6.tar.lz
gsoc2013-epiphany-9bf71295e9a4e5cdfe9dc4380343616c49b161c6.tar.xz
gsoc2013-epiphany-9bf71295e9a4e5cdfe9dc4380343616c49b161c6.tar.zst
gsoc2013-epiphany-9bf71295e9a4e5cdfe9dc4380343616c49b161c6.zip
Add attach_tab and detach_tab functions to extension interface (bug
#153732). Thanks to Crispin for almost all of the code.
Diffstat (limited to 'src/ephy-extensions-manager.c')
-rw-r--r--src/ephy-extensions-manager.c83
1 files changed, 81 insertions, 2 deletions
diff --git a/src/ephy-extensions-manager.c b/src/ephy-extensions-manager.c
index a6ef2bf36..ed650c749 100644
--- a/src/ephy-extensions-manager.c
+++ b/src/ephy-extensions-manager.c
@@ -742,12 +742,21 @@ get_loader_for_type (EphyExtensionsManager *manager,
return NULL;
}
-
static void
attach_window (EphyWindow *window,
EphyExtension *extension)
{
+ GList *tabs, *l;
+
ephy_extension_attach_window (extension, window);
+
+ tabs = ephy_window_get_tabs (window);
+ for (l = tabs; l; l = l->next)
+ {
+ ephy_extension_attach_tab (extension, window,
+ EPHY_TAB (l->data));
+ }
+ g_list_free (tabs);
}
static void
@@ -805,6 +814,16 @@ static void
detach_window (EphyWindow *window,
EphyExtension *extension)
{
+ GList *tabs, *l;
+
+ tabs = ephy_window_get_tabs (window);
+ for (l = tabs; l; l = l->next)
+ {
+ ephy_extension_detach_tab (extension, window,
+ EPHY_TAB (l->data));
+ }
+ g_list_free (tabs);
+
ephy_extension_detach_window (extension, window);
}
@@ -1225,6 +1244,13 @@ ephy_extensions_manager_finalize (GObject *object)
}
static void
+attach_extension_to_window (EphyExtension *extension,
+ EphyWindow *window)
+{
+ attach_window (window, extension);
+}
+
+static void
impl_attach_window (EphyExtension *extension,
EphyWindow *window)
{
@@ -1233,7 +1259,7 @@ impl_attach_window (EphyExtension *extension,
LOG ("Attach")
g_list_foreach (manager->priv->extensions,
- (GFunc) ephy_extension_attach_window, window);
+ (GFunc) attach_extension_to_window, window);
manager->priv->windows = g_list_prepend (manager->priv->windows, window);
}
@@ -1243,6 +1269,7 @@ impl_detach_window (EphyExtension *extension,
EphyWindow *window)
{
EphyExtensionsManager *manager = EPHY_EXTENSIONS_MANAGER (extension);
+ GList *tabs, *l;
LOG ("Detach")
@@ -1250,6 +1277,16 @@ impl_detach_window (EphyExtension *extension,
g_object_ref (window);
+ /* Detach tabs (uses impl_detach_tab) */
+ tabs = ephy_window_get_tabs (window);
+ for (l = tabs; l; l = l->next)
+ {
+ ephy_extension_detach_tab (extension, window,
+ EPHY_TAB (l->data));
+ }
+ g_list_free (tabs);
+
+ /* Then detach the window */
g_list_foreach (manager->priv->extensions,
(GFunc) ephy_extension_detach_window, window);
@@ -1257,10 +1294,52 @@ impl_detach_window (EphyExtension *extension,
}
static void
+impl_attach_tab (EphyExtension *extension,
+ EphyWindow *window,
+ EphyTab *tab)
+{
+ EphyExtensionsManager *manager = EPHY_EXTENSIONS_MANAGER (extension);
+ GList *l;
+
+ LOG ("Attach tab");
+
+ for (l = manager->priv->extensions; l; l = l->next)
+ {
+ ephy_extension_attach_tab (EPHY_EXTENSION (l->data),
+ window, tab);
+ }
+}
+
+static void
+impl_detach_tab (EphyExtension *extension,
+ EphyWindow *window,
+ EphyTab *tab)
+{
+ EphyExtensionsManager *manager = EPHY_EXTENSIONS_MANAGER (extension);
+ GList *l;
+
+ LOG ("Detach Tab");
+
+ g_object_ref (window);
+ g_object_ref (tab);
+
+ for (l = manager->priv->extensions; l; l = l->next)
+ {
+ ephy_extension_detach_tab (EPHY_EXTENSION (l->data),
+ window, tab);
+ }
+
+ g_object_unref (tab);
+ g_object_unref (window);
+}
+
+static void
ephy_extensions_manager_iface_init (EphyExtensionIface *iface)
{
iface->attach_window = impl_attach_window;
iface->detach_window = impl_detach_window;
+ iface->attach_tab = impl_attach_tab;
+ iface->detach_tab = impl_detach_tab;
}
static void