/nautilus-follow-symlink/trunk/debian/rules |
---|
0,0 → 1,98 |
#!/usr/bin/make -f |
# -*- makefile -*- |
# Sample debian/rules that uses debhelper. |
# This file was originally written by Joey Hess and Craig Small. |
# As a special exception, when this file is copied by dh-make into a |
# dh-make output file, you may use that output file without restriction. |
# This special exception was added by Craig Small in version 0.37 of dh-make. |
# Uncomment this to turn on verbose mode. |
#export DH_VERBOSE=1 |
CFLAGS = -Wall -g |
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) |
CFLAGS += -O0 |
else |
CFLAGS += -O2 |
endif |
configure: configure-stamp |
configure-stamp: |
dh_testdir |
# Add here commands to configure the package. |
touch configure-stamp |
build: build-stamp |
build-stamp: configure-stamp |
dh_testdir |
# Add here commands to compile the package. |
cd src && $(MAKE) FINAL=1 |
#docbook-to-man debian/nautilus-follow-symlink.sgml > nautilus-follow-symlink.1 |
touch build-stamp |
clean: |
dh_testdir |
dh_testroot |
rm -f build-stamp configure-stamp |
# Add here commands to clean up after the build process. |
-cd src && $(MAKE) clean |
dh_clean |
install: build |
dh_testdir |
dh_testroot |
dh_clean -k |
dh_installdirs |
# Add here commands to install the package into debian/nautilus-follow-symlink. |
cd src && $(MAKE) install DESTDIR=$(CURDIR)/debian/nautilus-follow-symlink |
# Build architecture-independent files here. |
binary-indep: build install |
# We have nothing to do by default. |
# Build architecture-dependent files here. |
binary-arch: build install |
dh_testdir |
dh_testroot |
dh_installchangelogs |
dh_installdocs |
dh_installexamples |
# dh_install |
# dh_installmenu |
# dh_installdebconf |
# dh_installlogrotate |
# dh_installemacsen |
# dh_installpam |
# dh_installmime |
# dh_installinit |
# dh_installcron |
# dh_installinfo |
dh_installman |
dh_link |
dh_strip |
dh_compress |
dh_fixperms |
# dh_perl |
# dh_python |
# dh_makeshlibs |
dh_installdeb |
dh_shlibdeps |
dh_gencontrol |
dh_md5sums |
dh_builddeb |
binary: binary-indep binary-arch |
.PHONY: build clean binary-indep binary-arch binary install configure |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/nautilus-follow-symlink/trunk/debian/changelog |
---|
0,0 → 1,6 |
nautilus-follow-symlink (0.5-out.1) experimental; urgency=low |
* Initial release |
-- Toni Corvera <outlyer@outlyer.net> Sun, 22 Oct 2006 04:11:50 +0200 |
/nautilus-follow-symlink/trunk/debian/copyright |
---|
0,0 → 1,27 |
This package was debianized by Toni Corvera <outlyer@outlyer.net> on |
Sat, 21 Oct 2006 23:46:12 +0200. |
It can be officially downloaded right now, contact the autor to |
get a copy or more information. |
Copyright Holder: Toni Corvera <outlyer@outlyer.net> |
License: |
This package 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 package 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 package; if not, write to the Free Software |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
On Debian systems, the complete text of the GNU General |
Public License can be found in `/usr/share/common-licenses/GPL'. |
/nautilus-follow-symlink/trunk/debian/docs |
---|
0,0 → 1,0 |
ROADMAP |
/nautilus-follow-symlink/trunk/debian/README.Debian |
---|
0,0 → 1,6 |
nautilus-follow-symlink for Debian |
---------------------------------- |
<possible notes regarding this package - if none, delete this file> |
-- Toni Corvera <outlyer@outlyer.net>, Sat, 21 Oct 2006 23:46:12 +0200 |
/nautilus-follow-symlink/trunk/debian/control |
---|
0,0 → 1,14 |
Source: nautilus-follow-symlink |
Section: contrib/gnome |
Priority: extra |
Maintainer: Toni Corvera <outlyer@outlyer.net> |
Build-Depends: debhelper (>= 4.0.0) |
Standards-Version: 3.6.2 |
Package: nautilus-follow-symlink |
Architecture: any |
Build-Depends: gcc, libtool, pkg-config, libc6-dev, libglib2.0-dev, libnautilus-extension-dev |
Depends: ${shlibs:Depends}, ${misc:Depends}, nautilus |
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. |
/nautilus-follow-symlink/trunk/debian/dirs |
---|
0,0 → 1,0 |
usr/lib |
/nautilus-follow-symlink/trunk/debian/compat |
---|
0,0 → 1,0 |
4 |
/nautilus-follow-symlink/trunk/ChangeLog |
---|
0,0 → 1,8 |
0.5.1: |
* BUGFIX: Correctly check error in realpath() call |
* INTERNAL: Rearrangement in multiple files, applied static where |
appropiate |
* INTERNAL: Added extra-verbosity, switchable on compile time |
0.5 (22 oct 2006): |
* Initial release |
/nautilus-follow-symlink/trunk/src/Makefile |
---|
0,0 → 1,57 |
# Note that building without FINAL=1 creates an uber-verbose version |
ifneq ($(FINAL),1) |
VERSION:=\"0.5.1.interim.debug\" |
else |
VERSION:=\"0.5.1\" |
endif |
CFLAGS=$$(pkg-config --cflags glib-2.0 libnautilus-extension) |
LDFLAGS=$$(pkg-config --libs glib-2.0 libnautilus-extension) |
CFLAGS+=-DPIC -fPIC -g -O -DVERSION=$(VERSION) |
LDFLAGS+=-Wl,--as-needed -g -O |
ifneq ($(FINAL),1) |
CFLAGS+=-D_DEBUG |
endif |
TARGET=libnautilus-follow-symlink |
# REQUIRED TO BUILD! |
TARGET_DIR=/usr/lib/nautilus/extensions-1.0 |
INSTALL_DIR=$(DESTDIR)$(TARGET_DIR) |
CC:=gcc |
all: $(TARGET).so |
$(TARGET).la: follow-symlink.o nautilus-ext-follow-symlink.o |
libtool --mode=link $(CC) $(LDFLAGS) -o $(TARGET).la follow-symlink.lo nautilus-ext-follow-symlink.lo -rpath $(TARGET_DIR) |
$(TARGET).so: $(TARGET).la |
ln -sf .libs/$(TARGET).so . |
follow-symlink.o: follow-symlink.c follow-symlink.h common.h |
libtool --mode=compile $(CC) $(CFLAGS) -c follow-symlink.c |
nautilus-ext-follow-symlink.o: nautilus-ext-follow-symlink.c nautilus-ext-follow-symlink.h common.h |
libtool --mode=compile $(CC) $(CFLAGS) -c nautilus-ext-follow-symlink.c |
install: strip |
mkdir -p $(INSTALL_DIR) |
install -m644 -oroot -groot $(TARGET).so $(INSTALL_DIR)/ |
uninstall: |
rm -f $(INSTALL_DIR)/$(TARGET).so |
rmdir -p $(INSTALL_DIR) || true |
strip: $(TARGET).so |
strip $(TARGET).so |
distclean: clean |
clean: |
rm -f *.la *.lo *.o *.so |
rm -rf .libs |
/nautilus-follow-symlink/trunk/src/common.h |
---|
0,0 → 1,17 |
#ifndef FOLLOW_SYMLINK_COMMON_H |
#define FOLLOW_SYMLINK_COMMON_H |
#include <glib.h> |
#ifdef _DEBUG |
#define TRACE() (g_printf("nautilus-follow-symlink trace: %s()\n", __FUNCTION__)); |
#else |
#define TRACE() |
#endif |
#ifndef VERSION |
#define VERSION "interim.debug" |
#endif |
#endif /* FOLLOW_SYMLINK_COMMON_H */ |
/* vim:set ts=4 et ai: */ |
/nautilus-follow-symlink/trunk/src/follow-symlink.c |
---|
0,0 → 1,129 |
#include "follow-symlink.h" |
/* Menu initialization */ |
void fsl_extension_menu_provider_iface_init(NautilusMenuProviderIface *iface) |
{ |
TRACE(); |
//TODO: iface->get_background_items = fsl_get_background_items; |
iface->get_file_items = fsl_get_file_items; |
} |
/* Bind to menu if needed */ |
GList * |
fsl_get_file_items (NautilusMenuProvider * provider, |
GtkWidget * window, |
GList * files) |
{ |
TRACE(); |
NautilusMenuItem *item; |
// Number of files = g_list_length(files) |
// Directory = nautilus_file_info_is_directory(files->data) |
if (files == NULL || g_list_length(files) != 1) { |
return NULL; |
} |
// Only file uris |
{ |
gchar * uri_scheme = nautilus_file_info_get_uri_scheme(files->data); |
if (strcmp(uri_scheme, "file") != 0) { |
return NULL; |
} |
g_free(uri_scheme); |
} |
// Xref: http://www.koders.com/c/fidA0AA0A78334E1FA3D668FD10B437638F6D031D77.aspx?s=NautilusFile |
GnomeVFSFileInfo * gfi = nautilus_file_info_get_vfs_file_info(files->data); |
/* |
* Xref: /usr/include/gnome-vfs-2.0/libgnomevfs/gnome-vfs-file-info.h |
* |
* Aparently type is never GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK and symlinks |
* are resolved to the target type |
*/ |
/*if (gfi->type != GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK) {*/ |
if (gfi->type != GNOME_VFS_FILE_TYPE_DIRECTORY) { |
return NULL; |
} |
// We know the file is either a directory or a symlink to a directory |
// TODO: Has glib/gnome any better/faster alternatives? |
{ |
struct stat file_info; |
const gchar * const file_name = nautilus_file_info_get_name(files->data); |
lstat(file_name, &file_info); |
if (! S_ISLNK(file_info.st_mode)) { |
return NULL; |
} |
} |
item = fsl_menu_item_new(gtk_widget_get_screen(window), TRUE); |
g_signal_connect(item, "activate", G_CALLBACK(fsl_callback), |
files->data); |
return g_list_append(NULL, item); |
} |
void fsl_callback (NautilusMenuItem * item, NautilusFileInfo * file_info) |
{ |
TRACE(); |
//g_print("fsl_callback\n"); |
const size_t URI_OFFSET = 7 * sizeof(gchar); // Offset at char 7 to remove file:// |
const size_t PATH_LENGTH_BYTES = sizeof(gchar) * (PATH_MAX + 1); |
gchar ** argv; |
const gchar * link_name = nautilus_file_info_get_uri(file_info); |
gchar * target = g_malloc(PATH_LENGTH_BYTES); |
/* unlike readlink(man 2), realpath(man 3) resolves the symlink, while |
* readlink returns the pointed file, which might be a relative path |
*/ |
if (NULL == realpath(link_name + URI_OFFSET, target)) { |
g_assert( FALSE ); |
} |
const gchar const * BASE_CMD = "nautilus --no-desktop --no-default-window "; |
gchar * command_line = g_malloc( sizeof(gchar) * (strlen(BASE_CMD) + strlen(target) + URI_OFFSET + 1) ); |
gchar * offset = g_stpcpy(command_line, BASE_CMD); |
offset = g_stpcpy(offset, "file://"); |
g_stpcpy(offset, target); |
if (FALSE == g_shell_parse_argv(command_line, NULL, &argv, NULL)) { |
g_assert( FALSE ); |
} |
g_printf("nautilus-follow-symlink: Spawning nautilus with\n \"%s\"\n", command_line); |
g_spawn_async( nautilus_file_info_get_parent_uri(file_info) + URI_OFFSET, |
argv, |
NULL, |
G_SPAWN_SEARCH_PATH, |
NULL, NULL, NULL, NULL); |
g_free(command_line); |
g_strfreev(argv); |
} |
/* Create the new menu item */ |
NautilusMenuItem * |
fsl_menu_item_new(GdkScreen *screen, gboolean is_file_item) |
{ |
TRACE(); |
NautilusMenuItem *ret; |
const char *name; |
const char *tooltip; |
name = "-> Follow symbolic _link"; |
tooltip = "Open the directory pointed by the currently selected symbolic link"; |
// (name, label, tip, icon) |
ret = nautilus_menu_item_new("FsymlinkExtension::follow_symlink", |
name, tooltip, NULL); |
//g_object_set_data(G_OBJECT(ret), "FsymlinkExtension::screen", screen); |
return ret; |
} |
/* vim:set ts=4 et ai: */ |
/nautilus-follow-symlink/trunk/src/nautilus-ext-follow-symlink.c |
---|
0,0 → 1,83 |
#include "nautilus-ext-follow-symlink.h" |
/* Public interface */ |
static GType fsl_type; |
static GType provider_types[1]; |
void nautilus_module_initialize (GTypeModule *module) |
{ |
TRACE(); |
g_printf("Initializing nautilus-follow-symlink extension (v.%s)\n", VERSION); |
fsl_register_type(module); |
provider_types[0] = fsl_get_type(); |
} |
void nautilus_module_shutdown (void) |
{ |
TRACE(); |
/* Module-specific shutdown */ |
g_print ("Shutting down nautilus-follow-symlink extension\n"); |
} |
void nautilus_module_list_types (const GType **types, int *num_types) |
{ |
TRACE(); |
*types = provider_types; |
*num_types = G_N_ELEMENTS(provider_types); |
} |
void fsl_register_type (GTypeModule *module) |
{ |
TRACE(); |
static const GTypeInfo info = { |
sizeof(FsymlinkExtensionClass), |
(GBaseInitFunc) NULL, |
(GBaseFinalizeFunc) NULL, |
(GClassInitFunc) fsl_class_init, |
NULL, |
NULL, |
sizeof (FsymlinkExtension), |
0, |
(GInstanceInitFunc) fsl_instance_init, |
}; |
fsl_type = g_type_module_register_type (module, |
G_TYPE_OBJECT, |
"FsymlinkExtension", |
&info, 0); |
/* Menu provider interface */ |
static const GInterfaceInfo menu_provider_iface_info = { |
(GInterfaceInitFunc)fsl_extension_menu_provider_iface_init, |
NULL, |
NULL, |
}; |
g_type_module_add_interface(module, fsl_type, |
NAUTILUS_TYPE_MENU_PROVIDER, &menu_provider_iface_info); |
/* Other Interfaces */ |
} |
GType fsl_get_type(void) |
{ |
TRACE(); |
return fsl_type; |
} |
static void fsl_instance_init(FsymlinkExtension *cvs) |
{ |
TRACE(); |
} |
static void fsl_class_init(FsymlinkExtensionClass *class) |
{ |
TRACE(); |
} |
/* vim:set ts=4 et ai: */ |
/nautilus-follow-symlink/trunk/src/follow-symlink.h |
---|
0,0 → 1,34 |
#ifndef FOLLOW_SYMLINK_H |
#define FOLLOW_SYMLINK_H |
/* |
* This file contains nautilus-follow-symlink's private interface, |
* its core functionality |
*/ |
#include <libnautilus-extension/nautilus-menu-provider.h> |
#include <sys/stat.h> |
#include <stdlib.h> /* realpath() */ |
#include <string.h> /* strlen() */ |
#include "common.h" |
/* Static Prototypes */ |
static GType fsl_get_type(void); |
static void fsl_register_type(GTypeModule *); |
static void fsl_callback(NautilusMenuItem *, NautilusFileInfo *); |
static GList *fsl_get_file_items(NautilusMenuProvider *, GtkWidget *, GList *); |
static NautilusMenuItem* fsl_menu_item_new(GdkScreen *, gboolean); |
/* Exported Prototypes |
* Here the namespace is a bit more explicit just in case |
*/ |
void fsl_extension_menu_provider_iface_init(NautilusMenuProviderIface *); |
#endif /* FOLLOW_SYMLINK_H */ |
/* vim:set ts=4 et ai: */ |
/nautilus-follow-symlink/trunk/src/nautilus-ext-follow-symlink.h |
---|
0,0 → 1,49 |
#ifndef NAUTILUS_EXT_FOLLOW_SYMLINK_H |
#define NAUTILUS_EXT_FOLLOW_SYMLINK_H |
#include <glib-object.h> |
#include <libnautilus-extension/nautilus-menu-provider.h> |
#include "common.h" |
/* |
* This file contains nautilus-follow-symlink's "public" interface, |
* the functions required to bind the extension to nautilus |
*/ |
void nautilus_module_initialize(GTypeModule *); |
void nautilus_module_shutdown(void); |
void nautilus_module_list_types(const GType **, int *); |
/* These ones don't need public visibility */ |
static void fsl_register_type(GTypeModule *); |
static GType fsl_get_type(void); |
/* Data Types */ |
struct _FsymlinkExtensionClass { |
GObjectClass parent_slot; |
}; |
struct _FsymlinkExtension { |
GObject parent_slot; |
}; |
typedef struct _FsymlinkExtensionClass FsymlinkExtensionClass; |
typedef struct _FsymlinkExtension FsymlinkExtension; |
/* Data initializers */ |
static void fsl_class_init (FsymlinkExtensionClass *class); |
static void fsl_instance_init (FsymlinkExtension *cvs); |
/* Defined in the private interface */ |
extern void fsl_extension_menu_provider_iface_init(NautilusMenuProviderIface *iface); |
#endif /* NAUTILUS_MODULE_FOLLOW_SYMLINK_H */ |
/* vim:set ts=4 et ai: */ |