/nautilus-follow-symlink/trunk/src/follow-symlink.c |
---|
0,0 → 1,327 |
/* $Id$ |
* |
* follow-symlink.h |
* nautilus-follow-symlink: Nautilus extension which allows opening the real |
* path of symbolic links |
* |
* Copyright (C) 2006 Toni Corvera |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Lesser General Public |
* License as published by the Free Software Foundation; either |
* version 2.1 of the License, or (at your option) any later version. |
* |
* This library 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 |
* Lesser General Public License for more details. |
* |
* You should have received a copy of the GNU Lesser General Public |
* License along with this library; if not, write to the Free Software |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
* |
* Author: Toni Corvera <outlyer@outlyer.net> |
*/ |
#include "follow-symlink.h" |
extern int errno; |
/* Menu initialization */ |
void fsl_extension_menu_provider_iface_init(NautilusMenuProviderIface *iface) |
{ |
TRACE(); |
iface->get_file_items = fsl_get_file_items; |
iface->get_background_items = fsl_get_background_items; |
} |
/* Implementation of the menu attachment, |
* this is slightly different whith 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, |
NautilusFileInfo * file_info, |
gboolean is_file_item, |
GList * input) |
{ |
TRACE(); |
NautilusMenuItem *item; |
// Only file uris |
{ |
// TODO: what about GnomeVFSFileInfo's is_local ? |
gchar * uri_scheme = nautilus_file_info_get_uri_scheme(file_info); |
if (strcmp(uri_scheme, "file") != 0) { |
FSL_LOG1( "Not file scheme" ); |
return NULL; |
} |
g_free(uri_scheme); |
} |
// 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; |
} |
item = fsl_menu_item_new(gtk_widget_get_screen(window), |
is_file_item, |
nautilus_file_info_get_name(file_info)); |
g_signal_connect(item, "activate", G_CALLBACK(fsl_callback), file_info); |
return g_list_append(input, item); |
} |
GList * |
fsl_get_background_items(NautilusMenuProvider * provider __UNUSED, |
GtkWidget * window, |
NautilusFileInfo * current_folder) |
{ |
TRACE(); |
if (NULL == current_folder) { // XXX: Does this ever happen? |
FSL_LOG1( "No folder selected"); |
} |
return fsl_get_items_impl(window, current_folder, FALSE, NULL); |
} |
gboolean file_is_directory (const gpointer const file_data) |
{ |
TRACE(); |
/* |
* 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; |
} |
/* |
* Bind to the menu if needed |
* |
* |
*/ |
GList * fsl_get_file_items (NautilusMenuProvider * provider __UNUSED, |
GtkWidget * window, |
GList * files) |
{ |
TRACE(); |
// Number of files = g_list_length(files) |
// Directory = nautilus_file_info_is_directory(files->data) |
if (NULL == files) { |
FSL_LOG1("No file selected"); |
return NULL; |
} |
assert( g_list_length(files) > 0 ); |
FSL_LOG_COND( g_list_length(files) > 1, "More than one file selected (%d)", g_list_length(files) ); |
GList * items = NULL; |
for (int i=0; i<g_list_length(files); ++i) { |
const gpointer file_info = g_list_nth_data(files, i); |
if (!file_is_directory(file_info)) { |
FSL_LOG ( "File %s is not a directory, discarded", |
nautilus_file_info_get_name(file_info) ); |
continue; |
} |
FSL_LOG( "%s is a directory", nautilus_file_info_get_name(file_info) ); |
// TODO: Am I loosing memory? |
GList * ret = fsl_get_items_impl(window, file_info, TRUE, items); |
if (NULL != ret) { |
items = ret; |
} |
} |
return items; |
} |
/* |
* Opens the real path of the symbolic link |
* |
* file_info: The symbolic link |
*/ |
void fsl_callback (NautilusMenuItem * item __UNUSED, NautilusFileInfo * file_info) |
{ |
TRACE(); |
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); |
} |
/* |
* Creates the new menu item |
* |
* is_file_item: TRUE if we're working over a (selected) file, FALSE if working |
* over a (opened) folder |
* base_name: file name, without path, of the given file |
*/ |
NautilusMenuItem * fsl_menu_item_new(GdkScreen *screen __UNUSED, |
gboolean is_file_item, |
const gchar * a_base_name) |
{ |
TRACE(); |
NautilusMenuItem *ret; |
gchar * name, * tooltip, * fmt_name, * fmt_tooltip, * unique_name; |
if (is_file_item) { |
fmt_name = _("Follow symbolic _link '%s'"); |
fmt_tooltip = _("Open the directory pointed by the symbolic link '%s'"); |
} |
else { |
fmt_name = _("Open _real path of '%s'"); |
fmt_tooltip = _("Open the real path of the folder pointed by '%s'"); |
} |
gchar * base_name = (gchar*)a_base_name; |
// Replace any _ in the file name with __ (to display correctly in the |
// context menu) |
{ |
// Count them |
size_t count = 0; |
for (size_t i=0; i<strlen(base_name); ++i) { |
if (*(base_name + i) == '_') { |
++count; |
} |
} |
// Escape the string if needed |
if (count > 0) { |
gchar * escaped_name = g_malloc( (strlen(base_name) + count)*sizeof(gchar) ); |
gchar * src = base_name, * dst = escaped_name; |
while (count > 0) { |
const gchar c = *src; |
if (c == '_') { |
*dst = '_'; |
dst++; |
--count; |
} |
*dst = *src; |
dst++; src++; |
} |
g_stpcpy(dst, src); |
base_name = escaped_name; |
} |
} |
// Trial and error showed that the menu item name must be different |
// when various are to be shown (multiple selections), and also that the |
// name should always be the same for a given file, hence the base name is |
// appended to the command name |
static const gchar * const ITEM_NAME_FMT = "FsymlinkExtension::follow_symlink_%s"; |
name = g_try_malloc( printf_string_upper_bound(fmt_name, base_name) ); |
tooltip = g_try_malloc( printf_string_upper_bound(fmt_tooltip, a_base_name) ); |
unique_name = g_try_malloc( printf_string_upper_bound(ITEM_NAME_FMT, a_base_name) ); |
if (NULL == name || NULL == tooltip || NULL == unique_name) { |
// Let's try to keep nautilus going if no allocation is possible |
if (name) g_free(name); |
if (tooltip) g_free(tooltip); |
if (unique_name) g_free(unique_name); |
g_printerr(__FILE__ ":%d: Failed to allocate enough memory for " |
"the new menu item, dummier menu item in use.\n", __LINE__); |
// Can't return NULL neither a nautilus_menu_item_new(NULL,NULL,NULL,NULL) |
ret = nautilus_menu_item_new("Fsymlink::allocation_error", |
_("Follow symbolic _link"), |
_("Open the symbolic link"), |
FSL_ICON); |
g_return_val_if_fail(NULL!=name && NULL!=tooltip && NULL!=unique_name, |
ret); |
} |
g_sprintf(name, fmt_name, base_name); |
g_sprintf(tooltip, fmt_tooltip, a_base_name); |
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); |
if (base_name != a_base_name) { |
g_free(base_name); |
} |
g_free(unique_name); |
g_free(name); |
g_free(tooltip); |
//g_object_set_data(G_OBJECT(ret), "FsymlinkExtension::screen", screen); |
return ret; |
} |
/*** Utility(-es) ***/ |
/* |
* Wrapper for g_printf_string_upper_bound with a variadic signature |
* |
* Returns the maximum space needed to store the formatted string |
*/ |
gsize printf_string_upper_bound(const gchar * format, ...) { |
va_list ap; |
va_start(ap, format); |
gsize retval = g_printf_string_upper_bound(format, ap); |
va_end(ap); |
return retval; |
} |
/* vim:set ts=4 et ai: */ |
Property changes: |
Added: svn:keywords |
+Rev Id Date |
\ No newline at end of property |
/nautilus-follow-symlink/trunk/src/nautilus-ext-follow-symlink.c |
---|
0,0 → 1,121 |
/* $Id$ |
* |
* follow-symlink.h |
* nautilus-follow-symlink: Nautilus extension which allows opening the real |
* path of symbolic links |
* |
* Copyright (C) 2006 Toni Corvera |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Lesser General Public |
* License as published by the Free Software Foundation; either |
* version 2.1 of the License, or (at your option) any later version. |
* |
* This library 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 |
* Lesser General Public License for more details. |
* |
* You should have received a copy of the GNU Lesser General Public |
* License along with this library; if not, write to the Free Software |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
* |
* Author: Toni Corvera <outlyer@outlyer.net> |
*/ |
#include "nautilus-ext-follow-symlink.h" |
/* Public interface */ |
static GType fsl_type; |
static GType provider_types[1]; |
void nautilus_module_initialize (GTypeModule *module) |
{ |
TRACE(); |
FSL_DEBUG_INIT(); |
setlocale(LC_ALL, ""); |
bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR); |
textdomain(GETTEXT_PACKAGE); |
g_printf("Initializing nautilus-follow-symlink extension (v%s)\n", VERSION); |
fsl_register_type(module); |
# if 0 |
provider_types[0] = fsl_get_type(); |
#endif |
provider_types[0] = fsl_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, |
//TODO: Does nullifyng this have side effects? |
NULL, //(GClassInitFunc) fsl_class_init, |
NULL, |
NULL, |
sizeof (FsymlinkExtension), |
0, |
NULL, //(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 */ |
} |
#if 0 |
GType fsl_get_type(void) |
{ |
TRACE(); |
return fsl_type; |
} |
#endif |
#if 0 |
void fsl_instance_init(FsymlinkExtension *instance) |
{ |
TRACE(); |
} |
void fsl_class_init(FsymlinkExtensionClass *class) |
{ |
TRACE(); |
} |
#endif |
/* vim:set ts=4 et ai: */ |
Property changes: |
Added: svn:keywords |
+Rev Id Date |
\ No newline at end of property |
/nautilus-follow-symlink/trunk/src/common.h |
---|
0,0 → 1,230 |
/* $Id$ |
* |
* common.h |
* nautilus-follow-symlink: Nautilus extension which allows opening the real |
* path of symbolic links |
* |
* Copyright (C) 2006 Toni Corvera |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Lesser General Public |
* License as published by the Free Software Foundation; either |
* version 2.1 of the License, or (at your option) any later version. |
* |
* This library 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 |
* Lesser General Public License for more details. |
* |
* You should have received a copy of the GNU Lesser General Public |
* License along with this library; if not, write to the Free Software |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
* |
* Author: Toni Corvera <outlyer@outlyer.net> |
*/ |
#ifndef FOLLOW_SYMLINK_COMMON_H |
#define FOLLOW_SYMLINK_COMMON_H |
/* |
* This file defines common debug utilities. |
* Also, includes config.h. |
*/ |
#include <glib/gmessages.h> /* g_print() */ |
#include <glib/gprintf.h> /* g_printf() */ |
#include <stdlib.h> /* getenv() (3) */ |
#include <string.h> /* strcmp() (3) */ |
#ifdef _DEBUG |
#include <stdarg.h> /* va_list, va_start ... */ |
#endif |
#include "libintl.h" |
#define _(STR) gettext(STR) |
#ifdef HAVE_CONFIG_H |
#include "config.h" |
#endif // HAVE_CONFIG_H |
#if !defined(__inline) |
#define __inline |
#elif defined(_DEBUG) |
#undef __inline |
#define __inline |
#endif |
// Based on : http://rlove.org/log/2005102601 |
#if __GNUC__ >= 3 |
#define inline inline __attribute__((always_inline)) |
#define __pure __attribute__((pure)) |
//#define __const __attribute__((const)) // fails |
#define __constfn __attribute__((const)) |
#define __noreturn __attribute__((noreturn)) |
#define __malloc __attribute__((malloc)) |
#define __must_check __attribute__((warn_unused_result)) |
#define __deprecated __attribute__((deprecated)) |
#define __used __attribute__((used)) |
// __unused gives errors in x86_64 |
#define __UNUSED __attribute__((unused)) |
#define __packed __attribute__((packed)) |
#define likely(x) __builtin_expect (!!(x), 1) |
#define unlikely(x) __builtin_expect (!!(x), 0) |
/* These are mine: used to hint the compiler in variadic printf-like |
* functions, this way it will warn if format/arguments are incorrect */ |
/* printf-like variadic arguments (format is first, args from second) */ |
#define __va_printf __attribute__((format(printf, 1, 2))) |
/* fprintf-like variadic arguments (format is second, args from third */ |
#define __va_fprintf __attribute__((format(printf, 2, 3))) |
#else |
#define inline /* no inline */ |
#define __pure /* no pure */ |
#define __constfn /* no const */ |
#define __noreturn /* no noreturn */ |
#define __malloc /* no malloc */ |
#define __must_check /* no warn_unused_result */ |
#define __deprecated /* no deprecated */ |
#define __used /* no used */ |
#define __UNUSED /* no unused */ |
#define __packed /* no packed */ |
#define likely(x) (x) |
#define unlikely(x) (x) |
#define __va_printf |
#define __va_fprintf |
#endif |
/* |
* Uber-anal glib usage: disallow stdlib's functions where glib provides |
* their own |
*/ |
#if 0 && __GNUC__ |
#pragma GCC poison printf sprintf |
#endif |
#ifdef _DEBUG |
/* Debugging facilities */ |
/* Prefix for messages */ |
#define FSL_ "nautilus-follow-symlink: " |
enum { |
FINE = 1, |
FINER, |
TRACE = FINER, |
}; |
/* Check on runtime the environment variable's value |
* |
* (set to 1 to enable verbosity, to 2 for extra verbosity) |
*/ |
static inline int VERBOSITY_LEVEL(void) |
{ |
const char * const DBGENV = getenv("FSL_DBG"); |
if (NULL == DBGENV || 0 == strcmp(DBGENV, "0")) { |
return 0; |
} |
else if (0 == strcmp(DBGENV, "2")) { |
return 2; |
} |
return 1; |
} |
/* Informational message shown on initialisation */ |
static inline void FSL_DEBUG_INIT(void) |
{ |
g_print( FSL_ "DEBUG mode is available, and "); |
g_printf(" set to %d.\n", VERBOSITY_LEVEL()); |
g_print( FSL_ "set the environment variable FSL_DBG to \n" |
FSL_ "1 to enable it or to any other value to disable it.\n"); |
} |
/* Display the name of the current function name */ |
#define TRACE() FSL_LOG_WITH_LEVEL(TRACE, FSL_ "trace: %s()", __func__); |
/* |
* Display a log message with a given log level if the level |
* is at least VERBOSITY_LEVEL(). |
* Same as FSL_LOG_WITH_LEVEL but taking a va_list, this function |
* provides the implementation used by the other FSL_LOG_*'s |
*/ |
static inline void __UNUSED FSL_LOG_WITH_LEVEL_IMPL(int level, |
gchar * const format, |
va_list ap) |
{ |
if (VERBOSITY_LEVEL() >= level) { |
g_vprintf(format, ap); |
g_print("\n"); |
} |
} |
/* |
* Display a log message with a given log level if the level |
* is at least VERBOSITY_LEVEL(). |
*/ |
static void __UNUSED __va_fprintf FSL_LOG_WITH_LEVEL(int level, |
gchar * const format, |
...) |
{ |
va_list ap; |
va_start(ap, format); |
FSL_LOG_WITH_LEVEL_IMPL(level, format, ap); |
va_end(ap); |
} |
/* Display a message |
* |
* NOTE: Variadic functions can't be inlined |
*/ |
static void __UNUSED __va_printf FSL_LOG(gchar * const format, ...) |
{ |
va_list ap; |
va_start(ap, format); |
FSL_LOG_WITH_LEVEL_IMPL(FINE, format, ap); |
va_end(ap); |
} |
/* Display a message if a condition is true |
* |
* NOTE: Variadic functions can't be inlined |
*/ |
static void __UNUSED __va_fprintf FSL_LOG_COND(int cond, gchar * const format, ...) |
{ |
if (cond) { |
va_list ap; |
va_start(ap, format); |
FSL_LOG_WITH_LEVEL_IMPL(FINE, format, ap); |
va_end(ap); |
} |
} |
/* see below for an explanation */ |
#define FSL_LOG1(s) FSL_LOG(s) |
#else |
/* Debugging facilities disabled */ |
#define FINE |
#define FINER |
#define TRACE() |
#define FSL_DEBUG_INIT() |
/* With variadic functions there's no way (AFAIK) to provide empty |
* alternative macros that won't raise a compiler error if no variable |
* arguments are given, hence this hackish FSL_LOG1, for the cases |
* in which just an argument is used |
*/ |
#define FSL_LOG1(s) |
#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 /* FOLLOW_SYMLINK_COMMON_H */ |
/* vim:set ts=4 et ai: */ |
Property changes: |
Added: svn:keywords |
+Rev Id Date |
\ No newline at end of property |
/nautilus-follow-symlink/trunk/src/Makefile.am |
---|
0,0 → 1,20 |
# $Id$ # |
# |
# Required to correctly install the locale files |
CPPFLAGS+=-DGNOMELOCALEDIR=\""$(datadir)/locale"\" |
nautilus_extension_lib_LTLIBRARIES = libnautilus-follow-symlink.la |
# Must be installed in nautilus' extension dir |
#nautilus_extension_libdir = $(libdir)/nautilus/extensions-1.0 |
# Cleaner way: |
nautilus_extension_libdir = `pkg-config --variable=extensiondir libnautilus-extension` |
libnautilus_follow_symlink_la_SOURCES = follow-symlink.c nautilus-ext-follow-symlink.c |
# There's really no need to have versioned file names |
libnautilus_follow_symlink_la_LDFLAGS = -avoid-version |
# See e.g. <http://www.seul.org/docs/autotut/#libtool> for version instructions |
#libnautilus_follow_symlink_la_LDFLAGS = -version-info 0:0:0 |
Property changes: |
Added: svn:keywords |
+Rev Id Date |
\ No newline at end of property |
/nautilus-follow-symlink/trunk/src/follow-symlink.h |
---|
0,0 → 1,74 |
/* $Id$ |
* |
* follow-symlink.h |
* nautilus-follow-symlink: Nautilus extension which allows opening the real |
* path of symbolic links |
* |
* Copyright (C) 2006 Toni Corvera |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Lesser General Public |
* License as published by the Free Software Foundation; either |
* version 2.1 of the License, or (at your option) any later version. |
* |
* This library 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 |
* Lesser General Public License for more details. |
* |
* You should have received a copy of the GNU Lesser General Public |
* License along with this library; if not, write to the Free Software |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
* |
* Author: Toni Corvera <outlyer@outlyer.net> |
*/ |
#ifndef FOLLOW_SYMLINK_H |
#define FOLLOW_SYMLINK_H |
/* |
* This file contains nautilus-follow-symlink's private interface, |
* its core functionality |
*/ |
#include "common.h" |
#include <libnautilus-extension/nautilus-menu-provider.h> |
#include <glib/gprintf.h> |
#include <errno.h> /* errno (3) */ |
#include <string.h> /* strlen(), strerror() (3) */ |
#include <assert.h> |
/* Static Prototypes */ |
static void fsl_callback(NautilusMenuItem *, NautilusFileInfo *); |
// This signature can't be changed |
static GList * fsl_get_file_items(NautilusMenuProvider *, |
GtkWidget *, |
GList *); |
// This signature can't be changed |
static GList * fsl_get_background_items(NautilusMenuProvider *, |
GtkWidget *, |
NautilusFileInfo *); |
static inline GList * fsl_get_items_impl(GtkWidget *, |
NautilusFileInfo *, |
gboolean, |
GList *); |
static NautilusMenuItem * fsl_menu_item_new(GdkScreen *, gboolean, const gchar *); |
static inline __pure gboolean file_is_directory(const gpointer const); |
static gsize printf_string_upper_bound(const gchar *, ...); |
/* 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: */ |
Property changes: |
Added: svn:keywords |
+Rev Id Date |
\ No newline at end of property |
/nautilus-follow-symlink/trunk/src/nautilus-ext-follow-symlink.h |
---|
0,0 → 1,83 |
/* $Id$ |
* |
* follow-symlink.h |
* nautilus-follow-symlink: Nautilus extension which allows opening the real |
* path of symbolic links |
* |
* Copyright (C) 2006 Toni Corvera |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Lesser General Public |
* License as published by the Free Software Foundation; either |
* version 2.1 of the License, or (at your option) any later version. |
* |
* This library 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 |
* Lesser General Public License for more details. |
* |
* You should have received a copy of the GNU Lesser General Public |
* License along with this library; if not, write to the Free Software |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
* |
* Author: Toni Corvera <outlyer@outlyer.net> |
*/ |
#ifndef NAUTILUS_EXT_FOLLOW_SYMLINK_H |
#define NAUTILUS_EXT_FOLLOW_SYMLINK_H |
#include "common.h" |
#include <glib-object.h> |
#include <libnautilus-extension/nautilus-menu-provider.h> |
#include <locale.h> |
#include <libintl.h> |
#include <glib/gprintf.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 *); |
#if 0 |
static __constfn GType fsl_get_type(void); |
#endif |
/* Data Types */ |
struct _FsymlinkExtensionClass { |
GObjectClass parent_slot; |
}; |
struct _FsymlinkExtension { |
GObject parent_slot; |
}; |
typedef struct _FsymlinkExtensionClass FsymlinkExtensionClass; |
typedef struct _FsymlinkExtension FsymlinkExtension; |
/* Data initializers, not really needed */ |
#if 0 |
static void fsl_class_init (FsymlinkExtensionClass *class); |
static void fsl_instance_init (FsymlinkExtension *cvs); |
#endif |
/* Defined in the private interface */ |
extern void fsl_extension_menu_provider_iface_init(NautilusMenuProviderIface *iface); |
#endif /* NAUTILUS_EXT_FOLLOW_SYMLINK_H */ |
/* vim:set ts=4 et ai: */ |
Property changes: |
Added: svn:keywords |
+Rev Id Date |
\ No newline at end of property |