commit
8cece49ab6
|
@ -1,11 +1,7 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
|
||||
|
||||
SUBDIRS = xed pixmaps po data plugin-loaders plugins docs help
|
||||
|
||||
if ENABLE_TESTS
|
||||
SUBDIRS += tests
|
||||
endif
|
||||
SUBDIRS = xed pixmaps po data plugins docs help
|
||||
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
|
||||
|
@ -55,7 +51,7 @@ MAINTAINERCLEANFILES = \
|
|||
m4/lt~obsolete.m4 \
|
||||
`find "$(srcdir)" -type f -name Makefile.in -print`
|
||||
|
||||
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --disable-tests
|
||||
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
|
||||
|
||||
dist-hook:
|
||||
@if test -d "$(srcdir)/.git"; \
|
||||
|
|
|
@ -24,7 +24,6 @@ which yelp-build || {
|
|||
}
|
||||
|
||||
REQUIRED_AUTOMAKE_VERSION=1.9
|
||||
REQUIRED_MACROS=python.m4
|
||||
GNOME_DATADIR="$gnome_datadir"
|
||||
USE_COMMON_DOC_BUILD=yes
|
||||
|
||||
|
|
165
configure.ac
165
configure.ac
|
@ -49,12 +49,6 @@ dnl toolbar style for GSettings schemas
|
|||
TOOLBAR_STYLE="XED_TOOLBAR_SYSTEM"
|
||||
AC_SUBST(TOOLBAR_STYLE)
|
||||
|
||||
# GLib min/max required versions
|
||||
AC_DEFINE([GLIB_VERSION_MAX_ALLOWED], [GLIB_VERSION_2_36],
|
||||
[Warn on use of APIs added after GLib 2.36])
|
||||
AC_DEFINE([GLIB_VERSION_MIN_REQUIRED], [GLIB_VERSION_2_36],
|
||||
[Warn on use of APIs deprecated before GLib 2.36])
|
||||
|
||||
dnl ===============================================================
|
||||
dnl Expanded dirs
|
||||
dnl ===============================================================
|
||||
|
@ -151,12 +145,14 @@ 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.36.0
|
||||
glib-2.0 >= 2.40.0
|
||||
$GMODULE_ADD
|
||||
gthread-2.0 >= 2.13.0
|
||||
gio-2.0 >= 2.26.0
|
||||
gtk+-3.0 >= 3.10.0
|
||||
gtksourceview-3.0 >= 2.9.7
|
||||
gio-2.0 >= 2.40.0
|
||||
gtk+-3.0 >= 3.14.0
|
||||
gtksourceview-3.0 >= 3.14.3
|
||||
libpeas-1.0 >= 1.12.0
|
||||
libpeas-gtk-1.0 >= 1.12.0
|
||||
])
|
||||
|
||||
PKG_CHECK_MODULES(X11, [x11])
|
||||
|
@ -167,10 +163,15 @@ XED_LIBS="$XED_LIBS $X11_LIBS"
|
|||
AC_SUBST(XED_CFLAGS)
|
||||
AC_SUBST(XED_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(EGG_SMCLIENT, [sm >= 1.0.0])
|
||||
# Introspection
|
||||
GOBJECT_INTROSPECTION_CHECK([0.9.3])
|
||||
|
||||
AC_SUBST(EGG_SMCLIENT_CFLAGS)
|
||||
AC_SUBST(EGG_SMCLIENT_LIBS)
|
||||
if test "$found_introspection" = "yes"; then
|
||||
enable_introspection=yes
|
||||
AC_DEFINE([ENABLE_INTROSPECTION], [1], [Define to enable GObject Introspection])
|
||||
else
|
||||
enable_introspection=no
|
||||
fi
|
||||
|
||||
dnl ================================================================
|
||||
dnl GSettings related settings
|
||||
|
@ -178,126 +179,10 @@ dnl ================================================================
|
|||
|
||||
GLIB_GSETTINGS
|
||||
|
||||
dnl ================================================================
|
||||
dnl Python
|
||||
dnl ================================================================
|
||||
|
||||
AC_MSG_CHECKING([whether Python support is requested])
|
||||
AC_ARG_ENABLE([python],
|
||||
AS_HELP_STRING([--enable-python],[Enable python support]),
|
||||
[enable_python=$enableval have_python=$enableval],
|
||||
[enable_python=autodetect have_python=yes])
|
||||
AC_MSG_RESULT([$enable_python])
|
||||
|
||||
if test "x$have_python" != "xno"; then
|
||||
AM_PATH_PYTHON([2.5],[],[no])
|
||||
if test "x$PYTHON" = "x:"; then
|
||||
have_python=no
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$have_python" != "xno"; then
|
||||
AM_CHECK_PYTHON_HEADERS([],[have_python=no])
|
||||
fi
|
||||
|
||||
if test "x$have_python" != "xno"; then
|
||||
PY_EXEC_PREFIX=`$PYTHON -c 'import sys ; print sys.exec_prefix'`
|
||||
PYTHON_LIBS="-lpython$PYTHON_VERSION"
|
||||
|
||||
PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'`
|
||||
PYTHON_LIB_LOC="-L$libdir/python$PYTHON_VERSION/config"
|
||||
PYTHON_CFLAGS="-I$PY_PREFIX/include/python$PYTHON_VERSION"
|
||||
PYTHON_MAKEFILE="$libdir/python$PYTHON_VERSION/config/Makefile"
|
||||
PYTHON_BASEMODLIBS=`sed -n -e 's/^BASEMODLIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
|
||||
PYTHON_OTHER_LIBS=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
|
||||
PYTHON_EXTRA_LIBS="$PYTHON_BASEMODLIBS $PYTHON_OTHER_LIBS"
|
||||
|
||||
AC_SUBST([PYTHON_LIBS])
|
||||
AC_SUBST([PYTHON_LIB_LOC])
|
||||
AC_SUBST([PYTHON_CFLAGS])
|
||||
AC_SUBST([PYTHON_EXTRA_LIBS])
|
||||
fi
|
||||
|
||||
if test "x$have_python" != "xyes"; then
|
||||
if test "x$enable_python" = "xyes"; then
|
||||
AC_MSG_ERROR([Python not found])
|
||||
elif test "x$enable_python" = "xautodetect"; then
|
||||
enable_python=no
|
||||
AC_MSG_WARN([Python not found, disabling python support])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$have_python" != "xno"; then
|
||||
PYGOBJECT_REQUIRED=2.15.4
|
||||
PYGTK_REQUIRED=2.12.0
|
||||
PYGTKSOURCEVIEW_REQUIRED=2.9.2
|
||||
|
||||
PKG_CHECK_MODULES([PYGTK], [
|
||||
pygobject-2.0 >= $PYGOBJECT_REQUIRED
|
||||
pygtk-2.0 >= $PYGTK_REQUIRED
|
||||
pygtksourceview-2.0 >= $PYGTKSOURCEVIEW_REQUIRED],
|
||||
[],
|
||||
[
|
||||
have_python=no
|
||||
if test "x$enable_python" = "xyes"; then
|
||||
AC_MSG_ERROR([$PYGTK_PKG_ERRORS])
|
||||
elif test "x$enable_python" = "xautodetect"; then
|
||||
enable_python=no
|
||||
AC_MSG_WARN([$PYGTK_PKG_ERRORS])
|
||||
AC_MSG_WARN([Disabling python support])
|
||||
fi
|
||||
])
|
||||
fi
|
||||
|
||||
if test "x$have_python" != "xno"; then
|
||||
AC_MSG_CHECKING([for pygtk defs])
|
||||
PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0`
|
||||
AC_MSG_RESULT([$PYGTK_DEFSDIR])
|
||||
|
||||
AC_MSG_CHECKING([for pygobject defs])
|
||||
PYGOBJECT_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygobject-2.0`
|
||||
AC_MSG_RESULT([$PYGOBJECT_DEFSDIR])
|
||||
|
||||
AC_MSG_CHECKING([for pygtk codegen])
|
||||
PYGTK_CODEGEN="$PYTHON `$PKG_CONFIG --variable=codegendir pygtk-2.0`/codegen.py"
|
||||
AC_MSG_RESULT([$PYGTK_CODEGEN])
|
||||
|
||||
AC_MSG_CHECKING([for pygtk h2def])
|
||||
PYGTK_H2DEF="$PYTHON `$PKG_CONFIG --variable=codegendir pygtk-2.0`/h2def.py"
|
||||
AC_MSG_RESULT([$PYGTK_H2DEF])
|
||||
|
||||
AC_SUBST([PYGTK_DEFSDIR])
|
||||
AC_SUBST([PYGOBJECT_DEFSDIR])
|
||||
AC_SUBST([PYGTK_CODEGEN])
|
||||
AC_SUBST([PYGTK_H2DEF])
|
||||
|
||||
dnl Check for -fno-strict-aliasing
|
||||
FLAGS="-fno-strict-aliasing"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $FLAGS"
|
||||
AC_MSG_CHECKING([whether [$]CC understands $FLAGS])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[compiler_has_option=yes],[compiler_has_option=no])
|
||||
CFLAGS="$save_CFLAGS"
|
||||
AC_MSG_RESULT($compiler_has_option)
|
||||
if test $compiler_has_option = yes; then
|
||||
NO_STRICT_ALIASING_CFLAGS="$FLAGS"
|
||||
fi
|
||||
AC_SUBST([NO_STRICT_ALIASING_CFLAGS])
|
||||
fi
|
||||
|
||||
if test "x$have_python" != "xno" -a "x$enable_python" != "xno"; then
|
||||
enable_python=yes
|
||||
AC_DEFINE([ENABLE_PYTHON],[1],[Define to compile with python support])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([ENABLE_PYTHON],[test "x$enable_python" = "xyes"])
|
||||
|
||||
dnl This allows the bug-report script to know whether python has been enabled
|
||||
AC_SUBST(enable_python)
|
||||
|
||||
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)
|
||||
|
||||
|
@ -318,18 +203,9 @@ if test "x$enable_deprecations" = "xyes"; then
|
|||
AC_SUBST(DISABLE_DEPRECATED_CFLAGS)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([tests],
|
||||
AS_HELP_STRING([--enable-tests], [Enable the tests]),
|
||||
[enable_tests=$enableval],
|
||||
[enable_tests=yes])
|
||||
|
||||
AM_CONDITIONAL(ENABLE_TESTS, test x$enable_tests = xyes)
|
||||
|
||||
PLUGIN_LIBTOOL_FLAGS="-module -avoid-version"
|
||||
LOADER_LIBTOOL_FLAGS="-module -avoid-version"
|
||||
|
||||
AC_SUBST(PLUGIN_LIBTOOL_FLAGS)
|
||||
AC_SUBST(LOADER_LIBTOOL_FLAGS)
|
||||
|
||||
XED_PLUGINS_DATA_DIR="$datadir/xed/plugins"
|
||||
AC_SUBST(XED_PLUGINS_DATA_DIR)
|
||||
|
@ -348,17 +224,10 @@ data/org.x.editor.gschema.xml
|
|||
data/Makefile
|
||||
docs/Makefile
|
||||
docs/reference/Makefile
|
||||
xed/dialogs/Makefile
|
||||
xed/smclient/Makefile
|
||||
xed/Makefile
|
||||
help/Makefile
|
||||
pixmaps/Makefile
|
||||
plugin-loaders/Makefile
|
||||
plugin-loaders/c/Makefile
|
||||
plugin-loaders/python/Makefile
|
||||
plugin-loaders/python/bindings/Makefile
|
||||
plugins/Makefile
|
||||
plugins/changecase/Makefile
|
||||
plugins/docinfo/Makefile
|
||||
plugins/filebrowser/Makefile
|
||||
plugins/filebrowser/org.x.editor.plugins.filebrowser.gschema.xml
|
||||
|
@ -371,7 +240,6 @@ plugins/time/Makefile
|
|||
plugins/time/org.x.editor.plugins.time.gschema.xml
|
||||
plugins/trailsave/Makefile
|
||||
po/Makefile.in
|
||||
tests/Makefile
|
||||
])
|
||||
|
||||
AC_OUTPUT
|
||||
|
@ -382,8 +250,7 @@ Configuration:
|
|||
|
||||
Source code location: ${srcdir}
|
||||
Compiler: ${CC}
|
||||
Python Plugins Support: $enable_python
|
||||
Spell Plugin enabled: $enable_enchant
|
||||
Gvfs metadata enabled: $enable_gvfs_metadata
|
||||
Tests enabled: $enable_tests
|
||||
GObject Introspection: ${enable_introspection}
|
||||
"
|
||||
|
|
|
@ -4,13 +4,22 @@ 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
|
||||
|
@ -22,12 +31,14 @@ 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)
|
||||
|
|
|
@ -1,195 +1,342 @@
|
|||
<?xml version="1.0"?>
|
||||
<schemalist gettext-domain="@GETTEXT_PACKAGE@">
|
||||
<schema id="org.x.editor" path="/org/x/editor/">
|
||||
<schemalist>
|
||||
<enum id="org.x.editor.WrapMode">
|
||||
<value nick="none" value="0"/>
|
||||
<value nick="char" value="1"/>
|
||||
<value nick="word" value="2"/>
|
||||
<value nick="word-char" value="3"/>
|
||||
</enum>
|
||||
|
||||
<enum id="org.x.editor.SmartHomeEnd">
|
||||
<value nick="disabled" value="0"/>
|
||||
<value nick="before" value="1"/>
|
||||
<value nick="after" value="2"/>
|
||||
<value nick="always" value="3"/>
|
||||
</enum>
|
||||
|
||||
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org.x.editor" path="/org/x/editor/">
|
||||
<child name="preferences" schema="org.x.editor.preferences"/>
|
||||
<child name="state" schema="org.x.editor.state"/>
|
||||
<child name="plugins" schema="org.x.editor.plugins"/>
|
||||
</schema>
|
||||
|
||||
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org.x.editor.preferences" path="/org/x/editor/preferences/">
|
||||
<child name="editor" schema="org.x.editor.preferences.editor"/>
|
||||
<child name="ui" schema="org.x.editor.preferences.ui"/>
|
||||
<child name="print" schema="org.x.editor.preferences.print"/>
|
||||
<child name="encodings" schema="org.x.editor.preferences.encodings"/>
|
||||
</schema>
|
||||
|
||||
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org.x.editor.preferences.editor" path="/org/x/editor/preferences/editor/">
|
||||
|
||||
<key name="use-default-font" type="b">
|
||||
<default>true</default>
|
||||
<summary>Use Default Font</summary>
|
||||
<description>Whether to use the system's default fixed width font for editing text instead of a font specific to xed. If this option is turned off, then the font named in the "Editor Font" option will be used instead of the system font.</description>
|
||||
</key>
|
||||
|
||||
<key name="editor-font" type="s">
|
||||
<default context="editor-font" l10n="messages">'Monospace 12'</default>
|
||||
<summary>Editor Font</summary>
|
||||
<description>A custom font that will be used for the editing area. This will only take effect if the "Use Default Font" option is turned off.</description>
|
||||
</key>
|
||||
<key name="color-scheme" type="s">
|
||||
|
||||
<key name="prefer-dark-theme" type="b">
|
||||
<default>false</default>
|
||||
<summary>Prefer Dark Theme</summary>
|
||||
<description>Whether xed should prefer the dark variation of the current Gtk theme if available.</description>
|
||||
</key>
|
||||
|
||||
<key name="scheme" type="s">
|
||||
<default>'tango'</default>
|
||||
<summary>Style Scheme</summary>
|
||||
<description>The ID of a GtkSourceView Style Scheme used to color the text.</description>
|
||||
</key>
|
||||
|
||||
<key name="create-backup-copy" type="b">
|
||||
<default>false</default>
|
||||
<summary>Create Backup Copies</summary>
|
||||
<description>Whether xed should create backup copies for the files it saves. You can set the backup file extension with the "Backup Copy Extension" option.</description>
|
||||
</key>
|
||||
|
||||
<key name="auto-save" type="b">
|
||||
<default>false</default>
|
||||
<summary>Autosave</summary>
|
||||
<description>Whether xed should automatically save modified files after a time interval. You can set the time interval with the "Autosave Interval" option.</description>
|
||||
</key>
|
||||
<key name="auto-save-interval" type="i">
|
||||
|
||||
<key name="auto-save-interval" type="u">
|
||||
<default>10</default>
|
||||
<summary>Autosave Interval</summary>
|
||||
<description>Number of minutes after which xed will automatically save modified files. This will only take effect if the "Autosave" option is turned on.</description>
|
||||
</key>
|
||||
|
||||
<key name="writable-vfs-schemes" type="as">
|
||||
<default>[ 'dav', 'davs', 'ftp', 'sftp', 'smb', 'ssh' ]</default>
|
||||
<summary>Writable VFS schemes</summary>
|
||||
<description>List of VFS schemes xed supports in write mode. The 'file' scheme is writable by default.</description>
|
||||
</key>
|
||||
|
||||
<key name="max-undo-actions" type="i">
|
||||
<default>2000</default>
|
||||
<summary>Maximum Number of Undo Actions</summary>
|
||||
<description>Maximum number of actions that xed will be able to undo or redo. Use "-1" for unlimited number of actions.</description>
|
||||
</key>
|
||||
<key name="wrap-mode" type="s">
|
||||
<default>'GTK_WRAP_WORD'</default>
|
||||
|
||||
<key name="wrap-mode" enum="org.x.editor.WrapMode">
|
||||
<default>'word'</default>
|
||||
<summary>Line Wrapping Mode</summary>
|
||||
<description>Specifies how to wrap long lines in the editing area. Use "GTK_WRAP_NONE" for no wrapping, "GTK_WRAP_WORD" for wrapping at word boundaries, and "GTK_WRAP_CHAR" for wrapping at individual character boundaries. Note that the values are case-sensitive, so make sure they appear exactly as mentioned here.</description>
|
||||
<description>Specifies how to wrap long lines in the editing area. Use "none" for no wrapping, "word" for wrapping at word boundaries, and "char" for wrapping at individual character boundaries. Note that the values are case-sensitive, so make sure they appear exactly as mentioned here.</description>
|
||||
</key>
|
||||
<key name="tabs-size" type="i">
|
||||
|
||||
<key name="tabs-size" type="u">
|
||||
<default>4</default>
|
||||
<summary>Tab Size</summary>
|
||||
<description>Specifies the number of spaces that should be displayed instead of Tab characters.</description>
|
||||
</key>
|
||||
|
||||
<key name="insert-spaces" type="b">
|
||||
<default>true</default>
|
||||
<summary>Insert spaces</summary>
|
||||
<description>Whether xed should insert spaces instead of tabs.</description>
|
||||
</key>
|
||||
|
||||
<key name="auto-indent" type="b">
|
||||
<default>false</default>
|
||||
<summary>Automatic indent</summary>
|
||||
<description>Whether xed should enable automatic indentation.</description>
|
||||
</key>
|
||||
|
||||
<key name="display-line-numbers" type="b">
|
||||
<default>false</default>
|
||||
<summary>Display Line Numbers</summary>
|
||||
<description>Whether xed should display line numbers in the editing area.</description>
|
||||
</key>
|
||||
|
||||
<key name="highlight-current-line" type="b">
|
||||
<default>false</default>
|
||||
<summary>Highlight Current Line</summary>
|
||||
<description>Whether xed should highlight the current line.</description>
|
||||
</key>
|
||||
|
||||
<key name="bracket-matching" type="b">
|
||||
<default>false</default>
|
||||
<summary>Highlight Matching Bracket</summary>
|
||||
<description>Whether xed should highlight the bracket matching the selected one.</description>
|
||||
</key>
|
||||
|
||||
<key name="display-right-margin" type="b">
|
||||
<default>false</default>
|
||||
<summary>Display Right Margin</summary>
|
||||
<description>Whether xed should display the right margin in the editing area.</description>
|
||||
</key>
|
||||
<key name="right-margin-position" type="i">
|
||||
|
||||
<key name="right-margin-position" type="u">
|
||||
<default>120</default>
|
||||
<summary>Right Margin Position</summary>
|
||||
<description>Specifies the position of the right margin.</description>
|
||||
</key>
|
||||
<key name="smart-home-end" type="s">
|
||||
|
||||
<key name="smart-home-end" enum="org.x.editor.SmartHomeEnd">
|
||||
<default>'after'</default>
|
||||
<summary>Smart Home End</summary>
|
||||
<description>Specifies how the cursor moves when the HOME and END keys are pressed. Use "DISABLED" to always move at the start/end of the line, "AFTER" to move to the start/end of the line the first time the keys are pressed and to the start/end of the text ignoring whitespaces the second time the keys are pressed, "BEFORE" to move to the start/end of the text before moving to the start/end of the line and "ALWAYS" to always move to the start/end of the text instead of the start/end of the line.</description>
|
||||
<description>Specifies how the cursor moves when the HOME and END keys are pressed. Use "disabled" to always move at the start/end of the line, "after" to move to the start/end of the line the first time the keys are pressed and to the start/end of the text ignoring whitespaces the second time the keys are pressed, "before" to move to the start/end of the text before moving to the start/end of the line and "always" to always move to the start/end of the text instead of the start/end of the line.</description>
|
||||
</key>
|
||||
|
||||
<key name="restore-cursor-position" type="b">
|
||||
<default>true</default>
|
||||
<summary>Restore Previous Cursor Position</summary>
|
||||
<description>Whether xed should restore the previous cursor position when a file is loaded.</description>
|
||||
</key>
|
||||
<key name="enable-search-highlighting" type="b">
|
||||
|
||||
<key name="search-highlighting" type="b">
|
||||
<default>true</default>
|
||||
<summary>Enable Search Highlighting</summary>
|
||||
<description>Whether xed should highlight all the occurrences of the searched text.</description>
|
||||
</key>
|
||||
<key name="enable-syntax-highlighting" type="b">
|
||||
|
||||
<key name="syntax-highlighting" type="b">
|
||||
<default>true</default>
|
||||
<summary>Enable Syntax Highlighting</summary>
|
||||
<description>Whether xed should enable syntax highlighting.</description>
|
||||
</key>
|
||||
|
||||
<key name="ensure-trailing-newline" type="b">
|
||||
<default>true</default>
|
||||
<summary>Ensure Trailing Newline</summary>
|
||||
<description>Whether gedit will ensure that documents always end with a trailing newline.</description>
|
||||
</key>
|
||||
|
||||
</schema>
|
||||
|
||||
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org.x.editor.preferences.ui" path="/org/x/editor/preferences/ui/">
|
||||
|
||||
<key name="toolbar-visible" type="b">
|
||||
<default>true</default>
|
||||
<summary>Toolbar is Visible</summary>
|
||||
<description>Whether the toolbar should be visible in editing windows.</description>
|
||||
</key>
|
||||
|
||||
<key name="statusbar-visible" type="b">
|
||||
<default>true</default>
|
||||
<summary>Status Bar is Visible</summary>
|
||||
<description>Whether the status bar at the bottom of editing windows should be visible.</description>
|
||||
</key>
|
||||
<key name="side-pane-visible" type="b">
|
||||
|
||||
<key name="side-panel-visible" type="b">
|
||||
<default>false</default>
|
||||
<summary>Side Pane is Visible</summary>
|
||||
<description>Whether the side pane at the left of editing windows should be visible.</description>
|
||||
</key>
|
||||
|
||||
<key name="bottom-panel-visible" type="b">
|
||||
<default>false</default>
|
||||
<summary>Bottom Panel is Visible</summary>
|
||||
<description>Whether the bottom panel at the bottom of editing windows should be visible.</description>
|
||||
</key>
|
||||
<key name="max-recents" type="i">
|
||||
|
||||
<key name="enable-tab-scrolling" type="b">
|
||||
<default>true</default>
|
||||
<summary>Allow changing active tabs by scrolling</summary>
|
||||
<description>Whether you can change active tabs by scrolling.</description>
|
||||
</key>
|
||||
|
||||
<key name="max-recents" type="u">
|
||||
<default>5</default>
|
||||
<summary>Maximum Recent Files</summary>
|
||||
<description>Specifies the maximum number of recently opened files that will be displayed in the "Recent Files" submenu.</description>
|
||||
</key>
|
||||
|
||||
</schema>
|
||||
|
||||
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org.x.editor.preferences.print" path="/org/x/editor/preferences/print/">
|
||||
|
||||
<key name="print-syntax-highlighting" type="b">
|
||||
<default>true</default>
|
||||
<summary>Print Syntax Highlighting</summary>
|
||||
<description>Whether xed should print syntax highlighting when printing documents.</description>
|
||||
</key>
|
||||
|
||||
<key name="print-header" type="b">
|
||||
<default>true</default>
|
||||
<summary>Print Header</summary>
|
||||
<description>Whether xed should include a document header when printing documents.</description>
|
||||
</key>
|
||||
<key name="print-wrap-mode" type="s">
|
||||
<default>'GTK_WRAP_WORD'</default>
|
||||
|
||||
<key name="print-wrap-mode" enum="org.x.editor.WrapMode">
|
||||
<default>'word'</default>
|
||||
<summary>Printing Line Wrapping Mode</summary>
|
||||
<description>Specifies how to wrap long lines for printing. Use "GTK_WRAP_NONE" for no wrapping, "GTK_WRAP_WORD" for wrapping at word boundaries, and "GTK_WRAP_CHAR" for wrapping at individual character boundaries. Note that the values are case-sensitive, so make sure they appear exactly as mentioned here.</description>
|
||||
<description>Specifies how to wrap long lines for printing. Use "none" for no wrapping, "word" for wrapping at word boundaries, and "char" for wrapping at individual character boundaries. Note that the values are case-sensitive, so make sure they appear exactly as mentioned here.</description>
|
||||
</key>
|
||||
<key name="print-line-numbers" type="i">
|
||||
|
||||
<key name="print-line-numbers" type="u">
|
||||
<default>0</default>
|
||||
<summary>Print Line Numbers</summary>
|
||||
<description>If this value is 0, then no line numbers will be inserted when printing a document. Otherwise, xed will print line numbers every such number of lines.</description>
|
||||
</key>
|
||||
|
||||
<key name="print-font-body-pango" type="s">
|
||||
<default context="print-font-body-pango" l10n="messages">'Monospace 9'</default>
|
||||
<summary>Body Font for Printing</summary>
|
||||
<description>Specifies the font to use for a document's body when printing documents.</description>
|
||||
</key>
|
||||
|
||||
<key name="print-font-header-pango" type="s">
|
||||
<default context="print-font-header-pango" l10n="messages">'Sans 11'</default>
|
||||
<summary>Header Font for Printing</summary>
|
||||
<description>Specifies the font to use for page headers when printing a document. This will only take effect if the "Print Header" option is turned on.</description>
|
||||
</key>
|
||||
|
||||
<key name="print-font-numbers-pango" type="s">
|
||||
<default context="print-font-numbers-pango" l10n="messages">'Sans 8'</default>
|
||||
<summary>Line Number Font for Printing</summary>
|
||||
<description>Specifies the font to use for line numbers when printing. This will only take effect if the "Print Line Numbers" option is non-zero.</description>
|
||||
</key>
|
||||
<key name="auto-detected-encodings" type="as">
|
||||
|
||||
</schema>
|
||||
|
||||
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org.x.editor.preferences.encodings" path="/org/x/editor/preferences/encodings/">
|
||||
|
||||
<key name="auto-detected" type="as">
|
||||
<default context="auto-detected" l10n="messages">[ 'UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16' ]</default>
|
||||
<summary>Automatically Detected Encodings</summary>
|
||||
<description>Sorted list of encodings used by xed for automatically detecting the encoding of a file. "CURRENT" represents the current locale encoding. Only recognized encodings are used.</description>
|
||||
</key>
|
||||
<key name="shown-in-menu-encodings" type="as">
|
||||
|
||||
<key name="shown-in-menu" type="as">
|
||||
<default context="shown-in-menu" l10n="messages">[ 'ISO-8859-15' ]</default>
|
||||
<summary>Encodings shown in menu</summary>
|
||||
<description>List of encodings shown in the Character Encoding menu in open/save file selector. Only recognized encodings are used.</description>
|
||||
</key>
|
||||
|
||||
</schema>
|
||||
|
||||
<schema id="org.x.editor.state" path="/org/x/editor/state/">
|
||||
<child name="window" schema="org.x.editor.state.window"/>
|
||||
<child name="file-filter" schema="org.x.editor.state.file-filter"/>
|
||||
<child name="history-entry" schema="org.x.editor.state.history-entry"/>
|
||||
</schema>
|
||||
|
||||
<schema id="org.x.editor.state.window" path="/org/x/editor/state/window/">
|
||||
|
||||
<key name="state" type="i">
|
||||
<default>0</default>
|
||||
</key>
|
||||
|
||||
<key name="size" type="(ii)">
|
||||
<default>(650,500)</default>
|
||||
</key>
|
||||
|
||||
<key name="side-panel-size" type="i">
|
||||
<default>200</default>
|
||||
</key>
|
||||
|
||||
<key name="side-panel-active-page" type="i">
|
||||
<default>0</default>
|
||||
</key>
|
||||
|
||||
<key name="bottom-panel-size" type="i">
|
||||
<default>140</default>
|
||||
</key>
|
||||
|
||||
<key name="bottom-panel-active-page" type="i">
|
||||
<default>0</default>
|
||||
</key>
|
||||
|
||||
</schema>
|
||||
|
||||
<schema id="org.x.editor.state.file-filter" path="/org/x/editor/state/file-filter/">
|
||||
|
||||
<key name="filter-id" type="i">
|
||||
<default>0</default>
|
||||
</key>
|
||||
|
||||
</schema>
|
||||
|
||||
<schema id="org.x.editor.state.history-entry" path="/org/x/editor/state/history-entry/">
|
||||
|
||||
<key name="history-search-for" type="as">
|
||||
<default>[]</default>
|
||||
<summary>History for "search for" entries</summary>
|
||||
<description>List of entries in "search for" textbox.</description>
|
||||
</key>
|
||||
|
||||
<key name="history-replace-with" type="as">
|
||||
<default>[]</default>
|
||||
<summary>History for "replace with" entries</summary>
|
||||
<description>List of entries in "replace with" textbox.</description>
|
||||
</key>
|
||||
|
||||
</schema>
|
||||
|
||||
<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>
|
||||
<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>
|
||||
|
||||
</schema>
|
||||
|
||||
</schemalist>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
[D-BUS Service]
|
||||
Name=org.x.editor
|
||||
Exec=@bindir@/xed
|
|
@ -1,10 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
ENABLE_PYTHON=@enable_python@
|
||||
|
||||
PKG_CONFIG_MODULES="glib-2.0 gtk+-2.0 gtksourceview-2.0 \
|
||||
pygobject-2.0 pygtk-2.0 \
|
||||
pygtksourceview-2.0 enchant iso-codes"
|
||||
PKG_CONFIG_MODULES="glib-2.0 gtk+-3.0 gtksourceview-3.0 enchant iso-codes"
|
||||
|
||||
echo_padded ()
|
||||
{
|
||||
|
@ -53,21 +49,3 @@ else
|
|||
echo " pkg-config unavailable"
|
||||
fi
|
||||
echo
|
||||
|
||||
echo "Python module versions:"
|
||||
if test "$ENABLE_PYTHON" = "yes"
|
||||
then
|
||||
echo_padded "python"
|
||||
python -V 2>&1 | cut -c8-
|
||||
|
||||
echo_padded "pygtk"
|
||||
python -c "import gtk, sys; \
|
||||
sys.stdout.write('%d.%d.%d ' % gtk.pygtk_version); \
|
||||
sys.stdout.write('(GTK+ %d.%d.%d)' % gtk.gtk_version)" \
|
||||
2>/dev/null
|
||||
echo
|
||||
else
|
||||
echo " Python support was not enabled at compile time."
|
||||
fi
|
||||
echo
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ pluginsdir=@libdir@/xed/plugins
|
|||
|
||||
Name: xed
|
||||
Description: xed
|
||||
Requires: gtksourceview-@GTK_API_VERSION@
|
||||
Requires: gtksourceview-3.0 libpeas-1.0 libpeas-gtk-1.0
|
||||
Version: @VERSION@
|
||||
Cflags: -I${includedir}/xed
|
||||
Libs: -L${libdir}
|
||||
|
|
|
@ -4,13 +4,16 @@ Priority: optional
|
|||
Maintainer: Linux Mint <root@linuxmint.com>
|
||||
Build-Depends: autotools-dev,
|
||||
debhelper (>= 9),
|
||||
gobject-introspection,
|
||||
gtk-doc-tools,
|
||||
intltool,
|
||||
iso-codes,
|
||||
libenchant-dev,
|
||||
libgirepository1.0-dev,
|
||||
libglib2.0-dev,
|
||||
libgtk-3-dev,
|
||||
libgtksourceview-3.0-dev,
|
||||
libpeas-dev,
|
||||
libsm-dev,
|
||||
libx11-dev,
|
||||
libxml2-dev,
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
DHFLAGS=--parallel
|
||||
|
||||
%:
|
||||
dh $@ $(DHFLAGS)
|
||||
dh $@ $(DHFLAGS) --with gir
|
||||
|
||||
override_dh_install:
|
||||
rm -rfv debian/tmp/usr/lib/*/xed/plugin-loaders/*.la
|
||||
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:
|
||||
|
@ -16,9 +16,7 @@ override_dh_auto_configure:
|
|||
dh_auto_configure $(DHFLAGS) -- \
|
||||
--disable-silent-rules \
|
||||
--libexecdir=/usr/lib/ \
|
||||
--disable-python \
|
||||
--enable-gtk-doc \
|
||||
--with-gtk=3.0
|
||||
--enable-gtk-doc
|
||||
|
||||
override_dh_installchangelogs:
|
||||
dh_installchangelogs NEWS
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
usr/share/appdata/
|
||||
usr/share/glib-2.0/
|
||||
usr/share/help/
|
||||
usr/share/locale/
|
||||
usr/share/xed/icons/
|
||||
usr/share/xed/plugins/
|
||||
usr/share/xed/ui/
|
||||
usr/share/appdata
|
||||
usr/share/xed/plugins
|
||||
usr/share/glib-2.0
|
||||
usr/share/help
|
||||
usr/share/locale
|
||||
usr/share/xed/icons
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
usr/include/xed/
|
||||
usr/include
|
||||
usr/lib/*/pkgconfig/
|
||||
usr/share/xed/gir-1.0
|
||||
|
|
|
@ -1 +1 @@
|
|||
usr/share/gtk-doc/
|
||||
usr/share/gtk-doc
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
usr/bin/
|
||||
usr/lib/*/xed/plugin-loaders/*.so
|
||||
usr/lib/*/xed/plugins/
|
||||
usr/bin/xed
|
||||
usr/lib/*/xed/girepository-1.0/
|
||||
usr/lib/xed/xed-bugreport.sh
|
||||
usr/share/applications/
|
||||
usr/lib/*/xed/plugins/*.plugin
|
||||
usr/lib/*/xed/plugins/*.so
|
||||
usr/lib/*/xed/*.so
|
||||
usr/share/applications/xed.desktop
|
||||
usr/share/dbus-1/
|
||||
usr/share/man/
|
||||
|
|
|
@ -21,7 +21,7 @@ SCANGOBJ_OPTIONS=
|
|||
|
||||
# Extra options to supply to gtkdoc-scan.
|
||||
# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
|
||||
SCAN_OPTIONS=
|
||||
SCAN_OPTIONS = --rebuild-types
|
||||
|
||||
# Extra options to supply to gtkdoc-mkdb.
|
||||
MKDB_OPTIONS=--sgml-mode --output-format=xml
|
||||
|
@ -41,15 +41,10 @@ CFILE_GLOB=$(top_srcdir)/xed/*.c
|
|||
# Header files to ignore when scanning (These are internal to xed).
|
||||
IGNORE_HFILES= \
|
||||
xed-commands.h \
|
||||
xed-document-loader.h \
|
||||
xed-document-saver.h \
|
||||
xed-documents-panel.h \
|
||||
xed-io-error-message-area.h \
|
||||
xed-io-error-info-bar.h \
|
||||
xed-languages-manager.h \
|
||||
xed-object-module.h \
|
||||
xed-plugin-manager.h \
|
||||
xed-plugins-engine.h \
|
||||
xed-prefs-manager-private.h \
|
||||
xed-session.h \
|
||||
xed-ui.h \
|
||||
xed-window-private.h \
|
||||
|
@ -67,7 +62,6 @@ IGNORE_HFILES= \
|
|||
# Do not parse them to make the docs.
|
||||
IGNORE_HFILES += \
|
||||
bacon-message-connection.h \
|
||||
xedtextregion.h \
|
||||
sexy-icon-entry.h
|
||||
|
||||
# Images to copy into HTML directory.
|
||||
|
@ -96,15 +90,7 @@ GTKDOC_LIBS= \
|
|||
$(top_builddir)/xed/libxed.la \
|
||||
$(XED_LIBS)
|
||||
|
||||
if ENABLE_PYTHON
|
||||
GTKDOC_CFLAGS += \
|
||||
$(NO_STRICT_ALIASING_CFLAGS) \
|
||||
$(PYGTK_CFLAGS) \
|
||||
$(PYTHON_CFLAGS) \
|
||||
$(AM_CFLAGS)
|
||||
GTKDOC_LIBS += \
|
||||
$(top_builddir)/plugin-loaders/python/bindings/xed.la
|
||||
endif
|
||||
MAINTAINERCLEANFILES = xed.types
|
||||
|
||||
# This includes the standard gtk-doc make rules, copied by gtkdocize.
|
||||
include $(top_srcdir)/gtk-doc.make
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<chapter>
|
||||
<title>xed</title>
|
||||
<xi:include href="xml/xed-app.xml"/>
|
||||
<xi:include href="xml/xed-app-activatable.xml"/>
|
||||
<xi:include href="xml/xed-document.xml"/>
|
||||
<xi:include href="xml/xed-encodings-option-menu.xml"/>
|
||||
<xi:include href="xml/xed-file-chooser-dialog.xml"/>
|
||||
|
@ -17,21 +18,18 @@
|
|||
<xi:include href="xml/xed-message.xml"/>
|
||||
<xi:include href="xml/xed-notebook.xml"/>
|
||||
<xi:include href="xml/xed-panel.xml"/>
|
||||
<xi:include href="xml/xed-plugin.xml"/>
|
||||
<xi:include href="xml/xed-print-job-preview.xml"/>
|
||||
<xi:include href="xml/xed-print.xml"/>
|
||||
<xi:include href="xml/xed-print-job.xml"/>
|
||||
<xi:include href="xml/xed-progress-message-area.xml"/>
|
||||
<xi:include href="xml/xed-statusbar.xml"/>
|
||||
<xi:include href="xml/xed-tab.xml"/>
|
||||
<xi:include href="xml/xed-view.xml"/>
|
||||
<xi:include href="xml/xed-view-activatable.xml"/>
|
||||
<xi:include href="xml/xed-window.xml"/>
|
||||
<xi:include href="xml/xed-convert.xml"/>
|
||||
<xi:include href="xml/xed-debug.xml"/>
|
||||
<xi:include href="xml/xed-encodings.xml"/>
|
||||
<xi:include href="xml/xed-help.xml"/>
|
||||
<xi:include href="xml/xed-metadata-manager.xml"/>
|
||||
<xi:include href="xml/xed-prefs-manager-app.xml"/>
|
||||
<xi:include href="xml/xed-prefs-manager.xml"/>
|
||||
<xi:include href="xml/xed-utils.xml"/>
|
||||
</chapter>
|
||||
</book>
|
||||
|
|
|
@ -19,45 +19,39 @@ XED_IS_APP_CLASS
|
|||
XED_APP_GET_CLASS
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>xed-app-activatable</FILE>
|
||||
<TITLE>XedAppActivatable</TITLE>
|
||||
XedAppActivatable
|
||||
xed_app_activatable_activate
|
||||
xed_app_activatable_deactivate
|
||||
<SUBSECTION Standard>
|
||||
XED_TYPE_APP_ACTIVATABLE
|
||||
XED_APP_ACTIVATABLE
|
||||
XED_APP_ACTIVATABLE_IFACE
|
||||
XED_IS_APP_ACTIVATABLE
|
||||
XED_APP_ACTIVATABLE_GET_IFACE
|
||||
xed_app_activatable_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>xed-document</FILE>
|
||||
XedSearchFlags
|
||||
XedDocumentPrivate
|
||||
<TITLE>XedDocument</TITLE>
|
||||
XedDocument
|
||||
XedDocumentSaveFlags
|
||||
XED_DOCUMENT_ERROR
|
||||
xed_document_error_quark
|
||||
xed_document_new
|
||||
xed_document_get_uri
|
||||
xed_document_get_file
|
||||
xed_document_get_location
|
||||
xed_document_get_uri_for_display
|
||||
xed_document_get_short_name_for_display
|
||||
xed_document_get_mime_type
|
||||
xed_document_get_readonly
|
||||
xed_document_load
|
||||
xed_document_insert_file
|
||||
xed_document_load_cancel
|
||||
xed_document_save
|
||||
xed_document_save_as
|
||||
xed_document_is_untouched
|
||||
xed_document_is_untitled
|
||||
xed_document_get_deleted
|
||||
xed_document_goto_line
|
||||
xed_document_set_search_text
|
||||
xed_document_get_search_text
|
||||
xed_document_get_can_search_again
|
||||
xed_document_search_forward
|
||||
xed_document_search_backward
|
||||
xed_document_replace_all
|
||||
xed_document_set_language
|
||||
xed_document_set_enable_search_highlighting
|
||||
xed_document_get_enable_search_highlighting
|
||||
XED_SEARCH_IS_DONT_SET_FLAGS
|
||||
XED_SEARCH_SET_DONT_SET_FLAGS
|
||||
XED_SEARCH_IS_ENTIRE_WORD
|
||||
XED_SEARCH_SET_ENTIRE_WORD
|
||||
XED_SEARCH_IS_CASE_SENSITIVE
|
||||
XED_SEARCH_SET_CASE_SENSITIVE
|
||||
<SUBSECTION Standard>
|
||||
XED_DOCUMENT
|
||||
XED_IS_DOCUMENT
|
||||
|
@ -236,30 +230,6 @@ XED_IS_PANEL_CLASS
|
|||
XED_PANEL_GET_CLASS
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>xed-plugin</FILE>
|
||||
<TITLE>XedPlugin</TITLE>
|
||||
XedPlugin
|
||||
xed_plugin_activate
|
||||
xed_plugin_deactivate
|
||||
xed_plugin_update_ui
|
||||
xed_plugin_is_configurable
|
||||
xed_plugin_create_configure_dialog
|
||||
XED_PLUGIN_REGISTER_TYPE
|
||||
<SUBSECTION Standard>
|
||||
XED_PLUGIN
|
||||
XED_IS_PLUGIN
|
||||
XED_TYPE_PLUGIN
|
||||
xed_plugin_get_type
|
||||
XED_PLUGIN_CLASS
|
||||
XED_IS_PLUGIN_CLASS
|
||||
XED_PLUGIN_GET_CLASS
|
||||
XED_PLUGIN_REGISTER_TYPE_WITH_CODE
|
||||
XED_PLUGIN_REGISTER_TYPE
|
||||
XED_PLUGIN_DEFINE_TYPE_WITH_CODE
|
||||
XED_PLUGIN_DEFINE_TYPE
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>xed-print-job-preview</FILE>
|
||||
XedPrintJobPreviewPrivate
|
||||
|
@ -277,7 +247,7 @@ XED_PRINT_JOB_PREVIEW_GET_CLASS
|
|||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>xed-print</FILE>
|
||||
<FILE>xed-print-job</FILE>
|
||||
<TITLE>XedPrintJob</TITLE>
|
||||
XedPrintJob
|
||||
xed_print_job_new
|
||||
|
@ -299,7 +269,7 @@ XedProgressMessageAreaPrivate
|
|||
<TITLE>XedProgressMessageArea</TITLE>
|
||||
XedProgressMessageArea
|
||||
xed_progress_message_area_new
|
||||
xed_progress_message_area_set_stock_image
|
||||
xed_progress_message_area_set_image
|
||||
xed_progress_message_area_set_markup
|
||||
xed_progress_message_area_set_text
|
||||
xed_progress_message_area_set_fraction
|
||||
|
@ -384,6 +354,22 @@ XED_IS_VIEW_CLASS
|
|||
XED_VIEW_GET_CLASS
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>xed-view-activatable</FILE>
|
||||
<TITLE>XedViewActivatable</TITLE>
|
||||
XedViewActivatable
|
||||
xed_view_activatable_activate
|
||||
xed_view_activatable_deactivate
|
||||
xed_view_activatable_update_state
|
||||
<SUBSECTION Standard>
|
||||
XED_TYPE_VIEW_ACTIVATABLE
|
||||
XED_VIEW_ACTIVATABLE
|
||||
XED_VIEW_ACTIVATABLE_IFACE
|
||||
XED_IS_VIEW_ACTIVATABLE
|
||||
XED_VIEW_ACTIVATABLE_GET_IFACE
|
||||
xed_view_activatable_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>xed-window</FILE>
|
||||
XedWindowState
|
||||
|
@ -391,7 +377,7 @@ XedWindowPrivate
|
|||
<TITLE>XedWindow</TITLE>
|
||||
XedWindow
|
||||
xed_window_create_tab
|
||||
xed_window_create_tab_from_uri
|
||||
xed_window_create_tab_from_location
|
||||
xed_window_close_tab
|
||||
xed_window_close_all_tabs
|
||||
xed_window_close_tabs
|
||||
|
@ -409,7 +395,6 @@ xed_window_get_statusbar
|
|||
xed_window_get_ui_manager
|
||||
xed_window_get_state
|
||||
xed_window_get_tab_from_location
|
||||
xed_window_get_tab_from_uri
|
||||
xed_window_get_message_bus
|
||||
<SUBSECTION Standard>
|
||||
XED_WINDOW
|
||||
|
@ -421,6 +406,20 @@ XED_IS_WINDOW_CLASS
|
|||
XED_WINDOW_GET_CLASS
|
||||
</SECTION>
|
||||
|
||||
<FILE>xed-window-activatable</FILE>
|
||||
<TITLE>XedWindowActivatable</TITLE>
|
||||
XedWindowActivatable
|
||||
xed_window_activatable_activate
|
||||
xed_window_activatable_deactivate
|
||||
xed_window_activatable_update_state
|
||||
<SUBSECTION Standard>
|
||||
XED_TYPE_WINDOW_ACTIVATABLE
|
||||
XED_WINDOW_ACTIVATABLE
|
||||
XED_WINDOW_ACTIVATABLE_IFACE
|
||||
XED_IS_WINDOW_ACTIVATABLE
|
||||
XED_WINDOW_ACTIVATABLE_GET_IFACE
|
||||
xed_window_activatable_get_type
|
||||
|
||||
<SECTION>
|
||||
<FILE>xed-convert</FILE>
|
||||
XedConvertError
|
||||
|
@ -453,22 +452,6 @@ xed_debug
|
|||
xed_debug_message
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>xed-encodings</FILE>
|
||||
XedEncoding
|
||||
XED_TYPE_ENCODING
|
||||
xed_encoding_get_type
|
||||
xed_encoding_copy
|
||||
xed_encoding_free
|
||||
xed_encoding_get_from_charset
|
||||
xed_encoding_get_from_index
|
||||
xed_encoding_to_string
|
||||
xed_encoding_get_name
|
||||
xed_encoding_get_charset
|
||||
xed_encoding_get_utf8
|
||||
xed_encoding_get_current
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>xed-help</FILE>
|
||||
xed_help_display
|
||||
|
@ -481,277 +464,11 @@ xed_metadata_manager_get
|
|||
xed_metadata_manager_set
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>xed-prefs-manager-app</FILE>
|
||||
xed_prefs_manager_app_init
|
||||
xed_prefs_manager_app_shutdown
|
||||
xed_prefs_manager_get_window_state
|
||||
xed_prefs_manager_set_window_state
|
||||
xed_prefs_manager_window_state_can_set
|
||||
xed_prefs_manager_get_window_size
|
||||
xed_prefs_manager_get_default_window_size
|
||||
xed_prefs_manager_set_window_size
|
||||
xed_prefs_manager_window_size_can_set
|
||||
xed_prefs_manager_get_side_panel_size
|
||||
xed_prefs_manager_get_default_side_panel_size
|
||||
xed_prefs_manager_set_side_panel_size
|
||||
xed_prefs_manager_side_panel_size_can_set
|
||||
xed_prefs_manager_get_bottom_panel_size
|
||||
xed_prefs_manager_get_default_bottom_panel_size
|
||||
xed_prefs_manager_set_bottom_panel_size
|
||||
xed_prefs_manager_bottom_panel_size_can_set
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>xed-prefs-manager</FILE>
|
||||
XED_BASE_KEY
|
||||
GPM_PREFS_DIR
|
||||
GPM_FONT_DIR
|
||||
GPM_USE_DEFAULT_FONT
|
||||
GPM_EDITOR_FONT
|
||||
GPM_COLORS_DIR
|
||||
GPM_USE_DEFAULT_COLORS
|
||||
GPM_BACKGROUND_COLOR
|
||||
GPM_TEXT_COLOR
|
||||
GPM_SELECTED_TEXT_COLOR
|
||||
GPM_SELECTION_COLOR
|
||||
GPM_SAVE_DIR
|
||||
GPM_CREATE_BACKUP_COPY
|
||||
GPM_BACKUP_COPY_EXTENSION
|
||||
GPM_AUTO_SAVE
|
||||
GPM_AUTO_SAVE_INTERVAL
|
||||
GPM_UNDO_DIR
|
||||
GPM_UNDO_ACTIONS_LIMIT
|
||||
GPM_WRAP_MODE_DIR
|
||||
GPM_WRAP_MODE
|
||||
GPM_TABS_DIR
|
||||
GPM_TABS_SIZE
|
||||
GPM_INSERT_SPACES
|
||||
GPM_AUTO_INDENT_DIR
|
||||
GPM_AUTO_INDENT
|
||||
GPM_LINE_NUMBERS_DIR
|
||||
GPM_DISPLAY_LINE_NUMBERS
|
||||
GPM_CURRENT_LINE_DIR
|
||||
GPM_HIGHLIGHT_CURRENT_LINE
|
||||
GPM_BRACKET_MATCHING_DIR
|
||||
GPM_BRACKET_MATCHING
|
||||
GPM_RIGHT_MARGIN_DIR
|
||||
GPM_DISPLAY_RIGHT_MARGIN
|
||||
GPM_RIGHT_MARGIN_POSITION
|
||||
GPM_CURSOR_POSITION_DIR
|
||||
GPM_RESTORE_CURSOR_POSITION
|
||||
GPM_SEARCH_HIGHLIGHTING_DIR
|
||||
GPM_SEARCH_HIGHLIGHTING_ENABLE
|
||||
GPM_TOOLBAR_DIR
|
||||
GPM_TOOLBAR_VISIBLE
|
||||
GPM_TOOLBAR_BUTTONS_STYLE
|
||||
GPM_STATUSBAR_DIR
|
||||
GPM_STATUSBAR_VISIBLE
|
||||
GPM_SIDE_PANE_DIR
|
||||
GPM_SIDE_PANE_VISIBLE
|
||||
GPM_BOTTOM_PANEL_DIR
|
||||
GPM_BOTTOM_PANEL_VISIBLE
|
||||
GPM_RECENTS_DIR
|
||||
GPM_MAX_RECENTS
|
||||
GPM_PRINT_PAGE_DIR
|
||||
GPM_PRINT_SYNTAX
|
||||
GPM_PRINT_HEADER
|
||||
GPM_PRINT_WRAP_MODE
|
||||
GPM_PRINT_LINE_NUMBERS
|
||||
GPM_PRINT_FONT_DIR
|
||||
GPM_PRINT_FONT_BODY
|
||||
GPM_PRINT_FONT_BODY_PANGO
|
||||
GPM_PRINT_FONT_HEADER
|
||||
GPM_PRINT_FONT_HEADER_PANGO
|
||||
GPM_PRINT_FONT_NUMBERS
|
||||
GPM_PRINT_FONT_NUMBERS_PANGO
|
||||
GPM_WINDOW_DIR
|
||||
GPM_WINDOW_STATE
|
||||
GPM_WINDOW_WIDTH
|
||||
GPM_WINDOW_HEIGHT
|
||||
GPM_SIDE_PANEL_SIZE
|
||||
GPM_BOTTOM_PANEL_SIZE
|
||||
GPM_ENCODINGS_DIR
|
||||
GPM_AUTO_DETECTED_ENCODINGS
|
||||
GPM_SHOWN_IN_MENU_ENCODINGS
|
||||
GPM_SYNTAX_HL_DIR
|
||||
GPM_SYNTAX_HL_ENABLE
|
||||
GPM_WRITABLE_VFS_SCHEMES
|
||||
GPM_DEFAULT_USE_DEFAULT_FONT
|
||||
GPM_DEFAULT_EDITOR_FONT
|
||||
GPM_DEFAULT_USE_DEFAULT_COLORS
|
||||
GPM_DEFAULT_BACKGROUND_COLOR
|
||||
GPM_DEFAULT_TEXT_COLOR
|
||||
GPM_DEFAULT_SELECTED_TEXT_COLOR
|
||||
GPM_DEFAULT_SELECTION_COLOR
|
||||
GPM_DEFAULT_CREATE_BACKUP_COPY
|
||||
GPM_DEFAULT_BACKUP_COPY_EXTENSION
|
||||
GPM_DEFAULT_AUTO_SAVE
|
||||
GPM_DEFAULT_AUTO_SAVE_INTERVAL
|
||||
GPM_DEFAULT_UNDO_ACTIONS_LIMIT
|
||||
GPM_DEFAULT_WRAP_MODE
|
||||
GPM_DEFAULT_TABS_SIZE
|
||||
GPM_DEFAULT_INSERT_SPACES
|
||||
GPM_DEFAULT_AUTO_INDENT
|
||||
GPM_DEFAULT_DISPLAY_LINE_NUMBERS
|
||||
GPM_DEFAULT_AUTO_DETECTED_ENCODINGS
|
||||
GPM_DEFAULT_TOOLBAR_VISIBLE
|
||||
GPM_DEFAULT_TOOLBAR_BUTTONS_STYLE
|
||||
GPM_DEFAULT_TOOLBAR_SHOW_TOOLTIPS
|
||||
GPM_DEFAULT_STATUSBAR_VISIBLE
|
||||
GPM_DEFAULT_SIDE_PANE_VISIBLE
|
||||
GPM_DEFAULT_BOTTOM_PANEL_VISIBLE
|
||||
GPM_DEFAULT_PRINT_SYNTAX
|
||||
GPM_DEFAULT_PRINT_HEADER
|
||||
GPM_DEFAULT_PRINT_WRAP_MODE
|
||||
GPM_DEFAULT_PRINT_LINE_NUMBERS
|
||||
GPM_DEFAULT_PRINT_FONT_BODY_PANGO
|
||||
GPM_DEFAULT_PRINT_FONT_HEADER_PANGO
|
||||
GPM_DEFAULT_PRINT_FONT_NUMBERS_PANGO
|
||||
GPM_DEFAULT_MAX_RECENTS
|
||||
GPM_DEFAULT_WINDOW_STATE
|
||||
GPM_DEFAULT_WINDOW_WIDTH
|
||||
GPM_DEFAULT_WINDOW_HEIGHT
|
||||
GPM_DEFAULT_WINDOW_STATE_STR
|
||||
GPM_DEFAULT_WINDOW_WIDTH_STR
|
||||
GPM_DEFAULT_WINDOW_HEIGHT_STR
|
||||
GPM_DEFAULT_SIDE_PANEL_SIZE
|
||||
GPM_DEFAULT_BOTTOM_PANEL_SIZE
|
||||
GPM_DEFAULT_SIDE_PANEL_SIZE_STR
|
||||
GPM_DEFAULT_BOTTOM_PANEL_SIZE_STR
|
||||
GPM_DEFAULT_HIGHLIGHT_CURRENT_LINE
|
||||
GPM_DEFAULT_BRACKET_MATCHING
|
||||
GPM_DEFAULT_DISPLAY_RIGHT_MARGIN
|
||||
GPM_DEFAULT_RIGHT_MARGIN_POSITION
|
||||
GPM_DEFAULT_SYNTAX_HL_ENABLE
|
||||
GPM_DEFAULT_WRITABLE_VFS_SCHEMES
|
||||
GPM_DEFAULT_RESTORE_CURSOR_POSITION
|
||||
GPM_DEFAULT_SEARCH_HIGHLIGHTING_ENABLE
|
||||
XedToolbarSetting
|
||||
xed_prefs_manager_init
|
||||
xed_prefs_manager_shutdown
|
||||
xed_prefs_manager_get_use_default_font
|
||||
xed_prefs_manager_set_use_default_font
|
||||
xed_prefs_manager_use_default_font_can_set
|
||||
xed_prefs_manager_get_editor_font
|
||||
xed_prefs_manager_set_editor_font
|
||||
xed_prefs_manager_editor_font_can_set
|
||||
xed_prefs_manager_get_use_default_colors
|
||||
xed_prefs_manager_set_use_default_colors
|
||||
xed_prefs_manager_use_default_colors_can_set
|
||||
xed_prefs_manager_get_background_color
|
||||
xed_prefs_manager_set_background_color
|
||||
xed_prefs_manager_background_color_can_set
|
||||
xed_prefs_manager_get_text_color
|
||||
xed_prefs_manager_set_text_color
|
||||
xed_prefs_manager_text_color_can_set
|
||||
xed_prefs_manager_get_selection_color
|
||||
xed_prefs_manager_set_selection_color
|
||||
xed_prefs_manager_selection_color_can_set
|
||||
xed_prefs_manager_get_selected_text_color
|
||||
xed_prefs_manager_set_selected_text_color
|
||||
xed_prefs_manager_selected_text_color_can_set
|
||||
xed_prefs_manager_get_create_backup_copy
|
||||
xed_prefs_manager_set_create_backup_copy
|
||||
xed_prefs_manager_create_backup_copy_can_set
|
||||
xed_prefs_manager_get_backup_extension
|
||||
xed_prefs_manager_get_auto_save
|
||||
xed_prefs_manager_set_auto_save
|
||||
xed_prefs_manager_auto_save_can_set
|
||||
xed_prefs_manager_get_auto_save_interval
|
||||
xed_prefs_manager_set_auto_save_interval
|
||||
xed_prefs_manager_auto_save_interval_can_set
|
||||
xed_prefs_manager_get_undo_actions_limit
|
||||
xed_prefs_manager_set_undo_actions_limit
|
||||
xed_prefs_manager_undo_actions_limit_can_set
|
||||
xed_prefs_manager_get_wrap_mode
|
||||
xed_prefs_manager_set_wrap_mode
|
||||
xed_prefs_manager_wrap_mode_can_set
|
||||
xed_prefs_manager_get_tabs_size
|
||||
xed_prefs_manager_set_tabs_size
|
||||
xed_prefs_manager_tabs_size_can_set
|
||||
xed_prefs_manager_get_insert_spaces
|
||||
xed_prefs_manager_set_insert_spaces
|
||||
xed_prefs_manager_insert_spaces_can_set
|
||||
xed_prefs_manager_get_auto_indent
|
||||
xed_prefs_manager_set_auto_indent
|
||||
xed_prefs_manager_auto_indent_can_set
|
||||
xed_prefs_manager_get_display_line_numbers
|
||||
xed_prefs_manager_set_display_line_numbers
|
||||
xed_prefs_manager_display_line_numbers_can_set
|
||||
xed_prefs_manager_get_toolbar_visible
|
||||
xed_prefs_manager_set_toolbar_visible
|
||||
xed_prefs_manager_toolbar_visible_can_set
|
||||
xed_prefs_manager_get_toolbar_buttons_style
|
||||
xed_prefs_manager_set_toolbar_buttons_style
|
||||
xed_prefs_manager_toolbar_buttons_style_can_set
|
||||
xed_prefs_manager_get_statusbar_visible
|
||||
xed_prefs_manager_set_statusbar_visible
|
||||
xed_prefs_manager_statusbar_visible_can_set
|
||||
xed_prefs_manager_get_side_pane_visible
|
||||
xed_prefs_manager_set_side_pane_visible
|
||||
xed_prefs_manager_side_pane_visible_can_set
|
||||
xed_prefs_manager_get_bottom_panel_visible
|
||||
xed_prefs_manager_set_bottom_panel_visible
|
||||
xed_prefs_manager_bottom_panel_visible_can_set
|
||||
xed_prefs_manager_get_print_syntax_hl
|
||||
xed_prefs_manager_set_print_syntax_hl
|
||||
xed_prefs_manager_print_syntax_hl_can_set
|
||||
xed_prefs_manager_get_print_header
|
||||
xed_prefs_manager_set_print_header
|
||||
xed_prefs_manager_print_header_can_set
|
||||
xed_prefs_manager_get_print_wrap_mode
|
||||
xed_prefs_manager_set_print_wrap_mode
|
||||
xed_prefs_manager_print_wrap_mode_can_set
|
||||
xed_prefs_manager_get_print_line_numbers
|
||||
xed_prefs_manager_set_print_line_numbers
|
||||
xed_prefs_manager_print_line_numbers_can_set
|
||||
xed_prefs_manager_get_print_font_body
|
||||
xed_prefs_manager_set_print_font_body
|
||||
xed_prefs_manager_print_font_body_can_set
|
||||
xed_prefs_manager_get_default_print_font_body
|
||||
xed_prefs_manager_get_print_font_header
|
||||
xed_prefs_manager_set_print_font_header
|
||||
xed_prefs_manager_print_font_header_can_set
|
||||
xed_prefs_manager_get_default_print_font_header
|
||||
xed_prefs_manager_get_print_font_numbers
|
||||
xed_prefs_manager_set_print_font_numbers
|
||||
xed_prefs_manager_print_font_numbers_can_set
|
||||
xed_prefs_manager_get_default_print_font_numbers
|
||||
xed_prefs_manager_get_max_recents
|
||||
xed_prefs_manager_get_auto_detected_encodings
|
||||
xed_prefs_manager_get_shown_in_menu_encodings
|
||||
xed_prefs_manager_set_shown_in_menu_encodings
|
||||
xed_prefs_manager_shown_in_menu_encodings_can_set
|
||||
xed_prefs_manager_get_highlight_current_line
|
||||
xed_prefs_manager_set_highlight_current_line
|
||||
xed_prefs_manager_highlight_current_line_can_set
|
||||
xed_prefs_manager_get_bracket_matching
|
||||
xed_prefs_manager_set_bracket_matching
|
||||
xed_prefs_manager_bracket_matching_can_set
|
||||
xed_prefs_manager_get_display_right_margin
|
||||
xed_prefs_manager_set_display_right_margin
|
||||
xed_prefs_manager_display_right_margin_can_set
|
||||
xed_prefs_manager_get_right_margin_position
|
||||
xed_prefs_manager_set_right_margin_position
|
||||
xed_prefs_manager_right_margin_position_can_set
|
||||
xed_prefs_manager_get_enable_syntax_highlighting
|
||||
xed_prefs_manager_set_enable_syntax_highlighting
|
||||
xed_prefs_manager_enable_syntax_highlighting_can_set
|
||||
xed_prefs_manager_get_writable_vfs_schemes
|
||||
xed_prefs_manager_get_restore_cursor_position
|
||||
xed_prefs_manager_get_enable_search_highlighting
|
||||
xed_prefs_manager_set_enable_search_highlighting
|
||||
xed_prefs_manager_enable_search_highlighting_can_set
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>xed-utils</FILE>
|
||||
GBOOLEAN_TO_POINTER
|
||||
GPOINTER_TO_BOOLEAN
|
||||
IS_VALID_BOOLEAN
|
||||
xed_utils_uri_has_writable_scheme
|
||||
xed_utils_uri_has_file_scheme
|
||||
xed_utils_menu_position_under_widget
|
||||
xed_utils_menu_position_under_tree_view
|
||||
xed_gtk_button_new_with_stock_icon
|
||||
|
@ -763,8 +480,6 @@ g_utf8_caselessnmatch
|
|||
xed_utils_set_atk_name_description
|
||||
xed_utils_set_atk_relation
|
||||
xed_utils_uri_exists
|
||||
xed_utils_escape_search_text
|
||||
xed_utils_unescape_search_text
|
||||
xed_utils_get_stdin
|
||||
xed_warning
|
||||
xed_utils_make_valid_utf8
|
||||
|
|
|
@ -1,32 +1,26 @@
|
|||
#include "xed-app.h"
|
||||
#include "xed-document.h"
|
||||
#include "xed-encodings.h"
|
||||
#include "xed-encodings-combo-box.h"
|
||||
#include "xed-file-chooser-dialog.h"
|
||||
#include "xed-message.h"
|
||||
#include "xed-message-bus.h"
|
||||
#include "xed-message-type.h"
|
||||
#include "xed-notebook.h"
|
||||
#include "xed-panel.h"
|
||||
#include "xed-plugin.h"
|
||||
#include "xed-progress-message-area.h"
|
||||
#include "xed-statusbar.h"
|
||||
#include "xed-tab.h"
|
||||
#include "xed-view.h"
|
||||
#include "xed-window.h"
|
||||
xed_app_activatable_get_type
|
||||
xed_app_get_type
|
||||
xed_close_button_get_type
|
||||
xed_document_get_type
|
||||
xed_encoding_get_type
|
||||
xed_encodings_combo_box_get_type
|
||||
xed_file_chooser_dialog_get_type
|
||||
xed_message_get_type
|
||||
xed_history_entry_get_type
|
||||
xed_message_bus_get_type
|
||||
xed_message_get_type
|
||||
xed_message_type_get_type
|
||||
xed_notebook_get_type
|
||||
xed_panel_get_type
|
||||
xed_plugin_get_type
|
||||
xed_print_job_get_type
|
||||
xed_print_preview_get_type
|
||||
xed_progress_message_area_get_type
|
||||
xed_searchbar_get_type
|
||||
xed_settings_get_type
|
||||
xed_status_combo_box_get_type
|
||||
xed_statusbar_get_type
|
||||
xed_tab_get_type
|
||||
xed_tab_label_get_type
|
||||
xed_view_activatable_get_type
|
||||
xed_view_frame_get_type
|
||||
xed_view_get_type
|
||||
xed_window_activatable_get_type
|
||||
xed_window_get_type
|
||||
|
|
62
m4/python.m4
62
m4/python.m4
|
@ -1,62 +0,0 @@
|
|||
## this one is commonly used with AM_PATH_PYTHONDIR ...
|
||||
dnl AM_CHECK_PYMOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]])
|
||||
dnl Check if a module containing a given symbol is visible to python.
|
||||
AC_DEFUN([AM_CHECK_PYMOD],
|
||||
[AC_REQUIRE([AM_PATH_PYTHON])
|
||||
py_mod_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
|
||||
AC_MSG_CHECKING(for ifelse([$2],[],,[$2 in ])python module $1)
|
||||
AC_CACHE_VAL(py_cv_mod_$py_mod_var, [
|
||||
ifelse([$2],[], [prog="
|
||||
import sys
|
||||
try:
|
||||
import $1
|
||||
except ImportError:
|
||||
sys.exit(1)
|
||||
except:
|
||||
sys.exit(0)
|
||||
sys.exit(0)"], [prog="
|
||||
import $1
|
||||
$1.$2"])
|
||||
if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
|
||||
then
|
||||
eval "py_cv_mod_$py_mod_var=yes"
|
||||
else
|
||||
eval "py_cv_mod_$py_mod_var=no"
|
||||
fi
|
||||
])
|
||||
py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"`
|
||||
if test "x$py_val" != xno; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$3], [],, [$3
|
||||
])dnl
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
ifelse([$4], [],, [$4
|
||||
])dnl
|
||||
fi
|
||||
])
|
||||
|
||||
dnl a macro to check for ability to create python extensions
|
||||
dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
|
||||
dnl function also defines PYTHON_INCLUDES
|
||||
AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
|
||||
[AC_REQUIRE([AM_PATH_PYTHON])
|
||||
AC_MSG_CHECKING(for headers required to compile python extensions)
|
||||
dnl deduce PYTHON_INCLUDES
|
||||
py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
|
||||
py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
|
||||
PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
|
||||
if test "$py_prefix" != "$py_exec_prefix"; then
|
||||
PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
|
||||
fi
|
||||
AC_SUBST(PYTHON_INCLUDES)
|
||||
dnl check if the headers exist:
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
|
||||
AC_TRY_CPP([#include <Python.h>],dnl
|
||||
[AC_MSG_RESULT(found)
|
||||
$1],dnl
|
||||
[AC_MSG_RESULT(not found)
|
||||
$2])
|
||||
CPPFLAGS="$save_CPPFLAGS"
|
||||
])
|
|
@ -1,7 +0,0 @@
|
|||
SUBDIRS = c
|
||||
|
||||
if ENABLE_PYTHON
|
||||
SUBDIRS += python
|
||||
endif
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
|
@ -1,24 +0,0 @@
|
|||
# C plugin loader
|
||||
|
||||
loaderdir = $(libdir)/xed/plugin-loaders
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
$(XED_CFLAGS) \
|
||||
$(WARN_CFLAGS) \
|
||||
$(DISABLE_DEPRECATED_CFLAGS) \
|
||||
-DXED_LOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
|
||||
|
||||
loader_LTLIBRARIES = libcloader.la
|
||||
|
||||
NOINST_H_FILES = \
|
||||
xed-plugin-loader-c.h
|
||||
|
||||
libcloader_la_SOURCES = \
|
||||
xed-plugin-loader-c.c \
|
||||
$(NOINST_H_FILES)
|
||||
|
||||
libcloader_la_LDFLAGS = $(LOADER_LIBTOOL_FLAGS)
|
||||
libcloader_la_LIBADD = $(XED_LIBS)
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
|
@ -1,182 +0,0 @@
|
|||
/*
|
||||
* xed-plugin-loader-c.c
|
||||
* This file is part of xed
|
||||
*
|
||||
* Copyright (C) 2008 - 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 "xed-plugin-loader-c.h"
|
||||
#include <xed/xed-object-module.h>
|
||||
|
||||
#define XED_PLUGIN_LOADER_C_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), XED_TYPE_PLUGIN_LOADER_C, XedPluginLoaderCPrivate))
|
||||
|
||||
struct _XedPluginLoaderCPrivate
|
||||
{
|
||||
GHashTable *loaded_plugins;
|
||||
};
|
||||
|
||||
static void xed_plugin_loader_iface_init (gpointer g_iface, gpointer iface_data);
|
||||
|
||||
XED_PLUGIN_LOADER_REGISTER_TYPE (XedPluginLoaderC, xed_plugin_loader_c, G_TYPE_OBJECT, xed_plugin_loader_iface_init);
|
||||
|
||||
|
||||
static const gchar *
|
||||
xed_plugin_loader_iface_get_id (void)
|
||||
{
|
||||
return "C";
|
||||
}
|
||||
|
||||
static XedPlugin *
|
||||
xed_plugin_loader_iface_load (XedPluginLoader *loader,
|
||||
XedPluginInfo *info,
|
||||
const gchar *path)
|
||||
{
|
||||
XedPluginLoaderC *cloader = XED_PLUGIN_LOADER_C (loader);
|
||||
XedObjectModule *module;
|
||||
const gchar *module_name;
|
||||
XedPlugin *result;
|
||||
|
||||
module = (XedObjectModule *)g_hash_table_lookup (cloader->priv->loaded_plugins, info);
|
||||
module_name = xed_plugin_info_get_module_name (info);
|
||||
|
||||
if (module == NULL)
|
||||
{
|
||||
/* For now we force all modules to be resident */
|
||||
module = xed_object_module_new (module_name,
|
||||
path,
|
||||
"register_xed_plugin",
|
||||
TRUE);
|
||||
|
||||
/* Infos are available for all the lifetime of the loader.
|
||||
* If this changes, we should use weak refs or something */
|
||||
|
||||
g_hash_table_insert (cloader->priv->loaded_plugins, info, module);
|
||||
}
|
||||
|
||||
if (!g_type_module_use (G_TYPE_MODULE (module)))
|
||||
{
|
||||
g_warning ("Could not load plugin module: %s", xed_plugin_info_get_name (info));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* TODO: for now we force data-dir-name = module-name... if needed we can
|
||||
* add a datadir field to the plugin descriptor file.
|
||||
*/
|
||||
result = (XedPlugin *)xed_object_module_new_object (module,
|
||||
"install-dir", path,
|
||||
"data-dir-name", module_name,
|
||||
NULL);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
g_warning ("Could not create plugin object: %s", xed_plugin_info_get_name (info));
|
||||
g_type_module_unuse (G_TYPE_MODULE (module));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_type_module_unuse (G_TYPE_MODULE (module));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
xed_plugin_loader_iface_unload (XedPluginLoader *loader,
|
||||
XedPluginInfo *info)
|
||||
{
|
||||
//XedPluginLoaderC *cloader = XED_PLUGIN_LOADER_C (loader);
|
||||
|
||||
/* this is a no-op, since the type module will be properly unused as
|
||||
the last reference to the plugin dies. When the plugin is activated
|
||||
again, the library will be reloaded */
|
||||
}
|
||||
|
||||
static void
|
||||
xed_plugin_loader_iface_init (gpointer g_iface,
|
||||
gpointer iface_data)
|
||||
{
|
||||
XedPluginLoaderInterface *iface = (XedPluginLoaderInterface *)g_iface;
|
||||
|
||||
iface->get_id = xed_plugin_loader_iface_get_id;
|
||||
iface->load = xed_plugin_loader_iface_load;
|
||||
iface->unload = xed_plugin_loader_iface_unload;
|
||||
}
|
||||
|
||||
static void
|
||||
xed_plugin_loader_c_finalize (GObject *object)
|
||||
{
|
||||
XedPluginLoaderC *cloader = XED_PLUGIN_LOADER_C (object);
|
||||
GList *infos;
|
||||
GList *item;
|
||||
|
||||
/* FIXME: this sanity check it's not efficient. Let's remove it
|
||||
* once we are confident with the code */
|
||||
|
||||
infos = g_hash_table_get_keys (cloader->priv->loaded_plugins);
|
||||
|
||||
for (item = infos; item; item = item->next)
|
||||
{
|
||||
XedPluginInfo *info = (XedPluginInfo *)item->data;
|
||||
|
||||
if (xed_plugin_info_is_active (info))
|
||||
{
|
||||
g_warning ("There are still C plugins loaded during destruction");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free (infos);
|
||||
|
||||
g_hash_table_destroy (cloader->priv->loaded_plugins);
|
||||
|
||||
G_OBJECT_CLASS (xed_plugin_loader_c_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_plugin_loader_c_class_init (XedPluginLoaderCClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = xed_plugin_loader_c_finalize;
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedPluginLoaderCPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
xed_plugin_loader_c_class_finalize (XedPluginLoaderCClass *klass)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
xed_plugin_loader_c_init (XedPluginLoaderC *self)
|
||||
{
|
||||
self->priv = XED_PLUGIN_LOADER_C_GET_PRIVATE (self);
|
||||
|
||||
/* loaded_plugins maps XedPluginInfo to a XedObjectModule */
|
||||
self->priv->loaded_plugins = g_hash_table_new (g_direct_hash,
|
||||
g_direct_equal);
|
||||
}
|
||||
|
||||
XedPluginLoaderC *
|
||||
xed_plugin_loader_c_new ()
|
||||
{
|
||||
GObject *loader = g_object_new (XED_TYPE_PLUGIN_LOADER_C, NULL);
|
||||
|
||||
return XED_PLUGIN_LOADER_C (loader);
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* xed-plugin-loader-c.h
|
||||
* This file is part of xed
|
||||
*
|
||||
* Copyright (C) 2008 - 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_PLUGIN_LOADER_C_H__
|
||||
#define __XED_PLUGIN_LOADER_C_H__
|
||||
|
||||
#include <xed/xed-plugin-loader.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define XED_TYPE_PLUGIN_LOADER_C (xed_plugin_loader_c_get_type ())
|
||||
#define XED_PLUGIN_LOADER_C(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XED_TYPE_PLUGIN_LOADER_C, XedPluginLoaderC))
|
||||
#define XED_PLUGIN_LOADER_C_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XED_TYPE_PLUGIN_LOADER_C, XedPluginLoaderC const))
|
||||
#define XED_PLUGIN_LOADER_C_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XED_TYPE_PLUGIN_LOADER_C, XedPluginLoaderCClass))
|
||||
#define XED_IS_PLUGIN_LOADER_C(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XED_TYPE_PLUGIN_LOADER_C))
|
||||
#define XED_IS_PLUGIN_LOADER_C_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XED_TYPE_PLUGIN_LOADER_C))
|
||||
#define XED_PLUGIN_LOADER_C_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XED_TYPE_PLUGIN_LOADER_C, XedPluginLoaderCClass))
|
||||
|
||||
typedef struct _XedPluginLoaderC XedPluginLoaderC;
|
||||
typedef struct _XedPluginLoaderCClass XedPluginLoaderCClass;
|
||||
typedef struct _XedPluginLoaderCPrivate XedPluginLoaderCPrivate;
|
||||
|
||||
struct _XedPluginLoaderC {
|
||||
GObject parent;
|
||||
|
||||
XedPluginLoaderCPrivate *priv;
|
||||
};
|
||||
|
||||
struct _XedPluginLoaderCClass {
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
GType xed_plugin_loader_c_get_type (void) G_GNUC_CONST;
|
||||
XedPluginLoaderC *xed_plugin_loader_c_new(void);
|
||||
|
||||
/* All the loaders must implement this function */
|
||||
G_MODULE_EXPORT GType register_xed_plugin_loader (GTypeModule * module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __XED_PLUGIN_LOADER_C_H__ */
|
|
@ -1,36 +0,0 @@
|
|||
# C plugin loader
|
||||
|
||||
SUBDIRS = bindings
|
||||
loaderdir = $(libdir)/xed/plugin-loaders
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_builddir) \
|
||||
-I$(top_srcdir)/xed \
|
||||
-I$(top_builddir)/xed \
|
||||
$(XED_CFLAGS) \
|
||||
$(WARN_CFLAGS) \
|
||||
$(DISABLE_DEPRECATED_CFLAGS) \
|
||||
$(PYGTK_CFLAGS) \
|
||||
$(PYTHON_CFLAGS) \
|
||||
-DXED_PLUGINS_LIBS_DIR=\"$(XED_PLUGINS_LIBS_DIR)\" \
|
||||
-DXED_LOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
|
||||
|
||||
loader_LTLIBRARIES = libpythonloader.la
|
||||
|
||||
|
||||
NOINST_H_FILES = \
|
||||
xed-plugin-loader-python.h \
|
||||
xed-plugin-python.h
|
||||
|
||||
libpythonloader_la_SOURCES = \
|
||||
xed-plugin-loader-python.c \
|
||||
xed-plugin-python.c \
|
||||
$(NOINST_H_FILES)
|
||||
|
||||
libpythonloader_la_LDFLAGS = $(LOADER_LIBTOOL_FLAGS)
|
||||
libpythonloader_la_LIBADD = \
|
||||
$(XED_LIBS) \
|
||||
bindings/xed.la
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
|
@ -1,115 +0,0 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
noinst_LTLIBRARIES = \
|
||||
xed.la
|
||||
|
||||
nodist_xed_la_SOURCES = \
|
||||
xed.c \
|
||||
xedutils.c \
|
||||
xedcommands.c
|
||||
|
||||
xed_la_LDFLAGS = \
|
||||
-module -avoid-version
|
||||
|
||||
xed_la_LIBADD = \
|
||||
$(PYTHON_LIB_LOC) \
|
||||
$(PYTHON_LIBS) \
|
||||
$(PYTHON_EXTRA_LIBS) \
|
||||
$(PYGTK_LIBS)
|
||||
|
||||
xed_la_CFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_builddir) \
|
||||
-I$(top_srcdir)/xed \
|
||||
-I$(top_builddir)/xed \
|
||||
-I$(top_srcdir)/plugin-loaders/python \
|
||||
-I$(top_builddir)/plugin-loaders/python \
|
||||
$(XED_CFLAGS) \
|
||||
$(NO_STRICT_ALIASING_CFLAGS) \
|
||||
$(PYGTK_CFLAGS) \
|
||||
$(PYTHON_CFLAGS) \
|
||||
$(AM_CFLAGS)
|
||||
|
||||
$(top_builddir)/xed/xed-enum-types.h:
|
||||
cd $(top_builddir)/xed && $(MAKE) xed-enum-types.h
|
||||
|
||||
xed.c: xed.defs xed.override xedplugin.override xedmessage.override $(top_builddir)/xed/xed-enum-types.h
|
||||
( cd $(srcdir) && $(PYGTK_CODEGEN) \
|
||||
--register $(PYGTK_DEFSDIR)/pango-types.defs \
|
||||
--register $(PYGTK_DEFSDIR)/gdk-types.defs \
|
||||
--register $(PYGTK_DEFSDIR)/gtk-types.defs \
|
||||
--register $(PYGTK_DEFSDIR)/gtksourceview2.defs \
|
||||
--register $(PYGOBJECT_DEFSDIR)/gio-types.defs \
|
||||
--override $*.override \
|
||||
--prefix py$* $(<F) ) > $@
|
||||
|
||||
xedutils.c: xedutils.defs xedutils.override
|
||||
( cd $(srcdir) && $(PYGTK_CODEGEN) \
|
||||
--override $*.override \
|
||||
--prefix py$* $(<F) ) > $@
|
||||
|
||||
xedcommands.c: xedcommands.defs xedcommands.override xed.defs
|
||||
( cd $(srcdir) && $(PYGTK_CODEGEN) \
|
||||
--register xed.defs \
|
||||
--register $(PYGTK_DEFSDIR)/gtk-types.defs \
|
||||
--override $*.override \
|
||||
--prefix py$* $(<F) ) > $@
|
||||
|
||||
BINDING_XED_HEADERS_SRCDIR_IN = \
|
||||
xed/xed-app.h \
|
||||
xed/xed-document.h \
|
||||
xed/xed-encodings.h \
|
||||
xed/xed-plugin.h \
|
||||
plugin-loaders/python/xed-plugin-python.h \
|
||||
xed/xed-view.h \
|
||||
xed/xed-statusbar.h \
|
||||
xed/xed-tab.h \
|
||||
xed/xed-panel.h \
|
||||
xed/xed-window.h \
|
||||
xed/xed-help.h \
|
||||
xed/xed-debug.h \
|
||||
xed/xed-message-type.h \
|
||||
xed/xed-message.h \
|
||||
xed/xed-message-bus.h \
|
||||
xed/xed-language-manager.h
|
||||
|
||||
BINDING_UTILS_HEADERS_SRCDIR_IN = \
|
||||
xed/xed-utils.h
|
||||
|
||||
BINDING_COMMANDS_HEADERS_SRCDIR_IN = \
|
||||
xed/xed-commands.h
|
||||
|
||||
BINDING_HEADERS_BUILDDIR_IN =
|
||||
|
||||
BINDING_XED_HEADERS_SRCDIR := $(addprefix $(top_srcdir)/,$(BINDING_XED_HEADERS_SRCDIR_IN))
|
||||
BINDING_UTILS_HEADERS_SRCDIR := $(addprefix $(top_srcdir)/,$(BINDING_UTILS_HEADERS_SRCDIR_IN))
|
||||
BINDING_COMMANDS_HEADERS_SRCDIR := $(addprefix $(top_srcdir)/,$(BINDING_COMMANDS_HEADERS_SRCDIR_IN))
|
||||
|
||||
BINDING_HEADERS_BUILDDIR := $(addprefix $(top_builddir)/,$(BINDING_HEADERS_BUILDDIR_IN))
|
||||
|
||||
regenerate-python-binding:
|
||||
$(PYGTK_H2DEF) $(sort $(BINDING_XED_HEADERS_SRCDIR) $(BINDING_HEADERS_BUILDDIR)) > xed.defs.new
|
||||
$(PYGTK_H2DEF) $(sort $(BINDING_UTILS_HEADERS_SRCDIR) $(BINDING_HEADERS_BUILDDIR)) > xedutils.defs.new
|
||||
$(PYGTK_H2DEF) $(sort $(BINDING_COMMANDS_HEADERS_SRCDIR) $(BINDING_HEADERS_BUILDDIR)) > xedcommands.defs.new
|
||||
|
||||
BUILT_SOURCES = \
|
||||
xed.c \
|
||||
xedutils.c \
|
||||
xedcommands.c
|
||||
|
||||
EXTRA_DIST = \
|
||||
xed.override \
|
||||
xed.defs \
|
||||
xedutils.override \
|
||||
xedutils.defs \
|
||||
xedcommands.override \
|
||||
xedcommands.defs \
|
||||
xedmessage.override \
|
||||
xedplugin.override
|
||||
|
||||
CLEANFILES = $(BUILT_SOURCES)
|
||||
|
||||
dist-hook:
|
||||
cd $(distdir); rm -f $(BUILT_SOURCES)
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
File diff suppressed because it is too large
Load Diff
|
@ -1,461 +0,0 @@
|
|||
%%
|
||||
headers
|
||||
#include <pygobject.h>
|
||||
#include <pygtk/pygtk.h>
|
||||
|
||||
#include <xed/xed-language-manager.h>
|
||||
#include <xed/xed-plugin.h>
|
||||
#include <xed/xed-app.h>
|
||||
#include <xed/xed-encodings.h>
|
||||
#include <xed/xed-enum-types.h>
|
||||
#include <xed/xed-statusbar.h>
|
||||
#include <xed/xed-debug.h>
|
||||
#include <xed/xed-help.h>
|
||||
|
||||
#include "xed-plugin-python.h"
|
||||
|
||||
void pyxed_register_classes (PyObject *d);
|
||||
void pyxed_add_constants (PyObject *module, const gchar *strip_prefix);
|
||||
|
||||
static PyObject *
|
||||
_helper_wrap_gobject_glist (const GList *list)
|
||||
{
|
||||
PyObject *py_list;
|
||||
const GList *tmp;
|
||||
|
||||
if ((py_list = PyList_New(0)) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
for (tmp = list; tmp != NULL; tmp = tmp->next) {
|
||||
PyObject *py_obj = pygobject_new(G_OBJECT(tmp->data));
|
||||
|
||||
if (py_obj == NULL) {
|
||||
Py_DECREF(py_list);
|
||||
return NULL;
|
||||
}
|
||||
PyList_Append(py_list, py_obj);
|
||||
Py_DECREF(py_obj);
|
||||
}
|
||||
return py_list;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
_helper_wrap_gobject_gslist (const GSList *list)
|
||||
{
|
||||
PyObject *py_list;
|
||||
const GSList *tmp;
|
||||
|
||||
if ((py_list = PyList_New(0)) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
for (tmp = list; tmp != NULL; tmp = tmp->next) {
|
||||
PyObject *py_obj = pygobject_new(G_OBJECT(tmp->data));
|
||||
|
||||
if (py_obj == NULL) {
|
||||
Py_DECREF(py_list);
|
||||
return NULL;
|
||||
}
|
||||
PyList_Append(py_list, py_obj);
|
||||
Py_DECREF(py_obj);
|
||||
}
|
||||
return py_list;
|
||||
}
|
||||
%%
|
||||
include
|
||||
xedplugin.override
|
||||
xedmessage.override
|
||||
%%
|
||||
modulename xed
|
||||
%%
|
||||
import gtk.Widget as PyGtkWidget_Type
|
||||
import gobject.GObject as PyGObject_Type
|
||||
import gtk.gdk.Screen as PyGdkScreen_Type
|
||||
import gtk.VBox as PyGtkVBox_Type
|
||||
import gtk.Window as PyGtkWindow_Type
|
||||
import gtk.Image as PyGtkImage_Type
|
||||
import gtk.Statusbar as PyGtkStatusbar_Type
|
||||
import gtksourceview2.Buffer as PyGtkSourceBuffer_Type
|
||||
import gtksourceview2.View as PyGtkSourceView_Type
|
||||
import gtksourceview2.Language as PyGtkSourceLanguage_Type
|
||||
import gtksourceview2.LanguageManager as PyGtkSourceLanguageManager_Type
|
||||
%%
|
||||
ignore-glob
|
||||
*_get_type
|
||||
xed_document_error_quark
|
||||
xed_panel_add_item_with_stock_icon
|
||||
%%
|
||||
override xed_app_create_window kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_app_create_window(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { "screen", NULL};
|
||||
PyGObject *screen = NULL;
|
||||
XedWindow *ret;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
||||
"|O!", kwlist,
|
||||
&PyGdkScreen_Type, &screen))
|
||||
return NULL;
|
||||
|
||||
ret = xed_app_create_window(XED_APP(self->obj),
|
||||
screen ? GDK_SCREEN(screen->obj) : NULL);
|
||||
|
||||
/* pygobject_new handles NULL checking */
|
||||
return pygobject_new((GObject *)ret);
|
||||
}
|
||||
%%
|
||||
override xed_app_get_windows
|
||||
static PyObject *
|
||||
_wrap_xed_app_get_windows(PyGObject *self)
|
||||
{
|
||||
const GList *list;
|
||||
PyObject *py_list;
|
||||
|
||||
list = xed_app_get_windows (XED_APP (self->obj));
|
||||
|
||||
py_list = _helper_wrap_gobject_glist (list);
|
||||
|
||||
return py_list;
|
||||
}
|
||||
%%
|
||||
override xed_app_get_views
|
||||
static PyObject *
|
||||
_wrap_xed_app_get_views(PyGObject *self)
|
||||
{
|
||||
GList *list;
|
||||
PyObject *py_list;
|
||||
|
||||
list = xed_app_get_views (XED_APP (self->obj));
|
||||
|
||||
py_list = _helper_wrap_gobject_glist (list);
|
||||
|
||||
g_list_free (list);
|
||||
|
||||
return py_list;
|
||||
}
|
||||
%%
|
||||
override xed_app_get_documents
|
||||
static PyObject *
|
||||
_wrap_xed_app_get_documents(PyGObject *self)
|
||||
{
|
||||
GList *list;
|
||||
PyObject *py_list;
|
||||
|
||||
list = xed_app_get_documents (XED_APP (self->obj));
|
||||
|
||||
py_list = _helper_wrap_gobject_glist (list);
|
||||
|
||||
g_list_free (list);
|
||||
|
||||
return py_list;
|
||||
}
|
||||
%%
|
||||
override xed_window_get_documents
|
||||
static PyObject *
|
||||
_wrap_xed_window_get_documents(PyGObject *self)
|
||||
{
|
||||
GList *list;
|
||||
PyObject *py_list;
|
||||
|
||||
list = xed_window_get_documents (XED_WINDOW (self->obj));
|
||||
|
||||
py_list = _helper_wrap_gobject_glist (list);
|
||||
|
||||
g_list_free(list);
|
||||
|
||||
return py_list;
|
||||
}
|
||||
%%
|
||||
override xed_window_get_unsaved_documents
|
||||
static PyObject *
|
||||
_wrap_xed_window_get_unsaved_documents(PyGObject *self)
|
||||
{
|
||||
GList *list;
|
||||
PyObject *py_list;
|
||||
|
||||
list = xed_window_get_unsaved_documents (XED_WINDOW (self->obj));
|
||||
|
||||
py_list = _helper_wrap_gobject_glist (list);
|
||||
|
||||
g_list_free(list);
|
||||
|
||||
return py_list;
|
||||
}
|
||||
%%
|
||||
override xed_window_get_views
|
||||
static PyObject *
|
||||
_wrap_xed_window_get_views(PyGObject *self)
|
||||
{
|
||||
GList *list;
|
||||
PyObject *py_list;
|
||||
|
||||
list = xed_window_get_views (XED_WINDOW (self->obj));
|
||||
|
||||
py_list = _helper_wrap_gobject_glist (list);
|
||||
|
||||
g_list_free(list);
|
||||
|
||||
return py_list;
|
||||
}
|
||||
%%
|
||||
override xed_window_close_tabs kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_window_close_tabs (PyGObject *self,
|
||||
PyObject *args,
|
||||
PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { "tabs", NULL };
|
||||
PyObject *list, *item;
|
||||
GList *glist = NULL;
|
||||
int len, i;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords (args, kwargs,
|
||||
"O:XedWindow.close_tabs", kwlist,
|
||||
&list))
|
||||
return NULL;
|
||||
|
||||
if (!PySequence_Check (list))
|
||||
{
|
||||
PyErr_SetString (PyExc_TypeError,
|
||||
"first argument must be a sequence");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
len = PySequence_Length (list);
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
item = PySequence_GetItem (list, i);
|
||||
Py_DECREF(item);
|
||||
|
||||
if (!pygobject_check (item, &PyXedTab_Type))
|
||||
{
|
||||
PyErr_SetString (PyExc_TypeError,
|
||||
"sequence item not a Gtkwidget object");
|
||||
g_list_free (glist);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
glist = g_list_append (glist, pygobject_get (item));
|
||||
}
|
||||
|
||||
xed_window_close_tabs (XED_WINDOW (self->obj), glist);
|
||||
|
||||
g_list_free (glist);
|
||||
Py_INCREF (Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
%%
|
||||
override xed_document_get_search_text
|
||||
static PyObject *
|
||||
_wrap_xed_document_get_search_text(PyGObject *self)
|
||||
{
|
||||
PyObject *tuple, *string;
|
||||
guint flags;
|
||||
gchar *ret;
|
||||
|
||||
ret = xed_document_get_search_text (XED_DOCUMENT (self->obj), &flags);
|
||||
|
||||
tuple = PyTuple_New(2);
|
||||
if (ret) {
|
||||
string = PyString_FromString(ret);
|
||||
PyTuple_SetItem(tuple, 0, string);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
PyTuple_SetItem(tuple, 0, Py_None);
|
||||
}
|
||||
PyTuple_SetItem(tuple, 1, PyInt_FromLong(flags));
|
||||
|
||||
g_free(ret);
|
||||
|
||||
return tuple;
|
||||
}
|
||||
%%
|
||||
override xed_panel_add_item kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_panel_add_item(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist1[] = { "item", "name", "image", NULL };
|
||||
static char *kwlist2[] = { "item", "name", "stock_id", NULL };
|
||||
PyGObject *item, *image;
|
||||
char *name = NULL;
|
||||
char *stock_id = NULL;
|
||||
|
||||
if (PyArg_ParseTupleAndKeywords(args, kwargs, "O!sO!:XedPanel.add_item", kwlist1, &PyGtkWidget_Type, &item, &name, &PyGtkImage_Type, &image)) {
|
||||
xed_panel_add_item(XED_PANEL(self->obj), GTK_WIDGET(item->obj), name, GTK_WIDGET(image->obj));
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
|
||||
if (PyArg_ParseTupleAndKeywords(args, kwargs, "O!ss:XedPanel.add_item", kwlist2, &PyGtkWidget_Type, &item, &name, &stock_id)) {
|
||||
xed_panel_add_item_with_stock_icon(XED_PANEL(self->obj), GTK_WIDGET(item->obj), name, stock_id);
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
PyErr_SetString(PyExc_TypeError, "the last arg should be either a gtk.Image or a stock_id string");
|
||||
return NULL;
|
||||
}
|
||||
%%
|
||||
override xed_app_get_default_deprecated
|
||||
/* deprecated wrappers */
|
||||
static PyObject *
|
||||
_wrap_xed_app_get_default_deprecated(PyObject *self)
|
||||
{
|
||||
if (PyErr_Warn(PyExc_DeprecationWarning, "use xed.app_get_default instead") < 0)
|
||||
return NULL;
|
||||
return _wrap_xed_app_get_default(self);
|
||||
}
|
||||
%%
|
||||
override xed_encoding_get_from_charset_deprecated kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_encoding_get_from_charset_deprecated(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
if (PyErr_Warn(PyExc_DeprecationWarning, "use xed.encoding_get_from_charset instead") < 0)
|
||||
return NULL;
|
||||
return _wrap_xed_encoding_get_from_charset(self, args, kwargs);
|
||||
}
|
||||
%%
|
||||
override xed_encoding_get_from_index_deprecated kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_encoding_get_from_index_deprecated(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
if (PyErr_Warn(PyExc_DeprecationWarning, "use xed.encoding_get_from_index instead") < 0)
|
||||
return NULL;
|
||||
return _wrap_xed_encoding_get_from_index(self, args, kwargs);
|
||||
}
|
||||
%%
|
||||
override xed_encoding_get_utf8_deprecated
|
||||
static PyObject *
|
||||
_wrap_xed_encoding_get_utf8_deprecated(PyObject *self)
|
||||
{
|
||||
if (PyErr_Warn(PyExc_DeprecationWarning, "use xed.encoding_get_utf8 instead") < 0)
|
||||
return NULL;
|
||||
return _wrap_xed_encoding_get_utf8(self);
|
||||
}
|
||||
%%
|
||||
override xed_encoding_get_current_deprecated
|
||||
static PyObject *
|
||||
_wrap_xed_encoding_get_current_deprecated(PyObject *self)
|
||||
{
|
||||
if (PyErr_Warn(PyExc_DeprecationWarning, "use xed.encoding_get_current instead") < 0)
|
||||
return NULL;
|
||||
return _wrap_xed_encoding_get_current(self);
|
||||
}
|
||||
%%
|
||||
override xed_tab_get_from_document_deprecated kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_tab_get_from_document_deprecated(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
if (PyErr_Warn(PyExc_DeprecationWarning, "use xed.tab_get_from_document instead") < 0)
|
||||
return NULL;
|
||||
return _wrap_xed_tab_get_from_document(self, args, kwargs);
|
||||
}
|
||||
%%
|
||||
override xed_language_manager_list_languages_sorted kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_language_manager_list_languages_sorted(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { "lm", "include_hidden", NULL };
|
||||
PyGObject *lm;
|
||||
int include_hidden;
|
||||
PyObject *py_list;
|
||||
GSList *list;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords (args, kwargs,
|
||||
"O!i:language_manager_list_languages_sorted",
|
||||
kwlist, &PyGtkSourceLanguageManager_Type, &lm,
|
||||
&include_hidden))
|
||||
return NULL;
|
||||
|
||||
list = xed_language_manager_list_languages_sorted (GTK_SOURCE_LANGUAGE_MANAGER (lm->obj),
|
||||
include_hidden);
|
||||
|
||||
py_list = _helper_wrap_gobject_gslist (list);
|
||||
|
||||
g_slist_free (list);
|
||||
|
||||
return py_list;
|
||||
}
|
||||
%%
|
||||
override xed_debug kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_debug(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { "message", NULL };
|
||||
PyObject *traceback_module, *mdict, *func, *traceback, *tuple;
|
||||
PyObject *filename, *lineno, *funcname;
|
||||
char *message = NULL;
|
||||
|
||||
if (g_getenv ("XED_DEBUG_PLUGINS") == NULL)
|
||||
{
|
||||
Py_INCREF (Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords (args, kwargs, "|s", kwlist, &message))
|
||||
return NULL;
|
||||
|
||||
traceback_module = PyImport_ImportModule ("traceback");
|
||||
if (traceback_module == NULL)
|
||||
{
|
||||
g_warning ("traceback module cannot be imported");
|
||||
Py_INCREF (Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
mdict = PyModule_GetDict (traceback_module);
|
||||
func = PyDict_GetItemString (mdict, "extract_stack");
|
||||
traceback = PyObject_CallFunction (func, "zi", NULL, 1);
|
||||
tuple = PyList_GetItem (traceback, 0);
|
||||
|
||||
if (tuple == NULL || !PyTuple_Check (tuple))
|
||||
{
|
||||
g_warning ("traceback tuple is null!");
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = PyTuple_GetItem (tuple, 0);
|
||||
lineno = PyTuple_GetItem (tuple, 1);
|
||||
funcname = PyTuple_GetItem (tuple, 2);
|
||||
|
||||
if (message == NULL)
|
||||
xed_debug (XED_DEBUG_PLUGINS,
|
||||
PyString_AsString (filename),
|
||||
PyInt_AsLong (lineno),
|
||||
PyString_AsString (funcname));
|
||||
else
|
||||
xed_debug_message (XED_DEBUG_PLUGINS,
|
||||
PyString_AsString (filename),
|
||||
PyInt_AsLong (lineno),
|
||||
PyString_AsString (funcname),
|
||||
"%s",
|
||||
message);
|
||||
}
|
||||
Py_DECREF (traceback);
|
||||
Py_DECREF (traceback_module);
|
||||
|
||||
Py_INCREF (Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
%%
|
||||
override xed_statusbar_flash_message kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_statusbar_flash_message(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { "context_id", "message", NULL };
|
||||
int context_id;
|
||||
char *message;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs,"is:XedStatusbar.flash_message", kwlist, &context_id, &message))
|
||||
return NULL;
|
||||
|
||||
xed_statusbar_flash_message(XED_STATUSBAR(self->obj), context_id, "%s", message);
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
%%
|
|
@ -1,45 +0,0 @@
|
|||
;; -*- scheme -*-
|
||||
; object definitions ...
|
||||
;; Enumerations and flags ...
|
||||
|
||||
|
||||
;; From ../../xed/xed-commands.h
|
||||
|
||||
(define-function load_uri
|
||||
(c-name "xed_commands_load_uri")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("XedWindow*" "window")
|
||||
'("const-gchar*" "uri")
|
||||
'("const-XedEncoding*" "encoding")
|
||||
'("gint" "line_pos")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function load_uris
|
||||
(c-name "xed_commands_load_uris")
|
||||
(return-type "gint")
|
||||
(parameters
|
||||
'("XedWindow*" "window")
|
||||
'("const-GSList*" "uris")
|
||||
'("const-XedEncoding*" "encoding")
|
||||
'("gint" "line_pos")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function save_document
|
||||
(c-name "xed_commands_save_document")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("XedWindow*" "window")
|
||||
'("XedDocument*" "document")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function save_all_documents
|
||||
(c-name "xed_commands_save_all_documents")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("XedWindow*" "window")
|
||||
)
|
||||
)
|
|
@ -1,122 +0,0 @@
|
|||
%%
|
||||
headers
|
||||
#define NO_IMPORT_PYGOBJECT
|
||||
#define NO_IMPORT_PYGTK
|
||||
#include <pygobject.h>
|
||||
#include <pygtk/pygtk.h>
|
||||
|
||||
#include "xed-commands.h"
|
||||
#include "xed-window.h"
|
||||
|
||||
void pyxedcommands_register_classes (PyObject *d);
|
||||
void pyxedcommands_add_constants (PyObject *module, const gchar *strip_prefix);
|
||||
|
||||
%%
|
||||
modulename xed.commands
|
||||
%%
|
||||
import xed.Window as PyXedWindow_Type
|
||||
import xed.Document as PyXedDocument_Type
|
||||
%%
|
||||
ignore-glob
|
||||
_*
|
||||
%%
|
||||
override xed_commands_load_uri kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_commands_load_uri (PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { "window", "uri", "encoding", "line_pos", NULL };
|
||||
PyGObject *window;
|
||||
char *uri;
|
||||
int line_pos = 0;
|
||||
PyObject *py_encoding = NULL;
|
||||
XedEncoding *encoding = NULL;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords (args, kwargs, "O!s|Oi:load_uri",
|
||||
kwlist, &PyXedWindow_Type,
|
||||
&window, &uri, &py_encoding,
|
||||
&line_pos))
|
||||
return NULL;
|
||||
|
||||
if (py_encoding != NULL && py_encoding != Py_None)
|
||||
{
|
||||
if (pyg_boxed_check (py_encoding, XED_TYPE_ENCODING))
|
||||
encoding = pyg_boxed_get (py_encoding, XedEncoding);
|
||||
else
|
||||
{
|
||||
PyErr_SetString (PyExc_TypeError,
|
||||
"encoding should be a XedEncoding");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
xed_commands_load_uri (XED_WINDOW (window->obj), uri, encoding,
|
||||
line_pos);
|
||||
Py_INCREF (Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
%%
|
||||
override xed_commands_load_uris kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_commands_load_uris (PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { "window", "uris", "encoding", "line_pos", NULL };
|
||||
PyGObject *window;
|
||||
GSList *uris = NULL;
|
||||
int line_pos = 0;
|
||||
PyObject *py_encoding = NULL;
|
||||
PyObject *list;
|
||||
PyObject *item;
|
||||
XedEncoding *encoding = NULL;
|
||||
int len;
|
||||
int i;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords (args, kwargs, "O!O|Oi:load_uri",
|
||||
kwlist, &PyXedWindow_Type,
|
||||
&window, &list, &py_encoding,
|
||||
&line_pos))
|
||||
return NULL;
|
||||
|
||||
if (py_encoding != NULL && py_encoding != Py_None)
|
||||
{
|
||||
if (pyg_boxed_check (py_encoding, XED_TYPE_ENCODING))
|
||||
encoding = pyg_boxed_get (py_encoding, XedEncoding);
|
||||
else {
|
||||
PyErr_SetString (PyExc_TypeError,
|
||||
"encoding should be a XedEncoding");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!PySequence_Check (list))
|
||||
{
|
||||
PyErr_SetString (PyExc_TypeError,
|
||||
"second argument must be a sequence");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
len = PySequence_Length (list);
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
item = PySequence_GetItem (list, i);
|
||||
Py_DECREF (item);
|
||||
|
||||
if (!PyString_Check (item))
|
||||
{
|
||||
PyErr_SetString (PyExc_TypeError,
|
||||
"sequence item not a string");
|
||||
g_slist_free (uris);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uris = g_slist_prepend (uris, PyString_AsString (item));
|
||||
}
|
||||
|
||||
uris = g_slist_reverse (uris);
|
||||
xed_commands_load_uris (XED_WINDOW (window->obj), uris,
|
||||
encoding, line_pos);
|
||||
g_slist_free (uris);
|
||||
|
||||
Py_INCREF (Py_None);
|
||||
return Py_None;
|
||||
}
|
|
@ -1,556 +0,0 @@
|
|||
%%
|
||||
headers
|
||||
|
||||
#include <xed/xed-message-bus.h>
|
||||
#include <xed/xed-message.h>
|
||||
|
||||
static GType
|
||||
_helper_wrap_get_gtype_from_pytype (PyObject *pytype)
|
||||
{
|
||||
PyTypeObject *type = (PyTypeObject *)pytype;
|
||||
|
||||
if (type == &PyList_Type || type == &PyTuple_Type)
|
||||
return G_TYPE_STRV;
|
||||
|
||||
return pyg_type_from_object (pytype);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
_helper_wrap_get_string (PyObject *obj)
|
||||
{
|
||||
PyObject *str;
|
||||
gchar *result;
|
||||
|
||||
str = PyObject_Str (obj);
|
||||
|
||||
if (!str)
|
||||
return NULL;
|
||||
|
||||
result = g_strdup (PyString_AsString (str));
|
||||
Py_DECREF (str);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
_helper_wrap_list_to_gvalue (GValue *gvalue, PyObject *pyvalue)
|
||||
{
|
||||
int num;
|
||||
gchar **lst;
|
||||
gint i;
|
||||
|
||||
num = PySequence_Size (pyvalue);
|
||||
lst = g_new0 (gchar *, num + 1);
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
lst[i] = _helper_wrap_get_string (PySequence_GetItem (pyvalue, i));
|
||||
|
||||
if (lst[i] == NULL)
|
||||
{
|
||||
g_strfreev (lst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
g_value_set_boxed (gvalue, lst);
|
||||
g_strfreev (lst);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_helper_wrap_get_gvalue_from_pyobject (GValue *gvalue, PyObject *pyvalue)
|
||||
{
|
||||
if (pyvalue->ob_type == &PyList_Type || pyvalue->ob_type == &PyTuple_Type)
|
||||
return _helper_wrap_list_to_gvalue (gvalue, pyvalue);
|
||||
|
||||
return pyg_value_from_pyobject(gvalue, pyvalue);
|
||||
}
|
||||
|
||||
static int
|
||||
_helper_wrap_message_set_value(XedMessage *message, PyObject *pykey, PyObject *pyvalue)
|
||||
{
|
||||
gchar *key;
|
||||
GType gtype;
|
||||
GValue value = {0,};
|
||||
|
||||
key = _helper_wrap_get_string(pykey);
|
||||
|
||||
if (key == NULL)
|
||||
return 0;
|
||||
|
||||
gtype = xed_message_get_key_type(message, key);
|
||||
|
||||
if (gtype == 0) {
|
||||
PyErr_SetString(PyExc_TypeError, "invalid key");
|
||||
g_free (key);
|
||||
return 0;
|
||||
}
|
||||
|
||||
g_value_init(&value, gtype);
|
||||
|
||||
if (_helper_wrap_get_gvalue_from_pyobject (&value, pyvalue)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"value is of the wrong type for this key");
|
||||
g_free (key);
|
||||
return 0;
|
||||
}
|
||||
|
||||
xed_message_set_value(message, key, &value);
|
||||
g_value_unset(&value);
|
||||
g_free (key);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
typedef void (*ParsePairFunc)(PyObject *key, PyObject *value, gpointer user_data);
|
||||
|
||||
static void
|
||||
_helper_parse_pairs_dict (PyObject *dict, ParsePairFunc func, gpointer user_data)
|
||||
{
|
||||
if (!dict)
|
||||
return;
|
||||
|
||||
PyObject *key, *value;
|
||||
Py_ssize_t i = 0;
|
||||
|
||||
while (PyDict_Next(dict, &i, &key, &value))
|
||||
{
|
||||
func(key, value, user_data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_helper_parse_pairs(PyObject *args, PyObject *kwargs, ParsePairFunc func, gpointer user_data)
|
||||
{
|
||||
guint len;
|
||||
guint i;
|
||||
|
||||
len = PyTuple_Size(args);
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
{
|
||||
PyObject *d = PyTuple_GetItem(args, i);
|
||||
|
||||
if (PyDict_Check(d))
|
||||
_helper_parse_pairs_dict(d, func, user_data);
|
||||
}
|
||||
|
||||
_helper_parse_pairs_dict(kwargs, func, user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
_helper_message_set(PyObject *key, PyObject *value, XedMessage *message)
|
||||
{
|
||||
_helper_wrap_message_set_value(message, key, value);
|
||||
}
|
||||
|
||||
static void
|
||||
_helper_message_set_values(XedMessage *message, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
_helper_parse_pairs(args, kwargs, (ParsePairFunc)_helper_message_set, message);
|
||||
}
|
||||
|
||||
static XedMessage *
|
||||
_helper_wrap_create_message(XedMessageBus *bus, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
PyObject *pypath, *pymethod, *pydict;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "OO|O:XedMessage.create", &pypath, &pymethod, &pydict))
|
||||
return NULL;
|
||||
|
||||
gchar *object_path = _helper_wrap_get_string(pypath);
|
||||
gchar *method = _helper_wrap_get_string(pymethod);
|
||||
|
||||
XedMessageType *message_type = xed_message_bus_lookup (bus, object_path, method);
|
||||
XedMessage *message;
|
||||
|
||||
if (message_type)
|
||||
{
|
||||
message = xed_message_type_instantiate(message_type, NULL);
|
||||
_helper_message_set_values(message, args, kwargs);
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_StandardError, "Message type does not exist");
|
||||
message = NULL;
|
||||
}
|
||||
|
||||
g_free(object_path);
|
||||
g_free(method);
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
PyObject *func;
|
||||
PyObject *data;
|
||||
} PyXedCustomNotify;
|
||||
|
||||
static void
|
||||
pyxed_custom_destroy_notify(gpointer user_data)
|
||||
{
|
||||
PyXedCustomNotify *cunote = user_data;
|
||||
PyGILState_STATE state;
|
||||
|
||||
g_return_if_fail(user_data);
|
||||
state = pyg_gil_state_ensure();
|
||||
Py_XDECREF(cunote->func);
|
||||
Py_XDECREF(cunote->data);
|
||||
pyg_gil_state_release(state);
|
||||
|
||||
g_free(cunote);
|
||||
}
|
||||
%%
|
||||
ignore-glob
|
||||
*_get_type
|
||||
xed_message_type_foreach
|
||||
xed_message_type_instantiate_valist
|
||||
xed_message_type_new_valist
|
||||
xed_message_get_valist
|
||||
xed_message_set_valist
|
||||
xed_message_set_valuesv
|
||||
xed_message_bus_disconnect_by_func
|
||||
xed_message_bus_block_by_func
|
||||
xed_message_bus_unblock_by_func
|
||||
%%
|
||||
override xed_message_type_new kwargs
|
||||
|
||||
typedef struct
|
||||
{
|
||||
XedMessageType *message_type;
|
||||
PyObject *optional;
|
||||
} MessageTypeSetInfo;
|
||||
|
||||
static void
|
||||
_message_type_set(PyObject *key, PyObject *value, MessageTypeSetInfo *info)
|
||||
{
|
||||
GType gtype;
|
||||
|
||||
gchar *k = _helper_wrap_get_string(key);
|
||||
|
||||
if (!k)
|
||||
return;
|
||||
|
||||
gtype = _helper_wrap_get_gtype_from_pytype(value);
|
||||
|
||||
gboolean optional = info->optional && PySequence_Contains(info->optional, key);
|
||||
|
||||
xed_message_type_set(info->message_type, optional, k, gtype, NULL);
|
||||
g_free(k);
|
||||
}
|
||||
|
||||
static int
|
||||
_wrap_xed_message_type_new(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
PyObject *pypath, *pymethod, *optional = NULL, *pydict;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "OO|OO:XedMessageType.new", &pypath, &pymethod, &optional, &pydict))
|
||||
return -1;
|
||||
|
||||
XedMessageType *message_type = XED_MESSAGE_TYPE(g_object_new(pyg_type_from_object((PyObject *) self), NULL));
|
||||
|
||||
MessageTypeSetInfo info = {message_type, optional && PySequence_Check(optional) ? optional : NULL};
|
||||
_helper_parse_pairs (args, kwargs, (ParsePairFunc)_message_type_set, &info);
|
||||
|
||||
self->obj = (GObject *)message_type;
|
||||
pygobject_register_wrapper((PyObject *) self);
|
||||
|
||||
return 0;
|
||||
}
|
||||
%%
|
||||
override xed_message_type_instantiate kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_message_type_instantiate(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
XedMessageType *message_type = XED_MESSAGE_TYPE (self->obj);
|
||||
XedMessage *message = xed_message_type_instantiate(message_type, NULL);
|
||||
|
||||
_helper_message_set_values(message, args, kwargs);
|
||||
|
||||
return pygobject_new((GObject *)message);
|
||||
}
|
||||
%%
|
||||
override xed_message_get args
|
||||
static PyObject *
|
||||
_wrap_xed_message_get(PyGObject *self, PyObject *args)
|
||||
{
|
||||
guint len, i;
|
||||
PyObject *ret;
|
||||
|
||||
len = PyTuple_Size(args);
|
||||
|
||||
ret = PyTuple_New(len);
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
GValue value = { 0, };
|
||||
PyObject *py_key = PyTuple_GetItem(args, i);
|
||||
gchar *key = _helper_wrap_get_string(py_key);
|
||||
|
||||
if (!key) {
|
||||
PyErr_SetString(PyExc_TypeError, "keys must be strings");
|
||||
Py_DECREF(ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xed_message_get_value (XED_MESSAGE (self->obj), key, &value);
|
||||
g_free (key);
|
||||
|
||||
PyTuple_SetItem(ret, i, pyg_value_as_pyobject(&value, TRUE));
|
||||
g_value_unset(&value);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
%%
|
||||
override xed_message_get_value kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_message_get_value(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { "key", NULL };
|
||||
const gchar *key;
|
||||
PyObject *ret;
|
||||
GValue value = { 0, };
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:XedMessage.get_value", kwlist, &key))
|
||||
return NULL;
|
||||
|
||||
xed_message_get_value(XED_MESSAGE(self->obj), key, &value);
|
||||
ret = pyg_value_as_pyobject(&value, TRUE);
|
||||
g_value_unset(&value);
|
||||
|
||||
return ret;
|
||||
}
|
||||
%%
|
||||
override xed_message_set_value kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_message_set_value(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { "key", "value", NULL };
|
||||
PyObject *pykey, *pyvalue;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:XedMessage.set_value", kwlist, &pykey, &pyvalue))
|
||||
return NULL;
|
||||
|
||||
if (!_helper_wrap_message_set_value(XED_MESSAGE(self->obj), pykey, pyvalue))
|
||||
return NULL;
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
%%
|
||||
override xed_message_set kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_message_set (PyGObject *self, PyObject *args, PyObject *kwargs) {
|
||||
_helper_message_set_values(XED_MESSAGE(self->obj), args, kwargs);
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
%%
|
||||
override xed_message_bus_new
|
||||
static int
|
||||
_wrap_xed_message_bus_new(PyGObject *self)
|
||||
{
|
||||
pygobject_construct (self, NULL);
|
||||
|
||||
if (!self->obj) {
|
||||
PyErr_SetString (PyExc_RuntimeError, "could not create xed.MessageBus object");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
%%
|
||||
new-constructor XED_TYPE_MESSAGE_BUS
|
||||
%%
|
||||
override xed_message_bus_register kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_message_bus_register(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
PyObject *pypath, *pymethod, *optional = NULL, *pydict;
|
||||
XedMessageBus *bus = XED_MESSAGE_BUS(self->obj);
|
||||
|
||||
if (!PyArg_ParseTuple(args, "OO|OO:XedMessageBus.register", &pypath, &pymethod, &optional, &pydict))
|
||||
return NULL;
|
||||
|
||||
gchar *object_path = _helper_wrap_get_string(pypath);
|
||||
gchar *method = _helper_wrap_get_string(pymethod);
|
||||
|
||||
XedMessageType *message_type = xed_message_bus_register(bus, object_path, method, 0, NULL);
|
||||
|
||||
g_free(object_path);
|
||||
g_free(method);
|
||||
|
||||
if (!message_type)
|
||||
{
|
||||
PyErr_SetString(PyExc_StandardError, "Message type already exists");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MessageTypeSetInfo info = {message_type, optional && PySequence_Check(optional) ? optional : NULL};
|
||||
_helper_parse_pairs (args, kwargs, (ParsePairFunc)_message_type_set, &info);
|
||||
|
||||
return pyg_boxed_new(XED_TYPE_MESSAGE_TYPE, message_type, TRUE, TRUE);
|
||||
}
|
||||
%%
|
||||
override xed_message_bus_connect kwargs
|
||||
static void
|
||||
pyxed_message_bus_connect_cb(XedMessageBus *bus, XedMessage *message, gpointer data)
|
||||
{
|
||||
PyGILState_STATE state;
|
||||
PyXedCustomNotify *cunote = data;
|
||||
PyObject *pybus, *pymessage, *retobj;
|
||||
|
||||
g_assert(cunote->func);
|
||||
|
||||
state = pyg_gil_state_ensure();
|
||||
|
||||
pybus = pygobject_new((GObject *)bus);
|
||||
pymessage = pygobject_new((GObject *)message);
|
||||
|
||||
if (cunote->data) {
|
||||
retobj = PyEval_CallFunction(cunote->func, "(NNO)", pybus, pymessage, cunote->data);
|
||||
} else {
|
||||
retobj = PyEval_CallFunction(cunote->func, "(NN)", pybus, pymessage);
|
||||
}
|
||||
|
||||
if (PyErr_Occurred()) {
|
||||
PyErr_Print();
|
||||
}
|
||||
|
||||
Py_XDECREF(retobj);
|
||||
|
||||
pyg_gil_state_release(state);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
_wrap_xed_message_bus_connect(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { "domain", "name", "func", "data", NULL };
|
||||
PyObject *pyfunc, *pyarg = NULL;
|
||||
const gchar *domain;
|
||||
const gchar *name;
|
||||
PyXedCustomNotify *cunote;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
||||
"ssO|O:XedMessageBus.connect",
|
||||
kwlist, &domain, &name, &pyfunc, &pyarg))
|
||||
return NULL;
|
||||
|
||||
if (!PyCallable_Check(pyfunc)) {
|
||||
PyErr_SetString(PyExc_TypeError, "func must be a callable object");
|
||||
return NULL;
|
||||
}
|
||||
cunote = g_new(PyXedCustomNotify, 1);
|
||||
Py_INCREF(pyfunc);
|
||||
cunote->func = pyfunc;
|
||||
Py_XINCREF(pyarg);
|
||||
cunote->data = pyarg;
|
||||
|
||||
guint id = xed_message_bus_connect(XED_MESSAGE_BUS(self->obj),
|
||||
domain,
|
||||
name,
|
||||
pyxed_message_bus_connect_cb,
|
||||
(gpointer)cunote,
|
||||
pyxed_custom_destroy_notify);
|
||||
return PyLong_FromUnsignedLong(id);
|
||||
}
|
||||
%%
|
||||
override xed_message_bus_send kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_message_bus_send(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
/* create a new message object */
|
||||
XedMessage *message;
|
||||
XedMessageBus *bus = XED_MESSAGE_BUS(self->obj);
|
||||
message = _helper_wrap_create_message(bus, args, kwargs);
|
||||
|
||||
if (!message)
|
||||
return NULL;
|
||||
|
||||
xed_message_bus_send_message(bus, message);
|
||||
g_object_unref (message);
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
%%
|
||||
override xed_message_bus_send_sync kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_message_bus_send_sync(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
/* create a new message object */
|
||||
XedMessage *message;
|
||||
XedMessageBus *bus = XED_MESSAGE_BUS(self->obj);
|
||||
|
||||
message = _helper_wrap_create_message(bus, args, kwargs);
|
||||
|
||||
if (!message)
|
||||
return NULL;
|
||||
|
||||
xed_message_bus_send_message_sync(bus, message);
|
||||
return pygobject_new((GObject *)message);
|
||||
}
|
||||
%%
|
||||
override-slot XedMessage.tp_getattro
|
||||
static PyObject *
|
||||
_wrap_xed_message_tp_getattro(PyObject *self, PyObject *attrname)
|
||||
{
|
||||
XedMessage *message = XED_MESSAGE(((PyGObject *)self)->obj);
|
||||
XedMessageType *type;
|
||||
|
||||
gchar *name = _helper_wrap_get_string (attrname);
|
||||
gboolean exists;
|
||||
gboolean intype;
|
||||
PyObject *ret;
|
||||
|
||||
if (name == NULL)
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "attr name somehow not a string");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_object_get (message, "type", &type, NULL);
|
||||
intype = xed_message_type_lookup (type, name) != G_TYPE_INVALID;
|
||||
xed_message_type_unref (type);
|
||||
|
||||
exists = xed_message_has_key (message, name);
|
||||
|
||||
if (!intype)
|
||||
{
|
||||
ret = PyObject_GenericGetAttr(self, attrname);
|
||||
}
|
||||
else if (exists)
|
||||
{
|
||||
GValue value = { 0, };
|
||||
xed_message_get_value (message, name, &value);
|
||||
ret = pyg_value_as_pyobject(&value, TRUE);
|
||||
g_value_unset (&value);
|
||||
}
|
||||
else
|
||||
{
|
||||
Py_INCREF(Py_None);
|
||||
ret = Py_None;
|
||||
}
|
||||
|
||||
g_free (name);
|
||||
return ret;
|
||||
}
|
||||
%%
|
||||
override-slot XedMessage.tp_setattro
|
||||
static int
|
||||
_wrap_xed_message_tp_setattro(PyObject *self, PyObject *attrname, PyObject *value)
|
||||
{
|
||||
XedMessage *message = XED_MESSAGE(((PyGObject *)self)->obj);
|
||||
|
||||
if (!_helper_wrap_message_set_value(message, attrname, value))
|
||||
{
|
||||
return PyObject_GenericSetAttr(self, attrname, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -1,193 +0,0 @@
|
|||
%%
|
||||
headers
|
||||
#include <xed/xed-plugin.h>
|
||||
#include <xed/xed-window.h>
|
||||
%%
|
||||
override xed_plugin_activate kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_plugin_activate(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
gpointer klass, klass2;
|
||||
static char *kwlist[] = { "window", NULL };
|
||||
PyGObject *window;
|
||||
PyObject *cls = (PyObject *)(((PyObject *)self)->ob_type);
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords (args,
|
||||
kwargs,
|
||||
"O!:XedPlugin.activate",
|
||||
kwlist,
|
||||
&PyXedWindow_Type,
|
||||
&window))
|
||||
return NULL;
|
||||
|
||||
klass = g_type_class_ref (pyg_type_from_object (cls));
|
||||
|
||||
if (XED_IS_PLUGIN_PYTHON_CLASS (klass))
|
||||
{
|
||||
klass2 = g_type_class_peek_parent (klass);
|
||||
g_type_class_unref (klass);
|
||||
klass = g_type_class_ref (G_TYPE_FROM_CLASS (klass2));
|
||||
}
|
||||
|
||||
if (XED_PLUGIN_CLASS (klass)->activate)
|
||||
XED_PLUGIN_CLASS (klass)->activate (XED_PLUGIN (self->obj),
|
||||
XED_WINDOW (window->obj));
|
||||
else {
|
||||
PyErr_SetString (PyExc_NotImplementedError,
|
||||
"virtual method XedPlugin.activate not implemented");
|
||||
g_type_class_unref (klass);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_type_class_unref (klass);
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
%%
|
||||
override xed_plugin_deactivate kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_plugin_deactivate(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
gpointer klass, klass2;
|
||||
static char *kwlist[] = {"window", NULL};
|
||||
PyGObject *window;
|
||||
PyObject *cls = (PyObject *)(((PyObject *)self)->ob_type);
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords (args,
|
||||
kwargs,
|
||||
"O!:XedPlugin.deactivate",
|
||||
kwlist,
|
||||
&PyXedWindow_Type,
|
||||
&window))
|
||||
return NULL;
|
||||
|
||||
klass = g_type_class_ref (pyg_type_from_object (cls));
|
||||
|
||||
if (XED_IS_PLUGIN_PYTHON_CLASS (klass))
|
||||
{
|
||||
klass2 = g_type_class_peek_parent (klass);
|
||||
g_type_class_unref (klass);
|
||||
klass = g_type_class_ref (G_TYPE_FROM_CLASS (klass2));
|
||||
}
|
||||
|
||||
if (XED_PLUGIN_CLASS (klass)->deactivate)
|
||||
XED_PLUGIN_CLASS (klass)->deactivate (XED_PLUGIN (self->obj),
|
||||
XED_WINDOW (window->obj));
|
||||
else {
|
||||
PyErr_SetString (PyExc_NotImplementedError,
|
||||
"virtual method XedPlugin.deactivate not implemented");
|
||||
g_type_class_unref (klass);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_type_class_unref (klass);
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
%%
|
||||
override xed_plugin_update_ui kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_plugin_update_ui (PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
gpointer klass, klass2;
|
||||
static char *kwlist[] = {"window", NULL};
|
||||
PyGObject *window;
|
||||
PyObject *cls = (PyObject *)(((PyObject *)self)->ob_type);
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords (args,
|
||||
kwargs,
|
||||
"O!:XedPlugin.update_ui",
|
||||
kwlist,
|
||||
&PyXedWindow_Type,
|
||||
&window))
|
||||
return NULL;
|
||||
|
||||
klass = g_type_class_ref (pyg_type_from_object (cls));
|
||||
|
||||
if (XED_IS_PLUGIN_PYTHON_CLASS (klass))
|
||||
{
|
||||
klass2 = g_type_class_peek_parent (klass);
|
||||
g_type_class_unref (klass);
|
||||
klass = g_type_class_ref (G_TYPE_FROM_CLASS (klass2));
|
||||
}
|
||||
|
||||
if (XED_PLUGIN_CLASS (klass)->update_ui)
|
||||
XED_PLUGIN_CLASS (klass)->update_ui (XED_PLUGIN (self->obj),
|
||||
XED_WINDOW (window->obj));
|
||||
else {
|
||||
PyErr_SetString (PyExc_NotImplementedError,
|
||||
"virtual method XedPlugin.update_ui not implemented");
|
||||
g_type_class_unref (klass);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_type_class_unref (klass);
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
%%
|
||||
override xed_plugin_is_configurable
|
||||
static PyObject *
|
||||
_wrap_xed_plugin_is_configurable (PyGObject *self)
|
||||
{
|
||||
int ret;
|
||||
gpointer klass, klass2;
|
||||
PyObject *cls = (PyObject *)(((PyObject *)self)->ob_type);
|
||||
|
||||
klass = g_type_class_ref (pyg_type_from_object (cls));
|
||||
|
||||
if (XED_IS_PLUGIN_PYTHON_CLASS (klass))
|
||||
{
|
||||
klass2 = g_type_class_peek_parent (klass);
|
||||
g_type_class_unref (klass);
|
||||
klass = g_type_class_ref (G_TYPE_FROM_CLASS (klass2));
|
||||
}
|
||||
|
||||
if (XED_PLUGIN_CLASS (klass)->is_configurable)
|
||||
ret = XED_PLUGIN_CLASS (klass)->is_configurable (XED_PLUGIN (self->obj));
|
||||
else {
|
||||
PyErr_SetString (PyExc_NotImplementedError,
|
||||
"virtual method XedPlugin.is_configurable not implemented");
|
||||
g_type_class_unref (klass);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_type_class_unref (klass);
|
||||
return PyBool_FromLong (ret);
|
||||
}
|
||||
|
||||
%%
|
||||
override xed_plugin_configure_dialog
|
||||
static PyObject *
|
||||
_wrap_xed_plugin_create_configure_dialog (PyGObject *self)
|
||||
{
|
||||
GtkWidget *ret;
|
||||
gpointer klass, klass2;
|
||||
PyObject *cls = (PyObject *)(((PyObject *)self)->ob_type);
|
||||
|
||||
klass = g_type_class_ref(pyg_type_from_object (cls));
|
||||
|
||||
if (XED_IS_PLUGIN_PYTHON_CLASS (klass))
|
||||
{
|
||||
klass2 = g_type_class_peek_parent (klass);
|
||||
g_type_class_unref (klass);
|
||||
klass = g_type_class_ref (G_TYPE_FROM_CLASS (klass2));
|
||||
}
|
||||
|
||||
if (XED_PLUGIN_CLASS (klass)->create_configure_dialog)
|
||||
ret = XED_PLUGIN_CLASS (klass)->create_configure_dialog (XED_PLUGIN (self->obj));
|
||||
else {
|
||||
PyErr_SetString (PyExc_NotImplementedError,
|
||||
"virtual method XedPlugin.create_configure_dialog not implemented");
|
||||
g_type_class_unref (klass);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_type_class_unref (klass);
|
||||
|
||||
/* pygobject_new handles NULL checking */
|
||||
return pygobject_new ((GObject *)ret);
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
;; -*- scheme -*-
|
||||
|
||||
;; From ../../xed/xed-utils.h
|
||||
|
||||
(define-function uri_has_writable_scheme
|
||||
(c-name "xed_utils_uri_has_writable_scheme")
|
||||
(return-type "gboolean")
|
||||
(parameters
|
||||
'("const-gchar*" "uri")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function uri_has_file_scheme
|
||||
(c-name "xed_utils_uri_has_file_scheme")
|
||||
(return-type "gboolean")
|
||||
(parameters
|
||||
'("const-gchar*" "uri")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function uri_exists
|
||||
(c-name "xed_utils_uri_exists")
|
||||
(return-type "gboolean")
|
||||
(parameters
|
||||
'("const-gchar*" "text_uri")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function uri_is_valid
|
||||
(c-name "xed_utils_is_valid_uri")
|
||||
(return-type "gboolean")
|
||||
(parameters
|
||||
'("const-gchar*" "uri")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function uri_get_dirname
|
||||
(c-name "xed_utils_uri_get_dirname")
|
||||
(return-type "gchar*")
|
||||
(parameters
|
||||
'("const-char*" "uri")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function menu_position_under_widget
|
||||
(c-name "xed_utils_menu_position_under_widget")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GtkMenu*" "menu")
|
||||
'("gint*" "x")
|
||||
'("gint*" "y")
|
||||
'("gboolean*" "push_in")
|
||||
'("gpointer" "user_data")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function menu_position_under_tree_view
|
||||
(c-name "xed_utils_menu_position_under_tree_view")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GtkMenu*" "menu")
|
||||
'("gint*" "x")
|
||||
'("gint*" "y")
|
||||
'("gboolean*" "push_in")
|
||||
'("gpointer" "user_data")
|
||||
)
|
||||
)
|
|
@ -1,85 +0,0 @@
|
|||
%%
|
||||
headers
|
||||
#define NO_IMPORT_PYGOBJECT
|
||||
#define NO_IMPORT_PYGTK
|
||||
#include <pygobject.h>
|
||||
#include <pygtk/pygtk.h>
|
||||
|
||||
#include "xed-utils.h"
|
||||
|
||||
void pyxedutils_register_classes (PyObject *d);
|
||||
void pyxedutils_add_constants (PyObject *module, const gchar *strip_prefix);
|
||||
|
||||
%%
|
||||
modulename xed.utils
|
||||
%%
|
||||
import gtk.Widget as PyGtkWidget_Type
|
||||
import gtk.TreeView as PyGtkTreeView_Type
|
||||
import gtk.Menu as PyGtkMenu_Type
|
||||
%%
|
||||
ignore-glob
|
||||
_*
|
||||
%%
|
||||
override xed_utils_menu_position_under_widget kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_utils_menu_position_under_widget (PyObject *self,
|
||||
PyObject *args,
|
||||
PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { "menu", "widget", NULL };
|
||||
PyObject *py_menu, *py_widget;
|
||||
GtkMenu *menu;
|
||||
GtkWidget *widget;
|
||||
gint x, y;
|
||||
gboolean push_in;
|
||||
PyObject *tuple;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords (args, kwargs,
|
||||
"O!O!", kwlist,
|
||||
&PyGtkMenu_Type, &py_menu,
|
||||
&PyGtkWidget_Type, &py_widget))
|
||||
return NULL;
|
||||
|
||||
menu = GTK_MENU (pygobject_get (py_menu));
|
||||
widget = GTK_WIDGET (pygobject_get (py_widget));
|
||||
|
||||
xed_utils_menu_position_under_widget (menu, &x, &y, &push_in, widget);
|
||||
|
||||
tuple = PyTuple_New (3);
|
||||
PyTuple_SetItem (tuple, 0, PyInt_FromLong (x));
|
||||
PyTuple_SetItem (tuple, 1, PyInt_FromLong (y));
|
||||
PyTuple_SetItem (tuple, 2, PyBool_FromLong (push_in));
|
||||
return tuple;
|
||||
}
|
||||
%%
|
||||
override xed_utils_menu_position_under_tree_view kwargs
|
||||
static PyObject *
|
||||
_wrap_xed_utils_menu_position_under_tree_view (PyObject *self,
|
||||
PyObject *args,
|
||||
PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { "menu", "tree_view", NULL };
|
||||
PyObject *py_menu, *py_view;
|
||||
GtkMenu *menu;
|
||||
GtkTreeView *view;
|
||||
gint x, y;
|
||||
gboolean push_in;
|
||||
PyObject *tuple;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords (args, kwargs,
|
||||
"O!O!", kwlist,
|
||||
&PyGtkMenu_Type, &py_menu,
|
||||
&PyGtkTreeView_Type, &py_view))
|
||||
return NULL;
|
||||
|
||||
menu = GTK_MENU (pygobject_get (py_menu));
|
||||
view = GTK_TREE_VIEW (pygobject_get (py_view));
|
||||
|
||||
xed_utils_menu_position_under_widget (menu, &x, &y, &push_in, view);
|
||||
|
||||
tuple = PyTuple_New (3);
|
||||
PyTuple_SetItem (tuple, 0, PyInt_FromLong (x));
|
||||
PyTuple_SetItem (tuple, 1, PyInt_FromLong (y));
|
||||
PyTuple_SetItem (tuple, 2, PyBool_FromLong (push_in));
|
||||
return tuple;
|
||||
}
|
|
@ -1,719 +0,0 @@
|
|||
/*
|
||||
* xed-plugin-loader-python.c
|
||||
* This file is part of xed
|
||||
*
|
||||
* Copyright (C) 2008 - 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 "xed-plugin-loader-python.h"
|
||||
#include "xed-plugin-python.h"
|
||||
#include <xed/xed-object-module.h>
|
||||
|
||||
#define NO_IMPORT_PYGOBJECT
|
||||
#define NO_IMPORT_PYGTK
|
||||
|
||||
#include <Python.h>
|
||||
#include <pygobject.h>
|
||||
#include <pygtk/pygtk.h>
|
||||
#include <signal.h>
|
||||
#include "config.h"
|
||||
|
||||
#if PY_VERSION_HEX < 0x02050000
|
||||
typedef int Py_ssize_t;
|
||||
#define PY_SSIZE_T_MAX INT_MAX
|
||||
#define PY_SSIZE_T_MIN INT_MIN
|
||||
#endif
|
||||
|
||||
#define XED_PLUGIN_LOADER_PYTHON_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), XED_TYPE_PLUGIN_LOADER_PYTHON, XedPluginLoaderPythonPrivate))
|
||||
|
||||
struct _XedPluginLoaderPythonPrivate
|
||||
{
|
||||
GHashTable *loaded_plugins;
|
||||
guint idle_gc;
|
||||
gboolean init_failed;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PyObject *type;
|
||||
PyObject *instance;
|
||||
gchar *path;
|
||||
} PythonInfo;
|
||||
|
||||
static void xed_plugin_loader_iface_init (gpointer g_iface, gpointer iface_data);
|
||||
|
||||
/* Exported by pyxed module */
|
||||
void pyxed_register_classes (PyObject *d);
|
||||
void pyxed_add_constants (PyObject *module, const gchar *strip_prefix);
|
||||
extern PyMethodDef pyxed_functions[];
|
||||
|
||||
/* Exported by pyxedutils module */
|
||||
void pyxedutils_register_classes (PyObject *d);
|
||||
extern PyMethodDef pyxedutils_functions[];
|
||||
|
||||
/* Exported by pyxedcommands module */
|
||||
void pyxedcommands_register_classes (PyObject *d);
|
||||
extern PyMethodDef pyxedcommands_functions[];
|
||||
|
||||
/* We retreive this to check for correct class hierarchy */
|
||||
static PyTypeObject *PyXedPlugin_Type;
|
||||
|
||||
XED_PLUGIN_LOADER_REGISTER_TYPE (XedPluginLoaderPython, xed_plugin_loader_python, G_TYPE_OBJECT, xed_plugin_loader_iface_init);
|
||||
|
||||
|
||||
static PyObject *
|
||||
find_python_plugin_type (XedPluginInfo *info,
|
||||
PyObject *pymodule)
|
||||
{
|
||||
PyObject *locals, *key, *value;
|
||||
Py_ssize_t pos = 0;
|
||||
|
||||
locals = PyModule_GetDict (pymodule);
|
||||
|
||||
while (PyDict_Next (locals, &pos, &key, &value))
|
||||
{
|
||||
if (!PyType_Check(value))
|
||||
continue;
|
||||
|
||||
if (PyObject_IsSubclass (value, (PyObject*) PyXedPlugin_Type))
|
||||
return value;
|
||||
}
|
||||
|
||||
g_warning ("No XedPlugin derivative found in Python plugin '%s'",
|
||||
xed_plugin_info_get_name (info));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static XedPlugin *
|
||||
new_plugin_from_info (XedPluginLoaderPython *loader,
|
||||
XedPluginInfo *info)
|
||||
{
|
||||
PythonInfo *pyinfo;
|
||||
PyTypeObject *pytype;
|
||||
PyObject *pyobject;
|
||||
PyGObject *pygobject;
|
||||
XedPlugin *instance;
|
||||
PyObject *emptyarg;
|
||||
|
||||
pyinfo = (PythonInfo *)g_hash_table_lookup (loader->priv->loaded_plugins, info);
|
||||
|
||||
if (pyinfo == NULL)
|
||||
return NULL;
|
||||
|
||||
pytype = (PyTypeObject *)pyinfo->type;
|
||||
|
||||
if (pytype->tp_new == NULL)
|
||||
return NULL;
|
||||
|
||||
emptyarg = PyTuple_New(0);
|
||||
pyobject = pytype->tp_new (pytype, emptyarg, NULL);
|
||||
Py_DECREF (emptyarg);
|
||||
|
||||
if (pyobject == NULL)
|
||||
{
|
||||
g_error ("Could not create instance for %s.", xed_plugin_info_get_name (info));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pygobject = (PyGObject *)pyobject;
|
||||
|
||||
if (pygobject->obj != NULL)
|
||||
{
|
||||
Py_DECREF (pyobject);
|
||||
g_error ("Could not create instance for %s (GObject already initialized).", xed_plugin_info_get_name (info));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pygobject_construct (pygobject,
|
||||
"install-dir", pyinfo->path,
|
||||
"data-dir-name", xed_plugin_info_get_module_name (info),
|
||||
NULL);
|
||||
|
||||
if (pygobject->obj == NULL)
|
||||
{
|
||||
g_error ("Could not create instance for %s (GObject not constructed).", xed_plugin_info_get_name (info));
|
||||
Py_DECREF (pyobject);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* now call tp_init manually */
|
||||
if (PyType_IsSubtype (pyobject->ob_type, pytype) &&
|
||||
pyobject->ob_type->tp_init != NULL)
|
||||
{
|
||||
emptyarg = PyTuple_New(0);
|
||||
pyobject->ob_type->tp_init (pyobject, emptyarg, NULL);
|
||||
Py_DECREF (emptyarg);
|
||||
}
|
||||
|
||||
instance = XED_PLUGIN (pygobject->obj);
|
||||
pyinfo->instance = (PyObject *)pygobject;
|
||||
|
||||
/* make sure to register the python instance for the XedPluginPython
|
||||
object to it can wrap the virtual xed plugin funcs back to python */
|
||||
_xed_plugin_python_set_instance (XED_PLUGIN_PYTHON (instance), (PyObject *)pygobject);
|
||||
|
||||
/* we return a reference here because the other is owned by python */
|
||||
return XED_PLUGIN (g_object_ref (instance));
|
||||
}
|
||||
|
||||
static XedPlugin *
|
||||
add_python_info (XedPluginLoaderPython *loader,
|
||||
XedPluginInfo *info,
|
||||
PyObject *module,
|
||||
const gchar *path,
|
||||
PyObject *type)
|
||||
{
|
||||
PythonInfo *pyinfo;
|
||||
|
||||
pyinfo = g_new (PythonInfo, 1);
|
||||
pyinfo->path = g_strdup (path);
|
||||
pyinfo->type = type;
|
||||
|
||||
Py_INCREF (pyinfo->type);
|
||||
|
||||
g_hash_table_insert (loader->priv->loaded_plugins, info, pyinfo);
|
||||
|
||||
return new_plugin_from_info (loader, info);
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
xed_plugin_loader_iface_get_id (void)
|
||||
{
|
||||
return "Python";
|
||||
}
|
||||
|
||||
static XedPlugin *
|
||||
xed_plugin_loader_iface_load (XedPluginLoader *loader,
|
||||
XedPluginInfo *info,
|
||||
const gchar *path)
|
||||
{
|
||||
XedPluginLoaderPython *pyloader = XED_PLUGIN_LOADER_PYTHON (loader);
|
||||
PyObject *main_module, *main_locals, *pytype;
|
||||
PyObject *pymodule, *fromlist;
|
||||
gchar *module_name;
|
||||
XedPlugin *result;
|
||||
|
||||
if (pyloader->priv->init_failed)
|
||||
{
|
||||
g_warning ("Cannot load python plugin Python '%s' since xed was"
|
||||
"not able to initialize the Python interpreter.",
|
||||
xed_plugin_info_get_name (info));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* see if py definition for the plugin is already loaded */
|
||||
result = new_plugin_from_info (pyloader, info);
|
||||
|
||||
if (result != NULL)
|
||||
return result;
|
||||
|
||||
main_module = PyImport_AddModule ("xed.plugins");
|
||||
if (main_module == NULL)
|
||||
{
|
||||
g_warning ("Could not get xed.plugins.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* If we have a special path, we register it */
|
||||
if (path != NULL)
|
||||
{
|
||||
PyObject *sys_path = PySys_GetObject ("path");
|
||||
PyObject *pypath = PyString_FromString (path);
|
||||
|
||||
if (PySequence_Contains (sys_path, pypath) == 0)
|
||||
PyList_Insert (sys_path, 0, pypath);
|
||||
|
||||
Py_DECREF (pypath);
|
||||
}
|
||||
|
||||
main_locals = PyModule_GetDict (main_module);
|
||||
|
||||
/* we need a fromlist to be able to import modules with a '.' in the
|
||||
name. */
|
||||
fromlist = PyTuple_New(0);
|
||||
module_name = g_strdup (xed_plugin_info_get_module_name (info));
|
||||
|
||||
pymodule = PyImport_ImportModuleEx (module_name,
|
||||
main_locals,
|
||||
main_locals,
|
||||
fromlist);
|
||||
|
||||
Py_DECREF(fromlist);
|
||||
|
||||
if (!pymodule)
|
||||
{
|
||||
g_free (module_name);
|
||||
PyErr_Print ();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PyDict_SetItemString (main_locals, module_name, pymodule);
|
||||
g_free (module_name);
|
||||
|
||||
pytype = find_python_plugin_type (info, pymodule);
|
||||
|
||||
if (pytype)
|
||||
return add_python_info (pyloader, info, pymodule, path, pytype);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
xed_plugin_loader_iface_unload (XedPluginLoader *loader,
|
||||
XedPluginInfo *info)
|
||||
{
|
||||
XedPluginLoaderPython *pyloader = XED_PLUGIN_LOADER_PYTHON (loader);
|
||||
PythonInfo *pyinfo;
|
||||
PyGILState_STATE state;
|
||||
|
||||
pyinfo = (PythonInfo *)g_hash_table_lookup (pyloader->priv->loaded_plugins, info);
|
||||
|
||||
if (!pyinfo)
|
||||
return;
|
||||
|
||||
state = pyg_gil_state_ensure ();
|
||||
Py_XDECREF (pyinfo->instance);
|
||||
pyg_gil_state_release (state);
|
||||
|
||||
pyinfo->instance = NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
run_gc (XedPluginLoaderPython *loader)
|
||||
{
|
||||
while (PyGC_Collect ())
|
||||
;
|
||||
|
||||
loader->priv->idle_gc = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
xed_plugin_loader_iface_garbage_collect (XedPluginLoader *loader)
|
||||
{
|
||||
XedPluginLoaderPython *pyloader;
|
||||
|
||||
if (!Py_IsInitialized())
|
||||
return;
|
||||
|
||||
pyloader = XED_PLUGIN_LOADER_PYTHON (loader);
|
||||
|
||||
/*
|
||||
* We both run the GC right now and we schedule
|
||||
* a further collection in the main loop.
|
||||
*/
|
||||
|
||||
while (PyGC_Collect ())
|
||||
;
|
||||
|
||||
if (pyloader->priv->idle_gc == 0)
|
||||
pyloader->priv->idle_gc = g_idle_add ((GSourceFunc)run_gc, pyloader);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_plugin_loader_iface_init (gpointer g_iface,
|
||||
gpointer iface_data)
|
||||
{
|
||||
XedPluginLoaderInterface *iface = (XedPluginLoaderInterface *)g_iface;
|
||||
|
||||
iface->get_id = xed_plugin_loader_iface_get_id;
|
||||
iface->load = xed_plugin_loader_iface_load;
|
||||
iface->unload = xed_plugin_loader_iface_unload;
|
||||
iface->garbage_collect = xed_plugin_loader_iface_garbage_collect;
|
||||
}
|
||||
|
||||
static void
|
||||
xed_python_shutdown (XedPluginLoaderPython *loader)
|
||||
{
|
||||
if (!Py_IsInitialized ())
|
||||
return;
|
||||
|
||||
if (loader->priv->idle_gc != 0)
|
||||
{
|
||||
g_source_remove (loader->priv->idle_gc);
|
||||
loader->priv->idle_gc = 0;
|
||||
}
|
||||
|
||||
while (PyGC_Collect ())
|
||||
;
|
||||
|
||||
Py_Finalize ();
|
||||
}
|
||||
|
||||
|
||||
/* C equivalent of
|
||||
* import pygtk
|
||||
* pygtk.require ("2.0")
|
||||
*/
|
||||
static gboolean
|
||||
xed_check_pygtk2 (void)
|
||||
{
|
||||
PyObject *pygtk, *mdict, *require;
|
||||
|
||||
/* pygtk.require("2.0") */
|
||||
pygtk = PyImport_ImportModule ("pygtk");
|
||||
if (pygtk == NULL)
|
||||
{
|
||||
g_warning ("Error initializing Python interpreter: could not import pygtk.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
mdict = PyModule_GetDict (pygtk);
|
||||
require = PyDict_GetItemString (mdict, "require");
|
||||
PyObject_CallObject (require,
|
||||
Py_BuildValue ("(S)", PyString_FromString ("2.0")));
|
||||
if (PyErr_Occurred())
|
||||
{
|
||||
g_warning ("Error initializing Python interpreter: pygtk 2 is required.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Note: the following two functions are needed because
|
||||
* init_pyobject and init_pygtk which are *macros* which in case
|
||||
* case of error set the PyErr and then make the calling
|
||||
* function return behind our back.
|
||||
* It's up to the caller to check the result with PyErr_Occurred()
|
||||
*/
|
||||
static void
|
||||
xed_init_pygobject (void)
|
||||
{
|
||||
init_pygobject_check (2, 11, 5); /* FIXME: get from config */
|
||||
}
|
||||
|
||||
static void
|
||||
xed_init_pygtk (void)
|
||||
{
|
||||
PyObject *gtk, *mdict, *version, *required_version;
|
||||
|
||||
init_pygtk ();
|
||||
|
||||
/* there isn't init_pygtk_check(), do the version
|
||||
* check ourselves */
|
||||
gtk = PyImport_ImportModule("gtk");
|
||||
mdict = PyModule_GetDict(gtk);
|
||||
version = PyDict_GetItemString (mdict, "pygtk_version");
|
||||
if (!version)
|
||||
{
|
||||
PyErr_SetString (PyExc_ImportError,
|
||||
"PyGObject version too old");
|
||||
return;
|
||||
}
|
||||
|
||||
required_version = Py_BuildValue ("(iii)", 2, 4, 0); /* FIXME */
|
||||
|
||||
if (PyObject_Compare (version, required_version) == -1)
|
||||
{
|
||||
PyErr_SetString (PyExc_ImportError,
|
||||
"PyGObject version too old");
|
||||
Py_DECREF (required_version);
|
||||
return;
|
||||
}
|
||||
|
||||
Py_DECREF (required_version);
|
||||
}
|
||||
|
||||
static void
|
||||
old_gtksourceview_init (void)
|
||||
{
|
||||
PyErr_SetString(PyExc_ImportError,
|
||||
"gtksourceview module not allowed, use gtksourceview2");
|
||||
}
|
||||
|
||||
static void
|
||||
xed_init_pygtksourceview (void)
|
||||
{
|
||||
PyObject *gtksourceview, *mdict, *version, *required_version;
|
||||
|
||||
gtksourceview = PyImport_ImportModule("gtksourceview2");
|
||||
if (gtksourceview == NULL)
|
||||
{
|
||||
PyErr_SetString (PyExc_ImportError,
|
||||
"could not import gtksourceview");
|
||||
return;
|
||||
}
|
||||
|
||||
mdict = PyModule_GetDict (gtksourceview);
|
||||
version = PyDict_GetItemString (mdict, "pygtksourceview2_version");
|
||||
if (!version)
|
||||
{
|
||||
PyErr_SetString (PyExc_ImportError,
|
||||
"PyGtkSourceView version too old");
|
||||
return;
|
||||
}
|
||||
|
||||
required_version = Py_BuildValue ("(iii)", 0, 8, 0); /* FIXME */
|
||||
|
||||
if (PyObject_Compare (version, required_version) == -1)
|
||||
{
|
||||
PyErr_SetString (PyExc_ImportError,
|
||||
"PyGtkSourceView version too old");
|
||||
Py_DECREF (required_version);
|
||||
return;
|
||||
}
|
||||
|
||||
Py_DECREF (required_version);
|
||||
|
||||
/* Create a dummy 'gtksourceview' module to prevent
|
||||
* loading of the old 'gtksourceview' modules that
|
||||
* has conflicting symbols with the gtksourceview2 module.
|
||||
* Raise an exception when trying to import it.
|
||||
*/
|
||||
PyImport_AppendInittab ("gtksourceview", old_gtksourceview_init);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
xed_python_init (XedPluginLoaderPython *loader)
|
||||
{
|
||||
PyObject *mdict, *tuple;
|
||||
PyObject *xed, *xedutils, *xedcommands, *xedplugins;
|
||||
PyObject *gettext, *install, *gettext_args;
|
||||
//char *argv[] = { "xed", NULL };
|
||||
char *argv[] = { XED_PLUGINS_LIBS_DIR, NULL };
|
||||
#ifdef HAVE_SIGACTION
|
||||
gint res;
|
||||
struct sigaction old_sigint;
|
||||
#endif
|
||||
|
||||
if (loader->priv->init_failed)
|
||||
{
|
||||
/* We already failed to initialized Python, don't need to
|
||||
* retry again */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (Py_IsInitialized ())
|
||||
{
|
||||
/* Python has already been successfully initialized */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* We are trying to initialize Python for the first time,
|
||||
set init_failed to FALSE only if the entire initialization process
|
||||
ends with success */
|
||||
loader->priv->init_failed = TRUE;
|
||||
|
||||
/* Hack to make python not overwrite SIGINT: this is needed to avoid
|
||||
* the crash reported on bug #326191 */
|
||||
|
||||
/* CHECK: can't we use Py_InitializeEx instead of Py_Initialize in order
|
||||
to avoid to manage signal handlers ? - Paolo (Dec. 31, 2006) */
|
||||
|
||||
#ifdef HAVE_SIGACTION
|
||||
/* Save old handler */
|
||||
res = sigaction (SIGINT, NULL, &old_sigint);
|
||||
if (res != 0)
|
||||
{
|
||||
g_warning ("Error initializing Python interpreter: cannot get "
|
||||
"handler to SIGINT signal (%s)",
|
||||
g_strerror (errno));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Python initialization */
|
||||
Py_Initialize ();
|
||||
|
||||
#ifdef HAVE_SIGACTION
|
||||
/* Restore old handler */
|
||||
res = sigaction (SIGINT, &old_sigint, NULL);
|
||||
if (res != 0)
|
||||
{
|
||||
g_warning ("Error initializing Python interpreter: cannot restore "
|
||||
"handler to SIGINT signal (%s).",
|
||||
g_strerror (errno));
|
||||
|
||||
goto python_init_error;
|
||||
}
|
||||
#endif
|
||||
|
||||
PySys_SetArgv (1, argv);
|
||||
|
||||
if (!xed_check_pygtk2 ())
|
||||
{
|
||||
/* Warning message already printed in check_pygtk2 */
|
||||
goto python_init_error;
|
||||
}
|
||||
|
||||
/* import gobject */
|
||||
xed_init_pygobject ();
|
||||
if (PyErr_Occurred ())
|
||||
{
|
||||
g_warning ("Error initializing Python interpreter: could not import pygobject.");
|
||||
|
||||
goto python_init_error;
|
||||
}
|
||||
|
||||
/* import gtk */
|
||||
xed_init_pygtk ();
|
||||
if (PyErr_Occurred ())
|
||||
{
|
||||
g_warning ("Error initializing Python interpreter: could not import pygtk.");
|
||||
|
||||
goto python_init_error;
|
||||
}
|
||||
|
||||
/* import gtksourceview */
|
||||
xed_init_pygtksourceview ();
|
||||
if (PyErr_Occurred ())
|
||||
{
|
||||
PyErr_Print ();
|
||||
|
||||
g_warning ("Error initializing Python interpreter: could not import pygtksourceview.");
|
||||
|
||||
goto python_init_error;
|
||||
}
|
||||
|
||||
/* import xed */
|
||||
xed = Py_InitModule ("xed", pyxed_functions);
|
||||
mdict = PyModule_GetDict (xed);
|
||||
|
||||
pyxed_register_classes (mdict);
|
||||
pyxed_add_constants (xed, "XED_");
|
||||
|
||||
/* xed version */
|
||||
tuple = Py_BuildValue("(iii)",
|
||||
XED_MAJOR_VERSION,
|
||||
XED_MINOR_VERSION,
|
||||
XED_MICRO_VERSION);
|
||||
PyDict_SetItemString(mdict, "version", tuple);
|
||||
Py_DECREF(tuple);
|
||||
|
||||
/* Retrieve the Python type for xed.Plugin */
|
||||
PyXedPlugin_Type = (PyTypeObject *) PyDict_GetItemString (mdict, "Plugin");
|
||||
if (PyXedPlugin_Type == NULL)
|
||||
{
|
||||
PyErr_Print ();
|
||||
|
||||
goto python_init_error;
|
||||
}
|
||||
|
||||
/* import xed.utils */
|
||||
xedutils = Py_InitModule ("xed.utils", pyxedutils_functions);
|
||||
PyDict_SetItemString (mdict, "utils", xedutils);
|
||||
|
||||
/* import xed.commands */
|
||||
xedcommands = Py_InitModule ("xed.commands", pyxedcommands_functions);
|
||||
PyDict_SetItemString (mdict, "commands", xedcommands);
|
||||
|
||||
/* initialize empty xed.plugins module */
|
||||
xedplugins = Py_InitModule ("xed.plugins", NULL);
|
||||
PyDict_SetItemString (mdict, "plugins", xedplugins);
|
||||
|
||||
mdict = PyModule_GetDict (xedutils);
|
||||
pyxedutils_register_classes (mdict);
|
||||
|
||||
mdict = PyModule_GetDict (xedcommands);
|
||||
pyxedcommands_register_classes (mdict);
|
||||
|
||||
/* i18n support */
|
||||
gettext = PyImport_ImportModule ("gettext");
|
||||
if (gettext == NULL)
|
||||
{
|
||||
g_warning ("Error initializing Python interpreter: could not import gettext.");
|
||||
|
||||
goto python_init_error;
|
||||
}
|
||||
|
||||
mdict = PyModule_GetDict (gettext);
|
||||
install = PyDict_GetItemString (mdict, "install");
|
||||
gettext_args = Py_BuildValue ("ss", GETTEXT_PACKAGE, XED_LOCALEDIR);
|
||||
PyObject_CallObject (install, gettext_args);
|
||||
Py_DECREF (gettext_args);
|
||||
|
||||
/* Python has been successfully initialized */
|
||||
loader->priv->init_failed = FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
||||
python_init_error:
|
||||
|
||||
g_warning ("Please check the installation of all the Python related packages required "
|
||||
"by xed and try again.");
|
||||
|
||||
PyErr_Clear ();
|
||||
|
||||
xed_python_shutdown (loader);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
xed_plugin_loader_python_finalize (GObject *object)
|
||||
{
|
||||
XedPluginLoaderPython *pyloader = XED_PLUGIN_LOADER_PYTHON (object);
|
||||
|
||||
g_hash_table_destroy (pyloader->priv->loaded_plugins);
|
||||
xed_python_shutdown (pyloader);
|
||||
|
||||
G_OBJECT_CLASS (xed_plugin_loader_python_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_plugin_loader_python_class_init (XedPluginLoaderPythonClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = xed_plugin_loader_python_finalize;
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedPluginLoaderPythonPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
xed_plugin_loader_python_class_finalize (XedPluginLoaderPythonClass *klass)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_python_info (PythonInfo *info)
|
||||
{
|
||||
PyGILState_STATE state = pyg_gil_state_ensure ();
|
||||
Py_XDECREF (info->type);
|
||||
pyg_gil_state_release (state);
|
||||
|
||||
g_free (info->path);
|
||||
g_free (info);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_plugin_loader_python_init (XedPluginLoaderPython *self)
|
||||
{
|
||||
self->priv = XED_PLUGIN_LOADER_PYTHON_GET_PRIVATE (self);
|
||||
|
||||
/* initialize python interpreter */
|
||||
xed_python_init (self);
|
||||
|
||||
/* loaded_plugins maps XedPluginInfo to a PythonInfo */
|
||||
self->priv->loaded_plugins = g_hash_table_new_full (g_direct_hash,
|
||||
g_direct_equal,
|
||||
NULL,
|
||||
(GDestroyNotify)destroy_python_info);
|
||||
}
|
||||
|
||||
XedPluginLoaderPython *
|
||||
xed_plugin_loader_python_new ()
|
||||
{
|
||||
GObject *loader = g_object_new (XED_TYPE_PLUGIN_LOADER_PYTHON, NULL);
|
||||
|
||||
return XED_PLUGIN_LOADER_PYTHON (loader);
|
||||
}
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* xed-plugin-loader-python.h
|
||||
* This file is part of xed
|
||||
*
|
||||
* Copyright (C) 2008 - 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_PLUGIN_LOADER_PYTHON_H__
|
||||
#define __XED_PLUGIN_LOADER_PYTHON_H__
|
||||
|
||||
#include <xed/xed-plugin-loader.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define XED_TYPE_PLUGIN_LOADER_PYTHON (xed_plugin_loader_python_get_type ())
|
||||
#define XED_PLUGIN_LOADER_PYTHON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XED_TYPE_PLUGIN_LOADER_PYTHON, XedPluginLoaderPython))
|
||||
#define XED_PLUGIN_LOADER_PYTHON_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XED_TYPE_PLUGIN_LOADER_PYTHON, XedPluginLoaderPython const))
|
||||
#define XED_PLUGIN_LOADER_PYTHON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XED_TYPE_PLUGIN_LOADER_PYTHON, XedPluginLoaderPythonClass))
|
||||
#define XED_IS_PLUGIN_LOADER_PYTHON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XED_TYPE_PLUGIN_LOADER_PYTHON))
|
||||
#define XED_IS_PLUGIN_LOADER_PYTHON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XED_TYPE_PLUGIN_LOADER_PYTHON))
|
||||
#define XED_PLUGIN_LOADER_PYTHON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XED_TYPE_PLUGIN_LOADER_PYTHON, XedPluginLoaderPythonClass))
|
||||
|
||||
typedef struct _XedPluginLoaderPython XedPluginLoaderPython;
|
||||
typedef struct _XedPluginLoaderPythonClass XedPluginLoaderPythonClass;
|
||||
typedef struct _XedPluginLoaderPythonPrivate XedPluginLoaderPythonPrivate;
|
||||
|
||||
struct _XedPluginLoaderPython {
|
||||
GObject parent;
|
||||
|
||||
XedPluginLoaderPythonPrivate *priv;
|
||||
};
|
||||
|
||||
struct _XedPluginLoaderPythonClass {
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
GType xed_plugin_loader_python_get_type (void) G_GNUC_CONST;
|
||||
XedPluginLoaderPython *xed_plugin_loader_python_new(void);
|
||||
|
||||
/* All the loaders must implement this function */
|
||||
G_MODULE_EXPORT GType register_xed_plugin_loader (GTypeModule * module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __XED_PLUGIN_LOADER_PYTHON_H__ */
|
||||
|
|
@ -1,281 +0,0 @@
|
|||
/*
|
||||
* xed-plugin-python.c
|
||||
* This file is part of xed
|
||||
*
|
||||
* Copyright (C) 2005 Raphael Slinckx
|
||||
* Copyright (C) 2008 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 <config.h>
|
||||
|
||||
#include "xed-plugin-python.h"
|
||||
|
||||
#include <xed/xed-plugin.h>
|
||||
#include <xed/xed-debug.h>
|
||||
#include <pygobject.h>
|
||||
#include <string.h>
|
||||
|
||||
#define XED_PLUGIN_PYTHON_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_PLUGIN_PYTHON, XedPluginPythonPrivate))
|
||||
|
||||
static GObjectClass *parent_class;
|
||||
|
||||
struct _XedPluginPythonPrivate
|
||||
{
|
||||
PyObject *instance;
|
||||
};
|
||||
|
||||
static void xed_plugin_python_class_init (XedPluginPythonClass *klass);
|
||||
static void xed_plugin_python_init (XedPluginPython *plugin);
|
||||
|
||||
G_DEFINE_TYPE (XedPluginPython, xed_plugin_python, XED_TYPE_PLUGIN)
|
||||
|
||||
static PyObject *
|
||||
call_python_method (XedPluginPythonPrivate *priv,
|
||||
XedWindow *window,
|
||||
gchar *method)
|
||||
{
|
||||
PyObject *py_ret = NULL;
|
||||
|
||||
g_return_val_if_fail (PyObject_HasAttrString (priv->instance, method), NULL);
|
||||
|
||||
if (window == NULL)
|
||||
{
|
||||
py_ret = PyObject_CallMethod (priv->instance,
|
||||
method,
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
py_ret = PyObject_CallMethod (priv->instance,
|
||||
method,
|
||||
"(N)",
|
||||
pygobject_new (G_OBJECT (window)));
|
||||
}
|
||||
|
||||
if (!py_ret)
|
||||
PyErr_Print ();
|
||||
|
||||
return py_ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
check_py_object_is_gtk_widget (PyObject *py_obj)
|
||||
{
|
||||
static PyTypeObject *_PyGtkWidget_Type = NULL;
|
||||
|
||||
if (_PyGtkWidget_Type == NULL)
|
||||
{
|
||||
PyObject *module;
|
||||
|
||||
if ((module = PyImport_ImportModule ("gtk")))
|
||||
{
|
||||
PyObject *moddict = PyModule_GetDict (module);
|
||||
_PyGtkWidget_Type = (PyTypeObject *) PyDict_GetItemString (moddict, "Widget");
|
||||
}
|
||||
|
||||
if (_PyGtkWidget_Type == NULL)
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "could not find Python gtk widget type");
|
||||
PyErr_Print();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return PyObject_TypeCheck (py_obj, _PyGtkWidget_Type) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
impl_update_ui (XedPlugin *plugin,
|
||||
XedWindow *window)
|
||||
{
|
||||
PyGILState_STATE state = pyg_gil_state_ensure ();
|
||||
XedPluginPythonPrivate *priv = XED_PLUGIN_PYTHON(plugin)->priv;
|
||||
|
||||
if (PyObject_HasAttrString (priv->instance, "update_ui"))
|
||||
{
|
||||
PyObject *py_ret = call_python_method (priv, window, "update_ui");
|
||||
|
||||
if (py_ret)
|
||||
{
|
||||
Py_XDECREF (py_ret);
|
||||
}
|
||||
}
|
||||
else
|
||||
XED_PLUGIN_CLASS (parent_class)->update_ui (plugin, window);
|
||||
|
||||
pyg_gil_state_release (state);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_deactivate (XedPlugin *plugin,
|
||||
XedWindow *window)
|
||||
{
|
||||
PyGILState_STATE state = pyg_gil_state_ensure ();
|
||||
XedPluginPythonPrivate *priv = XED_PLUGIN_PYTHON(plugin)->priv;
|
||||
|
||||
if (PyObject_HasAttrString (priv->instance, "deactivate"))
|
||||
{
|
||||
PyObject *py_ret = call_python_method (priv, window, "deactivate");
|
||||
|
||||
if (py_ret)
|
||||
{
|
||||
Py_XDECREF (py_ret);
|
||||
}
|
||||
}
|
||||
else
|
||||
XED_PLUGIN_CLASS (parent_class)->deactivate (plugin, window);
|
||||
|
||||
pyg_gil_state_release (state);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_activate (XedPlugin *plugin,
|
||||
XedWindow *window)
|
||||
{
|
||||
PyGILState_STATE state = pyg_gil_state_ensure ();
|
||||
XedPluginPythonPrivate *priv = XED_PLUGIN_PYTHON(plugin)->priv;
|
||||
|
||||
if (PyObject_HasAttrString (priv->instance, "activate"))
|
||||
{
|
||||
PyObject *py_ret = call_python_method (priv, window, "activate");
|
||||
|
||||
if (py_ret)
|
||||
{
|
||||
Py_XDECREF (py_ret);
|
||||
}
|
||||
}
|
||||
else
|
||||
XED_PLUGIN_CLASS (parent_class)->activate (plugin, window);
|
||||
|
||||
pyg_gil_state_release (state);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
impl_create_configure_dialog (XedPlugin *plugin)
|
||||
{
|
||||
PyGILState_STATE state = pyg_gil_state_ensure ();
|
||||
XedPluginPythonPrivate *priv = XED_PLUGIN_PYTHON(plugin)->priv;
|
||||
GtkWidget *ret = NULL;
|
||||
|
||||
if (PyObject_HasAttrString (priv->instance, "create_configure_dialog"))
|
||||
{
|
||||
PyObject *py_ret = call_python_method (priv, NULL, "create_configure_dialog");
|
||||
|
||||
if (py_ret)
|
||||
{
|
||||
if (check_py_object_is_gtk_widget (py_ret))
|
||||
{
|
||||
ret = GTK_WIDGET (pygobject_get (py_ret));
|
||||
g_object_ref (ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "return value for create_configure_dialog is not a GtkWidget");
|
||||
PyErr_Print();
|
||||
}
|
||||
|
||||
Py_DECREF (py_ret);
|
||||
}
|
||||
}
|
||||
else
|
||||
ret = XED_PLUGIN_CLASS (parent_class)->create_configure_dialog (plugin);
|
||||
|
||||
pyg_gil_state_release (state);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
impl_is_configurable (XedPlugin *plugin)
|
||||
{
|
||||
PyGILState_STATE state = pyg_gil_state_ensure ();
|
||||
XedPluginPythonPrivate *priv = XED_PLUGIN_PYTHON(plugin)->priv;
|
||||
PyObject *dict = priv->instance->ob_type->tp_dict;
|
||||
gboolean result;
|
||||
|
||||
if (dict == NULL)
|
||||
result = FALSE;
|
||||
else if (!PyDict_Check(dict))
|
||||
result = FALSE;
|
||||
else
|
||||
result = PyDict_GetItemString(dict, "create_configure_dialog") != NULL;
|
||||
|
||||
pyg_gil_state_release (state);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
_xed_plugin_python_set_instance (XedPluginPython *plugin,
|
||||
PyObject *instance)
|
||||
{
|
||||
PyGILState_STATE state = pyg_gil_state_ensure ();
|
||||
|
||||
/* we don't increment the instance here because we are the instance,
|
||||
when it dies, we also die */
|
||||
plugin->priv->instance = instance;
|
||||
pyg_gil_state_release (state);
|
||||
}
|
||||
|
||||
PyObject *
|
||||
_xed_plugin_python_get_instance (XedPluginPython *plugin)
|
||||
{
|
||||
return plugin->priv->instance;
|
||||
}
|
||||
|
||||
static void
|
||||
xed_plugin_python_init (XedPluginPython *plugin)
|
||||
{
|
||||
plugin->priv = XED_PLUGIN_PYTHON_GET_PRIVATE(plugin);
|
||||
|
||||
xed_debug_message (DEBUG_PLUGINS, "Creating Python plugin instance");
|
||||
plugin->priv->instance = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
xed_plugin_python_finalize (GObject *object)
|
||||
{
|
||||
PyGILState_STATE state;
|
||||
|
||||
xed_debug_message (DEBUG_PLUGINS, "Finalizing Python plugin instance");
|
||||
|
||||
state = pyg_gil_state_ensure ();
|
||||
Py_XDECREF (XED_PLUGIN_PYTHON(object)->priv->instance);
|
||||
pyg_gil_state_release (state);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_plugin_python_class_init (XedPluginPythonClass *klass)
|
||||
{
|
||||
XedPluginClass *plugin_class = XED_PLUGIN_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (XedPluginPythonPrivate));
|
||||
G_OBJECT_CLASS (klass)->finalize = xed_plugin_python_finalize;
|
||||
|
||||
plugin_class->activate = impl_activate;
|
||||
plugin_class->deactivate = impl_deactivate;
|
||||
plugin_class->update_ui = impl_update_ui;
|
||||
plugin_class->create_configure_dialog = impl_create_configure_dialog;
|
||||
plugin_class->is_configurable = impl_is_configurable;
|
||||
}
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
* xed-plugin-python.h
|
||||
* This file is part of xed
|
||||
*
|
||||
* Copyright (C) 2005 - Raphael Slinckx
|
||||
* Copyright (C) 2008 - 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_PLUGIN_PYTHON_H__
|
||||
#define __XED_PLUGIN_PYTHON_H__
|
||||
|
||||
#define NO_IMPORT_PYGOBJECT
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <pygobject.h>
|
||||
|
||||
#include <xed/xed-plugin.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Type checking and casting macros
|
||||
*/
|
||||
#define XED_TYPE_PLUGIN_PYTHON (xed_plugin_python_get_type())
|
||||
#define XED_PLUGIN_PYTHON(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XED_TYPE_PLUGIN_PYTHON, XedPluginPython))
|
||||
#define XED_PLUGIN_PYTHON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), XED_TYPE_PLUGIN_PYTHON, XedPluginPythonClass))
|
||||
#define XED_IS_PLUGIN_PYTHON(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), XED_TYPE_PLUGIN_PYTHON))
|
||||
#define XED_IS_PLUGIN_PYTHON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XED_TYPE_PLUGIN_PYTHON))
|
||||
#define XED_PLUGIN_PYTHON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), XED_TYPE_PLUGIN_PYTHON, XedPluginPythonClass))
|
||||
|
||||
/* Private structure type */
|
||||
typedef struct _XedPluginPythonPrivate XedPluginPythonPrivate;
|
||||
|
||||
/*
|
||||
* Main object structure
|
||||
*/
|
||||
typedef struct _XedPluginPython XedPluginPython;
|
||||
|
||||
struct _XedPluginPython
|
||||
{
|
||||
XedPlugin parent;
|
||||
|
||||
/*< private > */
|
||||
XedPluginPythonPrivate *priv;
|
||||
};
|
||||
|
||||
/*
|
||||
* Class definition
|
||||
*/
|
||||
typedef struct _XedPluginPythonClass XedPluginPythonClass;
|
||||
|
||||
struct _XedPluginPythonClass
|
||||
{
|
||||
XedPluginClass parent_class;
|
||||
};
|
||||
|
||||
/*
|
||||
* Public methods
|
||||
*/
|
||||
GType xed_plugin_python_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
/*
|
||||
* Private methods
|
||||
*/
|
||||
void _xed_plugin_python_set_instance (XedPluginPython *plugin,
|
||||
PyObject *instance);
|
||||
PyObject *_xed_plugin_python_get_instance (XedPluginPython *plugin);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __XED_PLUGIN_PYTHON_H__ */
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
DIST_SUBDIRS = \
|
||||
changecase \
|
||||
docinfo \
|
||||
filebrowser \
|
||||
modelines \
|
||||
|
@ -10,11 +9,11 @@ DIST_SUBDIRS = \
|
|||
trailsave
|
||||
|
||||
SUBDIRS = \
|
||||
changecase \
|
||||
docinfo \
|
||||
filebrowser \
|
||||
modelines \
|
||||
sort \
|
||||
spell \
|
||||
taglist \
|
||||
time \
|
||||
trailsave
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
# changecase plugin
|
||||
plugindir = $(XED_PLUGINS_LIBS_DIR)
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
$(XED_CFLAGS) \
|
||||
$(WARN_CFLAGS) \
|
||||
$(DISABLE_DEPRECATED_CFLAGS)
|
||||
|
||||
plugin_LTLIBRARIES = libchangecase.la
|
||||
|
||||
libchangecase_la_SOURCES = \
|
||||
xed-changecase-plugin.h \
|
||||
xed-changecase-plugin.c
|
||||
|
||||
libchangecase_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
|
||||
libchangecase_la_LIBADD = $(XED_LIBS)
|
||||
|
||||
uidir = $(XED_PLUGINS_DATA_DIR)/changecase
|
||||
ui_DATA =
|
||||
|
||||
plugin_in_files = changecase.xed-plugin.desktop.in
|
||||
|
||||
%.xed-plugin: %.xed-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:.xed-plugin.desktop.in=.xed-plugin)
|
||||
|
||||
EXTRA_DIST = $(ui_DATA) $(plugin_in_files)
|
||||
|
||||
CLEANFILES = $(plugin_DATA)
|
||||
DISTCLEANFILES = $(plugin_DATA)
|
||||
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
|
@ -1,8 +0,0 @@
|
|||
[Xed Plugin]
|
||||
Module=changecase
|
||||
IAge=2
|
||||
_Name=Change Case
|
||||
_Description=Changes the case of selected text.
|
||||
Authors=Paolo Borelli <pborelli@katamail.com>
|
||||
Copyright=Copyright © 2004-2005 Paolo Borelli
|
||||
Website=http://www.mate-desktop.org
|
|
@ -1,395 +0,0 @@
|
|||
/*
|
||||
* xed-changecase-plugin.c
|
||||
*
|
||||
* Copyright (C) 2004-2005 - Paolo Borelli
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "xed-changecase-plugin.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
#include <xed/xed-debug.h>
|
||||
|
||||
#define WINDOW_DATA_KEY "XedChangecasePluginWindowData"
|
||||
|
||||
XED_PLUGIN_REGISTER_TYPE(XedChangecasePlugin, xed_changecase_plugin)
|
||||
|
||||
typedef enum {
|
||||
TO_UPPER_CASE,
|
||||
TO_LOWER_CASE,
|
||||
INVERT_CASE,
|
||||
TO_TITLE_CASE,
|
||||
} ChangeCaseChoice;
|
||||
|
||||
static void
|
||||
do_upper_case (GtkTextBuffer *buffer,
|
||||
GtkTextIter *start,
|
||||
GtkTextIter *end)
|
||||
{
|
||||
GString *s = g_string_new (NULL);
|
||||
|
||||
while (!gtk_text_iter_is_end (start) &&
|
||||
!gtk_text_iter_equal (start, end))
|
||||
{
|
||||
gunichar c, nc;
|
||||
|
||||
c = gtk_text_iter_get_char (start);
|
||||
nc = g_unichar_toupper (c);
|
||||
g_string_append_unichar (s, nc);
|
||||
|
||||
gtk_text_iter_forward_char (start);
|
||||
}
|
||||
|
||||
gtk_text_buffer_delete_selection (buffer, TRUE, TRUE);
|
||||
gtk_text_buffer_insert_at_cursor (buffer, s->str, s->len);
|
||||
|
||||
g_string_free (s, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
do_lower_case (GtkTextBuffer *buffer,
|
||||
GtkTextIter *start,
|
||||
GtkTextIter *end)
|
||||
{
|
||||
GString *s = g_string_new (NULL);
|
||||
|
||||
while (!gtk_text_iter_is_end (start) &&
|
||||
!gtk_text_iter_equal (start, end))
|
||||
{
|
||||
gunichar c, nc;
|
||||
|
||||
c = gtk_text_iter_get_char (start);
|
||||
nc = g_unichar_tolower (c);
|
||||
g_string_append_unichar (s, nc);
|
||||
|
||||
gtk_text_iter_forward_char (start);
|
||||
}
|
||||
|
||||
gtk_text_buffer_delete_selection (buffer, TRUE, TRUE);
|
||||
gtk_text_buffer_insert_at_cursor (buffer, s->str, s->len);
|
||||
|
||||
g_string_free (s, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
do_invert_case (GtkTextBuffer *buffer,
|
||||
GtkTextIter *start,
|
||||
GtkTextIter *end)
|
||||
{
|
||||
GString *s = g_string_new (NULL);
|
||||
|
||||
while (!gtk_text_iter_is_end (start) &&
|
||||
!gtk_text_iter_equal (start, end))
|
||||
{
|
||||
gunichar c, nc;
|
||||
|
||||
c = gtk_text_iter_get_char (start);
|
||||
if (g_unichar_islower (c))
|
||||
nc = g_unichar_toupper (c);
|
||||
else
|
||||
nc = g_unichar_tolower (c);
|
||||
g_string_append_unichar (s, nc);
|
||||
|
||||
gtk_text_iter_forward_char (start);
|
||||
}
|
||||
|
||||
gtk_text_buffer_delete_selection (buffer, TRUE, TRUE);
|
||||
gtk_text_buffer_insert_at_cursor (buffer, s->str, s->len);
|
||||
|
||||
g_string_free (s, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
do_title_case (GtkTextBuffer *buffer,
|
||||
GtkTextIter *start,
|
||||
GtkTextIter *end)
|
||||
{
|
||||
GString *s = g_string_new (NULL);
|
||||
|
||||
while (!gtk_text_iter_is_end (start) &&
|
||||
!gtk_text_iter_equal (start, end))
|
||||
{
|
||||
gunichar c, nc;
|
||||
|
||||
c = gtk_text_iter_get_char (start);
|
||||
if (gtk_text_iter_starts_word (start))
|
||||
nc = g_unichar_totitle (c);
|
||||
else
|
||||
nc = g_unichar_tolower (c);
|
||||
g_string_append_unichar (s, nc);
|
||||
|
||||
gtk_text_iter_forward_char (start);
|
||||
}
|
||||
|
||||
gtk_text_buffer_delete_selection (buffer, TRUE, TRUE);
|
||||
gtk_text_buffer_insert_at_cursor (buffer, s->str, s->len);
|
||||
|
||||
g_string_free (s, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
change_case (XedWindow *window,
|
||||
ChangeCaseChoice choice)
|
||||
{
|
||||
XedDocument *doc;
|
||||
GtkTextIter start, end;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
doc = xed_window_get_active_document (window);
|
||||
g_return_if_fail (doc != NULL);
|
||||
|
||||
if (!gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (doc),
|
||||
&start, &end))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_text_buffer_begin_user_action (GTK_TEXT_BUFFER (doc));
|
||||
|
||||
switch (choice)
|
||||
{
|
||||
case TO_UPPER_CASE:
|
||||
do_upper_case (GTK_TEXT_BUFFER (doc), &start, &end);
|
||||
break;
|
||||
case TO_LOWER_CASE:
|
||||
do_lower_case (GTK_TEXT_BUFFER (doc), &start, &end);
|
||||
break;
|
||||
case INVERT_CASE:
|
||||
do_invert_case (GTK_TEXT_BUFFER (doc), &start, &end);
|
||||
break;
|
||||
case TO_TITLE_CASE:
|
||||
do_title_case (GTK_TEXT_BUFFER (doc), &start, &end);
|
||||
break;
|
||||
default:
|
||||
g_return_if_reached ();
|
||||
}
|
||||
|
||||
gtk_text_buffer_end_user_action (GTK_TEXT_BUFFER (doc));
|
||||
}
|
||||
|
||||
static void
|
||||
upper_case_cb (GtkAction *action,
|
||||
XedWindow *window)
|
||||
{
|
||||
change_case (window, TO_UPPER_CASE);
|
||||
}
|
||||
|
||||
static void
|
||||
lower_case_cb (GtkAction *action,
|
||||
XedWindow *window)
|
||||
{
|
||||
change_case (window, TO_LOWER_CASE);
|
||||
}
|
||||
|
||||
static void
|
||||
invert_case_cb (GtkAction *action,
|
||||
XedWindow *window)
|
||||
{
|
||||
change_case (window, INVERT_CASE);
|
||||
}
|
||||
|
||||
static void
|
||||
title_case_cb (GtkAction *action,
|
||||
XedWindow *window)
|
||||
{
|
||||
change_case (window, TO_TITLE_CASE);
|
||||
}
|
||||
|
||||
static const GtkActionEntry action_entries[] =
|
||||
{
|
||||
{ "ChangeCase", NULL, N_("C_hange Case") },
|
||||
{ "UpperCase", NULL, N_("All _Upper Case"), NULL,
|
||||
N_("Change selected text to upper case"),
|
||||
G_CALLBACK (upper_case_cb) },
|
||||
{ "LowerCase", NULL, N_("All _Lower Case"), NULL,
|
||||
N_("Change selected text to lower case"),
|
||||
G_CALLBACK (lower_case_cb) },
|
||||
{ "InvertCase", NULL, N_("_Invert Case"), NULL,
|
||||
N_("Invert the case of selected text"),
|
||||
G_CALLBACK (invert_case_cb) },
|
||||
{ "TitleCase", NULL, N_("_Title Case"), NULL,
|
||||
N_("Capitalize the first letter of each selected word"),
|
||||
G_CALLBACK (title_case_cb) }
|
||||
};
|
||||
|
||||
const gchar submenu[] =
|
||||
"<ui>"
|
||||
" <menubar name='MenuBar'>"
|
||||
" <menu name='EditMenu' action='Edit'>"
|
||||
" <placeholder name='EditOps_6'>"
|
||||
" <menu action='ChangeCase'>"
|
||||
" <menuitem action='UpperCase'/>"
|
||||
" <menuitem action='LowerCase'/>"
|
||||
" <menuitem action='InvertCase'/>"
|
||||
" <menuitem action='TitleCase'/>"
|
||||
" </menu>"
|
||||
" </placeholder>"
|
||||
" </menu>"
|
||||
" </menubar>"
|
||||
"</ui>";
|
||||
|
||||
static void
|
||||
xed_changecase_plugin_init (XedChangecasePlugin *plugin)
|
||||
{
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedChangecasePlugin initializing");
|
||||
}
|
||||
|
||||
static void
|
||||
xed_changecase_plugin_finalize (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (xed_changecase_plugin_parent_class)->finalize (object);
|
||||
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedChangecasePlugin finalizing");
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkActionGroup *action_group;
|
||||
guint ui_id;
|
||||
} WindowData;
|
||||
|
||||
static void
|
||||
free_window_data (WindowData *data)
|
||||
{
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
g_slice_free (WindowData, data);
|
||||
}
|
||||
|
||||
static void
|
||||
update_ui_real (XedWindow *window,
|
||||
WindowData *data)
|
||||
{
|
||||
GtkTextView *view;
|
||||
GtkAction *action;
|
||||
gboolean sensitive = FALSE;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
view = GTK_TEXT_VIEW (xed_window_get_active_view (window));
|
||||
|
||||
if (view != NULL)
|
||||
{
|
||||
GtkTextBuffer *buffer;
|
||||
|
||||
buffer = gtk_text_view_get_buffer (view);
|
||||
sensitive = (gtk_text_view_get_editable (view) &&
|
||||
gtk_text_buffer_get_has_selection (buffer));
|
||||
}
|
||||
|
||||
action = gtk_action_group_get_action (data->action_group,
|
||||
"ChangeCase");
|
||||
gtk_action_set_sensitive (action, sensitive);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_activate (XedPlugin *plugin,
|
||||
XedWindow *window)
|
||||
{
|
||||
GtkUIManager *manager;
|
||||
WindowData *data;
|
||||
GError *error = NULL;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
data = g_slice_new (WindowData);
|
||||
|
||||
manager = xed_window_get_ui_manager (window);
|
||||
|
||||
data->action_group = gtk_action_group_new ("XedChangecasePluginActions");
|
||||
gtk_action_group_set_translation_domain (data->action_group,
|
||||
GETTEXT_PACKAGE);
|
||||
gtk_action_group_add_actions (data->action_group,
|
||||
action_entries,
|
||||
G_N_ELEMENTS (action_entries),
|
||||
window);
|
||||
|
||||
gtk_ui_manager_insert_action_group (manager, data->action_group, -1);
|
||||
|
||||
data->ui_id = gtk_ui_manager_add_ui_from_string (manager,
|
||||
submenu,
|
||||
-1,
|
||||
&error);
|
||||
if (data->ui_id == 0)
|
||||
{
|
||||
g_warning ("%s", error->message);
|
||||
free_window_data (data);
|
||||
return;
|
||||
}
|
||||
|
||||
g_object_set_data_full (G_OBJECT (window),
|
||||
WINDOW_DATA_KEY,
|
||||
data,
|
||||
(GDestroyNotify) free_window_data);
|
||||
|
||||
update_ui_real (window, data);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_deactivate (XedPlugin *plugin,
|
||||
XedWindow *window)
|
||||
{
|
||||
GtkUIManager *manager;
|
||||
WindowData *data;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
manager = xed_window_get_ui_manager (window);
|
||||
|
||||
data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
gtk_ui_manager_remove_ui (manager, data->ui_id);
|
||||
gtk_ui_manager_remove_action_group (manager, data->action_group);
|
||||
|
||||
g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_update_ui (XedPlugin *plugin,
|
||||
XedWindow *window)
|
||||
{
|
||||
WindowData *data;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
update_ui_real (window, data);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_changecase_plugin_class_init (XedChangecasePluginClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
XedPluginClass *plugin_class = XED_PLUGIN_CLASS (klass);
|
||||
|
||||
object_class->finalize = xed_changecase_plugin_finalize;
|
||||
|
||||
plugin_class->activate = impl_activate;
|
||||
plugin_class->deactivate = impl_deactivate;
|
||||
plugin_class->update_ui = impl_update_ui;
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* xed-changecase-plugin.h
|
||||
*
|
||||
* Copyright (C) 2004-2005 - Paolo Borelli
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __XED_CHANGECASE_PLUGIN_H__
|
||||
#define __XED_CHANGECASE_PLUGIN_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <xed/xed-plugin.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Type checking and casting macros
|
||||
*/
|
||||
#define XED_TYPE_CHANGECASE_PLUGIN (xed_changecase_plugin_get_type ())
|
||||
#define XED_CHANGECASE_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), XED_TYPE_CHANGECASE_PLUGIN, XedChangecasePlugin))
|
||||
#define XED_CHANGECASE_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), XED_TYPE_CHANGECASE_PLUGIN, XedChangecasePluginClass))
|
||||
#define XED_IS_CHANGECASE_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), XED_TYPE_CHANGECASE_PLUGIN))
|
||||
#define XED_IS_CHANGECASE_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), XED_TYPE_CHANGECASE_PLUGIN))
|
||||
#define XED_CHANGECASE_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), XED_TYPE_CHANGECASE_PLUGIN, XedChangecasePluginClass))
|
||||
|
||||
/*
|
||||
* Main object structure
|
||||
*/
|
||||
typedef struct _XedChangecasePlugin XedChangecasePlugin;
|
||||
|
||||
struct _XedChangecasePlugin
|
||||
{
|
||||
XedPlugin parent_instance;
|
||||
};
|
||||
|
||||
/*
|
||||
* Class definition
|
||||
*/
|
||||
typedef struct _XedChangecasePluginClass XedChangecasePluginClass;
|
||||
|
||||
struct _XedChangecasePluginClass
|
||||
{
|
||||
XedPluginClass parent_class;
|
||||
};
|
||||
|
||||
/*
|
||||
* Public methods
|
||||
*/
|
||||
GType xed_changecase_plugin_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* All the plugins must implement this function */
|
||||
G_MODULE_EXPORT GType register_xed_plugin (GTypeModule *module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __XED_CHANGECASE_PLUGIN_H__ */
|
|
@ -19,11 +19,11 @@ libdocinfo_la_LIBADD = $(XED_LIBS)
|
|||
uidir = $(XED_PLUGINS_DATA_DIR)/docinfo
|
||||
ui_DATA = docinfo.ui
|
||||
|
||||
plugin_in_files = docinfo.xed-plugin.desktop.in
|
||||
plugin_in_files = docinfo.plugin.desktop.in
|
||||
|
||||
%.xed-plugin: %.xed-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: %.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:.xed-plugin.desktop.in=.xed-plugin)
|
||||
plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
|
||||
|
||||
EXTRA_DIST = $(ui_DATA) $(plugin_in_files)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[Xed Plugin]
|
||||
[Plugin]
|
||||
Module=docinfo
|
||||
IAge=2
|
||||
_Name=Document Statistics
|
|
@ -17,7 +17,6 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -28,20 +27,24 @@
|
|||
|
||||
#include <string.h> /* For strlen (...) */
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <pango/pango-break.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
#include <xed/xed-window.h>
|
||||
#include <xed/xed-window-activatable.h>
|
||||
#include <xed/xed-debug.h>
|
||||
#include <xed/xed-utils.h>
|
||||
|
||||
#define WINDOW_DATA_KEY "XedDocInfoWindowData"
|
||||
#define MENU_PATH "/MenuBar/ToolsMenu/ToolsOps_2"
|
||||
|
||||
XED_PLUGIN_REGISTER_TYPE(XedDocInfoPlugin, xed_docinfo_plugin)
|
||||
|
||||
typedef struct
|
||||
struct _XedDocInfoPluginPrivate
|
||||
{
|
||||
XedWindow *window;
|
||||
|
||||
GtkActionGroup *action_group;
|
||||
guint ui_id;
|
||||
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *file_name_label;
|
||||
GtkWidget *lines_label;
|
||||
|
@ -55,104 +58,22 @@ typedef struct
|
|||
GtkWidget *selected_chars_label;
|
||||
GtkWidget *selected_chars_ns_label;
|
||||
GtkWidget *selected_bytes_label;
|
||||
} DocInfoDialog;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
enum
|
||||
{
|
||||
XedPlugin *plugin;
|
||||
PROP_0,
|
||||
PROP_WINDOW
|
||||
};
|
||||
|
||||
GtkActionGroup *ui_action_group;
|
||||
guint ui_id;
|
||||
static void xed_window_activatable_iface_init (XedWindowActivatableInterface *iface);
|
||||
|
||||
DocInfoDialog *dialog;
|
||||
} WindowData;
|
||||
|
||||
static void docinfo_dialog_response_cb (GtkDialog *widget,
|
||||
gint res_id,
|
||||
XedWindow *window);
|
||||
|
||||
static void
|
||||
docinfo_dialog_destroy_cb (GObject *obj,
|
||||
WindowData *data)
|
||||
{
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
if (data != NULL)
|
||||
{
|
||||
g_free (data->dialog);
|
||||
data->dialog = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static DocInfoDialog *
|
||||
get_docinfo_dialog (XedWindow *window,
|
||||
WindowData *data)
|
||||
{
|
||||
DocInfoDialog *dialog;
|
||||
gchar *data_dir;
|
||||
gchar *ui_file;
|
||||
GtkWidget *content;
|
||||
GtkWidget *error_widget;
|
||||
gboolean ret;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
dialog = g_new (DocInfoDialog, 1);
|
||||
|
||||
data_dir = xed_plugin_get_data_dir (data->plugin);
|
||||
ui_file = g_build_filename (data_dir, "docinfo.ui", NULL);
|
||||
ret = xed_utils_get_ui_objects (ui_file,
|
||||
NULL,
|
||||
&error_widget,
|
||||
"dialog", &dialog->dialog,
|
||||
"docinfo_dialog_content", &content,
|
||||
"file_name_label", &dialog->file_name_label,
|
||||
"words_label", &dialog->words_label,
|
||||
"bytes_label", &dialog->bytes_label,
|
||||
"lines_label", &dialog->lines_label,
|
||||
"chars_label", &dialog->chars_label,
|
||||
"chars_ns_label", &dialog->chars_ns_label,
|
||||
"selection_vbox", &dialog->selection_vbox,
|
||||
"selected_words_label", &dialog->selected_words_label,
|
||||
"selected_bytes_label", &dialog->selected_bytes_label,
|
||||
"selected_lines_label", &dialog->selected_lines_label,
|
||||
"selected_chars_label", &dialog->selected_chars_label,
|
||||
"selected_chars_ns_label", &dialog->selected_chars_ns_label,
|
||||
NULL);
|
||||
|
||||
g_free (data_dir);
|
||||
g_free (ui_file);
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
const gchar *err_message;
|
||||
|
||||
err_message = gtk_label_get_label (GTK_LABEL (error_widget));
|
||||
xed_warning (GTK_WINDOW (window), "%s", err_message);
|
||||
|
||||
g_free (dialog);
|
||||
gtk_widget_destroy (error_widget);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog->dialog),
|
||||
GTK_RESPONSE_OK);
|
||||
gtk_window_set_transient_for (GTK_WINDOW (dialog->dialog),
|
||||
GTK_WINDOW (window));
|
||||
|
||||
g_signal_connect (dialog->dialog,
|
||||
"destroy",
|
||||
G_CALLBACK (docinfo_dialog_destroy_cb),
|
||||
data);
|
||||
|
||||
g_signal_connect (dialog->dialog,
|
||||
"response",
|
||||
G_CALLBACK (docinfo_dialog_response_cb),
|
||||
window);
|
||||
|
||||
return dialog;
|
||||
}
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedDocInfoPlugin,
|
||||
xed_docinfo_plugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
xed_window_activatable_iface_init))
|
||||
|
||||
static void
|
||||
calculate_info (XedDocument *doc,
|
||||
|
@ -167,10 +88,7 @@ calculate_info (XedDocument *doc,
|
|||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
text = gtk_text_buffer_get_slice (GTK_TEXT_BUFFER (doc),
|
||||
start,
|
||||
end,
|
||||
TRUE);
|
||||
text = gtk_text_buffer_get_slice (GTK_TEXT_BUFFER (doc), start, end, TRUE);
|
||||
|
||||
*chars = g_utf8_strlen (text, -1);
|
||||
*bytes = strlen (text);
|
||||
|
@ -182,21 +100,20 @@ calculate_info (XedDocument *doc,
|
|||
|
||||
attrs = g_new0 (PangoLogAttr, *chars + 1);
|
||||
|
||||
pango_get_log_attrs (text,
|
||||
-1,
|
||||
0,
|
||||
pango_language_from_string ("C"),
|
||||
attrs,
|
||||
*chars + 1);
|
||||
pango_get_log_attrs (text, -1, 0, pango_language_from_string ("C"), attrs, *chars + 1);
|
||||
|
||||
for (i = 0; i < (*chars); i++)
|
||||
{
|
||||
if (attrs[i].is_white)
|
||||
{
|
||||
++(*white_chars);
|
||||
}
|
||||
|
||||
if (attrs[i].is_word_start)
|
||||
{
|
||||
++(*words);
|
||||
}
|
||||
}
|
||||
|
||||
g_free (attrs);
|
||||
}
|
||||
|
@ -210,9 +127,10 @@ calculate_info (XedDocument *doc,
|
|||
}
|
||||
|
||||
static void
|
||||
docinfo_real (XedDocument *doc,
|
||||
DocInfoDialog *dialog)
|
||||
update_document_info (XedDocInfoPlugin *plugin,
|
||||
XedDocument *doc)
|
||||
{
|
||||
XedDocInfoPluginPrivate *priv;
|
||||
GtkTextIter start, end;
|
||||
gint words = 0;
|
||||
gint chars = 0;
|
||||
|
@ -224,18 +142,18 @@ docinfo_real (XedDocument *doc,
|
|||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (doc),
|
||||
&start,
|
||||
&end);
|
||||
priv = plugin->priv;
|
||||
|
||||
gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (doc), &start, &end);
|
||||
|
||||
lines = gtk_text_buffer_get_line_count (GTK_TEXT_BUFFER (doc));
|
||||
|
||||
calculate_info (doc,
|
||||
&start, &end,
|
||||
&chars, &words, &white_chars, &bytes);
|
||||
calculate_info (doc, &start, &end, &chars, &words, &white_chars, &bytes);
|
||||
|
||||
if (chars == 0)
|
||||
{
|
||||
lines = 0;
|
||||
}
|
||||
|
||||
xed_debug_message (DEBUG_PLUGINS, "Chars: %d", chars);
|
||||
xed_debug_message (DEBUG_PLUGINS, "Lines: %d", lines);
|
||||
|
@ -245,35 +163,36 @@ docinfo_real (XedDocument *doc,
|
|||
|
||||
doc_name = xed_document_get_short_name_for_display (doc);
|
||||
tmp_str = g_strdup_printf ("<span weight=\"bold\">%s</span>", doc_name);
|
||||
gtk_label_set_markup (GTK_LABEL (dialog->file_name_label), tmp_str);
|
||||
gtk_label_set_markup (GTK_LABEL (priv->file_name_label), tmp_str);
|
||||
g_free (doc_name);
|
||||
g_free (tmp_str);
|
||||
|
||||
tmp_str = g_strdup_printf("%d", lines);
|
||||
gtk_label_set_text (GTK_LABEL (dialog->lines_label), tmp_str);
|
||||
gtk_label_set_text (GTK_LABEL (priv->lines_label), tmp_str);
|
||||
g_free (tmp_str);
|
||||
|
||||
tmp_str = g_strdup_printf("%d", words);
|
||||
gtk_label_set_text (GTK_LABEL (dialog->words_label), tmp_str);
|
||||
gtk_label_set_text (GTK_LABEL (priv->words_label), tmp_str);
|
||||
g_free (tmp_str);
|
||||
|
||||
tmp_str = g_strdup_printf("%d", chars);
|
||||
gtk_label_set_text (GTK_LABEL (dialog->chars_label), tmp_str);
|
||||
gtk_label_set_text (GTK_LABEL (priv->chars_label), tmp_str);
|
||||
g_free (tmp_str);
|
||||
|
||||
tmp_str = g_strdup_printf("%d", chars - white_chars);
|
||||
gtk_label_set_text (GTK_LABEL (dialog->chars_ns_label), tmp_str);
|
||||
gtk_label_set_text (GTK_LABEL (priv->chars_ns_label), tmp_str);
|
||||
g_free (tmp_str);
|
||||
|
||||
tmp_str = g_strdup_printf("%d", bytes);
|
||||
gtk_label_set_text (GTK_LABEL (dialog->bytes_label), tmp_str);
|
||||
gtk_label_set_text (GTK_LABEL (priv->bytes_label), tmp_str);
|
||||
g_free (tmp_str);
|
||||
}
|
||||
|
||||
static void
|
||||
selectioninfo_real (XedDocument *doc,
|
||||
DocInfoDialog *dialog)
|
||||
update_selection_info (XedDocInfoPlugin *plugin,
|
||||
XedDocument *doc)
|
||||
{
|
||||
XedDocInfoPluginPrivate *priv;
|
||||
gboolean sel;
|
||||
GtkTextIter start, end;
|
||||
gint words = 0;
|
||||
|
@ -285,17 +204,15 @@ selectioninfo_real (XedDocument *doc,
|
|||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
sel = gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (doc),
|
||||
&start,
|
||||
&end);
|
||||
priv = plugin->priv;
|
||||
|
||||
sel = gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (doc), &start, &end);
|
||||
|
||||
if (sel)
|
||||
{
|
||||
lines = gtk_text_iter_get_line (&end) - gtk_text_iter_get_line (&start) + 1;
|
||||
|
||||
calculate_info (doc,
|
||||
&start, &end,
|
||||
&chars, &words, &white_chars, &bytes);
|
||||
calculate_info (doc, &start, &end, &chars, &words, &white_chars, &bytes);
|
||||
|
||||
xed_debug_message (DEBUG_PLUGINS, "Selected chars: %d", chars);
|
||||
xed_debug_message (DEBUG_PLUGINS, "Selected lines: %d", lines);
|
||||
|
@ -303,96 +220,56 @@ selectioninfo_real (XedDocument *doc,
|
|||
xed_debug_message (DEBUG_PLUGINS, "Selected chars non-space: %d", chars - white_chars);
|
||||
xed_debug_message (DEBUG_PLUGINS, "Selected bytes: %d", bytes);
|
||||
|
||||
gtk_widget_set_sensitive (dialog->selection_vbox, TRUE);
|
||||
gtk_widget_set_sensitive (priv->selection_vbox, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_set_sensitive (dialog->selection_vbox, FALSE);
|
||||
gtk_widget_set_sensitive (priv->selection_vbox, FALSE);
|
||||
|
||||
xed_debug_message (DEBUG_PLUGINS, "Selection empty");
|
||||
}
|
||||
|
||||
if (chars == 0)
|
||||
{
|
||||
lines = 0;
|
||||
}
|
||||
|
||||
tmp_str = g_strdup_printf("%d", lines);
|
||||
gtk_label_set_text (GTK_LABEL (dialog->selected_lines_label), tmp_str);
|
||||
gtk_label_set_text (GTK_LABEL (priv->selected_lines_label), tmp_str);
|
||||
g_free (tmp_str);
|
||||
|
||||
tmp_str = g_strdup_printf("%d", words);
|
||||
gtk_label_set_text (GTK_LABEL (dialog->selected_words_label), tmp_str);
|
||||
gtk_label_set_text (GTK_LABEL (priv->selected_words_label), tmp_str);
|
||||
g_free (tmp_str);
|
||||
|
||||
tmp_str = g_strdup_printf("%d", chars);
|
||||
gtk_label_set_text (GTK_LABEL (dialog->selected_chars_label), tmp_str);
|
||||
gtk_label_set_text (GTK_LABEL (priv->selected_chars_label), tmp_str);
|
||||
g_free (tmp_str);
|
||||
|
||||
tmp_str = g_strdup_printf("%d", chars - white_chars);
|
||||
gtk_label_set_text (GTK_LABEL (dialog->selected_chars_ns_label), tmp_str);
|
||||
gtk_label_set_text (GTK_LABEL (priv->selected_chars_ns_label), tmp_str);
|
||||
g_free (tmp_str);
|
||||
|
||||
tmp_str = g_strdup_printf("%d", bytes);
|
||||
gtk_label_set_text (GTK_LABEL (dialog->selected_bytes_label), tmp_str);
|
||||
gtk_label_set_text (GTK_LABEL (priv->selected_bytes_label), tmp_str);
|
||||
g_free (tmp_str);
|
||||
}
|
||||
|
||||
static void
|
||||
docinfo_cb (GtkAction *action,
|
||||
XedWindow *window)
|
||||
{
|
||||
XedDocument *doc;
|
||||
WindowData *data;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
data = (WindowData *) g_object_get_data (G_OBJECT (window),
|
||||
WINDOW_DATA_KEY);
|
||||
|
||||
doc = xed_window_get_active_document (window);
|
||||
g_return_if_fail (doc != NULL);
|
||||
|
||||
if (data->dialog != NULL)
|
||||
{
|
||||
gtk_window_present (GTK_WINDOW (data->dialog->dialog));
|
||||
gtk_widget_grab_focus (GTK_WIDGET (data->dialog->dialog));
|
||||
}
|
||||
else
|
||||
{
|
||||
DocInfoDialog *dialog;
|
||||
|
||||
dialog = get_docinfo_dialog (window, data);
|
||||
g_return_if_fail (dialog != NULL);
|
||||
|
||||
data->dialog = dialog;
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (dialog->dialog));
|
||||
}
|
||||
|
||||
docinfo_real (doc,
|
||||
data->dialog);
|
||||
selectioninfo_real (doc,
|
||||
data->dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
docinfo_dialog_response_cb (GtkDialog *widget,
|
||||
gint res_id,
|
||||
XedWindow *window)
|
||||
XedDocInfoPlugin *plugin)
|
||||
{
|
||||
WindowData *data;
|
||||
XedDocInfoPluginPrivate *priv;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
data = (WindowData *) g_object_get_data (G_OBJECT (window),
|
||||
WINDOW_DATA_KEY);
|
||||
priv = plugin->priv;
|
||||
|
||||
switch (res_id)
|
||||
{
|
||||
case GTK_RESPONSE_CLOSE:
|
||||
{
|
||||
xed_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_CLOSE");
|
||||
gtk_widget_destroy (data->dialog->dialog);
|
||||
|
||||
gtk_widget_destroy (priv->dialog);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -402,20 +279,102 @@ docinfo_dialog_response_cb (GtkDialog *widget,
|
|||
|
||||
xed_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_OK");
|
||||
|
||||
doc = xed_window_get_active_document (window);
|
||||
g_return_if_fail (doc != NULL);
|
||||
|
||||
docinfo_real (doc,
|
||||
data->dialog);
|
||||
|
||||
selectioninfo_real (doc,
|
||||
data->dialog);
|
||||
doc = xed_window_get_active_document (priv->window);
|
||||
|
||||
update_document_info (plugin, doc);
|
||||
update_selection_info (plugin, doc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
create_docinfo_dialog (XedDocInfoPlugin *plugin)
|
||||
{
|
||||
XedDocInfoPluginPrivate *priv;
|
||||
gchar *data_dir;
|
||||
gchar *ui_file;
|
||||
GtkWidget *content;
|
||||
GtkWidget *error_widget;
|
||||
gboolean ret;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
priv = plugin->priv;
|
||||
|
||||
data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (plugin));
|
||||
ui_file = g_build_filename (data_dir, "docinfo.ui", NULL);
|
||||
ret = xed_utils_get_ui_objects (ui_file,
|
||||
NULL,
|
||||
&error_widget,
|
||||
"dialog", &priv->dialog,
|
||||
"docinfo_dialog_content", &content,
|
||||
"file_name_label", &priv->file_name_label,
|
||||
"words_label", &priv->words_label,
|
||||
"bytes_label", &priv->bytes_label,
|
||||
"lines_label", &priv->lines_label,
|
||||
"chars_label", &priv->chars_label,
|
||||
"chars_ns_label", &priv->chars_ns_label,
|
||||
"selection_vbox", &priv->selection_vbox,
|
||||
"selected_words_label", &priv->selected_words_label,
|
||||
"selected_bytes_label", &priv->selected_bytes_label,
|
||||
"selected_lines_label", &priv->selected_lines_label,
|
||||
"selected_chars_label", &priv->selected_chars_label,
|
||||
"selected_chars_ns_label", &priv->selected_chars_ns_label,
|
||||
NULL);
|
||||
|
||||
g_free (data_dir);
|
||||
g_free (ui_file);
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
const gchar *err_message;
|
||||
|
||||
err_message = gtk_label_get_label (GTK_LABEL (error_widget));
|
||||
xed_warning (GTK_WINDOW (priv->window), "%s", err_message);
|
||||
|
||||
gtk_widget_destroy (error_widget);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (priv->dialog), GTK_RESPONSE_OK);
|
||||
gtk_window_set_transient_for (GTK_WINDOW (priv->dialog), GTK_WINDOW (priv->window));
|
||||
|
||||
g_signal_connect (priv->dialog, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &priv->dialog);
|
||||
g_signal_connect (priv->dialog, "response",
|
||||
G_CALLBACK (docinfo_dialog_response_cb), plugin);
|
||||
}
|
||||
|
||||
static void
|
||||
docinfo_cb (GtkAction *action,
|
||||
XedDocInfoPlugin *plugin)
|
||||
{
|
||||
XedDocInfoPluginPrivate *priv;
|
||||
XedDocument *doc;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
priv = plugin->priv;
|
||||
|
||||
doc = xed_window_get_active_document (priv->window);
|
||||
|
||||
if (priv->dialog != NULL)
|
||||
{
|
||||
gtk_window_present (GTK_WINDOW (priv->dialog));
|
||||
gtk_widget_grab_focus (GTK_WIDGET (priv->dialog));
|
||||
}
|
||||
else
|
||||
{
|
||||
create_docinfo_dialog (plugin);
|
||||
gtk_widget_show (GTK_WIDGET (priv->dialog));
|
||||
}
|
||||
|
||||
update_document_info (plugin, doc);
|
||||
update_selection_info (plugin, doc);
|
||||
}
|
||||
|
||||
static const GtkActionEntry action_entries[] =
|
||||
{
|
||||
{ "DocumentStatistics",
|
||||
|
@ -426,50 +385,24 @@ static const GtkActionEntry action_entries[] =
|
|||
G_CALLBACK (docinfo_cb) }
|
||||
};
|
||||
|
||||
static void
|
||||
free_window_data (WindowData *data)
|
||||
{
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
g_object_unref (data->plugin);
|
||||
|
||||
g_object_unref (data->ui_action_group);
|
||||
|
||||
if (data->dialog != NULL)
|
||||
{
|
||||
gtk_widget_destroy (data->dialog->dialog);
|
||||
}
|
||||
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
static void
|
||||
update_ui_real (XedWindow *window,
|
||||
WindowData *data)
|
||||
{
|
||||
XedView *view;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
view = xed_window_get_active_view (window);
|
||||
|
||||
gtk_action_group_set_sensitive (data->ui_action_group,
|
||||
(view != NULL));
|
||||
|
||||
if (data->dialog != NULL)
|
||||
{
|
||||
gtk_dialog_set_response_sensitive (GTK_DIALOG (data->dialog->dialog),
|
||||
GTK_RESPONSE_OK,
|
||||
(view != NULL));
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_docinfo_plugin_dispose (GObject *object)
|
||||
{
|
||||
XedDocInfoPlugin *plugin = XED_DOCINFO_PLUGIN (object);
|
||||
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedDocInfoPlugin dispose");
|
||||
|
||||
g_clear_object (&plugin->priv->action_group);
|
||||
g_clear_object (&plugin->priv->window);
|
||||
|
||||
G_OBJECT_CLASS (xed_docinfo_plugin_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -481,101 +414,150 @@ xed_docinfo_plugin_finalize (GObject *object)
|
|||
}
|
||||
|
||||
static void
|
||||
impl_activate (XedPlugin *plugin,
|
||||
XedWindow *window)
|
||||
xed_docinfo_plugin_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkUIManager *manager;
|
||||
WindowData *data;
|
||||
XedDocInfoPlugin *plugin = XED_DOCINFO_PLUGIN (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WINDOW:
|
||||
plugin->priv->window = XED_WINDOW (g_value_dup_object (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xed_docinfo_plugin_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XedDocInfoPlugin *plugin = XED_DOCINFO_PLUGIN (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WINDOW:
|
||||
g_value_set_object (value, plugin->priv->window);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
update_ui (XedDocInfoPlugin *plugin)
|
||||
{
|
||||
XedDocInfoPluginPrivate *priv;
|
||||
XedView *view;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
data = g_new (WindowData, 1);
|
||||
priv = plugin->priv;
|
||||
|
||||
data->plugin = g_object_ref (plugin);
|
||||
data->dialog = NULL;
|
||||
data->ui_action_group = gtk_action_group_new ("XedDocInfoPluginActions");
|
||||
view = xed_window_get_active_view (priv->window);
|
||||
|
||||
gtk_action_group_set_translation_domain (data->ui_action_group,
|
||||
GETTEXT_PACKAGE);
|
||||
gtk_action_group_add_actions (data->ui_action_group,
|
||||
action_entries,
|
||||
G_N_ELEMENTS (action_entries),
|
||||
window);
|
||||
gtk_action_group_set_sensitive (priv->action_group, (view != NULL));
|
||||
|
||||
manager = xed_window_get_ui_manager (window);
|
||||
gtk_ui_manager_insert_action_group (manager,
|
||||
data->ui_action_group,
|
||||
-1);
|
||||
if (priv->dialog != NULL)
|
||||
{
|
||||
gtk_dialog_set_response_sensitive (GTK_DIALOG (priv->dialog), GTK_RESPONSE_OK, (view != NULL));
|
||||
}
|
||||
}
|
||||
|
||||
data->ui_id = gtk_ui_manager_new_merge_id (manager);
|
||||
static void
|
||||
xed_docinfo_plugin_activate (XedWindowActivatable *activatable)
|
||||
{
|
||||
XedDocInfoPluginPrivate *priv;
|
||||
GtkUIManager *manager;
|
||||
|
||||
g_object_set_data_full (G_OBJECT (window),
|
||||
WINDOW_DATA_KEY,
|
||||
data,
|
||||
(GDestroyNotify) free_window_data);
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
priv = XED_DOCINFO_PLUGIN (activatable)->priv;
|
||||
manager = xed_window_get_ui_manager (priv->window);
|
||||
|
||||
priv->action_group = gtk_action_group_new ("XedDocinfoPluginActions");
|
||||
gtk_action_group_set_translation_domain (priv->action_group, GETTEXT_PACKAGE);
|
||||
gtk_action_group_add_actions (priv->action_group, action_entries, G_N_ELEMENTS (action_entries), activatable);
|
||||
|
||||
gtk_ui_manager_insert_action_group (manager, priv->action_group, -1);
|
||||
|
||||
priv->ui_id = gtk_ui_manager_new_merge_id (manager);
|
||||
|
||||
gtk_ui_manager_add_ui (manager,
|
||||
data->ui_id,
|
||||
priv->ui_id,
|
||||
MENU_PATH,
|
||||
"DocumentStatistics",
|
||||
"DocumentStatistics",
|
||||
GTK_UI_MANAGER_MENUITEM,
|
||||
FALSE);
|
||||
|
||||
update_ui_real (window,
|
||||
data);
|
||||
update_ui (XED_DOCINFO_PLUGIN (activatable));
|
||||
}
|
||||
|
||||
static void
|
||||
impl_deactivate (XedPlugin *plugin,
|
||||
XedWindow *window)
|
||||
xed_docinfo_plugin_deactivate (XedWindowActivatable *activatable)
|
||||
{
|
||||
XedDocInfoPluginPrivate *priv;
|
||||
GtkUIManager *manager;
|
||||
WindowData *data;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
manager = xed_window_get_ui_manager (window);
|
||||
priv = XED_DOCINFO_PLUGIN (activatable)->priv;
|
||||
manager = xed_window_get_ui_manager (priv->window);
|
||||
|
||||
data = (WindowData *) g_object_get_data (G_OBJECT (window),
|
||||
WINDOW_DATA_KEY);
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
gtk_ui_manager_remove_ui (manager,
|
||||
data->ui_id);
|
||||
gtk_ui_manager_remove_action_group (manager,
|
||||
data->ui_action_group);
|
||||
|
||||
g_object_set_data (G_OBJECT (window),
|
||||
WINDOW_DATA_KEY,
|
||||
NULL);
|
||||
gtk_ui_manager_remove_ui (manager, priv->ui_id);
|
||||
gtk_ui_manager_remove_action_group (manager, priv->action_group);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_update_ui (XedPlugin *plugin,
|
||||
XedWindow *window)
|
||||
xed_docinfo_plugin_update_state (XedWindowActivatable *activatable)
|
||||
{
|
||||
WindowData *data;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
data = (WindowData *) g_object_get_data (G_OBJECT (window),
|
||||
WINDOW_DATA_KEY);
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
update_ui_real (window,
|
||||
data);
|
||||
update_ui (XED_DOCINFO_PLUGIN (activatable));
|
||||
}
|
||||
|
||||
static void
|
||||
xed_docinfo_plugin_class_init (XedDocInfoPluginClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
XedPluginClass *plugin_class = XED_PLUGIN_CLASS (klass);
|
||||
|
||||
object_class->dispose = xed_docinfo_plugin_dispose;
|
||||
object_class->finalize = xed_docinfo_plugin_finalize;
|
||||
object_class->set_property = xed_docinfo_plugin_set_property;
|
||||
object_class->get_property = xed_docinfo_plugin_get_property;
|
||||
|
||||
plugin_class->activate = impl_activate;
|
||||
plugin_class->deactivate = impl_deactivate;
|
||||
plugin_class->update_ui = impl_update_ui;
|
||||
g_object_class_override_property (object_class, PROP_WINDOW, "window");
|
||||
|
||||
g_type_class_add_private (klass, sizeof (XedDocInfoPluginPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
xed_window_activatable_iface_init (XedWindowActivatableInterface *iface)
|
||||
{
|
||||
iface->activate = xed_docinfo_plugin_activate;
|
||||
iface->deactivate = xed_docinfo_plugin_deactivate;
|
||||
iface->update_state = xed_docinfo_plugin_update_state;
|
||||
}
|
||||
|
||||
static void
|
||||
xed_docinfo_plugin_class_finalize (XedDocInfoPluginClass *klass)
|
||||
{
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
peas_register_types (PeasObjectModule *module)
|
||||
{
|
||||
xed_docinfo_plugin_register_type (G_TYPE_MODULE (module));
|
||||
|
||||
peas_object_module_register_extension_type (module,
|
||||
XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
XED_TYPE_DOCINFO_PLUGIN);
|
||||
}
|
||||
|
|
|
@ -25,13 +25,11 @@
|
|||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <xed/xed-plugin.h>
|
||||
#include <libpeas/peas-extension-base.h>
|
||||
#include <libpeas/peas-object-module.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Type checking and casting macros
|
||||
*/
|
||||
#define XED_TYPE_DOCINFO_PLUGIN (xed_docinfo_plugin_get_type ())
|
||||
#define XED_DOCINFO_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), XED_TYPE_DOCINFO_PLUGIN, XedDocInfoPlugin))
|
||||
#define XED_DOCINFO_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), XED_TYPE_DOCINFO_PLUGIN, XedDocInfoPluginClass))
|
||||
|
@ -39,36 +37,27 @@ G_BEGIN_DECLS
|
|||
#define XED_IS_DOCINFO_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), XED_TYPE_DOCINFO_PLUGIN))
|
||||
#define XED_DOCINFO_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), XED_TYPE_DOCINFO_PLUGIN, XedDocInfoPluginClass))
|
||||
|
||||
/* Private structure type */
|
||||
typedef struct _XedDocInfoPluginPrivate XedDocInfoPluginPrivate;
|
||||
|
||||
/*
|
||||
* Main object structure
|
||||
*/
|
||||
typedef struct _XedDocInfoPlugin XedDocInfoPlugin;
|
||||
typedef struct _XedDocInfoPluginPrivate XedDocInfoPluginPrivate;
|
||||
typedef struct _XedDocInfoPluginClass XedDocInfoPluginClass;
|
||||
|
||||
struct _XedDocInfoPlugin
|
||||
{
|
||||
XedPlugin parent_instance;
|
||||
PeasExtensionBase parent;
|
||||
|
||||
XedDocInfoPluginPrivate *priv;
|
||||
};
|
||||
|
||||
/*
|
||||
* Class definition
|
||||
*/
|
||||
typedef struct _XedDocInfoPluginClass XedDocInfoPluginClass;
|
||||
|
||||
struct _XedDocInfoPluginClass
|
||||
{
|
||||
XedPluginClass parent_class;
|
||||
PeasExtensionBaseClass parent_class;
|
||||
};
|
||||
|
||||
/*
|
||||
* Public methods
|
||||
*/
|
||||
GType xed_docinfo_plugin_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* All the plugins must implement this function */
|
||||
G_MODULE_EXPORT GType register_xed_plugin (GTypeModule *module);
|
||||
G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -44,9 +44,9 @@ libfilebrowser_la_LIBADD = $(XED_LIBS)
|
|||
uidir = $(XED_PLUGINS_DATA_DIR)/filebrowser
|
||||
ui_DATA = xed-file-browser-widget-ui.xml
|
||||
|
||||
plugin_in_files = filebrowser.xed-plugin.desktop.in
|
||||
plugin_in_files = filebrowser.plugin.desktop.in
|
||||
|
||||
%.xed-plugin: %.xed-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: %.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)) > $@
|
||||
|
@ -63,7 +63,7 @@ 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:.xed-plugin.desktop.in=.xed-plugin)
|
||||
plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
|
||||
|
||||
@INTLTOOL_XML_NOMERGE_RULE@
|
||||
filebrowser_gschema_in = org.x.editor.plugins.filebrowser.gschema.xml.in
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[Xed Plugin]
|
||||
[Plugin]
|
||||
Loader=C
|
||||
Module=filebrowser
|
||||
IAge=2
|
|
@ -23,7 +23,6 @@
|
|||
#include <glib/gi18n.h>
|
||||
#include <gio/gio.h>
|
||||
#include <xed/xed-utils.h>
|
||||
#include <xed/xed-plugin.h>
|
||||
|
||||
#include "xed-file-bookmarks-store.h"
|
||||
#include "xed-file-browser-utils.h"
|
||||
|
@ -56,23 +55,23 @@ static gboolean find_with_flags (GtkTreeModel * model,
|
|||
guint flags,
|
||||
guint notflags);
|
||||
|
||||
XED_PLUGIN_DEFINE_TYPE(XedFileBookmarksStore, xed_file_bookmarks_store, GTK_TYPE_TREE_STORE)
|
||||
G_DEFINE_DYNAMIC_TYPE (XedFileBookmarksStore, xed_file_bookmarks_store, GTK_TYPE_TREE_STORE)
|
||||
|
||||
static void
|
||||
xed_file_bookmarks_store_dispose (GObject * object)
|
||||
{
|
||||
XedFileBookmarksStore *obj = XED_FILE_BOOKMARKS_STORE (object);
|
||||
|
||||
if (obj->priv->volume_monitor != NULL) {
|
||||
g_signal_handlers_disconnect_by_func (obj->priv->volume_monitor,
|
||||
on_fs_changed,
|
||||
obj);
|
||||
if (obj->priv->volume_monitor != NULL)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (obj->priv->volume_monitor, on_fs_changed, obj);
|
||||
|
||||
g_object_unref (obj->priv->volume_monitor);
|
||||
obj->priv->volume_monitor = NULL;
|
||||
}
|
||||
|
||||
if (obj->priv->bookmarks_monitor != NULL) {
|
||||
if (obj->priv->bookmarks_monitor != NULL)
|
||||
{
|
||||
g_object_unref (obj->priv->bookmarks_monitor);
|
||||
obj->priv->bookmarks_monitor = NULL;
|
||||
}
|
||||
|
@ -97,6 +96,12 @@ xed_file_bookmarks_store_class_init (XedFileBookmarksStoreClass *klass)
|
|||
g_type_class_add_private (object_class, sizeof (XedFileBookmarksStorePrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
xed_file_bookmarks_store_class_finalize (XedFileBookmarksStoreClass *klass)
|
||||
{
|
||||
/* dummy function - used by G_DEFINE_DYNAMIC_TYPE */
|
||||
}
|
||||
|
||||
static void
|
||||
xed_file_bookmarks_store_init (XedFileBookmarksStore * obj)
|
||||
{
|
||||
|
@ -124,8 +129,10 @@ add_node (XedFileBookmarksStore *model,
|
|||
-1);
|
||||
|
||||
if (iter != NULL)
|
||||
{
|
||||
*iter = newiter;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
add_file (XedFileBookmarksStore *model,
|
||||
|
@ -140,36 +147,52 @@ add_file (XedFileBookmarksStore *model,
|
|||
|
||||
native = g_file_is_native (file);
|
||||
|
||||
if (native && !g_file_query_exists (file, NULL)) {
|
||||
if (native && !g_file_query_exists (file, NULL))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (flags & XED_FILE_BOOKMARKS_STORE_IS_HOME)
|
||||
{
|
||||
pixbuf = xed_file_browser_utils_pixbuf_from_theme ("user-home", GTK_ICON_SIZE_MENU);
|
||||
}
|
||||
else if (flags & XED_FILE_BOOKMARKS_STORE_IS_DESKTOP)
|
||||
{
|
||||
pixbuf = xed_file_browser_utils_pixbuf_from_theme ("user-desktop", GTK_ICON_SIZE_MENU);
|
||||
}
|
||||
else if (flags & XED_FILE_BOOKMARKS_STORE_IS_ROOT)
|
||||
{
|
||||
pixbuf = xed_file_browser_utils_pixbuf_from_theme ("drive-harddisk", GTK_ICON_SIZE_MENU);
|
||||
}
|
||||
|
||||
if (pixbuf == NULL) {
|
||||
if (pixbuf == NULL)
|
||||
{
|
||||
/* getting the icon is a sync get_info call, so we just do it for local files */
|
||||
if (native) {
|
||||
if (native)
|
||||
{
|
||||
pixbuf = xed_file_browser_utils_pixbuf_from_file (file, GTK_ICON_SIZE_MENU);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
pixbuf = xed_file_browser_utils_pixbuf_from_theme ("folder", GTK_ICON_SIZE_MENU);
|
||||
}
|
||||
}
|
||||
|
||||
if (name == NULL) {
|
||||
if (name == NULL)
|
||||
{
|
||||
newname = xed_file_browser_utils_file_basename (file);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
newname = g_strdup (name);
|
||||
}
|
||||
|
||||
add_node (model, pixbuf, newname, G_OBJECT (file), flags, iter);
|
||||
|
||||
if (pixbuf)
|
||||
{
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
g_free (newname);
|
||||
|
||||
|
@ -183,17 +206,16 @@ check_mount_separator (XedFileBookmarksStore * model, guint flags,
|
|||
GtkTreeIter iter;
|
||||
gboolean found;
|
||||
|
||||
found =
|
||||
find_with_flags (GTK_TREE_MODEL (model), &iter, NULL,
|
||||
flags |
|
||||
XED_FILE_BOOKMARKS_STORE_IS_SEPARATOR, 0);
|
||||
found = find_with_flags (GTK_TREE_MODEL (model), &iter, NULL,
|
||||
flags | XED_FILE_BOOKMARKS_STORE_IS_SEPARATOR, 0);
|
||||
|
||||
if (added && !found) {
|
||||
if (added && !found)
|
||||
{
|
||||
/* Add the separator */
|
||||
add_node (model, NULL, NULL, NULL,
|
||||
flags | XED_FILE_BOOKMARKS_STORE_IS_SEPARATOR,
|
||||
NULL);
|
||||
} else if (!added && found) {
|
||||
add_node (model, NULL, NULL, NULL, flags | XED_FILE_BOOKMARKS_STORE_IS_SEPARATOR, NULL);
|
||||
}
|
||||
else if (!added && found)
|
||||
{
|
||||
remove_node (GTK_TREE_MODEL (model), &iter);
|
||||
}
|
||||
}
|
||||
|
@ -208,8 +230,7 @@ init_special_directories (XedFileBookmarksStore * model)
|
|||
if (path != NULL)
|
||||
{
|
||||
file = g_file_new_for_path (path);
|
||||
add_file (model, file, NULL, XED_FILE_BOOKMARKS_STORE_IS_HOME |
|
||||
XED_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR, NULL);
|
||||
add_file (model, file, NULL, XED_FILE_BOOKMARKS_STORE_IS_HOME | XED_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR, NULL);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
|
@ -294,7 +315,9 @@ add_fs (XedFileBookmarksStore *model,
|
|||
add_node (model, pixbuf, name, fs, flags | fsflags, iter);
|
||||
|
||||
if (pixbuf)
|
||||
{
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
g_free (name);
|
||||
check_mount_separator (model, XED_FILE_BOOKMARKS_STORE_IS_FS, TRUE);
|
||||
|
@ -434,7 +457,8 @@ init_mounts (XedFileBookmarksStore *model)
|
|||
static void
|
||||
init_fs (XedFileBookmarksStore * model)
|
||||
{
|
||||
if (model->priv->volume_monitor == NULL) {
|
||||
if (model->priv->volume_monitor == NULL)
|
||||
{
|
||||
const gchar **ptr;
|
||||
const gchar *signals[] = {
|
||||
"drive-connected", "drive-changed", "drive-disconnected",
|
||||
|
@ -448,9 +472,7 @@ init_fs (XedFileBookmarksStore * model)
|
|||
/* Connect signals */
|
||||
for (ptr = signals; *ptr; ptr++)
|
||||
{
|
||||
g_signal_connect (model->priv->volume_monitor,
|
||||
*ptr,
|
||||
G_CALLBACK (on_fs_changed), model);
|
||||
g_signal_connect (model->priv->volume_monitor, *ptr, G_CALLBACK (on_fs_changed), model);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -476,9 +498,12 @@ add_bookmark (XedFileBookmarksStore * model,
|
|||
|
||||
file = g_file_new_for_uri (uri);
|
||||
|
||||
if (g_file_is_native (file)) {
|
||||
if (g_file_is_native (file))
|
||||
{
|
||||
flags |= XED_FILE_BOOKMARKS_STORE_IS_LOCAL_BOOKMARK;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
flags |= XED_FILE_BOOKMARKS_STORE_IS_REMOTE_BOOKMARK;
|
||||
}
|
||||
|
||||
|
@ -500,33 +525,41 @@ init_bookmarks (XedFileBookmarksStore * model)
|
|||
gboolean added = FALSE;
|
||||
|
||||
/* Read the bookmarks file */
|
||||
bookmarks = g_build_filename (g_get_home_dir (),
|
||||
".gtk-bookmarks",
|
||||
NULL);
|
||||
bookmarks = g_build_filename (g_get_home_dir (), ".gtk-bookmarks", NULL);
|
||||
|
||||
if (g_file_get_contents (bookmarks, &contents, NULL, &error)) {
|
||||
if (g_file_get_contents (bookmarks, &contents, NULL, &error))
|
||||
{
|
||||
lines = g_strsplit (contents, "\n", 0);
|
||||
|
||||
for (line = lines; *line; ++line) {
|
||||
if (**line) {
|
||||
for (line = lines; *line; ++line)
|
||||
{
|
||||
if (**line)
|
||||
{
|
||||
GFile *location;
|
||||
gchar *pos;
|
||||
gchar *name;
|
||||
|
||||
/* CHECK: is this really utf8? */
|
||||
pos = g_utf8_strchr (*line, -1, ' ');
|
||||
|
||||
if (pos != NULL) {
|
||||
if (pos != NULL)
|
||||
{
|
||||
*pos = '\0';
|
||||
name = pos + 1;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
name = NULL;
|
||||
}
|
||||
|
||||
/* the bookmarks file should contain valid
|
||||
* URIs, but paranoia is good */
|
||||
if (xed_utils_is_valid_uri (*line)) {
|
||||
location = g_file_new_for_uri (*line);
|
||||
if (xed_utils_is_valid_location (location))
|
||||
{
|
||||
added |= add_bookmark (model, name, *line);
|
||||
}
|
||||
g_object_unref (location);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -534,24 +567,26 @@ init_bookmarks (XedFileBookmarksStore * model)
|
|||
g_free (contents);
|
||||
|
||||
/* Add a watch */
|
||||
if (model->priv->bookmarks_monitor == NULL) {
|
||||
if (model->priv->bookmarks_monitor == NULL)
|
||||
{
|
||||
GFile * file;
|
||||
|
||||
file = g_file_new_for_path (bookmarks);
|
||||
model->priv->bookmarks_monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, NULL);
|
||||
g_object_unref (file);
|
||||
|
||||
g_signal_connect (model->priv->bookmarks_monitor,
|
||||
"changed",
|
||||
(GCallback)on_bookmarks_file_changed,
|
||||
model);
|
||||
g_signal_connect (model->priv->bookmarks_monitor, "changed",
|
||||
(GCallback)on_bookmarks_file_changed, model);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The bookmarks file doesn't exist (which is perfectly fine) */
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
if (added) {
|
||||
if (added)
|
||||
{
|
||||
/* Bookmarks separator */
|
||||
add_node (model, NULL, NULL, NULL,
|
||||
XED_FILE_BOOKMARKS_STORE_IS_BOOKMARK |
|
||||
|
@ -590,7 +625,8 @@ utf8_casecmp (gchar const *s1, const gchar * s2)
|
|||
}
|
||||
|
||||
static gint
|
||||
bookmarks_compare_names (GtkTreeModel * model, GtkTreeIter * a,
|
||||
bookmarks_compare_names (GtkTreeModel * model,
|
||||
GtkTreeIter * a,
|
||||
GtkTreeIter * b)
|
||||
{
|
||||
gchar *n1;
|
||||
|
@ -609,17 +645,26 @@ bookmarks_compare_names (GtkTreeModel * model, GtkTreeIter * a,
|
|||
-1);
|
||||
|
||||
/* do not sort actual bookmarks to keep same order as in caja */
|
||||
if ((f1 & XED_FILE_BOOKMARKS_STORE_IS_BOOKMARK) &&
|
||||
(f2 & XED_FILE_BOOKMARKS_STORE_IS_BOOKMARK))
|
||||
if ((f1 & XED_FILE_BOOKMARKS_STORE_IS_BOOKMARK) && (f2 & XED_FILE_BOOKMARKS_STORE_IS_BOOKMARK))
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
else if (n1 == NULL && n2 == NULL)
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
else if (n1 == NULL)
|
||||
{
|
||||
result = -1;
|
||||
}
|
||||
else if (n2 == NULL)
|
||||
{
|
||||
result = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = utf8_casecmp (n1, n2);
|
||||
}
|
||||
|
||||
g_free (n1);
|
||||
g_free (n2);
|
||||
|
@ -628,7 +673,8 @@ bookmarks_compare_names (GtkTreeModel * model, GtkTreeIter * a,
|
|||
}
|
||||
|
||||
static gint
|
||||
bookmarks_compare_flags (GtkTreeModel * model, GtkTreeIter * a,
|
||||
bookmarks_compare_flags (GtkTreeModel * model,
|
||||
GtkTreeIter * a,
|
||||
GtkTreeIter * b)
|
||||
{
|
||||
guint f1;
|
||||
|
@ -638,48 +684,62 @@ bookmarks_compare_flags (GtkTreeModel * model, GtkTreeIter * a,
|
|||
|
||||
sep = XED_FILE_BOOKMARKS_STORE_IS_SEPARATOR;
|
||||
|
||||
gtk_tree_model_get (model, a,
|
||||
XED_FILE_BOOKMARKS_STORE_COLUMN_FLAGS, &f1,
|
||||
-1);
|
||||
gtk_tree_model_get (model, b,
|
||||
XED_FILE_BOOKMARKS_STORE_COLUMN_FLAGS, &f2,
|
||||
-1);
|
||||
gtk_tree_model_get (model, a, XED_FILE_BOOKMARKS_STORE_COLUMN_FLAGS, &f1, -1);
|
||||
gtk_tree_model_get (model, b, XED_FILE_BOOKMARKS_STORE_COLUMN_FLAGS, &f2, -1);
|
||||
|
||||
for (flags = flags_order; *flags != -1; ++flags) {
|
||||
if ((f1 & *flags) != (f2 & *flags)) {
|
||||
if (f1 & *flags) {
|
||||
for (flags = flags_order; *flags != -1; ++flags)
|
||||
{
|
||||
if ((f1 & *flags) != (f2 & *flags))
|
||||
{
|
||||
if (f1 & *flags)
|
||||
{
|
||||
return -1;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
} else if ((f1 & *flags) && (f1 & sep) != (f2 & sep)) {
|
||||
}
|
||||
else if ((f1 & *flags) && (f1 & sep) != (f2 & sep))
|
||||
{
|
||||
if (f1 & sep)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static gint
|
||||
bookmarks_compare_func (GtkTreeModel * model, GtkTreeIter * a,
|
||||
GtkTreeIter * b, gpointer user_data)
|
||||
bookmarks_compare_func (GtkTreeModel *model,
|
||||
GtkTreeIter *a,
|
||||
GtkTreeIter *b,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint result;
|
||||
|
||||
result = bookmarks_compare_flags (model, a, b);
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
result = bookmarks_compare_names (model, a, b);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
find_with_flags (GtkTreeModel * model, GtkTreeIter * iter, gpointer obj,
|
||||
guint flags, guint notflags)
|
||||
find_with_flags (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer obj,
|
||||
guint flags,
|
||||
guint notflags)
|
||||
{
|
||||
GtkTreeIter child;
|
||||
guint childflags = 0;
|
||||
|
@ -687,7 +747,9 @@ find_with_flags (GtkTreeModel * model, GtkTreeIter * iter, gpointer obj,
|
|||
gboolean fequal;
|
||||
|
||||
if (!gtk_tree_model_get_iter_first (model, &child))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
do {
|
||||
gtk_tree_model_get (model, &child,
|
||||
|
@ -699,11 +761,14 @@ find_with_flags (GtkTreeModel * model, GtkTreeIter * iter, gpointer obj,
|
|||
fequal = (obj == childobj);
|
||||
|
||||
if (childobj)
|
||||
{
|
||||
g_object_unref (childobj);
|
||||
}
|
||||
|
||||
if ((obj == NULL || fequal) &&
|
||||
(childflags & flags) == flags
|
||||
&& !(childflags & notflags)) {
|
||||
&& !(childflags & notflags))
|
||||
{
|
||||
*iter = child;
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -713,16 +778,17 @@ find_with_flags (GtkTreeModel * model, GtkTreeIter * iter, gpointer obj,
|
|||
}
|
||||
|
||||
static void
|
||||
remove_node (GtkTreeModel * model, GtkTreeIter * iter)
|
||||
remove_node (GtkTreeModel *model,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
guint flags;
|
||||
|
||||
gtk_tree_model_get (model, iter,
|
||||
XED_FILE_BOOKMARKS_STORE_COLUMN_FLAGS, &flags,
|
||||
-1);
|
||||
gtk_tree_model_get (model, iter, XED_FILE_BOOKMARKS_STORE_COLUMN_FLAGS, &flags, -1);
|
||||
|
||||
if (!(flags & XED_FILE_BOOKMARKS_STORE_IS_SEPARATOR)) {
|
||||
if (flags & XED_FILE_BOOKMARKS_STORE_IS_FS) {
|
||||
if (!(flags & XED_FILE_BOOKMARKS_STORE_IS_SEPARATOR))
|
||||
{
|
||||
if (flags & XED_FILE_BOOKMARKS_STORE_IS_FS)
|
||||
{
|
||||
check_mount_separator (XED_FILE_BOOKMARKS_STORE (model),
|
||||
flags & XED_FILE_BOOKMARKS_STORE_IS_FS,
|
||||
FALSE);
|
||||
|
@ -738,8 +804,8 @@ remove_bookmarks (XedFileBookmarksStore * model)
|
|||
GtkTreeIter iter;
|
||||
|
||||
while (find_with_flags (GTK_TREE_MODEL (model), &iter, NULL,
|
||||
XED_FILE_BOOKMARKS_STORE_IS_BOOKMARK,
|
||||
0)) {
|
||||
XED_FILE_BOOKMARKS_STORE_IS_BOOKMARK, 0))
|
||||
{
|
||||
remove_node (GTK_TREE_MODEL (model), &iter);
|
||||
}
|
||||
}
|
||||
|
@ -781,14 +847,14 @@ xed_file_bookmarks_store_new (void)
|
|||
return model;
|
||||
}
|
||||
|
||||
gchar *
|
||||
xed_file_bookmarks_store_get_uri (XedFileBookmarksStore * model,
|
||||
GFile *
|
||||
xed_file_bookmarks_store_get_location (XedFileBookmarksStore *model,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
GObject *obj;
|
||||
GFile *file = NULL;
|
||||
guint flags;
|
||||
gchar * ret = NULL;
|
||||
GFile *ret = NULL;
|
||||
gboolean isfs;
|
||||
|
||||
g_return_val_if_fail (XED_IS_FILE_BOOKMARKS_STORE (model), NULL);
|
||||
|
@ -802,7 +868,9 @@ xed_file_bookmarks_store_get_uri (XedFileBookmarksStore * model,
|
|||
-1);
|
||||
|
||||
if (obj == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
isfs = (flags & XED_FILE_BOOKMARKS_STORE_IS_FS);
|
||||
|
||||
|
@ -819,7 +887,7 @@ xed_file_bookmarks_store_get_uri (XedFileBookmarksStore * model,
|
|||
|
||||
if (file)
|
||||
{
|
||||
ret = g_file_get_uri (file);
|
||||
ret = g_file_dup (file);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
|
@ -876,4 +944,10 @@ on_bookmarks_file_changed (GFileMonitor * monitor,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
_xed_file_bookmarks_store_register_type (GTypeModule *type_module)
|
||||
{
|
||||
xed_file_bookmarks_store_register_type (type_module);
|
||||
}
|
||||
|
||||
// ex:ts=8:noet:
|
||||
|
|
|
@ -77,10 +77,10 @@ struct _XedFileBookmarksStoreClass
|
|||
};
|
||||
|
||||
GType xed_file_bookmarks_store_get_type (void) G_GNUC_CONST;
|
||||
GType xed_file_bookmarks_store_register_type (GTypeModule * module);
|
||||
void _xed_file_bookmarks_store_register_type (GTypeModule *type_module);
|
||||
|
||||
XedFileBookmarksStore *xed_file_bookmarks_store_new (void);
|
||||
gchar *xed_file_bookmarks_store_get_uri (XedFileBookmarksStore * model,
|
||||
GFile *xed_file_bookmarks_store_get_location (XedFileBookmarksStore * model,
|
||||
GtkTreeIter * iter);
|
||||
void xed_file_bookmarks_store_refresh (XedFileBookmarksStore * model);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
VOID:UINT,STRING
|
||||
VOID:STRING,STRING
|
||||
VOID:OBJECT,OBJECT
|
||||
BOOL:OBJECT,POINTER
|
||||
BOOL:POINTER
|
||||
BOOL:VOID
|
||||
|
|
|
@ -178,13 +178,16 @@ message_get_root_cb (XedMessageBus *bus,
|
|||
WindowData *data)
|
||||
{
|
||||
XedFileBrowserStore *store;
|
||||
gchar *uri;
|
||||
GFile *location;
|
||||
|
||||
store = xed_file_browser_widget_get_browser_store (data->widget);
|
||||
uri = xed_file_browser_store_get_virtual_root (store);
|
||||
location = xed_file_browser_store_get_virtual_root (store);
|
||||
|
||||
xed_message_set (message, "uri", uri, NULL);
|
||||
g_free (uri);
|
||||
if (location)
|
||||
{
|
||||
xed_message_set (message, "location", location, NULL);
|
||||
g_object_unref (location);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -192,10 +195,10 @@ message_set_root_cb (XedMessageBus *bus,
|
|||
XedMessage *message,
|
||||
WindowData *data)
|
||||
{
|
||||
gchar *root = NULL;
|
||||
gchar *virtual = NULL;
|
||||
GFile *root;
|
||||
GFile *virtual = NULL;
|
||||
|
||||
xed_message_get (message, "uri", &root, NULL);
|
||||
xed_message_get (message, "location", &root, NULL);
|
||||
|
||||
if (!root)
|
||||
return;
|
||||
|
@ -207,9 +210,6 @@ message_set_root_cb (XedMessageBus *bus,
|
|||
xed_file_browser_widget_set_root_and_virtual_root (data->widget, root, virtual);
|
||||
else
|
||||
xed_file_browser_widget_set_root (data->widget, root, TRUE);
|
||||
|
||||
g_free (root);
|
||||
g_free (virtual);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -278,23 +278,30 @@ message_set_emblem_cb (XedMessageBus *bus,
|
|||
|
||||
static gchar *
|
||||
item_id (const gchar *path,
|
||||
const gchar *uri)
|
||||
GFile *location)
|
||||
{
|
||||
return g_strconcat (path, "::", uri, NULL);
|
||||
gchar *uri;
|
||||
gchar *id;
|
||||
|
||||
uri = g_file_get_uri (location);
|
||||
id = g_strconcat (path, "::", uri, NULL);
|
||||
g_free (uri);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
track_row (WindowData *data,
|
||||
XedFileBrowserStore *store,
|
||||
GtkTreePath *path,
|
||||
const gchar *uri)
|
||||
GFile *location)
|
||||
{
|
||||
GtkTreeRowReference *ref;
|
||||
gchar *id;
|
||||
gchar *pathstr;
|
||||
|
||||
pathstr = gtk_tree_path_to_string (path);
|
||||
id = item_id (pathstr, uri);
|
||||
id = item_id (pathstr, location);
|
||||
|
||||
ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (store), path);
|
||||
g_hash_table_insert (data->row_tracking, g_strdup (id), ref);
|
||||
|
@ -311,28 +318,28 @@ set_item_message (WindowData *data,
|
|||
XedMessage *message)
|
||||
{
|
||||
XedFileBrowserStore *store;
|
||||
gchar *uri = NULL;
|
||||
GFile *location;
|
||||
guint flags = 0;
|
||||
gchar *track_id;
|
||||
|
||||
store = xed_file_browser_widget_get_browser_store (data->widget);
|
||||
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (store), iter,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_URI, &uri,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_LOCATION, &location,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags,
|
||||
-1);
|
||||
|
||||
if (!uri)
|
||||
if (!location)
|
||||
return;
|
||||
|
||||
if (path && gtk_tree_path_get_depth (path) != 0)
|
||||
track_id = track_row (data, store, path, uri);
|
||||
track_id = track_row (data, store, path, location);
|
||||
else
|
||||
track_id = NULL;
|
||||
|
||||
xed_message_set (message,
|
||||
"id", track_id,
|
||||
"uri", uri,
|
||||
"location", location,
|
||||
NULL);
|
||||
|
||||
if (xed_message_has_key (message, "is_directory"))
|
||||
|
@ -342,7 +349,6 @@ set_item_message (WindowData *data,
|
|||
NULL);
|
||||
}
|
||||
|
||||
g_free (uri);
|
||||
g_free (track_id);
|
||||
}
|
||||
|
||||
|
@ -353,19 +359,18 @@ custom_message_filter_func (XedFileBrowserWidget *widget,
|
|||
FilterData *data)
|
||||
{
|
||||
WindowData *wdata = get_window_data (data->window);
|
||||
gchar *uri = NULL;
|
||||
GFile *location;
|
||||
guint flags = 0;
|
||||
gboolean filter = FALSE;
|
||||
GtkTreePath *path;
|
||||
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (store), iter,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_URI, &uri,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_LOCATION, &location,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags,
|
||||
-1);
|
||||
|
||||
if (!uri || FILE_IS_DUMMY (flags))
|
||||
if (!location || FILE_IS_DUMMY (flags))
|
||||
{
|
||||
g_free (uri);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -420,7 +425,7 @@ message_add_filter_cb (XedMessageBus *bus,
|
|||
|
||||
// Check if the message type has the correct arguments
|
||||
if (xed_message_type_lookup (message_type, "id") != G_TYPE_STRING ||
|
||||
xed_message_type_lookup (message_type, "uri") != G_TYPE_STRING ||
|
||||
xed_message_type_lookup (message_type, "location") != G_TYPE_FILE ||
|
||||
xed_message_type_lookup (message_type, "is_directory") != G_TYPE_BOOLEAN ||
|
||||
xed_message_type_lookup (message_type, "filter") != G_TYPE_BOOLEAN)
|
||||
{
|
||||
|
@ -429,7 +434,7 @@ message_add_filter_cb (XedMessageBus *bus,
|
|||
|
||||
cbmessage = xed_message_type_instantiate (message_type,
|
||||
"id", NULL,
|
||||
"uri", NULL,
|
||||
"location", NULL,
|
||||
"is_directory", FALSE,
|
||||
"filter", FALSE,
|
||||
NULL);
|
||||
|
@ -647,13 +652,13 @@ register_methods (XedWindow *window,
|
|||
xed_message_bus_register (bus,
|
||||
MESSAGE_OBJECT_PATH, "get_root",
|
||||
1,
|
||||
"uri", G_TYPE_STRING,
|
||||
"location", G_TYPE_FILE,
|
||||
NULL);
|
||||
|
||||
xed_message_bus_register (bus,
|
||||
MESSAGE_OBJECT_PATH, "set_root",
|
||||
1,
|
||||
"uri", G_TYPE_STRING,
|
||||
"location", G_TYPE_FILE,
|
||||
"virtual", G_TYPE_STRING,
|
||||
NULL);
|
||||
|
||||
|
@ -749,11 +754,9 @@ store_row_inserted (XedFileBrowserStore *store,
|
|||
GtkTreeIter *iter,
|
||||
MessageCacheData *data)
|
||||
{
|
||||
gchar *uri = NULL;
|
||||
guint flags = 0;
|
||||
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (store), iter,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_URI, &uri,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags,
|
||||
-1);
|
||||
|
||||
|
@ -764,8 +767,6 @@ store_row_inserted (XedFileBrowserStore *store,
|
|||
set_item_message (wdata, iter, path, data->message);
|
||||
xed_message_bus_send_message_sync (wdata->bus, data->message);
|
||||
}
|
||||
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -774,14 +775,12 @@ store_row_deleted (XedFileBrowserStore *store,
|
|||
MessageCacheData *data)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
gchar *uri = NULL;
|
||||
guint flags = 0;
|
||||
|
||||
if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter, path))
|
||||
return;
|
||||
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_URI, &uri,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags,
|
||||
-1);
|
||||
|
||||
|
@ -792,8 +791,6 @@ store_row_deleted (XedFileBrowserStore *store,
|
|||
set_item_message (wdata, &iter, path, data->message);
|
||||
xed_message_bus_send_message_sync (wdata->bus, data->message);
|
||||
}
|
||||
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -802,20 +799,20 @@ store_virtual_root_changed (XedFileBrowserStore *store,
|
|||
MessageCacheData *data)
|
||||
{
|
||||
WindowData *wdata = get_window_data (data->window);
|
||||
gchar *uri;
|
||||
GFile *vroot;
|
||||
|
||||
uri = xed_file_browser_store_get_virtual_root (store);
|
||||
vroot = xed_file_browser_store_get_virtual_root (store);
|
||||
|
||||
if (!uri)
|
||||
if (!vroot)
|
||||
return;
|
||||
|
||||
xed_message_set (data->message,
|
||||
"uri", uri,
|
||||
"location", vroot,
|
||||
NULL);
|
||||
|
||||
xed_message_bus_send_message_sync (wdata->bus, data->message);
|
||||
|
||||
g_free (uri);
|
||||
g_object_unref (vroot);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -870,28 +867,28 @@ register_signals (XedWindow *window,
|
|||
MESSAGE_OBJECT_PATH, "root_changed",
|
||||
0,
|
||||
"id", G_TYPE_STRING,
|
||||
"uri", G_TYPE_STRING,
|
||||
"location", G_TYPE_FILE,
|
||||
NULL);
|
||||
|
||||
begin_loading_type = xed_message_bus_register (bus,
|
||||
MESSAGE_OBJECT_PATH, "begin_loading",
|
||||
0,
|
||||
"id", G_TYPE_STRING,
|
||||
"uri", G_TYPE_STRING,
|
||||
"location", G_TYPE_FILE,
|
||||
NULL);
|
||||
|
||||
end_loading_type = xed_message_bus_register (bus,
|
||||
MESSAGE_OBJECT_PATH, "end_loading",
|
||||
0,
|
||||
"id", G_TYPE_STRING,
|
||||
"uri", G_TYPE_STRING,
|
||||
"location", G_TYPE_FILE,
|
||||
NULL);
|
||||
|
||||
inserted_type = xed_message_bus_register (bus,
|
||||
MESSAGE_OBJECT_PATH, "inserted",
|
||||
0,
|
||||
"id", G_TYPE_STRING,
|
||||
"uri", G_TYPE_STRING,
|
||||
"location", G_TYPE_FILE,
|
||||
"is_directory", G_TYPE_BOOLEAN,
|
||||
NULL);
|
||||
|
||||
|
@ -899,7 +896,7 @@ register_signals (XedWindow *window,
|
|||
MESSAGE_OBJECT_PATH, "deleted",
|
||||
0,
|
||||
"id", G_TYPE_STRING,
|
||||
"uri", G_TYPE_STRING,
|
||||
"location", G_TYPE_FILE,
|
||||
"is_directory", G_TYPE_BOOLEAN,
|
||||
NULL);
|
||||
|
||||
|
@ -907,7 +904,7 @@ register_signals (XedWindow *window,
|
|||
|
||||
message = xed_message_type_instantiate (inserted_type,
|
||||
"id", NULL,
|
||||
"uri", NULL,
|
||||
"location", NULL,
|
||||
"is_directory", FALSE,
|
||||
NULL);
|
||||
|
||||
|
@ -923,7 +920,7 @@ register_signals (XedWindow *window,
|
|||
|
||||
message = xed_message_type_instantiate (deleted_type,
|
||||
"id", NULL,
|
||||
"uri", NULL,
|
||||
"location", NULL,
|
||||
"is_directory", FALSE,
|
||||
NULL);
|
||||
data->row_deleted_id =
|
||||
|
@ -936,7 +933,7 @@ register_signals (XedWindow *window,
|
|||
|
||||
message = xed_message_type_instantiate (root_changed_type,
|
||||
"id", NULL,
|
||||
"uri", NULL,
|
||||
"location", NULL,
|
||||
NULL);
|
||||
data->root_changed_id =
|
||||
g_signal_connect_data (store,
|
||||
|
@ -948,7 +945,7 @@ register_signals (XedWindow *window,
|
|||
|
||||
message = xed_message_type_instantiate (begin_loading_type,
|
||||
"id", NULL,
|
||||
"uri", NULL,
|
||||
"location", NULL,
|
||||
NULL);
|
||||
data->begin_loading_id =
|
||||
g_signal_connect_data (store,
|
||||
|
@ -960,7 +957,7 @@ register_signals (XedWindow *window,
|
|||
|
||||
message = xed_message_type_instantiate (end_loading_type,
|
||||
"id", NULL,
|
||||
"uri", NULL,
|
||||
"location", NULL,
|
||||
NULL);
|
||||
data->end_loading_id =
|
||||
g_signal_connect_data (store,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -24,13 +24,15 @@
|
|||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <xed/xed-plugin.h>
|
||||
#include <libpeas/peas-extension-base.h>
|
||||
#include <libpeas/peas-object-module.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Type checking and casting macros
|
||||
*/
|
||||
#define XED_TYPE_FILE_BROWSER_PLUGIN (filetree_plugin_get_type ())
|
||||
#define XED_TYPE_FILE_BROWSER_PLUGIN (xed_file_browser_plugin_get_type ())
|
||||
#define XED_FILE_BROWSER_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), XED_TYPE_FILE_BROWSER_PLUGIN, XedFileBrowserPlugin))
|
||||
#define XED_FILE_BROWSER_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), XED_TYPE_FILE_BROWSER_PLUGIN, XedFileBrowserPluginClass))
|
||||
#define XED_IS_FILE_BROWSER_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), XED_TYPE_FILE_BROWSER_PLUGIN))
|
||||
|
@ -44,7 +46,7 @@ typedef struct _XedFileBrowserPluginClass XedFileBrowserPluginClass;
|
|||
|
||||
struct _XedFileBrowserPlugin
|
||||
{
|
||||
XedPlugin parent_instance;
|
||||
PeasExtensionBase parent_instance;
|
||||
|
||||
/*< private > */
|
||||
XedFileBrowserPluginPrivate *priv;
|
||||
|
@ -54,16 +56,16 @@ struct _XedFileBrowserPlugin
|
|||
|
||||
struct _XedFileBrowserPluginClass
|
||||
{
|
||||
XedPluginClass parent_class;
|
||||
PeasExtensionBaseClass parent_class;
|
||||
};
|
||||
|
||||
/*
|
||||
* Public methods
|
||||
*/
|
||||
GType filetree_plugin_get_type (void) G_GNUC_CONST;
|
||||
GType xed_file_browser_plugin_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* All the plugins must implement this function */
|
||||
G_MODULE_EXPORT GType register_xed_plugin (GTypeModule * module);
|
||||
G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __XED_FILE_BROWSER_PLUGIN_H__ */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -37,7 +37,7 @@ typedef enum
|
|||
{
|
||||
XED_FILE_BROWSER_STORE_COLUMN_ICON = 0,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_NAME,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_URI,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_LOCATION,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_FLAGS,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_EMBLEM,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_NUM
|
||||
|
@ -81,8 +81,7 @@ typedef struct _XedFileBrowserStore XedFileBrowserStore;
|
|||
typedef struct _XedFileBrowserStoreClass XedFileBrowserStoreClass;
|
||||
typedef struct _XedFileBrowserStorePrivate XedFileBrowserStorePrivate;
|
||||
|
||||
typedef gboolean (*XedFileBrowserStoreFilterFunc) (XedFileBrowserStore
|
||||
* model,
|
||||
typedef gboolean (*XedFileBrowserStoreFilterFunc) (XedFileBrowserStore *model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer user_data);
|
||||
|
||||
|
@ -107,44 +106,37 @@ struct _XedFileBrowserStoreClass {
|
|||
gboolean (*no_trash) (XedFileBrowserStore *model,
|
||||
GList *files);
|
||||
void (*rename) (XedFileBrowserStore *model,
|
||||
const gchar * olduri,
|
||||
const gchar * newuri);
|
||||
GFile *oldfile,
|
||||
GFile *newfile);
|
||||
void (*begin_refresh) (XedFileBrowserStore *model);
|
||||
void (*end_refresh) (XedFileBrowserStore *model);
|
||||
void (*unload) (XedFileBrowserStore *model,
|
||||
const gchar * uri);
|
||||
GFile *location);
|
||||
};
|
||||
|
||||
GType xed_file_browser_store_get_type (void) G_GNUC_CONST;
|
||||
GType xed_file_browser_store_register_type (GTypeModule * module);
|
||||
void _xed_file_browser_store_register_type (GTypeModule *type_module);
|
||||
|
||||
XedFileBrowserStore *xed_file_browser_store_new (gchar const *root);
|
||||
XedFileBrowserStore *xed_file_browser_store_new (GFile *root);
|
||||
|
||||
XedFileBrowserStoreResult
|
||||
xed_file_browser_store_set_root_and_virtual_root (XedFileBrowserStore * model,
|
||||
gchar const *root,
|
||||
gchar const *virtual_root);
|
||||
XedFileBrowserStoreResult
|
||||
xed_file_browser_store_set_root (XedFileBrowserStore * model,
|
||||
gchar const *root);
|
||||
XedFileBrowserStoreResult
|
||||
xed_file_browser_store_set_virtual_root (XedFileBrowserStore * model,
|
||||
XedFileBrowserStoreResult xed_file_browser_store_set_root_and_virtual_root (XedFileBrowserStore *model,
|
||||
GFile *root,
|
||||
GFile *virtual_root);
|
||||
XedFileBrowserStoreResult xed_file_browser_store_set_root (XedFileBrowserStore *model,
|
||||
GFile *root);
|
||||
XedFileBrowserStoreResult xed_file_browser_store_set_virtual_root (XedFileBrowserStore *model,
|
||||
GtkTreeIter *iter);
|
||||
XedFileBrowserStoreResult
|
||||
xed_file_browser_store_set_virtual_root_from_string (XedFileBrowserStore * model,
|
||||
gchar const *root);
|
||||
XedFileBrowserStoreResult
|
||||
xed_file_browser_store_set_virtual_root_up (XedFileBrowserStore * model);
|
||||
XedFileBrowserStoreResult
|
||||
xed_file_browser_store_set_virtual_root_top (XedFileBrowserStore * model);
|
||||
XedFileBrowserStoreResult xed_file_browser_store_set_virtual_root_from_location (XedFileBrowserStore *model,
|
||||
GFile *root);
|
||||
XedFileBrowserStoreResult xed_file_browser_store_set_virtual_root_up (XedFileBrowserStore *model);
|
||||
XedFileBrowserStoreResult xed_file_browser_store_set_virtual_root_top (XedFileBrowserStore *model);
|
||||
|
||||
gboolean
|
||||
xed_file_browser_store_get_iter_virtual_root (XedFileBrowserStore * model,
|
||||
gboolean xed_file_browser_store_get_iter_virtual_root (XedFileBrowserStore *model,
|
||||
GtkTreeIter *iter);
|
||||
gboolean xed_file_browser_store_get_iter_root (XedFileBrowserStore *model,
|
||||
GtkTreeIter *iter);
|
||||
gchar * xed_file_browser_store_get_root (XedFileBrowserStore * model);
|
||||
gchar * xed_file_browser_store_get_virtual_root (XedFileBrowserStore * model);
|
||||
GFile * xed_file_browser_store_get_root (XedFileBrowserStore *model);
|
||||
GFile * xed_file_browser_store_get_virtual_root (XedFileBrowserStore *model);
|
||||
|
||||
gboolean xed_file_browser_store_iter_equal (XedFileBrowserStore *model,
|
||||
GtkTreeIter *iter1,
|
||||
|
@ -160,28 +152,24 @@ void _xed_file_browser_store_iter_expanded (XedFileBrowserStore * model
|
|||
void _xed_file_browser_store_iter_collapsed (XedFileBrowserStore *model,
|
||||
GtkTreeIter *iter);
|
||||
|
||||
XedFileBrowserStoreFilterMode
|
||||
xed_file_browser_store_get_filter_mode (XedFileBrowserStore * model);
|
||||
XedFileBrowserStoreFilterMode xed_file_browser_store_get_filter_mode (XedFileBrowserStore *model);
|
||||
void xed_file_browser_store_set_filter_mode (XedFileBrowserStore *model,
|
||||
XedFileBrowserStoreFilterMode mode);
|
||||
void xed_file_browser_store_set_filter_func (XedFileBrowserStore *model,
|
||||
XedFileBrowserStoreFilterFunc func,
|
||||
gpointer user_data);
|
||||
void xed_file_browser_store_refilter (XedFileBrowserStore *model);
|
||||
XedFileBrowserStoreFilterMode
|
||||
xed_file_browser_store_filter_mode_get_default (void);
|
||||
XedFileBrowserStoreFilterMode xed_file_browser_store_filter_mode_get_default (void);
|
||||
|
||||
void xed_file_browser_store_refresh (XedFileBrowserStore * model);
|
||||
gboolean xed_file_browser_store_rename (XedFileBrowserStore *model,
|
||||
GtkTreeIter *iter,
|
||||
gchar const *new_name,
|
||||
GError **error);
|
||||
XedFileBrowserStoreResult
|
||||
xed_file_browser_store_delete (XedFileBrowserStore * model,
|
||||
XedFileBrowserStoreResult xed_file_browser_store_delete (XedFileBrowserStore *model,
|
||||
GtkTreeIter *iter,
|
||||
gboolean trash);
|
||||
XedFileBrowserStoreResult
|
||||
xed_file_browser_store_delete_all (XedFileBrowserStore * model,
|
||||
XedFileBrowserStoreResult xed_file_browser_store_delete_all (XedFileBrowserStore *model,
|
||||
GList *rows,
|
||||
gboolean trash);
|
||||
|
||||
|
|
|
@ -128,20 +128,7 @@ xed_file_browser_utils_pixbuf_from_file (GFile * file,
|
|||
gchar *
|
||||
xed_file_browser_utils_file_basename (GFile * file)
|
||||
{
|
||||
gchar *uri;
|
||||
gchar *ret;
|
||||
|
||||
uri = g_file_get_uri (file);
|
||||
ret = xed_file_browser_utils_uri_basename (uri);
|
||||
g_free (uri);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
gchar *
|
||||
xed_file_browser_utils_uri_basename (gchar const * uri)
|
||||
{
|
||||
return xed_utils_basename_for_display (uri);
|
||||
return xed_utils_basename_for_display (file);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
@ -13,7 +13,6 @@ GdkPixbuf *xed_file_browser_utils_pixbuf_from_file (GFile * file,
|
|||
GtkIconSize size);
|
||||
|
||||
gchar * xed_file_browser_utils_file_basename (GFile * file);
|
||||
gchar * xed_file_browser_utils_uri_basename (gchar const * uri);
|
||||
|
||||
gboolean xed_file_browser_utils_confirmation_dialog (XedWindow * window,
|
||||
GtkMessageType type,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -37,7 +37,8 @@ typedef struct _XedFileBrowserView XedFileBrowserView;
|
|||
typedef struct _XedFileBrowserViewClass XedFileBrowserViewClass;
|
||||
typedef struct _XedFileBrowserViewPrivate XedFileBrowserViewPrivate;
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
XED_FILE_BROWSER_VIEW_CLICK_POLICY_DOUBLE,
|
||||
XED_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE
|
||||
} XedFileBrowserViewClickPolicy;
|
||||
|
@ -66,7 +67,7 @@ struct _XedFileBrowserViewClass
|
|||
};
|
||||
|
||||
GType xed_file_browser_view_get_type (void) G_GNUC_CONST;
|
||||
GType xed_file_browser_view_register_type (GTypeModule * module);
|
||||
void _xed_file_browser_view_register_type (GTypeModule *type_module);
|
||||
|
||||
GtkWidget *xed_file_browser_view_new (void);
|
||||
void xed_file_browser_view_set_model (XedFileBrowserView *tree_view,
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
#include <xed/xed-utils.h>
|
||||
#include <xed/xed-plugin.h>
|
||||
|
||||
#include "xed-file-browser-utils.h"
|
||||
#include "xed-file-browser-error.h"
|
||||
|
@ -81,7 +80,7 @@ enum
|
|||
/* Signals */
|
||||
enum
|
||||
{
|
||||
URI_ACTIVATED,
|
||||
LOCATION_ACTIVATED,
|
||||
ERROR,
|
||||
CONFIRM_DELETE,
|
||||
CONFIRM_NO_TRASH,
|
||||
|
@ -236,7 +235,7 @@ static void on_action_filter_binary (GtkAction * action,
|
|||
static void on_action_bookmark_open (GtkAction * action,
|
||||
XedFileBrowserWidget * obj);
|
||||
|
||||
XED_PLUGIN_DEFINE_TYPE (XedFileBrowserWidget, xed_file_browser_widget,
|
||||
G_DEFINE_DYNAMIC_TYPE (XedFileBrowserWidget, xed_file_browser_widget,
|
||||
GTK_TYPE_BOX)
|
||||
|
||||
static void
|
||||
|
@ -434,14 +433,14 @@ xed_file_browser_widget_class_init (XedFileBrowserWidgetClass * klass)
|
|||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
signals[URI_ACTIVATED] =
|
||||
g_signal_new ("uri-activated",
|
||||
signals[LOCATION_ACTIVATED] =
|
||||
g_signal_new ("location-activated",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (XedFileBrowserWidgetClass,
|
||||
uri_activated), NULL, NULL,
|
||||
g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1,
|
||||
G_TYPE_STRING);
|
||||
location_activated), NULL, NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
|
||||
G_TYPE_FILE);
|
||||
signals[ERROR] =
|
||||
g_signal_new ("error", G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
|
@ -479,6 +478,12 @@ xed_file_browser_widget_class_init (XedFileBrowserWidgetClass * klass)
|
|||
sizeof (XedFileBrowserWidgetPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
xed_file_browser_widget_class_finalize (XedFileBrowserWidgetClass *klass)
|
||||
{
|
||||
/* dummy function - used by G_DEFINE_DYNAMIC_TYPE */
|
||||
}
|
||||
|
||||
static void
|
||||
add_signal (XedFileBrowserWidget * obj, gpointer object, gulong id)
|
||||
{
|
||||
|
@ -795,18 +800,15 @@ static GtkActionEntry toplevel_actions[] =
|
|||
static const GtkActionEntry tree_actions_selection[] =
|
||||
{
|
||||
{"FileMoveToTrash", "user-trash", N_("_Move to Trash"), NULL,
|
||||
N_("Move selected file or folder to trash"),
|
||||
G_CALLBACK (on_action_file_move_to_trash)},
|
||||
N_("Move selected file or folder to trash"), G_CALLBACK (on_action_file_move_to_trash)},
|
||||
{"FileDelete", "edit-delete-symbolic", N_("_Delete"), NULL,
|
||||
N_("Delete selected file or folder"),
|
||||
G_CALLBACK (on_action_file_delete)}
|
||||
N_("Delete selected file or folder"), G_CALLBACK (on_action_file_delete)}
|
||||
};
|
||||
|
||||
static const GtkActionEntry tree_actions_file_selection[] =
|
||||
{
|
||||
{"FileOpen", "document-open-symbolic", N_("Open"), NULL,
|
||||
N_("Open selected file"),
|
||||
G_CALLBACK (on_action_file_open)}
|
||||
{"FileOpen", "document-open-symbolic", N_("_Open"), NULL,
|
||||
N_("Open selected file"), G_CALLBACK (on_action_file_open)}
|
||||
};
|
||||
|
||||
static const GtkActionEntry tree_actions[] =
|
||||
|
@ -818,8 +820,7 @@ static const GtkActionEntry tree_actions[] =
|
|||
static const GtkActionEntry tree_actions_single_most_selection[] =
|
||||
{
|
||||
{"DirectoryNew", "folder-new-symbolic", N_("_New Folder"), NULL,
|
||||
N_("Add new empty folder"),
|
||||
G_CALLBACK (on_action_directory_new)},
|
||||
N_("Add new empty folder"), G_CALLBACK (on_action_directory_new)},
|
||||
{"FileNew", "document-new-symbolic", N_("New F_ile"), NULL,
|
||||
N_("Add new empty file"), G_CALLBACK (on_action_file_new)}
|
||||
};
|
||||
|
@ -827,33 +828,27 @@ static const GtkActionEntry tree_actions_single_most_selection[] =
|
|||
static const GtkActionEntry tree_actions_single_selection[] =
|
||||
{
|
||||
{"FileRename", NULL, N_("_Rename"), NULL,
|
||||
N_("Rename selected file or folder"),
|
||||
G_CALLBACK (on_action_file_rename)}
|
||||
N_("Rename selected file or folder"), G_CALLBACK (on_action_file_rename)}
|
||||
};
|
||||
|
||||
static const GtkActionEntry tree_actions_sensitive[] =
|
||||
{
|
||||
{"DirectoryPrevious", "go-previous-symbolic", N_("_Previous Location"), NULL,
|
||||
N_("Go to the previous visited location"),
|
||||
G_CALLBACK (on_action_directory_previous)},
|
||||
N_("Go to the previous visited location"), G_CALLBACK (on_action_directory_previous)},
|
||||
{"DirectoryNext", "go-next-symbolic", N_("_Next Location"), NULL,
|
||||
N_("Go to the next visited location"), G_CALLBACK (on_action_directory_next)},
|
||||
{"DirectoryRefresh", "view-refresh-symbolic", N_("Re_fresh View"), NULL,
|
||||
N_("Refresh the view"), G_CALLBACK (on_action_directory_refresh)},
|
||||
{"DirectoryOpen", "folder-open-symbolic", N_("_View Folder"), NULL,
|
||||
N_("View folder in file manager"),
|
||||
G_CALLBACK (on_action_directory_open)}
|
||||
N_("View folder in file manager"), G_CALLBACK (on_action_directory_open)}
|
||||
};
|
||||
|
||||
static const GtkToggleActionEntry tree_actions_toggle[] =
|
||||
{
|
||||
{"FilterHidden", GTK_STOCK_DIALOG_AUTHENTICATION,
|
||||
N_("Show _Hidden"), NULL,
|
||||
N_("Show hidden files and folders"),
|
||||
G_CALLBACK (on_action_filter_hidden), FALSE},
|
||||
{"FilterHidden", GTK_STOCK_DIALOG_AUTHENTICATION, 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}
|
||||
N_("Show binary files"), G_CALLBACK (on_action_filter_binary), FALSE}
|
||||
};
|
||||
|
||||
static const GtkActionEntry bookmark_actions[] =
|
||||
|
@ -1065,22 +1060,18 @@ add_bookmark_hash (XedFileBrowserWidget * obj,
|
|||
GtkTreeModel *model;
|
||||
GdkPixbuf * pixbuf;
|
||||
gchar * name;
|
||||
gchar * uri;
|
||||
GFile * file;
|
||||
GFile * location;
|
||||
NameIcon * item;
|
||||
|
||||
model = GTK_TREE_MODEL (obj->priv->bookmarks_store);
|
||||
|
||||
uri = xed_file_bookmarks_store_get_uri (obj->priv->
|
||||
location = xed_file_bookmarks_store_get_location (obj->priv->
|
||||
bookmarks_store,
|
||||
iter);
|
||||
|
||||
if (uri == NULL)
|
||||
if (location == NULL)
|
||||
return;
|
||||
|
||||
file = g_file_new_for_uri (uri);
|
||||
g_free (uri);
|
||||
|
||||
gtk_tree_model_get (model, iter,
|
||||
XED_FILE_BOOKMARKS_STORE_COLUMN_ICON,
|
||||
&pixbuf,
|
||||
|
@ -1092,7 +1083,7 @@ add_bookmark_hash (XedFileBrowserWidget * obj,
|
|||
item->icon = pixbuf;
|
||||
|
||||
g_hash_table_insert (obj->priv->bookmarks_hash,
|
||||
file,
|
||||
location,
|
||||
item);
|
||||
}
|
||||
|
||||
|
@ -1586,8 +1577,6 @@ jump_to_location (XedFileBrowserWidget * obj, GList * item,
|
|||
GList *(*iter_func) (GList *);
|
||||
GtkWidget *menu_from;
|
||||
GtkWidget *menu_to;
|
||||
gchar *root;
|
||||
gchar *virtual_root;
|
||||
|
||||
if (!obj->priv->locations)
|
||||
return;
|
||||
|
@ -1648,15 +1637,9 @@ jump_to_location (XedFileBrowserWidget * obj, GList * item,
|
|||
loc = (Location *) (obj->priv->current_location->data);
|
||||
|
||||
/* Set the new root + virtual root */
|
||||
root = g_file_get_uri (loc->root);
|
||||
virtual_root = g_file_get_uri (loc->virtual_root);
|
||||
|
||||
xed_file_browser_widget_set_root_and_virtual_root (obj,
|
||||
root,
|
||||
virtual_root);
|
||||
|
||||
g_free (root);
|
||||
g_free (virtual_root);
|
||||
loc->root,
|
||||
loc->virtual_root);
|
||||
|
||||
obj->priv->changing_location = FALSE;
|
||||
}
|
||||
|
@ -1845,8 +1828,8 @@ xed_file_browser_widget_show_files (XedFileBrowserWidget * obj)
|
|||
|
||||
void
|
||||
xed_file_browser_widget_set_root_and_virtual_root (XedFileBrowserWidget *obj,
|
||||
gchar const *root,
|
||||
gchar const *virtual_root)
|
||||
GFile *root,
|
||||
GFile *virtual_root)
|
||||
{
|
||||
XedFileBrowserStoreResult result;
|
||||
|
||||
|
@ -1865,12 +1848,10 @@ xed_file_browser_widget_set_root_and_virtual_root (XedFileBrowserWidget *obj,
|
|||
|
||||
void
|
||||
xed_file_browser_widget_set_root (XedFileBrowserWidget * obj,
|
||||
gchar const *root,
|
||||
GFile *root,
|
||||
gboolean virtual_root)
|
||||
{
|
||||
GFile *file;
|
||||
GFile *parent;
|
||||
gchar *str;
|
||||
|
||||
if (!virtual_root) {
|
||||
xed_file_browser_widget_set_root_and_virtual_root (obj,
|
||||
|
@ -1882,16 +1863,11 @@ xed_file_browser_widget_set_root (XedFileBrowserWidget * obj,
|
|||
if (!root)
|
||||
return;
|
||||
|
||||
file = g_file_new_for_uri (root);
|
||||
parent = get_topmost_file (file);
|
||||
str = g_file_get_uri (parent);
|
||||
parent = get_topmost_file (root);
|
||||
|
||||
xed_file_browser_widget_set_root_and_virtual_root
|
||||
(obj, str, root);
|
||||
(obj, parent, root);
|
||||
|
||||
g_free (str);
|
||||
|
||||
g_object_unref (file);
|
||||
g_object_unref (parent);
|
||||
}
|
||||
|
||||
|
@ -2118,7 +2094,6 @@ activate_mount (XedFileBrowserWidget *widget,
|
|||
GMount *mount)
|
||||
{
|
||||
GFile *root;
|
||||
gchar *uri;
|
||||
|
||||
if (!mount)
|
||||
{
|
||||
|
@ -2140,11 +2115,9 @@ activate_mount (XedFileBrowserWidget *widget,
|
|||
}
|
||||
|
||||
root = g_mount_get_root (mount);
|
||||
uri = g_file_get_uri (root);
|
||||
|
||||
xed_file_browser_widget_set_root (widget, uri, FALSE);
|
||||
xed_file_browser_widget_set_root (widget, root, FALSE);
|
||||
|
||||
g_free (uri);
|
||||
g_object_unref (root);
|
||||
}
|
||||
|
||||
|
@ -2375,7 +2348,7 @@ bookmark_open (XedFileBrowserWidget *obj,
|
|||
GtkTreeModel *model,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
gchar *uri;
|
||||
GFile *location;
|
||||
gint flags;
|
||||
|
||||
gtk_tree_model_get (model, iter,
|
||||
|
@ -2397,11 +2370,11 @@ bookmark_open (XedFileBrowserWidget *obj,
|
|||
return;
|
||||
}
|
||||
|
||||
uri =
|
||||
xed_file_bookmarks_store_get_uri
|
||||
location =
|
||||
xed_file_bookmarks_store_get_location
|
||||
(XED_FILE_BOOKMARKS_STORE (model), iter);
|
||||
|
||||
if (uri) {
|
||||
if (location) {
|
||||
/* here we check if the bookmark is a mount point, or if it
|
||||
is a remote bookmark. If that's the case, we will set the
|
||||
root to the uri of the bookmark and not try to set the
|
||||
|
@ -2410,18 +2383,18 @@ bookmark_open (XedFileBrowserWidget *obj,
|
|||
if ((flags & XED_FILE_BOOKMARKS_STORE_IS_MOUNT) ||
|
||||
(flags & XED_FILE_BOOKMARKS_STORE_IS_REMOTE_BOOKMARK)) {
|
||||
xed_file_browser_widget_set_root (obj,
|
||||
uri,
|
||||
location,
|
||||
FALSE);
|
||||
} else {
|
||||
xed_file_browser_widget_set_root (obj,
|
||||
uri,
|
||||
location,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
g_object_unref (location);
|
||||
} else {
|
||||
g_warning ("No uri!");
|
||||
}
|
||||
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2429,19 +2402,17 @@ file_open (XedFileBrowserWidget *obj,
|
|||
GtkTreeModel *model,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
gchar *uri;
|
||||
GFile *location;
|
||||
gint flags;
|
||||
|
||||
gtk_tree_model_get (model, iter,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_URI, &uri,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_LOCATION, &location,
|
||||
-1);
|
||||
|
||||
if (!FILE_IS_DIR (flags) && !FILE_IS_DUMMY (flags)) {
|
||||
g_signal_emit (obj, signals[URI_ACTIVATED], 0, uri);
|
||||
g_signal_emit (obj, signals[LOCATION_ACTIVATED], 0, location);
|
||||
}
|
||||
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -2451,17 +2422,20 @@ directory_open (XedFileBrowserWidget *obj,
|
|||
{
|
||||
gboolean result = FALSE;
|
||||
GError *error = NULL;
|
||||
gchar *uri = NULL;
|
||||
GFile *location;
|
||||
XedFileBrowserStoreFlag flags;
|
||||
|
||||
gtk_tree_model_get (model, iter,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_URI, &uri,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_LOCATION, &location,
|
||||
-1);
|
||||
|
||||
if (FILE_IS_DIR (flags)) {
|
||||
if (FILE_IS_DIR (flags) && location) {
|
||||
gchar *uri;
|
||||
result = TRUE;
|
||||
|
||||
uri = g_file_get_uri (location);
|
||||
|
||||
if (!gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (obj)), uri, GDK_CURRENT_TIME, &error)) {
|
||||
g_signal_emit (obj, signals[ERROR], 0,
|
||||
XED_FILE_BROWSER_ERROR_OPEN_DIRECTORY,
|
||||
|
@ -2470,9 +2444,9 @@ directory_open (XedFileBrowserWidget *obj,
|
|||
g_error_free (error);
|
||||
error = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -2519,8 +2493,7 @@ on_virtual_root_changed (XedFileBrowserStore * model,
|
|||
XedFileBrowserWidget * obj)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
gchar *uri;
|
||||
gchar *root_uri;
|
||||
GFile *location;
|
||||
GtkTreeIter root;
|
||||
GtkAction *action;
|
||||
Location *loc;
|
||||
|
@ -2534,8 +2507,8 @@ on_virtual_root_changed (XedFileBrowserStore * model,
|
|||
|
||||
if (xed_file_browser_store_get_iter_virtual_root (model, &iter)) {
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
|
||||
XED_FILE_BROWSER_STORE_COLUMN_URI,
|
||||
&uri, -1);
|
||||
XED_FILE_BROWSER_STORE_COLUMN_LOCATION,
|
||||
&location, -1);
|
||||
|
||||
if (xed_file_browser_store_get_iter_root (model, &root)) {
|
||||
if (!obj->priv->changing_location) {
|
||||
|
@ -2543,14 +2516,9 @@ on_virtual_root_changed (XedFileBrowserStore * model,
|
|||
if (obj->priv->current_location)
|
||||
clear_next_locations (obj);
|
||||
|
||||
root_uri =
|
||||
xed_file_browser_store_get_root
|
||||
(model);
|
||||
|
||||
loc = g_new (Location, 1);
|
||||
loc->root = g_file_new_for_uri (root_uri);
|
||||
loc->virtual_root = g_file_new_for_uri (uri);
|
||||
g_free (root_uri);
|
||||
loc->root = xed_file_browser_store_get_root (model);
|
||||
loc->virtual_root = g_object_ref (location);
|
||||
|
||||
if (obj->priv->current_location) {
|
||||
/* Add current location to the menu so we can go back
|
||||
|
@ -2619,7 +2587,6 @@ on_virtual_root_changed (XedFileBrowserStore * model,
|
|||
}
|
||||
|
||||
check_current_item (obj, TRUE);
|
||||
g_free (uri);
|
||||
} else {
|
||||
g_message ("NO!");
|
||||
}
|
||||
|
@ -2699,7 +2666,6 @@ on_combo_changed (GtkComboBox * combo, XedFileBrowserWidget * obj)
|
|||
{
|
||||
GtkTreeIter iter;
|
||||
guint id;
|
||||
gchar * uri;
|
||||
GFile * file;
|
||||
|
||||
if (!gtk_combo_box_get_active_iter (combo, &iter))
|
||||
|
@ -2718,11 +2684,8 @@ on_combo_changed (GtkComboBox * combo, XedFileBrowserWidget * obj)
|
|||
(obj->priv->combo_model), &iter,
|
||||
COLUMN_FILE, &file, -1);
|
||||
|
||||
uri = g_file_get_uri (file);
|
||||
xed_file_browser_store_set_virtual_root_from_string
|
||||
(obj->priv->file_store, uri);
|
||||
xed_file_browser_store_set_virtual_root_from_location (obj->priv->file_store, file);
|
||||
|
||||
g_free (uri);
|
||||
g_object_unref (file);
|
||||
break;
|
||||
}
|
||||
|
@ -2907,22 +2870,19 @@ on_bookmarks_row_deleted (GtkTreeModel * model,
|
|||
XedFileBrowserWidget *obj)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
gchar * uri;
|
||||
GFile * file;
|
||||
GFile *location;
|
||||
|
||||
if (!gtk_tree_model_get_iter (model, &iter, path))
|
||||
return;
|
||||
|
||||
uri = xed_file_bookmarks_store_get_uri (obj->priv->bookmarks_store, &iter);
|
||||
location = xed_file_bookmarks_store_get_location (obj->priv->bookmarks_store, &iter);
|
||||
|
||||
if (!uri)
|
||||
if (!location)
|
||||
return;
|
||||
|
||||
file = g_file_new_for_uri (uri);
|
||||
g_hash_table_remove (obj->priv->bookmarks_hash, file);
|
||||
g_hash_table_remove (obj->priv->bookmarks_hash, location);
|
||||
|
||||
g_object_unref (file);
|
||||
g_free (uri);
|
||||
g_object_unref (location);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3146,4 +3106,10 @@ on_action_bookmark_open (GtkAction * action, XedFileBrowserWidget * obj)
|
|||
bookmark_open (obj, model, &iter);
|
||||
}
|
||||
|
||||
void
|
||||
_xed_file_browser_widget_register_type (GTypeModule *type_module)
|
||||
{
|
||||
xed_file_browser_widget_register_type (type_module);
|
||||
}
|
||||
|
||||
// ex:ts=8:noet:
|
||||
|
|
|
@ -58,8 +58,8 @@ struct _XedFileBrowserWidgetClass
|
|||
GtkBoxClass parent_class;
|
||||
|
||||
/* Signals */
|
||||
void (*uri_activated) (XedFileBrowserWidget * widget,
|
||||
gchar const *uri);
|
||||
void (*location_activated) (XedFileBrowserWidget * widget,
|
||||
GFile *location);
|
||||
void (*error) (XedFileBrowserWidget * widget,
|
||||
guint code,
|
||||
gchar const *message);
|
||||
|
@ -71,7 +71,7 @@ struct _XedFileBrowserWidgetClass
|
|||
};
|
||||
|
||||
GType xed_file_browser_widget_get_type (void) G_GNUC_CONST;
|
||||
GType xed_file_browser_widget_register_type (GTypeModule * module);
|
||||
void _xed_file_browser_widget_register_type (GTypeModule *type_module);
|
||||
|
||||
GtkWidget *xed_file_browser_widget_new (const gchar *data_dir);
|
||||
|
||||
|
@ -79,12 +79,12 @@ void xed_file_browser_widget_show_bookmarks (XedFileBrowserWidget * obj);
|
|||
void xed_file_browser_widget_show_files (XedFileBrowserWidget * obj);
|
||||
|
||||
void xed_file_browser_widget_set_root (XedFileBrowserWidget * obj,
|
||||
gchar const *root,
|
||||
GFile *root,
|
||||
gboolean virtual_root);
|
||||
void
|
||||
xed_file_browser_widget_set_root_and_virtual_root (XedFileBrowserWidget * obj,
|
||||
gchar const *root,
|
||||
gchar const *virtual_root);
|
||||
GFile *root,
|
||||
GFile *virtual_root);
|
||||
|
||||
gboolean
|
||||
xed_file_browser_widget_get_selected_directory (XedFileBrowserWidget * obj,
|
||||
|
|
|
@ -22,10 +22,10 @@ libmodelines_la_SOURCES = \
|
|||
libmodelines_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
|
||||
libmodelines_la_LIBADD = $(XED_LIBS)
|
||||
|
||||
plugin_in_files = modelines.xed-plugin.desktop.in
|
||||
%.xed-plugin: %.xed-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_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:.xed-plugin.desktop.in=.xed-plugin)
|
||||
plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(plugin_in_files) \
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
#include <stdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtksourceview/gtksource.h>
|
||||
#include <xed/xed-language-manager.h>
|
||||
#include <xed/xed-prefs-manager.h>
|
||||
#include <xed/xed-debug.h>
|
||||
#include <xed/xed-settings.h>
|
||||
#include <xed/xed-utils.h>
|
||||
#include "modeline-parser.h"
|
||||
|
||||
#define MODELINES_LANGUAGE_MAPPINGS_FILE "language-mappings"
|
||||
|
@ -79,9 +79,12 @@ has_option (ModelineOptions *options,
|
|||
|
||||
void
|
||||
modeline_parser_init (const gchar *data_dir)
|
||||
{
|
||||
if (modelines_data_dir == NULL)
|
||||
{
|
||||
modelines_data_dir = g_strdup (data_dir);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
modeline_parser_shutdown ()
|
||||
|
@ -100,6 +103,7 @@ modeline_parser_shutdown ()
|
|||
kate_languages = NULL;
|
||||
|
||||
g_free (modelines_data_dir);
|
||||
modelines_data_dir = NULL;
|
||||
}
|
||||
|
||||
static GHashTable *
|
||||
|
@ -326,7 +330,7 @@ parse_vim_modeline (gchar *s,
|
|||
|
||||
options->set |= MODELINE_SET_WRAP_MODE;
|
||||
}
|
||||
else if (strcmp (key->str, "textwidth") == 0)
|
||||
else if (strcmp (key->str, "textwidth") == 0 || strcmp (key->str, "tw") == 0)
|
||||
{
|
||||
intval = atoi (value->str);
|
||||
|
||||
|
@ -674,6 +678,7 @@ modeline_parser_apply_modeline (GtkSourceView *view)
|
|||
GtkTextBuffer *buffer;
|
||||
GtkTextIter iter, liter;
|
||||
gint line_count;
|
||||
GSettings *settings;
|
||||
|
||||
options.language_id = NULL;
|
||||
options.set = MODELINE_SET_NONE;
|
||||
|
@ -746,7 +751,7 @@ modeline_parser_apply_modeline (GtkSourceView *view)
|
|||
GtkSourceLanguageManager *manager;
|
||||
GtkSourceLanguage *language;
|
||||
|
||||
manager = xed_get_language_manager ();
|
||||
manager = gtk_source_language_manager_get_default ();
|
||||
language = gtk_source_language_manager_get_language
|
||||
(manager, options.language_id);
|
||||
|
||||
|
@ -760,6 +765,8 @@ modeline_parser_apply_modeline (GtkSourceView *view)
|
|||
ModelineOptions *previous = g_object_get_data (G_OBJECT (buffer),
|
||||
MODELINE_OPTIONS_DATA_KEY);
|
||||
|
||||
settings = g_settings_new ("org.x.editor.preferences.editor");
|
||||
|
||||
/* Apply the options we got from modelines and restore defaults if
|
||||
we set them before */
|
||||
if (has_option (&options, MODELINE_SET_INSERT_SPACES))
|
||||
|
@ -769,9 +776,10 @@ modeline_parser_apply_modeline (GtkSourceView *view)
|
|||
}
|
||||
else if (check_previous (view, previous, MODELINE_SET_INSERT_SPACES))
|
||||
{
|
||||
gtk_source_view_set_insert_spaces_instead_of_tabs
|
||||
(view,
|
||||
xed_prefs_manager_get_insert_spaces ());
|
||||
gboolean insert_spaces;
|
||||
|
||||
insert_spaces = g_settings_get_boolean (settings, XED_SETTINGS_INSERT_SPACES);
|
||||
gtk_source_view_set_insert_spaces_instead_of_tabs (view, insert_spaces);
|
||||
}
|
||||
|
||||
if (has_option (&options, MODELINE_SET_TAB_WIDTH))
|
||||
|
@ -780,8 +788,10 @@ modeline_parser_apply_modeline (GtkSourceView *view)
|
|||
}
|
||||
else if (check_previous (view, previous, MODELINE_SET_TAB_WIDTH))
|
||||
{
|
||||
gtk_source_view_set_tab_width (view,
|
||||
xed_prefs_manager_get_tabs_size ());
|
||||
guint tab_width;
|
||||
|
||||
tab_width = g_settings_get_uint (settings, XED_SETTINGS_TABS_SIZE);
|
||||
gtk_source_view_set_tab_width (view, tab_width);
|
||||
}
|
||||
|
||||
if (has_option (&options, MODELINE_SET_INDENT_WIDTH))
|
||||
|
@ -799,8 +809,10 @@ modeline_parser_apply_modeline (GtkSourceView *view)
|
|||
}
|
||||
else if (check_previous (view, previous, MODELINE_SET_WRAP_MODE))
|
||||
{
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view),
|
||||
xed_prefs_manager_get_wrap_mode ());
|
||||
GtkWrapMode mode;
|
||||
|
||||
mode = g_settings_get_enum (settings, XED_SETTINGS_WRAP_MODE);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), mode);
|
||||
}
|
||||
|
||||
if (has_option (&options, MODELINE_SET_RIGHT_MARGIN_POSITION))
|
||||
|
@ -809,8 +821,10 @@ modeline_parser_apply_modeline (GtkSourceView *view)
|
|||
}
|
||||
else if (check_previous (view, previous, MODELINE_SET_RIGHT_MARGIN_POSITION))
|
||||
{
|
||||
gtk_source_view_set_right_margin_position (view,
|
||||
xed_prefs_manager_get_right_margin_position ());
|
||||
guint right_margin_pos;
|
||||
|
||||
right_margin_pos = g_settings_get_uint (settings, XED_SETTINGS_RIGHT_MARGIN_POSITION);
|
||||
gtk_source_view_set_right_margin_position (view, right_margin_pos);
|
||||
}
|
||||
|
||||
if (has_option (&options, MODELINE_SET_SHOW_RIGHT_MARGIN))
|
||||
|
@ -819,12 +833,15 @@ modeline_parser_apply_modeline (GtkSourceView *view)
|
|||
}
|
||||
else if (check_previous (view, previous, MODELINE_SET_SHOW_RIGHT_MARGIN))
|
||||
{
|
||||
gtk_source_view_set_show_right_margin (view,
|
||||
xed_prefs_manager_get_display_right_margin ());
|
||||
gboolean display_right_margin;
|
||||
|
||||
display_right_margin = g_settings_get_boolean (settings, XED_SETTINGS_DISPLAY_RIGHT_MARGIN);
|
||||
gtk_source_view_set_show_right_margin (view, display_right_margin);
|
||||
}
|
||||
|
||||
if (previous)
|
||||
{
|
||||
g_free (previous->language_id);
|
||||
*previous = options;
|
||||
previous->language_id = g_strdup (options.language_id);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#define __MODELINE_PARSER_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <gtksourceview/gtksourceview.h>
|
||||
#include <gtksourceview/gtksource.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[Xed Plugin]
|
||||
[Plugin]
|
||||
Module=modelines
|
||||
IAge=2
|
||||
_Name=Modelines
|
|
@ -29,80 +29,66 @@
|
|||
#include "modeline-parser.h"
|
||||
|
||||
#include <xed/xed-debug.h>
|
||||
#include <xed/xed-utils.h>
|
||||
#include <xed/xed-view-activatable.h>
|
||||
#include <xed/xed-view.h>
|
||||
|
||||
#define WINDOW_DATA_KEY "XedModelinePluginWindowData"
|
||||
#define DOCUMENT_DATA_KEY "XedModelinePluginDocumentData"
|
||||
|
||||
typedef struct
|
||||
struct _XedModelinePluginPrivate
|
||||
{
|
||||
gulong tab_added_handler_id;
|
||||
gulong tab_removed_handler_id;
|
||||
} WindowData;
|
||||
XedView *view;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gulong document_loaded_handler_id;
|
||||
gulong document_saved_handler_id;
|
||||
} DocumentData;
|
||||
};
|
||||
|
||||
static void xed_modeline_plugin_activate (XedPlugin *plugin, XedWindow *window);
|
||||
static void xed_modeline_plugin_deactivate (XedPlugin *plugin, XedWindow *window);
|
||||
static GObject *xed_modeline_plugin_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_param);
|
||||
static void xed_modeline_plugin_finalize (GObject *object);
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_VIEW
|
||||
};
|
||||
|
||||
XED_PLUGIN_REGISTER_TYPE(XedModelinePlugin, xed_modeline_plugin)
|
||||
static void xed_view_activatable_iface_init (XedViewActivatableInterface *iface);
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedModelinePlugin,
|
||||
xed_modeline_plugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_VIEW_ACTIVATABLE,
|
||||
xed_view_activatable_iface_init))
|
||||
|
||||
static void
|
||||
window_data_free (WindowData *wdata)
|
||||
xed_modeline_plugin_constructed (GObject *object)
|
||||
{
|
||||
g_slice_free (WindowData, wdata);
|
||||
}
|
||||
|
||||
static void
|
||||
document_data_free (DocumentData *ddata)
|
||||
{
|
||||
g_slice_free (DocumentData, ddata);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_modeline_plugin_class_init (XedModelinePluginClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
XedPluginClass *plugin_class = XED_PLUGIN_CLASS (klass);
|
||||
|
||||
object_class->constructor = xed_modeline_plugin_constructor;
|
||||
object_class->finalize = xed_modeline_plugin_finalize;
|
||||
|
||||
plugin_class->activate = xed_modeline_plugin_activate;
|
||||
plugin_class->deactivate = xed_modeline_plugin_deactivate;
|
||||
}
|
||||
|
||||
static GObject *
|
||||
xed_modeline_plugin_constructor (GType type,
|
||||
guint n_construct_properties,
|
||||
GObjectConstructParam *construct_param)
|
||||
{
|
||||
GObject *object;
|
||||
gchar *data_dir;
|
||||
|
||||
object = G_OBJECT_CLASS (xed_modeline_plugin_parent_class)->constructor (type,
|
||||
n_construct_properties,
|
||||
construct_param);
|
||||
|
||||
data_dir = xed_plugin_get_data_dir (XED_PLUGIN (object));
|
||||
data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (object));
|
||||
|
||||
modeline_parser_init (data_dir);
|
||||
|
||||
g_free (data_dir);
|
||||
|
||||
return object;
|
||||
G_OBJECT_CLASS (xed_modeline_plugin_parent_class)->constructed (object);
|
||||
}
|
||||
|
||||
static void
|
||||
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);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_modeline_plugin_dispose (GObject *object)
|
||||
{
|
||||
XedModelinePlugin *plugin = XED_MODELINE_PLUGIN (object);
|
||||
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedModelinePlugin disposing");
|
||||
|
||||
g_clear_object (&plugin->priv->view);
|
||||
|
||||
G_OBJECT_CLASS (xed_modeline_plugin_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -115,134 +101,124 @@ xed_modeline_plugin_finalize (GObject *object)
|
|||
G_OBJECT_CLASS (xed_modeline_plugin_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_modeline_plugin_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XedModelinePlugin *plugin = XED_MODELINE_PLUGIN (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_VIEW:
|
||||
plugin->priv->view = XED_VIEW (g_value_dup_object (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xed_modeline_plugin_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XedModelinePlugin *plugin = XED_MODELINE_PLUGIN (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_VIEW:
|
||||
g_value_set_object (value, plugin->priv->view);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_document_loaded_or_saved (XedDocument *document,
|
||||
const GError *error,
|
||||
GtkSourceView *view)
|
||||
{
|
||||
modeline_parser_apply_modeline (view);
|
||||
}
|
||||
|
||||
static void
|
||||
connect_handlers (XedView *view)
|
||||
xed_modeline_plugin_activate (XedViewActivatable *activatable)
|
||||
{
|
||||
DocumentData *data;
|
||||
XedModelinePlugin *plugin;
|
||||
GtkTextBuffer *doc;
|
||||
|
||||
doc = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
data = g_slice_new (DocumentData);
|
||||
plugin = XED_MODELINE_PLUGIN (activatable);
|
||||
|
||||
data->document_loaded_handler_id =
|
||||
modeline_parser_apply_modeline (GTK_SOURCE_VIEW (plugin->priv->view));
|
||||
|
||||
doc = gtk_text_view_get_buffer (GTK_TEXT_VIEW (plugin->priv->view));
|
||||
|
||||
plugin->priv->document_loaded_handler_id =
|
||||
g_signal_connect (doc, "loaded",
|
||||
G_CALLBACK (on_document_loaded_or_saved),
|
||||
view);
|
||||
data->document_saved_handler_id =
|
||||
G_CALLBACK (on_document_loaded_or_saved), plugin->priv->view);
|
||||
plugin->priv->document_saved_handler_id =
|
||||
g_signal_connect (doc, "saved",
|
||||
G_CALLBACK (on_document_loaded_or_saved),
|
||||
view);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (doc), DOCUMENT_DATA_KEY,
|
||||
data, (GDestroyNotify) document_data_free);
|
||||
G_CALLBACK (on_document_loaded_or_saved), plugin->priv->view);
|
||||
}
|
||||
|
||||
static void
|
||||
disconnect_handlers (XedView *view)
|
||||
xed_modeline_plugin_deactivate (XedViewActivatable *activatable)
|
||||
{
|
||||
DocumentData *data;
|
||||
XedModelinePlugin *plugin;
|
||||
GtkTextBuffer *doc;
|
||||
|
||||
doc = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
|
||||
data = g_object_steal_data (G_OBJECT (doc), DOCUMENT_DATA_KEY);
|
||||
|
||||
if (data)
|
||||
{
|
||||
g_signal_handler_disconnect (doc, data->document_loaded_handler_id);
|
||||
g_signal_handler_disconnect (doc, data->document_saved_handler_id);
|
||||
|
||||
document_data_free (data);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Modeline handlers not found");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_window_tab_added (XedWindow *window,
|
||||
XedTab *tab,
|
||||
gpointer user_data)
|
||||
{
|
||||
connect_handlers (xed_tab_get_view (tab));
|
||||
}
|
||||
|
||||
static void
|
||||
on_window_tab_removed (XedWindow *window,
|
||||
XedTab *tab,
|
||||
gpointer user_data)
|
||||
{
|
||||
disconnect_handlers (xed_tab_get_view (tab));
|
||||
}
|
||||
|
||||
static void
|
||||
xed_modeline_plugin_activate (XedPlugin *plugin,
|
||||
XedWindow *window)
|
||||
{
|
||||
WindowData *wdata;
|
||||
GList *views;
|
||||
GList *l;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
views = xed_window_get_views (window);
|
||||
for (l = views; l != NULL; l = l->next)
|
||||
{
|
||||
connect_handlers (XED_VIEW (l->data));
|
||||
modeline_parser_apply_modeline (GTK_SOURCE_VIEW (l->data));
|
||||
}
|
||||
g_list_free (views);
|
||||
plugin = XED_MODELINE_PLUGIN (activatable);
|
||||
|
||||
wdata = g_slice_new (WindowData);
|
||||
doc = gtk_text_view_get_buffer (GTK_TEXT_VIEW (plugin->priv->view));
|
||||
|
||||
wdata->tab_added_handler_id =
|
||||
g_signal_connect (window, "tab-added",
|
||||
G_CALLBACK (on_window_tab_added), NULL);
|
||||
|
||||
wdata->tab_removed_handler_id =
|
||||
g_signal_connect (window, "tab-removed",
|
||||
G_CALLBACK (on_window_tab_removed), NULL);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (window), WINDOW_DATA_KEY,
|
||||
wdata, (GDestroyNotify) window_data_free);
|
||||
g_signal_handler_disconnect (doc, plugin->priv->document_loaded_handler_id);
|
||||
g_signal_handler_disconnect (doc, plugin->priv->document_saved_handler_id);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_modeline_plugin_deactivate (XedPlugin *plugin,
|
||||
XedWindow *window)
|
||||
xed_modeline_plugin_class_init (XedModelinePluginClass *klass)
|
||||
{
|
||||
WindowData *wdata;
|
||||
GList *views;
|
||||
GList *l;
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
object_class->constructed = xed_modeline_plugin_constructed;
|
||||
object_class->dispose = xed_modeline_plugin_dispose;
|
||||
object_class->finalize = xed_modeline_plugin_finalize;
|
||||
object_class->set_property = xed_modeline_plugin_set_property;
|
||||
object_class->get_property = xed_modeline_plugin_get_property;
|
||||
|
||||
wdata = g_object_steal_data (G_OBJECT (window), WINDOW_DATA_KEY);
|
||||
g_object_class_override_property (object_class, PROP_VIEW, "view");
|
||||
|
||||
g_signal_handler_disconnect (window, wdata->tab_added_handler_id);
|
||||
g_signal_handler_disconnect (window, wdata->tab_removed_handler_id);
|
||||
|
||||
window_data_free (wdata);
|
||||
|
||||
views = xed_window_get_views (window);
|
||||
|
||||
for (l = views; l != NULL; l = l->next)
|
||||
{
|
||||
disconnect_handlers (XED_VIEW (l->data));
|
||||
|
||||
modeline_parser_deactivate (GTK_SOURCE_VIEW (l->data));
|
||||
g_type_class_add_private (klass, sizeof (XedModelinePluginPrivate));
|
||||
}
|
||||
|
||||
g_list_free (views);
|
||||
static void
|
||||
xed_view_activatable_iface_init (XedViewActivatableInterface *iface)
|
||||
{
|
||||
iface->activate = xed_modeline_plugin_activate;
|
||||
iface->deactivate = xed_modeline_plugin_deactivate;
|
||||
}
|
||||
|
||||
static void
|
||||
xed_modeline_plugin_class_finalize (XedModelinePluginClass *klass)
|
||||
{
|
||||
/* dummy function - used by G_DEFINE_DYNAMIC_TYPE_EXTENDED */
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
peas_register_types (PeasObjectModule *module)
|
||||
{
|
||||
xed_modeline_plugin_register_type (G_TYPE_MODULE (module));
|
||||
|
||||
peas_object_module_register_extension_type (module,
|
||||
XED_TYPE_VIEW_ACTIVATABLE,
|
||||
XED_TYPE_MODELINE_PLUGIN);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <xed/xed-plugin.h>
|
||||
#include <libpeas/peas-extension-base.h>
|
||||
#include <libpeas/peas-object-module.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
@ -36,12 +37,28 @@ G_BEGIN_DECLS
|
|||
#define XED_MODELINE_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), XED_TYPE_MODELINE_PLUGIN, XedModelinePluginClass))
|
||||
|
||||
/* Private structure type */
|
||||
typedef XedPluginClass XedModelinePluginClass;
|
||||
typedef XedPlugin XedModelinePlugin;
|
||||
typedef struct _XedModelinePlugin XedModelinePlugin;
|
||||
typedef struct _XedModelinePluginPrivate XedModelinePluginPrivate;
|
||||
typedef struct _XedModelinePluginClass XedModelinePluginClass;
|
||||
|
||||
struct _XedModelinePlugin
|
||||
{
|
||||
PeasExtensionBase parent;
|
||||
|
||||
/*< private >*/
|
||||
XedModelinePluginPrivate *priv;
|
||||
};
|
||||
|
||||
typedef struct _XedModelinePluginClass XedModelinePluginClass;
|
||||
|
||||
struct _XedModelinePluginClass
|
||||
{
|
||||
PeasExtensionBaseClass parent_class;
|
||||
};
|
||||
|
||||
GType xed_modeline_plugin_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_MODULE_EXPORT GType register_xed_plugin (GTypeModule *module);
|
||||
G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -19,11 +19,11 @@ libsort_la_LIBADD = $(XED_LIBS)
|
|||
uidir = $(XED_PLUGINS_DATA_DIR)/sort
|
||||
ui_DATA = sort.ui
|
||||
|
||||
plugin_in_files = sort.xed-plugin.desktop.in
|
||||
plugin_in_files = sort.plugin.desktop.in
|
||||
|
||||
%.xed-plugin: %.xed-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: %.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:.xed-plugin.desktop.in=.xed-plugin)
|
||||
plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
|
||||
|
||||
EXTRA_DIST = $(ui_DATA) $(plugin_in_files)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[Xed Plugin]
|
||||
[Plugin]
|
||||
Module=sort
|
||||
IAge=2
|
||||
_Name=Sort
|
|
@ -28,58 +28,61 @@
|
|||
#include "xed-sort-plugin.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gmodule.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-help.h>
|
||||
#include <xed/xed-app.h>
|
||||
|
||||
#define XED_SORT_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_SORT_PLUGIN, XedSortPluginPrivate))
|
||||
|
||||
/* Key in case the plugin ever needs any settings. */
|
||||
#define SORT_BASE_KEY "/apps/xed/plugins/sort"
|
||||
|
||||
#define WINDOW_DATA_KEY "XedSortPluginWindowData"
|
||||
#define MENU_PATH "/MenuBar/EditMenu/EditOps_6"
|
||||
|
||||
XED_PLUGIN_REGISTER_TYPE(XedSortPlugin, xed_sort_plugin)
|
||||
static void xed_window_activatable_iface_init (XedWindowActivatableInterface *iface);
|
||||
|
||||
typedef struct
|
||||
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;
|
||||
|
||||
GtkActionGroup *ui_action_group;
|
||||
guint ui_id;
|
||||
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *col_num_spinbutton;
|
||||
GtkWidget *reverse_order_checkbutton;
|
||||
GtkWidget *ignore_case_checkbutton;
|
||||
GtkWidget *remove_dups_checkbutton;
|
||||
|
||||
XedDocument *doc;
|
||||
|
||||
GtkTextIter start, end; /* selection */
|
||||
} SortDialog;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkActionGroup *ui_action_group;
|
||||
guint ui_id;
|
||||
} WindowData;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
XedPlugin *plugin;
|
||||
XedWindow *window;
|
||||
} ActionData;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gboolean ignore_case;
|
||||
gboolean reverse_order;
|
||||
gboolean remove_duplicates;
|
||||
gint starting_column;
|
||||
|
||||
guint ignore_case : 1;
|
||||
guint reverse_order : 1;
|
||||
guint remove_duplicates : 1;
|
||||
} SortInfo;
|
||||
|
||||
static void sort_cb (GtkAction *action, ActionData *action_data);
|
||||
static void sort_real (SortDialog *dialog);
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_WINDOW
|
||||
};
|
||||
|
||||
static void sort_cb (GtkAction *action,
|
||||
XedSortPlugin *plugin);
|
||||
static void sort_real (XedSortPlugin *plugin);
|
||||
|
||||
static const GtkActionEntry action_entries[] =
|
||||
{
|
||||
|
@ -88,40 +91,30 @@ static const GtkActionEntry action_entries[] =
|
|||
N_("S_ort..."),
|
||||
NULL,
|
||||
N_("Sort the current document or selection"),
|
||||
G_CALLBACK (sort_cb) }
|
||||
G_CALLBACK (sort_cb)
|
||||
}
|
||||
};
|
||||
|
||||
static void
|
||||
sort_dialog_dispose (GObject *obj,
|
||||
gpointer dialog_pointer)
|
||||
{
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
g_slice_free (SortDialog, dialog_pointer);
|
||||
}
|
||||
|
||||
static void
|
||||
sort_dialog_response_handler (GtkDialog *widget,
|
||||
sort_dialog_response_handler (GtkDialog *dlg,
|
||||
gint res_id,
|
||||
SortDialog *dialog)
|
||||
XedSortPlugin *plugin)
|
||||
{
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
switch (res_id)
|
||||
{
|
||||
case GTK_RESPONSE_OK:
|
||||
sort_real (dialog);
|
||||
gtk_widget_destroy (dialog->dialog);
|
||||
sort_real (plugin);
|
||||
gtk_widget_destroy (GTK_WIDGET (dlg));
|
||||
break;
|
||||
|
||||
case GTK_RESPONSE_HELP:
|
||||
xed_help_display (GTK_WINDOW (widget),
|
||||
NULL,
|
||||
"xed-sort-plugin");
|
||||
xed_app_show_help (XED_APP (g_application_get_default ()), GTK_WINDOW (dlg), NULL, "xed-sort-plugin");
|
||||
break;
|
||||
|
||||
case GTK_RESPONSE_CANCEL:
|
||||
gtk_widget_destroy (dialog->dialog);
|
||||
gtk_widget_destroy (GTK_WIDGET (dlg));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -130,29 +123,28 @@ sort_dialog_response_handler (GtkDialog *widget,
|
|||
* the text field (like the combo box) looses the documnent selection.
|
||||
* Storing the selection ONLY works because the dialog is modal */
|
||||
static void
|
||||
get_current_selection (XedWindow *window, SortDialog *dialog)
|
||||
get_current_selection (XedSortPlugin *plugin)
|
||||
{
|
||||
XedSortPluginPrivate *priv;
|
||||
XedDocument *doc;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
doc = xed_window_get_active_document (window);
|
||||
priv = plugin->priv;
|
||||
|
||||
if (!gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (doc),
|
||||
&dialog->start,
|
||||
&dialog->end))
|
||||
doc = xed_window_get_active_document (priv->window);
|
||||
|
||||
if (!gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (doc), &priv->start, &priv->end))
|
||||
{
|
||||
/* No selection, get the whole document. */
|
||||
gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (doc),
|
||||
&dialog->start,
|
||||
&dialog->end);
|
||||
gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (doc), &priv->start, &priv->end);
|
||||
}
|
||||
}
|
||||
|
||||
static SortDialog *
|
||||
get_sort_dialog (ActionData *action_data)
|
||||
static void
|
||||
create_sort_dialog (XedSortPlugin *plugin)
|
||||
{
|
||||
SortDialog *dialog;
|
||||
XedSortPluginPrivate *priv;
|
||||
GtkWidget *error_widget;
|
||||
gboolean ret;
|
||||
gchar *data_dir;
|
||||
|
@ -160,20 +152,20 @@ get_sort_dialog (ActionData *action_data)
|
|||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
dialog = g_slice_new (SortDialog);
|
||||
priv = plugin->priv;
|
||||
|
||||
data_dir = xed_plugin_get_data_dir (action_data->plugin);
|
||||
data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (plugin));
|
||||
ui_file = g_build_filename (data_dir, "sort.ui", NULL);
|
||||
g_free (data_dir);
|
||||
ret = xed_utils_get_ui_objects (ui_file,
|
||||
NULL,
|
||||
&error_widget,
|
||||
"sort_dialog", &dialog->dialog,
|
||||
"reverse_order_checkbutton", &dialog->reverse_order_checkbutton,
|
||||
"col_num_spinbutton", &dialog->col_num_spinbutton,
|
||||
"ignore_case_checkbutton", &dialog->ignore_case_checkbutton,
|
||||
"remove_dups_checkbutton", &dialog->remove_dups_checkbutton,
|
||||
"sort_dialog", &priv->dialog,
|
||||
"reverse_order_checkbutton", &priv->reverse_order_checkbutton,
|
||||
"col_num_spinbutton", &priv->col_num_spinbutton,
|
||||
"ignore_case_checkbutton", &priv->ignore_case_checkbutton,
|
||||
"remove_dups_checkbutton", &priv->remove_dups_checkbutton,
|
||||
NULL);
|
||||
g_free (data_dir);
|
||||
g_free (ui_file);
|
||||
|
||||
if (!ret)
|
||||
|
@ -181,62 +173,41 @@ get_sort_dialog (ActionData *action_data)
|
|||
const gchar *err_message;
|
||||
|
||||
err_message = gtk_label_get_label (GTK_LABEL (error_widget));
|
||||
xed_warning (GTK_WINDOW (action_data->window),
|
||||
"%s", err_message);
|
||||
xed_warning (GTK_WINDOW (priv->window), "%s", err_message);
|
||||
|
||||
g_slice_free (SortDialog, dialog);
|
||||
gtk_widget_destroy (error_widget);
|
||||
|
||||
return NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog->dialog),
|
||||
GTK_RESPONSE_OK);
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (priv->dialog), GTK_RESPONSE_OK);
|
||||
|
||||
g_signal_connect (dialog->dialog,
|
||||
"dispose",
|
||||
G_CALLBACK (sort_dialog_dispose),
|
||||
dialog);
|
||||
g_signal_connect (priv->dialog, "destroy", G_CALLBACK (gtk_widget_destroyed), &priv->dialog);
|
||||
g_signal_connect (priv->dialog, "response", G_CALLBACK (sort_dialog_response_handler), plugin);
|
||||
|
||||
g_signal_connect (dialog->dialog,
|
||||
"response",
|
||||
G_CALLBACK (sort_dialog_response_handler),
|
||||
dialog);
|
||||
|
||||
get_current_selection (action_data->window, dialog);
|
||||
|
||||
return dialog;
|
||||
get_current_selection (plugin);
|
||||
}
|
||||
|
||||
static void
|
||||
sort_cb (GtkAction *action,
|
||||
ActionData *action_data)
|
||||
XedSortPlugin *plugin)
|
||||
{
|
||||
XedDocument *doc;
|
||||
XedSortPluginPrivate *priv;
|
||||
GtkWindowGroup *wg;
|
||||
SortDialog *dialog;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
doc = xed_window_get_active_document (action_data->window);
|
||||
g_return_if_fail (doc != NULL);
|
||||
priv = plugin->priv;
|
||||
|
||||
dialog = get_sort_dialog (action_data);
|
||||
g_return_if_fail (dialog != NULL);
|
||||
create_sort_dialog (plugin);
|
||||
|
||||
wg = xed_window_get_group (action_data->window);
|
||||
gtk_window_group_add_window (wg,
|
||||
GTK_WINDOW (dialog->dialog));
|
||||
wg = xed_window_get_group (priv->window);
|
||||
gtk_window_group_add_window (wg, GTK_WINDOW (priv->dialog));
|
||||
|
||||
dialog->doc = doc;
|
||||
gtk_window_set_transient_for (GTK_WINDOW (priv->dialog), GTK_WINDOW (priv->window));
|
||||
gtk_window_set_modal (GTK_WINDOW (priv->dialog), TRUE);
|
||||
|
||||
gtk_window_set_transient_for (GTK_WINDOW (dialog->dialog),
|
||||
GTK_WINDOW (action_data->window));
|
||||
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog->dialog),
|
||||
TRUE);
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (dialog->dialog));
|
||||
gtk_widget_show (GTK_WIDGET (priv->dialog));
|
||||
}
|
||||
|
||||
/* Compares two strings for the sorting algorithm. Uses the UTF-8 processing
|
||||
|
@ -335,12 +306,11 @@ get_line_slice (GtkTextBuffer *buf,
|
|||
end = start;
|
||||
|
||||
if (!gtk_text_iter_ends_line (&start))
|
||||
{
|
||||
gtk_text_iter_forward_to_line_end (&end);
|
||||
}
|
||||
|
||||
ret= gtk_text_buffer_get_slice (buf,
|
||||
&start,
|
||||
&end,
|
||||
TRUE);
|
||||
ret= gtk_text_buffer_get_slice (buf, &start, &end, TRUE);
|
||||
|
||||
g_assert (ret != NULL);
|
||||
|
||||
|
@ -348,8 +318,9 @@ get_line_slice (GtkTextBuffer *buf,
|
|||
}
|
||||
|
||||
static void
|
||||
sort_real (SortDialog *dialog)
|
||||
sort_real (XedSortPlugin *plugin)
|
||||
{
|
||||
XedSortPluginPrivate *priv;
|
||||
XedDocument *doc;
|
||||
GtkTextIter start, end;
|
||||
gint start_line, end_line;
|
||||
|
@ -361,17 +332,19 @@ sort_real (SortDialog *dialog)
|
|||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
doc = dialog->doc;
|
||||
priv = plugin->priv;
|
||||
|
||||
doc = xed_window_get_active_document (priv->window);
|
||||
g_return_if_fail (doc != NULL);
|
||||
|
||||
sort_info = g_new0 (SortInfo, 1);
|
||||
sort_info->ignore_case = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->ignore_case_checkbutton));
|
||||
sort_info->reverse_order = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->reverse_order_checkbutton));
|
||||
sort_info->remove_duplicates = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->remove_dups_checkbutton));
|
||||
sort_info->starting_column = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dialog->col_num_spinbutton)) - 1;
|
||||
sort_info = g_slice_new (SortInfo);
|
||||
sort_info->ignore_case = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->ignore_case_checkbutton));
|
||||
sort_info->reverse_order = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->reverse_order_checkbutton));
|
||||
sort_info->remove_duplicates = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->remove_dups_checkbutton));
|
||||
sort_info->starting_column = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (priv->col_num_spinbutton)) - 1;
|
||||
|
||||
start = dialog->start;
|
||||
end = dialog->end;
|
||||
start = priv->start;
|
||||
end = priv->end;
|
||||
start_line = gtk_text_iter_get_line (&start);
|
||||
end_line = gtk_text_iter_get_line (&end);
|
||||
|
||||
|
@ -379,9 +352,13 @@ sort_real (SortDialog *dialog)
|
|||
* Otherwise the last line is the current one but we try to
|
||||
* move the iter after the line terminator */
|
||||
if (gtk_text_iter_get_line_offset (&end) == 0)
|
||||
{
|
||||
end_line = MAX (start_line, end_line - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_text_iter_forward_line (&end);
|
||||
}
|
||||
|
||||
num_lines = end_line - start_line + 1;
|
||||
lines = g_new0 (gchar *, num_lines + 1);
|
||||
|
@ -397,35 +374,23 @@ sort_real (SortDialog *dialog)
|
|||
|
||||
xed_debug_message (DEBUG_PLUGINS, "Sort list...");
|
||||
|
||||
g_qsort_with_data (lines,
|
||||
num_lines,
|
||||
sizeof (gpointer),
|
||||
compare_algorithm,
|
||||
sort_info);
|
||||
g_qsort_with_data (lines, num_lines, sizeof (gpointer), compare_algorithm, sort_info);
|
||||
|
||||
xed_debug_message (DEBUG_PLUGINS, "Rebuilding document...");
|
||||
|
||||
gtk_source_buffer_begin_not_undoable_action (GTK_SOURCE_BUFFER (doc));
|
||||
|
||||
gtk_text_buffer_delete (GTK_TEXT_BUFFER (doc),
|
||||
&start,
|
||||
&end);
|
||||
gtk_text_buffer_delete (GTK_TEXT_BUFFER (doc), &start, &end);
|
||||
|
||||
for (i = 0; i < num_lines; i++)
|
||||
{
|
||||
if (sort_info->remove_duplicates &&
|
||||
last_row != NULL &&
|
||||
(strcmp (last_row, lines[i]) == 0))
|
||||
if (sort_info->remove_duplicates && last_row != NULL && (strcmp (last_row, lines[i]) == 0))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
gtk_text_buffer_insert (GTK_TEXT_BUFFER (doc),
|
||||
&start,
|
||||
lines[i],
|
||||
-1);
|
||||
gtk_text_buffer_insert (GTK_TEXT_BUFFER (doc),
|
||||
&start,
|
||||
"\n",
|
||||
-1);
|
||||
gtk_text_buffer_insert (GTK_TEXT_BUFFER (doc), &start, lines[i], -1);
|
||||
gtk_text_buffer_insert (GTK_TEXT_BUFFER (doc), &start, "\n", -1);
|
||||
|
||||
last_row = lines[i];
|
||||
}
|
||||
|
@ -433,137 +398,97 @@ sort_real (SortDialog *dialog)
|
|||
gtk_source_buffer_end_not_undoable_action (GTK_SOURCE_BUFFER (doc));
|
||||
|
||||
g_strfreev (lines);
|
||||
g_free (sort_info);
|
||||
g_slice_free (SortInfo, sort_info);
|
||||
|
||||
xed_debug_message (DEBUG_PLUGINS, "Done.");
|
||||
}
|
||||
|
||||
static void
|
||||
free_window_data (WindowData *data)
|
||||
{
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
g_object_unref (data->ui_action_group);
|
||||
g_slice_free (WindowData, data);
|
||||
}
|
||||
|
||||
static void
|
||||
free_action_data (ActionData *data)
|
||||
{
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
g_slice_free (ActionData, data);
|
||||
}
|
||||
|
||||
static void
|
||||
update_ui_real (XedWindow *window,
|
||||
WindowData *data)
|
||||
update_ui (XedSortPlugin *plugin)
|
||||
{
|
||||
XedView *view;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
view = xed_window_get_active_view (window);
|
||||
view = xed_window_get_active_view (plugin->priv->window);
|
||||
|
||||
gtk_action_group_set_sensitive (data->ui_action_group,
|
||||
gtk_action_group_set_sensitive (plugin->priv->ui_action_group,
|
||||
(view != NULL) &&
|
||||
gtk_text_view_get_editable (GTK_TEXT_VIEW (view)));
|
||||
}
|
||||
|
||||
static void
|
||||
impl_activate (XedPlugin *plugin,
|
||||
XedWindow *window)
|
||||
xed_sort_plugin_activate (XedWindowActivatable *activatable)
|
||||
{
|
||||
XedSortPluginPrivate *priv;
|
||||
GtkUIManager *manager;
|
||||
WindowData *data;
|
||||
ActionData *action_data;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
data = g_slice_new (WindowData);
|
||||
action_data = g_slice_new (ActionData);
|
||||
action_data->window = window;
|
||||
action_data->plugin = plugin;
|
||||
priv = XED_SORT_PLUGIN (activatable)->priv;
|
||||
manager = xed_window_get_ui_manager (priv->window);
|
||||
|
||||
manager = xed_window_get_ui_manager (window);
|
||||
priv->ui_action_group = gtk_action_group_new ("XedSortPluginActions");
|
||||
gtk_action_group_set_translation_domain (priv->ui_action_group, GETTEXT_PACKAGE);
|
||||
gtk_action_group_add_actions (priv->ui_action_group, action_entries, G_N_ELEMENTS (action_entries), activatable);
|
||||
|
||||
data->ui_action_group = gtk_action_group_new ("XedSortPluginActions");
|
||||
gtk_action_group_set_translation_domain (data->ui_action_group,
|
||||
GETTEXT_PACKAGE);
|
||||
gtk_action_group_add_actions_full (data->ui_action_group,
|
||||
action_entries,
|
||||
G_N_ELEMENTS (action_entries),
|
||||
action_data,
|
||||
(GDestroyNotify) free_action_data);
|
||||
gtk_ui_manager_insert_action_group (manager, priv->ui_action_group, -1);
|
||||
|
||||
gtk_ui_manager_insert_action_group (manager,
|
||||
data->ui_action_group,
|
||||
-1);
|
||||
|
||||
data->ui_id = gtk_ui_manager_new_merge_id (manager);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (window),
|
||||
WINDOW_DATA_KEY,
|
||||
data,
|
||||
(GDestroyNotify) free_window_data);
|
||||
priv->ui_id = gtk_ui_manager_new_merge_id (manager);
|
||||
|
||||
gtk_ui_manager_add_ui (manager,
|
||||
data->ui_id,
|
||||
priv->ui_id,
|
||||
MENU_PATH,
|
||||
"Sort",
|
||||
"Sort",
|
||||
GTK_UI_MANAGER_MENUITEM,
|
||||
FALSE);
|
||||
|
||||
update_ui_real (window,
|
||||
data);
|
||||
update_ui (XED_SORT_PLUGIN (activatable));
|
||||
}
|
||||
|
||||
static void
|
||||
impl_deactivate (XedPlugin *plugin,
|
||||
XedWindow *window)
|
||||
xed_sort_plugin_deactivate (XedWindowActivatable *activatable)
|
||||
{
|
||||
XedSortPluginPrivate *priv;
|
||||
GtkUIManager *manager;
|
||||
WindowData *data;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
manager = xed_window_get_ui_manager (window);
|
||||
priv = XED_SORT_PLUGIN (activatable)->priv;
|
||||
manager = xed_window_get_ui_manager (priv->window);
|
||||
|
||||
data = (WindowData *) g_object_get_data (G_OBJECT (window),
|
||||
WINDOW_DATA_KEY);
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
gtk_ui_manager_remove_ui (manager,
|
||||
data->ui_id);
|
||||
gtk_ui_manager_remove_action_group (manager,
|
||||
data->ui_action_group);
|
||||
|
||||
g_object_set_data (G_OBJECT (window),
|
||||
WINDOW_DATA_KEY,
|
||||
NULL);
|
||||
gtk_ui_manager_remove_ui (manager, priv->ui_id);
|
||||
gtk_ui_manager_remove_action_group (manager, priv->ui_action_group);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_update_ui (XedPlugin *plugin,
|
||||
XedWindow *window)
|
||||
xed_sort_plugin_update_state (XedWindowActivatable *activatable)
|
||||
{
|
||||
WindowData *data;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
data = (WindowData *) g_object_get_data (G_OBJECT (window),
|
||||
WINDOW_DATA_KEY);
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
update_ui_real (window,
|
||||
data);
|
||||
update_ui (XED_SORT_PLUGIN (activatable));
|
||||
}
|
||||
|
||||
static void
|
||||
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);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_sort_plugin_dispose (GObject *object)
|
||||
{
|
||||
XedSortPlugin *plugin = XED_SORT_PLUGIN (object);
|
||||
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedSortPlugin disposing");
|
||||
|
||||
g_clear_object (&plugin->priv->ui_action_group);
|
||||
g_clear_object (&plugin->priv->window);
|
||||
|
||||
G_OBJECT_CLASS (xed_sort_plugin_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -574,15 +499,79 @@ xed_sort_plugin_finalize (GObject *object)
|
|||
G_OBJECT_CLASS (xed_sort_plugin_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_sort_plugin_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XedSortPlugin *plugin = XED_SORT_PLUGIN (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WINDOW:
|
||||
plugin->priv->window = XED_WINDOW (g_value_dup_object (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xed_sort_plugin_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XedSortPlugin *plugin = XED_SORT_PLUGIN (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WINDOW:
|
||||
g_value_set_object (value, plugin->priv->window);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xed_sort_plugin_class_init (XedSortPluginClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
XedPluginClass *plugin_class = XED_PLUGIN_CLASS (klass);
|
||||
|
||||
object_class->dispose = xed_sort_plugin_dispose;
|
||||
object_class->finalize = xed_sort_plugin_finalize;
|
||||
object_class->set_property = xed_sort_plugin_set_property;
|
||||
object_class->get_property = xed_sort_plugin_get_property;
|
||||
|
||||
plugin_class->activate = impl_activate;
|
||||
plugin_class->deactivate = impl_deactivate;
|
||||
plugin_class->update_ui = impl_update_ui;
|
||||
g_object_class_override_property (object_class, PROP_WINDOW, "window");
|
||||
|
||||
g_type_class_add_private (klass, sizeof (XedSortPluginPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
xed_sort_plugin_class_finalize (XedSortPluginClass *klass)
|
||||
{
|
||||
/* dummy function - used by G_DEFINE_DYNAMIC_TYPE_EXTENDED */
|
||||
}
|
||||
|
||||
static void
|
||||
xed_window_activatable_iface_init (XedWindowActivatableInterface *iface)
|
||||
{
|
||||
iface->activate = xed_sort_plugin_activate;
|
||||
iface->deactivate = xed_sort_plugin_deactivate;
|
||||
iface->update_state = xed_sort_plugin_update_state;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
peas_register_types (PeasObjectModule *module)
|
||||
{
|
||||
xed_sort_plugin_register_type (G_TYPE_MODULE (module));
|
||||
|
||||
peas_object_module_register_extension_type (module,
|
||||
XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
XED_TYPE_SORT_PLUGIN);
|
||||
}
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __XED_SORT_PLUGIN_H__
|
||||
|
@ -23,13 +21,11 @@
|
|||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <xed/xed-plugin.h>
|
||||
#include <libpeas/peas-extension-base.h>
|
||||
#include <libpeas/peas-object-module.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Type checking and casting macros
|
||||
*/
|
||||
#define XED_TYPE_SORT_PLUGIN (xed_sort_plugin_get_type ())
|
||||
#define XED_SORT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), XED_TYPE_SORT_PLUGIN, XedSortPlugin))
|
||||
#define XED_SORT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), XED_TYPE_SORT_PLUGIN, XedSortPluginClass))
|
||||
|
@ -37,36 +33,26 @@ G_BEGIN_DECLS
|
|||
#define XED_IS_SORT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), XED_TYPE_SORT_PLUGIN))
|
||||
#define XED_SORT_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), XED_TYPE_SORT_PLUGIN, XedSortPluginClass))
|
||||
|
||||
/* Private structure type */
|
||||
typedef struct _XedSortPluginPrivate XedSortPluginPrivate;
|
||||
|
||||
/*
|
||||
* Main object structure
|
||||
*/
|
||||
typedef struct _XedSortPlugin XedSortPlugin;
|
||||
typedef struct _XedSortPluginPrivate XedSortPluginPrivate;
|
||||
typedef struct _XedSortPluginClass XedSortPluginClass;
|
||||
|
||||
struct _XedSortPlugin
|
||||
{
|
||||
XedPlugin parent_instance;
|
||||
};
|
||||
PeasExtensionBase parent;
|
||||
|
||||
/*
|
||||
* Class definition
|
||||
*/
|
||||
typedef struct _XedSortPluginClass XedSortPluginClass;
|
||||
/*< private >*/
|
||||
XedSortPluginPrivate *priv;
|
||||
};
|
||||
|
||||
struct _XedSortPluginClass
|
||||
{
|
||||
XedPluginClass parent_class;
|
||||
PeasExtensionBaseClass parent_class;
|
||||
};
|
||||
|
||||
/*
|
||||
* Public methods
|
||||
*/
|
||||
GType xed_sort_plugin_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* All the plugins must implement this function */
|
||||
G_MODULE_EXPORT GType register_xed_plugin (GTypeModule *module);
|
||||
G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -44,11 +44,11 @@ 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.xed-plugin.desktop.in
|
||||
plugin_in_files = spell.plugin.desktop.in
|
||||
|
||||
%.xed-plugin: %.xed-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: %.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:.xed-plugin.desktop.in=.xed-plugin)
|
||||
plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
|
||||
|
||||
@INTLTOOL_XML_NOMERGE_RULE@
|
||||
spell_gschema_in = org.x.editor.plugins.spell.gschema.xml.in
|
||||
|
|
|
@ -1,136 +1,132 @@
|
|||
<?xml version="1.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="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">True</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="focus_on_map">True</property>
|
||||
<property name="urgency_hint">False</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkVBox" id="dialog-vbox1">
|
||||
<object class="GtkBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkHButtonBox" id="dialog-action_area1">
|
||||
<object class="GtkButtonBox" id="dialog-action_area1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="helpbutton1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-help</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="closebutton1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="content">
|
||||
<property name="border_width">5</property>
|
||||
<object class="GtkButton" id="closebutton1">
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</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="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="mnemonic_widget">languages_treeview</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<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="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</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>
|
||||
<property name="rules_hint">False</property>
|
||||
<property name="reorderable">False</property>
|
||||
<property name="enable_search">True</property>
|
||||
<property name="fixed_height_mode">False</property>
|
||||
<property name="hover_selection">False</property>
|
||||
<property name="hover_expand">False</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="treeview-selection1"/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -1,479 +1,366 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--*- mode: xml -*-->
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.18.3 -->
|
||||
<interface>
|
||||
<object class="GtkImage" id="check_word_image">
|
||||
<property name="stock">gtk-spell-check</property>
|
||||
<property name="icon_size">4</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="add_word_image">
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon_size">4</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="ignore_image">
|
||||
<property name="stock">gtk-go-down</property>
|
||||
<property name="icon_size">4</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="change_image">
|
||||
<property name="stock">gtk-convert</property>
|
||||
<property name="icon_size">4</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="ignore_all_image">
|
||||
<property name="stock">gtk-goto-bottom</property>
|
||||
<property name="icon_size">4</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="change_all_image">
|
||||
<property name="stock">gtk-convert</property>
|
||||
<property name="icon_size">4</property>
|
||||
</object>
|
||||
<requires lib="gtk+" version="3.10"/>
|
||||
<object class="GtkWindow" id="check_spelling_window">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">Check spelling</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="destroy_with_parent">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="GtkVBox" id="content">
|
||||
<property name="border_width">12</property>
|
||||
<object class="GtkBox" id="content">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</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="GtkTable" id="table1">
|
||||
<object class="GtkGrid" id="grid1">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">2</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="homogeneous">False</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="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">1</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"/>
|
||||
</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_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">1</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label3">
|
||||
<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="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="mnemonic_widget">word_entry</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox1">
|
||||
<object class="GtkBox" id="box1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</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="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"/>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="activates_default">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<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="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="image">check_word_image</property>
|
||||
<property name="label" translatable="yes">Check _Word</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="y_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTable" id="table2">
|
||||
<object class="GtkGrid" id="grid2">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">3</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label4">
|
||||
<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="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="mnemonic_widget">suggestions_list</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">1</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="visible">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</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="width_request">200</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="rules_hint">False</property>
|
||||
<property name="reorderable">False</property>
|
||||
<property name="enable_search">True</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="treeview-selection1"/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox2">
|
||||
<object class="GtkBox" id="box2">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">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="GtkTable" id="table3">
|
||||
<object class="GtkGrid" id="grid3">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">2</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="homogeneous">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="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="image">ignore_image</property>
|
||||
<property name="label" translatable="yes">_Ignore</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">1</property>
|
||||
<property name="y_options">expand</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="change_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="image">change_image</property>
|
||||
<property name="label" translatable="yes">Cha_nge</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="y_options">expand</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="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="image">ignore_all_image</property>
|
||||
<property name="label" translatable="yes">Ignore _All</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">1</property>
|
||||
<property name="y_options">expand</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="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="image">change_all_image</property>
|
||||
<property name="label" translatable="yes">Change A_ll</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="y_options">expand</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox3">
|
||||
<object class="GtkBox" id="box3">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">11</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label6">
|
||||
<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_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">7.45058e-09</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox2">
|
||||
<object class="GtkBox" id="box7">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">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="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="image">add_word_image</property>
|
||||
<property name="label" translatable="yes">Add w_ord</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">False</property>
|
||||
<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="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox32">
|
||||
<object class="GtkBox" id="box4">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label44">
|
||||
<object class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Language:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">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_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<object class="GtkButtonBox" id="buttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
<property name="spacing">0</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_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-close</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</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="right_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options">fill</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[Xed Plugin]
|
||||
[Plugin]
|
||||
Module=spell
|
||||
IAge=2
|
||||
_Name=Spell Checker
|
|
@ -43,7 +43,8 @@
|
|||
#include "xed-automatic-spell-checker.h"
|
||||
#include "xed-spell-utils.h"
|
||||
|
||||
struct _XedAutomaticSpellChecker {
|
||||
struct _XedAutomaticSpellChecker
|
||||
{
|
||||
XedDocument *doc;
|
||||
GSList *views;
|
||||
|
||||
|
@ -63,13 +64,16 @@ static GQuark suggestion_id = 0;
|
|||
static void xed_automatic_spell_checker_free_internal (XedAutomaticSpellChecker *spell);
|
||||
|
||||
static void
|
||||
view_destroy (XedView *view, XedAutomaticSpellChecker *spell)
|
||||
view_destroy (XedView *view,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
xed_automatic_spell_checker_detach_view (spell, view);
|
||||
}
|
||||
|
||||
static void
|
||||
check_word (XedAutomaticSpellChecker *spell, GtkTextIter *start, GtkTextIter *end)
|
||||
check_word (XedAutomaticSpellChecker *spell,
|
||||
GtkTextIter *start,
|
||||
GtkTextIter *end)
|
||||
{
|
||||
gchar *word;
|
||||
|
||||
|
@ -86,10 +90,7 @@ check_word (XedAutomaticSpellChecker *spell, GtkTextIter *start, GtkTextIter *en
|
|||
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);
|
||||
gtk_text_buffer_apply_tag (GTK_TEXT_BUFFER (spell->doc), spell->tag_highlight, start, end);
|
||||
}
|
||||
|
||||
g_free (word);
|
||||
|
@ -117,12 +118,13 @@ check_range (XedAutomaticSpellChecker *spell,
|
|||
*/
|
||||
|
||||
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))
|
||||
if (gtk_text_iter_inside_word (&start) || gtk_text_iter_ends_word (&start))
|
||||
{
|
||||
gtk_text_iter_backward_word_start (&start);
|
||||
}
|
||||
|
@ -133,9 +135,11 @@ check_range (XedAutomaticSpellChecker *spell,
|
|||
* 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,
|
||||
|
@ -147,10 +151,7 @@ check_range (XedAutomaticSpellChecker *spell,
|
|||
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);
|
||||
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,
|
||||
|
@ -164,8 +165,7 @@ check_range (XedAutomaticSpellChecker *spell,
|
|||
|
||||
wstart = start;
|
||||
|
||||
while (xed_spell_utils_skip_no_spell_check (&wstart, &end) &&
|
||||
gtk_text_iter_compare (&wstart, &end) < 0)
|
||||
while (xed_spell_utils_skip_no_spell_check (&wstart, &end) && gtk_text_iter_compare (&wstart, &end) < 0)
|
||||
{
|
||||
gboolean inword;
|
||||
|
||||
|
@ -174,8 +174,7 @@ check_range (XedAutomaticSpellChecker *spell,
|
|||
|
||||
gtk_text_iter_forward_word_end (&wend);
|
||||
|
||||
inword = (gtk_text_iter_compare (&wstart, &cursor) < 0) &&
|
||||
(gtk_text_iter_compare (&cursor, &wend) <= 0);
|
||||
inword = (gtk_text_iter_compare (&wstart, &cursor) < 0) && (gtk_text_iter_compare (&cursor, &wend) <= 0);
|
||||
|
||||
if (inword && !force_all)
|
||||
{
|
||||
|
@ -183,10 +182,14 @@ check_range (XedAutomaticSpellChecker *spell,
|
|||
* 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);
|
||||
|
@ -200,7 +203,9 @@ check_range (XedAutomaticSpellChecker *spell,
|
|||
/* 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;
|
||||
|
@ -213,12 +218,8 @@ check_deferred_range (XedAutomaticSpellChecker *spell,
|
|||
{
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
@ -231,15 +232,21 @@ check_deferred_range (XedAutomaticSpellChecker *spell,
|
|||
* 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)
|
||||
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)
|
||||
insert_text_after (GtkTextBuffer *buffer,
|
||||
GtkTextIter *iter,
|
||||
gchar *text,
|
||||
gint len,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
GtkTextIter start;
|
||||
|
||||
|
@ -259,7 +266,9 @@ insert_text_after (GtkTextBuffer *buffer, GtkTextIter *iter,
|
|||
*/
|
||||
|
||||
static void
|
||||
delete_range_after (GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end,
|
||||
delete_range_after (GtkTextBuffer *buffer,
|
||||
GtkTextIter *start,
|
||||
GtkTextIter *end,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
check_range (spell, *start, *end, FALSE);
|
||||
|
@ -273,8 +282,10 @@ mark_set (GtkTextBuffer *buffer,
|
|||
{
|
||||
/* 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,
|
||||
|
@ -285,16 +296,21 @@ get_word_extents_from_mark (GtkTextBuffer *buffer,
|
|||
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)
|
||||
remove_tag_to_word (XedAutomaticSpellChecker *spell,
|
||||
const gchar *word)
|
||||
{
|
||||
GtkTextIter iter;
|
||||
GtkTextIter match_start, match_end;
|
||||
|
@ -316,8 +332,7 @@ remove_tag_to_word (XedAutomaticSpellChecker *spell, const gchar *word)
|
|||
|
||||
if (found)
|
||||
{
|
||||
if (gtk_text_iter_starts_word (&match_start) &&
|
||||
gtk_text_iter_ends_word (&match_end))
|
||||
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,
|
||||
|
@ -331,7 +346,8 @@ remove_tag_to_word (XedAutomaticSpellChecker *spell, const gchar *word)
|
|||
}
|
||||
|
||||
static void
|
||||
add_to_dictionary (GtkWidget *menuitem, XedAutomaticSpellChecker *spell)
|
||||
add_to_dictionary (GtkWidget *menuitem,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
gchar *word;
|
||||
|
||||
|
@ -339,10 +355,7 @@ add_to_dictionary (GtkWidget *menuitem, XedAutomaticSpellChecker *spell)
|
|||
|
||||
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);
|
||||
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);
|
||||
|
||||
|
@ -350,7 +363,8 @@ add_to_dictionary (GtkWidget *menuitem, XedAutomaticSpellChecker *spell)
|
|||
}
|
||||
|
||||
static void
|
||||
ignore_all (GtkWidget *menuitem, XedAutomaticSpellChecker *spell)
|
||||
ignore_all (GtkWidget *menuitem,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
gchar *word;
|
||||
|
||||
|
@ -358,10 +372,7 @@ ignore_all (GtkWidget *menuitem, XedAutomaticSpellChecker *spell)
|
|||
|
||||
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);
|
||||
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);
|
||||
|
||||
|
@ -369,7 +380,8 @@ ignore_all (GtkWidget *menuitem, XedAutomaticSpellChecker *spell)
|
|||
}
|
||||
|
||||
static void
|
||||
replace_word (GtkWidget *menuitem, XedAutomaticSpellChecker *spell)
|
||||
replace_word (GtkWidget *menuitem,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
gchar *oldword;
|
||||
const gchar *newword;
|
||||
|
@ -398,7 +410,8 @@ replace_word (GtkWidget *menuitem, XedAutomaticSpellChecker *spell)
|
|||
}
|
||||
|
||||
static GtkWidget *
|
||||
build_suggestion_menu (XedAutomaticSpellChecker *spell, const gchar *word)
|
||||
build_suggestion_menu (XedAutomaticSpellChecker *spell,
|
||||
const gchar *word)
|
||||
{
|
||||
GtkWidget *topmenu, *menu;
|
||||
GtkWidget *mi;
|
||||
|
@ -454,7 +467,7 @@ build_suggestion_menu (XedAutomaticSpellChecker *spell, const gchar *word)
|
|||
|
||||
label = gtk_label_new (label_text);
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
|
||||
mi = gtk_menu_item_new ();
|
||||
gtk_container_add (GTK_CONTAINER (mi), label);
|
||||
|
@ -468,10 +481,8 @@ build_suggestion_menu (XedAutomaticSpellChecker *spell, const gchar *word)
|
|||
(GDestroyNotify)g_free);
|
||||
|
||||
g_free (label_text);
|
||||
g_signal_connect (mi,
|
||||
"activate",
|
||||
G_CALLBACK (replace_word),
|
||||
spell);
|
||||
g_signal_connect (mi, "activate",
|
||||
G_CALLBACK (replace_word), spell);
|
||||
|
||||
count++;
|
||||
|
||||
|
@ -496,30 +507,20 @@ build_suggestion_menu (XedAutomaticSpellChecker *spell, const gchar *word)
|
|||
gtk_menu_shell_append (GTK_MENU_SHELL (topmenu), mi);
|
||||
|
||||
/* Ignore all */
|
||||
mi = gtk_image_menu_item_new_with_mnemonic (_("_Ignore All"));
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mi),
|
||||
gtk_image_new_from_stock (GTK_STOCK_GOTO_BOTTOM,
|
||||
GTK_ICON_SIZE_MENU));
|
||||
mi = gtk_menu_item_new_with_mnemonic (_("_Ignore All"));
|
||||
|
||||
g_signal_connect (mi,
|
||||
"activate",
|
||||
G_CALLBACK(ignore_all),
|
||||
spell);
|
||||
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_image_menu_item_new_with_mnemonic (_("_Add"));
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mi),
|
||||
gtk_image_new_from_stock (GTK_STOCK_ADD,
|
||||
GTK_ICON_SIZE_MENU));
|
||||
mi = gtk_menu_item_new_with_mnemonic (_("_Add"));
|
||||
|
||||
g_signal_connect (mi,
|
||||
"activate",
|
||||
G_CALLBACK (add_to_dictionary),
|
||||
spell);
|
||||
g_signal_connect (mi, "activate",
|
||||
G_CALLBACK (add_to_dictionary), spell);
|
||||
|
||||
gtk_widget_show_all (mi);
|
||||
|
||||
|
@ -529,9 +530,11 @@ build_suggestion_menu (XedAutomaticSpellChecker *spell, const gchar *word)
|
|||
}
|
||||
|
||||
static void
|
||||
populate_popup (GtkTextView *textview, GtkMenu *menu, XedAutomaticSpellChecker *spell)
|
||||
populate_popup (GtkTextView *textview,
|
||||
GtkMenu *menu,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
GtkWidget *img, *mi;
|
||||
GtkWidget *mi;
|
||||
GtkTextIter start, end;
|
||||
char *word;
|
||||
|
||||
|
@ -541,7 +544,9 @@ populate_popup (GtkTextView *textview, GtkMenu *menu, XedAutomaticSpellChecker *
|
|||
/* 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 ();
|
||||
|
@ -549,13 +554,10 @@ populate_popup (GtkTextView *textview, GtkMenu *menu, XedAutomaticSpellChecker *
|
|||
gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), mi);
|
||||
|
||||
/* then, on top of it, the suggestions menu. */
|
||||
img = gtk_image_new_from_stock (GTK_STOCK_SPELL_CHECK, GTK_ICON_SIZE_MENU);
|
||||
mi = gtk_image_menu_item_new_with_mnemonic (_("_Spelling Suggestions..."));
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mi), img);
|
||||
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));
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (mi), build_suggestion_menu (spell, word));
|
||||
g_free(word);
|
||||
|
||||
gtk_widget_show_all (mi);
|
||||
|
@ -583,9 +585,13 @@ add_word_signal_cb (XedSpellChecker *checker,
|
|||
gchar *w;
|
||||
|
||||
if (len < 0)
|
||||
{
|
||||
w = g_strdup (word);
|
||||
}
|
||||
else
|
||||
{
|
||||
w = g_strndup (word, len);
|
||||
}
|
||||
|
||||
remove_tag_to_word (spell, w);
|
||||
|
||||
|
@ -625,12 +631,11 @@ button_press_event (GtkTextView *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_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);
|
||||
|
||||
|
@ -645,7 +650,8 @@ button_press_event (GtkTextView *view,
|
|||
* will contain the wrong set of suggestions.
|
||||
*/
|
||||
static gboolean
|
||||
popup_menu_event (GtkTextView *view, XedAutomaticSpellChecker *spell)
|
||||
popup_menu_event (GtkTextView *view,
|
||||
XedAutomaticSpellChecker *spell)
|
||||
{
|
||||
GtkTextIter iter;
|
||||
GtkTextBuffer *buffer;
|
||||
|
@ -654,10 +660,11 @@ popup_menu_event (GtkTextView *view, XedAutomaticSpellChecker *spell)
|
|||
|
||||
/* 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_get_iter_at_mark (buffer, &iter, gtk_text_buffer_get_insert (buffer));
|
||||
gtk_text_buffer_move_mark (buffer, spell->mark_click, &iter);
|
||||
|
||||
return FALSE;
|
||||
|
@ -669,8 +676,7 @@ tag_table_changed (GtkTextTagTable *table,
|
|||
{
|
||||
g_return_if_fail (spell->tag_highlight != NULL);
|
||||
|
||||
gtk_text_tag_set_priority (spell->tag_highlight,
|
||||
gtk_text_tag_table_get_size (table) - 1);
|
||||
gtk_text_tag_set_priority (spell->tag_highlight, gtk_text_tag_table_get_size (table) - 1);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -716,8 +722,7 @@ xed_automatic_spell_checker_new (XedDocument *doc,
|
|||
|
||||
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);
|
||||
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);
|
||||
|
@ -727,85 +732,54 @@ xed_automatic_spell_checker_new (XedDocument *doc,
|
|||
|
||||
if (automatic_spell_checker_id == 0)
|
||||
{
|
||||
automatic_spell_checker_id =
|
||||
g_quark_from_string ("XedAutomaticSpellCheckerID");
|
||||
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_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, "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 (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);
|
||||
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),
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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. */
|
||||
|
@ -816,17 +790,14 @@ xed_automatic_spell_checker_new (XedDocument *doc,
|
|||
|
||||
if (spell->mark_insert_start == NULL)
|
||||
{
|
||||
spell->mark_insert_start =
|
||||
gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
|
||||
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);
|
||||
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),
|
||||
|
@ -834,17 +805,14 @@ xed_automatic_spell_checker_new (XedDocument *doc,
|
|||
|
||||
if (spell->mark_insert_end == NULL)
|
||||
{
|
||||
spell->mark_insert_end =
|
||||
gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
|
||||
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);
|
||||
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),
|
||||
|
@ -852,17 +820,14 @@ xed_automatic_spell_checker_new (XedDocument *doc,
|
|||
|
||||
if (spell->mark_click == NULL)
|
||||
{
|
||||
spell->mark_click =
|
||||
gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
|
||||
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);
|
||||
gtk_text_buffer_move_mark (GTK_TEXT_BUFFER (doc), spell->mark_click, &start);
|
||||
}
|
||||
|
||||
spell->deferred_check = FALSE;
|
||||
|
@ -876,7 +841,9 @@ 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);
|
||||
}
|
||||
|
@ -888,7 +855,9 @@ xed_automatic_spell_checker_free (XedAutomaticSpellChecker *spell)
|
|||
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);
|
||||
}
|
||||
|
@ -906,13 +875,8 @@ xed_automatic_spell_checker_free_internal (XedAutomaticSpellChecker *spell)
|
|||
|
||||
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);
|
||||
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,
|
||||
|
@ -958,46 +922,34 @@ xed_automatic_spell_checker_free_internal (XedAutomaticSpellChecker *spell)
|
|||
}
|
||||
|
||||
void
|
||||
xed_automatic_spell_checker_attach_view (
|
||||
XedAutomaticSpellChecker *spell,
|
||||
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_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);
|
||||
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,
|
||||
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 (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),
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <xed/xed-utils.h>
|
||||
#include <xed/xed-help.h>
|
||||
#include <xed/xed-app.h>
|
||||
#include "xed-spell-language-dialog.h"
|
||||
#include "xed-spell-checker-language.h"
|
||||
|
||||
|
@ -70,9 +70,7 @@ dialog_response_handler (GtkDialog *dlg,
|
|||
{
|
||||
if (res_id == GTK_RESPONSE_HELP)
|
||||
{
|
||||
xed_help_display (GTK_WINDOW (dlg),
|
||||
NULL,
|
||||
"xed-spell-checker-plugin");
|
||||
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");
|
||||
}
|
||||
|
@ -99,8 +97,7 @@ scroll_to_selected (GtkTreeView *tree_view)
|
|||
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_view_scroll_to_cell (tree_view, path, NULL, TRUE, 1.0, 0.0);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
}
|
||||
|
@ -130,12 +127,9 @@ create_dialog (XedSpellLanguageDialog *dlg,
|
|||
};
|
||||
|
||||
gtk_dialog_add_buttons (GTK_DIALOG (dlg),
|
||||
GTK_STOCK_CANCEL,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OK,
|
||||
GTK_RESPONSE_OK,
|
||||
GTK_STOCK_HELP,
|
||||
GTK_RESPONSE_HELP,
|
||||
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
||||
_("_OK"), GTK_RESPONSE_OK,
|
||||
_("_Help"), GTK_RESPONSE_HELP,
|
||||
NULL);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (dlg), _("Set language"));
|
||||
|
@ -144,17 +138,12 @@ create_dialog (XedSpellLanguageDialog *dlg,
|
|||
|
||||
/* 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); /* 2 * 5 + 2 = 12 */
|
||||
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);
|
||||
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);
|
||||
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,
|
||||
|
@ -169,24 +158,18 @@ create_dialog (XedSpellLanguageDialog *dlg,
|
|||
{
|
||||
gtk_widget_show (error_widget);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
|
||||
error_widget,
|
||||
TRUE, TRUE, 0);
|
||||
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);
|
||||
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));
|
||||
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);
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (dlg->languages_treeview), dlg->model);
|
||||
|
||||
g_object_unref (dlg->model);
|
||||
|
||||
|
@ -198,20 +181,14 @@ create_dialog (XedSpellLanguageDialog *dlg,
|
|||
COLUMN_LANGUAGE_NAME,
|
||||
NULL);
|
||||
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (dlg->languages_treeview),
|
||||
column);
|
||||
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);
|
||||
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);
|
||||
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
|
||||
|
@ -294,12 +271,11 @@ xed_spell_language_get_selected_language (XedSpellLanguageDialog *dlg)
|
|||
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);
|
||||
gtk_tree_model_get_value (dlg->model, &iter, COLUMN_LANGUAGE_POINTER, &value);
|
||||
|
||||
lang = (const XedSpellCheckerLanguage* ) g_value_get_pointer (&value);
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ G_BEGIN_DECLS
|
|||
|
||||
|
||||
typedef struct _XedSpellLanguageDialog XedSpellLanguageDialog;
|
||||
|
||||
typedef struct _XedSpellLanguageDialogClass XedSpellLanguageDialogClass;
|
||||
|
||||
struct _XedSpellLanguageDialogClass
|
||||
|
@ -58,8 +57,7 @@ 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);
|
||||
const XedSpellCheckerLanguage *xed_spell_language_get_selected_language (XedSpellLanguageDialog *dlg);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,13 +25,11 @@
|
|||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <xed/xed-plugin.h>
|
||||
#include <libpeas/peas-extension-base.h>
|
||||
#include <libpeas/peas-object-module.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Type checking and casting macros
|
||||
*/
|
||||
#define XED_TYPE_SPELL_PLUGIN (xed_spell_plugin_get_type ())
|
||||
#define XED_SPELL_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), XED_TYPE_SPELL_PLUGIN, XedSpellPlugin))
|
||||
#define XED_SPELL_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), XED_TYPE_SPELL_PLUGIN, XedSpellPluginClass))
|
||||
|
@ -39,38 +37,25 @@ G_BEGIN_DECLS
|
|||
#define XED_IS_SPELL_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), XED_TYPE_SPELL_PLUGIN))
|
||||
#define XED_SPELL_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), XED_TYPE_SPELL_PLUGIN, XedSpellPluginClass))
|
||||
|
||||
/* Private structure type */
|
||||
typedef struct _XedSpellPluginPrivate XedSpellPluginPrivate;
|
||||
|
||||
/*
|
||||
* Main object structure
|
||||
*/
|
||||
typedef struct _XedSpellPlugin XedSpellPlugin;
|
||||
typedef struct _XedSpellPluginPrivate XedSpellPluginPrivate;
|
||||
typedef struct _XedSpellPluginClass XedSpellPluginClass;
|
||||
|
||||
struct _XedSpellPlugin
|
||||
{
|
||||
XedPlugin parent_instance;
|
||||
PeasExtensionBase parent_instance;
|
||||
|
||||
XedSpellPluginPrivate *priv;
|
||||
};
|
||||
|
||||
/*
|
||||
* Class definition
|
||||
*/
|
||||
typedef struct _XedSpellPluginClass XedSpellPluginClass;
|
||||
|
||||
struct _XedSpellPluginClass
|
||||
{
|
||||
XedPluginClass parent_class;
|
||||
PeasExtensionBaseClass parent_class;
|
||||
};
|
||||
|
||||
/*
|
||||
* Public methods
|
||||
*/
|
||||
GType xed_spell_plugin_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* All the plugins must implement this function */
|
||||
G_MODULE_EXPORT GType register_xed_plugin (GTypeModule *module);
|
||||
G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -1,29 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--*- mode: xml -*-->
|
||||
<!-- Generated with glade 3.18.3 -->
|
||||
<interface>
|
||||
<object class="GtkDialog" id="spell_dialog">
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<object class="GtkDialog" id="dialog1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes">_Configure Spell Checker plugin...</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="type_hint">normal</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">8</property>
|
||||
<property name="orientation">vertical</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="button1">
|
||||
<property name="label">gtk-help</property>
|
||||
<object class="GtkButton" id="button3">
|
||||
<property name="label" translatable="yes">button</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>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
|
@ -32,13 +28,11 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button3">
|
||||
<property name="label">gtk-cancel</property>
|
||||
<object class="GtkButton" id="button2">
|
||||
<property name="label" translatable="yes">button</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>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
|
@ -47,13 +41,11 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button4">
|
||||
<property name="label">gtk-ok</property>
|
||||
<object class="GtkButton" id="button1">
|
||||
<property name="label" translatable="yes">button</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>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
|
@ -62,45 +54,149 @@
|
|||
</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="GtkVBox" id="spell_dialog_content">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Autocheck spelling on document load...</property>
|
||||
<property name="xalign">0</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="spell_dialog_content">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_bottom">12</property>
|
||||
<property name="border_width">8</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="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">Autocheck settings</property>
|
||||
<property name="xalign">0</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">30</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="autocheck_never">
|
||||
<property name="label" translatable="yes">_Never autocheck</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="height">2</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">Never</property>
|
||||
<property name="xalign">0</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Never autocheck spelling on document load</property>
|
||||
<property name="xalign">0</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="GtkGrid" id="grid2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="autocheck_document">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">autocheck_never</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="height">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Remember by document</property>
|
||||
<property name="xalign">0</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Remembers the setting for each document on load</property>
|
||||
<property name="xalign">0</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>
|
||||
|
@ -108,39 +204,65 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="autocheck_document">
|
||||
<property name="label" translatable="yes">_Remember autocheck by document</property>
|
||||
<object class="GtkGrid" id="grid3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="autocheck_always">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">autocheck_never</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="height">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Always</property>
|
||||
<property name="xalign">0</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label7">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Always autocheck on document load</property>
|
||||
<property name="xalign">0</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">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="autocheck_always">
|
||||
<property name="label" translatable="yes">_Always autocheck</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">autocheck_never</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -152,10 +274,5 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="0">button1</action-widget>
|
||||
<action-widget response="0">button3</action-widget>
|
||||
<action-widget response="0">button4</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "xed-spell-utils.h"
|
||||
#include <gtksourceview/gtksourcebuffer.h>
|
||||
#include <gtksourceview/gtksource.h>
|
||||
|
||||
gboolean
|
||||
xed_spell_utils_is_digit (const char *text, gssize length)
|
||||
|
|
|
@ -30,9 +30,9 @@ libtaglist_la_SOURCES = \
|
|||
libtaglist_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
|
||||
libtaglist_la_LIBADD = $(XED_LIBS)
|
||||
|
||||
plugin_in_files = taglist.xed-plugin.desktop.in
|
||||
plugin_in_files = taglist.plugin.desktop.in
|
||||
|
||||
%.xed-plugin: %.xed-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po)
|
||||
%.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
|
||||
|
@ -41,7 +41,7 @@ GZIP_ENV = -9
|
|||
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:.xed-plugin.desktop.in=.xed-plugin)
|
||||
plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(taglist_in_files) $(taglist_DATA) \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[Xed Plugin]
|
||||
[Plugin]
|
||||
Module=taglist
|
||||
IAge=2
|
||||
_Name=Tag list
|
|
@ -39,7 +39,6 @@
|
|||
|
||||
#include <xed/xed-utils.h>
|
||||
#include <xed/xed-debug.h>
|
||||
#include <xed/xed-plugin.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
@ -69,7 +68,7 @@ struct _XedTaglistPluginPanelPrivate
|
|||
gchar *data_dir;
|
||||
};
|
||||
|
||||
XED_PLUGIN_DEFINE_TYPE (XedTaglistPluginPanel, xed_taglist_plugin_panel, GTK_TYPE_BOX)
|
||||
G_DEFINE_DYNAMIC_TYPE (XedTaglistPluginPanel, xed_taglist_plugin_panel, GTK_TYPE_BOX)
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -160,6 +159,12 @@ xed_taglist_plugin_panel_class_init (XedTaglistPluginPanelClass *klass)
|
|||
g_type_class_add_private (object_class, sizeof(XedTaglistPluginPanelPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
xed_taglist_plugin_panel_class_finalize (XedTaglistPluginPanelClass *klass)
|
||||
{
|
||||
/* dummy function - used by G_DEFINE_DYNAMIC_TYPE */
|
||||
}
|
||||
|
||||
static void
|
||||
insert_tag (XedTaglistPluginPanel *panel,
|
||||
Tag *tag,
|
||||
|
@ -634,8 +639,8 @@ add_preview_widget (XedTaglistPluginPanel *panel)
|
|||
|
||||
gtk_widget_set_halign (panel->priv->preview, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (panel->priv->preview, GTK_ALIGN_START);
|
||||
gtk_widget_set_margin_left (panel->priv->preview, 6);
|
||||
gtk_widget_set_margin_right (panel->priv->preview, 6);
|
||||
gtk_widget_set_margin_start (panel->priv->preview, 6);
|
||||
gtk_widget_set_margin_end (panel->priv->preview, 6);
|
||||
gtk_widget_set_margin_top (panel->priv->preview, 6);
|
||||
gtk_widget_set_margin_bottom (panel->priv->preview, 6);
|
||||
|
||||
|
@ -786,3 +791,9 @@ xed_taglist_plugin_panel_new (XedWindow *window,
|
|||
|
||||
return GTK_WIDGET (panel);
|
||||
}
|
||||
|
||||
void
|
||||
_xed_taglist_plugin_panel_register_type (GTypeModule *type_module)
|
||||
{
|
||||
xed_taglist_plugin_panel_register_type (type_module);
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ struct _XedTaglistPluginPanelClass
|
|||
/*
|
||||
* Public methods
|
||||
*/
|
||||
GType xed_taglist_plugin_panel_register_type (GTypeModule *module);
|
||||
void _xed_taglist_plugin_panel_register_type (GTypeModule *module);
|
||||
|
||||
GType xed_taglist_plugin_panel_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#include "xed-taglist-plugin-parser.h"
|
||||
|
||||
/* we screwed up so we still look here for compatibility */
|
||||
#define USER_XED_TAGLIST_PLUGIN_LOCATION_LEGACY ".xed/plugins/taglist/"
|
||||
#define USER_XED_TAGLIST_PLUGIN_LOCATION "xed/taglist/"
|
||||
|
||||
TagList* taglist = NULL;
|
||||
|
@ -603,32 +602,11 @@ TagList* create_taglist(const gchar* data_dir)
|
|||
}
|
||||
|
||||
const gchar* home;
|
||||
const gchar* envvar;
|
||||
|
||||
/* load user's taglists */
|
||||
|
||||
/* legacy dir */
|
||||
home = g_get_home_dir ();
|
||||
if (home != NULL)
|
||||
{
|
||||
pdir = g_build_filename (home,
|
||||
USER_XED_TAGLIST_PLUGIN_LOCATION_LEGACY,
|
||||
NULL);
|
||||
parse_taglist_dir (pdir);
|
||||
g_free (pdir);
|
||||
}
|
||||
|
||||
/* Support old libmate env var */
|
||||
envvar = g_getenv ("MATE22_USER_DIR");
|
||||
if (envvar != NULL)
|
||||
{
|
||||
pdir = g_build_filename (envvar,
|
||||
USER_XED_TAGLIST_PLUGIN_LOCATION,
|
||||
NULL);
|
||||
parse_taglist_dir (pdir);
|
||||
g_free (pdir);
|
||||
}
|
||||
else if (home != NULL)
|
||||
{
|
||||
pdir = g_build_filename(home, ".config", USER_XED_TAGLIST_PLUGIN_LOCATION, NULL);
|
||||
parse_taglist_dir(pdir);
|
||||
|
|
|
@ -36,24 +36,38 @@
|
|||
#include "xed-taglist-plugin-parser.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
#include <xed/xed-plugin.h>
|
||||
#include <xed/xed-window.h>
|
||||
#include <xed/xed-window-activatable.h>
|
||||
#include <xed/xed-debug.h>
|
||||
|
||||
#define WINDOW_DATA_KEY "XedTaglistPluginWindowData"
|
||||
|
||||
#define XED_TAGLIST_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), XED_TYPE_TAGLIST_PLUGIN, XedTaglistPluginPrivate))
|
||||
|
||||
struct _XedTaglistPluginPrivate
|
||||
{
|
||||
gpointer dummy;
|
||||
XedWindow *window;
|
||||
|
||||
GtkWidget *taglist_panel;
|
||||
};
|
||||
|
||||
XED_PLUGIN_REGISTER_TYPE_WITH_CODE (XedTaglistPlugin, xed_taglist_plugin,
|
||||
xed_taglist_plugin_panel_register_type (module);
|
||||
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
|
||||
};
|
||||
|
||||
static void
|
||||
xed_taglist_plugin_init (XedTaglistPlugin *plugin)
|
||||
{
|
||||
|
@ -62,12 +76,21 @@ xed_taglist_plugin_init (XedTaglistPlugin *plugin)
|
|||
xed_debug_message (DEBUG_PLUGINS, "XedTaglistPlugin initializing");
|
||||
}
|
||||
|
||||
static void
|
||||
xed_taglist_plugin_dispose (GObject *object)
|
||||
{
|
||||
XedTaglistPlugin *plugin = XED_TAGLIST_PLUGIN (object);
|
||||
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedTaglistPlugin disposing");
|
||||
|
||||
g_clear_object (&plugin->priv->window);
|
||||
|
||||
G_OBJECT_CLASS (xed_taglist_plugin_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_taglist_plugin_finalize (GObject *object)
|
||||
{
|
||||
/*
|
||||
XedTaglistPlugin *plugin = XED_TAGLIST_PLUGIN (object);
|
||||
*/
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedTaglistPlugin finalizing");
|
||||
|
||||
free_taglist ();
|
||||
|
@ -76,85 +99,127 @@ xed_taglist_plugin_finalize (GObject *object)
|
|||
}
|
||||
|
||||
static void
|
||||
impl_activate (XedPlugin *plugin,
|
||||
XedWindow *window)
|
||||
xed_taglist_plugin_activate (XedWindowActivatable *activatable)
|
||||
{
|
||||
XedTaglistPluginPrivate *priv;
|
||||
XedPanel *side_panel;
|
||||
GtkWidget *taglist_panel;
|
||||
gchar *data_dir;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
g_return_if_fail (g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY) == NULL);
|
||||
priv = XED_TAGLIST_PLUGIN (activatable)->priv;
|
||||
side_panel = xed_window_get_side_panel (priv->window);
|
||||
|
||||
side_panel = xed_window_get_side_panel (window);
|
||||
|
||||
data_dir = xed_plugin_get_data_dir (plugin);
|
||||
taglist_panel = xed_taglist_plugin_panel_new (window, data_dir);
|
||||
data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (activatable));
|
||||
priv->taglist_panel = xed_taglist_plugin_panel_new (priv->window, data_dir);
|
||||
g_free (data_dir);
|
||||
|
||||
xed_panel_add_item_with_stock_icon (side_panel,
|
||||
taglist_panel,
|
||||
_("Tags"),
|
||||
GTK_STOCK_ADD);
|
||||
|
||||
g_object_set_data (G_OBJECT (window),
|
||||
WINDOW_DATA_KEY,
|
||||
taglist_panel);
|
||||
xed_panel_add_item (side_panel, priv->taglist_panel, _("Tags"), "list-add");
|
||||
}
|
||||
|
||||
static void
|
||||
impl_deactivate (XedPlugin *plugin,
|
||||
XedWindow *window)
|
||||
xed_taglist_plugin_deactivate (XedWindowActivatable *activatable)
|
||||
{
|
||||
XedTaglistPluginPrivate *priv;
|
||||
XedPanel *side_panel;
|
||||
gpointer data;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
data = g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
|
||||
g_return_if_fail (data != NULL);
|
||||
priv = XED_TAGLIST_PLUGIN (activatable)->priv;
|
||||
side_panel = xed_window_get_side_panel (priv->window);
|
||||
|
||||
side_panel = xed_window_get_side_panel (window);
|
||||
|
||||
xed_panel_remove_item (side_panel,
|
||||
GTK_WIDGET (data));
|
||||
|
||||
g_object_set_data (G_OBJECT (window),
|
||||
WINDOW_DATA_KEY,
|
||||
NULL);
|
||||
xed_panel_remove_item (side_panel, priv->taglist_panel);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_update_ui (XedPlugin *plugin,
|
||||
XedWindow *window)
|
||||
xed_taglist_plugin_update_state (XedWindowActivatable *activatable)
|
||||
{
|
||||
gpointer data;
|
||||
XedTaglistPluginPrivate *priv;
|
||||
XedView *view;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
data = g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
|
||||
g_return_if_fail (data != NULL);
|
||||
priv = XED_TAGLIST_PLUGIN (activatable)->priv;
|
||||
view = xed_window_get_active_view (priv->window);
|
||||
|
||||
view = xed_window_get_active_view (window);
|
||||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (data),
|
||||
gtk_widget_set_sensitive (priv->taglist_panel,
|
||||
(view != NULL) &&
|
||||
gtk_text_view_get_editable (GTK_TEXT_VIEW (view)));
|
||||
}
|
||||
|
||||
static void
|
||||
xed_taglist_plugin_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XedTaglistPlugin *plugin = XED_TAGLIST_PLUGIN (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WINDOW:
|
||||
plugin->priv->window = XED_WINDOW (g_value_dup_object (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xed_taglist_plugin_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XedTaglistPlugin *plugin = XED_TAGLIST_PLUGIN (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WINDOW:
|
||||
g_value_set_object (value, plugin->priv->window);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xed_taglist_plugin_class_init (XedTaglistPluginClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
XedPluginClass *plugin_class = XED_PLUGIN_CLASS (klass);
|
||||
|
||||
object_class->finalize = xed_taglist_plugin_finalize;
|
||||
object_class->dispose = xed_taglist_plugin_dispose;
|
||||
object_class->set_property = xed_taglist_plugin_set_property;
|
||||
object_class->get_property = xed_taglist_plugin_get_property;
|
||||
|
||||
plugin_class->activate = impl_activate;
|
||||
plugin_class->deactivate = impl_deactivate;
|
||||
plugin_class->update_ui = impl_update_ui;
|
||||
g_object_class_override_property (object_class, PROP_WINDOW, "window");
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedTaglistPluginPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
xed_taglist_plugin_class_finalize (XedTaglistPluginClass *klass)
|
||||
{
|
||||
/* dummy function - used by G_DEFINE_DYNAMIC_TYPE_EXTENDED */
|
||||
}
|
||||
|
||||
static void
|
||||
xed_window_activatable_iface_init (XedWindowActivatableInterface *iface)
|
||||
{
|
||||
iface->activate = xed_taglist_plugin_activate;
|
||||
iface->deactivate = xed_taglist_plugin_deactivate;
|
||||
iface->update_state = xed_taglist_plugin_update_state;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
peas_register_types (PeasObjectModule *module)
|
||||
{
|
||||
xed_taglist_plugin_register_type (G_TYPE_MODULE (module));
|
||||
|
||||
peas_object_module_register_extension_type (module,
|
||||
XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
XED_TYPE_TAGLIST_PLUGIN);
|
||||
}
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
* Modified by the xed Team, 2002-2005. See the AUTHORS file for a
|
||||
* list of people on the xed Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __XED_TAGLIST_PLUGIN_H__
|
||||
|
@ -32,7 +30,8 @@
|
|||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <xed/xed-plugin.h>
|
||||
#include <libpeas/peas-extension-base.h>
|
||||
#include <libpeas/peas-object-module.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
@ -46,39 +45,26 @@ G_BEGIN_DECLS
|
|||
#define XED_IS_TAGLIST_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), XED_TYPE_TAGLIST_PLUGIN))
|
||||
#define XED_TAGLIST_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), XED_TYPE_TAGLIST_PLUGIN, XedTaglistPluginClass))
|
||||
|
||||
/* Private structure type */
|
||||
typedef struct _XedTaglistPluginPrivate XedTaglistPluginPrivate;
|
||||
|
||||
/*
|
||||
* Main object structure
|
||||
*/
|
||||
typedef struct _XedTaglistPlugin XedTaglistPlugin;
|
||||
typedef struct _XedTaglistPluginPrivate XedTaglistPluginPrivate;
|
||||
typedef struct _XedTaglistPluginClass XedTaglistPluginClass;
|
||||
|
||||
struct _XedTaglistPlugin
|
||||
{
|
||||
XedPlugin parent_instance;
|
||||
PeasExtensionBase parent_instance;
|
||||
|
||||
/*< private >*/
|
||||
XedTaglistPluginPrivate *priv;
|
||||
};
|
||||
|
||||
/*
|
||||
* Class definition
|
||||
*/
|
||||
typedef struct _XedTaglistPluginClass XedTaglistPluginClass;
|
||||
|
||||
struct _XedTaglistPluginClass
|
||||
{
|
||||
XedPluginClass parent_class;
|
||||
PeasExtensionBaseClass parent_class;
|
||||
};
|
||||
|
||||
/*
|
||||
* Public methods
|
||||
*/
|
||||
GType xed_taglist_plugin_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* All the plugins must implement this function */
|
||||
G_MODULE_EXPORT GType register_xed_plugin (GTypeModule *module);
|
||||
G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -21,11 +21,11 @@ ui_DATA = \
|
|||
xed-time-dialog.ui \
|
||||
xed-time-setup-dialog.ui
|
||||
|
||||
plugin_in_files = time.xed-plugin.desktop.in
|
||||
plugin_in_files = time.plugin.desktop.in
|
||||
|
||||
%.xed-plugin: %.xed-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: %.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:.xed-plugin.desktop.in=.xed-plugin)
|
||||
plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
|
||||
|
||||
@INTLTOOL_XML_NOMERGE_RULE@
|
||||
time_gschema_in = org.x.editor.plugins.time.gschema.xml.in
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[Xed Plugin]
|
||||
[Plugin]
|
||||
Module=time
|
||||
IAge=2
|
||||
_Name=Insert Date/Time
|
File diff suppressed because it is too large
Load Diff
|
@ -25,13 +25,11 @@
|
|||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <xed/xed-plugin.h>
|
||||
#include <libpeas/peas-extension-base.h>
|
||||
#include <libpeas/peas-object-module.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Type checking and casting macros
|
||||
*/
|
||||
#define XED_TYPE_TIME_PLUGIN (xed_time_plugin_get_type ())
|
||||
#define XED_TIME_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), XED_TYPE_TIME_PLUGIN, XedTimePlugin))
|
||||
#define XED_TIME_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), XED_TYPE_TIME_PLUGIN, XedTimePluginClass))
|
||||
|
@ -39,39 +37,27 @@ G_BEGIN_DECLS
|
|||
#define XED_IS_TIME_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), XED_TYPE_TIME_PLUGIN))
|
||||
#define XED_TIME_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), XED_TYPE_TIME_PLUGIN, XedTimePluginClass))
|
||||
|
||||
/* Private structure type */
|
||||
typedef struct _XedTimePluginPrivate XedTimePluginPrivate;
|
||||
|
||||
/*
|
||||
* Main object structure
|
||||
*/
|
||||
typedef struct _XedTimePlugin XedTimePlugin;
|
||||
typedef struct _XedTimePluginPrivate XedTimePluginPrivate;
|
||||
typedef struct _XedTimePluginClass XedTimePluginClass;
|
||||
|
||||
struct _XedTimePlugin
|
||||
{
|
||||
XedPlugin parent_instance;
|
||||
PeasExtensionBase parent_instance;
|
||||
|
||||
/*< private >*/
|
||||
XedTimePluginPrivate *priv;
|
||||
};
|
||||
|
||||
/*
|
||||
* Class definition
|
||||
*/
|
||||
typedef struct _XedTimePluginClass XedTimePluginClass;
|
||||
|
||||
struct _XedTimePluginClass
|
||||
{
|
||||
XedPluginClass parent_class;
|
||||
PeasExtensionBaseClass parent_class;
|
||||
};
|
||||
|
||||
/*
|
||||
* Public methods
|
||||
*/
|
||||
GType xed_time_plugin_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* All the plugins must implement this function */
|
||||
G_MODULE_EXPORT GType register_xed_plugin (GTypeModule *module);
|
||||
G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@ libtrailsave_la_SOURCES = \
|
|||
libtrailsave_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
|
||||
libtrailsave_la_LIBADD = $(XED_LIBS)
|
||||
|
||||
plugin_in_files = trailsave.xed-plugin.desktop.in
|
||||
plugin_in_files = trailsave.plugin.desktop.in
|
||||
|
||||
%.xed-plugin: %.xed-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: %.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:.xed-plugin.desktop.in=.xed-plugin)
|
||||
plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
|
||||
|
||||
EXTRA_DIST = $(plugin_in_files)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[Xed Plugin]
|
||||
[Plugin]
|
||||
Module=trailsave
|
||||
IAge=2
|
||||
_Name=Save Without Trailing Spaces
|
|
@ -14,8 +14,6 @@
|
|||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -24,7 +22,33 @@
|
|||
|
||||
#include "xed-trail-save-plugin.h"
|
||||
|
||||
XED_PLUGIN_REGISTER_TYPE(XedTrailSavePlugin, xed_trail_save_plugin)
|
||||
#include <xed/xed-window.h>
|
||||
#include <xed/xed-window-activatable.h>
|
||||
#include <xed/xed-debug.h>
|
||||
|
||||
#define XED_TRAIL_SAVE_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
|
||||
XED_TYPE_TRAIL_SAVE_PLUGIN, \
|
||||
XedTrailSavePluginPrivate))
|
||||
|
||||
static void xed_window_activatable_iface_init (XedWindowActivatableInterface *iface);
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED (XedTrailSavePlugin,
|
||||
xed_trail_save_plugin,
|
||||
PEAS_TYPE_EXTENSION_BASE,
|
||||
0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
xed_window_activatable_iface_init))
|
||||
|
||||
struct _XedTrailSavePluginPrivate
|
||||
{
|
||||
XedWindow *window;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_WINDOW
|
||||
};
|
||||
|
||||
static void
|
||||
strip_trailing_spaces (GtkTextBuffer *text_buffer)
|
||||
|
@ -104,10 +128,7 @@ strip_trailing_spaces (GtkTextBuffer *text_buffer)
|
|||
|
||||
static void
|
||||
on_save (XedDocument *document,
|
||||
const gchar *uri,
|
||||
XedEncoding *encoding,
|
||||
XedDocumentSaveFlags save_flags,
|
||||
XedPlugin *plugin)
|
||||
XedTrailSavePlugin *plugin)
|
||||
{
|
||||
GtkTextBuffer *text_buffer = GTK_TEXT_BUFFER (document);
|
||||
|
||||
|
@ -117,18 +138,19 @@ on_save (XedDocument *document,
|
|||
static void
|
||||
on_tab_added (XedWindow *window,
|
||||
XedTab *tab,
|
||||
XedPlugin *plugin)
|
||||
XedTrailSavePlugin *plugin)
|
||||
{
|
||||
XedDocument *document;
|
||||
|
||||
document = xed_tab_get_document (tab);
|
||||
g_signal_connect (document, "save", G_CALLBACK (on_save), plugin);
|
||||
g_signal_connect (document, "save",
|
||||
G_CALLBACK (on_save), plugin);
|
||||
}
|
||||
|
||||
static void
|
||||
on_tab_removed (XedWindow *window,
|
||||
XedTab *tab,
|
||||
XedPlugin *plugin)
|
||||
XedTrailSavePlugin *plugin)
|
||||
{
|
||||
XedDocument *document;
|
||||
|
||||
|
@ -137,51 +159,58 @@ on_tab_removed (XedWindow *window,
|
|||
}
|
||||
|
||||
static void
|
||||
impl_activate (XedPlugin *plugin,
|
||||
XedWindow *window)
|
||||
xed_trail_save_plugin_activate (XedWindowActivatable *activatable)
|
||||
{
|
||||
XedTrailSavePluginPrivate *priv;
|
||||
GList *documents;
|
||||
GList *documents_iter;
|
||||
XedDocument *document;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
g_signal_connect (window, "tab_added", G_CALLBACK (on_tab_added), plugin);
|
||||
g_signal_connect (window, "tab_removed", G_CALLBACK (on_tab_removed), plugin);
|
||||
priv = XED_TRAIL_SAVE_PLUGIN (activatable)->priv;
|
||||
|
||||
documents = xed_window_get_documents (window);
|
||||
g_signal_connect (priv->window, "tab_added",
|
||||
G_CALLBACK (on_tab_added), XED_TRAIL_SAVE_PLUGIN (activatable));
|
||||
g_signal_connect (priv->window, "tab_removed",
|
||||
G_CALLBACK (on_tab_removed), XED_TRAIL_SAVE_PLUGIN (activatable));
|
||||
|
||||
documents = xed_window_get_documents (priv->window);
|
||||
|
||||
for (documents_iter = documents;
|
||||
documents_iter && documents_iter->data;
|
||||
documents_iter = documents_iter->next)
|
||||
{
|
||||
document = (XedDocument *) documents_iter->data;
|
||||
g_signal_connect (document, "save", G_CALLBACK (on_save), plugin);
|
||||
g_signal_connect (document, "save",
|
||||
G_CALLBACK (on_save), XED_TRAIL_SAVE_PLUGIN (activatable));
|
||||
}
|
||||
|
||||
g_list_free (documents);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_deactivate (XedPlugin *plugin,
|
||||
XedWindow *window)
|
||||
xed_trail_save_plugin_deactivate (XedWindowActivatable *activatable)
|
||||
{
|
||||
XedTrailSavePluginPrivate *priv;
|
||||
GList *documents;
|
||||
GList *documents_iter;
|
||||
XedDocument *document;
|
||||
|
||||
xed_debug (DEBUG_PLUGINS);
|
||||
|
||||
g_signal_handlers_disconnect_by_data (window, plugin);
|
||||
priv = XED_TRAIL_SAVE_PLUGIN (activatable)->priv;
|
||||
|
||||
documents = xed_window_get_documents (window);
|
||||
g_signal_handlers_disconnect_by_data (priv->window, XED_TRAIL_SAVE_PLUGIN (activatable));
|
||||
|
||||
documents = xed_window_get_documents (priv->window);
|
||||
|
||||
for (documents_iter = documents;
|
||||
documents_iter && documents_iter->data;
|
||||
documents_iter = documents_iter->next)
|
||||
{
|
||||
document = (XedDocument *) documents_iter->data;
|
||||
g_signal_handlers_disconnect_by_data (document, plugin);
|
||||
g_signal_handlers_disconnect_by_data (document, XED_TRAIL_SAVE_PLUGIN (activatable));
|
||||
}
|
||||
|
||||
g_list_free (documents);
|
||||
|
@ -191,24 +220,93 @@ static void
|
|||
xed_trail_save_plugin_init (XedTrailSavePlugin *plugin)
|
||||
{
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedTrailSavePlugin initializing");
|
||||
|
||||
plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin, XED_TYPE_TRAIL_SAVE_PLUGIN, XedTrailSavePluginPrivate);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_trail_save_plugin_finalize (GObject *object)
|
||||
xed_trail_save_plugin_dispose (GObject *object)
|
||||
{
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedTrailSavePlugin finalizing");
|
||||
XedTrailSavePlugin *plugin = XED_TRAIL_SAVE_PLUGIN (object);
|
||||
|
||||
G_OBJECT_CLASS (xed_trail_save_plugin_parent_class)->finalize (object);
|
||||
xed_debug_message (DEBUG_PLUGINS, "XedTrailSavePlugin disposing");
|
||||
|
||||
g_clear_object (&plugin->priv->window);
|
||||
|
||||
G_OBJECT_CLASS (xed_trail_save_plugin_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
xed_trail_save_plugin_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XedTrailSavePlugin *plugin = XED_TRAIL_SAVE_PLUGIN (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WINDOW:
|
||||
plugin->priv->window = XED_WINDOW (g_value_dup_object (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xed_trail_save_plugin_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XedTrailSavePlugin *plugin = XED_TRAIL_SAVE_PLUGIN (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WINDOW:
|
||||
g_value_set_object (value, plugin->priv->window);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xed_trail_save_plugin_class_init (XedTrailSavePluginClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
XedPluginClass *plugin_class = XED_PLUGIN_CLASS (klass);
|
||||
|
||||
object_class->finalize = xed_trail_save_plugin_finalize;
|
||||
object_class->dispose = xed_trail_save_plugin_dispose;
|
||||
object_class->set_property = xed_trail_save_plugin_set_property;
|
||||
object_class->get_property = xed_trail_save_plugin_get_property;
|
||||
|
||||
plugin_class->activate = impl_activate;
|
||||
plugin_class->deactivate = impl_deactivate;
|
||||
g_object_class_override_property (object_class, PROP_WINDOW, "window");
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (XedTrailSavePluginPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
xed_trail_save_plugin_class_finalize (XedTrailSavePluginClass *klass)
|
||||
{
|
||||
/* dummy function - used by G_DEFINE_DYNAMIC_TYPE_EXTENDED */
|
||||
}
|
||||
|
||||
static void
|
||||
xed_window_activatable_iface_init (XedWindowActivatableInterface *iface)
|
||||
{
|
||||
iface->activate = xed_trail_save_plugin_activate;
|
||||
iface->deactivate = xed_trail_save_plugin_deactivate;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
peas_register_types (PeasObjectModule *module)
|
||||
{
|
||||
xed_trail_save_plugin_register_type (G_TYPE_MODULE (module));
|
||||
|
||||
peas_object_module_register_extension_type (module,
|
||||
XED_TYPE_WINDOW_ACTIVATABLE,
|
||||
XED_TYPE_TRAIL_SAVE_PLUGIN);
|
||||
}
|
||||
|
|
|
@ -23,13 +23,11 @@
|
|||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <xed/xed-plugin.h>
|
||||
#include <libpeas/peas-extension-base.h>
|
||||
#include <libpeas/peas-object-module.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Type checking and casting macros
|
||||
*/
|
||||
#define XED_TYPE_TRAIL_SAVE_PLUGIN (xed_trail_save_plugin_get_type ())
|
||||
#define XED_TRAIL_SAVE_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), XED_TYPE_TRAIL_SAVE_PLUGIN, XedTrailSavePlugin))
|
||||
#define XED_TRAIL_SAVE_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), XED_TYPE_TRAIL_SAVE_PLUGIN, XedTrailSavePluginClass))
|
||||
|
@ -37,33 +35,26 @@ G_BEGIN_DECLS
|
|||
#define XED_IS_TRAIL_SAVE_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), XED_TYPE_TRAIL_SAVE_PLUGIN))
|
||||
#define XED_TRAIL_SAVE_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), XED_TYPE_TRAIL_SAVE_PLUGIN, XedTrailSavePluginClass))
|
||||
|
||||
/*
|
||||
* Main object structure
|
||||
*/
|
||||
typedef struct _XedTrailSavePlugin XedTrailSavePlugin;
|
||||
typedef struct _XedTrailSavePluginPrivate XedTrailSavePluginPrivate;
|
||||
typedef struct _XedTrailSavePluginClass XedTrailSavePluginClass;
|
||||
|
||||
struct _XedTrailSavePlugin
|
||||
{
|
||||
XedPlugin parent_instance;
|
||||
};
|
||||
PeasExtensionBase parent_instance;
|
||||
|
||||
/*
|
||||
* Class definition
|
||||
*/
|
||||
typedef struct _XedTrailSavePluginClass XedTrailSavePluginClass;
|
||||
/*< private >*/
|
||||
XedTrailSavePluginPrivate *priv;
|
||||
};
|
||||
|
||||
struct _XedTrailSavePluginClass
|
||||
{
|
||||
XedPluginClass parent_class;
|
||||
PeasExtensionBaseClass parent_class;
|
||||
};
|
||||
|
||||
/*
|
||||
* Public methods
|
||||
*/
|
||||
GType xed_trail_save_plugin_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* All the plugins must implement this function */
|
||||
G_MODULE_EXPORT GType register_xed_plugin (GTypeModule *module);
|
||||
G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -16,9 +16,7 @@ xed/xed-commands-help.c
|
|||
xed/xed-commands-search.c
|
||||
xed/xed-debug.c
|
||||
xed/xed-document.c
|
||||
xed/xed-document-saver.c
|
||||
xed/xed-documents-panel.c
|
||||
xed/xed-encodings.c
|
||||
xed/xed-encodings-combo-box.c
|
||||
xed/xed-file-chooser-dialog.c
|
||||
xed/xed-gio-document-loader.c
|
||||
|
@ -27,7 +25,6 @@ xed/xed-help.c
|
|||
xed/xed-io-error-message-area.c
|
||||
xed/xed-notebook.c
|
||||
xed/xed-panel.c
|
||||
xed/xed-plugin-manager.c
|
||||
xed/xed-plugins-engine.c
|
||||
xed/xed-prefs-manager.c
|
||||
xed/xed-print-job.c
|
||||
|
@ -45,21 +42,19 @@ xed/xed-ui.xml
|
|||
xed/xed-utils.c
|
||||
xed/xed-view.c
|
||||
xed/xed-window.c
|
||||
plugins/changecase/changecase.xed-plugin.desktop.in
|
||||
plugins/changecase/xed-changecase-plugin.c
|
||||
plugins/docinfo/docinfo.xed-plugin.desktop.in
|
||||
plugins/docinfo/docinfo.plugin.desktop.in
|
||||
[type: gettext/glade]plugins/docinfo/docinfo.ui
|
||||
plugins/docinfo/xed-docinfo-plugin.c
|
||||
plugins/filebrowser/filebrowser.xed-plugin.desktop.in
|
||||
plugins/filebrowser/filebrowser.plugin.desktop.in
|
||||
[type: gettext/gsettings]plugins/filebrowser/org.x.editor.plugins.filebrowser.gschema.xml.in
|
||||
plugins/filebrowser/xed-file-bookmarks-store.c
|
||||
plugins/filebrowser/xed-file-browser-plugin.c
|
||||
plugins/filebrowser/xed-file-browser-store.c
|
||||
plugins/filebrowser/xed-file-browser-view.c
|
||||
plugins/filebrowser/xed-file-browser-widget.c
|
||||
plugins/modelines/modelines.xed-plugin.desktop.in
|
||||
plugins/modelines/modelines.plugin.desktop.in
|
||||
plugins/sort/xed-sort-plugin.c
|
||||
plugins/sort/sort.xed-plugin.desktop.in
|
||||
plugins/sort/sort.plugin.desktop.in
|
||||
[type: gettext/glade]plugins/sort/sort.ui
|
||||
[type: gettext/gsettings]plugins/spell/org.x.editor.plugins.spell.gschema.xml.in
|
||||
plugins/spell/xed-automatic-spell-checker.c
|
||||
|
@ -71,18 +66,18 @@ plugins/spell/xed-spell-plugin.c
|
|||
[type: gettext/glade]plugins/spell/languages-dialog.ui
|
||||
[type: gettext/glade]plugins/spell/spell-checker.ui
|
||||
[type: gettext/glade]plugins/spell/xed-spell-setup-dialog.ui
|
||||
plugins/spell/spell.xed-plugin.desktop.in
|
||||
plugins/spell/spell.plugin.desktop.in
|
||||
plugins/taglist/xed-taglist-plugin.c
|
||||
plugins/taglist/xed-taglist-plugin-panel.c
|
||||
plugins/taglist/xed-taglist-plugin-parser.c
|
||||
plugins/taglist/HTML.tags.xml.in
|
||||
plugins/taglist/Latex.tags.xml.in
|
||||
plugins/taglist/taglist.xed-plugin.desktop.in
|
||||
plugins/taglist/taglist.plugin.desktop.in
|
||||
plugins/taglist/XSLT.tags.xml.in
|
||||
plugins/taglist/XUL.tags.xml.in
|
||||
[type: gettext/gsettings]plugins/time/org.x.editor.plugins.time.gschema.xml.in
|
||||
plugins/time/xed-time-plugin.c
|
||||
plugins/time/time.xed-plugin.desktop.in
|
||||
plugins/trailsave/trailsave.xed-plugin.desktop.in
|
||||
plugins/time/time.plugin.desktop.in
|
||||
plugins/trailsave/trailsave.plugin.desktop.in
|
||||
[type: gettext/glade]plugins/time/xed-time-dialog.ui
|
||||
[type: gettext/glade]plugins/time/xed-time-setup-dialog.ui
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
AM_CPPFLAGS = -g -I$(top_srcdir) -I$(top_srcdir)/xed $(XED_DEBUG_FLAGS) $(XED_CFLAGS)
|
||||
|
||||
noinst_PROGRAMS = $(TEST_PROGS)
|
||||
progs_ldadd = $(top_builddir)/xed/libxed.la
|
||||
|
||||
TEST_PROGS = smart-converter
|
||||
smart_converter_SOURCES = smart-converter.c
|
||||
smart_converter_LDADD = $(progs_ldadd)
|
||||
|
||||
TEST_PROGS += document-input-stream
|
||||
document_input_stream_SOURCES = document-input-stream.c
|
||||
document_input_stream_LDADD = $(progs_ldadd)
|
||||
|
||||
TEST_PROGS += document-output-stream
|
||||
document_output_stream_SOURCES = document-output-stream.c
|
||||
document_output_stream_LDADD = $(progs_ldadd)
|
||||
|
||||
TEST_PROGS += document-loader
|
||||
document_loader_SOURCES = document-loader.c
|
||||
document_loader_LDADD = $(progs_ldadd)
|
||||
|
||||
TEST_PROGS += document-saver
|
||||
document_saver_SOURCES = document-saver.c
|
||||
document_saver_LDADD = $(progs_ldadd)
|
||||
|
||||
TESTS = $(TEST_PROGS)
|
||||
|
||||
EXTRA_DIST = setup-document-saver.sh
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue