diff --git a/com.github.ADBeveridge.Raider.json b/com.github.ADBeveridge.Raider.json index b7fff72..d72949a 100644 --- a/com.github.ADBeveridge.Raider.json +++ b/com.github.ADBeveridge.Raider.json @@ -1,7 +1,7 @@ { "app-id" : "com.github.ADBeveridge.Raider", "runtime" : "org.gnome.Platform", - "runtime-version" : "46", + "runtime-version" : "47", "sdk" : "org.gnome.Sdk", "command" : "raider", "finish-args" : [ diff --git a/data/com.github.ADBeveridge.Raider.metainfo.xml.in.in b/data/com.github.ADBeveridge.Raider.metainfo.xml.in.in index bce7899..1267079 100644 --- a/data/com.github.ADBeveridge.Raider.metainfo.xml.in.in +++ b/data/com.github.ADBeveridge.Raider.metainfo.xml.in.in @@ -53,6 +53,16 @@ #5c0012 + + +

Update for GNOME 47

+
    +
  • Includes new file picker
  • +
  • Halve shredding time by using more sensible iteration count
  • +
  • Update Occitan, Slovenian and Italian translations
  • +
+
+

Improve icons and branding

diff --git a/src/corrupt.c b/src/corrupt.c index 00920f5..ccd88fa 100644 --- a/src/corrupt.c +++ b/src/corrupt.c @@ -21,11 +21,9 @@ #include #include "corrupt.h" +// The size of this array is how many times the file will be overwritten. const char* steps[] = {"\x77\x77\x77", "\x76\x76\x76", - "\x33\x33\x33", "\x35\x35\x35", - "\x55\x55\x55", "\xAA\xAA\xAA", - "\x44\x44\x44", "\x55\x55\x55", - "\x66\x66\x66", "\x77\x77\x77"}; + "\x33\x33\x33", "\x35\x35\x35", "\x55\x55\x55"}; struct _RaiderCorrupt { @@ -67,6 +65,17 @@ RaiderCorrupt *raider_corrupt_new(GFile* file, RaiderFileRow* row) return corrupt; } +GCancellable* raider_corrupt_start_shredding(RaiderCorrupt* self, GAsyncReadyCallback func) +{ + self->cancel = g_cancellable_new(); + self->task = g_task_new(self, self->cancel, func, NULL); + g_task_set_task_data (self->task, self->row, NULL); + g_task_run_in_thread(self->task, shredding_thread); + g_object_unref(self->task); + + return self->cancel; +} + void shredding_thread (GTask *task, gpointer source_object, gpointer task_data, GCancellable *cancellable) { RaiderCorrupt* corrupt = RAIDER_CORRUPT(source_object); @@ -84,39 +93,6 @@ void shredding_thread (GTask *task, gpointer source_object, gpointer task_data, } } -GCancellable* raider_corrupt_start_shredding(RaiderCorrupt* self, GAsyncReadyCallback func) -{ - self->cancel = g_cancellable_new(); - self->task = g_task_new(self, self->cancel, func, NULL); - g_task_set_task_data (self->task, self->row, NULL); - g_task_run_in_thread(self->task, shredding_thread); - g_object_unref(self->task); - - return self->cancel; -} - -/* Your standard recursive file listing algorithm. */ -static void list_files(const char *directory, GPtrArray* files) { - const gchar *file_name; - - GDir *dir = g_dir_open(directory, 0, NULL); - if (dir != NULL) { - while ((file_name = g_dir_read_name(dir)) != NULL) { - gchar *file_path = g_build_filename(directory, file_name, NULL); - // If it is another directory, recurse. - if (g_file_test(file_path, G_FILE_TEST_IS_DIR)) { - // Make sure it is not the current or parent directories. - if (strcmp(file_name, ".") != 0 && strcmp(file_name, "..") != 0) { - list_files(file_path, files); - } - } else { - g_ptr_array_add(files, file_path); - } - } - g_dir_close(dir); - } -} - int corrupt_folder(RaiderCorrupt* corrupt) { char* folder = g_file_get_path(corrupt->file); @@ -169,13 +145,13 @@ uint8_t corrupt_file(RaiderCorrupt* corrupt) raider_file_row_set_progress_num(corrupt->row, corrupt->progress); g_main_context_invoke (NULL, raider_file_row_set_progress, corrupt->row); - // Shred the file by overwriting it many times. off_t filesize = corrupt_check_file(filename); if (filesize == -1) { return -1; } + // Shred the file by overwriting it many times. uint8_t i; for (i = 0; i < steps_num; i++) { @@ -221,30 +197,6 @@ static uint8_t corrupt_step(GTask* task, const char* filename, const off_t files return ret; } -off_t corrupt_check_file(const char *filename) -{ - struct stat st; - - // Run some checks on the file. - if(lstat(filename, &st) != 0) - { - fprintf(stderr, "corrupt: current file not found\n"); - return -1; - } - if (S_ISLNK(st.st_mode) == 1) - { - /* Quietly deal with symbolic links. */ - corrupt_unlink_file(filename); - return -1; - } - if (S_ISREG(st.st_mode) == 0) - { - fprintf(stderr, "corrupt: current file is not a regular file\n"); - return -1; - } - return st.st_size; -} - uint8_t corrupt_unlink_file(const char *filename) { uint8_t ret = 0; @@ -289,3 +241,49 @@ uint8_t corrupt_unlink_folder(const char *directory) return 0; } + +off_t corrupt_check_file(const char *filename) +{ + struct stat st; + + // Run some checks on the file. + if(lstat(filename, &st) != 0) + { + fprintf(stderr, "corrupt: current file not found\n"); + return -1; + } + if (S_ISLNK(st.st_mode) == 1) + { + /* Quietly deal with symbolic links. */ + corrupt_unlink_file(filename); + return -1; + } + if (S_ISREG(st.st_mode) == 0) + { + fprintf(stderr, "corrupt: current file is not a regular file\n"); + return -1; + } + return st.st_size; +} + +// Standard directory scanner. +static void list_files(const char *directory, GPtrArray* files) { + const gchar *file_name; + + GDir *dir = g_dir_open(directory, 0, NULL); + if (dir != NULL) { + while ((file_name = g_dir_read_name(dir)) != NULL) { + gchar *file_path = g_build_filename(directory, file_name, NULL); + // If it is another directory, recurse. + if (g_file_test(file_path, G_FILE_TEST_IS_DIR)) { + // Make sure it is not the current or parent directories. + if (strcmp(file_name, ".") != 0 && strcmp(file_name, "..") != 0) { + list_files(file_path, files); + } + } else { + g_ptr_array_add(files, file_path); + } + } + g_dir_close(dir); + } +} diff --git a/src/raider-progress-info-popover.c b/src/raider-progress-info-popover.c index a65677d..fdfa319 100644 --- a/src/raider-progress-info-popover.c +++ b/src/raider-progress-info-popover.c @@ -53,7 +53,7 @@ void raider_progress_info_popover_set_progress(RaiderProgressInfoPopover *popove if (percentage == 0) { gtk_progress_bar_set_text(GTK_PROGRESS_BAR(popover->progress_bar), _("Starting…")); - gtk_progress_bar_pulse(GTK_PROGRESS_BAR(popover->progress_bar)); + gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(popover->progress_bar), 1); } else if (percentage < 100) { @@ -72,6 +72,6 @@ void raider_progress_info_popover_set_progress(RaiderProgressInfoPopover *popove /* This is used when the spinner is shown instead of the progress icon. */ void raider_progress_info_popover_pulse(RaiderProgressInfoPopover *popover) { - gtk_progress_bar_set_text(GTK_PROGRESS_BAR(popover->progress_bar), _("Estimating...")); + gtk_progress_bar_set_text(GTK_PROGRESS_BAR(popover->progress_bar), _("Estimating…")); gtk_progress_bar_pulse(GTK_PROGRESS_BAR(popover->progress_bar)); }