2 * Copyright © 2000-2003 Marco Pesenti Gritti
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2, or (at your option)
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * $Id: ephy-embed-single.c 6952 2007-03-11 19:42:02Z chpe $
23 #include "ephy-embed-single.h"
24 #include "ephy-embed-type-builtins.h"
25 #include "ephy-marshal.h"
26 #include "ephy-signal-accumulator.h"
28 static void ephy_embed_single_iface_init (gpointer g_class
);
31 ephy_embed_single_get_type (void)
33 static GType type
= 0;
35 if (G_UNLIKELY (type
== 0))
37 const GTypeInfo our_info
=
39 sizeof (EphyEmbedSingleIface
),
40 ephy_embed_single_iface_init
,
44 type
= g_type_register_static (G_TYPE_INTERFACE
,
54 ephy_embed_single_iface_init (gpointer g_iface
)
56 static gboolean initialised
= FALSE
;
58 if (initialised
== FALSE
)
61 * EphyEmbedSingle::new-window:
63 * @parent_embed: the #EphyEmbed requesting the new window, or %NULL
64 * @mask: a #EphyEmbedChrome
66 * The ::new_window signal is emitted when a new window needs to be opened.
67 * For example, when a JavaScript popup window was opened.
69 * Return a new #EphyEmbed.
71 g_signal_new ("new-window",
72 EPHY_TYPE_EMBED_SINGLE
,
73 G_SIGNAL_RUN_FIRST
| G_SIGNAL_RUN_LAST
,
74 G_STRUCT_OFFSET (EphyEmbedSingleIface
, new_window
),
75 ephy_signal_accumulator_object
, ephy_embed_get_type
,
76 ephy_marshal_OBJECT__OBJECT_FLAGS
,
80 EPHY_TYPE_EMBED_CHROME
);
83 * EphyEmbedSingle::handle_content:
85 * @mime_type: the MIME type of the content
86 * @address: the URL to the content
88 * The ::handle_content signal is emitted when encountering content of a mime
89 * type Epiphany is unable to handle itself.
91 * If a connected callback returns %TRUE, the signal will stop propagating. For
92 * example, this could be used by a download manager to prevent other
93 * ::handle_content listeners from being called.
95 g_signal_new ("handle_content",
96 EPHY_TYPE_EMBED_SINGLE
,
98 G_STRUCT_OFFSET (EphyEmbedSingleIface
, handle_content
),
99 g_signal_accumulator_true_handled
, NULL
,
100 ephy_marshal_BOOLEAN__STRING_STRING
,
107 * EphyEmbedSingle::add-sidebar:
109 * @url: The url of the sidebar to be added
110 * @title: The title of the sidebar to be added
112 * The ::add-sidebar signal is emitted when the user clicks a javascript link that
113 * requests adding a url to the sidebar.
115 g_signal_new ("add-sidebar",
116 EPHY_TYPE_EMBED_SINGLE
,
118 G_STRUCT_OFFSET (EphyEmbedSingleIface
, add_sidebar
),
119 g_signal_accumulator_true_handled
, NULL
,
120 ephy_marshal_BOOLEAN__STRING_STRING
,
123 G_TYPE_STRING
| G_SIGNAL_TYPE_STATIC_SCOPE
,
124 G_TYPE_STRING
| G_SIGNAL_TYPE_STATIC_SCOPE
);
127 * EphyEmbedSingle::add-search-engine
129 * @url: The url of the search engine definition file
130 * @icon_url: The url of the icon to use for this engine
131 * @title: The title of the search engine to be added
133 * The ::add-search-engine signal is emitted when the user clicks a javascript link that
134 * requests adding a search engine to the sidebar.
136 g_signal_new ("add-search-engine",
137 EPHY_TYPE_EMBED_SINGLE
,
139 G_STRUCT_OFFSET (EphyEmbedSingleIface
, add_search_engine
),
140 g_signal_accumulator_true_handled
, NULL
,
141 ephy_marshal_BOOLEAN__STRING_STRING_STRING
,
144 G_TYPE_STRING
| G_SIGNAL_TYPE_STATIC_SCOPE
,
145 G_TYPE_STRING
| G_SIGNAL_TYPE_STATIC_SCOPE
,
146 G_TYPE_STRING
| G_SIGNAL_TYPE_STATIC_SCOPE
);
149 * EphyEmbedSingle::network-status:
151 * Whether the network is on-line.
153 g_object_interface_install_property
155 g_param_spec_boolean ("network-status",
159 G_PARAM_READWRITE
| G_PARAM_STATIC_NAME
| G_PARAM_STATIC_NICK
| G_PARAM_STATIC_BLURB
));
166 * ephy_embed_single_init:
167 * @single: the #EphyEmbedSingle
169 * Performs startup initialisations. Must be called before calling
173 ephy_embed_single_init (EphyEmbedSingle
*single
)
175 EphyEmbedSingleIface
*iface
= EPHY_EMBED_SINGLE_GET_IFACE (single
);
176 return iface
->init (single
);
180 * ephy_embed_single_clear_cache:
181 * @single: the #EphyEmbedSingle
183 * Clears the Mozilla cache (temporarily saved web pages).
186 ephy_embed_single_clear_cache (EphyEmbedSingle
*single
)
188 EphyEmbedSingleIface
*iface
= EPHY_EMBED_SINGLE_GET_IFACE (single
);
189 iface
->clear_cache (single
);
193 * ephy_embed_single_clear_auth_cache:
194 * @single: the #EphyEmbedSingle
196 * Clears the Mozilla HTTP authentication cache.
198 * This does not clear regular website passwords; it only clears the HTTP
199 * authentication cache. Websites which use HTTP authentication require the
200 * browser to send a password along with every HTTP request; the browser will
201 * ask the user for the password once and then cache the password for subsequent
202 * HTTP requests. This function will clear the HTTP authentication cache,
203 * meaning the user will have to re-enter a username and password the next time
204 * Epiphany requests a web page secured with HTTP authentication.
207 ephy_embed_single_clear_auth_cache (EphyEmbedSingle
*single
)
209 EphyEmbedSingleIface
*iface
= EPHY_EMBED_SINGLE_GET_IFACE (single
);
210 iface
->clear_auth_cache (single
);
214 * ephy_embed_single_get_nework_status:
215 * @single: the #EphyEmbedSingle
216 * @offline: %TRUE if the network is on-line
218 * Sets the state of the network connection.
221 ephy_embed_single_set_network_status (EphyEmbedSingle
*single
,
224 EphyEmbedSingleIface
*iface
= EPHY_EMBED_SINGLE_GET_IFACE (single
);
225 iface
->set_network_status (single
, status
);
229 * ephy_embed_single_get_network_status:
230 * @single: the #EphyEmbedSingle
232 * Gets the state of the network connection.
234 * Returns: %TRUE iff the network is on-line.
237 ephy_embed_single_get_network_status (EphyEmbedSingle
*single
)
239 EphyEmbedSingleIface
*iface
= EPHY_EMBED_SINGLE_GET_IFACE (single
);
240 return iface
->get_network_status (single
);
244 * ephy_embed_single_get_font_list:
245 * @single: the #EphyEmbedSingle
246 * @lang_group: a mozilla font language group name, or %NULL
248 * Returns the list of fonts matching @lang_group, or all fonts if @lang_group
251 * The available @lang_group arguments are listed in Epiphany's Fonts and Colors
254 * Return value: a list of font names
257 ephy_embed_single_get_font_list (EphyEmbedSingle
*single
,
258 const char *lang_group
)
260 EphyEmbedSingleIface
*iface
= EPHY_EMBED_SINGLE_GET_IFACE (single
);
261 return iface
->get_font_list (single
, lang_group
);
265 * ephy_embed_single_open_window:
266 * @single: the #EphyEmbedSingle
267 * @parent: the requested window's parent #EphyEmbed
268 * @address: the URL to load
269 * @name: a name for the window
270 * @features: a Javascript features string
272 * Opens a new window, as if it were opened in @parent using the Javascript
273 * method and arguments: <code>window.open("@address",
274 * "_blank", "@features");</code>.
276 * Returns: the new embed. This is either a #EphyEmbed, or, when @features specified
277 * "chrome", a #GtkMozEmbed.
279 * NOTE: Use ephy_shell_new_tab() unless this handling of the @features string is
283 ephy_embed_single_open_window (EphyEmbedSingle
*single
,
287 const char *features
)
289 EphyEmbedSingleIface
*iface
= EPHY_EMBED_SINGLE_GET_IFACE (single
);
290 return iface
->open_window (single
, parent
, address
, name
, features
);
294 * ephy_embed_single_get_backend_name
295 * @single: the #EphyEmbedSingle
297 * Can be used to find the particular backend that is being used
298 * for rendering pages.
300 * Returns: the name of the backend. Valid returns are "gecko-1.7",
301 * "gecko-1.8" and "gecko-1.9"
304 ephy_embed_single_get_backend_name (EphyEmbedSingle
*single
)
306 EphyEmbedSingleIface
*iface
= EPHY_EMBED_SINGLE_GET_IFACE (single
);
307 return iface
->get_backend_name (single
);