GnuCash  4.11-137-g155922540d+
Files | Data Structures | Macros | Functions

Files

file  gnc-plugin-page-register.c
 Functions providing a register page for the GnuCash UI.
 
file  gnc-plugin-page-register.h
 Functions providing a register page for the GnuCash UI.
 
file  gnc-plugin-page-register.c
 Functions providing a register page for the GnuCash UI.
 

Data Structures

struct  status_action
 
struct  GncPluginPageRegisterPrivate
 
struct  GncPluginPageRegister
 
struct  GncPluginPageRegisterClass
 
struct  GncPluginPageRegister2Private
 

Macros

#define DEFAULT_LINES_AMOUNT   50
 
#define DEFAULT_FILTER_NUM_DAYS_GL   "30"
 
#define CUT_TRANSACTION_LABEL   N_("Cu_t Transaction")
 
#define COPY_TRANSACTION_LABEL   N_("_Copy Transaction")
 
#define PASTE_TRANSACTION_LABEL   N_("_Paste Transaction")
 
#define DUPLICATE_TRANSACTION_LABEL   N_("Dup_licate Transaction")
 
#define DELETE_TRANSACTION_LABEL   N_("_Delete Transaction")
 
#define LINK_TRANSACTION_LABEL   N_("_Manage Document Link...")
 
#define LINK_TRANSACTION_OPEN_LABEL   N_("_Open Linked Document")
 
#define JUMP_LINKED_INVOICE_LABEL   N_("Jump to Invoice")
 
#define CUT_SPLIT_LABEL   N_("Cu_t Split")
 
#define COPY_SPLIT_LABEL   N_("_Copy Split")
 
#define PASTE_SPLIT_LABEL   N_("_Paste Split")
 
#define DUPLICATE_SPLIT_LABEL   N_("Dup_licate Split")
 
#define DELETE_SPLIT_LABEL   N_("_Delete Split")
 
#define CUT_TRANSACTION_TIP   N_("Cut the selected transaction into clipboard")
 
#define COPY_TRANSACTION_TIP   N_("Copy the selected transaction into clipboard")
 
#define PASTE_TRANSACTION_TIP   N_("Paste the transaction from the clipboard")
 
#define DUPLICATE_TRANSACTION_TIP   N_("Make a copy of the current transaction")
 
#define DELETE_TRANSACTION_TIP   N_("Delete the current transaction")
 
#define LINK_TRANSACTION_TIP   N_("Add, change, or unlink the document linked with the current transaction")
 
#define LINK_TRANSACTION_OPEN_TIP   N_("Open the linked document for the current transaction")
 
#define JUMP_LINKED_INVOICE_TIP   N_("Jump to the linked bill, invoice, or voucher")
 
#define CUT_SPLIT_TIP   N_("Cut the selected split into clipboard")
 
#define COPY_SPLIT_TIP   N_("Copy the selected split into clipboard")
 
#define PASTE_SPLIT_TIP   N_("Paste the split from the clipboard")
 
#define DUPLICATE_SPLIT_TIP   N_("Make a copy of the current split")
 
#define DELETE_SPLIT_TIP   N_("Delete the current split")
 
#define CLEARED_VALUE   "cleared_value"
 
#define DEFAULT_FILTER   "0x001f"
 
#define DEFAULT_SORT_ORDER   "BY_STANDARD"
 
#define KEY_REGISTER_TYPE   "RegisterType"
 
#define KEY_ACCOUNT_NAME   "AccountName"
 
#define KEY_ACCOUNT_GUID   "AccountGuid"
 
#define KEY_REGISTER_STYLE   "RegisterStyle"
 
#define KEY_DOUBLE_LINE   "DoubleLineMode"
 
#define LABEL_ACCOUNT   "Account"
 
#define LABEL_SUBACCOUNT   "SubAccount"
 
#define LABEL_GL   "GL"
 
#define LABEL_SEARCH   "Search"
 
#define GNC_TYPE_PLUGIN_PAGE_REGISTER   (gnc_plugin_page_register_get_type ())
 
#define GNC_PLUGIN_PAGE_REGISTER(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_PAGE_REGISTER, GncPluginPageRegister))
 
#define GNC_PLUGIN_PAGE_REGISTER_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_PAGE_REGISTER, GncPluginPageRegisterClass))
 
#define GNC_IS_PLUGIN_PAGE_REGISTER(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_PAGE_REGISTER))
 
#define GNC_IS_PLUGIN_PAGE_REGISTER_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_PAGE_REGISTER))
 
#define GNC_PLUGIN_PAGE_REGISTER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_PAGE_REGISTER, GncPluginPageRegisterClass))
 
#define GNC_PLUGIN_PAGE_REGISTER_NAME   "GncPluginPageRegister"
 
#define DEFAULT_LINES_AMOUNT   50
 
#define CUT_TRANSACTION_LABEL   N_("Cu_t Transaction")
 
#define COPY_TRANSACTION_LABEL   N_("_Copy Transaction")
 
#define PASTE_TRANSACTION_LABEL   N_("_Paste Transaction")
 
#define DUPLICATE_TRANSACTION_LABEL   N_("Dup_licate Transaction")
 
#define DELETE_TRANSACTION_LABEL   N_("_Delete Transaction")
 
#define CUT_SPLIT_LABEL   N_("Cu_t Split")
 
#define COPY_SPLIT_LABEL   N_("_Copy Split")
 
#define PASTE_SPLIT_LABEL   N_("_Paste Split")
 
#define DUPLICATE_SPLIT_LABEL   N_("Dup_licate Split")
 
#define DELETE_SPLIT_LABEL   N_("_Delete Split")
 
#define CUT_TRANSACTION_TIP   N_("Cut the selected transaction into clipboard")
 
#define COPY_TRANSACTION_TIP   N_("Copy the selected transaction into clipboard")
 
#define PASTE_TRANSACTION_TIP   N_("Paste the transaction from the clipboard")
 
#define DUPLICATE_TRANSACTION_TIP   N_("Make a copy of the current transaction")
 
#define DELETE_TRANSACTION_TIP   N_("Delete the current transaction")
 
#define CUT_SPLIT_TIP   N_("Cut the selected split into clipboard")
 
#define COPY_SPLIT_TIP   N_("Copy the selected split into clipboard")
 
#define PASTE_SPLIT_TIP   N_("Paste the split from the clipboard")
 
#define DUPLICATE_SPLIT_TIP   N_("Make a copy of the current split")
 
#define DELETE_SPLIT_TIP   N_("Delete the current split")
 
#define TRANSACTION_UP_ACTION   "TransactionUpAction"
 
#define TRANSACTION_DOWN_ACTION   "TransactionDownAction"
 
#define CLEARED_VALUE   "cleared_value"
 
#define DEFAULT_FILTER   "0x001f"
 
#define GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(o)   ((GncPluginPageRegister2Private*)g_type_instance_get_private((GTypeInstance*)o, GNC_TYPE_PLUGIN_PAGE_REGISTER2))
 
#define KEY_REGISTER_TYPE   "RegisterType"
 
#define KEY_ACCOUNT_NAME   "AccountName"
 
#define KEY_REGISTER_STYLE   "RegisterStyle"
 
#define KEY_DOUBLE_LINE   "DoubleLineMode"
 
#define KEY_EXTRA_DATES   "ExtraDatesMode"
 
#define LABEL_ACCOUNT   "Account"
 
#define LABEL_SUBACCOUNT   "SubAccount"
 
#define LABEL_GL   "GL"
 
#define LABEL_SEARCH   "Search"
 
#define SPLIT_REGISTER_GUID   "SplitRegister GUID"
 

Functions

void gnc_plugin_page_register_sort_button_cb (GtkToggleButton *button, GncPluginPageRegister *page)
 This function is called when a radio button in the "Sort By..." dialog is clicked. More...
 
void gnc_plugin_page_register_sort_response_cb (GtkDialog *dialog, gint response, GncPluginPageRegister *page)
 This function is called when the "Sort By..." dialog is closed. More...
 
void gnc_plugin_page_register_sort_order_save_cb (GtkToggleButton *button, GncPluginPageRegister *page)
 This function is called whenever the save sort order is checked or unchecked which allows saving of the sort order. More...
 
void gnc_plugin_page_register_sort_order_reverse_cb (GtkToggleButton *button, GncPluginPageRegister *page)
 This function is called whenever the reverse sort order is checked or unchecked which allows reversing of the sort order. More...
 
void gnc_plugin_page_register_set_sort_order (GncPluginPage *plugin_page, const gchar *sort_order)
 
void gnc_plugin_page_register_set_sort_reversed (GncPluginPage *plugin_page, gboolean reverse_order)
 
void gnc_plugin_page_register_filter_select_range_cb (GtkRadioButton *button, GncPluginPageRegister *page)
 This function is called when the radio buttons changes state. More...
 
void gnc_plugin_page_register_filter_start_cb (GtkWidget *radio, GncPluginPageRegister *page)
 This function is called when one of the start date radio buttons is selected. More...
 
void gnc_plugin_page_register_filter_end_cb (GtkWidget *radio, GncPluginPageRegister *page)
 This function is called when one of the end date radio buttons is selected. More...
 
void gnc_plugin_page_register_filter_response_cb (GtkDialog *dialog, gint response, GncPluginPageRegister *page)
 This function is called when the "Filter By..." dialog is closed. More...
 
void gnc_plugin_page_register_filter_status_all_cb (GtkButton *button, GncPluginPageRegister *page)
 This function is called whenever the "select all" status button is clicked. More...
 
void gnc_plugin_page_register_filter_status_one_cb (GtkToggleButton *button, GncPluginPageRegister *page)
 This function is called whenever one of the status entries is checked or unchecked. More...
 
void gnc_plugin_page_register_filter_save_cb (GtkToggleButton *button, GncPluginPageRegister *page)
 This function is called whenever the save status is checked or unchecked. More...
 
void gnc_plugin_page_register_filter_days_changed_cb (GtkSpinButton *button, GncPluginPageRegister *page)
 This function is called when the "number of days" spin button is changed which is then saved and updates the time limitation on the register query. More...
 
void gnc_plugin_page_register_set_filter (GncPluginPage *plugin_page, const gchar *filter)
 
 G_DEFINE_TYPE_WITH_PRIVATE (GncPluginPageRegister, gnc_plugin_page_register, GNC_TYPE_PLUGIN_PAGE)
 
GncPluginPagegnc_plugin_page_register_new (Account *account, gboolean subaccounts)
 Create a new "register" plugin page, given a pointer to an account. More...
 
GncPluginPagegnc_plugin_page_register_new_gl (void)
 Create a new "register" plugin page containing a general journal. More...
 
GncPluginPagegnc_plugin_page_register_new_ledger (GNCLedgerDisplay *ledger)
 Create a new "register" plugin page, given a pointer to an already created ledger. More...
 
Accountgnc_plugin_page_register_get_account (GncPluginPageRegister *page)
 Get the Account associated with this register page. More...
 
Transaction * gnc_plugin_page_register_get_current_txn (GncPluginPageRegister *page)
 Get the currently selected transaction in this register page. More...
 
Query * gnc_plugin_page_register_get_query (GncPluginPage *plugin_page)
 This function is called to get the query associated with this plugin page. More...
 
void gnc_plugin_page_register_clear_current_filter (GncPluginPage *plugin_page)
 This function clears the registers current filter. More...
 
void gnc_plugin_page_register_set_options (GncPluginPage *plugin_page, gint lines_default, gboolean read_only)
 Set various register options on a newly created "register" plugin page. More...
 
GNCSplitReg * gnc_plugin_page_register_get_gsr (GncPluginPage *plugin_page)
 Get the GNCSplitReg data structure associated with this register page. More...
 
GType gnc_plugin_page_register_get_type (void)
 Retrieve the type number for the plugin page. More...
 
void gnc_plugin_page_register2_filter_select_range_cb (GtkRadioButton *button, GncPluginPageRegister2 *page)
 This function is called when the "select range" radio button changes state. More...
 
void gnc_plugin_page_register2_filter_start_cb (GtkWidget *radio, GncPluginPageRegister2 *page)
 This function is called when one of the start date radio buttons is selected. More...
 
void gnc_plugin_page_register2_filter_end_cb (GtkWidget *radio, GncPluginPageRegister2 *page)
 This function is called when one of the end date radio buttons is selected. More...
 
void gnc_plugin_page_register2_filter_response_cb (GtkDialog *dialog, gint response, GncPluginPageRegister2 *page)
 This function is called when the "Filter By..." dialog is closed. More...
 
void gnc_plugin_page_register2_filter_status_all_cb (GtkButton *button, GncPluginPageRegister2 *page)
 This function is called whenever the "select all" status button is clicked. More...
 
void gnc_plugin_page_register2_filter_status_one_cb (GtkToggleButton *button, GncPluginPageRegister2 *page)
 This function is called whenever one of the status entries is checked or unchecked. More...
 
void gnc_plugin_page_register2_filter_save_cb (GtkToggleButton *button, GncPluginPageRegister2 *page)
 This function is called whenever the save status is checked or unchecked. More...
 
void gnc_plugin_page_register2_set_filter (GncPluginPage *plugin_page, const gchar *filter)
 
GncPluginPagegnc_plugin_page_register2_new (Account *account, gboolean subaccounts)
 Create a new "register" plugin page, given a pointer to an account. More...
 
GncPluginPagegnc_plugin_page_register2_new_gl (void)
 Create a new "register" plugin page containing a general journal. More...
 
GncPluginPagegnc_plugin_page_register2_new_ledger (GNCLedgerDisplay2 *ledger)
 Create a new "register" plugin page, given a pointer to an already created ledger. More...
 
Accountgnc_plugin_page_register2_get_account (GncPluginPageRegister2 *page)
 Get the Account associated with this register page. More...
 
Query * gnc_plugin_page_register2_get_query (GncPluginPage *plugin_page)
 This function is called to get the query associated with this plugin page. More...
 
void gnc_plugin_page_register2_set_options (GncPluginPage *plugin_page, gint lines_default, gboolean read_only)
 Set various register options on a newly created "register" plugin page. More...
 
GNCSplitReg2 * gnc_plugin_page_register2_get_gsr (GncPluginPage *plugin_page)
 Get the GNCSplitReg data structure associated with this register page. More...
 
GNCLedgerDisplay2 * gnc_plugin_page_register2_get_ledger (GncPluginPage *plugin_page)
 Get the GNCLedgerDisplay data structure associated with this register page. More...
 

Detailed Description

Function Documentation

◆ gnc_plugin_page_register2_filter_end_cb()

void gnc_plugin_page_register2_filter_end_cb ( GtkWidget *  radio,
GncPluginPageRegister2 page 
)

This function is called when one of the end date radio buttons is selected.

It updates the sensitivity of the date entry widget, then calls a common routine to determine the start/end times and update the register query.

*Note: This function is actually called twice for each new radio button selection. The first time call is to uncheck the old button, and the second time to check the new button. This does make a kind of sense, as radio buttons are nothing more than linked toggle buttons where only one can be active.

Parameters
radioThe button whose state is changing. This will be the previously selected button the first of the pair of calls to this function, and will be the newly selected button the second time.
pageA pointer to the GncPluginPageRegister2 that is associated with this filter dialog.

Definition at line 2259 of file gnc-plugin-page-register2.c.

2261 {
2263  const gchar *name;
2264  gboolean active;
2265 
2266  g_return_if_fail (GTK_IS_RADIO_BUTTON (radio));
2267  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
2268 
2269  ENTER("(radio %s(%p), page %p)", gtk_buildable_get_name (GTK_BUILDABLE (radio)), radio, page);
2270  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
2271  if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
2272  {
2273  LEAVE("1st callback of pair. Defer to 2nd callback.");
2274  return;
2275  }
2276 
2277  name = gtk_buildable_get_name (GTK_BUILDABLE (radio));
2278  active = (g_strcmp0 (name, g_strdup ("end_date_choose")) == 0 ? 1 : 0 );
2279  gtk_widget_set_sensitive (priv->fd.end_date, active);
2280  get_filter_times (page);
2281  gnc_ppr_update_date_query (page, TRUE);
2282  LEAVE(" ");
2283 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register2_filter_response_cb()

void gnc_plugin_page_register2_filter_response_cb ( GtkDialog *  dialog,
gint  response,
GncPluginPageRegister2 page 
)

This function is called when the "Filter By..." dialog is closed.

If the dialog was closed by any method other than clicking the OK button, the original filter will be restored.

Parameters
dialogA pointer to the dialog box.
responseA numerical value indicating why the dialog box was closed.
pageA pointer to the GncPluginPageRegister2 associated with this dialog box.

Definition at line 2325 of file gnc-plugin-page-register2.c.

2328 {
2330  GncPluginPage *plugin_page;
2331 
2332  g_return_if_fail (GTK_IS_DIALOG (dialog));
2333  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
2334 
2335  ENTER(" ");
2336  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
2337  plugin_page = GNC_PLUGIN_PAGE (page);
2338 
2339  if (response != GTK_RESPONSE_OK)
2340  {
2341  /* Remove the old status match */
2342  priv->fd.cleared_match = priv->fd.original_cleared_match;
2343  gnc_ppr_update_status_query (page, FALSE);
2344  priv->fd.start_time = priv->fd.original_start_time;
2345  priv->fd.end_time = priv->fd.original_end_time;
2346  priv->fd.save_filter = priv->fd.original_save_filter;
2347  gnc_ppr_update_date_query (page, FALSE);
2348  gnc_ledger_display2_refresh (priv->ledger);
2349  }
2350  else
2351  {
2352  priv->fd.original_save_filter = priv->fd.save_filter;
2353 
2354  if (priv->fd.save_filter)
2355  {
2356  gchar* filter;
2357  filter = g_strdup_printf ("0x%04x", priv->fd.cleared_match);
2358 
2359  if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.start_date_choose)) && priv->fd.start_time != 0 )
2360  {
2361  gchar *timeval = gnc_plugin_page_register2_filter_time2dmy (priv->fd.start_time);
2362  filter = g_strconcat (filter, ",", timeval, NULL);
2363  g_free (timeval);
2364  }
2365  else
2366  filter = g_strconcat (filter, ",0", NULL);
2367 
2368  if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.end_date_choose)) && priv->fd.end_time != 0 )
2369  {
2370  gchar *timeval = gnc_plugin_page_register2_filter_time2dmy (priv->fd.end_time);
2371  filter = g_strconcat (filter, ",", timeval, NULL);
2372  g_free (timeval);
2373  }
2374  else
2375  filter = g_strconcat (filter, ",0", NULL);
2376 
2377  PINFO("The filter to save is %s", filter);
2378 
2379  gnc_plugin_page_register2_set_filter (plugin_page, filter);
2380  g_free (filter);
2381  }
2382  }
2383  priv->fd.dialog = NULL;
2384  gtk_widget_destroy (GTK_WIDGET (dialog));
2385  LEAVE(" ");
2386 }
The instance data structure for a content plugin.
void gnc_ledger_display2_refresh(GNCLedgerDisplay2 *ld)
redisplay/redraw only the indicated window.
#define PINFO(format, args...)
Print an informational note.
Definition: qoflog.h:256
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register2_filter_save_cb()

void gnc_plugin_page_register2_filter_save_cb ( GtkToggleButton *  button,
GncPluginPageRegister2 page 
)

This function is called whenever the save status is checked or unchecked.

It will allow saving of the filter if required.

Parameters
buttonThe toggle button that was changed.
pageA pointer to the GncPluginPageRegister2 that is associated with this filter dialog.

Definition at line 2294 of file gnc-plugin-page-register2.c.

2296 {
2298 
2299  g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
2300  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
2301 
2302  ENTER("Save toggle button (%p), plugin_page %p", button, page);
2303 
2304  /* Compute the new save filter status */
2305  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
2306  if (gtk_toggle_button_get_active (button))
2307  priv->fd.save_filter = TRUE;
2308  else
2309  priv->fd.save_filter = FALSE;
2310  LEAVE(" ");
2311 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register2_filter_select_range_cb()

void gnc_plugin_page_register2_filter_select_range_cb ( GtkRadioButton *  button,
GncPluginPageRegister2 page 
)

This function is called when the "select range" radio button changes state.

Since there are only two choices in this radio group, this one signal can be used to handle all cases. This function is responsible for setting the sensitivity of the table of widgets underneath the "select range" choice, and updating the time limitation on the register query. This is handled by a helper function when the radio button is selected (as potentially all the widgets in the table need to be inspected), and is trivial for the other case.

Parameters
buttonA pointer to the "select range" radio button.
pageA pointer to the GncPluginPageRegister2 that is associated with this filter dialog.

Definition at line 2145 of file gnc-plugin-page-register2.c.

2147 {
2149  gboolean active;
2150 
2151  g_return_if_fail (GTK_IS_RADIO_BUTTON (button));
2152  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
2153 
2154  ENTER("(button %p, page %p)", button, page);
2155  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
2156  active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
2157  gtk_widget_set_sensitive (priv->fd.table, active);
2158  if (active)
2159  {
2160  get_filter_times (page);
2161  }
2162  else
2163  {
2164  priv->fd.start_time = 0;
2165  priv->fd.end_time = 0;
2166  }
2167  gnc_ppr_update_date_query (page, TRUE);
2168  LEAVE(" ");
2169 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register2_filter_start_cb()

void gnc_plugin_page_register2_filter_start_cb ( GtkWidget *  radio,
GncPluginPageRegister2 page 
)

This function is called when one of the start date radio buttons is selected.

It updates the sensitivity of the date entry widget, then calls a common routine to determine the start/end times and update the register query.

*Note: This function is actually called twice for each new radio button selection. The first time call is to uncheck the old button, and the second time to check the new button. This does make a kind of sense, as radio buttons are nothing more than linked toggle buttons where only one can be active.

Parameters
radioThe button whose state is changing. This will be the previously selected button the first of the pair of calls to this function, and will be the newly selected button the second time.
pageA pointer to the GncPluginPageRegister2 that is associated with this filter dialog.

Definition at line 2213 of file gnc-plugin-page-register2.c.

2215 {
2217  const gchar *name;
2218  gboolean active;
2219 
2220  g_return_if_fail (GTK_IS_RADIO_BUTTON (radio));
2221  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
2222 
2223  ENTER("(radio %s(%p), page %p)", gtk_buildable_get_name (GTK_BUILDABLE (radio)), radio, page);
2224  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
2225  if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
2226  {
2227  LEAVE("1st callback of pair. Defer to 2nd callback.");
2228  return;
2229  }
2230 
2231  name = gtk_buildable_get_name (GTK_BUILDABLE (radio));
2232  active = (g_strcmp0 (name, g_strdup ("start_date_choose")) == 0 ? 1 : 0 );
2233  gtk_widget_set_sensitive (priv->fd.start_date, active);
2234  get_filter_times (page);
2235  gnc_ppr_update_date_query (page, TRUE);
2236  LEAVE(" ");
2237 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register2_filter_status_all_cb()

void gnc_plugin_page_register2_filter_status_all_cb ( GtkButton *  button,
GncPluginPageRegister2 page 
)

This function is called whenever the "select all" status button is clicked.

It updates all of the checkbox widgets, then updates the query on the register.

Parameters
buttonThe button that was clicked.
pageA pointer to the GncPluginPageRegister2 that is associated with this filter dialog.

Definition at line 2046 of file gnc-plugin-page-register2.c.

2048 {
2050  GtkWidget *widget;
2051  gint i;
2052 
2053  g_return_if_fail (GTK_IS_BUTTON (button));
2054  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
2055 
2056  ENTER("(button %p, page %p)", button, page);
2057 
2058  /* Turn on all the check menu items */
2059  for (i = 0; status_actions[i].action_name; i++)
2060  {
2061  widget = status_actions[i].widget;
2062  g_signal_handlers_block_by_func (widget, gnc_plugin_page_register2_filter_status_one_cb, page);
2063  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
2064  g_signal_handlers_unblock_by_func (widget, gnc_plugin_page_register2_filter_status_one_cb, page);
2065  }
2066 
2067  /* Set the requested status */
2068  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
2069  priv->fd.cleared_match = CLEARED_ALL;
2070  gnc_ppr_update_status_query (page, TRUE);
2071  LEAVE(" ");
2072 }
void gnc_plugin_page_register2_filter_status_one_cb(GtkToggleButton *button, GncPluginPageRegister2 *page)
This function is called whenever one of the status entries is checked or unchecked.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register2_filter_status_one_cb()

void gnc_plugin_page_register2_filter_status_one_cb ( GtkToggleButton *  button,
GncPluginPageRegister2 page 
)

This function is called whenever one of the status entries is checked or unchecked.

It updates the status value maintained for the filter dialog, and calls another function to do the work of applying the change to the register itself.

Parameters
buttonThe toggle button that was changed.
pageA pointer to the GncPluginPageRegister2 that is associated with this filter dialog.

Definition at line 2002 of file gnc-plugin-page-register2.c.

2004 {
2006  const gchar *name;
2007  gint i, value;
2008 
2009  g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
2010  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
2011 
2012  name = gtk_buildable_get_name (GTK_BUILDABLE (button));
2013  ENTER("toggle button %s (%p), plugin_page %p", name, button, page);
2014 
2015  /* Determine what status bit to change */
2016  value = CLEARED_NONE;
2017  for (i = 0; status_actions[i].action_name; i++)
2018  {
2019  if (g_strcmp0 (name, status_actions[i].action_name) == 0)
2020  {
2021  value = status_actions[i].value;
2022  break;
2023  }
2024  }
2025 
2026  /* Compute the new match status */
2027  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
2028  if (gtk_toggle_button_get_active (button))
2029  priv->fd.cleared_match |= value;
2030  else
2031  priv->fd.cleared_match &= ~value;
2032  gnc_ppr_update_status_query (page, TRUE);
2033  LEAVE(" ");
2034 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register2_get_account()

Account* gnc_plugin_page_register2_get_account ( GncPluginPageRegister2 page)

Get the Account associated with this register page.

Parameters
pageA "register" page.
Returns
The account if the register contains only a single account, or an account and its sub-accounts. NULL otherwise.

Definition at line 799 of file gnc-plugin-page-register2.c.

800 {
802  GNCLedgerDisplay2Type ledger_type;
803  Account *leader;
804 
805  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
806  ledger_type = gnc_ledger_display2_type (priv->ledger);
807  leader = gnc_ledger_display2_leader (priv->ledger);
808 
809  if ((ledger_type == LD2_SINGLE) || (ledger_type == LD2_SUBACCOUNT))
810  return leader;
811  return NULL;
812 }
Account * gnc_ledger_display2_leader(GNCLedgerDisplay2 *ld)
Implementations.

◆ gnc_plugin_page_register2_get_gsr()

GNCSplitReg2* gnc_plugin_page_register2_get_gsr ( GncPluginPage plugin_page)

Get the GNCSplitReg data structure associated with this register page.

Parameters
plugin_pageA "register" page.

Definition at line 3882 of file gnc-plugin-page-register2.c.

3883 {
3884  GncPluginPageRegister2 *page;
3886 
3887  g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page), NULL);
3888 
3889  page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
3890  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
3891 
3892  return priv->gsr;
3893 }

◆ gnc_plugin_page_register2_get_ledger()

GNCLedgerDisplay2* gnc_plugin_page_register2_get_ledger ( GncPluginPage plugin_page)

Get the GNCLedgerDisplay data structure associated with this register page.

Parameters
plugin_pageA "register" page.

Definition at line 3897 of file gnc-plugin-page-register2.c.

3898 {
3899  GncPluginPageRegister2 *page;
3901 
3902  g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page), NULL);
3903 
3904  page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
3905  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
3906 
3907  return priv->ledger;
3908 }

◆ gnc_plugin_page_register2_get_query()

Query* gnc_plugin_page_register2_get_query ( GncPluginPage plugin_page)

This function is called to get the query associated with this plugin page.

Get the Query associated with this "register" plugin page.

Parameters
pageA pointer to the GncPluginPage.

Definition at line 1839 of file gnc-plugin-page-register2.c.

1840 {
1841  GncPluginPageRegister2 *page;
1843 
1844  g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page), NULL);
1845 
1846  page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
1847  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
1848  return gnc_ledger_display2_get_query (priv->ledger);
1849 }
Query * gnc_ledger_display2_get_query(GNCLedgerDisplay2 *ld)
return the query associated with a ledger

◆ gnc_plugin_page_register2_new()

GncPluginPage* gnc_plugin_page_register2_new ( Account account,
gboolean  subaccounts 
)

Create a new "register" plugin page, given a pointer to an account.

Parameters
accountThe pointer to the account to embed in the register.
subaccountsTRUE if all the sub-accounts of the specified account should be included in the register.
Returns
The newly created plugin page.

Definition at line 652 of file gnc-plugin-page-register2.c.

653 {
654  GNCLedgerDisplay2 *ledger;
655  GncPluginPage *page;
657  gnc_commodity* com0;
658  gnc_commodity* com1;
659 
660 /*################## Added for Reg2 #################*/
661  const GList *item;
662  GncPluginPageRegister *old_register_page;
663 /*################## Added for Reg2 #################*/
664 
665  ENTER("account=%p, subaccounts=%s", account,
666  subaccounts ? "TRUE" : "FALSE");
667 
668 /*################## Added for Reg2 #################*/
669  // We test for the old register being open here, ie matching account guids
670  item = gnc_gobject_tracking_get_list (GNC_PLUGIN_PAGE_REGISTER_NAME);
671  for ( ; item; item = g_list_next (item))
672  {
673  Account *old_account;
674  old_register_page = (GncPluginPageRegister *)item->data;
675  old_account = gnc_plugin_page_register_get_account (old_register_page);
676 
677  if (guid_equal (xaccAccountGetGUID (account), xaccAccountGetGUID (old_account)))
678  {
679  GtkWindow *window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (old_register_page)));
680  gnc_error_dialog (window, "%s",
681  _("You have tried to open an account in the new register while it is open in the old register."));
682  return NULL;
683  }
684  }
685 /*################## Added for Reg2 #################*/
686  com0 = gnc_account_get_currency_or_parent(account);
687  com1 = gnc_account_foreach_descendant_until(account,gnc_plug_page_register_check_commodity,com0);
688  if (subaccounts)
689  ledger = gnc_ledger_display2_subaccounts (account,com1!=NULL);
690  else
691  ledger = gnc_ledger_display2_simple (account);
692 
693  page = gnc_plugin_page_register2_new_common (ledger);
694  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
695  priv->key = *xaccAccountGetGUID (account);
696 
697  LEAVE("%p", page);
698  return page;
699 }
GtkWidget * gnc_plugin_page_get_window(GncPluginPage *page)
Retrieve a pointer to the GncMainWindow (GtkWindow) containing this page.
The instance data structure for a content plugin.
const GList * gnc_gobject_tracking_get_list(const gchar *name)
Get a list of all known objects of a specified type.
GNCLedgerDisplay2 * gnc_ledger_display2_subaccounts(Account *account, gboolean mismatched_commodities)
opens up a register window to display the parent account and all of its children. ...
gpointer gnc_account_foreach_descendant_until(const Account *acc, AccountCb2 thunk, gpointer user_data)
This method will traverse all children of this accounts and their descendants, calling 'func' on each...
Definition: Account.cpp:3253
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define xaccAccountGetGUID(X)
Definition: Account.h:248
gboolean guid_equal(const GncGUID *guid_1, const GncGUID *guid_2)
Given two GUIDs, return TRUE if they are non-NULL and equal.
Definition: guid.cpp:204
gnc_commodity * gnc_account_get_currency_or_parent(const Account *account)
Returns a gnc_commodity that is a currency, suitable for being a Transaction's currency.
Definition: Account.cpp:3455
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
Account * gnc_plugin_page_register_get_account(GncPluginPageRegister *page)
Get the Account associated with this register page.
GNCLedgerDisplay2 * gnc_ledger_display2_simple(Account *account)
opens up a register window to display a single account

◆ gnc_plugin_page_register2_new_gl()

GncPluginPage* gnc_plugin_page_register2_new_gl ( void  )

Create a new "register" plugin page containing a general journal.

Returns
The newly created plugin page.

Definition at line 702 of file gnc-plugin-page-register2.c.

703 {
704  GNCLedgerDisplay2 *ledger;
705 
706  ledger = gnc_ledger_display2_gl ();
707  return gnc_plugin_page_register2_new_common (ledger);
708 }
GNCLedgerDisplay2 * gnc_ledger_display2_gl(void)
opens up a general ledger window

◆ gnc_plugin_page_register2_new_ledger()

GncPluginPage* gnc_plugin_page_register2_new_ledger ( GNCLedgerDisplay2 *  ledger)

Create a new "register" plugin page, given a pointer to an already created ledger.

This function should be used when the ledger already exists. (E.G. From the "find transaction" code, or from the scheduled transaction code.)

Parameters
ledgerThe pointer to the ledger to embed into the register.
Returns
The newly created plugin page.

Definition at line 711 of file gnc-plugin-page-register2.c.

712 {
713  return gnc_plugin_page_register2_new_common (ledger);
714 }

◆ gnc_plugin_page_register2_set_options()

void gnc_plugin_page_register2_set_options ( GncPluginPage plugin_page,
gint  lines_default,
gboolean  read_only 
)

Set various register options on a newly created "register" plugin page.

Parameters
plugin_pageThe "register" page to modify.
lines_defaultUsed to calculate the minimum preferred height of the plugin page.
read_onlyTrue if the register should be read-only.

Definition at line 3866 of file gnc-plugin-page-register2.c.

3869 {
3870  GncPluginPageRegister2 *page;
3872 
3873  g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
3874 
3875  page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
3876  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
3877  priv->lines_default = lines_default;
3878  priv->read_only = read_only;
3879 }

◆ gnc_plugin_page_register_clear_current_filter()

void gnc_plugin_page_register_clear_current_filter ( GncPluginPage plugin_page)

This function clears the registers current filter.

It is used so jumps to splits from other places can be completed otherwise the jump will be to the last active cell.

Parameters
plugin_pageA pointer to the GncPluginPageRegister.

Definition at line 3104 of file gnc-plugin-page-register.c.

3105 {
3107 
3108  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page));
3109 
3110  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (plugin_page);
3111 
3112  priv->fd.days = 0;
3113  priv->fd.start_time = 0;
3114  priv->fd.end_time = 0;
3115  priv->fd.cleared_match = (gint)g_ascii_strtoll (DEFAULT_FILTER, NULL, 16);
3116 
3117  gnc_ppr_update_date_query (GNC_PLUGIN_PAGE_REGISTER(plugin_page));
3118 }

◆ gnc_plugin_page_register_filter_days_changed_cb()

void gnc_plugin_page_register_filter_days_changed_cb ( GtkSpinButton *  button,
GncPluginPageRegister page 
)

This function is called when the "number of days" spin button is changed which is then saved and updates the time limitation on the register query.

This is handled by a helper function as potentially all widgets will need to be examined.

Parameters
buttonA pointer to the "number of days" spin button.
pageA pointer to the GncPluginPageRegister that is associated with this filter dialog.

Definition at line 3131 of file gnc-plugin-page-register.c.

3133 {
3135 
3136  g_return_if_fail (GTK_IS_SPIN_BUTTON (button));
3137  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3138 
3139  ENTER ("(button %p, page %p)", button, page);
3140  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3141 
3142  priv->fd.days = gtk_spin_button_get_value (GTK_SPIN_BUTTON (button));
3143  gnc_ppr_update_date_query (page);
3144  LEAVE (" ");
3145 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register_filter_end_cb()

void gnc_plugin_page_register_filter_end_cb ( GtkWidget *  radio,
GncPluginPageRegister page 
)

This function is called when one of the end date radio buttons is selected.

It updates the sensitivity of the date entry widget, then calls a common routine to determine the start/end times and update the register query.

*Note: This function is actually called twice for each new radio button selection. The first time call is to uncheck the old button, and the second time to check the new button. This does make a kind of sense, as radio buttons are nothing more than linked toggle buttons where only one can be active.

Parameters
radioThe button whose state is changing. This will be the previously selected button the first of the pair of calls to this function, and will be the newly selected button the second time.
pageA pointer to the GncPluginPageRegister that is associated with this filter dialog.

Definition at line 3240 of file gnc-plugin-page-register.c.

3242 {
3244  const gchar* name;
3245  gboolean active;
3246 
3247  g_return_if_fail (GTK_IS_RADIO_BUTTON (radio));
3248  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3249 
3250  ENTER ("(radio %s(%p), page %p)",
3251  gtk_buildable_get_name (GTK_BUILDABLE (radio)), radio, page);
3252  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3253  if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
3254  {
3255  LEAVE ("1st callback of pair. Defer to 2nd callback.");
3256  return;
3257  }
3258 
3259  name = gtk_buildable_get_name (GTK_BUILDABLE (radio));
3260  active = !g_strcmp0 (name, "end_date_choose");
3261  gtk_widget_set_sensitive (priv->fd.end_date, active);
3262  get_filter_times (page);
3263  gnc_ppr_update_date_query (page);
3264  LEAVE (" ");
3265 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register_filter_response_cb()

void gnc_plugin_page_register_filter_response_cb ( GtkDialog *  dialog,
gint  response,
GncPluginPageRegister page 
)

This function is called when the "Filter By..." dialog is closed.

If the dialog was closed by any method other than clicking the OK button, the original sorting order will be restored.

Parameters
dialogA pointer to the dialog box.
responseA numerical value indicating why the dialog box was closed.
pageA pointer to the GncPluginPageRegister associated with this dialog box.

Definition at line 3309 of file gnc-plugin-page-register.c.

3312 {
3314  GncPluginPage* plugin_page;
3315 
3316  g_return_if_fail (GTK_IS_DIALOG (dialog));
3317  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3318 
3319  ENTER (" ");
3320  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3321  plugin_page = GNC_PLUGIN_PAGE (page);
3322 
3323  if (response != GTK_RESPONSE_OK)
3324  {
3325  /* Remove the old status match */
3326  priv->fd.cleared_match = priv->fd.original_cleared_match;
3327  priv->enable_refresh = FALSE;
3328  gnc_ppr_update_status_query (page);
3329  priv->enable_refresh = TRUE;
3330  priv->fd.start_time = priv->fd.original_start_time;
3331  priv->fd.end_time = priv->fd.original_end_time;
3332  priv->fd.days = priv->fd.original_days;
3333  priv->fd.save_filter = priv->fd.original_save_filter;
3334  gnc_ppr_update_date_query (page);
3335  }
3336  else
3337  {
3338  // clear the filter when unticking the save option
3339  if ((priv->fd.save_filter == FALSE) && (priv->fd.original_save_filter == TRUE))
3340  gnc_plugin_page_register_set_filter (plugin_page, NULL);
3341 
3342  priv->fd.original_save_filter = priv->fd.save_filter;
3343 
3344  if (priv->fd.save_filter)
3345  {
3346  gchar *filter;
3347  GList *flist = NULL;
3348 
3349  // cleared match
3350  flist = g_list_prepend
3351  (flist, g_strdup_printf ("0x%04x", priv->fd.cleared_match));
3352 
3353  // start time
3354  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.start_date_choose)) && priv->fd.start_time != 0)
3355  flist = g_list_prepend (flist, gnc_plugin_page_register_filter_time2dmy (priv->fd.start_time));
3356  else
3357  flist = g_list_prepend (flist, g_strdup ("0"));
3358 
3359  // end time
3360  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.end_date_choose))
3361  && priv->fd.end_time != 0)
3362  flist = g_list_prepend (flist, gnc_plugin_page_register_filter_time2dmy (priv->fd.end_time));
3363  else
3364  flist = g_list_prepend (flist, g_strdup ("0"));
3365 
3366  // number of days
3367  if (priv->fd.days > 0)
3368  flist = g_list_prepend (flist, g_strdup_printf ("%d", priv->fd.days));
3369  else
3370  flist = g_list_prepend (flist, g_strdup ("0"));
3371 
3372  flist = g_list_reverse (flist);
3373  filter = gnc_g_list_stringjoin (flist, ",");
3374  PINFO ("The filter to save is %s", filter);
3375  gnc_plugin_page_register_set_filter (plugin_page, filter);
3376  g_free (filter);
3377  g_list_free_full (flist, g_free);
3378  }
3379  }
3380  priv->fd.dialog = NULL;
3381  gtk_widget_destroy (GTK_WIDGET (dialog));
3382  LEAVE (" ");
3383 }
The instance data structure for a content plugin.
gchar * gnc_g_list_stringjoin(GList *list_of_strings, const gchar *sep)
Return a string joining a GList whose elements are gchar* strings.
#define PINFO(format, args...)
Print an informational note.
Definition: qoflog.h:256
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register_filter_save_cb()

void gnc_plugin_page_register_filter_save_cb ( GtkToggleButton *  button,
GncPluginPageRegister page 
)

This function is called whenever the save status is checked or unchecked.

It will allow saving of the filter if required.

Parameters
buttonThe toggle button that was changed.
pageA pointer to the GncPluginPageRegister that is associated with this filter dialog.

Definition at line 3277 of file gnc-plugin-page-register.c.

3279 {
3281 
3282  g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
3283  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3284 
3285  ENTER ("Save toggle button (%p), plugin_page %p", button, page);
3286 
3287  /* Compute the new save filter status */
3288  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3289  if (gtk_toggle_button_get_active (button))
3290  priv->fd.save_filter = TRUE;
3291  else
3292  priv->fd.save_filter = FALSE;
3293  LEAVE (" ");
3294 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register_filter_select_range_cb()

void gnc_plugin_page_register_filter_select_range_cb ( GtkRadioButton *  button,
GncPluginPageRegister page 
)

This function is called when the radio buttons changes state.

This function is responsible for setting the sensitivity of the widgets controlled by each radio button choice and updating the time limitation on the register query. This is handled by a helper function as potentially all widgets will need to be examined.

Parameters
buttonA pointer to the "select range" radio button.
pageA pointer to the GncPluginPageRegister that is associated with this filter dialog.

Definition at line 3064 of file gnc-plugin-page-register.c.

3066 {
3068  gboolean active;
3069  const gchar* name;
3070 
3071  g_return_if_fail (GTK_IS_RADIO_BUTTON (button));
3072  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3073 
3074  ENTER ("(button %p, page %p)", button, page);
3075  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3076  name = gtk_buildable_get_name (GTK_BUILDABLE (button));
3077  active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
3078 
3079  if (active && g_strcmp0 (name, "filter_show_range") == 0)
3080  {
3081  gtk_widget_set_sensitive (priv->fd.table, active);
3082  gtk_widget_set_sensitive (priv->fd.num_days, !active);
3083  get_filter_times (page);
3084  }
3085  else if (active && g_strcmp0 (name, "filter_show_days") == 0)
3086  {
3087  gtk_widget_set_sensitive (priv->fd.table, !active);
3088  gtk_widget_set_sensitive (priv->fd.num_days, active);
3089  gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->fd.num_days), priv->fd.days);
3090  }
3091  else
3092  {
3093  gtk_widget_set_sensitive (priv->fd.table, FALSE);
3094  gtk_widget_set_sensitive (priv->fd.num_days, FALSE);
3095  priv->fd.days = 0;
3096  priv->fd.start_time = 0;
3097  priv->fd.end_time = 0;
3098  }
3099  gnc_ppr_update_date_query (page);
3100  LEAVE (" ");
3101 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register_filter_start_cb()

void gnc_plugin_page_register_filter_start_cb ( GtkWidget *  radio,
GncPluginPageRegister page 
)

This function is called when one of the start date radio buttons is selected.

It updates the sensitivity of the date entry widget, then calls a common routine to determine the start/end times and update the register query.

*Note: This function is actually called twice for each new radio button selection. The first time call is to uncheck the old button, and the second time to check the new button. This does make a kind of sense, as radio buttons are nothing more than linked toggle buttons where only one can be active.

Parameters
radioThe button whose state is changing. This will be the previously selected button the first of the pair of calls to this function, and will be the newly selected button the second time.
pageA pointer to the GncPluginPageRegister that is associated with this filter dialog.

Definition at line 3192 of file gnc-plugin-page-register.c.

3194 {
3196  const gchar* name;
3197  gboolean active;
3198 
3199  g_return_if_fail (GTK_IS_RADIO_BUTTON (radio));
3200  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3201 
3202  ENTER ("(radio %s(%p), page %p)",
3203  gtk_buildable_get_name (GTK_BUILDABLE (radio)), radio, page);
3204  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3205  if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
3206  {
3207  LEAVE ("1st callback of pair. Defer to 2nd callback.");
3208  return;
3209  }
3210 
3211  name = gtk_buildable_get_name (GTK_BUILDABLE (radio));
3212  active = !g_strcmp0 (name, "start_date_choose");
3213  gtk_widget_set_sensitive (priv->fd.start_date, active);
3214  get_filter_times (page);
3215  gnc_ppr_update_date_query (page);
3216  LEAVE (" ");
3217 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register_filter_status_all_cb()

void gnc_plugin_page_register_filter_status_all_cb ( GtkButton *  button,
GncPluginPageRegister page 
)

This function is called whenever the "select all" status button is clicked.

It updates all of the checkbox widgets, then updates the query on the register.

Parameters
buttonThe button that was clicked.
pageA pointer to the GncPluginPageRegister that is associated with this filter dialog.

Definition at line 2961 of file gnc-plugin-page-register.c.

2963 {
2965  GtkWidget* widget;
2966  gint i;
2967 
2968  g_return_if_fail (GTK_IS_BUTTON (button));
2969  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2970 
2971  ENTER ("(button %p, page %p)", button, page);
2972 
2973  /* Turn on all the check menu items */
2974  for (i = 0; status_actions[i].action_name; i++)
2975  {
2976  widget = status_actions[i].widget;
2977  g_signal_handlers_block_by_func (widget,
2979  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
2980  g_signal_handlers_unblock_by_func (widget,
2982  }
2983 
2984  /* Set the requested status */
2985  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2986  priv->fd.cleared_match = CLEARED_ALL;
2987  gnc_ppr_update_status_query (page);
2988  LEAVE (" ");
2989 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
void gnc_plugin_page_register_filter_status_one_cb(GtkToggleButton *button, GncPluginPageRegister *page)
This function is called whenever one of the status entries is checked or unchecked.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register_filter_status_one_cb()

void gnc_plugin_page_register_filter_status_one_cb ( GtkToggleButton *  button,
GncPluginPageRegister page 
)

This function is called whenever one of the status entries is checked or unchecked.

It updates the status value maintained for the filter dialog, and calls another function to do the work of applying the change to the register itself.

Parameters
buttonThe toggle button that was changed.
pageA pointer to the GncPluginPageRegister that is associated with this filter dialog.

Definition at line 2916 of file gnc-plugin-page-register.c.

2918 {
2920  const gchar* name;
2921  gint i, value;
2922 
2923  g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
2924  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2925 
2926  name = gtk_buildable_get_name (GTK_BUILDABLE (button));
2927  ENTER ("toggle button %s (%p), plugin_page %p", name, button, page);
2928 
2929  /* Determine what status bit to change */
2930  value = CLEARED_NONE;
2931  for (i = 0; status_actions[i].action_name; i++)
2932  {
2933  if (g_strcmp0 (name, status_actions[i].action_name) == 0)
2934  {
2935  value = status_actions[i].value;
2936  break;
2937  }
2938  }
2939 
2940  /* Compute the new match status */
2941  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2942  if (gtk_toggle_button_get_active (button))
2943  priv->fd.cleared_match |= value;
2944  else
2945  priv->fd.cleared_match &= ~value;
2946  gnc_ppr_update_status_query (page);
2947  LEAVE (" ");
2948 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register_get_account()

Account * gnc_plugin_page_register_get_account ( GncPluginPageRegister page)

Get the Account associated with this register page.

Parameters
pageA "register" page.
Returns
The account if the register contains only a single account, or an account and its sub-accounts. NULL otherwise.

Definition at line 973 of file gnc-plugin-page-register.c.

974 {
976  GNCLedgerDisplayType ledger_type;
977  Account* leader;
978 
979  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
980  ledger_type = gnc_ledger_display_type (priv->ledger);
981  leader = gnc_ledger_display_leader (priv->ledger);
982 
983  if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
984  return leader;
985  return NULL;
986 }
Account * gnc_ledger_display_leader(GNCLedgerDisplay *ld)
Implementations.

◆ gnc_plugin_page_register_get_current_txn()

Transaction * gnc_plugin_page_register_get_current_txn ( GncPluginPageRegister page)

Get the currently selected transaction in this register page.

Parameters
pageA "register" page.
Returns
The currently active transaction or NULL if there currently is no currently selected.

Definition at line 989 of file gnc-plugin-page-register.c.

990 {
992  SplitRegister* reg;
993 
994  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
995  reg = gnc_ledger_display_get_split_register (priv->ledger);
997 }
Transaction * gnc_split_register_get_current_trans(SplitRegister *reg)
Gets the transaction at the current cursor location, which may be on the transaction itself or on any...
SplitRegister * gnc_ledger_display_get_split_register(GNCLedgerDisplay *ld)
return the split register associated with a ledger display

◆ gnc_plugin_page_register_get_gsr()

GNCSplitReg * gnc_plugin_page_register_get_gsr ( GncPluginPage plugin_page)

Get the GNCSplitReg data structure associated with this register page.

Parameters
plugin_pageA "register" page.

Definition at line 5237 of file gnc-plugin-page-register.c.

5238 {
5239  GncPluginPageRegister* page;
5241 
5242  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), NULL);
5243 
5244  page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
5245  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
5246 
5247  return priv->gsr;
5248 }

◆ gnc_plugin_page_register_get_query()

Query * gnc_plugin_page_register_get_query ( GncPluginPage plugin_page)

This function is called to get the query associated with this plugin page.

Get the Query associated with this "register" plugin page.

Parameters
pageA pointer to the GncPluginPage.
plugin_pageThe "register" page to modify.
Returns
The query.

Definition at line 2491 of file gnc-plugin-page-register.c.

2492 {
2493  GncPluginPageRegister* page;
2495 
2496  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), NULL);
2497 
2498  page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
2499  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2500  return gnc_ledger_display_get_query (priv->ledger);
2501 }
Query * gnc_ledger_display_get_query(GNCLedgerDisplay *ld)
return the query associated with a ledger

◆ gnc_plugin_page_register_get_type()

GType gnc_plugin_page_register_get_type ( void  )

Retrieve the type number for the plugin page.

Returns
The type number.

◆ gnc_plugin_page_register_new()

GncPluginPage * gnc_plugin_page_register_new ( Account account,
gboolean  subaccounts 
)

Create a new "register" plugin page, given a pointer to an account.

Parameters
accountThe pointer to the account to embed in the register.
subaccountsTRUE if all the sub-accounts of the specified account should be included in the register.
Returns
The newly created plugin page.

Definition at line 819 of file gnc-plugin-page-register.c.

820 {
821  GNCLedgerDisplay* ledger;
822  GncPluginPage* page;
824  gnc_commodity* com0;
825  gnc_commodity* com1;
826 
827  /*################## Added for Reg2 #################*/
828  const GList* item;
829  GncPluginPageRegister2* new_register_page;
830  /*################## Added for Reg2 #################*/
831 
832  ENTER ("account=%p, subaccounts=%s", account,
833  subaccounts ? "TRUE" : "FALSE");
834 
835  /*################## Added for Reg2 #################*/
836  // We test for the new register being open here, ie matching account guids
837  item = gnc_gobject_tracking_get_list (GNC_PLUGIN_PAGE_REGISTER2_NAME);
838  for (; item; item = g_list_next (item))
839  {
840  Account* new_account;
841  new_register_page = (GncPluginPageRegister2*)item->data;
842  new_account = gnc_plugin_page_register2_get_account (new_register_page);
843 
844  if (guid_equal (xaccAccountGetGUID (account),
845  xaccAccountGetGUID (new_account)))
846  {
847  GtkWindow* window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (
848  new_register_page)));
849  gnc_error_dialog (window, "%s",
850  _ ("You have tried to open an account in the old register while it is open in the new register."));
851  return NULL;
852  }
853  }
854  /*################## Added for Reg2 #################*/
855  com0 = gnc_account_get_currency_or_parent (account);
856  com1 = gnc_account_foreach_descendant_until (account,
857  gnc_plug_page_register_check_commodity, com0);
858 
859  if (subaccounts)
860  ledger = gnc_ledger_display_subaccounts (account, com1 != NULL);
861  else
862  ledger = gnc_ledger_display_simple (account);
863 
864  page = gnc_plugin_page_register_new_common (ledger);
865  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
866  priv->key = *xaccAccountGetGUID (account);
867 
868  LEAVE ("%p", page);
869  return page;
870 }
GtkWidget * gnc_plugin_page_get_window(GncPluginPage *page)
Retrieve a pointer to the GncMainWindow (GtkWindow) containing this page.
The instance data structure for a content plugin.
const GList * gnc_gobject_tracking_get_list(const gchar *name)
Get a list of all known objects of a specified type.
gpointer gnc_account_foreach_descendant_until(const Account *acc, AccountCb2 thunk, gpointer user_data)
This method will traverse all children of this accounts and their descendants, calling 'func' on each...
Definition: Account.cpp:3253
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
GNCLedgerDisplay * gnc_ledger_display_subaccounts(Account *account, gboolean mismatched_commodities)
opens up a register window to display the parent account and all of its children. ...
#define xaccAccountGetGUID(X)
Definition: Account.h:248
gboolean guid_equal(const GncGUID *guid_1, const GncGUID *guid_2)
Given two GUIDs, return TRUE if they are non-NULL and equal.
Definition: guid.cpp:204
Account * gnc_plugin_page_register2_get_account(GncPluginPageRegister2 *page)
Get the Account associated with this register page.
gnc_commodity * gnc_account_get_currency_or_parent(const Account *account)
Returns a gnc_commodity that is a currency, suitable for being a Transaction's currency.
Definition: Account.cpp:3455
GNCLedgerDisplay * gnc_ledger_display_simple(Account *account)
opens up a register window to display a single account
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register_new_gl()

GncPluginPage * gnc_plugin_page_register_new_gl ( void  )

Create a new "register" plugin page containing a general journal.

Returns
The newly created plugin page.

Definition at line 873 of file gnc-plugin-page-register.c.

874 {
875  GNCLedgerDisplay* ledger;
876 
877  ledger = gnc_ledger_display_gl();
878  return gnc_plugin_page_register_new_common (ledger);
879 }
GNCLedgerDisplay * gnc_ledger_display_gl(void)
opens up a general ledger window

◆ gnc_plugin_page_register_new_ledger()

GncPluginPage * gnc_plugin_page_register_new_ledger ( GNCLedgerDisplay *  ledger)

Create a new "register" plugin page, given a pointer to an already created ledger.

This function should be used when the ledger already exists. (E.G. From the "find transaction" code, or from the scheduled transaction code.)

Parameters
ledgerThe pointer to the ledger to embed into the register.
Returns
The newly created plugin page.

Definition at line 882 of file gnc-plugin-page-register.c.

883 {
884  return gnc_plugin_page_register_new_common (ledger);
885 }

◆ gnc_plugin_page_register_set_options()

void gnc_plugin_page_register_set_options ( GncPluginPage plugin_page,
gint  lines_default,
gboolean  read_only 
)

Set various register options on a newly created "register" plugin page.

Parameters
plugin_pageThe "register" page to modify.
lines_defaultUsed to calculate the minimum preferred height of the plugin page.
read_onlyTrue if the register should be read-only.

Definition at line 5221 of file gnc-plugin-page-register.c.

5224 {
5225  GncPluginPageRegister* page;
5227 
5228  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page));
5229 
5230  page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
5231  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
5232  priv->lines_default = lines_default;
5233  priv->read_only = read_only;
5234 }

◆ gnc_plugin_page_register_sort_button_cb()

void gnc_plugin_page_register_sort_button_cb ( GtkToggleButton *  button,
GncPluginPageRegister page 
)

This function is called when a radio button in the "Sort By..." dialog is clicked.

Parameters
buttonThe button that was toggled.
pageA pointer to the GncPluginPageRegister associated with this dialog box.

Definition at line 2618 of file gnc-plugin-page-register.c.

2620 {
2622  const gchar* name;
2623  SortType type;
2624 
2625  g_return_if_fail (GTK_IS_TOGGLE_BUTTON (button));
2626  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2627 
2628  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2629  name = gtk_buildable_get_name (GTK_BUILDABLE (button));
2630  ENTER ("button %s(%p), page %p", name, button, page);
2631  type = SortTypefromString (name);
2632  gnc_split_reg_set_sort_type (priv->gsr, type);
2633  LEAVE (" ");
2634 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register_sort_order_reverse_cb()

void gnc_plugin_page_register_sort_order_reverse_cb ( GtkToggleButton *  button,
GncPluginPageRegister page 
)

This function is called whenever the reverse sort order is checked or unchecked which allows reversing of the sort order.

Parameters
buttonThe toggle button that was changed.
pageA pointer to the GncPluginPageRegister that is associated with this sort order dialog.

Definition at line 2675 of file gnc-plugin-page-register.c.

2678 {
2680 
2681  g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
2682  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2683 
2684  ENTER ("Reverse toggle button (%p), plugin_page %p", button, page);
2685 
2686  /* Compute the new save sort order */
2687  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2688 
2689  priv->sd.reverse_order = gtk_toggle_button_get_active (button);
2690  gnc_split_reg_set_sort_reversed (priv->gsr, priv->sd.reverse_order, TRUE);
2691  LEAVE (" ");
2692 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register_sort_order_save_cb()

void gnc_plugin_page_register_sort_order_save_cb ( GtkToggleButton *  button,
GncPluginPageRegister page 
)

This function is called whenever the save sort order is checked or unchecked which allows saving of the sort order.

Parameters
buttonThe toggle button that was changed.
pageA pointer to the GncPluginPageRegister that is associated with this sort order dialog.

Definition at line 2646 of file gnc-plugin-page-register.c.

2648 {
2650 
2651  g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
2652  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2653 
2654  ENTER ("Save toggle button (%p), plugin_page %p", button, page);
2655 
2656  /* Compute the new save sort order */
2657  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2658 
2659  if (gtk_toggle_button_get_active (button))
2660  priv->sd.save_order = TRUE;
2661  else
2662  priv->sd.save_order = FALSE;
2663  LEAVE (" ");
2664 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register_sort_response_cb()

void gnc_plugin_page_register_sort_response_cb ( GtkDialog *  dialog,
gint  response,
GncPluginPageRegister page 
)

This function is called when the "Sort By..." dialog is closed.

If the dialog was closed by any method other than clicking the OK button, the original sorting order will be restored.

Parameters
dialogA pointer to the dialog box.
responseA numerical value indicating why the dialog box was closed.
pageA pointer to the GncPluginPageRegister associated with this dialog box.

Definition at line 2554 of file gnc-plugin-page-register.c.

2557 {
2559  GncPluginPage* plugin_page;
2560  SortType type;
2561  const gchar* order;
2562 
2563  g_return_if_fail (GTK_IS_DIALOG (dialog));
2564  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2565 
2566  ENTER (" ");
2567  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2568  plugin_page = GNC_PLUGIN_PAGE (page);
2569 
2570  if (response != GTK_RESPONSE_OK)
2571  {
2572  /* Restore the original sort order */
2573  gnc_split_reg_set_sort_reversed (priv->gsr, priv->sd.original_reverse_order,
2574  TRUE);
2575  priv->sd.reverse_order = priv->sd.original_reverse_order;
2576  gnc_split_reg_set_sort_type (priv->gsr, priv->sd.original_sort_type);
2577  priv->sd.save_order = priv->sd.original_save_order;
2578  }
2579  else
2580  {
2581  // clear the sort when unticking the save option
2582  if ((!priv->sd.save_order) && ((priv->sd.original_save_order) || (priv->sd.original_reverse_order)))
2583  {
2584  gnc_plugin_page_register_set_sort_order (plugin_page, DEFAULT_SORT_ORDER);
2585  gnc_plugin_page_register_set_sort_reversed (plugin_page, FALSE);
2586  }
2587  priv->sd.original_save_order = priv->sd.save_order;
2588 
2589  if (priv->sd.save_order)
2590  {
2591  type = gnc_split_reg_get_sort_type (priv->gsr);
2592  order = SortTypeasString (type);
2593  gnc_plugin_page_register_set_sort_order (plugin_page, order);
2594  gnc_plugin_page_register_set_sort_reversed (plugin_page,
2595  priv->sd.reverse_order);
2596  }
2597  }
2598  gnc_book_option_remove_cb (OPTION_NAME_NUM_FIELD_SOURCE,
2599  gnc_plugin_page_register_sort_book_option_changed,
2600  page);
2601  priv->sd.dialog = NULL;
2602  priv->sd.num_radio = NULL;
2603  priv->sd.act_radio = NULL;
2604  gtk_widget_destroy (GTK_WIDGET (dialog));
2605  LEAVE (" ");
2606 }
The instance data structure for a content plugin.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282