From c4d340575eec0afc15b0717600ed712713779a50 Mon Sep 17 00:00:00 2001 From: Toni Corvera Date: Thu, 30 Apr 2009 19:47:19 +0000 Subject: [PATCH] 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 --- AUTHORS | 2 + BUILD | 37 --------- ChangeLog | 38 ++++++--- INSTALL | 30 ++++--- Makefile.am | 30 ++++--- configure.in => configure.ac | 52 +++++++++--- debian/README.Debian | 10 ++- debian/changelog | 16 ++++ debian/control | 3 +- debian/copyright | 17 +++- debian/docs | 2 +- dist | 97 ---------------------- dist.mk | 62 +++++++++++++++ nautilus-follow-symlink.spec.in | 89 +++++++++++++++++++++ po/ChangeLog | 11 +++ po/ca.po | 14 ++-- po/es.po | 14 ++-- src/Makefile.am | 3 +- src/common.h | 5 +- src/follow-symlink.c | 137 +++++++++----------------------- 20 files changed, 363 insertions(+), 306 deletions(-) create mode 100644 AUTHORS delete mode 100644 BUILD rename configure.in => configure.ac (53%) delete mode 100755 dist create mode 100755 dist.mk create mode 100644 nautilus-follow-symlink.spec.in create mode 100644 po/ChangeLog diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..9350b08 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,2 @@ +nautilus-follow-symlink is Copyright (c) 2006, 2007, 2009 Toni Corvera . + diff --git a/BUILD b/BUILD deleted file mode 100644 index 6dad50e..0000000 --- a/BUILD +++ /dev/null @@ -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 diff --git a/ChangeLog b/ChangeLog index 60ecbb1..902a697 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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: # diff --git a/INSTALL b/INSTALL index 7a063e7..0140d19 100644 --- a/INSTALL +++ b/INSTALL @@ -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 -. Or try building a deb -package yourself ($ dpkg-buildpackage -rfakeroot) +Binaries for some distributions are provided in nautilus-follow-symlink's +homepage . 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 diff --git a/Makefile.am b/Makefile.am index e48c667..d747564 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 + diff --git a/configure.in b/configure.ac similarity index 53% rename from configure.in rename to configure.ac index 8164335..9d9ce97 100644 --- a/configure.in +++ b/configure.ac @@ -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 < +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 , 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 , Thu, 30 Apr 2009 15:46:03 +0200 diff --git a/debian/changelog b/debian/changelog index 6fc9005..f92e307 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 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 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. diff --git a/debian/control b/debian/control index 9be2969..117a773 100644 --- a/debian/control +++ b/debian/control @@ -2,8 +2,9 @@ Source: nautilus-follow-symlink Section: contrib/gnome Priority: extra Maintainer: Toni Corvera -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 diff --git a/debian/copyright b/debian/copyright index b4891be..e4325d7 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,9 +1,15 @@ -This package was debianized by Toni Corvera on -Sat, 21 Oct 2006 23:46:12 +0200. +This package was debianized by Toni Corvera on +Thu, 30 Apr 2009 15:47:55 +0200. -It can be downloaded right now from . +It can be downloaded from -Copyright Holder: Toni Corvera +Upstream Author: + + Toni Corvera + +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 and +is licensed under the GPL, see `/usr/share/common-licenses/GPL'. + diff --git a/debian/docs b/debian/docs index 89620f3..62deb04 100644 --- a/debian/docs +++ b/debian/docs @@ -1 +1 @@ -BUILD +AUTHORS diff --git a/dist b/dist deleted file mode 100755 index 9a2cbd5..0000000 --- a/dist +++ /dev/null @@ -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 - diff --git a/dist.mk b/dist.mk new file mode 100755 index 0000000..67158f5 --- /dev/null +++ b/dist.mk @@ -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 ):" + @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 )" + @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* + diff --git a/nautilus-follow-symlink.spec.in b/nautilus-follow-symlink.spec.in new file mode 100644 index 0000000..bbd4284 --- /dev/null +++ b/nautilus-follow-symlink.spec.in @@ -0,0 +1,89 @@ +# +# spec file for nautilus-follow-symlink rpm +# +# based on the spec file for 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 - 1.1-1~upstream +- Packaging cleanup + +* Wed Jun 4 2008 Toni Corvera - 1.0.99+pre.2-1upstream +- Initial package diff --git a/po/ChangeLog b/po/ChangeLog new file mode 100644 index 0000000..6121d2c --- /dev/null +++ b/po/ChangeLog @@ -0,0 +1,11 @@ +2009-04-30 gettextize + + * 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. + diff --git a/po/ca.po b/po/ca.po index 3d548ef..cfd0f56 100644 --- a/po/ca.po +++ b/po/ca.po @@ -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 \n" "Language-Team: Catalan \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" diff --git a/po/es.po b/po/es.po index ff440a4..4693267 100644 --- a/po/es.po +++ b/po/es.po @@ -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 \n" "Language-Team: Spanish \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" diff --git a/src/Makefile.am b/src/Makefile.am index 8cd2acb..6f13299 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 diff --git a/src/common.h b/src/common.h index 06b9392..144a333 100644 --- a/src/common.h +++ b/src/common.h @@ -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 /* g_print() */ #include /* g_printf() */ diff --git a/src/follow-symlink.c b/src/follow-symlink.c index c64a218..3d5baf7 100644 --- a/src/follow-symlink.c +++ b/src/follow-symlink.c @@ -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 +#include + +// 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,41 +71,25 @@ GList * fsl_get_items_impl(GtkWidget * window, g_free(uri_scheme); } + // TODO: Once the older code is deprecated, some nautilus_* function can be + // translated to their g_file_* counterparts. -#ifndef NX_1_0 - // TODO: Once the older code is deprecated, some nautilus_* function can be - // translated to their g_file_* counterparts. - - // Only process symlinks to directories, we know already the file is a - // direcoty or a symlink to one - GFile * gf = nautilus_file_info_get_location(file_info); // Get the pointed GFile - // FIXME: Can NULL be passed as last argument??? - GFileInfo* gfi = g_file_query_info(gf, - G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK, - G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, // <== Important :P - NULL, - NULL); // Retrieve the symlink attribute - - if (!g_file_info_get_is_symlink(gfi)) { - FSL_LOG("No " G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK " attribute in %s", - 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); + // Only process symlinks to directories, we know already the file is a + // direcoty or a symlink to one + GFile * gf = nautilus_file_info_get_location(file_info); // Get the pointed GFile + // FIXME: Can NULL be passed as last argument??? + GFileInfo* gfi = g_file_query_info(gf, + G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK, + G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, // <== Important :P + NULL, + NULL); // Retrieve the symlink attribute - /* 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)); + if (!g_file_info_get_is_symlink(gfi)) { + FSL_LOG("No " G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK " attribute 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)); @@ -127,20 +115,11 @@ fsl_get_background_items(NautilusMenuProvider * provider __UNUSED, 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 + * The "effective" type is returned, a symlink to a directory is a directory */ - const GnomeVFSFileInfo * const gfi = nautilus_file_info_get_vfs_file_info(file_data); - return gfi->type == GNOME_VFS_FILE_TYPE_DIRECTORY; -#endif + return G_FILE_TYPE_DIRECTORY == nautilus_file_info_get_file_type(file_data); } /* @@ -194,21 +173,20 @@ 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 - // FIXME: Can NULL be passed as last argument??? - GFileInfo* gfi = g_file_query_info(gf, - G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET, - G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, // <== Important :P - NULL, - NULL); // Retrieve the symlink attribute - - // The result will relative if the symlink is, must use the correct CWD + gchar ** argv; + + GFile * gf = nautilus_file_info_get_location(file_info); // Get the pointed GFile + // FIXME: Can NULL be passed as last argument??? + GFileInfo* gfi = g_file_query_info(gf, + G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET, + G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, // <== Important :P + NULL, + NULL); // Retrieve the symlink attribute + + // The result will relative if the symlink is, must use the correct CWD const char * target = g_file_info_get_symlink_target(gfi); - - GFile * parent = nautilus_file_info_get_parent_location(file_info); + + GFile * parent = nautilus_file_info_get_parent_location(file_info); const gchar const * BASE_CMD = "nautilus --no-desktop --no-default-window '%s'"; const gsize mem_block_size = printf_string_upper_bound(BASE_CMD, target); @@ -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);