r18639 - gnucash/trunk/src - Have the Post date widget grab the focus by default when opening the post invoice dialog.

Geert Janssens gjanssens at code.gnucash.org
Wed Feb 10 17:55:11 EST 2010


Author: gjanssens
Date: 2010-02-10 17:55:11 -0500 (Wed, 10 Feb 2010)
New Revision: 18639
Trac: http://svn.gnucash.org/trac/changeset/18639

Modified:
   gnucash/trunk/src/business/business-gnome/dialog-date-close.c
   gnucash/trunk/src/gnome-utils/gnc-date-edit.c
   gnucash/trunk/src/gnome-utils/gnc-date-edit.h
Log:
Have the Post date widget grab the focus by default when opening the post invoice dialog.

Modified: gnucash/trunk/src/business/business-gnome/dialog-date-close.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-date-close.c	2010-02-10 20:35:31 UTC (rev 18638)
+++ gnucash/trunk/src/business/business-gnome/dialog-date-close.c	2010-02-10 22:55:11 UTC (rev 18639)
@@ -323,6 +323,9 @@
 
   gtk_widget_show_all (ddc->dialog);
 
+  /* Set the focus on the date widget */
+  gnc_date_grab_focus (GNC_DATE_EDIT (ddc->post_date));
+
   ddc->retval = FALSE;
   while (gtk_dialog_run (GTK_DIALOG (ddc->dialog)) == GTK_RESPONSE_OK) {
     /* If reponse is OK but flag is not set, try again */

Modified: gnucash/trunk/src/gnome-utils/gnc-date-edit.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-date-edit.c	2010-02-10 20:35:31 UTC (rev 18638)
+++ gnucash/trunk/src/gnome-utils/gnc-date-edit.c	2010-02-10 22:55:11 UTC (rev 18639)
@@ -1198,7 +1198,7 @@
 
 /**
  * gnc_date_set_activates_default:
- * @gde: The date editor to modity
+ * @gde: The date editor to modify
  * @state: The new state for this widget.
  * 
  * Extracts the editable field from a GNCDateEdit widget, and sets it
@@ -1214,7 +1214,21 @@
     gtk_entry_set_activates_default(GTK_ENTRY(gde->date_entry), state);
 }
 
+/**
+ * gnc_date_grab_focus:
+ * @gde: The date editor to modify
+ * @state: The new state for this widget.
+ * 
+ * Sets the focus to the Editable field.
+ **/
+void
+gnc_date_grab_focus (GNCDateEdit *gde)
+{
+	if (!gde)
+		return;
 
+	gtk_widget_grab_focus (gde->date_entry);
+}
 /** Sets the editable field from a GNCDateEdit widget as the target
  *  for the specified label's access key.
  *

Modified: gnucash/trunk/src/gnome-utils/gnc-date-edit.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-date-edit.h	2010-02-10 20:35:31 UTC (rev 18638)
+++ gnucash/trunk/src/gnome-utils/gnc-date-edit.h	2010-02-10 22:55:11 UTC (rev 18639)
@@ -134,6 +134,7 @@
 int       gnc_date_edit_get_flags       (GNCDateEdit *gde);
 
 void      gnc_date_activates_default    (GNCDateEdit *gde, gboolean state);
+void      gnc_date_grab_focus           (GNCDateEdit *gde);
 
 void      gnc_date_make_mnemonic_target (GNCDateEdit *gde, GtkWidget *label);
 #endif



More information about the gnucash-changes mailing list