mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add opening the transaction association from register sheet.
Add option to open transaction association by clicking on the association in the association cell.
This commit is contained in:
parent
6b3f9bd80e
commit
6e83494008
@ -119,6 +119,7 @@ void gsr_default_reverse_txn_handler ( GNCSplitReg *w, gpointer ud );
|
|||||||
void gsr_default_associate_handler ( GNCSplitReg *w );
|
void gsr_default_associate_handler ( GNCSplitReg *w );
|
||||||
void gsr_default_associate_open_handler ( GNCSplitReg *w );
|
void gsr_default_associate_open_handler ( GNCSplitReg *w );
|
||||||
void gsr_default_associate_remove_handler ( GNCSplitReg *w );
|
void gsr_default_associate_remove_handler ( GNCSplitReg *w );
|
||||||
|
static void gsr_default_associate_from_sheet_handler ( GNCSplitReg *w );
|
||||||
|
|
||||||
static void gsr_emit_simple_signal ( GNCSplitReg *gsr, const char *sigName );
|
static void gsr_emit_simple_signal ( GNCSplitReg *gsr, const char *sigName );
|
||||||
static void gsr_emit_help_changed ( GnucashRegister *reg, gpointer user_data );
|
static void gsr_emit_help_changed ( GnucashRegister *reg, gpointer user_data );
|
||||||
@ -578,6 +579,11 @@ gsr_create_table( GNCSplitReg *gsr )
|
|||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (gsr), GTK_WIDGET(gsr->reg), TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (gsr), GTK_WIDGET(gsr->reg), TRUE, TRUE, 0);
|
||||||
gnucash_sheet_set_window (gnucash_register_get_sheet (gsr->reg), gsr->window);
|
gnucash_sheet_set_window (gnucash_register_get_sheet (gsr->reg), gsr->window);
|
||||||
|
|
||||||
|
// setup the callback for when the associate cell clicked on
|
||||||
|
gnucash_register_set_open_assoc_cb (gsr->reg,
|
||||||
|
(GFunc)gsr_default_associate_from_sheet_handler, gsr);
|
||||||
|
|
||||||
gtk_widget_show ( GTK_WIDGET(gsr->reg) );
|
gtk_widget_show ( GTK_WIDGET(gsr->reg) );
|
||||||
g_signal_connect (gsr->reg, "activate_cursor",
|
g_signal_connect (gsr->reg, "activate_cursor",
|
||||||
G_CALLBACK(gnc_split_reg_record_cb), gsr);
|
G_CALLBACK(gnc_split_reg_record_cb), gsr);
|
||||||
@ -1435,6 +1441,31 @@ gsr_default_associate_remove_handler (GNCSplitReg *gsr)
|
|||||||
xaccTransSetAssociation (trans, "");
|
xaccTransSetAssociation (trans, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gsr_default_associate_from_sheet_handler (GNCSplitReg *gsr)
|
||||||
|
{
|
||||||
|
CursorClass cursor_class;
|
||||||
|
SplitRegister *reg = gnc_ledger_display_get_split_register (gsr->ledger);
|
||||||
|
Transaction *trans;
|
||||||
|
Split *split;
|
||||||
|
gchar *uri = NULL;
|
||||||
|
|
||||||
|
/* get the current split based on cursor position */
|
||||||
|
split = gnc_split_register_get_current_split (reg);
|
||||||
|
if (!split)
|
||||||
|
return;
|
||||||
|
|
||||||
|
trans = xaccSplitGetParent (split);
|
||||||
|
|
||||||
|
// fix an earlier error when storing relative paths before version 3.5
|
||||||
|
uri = gnc_assoc_convert_trans_associate_uri (trans, gsr->read_only);
|
||||||
|
|
||||||
|
if (uri)
|
||||||
|
gnc_assoc_open_uri (GTK_WINDOW (gsr->window), uri);
|
||||||
|
|
||||||
|
g_free (uri);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data )
|
gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data )
|
||||||
{
|
{
|
||||||
|
@ -644,3 +644,18 @@ GnucashSheet *gnucash_register_get_sheet (GnucashRegister *reg)
|
|||||||
return GNUCASH_SHEET(reg->sheet);
|
return GNUCASH_SHEET(reg->sheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
gnucash_register_set_open_assoc_cb (GnucashRegister *reg,
|
||||||
|
GFunc cb, gpointer cb_data)
|
||||||
|
{
|
||||||
|
GnucashSheet *sheet;
|
||||||
|
|
||||||
|
if (!reg || !reg->sheet)
|
||||||
|
return;
|
||||||
|
sheet = GNUCASH_SHEET(reg->sheet);
|
||||||
|
sheet->open_assoc_cb = cb;
|
||||||
|
sheet->open_assoc_cb_data = cb_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,6 +81,8 @@ void gnucash_register_paste_clipboard (GnucashRegister *reg);
|
|||||||
void gnucash_register_refresh_from_prefs (GnucashRegister *reg);
|
void gnucash_register_refresh_from_prefs (GnucashRegister *reg);
|
||||||
void gnucash_register_set_moved_cb (GnucashRegister *reg,
|
void gnucash_register_set_moved_cb (GnucashRegister *reg,
|
||||||
GFunc cb, gpointer cb_data);
|
GFunc cb, gpointer cb_data);
|
||||||
|
void gnucash_register_set_open_assoc_cb (GnucashRegister *reg,
|
||||||
|
GFunc cb, gpointer cb_data);
|
||||||
|
|
||||||
GnucashSheet *gnucash_register_get_sheet (GnucashRegister *reg);
|
GnucashSheet *gnucash_register_get_sheet (GnucashRegister *reg);
|
||||||
void gnucash_register_reset_sheet_layout (GnucashRegister *reg);
|
void gnucash_register_reset_sheet_layout (GnucashRegister *reg);
|
||||||
|
@ -1514,6 +1514,13 @@ gnucash_sheet_button_press_event (GtkWidget *widget, GdkEventButton *event)
|
|||||||
//FIXME does something need to be done if changed_cells is true or false ?
|
//FIXME does something need to be done if changed_cells is true or false ?
|
||||||
gnucash_sheet_cursor_move (sheet, new_virt_loc);
|
gnucash_sheet_cursor_move (sheet, new_virt_loc);
|
||||||
|
|
||||||
|
// if clicked in associate cell, run call back
|
||||||
|
if (g_strcmp0 (gnc_table_get_cell_name (table, new_virt_loc), ASSOC_CELL) == 0)
|
||||||
|
{
|
||||||
|
if (sheet->open_assoc_cb)
|
||||||
|
(sheet->open_assoc_cb)(sheet->open_assoc_cb_data, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if (button_1)
|
if (button_1)
|
||||||
gnucash_sheet_check_grab (sheet);
|
gnucash_sheet_check_grab (sheet);
|
||||||
|
|
||||||
|
@ -95,6 +95,9 @@ struct _GnucashSheet
|
|||||||
GFunc moved_cb;
|
GFunc moved_cb;
|
||||||
gpointer moved_cb_data;
|
gpointer moved_cb_data;
|
||||||
|
|
||||||
|
GFunc open_assoc_cb;
|
||||||
|
gpointer open_assoc_cb_data;
|
||||||
|
|
||||||
guint shift_state;
|
guint shift_state;
|
||||||
guint keyval_state;
|
guint keyval_state;
|
||||||
gboolean direct_update_cell; /** Indicates that this cell has special operation keys. */
|
gboolean direct_update_cell; /** Indicates that this cell has special operation keys. */
|
||||||
|
Loading…
Reference in New Issue
Block a user