=== added directory '.pc/00_epiphany-browser.patch'
=== removed directory '.pc/00_epiphany-browser.patch'
=== added file '.pc/00_epiphany-browser.patch/.timestamp'
=== added file '.pc/00_epiphany-browser.patch/configure.ac'
--- .pc/00_epiphany-browser.patch/configure.ac 1970-01-01 00:00:00 +0000
+++ .pc/00_epiphany-browser.patch/configure.ac 2015-07-11 21:08:34 +0000
@@ -0,0 +1,261 @@
+# Copyright © 2000-2004 Marco Pesenti Gritti
+# Copyright © 2003, 2004, 2005, 2006, 2007 Christian Persch
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+m4_define([epiphany_version_major],[3])
+m4_define([epiphany_version_minor],[16])
+m4_define([epiphany_version_micro],[3])
+m4_define([epiphany_version],[epiphany_version_major.epiphany_version_minor.epiphany_version_micro])
+
+AC_INIT([GNOME Web Browser],[epiphany_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=epiphany],[epiphany])
+
+AC_PREREQ([2.59])
+
+AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_SRCDIR([configure.ac])
+
+AC_SUBST([EPIPHANY_MAJOR],[epiphany_version_major.epiphany_version_minor])
+
+# for EPHY_CHECK_VERSION
+AC_SUBST([EPIPHANY_MAJOR_VERSION], [epiphany_version_major])
+AC_SUBST([EPIPHANY_MINOR_VERSION], [epiphany_version_minor])
+AC_SUBST([EPIPHANY_MICRO_VERSION], [epiphany_version_micro])
+
+AM_INIT_AUTOMAKE([1.11 foreign dist-xz no-dist-gzip tar-ustar])
+
+# Use AM_SILENT_RULES if present
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
+AM_MAINTAINER_MODE([enable])
+
+# Initialize libtool
+LT_PREREQ(2.2)
+LT_INIT([dlopen disable-static])
+
+AC_PROG_CC
+
+AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal])
+AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
+
+IT_PROG_INTLTOOL([0.50.0])
+
+GLIB_GSETTINGS
+
+PKG_PROG_PKG_CONFIG
+
+GNOME_DEBUG_CHECK
+GNOME_COMPILE_WARNINGS([maximum])
+GNOME_MAINTAINER_MODE_DEFINES
+
+GNOME_CODE_COVERAGE
+
+WARN_CFLAGS="$WARN_CFLAGS -Wdeclaration-after-statement -Wno-deprecated-declarations -Wno-missing-prototypes"
+
+GLIB_REQUIRED=2.38.0
+GTK_REQUIRED=3.13.0
+LIBXML_REQUIRED=2.6.12
+LIBXSLT_REQUIRED=1.1.7
+WEBKIT_GTK_REQUIRED=2.7.4
+LIBSOUP_REQUIRED=2.48.0
+GNOME_DESKTOP_REQUIRED=2.91.2
+LIBSECRET_REQUIRED=0.14
+GSETTINGS_DESKTOP_SCHEMAS_REQUIRED=0.0.1
+LIBNOTIFY_REQUIRED=0.5.1
+GCR_REQUIRED=3.5.5
+AVAHI_REQUIRED=0.6.22
+
+# Tests
+
+AC_MSG_CHECKING([whether to build tests])
+AC_ARG_ENABLE([tests],
+ AS_HELP_STRING([--enable-tests],[Whether to build tests (default: yes)]),
+ [], [enable_tests=yes])
+AC_MSG_RESULT([$enable_tests])
+
+AM_CONDITIONAL([ENABLE_TESTS],[test "$enable_tests" = "yes"])
+
+PKG_CHECK_MODULES([DEPENDENCIES], [
+ glib-2.0 >= $GLIB_REQUIRED
+ gthread-2.0
+ gio-unix-2.0 >= $GLIB_REQUIRED
+ gtk+-3.0 >= $GTK_REQUIRED
+ gtk+-unix-print-3.0 >= $GTK_REQUIRED
+ x11
+ libwnck-3.0
+ libxml-2.0 >= $LIBXML_REQUIRED
+ libxslt >= $LIBXSLT_REQUIRED
+ webkit2gtk-4.0 >= $WEBKIT_GTK_REQUIRED
+ libsoup-2.4 >= $LIBSOUP_REQUIRED
+ libsecret-1 >= $LIBSECRET_REQUIRED
+ gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED
+ gsettings-desktop-schemas >= $GSETTINGS_DESKTOP_SCHEMAS_REQUIRED
+ libnotify >= $LIBNOTIFY_REQUIRED
+ sqlite3
+ gcr-3 >= $GCR_REQUIRED
+ avahi-gobject >= $AVAHI_REQUIRED
+ avahi-client >= $AVAHI_REQUIRED
+ ])
+
+PKG_CHECK_MODULES(WEB_EXTENSION, [
+ webkit2gtk-web-extension-4.0 >= $WEBKIT_GTK_REQUIRED
+ libsecret-1 >= $LIBSECRET_REQUIRED
+ ])
+AC_SUBST(WEB_EXTENSION_CFLAGS)
+AC_SUBST(WEB_EXTENSION_LIBS)
+
+# ******************
+# Portability checks
+# ******************
+
+AC_CHECK_FUNCS([localtime_r memchr memmove memset mkdir mkdtemp realpath sqrt strchr strcspn strdup strerror strrchr strtol strtoul strstr])
+
+# for backtrace()
+AC_CHECK_HEADERS([execinfo.h fcntl.h])
+AC_SEARCH_LIBS([backtrace], [c execinfo])
+AC_C_INLINE
+AC_FUNC_MKTIME
+AC_FUNC_STRTOD
+AC_TYPE_SIZE_T
+
+# ***************
+# Multimedia keys
+# ***************
+
+AC_CHECK_HEADERS([X11/XF86keysym.h])
+
+# ***
+# NSS
+# ***
+
+AC_MSG_CHECKING([whether NSS support is requested])
+AC_ARG_ENABLE([nss],
+ [AS_HELP_STRING([--enable-nss], [Enable NSS support (default: enabled)])],
+ [], [enable_nss=yes])
+AC_MSG_RESULT([$enable_nss])
+
+if test "$enable_nss" = "yes"; then
+ PKG_CHECK_MODULES([NSS], [nss])
+
+ AC_DEFINE([ENABLE_NSS], [1], [Define to compile with NSS support])
+fi
+
+AM_CONDITIONAL([ENABLE_NSS],[test "$enable_nss" = "yes"])
+
+# *******************************
+# Internationalization
+# *******************************
+
+ISO_CODES_REQUIRED=0.35
+
+PKG_CHECK_EXISTS([iso-codes >= $ISO_CODES_REQUIRED],
+ [have_iso_codes=yes],[have_iso_codes=no])
+
+if test "$have_iso_codes" = "yes"; then
+ AC_MSG_CHECKING([whether iso-codes has iso-639 and iso-3166 domains])
+ if $PKG_CONFIG --variable=domains iso-codes | grep -q 639 && \
+ $PKG_CONFIG --variable=domains iso-codes | grep -q 3166 ; then
+ result=yes
+ else
+ result=no
+ have_iso_codes=no
+ fi
+ AC_MSG_RESULT([$result])
+fi
+
+if test "$have_iso_codes" = "yes"; then
+ AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["`$PKG_CONFIG --variable=prefix iso-codes`"],[ISO codes prefix])
+ AC_DEFINE([HAVE_ISO_CODES],[1],[Define if you have the iso-codes package])
+else
+ AC_MSG_ERROR([iso-codes is required])
+fi
+
+GETTEXT_PACKAGE=epiphany
+AC_SUBST([GETTEXT_PACKAGE])
+AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
+AM_GLIB_GNU_GETTEXT
+
+# *******************************
+# User help
+# *******************************
+
+YELP_HELP_INIT
+
+# ****************
+# Distributor name
+# ****************
+
+AC_ARG_WITH([distributor-name],
+ AS_HELP_STRING([--with-distributor-name=name],[Set the distributor name]),
+ [LSB_DISTRIBUTOR="$withval"])
+
+if test -z "$LSB_DISTRIBUTOR"; then
+ AC_CHECK_PROGS([LSB_RELEASE], [lsb_release],)
+ if test -n "$LSB_RELEASE"; then
+ # Fallback on lsb_release if available
+ LSB_DISTRIBUTOR=$($LSB_RELEASE -i -s)
+ else
+ # Fallback on the product name
+ LSB_DISTRIBUTOR="Epiphany"
+ fi
+fi
+
+AC_DEFINE_UNQUOTED([LSB_DISTRIBUTOR],["$LSB_DISTRIBUTOR"],[Distributor name])
+
+# ************
+# Output files
+# ************
+
+AC_DEFINE([EPIPHANY_COMPILATION],[1],[Compiling epiphany])
+
+AC_CONFIG_FILES([
+Makefile
+data/Makefile
+data/epiphany.desktop.in
+data/pages/Makefile
+doc/Makefile
+help/Makefile
+lib/Makefile
+lib/egg/Makefile
+lib/history/Makefile
+lib/widgets/Makefile
+embed/Makefile
+embed/web-extension/Makefile
+src/Makefile
+src/bookmarks/Makefile
+po/Makefile.in
+tests/Makefile
+tests/data/Makefile
+],
+[])
+
+AC_OUTPUT
+
+# *************************************
+# *************************************
+
+echo "
+Epiphany was configured with the following options:
+
+ Source code location : $srcdir
+ Compiler : $CC
+ Prefix : $prefix
+ Extra debugging support : $enable_debug
+ Build tests : $enable_tests
+ Code coverage : $enable_code_coverage
+
+ NSS support : $enable_nss
+"
=== removed file '.pc/00_epiphany-browser.patch/configure.ac'
--- .pc/00_epiphany-browser.patch/configure.ac 2015-06-25 06:50:45 +0000
+++ .pc/00_epiphany-browser.patch/configure.ac 1970-01-01 00:00:00 +0000
@@ -1,261 +0,0 @@
-# Copyright © 2000-2004 Marco Pesenti Gritti
-# Copyright © 2003, 2004, 2005, 2006, 2007 Christian Persch
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 2 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-m4_define([epiphany_version_major],[3])
-m4_define([epiphany_version_minor],[16])
-m4_define([epiphany_version_micro],[2])
-m4_define([epiphany_version],[epiphany_version_major.epiphany_version_minor.epiphany_version_micro])
-
-AC_INIT([GNOME Web Browser],[epiphany_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=epiphany],[epiphany])
-
-AC_PREREQ([2.59])
-
-AC_CONFIG_MACRO_DIR([m4])
-AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_SRCDIR([configure.ac])
-
-AC_SUBST([EPIPHANY_MAJOR],[epiphany_version_major.epiphany_version_minor])
-
-# for EPHY_CHECK_VERSION
-AC_SUBST([EPIPHANY_MAJOR_VERSION], [epiphany_version_major])
-AC_SUBST([EPIPHANY_MINOR_VERSION], [epiphany_version_minor])
-AC_SUBST([EPIPHANY_MICRO_VERSION], [epiphany_version_micro])
-
-AM_INIT_AUTOMAKE([1.11 foreign dist-xz no-dist-gzip tar-ustar])
-
-# Use AM_SILENT_RULES if present
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
-
-AM_MAINTAINER_MODE([enable])
-
-# Initialize libtool
-LT_PREREQ(2.2)
-LT_INIT([dlopen disable-static])
-
-AC_PROG_CC
-
-AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal])
-AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
-
-IT_PROG_INTLTOOL([0.50.0])
-
-GLIB_GSETTINGS
-
-PKG_PROG_PKG_CONFIG
-
-GNOME_DEBUG_CHECK
-GNOME_COMPILE_WARNINGS([maximum])
-GNOME_MAINTAINER_MODE_DEFINES
-
-GNOME_CODE_COVERAGE
-
-WARN_CFLAGS="$WARN_CFLAGS -Wdeclaration-after-statement -Wno-deprecated-declarations -Wno-missing-prototypes"
-
-GLIB_REQUIRED=2.38.0
-GTK_REQUIRED=3.13.0
-LIBXML_REQUIRED=2.6.12
-LIBXSLT_REQUIRED=1.1.7
-WEBKIT_GTK_REQUIRED=2.7.4
-LIBSOUP_REQUIRED=2.48.0
-GNOME_DESKTOP_REQUIRED=2.91.2
-LIBSECRET_REQUIRED=0.14
-GSETTINGS_DESKTOP_SCHEMAS_REQUIRED=0.0.1
-LIBNOTIFY_REQUIRED=0.5.1
-GCR_REQUIRED=3.5.5
-AVAHI_REQUIRED=0.6.22
-
-# Tests
-
-AC_MSG_CHECKING([whether to build tests])
-AC_ARG_ENABLE([tests],
- AS_HELP_STRING([--enable-tests],[Whether to build tests (default: yes)]),
- [], [enable_tests=yes])
-AC_MSG_RESULT([$enable_tests])
-
-AM_CONDITIONAL([ENABLE_TESTS],[test "$enable_tests" = "yes"])
-
-PKG_CHECK_MODULES([DEPENDENCIES], [
- glib-2.0 >= $GLIB_REQUIRED
- gthread-2.0
- gio-unix-2.0 >= $GLIB_REQUIRED
- gtk+-3.0 >= $GTK_REQUIRED
- gtk+-unix-print-3.0 >= $GTK_REQUIRED
- x11
- libwnck-3.0
- libxml-2.0 >= $LIBXML_REQUIRED
- libxslt >= $LIBXSLT_REQUIRED
- webkit2gtk-4.0 >= $WEBKIT_GTK_REQUIRED
- libsoup-2.4 >= $LIBSOUP_REQUIRED
- libsecret-1 >= $LIBSECRET_REQUIRED
- gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED
- gsettings-desktop-schemas >= $GSETTINGS_DESKTOP_SCHEMAS_REQUIRED
- libnotify >= $LIBNOTIFY_REQUIRED
- sqlite3
- gcr-3 >= $GCR_REQUIRED
- avahi-gobject >= $AVAHI_REQUIRED
- avahi-client >= $AVAHI_REQUIRED
- ])
-
-PKG_CHECK_MODULES(WEB_EXTENSION, [
- webkit2gtk-web-extension-4.0 >= $WEBKIT_GTK_REQUIRED
- libsecret-1 >= $LIBSECRET_REQUIRED
- ])
-AC_SUBST(WEB_EXTENSION_CFLAGS)
-AC_SUBST(WEB_EXTENSION_LIBS)
-
-# ******************
-# Portability checks
-# ******************
-
-AC_CHECK_FUNCS([localtime_r memchr memmove memset mkdir mkdtemp realpath sqrt strchr strcspn strdup strerror strrchr strtol strtoul strstr])
-
-# for backtrace()
-AC_CHECK_HEADERS([execinfo.h fcntl.h])
-AC_SEARCH_LIBS([backtrace], [c execinfo])
-AC_C_INLINE
-AC_FUNC_MKTIME
-AC_FUNC_STRTOD
-AC_TYPE_SIZE_T
-
-# ***************
-# Multimedia keys
-# ***************
-
-AC_CHECK_HEADERS([X11/XF86keysym.h])
-
-# ***
-# NSS
-# ***
-
-AC_MSG_CHECKING([whether NSS support is requested])
-AC_ARG_ENABLE([nss],
- [AS_HELP_STRING([--enable-nss], [Enable NSS support (default: enabled)])],
- [], [enable_nss=yes])
-AC_MSG_RESULT([$enable_nss])
-
-if test "$enable_nss" = "yes"; then
- PKG_CHECK_MODULES([NSS], [nss])
-
- AC_DEFINE([ENABLE_NSS], [1], [Define to compile with NSS support])
-fi
-
-AM_CONDITIONAL([ENABLE_NSS],[test "$enable_nss" = "yes"])
-
-# *******************************
-# Internationalization
-# *******************************
-
-ISO_CODES_REQUIRED=0.35
-
-PKG_CHECK_EXISTS([iso-codes >= $ISO_CODES_REQUIRED],
- [have_iso_codes=yes],[have_iso_codes=no])
-
-if test "$have_iso_codes" = "yes"; then
- AC_MSG_CHECKING([whether iso-codes has iso-639 and iso-3166 domains])
- if $PKG_CONFIG --variable=domains iso-codes | grep -q 639 && \
- $PKG_CONFIG --variable=domains iso-codes | grep -q 3166 ; then
- result=yes
- else
- result=no
- have_iso_codes=no
- fi
- AC_MSG_RESULT([$result])
-fi
-
-if test "$have_iso_codes" = "yes"; then
- AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["`$PKG_CONFIG --variable=prefix iso-codes`"],[ISO codes prefix])
- AC_DEFINE([HAVE_ISO_CODES],[1],[Define if you have the iso-codes package])
-else
- AC_MSG_ERROR([iso-codes is required])
-fi
-
-GETTEXT_PACKAGE=epiphany
-AC_SUBST([GETTEXT_PACKAGE])
-AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
-AM_GLIB_GNU_GETTEXT
-
-# *******************************
-# User help
-# *******************************
-
-YELP_HELP_INIT
-
-# ****************
-# Distributor name
-# ****************
-
-AC_ARG_WITH([distributor-name],
- AS_HELP_STRING([--with-distributor-name=name],[Set the distributor name]),
- [LSB_DISTRIBUTOR="$withval"])
-
-if test -z "$LSB_DISTRIBUTOR"; then
- AC_CHECK_PROGS([LSB_RELEASE], [lsb_release],)
- if test -n "$LSB_RELEASE"; then
- # Fallback on lsb_release if available
- LSB_DISTRIBUTOR=$($LSB_RELEASE -i -s)
- else
- # Fallback on the product name
- LSB_DISTRIBUTOR="Epiphany"
- fi
-fi
-
-AC_DEFINE_UNQUOTED([LSB_DISTRIBUTOR],["$LSB_DISTRIBUTOR"],[Distributor name])
-
-# ************
-# Output files
-# ************
-
-AC_DEFINE([EPIPHANY_COMPILATION],[1],[Compiling epiphany])
-
-AC_CONFIG_FILES([
-Makefile
-data/Makefile
-data/epiphany.desktop.in
-data/pages/Makefile
-doc/Makefile
-help/Makefile
-lib/Makefile
-lib/egg/Makefile
-lib/history/Makefile
-lib/widgets/Makefile
-embed/Makefile
-embed/web-extension/Makefile
-src/Makefile
-src/bookmarks/Makefile
-po/Makefile.in
-tests/Makefile
-tests/data/Makefile
-],
-[])
-
-AC_OUTPUT
-
-# *************************************
-# *************************************
-
-echo "
-Epiphany was configured with the following options:
-
- Source code location : $srcdir
- Compiler : $CC
- Prefix : $prefix
- Extra debugging support : $enable_debug
- Build tests : $enable_tests
- Code coverage : $enable_code_coverage
-
- NSS support : $enable_nss
-"
=== added directory '.pc/07_bookmarks.patch'
=== removed directory '.pc/07_bookmarks.patch'
=== added file '.pc/07_bookmarks.patch/.timestamp'
=== added directory '.pc/07_bookmarks.patch/data'
=== removed directory '.pc/07_bookmarks.patch/data'
=== added file '.pc/07_bookmarks.patch/data/default-bookmarks.rdf.in'
--- .pc/07_bookmarks.patch/data/default-bookmarks.rdf.in 1970-01-01 00:00:00 +0000
+++ .pc/07_bookmarks.patch/data/default-bookmarks.rdf.in 2015-07-11 21:08:34 +0000
@@ -0,0 +1,37 @@
+
+
+
+ Web bookmarks
+ https://wiki.gnome.org/Apps/Web
+
+
+
+
+
+
+ -
+ <_title>Search the web
+
+ <_link>https://duckduckgo.com/?t=epiphany
+
+ <_ephy:smartlink>https://duckduckgo.com/?q=%s&t=epiphany
+
+
=== removed file '.pc/07_bookmarks.patch/data/default-bookmarks.rdf.in'
--- .pc/07_bookmarks.patch/data/default-bookmarks.rdf.in 2014-04-11 23:16:25 +0000
+++ .pc/07_bookmarks.patch/data/default-bookmarks.rdf.in 1970-01-01 00:00:00 +0000
@@ -1,37 +0,0 @@
-
-
-
- Web bookmarks
- https://wiki.gnome.org/Apps/Web
-
-
-
-
-
-
- -
- <_title>Search the web
-
- <_link>https://duckduckgo.com/?t=epiphany
-
- <_ephy:smartlink>https://duckduckgo.com/?q=%s&t=epiphany
-
-
=== added directory '.pc/12_safetypes.patch'
=== removed directory '.pc/12_safetypes.patch'
=== added file '.pc/12_safetypes.patch/.timestamp'
=== added directory '.pc/12_safetypes.patch/data'
=== removed directory '.pc/12_safetypes.patch/data'
=== added file '.pc/12_safetypes.patch/data/mime-types-permissions.xml'
--- .pc/12_safetypes.patch/data/mime-types-permissions.xml 1970-01-01 00:00:00 +0000
+++ .pc/12_safetypes.patch/data/mime-types-permissions.xml 2015-07-11 21:08:34 +0000
@@ -0,0 +1,482 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
=== removed file '.pc/12_safetypes.patch/data/mime-types-permissions.xml'
--- .pc/12_safetypes.patch/data/mime-types-permissions.xml 2010-07-03 01:38:24 +0000
+++ .pc/12_safetypes.patch/data/mime-types-permissions.xml 1970-01-01 00:00:00 +0000
@@ -1,482 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
=== added directory '.pc/81_ubuntu_force_update_bookmarks_menu.patch'
=== removed directory '.pc/81_ubuntu_force_update_bookmarks_menu.patch'
=== added file '.pc/81_ubuntu_force_update_bookmarks_menu.patch/.timestamp'
=== added directory '.pc/81_ubuntu_force_update_bookmarks_menu.patch/src'
=== removed directory '.pc/81_ubuntu_force_update_bookmarks_menu.patch/src'
=== added directory '.pc/81_ubuntu_force_update_bookmarks_menu.patch/src/bookmarks'
=== removed directory '.pc/81_ubuntu_force_update_bookmarks_menu.patch/src/bookmarks'
=== added file '.pc/81_ubuntu_force_update_bookmarks_menu.patch/src/bookmarks/ephy-bookmarks-ui.c'
--- .pc/81_ubuntu_force_update_bookmarks_menu.patch/src/bookmarks/ephy-bookmarks-ui.c 1970-01-01 00:00:00 +0000
+++ .pc/81_ubuntu_force_update_bookmarks_menu.patch/src/bookmarks/ephy-bookmarks-ui.c 2015-07-11 21:08:34 +0000
@@ -0,0 +1,363 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright © 2005 Peter Harvey
+ * Copyright © 2006 Christian Persch
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "ephy-bookmarks-ui.h"
+
+#include "ephy-bookmark-action-group.h"
+#include "ephy-bookmark-action.h"
+#include "ephy-bookmark-properties.h"
+#include "ephy-bookmarks-menu.h"
+#include "ephy-bookmarks.h"
+#include "ephy-debug.h"
+#include "ephy-dnd.h"
+#include "ephy-embed-shell.h"
+#include "ephy-file-helpers.h"
+#include "ephy-gui.h"
+#include "ephy-link.h"
+#include "ephy-node-common.h"
+#include "ephy-open-tabs-action.h"
+#include "ephy-prefs.h"
+#include "ephy-settings.h"
+#include "ephy-shell.h"
+#include "ephy-string.h"
+#include "ephy-topic-action-group.h"
+#include "ephy-topic-action.h"
+
+#include
+#include
+#include
+
+#define BM_WINDOW_DATA_KEY "bookmarks-window-data"
+
+typedef struct
+{
+ guint bookmarks_menu;
+ guint toolbar_menu;
+} BookmarksWindowData;
+
+enum
+{
+ RESPONSE_SHOW_PROPERTIES = 1,
+ RESPONSE_NEW_BOOKMARK = 2
+};
+
+static GString * bookmarks_menu_string = 0;
+static GHashTable *properties_dialogs = 0;
+
+static GtkAction *
+find_action (GtkUIManager *manager, const char *name)
+{
+ GList *l = gtk_ui_manager_get_action_groups (manager);
+ GtkAction *action;
+
+ while (l != NULL)
+ {
+ action = gtk_action_group_get_action (GTK_ACTION_GROUP (l->data), name);
+ if (action) return action;
+ l = l->next;
+ }
+
+ return NULL;
+}
+
+static void
+activate_bookmarks_menu (GtkAction *action, EphyWindow *window)
+{
+ BookmarksWindowData *data = g_object_get_data (G_OBJECT (window), BM_WINDOW_DATA_KEY);
+ if (data && !data->bookmarks_menu)
+ {
+ GtkUIManager *manager = ephy_window_get_ui_manager (window);
+ gtk_ui_manager_ensure_update (manager);
+
+ if (!bookmarks_menu_string->len)
+ {
+ g_string_append (bookmarks_menu_string,
+ "");
+ }
+
+ data->bookmarks_menu = gtk_ui_manager_add_ui_from_string
+ (manager, bookmarks_menu_string->str, bookmarks_menu_string->len, 0);
+
+ gtk_ui_manager_ensure_update (manager);
+ }
+}
+
+static void
+erase_bookmarks_menu (EphyWindow *window)
+{
+ BookmarksWindowData *data;
+ GtkUIManager *manager;
+
+ manager = ephy_window_get_ui_manager (window);
+ data = g_object_get_data (G_OBJECT (window), BM_WINDOW_DATA_KEY);
+
+ if (data != NULL && data->bookmarks_menu != 0)
+ {
+ gtk_ui_manager_remove_ui (manager, data->bookmarks_menu);
+ data->bookmarks_menu = 0;
+ }
+
+ g_string_truncate (bookmarks_menu_string, 0);
+}
+
+static void
+tree_changed_cb (EphyBookmarks *bookmarks,
+ EphyWindow *window)
+{
+ erase_bookmarks_menu (window);
+}
+
+static void
+node_added_cb (EphyNode *parent,
+ EphyNode *child,
+ EphyWindow *window)
+{
+ erase_bookmarks_menu (window);
+}
+
+static void
+node_changed_cb (EphyNode *parent,
+ EphyNode *child,
+ guint property_id,
+ EphyWindow *window)
+{
+ if (property_id == EPHY_NODE_KEYWORD_PROP_NAME ||
+ property_id == EPHY_NODE_BMK_PROP_TITLE)
+ {
+ erase_bookmarks_menu (window);
+ }
+}
+
+static void
+node_removed_cb (EphyNode *parent,
+ EphyNode *child,
+ guint index,
+ EphyWindow *window)
+{
+ erase_bookmarks_menu (window);
+}
+
+void
+ephy_bookmarks_ui_attach_window (EphyWindow *window)
+{
+ EphyBookmarks *eb;
+ EphyNode *bookmarks;
+ EphyNode *topics;
+ BookmarksWindowData *data;
+ GtkUIManager *manager;
+ GtkActionGroup *actions;
+ GtkAction *action;
+
+ eb = ephy_shell_get_bookmarks (ephy_shell_get_default ());
+ bookmarks = ephy_bookmarks_get_bookmarks (eb);
+ topics = ephy_bookmarks_get_keywords (eb);
+ data = g_object_get_data (G_OBJECT (window), BM_WINDOW_DATA_KEY);
+ g_return_if_fail (data == NULL);
+
+ manager = ephy_window_get_ui_manager (window);
+
+ data = g_new0 (BookmarksWindowData, 1);
+ g_object_set_data_full (G_OBJECT (window), BM_WINDOW_DATA_KEY, data, g_free);
+
+ /* Create the self-maintaining action groups for bookmarks and topics */
+ actions = ephy_bookmark_group_new (bookmarks);
+ gtk_ui_manager_insert_action_group (manager, actions, -1);
+ g_signal_connect_object (actions, "open-link",
+ G_CALLBACK (ephy_link_open), G_OBJECT (window),
+ G_CONNECT_SWAPPED | G_CONNECT_AFTER);
+ g_object_unref (actions);
+
+ actions = ephy_topic_action_group_new (topics, manager);
+ gtk_ui_manager_insert_action_group (manager, actions, -1);
+ g_object_unref (actions);
+
+ actions = ephy_open_tabs_group_new (topics);
+ gtk_ui_manager_insert_action_group (manager, actions, -1);
+ g_signal_connect_object (actions, "open-link",
+ G_CALLBACK (ephy_link_open), G_OBJECT (window),
+ G_CONNECT_SWAPPED | G_CONNECT_AFTER);
+ g_object_unref (actions);
+
+ /* Add signal handlers for the bookmark database */
+ ephy_node_signal_connect_object (bookmarks, EPHY_NODE_CHILD_ADDED,
+ (EphyNodeCallback)node_added_cb,
+ G_OBJECT (window));
+ ephy_node_signal_connect_object (topics, EPHY_NODE_CHILD_ADDED,
+ (EphyNodeCallback)node_added_cb,
+ G_OBJECT (window));
+
+ ephy_node_signal_connect_object (bookmarks, EPHY_NODE_CHILD_REMOVED,
+ (EphyNodeCallback)node_removed_cb,
+ G_OBJECT (window));
+ ephy_node_signal_connect_object (topics, EPHY_NODE_CHILD_REMOVED,
+ (EphyNodeCallback)node_removed_cb,
+ G_OBJECT (window));
+
+ ephy_node_signal_connect_object (bookmarks, EPHY_NODE_CHILD_CHANGED,
+ (EphyNodeCallback)node_changed_cb,
+ G_OBJECT (window));
+ ephy_node_signal_connect_object (topics, EPHY_NODE_CHILD_CHANGED,
+ (EphyNodeCallback)node_changed_cb,
+ G_OBJECT (window));
+
+ g_signal_connect_object (eb, "tree_changed",
+ G_CALLBACK (tree_changed_cb),
+ G_OBJECT (window), 0);
+
+ /* Setup empty menu strings and add signal handlers to build the menus on demand */
+ if (!bookmarks_menu_string)
+ bookmarks_menu_string = g_string_new ("");
+
+ action = find_action (manager, "Bookmarks");
+ g_signal_connect_object (action, "activate",
+ G_CALLBACK (activate_bookmarks_menu),
+ G_OBJECT (window), 0);
+}
+
+void
+ephy_bookmarks_ui_detach_window (EphyWindow *window)
+{
+ EphyBookmarks *eb = ephy_shell_get_bookmarks (ephy_shell_get_default ());
+ EphyNode *bookmarks = ephy_bookmarks_get_bookmarks (eb);
+ EphyNode *topics = ephy_bookmarks_get_keywords (eb);
+
+ BookmarksWindowData *data = g_object_get_data (G_OBJECT (window), BM_WINDOW_DATA_KEY);
+ GtkUIManager *manager = ephy_window_get_ui_manager (window);
+ GtkAction *action;
+
+ g_return_if_fail (data != 0);
+
+ if (data->bookmarks_menu)
+ gtk_ui_manager_remove_ui (manager, data->bookmarks_menu);
+
+ g_object_set_data (G_OBJECT (window), BM_WINDOW_DATA_KEY, 0);
+
+ ephy_node_signal_disconnect_object (bookmarks, EPHY_NODE_CHILD_ADDED,
+ (EphyNodeCallback)node_added_cb,
+ G_OBJECT (window));
+ ephy_node_signal_disconnect_object (topics, EPHY_NODE_CHILD_ADDED,
+ (EphyNodeCallback)node_added_cb,
+ G_OBJECT (window));
+
+ ephy_node_signal_disconnect_object (bookmarks, EPHY_NODE_CHILD_REMOVED,
+ (EphyNodeCallback)node_removed_cb,
+ G_OBJECT (window));
+ ephy_node_signal_disconnect_object (topics, EPHY_NODE_CHILD_REMOVED,
+ (EphyNodeCallback)node_removed_cb,
+ G_OBJECT (window));
+
+ ephy_node_signal_disconnect_object (bookmarks, EPHY_NODE_CHILD_CHANGED,
+ (EphyNodeCallback)node_changed_cb,
+ G_OBJECT (window));
+ ephy_node_signal_disconnect_object (topics, EPHY_NODE_CHILD_CHANGED,
+ (EphyNodeCallback)node_changed_cb,
+ G_OBJECT (window));
+
+ g_signal_handlers_disconnect_by_func
+ (G_OBJECT (eb), G_CALLBACK (tree_changed_cb), G_OBJECT (window));
+
+ action = find_action (manager, "Bookmarks");
+ g_signal_handlers_disconnect_by_func
+ (G_OBJECT (action), G_CALLBACK (activate_bookmarks_menu), G_OBJECT (window));
+}
+
+static void
+properties_dialog_destroy_cb (EphyBookmarkProperties *dialog,
+ EphyNode *bookmark)
+{
+ g_hash_table_remove (properties_dialogs, bookmark);
+}
+
+void
+ephy_bookmarks_ui_add_bookmark (GtkWindow *parent,
+ const char *location,
+ const char *title)
+{
+ EphyBookmarks *bookmarks;
+ EphyNode *bookmark;
+ GtkWidget *dialog;
+
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING))
+ return;
+
+ bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ());
+ bookmark = ephy_bookmarks_add (bookmarks, title, location);
+
+ if (properties_dialogs == 0)
+ {
+ properties_dialogs = g_hash_table_new (g_direct_hash, g_direct_equal);
+ }
+
+ dialog = ephy_bookmark_properties_new (bookmarks, bookmark, TRUE);
+
+ g_assert (parent != NULL);
+
+ gtk_window_group_add_window (ephy_gui_ensure_window_group (parent),
+ GTK_WINDOW (dialog));
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
+
+ g_signal_connect (dialog, "destroy",
+ G_CALLBACK (properties_dialog_destroy_cb), bookmark);
+ g_hash_table_insert (properties_dialogs,
+ bookmark, dialog);
+
+ gtk_window_present_with_time (GTK_WINDOW (dialog),
+ gtk_get_current_event_time ());
+}
+
+void
+ephy_bookmarks_ui_show_bookmark (EphyNode *bookmark)
+{
+ EphyBookmarks *bookmarks;
+ GtkWidget *dialog;
+
+ bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ());
+
+ g_return_if_fail (EPHY_IS_BOOKMARKS (bookmarks));
+ g_return_if_fail (EPHY_IS_NODE (bookmark));
+
+ if (properties_dialogs == 0)
+ {
+ properties_dialogs = g_hash_table_new (g_direct_hash, g_direct_equal);
+ }
+
+ dialog = g_hash_table_lookup (properties_dialogs, bookmark);
+
+ if (dialog == NULL)
+ {
+ dialog = ephy_bookmark_properties_new (bookmarks, bookmark, FALSE);
+
+ g_signal_connect (dialog, "destroy",
+ G_CALLBACK (properties_dialog_destroy_cb), bookmark);
+ g_hash_table_insert (properties_dialogs,
+ bookmark, dialog);
+ }
+
+ gtk_window_present_with_time (GTK_WINDOW (dialog),
+ gtk_get_current_event_time ());
+}
+
+
+
=== removed file '.pc/81_ubuntu_force_update_bookmarks_menu.patch/src/bookmarks/ephy-bookmarks-ui.c'
--- .pc/81_ubuntu_force_update_bookmarks_menu.patch/src/bookmarks/ephy-bookmarks-ui.c 2013-11-13 11:39:29 +0000
+++ .pc/81_ubuntu_force_update_bookmarks_menu.patch/src/bookmarks/ephy-bookmarks-ui.c 1970-01-01 00:00:00 +0000
@@ -1,363 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright © 2005 Peter Harvey
- * Copyright © 2006 Christian Persch
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "ephy-bookmarks-ui.h"
-
-#include "ephy-bookmark-action-group.h"
-#include "ephy-bookmark-action.h"
-#include "ephy-bookmark-properties.h"
-#include "ephy-bookmarks-menu.h"
-#include "ephy-bookmarks.h"
-#include "ephy-debug.h"
-#include "ephy-dnd.h"
-#include "ephy-embed-shell.h"
-#include "ephy-file-helpers.h"
-#include "ephy-gui.h"
-#include "ephy-link.h"
-#include "ephy-node-common.h"
-#include "ephy-open-tabs-action.h"
-#include "ephy-prefs.h"
-#include "ephy-settings.h"
-#include "ephy-shell.h"
-#include "ephy-string.h"
-#include "ephy-topic-action-group.h"
-#include "ephy-topic-action.h"
-
-#include
-#include
-#include
-
-#define BM_WINDOW_DATA_KEY "bookmarks-window-data"
-
-typedef struct
-{
- guint bookmarks_menu;
- guint toolbar_menu;
-} BookmarksWindowData;
-
-enum
-{
- RESPONSE_SHOW_PROPERTIES = 1,
- RESPONSE_NEW_BOOKMARK = 2
-};
-
-static GString * bookmarks_menu_string = 0;
-static GHashTable *properties_dialogs = 0;
-
-static GtkAction *
-find_action (GtkUIManager *manager, const char *name)
-{
- GList *l = gtk_ui_manager_get_action_groups (manager);
- GtkAction *action;
-
- while (l != NULL)
- {
- action = gtk_action_group_get_action (GTK_ACTION_GROUP (l->data), name);
- if (action) return action;
- l = l->next;
- }
-
- return NULL;
-}
-
-static void
-activate_bookmarks_menu (GtkAction *action, EphyWindow *window)
-{
- BookmarksWindowData *data = g_object_get_data (G_OBJECT (window), BM_WINDOW_DATA_KEY);
- if (data && !data->bookmarks_menu)
- {
- GtkUIManager *manager = ephy_window_get_ui_manager (window);
- gtk_ui_manager_ensure_update (manager);
-
- if (!bookmarks_menu_string->len)
- {
- g_string_append (bookmarks_menu_string,
- "");
- }
-
- data->bookmarks_menu = gtk_ui_manager_add_ui_from_string
- (manager, bookmarks_menu_string->str, bookmarks_menu_string->len, 0);
-
- gtk_ui_manager_ensure_update (manager);
- }
-}
-
-static void
-erase_bookmarks_menu (EphyWindow *window)
-{
- BookmarksWindowData *data;
- GtkUIManager *manager;
-
- manager = ephy_window_get_ui_manager (window);
- data = g_object_get_data (G_OBJECT (window), BM_WINDOW_DATA_KEY);
-
- if (data != NULL && data->bookmarks_menu != 0)
- {
- gtk_ui_manager_remove_ui (manager, data->bookmarks_menu);
- data->bookmarks_menu = 0;
- }
-
- g_string_truncate (bookmarks_menu_string, 0);
-}
-
-static void
-tree_changed_cb (EphyBookmarks *bookmarks,
- EphyWindow *window)
-{
- erase_bookmarks_menu (window);
-}
-
-static void
-node_added_cb (EphyNode *parent,
- EphyNode *child,
- EphyWindow *window)
-{
- erase_bookmarks_menu (window);
-}
-
-static void
-node_changed_cb (EphyNode *parent,
- EphyNode *child,
- guint property_id,
- EphyWindow *window)
-{
- if (property_id == EPHY_NODE_KEYWORD_PROP_NAME ||
- property_id == EPHY_NODE_BMK_PROP_TITLE)
- {
- erase_bookmarks_menu (window);
- }
-}
-
-static void
-node_removed_cb (EphyNode *parent,
- EphyNode *child,
- guint index,
- EphyWindow *window)
-{
- erase_bookmarks_menu (window);
-}
-
-void
-ephy_bookmarks_ui_attach_window (EphyWindow *window)
-{
- EphyBookmarks *eb;
- EphyNode *bookmarks;
- EphyNode *topics;
- BookmarksWindowData *data;
- GtkUIManager *manager;
- GtkActionGroup *actions;
- GtkAction *action;
-
- eb = ephy_shell_get_bookmarks (ephy_shell_get_default ());
- bookmarks = ephy_bookmarks_get_bookmarks (eb);
- topics = ephy_bookmarks_get_keywords (eb);
- data = g_object_get_data (G_OBJECT (window), BM_WINDOW_DATA_KEY);
- g_return_if_fail (data == NULL);
-
- manager = ephy_window_get_ui_manager (window);
-
- data = g_new0 (BookmarksWindowData, 1);
- g_object_set_data_full (G_OBJECT (window), BM_WINDOW_DATA_KEY, data, g_free);
-
- /* Create the self-maintaining action groups for bookmarks and topics */
- actions = ephy_bookmark_group_new (bookmarks);
- gtk_ui_manager_insert_action_group (manager, actions, -1);
- g_signal_connect_object (actions, "open-link",
- G_CALLBACK (ephy_link_open), G_OBJECT (window),
- G_CONNECT_SWAPPED | G_CONNECT_AFTER);
- g_object_unref (actions);
-
- actions = ephy_topic_action_group_new (topics, manager);
- gtk_ui_manager_insert_action_group (manager, actions, -1);
- g_object_unref (actions);
-
- actions = ephy_open_tabs_group_new (topics);
- gtk_ui_manager_insert_action_group (manager, actions, -1);
- g_signal_connect_object (actions, "open-link",
- G_CALLBACK (ephy_link_open), G_OBJECT (window),
- G_CONNECT_SWAPPED | G_CONNECT_AFTER);
- g_object_unref (actions);
-
- /* Add signal handlers for the bookmark database */
- ephy_node_signal_connect_object (bookmarks, EPHY_NODE_CHILD_ADDED,
- (EphyNodeCallback)node_added_cb,
- G_OBJECT (window));
- ephy_node_signal_connect_object (topics, EPHY_NODE_CHILD_ADDED,
- (EphyNodeCallback)node_added_cb,
- G_OBJECT (window));
-
- ephy_node_signal_connect_object (bookmarks, EPHY_NODE_CHILD_REMOVED,
- (EphyNodeCallback)node_removed_cb,
- G_OBJECT (window));
- ephy_node_signal_connect_object (topics, EPHY_NODE_CHILD_REMOVED,
- (EphyNodeCallback)node_removed_cb,
- G_OBJECT (window));
-
- ephy_node_signal_connect_object (bookmarks, EPHY_NODE_CHILD_CHANGED,
- (EphyNodeCallback)node_changed_cb,
- G_OBJECT (window));
- ephy_node_signal_connect_object (topics, EPHY_NODE_CHILD_CHANGED,
- (EphyNodeCallback)node_changed_cb,
- G_OBJECT (window));
-
- g_signal_connect_object (eb, "tree_changed",
- G_CALLBACK (tree_changed_cb),
- G_OBJECT (window), 0);
-
- /* Setup empty menu strings and add signal handlers to build the menus on demand */
- if (!bookmarks_menu_string)
- bookmarks_menu_string = g_string_new ("");
-
- action = find_action (manager, "Bookmarks");
- g_signal_connect_object (action, "activate",
- G_CALLBACK (activate_bookmarks_menu),
- G_OBJECT (window), 0);
-}
-
-void
-ephy_bookmarks_ui_detach_window (EphyWindow *window)
-{
- EphyBookmarks *eb = ephy_shell_get_bookmarks (ephy_shell_get_default ());
- EphyNode *bookmarks = ephy_bookmarks_get_bookmarks (eb);
- EphyNode *topics = ephy_bookmarks_get_keywords (eb);
-
- BookmarksWindowData *data = g_object_get_data (G_OBJECT (window), BM_WINDOW_DATA_KEY);
- GtkUIManager *manager = ephy_window_get_ui_manager (window);
- GtkAction *action;
-
- g_return_if_fail (data != 0);
-
- if (data->bookmarks_menu)
- gtk_ui_manager_remove_ui (manager, data->bookmarks_menu);
-
- g_object_set_data (G_OBJECT (window), BM_WINDOW_DATA_KEY, 0);
-
- ephy_node_signal_disconnect_object (bookmarks, EPHY_NODE_CHILD_ADDED,
- (EphyNodeCallback)node_added_cb,
- G_OBJECT (window));
- ephy_node_signal_disconnect_object (topics, EPHY_NODE_CHILD_ADDED,
- (EphyNodeCallback)node_added_cb,
- G_OBJECT (window));
-
- ephy_node_signal_disconnect_object (bookmarks, EPHY_NODE_CHILD_REMOVED,
- (EphyNodeCallback)node_removed_cb,
- G_OBJECT (window));
- ephy_node_signal_disconnect_object (topics, EPHY_NODE_CHILD_REMOVED,
- (EphyNodeCallback)node_removed_cb,
- G_OBJECT (window));
-
- ephy_node_signal_disconnect_object (bookmarks, EPHY_NODE_CHILD_CHANGED,
- (EphyNodeCallback)node_changed_cb,
- G_OBJECT (window));
- ephy_node_signal_disconnect_object (topics, EPHY_NODE_CHILD_CHANGED,
- (EphyNodeCallback)node_changed_cb,
- G_OBJECT (window));
-
- g_signal_handlers_disconnect_by_func
- (G_OBJECT (eb), G_CALLBACK (tree_changed_cb), G_OBJECT (window));
-
- action = find_action (manager, "Bookmarks");
- g_signal_handlers_disconnect_by_func
- (G_OBJECT (action), G_CALLBACK (activate_bookmarks_menu), G_OBJECT (window));
-}
-
-static void
-properties_dialog_destroy_cb (EphyBookmarkProperties *dialog,
- EphyNode *bookmark)
-{
- g_hash_table_remove (properties_dialogs, bookmark);
-}
-
-void
-ephy_bookmarks_ui_add_bookmark (GtkWindow *parent,
- const char *location,
- const char *title)
-{
- EphyBookmarks *bookmarks;
- EphyNode *bookmark;
- GtkWidget *dialog;
-
- if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
- EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING))
- return;
-
- bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ());
- bookmark = ephy_bookmarks_add (bookmarks, title, location);
-
- if (properties_dialogs == 0)
- {
- properties_dialogs = g_hash_table_new (g_direct_hash, g_direct_equal);
- }
-
- dialog = ephy_bookmark_properties_new (bookmarks, bookmark, TRUE);
-
- g_assert (parent != NULL);
-
- gtk_window_group_add_window (ephy_gui_ensure_window_group (parent),
- GTK_WINDOW (dialog));
- gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
-
- g_signal_connect (dialog, "destroy",
- G_CALLBACK (properties_dialog_destroy_cb), bookmark);
- g_hash_table_insert (properties_dialogs,
- bookmark, dialog);
-
- gtk_window_present_with_time (GTK_WINDOW (dialog),
- gtk_get_current_event_time ());
-}
-
-void
-ephy_bookmarks_ui_show_bookmark (EphyNode *bookmark)
-{
- EphyBookmarks *bookmarks;
- GtkWidget *dialog;
-
- bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ());
-
- g_return_if_fail (EPHY_IS_BOOKMARKS (bookmarks));
- g_return_if_fail (EPHY_IS_NODE (bookmark));
-
- if (properties_dialogs == 0)
- {
- properties_dialogs = g_hash_table_new (g_direct_hash, g_direct_equal);
- }
-
- dialog = g_hash_table_lookup (properties_dialogs, bookmark);
-
- if (dialog == NULL)
- {
- dialog = ephy_bookmark_properties_new (bookmarks, bookmark, FALSE);
-
- g_signal_connect (dialog, "destroy",
- G_CALLBACK (properties_dialog_destroy_cb), bookmark);
- g_hash_table_insert (properties_dialogs,
- bookmark, dialog);
- }
-
- gtk_window_present_with_time (GTK_WINDOW (dialog),
- gtk_get_current_event_time ());
-}
-
-
-
=== added file '.pc/applied-patches'
--- .pc/applied-patches 1970-01-01 00:00:00 +0000
+++ .pc/applied-patches 2015-07-11 21:08:34 +0000
@@ -0,0 +1,5 @@
+00_epiphany-browser.patch
+07_bookmarks.patch
+12_safetypes.patch
+81_ubuntu_force_update_bookmarks_menu.patch
+ubuntu_titlebars.patch
=== removed file '.pc/applied-patches'
--- .pc/applied-patches 2014-12-21 10:19:27 +0000
+++ .pc/applied-patches 1970-01-01 00:00:00 +0000
@@ -1,5 +0,0 @@
-00_epiphany-browser.patch
-07_bookmarks.patch
-12_safetypes.patch
-81_ubuntu_force_update_bookmarks_menu.patch
-ubuntu_titlebars.patch
=== added directory '.pc/ubuntu_titlebars.patch'
=== removed directory '.pc/ubuntu_titlebars.patch'
=== added file '.pc/ubuntu_titlebars.patch/.timestamp'
=== added directory '.pc/ubuntu_titlebars.patch/src'
=== removed directory '.pc/ubuntu_titlebars.patch/src'
=== added file '.pc/ubuntu_titlebars.patch/src/ephy-window.c'
--- .pc/ubuntu_titlebars.patch/src/ephy-window.c 1970-01-01 00:00:00 +0000
+++ .pc/ubuntu_titlebars.patch/src/ephy-window.c 2015-07-11 21:08:34 +0000
@@ -0,0 +1,4026 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright © 2000, 2001, 2002, 2003, 2004 Marco Pesenti Gritti
+ * Copyright © 2003, 2004 Christian Persch
+ * Copyright © 2011 Igalia S.L.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "ephy-window.h"
+
+#include "ephy-action-helper.h"
+#include "ephy-bookmarks-ui.h"
+#include "ephy-certificate-popover.h"
+#include "ephy-combined-stop-reload-action.h"
+#include "ephy-debug.h"
+#include "ephy-download-widget.h"
+#include "ephy-embed-container.h"
+#include "ephy-embed-prefs.h"
+#include "ephy-embed-shell.h"
+#include "ephy-embed-type-builtins.h"
+#include "ephy-embed-utils.h"
+#include "ephy-encoding-menu.h"
+#include "ephy-file-helpers.h"
+#include "ephy-find-toolbar.h"
+#include "ephy-gui.h"
+#include "ephy-home-action.h"
+#include "ephy-initial-state.h"
+#include "ephy-link.h"
+#include "ephy-location-entry.h"
+#include "ephy-navigation-history-action.h"
+#include "ephy-notebook.h"
+#include "ephy-prefs.h"
+#include "ephy-private.h"
+#include "ephy-session.h"
+#include "ephy-settings.h"
+#include "ephy-shell.h"
+#include "ephy-title-box.h"
+#include "ephy-toolbar.h"
+#include "ephy-type-builtins.h"
+#include "ephy-web-view.h"
+#include "ephy-zoom-action.h"
+#include "ephy-zoom.h"
+#include "popup-commands.h"
+#include "window-commands.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define WNCK_I_KNOW_THIS_IS_UNSTABLE
+#include
+
+#include
+
+#ifdef HAVE_X11_XF86KEYSYM_H
+#include
+#endif
+
+/**
+ * SECTION:ephy-window
+ * @short_description: Epiphany's main #GtkWindow widget
+ *
+ * #EphyWindow is Epiphany's main widget.
+ */
+
+static void ephy_window_view_popup_windows_cb (GtkAction *action,
+ EphyWindow *window);
+
+static const GtkActionEntry ephy_menu_entries [] = {
+
+ /* Toplevel */
+
+ { "Bookmarks", NULL, N_("_Bookmarks") },
+ { "PopupAction", NULL, "" },
+ { "PagePopupAction", NULL, "" },
+ { "NotebookPopupAction", NULL, "" },
+
+ /* File actions. */
+
+ { "FileNewWindow", NULL, N_("_New Window"), "N", NULL,
+ G_CALLBACK (window_cmd_file_new_window) },
+ { "FileNewWindowIncognito", NULL, N_("New _Incognito Window"), "N", NULL,
+ G_CALLBACK (window_cmd_file_new_incognito_window) },
+ { "FileOpen", NULL, N_("_Open…"), "O", NULL,
+ G_CALLBACK (window_cmd_file_open) },
+ { "FileSaveAs", NULL, N_("Save _As…"), "S", NULL,
+ G_CALLBACK (window_cmd_file_save_as) },
+ { "FileSaveAsApplication", NULL, N_("Save As _Web Application…"), "A", NULL,
+ G_CALLBACK (window_cmd_file_save_as_application) },
+ { "FilePrint", NULL, N_("_Print…"), "P", NULL,
+ G_CALLBACK (window_cmd_file_print) },
+ { "FileSendTo", NULL, N_("S_end Link by Email…"), NULL, NULL,
+ G_CALLBACK (window_cmd_file_send_to) },
+ { "FileCloseTab", NULL, N_("_Close"), "W", NULL,
+ G_CALLBACK (window_cmd_file_close_window) },
+ { "FileQuit", NULL, N_("_Quit"), "Q", NULL,
+ G_CALLBACK (window_cmd_file_quit) },
+
+ /* Edit actions. */
+
+ { "EditUndo", NULL, N_("_Undo"), "Z", NULL,
+ G_CALLBACK (window_cmd_edit_undo) },
+ { "EditRedo", NULL, N_("Re_do"), "Z", NULL,
+ G_CALLBACK (window_cmd_edit_redo) },
+ { "EditCut", NULL, N_("Cu_t"), "X", NULL,
+ G_CALLBACK (window_cmd_edit_cut) },
+ { "EditCopy", NULL, N_("_Copy"), "C", NULL,
+ G_CALLBACK (window_cmd_edit_copy) },
+ { "EditPaste", NULL, N_("_Paste"), "V", NULL,
+ G_CALLBACK (window_cmd_edit_paste) },
+ { "EditDelete", NULL, NULL, NULL, NULL,
+ G_CALLBACK (window_cmd_edit_delete) },
+ { "EditSelectAll", NULL, N_("Select _All"), "A", NULL,
+ G_CALLBACK (window_cmd_edit_select_all) },
+ { "EditFind", NULL, N_("_Find…"), "F", NULL,
+ G_CALLBACK (window_cmd_edit_find) },
+ { "EditFindNext", NULL, N_("Find Ne_xt"), "G", NULL,
+ G_CALLBACK (window_cmd_edit_find_next) },
+ { "EditFindPrev", NULL, N_("Find Pre_vious"), "G", NULL,
+ G_CALLBACK (window_cmd_edit_find_prev) },
+ { "EditBookmarks", NULL, N_("Edit _Bookmarks"), "B", NULL,
+ G_CALLBACK (window_cmd_edit_bookmarks) },
+ { "EditHistory", NULL, N_("_History"), "H", NULL,
+ G_CALLBACK (window_cmd_edit_history) },
+ { "EditPreferences", NULL, N_("Pr_eferences"), "e", NULL,
+ G_CALLBACK (window_cmd_edit_preferences) },
+
+ /* View actions. */
+
+ { "ViewStop", NULL, N_("_Stop"), "Escape", NULL,
+ G_CALLBACK (window_cmd_view_stop) },
+ { "ViewAlwaysStop", NULL, N_("_Stop"), "Escape",
+ NULL, G_CALLBACK (window_cmd_view_stop) },
+ { "ViewReload", NULL, N_("_Reload"), "R", NULL,
+ G_CALLBACK (window_cmd_view_reload) },
+ { "ViewZoomIn", NULL, N_("Zoom _In"), "plus", NULL,
+ G_CALLBACK (window_cmd_view_zoom_in) },
+ { "ViewZoomOut", NULL, N_("Zoom O_ut"), "minus", NULL,
+ G_CALLBACK (window_cmd_view_zoom_out) },
+ { "ViewZoomNormal", NULL, N_("_Normal Size"), "0", NULL,
+ G_CALLBACK (window_cmd_view_zoom_normal) },
+ { "ViewEncoding", NULL, N_("Text _Encoding"), NULL, NULL, NULL },
+ { "ViewPageSource", NULL, N_("_Page Source"), "U", NULL,
+ G_CALLBACK (window_cmd_view_page_source) },
+
+ /* Bookmarks actions. */
+
+ { "FileBookmarkPage", NULL, N_("_Add Bookmark…"), "D", NULL,
+ G_CALLBACK (window_cmd_file_bookmark_page) },
+
+ /* Go actions. */
+
+ { "GoLocation", NULL, N_("_Location…"), "L", NULL,
+ G_CALLBACK (window_cmd_go_location) },
+
+ /* Tabs actions. */
+
+ { "TabsPrevious", NULL, N_("_Previous Tab"), "Page_Up", NULL,
+ G_CALLBACK (window_cmd_tabs_previous) },
+ { "TabsNext", NULL, N_("_Next Tab"), "Page_Down", NULL,
+ G_CALLBACK (window_cmd_tabs_next) },
+ { "TabsMoveLeft", NULL, N_("Move Tab _Left"), "Page_Up", NULL,
+ G_CALLBACK (window_cmd_tabs_move_left) },
+ { "TabsMoveRight", NULL, N_("Move Tab _Right"), "Page_Down", NULL,
+ G_CALLBACK (window_cmd_tabs_move_right) },
+ { "TabsDetach", NULL, N_("_Detach Tab"), NULL, NULL,
+ G_CALLBACK (window_cmd_tabs_detach) },
+
+ /* Help. */
+
+ { "HelpContents", NULL, N_("_Help"), NULL, NULL,
+ G_CALLBACK (window_cmd_help_contents) },
+ { "HelpAbout", NULL, N_("_About"), NULL, NULL,
+ G_CALLBACK (window_cmd_help_about) }
+};
+
+static const GtkToggleActionEntry ephy_menu_toggle_entries [] =
+{
+ /* View actions. */
+
+ { "ViewDownloadsBar", NULL, N_("_Downloads Bar"), NULL, NULL,
+ NULL, FALSE },
+
+ { "ViewFullscreen", NULL, N_("_Fullscreen"), "F11", NULL,
+ G_CALLBACK (window_cmd_view_fullscreen), FALSE },
+ { "ViewPopupWindows", NULL, N_("Popup _Windows"), NULL, NULL,
+ G_CALLBACK (ephy_window_view_popup_windows_cb), FALSE },
+ { "BrowseWithCaret", NULL, N_("Selection Caret"), "F7", NULL,
+ G_CALLBACK (window_cmd_browse_with_caret), FALSE }
+};
+
+static const GtkActionEntry ephy_popups_entries [] = {
+ /* Document. */
+
+ { "ContextBookmarkPage", NULL, N_("Add Boo_kmark…"), "D", NULL,
+ G_CALLBACK (window_cmd_file_bookmark_page) },
+
+ /* Links. */
+
+ { "OpenLinkInNewWindow", NULL, N_("Open Link in New _Window"), NULL, NULL,
+ G_CALLBACK (popup_cmd_link_in_new_window) },
+ { "OpenLinkInNewTab", NULL, N_("Open Link in New _Tab"), NULL, NULL,
+ G_CALLBACK (popup_cmd_link_in_new_tab) },
+ { "DownloadLinkAs", NULL, N_("_Save Link As…"), NULL, NULL,
+ G_CALLBACK (popup_cmd_download_link_as) },
+ { "CopyLinkAddress", NULL, N_("_Copy Link Address"), NULL,
+ NULL, G_CALLBACK (popup_cmd_copy_link_address) },
+ { "CopyEmailAddress", NULL, N_("_Copy E-mail Address"), NULL,
+ NULL, G_CALLBACK (popup_cmd_copy_link_address) },
+
+ /* Images. */
+
+ { "ViewImage", NULL, N_("View _Image in New Tab"), NULL,
+ NULL, G_CALLBACK (popup_cmd_view_image_in_new_tab) },
+ { "CopyImageLocation", NULL, N_("Copy I_mage Address"), NULL,
+ NULL, G_CALLBACK (popup_cmd_copy_image_location) },
+ { "SaveImageAs", NULL, N_("_Save Image As…"), NULL,
+ NULL, G_CALLBACK (popup_cmd_save_image_as) },
+ { "SetImageAsBackground", NULL, N_("Set as _Wallpaper"), NULL,
+ NULL, G_CALLBACK (popup_cmd_set_image_as_background) },
+
+ /* Video. */
+
+ { "OpenVideoInNewWindow", NULL, N_("Open Video in New _Window"), NULL, NULL,
+ G_CALLBACK (popup_cmd_media_in_new_window) },
+ { "OpenVideoInNewTab", NULL, N_("Open Video in New _Tab"), NULL, NULL,
+ G_CALLBACK (popup_cmd_media_in_new_tab) },
+ { "SaveVideoAs", NULL, N_("_Save Video As…"), NULL,
+ NULL, G_CALLBACK (popup_cmd_save_media_as) },
+ { "CopyVideoLocation", NULL, N_("_Copy Video Address"), NULL,
+ NULL, G_CALLBACK (popup_cmd_copy_media_location) },
+
+ /* Audio. */
+
+ { "OpenAudioInNewWindow", NULL, N_("Open Audio in New _Window"), NULL, NULL,
+ G_CALLBACK (popup_cmd_media_in_new_window) },
+ { "OpenAudioInNewTab", NULL, N_("Open Audio in New _Tab"), NULL, NULL,
+ G_CALLBACK (popup_cmd_media_in_new_tab) },
+ { "SaveAudioAs", NULL, N_("_Save Audio As…"), NULL,
+ NULL, G_CALLBACK (popup_cmd_save_media_as) },
+ { "CopyAudioLocation", NULL, N_("_Copy Audio Address"), NULL,
+ NULL, G_CALLBACK (popup_cmd_copy_media_location) },
+};
+
+static const struct
+{
+ guint keyval;
+ GdkModifierType modifier;
+ const gchar *action;
+ gboolean fromToolbar;
+} extra_keybindings [] = {
+ /* FIXME: PageMenu should have its accel without being in the
+ * extra keybindings, but does not seem to work for some
+ * reason. */
+ { GDK_KEY_F10, 0, "PageMenu", TRUE },
+ { GDK_KEY_Home, GDK_MOD1_MASK, "FileHome", TRUE },
+ /* FIXME: these are not in any menu for now, so add them here. */
+ { GDK_KEY_F11, 0, "ViewFullscreen", FALSE },
+ { GDK_KEY_plus, GDK_CONTROL_MASK, "ViewZoomIn", FALSE },
+ { GDK_KEY_minus, GDK_CONTROL_MASK, "ViewZoomOut", FALSE },
+ { GDK_KEY_0, GDK_CONTROL_MASK, "ViewZoomNormal", FALSE },
+ { GDK_KEY_g, GDK_CONTROL_MASK, "EditFindNext", FALSE },
+ { GDK_KEY_G, GDK_CONTROL_MASK |
+ GDK_SHIFT_MASK, "EditFindPrev", FALSE },
+
+ { GDK_KEY_s, GDK_CONTROL_MASK, "FileSaveAs", FALSE },
+ { GDK_KEY_r, GDK_CONTROL_MASK, "ViewReload", FALSE },
+ { GDK_KEY_R, GDK_CONTROL_MASK, "ViewReload", FALSE },
+ { GDK_KEY_R, GDK_CONTROL_MASK |
+ GDK_SHIFT_MASK, "ViewReload", FALSE },
+ /* Tab navigation */
+ { GDK_KEY_Page_Up, GDK_CONTROL_MASK, "TabsPrevious", FALSE },
+ { GDK_KEY_Page_Down, GDK_CONTROL_MASK, "TabsNext", FALSE },
+ { GDK_KEY_Page_Up, GDK_CONTROL_MASK |
+ GDK_SHIFT_MASK, "TabsMoveLeft", FALSE },
+ { GDK_KEY_Page_Down, GDK_CONTROL_MASK |
+ GDK_SHIFT_MASK, "TabsMoveRight", FALSE },
+ /* Go */
+ { GDK_KEY_l, GDK_CONTROL_MASK, "GoLocation", FALSE },
+ { GDK_KEY_F6, 0, "GoLocation", FALSE },
+ /* Support all the MSIE tricks as well ;) */
+ { GDK_KEY_F5, 0, "ViewReload", FALSE },
+ { GDK_KEY_F5, GDK_CONTROL_MASK, "ViewReload", FALSE },
+ { GDK_KEY_F5, GDK_SHIFT_MASK, "ViewReload", FALSE },
+ { GDK_KEY_F5, GDK_CONTROL_MASK |
+ GDK_SHIFT_MASK, "ViewReload", FALSE },
+ { GDK_KEY_KP_Add, GDK_CONTROL_MASK, "ViewZoomIn", FALSE },
+ { GDK_KEY_KP_Subtract, GDK_CONTROL_MASK, "ViewZoomOut", FALSE },
+ { GDK_KEY_equal, GDK_CONTROL_MASK, "ViewZoomIn", FALSE },
+ { GDK_KEY_KP_0, GDK_CONTROL_MASK, "ViewZoomNormal", FALSE },
+ /* These keys are a bit strange: when pressed with no modifiers, they emit
+ * KP_PageUp/Down Control; when pressed with Control+Shift they are KP_9/3,
+ * when NumLock is on they are KP_9/3 and with NumLock and Control+Shift
+ * They're KP_PageUp/Down again!
+ */
+ { GDK_KEY_Left, GDK_MOD1_MASK /*Alt*/, "NavigationBack", TRUE },
+ { GDK_KEY_KP_Left, GDK_MOD1_MASK /*Alt*/, "NavigationBack", TRUE },
+ { GDK_KEY_KP_4, GDK_MOD1_MASK /*Alt*/, "NavigationBack", TRUE },
+ { GDK_KEY_Right, GDK_MOD1_MASK /*Alt*/, "NavigationForward", TRUE },
+ { GDK_KEY_KP_Right, GDK_MOD1_MASK /*Alt*/, "NavigationForward", TRUE },
+ { GDK_KEY_KP_6, GDK_MOD1_MASK /*Alt*/, "NavigationForward", TRUE },
+ { GDK_KEY_KP_Page_Up, GDK_CONTROL_MASK, "TabsPrevious", FALSE },
+ { GDK_KEY_KP_9, GDK_CONTROL_MASK, "TabsPrevious", FALSE },
+ { GDK_KEY_KP_Page_Down, GDK_CONTROL_MASK, "TabsNext", FALSE },
+ { GDK_KEY_KP_3, GDK_CONTROL_MASK, "TabsNext", FALSE },
+ { GDK_KEY_KP_Page_Up, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "TabsMoveLeft", FALSE },
+ { GDK_KEY_KP_9, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "TabsMoveLeft", FALSE },
+ { GDK_KEY_KP_Page_Down, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "TabsMoveRight", FALSE },
+ { GDK_KEY_KP_3, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "TabsMoveRight", FALSE },
+#ifdef HAVE_X11_XF86KEYSYM_H
+ { XF86XK_Back, 0, "NavigationBack", TRUE },
+ { XF86XK_Forward, 0, "NavigationForward", TRUE },
+ { XF86XK_Go, 0, "GoLocation", FALSE },
+ { XF86XK_OpenURL, 0, "GoLocation", FALSE },
+ { XF86XK_AddFavorite, 0, "FileBookmarkPage", FALSE },
+ { XF86XK_Refresh, 0, "ViewReload", FALSE },
+ { XF86XK_Reload, 0, "ViewReload", FALSE },
+ { XF86XK_Search, 0, "EditFind", FALSE },
+ { XF86XK_Send, 0, "FileSendTo", FALSE },
+ { XF86XK_Stop, 0, "ViewStop", FALSE },
+ { XF86XK_ZoomIn, 0, "ViewZoomIn", FALSE },
+ { XF86XK_ZoomOut, 0, "ViewZoomOut", FALSE }
+ /* FIXME: what about ScrollUp, ScrollDown, Menu*, Option, LogOff, Save,.. any others? */
+#endif /* HAVE_X11_XF86KEYSYM_H */
+};
+
+#define SETTINGS_CONNECTION_DATA_KEY "EphyWindowSettings"
+
+#define EPHY_WINDOW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_WINDOW, EphyWindowPrivate))
+
+struct _EphyWindowPrivate
+{
+ GtkWidget *main_vbox;
+ GtkWidget *toolbar;
+ GtkUIManager *manager;
+ GtkActionGroup *action_group;
+ GtkActionGroup *popups_action_group;
+ GtkActionGroup *toolbar_action_group;
+ GtkActionGroup *tab_accels_action_group;
+ EphyEncodingMenu *enc_menu;
+ GtkNotebook *notebook;
+ EphyEmbed *active_embed;
+ EphyWindowChrome chrome;
+ EphyEmbedEvent *context_event;
+ WebKitHitTestResult *hit_test_result;
+ guint idle_worker;
+ GtkWidget *downloads_box;
+
+ EphyLocationController *location_controller;
+
+ gulong app_menu_visibility_handler;
+
+ guint closing : 1;
+ guint has_size : 1;
+ guint fullscreen_mode : 1;
+ guint is_popup : 1;
+ guint present_on_insert : 1;
+ guint key_theme_is_emacs : 1;
+ guint updating_address : 1;
+ guint force_close : 1;
+ guint checking_modified_forms : 1;
+};
+
+enum
+{
+ PROP_0,
+ PROP_ACTIVE_CHILD,
+ PROP_CHROME,
+ PROP_SINGLE_TAB_MODE
+};
+
+/* Make sure not to overlap with those in ephy-lockdown.c */
+enum
+{
+ SENS_FLAG_CHROME = 1 << 0,
+ SENS_FLAG_CONTEXT = 1 << 1,
+ SENS_FLAG_DOCUMENT = 1 << 2,
+ SENS_FLAG_LOADING = 1 << 3,
+ SENS_FLAG_NAVIGATION = 1 << 4,
+ SENS_FLAG_IS_BLANK = 1 << 5
+};
+
+static gint
+impl_add_child (EphyEmbedContainer *container,
+ EphyEmbed *child,
+ gint position,
+ gboolean jump_to)
+{
+ EphyWindow *window = EPHY_WINDOW (container);
+
+ g_return_val_if_fail (!window->priv->is_popup ||
+ gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->priv->notebook)) < 1, -1);
+
+ return ephy_notebook_add_tab (EPHY_NOTEBOOK (window->priv->notebook),
+ child, position, jump_to);
+}
+
+static void
+impl_set_active_child (EphyEmbedContainer *container,
+ EphyEmbed *child)
+{
+ int page;
+ EphyWindow *window;
+
+ window = EPHY_WINDOW (container);
+
+ page = gtk_notebook_page_num
+ (window->priv->notebook, GTK_WIDGET (child));
+ gtk_notebook_set_current_page
+ (window->priv->notebook, page);
+}
+
+static GtkWidget *
+construct_confirm_close_dialog (EphyWindow *window,
+ const char *title,
+ const char *info,
+ const char *action)
+{
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_CANCEL,
+ "%s", title);
+
+ gtk_message_dialog_format_secondary_text
+ (GTK_MESSAGE_DIALOG (dialog), "%s", info);
+
+ gtk_dialog_add_button (GTK_DIALOG (dialog),
+ action, GTK_RESPONSE_ACCEPT);
+
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
+
+ /* FIXME gtk_window_set_title (GTK_WINDOW (dialog), _("Close Document?")); */
+ gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (window)),
+ GTK_WINDOW (dialog));
+
+ return dialog;
+}
+
+static gboolean
+confirm_close_with_modified_forms (EphyWindow *window)
+{
+ GtkWidget *dialog;
+ int response;
+
+ dialog = construct_confirm_close_dialog (window,
+ _("There are unsubmitted changes to form elements"),
+ _("If you close the document anyway, "
+ "you will lose that information."),
+ _("Close _Document"));
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+
+ gtk_widget_destroy (dialog);
+
+ return response == GTK_RESPONSE_ACCEPT;
+}
+
+static gboolean
+confirm_close_with_downloads (EphyWindow *window)
+{
+ GtkWidget *dialog;
+ int response;
+
+ dialog = construct_confirm_close_dialog (window,
+ _("There are ongoing downloads in this window"),
+ _("If you close this window, the downloads will be cancelled"),
+ _("Close window and cancel downloads"));
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+
+ gtk_widget_destroy (dialog);
+
+ return response == GTK_RESPONSE_ACCEPT;
+}
+
+static void
+impl_remove_child (EphyEmbedContainer *container,
+ EphyEmbed *child)
+{
+ EphyWindow *window;
+
+ window = EPHY_WINDOW (container);
+ g_signal_emit_by_name (window->priv->notebook,
+ "tab-close-request",
+ child, window);
+}
+
+static EphyEmbed *
+impl_get_active_child (EphyEmbedContainer *container)
+{
+ return EPHY_WINDOW (container)->priv->active_embed;
+}
+
+static GList *
+impl_get_children (EphyEmbedContainer *container)
+{
+ EphyWindow *window = EPHY_WINDOW (container);
+
+ return gtk_container_get_children (GTK_CONTAINER (window->priv->notebook));
+}
+
+static gboolean
+impl_get_is_popup (EphyEmbedContainer *container)
+{
+ return EPHY_WINDOW (container)->priv->is_popup;
+}
+
+static void
+ephy_window_embed_container_iface_init (EphyEmbedContainerIface *iface)
+{
+ iface->add_child = impl_add_child;
+ iface->set_active_child = impl_set_active_child;
+ iface->remove_child = impl_remove_child;
+ iface->get_active_child = impl_get_active_child;
+ iface->get_children = impl_get_children;
+ iface->get_is_popup = impl_get_is_popup;
+}
+
+static EphyEmbed *
+ephy_window_open_link (EphyLink *link,
+ const char *address,
+ EphyEmbed *embed,
+ EphyLinkFlags flags)
+{
+ EphyWindow *window = EPHY_WINDOW (link);
+ EphyWindowPrivate *priv = window->priv;
+ EphyEmbed *new_embed;
+
+ g_return_val_if_fail (address != NULL, NULL);
+
+ if (embed == NULL)
+ {
+ embed = window->priv->active_embed;
+ }
+
+ if (flags & EPHY_LINK_BOOKMARK)
+ ephy_web_view_set_visit_type (ephy_embed_get_web_view (embed),
+ EPHY_PAGE_VISIT_BOOKMARK);
+ else if (flags & EPHY_LINK_TYPED)
+ ephy_web_view_set_visit_type (ephy_embed_get_web_view (embed),
+ EPHY_PAGE_VISIT_TYPED);
+
+ if (flags & (EPHY_LINK_JUMP_TO |
+ EPHY_LINK_NEW_TAB |
+ EPHY_LINK_NEW_WINDOW))
+ {
+ EphyNewTabFlags ntflags = 0;
+ EphyWindow *target_window = EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (embed)));
+
+ if (flags & EPHY_LINK_JUMP_TO)
+ {
+ ntflags |= EPHY_NEW_TAB_JUMP;
+ }
+
+ if (flags & EPHY_LINK_NEW_WINDOW ||
+ (flags & EPHY_LINK_NEW_TAB && priv->is_popup))
+ {
+ target_window = ephy_window_new ();
+ }
+
+ if (flags & EPHY_LINK_NEW_TAB_APPEND_AFTER)
+ ntflags |= EPHY_NEW_TAB_APPEND_AFTER;
+
+ new_embed = ephy_shell_new_tab
+ (ephy_shell_get_default (),
+ target_window,
+ embed, ntflags);
+ if (flags & EPHY_LINK_HOME_PAGE)
+ {
+ ephy_web_view_load_homepage (ephy_embed_get_web_view (new_embed));
+ ephy_window_activate_location (window);
+ }
+ else
+ {
+ ephy_web_view_load_url (ephy_embed_get_web_view (new_embed), address);
+ if (flags & EPHY_LINK_JUMP_TO)
+ {
+ gtk_widget_grab_focus (GTK_WIDGET (new_embed));
+ }
+ }
+ }
+ else
+ {
+ ephy_web_view_load_url (ephy_embed_get_web_view (embed), address);
+
+ if (address == NULL || address[0] == '\0' || g_str_equal (address, "about:blank"))
+ {
+ ephy_window_activate_location (window);
+ }
+ else
+ {
+ gtk_widget_grab_focus (GTK_WIDGET (embed));
+ }
+
+ new_embed = embed;
+ }
+
+ return new_embed;
+}
+
+static void
+ephy_window_link_iface_init (EphyLinkIface *iface)
+{
+ iface->open_link = ephy_window_open_link;
+}
+
+G_DEFINE_TYPE_WITH_CODE (EphyWindow, ephy_window, GTK_TYPE_APPLICATION_WINDOW,
+ G_IMPLEMENT_INTERFACE (EPHY_TYPE_LINK,
+ ephy_window_link_iface_init)
+ G_IMPLEMENT_INTERFACE (EPHY_TYPE_EMBED_CONTAINER,
+ ephy_window_embed_container_iface_init))
+
+static void
+settings_change_notify (GtkSettings *settings,
+ EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+ char *key_theme_name;
+
+ g_object_get (settings,
+ "gtk-key-theme-name", &key_theme_name,
+ NULL);
+
+ priv->key_theme_is_emacs =
+ key_theme_name &&
+ g_ascii_strcasecmp (key_theme_name, "Emacs") == 0;
+
+ g_free (key_theme_name);
+}
+
+static void
+settings_changed_cb (GtkSettings *settings)
+{
+ GList *list, *l;
+
+ /* FIXME: multi-head */
+ list = gtk_window_list_toplevels ();
+
+ for (l = list; l != NULL; l = l->next)
+ {
+ if (EPHY_IS_WINDOW (l->data))
+ {
+ settings_change_notify (settings, l->data);
+ }
+ }
+
+ g_list_free (list);
+}
+
+static void
+sync_chromes_visibility (EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+ gboolean show_tabsbar, show_downloads_box;
+
+ if (priv->closing)
+ return;
+
+ show_tabsbar = (priv->chrome & EPHY_WINDOW_CHROME_TABSBAR);
+ show_downloads_box = (priv->chrome & EPHY_WINDOW_CHROME_DOWNLOADS_BOX);
+
+ ephy_notebook_set_tabs_allowed (EPHY_NOTEBOOK (priv->notebook),
+ show_tabsbar && !(priv->is_popup || priv->fullscreen_mode));
+ gtk_widget_set_visible (priv->downloads_box,
+ show_downloads_box && !priv->fullscreen_mode);
+}
+
+static void
+ephy_window_set_chrome (EphyWindow *window,
+ EphyWindowChrome chrome)
+{
+ if (window->priv->chrome == chrome)
+ return;
+
+ window->priv->chrome = chrome;
+ if (window->priv->closing)
+ return;
+
+ g_object_notify (G_OBJECT (window), "chrome");
+ sync_chromes_visibility (window);
+}
+
+static void
+sync_tab_load_status (EphyWebView *view,
+ WebKitLoadEvent load_event,
+ EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+ GtkActionGroup *action_group = priv->action_group;
+ GtkAction *action;
+ gboolean loading;
+
+ if (window->priv->closing) return;
+
+ loading = ephy_web_view_is_loading (view);
+
+ action = gtk_action_group_get_action (action_group, "ViewStop");
+ gtk_action_set_sensitive (action, loading);
+
+ /* disable print while loading, see bug #116344 */
+ action = gtk_action_group_get_action (action_group, "FilePrint");
+ ephy_action_change_sensitivity_flags (action, SENS_FLAG_LOADING, loading);
+
+ action = gtk_action_group_get_action (priv->toolbar_action_group,
+ "ViewCombinedStopReload");
+ ephy_combined_stop_reload_action_set_loading (EPHY_COMBINED_STOP_RELOAD_ACTION (action),
+ loading);
+}
+
+static void
+sync_tab_security (EphyWebView *view,
+ GParamSpec *pspec,
+ EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+ EphyTitleBox *title_box;
+ EphySecurityLevel security_level;
+
+ if (priv->closing) return;
+
+ ephy_web_view_get_security_level (view, &security_level, NULL, NULL);
+ title_box = ephy_toolbar_get_title_box (EPHY_TOOLBAR (priv->toolbar));
+ ephy_title_box_set_security_level (title_box, security_level);
+}
+
+static void
+ephy_window_fullscreen (EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+ EphyEmbed *embed;
+
+ priv->fullscreen_mode = TRUE;
+
+ /* sync status */
+ embed = window->priv->active_embed;
+ sync_tab_load_status (ephy_embed_get_web_view (embed), WEBKIT_LOAD_STARTED, window);
+ sync_tab_security (ephy_embed_get_web_view (embed), NULL, window);
+
+ sync_chromes_visibility (window);
+ gtk_widget_hide (priv->toolbar);
+ ephy_embed_entering_fullscreen (embed);
+}
+
+static void
+ephy_window_unfullscreen (EphyWindow *window)
+{
+ window->priv->fullscreen_mode = FALSE;
+
+ gtk_widget_show (window->priv->toolbar);
+ sync_chromes_visibility (window);
+ ephy_embed_leaving_fullscreen (window->priv->active_embed);
+}
+
+static gboolean
+ephy_window_key_press_event (GtkWidget *widget,
+ GdkEventKey *event)
+{
+ EphyWindow *window = EPHY_WINDOW (widget);
+ EphyWindowPrivate *priv = window->priv;
+ GtkWidget *focus_widget;
+ gboolean shortcircuit = FALSE, force_chain = FALSE, handled = FALSE;
+ guint modifier = event->state & gtk_accelerator_get_default_mod_mask ();
+ guint i;
+
+ /* In an attempt to get the mozembed playing nice with things like emacs keybindings
+ * we are passing important events to the focused child widget before letting the window's
+ * base handler see them. This is *completely against* stated gtk2 policy but the
+ * 'correct' behaviour is exceptionally useless. We need to keep an eye out for
+ * unexpected consequences of this decision. IME's should be a high concern, but
+ * considering that the IME folks complained about the upside-down event propagation
+ * rules, we might be doing them a favour.
+ *
+ * We achieve this by first evaluating the event to see if it's important, and if
+ * so, we get the focus widget and attempt to get the widget to handle that event.
+ * If the widget does handle it, we're done (unless force_chain is true, in which
+ * case the event is handled as normal in addition to being sent to the focus
+ * widget), otherwise the event follows the normal handling path.
+ */
+
+ if (event->keyval == GDK_KEY_Escape && modifier == 0)
+ {
+ /* Always pass Escape to both the widget, and the parent */
+ shortcircuit = TRUE;
+ force_chain = TRUE;
+ }
+ else if (priv->key_theme_is_emacs &&
+ (modifier == GDK_CONTROL_MASK) &&
+ event->length > 0 &&
+ /* But don't pass Ctrl+Enter twice */
+ event->keyval != GDK_KEY_Return &&
+ event->keyval != GDK_KEY_KP_Enter &&
+ event->keyval != GDK_KEY_ISO_Enter)
+ {
+ /* Pass CTRL+letter characters to the widget */
+ shortcircuit = TRUE;
+ }
+
+ if (shortcircuit)
+ {
+ focus_widget = gtk_window_get_focus (GTK_WINDOW (window));
+
+ if (GTK_IS_WIDGET (focus_widget))
+ {
+ handled = gtk_widget_event (focus_widget,
+ (GdkEvent*) event);
+ }
+
+ if (handled && !force_chain)
+ {
+ return handled;
+ }
+ }
+
+ /* Handle accelerators that we want bound, but aren't associated with
+ * an action */
+ for (i = 0; i < G_N_ELEMENTS (extra_keybindings); i++)
+ {
+ if (event->keyval == extra_keybindings[i].keyval &&
+ modifier == extra_keybindings[i].modifier)
+ {
+ GtkAction * action = gtk_action_group_get_action
+ (extra_keybindings[i].fromToolbar ?
+ priv->toolbar_action_group :
+ priv->action_group,
+ extra_keybindings[i].action);
+ if (gtk_action_is_sensitive (action))
+ {
+ gtk_action_activate (action);
+ return TRUE;
+ }
+ break;
+ }
+ }
+
+ return GTK_WIDGET_CLASS (ephy_window_parent_class)->key_press_event (widget, event);
+}
+
+static gboolean
+window_has_ongoing_downloads (EphyWindow *window)
+{
+ GList *l, *downloads;
+ gboolean downloading = FALSE;
+
+ downloads = gtk_container_get_children (GTK_CONTAINER (window->priv->downloads_box));
+
+ for (l = downloads; l != NULL; l = l->next)
+ {
+ if (EPHY_IS_DOWNLOAD_WIDGET (l->data) != TRUE)
+ continue;
+
+ if (!ephy_download_widget_download_is_finished (EPHY_DOWNLOAD_WIDGET (l->data)))
+ {
+ downloading = TRUE;
+ break;
+ }
+ }
+ g_list_free (downloads);
+
+ return downloading;
+}
+
+static gboolean
+ephy_window_delete_event (GtkWidget *widget,
+ GdkEventAny *event)
+{
+ if (!ephy_window_close (EPHY_WINDOW (widget)))
+ return TRUE;
+
+ /* proceed with window close */
+ if (GTK_WIDGET_CLASS (ephy_window_parent_class)->delete_event)
+ {
+ return GTK_WIDGET_CLASS (ephy_window_parent_class)->delete_event (widget, event);
+ }
+
+ return FALSE;
+}
+
+#define MAX_SPELL_CHECK_GUESSES 4
+
+static void
+update_link_actions_sensitivity (EphyWindow *window,
+ gboolean link_has_web_scheme)
+{
+ GtkAction *action;
+ GtkActionGroup *action_group;
+
+ action_group = window->priv->popups_action_group;
+
+ action = gtk_action_group_get_action (action_group, "OpenLinkInNewWindow");
+ gtk_action_set_sensitive (action, link_has_web_scheme);
+
+ action = gtk_action_group_get_action (action_group, "OpenLinkInNewTab");
+ ephy_action_change_sensitivity_flags (action, SENS_FLAG_CONTEXT, !link_has_web_scheme);
+}
+
+static void
+update_edit_action_sensitivity (EphyWindow *window, const gchar *action_name, gboolean sensitive, gboolean hide)
+{
+ GtkAction *action;
+
+ action = gtk_action_group_get_action (window->priv->action_group, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+ gtk_action_set_visible (action, !hide || sensitive);
+}
+
+typedef struct
+{
+ EphyWindow *window;
+ const gchar *action_name;
+ gboolean hide;
+} CanEditCommandAsyncData;
+
+static CanEditCommandAsyncData *
+can_edit_command_async_data_new (EphyWindow *window, const gchar *action_name, gboolean hide)
+{
+ CanEditCommandAsyncData *data;
+
+ data = g_slice_new (CanEditCommandAsyncData);
+ data->window = g_object_ref (window);
+ data->action_name = action_name;
+ data->hide = hide;
+
+ return data;
+}
+
+static void
+can_edit_command_async_data_free (CanEditCommandAsyncData *data)
+{
+ if (G_UNLIKELY (!data))
+ return;
+
+ g_object_unref (data->window);
+ g_slice_free (CanEditCommandAsyncData, data);
+}
+
+static void
+can_edit_command_callback (GObject *object, GAsyncResult *result, CanEditCommandAsyncData *data)
+{
+ gboolean sensitive;
+ GError *error = NULL;
+
+ sensitive = webkit_web_view_can_execute_editing_command_finish (WEBKIT_WEB_VIEW (object), result, &error);
+ if (!error)
+ {
+ update_edit_action_sensitivity (data->window, data->action_name, sensitive, data->hide);
+
+ }
+ else
+ {
+ g_error_free (error);
+ }
+
+ can_edit_command_async_data_free (data);
+}
+
+static void
+update_edit_actions_sensitivity (EphyWindow *window, gboolean hide)
+{
+ GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
+ gboolean can_copy, can_cut, can_undo, can_redo, can_paste;
+
+ if (GTK_IS_EDITABLE (widget))
+ {
+ GtkWidget *entry;
+ gboolean has_selection;
+
+ entry = ephy_toolbar_get_location_entry (EPHY_TOOLBAR (window->priv->toolbar));
+
+ has_selection = gtk_editable_get_selection_bounds
+ (GTK_EDITABLE (widget), NULL, NULL);
+
+ can_copy = has_selection;
+ can_cut = has_selection;
+ can_paste = TRUE;
+ can_undo = ephy_location_entry_get_can_undo (EPHY_LOCATION_ENTRY (entry));
+ can_redo = ephy_location_entry_get_can_redo (EPHY_LOCATION_ENTRY (entry));
+ }
+ else
+ {
+ EphyEmbed *embed;
+ WebKitWebView *view;
+ CanEditCommandAsyncData *data;
+
+ embed = window->priv->active_embed;
+ g_return_if_fail (embed != NULL);
+
+ view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+
+ data = can_edit_command_async_data_new (window, "EditCopy", hide);
+ webkit_web_view_can_execute_editing_command (view, WEBKIT_EDITING_COMMAND_COPY, NULL,
+ (GAsyncReadyCallback)can_edit_command_callback,
+ data);
+ data = can_edit_command_async_data_new (window, "EditCut", hide);
+ webkit_web_view_can_execute_editing_command (view, WEBKIT_EDITING_COMMAND_CUT, NULL,
+ (GAsyncReadyCallback)can_edit_command_callback,
+ data);
+ data = can_edit_command_async_data_new (window, "EditPaste", hide);
+ webkit_web_view_can_execute_editing_command (view, WEBKIT_EDITING_COMMAND_PASTE, NULL,
+ (GAsyncReadyCallback)can_edit_command_callback,
+ data);
+ data = can_edit_command_async_data_new (window, "EditUndo", hide);
+ webkit_web_view_can_execute_editing_command (view, "Undo", NULL,
+ (GAsyncReadyCallback)can_edit_command_callback,
+ data);
+ data = can_edit_command_async_data_new (window, "EditRedo", hide);
+ webkit_web_view_can_execute_editing_command (view, "Redo", NULL,
+ (GAsyncReadyCallback)can_edit_command_callback,
+ data);
+ return;
+ }
+
+ update_edit_action_sensitivity (window, "EditCopy", can_copy, hide);
+ update_edit_action_sensitivity (window, "EditCut", can_cut, hide);
+ update_edit_action_sensitivity (window, "EditPaste", can_paste, hide);
+ update_edit_action_sensitivity (window, "EditUndo", can_undo, hide);
+ update_edit_action_sensitivity (window, "EditRedo", can_redo, hide);
+}
+
+static void
+enable_edit_actions_sensitivity (EphyWindow *window)
+{
+ GtkActionGroup *action_group;
+ GtkAction *action;
+
+ action_group = window->priv->action_group;
+
+ action = gtk_action_group_get_action (action_group, "EditCopy");
+ gtk_action_set_sensitive (action, TRUE);
+ gtk_action_set_visible (action, TRUE);
+ action = gtk_action_group_get_action (action_group, "EditCut");
+ gtk_action_set_sensitive (action, TRUE);
+ gtk_action_set_visible (action, TRUE);
+ action = gtk_action_group_get_action (action_group, "EditPaste");
+ gtk_action_set_sensitive (action, TRUE);
+ gtk_action_set_visible (action, TRUE);
+ action = gtk_action_group_get_action (action_group, "EditUndo");
+ gtk_action_set_sensitive (action, TRUE);
+ gtk_action_set_visible (action, TRUE);
+ action = gtk_action_group_get_action (action_group, "EditRedo");
+ gtk_action_set_sensitive (action, TRUE);
+ gtk_action_set_visible (action, TRUE);
+}
+
+static void
+edit_menu_show_cb (GtkWidget *menu,
+ EphyWindow *window)
+{
+ update_edit_actions_sensitivity (window, FALSE);
+}
+
+static void
+edit_menu_hide_cb (GtkWidget *menu,
+ EphyWindow *window)
+{
+ enable_edit_actions_sensitivity (window);
+}
+
+static void
+init_menu_updaters (EphyWindow *window)
+{
+ GtkWidget *edit_menu;
+
+ edit_menu = gtk_ui_manager_get_widget
+ (window->priv->manager, "/ui/PagePopup");
+
+ g_signal_connect (edit_menu, "show",
+ G_CALLBACK (edit_menu_show_cb), window);
+ g_signal_connect (edit_menu, "hide",
+ G_CALLBACK (edit_menu_hide_cb), window);
+}
+
+static void
+setup_ui_manager (EphyWindow *window)
+{
+ GtkActionGroup *action_group;
+ GtkAccelGroup *accel_group;
+ GtkAction *action;
+ GtkUIManager *manager;
+
+ window->priv->main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ gtk_widget_show (window->priv->main_vbox);
+ gtk_container_add (GTK_CONTAINER (window),
+ window->priv->main_vbox);
+
+ manager = gtk_ui_manager_new ();
+ accel_group = gtk_ui_manager_get_accel_group (manager);
+
+ action_group = gtk_action_group_new ("WindowActions");
+ gtk_action_group_set_translation_domain (action_group, NULL);
+ gtk_action_group_add_actions (action_group, ephy_menu_entries,
+ G_N_ELEMENTS (ephy_menu_entries), window);
+ gtk_action_group_add_toggle_actions (action_group,
+ ephy_menu_toggle_entries,
+ G_N_ELEMENTS (ephy_menu_toggle_entries),
+ window);
+ gtk_action_group_set_accel_group (action_group, accel_group);
+ gtk_ui_manager_insert_action_group (manager, action_group, 0);
+ window->priv->action_group = action_group;
+ g_object_unref (action_group);
+
+ action = gtk_action_group_get_action (action_group, "FileOpen");
+ g_object_set (action, "short_label", _("Open"), NULL);
+ action = gtk_action_group_get_action (action_group, "FileSaveAs");
+ g_object_set (action, "short_label", _("Save As"), NULL);
+ action = gtk_action_group_get_action (action_group, "FileSaveAsApplication");
+ g_object_set (action, "short_label", _("Save As Application"), NULL);
+ action = gtk_action_group_get_action (action_group, "FilePrint");
+ g_object_set (action, "short_label", _("Print"), NULL);
+ action = gtk_action_group_get_action (action_group, "FileBookmarkPage");
+ g_object_set (action, "short_label", _("Bookmark"), NULL);
+ action = gtk_action_group_get_action (action_group, "EditFind");
+ g_object_set (action, "short_label", _("Find"), NULL);
+
+ action = gtk_action_group_get_action (action_group, "EditFind");
+ g_object_set (action, "is_important", TRUE, NULL);
+
+ action = gtk_action_group_get_action (action_group, "ViewEncoding");
+ g_object_set (action, "hide_if_empty", FALSE, NULL);
+ action = gtk_action_group_get_action (action_group, "ViewZoomIn");
+ /* Translators: This refers to text size */
+ g_object_set (action, "short-label", _("Larger"), NULL);
+ action = gtk_action_group_get_action (action_group, "ViewZoomOut");
+ /* Translators: This refers to text size */
+ g_object_set (action, "short-label", _("Smaller"), NULL);
+
+ action_group = gtk_action_group_new ("PopupsActions");
+ gtk_action_group_set_translation_domain (action_group, NULL);
+ gtk_action_group_add_actions (action_group, ephy_popups_entries,
+ G_N_ELEMENTS (ephy_popups_entries), window);
+ gtk_action_group_set_accel_group (action_group, accel_group);
+ gtk_ui_manager_insert_action_group (manager, action_group, 0);
+ window->priv->popups_action_group = action_group;
+ g_object_unref (action_group);
+
+ /* Tab accels */
+ action_group = gtk_action_group_new ("TabAccelsActions");
+ gtk_action_group_set_accel_group (action_group, accel_group);
+ gtk_ui_manager_insert_action_group (manager, action_group, 0);
+ window->priv->tab_accels_action_group = action_group;
+ g_object_unref (action_group);
+
+ action_group = gtk_action_group_new ("SpecialToolbarActions");
+ action =
+ g_object_new (EPHY_TYPE_NAVIGATION_HISTORY_ACTION,
+ "name", "NavigationBack",
+ "label", _("Back"),
+ "icon-name", "go-previous-symbolic",
+ "window", window,
+ "direction", EPHY_NAVIGATION_HISTORY_DIRECTION_BACK,
+ NULL);
+ gtk_action_group_add_action_with_accel (action_group, action,
+ "Left");
+ g_object_unref (action);
+
+ action =
+ g_object_new (EPHY_TYPE_NAVIGATION_HISTORY_ACTION,
+ "name", "NavigationForward",
+ "label", _("Forward"),
+ "icon-name", "go-next-symbolic",
+ "window", window,
+ "direction", EPHY_NAVIGATION_HISTORY_DIRECTION_FORWARD,
+ NULL);
+ gtk_action_group_add_action_with_accel (action_group, action,
+ "Right");
+ g_object_unref (action);
+
+ action =
+ g_object_new (EPHY_TYPE_ZOOM_ACTION,
+ "name", "Zoom",
+ "label", _("Zoom"),
+ "zoom", 1.0,
+ NULL);
+ gtk_action_group_add_action (action_group, action);
+ g_object_unref (action);
+
+ action = g_object_new (EPHY_TYPE_HOME_ACTION,
+ "name", "FileNewTab",
+ "icon-name", "tab-new-symbolic",
+ "label", _("New _Tab"),
+ NULL);
+ gtk_action_group_add_action_with_accel (action_group, action, "T");
+ g_object_unref (action);
+
+ action =
+ g_object_new (EPHY_TYPE_HOME_ACTION,
+ "name", "FileHome",
+ "label", _("Go to most visited"),
+ NULL);
+ gtk_action_group_add_action_with_accel (action_group, action, "Home");
+ g_signal_connect_swapped (action, "open-link",
+ G_CALLBACK (ephy_link_open), window);
+ g_object_unref (action);
+
+ action = g_object_new (EPHY_TYPE_COMBINED_STOP_RELOAD_ACTION,
+ "name", "ViewCombinedStopReload",
+ "loading", FALSE,
+ "window", window,
+ NULL);
+ gtk_action_group_add_action (action_group, action);
+ g_object_unref (action);
+
+ gtk_action_group_set_accel_group (action_group, accel_group);
+ gtk_ui_manager_insert_action_group (manager, action_group, 0);
+ window->priv->toolbar_action_group = action_group;
+ g_object_unref (action_group);
+
+ window->priv->manager = manager;
+ gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
+}
+
+static char *
+calculate_location (const char *typed_address, const char *address)
+{
+ const char *location;
+
+ /* If there's a typed address, use that over address. Never
+ * show URIs in the 'do_not_show_address' array. */
+ location = typed_address ? typed_address : address;
+ location = ephy_embed_utils_is_no_show_address (location) ? NULL : location;
+
+ return g_strdup (location);
+}
+
+static void
+_ephy_window_set_default_actions_sensitive (EphyWindow *window,
+ guint flags,
+ gboolean set)
+{
+ EphyWindowPrivate *priv = window->priv;
+ GtkActionGroup *action_group;
+ GtkAction *action;
+ int i;
+ const char *action_group_actions[] = { "FileSaveAs", "FileSaveAsApplication", "FilePrint",
+ "FileSendTo", "FileBookmarkPage", "EditFind",
+ "EditFindPrev", "EditFindNext", "ViewEncoding",
+ "ViewZoomIn", "ViewZoomOut", "ViewPageSource",
+ NULL };
+
+ action_group = priv->action_group;
+
+ /* Page menu */
+ for (i = 0; action_group_actions[i] != NULL; i++)
+ {
+ action = gtk_action_group_get_action (action_group,
+ action_group_actions[i]);
+ ephy_action_change_sensitivity_flags (action,
+ flags, set);
+ }
+
+ /* Page context popup */
+ action = gtk_action_group_get_action (priv->popups_action_group,
+ "ContextBookmarkPage");
+ ephy_action_change_sensitivity_flags (action,
+ flags, set);
+
+ /* Toolbar */
+ action = gtk_action_group_get_action (priv->toolbar_action_group,
+ "ViewCombinedStopReload");
+ ephy_action_change_sensitivity_flags (action,
+ flags, set);
+}
+
+static void
+sync_tab_address (EphyWebView *view,
+ GParamSpec *pspec,
+ EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+ const char *address;
+ const char *typed_address;
+ char *location;
+
+ if (priv->closing) return;
+
+ address = ephy_web_view_get_address (view);
+ typed_address = ephy_web_view_get_typed_address (view);
+
+ _ephy_window_set_default_actions_sensitive (window,
+ SENS_FLAG_IS_BLANK,
+ ephy_web_view_is_overview (view));
+
+ location = calculate_location (typed_address, address);
+ ephy_window_set_location (window, location);
+ g_free (location);
+}
+
+static void
+sync_tab_zoom (WebKitWebView *web_view, GParamSpec *pspec, EphyWindow *window)
+{
+ GtkActionGroup *action_group;
+ GtkAction *action;
+ gboolean can_zoom_in = TRUE, can_zoom_out = TRUE, can_zoom_normal = FALSE;
+ double zoom;
+
+ if (window->priv->closing) return;
+
+ zoom = webkit_web_view_get_zoom_level (web_view);
+
+ if (zoom >= ZOOM_MAXIMAL)
+ {
+ can_zoom_in = FALSE;
+ }
+
+ if (zoom <= ZOOM_MINIMAL)
+ {
+ can_zoom_out = FALSE;
+ }
+
+ if (zoom != 1.0)
+ {
+ can_zoom_normal = TRUE;
+ }
+
+ action_group = window->priv->action_group;
+ action = gtk_action_group_get_action (action_group, "ViewZoomIn");
+ gtk_action_set_sensitive (action, can_zoom_in);
+ action = gtk_action_group_get_action (action_group, "ViewZoomOut");
+ gtk_action_set_sensitive (action, can_zoom_out);
+ action = gtk_action_group_get_action (action_group, "ViewZoomNormal");
+ gtk_action_set_sensitive (action, can_zoom_normal);
+}
+
+static void
+sync_tab_document_type (EphyWebView *view,
+ GParamSpec *pspec,
+ EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+ GtkActionGroup *action_group = priv->action_group;
+ GtkAction *action;
+ EphyWebViewDocumentType type;
+ gboolean can_find, disable, is_image;
+
+ if (priv->closing) return;
+
+ /* update zoom actions */
+ sync_tab_zoom (WEBKIT_WEB_VIEW (view), NULL, window);
+
+ type = ephy_web_view_get_document_type (view);
+ can_find = (type != EPHY_WEB_VIEW_DOCUMENT_IMAGE);
+ is_image = type == EPHY_WEB_VIEW_DOCUMENT_IMAGE;
+ disable = (type != EPHY_WEB_VIEW_DOCUMENT_HTML);
+
+ action = gtk_action_group_get_action (action_group, "ViewEncoding");
+ ephy_action_change_sensitivity_flags (action, SENS_FLAG_DOCUMENT, disable);
+ action = gtk_action_group_get_action (action_group, "ViewPageSource");
+ ephy_action_change_sensitivity_flags (action, SENS_FLAG_DOCUMENT, is_image);
+ action = gtk_action_group_get_action (action_group, "EditFind");
+ ephy_action_change_sensitivity_flags (action, SENS_FLAG_DOCUMENT, !can_find);
+ action = gtk_action_group_get_action (action_group, "EditFindNext");
+ ephy_action_change_sensitivity_flags (action, SENS_FLAG_DOCUMENT, !can_find);
+ action = gtk_action_group_get_action (action_group, "EditFindPrev");
+ ephy_action_change_sensitivity_flags (action, SENS_FLAG_DOCUMENT, !can_find);
+
+ if (!can_find)
+ {
+ ephy_find_toolbar_request_close (ephy_embed_get_find_toolbar (priv->active_embed));
+ }
+}
+
+static void
+_ephy_window_action_set_favicon (EphyWindow *window,
+ GdkPixbuf *icon)
+{
+ EphyWindowPrivate *priv = window->priv;
+
+ g_object_set (priv->location_controller, "icon", icon, NULL);
+}
+
+static void
+sync_tab_icon (EphyWebView *view,
+ GParamSpec *pspec,
+ EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+ GdkPixbuf *icon;
+
+ if (priv->closing) return;
+
+ icon = ephy_web_view_get_icon (view);
+
+ _ephy_window_action_set_favicon (window, icon);
+}
+
+static void
+_ephy_window_set_navigation_flags (EphyWindow *window,
+ EphyWebViewNavigationFlags flags)
+{
+ GtkAction *action;
+
+ action = gtk_action_group_get_action (window->priv->toolbar_action_group, "NavigationBack");
+ gtk_action_set_sensitive (action, flags & EPHY_WEB_VIEW_NAV_BACK);
+ action = gtk_action_group_get_action (window->priv->toolbar_action_group, "NavigationForward");
+ gtk_action_set_sensitive (action, flags & EPHY_WEB_VIEW_NAV_FORWARD);
+}
+
+static void
+sync_tab_navigation (EphyWebView *view,
+ GParamSpec *pspec,
+ EphyWindow *window)
+{
+ if (window->priv->closing) return;
+
+ _ephy_window_set_navigation_flags (window,
+ ephy_web_view_get_navigation_flags (view));
+}
+
+static void
+sync_tab_is_blank (EphyWebView *view,
+ GParamSpec *pspec,
+ EphyWindow *window)
+{
+ if (window->priv->closing) return;
+
+ _ephy_window_set_default_actions_sensitive (window,
+ SENS_FLAG_IS_BLANK,
+ ephy_web_view_get_is_blank (view));
+}
+
+static void
+sync_tab_popup_windows (EphyWebView *view,
+ GParamSpec *pspec,
+ EphyWindow *window)
+{
+ /* FIXME: show popup count somehow */
+}
+
+static void
+sync_tab_popups_allowed (EphyWebView *view,
+ GParamSpec *pspec,
+ EphyWindow *window)
+{
+ GtkAction *action;
+ gboolean allow;
+
+ g_return_if_fail (EPHY_IS_WEB_VIEW (view));
+ g_return_if_fail (EPHY_IS_WINDOW (window));
+
+ action = gtk_action_group_get_action (window->priv->action_group,
+ "ViewPopupWindows");
+ g_return_if_fail (GTK_IS_ACTION (action));
+
+ g_object_get (view, "popups-allowed", &allow, NULL);
+
+ g_signal_handlers_block_by_func
+ (G_OBJECT (action),
+ G_CALLBACK (ephy_window_view_popup_windows_cb),
+ window);
+
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), allow);
+
+ g_signal_handlers_unblock_by_func
+ (G_OBJECT (action),
+ G_CALLBACK (ephy_window_view_popup_windows_cb),
+ window);
+}
+
+static void
+sync_tab_title (EphyEmbed *embed,
+ GParamSpec *pspec,
+ EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+
+ if (priv->closing) return;
+
+ gtk_window_set_title (GTK_WINDOW(window),
+ ephy_embed_get_title (embed));
+}
+
+static gboolean
+idle_unref_context_event (EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+
+ LOG ("Idle unreffing context event %p", priv->context_event);
+
+ if (priv->context_event != NULL)
+ {
+ g_object_unref (priv->context_event);
+ priv->context_event = NULL;
+ }
+
+ priv->idle_worker = 0;
+ return FALSE;
+}
+
+static void
+_ephy_window_set_context_event (EphyWindow *window,
+ EphyEmbedEvent *event)
+{
+ EphyWindowPrivate *priv = window->priv;
+
+ if (priv->idle_worker != 0)
+ {
+ g_source_remove (priv->idle_worker);
+ priv->idle_worker = 0;
+ }
+
+ if (priv->context_event != NULL)
+ {
+ g_object_unref (priv->context_event);
+ }
+
+ priv->context_event = event != NULL ? g_object_ref (event) : NULL;
+}
+
+static void
+_ephy_window_unset_context_event (EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+
+ /* Unref the event from idle since we still need it
+ * from the action callbacks which will run before idle.
+ */
+ if (priv->idle_worker == 0 && priv->context_event != NULL)
+ {
+ priv->idle_worker =
+ g_idle_add ((GSourceFunc) idle_unref_context_event, window);
+ }
+}
+
+static void
+context_menu_dismissed_cb (WebKitWebView *webView,
+ EphyWindow *window)
+{
+ LOG ("Deactivating popup menu");
+
+ enable_edit_actions_sensitivity (window);
+
+ g_signal_handlers_disconnect_by_func
+ (webView, G_CALLBACK (context_menu_dismissed_cb), window);
+
+ _ephy_window_unset_context_event (window);
+}
+
+static void
+add_action_to_context_menu (WebKitContextMenu *context_menu,
+ GtkActionGroup *action_group,
+ const char *action_name)
+{
+ GtkAction *action;
+
+ action = gtk_action_group_get_action (action_group, action_name);
+ webkit_context_menu_append (context_menu, webkit_context_menu_item_new (action));
+}
+
+static void
+add_item_to_context_menu (WebKitContextMenu *context_menu,
+ WebKitContextMenuItem *item)
+{
+ if (!item)
+ return;
+
+ webkit_context_menu_append (context_menu, item);
+ g_object_unref (item);
+}
+
+/* FIXME: Add webkit_context_menu_find() ? */
+static WebKitContextMenuItem *
+find_item_in_context_menu (WebKitContextMenu *context_menu,
+ WebKitContextMenuAction action)
+{
+ GList *items, *iter;
+
+ items = webkit_context_menu_get_items (context_menu);
+ for (iter = items; iter; iter = g_list_next (iter))
+ {
+ WebKitContextMenuItem *item = (WebKitContextMenuItem *)iter->data;
+
+ if (webkit_context_menu_item_get_stock_action (item) == action)
+ return g_object_ref (item);
+ }
+
+ return NULL;
+}
+
+static GList *
+find_spelling_guess_context_menu_items (WebKitContextMenu *context_menu)
+{
+ GList *items, *iter;
+ guint i;
+ GList *retval = NULL;
+
+ items = webkit_context_menu_get_items (context_menu);
+ for (iter = items, i = 0; iter && i < MAX_SPELL_CHECK_GUESSES; iter = g_list_next (iter), i++)
+ {
+ WebKitContextMenuItem *item = (WebKitContextMenuItem *)iter->data;
+
+ if (webkit_context_menu_item_get_stock_action (item) == WEBKIT_CONTEXT_MENU_ACTION_SPELLING_GUESS)
+ {
+ retval = g_list_prepend (retval, g_object_ref (item));
+ }
+ else
+ {
+ /* Spelling guesses are always at the beginning of the context menu, so
+ * we can break the loop as soon as we find the first item that is not
+ * spelling guess.
+ */
+ break;
+ }
+ }
+
+ return g_list_reverse (retval);
+}
+
+static gboolean
+populate_context_menu (WebKitWebView *web_view,
+ WebKitContextMenu *context_menu,
+ GdkEvent *event,
+ WebKitHitTestResult *hit_test_result,
+ EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+ WebKitContextMenuItem *input_methods_item = NULL;
+ WebKitContextMenuItem *unicode_item = NULL;
+ WebKitContextMenuItem *play_pause_item = NULL;
+ WebKitContextMenuItem *mute_item = NULL;
+ WebKitContextMenuItem *toggle_controls_item = NULL;
+ WebKitContextMenuItem *toggle_loop_item = NULL;
+ WebKitContextMenuItem *fullscreen_item = NULL;
+ GList *spelling_guess_items = NULL;
+ EphyEmbedEvent *embed_event;
+ gboolean is_document = FALSE;
+ gboolean app_mode;
+ gboolean is_image;
+ gboolean is_media = FALSE;
+ gboolean is_video = FALSE;
+ gboolean is_audio = FALSE;
+
+ is_image = webkit_hit_test_result_context_is_image (hit_test_result);
+
+ if (webkit_hit_test_result_context_is_editable (hit_test_result)) {
+ input_methods_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_INPUT_METHODS);
+ unicode_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_UNICODE);
+ spelling_guess_items = find_spelling_guess_context_menu_items (context_menu);
+ }
+
+ if (webkit_hit_test_result_context_is_media (hit_test_result))
+ {
+ WebKitContextMenuItem *item;
+
+ is_media = TRUE;
+ play_pause_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_MEDIA_PLAY);
+ if (!play_pause_item)
+ play_pause_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_MEDIA_PAUSE);
+ mute_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_MEDIA_MUTE);
+ toggle_controls_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_TOGGLE_MEDIA_CONTROLS);
+ toggle_loop_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_TOGGLE_MEDIA_LOOP);
+ fullscreen_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_ENTER_VIDEO_FULLSCREEN);
+
+ item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_COPY_VIDEO_LINK_TO_CLIPBOARD);
+ if (item)
+ {
+ is_video = TRUE;
+ g_object_unref (item);
+ }
+ else
+ {
+ item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_COPY_AUDIO_LINK_TO_CLIPBOARD);
+ if (item)
+ {
+ is_audio = TRUE;
+ g_object_unref (item);
+ }
+ }
+ }
+
+ webkit_context_menu_remove_all (context_menu);
+
+ embed_event = ephy_embed_event_new ((GdkEventButton *)event, hit_test_result);
+ _ephy_window_set_context_event (window, embed_event);
+ g_object_unref (embed_event);
+
+ app_mode = ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_APPLICATION;
+
+ update_edit_actions_sensitivity (window, FALSE);
+
+ if (webkit_hit_test_result_context_is_link (hit_test_result))
+ {
+ const char *uri;
+ gboolean link_has_web_scheme;
+
+ uri = webkit_hit_test_result_get_link_uri (hit_test_result);
+ link_has_web_scheme = ephy_embed_utils_address_has_web_scheme (uri);
+
+ update_edit_actions_sensitivity (window, TRUE);
+ update_link_actions_sensitivity (window, link_has_web_scheme);
+
+ if (!app_mode)
+ {
+ add_action_to_context_menu (context_menu,
+ priv->popups_action_group, "OpenLinkInNewTab");
+ add_action_to_context_menu (context_menu,
+ priv->popups_action_group, "OpenLinkInNewWindow");
+ webkit_context_menu_append (context_menu,
+ webkit_context_menu_item_new_separator ());
+ }
+ add_action_to_context_menu (context_menu,
+ priv->action_group, "EditCopy");
+ webkit_context_menu_append (context_menu,
+ webkit_context_menu_item_new_separator ());
+ add_action_to_context_menu (context_menu,
+ priv->popups_action_group, "DownloadLinkAs");
+
+ if (g_str_has_prefix (uri, "mailto:"))
+ {
+ add_action_to_context_menu (context_menu,
+ priv->popups_action_group, "CopyEmailAddress");
+ }
+ else
+ {
+ add_action_to_context_menu (context_menu,
+ priv->popups_action_group, "CopyLinkAddress");
+ }
+ }
+ else if (webkit_hit_test_result_context_is_editable (hit_test_result))
+ {
+ GList *l;
+ gboolean has_guesses = FALSE;
+
+ for (l = spelling_guess_items; l; l = g_list_next (l))
+ {
+ WebKitContextMenuItem *item = WEBKIT_CONTEXT_MENU_ITEM (l->data);
+
+ webkit_context_menu_append (context_menu, item);
+ g_object_unref (item);
+ has_guesses = TRUE;
+ }
+ g_list_free (spelling_guess_items);
+
+ if (has_guesses)
+ {
+ webkit_context_menu_append (context_menu,
+ webkit_context_menu_item_new_separator ());
+ }
+
+ update_edit_actions_sensitivity (window, FALSE);
+
+ add_action_to_context_menu (context_menu,
+ priv->action_group, "EditUndo");
+ add_action_to_context_menu (context_menu,
+ priv->action_group, "EditRedo");
+ webkit_context_menu_append (context_menu,
+ webkit_context_menu_item_new_separator ());
+ add_action_to_context_menu (context_menu,
+ priv->action_group, "EditCut");
+ add_action_to_context_menu (context_menu,
+ priv->action_group, "EditCopy");
+ add_action_to_context_menu (context_menu,
+ priv->action_group, "EditPaste");
+ webkit_context_menu_append (context_menu,
+ webkit_context_menu_item_new_separator ());
+ add_action_to_context_menu (context_menu,
+ priv->action_group, "EditSelectAll");
+ if (input_methods_item || unicode_item)
+ webkit_context_menu_append (context_menu,
+ webkit_context_menu_item_new_separator ());
+ add_item_to_context_menu (context_menu, input_methods_item);
+ add_item_to_context_menu (context_menu, unicode_item);
+ }
+ else
+ {
+ is_document = TRUE;
+
+ update_edit_actions_sensitivity (window, TRUE);
+
+ if (!is_image && !is_media)
+ {
+ add_action_to_context_menu (context_menu,
+ priv->toolbar_action_group, "NavigationBack");
+ add_action_to_context_menu (context_menu,
+ priv->toolbar_action_group, "NavigationForward");
+ add_action_to_context_menu (context_menu,
+ priv->action_group, "ViewReload");
+ webkit_context_menu_append (context_menu,
+ webkit_context_menu_item_new_separator ());
+ }
+
+ add_action_to_context_menu (context_menu,
+ priv->action_group, "EditCopy");
+
+ if (!app_mode && !is_image && !is_media)
+ {
+ webkit_context_menu_append (context_menu,
+ webkit_context_menu_item_new_separator ());
+ add_action_to_context_menu (context_menu,
+ priv->popups_action_group, "ContextBookmarkPage");
+ }
+ }
+
+ if (is_image)
+ {
+ webkit_context_menu_append (context_menu,
+ webkit_context_menu_item_new_separator ());
+ add_action_to_context_menu (context_menu,
+ priv->popups_action_group, "SaveImageAs");
+ add_action_to_context_menu (context_menu,
+ priv->popups_action_group, "CopyImageLocation");
+ add_action_to_context_menu (context_menu,
+ priv->popups_action_group, "ViewImage");
+ add_action_to_context_menu (context_menu,
+ priv->popups_action_group, "SetImageAsBackground");
+ }
+
+ if (is_media)
+ {
+ add_item_to_context_menu (context_menu, play_pause_item);
+ add_item_to_context_menu (context_menu, mute_item);
+ add_item_to_context_menu (context_menu, toggle_controls_item);
+ add_item_to_context_menu (context_menu, toggle_loop_item);
+ add_item_to_context_menu (context_menu, fullscreen_item);
+ webkit_context_menu_append (context_menu,
+ webkit_context_menu_item_new_separator ());
+ if (is_video)
+ {
+ add_action_to_context_menu (context_menu, priv->popups_action_group,
+ "OpenVideoInNewWindow");
+ add_action_to_context_menu (context_menu, priv->popups_action_group,
+ "OpenVideoInNewTab");
+ add_action_to_context_menu (context_menu, priv->popups_action_group,
+ "SaveVideoAs");
+ add_action_to_context_menu (context_menu, priv->popups_action_group,
+ "CopyVideoLocation");
+ }
+ else if (is_audio)
+ {
+ add_action_to_context_menu (context_menu, priv->popups_action_group,
+ "OpenAudioInNewWindow");
+ add_action_to_context_menu (context_menu, priv->popups_action_group,
+ "OpenAudioInNewTab");
+ add_action_to_context_menu (context_menu, priv->popups_action_group,
+ "SaveAudioAs");
+ add_action_to_context_menu (context_menu, priv->popups_action_group,
+ "CopyAudioLocation");
+ }
+ }
+
+ g_signal_connect (web_view, "context-menu-dismissed",
+ G_CALLBACK (context_menu_dismissed_cb),
+ window);
+
+ if (app_mode)
+ return FALSE;
+
+ if (is_document && !is_image && !is_media)
+ {
+ webkit_context_menu_append (context_menu,
+ webkit_context_menu_item_new_separator ());
+ add_action_to_context_menu (context_menu,
+ priv->action_group, "FileSendTo");
+ }
+
+ webkit_context_menu_append (context_menu,
+ webkit_context_menu_item_new_separator ());
+ webkit_context_menu_append (context_menu,
+ webkit_context_menu_item_new_from_stock_action (WEBKIT_CONTEXT_MENU_ACTION_INSPECT_ELEMENT));
+
+ return FALSE;
+}
+
+static gboolean
+save_target_uri (EphyWindow *window,
+ WebKitWebView *view,
+ GdkEventButton *event,
+ WebKitHitTestResult *hit_test_result)
+{
+ guint context;
+ char *location = NULL;
+ gboolean retval = FALSE;
+
+ g_object_get (hit_test_result, "context", &context, NULL);
+
+ LOG ("ephy_window_dom_mouse_click_cb: button %d, context %d, modifier %d (%d:%d)",
+ event->button, context, event->state, (int)event->x, (int)event->y);
+
+ /* shift+click saves the link target */
+ if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK)
+ {
+ g_object_get (G_OBJECT (hit_test_result), "link-uri", &location, NULL);
+ }
+ /* Note: pressing enter to submit a form synthesizes a mouse
+ * click event
+ */
+ /* shift+click saves the non-link image */
+ else if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE &&
+ !(context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE))
+ {
+ g_object_get (G_OBJECT (hit_test_result), "image-uri", &location, NULL);
+ }
+
+ if (location)
+ {
+ LOG ("Location: %s", location);
+
+ retval = ephy_embed_utils_address_has_web_scheme (location);
+ if (retval)
+ {
+ EphyDownload *download;
+
+ download = ephy_download_new_for_uri (location, GTK_WINDOW (window));
+ ephy_download_set_action (download, EPHY_DOWNLOAD_ACTION_OPEN);
+ ephy_window_add_download (window, download);
+ g_object_unref (download);
+ }
+
+ g_free (location);
+ }
+
+ return retval;
+}
+
+static gboolean
+ephy_window_dom_mouse_click_cb (WebKitWebView *view,
+ GdkEventButton *event,
+ EphyWindow *window)
+{
+ WebKitHitTestResult *hit_test_result;
+ gboolean handled = FALSE;
+
+ /* Since we're only dealing with shift+click, we can do these
+ checks early. */
+ if (!(event->state & GDK_SHIFT_MASK) || event->button != GDK_BUTTON_PRIMARY)
+ {
+ return FALSE;
+ }
+
+ hit_test_result = g_object_ref (window->priv->hit_test_result);
+ handled = save_target_uri (window, view, event, hit_test_result);
+ g_object_unref (hit_test_result);
+
+ return handled;
+}
+
+static void
+ephy_window_mouse_target_changed_cb (WebKitWebView *web_view,
+ WebKitHitTestResult *hit_test_result,
+ guint modifiers,
+ EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+
+ if (priv->hit_test_result)
+ g_object_unref (priv->hit_test_result);
+ priv->hit_test_result = g_object_ref (hit_test_result);
+}
+
+static void
+ephy_window_set_is_popup (EphyWindow *window,
+ gboolean is_popup)
+{
+ EphyWindowPrivate *priv = window->priv;
+
+ priv->is_popup = is_popup;
+
+ g_object_notify (G_OBJECT (window), "is-popup");
+}
+
+static void
+window_properties_geometry_changed (WebKitWindowProperties *properties,
+ GParamSpec *pspec,
+ EphyWindow *window)
+{
+ GdkRectangle geometry;
+
+ webkit_window_properties_get_geometry (properties, &geometry);
+ if (geometry.x >= 0 && geometry.y >= 0)
+ gtk_window_move (GTK_WINDOW (window), geometry.x, geometry.y);
+ if (geometry.width > 0 && geometry.height > 0)
+ gtk_window_resize (GTK_WINDOW (window), geometry.width, geometry.height);
+}
+
+static void
+ephy_window_configure_for_view (EphyWindow *window,
+ WebKitWebView *web_view)
+{
+ WebKitWindowProperties *properties;
+ GdkRectangle geometry;
+ EphyWindowChrome chrome = 0;
+
+ properties = webkit_web_view_get_window_properties (web_view);
+
+ if (webkit_window_properties_get_toolbar_visible (properties))
+ chrome |= EPHY_WINDOW_CHROME_TOOLBAR;
+
+ if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) != EPHY_EMBED_SHELL_MODE_APPLICATION)
+ {
+ GtkWidget *entry;
+
+ entry = ephy_toolbar_get_location_entry (EPHY_TOOLBAR (window->priv->toolbar));
+ gtk_editable_set_editable (GTK_EDITABLE (entry), FALSE);
+
+ if (webkit_window_properties_get_menubar_visible (properties))
+ chrome |= EPHY_WINDOW_CHROME_MENU;
+ if (webkit_window_properties_get_locationbar_visible (properties))
+ chrome |= EPHY_WINDOW_CHROME_LOCATION;
+ }
+
+ webkit_window_properties_get_geometry (properties, &geometry);
+ if (geometry.width > 0 && geometry.height > 0)
+ gtk_window_set_default_size (GTK_WINDOW (window), geometry.width, geometry.height);
+
+ if (!webkit_window_properties_get_resizable (properties))
+ gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
+
+ window->priv->is_popup = TRUE;
+ ephy_window_set_chrome (window, chrome);
+ g_signal_connect (properties, "notify::geometry",
+ G_CALLBACK (window_properties_geometry_changed),
+ window);
+}
+
+static gboolean
+web_view_ready_cb (WebKitWebView *web_view,
+ WebKitWebView *parent_web_view)
+{
+ EphyWindow *window, *parent_view_window;
+ gboolean using_new_window;
+
+ window = EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (web_view)));
+ parent_view_window = EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (parent_web_view)));
+
+ using_new_window = window != parent_view_window;
+
+ if (using_new_window)
+ {
+ ephy_window_configure_for_view (window, web_view);
+ g_signal_emit_by_name (parent_web_view, "new-window", web_view);
+ }
+
+ if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_APPLICATION &&
+ !webkit_web_view_get_uri(web_view))
+ {
+ /* Wait until we have a valid URL to decide whether to show the window
+ * or load the URL in the default web browser
+ */
+ g_object_set_data_full (G_OBJECT (window), "referrer",
+ g_strdup (webkit_web_view_get_uri (parent_web_view)),
+ g_free);
+ return TRUE;
+ }
+
+ gtk_widget_show (GTK_WIDGET (window));
+
+ return TRUE;
+}
+
+static WebKitWebView *
+create_web_view_cb (WebKitWebView *web_view,
+ WebKitNavigationAction *navigation_action,
+ EphyWindow *window)
+{
+ EphyEmbed *embed;
+ WebKitWebView *new_web_view;
+ EphyNewTabFlags flags;
+ EphyWindow *target_window;
+
+ if ((ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) != EPHY_EMBED_SHELL_MODE_APPLICATION) &&
+ (g_settings_get_boolean (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_NEW_WINDOWS_IN_TABS) ||
+ g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_FULLSCREEN)))
+ {
+ target_window = window;
+ flags = EPHY_NEW_TAB_JUMP |
+ EPHY_NEW_TAB_APPEND_AFTER;
+ }
+ else
+ {
+ target_window = ephy_window_new ();
+ flags = EPHY_NEW_TAB_DONT_SHOW_WINDOW;
+ }
+
+ embed = ephy_shell_new_tab_full (ephy_shell_get_default (),
+ NULL,
+ web_view,
+ target_window,
+ EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (web_view),
+ flags,
+ 0);
+ if (target_window == window)
+ gtk_widget_grab_focus (GTK_WIDGET (embed));
+
+ new_web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+ g_signal_connect (new_web_view, "ready-to-show",
+ G_CALLBACK (web_view_ready_cb),
+ web_view);
+
+ return new_web_view;
+}
+
+static gboolean
+decide_policy_cb (WebKitWebView *web_view,
+ WebKitPolicyDecision *decision,
+ WebKitPolicyDecisionType decision_type,
+ EphyWindow *window)
+{
+ WebKitNavigationPolicyDecision *navigation_decision;
+ WebKitNavigationAction *navigation_action;
+ WebKitNavigationType navigation_type;
+ WebKitURIRequest *request;
+ const char *uri;
+ EphyEmbed *embed;
+
+ if (decision_type == WEBKIT_POLICY_DECISION_TYPE_RESPONSE)
+ return FALSE;
+
+ navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION (decision);
+ navigation_action = webkit_navigation_policy_decision_get_navigation_action (navigation_decision);
+ request = webkit_navigation_action_get_request (navigation_action);
+ uri = webkit_uri_request_get_uri (request);
+
+ if (!ephy_embed_utils_address_has_web_scheme (uri))
+ {
+ GError *error = NULL;
+ GdkScreen *screen;
+
+ screen = gtk_widget_get_screen (GTK_WIDGET (web_view));
+ gtk_show_uri (screen, uri, GDK_CURRENT_TIME, &error);
+
+ if (error)
+ {
+ LOG ("failed to handle non web scheme: %s", error->message);
+ g_error_free (error);
+
+ return FALSE;
+ }
+
+ webkit_policy_decision_ignore (decision);
+
+ return TRUE;
+ }
+
+ if (decision_type == WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION)
+ {
+ const char *frame_name = webkit_navigation_policy_decision_get_frame_name (navigation_decision);
+
+ if (g_strcmp0 (frame_name, "_evince_download") == 0)
+ {
+ /* The Evince Browser Plugin is requesting us to downlod the document */
+ webkit_policy_decision_download (decision);
+ return TRUE;
+ }
+
+ if (!g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_ENABLE_POPUPS) &&
+ !webkit_navigation_action_is_user_gesture (navigation_action))
+ {
+ webkit_policy_decision_ignore (decision);
+ return TRUE;
+ }
+ }
+
+ navigation_type = webkit_navigation_action_get_navigation_type (navigation_action);
+
+ if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_APPLICATION)
+ {
+ if (!gtk_widget_is_visible (GTK_WIDGET (window)))
+ {
+ char *referrer;
+
+ referrer = (char *)g_object_get_data (G_OBJECT (window), "referrer");
+
+ if (ephy_embed_utils_urls_have_same_origin (uri, referrer))
+ {
+ gtk_widget_show (GTK_WIDGET (window));
+ }
+ else
+ {
+ ephy_file_open_uri_in_default_browser (uri, GDK_CURRENT_TIME,
+ gtk_window_get_screen (GTK_WINDOW (window)));
+ webkit_policy_decision_ignore (decision);
+
+ gtk_widget_destroy (GTK_WIDGET (window));
+
+ return TRUE;
+ }
+ }
+
+ if (navigation_type == WEBKIT_NAVIGATION_TYPE_LINK_CLICKED)
+ {
+ if (ephy_embed_utils_urls_have_same_origin (uri, webkit_web_view_get_uri (web_view)))
+ {
+ return FALSE;
+ }
+
+ ephy_file_open_uri_in_default_browser (uri, GDK_CURRENT_TIME,
+ gtk_window_get_screen (GTK_WINDOW (window)));
+ webkit_policy_decision_ignore (decision);
+
+ return TRUE;
+ }
+ }
+
+ if (navigation_type == WEBKIT_NAVIGATION_TYPE_LINK_CLICKED)
+ {
+ gint button;
+ gint state;
+ EphyEmbed *new_embed;
+ EphyNewTabFlags flags = 0;
+ EphyWindow *target_window = window;
+
+ button = webkit_navigation_action_get_mouse_button (navigation_action);
+ state = webkit_navigation_action_get_modifiers (navigation_action);
+
+ ephy_web_view_set_visit_type (EPHY_WEB_VIEW (web_view),
+ EPHY_PAGE_VISIT_LINK);
+
+ /* New tab in new window for control+shift+click */
+ if (button == 1 && state == (GDK_SHIFT_MASK | GDK_CONTROL_MASK) &&
+ !g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_FULLSCREEN))
+ {
+ target_window = ephy_window_new ();
+ }
+ /* New tab in existing window for middle click and
+ * control+click */
+ else if (button == 2 || (button == 1 && state == GDK_CONTROL_MASK))
+ {
+ flags |= EPHY_NEW_TAB_APPEND_AFTER;
+ }
+ /* Because we connect to button-press-event *after*
+ * (G_CONNECT_AFTER) we need to prevent WebKit from browsing to
+ * a link when you shift+click it. Otherwise when you
+ * shift+click a link to download it you would also be taken to
+ * the link destination. */
+ else if (button == 1 && state == GDK_SHIFT_MASK)
+ {
+ webkit_policy_decision_ignore (decision);
+
+ return TRUE;
+ }
+ /* Those were our special cases, we won't handle this */
+ else
+ {
+ return FALSE;
+ }
+
+ embed = ephy_embed_container_get_active_child
+ (EPHY_EMBED_CONTAINER (window));
+
+ new_embed = ephy_shell_new_tab_full (ephy_shell_get_default (),
+ NULL, NULL,
+ target_window,
+ embed,
+ flags,
+ 0);
+ ephy_web_view_load_request (ephy_embed_get_web_view (new_embed), request);
+
+ webkit_policy_decision_ignore (decision);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void
+ephy_window_connect_active_embed (EphyWindow *window)
+{
+ EphyEmbed *embed;
+ WebKitWebView *web_view;
+ EphyWebView *view;
+
+ g_return_if_fail (window->priv->active_embed != NULL);
+
+ embed = window->priv->active_embed;
+ view = ephy_embed_get_web_view (embed);
+ web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+
+ sync_tab_security (view, NULL, window);
+ sync_tab_document_type (view, NULL, window);
+ sync_tab_load_status (view, WEBKIT_LOAD_STARTED, window);
+ sync_tab_is_blank (view, NULL, window);
+ sync_tab_navigation (view, NULL, window);
+ sync_tab_title (embed, NULL, window);
+ sync_tab_address (view, NULL, window);
+ sync_tab_icon (view, NULL, window);
+ sync_tab_popup_windows (view, NULL, window);
+ sync_tab_popups_allowed (view, NULL, window);
+
+ sync_tab_zoom (web_view, NULL, window);
+
+ g_signal_connect_object (web_view, "notify::zoom-level",
+ G_CALLBACK (sync_tab_zoom),
+ window, 0);
+
+ g_signal_connect_object (web_view, "create",
+ G_CALLBACK (create_web_view_cb),
+ window, 0);
+ g_signal_connect_object (web_view, "decide-policy",
+ G_CALLBACK (decide_policy_cb),
+ window, 0);
+ g_signal_connect_object (view, "notify::hidden-popup-count",
+ G_CALLBACK (sync_tab_popup_windows),
+ window, 0);
+ g_signal_connect_object (view, "notify::popups-allowed",
+ G_CALLBACK (sync_tab_popups_allowed),
+ window, 0);
+ g_signal_connect_object (embed, "notify::title",
+ G_CALLBACK (sync_tab_title),
+ window, 0);
+ g_signal_connect_object (view, "notify::address",
+ G_CALLBACK (sync_tab_address),
+ window, 0);
+ g_signal_connect_object (view, "notify::icon",
+ G_CALLBACK (sync_tab_icon),
+ window, 0);
+ g_signal_connect_object (view, "notify::security-level",
+ G_CALLBACK (sync_tab_security),
+ window, 0);
+ g_signal_connect_object (view, "notify::document-type",
+ G_CALLBACK (sync_tab_document_type),
+ window, 0);
+ g_signal_connect_object (view, "load-changed",
+ G_CALLBACK (sync_tab_load_status),
+ window, 0);
+ g_signal_connect_object (view, "notify::navigation",
+ G_CALLBACK (sync_tab_navigation),
+ window, 0);
+ g_signal_connect_object (view, "notify::is-blank",
+ G_CALLBACK (sync_tab_is_blank),
+ window, 0);
+ g_signal_connect_object (view, "button-press-event",
+ G_CALLBACK (ephy_window_dom_mouse_click_cb),
+ window, 0);
+ g_signal_connect_object (view, "context-menu",
+ G_CALLBACK (populate_context_menu),
+ window, 0);
+ g_signal_connect_object (view, "mouse-target-changed",
+ G_CALLBACK (ephy_window_mouse_target_changed_cb),
+ window, 0);
+
+ g_object_notify (G_OBJECT (window), "active-child");
+}
+
+static void
+ephy_window_disconnect_active_embed (EphyWindow *window)
+{
+ EphyEmbed *embed;
+ WebKitWebView *web_view;
+ EphyWebView *view;
+
+ g_return_if_fail (window->priv->active_embed != NULL);
+
+ embed = window->priv->active_embed;
+ web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+ view = EPHY_WEB_VIEW (web_view);
+
+ g_signal_handlers_disconnect_by_func (web_view,
+ G_CALLBACK (sync_tab_zoom),
+ window);
+ g_signal_handlers_disconnect_by_func (web_view,
+ G_CALLBACK (create_web_view_cb),
+ window);
+ g_signal_handlers_disconnect_by_func (view,
+ G_CALLBACK (decide_policy_cb),
+ window);
+ g_signal_handlers_disconnect_by_func (view,
+ G_CALLBACK (sync_tab_popup_windows),
+ window);
+ g_signal_handlers_disconnect_by_func (view,
+ G_CALLBACK (sync_tab_popups_allowed),
+ window);
+ g_signal_handlers_disconnect_by_func (view,
+ G_CALLBACK (sync_tab_security),
+ window);
+ g_signal_handlers_disconnect_by_func (view,
+ G_CALLBACK (sync_tab_document_type),
+ window);
+ g_signal_handlers_disconnect_by_func (view,
+ G_CALLBACK (sync_tab_load_status),
+ window);
+ g_signal_handlers_disconnect_by_func (view,
+ G_CALLBACK (sync_tab_is_blank),
+ window);
+ g_signal_handlers_disconnect_by_func (view,
+ G_CALLBACK (sync_tab_navigation),
+ window);
+ g_signal_handlers_disconnect_by_func (embed,
+ G_CALLBACK (sync_tab_title),
+ window);
+ g_signal_handlers_disconnect_by_func (view,
+ G_CALLBACK (sync_tab_address),
+ window);
+ g_signal_handlers_disconnect_by_func (view,
+ G_CALLBACK (sync_tab_icon),
+ window);
+
+ g_signal_handlers_disconnect_by_func
+ (view, G_CALLBACK (ephy_window_dom_mouse_click_cb), window);
+ g_signal_handlers_disconnect_by_func (view,
+ G_CALLBACK (populate_context_menu),
+ window);
+ g_signal_handlers_disconnect_by_func (view,
+ G_CALLBACK (ephy_window_mouse_target_changed_cb),
+ window);
+}
+
+static void
+ephy_window_set_active_tab (EphyWindow *window, EphyEmbed *new_embed)
+{
+ EphyEmbed *old_embed;
+
+ g_return_if_fail (EPHY_IS_WINDOW (window));
+ g_return_if_fail (gtk_widget_get_toplevel (GTK_WIDGET (new_embed)) == GTK_WIDGET (window));
+
+ old_embed = window->priv->active_embed;
+
+ if (old_embed == new_embed) return;
+
+ if (old_embed != NULL)
+ ephy_window_disconnect_active_embed (window);
+
+ window->priv->active_embed = new_embed;
+
+ if (new_embed != NULL)
+ ephy_window_connect_active_embed (window);
+}
+
+static gboolean
+embed_modal_alert_cb (EphyEmbed *embed,
+ EphyWindow *window)
+{
+ const char *address;
+
+ /* switch the window to the tab, and bring the window to the foreground
+ * (since the alert is modal, the user won't be able to do anything
+ * with his current window anyway :|)
+ */
+ impl_set_active_child (EPHY_EMBED_CONTAINER (window), embed);
+ gtk_window_present (GTK_WINDOW (window));
+
+ /* make sure the location entry shows the real URL of the tab's page */
+ address = ephy_web_view_get_address (ephy_embed_get_web_view (embed));
+ ephy_window_set_location (window, address);
+
+ /* don't suppress alert */
+ return FALSE;
+}
+
+static void
+tab_accels_item_activate (GtkAction *action,
+ EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+ const char *name;
+ int tab_number;
+
+ name = gtk_action_get_name (action);
+ tab_number = atoi (name + strlen ("TabAccel"));
+
+ gtk_notebook_set_current_page (priv->notebook, tab_number);
+}
+
+static void
+tab_accels_update (EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+ int pages, i = 0;
+ GList *actions, *l;
+
+ actions = gtk_action_group_list_actions (priv->tab_accels_action_group);
+ pages = gtk_notebook_get_n_pages (priv->notebook);
+ for (l = actions; l != NULL; l = l->next)
+ {
+ GtkAction *action = GTK_ACTION (l->data);
+
+ gtk_action_set_sensitive (action, (i < pages));
+
+ i++;
+ }
+ g_list_free (actions);
+}
+
+#define TAB_ACCELS_N 10
+
+static void
+setup_tab_accels (EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+ guint id;
+ int i;
+
+ id = gtk_ui_manager_new_merge_id (priv->manager);
+
+ for (i = 0; i < TAB_ACCELS_N; i++)
+ {
+ GtkAction *action;
+ char *name;
+ char *accel;
+
+ name = g_strdup_printf ("TabAccel%d", i);
+ accel = g_strdup_printf ("%d", (i + 1) % TAB_ACCELS_N);
+ action = gtk_action_new (name, NULL, NULL, NULL);
+
+ gtk_action_group_add_action_with_accel (priv->tab_accels_action_group,
+ action, accel);
+
+ g_signal_connect (action, "activate",
+ G_CALLBACK (tab_accels_item_activate), window);
+ gtk_ui_manager_add_ui (priv->manager, id, "/",
+ name, name,
+ GTK_UI_MANAGER_ACCELERATOR,
+ FALSE);
+
+ g_object_unref (action);
+ g_free (accel);
+ g_free (name);
+ }
+}
+
+static gboolean
+show_notebook_popup_menu (GtkNotebook *notebook,
+ EphyWindow *window,
+ GdkEventButton *event)
+{
+ GtkWidget *menu, *tab, *tab_label;
+ GtkAction *action;
+
+ menu = gtk_ui_manager_get_widget (window->priv->manager, "/EphyNotebookPopup");
+ g_return_val_if_fail (menu != NULL, FALSE);
+
+ /* allow extensions to sync when showing the popup */
+ action = gtk_action_group_get_action (window->priv->action_group,
+ "NotebookPopupAction");
+ g_return_val_if_fail (action != NULL, FALSE);
+ gtk_action_activate (action);
+
+ if (event != NULL)
+ {
+ gint n_pages, page_num;
+
+ tab = GTK_WIDGET (window->priv->active_embed);
+ n_pages = gtk_notebook_get_n_pages (notebook);
+ page_num = gtk_notebook_page_num (notebook, tab);
+
+ /* enable/disable move left/right items*/
+ action = gtk_action_group_get_action (window->priv->action_group,
+ "TabsMoveLeft");
+ gtk_action_set_sensitive (action, page_num > 0);
+
+ action = gtk_action_group_get_action (window->priv->action_group,
+ "TabsMoveRight");
+ gtk_action_set_sensitive (action, page_num < n_pages - 1);
+
+ gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
+ NULL, NULL,
+ event->button, event->time);
+ }
+ else
+ {
+ tab = GTK_WIDGET (window->priv->active_embed);
+ tab_label = gtk_notebook_get_tab_label (notebook, tab);
+
+ gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
+ ephy_gui_menu_position_under_widget, tab_label,
+ 0, gtk_get_current_event_time ());
+ gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+notebook_button_press_cb (GtkNotebook *notebook,
+ GdkEventButton *event,
+ EphyWindow *window)
+{
+ if (GDK_BUTTON_PRESS == event->type && 3 == event->button)
+ {
+ return show_notebook_popup_menu (notebook, window, event);
+ }
+
+ return FALSE;
+}
+
+static gboolean
+notebook_popup_menu_cb (GtkNotebook *notebook,
+ EphyWindow *window)
+{
+ /* Only respond if the notebook is the actual focus */
+ if (EPHY_IS_NOTEBOOK (gtk_window_get_focus (GTK_WINDOW (window))))
+ {
+ return show_notebook_popup_menu (notebook, window, NULL);
+ }
+
+ return FALSE;
+}
+
+static gboolean
+present_on_idle_cb (GtkWindow *window)
+{
+ gtk_window_present (window);
+ return FALSE;
+}
+
+static gboolean
+delayed_remove_child (gpointer data)
+{
+ GtkWidget *widget = GTK_WIDGET (data);
+ EphyEmbedContainer *container = EPHY_EMBED_CONTAINER (gtk_widget_get_toplevel (widget));
+
+ ephy_embed_container_remove_child (container, EPHY_EMBED (widget));
+
+ return FALSE;
+}
+
+static void
+download_only_load_cb (EphyWebView *view,
+ EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+
+ if (gtk_notebook_get_n_pages (priv->notebook) == 1) {
+ ephy_web_view_load_homepage (view);
+ return;
+ }
+
+ g_idle_add (delayed_remove_child, EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (view));
+}
+
+static void
+notebook_page_added_cb (EphyNotebook *notebook,
+ EphyEmbed *embed,
+ guint position,
+ EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+
+ LOG ("page-added notebook %p embed %p position %u\n", notebook, embed, position);
+
+ g_return_if_fail (EPHY_IS_EMBED (embed));
+
+#if 0
+ g_signal_connect_object (embed, "open-link",
+ G_CALLBACK (ephy_link_open), window,
+ G_CONNECT_SWAPPED);
+#endif
+
+ g_signal_connect_object (ephy_embed_get_web_view (embed), "download-only-load",
+ G_CALLBACK (download_only_load_cb), window, G_CONNECT_AFTER);
+
+ g_signal_connect_object (ephy_embed_get_web_view (embed), "ge-modal-alert",
+ G_CALLBACK (embed_modal_alert_cb), window, G_CONNECT_AFTER);
+
+ if (priv->present_on_insert)
+ {
+ priv->present_on_insert = FALSE;
+ g_idle_add ((GSourceFunc) present_on_idle_cb, g_object_ref (window));
+ }
+
+ tab_accels_update (window);
+}
+
+static void
+notebook_page_removed_cb (EphyNotebook *notebook,
+ EphyEmbed *embed,
+ guint position,
+ EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+
+ LOG ("page-removed notebook %p embed %p position %u\n", notebook, embed, position);
+
+ if (priv->closing) return;
+
+ g_return_if_fail (EPHY_IS_EMBED (embed));
+
+#if 0
+ g_signal_handlers_disconnect_by_func (G_OBJECT (embed),
+ G_CALLBACK (ephy_link_open),
+ window);
+#endif
+
+ g_signal_handlers_disconnect_by_func
+ (ephy_embed_get_web_view (embed), G_CALLBACK (download_only_load_cb), window);
+
+ g_signal_handlers_disconnect_by_func
+ (ephy_embed_get_web_view (embed), G_CALLBACK (embed_modal_alert_cb), window);
+
+ tab_accels_update (window);
+}
+
+static void
+ephy_window_close_tab (EphyWindow *window,
+ EphyEmbed *tab)
+{
+ gtk_widget_destroy (GTK_WIDGET (tab));
+
+ /* If that was the last tab, destroy the window. */
+ if (gtk_notebook_get_n_pages (window->priv->notebook) == 0)
+ {
+ gtk_widget_destroy (GTK_WIDGET (window));
+ }
+}
+
+static void
+tab_has_modified_forms_cb (EphyWebView *view,
+ GAsyncResult *result,
+ EphyWindow *window)
+{
+ gboolean has_modified_forms;
+
+ has_modified_forms = ephy_web_view_has_modified_forms_finish (view, result, NULL);
+ if (!has_modified_forms || confirm_close_with_modified_forms (window))
+ {
+ ephy_window_close_tab (window, EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (view));
+ }
+}
+
+static void
+notebook_page_close_request_cb (EphyNotebook *notebook,
+ EphyEmbed *embed,
+ EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+
+ if (gtk_notebook_get_n_pages (priv->notebook) == 1)
+ {
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_QUIT))
+ {
+ return;
+ }
+ if (window_has_ongoing_downloads (window) &&
+ !confirm_close_with_downloads (window))
+ {
+ return;
+ }
+ }
+
+ if (g_settings_get_boolean (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_WARN_ON_CLOSE_UNSUBMITTED_DATA))
+ {
+ ephy_web_view_has_modified_forms (ephy_embed_get_web_view (embed),
+ NULL,
+ (GAsyncReadyCallback)tab_has_modified_forms_cb,
+ window);
+ }
+ else
+ {
+ ephy_window_close_tab (window, embed);
+ }
+}
+
+static GtkWidget *
+notebook_create_window_cb (GtkNotebook *notebook,
+ GtkWidget *page,
+ int x,
+ int y,
+ EphyWindow *window)
+{
+ EphyWindow *new_window;
+ EphyWindowPrivate *new_priv;
+
+ new_window = ephy_window_new ();
+ new_priv = new_window->priv;
+
+ new_priv->present_on_insert = TRUE;
+
+ return ephy_window_get_notebook (new_window);
+}
+
+static EphyEmbed *
+real_get_active_tab (EphyWindow *window, int page_num)
+{
+ GtkWidget *embed;
+
+ if (page_num == -1)
+ {
+ page_num = gtk_notebook_get_current_page (window->priv->notebook);
+ }
+
+ embed = gtk_notebook_get_nth_page (window->priv->notebook, page_num);
+
+ g_return_val_if_fail (EPHY_IS_EMBED (embed), NULL);
+
+ return EPHY_EMBED (embed);
+}
+
+static void
+notebook_switch_page_cb (GtkNotebook *notebook,
+ GtkWidget *page,
+ guint page_num,
+ EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+ EphyEmbed *embed;
+
+ LOG ("switch-page notebook %p position %u\n", notebook, page_num);
+
+ if (priv->closing) return;
+
+ /* get the new tab */
+ embed = real_get_active_tab (window, page_num);
+
+ /* update new tab */
+ ephy_window_set_active_tab (window, embed);
+
+ ephy_title_box_set_web_view (ephy_toolbar_get_title_box (EPHY_TOOLBAR (priv->toolbar)),
+ EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
+}
+
+static GtkNotebook *
+setup_notebook (EphyWindow *window)
+{
+ GtkNotebook *notebook;
+
+ notebook = GTK_NOTEBOOK (g_object_new (EPHY_TYPE_NOTEBOOK, NULL));
+
+ g_signal_connect_after (notebook, "switch-page",
+ G_CALLBACK (notebook_switch_page_cb),
+ window);
+ g_signal_connect (notebook, "create-window",
+ G_CALLBACK (notebook_create_window_cb),
+ window);
+
+ g_signal_connect (notebook, "popup-menu",
+ G_CALLBACK (notebook_popup_menu_cb), window);
+ g_signal_connect (notebook, "button-press-event",
+ G_CALLBACK (notebook_button_press_cb), window);
+
+ g_signal_connect (notebook, "page-added",
+ G_CALLBACK (notebook_page_added_cb), window);
+ g_signal_connect (notebook, "page-removed",
+ G_CALLBACK (notebook_page_removed_cb), window);
+ g_signal_connect (notebook, "tab-close-request",
+ G_CALLBACK (notebook_page_close_request_cb), window);
+
+ g_signal_connect_swapped (notebook, "open-link",
+ G_CALLBACK (ephy_link_open), window);
+
+ return notebook;
+}
+
+static void
+ephy_window_set_downloads_box_visibility (EphyWindow *window,
+ gboolean show)
+{
+ EphyWindowChrome chrome = window->priv->chrome;
+
+ if (show)
+ chrome |= EPHY_WINDOW_CHROME_DOWNLOADS_BOX;
+ else
+ chrome &= ~EPHY_WINDOW_CHROME_DOWNLOADS_BOX;
+
+ ephy_window_set_chrome (window, chrome);
+}
+
+void
+ephy_window_add_download (EphyWindow *window,
+ EphyDownload *download)
+{
+ GtkWidget *widget;
+
+ widget = ephy_download_widget_new (download);
+ gtk_box_pack_start (GTK_BOX (window->priv->downloads_box),
+ widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+ ephy_window_set_downloads_box_visibility (window, TRUE);
+}
+
+static void
+downloads_removed_cb (GtkContainer *container,
+ GtkWidget *widget,
+ gpointer data)
+{
+ EphyWindow *window = EPHY_WINDOW (data);
+ GList *children = NULL;
+
+ children = gtk_container_get_children (container);
+ if (g_list_length (children) == 1)
+ ephy_window_set_downloads_box_visibility (window, FALSE);
+
+ g_list_free (children);
+}
+
+static void
+downloads_close_cb (GtkButton *button, EphyWindow *window)
+{
+ GList *l, *downloads;
+
+ downloads = gtk_container_get_children (GTK_CONTAINER (window->priv->downloads_box));
+
+ for (l = downloads; l != NULL; l = l->next)
+ {
+ if (EPHY_IS_DOWNLOAD_WIDGET (l->data) != TRUE)
+ continue;
+
+ if (ephy_download_widget_download_is_finished (EPHY_DOWNLOAD_WIDGET (l->data)))
+ {
+ gtk_widget_destroy (GTK_WIDGET (l->data));
+ }
+ }
+ g_list_free (downloads);
+
+ ephy_window_set_downloads_box_visibility (window, FALSE);
+}
+
+static GtkWidget *
+setup_downloads_box (EphyWindow *window)
+{
+ GtkWidget *widget;
+ GtkWidget *close_button;
+ GtkWidget *image;
+
+ widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ close_button = gtk_button_new ();
+ gtk_container_set_border_width (GTK_CONTAINER (close_button), 6);
+ gtk_widget_set_valign (close_button, GTK_ALIGN_CENTER);
+ gtk_style_context_add_class (gtk_widget_get_style_context (close_button), "image-button");
+ gtk_style_context_add_class (gtk_widget_get_style_context (close_button), "close");
+
+ gtk_button_set_relief (GTK_BUTTON (close_button), GTK_RELIEF_NONE);
+
+ image = gtk_image_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_MENU);
+ g_object_set (image, "use-fallback", TRUE, NULL);
+
+ gtk_container_add (GTK_CONTAINER (close_button), image);
+ gtk_box_pack_end (GTK_BOX (widget), close_button, FALSE, FALSE, 4);
+
+ g_signal_connect (close_button, "clicked",
+ G_CALLBACK (downloads_close_cb), window);
+ g_signal_connect (widget, "remove",
+ G_CALLBACK (downloads_removed_cb), window);
+
+ gtk_widget_show_all (close_button);
+
+ return widget;
+}
+
+static void
+ephy_window_dispose (GObject *object)
+{
+ EphyWindow *window = EPHY_WINDOW (object);
+ EphyWindowPrivate *priv = window->priv;
+ GSList *popups;
+
+ LOG ("EphyWindow dispose %p", window);
+
+ /* Only do these once */
+ if (window->priv->closing == FALSE)
+ {
+ window->priv->closing = TRUE;
+
+ ephy_bookmarks_ui_detach_window (window);
+
+ /* Deactivate menus */
+ popups = gtk_ui_manager_get_toplevels (window->priv->manager, GTK_UI_MANAGER_POPUP);
+ g_slist_foreach (popups, (GFunc) gtk_menu_shell_deactivate, NULL);
+ g_slist_free (popups);
+
+ g_object_unref (priv->enc_menu);
+ priv->enc_menu = NULL;
+
+ priv->action_group = NULL;
+ priv->popups_action_group = NULL;
+ priv->tab_accels_action_group = NULL;
+
+ g_object_unref (priv->manager);
+ priv->manager = NULL;
+
+ _ephy_window_set_context_event (window, NULL);
+
+ g_clear_object (&priv->hit_test_result);
+ }
+
+ G_OBJECT_CLASS (ephy_window_parent_class)->dispose (object);
+}
+
+static void
+ephy_window_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyWindow *window = EPHY_WINDOW (object);
+
+ switch (prop_id)
+ {
+ case PROP_ACTIVE_CHILD:
+ impl_set_active_child (EPHY_EMBED_CONTAINER (window),
+ g_value_get_object (value));
+ break;
+ case PROP_CHROME:
+ ephy_window_set_chrome (window, g_value_get_flags (value));
+ break;
+ case PROP_SINGLE_TAB_MODE:
+ ephy_window_set_is_popup (window, g_value_get_boolean (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+ephy_window_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EphyWindow *window = EPHY_WINDOW (object);
+
+ switch (prop_id)
+ {
+ case PROP_ACTIVE_CHILD:
+ g_value_set_object (value, window->priv->active_embed);
+ break;
+ case PROP_CHROME:
+ g_value_set_flags (value, window->priv->chrome);
+ break;
+ case PROP_SINGLE_TAB_MODE:
+ g_value_set_boolean (value, window->priv->is_popup);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static gboolean
+ephy_window_state_event (GtkWidget *widget,
+ GdkEventWindowState *event)
+{
+ EphyWindow *window = EPHY_WINDOW (widget);
+ EphyWindowPrivate *priv = window->priv;
+
+ if (GTK_WIDGET_CLASS (ephy_window_parent_class)->window_state_event)
+ {
+ GTK_WIDGET_CLASS (ephy_window_parent_class)->window_state_event (widget, event);
+ }
+
+ if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
+ {
+ GtkActionGroup *action_group;
+ GtkAction *action;
+ gboolean fullscreen;
+
+ fullscreen = event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN;
+
+ if (fullscreen)
+ {
+ ephy_window_fullscreen (window);
+ }
+ else
+ {
+ ephy_window_unfullscreen (window);
+ }
+
+ action_group = priv->action_group;
+
+ action = gtk_action_group_get_action (action_group, "ViewFullscreen");
+ g_signal_handlers_block_by_func
+ (action, G_CALLBACK (window_cmd_view_fullscreen), window);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), fullscreen);
+ g_signal_handlers_unblock_by_func
+ (action, G_CALLBACK (window_cmd_view_fullscreen), window);
+ }
+
+ return FALSE;
+}
+
+static void
+ephy_window_finalize (GObject *object)
+{
+ EphyWindow *window = EPHY_WINDOW (object);
+ EphyWindowPrivate *priv = window->priv;
+
+ if (priv->app_menu_visibility_handler != 0)
+ g_signal_handler_disconnect (gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (window))),
+ priv->app_menu_visibility_handler);
+
+ G_OBJECT_CLASS (ephy_window_parent_class)->finalize (object);
+
+ LOG ("EphyWindow finalised %p", object);
+}
+
+static void
+allow_popups_notifier (GSettings *settings,
+ char *key,
+ EphyWindow *window)
+{
+ GList *tabs;
+ EphyEmbed *embed;
+
+ g_return_if_fail (EPHY_IS_WINDOW (window));
+
+ tabs = impl_get_children (EPHY_EMBED_CONTAINER (window));
+
+ for (; tabs; tabs = g_list_next (tabs))
+ {
+ embed = EPHY_EMBED (tabs->data);
+ g_return_if_fail (EPHY_IS_EMBED (embed));
+
+ g_object_notify (G_OBJECT (ephy_embed_get_web_view (embed)), "popups-allowed");
+ }
+ g_list_free (tabs);
+}
+
+static void
+sync_user_input_cb (EphyLocationController *action,
+ GParamSpec *pspec,
+ EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+ EphyEmbed *embed;
+ const char *address;
+
+ LOG ("sync_user_input_cb");
+
+ if (priv->updating_address) return;
+
+ embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
+ g_assert (EPHY_IS_EMBED (embed));
+
+ address = ephy_location_controller_get_address (action);
+
+ priv->updating_address = TRUE;
+ ephy_web_view_set_typed_address (ephy_embed_get_web_view (embed), address);
+ priv->updating_address = FALSE;
+}
+
+static void
+zoom_to_level_cb (GtkAction *action,
+ float zoom,
+ EphyWindow *window)
+{
+ ephy_window_set_zoom (window, zoom);
+}
+
+static void
+open_certificate_popover (EphyWindow *window,
+ GtkWidget *relative_to,
+ GdkRectangle *lock_position)
+{
+ EphyWindowPrivate *priv = window->priv;
+ EphyWebView *view;
+ GTlsCertificate *certificate;
+ GTlsCertificateFlags tls_errors;
+ EphySecurityLevel security_level;
+ GtkWidget *location_entry;
+ GtkWidget *certificate_popover;
+
+ view = ephy_embed_get_web_view (priv->active_embed);
+ ephy_web_view_get_security_level (view, &security_level, &certificate, &tls_errors);
+ location_entry = ephy_toolbar_get_location_entry (EPHY_TOOLBAR (priv->toolbar));
+
+ certificate_popover = ephy_certificate_popover_new (relative_to,
+ ephy_location_entry_get_location (EPHY_LOCATION_ENTRY (location_entry)),
+ certificate,
+ tls_errors,
+ security_level);
+
+ g_signal_connect (certificate_popover, "closed",
+ G_CALLBACK (gtk_widget_destroy), NULL);
+ gtk_popover_set_pointing_to (GTK_POPOVER (certificate_popover), lock_position);
+ gtk_widget_show (certificate_popover);
+}
+
+static void
+location_controller_lock_clicked_cb (EphyLocationController *controller,
+ gpointer user_data)
+{
+ EphyWindow *window = EPHY_WINDOW (user_data);
+ EphyWindowPrivate *priv = window->priv;
+ GtkWidget *location_entry;
+ GdkRectangle lock_position;
+
+ location_entry = ephy_toolbar_get_location_entry (EPHY_TOOLBAR (priv->toolbar));
+ gtk_entry_get_icon_area (GTK_ENTRY (location_entry), GTK_ENTRY_ICON_SECONDARY, &lock_position);
+ open_certificate_popover (window, location_entry, &lock_position);
+}
+
+static void
+title_box_lock_clicked_cb (EphyTitleBox *title_box,
+ GdkRectangle *lock_position,
+ gpointer user_data)
+{
+ EphyWindow *window = EPHY_WINDOW (user_data);
+
+ open_certificate_popover (window, GTK_WIDGET (title_box), lock_position);
+}
+
+static GtkWidget *
+setup_toolbar (EphyWindow *window)
+{
+ GtkWidget *toolbar;
+ GtkAction *action;
+ EphyWindowPrivate *priv = window->priv;
+ EphyEmbedShellMode app_mode;
+ EphyTitleBox *title_box;
+
+ toolbar = ephy_toolbar_new (window);
+ gtk_window_set_titlebar (GTK_WINDOW (window), toolbar);
+ gtk_widget_show (toolbar);
+
+ app_mode = ephy_embed_shell_get_mode (ephy_embed_shell_get_default ());
+ if (app_mode == EPHY_EMBED_SHELL_MODE_INCOGNITO)
+ gtk_style_context_add_class (gtk_widget_get_style_context (toolbar), "incognito-mode");
+
+ action = gtk_action_group_get_action (priv->toolbar_action_group,
+ "NavigationBack");
+ g_signal_connect_swapped (action, "open-link",
+ G_CALLBACK (ephy_link_open), window);
+
+ action = gtk_action_group_get_action (priv->toolbar_action_group,
+ "NavigationForward");
+ g_signal_connect_swapped (action, "open-link",
+ G_CALLBACK (ephy_link_open), window);
+
+ action = gtk_action_group_get_action (priv->toolbar_action_group,
+ "FileNewTab");
+ g_signal_connect_swapped (action, "open-link",
+ G_CALLBACK (ephy_link_open), window);
+
+ action = gtk_action_group_get_action (priv->toolbar_action_group,
+ "Zoom");
+ g_signal_connect (action, "zoom-to-level",
+ G_CALLBACK (zoom_to_level_cb), window);
+
+ title_box = ephy_toolbar_get_title_box (EPHY_TOOLBAR (toolbar));
+ g_signal_connect (title_box, "lock-clicked",
+ G_CALLBACK (title_box_lock_clicked_cb), window);
+
+ return toolbar;
+}
+
+static EphyLocationController *
+setup_location_controller (EphyWindow *window,
+ EphyToolbar *toolbar)
+{
+ EphyLocationController *location_controller;
+
+ location_controller =
+ g_object_new (EPHY_TYPE_LOCATION_CONTROLLER,
+ "window", window,
+ "location-entry", ephy_toolbar_get_location_entry (toolbar),
+ "title-box", ephy_toolbar_get_title_box (toolbar),
+ NULL);
+ g_signal_connect (location_controller, "notify::address",
+ G_CALLBACK (sync_user_input_cb), window);
+ g_signal_connect_swapped (location_controller, "open-link",
+ G_CALLBACK (ephy_link_open), window);
+ g_signal_connect (location_controller, "lock-clicked",
+ G_CALLBACK (location_controller_lock_clicked_cb), window);
+
+ return location_controller;
+}
+
+static const char* disabled_actions_for_app_mode[] = { "FileOpen",
+ "FileNewWindow",
+ "FileNewWindowIncognito",
+ "FileSaveAs",
+ "FileSaveAsApplication",
+ "ViewEncoding",
+ "ViewPageSource",
+ "FileBookmarkPage",
+ "EditBookmarks",
+ "EditHistory",
+ "EditPreferences"};
+
+static gboolean
+_gtk_css_provider_load_from_resource (GtkCssProvider* provider,
+ const char *resource_path,
+ GError **error)
+{
+ GBytes *data;
+ gboolean res;
+
+ g_return_val_if_fail (GTK_IS_CSS_PROVIDER (provider), FALSE);
+ g_return_val_if_fail (resource_path != NULL, FALSE);
+
+ data = g_resources_lookup_data (resource_path, 0, error);
+ if (data == NULL)
+ return FALSE;
+
+ res = gtk_css_provider_load_from_data (provider,
+ g_bytes_get_data (data, NULL),
+ g_bytes_get_size (data),
+ error);
+ g_bytes_unref (data);
+
+ return res;
+}
+
+static const gchar* app_actions[] = {
+ "FileNewWindow",
+ "FileNewWindowIncognito",
+ "EditPreferences",
+ "EditBookmarks",
+ "EditHistory",
+ "FileQuit",
+ "HelpContents",
+ "HelpAbout"
+};
+
+static void
+ephy_window_toggle_visibility_for_app_menu (EphyWindow *window)
+{
+ const gchar *action_name;
+ gboolean shows_app_menu;
+ GtkSettings *settings;
+ GtkAction *action;
+ gint idx;
+
+ settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (window)));
+ g_object_get (settings,
+ "gtk-shell-shows-app-menu", &shows_app_menu,
+ NULL);
+
+ for (idx = 0; idx < G_N_ELEMENTS (app_actions); idx++) {
+ action_name = app_actions[idx];
+ action = gtk_action_group_get_action (window->priv->action_group, action_name);
+
+ gtk_action_set_visible (action, !shows_app_menu);
+ }
+}
+
+static GObject *
+ephy_window_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_params)
+{
+ GObject *object;
+ EphyWindow *window;
+ EphyWindowPrivate *priv;
+ GtkSettings *settings;
+ GtkAction *action;
+ GtkActionGroup *toolbar_action_group;
+ GError *error = NULL;
+ guint settings_connection;
+ GtkCssProvider *css_provider;
+ int i;
+ EphyEmbedShellMode mode;
+ EphyWindowChrome chrome = EPHY_WINDOW_CHROME_DEFAULT;
+
+ object = G_OBJECT_CLASS (ephy_window_parent_class)->constructor
+ (type, n_construct_properties, construct_params);
+
+ window = EPHY_WINDOW (object);
+
+ priv = window->priv;
+
+ ephy_gui_ensure_window_group (GTK_WINDOW (window));
+
+ /* initialize the listener for the key theme
+ * FIXME: Need to handle multi-head and migration.
+ */
+ settings = gtk_settings_get_default ();
+ settings_connection = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (settings),
+ SETTINGS_CONNECTION_DATA_KEY));
+ if (settings_connection == 0)
+ {
+ settings_connection =
+ g_signal_connect (settings, "notify::gtk-key-theme-name",
+ G_CALLBACK (settings_changed_cb), NULL);
+ g_object_set_data (G_OBJECT (settings), SETTINGS_CONNECTION_DATA_KEY,
+ GUINT_TO_POINTER (settings_connection));
+
+ }
+
+ settings_change_notify (settings, window);
+
+ /* Setup the UI manager and connect verbs */
+ setup_ui_manager (window);
+ setup_tab_accels (window);
+
+ priv->notebook = setup_notebook (window);
+
+ /* Now load the UI definition (needed by EphyToolbar). */
+ gtk_ui_manager_add_ui_from_resource (priv->manager,
+ "/org/gnome/epiphany/epiphany-ui.xml",
+ &error);
+ if (error != NULL)
+ {
+ g_warning ("Could not merge epiphany-ui.xml: %s", error->message);
+ g_error_free (error);
+ error = NULL;
+ }
+
+ /* Setup the toolbar. */
+ priv->toolbar = setup_toolbar (window);
+ priv->location_controller = setup_location_controller (window, EPHY_TOOLBAR (priv->toolbar));
+ gtk_box_pack_start (GTK_BOX (priv->main_vbox),
+ GTK_WIDGET (priv->notebook),
+ TRUE, TRUE, 0);
+ gtk_widget_show (GTK_WIDGET (priv->notebook));
+
+ priv->downloads_box = setup_downloads_box (window);
+ gtk_box_pack_start (GTK_BOX (priv->main_vbox),
+ GTK_WIDGET (priv->downloads_box), FALSE, FALSE, 0);
+ action = gtk_action_group_get_action (window->priv->action_group,
+ "ViewDownloadsBar");
+
+ g_object_bind_property (action, "active",
+ priv->downloads_box, "visible",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
+
+ /* Attach the CSS provider to the window. */
+ css_provider = gtk_css_provider_new ();
+ _gtk_css_provider_load_from_resource (css_provider,
+ "/org/gnome/epiphany/epiphany.css",
+ &error);
+ if (error == NULL)
+ {
+ gtk_style_context_add_provider_for_screen (gtk_widget_get_screen (GTK_WIDGET (window)),
+ GTK_STYLE_PROVIDER (css_provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ }
+ else
+ {
+ g_warning ("Could not attach css style: %s", error->message);
+ g_error_free (error);
+ }
+
+ g_object_unref (css_provider);
+
+ /* Initialize the menus */
+ priv->enc_menu = ephy_encoding_menu_new (window);
+
+ ephy_bookmarks_ui_attach_window (window);
+
+ /* other notifiers */
+ action = gtk_action_group_get_action (window->priv->action_group,
+ "BrowseWithCaret");
+
+ g_settings_bind (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_ENABLE_CARET_BROWSING,
+ action, "active",
+ G_SETTINGS_BIND_GET);
+
+ g_signal_connect (EPHY_SETTINGS_WEB,
+ "changed::" EPHY_PREFS_WEB_ENABLE_POPUPS,
+ G_CALLBACK (allow_popups_notifier), window);
+
+ /* Disable actions not needed for popup mode. */
+ toolbar_action_group = priv->toolbar_action_group;
+ action = gtk_action_group_get_action (toolbar_action_group, "FileNewTab");
+ ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME,
+ priv->is_popup);
+
+ action = gtk_action_group_get_action (priv->popups_action_group, "OpenLinkInNewTab");
+ ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME,
+ priv->is_popup);
+
+ /* Disabled actions not needed for application mode. */
+ mode = ephy_embed_shell_get_mode (ephy_embed_shell_get_default ());
+ if (mode == EPHY_EMBED_SHELL_MODE_APPLICATION)
+ {
+ g_object_set(priv->location_controller, "editable", FALSE, NULL);
+
+ /* We don't need to show the page menu in web application mode. */
+ action = gtk_action_group_get_action (toolbar_action_group, "PageMenu");
+ ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, TRUE);
+ gtk_action_set_visible (action, FALSE);
+
+ action = gtk_action_group_get_action (toolbar_action_group, "FileNewTab");
+ ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME,
+ TRUE);
+ gtk_action_set_visible (action, FALSE);
+
+ action = gtk_action_group_get_action (priv->popups_action_group, "ContextBookmarkPage");
+ ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, TRUE);
+ gtk_action_set_visible (action, FALSE);
+
+ for (i = 0; i < G_N_ELEMENTS (disabled_actions_for_app_mode); i++)
+ {
+ action = gtk_action_group_get_action (priv->action_group,
+ disabled_actions_for_app_mode[i]);
+ ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, TRUE);
+ gtk_action_set_visible (action, FALSE);
+ }
+ chrome &= ~(EPHY_WINDOW_CHROME_MENU | EPHY_WINDOW_CHROME_TABSBAR);
+ }
+
+ /* We never want the menubar shown, we merge the app menu into
+ * our super menu manually when running outside the Shell. */
+ gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (window), FALSE);
+
+ ephy_window_toggle_visibility_for_app_menu (window);
+ priv->app_menu_visibility_handler = g_signal_connect_swapped (gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (window))),
+ "notify::gtk-shell-shows-app-menu",
+ G_CALLBACK (ephy_window_toggle_visibility_for_app_menu), window);
+
+ /* ensure the UI is updated */
+ gtk_ui_manager_ensure_update (priv->manager);
+
+ init_menu_updaters (window);
+
+ ephy_window_set_chrome (window, chrome);
+
+ return object;
+}
+
+static void
+ephy_window_show (GtkWidget *widget)
+{
+ EphyWindow *window = EPHY_WINDOW(widget);
+ EphyWindowPrivate *priv = window->priv;
+
+ if (!priv->has_size)
+ {
+ EphyEmbed *embed;
+ int flags = 0;
+
+ embed = priv->active_embed;
+ g_return_if_fail (EPHY_IS_EMBED (embed));
+
+ if (!priv->is_popup)
+ flags = EPHY_INITIAL_STATE_WINDOW_SAVE_SIZE;
+
+ ephy_initial_state_add_window (widget, "main_window", 600, 500,
+ TRUE, flags);
+ priv->has_size = TRUE;
+ }
+
+ GTK_WIDGET_CLASS (ephy_window_parent_class)->show (widget);
+}
+
+static void
+ephy_window_class_init (EphyWindowClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ object_class->constructor = ephy_window_constructor;
+ object_class->dispose = ephy_window_dispose;
+ object_class->finalize = ephy_window_finalize;
+ object_class->get_property = ephy_window_get_property;
+ object_class->set_property = ephy_window_set_property;
+
+ widget_class->show = ephy_window_show;
+ widget_class->key_press_event = ephy_window_key_press_event;
+ widget_class->window_state_event = ephy_window_state_event;
+ widget_class->delete_event = ephy_window_delete_event;
+
+ g_object_class_override_property (object_class,
+ PROP_ACTIVE_CHILD,
+ "active-child");
+
+ g_object_class_override_property (object_class,
+ PROP_SINGLE_TAB_MODE,
+ "is-popup");
+
+ g_object_class_install_property (object_class,
+ PROP_CHROME,
+ g_param_spec_flags ("chrome",
+ NULL,
+ NULL,
+ EPHY_TYPE_WINDOW_CHROME,
+ EPHY_WINDOW_CHROME_DEFAULT,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
+
+ g_type_class_add_private (object_class, sizeof (EphyWindowPrivate));
+}
+
+static void
+ephy_window_init (EphyWindow *window)
+{
+ LOG ("EphyWindow initialising %p", window);
+
+ window->priv = EPHY_WINDOW_GET_PRIVATE (window);
+}
+
+/**
+ * ephy_window_new:
+ *
+ * Equivalent to g_object_new() but returns an #EphyWindow so you don't have
+ * to cast it.
+ *
+ * Return value: a new #EphyWindow
+ **/
+EphyWindow *
+ephy_window_new (void)
+{
+ return g_object_new (EPHY_TYPE_WINDOW,
+ "application", GTK_APPLICATION (ephy_shell_get_default ()),
+ "icon-name", "web-browser",
+ NULL);
+}
+
+/**
+ * ephy_window_get_ui_manager:
+ * @window: an #EphyWindow
+ *
+ * Returns this window's UI manager.
+ *
+ * Return value: (transfer none): an #GtkUIManager
+ **/
+GtkUIManager *
+ephy_window_get_ui_manager (EphyWindow *window)
+{
+ g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL);
+
+ return window->priv->manager;
+}
+
+/**
+ * ephy_window_get_notebook:
+ * @window: an #EphyWindow
+ *
+ * Returns the #GtkNotebook used by this window.
+ *
+ * Return value: (transfer none): the @window's #GtkNotebook
+ **/
+GtkWidget *
+ephy_window_get_notebook (EphyWindow *window)
+{
+ g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL);
+
+ return GTK_WIDGET (window->priv->notebook);
+}
+
+/**
+ * ephy_window_get_find_toolbar:
+ * @window: an #EphyWindow
+ *
+ * Returns the #EphyFindToolbar used by this window.
+ *
+ * Return value: (transfer none): the @window's #EphyFindToolbar
+ **/
+GtkWidget *
+ephy_window_get_current_find_toolbar (EphyWindow *window)
+{
+ g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL);
+
+ return GTK_WIDGET (ephy_embed_get_find_toolbar (window->priv->active_embed));
+}
+
+/**
+ * ephy_window_load_url:
+ * @window: a #EphyWindow
+ * @url: the url to load
+ *
+ * Loads a new url in the active tab of @window.
+ * Unlike ephy_web_view_load_url(), this function activates
+ * the embed.
+ *
+ **/
+void
+ephy_window_load_url (EphyWindow *window,
+ const char *url)
+{
+ g_return_if_fail (url != NULL);
+
+ ephy_link_open (EPHY_LINK (window), url, NULL, 0);
+}
+
+/**
+ * ephy_window_activate_location:
+ * @window: an #EphyWindow
+ *
+ * Activates the location entry on @window's toolbar.
+ **/
+void
+ephy_window_activate_location (EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+ GtkWidget *entry;
+
+ if (!(priv->chrome & EPHY_WINDOW_CHROME_LOCATION))
+ return;
+
+ ephy_title_box_set_mode (ephy_toolbar_get_title_box (EPHY_TOOLBAR (priv->toolbar)),
+ EPHY_TITLE_BOX_MODE_LOCATION_ENTRY);
+
+ entry = ephy_toolbar_get_location_entry (EPHY_TOOLBAR (priv->toolbar));
+ ephy_location_entry_activate (EPHY_LOCATION_ENTRY (entry));
+}
+
+/**
+ * ephy_window_set_zoom:
+ * @window: an #EphyWindow
+ * @zoom: the desired zoom level
+ *
+ * Sets the zoom on @window's active #EphyEmbed. A @zoom of 1.0 corresponds to
+ * 100% zoom (normal size).
+ **/
+void
+ephy_window_set_zoom (EphyWindow *window,
+ float zoom)
+{
+ EphyEmbed *embed;
+ double current_zoom = 1.0;
+ WebKitWebView *web_view;
+
+ g_return_if_fail (EPHY_IS_WINDOW (window));
+
+ embed = window->priv->active_embed;
+ g_return_if_fail (embed != NULL);
+
+ web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+
+ current_zoom = webkit_web_view_get_zoom_level (web_view);
+
+ if (zoom == ZOOM_IN)
+ {
+ zoom = ephy_zoom_get_changed_zoom_level (current_zoom, 1);
+ }
+ else if (zoom == ZOOM_OUT)
+ {
+ zoom = ephy_zoom_get_changed_zoom_level (current_zoom, -1);
+ }
+
+ if (zoom != current_zoom)
+ {
+ webkit_web_view_set_zoom_level (web_view, zoom);
+ }
+}
+
+static void
+ephy_window_view_popup_windows_cb (GtkAction *action,
+ EphyWindow *window)
+{
+ EphyEmbed *embed;
+ gboolean allow;
+
+ g_return_if_fail (EPHY_IS_WINDOW (window));
+
+ embed = window->priv->active_embed;
+ g_return_if_fail (EPHY_IS_EMBED (embed));
+
+ if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
+ {
+ allow = TRUE;
+ }
+ else
+ {
+ allow = FALSE;
+ }
+
+ g_object_set (G_OBJECT (ephy_embed_get_web_view (embed)), "popups-allowed", allow, NULL);
+}
+
+/**
+ * ephy_window_get_context_event:
+ * @window: an #EphyWindow
+ *
+ * Returns the #EphyEmbedEvent for the current context menu.
+ * Use this to get the event from the action callback.
+ *
+ * Return value: (transfer none): an #EphyEmbedEvent, or %NULL
+ **/
+EphyEmbedEvent *
+ephy_window_get_context_event (EphyWindow *window)
+{
+ g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL);
+
+ return window->priv->context_event;
+}
+
+/**
+ * ephy_window_get_location:
+ * @window: an #EphyWindow widget
+ *
+ * Gets the current address according to @window's #EphyLocationController.
+ *
+ * Returns: current @window address
+ **/
+const char *
+ephy_window_get_location (EphyWindow *window)
+{
+ EphyWindowPrivate *priv = window->priv;
+ return ephy_location_controller_get_address (priv->location_controller);
+}
+
+/**
+ * ephy_window_set_location:
+ * @window: an #EphyWindow widget
+ * @address: new address
+ *
+ * Sets the internal #EphyLocationController address to @address.
+ **/
+void
+ephy_window_set_location (EphyWindow *window,
+ const char *address)
+{
+ EphyWindowPrivate *priv = window->priv;
+
+ if (priv->updating_address) return;
+
+ priv->updating_address = TRUE;
+ ephy_location_controller_set_address (priv->location_controller, address);
+ priv->updating_address = FALSE;
+}
+
+/**
+ * ephy_window_get_toolbar_action_group:
+ * @window: an #EphyWindow
+ *
+ * Returns the toolbar #GtkActionGroup for this @window
+ *
+ * Returns: (transfer none): the #GtkActionGroup for this @window's
+ * toolbar actions
+ **/
+GtkActionGroup *
+ephy_window_get_toolbar_action_group (EphyWindow *window)
+{
+ g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL);
+
+ return window->priv->toolbar_action_group;
+}
+
+/**
+ * ephy_window_get_location_controller:
+ * @window: an #EphyWindow
+ *
+ * Returns the @window #EphyLocationController
+ *
+ * Returns: (transfer none): the @window #EphyLocationController
+ **/
+EphyLocationController *
+ephy_window_get_location_controller (EphyWindow *window)
+{
+ g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL);
+
+ return window->priv->location_controller;
+}
+
+/**
+ * ephy_window_is_on_current_workspace:
+ * @window: an #EphyWindow
+ *
+ * Returns whether @window is on the current workspace
+ *
+ * Returns: %TRUE if the window is on the current workspace, %FALSE otherwise
+ **/
+gboolean
+ephy_window_is_on_current_workspace (EphyWindow *window)
+{
+ GdkWindow *gdk_window = NULL;
+ WnckWorkspace *workspace = NULL;
+ WnckWindow *wnck_window = NULL;
+
+ if (!gtk_widget_get_realized (GTK_WIDGET (window)))
+ return TRUE;
+
+ gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
+
+ if(!GDK_IS_X11_WINDOW (gdk_window))
+ return TRUE;
+
+ workspace = wnck_screen_get_active_workspace (wnck_screen_get_default ());
+
+ /* From WNCK docs:
+ * "May return NULL sometimes, if libwnck is in a weird state due to
+ * the asynchronous nature of the interaction with the window manager."
+ * In such a case we cannot really check, so assume we are.
+ */
+ if (!workspace)
+ return TRUE;
+
+ wnck_window = wnck_window_get (GDK_WINDOW_XID (gdk_window));
+
+ return wnck_window_is_on_workspace (wnck_window, workspace);
+}
+
+typedef struct {
+ EphyWindow *window;
+ GCancellable *cancellable;
+
+ guint embeds_to_check;
+ EphyEmbed *modified_embed;
+} ModifiedFormsData;
+
+static void
+modified_forms_data_free (ModifiedFormsData *data)
+{
+ g_object_unref (data->cancellable);
+
+ g_slice_free (ModifiedFormsData, data);
+}
+
+static void
+continue_window_close_after_modified_forms_check (ModifiedFormsData *data)
+{
+ gboolean should_close;
+
+ data->window->priv->checking_modified_forms = FALSE;
+
+ if (data->modified_embed)
+ {
+ /* jump to the first tab with modified forms */
+ impl_set_active_child (EPHY_EMBED_CONTAINER (data->window),
+ data->modified_embed);
+ if (!confirm_close_with_modified_forms (data->window))
+ return;
+ }
+
+ data->window->priv->force_close = TRUE;
+ should_close = ephy_window_close (data->window);
+ data->window->priv->force_close = FALSE;
+ if (should_close)
+ gtk_widget_destroy (GTK_WIDGET (data->window));
+}
+
+static void
+has_modified_forms_cb (EphyWebView *view,
+ GAsyncResult *result,
+ ModifiedFormsData *data)
+{
+ gboolean has_modified_forms;
+
+ data->embeds_to_check--;
+ has_modified_forms = ephy_web_view_has_modified_forms_finish (view, result, NULL);
+ if (has_modified_forms)
+ {
+ /* Cancel all others */
+ g_cancellable_cancel (data->cancellable);
+ data->modified_embed = EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (view);
+ }
+
+ if (data->embeds_to_check > 0)
+ return;
+
+ continue_window_close_after_modified_forms_check (data);
+ modified_forms_data_free (data);
+}
+
+static void
+ephy_window_check_modified_forms (EphyWindow *window)
+{
+ GList *tabs, *l;
+ ModifiedFormsData *data;
+
+ window->priv->checking_modified_forms = TRUE;
+
+ data = g_slice_new0 (ModifiedFormsData);
+ data->window = window;
+ data->cancellable = g_cancellable_new ();
+ data->embeds_to_check = gtk_notebook_get_n_pages (window->priv->notebook);
+
+ tabs = impl_get_children (EPHY_EMBED_CONTAINER (window));
+ for (l = tabs; l != NULL; l = l->next)
+ {
+ EphyEmbed *embed = (EphyEmbed *) l->data;
+
+ ephy_web_view_has_modified_forms (ephy_embed_get_web_view (embed),
+ data->cancellable,
+ (GAsyncReadyCallback)has_modified_forms_cb,
+ data);
+ }
+ g_list_free (tabs);
+}
+
+/**
+ * ephy_window_close:
+ * @window: an #EphyWindow
+ *
+ * Try to close the window. The window might refuse to close
+ * if there are ongoing download operations or unsubmitted
+ * modifed forms.
+ *
+ * Returns: %TRUE if the window is closed, or %FALSE otherwise
+ **/
+gboolean
+ephy_window_close (EphyWindow *window)
+{
+ /* We ignore the delete_event if the disable_quit lockdown has been set
+ */
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_QUIT)) return FALSE;
+
+ if (window->priv->checking_modified_forms) {
+ /* stop window close */
+ return FALSE;
+ }
+
+ if (!window->priv->force_close &&
+ g_settings_get_boolean (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_WARN_ON_CLOSE_UNSUBMITTED_DATA) &&
+ gtk_notebook_get_n_pages (window->priv->notebook) > 0)
+ {
+ ephy_window_check_modified_forms (window);
+ /* stop window close */
+ return FALSE;
+ }
+
+ if (window_has_ongoing_downloads (window) && confirm_close_with_downloads (window) == FALSE)
+ {
+ /* stop window close */
+ return FALSE;
+ }
+
+ /* If this is the last window, save its state in the session. */
+ if (ephy_shell_get_n_windows (ephy_shell_get_default ()) == 1)
+ {
+ ephy_session_close (ephy_shell_get_session (ephy_shell_get_default ()));
+ }
+
+ /* See bug #114689 */
+ gtk_widget_hide (GTK_WIDGET (window));
+
+ return TRUE;
+}
+
+EphyWindowChrome
+ephy_window_get_chrome (EphyWindow *window)
+{
+ g_return_val_if_fail (EPHY_IS_WINDOW (window), EPHY_WINDOW_CHROME_DEFAULT);
+
+ return window->priv->chrome;
+}
=== removed file '.pc/ubuntu_titlebars.patch/src/ephy-window.c'
--- .pc/ubuntu_titlebars.patch/src/ephy-window.c 2015-06-02 10:42:34 +0000
+++ .pc/ubuntu_titlebars.patch/src/ephy-window.c 1970-01-01 00:00:00 +0000
@@ -1,4026 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright © 2000, 2001, 2002, 2003, 2004 Marco Pesenti Gritti
- * Copyright © 2003, 2004 Christian Persch
- * Copyright © 2011 Igalia S.L.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "ephy-window.h"
-
-#include "ephy-action-helper.h"
-#include "ephy-bookmarks-ui.h"
-#include "ephy-certificate-popover.h"
-#include "ephy-combined-stop-reload-action.h"
-#include "ephy-debug.h"
-#include "ephy-download-widget.h"
-#include "ephy-embed-container.h"
-#include "ephy-embed-prefs.h"
-#include "ephy-embed-shell.h"
-#include "ephy-embed-type-builtins.h"
-#include "ephy-embed-utils.h"
-#include "ephy-encoding-menu.h"
-#include "ephy-file-helpers.h"
-#include "ephy-find-toolbar.h"
-#include "ephy-gui.h"
-#include "ephy-home-action.h"
-#include "ephy-initial-state.h"
-#include "ephy-link.h"
-#include "ephy-location-entry.h"
-#include "ephy-navigation-history-action.h"
-#include "ephy-notebook.h"
-#include "ephy-prefs.h"
-#include "ephy-private.h"
-#include "ephy-session.h"
-#include "ephy-settings.h"
-#include "ephy-shell.h"
-#include "ephy-title-box.h"
-#include "ephy-toolbar.h"
-#include "ephy-type-builtins.h"
-#include "ephy-web-view.h"
-#include "ephy-zoom-action.h"
-#include "ephy-zoom.h"
-#include "popup-commands.h"
-#include "window-commands.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#define WNCK_I_KNOW_THIS_IS_UNSTABLE
-#include
-
-#include
-
-#ifdef HAVE_X11_XF86KEYSYM_H
-#include
-#endif
-
-/**
- * SECTION:ephy-window
- * @short_description: Epiphany's main #GtkWindow widget
- *
- * #EphyWindow is Epiphany's main widget.
- */
-
-static void ephy_window_view_popup_windows_cb (GtkAction *action,
- EphyWindow *window);
-
-static const GtkActionEntry ephy_menu_entries [] = {
-
- /* Toplevel */
-
- { "Bookmarks", NULL, N_("_Bookmarks") },
- { "PopupAction", NULL, "" },
- { "PagePopupAction", NULL, "" },
- { "NotebookPopupAction", NULL, "" },
-
- /* File actions. */
-
- { "FileNewWindow", NULL, N_("_New Window"), "N", NULL,
- G_CALLBACK (window_cmd_file_new_window) },
- { "FileNewWindowIncognito", NULL, N_("New _Incognito Window"), "N", NULL,
- G_CALLBACK (window_cmd_file_new_incognito_window) },
- { "FileOpen", NULL, N_("_Open…"), "O", NULL,
- G_CALLBACK (window_cmd_file_open) },
- { "FileSaveAs", NULL, N_("Save _As…"), "S", NULL,
- G_CALLBACK (window_cmd_file_save_as) },
- { "FileSaveAsApplication", NULL, N_("Save As _Web Application…"), "A", NULL,
- G_CALLBACK (window_cmd_file_save_as_application) },
- { "FilePrint", NULL, N_("_Print…"), "P", NULL,
- G_CALLBACK (window_cmd_file_print) },
- { "FileSendTo", NULL, N_("S_end Link by Email…"), NULL, NULL,
- G_CALLBACK (window_cmd_file_send_to) },
- { "FileCloseTab", NULL, N_("_Close"), "W", NULL,
- G_CALLBACK (window_cmd_file_close_window) },
- { "FileQuit", NULL, N_("_Quit"), "Q", NULL,
- G_CALLBACK (window_cmd_file_quit) },
-
- /* Edit actions. */
-
- { "EditUndo", NULL, N_("_Undo"), "Z", NULL,
- G_CALLBACK (window_cmd_edit_undo) },
- { "EditRedo", NULL, N_("Re_do"), "Z", NULL,
- G_CALLBACK (window_cmd_edit_redo) },
- { "EditCut", NULL, N_("Cu_t"), "X", NULL,
- G_CALLBACK (window_cmd_edit_cut) },
- { "EditCopy", NULL, N_("_Copy"), "C", NULL,
- G_CALLBACK (window_cmd_edit_copy) },
- { "EditPaste", NULL, N_("_Paste"), "V", NULL,
- G_CALLBACK (window_cmd_edit_paste) },
- { "EditDelete", NULL, NULL, NULL, NULL,
- G_CALLBACK (window_cmd_edit_delete) },
- { "EditSelectAll", NULL, N_("Select _All"), "A", NULL,
- G_CALLBACK (window_cmd_edit_select_all) },
- { "EditFind", NULL, N_("_Find…"), "F", NULL,
- G_CALLBACK (window_cmd_edit_find) },
- { "EditFindNext", NULL, N_("Find Ne_xt"), "G", NULL,
- G_CALLBACK (window_cmd_edit_find_next) },
- { "EditFindPrev", NULL, N_("Find Pre_vious"), "G", NULL,
- G_CALLBACK (window_cmd_edit_find_prev) },
- { "EditBookmarks", NULL, N_("Edit _Bookmarks"), "B", NULL,
- G_CALLBACK (window_cmd_edit_bookmarks) },
- { "EditHistory", NULL, N_("_History"), "H", NULL,
- G_CALLBACK (window_cmd_edit_history) },
- { "EditPreferences", NULL, N_("Pr_eferences"), "e", NULL,
- G_CALLBACK (window_cmd_edit_preferences) },
-
- /* View actions. */
-
- { "ViewStop", NULL, N_("_Stop"), "Escape", NULL,
- G_CALLBACK (window_cmd_view_stop) },
- { "ViewAlwaysStop", NULL, N_("_Stop"), "Escape",
- NULL, G_CALLBACK (window_cmd_view_stop) },
- { "ViewReload", NULL, N_("_Reload"), "R", NULL,
- G_CALLBACK (window_cmd_view_reload) },
- { "ViewZoomIn", NULL, N_("Zoom _In"), "plus", NULL,
- G_CALLBACK (window_cmd_view_zoom_in) },
- { "ViewZoomOut", NULL, N_("Zoom O_ut"), "minus", NULL,
- G_CALLBACK (window_cmd_view_zoom_out) },
- { "ViewZoomNormal", NULL, N_("_Normal Size"), "0", NULL,
- G_CALLBACK (window_cmd_view_zoom_normal) },
- { "ViewEncoding", NULL, N_("Text _Encoding"), NULL, NULL, NULL },
- { "ViewPageSource", NULL, N_("_Page Source"), "U", NULL,
- G_CALLBACK (window_cmd_view_page_source) },
-
- /* Bookmarks actions. */
-
- { "FileBookmarkPage", NULL, N_("_Add Bookmark…"), "D", NULL,
- G_CALLBACK (window_cmd_file_bookmark_page) },
-
- /* Go actions. */
-
- { "GoLocation", NULL, N_("_Location…"), "L", NULL,
- G_CALLBACK (window_cmd_go_location) },
-
- /* Tabs actions. */
-
- { "TabsPrevious", NULL, N_("_Previous Tab"), "Page_Up", NULL,
- G_CALLBACK (window_cmd_tabs_previous) },
- { "TabsNext", NULL, N_("_Next Tab"), "Page_Down", NULL,
- G_CALLBACK (window_cmd_tabs_next) },
- { "TabsMoveLeft", NULL, N_("Move Tab _Left"), "Page_Up", NULL,
- G_CALLBACK (window_cmd_tabs_move_left) },
- { "TabsMoveRight", NULL, N_("Move Tab _Right"), "Page_Down", NULL,
- G_CALLBACK (window_cmd_tabs_move_right) },
- { "TabsDetach", NULL, N_("_Detach Tab"), NULL, NULL,
- G_CALLBACK (window_cmd_tabs_detach) },
-
- /* Help. */
-
- { "HelpContents", NULL, N_("_Help"), NULL, NULL,
- G_CALLBACK (window_cmd_help_contents) },
- { "HelpAbout", NULL, N_("_About"), NULL, NULL,
- G_CALLBACK (window_cmd_help_about) }
-};
-
-static const GtkToggleActionEntry ephy_menu_toggle_entries [] =
-{
- /* View actions. */
-
- { "ViewDownloadsBar", NULL, N_("_Downloads Bar"), NULL, NULL,
- NULL, FALSE },
-
- { "ViewFullscreen", NULL, N_("_Fullscreen"), "F11", NULL,
- G_CALLBACK (window_cmd_view_fullscreen), FALSE },
- { "ViewPopupWindows", NULL, N_("Popup _Windows"), NULL, NULL,
- G_CALLBACK (ephy_window_view_popup_windows_cb), FALSE },
- { "BrowseWithCaret", NULL, N_("Selection Caret"), "F7", NULL,
- G_CALLBACK (window_cmd_browse_with_caret), FALSE }
-};
-
-static const GtkActionEntry ephy_popups_entries [] = {
- /* Document. */
-
- { "ContextBookmarkPage", NULL, N_("Add Boo_kmark…"), "D", NULL,
- G_CALLBACK (window_cmd_file_bookmark_page) },
-
- /* Links. */
-
- { "OpenLinkInNewWindow", NULL, N_("Open Link in New _Window"), NULL, NULL,
- G_CALLBACK (popup_cmd_link_in_new_window) },
- { "OpenLinkInNewTab", NULL, N_("Open Link in New _Tab"), NULL, NULL,
- G_CALLBACK (popup_cmd_link_in_new_tab) },
- { "DownloadLinkAs", NULL, N_("_Save Link As…"), NULL, NULL,
- G_CALLBACK (popup_cmd_download_link_as) },
- { "CopyLinkAddress", NULL, N_("_Copy Link Address"), NULL,
- NULL, G_CALLBACK (popup_cmd_copy_link_address) },
- { "CopyEmailAddress", NULL, N_("_Copy E-mail Address"), NULL,
- NULL, G_CALLBACK (popup_cmd_copy_link_address) },
-
- /* Images. */
-
- { "ViewImage", NULL, N_("View _Image in New Tab"), NULL,
- NULL, G_CALLBACK (popup_cmd_view_image_in_new_tab) },
- { "CopyImageLocation", NULL, N_("Copy I_mage Address"), NULL,
- NULL, G_CALLBACK (popup_cmd_copy_image_location) },
- { "SaveImageAs", NULL, N_("_Save Image As…"), NULL,
- NULL, G_CALLBACK (popup_cmd_save_image_as) },
- { "SetImageAsBackground", NULL, N_("Set as _Wallpaper"), NULL,
- NULL, G_CALLBACK (popup_cmd_set_image_as_background) },
-
- /* Video. */
-
- { "OpenVideoInNewWindow", NULL, N_("Open Video in New _Window"), NULL, NULL,
- G_CALLBACK (popup_cmd_media_in_new_window) },
- { "OpenVideoInNewTab", NULL, N_("Open Video in New _Tab"), NULL, NULL,
- G_CALLBACK (popup_cmd_media_in_new_tab) },
- { "SaveVideoAs", NULL, N_("_Save Video As…"), NULL,
- NULL, G_CALLBACK (popup_cmd_save_media_as) },
- { "CopyVideoLocation", NULL, N_("_Copy Video Address"), NULL,
- NULL, G_CALLBACK (popup_cmd_copy_media_location) },
-
- /* Audio. */
-
- { "OpenAudioInNewWindow", NULL, N_("Open Audio in New _Window"), NULL, NULL,
- G_CALLBACK (popup_cmd_media_in_new_window) },
- { "OpenAudioInNewTab", NULL, N_("Open Audio in New _Tab"), NULL, NULL,
- G_CALLBACK (popup_cmd_media_in_new_tab) },
- { "SaveAudioAs", NULL, N_("_Save Audio As…"), NULL,
- NULL, G_CALLBACK (popup_cmd_save_media_as) },
- { "CopyAudioLocation", NULL, N_("_Copy Audio Address"), NULL,
- NULL, G_CALLBACK (popup_cmd_copy_media_location) },
-};
-
-static const struct
-{
- guint keyval;
- GdkModifierType modifier;
- const gchar *action;
- gboolean fromToolbar;
-} extra_keybindings [] = {
- /* FIXME: PageMenu should have its accel without being in the
- * extra keybindings, but does not seem to work for some
- * reason. */
- { GDK_KEY_F10, 0, "PageMenu", TRUE },
- { GDK_KEY_Home, GDK_MOD1_MASK, "FileHome", TRUE },
- /* FIXME: these are not in any menu for now, so add them here. */
- { GDK_KEY_F11, 0, "ViewFullscreen", FALSE },
- { GDK_KEY_plus, GDK_CONTROL_MASK, "ViewZoomIn", FALSE },
- { GDK_KEY_minus, GDK_CONTROL_MASK, "ViewZoomOut", FALSE },
- { GDK_KEY_0, GDK_CONTROL_MASK, "ViewZoomNormal", FALSE },
- { GDK_KEY_g, GDK_CONTROL_MASK, "EditFindNext", FALSE },
- { GDK_KEY_G, GDK_CONTROL_MASK |
- GDK_SHIFT_MASK, "EditFindPrev", FALSE },
-
- { GDK_KEY_s, GDK_CONTROL_MASK, "FileSaveAs", FALSE },
- { GDK_KEY_r, GDK_CONTROL_MASK, "ViewReload", FALSE },
- { GDK_KEY_R, GDK_CONTROL_MASK, "ViewReload", FALSE },
- { GDK_KEY_R, GDK_CONTROL_MASK |
- GDK_SHIFT_MASK, "ViewReload", FALSE },
- /* Tab navigation */
- { GDK_KEY_Page_Up, GDK_CONTROL_MASK, "TabsPrevious", FALSE },
- { GDK_KEY_Page_Down, GDK_CONTROL_MASK, "TabsNext", FALSE },
- { GDK_KEY_Page_Up, GDK_CONTROL_MASK |
- GDK_SHIFT_MASK, "TabsMoveLeft", FALSE },
- { GDK_KEY_Page_Down, GDK_CONTROL_MASK |
- GDK_SHIFT_MASK, "TabsMoveRight", FALSE },
- /* Go */
- { GDK_KEY_l, GDK_CONTROL_MASK, "GoLocation", FALSE },
- { GDK_KEY_F6, 0, "GoLocation", FALSE },
- /* Support all the MSIE tricks as well ;) */
- { GDK_KEY_F5, 0, "ViewReload", FALSE },
- { GDK_KEY_F5, GDK_CONTROL_MASK, "ViewReload", FALSE },
- { GDK_KEY_F5, GDK_SHIFT_MASK, "ViewReload", FALSE },
- { GDK_KEY_F5, GDK_CONTROL_MASK |
- GDK_SHIFT_MASK, "ViewReload", FALSE },
- { GDK_KEY_KP_Add, GDK_CONTROL_MASK, "ViewZoomIn", FALSE },
- { GDK_KEY_KP_Subtract, GDK_CONTROL_MASK, "ViewZoomOut", FALSE },
- { GDK_KEY_equal, GDK_CONTROL_MASK, "ViewZoomIn", FALSE },
- { GDK_KEY_KP_0, GDK_CONTROL_MASK, "ViewZoomNormal", FALSE },
- /* These keys are a bit strange: when pressed with no modifiers, they emit
- * KP_PageUp/Down Control; when pressed with Control+Shift they are KP_9/3,
- * when NumLock is on they are KP_9/3 and with NumLock and Control+Shift
- * They're KP_PageUp/Down again!
- */
- { GDK_KEY_Left, GDK_MOD1_MASK /*Alt*/, "NavigationBack", TRUE },
- { GDK_KEY_KP_Left, GDK_MOD1_MASK /*Alt*/, "NavigationBack", TRUE },
- { GDK_KEY_KP_4, GDK_MOD1_MASK /*Alt*/, "NavigationBack", TRUE },
- { GDK_KEY_Right, GDK_MOD1_MASK /*Alt*/, "NavigationForward", TRUE },
- { GDK_KEY_KP_Right, GDK_MOD1_MASK /*Alt*/, "NavigationForward", TRUE },
- { GDK_KEY_KP_6, GDK_MOD1_MASK /*Alt*/, "NavigationForward", TRUE },
- { GDK_KEY_KP_Page_Up, GDK_CONTROL_MASK, "TabsPrevious", FALSE },
- { GDK_KEY_KP_9, GDK_CONTROL_MASK, "TabsPrevious", FALSE },
- { GDK_KEY_KP_Page_Down, GDK_CONTROL_MASK, "TabsNext", FALSE },
- { GDK_KEY_KP_3, GDK_CONTROL_MASK, "TabsNext", FALSE },
- { GDK_KEY_KP_Page_Up, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "TabsMoveLeft", FALSE },
- { GDK_KEY_KP_9, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "TabsMoveLeft", FALSE },
- { GDK_KEY_KP_Page_Down, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "TabsMoveRight", FALSE },
- { GDK_KEY_KP_3, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "TabsMoveRight", FALSE },
-#ifdef HAVE_X11_XF86KEYSYM_H
- { XF86XK_Back, 0, "NavigationBack", TRUE },
- { XF86XK_Forward, 0, "NavigationForward", TRUE },
- { XF86XK_Go, 0, "GoLocation", FALSE },
- { XF86XK_OpenURL, 0, "GoLocation", FALSE },
- { XF86XK_AddFavorite, 0, "FileBookmarkPage", FALSE },
- { XF86XK_Refresh, 0, "ViewReload", FALSE },
- { XF86XK_Reload, 0, "ViewReload", FALSE },
- { XF86XK_Search, 0, "EditFind", FALSE },
- { XF86XK_Send, 0, "FileSendTo", FALSE },
- { XF86XK_Stop, 0, "ViewStop", FALSE },
- { XF86XK_ZoomIn, 0, "ViewZoomIn", FALSE },
- { XF86XK_ZoomOut, 0, "ViewZoomOut", FALSE }
- /* FIXME: what about ScrollUp, ScrollDown, Menu*, Option, LogOff, Save,.. any others? */
-#endif /* HAVE_X11_XF86KEYSYM_H */
-};
-
-#define SETTINGS_CONNECTION_DATA_KEY "EphyWindowSettings"
-
-#define EPHY_WINDOW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_WINDOW, EphyWindowPrivate))
-
-struct _EphyWindowPrivate
-{
- GtkWidget *main_vbox;
- GtkWidget *toolbar;
- GtkUIManager *manager;
- GtkActionGroup *action_group;
- GtkActionGroup *popups_action_group;
- GtkActionGroup *toolbar_action_group;
- GtkActionGroup *tab_accels_action_group;
- EphyEncodingMenu *enc_menu;
- GtkNotebook *notebook;
- EphyEmbed *active_embed;
- EphyWindowChrome chrome;
- EphyEmbedEvent *context_event;
- WebKitHitTestResult *hit_test_result;
- guint idle_worker;
- GtkWidget *downloads_box;
-
- EphyLocationController *location_controller;
-
- gulong app_menu_visibility_handler;
-
- guint closing : 1;
- guint has_size : 1;
- guint fullscreen_mode : 1;
- guint is_popup : 1;
- guint present_on_insert : 1;
- guint key_theme_is_emacs : 1;
- guint updating_address : 1;
- guint force_close : 1;
- guint checking_modified_forms : 1;
-};
-
-enum
-{
- PROP_0,
- PROP_ACTIVE_CHILD,
- PROP_CHROME,
- PROP_SINGLE_TAB_MODE
-};
-
-/* Make sure not to overlap with those in ephy-lockdown.c */
-enum
-{
- SENS_FLAG_CHROME = 1 << 0,
- SENS_FLAG_CONTEXT = 1 << 1,
- SENS_FLAG_DOCUMENT = 1 << 2,
- SENS_FLAG_LOADING = 1 << 3,
- SENS_FLAG_NAVIGATION = 1 << 4,
- SENS_FLAG_IS_BLANK = 1 << 5
-};
-
-static gint
-impl_add_child (EphyEmbedContainer *container,
- EphyEmbed *child,
- gint position,
- gboolean jump_to)
-{
- EphyWindow *window = EPHY_WINDOW (container);
-
- g_return_val_if_fail (!window->priv->is_popup ||
- gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->priv->notebook)) < 1, -1);
-
- return ephy_notebook_add_tab (EPHY_NOTEBOOK (window->priv->notebook),
- child, position, jump_to);
-}
-
-static void
-impl_set_active_child (EphyEmbedContainer *container,
- EphyEmbed *child)
-{
- int page;
- EphyWindow *window;
-
- window = EPHY_WINDOW (container);
-
- page = gtk_notebook_page_num
- (window->priv->notebook, GTK_WIDGET (child));
- gtk_notebook_set_current_page
- (window->priv->notebook, page);
-}
-
-static GtkWidget *
-construct_confirm_close_dialog (EphyWindow *window,
- const char *title,
- const char *info,
- const char *action)
-{
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (window),
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_CANCEL,
- "%s", title);
-
- gtk_message_dialog_format_secondary_text
- (GTK_MESSAGE_DIALOG (dialog), "%s", info);
-
- gtk_dialog_add_button (GTK_DIALOG (dialog),
- action, GTK_RESPONSE_ACCEPT);
-
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
-
- /* FIXME gtk_window_set_title (GTK_WINDOW (dialog), _("Close Document?")); */
- gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (window)),
- GTK_WINDOW (dialog));
-
- return dialog;
-}
-
-static gboolean
-confirm_close_with_modified_forms (EphyWindow *window)
-{
- GtkWidget *dialog;
- int response;
-
- dialog = construct_confirm_close_dialog (window,
- _("There are unsubmitted changes to form elements"),
- _("If you close the document anyway, "
- "you will lose that information."),
- _("Close _Document"));
- response = gtk_dialog_run (GTK_DIALOG (dialog));
-
- gtk_widget_destroy (dialog);
-
- return response == GTK_RESPONSE_ACCEPT;
-}
-
-static gboolean
-confirm_close_with_downloads (EphyWindow *window)
-{
- GtkWidget *dialog;
- int response;
-
- dialog = construct_confirm_close_dialog (window,
- _("There are ongoing downloads in this window"),
- _("If you close this window, the downloads will be cancelled"),
- _("Close window and cancel downloads"));
- response = gtk_dialog_run (GTK_DIALOG (dialog));
-
- gtk_widget_destroy (dialog);
-
- return response == GTK_RESPONSE_ACCEPT;
-}
-
-static void
-impl_remove_child (EphyEmbedContainer *container,
- EphyEmbed *child)
-{
- EphyWindow *window;
-
- window = EPHY_WINDOW (container);
- g_signal_emit_by_name (window->priv->notebook,
- "tab-close-request",
- child, window);
-}
-
-static EphyEmbed *
-impl_get_active_child (EphyEmbedContainer *container)
-{
- return EPHY_WINDOW (container)->priv->active_embed;
-}
-
-static GList *
-impl_get_children (EphyEmbedContainer *container)
-{
- EphyWindow *window = EPHY_WINDOW (container);
-
- return gtk_container_get_children (GTK_CONTAINER (window->priv->notebook));
-}
-
-static gboolean
-impl_get_is_popup (EphyEmbedContainer *container)
-{
- return EPHY_WINDOW (container)->priv->is_popup;
-}
-
-static void
-ephy_window_embed_container_iface_init (EphyEmbedContainerIface *iface)
-{
- iface->add_child = impl_add_child;
- iface->set_active_child = impl_set_active_child;
- iface->remove_child = impl_remove_child;
- iface->get_active_child = impl_get_active_child;
- iface->get_children = impl_get_children;
- iface->get_is_popup = impl_get_is_popup;
-}
-
-static EphyEmbed *
-ephy_window_open_link (EphyLink *link,
- const char *address,
- EphyEmbed *embed,
- EphyLinkFlags flags)
-{
- EphyWindow *window = EPHY_WINDOW (link);
- EphyWindowPrivate *priv = window->priv;
- EphyEmbed *new_embed;
-
- g_return_val_if_fail (address != NULL, NULL);
-
- if (embed == NULL)
- {
- embed = window->priv->active_embed;
- }
-
- if (flags & EPHY_LINK_BOOKMARK)
- ephy_web_view_set_visit_type (ephy_embed_get_web_view (embed),
- EPHY_PAGE_VISIT_BOOKMARK);
- else if (flags & EPHY_LINK_TYPED)
- ephy_web_view_set_visit_type (ephy_embed_get_web_view (embed),
- EPHY_PAGE_VISIT_TYPED);
-
- if (flags & (EPHY_LINK_JUMP_TO |
- EPHY_LINK_NEW_TAB |
- EPHY_LINK_NEW_WINDOW))
- {
- EphyNewTabFlags ntflags = 0;
- EphyWindow *target_window = EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (embed)));
-
- if (flags & EPHY_LINK_JUMP_TO)
- {
- ntflags |= EPHY_NEW_TAB_JUMP;
- }
-
- if (flags & EPHY_LINK_NEW_WINDOW ||
- (flags & EPHY_LINK_NEW_TAB && priv->is_popup))
- {
- target_window = ephy_window_new ();
- }
-
- if (flags & EPHY_LINK_NEW_TAB_APPEND_AFTER)
- ntflags |= EPHY_NEW_TAB_APPEND_AFTER;
-
- new_embed = ephy_shell_new_tab
- (ephy_shell_get_default (),
- target_window,
- embed, ntflags);
- if (flags & EPHY_LINK_HOME_PAGE)
- {
- ephy_web_view_load_homepage (ephy_embed_get_web_view (new_embed));
- ephy_window_activate_location (window);
- }
- else
- {
- ephy_web_view_load_url (ephy_embed_get_web_view (new_embed), address);
- if (flags & EPHY_LINK_JUMP_TO)
- {
- gtk_widget_grab_focus (GTK_WIDGET (new_embed));
- }
- }
- }
- else
- {
- ephy_web_view_load_url (ephy_embed_get_web_view (embed), address);
-
- if (address == NULL || address[0] == '\0' || g_str_equal (address, "about:blank"))
- {
- ephy_window_activate_location (window);
- }
- else
- {
- gtk_widget_grab_focus (GTK_WIDGET (embed));
- }
-
- new_embed = embed;
- }
-
- return new_embed;
-}
-
-static void
-ephy_window_link_iface_init (EphyLinkIface *iface)
-{
- iface->open_link = ephy_window_open_link;
-}
-
-G_DEFINE_TYPE_WITH_CODE (EphyWindow, ephy_window, GTK_TYPE_APPLICATION_WINDOW,
- G_IMPLEMENT_INTERFACE (EPHY_TYPE_LINK,
- ephy_window_link_iface_init)
- G_IMPLEMENT_INTERFACE (EPHY_TYPE_EMBED_CONTAINER,
- ephy_window_embed_container_iface_init))
-
-static void
-settings_change_notify (GtkSettings *settings,
- EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
- char *key_theme_name;
-
- g_object_get (settings,
- "gtk-key-theme-name", &key_theme_name,
- NULL);
-
- priv->key_theme_is_emacs =
- key_theme_name &&
- g_ascii_strcasecmp (key_theme_name, "Emacs") == 0;
-
- g_free (key_theme_name);
-}
-
-static void
-settings_changed_cb (GtkSettings *settings)
-{
- GList *list, *l;
-
- /* FIXME: multi-head */
- list = gtk_window_list_toplevels ();
-
- for (l = list; l != NULL; l = l->next)
- {
- if (EPHY_IS_WINDOW (l->data))
- {
- settings_change_notify (settings, l->data);
- }
- }
-
- g_list_free (list);
-}
-
-static void
-sync_chromes_visibility (EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
- gboolean show_tabsbar, show_downloads_box;
-
- if (priv->closing)
- return;
-
- show_tabsbar = (priv->chrome & EPHY_WINDOW_CHROME_TABSBAR);
- show_downloads_box = (priv->chrome & EPHY_WINDOW_CHROME_DOWNLOADS_BOX);
-
- ephy_notebook_set_tabs_allowed (EPHY_NOTEBOOK (priv->notebook),
- show_tabsbar && !(priv->is_popup || priv->fullscreen_mode));
- gtk_widget_set_visible (priv->downloads_box,
- show_downloads_box && !priv->fullscreen_mode);
-}
-
-static void
-ephy_window_set_chrome (EphyWindow *window,
- EphyWindowChrome chrome)
-{
- if (window->priv->chrome == chrome)
- return;
-
- window->priv->chrome = chrome;
- if (window->priv->closing)
- return;
-
- g_object_notify (G_OBJECT (window), "chrome");
- sync_chromes_visibility (window);
-}
-
-static void
-sync_tab_load_status (EphyWebView *view,
- WebKitLoadEvent load_event,
- EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
- GtkActionGroup *action_group = priv->action_group;
- GtkAction *action;
- gboolean loading;
-
- if (window->priv->closing) return;
-
- loading = ephy_web_view_is_loading (view);
-
- action = gtk_action_group_get_action (action_group, "ViewStop");
- gtk_action_set_sensitive (action, loading);
-
- /* disable print while loading, see bug #116344 */
- action = gtk_action_group_get_action (action_group, "FilePrint");
- ephy_action_change_sensitivity_flags (action, SENS_FLAG_LOADING, loading);
-
- action = gtk_action_group_get_action (priv->toolbar_action_group,
- "ViewCombinedStopReload");
- ephy_combined_stop_reload_action_set_loading (EPHY_COMBINED_STOP_RELOAD_ACTION (action),
- loading);
-}
-
-static void
-sync_tab_security (EphyWebView *view,
- GParamSpec *pspec,
- EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
- EphyTitleBox *title_box;
- EphySecurityLevel security_level;
-
- if (priv->closing) return;
-
- ephy_web_view_get_security_level (view, &security_level, NULL, NULL);
- title_box = ephy_toolbar_get_title_box (EPHY_TOOLBAR (priv->toolbar));
- ephy_title_box_set_security_level (title_box, security_level);
-}
-
-static void
-ephy_window_fullscreen (EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
- EphyEmbed *embed;
-
- priv->fullscreen_mode = TRUE;
-
- /* sync status */
- embed = window->priv->active_embed;
- sync_tab_load_status (ephy_embed_get_web_view (embed), WEBKIT_LOAD_STARTED, window);
- sync_tab_security (ephy_embed_get_web_view (embed), NULL, window);
-
- sync_chromes_visibility (window);
- gtk_widget_hide (priv->toolbar);
- ephy_embed_entering_fullscreen (embed);
-}
-
-static void
-ephy_window_unfullscreen (EphyWindow *window)
-{
- window->priv->fullscreen_mode = FALSE;
-
- gtk_widget_show (window->priv->toolbar);
- sync_chromes_visibility (window);
- ephy_embed_leaving_fullscreen (window->priv->active_embed);
-}
-
-static gboolean
-ephy_window_key_press_event (GtkWidget *widget,
- GdkEventKey *event)
-{
- EphyWindow *window = EPHY_WINDOW (widget);
- EphyWindowPrivate *priv = window->priv;
- GtkWidget *focus_widget;
- gboolean shortcircuit = FALSE, force_chain = FALSE, handled = FALSE;
- guint modifier = event->state & gtk_accelerator_get_default_mod_mask ();
- guint i;
-
- /* In an attempt to get the mozembed playing nice with things like emacs keybindings
- * we are passing important events to the focused child widget before letting the window's
- * base handler see them. This is *completely against* stated gtk2 policy but the
- * 'correct' behaviour is exceptionally useless. We need to keep an eye out for
- * unexpected consequences of this decision. IME's should be a high concern, but
- * considering that the IME folks complained about the upside-down event propagation
- * rules, we might be doing them a favour.
- *
- * We achieve this by first evaluating the event to see if it's important, and if
- * so, we get the focus widget and attempt to get the widget to handle that event.
- * If the widget does handle it, we're done (unless force_chain is true, in which
- * case the event is handled as normal in addition to being sent to the focus
- * widget), otherwise the event follows the normal handling path.
- */
-
- if (event->keyval == GDK_KEY_Escape && modifier == 0)
- {
- /* Always pass Escape to both the widget, and the parent */
- shortcircuit = TRUE;
- force_chain = TRUE;
- }
- else if (priv->key_theme_is_emacs &&
- (modifier == GDK_CONTROL_MASK) &&
- event->length > 0 &&
- /* But don't pass Ctrl+Enter twice */
- event->keyval != GDK_KEY_Return &&
- event->keyval != GDK_KEY_KP_Enter &&
- event->keyval != GDK_KEY_ISO_Enter)
- {
- /* Pass CTRL+letter characters to the widget */
- shortcircuit = TRUE;
- }
-
- if (shortcircuit)
- {
- focus_widget = gtk_window_get_focus (GTK_WINDOW (window));
-
- if (GTK_IS_WIDGET (focus_widget))
- {
- handled = gtk_widget_event (focus_widget,
- (GdkEvent*) event);
- }
-
- if (handled && !force_chain)
- {
- return handled;
- }
- }
-
- /* Handle accelerators that we want bound, but aren't associated with
- * an action */
- for (i = 0; i < G_N_ELEMENTS (extra_keybindings); i++)
- {
- if (event->keyval == extra_keybindings[i].keyval &&
- modifier == extra_keybindings[i].modifier)
- {
- GtkAction * action = gtk_action_group_get_action
- (extra_keybindings[i].fromToolbar ?
- priv->toolbar_action_group :
- priv->action_group,
- extra_keybindings[i].action);
- if (gtk_action_is_sensitive (action))
- {
- gtk_action_activate (action);
- return TRUE;
- }
- break;
- }
- }
-
- return GTK_WIDGET_CLASS (ephy_window_parent_class)->key_press_event (widget, event);
-}
-
-static gboolean
-window_has_ongoing_downloads (EphyWindow *window)
-{
- GList *l, *downloads;
- gboolean downloading = FALSE;
-
- downloads = gtk_container_get_children (GTK_CONTAINER (window->priv->downloads_box));
-
- for (l = downloads; l != NULL; l = l->next)
- {
- if (EPHY_IS_DOWNLOAD_WIDGET (l->data) != TRUE)
- continue;
-
- if (!ephy_download_widget_download_is_finished (EPHY_DOWNLOAD_WIDGET (l->data)))
- {
- downloading = TRUE;
- break;
- }
- }
- g_list_free (downloads);
-
- return downloading;
-}
-
-static gboolean
-ephy_window_delete_event (GtkWidget *widget,
- GdkEventAny *event)
-{
- if (!ephy_window_close (EPHY_WINDOW (widget)))
- return TRUE;
-
- /* proceed with window close */
- if (GTK_WIDGET_CLASS (ephy_window_parent_class)->delete_event)
- {
- return GTK_WIDGET_CLASS (ephy_window_parent_class)->delete_event (widget, event);
- }
-
- return FALSE;
-}
-
-#define MAX_SPELL_CHECK_GUESSES 4
-
-static void
-update_link_actions_sensitivity (EphyWindow *window,
- gboolean link_has_web_scheme)
-{
- GtkAction *action;
- GtkActionGroup *action_group;
-
- action_group = window->priv->popups_action_group;
-
- action = gtk_action_group_get_action (action_group, "OpenLinkInNewWindow");
- gtk_action_set_sensitive (action, link_has_web_scheme);
-
- action = gtk_action_group_get_action (action_group, "OpenLinkInNewTab");
- ephy_action_change_sensitivity_flags (action, SENS_FLAG_CONTEXT, !link_has_web_scheme);
-}
-
-static void
-update_edit_action_sensitivity (EphyWindow *window, const gchar *action_name, gboolean sensitive, gboolean hide)
-{
- GtkAction *action;
-
- action = gtk_action_group_get_action (window->priv->action_group, action_name);
- gtk_action_set_sensitive (action, sensitive);
- gtk_action_set_visible (action, !hide || sensitive);
-}
-
-typedef struct
-{
- EphyWindow *window;
- const gchar *action_name;
- gboolean hide;
-} CanEditCommandAsyncData;
-
-static CanEditCommandAsyncData *
-can_edit_command_async_data_new (EphyWindow *window, const gchar *action_name, gboolean hide)
-{
- CanEditCommandAsyncData *data;
-
- data = g_slice_new (CanEditCommandAsyncData);
- data->window = g_object_ref (window);
- data->action_name = action_name;
- data->hide = hide;
-
- return data;
-}
-
-static void
-can_edit_command_async_data_free (CanEditCommandAsyncData *data)
-{
- if (G_UNLIKELY (!data))
- return;
-
- g_object_unref (data->window);
- g_slice_free (CanEditCommandAsyncData, data);
-}
-
-static void
-can_edit_command_callback (GObject *object, GAsyncResult *result, CanEditCommandAsyncData *data)
-{
- gboolean sensitive;
- GError *error = NULL;
-
- sensitive = webkit_web_view_can_execute_editing_command_finish (WEBKIT_WEB_VIEW (object), result, &error);
- if (!error)
- {
- update_edit_action_sensitivity (data->window, data->action_name, sensitive, data->hide);
-
- }
- else
- {
- g_error_free (error);
- }
-
- can_edit_command_async_data_free (data);
-}
-
-static void
-update_edit_actions_sensitivity (EphyWindow *window, gboolean hide)
-{
- GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
- gboolean can_copy, can_cut, can_undo, can_redo, can_paste;
-
- if (GTK_IS_EDITABLE (widget))
- {
- GtkWidget *entry;
- gboolean has_selection;
-
- entry = ephy_toolbar_get_location_entry (EPHY_TOOLBAR (window->priv->toolbar));
-
- has_selection = gtk_editable_get_selection_bounds
- (GTK_EDITABLE (widget), NULL, NULL);
-
- can_copy = has_selection;
- can_cut = has_selection;
- can_paste = TRUE;
- can_undo = ephy_location_entry_get_can_undo (EPHY_LOCATION_ENTRY (entry));
- can_redo = ephy_location_entry_get_can_redo (EPHY_LOCATION_ENTRY (entry));
- }
- else
- {
- EphyEmbed *embed;
- WebKitWebView *view;
- CanEditCommandAsyncData *data;
-
- embed = window->priv->active_embed;
- g_return_if_fail (embed != NULL);
-
- view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
-
- data = can_edit_command_async_data_new (window, "EditCopy", hide);
- webkit_web_view_can_execute_editing_command (view, WEBKIT_EDITING_COMMAND_COPY, NULL,
- (GAsyncReadyCallback)can_edit_command_callback,
- data);
- data = can_edit_command_async_data_new (window, "EditCut", hide);
- webkit_web_view_can_execute_editing_command (view, WEBKIT_EDITING_COMMAND_CUT, NULL,
- (GAsyncReadyCallback)can_edit_command_callback,
- data);
- data = can_edit_command_async_data_new (window, "EditPaste", hide);
- webkit_web_view_can_execute_editing_command (view, WEBKIT_EDITING_COMMAND_PASTE, NULL,
- (GAsyncReadyCallback)can_edit_command_callback,
- data);
- data = can_edit_command_async_data_new (window, "EditUndo", hide);
- webkit_web_view_can_execute_editing_command (view, "Undo", NULL,
- (GAsyncReadyCallback)can_edit_command_callback,
- data);
- data = can_edit_command_async_data_new (window, "EditRedo", hide);
- webkit_web_view_can_execute_editing_command (view, "Redo", NULL,
- (GAsyncReadyCallback)can_edit_command_callback,
- data);
- return;
- }
-
- update_edit_action_sensitivity (window, "EditCopy", can_copy, hide);
- update_edit_action_sensitivity (window, "EditCut", can_cut, hide);
- update_edit_action_sensitivity (window, "EditPaste", can_paste, hide);
- update_edit_action_sensitivity (window, "EditUndo", can_undo, hide);
- update_edit_action_sensitivity (window, "EditRedo", can_redo, hide);
-}
-
-static void
-enable_edit_actions_sensitivity (EphyWindow *window)
-{
- GtkActionGroup *action_group;
- GtkAction *action;
-
- action_group = window->priv->action_group;
-
- action = gtk_action_group_get_action (action_group, "EditCopy");
- gtk_action_set_sensitive (action, TRUE);
- gtk_action_set_visible (action, TRUE);
- action = gtk_action_group_get_action (action_group, "EditCut");
- gtk_action_set_sensitive (action, TRUE);
- gtk_action_set_visible (action, TRUE);
- action = gtk_action_group_get_action (action_group, "EditPaste");
- gtk_action_set_sensitive (action, TRUE);
- gtk_action_set_visible (action, TRUE);
- action = gtk_action_group_get_action (action_group, "EditUndo");
- gtk_action_set_sensitive (action, TRUE);
- gtk_action_set_visible (action, TRUE);
- action = gtk_action_group_get_action (action_group, "EditRedo");
- gtk_action_set_sensitive (action, TRUE);
- gtk_action_set_visible (action, TRUE);
-}
-
-static void
-edit_menu_show_cb (GtkWidget *menu,
- EphyWindow *window)
-{
- update_edit_actions_sensitivity (window, FALSE);
-}
-
-static void
-edit_menu_hide_cb (GtkWidget *menu,
- EphyWindow *window)
-{
- enable_edit_actions_sensitivity (window);
-}
-
-static void
-init_menu_updaters (EphyWindow *window)
-{
- GtkWidget *edit_menu;
-
- edit_menu = gtk_ui_manager_get_widget
- (window->priv->manager, "/ui/PagePopup");
-
- g_signal_connect (edit_menu, "show",
- G_CALLBACK (edit_menu_show_cb), window);
- g_signal_connect (edit_menu, "hide",
- G_CALLBACK (edit_menu_hide_cb), window);
-}
-
-static void
-setup_ui_manager (EphyWindow *window)
-{
- GtkActionGroup *action_group;
- GtkAccelGroup *accel_group;
- GtkAction *action;
- GtkUIManager *manager;
-
- window->priv->main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_widget_show (window->priv->main_vbox);
- gtk_container_add (GTK_CONTAINER (window),
- window->priv->main_vbox);
-
- manager = gtk_ui_manager_new ();
- accel_group = gtk_ui_manager_get_accel_group (manager);
-
- action_group = gtk_action_group_new ("WindowActions");
- gtk_action_group_set_translation_domain (action_group, NULL);
- gtk_action_group_add_actions (action_group, ephy_menu_entries,
- G_N_ELEMENTS (ephy_menu_entries), window);
- gtk_action_group_add_toggle_actions (action_group,
- ephy_menu_toggle_entries,
- G_N_ELEMENTS (ephy_menu_toggle_entries),
- window);
- gtk_action_group_set_accel_group (action_group, accel_group);
- gtk_ui_manager_insert_action_group (manager, action_group, 0);
- window->priv->action_group = action_group;
- g_object_unref (action_group);
-
- action = gtk_action_group_get_action (action_group, "FileOpen");
- g_object_set (action, "short_label", _("Open"), NULL);
- action = gtk_action_group_get_action (action_group, "FileSaveAs");
- g_object_set (action, "short_label", _("Save As"), NULL);
- action = gtk_action_group_get_action (action_group, "FileSaveAsApplication");
- g_object_set (action, "short_label", _("Save As Application"), NULL);
- action = gtk_action_group_get_action (action_group, "FilePrint");
- g_object_set (action, "short_label", _("Print"), NULL);
- action = gtk_action_group_get_action (action_group, "FileBookmarkPage");
- g_object_set (action, "short_label", _("Bookmark"), NULL);
- action = gtk_action_group_get_action (action_group, "EditFind");
- g_object_set (action, "short_label", _("Find"), NULL);
-
- action = gtk_action_group_get_action (action_group, "EditFind");
- g_object_set (action, "is_important", TRUE, NULL);
-
- action = gtk_action_group_get_action (action_group, "ViewEncoding");
- g_object_set (action, "hide_if_empty", FALSE, NULL);
- action = gtk_action_group_get_action (action_group, "ViewZoomIn");
- /* Translators: This refers to text size */
- g_object_set (action, "short-label", _("Larger"), NULL);
- action = gtk_action_group_get_action (action_group, "ViewZoomOut");
- /* Translators: This refers to text size */
- g_object_set (action, "short-label", _("Smaller"), NULL);
-
- action_group = gtk_action_group_new ("PopupsActions");
- gtk_action_group_set_translation_domain (action_group, NULL);
- gtk_action_group_add_actions (action_group, ephy_popups_entries,
- G_N_ELEMENTS (ephy_popups_entries), window);
- gtk_action_group_set_accel_group (action_group, accel_group);
- gtk_ui_manager_insert_action_group (manager, action_group, 0);
- window->priv->popups_action_group = action_group;
- g_object_unref (action_group);
-
- /* Tab accels */
- action_group = gtk_action_group_new ("TabAccelsActions");
- gtk_action_group_set_accel_group (action_group, accel_group);
- gtk_ui_manager_insert_action_group (manager, action_group, 0);
- window->priv->tab_accels_action_group = action_group;
- g_object_unref (action_group);
-
- action_group = gtk_action_group_new ("SpecialToolbarActions");
- action =
- g_object_new (EPHY_TYPE_NAVIGATION_HISTORY_ACTION,
- "name", "NavigationBack",
- "label", _("Back"),
- "icon-name", "go-previous-symbolic",
- "window", window,
- "direction", EPHY_NAVIGATION_HISTORY_DIRECTION_BACK,
- NULL);
- gtk_action_group_add_action_with_accel (action_group, action,
- "Left");
- g_object_unref (action);
-
- action =
- g_object_new (EPHY_TYPE_NAVIGATION_HISTORY_ACTION,
- "name", "NavigationForward",
- "label", _("Forward"),
- "icon-name", "go-next-symbolic",
- "window", window,
- "direction", EPHY_NAVIGATION_HISTORY_DIRECTION_FORWARD,
- NULL);
- gtk_action_group_add_action_with_accel (action_group, action,
- "Right");
- g_object_unref (action);
-
- action =
- g_object_new (EPHY_TYPE_ZOOM_ACTION,
- "name", "Zoom",
- "label", _("Zoom"),
- "zoom", 1.0,
- NULL);
- gtk_action_group_add_action (action_group, action);
- g_object_unref (action);
-
- action = g_object_new (EPHY_TYPE_HOME_ACTION,
- "name", "FileNewTab",
- "icon-name", "tab-new-symbolic",
- "label", _("New _Tab"),
- NULL);
- gtk_action_group_add_action_with_accel (action_group, action, "T");
- g_object_unref (action);
-
- action =
- g_object_new (EPHY_TYPE_HOME_ACTION,
- "name", "FileHome",
- "label", _("Go to most visited"),
- NULL);
- gtk_action_group_add_action_with_accel (action_group, action, "Home");
- g_signal_connect_swapped (action, "open-link",
- G_CALLBACK (ephy_link_open), window);
- g_object_unref (action);
-
- action = g_object_new (EPHY_TYPE_COMBINED_STOP_RELOAD_ACTION,
- "name", "ViewCombinedStopReload",
- "loading", FALSE,
- "window", window,
- NULL);
- gtk_action_group_add_action (action_group, action);
- g_object_unref (action);
-
- gtk_action_group_set_accel_group (action_group, accel_group);
- gtk_ui_manager_insert_action_group (manager, action_group, 0);
- window->priv->toolbar_action_group = action_group;
- g_object_unref (action_group);
-
- window->priv->manager = manager;
- gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
-}
-
-static char *
-calculate_location (const char *typed_address, const char *address)
-{
- const char *location;
-
- /* If there's a typed address, use that over address. Never
- * show URIs in the 'do_not_show_address' array. */
- location = typed_address ? typed_address : address;
- location = ephy_embed_utils_is_no_show_address (location) ? NULL : location;
-
- return g_strdup (location);
-}
-
-static void
-_ephy_window_set_default_actions_sensitive (EphyWindow *window,
- guint flags,
- gboolean set)
-{
- EphyWindowPrivate *priv = window->priv;
- GtkActionGroup *action_group;
- GtkAction *action;
- int i;
- const char *action_group_actions[] = { "FileSaveAs", "FileSaveAsApplication", "FilePrint",
- "FileSendTo", "FileBookmarkPage", "EditFind",
- "EditFindPrev", "EditFindNext", "ViewEncoding",
- "ViewZoomIn", "ViewZoomOut", "ViewPageSource",
- NULL };
-
- action_group = priv->action_group;
-
- /* Page menu */
- for (i = 0; action_group_actions[i] != NULL; i++)
- {
- action = gtk_action_group_get_action (action_group,
- action_group_actions[i]);
- ephy_action_change_sensitivity_flags (action,
- flags, set);
- }
-
- /* Page context popup */
- action = gtk_action_group_get_action (priv->popups_action_group,
- "ContextBookmarkPage");
- ephy_action_change_sensitivity_flags (action,
- flags, set);
-
- /* Toolbar */
- action = gtk_action_group_get_action (priv->toolbar_action_group,
- "ViewCombinedStopReload");
- ephy_action_change_sensitivity_flags (action,
- flags, set);
-}
-
-static void
-sync_tab_address (EphyWebView *view,
- GParamSpec *pspec,
- EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
- const char *address;
- const char *typed_address;
- char *location;
-
- if (priv->closing) return;
-
- address = ephy_web_view_get_address (view);
- typed_address = ephy_web_view_get_typed_address (view);
-
- _ephy_window_set_default_actions_sensitive (window,
- SENS_FLAG_IS_BLANK,
- ephy_web_view_is_overview (view));
-
- location = calculate_location (typed_address, address);
- ephy_window_set_location (window, location);
- g_free (location);
-}
-
-static void
-sync_tab_zoom (WebKitWebView *web_view, GParamSpec *pspec, EphyWindow *window)
-{
- GtkActionGroup *action_group;
- GtkAction *action;
- gboolean can_zoom_in = TRUE, can_zoom_out = TRUE, can_zoom_normal = FALSE;
- double zoom;
-
- if (window->priv->closing) return;
-
- zoom = webkit_web_view_get_zoom_level (web_view);
-
- if (zoom >= ZOOM_MAXIMAL)
- {
- can_zoom_in = FALSE;
- }
-
- if (zoom <= ZOOM_MINIMAL)
- {
- can_zoom_out = FALSE;
- }
-
- if (zoom != 1.0)
- {
- can_zoom_normal = TRUE;
- }
-
- action_group = window->priv->action_group;
- action = gtk_action_group_get_action (action_group, "ViewZoomIn");
- gtk_action_set_sensitive (action, can_zoom_in);
- action = gtk_action_group_get_action (action_group, "ViewZoomOut");
- gtk_action_set_sensitive (action, can_zoom_out);
- action = gtk_action_group_get_action (action_group, "ViewZoomNormal");
- gtk_action_set_sensitive (action, can_zoom_normal);
-}
-
-static void
-sync_tab_document_type (EphyWebView *view,
- GParamSpec *pspec,
- EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
- GtkActionGroup *action_group = priv->action_group;
- GtkAction *action;
- EphyWebViewDocumentType type;
- gboolean can_find, disable, is_image;
-
- if (priv->closing) return;
-
- /* update zoom actions */
- sync_tab_zoom (WEBKIT_WEB_VIEW (view), NULL, window);
-
- type = ephy_web_view_get_document_type (view);
- can_find = (type != EPHY_WEB_VIEW_DOCUMENT_IMAGE);
- is_image = type == EPHY_WEB_VIEW_DOCUMENT_IMAGE;
- disable = (type != EPHY_WEB_VIEW_DOCUMENT_HTML);
-
- action = gtk_action_group_get_action (action_group, "ViewEncoding");
- ephy_action_change_sensitivity_flags (action, SENS_FLAG_DOCUMENT, disable);
- action = gtk_action_group_get_action (action_group, "ViewPageSource");
- ephy_action_change_sensitivity_flags (action, SENS_FLAG_DOCUMENT, is_image);
- action = gtk_action_group_get_action (action_group, "EditFind");
- ephy_action_change_sensitivity_flags (action, SENS_FLAG_DOCUMENT, !can_find);
- action = gtk_action_group_get_action (action_group, "EditFindNext");
- ephy_action_change_sensitivity_flags (action, SENS_FLAG_DOCUMENT, !can_find);
- action = gtk_action_group_get_action (action_group, "EditFindPrev");
- ephy_action_change_sensitivity_flags (action, SENS_FLAG_DOCUMENT, !can_find);
-
- if (!can_find)
- {
- ephy_find_toolbar_request_close (ephy_embed_get_find_toolbar (priv->active_embed));
- }
-}
-
-static void
-_ephy_window_action_set_favicon (EphyWindow *window,
- GdkPixbuf *icon)
-{
- EphyWindowPrivate *priv = window->priv;
-
- g_object_set (priv->location_controller, "icon", icon, NULL);
-}
-
-static void
-sync_tab_icon (EphyWebView *view,
- GParamSpec *pspec,
- EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
- GdkPixbuf *icon;
-
- if (priv->closing) return;
-
- icon = ephy_web_view_get_icon (view);
-
- _ephy_window_action_set_favicon (window, icon);
-}
-
-static void
-_ephy_window_set_navigation_flags (EphyWindow *window,
- EphyWebViewNavigationFlags flags)
-{
- GtkAction *action;
-
- action = gtk_action_group_get_action (window->priv->toolbar_action_group, "NavigationBack");
- gtk_action_set_sensitive (action, flags & EPHY_WEB_VIEW_NAV_BACK);
- action = gtk_action_group_get_action (window->priv->toolbar_action_group, "NavigationForward");
- gtk_action_set_sensitive (action, flags & EPHY_WEB_VIEW_NAV_FORWARD);
-}
-
-static void
-sync_tab_navigation (EphyWebView *view,
- GParamSpec *pspec,
- EphyWindow *window)
-{
- if (window->priv->closing) return;
-
- _ephy_window_set_navigation_flags (window,
- ephy_web_view_get_navigation_flags (view));
-}
-
-static void
-sync_tab_is_blank (EphyWebView *view,
- GParamSpec *pspec,
- EphyWindow *window)
-{
- if (window->priv->closing) return;
-
- _ephy_window_set_default_actions_sensitive (window,
- SENS_FLAG_IS_BLANK,
- ephy_web_view_get_is_blank (view));
-}
-
-static void
-sync_tab_popup_windows (EphyWebView *view,
- GParamSpec *pspec,
- EphyWindow *window)
-{
- /* FIXME: show popup count somehow */
-}
-
-static void
-sync_tab_popups_allowed (EphyWebView *view,
- GParamSpec *pspec,
- EphyWindow *window)
-{
- GtkAction *action;
- gboolean allow;
-
- g_return_if_fail (EPHY_IS_WEB_VIEW (view));
- g_return_if_fail (EPHY_IS_WINDOW (window));
-
- action = gtk_action_group_get_action (window->priv->action_group,
- "ViewPopupWindows");
- g_return_if_fail (GTK_IS_ACTION (action));
-
- g_object_get (view, "popups-allowed", &allow, NULL);
-
- g_signal_handlers_block_by_func
- (G_OBJECT (action),
- G_CALLBACK (ephy_window_view_popup_windows_cb),
- window);
-
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), allow);
-
- g_signal_handlers_unblock_by_func
- (G_OBJECT (action),
- G_CALLBACK (ephy_window_view_popup_windows_cb),
- window);
-}
-
-static void
-sync_tab_title (EphyEmbed *embed,
- GParamSpec *pspec,
- EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
-
- if (priv->closing) return;
-
- gtk_window_set_title (GTK_WINDOW(window),
- ephy_embed_get_title (embed));
-}
-
-static gboolean
-idle_unref_context_event (EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
-
- LOG ("Idle unreffing context event %p", priv->context_event);
-
- if (priv->context_event != NULL)
- {
- g_object_unref (priv->context_event);
- priv->context_event = NULL;
- }
-
- priv->idle_worker = 0;
- return FALSE;
-}
-
-static void
-_ephy_window_set_context_event (EphyWindow *window,
- EphyEmbedEvent *event)
-{
- EphyWindowPrivate *priv = window->priv;
-
- if (priv->idle_worker != 0)
- {
- g_source_remove (priv->idle_worker);
- priv->idle_worker = 0;
- }
-
- if (priv->context_event != NULL)
- {
- g_object_unref (priv->context_event);
- }
-
- priv->context_event = event != NULL ? g_object_ref (event) : NULL;
-}
-
-static void
-_ephy_window_unset_context_event (EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
-
- /* Unref the event from idle since we still need it
- * from the action callbacks which will run before idle.
- */
- if (priv->idle_worker == 0 && priv->context_event != NULL)
- {
- priv->idle_worker =
- g_idle_add ((GSourceFunc) idle_unref_context_event, window);
- }
-}
-
-static void
-context_menu_dismissed_cb (WebKitWebView *webView,
- EphyWindow *window)
-{
- LOG ("Deactivating popup menu");
-
- enable_edit_actions_sensitivity (window);
-
- g_signal_handlers_disconnect_by_func
- (webView, G_CALLBACK (context_menu_dismissed_cb), window);
-
- _ephy_window_unset_context_event (window);
-}
-
-static void
-add_action_to_context_menu (WebKitContextMenu *context_menu,
- GtkActionGroup *action_group,
- const char *action_name)
-{
- GtkAction *action;
-
- action = gtk_action_group_get_action (action_group, action_name);
- webkit_context_menu_append (context_menu, webkit_context_menu_item_new (action));
-}
-
-static void
-add_item_to_context_menu (WebKitContextMenu *context_menu,
- WebKitContextMenuItem *item)
-{
- if (!item)
- return;
-
- webkit_context_menu_append (context_menu, item);
- g_object_unref (item);
-}
-
-/* FIXME: Add webkit_context_menu_find() ? */
-static WebKitContextMenuItem *
-find_item_in_context_menu (WebKitContextMenu *context_menu,
- WebKitContextMenuAction action)
-{
- GList *items, *iter;
-
- items = webkit_context_menu_get_items (context_menu);
- for (iter = items; iter; iter = g_list_next (iter))
- {
- WebKitContextMenuItem *item = (WebKitContextMenuItem *)iter->data;
-
- if (webkit_context_menu_item_get_stock_action (item) == action)
- return g_object_ref (item);
- }
-
- return NULL;
-}
-
-static GList *
-find_spelling_guess_context_menu_items (WebKitContextMenu *context_menu)
-{
- GList *items, *iter;
- guint i;
- GList *retval = NULL;
-
- items = webkit_context_menu_get_items (context_menu);
- for (iter = items, i = 0; iter && i < MAX_SPELL_CHECK_GUESSES; iter = g_list_next (iter), i++)
- {
- WebKitContextMenuItem *item = (WebKitContextMenuItem *)iter->data;
-
- if (webkit_context_menu_item_get_stock_action (item) == WEBKIT_CONTEXT_MENU_ACTION_SPELLING_GUESS)
- {
- retval = g_list_prepend (retval, g_object_ref (item));
- }
- else
- {
- /* Spelling guesses are always at the beginning of the context menu, so
- * we can break the loop as soon as we find the first item that is not
- * spelling guess.
- */
- break;
- }
- }
-
- return g_list_reverse (retval);
-}
-
-static gboolean
-populate_context_menu (WebKitWebView *web_view,
- WebKitContextMenu *context_menu,
- GdkEvent *event,
- WebKitHitTestResult *hit_test_result,
- EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
- WebKitContextMenuItem *input_methods_item = NULL;
- WebKitContextMenuItem *unicode_item = NULL;
- WebKitContextMenuItem *play_pause_item = NULL;
- WebKitContextMenuItem *mute_item = NULL;
- WebKitContextMenuItem *toggle_controls_item = NULL;
- WebKitContextMenuItem *toggle_loop_item = NULL;
- WebKitContextMenuItem *fullscreen_item = NULL;
- GList *spelling_guess_items = NULL;
- EphyEmbedEvent *embed_event;
- gboolean is_document = FALSE;
- gboolean app_mode;
- gboolean is_image;
- gboolean is_media = FALSE;
- gboolean is_video = FALSE;
- gboolean is_audio = FALSE;
-
- is_image = webkit_hit_test_result_context_is_image (hit_test_result);
-
- if (webkit_hit_test_result_context_is_editable (hit_test_result)) {
- input_methods_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_INPUT_METHODS);
- unicode_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_UNICODE);
- spelling_guess_items = find_spelling_guess_context_menu_items (context_menu);
- }
-
- if (webkit_hit_test_result_context_is_media (hit_test_result))
- {
- WebKitContextMenuItem *item;
-
- is_media = TRUE;
- play_pause_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_MEDIA_PLAY);
- if (!play_pause_item)
- play_pause_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_MEDIA_PAUSE);
- mute_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_MEDIA_MUTE);
- toggle_controls_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_TOGGLE_MEDIA_CONTROLS);
- toggle_loop_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_TOGGLE_MEDIA_LOOP);
- fullscreen_item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_ENTER_VIDEO_FULLSCREEN);
-
- item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_COPY_VIDEO_LINK_TO_CLIPBOARD);
- if (item)
- {
- is_video = TRUE;
- g_object_unref (item);
- }
- else
- {
- item = find_item_in_context_menu (context_menu, WEBKIT_CONTEXT_MENU_ACTION_COPY_AUDIO_LINK_TO_CLIPBOARD);
- if (item)
- {
- is_audio = TRUE;
- g_object_unref (item);
- }
- }
- }
-
- webkit_context_menu_remove_all (context_menu);
-
- embed_event = ephy_embed_event_new ((GdkEventButton *)event, hit_test_result);
- _ephy_window_set_context_event (window, embed_event);
- g_object_unref (embed_event);
-
- app_mode = ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_APPLICATION;
-
- update_edit_actions_sensitivity (window, FALSE);
-
- if (webkit_hit_test_result_context_is_link (hit_test_result))
- {
- const char *uri;
- gboolean link_has_web_scheme;
-
- uri = webkit_hit_test_result_get_link_uri (hit_test_result);
- link_has_web_scheme = ephy_embed_utils_address_has_web_scheme (uri);
-
- update_edit_actions_sensitivity (window, TRUE);
- update_link_actions_sensitivity (window, link_has_web_scheme);
-
- if (!app_mode)
- {
- add_action_to_context_menu (context_menu,
- priv->popups_action_group, "OpenLinkInNewTab");
- add_action_to_context_menu (context_menu,
- priv->popups_action_group, "OpenLinkInNewWindow");
- webkit_context_menu_append (context_menu,
- webkit_context_menu_item_new_separator ());
- }
- add_action_to_context_menu (context_menu,
- priv->action_group, "EditCopy");
- webkit_context_menu_append (context_menu,
- webkit_context_menu_item_new_separator ());
- add_action_to_context_menu (context_menu,
- priv->popups_action_group, "DownloadLinkAs");
-
- if (g_str_has_prefix (uri, "mailto:"))
- {
- add_action_to_context_menu (context_menu,
- priv->popups_action_group, "CopyEmailAddress");
- }
- else
- {
- add_action_to_context_menu (context_menu,
- priv->popups_action_group, "CopyLinkAddress");
- }
- }
- else if (webkit_hit_test_result_context_is_editable (hit_test_result))
- {
- GList *l;
- gboolean has_guesses = FALSE;
-
- for (l = spelling_guess_items; l; l = g_list_next (l))
- {
- WebKitContextMenuItem *item = WEBKIT_CONTEXT_MENU_ITEM (l->data);
-
- webkit_context_menu_append (context_menu, item);
- g_object_unref (item);
- has_guesses = TRUE;
- }
- g_list_free (spelling_guess_items);
-
- if (has_guesses)
- {
- webkit_context_menu_append (context_menu,
- webkit_context_menu_item_new_separator ());
- }
-
- update_edit_actions_sensitivity (window, FALSE);
-
- add_action_to_context_menu (context_menu,
- priv->action_group, "EditUndo");
- add_action_to_context_menu (context_menu,
- priv->action_group, "EditRedo");
- webkit_context_menu_append (context_menu,
- webkit_context_menu_item_new_separator ());
- add_action_to_context_menu (context_menu,
- priv->action_group, "EditCut");
- add_action_to_context_menu (context_menu,
- priv->action_group, "EditCopy");
- add_action_to_context_menu (context_menu,
- priv->action_group, "EditPaste");
- webkit_context_menu_append (context_menu,
- webkit_context_menu_item_new_separator ());
- add_action_to_context_menu (context_menu,
- priv->action_group, "EditSelectAll");
- if (input_methods_item || unicode_item)
- webkit_context_menu_append (context_menu,
- webkit_context_menu_item_new_separator ());
- add_item_to_context_menu (context_menu, input_methods_item);
- add_item_to_context_menu (context_menu, unicode_item);
- }
- else
- {
- is_document = TRUE;
-
- update_edit_actions_sensitivity (window, TRUE);
-
- if (!is_image && !is_media)
- {
- add_action_to_context_menu (context_menu,
- priv->toolbar_action_group, "NavigationBack");
- add_action_to_context_menu (context_menu,
- priv->toolbar_action_group, "NavigationForward");
- add_action_to_context_menu (context_menu,
- priv->action_group, "ViewReload");
- webkit_context_menu_append (context_menu,
- webkit_context_menu_item_new_separator ());
- }
-
- add_action_to_context_menu (context_menu,
- priv->action_group, "EditCopy");
-
- if (!app_mode && !is_image && !is_media)
- {
- webkit_context_menu_append (context_menu,
- webkit_context_menu_item_new_separator ());
- add_action_to_context_menu (context_menu,
- priv->popups_action_group, "ContextBookmarkPage");
- }
- }
-
- if (is_image)
- {
- webkit_context_menu_append (context_menu,
- webkit_context_menu_item_new_separator ());
- add_action_to_context_menu (context_menu,
- priv->popups_action_group, "SaveImageAs");
- add_action_to_context_menu (context_menu,
- priv->popups_action_group, "CopyImageLocation");
- add_action_to_context_menu (context_menu,
- priv->popups_action_group, "ViewImage");
- add_action_to_context_menu (context_menu,
- priv->popups_action_group, "SetImageAsBackground");
- }
-
- if (is_media)
- {
- add_item_to_context_menu (context_menu, play_pause_item);
- add_item_to_context_menu (context_menu, mute_item);
- add_item_to_context_menu (context_menu, toggle_controls_item);
- add_item_to_context_menu (context_menu, toggle_loop_item);
- add_item_to_context_menu (context_menu, fullscreen_item);
- webkit_context_menu_append (context_menu,
- webkit_context_menu_item_new_separator ());
- if (is_video)
- {
- add_action_to_context_menu (context_menu, priv->popups_action_group,
- "OpenVideoInNewWindow");
- add_action_to_context_menu (context_menu, priv->popups_action_group,
- "OpenVideoInNewTab");
- add_action_to_context_menu (context_menu, priv->popups_action_group,
- "SaveVideoAs");
- add_action_to_context_menu (context_menu, priv->popups_action_group,
- "CopyVideoLocation");
- }
- else if (is_audio)
- {
- add_action_to_context_menu (context_menu, priv->popups_action_group,
- "OpenAudioInNewWindow");
- add_action_to_context_menu (context_menu, priv->popups_action_group,
- "OpenAudioInNewTab");
- add_action_to_context_menu (context_menu, priv->popups_action_group,
- "SaveAudioAs");
- add_action_to_context_menu (context_menu, priv->popups_action_group,
- "CopyAudioLocation");
- }
- }
-
- g_signal_connect (web_view, "context-menu-dismissed",
- G_CALLBACK (context_menu_dismissed_cb),
- window);
-
- if (app_mode)
- return FALSE;
-
- if (is_document && !is_image && !is_media)
- {
- webkit_context_menu_append (context_menu,
- webkit_context_menu_item_new_separator ());
- add_action_to_context_menu (context_menu,
- priv->action_group, "FileSendTo");
- }
-
- webkit_context_menu_append (context_menu,
- webkit_context_menu_item_new_separator ());
- webkit_context_menu_append (context_menu,
- webkit_context_menu_item_new_from_stock_action (WEBKIT_CONTEXT_MENU_ACTION_INSPECT_ELEMENT));
-
- return FALSE;
-}
-
-static gboolean
-save_target_uri (EphyWindow *window,
- WebKitWebView *view,
- GdkEventButton *event,
- WebKitHitTestResult *hit_test_result)
-{
- guint context;
- char *location = NULL;
- gboolean retval = FALSE;
-
- g_object_get (hit_test_result, "context", &context, NULL);
-
- LOG ("ephy_window_dom_mouse_click_cb: button %d, context %d, modifier %d (%d:%d)",
- event->button, context, event->state, (int)event->x, (int)event->y);
-
- /* shift+click saves the link target */
- if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK)
- {
- g_object_get (G_OBJECT (hit_test_result), "link-uri", &location, NULL);
- }
- /* Note: pressing enter to submit a form synthesizes a mouse
- * click event
- */
- /* shift+click saves the non-link image */
- else if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE &&
- !(context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE))
- {
- g_object_get (G_OBJECT (hit_test_result), "image-uri", &location, NULL);
- }
-
- if (location)
- {
- LOG ("Location: %s", location);
-
- retval = ephy_embed_utils_address_has_web_scheme (location);
- if (retval)
- {
- EphyDownload *download;
-
- download = ephy_download_new_for_uri (location, GTK_WINDOW (window));
- ephy_download_set_action (download, EPHY_DOWNLOAD_ACTION_OPEN);
- ephy_window_add_download (window, download);
- g_object_unref (download);
- }
-
- g_free (location);
- }
-
- return retval;
-}
-
-static gboolean
-ephy_window_dom_mouse_click_cb (WebKitWebView *view,
- GdkEventButton *event,
- EphyWindow *window)
-{
- WebKitHitTestResult *hit_test_result;
- gboolean handled = FALSE;
-
- /* Since we're only dealing with shift+click, we can do these
- checks early. */
- if (!(event->state & GDK_SHIFT_MASK) || event->button != GDK_BUTTON_PRIMARY)
- {
- return FALSE;
- }
-
- hit_test_result = g_object_ref (window->priv->hit_test_result);
- handled = save_target_uri (window, view, event, hit_test_result);
- g_object_unref (hit_test_result);
-
- return handled;
-}
-
-static void
-ephy_window_mouse_target_changed_cb (WebKitWebView *web_view,
- WebKitHitTestResult *hit_test_result,
- guint modifiers,
- EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
-
- if (priv->hit_test_result)
- g_object_unref (priv->hit_test_result);
- priv->hit_test_result = g_object_ref (hit_test_result);
-}
-
-static void
-ephy_window_set_is_popup (EphyWindow *window,
- gboolean is_popup)
-{
- EphyWindowPrivate *priv = window->priv;
-
- priv->is_popup = is_popup;
-
- g_object_notify (G_OBJECT (window), "is-popup");
-}
-
-static void
-window_properties_geometry_changed (WebKitWindowProperties *properties,
- GParamSpec *pspec,
- EphyWindow *window)
-{
- GdkRectangle geometry;
-
- webkit_window_properties_get_geometry (properties, &geometry);
- if (geometry.x >= 0 && geometry.y >= 0)
- gtk_window_move (GTK_WINDOW (window), geometry.x, geometry.y);
- if (geometry.width > 0 && geometry.height > 0)
- gtk_window_resize (GTK_WINDOW (window), geometry.width, geometry.height);
-}
-
-static void
-ephy_window_configure_for_view (EphyWindow *window,
- WebKitWebView *web_view)
-{
- WebKitWindowProperties *properties;
- GdkRectangle geometry;
- EphyWindowChrome chrome = 0;
-
- properties = webkit_web_view_get_window_properties (web_view);
-
- if (webkit_window_properties_get_toolbar_visible (properties))
- chrome |= EPHY_WINDOW_CHROME_TOOLBAR;
-
- if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) != EPHY_EMBED_SHELL_MODE_APPLICATION)
- {
- GtkWidget *entry;
-
- entry = ephy_toolbar_get_location_entry (EPHY_TOOLBAR (window->priv->toolbar));
- gtk_editable_set_editable (GTK_EDITABLE (entry), FALSE);
-
- if (webkit_window_properties_get_menubar_visible (properties))
- chrome |= EPHY_WINDOW_CHROME_MENU;
- if (webkit_window_properties_get_locationbar_visible (properties))
- chrome |= EPHY_WINDOW_CHROME_LOCATION;
- }
-
- webkit_window_properties_get_geometry (properties, &geometry);
- if (geometry.width > 0 && geometry.height > 0)
- gtk_window_set_default_size (GTK_WINDOW (window), geometry.width, geometry.height);
-
- if (!webkit_window_properties_get_resizable (properties))
- gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
-
- window->priv->is_popup = TRUE;
- ephy_window_set_chrome (window, chrome);
- g_signal_connect (properties, "notify::geometry",
- G_CALLBACK (window_properties_geometry_changed),
- window);
-}
-
-static gboolean
-web_view_ready_cb (WebKitWebView *web_view,
- WebKitWebView *parent_web_view)
-{
- EphyWindow *window, *parent_view_window;
- gboolean using_new_window;
-
- window = EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (web_view)));
- parent_view_window = EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (parent_web_view)));
-
- using_new_window = window != parent_view_window;
-
- if (using_new_window)
- {
- ephy_window_configure_for_view (window, web_view);
- g_signal_emit_by_name (parent_web_view, "new-window", web_view);
- }
-
- if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_APPLICATION &&
- !webkit_web_view_get_uri(web_view))
- {
- /* Wait until we have a valid URL to decide whether to show the window
- * or load the URL in the default web browser
- */
- g_object_set_data_full (G_OBJECT (window), "referrer",
- g_strdup (webkit_web_view_get_uri (parent_web_view)),
- g_free);
- return TRUE;
- }
-
- gtk_widget_show (GTK_WIDGET (window));
-
- return TRUE;
-}
-
-static WebKitWebView *
-create_web_view_cb (WebKitWebView *web_view,
- WebKitNavigationAction *navigation_action,
- EphyWindow *window)
-{
- EphyEmbed *embed;
- WebKitWebView *new_web_view;
- EphyNewTabFlags flags;
- EphyWindow *target_window;
-
- if ((ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) != EPHY_EMBED_SHELL_MODE_APPLICATION) &&
- (g_settings_get_boolean (EPHY_SETTINGS_MAIN,
- EPHY_PREFS_NEW_WINDOWS_IN_TABS) ||
- g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
- EPHY_PREFS_LOCKDOWN_FULLSCREEN)))
- {
- target_window = window;
- flags = EPHY_NEW_TAB_JUMP |
- EPHY_NEW_TAB_APPEND_AFTER;
- }
- else
- {
- target_window = ephy_window_new ();
- flags = EPHY_NEW_TAB_DONT_SHOW_WINDOW;
- }
-
- embed = ephy_shell_new_tab_full (ephy_shell_get_default (),
- NULL,
- web_view,
- target_window,
- EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (web_view),
- flags,
- 0);
- if (target_window == window)
- gtk_widget_grab_focus (GTK_WIDGET (embed));
-
- new_web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
- g_signal_connect (new_web_view, "ready-to-show",
- G_CALLBACK (web_view_ready_cb),
- web_view);
-
- return new_web_view;
-}
-
-static gboolean
-decide_policy_cb (WebKitWebView *web_view,
- WebKitPolicyDecision *decision,
- WebKitPolicyDecisionType decision_type,
- EphyWindow *window)
-{
- WebKitNavigationPolicyDecision *navigation_decision;
- WebKitNavigationAction *navigation_action;
- WebKitNavigationType navigation_type;
- WebKitURIRequest *request;
- const char *uri;
- EphyEmbed *embed;
-
- if (decision_type == WEBKIT_POLICY_DECISION_TYPE_RESPONSE)
- return FALSE;
-
- navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION (decision);
- navigation_action = webkit_navigation_policy_decision_get_navigation_action (navigation_decision);
- request = webkit_navigation_action_get_request (navigation_action);
- uri = webkit_uri_request_get_uri (request);
-
- if (!ephy_embed_utils_address_has_web_scheme (uri))
- {
- GError *error = NULL;
- GdkScreen *screen;
-
- screen = gtk_widget_get_screen (GTK_WIDGET (web_view));
- gtk_show_uri (screen, uri, GDK_CURRENT_TIME, &error);
-
- if (error)
- {
- LOG ("failed to handle non web scheme: %s", error->message);
- g_error_free (error);
-
- return FALSE;
- }
-
- webkit_policy_decision_ignore (decision);
-
- return TRUE;
- }
-
- if (decision_type == WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION)
- {
- const char *frame_name = webkit_navigation_policy_decision_get_frame_name (navigation_decision);
-
- if (g_strcmp0 (frame_name, "_evince_download") == 0)
- {
- /* The Evince Browser Plugin is requesting us to downlod the document */
- webkit_policy_decision_download (decision);
- return TRUE;
- }
-
- if (!g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_ENABLE_POPUPS) &&
- !webkit_navigation_action_is_user_gesture (navigation_action))
- {
- webkit_policy_decision_ignore (decision);
- return TRUE;
- }
- }
-
- navigation_type = webkit_navigation_action_get_navigation_type (navigation_action);
-
- if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_APPLICATION)
- {
- if (!gtk_widget_is_visible (GTK_WIDGET (window)))
- {
- char *referrer;
-
- referrer = (char *)g_object_get_data (G_OBJECT (window), "referrer");
-
- if (ephy_embed_utils_urls_have_same_origin (uri, referrer))
- {
- gtk_widget_show (GTK_WIDGET (window));
- }
- else
- {
- ephy_file_open_uri_in_default_browser (uri, GDK_CURRENT_TIME,
- gtk_window_get_screen (GTK_WINDOW (window)));
- webkit_policy_decision_ignore (decision);
-
- gtk_widget_destroy (GTK_WIDGET (window));
-
- return TRUE;
- }
- }
-
- if (navigation_type == WEBKIT_NAVIGATION_TYPE_LINK_CLICKED)
- {
- if (ephy_embed_utils_urls_have_same_origin (uri, webkit_web_view_get_uri (web_view)))
- {
- return FALSE;
- }
-
- ephy_file_open_uri_in_default_browser (uri, GDK_CURRENT_TIME,
- gtk_window_get_screen (GTK_WINDOW (window)));
- webkit_policy_decision_ignore (decision);
-
- return TRUE;
- }
- }
-
- if (navigation_type == WEBKIT_NAVIGATION_TYPE_LINK_CLICKED)
- {
- gint button;
- gint state;
- EphyEmbed *new_embed;
- EphyNewTabFlags flags = 0;
- EphyWindow *target_window = window;
-
- button = webkit_navigation_action_get_mouse_button (navigation_action);
- state = webkit_navigation_action_get_modifiers (navigation_action);
-
- ephy_web_view_set_visit_type (EPHY_WEB_VIEW (web_view),
- EPHY_PAGE_VISIT_LINK);
-
- /* New tab in new window for control+shift+click */
- if (button == 1 && state == (GDK_SHIFT_MASK | GDK_CONTROL_MASK) &&
- !g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
- EPHY_PREFS_LOCKDOWN_FULLSCREEN))
- {
- target_window = ephy_window_new ();
- }
- /* New tab in existing window for middle click and
- * control+click */
- else if (button == 2 || (button == 1 && state == GDK_CONTROL_MASK))
- {
- flags |= EPHY_NEW_TAB_APPEND_AFTER;
- }
- /* Because we connect to button-press-event *after*
- * (G_CONNECT_AFTER) we need to prevent WebKit from browsing to
- * a link when you shift+click it. Otherwise when you
- * shift+click a link to download it you would also be taken to
- * the link destination. */
- else if (button == 1 && state == GDK_SHIFT_MASK)
- {
- webkit_policy_decision_ignore (decision);
-
- return TRUE;
- }
- /* Those were our special cases, we won't handle this */
- else
- {
- return FALSE;
- }
-
- embed = ephy_embed_container_get_active_child
- (EPHY_EMBED_CONTAINER (window));
-
- new_embed = ephy_shell_new_tab_full (ephy_shell_get_default (),
- NULL, NULL,
- target_window,
- embed,
- flags,
- 0);
- ephy_web_view_load_request (ephy_embed_get_web_view (new_embed), request);
-
- webkit_policy_decision_ignore (decision);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-ephy_window_connect_active_embed (EphyWindow *window)
-{
- EphyEmbed *embed;
- WebKitWebView *web_view;
- EphyWebView *view;
-
- g_return_if_fail (window->priv->active_embed != NULL);
-
- embed = window->priv->active_embed;
- view = ephy_embed_get_web_view (embed);
- web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
-
- sync_tab_security (view, NULL, window);
- sync_tab_document_type (view, NULL, window);
- sync_tab_load_status (view, WEBKIT_LOAD_STARTED, window);
- sync_tab_is_blank (view, NULL, window);
- sync_tab_navigation (view, NULL, window);
- sync_tab_title (embed, NULL, window);
- sync_tab_address (view, NULL, window);
- sync_tab_icon (view, NULL, window);
- sync_tab_popup_windows (view, NULL, window);
- sync_tab_popups_allowed (view, NULL, window);
-
- sync_tab_zoom (web_view, NULL, window);
-
- g_signal_connect_object (web_view, "notify::zoom-level",
- G_CALLBACK (sync_tab_zoom),
- window, 0);
-
- g_signal_connect_object (web_view, "create",
- G_CALLBACK (create_web_view_cb),
- window, 0);
- g_signal_connect_object (web_view, "decide-policy",
- G_CALLBACK (decide_policy_cb),
- window, 0);
- g_signal_connect_object (view, "notify::hidden-popup-count",
- G_CALLBACK (sync_tab_popup_windows),
- window, 0);
- g_signal_connect_object (view, "notify::popups-allowed",
- G_CALLBACK (sync_tab_popups_allowed),
- window, 0);
- g_signal_connect_object (embed, "notify::title",
- G_CALLBACK (sync_tab_title),
- window, 0);
- g_signal_connect_object (view, "notify::address",
- G_CALLBACK (sync_tab_address),
- window, 0);
- g_signal_connect_object (view, "notify::icon",
- G_CALLBACK (sync_tab_icon),
- window, 0);
- g_signal_connect_object (view, "notify::security-level",
- G_CALLBACK (sync_tab_security),
- window, 0);
- g_signal_connect_object (view, "notify::document-type",
- G_CALLBACK (sync_tab_document_type),
- window, 0);
- g_signal_connect_object (view, "load-changed",
- G_CALLBACK (sync_tab_load_status),
- window, 0);
- g_signal_connect_object (view, "notify::navigation",
- G_CALLBACK (sync_tab_navigation),
- window, 0);
- g_signal_connect_object (view, "notify::is-blank",
- G_CALLBACK (sync_tab_is_blank),
- window, 0);
- g_signal_connect_object (view, "button-press-event",
- G_CALLBACK (ephy_window_dom_mouse_click_cb),
- window, 0);
- g_signal_connect_object (view, "context-menu",
- G_CALLBACK (populate_context_menu),
- window, 0);
- g_signal_connect_object (view, "mouse-target-changed",
- G_CALLBACK (ephy_window_mouse_target_changed_cb),
- window, 0);
-
- g_object_notify (G_OBJECT (window), "active-child");
-}
-
-static void
-ephy_window_disconnect_active_embed (EphyWindow *window)
-{
- EphyEmbed *embed;
- WebKitWebView *web_view;
- EphyWebView *view;
-
- g_return_if_fail (window->priv->active_embed != NULL);
-
- embed = window->priv->active_embed;
- web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
- view = EPHY_WEB_VIEW (web_view);
-
- g_signal_handlers_disconnect_by_func (web_view,
- G_CALLBACK (sync_tab_zoom),
- window);
- g_signal_handlers_disconnect_by_func (web_view,
- G_CALLBACK (create_web_view_cb),
- window);
- g_signal_handlers_disconnect_by_func (view,
- G_CALLBACK (decide_policy_cb),
- window);
- g_signal_handlers_disconnect_by_func (view,
- G_CALLBACK (sync_tab_popup_windows),
- window);
- g_signal_handlers_disconnect_by_func (view,
- G_CALLBACK (sync_tab_popups_allowed),
- window);
- g_signal_handlers_disconnect_by_func (view,
- G_CALLBACK (sync_tab_security),
- window);
- g_signal_handlers_disconnect_by_func (view,
- G_CALLBACK (sync_tab_document_type),
- window);
- g_signal_handlers_disconnect_by_func (view,
- G_CALLBACK (sync_tab_load_status),
- window);
- g_signal_handlers_disconnect_by_func (view,
- G_CALLBACK (sync_tab_is_blank),
- window);
- g_signal_handlers_disconnect_by_func (view,
- G_CALLBACK (sync_tab_navigation),
- window);
- g_signal_handlers_disconnect_by_func (embed,
- G_CALLBACK (sync_tab_title),
- window);
- g_signal_handlers_disconnect_by_func (view,
- G_CALLBACK (sync_tab_address),
- window);
- g_signal_handlers_disconnect_by_func (view,
- G_CALLBACK (sync_tab_icon),
- window);
-
- g_signal_handlers_disconnect_by_func
- (view, G_CALLBACK (ephy_window_dom_mouse_click_cb), window);
- g_signal_handlers_disconnect_by_func (view,
- G_CALLBACK (populate_context_menu),
- window);
- g_signal_handlers_disconnect_by_func (view,
- G_CALLBACK (ephy_window_mouse_target_changed_cb),
- window);
-}
-
-static void
-ephy_window_set_active_tab (EphyWindow *window, EphyEmbed *new_embed)
-{
- EphyEmbed *old_embed;
-
- g_return_if_fail (EPHY_IS_WINDOW (window));
- g_return_if_fail (gtk_widget_get_toplevel (GTK_WIDGET (new_embed)) == GTK_WIDGET (window));
-
- old_embed = window->priv->active_embed;
-
- if (old_embed == new_embed) return;
-
- if (old_embed != NULL)
- ephy_window_disconnect_active_embed (window);
-
- window->priv->active_embed = new_embed;
-
- if (new_embed != NULL)
- ephy_window_connect_active_embed (window);
-}
-
-static gboolean
-embed_modal_alert_cb (EphyEmbed *embed,
- EphyWindow *window)
-{
- const char *address;
-
- /* switch the window to the tab, and bring the window to the foreground
- * (since the alert is modal, the user won't be able to do anything
- * with his current window anyway :|)
- */
- impl_set_active_child (EPHY_EMBED_CONTAINER (window), embed);
- gtk_window_present (GTK_WINDOW (window));
-
- /* make sure the location entry shows the real URL of the tab's page */
- address = ephy_web_view_get_address (ephy_embed_get_web_view (embed));
- ephy_window_set_location (window, address);
-
- /* don't suppress alert */
- return FALSE;
-}
-
-static void
-tab_accels_item_activate (GtkAction *action,
- EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
- const char *name;
- int tab_number;
-
- name = gtk_action_get_name (action);
- tab_number = atoi (name + strlen ("TabAccel"));
-
- gtk_notebook_set_current_page (priv->notebook, tab_number);
-}
-
-static void
-tab_accels_update (EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
- int pages, i = 0;
- GList *actions, *l;
-
- actions = gtk_action_group_list_actions (priv->tab_accels_action_group);
- pages = gtk_notebook_get_n_pages (priv->notebook);
- for (l = actions; l != NULL; l = l->next)
- {
- GtkAction *action = GTK_ACTION (l->data);
-
- gtk_action_set_sensitive (action, (i < pages));
-
- i++;
- }
- g_list_free (actions);
-}
-
-#define TAB_ACCELS_N 10
-
-static void
-setup_tab_accels (EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
- guint id;
- int i;
-
- id = gtk_ui_manager_new_merge_id (priv->manager);
-
- for (i = 0; i < TAB_ACCELS_N; i++)
- {
- GtkAction *action;
- char *name;
- char *accel;
-
- name = g_strdup_printf ("TabAccel%d", i);
- accel = g_strdup_printf ("%d", (i + 1) % TAB_ACCELS_N);
- action = gtk_action_new (name, NULL, NULL, NULL);
-
- gtk_action_group_add_action_with_accel (priv->tab_accels_action_group,
- action, accel);
-
- g_signal_connect (action, "activate",
- G_CALLBACK (tab_accels_item_activate), window);
- gtk_ui_manager_add_ui (priv->manager, id, "/",
- name, name,
- GTK_UI_MANAGER_ACCELERATOR,
- FALSE);
-
- g_object_unref (action);
- g_free (accel);
- g_free (name);
- }
-}
-
-static gboolean
-show_notebook_popup_menu (GtkNotebook *notebook,
- EphyWindow *window,
- GdkEventButton *event)
-{
- GtkWidget *menu, *tab, *tab_label;
- GtkAction *action;
-
- menu = gtk_ui_manager_get_widget (window->priv->manager, "/EphyNotebookPopup");
- g_return_val_if_fail (menu != NULL, FALSE);
-
- /* allow extensions to sync when showing the popup */
- action = gtk_action_group_get_action (window->priv->action_group,
- "NotebookPopupAction");
- g_return_val_if_fail (action != NULL, FALSE);
- gtk_action_activate (action);
-
- if (event != NULL)
- {
- gint n_pages, page_num;
-
- tab = GTK_WIDGET (window->priv->active_embed);
- n_pages = gtk_notebook_get_n_pages (notebook);
- page_num = gtk_notebook_page_num (notebook, tab);
-
- /* enable/disable move left/right items*/
- action = gtk_action_group_get_action (window->priv->action_group,
- "TabsMoveLeft");
- gtk_action_set_sensitive (action, page_num > 0);
-
- action = gtk_action_group_get_action (window->priv->action_group,
- "TabsMoveRight");
- gtk_action_set_sensitive (action, page_num < n_pages - 1);
-
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
- NULL, NULL,
- event->button, event->time);
- }
- else
- {
- tab = GTK_WIDGET (window->priv->active_embed);
- tab_label = gtk_notebook_get_tab_label (notebook, tab);
-
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
- ephy_gui_menu_position_under_widget, tab_label,
- 0, gtk_get_current_event_time ());
- gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE);
- }
-
- return TRUE;
-}
-
-static gboolean
-notebook_button_press_cb (GtkNotebook *notebook,
- GdkEventButton *event,
- EphyWindow *window)
-{
- if (GDK_BUTTON_PRESS == event->type && 3 == event->button)
- {
- return show_notebook_popup_menu (notebook, window, event);
- }
-
- return FALSE;
-}
-
-static gboolean
-notebook_popup_menu_cb (GtkNotebook *notebook,
- EphyWindow *window)
-{
- /* Only respond if the notebook is the actual focus */
- if (EPHY_IS_NOTEBOOK (gtk_window_get_focus (GTK_WINDOW (window))))
- {
- return show_notebook_popup_menu (notebook, window, NULL);
- }
-
- return FALSE;
-}
-
-static gboolean
-present_on_idle_cb (GtkWindow *window)
-{
- gtk_window_present (window);
- return FALSE;
-}
-
-static gboolean
-delayed_remove_child (gpointer data)
-{
- GtkWidget *widget = GTK_WIDGET (data);
- EphyEmbedContainer *container = EPHY_EMBED_CONTAINER (gtk_widget_get_toplevel (widget));
-
- ephy_embed_container_remove_child (container, EPHY_EMBED (widget));
-
- return FALSE;
-}
-
-static void
-download_only_load_cb (EphyWebView *view,
- EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
-
- if (gtk_notebook_get_n_pages (priv->notebook) == 1) {
- ephy_web_view_load_homepage (view);
- return;
- }
-
- g_idle_add (delayed_remove_child, EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (view));
-}
-
-static void
-notebook_page_added_cb (EphyNotebook *notebook,
- EphyEmbed *embed,
- guint position,
- EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
-
- LOG ("page-added notebook %p embed %p position %u\n", notebook, embed, position);
-
- g_return_if_fail (EPHY_IS_EMBED (embed));
-
-#if 0
- g_signal_connect_object (embed, "open-link",
- G_CALLBACK (ephy_link_open), window,
- G_CONNECT_SWAPPED);
-#endif
-
- g_signal_connect_object (ephy_embed_get_web_view (embed), "download-only-load",
- G_CALLBACK (download_only_load_cb), window, G_CONNECT_AFTER);
-
- g_signal_connect_object (ephy_embed_get_web_view (embed), "ge-modal-alert",
- G_CALLBACK (embed_modal_alert_cb), window, G_CONNECT_AFTER);
-
- if (priv->present_on_insert)
- {
- priv->present_on_insert = FALSE;
- g_idle_add ((GSourceFunc) present_on_idle_cb, g_object_ref (window));
- }
-
- tab_accels_update (window);
-}
-
-static void
-notebook_page_removed_cb (EphyNotebook *notebook,
- EphyEmbed *embed,
- guint position,
- EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
-
- LOG ("page-removed notebook %p embed %p position %u\n", notebook, embed, position);
-
- if (priv->closing) return;
-
- g_return_if_fail (EPHY_IS_EMBED (embed));
-
-#if 0
- g_signal_handlers_disconnect_by_func (G_OBJECT (embed),
- G_CALLBACK (ephy_link_open),
- window);
-#endif
-
- g_signal_handlers_disconnect_by_func
- (ephy_embed_get_web_view (embed), G_CALLBACK (download_only_load_cb), window);
-
- g_signal_handlers_disconnect_by_func
- (ephy_embed_get_web_view (embed), G_CALLBACK (embed_modal_alert_cb), window);
-
- tab_accels_update (window);
-}
-
-static void
-ephy_window_close_tab (EphyWindow *window,
- EphyEmbed *tab)
-{
- gtk_widget_destroy (GTK_WIDGET (tab));
-
- /* If that was the last tab, destroy the window. */
- if (gtk_notebook_get_n_pages (window->priv->notebook) == 0)
- {
- gtk_widget_destroy (GTK_WIDGET (window));
- }
-}
-
-static void
-tab_has_modified_forms_cb (EphyWebView *view,
- GAsyncResult *result,
- EphyWindow *window)
-{
- gboolean has_modified_forms;
-
- has_modified_forms = ephy_web_view_has_modified_forms_finish (view, result, NULL);
- if (!has_modified_forms || confirm_close_with_modified_forms (window))
- {
- ephy_window_close_tab (window, EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (view));
- }
-}
-
-static void
-notebook_page_close_request_cb (EphyNotebook *notebook,
- EphyEmbed *embed,
- EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
-
- if (gtk_notebook_get_n_pages (priv->notebook) == 1)
- {
- if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
- EPHY_PREFS_LOCKDOWN_QUIT))
- {
- return;
- }
- if (window_has_ongoing_downloads (window) &&
- !confirm_close_with_downloads (window))
- {
- return;
- }
- }
-
- if (g_settings_get_boolean (EPHY_SETTINGS_MAIN,
- EPHY_PREFS_WARN_ON_CLOSE_UNSUBMITTED_DATA))
- {
- ephy_web_view_has_modified_forms (ephy_embed_get_web_view (embed),
- NULL,
- (GAsyncReadyCallback)tab_has_modified_forms_cb,
- window);
- }
- else
- {
- ephy_window_close_tab (window, embed);
- }
-}
-
-static GtkWidget *
-notebook_create_window_cb (GtkNotebook *notebook,
- GtkWidget *page,
- int x,
- int y,
- EphyWindow *window)
-{
- EphyWindow *new_window;
- EphyWindowPrivate *new_priv;
-
- new_window = ephy_window_new ();
- new_priv = new_window->priv;
-
- new_priv->present_on_insert = TRUE;
-
- return ephy_window_get_notebook (new_window);
-}
-
-static EphyEmbed *
-real_get_active_tab (EphyWindow *window, int page_num)
-{
- GtkWidget *embed;
-
- if (page_num == -1)
- {
- page_num = gtk_notebook_get_current_page (window->priv->notebook);
- }
-
- embed = gtk_notebook_get_nth_page (window->priv->notebook, page_num);
-
- g_return_val_if_fail (EPHY_IS_EMBED (embed), NULL);
-
- return EPHY_EMBED (embed);
-}
-
-static void
-notebook_switch_page_cb (GtkNotebook *notebook,
- GtkWidget *page,
- guint page_num,
- EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
- EphyEmbed *embed;
-
- LOG ("switch-page notebook %p position %u\n", notebook, page_num);
-
- if (priv->closing) return;
-
- /* get the new tab */
- embed = real_get_active_tab (window, page_num);
-
- /* update new tab */
- ephy_window_set_active_tab (window, embed);
-
- ephy_title_box_set_web_view (ephy_toolbar_get_title_box (EPHY_TOOLBAR (priv->toolbar)),
- EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
-}
-
-static GtkNotebook *
-setup_notebook (EphyWindow *window)
-{
- GtkNotebook *notebook;
-
- notebook = GTK_NOTEBOOK (g_object_new (EPHY_TYPE_NOTEBOOK, NULL));
-
- g_signal_connect_after (notebook, "switch-page",
- G_CALLBACK (notebook_switch_page_cb),
- window);
- g_signal_connect (notebook, "create-window",
- G_CALLBACK (notebook_create_window_cb),
- window);
-
- g_signal_connect (notebook, "popup-menu",
- G_CALLBACK (notebook_popup_menu_cb), window);
- g_signal_connect (notebook, "button-press-event",
- G_CALLBACK (notebook_button_press_cb), window);
-
- g_signal_connect (notebook, "page-added",
- G_CALLBACK (notebook_page_added_cb), window);
- g_signal_connect (notebook, "page-removed",
- G_CALLBACK (notebook_page_removed_cb), window);
- g_signal_connect (notebook, "tab-close-request",
- G_CALLBACK (notebook_page_close_request_cb), window);
-
- g_signal_connect_swapped (notebook, "open-link",
- G_CALLBACK (ephy_link_open), window);
-
- return notebook;
-}
-
-static void
-ephy_window_set_downloads_box_visibility (EphyWindow *window,
- gboolean show)
-{
- EphyWindowChrome chrome = window->priv->chrome;
-
- if (show)
- chrome |= EPHY_WINDOW_CHROME_DOWNLOADS_BOX;
- else
- chrome &= ~EPHY_WINDOW_CHROME_DOWNLOADS_BOX;
-
- ephy_window_set_chrome (window, chrome);
-}
-
-void
-ephy_window_add_download (EphyWindow *window,
- EphyDownload *download)
-{
- GtkWidget *widget;
-
- widget = ephy_download_widget_new (download);
- gtk_box_pack_start (GTK_BOX (window->priv->downloads_box),
- widget, FALSE, FALSE, 0);
- gtk_widget_show (widget);
- ephy_window_set_downloads_box_visibility (window, TRUE);
-}
-
-static void
-downloads_removed_cb (GtkContainer *container,
- GtkWidget *widget,
- gpointer data)
-{
- EphyWindow *window = EPHY_WINDOW (data);
- GList *children = NULL;
-
- children = gtk_container_get_children (container);
- if (g_list_length (children) == 1)
- ephy_window_set_downloads_box_visibility (window, FALSE);
-
- g_list_free (children);
-}
-
-static void
-downloads_close_cb (GtkButton *button, EphyWindow *window)
-{
- GList *l, *downloads;
-
- downloads = gtk_container_get_children (GTK_CONTAINER (window->priv->downloads_box));
-
- for (l = downloads; l != NULL; l = l->next)
- {
- if (EPHY_IS_DOWNLOAD_WIDGET (l->data) != TRUE)
- continue;
-
- if (ephy_download_widget_download_is_finished (EPHY_DOWNLOAD_WIDGET (l->data)))
- {
- gtk_widget_destroy (GTK_WIDGET (l->data));
- }
- }
- g_list_free (downloads);
-
- ephy_window_set_downloads_box_visibility (window, FALSE);
-}
-
-static GtkWidget *
-setup_downloads_box (EphyWindow *window)
-{
- GtkWidget *widget;
- GtkWidget *close_button;
- GtkWidget *image;
-
- widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- close_button = gtk_button_new ();
- gtk_container_set_border_width (GTK_CONTAINER (close_button), 6);
- gtk_widget_set_valign (close_button, GTK_ALIGN_CENTER);
- gtk_style_context_add_class (gtk_widget_get_style_context (close_button), "image-button");
- gtk_style_context_add_class (gtk_widget_get_style_context (close_button), "close");
-
- gtk_button_set_relief (GTK_BUTTON (close_button), GTK_RELIEF_NONE);
-
- image = gtk_image_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_MENU);
- g_object_set (image, "use-fallback", TRUE, NULL);
-
- gtk_container_add (GTK_CONTAINER (close_button), image);
- gtk_box_pack_end (GTK_BOX (widget), close_button, FALSE, FALSE, 4);
-
- g_signal_connect (close_button, "clicked",
- G_CALLBACK (downloads_close_cb), window);
- g_signal_connect (widget, "remove",
- G_CALLBACK (downloads_removed_cb), window);
-
- gtk_widget_show_all (close_button);
-
- return widget;
-}
-
-static void
-ephy_window_dispose (GObject *object)
-{
- EphyWindow *window = EPHY_WINDOW (object);
- EphyWindowPrivate *priv = window->priv;
- GSList *popups;
-
- LOG ("EphyWindow dispose %p", window);
-
- /* Only do these once */
- if (window->priv->closing == FALSE)
- {
- window->priv->closing = TRUE;
-
- ephy_bookmarks_ui_detach_window (window);
-
- /* Deactivate menus */
- popups = gtk_ui_manager_get_toplevels (window->priv->manager, GTK_UI_MANAGER_POPUP);
- g_slist_foreach (popups, (GFunc) gtk_menu_shell_deactivate, NULL);
- g_slist_free (popups);
-
- g_object_unref (priv->enc_menu);
- priv->enc_menu = NULL;
-
- priv->action_group = NULL;
- priv->popups_action_group = NULL;
- priv->tab_accels_action_group = NULL;
-
- g_object_unref (priv->manager);
- priv->manager = NULL;
-
- _ephy_window_set_context_event (window, NULL);
-
- g_clear_object (&priv->hit_test_result);
- }
-
- G_OBJECT_CLASS (ephy_window_parent_class)->dispose (object);
-}
-
-static void
-ephy_window_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- EphyWindow *window = EPHY_WINDOW (object);
-
- switch (prop_id)
- {
- case PROP_ACTIVE_CHILD:
- impl_set_active_child (EPHY_EMBED_CONTAINER (window),
- g_value_get_object (value));
- break;
- case PROP_CHROME:
- ephy_window_set_chrome (window, g_value_get_flags (value));
- break;
- case PROP_SINGLE_TAB_MODE:
- ephy_window_set_is_popup (window, g_value_get_boolean (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-ephy_window_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EphyWindow *window = EPHY_WINDOW (object);
-
- switch (prop_id)
- {
- case PROP_ACTIVE_CHILD:
- g_value_set_object (value, window->priv->active_embed);
- break;
- case PROP_CHROME:
- g_value_set_flags (value, window->priv->chrome);
- break;
- case PROP_SINGLE_TAB_MODE:
- g_value_set_boolean (value, window->priv->is_popup);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static gboolean
-ephy_window_state_event (GtkWidget *widget,
- GdkEventWindowState *event)
-{
- EphyWindow *window = EPHY_WINDOW (widget);
- EphyWindowPrivate *priv = window->priv;
-
- if (GTK_WIDGET_CLASS (ephy_window_parent_class)->window_state_event)
- {
- GTK_WIDGET_CLASS (ephy_window_parent_class)->window_state_event (widget, event);
- }
-
- if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
- {
- GtkActionGroup *action_group;
- GtkAction *action;
- gboolean fullscreen;
-
- fullscreen = event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN;
-
- if (fullscreen)
- {
- ephy_window_fullscreen (window);
- }
- else
- {
- ephy_window_unfullscreen (window);
- }
-
- action_group = priv->action_group;
-
- action = gtk_action_group_get_action (action_group, "ViewFullscreen");
- g_signal_handlers_block_by_func
- (action, G_CALLBACK (window_cmd_view_fullscreen), window);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), fullscreen);
- g_signal_handlers_unblock_by_func
- (action, G_CALLBACK (window_cmd_view_fullscreen), window);
- }
-
- return FALSE;
-}
-
-static void
-ephy_window_finalize (GObject *object)
-{
- EphyWindow *window = EPHY_WINDOW (object);
- EphyWindowPrivate *priv = window->priv;
-
- if (priv->app_menu_visibility_handler != 0)
- g_signal_handler_disconnect (gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (window))),
- priv->app_menu_visibility_handler);
-
- G_OBJECT_CLASS (ephy_window_parent_class)->finalize (object);
-
- LOG ("EphyWindow finalised %p", object);
-}
-
-static void
-allow_popups_notifier (GSettings *settings,
- char *key,
- EphyWindow *window)
-{
- GList *tabs;
- EphyEmbed *embed;
-
- g_return_if_fail (EPHY_IS_WINDOW (window));
-
- tabs = impl_get_children (EPHY_EMBED_CONTAINER (window));
-
- for (; tabs; tabs = g_list_next (tabs))
- {
- embed = EPHY_EMBED (tabs->data);
- g_return_if_fail (EPHY_IS_EMBED (embed));
-
- g_object_notify (G_OBJECT (ephy_embed_get_web_view (embed)), "popups-allowed");
- }
- g_list_free (tabs);
-}
-
-static void
-sync_user_input_cb (EphyLocationController *action,
- GParamSpec *pspec,
- EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
- EphyEmbed *embed;
- const char *address;
-
- LOG ("sync_user_input_cb");
-
- if (priv->updating_address) return;
-
- embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
- g_assert (EPHY_IS_EMBED (embed));
-
- address = ephy_location_controller_get_address (action);
-
- priv->updating_address = TRUE;
- ephy_web_view_set_typed_address (ephy_embed_get_web_view (embed), address);
- priv->updating_address = FALSE;
-}
-
-static void
-zoom_to_level_cb (GtkAction *action,
- float zoom,
- EphyWindow *window)
-{
- ephy_window_set_zoom (window, zoom);
-}
-
-static void
-open_certificate_popover (EphyWindow *window,
- GtkWidget *relative_to,
- GdkRectangle *lock_position)
-{
- EphyWindowPrivate *priv = window->priv;
- EphyWebView *view;
- GTlsCertificate *certificate;
- GTlsCertificateFlags tls_errors;
- EphySecurityLevel security_level;
- GtkWidget *location_entry;
- GtkWidget *certificate_popover;
-
- view = ephy_embed_get_web_view (priv->active_embed);
- ephy_web_view_get_security_level (view, &security_level, &certificate, &tls_errors);
- location_entry = ephy_toolbar_get_location_entry (EPHY_TOOLBAR (priv->toolbar));
-
- certificate_popover = ephy_certificate_popover_new (relative_to,
- ephy_location_entry_get_location (EPHY_LOCATION_ENTRY (location_entry)),
- certificate,
- tls_errors,
- security_level);
-
- g_signal_connect (certificate_popover, "closed",
- G_CALLBACK (gtk_widget_destroy), NULL);
- gtk_popover_set_pointing_to (GTK_POPOVER (certificate_popover), lock_position);
- gtk_widget_show (certificate_popover);
-}
-
-static void
-location_controller_lock_clicked_cb (EphyLocationController *controller,
- gpointer user_data)
-{
- EphyWindow *window = EPHY_WINDOW (user_data);
- EphyWindowPrivate *priv = window->priv;
- GtkWidget *location_entry;
- GdkRectangle lock_position;
-
- location_entry = ephy_toolbar_get_location_entry (EPHY_TOOLBAR (priv->toolbar));
- gtk_entry_get_icon_area (GTK_ENTRY (location_entry), GTK_ENTRY_ICON_SECONDARY, &lock_position);
- open_certificate_popover (window, location_entry, &lock_position);
-}
-
-static void
-title_box_lock_clicked_cb (EphyTitleBox *title_box,
- GdkRectangle *lock_position,
- gpointer user_data)
-{
- EphyWindow *window = EPHY_WINDOW (user_data);
-
- open_certificate_popover (window, GTK_WIDGET (title_box), lock_position);
-}
-
-static GtkWidget *
-setup_toolbar (EphyWindow *window)
-{
- GtkWidget *toolbar;
- GtkAction *action;
- EphyWindowPrivate *priv = window->priv;
- EphyEmbedShellMode app_mode;
- EphyTitleBox *title_box;
-
- toolbar = ephy_toolbar_new (window);
- gtk_window_set_titlebar (GTK_WINDOW (window), toolbar);
- gtk_widget_show (toolbar);
-
- app_mode = ephy_embed_shell_get_mode (ephy_embed_shell_get_default ());
- if (app_mode == EPHY_EMBED_SHELL_MODE_INCOGNITO)
- gtk_style_context_add_class (gtk_widget_get_style_context (toolbar), "incognito-mode");
-
- action = gtk_action_group_get_action (priv->toolbar_action_group,
- "NavigationBack");
- g_signal_connect_swapped (action, "open-link",
- G_CALLBACK (ephy_link_open), window);
-
- action = gtk_action_group_get_action (priv->toolbar_action_group,
- "NavigationForward");
- g_signal_connect_swapped (action, "open-link",
- G_CALLBACK (ephy_link_open), window);
-
- action = gtk_action_group_get_action (priv->toolbar_action_group,
- "FileNewTab");
- g_signal_connect_swapped (action, "open-link",
- G_CALLBACK (ephy_link_open), window);
-
- action = gtk_action_group_get_action (priv->toolbar_action_group,
- "Zoom");
- g_signal_connect (action, "zoom-to-level",
- G_CALLBACK (zoom_to_level_cb), window);
-
- title_box = ephy_toolbar_get_title_box (EPHY_TOOLBAR (toolbar));
- g_signal_connect (title_box, "lock-clicked",
- G_CALLBACK (title_box_lock_clicked_cb), window);
-
- return toolbar;
-}
-
-static EphyLocationController *
-setup_location_controller (EphyWindow *window,
- EphyToolbar *toolbar)
-{
- EphyLocationController *location_controller;
-
- location_controller =
- g_object_new (EPHY_TYPE_LOCATION_CONTROLLER,
- "window", window,
- "location-entry", ephy_toolbar_get_location_entry (toolbar),
- "title-box", ephy_toolbar_get_title_box (toolbar),
- NULL);
- g_signal_connect (location_controller, "notify::address",
- G_CALLBACK (sync_user_input_cb), window);
- g_signal_connect_swapped (location_controller, "open-link",
- G_CALLBACK (ephy_link_open), window);
- g_signal_connect (location_controller, "lock-clicked",
- G_CALLBACK (location_controller_lock_clicked_cb), window);
-
- return location_controller;
-}
-
-static const char* disabled_actions_for_app_mode[] = { "FileOpen",
- "FileNewWindow",
- "FileNewWindowIncognito",
- "FileSaveAs",
- "FileSaveAsApplication",
- "ViewEncoding",
- "ViewPageSource",
- "FileBookmarkPage",
- "EditBookmarks",
- "EditHistory",
- "EditPreferences"};
-
-static gboolean
-_gtk_css_provider_load_from_resource (GtkCssProvider* provider,
- const char *resource_path,
- GError **error)
-{
- GBytes *data;
- gboolean res;
-
- g_return_val_if_fail (GTK_IS_CSS_PROVIDER (provider), FALSE);
- g_return_val_if_fail (resource_path != NULL, FALSE);
-
- data = g_resources_lookup_data (resource_path, 0, error);
- if (data == NULL)
- return FALSE;
-
- res = gtk_css_provider_load_from_data (provider,
- g_bytes_get_data (data, NULL),
- g_bytes_get_size (data),
- error);
- g_bytes_unref (data);
-
- return res;
-}
-
-static const gchar* app_actions[] = {
- "FileNewWindow",
- "FileNewWindowIncognito",
- "EditPreferences",
- "EditBookmarks",
- "EditHistory",
- "FileQuit",
- "HelpContents",
- "HelpAbout"
-};
-
-static void
-ephy_window_toggle_visibility_for_app_menu (EphyWindow *window)
-{
- const gchar *action_name;
- gboolean shows_app_menu;
- GtkSettings *settings;
- GtkAction *action;
- gint idx;
-
- settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (window)));
- g_object_get (settings,
- "gtk-shell-shows-app-menu", &shows_app_menu,
- NULL);
-
- for (idx = 0; idx < G_N_ELEMENTS (app_actions); idx++) {
- action_name = app_actions[idx];
- action = gtk_action_group_get_action (window->priv->action_group, action_name);
-
- gtk_action_set_visible (action, !shows_app_menu);
- }
-}
-
-static GObject *
-ephy_window_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_params)
-{
- GObject *object;
- EphyWindow *window;
- EphyWindowPrivate *priv;
- GtkSettings *settings;
- GtkAction *action;
- GtkActionGroup *toolbar_action_group;
- GError *error = NULL;
- guint settings_connection;
- GtkCssProvider *css_provider;
- int i;
- EphyEmbedShellMode mode;
- EphyWindowChrome chrome = EPHY_WINDOW_CHROME_DEFAULT;
-
- object = G_OBJECT_CLASS (ephy_window_parent_class)->constructor
- (type, n_construct_properties, construct_params);
-
- window = EPHY_WINDOW (object);
-
- priv = window->priv;
-
- ephy_gui_ensure_window_group (GTK_WINDOW (window));
-
- /* initialize the listener for the key theme
- * FIXME: Need to handle multi-head and migration.
- */
- settings = gtk_settings_get_default ();
- settings_connection = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (settings),
- SETTINGS_CONNECTION_DATA_KEY));
- if (settings_connection == 0)
- {
- settings_connection =
- g_signal_connect (settings, "notify::gtk-key-theme-name",
- G_CALLBACK (settings_changed_cb), NULL);
- g_object_set_data (G_OBJECT (settings), SETTINGS_CONNECTION_DATA_KEY,
- GUINT_TO_POINTER (settings_connection));
-
- }
-
- settings_change_notify (settings, window);
-
- /* Setup the UI manager and connect verbs */
- setup_ui_manager (window);
- setup_tab_accels (window);
-
- priv->notebook = setup_notebook (window);
-
- /* Now load the UI definition (needed by EphyToolbar). */
- gtk_ui_manager_add_ui_from_resource (priv->manager,
- "/org/gnome/epiphany/epiphany-ui.xml",
- &error);
- if (error != NULL)
- {
- g_warning ("Could not merge epiphany-ui.xml: %s", error->message);
- g_error_free (error);
- error = NULL;
- }
-
- /* Setup the toolbar. */
- priv->toolbar = setup_toolbar (window);
- priv->location_controller = setup_location_controller (window, EPHY_TOOLBAR (priv->toolbar));
- gtk_box_pack_start (GTK_BOX (priv->main_vbox),
- GTK_WIDGET (priv->notebook),
- TRUE, TRUE, 0);
- gtk_widget_show (GTK_WIDGET (priv->notebook));
-
- priv->downloads_box = setup_downloads_box (window);
- gtk_box_pack_start (GTK_BOX (priv->main_vbox),
- GTK_WIDGET (priv->downloads_box), FALSE, FALSE, 0);
- action = gtk_action_group_get_action (window->priv->action_group,
- "ViewDownloadsBar");
-
- g_object_bind_property (action, "active",
- priv->downloads_box, "visible",
- G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
-
- /* Attach the CSS provider to the window. */
- css_provider = gtk_css_provider_new ();
- _gtk_css_provider_load_from_resource (css_provider,
- "/org/gnome/epiphany/epiphany.css",
- &error);
- if (error == NULL)
- {
- gtk_style_context_add_provider_for_screen (gtk_widget_get_screen (GTK_WIDGET (window)),
- GTK_STYLE_PROVIDER (css_provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- }
- else
- {
- g_warning ("Could not attach css style: %s", error->message);
- g_error_free (error);
- }
-
- g_object_unref (css_provider);
-
- /* Initialize the menus */
- priv->enc_menu = ephy_encoding_menu_new (window);
-
- ephy_bookmarks_ui_attach_window (window);
-
- /* other notifiers */
- action = gtk_action_group_get_action (window->priv->action_group,
- "BrowseWithCaret");
-
- g_settings_bind (EPHY_SETTINGS_MAIN,
- EPHY_PREFS_ENABLE_CARET_BROWSING,
- action, "active",
- G_SETTINGS_BIND_GET);
-
- g_signal_connect (EPHY_SETTINGS_WEB,
- "changed::" EPHY_PREFS_WEB_ENABLE_POPUPS,
- G_CALLBACK (allow_popups_notifier), window);
-
- /* Disable actions not needed for popup mode. */
- toolbar_action_group = priv->toolbar_action_group;
- action = gtk_action_group_get_action (toolbar_action_group, "FileNewTab");
- ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME,
- priv->is_popup);
-
- action = gtk_action_group_get_action (priv->popups_action_group, "OpenLinkInNewTab");
- ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME,
- priv->is_popup);
-
- /* Disabled actions not needed for application mode. */
- mode = ephy_embed_shell_get_mode (ephy_embed_shell_get_default ());
- if (mode == EPHY_EMBED_SHELL_MODE_APPLICATION)
- {
- g_object_set(priv->location_controller, "editable", FALSE, NULL);
-
- /* We don't need to show the page menu in web application mode. */
- action = gtk_action_group_get_action (toolbar_action_group, "PageMenu");
- ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, TRUE);
- gtk_action_set_visible (action, FALSE);
-
- action = gtk_action_group_get_action (toolbar_action_group, "FileNewTab");
- ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME,
- TRUE);
- gtk_action_set_visible (action, FALSE);
-
- action = gtk_action_group_get_action (priv->popups_action_group, "ContextBookmarkPage");
- ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, TRUE);
- gtk_action_set_visible (action, FALSE);
-
- for (i = 0; i < G_N_ELEMENTS (disabled_actions_for_app_mode); i++)
- {
- action = gtk_action_group_get_action (priv->action_group,
- disabled_actions_for_app_mode[i]);
- ephy_action_change_sensitivity_flags (action, SENS_FLAG_CHROME, TRUE);
- gtk_action_set_visible (action, FALSE);
- }
- chrome &= ~(EPHY_WINDOW_CHROME_MENU | EPHY_WINDOW_CHROME_TABSBAR);
- }
-
- /* We never want the menubar shown, we merge the app menu into
- * our super menu manually when running outside the Shell. */
- gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (window), FALSE);
-
- ephy_window_toggle_visibility_for_app_menu (window);
- priv->app_menu_visibility_handler = g_signal_connect_swapped (gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (window))),
- "notify::gtk-shell-shows-app-menu",
- G_CALLBACK (ephy_window_toggle_visibility_for_app_menu), window);
-
- /* ensure the UI is updated */
- gtk_ui_manager_ensure_update (priv->manager);
-
- init_menu_updaters (window);
-
- ephy_window_set_chrome (window, chrome);
-
- return object;
-}
-
-static void
-ephy_window_show (GtkWidget *widget)
-{
- EphyWindow *window = EPHY_WINDOW(widget);
- EphyWindowPrivate *priv = window->priv;
-
- if (!priv->has_size)
- {
- EphyEmbed *embed;
- int flags = 0;
-
- embed = priv->active_embed;
- g_return_if_fail (EPHY_IS_EMBED (embed));
-
- if (!priv->is_popup)
- flags = EPHY_INITIAL_STATE_WINDOW_SAVE_SIZE;
-
- ephy_initial_state_add_window (widget, "main_window", 600, 500,
- TRUE, flags);
- priv->has_size = TRUE;
- }
-
- GTK_WIDGET_CLASS (ephy_window_parent_class)->show (widget);
-}
-
-static void
-ephy_window_class_init (EphyWindowClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
- object_class->constructor = ephy_window_constructor;
- object_class->dispose = ephy_window_dispose;
- object_class->finalize = ephy_window_finalize;
- object_class->get_property = ephy_window_get_property;
- object_class->set_property = ephy_window_set_property;
-
- widget_class->show = ephy_window_show;
- widget_class->key_press_event = ephy_window_key_press_event;
- widget_class->window_state_event = ephy_window_state_event;
- widget_class->delete_event = ephy_window_delete_event;
-
- g_object_class_override_property (object_class,
- PROP_ACTIVE_CHILD,
- "active-child");
-
- g_object_class_override_property (object_class,
- PROP_SINGLE_TAB_MODE,
- "is-popup");
-
- g_object_class_install_property (object_class,
- PROP_CHROME,
- g_param_spec_flags ("chrome",
- NULL,
- NULL,
- EPHY_TYPE_WINDOW_CHROME,
- EPHY_WINDOW_CHROME_DEFAULT,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_NAME |
- G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB));
-
- g_type_class_add_private (object_class, sizeof (EphyWindowPrivate));
-}
-
-static void
-ephy_window_init (EphyWindow *window)
-{
- LOG ("EphyWindow initialising %p", window);
-
- window->priv = EPHY_WINDOW_GET_PRIVATE (window);
-}
-
-/**
- * ephy_window_new:
- *
- * Equivalent to g_object_new() but returns an #EphyWindow so you don't have
- * to cast it.
- *
- * Return value: a new #EphyWindow
- **/
-EphyWindow *
-ephy_window_new (void)
-{
- return g_object_new (EPHY_TYPE_WINDOW,
- "application", GTK_APPLICATION (ephy_shell_get_default ()),
- "icon-name", "web-browser",
- NULL);
-}
-
-/**
- * ephy_window_get_ui_manager:
- * @window: an #EphyWindow
- *
- * Returns this window's UI manager.
- *
- * Return value: (transfer none): an #GtkUIManager
- **/
-GtkUIManager *
-ephy_window_get_ui_manager (EphyWindow *window)
-{
- g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL);
-
- return window->priv->manager;
-}
-
-/**
- * ephy_window_get_notebook:
- * @window: an #EphyWindow
- *
- * Returns the #GtkNotebook used by this window.
- *
- * Return value: (transfer none): the @window's #GtkNotebook
- **/
-GtkWidget *
-ephy_window_get_notebook (EphyWindow *window)
-{
- g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL);
-
- return GTK_WIDGET (window->priv->notebook);
-}
-
-/**
- * ephy_window_get_find_toolbar:
- * @window: an #EphyWindow
- *
- * Returns the #EphyFindToolbar used by this window.
- *
- * Return value: (transfer none): the @window's #EphyFindToolbar
- **/
-GtkWidget *
-ephy_window_get_current_find_toolbar (EphyWindow *window)
-{
- g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL);
-
- return GTK_WIDGET (ephy_embed_get_find_toolbar (window->priv->active_embed));
-}
-
-/**
- * ephy_window_load_url:
- * @window: a #EphyWindow
- * @url: the url to load
- *
- * Loads a new url in the active tab of @window.
- * Unlike ephy_web_view_load_url(), this function activates
- * the embed.
- *
- **/
-void
-ephy_window_load_url (EphyWindow *window,
- const char *url)
-{
- g_return_if_fail (url != NULL);
-
- ephy_link_open (EPHY_LINK (window), url, NULL, 0);
-}
-
-/**
- * ephy_window_activate_location:
- * @window: an #EphyWindow
- *
- * Activates the location entry on @window's toolbar.
- **/
-void
-ephy_window_activate_location (EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
- GtkWidget *entry;
-
- if (!(priv->chrome & EPHY_WINDOW_CHROME_LOCATION))
- return;
-
- ephy_title_box_set_mode (ephy_toolbar_get_title_box (EPHY_TOOLBAR (priv->toolbar)),
- EPHY_TITLE_BOX_MODE_LOCATION_ENTRY);
-
- entry = ephy_toolbar_get_location_entry (EPHY_TOOLBAR (priv->toolbar));
- ephy_location_entry_activate (EPHY_LOCATION_ENTRY (entry));
-}
-
-/**
- * ephy_window_set_zoom:
- * @window: an #EphyWindow
- * @zoom: the desired zoom level
- *
- * Sets the zoom on @window's active #EphyEmbed. A @zoom of 1.0 corresponds to
- * 100% zoom (normal size).
- **/
-void
-ephy_window_set_zoom (EphyWindow *window,
- float zoom)
-{
- EphyEmbed *embed;
- double current_zoom = 1.0;
- WebKitWebView *web_view;
-
- g_return_if_fail (EPHY_IS_WINDOW (window));
-
- embed = window->priv->active_embed;
- g_return_if_fail (embed != NULL);
-
- web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
-
- current_zoom = webkit_web_view_get_zoom_level (web_view);
-
- if (zoom == ZOOM_IN)
- {
- zoom = ephy_zoom_get_changed_zoom_level (current_zoom, 1);
- }
- else if (zoom == ZOOM_OUT)
- {
- zoom = ephy_zoom_get_changed_zoom_level (current_zoom, -1);
- }
-
- if (zoom != current_zoom)
- {
- webkit_web_view_set_zoom_level (web_view, zoom);
- }
-}
-
-static void
-ephy_window_view_popup_windows_cb (GtkAction *action,
- EphyWindow *window)
-{
- EphyEmbed *embed;
- gboolean allow;
-
- g_return_if_fail (EPHY_IS_WINDOW (window));
-
- embed = window->priv->active_embed;
- g_return_if_fail (EPHY_IS_EMBED (embed));
-
- if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
- {
- allow = TRUE;
- }
- else
- {
- allow = FALSE;
- }
-
- g_object_set (G_OBJECT (ephy_embed_get_web_view (embed)), "popups-allowed", allow, NULL);
-}
-
-/**
- * ephy_window_get_context_event:
- * @window: an #EphyWindow
- *
- * Returns the #EphyEmbedEvent for the current context menu.
- * Use this to get the event from the action callback.
- *
- * Return value: (transfer none): an #EphyEmbedEvent, or %NULL
- **/
-EphyEmbedEvent *
-ephy_window_get_context_event (EphyWindow *window)
-{
- g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL);
-
- return window->priv->context_event;
-}
-
-/**
- * ephy_window_get_location:
- * @window: an #EphyWindow widget
- *
- * Gets the current address according to @window's #EphyLocationController.
- *
- * Returns: current @window address
- **/
-const char *
-ephy_window_get_location (EphyWindow *window)
-{
- EphyWindowPrivate *priv = window->priv;
- return ephy_location_controller_get_address (priv->location_controller);
-}
-
-/**
- * ephy_window_set_location:
- * @window: an #EphyWindow widget
- * @address: new address
- *
- * Sets the internal #EphyLocationController address to @address.
- **/
-void
-ephy_window_set_location (EphyWindow *window,
- const char *address)
-{
- EphyWindowPrivate *priv = window->priv;
-
- if (priv->updating_address) return;
-
- priv->updating_address = TRUE;
- ephy_location_controller_set_address (priv->location_controller, address);
- priv->updating_address = FALSE;
-}
-
-/**
- * ephy_window_get_toolbar_action_group:
- * @window: an #EphyWindow
- *
- * Returns the toolbar #GtkActionGroup for this @window
- *
- * Returns: (transfer none): the #GtkActionGroup for this @window's
- * toolbar actions
- **/
-GtkActionGroup *
-ephy_window_get_toolbar_action_group (EphyWindow *window)
-{
- g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL);
-
- return window->priv->toolbar_action_group;
-}
-
-/**
- * ephy_window_get_location_controller:
- * @window: an #EphyWindow
- *
- * Returns the @window #EphyLocationController
- *
- * Returns: (transfer none): the @window #EphyLocationController
- **/
-EphyLocationController *
-ephy_window_get_location_controller (EphyWindow *window)
-{
- g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL);
-
- return window->priv->location_controller;
-}
-
-/**
- * ephy_window_is_on_current_workspace:
- * @window: an #EphyWindow
- *
- * Returns whether @window is on the current workspace
- *
- * Returns: %TRUE if the window is on the current workspace, %FALSE otherwise
- **/
-gboolean
-ephy_window_is_on_current_workspace (EphyWindow *window)
-{
- GdkWindow *gdk_window = NULL;
- WnckWorkspace *workspace = NULL;
- WnckWindow *wnck_window = NULL;
-
- if (!gtk_widget_get_realized (GTK_WIDGET (window)))
- return TRUE;
-
- gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
-
- if(!GDK_IS_X11_WINDOW (gdk_window))
- return TRUE;
-
- workspace = wnck_screen_get_active_workspace (wnck_screen_get_default ());
-
- /* From WNCK docs:
- * "May return NULL sometimes, if libwnck is in a weird state due to
- * the asynchronous nature of the interaction with the window manager."
- * In such a case we cannot really check, so assume we are.
- */
- if (!workspace)
- return TRUE;
-
- wnck_window = wnck_window_get (GDK_WINDOW_XID (gdk_window));
-
- return wnck_window_is_on_workspace (wnck_window, workspace);
-}
-
-typedef struct {
- EphyWindow *window;
- GCancellable *cancellable;
-
- guint embeds_to_check;
- EphyEmbed *modified_embed;
-} ModifiedFormsData;
-
-static void
-modified_forms_data_free (ModifiedFormsData *data)
-{
- g_object_unref (data->cancellable);
-
- g_slice_free (ModifiedFormsData, data);
-}
-
-static void
-continue_window_close_after_modified_forms_check (ModifiedFormsData *data)
-{
- gboolean should_close;
-
- data->window->priv->checking_modified_forms = FALSE;
-
- if (data->modified_embed)
- {
- /* jump to the first tab with modified forms */
- impl_set_active_child (EPHY_EMBED_CONTAINER (data->window),
- data->modified_embed);
- if (!confirm_close_with_modified_forms (data->window))
- return;
- }
-
- data->window->priv->force_close = TRUE;
- should_close = ephy_window_close (data->window);
- data->window->priv->force_close = FALSE;
- if (should_close)
- gtk_widget_destroy (GTK_WIDGET (data->window));
-}
-
-static void
-has_modified_forms_cb (EphyWebView *view,
- GAsyncResult *result,
- ModifiedFormsData *data)
-{
- gboolean has_modified_forms;
-
- data->embeds_to_check--;
- has_modified_forms = ephy_web_view_has_modified_forms_finish (view, result, NULL);
- if (has_modified_forms)
- {
- /* Cancel all others */
- g_cancellable_cancel (data->cancellable);
- data->modified_embed = EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (view);
- }
-
- if (data->embeds_to_check > 0)
- return;
-
- continue_window_close_after_modified_forms_check (data);
- modified_forms_data_free (data);
-}
-
-static void
-ephy_window_check_modified_forms (EphyWindow *window)
-{
- GList *tabs, *l;
- ModifiedFormsData *data;
-
- window->priv->checking_modified_forms = TRUE;
-
- data = g_slice_new0 (ModifiedFormsData);
- data->window = window;
- data->cancellable = g_cancellable_new ();
- data->embeds_to_check = gtk_notebook_get_n_pages (window->priv->notebook);
-
- tabs = impl_get_children (EPHY_EMBED_CONTAINER (window));
- for (l = tabs; l != NULL; l = l->next)
- {
- EphyEmbed *embed = (EphyEmbed *) l->data;
-
- ephy_web_view_has_modified_forms (ephy_embed_get_web_view (embed),
- data->cancellable,
- (GAsyncReadyCallback)has_modified_forms_cb,
- data);
- }
- g_list_free (tabs);
-}
-
-/**
- * ephy_window_close:
- * @window: an #EphyWindow
- *
- * Try to close the window. The window might refuse to close
- * if there are ongoing download operations or unsubmitted
- * modifed forms.
- *
- * Returns: %TRUE if the window is closed, or %FALSE otherwise
- **/
-gboolean
-ephy_window_close (EphyWindow *window)
-{
- /* We ignore the delete_event if the disable_quit lockdown has been set
- */
- if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
- EPHY_PREFS_LOCKDOWN_QUIT)) return FALSE;
-
- if (window->priv->checking_modified_forms) {
- /* stop window close */
- return FALSE;
- }
-
- if (!window->priv->force_close &&
- g_settings_get_boolean (EPHY_SETTINGS_MAIN,
- EPHY_PREFS_WARN_ON_CLOSE_UNSUBMITTED_DATA) &&
- gtk_notebook_get_n_pages (window->priv->notebook) > 0)
- {
- ephy_window_check_modified_forms (window);
- /* stop window close */
- return FALSE;
- }
-
- if (window_has_ongoing_downloads (window) && confirm_close_with_downloads (window) == FALSE)
- {
- /* stop window close */
- return FALSE;
- }
-
- /* If this is the last window, save its state in the session. */
- if (ephy_shell_get_n_windows (ephy_shell_get_default ()) == 1)
- {
- ephy_session_close (ephy_shell_get_session (ephy_shell_get_default ()));
- }
-
- /* See bug #114689 */
- gtk_widget_hide (GTK_WIDGET (window));
-
- return TRUE;
-}
-
-EphyWindowChrome
-ephy_window_get_chrome (EphyWindow *window)
-{
- g_return_val_if_fail (EPHY_IS_WINDOW (window), EPHY_WINDOW_CHROME_DEFAULT);
-
- return window->priv->chrome;
-}
=== modified file 'ChangeLog'
--- ChangeLog 2015-06-25 06:50:45 +0000
+++ ChangeLog 2015-07-11 21:08:34 +0000
@@ -1,3 +1,73 @@
+commit c9c721640a07f891456f9b03cb8a4c0997fe8335
+Author: Claudio Saavedra
+Date: Thu Jul 9 16:37:00 2015 +0300
+
+ [release] 3.16.3
+
+ NEWS | 8 ++++++++
+ configure.ac | 2 +-
+ 2 files changed, 9 insertions(+), 1 deletion(-)
+
+commit b17a94c66362001f62bd0e09fab51bffa62d45b3
+Author: Michael Catanzaro
+Date: Thu Jul 2 14:04:27 2015 -0500
+
+ Be more careful with weak pointers
+
+ As a follow-up to bug #747422, be careful to remove weak pointers to
+ objects when it appears that the lifetime of the object can outlive the
+ lifetime of the memory location of the pointer.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=751858
+
+ embed/ephy-web-view.c | 6 ++++++
+ embed/web-extension/ephy-web-extension.c | 2 ++
+ 2 files changed, 8 insertions(+)
+
+commit dedbad49530a554b4ccede0d7c2c40481801c93c
+Author: Carlos Garnacho
+Date: Thu Jul 2 15:56:44 2015 +0200
+
+ ephy-web-view: Clean up after outliving web extension proxies
+
+ If the EphyWebView is destroyed before the EphyWebExtensionProxy
+ it's attached to does, we'll leave a dangling weak pointer, which
+ will nullify random memory at the time the web extension proxy
+ is actually destroyed.
+
+ So, prepare for undoing the effects of page_created_cb() in case
+ we ::dispose() when we still have a web extension attached.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=747422
+
+ embed/ephy-web-view.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+commit cd4032bce6abd1bdbe4203660da3c0aab3f3930c
+Author: Michael Catanzaro
+Date: Wed Jul 1 10:05:12 2015 -0500
+
+ Fix translations in the search provider
+
+ src/ephy-search-provider-main.c | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+commit 121b541924c4c0e9927170e285eebe0c2571d941
+Author: Carlos Garcia Campos
+Date: Sat Jun 27 10:41:59 2015 +0200
+
+ webapp: Open links to the same base domain inside the web app
+
+ This fixes the case of web apps like www.foo.com that have a login
+ button that loads login.foo.com. Since we are just checking the hosts,
+ they are different, and the login page is opened in a different browser
+ or profile, making it impossible to login inside the web app. Now, when
+ the hosts are different we also check the base domain, using
+ soup_tld_get_base_domain().
+
+ embed/ephy-embed-utils.c | 20 +++++++++++++++++---
+ 1 file changed, 17 insertions(+), 3 deletions(-)
+
commit dc4db9278bdcd2a6a951bce14fa3454cb7907788
Author: Claudio Saavedra
Date: Tue Jun 23 17:27:55 2015 +0300
=== modified file 'Makefile.in'
--- Makefile.in 2015-06-02 10:42:34 +0000
+++ Makefile.in 2015-07-11 21:08:34 +0000
@@ -85,10 +85,14 @@
TODO compile config.guess config.sub depcomp install-sh \
missing ltmain.sh
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_enable_debug.m4 \
+ $(top_srcdir)/m4/ax_code_coverage.m4 \
+ $(top_srcdir)/m4/gsettings.m4 $(top_srcdir)/m4/intltool.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/yelp.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
=== modified file 'NEWS'
--- NEWS 2015-06-25 06:50:45 +0000
+++ NEWS 2015-07-11 21:08:34 +0000
@@ -1,4 +1,12 @@
===============
+Epiphany 3.16.3
+===============
+
+ - Web applications fixes.
+ - Fix translations in the search provider.
+ - Crashers fixed (#747422, #751858)
+
+===============
Epiphany 3.16.2
===============
=== modified file 'aclocal.m4'
--- aclocal.m4 2015-06-02 10:42:34 +0000
+++ aclocal.m4 2015-07-11 21:08:34 +0000
@@ -20,549 +20,6 @@
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
-# nls.m4 serial 5 (gettext-0.18)
-dnl Copyright (C) 1995-2003, 2005-2006, 2008-2014 Free Software Foundation,
-dnl Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-dnl
-dnl This file can can be used in projects which are not available under
-dnl the GNU General Public License or the GNU Library General Public
-dnl License but which still want to provide support for the GNU gettext
-dnl functionality.
-dnl Please note that the actual code of the GNU gettext library is covered
-dnl by the GNU Library General Public License, and the rest of the GNU
-dnl gettext package package is covered by the GNU General Public License.
-dnl They are *not* in the public domain.
-
-dnl Authors:
-dnl Ulrich Drepper , 1995-2000.
-dnl Bruno Haible , 2000-2003.
-
-AC_PREREQ([2.50])
-
-AC_DEFUN([AM_NLS],
-[
- AC_MSG_CHECKING([whether NLS is requested])
- dnl Default is enabled NLS
- AC_ARG_ENABLE([nls],
- [ --disable-nls do not use Native Language Support],
- USE_NLS=$enableval, USE_NLS=yes)
- AC_MSG_RESULT([$USE_NLS])
- AC_SUBST([USE_NLS])
-])
-
-# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
-# serial 1 (pkg-config-0.24)
-#
-# Copyright © 2004 Scott James Remnant .
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# PKG_PROG_PKG_CONFIG([MIN-VERSION])
-# ----------------------------------
-AC_DEFUN([PKG_PROG_PKG_CONFIG],
-[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
-m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
-m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
-AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
-AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
-AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
-
-if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
- AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
-fi
-if test -n "$PKG_CONFIG"; then
- _pkg_min_version=m4_default([$1], [0.9.0])
- AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
- if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- PKG_CONFIG=""
- fi
-fi[]dnl
-])# PKG_PROG_PKG_CONFIG
-
-# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-#
-# Check to see whether a particular set of modules exists. Similar
-# to PKG_CHECK_MODULES(), but does not set variables or print errors.
-#
-# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-# only at the first occurence in configure.ac, so if the first place
-# it's called might be skipped (such as if it is within an "if", you
-# have to call PKG_CHECK_EXISTS manually
-# --------------------------------------------------------------
-AC_DEFUN([PKG_CHECK_EXISTS],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-if test -n "$PKG_CONFIG" && \
- AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
- m4_default([$2], [:])
-m4_ifvaln([$3], [else
- $3])dnl
-fi])
-
-# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
-# ---------------------------------------------
-m4_define([_PKG_CONFIG],
-[if test -n "$$1"; then
- pkg_cv_[]$1="$$1"
- elif test -n "$PKG_CONFIG"; then
- PKG_CHECK_EXISTS([$3],
- [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
- test "x$?" != "x0" && pkg_failed=yes ],
- [pkg_failed=yes])
- else
- pkg_failed=untried
-fi[]dnl
-])# _PKG_CONFIG
-
-# _PKG_SHORT_ERRORS_SUPPORTED
-# -----------------------------
-AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
- _pkg_short_errors_supported=yes
-else
- _pkg_short_errors_supported=no
-fi[]dnl
-])# _PKG_SHORT_ERRORS_SUPPORTED
-
-
-# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
-# [ACTION-IF-NOT-FOUND])
-#
-#
-# Note that if there is a possibility the first call to
-# PKG_CHECK_MODULES might not happen, you should be sure to include an
-# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
-#
-#
-# --------------------------------------------------------------
-AC_DEFUN([PKG_CHECK_MODULES],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
-AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
-
-pkg_failed=no
-AC_MSG_CHECKING([for $1])
-
-_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
-_PKG_CONFIG([$1][_LIBS], [libs], [$2])
-
-m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
-and $1[]_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.])
-
-if test $pkg_failed = yes; then
- AC_MSG_RESULT([no])
- _PKG_SHORT_ERRORS_SUPPORTED
- if test $_pkg_short_errors_supported = yes; then
- $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
- else
- $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
- fi
- # Put the nasty error message in config.log where it belongs
- echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
-
- m4_default([$4], [AC_MSG_ERROR(
-[Package requirements ($2) were not met:
-
-$$1_PKG_ERRORS
-
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-_PKG_TEXT])[]dnl
- ])
-elif test $pkg_failed = untried; then
- AC_MSG_RESULT([no])
- m4_default([$4], [AC_MSG_FAILURE(
-[The pkg-config script could not be found or is too old. Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-_PKG_TEXT
-
-To get pkg-config, see .])[]dnl
- ])
-else
- $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
- $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
- AC_MSG_RESULT([yes])
- $3
-fi[]dnl
-])# PKG_CHECK_MODULES
-
-
-# PKG_INSTALLDIR(DIRECTORY)
-# -------------------------
-# Substitutes the variable pkgconfigdir as the location where a module
-# should install pkg-config .pc files. By default the directory is
-# $libdir/pkgconfig, but the default can be changed by passing
-# DIRECTORY. The user can override through the --with-pkgconfigdir
-# parameter.
-AC_DEFUN([PKG_INSTALLDIR],
-[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
-m4_pushdef([pkg_description],
- [pkg-config installation directory @<:@]pkg_default[@:>@])
-AC_ARG_WITH([pkgconfigdir],
- [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
- [with_pkgconfigdir=]pkg_default)
-AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
-m4_popdef([pkg_default])
-m4_popdef([pkg_description])
-]) dnl PKG_INSTALLDIR
-
-
-# PKG_NOARCH_INSTALLDIR(DIRECTORY)
-# -------------------------
-# Substitutes the variable noarch_pkgconfigdir as the location where a
-# module should install arch-independent pkg-config .pc files. By
-# default the directory is $datadir/pkgconfig, but the default can be
-# changed by passing DIRECTORY. The user can override through the
-# --with-noarch-pkgconfigdir parameter.
-AC_DEFUN([PKG_NOARCH_INSTALLDIR],
-[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
-m4_pushdef([pkg_description],
- [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
-AC_ARG_WITH([noarch-pkgconfigdir],
- [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
- [with_noarch_pkgconfigdir=]pkg_default)
-AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
-m4_popdef([pkg_default])
-m4_popdef([pkg_description])
-]) dnl PKG_NOARCH_INSTALLDIR
-
-
-# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
-# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-# -------------------------------------------
-# Retrieves the value of the pkg-config variable for the given module.
-AC_DEFUN([PKG_CHECK_VAR],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
-
-_PKG_CONFIG([$1], [variable="][$3]["], [$2])
-AS_VAR_COPY([$1], [pkg_cv_][$1])
-
-AS_VAR_IF([$1], [""], [$5], [$4])dnl
-])# PKG_CHECK_VAR
-
-# ===========================================================================
-# http://autoconf-archive.cryp.to/ax_check_enable_debug.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# Check for the presence of an --enable-debug option to configure and
-# allow/avoid compiled debugging flags appropriately.
-#
-# AX_CHECK_ENABLE_DEBUG([enable by default=yes/info/profile/no],
-# [ENABLE DEBUG VARIABLES …],
-# [DISABLE DEBUG VARIABLES NDEBUG …])
-#
-# DESCRIPTION
-#
-# Check for the presence of an --enable-debug option to configure, with the
-# specified default value used when the option is not present. Return the
-# value in the variable $ax_enable_debug.
-#
-# Specifying 'yes' adds '-g -O0' to the compilation flags for all languages.
-# Specifying 'info' adds '-g' to the compilation flags. Specifying 'profile'
-# adds '-g -pg' to the compilation flags and '-pg' to the linking flags.
-# Otherwise, nothing is added.
-#
-# Define the variables listed in the second argument if debug is enabled,
-# defaulting to no variables. Defines the variables listed in the third
-# argument if debug is disabled, defaulting to NDEBUG. All lists of
-# variables should be space-separated.
-#
-# If debug is not enabled, ensure AC_PROG_* will not add debugging flags.
-# Should be invoked prior to any AC_PROG_* compiler checks.
-#
-# LAST MODIFICATION
-#
-# 2014-05-12
-#
-# COPYLEFT
-#
-# Copyright (c) 2011 Rhys Ulerich
-# Copyright © 2014 Philip Withnall
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice
-# and this notice are preserved.
-
-AC_DEFUN([AX_CHECK_ENABLE_DEBUG],[
- AC_BEFORE([$0],[AC_PROG_CC])dnl
- AC_BEFORE([$0],[AC_PROG_CXX])dnl
- AC_BEFORE([$0],[AC_PROG_F77])dnl
- AC_BEFORE([$0],[AC_PROG_FC])dnl
-
- AC_MSG_CHECKING(whether to enable debugging)
-
- m4_define(ax_enable_debug_default,[m4_tolower(m4_normalize(ifelse([$1],,[no],[$1])))])
- m4_define(ax_enable_debug_vars,[m4_normalize(ifelse([$2],,,[$2]))])
- m4_define(ax_disable_debug_vars,[m4_normalize(ifelse([$3],,[NDEBUG],[$3]))])
-
- AC_ARG_ENABLE(debug,
- [AS_HELP_STRING([--enable-debug]@<:@=ax_enable_debug_default@:>@,[compile with debugging; one of yes/info/profile/no])],
- [],enable_debug=ax_enable_debug_default)
- if test "x$enable_debug" = "xyes" || test "x$enable_debug" = "x"; then
- AC_MSG_RESULT(yes)
- CFLAGS="${CFLAGS} -g -O0"
- CXXFLAGS="${CXXFLAGS} -g -O0"
- FFLAGS="${FFLAGS} -g -O0"
- FCFLAGS="${FCFLAGS} -g -O0"
- OBJCFLAGS="${OBJCFLAGS} -g -O0"
-
- dnl Define various variables if debugging is enabled.
- m4_map_args_w(ax_enable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is enabled])])
- else
- if test "x$enable_debug" = "xinfo"; then
- AC_MSG_RESULT(info)
- CFLAGS="${CFLAGS} -g"
- CXXFLAGS="${CXXFLAGS} -g"
- FFLAGS="${FFLAGS} -g"
- FCFLAGS="${FCFLAGS} -g"
- OBJCFLAGS="${OBJCFLAGS} -g"
- elif test "x$enable_debug" = "xprofile"; then
- AC_MSG_RESULT(profile)
- CFLAGS="${CFLAGS} -g -pg"
- CXXFLAGS="${CXXFLAGS} -g -pg"
- FFLAGS="${FFLAGS} -g -pg"
- FCFLAGS="${FCFLAGS} -g -pg"
- OBJCFLAGS="${OBJCFLAGS} -g -pg"
- LDFLAGS="${LDFLAGS} -pg"
- else
- AC_MSG_RESULT(no)
- dnl Ensure AC_PROG_CC/CXX/F77/FC/OBJC will not enable debug flags
- dnl by setting any unset environment flag variables
- if test "x${CFLAGS+set}" != "xset"; then
- CFLAGS=""
- fi
- if test "x${CXXFLAGS+set}" != "xset"; then
- CXXFLAGS=""
- fi
- if test "x${FFLAGS+set}" != "xset"; then
- FFLAGS=""
- fi
- if test "x${FCFLAGS+set}" != "xset"; then
- FCFLAGS=""
- fi
- if test "x${OBJCFLAGS+set}" != "xset"; then
- OBJCFLAGS=""
- fi
- fi
-
- dnl Define various variables if debugging is disabled.
- dnl assert.h is a NOP if NDEBUG is defined, so define it by default.
- m4_map_args_w(ax_disable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is disabled])])
- fi
- ax_enable_debug=$enable_debug
-])
-
-# SYNOPSIS
-#
-# AX_CODE_COVERAGE()
-#
-# DESCRIPTION
-#
-# Defines CODE_COVERAGE_CFLAGS and CODE_COVERAGE_LDFLAGS which should be
-# included in the CFLAGS and LIBS/LDFLAGS variables of every build target
-# (program or library) which should be built with code coverage support.
-# Also defines CODE_COVERAGE_RULES which should be substituted in your
-# Makefile; and $enable_code_coverage which can be used in subsequent
-# configure output. CODE_COVERAGE_ENABLED is defined and substituted, and
-# corresponds to the value of the --enable-code-coverage option, which
-# defaults to being disabled.
-#
-# Note that all optimisation flags in CFLAGS must be disabled when code
-# coverage is enabled.
-#
-# Usage example:
-# configure.ac:
-# AX_CODE_COVERAGE
-#
-# Makefile.am:
-# @CODE_COVERAGE_RULES@
-# my_program_LIBS = … $(CODE_COVERAGE_LDFLAGS) …
-# my_program_CFLAGS = … $(CODE_COVERAGE_CFLAGS) …
-#
-# This results in a “check-code-coverage” rule being added to any Makefile.am
-# which includes “@CODE_COVERAGE_RULES@” (assuming the module has been
-# configured with --enable-code-coverage). Running `make check-code-coverage`
-# in that directory will run the module’s test suite (`make check`) and build
-# a code coverage report detailing the code which was touched, then print the
-# URI for the report.
-#
-# LICENSE
-#
-# Copyright © 2012, 2014 Philip Withnall
-# Copyright © 2012 Xan Lopez
-# Copyright © 2012 Christian Persch
-# Copyright © 2012 Paolo Borelli
-# Copyright © 2012 Dan Winship
-#
-# Derived from Makefile.decl in GLib, originally licenced under LGPLv2.1+.
-# This file is licenced under LGPLv2.1+.
-
-#serial 1
-
-AC_DEFUN([AX_CODE_COVERAGE],[
- dnl Check for --enable-code-coverage
- AC_MSG_CHECKING([whether to build with code coverage support])
- AC_ARG_ENABLE([code-coverage], AS_HELP_STRING([--enable-code-coverage], [Whether to enable code coverage support]),, enable_code_coverage=no)
- AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes])
- AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage])
- AC_MSG_RESULT($enable_code_coverage)
-
- AS_IF([ test "$enable_code_coverage" = "yes" ], [
- dnl Check if gcc is being used
- AS_IF([ test "$GCC" = "no" ], [
- AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage])
- ])
-
- # List of supported lcov versions.
- lcov_version_list="1.6 1.7 1.8 1.9 1.10 1.11"
-
- AC_CHECK_PROG([LCOV], [lcov], [lcov])
- AC_CHECK_PROG([GENHTML], [genhtml], [genhtml])
-
- AS_IF([ test "$LCOV" ], [
- AC_CACHE_CHECK([for lcov version], ax_cv_lcov_version, [
- ax_cv_lcov_version=invalid
- lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'`
- for lcov_check_version in $lcov_version_list; do
- if test "$lcov_version" = "$lcov_check_version"; then
- ax_cv_lcov_version="$lcov_check_version (ok)"
- fi
- done
- ])
- ], [
- lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list"
- AC_MSG_ERROR([$lcov_msg])
- ])
-
- case $ax_cv_lcov_version in
- ""|invalid[)]
- lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)."
- AC_MSG_ERROR([$lcov_msg])
- LCOV="exit 0;"
- ;;
- esac
-
- AS_IF([ test -z "$GENHTML" ], [
- AC_MSG_ERROR([Could not find genhtml from the lcov package])
- ])
-
- dnl Build the code coverage flags
- CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
- CODE_COVERAGE_LDFLAGS="-lgcov"
-
- AC_SUBST([CODE_COVERAGE_CFLAGS])
- AC_SUBST([CODE_COVERAGE_LDFLAGS])
- ])
-
-CODE_COVERAGE_RULES='
-# Code coverage
-#
-# Optional:
-# - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting.
-# (Default: $(top_builddir))
-# - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated
-# by lcov for code coverage. (Default:
-# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info)
-# - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage
-# reports to be created. (Default:
-# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage)
-# - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the lcov instance.
-# (Default: empty)
-# - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml
-# instance. (Default: empty)
-# - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore
-#
-# The generated report will be titled using the $(PACKAGE_NAME) and
-# $(PACKAGE_VERSION). In order to add the current git hash to the title,
-# use the git-version-gen script, available online.
-
-# Optional variables
-CODE_COVERAGE_DIRECTORY ?= $(top_builddir)
-CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info
-CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage
-CODE_COVERAGE_LCOV_OPTIONS ?=
-CODE_COVERAGE_GENHTML_OPTIONS ?=
-CODE_COVERAGE_IGNORE_PATTERN ?=
-
-code_coverage_quiet = $(code_coverage_quiet_$(V))
-code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY))
-code_coverage_quiet_0 = --quiet
-
-# Use recursive makes in order to ignore errors during check
-check-code-coverage:
-ifeq ($(CODE_COVERAGE_ENABLED),yes)
- -$(MAKE) $(AM_MAKEFLAGS) -k check
- $(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
-else
- @echo "Need to reconfigure with --enable-code-coverage"
-endif
-
-# Capture code coverage data
-code-coverage-capture: code-coverage-capture-hook
-ifeq ($(CODE_COVERAGE_ENABLED),yes)
- $(LCOV) $(code_coverage_quiet) --directory $(CODE_COVERAGE_DIRECTORY) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_OPTIONS)
- $(LCOV) $(code_coverage_quiet) --directory $(CODE_COVERAGE_DIRECTORY) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)"
- -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
- LANG=C $(GENHTML) $(code_coverage_quiet) --prefix $(CODE_COVERAGE_DIRECTORY) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
- @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"
-else
- @echo "Need to reconfigure with --enable-code-coverage"
-endif
-
-# Hook rule executed before code-coverage-capture, overridable by the user
-code-coverage-capture-hook:
-
-ifeq ($(CODE_COVERAGE_ENABLED),yes)
-clean: code-coverage-clean
-code-coverage-clean:
- -$(LCOV) --directory $(top_builddir) -z
- -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY)
- -find . -name "*.gcda" -o -name "*.gcov" -delete
-endif
-
-GITIGNOREFILES ?=
-GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
-
-DISTCHECK_CONFIGURE_FLAGS ?=
-DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage
-
-.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean
-'
-
- AC_SUBST([CODE_COVERAGE_RULES])
- m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])])
-])
-
# Copyright (C) 1995-2002 Free Software Foundation, Inc.
# Copyright (C) 2001-2003,2004 Red Hat, Inc.
#
@@ -1259,304 +716,6 @@
eliminate use of --enable-iso-cxx.
See: http://www.gnu.org/software/autoconf-archive/ax_compiler_flags.html#ax_compiler_flags]])
-dnl GLIB_GSETTINGS
-dnl Defines GSETTINGS_SCHEMAS_INSTALL which controls whether
-dnl the schema should be compiled
-dnl
-
-AC_DEFUN([GLIB_GSETTINGS],
-[
- m4_pattern_allow([AM_V_GEN])
- AC_ARG_ENABLE(schemas-compile,
- AS_HELP_STRING([--disable-schemas-compile],
- [Disable regeneration of gschemas.compiled on install]),
- [case ${enableval} in
- yes) GSETTINGS_DISABLE_SCHEMAS_COMPILE="" ;;
- no) GSETTINGS_DISABLE_SCHEMAS_COMPILE="1" ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-schemas-compile]) ;;
- esac])
- AC_SUBST([GSETTINGS_DISABLE_SCHEMAS_COMPILE])
- PKG_PROG_PKG_CONFIG([0.16])
- AC_SUBST(gsettingsschemadir, [${datadir}/glib-2.0/schemas])
- if test x$cross_compiling != xyes; then
- GLIB_COMPILE_SCHEMAS=`$PKG_CONFIG --variable glib_compile_schemas gio-2.0`
- else
- AC_PATH_PROG(GLIB_COMPILE_SCHEMAS, glib-compile-schemas)
- fi
- AC_SUBST(GLIB_COMPILE_SCHEMAS)
- if test "x$GLIB_COMPILE_SCHEMAS" = "x"; then
- ifelse([$2],,[AC_MSG_ERROR([glib-compile-schemas not found.])],[$2])
- else
- ifelse([$1],,[:],[$1])
- fi
-
- GSETTINGS_RULES='
-.PHONY : uninstall-gsettings-schemas install-gsettings-schemas clean-gsettings-schemas
-
-mostlyclean-am: clean-gsettings-schemas
-
-gsettings__enum_file = $(addsuffix .enums.xml,$(gsettings_ENUM_NAMESPACE))
-
-%.gschema.valid: %.gschema.xml $(gsettings__enum_file)
- $(AM_V_GEN) $(GLIB_COMPILE_SCHEMAS) --strict --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$< && mkdir -p [$](@D) && touch [$]@
-
-all-am: $(gsettings_SCHEMAS:.xml=.valid)
-uninstall-am: uninstall-gsettings-schemas
-install-data-am: install-gsettings-schemas
-
-.SECONDARY: $(gsettings_SCHEMAS)
-
-install-gsettings-schemas: $(gsettings_SCHEMAS) $(gsettings__enum_file)
- @$(NORMAL_INSTALL)
- if test -n "$^"; then \
- test -z "$(gsettingsschemadir)" || $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)"; \
- $(INSTALL_DATA) $^ "$(DESTDIR)$(gsettingsschemadir)"; \
- test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); \
- fi
-
-uninstall-gsettings-schemas:
- @$(NORMAL_UNINSTALL)
- @list='\''$(gsettings_SCHEMAS) $(gsettings__enum_file)'\''; test -n "$(gsettingsschemadir)" || list=; \
- files=`for p in $$list; do echo $$p; done | sed -e '\''s|^.*/||'\''`; \
- test -n "$$files" || exit 0; \
- echo " ( cd '\''$(DESTDIR)$(gsettingsschemadir)'\'' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(gsettingsschemadir)" && rm -f $$files
- test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir)
-
-clean-gsettings-schemas:
- rm -f $(gsettings_SCHEMAS:.xml=.valid) $(gsettings__enum_file)
-
-ifdef gsettings_ENUM_NAMESPACE
-$(gsettings__enum_file): $(gsettings_ENUM_FILES)
- $(AM_V_GEN) glib-mkenums --comments '\'''\'' --fhead "" --vhead " <@type@ id='\''$(gsettings_ENUM_NAMESPACE).@EnumName@'\''>" --vprod " " --vtail " @type@>" --ftail "" [$]^ > [$]@.tmp && mv [$]@.tmp [$]@
-endif
-'
- _GSETTINGS_SUBST(GSETTINGS_RULES)
-])
-
-dnl _GSETTINGS_SUBST(VARIABLE)
-dnl Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST
-AC_DEFUN([_GSETTINGS_SUBST],
-[
-AC_SUBST([$1])
-m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])])
-]
-)
-
-AC_DEFUN([YELP_HELP_INIT],
-[
-AC_REQUIRE([AC_PROG_LN_S])
-m4_pattern_allow([AM_V_at])
-m4_pattern_allow([AM_V_GEN])
-m4_pattern_allow([AM_DEFAULT_VERBOSITY])
-
-YELP_LC_MEDIA_LINKS=true
-YELP_LC_DIST=true
-
-for yelpopt in [$1]; do
- case $yelpopt in
- lc-media-links) YELP_LC_MEDIA_LINKS=true ;;
- no-lc-media-links) YELP_LC_MEDIA_LINKS= ;;
- lc-dist) YELP_LC_DIST=true ;;
- no-lc-dist) YELP_LC_DIST= ;;
- *) AC_MSG_ERROR([Unrecognized [YELP_HELP_INIT] option $yelpopt"]) ;;
- esac
-done;
-AC_SUBST([YELP_LC_MEDIA_LINKS])
-AC_SUBST([YELP_LC_DIST])
-
-AC_ARG_WITH([help-dir],
- AS_HELP_STRING([--with-help-dir=DIR],
- [path where help files are installed]),,
- [with_help_dir='${datadir}/help'])
-HELP_DIR="$with_help_dir"
-AC_SUBST(HELP_DIR)
-
-AC_ARG_VAR([ITSTOOL], [Path to the `itstool` command])
-AC_CHECK_PROG([ITSTOOL], [itstool], [itstool])
-if test x"$ITSTOOL" = x; then
- AC_MSG_ERROR([itstool not found])
-fi
-
-AC_ARG_VAR([XMLLINT], [Path to the `xmllint` command])
-AC_CHECK_PROG([XMLLINT], [xmllint], [xmllint])
-if test x"$XMLLINT" = x; then
- AC_MSG_ERROR([xmllint not found])
-fi
-
-YELP_HELP_RULES='
-HELP_ID ?=
-HELP_POT ?=
-HELP_FILES ?=
-HELP_EXTRA ?=
-HELP_MEDIA ?=
-HELP_LINGUAS ?=
-
-_HELP_LINGUAS = $(if $(filter environment,$(origin LINGUAS)),$(filter $(LINGUAS),$(HELP_LINGUAS)),$(HELP_LINGUAS))
-_HELP_POTFILE = $(if $(HELP_POT),$(HELP_POT),$(if $(HELP_ID),$(HELP_ID).pot))
-_HELP_POFILES = $(if $(HELP_ID),$(foreach lc,$(_HELP_LINGUAS),$(lc)/$(lc).po))
-_HELP_MOFILES = $(patsubst %.po,%.mo,$(_HELP_POFILES))
-_HELP_C_FILES = $(foreach f,$(HELP_FILES),C/$(f))
-_HELP_C_EXTRA = $(foreach f,$(HELP_EXTRA),C/$(f))
-_HELP_C_MEDIA = $(foreach f,$(HELP_MEDIA),C/$(f))
-_HELP_LC_FILES = $(foreach lc,$(_HELP_LINGUAS),$(foreach f,$(HELP_FILES),$(lc)/$(f)))
-_HELP_LC_STAMPS = $(foreach lc,$(_HELP_LINGUAS),$(lc)/$(lc).stamp)
-
-_HELP_DEFAULT_V = $(if $(AM_DEFAULT_VERBOSITY),$(AM_DEFAULT_VERBOSITY),1)
-_HELP_V = $(if $(V),$(V),$(_HELP_DEFAULT_V))
-_HELP_LC_VERBOSE = $(_HELP_LC_VERBOSE_$(_HELP_V))
-_HELP_LC_VERBOSE_ = $(_HELP_LC_VERBOSE_$(_HELP_DEFAULT_V))
-_HELP_LC_VERBOSE_0 = @echo " GEN "$(dir [$]@);
-
-all: $(_HELP_C_FILES) $(_HELP_C_EXTRA) $(_HELP_C_MEDIA) $(_HELP_LC_FILES) $(_HELP_POFILES)
-
-.PHONY: pot
-pot: $(_HELP_POTFILE)
-$(_HELP_POTFILE): $(_HELP_C_FILES) $(_HELP_C_EXTRA) $(_HELP_C_MEDIA)
- $(AM_V_GEN)if test -d "C"; then d=; else d="$(srcdir)/"; fi; \
- $(ITSTOOL) -o "[$]@" $(foreach f,$(_HELP_C_FILES),"$${d}$(f)")
-
-.PHONY: repo
-repo: $(_HELP_POTFILE)
- $(AM_V_at)for po in $(_HELP_POFILES); do \
- if test "x[$](_HELP_V)" = "x0"; then echo " GEN $${po}"; fi; \
- msgmerge -q -o "$${po}" "$${po}" "$(_HELP_POTFILE)"; \
- done
-
-$(_HELP_POFILES):
- $(AM_V_at)if ! test -d "$(dir [$]@)"; then mkdir "$(dir [$]@)"; fi
- $(AM_V_at)if test ! -f "[$]@" -a -f "$(srcdir)/[$]@"; then cp "$(srcdir)/[$]@" "[$]@"; fi
- $(AM_V_GEN)if ! test -f "[$]@"; then \
- (cd "$(dir [$]@)" && \
- $(ITSTOOL) -o "$(notdir [$]@).tmp" $(_HELP_C_FILES) && \
- mv "$(notdir [$]@).tmp" "$(notdir [$]@)"); \
- else \
- (cd "$(dir [$]@)" && \
- $(ITSTOOL) -o "$(notdir [$]@).tmp" $(_HELP_C_FILES) && \
- msgmerge -o "$(notdir [$]@)" "$(notdir [$]@)" "$(notdir [$]@).tmp" && \
- rm "$(notdir [$]@).tmp"); \
- fi
-
-$(_HELP_MOFILES): %.mo: %.po
- $(AM_V_at)if ! test -d "$(dir [$]@)"; then mkdir "$(dir [$]@)"; fi
- $(AM_V_GEN)msgfmt -o "[$]@" "$<"
-
-$(_HELP_LC_FILES): $(_HELP_LINGUAS)
-$(_HELP_LINGUAS): $(_HELP_LC_STAMPS)
-$(_HELP_LC_STAMPS): %.stamp: %.mo
-$(_HELP_LC_STAMPS): $(_HELP_C_FILES) $(_HELP_C_EXTRA)
- $(AM_V_at)if ! test -d "$(dir [$]@)"; then mkdir "$(dir [$]@)"; fi
- $(_HELP_LC_VERBOSE)if test -d "C"; then d="../"; else d="$(abs_srcdir)/"; fi; \
- mo="$(dir [$]@)$(patsubst %/$(notdir [$]@),%,[$]@).mo"; \
- if test -f "$${mo}"; then mo="../$${mo}"; else mo="$(abs_srcdir)/$${mo}"; fi; \
- (cd "$(dir [$]@)" && $(ITSTOOL) -m "$${mo}" $(foreach f,$(_HELP_C_FILES),$${d}/$(f))) && \
- touch "[$]@"
-
-.PHONY: clean-help
-mostlyclean-am: $(if $(HELP_ID),clean-help)
-clean-help:
- rm -f $(_HELP_LC_FILES) $(_HELP_LC_STAMPS) $(_HELP_MOFILES)
-
-EXTRA_DIST ?=
-EXTRA_DIST += $(_HELP_C_EXTRA) $(_HELP_C_MEDIA)
-EXTRA_DIST += $(if $(YELP_LC_DIST),$(foreach lc,$(HELP_LINGUAS),$(lc)/$(lc).stamp))
-EXTRA_DIST += $(foreach lc,$(HELP_LINGUAS),$(lc)/$(lc).po)
-EXTRA_DIST += $(foreach f,$(HELP_MEDIA),$(foreach lc,$(HELP_LINGUAS),$(wildcard $(lc)/$(f))))
-
-distdir: distdir-help-files
-distdir-help-files: $(_HELP_LC_FILES)
- @for lc in C $(if $(YELP_LC_DIST),$(HELP_LINGUAS)) ; do \
- $(MKDIR_P) "$(distdir)/$$lc"; \
- for file in $(HELP_FILES); do \
- if test -f "$$lc/$$file"; then d=./; else d=$(srcdir)/; fi; \
- cp -p "$$d$$lc/$$file" "$(distdir)/$$lc/" || exit 1; \
- done; \
- done; \
-
-.PHONY: check-help
-check: check-help
-check-help:
- for lc in C $(_HELP_LINGUAS); do \
- if test -d "$$lc"; \
- then d=; \
- xmlpath="$$lc"; \
- else \
- d="$(srcdir)/"; \
- xmlpath="$$lc:$(srcdir)/$$lc"; \
- fi; \
- for page in $(HELP_FILES); do \
- echo "$(XMLLINT) --noout --noent --path $$xmlpath --xinclude $$d$$lc/$$page"; \
- $(XMLLINT) --noout --noent --path "$$xmlpath" --xinclude "$$d$$lc/$$page"; \
- done; \
- done
-
-
-.PHONY: install-help
-install-data-am: $(if $(HELP_ID),install-help)
-install-help: $(_HELP_LC_FILES)
- @for lc in C $(_HELP_LINGUAS); do \
- $(mkinstalldirs) "$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)" || exit 1; \
- done
- @for lc in C $(_HELP_LINGUAS); do for f in $(HELP_FILES); do \
- if test -f "$$lc/$$f"; then d=; else d="$(srcdir)/"; fi; \
- helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
- if ! test -d "$$helpdir"; then $(mkinstalldirs) "$$helpdir"; fi; \
- echo "$(INSTALL_DATA) $$d$$lc/$$f $$helpdir`basename $$f`"; \
- $(INSTALL_DATA) "$$d$$lc/$$f" "$$helpdir`basename $$f`" || exit 1; \
- done; done
- @for f in $(_HELP_C_EXTRA); do \
- lc=`dirname "$$f"`; lc=`basename "$$lc"`; \
- if test -f "$$f"; then d=; else d="$(srcdir)/"; fi; \
- helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
- if ! test -d "$$helpdir"; then $(mkinstalldirs) "$$helpdir"; fi; \
- echo "$(INSTALL_DATA) $$d$$f $$helpdir`basename $$f`"; \
- $(INSTALL_DATA) "$$d$$f" "$$helpdir`basename $$f`" || exit 1; \
- done
- @for f in $(HELP_MEDIA); do \
- for lc in C $(_HELP_LINGUAS); do \
- if test -f "$$lc$$f"; then d=; else d="$(srcdir)/"; fi; \
- helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
- mdir=`dirname "$$f"`; \
- if test "x$mdir" = "x."; then mdir=""; fi; \
- if ! test -d "$$helpdir$$mdir"; then $(mkinstalldirs) "$$helpdir$$mdir"; fi; \
- if test -f "$$d$$lc/$$f"; then \
- echo "$(INSTALL_DATA) $$d$$lc/$$f $$helpdir$$f"; \
- $(INSTALL_DATA) "$$d$$lc/$$f" "$$helpdir$$f" || exit 1; \
- elif test "x$$lc" != "xC"; then \
- if test "x$(YELP_LC_MEDIA_LINKS)" != "x"; then \
- echo "$(LN_S) -f $(HELP_DIR)/C/$(HELP_ID)/$$f $$helpdir$$f"; \
- $(LN_S) -f "$(HELP_DIR)/C/$(HELP_ID)/$$f" "$$helpdir$$f" || exit 1; \
- fi; \
- fi; \
- done; \
- done
-
-.PHONY: uninstall-help
-uninstall-am: $(if $(HELP_ID),uninstall-help)
-uninstall-help:
- for lc in C $(_HELP_LINGUAS); do for f in $(HELP_FILES); do \
- helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
- echo "rm -f $$helpdir`basename $$f`"; \
- rm -f "$$helpdir`basename $$f`"; \
- done; done
- @for f in $(_HELP_C_EXTRA); do \
- lc=`dirname "$$f"`; lc=`basename "$$lc"`; \
- helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
- echo "rm -f $$helpdir`basename $$f`"; \
- rm -f "$$helpdir`basename $$f`"; \
- done
- @for f in $(HELP_MEDIA); do \
- for lc in C $(_HELP_LINGUAS); do \
- helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
- echo "rm -f $$helpdir$$f"; \
- rm -f "$$helpdir$$f"; \
- done; \
- done;
-'
-AC_SUBST([YELP_HELP_RULES])
-m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([YELP_HELP_RULES])])
-])
-
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
@@ -2720,9 +1879,15 @@
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
+m4_include([m4/ax_check_enable_debug.m4])
+m4_include([m4/ax_code_coverage.m4])
+m4_include([m4/gsettings.m4])
m4_include([m4/intltool.m4])
m4_include([m4/libtool.m4])
m4_include([m4/ltoptions.m4])
m4_include([m4/ltsugar.m4])
m4_include([m4/ltversion.m4])
m4_include([m4/lt~obsolete.m4])
+m4_include([m4/nls.m4])
+m4_include([m4/pkg.m4])
+m4_include([m4/yelp.m4])
=== modified file 'configure'
--- configure 2015-06-25 06:50:45 +0000
+++ configure 2015-07-11 21:08:34 +0000
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for GNOME Web Browser 3.16.2.
+# Generated by GNU Autoconf 2.69 for GNOME Web Browser 3.16.3.
#
# Report bugs to .
#
@@ -591,8 +591,8 @@
# Identity of this package.
PACKAGE_NAME='GNOME Web Browser'
PACKAGE_TARNAME='epiphany'
-PACKAGE_VERSION='3.16.2'
-PACKAGE_STRING='GNOME Web Browser 3.16.2'
+PACKAGE_VERSION='3.16.3'
+PACKAGE_STRING='GNOME Web Browser 3.16.3'
PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=epiphany'
PACKAGE_URL=''
@@ -1428,7 +1428,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures GNOME Web Browser 3.16.2 to adapt to many kinds of systems.
+\`configure' configures GNOME Web Browser 3.16.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1498,7 +1498,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of GNOME Web Browser 3.16.2:";;
+ short | recursive ) echo "Configuration of GNOME Web Browser 3.16.3:";;
esac
cat <<\_ACEOF
@@ -1636,7 +1636,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-GNOME Web Browser configure 3.16.2
+GNOME Web Browser configure 3.16.3
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2059,7 +2059,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by GNOME Web Browser $as_me 3.16.2, which was
+It was created by GNOME Web Browser $as_me 3.16.3, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2426,7 +2426,7 @@
EPIPHANY_MINOR_VERSION=16
-EPIPHANY_MICRO_VERSION=2
+EPIPHANY_MICRO_VERSION=3
am__api_version='1.14'
@@ -2944,7 +2944,7 @@
# Define the identity of the package.
PACKAGE='epiphany'
- VERSION='3.16.2'
+ VERSION='3.16.3'
cat >>confdefs.h <<_ACEOF
@@ -16861,7 +16861,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by GNOME Web Browser $as_me 3.16.2, which was
+This file was extended by GNOME Web Browser $as_me 3.16.3, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -16927,7 +16927,7 @@
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-GNOME Web Browser config.status 3.16.2
+GNOME Web Browser config.status 3.16.3
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
=== modified file 'configure.ac'
--- configure.ac 2015-06-25 06:50:45 +0000
+++ configure.ac 2015-07-11 21:08:34 +0000
@@ -17,7 +17,7 @@
m4_define([epiphany_version_major],[3])
m4_define([epiphany_version_minor],[16])
-m4_define([epiphany_version_micro],[2])
+m4_define([epiphany_version_micro],[3])
m4_define([epiphany_version],[epiphany_version_major.epiphany_version_minor.epiphany_version_micro])
AC_INIT([GNOME Web Browser],[epiphany_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=epiphany],[epiphany-browser])
=== modified file 'data/Makefile.in'
--- data/Makefile.in 2015-06-02 10:42:34 +0000
+++ data/Makefile.in 2015-07-11 21:08:34 +0000
@@ -82,10 +82,14 @@
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(srcdir)/epiphany.desktop.in.in $(dist_searchprovider_DATA)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_enable_debug.m4 \
+ $(top_srcdir)/m4/ax_code_coverage.m4 \
+ $(top_srcdir)/m4/gsettings.m4 $(top_srcdir)/m4/intltool.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/yelp.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
=== modified file 'data/pages/Makefile.in'
--- data/pages/Makefile.in 2015-06-02 10:42:34 +0000
+++ data/pages/Makefile.in 2015-07-11 21:08:34 +0000
@@ -81,10 +81,14 @@
subdir = data/pages
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_enable_debug.m4 \
+ $(top_srcdir)/m4/ax_code_coverage.m4 \
+ $(top_srcdir)/m4/gsettings.m4 $(top_srcdir)/m4/intltool.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/yelp.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
=== modified file 'debian/changelog'
--- debian/changelog 2015-06-25 06:50:45 +0000
+++ debian/changelog 2015-07-11 21:08:34 +0000
@@ -1,3 +1,24 @@
+epiphany-browser (3.16.3-1ubuntu1) wily; urgency=medium
+
+ * Merge from Debian unstable. Remaining changes:
+ - debian/patches/07_bookmarks.patch:
+ Add Ubuntu-specific default bookmarks, borrowed from Firefox
+ - debian/patches/81_ubuntu_force_update_bookmarks_menu.patch:
+ update the bookmarks menu every time the internal structure
+ is changed (needed for the indicator application menu to work
+ correctly).
+ - debian/patches/ubuntu_titlebars.patch: Use traditional titlebars
+ for non-GNOME sessions
+
+ -- Jackson Doak Sun, 12 Jul 2015 06:44:28 +1000
+
+epiphany-browser (3.16.3-1) unstable; urgency=medium
+
+ * New upstream release.
+ * Refresh patches.
+
+ -- Michael Biebl Fri, 10 Jul 2015 22:44:38 +0200
+
epiphany-browser (3.16.2-1ubuntu1) wily; urgency=medium
* Merge from Debian unstable. Remaining changes:
=== modified file 'debian/control'
--- debian/control 2015-06-25 06:50:45 +0000
+++ debian/control 2015-07-11 21:08:34 +0000
@@ -7,7 +7,7 @@
Priority: optional
Maintainer: Ubuntu Developers
XSBC-Original-Maintainer: Debian GNOME Maintainers
-Uploaders: Andreas Henriksson , Debian GNOME Maintainers , Laurent Bigonville , Michael Biebl , Sjoerd Simons
+Uploaders: Andreas Henriksson , Laurent Bigonville , Michael Biebl , Sjoerd Simons
Build-Depends: debhelper (>= 9),
cdbs (>= 0.4.90),
dh-autoreconf,
=== modified file 'debian/patches/00_epiphany-browser.patch'
--- debian/patches/00_epiphany-browser.patch 2015-06-25 06:50:45 +0000
+++ debian/patches/00_epiphany-browser.patch 2015-07-11 21:08:34 +0000
@@ -1,9 +1,9 @@
-Index: epiphany-3.16.2/configure.ac
+Index: epiphany-3.16.3/configure.ac
===================================================================
---- epiphany-3.16.2.orig/configure.ac 2015-06-23 22:43:39.487168856 +0200
-+++ epiphany-3.16.2/configure.ac 2015-06-23 22:43:39.483167308 +0200
+--- epiphany-3.16.3.orig/configure.ac 2015-07-10 22:41:38.821564468 +0200
++++ epiphany-3.16.3/configure.ac 2015-07-10 22:41:38.817564370 +0200
@@ -20,7 +20,7 @@
- m4_define([epiphany_version_micro],[2])
+ m4_define([epiphany_version_micro],[3])
m4_define([epiphany_version],[epiphany_version_major.epiphany_version_minor.epiphany_version_micro])
-AC_INIT([GNOME Web Browser],[epiphany_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=epiphany],[epiphany])
=== modified file 'doc/Makefile.in'
--- doc/Makefile.in 2015-06-02 10:42:34 +0000
+++ doc/Makefile.in 2015-07-11 21:08:34 +0000
@@ -80,10 +80,14 @@
subdir = doc
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_enable_debug.m4 \
+ $(top_srcdir)/m4/ax_code_coverage.m4 \
+ $(top_srcdir)/m4/gsettings.m4 $(top_srcdir)/m4/intltool.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/yelp.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
=== modified file 'embed/Makefile.in'
--- embed/Makefile.in 2015-06-02 10:42:34 +0000
+++ embed/Makefile.in 2015-07-11 21:08:34 +0000
@@ -82,10 +82,14 @@
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_enable_debug.m4 \
+ $(top_srcdir)/m4/ax_code_coverage.m4 \
+ $(top_srcdir)/m4/gsettings.m4 $(top_srcdir)/m4/intltool.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/yelp.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
=== modified file 'embed/ephy-embed-utils.c'
--- embed/ephy-embed-utils.c 2015-06-02 10:42:34 +0000
+++ embed/ephy-embed-utils.c 2015-07-11 21:08:34 +0000
@@ -315,12 +315,26 @@
return retval;
b_uri = soup_uri_new (b_url);
- if (b_uri) {
- retval = a_uri->host && b_uri->host && soup_uri_host_equal (a_uri, b_uri);
- soup_uri_free (b_uri);
+ if (!b_uri) {
+ soup_uri_free (a_uri);
+ return retval;
+ }
+
+ if (a_uri->host && b_uri->host) {
+ retval = soup_uri_host_equal (a_uri, b_uri);
+ if (!retval) {
+ const char *a_domain;
+ const char *b_domain;
+
+ a_domain = soup_tld_get_base_domain (a_uri->host, NULL);
+ b_domain = soup_tld_get_base_domain (b_uri->host, NULL);
+
+ retval = a_domain && b_domain && strcmp (a_domain, b_domain) == 0;
+ }
}
soup_uri_free (a_uri);
+ soup_uri_free (b_uri);
return retval;
}
=== modified file 'embed/ephy-web-view.c'
--- embed/ephy-web-view.c 2015-06-02 10:42:34 +0000
+++ embed/ephy-web-view.c 2015-07-11 21:08:34 +0000
@@ -748,6 +748,18 @@
{
EphyWebViewPrivate *priv = EPHY_WEB_VIEW (object)->priv;
+ if (priv->web_extension)
+ {
+ g_object_remove_weak_pointer (G_OBJECT (priv->web_extension), (gpointer *)&priv->web_extension);
+ priv->web_extension = NULL;
+ }
+
+ if (priv->password_info_bar)
+ {
+ g_object_remove_weak_pointer (G_OBJECT (priv->password_info_bar), (gpointer *)&priv->password_info_bar);
+ priv->password_info_bar = NULL;
+ }
+
g_signal_handlers_disconnect_by_func (priv->history_service,
ephy_web_view_history_cleared_cb,
EPHY_WEB_VIEW (object));
=== modified file 'embed/web-extension/Makefile.in'
--- embed/web-extension/Makefile.in 2015-06-02 10:42:34 +0000
+++ embed/web-extension/Makefile.in 2015-07-11 21:08:34 +0000
@@ -82,10 +82,14 @@
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_enable_debug.m4 \
+ $(top_srcdir)/m4/ax_code_coverage.m4 \
+ $(top_srcdir)/m4/gsettings.m4 $(top_srcdir)/m4/intltool.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/yelp.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
=== modified file 'embed/web-extension/ephy-web-extension.c'
--- embed/web-extension/ephy-web-extension.c 2015-06-25 06:50:45 +0000
+++ embed/web-extension/ephy-web-extension.c 2015-07-11 21:08:34 +0000
@@ -1260,6 +1260,8 @@
}
if (extension->priv->dbus_connection) {
+ g_object_remove_weak_pointer (G_OBJECT (extension->priv->dbus_connection),
+ (gpointer *)&extension->priv->dbus_connection);
g_dbus_connection_unregister_object (extension->priv->dbus_connection,
extension->priv->registration_id);
extension->priv->registration_id = 0;
=== modified file 'help/Makefile.in'
--- help/Makefile.in 2015-06-02 10:42:34 +0000
+++ help/Makefile.in 2015-07-11 21:08:34 +0000
@@ -80,10 +80,14 @@
subdir = help
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_enable_debug.m4 \
+ $(top_srcdir)/m4/ax_code_coverage.m4 \
+ $(top_srcdir)/m4/gsettings.m4 $(top_srcdir)/m4/intltool.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/yelp.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
=== modified file 'lib/Makefile.in'
--- lib/Makefile.in 2015-06-02 10:42:34 +0000
+++ lib/Makefile.in 2015-07-11 21:08:34 +0000
@@ -89,10 +89,14 @@
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_enable_debug.m4 \
+ $(top_srcdir)/m4/ax_code_coverage.m4 \
+ $(top_srcdir)/m4/gsettings.m4 $(top_srcdir)/m4/intltool.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/yelp.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
=== modified file 'lib/egg/Makefile.in'
--- lib/egg/Makefile.in 2015-06-02 10:42:34 +0000
+++ lib/egg/Makefile.in 2015-07-11 21:08:34 +0000
@@ -83,10 +83,14 @@
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp $(noinst_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_enable_debug.m4 \
+ $(top_srcdir)/m4/ax_code_coverage.m4 \
+ $(top_srcdir)/m4/gsettings.m4 $(top_srcdir)/m4/intltool.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/yelp.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
=== modified file 'lib/history/Makefile.in'
--- lib/history/Makefile.in 2015-06-02 10:42:34 +0000
+++ lib/history/Makefile.in 2015-07-11 21:08:34 +0000
@@ -82,10 +82,14 @@
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_enable_debug.m4 \
+ $(top_srcdir)/m4/ax_code_coverage.m4 \
+ $(top_srcdir)/m4/gsettings.m4 $(top_srcdir)/m4/intltool.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/yelp.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
=== modified file 'lib/widgets/Makefile.in'
--- lib/widgets/Makefile.in 2015-06-02 10:42:34 +0000
+++ lib/widgets/Makefile.in 2015-07-11 21:08:34 +0000
@@ -82,10 +82,14 @@
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_enable_debug.m4 \
+ $(top_srcdir)/m4/ax_code_coverage.m4 \
+ $(top_srcdir)/m4/gsettings.m4 $(top_srcdir)/m4/intltool.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/yelp.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
=== added file 'm4/ax_check_enable_debug.m4'
--- m4/ax_check_enable_debug.m4 1970-01-01 00:00:00 +0000
+++ m4/ax_check_enable_debug.m4 2015-07-11 21:08:34 +0000
@@ -0,0 +1,113 @@
+# ===========================================================================
+# http://autoconf-archive.cryp.to/ax_check_enable_debug.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# Check for the presence of an --enable-debug option to configure and
+# allow/avoid compiled debugging flags appropriately.
+#
+# AX_CHECK_ENABLE_DEBUG([enable by default=yes/info/profile/no],
+# [ENABLE DEBUG VARIABLES …],
+# [DISABLE DEBUG VARIABLES NDEBUG …])
+#
+# DESCRIPTION
+#
+# Check for the presence of an --enable-debug option to configure, with the
+# specified default value used when the option is not present. Return the
+# value in the variable $ax_enable_debug.
+#
+# Specifying 'yes' adds '-g -O0' to the compilation flags for all languages.
+# Specifying 'info' adds '-g' to the compilation flags. Specifying 'profile'
+# adds '-g -pg' to the compilation flags and '-pg' to the linking flags.
+# Otherwise, nothing is added.
+#
+# Define the variables listed in the second argument if debug is enabled,
+# defaulting to no variables. Defines the variables listed in the third
+# argument if debug is disabled, defaulting to NDEBUG. All lists of
+# variables should be space-separated.
+#
+# If debug is not enabled, ensure AC_PROG_* will not add debugging flags.
+# Should be invoked prior to any AC_PROG_* compiler checks.
+#
+# LAST MODIFICATION
+#
+# 2014-05-12
+#
+# COPYLEFT
+#
+# Copyright (c) 2011 Rhys Ulerich
+# Copyright © 2014 Philip Withnall
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved.
+
+AC_DEFUN([AX_CHECK_ENABLE_DEBUG],[
+ AC_BEFORE([$0],[AC_PROG_CC])dnl
+ AC_BEFORE([$0],[AC_PROG_CXX])dnl
+ AC_BEFORE([$0],[AC_PROG_F77])dnl
+ AC_BEFORE([$0],[AC_PROG_FC])dnl
+
+ AC_MSG_CHECKING(whether to enable debugging)
+
+ m4_define(ax_enable_debug_default,[m4_tolower(m4_normalize(ifelse([$1],,[no],[$1])))])
+ m4_define(ax_enable_debug_vars,[m4_normalize(ifelse([$2],,,[$2]))])
+ m4_define(ax_disable_debug_vars,[m4_normalize(ifelse([$3],,[NDEBUG],[$3]))])
+
+ AC_ARG_ENABLE(debug,
+ [AS_HELP_STRING([--enable-debug]@<:@=ax_enable_debug_default@:>@,[compile with debugging; one of yes/info/profile/no])],
+ [],enable_debug=ax_enable_debug_default)
+ if test "x$enable_debug" = "xyes" || test "x$enable_debug" = "x"; then
+ AC_MSG_RESULT(yes)
+ CFLAGS="${CFLAGS} -g -O0"
+ CXXFLAGS="${CXXFLAGS} -g -O0"
+ FFLAGS="${FFLAGS} -g -O0"
+ FCFLAGS="${FCFLAGS} -g -O0"
+ OBJCFLAGS="${OBJCFLAGS} -g -O0"
+
+ dnl Define various variables if debugging is enabled.
+ m4_map_args_w(ax_enable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is enabled])])
+ else
+ if test "x$enable_debug" = "xinfo"; then
+ AC_MSG_RESULT(info)
+ CFLAGS="${CFLAGS} -g"
+ CXXFLAGS="${CXXFLAGS} -g"
+ FFLAGS="${FFLAGS} -g"
+ FCFLAGS="${FCFLAGS} -g"
+ OBJCFLAGS="${OBJCFLAGS} -g"
+ elif test "x$enable_debug" = "xprofile"; then
+ AC_MSG_RESULT(profile)
+ CFLAGS="${CFLAGS} -g -pg"
+ CXXFLAGS="${CXXFLAGS} -g -pg"
+ FFLAGS="${FFLAGS} -g -pg"
+ FCFLAGS="${FCFLAGS} -g -pg"
+ OBJCFLAGS="${OBJCFLAGS} -g -pg"
+ LDFLAGS="${LDFLAGS} -pg"
+ else
+ AC_MSG_RESULT(no)
+ dnl Ensure AC_PROG_CC/CXX/F77/FC/OBJC will not enable debug flags
+ dnl by setting any unset environment flag variables
+ if test "x${CFLAGS+set}" != "xset"; then
+ CFLAGS=""
+ fi
+ if test "x${CXXFLAGS+set}" != "xset"; then
+ CXXFLAGS=""
+ fi
+ if test "x${FFLAGS+set}" != "xset"; then
+ FFLAGS=""
+ fi
+ if test "x${FCFLAGS+set}" != "xset"; then
+ FCFLAGS=""
+ fi
+ if test "x${OBJCFLAGS+set}" != "xset"; then
+ OBJCFLAGS=""
+ fi
+ fi
+
+ dnl Define various variables if debugging is disabled.
+ dnl assert.h is a NOP if NDEBUG is defined, so define it by default.
+ m4_map_args_w(ax_disable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is disabled])])
+ fi
+ ax_enable_debug=$enable_debug
+])
=== added file 'm4/ax_code_coverage.m4'
--- m4/ax_code_coverage.m4 1970-01-01 00:00:00 +0000
+++ m4/ax_code_coverage.m4 2015-07-11 21:08:34 +0000
@@ -0,0 +1,180 @@
+# SYNOPSIS
+#
+# AX_CODE_COVERAGE()
+#
+# DESCRIPTION
+#
+# Defines CODE_COVERAGE_CFLAGS and CODE_COVERAGE_LDFLAGS which should be
+# included in the CFLAGS and LIBS/LDFLAGS variables of every build target
+# (program or library) which should be built with code coverage support.
+# Also defines CODE_COVERAGE_RULES which should be substituted in your
+# Makefile; and $enable_code_coverage which can be used in subsequent
+# configure output. CODE_COVERAGE_ENABLED is defined and substituted, and
+# corresponds to the value of the --enable-code-coverage option, which
+# defaults to being disabled.
+#
+# Note that all optimisation flags in CFLAGS must be disabled when code
+# coverage is enabled.
+#
+# Usage example:
+# configure.ac:
+# AX_CODE_COVERAGE
+#
+# Makefile.am:
+# @CODE_COVERAGE_RULES@
+# my_program_LIBS = … $(CODE_COVERAGE_LDFLAGS) …
+# my_program_CFLAGS = … $(CODE_COVERAGE_CFLAGS) …
+#
+# This results in a “check-code-coverage” rule being added to any Makefile.am
+# which includes “@CODE_COVERAGE_RULES@” (assuming the module has been
+# configured with --enable-code-coverage). Running `make check-code-coverage`
+# in that directory will run the module’s test suite (`make check`) and build
+# a code coverage report detailing the code which was touched, then print the
+# URI for the report.
+#
+# LICENSE
+#
+# Copyright © 2012, 2014 Philip Withnall
+# Copyright © 2012 Xan Lopez
+# Copyright © 2012 Christian Persch
+# Copyright © 2012 Paolo Borelli
+# Copyright © 2012 Dan Winship
+#
+# Derived from Makefile.decl in GLib, originally licenced under LGPLv2.1+.
+# This file is licenced under LGPLv2.1+.
+
+#serial 1
+
+AC_DEFUN([AX_CODE_COVERAGE],[
+ dnl Check for --enable-code-coverage
+ AC_MSG_CHECKING([whether to build with code coverage support])
+ AC_ARG_ENABLE([code-coverage], AS_HELP_STRING([--enable-code-coverage], [Whether to enable code coverage support]),, enable_code_coverage=no)
+ AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes])
+ AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage])
+ AC_MSG_RESULT($enable_code_coverage)
+
+ AS_IF([ test "$enable_code_coverage" = "yes" ], [
+ dnl Check if gcc is being used
+ AS_IF([ test "$GCC" = "no" ], [
+ AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage])
+ ])
+
+ # List of supported lcov versions.
+ lcov_version_list="1.6 1.7 1.8 1.9 1.10 1.11"
+
+ AC_CHECK_PROG([LCOV], [lcov], [lcov])
+ AC_CHECK_PROG([GENHTML], [genhtml], [genhtml])
+
+ AS_IF([ test "$LCOV" ], [
+ AC_CACHE_CHECK([for lcov version], ax_cv_lcov_version, [
+ ax_cv_lcov_version=invalid
+ lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'`
+ for lcov_check_version in $lcov_version_list; do
+ if test "$lcov_version" = "$lcov_check_version"; then
+ ax_cv_lcov_version="$lcov_check_version (ok)"
+ fi
+ done
+ ])
+ ], [
+ lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list"
+ AC_MSG_ERROR([$lcov_msg])
+ ])
+
+ case $ax_cv_lcov_version in
+ ""|invalid[)]
+ lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)."
+ AC_MSG_ERROR([$lcov_msg])
+ LCOV="exit 0;"
+ ;;
+ esac
+
+ AS_IF([ test -z "$GENHTML" ], [
+ AC_MSG_ERROR([Could not find genhtml from the lcov package])
+ ])
+
+ dnl Build the code coverage flags
+ CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
+ CODE_COVERAGE_LDFLAGS="-lgcov"
+
+ AC_SUBST([CODE_COVERAGE_CFLAGS])
+ AC_SUBST([CODE_COVERAGE_LDFLAGS])
+ ])
+
+CODE_COVERAGE_RULES='
+# Code coverage
+#
+# Optional:
+# - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting.
+# (Default: $(top_builddir))
+# - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated
+# by lcov for code coverage. (Default:
+# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info)
+# - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage
+# reports to be created. (Default:
+# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage)
+# - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the lcov instance.
+# (Default: empty)
+# - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml
+# instance. (Default: empty)
+# - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore
+#
+# The generated report will be titled using the $(PACKAGE_NAME) and
+# $(PACKAGE_VERSION). In order to add the current git hash to the title,
+# use the git-version-gen script, available online.
+
+# Optional variables
+CODE_COVERAGE_DIRECTORY ?= $(top_builddir)
+CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info
+CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage
+CODE_COVERAGE_LCOV_OPTIONS ?=
+CODE_COVERAGE_GENHTML_OPTIONS ?=
+CODE_COVERAGE_IGNORE_PATTERN ?=
+
+code_coverage_quiet = $(code_coverage_quiet_$(V))
+code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY))
+code_coverage_quiet_0 = --quiet
+
+# Use recursive makes in order to ignore errors during check
+check-code-coverage:
+ifeq ($(CODE_COVERAGE_ENABLED),yes)
+ -$(MAKE) $(AM_MAKEFLAGS) -k check
+ $(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
+else
+ @echo "Need to reconfigure with --enable-code-coverage"
+endif
+
+# Capture code coverage data
+code-coverage-capture: code-coverage-capture-hook
+ifeq ($(CODE_COVERAGE_ENABLED),yes)
+ $(LCOV) $(code_coverage_quiet) --directory $(CODE_COVERAGE_DIRECTORY) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_OPTIONS)
+ $(LCOV) $(code_coverage_quiet) --directory $(CODE_COVERAGE_DIRECTORY) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)"
+ -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
+ LANG=C $(GENHTML) $(code_coverage_quiet) --prefix $(CODE_COVERAGE_DIRECTORY) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
+ @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"
+else
+ @echo "Need to reconfigure with --enable-code-coverage"
+endif
+
+# Hook rule executed before code-coverage-capture, overridable by the user
+code-coverage-capture-hook:
+
+ifeq ($(CODE_COVERAGE_ENABLED),yes)
+clean: code-coverage-clean
+code-coverage-clean:
+ -$(LCOV) --directory $(top_builddir) -z
+ -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY)
+ -find . -name "*.gcda" -o -name "*.gcov" -delete
+endif
+
+GITIGNOREFILES ?=
+GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
+
+DISTCHECK_CONFIGURE_FLAGS ?=
+DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage
+
+.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean
+'
+
+ AC_SUBST([CODE_COVERAGE_RULES])
+ m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])])
+])
=== added file 'm4/gsettings.m4'
--- m4/gsettings.m4 1970-01-01 00:00:00 +0000
+++ m4/gsettings.m4 2015-07-11 21:08:34 +0000
@@ -0,0 +1,83 @@
+dnl GLIB_GSETTINGS
+dnl Defines GSETTINGS_SCHEMAS_INSTALL which controls whether
+dnl the schema should be compiled
+dnl
+
+AC_DEFUN([GLIB_GSETTINGS],
+[
+ m4_pattern_allow([AM_V_GEN])
+ AC_ARG_ENABLE(schemas-compile,
+ AS_HELP_STRING([--disable-schemas-compile],
+ [Disable regeneration of gschemas.compiled on install]),
+ [case ${enableval} in
+ yes) GSETTINGS_DISABLE_SCHEMAS_COMPILE="" ;;
+ no) GSETTINGS_DISABLE_SCHEMAS_COMPILE="1" ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-schemas-compile]) ;;
+ esac])
+ AC_SUBST([GSETTINGS_DISABLE_SCHEMAS_COMPILE])
+ PKG_PROG_PKG_CONFIG([0.16])
+ AC_SUBST(gsettingsschemadir, [${datadir}/glib-2.0/schemas])
+ if test x$cross_compiling != xyes; then
+ GLIB_COMPILE_SCHEMAS=`$PKG_CONFIG --variable glib_compile_schemas gio-2.0`
+ else
+ AC_PATH_PROG(GLIB_COMPILE_SCHEMAS, glib-compile-schemas)
+ fi
+ AC_SUBST(GLIB_COMPILE_SCHEMAS)
+ if test "x$GLIB_COMPILE_SCHEMAS" = "x"; then
+ ifelse([$2],,[AC_MSG_ERROR([glib-compile-schemas not found.])],[$2])
+ else
+ ifelse([$1],,[:],[$1])
+ fi
+
+ GSETTINGS_RULES='
+.PHONY : uninstall-gsettings-schemas install-gsettings-schemas clean-gsettings-schemas
+
+mostlyclean-am: clean-gsettings-schemas
+
+gsettings__enum_file = $(addsuffix .enums.xml,$(gsettings_ENUM_NAMESPACE))
+
+%.gschema.valid: %.gschema.xml $(gsettings__enum_file)
+ $(AM_V_GEN) $(GLIB_COMPILE_SCHEMAS) --strict --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$< && mkdir -p [$](@D) && touch [$]@
+
+all-am: $(gsettings_SCHEMAS:.xml=.valid)
+uninstall-am: uninstall-gsettings-schemas
+install-data-am: install-gsettings-schemas
+
+.SECONDARY: $(gsettings_SCHEMAS)
+
+install-gsettings-schemas: $(gsettings_SCHEMAS) $(gsettings__enum_file)
+ @$(NORMAL_INSTALL)
+ if test -n "$^"; then \
+ test -z "$(gsettingsschemadir)" || $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)"; \
+ $(INSTALL_DATA) $^ "$(DESTDIR)$(gsettingsschemadir)"; \
+ test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); \
+ fi
+
+uninstall-gsettings-schemas:
+ @$(NORMAL_UNINSTALL)
+ @list='\''$(gsettings_SCHEMAS) $(gsettings__enum_file)'\''; test -n "$(gsettingsschemadir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e '\''s|^.*/||'\''`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '\''$(DESTDIR)$(gsettingsschemadir)'\'' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(gsettingsschemadir)" && rm -f $$files
+ test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir)
+
+clean-gsettings-schemas:
+ rm -f $(gsettings_SCHEMAS:.xml=.valid) $(gsettings__enum_file)
+
+ifdef gsettings_ENUM_NAMESPACE
+$(gsettings__enum_file): $(gsettings_ENUM_FILES)
+ $(AM_V_GEN) glib-mkenums --comments '\'''\'' --fhead "" --vhead " <@type@ id='\''$(gsettings_ENUM_NAMESPACE).@EnumName@'\''>" --vprod " " --vtail " @type@>" --ftail "" [$]^ > [$]@.tmp && mv [$]@.tmp [$]@
+endif
+'
+ _GSETTINGS_SUBST(GSETTINGS_RULES)
+])
+
+dnl _GSETTINGS_SUBST(VARIABLE)
+dnl Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST
+AC_DEFUN([_GSETTINGS_SUBST],
+[
+AC_SUBST([$1])
+m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])])
+]
+)
=== added file 'm4/nls.m4'
--- m4/nls.m4 1970-01-01 00:00:00 +0000
+++ m4/nls.m4 2015-07-11 21:08:34 +0000
@@ -0,0 +1,32 @@
+# nls.m4 serial 5 (gettext-0.18)
+dnl Copyright (C) 1995-2003, 2005-2006, 2008-2014 Free Software Foundation,
+dnl Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl Ulrich Drepper , 1995-2000.
+dnl Bruno Haible , 2000-2003.
+
+AC_PREREQ([2.50])
+
+AC_DEFUN([AM_NLS],
+[
+ AC_MSG_CHECKING([whether NLS is requested])
+ dnl Default is enabled NLS
+ AC_ARG_ENABLE([nls],
+ [ --disable-nls do not use Native Language Support],
+ USE_NLS=$enableval, USE_NLS=yes)
+ AC_MSG_RESULT([$USE_NLS])
+ AC_SUBST([USE_NLS])
+])
=== added file 'm4/pkg.m4'
--- m4/pkg.m4 1970-01-01 00:00:00 +0000
+++ m4/pkg.m4 2015-07-11 21:08:34 +0000
@@ -0,0 +1,214 @@
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
+#
+# Copyright © 2004 Scott James Remnant .
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=m4_default([$1], [0.9.0])
+ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ PKG_CONFIG=""
+ fi
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists. Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+# only at the first occurence in configure.ac, so if the first place
+# it's called might be skipped (such as if it is within an "if", you
+# have to call PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+ m4_default([$2], [:])
+m4_ifvaln([$3], [else
+ $3])dnl
+fi])
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+ pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+ PKG_CHECK_EXISTS([$3],
+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes ],
+ [pkg_failed=yes])
+ else
+ pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+ AC_MSG_RESULT([no])
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
+ else
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+ m4_default([$4], [AC_MSG_ERROR(
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT])[]dnl
+ ])
+elif test $pkg_failed = untried; then
+ AC_MSG_RESULT([no])
+ m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see .])[]dnl
+ ])
+else
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ AC_MSG_RESULT([yes])
+ $3
+fi[]dnl
+])# PKG_CHECK_MODULES
+
+
+# PKG_INSTALLDIR(DIRECTORY)
+# -------------------------
+# Substitutes the variable pkgconfigdir as the location where a module
+# should install pkg-config .pc files. By default the directory is
+# $libdir/pkgconfig, but the default can be changed by passing
+# DIRECTORY. The user can override through the --with-pkgconfigdir
+# parameter.
+AC_DEFUN([PKG_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+ [pkg-config installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([pkgconfigdir],
+ [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
+ [with_pkgconfigdir=]pkg_default)
+AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+]) dnl PKG_INSTALLDIR
+
+
+# PKG_NOARCH_INSTALLDIR(DIRECTORY)
+# -------------------------
+# Substitutes the variable noarch_pkgconfigdir as the location where a
+# module should install arch-independent pkg-config .pc files. By
+# default the directory is $datadir/pkgconfig, but the default can be
+# changed by passing DIRECTORY. The user can override through the
+# --with-noarch-pkgconfigdir parameter.
+AC_DEFUN([PKG_NOARCH_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+ [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([noarch-pkgconfigdir],
+ [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
+ [with_noarch_pkgconfigdir=]pkg_default)
+AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+]) dnl PKG_NOARCH_INSTALLDIR
+
+
+# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
+# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# -------------------------------------------
+# Retrieves the value of the pkg-config variable for the given module.
+AC_DEFUN([PKG_CHECK_VAR],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
+
+_PKG_CONFIG([$1], [variable="][$3]["], [$2])
+AS_VAR_COPY([$1], [pkg_cv_][$1])
+
+AS_VAR_IF([$1], [""], [$5], [$4])dnl
+])# PKG_CHECK_VAR
=== added file 'm4/yelp.m4'
--- m4/yelp.m4 1970-01-01 00:00:00 +0000
+++ m4/yelp.m4 2015-07-11 21:08:34 +0000
@@ -0,0 +1,213 @@
+AC_DEFUN([YELP_HELP_INIT],
+[
+AC_REQUIRE([AC_PROG_LN_S])
+m4_pattern_allow([AM_V_at])
+m4_pattern_allow([AM_V_GEN])
+m4_pattern_allow([AM_DEFAULT_VERBOSITY])
+
+YELP_LC_MEDIA_LINKS=true
+YELP_LC_DIST=true
+
+for yelpopt in [$1]; do
+ case $yelpopt in
+ lc-media-links) YELP_LC_MEDIA_LINKS=true ;;
+ no-lc-media-links) YELP_LC_MEDIA_LINKS= ;;
+ lc-dist) YELP_LC_DIST=true ;;
+ no-lc-dist) YELP_LC_DIST= ;;
+ *) AC_MSG_ERROR([Unrecognized [YELP_HELP_INIT] option $yelpopt"]) ;;
+ esac
+done;
+AC_SUBST([YELP_LC_MEDIA_LINKS])
+AC_SUBST([YELP_LC_DIST])
+
+AC_ARG_WITH([help-dir],
+ AS_HELP_STRING([--with-help-dir=DIR],
+ [path where help files are installed]),,
+ [with_help_dir='${datadir}/help'])
+HELP_DIR="$with_help_dir"
+AC_SUBST(HELP_DIR)
+
+AC_ARG_VAR([ITSTOOL], [Path to the `itstool` command])
+AC_CHECK_PROG([ITSTOOL], [itstool], [itstool])
+if test x"$ITSTOOL" = x; then
+ AC_MSG_ERROR([itstool not found])
+fi
+
+AC_ARG_VAR([XMLLINT], [Path to the `xmllint` command])
+AC_CHECK_PROG([XMLLINT], [xmllint], [xmllint])
+if test x"$XMLLINT" = x; then
+ AC_MSG_ERROR([xmllint not found])
+fi
+
+YELP_HELP_RULES='
+HELP_ID ?=
+HELP_POT ?=
+HELP_FILES ?=
+HELP_EXTRA ?=
+HELP_MEDIA ?=
+HELP_LINGUAS ?=
+
+_HELP_LINGUAS = $(if $(filter environment,$(origin LINGUAS)),$(filter $(LINGUAS),$(HELP_LINGUAS)),$(HELP_LINGUAS))
+_HELP_POTFILE = $(if $(HELP_POT),$(HELP_POT),$(if $(HELP_ID),$(HELP_ID).pot))
+_HELP_POFILES = $(if $(HELP_ID),$(foreach lc,$(_HELP_LINGUAS),$(lc)/$(lc).po))
+_HELP_MOFILES = $(patsubst %.po,%.mo,$(_HELP_POFILES))
+_HELP_C_FILES = $(foreach f,$(HELP_FILES),C/$(f))
+_HELP_C_EXTRA = $(foreach f,$(HELP_EXTRA),C/$(f))
+_HELP_C_MEDIA = $(foreach f,$(HELP_MEDIA),C/$(f))
+_HELP_LC_FILES = $(foreach lc,$(_HELP_LINGUAS),$(foreach f,$(HELP_FILES),$(lc)/$(f)))
+_HELP_LC_STAMPS = $(foreach lc,$(_HELP_LINGUAS),$(lc)/$(lc).stamp)
+
+_HELP_DEFAULT_V = $(if $(AM_DEFAULT_VERBOSITY),$(AM_DEFAULT_VERBOSITY),1)
+_HELP_V = $(if $(V),$(V),$(_HELP_DEFAULT_V))
+_HELP_LC_VERBOSE = $(_HELP_LC_VERBOSE_$(_HELP_V))
+_HELP_LC_VERBOSE_ = $(_HELP_LC_VERBOSE_$(_HELP_DEFAULT_V))
+_HELP_LC_VERBOSE_0 = @echo " GEN "$(dir [$]@);
+
+all: $(_HELP_C_FILES) $(_HELP_C_EXTRA) $(_HELP_C_MEDIA) $(_HELP_LC_FILES) $(_HELP_POFILES)
+
+.PHONY: pot
+pot: $(_HELP_POTFILE)
+$(_HELP_POTFILE): $(_HELP_C_FILES) $(_HELP_C_EXTRA) $(_HELP_C_MEDIA)
+ $(AM_V_GEN)if test -d "C"; then d=; else d="$(srcdir)/"; fi; \
+ $(ITSTOOL) -o "[$]@" $(foreach f,$(_HELP_C_FILES),"$${d}$(f)")
+
+.PHONY: repo
+repo: $(_HELP_POTFILE)
+ $(AM_V_at)for po in $(_HELP_POFILES); do \
+ if test "x[$](_HELP_V)" = "x0"; then echo " GEN $${po}"; fi; \
+ msgmerge -q -o "$${po}" "$${po}" "$(_HELP_POTFILE)"; \
+ done
+
+$(_HELP_POFILES):
+ $(AM_V_at)if ! test -d "$(dir [$]@)"; then mkdir "$(dir [$]@)"; fi
+ $(AM_V_at)if test ! -f "[$]@" -a -f "$(srcdir)/[$]@"; then cp "$(srcdir)/[$]@" "[$]@"; fi
+ $(AM_V_GEN)if ! test -f "[$]@"; then \
+ (cd "$(dir [$]@)" && \
+ $(ITSTOOL) -o "$(notdir [$]@).tmp" $(_HELP_C_FILES) && \
+ mv "$(notdir [$]@).tmp" "$(notdir [$]@)"); \
+ else \
+ (cd "$(dir [$]@)" && \
+ $(ITSTOOL) -o "$(notdir [$]@).tmp" $(_HELP_C_FILES) && \
+ msgmerge -o "$(notdir [$]@)" "$(notdir [$]@)" "$(notdir [$]@).tmp" && \
+ rm "$(notdir [$]@).tmp"); \
+ fi
+
+$(_HELP_MOFILES): %.mo: %.po
+ $(AM_V_at)if ! test -d "$(dir [$]@)"; then mkdir "$(dir [$]@)"; fi
+ $(AM_V_GEN)msgfmt -o "[$]@" "$<"
+
+$(_HELP_LC_FILES): $(_HELP_LINGUAS)
+$(_HELP_LINGUAS): $(_HELP_LC_STAMPS)
+$(_HELP_LC_STAMPS): %.stamp: %.mo
+$(_HELP_LC_STAMPS): $(_HELP_C_FILES) $(_HELP_C_EXTRA)
+ $(AM_V_at)if ! test -d "$(dir [$]@)"; then mkdir "$(dir [$]@)"; fi
+ $(_HELP_LC_VERBOSE)if test -d "C"; then d="../"; else d="$(abs_srcdir)/"; fi; \
+ mo="$(dir [$]@)$(patsubst %/$(notdir [$]@),%,[$]@).mo"; \
+ if test -f "$${mo}"; then mo="../$${mo}"; else mo="$(abs_srcdir)/$${mo}"; fi; \
+ (cd "$(dir [$]@)" && $(ITSTOOL) -m "$${mo}" $(foreach f,$(_HELP_C_FILES),$${d}/$(f))) && \
+ touch "[$]@"
+
+.PHONY: clean-help
+mostlyclean-am: $(if $(HELP_ID),clean-help)
+clean-help:
+ rm -f $(_HELP_LC_FILES) $(_HELP_LC_STAMPS) $(_HELP_MOFILES)
+
+EXTRA_DIST ?=
+EXTRA_DIST += $(_HELP_C_EXTRA) $(_HELP_C_MEDIA)
+EXTRA_DIST += $(if $(YELP_LC_DIST),$(foreach lc,$(HELP_LINGUAS),$(lc)/$(lc).stamp))
+EXTRA_DIST += $(foreach lc,$(HELP_LINGUAS),$(lc)/$(lc).po)
+EXTRA_DIST += $(foreach f,$(HELP_MEDIA),$(foreach lc,$(HELP_LINGUAS),$(wildcard $(lc)/$(f))))
+
+distdir: distdir-help-files
+distdir-help-files: $(_HELP_LC_FILES)
+ @for lc in C $(if $(YELP_LC_DIST),$(HELP_LINGUAS)) ; do \
+ $(MKDIR_P) "$(distdir)/$$lc"; \
+ for file in $(HELP_FILES); do \
+ if test -f "$$lc/$$file"; then d=./; else d=$(srcdir)/; fi; \
+ cp -p "$$d$$lc/$$file" "$(distdir)/$$lc/" || exit 1; \
+ done; \
+ done; \
+
+.PHONY: check-help
+check: check-help
+check-help:
+ for lc in C $(_HELP_LINGUAS); do \
+ if test -d "$$lc"; \
+ then d=; \
+ xmlpath="$$lc"; \
+ else \
+ d="$(srcdir)/"; \
+ xmlpath="$$lc:$(srcdir)/$$lc"; \
+ fi; \
+ for page in $(HELP_FILES); do \
+ echo "$(XMLLINT) --noout --noent --path $$xmlpath --xinclude $$d$$lc/$$page"; \
+ $(XMLLINT) --noout --noent --path "$$xmlpath" --xinclude "$$d$$lc/$$page"; \
+ done; \
+ done
+
+
+.PHONY: install-help
+install-data-am: $(if $(HELP_ID),install-help)
+install-help: $(_HELP_LC_FILES)
+ @for lc in C $(_HELP_LINGUAS); do \
+ $(mkinstalldirs) "$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)" || exit 1; \
+ done
+ @for lc in C $(_HELP_LINGUAS); do for f in $(HELP_FILES); do \
+ if test -f "$$lc/$$f"; then d=; else d="$(srcdir)/"; fi; \
+ helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
+ if ! test -d "$$helpdir"; then $(mkinstalldirs) "$$helpdir"; fi; \
+ echo "$(INSTALL_DATA) $$d$$lc/$$f $$helpdir`basename $$f`"; \
+ $(INSTALL_DATA) "$$d$$lc/$$f" "$$helpdir`basename $$f`" || exit 1; \
+ done; done
+ @for f in $(_HELP_C_EXTRA); do \
+ lc=`dirname "$$f"`; lc=`basename "$$lc"`; \
+ if test -f "$$f"; then d=; else d="$(srcdir)/"; fi; \
+ helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
+ if ! test -d "$$helpdir"; then $(mkinstalldirs) "$$helpdir"; fi; \
+ echo "$(INSTALL_DATA) $$d$$f $$helpdir`basename $$f`"; \
+ $(INSTALL_DATA) "$$d$$f" "$$helpdir`basename $$f`" || exit 1; \
+ done
+ @for f in $(HELP_MEDIA); do \
+ for lc in C $(_HELP_LINGUAS); do \
+ if test -f "$$lc$$f"; then d=; else d="$(srcdir)/"; fi; \
+ helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
+ mdir=`dirname "$$f"`; \
+ if test "x$mdir" = "x."; then mdir=""; fi; \
+ if ! test -d "$$helpdir$$mdir"; then $(mkinstalldirs) "$$helpdir$$mdir"; fi; \
+ if test -f "$$d$$lc/$$f"; then \
+ echo "$(INSTALL_DATA) $$d$$lc/$$f $$helpdir$$f"; \
+ $(INSTALL_DATA) "$$d$$lc/$$f" "$$helpdir$$f" || exit 1; \
+ elif test "x$$lc" != "xC"; then \
+ if test "x$(YELP_LC_MEDIA_LINKS)" != "x"; then \
+ echo "$(LN_S) -f $(HELP_DIR)/C/$(HELP_ID)/$$f $$helpdir$$f"; \
+ $(LN_S) -f "$(HELP_DIR)/C/$(HELP_ID)/$$f" "$$helpdir$$f" || exit 1; \
+ fi; \
+ fi; \
+ done; \
+ done
+
+.PHONY: uninstall-help
+uninstall-am: $(if $(HELP_ID),uninstall-help)
+uninstall-help:
+ for lc in C $(_HELP_LINGUAS); do for f in $(HELP_FILES); do \
+ helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
+ echo "rm -f $$helpdir`basename $$f`"; \
+ rm -f "$$helpdir`basename $$f`"; \
+ done; done
+ @for f in $(_HELP_C_EXTRA); do \
+ lc=`dirname "$$f"`; lc=`basename "$$lc"`; \
+ helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
+ echo "rm -f $$helpdir`basename $$f`"; \
+ rm -f "$$helpdir`basename $$f`"; \
+ done
+ @for f in $(HELP_MEDIA); do \
+ for lc in C $(_HELP_LINGUAS); do \
+ helpdir="$(DESTDIR)$(HELP_DIR)/$$lc/$(HELP_ID)/"; \
+ echo "rm -f $$helpdir$$f"; \
+ rm -f "$$helpdir$$f"; \
+ done; \
+ done;
+'
+AC_SUBST([YELP_HELP_RULES])
+m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([YELP_HELP_RULES])])
+])
=== modified file 'src/Makefile.in'
--- src/Makefile.in 2015-06-02 10:42:34 +0000
+++ src/Makefile.in 2015-07-11 21:08:34 +0000
@@ -85,10 +85,14 @@
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_enable_debug.m4 \
+ $(top_srcdir)/m4/ax_code_coverage.m4 \
+ $(top_srcdir)/m4/gsettings.m4 $(top_srcdir)/m4/intltool.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/yelp.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
=== modified file 'src/bookmarks/Makefile.in'
--- src/bookmarks/Makefile.in 2015-06-02 10:42:34 +0000
+++ src/bookmarks/Makefile.in 2015-07-11 21:08:34 +0000
@@ -82,10 +82,14 @@
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_enable_debug.m4 \
+ $(top_srcdir)/m4/ax_code_coverage.m4 \
+ $(top_srcdir)/m4/gsettings.m4 $(top_srcdir)/m4/intltool.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/yelp.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
=== modified file 'src/ephy-search-provider-main.c'
--- src/ephy-search-provider-main.c 2015-06-02 10:42:34 +0000
+++ src/ephy-search-provider-main.c 2015-07-11 21:08:34 +0000
@@ -24,12 +24,23 @@
#include "ephy-file-helpers.h"
#include "ephy-private.h"
+#include
+#include
+
gint main (gint argc, gchar** argv)
{
EphySearchProvider *search_provider;
int status;
GError *error = NULL;
+#if ENABLE_NLS
+ /* Initialize the i18n stuff */
+ setlocale (LC_ALL, "");
+ bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+#endif
+
if (!ephy_file_helpers_init (NULL, 0, &error)) {
g_printerr ("%s\n", error->message);
g_error_free (error);
=== modified file 'src/ephy-shell-search-provider-generated.c'
--- src/ephy-shell-search-provider-generated.c 2015-06-25 06:50:45 +0000
+++ src/ephy-shell-search-provider-generated.c 2015-07-11 21:08:34 +0000
@@ -1,5 +1,5 @@
/*
- * Generated by gdbus-codegen 2.45.2. DO NOT EDIT.
+ * Generated by gdbus-codegen 2.45.3. DO NOT EDIT.
*
* The license of this code is the same as for the source it was derived from.
*/
=== modified file 'src/ephy-shell-search-provider-generated.h'
--- src/ephy-shell-search-provider-generated.h 2015-06-25 06:50:45 +0000
+++ src/ephy-shell-search-provider-generated.h 2015-07-11 21:08:34 +0000
@@ -1,5 +1,5 @@
/*
- * Generated by gdbus-codegen 2.45.2. DO NOT EDIT.
+ * Generated by gdbus-codegen 2.45.3. DO NOT EDIT.
*
* The license of this code is the same as for the source it was derived from.
*/
=== modified file 'tests/Makefile.in'
--- tests/Makefile.in 2015-06-02 10:42:34 +0000
+++ tests/Makefile.in 2015-07-11 21:08:34 +0000
@@ -91,10 +91,14 @@
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_enable_debug.m4 \
+ $(top_srcdir)/m4/ax_code_coverage.m4 \
+ $(top_srcdir)/m4/gsettings.m4 $(top_srcdir)/m4/intltool.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/yelp.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
=== modified file 'tests/data/Makefile.in'
--- tests/data/Makefile.in 2015-06-02 10:42:34 +0000
+++ tests/data/Makefile.in 2015-07-11 21:08:34 +0000
@@ -80,10 +80,14 @@
subdir = tests/data
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_enable_debug.m4 \
+ $(top_srcdir)/m4/ax_code_coverage.m4 \
+ $(top_srcdir)/m4/gsettings.m4 $(top_srcdir)/m4/intltool.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/yelp.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d