aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-06-25 08:41:19 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-06-25 08:42:09 +0800
commit54f6924c8410d18b8bcae7f2294db73301d21bfe (patch)
tree4c11cd88cee74d944f79eeaec77204a62e0d7428 /widgets
parent71e92f3f2c45cd8dd9f44d8226e23603164974a5 (diff)
downloadgsoc2013-evolution-54f6924c8410d18b8bcae7f2294db73301d21bfe.tar.gz
gsoc2013-evolution-54f6924c8410d18b8bcae7f2294db73301d21bfe.tar.zst
gsoc2013-evolution-54f6924c8410d18b8bcae7f2294db73301d21bfe.zip
EHintedEntry: Don't select hints on grab_focus().
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/e-hinted-entry.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/widgets/misc/e-hinted-entry.c b/widgets/misc/e-hinted-entry.c
index 1d292a626c..934c65a6d3 100644
--- a/widgets/misc/e-hinted-entry.c
+++ b/widgets/misc/e-hinted-entry.c
@@ -123,6 +123,34 @@ hinted_entry_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
+static void
+hinted_entry_grab_focus (GtkWidget *widget)
+{
+ EHintedEntryPrivate *priv;
+ GtkSettings *settings;
+ const gchar *property_name;
+ gboolean select_on_focus;
+
+ priv = E_HINTED_ENTRY_GET_PRIVATE (widget);
+
+ /* We don't want hints to be selected so we must temporarily
+ * override the "gtk-entry-select-on-focus" setting. */
+
+ settings = gtk_widget_get_settings (widget);
+ property_name = "gtk-entry-select-on-focus";
+
+ g_object_get (settings, property_name, &select_on_focus, NULL);
+
+ if (priv->hint_shown)
+ g_object_set (settings, property_name, FALSE, NULL);
+
+ /* Chain up to parent's grab_focus() method. */
+ GTK_WIDGET_CLASS (parent_class)->grab_focus (widget);
+
+ if (priv->hint_shown)
+ g_object_set (settings, property_name, select_on_focus, NULL);
+}
+
static gboolean
hinted_entry_focus_in_event (GtkWidget *widget,
GdkEventFocus *event)
@@ -169,6 +197,7 @@ hinted_entry_class_init (EHintedEntryClass *class)
object_class->finalize = hinted_entry_finalize;
widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->grab_focus = hinted_entry_grab_focus;
widget_class->focus_in_event = hinted_entry_focus_in_event;
widget_class->focus_out_event = hinted_entry_focus_out_event;