[gimp/soc-2011-gimpunitentry: 37/68] GimpUnitEntryTable: add grab_focus()



commit 0575e04c0b7984690543ccdceda3ce12898649bd
Author: Enrico Schröder <enni schroeder gmail com>
Date:   Fri Jul 8 12:34:58 2011 +0200

    GimpUnitEntryTable: add grab_focus()

 app/dialogs/image-new-dialog.c      |    8 ++++----
 libgimpwidgets/gimpunitentrytable.c |    5 +++++
 libgimpwidgets/gimpunitentrytable.h |    1 +
 libgimpwidgets/gimpwidgets.def      |    1 +
 4 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/app/dialogs/image-new-dialog.c b/app/dialogs/image-new-dialog.c
index aecfe82..1daf23c 100644
--- a/app/dialogs/image-new-dialog.c
+++ b/app/dialogs/image-new-dialog.c
@@ -83,7 +83,7 @@ image_new_dialog_new (GimpContext *context)
   ImageNewDialog      *dialog;
   GtkWidget           *main_vbox;
   GtkWidget           *table;
-  GimpUnitEntryTable  *UETable;
+  GimpUnitEntryTable  *unit_entry_table;
 
   g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
 
@@ -158,9 +158,9 @@ image_new_dialog_new (GimpContext *context)
   gtk_box_pack_start (GTK_BOX (main_vbox), dialog->editor, FALSE, FALSE, 0);
   gtk_widget_show (dialog->editor);
 
-  UETable = GIMP_UNIT_ENTRY_TABLE (gimp_template_editor_get_size_se (GIMP_TEMPLATE_EDITOR (dialog->editor)));
-  gimp_unit_entry_table_set_activates_default (UETable, TRUE);
-  gtk_widget_grab_focus (GTK_WIDGET (gimp_unit_entry_table_get_nth_entry (UETable, 0)));
+  unit_entry_table = gimp_template_editor_get_size_se (GIMP_TEMPLATE_EDITOR (dialog->editor));
+  gimp_unit_entry_table_set_activates_default (unit_entry_table, TRUE);
+  gimp_unit_entry_table_grab_focus (unit_entry_table);
 
   image_new_template_changed (dialog->context,
                               gimp_context_get_template (dialog->context),
diff --git a/libgimpwidgets/gimpunitentrytable.c b/libgimpwidgets/gimpunitentrytable.c
index 44e7b8c..6bf1196 100644
--- a/libgimpwidgets/gimpunitentrytable.c
+++ b/libgimpwidgets/gimpunitentrytable.c
@@ -415,3 +415,8 @@ gimp_unit_entry_table_set_activates_default (GimpUnitEntryTable *table,
     gtk_entry_set_activates_default (GTK_ENTRY (entry), setting);
   }
 }
+void 
+gimp_unit_entry_table_grab_focus (GimpUnitEntryTable *table)
+{
+  gtk_widget_grab_focus (GTK_WIDGET (gimp_unit_entry_table_get_nth_entry (table, 0)));
+}
diff --git a/libgimpwidgets/gimpunitentrytable.h b/libgimpwidgets/gimpunitentrytable.h
index 189681e..51aec93 100644
--- a/libgimpwidgets/gimpunitentrytable.h
+++ b/libgimpwidgets/gimpunitentrytable.h
@@ -90,6 +90,7 @@ void gimp_unit_entry_table_set_resolution           (GimpUnitEntryTable *table,
 void gimp_unit_entry_table_set_res_mode             (GimpUnitEntryTable *table, gboolean enable);
 /* calls gtk_entry_set_activates_default for all UnitEntries */
 void gimp_unit_entry_table_set_activates_default    (GimpUnitEntryTable *table, gboolean setting);
+void gimp_unit_entry_table_grab_focus               (GimpUnitEntryTable *table);
 G_END_DECLS
 
 #endif /*__GIMP_UNIT_ENTRY_TABLE_H__*/
diff --git a/libgimpwidgets/gimpwidgets.def b/libgimpwidgets/gimpwidgets.def
index 811b289..413c19a 100644
--- a/libgimpwidgets/gimpwidgets.def
+++ b/libgimpwidgets/gimpwidgets.def
@@ -403,6 +403,7 @@ EXPORTS
        gimp_unit_entry_table_get_pixels
        gimp_unit_entry_table_get_type
        gimp_unit_entry_table_get_value_in_unit
+       gimp_unit_entry_table_grab_focus
        gimp_unit_entry_table_new
        gimp_unit_entry_table_set_activates_default
        gimp_unit_entry_table_set_res_mode


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