make the quicksearch clear button more active and useful
authorpaul <paul@claws-mail.org>
Tue, 29 Dec 2020 12:36:04 +0000 (12:36 +0000)
committerPaul <paul@claws-mail.org>
Wed, 30 Dec 2020 14:24:20 +0000 (14:24 +0000)
clear the search string when not running, clear the string and stop the search when running

src/gtk/quicksearch.c

index f79cbffe9ec387946bc0133a311bef641044ee11..10cfbf3b9e5839e2ca43c945ff9dd1c230348283 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2018 Colin Leroy and the Claws Mail team
+ * Copyright (C) 1999-2020 the Claws Mail team and Colin Leroy
  *
  * 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
@@ -549,9 +549,6 @@ static gboolean clear_search_cb(GtkMenuItem *widget, gpointer data)
 {
        QuickSearch *quicksearch = (QuickSearch *)data;
 
-       if (!quicksearch->active)
-               return TRUE;
-
        quicksearch_set(quicksearch, prefs_common.summary_quicksearch_type, "");
 
        return TRUE;
@@ -961,21 +958,19 @@ static void quicksearch_set_active(QuickSearch *quicksearch, gboolean active)
                error = TRUE;
 
        if (active) {
-               gtk_widget_set_sensitive(quicksearch->clear_search, TRUE);
-                       gtk_widget_modify_base(
-                               gtk_bin_get_child(GTK_BIN((quicksearch->search_string_entry))),
-                               GTK_STATE_NORMAL, error ? &qs_error_bgcolor : &qs_active_bgcolor);
-                       gtk_widget_modify_text(
-                               gtk_bin_get_child(GTK_BIN((quicksearch->search_string_entry))),
-                               GTK_STATE_NORMAL, error ? &qs_error_color : &qs_active_color);
+               gtk_widget_modify_base(
+                       gtk_bin_get_child(GTK_BIN((quicksearch->search_string_entry))),
+                       GTK_STATE_NORMAL, error ? &qs_error_bgcolor : &qs_active_bgcolor);
+               gtk_widget_modify_text(
+                       gtk_bin_get_child(GTK_BIN((quicksearch->search_string_entry))),
+                       GTK_STATE_NORMAL, error ? &qs_error_color : &qs_active_color);
        } else {
-               gtk_widget_set_sensitive(quicksearch->clear_search, FALSE);
-                       gtk_widget_modify_base(
-                               gtk_bin_get_child(GTK_BIN((quicksearch->search_string_entry))),
-                               GTK_STATE_NORMAL, NULL);
-                       gtk_widget_modify_text(
-                               gtk_bin_get_child(GTK_BIN((quicksearch->search_string_entry))),
-                               GTK_STATE_NORMAL, NULL);
+               gtk_widget_modify_base(
+                       gtk_bin_get_child(GTK_BIN((quicksearch->search_string_entry))),
+                       GTK_STATE_NORMAL, NULL);
+               gtk_widget_modify_text(
+                       gtk_bin_get_child(GTK_BIN((quicksearch->search_string_entry))),
+                       GTK_STATE_NORMAL, NULL);
        }
 
        if (!active) {