Bug 797760 - Broken register split activity...

cannot delete splits, unable to tab complete account name.

The final piece, commits the currently selected item in the PopBox
when tabbing out of a register combocell in type-ahead mode.
This commit is contained in:
John Ralls 2020-05-18 14:14:08 -07:00
parent 07325f796c
commit 279a632b40
3 changed files with 32 additions and 9 deletions

View File

@ -718,6 +718,14 @@ gnc_combo_cell_direct_update (BasicCell* bcell,
/* fall through */
case GDK_KEY_Tab:
case GDK_KEY_ISO_Left_Tab:
if (gnc_item_list_using_temp (box->item_list))
{
char* string = gnc_item_list_get_selection (box->item_list);
g_signal_emit_by_name (G_OBJECT (box->item_list), "change_item",
string, (gpointer)bcell);
g_free (string);
return FALSE;
}
if (! (event->state & GDK_CONTROL_MASK) &&
!keep_on_going)
return FALSE;

View File

@ -201,6 +201,22 @@ gnc_item_list_select (GncItemList* item_list, const char* string)
g_free (to_find_data);
}
char*
gnc_item_list_get_selection (GncItemList *item_list)
{
GtkTreeIter iter;
GtkTreeModel* model;
gchar* string;
GtkTreeSelection *selection =
gtk_tree_view_get_selection (item_list->tree_view);
if (!gtk_tree_selection_get_selected (selection, &model, &iter))
return FALSE;
gtk_tree_model_get (model, &iter, 0, &string, -1);
return string;
}
void
gnc_item_list_show_selected (GncItemList* item_list)
@ -326,21 +342,13 @@ static gboolean
gnc_item_list_key_event (GtkWidget* widget, GdkEventKey* event, gpointer data)
{
GncItemList* item_list = GNC_ITEM_LIST (data);
GtkTreeSelection* selection = NULL;
GtkTreeIter iter;
GtkTreeModel* model;
gchar* string;
gboolean retval;
switch (event->keyval)
{
case GDK_KEY_Return:
selection = gtk_tree_view_get_selection (item_list->tree_view);
if (!gtk_tree_selection_get_selected (selection, &model, &iter))
return FALSE;
gtk_tree_model_get (model, &iter, 0, &string, -1);
string = gnc_item_list_get_selection (item_list);
g_signal_emit (G_OBJECT (item_list),
gnc_item_list_signals[ACTIVATE_ITEM],
0,

View File

@ -80,6 +80,13 @@ void gnc_item_list_select (GncItemList *item_list, const char *string);
void gnc_item_list_show_selected (GncItemList *item_list);
/** Retrieve the selected string from the item_list's active GtkListStore.
*
* @param item_list the GncItemList
* @return the string value. It must be freed with g_free().
*/
char* gnc_item_list_get_selection (GncItemList *item_list);
int gnc_item_list_autosize (GncItemList *item_list);
void gnc_item_list_set_temp_store (GncItemList *item_list, GtkListStore *store);