summaryrefslogtreecommitdiff
path: root/gtk/gtkentry.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-02-02 22:52:22 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-02-02 22:52:22 +0000
commitd6622d38d6f460d84f571669a2081a8fd3024f11 (patch)
tree70f263d9587bc25934afcc4fed6e594ea9f79c90 /gtk/gtkentry.c
parent2ee08d8ec6db2b23dd0e4865be411f934513b48c (diff)
downloadgtk+-d6622d38d6f460d84f571669a2081a8fd3024f11.tar.gz
Add a GtkSetting (gtk-entry-select-on-focus) controlling whether the
Sat Feb 2 17:43:00 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c (gtk_entry_grab_focus): Add a GtkSetting (gtk-entry-select-on-focus) controlling whether the contents of an entry are selected on focus in. * gtk/gtkmenu.c (gtk_menu_key_press): Add a GtkSetting (gtk-can-change-accels) controlling whether accelerators can be changed on the fly or not. (#51902) * gtk/gtkmenu.c (gtk_menu_key_press): Allow unmodified accelerators, now that accelerator changing can be turned off for those who won't expect it. (#61285) * gtk/gtkaccelgroup.c (gtk_accelerator_valid): Allow Backspace/Delete/KP_Delete as valid accelerators. * gtk/gtkmenu.c (gtk_menu_key_press): Allow setting of Delete/Backspace as accelerators by making them toggle the menu item between empty and the pressed key. (#58605) * tests/testgtkrc: Remove the objectionably short cursor blink time setting.
Diffstat (limited to 'gtk/gtkentry.c')
-rw-r--r--gtk/gtkentry.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index d9bf421f3d..25cbcc7956 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -780,6 +780,12 @@ gtk_entry_class_init (GtkEntryClass *class)
"toggle_overwrite", 0);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Insert, 0,
"toggle_overwrite", 0);
+
+ gtk_settings_install_property (g_param_spec_boolean ("gtk-entry-select-on-focus",
+ _("Select on focus"),
+ _("Whether to select the contents of an entry when it is focused."),
+ TRUE,
+ G_PARAM_READWRITE));
}
static void
@@ -1659,9 +1665,16 @@ gtk_entry_focus_out (GtkWidget *widget,
static void
gtk_entry_grab_focus (GtkWidget *widget)
{
- GTK_WIDGET_CLASS (parent_class)->grab_focus (widget);
+ gboolean select_on_focus;
+
+ GTK_WIDGET_CLASS (parent_class)->grab_focus (widget);
- if (!GTK_ENTRY (widget)->in_click)
+ g_object_get (G_OBJECT (gtk_settings_get_default ()),
+ "gtk-entry-select-on-focus",
+ &select_on_focus,
+ NULL);
+
+ if (select_on_focus && !GTK_ENTRY (widget)->in_click)
gtk_editable_select_region (GTK_EDITABLE (widget), 0, -1);
}