Merge branch 0.7.0 into trunk (12:13)
git-svn-id: https://svn.outlyer.net/svn/pub/nautilus-follow-symlink/trunk@14 da2faf11-d50b-4b07-92cd-6070d1bd8887
This commit is contained in:
commit
dc7a1207aa
|
@ -2,7 +2,12 @@ Iterim milestones
|
|||
These private versions, the version numbering bumps just denote
|
||||
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
|
||||
|
||||
0.5.2 (24 oct 2006):
|
||||
|
|
|
@ -4,7 +4,7 @@ SUBDIRS = po src
|
|||
# This doesn't work as expected
|
||||
libdir = @libdir@/nautilus/extensions-1.0
|
||||
|
||||
EXTRA_DIST = dist
|
||||
#EXTRA_DIST = dist
|
||||
|
||||
# Extra files to get rid of when distcleaning
|
||||
DISTCLEANFILES = \
|
||||
|
@ -12,10 +12,6 @@ DISTCLEANFILES = \
|
|||
intltool-merge \
|
||||
intltool-update \
|
||||
\
|
||||
intltool-extract.in \
|
||||
intltool-merge.in \
|
||||
intltool-update.in \
|
||||
\
|
||||
libtool \
|
||||
libtool.m4 \
|
||||
ltmain.sh \
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
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)
|
||||
|
||||
dnl default FLAGS
|
||||
|
|
|
@ -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
|
||||
|
||||
* New upstream release
|
||||
|
|
1
dist
1
dist
|
@ -27,6 +27,7 @@ clean:
|
|||
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
|
||||
# The following are moved thanks to Makefile.am (var DISTCLEANFILES)
|
||||
# (kept for situations in which make distclean fails)
|
||||
# Undo libtoolize
|
||||
|
|
16
po/ca.po
16
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-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"
|
||||
"Last-Translator: Toni Corvera <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-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ../src/follow-symlink.c:135
|
||||
#: ../src/follow-symlink.c:156
|
||||
msgid "Follow symbolic _link"
|
||||
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"
|
||||
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ç"
|
||||
|
|
17
po/es.po
17
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-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"
|
||||
"Last-Translator: Toni Corvera <outlyer@outlyer.net>\n"
|
||||
"Language-Team: Spanish <outlyer@outlyer.net>\n"
|
||||
|
@ -17,10 +17,19 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#: ../src/follow-symlink.c:135
|
||||
#: ../src/follow-symlink.c:156
|
||||
msgid "Follow symbolic _link"
|
||||
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"
|
||||
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"
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\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"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -16,10 +16,18 @@ msgstr ""
|
|||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ../src/follow-symlink.c:135
|
||||
#: ../src/follow-symlink.c:156
|
||||
msgid "Follow symbolic _link"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/follow-symlink.c:136
|
||||
#: ../src/follow-symlink.c:157
|
||||
msgid "Open the directory pointed by the currently selected symbolic link"
|
||||
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 ""
|
11
src/common.h
11
src/common.h
|
@ -9,6 +9,9 @@
|
|||
#include <glib/gmessages.h> /* g_print() */
|
||||
#include <glib/gprintf.h> /* g_printf() */
|
||||
|
||||
#include <stdlib.h> /* getenv() (3) */
|
||||
#include <string.h> /* strcmp() (3) */
|
||||
|
||||
#include "libintl.h"
|
||||
#define _(STR) gettext(STR)
|
||||
|
||||
|
@ -16,10 +19,12 @@
|
|||
#include "config.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#ifndef __inline__
|
||||
#define __inline
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
/* Debugging facilities */
|
||||
#include <stdlib.h> /* getenv() (3) */
|
||||
#include <string.h> /* strcmp() (3) */
|
||||
/* Debugging facilities */
|
||||
|
||||
/* Prefix for messages */
|
||||
#define FSL_ "nautilus-follow-symlink: "
|
||||
|
|
|
@ -1,22 +1,73 @@
|
|||
#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://
|
||||
static const unsigned short URI_OFFSET = 7 * sizeof(gchar);
|
||||
static const size_t PATH_LENGTH_BYTES = sizeof(gchar) * (PATH_MAX + 1);
|
||||
|
||||
extern int errno;
|
||||
|
||||
/* 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;
|
||||
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 */
|
||||
|
@ -27,8 +78,6 @@ fsl_get_file_items (NautilusMenuProvider * provider,
|
|||
{
|
||||
TRACE();
|
||||
|
||||
NautilusMenuItem *item;
|
||||
|
||||
// Number of files = g_list_length(files)
|
||||
// Directory = nautilus_file_info_is_directory(files->data)
|
||||
|
||||
|
@ -37,47 +86,18 @@ fsl_get_file_items (NautilusMenuProvider * provider,
|
|||
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);
|
||||
/*
|
||||
* 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) {
|
||||
FSL_LOG( "Not 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;
|
||||
// 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)
|
||||
|
@ -132,8 +152,14 @@ fsl_menu_item_new(GdkScreen *screen, gboolean is_file_item)
|
|||
const char *name;
|
||||
const char *tooltip;
|
||||
|
||||
name = _("Follow symbolic _link");
|
||||
tooltip = _("Open the directory pointed by the currently selected symbolic link");
|
||||
if (is_file_item) {
|
||||
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)
|
||||
ret = nautilus_menu_item_new("FsymlinkExtension::follow_symlink",
|
||||
|
|
|
@ -6,17 +6,27 @@
|
|||
* its core functionality
|
||||
*/
|
||||
|
||||
#include "common.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 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
|
||||
* Here the namespace is a bit more explicit just in case
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
#include "nautilus-ext-follow-symlink.h"
|
||||
|
||||
#include <locale.h>
|
||||
#include <libintl.h>
|
||||
|
||||
#include <glib/gprintf.h>
|
||||
|
||||
/* Public interface */
|
||||
static GType fsl_type;
|
||||
static GType provider_types[1];
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
#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 "common.h"
|
||||
#include <locale.h>
|
||||
#include <libintl.h>
|
||||
|
||||
#include <glib/gprintf.h>
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
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: */
|
||||
|
|
Loading…
Reference in New Issue