aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-06-24 20:13:46 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-06-24 20:17:13 +0800
commitf1bad7677ab2928638f8705873d7ab599b6c99cd (patch)
tree3c1b194d88fcbc94a75a9352145155aafbc77d3f /widgets
parentbcdea3f01e0b614a0e366ee19c0ff6810e43b32d (diff)
downloadgsoc2013-evolution-f1bad7677ab2928638f8705873d7ab599b6c99cd.tar
gsoc2013-evolution-f1bad7677ab2928638f8705873d7ab599b6c99cd.tar.gz
gsoc2013-evolution-f1bad7677ab2928638f8705873d7ab599b6c99cd.tar.bz2
gsoc2013-evolution-f1bad7677ab2928638f8705873d7ab599b6c99cd.tar.lz
gsoc2013-evolution-f1bad7677ab2928638f8705873d7ab599b6c99cd.tar.xz
gsoc2013-evolution-f1bad7677ab2928638f8705873d7ab599b6c99cd.tar.zst
gsoc2013-evolution-f1bad7677ab2928638f8705873d7ab599b6c99cd.zip
Bug 622559 - Changing search option should focus search entry
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/e-hinted-entry.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/widgets/misc/e-hinted-entry.c b/widgets/misc/e-hinted-entry.c
index 51131cedcd..1d292a626c 100644
--- a/widgets/misc/e-hinted-entry.c
+++ b/widgets/misc/e-hinted-entry.c
@@ -39,18 +39,6 @@ enum {
static gpointer parent_class;
static void
-hinted_entry_hide_hint (EHintedEntry *entry)
-{
- entry->priv->hint_shown = FALSE;
-
- gtk_entry_set_text (GTK_ENTRY (entry), "");
-
- gtk_widget_modify_text (GTK_WIDGET (entry), GTK_STATE_NORMAL, NULL);
-
- g_object_notify (G_OBJECT (entry), "hint-shown");
-}
-
-static void
hinted_entry_show_hint (EHintedEntry *entry)
{
GtkStyle *style;
@@ -70,6 +58,19 @@ hinted_entry_show_hint (EHintedEntry *entry)
}
static void
+hinted_entry_show_text (EHintedEntry *entry,
+ const gchar *text)
+{
+ entry->priv->hint_shown = FALSE;
+
+ gtk_entry_set_text (GTK_ENTRY (entry), text);
+
+ gtk_widget_modify_text (GTK_WIDGET (entry), GTK_STATE_NORMAL, NULL);
+
+ g_object_notify (G_OBJECT (entry), "hint-shown");
+}
+
+static void
hinted_entry_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -129,7 +130,7 @@ hinted_entry_focus_in_event (GtkWidget *widget,
EHintedEntry *entry = E_HINTED_ENTRY (widget);
if (e_hinted_entry_get_hint_shown (entry))
- hinted_entry_hide_hint (entry);
+ hinted_entry_show_text (entry, "");
/* Chain up to parent's focus_in_event() method. */
return GTK_WIDGET_CLASS (parent_class)->
@@ -269,14 +270,16 @@ e_hinted_entry_get_hint_shown (EHintedEntry *entry)
const gchar *
e_hinted_entry_get_text (EHintedEntry *entry)
{
+ const gchar *text = "";
+
/* XXX This clumsily overrides gtk_entry_get_text(). */
g_return_val_if_fail (E_IS_HINTED_ENTRY (entry), NULL);
- if (e_hinted_entry_get_hint_shown (entry))
- return "";
+ if (!e_hinted_entry_get_hint_shown (entry))
+ text = gtk_entry_get_text (GTK_ENTRY (entry));
- return gtk_entry_get_text (GTK_ENTRY (entry));
+ return text;
}
void
@@ -292,8 +295,6 @@ e_hinted_entry_set_text (EHintedEntry *entry,
if (*text == '\0' && !gtk_widget_has_focus (GTK_WIDGET (entry)))
hinted_entry_show_hint (entry);
- else {
- hinted_entry_hide_hint (entry);
- gtk_entry_set_text (GTK_ENTRY (entry), text);
- }
+ else
+ hinted_entry_show_text (entry, text);
}