Retro-fitted branch 1.1

git-svn-id: https://svn.outlyer.net/svn/pub/nautilus-follow-symlink/branches/1.1@40 da2faf11-d50b-4b07-92cd-6070d1bd8887
This commit is contained in:
Toni Corvera 2009-04-30 19:47:19 +00:00
parent fba27174e4
commit c4d340575e
20 changed files with 363 additions and 306 deletions

2
AUTHORS Normal file
View File

@ -0,0 +1,2 @@
nautilus-follow-symlink is Copyright (c) 2006, 2007, 2009 Toni Corvera <outlyer@gmail.com>.

37
BUILD
View File

@ -1,37 +0,0 @@
COMPILER NOTES
==============
* This program is meant to be built whith gcc.
While where possible care has been taken to not rely on GCC, the code is (and
will remain) only tested to build with it. Additionally, future versions
might use GCC's extension to the C syntax.
* Error-on-warning is used by default, keep in mind in case some future
gcc version gets more picky.
COMPILATION
===========
* If no ./configure exists (i.e. raw svn export), use the dist command:
$ ./dist
* Configure
$ ./configure --prefix=/usr
Note that this being a nautilus extension, the --prefix is not really used
at installation time as there's no real flexibility on where to install them
(the appropiate place will be checked on install time). BUT it should match
gnome's locale dir.
* Compile
$ make
* Install
$ make install
Of special interest:
Pass -D_DEBUG to the precompiler to enable the debugging/verbose
mode.
CPPFLAGS="-D_DEBUG" ./configure

View File

@ -1,15 +1,31 @@
1.1.0: (pre-release)
* Adapted to work with GNOME 2.22, support for older GNOME versions
is dropped in newer releases; 1.0.2 can be used since it provides
the same functionality.
2009-04-30: Release 1.1.0
* Bugfix:
- Use stock icon instead of hard-wired icon location
* Packaging:
- Re-gettextized: added po/ChangeLog
- Deb package cleanup
- RPM packaging support
- Provide configure script by default
* Compatibility:
- Dropped support for nautilus-extension 1.0 completely
* Other:
- Reworked autoconf/automake with looser requirements
- Support cross-compilation
1.0.2: (2007-05-12)
* BUGFIX: Fixed icon location, was broken on newer systems
2008-05-04: Release 1.0.99-pre.1 (1.1.0 pre-release)
* Other:
- Adapted to work with GNOME 2.22 and above
For older GNOME versions, 1.0.2 should be used
2007-05-12: Release 1.0.2
* Bugfix: Fixed icon location, was broken on newer systems
1.0.1: (2006-12-14)
* BUGFIX: Show correctly file names with underscores
* BUGFIX: Fixed compilation on 64bits archs (__unused can't be defined)
* BUGFIX: Require automake 1.9, which was actually used
2006-12-14: Release 1.0.1
* Bugfixes:
- Show correctly file names with underscores
- Fixed compilation on 64bits archs (__unused can't be defined)
- Require automake 1.9, which was actually used
1.0: Initial public release (2006-11-10)
2006-11-10: Release 1.0
[First public release]
# vim:set ts=4 et ai: #

30
INSTALL
View File

@ -1,23 +1,29 @@
BUILD / INSTALLATION INSTRUCTIONS
=================================
First and foremost, if you use Debian or a derived distribution try first
the upstream packages found at the project's homepage
<http://p.outlyer.net/nautilus-follow-symlink>. Or try building a deb
package yourself ($ dpkg-buildpackage -rfakeroot)
Binaries for some distributions are provided in nautilus-follow-symlink's
homepage <http://p.outlyer.net/nautilus-follow-symlink>.
Building
========
Run the included script "dist", this should create the missing files needed
to prepare the configuration. If some tool required to build is missing it
should also point it.
Follow the usual GNU build instructions:
$ ./dist
The follow the usual GNU build instructions:
$ ./configure --prefix=/usr/local
$ ./configure --prefix=/usr
(or: $ ./configure --prefix=`pkg-config --variable prefix libnautilus-extension`)
$ make
# make install
Note that this being a nautilus extension, the --prefix is not really used
at installation time as there's no flexibility on where to install them
(the appropiate place will be checked on install time). BUT it should match
gnome's locale dir.
COMPILER NOTES
==============
* This program has only been tested with gcc
* Define _DEBUG in the precompiler to enable the debugging/verbose mode.
CPPFLAGS="-D_DEBUG" ./configure

View File

@ -1,22 +1,26 @@
SUBDIRS = po src
# This doesn't work as expected
libdir = @libdir@/nautilus/extensions-2.0
EXTRA_DIST = dist po/nautilus-follow-symlink.pot
EXTRA_DIST = \
po/ChangeLog \
intltool-extract.in \
intltool-update.in \
intltool-merge.in \
@PACKAGE@.spec.in @PACKAGE@.spec \
debian/changelog debian/control debian/compat debian/copyright \
debian/dirs debian/docs debian/README.Debian debian/rules
# Extra files to get rid of when distcleaning
DISTCLEANFILES = \
intltool-extract \
intltool-merge \
intltool-update \
\
libtool \
libtool.m4 \
ltmain.sh \
ltoptions.m4 \
ltsugar.m4 \
ltversion.m4 \
\
po/Makefile.in.in
po/.intltool-merge-cache
harshtest:
make
sudo cp src/.libs/libnautilus-follow-symlink.so /usr/lib/nautilus/extensions-2.0/
killall -9 nautilus
#ACLOCAL_AMFLAGS = -I m4

View File

@ -1,17 +1,30 @@
dnl $Id$
AC_INIT(nautilus-follow-symlink, [1.1])
AC_CONFIG_SRCDIR([src/follow-symlink.c])
dnl Cross-compilation
AC_CANONICAL_SYSTEM
AC_CANONICAL_BUILD
AC_ARG_PROGRAM
AM_INIT_AUTOMAKE([1.7 foreign])
AC_REVISION(SVN $Rev$)
AC_INIT(src/follow-symlink.c)
AM_INIT_AUTOMAKE([ 1.9 libnautilus-follow-symlink ], "1.0.99")
AC_CONFIG_HEADER(src/config.h)
dnl default FLAGS
CPPFLAGS="$CPPFLAGS -std=gnu99 -pedantic-errors -Wall"
CFLAGS="$CFLAGS -O -Wall -Werror -Winline"
LDFLAGS="$LDFLAGS -Wl,--as-needed"
dnl default FLAGS, if none provided (note to self: ':=' is not portable)
if test -z "$CPPFLAGS" ; then
CPPFLAGS="-pedantic-errors"
fi
if test -z "$CFLAGS" ; then
CFLAGS="-Werror -Winline"
fi
# FIXME: Make this better
FSL_ICON="/usr/share/icons/gnome/16x16/emblems/emblem-symbolic-link.png"
AC_SUBST(FSL_ICON)
AC_DEFINE_UNQUOTED(FSL_ICON, "$FSL_ICON", [follow-symlink menu icon])
dnl Extra flags always set (might be overridden by user's)
dnl CPPFLAGS="$CPPFLAGS"
CFLAGS="-O2 -Wall -std=gnu99 $CFLAGS"
LDFLAGS="-Wl,--as-needed $LDFLAGS"
# libtool, DISABLE_STATIC should go before PROG_LIBTOOL
AM_DISABLE_STATIC
@ -27,6 +40,7 @@ GETTEXT_PACKAGE=nautilus-follow-symlink
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [gettext domain])
ALL_LINGUAS="ca es" dnl Implied en
#AM_GNU_GETTEXT_VERSION dnl autoreconf only runs autopoint if this is present
AM_GLIB_GNU_GETTEXT
# string.h and stdlib.h are used
@ -50,7 +64,25 @@ dnl Incorporate the result of tests
CFLAGS="$CFLAGS $GLIB_CFLAGS $NAUTILUS_EXTENSION_CFLAGS"
LIBS="$LIBS $GLIB_LIBS $NAUTILUS_EXTENSION_LIBS"
cat <<EOF
##############################################################################
# Config:
#
# Flags:
# CFLAGS = $CFLAGS
# CPPFLAGS = $CPPFLAGS
# LDFLAGS = $LDFLAGS
# LIBS = $LIBS
# LDADD = $LDADD
# CC = $CC
# CPP = $CPP
##############################################################################
EOF
AC_OUTPUT([Makefile
src/Makefile
po/Makefile.in
nautilus-follow-symlink.spec
])

10
debian/README.Debian vendored
View File

@ -1,6 +1,12 @@
nautilus-follow-symlink for Debian
----------------------------------
<possible notes regarding this package - if none, delete this file>
This is an unofficial debian package created directly from the upstream
source, by the upstream author.
I'm no Debian Developer so I can't guarantee a strict following of the
Debian Policy.
-- Toni Corvera <outlyer@outlyer.net>, Sat, 21 Oct 2006 23:46:12 +0200
I use Debian Sid, when possible I try to build against packages available in
Debian Stable but sometimes published packages will only work in Unstable.
-- Toni Corvera <outlyer@outlyer.net>, Thu, 30 Apr 2009 15:46:03 +0200

16
debian/changelog vendored
View File

@ -1,3 +1,19 @@
nautilus-follow-symlink (1.1.0-upstream.1) unstable; urgency=low
* New release.
* debian/control: Drop build-depencies on autotools
* debian/copyright: Updated template
* debian/README.Debian: Notes on being unofficial+upstream
-- Toni Corvera <outlyer@gmail.com> Thu, 30 Apr 2009 15:50:14 +0200
nautilus-follow-symlink (1.0.99+pre.2-upstream.0) experimental; urgency=low
* New pre-release
* Corrected package pre-version number order
-- Toni Corvera <outlyer@gmail.com> Wed, 04 Jun 2008 13:20:28 +0200
nautilus-follow-symlink (1.0.99-upstream.0-pre.1) experimental; urgency=low
* First pre-release for GNOME 2.22.

3
debian/control vendored
View File

@ -2,8 +2,9 @@ Source: nautilus-follow-symlink
Section: contrib/gnome
Priority: extra
Maintainer: Toni Corvera <outlyer@gmail.com>
Build-Depends: debhelper (>= 4.0.0), gcc, libtool, pkg-config, libc6-dev, libglib2.0-dev (>= 2.16), libnautilus-extension-dev (>= 2.21), intltool (>= 0.18), gettext, automake (>= 1.9), autoconf
Build-Depends: debhelper (>= 4.0.0), gcc, pkg-config, libglib2.0-dev (>= 2.16), libnautilus-extension-dev (>= 2.21), intltool (>= 0.18), gettext
Standards-Version: 3.6.2
Homepage: http://p.outlyer.net/nautilus-follow-symlink/
Package: nautilus-follow-symlink
Architecture: any

17
debian/copyright vendored
View File

@ -1,9 +1,15 @@
This package was debianized by Toni Corvera <outlyer@outlyer.net> on
Sat, 21 Oct 2006 23:46:12 +0200.
This package was debianized by Toni Corvera <outlyer@gmail.com> on
Thu, 30 Apr 2009 15:47:55 +0200.
It can be downloaded right now from <http://proyectos.outlyer.net/nautilus-follow-symlink>.
It can be downloaded from <http://p.outlyer.net/nautilus-follow-symlink>
Copyright Holder: Toni Corvera <outlyer@outlyer.net>
Upstream Author:
Toni Corvera <outlyer@gmail.com>
Copyright:
Copyright (C) 2006, 2008, 2009 Toni Corvera
License:
@ -24,3 +30,6 @@ License:
On Debian systems, the complete text of the GNU Lesser General
Public License can be found in `/usr/share/common-licenses/LGPL'.
The Debian packaging is (C) 2006-2009, Toni Corvera <outlyer@gmail.com> and
is licensed under the GPL, see `/usr/share/common-licenses/GPL'.

2
debian/docs vendored
View File

@ -1 +1 @@
BUILD
AUTHORS

97
dist
View File

@ -1,97 +0,0 @@
#!/usr/bin/make -f
# $Id$
UPSTREAM_URL=http://p.outlyer.net/nautilus-follow-symlink
dist: gen
# aclocal won't find libtool's m4, at least in debian, unless an
# extra include path is given, with libtoolize it is "." while
# whitout it is /usr/share/libtool/m4, altough it will fail
# on finding ltmain.sh
gen: check-gen-deps
libtoolize
intltoolize
aclocal -I .
autoconf
autoheader
automake --add-missing --foreign
# This rule serves as a replacement for which for systems in which it
# isn't installed
# Use: ./dist which-PROGNAME or
# a rule that depends on which-PROGNAME1, which-PROGNAME2, ...
which-%:
@bash -c "type -p $*" || { \
echo "*** Couldn't find $*, can't continue without"\
"all requirements">&2 ;\
false ; \
}
check-gen-deps: \
which-libtoolize \
which-intltoolize \
which-aclocal \
which-autoconf \
which-autoheader \
which-automake-1.9
help:
@echo "This file is used to aid in the setup of the build"
@echo "environment, there are the following available targets"
@echo "(use ./dist TARGET):"
@echo " gen (default) Create the required structure"
@echo " clean Remove the files created by gen and by the build process"
@echo " update-po Update the language files with new translation or moved "
@echo " string locations (note it also updates the meta-timestamp)"
@echo " so it can get funny issuing this command when using CVS/SVN"
@echo " regen 'clean' then 'gen'"
@echo " help This very message"
update-po:
cd po && intltool-update -p
cd po && for file in *.po ; do \
intltool-update --dist `basename $$file .po` ; \
done
regen: clean gen
clean:
make distclean || true
make clean || true
cd src && make clean || true
#
rm -rf autom4te.cache
rm -f config.* depcomp install-sh missing src/config.h src/config.h.in
rm -f aclocal.m4
rm -f configure Makefile Makefile.in src/Makefile src/Makefile.in
rm -f po/*.gmo po/Makefile po/Makefile.in po/POTFILES
find . -name 'stamp-??' -exec rm {} \;
# The following are moved thanks to Makefile.am (var DISTCLEANFILES)
# (kept for situations in which make distclean fails)
# Undo libtoolize
rm -f libtool.m4 lt*.m4 ltmain.sh libtool
# Undo intltoolize
rm -f intltool*
rm -f po/Makefile.in.in
package-source: clean
if [ -d .svn ]; then echo "WARNING: Using SVN working copy" >&2 && sleep 2s ; fi
cd ../ && tar zcvf `basename $$OLDPWD`.tar.gz \
--label 'nautilus-follow-symlink <$(UPSTREAM_URL)>' \
--totals \
--group 0 \
--owner 0 \
--exclude='.svn' \
--exclude='devel_docs' \
--exclude='.*' \
`basename $$OLDPWD`/
# Aliases
src: package-source
source: package-source
tarball: package-source

62
dist.mk Executable file
View File

@ -0,0 +1,62 @@
#!/usr/bin/make -f
# $Id$
all:
@echo "This file is used to aid in the setup of the build"
@echo "environment, there are the following available targets"
@echo " (use ./dist.mk <TARGET>):"
@echo " gen Run the autotools"
@echo " clean Remove the files created by gen and by the build process"
@echo " update-po Update the language files with new translation or moved "
@echo " string locations (note it also updates the meta-timestamp)"
@echo " so it can get funny issuing this command when using CVS/SVN"
@echo " regen 'clean' then 'gen'"
@echo " force-gen Like gen, but overwrite even up-to-date files"
@echo
@echo "The rest of important rules are provided by the generated Makefile"
@echo " (i.e.: $$ make <TARGET>)"
@echo " harshtest (To be used during development) Copy the library to the system"
@echo " and kill nautilus to re-load it"
@echo " and the standard GNU rules:"
@echo " dist Create the distribution tarball"
@echo " distcheck Create tarball, check it builds and it installs. Add a DESTDIR"
@echo " or it will try to install in the system"
_gen_common:
intltoolize --automake
gen:
autoreconf --install --verbose --symlink
$(MAKE) -f dist.mk _gen_common
force-gen:
autoreconf --install --verbose --force --symlink
$(MAKE) -f dist.mk _gen_common
update-po:
cd po && intltool-update -p
cd po && for file in *.po ; do \
intltool-update --dist `basename $$file .po` ; \
done
regen: clean gen
clean:
-debclean
-make distclean
cd src && make clean || true
#
$(RM) -r autom4te.cache
$(RM) config.* depcomp install-sh missing src/config.h src/config.h.in
$(RM) aclocal.m4
$(RM) configure Makefile Makefile.in src/Makefile src/Makefile.in
$(RM) po/*.gmo po/Makefile po/Makefile.in po/POTFILES
find . -name 'stamp-??' -exec rm {} \;
# The following are moved thanks to Makefile.am (var DISTCLEANFILES)
# (kept for situations in which make distclean fails)
# Undo libtoolize
$(RM) libtool.m4 lt*.m4 ltmain.sh libtool
# Undo intltoolize
$(RM) intltool*

View File

@ -0,0 +1,89 @@
#
# spec file for nautilus-follow-symlink rpm
#
# based on the spec file for mp3plot <http://p.outlyer.net/mp3plot>
#
%define is_mandrake %(test -e /etc/mandrake-release && echo 1 || echo 0)
%define is_suse %(test -e /etc/SuSE-release && echo 1 || echo 0)
%define is_fedora 0%{?fedora}
%define is_redhat 0%{?rhl}
%define is_rhel 0%{?rhel}
%define distname generic
%define disttag .generic_lsb
%if %{is_fedora}
%define distname fedora
%define disttag %{dist}
%endif
%if %{is_redhat}
%define distname redhat
%define disttag %{dist}
%endif
%if %{is_mandrake}
%define distname mandrake
%define disttag .mdk
%endif
%if %{is_suse}
%define distname suse
%define disttag .suse
%endif
%if %{is_rhel}
%define distname rhel
%define disttag %{dist}
%endif
Name: @PACKAGE@
Version: @VERSION@
Release: 1%{?disttag}~upstream
Summary: nautilus plugin to open the location pointed by a symlink
Group: User Interface/Desktops
License: LGPL
URL: http://p.outlyer.net./nautilus-follow-symlink/
Source0: %{url}/files/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: intltool, libtool, nautilus-devel, gtk2-devel
Requires: nautilus-extensions
AutoReqProv: yes
Prefix: /usr
%description
This extension adds a context menu option to symbolic links to folders which
opens the pointed folder instead of the symbolic link.
%prep
echo Building %{name}-%{version}-%{release}
%setup -q -n %{name}-%{version}
%build
%configure
make %{?_smp_mflags}
%install
make install DESTDIR=%buildroot
rm -f $RPM_BUILD_ROOT/%{_libdir}/nautilus/extensions-2.0/*.{l,}a
# create %{name}.lang with the locale data. To be included by %files
%find_lang %{name}
%clean
[ ${RPM_BUILD_ROOT} != "/" ] && rm -rf $RPM_BUILD_ROOT
%files -f %{name}.lang
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog
%_libdir/nautilus/extensions-2.0/*.so
%changelog
* Thu Apr 30 2009 Toni Corvera <outlyer@gmail.com> - 1.1-1~upstream
- Packaging cleanup
* Wed Jun 4 2008 Toni Corvera <outlyer@gmail.com> - 1.0.99+pre.2-1upstream
- Initial package

11
po/ChangeLog Normal file
View File

@ -0,0 +1,11 @@
2009-04-30 gettextize <bug-gnu-gettext@gnu.org>
* Makefile.in.in: Upgrade to gettext-0.17.
* boldquot.sed: New file, from gettext-0.17.
* en@boldquot.header: New file, from gettext-0.17.
* en@quot.header: New file, from gettext-0.17.
* insert-header.sin: New file, from gettext-0.17.
* quot.sed: New file, from gettext-0.17.
* remove-potcdate.sin: New file, from gettext-0.17.
* Rules-quot: New file, from gettext-0.17.

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: libnautilus-follow-symlink\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2006-12-01 23:52+0100\n"
"POT-Creation-Date: 2009-04-30 15:13+0200\n"
"PO-Revision-Date: 2006-10-30 13:42+0100\n"
"Last-Translator: Toni Corvera <outlyer@outlyer.net>\n"
"Language-Team: Catalan <outlyer@outlyer.net>\n"
@ -15,30 +15,30 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../src/follow-symlink.c:219
#: ../src/follow-symlink.c:242
#, c-format
msgid "Follow symbolic _link '%s'"
msgstr "Segueix l'en_llaç simbòlic '%s'"
#: ../src/follow-symlink.c:220
#: ../src/follow-symlink.c:243
#, c-format
msgid "Open the directory pointed by the symbolic link '%s'"
msgstr "Obre el directori apuntat per l'enllaç simbòlic '%s'"
#: ../src/follow-symlink.c:223
#: ../src/follow-symlink.c:246
#, c-format
msgid "Open _real path of '%s'"
msgstr "Obre la _ruta real de '%s'"
#: ../src/follow-symlink.c:224
#: ../src/follow-symlink.c:247
#, c-format
msgid "Open the real path of the folder pointed by '%s'"
msgstr "Obre el directori apuntat per '%s'"
#: ../src/follow-symlink.c:284
#: ../src/follow-symlink.c:307
msgid "Follow symbolic _link"
msgstr "Segueix l'en_llaç simbòlic"
#: ../src/follow-symlink.c:285
#: ../src/follow-symlink.c:308
msgid "Open the symbolic link"
msgstr "Obre l'enllaç simbòlic"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: libnautilus-follow-symlink\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2006-12-01 23:52+0100\n"
"POT-Creation-Date: 2009-04-30 15:13+0200\n"
"PO-Revision-Date: 2006-10-30 13:42+0100\n"
"Last-Translator: Toni Corvera <outlyer@outlyer.net>\n"
"Language-Team: Spanish <outlyer@outlyer.net>\n"
@ -17,30 +17,30 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ../src/follow-symlink.c:219
#: ../src/follow-symlink.c:242
#, c-format
msgid "Follow symbolic _link '%s'"
msgstr "Seguir en_lace simbólico '%s'"
#: ../src/follow-symlink.c:220
#: ../src/follow-symlink.c:243
#, c-format
msgid "Open the directory pointed by the symbolic link '%s'"
msgstr "Abrir el directorio apuntado por el enlace simbólico '%s'"
#: ../src/follow-symlink.c:223
#: ../src/follow-symlink.c:246
#, c-format
msgid "Open _real path of '%s'"
msgstr "Abrir la _ruta real de '%s'"
#: ../src/follow-symlink.c:224
#: ../src/follow-symlink.c:247
#, c-format
msgid "Open the real path of the folder pointed by '%s'"
msgstr "Abrir el directoro apuntado por '%s'"
#: ../src/follow-symlink.c:284
#: ../src/follow-symlink.c:307
msgid "Follow symbolic _link"
msgstr "Seguir en_lace simbólico"
#: ../src/follow-symlink.c:285
#: ../src/follow-symlink.c:308
msgid "Open the symbolic link"
msgstr "Abrir el enlace simbólico"

View File

@ -1,7 +1,7 @@
# $Id$ #
#
# Required to correctly install the locale files
# Required to correctly install the locale files (and to access them)
CPPFLAGS+=-DGNOMELOCALEDIR=\""$(datadir)/locale"\"
nautilus_extension_lib_LTLIBRARIES = libnautilus-follow-symlink.la
@ -12,6 +12,7 @@ nautilus_extension_lib_LTLIBRARIES = libnautilus-follow-symlink.la
nautilus_extension_libdir = `pkg-config --variable=extensiondir libnautilus-extension`
libnautilus_follow_symlink_la_SOURCES = follow-symlink.c nautilus-ext-follow-symlink.c
noinst_HEADERS=*.h
# There's really no need to have versioned file names
libnautilus_follow_symlink_la_LDFLAGS = -avoid-version

View File

@ -4,7 +4,7 @@
* nautilus-follow-symlink: Nautilus extension which allows opening the real
* path of symbolic links
*
* Copyright (C) 2006-2008 Toni Corvera
* Copyright (C) 2006, 2008, 2009 Toni Corvera
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -31,9 +31,6 @@
* Also, includes config.h.
*/
// Define NX_1_0 to use the older code, for nautilus-extension 1.0
// It will be removed soon though
#include <glib/gmessages.h> /* g_print() */
#include <glib/gprintf.h> /* g_printf() */

View File

@ -4,7 +4,7 @@
* nautilus-follow-symlink: Nautilus extension which allows opening the real
* path of symbolic links
*
* Copyright (C) 2006-2008 Toni Corvera
* Copyright (C) 2006, 2008, 2009 Toni Corvera
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -26,6 +26,10 @@
#include "follow-symlink.h"
#include <gio/gio.h>
#include <gtk/gtkicontheme.h>
// Symbolic name of the icon, use to be in /usr/share/icons/gnome/[16x16]/emblems/
#define FSL_ICON_NAME "emblem-symbolic-link"
extern int errno;
@ -67,8 +71,6 @@ GList * fsl_get_items_impl(GtkWidget * window,
g_free(uri_scheme);
}
#ifndef NX_1_0
// TODO: Once the older code is deprecated, some nautilus_* function can be
// translated to their g_file_* counterparts.
@ -87,21 +89,7 @@ GList * fsl_get_items_impl(GtkWidget * window,
nautilus_file_info_get_uri(file_info));
return NULL;
}
#else
// We know the file is either a directory or a symlink to a directory
// TODO: Has glib/gnome any better/faster alternatives?
GnomeVFSFileInfo * gfi = nautilus_file_info_get_vfs_file_info(file_info);
/* TODO: In which situations might the flags field be invalid?
* Hence, can the older stat version be dumped safely?
*/
g_assert( (gfi->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_FLAGS) > 0 );
if ( (gfi->flags & GNOME_VFS_FILE_FLAGS_SYMLINK) == 0 ) {
FSL_LOG("GnomeVFS Flags: ! SYMLINK in %s", nautilus_file_info_get_uri(file_info));
return NULL;
}
#endif
item = fsl_menu_item_new(gtk_widget_get_screen(window),
is_file_item,
nautilus_file_info_get_name(file_info));
@ -128,19 +116,10 @@ gboolean file_is_directory (const gpointer const file_data)
{
TRACE();
#ifndef NX_1_0 // Nautilus extension v1.0, deprected
/*
* The "effective" type is returned, a symlink to a directory is a directory
*/
return G_FILE_TYPE_DIRECTORY == nautilus_file_info_get_file_type(file_data);
#else
/*
* Apparently type is never GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK and symlinks
* are resolved to the target type
*/
const GnomeVFSFileInfo * const gfi = nautilus_file_info_get_vfs_file_info(file_data);
return gfi->type == GNOME_VFS_FILE_TYPE_DIRECTORY;
#endif
}
/*
@ -194,7 +173,6 @@ void fsl_callback (NautilusMenuItem * item __UNUSED, NautilusFileInfo * file_inf
{
TRACE();
#ifndef NX_1_0
gchar ** argv;
GFile * gf = nautilus_file_info_get_location(file_info); // Get the pointed GFile
@ -241,45 +219,6 @@ void fsl_callback (NautilusMenuItem * item __UNUSED, NautilusFileInfo * file_inf
g_free(command_line);
g_strfreev(argv);
#else
gchar ** argv;
const GnomeVFSFileInfo * gfi = nautilus_file_info_get_vfs_file_info(file_info);
// See /usr/include/gnome-vfs-2.0/libgnomevfs/gnome-vfs-file-info.h,
// this one is the "realpath()" (3), also it isn't urlencoded
const gchar const * target = gfi->symlink_name;
const gchar const * BASE_CMD = "nautilus --no-desktop --no-default-window '%s'";
const gsize mem_block_size = printf_string_upper_bound(BASE_CMD, target);
gchar * command_line = g_try_malloc( mem_block_size );
if (NULL == command_line) {
g_printerr(__FILE__ ":%d: Failed to allocate enough memory "
"for command line, can't spawn new nautilus.\n", __LINE__);
// Redundant, but issues a CRITICAL message
g_return_if_fail( NULL != command_line );
}
g_sprintf(command_line, BASE_CMD, target);
if (FALSE == g_shell_parse_argv(command_line, NULL, &argv, NULL)) {
g_free(command_line);
g_printerr("Failed in creating the arguments for the child nautilus.\n");
//g_return_if_fail( FALSE );
g_return_if_reached();
}
g_printf("nautilus-follow-symlink: Spawning nautilus with\n '%s'\n", command_line);
g_spawn_async( NULL, // Inherit CWD
argv,
NULL,
G_SPAWN_SEARCH_PATH, //| G_SPAWN_DO_NOT_REAP_CHILD,
NULL, NULL, NULL, NULL);
g_free(command_line);
g_strfreev(argv);
#endif
}
/*
@ -367,7 +306,7 @@ NautilusMenuItem * fsl_menu_item_new(GdkScreen *screen __UNUSED,
ret = nautilus_menu_item_new("Fsymlink::allocation_error",
_("Follow symbolic _link"),
_("Open the symbolic link"),
FSL_ICON);
FSL_ICON_NAME);
g_return_val_if_fail(NULL!=name && NULL!=tooltip && NULL!=unique_name,
ret);
}
@ -377,7 +316,7 @@ NautilusMenuItem * fsl_menu_item_new(GdkScreen *screen __UNUSED,
g_sprintf(unique_name, ITEM_NAME_FMT, a_base_name);
// (name, label, tip, icon)
ret = nautilus_menu_item_new(unique_name, name, tooltip, FSL_ICON);
ret = nautilus_menu_item_new(unique_name, name, tooltip, FSL_ICON_NAME);
if (base_name != a_base_name) {
g_free(base_name);