1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/*
* Copyright (C) 2011-2020 Juan Pablo Ugarte
* 2016 Endless Mobile Inc.
*
* This library 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 2 of the License, or (at your option) any later version.
*
* This library 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 library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* Authors:
* Juan Pablo Ugarte <juanpablougarte@gmail.com>
* Juan Pablo Ugarte <ugarte@endlessm.com>
*/
#include "config.h"
#include <webkit2/webkit2.h>
#include <gladeui/glade.h>
void
glade_webkit2gtk_init (const gchar *name)
{
/* Enable Sandbox */
webkit_web_context_set_sandbox_enabled (webkit_web_context_get_default (), TRUE);
}
void
glade_webkit_web_view_set_property (GladeWidgetAdaptor *adaptor,
GObject *object,
const gchar *id,
const GValue *value)
{
if (g_str_equal(id, "glade-url"))
{
const gchar *url = g_value_get_string (value);
g_autofree gchar *scheme, *full_url;
if (!url)
return;
if ((scheme = g_uri_parse_scheme (url)))
{
webkit_web_view_load_uri (WEBKIT_WEB_VIEW (object), url);
return;
}
full_url = g_strconcat ("http://", url, NULL);
webkit_web_view_load_uri (WEBKIT_WEB_VIEW (object), full_url);
}
else
GWA_GET_CLASS(GTK_TYPE_WIDGET)->set_property (adaptor, object, id, value);
}
|