Compare commits
178 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8c695048ff | ||
|
d82f0664da | ||
|
3adcd8e10b | ||
|
960d56b379 | ||
|
215f6c7791 | ||
|
c8e8994410 | ||
|
1cd2ed7b4c | ||
|
a48dab6ef5 | ||
|
5b769045f0 | ||
|
8ff2d3fd74 | ||
|
5b7c1d936e | ||
|
423f214a70 | ||
|
c469e1345c | ||
|
ef0979b2d3 | ||
|
fc80c90843 | ||
|
3940e04530 | ||
|
83597ba864 | ||
|
7d8538b748 | ||
|
4429a455f4 | ||
|
2229d826c4 | ||
|
ba9bcf2244 | ||
|
10e9a275c8 | ||
|
18d3ebf460 | ||
|
76b2fcba7b | ||
|
d41e63a340 | ||
|
c7455d5f23 | ||
|
6168aee699 | ||
|
f4be97d79d | ||
|
9e805380d4 | ||
|
15b607ddc0 | ||
|
4dcfaada50 | ||
|
3bf1b62a34 | ||
|
33d035aac7 | ||
|
a71e7eea3a | ||
|
7e6a888e1d | ||
|
36b625be6a | ||
|
5a3fc97c6a | ||
|
3ca66d6fb6 | ||
|
22ddcc04e0 | ||
|
63f9ac4baf | ||
|
68ef65bedb | ||
|
f9cd2e8048 | ||
|
19bb11e8a0 | ||
|
8f28449081 | ||
|
8bb308de4f | ||
|
0cb924853d | ||
|
14896668d3 | ||
|
8b0f775e7e | ||
|
385d32dbfc | ||
|
2bb61b9190 | ||
|
c8a0150fd4 | ||
|
6f58fd2f2c | ||
|
b6483090b6 | ||
|
5e9e34ed60 | ||
|
6bbcc343dd | ||
|
1d39305c1c | ||
|
45bcb345e8 | ||
|
d1833f6591 | ||
|
8a98e18511 | ||
|
c3b8a73695 | ||
|
7302b14f78 | ||
|
5a16a65643 | ||
|
d5a48be670 | ||
|
bfa1fa0e00 | ||
|
c19752ec31 | ||
|
4eaddc1cb7 | ||
|
808e77b052 | ||
|
5e2c6f0369 | ||
|
55e386beef | ||
|
5fae2771c8 | ||
|
c912a44774 | ||
|
0d006777fc | ||
|
2e074fd0ed | ||
|
8a0c1f6e08 | ||
|
3e37213b5e | ||
|
b7ee3bf83b | ||
|
359fcb87c5 | ||
|
a549184217 | ||
|
eda7a9a23c | ||
|
4dff6fa7e1 | ||
|
8763fbf5df | ||
|
9d3d2acfd9 | ||
|
96d6a9c0fb | ||
|
7cc3d5967b | ||
|
54978e6e8f | ||
|
69895bd026 | ||
|
3066879089 | ||
|
f4c882e3b5 | ||
|
cd94beb376 | ||
|
350e3ffc29 | ||
|
52ee1591f7 | ||
|
db60af5efb | ||
|
dde92eecbf | ||
|
7bdc217e8c | ||
|
2520d1c087 | ||
|
116bfc2ac1 | ||
|
1820d0db69 | ||
|
17062aaa18 | ||
|
aa7dabad39 | ||
|
15ec9b4e65 | ||
|
612f36cea9 | ||
|
e7328ad12e | ||
|
172f323b4b | ||
|
4044529191 | ||
|
992ca7a3ec | ||
|
67892da099 | ||
|
2ebff67c9c | ||
|
43ee0436d8 | ||
|
fb0002bdcd | ||
|
2e3f337e84 | ||
|
d208cae3bc | ||
|
05b68fb5f5 | ||
|
42da8bc289 | ||
|
fe1c4f1e38 | ||
|
c57ad618a1 | ||
|
39e08bd3b8 | ||
|
b868ebde1c | ||
|
dc1104c93b | ||
|
c30f2a988d | ||
|
465226e185 | ||
|
7220975463 | ||
|
088ec7b031 | ||
|
f6bc8206ed | ||
|
0ec63fc00e | ||
|
7ce2a750db | ||
|
6e36dc4a5f | ||
|
39cadaa36e | ||
|
834266682c | ||
|
3523968707 | ||
|
494a2e7ce3 | ||
|
0b1133ac44 | ||
|
986655d6aa | ||
|
06a20265ea | ||
|
66c155a386 | ||
|
fe3fa259fb | ||
|
ac9d0a9343 | ||
|
bc381189c7 | ||
|
d4de361efb | ||
|
d99074ec5e | ||
|
dfcf007a44 | ||
|
4f43977c59 | ||
|
7bebfc9b97 | ||
|
8c6125e8fa | ||
|
e7c4d897dd | ||
|
44ec63074e | ||
|
fdd6c18a51 | ||
|
51383ae711 | ||
|
7951868e92 | ||
|
9788914d86 | ||
|
0409e91288 | ||
|
8a32b92c33 | ||
|
3999de8f59 | ||
|
37338603dc | ||
|
87cd264acf | ||
|
cc493b9b9b | ||
|
a86c482308 | ||
|
bd32e81f13 | ||
|
19354f86c1 | ||
|
39dcfcab0b | ||
|
6c7e40c3ba | ||
|
0a25600883 | ||
|
a5af28a95d | ||
|
a13a573228 | ||
|
100428eaf9 | ||
|
d86c906848 | ||
|
ddaf70747c | ||
|
6159ad5be2 | ||
|
6383f71fa0 | ||
|
c269c57777 | ||
|
561c94e71a | ||
|
78ca6d13e0 | ||
|
bc18f166a3 | ||
|
ef9294aae2 | ||
|
4c813f2c7f | ||
|
50b01551ac | ||
|
d5ccae34be | ||
|
4fe403dd63 | ||
|
b4d9a09870 |
64
.circleci/config.yml
Normal file
64
.circleci/config.yml
Normal file
@@ -0,0 +1,64 @@
|
||||
version: 2.0
|
||||
|
||||
shared: &shared
|
||||
|
||||
steps:
|
||||
|
||||
- checkout
|
||||
|
||||
- run:
|
||||
name: Prepare environment
|
||||
command: apt-get update
|
||||
|
||||
- run:
|
||||
name: Install dependencies
|
||||
command: |
|
||||
wget https://github.com/linuxmint/xapps/releases/download/master.${CIRCLE_JOB}/packages.tar.gz -O xapps.tar.gz
|
||||
ls *.tar.gz | xargs -i tar zxvf {}
|
||||
apt install --yes --allow-downgrades ./packages/*.deb
|
||||
rm -rf packages
|
||||
|
||||
- run:
|
||||
name: Build project
|
||||
command: mint-build -i
|
||||
|
||||
- run:
|
||||
name: Prepare packages
|
||||
command: |
|
||||
if [ -z $CI_PULL_REQUEST ]; then
|
||||
mkdir /packages
|
||||
mv /root/*.deb /packages/
|
||||
git log > /packages/git.log
|
||||
cd /
|
||||
tar zcvf packages.tar.gz packages
|
||||
fi
|
||||
|
||||
- run:
|
||||
name: Deploy packages to Github
|
||||
command: |
|
||||
if [ -z $CI_PULL_REQUEST ]; then
|
||||
wget https://github.com/tcnksm/ghr/releases/download/v0.5.4/ghr_v0.5.4_linux_amd64.zip
|
||||
apt-get install --yes unzip
|
||||
unzip ghr_v0.5.4_linux_amd64.zip
|
||||
TAG="master".$CIRCLE_JOB
|
||||
./ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME -replace $TAG /packages.tar.gz
|
||||
./ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME -recreate -b "Latest unstable packages" $TAG /packages.tar.gz
|
||||
fi
|
||||
|
||||
jobs:
|
||||
"mint20":
|
||||
<<: *shared
|
||||
docker:
|
||||
- image: linuxmintd/mint20-amd64
|
||||
|
||||
"lmde4":
|
||||
<<: *shared
|
||||
docker:
|
||||
- image: linuxmintd/lmde4-amd64
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build:
|
||||
jobs:
|
||||
- "mint20"
|
||||
- "lmde4"
|
12
.gitignore
vendored
Normal file
12
.gitignore
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# Specify filepatterns you want git to ignore.
|
||||
debian/tmp/
|
||||
debian/build/
|
||||
debian/.debhelper/
|
||||
debian/xed/
|
||||
debian/xed-common/
|
||||
debian/xed-dbg/
|
||||
debian/xed-dev/
|
||||
debian/xed-doc/
|
||||
debian/files
|
||||
debian/*.log
|
||||
debian/*.substvars
|
70
Makefile.am
70
Makefile.am
@@ -1,70 +0,0 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
|
||||
|
||||
SUBDIRS = xed pixmaps po data plugins docs help
|
||||
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
|
||||
EXTRA_DIST = \
|
||||
autogen.sh \
|
||||
ChangeLog \
|
||||
HACKING \
|
||||
NEWS \
|
||||
NEWS.GNOME \
|
||||
README \
|
||||
xmldocs.make \
|
||||
omf.make \
|
||||
intltool-extract.in \
|
||||
intltool-merge.in \
|
||||
intltool-update.in
|
||||
|
||||
DISTCLEANFILES = \
|
||||
intltool-extract \
|
||||
intltool-merge \
|
||||
intltool-update
|
||||
|
||||
MAINTAINERCLEANFILES = \
|
||||
aclocal.m4 \
|
||||
config.guess \
|
||||
config.h.in \
|
||||
config.sub \
|
||||
depcomp \
|
||||
intltool-extract.in \
|
||||
intltool-merge.in \
|
||||
intltool-update.in \
|
||||
configure \
|
||||
INSTALL \
|
||||
gtk-doc.make \
|
||||
install-sh \
|
||||
ltmain.sh \
|
||||
missing \
|
||||
mkinstalldirs \
|
||||
omf.make \
|
||||
py-compile \
|
||||
xmldocs.make \
|
||||
m4/gtk-doc.m4 \
|
||||
m4/intltool.m4 \
|
||||
m4/libtool.m4 \
|
||||
m4/ltoptions.m4 \
|
||||
m4/ltsugar.m4 \
|
||||
m4/ltversion.m4 \
|
||||
m4/lt~obsolete.m4 \
|
||||
`find "$(srcdir)" -type f -name Makefile.in -print`
|
||||
|
||||
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
|
||||
|
||||
dist-hook:
|
||||
@if test -d "$(srcdir)/.git"; \
|
||||
then \
|
||||
echo Creating ChangeLog && \
|
||||
(GIT_DIR=$(top_srcdir)/.git \
|
||||
./missing --run git log --stat -M -C --name-status --date=short --no-color) | \
|
||||
fmt --split-only > ChangeLog.tmp \
|
||||
&& mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
|
||||
|| ( rm -f ChangeLog.tmp ; \
|
||||
echo Failed to generate ChangeLog >&2 ); \
|
||||
else \
|
||||
echo A git clone is required to generate a ChangeLog >&2; \
|
||||
fi
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
41
README
41
README
@@ -1,41 +0,0 @@
|
||||
General Information
|
||||
===================
|
||||
|
||||
xed is a small and lightweight text editor.
|
||||
|
||||
xed supports most standard editing features, plus several not found in your
|
||||
average text editor (plugins being the most notable of these).
|
||||
|
||||
Although new features are always under development, currently xed has:
|
||||
|
||||
* Complete support for UTF-8 text
|
||||
* Syntax highlighting
|
||||
* Support for editing remote files
|
||||
* Search and Replace
|
||||
* Printing and Print Previewing Support
|
||||
* File Revert
|
||||
* A complete preferences interface
|
||||
* Configurable Plugin system, with optional python support
|
||||
|
||||
Some of the plugins, packaged and installed with xed include, among others:
|
||||
|
||||
* Word count
|
||||
* Spell checker
|
||||
* Change case of selected text
|
||||
* File Browser
|
||||
* Sort
|
||||
* Insert Date/Time
|
||||
* Tag list
|
||||
|
||||
xed is released under the GNU General Public License (GPL) version 2, see
|
||||
the file 'COPYING' for more information.
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
Simple install procedure:
|
||||
|
||||
% ./autogen.sh # run the `configure' script
|
||||
% make # build xed
|
||||
[ Become root if necessary ]
|
||||
% make install # install xed
|
74
README.md
Normal file
74
README.md
Normal file
@@ -0,0 +1,74 @@
|
||||
# Xed Text Editor
|
||||
|
||||
xed is a small and lightweight text editor.
|
||||
|
||||
xed supports most standard editing features, plus several not found in your
|
||||
average text editor (plugins being the most notable of these).
|
||||
|
||||
Although new features are always under development, currently xed has:
|
||||
|
||||
* Complete support for UTF-8 text
|
||||
* Syntax highlighting
|
||||
* Support for editing remote files
|
||||
* Search and Replace
|
||||
* Printing and Print Previewing Support
|
||||
* File Revert
|
||||
* A complete preferences interface
|
||||
* Configurable Plugin system, with optional python support
|
||||
|
||||
Some of the plugins, packaged and installed with xed include, among others:
|
||||
|
||||
* Change Case
|
||||
* Document Statistics
|
||||
* File Browser
|
||||
* Indent Lines
|
||||
* Insert Date/Time
|
||||
* Modelines
|
||||
* Save Without Trailing Spaces
|
||||
* Sort
|
||||
* Spell checker
|
||||
* Tag list
|
||||
* Word Completion
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
1. run the 'configure' script
|
||||
# meson --prefix=/usr build
|
||||
2. build xed
|
||||
# ninja -v -C build
|
||||
3. install xed
|
||||
# sudo ninja install -v -C build
|
||||
|
||||
** Build Instructions for Debian-based distros **
|
||||
1. run "dpkg-buildpackage" from the xed base directory
|
||||
2. cd ..
|
||||
3. run
|
||||
# sudo dpkg -i *.deb
|
||||
4. From then, any new changes can be applied by running
|
||||
# sudo ninja -C debian/build install
|
||||
```
|
||||
|
||||
### Xed look and feel
|
||||
|
||||
##### Classic Mode
|
||||

|
||||
|
||||
##### Theme selections
|
||||

|
||||
|
||||
##### Search and Replace feature
|
||||

|
||||
|
||||
##### Select from several languages in Highlight syntax mode
|
||||

|
||||
|
||||
##### Xed Shortcuts
|
||||

|
||||

|
||||
|
||||
|
||||
|
||||
> xed is released under the GNU General Public License (GPL) version 2, see
|
||||
> the file 'COPYING' for more information.
|
31
autogen.sh
31
autogen.sh
@@ -1,31 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
|
||||
srcdir=`dirname $0`
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
PKG_NAME="xed"
|
||||
|
||||
(test -f $srcdir/configure.ac) || {
|
||||
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
|
||||
echo " top-level $PKG_NAME directory"
|
||||
exit 1
|
||||
}
|
||||
|
||||
which gnome-autogen.sh || {
|
||||
echo "You need to install gnome-common"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
which yelp-build || {
|
||||
echo "You need to install yelp-tools"
|
||||
exit 1
|
||||
}
|
||||
|
||||
REQUIRED_AUTOMAKE_VERSION=1.9
|
||||
GNOME_DATADIR="$gnome_datadir"
|
||||
USE_COMMON_DOC_BUILD=yes
|
||||
|
||||
. gnome-autogen.sh
|
||||
|
260
configure.ac
260
configure.ac
@@ -1,260 +0,0 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.63.2)
|
||||
|
||||
m4_define(xed_major_version, 1)
|
||||
m4_define(xed_minor_version, 6)
|
||||
m4_define(xed_micro_version, 2)
|
||||
m4_define(xed_version, xed_major_version.xed_minor_version.xed_micro_version)
|
||||
|
||||
AC_INIT([xed], [xed_version],
|
||||
[https://github.com/linuxmint/xed/issues],
|
||||
[xed], [http://github.com/linuxmint/xed])
|
||||
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
AC_CONFIG_SRCDIR(xed/xed.c)
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
AC_DEFINE(XED_MAJOR_VERSION, xed_major_version, [Xed major version])
|
||||
AC_SUBST(XED_MAJOR_VERSION, xed_major_version)
|
||||
AC_DEFINE(XED_MINOR_VERSION, xed_minor_version, [Xed minor version])
|
||||
AC_SUBST(XED_MINOR_VERSION, xed_minor_version)
|
||||
AC_DEFINE(XED_MICRO_VERSION, xed_micro_version, [Xed micro version])
|
||||
AC_SUBST(XED_MICRO_VERSION, xed_micro_version)
|
||||
|
||||
AM_INIT_AUTOMAKE([1.10 dist-xz no-dist-gzip -Wno-portability check-news])
|
||||
AM_MAINTAINER_MODE
|
||||
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
|
||||
|
||||
# Checks for programs
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_MAKE_SET
|
||||
AC_SYS_LARGEFILE
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
# Initialize libtool
|
||||
LT_PREREQ([2.2.6])
|
||||
LT_INIT(disable-static)
|
||||
|
||||
GTK_DOC_CHECK([1.0],[--flavour=no-tmpl])
|
||||
|
||||
AC_CHECK_FUNC(sigaction)
|
||||
AC_CHECK_LIB(m, floor)
|
||||
|
||||
dnl make sure we keep ACLOCAL_FLAGS around for maintainer builds to work
|
||||
AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS -I m4")
|
||||
|
||||
dnl toolbar style for GSettings schemas
|
||||
TOOLBAR_STYLE="XED_TOOLBAR_SYSTEM"
|
||||
AC_SUBST(TOOLBAR_STYLE)
|
||||
|
||||
dnl ===============================================================
|
||||
dnl Expanded dirs
|
||||
dnl ===============================================================
|
||||
|
||||
# This macro expands DIR and assigns it to RET.
|
||||
# If DIR is NONE, then it's replaced by DEFAULT.
|
||||
# Based on AC_DEFINE_DIR
|
||||
AC_DEFUN([XED_FULLPATH], [
|
||||
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
|
||||
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
|
||||
ac_expand=[$]$1
|
||||
test "x$ac_expand" = xNONE && ac_expand="[$]$2"
|
||||
ac_expand=`eval echo [$]ac_expand`
|
||||
$3=`eval echo [$]ac_expand`
|
||||
])
|
||||
|
||||
dnl ================================================================
|
||||
dnl Gettext stuff.
|
||||
dnl ================================================================
|
||||
|
||||
IT_PROG_INTLTOOL([0.50.1])
|
||||
GETTEXT_PACKAGE=xed
|
||||
AC_SUBST([GETTEXT_PACKAGE])
|
||||
AM_GLIB_GNU_GETTEXT
|
||||
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Define to the Gettext package name])
|
||||
|
||||
dnl ================================================================
|
||||
dnl Use gvfs metadata or the old xml file store.
|
||||
dnl ================================================================
|
||||
|
||||
AC_ARG_ENABLE([gvfs-metadata],
|
||||
AS_HELP_STRING([--enable-gvfs-metadata], [Enable using gvfs to store metadata]),
|
||||
[enable_gvfs_metadata=$enableval],
|
||||
[enable_gvfs_metadata=yes])
|
||||
|
||||
AM_CONDITIONAL(ENABLE_GVFS_METADATA, test "x$enable_gvfs_metadata" != "xno")
|
||||
|
||||
if test "x$enable_gvfs_metadata" != "xno"; then
|
||||
AC_DEFINE([ENABLE_GVFS_METADATA], [1], [Define to enable using gvfs metadata])
|
||||
fi
|
||||
|
||||
dnl ================================================================
|
||||
dnl spell plugins checks: enchant and iso-codes
|
||||
dnl ================================================================
|
||||
|
||||
ENCHANT_REQUIRED=1.2.0
|
||||
ISO_CODES_REQUIRED=0.35
|
||||
|
||||
AC_ARG_ENABLE([spell],
|
||||
AS_HELP_STRING([--disable-spell],[Disable spell plugin (default: enabled)]),
|
||||
[enable_enchant=$enableval],
|
||||
[enable_enchant=yes])
|
||||
|
||||
if test "x$enable_enchant" = "xyes" ; then
|
||||
|
||||
PKG_CHECK_MODULES(ENCHANT, enchant >= $ENCHANT_REQUIRED, \
|
||||
have_enchant=yes, have_enchant=no)
|
||||
|
||||
if test "x$have_enchant" = "xyes"; then
|
||||
|
||||
PKG_CHECK_EXISTS([iso-codes >= $ISO_CODES_REQUIRED],
|
||||
[have_iso_codes=yes],[have_iso_codes=no])
|
||||
|
||||
if test "x$have_iso_codes" = "xyes"; then
|
||||
AC_MSG_CHECKING([whether iso-codes has iso-639 and iso-3166 domains])
|
||||
if $PKG_CONFIG --variable=domains iso-codes | grep 639 > /dev/null && \
|
||||
$PKG_CONFIG --variable=domains iso-codes | grep 3166 > /dev/null ; then
|
||||
result=yes
|
||||
else
|
||||
result=no
|
||||
have_iso_codes=no
|
||||
fi
|
||||
AC_MSG_RESULT([$result])
|
||||
fi
|
||||
|
||||
if test "x$have_iso_codes" = "xyes"; 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 to build the spell plugin. Use --disable-spell to build without spell plugin.])
|
||||
fi
|
||||
else
|
||||
enable_enchant=no
|
||||
AC_MSG_ERROR([Enchant library not found or too old. Use --disable-spell to build without spell plugin.])
|
||||
fi
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(ENABLE_ENCHANT, test x"$enable_enchant" = "xyes")
|
||||
|
||||
dnl ================================================================
|
||||
dnl Start of pkg-config checks
|
||||
dnl ================================================================
|
||||
|
||||
PKG_CHECK_MODULES(GMODULE,gmodule-2.0,[GMODULE_ADD="gmodule-2.0"],[GMODULE_ADD=""])
|
||||
PKG_CHECK_MODULES(XED, [
|
||||
libxml-2.0 >= 2.5.0
|
||||
glib-2.0 >= 2.40.0
|
||||
$GMODULE_ADD
|
||||
gthread-2.0 >= 2.13.0
|
||||
gio-2.0 >= 2.40.0
|
||||
gtk+-3.0 >= 3.18.0
|
||||
gtksourceview-3.0 >= 3.18.0
|
||||
libpeas-1.0 >= 1.12.0
|
||||
libpeas-gtk-1.0 >= 1.12.0
|
||||
])
|
||||
|
||||
PKG_CHECK_MODULES(X11, [x11])
|
||||
|
||||
XED_CFLAGS="$XED_CFLAGS $X11_CFLAGS"
|
||||
XED_LIBS="$XED_LIBS $X11_LIBS"
|
||||
|
||||
AC_SUBST(XED_CFLAGS)
|
||||
AC_SUBST(XED_LIBS)
|
||||
|
||||
# Introspection
|
||||
GOBJECT_INTROSPECTION_CHECK([0.9.3])
|
||||
|
||||
if test "$found_introspection" = "yes"; then
|
||||
enable_introspection=yes
|
||||
AC_DEFINE([ENABLE_INTROSPECTION], [1], [Define to enable GObject Introspection])
|
||||
else
|
||||
enable_introspection=no
|
||||
fi
|
||||
|
||||
AM_PATH_PYTHON([3.4])
|
||||
|
||||
dnl ================================================================
|
||||
dnl GSettings related settings
|
||||
dnl ================================================================
|
||||
|
||||
GLIB_GSETTINGS
|
||||
|
||||
dnl ================================================================
|
||||
dnl Misc
|
||||
dnl ================================================================
|
||||
AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
|
||||
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
|
||||
AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
|
||||
|
||||
GNOME_COMPILE_WARNINGS(yes)
|
||||
|
||||
AC_ARG_ENABLE(deprecations,
|
||||
[AS_HELP_STRING([--enable-deprecations],
|
||||
[warn about deprecated usages [default=no]])],,
|
||||
[enable_deprecations=no])
|
||||
|
||||
if test "x$enable_deprecations" = "xyes"; then
|
||||
DISABLE_DEPRECATED_CFLAGS="\
|
||||
-DG_DISABLE_DEPRECATED \
|
||||
-DGDK_DISABLE_DEPRECATED \
|
||||
-DGTK_DISABLE_DEPRECATED \
|
||||
-DGDK_PIXBUF_DISABLE_DEPRECATED \
|
||||
-DGNOME_DISABLE_DEPRECATED"
|
||||
AC_SUBST(DISABLE_DEPRECATED_CFLAGS)
|
||||
fi
|
||||
|
||||
PLUGIN_LIBTOOL_FLAGS="-module -avoid-version"
|
||||
|
||||
AC_SUBST(PLUGIN_LIBTOOL_FLAGS)
|
||||
|
||||
XED_PLUGINS_DATA_DIR="$datadir/xed/plugins"
|
||||
AC_SUBST(XED_PLUGINS_DATA_DIR)
|
||||
|
||||
XED_PLUGINS_LIBS_DIR="$libdir/xed/plugins"
|
||||
AC_SUBST(XED_PLUGINS_LIBS_DIR)
|
||||
|
||||
YELP_HELP_INIT
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
data/xed.desktop.in
|
||||
data/xed-bugreport.sh
|
||||
data/xed.pc
|
||||
data/org.x.editor.gschema.xml
|
||||
data/Makefile
|
||||
docs/Makefile
|
||||
docs/reference/Makefile
|
||||
xed/Makefile
|
||||
help/Makefile
|
||||
pixmaps/Makefile
|
||||
plugins/Makefile
|
||||
plugins/docinfo/Makefile
|
||||
plugins/filebrowser/Makefile
|
||||
plugins/filebrowser/org.x.editor.plugins.filebrowser.gschema.xml
|
||||
plugins/modelines/Makefile
|
||||
plugins/sort/Makefile
|
||||
plugins/spell/Makefile
|
||||
plugins/spell/org.x.editor.plugins.spell.gschema.xml
|
||||
plugins/taglist/Makefile
|
||||
plugins/textsize/Makefile
|
||||
plugins/textsize/textsize/Makefile
|
||||
plugins/time/Makefile
|
||||
plugins/time/org.x.editor.plugins.time.gschema.xml
|
||||
plugins/trailsave/Makefile
|
||||
po/Makefile.in
|
||||
])
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
echo "
|
||||
|
||||
Configuration:
|
||||
|
||||
Source code location: ${srcdir}
|
||||
Compiler: ${CC}
|
||||
Spell Plugin enabled: $enable_enchant
|
||||
Gvfs metadata enabled: $enable_gvfs_metadata
|
||||
GObject Introspection: ${enable_introspection}
|
||||
"
|
@@ -1,49 +0,0 @@
|
||||
desktopdir = $(datadir)/applications
|
||||
desktop_in_files = xed.desktop.in
|
||||
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
|
||||
@INTLTOOL_DESKTOP_RULE@
|
||||
|
||||
@INTLTOOL_XML_RULE@
|
||||
|
||||
appdatadir = $(datadir)/appdata
|
||||
appdata_in_files = xed.appdata.xml.in
|
||||
appdata_DATA = $(appdata_in_files:.xml.in=.xml)
|
||||
|
||||
gsettings_SCHEMAS = org.x.editor.gschema.xml
|
||||
|
||||
@GSETTINGS_RULES@
|
||||
|
||||
servicedir = $(datadir)/dbus-1/services
|
||||
service_in_files = org.x.editor.service.in
|
||||
service_DATA = $(service_in_files:.service.in=.service)
|
||||
|
||||
$(service_DATA): $(service_in_files) Makefile
|
||||
@sed -e "s|\@bindir\@|$(bindir)|" $<> $@
|
||||
|
||||
man_MANS = xed.1
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = xed.pc
|
||||
|
||||
bugreportdir = $(libexecdir)/xed
|
||||
bugreport_SCRIPTS = xed-bugreport.sh
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(appdata_in_files) \
|
||||
$(desktop_in_files) \
|
||||
$(service_in_files) \
|
||||
$(man_MANS) \
|
||||
xed.pc.in \
|
||||
xed-bugreport.sh.in
|
||||
|
||||
CLEANFILES = \
|
||||
$(desktop_DATA) \
|
||||
$(service_DATA) \
|
||||
$(gsettings_SCHEMAS) \
|
||||
$(pkgconfig_DATA) \
|
||||
$(appdata_DATA)
|
||||
|
||||
|
||||
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
42
data/meson.build
Normal file
42
data/meson.build
Normal file
@@ -0,0 +1,42 @@
|
||||
desktop = custom_target(
|
||||
'desktop',
|
||||
input: 'xed.desktop.in.in',
|
||||
output: 'xed.desktop',
|
||||
command: [intltool_merge, '-d', '-u', po_dir, '@INPUT@', '@OUTPUT@'],
|
||||
install: true,
|
||||
install_dir: desktopdir,
|
||||
)
|
||||
|
||||
appdata = custom_target(
|
||||
'appdata',
|
||||
input: 'xed.appdata.xml.in',
|
||||
output: 'xed.appdata.xml',
|
||||
command: [intltool_merge, '-x', '-u', po_dir, '@INPUT@', '@OUTPUT@'],
|
||||
install: true,
|
||||
install_dir: join_paths(datadir, 'metainfo'),
|
||||
)
|
||||
|
||||
schema_conf = configuration_data()
|
||||
schema_conf.set('GETTEXT_PACKAGE', 'xed')
|
||||
|
||||
schema_file = configure_file(
|
||||
input: 'org.x.editor.gschema.xml.in',
|
||||
output: 'org.x.editor.gschema.xml',
|
||||
configuration: schema_conf,
|
||||
install_dir: join_paths(datadir, 'glib-2.0', 'schemas')
|
||||
)
|
||||
|
||||
service_conf = configuration_data()
|
||||
service_conf.set('bindir', join_paths(prefix, bindir))
|
||||
|
||||
configure_file(
|
||||
input: 'org.x.editor.service.in',
|
||||
output: 'org.x.editor.service',
|
||||
configuration: service_conf,
|
||||
install_dir: join_paths(datadir, 'dbus-1', 'services')
|
||||
)
|
||||
|
||||
install_data(
|
||||
'xed.1',
|
||||
install_dir : join_paths(get_option('prefix'), get_option('mandir'), 'man1')
|
||||
)
|
@@ -167,6 +167,36 @@
|
||||
<description>Whether xed will ensure that documents always end with a trailing newline.</description>
|
||||
</key>
|
||||
|
||||
<key name="draw-whitespace" type="b">
|
||||
<default>false</default>
|
||||
<summary>Draw whitespace</summary>
|
||||
<description>Whether xed should render whitespace</description>
|
||||
</key>
|
||||
|
||||
<key name="draw-whitespace-leading" type="b">
|
||||
<default>false</default>
|
||||
<summary>Draw leading whitespace</summary>
|
||||
<description>Whether xed should render leading whitespace</description>
|
||||
</key>
|
||||
|
||||
<key name="draw-whitespace-inside" type="b">
|
||||
<default>false</default>
|
||||
<summary>Draw whitespace within text</summary>
|
||||
<description>Whether xed should render whitespace between words and characters</description>
|
||||
</key>
|
||||
|
||||
<key name="draw-whitespace-trailing" type="b">
|
||||
<default>false</default>
|
||||
<summary>Draw trailing whitespace</summary>
|
||||
<description>Whether xed should render trailing whitespace</description>
|
||||
</key>
|
||||
|
||||
<key name="draw-whitespace-newline" type="b">
|
||||
<default>false</default>
|
||||
<summary>Draw newline characters</summary>
|
||||
<description>Whether xed should render newline characters</description>
|
||||
</key>
|
||||
|
||||
</schema>
|
||||
|
||||
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org.x.editor.preferences.ui" path="/org/x/editor/preferences/ui/">
|
||||
@@ -338,7 +368,7 @@
|
||||
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org.x.editor.plugins" path="/org/x/editor/plugins/">
|
||||
|
||||
<key name="active-plugins" type="as">
|
||||
<default>[ 'docinfo', 'modelines', 'filebrowser', 'spell', 'time' ]</default>
|
||||
<default>[ 'docinfo', 'modelines', 'filebrowser', 'spell', 'time', 'bracketcompletion' ]</default>
|
||||
<summary>Active plugins</summary>
|
||||
<description>List of active plugins. It contains the "Location" of the active plugins. See the .xed-plugin file for obtaining the "Location" of a given plugin.</description>
|
||||
</key>
|
||||
|
@@ -1,51 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
PKG_CONFIG_MODULES="glib-2.0 gtk+-3.0 gtksourceview-3.0 enchant iso-codes"
|
||||
|
||||
echo_padded ()
|
||||
{
|
||||
echo -n " - $1 "
|
||||
N=$(echo -n $1 | wc -m)
|
||||
while test $N -le 20
|
||||
do
|
||||
echo -n " "
|
||||
N=`expr $N + 1`
|
||||
done
|
||||
}
|
||||
|
||||
if (which gsettings >/dev/null)
|
||||
then
|
||||
echo "GSettings configuration dump:"
|
||||
gsettings list-recursively org.x.editor
|
||||
echo
|
||||
fi
|
||||
|
||||
echo "Active plugins:"
|
||||
gsettings get org.x.editor active-plugins \
|
||||
| sed -r -e 's/^\[(.*)\]$/\1/' -e 's/, /\n/g' \
|
||||
| sed -e 's/^.*$/ - \0/'
|
||||
echo
|
||||
|
||||
# Manually installed plugins (in $HOME)
|
||||
if [ -d $HOME/.config/xed/plugins ]
|
||||
then
|
||||
echo "Plugins in \$HOME:"
|
||||
ls $HOME/.config/xed/plugins/*.xed-plugin \
|
||||
| sed -r -e 's#.*/([^/]*)\.xed-plugin$# - \1#'
|
||||
else
|
||||
echo "No plugin installed in \$HOME."
|
||||
fi
|
||||
echo
|
||||
|
||||
echo "Module versions:"
|
||||
if (which pkg-config > /dev/null)
|
||||
then
|
||||
for i in $PKG_CONFIG_MODULES
|
||||
do
|
||||
echo_padded "`echo -n $i | sed -r -e 's/^(.*)-[0-9]\.[0-9]$/\1/'`"
|
||||
pkg-config --modversion $i 2>/dev/null || echo
|
||||
done
|
||||
else
|
||||
echo " pkg-config unavailable"
|
||||
fi
|
||||
echo
|
@@ -42,6 +42,9 @@ Output version information and exit
|
||||
\fB\-?, \-h, \-\-help\fR
|
||||
Print standard command line options.
|
||||
.TP
|
||||
\fB\-w, \-\-wait\fR
|
||||
Open files and block the xed process.
|
||||
.TP
|
||||
\fB\-\-help\-all\fR
|
||||
Print all command line options.
|
||||
.P
|
||||
|
@@ -10,3 +10,8 @@ Icon=accessories-text-editor
|
||||
Categories=GTK;Utility;TextEditor;
|
||||
Keywords=text;editor;tabs;highlighting;code;multiple;files;pluggable;notepad;
|
||||
X-MATE-DocPath=xed/xed.xml
|
||||
Actions=new-window;
|
||||
|
||||
[Desktop Action new-window]
|
||||
Name=New Window
|
||||
Exec=xed --new-window %U
|
||||
|
@@ -1,12 +0,0 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
pluginsdir=@libdir@/xed/plugins
|
||||
|
||||
Name: xed
|
||||
Description: xed
|
||||
Requires: gtksourceview-3.0 libpeas-1.0 libpeas-gtk-1.0
|
||||
Version: @VERSION@
|
||||
Cflags: -I${includedir}/xed
|
||||
Libs: -L${libdir}
|
403
debian/changelog
vendored
403
debian/changelog
vendored
@@ -1,3 +1,406 @@
|
||||
xed (3.0.2) uma; urgency=medium
|
||||
|
||||
* l10n: Update translations
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Fri, 25 Jun 2021 15:15:39 +0100
|
||||
|
||||
xed (3.0.1) uma; urgency=medium
|
||||
|
||||
* l10n: Update translations
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Thu, 10 Jun 2021 11:04:22 +0100
|
||||
|
||||
xed (3.0.0) uma; urgency=medium
|
||||
|
||||
[ Talkashie ]
|
||||
* Fix various typos in index.docbook
|
||||
|
||||
[ Soapux ]
|
||||
* Fix permissions
|
||||
|
||||
[ okaestne ]
|
||||
* Implement #225: Options to render whitespace
|
||||
|
||||
[ Michael Webster ]
|
||||
* i18n: Don't translate gsettings strings.
|
||||
|
||||
[ okaestne ]
|
||||
* Fix crashes when no documents (tabs) are open
|
||||
|
||||
[ Justin Schiff ]
|
||||
* Uses strtol instead of atoi so that we can properly handle errors.
|
||||
* Use CLAMP macro instead
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* l10n: Update POT
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Tue, 01 Jun 2021 12:56:22 +0100
|
||||
|
||||
xed (2.8.4) ulyssa; urgency=medium
|
||||
|
||||
[ Eli Schwartz ]
|
||||
* fixup! cleanup: remove code dropped in commit 67892da099357e24b3fd3c31fa758947b1dfc47a
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* l10n: Update translations
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Sat, 02 Jan 2021 17:33:30 +0000
|
||||
|
||||
xed (2.8.3) ulyssa; urgency=medium
|
||||
|
||||
* Packaging: Add missing dependency on gir1.2-gtksource-4
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Mon, 14 Dec 2020 08:11:29 +0000
|
||||
|
||||
xed (2.8.2) ulyssa; urgency=medium
|
||||
|
||||
* l10n: Update translations
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Thu, 10 Dec 2020 12:14:34 +0000
|
||||
|
||||
xed (2.8.1) ulyssa; urgency=medium
|
||||
|
||||
[ Eli Schwartz ]
|
||||
* cleanup: remove code dropped in commit 67892da099357e24b3fd3c31fa758947b1dfc47a
|
||||
* remove never-used variable added in commit 9e805380d4aa6338ca1b85d06b5dbf60e9fb0cbe
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* bracketcompletion: Enable plugin by default
|
||||
* Remove links in plugin about dialogs
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Tue, 08 Dec 2020 10:11:12 +0000
|
||||
|
||||
xed (2.8.0) ulyssa; urgency=medium
|
||||
|
||||
[ JosephMcc ]
|
||||
* Port to Gtksourceview4
|
||||
* Add a new window desktop action
|
||||
* plugins: Clean up deprecated preprcessor commands
|
||||
* Clean up remaining deprecated preprocessor commands
|
||||
* xed-highlight-mode-selector.c: Fix a couple of missing casts
|
||||
* textsize plugin: Zoom text regardless of selection
|
||||
* xed-highlight-mode-dialog/selector: Clean up code style
|
||||
* xed-completion-plugin.c: Clean up the code style
|
||||
|
||||
[ Hrutvik Suthar ]
|
||||
* auto bracket complete feature - added bracket-complete dir in plugins - gtksourceview min depedency change to 4.0.3
|
||||
|
||||
[ Michael Webster ]
|
||||
* Add XAppFavorites support to the file menu.
|
||||
* meson.build: bump xapp version.
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* l10n: Update POT
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Mon, 30 Nov 2020 11:25:34 +0000
|
||||
|
||||
xed (2.6.2) ulyana; urgency=medium
|
||||
|
||||
* CI: Update targets
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Wed, 24 Jun 2020 12:44:58 +0100
|
||||
|
||||
xed (2.6.1) ulyana; urgency=medium
|
||||
|
||||
[ NikoKrause ]
|
||||
* l10n: add missing strings for new plugin joinlines (#385)
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* l10n: Update POT
|
||||
* l10n: Update translations
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Wed, 24 Jun 2020 12:06:37 +0100
|
||||
|
||||
xed (2.6.0) ulyana; urgency=medium
|
||||
|
||||
[ Stephen Collins ]
|
||||
* Disable the comments action when not supported to avoid confusion
|
||||
* Trailsave plugin: remove second trailing line
|
||||
* xed-tab-label.c: remove unused event box preventing scroll events
|
||||
|
||||
[ Michael Webster ]
|
||||
* xed-tab-label.c: Apply tab tooltip to the box containing the tab's label and icon, regression from 808e77b052322b8f.
|
||||
|
||||
[ Stephen Collins ]
|
||||
* Add .gitignore file
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* l10n: Update translations
|
||||
|
||||
[ Stephen Collins ]
|
||||
* Add settings widget to the prefs dialog for the implicit newline setting
|
||||
|
||||
[ icarter09 ]
|
||||
* Created initial test dir. Created File menu test.
|
||||
* Removed override_dh_auto_test so tests are not ran by default when building with dpkg.
|
||||
* Removed link that was not working.
|
||||
* Created new section for the Word Wrap shortcut. Increased height attribute to fit new section so a new page is not created.
|
||||
* Added logic to support using replace all across documents.
|
||||
* Added logic to check if the focus need to be set. Squashed formatting commits.
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* Packaging: Remove python dependency
|
||||
|
||||
[ Isaac Carter ]
|
||||
* Fixed memory issue found by valgrind (#366)
|
||||
|
||||
[ icarter09 ]
|
||||
* Cleaned up broken links.
|
||||
* Changed shortcut window to be non-model.
|
||||
* Added wait entry to man page. Removed logic that cause wait to open extra tab.
|
||||
* Added screen captures to README. Changed README to README.md and added markdown. Updated README with plugins and debian build instructions.
|
||||
|
||||
[ Isaac Carter ]
|
||||
* Update README.md
|
||||
|
||||
[ icarter09 ]
|
||||
* Added JoinLines plugin. Removed logic to split lines. Moved Join Line shortcut from Layout to Editing section.
|
||||
|
||||
[ JosephMcc ]
|
||||
* taglist: Use a symbolic icon in the notebook sidebar
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* l10n: Update POT
|
||||
* l10n: Update translations
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Mon, 11 May 2020 13:58:58 +0100
|
||||
|
||||
xed (2.4.2) tricia; urgency=medium
|
||||
|
||||
* l10n: Update translations
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Wed, 11 Dec 2019 14:49:32 +0000
|
||||
|
||||
xed (2.4.1) tricia; urgency=medium
|
||||
|
||||
* l10n: Update translations
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Tue, 26 Nov 2019 17:14:23 +0000
|
||||
|
||||
xed (2.4.0) tricia; urgency=medium
|
||||
|
||||
[ Michael Webster ]
|
||||
* print-preview: add a print button to the preview toolbar, to immediately print the previewed document.
|
||||
|
||||
[ nardholio ]
|
||||
* Packaging: remove dependency on libpeas-1.0-0-python3loader (#325)
|
||||
|
||||
[ Pavel Shlyak ]
|
||||
* Cleanup (#321)
|
||||
|
||||
[ Leigh Scott ]
|
||||
* add open uri plugin (#317)
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* open-uri: Make the plugin built-in
|
||||
* open-uri: Simplify and fix translations
|
||||
* Print preview: Reuse existing msgid
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Fri, 22 Nov 2019 12:12:12 +0000
|
||||
|
||||
xed (2.2.3) tina; urgency=medium
|
||||
|
||||
* l10n: Update translations
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Sun, 28 Jul 2019 15:03:33 +0200
|
||||
|
||||
xed (2.2.2) tina; urgency=medium
|
||||
|
||||
* Preferences: Make dialog slightly taller
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Thu, 25 Jul 2019 10:59:55 +0200
|
||||
|
||||
xed (2.2.1) tina; urgency=medium
|
||||
|
||||
[ Alexander Drozdov ]
|
||||
* Automatically open new Xed window on current workspace... (#319)
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* l10n: Update translations
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Wed, 10 Jul 2019 11:26:12 +0200
|
||||
|
||||
xed (2.2.0) tina; urgency=medium
|
||||
|
||||
[ Eli Schwartz ]
|
||||
* meson: require itstool command to be available (#266)
|
||||
|
||||
[ JosephMcc ]
|
||||
* statusbar: Fix the menu button styling (#281)
|
||||
* cleanup: Remove an unused Makefile.am (#280)
|
||||
|
||||
[ Stephen Collins ]
|
||||
* print preview: fix layout drawing for 1X2 and 2X1 layouts (#291)
|
||||
* Filebrowser: Kill the click policy property with fire (#293)
|
||||
|
||||
[ JosephMcc ]
|
||||
* xed-window: Fix the tabs/spaces label in the statusbar (#283)
|
||||
* xed-notebook: Always show the main notebook tabs (#285)
|
||||
|
||||
[ Stephen Collins ]
|
||||
* Fix some deprecation warnings (#289)
|
||||
* print preview: fix logic for forward button sensitivity (#292)
|
||||
* Add toggle comment and toggle comment block actions w/ keybindings (#290)
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* l10n: Update POT
|
||||
|
||||
[ Stephen Collins ]
|
||||
* print job: replace some deprecated font button functions (#294)
|
||||
* Replace deprecated gdk_cursor_new with gdk_cursor_new_for_display (#295)
|
||||
* Print preview: remove a couple calls to gtk_adjustment_value_changed (#296)
|
||||
* Search: replace a few functions that were deprecated in Gtk 3.22 (#297)
|
||||
* Fix stuttering and disappearing of the toolbar when fullscreen (#300)
|
||||
* Switch deprecated gtk_icon_info_free to g_object_unref (#301)
|
||||
* Remove references to deprecated GTK_STOCK_* (#298)
|
||||
* Remove deprecated call to gtk_widget_override_background_color (#299)
|
||||
* Tab width popup: only select a menu item when the menu is open (#311)
|
||||
* Simplify an if statement. The logic is identical, but easier to read (#314)
|
||||
|
||||
[ Leigh Scott ]
|
||||
* Add minimum required version for xapp (#313)
|
||||
|
||||
[ Stephen Collins ]
|
||||
* Prevent a warning when closing the window while print preview is open (#315)
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* l10n: Update POT
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Sat, 29 Jun 2019 17:23:48 +0200
|
||||
|
||||
xed (2.0.2) tessa; urgency=medium
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* Fix non-translated desktop file
|
||||
|
||||
[ Michael Webster ]
|
||||
* highlight mode window: Make activatable via shortcut (ctrl-shift-H), focus the search entry by default, and allow Escape to cancel the dialog from the search entry.
|
||||
|
||||
[ chingyinwan123 ]
|
||||
* Fix warnings when building xed 2.0.1 (#264)
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* l10n: Update translations
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Tue, 11 Dec 2018 14:10:08 +0000
|
||||
|
||||
xed (2.0.1) tessa; urgency=medium
|
||||
|
||||
[ Leigh Scott ]
|
||||
* Switch build instructions for meson port. (#263)
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* l10n: Update translations
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Tue, 27 Nov 2018 18:33:21 +0000
|
||||
|
||||
xed (2.0.0) tessa; urgency=medium
|
||||
|
||||
[ Tomasz Gąsior ]
|
||||
* Import GeditHighlightModeDialog and -Selector from Gedit to Xed.
|
||||
* Use highlight dialog instead submenu in "View" menu.
|
||||
* XedWindow cleanup.
|
||||
* Import GeditStatusMenuButton.
|
||||
* Fix compilation warning.
|
||||
* Use popover with highlight selector instead loooong menu in statusbar.
|
||||
* Use XedStatusMenuButton instead -ComboBox in statusbar, for consistency.
|
||||
* Kill XedStatusComboBox. It's not used now.
|
||||
|
||||
[ JosephMcc ]
|
||||
* xed-window: Indicate if we are currently using spaces or tabs in statusbar (#246)
|
||||
|
||||
[ NikoKrause ]
|
||||
* Use icon for keyboard shortcuts help entry (#255)
|
||||
* Rearrange help entries (xapp consistency) (#256)
|
||||
* close dialog: use "suggested-action" style class (#261)
|
||||
|
||||
[ Stephen Collins ]
|
||||
* Port to meson (#258)
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* Fix merge issues
|
||||
* l10n: Update POT
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Mon, 19 Nov 2018 11:34:46 +0000
|
||||
|
||||
xed (1.8.3) tara; urgency=medium
|
||||
|
||||
[ Michael Webster ]
|
||||
* search bar/xed-history-entry: Set a 'width-chars' on the GtkEntry widgets of the search and replace entry widgets, and allow their labels to ellipsize upon resizing.
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Tue, 17 Jul 2018 09:32:59 +0200
|
||||
|
||||
xed (1.8.2) tara; urgency=medium
|
||||
|
||||
[ NikoKrause ]
|
||||
* missing l10n: Help -> Shortcuts (#229)
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* l10n: Update POT file
|
||||
* l10n: Update translations
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Tue, 26 Jun 2018 13:21:55 +0200
|
||||
|
||||
xed (1.8.1) tara; urgency=medium
|
||||
|
||||
* l10n: Update translations
|
||||
* l10n: Update files
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Tue, 22 May 2018 12:53:38 +0100
|
||||
|
||||
xed (1.8.0) tara; urgency=medium
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* Add CI configuration
|
||||
|
||||
[ Leigh Scott ]
|
||||
* Fix clang compile issue (#209)
|
||||
* Fix Py*DeprecationWarning (#202)
|
||||
|
||||
[ JosephMcc ]
|
||||
* Pull upstream fixes for gtk and gtksourceview changes
|
||||
* preferences-dialog: Complete revamp
|
||||
* xed-window: Rework the fullscreen toolbar
|
||||
* xed-status-combo-box: Remove some deprecated css functionality
|
||||
* xed-view-frame: Fix the css for the minimap frame
|
||||
* xed-notebook: Clean up some gtk3.20+ conditionals
|
||||
* Add a shortcuts window
|
||||
* xed-view: Add shortcuts for change case
|
||||
* debian: Add --enable-silent-rules to debian/rules
|
||||
* css: Add support for Adwaita
|
||||
* xed-searchbar: Fix the size of the searchbar close button
|
||||
* xed-spell-checker.c: Clean up the code formatting
|
||||
* spell-plugin: Update for removal of some deprecated functionality
|
||||
* xed-notebook: Allow changing tabs with mouse back/forward buttons
|
||||
* Fix a couple of issues turned up by Codacy
|
||||
* Clean up a few build warnings
|
||||
* spell-plugin: Port to gspell
|
||||
* spell-plugin: Fix a link to the help file
|
||||
|
||||
[ Nic ]
|
||||
* Add C tags to the taglist plugin (#188)
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* CI: Don't build for Mint 18
|
||||
|
||||
[ JosephMcc ]
|
||||
* xed-window: Fix a potential crash
|
||||
|
||||
[ Mickael Albertus ]
|
||||
* Creation of plugin Word completion (#199)
|
||||
|
||||
[ Clement Lefebvre ]
|
||||
* Wordcompletion: Fix a few mgsids
|
||||
* l10n: Update POT file
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Sun, 06 May 2018 16:43:18 +0100
|
||||
|
||||
xed (1.6.3) sylvia; urgency=medium
|
||||
|
||||
* l10n: Update translations
|
||||
|
||||
-- Clement Lefebvre <root@linuxmint.com> Thu, 23 Nov 2017 12:24:36 +0000
|
||||
|
||||
xed (1.6.2) sylvia; urgency=medium
|
||||
|
||||
[ JosephMcc ]
|
||||
|
1
debian/clean
vendored
Normal file
1
debian/clean
vendored
Normal file
@@ -0,0 +1 @@
|
||||
debian/build/
|
19
debian/control
vendored
19
debian/control
vendored
@@ -2,18 +2,17 @@ Source: xed
|
||||
Section: x11
|
||||
Priority: optional
|
||||
Maintainer: Linux Mint <root@linuxmint.com>
|
||||
Build-Depends: autotools-dev,
|
||||
debhelper (>= 9),
|
||||
Build-Depends: debhelper (>= 9),
|
||||
gobject-introspection,
|
||||
gtk-doc-tools,
|
||||
intltool,
|
||||
iso-codes,
|
||||
libenchant-dev,
|
||||
libgirepository1.0-dev,
|
||||
libglib2.0-dev,
|
||||
libgspell-1-dev,
|
||||
libgtk-3-dev,
|
||||
libgtksourceview-3.0-dev,
|
||||
libgtksourceview-4-dev,
|
||||
libpeas-dev,
|
||||
libxapp-dev (>= 1.9),
|
||||
libsm-dev,
|
||||
libx11-dev,
|
||||
libxml2-dev,
|
||||
@@ -21,6 +20,7 @@ Build-Depends: autotools-dev,
|
||||
python3,
|
||||
python3-gi,
|
||||
yelp-tools,
|
||||
meson
|
||||
Standards-Version: 3.9.6
|
||||
|
||||
Package: xed
|
||||
@@ -30,10 +30,10 @@ Depends: iso-codes,
|
||||
${misc:Depends},
|
||||
${python:Depends},
|
||||
${shlibs:Depends},
|
||||
libpeas-1.0-0-python3loader | debian-system-adjustments,
|
||||
python3,
|
||||
python3-gi,
|
||||
xapps-common,
|
||||
gir1.2-gtksource-4,
|
||||
xapps-common (>= 1.9.0),
|
||||
zenity
|
||||
XB-Python-Version: ${python:Versions}
|
||||
Description: Text editor
|
||||
@@ -54,8 +54,7 @@ Description: Text editor
|
||||
|
||||
Package: xed-common
|
||||
Architecture: all
|
||||
Depends: python,
|
||||
${misc:Depends},
|
||||
Depends: ${misc:Depends},
|
||||
Description: Text editor (common files)
|
||||
Xed is a text editor which supports most standard editor features,
|
||||
extending this basic functionality with other features not usually
|
||||
@@ -145,4 +144,4 @@ Description: Text editor (documentation files)
|
||||
includes support for spell checking, comparing files, viewing CVS
|
||||
ChangeLogs, and adjusting indentation levels.
|
||||
.
|
||||
This package contains the documentation files.
|
||||
This package contains the documentation files.
|
||||
|
6
debian/copyright
vendored
6
debian/copyright
vendored
@@ -1,7 +1,7 @@
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: xed (old name: mate-text-editor)
|
||||
Upstream-Contact: Stefano Karapetsas <stefano@karapetsas.com>
|
||||
Source: http://git.mate-desktop.org/xed/
|
||||
Upstream-Name: xed
|
||||
Upstream-Contact: Linux Mint <root@linuxmint.com>
|
||||
Source: http://github.com/linuxmint/xed/
|
||||
|
||||
Files: plugins/docinfo/xed-docinfo-plugin.c
|
||||
plugins/docinfo/xed-docinfo-plugin.h
|
||||
|
26
debian/rules
vendored
26
debian/rules
vendored
@@ -5,27 +5,25 @@ DHFLAGS=--parallel
|
||||
%:
|
||||
dh $@ $(DHFLAGS) --with gir
|
||||
|
||||
override_dh_install:
|
||||
rm -rfv debian/tmp/usr/lib/*/xed/plugins/*.la
|
||||
rm -rfv debian/tmp/usr/lib/*/xed/*.la
|
||||
dh_install --fail-missing
|
||||
|
||||
override_dh_auto_configure:
|
||||
# upstream tarball is without configure. autogen.sh will create it
|
||||
NOCONFIGURE=1 ./autogen.sh
|
||||
dh_auto_configure $(DHFLAGS) -- \
|
||||
--disable-silent-rules \
|
||||
--libexecdir=/usr/lib/ \
|
||||
--enable-gtk-doc
|
||||
meson debian/build \
|
||||
--prefix=/usr \
|
||||
--buildtype=plain \
|
||||
-D docs=true \
|
||||
-D deprecated_warnings=false
|
||||
|
||||
override_dh_installchangelogs:
|
||||
dh_installchangelogs NEWS
|
||||
|
||||
override_dh_auto_test:
|
||||
DEB_BUILD_OPTIONS=nocheck dh_auto_test
|
||||
|
||||
override_dh_strip:
|
||||
dh_strip --dbg-package=xed-dbg
|
||||
|
||||
get-orig-source:
|
||||
uscan --noconf --force-download --rename --download-current-version --destdir=..
|
||||
|
||||
override_dh_auto_install:
|
||||
DESTDIR=${CURDIR}/debian/tmp \
|
||||
ninja -C debian/build install
|
||||
|
||||
override_dh_auto_build:
|
||||
ninja -C debian/build
|
||||
|
2
debian/xed-common.install
vendored
2
debian/xed-common.install
vendored
@@ -1,4 +1,4 @@
|
||||
usr/share/appdata
|
||||
usr/share/metainfo
|
||||
usr/share/xed/plugins
|
||||
usr/share/glib-2.0
|
||||
usr/share/help
|
||||
|
1
debian/xed.install
vendored
1
debian/xed.install
vendored
@@ -1,6 +1,5 @@
|
||||
usr/bin/xed
|
||||
usr/lib/*/xed/girepository-1.0/
|
||||
usr/lib/xed/xed-bugreport.sh
|
||||
usr/lib/*/xed/plugins/
|
||||
usr/lib/*/xed/*.so
|
||||
usr/share/applications/xed.desktop
|
||||
|
@@ -1,5 +0,0 @@
|
||||
SUBDIRS = reference
|
||||
|
||||
EXTRA_DIST = class-diagram.dia
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
@@ -1,74 +0,0 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
# see /gtk-doc/examples/Makefile.am
|
||||
|
||||
# We require automake 1.6 at least.
|
||||
AUTOMAKE_OPTIONS = 1.6
|
||||
|
||||
# The name of the module, e.g. 'glib'.
|
||||
DOC_MODULE = xed
|
||||
|
||||
# The top-level XML file (SGML in the past).
|
||||
DOC_MAIN_SGML_FILE = xed-docs.xml
|
||||
|
||||
# The directory containing the source code. Relative to $(srcdir).
|
||||
DOC_SOURCE_DIR = ../../xed
|
||||
|
||||
# Extra options to supply to gtkdoc-scan.
|
||||
# e.g. SCAN_OPTIONS = --deprecated-guards="GTK_DISABLE_DEPRECATED"
|
||||
SCAN_OPTIONS = --rebuild-types
|
||||
|
||||
# Extra options to supply to gtkdoc-mkdb.
|
||||
MKDB_OPTIONS = --xml-mode --output-format=xml
|
||||
|
||||
# Used for dependencies. The docs will be rebuilt if any of these change.
|
||||
HFILE_GLOB = $(top_srcdir)/xed/*.h
|
||||
CFILE_GLOB = $(top_srcdir)/xed/*.c
|
||||
|
||||
# Header files to ignore when scanning (These are internal to xed).
|
||||
IGNORE_HFILES= \
|
||||
xed-close-confirmation-dialog.h \
|
||||
xed-dirs.h \
|
||||
xed-commands.h \
|
||||
xed-documents-panel.h \
|
||||
xed-io-error-info-bar.h \
|
||||
xed-languages-manager.h \
|
||||
xed-plugins-engine.h \
|
||||
xed-session.h \
|
||||
xed-ui.h \
|
||||
xed-window-private.h \
|
||||
xed-output-window.h \
|
||||
xed-encodings-dialog.h \
|
||||
xed-open-location-dialog.h \
|
||||
xed-page-setup-dialog.h \
|
||||
xed-preferences-dialog.h \
|
||||
xed-search-dialog.h \
|
||||
xed-marshal.h \
|
||||
xed-enum-types.h
|
||||
|
||||
# Images to copy into HTML directory.
|
||||
HTML_IMAGES =
|
||||
|
||||
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
|
||||
content_files =
|
||||
|
||||
# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
|
||||
# Only needed if you are using gtkdoc-scangobj to dynamically query widget
|
||||
# signals and properties.
|
||||
GTKDOC_CFLAGS = \
|
||||
-I$(top_srcdir)/xed \
|
||||
-I$(top_builddir)/xed \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_builddir) \
|
||||
$(XED_CFLAGS)
|
||||
|
||||
GTKDOC_LIBS = \
|
||||
$(top_builddir)/xed/libxed.la \
|
||||
$(XED_LIBS)
|
||||
|
||||
MAINTAINERCLEANFILES = xed.types
|
||||
|
||||
# This includes the standard gtk-doc make rules, copied by gtkdocize.
|
||||
include $(top_srcdir)/gtk-doc.make
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
36
docs/reference/meson.build
Normal file
36
docs/reference/meson.build
Normal file
@@ -0,0 +1,36 @@
|
||||
docs_ignore_h = [
|
||||
'xed-close-confirmation-dialog.h',
|
||||
'xed-dirs.h',
|
||||
'xed-commands.h',
|
||||
'xed-documents-panel.h',
|
||||
'xed-io-error-info-bar.h',
|
||||
'xed-languages-manager.h',
|
||||
'xed-plugins-engine.h',
|
||||
'xed-session.h',
|
||||
'xed-ui.h',
|
||||
'xed-window-private.h',
|
||||
'xed-output-window.h',
|
||||
'xed-encodings-dialog.h',
|
||||
'xed-open-location-dialog.h',
|
||||
'xed-page-setup-dialog.h',
|
||||
'xed-preferences-dialog.h',
|
||||
'xed-search-dialog.h',
|
||||
'xed-marshal.h',
|
||||
'xed-enum-types.h'
|
||||
]
|
||||
|
||||
gnome.gtkdoc(
|
||||
'xed',
|
||||
mode: 'xml',
|
||||
install: true,
|
||||
main_xml: 'xed-docs.xml',
|
||||
gobject_typesfile: 'xed.types',
|
||||
src_dir: [
|
||||
join_paths(meson.source_root(), 'xed'),
|
||||
join_paths(meson.build_root(), 'xed'),
|
||||
],
|
||||
ignore_headers: docs_ignore_h,
|
||||
dependencies: libxed_dep,
|
||||
scan_args: ['--rebuild-types'],
|
||||
mkdb_args: ['--xml-mode', '--output-format=xml'],
|
||||
)
|
@@ -458,8 +458,6 @@ xed_help_display
|
||||
GBOOLEAN_TO_POINTER
|
||||
GPOINTER_TO_BOOLEAN
|
||||
IS_VALID_BOOLEAN
|
||||
xed_utils_menu_position_under_widget
|
||||
xed_utils_menu_position_under_tree_view
|
||||
xed_gtk_button_new_with_stock_icon
|
||||
xed_dialog_add_button
|
||||
xed_utils_escape_underscores
|
||||
|
@@ -292,7 +292,7 @@
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
<para>Valid types of <replaceable>URI</replaceable> include <literal>http:</literal>, <literal>ftp:</literal>, <literal>file:</literal>, and all of the methods supported by <literal>gvfs</literal>.</para>
|
||||
<para>Files from some types of URI are opened as read-only, and any changes you make must be saved to a different location. HTTP only allows files to be read. Files opened from FTP are read-only because because not all FTP servers may correctly work with saving remote files.</para>
|
||||
<para>Files from some types of URI are opened as read-only, and any changes you make must be saved to a different location. HTTP only allows files to be read. Files opened from FTP are read-only because not all FTP servers may correctly work with saving remote files.</para>
|
||||
</sect2>
|
||||
|
||||
<!-- ============= Working with tabs ======================== -->
|
||||
@@ -350,7 +350,7 @@
|
||||
</listitem>
|
||||
<listitem><para>Type the string that you want to find in the <guilabel>Search for</guilabel> field. You can include special characters such as a new line or tab: see <xref linkend="xed-find-escapes"/>.</para>
|
||||
</listitem>
|
||||
<listitem><para>Click <guibutton>Find</guibutton> to search the file for the first occurrence of the string after your current cursor position. If <application>&app;</application> finds the string, the application selects first occurrence of the string. Other occurrences of the string are highlighted.</para>
|
||||
<listitem><para>Click <guibutton>Find</guibutton> to search the file for the first occurrence of the string after your current cursor position. If <application>&app;</application> finds the string, the application selects the first occurrence of the string. Other occurrences of the string are highlighted.</para>
|
||||
</listitem>
|
||||
<listitem><para>To find the next occurrence of the string, click <guibutton>Find</guibutton> or choose <menuchoice> <guimenu>Search</guimenu> <guimenuitem>Find Next</guimenuitem> </menuchoice>. To find the previous occurrence of the text, choose <menuchoice> <guimenu>Search</guimenu> <guimenuitem>Find Previous</guimenuitem> </menuchoice>.</para>
|
||||
</listitem>
|
||||
@@ -1191,7 +1191,7 @@
|
||||
</variablelist>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="xed-prefs-plugins">
|
||||
<sect2 id="xed-prefs-plugins" xreflabel="Plugins Preferences">
|
||||
<title>Plugins Preferences</title>
|
||||
<para>Plugins add extra features to <application>&app;</application>. For more information on plugins and how to use the built-in plugins, see <xref linkend="xed-plugins-overview"/>.</para>
|
||||
|
||||
@@ -1245,45 +1245,42 @@
|
||||
<title>Working with Plugins</title>
|
||||
<para>You can add extra features to <application>&app;</application> by enabling <firstterm>plugins</firstterm>. A plugin is a supplementary program that enhances the functionality of an application. Plugins add new items to the <application>&app;</application> menus for the new features they provide.
|
||||
</para>
|
||||
<para>Several plugins come built-in with <application>&app;</application>, and you can install more. The <ulink type="http" url="http://live.gnome.org/Xed/Plugins">xed website</ulink> lists third-party plugins.</para>
|
||||
<para>To enable and disable plugins, or see which plugins are currently enabled, use the <link linkend="xed-prefs-plugins">Plugins Preferences</link>.</para>
|
||||
<para>Several plugins come built-in with <application>&app;</application>, and you can install more.</para>
|
||||
<para>To enable and disable plugins, or see which plugins are currently enabled, use the <xref linkend="xed-prefs-plugins"/>.</para>
|
||||
<para>The following plugins come built-in with <application>&app;</application>:</para>
|
||||
<!-- Not yet documented:
|
||||
File browser
|
||||
-->
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><link linkend="xed-change-case-plugin"><application>Change Case</application></link> allows you to change the case of the selected text.</para>
|
||||
<para><xref linkend="xed-change-case-plugin"/> allows you to change the case of the selected text.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><application><link linkend="xed-document-statistics-plugin">Document Statistics</link></application> shows the number of lines, words, and characters in the document. </para>
|
||||
<para><xref linkend="xed-document-statistics-plugin"/> shows the number of lines, words, and characters in the document. </para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><application><!-- <link linkend="xed-file-browser-plugin">File Browser</link>-->File Browser</application> allows you to browse your files and folders in the side pane.</para>
|
||||
<para><xref linkend="xed-file-browser-plugin"/> allows you to browse your files and folders in the side pane.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><application><link linkend="xed-indent-lines-plugin">Indent Lines</link></application> adds or removes indentation from the selected lines.</para>
|
||||
<para><xref linkend="xed-indent-lines-plugin"/> adds or removes indentation from the selected lines.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><application><link linkend="xed-insert-date-time-plugin">Insert Date/Time</link></application> adds the current date and time into a document.</para>
|
||||
<para><xref linkend="xed-insert-date-time-plugin"/> adds the current date and time into a document.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><application><link linkend="xed-modelines-plugin">Modelines</link></application> allows you to set editing preferences for individual documents, and supports <application>Emacs</application>, <application>Kate</application> and <application>Vim</application>-style modelines.</para>
|
||||
<para><xref linkend="xed-modelines-plugin"/> allows you to set editing preferences for individual documents, and supports <application>Emacs</application>, <application>Kate</application> and <application>Vim</application>-style modelines.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><application><link linkend="xed-sort-plugin">Sort</link></application> arranges selected lines of text into alphabetical order.</para>
|
||||
<para><xref linkend="xed-sort-plugin"/> arranges selected lines of text into alphabetical order.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><application><link linkend="xed-spell-checker-plugin">Spell Checker</link></application> corrects the spelling in the selected text, or marks errors automatically in the document.</para>
|
||||
<para><xref linkend="xed-spell-checker-plugin"/> corrects the spelling in the selected text, or marks errors automatically in the document.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><application><link linkend="xed-tag-list-plugin">Tag List</link></application> lets you insert commonly-used tags for HTML and other languages from a list in the side pane.</para>
|
||||
<para><xref linkend="xed-tag-list-plugin"/> lets you insert commonly-used tags for HTML and other languages from a list in the side pane.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
</sect2>
|
||||
|
||||
<sect2 id="xed-change-case-plugin">
|
||||
<sect2 id="xed-change-case-plugin" xreflabel="Change Case">
|
||||
<title>Change Case Plugin</title>
|
||||
<para>The <application>Change Case</application> plugin changes the case of the selected text.</para>
|
||||
<para>The following items are added to the <guimenu>Edit</guimenu> menu when the <application>Change Case</application> plugin is enabled:</para>
|
||||
@@ -1334,7 +1331,7 @@
|
||||
|
||||
</sect2>
|
||||
|
||||
<sect2 id="xed-document-statistics-plugin">
|
||||
<sect2 id="xed-document-statistics-plugin" xreflabel="Document Statistics">
|
||||
<title>Document Statistics Plugin</title>
|
||||
<para>The <application>Document Statistics</application> plugin counts the number of lines, words, characters with spaces, characters without spaces, and bytes in the current file. The plugin displays the results in a <guilabel>Document Statistics</guilabel> dialog. To use the Document Statistics plugin, perform the following steps:</para>
|
||||
<orderedlist>
|
||||
@@ -1364,7 +1361,7 @@
|
||||
</orderedlist>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="xed-file-browser-plugin">
|
||||
<sect2 id="xed-file-browser-plugin" xreflabel="File Browser">
|
||||
<title>File Browser Plugin</title>
|
||||
<para>The <application>File Browser</application> Plugin shows your files and folders in the side pane, allowing you to quickly open files.</para>
|
||||
<para>To view the File Browser, choose <menuchoice><guimenu>View</guimenu> <guimenuitem>Side Pane</guimenuitem> </menuchoice> and then click on the tab showing the File Browser icon at the bottom of the side pane.</para>
|
||||
@@ -1385,7 +1382,7 @@
|
||||
</sect3>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="xed-indent-lines-plugin">
|
||||
<sect2 id="xed-indent-lines-plugin" xreflabel="Indent Lines">
|
||||
<title>Indent Lines Plugin</title>
|
||||
<para>The <application>Indent Lines</application> plugin adds or removes space from the beginning of lines of text.</para>
|
||||
<para>To indent or unindent text, perform the following steps:</para>
|
||||
@@ -1403,11 +1400,11 @@
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
<para>The amount of space used, and whether tab character or space characters are used, depends on the <guilabel>Tab Stops</guilabel> settings in the Editor Preferences: see <xref linkend="xed-prefs-editor"/>.</para>
|
||||
<para>The amount of space used, and whether tab characters or space characters are used, depends on the <guilabel>Tab Stops</guilabel> settings in the Editor Preferences: see <xref linkend="xed-prefs-editor"/>.</para>
|
||||
|
||||
</sect2>
|
||||
|
||||
<sect2 id="xed-insert-date-time-plugin">
|
||||
<sect2 id="xed-insert-date-time-plugin" xreflabel="Insert Date/Time">
|
||||
<title>Insert Date/Time Plugin</title>
|
||||
<para>The <application>Insert Date/Time</application> plugin inserts the current date and time into a document. To use the Insert Date/Time plugin, perform the following steps:</para>
|
||||
<orderedlist>
|
||||
@@ -1455,7 +1452,7 @@
|
||||
</sect3>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="xed-modelines-plugin">
|
||||
<sect2 id="xed-modelines-plugin" xreflabel="Modelines">
|
||||
<title>Modelines Plugin</title>
|
||||
<para>The <application>Modelines</application> plugin allows you to set preferences for individual documents. A <firstterm>modeline</firstterm> is a line of text at the start or end of the document with settings that <application>&app;</application> recognises.</para>
|
||||
<para>Preferences set using modelines take precedence over the ones specified in the preference dialog.</para>
|
||||
@@ -1483,21 +1480,21 @@
|
||||
<sect3 id="xed-modelines-plugin-emacs">
|
||||
<title>Emacs Modelines</title>
|
||||
<para>The first two lines of a document are scanned for <application>Emacs</application> modelines.</para>
|
||||
<para>The <application>Emacs</application> options for tab-width, indent-offset, indent-tabs-mode and autowrap are supported. For more information, see the <ulink type="http" url="http://www.delorie.com/gnu/docs/emacs/emacs_486.html">GNU Emacs Manual</ulink>.</para>
|
||||
<para>The <application>Emacs</application> options for tab-width, indent-offset, indent-tabs-mode and autowrap are supported. For more information, see the <ulink type="http" url="http://www.gnu.org/software/emacs/manual/html_node/emacs/index.html">GNU Emacs Manual</ulink>.</para>
|
||||
</sect3>
|
||||
<sect3 id="xed-modelines-plugin-kate">
|
||||
<title>Kate Modelines</title>
|
||||
<para>The first and last ten lines a document are scanned for <application>Kate</application> modelines.</para>
|
||||
<para>The <application>Kate</application> options for tab-width, indent-width, space-indent, word-wrap and word-wrap-column are supported. For more information, see the <ulink type="http" url="http://www.kate-editor.org/article/katepart_modelines">Kate website</ulink>.</para>
|
||||
<para>The first and last ten lines of a document are scanned for <application>Kate</application> modelines.</para>
|
||||
<para>The <application>Kate</application> options for tab-width, indent-width, space-indent, word-wrap and word-wrap-column are supported. For more information, see the <ulink type="http" url="http://www.kate-editor.org">Kate website</ulink>.</para>
|
||||
</sect3>
|
||||
<sect3 id="xed-modelines-plugin-vim">
|
||||
<title>Vim Modelines</title>
|
||||
<para>The first and last three lines a document are scanned for <application>Vim</application> modelines.</para>
|
||||
<para>The first and last three lines of a document are scanned for <application>Vim</application> modelines.</para>
|
||||
<para>The <application>Vim</application> options for et, expandtab, ts, tabstop, sw, shiftwidth, wrap, and textwidth are supported. For more information, see the <ulink type="http" url="http://vimdoc.sourceforge.net/htmldoc/options.html#modeline">Vim website</ulink>.</para>
|
||||
</sect3>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="xed-sort-plugin">
|
||||
<sect2 id="xed-sort-plugin" xreflabel="Sort">
|
||||
<title>Sort Plugin</title>
|
||||
<para>The <application>Sort</application> plugin arranges selected lines of text into alphabetical order.</para>
|
||||
<caution><para>You cannot undo the Sort operation, so you should save the file before performing the sort. To revert to the saved version of the file after the sort operation, choose <menuchoice> <guimenu>File</guimenu> <guimenuitem>Revert</guimenuitem> </menuchoice>.
|
||||
@@ -1534,7 +1531,7 @@
|
||||
</orderedlist>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="xed-spell-checker-plugin">
|
||||
<sect2 id="xed-spell-checker-plugin" xreflabel="Spell Checker">
|
||||
<title>Spell Checker Plugin</title>
|
||||
<para>The <application>Spell Checker</application> plugin checks the spelling in the selected text. You can configure <application>&app;</application> to check the spelling automatically, or you can check the spelling manually, in the specified language. The language setting, and the autocheck spelling properties, apply per document. To use the Spell checker plugin, perform the following steps:</para>
|
||||
<orderedlist>
|
||||
@@ -1589,7 +1586,7 @@
|
||||
</orderedlist>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="xed-tag-list-plugin">
|
||||
<sect2 id="xed-tag-list-plugin" xreflabel="Tag List">
|
||||
<title>Tag List Plugin</title>
|
||||
<para>The <application>Tag List</application> plugin allows you to insert common tags from a list in the side pane.</para>
|
||||
<para>To use the Tag List plugin, perform the following steps:</para>
|
||||
|
23
help/LINGUAS
Normal file
23
help/LINGUAS
Normal file
@@ -0,0 +1,23 @@
|
||||
ar
|
||||
bg
|
||||
ca
|
||||
cs
|
||||
da
|
||||
de
|
||||
el
|
||||
es
|
||||
fi
|
||||
fr
|
||||
hu
|
||||
it
|
||||
ja
|
||||
ko
|
||||
oc
|
||||
pt_BR
|
||||
ru
|
||||
sv
|
||||
th
|
||||
uk
|
||||
zh_CN
|
||||
zh_HK
|
||||
zh_TW
|
@@ -1,16 +0,0 @@
|
||||
@YELP_HELP_RULES@
|
||||
|
||||
HELP_ID = xed
|
||||
HELP_FILES = index.docbook legal.xml
|
||||
HELP_MEDIA = \
|
||||
figures/xed_format_bold.png \
|
||||
figures/xed_format_italic.png \
|
||||
figures/xed_format_strikethrough.png \
|
||||
figures/xed_format_underline.png \
|
||||
figures/xed_recent_files_menu_icon.png \
|
||||
figures/xed_window.png
|
||||
|
||||
HELP_LINGUAS = ar bg ca cs da de el es fi fr hu it ja ko oc pt_BR ru sv th uk zh_CN zh_HK zh_TW
|
||||
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
20
help/meson.build
Normal file
20
help/meson.build
Normal file
@@ -0,0 +1,20 @@
|
||||
help_sources = [
|
||||
'index.docbook',
|
||||
'legal.xml'
|
||||
]
|
||||
|
||||
help_media = [
|
||||
'figures/xed_format_bold.png',
|
||||
'figures/xed_format_italic.png',
|
||||
'figures/xed_format_strikethrough.png',
|
||||
'figures/xed_format_underline.png',
|
||||
'figures/xed_recent_files_menu_icon.png',
|
||||
'figures/xed_window.png'
|
||||
]
|
||||
|
||||
gnome.yelp(
|
||||
meson.project_name(),
|
||||
sources: help_sources,
|
||||
media: help_media,
|
||||
symlink_media: false
|
||||
)
|
114
meson.build
Normal file
114
meson.build
Normal file
@@ -0,0 +1,114 @@
|
||||
project('xed', 'c', version : '3.0.2')
|
||||
|
||||
gnome = import('gnome')
|
||||
i18n = import('i18n')
|
||||
pkgconfig = import('pkgconfig')
|
||||
|
||||
version = meson.project_version()
|
||||
|
||||
xed_conf = configuration_data()
|
||||
xed_conf.set_quoted('VERSION', version)
|
||||
#xed_conf.set_quoted('GETTEXT_PACKAGE', 'xed')
|
||||
xed_conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
|
||||
|
||||
# directories
|
||||
prefix = get_option('prefix')
|
||||
bindir = get_option('bindir')
|
||||
datadir = get_option('datadir')
|
||||
libdir = get_option('libdir')
|
||||
includedir = get_option('includedir')
|
||||
libexecdir = get_option('libexecdir')
|
||||
desktopdir = join_paths(datadir, 'applications')
|
||||
schema_dir = join_paths(datadir, 'glib-2.0', 'schemas')
|
||||
|
||||
po_dir = join_paths(meson.source_root(), 'po')
|
||||
|
||||
# dependencies
|
||||
libxml = dependency('libxml-2.0', version: '>= 2.5.0')
|
||||
glib = dependency('glib-2.0', version: '>= 2.40.0')
|
||||
gthread = dependency('gthread-2.0', version: '>= 2.13.0')
|
||||
gio = dependency('gio-2.0', version: '>= 2.40.0')
|
||||
gtk = dependency('gtk+-3.0', version: '>= 3.19.3')
|
||||
gtksourceview = dependency('gtksourceview-4', version: '>= 4.0.3')
|
||||
libpeas = dependency('libpeas-1.0', version: '>= 1.12.0')
|
||||
libpeas_gtk = dependency('libpeas-gtk-1.0', version: '>= 1.12.0')
|
||||
gir_dep = dependency('gobject-introspection-1.0', version: '>= 1.42.0', required: false)
|
||||
gmodule = dependency('gmodule-2.0')
|
||||
xapp = dependency('xapp', version: '>= 1.9.0')
|
||||
X11 = dependency('x11')
|
||||
pango = dependency('pango')
|
||||
|
||||
if gir_dep.found()
|
||||
xed_conf.set('ENABLE_INTROSPECTION', 1)
|
||||
endif
|
||||
|
||||
enable_spell = get_option('enable_spell')
|
||||
if enable_spell
|
||||
gspell = dependency('gspell-1', version: '>= 0.2.5')
|
||||
endif
|
||||
|
||||
if get_option('enable_gvfs_metadata')
|
||||
xed_conf.set('ENABLE_GVFS_METADATA', true)
|
||||
endif
|
||||
|
||||
# on some systems we need to find the math lib to make sure it builds
|
||||
cc = meson.get_compiler('c')
|
||||
math = cc.find_library('m', required: false)
|
||||
|
||||
intltool_merge = find_program('intltool-merge')
|
||||
itstool = find_program('itstool')
|
||||
|
||||
# generate config.h
|
||||
config_h_file = configure_file(
|
||||
output : 'config.h',
|
||||
configuration : xed_conf
|
||||
)
|
||||
|
||||
config_h = declare_dependency(
|
||||
sources: config_h_file
|
||||
)
|
||||
|
||||
include_dirs = include_directories('.', 'xed')
|
||||
|
||||
# compiler flags
|
||||
add_global_arguments('-DDATADIR="@0@"'.format(join_paths(prefix, datadir)), language: 'c')
|
||||
add_global_arguments('-DLIBDIR="@0@"'.format(join_paths(prefix, libdir)), language: 'c')
|
||||
|
||||
# remove this later or add as build option
|
||||
if not get_option('deprecated_warnings')
|
||||
add_global_arguments([
|
||||
'-Wno-deprecated-declarations',
|
||||
'-Wno-deprecated',
|
||||
'-Wno-declaration-after-statement',
|
||||
],
|
||||
language: 'c',
|
||||
)
|
||||
endif
|
||||
|
||||
subdir('xed')
|
||||
subdir('pixmaps')
|
||||
subdir('po')
|
||||
subdir('data')
|
||||
subdir('plugins')
|
||||
subdir('help')
|
||||
if get_option('docs')
|
||||
subdir('docs/reference')
|
||||
endif
|
||||
|
||||
# The tests use an option that doesn't exist in meson before 0.46.
|
||||
# Since they aren't strictly necessary, we'll just skip them for earlier versions
|
||||
# rather than making 0.46 a hard requirement. This condition can be removed once we
|
||||
# no longer need to worry about building on 0.45 or earlier
|
||||
meson_version_parts = meson.version().split('.')
|
||||
if meson_version_parts[0].to_int() > 0 or meson_version_parts[1].to_int() >= 46
|
||||
subdir('test')
|
||||
endif
|
||||
|
||||
message('prefix = @0@'.format(prefix))
|
||||
message('bindir = @0@'.format(bindir))
|
||||
message('datadir = @0@'.format(datadir))
|
||||
message('libdir = @0@'.format(libdir))
|
||||
message('includedir = @0@'.format(includedir))
|
||||
message('libexecdir = @0@'.format(libexecdir))
|
||||
message('desktopdir = @0@'.format(desktopdir))
|
||||
message('schema_dir = @0@'.format(schema_dir))
|
23
meson_options.txt
Normal file
23
meson_options.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
option(
|
||||
'enable_spell',
|
||||
type : 'boolean',
|
||||
value : true,
|
||||
description : 'enable gspell'
|
||||
)
|
||||
option(
|
||||
'enable_gvfs_metadata',
|
||||
type : 'boolean',
|
||||
value : true,
|
||||
description : 'enable gvfs metadata'
|
||||
)
|
||||
option('docs',
|
||||
type: 'boolean',
|
||||
value: false,
|
||||
description: 'Build the API references (requires gtk-doc)'
|
||||
)
|
||||
option(
|
||||
'deprecated_warnings',
|
||||
type : 'boolean',
|
||||
value : false,
|
||||
description: 'Show build warnings for deprecations'
|
||||
)
|
@@ -1,8 +0,0 @@
|
||||
icondir = $(datadir)/xed/icons
|
||||
icon_DATA = xed-plugin.png
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(icon_DATA) \
|
||||
xed.ico
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
4
pixmaps/meson.build
Normal file
4
pixmaps/meson.build
Normal file
@@ -0,0 +1,4 @@
|
||||
install_data(
|
||||
'xed-plugin.png',
|
||||
install_dir: join_paths(datadir, 'xed', 'icons')
|
||||
)
|
@@ -1,26 +0,0 @@
|
||||
DIST_SUBDIRS = \
|
||||
docinfo \
|
||||
filebrowser \
|
||||
modelines \
|
||||
sort \
|
||||
spell \
|
||||
taglist \
|
||||
textsize \
|
||||
time \
|
||||
trailsave
|
||||
|
||||
SUBDIRS = \
|
||||
docinfo \
|
||||
filebrowser \
|
||||
modelines \
|
||||
sort \
|
||||
taglist \
|
||||
textsize \
|
||||
time \
|
||||
trailsave
|
||||
|
||||
if ENABLE_ENCHANT
|
||||
SUBDIRS += spell
|
||||
endif
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
@@ -0,0 +1,105 @@
|
||||
[Plugin]
|
||||
Loader=python3
|
||||
Module=bracketcompletion
|
||||
IAge=3
|
||||
Name[ar]=إكمال الأقواس
|
||||
Name[be]=Дапаўненне дужак
|
||||
Name[bs]=Zatvaranje zagrada
|
||||
Name[ca]=Compleció dels claudàtors
|
||||
Name[ca@valencia]=Compleció dels claudàtors
|
||||
Name[cs]=Doplňování závorek
|
||||
Name[da]=Klammefuldførelse
|
||||
Name[de]=Klammern schließen
|
||||
Name[el]=Συμπλήρωση αγκύλων
|
||||
Name[en_GB]=Bracket Completion
|
||||
Name[eo]=Krampo-kompletigo
|
||||
Name[es]=Completar paréntesis
|
||||
Name[et]=Sulgude lõpetamine
|
||||
Name[eu]=Parentesien osaketa
|
||||
Name[fi]=Sulkuparin täsmäys
|
||||
Name[fr]=Complétion de parenthèses
|
||||
Name[fur]=Completament parentesis
|
||||
Name[gl]=Completar parénteses
|
||||
Name[he]=התאמת סוגריים
|
||||
Name[hr]=Dovršavanje zagrada
|
||||
Name[hu]=Zárójel-kiegészítés
|
||||
Name[id]=Penyelesaian Tanda Kurung
|
||||
Name[it]=Completamento parentesi
|
||||
Name[ja]=カッコの補完
|
||||
Name[kk]=Жақшаларды толықтыру
|
||||
Name[ko]=각괄호 일치
|
||||
Name[lt]=Skliaustų užbaigimas
|
||||
Name[lv]=Iekavu noslēgšana
|
||||
Name[nl]=Haakjes-voltooiing
|
||||
Name[oc]=Complecion de parentèsis
|
||||
Name[pl]=Uzupełnianie nawiasów
|
||||
Name[pt]=Conclusão de chavetas
|
||||
Name[pt_BR]=Fechamento de parênteses
|
||||
Name[ro]=Completare paranteze
|
||||
Name[ru]=Дополнение скобок
|
||||
Name[sk]=Dopĺňanie pravých zátvoriek
|
||||
Name[sl]=Dopolnjevanje oklepajev
|
||||
Name[sr]=Допуњавање заграда
|
||||
Name[sr@latin]=Dopunjavanje zagrada
|
||||
Name[sv]=Parenteskomplettering
|
||||
Name[te]=బ్రాకెట్ ముగింపు
|
||||
Name[th]=การเติมเต็มคู่วงเล็บ
|
||||
Name[tr]=Parantez Tamamlama
|
||||
Name[zh_CN]=括号补全
|
||||
Name[zh_TW]=括號補完
|
||||
Name=Bracket Completion
|
||||
Description[ar]=يغلق الأقواس آليا.
|
||||
Description[as]=বন্ধনী নিজেই যোগ কৰে ।
|
||||
Description[be]=Аўтаматычна дадае канцавыя дужкі.
|
||||
Description[be@latin]=Aŭtamatyčna dadaje kancavyja dužki.
|
||||
Description[bs]=Automatski dodaj zatvorene zagrade.
|
||||
Description[ca]=Afegeix claudàtors de tancada automàticament.
|
||||
Description[ca@valencia]=Afig claudàtors de tancada automàticament.
|
||||
Description[cs]=Automaticky přidává zavírací závorky.
|
||||
Description[da]=Tilføjer automatisk afsluttende klammer.
|
||||
Description[de]=Fügt automatisch schließende Klammern hinzu.
|
||||
Description[dz]=ཁ་བསྡམ་གུག་ཤད་ཚུ་ རང་བཞིན་གྱིས་ཁ་སྐོང་རྐྱབ་ཨིན།
|
||||
Description[el]=Συμπληρώνει αυτόματα τις αγκύλες.
|
||||
Description[en_CA]=Automatically adds closing brackets.
|
||||
Description[en_GB]=Automatically adds closing brackets.
|
||||
Description[eo]=Aŭtomate aldoni fermantajn krampojn.
|
||||
Description[es]=Añadir automáticamente cierres de paréntesis.
|
||||
Description[eu]=Automatikoki gehitzen ditu itxierako parentesiak.
|
||||
Description[fi]=Lisää suluille pääte automaattisesti.
|
||||
Description[fr]=Ajouter automatiquement les parenthèses fermantes.
|
||||
Description[fur]=Al zonte in automatic lis parentesis sieradis.
|
||||
Description[gl]=Engadir automaticamente peches de parénteses.
|
||||
Description[gu]=બંધ કરતા કૌંસો ઓપોઆપ ઉમેરાય છે.
|
||||
Description[he]=הוספת סוגר לסגירה.
|
||||
Description[hr]=Automatski zatvara zagrade.
|
||||
Description[hu]=Automatikusan hozzáadja a záró zárójeleket.
|
||||
Description[id]=Otomatis menambah kurung tutup.
|
||||
Description[it]=Aggiunge automaticamente le parentesi di chiusura
|
||||
Description[ja]=終わり括弧を自動的に追加します
|
||||
Description[kk]=Жабатын жақшаны автоматты түрде қосады.
|
||||
Description[ko]=자동으로 닫는 각괄호를 추가합니다.
|
||||
Description[lt]=Automatiškai prideda užveriančius skliaustus.
|
||||
Description[lv]=Automātiski pievieno aizverošās iekavas.
|
||||
Description[mr]=स्वयं बंद करण्याजोगी ब्रॅकेट समावेष करा.
|
||||
Description[nl]=Voegt automatisch ‘haakjes sluiten’ toe.
|
||||
Description[oc]=Apondre automaticament las parentèsis tampantas.
|
||||
Description[or]=ବନ୍ଦହୋଇଥିବା ବନ୍ଧନିଗୁଡ଼ିକୁ ସ୍ୱୟଂଚାଳିତ ଭାବରେ ଯୋଗକରନ୍ତୁ।
|
||||
Description[pl]=Automatycznie dodaje nawiasy zamykające.
|
||||
Description[pt]=Adiciona automaticamente fecho de chavetas.
|
||||
Description[pt_BR]=Fecha parênteses automaticamente.
|
||||
Description[ro]=Adaugă automat paranteze închise.
|
||||
Description[ru]=Автоматическое добавление закрывающей скобки.
|
||||
Description[sk]=Automatické pridávanie pravých zátvoriek.
|
||||
Description[sl]=Samodejno doda zaklepaje
|
||||
Description[sr]=Сам додаје затварајуће заграде.
|
||||
Description[sr@latin]=Sam dodaje zatvarajuće zagrade.
|
||||
Description[sv]=Lägger automatiskt till avslutande parenteser.
|
||||
Description[th]=เติมวงเล็บปิดโดยอัตโนมัติ
|
||||
Description[tr]=Parantez kapanışını kendiliğinden ekler.
|
||||
Description[vi]=Tự động thêm dấu ngoặc đóng.
|
||||
Description[zh_CN]=自动添加闭合括号。
|
||||
Description[zh_TW]=自動加入關閉用括號。
|
||||
Description=Automatically adds closing brackets.
|
||||
Authors=Hrutvik Suthar <steve@istique.net>
|
||||
Copyright=Copyright @ 2020 Hrutvik Suthar
|
||||
Version=1.0
|
318
plugins/bracket-complete/bracket-complete/bracketcompletion.py
Normal file
318
plugins/bracket-complete/bracket-complete/bracketcompletion.py
Normal file
@@ -0,0 +1,318 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# bracketcompletion.py - Bracket completion plugin for Xed
|
||||
#
|
||||
#
|
||||
# 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.
|
||||
|
||||
import gi
|
||||
gi.require_version('Peas', '1.0')
|
||||
#gi.require_version('Xed', '3.0')
|
||||
from gi.repository import GObject, Gdk, Xed
|
||||
|
||||
common_brackets = {
|
||||
'(' : ')',
|
||||
'[' : ']',
|
||||
'{' : '}',
|
||||
'"' : '"',
|
||||
"'" : "'",
|
||||
}
|
||||
|
||||
close_brackets = {
|
||||
')' : '(',
|
||||
']' : '[',
|
||||
'}' : '{',
|
||||
}
|
||||
|
||||
language_brackets = {
|
||||
'changelog': { '<' : '>' },
|
||||
'html': { '<' : '>' },
|
||||
'ruby': { '|' : '|' },
|
||||
'sh': { '`' : '`' },
|
||||
'xml': { '<' : '>' },
|
||||
'php': { '<' : '>' },
|
||||
}
|
||||
|
||||
|
||||
class BracketCompletionPlugin(GObject.Object, Xed.ViewActivatable):
|
||||
__gtype_name__ = "BracketCompletion"
|
||||
|
||||
view = GObject.Property(type=Xed.View)
|
||||
|
||||
def __init__(self):
|
||||
GObject.Object.__init__(self)
|
||||
|
||||
def do_activate(self):
|
||||
self._doc = self.view.get_buffer()
|
||||
self._last_iter = None
|
||||
self._stack = []
|
||||
self._relocate_marks = True
|
||||
self.update_language()
|
||||
|
||||
# Add the markers to the buffer
|
||||
insert = self._doc.get_iter_at_mark(self._doc.get_insert())
|
||||
self._mark_begin = self._doc.create_mark(None, insert, True)
|
||||
self._mark_end = self._doc.create_mark(None, insert, False)
|
||||
|
||||
self._handlers = [
|
||||
None,
|
||||
None,
|
||||
self.view.connect('notify::editable', self.on_notify_editable),
|
||||
self._doc.connect('notify::language', self.on_notify_language),
|
||||
None,
|
||||
]
|
||||
self.update_active()
|
||||
|
||||
def do_deactivate(self):
|
||||
if self._handlers[0]:
|
||||
self.view.disconnect(self._handlers[0])
|
||||
self.view.disconnect(self._handlers[1])
|
||||
self._doc.disconnect(self._handlers[4])
|
||||
self.view.disconnect(self._handlers[2])
|
||||
self._doc.disconnect(self._handlers[3])
|
||||
self._doc.delete_mark(self._mark_begin)
|
||||
self._doc.delete_mark(self._mark_end)
|
||||
|
||||
def update_active(self):
|
||||
# Don't activate the feature if the buffer isn't editable or if
|
||||
# there are no brackets for the language
|
||||
active = self.view.get_editable() and \
|
||||
self._brackets is not None
|
||||
|
||||
if active and self._handlers[0] is None:
|
||||
self._handlers[0] = self.view.connect('event-after',
|
||||
self.on_event_after)
|
||||
self._handlers[1] = self.view.connect('key-press-event',
|
||||
self.on_key_press_event)
|
||||
self._handlers[4] = self._doc.connect('delete-range',
|
||||
self.on_delete_range)
|
||||
elif not active and self._handlers[0] is not None:
|
||||
self.view.disconnect(self._handlers[0])
|
||||
self._handlers[0] = None
|
||||
self.view.disconnect(self._handlers[1])
|
||||
self._handlers[1] = None
|
||||
self._doc.disconnect(self._handlers[4])
|
||||
self._handlers[4] = None
|
||||
|
||||
def update_language(self):
|
||||
lang = self._doc.get_language()
|
||||
if lang is None:
|
||||
self._brackets = None
|
||||
return
|
||||
|
||||
lang_id = lang.get_id()
|
||||
if lang_id in language_brackets:
|
||||
self._brackets = language_brackets[lang_id]
|
||||
# we populate the language-specific brackets with common ones lazily
|
||||
self._brackets.update(common_brackets)
|
||||
else:
|
||||
self._brackets = common_brackets
|
||||
|
||||
# get the corresponding keyvals
|
||||
self._bracket_keyvals = set()
|
||||
for b in self._brackets:
|
||||
kv = Gdk.unicode_to_keyval(ord(b[-1]))
|
||||
if (kv):
|
||||
self._bracket_keyvals.add(kv)
|
||||
for b in close_brackets:
|
||||
kv = Gdk.unicode_to_keyval(ord(b[-1]))
|
||||
if (kv):
|
||||
self._bracket_keyvals.add(kv)
|
||||
|
||||
def get_current_token(self):
|
||||
end = self._doc.get_iter_at_mark(self._doc.get_insert())
|
||||
start = end.copy()
|
||||
word = None
|
||||
|
||||
if end.ends_word() or (end.inside_word() and not end.starts_word()):
|
||||
start.backward_word_start()
|
||||
word = self._doc.get_text(start, end)
|
||||
|
||||
if not word and start.backward_char():
|
||||
word = start.get_char()
|
||||
if word.isspace():
|
||||
word = None
|
||||
|
||||
if word:
|
||||
return word, start, end
|
||||
else:
|
||||
return None, None, None
|
||||
|
||||
def get_next_token(self):
|
||||
start = self._doc.get_iter_at_mark(self._doc.get_insert())
|
||||
end = start.copy()
|
||||
word = None
|
||||
|
||||
if start.ends_word() or (start.inside_word() and not start.starts_word()):
|
||||
end.forward_word_end()
|
||||
word = self._doc.get_text(start, end)
|
||||
|
||||
if not word:
|
||||
word = start.get_char()
|
||||
if word.isspace():
|
||||
word = None
|
||||
|
||||
if word:
|
||||
return word, start, end
|
||||
else:
|
||||
return None, None, None
|
||||
|
||||
def compute_indentation(self, cur):
|
||||
"""
|
||||
Compute indentation at the given iterator line
|
||||
view : gtk.TextView
|
||||
cur : gtk.TextIter
|
||||
"""
|
||||
start = self._doc.get_iter_at_line(cur.get_line())
|
||||
end = start.copy()
|
||||
|
||||
c = end.get_char()
|
||||
while c.isspace() and c not in ('\n', '\r') and end.compare(cur) < 0:
|
||||
if not end.forward_char():
|
||||
break
|
||||
c = end.get_char()
|
||||
|
||||
if start.equal(end):
|
||||
return ''
|
||||
return start.get_slice(end)
|
||||
|
||||
def on_notify_language(self, view, pspec):
|
||||
self.update_language()
|
||||
self.update_active()
|
||||
|
||||
def on_notify_editable(self, view, pspec):
|
||||
self.update_active()
|
||||
|
||||
def on_key_press_event(self, view, event):
|
||||
if event.state & (Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.MOD1_MASK):
|
||||
return False
|
||||
|
||||
if event.keyval in (Gdk.KEY_Left, Gdk.KEY_Right):
|
||||
self._stack = []
|
||||
|
||||
if event.keyval == Gdk.KEY_BackSpace:
|
||||
self._stack = []
|
||||
|
||||
if self._last_iter == None:
|
||||
return False
|
||||
|
||||
iter1 = self._doc.get_iter_at_mark(self._doc.get_insert())
|
||||
iter1.backward_char()
|
||||
self._doc.begin_user_action()
|
||||
self._doc.delete(iter1, self._last_iter)
|
||||
self._doc.end_user_action()
|
||||
self._last_iter = None
|
||||
return True
|
||||
|
||||
if event.keyval in (Gdk.KEY_Return, Gdk.KEY_KP_Enter) and \
|
||||
view.get_auto_indent() and self._last_iter != None:
|
||||
# This code has barely been adapted from gtksourceview.c
|
||||
# Note: it might break IM!
|
||||
|
||||
mark = self._doc.get_insert()
|
||||
iter1 = self._doc.get_iter_at_mark(mark)
|
||||
|
||||
indent = self.compute_indentation(iter1)
|
||||
indent = "\n" + indent
|
||||
|
||||
# Insert new line and auto-indent.
|
||||
self._doc.begin_user_action()
|
||||
self._doc.insert(iter1, indent)
|
||||
self._doc.insert(iter1, indent)
|
||||
self._doc.end_user_action()
|
||||
|
||||
# Leave the cursor where we want it to be
|
||||
iter1.backward_chars(len(indent))
|
||||
self._doc.place_cursor(iter1)
|
||||
self.view.scroll_mark_onscreen(mark)
|
||||
|
||||
self._last_iter = None
|
||||
return True
|
||||
|
||||
self._last_iter = None
|
||||
return False
|
||||
|
||||
def on_event_after(self, view, event):
|
||||
if event.type != Gdk.EventType.KEY_PRESS or \
|
||||
event.state & (Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.MOD1_MASK) or \
|
||||
event.keyval not in self._bracket_keyvals:
|
||||
return
|
||||
|
||||
# Check if the insert mark is in the range of mark_begin to mark_end
|
||||
# if not we free the stack
|
||||
insert = self._doc.get_insert()
|
||||
iter_begin = self._doc.get_iter_at_mark(self._mark_begin)
|
||||
iter_end = self._doc.get_iter_at_mark(self._mark_end)
|
||||
insert_iter = self._doc.get_iter_at_mark(insert)
|
||||
if not iter_begin.equal(iter_end):
|
||||
if not insert_iter.in_range(iter_begin, iter_end):
|
||||
self._stack = []
|
||||
self._relocate_marks = True
|
||||
|
||||
# Check if the word is not in our brackets
|
||||
word, start, end = self.get_current_token()
|
||||
|
||||
if word not in self._brackets and word not in close_brackets:
|
||||
return
|
||||
|
||||
# If we didn't insert brackets yet we insert them in the insert mark iter
|
||||
if self._relocate_marks == True:
|
||||
insert_iter = self._doc.get_iter_at_mark(insert)
|
||||
self._doc.move_mark(self._mark_begin, insert_iter)
|
||||
self._doc.move_mark(self._mark_end, insert_iter)
|
||||
self._relocate_marks = False
|
||||
|
||||
# Depending on having close bracket or a open bracket we get the opposed
|
||||
# bracket
|
||||
bracket = None
|
||||
bracket2 = None
|
||||
|
||||
if word not in close_brackets:
|
||||
self._stack.append(word)
|
||||
bracket = self._brackets[word]
|
||||
else:
|
||||
bracket2 = close_brackets[word]
|
||||
|
||||
word2, _, _ = self.get_next_token()
|
||||
|
||||
# Check to skip the closing bracket
|
||||
# Example: word = ) and word2 = )
|
||||
if word == word2:
|
||||
if bracket2 != None and self._stack != [] and \
|
||||
self._stack[len(self._stack) - 1] == bracket2:
|
||||
self._stack.pop()
|
||||
self._doc.handler_block(self._handlers[4])
|
||||
self._doc.delete(start, end)
|
||||
self._doc.handler_unblock(self._handlers[4])
|
||||
end.forward_char()
|
||||
self._doc.place_cursor(end)
|
||||
return
|
||||
|
||||
# Insert the closing bracket
|
||||
if bracket != None:
|
||||
self._doc.begin_user_action()
|
||||
self._doc.insert(end, bracket)
|
||||
self._doc.end_user_action()
|
||||
|
||||
# Leave the cursor when we want it to be
|
||||
self._last_iter = end.copy()
|
||||
end.backward_chars(len(bracket))
|
||||
self._doc.place_cursor(end)
|
||||
|
||||
def on_delete_range(self, doc, start, end):
|
||||
self._stack = []
|
||||
|
||||
# ex:ts=4:et:
|
4
plugins/bracket-complete/meson.build
Normal file
4
plugins/bracket-complete/meson.build
Normal file
@@ -0,0 +1,4 @@
|
||||
install_subdir(
|
||||
'bracket-complete',
|
||||
install_dir: pluginslibdir
|
||||
)
|
@@ -1,34 +0,0 @@
|
||||
# docinfo plugin
|
||||
plugindir = $(XED_PLUGINS_LIBS_DIR)
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
$(XED_CFLAGS) \
|
||||
$(WARN_CFLAGS) \
|
||||
$(DISABLE_DEPRECATED_CFLAGS)
|
||||
|
||||
plugin_LTLIBRARIES = libdocinfo.la
|
||||
|
||||
libdocinfo_la_SOURCES = \
|
||||
xed-docinfo-plugin.h \
|
||||
xed-docinfo-plugin.c
|
||||
|
||||
libdocinfo_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
|
||||
libdocinfo_la_LIBADD = $(XED_LIBS)
|
||||
|
||||
uidir = $(XED_PLUGINS_DATA_DIR)/docinfo
|
||||
ui_DATA = docinfo.ui
|
||||
|
||||
plugin_in_files = docinfo.plugin.desktop.in
|
||||
|
||||
%.plugin: %.plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
|
||||
|
||||
plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
|
||||
|
||||
EXTRA_DIST = $(ui_DATA) $(plugin_in_files)
|
||||
|
||||
CLEANFILES = $(plugin_DATA)
|
||||
DISTCLEANFILES = $(plugin_DATA)
|
||||
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
37
plugins/docinfo/meson.build
Normal file
37
plugins/docinfo/meson.build
Normal file
@@ -0,0 +1,37 @@
|
||||
docinfo_sources = [
|
||||
'xed-docinfo-plugin.h',
|
||||
'xed-docinfo-plugin.c'
|
||||
]
|
||||
|
||||
docinfo_deps = [
|
||||
config_h,
|
||||
glib,
|
||||
gmodule,
|
||||
gtksourceview,
|
||||
libpeas,
|
||||
pango
|
||||
]
|
||||
|
||||
library('docinfo',
|
||||
docinfo_sources,
|
||||
dependencies: docinfo_deps,
|
||||
include_directories: include_dirs,
|
||||
link_with: libxed,
|
||||
install_rpath: join_paths(prefix, libdir, 'xed'),
|
||||
install: true,
|
||||
install_dir: join_paths(libdir, 'xed', 'plugins')
|
||||
)
|
||||
|
||||
install_data(
|
||||
'docinfo.ui',
|
||||
install_dir: join_paths(pluginsdatadir, 'docinfo')
|
||||
)
|
||||
|
||||
docinfo_desktop = custom_target(
|
||||
'docinfo_desktop',
|
||||
input: 'docinfo.plugin.desktop.in',
|
||||
output: 'docinfo.plugin',
|
||||
command: [intltool_merge, '-d', '-u', po_dir, '@INPUT@', '@OUTPUT@'],
|
||||
install: true,
|
||||
install_dir: pluginslibdir,
|
||||
)
|
@@ -19,14 +19,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "xed-docinfo-plugin.h"
|
||||
|
||||
#include <string.h> /* For strlen (...) */
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <pango/pango-break.h>
|
||||
#include <gmodule.h>
|
||||
@@ -36,6 +30,8 @@
|
||||
#include <xed/xed-debug.h>
|
||||
#include <xed/xed-utils.h>
|
||||
|
||||
#include "xed-docinfo-plugin.h"
|
||||
|
||||
#define MENU_PATH "/MenuBar/ToolsMenu/ToolsOps_2"
|
||||
|
||||
struct _XedDocInfoPluginPrivate
|
||||
@@ -73,7 +69,8 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedDocInfoPlugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
xed_window_activatable_iface_init))
|
||||
xed_window_activatable_iface_init)
|
||||
G_ADD_PRIVATE_DYNAMIC (XedDocInfoPlugin))
|
||||
|
||||
static void
|
||||
calculate_info (XedDocument *doc,
|
||||
@@ -389,7 +386,7 @@ static void
|
||||
xed_docinfo_plugin_init (XedDocInfoPlugin *plugin)
|
||||
{
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedDocInfoPlugin initializing");
|
||||
plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin, XED_TYPE_DOCINFO_PLUGIN, XedDocInfoPluginPrivate);
|
||||
plugin->priv = xed_docinfo_plugin_get_instance_private (plugin);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -535,8 +532,6 @@ xed_docinfo_plugin_class_init (XedDocInfoPluginClass *klass)
|
||||
object_class->get_property = xed_docinfo_plugin_get_property;
|
||||
|
||||
g_object_class_override_property (object_class, PROP_WINDOW, "window");
|
||||
|
||||
g_type_class_add_private (klass, sizeof (XedDocInfoPluginPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -1,94 +0,0 @@
|
||||
# filebrowser
|
||||
|
||||
plugindir = $(XED_PLUGINS_LIBS_DIR)
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
$(XED_CFLAGS) \
|
||||
$(WARN_CFLAGS) \
|
||||
$(DISABLE_DEPRECATED_CFLAGS)
|
||||
|
||||
BUILT_SOURCES = \
|
||||
xed-file-browser-enum-types.h \
|
||||
xed-file-browser-enum-types.c \
|
||||
xed-file-browser-marshal.h \
|
||||
xed-file-browser-marshal.c
|
||||
|
||||
plugin_LTLIBRARIES = libfilebrowser.la
|
||||
|
||||
NOINST_H_FILES = \
|
||||
xed-file-bookmarks-store.h \
|
||||
xed-file-browser-store.h \
|
||||
xed-file-browser-view.h \
|
||||
xed-file-browser-widget.h \
|
||||
xed-file-browser-error.h \
|
||||
xed-file-browser-utils.h \
|
||||
xed-file-browser-plugin.h \
|
||||
xed-file-browser-messages.h
|
||||
|
||||
libfilebrowser_la_SOURCES = \
|
||||
$(BUILT_SOURCES) \
|
||||
xed-file-bookmarks-store.c \
|
||||
xed-file-browser-store.c \
|
||||
xed-file-browser-view.c \
|
||||
xed-file-browser-widget.c \
|
||||
xed-file-browser-utils.c \
|
||||
xed-file-browser-plugin.c \
|
||||
xed-file-browser-messages.c \
|
||||
$(NOINST_H_FILES)
|
||||
|
||||
libfilebrowser_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
|
||||
libfilebrowser_la_LIBADD = $(XED_LIBS)
|
||||
|
||||
# UI files (if you use ui for your plugin, list those files here)
|
||||
uidir = $(XED_PLUGINS_DATA_DIR)/filebrowser
|
||||
ui_DATA = xed-file-browser-widget-ui.xml
|
||||
|
||||
plugin_in_files = filebrowser.plugin.desktop.in
|
||||
|
||||
%.plugin: %.plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
|
||||
|
||||
xed-file-browser-enum-types.h: xed-file-browser-enum-types.h.template $(NOINST_H_FILES) $(GLIB_MKENUMS)
|
||||
(cd $(srcdir) && $(GLIB_MKENUMS) --template xed-file-browser-enum-types.h.template $(NOINST_H_FILES)) > $@
|
||||
|
||||
xed-file-browser-enum-types.c: xed-file-browser-enum-types.c.template xed-file-browser-enum-register.c.template $(NOINST_H_FILES) $(GLIB_MKENUMS)
|
||||
$(AM_V_GEN) (cd $(srcdir) && \
|
||||
$(GLIB_MKENUMS) --template xed-file-browser-enum-types.c.template $(NOINST_H_FILES) && \
|
||||
$(GLIB_MKENUMS) --template xed-file-browser-enum-register.c.template $(NOINST_H_FILES)) > $@
|
||||
|
||||
xed-file-browser-marshal.h: xed-file-browser-marshal.list $(GLIB_GENMARSHAL)
|
||||
$(AM_V_GEN) $(GLIB_GENMARSHAL) $< --header --prefix=xed_file_browser_marshal > $@
|
||||
|
||||
xed-file-browser-marshal.c: xed-file-browser-marshal.list $(GLIB_GENMARSHAL)
|
||||
$(AM_V_GEN) echo "#include \"xed-file-browser-marshal.h\"" > $@ && \
|
||||
$(GLIB_GENMARSHAL) $< --body --prefix=xed_file_browser_marshal >> $@
|
||||
|
||||
plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
|
||||
|
||||
@INTLTOOL_XML_NOMERGE_RULE@
|
||||
filebrowser_gschema_in = org.x.editor.plugins.filebrowser.gschema.xml.in
|
||||
gsettings_SCHEMAS = $(filebrowser_gschema_in:.xml.in=.xml)
|
||||
@GSETTINGS_RULES@
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(ui_DATA) \
|
||||
$(plugin_in_files) \
|
||||
$(filebrowser_gschema_in) \
|
||||
xed-file-browser-enum-types.h.template \
|
||||
xed-file-browser-enum-types.c.template \
|
||||
xed-file-browser-enum-register.c.template \
|
||||
xed-file-browser-marshal.list
|
||||
|
||||
CLEANFILES = \
|
||||
$(plugin_DATA) \
|
||||
$(gsettings_SCHEMAS_in) \
|
||||
$(gsettings_SCHEMAS) \
|
||||
$(BUILT_SOURCES)
|
||||
|
||||
DISTCLEANFILES = \
|
||||
$(plugin_DATA) \
|
||||
$(gsettings_SCHEMAS_in) \
|
||||
$(gsettings_SCHEMAS) \
|
||||
$(BUILT_SOURCES)
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
@@ -7,4 +7,3 @@ _Description=Easy file access from the side pane
|
||||
Icon=system-file-manager
|
||||
Authors=Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
Copyright=Copyright © 2006 Jesse van den Kieboom
|
||||
Website=http://www.mate-desktop.org
|
||||
|
73
plugins/filebrowser/meson.build
Normal file
73
plugins/filebrowser/meson.build
Normal file
@@ -0,0 +1,73 @@
|
||||
filebrowser_headers = [
|
||||
'xed-file-bookmarks-store.h',
|
||||
'xed-file-browser-store.h',
|
||||
'xed-file-browser-view.h',
|
||||
'xed-file-browser-widget.h',
|
||||
'xed-file-browser-error.h',
|
||||
'xed-file-browser-utils.h',
|
||||
'xed-file-browser-plugin.h',
|
||||
'xed-file-browser-messages.h'
|
||||
]
|
||||
|
||||
filebrowser_lib_sources = [
|
||||
'xed-file-bookmarks-store.c',
|
||||
'xed-file-browser-store.c',
|
||||
'xed-file-browser-view.c',
|
||||
'xed-file-browser-widget.c',
|
||||
'xed-file-browser-utils.c',
|
||||
'xed-file-browser-plugin.c',
|
||||
'xed-file-browser-messages.c'
|
||||
]
|
||||
|
||||
filebrowser_enums = gnome.mkenums_simple(
|
||||
'xed-file-browser-enum-types',
|
||||
sources : filebrowser_headers,
|
||||
identifier_prefix : 'XedFileBrowser',
|
||||
symbol_prefix : 'xed_file_browser'
|
||||
)
|
||||
|
||||
filebrowser_marshal = gnome.genmarshal(
|
||||
'xed-file-browser-marshal',
|
||||
sources: 'xed-file-browser-marshal.list',
|
||||
prefix: 'xed_file_browser_marshal'
|
||||
)
|
||||
|
||||
filebrowser_deps = [
|
||||
config_h,
|
||||
gio,
|
||||
glib,
|
||||
gmodule,
|
||||
gtk,
|
||||
gtksourceview,
|
||||
libpeas
|
||||
]
|
||||
|
||||
library(
|
||||
'filebrowser',
|
||||
filebrowser_headers + filebrowser_lib_sources + filebrowser_enums + filebrowser_marshal,
|
||||
link_with: libxed,
|
||||
dependencies: filebrowser_deps,
|
||||
include_directories: include_dirs,
|
||||
install_rpath: join_paths(prefix, libdir, 'xed'),
|
||||
install: true,
|
||||
install_dir: join_paths(libdir, 'xed', 'plugins')
|
||||
)
|
||||
|
||||
install_data(
|
||||
'xed-file-browser-widget-ui.xml',
|
||||
install_dir: join_paths(pluginsdatadir, 'filebrowser')
|
||||
)
|
||||
|
||||
filebrowser_desktop = custom_target(
|
||||
'filebrowser_desktop',
|
||||
input: 'filebrowser.plugin.desktop.in',
|
||||
output: 'filebrowser.plugin',
|
||||
command: [intltool_merge, '-d', '-u', po_dir, '@INPUT@', '@OUTPUT@'],
|
||||
install: true,
|
||||
install_dir: pluginslibdir,
|
||||
)
|
||||
|
||||
install_data(
|
||||
'org.x.editor.plugins.filebrowser.gschema.xml',
|
||||
install_dir: schema_dir
|
||||
)
|
@@ -27,10 +27,6 @@
|
||||
#include "xed-file-bookmarks-store.h"
|
||||
#include "xed-file-browser-utils.h"
|
||||
|
||||
#define XED_FILE_BOOKMARKS_STORE_GET_PRIVATE(object)( \
|
||||
G_TYPE_INSTANCE_GET_PRIVATE((object), XED_TYPE_FILE_BOOKMARKS_STORE, \
|
||||
XedFileBookmarksStorePrivate))
|
||||
|
||||
struct _XedFileBookmarksStorePrivate
|
||||
{
|
||||
GVolumeMonitor * volume_monitor;
|
||||
@@ -55,7 +51,11 @@ static gboolean find_with_flags (GtkTreeModel * model,
|
||||
guint flags,
|
||||
guint notflags);
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (XedFileBookmarksStore, xed_file_bookmarks_store, GTK_TYPE_TREE_STORE)
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedFileBookmarksStore,
|
||||
xed_file_bookmarks_store,
|
||||
GTK_TYPE_TREE_STORE,
|
||||
0,
|
||||
G_ADD_PRIVATE_DYNAMIC (XedFileBookmarksStore))
|
||||
|
||||
static void
|
||||
xed_file_bookmarks_store_dispose (GObject * object)
|
||||
@@ -92,8 +92,6 @@ xed_file_bookmarks_store_class_init (XedFileBookmarksStoreClass *klass)
|
||||
|
||||
object_class->dispose = xed_file_bookmarks_store_dispose;
|
||||
object_class->finalize = xed_file_bookmarks_store_finalize;
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedFileBookmarksStorePrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -105,7 +103,7 @@ xed_file_bookmarks_store_class_finalize (XedFileBookmarksStoreClass *klass)
|
||||
static void
|
||||
xed_file_bookmarks_store_init (XedFileBookmarksStore * obj)
|
||||
{
|
||||
obj->priv = XED_FILE_BOOKMARKS_STORE_GET_PRIVATE (obj);
|
||||
obj->priv = xed_file_bookmarks_store_get_instance_private (obj);
|
||||
}
|
||||
|
||||
/* Private */
|
||||
@@ -911,7 +909,7 @@ xed_file_bookmarks_store_get_location (XedFileBookmarksStore *model,
|
||||
}
|
||||
else if (!isfs)
|
||||
{
|
||||
file = g_object_ref (obj);
|
||||
file = G_FILE (g_object_ref (obj));
|
||||
}
|
||||
|
||||
g_object_unref (obj);
|
||||
|
@@ -1,20 +0,0 @@
|
||||
/*** BEGIN file-header ***/
|
||||
void
|
||||
xed_file_browser_enum_and_flag_register_type (GTypeModule * module)
|
||||
{
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
/* Enumerations from "@filename@" */
|
||||
|
||||
/*** END file-production ***/
|
||||
|
||||
/*** BEGIN enumeration-production ***/
|
||||
register_@enum_name@ (module);
|
||||
|
||||
/*** END enumeration-production ***/
|
||||
|
||||
/*** BEGIN file-tail ***/
|
||||
}
|
||||
|
||||
/*** END file-tail ***/
|
@@ -1,45 +0,0 @@
|
||||
/*** BEGIN file-header ***/
|
||||
#include "xed-file-browser-enum-types.h"
|
||||
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
/* enumerations from "@filename@" */
|
||||
#include "@filename@"
|
||||
|
||||
/*** END file-production ***/
|
||||
|
||||
/*** BEGIN value-header ***/
|
||||
static GType @enum_name@_type = 0;
|
||||
|
||||
static GType
|
||||
register_@enum_name@ (GTypeModule *module)
|
||||
{
|
||||
static const G@Type@Value values[] = {
|
||||
/*** END value-header ***/
|
||||
|
||||
/*** BEGIN value-production ***/
|
||||
{ @VALUENAME@,
|
||||
"@VALUENAME@",
|
||||
"@valuenick@" },
|
||||
/*** END value-production ***/
|
||||
|
||||
/*** BEGIN value-tail ***/
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
@enum_name@_type =
|
||||
g_type_module_register_@type@ (module,
|
||||
"@EnumName@",
|
||||
values);
|
||||
|
||||
return @enum_name@_type;
|
||||
}
|
||||
|
||||
GType
|
||||
@enum_name@_get_type (void)
|
||||
{
|
||||
return @enum_name@_type;
|
||||
}
|
||||
|
||||
/*** END value-tail ***/
|
@@ -1,29 +0,0 @@
|
||||
/*** BEGIN file-header ***/
|
||||
#ifndef __XED_FILE_BROWSER_ENUM_TYPES_H__
|
||||
#define __XED_FILE_BROWSER_ENUM_TYPES_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
/* Enumerations from "@filename@" */
|
||||
|
||||
/*** END file-production ***/
|
||||
|
||||
/*** BEGIN enumeration-production ***/
|
||||
#define XED_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
|
||||
GType @enum_name@_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/*** END enumeration-production ***/
|
||||
|
||||
/*** BEGIN file-tail ***/
|
||||
void xed_file_browser_enum_and_flag_register_type (GTypeModule * module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __XED_FILE_BROWSER_ENUM_TYPES_H__ */
|
||||
/*** END file-tail ***/
|
||||
|
@@ -1,5 +1,5 @@
|
||||
VOID:UINT,STRING
|
||||
VOID:OBJECT,OBJECT
|
||||
BOOL:OBJECT,POINTER
|
||||
BOOL:POINTER
|
||||
BOOL:VOID
|
||||
BOOLEAN:OBJECT,POINTER
|
||||
BOOLEAN:POINTER
|
||||
BOOLEAN:VOID
|
||||
|
@@ -20,10 +20,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gmodule.h>
|
||||
@@ -45,8 +42,6 @@
|
||||
#define FILE_BROWSER_SCHEMA "org.x.editor.plugins.filebrowser"
|
||||
#define FILE_BROWSER_ONLOAD_SCHEMA "org.x.editor.plugins.filebrowser.on-load"
|
||||
|
||||
#define XED_FILE_BROWSER_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_FILE_BROWSER_PLUGIN, XedFileBrowserPluginPrivate))
|
||||
|
||||
struct _XedFileBrowserPluginPrivate
|
||||
{
|
||||
XedWindow *window;
|
||||
@@ -109,9 +104,8 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedFileBrowserPlugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
xed_window_activatable_iface_init) \
|
||||
\
|
||||
xed_file_browser_enum_and_flag_register_type (type_module); \
|
||||
xed_window_activatable_iface_init)
|
||||
G_ADD_PRIVATE_DYNAMIC (XedFileBrowserPlugin)
|
||||
_xed_file_browser_store_register_type (type_module); \
|
||||
_xed_file_bookmarks_store_register_type (type_module); \
|
||||
_xed_file_browser_view_register_type (type_module); \
|
||||
@@ -122,7 +116,7 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedFileBrowserPlugin,
|
||||
static void
|
||||
xed_file_browser_plugin_init (XedFileBrowserPlugin *plugin)
|
||||
{
|
||||
plugin->priv = XED_FILE_BROWSER_PLUGIN_GET_PRIVATE (plugin);
|
||||
plugin->priv = xed_file_browser_plugin_get_instance_private (plugin);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -532,8 +526,6 @@ xed_file_browser_plugin_activate (XedWindowActivatable *activatable)
|
||||
XedPanel *panel;
|
||||
XedFileBrowserStore *store;
|
||||
gchar *data_dir;
|
||||
GSettingsSchemaSource *schema_source;
|
||||
GSettingsSchema *schema;
|
||||
|
||||
priv = plugin->priv;
|
||||
|
||||
@@ -626,8 +618,6 @@ xed_file_browser_plugin_class_init (XedFileBrowserPluginClass * klass)
|
||||
object_class->get_property = xed_file_browser_plugin_get_property;
|
||||
|
||||
g_object_class_override_property (object_class, PROP_WINDOW, "window");
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedFileBrowserPluginPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -19,10 +19,7 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gio/gio.h>
|
||||
@@ -34,10 +31,6 @@
|
||||
#include "xed-file-browser-error.h"
|
||||
#include "xed-file-browser-utils.h"
|
||||
|
||||
#define XED_FILE_BROWSER_STORE_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), \
|
||||
XED_TYPE_FILE_BROWSER_STORE, \
|
||||
XedFileBrowserStorePrivate))
|
||||
|
||||
#define NODE_IS_DIR(node) (FILE_IS_DIR((node)->flags))
|
||||
#define NODE_IS_HIDDEN(node) (FILE_IS_HIDDEN((node)->flags))
|
||||
#define NODE_IS_TEXT(node) (FILE_IS_TEXT((node)->flags))
|
||||
@@ -196,14 +189,6 @@ static void next_files_async (GFileEnumerator *enumerator,
|
||||
|
||||
static void delete_files (AsyncData *data);
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedFileBrowserStore, xed_file_browser_store,
|
||||
G_TYPE_OBJECT,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (GTK_TYPE_TREE_MODEL,
|
||||
xed_file_browser_store_iface_init)
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (GTK_TYPE_TREE_DRAG_SOURCE,
|
||||
xed_file_browser_store_drag_source_init))
|
||||
|
||||
/* Properties */
|
||||
enum {
|
||||
PROP_0,
|
||||
@@ -227,6 +212,15 @@ enum
|
||||
NUM_SIGNALS
|
||||
};
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedFileBrowserStore, xed_file_browser_store,
|
||||
G_TYPE_OBJECT,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (GTK_TYPE_TREE_MODEL,
|
||||
xed_file_browser_store_iface_init)
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (GTK_TYPE_TREE_DRAG_SOURCE,
|
||||
xed_file_browser_store_drag_source_init)
|
||||
G_ADD_PRIVATE_DYNAMIC (XedFileBrowserStore))
|
||||
|
||||
static guint model_signals[NUM_SIGNALS] = { 0 };
|
||||
|
||||
static void
|
||||
@@ -350,7 +344,7 @@ xed_file_browser_store_class_init (XedFileBrowserStoreClass * klass)
|
||||
g_param_spec_flags ("filter-mode",
|
||||
"Filter Mode",
|
||||
"The filter mode",
|
||||
XED_TYPE_FILE_BROWSER_STORE_FILTER_MODE,
|
||||
XED_FILE_BROWSER_TYPE_STORE_FILTER_MODE,
|
||||
xed_file_browser_store_filter_mode_get_default (),
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
@@ -384,7 +378,7 @@ xed_file_browser_store_class_init (XedFileBrowserStoreClass * klass)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (XedFileBrowserStoreClass,
|
||||
no_trash), g_signal_accumulator_true_handled, NULL,
|
||||
xed_file_browser_marshal_BOOL__POINTER,
|
||||
xed_file_browser_marshal_BOOLEAN__POINTER,
|
||||
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
|
||||
model_signals[RENAME] =
|
||||
g_signal_new ("rename",
|
||||
@@ -421,8 +415,6 @@ xed_file_browser_store_class_init (XedFileBrowserStoreClass * klass)
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_FILE);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedFileBrowserStorePrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -460,7 +452,7 @@ xed_file_browser_store_drag_source_init (GtkTreeDragSourceIface * iface)
|
||||
static void
|
||||
xed_file_browser_store_init (XedFileBrowserStore * obj)
|
||||
{
|
||||
obj->priv = XED_FILE_BROWSER_STORE_GET_PRIVATE (obj);
|
||||
obj->priv = xed_file_browser_store_get_instance_private (obj);
|
||||
|
||||
obj->priv->column_types[XED_FILE_BROWSER_STORE_COLUMN_LOCATION] = G_TYPE_FILE;
|
||||
obj->priv->column_types[XED_FILE_BROWSER_STORE_COLUMN_NAME] = G_TYPE_STRING;
|
||||
@@ -3592,7 +3584,7 @@ delete_file_finished (GFile *file,
|
||||
/* Process the next file */
|
||||
data->iter = data->iter->next;
|
||||
}
|
||||
else if (!ok && error != NULL)
|
||||
else if (error != NULL)
|
||||
{
|
||||
gint code = error->code;
|
||||
g_error_free (error);
|
||||
|
@@ -19,10 +19,7 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <xed/xed-utils.h>
|
||||
|
||||
@@ -94,7 +91,7 @@ xed_file_browser_utils_pixbuf_from_icon (GIcon *icon,
|
||||
}
|
||||
|
||||
ret = gtk_icon_info_load_icon (info, NULL);
|
||||
gtk_icon_info_free (info);
|
||||
g_object_unref (info);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@@ -31,10 +31,6 @@
|
||||
#include "xed-file-browser-marshal.h"
|
||||
#include "xed-file-browser-enum-types.h"
|
||||
|
||||
#define XED_FILE_BROWSER_VIEW_GET_PRIVATE(object)( \
|
||||
G_TYPE_INSTANCE_GET_PRIVATE((object), \
|
||||
XED_TYPE_FILE_BROWSER_VIEW, XedFileBrowserViewPrivate))
|
||||
|
||||
struct _XedFileBrowserViewPrivate
|
||||
{
|
||||
GtkTreeViewColumn *column;
|
||||
@@ -44,8 +40,6 @@ struct _XedFileBrowserViewPrivate
|
||||
GtkTreeModel *model;
|
||||
GtkTreeRowReference *editable;
|
||||
|
||||
/* CLick policy */
|
||||
XedFileBrowserViewClickPolicy click_policy;
|
||||
GtkTreePath *double_click_path[2]; /* Both clicks in a double click need to be on the same row */
|
||||
GtkTreePath *hover_path;
|
||||
GdkCursor *hand_cursor;
|
||||
@@ -64,7 +58,6 @@ enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_CLICK_POLICY,
|
||||
PROP_RESTORE_EXPAND_STATE
|
||||
};
|
||||
|
||||
@@ -84,7 +77,11 @@ static const GtkTargetEntry drag_source_targets[] = {
|
||||
{ "text/uri-list", 0, 0 }
|
||||
};
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (XedFileBrowserView, xed_file_browser_view, GTK_TYPE_TREE_VIEW)
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedFileBrowserView,
|
||||
xed_file_browser_view,
|
||||
GTK_TYPE_TREE_VIEW,
|
||||
0,
|
||||
G_ADD_PRIVATE_DYNAMIC (XedFileBrowserView))
|
||||
|
||||
static void on_cell_edited (GtkCellRendererText *cell,
|
||||
gchar *path,
|
||||
@@ -227,139 +224,6 @@ row_collapsed (GtkTreeView *tree_view,
|
||||
_xed_file_browser_store_iter_collapsed (XED_FILE_BROWSER_STORE (view->priv->model), iter);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
leave_notify_event (GtkWidget *widget,
|
||||
GdkEventCrossing *event)
|
||||
{
|
||||
XedFileBrowserView *view = XED_FILE_BROWSER_VIEW (widget);
|
||||
|
||||
if (view->priv->click_policy == XED_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE &&
|
||||
view->priv->hover_path != NULL)
|
||||
{
|
||||
gtk_tree_path_free (view->priv->hover_path);
|
||||
view->priv->hover_path = NULL;
|
||||
}
|
||||
|
||||
// Chainup
|
||||
return GTK_WIDGET_CLASS (xed_file_browser_view_parent_class)->leave_notify_event (widget, event);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
enter_notify_event (GtkWidget *widget,
|
||||
GdkEventCrossing *event)
|
||||
{
|
||||
XedFileBrowserView *view = XED_FILE_BROWSER_VIEW (widget);
|
||||
|
||||
if (view->priv->click_policy == XED_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE)
|
||||
{
|
||||
if (view->priv->hover_path != NULL)
|
||||
{
|
||||
gtk_tree_path_free (view->priv->hover_path);
|
||||
}
|
||||
|
||||
gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget),
|
||||
event->x, event->y,
|
||||
&view->priv->hover_path,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
if (view->priv->hover_path != NULL)
|
||||
{
|
||||
gdk_window_set_cursor (gtk_widget_get_window (widget), view->priv->hand_cursor);
|
||||
}
|
||||
}
|
||||
|
||||
// Chainup
|
||||
return GTK_WIDGET_CLASS (xed_file_browser_view_parent_class)->enter_notify_event (widget, event);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
motion_notify_event (GtkWidget *widget,
|
||||
GdkEventMotion *event)
|
||||
{
|
||||
GtkTreePath *old_hover_path;
|
||||
XedFileBrowserView *view = XED_FILE_BROWSER_VIEW (widget);
|
||||
|
||||
if (view->priv->click_policy == XED_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE)
|
||||
{
|
||||
old_hover_path = view->priv->hover_path;
|
||||
gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget),
|
||||
event->x, event->y,
|
||||
&view->priv->hover_path,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
if ((old_hover_path != NULL) != (view->priv->hover_path != NULL))
|
||||
{
|
||||
if (view->priv->hover_path != NULL)
|
||||
{
|
||||
gdk_window_set_cursor (gtk_widget_get_window (widget), view->priv->hand_cursor);
|
||||
}
|
||||
else
|
||||
{
|
||||
gdk_window_set_cursor (gtk_widget_get_window (widget), NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (old_hover_path != NULL)
|
||||
{
|
||||
gtk_tree_path_free (old_hover_path);
|
||||
}
|
||||
}
|
||||
|
||||
// Chainup
|
||||
return GTK_WIDGET_CLASS (xed_file_browser_view_parent_class)->motion_notify_event (widget, event);
|
||||
}
|
||||
|
||||
static void
|
||||
set_click_policy_property (XedFileBrowserView *obj,
|
||||
XedFileBrowserViewClickPolicy click_policy)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GdkDisplay *display;
|
||||
GdkWindow *win;
|
||||
|
||||
obj->priv->click_policy = click_policy;
|
||||
|
||||
if (click_policy == XED_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE)
|
||||
{
|
||||
if (obj->priv->hand_cursor == NULL)
|
||||
{
|
||||
obj->priv->hand_cursor = gdk_cursor_new(GDK_HAND2);
|
||||
}
|
||||
}
|
||||
else if (click_policy == XED_FILE_BROWSER_VIEW_CLICK_POLICY_DOUBLE)
|
||||
{
|
||||
if (obj->priv->hover_path != NULL)
|
||||
{
|
||||
if (gtk_tree_model_get_iter (GTK_TREE_MODEL (obj->priv->model), &iter, obj->priv->hover_path))
|
||||
{
|
||||
gtk_tree_model_row_changed (GTK_TREE_MODEL (obj->priv->model), obj->priv->hover_path, &iter);
|
||||
}
|
||||
|
||||
gtk_tree_path_free (obj->priv->hover_path);
|
||||
obj->priv->hover_path = NULL;
|
||||
}
|
||||
|
||||
if (gtk_widget_get_realized (GTK_WIDGET (obj)))
|
||||
{
|
||||
win = gtk_widget_get_window (GTK_WIDGET (obj));
|
||||
gdk_window_set_cursor (win, NULL);
|
||||
|
||||
display = gtk_widget_get_display (GTK_WIDGET (obj));
|
||||
|
||||
if (display != NULL)
|
||||
{
|
||||
gdk_display_flush (display);
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->priv->hand_cursor)
|
||||
{
|
||||
g_object_unref (obj->priv->hand_cursor);
|
||||
obj->priv->hand_cursor = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
directory_activated (XedFileBrowserView *view,
|
||||
GtkTreeIter *iter)
|
||||
@@ -503,14 +367,7 @@ did_not_drag (XedFileBrowserView *view,
|
||||
|
||||
if (gtk_tree_view_get_path_at_pos (tree_view, event->x, event->y, &path, NULL, NULL, NULL))
|
||||
{
|
||||
if ((view->priv->click_policy == XED_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE)
|
||||
&& !button_event_modifies_selection(event)
|
||||
&& (event->button == 1 || event->button == 2))
|
||||
{
|
||||
/* Activate all selected items, and leave them selected */
|
||||
activate_selected_items (view);
|
||||
}
|
||||
else if ((event->button == 1 || event->button == 2)
|
||||
if ((event->button == 1 || event->button == 2)
|
||||
&& ((event->state & GDK_CONTROL_MASK) != 0 ||
|
||||
(event->state & GDK_SHIFT_MASK) == 0)
|
||||
&& view->priv->selected_on_button_down)
|
||||
@@ -589,12 +446,6 @@ button_press_event (GtkWidget *widget,
|
||||
|
||||
last_click_time = event->time;
|
||||
|
||||
/* Ignore double click if we are in single click mode */
|
||||
if (view->priv->click_policy == XED_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE && click_count >= 2)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
view->priv->ignore_release = FALSE;
|
||||
call_parent = TRUE;
|
||||
|
||||
@@ -654,7 +505,7 @@ button_press_event (GtkWidget *widget,
|
||||
if (selected)
|
||||
{
|
||||
call_parent = on_expander || gtk_tree_selection_count_selected_rows (selection) == 1;
|
||||
view->priv->ignore_release = call_parent && view->priv->click_policy != XED_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE;
|
||||
view->priv->ignore_release = call_parent;
|
||||
}
|
||||
else if ((event->state & GDK_CONTROL_MASK) != 0)
|
||||
{
|
||||
@@ -881,9 +732,6 @@ get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_CLICK_POLICY:
|
||||
g_value_set_enum (value, obj->priv->click_policy);
|
||||
break;
|
||||
case PROP_RESTORE_EXPAND_STATE:
|
||||
g_value_set_boolean (value, obj->priv->restore_expand_state);
|
||||
break;
|
||||
@@ -903,9 +751,6 @@ set_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_CLICK_POLICY:
|
||||
set_click_policy_property (obj, g_value_get_enum (value));
|
||||
break;
|
||||
case PROP_RESTORE_EXPAND_STATE:
|
||||
set_restore_expand_state (obj, g_value_get_boolean (value));
|
||||
break;
|
||||
@@ -927,9 +772,6 @@ xed_file_browser_view_class_init (XedFileBrowserViewClass *klass)
|
||||
object_class->set_property = set_property;
|
||||
|
||||
/* Event handlers */
|
||||
widget_class->motion_notify_event = motion_notify_event;
|
||||
widget_class->enter_notify_event = enter_notify_event;
|
||||
widget_class->leave_notify_event = leave_notify_event;
|
||||
widget_class->button_press_event = button_press_event;
|
||||
widget_class->button_release_event = button_release_event;
|
||||
widget_class->drag_begin = drag_begin;
|
||||
@@ -943,14 +785,6 @@ xed_file_browser_view_class_init (XedFileBrowserViewClass *klass)
|
||||
/* Default handlers */
|
||||
klass->directory_activated = directory_activated;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_CLICK_POLICY,
|
||||
g_param_spec_enum ("click-policy",
|
||||
"Click Policy",
|
||||
"The click policy",
|
||||
XED_TYPE_FILE_BROWSER_VIEW_CLICK_POLICY,
|
||||
XED_FILE_BROWSER_VIEW_CLICK_POLICY_DOUBLE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_RESTORE_EXPAND_STATE,
|
||||
g_param_spec_boolean ("restore-expand-state",
|
||||
"Restore Expand State",
|
||||
@@ -990,8 +824,6 @@ xed_file_browser_view_class_init (XedFileBrowserViewClass *klass)
|
||||
bookmark_activated), NULL, NULL,
|
||||
g_cclosure_marshal_VOID__BOXED,
|
||||
G_TYPE_NONE, 1, GTK_TYPE_TREE_ITER);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedFileBrowserViewPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1013,14 +845,6 @@ cell_data_cb (GtkTreeViewColumn *tree_column,
|
||||
|
||||
path = gtk_tree_model_get_path (tree_model, iter);
|
||||
|
||||
if (obj->priv->click_policy == XED_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE)
|
||||
{
|
||||
if (obj->priv->hover_path != NULL && gtk_tree_path_compare (path, obj->priv->hover_path) == 0)
|
||||
{
|
||||
underline = PANGO_UNDERLINE_SINGLE;
|
||||
}
|
||||
}
|
||||
|
||||
if (XED_IS_FILE_BROWSER_STORE (tree_model))
|
||||
{
|
||||
if (obj->priv->editable != NULL && gtk_tree_row_reference_valid (obj->priv->editable))
|
||||
@@ -1038,7 +862,7 @@ cell_data_cb (GtkTreeViewColumn *tree_column,
|
||||
static void
|
||||
xed_file_browser_view_init (XedFileBrowserView *obj)
|
||||
{
|
||||
obj->priv = XED_FILE_BROWSER_VIEW_GET_PRIVATE (obj);
|
||||
obj->priv = xed_file_browser_view_get_instance_private (obj);
|
||||
|
||||
obj->priv->column = gtk_tree_view_column_new ();
|
||||
|
||||
@@ -1200,17 +1024,6 @@ xed_file_browser_view_start_rename (XedFileBrowserView *tree_view,
|
||||
FALSE, 0.0, 0.0);
|
||||
}
|
||||
|
||||
void
|
||||
xed_file_browser_view_set_click_policy (XedFileBrowserView *tree_view,
|
||||
XedFileBrowserViewClickPolicy policy)
|
||||
{
|
||||
g_return_if_fail (XED_IS_FILE_BROWSER_VIEW (tree_view));
|
||||
|
||||
set_click_policy_property (tree_view, policy);
|
||||
|
||||
g_object_notify (G_OBJECT (tree_view), "click-policy");
|
||||
}
|
||||
|
||||
void
|
||||
xed_file_browser_view_set_restore_expand_state (XedFileBrowserView *tree_view,
|
||||
gboolean restore_expand_state)
|
||||
|
@@ -37,12 +37,6 @@ typedef struct _XedFileBrowserView XedFileBrowserView;
|
||||
typedef struct _XedFileBrowserViewClass XedFileBrowserViewClass;
|
||||
typedef struct _XedFileBrowserViewPrivate XedFileBrowserViewPrivate;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
XED_FILE_BROWSER_VIEW_CLICK_POLICY_DOUBLE,
|
||||
XED_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE
|
||||
} XedFileBrowserViewClickPolicy;
|
||||
|
||||
struct _XedFileBrowserView
|
||||
{
|
||||
GtkTreeView parent;
|
||||
@@ -74,8 +68,6 @@ void xed_file_browser_view_set_model (XedFileBrowserView *tree_view,
|
||||
GtkTreeModel *model);
|
||||
void xed_file_browser_view_start_rename (XedFileBrowserView *tree_view,
|
||||
GtkTreeIter *iter);
|
||||
void xed_file_browser_view_set_click_policy (XedFileBrowserView *tree_view,
|
||||
XedFileBrowserViewClickPolicy policy);
|
||||
void xed_file_browser_view_set_restore_expand_state (XedFileBrowserView *tree_view,
|
||||
gboolean restore_expand_state);
|
||||
|
||||
|
@@ -19,10 +19,7 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
@@ -30,7 +27,6 @@
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
#include <xed/xed-utils.h>
|
||||
|
||||
#include "xed-file-browser-utils.h"
|
||||
@@ -42,10 +38,6 @@
|
||||
#include "xed-file-browser-marshal.h"
|
||||
#include "xed-file-browser-enum-types.h"
|
||||
|
||||
#define XED_FILE_BROWSER_WIDGET_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), \
|
||||
XED_TYPE_FILE_BROWSER_WIDGET, \
|
||||
XedFileBrowserWidgetPrivate))
|
||||
|
||||
#define XML_UI_FILE "xed-file-browser-widget-ui.xml"
|
||||
#define LOCATION_DATA_KEY "xed-file-browser-widget-location"
|
||||
|
||||
@@ -229,7 +221,11 @@ static void on_action_filter_binary (GtkAction *action,
|
||||
static void on_action_bookmark_open (GtkAction *action,
|
||||
XedFileBrowserWidget *obj);
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (XedFileBrowserWidget, xed_file_browser_widget, GTK_TYPE_BOX)
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedFileBrowserWidget,
|
||||
xed_file_browser_widget,
|
||||
GTK_TYPE_BOX,
|
||||
0,
|
||||
G_ADD_PRIVATE_DYNAMIC (XedFileBrowserWidget))
|
||||
|
||||
static void
|
||||
free_name_icon (gpointer data)
|
||||
@@ -470,7 +466,7 @@ xed_file_browser_widget_class_init (XedFileBrowserWidgetClass *klass)
|
||||
confirm_delete),
|
||||
g_signal_accumulator_true_handled,
|
||||
NULL,
|
||||
xed_file_browser_marshal_BOOL__OBJECT_POINTER,
|
||||
xed_file_browser_marshal_BOOLEAN__OBJECT_POINTER,
|
||||
G_TYPE_BOOLEAN,
|
||||
2,
|
||||
G_TYPE_OBJECT,
|
||||
@@ -483,12 +479,10 @@ xed_file_browser_widget_class_init (XedFileBrowserWidgetClass *klass)
|
||||
confirm_no_trash),
|
||||
g_signal_accumulator_true_handled,
|
||||
NULL,
|
||||
xed_file_browser_marshal_BOOL__POINTER,
|
||||
xed_file_browser_marshal_BOOLEAN__POINTER,
|
||||
G_TYPE_BOOLEAN,
|
||||
1,
|
||||
G_TYPE_POINTER);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedFileBrowserWidgetPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -712,7 +706,7 @@ fill_combo_model (XedFileBrowserWidget *obj)
|
||||
GtkTreeIter iter;
|
||||
GdkPixbuf *icon;
|
||||
|
||||
icon = xed_file_browser_utils_pixbuf_from_theme (GTK_STOCK_HOME, GTK_ICON_SIZE_MENU);
|
||||
icon = xed_file_browser_utils_pixbuf_from_theme ("go-home", GTK_ICON_SIZE_MENU);
|
||||
|
||||
gtk_tree_store_append (store, &iter, NULL);
|
||||
gtk_tree_store_set (store, &iter,
|
||||
@@ -805,7 +799,7 @@ static const GtkActionEntry tree_actions_sensitive[] =
|
||||
|
||||
static const GtkToggleActionEntry tree_actions_toggle[] =
|
||||
{
|
||||
{"FilterHidden", GTK_STOCK_DIALOG_AUTHENTICATION, N_("Show _Hidden"), NULL,
|
||||
{"FilterHidden", NULL, N_("Show _Hidden"), NULL,
|
||||
N_("Show hidden files and folders"), G_CALLBACK (on_action_filter_hidden), FALSE},
|
||||
{"FilterBinary", NULL, N_("Show _Binary"), NULL,
|
||||
N_("Show binary files"), G_CALLBACK (on_action_filter_binary), FALSE}
|
||||
@@ -1177,7 +1171,7 @@ create_filter (XedFileBrowserWidget *obj)
|
||||
static void
|
||||
xed_file_browser_widget_init (XedFileBrowserWidget *obj)
|
||||
{
|
||||
obj->priv = XED_FILE_BROWSER_WIDGET_GET_PRIVATE (obj);
|
||||
obj->priv = xed_file_browser_widget_get_instance_private (obj);
|
||||
|
||||
obj->priv->bookmarks_hash = g_hash_table_new_full (g_file_hash,
|
||||
(GEqualFunc)g_file_equal,
|
||||
@@ -1187,7 +1181,7 @@ xed_file_browser_widget_init (XedFileBrowserWidget *obj)
|
||||
gtk_box_set_spacing (GTK_BOX (obj), 3);
|
||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (obj), GTK_ORIENTATION_VERTICAL);
|
||||
|
||||
obj->priv->busy_cursor = gdk_cursor_new (GDK_WATCH);
|
||||
obj->priv->busy_cursor = gdk_cursor_new_for_display (gdk_display_get_default(), GDK_WATCH);
|
||||
}
|
||||
|
||||
/* Private */
|
||||
@@ -1251,6 +1245,7 @@ popup_menu (XedFileBrowserWidget *obj,
|
||||
GtkTreeModel *model)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkTreeView *tree;
|
||||
|
||||
if (XED_IS_FILE_BROWSER_STORE (model))
|
||||
{
|
||||
@@ -1267,16 +1262,18 @@ popup_menu (XedFileBrowserWidget *obj,
|
||||
|
||||
g_return_val_if_fail (menu != NULL, FALSE);
|
||||
|
||||
tree = GTK_TREE_VIEW (obj->priv->treeview);
|
||||
|
||||
if (event != NULL)
|
||||
{
|
||||
GtkTreeSelection *selection;
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (obj->priv->treeview));
|
||||
selection = gtk_tree_view_get_selection (tree);
|
||||
|
||||
if (gtk_tree_selection_count_selected_rows (selection) <= 1)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
|
||||
if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (obj->priv->treeview),
|
||||
if (gtk_tree_view_get_path_at_pos (tree,
|
||||
(gint)event->x, (gint)event->y,
|
||||
&path, NULL, NULL, NULL))
|
||||
{
|
||||
@@ -1286,14 +1283,38 @@ popup_menu (XedFileBrowserWidget *obj,
|
||||
}
|
||||
}
|
||||
|
||||
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, event->button, event->time);
|
||||
gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent *) event);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
|
||||
xed_utils_menu_position_under_tree_view,
|
||||
obj->priv->treeview, 0,
|
||||
gtk_get_current_event_time ());
|
||||
GtkTreeModel *model;
|
||||
GtkTreeSelection *selection;
|
||||
GtkTreeIter iter;
|
||||
|
||||
model = gtk_tree_view_get_model (tree);
|
||||
g_return_val_if_fail (model != NULL, FALSE);
|
||||
|
||||
selection = gtk_tree_view_get_selection (tree);
|
||||
g_return_val_if_fail (selection != NULL, FALSE);
|
||||
|
||||
if (gtk_tree_selection_get_selected (selection, NULL, &iter))
|
||||
{
|
||||
GtkTreePath *path;
|
||||
GdkRectangle rect;
|
||||
|
||||
path = gtk_tree_model_get_path (model, &iter);
|
||||
gtk_tree_view_get_cell_area (tree, path, gtk_tree_view_get_column (tree, 0), &rect);
|
||||
gtk_menu_popup_at_rect (GTK_MENU (menu), gtk_widget_get_window (GTK_WIDGET (tree)),
|
||||
&rect, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, NULL);
|
||||
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_menu_popup_at_widget (GTK_MENU (menu), GTK_WIDGET (obj->priv->treeview),
|
||||
GDK_GRAVITY_SOUTH, GDK_GRAVITY_NORTH, NULL);
|
||||
}
|
||||
|
||||
gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE);
|
||||
}
|
||||
|
||||
@@ -1965,11 +1986,7 @@ set_busy (XedFileBrowserWidget *obj,
|
||||
|
||||
if (busy)
|
||||
{
|
||||
GdkCursor *cursor;
|
||||
|
||||
cursor = gdk_cursor_new (GDK_WATCH);
|
||||
gdk_window_set_cursor (window, cursor);
|
||||
g_object_unref (obj->priv->busy_cursor);
|
||||
gdk_window_set_cursor (window, obj->priv->busy_cursor);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2333,7 +2350,8 @@ directory_open (XedFileBrowserWidget *obj,
|
||||
|
||||
uri = g_file_get_uri (location);
|
||||
|
||||
if (!gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (obj)), uri, GDK_CURRENT_TIME, &error))
|
||||
if (!gtk_show_uri_on_window (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (obj))),
|
||||
uri, GDK_CURRENT_TIME, &error))
|
||||
{
|
||||
g_signal_emit (obj, signals[ERROR], 0, XED_FILE_BROWSER_ERROR_OPEN_DIRECTORY, error->message);
|
||||
|
||||
|
10
plugins/joinlines/joinlines.plugin.desktop.in
Normal file
10
plugins/joinlines/joinlines.plugin.desktop.in
Normal file
@@ -0,0 +1,10 @@
|
||||
[Plugin]
|
||||
Loader=python3
|
||||
Module=joinlines
|
||||
IAge=3
|
||||
_Name=Join Lines
|
||||
_Description=Join several lines
|
||||
Icon=gnome-mime-text-x-python
|
||||
Authors=Steve Frécinaux <steve@istique.net>;André Homeyer;Linux Mint team
|
||||
Copyright=Copyright @ 2006-2007 Steve Frécinaux, André Homeyer
|
||||
Builtin=true
|
91
plugins/joinlines/joinlines/__init__.py
Normal file
91
plugins/joinlines/joinlines/__init__.py
Normal file
@@ -0,0 +1,91 @@
|
||||
from gi.repository import GObject, Gtk, Xed
|
||||
|
||||
import gettext
|
||||
gettext.install("xed")
|
||||
|
||||
MENU_PATH = "/MenuBar/ViewMenu/ViewOps_1"
|
||||
|
||||
class JoinLinesPlugin(GObject.Object, Xed.WindowActivatable):
|
||||
__gtype_name__ = "JoinLinesPlugin"
|
||||
|
||||
window = GObject.property(type=Xed.Window)
|
||||
|
||||
def __init__(self):
|
||||
GObject.Object.__init__(self)
|
||||
|
||||
def do_activate(self):
|
||||
self._views = {}
|
||||
|
||||
self._insert_menu()
|
||||
|
||||
def _insert_menu(self):
|
||||
manager = self.window.get_ui_manager()
|
||||
|
||||
self._action_group = Gtk.ActionGroup(name="XedJoinLinesPluginActions")
|
||||
self._action_group.add_actions(
|
||||
[("JoinLinesAction", None, _("_Join Lines"), "<Ctrl>J",
|
||||
_("Join the selected lines"),
|
||||
lambda w: self.join_lines(w))])
|
||||
|
||||
manager.insert_action_group(self._action_group)
|
||||
|
||||
self._ui_id = manager.new_merge_id()
|
||||
|
||||
manager.add_ui(self._ui_id,
|
||||
MENU_PATH,
|
||||
"JoinLinesAction",
|
||||
"JoinLinesAction",
|
||||
Gtk.UIManagerItemType.MENUITEM,
|
||||
False)
|
||||
|
||||
def do_update_state(self):
|
||||
self._action_group.set_sensitive(self.window.get_active_document() != None)
|
||||
|
||||
def do_deactivate(self):
|
||||
self._remove_menu()
|
||||
|
||||
|
||||
def _remove_menu(self):
|
||||
manager = self.window.get_ui_manager()
|
||||
manager.remove_ui(self._ui_id)
|
||||
manager.remove_action_group(self._action_group)
|
||||
manager.ensure_update()
|
||||
|
||||
def join_lines(self, w):
|
||||
doc = self.window.get_active_document()
|
||||
if doc is None:
|
||||
return
|
||||
|
||||
doc.begin_user_action()
|
||||
|
||||
# If there is a selection use it, otherwise join the
|
||||
# next line
|
||||
try:
|
||||
start, end = doc.get_selection_bounds()
|
||||
except ValueError:
|
||||
start = doc.get_iter_at_mark(doc.get_insert())
|
||||
end = start.copy()
|
||||
end.forward_line()
|
||||
|
||||
end_mark = doc.create_mark(None, end)
|
||||
|
||||
if not start.ends_line():
|
||||
start.forward_to_line_end()
|
||||
|
||||
# Include trailing spaces in the chunk to be removed
|
||||
while start.backward_char() and start.get_char() in ('\t', ' '):
|
||||
pass
|
||||
start.forward_char()
|
||||
|
||||
while doc.get_iter_at_mark(end_mark).compare(start) == 1:
|
||||
end = start.copy()
|
||||
while end.get_char() in ('\r', '\n', ' ', '\t'):
|
||||
end.forward_char()
|
||||
doc.delete(start, end)
|
||||
|
||||
doc.insert(start, ' ')
|
||||
start.forward_to_line_end()
|
||||
|
||||
doc.delete_mark(end_mark)
|
||||
doc.end_user_action()
|
||||
|
13
plugins/joinlines/meson.build
Normal file
13
plugins/joinlines/meson.build
Normal file
@@ -0,0 +1,13 @@
|
||||
install_subdir(
|
||||
'joinlines',
|
||||
install_dir: pluginslibdir
|
||||
)
|
||||
|
||||
textsize_desktop = custom_target(
|
||||
'joinlines_desktop',
|
||||
input: 'joinlines.plugin.desktop.in',
|
||||
output: 'joinlines.plugin',
|
||||
command: [intltool_merge, '-d', '-u', po_dir, '@INPUT@', '@OUTPUT@'],
|
||||
install: true,
|
||||
install_dir: pluginslibdir,
|
||||
)
|
19
plugins/meson.build
Normal file
19
plugins/meson.build
Normal file
@@ -0,0 +1,19 @@
|
||||
pluginsdatadir = join_paths(datadir, 'xed', 'plugins')
|
||||
pluginslibdir = join_paths(libdir, 'xed', 'plugins')
|
||||
|
||||
subdir('bracket-complete')
|
||||
subdir('docinfo')
|
||||
subdir('filebrowser')
|
||||
subdir('joinlines')
|
||||
subdir('modelines')
|
||||
subdir('open-uri-context-menu')
|
||||
subdir('sort')
|
||||
subdir('taglist')
|
||||
subdir('textsize')
|
||||
subdir('time')
|
||||
subdir('trailsave')
|
||||
subdir('wordcompletion')
|
||||
|
||||
if enable_spell
|
||||
subdir('spell')
|
||||
endif
|
@@ -1,38 +0,0 @@
|
||||
# Modelines Plugin
|
||||
plugindir = $(XED_PLUGINS_LIBS_DIR)
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
$(XED_CFLAGS) \
|
||||
$(WARN_CFLAGS) \
|
||||
$(DISABLE_DEPRECATED_CFLAGS)
|
||||
|
||||
modelinesdir = $(XED_PLUGINS_DATA_DIR)/modelines
|
||||
modelines_DATA = \
|
||||
language-mappings
|
||||
|
||||
plugin_LTLIBRARIES = libmodelines.la
|
||||
|
||||
libmodelines_la_SOURCES = \
|
||||
xed-modeline-plugin.h \
|
||||
xed-modeline-plugin.c \
|
||||
modeline-parser.h \
|
||||
modeline-parser.c
|
||||
|
||||
libmodelines_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
|
||||
libmodelines_la_LIBADD = $(XED_LIBS)
|
||||
|
||||
plugin_in_files = modelines.plugin.desktop.in
|
||||
%.plugin: %.plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
|
||||
|
||||
plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(plugin_in_files) \
|
||||
$(modelines_DATA)
|
||||
|
||||
CLEANFILES = $(plugin_DATA)
|
||||
DISTCLEANFILES = $(plugin_DATA)
|
||||
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
40
plugins/modelines/meson.build
Normal file
40
plugins/modelines/meson.build
Normal file
@@ -0,0 +1,40 @@
|
||||
modelines_sources = [
|
||||
'xed-modeline-plugin.h',
|
||||
'xed-modeline-plugin.c',
|
||||
'modeline-parser.h',
|
||||
'modeline-parser.c'
|
||||
]
|
||||
|
||||
modelines_deps = [
|
||||
config_h,
|
||||
glib,
|
||||
gmodule,
|
||||
gtk,
|
||||
gtksourceview,
|
||||
libpeas
|
||||
]
|
||||
|
||||
library(
|
||||
'modelines',
|
||||
modelines_sources,
|
||||
link_with: libxed,
|
||||
dependencies: modelines_deps,
|
||||
include_directories: include_dirs,
|
||||
install_rpath: join_paths(prefix, libdir, 'xed'),
|
||||
install: true,
|
||||
install_dir: join_paths(libdir, 'xed', 'plugins')
|
||||
)
|
||||
|
||||
install_data(
|
||||
'language-mappings',
|
||||
install_dir: join_paths(pluginsdatadir, 'modelines')
|
||||
)
|
||||
|
||||
modelines_desktop = custom_target(
|
||||
'modelines_desktop',
|
||||
input: 'modelines.plugin.desktop.in',
|
||||
output: 'modelines.plugin',
|
||||
command: [intltool_merge, '-d', '-u', po_dir, '@INPUT@', '@OUTPUT@'],
|
||||
install: true,
|
||||
install_dir: pluginslibdir,
|
||||
)
|
@@ -5,4 +5,3 @@ _Name=Modelines
|
||||
_Description=Emacs, Kate and Vim-style modelines support for xed.
|
||||
Authors=Steve Frécinaux <steve@istique.net>
|
||||
Copyright=Copyright © 2005 Steve Frécinaux
|
||||
Website=http://www.mate-desktop.org
|
||||
|
@@ -19,19 +19,16 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gmodule.h>
|
||||
#include "xed-modeline-plugin.h"
|
||||
#include "modeline-parser.h"
|
||||
|
||||
#include <xed/xed-debug.h>
|
||||
#include <xed/xed-view-activatable.h>
|
||||
#include <xed/xed-view.h>
|
||||
|
||||
#include "xed-modeline-plugin.h"
|
||||
#include "modeline-parser.h"
|
||||
|
||||
struct _XedModelinePluginPrivate
|
||||
{
|
||||
XedView *view;
|
||||
@@ -53,7 +50,8 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedModelinePlugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_VIEW_ACTIVATABLE,
|
||||
xed_view_activatable_iface_init))
|
||||
xed_view_activatable_iface_init)
|
||||
G_ADD_PRIVATE_DYNAMIC (XedModelinePlugin))
|
||||
|
||||
static void
|
||||
xed_modeline_plugin_constructed (GObject *object)
|
||||
@@ -74,9 +72,7 @@ xed_modeline_plugin_init (XedModelinePlugin *plugin)
|
||||
{
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedModelinePlugin initializing");
|
||||
|
||||
plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin,
|
||||
XED_TYPE_MODELINE_PLUGIN,
|
||||
XedModelinePluginPrivate);
|
||||
plugin->priv = xed_modeline_plugin_get_instance_private (plugin);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -196,8 +192,6 @@ xed_modeline_plugin_class_init (XedModelinePluginClass *klass)
|
||||
object_class->get_property = xed_modeline_plugin_get_property;
|
||||
|
||||
g_object_class_override_property (object_class, PROP_VIEW, "view");
|
||||
|
||||
g_type_class_add_private (klass, sizeof (XedModelinePluginPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
|
4
plugins/open-uri-context-menu/meson.build
Normal file
4
plugins/open-uri-context-menu/meson.build
Normal file
@@ -0,0 +1,4 @@
|
||||
install_subdir(
|
||||
'open-uri-context-menu',
|
||||
install_dir: pluginslibdir
|
||||
)
|
674
plugins/open-uri-context-menu/open-uri-context-menu/COPYING
Normal file
674
plugins/open-uri-context-menu/open-uri-context-menu/COPYING
Normal file
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
@@ -0,0 +1,10 @@
|
||||
[Plugin]
|
||||
Loader=python3
|
||||
Module=open-uri-context-menu
|
||||
IAge=3
|
||||
Name=Open URI
|
||||
Description=Adds context menu item to open an URI at the pointer position.
|
||||
Icon=gtk-open
|
||||
Authors=Martin Szulecki <opensuse@sukimashita.com>\nJean-Philippe Fleury <contact@jpfleury.net>
|
||||
Copyright=Copyright © 2007-2008 Martin Szulecki\nCopyright © 2011 Jean-Philippe Fleury
|
||||
Builtin=true
|
@@ -0,0 +1,179 @@
|
||||
# Copyright (C) 2007-2008 Martin Szulecki
|
||||
# Copyright (C) 2011 Jean-Philippe Fleury <contact@jpfleury.net>
|
||||
#
|
||||
# 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
'''
|
||||
Adds context menu item to open an URI at the pointer position
|
||||
'''
|
||||
|
||||
from gi.repository import Gtk, Xed, Gio, GObject, GtkSource
|
||||
import gettext
|
||||
import re
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
import string
|
||||
|
||||
gettext.install("xed")
|
||||
|
||||
ACCEPTED_SCHEMES = ['file', 'ftp', 'sftp', 'smb', 'dav', 'davs', 'ssh', 'http', 'https']
|
||||
RE_DELIM = re.compile(r'[\w#/\?:%@&\=\+\.\\~-]+', re.UNICODE|re.MULTILINE)
|
||||
RE_URI_RFC2396 = re.compile("((([a-zA-Z][0-9a-zA-Z+\\-\\.]*):)?/{0,2}([0-9a-zA-Z;:,/\?@&=\+\$\.\-_!~\*'\(\)%]+))?(#[0-9a-zA-Z;,/\?:@&\=+$\.\\-_!~\*'\(\)%]+)?")
|
||||
|
||||
class OpenURIContextMenuPlugin(GObject.Object, Xed.WindowActivatable):
|
||||
__gtype_name__ = "OpenURIContextMenuPlugin"
|
||||
window = GObject.property(type=Xed.Window)
|
||||
|
||||
def __init__(self):
|
||||
GObject.Object.__init__(self)
|
||||
self.uri = ""
|
||||
self.window = None
|
||||
self.encoding = GtkSource.Encoding.get_from_charset("UTF-8")
|
||||
|
||||
def do_activate(self):
|
||||
handler_ids = []
|
||||
for signal in ('tab-added', 'tab-removed'):
|
||||
method = getattr(self, 'on_window_' + signal.replace('-', '_'))
|
||||
handler_ids.append(self.window.connect(signal, method))
|
||||
self.window.OpenURIContextMenuPluginID = handler_ids
|
||||
for view in self.window.get_views():
|
||||
self.connect_view(view)
|
||||
|
||||
def do_deactivate(self):
|
||||
widgets = [self.window] + self.window.get_views()
|
||||
for widget in widgets:
|
||||
handler_ids = widget.OpenURIContextMenuPluginID
|
||||
if not handler_ids is None:
|
||||
for handler_id in handler_ids:
|
||||
widget.disconnect(handler_id)
|
||||
widget.OpenURIContextMenuPluginID = None
|
||||
self.window = None
|
||||
|
||||
def connect_view(self, view):
|
||||
handler_id = view.connect('populate-popup', self.on_view_populate_popup)
|
||||
view.OpenURIContextMenuPluginID = [handler_id]
|
||||
|
||||
def update_ui(self, window):
|
||||
pass
|
||||
|
||||
def browse_url(self, menu_item, url):
|
||||
command = ['xdg-open', url]
|
||||
# Avoid to run the browser as user root
|
||||
if os.getuid() == 0 and os.environ.has_key('SUDO_USER'):
|
||||
command = ['sudo', '-u', os.environ['SUDO_USER']] + command
|
||||
subprocess.Popen(command)
|
||||
|
||||
def on_window_tab_added(self, window, tab):
|
||||
self.connect_view(tab.get_view())
|
||||
|
||||
def on_window_tab_removed(self, window, tab):
|
||||
pass
|
||||
|
||||
def on_view_populate_popup(self, view, menu):
|
||||
doc = view.get_buffer()
|
||||
win = view.get_window(Gtk.TextWindowType.TEXT);
|
||||
ptr_window, x, y, mod = win.get_pointer()
|
||||
x, y = view.window_to_buffer_coords(Gtk.TextWindowType.TEXT, x, y);
|
||||
|
||||
# First try at pointer location
|
||||
# Starting with GTK 3.20, get_iter_at_location returns a tuple of type
|
||||
# (gboolean, GtkTextIter). Earlier versions return only the GtkTextIter.
|
||||
insert = view.get_iter_at_location(x, y);
|
||||
if isinstance(insert, tuple):
|
||||
insert = insert[1] if insert[0] else None
|
||||
|
||||
# Second try at cursor
|
||||
if insert == None:
|
||||
insert = doc.get_iter_at_mark(doc.get_insert())
|
||||
if isinstance(insert, tuple):
|
||||
insert = insert[1] if insert[0] else None
|
||||
|
||||
while insert.forward_char():
|
||||
if not RE_DELIM.match(insert.get_char()):
|
||||
break
|
||||
|
||||
start = insert.copy()
|
||||
while start.backward_char():
|
||||
if not RE_DELIM.match(start.get_char()):
|
||||
start.forward_char();
|
||||
break
|
||||
|
||||
word = doc.get_text(start, insert, False)
|
||||
if len(word) == 0:
|
||||
return True
|
||||
|
||||
word = self.validate_uri(word)
|
||||
if not word:
|
||||
return True
|
||||
|
||||
displayed_word = word
|
||||
if len(displayed_word) > 50:
|
||||
displayed_word = displayed_word[:50] + u"\u2026"
|
||||
|
||||
browse_to = False
|
||||
if word.startswith("http://") or word.startswith("https://"):
|
||||
browse_to = True
|
||||
|
||||
if browse_to:
|
||||
browse_uri_item = Gtk.MenuItem(_("Open '%s'") % (displayed_word))
|
||||
browse_uri_item.connect('activate', self.browse_url, word);
|
||||
browse_uri_item.show();
|
||||
|
||||
separator = Gtk.SeparatorMenuItem()
|
||||
separator.show();
|
||||
menu.prepend(separator)
|
||||
menu.prepend(browse_uri_item)
|
||||
return True
|
||||
|
||||
def validate_uri(self, uri):
|
||||
m = RE_URI_RFC2396.search(uri);
|
||||
if not m:
|
||||
return False
|
||||
|
||||
target = m.group()
|
||||
|
||||
if m.group(4) == None or m.group(4) == "/":
|
||||
return False
|
||||
|
||||
if m.group(2) != None:
|
||||
if m.group(3) in ACCEPTED_SCHEMES:
|
||||
return target
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
if m.group(4).startswith("www."):
|
||||
return 'http://' + target
|
||||
|
||||
target = os.path.expanduser(target)
|
||||
if os.path.isfile(target):
|
||||
if os.path.isabs(target):
|
||||
return 'file://' + target
|
||||
|
||||
doc_dir = self.window.get_active_document().get_uri_for_display()
|
||||
if doc_dir != None:
|
||||
if doc_dir.startswith('file://'):
|
||||
f = os.path.join(os.path.dirname(doc_dir), target)
|
||||
if os.path.isfile(f.replace('file://', '', 1)):
|
||||
return f
|
||||
else:
|
||||
return os.path.join(os.path.dirname(doc_dir), target)
|
||||
|
||||
paths = string.split(os.environ["PATH"], os.pathsep)
|
||||
for dirname in paths:
|
||||
f = os.path.join(os.path.dirname(dirname), 'include', target)
|
||||
if os.path.isfile(f):
|
||||
return 'file://' + f
|
||||
|
||||
return False
|
@@ -1,31 +0,0 @@
|
||||
# sort plugin
|
||||
plugindir = $(XED_PLUGINS_LIBS_DIR)
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
$(XED_CFLAGS) \
|
||||
$(WARN_CFLAGS) \
|
||||
$(DISABLE_DEPRECATED_CFLAGS)
|
||||
|
||||
plugin_LTLIBRARIES = libsort.la
|
||||
|
||||
libsort_la_SOURCES = \
|
||||
xed-sort-plugin.h \
|
||||
xed-sort-plugin.c
|
||||
|
||||
libsort_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
|
||||
libsort_la_LIBADD = $(XED_LIBS)
|
||||
|
||||
plugin_in_files = sort.plugin.desktop.in
|
||||
|
||||
%.plugin: %.plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
|
||||
|
||||
plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
|
||||
|
||||
EXTRA_DIST = $(plugin_in_files)
|
||||
|
||||
CLEANFILES = $(plugin_DATA)
|
||||
DISTCLEANFILES = $(plugin_DATA)
|
||||
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
31
plugins/sort/meson.build
Normal file
31
plugins/sort/meson.build
Normal file
@@ -0,0 +1,31 @@
|
||||
sort_sources = [
|
||||
'xed-sort-plugin.h',
|
||||
'xed-sort-plugin.c'
|
||||
]
|
||||
|
||||
sort_deps = [
|
||||
config_h,
|
||||
glib,
|
||||
gtksourceview,
|
||||
libpeas
|
||||
]
|
||||
|
||||
library(
|
||||
'sort',
|
||||
sort_sources,
|
||||
link_with: libxed,
|
||||
dependencies: sort_deps,
|
||||
include_directories: include_dirs,
|
||||
install_rpath: join_paths(prefix, libdir, 'xed'),
|
||||
install: true,
|
||||
install_dir: join_paths(libdir, 'xed', 'plugins'),
|
||||
)
|
||||
|
||||
sort_desktop = custom_target(
|
||||
'sort_desktop',
|
||||
input: 'sort.plugin.desktop.in',
|
||||
output: 'sort.plugin',
|
||||
command: [intltool_merge, '-d', '-u', po_dir, '@INPUT@', '@OUTPUT@'],
|
||||
install: true,
|
||||
install_dir: pluginslibdir,
|
||||
)
|
@@ -6,5 +6,4 @@ _Description=Sorts a document or selected text.
|
||||
Icon=gtk-sort-ascending
|
||||
Authors=Carlo Borreo <borreo@softhome.net>;Lee Mallabone <mate@fonicmonkey.net>;Paolo Maggi <paolo.maggi@polito.it>;Jorge Alberto Torres H. <jorge@deadoak.com>
|
||||
Copyright=Copyright © 2001 Carlo Borreo\nCopyright © 2002-2003 Lee Mallabone, Paolo Maggi\nCopyright © 2004-2005 Paolo Maggi
|
||||
Website=http://www.mate-desktop.org
|
||||
Builtin=true
|
||||
|
@@ -21,35 +21,22 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "xed-sort-plugin.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include <xed/xed-window.h>
|
||||
#include <xed/xed-window-activatable.h>
|
||||
#include <xed/xed-debug.h>
|
||||
#include <xed/xed-utils.h>
|
||||
#include <xed/xed-app.h>
|
||||
|
||||
#define XED_SORT_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_SORT_PLUGIN, XedSortPluginPrivate))
|
||||
#include "xed-sort-plugin.h"
|
||||
|
||||
#define MENU_PATH "/MenuBar/EditMenu/EditOps_6"
|
||||
|
||||
static void xed_window_activatable_iface_init (XedWindowActivatableInterface *iface);
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedSortPlugin,
|
||||
xed_sort_plugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
xed_window_activatable_iface_init))
|
||||
|
||||
struct _XedSortPluginPrivate
|
||||
{
|
||||
XedWindow *window;
|
||||
@@ -66,6 +53,14 @@ enum
|
||||
PROP_WINDOW
|
||||
};
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedSortPlugin,
|
||||
xed_sort_plugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
xed_window_activatable_iface_init)
|
||||
G_ADD_PRIVATE_DYNAMIC (XedSortPlugin))
|
||||
|
||||
static void sort_cb (GtkAction *action,
|
||||
XedSortPlugin *plugin);
|
||||
|
||||
@@ -169,7 +164,6 @@ buffer_sort_lines (GtkSourceBuffer *buffer,
|
||||
gint end_line;
|
||||
gint num_lines;
|
||||
SortLine *lines;
|
||||
gchar *last_line = NULL;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (GTK_SOURCE_IS_BUFFER (buffer));
|
||||
@@ -230,8 +224,6 @@ buffer_sort_lines (GtkSourceBuffer *buffer,
|
||||
{
|
||||
gtk_text_buffer_insert (text_buffer, start, lines[i].line, -1);
|
||||
gtk_text_buffer_insert (text_buffer, start, "\n", -1);
|
||||
|
||||
last_line = lines[i].line;
|
||||
}
|
||||
|
||||
gtk_text_buffer_end_user_action (text_buffer);
|
||||
@@ -317,7 +309,7 @@ xed_sort_plugin_init (XedSortPlugin *plugin)
|
||||
{
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedSortPlugin initializing");
|
||||
|
||||
plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin, XED_TYPE_SORT_PLUGIN, XedSortPluginPrivate);
|
||||
plugin->priv = xed_sort_plugin_get_instance_private (plugin);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -390,8 +382,6 @@ xed_sort_plugin_class_init (XedSortPluginClass *klass)
|
||||
object_class->get_property = xed_sort_plugin_get_property;
|
||||
|
||||
g_object_class_override_property (object_class, PROP_WINDOW, "window");
|
||||
|
||||
g_type_class_add_private (klass, sizeof (XedSortPluginPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -1,70 +0,0 @@
|
||||
# Spell checker plugin
|
||||
plugindir = $(XED_PLUGINS_LIBS_DIR)
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
$(XED_CFLAGS) \
|
||||
$(ENCHANT_CFLAGS) \
|
||||
$(WARN_CFLAGS) \
|
||||
$(DISABLE_DEPRECATED_CFLAGS)
|
||||
|
||||
BUILT_SOURCES = \
|
||||
xed-spell-marshal.c \
|
||||
xed-spell-marshal.h
|
||||
|
||||
plugin_LTLIBRARIES = libspell.la
|
||||
|
||||
libspell_la_SOURCES = \
|
||||
xed-spell-plugin.c \
|
||||
xed-spell-plugin.h \
|
||||
xed-spell-checker.c \
|
||||
xed-spell-checker.h \
|
||||
xed-spell-checker-dialog.c \
|
||||
xed-spell-checker-dialog.h \
|
||||
xed-spell-checker-language.c \
|
||||
xed-spell-checker-language.h \
|
||||
xed-spell-language-dialog.c \
|
||||
xed-spell-language-dialog.h \
|
||||
xed-automatic-spell-checker.c \
|
||||
xed-automatic-spell-checker.h \
|
||||
xed-spell-utils.c \
|
||||
xed-spell-utils.h \
|
||||
$(BUILT_SOURCES)
|
||||
|
||||
libspell_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
|
||||
libspell_la_LIBADD = $(XED_LIBS) $(ENCHANT_LIBS)
|
||||
|
||||
uidir = $(XED_PLUGINS_DATA_DIR)/spell
|
||||
ui_DATA = spell-checker.ui languages-dialog.ui xed-spell-setup-dialog.ui
|
||||
|
||||
xed-spell-marshal.h: xed-spell-marshal.list $(GLIB_GENMARSHAL)
|
||||
$(AM_V_GEN) $(GLIB_GENMARSHAL) $< --header --prefix=xed_marshal > $@
|
||||
|
||||
xed-spell-marshal.c: xed-spell-marshal.list $(GLIB_GENMARSHAL)
|
||||
$(AM_V_GEN) echo "#include \"xed-spell-marshal.h\"" > $@ && \
|
||||
$(GLIB_GENMARSHAL) $< --body --prefix=xed_marshal >> $@
|
||||
|
||||
plugin_in_files = spell.plugin.desktop.in
|
||||
|
||||
%.plugin: %.plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
|
||||
|
||||
plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
|
||||
|
||||
@INTLTOOL_XML_NOMERGE_RULE@
|
||||
spell_gschema_in = org.x.editor.plugins.spell.gschema.xml.in
|
||||
gsettings_SCHEMAS = $(spell_gschema_in:.xml.in=.xml)
|
||||
@GSETTINGS_RULES@
|
||||
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(ui_DATA) \
|
||||
$(plugin_in_files) \
|
||||
xed-spell-marshal.list \
|
||||
$(spell_gschema_in)
|
||||
|
||||
CLEANFILES = $(BUILT_SOURCES) $(plugin_DATA) $(gsettings_SCHEMAS)
|
||||
|
||||
dist-hook:
|
||||
cd $(distdir); rm -f $(BUILT_SOURCES)
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
@@ -1,140 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.18.3 -->
|
||||
<!--*- mode: xml -*-->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.10"/>
|
||||
<object class="GtkDialog" id="dialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="title" translatable="yes">Set language</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="destroy_with_parent">True</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="dialog-action_area1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="helpbutton1">
|
||||
<property name="label">gtk-help</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="closebutton1">
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button1">
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="content">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">11</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Select the _language of the current document.</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="mnemonic_widget">languages_treeview</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="height_request">180</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="shadow_type">etched-in</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="languages_treeview">
|
||||
<property name="height_request">180</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="treeview-selection1"/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="-11">helpbutton1</action-widget>
|
||||
<action-widget response="-6">closebutton1</action-widget>
|
||||
<action-widget response="-5">button1</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
</interface>
|
57
plugins/spell/meson.build
Normal file
57
plugins/spell/meson.build
Normal file
@@ -0,0 +1,57 @@
|
||||
spell_sources = [
|
||||
'xed-spell-plugin.c',
|
||||
'xed-spell-plugin.h'
|
||||
]
|
||||
|
||||
spell_marshal = gnome.genmarshal(
|
||||
'xed-spell-marshal',
|
||||
sources: 'xed-spell-marshal.list',
|
||||
prefix: 'xed_spell_marshal'
|
||||
)
|
||||
|
||||
spell_deps = [
|
||||
config_h,
|
||||
glib,
|
||||
gspell,
|
||||
gtksourceview,
|
||||
libpeas,
|
||||
libpeas_gtk
|
||||
]
|
||||
|
||||
library(
|
||||
'spell',
|
||||
spell_sources + spell_marshal,
|
||||
link_with: libxed,
|
||||
dependencies: spell_deps,
|
||||
include_directories: include_dirs,
|
||||
install_rpath: join_paths(prefix, libdir, 'xed'),
|
||||
install: true,
|
||||
install_dir: join_paths(libdir, 'xed', 'plugins')
|
||||
)
|
||||
|
||||
install_data(
|
||||
'xed-spell-setup-dialog.ui',
|
||||
install_dir: join_paths(pluginsdatadir, 'spell')
|
||||
)
|
||||
|
||||
spell_desktop = custom_target(
|
||||
'spell_desktop',
|
||||
input: 'spell.plugin.desktop.in',
|
||||
output: 'spell.plugin',
|
||||
command: [intltool_merge, '-d', '-u', po_dir, '@INPUT@', '@OUTPUT@'],
|
||||
install: true,
|
||||
install_dir: pluginslibdir,
|
||||
)
|
||||
|
||||
|
||||
spell_schema_file = configure_file(
|
||||
input: 'org.x.editor.plugins.spell.gschema.xml.in',
|
||||
output: 'org.x.editor.plugins.spell.gschema.xml',
|
||||
configuration: schema_conf,
|
||||
install_dir: join_paths(datadir, 'glib-2.0', 'schemas')
|
||||
)
|
||||
|
||||
install_data(
|
||||
spell_schema_file,
|
||||
install_dir: schema_dir
|
||||
)
|
@@ -1,369 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.18.3 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.10"/>
|
||||
<object class="GtkWindow" id="check_spelling_window">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="destroy_with_parent">True</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<property name="skip_taskbar_hint">True</property>
|
||||
<property name="startup_id">Check spelling</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="content">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Misspelled word:</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="misspelled_word_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">word</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Change _to:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="word_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="check_word_button">
|
||||
<property name="label" translatable="yes">Check _Word</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">_Suggestions:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="suggestions_list">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="treeview-selection1"/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_bottom">6</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="row_spacing">12</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="ignore_button">
|
||||
<property name="label" translatable="yes">_Ignore</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="ignore_all_button">
|
||||
<property name="label" translatable="yes">Ignore _All</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="change_button">
|
||||
<property name="label" translatable="yes">Cha_nge</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="change_all_button">
|
||||
<property name="label" translatable="yes">Change A_ll</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">11</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">User dictionary:</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box7">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="add_word_button">
|
||||
<property name="label" translatable="yes">Add w_ord</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Language:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="language_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Language</property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButtonBox" id="buttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="close_button">
|
||||
<property name="label" translatable="yes">_Close</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="use_underline">True</property>
|
||||
<style>
|
||||
<class name="text-button"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
@@ -6,4 +6,3 @@ _Description=Checks the spelling of the current document.
|
||||
Icon=gtk-spell-check
|
||||
Authors=Paolo Maggi <paolo@gnome.org>
|
||||
Copyright=Copyright © 2002-2005 Paolo Maggi
|
||||
Website=http://www.mate-desktop.org
|
||||
|
@@ -1,967 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* xed-automatic-spell-checker.c
|
||||
* This file is part of xed
|
||||
*
|
||||
* Copyright (C) 2002 Paolo Maggi
|
||||
*
|
||||
* 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 St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the xed Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the xed Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
/* This is a modified version of gtkspell 2.0.5 (gtkspell.sf.net) */
|
||||
/* gtkspell - a spell-checking addon for GTK's TextView widget
|
||||
* Copyright (c) 2002 Evan Martin.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include "xed-automatic-spell-checker.h"
|
||||
#include "xed-spell-utils.h"
|
||||
|
||||
struct _XedAutomaticSpellChecker
|
||||
{
|
||||
XedDocument *doc;
|
||||
GSList *views;
|
||||
|
||||
GtkTextMark *mark_insert_start;
|
||||
GtkTextMark *mark_insert_end;
|
||||
gboolean deferred_check;
|
||||
|
||||
GtkTextTag *tag_highlight;
|
||||
GtkTextMark *mark_click;
|
||||
|
||||
XedSpellChecker *spell_checker;
|
||||
};
|
||||
|
||||
static GQuark automatic_spell_checker_id = 0;
|
||||
static GQuark suggestion_id = 0;
|
||||
|
||||
static void xed_automatic_spell_checker_free_internal (XedAutomaticSpellChecker *spell);
|
||||
|
||||
static void
|
||||
view_destroy (XedView *view,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
xed_automatic_spell_checker_detach_view (spell, view);
|
||||
}
|
||||
|
||||
static void
|
||||
check_word (XedAutomaticSpellChecker *spell,
|
||||
GtkTextIter *start,
|
||||
GtkTextIter *end)
|
||||
{
|
||||
gchar *word;
|
||||
|
||||
word = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (spell->doc), start, end, FALSE);
|
||||
|
||||
/*
|
||||
g_print ("Check word: %s [%d - %d]\n", word, gtk_text_iter_get_offset (start),
|
||||
gtk_text_iter_get_offset (end));
|
||||
*/
|
||||
|
||||
if (!xed_spell_checker_check_word (spell->spell_checker, word, -1))
|
||||
{
|
||||
/*
|
||||
g_print ("Apply tag: [%d - %d]\n", gtk_text_iter_get_offset (start),
|
||||
gtk_text_iter_get_offset (end));
|
||||
*/
|
||||
gtk_text_buffer_apply_tag (GTK_TEXT_BUFFER (spell->doc), spell->tag_highlight, start, end);
|
||||
}
|
||||
|
||||
g_free (word);
|
||||
}
|
||||
|
||||
static void
|
||||
check_range (XedAutomaticSpellChecker *spell,
|
||||
GtkTextIter start,
|
||||
GtkTextIter end,
|
||||
gboolean force_all)
|
||||
{
|
||||
/* we need to "split" on word boundaries.
|
||||
* luckily, Pango knows what "words" are
|
||||
* so we don't have to figure it out. */
|
||||
|
||||
GtkTextIter wstart;
|
||||
GtkTextIter wend;
|
||||
GtkTextIter cursor;
|
||||
GtkTextIter precursor;
|
||||
gboolean highlight;
|
||||
|
||||
/*
|
||||
g_print ("Check range: [%d - %d]\n", gtk_text_iter_get_offset (&start),
|
||||
gtk_text_iter_get_offset (&end));
|
||||
*/
|
||||
|
||||
if (gtk_text_iter_inside_word (&end))
|
||||
{
|
||||
gtk_text_iter_forward_word_end (&end);
|
||||
}
|
||||
|
||||
if (!gtk_text_iter_starts_word (&start))
|
||||
{
|
||||
if (gtk_text_iter_inside_word (&start) || gtk_text_iter_ends_word (&start))
|
||||
{
|
||||
gtk_text_iter_backward_word_start (&start);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if we're neither at the beginning nor inside a word,
|
||||
* me must be in some spaces.
|
||||
* skip forward to the beginning of the next word. */
|
||||
|
||||
if (gtk_text_iter_forward_word_end (&start))
|
||||
{
|
||||
gtk_text_iter_backward_word_start (&start);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (spell->doc),
|
||||
&cursor,
|
||||
gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (spell->doc)));
|
||||
|
||||
precursor = cursor;
|
||||
gtk_text_iter_backward_char (&precursor);
|
||||
|
||||
highlight = gtk_text_iter_has_tag (&cursor, spell->tag_highlight) ||
|
||||
gtk_text_iter_has_tag (&precursor, spell->tag_highlight);
|
||||
|
||||
gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (spell->doc), spell->tag_highlight, &start, &end);
|
||||
|
||||
/* Fix a corner case when replacement occurs at beginning of buffer:
|
||||
* An iter at offset 0 seems to always be inside a word,
|
||||
* even if it's not. Possibly a pango bug.
|
||||
*/
|
||||
if (gtk_text_iter_get_offset (&start) == 0)
|
||||
{
|
||||
gtk_text_iter_forward_word_end(&start);
|
||||
gtk_text_iter_backward_word_start(&start);
|
||||
}
|
||||
|
||||
wstart = start;
|
||||
|
||||
while (xed_spell_utils_skip_no_spell_check (&wstart, &end) && gtk_text_iter_compare (&wstart, &end) < 0)
|
||||
{
|
||||
gboolean inword;
|
||||
|
||||
/* move wend to the end of the current word. */
|
||||
wend = wstart;
|
||||
|
||||
gtk_text_iter_forward_word_end (&wend);
|
||||
|
||||
inword = (gtk_text_iter_compare (&wstart, &cursor) < 0) && (gtk_text_iter_compare (&cursor, &wend) <= 0);
|
||||
|
||||
if (inword && !force_all)
|
||||
{
|
||||
/* this word is being actively edited,
|
||||
* only check if it's already highligted,
|
||||
* otherwise defer this check until later. */
|
||||
if (highlight)
|
||||
{
|
||||
check_word (spell, &wstart, &wend);
|
||||
}
|
||||
else
|
||||
{
|
||||
spell->deferred_check = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
check_word (spell, &wstart, &wend);
|
||||
spell->deferred_check = FALSE;
|
||||
}
|
||||
|
||||
/* now move wend to the beginning of the next word, */
|
||||
gtk_text_iter_forward_word_end (&wend);
|
||||
gtk_text_iter_backward_word_start (&wend);
|
||||
|
||||
/* make sure we've actually advanced
|
||||
* (we don't advance in some corner cases), */
|
||||
if (gtk_text_iter_equal (&wstart, &wend))
|
||||
{
|
||||
break; /* we're done in these cases.. */
|
||||
}
|
||||
|
||||
/* and then pick this as the new next word beginning. */
|
||||
wstart = wend;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
check_deferred_range (XedAutomaticSpellChecker *spell,
|
||||
gboolean force_all)
|
||||
{
|
||||
GtkTextIter start, end;
|
||||
|
||||
gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (spell->doc), &start, spell->mark_insert_start);
|
||||
gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (spell->doc), &end, spell->mark_insert_end);
|
||||
|
||||
check_range (spell, start, end, force_all);
|
||||
}
|
||||
|
||||
/* insertion works like this:
|
||||
* - before the text is inserted, we mark the position in the buffer.
|
||||
* - after the text is inserted, we see where our mark is and use that and
|
||||
* the current position to check the entire range of inserted text.
|
||||
*
|
||||
* this may be overkill for the common case (inserting one character). */
|
||||
|
||||
static void
|
||||
insert_text_before (GtkTextBuffer *buffer,
|
||||
GtkTextIter *iter,
|
||||
gchar *text,
|
||||
gint len,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
gtk_text_buffer_move_mark (buffer, spell->mark_insert_start, iter);
|
||||
}
|
||||
|
||||
static void
|
||||
insert_text_after (GtkTextBuffer *buffer,
|
||||
GtkTextIter *iter,
|
||||
gchar *text,
|
||||
gint len,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
GtkTextIter start;
|
||||
|
||||
/* we need to check a range of text. */
|
||||
gtk_text_buffer_get_iter_at_mark (buffer, &start, spell->mark_insert_start);
|
||||
|
||||
check_range (spell, start, *iter, FALSE);
|
||||
|
||||
gtk_text_buffer_move_mark (buffer, spell->mark_insert_end, iter);
|
||||
}
|
||||
|
||||
/* deleting is more simple: we're given the range of deleted text.
|
||||
* after deletion, the start and end iters should be at the same position
|
||||
* (because all of the text between them was deleted!).
|
||||
* this means we only really check the words immediately bounding the
|
||||
* deletion.
|
||||
*/
|
||||
|
||||
static void
|
||||
delete_range_after (GtkTextBuffer *buffer,
|
||||
GtkTextIter *start,
|
||||
GtkTextIter *end,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
check_range (spell, *start, *end, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
mark_set (GtkTextBuffer *buffer,
|
||||
GtkTextIter *iter,
|
||||
GtkTextMark *mark,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
/* if the cursor has moved and there is a deferred check so handle it now */
|
||||
if ((mark == gtk_text_buffer_get_insert (buffer)) && spell->deferred_check)
|
||||
{
|
||||
check_deferred_range (spell, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
get_word_extents_from_mark (GtkTextBuffer *buffer,
|
||||
GtkTextIter *start,
|
||||
GtkTextIter *end,
|
||||
GtkTextMark *mark)
|
||||
{
|
||||
gtk_text_buffer_get_iter_at_mark(buffer, start, mark);
|
||||
|
||||
if (!gtk_text_iter_starts_word (start))
|
||||
{
|
||||
gtk_text_iter_backward_word_start (start);
|
||||
}
|
||||
|
||||
*end = *start;
|
||||
|
||||
if (gtk_text_iter_inside_word (end))
|
||||
{
|
||||
gtk_text_iter_forward_word_end (end);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
remove_tag_to_word (XedAutomaticSpellChecker *spell,
|
||||
const gchar *word)
|
||||
{
|
||||
GtkTextIter iter;
|
||||
GtkTextIter match_start, match_end;
|
||||
|
||||
gboolean found;
|
||||
|
||||
gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (spell->doc), &iter, 0);
|
||||
|
||||
found = TRUE;
|
||||
|
||||
while (found)
|
||||
{
|
||||
found = gtk_text_iter_forward_search (&iter,
|
||||
word,
|
||||
GTK_TEXT_SEARCH_VISIBLE_ONLY | GTK_TEXT_SEARCH_TEXT_ONLY,
|
||||
&match_start,
|
||||
&match_end,
|
||||
NULL);
|
||||
|
||||
if (found)
|
||||
{
|
||||
if (gtk_text_iter_starts_word (&match_start) && gtk_text_iter_ends_word (&match_end))
|
||||
{
|
||||
gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (spell->doc),
|
||||
spell->tag_highlight,
|
||||
&match_start,
|
||||
&match_end);
|
||||
}
|
||||
|
||||
iter = match_end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
add_to_dictionary (GtkWidget *menuitem,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
gchar *word;
|
||||
|
||||
GtkTextIter start, end;
|
||||
|
||||
get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click);
|
||||
|
||||
word = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (spell->doc), &start, &end, FALSE);
|
||||
|
||||
xed_spell_checker_add_word_to_personal (spell->spell_checker, word, -1);
|
||||
|
||||
g_free (word);
|
||||
}
|
||||
|
||||
static void
|
||||
ignore_all (GtkWidget *menuitem,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
gchar *word;
|
||||
|
||||
GtkTextIter start, end;
|
||||
|
||||
get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click);
|
||||
|
||||
word = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (spell->doc), &start, &end, FALSE);
|
||||
|
||||
xed_spell_checker_add_word_to_session (spell->spell_checker, word, -1);
|
||||
|
||||
g_free (word);
|
||||
}
|
||||
|
||||
static void
|
||||
replace_word (GtkWidget *menuitem,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
gchar *oldword;
|
||||
const gchar *newword;
|
||||
|
||||
GtkTextIter start, end;
|
||||
|
||||
get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click);
|
||||
|
||||
oldword = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (spell->doc), &start, &end, FALSE);
|
||||
|
||||
newword = g_object_get_qdata (G_OBJECT (menuitem), suggestion_id);
|
||||
g_return_if_fail (newword != NULL);
|
||||
|
||||
gtk_text_buffer_begin_user_action (GTK_TEXT_BUFFER (spell->doc));
|
||||
|
||||
gtk_text_buffer_delete (GTK_TEXT_BUFFER (spell->doc), &start, &end);
|
||||
gtk_text_buffer_insert (GTK_TEXT_BUFFER (spell->doc), &start, newword, -1);
|
||||
|
||||
gtk_text_buffer_end_user_action (GTK_TEXT_BUFFER (spell->doc));
|
||||
|
||||
xed_spell_checker_set_correction (spell->spell_checker,
|
||||
oldword, strlen (oldword),
|
||||
newword, strlen (newword));
|
||||
|
||||
g_free (oldword);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
build_suggestion_menu (XedAutomaticSpellChecker *spell,
|
||||
const gchar *word)
|
||||
{
|
||||
GtkWidget *topmenu, *menu;
|
||||
GtkWidget *mi;
|
||||
GSList *suggestions;
|
||||
GSList *list;
|
||||
gchar *label_text;
|
||||
|
||||
topmenu = menu = gtk_menu_new();
|
||||
|
||||
suggestions = xed_spell_checker_get_suggestions (spell->spell_checker, word, -1);
|
||||
|
||||
list = suggestions;
|
||||
|
||||
if (suggestions == NULL)
|
||||
{
|
||||
/* no suggestions. put something in the menu anyway... */
|
||||
GtkWidget *label;
|
||||
/* Translators: Displayed in the "Check Spelling" dialog if there are no suggestions for the current misspelled word */
|
||||
label = gtk_label_new (_("(no suggested words)"));
|
||||
|
||||
mi = gtk_menu_item_new ();
|
||||
gtk_widget_set_sensitive (mi, FALSE);
|
||||
gtk_container_add (GTK_CONTAINER(mi), label);
|
||||
gtk_widget_show_all (mi);
|
||||
gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), mi);
|
||||
}
|
||||
else
|
||||
{
|
||||
gint count = 0;
|
||||
|
||||
/* build a set of menus with suggestions. */
|
||||
while (suggestions != NULL)
|
||||
{
|
||||
GtkWidget *label;
|
||||
|
||||
if (count == 10)
|
||||
{
|
||||
/* Separator */
|
||||
mi = gtk_menu_item_new ();
|
||||
gtk_widget_show (mi);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
|
||||
|
||||
mi = gtk_menu_item_new_with_mnemonic (_("_More..."));
|
||||
gtk_widget_show (mi);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (mi), menu);
|
||||
count = 0;
|
||||
}
|
||||
|
||||
label_text = g_strdup_printf ("<b>%s</b>", (gchar*) suggestions->data);
|
||||
|
||||
label = gtk_label_new (label_text);
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
|
||||
mi = gtk_menu_item_new ();
|
||||
gtk_container_add (GTK_CONTAINER (mi), label);
|
||||
|
||||
gtk_widget_show_all (mi);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
|
||||
|
||||
g_object_set_qdata_full (G_OBJECT (mi),
|
||||
suggestion_id,
|
||||
g_strdup (suggestions->data),
|
||||
(GDestroyNotify)g_free);
|
||||
|
||||
g_free (label_text);
|
||||
g_signal_connect (mi, "activate",
|
||||
G_CALLBACK (replace_word), spell);
|
||||
|
||||
count++;
|
||||
|
||||
suggestions = g_slist_next (suggestions);
|
||||
}
|
||||
}
|
||||
|
||||
/* free the suggestion list */
|
||||
suggestions = list;
|
||||
|
||||
while (list)
|
||||
{
|
||||
g_free (list->data);
|
||||
list = g_slist_next (list);
|
||||
}
|
||||
|
||||
g_slist_free (suggestions);
|
||||
|
||||
/* Separator */
|
||||
mi = gtk_menu_item_new ();
|
||||
gtk_widget_show (mi);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (topmenu), mi);
|
||||
|
||||
/* Ignore all */
|
||||
mi = gtk_menu_item_new_with_mnemonic (_("_Ignore All"));
|
||||
|
||||
g_signal_connect (mi, "activate",
|
||||
G_CALLBACK(ignore_all), spell);
|
||||
|
||||
gtk_widget_show_all (mi);
|
||||
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (topmenu), mi);
|
||||
|
||||
/* + Add to Dictionary */
|
||||
mi = gtk_menu_item_new_with_mnemonic (_("_Add"));
|
||||
|
||||
g_signal_connect (mi, "activate",
|
||||
G_CALLBACK (add_to_dictionary), spell);
|
||||
|
||||
gtk_widget_show_all (mi);
|
||||
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (topmenu), mi);
|
||||
|
||||
return topmenu;
|
||||
}
|
||||
|
||||
static void
|
||||
populate_popup (GtkTextView *textview,
|
||||
GtkMenu *menu,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
GtkWidget *mi;
|
||||
GtkTextIter start, end;
|
||||
char *word;
|
||||
|
||||
/* we need to figure out if they picked a misspelled word. */
|
||||
get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click);
|
||||
|
||||
/* if our highlight algorithm ever messes up,
|
||||
* this isn't correct, either. */
|
||||
if (!gtk_text_iter_has_tag (&start, spell->tag_highlight))
|
||||
{
|
||||
return; /* word wasn't misspelled. */
|
||||
}
|
||||
|
||||
/* menu separator comes first. */
|
||||
mi = gtk_menu_item_new ();
|
||||
gtk_widget_show (mi);
|
||||
gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), mi);
|
||||
|
||||
/* then, on top of it, the suggestions menu. */
|
||||
mi = gtk_menu_item_new_with_mnemonic (_("_Spelling Suggestions..."));
|
||||
|
||||
word = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (spell->doc), &start, &end, FALSE);
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (mi), build_suggestion_menu (spell, word));
|
||||
g_free(word);
|
||||
|
||||
gtk_widget_show_all (mi);
|
||||
gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), mi);
|
||||
}
|
||||
|
||||
void
|
||||
xed_automatic_spell_checker_recheck_all (XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
GtkTextIter start, end;
|
||||
|
||||
g_return_if_fail (spell != NULL);
|
||||
|
||||
gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (spell->doc), &start, &end);
|
||||
|
||||
check_range (spell, start, end, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
add_word_signal_cb (XedSpellChecker *checker,
|
||||
const gchar *word,
|
||||
gint len,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
gchar *w;
|
||||
|
||||
if (len < 0)
|
||||
{
|
||||
w = g_strdup (word);
|
||||
}
|
||||
else
|
||||
{
|
||||
w = g_strndup (word, len);
|
||||
}
|
||||
|
||||
remove_tag_to_word (spell, w);
|
||||
|
||||
g_free (w);
|
||||
}
|
||||
|
||||
static void
|
||||
set_language_cb (XedSpellChecker *checker,
|
||||
const XedSpellCheckerLanguage *lang,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
xed_automatic_spell_checker_recheck_all (spell);
|
||||
}
|
||||
|
||||
static void
|
||||
clear_session_cb (XedSpellChecker *checker,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
xed_automatic_spell_checker_recheck_all (spell);
|
||||
}
|
||||
|
||||
/* When the user right-clicks on a word, they want to check that word.
|
||||
* Here, we do NOT move the cursor to the location of the clicked-upon word
|
||||
* since that prevents the use of edit functions on the context menu.
|
||||
*/
|
||||
static gboolean
|
||||
button_press_event (GtkTextView *view,
|
||||
GdkEventButton *event,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
if (event->button == 3)
|
||||
{
|
||||
gint x, y;
|
||||
GtkTextIter iter;
|
||||
|
||||
GtkTextBuffer *buffer = gtk_text_view_get_buffer (view);
|
||||
|
||||
/* handle deferred check if it exists */
|
||||
if (spell->deferred_check)
|
||||
{
|
||||
check_deferred_range (spell, TRUE);
|
||||
}
|
||||
|
||||
gtk_text_view_window_to_buffer_coords (view, GTK_TEXT_WINDOW_TEXT, event->x, event->y, &x, &y);
|
||||
|
||||
gtk_text_view_get_iter_at_location (view, &iter, x, y);
|
||||
|
||||
gtk_text_buffer_move_mark (buffer, spell->mark_click, &iter);
|
||||
}
|
||||
|
||||
return FALSE; /* false: let gtk process this event, too.
|
||||
we don't want to eat any events. */
|
||||
}
|
||||
|
||||
/* Move the insert mark before popping up the menu, otherwise it
|
||||
* will contain the wrong set of suggestions.
|
||||
*/
|
||||
static gboolean
|
||||
popup_menu_event (GtkTextView *view,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
GtkTextIter iter;
|
||||
GtkTextBuffer *buffer;
|
||||
|
||||
buffer = gtk_text_view_get_buffer (view);
|
||||
|
||||
/* handle deferred check if it exists */
|
||||
if (spell->deferred_check)
|
||||
{
|
||||
check_deferred_range (spell, TRUE);
|
||||
}
|
||||
|
||||
gtk_text_buffer_get_iter_at_mark (buffer, &iter, gtk_text_buffer_get_insert (buffer));
|
||||
gtk_text_buffer_move_mark (buffer, spell->mark_click, &iter);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
tag_table_changed (GtkTextTagTable *table,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
g_return_if_fail (spell->tag_highlight != NULL);
|
||||
|
||||
gtk_text_tag_set_priority (spell->tag_highlight, gtk_text_tag_table_get_size (table) - 1);
|
||||
}
|
||||
|
||||
static void
|
||||
tag_added_or_removed (GtkTextTagTable *table,
|
||||
GtkTextTag *tag,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
tag_table_changed (table, spell);
|
||||
}
|
||||
|
||||
static void
|
||||
tag_changed (GtkTextTagTable *table,
|
||||
GtkTextTag *tag,
|
||||
gboolean size_changed,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
tag_table_changed (table, spell);
|
||||
}
|
||||
|
||||
static void
|
||||
highlight_updated (GtkSourceBuffer *buffer,
|
||||
GtkTextIter *start,
|
||||
GtkTextIter *end,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
check_range (spell, *start, *end, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
spell_tag_destroyed (XedAutomaticSpellChecker *spell,
|
||||
GObject *where_the_object_was)
|
||||
{
|
||||
spell->tag_highlight = NULL;
|
||||
}
|
||||
|
||||
XedAutomaticSpellChecker *
|
||||
xed_automatic_spell_checker_new (XedDocument *doc,
|
||||
XedSpellChecker *checker)
|
||||
{
|
||||
XedAutomaticSpellChecker *spell;
|
||||
GtkTextTagTable *tag_table;
|
||||
GtkTextIter start, end;
|
||||
|
||||
g_return_val_if_fail (XED_IS_DOCUMENT (doc), NULL);
|
||||
g_return_val_if_fail (XED_IS_SPELL_CHECKER (checker), NULL);
|
||||
g_return_val_if_fail ((spell = xed_automatic_spell_checker_get_from_document (doc)) == NULL, spell);
|
||||
|
||||
/* attach to the widget */
|
||||
spell = g_new0 (XedAutomaticSpellChecker, 1);
|
||||
|
||||
spell->doc = doc;
|
||||
spell->spell_checker = g_object_ref (checker);
|
||||
|
||||
if (automatic_spell_checker_id == 0)
|
||||
{
|
||||
automatic_spell_checker_id = g_quark_from_string ("XedAutomaticSpellCheckerID");
|
||||
}
|
||||
if (suggestion_id == 0)
|
||||
{
|
||||
suggestion_id = g_quark_from_string ("XedAutoSuggestionID");
|
||||
}
|
||||
|
||||
g_object_set_qdata_full (G_OBJECT (doc), automatic_spell_checker_id,
|
||||
spell, (GDestroyNotify)xed_automatic_spell_checker_free_internal);
|
||||
|
||||
g_signal_connect (doc, "insert-text",
|
||||
G_CALLBACK (insert_text_before), spell);
|
||||
g_signal_connect_after (doc, "insert-text",
|
||||
G_CALLBACK (insert_text_after), spell);
|
||||
g_signal_connect_after (doc, "delete-range",
|
||||
G_CALLBACK (delete_range_after), spell);
|
||||
g_signal_connect (doc, "mark-set",
|
||||
G_CALLBACK (mark_set), spell);
|
||||
|
||||
g_signal_connect (doc, "highlight-updated",
|
||||
G_CALLBACK (highlight_updated), spell);
|
||||
|
||||
g_signal_connect (spell->spell_checker, "add_word_to_session",
|
||||
G_CALLBACK (add_word_signal_cb), spell);
|
||||
g_signal_connect (spell->spell_checker, "add_word_to_personal",
|
||||
G_CALLBACK (add_word_signal_cb), spell);
|
||||
g_signal_connect (spell->spell_checker, "clear_session",
|
||||
G_CALLBACK (clear_session_cb), spell);
|
||||
g_signal_connect (spell->spell_checker, "set_language",
|
||||
G_CALLBACK (set_language_cb), spell);
|
||||
|
||||
spell->tag_highlight = gtk_text_buffer_create_tag (GTK_TEXT_BUFFER (doc),
|
||||
"gtkspell-misspelled",
|
||||
"underline", PANGO_UNDERLINE_ERROR,
|
||||
NULL);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (spell->tag_highlight), (GWeakNotify)spell_tag_destroyed, spell);
|
||||
|
||||
tag_table = gtk_text_buffer_get_tag_table (GTK_TEXT_BUFFER (doc));
|
||||
|
||||
gtk_text_tag_set_priority (spell->tag_highlight, gtk_text_tag_table_get_size (tag_table) - 1);
|
||||
|
||||
g_signal_connect (tag_table, "tag-added",
|
||||
G_CALLBACK (tag_added_or_removed), spell);
|
||||
g_signal_connect (tag_table, "tag-removed",
|
||||
G_CALLBACK (tag_added_or_removed), spell);
|
||||
g_signal_connect (tag_table, "tag-changed",
|
||||
G_CALLBACK (tag_changed), spell);
|
||||
|
||||
/* we create the mark here, but we don't use it until text is
|
||||
* inserted, so we don't really care where iter points. */
|
||||
gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (doc), &start, &end);
|
||||
|
||||
spell->mark_insert_start = gtk_text_buffer_get_mark (GTK_TEXT_BUFFER (doc),
|
||||
"xed-automatic-spell-checker-insert-start");
|
||||
|
||||
if (spell->mark_insert_start == NULL)
|
||||
{
|
||||
spell->mark_insert_start = gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
|
||||
"xed-automatic-spell-checker-insert-start",
|
||||
&start,
|
||||
TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_text_buffer_move_mark (GTK_TEXT_BUFFER (doc), spell->mark_insert_start, &start);
|
||||
}
|
||||
|
||||
spell->mark_insert_end = gtk_text_buffer_get_mark (GTK_TEXT_BUFFER (doc),
|
||||
"xed-automatic-spell-checker-insert-end");
|
||||
|
||||
if (spell->mark_insert_end == NULL)
|
||||
{
|
||||
spell->mark_insert_end = gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
|
||||
"xed-automatic-spell-checker-insert-end",
|
||||
&start,
|
||||
TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_text_buffer_move_mark (GTK_TEXT_BUFFER (doc), spell->mark_insert_end, &start);
|
||||
}
|
||||
|
||||
spell->mark_click = gtk_text_buffer_get_mark (GTK_TEXT_BUFFER (doc),
|
||||
"xed-automatic-spell-checker-click");
|
||||
|
||||
if (spell->mark_click == NULL)
|
||||
{
|
||||
spell->mark_click = gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
|
||||
"xed-automatic-spell-checker-click",
|
||||
&start,
|
||||
TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_text_buffer_move_mark (GTK_TEXT_BUFFER (doc), spell->mark_click, &start);
|
||||
}
|
||||
|
||||
spell->deferred_check = FALSE;
|
||||
|
||||
return spell;
|
||||
}
|
||||
|
||||
XedAutomaticSpellChecker *
|
||||
xed_automatic_spell_checker_get_from_document (const XedDocument *doc)
|
||||
{
|
||||
g_return_val_if_fail (XED_IS_DOCUMENT (doc), NULL);
|
||||
|
||||
if (automatic_spell_checker_id == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return g_object_get_qdata (G_OBJECT (doc), automatic_spell_checker_id);
|
||||
}
|
||||
|
||||
void
|
||||
xed_automatic_spell_checker_free (XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
g_return_if_fail (spell != NULL);
|
||||
g_return_if_fail (xed_automatic_spell_checker_get_from_document (spell->doc) == spell);
|
||||
|
||||
if (automatic_spell_checker_id == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
g_object_set_qdata (G_OBJECT (spell->doc), automatic_spell_checker_id, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_automatic_spell_checker_free_internal (XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
GtkTextTagTable *table;
|
||||
GtkTextIter start, end;
|
||||
GSList *list;
|
||||
|
||||
g_return_if_fail (spell != NULL);
|
||||
|
||||
table = gtk_text_buffer_get_tag_table (GTK_TEXT_BUFFER (spell->doc));
|
||||
|
||||
if (table != NULL && spell->tag_highlight != NULL)
|
||||
{
|
||||
gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (spell->doc), &start, &end);
|
||||
gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (spell->doc), spell->tag_highlight, &start, &end);
|
||||
|
||||
g_signal_handlers_disconnect_matched (G_OBJECT (table),
|
||||
G_SIGNAL_MATCH_DATA,
|
||||
0, 0, NULL, NULL,
|
||||
spell);
|
||||
|
||||
gtk_text_tag_table_remove (table, spell->tag_highlight);
|
||||
}
|
||||
|
||||
g_signal_handlers_disconnect_matched (G_OBJECT (spell->doc),
|
||||
G_SIGNAL_MATCH_DATA,
|
||||
0, 0, NULL, NULL,
|
||||
spell);
|
||||
|
||||
g_signal_handlers_disconnect_matched (G_OBJECT (spell->spell_checker),
|
||||
G_SIGNAL_MATCH_DATA,
|
||||
0, 0, NULL, NULL,
|
||||
spell);
|
||||
|
||||
g_object_unref (spell->spell_checker);
|
||||
|
||||
list = spell->views;
|
||||
while (list != NULL)
|
||||
{
|
||||
XedView *view = XED_VIEW (list->data);
|
||||
|
||||
g_signal_handlers_disconnect_matched (G_OBJECT (view),
|
||||
G_SIGNAL_MATCH_DATA,
|
||||
0, 0, NULL, NULL,
|
||||
spell);
|
||||
|
||||
g_signal_handlers_disconnect_matched (G_OBJECT (view),
|
||||
G_SIGNAL_MATCH_DATA,
|
||||
0, 0, NULL, NULL,
|
||||
spell);
|
||||
|
||||
list = g_slist_next (list);
|
||||
}
|
||||
|
||||
g_slist_free (spell->views);
|
||||
|
||||
g_free (spell);
|
||||
}
|
||||
|
||||
void
|
||||
xed_automatic_spell_checker_attach_view (XedAutomaticSpellChecker *spell,
|
||||
XedView *view)
|
||||
{
|
||||
g_return_if_fail (spell != NULL);
|
||||
g_return_if_fail (XED_IS_VIEW (view));
|
||||
|
||||
g_return_if_fail (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)) == GTK_TEXT_BUFFER (spell->doc));
|
||||
|
||||
g_signal_connect (view, "button-press-event",
|
||||
G_CALLBACK (button_press_event), spell);
|
||||
g_signal_connect (view, "popup-menu",
|
||||
G_CALLBACK (popup_menu_event), spell);
|
||||
g_signal_connect (view, "populate-popup",
|
||||
G_CALLBACK (populate_popup), spell);
|
||||
g_signal_connect (view, "destroy",
|
||||
G_CALLBACK (view_destroy), spell);
|
||||
|
||||
spell->views = g_slist_prepend (spell->views, view);
|
||||
}
|
||||
|
||||
void
|
||||
xed_automatic_spell_checker_detach_view (XedAutomaticSpellChecker *spell,
|
||||
XedView *view)
|
||||
{
|
||||
g_return_if_fail (spell != NULL);
|
||||
g_return_if_fail (XED_IS_VIEW (view));
|
||||
|
||||
g_return_if_fail (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)) == GTK_TEXT_BUFFER (spell->doc));
|
||||
g_return_if_fail (spell->views != NULL);
|
||||
|
||||
g_signal_handlers_disconnect_matched (G_OBJECT (view),
|
||||
G_SIGNAL_MATCH_DATA,
|
||||
0, 0, NULL, NULL,
|
||||
spell);
|
||||
|
||||
g_signal_handlers_disconnect_matched (G_OBJECT (view),
|
||||
G_SIGNAL_MATCH_DATA,
|
||||
0, 0, NULL, NULL,
|
||||
spell);
|
||||
|
||||
spell->views = g_slist_remove (spell->views, view);
|
||||
}
|
||||
|
@@ -1,67 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* xed-automatic-spell-checker.h
|
||||
* This file is part of xed
|
||||
*
|
||||
* Copyright (C) 2002 Paolo Maggi
|
||||
*
|
||||
* 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 St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the xed Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the xed Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
/* This is a modified version of gtkspell 2.0.2 (gtkspell.sf.net) */
|
||||
/* gtkspell - a spell-checking addon for GTK's TextView widget
|
||||
* Copyright (c) 2002 Evan Martin.
|
||||
*/
|
||||
|
||||
#ifndef __XED_AUTOMATIC_SPELL_CHECKER_H__
|
||||
#define __XED_AUTOMATIC_SPELL_CHECKER_H__
|
||||
|
||||
#include <xed/xed-document.h>
|
||||
#include <xed/xed-view.h>
|
||||
|
||||
#include "xed-spell-checker.h"
|
||||
|
||||
typedef struct _XedAutomaticSpellChecker XedAutomaticSpellChecker;
|
||||
|
||||
XedAutomaticSpellChecker *xed_automatic_spell_checker_new (
|
||||
XedDocument *doc,
|
||||
XedSpellChecker *checker);
|
||||
|
||||
XedAutomaticSpellChecker *xed_automatic_spell_checker_get_from_document (
|
||||
const XedDocument *doc);
|
||||
|
||||
void xed_automatic_spell_checker_free (
|
||||
XedAutomaticSpellChecker *spell);
|
||||
|
||||
void xed_automatic_spell_checker_attach_view (
|
||||
XedAutomaticSpellChecker *spell,
|
||||
XedView *view);
|
||||
|
||||
void xed_automatic_spell_checker_detach_view (
|
||||
XedAutomaticSpellChecker *spell,
|
||||
XedView *view);
|
||||
|
||||
void xed_automatic_spell_checker_recheck_all (
|
||||
XedAutomaticSpellChecker *spell);
|
||||
|
||||
#endif /* __XED_AUTOMATIC_SPELL_CHECKER_H__ */
|
||||
|
@@ -1,726 +0,0 @@
|
||||
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* xed-spell-checker-dialog.c
|
||||
* This file is part of xed
|
||||
*
|
||||
* Copyright (C) 2002 Paolo Maggi
|
||||
*
|
||||
* 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 St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the xed Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the xed Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <xed/xed-utils.h>
|
||||
#include "xed-spell-checker-dialog.h"
|
||||
#include "xed-spell-marshal.h"
|
||||
|
||||
struct _XedSpellCheckerDialog
|
||||
{
|
||||
GtkWindow parent_instance;
|
||||
|
||||
XedSpellChecker *spell_checker;
|
||||
|
||||
gchar *misspelled_word;
|
||||
|
||||
GtkWidget *misspelled_word_label;
|
||||
GtkWidget *word_entry;
|
||||
GtkWidget *check_word_button;
|
||||
GtkWidget *ignore_button;
|
||||
GtkWidget *ignore_all_button;
|
||||
GtkWidget *change_button;
|
||||
GtkWidget *change_all_button;
|
||||
GtkWidget *add_word_button;
|
||||
GtkWidget *close_button;
|
||||
GtkWidget *suggestions_list;
|
||||
GtkWidget *language_label;
|
||||
|
||||
GtkTreeModel *suggestions_list_model;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
IGNORE,
|
||||
IGNORE_ALL,
|
||||
CHANGE,
|
||||
CHANGE_ALL,
|
||||
ADD_WORD_TO_PERSONAL,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
COLUMN_SUGGESTIONS,
|
||||
NUM_COLUMNS
|
||||
};
|
||||
|
||||
static void update_suggestions_list_model (XedSpellCheckerDialog *dlg,
|
||||
GSList *suggestions);
|
||||
|
||||
static void word_entry_changed_handler (GtkEditable *editable,
|
||||
XedSpellCheckerDialog *dlg);
|
||||
static void close_button_clicked_handler (GtkButton *button,
|
||||
XedSpellCheckerDialog *dlg);
|
||||
static void suggestions_list_selection_changed_handler (GtkTreeSelection *selection,
|
||||
XedSpellCheckerDialog *dlg);
|
||||
static void check_word_button_clicked_handler (GtkButton *button,
|
||||
XedSpellCheckerDialog *dlg);
|
||||
static void add_word_button_clicked_handler (GtkButton *button,
|
||||
XedSpellCheckerDialog *dlg);
|
||||
static void ignore_button_clicked_handler (GtkButton *button,
|
||||
XedSpellCheckerDialog *dlg);
|
||||
static void ignore_all_button_clicked_handler (GtkButton *button,
|
||||
XedSpellCheckerDialog *dlg);
|
||||
static void change_button_clicked_handler (GtkButton *button,
|
||||
XedSpellCheckerDialog *dlg);
|
||||
static void change_all_button_clicked_handler (GtkButton *button,
|
||||
XedSpellCheckerDialog *dlg);
|
||||
static void suggestions_list_row_activated_handler (GtkTreeView *view,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
XedSpellCheckerDialog *dlg);
|
||||
|
||||
|
||||
static guint signals [LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE(XedSpellCheckerDialog, xed_spell_checker_dialog, GTK_TYPE_WINDOW)
|
||||
|
||||
static void
|
||||
xed_spell_checker_dialog_dispose (GObject *object)
|
||||
{
|
||||
XedSpellCheckerDialog *dlg = XED_SPELL_CHECKER_DIALOG (object);
|
||||
|
||||
if (dlg->spell_checker != NULL)
|
||||
{
|
||||
g_object_unref (dlg->spell_checker);
|
||||
dlg->spell_checker = NULL;
|
||||
}
|
||||
|
||||
if (dlg->misspelled_word != NULL)
|
||||
{
|
||||
g_free (dlg->misspelled_word);
|
||||
dlg->misspelled_word = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (xed_spell_checker_dialog_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_spell_checker_dialog_class_init (XedSpellCheckerDialogClass * klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->dispose = xed_spell_checker_dialog_dispose;
|
||||
|
||||
signals[IGNORE] =
|
||||
g_signal_new ("ignore",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (XedSpellCheckerDialogClass, ignore),
|
||||
NULL, NULL,
|
||||
xed_marshal_VOID__STRING,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
G_TYPE_STRING);
|
||||
|
||||
signals[IGNORE_ALL] =
|
||||
g_signal_new ("ignore_all",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (XedSpellCheckerDialogClass, ignore_all),
|
||||
NULL, NULL,
|
||||
xed_marshal_VOID__STRING,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
G_TYPE_STRING);
|
||||
|
||||
signals[CHANGE] =
|
||||
g_signal_new ("change",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (XedSpellCheckerDialogClass, change),
|
||||
NULL, NULL,
|
||||
xed_marshal_VOID__STRING_STRING,
|
||||
G_TYPE_NONE,
|
||||
2,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING);
|
||||
|
||||
signals[CHANGE_ALL] =
|
||||
g_signal_new ("change_all",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (XedSpellCheckerDialogClass, change_all),
|
||||
NULL, NULL,
|
||||
xed_marshal_VOID__STRING_STRING,
|
||||
G_TYPE_NONE,
|
||||
2,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING);
|
||||
|
||||
signals[ADD_WORD_TO_PERSONAL] =
|
||||
g_signal_new ("add_word_to_personal",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (XedSpellCheckerDialogClass, add_word_to_personal),
|
||||
NULL, NULL,
|
||||
xed_marshal_VOID__STRING,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
G_TYPE_STRING);
|
||||
}
|
||||
|
||||
static void
|
||||
create_dialog (XedSpellCheckerDialog *dlg,
|
||||
const gchar *data_dir)
|
||||
{
|
||||
GtkWidget *error_widget;
|
||||
GtkWidget *content;
|
||||
GtkTreeViewColumn *column;
|
||||
GtkCellRenderer *cell;
|
||||
GtkTreeSelection *selection;
|
||||
gchar *root_objects[] = {
|
||||
"content",
|
||||
"check_word_image",
|
||||
"add_word_image",
|
||||
"ignore_image",
|
||||
"change_image",
|
||||
"ignore_all_image",
|
||||
"change_all_image",
|
||||
NULL
|
||||
};
|
||||
gboolean ret;
|
||||
gchar *ui_file;
|
||||
|
||||
g_return_if_fail (dlg != NULL);
|
||||
|
||||
dlg->spell_checker = NULL;
|
||||
dlg->misspelled_word = NULL;
|
||||
|
||||
ui_file = g_build_filename (data_dir, "spell-checker.ui", NULL);
|
||||
ret = xed_utils_get_ui_objects (ui_file,
|
||||
root_objects,
|
||||
&error_widget,
|
||||
|
||||
"content", &content,
|
||||
"misspelled_word_label", &dlg->misspelled_word_label,
|
||||
"word_entry", &dlg->word_entry,
|
||||
"check_word_button", &dlg->check_word_button,
|
||||
"ignore_button", &dlg->ignore_button,
|
||||
"ignore_all_button", &dlg->ignore_all_button,
|
||||
"change_button", &dlg->change_button,
|
||||
"change_all_button", &dlg->change_all_button,
|
||||
"add_word_button", &dlg->add_word_button,
|
||||
"close_button", &dlg->close_button,
|
||||
"suggestions_list", &dlg->suggestions_list,
|
||||
"language_label", &dlg->language_label,
|
||||
NULL);
|
||||
g_free (ui_file);
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
gtk_widget_show (error_widget);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
|
||||
error_widget, TRUE, TRUE, 0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_label_set_label (GTK_LABEL (dlg->misspelled_word_label), "");
|
||||
gtk_widget_set_sensitive (dlg->word_entry, FALSE);
|
||||
gtk_widget_set_sensitive (dlg->check_word_button, FALSE);
|
||||
gtk_widget_set_sensitive (dlg->ignore_button, FALSE);
|
||||
gtk_widget_set_sensitive (dlg->ignore_all_button, FALSE);
|
||||
gtk_widget_set_sensitive (dlg->change_button, FALSE);
|
||||
gtk_widget_set_sensitive (dlg->change_all_button, FALSE);
|
||||
gtk_widget_set_sensitive (dlg->add_word_button, FALSE);
|
||||
|
||||
gtk_label_set_label (GTK_LABEL (dlg->language_label), "");
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (dlg), content);
|
||||
g_object_unref (content);
|
||||
|
||||
gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
|
||||
gtk_window_set_title (GTK_WINDOW (dlg), _("Check Spelling"));
|
||||
|
||||
/* Suggestion list */
|
||||
dlg->suggestions_list_model = GTK_TREE_MODEL (
|
||||
gtk_list_store_new (NUM_COLUMNS, G_TYPE_STRING));
|
||||
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (dlg->suggestions_list),
|
||||
dlg->suggestions_list_model);
|
||||
|
||||
/* Add the suggestions column */
|
||||
cell = gtk_cell_renderer_text_new ();
|
||||
column = gtk_tree_view_column_new_with_attributes (_("Suggestions"), cell,
|
||||
"text", COLUMN_SUGGESTIONS, NULL);
|
||||
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (dlg->suggestions_list), column);
|
||||
|
||||
gtk_tree_view_set_search_column (GTK_TREE_VIEW (dlg->suggestions_list),
|
||||
COLUMN_SUGGESTIONS);
|
||||
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dlg->suggestions_list));
|
||||
|
||||
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
|
||||
|
||||
/* Set default button */
|
||||
gtk_widget_set_can_default (dlg->change_button, TRUE);
|
||||
gtk_widget_grab_default (dlg->change_button);
|
||||
|
||||
gtk_entry_set_activates_default (GTK_ENTRY (dlg->word_entry), TRUE);
|
||||
|
||||
/* Connect signals */
|
||||
g_signal_connect (dlg->word_entry, "changed",
|
||||
G_CALLBACK (word_entry_changed_handler), dlg);
|
||||
g_signal_connect (dlg->close_button, "clicked",
|
||||
G_CALLBACK (close_button_clicked_handler), dlg);
|
||||
g_signal_connect (selection, "changed",
|
||||
G_CALLBACK (suggestions_list_selection_changed_handler),
|
||||
dlg);
|
||||
g_signal_connect (dlg->check_word_button, "clicked",
|
||||
G_CALLBACK (check_word_button_clicked_handler), dlg);
|
||||
g_signal_connect (dlg->add_word_button, "clicked",
|
||||
G_CALLBACK (add_word_button_clicked_handler), dlg);
|
||||
g_signal_connect (dlg->ignore_button, "clicked",
|
||||
G_CALLBACK (ignore_button_clicked_handler), dlg);
|
||||
g_signal_connect (dlg->ignore_all_button, "clicked",
|
||||
G_CALLBACK (ignore_all_button_clicked_handler), dlg);
|
||||
g_signal_connect (dlg->change_button, "clicked",
|
||||
G_CALLBACK (change_button_clicked_handler), dlg);
|
||||
g_signal_connect (dlg->change_all_button, "clicked",
|
||||
G_CALLBACK (change_all_button_clicked_handler), dlg);
|
||||
g_signal_connect (dlg->suggestions_list, "row-activated",
|
||||
G_CALLBACK (suggestions_list_row_activated_handler), dlg);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_spell_checker_dialog_init (XedSpellCheckerDialog *dlg)
|
||||
{
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
xed_spell_checker_dialog_new (const gchar *data_dir)
|
||||
{
|
||||
XedSpellCheckerDialog *dlg;
|
||||
|
||||
dlg = XED_SPELL_CHECKER_DIALOG (
|
||||
g_object_new (XED_TYPE_SPELL_CHECKER_DIALOG, NULL));
|
||||
|
||||
g_return_val_if_fail (dlg != NULL, NULL);
|
||||
|
||||
create_dialog (dlg, data_dir);
|
||||
|
||||
return GTK_WIDGET (dlg);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
xed_spell_checker_dialog_new_from_spell_checker (XedSpellChecker *spell,
|
||||
const gchar *data_dir)
|
||||
{
|
||||
XedSpellCheckerDialog *dlg;
|
||||
|
||||
g_return_val_if_fail (spell != NULL, NULL);
|
||||
|
||||
dlg = XED_SPELL_CHECKER_DIALOG (
|
||||
g_object_new (XED_TYPE_SPELL_CHECKER_DIALOG, NULL));
|
||||
|
||||
g_return_val_if_fail (dlg != NULL, NULL);
|
||||
|
||||
create_dialog (dlg, data_dir);
|
||||
|
||||
xed_spell_checker_dialog_set_spell_checker (dlg, spell);
|
||||
|
||||
return GTK_WIDGET (dlg);
|
||||
}
|
||||
|
||||
void
|
||||
xed_spell_checker_dialog_set_spell_checker (XedSpellCheckerDialog *dlg, XedSpellChecker *spell)
|
||||
{
|
||||
const XedSpellCheckerLanguage* language;
|
||||
const gchar *lang;
|
||||
gchar *tmp;
|
||||
|
||||
g_return_if_fail (XED_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (spell != NULL);
|
||||
|
||||
if (dlg->spell_checker != NULL)
|
||||
g_object_unref (dlg->spell_checker);
|
||||
|
||||
dlg->spell_checker = spell;
|
||||
g_object_ref (dlg->spell_checker);
|
||||
|
||||
language = xed_spell_checker_get_language (dlg->spell_checker);
|
||||
|
||||
lang = xed_spell_checker_language_to_string (language);
|
||||
tmp = g_strdup_printf("<b>%s</b>", lang);
|
||||
|
||||
gtk_label_set_label (GTK_LABEL (dlg->language_label), tmp);
|
||||
g_free (tmp);
|
||||
|
||||
if (dlg->misspelled_word != NULL)
|
||||
xed_spell_checker_dialog_set_misspelled_word (dlg, dlg->misspelled_word, -1);
|
||||
else
|
||||
gtk_list_store_clear (GTK_LIST_STORE (dlg->suggestions_list_model));
|
||||
|
||||
/* TODO: reset all widgets */
|
||||
}
|
||||
|
||||
void
|
||||
xed_spell_checker_dialog_set_misspelled_word (XedSpellCheckerDialog *dlg,
|
||||
const gchar *word,
|
||||
gint len)
|
||||
{
|
||||
gchar *tmp;
|
||||
GSList *sug;
|
||||
|
||||
g_return_if_fail (XED_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (word != NULL);
|
||||
|
||||
g_return_if_fail (dlg->spell_checker != NULL);
|
||||
g_return_if_fail (!xed_spell_checker_check_word (dlg->spell_checker, word, -1));
|
||||
|
||||
/* build_suggestions_list */
|
||||
if (dlg->misspelled_word != NULL)
|
||||
g_free (dlg->misspelled_word);
|
||||
|
||||
dlg->misspelled_word = g_strdup (word);
|
||||
|
||||
tmp = g_strdup_printf("<b>%s</b>", word);
|
||||
gtk_label_set_label (GTK_LABEL (dlg->misspelled_word_label), tmp);
|
||||
g_free (tmp);
|
||||
|
||||
sug = xed_spell_checker_get_suggestions (dlg->spell_checker,
|
||||
dlg->misspelled_word,
|
||||
-1);
|
||||
|
||||
update_suggestions_list_model (dlg, sug);
|
||||
|
||||
/* free the suggestion list */
|
||||
g_slist_foreach (sug, (GFunc)g_free, NULL);
|
||||
g_slist_free (sug);
|
||||
|
||||
gtk_widget_set_sensitive (dlg->ignore_button, TRUE);
|
||||
gtk_widget_set_sensitive (dlg->ignore_all_button, TRUE);
|
||||
gtk_widget_set_sensitive (dlg->add_word_button, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
update_suggestions_list_model (XedSpellCheckerDialog *dlg, GSList *suggestions)
|
||||
{
|
||||
GtkListStore *store;
|
||||
GtkTreeIter iter;
|
||||
GtkTreeSelection *sel;
|
||||
|
||||
g_return_if_fail (XED_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (GTK_IS_LIST_STORE (dlg->suggestions_list_model));
|
||||
|
||||
store = GTK_LIST_STORE (dlg->suggestions_list_model);
|
||||
gtk_list_store_clear (store);
|
||||
|
||||
gtk_widget_set_sensitive (dlg->word_entry, TRUE);
|
||||
|
||||
if (suggestions == NULL)
|
||||
{
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
/* Translators: Displayed in the "Check Spelling" dialog if there are no suggestions
|
||||
* for the current misspelled word */
|
||||
COLUMN_SUGGESTIONS, _("(no suggested words)"),
|
||||
-1);
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (dlg->word_entry), "");
|
||||
|
||||
gtk_widget_set_sensitive (dlg->suggestions_list, FALSE);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (dlg->suggestions_list, TRUE);
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (dlg->word_entry), (gchar*)suggestions->data);
|
||||
|
||||
while (suggestions != NULL)
|
||||
{
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
COLUMN_SUGGESTIONS, (gchar*)suggestions->data,
|
||||
-1);
|
||||
|
||||
suggestions = g_slist_next (suggestions);
|
||||
}
|
||||
|
||||
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (dlg->suggestions_list));
|
||||
gtk_tree_model_get_iter_first (dlg->suggestions_list_model, &iter);
|
||||
gtk_tree_selection_select_iter (sel, &iter);
|
||||
}
|
||||
|
||||
static void
|
||||
word_entry_changed_handler (GtkEditable *editable, XedSpellCheckerDialog *dlg)
|
||||
{
|
||||
const gchar *text;
|
||||
|
||||
g_return_if_fail (XED_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
|
||||
text = gtk_entry_get_text (GTK_ENTRY (dlg->word_entry));
|
||||
|
||||
if (g_utf8_strlen (text, -1) > 0)
|
||||
{
|
||||
gtk_widget_set_sensitive (dlg->check_word_button, TRUE);
|
||||
gtk_widget_set_sensitive (dlg->change_button, TRUE);
|
||||
gtk_widget_set_sensitive (dlg->change_all_button, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_set_sensitive (dlg->check_word_button, FALSE);
|
||||
gtk_widget_set_sensitive (dlg->change_button, FALSE);
|
||||
gtk_widget_set_sensitive (dlg->change_all_button, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
close_button_clicked_handler (GtkButton *button, XedSpellCheckerDialog *dlg)
|
||||
{
|
||||
g_return_if_fail (XED_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (dlg));
|
||||
}
|
||||
|
||||
static void
|
||||
suggestions_list_selection_changed_handler (GtkTreeSelection *selection,
|
||||
XedSpellCheckerDialog *dlg)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GValue value = {0, };
|
||||
const gchar *text;
|
||||
|
||||
g_return_if_fail (XED_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
|
||||
if (! gtk_tree_selection_get_selected (selection, NULL, &iter))
|
||||
return;
|
||||
|
||||
gtk_tree_model_get_value (dlg->suggestions_list_model, &iter,
|
||||
COLUMN_SUGGESTIONS,
|
||||
&value);
|
||||
|
||||
text = g_value_get_string (&value);
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (dlg->word_entry), text);
|
||||
|
||||
g_value_unset (&value);
|
||||
}
|
||||
|
||||
static void
|
||||
check_word_button_clicked_handler (GtkButton *button, XedSpellCheckerDialog *dlg)
|
||||
{
|
||||
const gchar *word;
|
||||
gssize len;
|
||||
|
||||
g_return_if_fail (XED_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
|
||||
word = gtk_entry_get_text (GTK_ENTRY (dlg->word_entry));
|
||||
len = strlen (word);
|
||||
g_return_if_fail (len > 0);
|
||||
|
||||
if (xed_spell_checker_check_word (dlg->spell_checker, word, len))
|
||||
{
|
||||
GtkListStore *store;
|
||||
GtkTreeIter iter;
|
||||
|
||||
store = GTK_LIST_STORE (dlg->suggestions_list_model);
|
||||
gtk_list_store_clear (store);
|
||||
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
/* Translators: Displayed in the "Check Spelling" dialog if the current word isn't misspelled */
|
||||
COLUMN_SUGGESTIONS, _("(correct spelling)"),
|
||||
-1);
|
||||
|
||||
gtk_widget_set_sensitive (dlg->suggestions_list, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
GSList *sug;
|
||||
|
||||
sug = xed_spell_checker_get_suggestions (dlg->spell_checker,
|
||||
word,
|
||||
len);
|
||||
|
||||
update_suggestions_list_model (dlg, sug);
|
||||
|
||||
/* free the suggestion list */
|
||||
g_slist_foreach (sug, (GFunc)g_free, NULL);
|
||||
g_slist_free (sug);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
add_word_button_clicked_handler (GtkButton *button, XedSpellCheckerDialog *dlg)
|
||||
{
|
||||
gchar *word;
|
||||
|
||||
g_return_if_fail (XED_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (dlg->misspelled_word != NULL);
|
||||
|
||||
xed_spell_checker_add_word_to_personal (dlg->spell_checker,
|
||||
dlg->misspelled_word,
|
||||
-1);
|
||||
|
||||
word = g_strdup (dlg->misspelled_word);
|
||||
|
||||
g_signal_emit (G_OBJECT (dlg), signals [ADD_WORD_TO_PERSONAL], 0, word);
|
||||
|
||||
g_free (word);
|
||||
}
|
||||
|
||||
static void
|
||||
ignore_button_clicked_handler (GtkButton *button, XedSpellCheckerDialog *dlg)
|
||||
{
|
||||
gchar *word;
|
||||
|
||||
g_return_if_fail (XED_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (dlg->misspelled_word != NULL);
|
||||
|
||||
word = g_strdup (dlg->misspelled_word);
|
||||
|
||||
g_signal_emit (G_OBJECT (dlg), signals [IGNORE], 0, word);
|
||||
|
||||
g_free (word);
|
||||
}
|
||||
|
||||
static void
|
||||
ignore_all_button_clicked_handler (GtkButton *button, XedSpellCheckerDialog *dlg)
|
||||
{
|
||||
gchar *word;
|
||||
|
||||
g_return_if_fail (XED_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (dlg->misspelled_word != NULL);
|
||||
|
||||
xed_spell_checker_add_word_to_session (dlg->spell_checker,
|
||||
dlg->misspelled_word,
|
||||
-1);
|
||||
|
||||
word = g_strdup (dlg->misspelled_word);
|
||||
|
||||
g_signal_emit (G_OBJECT (dlg), signals [IGNORE_ALL], 0, word);
|
||||
|
||||
g_free (word);
|
||||
}
|
||||
|
||||
static void
|
||||
change_button_clicked_handler (GtkButton *button, XedSpellCheckerDialog *dlg)
|
||||
{
|
||||
const gchar *entry_text;
|
||||
gchar *change;
|
||||
gchar *word;
|
||||
|
||||
g_return_if_fail (XED_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (dlg->misspelled_word != NULL);
|
||||
|
||||
entry_text = gtk_entry_get_text (GTK_ENTRY (dlg->word_entry));
|
||||
g_return_if_fail (entry_text != NULL);
|
||||
g_return_if_fail (*entry_text != '\0');
|
||||
change = g_strdup (entry_text);
|
||||
|
||||
xed_spell_checker_set_correction (dlg->spell_checker,
|
||||
dlg->misspelled_word, -1,
|
||||
change, -1);
|
||||
|
||||
word = g_strdup (dlg->misspelled_word);
|
||||
|
||||
g_signal_emit (G_OBJECT (dlg), signals [CHANGE], 0, word, change);
|
||||
|
||||
g_free (word);
|
||||
g_free (change);
|
||||
}
|
||||
|
||||
/* double click on one of the suggestions is like clicking on "change" */
|
||||
static void
|
||||
suggestions_list_row_activated_handler (GtkTreeView *view,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
XedSpellCheckerDialog *dlg)
|
||||
{
|
||||
g_return_if_fail (XED_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
|
||||
change_button_clicked_handler (GTK_BUTTON (dlg->change_button), dlg);
|
||||
}
|
||||
|
||||
static void
|
||||
change_all_button_clicked_handler (GtkButton *button, XedSpellCheckerDialog *dlg)
|
||||
{
|
||||
const gchar *entry_text;
|
||||
gchar *change;
|
||||
gchar *word;
|
||||
|
||||
g_return_if_fail (XED_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (dlg->misspelled_word != NULL);
|
||||
|
||||
entry_text = gtk_entry_get_text (GTK_ENTRY (dlg->word_entry));
|
||||
g_return_if_fail (entry_text != NULL);
|
||||
g_return_if_fail (*entry_text != '\0');
|
||||
change = g_strdup (entry_text);
|
||||
|
||||
xed_spell_checker_set_correction (dlg->spell_checker,
|
||||
dlg->misspelled_word, -1,
|
||||
change, -1);
|
||||
|
||||
word = g_strdup (dlg->misspelled_word);
|
||||
|
||||
g_signal_emit (G_OBJECT (dlg), signals [CHANGE_ALL], 0, word, change);
|
||||
|
||||
g_free (word);
|
||||
g_free (change);
|
||||
}
|
||||
|
||||
void
|
||||
xed_spell_checker_dialog_set_completed (XedSpellCheckerDialog *dlg)
|
||||
{
|
||||
gchar *tmp;
|
||||
|
||||
g_return_if_fail (XED_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
|
||||
tmp = g_strdup_printf("<b>%s</b>", _("Completed spell checking"));
|
||||
gtk_label_set_label (GTK_LABEL (dlg->misspelled_word_label),
|
||||
tmp);
|
||||
g_free (tmp);
|
||||
|
||||
gtk_list_store_clear (GTK_LIST_STORE (dlg->suggestions_list_model));
|
||||
gtk_entry_set_text (GTK_ENTRY (dlg->word_entry), "");
|
||||
|
||||
gtk_widget_set_sensitive (dlg->word_entry, FALSE);
|
||||
gtk_widget_set_sensitive (dlg->check_word_button, FALSE);
|
||||
gtk_widget_set_sensitive (dlg->ignore_button, FALSE);
|
||||
gtk_widget_set_sensitive (dlg->ignore_all_button, FALSE);
|
||||
gtk_widget_set_sensitive (dlg->change_button, FALSE);
|
||||
gtk_widget_set_sensitive (dlg->change_all_button, FALSE);
|
||||
gtk_widget_set_sensitive (dlg->add_word_button, FALSE);
|
||||
gtk_widget_set_sensitive (dlg->suggestions_list, FALSE);
|
||||
}
|
||||
|
@@ -1,92 +0,0 @@
|
||||
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* xed-spell-checker-dialog.h
|
||||
* This file is part of xed
|
||||
*
|
||||
* Copyright (C) 2002 Paolo Maggi
|
||||
*
|
||||
* 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 St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the xed Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the xed Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
#ifndef __XED_SPELL_CHECKER_DIALOG_H__
|
||||
#define __XED_SPELL_CHECKER_DIALOG_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "xed-spell-checker.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define XED_TYPE_SPELL_CHECKER_DIALOG (xed_spell_checker_dialog_get_type ())
|
||||
#define XED_SPELL_CHECKER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XED_TYPE_SPELL_CHECKER_DIALOG, XedSpellCheckerDialog))
|
||||
#define XED_SPELL_CHECKER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XED_TYPE_SPELL_CHECKER_DIALOG, XedSpellCheckerDialog))
|
||||
#define XED_IS_SPELL_CHECKER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XED_TYPE_SPELL_CHECKER_DIALOG))
|
||||
#define XED_IS_SPELL_CHECKER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XED_TYPE_SPELL_CHECKER_DIALOG))
|
||||
#define XED_SPELL_CHECKER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XED_TYPE_SPELL_CHECKER_DIALOG, XedSpellCheckerDialog))
|
||||
|
||||
|
||||
typedef struct _XedSpellCheckerDialog XedSpellCheckerDialog;
|
||||
|
||||
typedef struct _XedSpellCheckerDialogClass XedSpellCheckerDialogClass;
|
||||
|
||||
struct _XedSpellCheckerDialogClass
|
||||
{
|
||||
GtkWindowClass parent_class;
|
||||
|
||||
/* Signals */
|
||||
void (*ignore) (XedSpellCheckerDialog *dlg,
|
||||
const gchar *word);
|
||||
void (*ignore_all) (XedSpellCheckerDialog *dlg,
|
||||
const gchar *word);
|
||||
void (*change) (XedSpellCheckerDialog *dlg,
|
||||
const gchar *word,
|
||||
const gchar *change_to);
|
||||
void (*change_all) (XedSpellCheckerDialog *dlg,
|
||||
const gchar *word,
|
||||
const gchar *change_to);
|
||||
void (*add_word_to_personal) (XedSpellCheckerDialog *dlg,
|
||||
const gchar *word);
|
||||
|
||||
};
|
||||
|
||||
GType xed_spell_checker_dialog_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* Constructors */
|
||||
GtkWidget *xed_spell_checker_dialog_new (const gchar *data_dir);
|
||||
GtkWidget *xed_spell_checker_dialog_new_from_spell_checker
|
||||
(XedSpellChecker *spell,
|
||||
const gchar *data_dir);
|
||||
|
||||
void xed_spell_checker_dialog_set_spell_checker
|
||||
(XedSpellCheckerDialog *dlg,
|
||||
XedSpellChecker *spell);
|
||||
void xed_spell_checker_dialog_set_misspelled_word
|
||||
(XedSpellCheckerDialog *dlg,
|
||||
const gchar* word,
|
||||
gint len);
|
||||
|
||||
void xed_spell_checker_dialog_set_completed
|
||||
(XedSpellCheckerDialog *dlg);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __XED_SPELL_CHECKER_DIALOG_H__ */
|
||||
|
@@ -1,439 +0,0 @@
|
||||
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* xed-spell-checker-language.c
|
||||
* This file is part of xed
|
||||
*
|
||||
* Copyright (C) 2006 Paolo Maggi
|
||||
*
|
||||
* 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 St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the xed Team, 2006. See the AUTHORS file for a
|
||||
* list of people on the xed Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
/* Part of the code taked from Epiphany.
|
||||
*
|
||||
* Copyright (C) 2003, 2004 Christian Persch
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <enchant.h>
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <libxml/xmlreader.h>
|
||||
|
||||
#include "xed-spell-checker-language.h"
|
||||
|
||||
#include <xed/xed-debug.h>
|
||||
|
||||
#define ISO_639_DOMAIN "iso_639"
|
||||
#define ISO_3166_DOMAIN "iso_3166"
|
||||
|
||||
#define ISOCODESLOCALEDIR ISO_CODES_PREFIX "/share/locale"
|
||||
|
||||
struct _XedSpellCheckerLanguage
|
||||
{
|
||||
gchar *abrev;
|
||||
gchar *name;
|
||||
};
|
||||
|
||||
static gboolean available_languages_initialized = FALSE;
|
||||
static GSList *available_languages = NULL;
|
||||
|
||||
static GHashTable *iso_639_table = NULL;
|
||||
static GHashTable *iso_3166_table = NULL;
|
||||
|
||||
static void
|
||||
bind_iso_domains (void)
|
||||
{
|
||||
static gboolean bound = FALSE;
|
||||
|
||||
if (bound == FALSE)
|
||||
{
|
||||
bindtextdomain (ISO_639_DOMAIN, ISOCODESLOCALEDIR);
|
||||
bind_textdomain_codeset (ISO_639_DOMAIN, "UTF-8");
|
||||
|
||||
bindtextdomain(ISO_3166_DOMAIN, ISOCODESLOCALEDIR);
|
||||
bind_textdomain_codeset (ISO_3166_DOMAIN, "UTF-8");
|
||||
|
||||
bound = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
read_iso_639_entry (xmlTextReaderPtr reader,
|
||||
GHashTable *table)
|
||||
{
|
||||
xmlChar *code, *name;
|
||||
|
||||
code = xmlTextReaderGetAttribute (reader, (const xmlChar *) "iso_639_1_code");
|
||||
name = xmlTextReaderGetAttribute (reader, (const xmlChar *) "name");
|
||||
|
||||
/* Get iso-639-2 code */
|
||||
if (code == NULL || code[0] == '\0')
|
||||
{
|
||||
xmlFree (code);
|
||||
/* FIXME: use the 2T or 2B code? */
|
||||
code = xmlTextReaderGetAttribute (reader, (const xmlChar *) "iso_639_2T_code");
|
||||
}
|
||||
|
||||
if (code != NULL && code[0] != '\0' && name != NULL && name[0] != '\0')
|
||||
{
|
||||
g_hash_table_insert (table, code, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlFree (code);
|
||||
xmlFree (name);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
read_iso_3166_entry (xmlTextReaderPtr reader,
|
||||
GHashTable *table)
|
||||
{
|
||||
xmlChar *code, *name;
|
||||
|
||||
code = xmlTextReaderGetAttribute (reader, (const xmlChar *) "alpha_2_code");
|
||||
name = xmlTextReaderGetAttribute (reader, (const xmlChar *) "name");
|
||||
|
||||
if (code != NULL && code[0] != '\0' && name != NULL && name[0] != '\0')
|
||||
{
|
||||
char *lcode;
|
||||
|
||||
lcode = g_ascii_strdown ((char *) code, -1);
|
||||
xmlFree (code);
|
||||
|
||||
/* g_print ("%s -> %s\n", lcode, name); */
|
||||
|
||||
g_hash_table_insert (table, lcode, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlFree (code);
|
||||
xmlFree (name);
|
||||
}
|
||||
}
|
||||
|
||||
typedef enum
|
||||
{
|
||||
STATE_START,
|
||||
STATE_STOP,
|
||||
STATE_ENTRIES,
|
||||
} ParserState;
|
||||
|
||||
static void
|
||||
load_iso_entries (int iso,
|
||||
GFunc read_entry_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
xmlTextReaderPtr reader;
|
||||
ParserState state = STATE_START;
|
||||
xmlChar iso_entries[32], iso_entry[32];
|
||||
char *filename;
|
||||
int ret = -1;
|
||||
|
||||
xed_debug_message (DEBUG_PLUGINS, "Loading ISO-%d codes", iso);
|
||||
|
||||
filename = g_strdup_printf (ISO_CODES_PREFIX "/share/xml/iso-codes/iso_%d.xml", iso);
|
||||
reader = xmlNewTextReaderFilename (filename);
|
||||
if (reader == NULL) goto out;
|
||||
|
||||
xmlStrPrintf (iso_entries, sizeof (iso_entries), (const xmlChar *)"iso_%d_entries", iso);
|
||||
xmlStrPrintf (iso_entry, sizeof (iso_entry), (const xmlChar *)"iso_%d_entry", iso);
|
||||
|
||||
ret = xmlTextReaderRead (reader);
|
||||
|
||||
while (ret == 1)
|
||||
{
|
||||
const xmlChar *tag;
|
||||
xmlReaderTypes type;
|
||||
|
||||
tag = xmlTextReaderConstName (reader);
|
||||
type = xmlTextReaderNodeType (reader);
|
||||
|
||||
if (state == STATE_ENTRIES &&
|
||||
type == XML_READER_TYPE_ELEMENT &&
|
||||
xmlStrEqual (tag, iso_entry))
|
||||
{
|
||||
read_entry_func (reader, user_data);
|
||||
}
|
||||
else if (state == STATE_START &&
|
||||
type == XML_READER_TYPE_ELEMENT &&
|
||||
xmlStrEqual (tag, iso_entries))
|
||||
{
|
||||
state = STATE_ENTRIES;
|
||||
}
|
||||
else if (state == STATE_ENTRIES &&
|
||||
type == XML_READER_TYPE_END_ELEMENT &&
|
||||
xmlStrEqual (tag, iso_entries))
|
||||
{
|
||||
state = STATE_STOP;
|
||||
}
|
||||
else if (type == XML_READER_TYPE_SIGNIFICANT_WHITESPACE ||
|
||||
type == XML_READER_TYPE_WHITESPACE ||
|
||||
type == XML_READER_TYPE_TEXT ||
|
||||
type == XML_READER_TYPE_COMMENT)
|
||||
{
|
||||
/* eat it */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ignore it */
|
||||
}
|
||||
|
||||
ret = xmlTextReaderRead (reader);
|
||||
}
|
||||
|
||||
xmlFreeTextReader (reader);
|
||||
|
||||
out:
|
||||
if (ret < 0 || state != STATE_STOP)
|
||||
{
|
||||
g_warning ("Failed to load ISO-%d codes from %s!\n",
|
||||
iso, filename);
|
||||
}
|
||||
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
static GHashTable *
|
||||
create_iso_639_table (void)
|
||||
{
|
||||
GHashTable *table;
|
||||
|
||||
bind_iso_domains ();
|
||||
table = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
(GDestroyNotify) xmlFree,
|
||||
(GDestroyNotify) xmlFree);
|
||||
|
||||
load_iso_entries (639, (GFunc) read_iso_639_entry, table);
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
static GHashTable *
|
||||
create_iso_3166_table (void)
|
||||
{
|
||||
GHashTable *table;
|
||||
|
||||
bind_iso_domains ();
|
||||
table = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
(GDestroyNotify) g_free,
|
||||
(GDestroyNotify) xmlFree);
|
||||
|
||||
load_iso_entries (3166, (GFunc) read_iso_3166_entry, table);
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
static char *
|
||||
create_name_for_language (const char *code)
|
||||
{
|
||||
char **str;
|
||||
char *name = NULL;
|
||||
const char *langname, *localename;
|
||||
int len;
|
||||
|
||||
g_return_val_if_fail (iso_639_table != NULL, NULL);
|
||||
g_return_val_if_fail (iso_3166_table != NULL, NULL);
|
||||
|
||||
str = g_strsplit (code, "_", -1);
|
||||
len = g_strv_length (str);
|
||||
g_return_val_if_fail (len != 0, NULL);
|
||||
|
||||
langname = (const char *) g_hash_table_lookup (iso_639_table, str[0]);
|
||||
|
||||
if (len == 1 && langname != NULL)
|
||||
{
|
||||
name = g_strdup (dgettext (ISO_639_DOMAIN, langname));
|
||||
}
|
||||
else if (len == 2 && langname != NULL)
|
||||
{
|
||||
gchar *locale_code = g_ascii_strdown (str[1], -1);
|
||||
|
||||
localename = (const char *) g_hash_table_lookup (iso_3166_table, locale_code);
|
||||
g_free (locale_code);
|
||||
|
||||
if (localename != NULL)
|
||||
{
|
||||
/* Translators: the first %s is the language name, and
|
||||
* the second %s is the locale name. Example:
|
||||
* "French (France)"
|
||||
*/
|
||||
name = g_strdup_printf (C_("language", "%s (%s)"),
|
||||
dgettext (ISO_639_DOMAIN, langname),
|
||||
dgettext (ISO_3166_DOMAIN, localename));
|
||||
}
|
||||
else
|
||||
{
|
||||
name = g_strdup_printf (C_("language", "%s (%s)"),
|
||||
dgettext (ISO_639_DOMAIN, langname), str[1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Translators: this refers to an unknown language code
|
||||
* (one which isn't in our built-in list).
|
||||
*/
|
||||
name = g_strdup_printf (C_("language", "Unknown (%s)"), code);
|
||||
}
|
||||
|
||||
g_strfreev (str);
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
static void
|
||||
enumerate_dicts (const char * const lang_tag,
|
||||
const char * const provider_name,
|
||||
const char * const provider_desc,
|
||||
const char * const provider_file,
|
||||
void * user_data)
|
||||
{
|
||||
gchar *lang_name;
|
||||
|
||||
GTree *dicts = (GTree *)user_data;
|
||||
|
||||
lang_name = create_name_for_language (lang_tag);
|
||||
g_return_if_fail (lang_name != NULL);
|
||||
|
||||
/* g_print ("%s - %s\n", lang_tag, lang_name); */
|
||||
|
||||
g_tree_replace (dicts, g_strdup (lang_tag), lang_name);
|
||||
}
|
||||
|
||||
static gint
|
||||
key_cmp (gconstpointer a, gconstpointer b, gpointer user_data)
|
||||
{
|
||||
return strcmp (a, b);
|
||||
}
|
||||
|
||||
static gint
|
||||
lang_cmp (const XedSpellCheckerLanguage *a,
|
||||
const XedSpellCheckerLanguage *b)
|
||||
{
|
||||
return g_utf8_collate (a->name, b->name);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
build_langs_list (const gchar *key,
|
||||
const gchar *value,
|
||||
gpointer data)
|
||||
{
|
||||
XedSpellCheckerLanguage *lang = g_new (XedSpellCheckerLanguage, 1);
|
||||
|
||||
lang->abrev = g_strdup (key);
|
||||
lang->name = g_strdup (value);
|
||||
|
||||
available_languages = g_slist_insert_sorted (available_languages,
|
||||
lang,
|
||||
(GCompareFunc)lang_cmp);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const GSList *
|
||||
xed_spell_checker_get_available_languages (void)
|
||||
{
|
||||
EnchantBroker *broker;
|
||||
GTree *dicts;
|
||||
|
||||
if (available_languages_initialized)
|
||||
return available_languages;
|
||||
|
||||
g_return_val_if_fail (available_languages == NULL, NULL);
|
||||
|
||||
available_languages_initialized = TRUE;
|
||||
|
||||
broker = enchant_broker_init ();
|
||||
g_return_val_if_fail (broker != NULL, NULL);
|
||||
|
||||
/* Use a GTree to efficiently remove duplicates while building the list */
|
||||
dicts = g_tree_new_full (key_cmp,
|
||||
NULL,
|
||||
(GDestroyNotify)g_free,
|
||||
(GDestroyNotify)g_free);
|
||||
|
||||
iso_639_table = create_iso_639_table ();
|
||||
iso_3166_table = create_iso_3166_table ();
|
||||
|
||||
enchant_broker_list_dicts (broker, enumerate_dicts, dicts);
|
||||
|
||||
enchant_broker_free (broker);
|
||||
|
||||
g_hash_table_destroy (iso_639_table);
|
||||
g_hash_table_destroy (iso_3166_table);
|
||||
|
||||
iso_639_table = NULL;
|
||||
iso_3166_table = NULL;
|
||||
|
||||
g_tree_foreach (dicts, (GTraverseFunc)build_langs_list, NULL);
|
||||
|
||||
g_tree_destroy (dicts);
|
||||
|
||||
return available_languages;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
xed_spell_checker_language_to_string (const XedSpellCheckerLanguage *lang)
|
||||
{
|
||||
if (lang == NULL)
|
||||
/* Translators: this refers the Default language used by the
|
||||
* spell checker
|
||||
*/
|
||||
return C_("language", "Default");
|
||||
|
||||
return lang->name;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
xed_spell_checker_language_to_key (const XedSpellCheckerLanguage *lang)
|
||||
{
|
||||
g_return_val_if_fail (lang != NULL, NULL);
|
||||
|
||||
return lang->abrev;
|
||||
}
|
||||
|
||||
const XedSpellCheckerLanguage *
|
||||
xed_spell_checker_language_from_key (const gchar *key)
|
||||
{
|
||||
const GSList *langs;
|
||||
|
||||
g_return_val_if_fail (key != NULL, NULL);
|
||||
|
||||
langs = xed_spell_checker_get_available_languages ();
|
||||
|
||||
while (langs != NULL)
|
||||
{
|
||||
const XedSpellCheckerLanguage *l = (const XedSpellCheckerLanguage *)langs->data;
|
||||
|
||||
if (g_ascii_strcasecmp (key, l->abrev) == 0)
|
||||
return l;
|
||||
|
||||
langs = g_slist_next (langs);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
@@ -1,51 +0,0 @@
|
||||
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* xed-spell-checker-language.h
|
||||
* This file is part of xed
|
||||
*
|
||||
* Copyright (C) 2006 Paolo Maggi
|
||||
*
|
||||
* 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 St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the xed Team, 2006. See the AUTHORS file for a
|
||||
* list of people on the xed Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
#ifndef __XED_SPELL_CHECKER_LANGUAGE_H__
|
||||
#define __XED_SPELL_CHECKER_LANGUAGE_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _XedSpellCheckerLanguage XedSpellCheckerLanguage;
|
||||
|
||||
const gchar *xed_spell_checker_language_to_string (const XedSpellCheckerLanguage *lang);
|
||||
|
||||
const gchar *xed_spell_checker_language_to_key (const XedSpellCheckerLanguage *lang);
|
||||
|
||||
const XedSpellCheckerLanguage *xed_spell_checker_language_from_key (const gchar *key);
|
||||
|
||||
/* GSList contains "XedSpellCheckerLanguage*" items */
|
||||
const GSList *xed_spell_checker_get_available_languages
|
||||
(void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __XED_SPELL_CHECKER_LANGUAGE_H__ */
|
@@ -1,520 +0,0 @@
|
||||
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* xed-spell-checker.c
|
||||
* This file is part of xed
|
||||
*
|
||||
* Copyright (C) 2002-2006 Paolo Maggi
|
||||
*
|
||||
* 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 St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the xed Team, 2002-2006. See the AUTHORS file for a
|
||||
* list of people on the xed Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <enchant.h>
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "xed-spell-checker.h"
|
||||
#include "xed-spell-utils.h"
|
||||
#include "xed-spell-marshal.h"
|
||||
|
||||
struct _XedSpellChecker
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
EnchantDict *dict;
|
||||
EnchantBroker *broker;
|
||||
const XedSpellCheckerLanguage *active_lang;
|
||||
};
|
||||
|
||||
/* GObject properties */
|
||||
enum {
|
||||
PROP_0 = 0,
|
||||
PROP_LANGUAGE,
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
/* Signals */
|
||||
enum {
|
||||
ADD_WORD_TO_PERSONAL = 0,
|
||||
ADD_WORD_TO_SESSION,
|
||||
SET_LANGUAGE,
|
||||
CLEAR_SESSION,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE(XedSpellChecker, xed_spell_checker, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
xed_spell_checker_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
/*
|
||||
XedSpellChecker *spell = XED_SPELL_CHECKER (object);
|
||||
*/
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_LANGUAGE:
|
||||
/* TODO */
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xed_spell_checker_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
/*
|
||||
XedSpellChecker *spell = XED_SPELL_CHECKER (object);
|
||||
*/
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_LANGUAGE:
|
||||
/* TODO */
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xed_spell_checker_finalize (GObject *object)
|
||||
{
|
||||
XedSpellChecker *spell_checker;
|
||||
|
||||
g_return_if_fail (XED_IS_SPELL_CHECKER (object));
|
||||
|
||||
spell_checker = XED_SPELL_CHECKER (object);
|
||||
|
||||
if (spell_checker->dict != NULL)
|
||||
enchant_broker_free_dict (spell_checker->broker, spell_checker->dict);
|
||||
|
||||
if (spell_checker->broker != NULL)
|
||||
enchant_broker_free (spell_checker->broker);
|
||||
|
||||
G_OBJECT_CLASS (xed_spell_checker_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_spell_checker_class_init (XedSpellCheckerClass * klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->set_property = xed_spell_checker_set_property;
|
||||
object_class->get_property = xed_spell_checker_get_property;
|
||||
|
||||
object_class->finalize = xed_spell_checker_finalize;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_LANGUAGE,
|
||||
g_param_spec_pointer ("language",
|
||||
"Language",
|
||||
"The language used by the spell checker",
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
signals[ADD_WORD_TO_PERSONAL] =
|
||||
g_signal_new ("add_word_to_personal",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (XedSpellCheckerClass, add_word_to_personal),
|
||||
NULL, NULL,
|
||||
xed_marshal_VOID__STRING_INT,
|
||||
G_TYPE_NONE,
|
||||
2,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_INT);
|
||||
|
||||
signals[ADD_WORD_TO_SESSION] =
|
||||
g_signal_new ("add_word_to_session",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (XedSpellCheckerClass, add_word_to_session),
|
||||
NULL, NULL,
|
||||
xed_marshal_VOID__STRING_INT,
|
||||
G_TYPE_NONE,
|
||||
2,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_INT);
|
||||
|
||||
signals[SET_LANGUAGE] =
|
||||
g_signal_new ("set_language",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (XedSpellCheckerClass, set_language),
|
||||
NULL, NULL,
|
||||
xed_marshal_VOID__POINTER,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
G_TYPE_POINTER);
|
||||
|
||||
signals[CLEAR_SESSION] =
|
||||
g_signal_new ("clear_session",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (XedSpellCheckerClass, clear_session),
|
||||
NULL, NULL,
|
||||
xed_marshal_VOID__VOID,
|
||||
G_TYPE_NONE,
|
||||
0);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_spell_checker_init (XedSpellChecker *spell_checker)
|
||||
{
|
||||
spell_checker->broker = enchant_broker_init ();
|
||||
spell_checker->dict = NULL;
|
||||
spell_checker->active_lang = NULL;
|
||||
}
|
||||
|
||||
XedSpellChecker *
|
||||
xed_spell_checker_new (void)
|
||||
{
|
||||
XedSpellChecker *spell;
|
||||
|
||||
spell = XED_SPELL_CHECKER (
|
||||
g_object_new (XED_TYPE_SPELL_CHECKER, NULL));
|
||||
|
||||
g_return_val_if_fail (spell != NULL, NULL);
|
||||
|
||||
return spell;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
lazy_init (XedSpellChecker *spell,
|
||||
const XedSpellCheckerLanguage *language)
|
||||
{
|
||||
if (spell->dict != NULL)
|
||||
return TRUE;
|
||||
|
||||
g_return_val_if_fail (spell->broker != NULL, FALSE);
|
||||
|
||||
spell->active_lang = NULL;
|
||||
|
||||
if (language != NULL)
|
||||
{
|
||||
spell->active_lang = language;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* First try to get a default language */
|
||||
const XedSpellCheckerLanguage *l;
|
||||
gint i = 0;
|
||||
const gchar * const *lang_tags = g_get_language_names ();
|
||||
|
||||
while (lang_tags [i])
|
||||
{
|
||||
l = xed_spell_checker_language_from_key (lang_tags [i]);
|
||||
|
||||
if (l != NULL)
|
||||
{
|
||||
spell->active_lang = l;
|
||||
break;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Second try to get a default language */
|
||||
if (spell->active_lang == NULL)
|
||||
spell->active_lang = xed_spell_checker_language_from_key ("en_US");
|
||||
|
||||
/* Last try to get a default language */
|
||||
if (spell->active_lang == NULL)
|
||||
{
|
||||
const GSList *langs;
|
||||
langs = xed_spell_checker_get_available_languages ();
|
||||
if (langs != NULL)
|
||||
spell->active_lang = (const XedSpellCheckerLanguage *)langs->data;
|
||||
}
|
||||
|
||||
if (spell->active_lang != NULL)
|
||||
{
|
||||
const gchar *key;
|
||||
|
||||
key = xed_spell_checker_language_to_key (spell->active_lang);
|
||||
|
||||
spell->dict = enchant_broker_request_dict (spell->broker,
|
||||
key);
|
||||
}
|
||||
|
||||
if (spell->dict == NULL)
|
||||
{
|
||||
spell->active_lang = NULL;
|
||||
|
||||
if (language != NULL)
|
||||
g_warning ("Spell checker plugin: cannot select a default language.");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
xed_spell_checker_set_language (XedSpellChecker *spell,
|
||||
const XedSpellCheckerLanguage *language)
|
||||
{
|
||||
gboolean ret;
|
||||
|
||||
g_return_val_if_fail (XED_IS_SPELL_CHECKER (spell), FALSE);
|
||||
|
||||
if (spell->dict != NULL)
|
||||
{
|
||||
enchant_broker_free_dict (spell->broker, spell->dict);
|
||||
spell->dict = NULL;
|
||||
}
|
||||
|
||||
ret = lazy_init (spell, language);
|
||||
|
||||
if (ret)
|
||||
g_signal_emit (G_OBJECT (spell), signals[SET_LANGUAGE], 0, language);
|
||||
else
|
||||
g_warning ("Spell checker plugin: cannot use language %s.",
|
||||
xed_spell_checker_language_to_string (language));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
const XedSpellCheckerLanguage *
|
||||
xed_spell_checker_get_language (XedSpellChecker *spell)
|
||||
{
|
||||
g_return_val_if_fail (XED_IS_SPELL_CHECKER (spell), NULL);
|
||||
|
||||
if (!lazy_init (spell, spell->active_lang))
|
||||
return NULL;
|
||||
|
||||
return spell->active_lang;
|
||||
}
|
||||
|
||||
gboolean
|
||||
xed_spell_checker_check_word (XedSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize len)
|
||||
{
|
||||
gint enchant_result;
|
||||
gboolean res = FALSE;
|
||||
|
||||
g_return_val_if_fail (XED_IS_SPELL_CHECKER (spell), FALSE);
|
||||
g_return_val_if_fail (word != NULL, FALSE);
|
||||
|
||||
if (!lazy_init (spell, spell->active_lang))
|
||||
return FALSE;
|
||||
|
||||
if (len < 0)
|
||||
len = strlen (word);
|
||||
|
||||
if (strcmp (word, "xed") == 0)
|
||||
return TRUE;
|
||||
|
||||
if (xed_spell_utils_is_digit (word, len))
|
||||
return TRUE;
|
||||
|
||||
g_return_val_if_fail (spell->dict != NULL, FALSE);
|
||||
enchant_result = enchant_dict_check (spell->dict, word, len);
|
||||
|
||||
switch (enchant_result)
|
||||
{
|
||||
case -1:
|
||||
/* error */
|
||||
res = FALSE;
|
||||
|
||||
g_warning ("Spell checker plugin: error checking word '%s' (%s).",
|
||||
word, enchant_dict_get_error (spell->dict));
|
||||
|
||||
break;
|
||||
case 1:
|
||||
/* it is not in the directory */
|
||||
res = FALSE;
|
||||
break;
|
||||
case 0:
|
||||
/* is is in the directory */
|
||||
res = TRUE;
|
||||
break;
|
||||
default:
|
||||
g_return_val_if_reached (FALSE);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/* return NULL on error or if no suggestions are found */
|
||||
GSList *
|
||||
xed_spell_checker_get_suggestions (XedSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize len)
|
||||
{
|
||||
gchar **suggestions;
|
||||
size_t n_suggestions = 0;
|
||||
GSList *suggestions_list = NULL;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (XED_IS_SPELL_CHECKER (spell), NULL);
|
||||
g_return_val_if_fail (word != NULL, NULL);
|
||||
|
||||
if (!lazy_init (spell, spell->active_lang))
|
||||
return NULL;
|
||||
|
||||
g_return_val_if_fail (spell->dict != NULL, NULL);
|
||||
|
||||
if (len < 0)
|
||||
len = strlen (word);
|
||||
|
||||
suggestions = enchant_dict_suggest (spell->dict, word, len, &n_suggestions);
|
||||
|
||||
if (n_suggestions == 0)
|
||||
return NULL;
|
||||
|
||||
g_return_val_if_fail (suggestions != NULL, NULL);
|
||||
|
||||
for (i = 0; i < (gint)n_suggestions; i++)
|
||||
{
|
||||
suggestions_list = g_slist_prepend (suggestions_list,
|
||||
suggestions[i]);
|
||||
}
|
||||
|
||||
/* The single suggestions will be freed by the caller */
|
||||
g_free (suggestions);
|
||||
|
||||
suggestions_list = g_slist_reverse (suggestions_list);
|
||||
|
||||
return suggestions_list;
|
||||
}
|
||||
|
||||
gboolean
|
||||
xed_spell_checker_add_word_to_personal (XedSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize len)
|
||||
{
|
||||
g_return_val_if_fail (XED_IS_SPELL_CHECKER (spell), FALSE);
|
||||
g_return_val_if_fail (word != NULL, FALSE);
|
||||
|
||||
if (!lazy_init (spell, spell->active_lang))
|
||||
return FALSE;
|
||||
|
||||
g_return_val_if_fail (spell->dict != NULL, FALSE);
|
||||
|
||||
if (len < 0)
|
||||
len = strlen (word);
|
||||
|
||||
enchant_dict_add_to_pwl (spell->dict, word, len);
|
||||
|
||||
g_signal_emit (G_OBJECT (spell), signals[ADD_WORD_TO_PERSONAL], 0, word, len);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
xed_spell_checker_add_word_to_session (XedSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize len)
|
||||
{
|
||||
g_return_val_if_fail (XED_IS_SPELL_CHECKER (spell), FALSE);
|
||||
g_return_val_if_fail (word != NULL, FALSE);
|
||||
|
||||
if (!lazy_init (spell, spell->active_lang))
|
||||
return FALSE;
|
||||
|
||||
g_return_val_if_fail (spell->dict != NULL, FALSE);
|
||||
|
||||
if (len < 0)
|
||||
len = strlen (word);
|
||||
|
||||
enchant_dict_add_to_session (spell->dict, word, len);
|
||||
|
||||
g_signal_emit (G_OBJECT (spell), signals[ADD_WORD_TO_SESSION], 0, word, len);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
xed_spell_checker_clear_session (XedSpellChecker *spell)
|
||||
{
|
||||
g_return_val_if_fail (XED_IS_SPELL_CHECKER (spell), FALSE);
|
||||
|
||||
/* free and re-request dictionary */
|
||||
if (spell->dict != NULL)
|
||||
{
|
||||
enchant_broker_free_dict (spell->broker, spell->dict);
|
||||
spell->dict = NULL;
|
||||
}
|
||||
|
||||
if (!lazy_init (spell, spell->active_lang))
|
||||
return FALSE;
|
||||
|
||||
g_signal_emit (G_OBJECT (spell), signals[CLEAR_SESSION], 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Informs dictionary, that word 'word' will be replaced/corrected by word
|
||||
* 'replacement'
|
||||
*/
|
||||
gboolean
|
||||
xed_spell_checker_set_correction (XedSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize w_len,
|
||||
const gchar *replacement,
|
||||
gssize r_len)
|
||||
{
|
||||
g_return_val_if_fail (XED_IS_SPELL_CHECKER (spell), FALSE);
|
||||
g_return_val_if_fail (word != NULL, FALSE);
|
||||
g_return_val_if_fail (replacement != NULL, FALSE);
|
||||
|
||||
if (!lazy_init (spell, spell->active_lang))
|
||||
return FALSE;
|
||||
|
||||
g_return_val_if_fail (spell->dict != NULL, FALSE);
|
||||
|
||||
if (w_len < 0)
|
||||
w_len = strlen (word);
|
||||
|
||||
if (r_len < 0)
|
||||
r_len = strlen (replacement);
|
||||
|
||||
enchant_dict_store_replacement (spell->dict,
|
||||
word,
|
||||
w_len,
|
||||
replacement,
|
||||
r_len);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -1,109 +0,0 @@
|
||||
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* xed-spell-checker.h
|
||||
* This file is part of xed
|
||||
*
|
||||
* Copyright (C) 2002-2006 Paolo Maggi
|
||||
*
|
||||
* 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 St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the xed Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the xed Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
#ifndef __XED_SPELL_CHECKER_H__
|
||||
#define __XED_SPELL_CHECKER_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "xed-spell-checker-language.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define XED_TYPE_SPELL_CHECKER (xed_spell_checker_get_type ())
|
||||
#define XED_SPELL_CHECKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XED_TYPE_SPELL_CHECKER, XedSpellChecker))
|
||||
#define XED_SPELL_CHECKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XED_TYPE_SPELL_CHECKER, XedSpellChecker))
|
||||
#define XED_IS_SPELL_CHECKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XED_TYPE_SPELL_CHECKER))
|
||||
#define XED_IS_SPELL_CHECKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XED_TYPE_SPELL_CHECKER))
|
||||
#define XED_SPELL_CHECKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XED_TYPE_SPELL_CHECKER, XedSpellChecker))
|
||||
|
||||
typedef struct _XedSpellChecker XedSpellChecker;
|
||||
|
||||
typedef struct _XedSpellCheckerClass XedSpellCheckerClass;
|
||||
|
||||
struct _XedSpellCheckerClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* Signals */
|
||||
void (*add_word_to_personal) (XedSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gint len);
|
||||
|
||||
void (*add_word_to_session) (XedSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gint len);
|
||||
|
||||
void (*set_language) (XedSpellChecker *spell,
|
||||
const XedSpellCheckerLanguage *lang);
|
||||
|
||||
void (*clear_session) (XedSpellChecker *spell);
|
||||
};
|
||||
|
||||
|
||||
GType xed_spell_checker_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* Constructors */
|
||||
XedSpellChecker *xed_spell_checker_new (void);
|
||||
|
||||
gboolean xed_spell_checker_set_language (XedSpellChecker *spell,
|
||||
const XedSpellCheckerLanguage *lang);
|
||||
const XedSpellCheckerLanguage
|
||||
*xed_spell_checker_get_language (XedSpellChecker *spell);
|
||||
|
||||
gboolean xed_spell_checker_check_word (XedSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize len);
|
||||
|
||||
GSList *xed_spell_checker_get_suggestions (XedSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize len);
|
||||
|
||||
gboolean xed_spell_checker_add_word_to_personal
|
||||
(XedSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize len);
|
||||
|
||||
gboolean xed_spell_checker_add_word_to_session
|
||||
(XedSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize len);
|
||||
|
||||
gboolean xed_spell_checker_clear_session (XedSpellChecker *spell);
|
||||
|
||||
gboolean xed_spell_checker_set_correction (XedSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize w_len,
|
||||
const gchar *replacement,
|
||||
gssize r_len);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __XED_SPELL_CHECKER_H__ */
|
||||
|
@@ -1,284 +0,0 @@
|
||||
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* xed-spell-language-dialog.c
|
||||
* This file is part of xed
|
||||
*
|
||||
* Copyright (C) 2002 Paolo Maggi
|
||||
*
|
||||
* 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 St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the xed Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the xed Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <xed/xed-utils.h>
|
||||
#include <xed/xed-app.h>
|
||||
#include "xed-spell-language-dialog.h"
|
||||
#include "xed-spell-checker-language.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
COLUMN_LANGUAGE_NAME = 0,
|
||||
COLUMN_LANGUAGE_POINTER,
|
||||
ENCODING_NUM_COLS
|
||||
};
|
||||
|
||||
|
||||
struct _XedSpellLanguageDialog
|
||||
{
|
||||
GtkDialog dialog;
|
||||
|
||||
GtkWidget *languages_treeview;
|
||||
GtkTreeModel *model;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (XedSpellLanguageDialog, xed_spell_language_dialog, GTK_TYPE_DIALOG)
|
||||
|
||||
|
||||
static void
|
||||
xed_spell_language_dialog_class_init (XedSpellLanguageDialogClass *klass)
|
||||
{
|
||||
/* GObjectClass *object_class = G_OBJECT_CLASS (klass); */
|
||||
}
|
||||
|
||||
static void
|
||||
dialog_response_handler (GtkDialog *dlg,
|
||||
gint res_id)
|
||||
{
|
||||
if (res_id == GTK_RESPONSE_HELP)
|
||||
{
|
||||
xed_app_show_help (XED_APP (g_application_get_default ()), GTK_WINDOW (dlg), NULL, "xed-spell-checker-plugin");
|
||||
|
||||
g_signal_stop_emission_by_name (dlg, "response");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
scroll_to_selected (GtkTreeView *tree_view)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
GtkTreeSelection *selection;
|
||||
GtkTreeIter iter;
|
||||
|
||||
model = gtk_tree_view_get_model (tree_view);
|
||||
g_return_if_fail (model != NULL);
|
||||
|
||||
/* Scroll to selected */
|
||||
selection = gtk_tree_view_get_selection (tree_view);
|
||||
g_return_if_fail (selection != NULL);
|
||||
|
||||
if (gtk_tree_selection_get_selected (selection, NULL, &iter))
|
||||
{
|
||||
GtkTreePath* path;
|
||||
|
||||
path = gtk_tree_model_get_path (model, &iter);
|
||||
g_return_if_fail (path != NULL);
|
||||
|
||||
gtk_tree_view_scroll_to_cell (tree_view, path, NULL, TRUE, 1.0, 0.0);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
language_row_activated (GtkTreeView *tree_view,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
XedSpellLanguageDialog *dialog)
|
||||
{
|
||||
gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
||||
}
|
||||
|
||||
static void
|
||||
create_dialog (XedSpellLanguageDialog *dlg,
|
||||
const gchar *data_dir)
|
||||
{
|
||||
GtkWidget *error_widget;
|
||||
GtkWidget *content;
|
||||
gboolean ret;
|
||||
GtkCellRenderer *cell;
|
||||
GtkTreeViewColumn *column;
|
||||
gchar *ui_file;
|
||||
gchar *root_objects[] = {
|
||||
"content",
|
||||
NULL
|
||||
};
|
||||
|
||||
gtk_dialog_add_buttons (GTK_DIALOG (dlg),
|
||||
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
||||
_("_OK"), GTK_RESPONSE_OK,
|
||||
_("_Help"), GTK_RESPONSE_HELP,
|
||||
NULL);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (dlg), _("Set language"));
|
||||
gtk_window_set_modal (GTK_WINDOW (dlg), TRUE);
|
||||
gtk_window_set_destroy_with_parent (GTK_WINDOW (dlg), TRUE);
|
||||
|
||||
/* HIG defaults */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dlg), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (dlg))), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dlg))), 6);
|
||||
|
||||
g_signal_connect (dlg, "response",
|
||||
G_CALLBACK (dialog_response_handler), NULL);
|
||||
|
||||
ui_file = g_build_filename (data_dir, "languages-dialog.ui", NULL);
|
||||
ret = xed_utils_get_ui_objects (ui_file,
|
||||
root_objects,
|
||||
&error_widget,
|
||||
"content", &content,
|
||||
"languages_treeview", &dlg->languages_treeview,
|
||||
NULL);
|
||||
g_free (ui_file);
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
gtk_widget_show (error_widget);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), error_widget, TRUE, TRUE, 0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), content, TRUE, TRUE, 0);
|
||||
g_object_unref (content);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (content), 5);
|
||||
|
||||
dlg->model = GTK_TREE_MODEL (gtk_list_store_new (ENCODING_NUM_COLS, G_TYPE_STRING, G_TYPE_POINTER));
|
||||
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (dlg->languages_treeview), dlg->model);
|
||||
|
||||
g_object_unref (dlg->model);
|
||||
|
||||
/* Add the encoding column */
|
||||
cell = gtk_cell_renderer_text_new ();
|
||||
column = gtk_tree_view_column_new_with_attributes (_("Languages"),
|
||||
cell,
|
||||
"text",
|
||||
COLUMN_LANGUAGE_NAME,
|
||||
NULL);
|
||||
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (dlg->languages_treeview), column);
|
||||
|
||||
gtk_tree_view_set_search_column (GTK_TREE_VIEW (dlg->languages_treeview), COLUMN_LANGUAGE_NAME);
|
||||
|
||||
g_signal_connect (dlg->languages_treeview, "realize",
|
||||
G_CALLBACK (scroll_to_selected), dlg);
|
||||
g_signal_connect (dlg->languages_treeview, "row-activated",
|
||||
G_CALLBACK (language_row_activated), dlg);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_spell_language_dialog_init (XedSpellLanguageDialog *dlg)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
populate_language_list (XedSpellLanguageDialog *dlg,
|
||||
const XedSpellCheckerLanguage *cur_lang)
|
||||
{
|
||||
GtkListStore *store;
|
||||
GtkTreeIter iter;
|
||||
|
||||
const GSList* langs;
|
||||
|
||||
/* create list store */
|
||||
store = GTK_LIST_STORE (dlg->model);
|
||||
|
||||
langs = xed_spell_checker_get_available_languages ();
|
||||
|
||||
while (langs)
|
||||
{
|
||||
const gchar *name;
|
||||
|
||||
name = xed_spell_checker_language_to_string ((const XedSpellCheckerLanguage*)langs->data);
|
||||
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
COLUMN_LANGUAGE_NAME, name,
|
||||
COLUMN_LANGUAGE_POINTER, langs->data,
|
||||
-1);
|
||||
|
||||
if (langs->data == cur_lang)
|
||||
{
|
||||
GtkTreeSelection *selection;
|
||||
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dlg->languages_treeview));
|
||||
g_return_if_fail (selection != NULL);
|
||||
|
||||
gtk_tree_selection_select_iter (selection, &iter);
|
||||
}
|
||||
|
||||
langs = g_slist_next (langs);
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
xed_spell_language_dialog_new (GtkWindow *parent,
|
||||
const XedSpellCheckerLanguage *cur_lang,
|
||||
const gchar *data_dir)
|
||||
{
|
||||
XedSpellLanguageDialog *dlg;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_WINDOW (parent), NULL);
|
||||
|
||||
dlg = g_object_new (XED_TYPE_SPELL_LANGUAGE_DIALOG, NULL);
|
||||
|
||||
create_dialog (dlg, data_dir);
|
||||
|
||||
populate_language_list (dlg, cur_lang);
|
||||
|
||||
gtk_window_set_transient_for (GTK_WINDOW (dlg), parent);
|
||||
gtk_widget_grab_focus (dlg->languages_treeview);
|
||||
|
||||
return GTK_WIDGET (dlg);
|
||||
}
|
||||
|
||||
const XedSpellCheckerLanguage *
|
||||
xed_spell_language_get_selected_language (XedSpellLanguageDialog *dlg)
|
||||
{
|
||||
GValue value = {0, };
|
||||
const XedSpellCheckerLanguage* lang;
|
||||
|
||||
GtkTreeIter iter;
|
||||
GtkTreeSelection *selection;
|
||||
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dlg->languages_treeview));
|
||||
g_return_val_if_fail (selection != NULL, NULL);
|
||||
|
||||
if (!gtk_tree_selection_get_selected (selection, NULL, &iter))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gtk_tree_model_get_value (dlg->model, &iter, COLUMN_LANGUAGE_POINTER, &value);
|
||||
|
||||
lang = (const XedSpellCheckerLanguage* ) g_value_get_pointer (&value);
|
||||
|
||||
return lang;
|
||||
}
|
||||
|
@@ -1,65 +0,0 @@
|
||||
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* xed-spell-language-dialog.h
|
||||
* This file is part of xed
|
||||
*
|
||||
* Copyright (C) 2002 Paolo Maggi
|
||||
*
|
||||
* 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 St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the xed Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the xed Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
#ifndef __XED_SPELL_LANGUAGE_DIALOG_H__
|
||||
#define __XED_SPELL_LANGUAGE_DIALOG_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "xed-spell-checker-language.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define XED_TYPE_SPELL_LANGUAGE_DIALOG (xed_spell_language_dialog_get_type())
|
||||
#define XED_SPELL_LANGUAGE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XED_TYPE_SPELL_LANGUAGE_DIALOG, XedSpellLanguageDialog))
|
||||
#define XED_SPELL_LANGUAGE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), XED_TYPE_SPELL_LANGUAGE_DIALOG, XedSpellLanguageDialogClass))
|
||||
#define XED_IS_SPELL_LANGUAGE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), XED_TYPE_SPELL_LANGUAGE_DIALOG))
|
||||
#define XED_IS_SPELL_LANGUAGE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XED_TYPE_SPELL_LANGUAGE_DIALOG))
|
||||
#define XED_SPELL_LANGUAGE_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), XED_TYPE_SPELL_LANGUAGE_DIALOG, XedSpellLanguageDialogClass))
|
||||
|
||||
|
||||
typedef struct _XedSpellLanguageDialog XedSpellLanguageDialog;
|
||||
typedef struct _XedSpellLanguageDialogClass XedSpellLanguageDialogClass;
|
||||
|
||||
struct _XedSpellLanguageDialogClass
|
||||
{
|
||||
GtkDialogClass parent_class;
|
||||
};
|
||||
|
||||
GType xed_spell_language_dialog_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget *xed_spell_language_dialog_new (GtkWindow *parent,
|
||||
const XedSpellCheckerLanguage *cur_lang,
|
||||
const gchar *data_dir);
|
||||
|
||||
const XedSpellCheckerLanguage *xed_spell_language_get_selected_language (XedSpellLanguageDialog *dlg);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __XED_SPELL_LANGUAGE_DIALOG_H__ */
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
* xed-spell-utils.c
|
||||
* This file is part of xed
|
||||
*
|
||||
* Copyright (C) 2010 - Jesse van den Kieboom
|
||||
*
|
||||
* 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 St, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "xed-spell-utils.h"
|
||||
#include <gtksourceview/gtksource.h>
|
||||
|
||||
gboolean
|
||||
xed_spell_utils_is_digit (const char *text, gssize length)
|
||||
{
|
||||
gunichar c;
|
||||
const gchar *p;
|
||||
const gchar *end;
|
||||
|
||||
g_return_val_if_fail (text != NULL, FALSE);
|
||||
|
||||
if (length < 0)
|
||||
length = strlen (text);
|
||||
|
||||
p = text;
|
||||
end = text + length;
|
||||
|
||||
while (p != end) {
|
||||
const gchar *next;
|
||||
next = g_utf8_next_char (p);
|
||||
|
||||
c = g_utf8_get_char (p);
|
||||
|
||||
if (!g_unichar_isdigit (c) && c != '.' && c != ',')
|
||||
return FALSE;
|
||||
|
||||
p = next;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
xed_spell_utils_skip_no_spell_check (GtkTextIter *start,
|
||||
GtkTextIter *end)
|
||||
{
|
||||
GtkSourceBuffer *buffer = GTK_SOURCE_BUFFER (gtk_text_iter_get_buffer (start));
|
||||
|
||||
while (gtk_source_buffer_iter_has_context_class (buffer, start, "no-spell-check"))
|
||||
{
|
||||
GtkTextIter last = *start;
|
||||
|
||||
if (!gtk_source_buffer_iter_forward_to_context_class_toggle (buffer, start, "no-spell-check"))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (gtk_text_iter_compare (start, &last) <= 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gtk_text_iter_forward_word_end (start);
|
||||
gtk_text_iter_backward_word_start (start);
|
||||
|
||||
if (gtk_text_iter_compare (start, &last) <= 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (gtk_text_iter_compare (start, end) >= 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* xed-spell-utils.h
|
||||
* This file is part of xed
|
||||
*
|
||||
* Copyright (C) 2010 - Jesse van den Kieboom
|
||||
*
|
||||
* 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 St, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __XED_SPELL_UTILS_H__
|
||||
#define __XED_SPELL_UTILS_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
gboolean xed_spell_utils_is_digit (const char *text, gssize length);
|
||||
|
||||
gboolean xed_spell_utils_skip_no_spell_check (GtkTextIter *start, GtkTextIter *end);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __XED_SPELL_UTILS_H__ */
|
||||
|
38
plugins/taglist/C.tags.xml.in
Normal file
38
plugins/taglist/C.tags.xml.in
Normal file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<TagList xmlns="http://xed.sourceforge.net/some-location">
|
||||
<TagGroup _name="C - Tags" sort="true">
|
||||
|
||||
<Tag name="STDIO">
|
||||
<Begin>#include <stdio.h></Begin>
|
||||
</Tag>
|
||||
|
||||
<Tag name="include">
|
||||
<Begin>#include </Begin>
|
||||
</Tag>
|
||||
|
||||
<Tag name="main">
|
||||
<Begin>int main() {
|
||||
</Begin>
|
||||
<End>
|
||||
}</End>
|
||||
</Tag>
|
||||
|
||||
<Tag name="Comment">
|
||||
<Begin>/* </Begin>
|
||||
<End> */</End>
|
||||
</Tag>
|
||||
|
||||
<Tag name="Multi-Line Comment">
|
||||
<Begin>/*
|
||||
* </Begin>
|
||||
<End>
|
||||
*/</End>
|
||||
</Tag>
|
||||
|
||||
<Tag name="printf">
|
||||
<Begin>printf("</Begin>
|
||||
<End>");</End>
|
||||
</Tag>
|
||||
|
||||
</TagGroup>
|
||||
</TagList>
|
@@ -1,60 +0,0 @@
|
||||
# Tag list plugin
|
||||
plugindir = $(XED_PLUGINS_LIBS_DIR)
|
||||
|
||||
taglistdir = $(XED_PLUGINS_DATA_DIR)/taglist
|
||||
|
||||
taglist_in_files = \
|
||||
HTML.tags.xml.in \
|
||||
Latex.tags.xml.in \
|
||||
XSLT.tags.xml.in \
|
||||
XUL.tags.xml.in
|
||||
|
||||
taglist_DATA = $(taglist_in_files:.tags.xml.in=.tags.gz)
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
$(XED_CFLAGS) \
|
||||
$(WARN_CFLAGS) \
|
||||
$(DISABLE_DEPRECATED_CFLAGS)
|
||||
|
||||
plugin_LTLIBRARIES = libtaglist.la
|
||||
|
||||
libtaglist_la_SOURCES = \
|
||||
xed-taglist-plugin-parser.c \
|
||||
xed-taglist-plugin-parser.h \
|
||||
xed-taglist-plugin-panel.c \
|
||||
xed-taglist-plugin-panel.h \
|
||||
xed-taglist-plugin.c \
|
||||
xed-taglist-plugin.h
|
||||
|
||||
libtaglist_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
|
||||
libtaglist_la_LIBADD = $(XED_LIBS)
|
||||
|
||||
plugin_in_files = taglist.plugin.desktop.in
|
||||
|
||||
%.plugin: %.plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po)
|
||||
$(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
|
||||
|
||||
GZIP_ENV = -9
|
||||
|
||||
%.tags.gz: %.tags.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po)
|
||||
LC_ALL=C $(INTLTOOL_MERGE) $(top_srcdir)/po $< $(@:.gz=) -x -u -c $(top_builddir)/po/.intltool-merge-cache
|
||||
GZIP=$(GZIP_ENV) gzip -n -f $(@:.gz=)
|
||||
|
||||
plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(taglist_in_files) $(taglist_DATA) \
|
||||
$(plugin_in_files) $(plugin_DATA)
|
||||
|
||||
CLEANFILES = \
|
||||
$(taglist_DATA) \
|
||||
$(plugin_DATA)
|
||||
DISTCLEANFILES = \
|
||||
$(taglist_DATA) \
|
||||
$(plugin_DATA)
|
||||
|
||||
|
||||
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
63
plugins/taglist/meson.build
Normal file
63
plugins/taglist/meson.build
Normal file
@@ -0,0 +1,63 @@
|
||||
taglist_sources = [
|
||||
'xed-taglist-plugin-parser.c',
|
||||
'xed-taglist-plugin-parser.h',
|
||||
'xed-taglist-plugin-panel.c',
|
||||
'xed-taglist-plugin-panel.h',
|
||||
'xed-taglist-plugin.c',
|
||||
'xed-taglist-plugin.h'
|
||||
]
|
||||
|
||||
taglist_in_files = [
|
||||
'C.tags@0@',
|
||||
'HTML.tags@0@',
|
||||
'Latex.tags@0@',
|
||||
'XSLT.tags@0@',
|
||||
'XUL.tags@0@'
|
||||
]
|
||||
|
||||
taglist_deps = [
|
||||
config_h,
|
||||
glib,
|
||||
gtk,
|
||||
gtksourceview,
|
||||
libpeas,
|
||||
libxml
|
||||
]
|
||||
|
||||
library(
|
||||
'taglist',
|
||||
taglist_sources,
|
||||
link_with: libxed,
|
||||
dependencies: taglist_deps,
|
||||
include_directories: include_dirs,
|
||||
install_rpath: join_paths(prefix, libdir, 'xed'),
|
||||
install: true,
|
||||
install_dir: join_paths(libdir, 'xed', 'plugins')
|
||||
)
|
||||
|
||||
taglist_desktop = custom_target(
|
||||
'taglist_desktop',
|
||||
input: 'taglist.plugin.desktop.in',
|
||||
output: 'taglist.plugin',
|
||||
command: [intltool_merge, '-d', '-u', po_dir, '@INPUT@', '@OUTPUT@'],
|
||||
install: true,
|
||||
install_dir: pluginslibdir,
|
||||
)
|
||||
|
||||
foreach tagtype : taglist_in_files
|
||||
taglist_xml = custom_target(
|
||||
'@0@xmltags'.format(tagtype.format('')),
|
||||
input: tagtype.format('.xml.in'),
|
||||
output: tagtype.format(''),
|
||||
command: [intltool_merge, '-x', '-u', po_dir, '@INPUT@', '@OUTPUT@'],
|
||||
)
|
||||
|
||||
taglist_gz = custom_target(
|
||||
'@0@gztags'.format(tagtype.format('')),
|
||||
input: taglist_xml,
|
||||
output: tagtype.format('.gz'),
|
||||
command: ['gzip', '-9', '-n', '-f', '@INPUT@'],
|
||||
install: true,
|
||||
install_dir: join_paths(pluginsdatadir, 'taglist')
|
||||
)
|
||||
endforeach
|
@@ -5,4 +5,3 @@ _Name=Tag list
|
||||
_Description=Provides a method to easily insert commonly used tags/strings into a document without having to type them.
|
||||
Authors=Paolo Maggi <paolo.maggi@polito.it>
|
||||
Copyright=Copyright © 2002-2005 Paolo Maggi
|
||||
Website=http://www.mate-desktop.org
|
||||
|
@@ -28,25 +28,16 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "xed-taglist-plugin-panel.h"
|
||||
#include "xed-taglist-plugin-parser.h"
|
||||
|
||||
#include <xed/xed-utils.h>
|
||||
#include <xed/xed-debug.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#define XED_TAGLIST_PLUGIN_PANEL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
|
||||
XED_TYPE_TAGLIST_PLUGIN_PANEL, \
|
||||
XedTaglistPluginPanelPrivate))
|
||||
#include "xed-taglist-plugin-panel.h"
|
||||
#include "xed-taglist-plugin-parser.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -68,7 +59,11 @@ struct _XedTaglistPluginPanelPrivate
|
||||
gchar *data_dir;
|
||||
};
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (XedTaglistPluginPanel, xed_taglist_plugin_panel, GTK_TYPE_BOX)
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedTaglistPluginPanel,
|
||||
xed_taglist_plugin_panel,
|
||||
GTK_TYPE_BOX,
|
||||
0,
|
||||
G_ADD_PRIVATE_DYNAMIC (XedTaglistPluginPanel))
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -119,8 +114,7 @@ xed_taglist_plugin_panel_get_property (GObject *object,
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WINDOW:
|
||||
g_value_set_object (value,
|
||||
XED_TAGLIST_PLUGIN_PANEL_GET_PRIVATE (panel)->window);
|
||||
g_value_set_object (value, panel->priv->window);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@@ -155,8 +149,6 @@ xed_taglist_plugin_panel_class_init (XedTaglistPluginPanelClass *klass)
|
||||
XED_TYPE_WINDOW,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_type_class_add_private (object_class, sizeof(XedTaglistPluginPanelPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -673,7 +665,7 @@ xed_taglist_plugin_panel_init (XedTaglistPluginPanel *panel)
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
panel->priv = XED_TAGLIST_PLUGIN_PANEL_GET_PRIVATE (panel);
|
||||
panel->priv = xed_taglist_plugin_panel_get_instance_private (panel);
|
||||
panel->priv->data_dir = NULL;
|
||||
|
||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (panel),
|
||||
@@ -717,7 +709,6 @@ xed_taglist_plugin_panel_init (XedTaglistPluginPanel *panel)
|
||||
panel->priv->tag_groups_combo,
|
||||
ATK_RELATION_CONTROLLED_BY);
|
||||
|
||||
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (panel->priv->tags_list), FALSE);
|
||||
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (panel->priv->tags_list), FALSE);
|
||||
|
||||
g_object_set (panel->priv->tags_list, "has-tooltip", TRUE, NULL);
|
||||
|
@@ -30,15 +30,11 @@
|
||||
|
||||
/* FIXME: we should rewrite the parser to avoid using DOM */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include <xed/xed-debug.h>
|
||||
|
||||
#include "xed-taglist-plugin-parser.h"
|
||||
|
@@ -27,21 +27,15 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "xed-taglist-plugin.h"
|
||||
#include "xed-taglist-plugin-panel.h"
|
||||
#include "xed-taglist-plugin-parser.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include <xed/xed-window.h>
|
||||
#include <xed/xed-window-activatable.h>
|
||||
#include <xed/xed-debug.h>
|
||||
|
||||
#define XED_TAGLIST_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_TAGLIST_PLUGIN, XedTaglistPluginPrivate))
|
||||
#include "xed-taglist-plugin.h"
|
||||
#include "xed-taglist-plugin-panel.h"
|
||||
#include "xed-taglist-plugin-parser.h"
|
||||
|
||||
struct _XedTaglistPluginPrivate
|
||||
{
|
||||
@@ -52,26 +46,25 @@ struct _XedTaglistPluginPrivate
|
||||
|
||||
static void xed_window_activatable_iface_init (XedWindowActivatableInterface *iface);
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedTaglistPlugin,
|
||||
xed_taglist_plugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
xed_window_activatable_iface_init) \
|
||||
\
|
||||
_xed_taglist_plugin_panel_register_type (type_module); \
|
||||
)
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_WINDOW
|
||||
};
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedTaglistPlugin,
|
||||
xed_taglist_plugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
xed_window_activatable_iface_init)
|
||||
G_ADD_PRIVATE_DYNAMIC (XedTaglistPlugin)
|
||||
_xed_taglist_plugin_panel_register_type (type_module))
|
||||
|
||||
static void
|
||||
xed_taglist_plugin_init (XedTaglistPlugin *plugin)
|
||||
{
|
||||
plugin->priv = XED_TAGLIST_PLUGIN_GET_PRIVATE (plugin);
|
||||
plugin->priv = xed_taglist_plugin_get_instance_private (plugin);
|
||||
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedTaglistPlugin initializing");
|
||||
}
|
||||
@@ -114,7 +107,7 @@ xed_taglist_plugin_activate (XedWindowActivatable *activatable)
|
||||
priv->taglist_panel = xed_taglist_plugin_panel_new (priv->window, data_dir);
|
||||
g_free (data_dir);
|
||||
|
||||
xed_panel_add_item (side_panel, priv->taglist_panel, _("Tags"), "list-add");
|
||||
xed_panel_add_item (side_panel, priv->taglist_panel, _("Tags"), "list-add-symbolic");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -196,8 +189,6 @@ xed_taglist_plugin_class_init (XedTaglistPluginClass *klass)
|
||||
object_class->get_property = xed_taglist_plugin_get_property;
|
||||
|
||||
g_object_class_override_property (object_class, PROP_WINDOW, "window");
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedTaglistPluginPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -1,16 +0,0 @@
|
||||
# Textsize Plugin
|
||||
SUBDIRS = textsize
|
||||
plugindir = $(XED_PLUGINS_LIBS_DIR)
|
||||
|
||||
plugin_in_files = textsize.plugin.desktop.in
|
||||
%.plugin: %.plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
|
||||
|
||||
plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(plugin_in_files)
|
||||
|
||||
CLEANFILES = $(plugin_DATA)
|
||||
DISTCLEANFILES = $(plugin_DATA)
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
13
plugins/textsize/meson.build
Normal file
13
plugins/textsize/meson.build
Normal file
@@ -0,0 +1,13 @@
|
||||
install_subdir(
|
||||
'textsize',
|
||||
install_dir: pluginslibdir
|
||||
)
|
||||
|
||||
textsize_desktop = custom_target(
|
||||
'textsize_desktop',
|
||||
input: 'textsize.plugin.desktop.in',
|
||||
output: 'textsize.plugin',
|
||||
command: [intltool_merge, '-d', '-u', po_dir, '@INPUT@', '@OUTPUT@'],
|
||||
install: true,
|
||||
install_dir: pluginslibdir,
|
||||
)
|
@@ -7,5 +7,4 @@ _Description=Allow controlling the zoom levels of the text
|
||||
Icon=gnome-mime-text-x-python
|
||||
Authors=Steve Frécinaux <steve@istique.net>;Linux Mint team
|
||||
Copyright=Copyright © 2017 by the authors
|
||||
Website=https://github.com/linuxmint
|
||||
Builtin=true
|
@@ -1,11 +0,0 @@
|
||||
plugindir = $(XED_PLUGINS_LIBS_DIR)/textsize
|
||||
|
||||
plugin_PYTHON = \
|
||||
__init__.py \
|
||||
signals.py \
|
||||
documenthelper.py
|
||||
|
||||
CLEANFILES =
|
||||
DISTCLEANFILES =
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user