Commit 381e762e authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

libgimpwidgets/gimpsizeentry.[ch] added new function

2005-02-09  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimpsizeentry.[ch]
	* libgimpwidgets/gimpwidgets.def: added new function
	gimp_size_entry_set_activates_default().

	* app/dialogs/image-new-dialog.c: set the initial focus on the
	Width entry and set the activates_default flag for the size entry.
	Fixes bug #165748.
parent e21a5ff2
2005-02-09 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimpsizeentry.[ch]
* libgimpwidgets/gimpwidgets.def: added new function
gimp_size_entry_set_activates_default().
* app/dialogs/image-new-dialog.c: set the initial focus on the
Width entry and set the activates_default flag for the size entry.
Fixes bug #165748.
2005-02-09 Sven Neumann <sven@gimp.org>
* app/display/gimpscalecombobox.[ch]
......
......@@ -83,6 +83,7 @@ image_new_dialog_new (Gimp *gimp)
ImageNewDialog *dialog;
GtkWidget *main_vbox;
GtkWidget *table;
GimpSizeEntry *entry;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
......@@ -144,6 +145,10 @@ image_new_dialog_new (Gimp *gimp)
gtk_box_pack_start (GTK_BOX (main_vbox), dialog->editor, FALSE, FALSE, 0);
gtk_widget_show (dialog->editor);
entry = GIMP_SIZE_ENTRY (GIMP_TEMPLATE_EDITOR (dialog->editor)->size_se);
gimp_size_entry_set_activates_default (entry, TRUE);
gimp_size_entry_grab_focus (entry);
return dialog->dialog;
}
......
......@@ -1217,10 +1217,42 @@ gimp_size_entry_grab_focus (GimpSizeEntry *gse)
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
gsef = (GimpSizeEntryField*) gse->fields->data;
gsef = gse->fields->data;
if (gsef)
gtk_widget_grab_focus (gse->show_refval ?
gsef->refval_spinbutton : gsef->value_spinbutton);
}
/**
* gimp_size_entry_set_activates_default:
* @gse: A #GimpSizeEntr
* @setting: %TRUE to activate window's default widget on Enter keypress
*
* Iterates over all entries in the #GimpSizeEntry and calls
* gtk_entry_set_activates_default() on them.
*
* Since: GIMP 2.4
**/
void
gimp_size_entry_set_activates_default (GimpSizeEntry *gse,
gboolean setting)
{
GSList *list;
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
gtk_widget_grab_focus (gse->show_refval ?
gsef->refval_spinbutton : gsef->value_spinbutton);
for (list = gse->fields; list; list = g_slist_next (list))
{
GimpSizeEntryField *gsef = list->data;
if (gsef->value_spinbutton)
gtk_entry_set_activates_default (GTK_ENTRY (gsef->value_spinbutton),
setting);
if (gsef->refval_spinbutton)
gtk_entry_set_activates_default (GTK_ENTRY (gsef->refval_spinbutton),
setting);
}
}
/**
......
......@@ -139,6 +139,8 @@ void gimp_size_entry_set_pixel_digits (GimpSizeEntry *gse,
gint digits);
void gimp_size_entry_grab_focus (GimpSizeEntry *gse);
void gimp_size_entry_set_activates_default (GimpSizeEntry *gse,
gboolean setting);
GtkWidget * gimp_size_entry_get_help_widget (GimpSizeEntry *gse,
gint field);
......
......@@ -240,6 +240,7 @@ EXPORTS
gimp_size_entry_get_value
gimp_size_entry_grab_focus
gimp_size_entry_new
gimp_size_entry_set_activates_default
gimp_size_entry_set_pixel_digits
gimp_size_entry_set_refval
gimp_size_entry_set_refval_boundaries
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment