2
* Copyright © 2003 Marco Pesenti Gritti
3
* Copyright © 2003 Christian Persch
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2, or (at your option)
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
#include "ephy-sample2-extension.h"
25
#include "mozilla-sample.h"
26
#include "ephy-debug.h"
28
#include <epiphany/ephy-extension.h>
30
#include <glib/gi18n-lib.h>
33
#define EPHY_SAMPLE2_EXTENSION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_SAMPLE2_EXTENSION, EphySample2ExtensionPrivate))
35
struct _EphySample2ExtensionPrivate
45
static GObjectClass *parent_class = NULL;
47
static GType type = 0;
50
ephy_sample2_extension_init (EphySample2Extension *extension)
52
extension->priv = EPHY_SAMPLE2_EXTENSION_GET_PRIVATE (extension);
54
LOG ("EphySample2Extension initialising");
58
ephy_sample2_extension_finalize (GObject *object)
61
EphySample2Extension *extension = EPHY_SAMPLE2_EXTENSION (object);
63
LOG ("EphySample2Extension finalising");
65
G_OBJECT_CLASS (parent_class)->finalize (object);
69
dom_mouse_down_cb (EphyEmbed *embed,
70
EphyEmbedEvent *event,
71
EphySample2Extension *extension)
75
dom_event = ephy_embed_event_get_dom_event (event);
77
LOG ("DOM Event %p", dom_event);
79
mozilla_do_something (dom_event);
85
impl_attach_window (EphyExtension *ext,
90
LOG ("EphySample2Extension attach_window");
92
notebook = ephy_window_get_notebook (window);
96
impl_detach_window (EphyExtension *ext,
101
LOG ("EphySample2Extension detach_window");
103
notebook = ephy_window_get_notebook (window);
107
impl_attach_tab (EphyExtension *ext,
111
LOG ("impl_attach_tab");
113
g_return_if_fail (EPHY_IS_EMBED (embed));
115
g_signal_connect (embed, "ge_dom_mouse_down",
116
G_CALLBACK (dom_mouse_down_cb), ext);
120
impl_detach_tab (EphyExtension *ext,
124
LOG ("impl_detach_tab");
126
g_return_if_fail (EPHY_IS_EMBED (embed));
128
g_signal_handlers_disconnect_by_func
129
(embed, G_CALLBACK (dom_mouse_down_cb), ext);
133
ephy_sample2_extension_iface_init (EphyExtensionIface *iface)
135
iface->attach_window = impl_attach_window;
136
iface->detach_window = impl_detach_window;
137
iface->attach_tab = impl_attach_tab;
138
iface->detach_tab = impl_detach_tab;
142
ephy_sample2_extension_class_init (EphySample2ExtensionClass *klass)
144
GObjectClass *object_class = G_OBJECT_CLASS (klass);
146
parent_class = g_type_class_peek_parent (klass);
148
object_class->finalize = ephy_sample2_extension_finalize;
150
g_type_class_add_private (object_class, sizeof (EphySample2ExtensionPrivate));
154
ephy_sample2_extension_get_type (void)
160
ephy_sample2_extension_register_type (GTypeModule *module)
162
const GTypeInfo our_info =
164
sizeof (EphySample2ExtensionClass),
165
NULL, /* base_init */
166
NULL, /* base_finalize */
167
(GClassInitFunc) ephy_sample2_extension_class_init,
169
NULL, /* class_data */
170
sizeof (EphySample2Extension),
172
(GInstanceInitFunc) ephy_sample2_extension_init
175
const GInterfaceInfo extension_info =
177
(GInterfaceInitFunc) ephy_sample2_extension_iface_init,
182
type = g_type_module_register_type (module,
184
"EphySample2Extension",
187
g_type_module_add_interface (module,