Retro-fitted branch 0.7.0

git-svn-id: https://svn.outlyer.net/svn/pub/nautilus-follow-symlink/branches/0.7.0@13 da2faf11-d50b-4b07-92cd-6070d1bd8887
This commit is contained in:
Toni Corvera 2006-10-24 20:42:11 +00:00
parent 0eca4fd53c
commit 5cfea310a9
13 changed files with 146 additions and 72 deletions

View File

@ -2,7 +2,12 @@ Iterim milestones
These private versions, the version numbering bumps just denote These private versions, the version numbering bumps just denote
that a development milestone is achieved that a development milestone is achieved
0.6.0: 0.7.0 (24 oct 2006):
* Added support for background items (context menu on opened symlinks)
* BUGFIX: Corrected translation typos
* BUGFIX: Corrected includes only working in DEBUG/NON-DEBUG mode
0.6.0 (24 oct 2006):
* Added support for i18n, updated build-dependancies accordingly * Added support for i18n, updated build-dependancies accordingly
0.5.2 (24 oct 2006): 0.5.2 (24 oct 2006):

View File

@ -4,7 +4,7 @@ SUBDIRS = po src
# This doesn't work as expected # This doesn't work as expected
libdir = @libdir@/nautilus/extensions-1.0 libdir = @libdir@/nautilus/extensions-1.0
EXTRA_DIST = dist #EXTRA_DIST = dist
# Extra files to get rid of when distcleaning # Extra files to get rid of when distcleaning
DISTCLEANFILES = \ DISTCLEANFILES = \
@ -12,10 +12,6 @@ DISTCLEANFILES = \
intltool-merge \ intltool-merge \
intltool-update \ intltool-update \
\ \
intltool-extract.in \
intltool-merge.in \
intltool-update.in \
\
libtool \ libtool \
libtool.m4 \ libtool.m4 \
ltmain.sh \ ltmain.sh \

View File

@ -1,6 +1,6 @@
AC_INIT(src/follow-symlink.c) AC_INIT(src/follow-symlink.c)
AM_INIT_AUTOMAKE(libnautilus-follow-symlink, "0.6.0") AM_INIT_AUTOMAKE(libnautilus-follow-symlink, "0.7.0")
AC_CONFIG_HEADER(src/config.h) AC_CONFIG_HEADER(src/config.h)
dnl default FLAGS dnl default FLAGS

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
nautilus-follow-symlink (0.7.0-out.1) unstable; urgency=low
* New upstream release
-- Toni Corvera <outlyer@outlyer.net> Tue, 24 Oct 2006 21:30:10 +0200
nautilus-follow-symlink (0.6.0-out.1) experimental; urgency=low nautilus-follow-symlink (0.6.0-out.1) experimental; urgency=low
* New upstream release * New upstream release

1
dist
View File

@ -27,6 +27,7 @@ clean:
rm -f config.* depcomp install-sh missing src/config.h src/config.h.in rm -f config.* depcomp install-sh missing src/config.h src/config.h.in
rm -f aclocal.m4 rm -f aclocal.m4
rm -f configure Makefile Makefile.in src/Makefile src/Makefile.in rm -f configure Makefile Makefile.in src/Makefile src/Makefile.in
rm -f po/*.gmo po/Makefile po/Makefile.in po/POTFILES
# The following are moved thanks to Makefile.am (var DISTCLEANFILES) # The following are moved thanks to Makefile.am (var DISTCLEANFILES)
# (kept for situations in which make distclean fails) # (kept for situations in which make distclean fails)
# Undo libtoolize # Undo libtoolize

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: libnautilus-follow-symlink\n" "Project-Id-Version: libnautilus-follow-symlink\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2006-10-24 19:07+0200\n" "POT-Creation-Date: 2006-10-24 21:27+0200\n"
"PO-Revision-Date: 2006-10-24 19:37+0200\n" "PO-Revision-Date: 2006-10-24 19:37+0200\n"
"Last-Translator: Toni Corvera <outlyer@outlyer.net>\n" "Last-Translator: Toni Corvera <outlyer@outlyer.net>\n"
"Language-Team: Catalan <outlyer@outlyer.net>\n" "Language-Team: Catalan <outlyer@outlyer.net>\n"
@ -15,10 +15,18 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: ../src/follow-symlink.c:135 #: ../src/follow-symlink.c:156
msgid "Follow symbolic _link" msgid "Follow symbolic _link"
msgstr "Segueix l'en_llaç simbòlic" msgstr "Segueix l'en_llaç simbòlic"
#: ../src/follow-symlink.c:136 #: ../src/follow-symlink.c:157
msgid "Open the directory pointed by the currently selected symbolic link" msgid "Open the directory pointed by the currently selected symbolic link"
msgstr "Obre el directori apuntat per l'enllça simbòlic seleccionat" msgstr "Obre el directori apuntat per l'enllaç simbòlic seleccionat"
#: ../src/follow-symlink.c:160
msgid "Open real path"
msgstr "Obre la ruta real"
#: ../src/follow-symlink.c:161
msgid "Open the real path of the folder pointed by this symbolic link"
msgstr "Obre el directori apuntat per aquest enllaç"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: libnautilus-follow-symlink\n" "Project-Id-Version: libnautilus-follow-symlink\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2006-10-24 19:07+0200\n" "POT-Creation-Date: 2006-10-24 21:27+0200\n"
"PO-Revision-Date: 2006-10-24 19:09+0200\n" "PO-Revision-Date: 2006-10-24 19:09+0200\n"
"Last-Translator: Toni Corvera <outlyer@outlyer.net>\n" "Last-Translator: Toni Corvera <outlyer@outlyer.net>\n"
"Language-Team: Spanish <outlyer@outlyer.net>\n" "Language-Team: Spanish <outlyer@outlyer.net>\n"
@ -17,10 +17,19 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ../src/follow-symlink.c:135 #: ../src/follow-symlink.c:156
msgid "Follow symbolic _link" msgid "Follow symbolic _link"
msgstr "Seguir en_lace simbólico" msgstr "Seguir en_lace simbólico"
#: ../src/follow-symlink.c:136 #: ../src/follow-symlink.c:157
msgid "Open the directory pointed by the currently selected symbolic link" msgid "Open the directory pointed by the currently selected symbolic link"
msgstr "Abrir el directoro apuntado por el enlace simbólico seleccionado actualmente" msgstr ""
"Abrir el directorio apuntado por el enlace simbólico seleccionado actualmente"
#: ../src/follow-symlink.c:160
msgid "Open real path"
msgstr "Abrir la ruta real"
#: ../src/follow-symlink.c:161
msgid "Open the real path of the folder pointed by this symbolic link"
msgstr "Abrir el directoro apuntado por éste enlace simbólico"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2006-10-24 19:07+0200\n" "POT-Creation-Date: 2006-10-24 21:27+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -16,10 +16,18 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n" "Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: ../src/follow-symlink.c:135 #: ../src/follow-symlink.c:156
msgid "Follow symbolic _link" msgid "Follow symbolic _link"
msgstr "" msgstr ""
#: ../src/follow-symlink.c:136 #: ../src/follow-symlink.c:157
msgid "Open the directory pointed by the currently selected symbolic link" msgid "Open the directory pointed by the currently selected symbolic link"
msgstr "" msgstr ""
#: ../src/follow-symlink.c:160
msgid "Open real path"
msgstr ""
#: ../src/follow-symlink.c:161
msgid "Open the real path of the folder pointed by this symbolic link"
msgstr ""

View File

@ -9,6 +9,9 @@
#include <glib/gmessages.h> /* g_print() */ #include <glib/gmessages.h> /* g_print() */
#include <glib/gprintf.h> /* g_printf() */ #include <glib/gprintf.h> /* g_printf() */
#include <stdlib.h> /* getenv() (3) */
#include <string.h> /* strcmp() (3) */
#include "libintl.h" #include "libintl.h"
#define _(STR) gettext(STR) #define _(STR) gettext(STR)
@ -16,10 +19,12 @@
#include "config.h" #include "config.h"
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
#ifndef __inline__
#define __inline
#endif
#ifdef _DEBUG #ifdef _DEBUG
/* Debugging facilities */ /* Debugging facilities */
#include <stdlib.h> /* getenv() (3) */
#include <string.h> /* strcmp() (3) */
/* Prefix for messages */ /* Prefix for messages */
#define FSL_ "nautilus-follow-symlink: " #define FSL_ "nautilus-follow-symlink: "

View File

@ -1,22 +1,73 @@
#include "follow-symlink.h" #include "follow-symlink.h"
#include <glib/gprintf.h>
#include <sys/stat.h>
#include <errno.h> /* errno (3) */
#include <stdlib.h> /* realpath() (3) */
#include <string.h> /* strlen(), strerror() (3) */
// Offset at char 7 to remove file:// // Offset at char 7 to remove file://
static const unsigned short URI_OFFSET = 7 * sizeof(gchar); static const unsigned short URI_OFFSET = 7 * sizeof(gchar);
static const size_t PATH_LENGTH_BYTES = sizeof(gchar) * (PATH_MAX + 1); static const size_t PATH_LENGTH_BYTES = sizeof(gchar) * (PATH_MAX + 1);
extern int errno;
/* Menu initialization */ /* Menu initialization */
void fsl_extension_menu_provider_iface_init(NautilusMenuProviderIface *iface) void fsl_extension_menu_provider_iface_init(NautilusMenuProviderIface *iface)
{ {
TRACE(); TRACE();
//TODO: iface->get_background_items = fsl_get_background_items;
iface->get_file_items = fsl_get_file_items; 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)
{
TRACE();
NautilusMenuItem *item;
// Only file uris
{
gchar * uri_scheme = nautilus_file_info_get_uri_scheme(file_info);
if (strcmp(uri_scheme, "file") != 0) {
FSL_LOG( "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?
{
struct stat file_stat;
// Note ..._get_name doesn't give the full path
const gchar * const file_name = nautilus_file_info_get_uri(file_info) + URI_OFFSET;
lstat(file_name, &file_stat);
if (! S_ISLNK(file_stat.st_mode)) {
FSL_LOG1( "Not S_ISLNK:", file_name );
return NULL;
}
}
item = fsl_menu_item_new(gtk_widget_get_screen(window), is_file_item);
g_signal_connect(item, "activate", G_CALLBACK(fsl_callback),
file_info);
return g_list_append(NULL, item);
}
GList *
fsl_get_background_items(NautilusMenuProvider * provider,
GtkWidget * window,
NautilusFileInfo * current_folder)
{
TRACE();
if (NULL == current_folder) { // XXX: Does this ever happen?
FSL_LOG( "No folder selected" );
}
return fsl_get_items_impl(window, current_folder, FALSE);
} }
/* Bind to menu if needed */ /* Bind to menu if needed */
@ -27,8 +78,6 @@ fsl_get_file_items (NautilusMenuProvider * provider,
{ {
TRACE(); TRACE();
NautilusMenuItem *item;
// Number of files = g_list_length(files) // Number of files = g_list_length(files)
// Directory = nautilus_file_info_is_directory(files->data) // Directory = nautilus_file_info_is_directory(files->data)
@ -37,47 +86,18 @@ fsl_get_file_items (NautilusMenuProvider * provider,
return NULL; return NULL;
} }
// Only file uris
{
gchar * uri_scheme = nautilus_file_info_get_uri_scheme(files->data);
if (strcmp(uri_scheme, "file") != 0) {
FSL_LOG( "Not file scheme" );
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); 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 * Aparently type is never GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK and symlinks
* are resolved to the target type * are resolved to the target type
*/ */
/*if (gfi->type != GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK) {*/
if (gfi->type != GNOME_VFS_FILE_TYPE_DIRECTORY) { if (gfi->type != GNOME_VFS_FILE_TYPE_DIRECTORY) {
FSL_LOG( "Not directory" ); FSL_LOG( "Not directory" );
return NULL; 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;
// Note ..._get_name doesn't give the full path
const gchar * const file_name = nautilus_file_info_get_uri(files->data) + URI_OFFSET;
lstat(file_name, &file_info);
if (! S_ISLNK(file_info.st_mode)) {
FSL_LOG1( "Not S_ISLNK:", file_name );
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); return fsl_get_items_impl(window, files->data, TRUE);
} }
void fsl_callback (NautilusMenuItem * item, NautilusFileInfo * file_info) void fsl_callback (NautilusMenuItem * item, NautilusFileInfo * file_info)
@ -132,8 +152,14 @@ fsl_menu_item_new(GdkScreen *screen, gboolean is_file_item)
const char *name; const char *name;
const char *tooltip; const char *tooltip;
name = _("Follow symbolic _link"); if (is_file_item) {
tooltip = _("Open the directory pointed by the currently selected symbolic link"); name = _("Follow symbolic _link");
tooltip = _("Open the directory pointed by the currently selected symbolic link");
}
else {
name = _("Open real path");
tooltip = _("Open the real path of the folder pointed by this symbolic link");
}
// (name, label, tip, icon) // (name, label, tip, icon)
ret = nautilus_menu_item_new("FsymlinkExtension::follow_symlink", ret = nautilus_menu_item_new("FsymlinkExtension::follow_symlink",

View File

@ -6,17 +6,27 @@
* its core functionality * its core functionality
*/ */
#include "common.h"
#include <libnautilus-extension/nautilus-menu-provider.h> #include <libnautilus-extension/nautilus-menu-provider.h>
#include "common.h" #include <glib/gprintf.h>
#include <sys/stat.h>
#include <errno.h> /* errno (3) */
#include <stdlib.h> /* realpath() (3) */
#include <string.h> /* strlen(), strerror() (3) */
/* Static Prototypes */ /* Static Prototypes */
static void fsl_callback(NautilusMenuItem *, NautilusFileInfo *); static void fsl_callback(NautilusMenuItem *, NautilusFileInfo *);
static GList *fsl_get_file_items(NautilusMenuProvider *, GtkWidget *, GList *); static GList * fsl_get_file_items(NautilusMenuProvider *, GtkWidget *, GList *);
static NautilusMenuItem* fsl_menu_item_new(GdkScreen *, gboolean); static GList * fsl_get_background_items(NautilusMenuProvider *, GtkWidget *, NautilusFileInfo *);
static GList * fsl_get_items_impl(GtkWidget *, NautilusFileInfo *, gboolean);
static NautilusMenuItem * fsl_menu_item_new(GdkScreen *, gboolean);
/* Exported Prototypes /* Exported Prototypes
* Here the namespace is a bit more explicit just in case * Here the namespace is a bit more explicit just in case

View File

@ -1,10 +1,5 @@
#include "nautilus-ext-follow-symlink.h" #include "nautilus-ext-follow-symlink.h"
#include <locale.h>
#include <libintl.h>
#include <glib/gprintf.h>
/* Public interface */ /* Public interface */
static GType fsl_type; static GType fsl_type;
static GType provider_types[1]; static GType provider_types[1];

View File

@ -1,10 +1,15 @@
#ifndef NAUTILUS_EXT_FOLLOW_SYMLINK_H #ifndef NAUTILUS_EXT_FOLLOW_SYMLINK_H
#define NAUTILUS_EXT_FOLLOW_SYMLINK_H #define NAUTILUS_EXT_FOLLOW_SYMLINK_H
#include "common.h"
#include <glib-object.h> #include <glib-object.h>
#include <libnautilus-extension/nautilus-menu-provider.h> #include <libnautilus-extension/nautilus-menu-provider.h>
#include "common.h" #include <locale.h>
#include <libintl.h>
#include <glib/gprintf.h>
/* /*
* This file contains nautilus-follow-symlink's "public" interface, * This file contains nautilus-follow-symlink's "public" interface,
@ -45,5 +50,5 @@ static void fsl_instance_init (FsymlinkExtension *cvs);
/* Defined in the private interface */ /* Defined in the private interface */
extern void fsl_extension_menu_provider_iface_init(NautilusMenuProviderIface *iface); extern void fsl_extension_menu_provider_iface_init(NautilusMenuProviderIface *iface);
#endif /* NAUTILUS_MODULE_FOLLOW_SYMLINK_H */ #endif /* NAUTILUS_EXT_FOLLOW_SYMLINK_H */
/* vim:set ts=4 et ai: */ /* vim:set ts=4 et ai: */