Subversion Repositories pub

Compare Revisions

Ignore whitespace Rev 31 → Rev 32

/nautilus-follow-symlink/trunk/src/follow-symlink.c
83,7 → 83,7
}
 
GList *
fsl_get_background_items(NautilusMenuProvider * provider __unused,
fsl_get_background_items(NautilusMenuProvider * provider __UNUSED,
GtkWidget * window,
NautilusFileInfo * current_folder)
{
113,7 → 113,7
*
*
*/
GList * fsl_get_file_items (NautilusMenuProvider * provider __unused,
GList * fsl_get_file_items (NautilusMenuProvider * provider __UNUSED,
GtkWidget * window,
GList * files)
{
155,7 → 155,7
*
* file_info: The symbolic link
*/
void fsl_callback (NautilusMenuItem * item __unused, NautilusFileInfo * file_info)
void fsl_callback (NautilusMenuItem * item __UNUSED, NautilusFileInfo * file_info)
{
TRACE();
 
205,9 → 205,9
* over a (opened) folder
* base_name: file name, without path, of the given file
*/
NautilusMenuItem * fsl_menu_item_new(GdkScreen *screen __unused,
NautilusMenuItem * fsl_menu_item_new(GdkScreen *screen __UNUSED,
gboolean is_file_item,
const gchar * base_name)
const gchar * a_base_name)
{
TRACE();
 
224,6 → 224,40
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
231,8 → 265,8
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, base_name) );
unique_name = g_try_malloc( printf_string_upper_bound(ITEM_NAME_FMT, 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) {
255,12 → 289,15
}
 
g_sprintf(name, fmt_name, base_name);
g_sprintf(tooltip, fmt_tooltip, base_name);
g_sprintf(unique_name, ITEM_NAME_FMT, 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);
/nautilus-follow-symlink/trunk/src/nautilus-ext-follow-symlink.c
38,7 → 38,7
bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR);
textdomain(GETTEXT_PACKAGE);
 
g_printf("Initializing nautilus-follow-symlink extension (v.%s)\n", VERSION);
g_printf("Initializing nautilus-follow-symlink extension (v%s)\n", VERSION);
 
fsl_register_type(module);
# if 0
/nautilus-follow-symlink/trunk/src/common.h
66,7 → 66,8
#define __must_check __attribute__((warn_unused_result))
#define __deprecated __attribute__((deprecated))
#define __used __attribute__((used))
#define __unused __attribute__((unused))
// __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)
86,7 → 87,7
#define __must_check /* no warn_unused_result */
#define __deprecated /* no deprecated */
#define __used /* no used */
#define __unused /* no unused */
#define __UNUSED /* no unused */
#define __packed /* no packed */
#define likely(x) (x)
#define unlikely(x) (x)
150,7 → 151,7
* 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,
static inline void __UNUSED FSL_LOG_WITH_LEVEL_IMPL(int level,
gchar * const format,
va_list ap)
{
164,7 → 165,7
* 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,
static void __UNUSED __va_fprintf FSL_LOG_WITH_LEVEL(int level,
gchar * const format,
...)
{
180,7 → 181,7
*
* NOTE: Variadic functions can't be inlined
*/
static void __unused __va_printf FSL_LOG(gchar * const format, ...)
static void __UNUSED __va_printf FSL_LOG(gchar * const format, ...)
{
va_list ap;
va_start(ap, format);
194,7 → 195,7
*
* NOTE: Variadic functions can't be inlined
*/
static void __unused __va_fprintf FSL_LOG_COND(int cond, gchar * const format, ...)
static void __UNUSED __va_fprintf FSL_LOG_COND(int cond, gchar * const format, ...)
{
if (cond) {
va_list ap;