diff options
Diffstat (limited to 'xattr-tags')
-rw-r--r-- | xattr-tags/Makefile.am | 4 | ||||
-rw-r--r-- | xattr-tags/caja-xattr-tags-extension.c | 48 | ||||
-rw-r--r-- | xattr-tags/caja-xattr-tags-extension.h | 1 | ||||
-rw-r--r-- | xattr-tags/libcaja-xattr-tags.caja-extension.desktop.in.in | 4 |
4 files changed, 44 insertions, 13 deletions
diff --git a/xattr-tags/Makefile.am b/xattr-tags/Makefile.am index 51e3f59..c593203 100644 --- a/xattr-tags/Makefile.am +++ b/xattr-tags/Makefile.am @@ -34,7 +34,11 @@ extensiondir = $(datadir)/caja/extensions extension_in_files = libcaja-xattr-tags.caja-extension.desktop.in extension_DATA = $(extension_in_files:.caja-extension.desktop.in=.caja-extension) $(extension_DATA): $(extension_in_files) +if USE_NLS $(AM_V_GEN) $(MSGFMT) --desktop --keyword= --keyword=Copyright --keyword=Name --keyword=Description --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) cp $< $@ +endif CLEANFILES = $(extension_DATA) diff --git a/xattr-tags/caja-xattr-tags-extension.c b/xattr-tags/caja-xattr-tags-extension.c index eb4eec3..cc420c7 100644 --- a/xattr-tags/caja-xattr-tags-extension.c +++ b/xattr-tags/caja-xattr-tags-extension.c @@ -2,6 +2,7 @@ * Caja xattr tags extension * * Copyright (C) 2016 Felipe Barriga Richards + * Copyright (C) 2016-2021 MATE developers. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,13 +21,19 @@ * Authors: Felipe Barriga Richards <[email protected]> */ +#ifdef HAVE_CONFIG_H #include <config.h> +#endif + +#include <glib/gi18n-lib.h> + #include <string.h> #include <gio/gio.h> -#include <glib/gi18n-lib.h> + #include <libcaja-extension/caja-file-info.h> #include <libcaja-extension/caja-info-provider.h> #include <libcaja-extension/caja-column-provider.h> + #include "caja-xattr-tags-extension.h" #define XATTR_TAGS_NAME "Xattr::Tags" @@ -43,6 +50,16 @@ typedef struct { GClosure *update_complete; } CajaXattrTagsHandle; +/* List of protocols that don't support xattr retriving, + * so we can skip it safetely + */ +static gchar *protocols_blacklist[] = { + "mtp://", + "gphoto2://", + + NULL +}; + /* Stolen code: why they didn't expose it!? * file: glocalfileinfo.c * function: hex_unescape_string @@ -100,8 +117,21 @@ static gchar *caja_xattr_tags_get_xdg_tags(CajaFileInfo *file) gchar *tags = NULL, *uri; GFile *location; GFileInfo *info; + int i; uri = caja_file_info_get_activation_uri (file); + for (i = 0 ; protocols_blacklist[i] ; i++) { + int l = strlen(protocols_blacklist[i]); + + if (strlen(uri) < l) + continue; + if (strncasecmp(uri, protocols_blacklist[i], l)) + continue; + + g_free (uri); + return NULL; + } + location = g_file_new_for_uri (uri); info = g_file_query_info (location, G_FILE_ATTRIBUTE_XATTR_XDG_TAGS, @@ -147,7 +177,6 @@ caja_xattr_tags_update_file_info(CajaInfoProvider *provider, return CAJA_OPERATION_COMPLETE; } - static void caja_xattr_tags_cancel_update(CajaInfoProvider *provider, CajaOperationHandle *handle) @@ -165,7 +194,6 @@ caja_xattr_tags_info_provider_iface_init(CajaInfoProviderIface *iface) iface->cancel_update = caja_xattr_tags_cancel_update; } - static GList * caja_xattr_tags_get_columns(CajaColumnProvider *provider) { @@ -187,30 +215,25 @@ caja_xattr_tags_column_provider_iface_init(CajaColumnProviderIface *iface) iface->get_columns = caja_xattr_tags_get_columns; } - static void caja_xattr_tags_instance_init(CajaXattrTags *cajaXattrTags) { } - static void caja_xattr_tags_class_init(CajaXattrTagsClass *class) { parent_class = g_type_class_peek_parent (class); } - static GType caja_xattr_tags_type = 0; - GType caja_xattr_tags_get_type(void) { return caja_xattr_tags_type; } - void caja_xattr_tags_register_type(GTypeModule *module) { @@ -224,9 +247,9 @@ caja_xattr_tags_register_type(GTypeModule *module) sizeof (CajaXattrTags), 0, (GInstanceInitFunc) caja_xattr_tags_instance_init, + NULL }; - caja_xattr_tags_type = g_type_module_register_type (module, G_TYPE_OBJECT, "CajaXattrTags", @@ -249,7 +272,6 @@ caja_xattr_tags_register_type(GTypeModule *module) NULL }; - g_type_module_add_interface (module, CAJA_TYPE_XATTR_TAGS, CAJA_TYPE_COLUMN_PROVIDER, @@ -261,13 +283,17 @@ void caja_module_initialize (GTypeModule *module) { g_print ("Initializing caja-xattr-tags extension\n"); - caja_xattr_tags_register_type (module); +#ifdef ENABLE_NLS + bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +#endif /* ENABLE_NLS */ } void caja_module_shutdown (void) { + g_print ("Shutting down caja-xattr-tags extension\n"); } /* List all the extension types. */ diff --git a/xattr-tags/caja-xattr-tags-extension.h b/xattr-tags/caja-xattr-tags-extension.h index 3225ad1..2386ec1 100644 --- a/xattr-tags/caja-xattr-tags-extension.h +++ b/xattr-tags/caja-xattr-tags-extension.h @@ -2,6 +2,7 @@ * Caja xattr tags extension * * Copyright (C) 2016 Felipe Barriga Richards + * Copyright (C) 2016-2021 MATE developers. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/xattr-tags/libcaja-xattr-tags.caja-extension.desktop.in.in b/xattr-tags/libcaja-xattr-tags.caja-extension.desktop.in.in index 5574263..eb5986a 100644 --- a/xattr-tags/libcaja-xattr-tags.caja-extension.desktop.in.in +++ b/xattr-tags/libcaja-xattr-tags.caja-extension.desktop.in.in @@ -4,6 +4,6 @@ Icon=desktop Name=xattr Tags Description=View tags stored in extended attributes Author=Felipe Barriga Richards -Copyright=Copyright (C) 2016 Felipe Barriga Richards +Copyright=Copyright (C) 2016 Felipe Barriga Richards\nCopyright (C) 2017-2021 MATE developers Version=@VERSION@ -Website=https://mate-desktop.org/ +Website=@PACKAGE_URL@ |