Merge lp:~noskcaj/ubuntu/wily/epiphany-browser/merge2 into lp:ubuntu/wily/epiphany-browser
- Wily (15.10)
- merge2
- Merge into wily
Proposed by
Jackson Doak
Status: | Merged |
---|---|
Merge reported by: | Robert Ancell |
Merged at revision: | not available |
Proposed branch: | lp:~noskcaj/ubuntu/wily/epiphany-browser/merge2 |
Merge into: | lp:ubuntu/wily/epiphany-browser |
Diff against target: |
12870 lines (+1091/-6067) 41 files modified
.pc/00_epiphany-browser.patch/configure.ac (+0/-261) .pc/07_bookmarks.patch/data/default-bookmarks.rdf.in (+0/-37) .pc/12_safetypes.patch/data/mime-types-permissions.xml (+0/-482) .pc/81_ubuntu_force_update_bookmarks_menu.patch/src/bookmarks/ephy-bookmarks-ui.c (+0/-363) .pc/applied-patches (+0/-5) .pc/ubuntu_titlebars.patch/src/ephy-window.c (+0/-4026) ChangeLog (+70/-0) Makefile.in (+6/-2) NEWS (+8/-0) aclocal.m4 (+6/-841) configure (+11/-11) configure.ac (+1/-1) data/Makefile.in (+6/-2) data/pages/Makefile.in (+6/-2) debian/changelog (+21/-0) debian/control (+1/-1) debian/patches/00_epiphany-browser.patch (+4/-4) doc/Makefile.in (+6/-2) embed/Makefile.in (+6/-2) embed/ephy-embed-utils.c (+17/-3) embed/ephy-web-view.c (+12/-0) embed/web-extension/Makefile.in (+6/-2) embed/web-extension/ephy-web-extension.c (+2/-0) help/Makefile.in (+6/-2) lib/Makefile.in (+6/-2) lib/egg/Makefile.in (+6/-2) lib/history/Makefile.in (+6/-2) lib/widgets/Makefile.in (+6/-2) m4/ax_check_enable_debug.m4 (+113/-0) m4/ax_code_coverage.m4 (+180/-0) m4/gsettings.m4 (+83/-0) m4/nls.m4 (+32/-0) m4/pkg.m4 (+214/-0) m4/yelp.m4 (+213/-0) src/Makefile.in (+6/-2) src/bookmarks/Makefile.in (+6/-2) src/ephy-search-provider-main.c (+11/-0) src/ephy-shell-search-provider-generated.c (+1/-1) src/ephy-shell-search-provider-generated.h (+1/-1) tests/Makefile.in (+6/-2) tests/data/Makefile.in (+6/-2) |
To merge this branch: | bzr merge lp:~noskcaj/ubuntu/wily/epiphany-browser/merge2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu branches | Pending | ||
Review via email: mp+264481@code.launchpad.net |
Commit message
Description of the change
Merge from debian
To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory '.pc/00_epiphany-browser.patch' | |||
2 | === removed directory '.pc/00_epiphany-browser.patch' | |||
3 | === added file '.pc/00_epiphany-browser.patch/.timestamp' | |||
4 | === added file '.pc/00_epiphany-browser.patch/configure.ac' | |||
5 | --- .pc/00_epiphany-browser.patch/configure.ac 1970-01-01 00:00:00 +0000 | |||
6 | +++ .pc/00_epiphany-browser.patch/configure.ac 2015-07-11 21:08:34 +0000 | |||
7 | @@ -0,0 +1,261 @@ | |||
8 | 1 | # Copyright © 2000-2004 Marco Pesenti Gritti | ||
9 | 2 | # Copyright © 2003, 2004, 2005, 2006, 2007 Christian Persch | ||
10 | 3 | # | ||
11 | 4 | # This program is free software; you can redistribute it and/or modify it | ||
12 | 5 | # under the terms of the GNU General Public License as published by the | ||
13 | 6 | # Free Software Foundation; either version 2 of the License, or (at your | ||
14 | 7 | # option) any later version. | ||
15 | 8 | # | ||
16 | 9 | # This program is distributed in the hope that it will be useful, but | ||
17 | 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
19 | 12 | # General Public License for more details. | ||
20 | 13 | # | ||
21 | 14 | # You should have received a copy of the GNU General Public License along | ||
22 | 15 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
23 | 16 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
24 | 17 | |||
25 | 18 | m4_define([epiphany_version_major],[3]) | ||
26 | 19 | m4_define([epiphany_version_minor],[16]) | ||
27 | 20 | m4_define([epiphany_version_micro],[3]) | ||
28 | 21 | m4_define([epiphany_version],[epiphany_version_major.epiphany_version_minor.epiphany_version_micro]) | ||
29 | 22 | |||
30 | 23 | AC_INIT([GNOME Web Browser],[epiphany_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=epiphany],[epiphany]) | ||
31 | 24 | |||
32 | 25 | AC_PREREQ([2.59]) | ||
33 | 26 | |||
34 | 27 | AC_CONFIG_MACRO_DIR([m4]) | ||
35 | 28 | AC_CONFIG_HEADERS([config.h]) | ||
36 | 29 | AC_CONFIG_SRCDIR([configure.ac]) | ||
37 | 30 | |||
38 | 31 | AC_SUBST([EPIPHANY_MAJOR],[epiphany_version_major.epiphany_version_minor]) | ||
39 | 32 | |||
40 | 33 | # for EPHY_CHECK_VERSION | ||
41 | 34 | AC_SUBST([EPIPHANY_MAJOR_VERSION], [epiphany_version_major]) | ||
42 | 35 | AC_SUBST([EPIPHANY_MINOR_VERSION], [epiphany_version_minor]) | ||
43 | 36 | AC_SUBST([EPIPHANY_MICRO_VERSION], [epiphany_version_micro]) | ||
44 | 37 | |||
45 | 38 | AM_INIT_AUTOMAKE([1.11 foreign dist-xz no-dist-gzip tar-ustar]) | ||
46 | 39 | |||
47 | 40 | # Use AM_SILENT_RULES if present | ||
48 | 41 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) | ||
49 | 42 | |||
50 | 43 | AM_MAINTAINER_MODE([enable]) | ||
51 | 44 | |||
52 | 45 | # Initialize libtool | ||
53 | 46 | LT_PREREQ(2.2) | ||
54 | 47 | LT_INIT([dlopen disable-static]) | ||
55 | 48 | |||
56 | 49 | AC_PROG_CC | ||
57 | 50 | |||
58 | 51 | AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal]) | ||
59 | 52 | AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums]) | ||
60 | 53 | |||
61 | 54 | IT_PROG_INTLTOOL([0.50.0]) | ||
62 | 55 | |||
63 | 56 | GLIB_GSETTINGS | ||
64 | 57 | |||
65 | 58 | PKG_PROG_PKG_CONFIG | ||
66 | 59 | |||
67 | 60 | GNOME_DEBUG_CHECK | ||
68 | 61 | GNOME_COMPILE_WARNINGS([maximum]) | ||
69 | 62 | GNOME_MAINTAINER_MODE_DEFINES | ||
70 | 63 | |||
71 | 64 | GNOME_CODE_COVERAGE | ||
72 | 65 | |||
73 | 66 | WARN_CFLAGS="$WARN_CFLAGS -Wdeclaration-after-statement -Wno-deprecated-declarations -Wno-missing-prototypes" | ||
74 | 67 | |||
75 | 68 | GLIB_REQUIRED=2.38.0 | ||
76 | 69 | GTK_REQUIRED=3.13.0 | ||
77 | 70 | LIBXML_REQUIRED=2.6.12 | ||
78 | 71 | LIBXSLT_REQUIRED=1.1.7 | ||
79 | 72 | WEBKIT_GTK_REQUIRED=2.7.4 | ||
80 | 73 | LIBSOUP_REQUIRED=2.48.0 | ||
81 | 74 | GNOME_DESKTOP_REQUIRED=2.91.2 | ||
82 | 75 | LIBSECRET_REQUIRED=0.14 | ||
83 | 76 | GSETTINGS_DESKTOP_SCHEMAS_REQUIRED=0.0.1 | ||
84 | 77 | LIBNOTIFY_REQUIRED=0.5.1 | ||
85 | 78 | GCR_REQUIRED=3.5.5 | ||
86 | 79 | AVAHI_REQUIRED=0.6.22 | ||
87 | 80 | |||
88 | 81 | # Tests | ||
89 | 82 | |||
90 | 83 | AC_MSG_CHECKING([whether to build tests]) | ||
91 | 84 | AC_ARG_ENABLE([tests], | ||
92 | 85 | AS_HELP_STRING([--enable-tests],[Whether to build tests (default: yes)]), | ||
93 | 86 | [], [enable_tests=yes]) | ||
94 | 87 | AC_MSG_RESULT([$enable_tests]) | ||
95 | 88 | |||
96 | 89 | AM_CONDITIONAL([ENABLE_TESTS],[test "$enable_tests" = "yes"]) | ||
97 | 90 | |||
98 | 91 | PKG_CHECK_MODULES([DEPENDENCIES], [ | ||
99 | 92 | glib-2.0 >= $GLIB_REQUIRED | ||
100 | 93 | gthread-2.0 | ||
101 | 94 | gio-unix-2.0 >= $GLIB_REQUIRED | ||
102 | 95 | gtk+-3.0 >= $GTK_REQUIRED | ||
103 | 96 | gtk+-unix-print-3.0 >= $GTK_REQUIRED | ||
104 | 97 | x11 | ||
105 | 98 | libwnck-3.0 | ||
106 | 99 | libxml-2.0 >= $LIBXML_REQUIRED | ||
107 | 100 | libxslt >= $LIBXSLT_REQUIRED | ||
108 | 101 | webkit2gtk-4.0 >= $WEBKIT_GTK_REQUIRED | ||
109 | 102 | libsoup-2.4 >= $LIBSOUP_REQUIRED | ||
110 | 103 | libsecret-1 >= $LIBSECRET_REQUIRED | ||
111 | 104 | gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED | ||
112 | 105 | gsettings-desktop-schemas >= $GSETTINGS_DESKTOP_SCHEMAS_REQUIRED | ||
113 | 106 | libnotify >= $LIBNOTIFY_REQUIRED | ||
114 | 107 | sqlite3 | ||
115 | 108 | gcr-3 >= $GCR_REQUIRED | ||
116 | 109 | avahi-gobject >= $AVAHI_REQUIRED | ||
117 | 110 | avahi-client >= $AVAHI_REQUIRED | ||
118 | 111 | ]) | ||
119 | 112 | |||
120 | 113 | PKG_CHECK_MODULES(WEB_EXTENSION, [ | ||
121 | 114 | webkit2gtk-web-extension-4.0 >= $WEBKIT_GTK_REQUIRED | ||
122 | 115 | libsecret-1 >= $LIBSECRET_REQUIRED | ||
123 | 116 | ]) | ||
124 | 117 | AC_SUBST(WEB_EXTENSION_CFLAGS) | ||
125 | 118 | AC_SUBST(WEB_EXTENSION_LIBS) | ||
126 | 119 | |||
127 | 120 | # ****************** | ||
128 | 121 | # Portability checks | ||
129 | 122 | # ****************** | ||
130 | 123 | |||
131 | 124 | AC_CHECK_FUNCS([localtime_r memchr memmove memset mkdir mkdtemp realpath sqrt strchr strcspn strdup strerror strrchr strtol strtoul strstr]) | ||
132 | 125 | |||
133 | 126 | # for backtrace() | ||
134 | 127 | AC_CHECK_HEADERS([execinfo.h fcntl.h]) | ||
135 | 128 | AC_SEARCH_LIBS([backtrace], [c execinfo]) | ||
136 | 129 | AC_C_INLINE | ||
137 | 130 | AC_FUNC_MKTIME | ||
138 | 131 | AC_FUNC_STRTOD | ||
139 | 132 | AC_TYPE_SIZE_T | ||
140 | 133 | |||
141 | 134 | # *************** | ||
142 | 135 | # Multimedia keys | ||
143 | 136 | # *************** | ||
144 | 137 | |||
145 | 138 | AC_CHECK_HEADERS([X11/XF86keysym.h]) | ||
146 | 139 | |||
147 | 140 | # *** | ||
148 | 141 | # NSS | ||
149 | 142 | # *** | ||
150 | 143 | |||
151 | 144 | AC_MSG_CHECKING([whether NSS support is requested]) | ||
152 | 145 | AC_ARG_ENABLE([nss], | ||
153 | 146 | [AS_HELP_STRING([--enable-nss], [Enable NSS support (default: enabled)])], | ||
154 | 147 | [], [enable_nss=yes]) | ||
155 | 148 | AC_MSG_RESULT([$enable_nss]) | ||
156 | 149 | |||
157 | 150 | if test "$enable_nss" = "yes"; then | ||
158 | 151 | PKG_CHECK_MODULES([NSS], [nss]) | ||
159 | 152 | |||
160 | 153 | AC_DEFINE([ENABLE_NSS], [1], [Define to compile with NSS support]) | ||
161 | 154 | fi | ||
162 | 155 | |||
163 | 156 | AM_CONDITIONAL([ENABLE_NSS],[test "$enable_nss" = "yes"]) | ||
164 | 157 | |||
165 | 158 | # ******************************* | ||
166 | 159 | # Internationalization | ||
167 | 160 | # ******************************* | ||
168 | 161 | |||
169 | 162 | ISO_CODES_REQUIRED=0.35 | ||
170 | 163 | |||
171 | 164 | PKG_CHECK_EXISTS([iso-codes >= $ISO_CODES_REQUIRED], | ||
172 | 165 | [have_iso_codes=yes],[have_iso_codes=no]) | ||
173 | 166 | |||
174 | 167 | if test "$have_iso_codes" = "yes"; then | ||
175 | 168 | AC_MSG_CHECKING([whether iso-codes has iso-639 and iso-3166 domains]) | ||
176 | 169 | if $PKG_CONFIG --variable=domains iso-codes | grep -q 639 && \ | ||
177 | 170 | $PKG_CONFIG --variable=domains iso-codes | grep -q 3166 ; then | ||
178 | 171 | result=yes | ||
179 | 172 | else | ||
180 | 173 | result=no | ||
181 | 174 | have_iso_codes=no | ||
182 | 175 | fi | ||
183 | 176 | AC_MSG_RESULT([$result]) | ||
184 | 177 | fi | ||
185 | 178 | |||
186 | 179 | if test "$have_iso_codes" = "yes"; then | ||
187 | 180 | AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["`$PKG_CONFIG --variable=prefix iso-codes`"],[ISO codes prefix]) | ||
188 | 181 | AC_DEFINE([HAVE_ISO_CODES],[1],[Define if you have the iso-codes package]) | ||
189 | 182 | else | ||
190 | 183 | AC_MSG_ERROR([iso-codes is required]) | ||
191 | 184 | fi | ||
192 | 185 | |||
193 | 186 | GETTEXT_PACKAGE=epiphany | ||
194 | 187 | AC_SUBST([GETTEXT_PACKAGE]) | ||
195 | 188 | AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package]) | ||
196 | 189 | AM_GLIB_GNU_GETTEXT | ||
197 | 190 | |||
198 | 191 | # ******************************* | ||
199 | 192 | # User help | ||
200 | 193 | # ******************************* | ||
201 | 194 | |||
202 | 195 | YELP_HELP_INIT | ||
203 | 196 | |||
204 | 197 | # **************** | ||
205 | 198 | # Distributor name | ||
206 | 199 | # **************** | ||
207 | 200 | |||
208 | 201 | AC_ARG_WITH([distributor-name], | ||
209 | 202 | AS_HELP_STRING([--with-distributor-name=name],[Set the distributor name]), | ||
210 | 203 | [LSB_DISTRIBUTOR="$withval"]) | ||
211 | 204 | |||
212 | 205 | if test -z "$LSB_DISTRIBUTOR"; then | ||
213 | 206 | AC_CHECK_PROGS([LSB_RELEASE], [lsb_release],) | ||
214 | 207 | if test -n "$LSB_RELEASE"; then | ||
215 | 208 | # Fallback on lsb_release if available | ||
216 | 209 | LSB_DISTRIBUTOR=$($LSB_RELEASE -i -s) | ||
217 | 210 | else | ||
218 | 211 | # Fallback on the product name | ||
219 | 212 | LSB_DISTRIBUTOR="Epiphany" | ||
220 | 213 | fi | ||
221 | 214 | fi | ||
222 | 215 | |||
223 | 216 | AC_DEFINE_UNQUOTED([LSB_DISTRIBUTOR],["$LSB_DISTRIBUTOR"],[Distributor name]) | ||
224 | 217 | |||
225 | 218 | # ************ | ||
226 | 219 | # Output files | ||
227 | 220 | # ************ | ||
228 | 221 | |||
229 | 222 | AC_DEFINE([EPIPHANY_COMPILATION],[1],[Compiling epiphany]) | ||
230 | 223 | |||
231 | 224 | AC_CONFIG_FILES([ | ||
232 | 225 | Makefile | ||
233 | 226 | data/Makefile | ||
234 | 227 | data/epiphany.desktop.in | ||
235 | 228 | data/pages/Makefile | ||
236 | 229 | doc/Makefile | ||
237 | 230 | help/Makefile | ||
238 | 231 | lib/Makefile | ||
239 | 232 | lib/egg/Makefile | ||
240 | 233 | lib/history/Makefile | ||
241 | 234 | lib/widgets/Makefile | ||
242 | 235 | embed/Makefile | ||
243 | 236 | embed/web-extension/Makefile | ||
244 | 237 | src/Makefile | ||
245 | 238 | src/bookmarks/Makefile | ||
246 | 239 | po/Makefile.in | ||
247 | 240 | tests/Makefile | ||
248 | 241 | tests/data/Makefile | ||
249 | 242 | ], | ||
250 | 243 | []) | ||
251 | 244 | |||
252 | 245 | AC_OUTPUT | ||
253 | 246 | |||
254 | 247 | # ************************************* | ||
255 | 248 | # ************************************* | ||
256 | 249 | |||
257 | 250 | echo " | ||
258 | 251 | Epiphany was configured with the following options: | ||
259 | 252 | |||
260 | 253 | Source code location : $srcdir | ||
261 | 254 | Compiler : $CC | ||
262 | 255 | Prefix : $prefix | ||
263 | 256 | Extra debugging support : $enable_debug | ||
264 | 257 | Build tests : $enable_tests | ||
265 | 258 | Code coverage : $enable_code_coverage | ||
266 | 259 | |||
267 | 260 | NSS support : $enable_nss | ||
268 | 261 | " | ||
269 | 0 | 262 | ||
270 | === removed file '.pc/00_epiphany-browser.patch/configure.ac' | |||
271 | --- .pc/00_epiphany-browser.patch/configure.ac 2015-06-25 06:50:45 +0000 | |||
272 | +++ .pc/00_epiphany-browser.patch/configure.ac 1970-01-01 00:00:00 +0000 | |||
273 | @@ -1,261 +0,0 @@ | |||
274 | 1 | # Copyright © 2000-2004 Marco Pesenti Gritti | ||
275 | 2 | # Copyright © 2003, 2004, 2005, 2006, 2007 Christian Persch | ||
276 | 3 | # | ||
277 | 4 | # This program is free software; you can redistribute it and/or modify it | ||
278 | 5 | # under the terms of the GNU General Public License as published by the | ||
279 | 6 | # Free Software Foundation; either version 2 of the License, or (at your | ||
280 | 7 | # option) any later version. | ||
281 | 8 | # | ||
282 | 9 | # This program is distributed in the hope that it will be useful, but | ||
283 | 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
284 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
285 | 12 | # General Public License for more details. | ||
286 | 13 | # | ||
287 | 14 | # You should have received a copy of the GNU General Public License along | ||
288 | 15 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
289 | 16 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
290 | 17 | |||
291 | 18 | m4_define([epiphany_version_major],[3]) | ||
292 | 19 | m4_define([epiphany_version_minor],[16]) | ||
293 | 20 | m4_define([epiphany_version_micro],[2]) | ||
294 | 21 | m4_define([epiphany_version],[epiphany_version_major.epiphany_version_minor.epiphany_version_micro]) | ||
295 | 22 | |||
296 | 23 | AC_INIT([GNOME Web Browser],[epiphany_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=epiphany],[epiphany]) | ||
297 | 24 | |||
298 | 25 | AC_PREREQ([2.59]) | ||
299 | 26 | |||
300 | 27 | AC_CONFIG_MACRO_DIR([m4]) | ||
301 | 28 | AC_CONFIG_HEADERS([config.h]) | ||
302 | 29 | AC_CONFIG_SRCDIR([configure.ac]) | ||
303 | 30 | |||
304 | 31 | AC_SUBST([EPIPHANY_MAJOR],[epiphany_version_major.epiphany_version_minor]) | ||
305 | 32 | |||
306 | 33 | # for EPHY_CHECK_VERSION | ||
307 | 34 | AC_SUBST([EPIPHANY_MAJOR_VERSION], [epiphany_version_major]) | ||
308 | 35 | AC_SUBST([EPIPHANY_MINOR_VERSION], [epiphany_version_minor]) | ||
309 | 36 | AC_SUBST([EPIPHANY_MICRO_VERSION], [epiphany_version_micro]) | ||
310 | 37 | |||
311 | 38 | AM_INIT_AUTOMAKE([1.11 foreign dist-xz no-dist-gzip tar-ustar]) | ||
312 | 39 | |||
313 | 40 | # Use AM_SILENT_RULES if present | ||
314 | 41 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) | ||
315 | 42 | |||
316 | 43 | AM_MAINTAINER_MODE([enable]) | ||
317 | 44 | |||
318 | 45 | # Initialize libtool | ||
319 | 46 | LT_PREREQ(2.2) | ||
320 | 47 | LT_INIT([dlopen disable-static]) | ||
321 | 48 | |||
322 | 49 | AC_PROG_CC | ||
323 | 50 | |||
324 | 51 | AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal]) | ||
325 | 52 | AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums]) | ||
326 | 53 | |||
327 | 54 | IT_PROG_INTLTOOL([0.50.0]) | ||
328 | 55 | |||
329 | 56 | GLIB_GSETTINGS | ||
330 | 57 | |||
331 | 58 | PKG_PROG_PKG_CONFIG | ||
332 | 59 | |||
333 | 60 | GNOME_DEBUG_CHECK | ||
334 | 61 | GNOME_COMPILE_WARNINGS([maximum]) | ||
335 | 62 | GNOME_MAINTAINER_MODE_DEFINES | ||
336 | 63 | |||
337 | 64 | GNOME_CODE_COVERAGE | ||
338 | 65 | |||
339 | 66 | WARN_CFLAGS="$WARN_CFLAGS -Wdeclaration-after-statement -Wno-deprecated-declarations -Wno-missing-prototypes" | ||
340 | 67 | |||
341 | 68 | GLIB_REQUIRED=2.38.0 | ||
342 | 69 | GTK_REQUIRED=3.13.0 | ||
343 | 70 | LIBXML_REQUIRED=2.6.12 | ||
344 | 71 | LIBXSLT_REQUIRED=1.1.7 | ||
345 | 72 | WEBKIT_GTK_REQUIRED=2.7.4 | ||
346 | 73 | LIBSOUP_REQUIRED=2.48.0 | ||
347 | 74 | GNOME_DESKTOP_REQUIRED=2.91.2 | ||
348 | 75 | LIBSECRET_REQUIRED=0.14 | ||
349 | 76 | GSETTINGS_DESKTOP_SCHEMAS_REQUIRED=0.0.1 | ||
350 | 77 | LIBNOTIFY_REQUIRED=0.5.1 | ||
351 | 78 | GCR_REQUIRED=3.5.5 | ||
352 | 79 | AVAHI_REQUIRED=0.6.22 | ||
353 | 80 | |||
354 | 81 | # Tests | ||
355 | 82 | |||
356 | 83 | AC_MSG_CHECKING([whether to build tests]) | ||
357 | 84 | AC_ARG_ENABLE([tests], | ||
358 | 85 | AS_HELP_STRING([--enable-tests],[Whether to build tests (default: yes)]), | ||
359 | 86 | [], [enable_tests=yes]) | ||
360 | 87 | AC_MSG_RESULT([$enable_tests]) | ||
361 | 88 | |||
362 | 89 | AM_CONDITIONAL([ENABLE_TESTS],[test "$enable_tests" = "yes"]) | ||
363 | 90 | |||
364 | 91 | PKG_CHECK_MODULES([DEPENDENCIES], [ | ||
365 | 92 | glib-2.0 >= $GLIB_REQUIRED | ||
366 | 93 | gthread-2.0 | ||
367 | 94 | gio-unix-2.0 >= $GLIB_REQUIRED | ||
368 | 95 | gtk+-3.0 >= $GTK_REQUIRED | ||
369 | 96 | gtk+-unix-print-3.0 >= $GTK_REQUIRED | ||
370 | 97 | x11 | ||
371 | 98 | libwnck-3.0 | ||
372 | 99 | libxml-2.0 >= $LIBXML_REQUIRED | ||
373 | 100 | libxslt >= $LIBXSLT_REQUIRED | ||
374 | 101 | webkit2gtk-4.0 >= $WEBKIT_GTK_REQUIRED | ||
375 | 102 | libsoup-2.4 >= $LIBSOUP_REQUIRED | ||
376 | 103 | libsecret-1 >= $LIBSECRET_REQUIRED | ||
377 | 104 | gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED | ||
378 | 105 | gsettings-desktop-schemas >= $GSETTINGS_DESKTOP_SCHEMAS_REQUIRED | ||
379 | 106 | libnotify >= $LIBNOTIFY_REQUIRED | ||
380 | 107 | sqlite3 | ||
381 | 108 | gcr-3 >= $GCR_REQUIRED | ||
382 | 109 | avahi-gobject >= $AVAHI_REQUIRED | ||
383 | 110 | avahi-client >= $AVAHI_REQUIRED | ||
384 | 111 | ]) | ||
385 | 112 | |||
386 | 113 | PKG_CHECK_MODULES(WEB_EXTENSION, [ | ||
387 | 114 | webkit2gtk-web-extension-4.0 >= $WEBKIT_GTK_REQUIRED | ||
388 | 115 | libsecret-1 >= $LIBSECRET_REQUIRED | ||
389 | 116 | ]) | ||
390 | 117 | AC_SUBST(WEB_EXTENSION_CFLAGS) | ||
391 | 118 | AC_SUBST(WEB_EXTENSION_LIBS) | ||
392 | 119 | |||
393 | 120 | # ****************** | ||
394 | 121 | # Portability checks | ||
395 | 122 | # ****************** | ||
396 | 123 | |||
397 | 124 | AC_CHECK_FUNCS([localtime_r memchr memmove memset mkdir mkdtemp realpath sqrt strchr strcspn strdup strerror strrchr strtol strtoul strstr]) | ||
398 | 125 | |||
399 | 126 | # for backtrace() | ||
400 | 127 | AC_CHECK_HEADERS([execinfo.h fcntl.h]) | ||
401 | 128 | AC_SEARCH_LIBS([backtrace], [c execinfo]) | ||
402 | 129 | AC_C_INLINE | ||
403 | 130 | AC_FUNC_MKTIME | ||
404 | 131 | AC_FUNC_STRTOD | ||
405 | 132 | AC_TYPE_SIZE_T | ||
406 | 133 | |||
407 | 134 | # *************** | ||
408 | 135 | # Multimedia keys | ||
409 | 136 | # *************** | ||
410 | 137 | |||
411 | 138 | AC_CHECK_HEADERS([X11/XF86keysym.h]) | ||
412 | 139 | |||
413 | 140 | # *** | ||
414 | 141 | # NSS | ||
415 | 142 | # *** | ||
416 | 143 | |||
417 | 144 | AC_MSG_CHECKING([whether NSS support is requested]) | ||
418 | 145 | AC_ARG_ENABLE([nss], | ||
419 | 146 | [AS_HELP_STRING([--enable-nss], [Enable NSS support (default: enabled)])], | ||
420 | 147 | [], [enable_nss=yes]) | ||
421 | 148 | AC_MSG_RESULT([$enable_nss]) | ||
422 | 149 | |||
423 | 150 | if test "$enable_nss" = "yes"; then | ||
424 | 151 | PKG_CHECK_MODULES([NSS], [nss]) | ||
425 | 152 | |||
426 | 153 | AC_DEFINE([ENABLE_NSS], [1], [Define to compile with NSS support]) | ||
427 | 154 | fi | ||
428 | 155 | |||
429 | 156 | AM_CONDITIONAL([ENABLE_NSS],[test "$enable_nss" = "yes"]) | ||
430 | 157 | |||
431 | 158 | # ******************************* | ||
432 | 159 | # Internationalization | ||
433 | 160 | # ******************************* | ||
434 | 161 | |||
435 | 162 | ISO_CODES_REQUIRED=0.35 | ||
436 | 163 | |||
437 | 164 | PKG_CHECK_EXISTS([iso-codes >= $ISO_CODES_REQUIRED], | ||
438 | 165 | [have_iso_codes=yes],[have_iso_codes=no]) | ||
439 | 166 | |||
440 | 167 | if test "$have_iso_codes" = "yes"; then | ||
441 | 168 | AC_MSG_CHECKING([whether iso-codes has iso-639 and iso-3166 domains]) | ||
442 | 169 | if $PKG_CONFIG --variable=domains iso-codes | grep -q 639 && \ | ||
443 | 170 | $PKG_CONFIG --variable=domains iso-codes | grep -q 3166 ; then | ||
444 | 171 | result=yes | ||
445 | 172 | else | ||
446 | 173 | result=no | ||
447 | 174 | have_iso_codes=no | ||
448 | 175 | fi | ||
449 | 176 | AC_MSG_RESULT([$result]) | ||
450 | 177 | fi | ||
451 | 178 | |||
452 | 179 | if test "$have_iso_codes" = "yes"; then | ||
453 | 180 | AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["`$PKG_CONFIG --variable=prefix iso-codes`"],[ISO codes prefix]) | ||
454 | 181 | AC_DEFINE([HAVE_ISO_CODES],[1],[Define if you have the iso-codes package]) | ||
455 | 182 | else | ||
456 | 183 | AC_MSG_ERROR([iso-codes is required]) | ||
457 | 184 | fi | ||
458 | 185 | |||
459 | 186 | GETTEXT_PACKAGE=epiphany | ||
460 | 187 | AC_SUBST([GETTEXT_PACKAGE]) | ||
461 | 188 | AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package]) | ||
462 | 189 | AM_GLIB_GNU_GETTEXT | ||
463 | 190 | |||
464 | 191 | # ******************************* | ||
465 | 192 | # User help | ||
466 | 193 | # ******************************* | ||
467 | 194 | |||
468 | 195 | YELP_HELP_INIT | ||
469 | 196 | |||
470 | 197 | # **************** | ||
471 | 198 | # Distributor name | ||
472 | 199 | # **************** | ||
473 | 200 | |||
474 | 201 | AC_ARG_WITH([distributor-name], | ||
475 | 202 | AS_HELP_STRING([--with-distributor-name=name],[Set the distributor name]), | ||
476 | 203 | [LSB_DISTRIBUTOR="$withval"]) | ||
477 | 204 | |||
478 | 205 | if test -z "$LSB_DISTRIBUTOR"; then | ||
479 | 206 | AC_CHECK_PROGS([LSB_RELEASE], [lsb_release],) | ||
480 | 207 | if test -n "$LSB_RELEASE"; then | ||
481 | 208 | # Fallback on lsb_release if available | ||
482 | 209 | LSB_DISTRIBUTOR=$($LSB_RELEASE -i -s) | ||
483 | 210 | else | ||
484 | 211 | # Fallback on the product name | ||
485 | 212 | LSB_DISTRIBUTOR="Epiphany" | ||
486 | 213 | fi | ||
487 | 214 | fi | ||
488 | 215 | |||
489 | 216 | AC_DEFINE_UNQUOTED([LSB_DISTRIBUTOR],["$LSB_DISTRIBUTOR"],[Distributor name]) | ||
490 | 217 | |||
491 | 218 | # ************ | ||
492 | 219 | # Output files | ||
493 | 220 | # ************ | ||
494 | 221 | |||
495 | 222 | AC_DEFINE([EPIPHANY_COMPILATION],[1],[Compiling epiphany]) | ||
496 | 223 | |||
497 | 224 | AC_CONFIG_FILES([ | ||
498 | 225 | Makefile | ||
499 | 226 | data/Makefile | ||
500 | 227 | data/epiphany.desktop.in | ||
501 | 228 | data/pages/Makefile | ||
502 | 229 | doc/Makefile | ||
503 | 230 | help/Makefile | ||
504 | 231 | lib/Makefile | ||
505 | 232 | lib/egg/Makefile | ||
506 | 233 | lib/history/Makefile | ||
507 | 234 | lib/widgets/Makefile | ||
508 | 235 | embed/Makefile | ||
509 | 236 | embed/web-extension/Makefile | ||
510 | 237 | src/Makefile | ||
511 | 238 | src/bookmarks/Makefile | ||
512 | 239 | po/Makefile.in | ||
513 | 240 | tests/Makefile | ||
514 | 241 | tests/data/Makefile | ||
515 | 242 | ], | ||
516 | 243 | []) | ||
517 | 244 | |||
518 | 245 | AC_OUTPUT | ||
519 | 246 | |||
520 | 247 | # ************************************* | ||
521 | 248 | # ************************************* | ||
522 | 249 | |||
523 | 250 | echo " | ||
524 | 251 | Epiphany was configured with the following options: | ||
525 | 252 | |||
526 | 253 | Source code location : $srcdir | ||
527 | 254 | Compiler : $CC | ||
528 | 255 | Prefix : $prefix | ||
529 | 256 | Extra debugging support : $enable_debug | ||
530 | 257 | Build tests : $enable_tests | ||
531 | 258 | Code coverage : $enable_code_coverage | ||
532 | 259 | |||
533 | 260 | NSS support : $enable_nss | ||
534 | 261 | " | ||
535 | 262 | 0 | ||
536 | === added directory '.pc/07_bookmarks.patch' | |||
537 | === removed directory '.pc/07_bookmarks.patch' | |||
538 | === added file '.pc/07_bookmarks.patch/.timestamp' | |||
539 | === added directory '.pc/07_bookmarks.patch/data' | |||
540 | === removed directory '.pc/07_bookmarks.patch/data' | |||
541 | === added file '.pc/07_bookmarks.patch/data/default-bookmarks.rdf.in' | |||
542 | --- .pc/07_bookmarks.patch/data/default-bookmarks.rdf.in 1970-01-01 00:00:00 +0000 | |||
543 | +++ .pc/07_bookmarks.patch/data/default-bookmarks.rdf.in 2015-07-11 21:08:34 +0000 | |||
544 | @@ -0,0 +1,37 @@ | |||
545 | 1 | <?xml version="1.0"?> | ||
546 | 2 | <rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:ephy="http://gnome.org/ns/epiphany#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> | ||
547 | 3 | <channel rdf:about="file://@pkgdatadir@/default-bookmarks.rdf"> | ||
548 | 4 | <title>Web bookmarks</title> | ||
549 | 5 | <link>https://wiki.gnome.org/Apps/Web</link> | ||
550 | 6 | <items> | ||
551 | 7 | <rdf:Seq> | ||
552 | 8 | <rdf:li rdf:resource="https://duckduckgo.com"/> | ||
553 | 9 | </rdf:Seq> | ||
554 | 10 | </items> | ||
555 | 11 | </channel> | ||
556 | 12 | <item rdf:about="https://duckduckgo.com"> | ||
557 | 13 | <_title>Search the web</_title> | ||
558 | 14 | <!-- Translators: you can use the regions listed in | ||
559 | 15 | https://duckduckgo.com/params to boost a particular region | ||
560 | 16 | associated with your language. For instance, for translators | ||
561 | 17 | to Finnish, it might make sense to add kl=fi-fi to the search | ||
562 | 18 | URL in order to boost results from Finland. Additionally, the | ||
563 | 19 | 'kad' parameter can be used to specify the locale in which | ||
564 | 20 | duckduckgo must be translated. So, for a Finnish localized | ||
565 | 21 | version of duckduckgo that will render results tailored for | ||
566 | 22 | Finland, the string would be: | ||
567 | 23 | https://duckduckgo.com/?t=epiphany&kl=fi-fi&kad=fi_FI | ||
568 | 24 | --> | ||
569 | 25 | <_link>https://duckduckgo.com/?t=epiphany</_link> | ||
570 | 26 | <!-- Translators: you can use the regions listed in | ||
571 | 27 | https://duckduckgo.com/params to boost a particular region | ||
572 | 28 | associated with your language. For instance, for translators | ||
573 | 29 | to Finnish, it might make sense to add kl=fi-fi to the search | ||
574 | 30 | URL in order to boost results from Finland. Additionally, the | ||
575 | 31 | 'kad' parameter can be used to specify the locale in which | ||
576 | 32 | duckduckgo must be translated. For such case, the search url | ||
577 | 33 | would be | ||
578 | 34 | https://duckduckgo.com/?q=%s&t=epiphany&kl=fi-fi&kad=fi_FI --> | ||
579 | 35 | <_ephy:smartlink>https://duckduckgo.com/?q=%s&t=epiphany</_ephy:smartlink> | ||
580 | 36 | </item> | ||
581 | 37 | </rdf:RDF> | ||
582 | 0 | 38 | ||
583 | === removed file '.pc/07_bookmarks.patch/data/default-bookmarks.rdf.in' | |||
584 | --- .pc/07_bookmarks.patch/data/default-bookmarks.rdf.in 2014-04-11 23:16:25 +0000 | |||
585 | +++ .pc/07_bookmarks.patch/data/default-bookmarks.rdf.in 1970-01-01 00:00:00 +0000 | |||
586 | @@ -1,37 +0,0 @@ | |||
587 | 1 | <?xml version="1.0"?> | ||
588 | 2 | <rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:ephy="http://gnome.org/ns/epiphany#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> | ||
589 | 3 | <channel rdf:about="file://@pkgdatadir@/default-bookmarks.rdf"> | ||
590 | 4 | <title>Web bookmarks</title> | ||
591 | 5 | <link>https://wiki.gnome.org/Apps/Web</link> | ||
592 | 6 | <items> | ||
593 | 7 | <rdf:Seq> | ||
594 | 8 | <rdf:li rdf:resource="https://duckduckgo.com"/> | ||
595 | 9 | </rdf:Seq> | ||
596 | 10 | </items> | ||
597 | 11 | </channel> | ||
598 | 12 | <item rdf:about="https://duckduckgo.com"> | ||
599 | 13 | <_title>Search the web</_title> | ||
600 | 14 | <!-- Translators: you can use the regions listed in | ||
601 | 15 | https://duckduckgo.com/params to boost a particular region | ||
602 | 16 | associated with your language. For instance, for translators | ||
603 | 17 | to Finnish, it might make sense to add kl=fi-fi to the search | ||
604 | 18 | URL in order to boost results from Finland. Additionally, the | ||
605 | 19 | 'kad' parameter can be used to specify the locale in which | ||
606 | 20 | duckduckgo must be translated. So, for a Finnish localized | ||
607 | 21 | version of duckduckgo that will render results tailored for | ||
608 | 22 | Finland, the string would be: | ||
609 | 23 | https://duckduckgo.com/?t=epiphany&kl=fi-fi&kad=fi_FI | ||
610 | 24 | --> | ||
611 | 25 | <_link>https://duckduckgo.com/?t=epiphany</_link> | ||
612 | 26 | <!-- Translators: you can use the regions listed in | ||
613 | 27 | https://duckduckgo.com/params to boost a particular region | ||
614 | 28 | associated with your language. For instance, for translators | ||
615 | 29 | to Finnish, it might make sense to add kl=fi-fi to the search | ||
616 | 30 | URL in order to boost results from Finland. Additionally, the | ||
617 | 31 | 'kad' parameter can be used to specify the locale in which | ||
618 | 32 | duckduckgo must be translated. For such case, the search url | ||
619 | 33 | would be | ||
620 | 34 | https://duckduckgo.com/?q=%s&t=epiphany&kl=fi-fi&kad=fi_FI --> | ||
621 | 35 | <_ephy:smartlink>https://duckduckgo.com/?q=%s&t=epiphany</_ephy:smartlink> | ||
622 | 36 | </item> | ||
623 | 37 | </rdf:RDF> | ||
624 | 38 | 0 | ||
625 | === added directory '.pc/12_safetypes.patch' | |||
626 | === removed directory '.pc/12_safetypes.patch' | |||
627 | === added file '.pc/12_safetypes.patch/.timestamp' | |||
628 | === added directory '.pc/12_safetypes.patch/data' | |||
629 | === removed directory '.pc/12_safetypes.patch/data' | |||
630 | === added file '.pc/12_safetypes.patch/data/mime-types-permissions.xml' | |||
631 | --- .pc/12_safetypes.patch/data/mime-types-permissions.xml 1970-01-01 00:00:00 +0000 | |||
632 | +++ .pc/12_safetypes.patch/data/mime-types-permissions.xml 2015-07-11 21:08:34 +0000 | |||
633 | @@ -0,0 +1,482 @@ | |||
634 | 1 | <mime-types-permissions> | ||
635 | 2 | <safe> | ||
636 | 3 | <mime-type type="application/andrew-inset"/> | ||
637 | 4 | <mime-type type="application/dicom"/> | ||
638 | 5 | <mime-type type="application/illustrator"/> | ||
639 | 6 | <mime-type type="application/mathematica"/> | ||
640 | 7 | <mime-type type="application/msexcel"/> | ||
641 | 8 | <mime-type type="application/msword"/> | ||
642 | 9 | <mime-type type="application/octet-stream"/> | ||
643 | 10 | <mime-type type="application/oda"/> | ||
644 | 11 | <mime-type type="application/ogg"/> | ||
645 | 12 | <mime-type type="application/pdf"/> | ||
646 | 13 | <mime-type type="application/pgp"/> | ||
647 | 14 | <mime-type type="application/pgp-encrypted"/> | ||
648 | 15 | <mime-type type="application/pgp-keys"/> | ||
649 | 16 | <mime-type type="application/pgp-signature"/> | ||
650 | 17 | <mime-type type="application/pkcs7-mime"/> | ||
651 | 18 | <mime-type type="application/pkcs7-signature"/> | ||
652 | 19 | <mime-type type="application/postscript"/> | ||
653 | 20 | <mime-type type="application/ram"/> | ||
654 | 21 | <mime-type type="application/rdf+xml"/> | ||
655 | 22 | <mime-type type="application/rtf"/> | ||
656 | 23 | <mime-type type="application/sdp"/> | ||
657 | 24 | <mime-type type="application/smil"/> | ||
658 | 25 | <mime-type type="application/stuffit"/> | ||
659 | 26 | <mime-type type="application/vlc"/> | ||
660 | 27 | <mime-type type="application/vnd.corel-draw"/> | ||
661 | 28 | <mime-type type="application/vnd.emusic-emusic_package"/> | ||
662 | 29 | <mime-type type="application/vnd.lotus-1-2-3"/> | ||
663 | 30 | <mime-type type="application/vnd.ms-excel"/> | ||
664 | 31 | <mime-type type="application/vnd.ms-powerpoint"/> | ||
665 | 32 | <mime-type type="application/vnd.ms-word"/> | ||
666 | 33 | <mime-type type="application/vnd.oasis.opendocument.text"/> | ||
667 | 34 | <mime-type type="application/vnd.oasis.opendocument.text-template"/> | ||
668 | 35 | <mime-type type="application/vnd.oasis.opendocument.text-web"/> | ||
669 | 36 | <mime-type type="application/vnd.oasis.opendocument.text-master"/> | ||
670 | 37 | <mime-type type="application/vnd.oasis.opendocument.graphics"/> | ||
671 | 38 | <mime-type type="application/vnd.oasis.opendocument.graphics-template"/> | ||
672 | 39 | <mime-type type="application/vnd.oasis.opendocument.presentation"/> | ||
673 | 40 | <mime-type type="application/vnd.oasis.opendocument.presentation-template"/> | ||
674 | 41 | <mime-type type="application/vnd.oasis.opendocument.spreadsheet"/> | ||
675 | 42 | <mime-type type="application/vnd.oasis.opendocument.spreadsheet-template"/> | ||
676 | 43 | <mime-type type="application/vnd.oasis.opendocument.chart"/> | ||
677 | 44 | <mime-type type="application/vnd.oasis.opendocument.formula"/> | ||
678 | 45 | <mime-type type="application/vnd.oasis.opendocument.database"/> | ||
679 | 46 | <mime-type type="application/vnd.oasis.opendocument.image"/> | ||
680 | 47 | <mime-type type="application/vnd.rn-realmedia"/> | ||
681 | 48 | <mime-type type="application/vnd.stardivision.calc"/> | ||
682 | 49 | <mime-type type="application/vnd.stardivision.chart"/> | ||
683 | 50 | <mime-type type="application/vnd.stardivision.draw"/> | ||
684 | 51 | <mime-type type="application/vnd.stardivision.impress"/> | ||
685 | 52 | <mime-type type="application/vnd.stardivision.mail"/> | ||
686 | 53 | <mime-type type="application/vnd.stardivision.math"/> | ||
687 | 54 | <mime-type type="application/vnd.stardivision.writer"/> | ||
688 | 55 | <mime-type type="application/vnd.sun.xml.calc"/> | ||
689 | 56 | <mime-type type="application/vnd.sun.xml.calc.template"/> | ||
690 | 57 | <mime-type type="application/vnd.sun.xml.draw"/> | ||
691 | 58 | <mime-type type="application/vnd.sun.xml.draw.template"/> | ||
692 | 59 | <mime-type type="application/vnd.sun.xml.impress"/> | ||
693 | 60 | <mime-type type="application/vnd.sun.xml.impress.template"/> | ||
694 | 61 | <mime-type type="application/vnd.sun.xml.math"/> | ||
695 | 62 | <mime-type type="application/vnd.sun.xml.writer"/> | ||
696 | 63 | <mime-type type="application/vnd.sun.xml.writer.global"/> | ||
697 | 64 | <mime-type type="application/vnd.sun.xml.writer.template"/> | ||
698 | 65 | <mime-type type="application/vnd.wordperfect"/> | ||
699 | 66 | <mime-type type="application/wordperfect"/> | ||
700 | 67 | <mime-type type="application/x-7z-compressed"/> | ||
701 | 68 | <mime-type type="application/x-abiword"/> | ||
702 | 69 | <mime-type type="application/x-amipro"/> | ||
703 | 70 | <mime-type type="application/x-applix-spreadsheet"/> | ||
704 | 71 | <mime-type type="application/x-applix-word"/> | ||
705 | 72 | <mime-type type="application/x-archive"/> | ||
706 | 73 | <mime-type type="application/x-arj"/> | ||
707 | 74 | <mime-type type="application/x-asp"/> | ||
708 | 75 | <mime-type type="application/x-bcpio"/> | ||
709 | 76 | <mime-type type="application/x-bittorrent"/> | ||
710 | 77 | <mime-type type="application/x-blender"/> | ||
711 | 78 | <mime-type type="application/x-bzip"/> | ||
712 | 79 | <mime-type type="application/x-bzip2"/> | ||
713 | 80 | <mime-type type="application/x-bzip-compressed-tar"/> | ||
714 | 81 | <mime-type type="application/x-cd-image"/> | ||
715 | 82 | <mime-type type="application/x-cgi"/> | ||
716 | 83 | <mime-type type="application/x-chess-pgn"/> | ||
717 | 84 | <mime-type type="application/x-chm"/> | ||
718 | 85 | <mime-type type="application/x-compress"/> | ||
719 | 86 | <mime-type type="application/x-compressed-tar"/> | ||
720 | 87 | <mime-type type="application/x-cpio"/> | ||
721 | 88 | <mime-type type="application/x-cpio-compressed"/> | ||
722 | 89 | <mime-type type="application/x-dbase"/> | ||
723 | 90 | <mime-type type="application/x-dbm"/> | ||
724 | 91 | <mime-type type="application/x-designer"/> | ||
725 | 92 | <mime-type type="application/x-desktop"/> | ||
726 | 93 | <mime-type type="application/x-dia-diagram"/> | ||
727 | 94 | <mime-type type="application/x-dvi"/> | ||
728 | 95 | <mime-type type="application/x-e-theme"/> | ||
729 | 96 | <mime-type type="application/x-egon"/> | ||
730 | 97 | <mime-type type="application/x-excellon"/> | ||
731 | 98 | <mime-type type="application/x-flash-video"/> | ||
732 | 99 | <mime-type type="application/x-font"/> | ||
733 | 100 | <mime-type type="application/x-font-afm"/> | ||
734 | 101 | <mime-type type="application/x-font-bdf"/> | ||
735 | 102 | <mime-type type="application/x-font-dos"/> | ||
736 | 103 | <mime-type type="application/x-font-framemaker"/> | ||
737 | 104 | <mime-type type="application/x-font-libgrx"/> | ||
738 | 105 | <mime-type type="application/x-font-linux-psf"/> | ||
739 | 106 | <mime-type type="application/x-font-otf"/> | ||
740 | 107 | <mime-type type="application/x-font-pcf"/> | ||
741 | 108 | <mime-type type="application/x-font-speedo"/> | ||
742 | 109 | <mime-type type="application/x-font-sunos-news"/> | ||
743 | 110 | <mime-type type="application/x-font-tex"/> | ||
744 | 111 | <mime-type type="application/x-font-tex-tfm"/> | ||
745 | 112 | <mime-type type="application/x-font-ttf"/> | ||
746 | 113 | <mime-type type="application/x-font-type1"/> | ||
747 | 114 | <mime-type type="application/x-font-vfont"/> | ||
748 | 115 | <mime-type type="application/x-frame"/> | ||
749 | 116 | <mime-type type="application/x-gdbm"/> | ||
750 | 117 | <mime-type type="application/x-geda-gsch2pcb-project"/> | ||
751 | 118 | <mime-type type="application/x-geda-schematic"/> | ||
752 | 119 | <mime-type type="application/x-geda-symbol"/> | ||
753 | 120 | <mime-type type="application/x-gerber"/> | ||
754 | 121 | <mime-type type="application/x-gettext-translation"/> | ||
755 | 122 | <mime-type type="application/x-glade"/> | ||
756 | 123 | <mime-type type="application/x-gmc-link"/> | ||
757 | 124 | <mime-type type="application/x-gnome-app-info"/> | ||
758 | 125 | <mime-type type="application/x-gnucash"/> | ||
759 | 126 | <mime-type type="application/x-gnumeric"/> | ||
760 | 127 | <mime-type type="application/x-graphite"/> | ||
761 | 128 | <mime-type type="application/x-gtar"/> | ||
762 | 129 | <mime-type type="application/x-gtktalog"/> | ||
763 | 130 | <mime-type type="application/x-gzip"/> | ||
764 | 131 | <mime-type type="application/x-gzpostscript"/> | ||
765 | 132 | <mime-type type="application/x-hdf"/> | ||
766 | 133 | <mime-type type="application/x-jar"/> | ||
767 | 134 | <mime-type type="application/x-java"/> | ||
768 | 135 | <mime-type type="application/x-java-jnlp-file"/> | ||
769 | 136 | <mime-type type="application/x-jbuilder-project"/> | ||
770 | 137 | <mime-type type="application/x-karbon"/> | ||
771 | 138 | <mime-type type="application/x-kchart"/> | ||
772 | 139 | <mime-type type="application/x-kformula"/> | ||
773 | 140 | <mime-type type="application/x-killustrator"/> | ||
774 | 141 | <mime-type type="application/x-kivio"/> | ||
775 | 142 | <mime-type type="application/x-kontour"/> | ||
776 | 143 | <mime-type type="application/x-kpovmodeler"/> | ||
777 | 144 | <mime-type type="application/x-kpresenter"/> | ||
778 | 145 | <mime-type type="application/x-krita"/> | ||
779 | 146 | <mime-type type="application/x-kspread"/> | ||
780 | 147 | <mime-type type="application/x-kspread-crypt"/> | ||
781 | 148 | <mime-type type="application/x-ksysv-package"/> | ||
782 | 149 | <mime-type type="application/x-kugar"/> | ||
783 | 150 | <mime-type type="application/x-kword"/> | ||
784 | 151 | <mime-type type="application/x-kword-crypt"/> | ||
785 | 152 | <mime-type type="application/x-lha"/> | ||
786 | 153 | <mime-type type="application/x-lhz"/> | ||
787 | 154 | <mime-type type="application/x-linguist"/> | ||
788 | 155 | <mime-type type="application/x-lyx"/> | ||
789 | 156 | <mime-type type="application/x-lzop"/> | ||
790 | 157 | <mime-type type="application/x-magicpoint"/> | ||
791 | 158 | <mime-type type="application/x-matroska"/> | ||
792 | 159 | <mime-type type="application/x-mif"/> | ||
793 | 160 | <mime-type type="application/x-mozilla-bookmarks"/> | ||
794 | 161 | <mime-type type="application/x-mswinurl"/> | ||
795 | 162 | <mime-type type="application/x-mswrite"/> | ||
796 | 163 | <mime-type type="application/x-nautilus-link"/> | ||
797 | 164 | <mime-type type="application/x-netcdf"/> | ||
798 | 165 | <mime-type type="application/x-netscape-bookmarks"/> | ||
799 | 166 | <mime-type type="application/x-netshow-channel"/> | ||
800 | 167 | <mime-type type="application/x-ogg"/> | ||
801 | 168 | <mime-type type="application/x-oleo"/> | ||
802 | 169 | <mime-type type="application/x-palm-database"/> | ||
803 | 170 | <mime-type type="application/x-pcb-layout"/> | ||
804 | 171 | <mime-type type="application/x-pcb-footprint"/> | ||
805 | 172 | <mime-type type="application/x-pcb-netlist"/> | ||
806 | 173 | <mime-type type="application/x-pdf"/> | ||
807 | 174 | <mime-type type="application/x-php"/> | ||
808 | 175 | <mime-type type="application/x-pkcs12"/> | ||
809 | 176 | <mime-type type="application/x-profile"/> | ||
810 | 177 | <mime-type type="application/x-pw"/> | ||
811 | 178 | <mime-type type="application/x-quattropro"/> | ||
812 | 179 | <mime-type type="application/x-quicktime-media-link"/> | ||
813 | 180 | <mime-type type="application/x-quicktimeplayer"/> | ||
814 | 181 | <mime-type type="application/x-qw"/> | ||
815 | 182 | <mime-type type="application/x-rar"/> | ||
816 | 183 | <mime-type type="application/x-reject"/> | ||
817 | 184 | <mime-type type="application/x-rpm"/> | ||
818 | 185 | <mime-type type="application/x-sc"/> | ||
819 | 186 | <mime-type type="application/x-shar"/> | ||
820 | 187 | <mime-type type="application/x-shared-library-la"/> | ||
821 | 188 | <mime-type type="application/x-shockwave-flash"/> | ||
822 | 189 | <mime-type type="application/x-siag"/> | ||
823 | 190 | <mime-type type="application/x-sit"/> | ||
824 | 191 | <mime-type type="application/x-slp"/> | ||
825 | 192 | <mime-type type="application/x-smil"/> | ||
826 | 193 | <mime-type type="application/x-stuffit"/> | ||
827 | 194 | <mime-type type="application/x-sv4cpio"/> | ||
828 | 195 | <mime-type type="application/x-sv4crc"/> | ||
829 | 196 | <mime-type type="application/x-tar"/> | ||
830 | 197 | <mime-type type="application/x-tarz"/> | ||
831 | 198 | <mime-type type="application/x-tex-gf"/> | ||
832 | 199 | <mime-type type="application/x-tex-pk"/> | ||
833 | 200 | <mime-type type="application/x-tgif"/> | ||
834 | 201 | <mime-type type="application/x-theme"/> | ||
835 | 202 | <mime-type type="application/x-toutdoux"/> | ||
836 | 203 | <mime-type type="application/x-trash"/> | ||
837 | 204 | <mime-type type="application/x-troff"/> | ||
838 | 205 | <mime-type type="application/x-troff-man"/> | ||
839 | 206 | <mime-type type="application/x-troff-man-compressed"/> | ||
840 | 207 | <mime-type type="application/x-tzo"/> | ||
841 | 208 | <mime-type type="application/x-ustar"/> | ||
842 | 209 | <mime-type type="application/x-wais-source"/> | ||
843 | 210 | <mime-type type="application/x-wordperfect"/> | ||
844 | 211 | <mime-type type="application/x-wpg"/> | ||
845 | 212 | <mime-type type="application/x-x509-ca-cert"/> | ||
846 | 213 | <mime-type type="application/x-xbel"/> | ||
847 | 214 | <mime-type type="application/x-zerosize"/> | ||
848 | 215 | <mime-type type="application/x-zip-compressed"/> | ||
849 | 216 | <mime-type type="application/x-zoo"/> | ||
850 | 217 | <mime-type type="application/xhtml+xml"/> | ||
851 | 218 | <mime-type type="application/zip"/> | ||
852 | 219 | <mime-type type="audio/ac3"/> | ||
853 | 220 | <mime-type type="audio/AMR"/> | ||
854 | 221 | <mime-type type="audio/AMR-WB"/> | ||
855 | 222 | <mime-type type="audio/basic"/> | ||
856 | 223 | <mime-type type="audio/midi"/> | ||
857 | 224 | <mime-type type="audio/mpeg"/> | ||
858 | 225 | <mime-type type="audio/mpegurl"/> | ||
859 | 226 | <mime-type type="audio/ogg"/> | ||
860 | 227 | <mime-type type="audio/playlist"/> | ||
861 | 228 | <mime-type type="audio/prs.sid"/> | ||
862 | 229 | <mime-type type="audio/vnd.rn-realaudio"/> | ||
863 | 230 | <mime-type type="audio/vnd.wave"/> | ||
864 | 231 | <mime-type type="audio/x-vorbis"/> | ||
865 | 232 | <mime-type type="audio/wav"/> | ||
866 | 233 | <mime-type type="audio/x-adpcm"/> | ||
867 | 234 | <mime-type type="audio/x-aifc"/> | ||
868 | 235 | <mime-type type="audio/x-aiff"/> | ||
869 | 236 | <mime-type type="audio/x-aiffc"/> | ||
870 | 237 | <mime-type type="audio/x-ape"/> | ||
871 | 238 | <mime-type type="audio/x-flac"/> | ||
872 | 239 | <mime-type type="audio/x-it"/> | ||
873 | 240 | <mime-type type="audio/x-m4a"/> | ||
874 | 241 | <mime-type type="audio/x-matroska"/> | ||
875 | 242 | <mime-type type="audio/x-midi"/> | ||
876 | 243 | <mime-type type="audio/x-mod"/> | ||
877 | 244 | <mime-type type="audio/x-mp3"/> | ||
878 | 245 | <mime-type type="audio/x-mp3-playlist"/> | ||
879 | 246 | <mime-type type="audio/x-mpeg"/> | ||
880 | 247 | <mime-type type="audio/x-mpegurl"/> | ||
881 | 248 | <mime-type type="audio/x-ms-asx"/> | ||
882 | 249 | <mime-type type="audio/x-ms-wax"/> | ||
883 | 250 | <mime-type type="audio/x-musepack"/> | ||
884 | 251 | <mime-type type="audio/x-pn-realaudio"/> | ||
885 | 252 | <mime-type type="audio/x-pn-realaudio-plugin"/> | ||
886 | 253 | <mime-type type="audio/x-realaudio"/> | ||
887 | 254 | <mime-type type="audio/x-real-audio"/> | ||
888 | 255 | <mime-type type="audio/x-riff"/> | ||
889 | 256 | <mime-type type="audio/x-s3m"/> | ||
890 | 257 | <mime-type type="audio/x-sbc"/> | ||
891 | 258 | <mime-type type="audio/x-scpls"/> | ||
892 | 259 | <mime-type type="audio/x-stm"/> | ||
893 | 260 | <mime-type type="audio/x-tta"/> | ||
894 | 261 | <mime-type type="audio/x-voc"/> | ||
895 | 262 | <mime-type type="audio/x-wav"/> | ||
896 | 263 | <mime-type type="audio/x-wavpack"/> | ||
897 | 264 | <mime-type type="audio/x-xi"/> | ||
898 | 265 | <mime-type type="audio/x-xm"/> | ||
899 | 266 | <mime-type type="image/bmp"/> | ||
900 | 267 | <mime-type type="image/cgm"/> | ||
901 | 268 | <mime-type type="image/dpx"/> | ||
902 | 269 | <mime-type type="image/fax-g3"/> | ||
903 | 270 | <mime-type type="image/g3fax"/> | ||
904 | 271 | <mime-type type="image/gif"/> | ||
905 | 272 | <mime-type type="image/ief"/> | ||
906 | 273 | <mime-type type="image/jpeg"/> | ||
907 | 274 | <mime-type type="image/jpeg2000"/> | ||
908 | 275 | <mime-type type="image/png"/> | ||
909 | 276 | <mime-type type="image/rle"/> | ||
910 | 277 | <mime-type type="image/svg+xml"/> | ||
911 | 278 | <mime-type type="image/tiff"/> | ||
912 | 279 | <mime-type type="image/vnd.djvu"/> | ||
913 | 280 | <mime-type type="image/vnd.dwg"/> | ||
914 | 281 | <mime-type type="image/vnd.dxf"/> | ||
915 | 282 | <mime-type type="image/x-3ds"/> | ||
916 | 283 | <mime-type type="image/x-applix-graphics"/> | ||
917 | 284 | <mime-type type="image/x-cmu-raster"/> | ||
918 | 285 | <mime-type type="image/x-compressed-xcf"/> | ||
919 | 286 | <mime-type type="image/x-dcm"/> | ||
920 | 287 | <mime-type type="image/x-dib"/> | ||
921 | 288 | <mime-type type="image/x-djvu"/> | ||
922 | 289 | <mime-type type="image/x-eps"/> | ||
923 | 290 | <mime-type type="image/x-fits"/> | ||
924 | 291 | <mime-type type="image/x-fpx"/> | ||
925 | 292 | <mime-type type="image/x-icb"/> | ||
926 | 293 | <mime-type type="image/x-ico"/> | ||
927 | 294 | <mime-type type="image/x-iff"/> | ||
928 | 295 | <mime-type type="image/x-ilbm"/> | ||
929 | 296 | <mime-type type="image/x-jng"/> | ||
930 | 297 | <mime-type type="image/x-lwo"/> | ||
931 | 298 | <mime-type type="image/x-lws"/> | ||
932 | 299 | <mime-type type="image/x-msod"/> | ||
933 | 300 | <mime-type type="image/x-niff"/> | ||
934 | 301 | <mime-type type="image/x-pcx"/> | ||
935 | 302 | <mime-type type="image/x-photo-cd"/> | ||
936 | 303 | <mime-type type="image/x-pict"/> | ||
937 | 304 | <mime-type type="image/x-png"/> | ||
938 | 305 | <mime-type type="image/x-portable-anymap"/> | ||
939 | 306 | <mime-type type="image/x-portable-bitmap"/> | ||
940 | 307 | <mime-type type="image/x-portable-graymap"/> | ||
941 | 308 | <mime-type type="image/x-portable-pixmap"/> | ||
942 | 309 | <mime-type type="image/x-psd"/> | ||
943 | 310 | <mime-type type="image/x-rgb"/> | ||
944 | 311 | <mime-type type="image/x-sgi"/> | ||
945 | 312 | <mime-type type="image/x-sun-raster"/> | ||
946 | 313 | <mime-type type="image/x-tga"/> | ||
947 | 314 | <mime-type type="image/x-win-bitmap"/> | ||
948 | 315 | <mime-type type="image/x-wmf"/> | ||
949 | 316 | <mime-type type="image/x-xbitmap"/> | ||
950 | 317 | <mime-type type="image/x-xcf"/> | ||
951 | 318 | <mime-type type="image/x-xfig"/> | ||
952 | 319 | <mime-type type="image/x-xpixmap"/> | ||
953 | 320 | <mime-type type="image/x-xwindowdump"/> | ||
954 | 321 | <mime-type type="message/delivery-status"/> | ||
955 | 322 | <mime-type type="message/disposition-notification"/> | ||
956 | 323 | <mime-type type="message/external-body"/> | ||
957 | 324 | <mime-type type="message/news"/> | ||
958 | 325 | <mime-type type="message/partial"/> | ||
959 | 326 | <mime-type type="message/rfc822"/> | ||
960 | 327 | <mime-type type="message/x-gnu-rmail"/> | ||
961 | 328 | <mime-type type="model/vrml"/> | ||
962 | 329 | <mime-type type="multipart/alternative"/> | ||
963 | 330 | <mime-type type="multipart/appledouble"/> | ||
964 | 331 | <mime-type type="multipart/digest"/> | ||
965 | 332 | <mime-type type="multipart/encrypted"/> | ||
966 | 333 | <mime-type type="multipart/mixed"/> | ||
967 | 334 | <mime-type type="multipart/related"/> | ||
968 | 335 | <mime-type type="multipart/report"/> | ||
969 | 336 | <mime-type type="multipart/signed"/> | ||
970 | 337 | <mime-type type="multipart/x-mixed-replace"/> | ||
971 | 338 | <mime-type type="text/calendar"/> | ||
972 | 339 | <mime-type type="text/css"/> | ||
973 | 340 | <mime-type type="text/csv"/> | ||
974 | 341 | <mime-type type="text/directory"/> | ||
975 | 342 | <mime-type type="text/enriched"/> | ||
976 | 343 | <mime-type type="text/google-video-pointer"/> | ||
977 | 344 | <mime-type type="text/html"/> | ||
978 | 345 | <mime-type type="text/htmlh"/> | ||
979 | 346 | <mime-type type="text/mathml"/> | ||
980 | 347 | <mime-type type="text/plain"/> | ||
981 | 348 | <mime-type type="text/rdf"/> | ||
982 | 349 | <mime-type type="text/rfc822-headers"/> | ||
983 | 350 | <mime-type type="text/richtext"/> | ||
984 | 351 | <mime-type type="text/rss"/> | ||
985 | 352 | <mime-type type="text/rtf"/> | ||
986 | 353 | <mime-type type="text/sgml"/> | ||
987 | 354 | <mime-type type="text/spreadsheet"/> | ||
988 | 355 | <mime-type type="text/tab-separated-values"/> | ||
989 | 356 | <mime-type type="text/vnd.wap.wml"/> | ||
990 | 357 | <mime-type type="text/x-adasrc"/> | ||
991 | 358 | <mime-type type="text/x-authors"/> | ||
992 | 359 | <mime-type type="text/x-bibtex"/> | ||
993 | 360 | <mime-type type="text/x-c++hdr"/> | ||
994 | 361 | <mime-type type="text/x-c++src"/> | ||
995 | 362 | <mime-type type="text/x-chdr"/> | ||
996 | 363 | <mime-type type="text/x-comma-separated-values"/> | ||
997 | 364 | <mime-type type="text/x-copying"/> | ||
998 | 365 | <mime-type type="text/x-credits"/> | ||
999 | 366 | <mime-type type="text/x-csharp"/> | ||
1000 | 367 | <mime-type type="text/x-csrc"/> | ||
1001 | 368 | <mime-type type="text/x-dcl"/> | ||
1002 | 369 | <mime-type type="text/x-diff"/> | ||
1003 | 370 | <mime-type type="text/x-dsl"/> | ||
1004 | 371 | <mime-type type="text/x-dsrc"/> | ||
1005 | 372 | <mime-type type="text/x-dtd"/> | ||
1006 | 373 | <mime-type type="text/x-emacs-lisp"/> | ||
1007 | 374 | <mime-type type="text/x-fortran"/> | ||
1008 | 375 | <mime-type type="text/x-gettext-translation"/> | ||
1009 | 376 | <mime-type type="text/x-gettext-translation-template"/> | ||
1010 | 377 | <mime-type type="text/x-google-video-pointer"/> | ||
1011 | 378 | <mime-type type="text/x-gtkrc"/> | ||
1012 | 379 | <mime-type type="text/x-haskell"/> | ||
1013 | 380 | <mime-type type="text/x-idl"/> | ||
1014 | 381 | <mime-type type="text/x-install"/> | ||
1015 | 382 | <mime-type type="text/x-java"/> | ||
1016 | 383 | <mime-type type="text/x-ksysv-log"/> | ||
1017 | 384 | <mime-type type="text/x-literate-haskell"/> | ||
1018 | 385 | <mime-type type="text/x-log"/> | ||
1019 | 386 | <mime-type type="text/x-makefile"/> | ||
1020 | 387 | <mime-type type="text/x-moc"/> | ||
1021 | 388 | <mime-type type="text/x-objcsrc"/> | ||
1022 | 389 | <mime-type type="text/x-pascal"/> | ||
1023 | 390 | <mime-type type="text/x-patch"/> | ||
1024 | 391 | <mime-type type="text/x-python"/> | ||
1025 | 392 | <mime-type type="text/x-readme"/> | ||
1026 | 393 | <mime-type type="text/x-scheme"/> | ||
1027 | 394 | <mime-type type="text/x-setext"/> | ||
1028 | 395 | <mime-type type="text/x-speech"/> | ||
1029 | 396 | <mime-type type="text/x-sql"/> | ||
1030 | 397 | <mime-type type="text/x-tcl"/> | ||
1031 | 398 | <mime-type type="text/x-tex"/> | ||
1032 | 399 | <mime-type type="text/x-texinfo"/> | ||
1033 | 400 | <mime-type type="text/x-troff-me"/> | ||
1034 | 401 | <mime-type type="text/x-troff-mm"/> | ||
1035 | 402 | <mime-type type="text/x-troff-ms"/> | ||
1036 | 403 | <mime-type type="text/x-uil"/> | ||
1037 | 404 | <mime-type type="text/x-uri"/> | ||
1038 | 405 | <mime-type type="text/x-vcalendar"/> | ||
1039 | 406 | <mime-type type="text/x-vcard"/> | ||
1040 | 407 | <mime-type type="text/x-xmi"/> | ||
1041 | 408 | <mime-type type="text/x-xslfo"/> | ||
1042 | 409 | <mime-type type="text/x-xslt"/> | ||
1043 | 410 | <mime-type type="text/xmcd"/> | ||
1044 | 411 | <mime-type type="text/xml"/> | ||
1045 | 412 | <mime-type type="video/flv"/> | ||
1046 | 413 | <mime-type type="video/isivideo"/> | ||
1047 | 414 | <mime-type type="video/mp4"/> | ||
1048 | 415 | <mime-type type="video/mpeg"/> | ||
1049 | 416 | <mime-type type="video/quicktime"/> | ||
1050 | 417 | <mime-type type="video/vivo"/> | ||
1051 | 418 | <mime-type type="video/wavelet"/> | ||
1052 | 419 | <mime-type type="video/x-anim"/> | ||
1053 | 420 | <mime-type type="video/x-avi"/> | ||
1054 | 421 | <mime-type type="video/x-flic"/> | ||
1055 | 422 | <mime-type type="video/x-flv"/> | ||
1056 | 423 | <mime-type type="video/x-m4v"/> | ||
1057 | 424 | <mime-type type="video/x-matroska"/> | ||
1058 | 425 | <mime-type type="video/x-mng"/> | ||
1059 | 426 | <mime-type type="video/x-ms-asf"/> | ||
1060 | 427 | <mime-type type="video/x-ms-asf-plugin"/> | ||
1061 | 428 | <mime-type type="video/x-ms-wmv"/> | ||
1062 | 429 | <mime-type type="video/x-ms-wvx"/> | ||
1063 | 430 | <mime-type type="video/x-msvideo"/> | ||
1064 | 431 | <mime-type type="video/x-nsv"/> | ||
1065 | 432 | <mime-type type="video/x-ogm+ogg"/> | ||
1066 | 433 | <mime-type type="video/x-real-video"/> | ||
1067 | 434 | <mime-type type="video/x-theora+ogg"/> | ||
1068 | 435 | <mime-type type="video/x-sgi-movie"/> | ||
1069 | 436 | </safe> | ||
1070 | 437 | <unsafe> | ||
1071 | 438 | <mime-type type="application/mac-binhex40"/> | ||
1072 | 439 | <mime-type type="application/vnd.hp-hpgl"/> | ||
1073 | 440 | <mime-type type="application/vnd.hp-pcl"/> | ||
1074 | 441 | <mime-type type="application/vnd.mozilla.xul+xml"/> | ||
1075 | 442 | <mime-type type="application/vnd.palm"/> | ||
1076 | 443 | <mime-type type="application/x-arc"/> | ||
1077 | 444 | <mime-type type="application/x-awk"/> | ||
1078 | 445 | <mime-type type="application/x-class-file"/> | ||
1079 | 446 | <mime-type type="application/x-core"/> | ||
1080 | 447 | <mime-type type="application/x-csh"/> | ||
1081 | 448 | <mime-type type="application/x-dc-rom"/> | ||
1082 | 449 | <mime-type type="application/x-deb"/> | ||
1083 | 450 | <mime-type type="application/x-executable"/> | ||
1084 | 451 | <mime-type type="application/x-gameboy-rom"/> | ||
1085 | 452 | <mime-type type="application/x-genesis-rom"/> | ||
1086 | 453 | <mime-type type="application/x-ipod-firmware"/> | ||
1087 | 454 | <mime-type type="application/x-javascript"/> | ||
1088 | 455 | <mime-type type="application/x-macbinary"/> | ||
1089 | 456 | <mime-type type="application/x-mplayer2"/> | ||
1090 | 457 | <mime-type type="application/x-ms-dos-executable"/> | ||
1091 | 458 | <mime-type type="application/x-msx-rom"/> | ||
1092 | 459 | <mime-type type="application/x-n64-rom"/> | ||
1093 | 460 | <mime-type type="application/x-nes-rom"/> | ||
1094 | 461 | <mime-type type="application/x-object"/> | ||
1095 | 462 | <mime-type type="application/x-ole-storage"/> | ||
1096 | 463 | <mime-type type="application/x-par2"/> | ||
1097 | 464 | <mime-type type="application/x-pef-executable"/> | ||
1098 | 465 | <mime-type type="application/x-perl"/> | ||
1099 | 466 | <mime-type type="application/x-python"/> | ||
1100 | 467 | <mime-type type="application/x-python-bytecode"/> | ||
1101 | 468 | <mime-type type="application/x-ruby"/> | ||
1102 | 469 | <mime-type type="application/x-sharedlib"/> | ||
1103 | 470 | <mime-type type="application/x-shellscript"/> | ||
1104 | 471 | <mime-type type="application/x-sms-rom"/> | ||
1105 | 472 | <mime-type type="application/x-xpinstall"/> | ||
1106 | 473 | <mime-type type="inode/blockdevice"/> | ||
1107 | 474 | <mime-type type="inode/chardevice"/> | ||
1108 | 475 | <mime-type type="inode/directory"/> | ||
1109 | 476 | <mime-type type="inode/fifo"/> | ||
1110 | 477 | <mime-type type="inode/mount-point"/> | ||
1111 | 478 | <mime-type type="inode/socket"/> | ||
1112 | 479 | <mime-type type="inode/symlink"/> | ||
1113 | 480 | <mime-type type="text/x-ksh"/> | ||
1114 | 481 | </unsafe> | ||
1115 | 482 | </mime-types-permissions> | ||
1116 | 0 | 483 | ||
1117 | === removed file '.pc/12_safetypes.patch/data/mime-types-permissions.xml' | |||
1118 | --- .pc/12_safetypes.patch/data/mime-types-permissions.xml 2010-07-03 01:38:24 +0000 | |||
1119 | +++ .pc/12_safetypes.patch/data/mime-types-permissions.xml 1970-01-01 00:00:00 +0000 | |||
1120 | @@ -1,482 +0,0 @@ | |||
1121 | 1 | <mime-types-permissions> | ||
1122 | 2 | <safe> | ||
1123 | 3 | <mime-type type="application/andrew-inset"/> | ||
1124 | 4 | <mime-type type="application/dicom"/> | ||
1125 | 5 | <mime-type type="application/illustrator"/> | ||
1126 | 6 | <mime-type type="application/mathematica"/> | ||
1127 | 7 | <mime-type type="application/msexcel"/> | ||
1128 | 8 | <mime-type type="application/msword"/> | ||
1129 | 9 | <mime-type type="application/octet-stream"/> | ||
1130 | 10 | <mime-type type="application/oda"/> | ||
1131 | 11 | <mime-type type="application/ogg"/> | ||
1132 | 12 | <mime-type type="application/pdf"/> | ||
1133 | 13 | <mime-type type="application/pgp"/> | ||
1134 | 14 | <mime-type type="application/pgp-encrypted"/> | ||
1135 | 15 | <mime-type type="application/pgp-keys"/> | ||
1136 | 16 | <mime-type type="application/pgp-signature"/> | ||
1137 | 17 | <mime-type type="application/pkcs7-mime"/> | ||
1138 | 18 | <mime-type type="application/pkcs7-signature"/> | ||
1139 | 19 | <mime-type type="application/postscript"/> | ||
1140 | 20 | <mime-type type="application/ram"/> | ||
1141 | 21 | <mime-type type="application/rdf+xml"/> | ||
1142 | 22 | <mime-type type="application/rtf"/> | ||
1143 | 23 | <mime-type type="application/sdp"/> | ||
1144 | 24 | <mime-type type="application/smil"/> | ||
1145 | 25 | <mime-type type="application/stuffit"/> | ||
1146 | 26 | <mime-type type="application/vlc"/> | ||
1147 | 27 | <mime-type type="application/vnd.corel-draw"/> | ||
1148 | 28 | <mime-type type="application/vnd.emusic-emusic_package"/> | ||
1149 | 29 | <mime-type type="application/vnd.lotus-1-2-3"/> | ||
1150 | 30 | <mime-type type="application/vnd.ms-excel"/> | ||
1151 | 31 | <mime-type type="application/vnd.ms-powerpoint"/> | ||
1152 | 32 | <mime-type type="application/vnd.ms-word"/> | ||
1153 | 33 | <mime-type type="application/vnd.oasis.opendocument.text"/> | ||
1154 | 34 | <mime-type type="application/vnd.oasis.opendocument.text-template"/> | ||
1155 | 35 | <mime-type type="application/vnd.oasis.opendocument.text-web"/> | ||
1156 | 36 | <mime-type type="application/vnd.oasis.opendocument.text-master"/> | ||
1157 | 37 | <mime-type type="application/vnd.oasis.opendocument.graphics"/> | ||
1158 | 38 | <mime-type type="application/vnd.oasis.opendocument.graphics-template"/> | ||
1159 | 39 | <mime-type type="application/vnd.oasis.opendocument.presentation"/> | ||
1160 | 40 | <mime-type type="application/vnd.oasis.opendocument.presentation-template"/> | ||
1161 | 41 | <mime-type type="application/vnd.oasis.opendocument.spreadsheet"/> | ||
1162 | 42 | <mime-type type="application/vnd.oasis.opendocument.spreadsheet-template"/> | ||
1163 | 43 | <mime-type type="application/vnd.oasis.opendocument.chart"/> | ||
1164 | 44 | <mime-type type="application/vnd.oasis.opendocument.formula"/> | ||
1165 | 45 | <mime-type type="application/vnd.oasis.opendocument.database"/> | ||
1166 | 46 | <mime-type type="application/vnd.oasis.opendocument.image"/> | ||
1167 | 47 | <mime-type type="application/vnd.rn-realmedia"/> | ||
1168 | 48 | <mime-type type="application/vnd.stardivision.calc"/> | ||
1169 | 49 | <mime-type type="application/vnd.stardivision.chart"/> | ||
1170 | 50 | <mime-type type="application/vnd.stardivision.draw"/> | ||
1171 | 51 | <mime-type type="application/vnd.stardivision.impress"/> | ||
1172 | 52 | <mime-type type="application/vnd.stardivision.mail"/> | ||
1173 | 53 | <mime-type type="application/vnd.stardivision.math"/> | ||
1174 | 54 | <mime-type type="application/vnd.stardivision.writer"/> | ||
1175 | 55 | <mime-type type="application/vnd.sun.xml.calc"/> | ||
1176 | 56 | <mime-type type="application/vnd.sun.xml.calc.template"/> | ||
1177 | 57 | <mime-type type="application/vnd.sun.xml.draw"/> | ||
1178 | 58 | <mime-type type="application/vnd.sun.xml.draw.template"/> | ||
1179 | 59 | <mime-type type="application/vnd.sun.xml.impress"/> | ||
1180 | 60 | <mime-type type="application/vnd.sun.xml.impress.template"/> | ||
1181 | 61 | <mime-type type="application/vnd.sun.xml.math"/> | ||
1182 | 62 | <mime-type type="application/vnd.sun.xml.writer"/> | ||
1183 | 63 | <mime-type type="application/vnd.sun.xml.writer.global"/> | ||
1184 | 64 | <mime-type type="application/vnd.sun.xml.writer.template"/> | ||
1185 | 65 | <mime-type type="application/vnd.wordperfect"/> | ||
1186 | 66 | <mime-type type="application/wordperfect"/> | ||
1187 | 67 | <mime-type type="application/x-7z-compressed"/> | ||
1188 | 68 | <mime-type type="application/x-abiword"/> | ||
1189 | 69 | <mime-type type="application/x-amipro"/> | ||
1190 | 70 | <mime-type type="application/x-applix-spreadsheet"/> | ||
1191 | 71 | <mime-type type="application/x-applix-word"/> | ||
1192 | 72 | <mime-type type="application/x-archive"/> | ||
1193 | 73 | <mime-type type="application/x-arj"/> | ||
1194 | 74 | <mime-type type="application/x-asp"/> | ||
1195 | 75 | <mime-type type="application/x-bcpio"/> | ||
1196 | 76 | <mime-type type="application/x-bittorrent"/> | ||
1197 | 77 | <mime-type type="application/x-blender"/> | ||
1198 | 78 | <mime-type type="application/x-bzip"/> | ||
1199 | 79 | <mime-type type="application/x-bzip2"/> | ||
1200 | 80 | <mime-type type="application/x-bzip-compressed-tar"/> | ||
1201 | 81 | <mime-type type="application/x-cd-image"/> | ||
1202 | 82 | <mime-type type="application/x-cgi"/> | ||
1203 | 83 | <mime-type type="application/x-chess-pgn"/> | ||
1204 | 84 | <mime-type type="application/x-chm"/> | ||
1205 | 85 | <mime-type type="application/x-compress"/> | ||
1206 | 86 | <mime-type type="application/x-compressed-tar"/> | ||
1207 | 87 | <mime-type type="application/x-cpio"/> | ||
1208 | 88 | <mime-type type="application/x-cpio-compressed"/> | ||
1209 | 89 | <mime-type type="application/x-dbase"/> | ||
1210 | 90 | <mime-type type="application/x-dbm"/> | ||
1211 | 91 | <mime-type type="application/x-designer"/> | ||
1212 | 92 | <mime-type type="application/x-desktop"/> | ||
1213 | 93 | <mime-type type="application/x-dia-diagram"/> | ||
1214 | 94 | <mime-type type="application/x-dvi"/> | ||
1215 | 95 | <mime-type type="application/x-e-theme"/> | ||
1216 | 96 | <mime-type type="application/x-egon"/> | ||
1217 | 97 | <mime-type type="application/x-excellon"/> | ||
1218 | 98 | <mime-type type="application/x-flash-video"/> | ||
1219 | 99 | <mime-type type="application/x-font"/> | ||
1220 | 100 | <mime-type type="application/x-font-afm"/> | ||
1221 | 101 | <mime-type type="application/x-font-bdf"/> | ||
1222 | 102 | <mime-type type="application/x-font-dos"/> | ||
1223 | 103 | <mime-type type="application/x-font-framemaker"/> | ||
1224 | 104 | <mime-type type="application/x-font-libgrx"/> | ||
1225 | 105 | <mime-type type="application/x-font-linux-psf"/> | ||
1226 | 106 | <mime-type type="application/x-font-otf"/> | ||
1227 | 107 | <mime-type type="application/x-font-pcf"/> | ||
1228 | 108 | <mime-type type="application/x-font-speedo"/> | ||
1229 | 109 | <mime-type type="application/x-font-sunos-news"/> | ||
1230 | 110 | <mime-type type="application/x-font-tex"/> | ||
1231 | 111 | <mime-type type="application/x-font-tex-tfm"/> | ||
1232 | 112 | <mime-type type="application/x-font-ttf"/> | ||
1233 | 113 | <mime-type type="application/x-font-type1"/> | ||
1234 | 114 | <mime-type type="application/x-font-vfont"/> | ||
1235 | 115 | <mime-type type="application/x-frame"/> | ||
1236 | 116 | <mime-type type="application/x-gdbm"/> | ||
1237 | 117 | <mime-type type="application/x-geda-gsch2pcb-project"/> | ||
1238 | 118 | <mime-type type="application/x-geda-schematic"/> | ||
1239 | 119 | <mime-type type="application/x-geda-symbol"/> | ||
1240 | 120 | <mime-type type="application/x-gerber"/> | ||
1241 | 121 | <mime-type type="application/x-gettext-translation"/> | ||
1242 | 122 | <mime-type type="application/x-glade"/> | ||
1243 | 123 | <mime-type type="application/x-gmc-link"/> | ||
1244 | 124 | <mime-type type="application/x-gnome-app-info"/> | ||
1245 | 125 | <mime-type type="application/x-gnucash"/> | ||
1246 | 126 | <mime-type type="application/x-gnumeric"/> | ||
1247 | 127 | <mime-type type="application/x-graphite"/> | ||
1248 | 128 | <mime-type type="application/x-gtar"/> | ||
1249 | 129 | <mime-type type="application/x-gtktalog"/> | ||
1250 | 130 | <mime-type type="application/x-gzip"/> | ||
1251 | 131 | <mime-type type="application/x-gzpostscript"/> | ||
1252 | 132 | <mime-type type="application/x-hdf"/> | ||
1253 | 133 | <mime-type type="application/x-jar"/> | ||
1254 | 134 | <mime-type type="application/x-java"/> | ||
1255 | 135 | <mime-type type="application/x-java-jnlp-file"/> | ||
1256 | 136 | <mime-type type="application/x-jbuilder-project"/> | ||
1257 | 137 | <mime-type type="application/x-karbon"/> | ||
1258 | 138 | <mime-type type="application/x-kchart"/> | ||
1259 | 139 | <mime-type type="application/x-kformula"/> | ||
1260 | 140 | <mime-type type="application/x-killustrator"/> | ||
1261 | 141 | <mime-type type="application/x-kivio"/> | ||
1262 | 142 | <mime-type type="application/x-kontour"/> | ||
1263 | 143 | <mime-type type="application/x-kpovmodeler"/> | ||
1264 | 144 | <mime-type type="application/x-kpresenter"/> | ||
1265 | 145 | <mime-type type="application/x-krita"/> | ||
1266 | 146 | <mime-type type="application/x-kspread"/> | ||
1267 | 147 | <mime-type type="application/x-kspread-crypt"/> | ||
1268 | 148 | <mime-type type="application/x-ksysv-package"/> | ||
1269 | 149 | <mime-type type="application/x-kugar"/> | ||
1270 | 150 | <mime-type type="application/x-kword"/> | ||
1271 | 151 | <mime-type type="application/x-kword-crypt"/> | ||
1272 | 152 | <mime-type type="application/x-lha"/> | ||
1273 | 153 | <mime-type type="application/x-lhz"/> | ||
1274 | 154 | <mime-type type="application/x-linguist"/> | ||
1275 | 155 | <mime-type type="application/x-lyx"/> | ||
1276 | 156 | <mime-type type="application/x-lzop"/> | ||
1277 | 157 | <mime-type type="application/x-magicpoint"/> | ||
1278 | 158 | <mime-type type="application/x-matroska"/> | ||
1279 | 159 | <mime-type type="application/x-mif"/> | ||
1280 | 160 | <mime-type type="application/x-mozilla-bookmarks"/> | ||
1281 | 161 | <mime-type type="application/x-mswinurl"/> | ||
1282 | 162 | <mime-type type="application/x-mswrite"/> | ||
1283 | 163 | <mime-type type="application/x-nautilus-link"/> | ||
1284 | 164 | <mime-type type="application/x-netcdf"/> | ||
1285 | 165 | <mime-type type="application/x-netscape-bookmarks"/> | ||
1286 | 166 | <mime-type type="application/x-netshow-channel"/> | ||
1287 | 167 | <mime-type type="application/x-ogg"/> | ||
1288 | 168 | <mime-type type="application/x-oleo"/> | ||
1289 | 169 | <mime-type type="application/x-palm-database"/> | ||
1290 | 170 | <mime-type type="application/x-pcb-layout"/> | ||
1291 | 171 | <mime-type type="application/x-pcb-footprint"/> | ||
1292 | 172 | <mime-type type="application/x-pcb-netlist"/> | ||
1293 | 173 | <mime-type type="application/x-pdf"/> | ||
1294 | 174 | <mime-type type="application/x-php"/> | ||
1295 | 175 | <mime-type type="application/x-pkcs12"/> | ||
1296 | 176 | <mime-type type="application/x-profile"/> | ||
1297 | 177 | <mime-type type="application/x-pw"/> | ||
1298 | 178 | <mime-type type="application/x-quattropro"/> | ||
1299 | 179 | <mime-type type="application/x-quicktime-media-link"/> | ||
1300 | 180 | <mime-type type="application/x-quicktimeplayer"/> | ||
1301 | 181 | <mime-type type="application/x-qw"/> | ||
1302 | 182 | <mime-type type="application/x-rar"/> | ||
1303 | 183 | <mime-type type="application/x-reject"/> | ||
1304 | 184 | <mime-type type="application/x-rpm"/> | ||
1305 | 185 | <mime-type type="application/x-sc"/> | ||
1306 | 186 | <mime-type type="application/x-shar"/> | ||
1307 | 187 | <mime-type type="application/x-shared-library-la"/> | ||
1308 | 188 | <mime-type type="application/x-shockwave-flash"/> | ||
1309 | 189 | <mime-type type="application/x-siag"/> | ||
1310 | 190 | <mime-type type="application/x-sit"/> | ||
1311 | 191 | <mime-type type="application/x-slp"/> | ||
1312 | 192 | <mime-type type="application/x-smil"/> | ||
1313 | 193 | <mime-type type="application/x-stuffit"/> | ||
1314 | 194 | <mime-type type="application/x-sv4cpio"/> | ||
1315 | 195 | <mime-type type="application/x-sv4crc"/> | ||
1316 | 196 | <mime-type type="application/x-tar"/> | ||
1317 | 197 | <mime-type type="application/x-tarz"/> | ||
1318 | 198 | <mime-type type="application/x-tex-gf"/> | ||
1319 | 199 | <mime-type type="application/x-tex-pk"/> | ||
1320 | 200 | <mime-type type="application/x-tgif"/> | ||
1321 | 201 | <mime-type type="application/x-theme"/> | ||
1322 | 202 | <mime-type type="application/x-toutdoux"/> | ||
1323 | 203 | <mime-type type="application/x-trash"/> | ||
1324 | 204 | <mime-type type="application/x-troff"/> | ||
1325 | 205 | <mime-type type="application/x-troff-man"/> | ||
1326 | 206 | <mime-type type="application/x-troff-man-compressed"/> | ||
1327 | 207 | <mime-type type="application/x-tzo"/> | ||
1328 | 208 | <mime-type type="application/x-ustar"/> | ||
1329 | 209 | <mime-type type="application/x-wais-source"/> | ||
1330 | 210 | <mime-type type="application/x-wordperfect"/> | ||
1331 | 211 | <mime-type type="application/x-wpg"/> | ||
1332 | 212 | <mime-type type="application/x-x509-ca-cert"/> | ||
1333 | 213 | <mime-type type="application/x-xbel"/> | ||
1334 | 214 | <mime-type type="application/x-zerosize"/> | ||
1335 | 215 | <mime-type type="application/x-zip-compressed"/> | ||
1336 | 216 | <mime-type type="application/x-zoo"/> | ||
1337 | 217 | <mime-type type="application/xhtml+xml"/> | ||
1338 | 218 | <mime-type type="application/zip"/> | ||
1339 | 219 | <mime-type type="audio/ac3"/> | ||
1340 | 220 | <mime-type type="audio/AMR"/> | ||
1341 | 221 | <mime-type type="audio/AMR-WB"/> | ||
1342 | 222 | <mime-type type="audio/basic"/> | ||
1343 | 223 | <mime-type type="audio/midi"/> | ||
1344 | 224 | <mime-type type="audio/mpeg"/> | ||
1345 | 225 | <mime-type type="audio/mpegurl"/> | ||
1346 | 226 | <mime-type type="audio/ogg"/> | ||
1347 | 227 | <mime-type type="audio/playlist"/> | ||
1348 | 228 | <mime-type type="audio/prs.sid"/> | ||
1349 | 229 | <mime-type type="audio/vnd.rn-realaudio"/> | ||
1350 | 230 | <mime-type type="audio/vnd.wave"/> | ||
1351 | 231 | <mime-type type="audio/x-vorbis"/> | ||
1352 | 232 | <mime-type type="audio/wav"/> | ||
1353 | 233 | <mime-type type="audio/x-adpcm"/> | ||
1354 | 234 | <mime-type type="audio/x-aifc"/> | ||
1355 | 235 | <mime-type type="audio/x-aiff"/> | ||
1356 | 236 | <mime-type type="audio/x-aiffc"/> | ||
1357 | 237 | <mime-type type="audio/x-ape"/> | ||
1358 | 238 | <mime-type type="audio/x-flac"/> | ||
1359 | 239 | <mime-type type="audio/x-it"/> | ||
1360 | 240 | <mime-type type="audio/x-m4a"/> | ||
1361 | 241 | <mime-type type="audio/x-matroska"/> | ||
1362 | 242 | <mime-type type="audio/x-midi"/> | ||
1363 | 243 | <mime-type type="audio/x-mod"/> | ||
1364 | 244 | <mime-type type="audio/x-mp3"/> | ||
1365 | 245 | <mime-type type="audio/x-mp3-playlist"/> | ||
1366 | 246 | <mime-type type="audio/x-mpeg"/> | ||
1367 | 247 | <mime-type type="audio/x-mpegurl"/> | ||
1368 | 248 | <mime-type type="audio/x-ms-asx"/> | ||
1369 | 249 | <mime-type type="audio/x-ms-wax"/> | ||
1370 | 250 | <mime-type type="audio/x-musepack"/> | ||
1371 | 251 | <mime-type type="audio/x-pn-realaudio"/> | ||
1372 | 252 | <mime-type type="audio/x-pn-realaudio-plugin"/> | ||
1373 | 253 | <mime-type type="audio/x-realaudio"/> | ||
1374 | 254 | <mime-type type="audio/x-real-audio"/> | ||
1375 | 255 | <mime-type type="audio/x-riff"/> | ||
1376 | 256 | <mime-type type="audio/x-s3m"/> | ||
1377 | 257 | <mime-type type="audio/x-sbc"/> | ||
1378 | 258 | <mime-type type="audio/x-scpls"/> | ||
1379 | 259 | <mime-type type="audio/x-stm"/> | ||
1380 | 260 | <mime-type type="audio/x-tta"/> | ||
1381 | 261 | <mime-type type="audio/x-voc"/> | ||
1382 | 262 | <mime-type type="audio/x-wav"/> | ||
1383 | 263 | <mime-type type="audio/x-wavpack"/> | ||
1384 | 264 | <mime-type type="audio/x-xi"/> | ||
1385 | 265 | <mime-type type="audio/x-xm"/> | ||
1386 | 266 | <mime-type type="image/bmp"/> | ||
1387 | 267 | <mime-type type="image/cgm"/> | ||
1388 | 268 | <mime-type type="image/dpx"/> | ||
1389 | 269 | <mime-type type="image/fax-g3"/> | ||
1390 | 270 | <mime-type type="image/g3fax"/> | ||
1391 | 271 | <mime-type type="image/gif"/> | ||
1392 | 272 | <mime-type type="image/ief"/> | ||
1393 | 273 | <mime-type type="image/jpeg"/> | ||
1394 | 274 | <mime-type type="image/jpeg2000"/> | ||
1395 | 275 | <mime-type type="image/png"/> | ||
1396 | 276 | <mime-type type="image/rle"/> | ||
1397 | 277 | <mime-type type="image/svg+xml"/> | ||
1398 | 278 | <mime-type type="image/tiff"/> | ||
1399 | 279 | <mime-type type="image/vnd.djvu"/> | ||
1400 | 280 | <mime-type type="image/vnd.dwg"/> | ||
1401 | 281 | <mime-type type="image/vnd.dxf"/> | ||
1402 | 282 | <mime-type type="image/x-3ds"/> | ||
1403 | 283 | <mime-type type="image/x-applix-graphics"/> | ||
1404 | 284 | <mime-type type="image/x-cmu-raster"/> | ||
1405 | 285 | <mime-type type="image/x-compressed-xcf"/> | ||
1406 | 286 | <mime-type type="image/x-dcm"/> | ||
1407 | 287 | <mime-type type="image/x-dib"/> | ||
1408 | 288 | <mime-type type="image/x-djvu"/> | ||
1409 | 289 | <mime-type type="image/x-eps"/> | ||
1410 | 290 | <mime-type type="image/x-fits"/> | ||
1411 | 291 | <mime-type type="image/x-fpx"/> | ||
1412 | 292 | <mime-type type="image/x-icb"/> | ||
1413 | 293 | <mime-type type="image/x-ico"/> | ||
1414 | 294 | <mime-type type="image/x-iff"/> | ||
1415 | 295 | <mime-type type="image/x-ilbm"/> | ||
1416 | 296 | <mime-type type="image/x-jng"/> | ||
1417 | 297 | <mime-type type="image/x-lwo"/> | ||
1418 | 298 | <mime-type type="image/x-lws"/> | ||
1419 | 299 | <mime-type type="image/x-msod"/> | ||
1420 | 300 | <mime-type type="image/x-niff"/> | ||
1421 | 301 | <mime-type type="image/x-pcx"/> | ||
1422 | 302 | <mime-type type="image/x-photo-cd"/> | ||
1423 | 303 | <mime-type type="image/x-pict"/> | ||
1424 | 304 | <mime-type type="image/x-png"/> | ||
1425 | 305 | <mime-type type="image/x-portable-anymap"/> | ||
1426 | 306 | <mime-type type="image/x-portable-bitmap"/> | ||
1427 | 307 | <mime-type type="image/x-portable-graymap"/> | ||
1428 | 308 | <mime-type type="image/x-portable-pixmap"/> | ||
1429 | 309 | <mime-type type="image/x-psd"/> | ||
1430 | 310 | <mime-type type="image/x-rgb"/> | ||
1431 | 311 | <mime-type type="image/x-sgi"/> | ||
1432 | 312 | <mime-type type="image/x-sun-raster"/> | ||
1433 | 313 | <mime-type type="image/x-tga"/> | ||
1434 | 314 | <mime-type type="image/x-win-bitmap"/> | ||
1435 | 315 | <mime-type type="image/x-wmf"/> | ||
1436 | 316 | <mime-type type="image/x-xbitmap"/> | ||
1437 | 317 | <mime-type type="image/x-xcf"/> | ||
1438 | 318 | <mime-type type="image/x-xfig"/> | ||
1439 | 319 | <mime-type type="image/x-xpixmap"/> | ||
1440 | 320 | <mime-type type="image/x-xwindowdump"/> | ||
1441 | 321 | <mime-type type="message/delivery-status"/> | ||
1442 | 322 | <mime-type type="message/disposition-notification"/> | ||
1443 | 323 | <mime-type type="message/external-body"/> | ||
1444 | 324 | <mime-type type="message/news"/> | ||
1445 | 325 | <mime-type type="message/partial"/> | ||
1446 | 326 | <mime-type type="message/rfc822"/> | ||
1447 | 327 | <mime-type type="message/x-gnu-rmail"/> | ||
1448 | 328 | <mime-type type="model/vrml"/> | ||
1449 | 329 | <mime-type type="multipart/alternative"/> | ||
1450 | 330 | <mime-type type="multipart/appledouble"/> | ||
1451 | 331 | <mime-type type="multipart/digest"/> | ||
1452 | 332 | <mime-type type="multipart/encrypted"/> | ||
1453 | 333 | <mime-type type="multipart/mixed"/> | ||
1454 | 334 | <mime-type type="multipart/related"/> | ||
1455 | 335 | <mime-type type="multipart/report"/> | ||
1456 | 336 | <mime-type type="multipart/signed"/> | ||
1457 | 337 | <mime-type type="multipart/x-mixed-replace"/> | ||
1458 | 338 | <mime-type type="text/calendar"/> | ||
1459 | 339 | <mime-type type="text/css"/> | ||
1460 | 340 | <mime-type type="text/csv"/> | ||
1461 | 341 | <mime-type type="text/directory"/> | ||
1462 | 342 | <mime-type type="text/enriched"/> | ||
1463 | 343 | <mime-type type="text/google-video-pointer"/> | ||
1464 | 344 | <mime-type type="text/html"/> | ||
1465 | 345 | <mime-type type="text/htmlh"/> | ||
1466 | 346 | <mime-type type="text/mathml"/> | ||
1467 | 347 | <mime-type type="text/plain"/> | ||
1468 | 348 | <mime-type type="text/rdf"/> | ||
1469 | 349 | <mime-type type="text/rfc822-headers"/> | ||
1470 | 350 | <mime-type type="text/richtext"/> | ||
1471 | 351 | <mime-type type="text/rss"/> | ||
1472 | 352 | <mime-type type="text/rtf"/> | ||
1473 | 353 | <mime-type type="text/sgml"/> | ||
1474 | 354 | <mime-type type="text/spreadsheet"/> | ||
1475 | 355 | <mime-type type="text/tab-separated-values"/> | ||
1476 | 356 | <mime-type type="text/vnd.wap.wml"/> | ||
1477 | 357 | <mime-type type="text/x-adasrc"/> | ||
1478 | 358 | <mime-type type="text/x-authors"/> | ||
1479 | 359 | <mime-type type="text/x-bibtex"/> | ||
1480 | 360 | <mime-type type="text/x-c++hdr"/> | ||
1481 | 361 | <mime-type type="text/x-c++src"/> | ||
1482 | 362 | <mime-type type="text/x-chdr"/> | ||
1483 | 363 | <mime-type type="text/x-comma-separated-values"/> | ||
1484 | 364 | <mime-type type="text/x-copying"/> | ||
1485 | 365 | <mime-type type="text/x-credits"/> | ||
1486 | 366 | <mime-type type="text/x-csharp"/> | ||
1487 | 367 | <mime-type type="text/x-csrc"/> | ||
1488 | 368 | <mime-type type="text/x-dcl"/> | ||
1489 | 369 | <mime-type type="text/x-diff"/> | ||
1490 | 370 | <mime-type type="text/x-dsl"/> | ||
1491 | 371 | <mime-type type="text/x-dsrc"/> | ||
1492 | 372 | <mime-type type="text/x-dtd"/> | ||
1493 | 373 | <mime-type type="text/x-emacs-lisp"/> | ||
1494 | 374 | <mime-type type="text/x-fortran"/> | ||
1495 | 375 | <mime-type type="text/x-gettext-translation"/> | ||
1496 | 376 | <mime-type type="text/x-gettext-translation-template"/> | ||
1497 | 377 | <mime-type type="text/x-google-video-pointer"/> | ||
1498 | 378 | <mime-type type="text/x-gtkrc"/> | ||
1499 | 379 | <mime-type type="text/x-haskell"/> | ||
1500 | 380 | <mime-type type="text/x-idl"/> | ||
1501 | 381 | <mime-type type="text/x-install"/> | ||
1502 | 382 | <mime-type type="text/x-java"/> | ||
1503 | 383 | <mime-type type="text/x-ksysv-log"/> | ||
1504 | 384 | <mime-type type="text/x-literate-haskell"/> | ||
1505 | 385 | <mime-type type="text/x-log"/> | ||
1506 | 386 | <mime-type type="text/x-makefile"/> | ||
1507 | 387 | <mime-type type="text/x-moc"/> | ||
1508 | 388 | <mime-type type="text/x-objcsrc"/> | ||
1509 | 389 | <mime-type type="text/x-pascal"/> | ||
1510 | 390 | <mime-type type="text/x-patch"/> | ||
1511 | 391 | <mime-type type="text/x-python"/> | ||
1512 | 392 | <mime-type type="text/x-readme"/> | ||
1513 | 393 | <mime-type type="text/x-scheme"/> | ||
1514 | 394 | <mime-type type="text/x-setext"/> | ||
1515 | 395 | <mime-type type="text/x-speech"/> | ||
1516 | 396 | <mime-type type="text/x-sql"/> | ||
1517 | 397 | <mime-type type="text/x-tcl"/> | ||
1518 | 398 | <mime-type type="text/x-tex"/> | ||
1519 | 399 | <mime-type type="text/x-texinfo"/> | ||
1520 | 400 | <mime-type type="text/x-troff-me"/> | ||
1521 | 401 | <mime-type type="text/x-troff-mm"/> | ||
1522 | 402 | <mime-type type="text/x-troff-ms"/> | ||
1523 | 403 | <mime-type type="text/x-uil"/> | ||
1524 | 404 | <mime-type type="text/x-uri"/> | ||
1525 | 405 | <mime-type type="text/x-vcalendar"/> | ||
1526 | 406 | <mime-type type="text/x-vcard"/> | ||
1527 | 407 | <mime-type type="text/x-xmi"/> | ||
1528 | 408 | <mime-type type="text/x-xslfo"/> | ||
1529 | 409 | <mime-type type="text/x-xslt"/> | ||
1530 | 410 | <mime-type type="text/xmcd"/> | ||
1531 | 411 | <mime-type type="text/xml"/> | ||
1532 | 412 | <mime-type type="video/flv"/> | ||
1533 | 413 | <mime-type type="video/isivideo"/> | ||
1534 | 414 | <mime-type type="video/mp4"/> | ||
1535 | 415 | <mime-type type="video/mpeg"/> | ||
1536 | 416 | <mime-type type="video/quicktime"/> | ||
1537 | 417 | <mime-type type="video/vivo"/> | ||
1538 | 418 | <mime-type type="video/wavelet"/> | ||
1539 | 419 | <mime-type type="video/x-anim"/> | ||
1540 | 420 | <mime-type type="video/x-avi"/> | ||
1541 | 421 | <mime-type type="video/x-flic"/> | ||
1542 | 422 | <mime-type type="video/x-flv"/> | ||
1543 | 423 | <mime-type type="video/x-m4v"/> | ||
1544 | 424 | <mime-type type="video/x-matroska"/> | ||
1545 | 425 | <mime-type type="video/x-mng"/> | ||
1546 | 426 | <mime-type type="video/x-ms-asf"/> | ||
1547 | 427 | <mime-type type="video/x-ms-asf-plugin"/> | ||
1548 | 428 | <mime-type type="video/x-ms-wmv"/> | ||
1549 | 429 | <mime-type type="video/x-ms-wvx"/> | ||
1550 | 430 | <mime-type type="video/x-msvideo"/> | ||
1551 | 431 | <mime-type type="video/x-nsv"/> | ||
1552 | 432 | <mime-type type="video/x-ogm+ogg"/> | ||
1553 | 433 | <mime-type type="video/x-real-video"/> | ||
1554 | 434 | <mime-type type="video/x-theora+ogg"/> | ||
1555 | 435 | <mime-type type="video/x-sgi-movie"/> | ||
1556 | 436 | </safe> | ||
1557 | 437 | <unsafe> | ||
1558 | 438 | <mime-type type="application/mac-binhex40"/> | ||
1559 | 439 | <mime-type type="application/vnd.hp-hpgl"/> | ||
1560 | 440 | <mime-type type="application/vnd.hp-pcl"/> | ||
1561 | 441 | <mime-type type="application/vnd.mozilla.xul+xml"/> | ||
1562 | 442 | <mime-type type="application/vnd.palm"/> | ||
1563 | 443 | <mime-type type="application/x-arc"/> | ||
1564 | 444 | <mime-type type="application/x-awk"/> | ||
1565 | 445 | <mime-type type="application/x-class-file"/> | ||
1566 | 446 | <mime-type type="application/x-core"/> | ||
1567 | 447 | <mime-type type="application/x-csh"/> | ||
1568 | 448 | <mime-type type="application/x-dc-rom"/> | ||
1569 | 449 | <mime-type type="application/x-deb"/> | ||
1570 | 450 | <mime-type type="application/x-executable"/> | ||
1571 | 451 | <mime-type type="application/x-gameboy-rom"/> | ||
1572 | 452 | <mime-type type="application/x-genesis-rom"/> | ||
1573 | 453 | <mime-type type="application/x-ipod-firmware"/> | ||
1574 | 454 | <mime-type type="application/x-javascript"/> | ||
1575 | 455 | <mime-type type="application/x-macbinary"/> | ||
1576 | 456 | <mime-type type="application/x-mplayer2"/> | ||
1577 | 457 | <mime-type type="application/x-ms-dos-executable"/> | ||
1578 | 458 | <mime-type type="application/x-msx-rom"/> | ||
1579 | 459 | <mime-type type="application/x-n64-rom"/> | ||
1580 | 460 | <mime-type type="application/x-nes-rom"/> | ||
1581 | 461 | <mime-type type="application/x-object"/> | ||
1582 | 462 | <mime-type type="application/x-ole-storage"/> | ||
1583 | 463 | <mime-type type="application/x-par2"/> | ||
1584 | 464 | <mime-type type="application/x-pef-executable"/> | ||
1585 | 465 | <mime-type type="application/x-perl"/> | ||
1586 | 466 | <mime-type type="application/x-python"/> | ||
1587 | 467 | <mime-type type="application/x-python-bytecode"/> | ||
1588 | 468 | <mime-type type="application/x-ruby"/> | ||
1589 | 469 | <mime-type type="application/x-sharedlib"/> | ||
1590 | 470 | <mime-type type="application/x-shellscript"/> | ||
1591 | 471 | <mime-type type="application/x-sms-rom"/> | ||
1592 | 472 | <mime-type type="application/x-xpinstall"/> | ||
1593 | 473 | <mime-type type="inode/blockdevice"/> | ||
1594 | 474 | <mime-type type="inode/chardevice"/> | ||
1595 | 475 | <mime-type type="inode/directory"/> | ||
1596 | 476 | <mime-type type="inode/fifo"/> | ||
1597 | 477 | <mime-type type="inode/mount-point"/> | ||
1598 | 478 | <mime-type type="inode/socket"/> | ||
1599 | 479 | <mime-type type="inode/symlink"/> | ||
1600 | 480 | <mime-type type="text/x-ksh"/> | ||
1601 | 481 | </unsafe> | ||
1602 | 482 | </mime-types-permissions> | ||
1603 | 483 | 0 | ||
1604 | === added directory '.pc/81_ubuntu_force_update_bookmarks_menu.patch' | |||
1605 | === removed directory '.pc/81_ubuntu_force_update_bookmarks_menu.patch' | |||
1606 | === added file '.pc/81_ubuntu_force_update_bookmarks_menu.patch/.timestamp' | |||
1607 | === added directory '.pc/81_ubuntu_force_update_bookmarks_menu.patch/src' | |||
1608 | === removed directory '.pc/81_ubuntu_force_update_bookmarks_menu.patch/src' | |||
1609 | === added directory '.pc/81_ubuntu_force_update_bookmarks_menu.patch/src/bookmarks' | |||
1610 | === removed directory '.pc/81_ubuntu_force_update_bookmarks_menu.patch/src/bookmarks' | |||
1611 | === added file '.pc/81_ubuntu_force_update_bookmarks_menu.patch/src/bookmarks/ephy-bookmarks-ui.c' | |||
1612 | --- .pc/81_ubuntu_force_update_bookmarks_menu.patch/src/bookmarks/ephy-bookmarks-ui.c 1970-01-01 00:00:00 +0000 | |||
1613 | +++ .pc/81_ubuntu_force_update_bookmarks_menu.patch/src/bookmarks/ephy-bookmarks-ui.c 2015-07-11 21:08:34 +0000 | |||
1614 | @@ -0,0 +1,363 @@ | |||
1615 | 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ | ||
1616 | 2 | /* | ||
1617 | 3 | * Copyright © 2005 Peter Harvey | ||
1618 | 4 | * Copyright © 2006 Christian Persch | ||
1619 | 5 | * | ||
1620 | 6 | * This program is free software; you can redistribute it and/or modify | ||
1621 | 7 | * it under the terms of the GNU General Public License as published by | ||
1622 | 8 | * the Free Software Foundation; either version 2, or (at your option) | ||
1623 | 9 | * any later version. | ||
1624 | 10 | * | ||
1625 | 11 | * This program is distributed in the hope that it will be useful, | ||
1626 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1627 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1628 | 14 | * GNU General Public License for more details. | ||
1629 | 15 | * | ||
1630 | 16 | * You should have received a copy of the GNU General Public License | ||
1631 | 17 | * along with this program; if not, write to the Free Software | ||
1632 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
1633 | 19 | * | ||
1634 | 20 | */ | ||
1635 | 21 | |||
1636 | 22 | #include "config.h" | ||
1637 | 23 | #include "ephy-bookmarks-ui.h" | ||
1638 | 24 | |||
1639 | 25 | #include "ephy-bookmark-action-group.h" | ||
1640 | 26 | #include "ephy-bookmark-action.h" | ||
1641 | 27 | #include "ephy-bookmark-properties.h" | ||
1642 | 28 | #include "ephy-bookmarks-menu.h" | ||
1643 | 29 | #include "ephy-bookmarks.h" | ||
1644 | 30 | #include "ephy-debug.h" | ||
1645 | 31 | #include "ephy-dnd.h" | ||
1646 | 32 | #include "ephy-embed-shell.h" | ||
1647 | 33 | #include "ephy-file-helpers.h" | ||
1648 | 34 | #include "ephy-gui.h" | ||
1649 | 35 | #include "ephy-link.h" | ||
1650 | 36 | #include "ephy-node-common.h" | ||
1651 | 37 | #include "ephy-open-tabs-action.h" | ||
1652 | 38 | #include "ephy-prefs.h" | ||
1653 | 39 | #include "ephy-settings.h" | ||
1654 | 40 | #include "ephy-shell.h" | ||
1655 | 41 | #include "ephy-string.h" | ||
1656 | 42 | #include "ephy-topic-action-group.h" | ||
1657 | 43 | #include "ephy-topic-action.h" | ||
1658 | 44 | |||
1659 | 45 | #include <string.h> | ||
1660 | 46 | #include <glib/gi18n.h> | ||
1661 | 47 | #include <gtk/gtk.h> | ||
1662 | 48 | |||
1663 | 49 | #define BM_WINDOW_DATA_KEY "bookmarks-window-data" | ||
1664 | 50 | |||
1665 | 51 | typedef struct | ||
1666 | 52 | { | ||
1667 | 53 | guint bookmarks_menu; | ||
1668 | 54 | guint toolbar_menu; | ||
1669 | 55 | } BookmarksWindowData; | ||
1670 | 56 | |||
1671 | 57 | enum | ||
1672 | 58 | { | ||
1673 | 59 | RESPONSE_SHOW_PROPERTIES = 1, | ||
1674 | 60 | RESPONSE_NEW_BOOKMARK = 2 | ||
1675 | 61 | }; | ||
1676 | 62 | |||
1677 | 63 | static GString * bookmarks_menu_string = 0; | ||
1678 | 64 | static GHashTable *properties_dialogs = 0; | ||
1679 | 65 | |||
1680 | 66 | static GtkAction * | ||
1681 | 67 | find_action (GtkUIManager *manager, const char *name) | ||
1682 | 68 | { | ||
1683 | 69 | GList *l = gtk_ui_manager_get_action_groups (manager); | ||
1684 | 70 | GtkAction *action; | ||
1685 | 71 | |||
1686 | 72 | while (l != NULL) | ||
1687 | 73 | { | ||
1688 | 74 | action = gtk_action_group_get_action (GTK_ACTION_GROUP (l->data), name); | ||
1689 | 75 | if (action) return action; | ||
1690 | 76 | l = l->next; | ||
1691 | 77 | } | ||
1692 | 78 | |||
1693 | 79 | return NULL; | ||
1694 | 80 | } | ||
1695 | 81 | |||
1696 | 82 | static void | ||
1697 | 83 | activate_bookmarks_menu (GtkAction *action, EphyWindow *window) | ||
1698 | 84 | { | ||
1699 | 85 | BookmarksWindowData *data = g_object_get_data (G_OBJECT (window), BM_WINDOW_DATA_KEY); | ||
1700 | 86 | if (data && !data->bookmarks_menu) | ||
1701 | 87 | { | ||
1702 | 88 | GtkUIManager *manager = ephy_window_get_ui_manager (window); | ||
1703 | 89 | gtk_ui_manager_ensure_update (manager); | ||
1704 | 90 | |||
1705 | 91 | if (!bookmarks_menu_string->len) | ||
1706 | 92 | { | ||
1707 | 93 | g_string_append (bookmarks_menu_string, | ||
1708 | 94 | "<ui><popup name=\"PagePopup\" action=\"PagePopupAction\"><menu name=\"BookmarksMenu\" action=\"Bookmarks\">"); | ||
1709 | 95 | ephy_bookmarks_menu_build (bookmarks_menu_string, 0); | ||
1710 | 96 | g_string_append (bookmarks_menu_string, "</menu></popup></ui>"); | ||
1711 | 97 | } | ||
1712 | 98 | |||
1713 | 99 | data->bookmarks_menu = gtk_ui_manager_add_ui_from_string | ||
1714 | 100 | (manager, bookmarks_menu_string->str, bookmarks_menu_string->len, 0); | ||
1715 | 101 | |||
1716 | 102 | gtk_ui_manager_ensure_update (manager); | ||
1717 | 103 | } | ||
1718 | 104 | } | ||
1719 | 105 | |||
1720 | 106 | static void | ||
1721 | 107 | erase_bookmarks_menu (EphyWindow *window) | ||
1722 | 108 | { | ||
1723 | 109 | BookmarksWindowData *data; | ||
1724 | 110 | GtkUIManager *manager; | ||
1725 | 111 | |||
1726 | 112 | manager = ephy_window_get_ui_manager (window); | ||
1727 | 113 | data = g_object_get_data (G_OBJECT (window), BM_WINDOW_DATA_KEY); | ||
1728 | 114 | |||
1729 | 115 | if (data != NULL && data->bookmarks_menu != 0) | ||
1730 | 116 | { | ||
1731 | 117 | gtk_ui_manager_remove_ui (manager, data->bookmarks_menu); | ||
1732 | 118 | data->bookmarks_menu = 0; | ||
1733 | 119 | } | ||
1734 | 120 | |||
1735 | 121 | g_string_truncate (bookmarks_menu_string, 0); | ||
1736 | 122 | } | ||
1737 | 123 | |||
1738 | 124 | static void | ||
1739 | 125 | tree_changed_cb (EphyBookmarks *bookmarks, | ||
1740 | 126 | EphyWindow *window) | ||
1741 | 127 | { | ||
1742 | 128 | erase_bookmarks_menu (window); | ||
1743 | 129 | } | ||
1744 | 130 | |||
1745 | 131 | static void | ||
1746 | 132 | node_added_cb (EphyNode *parent, | ||
1747 | 133 | EphyNode *child, | ||
1748 | 134 | EphyWindow *window) | ||
1749 | 135 | { | ||
1750 | 136 | erase_bookmarks_menu (window); | ||
1751 | 137 | } | ||
1752 | 138 | |||
1753 | 139 | static void | ||
1754 | 140 | node_changed_cb (EphyNode *parent, | ||
1755 | 141 | EphyNode *child, | ||
1756 | 142 | guint property_id, | ||
1757 | 143 | EphyWindow *window) | ||
1758 | 144 | { | ||
1759 | 145 | if (property_id == EPHY_NODE_KEYWORD_PROP_NAME || | ||
1760 | 146 | property_id == EPHY_NODE_BMK_PROP_TITLE) | ||
1761 | 147 | { | ||
1762 | 148 | erase_bookmarks_menu (window); | ||
1763 | 149 | } | ||
1764 | 150 | } | ||
1765 | 151 | |||
1766 | 152 | static void | ||
1767 | 153 | node_removed_cb (EphyNode *parent, | ||
1768 | 154 | EphyNode *child, | ||
1769 | 155 | guint index, | ||
1770 | 156 | EphyWindow *window) | ||
1771 | 157 | { | ||
1772 | 158 | erase_bookmarks_menu (window); | ||
1773 | 159 | } | ||
1774 | 160 | |||
1775 | 161 | void | ||
1776 | 162 | ephy_bookmarks_ui_attach_window (EphyWindow *window) | ||
1777 | 163 | { | ||
1778 | 164 | EphyBookmarks *eb; | ||
1779 | 165 | EphyNode *bookmarks; | ||
1780 | 166 | EphyNode *topics; | ||
1781 | 167 | BookmarksWindowData *data; | ||
1782 | 168 | GtkUIManager *manager; | ||
1783 | 169 | GtkActionGroup *actions; | ||
1784 | 170 | GtkAction *action; | ||
1785 | 171 | |||
1786 | 172 | eb = ephy_shell_get_bookmarks (ephy_shell_get_default ()); | ||
1787 | 173 | bookmarks = ephy_bookmarks_get_bookmarks (eb); | ||
1788 | 174 | topics = ephy_bookmarks_get_keywords (eb); | ||
1789 | 175 | data = g_object_get_data (G_OBJECT (window), BM_WINDOW_DATA_KEY); | ||
1790 | 176 | g_return_if_fail (data == NULL); | ||
1791 | 177 | |||
1792 | 178 | manager = ephy_window_get_ui_manager (window); | ||
1793 | 179 | |||
1794 | 180 | data = g_new0 (BookmarksWindowData, 1); | ||
1795 | 181 | g_object_set_data_full (G_OBJECT (window), BM_WINDOW_DATA_KEY, data, g_free); | ||
1796 | 182 | |||
1797 | 183 | /* Create the self-maintaining action groups for bookmarks and topics */ | ||
1798 | 184 | actions = ephy_bookmark_group_new (bookmarks); | ||
1799 | 185 | gtk_ui_manager_insert_action_group (manager, actions, -1); | ||
1800 | 186 | g_signal_connect_object (actions, "open-link", | ||
1801 | 187 | G_CALLBACK (ephy_link_open), G_OBJECT (window), | ||
1802 | 188 | G_CONNECT_SWAPPED | G_CONNECT_AFTER); | ||
1803 | 189 | g_object_unref (actions); | ||
1804 | 190 | |||
1805 | 191 | actions = ephy_topic_action_group_new (topics, manager); | ||
1806 | 192 | gtk_ui_manager_insert_action_group (manager, actions, -1); | ||
1807 | 193 | g_object_unref (actions); | ||
1808 | 194 | |||
1809 | 195 | actions = ephy_open_tabs_group_new (topics); | ||
1810 | 196 | gtk_ui_manager_insert_action_group (manager, actions, -1); | ||
1811 | 197 | g_signal_connect_object (actions, "open-link", | ||
1812 | 198 | G_CALLBACK (ephy_link_open), G_OBJECT (window), | ||
1813 | 199 | G_CONNECT_SWAPPED | G_CONNECT_AFTER); | ||
1814 | 200 | g_object_unref (actions); | ||
1815 | 201 | |||
1816 | 202 | /* Add signal handlers for the bookmark database */ | ||
1817 | 203 | ephy_node_signal_connect_object (bookmarks, EPHY_NODE_CHILD_ADDED, | ||
1818 | 204 | (EphyNodeCallback)node_added_cb, | ||
1819 | 205 | G_OBJECT (window)); | ||
1820 | 206 | ephy_node_signal_connect_object (topics, EPHY_NODE_CHILD_ADDED, | ||
1821 | 207 | (EphyNodeCallback)node_added_cb, | ||
1822 | 208 | G_OBJECT (window)); | ||
1823 | 209 | |||
1824 | 210 | ephy_node_signal_connect_object (bookmarks, EPHY_NODE_CHILD_REMOVED, | ||
1825 | 211 | (EphyNodeCallback)node_removed_cb, | ||
1826 | 212 | G_OBJECT (window)); | ||
1827 | 213 | ephy_node_signal_connect_object (topics, EPHY_NODE_CHILD_REMOVED, | ||
1828 | 214 | (EphyNodeCallback)node_removed_cb, | ||
1829 | 215 | G_OBJECT (window)); | ||
1830 | 216 | |||
1831 | 217 | ephy_node_signal_connect_object (bookmarks, EPHY_NODE_CHILD_CHANGED, | ||
1832 | 218 | (EphyNodeCallback)node_changed_cb, | ||
1833 | 219 | G_OBJECT (window)); | ||
1834 | 220 | ephy_node_signal_connect_object (topics, EPHY_NODE_CHILD_CHANGED, | ||
1835 | 221 | (EphyNodeCallback)node_changed_cb, | ||
1836 | 222 | G_OBJECT (window)); | ||
1837 | 223 | |||
1838 | 224 | g_signal_connect_object (eb, "tree_changed", | ||
1839 | 225 | G_CALLBACK (tree_changed_cb), | ||
1840 | 226 | G_OBJECT (window), 0); | ||
1841 | 227 | |||
1842 | 228 | /* Setup empty menu strings and add signal handlers to build the menus on demand */ | ||
1843 | 229 | if (!bookmarks_menu_string) | ||
1844 | 230 | bookmarks_menu_string = g_string_new (""); | ||
1845 | 231 | |||
1846 | 232 | action = find_action (manager, "Bookmarks"); | ||
1847 | 233 | g_signal_connect_object (action, "activate", | ||
1848 | 234 | G_CALLBACK (activate_bookmarks_menu), | ||
1849 | 235 | G_OBJECT (window), 0); | ||
1850 | 236 | } | ||
1851 | 237 | |||
1852 | 238 | void | ||
1853 | 239 | ephy_bookmarks_ui_detach_window (EphyWindow *window) | ||
1854 | 240 | { | ||
1855 | 241 | EphyBookmarks *eb = ephy_shell_get_bookmarks (ephy_shell_get_default ()); | ||
1856 | 242 | EphyNode *bookmarks = ephy_bookmarks_get_bookmarks (eb); | ||
1857 | 243 | EphyNode *topics = ephy_bookmarks_get_keywords (eb); | ||
1858 | 244 | |||
1859 | 245 | BookmarksWindowData *data = g_object_get_data (G_OBJECT (window), BM_WINDOW_DATA_KEY); | ||
1860 | 246 | GtkUIManager *manager = ephy_window_get_ui_manager (window); | ||
1861 | 247 | GtkAction *action; | ||
1862 | 248 | |||
1863 | 249 | g_return_if_fail (data != 0); | ||
1864 | 250 | |||
1865 | 251 | if (data->bookmarks_menu) | ||
1866 | 252 | gtk_ui_manager_remove_ui (manager, data->bookmarks_menu); | ||
1867 | 253 | |||
1868 | 254 | g_object_set_data (G_OBJECT (window), BM_WINDOW_DATA_KEY, 0); | ||
1869 | 255 | |||
1870 | 256 | ephy_node_signal_disconnect_object (bookmarks, EPHY_NODE_CHILD_ADDED, | ||
1871 | 257 | (EphyNodeCallback)node_added_cb, | ||
1872 | 258 | G_OBJECT (window)); | ||
1873 | 259 | ephy_node_signal_disconnect_object (topics, EPHY_NODE_CHILD_ADDED, | ||
1874 | 260 | (EphyNodeCallback)node_added_cb, | ||
1875 | 261 | G_OBJECT (window)); | ||
1876 | 262 | |||
1877 | 263 | ephy_node_signal_disconnect_object (bookmarks, EPHY_NODE_CHILD_REMOVED, | ||
1878 | 264 | (EphyNodeCallback)node_removed_cb, | ||
1879 | 265 | G_OBJECT (window)); | ||
1880 | 266 | ephy_node_signal_disconnect_object (topics, EPHY_NODE_CHILD_REMOVED, | ||
1881 | 267 | (EphyNodeCallback)node_removed_cb, | ||
1882 | 268 | G_OBJECT (window)); | ||
1883 | 269 | |||
1884 | 270 | ephy_node_signal_disconnect_object (bookmarks, EPHY_NODE_CHILD_CHANGED, | ||
1885 | 271 | (EphyNodeCallback)node_changed_cb, | ||
1886 | 272 | G_OBJECT (window)); | ||
1887 | 273 | ephy_node_signal_disconnect_object (topics, EPHY_NODE_CHILD_CHANGED, | ||
1888 | 274 | (EphyNodeCallback)node_changed_cb, | ||
1889 | 275 | G_OBJECT (window)); | ||
1890 | 276 | |||
1891 | 277 | g_signal_handlers_disconnect_by_func | ||
1892 | 278 | (G_OBJECT (eb), G_CALLBACK (tree_changed_cb), G_OBJECT (window)); | ||
1893 | 279 | |||
1894 | 280 | action = find_action (manager, "Bookmarks"); | ||
1895 | 281 | g_signal_handlers_disconnect_by_func | ||
1896 | 282 | (G_OBJECT (action), G_CALLBACK (activate_bookmarks_menu), G_OBJECT (window)); | ||
1897 | 283 | } | ||
1898 | 284 | |||
1899 | 285 | static void | ||
1900 | 286 | properties_dialog_destroy_cb (EphyBookmarkProperties *dialog, | ||
1901 | 287 | EphyNode *bookmark) | ||
1902 | 288 | { | ||
1903 | 289 | g_hash_table_remove (properties_dialogs, bookmark); | ||
1904 | 290 | } | ||
1905 | 291 | |||
1906 | 292 | void | ||
1907 | 293 | ephy_bookmarks_ui_add_bookmark (GtkWindow *parent, | ||
1908 | 294 | const char *location, | ||
1909 | 295 | const char *title) | ||
1910 | 296 | { | ||
1911 | 297 | EphyBookmarks *bookmarks; | ||
1912 | 298 | EphyNode *bookmark; | ||
1913 | 299 | GtkWidget *dialog; | ||
1914 | 300 | |||
1915 | 301 | if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN, | ||
1916 | 302 | EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING)) | ||
1917 | 303 | return; | ||
1918 | 304 | |||
1919 | 305 | bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ()); | ||
1920 | 306 | bookmark = ephy_bookmarks_add (bookmarks, title, location); | ||
1921 | 307 | |||
1922 | 308 | if (properties_dialogs == 0) | ||
1923 | 309 | { | ||
1924 | 310 | properties_dialogs = g_hash_table_new (g_direct_hash, g_direct_equal); | ||
1925 | 311 | } | ||
1926 | 312 | |||
1927 | 313 | dialog = ephy_bookmark_properties_new (bookmarks, bookmark, TRUE); | ||
1928 | 314 | |||
1929 | 315 | g_assert (parent != NULL); | ||
1930 | 316 | |||
1931 | 317 | gtk_window_group_add_window (ephy_gui_ensure_window_group (parent), | ||
1932 | 318 | GTK_WINDOW (dialog)); | ||
1933 | 319 | gtk_window_set_transient_for (GTK_WINDOW (dialog), parent); | ||
1934 | 320 | |||
1935 | 321 | g_signal_connect (dialog, "destroy", | ||
1936 | 322 | G_CALLBACK (properties_dialog_destroy_cb), bookmark); | ||
1937 | 323 | g_hash_table_insert (properties_dialogs, | ||
1938 | 324 | bookmark, dialog); | ||
1939 | 325 | |||
1940 | 326 | gtk_window_present_with_time (GTK_WINDOW (dialog), | ||
1941 | 327 | gtk_get_current_event_time ()); | ||
1942 | 328 | } | ||
1943 | 329 | |||
1944 | 330 | void | ||
1945 | 331 | ephy_bookmarks_ui_show_bookmark (EphyNode *bookmark) | ||
1946 | 332 | { | ||
1947 | 333 | EphyBookmarks *bookmarks; | ||
1948 | 334 | GtkWidget *dialog; | ||
1949 | 335 | |||
1950 | 336 | bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ()); | ||
1951 | 337 | |||
1952 | 338 | g_return_if_fail (EPHY_IS_BOOKMARKS (bookmarks)); | ||
1953 | 339 | g_return_if_fail (EPHY_IS_NODE (bookmark)); | ||
1954 | 340 | |||
1955 | 341 | if (properties_dialogs == 0) | ||
1956 | 342 | { | ||
1957 | 343 | properties_dialogs = g_hash_table_new (g_direct_hash, g_direct_equal); | ||
1958 | 344 | } | ||
1959 | 345 | |||
1960 | 346 | dialog = g_hash_table_lookup (properties_dialogs, bookmark); | ||
1961 | 347 | |||
1962 | 348 | if (dialog == NULL) | ||
1963 | 349 | { | ||
1964 | 350 | dialog = ephy_bookmark_properties_new (bookmarks, bookmark, FALSE); | ||
1965 | 351 | |||
1966 | 352 | g_signal_connect (dialog, "destroy", | ||
1967 | 353 | G_CALLBACK (properties_dialog_destroy_cb), bookmark); | ||
1968 | 354 | g_hash_table_insert (properties_dialogs, | ||
1969 | 355 | bookmark, dialog); | ||
1970 | 356 | } | ||
1971 | 357 | |||
1972 | 358 | gtk_window_present_with_time (GTK_WINDOW (dialog), | ||
1973 | 359 | gtk_get_current_event_time ()); | ||
1974 | 360 | } | ||
1975 | 361 | |||
1976 | 362 | |||
1977 | 363 | |||
1978 | 0 | 364 | ||
1979 | === removed file '.pc/81_ubuntu_force_update_bookmarks_menu.patch/src/bookmarks/ephy-bookmarks-ui.c' | |||
1980 | --- .pc/81_ubuntu_force_update_bookmarks_menu.patch/src/bookmarks/ephy-bookmarks-ui.c 2013-11-13 11:39:29 +0000 | |||
1981 | +++ .pc/81_ubuntu_force_update_bookmarks_menu.patch/src/bookmarks/ephy-bookmarks-ui.c 1970-01-01 00:00:00 +0000 | |||
1982 | @@ -1,363 +0,0 @@ | |||
1983 | 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ | ||
1984 | 2 | /* | ||
1985 | 3 | * Copyright © 2005 Peter Harvey | ||
1986 | 4 | * Copyright © 2006 Christian Persch | ||
1987 | 5 | * | ||
1988 | 6 | * This program is free software; you can redistribute it and/or modify | ||
1989 | 7 | * it under the terms of the GNU General Public License as published by | ||
1990 | 8 | * the Free Software Foundation; either version 2, or (at your option) | ||
1991 | 9 | * any later version. | ||
1992 | 10 | * | ||
1993 | 11 | * This program is distributed in the hope that it will be useful, | ||
1994 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1995 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1996 | 14 | * GNU General Public License for more details. | ||
1997 | 15 | * | ||
1998 | 16 | * You should have received a copy of the GNU General Public License | ||
1999 | 17 | * along with this program; if not, write to the Free Software | ||
2000 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
2001 | 19 | * | ||
2002 | 20 | */ | ||
2003 | 21 | |||
2004 | 22 | #include "config.h" | ||
2005 | 23 | #include "ephy-bookmarks-ui.h" | ||
2006 | 24 | |||
2007 | 25 | #include "ephy-bookmark-action-group.h" | ||
2008 | 26 | #include "ephy-bookmark-action.h" | ||
2009 | 27 | #include "ephy-bookmark-properties.h" | ||
2010 | 28 | #include "ephy-bookmarks-menu.h" | ||
2011 | 29 | #include "ephy-bookmarks.h" | ||
2012 | 30 | #include "ephy-debug.h" | ||
2013 | 31 | #include "ephy-dnd.h" | ||
2014 | 32 | #include "ephy-embed-shell.h" | ||
2015 | 33 | #include "ephy-file-helpers.h" | ||
2016 | 34 | #include "ephy-gui.h" | ||
2017 | 35 | #include "ephy-link.h" | ||
2018 | 36 | #include "ephy-node-common.h" | ||
2019 | 37 | #include "ephy-open-tabs-action.h" | ||
2020 | 38 | #include "ephy-prefs.h" | ||
2021 | 39 | #include "ephy-settings.h" | ||
2022 | 40 | #include "ephy-shell.h" | ||
2023 | 41 | #include "ephy-string.h" | ||
2024 | 42 | #include "ephy-topic-action-group.h" | ||
2025 | 43 | #include "ephy-topic-action.h" | ||
2026 | 44 | |||
2027 | 45 | #include <string.h> | ||
2028 | 46 | #include <glib/gi18n.h> | ||
2029 | 47 | #include <gtk/gtk.h> | ||
2030 | 48 | |||
2031 | 49 | #define BM_WINDOW_DATA_KEY "bookmarks-window-data" | ||
2032 | 50 | |||
2033 | 51 | typedef struct | ||
2034 | 52 | { | ||
2035 | 53 | guint bookmarks_menu; | ||
2036 | 54 | guint toolbar_menu; | ||
2037 | 55 | } BookmarksWindowData; | ||
2038 | 56 | |||
2039 | 57 | enum | ||
2040 | 58 | { | ||
2041 | 59 | RESPONSE_SHOW_PROPERTIES = 1, | ||
2042 | 60 | RESPONSE_NEW_BOOKMARK = 2 | ||
2043 | 61 | }; | ||
2044 | 62 | |||
2045 | 63 | static GString * bookmarks_menu_string = 0; | ||
2046 | 64 | static GHashTable *properties_dialogs = 0; | ||
2047 | 65 | |||
2048 | 66 | static GtkAction * | ||
2049 | 67 | find_action (GtkUIManager *manager, const char *name) | ||
2050 | 68 | { | ||
2051 | 69 | GList *l = gtk_ui_manager_get_action_groups (manager); | ||
2052 | 70 | GtkAction *action; | ||
2053 | 71 | |||
2054 | 72 | while (l != NULL) | ||
2055 | 73 | { | ||
2056 | 74 | action = gtk_action_group_get_action (GTK_ACTION_GROUP (l->data), name); | ||
2057 | 75 | if (action) return action; | ||
2058 | 76 | l = l->next; | ||
2059 | 77 | } | ||
2060 | 78 | |||
2061 | 79 | return NULL; | ||
2062 | 80 | } | ||
2063 | 81 | |||
2064 | 82 | static void | ||
2065 | 83 | activate_bookmarks_menu (GtkAction *action, EphyWindow *window) | ||
2066 | 84 | { | ||
2067 | 85 | BookmarksWindowData *data = g_object_get_data (G_OBJECT (window), BM_WINDOW_DATA_KEY); | ||
2068 | 86 | if (data && !data->bookmarks_menu) | ||
2069 | 87 | { | ||
2070 | 88 | GtkUIManager *manager = ephy_window_get_ui_manager (window); | ||
2071 | 89 | gtk_ui_manager_ensure_update (manager); | ||
2072 | 90 | |||
2073 | 91 | if (!bookmarks_menu_string->len) | ||
2074 | 92 | { | ||
2075 | 93 | g_string_append (bookmarks_menu_string, | ||
2076 | 94 | "<ui><popup name=\"PagePopup\" action=\"PagePopupAction\"><menu name=\"BookmarksMenu\" action=\"Bookmarks\">"); | ||
2077 | 95 | ephy_bookmarks_menu_build (bookmarks_menu_string, 0); | ||
2078 | 96 | g_string_append (bookmarks_menu_string, "</menu></popup></ui>"); | ||
2079 | 97 | } | ||
2080 | 98 | |||
2081 | 99 | data->bookmarks_menu = gtk_ui_manager_add_ui_from_string | ||
2082 | 100 | (manager, bookmarks_menu_string->str, bookmarks_menu_string->len, 0); | ||
2083 | 101 | |||
2084 | 102 | gtk_ui_manager_ensure_update (manager); | ||
2085 | 103 | } | ||
2086 | 104 | } | ||
2087 | 105 | |||
2088 | 106 | static void | ||
2089 | 107 | erase_bookmarks_menu (EphyWindow *window) | ||
2090 | 108 | { | ||
2091 | 109 | BookmarksWindowData *data; | ||
2092 | 110 | GtkUIManager *manager; | ||
2093 | 111 | |||
2094 | 112 | manager = ephy_window_get_ui_manager (window); | ||
2095 | 113 | data = g_object_get_data (G_OBJECT (window), BM_WINDOW_DATA_KEY); | ||
2096 | 114 | |||
2097 | 115 | if (data != NULL && data->bookmarks_menu != 0) | ||
2098 | 116 | { | ||
2099 | 117 | gtk_ui_manager_remove_ui (manager, data->bookmarks_menu); | ||
2100 | 118 | data->bookmarks_menu = 0; | ||
2101 | 119 | } | ||
2102 | 120 | |||
2103 | 121 | g_string_truncate (bookmarks_menu_string, 0); | ||
2104 | 122 | } | ||
2105 | 123 | |||
2106 | 124 | static void | ||
2107 | 125 | tree_changed_cb (EphyBookmarks *bookmarks, | ||
2108 | 126 | EphyWindow *window) | ||
2109 | 127 | { | ||
2110 | 128 | erase_bookmarks_menu (window); | ||
2111 | 129 | } | ||
2112 | 130 | |||
2113 | 131 | static void | ||
2114 | 132 | node_added_cb (EphyNode *parent, | ||
2115 | 133 | EphyNode *child, | ||
2116 | 134 | EphyWindow *window) | ||
2117 | 135 | { | ||
2118 | 136 | erase_bookmarks_menu (window); | ||
2119 | 137 | } | ||
2120 | 138 | |||
2121 | 139 | static void | ||
2122 | 140 | node_changed_cb (EphyNode *parent, | ||
2123 | 141 | EphyNode *child, | ||
2124 | 142 | guint property_id, | ||
2125 | 143 | EphyWindow *window) | ||
2126 | 144 | { | ||
2127 | 145 | if (property_id == EPHY_NODE_KEYWORD_PROP_NAME || | ||
2128 | 146 | property_id == EPHY_NODE_BMK_PROP_TITLE) | ||
2129 | 147 | { | ||
2130 | 148 | erase_bookmarks_menu (window); | ||
2131 | 149 | } | ||
2132 | 150 | } | ||
2133 | 151 | |||
2134 | 152 | static void | ||
2135 | 153 | node_removed_cb (EphyNode *parent, | ||
2136 | 154 | EphyNode *child, | ||
2137 | 155 | guint index, | ||
2138 | 156 | EphyWindow *window) | ||
2139 | 157 | { | ||
2140 | 158 | erase_bookmarks_menu (window); | ||
2141 | 159 | } | ||
2142 | 160 | |||
2143 | 161 | void | ||
2144 | 162 | ephy_bookmarks_ui_attach_window (EphyWindow *window) | ||
2145 | 163 | { | ||
2146 | 164 | EphyBookmarks *eb; | ||
2147 | 165 | EphyNode *bookmarks; | ||
2148 | 166 | EphyNode *topics; | ||
2149 | 167 | BookmarksWindowData *data; | ||
2150 | 168 | GtkUIManager *manager; | ||
2151 | 169 | GtkActionGroup *actions; | ||
2152 | 170 | GtkAction *action; | ||
2153 | 171 | |||
2154 | 172 | eb = ephy_shell_get_bookmarks (ephy_shell_get_default ()); | ||
2155 | 173 | bookmarks = ephy_bookmarks_get_bookmarks (eb); | ||
2156 | 174 | topics = ephy_bookmarks_get_keywords (eb); | ||
2157 | 175 | data = g_object_get_data (G_OBJECT (window), BM_WINDOW_DATA_KEY); | ||
2158 | 176 | g_return_if_fail (data == NULL); | ||
2159 | 177 | |||
2160 | 178 | manager = ephy_window_get_ui_manager (window); | ||
2161 | 179 | |||
2162 | 180 | data = g_new0 (BookmarksWindowData, 1); | ||
2163 | 181 | g_object_set_data_full (G_OBJECT (window), BM_WINDOW_DATA_KEY, data, g_free); | ||
2164 | 182 | |||
2165 | 183 | /* Create the self-maintaining action groups for bookmarks and topics */ | ||
2166 | 184 | actions = ephy_bookmark_group_new (bookmarks); | ||
2167 | 185 | gtk_ui_manager_insert_action_group (manager, actions, -1); | ||
2168 | 186 | g_signal_connect_object (actions, "open-link", | ||
2169 | 187 | G_CALLBACK (ephy_link_open), G_OBJECT (window), | ||
2170 | 188 | G_CONNECT_SWAPPED | G_CONNECT_AFTER); | ||
2171 | 189 | g_object_unref (actions); | ||
2172 | 190 | |||
2173 | 191 | actions = ephy_topic_action_group_new (topics, manager); | ||
2174 | 192 | gtk_ui_manager_insert_action_group (manager, actions, -1); | ||
2175 | 193 | g_object_unref (actions); | ||
2176 | 194 | |||
2177 | 195 | actions = ephy_open_tabs_group_new (topics); | ||
2178 | 196 | gtk_ui_manager_insert_action_group (manager, actions, -1); | ||
2179 | 197 | g_signal_connect_object (actions, "open-link", | ||
2180 | 198 | G_CALLBACK (ephy_link_open), G_OBJECT (window), | ||
2181 | 199 | G_CONNECT_SWAPPED | G_CONNECT_AFTER); | ||
2182 | 200 | g_object_unref (actions); | ||
2183 | 201 | |||
2184 | 202 | /* Add signal handlers for the bookmark database */ | ||
2185 | 203 | ephy_node_signal_connect_object (bookmarks, EPHY_NODE_CHILD_ADDED, | ||
2186 | 204 | (EphyNodeCallback)node_added_cb, | ||
2187 | 205 | G_OBJECT (window)); | ||
2188 | 206 | ephy_node_signal_connect_object (topics, EPHY_NODE_CHILD_ADDED, | ||
2189 | 207 | (EphyNodeCallback)node_added_cb, | ||
2190 | 208 | G_OBJECT (window)); | ||
2191 | 209 | |||
2192 | 210 | ephy_node_signal_connect_object (bookmarks, EPHY_NODE_CHILD_REMOVED, | ||
2193 | 211 | (EphyNodeCallback)node_removed_cb, | ||
2194 | 212 | G_OBJECT (window)); | ||
2195 | 213 | ephy_node_signal_connect_object (topics, EPHY_NODE_CHILD_REMOVED, | ||
2196 | 214 | (EphyNodeCallback)node_removed_cb, | ||
2197 | 215 | G_OBJECT (window)); | ||
2198 | 216 | |||
2199 | 217 | ephy_node_signal_connect_object (bookmarks, EPHY_NODE_CHILD_CHANGED, | ||
2200 | 218 | (EphyNodeCallback)node_changed_cb, | ||
2201 | 219 | G_OBJECT (window)); | ||
2202 | 220 | ephy_node_signal_connect_object (topics, EPHY_NODE_CHILD_CHANGED, | ||
2203 | 221 | (EphyNodeCallback)node_changed_cb, | ||
2204 | 222 | G_OBJECT (window)); | ||
2205 | 223 | |||
2206 | 224 | g_signal_connect_object (eb, "tree_changed", | ||
2207 | 225 | G_CALLBACK (tree_changed_cb), | ||
2208 | 226 | G_OBJECT (window), 0); | ||
2209 | 227 | |||
2210 | 228 | /* Setup empty menu strings and add signal handlers to build the menus on demand */ | ||
2211 | 229 | if (!bookmarks_menu_string) | ||
2212 | 230 | bookmarks_menu_string = g_string_new (""); | ||
2213 | 231 | |||
2214 | 232 | action = find_action (manager, "Bookmarks"); | ||
2215 | 233 | g_signal_connect_object (action, "activate", | ||
2216 | 234 | G_CALLBACK (activate_bookmarks_menu), | ||
2217 | 235 | G_OBJECT (window), 0); | ||
2218 | 236 | } | ||
2219 | 237 | |||
2220 | 238 | void | ||
2221 | 239 | ephy_bookmarks_ui_detach_window (EphyWindow *window) | ||
2222 | 240 | { | ||
2223 | 241 | EphyBookmarks *eb = ephy_shell_get_bookmarks (ephy_shell_get_default ()); | ||
2224 | 242 | EphyNode *bookmarks = ephy_bookmarks_get_bookmarks (eb); | ||
2225 | 243 | EphyNode *topics = ephy_bookmarks_get_keywords (eb); | ||
2226 | 244 | |||
2227 | 245 | BookmarksWindowData *data = g_object_get_data (G_OBJECT (window), BM_WINDOW_DATA_KEY); | ||
2228 | 246 | GtkUIManager *manager = ephy_window_get_ui_manager (window); | ||
2229 | 247 | GtkAction *action; | ||
2230 | 248 | |||
2231 | 249 | g_return_if_fail (data != 0); | ||
2232 | 250 | |||
2233 | 251 | if (data->bookmarks_menu) | ||
2234 | 252 | gtk_ui_manager_remove_ui (manager, data->bookmarks_menu); | ||
2235 | 253 | |||
2236 | 254 | g_object_set_data (G_OBJECT (window), BM_WINDOW_DATA_KEY, 0); | ||
2237 | 255 | |||
2238 | 256 | ephy_node_signal_disconnect_object (bookmarks, EPHY_NODE_CHILD_ADDED, | ||
2239 | 257 | (EphyNodeCallback)node_added_cb, | ||
2240 | 258 | G_OBJECT (window)); | ||
2241 | 259 | ephy_node_signal_disconnect_object (topics, EPHY_NODE_CHILD_ADDED, | ||
2242 | 260 | (EphyNodeCallback)node_added_cb, | ||
2243 | 261 | G_OBJECT (window)); | ||
2244 | 262 | |||
2245 | 263 | ephy_node_signal_disconnect_object (bookmarks, EPHY_NODE_CHILD_REMOVED, | ||
2246 | 264 | (EphyNodeCallback)node_removed_cb, | ||
2247 | 265 | G_OBJECT (window)); | ||
2248 | 266 | ephy_node_signal_disconnect_object (topics, EPHY_NODE_CHILD_REMOVED, | ||
2249 | 267 | (EphyNodeCallback)node_removed_cb, | ||
2250 | 268 | G_OBJECT (window)); | ||
2251 | 269 | |||
2252 | 270 | ephy_node_signal_disconnect_object (bookmarks, EPHY_NODE_CHILD_CHANGED, | ||
2253 | 271 | (EphyNodeCallback)node_changed_cb, | ||
2254 | 272 | G_OBJECT (window)); | ||
2255 | 273 | ephy_node_signal_disconnect_object (topics, EPHY_NODE_CHILD_CHANGED, | ||
2256 | 274 | (EphyNodeCallback)node_changed_cb, | ||
2257 | 275 | G_OBJECT (window)); | ||
2258 | 276 | |||
2259 | 277 | g_signal_handlers_disconnect_by_func | ||
2260 | 278 | (G_OBJECT (eb), G_CALLBACK (tree_changed_cb), G_OBJECT (window)); | ||
2261 | 279 | |||
2262 | 280 | action = find_action (manager, "Bookmarks"); | ||
2263 | 281 | g_signal_handlers_disconnect_by_func | ||
2264 | 282 | (G_OBJECT (action), G_CALLBACK (activate_bookmarks_menu), G_OBJECT (window)); | ||
2265 | 283 | } | ||
2266 | 284 | |||
2267 | 285 | static void | ||
2268 | 286 | properties_dialog_destroy_cb (EphyBookmarkProperties *dialog, | ||
2269 | 287 | EphyNode *bookmark) | ||
2270 | 288 | { | ||
2271 | 289 | g_hash_table_remove (properties_dialogs, bookmark); | ||
2272 | 290 | } | ||
2273 | 291 | |||
2274 | 292 | void | ||
2275 | 293 | ephy_bookmarks_ui_add_bookmark (GtkWindow *parent, | ||
2276 | 294 | const char *location, | ||
2277 | 295 | const char *title) | ||
2278 | 296 | { | ||
2279 | 297 | EphyBookmarks *bookmarks; | ||
2280 | 298 | EphyNode *bookmark; | ||
2281 | 299 | GtkWidget *dialog; | ||
2282 | 300 | |||
2283 | 301 | if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN, | ||
2284 | 302 | EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING)) | ||
2285 | 303 | return; | ||
2286 | 304 | |||
2287 | 305 | bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ()); | ||
2288 | 306 | bookmark = ephy_bookmarks_add (bookmarks, title, location); | ||
2289 | 307 | |||
2290 | 308 | if (properties_dialogs == 0) | ||
2291 | 309 | { | ||
2292 | 310 | properties_dialogs = g_hash_table_new (g_direct_hash, g_direct_equal); | ||
2293 | 311 | } | ||
2294 | 312 | |||
2295 | 313 | dialog = ephy_bookmark_properties_new (bookmarks, bookmark, TRUE); | ||
2296 | 314 | |||
2297 | 315 | g_assert (parent != NULL); | ||
2298 | 316 | |||
2299 | 317 | gtk_window_group_add_window (ephy_gui_ensure_window_group (parent), | ||
2300 | 318 | GTK_WINDOW (dialog)); | ||
2301 | 319 | gtk_window_set_transient_for (GTK_WINDOW (dialog), parent); | ||
2302 | 320 | |||
2303 | 321 | g_signal_connect (dialog, "destroy", | ||
2304 | 322 | G_CALLBACK (properties_dialog_destroy_cb), bookmark); | ||
2305 | 323 | g_hash_table_insert (properties_dialogs, | ||
2306 | 324 | bookmark, dialog); | ||
2307 | 325 | |||
2308 | 326 | gtk_window_present_with_time (GTK_WINDOW (dialog), | ||
2309 | 327 | gtk_get_current_event_time ()); | ||
2310 | 328 | } | ||
2311 | 329 | |||
2312 | 330 | void | ||
2313 | 331 | ephy_bookmarks_ui_show_bookmark (EphyNode *bookmark) | ||
2314 | 332 | { | ||
2315 | 333 | EphyBookmarks *bookmarks; | ||
2316 | 334 | GtkWidget *dialog; | ||
2317 | 335 | |||
2318 | 336 | bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ()); | ||
2319 | 337 | |||
2320 | 338 | g_return_if_fail (EPHY_IS_BOOKMARKS (bookmarks)); | ||
2321 | 339 | g_return_if_fail (EPHY_IS_NODE (bookmark)); | ||
2322 | 340 | |||
2323 | 341 | if (properties_dialogs == 0) | ||
2324 | 342 | { | ||
2325 | 343 | properties_dialogs = g_hash_table_new (g_direct_hash, g_direct_equal); | ||
2326 | 344 | } | ||
2327 | 345 | |||
2328 | 346 | dialog = g_hash_table_lookup (properties_dialogs, bookmark); | ||
2329 | 347 | |||
2330 | 348 | if (dialog == NULL) | ||
2331 | 349 | { | ||
2332 | 350 | dialog = ephy_bookmark_properties_new (bookmarks, bookmark, FALSE); | ||
2333 | 351 | |||
2334 | 352 | g_signal_connect (dialog, "destroy", | ||
2335 | 353 | G_CALLBACK (properties_dialog_destroy_cb), bookmark); | ||
2336 | 354 | g_hash_table_insert (properties_dialogs, | ||
2337 | 355 | bookmark, dialog); | ||
2338 | 356 | } | ||
2339 | 357 | |||
2340 | 358 | gtk_window_present_with_time (GTK_WINDOW (dialog), | ||
2341 | 359 | gtk_get_current_event_time ()); | ||
2342 | 360 | } | ||
2343 | 361 | |||
2344 | 362 | |||
2345 | 363 | |||
2346 | 364 | 0 | ||
2347 | === added file '.pc/applied-patches' | |||
2348 | --- .pc/applied-patches 1970-01-01 00:00:00 +0000 | |||
2349 | +++ .pc/applied-patches 2015-07-11 21:08:34 +0000 | |||
2350 | @@ -0,0 +1,5 @@ | |||
2351 | 1 | 00_epiphany-browser.patch | ||
2352 | 2 | 07_bookmarks.patch | ||
2353 | 3 | 12_safetypes.patch | ||
2354 | 4 | 81_ubuntu_force_update_bookmarks_menu.patch | ||
2355 | 5 | ubuntu_titlebars.patch | ||
2356 | 0 | 6 | ||
2357 | === removed file '.pc/applied-patches' | |||
2358 | --- .pc/applied-patches 2014-12-21 10:19:27 +0000 | |||
2359 | +++ .pc/applied-patches 1970-01-01 00:00:00 +0000 | |||
2360 | @@ -1,5 +0,0 @@ | |||
2361 | 1 | 00_epiphany-browser.patch | ||
2362 | 2 | 07_bookmarks.patch | ||
2363 | 3 | 12_safetypes.patch | ||
2364 | 4 | 81_ubuntu_force_update_bookmarks_menu.patch | ||
2365 | 5 | ubuntu_titlebars.patch | ||
2366 | 6 | 0 | ||
2367 | === added directory '.pc/ubuntu_titlebars.patch' | |||
2368 | === removed directory '.pc/ubuntu_titlebars.patch' | |||
2369 | === added file '.pc/ubuntu_titlebars.patch/.timestamp' | |||
2370 | === added directory '.pc/ubuntu_titlebars.patch/src' | |||
2371 | === removed directory '.pc/ubuntu_titlebars.patch/src' | |||
2372 | === added file '.pc/ubuntu_titlebars.patch/src/ephy-window.c' | |||
2373 | --- .pc/ubuntu_titlebars.patch/src/ephy-window.c 1970-01-01 00:00:00 +0000 | |||
2374 | +++ .pc/ubuntu_titlebars.patch/src/ephy-window.c 2015-07-11 21:08:34 +0000 | |||
2375 | @@ -0,0 +1,4026 @@ | |||
2376 | 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ | ||
2377 | 2 | /* | ||
2378 | 3 | * Copyright © 2000, 2001, 2002, 2003, 2004 Marco Pesenti Gritti | ||
2379 | 4 | * Copyright © 2003, 2004 Christian Persch | ||
2380 | 5 | * Copyright © 2011 Igalia S.L. | ||
2381 | 6 | * | ||
2382 | 7 | * This program is free software; you can redistribute it and/or modify | ||
2383 | 8 | * it under the terms of the GNU General Public License as published by | ||
2384 | 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
2385 | 10 | * any later version. | ||
2386 | 11 | * | ||
2387 | 12 | * This program is distributed in the hope that it will be useful, | ||
2388 | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2389 | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2390 | 15 | * GNU General Public License for more details. | ||
2391 | 16 | * | ||
2392 | 17 | * You should have received a copy of the GNU General Public License | ||
2393 | 18 | * along with this program; if not, write to the Free Software | ||
2394 | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
2395 | 20 | * | ||
2396 | 21 | */ | ||
2397 | 22 | |||
2398 | 23 | #include "config.h" | ||
2399 | 24 | #include "ephy-window.h" | ||
2400 | 25 | |||
2401 | 26 | #include "ephy-action-helper.h" | ||
2402 | 27 | #include "ephy-bookmarks-ui.h" | ||
2403 | 28 | #include "ephy-certificate-popover.h" | ||
2404 | 29 | #include "ephy-combined-stop-reload-action.h" | ||
2405 | 30 | #include "ephy-debug.h" | ||
2406 | 31 | #include "ephy-download-widget.h" | ||
2407 | 32 | #include "ephy-embed-container.h" | ||
2408 | 33 | #include "ephy-embed-prefs.h" | ||
2409 | 34 | #include "ephy-embed-shell.h" | ||
2410 | 35 | #include "ephy-embed-type-builtins.h" | ||
2411 | 36 | #include "ephy-embed-utils.h" | ||
2412 | 37 | #include "ephy-encoding-menu.h" | ||
2413 | 38 | #include "ephy-file-helpers.h" | ||
2414 | 39 | #include "ephy-find-toolbar.h" | ||
2415 | 40 | #include "ephy-gui.h" | ||
2416 | 41 | #include "ephy-home-action.h" | ||
2417 | 42 | #include "ephy-initial-state.h" | ||
2418 | 43 | #include "ephy-link.h" | ||
2419 | 44 | #include "ephy-location-entry.h" | ||
2420 | 45 | #include "ephy-navigation-history-action.h" | ||
2421 | 46 | #include "ephy-notebook.h" | ||
2422 | 47 | #include "ephy-prefs.h" | ||
2423 | 48 | #include "ephy-private.h" | ||
2424 | 49 | #include "ephy-session.h" | ||
2425 | 50 | #include "ephy-settings.h" | ||
2426 | 51 | #include "ephy-shell.h" | ||
2427 | 52 | #include "ephy-title-box.h" | ||
2428 | 53 | #include "ephy-toolbar.h" | ||
2429 | 54 | #include "ephy-type-builtins.h" | ||
2430 | 55 | #include "ephy-web-view.h" | ||
2431 | 56 | #include "ephy-zoom-action.h" | ||
2432 | 57 | #include "ephy-zoom.h" | ||
2433 | 58 | #include "popup-commands.h" | ||
2434 | 59 | #include "window-commands.h" | ||
2435 | 60 | |||
2436 | 61 | #include <gdk/gdkkeysyms.h> | ||
2437 | 62 | #include <gdk/gdkx.h> | ||
2438 | 63 | #include <gio/gio.h> | ||
2439 | 64 | #include <glib/gi18n.h> | ||
2440 | 65 | #include <gtk/gtk.h> | ||
2441 | 66 | #include <libsoup/soup.h> | ||
2442 | 67 | |||
2443 | 68 | #define WNCK_I_KNOW_THIS_IS_UNSTABLE | ||
2444 | 69 | #include <libwnck/libwnck.h> | ||
2445 | 70 | |||
2446 | 71 | #include <webkit2/webkit2.h> | ||
2447 | 72 | |||
2448 | 73 | #ifdef HAVE_X11_XF86KEYSYM_H | ||
2449 | 74 | #include <X11/XF86keysym.h> | ||
2450 | 75 | #endif | ||
2451 | 76 | |||
2452 | 77 | /** | ||
2453 | 78 | * SECTION:ephy-window | ||
2454 | 79 | * @short_description: Epiphany's main #GtkWindow widget | ||
2455 | 80 | * | ||
2456 | 81 | * #EphyWindow is Epiphany's main widget. | ||
2457 | 82 | */ | ||
2458 | 83 | |||
2459 | 84 | static void ephy_window_view_popup_windows_cb (GtkAction *action, | ||
2460 | 85 | EphyWindow *window); | ||
2461 | 86 | |||
2462 | 87 | static const GtkActionEntry ephy_menu_entries [] = { | ||
2463 | 88 | |||
2464 | 89 | /* Toplevel */ | ||
2465 | 90 | |||
2466 | 91 | { "Bookmarks", NULL, N_("_Bookmarks") }, | ||
2467 | 92 | { "PopupAction", NULL, "" }, | ||
2468 | 93 | { "PagePopupAction", NULL, "" }, | ||
2469 | 94 | { "NotebookPopupAction", NULL, "" }, | ||
2470 | 95 | |||
2471 | 96 | /* File actions. */ | ||
2472 | 97 | |||
2473 | 98 | { "FileNewWindow", NULL, N_("_New Window"), "<control>N", NULL, | ||
2474 | 99 | G_CALLBACK (window_cmd_file_new_window) }, | ||
2475 | 100 | { "FileNewWindowIncognito", NULL, N_("New _Incognito Window"), "<control><shift>N", NULL, | ||
2476 | 101 | G_CALLBACK (window_cmd_file_new_incognito_window) }, | ||
2477 | 102 | { "FileOpen", NULL, N_("_Open…"), "<control>O", NULL, | ||
2478 | 103 | G_CALLBACK (window_cmd_file_open) }, | ||
2479 | 104 | { "FileSaveAs", NULL, N_("Save _As…"), "<shift><control>S", NULL, | ||
2480 | 105 | G_CALLBACK (window_cmd_file_save_as) }, | ||
2481 | 106 | { "FileSaveAsApplication", NULL, N_("Save As _Web Application…"), "<shift><control>A", NULL, | ||
2482 | 107 | G_CALLBACK (window_cmd_file_save_as_application) }, | ||
2483 | 108 | { "FilePrint", NULL, N_("_Print…"), "<control>P", NULL, | ||
2484 | 109 | G_CALLBACK (window_cmd_file_print) }, | ||
2485 | 110 | { "FileSendTo", NULL, N_("S_end Link by Email…"), NULL, NULL, | ||
2486 | 111 | G_CALLBACK (window_cmd_file_send_to) }, | ||
2487 | 112 | { "FileCloseTab", NULL, N_("_Close"), "<control>W", NULL, | ||
2488 | 113 | G_CALLBACK (window_cmd_file_close_window) }, | ||
2489 | 114 | { "FileQuit", NULL, N_("_Quit"), "<control>Q", NULL, | ||
2490 | 115 | G_CALLBACK (window_cmd_file_quit) }, | ||
2491 | 116 | |||
2492 | 117 | /* Edit actions. */ | ||
2493 | 118 | |||
2494 | 119 | { "EditUndo", NULL, N_("_Undo"), "<control>Z", NULL, | ||
2495 | 120 | G_CALLBACK (window_cmd_edit_undo) }, | ||
2496 | 121 | { "EditRedo", NULL, N_("Re_do"), "<shift><control>Z", NULL, | ||
2497 | 122 | G_CALLBACK (window_cmd_edit_redo) }, | ||
2498 | 123 | { "EditCut", NULL, N_("Cu_t"), "<control>X", NULL, | ||
2499 | 124 | G_CALLBACK (window_cmd_edit_cut) }, | ||
2500 | 125 | { "EditCopy", NULL, N_("_Copy"), "<control>C", NULL, | ||
2501 | 126 | G_CALLBACK (window_cmd_edit_copy) }, | ||
2502 | 127 | { "EditPaste", NULL, N_("_Paste"), "<control>V", NULL, | ||
2503 | 128 | G_CALLBACK (window_cmd_edit_paste) }, | ||
2504 | 129 | { "EditDelete", NULL, NULL, NULL, NULL, | ||
2505 | 130 | G_CALLBACK (window_cmd_edit_delete) }, | ||
2506 | 131 | { "EditSelectAll", NULL, N_("Select _All"), "<control>A", NULL, | ||
2507 | 132 | G_CALLBACK (window_cmd_edit_select_all) }, | ||
2508 | 133 | { "EditFind", NULL, N_("_Find…"), "<control>F", NULL, | ||
2509 | 134 | G_CALLBACK (window_cmd_edit_find) }, | ||
2510 | 135 | { "EditFindNext", NULL, N_("Find Ne_xt"), "<control>G", NULL, | ||
2511 | 136 | G_CALLBACK (window_cmd_edit_find_next) }, | ||
2512 | 137 | { "EditFindPrev", NULL, N_("Find Pre_vious"), "<shift><control>G", NULL, | ||
2513 | 138 | G_CALLBACK (window_cmd_edit_find_prev) }, | ||
2514 | 139 | { "EditBookmarks", NULL, N_("Edit _Bookmarks"), "<control>B", NULL, | ||
2515 | 140 | G_CALLBACK (window_cmd_edit_bookmarks) }, | ||
2516 | 141 | { "EditHistory", NULL, N_("_History"), "<control>H", NULL, | ||
2517 | 142 | G_CALLBACK (window_cmd_edit_history) }, | ||
2518 | 143 | { "EditPreferences", NULL, N_("Pr_eferences"), "<control>e", NULL, | ||
2519 | 144 | G_CALLBACK (window_cmd_edit_preferences) }, | ||
2520 | 145 | |||
2521 | 146 | /* View actions. */ | ||
2522 | 147 | |||
2523 | 148 | { "ViewStop", NULL, N_("_Stop"), "Escape", NULL, | ||
2524 | 149 | G_CALLBACK (window_cmd_view_stop) }, | ||
2525 | 150 | { "ViewAlwaysStop", NULL, N_("_Stop"), "Escape", | ||
2526 | 151 | NULL, G_CALLBACK (window_cmd_view_stop) }, | ||
2527 | 152 | { "ViewReload", NULL, N_("_Reload"), "<control>R", NULL, | ||
2528 | 153 | G_CALLBACK (window_cmd_view_reload) }, | ||
2529 | 154 | { "ViewZoomIn", NULL, N_("Zoom _In"), "<control>plus", NULL, | ||
2530 | 155 | G_CALLBACK (window_cmd_view_zoom_in) }, | ||
2531 | 156 | { "ViewZoomOut", NULL, N_("Zoom O_ut"), "<control>minus", NULL, | ||
2532 | 157 | G_CALLBACK (window_cmd_view_zoom_out) }, | ||
2533 | 158 | { "ViewZoomNormal", NULL, N_("_Normal Size"), "<control>0", NULL, | ||
2534 | 159 | G_CALLBACK (window_cmd_view_zoom_normal) }, | ||
2535 | 160 | { "ViewEncoding", NULL, N_("Text _Encoding"), NULL, NULL, NULL }, | ||
2536 | 161 | { "ViewPageSource", NULL, N_("_Page Source"), "<control>U", NULL, | ||
2537 | 162 | G_CALLBACK (window_cmd_view_page_source) }, | ||
2538 | 163 | |||
2539 | 164 | /* Bookmarks actions. */ | ||
2540 | 165 | |||
2541 | 166 | { "FileBookmarkPage", NULL, N_("_Add Bookmark…"), "<control>D", NULL, | ||
2542 | 167 | G_CALLBACK (window_cmd_file_bookmark_page) }, | ||
2543 | 168 | |||
2544 | 169 | /* Go actions. */ | ||
2545 | 170 | |||
2546 | 171 | { "GoLocation", NULL, N_("_Location…"), "<control>L", NULL, | ||
2547 | 172 | G_CALLBACK (window_cmd_go_location) }, | ||
2548 | 173 | |||
2549 | 174 | /* Tabs actions. */ | ||
2550 | 175 | |||
2551 | 176 | { "TabsPrevious", NULL, N_("_Previous Tab"), "<control>Page_Up", NULL, | ||
2552 | 177 | G_CALLBACK (window_cmd_tabs_previous) }, | ||
2553 | 178 | { "TabsNext", NULL, N_("_Next Tab"), "<control>Page_Down", NULL, | ||
2554 | 179 | G_CALLBACK (window_cmd_tabs_next) }, | ||
2555 | 180 | { "TabsMoveLeft", NULL, N_("Move Tab _Left"), "<shift><control>Page_Up", NULL, | ||
2556 | 181 | G_CALLBACK (window_cmd_tabs_move_left) }, | ||
2557 | 182 | { "TabsMoveRight", NULL, N_("Move Tab _Right"), "<shift><control>Page_Down", NULL, | ||
2558 | 183 | G_CALLBACK (window_cmd_tabs_move_right) }, | ||
2559 | 184 | { "TabsDetach", NULL, N_("_Detach Tab"), NULL, NULL, | ||
2560 | 185 | G_CALLBACK (window_cmd_tabs_detach) }, | ||
2561 | 186 | |||
2562 | 187 | /* Help. */ | ||
2563 | 188 | |||
2564 | 189 | { "HelpContents", NULL, N_("_Help"), NULL, NULL, | ||
2565 | 190 | G_CALLBACK (window_cmd_help_contents) }, | ||
2566 | 191 | { "HelpAbout", NULL, N_("_About"), NULL, NULL, | ||
2567 | 192 | G_CALLBACK (window_cmd_help_about) } | ||
2568 | 193 | }; | ||
2569 | 194 | |||
2570 | 195 | static const GtkToggleActionEntry ephy_menu_toggle_entries [] = | ||
2571 | 196 | { | ||
2572 | 197 | /* View actions. */ | ||
2573 | 198 | |||
2574 | 199 | { "ViewDownloadsBar", NULL, N_("_Downloads Bar"), NULL, NULL, | ||
2575 | 200 | NULL, FALSE }, | ||
2576 | 201 | |||
2577 | 202 | { "ViewFullscreen", NULL, N_("_Fullscreen"), "F11", NULL, | ||
2578 | 203 | G_CALLBACK (window_cmd_view_fullscreen), FALSE }, | ||
2579 | 204 | { "ViewPopupWindows", NULL, N_("Popup _Windows"), NULL, NULL, | ||
2580 | 205 | G_CALLBACK (ephy_window_view_popup_windows_cb), FALSE }, | ||
2581 | 206 | { "BrowseWithCaret", NULL, N_("Selection Caret"), "F7", NULL, | ||
2582 | 207 | G_CALLBACK (window_cmd_browse_with_caret), FALSE } | ||
2583 | 208 | }; | ||
2584 | 209 | |||
2585 | 210 | static const GtkActionEntry ephy_popups_entries [] = { | ||
2586 | 211 | /* Document. */ | ||
2587 | 212 | |||
2588 | 213 | { "ContextBookmarkPage", NULL, N_("Add Boo_kmark…"), "<control>D", NULL, | ||
2589 | 214 | G_CALLBACK (window_cmd_file_bookmark_page) }, | ||
2590 | 215 | |||
2591 | 216 | /* Links. */ | ||
2592 | 217 | |||
2593 | 218 | { "OpenLinkInNewWindow", NULL, N_("Open Link in New _Window"), NULL, NULL, | ||
2594 | 219 | G_CALLBACK (popup_cmd_link_in_new_window) }, | ||
2595 | 220 | { "OpenLinkInNewTab", NULL, N_("Open Link in New _Tab"), NULL, NULL, | ||
2596 | 221 | G_CALLBACK (popup_cmd_link_in_new_tab) }, | ||
2597 | 222 | { "DownloadLinkAs", NULL, N_("_Save Link As…"), NULL, NULL, | ||
2598 | 223 | G_CALLBACK (popup_cmd_download_link_as) }, | ||
2599 | 224 | { "CopyLinkAddress", NULL, N_("_Copy Link Address"), NULL, | ||
2600 | 225 | NULL, G_CALLBACK (popup_cmd_copy_link_address) }, | ||
2601 | 226 | { "CopyEmailAddress", NULL, N_("_Copy E-mail Address"), NULL, | ||
2602 | 227 | NULL, G_CALLBACK (popup_cmd_copy_link_address) }, | ||
2603 | 228 | |||
2604 | 229 | /* Images. */ | ||
2605 | 230 | |||
2606 | 231 | { "ViewImage", NULL, N_("View _Image in New Tab"), NULL, | ||
2607 | 232 | NULL, G_CALLBACK (popup_cmd_view_image_in_new_tab) }, | ||
2608 | 233 | { "CopyImageLocation", NULL, N_("Copy I_mage Address"), NULL, | ||
2609 | 234 | NULL, G_CALLBACK (popup_cmd_copy_image_location) }, | ||
2610 | 235 | { "SaveImageAs", NULL, N_("_Save Image As…"), NULL, | ||
2611 | 236 | NULL, G_CALLBACK (popup_cmd_save_image_as) }, | ||
2612 | 237 | { "SetImageAsBackground", NULL, N_("Set as _Wallpaper"), NULL, | ||
2613 | 238 | NULL, G_CALLBACK (popup_cmd_set_image_as_background) }, | ||
2614 | 239 | |||
2615 | 240 | /* Video. */ | ||
2616 | 241 | |||
2617 | 242 | { "OpenVideoInNewWindow", NULL, N_("Open Video in New _Window"), NULL, NULL, | ||
2618 | 243 | G_CALLBACK (popup_cmd_media_in_new_window) }, | ||
2619 | 244 | { "OpenVideoInNewTab", NULL, N_("Open Video in New _Tab"), NULL, NULL, | ||
2620 | 245 | G_CALLBACK (popup_cmd_media_in_new_tab) }, | ||
2621 | 246 | { "SaveVideoAs", NULL, N_("_Save Video As…"), NULL, | ||
2622 | 247 | NULL, G_CALLBACK (popup_cmd_save_media_as) }, | ||
2623 | 248 | { "CopyVideoLocation", NULL, N_("_Copy Video Address"), NULL, | ||
2624 | 249 | NULL, G_CALLBACK (popup_cmd_copy_media_location) }, | ||
2625 | 250 | |||
2626 | 251 | /* Audio. */ | ||
2627 | 252 | |||
2628 | 253 | { "OpenAudioInNewWindow", NULL, N_("Open Audio in New _Window"), NULL, NULL, | ||
2629 | 254 | G_CALLBACK (popup_cmd_media_in_new_window) }, | ||
2630 | 255 | { "OpenAudioInNewTab", NULL, N_("Open Audio in New _Tab"), NULL, NULL, | ||
2631 | 256 | G_CALLBACK (popup_cmd_media_in_new_tab) }, | ||
2632 | 257 | { "SaveAudioAs", NULL, N_("_Save Audio As…"), NULL, | ||
2633 | 258 | NULL, G_CALLBACK (popup_cmd_save_media_as) }, | ||
2634 | 259 | { "CopyAudioLocation", NULL, N_("_Copy Audio Address"), NULL, | ||
2635 | 260 | NULL, G_CALLBACK (popup_cmd_copy_media_location) }, | ||
2636 | 261 | }; | ||
2637 | 262 | |||
2638 | 263 | static const struct | ||
2639 | 264 | { | ||
2640 | 265 | guint keyval; | ||
2641 | 266 | GdkModifierType modifier; | ||
2642 | 267 | const gchar *action; | ||
2643 | 268 | gboolean fromToolbar; | ||
2644 | 269 | } extra_keybindings [] = { | ||
2645 | 270 | /* FIXME: PageMenu should have its accel without being in the | ||
2646 | 271 | * extra keybindings, but does not seem to work for some | ||
2647 | 272 | * reason. */ | ||
2648 | 273 | { GDK_KEY_F10, 0, "PageMenu", TRUE }, | ||
2649 | 274 | { GDK_KEY_Home, GDK_MOD1_MASK, "FileHome", TRUE }, | ||
2650 | 275 | /* FIXME: these are not in any menu for now, so add them here. */ | ||
2651 | 276 | { GDK_KEY_F11, 0, "ViewFullscreen", FALSE }, | ||
2652 | 277 | { GDK_KEY_plus, GDK_CONTROL_MASK, "ViewZoomIn", FALSE }, | ||
2653 | 278 | { GDK_KEY_minus, GDK_CONTROL_MASK, "ViewZoomOut", FALSE }, | ||
2654 | 279 | { GDK_KEY_0, GDK_CONTROL_MASK, "ViewZoomNormal", FALSE }, | ||
2655 | 280 | { GDK_KEY_g, GDK_CONTROL_MASK, "EditFindNext", FALSE }, | ||
2656 | 281 | { GDK_KEY_G, GDK_CONTROL_MASK | | ||
2657 | 282 | GDK_SHIFT_MASK, "EditFindPrev", FALSE }, | ||
2658 | 283 | |||
2659 | 284 | { GDK_KEY_s, GDK_CONTROL_MASK, "FileSaveAs", FALSE }, | ||
2660 | 285 | { GDK_KEY_r, GDK_CONTROL_MASK, "ViewReload", FALSE }, | ||
2661 | 286 | { GDK_KEY_R, GDK_CONTROL_MASK, "ViewReload", FALSE }, | ||
2662 | 287 | { GDK_KEY_R, GDK_CONTROL_MASK | | ||
2663 | 288 | GDK_SHIFT_MASK, "ViewReload", FALSE }, | ||
2664 | 289 | /* Tab navigation */ | ||
2665 | 290 | { GDK_KEY_Page_Up, GDK_CONTROL_MASK, "TabsPrevious", FALSE }, | ||
2666 | 291 | { GDK_KEY_Page_Down, GDK_CONTROL_MASK, "TabsNext", FALSE }, | ||
2667 | 292 | { GDK_KEY_Page_Up, GDK_CONTROL_MASK | | ||
2668 | 293 | GDK_SHIFT_MASK, "TabsMoveLeft", FALSE }, | ||
2669 | 294 | { GDK_KEY_Page_Down, GDK_CONTROL_MASK | | ||
2670 | 295 | GDK_SHIFT_MASK, "TabsMoveRight", FALSE }, | ||
2671 | 296 | /* Go */ | ||
2672 | 297 | { GDK_KEY_l, GDK_CONTROL_MASK, "GoLocation", FALSE }, | ||
2673 | 298 | { GDK_KEY_F6, 0, "GoLocation", FALSE }, | ||
2674 | 299 | /* Support all the MSIE tricks as well ;) */ | ||
2675 | 300 | { GDK_KEY_F5, 0, "ViewReload", FALSE }, | ||
2676 | 301 | { GDK_KEY_F5, GDK_CONTROL_MASK, "ViewReload", FALSE }, | ||
2677 | 302 | { GDK_KEY_F5, GDK_SHIFT_MASK, "ViewReload", FALSE }, | ||
2678 | 303 | { GDK_KEY_F5, GDK_CONTROL_MASK | | ||
2679 | 304 | GDK_SHIFT_MASK, "ViewReload", FALSE }, | ||
2680 | 305 | { GDK_KEY_KP_Add, GDK_CONTROL_MASK, "ViewZoomIn", FALSE }, | ||
2681 | 306 | { GDK_KEY_KP_Subtract, GDK_CONTROL_MASK, "ViewZoomOut", FALSE }, | ||
2682 | 307 | { GDK_KEY_equal, GDK_CONTROL_MASK, "ViewZoomIn", FALSE }, | ||
2683 | 308 | { GDK_KEY_KP_0, GDK_CONTROL_MASK, "ViewZoomNormal", FALSE }, | ||
2684 | 309 | /* These keys are a bit strange: when pressed with no modifiers, they emit | ||
2685 | 310 | * KP_PageUp/Down Control; when pressed with Control+Shift they are KP_9/3, | ||
2686 | 311 | * when NumLock is on they are KP_9/3 and with NumLock and Control+Shift | ||
2687 | 312 | * They're KP_PageUp/Down again! | ||
2688 | 313 | */ | ||
2689 | 314 | { GDK_KEY_Left, GDK_MOD1_MASK /*Alt*/, "NavigationBack", TRUE }, | ||
2690 | 315 | { GDK_KEY_KP_Left, GDK_MOD1_MASK /*Alt*/, "NavigationBack", TRUE }, | ||
2691 | 316 | { GDK_KEY_KP_4, GDK_MOD1_MASK /*Alt*/, "NavigationBack", TRUE }, | ||
2692 | 317 | { GDK_KEY_Right, GDK_MOD1_MASK /*Alt*/, "NavigationForward", TRUE }, | ||
2693 | 318 | { GDK_KEY_KP_Right, GDK_MOD1_MASK /*Alt*/, "NavigationForward", TRUE }, | ||
2694 | 319 | { GDK_KEY_KP_6, GDK_MOD1_MASK /*Alt*/, "NavigationForward", TRUE }, | ||
2695 | 320 | { GDK_KEY_KP_Page_Up, GDK_CONTROL_MASK, "TabsPrevious", FALSE }, | ||
2696 | 321 | { GDK_KEY_KP_9, GDK_CONTROL_MASK, "TabsPrevious", FALSE }, | ||
2697 | 322 | { GDK_KEY_KP_Page_Down, GDK_CONTROL_MASK, "TabsNext", FALSE }, | ||
2698 | 323 | { GDK_KEY_KP_3, GDK_CONTROL_MASK, "TabsNext", FALSE }, | ||
2699 | 324 | { GDK_KEY_KP_Page_Up, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "TabsMoveLeft", FALSE }, | ||
2700 | 325 | { GDK_KEY_KP_9, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "TabsMoveLeft", FALSE }, | ||
2701 | 326 | { GDK_KEY_KP_Page_Down, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "TabsMoveRight", FALSE }, | ||
2702 | 327 | { GDK_KEY_KP_3, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "TabsMoveRight", FALSE }, | ||
2703 | 328 | #ifdef HAVE_X11_XF86KEYSYM_H | ||
2704 | 329 | { XF86XK_Back, 0, "NavigationBack", TRUE }, | ||
2705 | 330 | { XF86XK_Forward, 0, "NavigationForward", TRUE }, | ||
2706 | 331 | { XF86XK_Go, 0, "GoLocation", FALSE }, | ||
2707 | 332 | { XF86XK_OpenURL, 0, "GoLocation", FALSE }, | ||
2708 | 333 | { XF86XK_AddFavorite, 0, "FileBookmarkPage", FALSE }, | ||
2709 | 334 | { XF86XK_Refresh, 0, "ViewReload", FALSE }, | ||
2710 | 335 | { XF86XK_Reload, 0, "ViewReload", FALSE }, | ||
2711 | 336 | { XF86XK_Search, 0, "EditFind", FALSE }, | ||
2712 | 337 | { XF86XK_Send, 0, "FileSendTo", FALSE }, | ||
2713 | 338 | { XF86XK_Stop, 0, "ViewStop", FALSE }, | ||
2714 | 339 | { XF86XK_ZoomIn, 0, "ViewZoomIn", FALSE }, | ||
2715 | 340 | { XF86XK_ZoomOut, 0, "ViewZoomOut", FALSE } | ||
2716 | 341 | /* FIXME: what about ScrollUp, ScrollDown, Menu*, Option, LogOff, Save,.. any others? */ | ||
2717 | 342 | #endif /* HAVE_X11_XF86KEYSYM_H */ | ||
2718 | 343 | }; | ||
2719 | 344 | |||
2720 | 345 | #define SETTINGS_CONNECTION_DATA_KEY "EphyWindowSettings" | ||
2721 | 346 | |||
2722 | 347 | #define EPHY_WINDOW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_WINDOW, EphyWindowPrivate)) | ||
2723 | 348 | |||
2724 | 349 | struct _EphyWindowPrivate | ||
2725 | 350 | { | ||
2726 | 351 | GtkWidget *main_vbox; | ||
2727 | 352 | GtkWidget *toolbar; | ||
2728 | 353 | GtkUIManager *manager; | ||
2729 | 354 | GtkActionGroup *action_group; | ||
2730 | 355 | GtkActionGroup *popups_action_group; | ||
2731 | 356 | GtkActionGroup *toolbar_action_group; | ||
2732 | 357 | GtkActionGroup *tab_accels_action_group; | ||
2733 | 358 | EphyEncodingMenu *enc_menu; | ||
2734 | 359 | GtkNotebook *notebook; | ||
2735 | 360 | EphyEmbed *active_embed; | ||
2736 | 361 | EphyWindowChrome chrome; | ||
2737 | 362 | EphyEmbedEvent *context_event; | ||
2738 | 363 | WebKitHitTestResult *hit_test_result; | ||
2739 | 364 | guint idle_worker; | ||
2740 | 365 | GtkWidget *downloads_box; | ||
2741 | 366 | |||
2742 | 367 | EphyLocationController *location_controller; | ||
2743 | 368 | |||
2744 | 369 | gulong app_menu_visibility_handler; | ||
2745 | 370 | |||
2746 | 371 | guint closing : 1; | ||
2747 | 372 | guint has_size : 1; | ||
2748 | 373 | guint fullscreen_mode : 1; | ||
2749 | 374 | guint is_popup : 1; | ||
2750 | 375 | guint present_on_insert : 1; | ||
2751 | 376 | guint key_theme_is_emacs : 1; | ||
2752 | 377 | guint updating_address : 1; | ||
2753 | 378 | guint force_close : 1; | ||
2754 | 379 | guint checking_modified_forms : 1; | ||
2755 | 380 | }; | ||
2756 | 381 | |||
2757 | 382 | enum | ||
2758 | 383 | { | ||
2759 | 384 | PROP_0, | ||
2760 | 385 | PROP_ACTIVE_CHILD, | ||
2761 | 386 | PROP_CHROME, | ||
2762 | 387 | PROP_SINGLE_TAB_MODE | ||
2763 | 388 | }; | ||
2764 | 389 | |||
2765 | 390 | /* Make sure not to overlap with those in ephy-lockdown.c */ | ||
2766 | 391 | enum | ||
2767 | 392 | { | ||
2768 | 393 | SENS_FLAG_CHROME = 1 << 0, | ||
2769 | 394 | SENS_FLAG_CONTEXT = 1 << 1, | ||
2770 | 395 | SENS_FLAG_DOCUMENT = 1 << 2, | ||
2771 | 396 | SENS_FLAG_LOADING = 1 << 3, | ||
2772 | 397 | SENS_FLAG_NAVIGATION = 1 << 4, | ||
2773 | 398 | SENS_FLAG_IS_BLANK = 1 << 5 | ||
2774 | 399 | }; | ||
2775 | 400 | |||
2776 | 401 | static gint | ||
2777 | 402 | impl_add_child (EphyEmbedContainer *container, | ||
2778 | 403 | EphyEmbed *child, | ||
2779 | 404 | gint position, | ||
2780 | 405 | gboolean jump_to) | ||
2781 | 406 | { | ||
2782 | 407 | EphyWindow *window = EPHY_WINDOW (container); | ||
2783 | 408 | |||
2784 | 409 | g_return_val_if_fail (!window->priv->is_popup || | ||
2785 | 410 | gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->priv->notebook)) < 1, -1); | ||
2786 | 411 | |||
2787 | 412 | return ephy_notebook_add_tab (EPHY_NOTEBOOK (window->priv->notebook), | ||
2788 | 413 | child, position, jump_to); | ||
2789 | 414 | } | ||
2790 | 415 | |||
2791 | 416 | static void | ||
2792 | 417 | impl_set_active_child (EphyEmbedContainer *container, | ||
2793 | 418 | EphyEmbed *child) | ||
2794 | 419 | { | ||
2795 | 420 | int page; | ||
2796 | 421 | EphyWindow *window; | ||
2797 | 422 | |||
2798 | 423 | window = EPHY_WINDOW (container); | ||
2799 | 424 | |||
2800 | 425 | page = gtk_notebook_page_num | ||
2801 | 426 | (window->priv->notebook, GTK_WIDGET (child)); | ||
2802 | 427 | gtk_notebook_set_current_page | ||
2803 | 428 | (window->priv->notebook, page); | ||
2804 | 429 | } | ||
2805 | 430 | |||
2806 | 431 | static GtkWidget * | ||
2807 | 432 | construct_confirm_close_dialog (EphyWindow *window, | ||
2808 | 433 | const char *title, | ||
2809 | 434 | const char *info, | ||
2810 | 435 | const char *action) | ||
2811 | 436 | { | ||
2812 | 437 | GtkWidget *dialog; | ||
2813 | 438 | |||
2814 | 439 | dialog = gtk_message_dialog_new (GTK_WINDOW (window), | ||
2815 | 440 | GTK_DIALOG_MODAL, | ||
2816 | 441 | GTK_MESSAGE_WARNING, | ||
2817 | 442 | GTK_BUTTONS_CANCEL, | ||
2818 | 443 | "%s", title); | ||
2819 | 444 | |||
2820 | 445 | gtk_message_dialog_format_secondary_text | ||
2821 | 446 | (GTK_MESSAGE_DIALOG (dialog), "%s", info); | ||
2822 | 447 | |||
2823 | 448 | gtk_dialog_add_button (GTK_DIALOG (dialog), | ||
2824 | 449 | action, GTK_RESPONSE_ACCEPT); | ||
2825 | 450 | |||
2826 | 451 | gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL); | ||
2827 | 452 | |||
2828 | 453 | /* FIXME gtk_window_set_title (GTK_WINDOW (dialog), _("Close Document?")); */ | ||
2829 | 454 | gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (window)), | ||
2830 | 455 | GTK_WINDOW (dialog)); | ||
2831 | 456 | |||
2832 | 457 | return dialog; | ||
2833 | 458 | } | ||
2834 | 459 | |||
2835 | 460 | static gboolean | ||
2836 | 461 | confirm_close_with_modified_forms (EphyWindow *window) | ||
2837 | 462 | { | ||
2838 | 463 | GtkWidget *dialog; | ||
2839 | 464 | int response; | ||
2840 | 465 | |||
2841 | 466 | dialog = construct_confirm_close_dialog (window, | ||
2842 | 467 | _("There are unsubmitted changes to form elements"), | ||
2843 | 468 | _("If you close the document anyway, " | ||
2844 | 469 | "you will lose that information."), | ||
2845 | 470 | _("Close _Document")); | ||
2846 | 471 | response = gtk_dialog_run (GTK_DIALOG (dialog)); | ||
2847 | 472 | |||
2848 | 473 | gtk_widget_destroy (dialog); | ||
2849 | 474 | |||
2850 | 475 | return response == GTK_RESPONSE_ACCEPT; | ||
2851 | 476 | } | ||
2852 | 477 | |||
2853 | 478 | static gboolean | ||
2854 | 479 | confirm_close_with_downloads (EphyWindow *window) | ||
2855 | 480 | { | ||
2856 | 481 | GtkWidget *dialog; | ||
2857 | 482 | int response; | ||
2858 | 483 | |||
2859 | 484 | dialog = construct_confirm_close_dialog (window, | ||
2860 | 485 | _("There are ongoing downloads in this window"), | ||
2861 | 486 | _("If you close this window, the downloads will be cancelled"), | ||
2862 | 487 | _("Close window and cancel downloads")); | ||
2863 | 488 | response = gtk_dialog_run (GTK_DIALOG (dialog)); | ||
2864 | 489 | |||
2865 | 490 | gtk_widget_destroy (dialog); | ||
2866 | 491 | |||
2867 | 492 | return response == GTK_RESPONSE_ACCEPT; | ||
2868 | 493 | } | ||
2869 | 494 | |||
2870 | 495 | static void | ||
2871 | 496 | impl_remove_child (EphyEmbedContainer *container, | ||
2872 | 497 | EphyEmbed *child) | ||
2873 | 498 | { | ||
2874 | 499 | EphyWindow *window; | ||
2875 | 500 | |||
2876 | 501 | window = EPHY_WINDOW (container); | ||
2877 | 502 | g_signal_emit_by_name (window->priv->notebook, | ||
2878 | 503 | "tab-close-request", | ||
2879 | 504 | child, window); | ||
2880 | 505 | } | ||
2881 | 506 | |||
2882 | 507 | static EphyEmbed * | ||
2883 | 508 | impl_get_active_child (EphyEmbedContainer *container) | ||
2884 | 509 | { | ||
2885 | 510 | return EPHY_WINDOW (container)->priv->active_embed; | ||
2886 | 511 | } | ||
2887 | 512 | |||
2888 | 513 | static GList * | ||
2889 | 514 | impl_get_children (EphyEmbedContainer *container) | ||
2890 | 515 | { | ||
2891 | 516 | EphyWindow *window = EPHY_WINDOW (container); | ||
2892 | 517 | |||
2893 | 518 | return gtk_container_get_children (GTK_CONTAINER (window->priv->notebook)); | ||
2894 | 519 | } | ||
2895 | 520 | |||
2896 | 521 | static gboolean | ||
2897 | 522 | impl_get_is_popup (EphyEmbedContainer *container) | ||
2898 | 523 | { | ||
2899 | 524 | return EPHY_WINDOW (container)->priv->is_popup; | ||
2900 | 525 | } | ||
2901 | 526 | |||
2902 | 527 | static void | ||
2903 | 528 | ephy_window_embed_container_iface_init (EphyEmbedContainerIface *iface) | ||
2904 | 529 | { | ||
2905 | 530 | iface->add_child = impl_add_child; | ||
2906 | 531 | iface->set_active_child = impl_set_active_child; | ||
2907 | 532 | iface->remove_child = impl_remove_child; | ||
2908 | 533 | iface->get_active_child = impl_get_active_child; | ||
2909 | 534 | iface->get_children = impl_get_children; | ||
2910 | 535 | iface->get_is_popup = impl_get_is_popup; | ||
2911 | 536 | } | ||
2912 | 537 | |||
2913 | 538 | static EphyEmbed * | ||
2914 | 539 | ephy_window_open_link (EphyLink *link, | ||
2915 | 540 | const char *address, | ||
2916 | 541 | EphyEmbed *embed, | ||
2917 | 542 | EphyLinkFlags flags) | ||
2918 | 543 | { | ||
2919 | 544 | EphyWindow *window = EPHY_WINDOW (link); | ||
2920 | 545 | EphyWindowPrivate *priv = window->priv; | ||
2921 | 546 | EphyEmbed *new_embed; | ||
2922 | 547 | |||
2923 | 548 | g_return_val_if_fail (address != NULL, NULL); | ||
2924 | 549 | |||
2925 | 550 | if (embed == NULL) | ||
2926 | 551 | { | ||
2927 | 552 | embed = window->priv->active_embed; | ||
2928 | 553 | } | ||
2929 | 554 | |||
2930 | 555 | if (flags & EPHY_LINK_BOOKMARK) | ||
2931 | 556 | ephy_web_view_set_visit_type (ephy_embed_get_web_view (embed), | ||
2932 | 557 | EPHY_PAGE_VISIT_BOOKMARK); | ||
2933 | 558 | else if (flags & EPHY_LINK_TYPED) | ||
2934 | 559 | ephy_web_view_set_visit_type (ephy_embed_get_web_view (embed), | ||
2935 | 560 | EPHY_PAGE_VISIT_TYPED); | ||
2936 | 561 | |||
2937 | 562 | if (flags & (EPHY_LINK_JUMP_TO | | ||
2938 | 563 | EPHY_LINK_NEW_TAB | | ||
2939 | 564 | EPHY_LINK_NEW_WINDOW)) | ||
2940 | 565 | { | ||
2941 | 566 | EphyNewTabFlags ntflags = 0; | ||
2942 | 567 | EphyWindow *target_window = EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (embed))); | ||
2943 | 568 | |||
2944 | 569 | if (flags & EPHY_LINK_JUMP_TO) | ||
2945 | 570 | { | ||
2946 | 571 | ntflags |= EPHY_NEW_TAB_JUMP; | ||
2947 | 572 | } | ||
2948 | 573 | |||
2949 | 574 | if (flags & EPHY_LINK_NEW_WINDOW || | ||
2950 | 575 | (flags & EPHY_LINK_NEW_TAB && priv->is_popup)) | ||
2951 | 576 | { | ||
2952 | 577 | target_window = ephy_window_new (); | ||
2953 | 578 | } | ||
2954 | 579 | |||
2955 | 580 | if (flags & EPHY_LINK_NEW_TAB_APPEND_AFTER) | ||
2956 | 581 | ntflags |= EPHY_NEW_TAB_APPEND_AFTER; | ||
2957 | 582 | |||
2958 | 583 | new_embed = ephy_shell_new_tab | ||
2959 | 584 | (ephy_shell_get_default (), | ||
2960 | 585 | target_window, | ||
2961 | 586 | embed, ntflags); | ||
2962 | 587 | if (flags & EPHY_LINK_HOME_PAGE) | ||
2963 | 588 | { | ||
2964 | 589 | ephy_web_view_load_homepage (ephy_embed_get_web_view (new_embed)); | ||
2965 | 590 | ephy_window_activate_location (window); | ||
2966 | 591 | } | ||
2967 | 592 | else | ||
2968 | 593 | { | ||
2969 | 594 | ephy_web_view_load_url (ephy_embed_get_web_view (new_embed), address); | ||
2970 | 595 | if (flags & EPHY_LINK_JUMP_TO) | ||
2971 | 596 | { | ||
2972 | 597 | gtk_widget_grab_focus (GTK_WIDGET (new_embed)); | ||
2973 | 598 | } | ||
2974 | 599 | } | ||
2975 | 600 | } | ||
2976 | 601 | else | ||
2977 | 602 | { | ||
2978 | 603 | ephy_web_view_load_url (ephy_embed_get_web_view (embed), address); | ||
2979 | 604 | |||
2980 | 605 | if (address == NULL || address[0] == '\0' || g_str_equal (address, "about:blank")) | ||
2981 | 606 | { | ||
2982 | 607 | ephy_window_activate_location (window); | ||
2983 | 608 | } | ||
2984 | 609 | else | ||
2985 | 610 | { | ||
2986 | 611 | gtk_widget_grab_focus (GTK_WIDGET (embed)); | ||
2987 | 612 | } | ||
2988 | 613 | |||
2989 | 614 | new_embed = embed; | ||
2990 | 615 | } | ||
2991 | 616 | |||
2992 | 617 | return new_embed; | ||
2993 | 618 | } | ||
2994 | 619 | |||
2995 | 620 | static void | ||
2996 | 621 | ephy_window_link_iface_init (EphyLinkIface *iface) | ||
2997 | 622 | { | ||
2998 | 623 | iface->open_link = ephy_window_open_link; | ||
2999 | 624 | } | ||
3000 | 625 | |||
3001 | 626 | G_DEFINE_TYPE_WITH_CODE (EphyWindow, ephy_window, GTK_TYPE_APPLICATION_WINDOW, | ||
3002 | 627 | G_IMPLEMENT_INTERFACE (EPHY_TYPE_LINK, | ||
3003 | 628 | ephy_window_link_iface_init) | ||
3004 | 629 | G_IMPLEMENT_INTERFACE (EPHY_TYPE_EMBED_CONTAINER, | ||
3005 | 630 | ephy_window_embed_container_iface_init)) | ||
3006 | 631 | |||
3007 | 632 | static void | ||
3008 | 633 | settings_change_notify (GtkSettings *settings, | ||
3009 | 634 | EphyWindow *window) | ||
3010 | 635 | { | ||
3011 | 636 | EphyWindowPrivate *priv = window->priv; | ||
3012 | 637 | char *key_theme_name; | ||
3013 | 638 | |||
3014 | 639 | g_object_get (settings, | ||
3015 | 640 | "gtk-key-theme-name", &key_theme_name, | ||
3016 | 641 | NULL); | ||
3017 | 642 | |||
3018 | 643 | priv->key_theme_is_emacs = | ||
3019 | 644 | key_theme_name && | ||
3020 | 645 | g_ascii_strcasecmp (key_theme_name, "Emacs") == 0; | ||
3021 | 646 | |||
3022 | 647 | g_free (key_theme_name); | ||
3023 | 648 | } | ||
3024 | 649 | |||
3025 | 650 | static void | ||
3026 | 651 | settings_changed_cb (GtkSettings *settings) | ||
3027 | 652 | { | ||
3028 | 653 | GList *list, *l; | ||
3029 | 654 | |||
3030 | 655 | /* FIXME: multi-head */ | ||
3031 | 656 | list = gtk_window_list_toplevels (); | ||
3032 | 657 | |||
3033 | 658 | for (l = list; l != NULL; l = l->next) | ||
3034 | 659 | { | ||
3035 | 660 | if (EPHY_IS_WINDOW (l->data)) | ||
3036 | 661 | { | ||
3037 | 662 | settings_change_notify (settings, l->data); | ||
3038 | 663 | } | ||
3039 | 664 | } | ||
3040 | 665 | |||
3041 | 666 | g_list_free (list); | ||
3042 | 667 | } | ||
3043 | 668 | |||
3044 | 669 | static void | ||
3045 | 670 | sync_chromes_visibility (EphyWindow *window) | ||
3046 | 671 | { | ||
3047 | 672 | EphyWindowPrivate *priv = window->priv; | ||
3048 | 673 | gboolean show_tabsbar, show_downloads_box; | ||
3049 | 674 | |||
3050 | 675 | if (priv->closing) | ||
3051 | 676 | return; | ||
3052 | 677 | |||
3053 | 678 | show_tabsbar = (priv->chrome & EPHY_WINDOW_CHROME_TABSBAR); | ||
3054 | 679 | show_downloads_box = (priv->chrome & EPHY_WINDOW_CHROME_DOWNLOADS_BOX); | ||
3055 | 680 | |||
3056 | 681 | ephy_notebook_set_tabs_allowed (EPHY_NOTEBOOK (priv->notebook), | ||
3057 | 682 | show_tabsbar && !(priv->is_popup || priv->fullscreen_mode)); | ||
3058 | 683 | gtk_widget_set_visible (priv->downloads_box, | ||
3059 | 684 | show_downloads_box && !priv->fullscreen_mode); | ||
3060 | 685 | } | ||
3061 | 686 | |||
3062 | 687 | static void | ||
3063 | 688 | ephy_window_set_chrome (EphyWindow *window, | ||
3064 | 689 | EphyWindowChrome chrome) | ||
3065 | 690 | { | ||
3066 | 691 | if (window->priv->chrome == chrome) | ||
3067 | 692 | return; | ||
3068 | 693 | |||
3069 | 694 | window->priv->chrome = chrome; | ||
3070 | 695 | if (window->priv->closing) | ||
3071 | 696 | return; | ||
3072 | 697 | |||
3073 | 698 | g_object_notify (G_OBJECT (window), "chrome"); | ||
3074 | 699 | sync_chromes_visibility (window); | ||
3075 | 700 | } | ||
3076 | 701 | |||
3077 | 702 | static void | ||
3078 | 703 | sync_tab_load_status (EphyWebView *view, | ||
3079 | 704 | WebKitLoadEvent load_event, | ||
3080 | 705 | EphyWindow *window) | ||
3081 | 706 | { | ||
3082 | 707 | EphyWindowPrivate *priv = window->priv; | ||
3083 | 708 | GtkActionGroup *action_group = priv->action_group; | ||
3084 | 709 | GtkAction *action; | ||
3085 | 710 | gboolean loading; | ||
3086 | 711 | |||
3087 | 712 | if (window->priv->closing) return; | ||
3088 | 713 | |||
3089 | 714 | loading = ephy_web_view_is_loading (view); | ||
3090 | 715 | |||
3091 | 716 | action = gtk_action_group_get_action (action_group, "ViewStop"); | ||
3092 | 717 | gtk_action_set_sensitive (action, loading); | ||
3093 | 718 | |||
3094 | 719 | /* disable print while loading, see bug #116344 */ | ||
3095 | 720 | action = gtk_action_group_get_action (action_group, "FilePrint"); | ||
3096 | 721 | ephy_action_change_sensitivity_flags (action, SENS_FLAG_LOADING, loading); | ||
3097 | 722 | |||
3098 | 723 | action = gtk_action_group_get_action (priv->toolbar_action_group, | ||
3099 | 724 | "ViewCombinedStopReload"); | ||
3100 | 725 | ephy_combined_stop_reload_action_set_loading (EPHY_COMBINED_STOP_RELOAD_ACTION (action), | ||
3101 | 726 | loading); | ||
3102 | 727 | } | ||
3103 | 728 | |||
3104 | 729 | static void | ||
3105 | 730 | sync_tab_security (EphyWebView *view, | ||
3106 | 731 | GParamSpec *pspec, | ||
3107 | 732 | EphyWindow *window) | ||
3108 | 733 | { | ||
3109 | 734 | EphyWindowPrivate *priv = window->priv; | ||
3110 | 735 | EphyTitleBox *title_box; | ||
3111 | 736 | EphySecurityLevel security_level; | ||
3112 | 737 | |||
3113 | 738 | if (priv->closing) return; | ||
3114 | 739 | |||
3115 | 740 | ephy_web_view_get_security_level (view, &security_level, NULL, NULL); | ||
3116 | 741 | title_box = ephy_toolbar_get_title_box (EPHY_TOOLBAR (priv->toolbar)); | ||
3117 | 742 | ephy_title_box_set_security_level (title_box, security_level); | ||
3118 | 743 | } | ||
3119 | 744 | |||
3120 | 745 | static void | ||
3121 | 746 | ephy_window_fullscreen (EphyWindow *window) | ||
3122 | 747 | { | ||
3123 | 748 | EphyWindowPrivate *priv = window->priv; | ||
3124 | 749 | EphyEmbed *embed; | ||
3125 | 750 | |||
3126 | 751 | priv->fullscreen_mode = TRUE; | ||
3127 | 752 | |||
3128 | 753 | /* sync status */ | ||
3129 | 754 | embed = window->priv->active_embed; | ||
3130 | 755 | sync_tab_load_status (ephy_embed_get_web_view (embed), WEBKIT_LOAD_STARTED, window); | ||
3131 | 756 | sync_tab_security (ephy_embed_get_web_view (embed), NULL, window); | ||
3132 | 757 | |||
3133 | 758 | sync_chromes_visibility (window); | ||
3134 | 759 | gtk_widget_hide (priv->toolbar); | ||
3135 | 760 | ephy_embed_entering_fullscreen (embed); | ||
3136 | 761 | } | ||
3137 | 762 | |||
3138 | 763 | static void | ||
3139 | 764 | ephy_window_unfullscreen (EphyWindow *window) | ||
3140 | 765 | { | ||
3141 | 766 | window->priv->fullscreen_mode = FALSE; | ||
3142 | 767 | |||
3143 | 768 | gtk_widget_show (window->priv->toolbar); | ||
3144 | 769 | sync_chromes_visibility (window); | ||
3145 | 770 | ephy_embed_leaving_fullscreen (window->priv->active_embed); | ||
3146 | 771 | } | ||
3147 | 772 | |||
3148 | 773 | static gboolean | ||
3149 | 774 | ephy_window_key_press_event (GtkWidget *widget, | ||
3150 | 775 | GdkEventKey *event) | ||
3151 | 776 | { | ||
3152 | 777 | EphyWindow *window = EPHY_WINDOW (widget); | ||
3153 | 778 | EphyWindowPrivate *priv = window->priv; | ||
3154 | 779 | GtkWidget *focus_widget; | ||
3155 | 780 | gboolean shortcircuit = FALSE, force_chain = FALSE, handled = FALSE; | ||
3156 | 781 | guint modifier = event->state & gtk_accelerator_get_default_mod_mask (); | ||
3157 | 782 | guint i; | ||
3158 | 783 | |||
3159 | 784 | /* In an attempt to get the mozembed playing nice with things like emacs keybindings | ||
3160 | 785 | * we are passing important events to the focused child widget before letting the window's | ||
3161 | 786 | * base handler see them. This is *completely against* stated gtk2 policy but the | ||
3162 | 787 | * 'correct' behaviour is exceptionally useless. We need to keep an eye out for | ||
3163 | 788 | * unexpected consequences of this decision. IME's should be a high concern, but | ||
3164 | 789 | * considering that the IME folks complained about the upside-down event propagation | ||
3165 | 790 | * rules, we might be doing them a favour. | ||
3166 | 791 | * | ||
3167 | 792 | * We achieve this by first evaluating the event to see if it's important, and if | ||
3168 | 793 | * so, we get the focus widget and attempt to get the widget to handle that event. | ||
3169 | 794 | * If the widget does handle it, we're done (unless force_chain is true, in which | ||
3170 | 795 | * case the event is handled as normal in addition to being sent to the focus | ||
3171 | 796 | * widget), otherwise the event follows the normal handling path. | ||
3172 | 797 | */ | ||
3173 | 798 | |||
3174 | 799 | if (event->keyval == GDK_KEY_Escape && modifier == 0) | ||
3175 | 800 | { | ||
3176 | 801 | /* Always pass Escape to both the widget, and the parent */ | ||
3177 | 802 | shortcircuit = TRUE; | ||
3178 | 803 | force_chain = TRUE; | ||
3179 | 804 | } | ||
3180 | 805 | else if (priv->key_theme_is_emacs && | ||
3181 | 806 | (modifier == GDK_CONTROL_MASK) && | ||
3182 | 807 | event->length > 0 && | ||
3183 | 808 | /* But don't pass Ctrl+Enter twice */ | ||
3184 | 809 | event->keyval != GDK_KEY_Return && | ||
3185 | 810 | event->keyval != GDK_KEY_KP_Enter && | ||
3186 | 811 | event->keyval != GDK_KEY_ISO_Enter) | ||
3187 | 812 | { | ||
3188 | 813 | /* Pass CTRL+letter characters to the widget */ | ||
3189 | 814 | shortcircuit = TRUE; | ||
3190 | 815 | } | ||
3191 | 816 | |||
3192 | 817 | if (shortcircuit) | ||
3193 | 818 | { | ||
3194 | 819 | focus_widget = gtk_window_get_focus (GTK_WINDOW (window)); | ||
3195 | 820 | |||
3196 | 821 | if (GTK_IS_WIDGET (focus_widget)) | ||
3197 | 822 | { | ||
3198 | 823 | handled = gtk_widget_event (focus_widget, | ||
3199 | 824 | (GdkEvent*) event); | ||
3200 | 825 | } | ||
3201 | 826 | |||
3202 | 827 | if (handled && !force_chain) | ||
3203 | 828 | { | ||
3204 | 829 | return handled; | ||
3205 | 830 | } | ||
3206 | 831 | } | ||
3207 | 832 | |||
3208 | 833 | /* Handle accelerators that we want bound, but aren't associated with | ||
3209 | 834 | * an action */ | ||
3210 | 835 | for (i = 0; i < G_N_ELEMENTS (extra_keybindings); i++) | ||
3211 | 836 | { | ||
3212 | 837 | if (event->keyval == extra_keybindings[i].keyval && | ||
3213 | 838 | modifier == extra_keybindings[i].modifier) | ||
3214 | 839 | { | ||
3215 | 840 | GtkAction * action = gtk_action_group_get_action | ||
3216 | 841 | (extra_keybindings[i].fromToolbar ? | ||
3217 | 842 | priv->toolbar_action_group : | ||
3218 | 843 | priv->action_group, | ||
3219 | 844 | extra_keybindings[i].action); | ||
3220 | 845 | if (gtk_action_is_sensitive (action)) | ||
3221 | 846 | { | ||
3222 | 847 | gtk_action_activate (action); | ||
3223 | 848 | return TRUE; | ||
3224 | 849 | } | ||
3225 | 850 | break; | ||
3226 | 851 | } | ||
3227 | 852 | } | ||
3228 | 853 | |||
3229 | 854 | return GTK_WIDGET_CLASS (ephy_window_parent_class)->key_press_event (widget, event); | ||
3230 | 855 | } | ||
3231 | 856 | |||
3232 | 857 | static gboolean | ||
3233 | 858 | window_has_ongoing_downloads (EphyWindow *window) | ||
3234 | 859 | { | ||
3235 | 860 | GList *l, *downloads; | ||
3236 | 861 | gboolean downloading = FALSE; | ||
3237 | 862 | |||
3238 | 863 | downloads = gtk_container_get_children (GTK_CONTAINER (window->priv->downloads_box)); | ||
3239 | 864 | |||
3240 | 865 | for (l = downloads; l != NULL; l = l->next) | ||
3241 | 866 | { | ||
3242 | 867 | if (EPHY_IS_DOWNLOAD_WIDGET (l->data) != TRUE) | ||
3243 | 868 | continue; | ||
3244 | 869 | |||
3245 | 870 | if (!ephy_download_widget_download_is_finished (EPHY_DOWNLOAD_WIDGET (l->data))) | ||
3246 | 871 | { | ||
3247 | 872 | downloading = TRUE; | ||
3248 | 873 | break; | ||
3249 | 874 | } | ||
3250 | 875 | } | ||
3251 | 876 | g_list_free (downloads); | ||
3252 | 877 | |||
3253 | 878 | return downloading; | ||
3254 | 879 | } | ||
3255 | 880 | |||
3256 | 881 | static gboolean | ||
3257 | 882 | ephy_window_delete_event (GtkWidget *widget, | ||
3258 | 883 | GdkEventAny *event) | ||
3259 | 884 | { | ||
3260 | 885 | if (!ephy_window_close (EPHY_WINDOW (widget))) | ||
3261 | 886 | return TRUE; | ||
3262 | 887 | |||
3263 | 888 | /* proceed with window close */ | ||
3264 | 889 | if (GTK_WIDGET_CLASS (ephy_window_parent_class)->delete_event) | ||
3265 | 890 | { | ||
3266 | 891 | return GTK_WIDGET_CLASS (ephy_window_parent_class)->delete_event (widget, event); | ||
3267 | 892 | } | ||
3268 | 893 | |||
3269 | 894 | return FALSE; | ||
3270 | 895 | } | ||
3271 | 896 | |||
3272 | 897 | #define MAX_SPELL_CHECK_GUESSES 4 | ||
3273 | 898 | |||
3274 | 899 | static void | ||
3275 | 900 | update_link_actions_sensitivity (EphyWindow *window, | ||
3276 | 901 | gboolean link_has_web_scheme) | ||
3277 | 902 | { | ||
3278 | 903 | GtkAction *action; | ||
3279 | 904 | GtkActionGroup *action_group; | ||
3280 | 905 | |||
3281 | 906 | action_group = window->priv->popups_action_group; | ||
3282 | 907 | |||
3283 | 908 | action = gtk_action_group_get_action (action_group, "OpenLinkInNewWindow"); | ||
3284 | 909 | gtk_action_set_sensitive (action, link_has_web_scheme); | ||
3285 | 910 | |||
3286 | 911 | action = gtk_action_group_get_action (action_group, "OpenLinkInNewTab"); | ||
3287 | 912 | ephy_action_change_sensitivity_flags (action, SENS_FLAG_CONTEXT, !link_has_web_scheme); | ||
3288 | 913 | } | ||
3289 | 914 | |||
3290 | 915 | static void | ||
3291 | 916 | update_edit_action_sensitivity (EphyWindow *window, const gchar *action_name, gboolean sensitive, gboolean hide) | ||
3292 | 917 | { | ||
3293 | 918 | GtkAction *action; | ||
3294 | 919 | |||
3295 | 920 | action = gtk_action_group_get_action (window->priv->action_group, action_name); | ||
3296 | 921 | gtk_action_set_sensitive (action, sensitive); | ||
3297 | 922 | gtk_action_set_visible (action, !hide || sensitive); | ||
3298 | 923 | } | ||
3299 | 924 | |||
3300 | 925 | typedef struct | ||
3301 | 926 | { | ||
3302 | 927 | EphyWindow *window; | ||
3303 | 928 | const gchar *action_name; | ||
3304 | 929 | gboolean hide; | ||
3305 | 930 | } CanEditCommandAsyncData; | ||
3306 | 931 | |||
3307 | 932 | static CanEditCommandAsyncData * | ||
3308 | 933 | can_edit_command_async_data_new (EphyWindow *window, const gchar *action_name, gboolean hide) | ||
3309 | 934 | { | ||
3310 | 935 | CanEditCommandAsyncData *data; | ||
3311 | 936 | |||
3312 | 937 | data = g_slice_new (CanEditCommandAsyncData); | ||
3313 | 938 | data->window = g_object_ref (window); | ||
3314 | 939 | data->action_name = action_name; | ||
3315 | 940 | data->hide = hide; | ||
3316 | 941 | |||
3317 | 942 | return data; | ||
3318 | 943 | } | ||
3319 | 944 | |||
3320 | 945 | static void | ||
3321 | 946 | can_edit_command_async_data_free (CanEditCommandAsyncData *data) | ||
3322 | 947 | { | ||
3323 | 948 | if (G_UNLIKELY (!data)) | ||
3324 | 949 | return; | ||
3325 | 950 | |||
3326 | 951 | g_object_unref (data->window); | ||
3327 | 952 | g_slice_free (CanEditCommandAsyncData, data); | ||
3328 | 953 | } | ||
3329 | 954 | |||
3330 | 955 | static void | ||
3331 | 956 | can_edit_command_callback (GObject *object, GAsyncResult *result, CanEditCommandAsyncData *data) | ||
3332 | 957 | { | ||
3333 | 958 | gboolean sensitive; | ||
3334 | 959 | GError *error = NULL; | ||
3335 | 960 | |||
3336 | 961 | sensitive = webkit_web_view_can_execute_editing_command_finish (WEBKIT_WEB_VIEW (object), result, &error); | ||
3337 | 962 | if (!error) | ||
3338 | 963 | { | ||
3339 | 964 | update_edit_action_sensitivity (data->window, data->action_name, sensitive, data->hide); | ||
3340 | 965 | |||
3341 | 966 | } | ||
3342 | 967 | else | ||
3343 | 968 | { | ||
3344 | 969 | g_error_free (error); | ||
3345 | 970 | } | ||
3346 | 971 | |||
3347 | 972 | can_edit_command_async_data_free (data); | ||
3348 | 973 | } | ||
3349 | 974 | |||
3350 | 975 | static void | ||
3351 | 976 | update_edit_actions_sensitivity (EphyWindow *window, gboolean hide) | ||
3352 | 977 | { | ||
3353 | 978 | GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window)); | ||
3354 | 979 | gboolean can_copy, can_cut, can_undo, can_redo, can_paste; | ||
3355 | 980 | |||
3356 | 981 | if (GTK_IS_EDITABLE (widget)) | ||
3357 | 982 | { | ||
3358 | 983 | GtkWidget *entry; | ||
3359 | 984 | gboolean has_selection; | ||
3360 | 985 | |||
3361 | 986 | entry = ephy_toolbar_get_location_entry (EPHY_TOOLBAR (window->priv->toolbar)); | ||
3362 | 987 | |||
3363 | 988 | has_selection = gtk_editable_get_selection_bounds | ||
3364 | 989 | (GTK_EDITABLE (widget), NULL, NULL); | ||
3365 | 990 | |||
3366 | 991 | can_copy = has_selection; | ||
3367 | 992 | can_cut = has_selection; | ||
3368 | 993 | can_paste = TRUE; | ||
3369 | 994 | can_undo = ephy_location_entry_get_can_undo (EPHY_LOCATION_ENTRY (entry)); | ||
3370 | 995 | can_redo = ephy_location_entry_get_can_redo (EPHY_LOCATION_ENTRY (entry)); | ||
3371 | 996 | } | ||
3372 | 997 | else | ||
3373 | 998 | { | ||
3374 | 999 | EphyEmbed *embed; | ||
3375 | 1000 | WebKitWebView *view; | ||
3376 | 1001 | CanEditCommandAsyncData *data; | ||
3377 | 1002 | |||
3378 | 1003 | embed = window->priv->active_embed; | ||
3379 | 1004 | g_return_if_fail (embed != NULL); | ||
3380 | 1005 | |||
3381 | 1006 | view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); | ||
3382 | 1007 | |||
3383 | 1008 | data = can_edit_command_async_data_new (window, "EditCopy", hide); | ||
3384 | 1009 | webkit_web_view_can_execute_editing_command (view, WEBKIT_EDITING_COMMAND_COPY, NULL, | ||
3385 | 1010 | (GAsyncReadyCallback)can_edit_command_callback, | ||
3386 | 1011 | data); | ||
3387 | 1012 | data = can_edit_command_async_data_new (window, "EditCut", hide); | ||
3388 | 1013 | webkit_web_view_can_execute_editing_command (view, WEBKIT_EDITING_COMMAND_CUT, NULL, | ||
3389 | 1014 | (GAsyncReadyCallback)can_edit_command_callback, | ||
3390 | 1015 | data); | ||
3391 | 1016 | data = can_edit_command_async_data_new (window, "EditPaste", hide); | ||
3392 | 1017 | webkit_web_view_can_execute_editing_command (view, WEBKIT_EDITING_COMMAND_PASTE, NULL, | ||
3393 | 1018 | (GAsyncReadyCallback)can_edit_command_callback, | ||
3394 | 1019 | data); | ||
3395 | 1020 | data = can_edit_command_async_data_new (window, "EditUndo", hide); | ||
3396 | 1021 | webkit_web_view_can_execute_editing_command (view, "Undo", NULL, | ||
3397 | 1022 | (GAsyncReadyCallback)can_edit_command_callback, | ||
3398 | 1023 | data); | ||
3399 | 1024 | data = can_edit_command_async_data_new (window, "EditRedo", hide); | ||
3400 | 1025 | webkit_web_view_can_execute_editing_command (view, "Redo", NULL, | ||
3401 | 1026 | (GAsyncReadyCallback)can_edit_command_callback, | ||
3402 | 1027 | data); | ||
3403 | 1028 | return; | ||
3404 | 1029 | } | ||
3405 | 1030 | |||
3406 | 1031 | update_edit_action_sensitivity (window, "EditCopy", can_copy, hide); | ||
3407 | 1032 | update_edit_action_sensitivity (window, "EditCut", can_cut, hide); | ||
3408 | 1033 | update_edit_action_sensitivity (window, "EditPaste", can_paste, hide); | ||
3409 | 1034 | update_edit_action_sensitivity (window, "EditUndo", can_undo, hide); | ||
3410 | 1035 | update_edit_action_sensitivity (window, "EditRedo", can_redo, hide); | ||
3411 | 1036 | } | ||
3412 | 1037 | |||
3413 | 1038 | static void | ||
3414 | 1039 | enable_edit_actions_sensitivity (EphyWindow *window) | ||
3415 | 1040 | { | ||
3416 | 1041 | GtkActionGroup *action_group; | ||
3417 | 1042 | GtkAction *action; | ||
3418 | 1043 | |||
3419 | 1044 | action_group = window->priv->action_group; | ||
3420 | 1045 | |||
3421 | 1046 | action = gtk_action_group_get_action (action_group, "EditCopy"); | ||
3422 | 1047 | gtk_action_set_sensitive (action, TRUE); | ||
3423 | 1048 | gtk_action_set_visible (action, TRUE); | ||
3424 | 1049 | action = gtk_action_group_get_action (action_group, "EditCut"); | ||
3425 | 1050 | gtk_action_set_sensitive (action, TRUE); | ||
3426 | 1051 | gtk_action_set_visible (action, TRUE); | ||
3427 | 1052 | action = gtk_action_group_get_action (action_group, "EditPaste"); | ||
3428 | 1053 | gtk_action_set_sensitive (action, TRUE); | ||
3429 | 1054 | gtk_action_set_visible (action, TRUE); | ||
3430 | 1055 | action = gtk_action_group_get_action (action_group, "EditUndo"); | ||
3431 | 1056 | gtk_action_set_sensitive (action, TRUE); | ||
3432 | 1057 | gtk_action_set_visible (action, TRUE); | ||
3433 | 1058 | action = gtk_action_group_get_action (action_group, "EditRedo"); | ||
3434 | 1059 | gtk_action_set_sensitive (action, TRUE); | ||
3435 | 1060 | gtk_action_set_visible (action, TRUE); | ||
3436 | 1061 | } | ||
3437 | 1062 | |||
3438 | 1063 | static void | ||
3439 | 1064 | edit_menu_show_cb (GtkWidget *menu, | ||
3440 | 1065 | EphyWindow *window) | ||
3441 | 1066 | { | ||
3442 | 1067 | update_edit_actions_sensitivity (window, FALSE); | ||
3443 | 1068 | } | ||
3444 | 1069 | |||
3445 | 1070 | static void | ||
3446 | 1071 | edit_menu_hide_cb (GtkWidget *menu, | ||
3447 | 1072 | EphyWindow *window) | ||
3448 | 1073 | { | ||
3449 | 1074 | enable_edit_actions_sensitivity (window); | ||
3450 | 1075 | } | ||
3451 | 1076 | |||
3452 | 1077 | static void | ||
3453 | 1078 | init_menu_updaters (EphyWindow *window) | ||
3454 | 1079 | { | ||
3455 | 1080 | GtkWidget *edit_menu; | ||
3456 | 1081 | |||
3457 | 1082 | edit_menu = gtk_ui_manager_get_widget | ||
3458 | 1083 | (window->priv->manager, "/ui/PagePopup"); | ||
3459 | 1084 | |||
3460 | 1085 | g_signal_connect (edit_menu, "show", | ||
3461 | 1086 | G_CALLBACK (edit_menu_show_cb), window); | ||
3462 | 1087 | g_signal_connect (edit_menu, "hide", | ||
3463 | 1088 | G_CALLBACK (edit_menu_hide_cb), window); | ||
3464 | 1089 | } | ||
3465 | 1090 | |||
3466 | 1091 | static void | ||
3467 | 1092 | setup_ui_manager (EphyWindow *window) | ||
3468 | 1093 | { | ||
3469 | 1094 | GtkActionGroup *action_group; | ||
3470 | 1095 | GtkAccelGroup *accel_group; | ||
3471 | 1096 | GtkAction *action; | ||
3472 | 1097 | GtkUIManager *manager; | ||
3473 | 1098 | |||
3474 | 1099 | window->priv->main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); | ||
3475 | 1100 | gtk_widget_show (window->priv->main_vbox); | ||
3476 | 1101 | gtk_container_add (GTK_CONTAINER (window), | ||
3477 | 1102 | window->priv->main_vbox); | ||
3478 | 1103 | |||
3479 | 1104 | manager = gtk_ui_manager_new (); | ||
3480 | 1105 | accel_group = gtk_ui_manager_get_accel_group (manager); | ||
3481 | 1106 | |||
3482 | 1107 | action_group = gtk_action_group_new ("WindowActions"); | ||
3483 | 1108 | gtk_action_group_set_translation_domain (action_group, NULL); | ||
3484 | 1109 | gtk_action_group_add_actions (action_group, ephy_menu_entries, | ||
3485 | 1110 | G_N_ELEMENTS (ephy_menu_entries), window); | ||
3486 | 1111 | gtk_action_group_add_toggle_actions (action_group, | ||
3487 | 1112 | ephy_menu_toggle_entries, | ||
3488 | 1113 | G_N_ELEMENTS (ephy_menu_toggle_entries), | ||
3489 | 1114 | window); | ||
3490 | 1115 | gtk_action_group_set_accel_group (action_group, accel_group); | ||
3491 | 1116 | gtk_ui_manager_insert_action_group (manager, action_group, 0); | ||
3492 | 1117 | window->priv->action_group = action_group; | ||
3493 | 1118 | g_object_unref (action_group); | ||
3494 | 1119 | |||
3495 | 1120 | action = gtk_action_group_get_action (action_group, "FileOpen"); | ||
3496 | 1121 | g_object_set (action, "short_label", _("Open"), NULL); | ||
3497 | 1122 | action = gtk_action_group_get_action (action_group, "FileSaveAs"); | ||
3498 | 1123 | g_object_set (action, "short_label", _("Save As"), NULL); | ||
3499 | 1124 | action = gtk_action_group_get_action (action_group, "FileSaveAsApplication"); | ||
3500 | 1125 | g_object_set (action, "short_label", _("Save As Application"), NULL); | ||
3501 | 1126 | action = gtk_action_group_get_action (action_group, "FilePrint"); | ||
3502 | 1127 | g_object_set (action, "short_label", _("Print"), NULL); | ||
3503 | 1128 | action = gtk_action_group_get_action (action_group, "FileBookmarkPage"); | ||
3504 | 1129 | g_object_set (action, "short_label", _("Bookmark"), NULL); | ||
3505 | 1130 | action = gtk_action_group_get_action (action_group, "EditFind"); | ||
3506 | 1131 | g_object_set (action, "short_label", _("Find"), NULL); | ||
3507 | 1132 | |||
3508 | 1133 | action = gtk_action_group_get_action (action_group, "EditFind"); | ||
3509 | 1134 | g_object_set (action, "is_important", TRUE, NULL); | ||
3510 | 1135 | |||
3511 | 1136 | action = gtk_action_group_get_action (action_group, "ViewEncoding"); | ||
3512 | 1137 | g_object_set (action, "hide_if_empty", FALSE, NULL); | ||
3513 | 1138 | action = gtk_action_group_get_action (action_group, "ViewZoomIn"); | ||
3514 | 1139 | /* Translators: This refers to text size */ | ||
3515 | 1140 | g_object_set (action, "short-label", _("Larger"), NULL); | ||
3516 | 1141 | action = gtk_action_group_get_action (action_group, "ViewZoomOut"); | ||
3517 | 1142 | /* Translators: This refers to text size */ | ||
3518 | 1143 | g_object_set (action, "short-label", _("Smaller"), NULL); | ||
3519 | 1144 | |||
3520 | 1145 | action_group = gtk_action_group_new ("PopupsActions"); | ||
3521 | 1146 | gtk_action_group_set_translation_domain (action_group, NULL); | ||
3522 | 1147 | gtk_action_group_add_actions (action_group, ephy_popups_entries, | ||
3523 | 1148 | G_N_ELEMENTS (ephy_popups_entries), window); | ||
3524 | 1149 | gtk_action_group_set_accel_group (action_group, accel_group); | ||
3525 | 1150 | gtk_ui_manager_insert_action_group (manager, action_group, 0); | ||
3526 | 1151 | window->priv->popups_action_group = action_group; | ||
3527 | 1152 | g_object_unref (action_group); | ||
3528 | 1153 | |||
3529 | 1154 | /* Tab accels */ | ||
3530 | 1155 | action_group = gtk_action_group_new ("TabAccelsActions"); | ||
3531 | 1156 | gtk_action_group_set_accel_group (action_group, accel_group); | ||
3532 | 1157 | gtk_ui_manager_insert_action_group (manager, action_group, 0); | ||
3533 | 1158 | window->priv->tab_accels_action_group = action_group; | ||
3534 | 1159 | g_object_unref (action_group); | ||
3535 | 1160 | |||
3536 | 1161 | action_group = gtk_action_group_new ("SpecialToolbarActions"); | ||
3537 | 1162 | action = | ||
3538 | 1163 | g_object_new (EPHY_TYPE_NAVIGATION_HISTORY_ACTION, | ||
3539 | 1164 | "name", "NavigationBack", | ||
3540 | 1165 | "label", _("Back"), | ||
3541 | 1166 | "icon-name", "go-previous-symbolic", | ||
3542 | 1167 | "window", window, | ||
3543 | 1168 | "direction", EPHY_NAVIGATION_HISTORY_DIRECTION_BACK, | ||
3544 | 1169 | NULL); | ||
3545 | 1170 | gtk_action_group_add_action_with_accel (action_group, action, | ||
3546 | 1171 | "<alt>Left"); | ||
3547 | 1172 | g_object_unref (action); | ||
3548 | 1173 | |||
3549 | 1174 | action = | ||
3550 | 1175 | g_object_new (EPHY_TYPE_NAVIGATION_HISTORY_ACTION, | ||
3551 | 1176 | "name", "NavigationForward", | ||
3552 | 1177 | "label", _("Forward"), | ||
3553 | 1178 | "icon-name", "go-next-symbolic", | ||
3554 | 1179 | "window", window, | ||
3555 | 1180 | "direction", EPHY_NAVIGATION_HISTORY_DIRECTION_FORWARD, | ||
3556 | 1181 | NULL); | ||
3557 | 1182 | gtk_action_group_add_action_with_accel (action_group, action, | ||
3558 | 1183 | "<alt>Right"); | ||
3559 | 1184 | g_object_unref (action); | ||
3560 | 1185 | |||
3561 | 1186 | action = | ||
3562 | 1187 | g_object_new (EPHY_TYPE_ZOOM_ACTION, | ||
3563 | 1188 | "name", "Zoom", | ||
3564 | 1189 | "label", _("Zoom"), | ||
3565 | 1190 | "zoom", 1.0, | ||
3566 | 1191 | NULL); | ||
3567 | 1192 | gtk_action_group_add_action (action_group, action); | ||
3568 | 1193 | g_object_unref (action); | ||
3569 | 1194 | |||
3570 | 1195 | action = g_object_new (EPHY_TYPE_HOME_ACTION, | ||
3571 | 1196 | "name", "FileNewTab", | ||
3572 | 1197 | "icon-name", "tab-new-symbolic", | ||
3573 | 1198 | "label", _("New _Tab"), | ||
3574 | 1199 | NULL); | ||
3575 | 1200 | gtk_action_group_add_action_with_accel (action_group, action, "<control>T"); | ||
3576 | 1201 | g_object_unref (action); | ||
3577 | 1202 | |||
3578 | 1203 | action = | ||
3579 | 1204 | g_object_new (EPHY_TYPE_HOME_ACTION, | ||
3580 | 1205 | "name", "FileHome", | ||
3581 | 1206 | "label", _("Go to most visited"), | ||
3582 | 1207 | NULL); | ||
3583 | 1208 | gtk_action_group_add_action_with_accel (action_group, action, "<alt>Home"); | ||
3584 | 1209 | g_signal_connect_swapped (action, "open-link", | ||
3585 | 1210 | G_CALLBACK (ephy_link_open), window); | ||
3586 | 1211 | g_object_unref (action); | ||
3587 | 1212 | |||
3588 | 1213 | action = g_object_new (EPHY_TYPE_COMBINED_STOP_RELOAD_ACTION, | ||
3589 | 1214 | "name", "ViewCombinedStopReload", | ||
3590 | 1215 | "loading", FALSE, | ||
3591 | 1216 | "window", window, | ||
3592 | 1217 | NULL); | ||
3593 | 1218 | gtk_action_group_add_action (action_group, action); | ||
3594 | 1219 | g_object_unref (action); | ||
3595 | 1220 | |||
3596 | 1221 | gtk_action_group_set_accel_group (action_group, accel_group); | ||
3597 | 1222 | gtk_ui_manager_insert_action_group (manager, action_group, 0); | ||
3598 | 1223 | window->priv->toolbar_action_group = action_group; | ||
3599 | 1224 | g_object_unref (action_group); | ||
3600 | 1225 | |||
3601 | 1226 | window->priv->manager = manager; | ||
3602 | 1227 | gtk_window_add_accel_group (GTK_WINDOW (window), accel_group); | ||
3603 | 1228 | } | ||
3604 | 1229 | |||
3605 | 1230 | static char * | ||
3606 | 1231 | calculate_location (const char *typed_address, const char *address) | ||
3607 | 1232 | { | ||
3608 | 1233 | const char *location; | ||
3609 | 1234 | |||
3610 | 1235 | /* If there's a typed address, use that over address. Never | ||
3611 | 1236 | * show URIs in the 'do_not_show_address' array. */ | ||
3612 | 1237 | location = typed_address ? typed_address : address; | ||
3613 | 1238 | location = ephy_embed_utils_is_no_show_address (location) ? NULL : location; | ||
3614 | 1239 | |||
3615 | 1240 | return g_strdup (location); | ||
3616 | 1241 | } | ||
3617 | 1242 | |||
3618 | 1243 | static void | ||
3619 | 1244 | _ephy_window_set_default_actions_sensitive (EphyWindow *window, | ||
3620 | 1245 | guint flags, | ||
3621 | 1246 | gboolean set) | ||
3622 | 1247 | { | ||
3623 | 1248 | EphyWindowPrivate *priv = window->priv; | ||
3624 | 1249 | GtkActionGroup *action_group; | ||
3625 | 1250 | GtkAction *action; | ||
3626 | 1251 | int i; | ||
3627 | 1252 | const char *action_group_actions[] = { "FileSaveAs", "FileSaveAsApplication", "FilePrint", | ||
3628 | 1253 | "FileSendTo", "FileBookmarkPage", "EditFind", | ||
3629 | 1254 | "EditFindPrev", "EditFindNext", "ViewEncoding", | ||
3630 | 1255 | "ViewZoomIn", "ViewZoomOut", "ViewPageSource", | ||
3631 | 1256 | NULL }; | ||
3632 | 1257 | |||
3633 | 1258 | action_group = priv->action_group; | ||
3634 | 1259 | |||
3635 | 1260 | /* Page menu */ | ||
3636 | 1261 | for (i = 0; action_group_actions[i] != NULL; i++) | ||
3637 | 1262 | { | ||
3638 | 1263 | action = gtk_action_group_get_action (action_group, | ||
3639 | 1264 | action_group_actions[i]); | ||
3640 | 1265 | ephy_action_change_sensitivity_flags (action, | ||
3641 | 1266 | flags, set); | ||
3642 | 1267 | } | ||
3643 | 1268 | |||
3644 | 1269 | /* Page context popup */ | ||
3645 | 1270 | action = gtk_action_group_get_action (priv->popups_action_group, | ||
3646 | 1271 | "ContextBookmarkPage"); | ||
3647 | 1272 | ephy_action_change_sensitivity_flags (action, | ||
3648 | 1273 | flags, set); | ||
3649 | 1274 | |||
3650 | 1275 | /* Toolbar */ | ||
3651 | 1276 | action = gtk_action_group_get_action (priv->toolbar_action_group, | ||
3652 | 1277 | "ViewCombinedStopReload"); | ||
3653 | 1278 | ephy_action_change_sensitivity_flags (action, | ||
3654 | 1279 | flags, set); | ||
3655 | 1280 | } | ||
3656 | 1281 | |||
3657 | 1282 | static void | ||
3658 | 1283 | sync_tab_address (EphyWebView *view, | ||
3659 | 1284 | GParamSpec *pspec, | ||
3660 | 1285 | EphyWindow *window) | ||
3661 | 1286 | { | ||
3662 | 1287 | EphyWindowPrivate *priv = window->priv; | ||
3663 | 1288 | const char *address; | ||
3664 | 1289 | const char *typed_address; | ||
3665 | 1290 | char *location; | ||
3666 | 1291 | |||
3667 | 1292 | if (priv->closing) return; | ||
3668 | 1293 | |||
3669 | 1294 | address = ephy_web_view_get_address (view); | ||
3670 | 1295 | typed_address = ephy_web_view_get_typed_address (view); | ||
3671 | 1296 | |||
3672 | 1297 | _ephy_window_set_default_actions_sensitive (window, | ||
3673 | 1298 | SENS_FLAG_IS_BLANK, | ||
3674 | 1299 | ephy_web_view_is_overview (view)); | ||
3675 | 1300 | |||
3676 | 1301 | location = calculate_location (typed_address, address); | ||
3677 | 1302 | ephy_window_set_location (window, location); | ||
3678 | 1303 | g_free (location); | ||
3679 | 1304 | } | ||
3680 | 1305 | |||
3681 | 1306 | static void | ||
3682 | 1307 | sync_tab_zoom (WebKitWebView *web_view, GParamSpec *pspec, EphyWindow *window) | ||
3683 | 1308 | { | ||
3684 | 1309 | GtkActionGroup *action_group; | ||
3685 | 1310 | GtkAction *action; | ||
3686 | 1311 | gboolean can_zoom_in = TRUE, can_zoom_out = TRUE, can_zoom_normal = FALSE; | ||
3687 | 1312 | double zoom; | ||
3688 | 1313 | |||
3689 | 1314 | if (window->priv->closing) return; | ||
3690 | 1315 | |||
3691 | 1316 | zoom = webkit_web_view_get_zoom_level (web_view); | ||
3692 | 1317 | |||
3693 | 1318 | if (zoom >= ZOOM_MAXIMAL) | ||
3694 | 1319 | { | ||
3695 | 1320 | can_zoom_in = FALSE; | ||
3696 | 1321 | } | ||
3697 | 1322 | |||
3698 | 1323 | if (zoom <= ZOOM_MINIMAL) | ||
3699 | 1324 | { | ||
3700 | 1325 | can_zoom_out = FALSE; | ||
3701 | 1326 | } | ||
3702 | 1327 | |||
3703 | 1328 | if (zoom != 1.0) | ||
3704 | 1329 | { | ||
3705 | 1330 | can_zoom_normal = TRUE; | ||
3706 | 1331 | } | ||
3707 | 1332 | |||
3708 | 1333 | action_group = window->priv->action_group; | ||
3709 | 1334 | action = gtk_action_group_get_action (action_group, "ViewZoomIn"); | ||
3710 | 1335 | gtk_action_set_sensitive (action, can_zoom_in); | ||
3711 | 1336 | action = gtk_action_group_get_action (action_group, "ViewZoomOut"); | ||
3712 | 1337 | gtk_action_set_sensitive (action, can_zoom_out); | ||
3713 | 1338 | action = gtk_action_group_get_action (action_group, "ViewZoomNormal"); | ||
3714 | 1339 | gtk_action_set_sensitive (action, can_zoom_normal); | ||
3715 | 1340 | } | ||
3716 | 1341 | |||
3717 | 1342 | static void | ||
3718 | 1343 | sync_tab_document_type (EphyWebView *view, | ||
3719 | 1344 | GParamSpec *pspec, | ||
3720 | 1345 | EphyWindow *window) | ||
3721 | 1346 | { | ||
3722 | 1347 | EphyWindowPrivate *priv = window->priv; | ||
3723 | 1348 | GtkActionGroup *action_group = priv->action_group; | ||
3724 | 1349 | GtkAction *action; | ||
3725 | 1350 | EphyWebViewDocumentType type; | ||
3726 | 1351 | gboolean can_find, disable, is_image; | ||
3727 | 1352 | |||
3728 | 1353 | if (priv->closing) return; | ||
3729 | 1354 | |||
3730 | 1355 | /* update zoom actions */ | ||
3731 | 1356 | sync_tab_zoom (WEBKIT_WEB_VIEW (view), NULL, window); | ||
3732 | 1357 | |||
3733 | 1358 | type = ephy_web_view_get_document_type (view); | ||
3734 | 1359 | can_find = (type != EPHY_WEB_VIEW_DOCUMENT_IMAGE); | ||
3735 | 1360 | is_image = type == EPHY_WEB_VIEW_DOCUMENT_IMAGE; | ||
3736 | 1361 | disable = (type != EPHY_WEB_VIEW_DOCUMENT_HTML); | ||
3737 | 1362 | |||
3738 | 1363 | action = gtk_action_group_get_action (action_group, "ViewEncoding"); | ||
3739 | 1364 | ephy_action_change_sensitivity_flags (action, SENS_FLAG_DOCUMENT, disable); | ||
3740 | 1365 | action = gtk_action_group_get_action (action_group, "ViewPageSource"); | ||
3741 | 1366 | ephy_action_change_sensitivity_flags (action, SENS_FLAG_DOCUMENT, is_image); | ||
3742 | 1367 | action = gtk_action_group_get_action (action_group, "EditFind"); | ||
3743 | 1368 | ephy_action_change_sensitivity_flags (action, SENS_FLAG_DOCUMENT, !can_find); | ||
3744 | 1369 | action = gtk_action_group_get_action (action_group, "EditFindNext"); | ||
3745 | 1370 | ephy_action_change_sensitivity_flags (action, SENS_FLAG_DOCUMENT, !can_find); | ||
3746 | 1371 | action = gtk_action_group_get_action (action_group, "EditFindPrev"); | ||
3747 | 1372 | ephy_action_change_sensitivity_flags (action, SENS_FLAG_DOCUMENT, !can_find); | ||
3748 | 1373 | |||
3749 | 1374 | if (!can_find) | ||
3750 | 1375 | { | ||
3751 | 1376 | ephy_find_toolbar_request_close (ephy_embed_get_find_toolbar (priv->active_embed)); | ||
3752 | 1377 | } | ||
3753 | 1378 | } | ||
3754 | 1379 | |||
3755 | 1380 | static void | ||
3756 | 1381 | _ephy_window_action_set_favicon (EphyWindow *window, | ||
3757 | 1382 | GdkPixbuf *icon) | ||
3758 | 1383 | { | ||
3759 | 1384 | EphyWindowPrivate *priv = window->priv; | ||
3760 | 1385 | |||
3761 | 1386 | g_object_set (priv->location_controller, "icon", icon, NULL); | ||
3762 | 1387 | } | ||
3763 | 1388 | |||
3764 | 1389 | static void | ||
3765 | 1390 | sync_tab_icon (EphyWebView *view, | ||
3766 | 1391 | GParamSpec *pspec, | ||
3767 | 1392 | EphyWindow *window) | ||
3768 | 1393 | { | ||
3769 | 1394 | EphyWindowPrivate *priv = window->priv; | ||
3770 | 1395 | GdkPixbuf *icon; | ||
3771 | 1396 | |||
3772 | 1397 | if (priv->closing) return; | ||
3773 | 1398 | |||
3774 | 1399 | icon = ephy_web_view_get_icon (view); | ||
3775 | 1400 | |||
3776 | 1401 | _ephy_window_action_set_favicon (window, icon); | ||
3777 | 1402 | } | ||
3778 | 1403 | |||
3779 | 1404 | static void | ||
3780 | 1405 | _ephy_window_set_navigation_flags (EphyWindow *window, | ||
3781 | 1406 | EphyWebViewNavigationFlags flags) | ||
3782 | 1407 | { | ||
3783 | 1408 | GtkAction *action; | ||
3784 | 1409 | |||
3785 | 1410 | action = gtk_action_group_get_action (window->priv->toolbar_action_group, "NavigationBack"); | ||
3786 | 1411 | gtk_action_set_sensitive (action, flags & EPHY_WEB_VIEW_NAV_BACK); | ||
3787 | 1412 | action = gtk_action_group_get_action (window->priv->toolbar_action_group, "NavigationForward"); | ||
3788 | 1413 | gtk_action_set_sensitive (action, flags & EPHY_WEB_VIEW_NAV_FORWARD); | ||
3789 | 1414 | } | ||
3790 | 1415 | |||
3791 | 1416 | static void | ||
3792 | 1417 | sync_tab_navigation (EphyWebView *view, | ||
3793 | 1418 | GParamSpec *pspec, | ||
3794 | 1419 | EphyWindow *window) | ||
3795 | 1420 | { | ||
3796 | 1421 | if (window->priv->closing) return; | ||
3797 | 1422 | |||
3798 | 1423 | _ephy_window_set_navigation_flags (window, | ||
3799 | 1424 | ephy_web_view_get_navigation_flags (view)); | ||
3800 | 1425 | } | ||
3801 | 1426 | |||
3802 | 1427 | static void | ||
3803 | 1428 | sync_tab_is_blank (EphyWebView *view, | ||
3804 | 1429 | GParamSpec *pspec, | ||
3805 | 1430 | EphyWindow *window) | ||
3806 | 1431 | { | ||
3807 | 1432 | if (window->priv->closing) return; | ||
3808 | 1433 | |||
3809 | 1434 | _ephy_window_set_default_actions_sensitive (window, | ||
3810 | 1435 | SENS_FLAG_IS_BLANK, | ||
3811 | 1436 | ephy_web_view_get_is_blank (view)); | ||
3812 | 1437 | } | ||
3813 | 1438 | |||
3814 | 1439 | static void | ||
3815 | 1440 | sync_tab_popup_windows (EphyWebView *view, | ||
3816 | 1441 | GParamSpec *pspec, | ||
3817 | 1442 | EphyWindow *window) | ||
3818 | 1443 | { | ||
3819 | 1444 | /* FIXME: show popup count somehow */ | ||
3820 | 1445 | } | ||
3821 | 1446 | |||
3822 | 1447 | static void | ||
3823 | 1448 | sync_tab_popups_allowed (EphyWebView *view, | ||
3824 | 1449 | GParamSpec *pspec, | ||
3825 | 1450 | EphyWindow *window) | ||
3826 | 1451 | { | ||
3827 | 1452 | GtkAction *action; | ||
3828 | 1453 | gboolean allow; | ||
3829 | 1454 | |||
3830 | 1455 | g_return_if_fail (EPHY_IS_WEB_VIEW (view)); | ||
3831 | 1456 | g_return_if_fail (EPHY_IS_WINDOW (window)); | ||
3832 | 1457 | |||
3833 | 1458 | action = gtk_action_group_get_action (window->priv->action_group, | ||
3834 | 1459 | "ViewPopupWindows"); | ||
3835 | 1460 | g_return_if_fail (GTK_IS_ACTION (action)); | ||
3836 | 1461 | |||
3837 | 1462 | g_object_get (view, "popups-allowed", &allow, NULL); | ||
3838 | 1463 | |||
3839 | 1464 | g_signal_handlers_block_by_func | ||
3840 | 1465 | (G_OBJECT (action), | ||
3841 | 1466 | G_CALLBACK (ephy_window_view_popup_windows_cb), | ||
3842 | 1467 | window); | ||
3843 | 1468 | |||
3844 | 1469 | gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), allow); | ||
3845 | 1470 | |||
3846 | 1471 | g_signal_handlers_unblock_by_func | ||
3847 | 1472 | (G_OBJECT (action), | ||
3848 | 1473 | G_CALLBACK (ephy_window_view_popup_windows_cb), | ||
3849 | 1474 | window); | ||
3850 | 1475 | } | ||
3851 | 1476 | |||
3852 | 1477 | static void | ||
3853 | 1478 | sync_tab_title (EphyEmbed *embed, | ||
3854 | 1479 | GParamSpec *pspec, | ||
3855 | 1480 | EphyWindow *window) | ||
3856 | 1481 | { | ||
3857 | 1482 | EphyWindowPrivate *priv = window->priv; | ||
3858 | 1483 | |||
3859 | 1484 | if (priv->closing) return; | ||
3860 | 1485 | |||
3861 | 1486 | gtk_window_set_title (GTK_WINDOW(window), | ||
3862 | 1487 | ephy_embed_get_title (embed)); | ||
3863 | 1488 | } | ||
3864 | 1489 | |||
3865 | 1490 | static gboolean | ||
3866 | 1491 | idle_unref_context_event (EphyWindow *window) | ||
3867 | 1492 | { | ||
3868 | 1493 | EphyWindowPrivate *priv = window->priv; | ||
3869 | 1494 | |||
3870 | 1495 | LOG ("Idle unreffing context event %p", priv->context_event); | ||
3871 | 1496 | |||
3872 | 1497 | if (priv->context_event != NULL) | ||
3873 | 1498 | { | ||
3874 | 1499 | g_object_unref (priv->context_event); | ||
3875 | 1500 | priv->context_event = NULL; | ||
3876 | 1501 | } | ||
3877 | 1502 | |||
3878 | 1503 | priv->idle_worker = 0; | ||
3879 | 1504 | return FALSE; | ||
3880 | 1505 | } | ||
3881 | 1506 | |||
3882 | 1507 | static void | ||
3883 | 1508 | _ephy_window_set_context_event (EphyWindow *window, | ||
3884 | 1509 | EphyEmbedEvent *event) | ||
3885 | 1510 | { | ||
3886 | 1511 | EphyWindowPrivate *priv = window->priv; | ||
3887 | 1512 | |||
3888 | 1513 | if (priv->idle_worker != 0) | ||
3889 | 1514 | { | ||
3890 | 1515 | g_source_remove (priv->idle_worker); | ||
3891 | 1516 | priv->idle_worker = 0; | ||
3892 | 1517 | } | ||
3893 | 1518 | |||
3894 | 1519 | if (priv->context_event != NULL) | ||
3895 | 1520 | { | ||
3896 | 1521 | g_object_unref (priv->context_event); | ||
3897 | 1522 | } | ||
3898 | 1523 | |||
3899 | 1524 | priv->context_event = event != NULL ? g_object_ref (event) : NULL; | ||
3900 | 1525 | } | ||
3901 | 1526 | |||
3902 | 1527 | static void | ||
3903 | 1528 | _ephy_window_unset_context_event (EphyWindow *window) | ||
3904 | 1529 | { | ||
3905 | 1530 | EphyWindowPrivate *priv = window->priv; | ||
3906 | 1531 | |||
3907 | 1532 | /* Unref the event from idle since we still need it | ||
3908 | 1533 | * from the action callbacks which will run before idle. | ||
3909 | 1534 | */ | ||
3910 | 1535 | if (priv->idle_worker == 0 && priv->context_event != NULL) | ||
3911 | 1536 | { | ||
3912 | 1537 | priv->idle_worker = | ||
3913 | 1538 | g_idle_add ((GSourceFunc) idle_unref_context_event, window); | ||
3914 | 1539 | } | ||
3915 | 1540 | } | ||
3916 | 1541 | |||
3917 | 1542 | static void | ||
3918 | 1543 | context_menu_dismissed_cb (WebKitWebView *webView, | ||
3919 | 1544 | EphyWindow *window) | ||
3920 | 1545 | { | ||
3921 | 1546 | LOG ("Deactivating popup menu"); | ||
3922 | 1547 | |||
3923 | 1548 | enable_edit_actions_sensitivity (window); | ||
3924 | 1549 | |||
3925 | 1550 | g_signal_handlers_disconnect_by_func | ||
3926 | 1551 | (webView, G_CALLBACK (context_menu_dismissed_cb), window); | ||
3927 | 1552 | |||
3928 | 1553 | _ephy_window_unset_context_event (window); | ||
3929 | 1554 | } | ||
3930 | 1555 | |||
3931 | 1556 | static void | ||
3932 | 1557 | add_action_to_context_menu (WebKitContextMenu *context_menu, | ||
3933 | 1558 | GtkActionGroup *action_group, | ||
3934 | 1559 | const char *action_name) | ||
3935 | 1560 | { | ||
3936 | 1561 | GtkAction *action; | ||
3937 | 1562 | |||
3938 | 1563 | action = gtk_action_group_get_action (action_group, action_name); | ||
3939 | 1564 | webkit_context_menu_append (context_menu, webkit_context_menu_item_new (action)); | ||
3940 | 1565 | } | ||
3941 | 1566 | |||
3942 | 1567 | static void | ||
3943 | 1568 | add_item_to_context_menu (WebKitContextMenu *context_menu, | ||
3944 | 1569 | WebKitContextMenuItem *item) | ||
3945 | 1570 | { | ||
3946 | 1571 | if (!item) | ||
3947 | 1572 | return; | ||
3948 | 1573 | |||
3949 | 1574 | webkit_context_menu_append (context_menu, item); | ||
3950 | 1575 | g_object_unref (item); | ||
3951 | 1576 | } | ||
3952 | 1577 | |||
3953 | 1578 | /* FIXME: Add webkit_context_menu_find() ? */ | ||
3954 | 1579 | static WebKitContextMenuItem * | ||
3955 | 1580 | find_item_in_context_menu (WebKitContextMenu *context_menu, | ||
3956 | 1581 | WebKitContextMenuAction action) | ||
3957 | 1582 | { | ||
3958 | 1583 | GList *items, *iter; | ||
3959 | 1584 | |||
3960 | 1585 | items = webkit_context_menu_get_items (context_menu); | ||
3961 | 1586 | for (iter = items; iter; iter = g_list_next (iter)) | ||
3962 | 1587 | { | ||
3963 | 1588 | WebKitContextMenuItem *item = (WebKitContextMenuItem *)iter->data; | ||
3964 | 1589 | |||
3965 | 1590 | if (webkit_context_menu_item_get_stock_action (item) == action) | ||
3966 | 1591 | return g_object_ref (item); | ||
3967 | 1592 | } | ||
3968 | 1593 | |||
3969 | 1594 | return NULL; | ||
3970 | 1595 | } | ||
3971 | 1596 | |||
3972 | 1597 | static GList * | ||
3973 | 1598 | find_spelling_guess_context_menu_items (WebKitContextMenu *context_menu) | ||
3974 | 1599 | { | ||
3975 | 1600 | GList *items, *iter; | ||
3976 | 1601 | guint i; | ||
3977 | 1602 | GList *retval = NULL; | ||
3978 | 1603 | |||
3979 | 1604 | items = webkit_context_menu_get_items (context_menu); | ||
3980 | 1605 | for (iter = items, i = 0; iter && i < MAX_SPELL_CHECK_GUESSES; iter = g_list_next (iter), i++) | ||
3981 | 1606 | { | ||
3982 | 1607 | WebKitContextMenuItem *item = (WebKitContextMenuItem *)iter->data; | ||
3983 | 1608 | |||
3984 | 1609 | if (webkit_context_menu_item_get_stock_action (item) == WEBKIT_CONTEXT_MENU_ACTION_SPELLING_GUESS) | ||
3985 | 1610 | { | ||
3986 | 1611 | retval = g_list_prepend (retval, g_object_ref (item)); | ||
3987 | 1612 | } | ||
3988 | 1613 | else | ||
3989 | 1614 | { | ||
3990 | 1615 | /* Spelling guesses are always at the beginning of the context menu, so | ||
3991 | 1616 | * we can break the loop as soon as we find the first item that is not | ||
3992 | 1617 | * spelling guess. | ||
3993 | 1618 | */ | ||
3994 | 1619 | break; | ||
3995 | 1620 | } | ||
3996 | 1621 | } | ||
3997 | 1622 | |||
3998 | 1623 | return g_list_reverse (retval); | ||
3999 | 1624 | } | ||
4000 | 1625 | |||
4001 | 1626 | static gboolean | ||
4002 | 1627 | populate_context_menu (WebKitWebView *web_view, | ||
4003 | 1628 | WebKitContextMenu *context_menu, | ||
4004 | 1629 | GdkEvent *event, | ||
4005 | 1630 | WebKitHitTestResult *hit_test_result, | ||
4006 | 1631 | EphyWindow *window) | ||
4007 | 1632 | { | ||
4008 | 1633 | EphyWindowPrivate *priv = window->priv; | ||
4009 | 1634 | WebKitContextMenuItem *input_methods_item = NULL; | ||
4010 | 1635 | WebKitContextMenuItem *unicode_item = NULL; | ||
4011 | 1636 | WebKitContextMenuItem *play_pause_item = NULL; | ||
4012 | 1637 | WebKitContextMenuItem *mute_item = NULL; | ||
4013 | 1638 | WebKitContextMenuItem *toggle_controls_item = NULL; | ||
4014 | 1639 | WebKitContextMenuItem *toggle_loop_item = NULL; | ||
4015 | 1640 | WebKitContextMenuItem *fullscreen_item = NULL; | ||
4016 | 1641 | GList *spelling_guess_items = NULL; | ||
4017 | 1642 | EphyEmbedEvent *embed_event; | ||
4018 | 1643 | gboolean is_document = FALSE; | ||
4019 | 1644 | gboolean app_mode; | ||
4020 | 1645 | gboolean is_image; | ||
4021 | 1646 | gboolean is_media = FALSE; | ||
4022 | 1647 | gboolean is_video = FALSE; | ||
4023 | 1648 | gboolean is_audio = FALSE; | ||
4024 | 1649 | |||
4025 | 1650 | is_image = webkit_hit_test_result_context_is_image (hit_test_result); | ||
4026 | 1651 | |||
4027 | 1652 | if (webkit_hit_test_result_context_is_editable (hit_test_result)) { | ||
4028 | 1653 | input_methods_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_INPUT_METHODS); | ||
4029 | 1654 | unicode_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_UNICODE); | ||
4030 | 1655 | spelling_guess_items = find_spelling_guess_context_menu_items (context_menu); | ||
4031 | 1656 | } | ||
4032 | 1657 | |||
4033 | 1658 | if (webkit_hit_test_result_context_is_media (hit_test_result)) | ||
4034 | 1659 | { | ||
4035 | 1660 | WebKitContextMenuItem *item; | ||
4036 | 1661 | |||
4037 | 1662 | is_media = TRUE; | ||
4038 | 1663 | play_pause_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_MEDIA_PLAY); | ||
4039 | 1664 | if (!play_pause_item) | ||
4040 | 1665 | play_pause_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_MEDIA_PAUSE); | ||
4041 | 1666 | mute_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_MEDIA_MUTE); | ||
4042 | 1667 | toggle_controls_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_TOGGLE_MEDIA_CONTROLS); | ||
4043 | 1668 | toggle_loop_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_TOGGLE_MEDIA_LOOP); | ||
4044 | 1669 | fullscreen_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_ENTER_VIDEO_FULLSCREEN); | ||
4045 | 1670 | |||
4046 | 1671 | item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_COPY_VIDEO_LINK_TO_CLIPBOARD); | ||
4047 | 1672 | if (item) | ||
4048 | 1673 | { | ||
4049 | 1674 | is_video = TRUE; | ||
4050 | 1675 | g_object_unref (item); | ||
4051 | 1676 | } | ||
4052 | 1677 | else | ||
4053 | 1678 | { | ||
4054 | 1679 | item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_COPY_AUDIO_LINK_TO_CLIPBOARD); | ||
4055 | 1680 | if (item) | ||
4056 | 1681 | { | ||
4057 | 1682 | is_audio = TRUE; | ||
4058 | 1683 | g_object_unref (item); | ||
4059 | 1684 | } | ||
4060 | 1685 | } | ||
4061 | 1686 | } | ||
4062 | 1687 | |||
4063 | 1688 | webkit_context_menu_remove_all (context_menu); | ||
4064 | 1689 | |||
4065 | 1690 | embed_event = ephy_embed_event_new ((GdkEventButton *)event, hit_test_result); | ||
4066 | 1691 | _ephy_window_set_context_event (window, embed_event); | ||
4067 | 1692 | g_object_unref (embed_event); | ||
4068 | 1693 | |||
4069 | 1694 | app_mode = ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_APPLICATION; | ||
4070 | 1695 | |||
4071 | 1696 | update_edit_actions_sensitivity (window, FALSE); | ||
4072 | 1697 | |||
4073 | 1698 | if (webkit_hit_test_result_context_is_link (hit_test_result)) | ||
4074 | 1699 | { | ||
4075 | 1700 | const char *uri; | ||
4076 | 1701 | gboolean link_has_web_scheme; | ||
4077 | 1702 | |||
4078 | 1703 | uri = webkit_hit_test_result_get_link_uri (hit_test_result); | ||
4079 | 1704 | link_has_web_scheme = ephy_embed_utils_address_has_web_scheme (uri); | ||
4080 | 1705 | |||
4081 | 1706 | update_edit_actions_sensitivity (window, TRUE); | ||
4082 | 1707 | update_link_actions_sensitivity (window, link_has_web_scheme); | ||
4083 | 1708 | |||
4084 | 1709 | if (!app_mode) | ||
4085 | 1710 | { | ||
4086 | 1711 | add_action_to_context_menu (context_menu, | ||
4087 | 1712 | priv->popups_action_group, "OpenLinkInNewTab"); | ||
4088 | 1713 | add_action_to_context_menu (context_menu, | ||
4089 | 1714 | priv->popups_action_group, "OpenLinkInNewWindow"); | ||
4090 | 1715 | webkit_context_menu_append (context_menu, | ||
4091 | 1716 | webkit_context_menu_item_new_separator ()); | ||
4092 | 1717 | } | ||
4093 | 1718 | add_action_to_context_menu (context_menu, | ||
4094 | 1719 | priv->action_group, "EditCopy"); | ||
4095 | 1720 | webkit_context_menu_append (context_menu, | ||
4096 | 1721 | webkit_context_menu_item_new_separator ()); | ||
4097 | 1722 | add_action_to_context_menu (context_menu, | ||
4098 | 1723 | priv->popups_action_group, "DownloadLinkAs"); | ||
4099 | 1724 | |||
4100 | 1725 | if (g_str_has_prefix (uri, "mailto:")) | ||
4101 | 1726 | { | ||
4102 | 1727 | add_action_to_context_menu (context_menu, | ||
4103 | 1728 | priv->popups_action_group, "CopyEmailAddress"); | ||
4104 | 1729 | } | ||
4105 | 1730 | else | ||
4106 | 1731 | { | ||
4107 | 1732 | add_action_to_context_menu (context_menu, | ||
4108 | 1733 | priv->popups_action_group, "CopyLinkAddress"); | ||
4109 | 1734 | } | ||
4110 | 1735 | } | ||
4111 | 1736 | else if (webkit_hit_test_result_context_is_editable (hit_test_result)) | ||
4112 | 1737 | { | ||
4113 | 1738 | GList *l; | ||
4114 | 1739 | gboolean has_guesses = FALSE; | ||
4115 | 1740 | |||
4116 | 1741 | for (l = spelling_guess_items; l; l = g_list_next (l)) | ||
4117 | 1742 | { | ||
4118 | 1743 | WebKitContextMenuItem *item = WEBKIT_CONTEXT_MENU_ITEM (l->data); | ||
4119 | 1744 | |||
4120 | 1745 | webkit_context_menu_append (context_menu, item); | ||
4121 | 1746 | g_object_unref (item); | ||
4122 | 1747 | has_guesses = TRUE; | ||
4123 | 1748 | } | ||
4124 | 1749 | g_list_free (spelling_guess_items); | ||
4125 | 1750 | |||
4126 | 1751 | if (has_guesses) | ||
4127 | 1752 | { | ||
4128 | 1753 | webkit_context_menu_append (context_menu, | ||
4129 | 1754 | webkit_context_menu_item_new_separator ()); | ||
4130 | 1755 | } | ||
4131 | 1756 | |||
4132 | 1757 | update_edit_actions_sensitivity (window, FALSE); | ||
4133 | 1758 | |||
4134 | 1759 | add_action_to_context_menu (context_menu, | ||
4135 | 1760 | priv->action_group, "EditUndo"); | ||
4136 | 1761 | add_action_to_context_menu (context_menu, | ||
4137 | 1762 | priv->action_group, "EditRedo"); | ||
4138 | 1763 | webkit_context_menu_append (context_menu, | ||
4139 | 1764 | webkit_context_menu_item_new_separator ()); | ||
4140 | 1765 | add_action_to_context_menu (context_menu, | ||
4141 | 1766 | priv->action_group, "EditCut"); | ||
4142 | 1767 | add_action_to_context_menu (context_menu, | ||
4143 | 1768 | priv->action_group, "EditCopy"); | ||
4144 | 1769 | add_action_to_context_menu (context_menu, | ||
4145 | 1770 | priv->action_group, "EditPaste"); | ||
4146 | 1771 | webkit_context_menu_append (context_menu, | ||
4147 | 1772 | webkit_context_menu_item_new_separator ()); | ||
4148 | 1773 | add_action_to_context_menu (context_menu, | ||
4149 | 1774 | priv->action_group, "EditSelectAll"); | ||
4150 | 1775 | if (input_methods_item || unicode_item) | ||
4151 | 1776 | webkit_context_menu_append (context_menu, | ||
4152 | 1777 | webkit_context_menu_item_new_separator ()); | ||
4153 | 1778 | add_item_to_context_menu (context_menu, input_methods_item); | ||
4154 | 1779 | add_item_to_context_menu (context_menu, unicode_item); | ||
4155 | 1780 | } | ||
4156 | 1781 | else | ||
4157 | 1782 | { | ||
4158 | 1783 | is_document = TRUE; | ||
4159 | 1784 | |||
4160 | 1785 | update_edit_actions_sensitivity (window, TRUE); | ||
4161 | 1786 | |||
4162 | 1787 | if (!is_image && !is_media) | ||
4163 | 1788 | { | ||
4164 | 1789 | add_action_to_context_menu (context_menu, | ||
4165 | 1790 | priv->toolbar_action_group, "NavigationBack"); | ||
4166 | 1791 | add_action_to_context_menu (context_menu, | ||
4167 | 1792 | priv->toolbar_action_group, "NavigationForward"); | ||
4168 | 1793 | add_action_to_context_menu (context_menu, | ||
4169 | 1794 | priv->action_group, "ViewReload"); | ||
4170 | 1795 | webkit_context_menu_append (context_menu, | ||
4171 | 1796 | webkit_context_menu_item_new_separator ()); | ||
4172 | 1797 | } | ||
4173 | 1798 | |||
4174 | 1799 | add_action_to_context_menu (context_menu, | ||
4175 | 1800 | priv->action_group, "EditCopy"); | ||
4176 | 1801 | |||
4177 | 1802 | if (!app_mode && !is_image && !is_media) | ||
4178 | 1803 | { | ||
4179 | 1804 | webkit_context_menu_append (context_menu, | ||
4180 | 1805 | webkit_context_menu_item_new_separator ()); | ||
4181 | 1806 | add_action_to_context_menu (context_menu, | ||
4182 | 1807 | priv->popups_action_group, "ContextBookmarkPage"); | ||
4183 | 1808 | } | ||
4184 | 1809 | } | ||
4185 | 1810 | |||
4186 | 1811 | if (is_image) | ||
4187 | 1812 | { | ||
4188 | 1813 | webkit_context_menu_append (context_menu, | ||
4189 | 1814 | webkit_context_menu_item_new_separator ()); | ||
4190 | 1815 | add_action_to_context_menu (context_menu, | ||
4191 | 1816 | priv->popups_action_group, "SaveImageAs"); | ||
4192 | 1817 | add_action_to_context_menu (context_menu, | ||
4193 | 1818 | priv->popups_action_group, "CopyImageLocation"); | ||
4194 | 1819 | add_action_to_context_menu (context_menu, | ||
4195 | 1820 | priv->popups_action_group, "ViewImage"); | ||
4196 | 1821 | add_action_to_context_menu (context_menu, | ||
4197 | 1822 | priv->popups_action_group, "SetImageAsBackground"); | ||
4198 | 1823 | } | ||
4199 | 1824 | |||
4200 | 1825 | if (is_media) | ||
4201 | 1826 | { | ||
4202 | 1827 | add_item_to_context_menu (context_menu, play_pause_item); | ||
4203 | 1828 | add_item_to_context_menu (context_menu, mute_item); | ||
4204 | 1829 | add_item_to_context_menu (context_menu, toggle_controls_item); | ||
4205 | 1830 | add_item_to_context_menu (context_menu, toggle_loop_item); | ||
4206 | 1831 | add_item_to_context_menu (context_menu, fullscreen_item); | ||
4207 | 1832 | webkit_context_menu_append (context_menu, | ||
4208 | 1833 | webkit_context_menu_item_new_separator ()); | ||
4209 | 1834 | if (is_video) | ||
4210 | 1835 | { | ||
4211 | 1836 | add_action_to_context_menu (context_menu, priv->popups_action_group, | ||
4212 | 1837 | "OpenVideoInNewWindow"); | ||
4213 | 1838 | add_action_to_context_menu (context_menu, priv->popups_action_group, | ||
4214 | 1839 | "OpenVideoInNewTab"); | ||
4215 | 1840 | add_action_to_context_menu (context_menu, priv->popups_action_group, | ||
4216 | 1841 | "SaveVideoAs"); | ||
4217 | 1842 | add_action_to_context_menu (context_menu, priv->popups_action_group, | ||
4218 | 1843 | "CopyVideoLocation"); | ||
4219 | 1844 | } | ||
4220 | 1845 | else if (is_audio) | ||
4221 | 1846 | { | ||
4222 | 1847 | add_action_to_context_menu (context_menu, priv->popups_action_group, | ||
4223 | 1848 | "OpenAudioInNewWindow"); | ||
4224 | 1849 | add_action_to_context_menu (context_menu, priv->popups_action_group, | ||
4225 | 1850 | "OpenAudioInNewTab"); | ||
4226 | 1851 | add_action_to_context_menu (context_menu, priv->popups_action_group, | ||
4227 | 1852 | "SaveAudioAs"); | ||
4228 | 1853 | add_action_to_context_menu (context_menu, priv->popups_action_group, | ||
4229 | 1854 | "CopyAudioLocation"); | ||
4230 | 1855 | } | ||
4231 | 1856 | } | ||
4232 | 1857 | |||
4233 | 1858 | g_signal_connect (web_view, "context-menu-dismissed", | ||
4234 | 1859 | G_CALLBACK (context_menu_dismissed_cb), | ||
4235 | 1860 | window); | ||
4236 | 1861 | |||
4237 | 1862 | if (app_mode) | ||
4238 | 1863 | return FALSE; | ||
4239 | 1864 | |||
4240 | 1865 | if (is_document && !is_image && !is_media) | ||
4241 | 1866 | { | ||
4242 | 1867 | webkit_context_menu_append (context_menu, | ||
4243 | 1868 | webkit_context_menu_item_new_separator ()); | ||
4244 | 1869 | add_action_to_context_menu (context_menu, | ||
4245 | 1870 | priv->action_group, "FileSendTo"); | ||
4246 | 1871 | } | ||
4247 | 1872 | |||
4248 | 1873 | webkit_context_menu_append (context_menu, | ||
4249 | 1874 | webkit_context_menu_item_new_separator ()); | ||
4250 | 1875 | webkit_context_menu_append (context_menu, | ||
4251 | 1876 | webkit_context_menu_item_new_from_stock_action (WEBKIT_CONTEXT_MENU_ACTION_INSPECT_ELEMENT)); | ||
4252 | 1877 | |||
4253 | 1878 | return FALSE; | ||
4254 | 1879 | } | ||
4255 | 1880 | |||
4256 | 1881 | static gboolean | ||
4257 | 1882 | save_target_uri (EphyWindow *window, | ||
4258 | 1883 | WebKitWebView *view, | ||
4259 | 1884 | GdkEventButton *event, | ||
4260 | 1885 | WebKitHitTestResult *hit_test_result) | ||
4261 | 1886 | { | ||
4262 | 1887 | guint context; | ||
4263 | 1888 | char *location = NULL; | ||
4264 | 1889 | gboolean retval = FALSE; | ||
4265 | 1890 | |||
4266 | 1891 | g_object_get (hit_test_result, "context", &context, NULL); | ||
4267 | 1892 | |||
4268 | 1893 | LOG ("ephy_window_dom_mouse_click_cb: button %d, context %d, modifier %d (%d:%d)", | ||
4269 | 1894 | event->button, context, event->state, (int)event->x, (int)event->y); | ||
4270 | 1895 | |||
4271 | 1896 | /* shift+click saves the link target */ | ||
4272 | 1897 | if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK) | ||
4273 | 1898 | { | ||
4274 | 1899 | g_object_get (G_OBJECT (hit_test_result), "link-uri", &location, NULL); | ||
4275 | 1900 | } | ||
4276 | 1901 | /* Note: pressing enter to submit a form synthesizes a mouse | ||
4277 | 1902 | * click event | ||
4278 | 1903 | */ | ||
4279 | 1904 | /* shift+click saves the non-link image */ | ||
4280 | 1905 | else if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE && | ||
4281 | 1906 | !(context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE)) | ||
4282 | 1907 | { | ||
4283 | 1908 | g_object_get (G_OBJECT (hit_test_result), "image-uri", &location, NULL); | ||
4284 | 1909 | } | ||
4285 | 1910 | |||
4286 | 1911 | if (location) | ||
4287 | 1912 | { | ||
4288 | 1913 | LOG ("Location: %s", location); | ||
4289 | 1914 | |||
4290 | 1915 | retval = ephy_embed_utils_address_has_web_scheme (location); | ||
4291 | 1916 | if (retval) | ||
4292 | 1917 | { | ||
4293 | 1918 | EphyDownload *download; | ||
4294 | 1919 | |||
4295 | 1920 | download = ephy_download_new_for_uri (location, GTK_WINDOW (window)); | ||
4296 | 1921 | ephy_download_set_action (download, EPHY_DOWNLOAD_ACTION_OPEN); | ||
4297 | 1922 | ephy_window_add_download (window, download); | ||
4298 | 1923 | g_object_unref (download); | ||
4299 | 1924 | } | ||
4300 | 1925 | |||
4301 | 1926 | g_free (location); | ||
4302 | 1927 | } | ||
4303 | 1928 | |||
4304 | 1929 | return retval; | ||
4305 | 1930 | } | ||
4306 | 1931 | |||
4307 | 1932 | static gboolean | ||
4308 | 1933 | ephy_window_dom_mouse_click_cb (WebKitWebView *view, | ||
4309 | 1934 | GdkEventButton *event, | ||
4310 | 1935 | EphyWindow *window) | ||
4311 | 1936 | { | ||
4312 | 1937 | WebKitHitTestResult *hit_test_result; | ||
4313 | 1938 | gboolean handled = FALSE; | ||
4314 | 1939 | |||
4315 | 1940 | /* Since we're only dealing with shift+click, we can do these | ||
4316 | 1941 | checks early. */ | ||
4317 | 1942 | if (!(event->state & GDK_SHIFT_MASK) || event->button != GDK_BUTTON_PRIMARY) | ||
4318 | 1943 | { | ||
4319 | 1944 | return FALSE; | ||
4320 | 1945 | } | ||
4321 | 1946 | |||
4322 | 1947 | hit_test_result = g_object_ref (window->priv->hit_test_result); | ||
4323 | 1948 | handled = save_target_uri (window, view, event, hit_test_result); | ||
4324 | 1949 | g_object_unref (hit_test_result); | ||
4325 | 1950 | |||
4326 | 1951 | return handled; | ||
4327 | 1952 | } | ||
4328 | 1953 | |||
4329 | 1954 | static void | ||
4330 | 1955 | ephy_window_mouse_target_changed_cb (WebKitWebView *web_view, | ||
4331 | 1956 | WebKitHitTestResult *hit_test_result, | ||
4332 | 1957 | guint modifiers, | ||
4333 | 1958 | EphyWindow *window) | ||
4334 | 1959 | { | ||
4335 | 1960 | EphyWindowPrivate *priv = window->priv; | ||
4336 | 1961 | |||
4337 | 1962 | if (priv->hit_test_result) | ||
4338 | 1963 | g_object_unref (priv->hit_test_result); | ||
4339 | 1964 | priv->hit_test_result = g_object_ref (hit_test_result); | ||
4340 | 1965 | } | ||
4341 | 1966 | |||
4342 | 1967 | static void | ||
4343 | 1968 | ephy_window_set_is_popup (EphyWindow *window, | ||
4344 | 1969 | gboolean is_popup) | ||
4345 | 1970 | { | ||
4346 | 1971 | EphyWindowPrivate *priv = window->priv; | ||
4347 | 1972 | |||
4348 | 1973 | priv->is_popup = is_popup; | ||
4349 | 1974 | |||
4350 | 1975 | g_object_notify (G_OBJECT (window), "is-popup"); | ||
4351 | 1976 | } | ||
4352 | 1977 | |||
4353 | 1978 | static void | ||
4354 | 1979 | window_properties_geometry_changed (WebKitWindowProperties *properties, | ||
4355 | 1980 | GParamSpec *pspec, | ||
4356 | 1981 | EphyWindow *window) | ||
4357 | 1982 | { | ||
4358 | 1983 | GdkRectangle geometry; | ||
4359 | 1984 | |||
4360 | 1985 | webkit_window_properties_get_geometry (properties, &geometry); | ||
4361 | 1986 | if (geometry.x >= 0 && geometry.y >= 0) | ||
4362 | 1987 | gtk_window_move (GTK_WINDOW (window), geometry.x, geometry.y); | ||
4363 | 1988 | if (geometry.width > 0 && geometry.height > 0) | ||
4364 | 1989 | gtk_window_resize (GTK_WINDOW (window), geometry.width, geometry.height); | ||
4365 | 1990 | } | ||
4366 | 1991 | |||
4367 | 1992 | static void | ||
4368 | 1993 | ephy_window_configure_for_view (EphyWindow *window, | ||
4369 | 1994 | WebKitWebView *web_view) | ||
4370 | 1995 | { | ||
4371 | 1996 | WebKitWindowProperties *properties; | ||
4372 | 1997 | GdkRectangle geometry; | ||
4373 | 1998 | EphyWindowChrome chrome = 0; | ||
4374 | 1999 | |||
4375 | 2000 | properties = webkit_web_view_get_window_properties (web_view); | ||
4376 | 2001 | |||
4377 | 2002 | if (webkit_window_properties_get_toolbar_visible (properties)) | ||
4378 | 2003 | chrome |= EPHY_WINDOW_CHROME_TOOLBAR; | ||
4379 | 2004 | |||
4380 | 2005 | if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) != EPHY_EMBED_SHELL_MODE_APPLICATION) | ||
4381 | 2006 | { | ||
4382 | 2007 | GtkWidget *entry; | ||
4383 | 2008 | |||
4384 | 2009 | entry = ephy_toolbar_get_location_entry (EPHY_TOOLBAR (window->priv->toolbar)); | ||
4385 | 2010 | gtk_editable_set_editable (GTK_EDITABLE (entry), FALSE); | ||
4386 | 2011 | |||
4387 | 2012 | if (webkit_window_properties_get_menubar_visible (properties)) | ||
4388 | 2013 | chrome |= EPHY_WINDOW_CHROME_MENU; | ||
4389 | 2014 | if (webkit_window_properties_get_locationbar_visible (properties)) | ||
4390 | 2015 | chrome |= EPHY_WINDOW_CHROME_LOCATION; | ||
4391 | 2016 | } | ||
4392 | 2017 | |||
4393 | 2018 | webkit_window_properties_get_geometry (properties, &geometry); | ||
4394 | 2019 | if (geometry.width > 0 && geometry.height > 0) | ||
4395 | 2020 | gtk_window_set_default_size (GTK_WINDOW (window), geometry.width, geometry.height); | ||
4396 | 2021 | |||
4397 | 2022 | if (!webkit_window_properties_get_resizable (properties)) | ||
4398 | 2023 | gtk_window_set_resizable (GTK_WINDOW (window), FALSE); | ||
4399 | 2024 | |||
4400 | 2025 | window->priv->is_popup = TRUE; | ||
4401 | 2026 | ephy_window_set_chrome (window, chrome); | ||
4402 | 2027 | g_signal_connect (properties, "notify::geometry", | ||
4403 | 2028 | G_CALLBACK (window_properties_geometry_changed), | ||
4404 | 2029 | window); | ||
4405 | 2030 | } | ||
4406 | 2031 | |||
4407 | 2032 | static gboolean | ||
4408 | 2033 | web_view_ready_cb (WebKitWebView *web_view, | ||
4409 | 2034 | WebKitWebView *parent_web_view) | ||
4410 | 2035 | { | ||
4411 | 2036 | EphyWindow *window, *parent_view_window; | ||
4412 | 2037 | gboolean using_new_window; | ||
4413 | 2038 | |||
4414 | 2039 | window = EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (web_view))); | ||
4415 | 2040 | parent_view_window = EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (parent_web_view))); | ||
4416 | 2041 | |||
4417 | 2042 | using_new_window = window != parent_view_window; | ||
4418 | 2043 | |||
4419 | 2044 | if (using_new_window) | ||
4420 | 2045 | { | ||
4421 | 2046 | ephy_window_configure_for_view (window, web_view); | ||
4422 | 2047 | g_signal_emit_by_name (parent_web_view, "new-window", web_view); | ||
4423 | 2048 | } | ||
4424 | 2049 | |||
4425 | 2050 | if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_APPLICATION && | ||
4426 | 2051 | !webkit_web_view_get_uri(web_view)) | ||
4427 | 2052 | { | ||
4428 | 2053 | /* Wait until we have a valid URL to decide whether to show the window | ||
4429 | 2054 | * or load the URL in the default web browser | ||
4430 | 2055 | */ | ||
4431 | 2056 | g_object_set_data_full (G_OBJECT (window), "referrer", | ||
4432 | 2057 | g_strdup (webkit_web_view_get_uri (parent_web_view)), | ||
4433 | 2058 | g_free); | ||
4434 | 2059 | return TRUE; | ||
4435 | 2060 | } | ||
4436 | 2061 | |||
4437 | 2062 | gtk_widget_show (GTK_WIDGET (window)); | ||
4438 | 2063 | |||
4439 | 2064 | return TRUE; | ||
4440 | 2065 | } | ||
4441 | 2066 | |||
4442 | 2067 | static WebKitWebView * | ||
4443 | 2068 | create_web_view_cb (WebKitWebView *web_view, | ||
4444 | 2069 | WebKitNavigationAction *navigation_action, | ||
4445 | 2070 | EphyWindow *window) | ||
4446 | 2071 | { | ||
4447 | 2072 | EphyEmbed *embed; | ||
4448 | 2073 | WebKitWebView *new_web_view; | ||
4449 | 2074 | EphyNewTabFlags flags; | ||
4450 | 2075 | EphyWindow *target_window; | ||
4451 | 2076 | |||
4452 | 2077 | if ((ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) != EPHY_EMBED_SHELL_MODE_APPLICATION) && | ||
4453 | 2078 | (g_settings_get_boolean (EPHY_SETTINGS_MAIN, | ||
4454 | 2079 | EPHY_PREFS_NEW_WINDOWS_IN_TABS) || | ||
4455 | 2080 | g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN, | ||
4456 | 2081 | EPHY_PREFS_LOCKDOWN_FULLSCREEN))) | ||
4457 | 2082 | { | ||
4458 | 2083 | target_window = window; | ||
4459 | 2084 | flags = EPHY_NEW_TAB_JUMP | | ||
4460 | 2085 | EPHY_NEW_TAB_APPEND_AFTER; | ||
4461 | 2086 | } | ||
4462 | 2087 | else | ||
4463 | 2088 | { | ||
4464 | 2089 | target_window = ephy_window_new (); | ||
4465 | 2090 | flags = EPHY_NEW_TAB_DONT_SHOW_WINDOW; | ||
4466 | 2091 | } | ||
4467 | 2092 | |||
4468 | 2093 | embed = ephy_shell_new_tab_full (ephy_shell_get_default (), | ||
4469 | 2094 | NULL, | ||
4470 | 2095 | web_view, | ||
4471 | 2096 | target_window, | ||
4472 | 2097 | EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (web_view), | ||
4473 | 2098 | flags, | ||
4474 | 2099 | 0); | ||
4475 | 2100 | if (target_window == window) | ||
4476 | 2101 | gtk_widget_grab_focus (GTK_WIDGET (embed)); | ||
4477 | 2102 | |||
4478 | 2103 | new_web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); | ||
4479 | 2104 | g_signal_connect (new_web_view, "ready-to-show", | ||
4480 | 2105 | G_CALLBACK (web_view_ready_cb), | ||
4481 | 2106 | web_view); | ||
4482 | 2107 | |||
4483 | 2108 | return new_web_view; | ||
4484 | 2109 | } | ||
4485 | 2110 | |||
4486 | 2111 | static gboolean | ||
4487 | 2112 | decide_policy_cb (WebKitWebView *web_view, | ||
4488 | 2113 | WebKitPolicyDecision *decision, | ||
4489 | 2114 | WebKitPolicyDecisionType decision_type, | ||
4490 | 2115 | EphyWindow *window) | ||
4491 | 2116 | { | ||
4492 | 2117 | WebKitNavigationPolicyDecision *navigation_decision; | ||
4493 | 2118 | WebKitNavigationAction *navigation_action; | ||
4494 | 2119 | WebKitNavigationType navigation_type; | ||
4495 | 2120 | WebKitURIRequest *request; | ||
4496 | 2121 | const char *uri; | ||
4497 | 2122 | EphyEmbed *embed; | ||
4498 | 2123 | |||
4499 | 2124 | if (decision_type == WEBKIT_POLICY_DECISION_TYPE_RESPONSE) | ||
4500 | 2125 | return FALSE; | ||
4501 | 2126 | |||
4502 | 2127 | navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION (decision); | ||
4503 | 2128 | navigation_action = webkit_navigation_policy_decision_get_navigation_action (navigation_decision); | ||
4504 | 2129 | request = webkit_navigation_action_get_request (navigation_action); | ||
4505 | 2130 | uri = webkit_uri_request_get_uri (request); | ||
4506 | 2131 | |||
4507 | 2132 | if (!ephy_embed_utils_address_has_web_scheme (uri)) | ||
4508 | 2133 | { | ||
4509 | 2134 | GError *error = NULL; | ||
4510 | 2135 | GdkScreen *screen; | ||
4511 | 2136 | |||
4512 | 2137 | screen = gtk_widget_get_screen (GTK_WIDGET (web_view)); | ||
4513 | 2138 | gtk_show_uri (screen, uri, GDK_CURRENT_TIME, &error); | ||
4514 | 2139 | |||
4515 | 2140 | if (error) | ||
4516 | 2141 | { | ||
4517 | 2142 | LOG ("failed to handle non web scheme: %s", error->message); | ||
4518 | 2143 | g_error_free (error); | ||
4519 | 2144 | |||
4520 | 2145 | return FALSE; | ||
4521 | 2146 | } | ||
4522 | 2147 | |||
4523 | 2148 | webkit_policy_decision_ignore (decision); | ||
4524 | 2149 | |||
4525 | 2150 | return TRUE; | ||
4526 | 2151 | } | ||
4527 | 2152 | |||
4528 | 2153 | if (decision_type == WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION) | ||
4529 | 2154 | { | ||
4530 | 2155 | const char *frame_name = webkit_navigation_policy_decision_get_frame_name (navigation_decision); | ||
4531 | 2156 | |||
4532 | 2157 | if (g_strcmp0 (frame_name, "_evince_download") == 0) | ||
4533 | 2158 | { | ||
4534 | 2159 | /* The Evince Browser Plugin is requesting us to downlod the document */ | ||
4535 | 2160 | webkit_policy_decision_download (decision); | ||
4536 | 2161 | return TRUE; | ||
4537 | 2162 | } | ||
4538 | 2163 | |||
4539 | 2164 | if (!g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_ENABLE_POPUPS) && | ||
4540 | 2165 | !webkit_navigation_action_is_user_gesture (navigation_action)) | ||
4541 | 2166 | { | ||
4542 | 2167 | webkit_policy_decision_ignore (decision); | ||
4543 | 2168 | return TRUE; | ||
4544 | 2169 | } | ||
4545 | 2170 | } | ||
4546 | 2171 | |||
4547 | 2172 | navigation_type = webkit_navigation_action_get_navigation_type (navigation_action); | ||
4548 | 2173 | |||
4549 | 2174 | if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_APPLICATION) | ||
4550 | 2175 | { | ||
4551 | 2176 | if (!gtk_widget_is_visible (GTK_WIDGET (window))) | ||
4552 | 2177 | { | ||
4553 | 2178 | char *referrer; | ||
4554 | 2179 | |||
4555 | 2180 | referrer = (char *)g_object_get_data (G_OBJECT (window), "referrer"); | ||
4556 | 2181 | |||
4557 | 2182 | if (ephy_embed_utils_urls_have_same_origin (uri, referrer)) | ||
4558 | 2183 | { | ||
4559 | 2184 | gtk_widget_show (GTK_WIDGET (window)); | ||
4560 | 2185 | } | ||
4561 | 2186 | else | ||
4562 | 2187 | { | ||
4563 | 2188 | ephy_file_open_uri_in_default_browser (uri, GDK_CURRENT_TIME, | ||
4564 | 2189 | gtk_window_get_screen (GTK_WINDOW (window))); | ||
4565 | 2190 | webkit_policy_decision_ignore (decision); | ||
4566 | 2191 | |||
4567 | 2192 | gtk_widget_destroy (GTK_WIDGET (window)); | ||
4568 | 2193 | |||
4569 | 2194 | return TRUE; | ||
4570 | 2195 | } | ||
4571 | 2196 | } | ||
4572 | 2197 | |||
4573 | 2198 | if (navigation_type == WEBKIT_NAVIGATION_TYPE_LINK_CLICKED) | ||
4574 | 2199 | { | ||
4575 | 2200 | if (ephy_embed_utils_urls_have_same_origin (uri, webkit_web_view_get_uri (web_view))) | ||
4576 | 2201 | { | ||
4577 | 2202 | return FALSE; | ||
4578 | 2203 | } | ||
4579 | 2204 | |||
4580 | 2205 | ephy_file_open_uri_in_default_browser (uri, GDK_CURRENT_TIME, | ||
4581 | 2206 | gtk_window_get_screen (GTK_WINDOW (window))); | ||
4582 | 2207 | webkit_policy_decision_ignore (decision); | ||
4583 | 2208 | |||
4584 | 2209 | return TRUE; | ||
4585 | 2210 | } | ||
4586 | 2211 | } | ||
4587 | 2212 | |||
4588 | 2213 | if (navigation_type == WEBKIT_NAVIGATION_TYPE_LINK_CLICKED) | ||
4589 | 2214 | { | ||
4590 | 2215 | gint button; | ||
4591 | 2216 | gint state; | ||
4592 | 2217 | EphyEmbed *new_embed; | ||
4593 | 2218 | EphyNewTabFlags flags = 0; | ||
4594 | 2219 | EphyWindow *target_window = window; | ||
4595 | 2220 | |||
4596 | 2221 | button = webkit_navigation_action_get_mouse_button (navigation_action); | ||
4597 | 2222 | state = webkit_navigation_action_get_modifiers (navigation_action); | ||
4598 | 2223 | |||
4599 | 2224 | ephy_web_view_set_visit_type (EPHY_WEB_VIEW (web_view), | ||
4600 | 2225 | EPHY_PAGE_VISIT_LINK); | ||
4601 | 2226 | |||
4602 | 2227 | /* New tab in new window for control+shift+click */ | ||
4603 | 2228 | if (button == 1 && state == (GDK_SHIFT_MASK | GDK_CONTROL_MASK) && | ||
4604 | 2229 | !g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN, | ||
4605 | 2230 | EPHY_PREFS_LOCKDOWN_FULLSCREEN)) | ||
4606 | 2231 | { | ||
4607 | 2232 | target_window = ephy_window_new (); | ||
4608 | 2233 | } | ||
4609 | 2234 | /* New tab in existing window for middle click and | ||
4610 | 2235 | * control+click */ | ||
4611 | 2236 | else if (button == 2 || (button == 1 && state == GDK_CONTROL_MASK)) | ||
4612 | 2237 | { | ||
4613 | 2238 | flags |= EPHY_NEW_TAB_APPEND_AFTER; | ||
4614 | 2239 | } | ||
4615 | 2240 | /* Because we connect to button-press-event *after* | ||
4616 | 2241 | * (G_CONNECT_AFTER) we need to prevent WebKit from browsing to | ||
4617 | 2242 | * a link when you shift+click it. Otherwise when you | ||
4618 | 2243 | * shift+click a link to download it you would also be taken to | ||
4619 | 2244 | * the link destination. */ | ||
4620 | 2245 | else if (button == 1 && state == GDK_SHIFT_MASK) | ||
4621 | 2246 | { | ||
4622 | 2247 | webkit_policy_decision_ignore (decision); | ||
4623 | 2248 | |||
4624 | 2249 | return TRUE; | ||
4625 | 2250 | } | ||
4626 | 2251 | /* Those were our special cases, we won't handle this */ | ||
4627 | 2252 | else | ||
4628 | 2253 | { | ||
4629 | 2254 | return FALSE; | ||
4630 | 2255 | } | ||
4631 | 2256 | |||
4632 | 2257 | embed = ephy_embed_container_get_active_child | ||
4633 | 2258 | (EPHY_EMBED_CONTAINER (window)); | ||
4634 | 2259 | |||
4635 | 2260 | new_embed = ephy_shell_new_tab_full (ephy_shell_get_default (), | ||
4636 | 2261 | NULL, NULL, | ||
4637 | 2262 | target_window, | ||
4638 | 2263 | embed, | ||
4639 | 2264 | flags, | ||
4640 | 2265 | 0); | ||
4641 | 2266 | ephy_web_view_load_request (ephy_embed_get_web_view (new_embed), request); | ||
4642 | 2267 | |||
4643 | 2268 | webkit_policy_decision_ignore (decision); | ||
4644 | 2269 | |||
4645 | 2270 | return TRUE; | ||
4646 | 2271 | } | ||
4647 | 2272 | |||
4648 | 2273 | return FALSE; | ||
4649 | 2274 | } | ||
4650 | 2275 | |||
4651 | 2276 | static void | ||
4652 | 2277 | ephy_window_connect_active_embed (EphyWindow *window) | ||
4653 | 2278 | { | ||
4654 | 2279 | EphyEmbed *embed; | ||
4655 | 2280 | WebKitWebView *web_view; | ||
4656 | 2281 | EphyWebView *view; | ||
4657 | 2282 | |||
4658 | 2283 | g_return_if_fail (window->priv->active_embed != NULL); | ||
4659 | 2284 | |||
4660 | 2285 | embed = window->priv->active_embed; | ||
4661 | 2286 | view = ephy_embed_get_web_view (embed); | ||
4662 | 2287 | web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); | ||
4663 | 2288 | |||
4664 | 2289 | sync_tab_security (view, NULL, window); | ||
4665 | 2290 | sync_tab_document_type (view, NULL, window); | ||
4666 | 2291 | sync_tab_load_status (view, WEBKIT_LOAD_STARTED, window); | ||
4667 | 2292 | sync_tab_is_blank (view, NULL, window); | ||
4668 | 2293 | sync_tab_navigation (view, NULL, window); | ||
4669 | 2294 | sync_tab_title (embed, NULL, window); | ||
4670 | 2295 | sync_tab_address (view, NULL, window); | ||
4671 | 2296 | sync_tab_icon (view, NULL, window); | ||
4672 | 2297 | sync_tab_popup_windows (view, NULL, window); | ||
4673 | 2298 | sync_tab_popups_allowed (view, NULL, window); | ||
4674 | 2299 | |||
4675 | 2300 | sync_tab_zoom (web_view, NULL, window); | ||
4676 | 2301 | |||
4677 | 2302 | g_signal_connect_object (web_view, "notify::zoom-level", | ||
4678 | 2303 | G_CALLBACK (sync_tab_zoom), | ||
4679 | 2304 | window, 0); | ||
4680 | 2305 | |||
4681 | 2306 | g_signal_connect_object (web_view, "create", | ||
4682 | 2307 | G_CALLBACK (create_web_view_cb), | ||
4683 | 2308 | window, 0); | ||
4684 | 2309 | g_signal_connect_object (web_view, "decide-policy", | ||
4685 | 2310 | G_CALLBACK (decide_policy_cb), | ||
4686 | 2311 | window, 0); | ||
4687 | 2312 | g_signal_connect_object (view, "notify::hidden-popup-count", | ||
4688 | 2313 | G_CALLBACK (sync_tab_popup_windows), | ||
4689 | 2314 | window, 0); | ||
4690 | 2315 | g_signal_connect_object (view, "notify::popups-allowed", | ||
4691 | 2316 | G_CALLBACK (sync_tab_popups_allowed), | ||
4692 | 2317 | window, 0); | ||
4693 | 2318 | g_signal_connect_object (embed, "notify::title", | ||
4694 | 2319 | G_CALLBACK (sync_tab_title), | ||
4695 | 2320 | window, 0); | ||
4696 | 2321 | g_signal_connect_object (view, "notify::address", | ||
4697 | 2322 | G_CALLBACK (sync_tab_address), | ||
4698 | 2323 | window, 0); | ||
4699 | 2324 | g_signal_connect_object (view, "notify::icon", | ||
4700 | 2325 | G_CALLBACK (sync_tab_icon), | ||
4701 | 2326 | window, 0); | ||
4702 | 2327 | g_signal_connect_object (view, "notify::security-level", | ||
4703 | 2328 | G_CALLBACK (sync_tab_security), | ||
4704 | 2329 | window, 0); | ||
4705 | 2330 | g_signal_connect_object (view, "notify::document-type", | ||
4706 | 2331 | G_CALLBACK (sync_tab_document_type), | ||
4707 | 2332 | window, 0); | ||
4708 | 2333 | g_signal_connect_object (view, "load-changed", | ||
4709 | 2334 | G_CALLBACK (sync_tab_load_status), | ||
4710 | 2335 | window, 0); | ||
4711 | 2336 | g_signal_connect_object (view, "notify::navigation", | ||
4712 | 2337 | G_CALLBACK (sync_tab_navigation), | ||
4713 | 2338 | window, 0); | ||
4714 | 2339 | g_signal_connect_object (view, "notify::is-blank", | ||
4715 | 2340 | G_CALLBACK (sync_tab_is_blank), | ||
4716 | 2341 | window, 0); | ||
4717 | 2342 | g_signal_connect_object (view, "button-press-event", | ||
4718 | 2343 | G_CALLBACK (ephy_window_dom_mouse_click_cb), | ||
4719 | 2344 | window, 0); | ||
4720 | 2345 | g_signal_connect_object (view, "context-menu", | ||
4721 | 2346 | G_CALLBACK (populate_context_menu), | ||
4722 | 2347 | window, 0); | ||
4723 | 2348 | g_signal_connect_object (view, "mouse-target-changed", | ||
4724 | 2349 | G_CALLBACK (ephy_window_mouse_target_changed_cb), | ||
4725 | 2350 | window, 0); | ||
4726 | 2351 | |||
4727 | 2352 | g_object_notify (G_OBJECT (window), "active-child"); | ||
4728 | 2353 | } | ||
4729 | 2354 | |||
4730 | 2355 | static void | ||
4731 | 2356 | ephy_window_disconnect_active_embed (EphyWindow *window) | ||
4732 | 2357 | { | ||
4733 | 2358 | EphyEmbed *embed; | ||
4734 | 2359 | WebKitWebView *web_view; | ||
4735 | 2360 | EphyWebView *view; | ||
4736 | 2361 | |||
4737 | 2362 | g_return_if_fail (window->priv->active_embed != NULL); | ||
4738 | 2363 | |||
4739 | 2364 | embed = window->priv->active_embed; | ||
4740 | 2365 | web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); | ||
4741 | 2366 | view = EPHY_WEB_VIEW (web_view); | ||
4742 | 2367 | |||
4743 | 2368 | g_signal_handlers_disconnect_by_func (web_view, | ||
4744 | 2369 | G_CALLBACK (sync_tab_zoom), | ||
4745 | 2370 | window); | ||
4746 | 2371 | g_signal_handlers_disconnect_by_func (web_view, | ||
4747 | 2372 | G_CALLBACK (create_web_view_cb), | ||
4748 | 2373 | window); | ||
4749 | 2374 | g_signal_handlers_disconnect_by_func (view, | ||
4750 | 2375 | G_CALLBACK (decide_policy_cb), | ||
4751 | 2376 | window); | ||
4752 | 2377 | g_signal_handlers_disconnect_by_func (view, | ||
4753 | 2378 | G_CALLBACK (sync_tab_popup_windows), | ||
4754 | 2379 | window); | ||
4755 | 2380 | g_signal_handlers_disconnect_by_func (view, | ||
4756 | 2381 | G_CALLBACK (sync_tab_popups_allowed), | ||
4757 | 2382 | window); | ||
4758 | 2383 | g_signal_handlers_disconnect_by_func (view, | ||
4759 | 2384 | G_CALLBACK (sync_tab_security), | ||
4760 | 2385 | window); | ||
4761 | 2386 | g_signal_handlers_disconnect_by_func (view, | ||
4762 | 2387 | G_CALLBACK (sync_tab_document_type), | ||
4763 | 2388 | window); | ||
4764 | 2389 | g_signal_handlers_disconnect_by_func (view, | ||
4765 | 2390 | G_CALLBACK (sync_tab_load_status), | ||
4766 | 2391 | window); | ||
4767 | 2392 | g_signal_handlers_disconnect_by_func (view, | ||
4768 | 2393 | G_CALLBACK (sync_tab_is_blank), | ||
4769 | 2394 | window); | ||
4770 | 2395 | g_signal_handlers_disconnect_by_func (view, | ||
4771 | 2396 | G_CALLBACK (sync_tab_navigation), | ||
4772 | 2397 | window); | ||
4773 | 2398 | g_signal_handlers_disconnect_by_func (embed, | ||
4774 | 2399 | G_CALLBACK (sync_tab_title), | ||
4775 | 2400 | window); | ||
4776 | 2401 | g_signal_handlers_disconnect_by_func (view, | ||
4777 | 2402 | G_CALLBACK (sync_tab_address), | ||
4778 | 2403 | window); | ||
4779 | 2404 | g_signal_handlers_disconnect_by_func (view, | ||
4780 | 2405 | G_CALLBACK (sync_tab_icon), | ||
4781 | 2406 | window); | ||
4782 | 2407 | |||
4783 | 2408 | g_signal_handlers_disconnect_by_func | ||
4784 | 2409 | (view, G_CALLBACK (ephy_window_dom_mouse_click_cb), window); | ||
4785 | 2410 | g_signal_handlers_disconnect_by_func (view, | ||
4786 | 2411 | G_CALLBACK (populate_context_menu), | ||
4787 | 2412 | window); | ||
4788 | 2413 | g_signal_handlers_disconnect_by_func (view, | ||
4789 | 2414 | G_CALLBACK (ephy_window_mouse_target_changed_cb), | ||
4790 | 2415 | window); | ||
4791 | 2416 | } | ||
4792 | 2417 | |||
4793 | 2418 | static void | ||
4794 | 2419 | ephy_window_set_active_tab (EphyWindow *window, EphyEmbed *new_embed) | ||
4795 | 2420 | { | ||
4796 | 2421 | EphyEmbed *old_embed; | ||
4797 | 2422 | |||
4798 | 2423 | g_return_if_fail (EPHY_IS_WINDOW (window)); | ||
4799 | 2424 | g_return_if_fail (gtk_widget_get_toplevel (GTK_WIDGET (new_embed)) == GTK_WIDGET (window)); | ||
4800 | 2425 | |||
4801 | 2426 | old_embed = window->priv->active_embed; | ||
4802 | 2427 | |||
4803 | 2428 | if (old_embed == new_embed) return; | ||
4804 | 2429 | |||
4805 | 2430 | if (old_embed != NULL) | ||
4806 | 2431 | ephy_window_disconnect_active_embed (window); | ||
4807 | 2432 | |||
4808 | 2433 | window->priv->active_embed = new_embed; | ||
4809 | 2434 | |||
4810 | 2435 | if (new_embed != NULL) | ||
4811 | 2436 | ephy_window_connect_active_embed (window); | ||
4812 | 2437 | } | ||
4813 | 2438 | |||
4814 | 2439 | static gboolean | ||
4815 | 2440 | embed_modal_alert_cb (EphyEmbed *embed, | ||
4816 | 2441 | EphyWindow *window) | ||
4817 | 2442 | { | ||
4818 | 2443 | const char *address; | ||
4819 | 2444 | |||
4820 | 2445 | /* switch the window to the tab, and bring the window to the foreground | ||
4821 | 2446 | * (since the alert is modal, the user won't be able to do anything | ||
4822 | 2447 | * with his current window anyway :|) | ||
4823 | 2448 | */ | ||
4824 | 2449 | impl_set_active_child (EPHY_EMBED_CONTAINER (window), embed); | ||
4825 | 2450 | gtk_window_present (GTK_WINDOW (window)); | ||
4826 | 2451 | |||
4827 | 2452 | /* make sure the location entry shows the real URL of the tab's page */ | ||
4828 | 2453 | address = ephy_web_view_get_address (ephy_embed_get_web_view (embed)); | ||
4829 | 2454 | ephy_window_set_location (window, address); | ||
4830 | 2455 | |||
4831 | 2456 | /* don't suppress alert */ | ||
4832 | 2457 | return FALSE; | ||
4833 | 2458 | } | ||
4834 | 2459 | |||
4835 | 2460 | static void | ||
4836 | 2461 | tab_accels_item_activate (GtkAction *action, | ||
4837 | 2462 | EphyWindow *window) | ||
4838 | 2463 | { | ||
4839 | 2464 | EphyWindowPrivate *priv = window->priv; | ||
4840 | 2465 | const char *name; | ||
4841 | 2466 | int tab_number; | ||
4842 | 2467 | |||
4843 | 2468 | name = gtk_action_get_name (action); | ||
4844 | 2469 | tab_number = atoi (name + strlen ("TabAccel")); | ||
4845 | 2470 | |||
4846 | 2471 | gtk_notebook_set_current_page (priv->notebook, tab_number); | ||
4847 | 2472 | } | ||
4848 | 2473 | |||
4849 | 2474 | static void | ||
4850 | 2475 | tab_accels_update (EphyWindow *window) | ||
4851 | 2476 | { | ||
4852 | 2477 | EphyWindowPrivate *priv = window->priv; | ||
4853 | 2478 | int pages, i = 0; | ||
4854 | 2479 | GList *actions, *l; | ||
4855 | 2480 | |||
4856 | 2481 | actions = gtk_action_group_list_actions (priv->tab_accels_action_group); | ||
4857 | 2482 | pages = gtk_notebook_get_n_pages (priv->notebook); | ||
4858 | 2483 | for (l = actions; l != NULL; l = l->next) | ||
4859 | 2484 | { | ||
4860 | 2485 | GtkAction *action = GTK_ACTION (l->data); | ||
4861 | 2486 | |||
4862 | 2487 | gtk_action_set_sensitive (action, (i < pages)); | ||
4863 | 2488 | |||
4864 | 2489 | i++; | ||
4865 | 2490 | } | ||
4866 | 2491 | g_list_free (actions); | ||
4867 | 2492 | } | ||
4868 | 2493 | |||
4869 | 2494 | #define TAB_ACCELS_N 10 | ||
4870 | 2495 | |||
4871 | 2496 | static void | ||
4872 | 2497 | setup_tab_accels (EphyWindow *window) | ||
4873 | 2498 | { | ||
4874 | 2499 | EphyWindowPrivate *priv = window->priv; | ||
4875 | 2500 | guint id; | ||
4876 | 2501 | int i; | ||
4877 | 2502 | |||
4878 | 2503 | id = gtk_ui_manager_new_merge_id (priv->manager); | ||
4879 | 2504 | |||
4880 | 2505 | for (i = 0; i < TAB_ACCELS_N; i++) | ||
4881 | 2506 | { | ||
4882 | 2507 | GtkAction *action; | ||
4883 | 2508 | char *name; | ||
4884 | 2509 | char *accel; | ||
4885 | 2510 | |||
4886 | 2511 | name = g_strdup_printf ("TabAccel%d", i); | ||
4887 | 2512 | accel = g_strdup_printf ("<alt>%d", (i + 1) % TAB_ACCELS_N); | ||
4888 | 2513 | action = gtk_action_new (name, NULL, NULL, NULL); | ||
4889 | 2514 | |||
4890 | 2515 | gtk_action_group_add_action_with_accel (priv->tab_accels_action_group, | ||
4891 | 2516 | action, accel); | ||
4892 | 2517 | |||
4893 | 2518 | g_signal_connect (action, "activate", | ||
4894 | 2519 | G_CALLBACK (tab_accels_item_activate), window); | ||
4895 | 2520 | gtk_ui_manager_add_ui (priv->manager, id, "/", | ||
4896 | 2521 | name, name, | ||
4897 | 2522 | GTK_UI_MANAGER_ACCELERATOR, | ||
4898 | 2523 | FALSE); | ||
4899 | 2524 | |||
4900 | 2525 | g_object_unref (action); | ||
4901 | 2526 | g_free (accel); | ||
4902 | 2527 | g_free (name); | ||
4903 | 2528 | } | ||
4904 | 2529 | } | ||
4905 | 2530 | |||
4906 | 2531 | static gboolean | ||
4907 | 2532 | show_notebook_popup_menu (GtkNotebook *notebook, | ||
4908 | 2533 | EphyWindow *window, | ||
4909 | 2534 | GdkEventButton *event) | ||
4910 | 2535 | { | ||
4911 | 2536 | GtkWidget *menu, *tab, *tab_label; | ||
4912 | 2537 | GtkAction *action; | ||
4913 | 2538 | |||
4914 | 2539 | menu = gtk_ui_manager_get_widget (window->priv->manager, "/EphyNotebookPopup"); | ||
4915 | 2540 | g_return_val_if_fail (menu != NULL, FALSE); | ||
4916 | 2541 | |||
4917 | 2542 | /* allow extensions to sync when showing the popup */ | ||
4918 | 2543 | action = gtk_action_group_get_action (window->priv->action_group, | ||
4919 | 2544 | "NotebookPopupAction"); | ||
4920 | 2545 | g_return_val_if_fail (action != NULL, FALSE); | ||
4921 | 2546 | gtk_action_activate (action); | ||
4922 | 2547 | |||
4923 | 2548 | if (event != NULL) | ||
4924 | 2549 | { | ||
4925 | 2550 | gint n_pages, page_num; | ||
4926 | 2551 | |||
4927 | 2552 | tab = GTK_WIDGET (window->priv->active_embed); | ||
4928 | 2553 | n_pages = gtk_notebook_get_n_pages (notebook); | ||
4929 | 2554 | page_num = gtk_notebook_page_num (notebook, tab); | ||
4930 | 2555 | |||
4931 | 2556 | /* enable/disable move left/right items*/ | ||
4932 | 2557 | action = gtk_action_group_get_action (window->priv->action_group, | ||
4933 | 2558 | "TabsMoveLeft"); | ||
4934 | 2559 | gtk_action_set_sensitive (action, page_num > 0); | ||
4935 | 2560 | |||
4936 | 2561 | action = gtk_action_group_get_action (window->priv->action_group, | ||
4937 | 2562 | "TabsMoveRight"); | ||
4938 | 2563 | gtk_action_set_sensitive (action, page_num < n_pages - 1); | ||
4939 | 2564 | |||
4940 | 2565 | gtk_menu_popup (GTK_MENU (menu), NULL, NULL, | ||
4941 | 2566 | NULL, NULL, | ||
4942 | 2567 | event->button, event->time); | ||
4943 | 2568 | } | ||
4944 | 2569 | else | ||
4945 | 2570 | { | ||
4946 | 2571 | tab = GTK_WIDGET (window->priv->active_embed); | ||
4947 | 2572 | tab_label = gtk_notebook_get_tab_label (notebook, tab); | ||
4948 | 2573 | |||
4949 | 2574 | gtk_menu_popup (GTK_MENU (menu), NULL, NULL, | ||
4950 | 2575 | ephy_gui_menu_position_under_widget, tab_label, | ||
4951 | 2576 | 0, gtk_get_current_event_time ()); | ||
4952 | 2577 | gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE); | ||
4953 | 2578 | } | ||
4954 | 2579 | |||
4955 | 2580 | return TRUE; | ||
4956 | 2581 | } | ||
4957 | 2582 | |||
4958 | 2583 | static gboolean | ||
4959 | 2584 | notebook_button_press_cb (GtkNotebook *notebook, | ||
4960 | 2585 | GdkEventButton *event, | ||
4961 | 2586 | EphyWindow *window) | ||
4962 | 2587 | { | ||
4963 | 2588 | if (GDK_BUTTON_PRESS == event->type && 3 == event->button) | ||
4964 | 2589 | { | ||
4965 | 2590 | return show_notebook_popup_menu (notebook, window, event); | ||
4966 | 2591 | } | ||
4967 | 2592 | |||
4968 | 2593 | return FALSE; | ||
4969 | 2594 | } | ||
4970 | 2595 | |||
4971 | 2596 | static gboolean | ||
4972 | 2597 | notebook_popup_menu_cb (GtkNotebook *notebook, | ||
4973 | 2598 | EphyWindow *window) | ||
4974 | 2599 | { | ||
4975 | 2600 | /* Only respond if the notebook is the actual focus */ | ||
4976 | 2601 | if (EPHY_IS_NOTEBOOK (gtk_window_get_focus (GTK_WINDOW (window)))) | ||
4977 | 2602 | { | ||
4978 | 2603 | return show_notebook_popup_menu (notebook, window, NULL); | ||
4979 | 2604 | } | ||
4980 | 2605 | |||
4981 | 2606 | return FALSE; | ||
4982 | 2607 | } | ||
4983 | 2608 | |||
4984 | 2609 | static gboolean | ||
4985 | 2610 | present_on_idle_cb (GtkWindow *window) | ||
4986 | 2611 | { | ||
4987 | 2612 | gtk_window_present (window); | ||
4988 | 2613 | return FALSE; | ||
4989 | 2614 | } | ||
4990 | 2615 | |||
4991 | 2616 | static gboolean | ||
4992 | 2617 | delayed_remove_child (gpointer data) | ||
4993 | 2618 | { | ||
4994 | 2619 | GtkWidget *widget = GTK_WIDGET (data); | ||
4995 | 2620 | EphyEmbedContainer *container = EPHY_EMBED_CONTAINER (gtk_widget_get_toplevel (widget)); | ||
4996 | 2621 | |||
4997 | 2622 | ephy_embed_container_remove_child (container, EPHY_EMBED (widget)); | ||
4998 | 2623 | |||
4999 | 2624 | return FALSE; | ||
5000 | 2625 | } |
The diff has been truncated for viewing.
This already seems to have been done.