Retro-fitted branch 1.0.99-pre.1
git-svn-id: https://svn.outlyer.net/svn/pub/nautilus-follow-symlink/branches/1.0.99-pre.1@37 da2faf11-d50b-4b07-92cd-6070d1bd8887
This commit is contained in:
parent
5733fe6c6a
commit
50e5034868
|
@ -1,3 +1,8 @@
|
|||
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.
|
||||
|
||||
1.0.2: (2007-05-12)
|
||||
* BUGFIX: Fixed icon location, was broken on newer systems
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
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)
|
||||
|
||||
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.
|
||||
|
||||
$ ./dist
|
||||
|
||||
The follow the usual GNU build instructions:
|
||||
|
||||
$ ./configure --prefix=/usr/local
|
||||
$ make
|
||||
# make install
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
SUBDIRS = po src
|
||||
|
||||
# This doesn't work as expected
|
||||
libdir = @libdir@/nautilus/extensions-1.0
|
||||
libdir = @libdir@/nautilus/extensions-2.0
|
||||
|
||||
EXTRA_DIST = dist po/nautilus-follow-symlink.pot
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
AC_INIT(src/follow-symlink.c)
|
||||
AM_INIT_AUTOMAKE([ 1.9 libnautilus-follow-symlink ], "1.0.2")
|
||||
AM_INIT_AUTOMAKE([ 1.9 libnautilus-follow-symlink ], "1.0.99")
|
||||
AC_CONFIG_HEADER(src/config.h)
|
||||
|
||||
dnl default FLAGS
|
||||
|
@ -37,7 +37,9 @@ dnl Xref: http://www.seul.org/docs/autotut/#libtool
|
|||
|
||||
# glib-2.0: ensure it's present
|
||||
dnl and set GLIB_CFLAGS and GLIB_LIBS
|
||||
AM_PATH_GLIB_2_0
|
||||
dnl The newer API in GNOME 2.22 requires 2.16 (maybe 2.14?),
|
||||
dnl gio is the only module required (probably)
|
||||
AM_PATH_GLIB_2_0(2.16.0, [], [], gio)
|
||||
|
||||
# pkg-config: ensure libnautilus-extension is found by pkg-config
|
||||
PKG_CHECK_MODULES(NAUTILUS_EXTENSION, [libnautilus-extension])
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
nautilus-follow-symlink (1.0.99-upstream.0-pre.1) experimental; urgency=low
|
||||
|
||||
* First pre-release for GNOME 2.22.
|
||||
|
||||
-- Toni Corvera <outlyer@gmail.com> Sat, 03 May 2008 21:48:02 +0200
|
||||
|
||||
nautilus-follow-symlink (1.0.2-out.1) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
Source: nautilus-follow-symlink
|
||||
Section: contrib/gnome
|
||||
Priority: extra
|
||||
Maintainer: Toni Corvera <outlyer@outlyer.net>
|
||||
Build-Depends: debhelper (>= 4.0.0), gcc, libtool, pkg-config, libc6-dev, libglib2.0-dev, libnautilus-extension-dev, intltool (>= 0.18), gettext, automake1.9, autoconf
|
||||
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
|
||||
Standards-Version: 3.6.2
|
||||
|
||||
Package: nautilus-follow-symlink
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, nautilus
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, nautilus (>= 2.21)
|
||||
Description: nautilus plugin to open the location pointed by a symlink
|
||||
This extension adds a context menu option to symbolic links to
|
||||
folders which opens the pointed folder instead of the symbolic link.
|
||||
|
|
6
dist
6
dist
|
@ -89,3 +89,9 @@ package-source: clean
|
|||
--exclude='devel_docs' \
|
||||
--exclude='.*' \
|
||||
`basename $$OLDPWD`/
|
||||
|
||||
# Aliases
|
||||
src: package-source
|
||||
source: package-source
|
||||
tarball: package-source
|
||||
|
||||
|
|
13
src/common.h
13
src/common.h
|
@ -4,7 +4,7 @@
|
|||
* nautilus-follow-symlink: Nautilus extension which allows opening the real
|
||||
* path of symbolic links
|
||||
*
|
||||
* Copyright (C) 2006 Toni Corvera
|
||||
* Copyright (C) 2006-2008 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,6 +31,9 @@
|
|||
* 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() */
|
||||
|
||||
|
@ -48,6 +51,12 @@
|
|||
#include "config.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
// Not including this produces multiple definition errors as of 2008 (it didn't
|
||||
// at the time of the previous release)
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif // HAVE_SYS_STAT_H
|
||||
|
||||
#if !defined(__inline)
|
||||
#define __inline
|
||||
#elif defined(_DEBUG)
|
||||
|
@ -224,7 +233,7 @@
|
|||
#define FSL_LOG(f, ...)
|
||||
///* Unneeded for the time being */ #define FSL_LOG_WITH_LEVEL(l,f,rest...)
|
||||
#define FSL_LOG_COND(c,f,...)
|
||||
#endif
|
||||
#endif // _DEBUG
|
||||
|
||||
#endif /* FOLLOW_SYMLINK_COMMON_H */
|
||||
/* vim:set ts=4 et ai: */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* nautilus-follow-symlink: Nautilus extension which allows opening the real
|
||||
* path of symbolic links
|
||||
*
|
||||
* Copyright (C) 2006 Toni Corvera
|
||||
* Copyright (C) 2006-2008 Toni Corvera
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -25,8 +25,15 @@
|
|||
|
||||
#include "follow-symlink.h"
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
extern int errno;
|
||||
|
||||
// References for gio and the newer nautilus-extension: (required to support GNOME 2.22)
|
||||
// http://library.gnome.org/devel/gio/unstable/GFile.html
|
||||
// http://library.gnome.org/devel/gio/unstable/GFileInfo.html
|
||||
// http://library.gnome.org/devel/libnautilus-extension/unstable/libnautilus-extension-nautilus-file-info.html
|
||||
|
||||
/* Menu initialization */
|
||||
void fsl_extension_menu_provider_iface_init(NautilusMenuProviderIface *iface)
|
||||
{
|
||||
|
@ -37,7 +44,7 @@ void fsl_extension_menu_provider_iface_init(NautilusMenuProviderIface *iface)
|
|||
}
|
||||
|
||||
/* Implementation of the menu attachment,
|
||||
* this is slightly different whith file items and with background (one folder)
|
||||
* this is slightly different with file items and with background (one folder)
|
||||
* items, but shares most of the code, so the common part is here.
|
||||
*/
|
||||
GList * fsl_get_items_impl(GtkWidget * window,
|
||||
|
@ -60,6 +67,27 @@ 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.
|
||||
|
||||
// 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);
|
||||
|
@ -73,7 +101,7 @@ GList * fsl_get_items_impl(GtkWidget * window,
|
|||
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));
|
||||
|
@ -99,13 +127,20 @@ 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
|
||||
*/
|
||||
const GnomeVFSFileInfo * const gfi = nautilus_file_info_get_vfs_file_info(file_data);
|
||||
return gfi->type == GNOME_VFS_FILE_TYPE_DIRECTORY;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -159,6 +194,54 @@ 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
|
||||
const char * target = g_file_info_get_symlink_target(gfi);
|
||||
|
||||
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);
|
||||
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( g_file_get_path(parent), // 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);
|
||||
#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,
|
||||
|
@ -196,6 +279,7 @@ void fsl_callback (NautilusMenuItem * item __UNUSED, NautilusFileInfo * file_inf
|
|||
|
||||
g_free(command_line);
|
||||
g_strfreev(argv);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue