[gnome-builder: 1/2] Change the search bar to an error state when no match is found.



commit 257f00b7231659f4d95553a9c8707d30368f34da
Author: Eduardo Grajeda <tatofoo gmail com>
Date:   Mon Sep 17 17:54:09 2018 -0300

    Change the search bar to an error state when no match is found.

 src/libide/editor/ide-editor-search-bar.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/libide/editor/ide-editor-search-bar.c b/src/libide/editor/ide-editor-search-bar.c
index 07d212d4c..5bdf40caf 100644
--- a/src/libide/editor/ide-editor-search-bar.c
+++ b/src/libide/editor/ide-editor-search-bar.c
@@ -289,6 +289,7 @@ static gboolean
 update_match_positions (gpointer user_data)
 {
   IdeEditorSearchBar *self = user_data;
+  GtkStyleContext *style;
   g_autofree gchar *str = NULL;
   guint count;
   guint pos;
@@ -323,6 +324,13 @@ update_match_positions (gpointer user_data)
       ide_tagged_entry_tag_set_label (self->search_entry_tag, str);
     }
 
+  style = gtk_widget_get_style_context (GTK_WIDGET(self->search_entry));
+
+  if (count == 0 && gtk_entry_get_text_length (GTK_ENTRY (self->search_entry)) > 0)
+    gtk_style_context_add_class (style, GTK_STYLE_CLASS_ERROR);
+  else
+    gtk_style_context_remove_class(style, GTK_STYLE_CLASS_ERROR);
+
   return G_SOURCE_REMOVE;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]