Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

clear digest when disabling func

  • Loading branch information...
commit 226b219f9d9028a592e1b8baa55de7f977cdc4d5 1 parent 3af60df
@tristanheaven authored
Showing with 25 additions and 1 deletion.
  1. +8 −0 src/nautilus/properties-list.c
  2. +17 −1 src/nautilus/properties.c
View
8 src/nautilus/properties-list.c
@@ -69,6 +69,14 @@ void gtkhash_properties_list_update_enabled(struct page_s *page, char *path_str)
enabled = !enabled;
gtk_list_store_set(store, &iter, COL_ENABLED, enabled, -1);
+ if (!enabled) {
+ // Clear digest for disabled func
+ gtkhash_hash_func_clear_digest(&page->hash_file.funcs[id]);
+ const char *digest = gtkhash_hash_func_get_digest(
+ &page->hash_file.funcs[id], DIGEST_FORMAT_HEX_LOWER);
+ gtk_list_store_set(store, &iter, COL_DIGEST, digest, -1);
+ }
+
page->hash_file.funcs[id].enabled = enabled;
}
View
18 src/nautilus/properties.c
@@ -66,13 +66,27 @@ static void gtkhash_properties_busy(struct page_s *page)
gtk_widget_show(GTK_WIDGET(page->progressbar));
}
+static void gtkhash_properties_button_hash_set_sensitive(struct page_s *page)
+{
+ bool has_enabled = false;
+
+ for (int i = 0; i < HASH_FUNCS_N; i++) {
+ if (page->hash_file.funcs[i].enabled) {
+ has_enabled = true;
+ break;
+ }
+ }
+
+ gtk_widget_set_sensitive(GTK_WIDGET(page->button_hash), has_enabled);
+}
+
void gtkhash_properties_idle(struct page_s *page)
{
gtk_widget_hide(GTK_WIDGET(page->progressbar));
gtk_widget_set_sensitive(GTK_WIDGET(page->treeview), true);
gtk_widget_set_sensitive(GTK_WIDGET(page->button_stop), false);
- gtk_widget_set_sensitive(GTK_WIDGET(page->button_hash), true);
+ gtkhash_properties_button_hash_set_sensitive(page);
gtkhash_properties_list_check_digests(page);
}
@@ -81,6 +95,8 @@ static void gtkhash_properties_on_cell_toggled(struct page_s *page,
char *path_str)
{
gtkhash_properties_list_update_enabled(page, path_str);
+ gtkhash_properties_list_check_digests(page);
+ gtkhash_properties_button_hash_set_sensitive(page);
}
static void gtkhash_properties_on_treeview_popup_menu(struct page_s *page)
Please sign in to comment.
Something went wrong with that request. Please try again.