mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Provide a callback whereby the core register code can tell the upper
layers that it has moved from an expanded transaction to a collapsed transaction. This lets the upper layer adjust the "split" transaction toolbar button properly. Fixes 332165. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13361 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
9958820d8e
commit
df6173132b
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
2006-02-22 David Hampton <hampton@employees.org>
|
||||
|
||||
* src/register/ledger-core/split-register.[ch]:
|
||||
* src/register/ledger-core/split-register-control.c:
|
||||
* src/gnome/gnc-plugin-page-register.c: Provide a callback whereby
|
||||
the core register code can tell the upper layers that it has moved
|
||||
from an expanded transaction to a collapsed transaction. This
|
||||
lets the upper layer adjust the "split" transaction toolbar button
|
||||
properly. Fixes 332165.
|
||||
|
||||
2006-02-21 David Hampton <hampton@employees.org>
|
||||
|
||||
* src/gnome/gnc-plugin-page-register.c: Fix from Andreas Köhler to
|
||||
|
@ -146,6 +146,8 @@ static void gnc_plugin_page_register_cmd_transaction_report (GtkAction *action,
|
||||
static void gnc_plugin_page_help_changed_cb( GNCSplitReg *gsr, GncPluginPageRegister *register_page );
|
||||
static void gnc_plugin_page_register_refresh_cb (GHashTable *changes, gpointer user_data);
|
||||
|
||||
static void gnc_plugin_page_register_update_split_button (SplitRegister *reg, GncPluginPageRegister *page);
|
||||
|
||||
/************************************************************/
|
||||
/* Actions */
|
||||
/************************************************************/
|
||||
@ -407,6 +409,7 @@ gnc_plugin_page_register_new_common (GNCLedgerDisplay *ledger)
|
||||
GncPluginPageRegisterPrivate *priv;
|
||||
GncPluginPage *plugin_page;
|
||||
GNCSplitReg *gsr;
|
||||
SplitRegister *reg;
|
||||
const GList *item;
|
||||
GList *book_list;
|
||||
gchar *label;
|
||||
@ -440,6 +443,10 @@ gnc_plugin_page_register_new_common (GNCLedgerDisplay *ledger)
|
||||
gnc_plugin_page_add_book (plugin_page, (QofBook *)item->data);
|
||||
// Do not free the list. It is owned by the query.
|
||||
|
||||
reg = gnc_ledger_display_get_split_register(priv->ledger);
|
||||
gnc_split_register_set_trans_collapsed_cb
|
||||
(reg, (GFunc)gnc_plugin_page_register_update_split_button, register_page);
|
||||
|
||||
priv->component_manager_id = 0;
|
||||
return plugin_page;
|
||||
}
|
||||
@ -577,6 +584,26 @@ gnc_plugin_page_register_get_account (GncPluginPageRegister *page)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gnc_plugin_page_register_update_split_button (SplitRegister *reg, GncPluginPageRegister *page)
|
||||
{
|
||||
GtkActionGroup *action_group;
|
||||
GtkAction *action;
|
||||
gboolean expanded;
|
||||
|
||||
expanded = gnc_split_register_current_trans_expanded(reg);
|
||||
|
||||
action_group = gnc_plugin_page_get_action_group(GNC_PLUGIN_PAGE(page));
|
||||
action = gtk_action_group_get_action (action_group,
|
||||
"SplitTransactionAction");
|
||||
|
||||
g_signal_handlers_block_by_func
|
||||
(action, gnc_plugin_page_register_cmd_expand_transaction, page);
|
||||
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION(action), expanded);
|
||||
g_signal_handlers_unblock_by_func
|
||||
(action, gnc_plugin_page_register_cmd_expand_transaction, page);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_plugin_page_register_update_toolbar (GncPluginPageRegister *page, SplitRegisterStyle style)
|
||||
{
|
||||
|
@ -448,7 +448,7 @@ gnc_split_register_move_cursor (VirtualLocation *p_new_virt_loc,
|
||||
reg->style == REG_STYLE_JOURNAL);
|
||||
}
|
||||
|
||||
info->trans_expanded = FALSE;
|
||||
gnc_split_register_collapse_current_trans(reg);
|
||||
|
||||
do_refresh = TRUE;
|
||||
}
|
||||
|
@ -229,6 +229,29 @@ gnc_split_register_expand_current_trans (SplitRegister *reg, gboolean expand)
|
||||
reg->table->current_cursor_loc.vcell_loc);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_split_register_collapse_current_trans (SplitRegister *reg)
|
||||
{
|
||||
SRInfo *info = gnc_split_register_get_info (reg);
|
||||
|
||||
if (!reg)
|
||||
return;
|
||||
|
||||
info->trans_expanded = FALSE;
|
||||
if (reg->expand_changed_cb)
|
||||
(reg->expand_changed_cb)(reg, reg->expand_changed_cb_data);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_split_register_set_trans_collapsed_cb (SplitRegister *reg, GFunc cb, gpointer cb_data)
|
||||
{
|
||||
if (!reg)
|
||||
return;
|
||||
|
||||
reg->expand_changed_cb = cb;
|
||||
reg->expand_changed_cb_data = cb_data;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gnc_split_register_current_trans_expanded (SplitRegister *reg)
|
||||
{
|
||||
@ -540,7 +563,7 @@ gnc_split_register_duplicate_current (SplitRegister *reg)
|
||||
info->cursor_hint_trans_split = trans_split;
|
||||
info->cursor_hint_cursor_class = CURSOR_CLASS_TRANS;
|
||||
|
||||
info->trans_expanded = FALSE;
|
||||
gnc_split_register_collapse_current_trans(reg);
|
||||
}
|
||||
|
||||
/* Refresh the GUI. */
|
||||
@ -928,7 +951,7 @@ gnc_split_register_delete_current_trans (SplitRegister *reg)
|
||||
return;
|
||||
}
|
||||
|
||||
info->trans_expanded = FALSE;
|
||||
gnc_split_register_collapse_current_trans(reg);
|
||||
|
||||
gnc_suspend_gui_refresh ();
|
||||
|
||||
@ -980,7 +1003,7 @@ gnc_split_register_void_current_trans (SplitRegister *reg, const char *reason)
|
||||
if (xaccSplitGetReconcile (split) == VREC)
|
||||
return;
|
||||
|
||||
info->trans_expanded = FALSE;
|
||||
gnc_split_register_collapse_current_trans(reg);
|
||||
|
||||
gnc_suspend_gui_refresh ();
|
||||
|
||||
@ -1029,7 +1052,7 @@ gnc_split_register_unvoid_current_trans (SplitRegister *reg)
|
||||
if (xaccSplitGetReconcile (split) != VREC)
|
||||
return;
|
||||
|
||||
info->trans_expanded = FALSE;
|
||||
gnc_split_register_collapse_current_trans(reg);
|
||||
|
||||
gnc_suspend_gui_refresh ();
|
||||
|
||||
|
@ -240,6 +240,9 @@ struct split_register
|
||||
{
|
||||
Table * table; /**< The table itself that implements the underlying GUI. */
|
||||
|
||||
GFunc expand_changed_cb;
|
||||
gpointer expand_changed_cb_data;
|
||||
|
||||
SplitRegisterType type;
|
||||
SplitRegisterStyle style;
|
||||
|
||||
@ -410,6 +413,14 @@ void gnc_split_register_show_present_divider (SplitRegister *reg,
|
||||
void gnc_split_register_expand_current_trans (SplitRegister *reg,
|
||||
gboolean expand);
|
||||
|
||||
/** Mark the current transaction as collapsed, and do callbacks. */
|
||||
void gnc_split_register_collapse_current_trans (SplitRegister *reg);
|
||||
|
||||
/** Register a callback function for when the register closes a
|
||||
* transaction without the user explicitly asking for this to
|
||||
* be changed. */
|
||||
void gnc_split_register_set_trans_collapsed_cb (SplitRegister *reg, GFunc cb, gpointer cb_data);
|
||||
|
||||
/** Return TRUE if current trans is expanded and style is REG_STYLE_LEDGER. */
|
||||
gboolean gnc_split_register_current_trans_expanded (SplitRegister *reg);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user