Make "Create" button default for New Project dialog

So it activates when you press the enter/return key in one of the
entries.
This commit is contained in:
Matthew Brush 2013-04-26 14:55:48 -07:00
parent a3da0467d4
commit e0245df568

View File

@ -123,6 +123,8 @@ void project_new(void)
gtk_widget_set_name(e->dialog, "GeanyDialogProject"); gtk_widget_set_name(e->dialog, "GeanyDialogProject");
bbox = gtk_hbox_new(FALSE, 0); bbox = gtk_hbox_new(FALSE, 0);
button = gtk_button_new(); button = gtk_button_new();
gtk_widget_set_can_default(button, TRUE);
gtk_window_set_default(GTK_WINDOW(e->dialog), button);
image = gtk_image_new_from_stock(GTK_STOCK_NEW, GTK_ICON_SIZE_BUTTON); image = gtk_image_new_from_stock(GTK_STOCK_NEW, GTK_ICON_SIZE_BUTTON);
label = gtk_label_new_with_mnemonic(_("C_reate")); label = gtk_label_new_with_mnemonic(_("C_reate"));
gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 3); gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 3);
@ -142,6 +144,7 @@ void project_new(void)
gtk_misc_set_alignment(GTK_MISC(label), 1, 0); gtk_misc_set_alignment(GTK_MISC(label), 1, 0);
e->name = gtk_entry_new(); e->name = gtk_entry_new();
gtk_entry_set_activates_default(GTK_ENTRY(e->name), TRUE);
ui_entry_add_clear_icon(GTK_ENTRY(e->name)); ui_entry_add_clear_icon(GTK_ENTRY(e->name));
gtk_entry_set_max_length(GTK_ENTRY(e->name), MAX_NAME_LEN); gtk_entry_set_max_length(GTK_ENTRY(e->name), MAX_NAME_LEN);
@ -151,6 +154,7 @@ void project_new(void)
gtk_misc_set_alignment(GTK_MISC(label), 1, 0); gtk_misc_set_alignment(GTK_MISC(label), 1, 0);
e->file_name = gtk_entry_new(); e->file_name = gtk_entry_new();
gtk_entry_set_activates_default(GTK_ENTRY(e->file_name), TRUE);
ui_entry_add_clear_icon(GTK_ENTRY(e->file_name)); ui_entry_add_clear_icon(GTK_ENTRY(e->file_name));
gtk_entry_set_width_chars(GTK_ENTRY(e->file_name), 30); gtk_entry_set_width_chars(GTK_ENTRY(e->file_name), 30);
button = gtk_button_new(); button = gtk_button_new();
@ -167,6 +171,7 @@ void project_new(void)
gtk_misc_set_alignment(GTK_MISC(label), 1, 0); gtk_misc_set_alignment(GTK_MISC(label), 1, 0);
e->base_path = gtk_entry_new(); e->base_path = gtk_entry_new();
gtk_entry_set_activates_default(GTK_ENTRY(e->base_path), TRUE);
ui_entry_add_clear_icon(GTK_ENTRY(e->base_path)); ui_entry_add_clear_icon(GTK_ENTRY(e->base_path));
gtk_widget_set_tooltip_text(e->base_path, gtk_widget_set_tooltip_text(e->base_path,
_("Base directory of all files that make up the project. " _("Base directory of all files that make up the project. "