[ghex] Provide a better experience for the "Goto Byte..." dialog



commit 40ce7d7655a3e42d56b1f1fbf4d6845380892065
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Feb 2 03:54:53 2012 -0500

    Provide a better experience for the "Goto Byte..." dialog
    
    Set the entry to be focused by default, and make it so that activating
    the entry activates the default button.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=671101

 src/findreplace.c     |    3 +++
 src/hex-document-ui.c |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/findreplace.c b/src/findreplace.c
index 6de4224..4be2f4b 100644
--- a/src/findreplace.c
+++ b/src/findreplace.c
@@ -436,6 +436,9 @@ JumpDialog *create_jump_dialog()
 	dialog->int_entry = gtk_entry_new();
 	gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog->window))), dialog->int_entry,
 					   TRUE, TRUE, 0);
+	g_signal_connect_swapped (G_OBJECT (dialog->int_entry),
+	                          "activate", G_CALLBACK(gtk_window_activate_default),
+	                          GTK_WINDOW (dialog->window));
 	gtk_widget_show(dialog->int_entry);
 
 	dialog->ok = gtk_button_new_from_stock (GTK_STOCK_OK);
diff --git a/src/hex-document-ui.c b/src/hex-document-ui.c
index 551a199..07e4859 100644
--- a/src/hex-document-ui.c
+++ b/src/hex-document-ui.c
@@ -118,6 +118,7 @@ jump_cb (GtkAction *action,
 		gtk_window_set_position (GTK_WINDOW(jump_dialog->window), GTK_WIN_POS_MOUSE);
 		gtk_window_set_default(GTK_WINDOW(jump_dialog->window), jump_dialog->ok);
 		gtk_widget_show(jump_dialog->window);
+		gtk_widget_grab_focus(jump_dialog->int_entry);
 	}
 	raise_and_focus_widget(jump_dialog->window);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]