r20273 - gnucash/trunk/src/business/business-gnome - Extend the addr2/addr3 auto-completion also to the shipping addr2/addr3 lines.
Christian Stimming
cstim at code.gnucash.org
Thu Feb 10 16:49:44 EST 2011
Author: cstim
Date: 2011-02-10 16:49:44 -0500 (Thu, 10 Feb 2011)
New Revision: 20273
Trac: http://svn.gnucash.org/trac/changeset/20273
Modified:
gnucash/trunk/src/business/business-gnome/dialog-customer.c
gnucash/trunk/src/business/business-gnome/glade/customer.glade
Log:
Extend the addr2/addr3 auto-completion also to the shipping addr2/addr3 lines.
Modified: gnucash/trunk/src/business/business-gnome/dialog-customer.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-customer.c 2011-02-10 21:49:29 UTC (rev 20272)
+++ gnucash/trunk/src/business/business-gnome/dialog-customer.c 2011-02-10 21:49:44 UTC (rev 20273)
@@ -71,12 +71,24 @@
void gnc_customer_addr3_insert_cb(GtkEditable *editable,
gchar *new_text, gint new_text_length,
gint *position, gpointer user_data);
+void gnc_customer_shipaddr2_insert_cb(GtkEditable *editable,
+ gchar *new_text, gint new_text_length,
+ gint *position, gpointer user_data);
+void gnc_customer_shipaddr3_insert_cb(GtkEditable *editable,
+ gchar *new_text, gint new_text_length,
+ gint *position, gpointer user_data);
gboolean
gnc_customer_addr2_key_press_cb( GtkEntry *entry, GdkEventKey *event,
gpointer user_data );
gboolean
gnc_customer_addr3_key_press_cb( GtkEntry *entry, GdkEventKey *event,
gpointer user_data );
+gboolean
+gnc_customer_shipaddr2_key_press_cb( GtkEntry *entry, GdkEventKey *event,
+ gpointer user_data );
+gboolean
+gnc_customer_shipaddr3_key_press_cb( GtkEntry *entry, GdkEventKey *event,
+ gpointer user_data );
#define ADDR_QUICKFILL "GncAddress-Quickfill"
@@ -938,6 +950,34 @@
return FALSE;
}
+static gboolean
+idle_select_region_shipaddr2(gpointer user_data)
+{
+ CustomerWindow *wdata = user_data;
+ g_return_val_if_fail(user_data, FALSE);
+
+ gtk_editable_select_region(GTK_EDITABLE(wdata->shipaddr2_entry),
+ wdata->addr2_start_selection,
+ wdata->addr2_end_selection);
+
+ wdata->addr2_selection_source_id = 0;
+ return FALSE;
+}
+
+static gboolean
+idle_select_region_shipaddr3(gpointer user_data)
+{
+ CustomerWindow *wdata = user_data;
+ g_return_val_if_fail(user_data, FALSE);
+
+ gtk_editable_select_region(GTK_EDITABLE(wdata->shipaddr3_entry),
+ wdata->addr3_start_selection,
+ wdata->addr3_end_selection);
+
+ wdata->addr3_selection_source_id = 0;
+ return FALSE;
+}
+
/* Implementation of the steps common to all address lines. Returns
* TRUE if anything was inserted by quickfill, otherwise FALSE. */
static gboolean
@@ -1016,8 +1056,6 @@
CustomerWindow *wdata = user_data;
gboolean r;
- /*g_warning("In gnc_customer_addr2_insert_cb");*/
-
/* The handling common to all address lines is done in this other
* function. */
r = gnc_customer_addr_common_insert_cb(editable, new_text, new_text_length,
@@ -1042,8 +1080,6 @@
CustomerWindow *wdata = user_data;
gboolean r;
- /*g_warning("In gnc_customer_addr3_insert_cb");*/
-
/* The handling common to all address lines is done in this other
* function. */
r = gnc_customer_addr_common_insert_cb(editable, new_text, new_text_length,
@@ -1052,8 +1088,6 @@
/* Did we insert something? Then set up the correct idle handler */
if (r)
{
- /* select region on idle, because it would be reset once this function
- finishes */
wdata->addr3_start_selection = *position;
wdata->addr3_end_selection = -1;
wdata->addr3_selection_source_id = g_idle_add(idle_select_region_addr3,
@@ -1061,6 +1095,50 @@
}
}
+void gnc_customer_shipaddr2_insert_cb(GtkEditable *editable,
+ gchar *new_text, gint new_text_length,
+ gint *position, gpointer user_data)
+{
+ CustomerWindow *wdata = user_data;
+ gboolean r;
+
+ /* The handling common to all address lines is done in this other
+ * function. */
+ r = gnc_customer_addr_common_insert_cb(editable, new_text, new_text_length,
+ position, user_data, wdata->addr2_quickfill);
+
+ /* Did we insert something? Then set up the correct idle handler */
+ if (r)
+ {
+ wdata->addr2_start_selection = *position;
+ wdata->addr2_end_selection = -1;
+ wdata->addr2_selection_source_id = g_idle_add(idle_select_region_shipaddr2,
+ user_data);
+ }
+}
+
+void gnc_customer_shipaddr3_insert_cb(GtkEditable *editable,
+ gchar *new_text, gint new_text_length,
+ gint *position, gpointer user_data)
+{
+ CustomerWindow *wdata = user_data;
+ gboolean r;
+
+ /* The handling common to all address lines is done in this other
+ * function. */
+ r = gnc_customer_addr_common_insert_cb(editable, new_text, new_text_length,
+ position, user_data, wdata->addr3_quickfill);
+
+ /* Did we insert something? Then set up the correct idle handler */
+ if (r)
+ {
+ wdata->addr3_start_selection = *position;
+ wdata->addr3_end_selection = -1;
+ wdata->addr3_selection_source_id = g_idle_add(idle_select_region_shipaddr3,
+ user_data);
+ }
+}
+
static gboolean
gnc_customer_common_key_press_cb( GtkEntry *entry,
GdkEventKey *event,
@@ -1108,3 +1186,21 @@
return gnc_customer_common_key_press_cb(entry, event, user_data,
wdata->addr3_entry);
}
+gboolean
+gnc_customer_shipaddr2_key_press_cb( GtkEntry *entry,
+ GdkEventKey *event,
+ gpointer user_data )
+{
+ CustomerWindow *wdata = user_data;
+ return gnc_customer_common_key_press_cb(entry, event, user_data,
+ wdata->shipaddr2_entry);
+}
+gboolean
+gnc_customer_shipaddr3_key_press_cb( GtkEntry *entry,
+ GdkEventKey *event,
+ gpointer user_data )
+{
+ CustomerWindow *wdata = user_data;
+ return gnc_customer_common_key_press_cb(entry, event, user_data,
+ wdata->shipaddr3_entry);
+}
Modified: gnucash/trunk/src/business/business-gnome/glade/customer.glade
===================================================================
--- gnucash/trunk/src/business/business-gnome/glade/customer.glade 2011-02-10 21:49:29 UTC (rev 20272)
+++ gnucash/trunk/src/business/business-gnome/glade/customer.glade 2011-02-10 21:49:44 UTC (rev 20273)
@@ -883,6 +883,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activates_default">True</property>
+ <signal name="insert_text" handler="gnc_customer_shipaddr2_insert_cb"/>
+ <signal name="key_press_event" handler="gnc_customer_shipaddr2_key_press_cb"/>
</widget>
<packing>
<property name="expand">False</property>
@@ -895,6 +897,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activates_default">True</property>
+ <signal name="insert_text" handler="gnc_customer_shipaddr3_insert_cb"/>
+ <signal name="key_press_event" handler="gnc_customer_shipaddr3_key_press_cb"/>
</widget>
<packing>
<property name="expand">False</property>
More information about the gnucash-changes
mailing list