diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-10-20 19:31:03 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-10-20 19:31:03 (GMT) |
commit | edb4e7aae1edda23c6b2a6e5281585b5267f7eed (patch) | |
tree | 8aa9535a50d8c662d636e8c6d4b6f5b0dd3c2314 | |
parent | 5a26d51d20938b7e982ef5d9fa5137e07b4a3f83 (diff) |
Double click select the whole address
-rw-r--r-- | lib/src/sugar-address-entry.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/src/sugar-address-entry.c b/lib/src/sugar-address-entry.c index 8e8a2c8..da28723 100644 --- a/lib/src/sugar-address-entry.c +++ b/lib/src/sugar-address-entry.c @@ -618,6 +618,19 @@ sugar_address_entry_class_init(SugarAddressEntryClass *klass) } static gboolean +button_press_event_cb (GtkWidget *widget, GdkEventButton *event) +{ + if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { + gtk_editable_select_region(GTK_EDITABLE(widget), 0, -1); + gtk_widget_grab_focus(widget); + + return TRUE; + } + + return FALSE; +} + +static gboolean focus_in_event_cb(GtkWidget *widget, GdkEventFocus *event) { update_entry_text(SUGAR_ADDRESS_ENTRY(widget), TRUE); @@ -642,4 +655,6 @@ sugar_address_entry_init(SugarAddressEntry *entry) G_CALLBACK(focus_in_event_cb), NULL); g_signal_connect(entry, "focus-out-event", G_CALLBACK(focus_out_event_cb), NULL); + g_signal_connect(entry, "button-press-event", + G_CALLBACK(button_press_event_cb), NULL); } |