4 days ago
fix gtk3 build
463 | 1 | /* |
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | |
3 | * | |
4 | * Copyright 2025 Olaf Wintermann. All rights reserved. | |
5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions are met: | |
8 | * | |
9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | |
11 | * | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | |
15 | * | |
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | |
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
26 | * POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | |
28 | ||
29 | #include "toolkit.h" | |
30 | #include "container.h" | |
31 | ||
468
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
32 | #include "webview.h" |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
33 | |
463 | 34 | #ifdef UI_WEBVIEW |
35 | ||
36 | UIWIDGET ui_webview_create(UiObject *obj, UiWebviewArgs args) { | |
37 | UiObject* current = uic_current_obj(obj); | |
38 | ||
39 | GtkWidget *webview = webkit_web_view_new(); | |
40 | ||
41 | ui_set_name_and_style(webview, args.name, args.style_class); | |
42 | ||
468
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
43 | UiVar *var = uic_widget_var(obj->ctx, current->ctx, args.value, args.varname, UI_VAR_GENERIC); |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
44 | if(var) { |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
45 | WebViewData *data = malloc(sizeof(WebViewData)); |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
46 | memset(data, 0, sizeof(WebViewData)); |
469
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
47 | data->webview = WEBKIT_WEB_VIEW(webview); |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
48 | WebKitSettings *settings = webkit_web_view_get_settings(data->webview); |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
49 | data->javascript = webkit_settings_get_enable_javascript(settings); |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
50 | data->zoom = webkit_web_view_get_zoom_level(data->webview); |
468
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
51 | |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
52 | UiGeneric *value = var->value; |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
53 | value->get = ui_webview_get; |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
54 | value->get_type = ui_webview_get_type; |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
55 | value->set = ui_webview_set; |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
56 | value->obj = data; |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
57 | if(value->value && value->type && !strcmp(value->type, UI_WEBVIEW_OBJECT_TYPE)) { |
469
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
58 | // TODO |
468
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
59 | } |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
60 | } |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
61 | |
463 | 62 | ui_set_widget_groups(obj->ctx, webview, args.groups); |
63 | UI_APPLY_LAYOUT1(current, args); | |
64 | current->container->add(current->container, webview, FALSE); | |
65 | ||
66 | return webview; | |
67 | } | |
68 | ||
468
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
69 | void* ui_webview_get(UiGeneric *g) { |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
70 | return g->value; |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
71 | } |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
72 | |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
73 | const char* ui_webview_get_type(UiGeneric *g) { |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
74 | return UI_WEBVIEW_OBJECT_TYPE; |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
75 | } |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
76 | |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
77 | int ui_webview_set(UiGeneric *g, void *value, const char *type) { |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
78 | if(!type || strcmp(type, UI_WEBVIEW_OBJECT_TYPE)) { |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
79 | return 1; |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
80 | } |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
81 | |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
82 | WebViewData *obj = g->obj; |
469
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
83 | if(!obj->webview) { |
468
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
84 | return 1; |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
85 | } |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
86 | |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
87 | WebViewData *data = value; |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
88 | if(data->type == WEBVIEW_CONTENT_URL) { |
469
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
89 | webkit_web_view_load_uri(obj->webview, data->uri); |
468
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
90 | } else { |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
91 | if(!data->content) { |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
92 | return 1; |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
93 | } |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
94 | |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
95 | GBytes *bytes = g_bytes_new(data->content, data->contentlength); |
469
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
96 | webkit_web_view_load_bytes(obj->webview, bytes, data->mimetype, data->encoding, data->uri); |
468
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
97 | } |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
98 | |
469
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
99 | ui_webview_enable_javascript(g, data->javascript); |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
100 | webkit_web_view_set_zoom_level(data->webview, data->zoom); |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
101 | |
468
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
102 | return 0; |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
103 | } |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
104 | |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
105 | void ui_webview_load_url(UiGeneric *g, const char *url) { |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
106 | WebViewData data = { .uri = (char*)url, .type = WEBVIEW_CONTENT_URL }; |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
107 | g->set(g, &data, UI_WEBVIEW_OBJECT_TYPE); |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
108 | } |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
109 | |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
110 | void ui_webview_load_content( |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
111 | UiGeneric *g, |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
112 | const char *uri, |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
113 | const char *content, |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
114 | size_t contentlength, |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
115 | const char *mimetype, |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
116 | const char *encoding) |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
117 | { |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
118 | WebViewData data; |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
119 | data.uri = (char*)uri; |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
120 | data.content = (char*)content; |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
121 | data.contentlength = contentlength; |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
122 | data.mimetype = (char*)mimetype; |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
123 | data.encoding = (char*)encoding; |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
124 | data.type = WEBVIEW_CONTENT_CONTENT; |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
125 | g->set(g, &data, UI_WEBVIEW_OBJECT_TYPE); |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
126 | } |
1f251c462f74
use UiGeneric for WebView
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
463
diff
changeset
|
127 | |
469
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
128 | void ui_webview_reload(UiGeneric *g) { |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
129 | WebViewData *webview = g->obj; |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
130 | webkit_web_view_reload(webview->webview); |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
131 | } |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
132 | |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
133 | UiBool ui_webview_can_go_back(UiGeneric *g) { |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
134 | WebViewData *webview = g->obj; |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
135 | return webkit_web_view_can_go_back(webview->webview); |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
136 | } |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
137 | |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
138 | UiBool ui_webview_can_go_forward(UiGeneric *g) { |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
139 | WebViewData *webview = g->obj; |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
140 | return webkit_web_view_can_go_forward(webview->webview); |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
141 | } |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
142 | |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
143 | void ui_webview_go_back(UiGeneric *g) { |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
144 | WebViewData *webview = g->obj; |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
145 | webkit_web_view_go_back(webview->webview); |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
146 | } |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
147 | |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
148 | void ui_webview_go_forward(UiGeneric *g) { |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
149 | WebViewData *webview = g->obj; |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
150 | webkit_web_view_go_forward(webview->webview); |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
151 | } |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
152 | |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
153 | const char* ui_webview_get_uri(UiGeneric *g) { |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
154 | WebViewData *webview = g->obj; |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
155 | return webkit_web_view_get_uri(webview->webview); |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
156 | } |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
157 | |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
158 | void ui_webview_enable_javascript(UiGeneric *g, UiBool enable) { |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
159 | WebViewData *webview = g->obj; |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
160 | WebKitSettings *settings = webkit_web_view_get_settings(webview->webview); |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
161 | webkit_settings_set_enable_javascript(settings, enable); |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
162 | } |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
163 | |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
164 | void ui_webview_set_zoom(UiGeneric *g, double zoom) { |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
165 | WebViewData *webview = g->obj; |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
166 | webkit_web_view_set_zoom_level(webview->webview, zoom); |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
167 | webview->zoom = zoom; |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
168 | } |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
169 | |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
170 | double ui_webview_get_zoom(UiGeneric *g) { |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
171 | WebViewData *webview = g->obj; |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
172 | webview->zoom = webkit_web_view_get_zoom_level(webview->webview); |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
173 | return webview->zoom; |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
174 | } |
3f6142271f58
add more webview API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
468
diff
changeset
|
175 | |
463 | 176 | |
177 | #endif |