From 9089bddf2c22ade63b5591764c715e5e216020f6 Mon Sep 17 00:00:00 2001 From: piernov Date: Mon, 17 Jun 2024 22:20:51 +0200 Subject: [PATCH 1/3] clone_gui.c: fix some GTK type casts --- src/opensuperclone/clone_gui.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/opensuperclone/clone_gui.c b/src/opensuperclone/clone_gui.c index e504288..fd84949 100644 --- a/src/opensuperclone/clone_gui.c +++ b/src/opensuperclone/clone_gui.c @@ -391,8 +391,8 @@ int start_gtk_ccc(int argc, char **argv, char *title, char *version) status_register_label = GTK_WIDGET(gtk_builder_get_object(builder, "status_register_label")); error_register_label = GTK_WIDGET(gtk_builder_get_object(builder, "error_register_label")); - gtk_label_set_text(status_register_label, _("Status Register")); - gtk_label_set_text(error_register_label, _("Error Register")); + gtk_label_set_text(GTK_LABEL(status_register_label), _("Status Register")); + gtk_label_set_text(GTK_LABEL(error_register_label), _("Error Register")); bsy_status_icon = GTK_WIDGET(gtk_builder_get_object(builder, "bsy_status_icon")); drdy_status_icon = GTK_WIDGET(gtk_builder_get_object(builder, "drdy_status_icon")); @@ -496,7 +496,7 @@ int start_gtk_ccc(int argc, char **argv, char *title, char *version) g_object_unref(builder); - gtk_window_set_default_size(main_window_ccc, 1150, 690); + gtk_window_set_default_size(GTK_WINDOW(main_window_ccc), 1150, 690); gtk_widget_show_all(main_window_ccc); gtk_main(); From b13233f9b7fa349ae3e963aadc37e506e020104a Mon Sep 17 00:00:00 2001 From: piernov Date: Mon, 17 Jun 2024 22:21:48 +0200 Subject: [PATCH 2/3] clone_gui.c: place disconnect_devices_ccc() before its call in connect_devices_ccc() --- src/opensuperclone/clone_gui.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/opensuperclone/clone_gui.c b/src/opensuperclone/clone_gui.c index fd84949..82716fc 100644 --- a/src/opensuperclone/clone_gui.c +++ b/src/opensuperclone/clone_gui.c @@ -1808,6 +1808,20 @@ void choose_null_ccc(void) } } +void disconnect_devices_ccc(void) +{ + release_devices_ccc(); + connected_ccc = 0; + // strcpy (tempmessage_ccc, _("Devices now disconnected")); + // message_error_ccc(tempmessage_ccc); + // print_gui_error_message_ccc(error_message_ccc, _("Success!"), 0); + // clear_error_message_ccc(); + set_disconnected_ccc(); + ata_status_ccc = 0; + ata_error_ccc = 0; + update_display_ccc(0); +} + void connect_devices_ccc(void) { // check if we're already connected @@ -2015,20 +2029,6 @@ gint display_status_update_action_ccc(gpointer data) return 1; } -void disconnect_devices_ccc(void) -{ - release_devices_ccc(); - connected_ccc = 0; - // strcpy (tempmessage_ccc, _("Devices now disconnected")); - // message_error_ccc(tempmessage_ccc); - // print_gui_error_message_ccc(error_message_ccc, _("Success!"), 0); - // clear_error_message_ccc(); - set_disconnected_ccc(); - ata_status_ccc = 0; - ata_error_ccc = 0; - update_display_ccc(0); -} - void set_connected_ccc(void) { if (driver_mode_ccc && (strcmp(disk_2_ccc, "/dev/null") == 0)) From d9fc7433360750aa5d8818a1e441616dca8b3fa7 Mon Sep 17 00:00:00 2001 From: piernov Date: Mon, 17 Jun 2024 22:22:38 +0200 Subject: [PATCH 3/3] Move get_smart_attribute_level_ccc() from opensuperclone.c to clone_gui.c since that's where it's used --- src/opensuperclone/clone_gui.c | 32 +++++++++++++++++++++++++++++ src/opensuperclone/opensuperclone.c | 32 ----------------------------- src/opensuperclone/opensuperclone.h | 2 -- 3 files changed, 32 insertions(+), 34 deletions(-) diff --git a/src/opensuperclone/clone_gui.c b/src/opensuperclone/clone_gui.c index 82716fc..49d7099 100644 --- a/src/opensuperclone/clone_gui.c +++ b/src/opensuperclone/clone_gui.c @@ -2869,6 +2869,38 @@ void display_analyze_results_ccc(void) gtk_widget_destroy(dialog); } +int get_smart_attribute_level_ccc(int id, long long value, int current, int worst, int threshold) +{ + int level = 0; + + switch (id) + { + // Reallocated Sectors Count + case 5: + // Current Pending Sectors + case 197: + if (value > 0) level = 2; + break; + + // Reported Uncorrectable Errors + case 187: + // Command Timeout + case 188: + // Off-line Uncorrectable + case 198: + // UDMA CRC Error Rate + case 199: + if (value > 0) level = 1; + break; + + default: + level = 0; + break; + } + + return level; +} + void get_smart_data_ccc(void) { stop_signal_ccc = false; diff --git a/src/opensuperclone/opensuperclone.c b/src/opensuperclone/opensuperclone.c index 1764037..b9c25b0 100644 --- a/src/opensuperclone/opensuperclone.c +++ b/src/opensuperclone/opensuperclone.c @@ -14591,38 +14591,6 @@ char *get_smart_attribute_name_ccc(int id) return message; } -int get_smart_attribute_level_ccc(int id, long long value, int current, int worst, int threshold) -{ - int level = 0; - - switch (id) - { - // Reallocated Sectors Count - case 5: - // Current Pending Sectors - case 197: - if (value > 0) level = 2; - break; - - // Reported Uncorrectable Errors - case 187: - // Command Timeout - case 188: - // Off-line Uncorrectable - case 198: - // UDMA CRC Error Rate - case 199: - if (value > 0) level = 1; - break; - - default: - level = 0; - break; - } - - return level; -} - long long block_align_ccc(long long value, int offset) { long long new_value = value / block_size_ccc; diff --git a/src/opensuperclone/opensuperclone.h b/src/opensuperclone/opensuperclone.h index c5546d7..daf1374 100644 --- a/src/opensuperclone/opensuperclone.h +++ b/src/opensuperclone/opensuperclone.h @@ -492,8 +492,6 @@ void test_skip_ccc(int size); char *get_smart_attribute_name_ccc(int id); -int get_smart_attribute_level_ccc(int id, long long value, int current, int worst, int threshold); - char *install_directory_ccc = OSC_INSTALL_PATH; bool path_fail_ccc = false; char start_working_directory_ccc[PATH_MAX];