From 08ff6be93f75edc4c93f5a8bfa5dab88b2422c41 Mon Sep 17 00:00:00 2001 From: madmurphy Date: Mon, 26 Apr 2021 18:23:08 +0200 Subject: [PATCH] Commit #2 --- ChangeLog | 8 ++++++ NEWS | 1 + README | 21 ++++++++------- configure.ac | 2 +- package.json | 2 +- po/it.po | 58 ++++++++++++++++++++++----------------- src/nautilus-hide.c | 66 ++++++++++++++++++++++----------------------- 7 files changed, 88 insertions(+), 70 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3e6708f..c397706 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,14 @@ Change Log ========== +## 0.1.1 (2021-04-26) + +Changes: + +* Translatable strings have changed +* Package review + + ## 0.1.0 (2021-04-25) **Nautilus Hide** has been published. diff --git a/NEWS b/NEWS index b2c8b72..fa9a8f0 100644 --- a/NEWS +++ b/NEWS @@ -5,3 +5,4 @@ NEWS ## 0.1.0 **Nautilus Hide** has been published. + diff --git a/README b/README index 438da77..75f6287 100644 --- a/README +++ b/README @@ -10,11 +10,12 @@ Details **Nautilus Hide** does not add a leading dot to file names, but relies on Nautilus' ability to hide the files that are listed in a `.hidden` file (to be -found in the same directory). The extension erases the `.hidden` files when -empty and is able to handle selections of files that are distributed across -multiple locations. +found in the same directory). -If a file is not immediately hidden/unhidden, press `F5` or `Ctrl` + `R` to +The extension erases the `.hidden` files when these are empty and is able to +handle selections of files that are distributed across multiple locations. + +If a file is not immediately hidden/unhidden, press `Ctrl` + `R` or `F5` to refresh the viewport. @@ -28,13 +29,13 @@ Let's say you want to create a Dutch translation of **Nautilus Hide**. This package comes with only a bunch of strings to translate, whose most important ones are: -1. “Hide” -2. “Hide the selected files” -3. “Unhide” -4. “Unhide the selected files” +1. “Hide file(s)” +2. “Hide the selected file(s)” +3. “Unhide file(s)” +4. “Unhide the selected file(s)” -Other strings are only debug messages sent to the standard error stream and can -be left untraslated. +Other translatable strings are only debug messages sent to the standard error +stream and can be left untraslated. First thing to do is to make sure that `gettext` and `intltool` are installed on your system. Then clone this repository and launch the following four diff --git a/configure.ac b/configure.ac index 9225f2d..01193c5 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ dnl *************************************************************************** AC_PREREQ([2.69]) AC_INIT([Nautilus Hide], - [0.1.0], + [0.1.1], [madmurphy333@gmail.com], [nautilus-hide], [https://gitlab.gnome.org/madmurphy/nautilus-hide]) diff --git a/package.json b/package.json index b1f3515..a52e32c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nautilus-hide", - "version": "0.1.0", + "version": "0.1.1", "description": "A simple Nautilus extension that adds \"Hide\" and \"Unhide\" to Nautilus right-click menu", "homepage": "https://gitlab.gnome.org/madmurphy/nautilus-hide", "author": "madmurphy333@gmail.com", diff --git a/po/it.po b/po/it.po index f977bf7..3a45726 100644 --- a/po/it.po +++ b/po/it.po @@ -5,10 +5,10 @@ # msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" +"Project-Id-Version: 0.1.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-04-24 10:15+0200\n" -"PO-Revision-Date: 2021-04-24 10:16+0200\n" +"POT-Creation-Date: 2021-04-26 18:05+0200\n" +"PO-Revision-Date: 2021-04-26 18:05+0200\n" "Last-Translator: FULL NAME \n" "Language-Team: Italian \n" "Language: it\n" @@ -17,33 +17,33 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: ../src/nautilus-hide.c:91 +#: ../src/nautilus-hide.c:96 msgid "Could not close the database of hidden files" msgstr "Impossibile chiudere il database dei file nascosti" -#: ../src/nautilus-hide.c:111 ../src/nautilus-hide.c:128 -#: ../src/nautilus-hide.c:142 ../src/nautilus-hide.c:200 -#: ../src/nautilus-hide.c:251 ../src/nautilus-hide.c:303 +#: ../src/nautilus-hide.c:116 ../src/nautilus-hide.c:133 +#: ../src/nautilus-hide.c:147 ../src/nautilus-hide.c:205 +#: ../src/nautilus-hide.c:256 ../src/nautilus-hide.c:308 msgid "Error allocating memory" msgstr "Errore nell'allocare memoria" -#: ../src/nautilus-hide.c:174 -msgid "Database of hidden files is not seekable" -msgstr "Impossibile lanciare seek sul database dei file nascosti" +#: ../src/nautilus-hide.c:179 +msgid "Could not calculate the size of the database of hidden files" +msgstr "Impossibile calcolare le dimensioni del database dei file nascosti" -#: ../src/nautilus-hide.c:186 +#: ../src/nautilus-hide.c:191 msgid "Database of hidden files is too big" msgstr "Il database dei file nascosti è troppo grande" -#: ../src/nautilus-hide.c:214 +#: ../src/nautilus-hide.c:219 msgid "I/O error while accessing database of hidden files" msgstr "Errore I/O nell'accedere al database dei file nascosti" -#: ../src/nautilus-hide.c:391 +#: ../src/nautilus-hide.c:390 msgid "No files were selected to be hidden" msgstr "Non ci sono file selezionati da nascondere" -#: ../src/nautilus-hide.c:405 +#: ../src/nautilus-hide.c:404 msgid "" "Could not hide the selected files, error attempting to group them according " "to their parent directories" @@ -51,18 +51,18 @@ msgstr "" "Impossibile nascondere i file selezionati, errore nel tentativo di " "raggrupparli in base alla loro directory di appartenenza" -#: ../src/nautilus-hide.c:433 +#: ../src/nautilus-hide.c:432 msgid "" "Could not hide the selected files, error attempting to edit the database" msgstr "" "Impossibile nascondere i file selezionati, errore nel tentativo di " "modificare il database" -#: ../src/nautilus-hide.c:550 +#: ../src/nautilus-hide.c:549 msgid "No files were selected to be unhidden" msgstr "Non ci sono file selezionati da rendere visibili" -#: ../src/nautilus-hide.c:564 +#: ../src/nautilus-hide.c:563 msgid "" "Could not unhide the selected files, error attempting to group them " "according to their parent directories" @@ -70,7 +70,7 @@ msgstr "" "Impossibile rendere visibili i file selezionati, errore nel tentativo di " "raggrupparli in base alla loro directory di appartenenza" -#: ../src/nautilus-hide.c:605 +#: ../src/nautilus-hide.c:604 msgid "" "Could not unhide the selected files, error attempting to edit the database" msgstr "" @@ -78,17 +78,25 @@ msgstr "" "modificare il database" #: ../src/nautilus-hide.c:835 -msgid "Hide" -msgstr "Nascondi" +msgid "_Hide file" +msgid_plural "_Hide files" +msgstr[0] "_Nascondi" +msgstr[1] "_Nascondi i file" #: ../src/nautilus-hide.c:836 -msgid "Hide the selected files" -msgstr "Nascondi i file selezionati" +msgid "Hide the selected file" +msgid_plural "Hide the selected files" +msgstr[0] "Nascondi il file selezionato" +msgstr[1] "Nascondi i file selezionati" #: ../src/nautilus-hide.c:863 -msgid "Unhide" -msgstr "Ripristina visibilità" +msgid "_Unhide file" +msgid_plural "_Unhide files" +msgstr[0] "Ripristina _visibilità" +msgstr[1] "Ripristina _visibilità dei file" #: ../src/nautilus-hide.c:864 msgid "Unhide the selected files" -msgstr "Rendi visibili i file selezionati" +msgid_plural "Unhide the selected files" +msgstr[0] "Rendi visibile il file selezionato" +msgstr[1] "Rendi visibili i file selezionati" diff --git a/src/nautilus-hide.c b/src/nautilus-hide.c index 87a79c6..4fe341e 100644 --- a/src/nautilus-hide.c +++ b/src/nautilus-hide.c @@ -2,22 +2,22 @@ /*\ |*| -|*| nautilus-hide.c +|*| nautilus-hide.c |*| -|*| Copyright (C) 2021 +|*| Copyright (C) 2021 |*| -|*| nautilus-hide is free software: you can redistribute it and/or modify it -|*| under the terms of the GNU General Public License as published by the Free -|*| Software Foundation, either version 3 of the License, or (at your option) +|*| nautilus-hide is free software: you can redistribute it and/or modify it +|*| under the terms of the GNU General Public License as published by the Free +|*| Software Foundation, either version 3 of the License, or (at your option) |*| any later version. |*| -|*| nautilus-hide is distributed in the hope that it will be useful, but -|*| WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +|*| nautilus-hide is distributed in the hope that it will be useful, but +|*| WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |*| or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |*| more details. |*| -|*| You should have received a copy of the GNU General Public License along -|*| with this program. If not, see . +|*| You should have received a copy of the GNU General Public License along +|*| with this program. If not, see . |*| \*/ @@ -35,9 +35,14 @@ #include #ifdef ENABLE_NLS +#include #include +#define __(STRING_S, STRING_PL, NUM) ((char *) \ + dngettext(GETTEXT_PACKAGE, STRING_S, STRING_PL, NUM)) #else -#define _(STRING) STRING +#define _(STRING) ((char *) (STRING)) +#define g_dngettext(DOMAIN, STRING1, STRING2, NUM) \ + ((NUM) > 1 ? (char *) (STRING2) : (char *) (STRING1)) #endif @@ -171,7 +176,7 @@ static ssofwcp * ssofwcp_new_with_dir ( fprintf( stderr, "Nautilus Hide: %s\n", - _("Database of hidden files is not seekable") + _("Could not calculate the size of the database of hidden files") ); close_hdb_file(hdb_file, new_ssofwcp->hdb_path); return new_ssofwcp; @@ -306,30 +311,24 @@ static GList * ordered_file_selection_new ( } - if (ordered_selection) { + for (d_iter = ordered_selection; d_iter; d_iter = d_iter->next) { - /* The ordered selection has already been partially populated */ + #define subselection ((ssofwcp *) d_iter->data) - for (d_iter = ordered_selection; d_iter; d_iter = d_iter->next) { + if (!strcmp(subselection->directory, dpath)) { - #define subselection ((ssofwcp *) d_iter->data) + /* The parent directory of this file had already been indicized */ - if (!strcmp(subselection->directory, dpath)) { - - /* The parent directory of this file had already been indicized */ - - subselection->selection = g_list_prepend( - subselection->selection, - s_iter->data - ); - goto free_and_continue; - - } - - #undef subselection + subselection->selection = g_list_prepend( + subselection->selection, + s_iter->data + ); + goto free_and_continue; } + #undef subselection + } /* The parent directory of this file has not been indicized yet */ @@ -722,6 +721,7 @@ static GList * nautilus_hide_get_file_items ( } + const unsigned int sel_len = g_list_length(file_selection); bool b_show_hide = false; bool b_show_unhide = false; size_t idx; @@ -832,8 +832,8 @@ static GList * nautilus_hide_get_file_items ( NautilusMenuItem * const menu_item_hide = nautilus_menu_item_new( "NautilusHide::hide", - _("Hide"), - _("Hide the selected files"), + g_dngettext(GETTEXT_PACKAGE, "_Hide file", "_Hide files", sel_len), + g_dngettext(GETTEXT_PACKAGE, "Hide the selected file", "Hide the selected files", sel_len), NULL /* icon name or `NULL` */ ); @@ -860,8 +860,8 @@ static GList * nautilus_hide_get_file_items ( NautilusMenuItem * const menu_item_unhide = nautilus_menu_item_new( "NautilusHide::unhide", - _("Unhide"), - _("Unhide the selected files"), + g_dngettext(GETTEXT_PACKAGE, "_Unhide file", "_Unhide files", sel_len), + g_dngettext(GETTEXT_PACKAGE, "Unhide the selected files", "Unhide the selected files", sel_len), NULL /* icon name or `NULL` */ ); @@ -962,7 +962,7 @@ void nautilus_module_list_types (const GType ** types, int * num_types) { } -/* NOTE: `ssofwcp` = Sub-Selection Of Files With Common Parent */ +/* NOTE: `ssofwcp` ==> Sub-Selection Of Files With Common Parent */ /* EOF */