diff --git a/src/register/gnome/combocell-gnome.c b/src/register/gnome/combocell-gnome.c index d53b7a84b5..743b05a65f 100644 --- a/src/register/gnome/combocell-gnome.c +++ b/src/register/gnome/combocell-gnome.c @@ -53,10 +53,6 @@ typedef struct _PopBox ItemEdit *item_edit; GNCItemList *item_list; - gint select_item_signal; - gint change_item_signal; - gint key_press_signal; - gboolean signals_connected; /* list signals connected? */ gboolean list_in_sync; /* list in sync with menustrings? */ @@ -164,6 +160,16 @@ change_item_cb (GNCItemList *item_list, char *item_string, gpointer data) box->in_list_select = FALSE; } +static void +activate_item_cb (GNCItemList *item_list, char *item_string, gpointer data) +{ + ComboCell *cell = data; + PopBox *box = cell->cell.gui_private; + + item_edit_hide_list(box->item_edit); + box->list_popped = FALSE; +} + static void key_press_item_cb (GNCItemList *item_list, GdkEventKey *event, gpointer data) { @@ -193,14 +199,7 @@ combo_disconnect_signals (ComboCell *cell) if (GTK_OBJECT_DESTROYED(GTK_OBJECT(box->item_list))) return; - gtk_signal_disconnect(GTK_OBJECT(box->item_list), - box->select_item_signal); - - gtk_signal_disconnect(GTK_OBJECT(box->item_list), - box->change_item_signal); - - gtk_signal_disconnect(GTK_OBJECT(box->item_list), - box->key_press_signal); + gtk_signal_disconnect_by_data (GTK_OBJECT(box->item_list), cell); box->signals_connected = FALSE; } @@ -216,21 +215,17 @@ combo_connect_signals (ComboCell *cell) if (GTK_OBJECT_DESTROYED(GTK_OBJECT(box->item_list))) return; - box->select_item_signal = - gtk_signal_connect(GTK_OBJECT(box->item_list), "select_item", - GTK_SIGNAL_FUNC(select_item_cb), - (gpointer) cell); + gtk_signal_connect(GTK_OBJECT(box->item_list), "select_item", + GTK_SIGNAL_FUNC(select_item_cb), cell); - box->change_item_signal = - gtk_signal_connect(GTK_OBJECT(box->item_list), "change_item", - GTK_SIGNAL_FUNC(change_item_cb), - (gpointer) cell); + gtk_signal_connect(GTK_OBJECT(box->item_list), "change_item", + GTK_SIGNAL_FUNC(change_item_cb), cell); - box->key_press_signal = - gtk_signal_connect(GTK_OBJECT(box->item_list), - "key_press_event", - GTK_SIGNAL_FUNC(key_press_item_cb), - (gpointer) cell); + gtk_signal_connect(GTK_OBJECT(box->item_list), "activate_item", + GTK_SIGNAL_FUNC(activate_item_cb), cell); + + gtk_signal_connect(GTK_OBJECT(box->item_list), "key_press_event", + GTK_SIGNAL_FUNC(key_press_item_cb), cell); box->signals_connected = TRUE; } @@ -243,14 +238,7 @@ block_list_signals (ComboCell *cell) if (!box->signals_connected) return; - gtk_signal_handler_block(GTK_OBJECT(box->item_list), - box->select_item_signal); - - gtk_signal_handler_block(GTK_OBJECT(box->item_list), - box->change_item_signal); - - gtk_signal_handler_block(GTK_OBJECT(box->item_list), - box->key_press_signal); + gtk_signal_handler_block_by_data (GTK_OBJECT(box->item_list), cell); } static void @@ -261,14 +249,7 @@ unblock_list_signals (ComboCell *cell) if (!box->signals_connected) return; - gtk_signal_handler_unblock(GTK_OBJECT(box->item_list), - box->select_item_signal); - - gtk_signal_handler_unblock(GTK_OBJECT(box->item_list), - box->change_item_signal); - - gtk_signal_handler_unblock(GTK_OBJECT(box->item_list), - box->key_press_signal); + gtk_signal_handler_unblock_by_data (GTK_OBJECT(box->item_list), cell); } /* =============================================== */ diff --git a/src/register/gnome/gnucash-item-list.c b/src/register/gnome/gnucash-item-list.c index 4fd7e9e40e..5c64c77082 100644 --- a/src/register/gnome/gnucash-item-list.c +++ b/src/register/gnome/gnucash-item-list.c @@ -33,6 +33,7 @@ enum { SELECT_ITEM, CHANGE_ITEM, + ACTIVATE_ITEM, KEY_PRESS_EVENT, LAST_SIGNAL }; @@ -229,7 +230,7 @@ gnc_item_list_key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) return FALSE; gtk_signal_emit(GTK_OBJECT(item_list), - gnc_item_list_signals[SELECT_ITEM], + gnc_item_list_signals[ACTIVATE_ITEM], string); return TRUE; @@ -283,6 +284,16 @@ gnc_item_list_class_init(GNCItemListClass *item_list_class) GTK_TYPE_NONE, 1, GTK_TYPE_POINTER); + gnc_item_list_signals[ACTIVATE_ITEM] = + gtk_signal_new("activate_item", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET(GNCItemListClass, + activate_item), + gtk_marshal_NONE__POINTER, + GTK_TYPE_NONE, 1, + GTK_TYPE_POINTER); + gnc_item_list_signals[KEY_PRESS_EVENT] = gtk_signal_new ("key_press_event", GTK_RUN_LAST, @@ -299,6 +310,7 @@ gnc_item_list_class_init(GNCItemListClass *item_list_class) item_list_class->select_item = NULL; item_list_class->change_item = NULL; + item_list_class->activate_item = NULL; item_list_class->key_press_event = NULL; } diff --git a/src/register/gnome/gnucash-item-list.h b/src/register/gnome/gnucash-item-list.h index 018472a5de..e0a14dfe2b 100644 --- a/src/register/gnome/gnucash-item-list.h +++ b/src/register/gnome/gnucash-item-list.h @@ -68,6 +68,9 @@ typedef struct void (*change_item) (GNCItemList *item_list, char *item_string); + void (*activate_item) (GNCItemList *item_list, + char *item_string); + void (*key_press_event) (GNCItemList *item_list, GdkEventKey *event); diff --git a/src/register/table-allgui.c b/src/register/table-allgui.c index bea658b8a5..ddb820ecf6 100644 --- a/src/register/table-allgui.c +++ b/src/register/table-allgui.c @@ -1487,6 +1487,8 @@ gnc_table_traverse_update(Table *table, /* Call the table traverse callback for any modifications. */ if (table->traverse) abort_move = table->traverse (table, dest_loc, dir); + else + abort_move = FALSE; LEAVE("dest_row = %d, dest_col = %d\n", dest_loc->vcell_loc.virt_row, dest_loc->vcell_loc.virt_col);