diff options
author | Srinivasa Ragavan <sragavan@novell.com> | 2005-12-15 16:27:34 +0800 |
---|---|---|
committer | Srinivasa Ragavan <sragavan@src.gnome.org> | 2005-12-15 16:27:34 +0800 |
commit | 32f88d560f6f1789b4dd740327e8765c893e5970 (patch) | |
tree | f290cb109780cb64c1f1e93db09358388b2964d9 /widgets | |
parent | a95828f5d08145384fcbe7df4c2dccae3e5adee4 (diff) | |
download | gsoc2013-evolution-32f88d560f6f1789b4dd740327e8765c893e5970.tar gsoc2013-evolution-32f88d560f6f1789b4dd740327e8765c893e5970.tar.gz gsoc2013-evolution-32f88d560f6f1789b4dd740327e8765c893e5970.tar.bz2 gsoc2013-evolution-32f88d560f6f1789b4dd740327e8765c893e5970.tar.lz gsoc2013-evolution-32f88d560f6f1789b4dd740327e8765c893e5970.tar.xz gsoc2013-evolution-32f88d560f6f1789b4dd740327e8765c893e5970.tar.zst gsoc2013-evolution-32f88d560f6f1789b4dd740327e8765c893e5970.zip |
Added a visual cue to search bar to indicate search filter active.
2005-12-15 Srinivasa Ragavan <sragavan@novell.com>
* Added a visual cue to search bar to indicate search filter
active.
svn path=/trunk/; revision=30781
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/misc/ChangeLog | 8 | ||||
-rw-r--r-- | widgets/misc/e-filter-bar.c | 27 | ||||
-rw-r--r-- | widgets/misc/e-search-bar.c | 26 |
3 files changed, 60 insertions, 1 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index aada93196d..b2b2152422 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,11 @@ +2005-12-15 Srinivasa Ragavan <sragavan@novell.com> + + * e-filter-bar.c: (rule_advanced_response), (option_changed), + (set_property): Added code to Show color in search widget. + * e-search-bar.c: (entry_activated_cb), + (activate_button_clicked_cb), (clear_button_clicked_cb): Added + code to show color in search widget, when the filter is active. + 2005-11-24 Tor Lillqvist <tml@novell.com> * e-dateedit.c diff --git a/widgets/misc/e-filter-bar.c b/widgets/misc/e-filter-bar.c index f9d4d24ab1..9dc6501ff8 100644 --- a/widgets/misc/e-filter-bar.c +++ b/widgets/misc/e-filter-bar.c @@ -107,18 +107,24 @@ static void rule_advanced_response (GtkWidget *dialog, int response, void *data) { EFilterBar *efb = data; + ESearchBar *esb = efb; FilterRule *rule; if (response == GTK_RESPONSE_OK || response == GTK_RESPONSE_APPLY) { rule = g_object_get_data ((GObject *) dialog, "rule"); if (rule) { + GtkStyle *style = gtk_widget_get_default_style (); + if (!filter_rule_validate (rule)) return; efb->current_query = rule; g_object_ref (rule); g_signal_emit_by_name (efb, "query_changed"); - + + gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED])); + gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, &(style->text[GTK_STATE_SELECTED])); + if (response == GTK_RESPONSE_APPLY) { if (!rule_context_find_rule (efb->context, rule->name, rule->source)) rule_context_add_rule (efb->context, rule); @@ -298,6 +304,11 @@ option_changed (ESearchBar *esb, void *data) } gtk_widget_set_sensitive (esb->entry, TRUE); } else { + GtkStyle *style = gtk_widget_get_default_style (); + + gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, NULL); + gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, NULL); + gtk_widget_set_sensitive (esb->entry, id == E_SEARCHBAR_CLEAR_ID); efb->current_query = NULL; } @@ -666,11 +677,17 @@ set_property (GObject *object, guint property_id, const GValue *value, GParamSpe FilterRule *rule = NULL; if ((node = node->children)) { + GtkStyle *style = gtk_widget_get_default_style (); + rule = filter_rule_new (); if (filter_rule_xml_decode (rule, node, efb->context) != 0) { + gtk_widget_modify_base (((ESearchBar *)efb)->entry, GTK_STATE_NORMAL, NULL); + gtk_widget_modify_text (((ESearchBar *)efb)->entry, GTK_STATE_NORMAL, NULL); g_object_unref (rule); rule = NULL; } else { + gtk_widget_modify_base (((ESearchBar *)efb)->entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED])); + gtk_widget_modify_text (((ESearchBar *)efb)->entry, GTK_STATE_NORMAL, &(style->text[GTK_STATE_SELECTED])); g_object_set_data_full (object, "rule", rule, (GDestroyNotify) g_object_unref); } } @@ -685,10 +702,18 @@ set_property (GObject *object, guint property_id, const GValue *value, GParamSpe } else if (!strcmp (node->name, "search-bar")) { int subitem_id, item_id; char *text; + GtkStyle *style = gtk_widget_get_default_style (); /* set the text first (it doesn't emit a signal) */ text = xmlGetProp (node, "text"); e_search_bar_set_text ((ESearchBar *) efb, text); + if (text && *text) { + gtk_widget_modify_base (((ESearchBar *)efb)->entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED])); + gtk_widget_modify_text (((ESearchBar *)efb)->entry, GTK_STATE_NORMAL, &(style->text[GTK_STATE_SELECTED])); + } else { + gtk_widget_modify_base (((ESearchBar *)efb)->entry, GTK_STATE_NORMAL, NULL); + gtk_widget_modify_text (((ESearchBar *)efb)->entry, GTK_STATE_NORMAL, NULL); + } xmlFree (text); /* now set the item_id and subitem_id */ diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c index bb74d311ca..5f322fd25a 100644 --- a/widgets/misc/e-search-bar.c +++ b/widgets/misc/e-search-bar.c @@ -259,6 +259,17 @@ static void entry_activated_cb (GtkWidget *widget, ESearchBar *esb) { + const char *text = gtk_entry_get_text (esb->entry); + GtkStyle *style = gtk_widget_get_default_style (); + + if (text && *text) { + gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED])); + gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, &(style->text[GTK_STATE_SELECTED])); + } else { + gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, NULL); + gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, NULL); + } + emit_search_activated (esb); } @@ -450,6 +461,16 @@ static void activate_button_clicked_cb (GtkWidget *widget, ESearchBar *esb) { + const char *text = gtk_entry_get_text (esb->entry); + GtkStyle *style = gtk_widget_get_default_style (); + + if (text && *text) { + gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED])); + gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, &(style->text[GTK_STATE_SELECTED])); + } else { + gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, NULL); + gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, NULL); + } emit_search_activated (esb); gtk_widget_grab_focus (esb->entry); @@ -459,6 +480,11 @@ static void clear_button_clicked_cb (GtkWidget *widget, ESearchBar *esb) { + GtkStyle *style = gtk_widget_get_default_style (); + + gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, NULL); + gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, NULL); + clear_search (esb); gtk_widget_grab_focus (esb->entry); |