diff --git a/ChangeLog b/ChangeLog index 5b73ad6..35ecb49 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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): diff --git a/Makefile.am b/Makefile.am index f64de7c..7a9b5bf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 \ diff --git a/configure.in b/configure.in index 526ade1..e4a705c 100644 --- a/configure.in +++ b/configure.in @@ -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 diff --git a/debian/changelog b/debian/changelog index 3e59688..10042e9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +nautilus-follow-symlink (0.7.0-out.1) unstable; urgency=low + + * New upstream release + + -- Toni Corvera Tue, 24 Oct 2006 21:30:10 +0200 + nautilus-follow-symlink (0.6.0-out.1) experimental; urgency=low * New upstream release diff --git a/dist b/dist index e3ec2fb..f963b38 100755 --- a/dist +++ b/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 diff --git a/po/ca.po b/po/ca.po index bfeec2b..ec81268 100644 --- a/po/ca.po +++ b/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 \n" "Language-Team: Catalan \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ç" diff --git a/po/es.po b/po/es.po index 33c93dd..b8e3277 100644 --- a/po/es.po +++ b/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 \n" "Language-Team: Spanish \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" diff --git a/po/libnautilus-follow-symlink.pot b/po/nautilus-follow-symlink.pot similarity index 69% rename from po/libnautilus-follow-symlink.pot rename to po/nautilus-follow-symlink.pot index 9e9b33d..71602b1 100644 --- a/po/libnautilus-follow-symlink.pot +++ b/po/nautilus-follow-symlink.pot @@ -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 \n" "Language-Team: LANGUAGE \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 "" diff --git a/src/common.h b/src/common.h index b2f3fe1..66364b4 100644 --- a/src/common.h +++ b/src/common.h @@ -9,6 +9,9 @@ #include /* g_print() */ #include /* g_printf() */ +#include /* getenv() (3) */ +#include /* 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 /* getenv() (3) */ - #include /* strcmp() (3) */ + /* Debugging facilities */ /* Prefix for messages */ #define FSL_ "nautilus-follow-symlink: " diff --git a/src/follow-symlink.c b/src/follow-symlink.c index 66ffad6..589557c 100644 --- a/src/follow-symlink.c +++ b/src/follow-symlink.c @@ -1,22 +1,73 @@ #include "follow-symlink.h" -#include -#include -#include /* errno (3) */ -#include /* realpath() (3) */ -#include /* 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", diff --git a/src/follow-symlink.h b/src/follow-symlink.h index 14dd750..5ec3056 100644 --- a/src/follow-symlink.h +++ b/src/follow-symlink.h @@ -6,17 +6,27 @@ * its core functionality */ +#include "common.h" + #include -#include "common.h" +#include +#include +#include /* errno (3) */ +#include /* realpath() (3) */ +#include /* 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 diff --git a/src/nautilus-ext-follow-symlink.c b/src/nautilus-ext-follow-symlink.c index a206d13..10146f4 100644 --- a/src/nautilus-ext-follow-symlink.c +++ b/src/nautilus-ext-follow-symlink.c @@ -1,10 +1,5 @@ #include "nautilus-ext-follow-symlink.h" -#include -#include - -#include - /* Public interface */ static GType fsl_type; static GType provider_types[1]; diff --git a/src/nautilus-ext-follow-symlink.h b/src/nautilus-ext-follow-symlink.h index e3702a6..3f31f63 100644 --- a/src/nautilus-ext-follow-symlink.h +++ b/src/nautilus-ext-follow-symlink.h @@ -1,10 +1,15 @@ #ifndef NAUTILUS_EXT_FOLLOW_SYMLINK_H #define NAUTILUS_EXT_FOLLOW_SYMLINK_H +#include "common.h" + #include #include -#include "common.h" +#include +#include + +#include /* * 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: */