GnuCash  5.6-150-g038405b370+
Files | Data Structures | Macros | Enumerations | Functions | Variables
Register Page Filter

Files

file  gnc-plugin-page-register-filter.cpp
 Functions providing a register page filter for the GnuCash UI.
 
file  gnc-plugin-page-register-filter.hpp
 Functions providing a register page filter for the GnuCash UI.
 
file  gnc-plugin-page-register-filter.hpp
 Functions providing a register page filter for the GnuCash UI.
 
file  gnc-plugin-page-register.h
 Functions providing a register page for the GnuCash UI.
 

Data Structures

struct  RegisterFilterDialog
 
struct  status_action
 
struct  FilterData
 
struct  RegisterSortDialog
 
struct  SortData
 
struct  GncPluginPageRegisterPrivate
 
struct  GncPluginPageRegister
 
struct  GncPluginPageRegisterClass
 

Macros

#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 LINK_TRANSACTION_LABEL   N_("_Manage Document Link…")
 
#define LINK_TRANSACTION_OPEN_LABEL   N_("_Open Linked Document")
 
#define JUMP_LINKED_INVOICE_LABEL   N_("Jump to Business item")
 
#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 invoice, bill, expense or credit note")
 
#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 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"
 

Enumerations

enum  GncPrefJumpMultSplits : gint { JUMP_DEFAULT = 0, JUMP_LARGEST_VALUE_FIRST_SPLIT = 1, JUMP_SMALLEST_VALUE_FIRST_SPLIT = 2 }
 

Functions

void gnc_ppr_filter_select_range_cb (GtkRadioButton *button, RegisterFilterDialog *rfd)
 This function is called when the radio buttons changes state. More...
 
void gnc_ppr_filter_start_cb (GtkWidget *radio, RegisterFilterDialog *rfd)
 This function is called when one of the start date radio buttons is selected. More...
 
void gnc_ppr_filter_end_cb (GtkWidget *radio, RegisterFilterDialog *rfd)
 This function is called when one of the end date radio buttons is selected. More...
 
void gnc_ppr_filter_response_cb (GtkDialog *dialog, gint response, RegisterFilterDialog *rfd)
 This function is called when the "Filter By…" dialog is closed. More...
 
void gnc_ppr_filter_status_select_all_cb (GtkButton *button, RegisterFilterDialog *rfd)
 This function is called whenever the "select all" status button is clicked. More...
 
void gnc_ppr_filter_status_clear_all_cb (GtkButton *button, RegisterFilterDialog *rfd)
 This function is called whenever the "clear all" status button is clicked. More...
 
void gnc_ppr_filter_status_one_cb (GtkToggleButton *button, RegisterFilterDialog *rfd)
 This function is called whenever one of the status entries is checked or unchecked. More...
 
void gnc_ppr_filter_save_cb (GtkToggleButton *button, RegisterFilterDialog *rfd)
 This function is called whenever the save status is checked or unchecked. More...
 
void gnc_ppr_filter_days_changed_cb (GtkSpinButton *button, RegisterFilterDialog *rfd)
 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_ppr_filter_set_tooltip (GncPluginPage *plugin_page, FilterData *fd)
 This function is used to update the tooltip shown in the register which shows a summary of the current filter. More...
 
void gnc_ppr_filter_clear_current_filter (GncPluginPage *plugin_page)
 This function is used to clear the current filter so that a specific split can be shown in the register. More...
 
void gnc_ppr_filter_update_register (GncPluginPage *plugin_page)
 This function is called to update the register. More...
 
void gnc_ppr_filter_by (GncPluginPage *plugin_page, Query *query, FilterData *fd, bool show_save_button)
 This function is called for the filter dialog. More...
 
void gnc_ppr_sort_response_cb (GtkDialog *dialog, gint response, RegisterSortDialog *rsd)
 This function is called when the "Sort By…" dialog is closed. More...
 
void gnc_ppr_sort_button_cb (GtkToggleButton *button, RegisterSortDialog *rsd)
 This function is called when a radio button in the "Sort By…" dialog is clicked. More...
 
void gnc_ppr_sort_order_save_cb (GtkToggleButton *button, RegisterSortDialog *rsd)
 This function is called whenever the save sort order is checked or unchecked which allows saving of the sort order. More...
 
void gnc_ppr_sort_order_reverse_cb (GtkToggleButton *button, RegisterSortDialog *rsd)
 This function is called whenever the reverse sort order is checked or unchecked which allows reversing of the sort order. More...
 
void gnc_ppr_sort_update_register (GncPluginPage *plugin_page)
 This function is called to update the register. More...
 
void gnc_ppr_sort_dialog (GncPluginPage *plugin_page, SplitRegister *reg, SortData *sd, bool show_save_button)
 This function is called for the sort dialog. More...
 
 G_DEFINE_TYPE_WITH_PRIVATE (GncPluginPageRegister, gnc_plugin_page_register, GNC_TYPE_PLUGIN_PAGE) static GncPluginPage *gnc_plugin_page_register_new_common(GNCLedgerDisplay *ledger)
 
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...
 
Querygnc_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_query_update (GncPluginPageRegister *page, Query *query)
 This updates the query after the filters have been applied. More...
 
void gnc_plugin_page_register_update_for_search_query (GncPluginPageRegister *page)
 This checks if the register is a search register and if so saves the query. More...
 
void gnc_plugin_register_set_enable_refresh (GncPluginPageRegister *page, gboolean enable_refresh)
 This allows controlling when refreshes happen, used to reduce refreshes when different aspects of the register filter change, namely date and status. 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...
 
FilterDatagnc_plugin_page_register_get_filter_data (GncPluginPage *plugin_page)
 Get the FilterData data structure associated with this register page. More...
 
SortDatagnc_plugin_page_register_get_sort_data (GncPluginPage *plugin_page)
 Get the SortData 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...
 

Variables

GncPluginPageRegisterFilterDialog::plugin_page
 
GtkWidget * RegisterFilterDialog::dialog
 
GtkWidget * RegisterFilterDialog::table
 
GtkWidget * RegisterFilterDialog::start_date_choose
 
GtkWidget * RegisterFilterDialog::start_date_today
 
GtkWidget * RegisterFilterDialog::start_date
 
GtkWidget * RegisterFilterDialog::end_date_choose
 
GtkWidget * RegisterFilterDialog::end_date_today
 
GtkWidget * RegisterFilterDialog::end_date
 
GtkWidget * RegisterFilterDialog::num_days
 
cleared_match_t RegisterFilterDialog::original_cleared_match
 
time64 RegisterFilterDialog::original_start_time
 
time64 RegisterFilterDialog::original_end_time
 
int RegisterFilterDialog::original_days
 
bool RegisterFilterDialog::original_save_filter
 
bool RegisterFilterDialog::show_save_button
 
std::string status_action::action_name
 
int status_action::value
 
GtkWidget * status_action::widget
 
GtkWidget * FilterData::dialog
 
cleared_match_t FilterData::cleared_match
 
time64 FilterData::start_time
 
time64 FilterData::end_time
 
int FilterData::days
 
bool FilterData::save_filter
 
GncPluginPageRegisterSortDialog::plugin_page
 
SplitRegister * RegisterSortDialog::reg
 
GtkWidget * RegisterSortDialog::dialog
 
GtkWidget * RegisterSortDialog::num_radio
 
GtkWidget * RegisterSortDialog::act_radio
 
SortType RegisterSortDialog::original_sort_type
 
bool RegisterSortDialog::original_reverse_order
 
bool RegisterSortDialog::original_save_order
 
bool RegisterSortDialog::show_save_button
 
GtkWidget * SortData::dialog
 
SortType SortData::sort_type
 
bool SortData::reverse_order
 
bool SortData::save_order
 

Detailed Description

Function Documentation

◆ 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 1922 of file gnc-plugin-page-register.cpp.

1923 {
1924  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
1925 
1927 }
void gnc_ppr_filter_clear_current_filter(GncPluginPage *plugin_page)
This function is used to clear the current filter so that a specific split can be shown in the regist...

◆ 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 580 of file gnc-plugin-page-register.cpp.

581 {
583  GNCLedgerDisplayType ledger_type;
584  Account* leader;
585 
586  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
587  ledger_type = gnc_ledger_display_type (priv->ledger);
588  leader = gnc_ledger_display_leader (priv->ledger);
589 
590  if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
591  return leader;
592  return NULL;
593 }
STRUCTS.
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 596 of file gnc-plugin-page-register.cpp.

597 {
599  SplitRegister* reg;
600 
601  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
602  reg = gnc_ledger_display_get_split_register (priv->ledger);
604 }
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_filter_data()

struct FilterData * gnc_plugin_page_register_get_filter_data ( GncPluginPage plugin_page)

Get the FilterData data structure associated with this register page.

Parameters
plugin_pageA "register" page.

Definition at line 3780 of file gnc-plugin-page-register.cpp.

3781 {
3782  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page), NULL);
3783 
3784  GncPluginPageRegister* page = GNC_PLUGIN_PAGE_REGISTER(plugin_page);
3785  GncPluginPageRegisterPrivate* priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
3786 
3787  return &priv->fd;
3788 }

◆ 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 3766 of file gnc-plugin-page-register.cpp.

3767 {
3768  GncPluginPageRegister* page;
3770 
3771  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), NULL);
3772 
3773  page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
3774  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3775 
3776  return priv->gsr;
3777 }

◆ 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 1853 of file gnc-plugin-page-register.cpp.

1854 {
1855  GncPluginPageRegister* page;
1857 
1858  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), NULL);
1859 
1860  page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
1861  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
1862  return gnc_ledger_display_get_query (priv->ledger);
1863 }
Query * gnc_ledger_display_get_query(GNCLedgerDisplay *ld)
return the query associated with a ledger

◆ gnc_plugin_page_register_get_sort_data()

struct SortData * gnc_plugin_page_register_get_sort_data ( GncPluginPage plugin_page)

Get the SortData data structure associated with this register page.

Parameters
plugin_pageA "register" page.

Definition at line 3791 of file gnc-plugin-page-register.cpp.

3792 {
3793  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page), NULL);
3794 
3795  GncPluginPageRegister* page = GNC_PLUGIN_PAGE_REGISTER(plugin_page);
3796  GncPluginPageRegisterPrivate* priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
3797 
3798  return &priv->sd;
3799 }

◆ 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 464 of file gnc-plugin-page-register.cpp.

465 {
466  GNCLedgerDisplay* ledger;
467  GncPluginPage* plugin_page;
469  gnc_commodity* com0;
470  gnc_commodity* com1;
471 
472  ENTER ("account=%p, subaccounts=%s", account,
473  subaccounts ? "TRUE" : "FALSE");
474 
475  com0 = gnc_account_get_currency_or_parent (account);
476  com1 = GNC_COMMODITY(gnc_account_foreach_descendant_until (account,
477  gnc_plug_page_register_check_commodity,
478  static_cast<gpointer>(com0)));
479 
480  if (subaccounts)
481  ledger = gnc_ledger_display_subaccounts (account, com1 != NULL);
482  else
483  ledger = gnc_ledger_display_simple (account);
484 
485  plugin_page = gnc_plugin_page_register_new_common (ledger);
486  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (plugin_page);
487  priv->key = *xaccAccountGetGUID (account);
488 
489  LEAVE ("%p", plugin_page);
490  return plugin_page;
491 }
The instance data structure for a content plugin.
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 &#39;func&#39; on each...
Definition: Account.cpp:3218
#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:252
gnc_commodity * gnc_account_get_currency_or_parent(const Account *account)
Returns a gnc_commodity that is a currency, suitable for being a Transaction&#39;s currency.
Definition: Account.cpp:3382
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 494 of file gnc-plugin-page-register.cpp.

495 {
496  GNCLedgerDisplay* ledger;
497 
498  ledger = gnc_ledger_display_gl();
499  return gnc_plugin_page_register_new_common (ledger);
500 }
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 503 of file gnc-plugin-page-register.cpp.

504 {
505  return gnc_plugin_page_register_new_common (ledger);
506 }

◆ gnc_plugin_page_register_query_update()

void gnc_plugin_page_register_query_update ( GncPluginPageRegister page,
Query query 
)

This updates the query after the filters have been applied.

Parameters
plugin_pageA pointer to the GncPluginPageRegister.
queryThe updated query

Definition at line 1866 of file gnc-plugin-page-register.cpp.

1867 {
1869 
1870  ENTER(" ");
1871  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
1872 
1873  // clear previous filter query and save current
1874  qof_query_destroy (priv->filter_query);
1875  priv->filter_query = qof_query_copy (query);
1876 
1877  if (priv->enable_refresh)
1878  gnc_ledger_display_refresh (priv->ledger);
1879  LEAVE(" ");
1880 }
void gnc_ledger_display_refresh(GNCLedgerDisplay *ld)
redisplay/redraw only the indicated window.
QofQuery * qof_query_copy(QofQuery *q)
Make a copy of the indicated query.
Definition: qofquery.cpp:1018
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
void qof_query_destroy(QofQuery *query)
Frees the resources associate with a Query object.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ 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 3750 of file gnc-plugin-page-register.cpp.

3753 {
3754  GncPluginPageRegister* page;
3756 
3757  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page));
3758 
3759  page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
3760  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3761  priv->lines_default = lines_default;
3762  priv->read_only = read_only;
3763 }

◆ gnc_plugin_page_register_update_for_search_query()

void gnc_plugin_page_register_update_for_search_query ( GncPluginPageRegister page)

This checks if the register is a search register and if so saves the query.

Parameters
plugin_pageA pointer to the GncPluginPageRegister.

Definition at line 1883 of file gnc-plugin-page-register.cpp.

1884 {
1886  SplitRegister* reg;
1887 
1888  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
1889  reg = gnc_ledger_display_get_split_register (priv->ledger);
1890 
1891  if (reg->type == SEARCH_LEDGER)
1892  {
1893  Query* query_tmp = gnc_ledger_display_get_query (priv->ledger);
1894 
1895  // if filter_query is NULL, then the dialogue find has been run
1896  // before coming here. if query_tmp does not equal filter_query
1897  // then the dialogue find has been run again before coming here
1898  if ((priv->filter_query == NULL) ||
1899  (!qof_query_equal (query_tmp, priv->filter_query)))
1900  {
1901  qof_query_destroy (priv->search_query);
1902  priv->search_query = qof_query_copy (query_tmp);
1903  }
1904  gnc_ledger_display_set_query (priv->ledger, priv->search_query);
1905  }
1906 }
QofQuery * qof_query_copy(QofQuery *q)
Make a copy of the indicated query.
Definition: qofquery.cpp:1018
gboolean qof_query_equal(const QofQuery *q1, const QofQuery *q2)
Compare two queries for equality.
Definition: qofquery.cpp:1472
void gnc_ledger_display_set_query(GNCLedgerDisplay *ledger_display, Query *q)
Set the query used for a register.
Query * gnc_ledger_display_get_query(GNCLedgerDisplay *ld)
return the query associated with a ledger
void qof_query_destroy(QofQuery *query)
Frees the resources associate with a Query object.
SplitRegister * gnc_ledger_display_get_split_register(GNCLedgerDisplay *ld)
return the split register associated with a ledger display
A Query.
Definition: qofquery.cpp:74

◆ gnc_plugin_register_set_enable_refresh()

void gnc_plugin_register_set_enable_refresh ( GncPluginPageRegister page,
gboolean  enable_refresh 
)

This allows controlling when refreshes happen, used to reduce refreshes when different aspects of the register filter change, namely date and status.

Parameters
plugin_pageA pointer to the GncPluginPageRegister.
enable_refreshUsed to controll wehn refresh is required

Definition at line 1909 of file gnc-plugin-page-register.cpp.

1911 {
1913 
1914  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(page));
1915 
1916  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
1917 
1918  priv->enable_refresh = enable_refresh;
1919 }

◆ gnc_ppr_filter_by()

void gnc_ppr_filter_by ( GncPluginPage plugin_page,
Query query,
FilterData fd,
bool  show_save_button 
)

This function is called for the filter dialog.

Parameters
plugin_pageA pointer to the GncPluginPageRegister that is associated with this filter dialog.
queryA pointer to the current register query.
fdA pointer to the filter data structure for remembering state.
show_save_buttonSet to True to show save button.

Definition at line 1298 of file gnc-plugin-page-register-filter.cpp.

1300 {
1301  RegisterFilterDialog *rfd;
1302 
1303  ENTER(" ");
1304 
1305  rfd = g_new0 (RegisterFilterDialog, 1);
1306 
1307  rfd->plugin_page = plugin_page;
1308  rfd->show_save_button = show_save_button;
1309 
1310  gnc_ppr_filter_dialog_create (rfd, fd, query);
1311 
1312  LEAVE(" ");
1313 }
#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_ppr_filter_clear_current_filter()

void gnc_ppr_filter_clear_current_filter ( GncPluginPage plugin_page)

This function is used to clear the current filter so that a specific split can be shown in the register.

Parameters
pageA pointer to the GncPluginPageRegister that is associated with this filter dialog.

Definition at line 631 of file gnc-plugin-page-register-filter.cpp.

632 {
633  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
634 
635  auto fd = gnc_plugin_page_register_get_filter_data (plugin_page);
636 
637  set_filterdata_to_defaults (fd);
638 
639  gnc_ppr_filter_update_date_query (plugin_page);
640 }
FilterData * gnc_plugin_page_register_get_filter_data(GncPluginPage *plugin_page)
Get the FilterData data structure associated with this register page.

◆ gnc_ppr_filter_days_changed_cb()

void gnc_ppr_filter_days_changed_cb ( GtkSpinButton *  button,
RegisterFilterDialog rfd 
)

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.
rfdA pointer to the filter dialog structure.

Definition at line 906 of file gnc-plugin-page-register-filter.cpp.

908 {
909  g_return_if_fail (GTK_IS_SPIN_BUTTON(button));
910  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(rfd->plugin_page));
911 
912  ENTER("(button %p, page %p)", button, rfd->plugin_page);
913 
914  auto fd = gnc_plugin_page_register_get_filter_data (rfd->plugin_page);
915 
916  fd->days = gtk_spin_button_get_value (GTK_SPIN_BUTTON(button));
917  gnc_ppr_filter_update_date_query (rfd->plugin_page);
918 
919  LEAVE(" ");
920 }
FilterData * gnc_plugin_page_register_get_filter_data(GncPluginPage *plugin_page)
Get the FilterData data structure associated with this register page.
#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_ppr_filter_end_cb()

void gnc_ppr_filter_end_cb ( GtkWidget *  radio,
RegisterFilterDialog rfd 
)

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.
rfdA pointer to the filter dialog structure.

Definition at line 1008 of file gnc-plugin-page-register-filter.cpp.

1010 {
1011  g_return_if_fail (GTK_IS_RADIO_BUTTON(radio));
1012  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(rfd->plugin_page));
1013 
1014  ENTER("(radio %s(%p), page %p)",
1015  gtk_buildable_get_name (GTK_BUILDABLE(radio)), radio, rfd->plugin_page);
1016 
1017  if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(radio)))
1018  {
1019  LEAVE("1st callback of pair. Defer to 2nd callback.");
1020  return;
1021  }
1022 
1023  auto name = gtk_buildable_get_name (GTK_BUILDABLE(radio));
1024  gboolean active = !g_strcmp0 (name, "end_date_choose");
1025  gtk_widget_set_sensitive (rfd->end_date, active);
1026  get_filter_times (rfd);
1027  gnc_ppr_filter_update_date_query (rfd->plugin_page);
1028 
1029  LEAVE(" ");
1030 }
#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_ppr_filter_response_cb()

void gnc_ppr_filter_response_cb ( GtkDialog *  dialog,
gint  response,
RegisterFilterDialog rfd 
)

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.
rfdA pointer to the filter dialog structure.

Definition at line 1070 of file gnc-plugin-page-register-filter.cpp.

1073 {
1074  g_return_if_fail (GTK_IS_DIALOG(dialog));
1075  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(rfd->plugin_page));
1076 
1077  ENTER(" ");
1078 
1079  auto fd = gnc_plugin_page_register_get_filter_data (rfd->plugin_page);
1080  auto gsr = gnc_plugin_page_register_get_gsr (rfd->plugin_page);
1081 
1082  if (response != GTK_RESPONSE_OK)
1083  {
1084  /* Remove the old status match */
1085  fd->cleared_match = rfd->original_cleared_match;
1086  gnc_plugin_register_set_enable_refresh (GNC_PLUGIN_PAGE_REGISTER(rfd->plugin_page), FALSE);
1087  gnc_ppr_filter_update_status_query (rfd->plugin_page);
1088  gnc_plugin_register_set_enable_refresh (GNC_PLUGIN_PAGE_REGISTER(rfd->plugin_page), TRUE);
1089  fd->start_time = rfd->original_start_time;
1090  fd->end_time = rfd->original_end_time;
1091  fd->days = rfd->original_days;
1092  fd->save_filter = rfd->original_save_filter;
1093  gnc_ppr_filter_update_date_query (rfd->plugin_page);
1094  }
1095  else
1096  {
1097  // clear the filter when unticking the save option
1098  if (!fd->save_filter && rfd->original_save_filter)
1099  gnc_ppr_filter_save_filter (gsr, "");
1100 
1101  rfd->original_save_filter = fd->save_filter;
1102 
1103  if (fd->save_filter)
1104  gnc_ppr_filter_save_filter_parts (gsr, fd);
1105  }
1106  rfd->dialog = nullptr;
1107  fd->dialog = nullptr;
1108  g_free (rfd);
1109  gtk_widget_destroy (GTK_WIDGET(dialog));
1110  LEAVE(" ");
1111 }
void gnc_plugin_register_set_enable_refresh(GncPluginPageRegister *page, gboolean enable_refresh)
This allows controlling when refreshes happen, used to reduce refreshes when different aspects of the...
FilterData * gnc_plugin_page_register_get_filter_data(GncPluginPage *plugin_page)
Get the FilterData data structure associated with this register page.
#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
GNCSplitReg * gnc_plugin_page_register_get_gsr(GncPluginPage *plugin_page)
Get the GNCSplitReg data structure associated with this register page.

◆ gnc_ppr_filter_save_cb()

void gnc_ppr_filter_save_cb ( GtkToggleButton *  button,
RegisterFilterDialog rfd 
)

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.
rfdA pointer to the filter dialog structure.

Definition at line 1040 of file gnc-plugin-page-register-filter.cpp.

1042 {
1043  g_return_if_fail (GTK_IS_CHECK_BUTTON(button));
1044  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(rfd->plugin_page));
1045 
1046  ENTER("Save toggle button (%p), plugin_page %p", button, rfd->plugin_page);
1047 
1048  auto fd = gnc_plugin_page_register_get_filter_data (rfd->plugin_page);
1049 
1050  /* Compute the new save filter status */
1051  if (gtk_toggle_button_get_active (button))
1052  fd->save_filter = true;
1053  else
1054  fd->save_filter = false;
1055 
1056  LEAVE(" ");
1057 }
FilterData * gnc_plugin_page_register_get_filter_data(GncPluginPage *plugin_page)
Get the FilterData data structure associated with this register page.
#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_ppr_filter_select_range_cb()

void gnc_ppr_filter_select_range_cb ( GtkRadioButton *  button,
RegisterFilterDialog rfd 
)

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.
rfdA pointer to the filter dialog structure.

Definition at line 859 of file gnc-plugin-page-register-filter.cpp.

861 {
862  g_return_if_fail (GTK_IS_RADIO_BUTTON(button));
863  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(rfd->plugin_page));
864 
865  ENTER("(button %p, page %p)", button, rfd->plugin_page);
866 
867  auto fd = gnc_plugin_page_register_get_filter_data (rfd->plugin_page);
868 
869  auto name = gtk_buildable_get_name (GTK_BUILDABLE(button));
870  gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(button));
871 
872  if (active && g_strcmp0 (name, "filter_show_range") == 0)
873  {
874  gtk_widget_set_sensitive (rfd->table, active);
875  gtk_widget_set_sensitive (rfd->num_days, !active);
876  get_filter_times (rfd);
877  }
878  else if (active && g_strcmp0 (name, "filter_show_days") == 0)
879  {
880  gtk_widget_set_sensitive (rfd->table, !active);
881  gtk_widget_set_sensitive (rfd->num_days, active);
882  gtk_spin_button_set_value (GTK_SPIN_BUTTON(rfd->num_days), fd->days);
883  }
884  else
885  {
886  gtk_widget_set_sensitive (rfd->table, FALSE);
887  gtk_widget_set_sensitive (rfd->num_days, FALSE);
888  fd->start_time = 0;
889  fd->end_time = 0;
890  fd->days = 0;
891  }
892  gnc_ppr_filter_update_date_query (rfd->plugin_page);
893  LEAVE(" ");
894 }
FilterData * gnc_plugin_page_register_get_filter_data(GncPluginPage *plugin_page)
Get the FilterData data structure associated with this register page.
#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_ppr_filter_set_tooltip()

void gnc_ppr_filter_set_tooltip ( GncPluginPage plugin_page,
FilterData fd 
)

This function is used to update the tooltip shown in the register which shows a summary of the current filter.

Parameters
pageA pointer to the GncPluginPageRegister that is associated with this filter dialog.
fdA pointer to the filter data used for filter state.

Definition at line 404 of file gnc-plugin-page-register-filter.cpp.

405 {
406  GList *t_list = nullptr;
407 
408  ENTER(" ");
409 
410  auto gsr = gnc_plugin_page_register_get_gsr (plugin_page);
411 
412  // filtered start time
413  if (fd->start_time != 0)
414  {
415  auto sdate = qof_print_date (fd->start_time);
416  t_list = g_list_prepend
417  (t_list, g_strdup_printf ("%s %s", _("Start Date:"), sdate));
418  g_free (sdate);
419  }
420 
421  // filtered number of days
422  if (fd->days > 0)
423  {
424  t_list = g_list_prepend
425  (t_list, g_strdup_printf ("%s %d", _("Show previous number of days:"),
426  fd->days));
427  }
428  // filtered end time
429  if (fd->end_time != 0)
430  {
431  auto edate = qof_print_date (fd->end_time);
432  t_list = g_list_prepend
433  (t_list, g_strdup_printf ("%s %s", _("End Date:"), edate));
434  g_free (edate);
435  }
436 
437  // filtered match items
438  if (fd->cleared_match != CLEARED_ALL)
439  {
440  GList *show = nullptr;
441  GList *hide = nullptr;
442 
443  gpp_update_match_filter_text (fd->cleared_match, 0x01, _("Unreconciled"),
444  &show, &hide);
445  gpp_update_match_filter_text (fd->cleared_match, 0x02, _("Cleared"),
446  &show, &hide);
447  gpp_update_match_filter_text (fd->cleared_match, 0x04, _("Reconciled"),
448  &show, &hide);
449  gpp_update_match_filter_text (fd->cleared_match, 0x08, _("Frozen"),
450  &show, &hide);
451  gpp_update_match_filter_text (fd->cleared_match, 0x10, _("Voided"),
452  &show, &hide);
453 
454  show = g_list_reverse (show);
455  hide = g_list_reverse (hide);
456 
457  if (show)
458  {
459  auto str = gnc_list_formatter (show);
460  t_list = g_list_prepend
461  (t_list, g_strdup_printf ("%s %s", _("Show:"), str));
462  g_free (str);
463  }
464 
465  if (hide)
466  {
467  auto str = gnc_list_formatter (hide);
468  t_list = g_list_prepend
469  (t_list, g_strdup_printf ("%s %s", _("Hide:"), str));
470  g_free (str);
471  }
472 
473  g_list_free_full (show, g_free);
474  g_list_free_full (hide, g_free);
475  }
476 
477  t_list = g_list_reverse (t_list);
478 
479  if (t_list)
480  t_list = g_list_prepend (t_list, g_strdup (_("Filter By:")));
481 
482  // free the existing text if present
483  if (gsr->filter_text)
484  g_free (gsr->filter_text);
485 
486  // set the tooltip text variable in the gsr
487  gsr->filter_text = gnc_g_list_stringjoin (t_list, "\n");
488 
489  g_list_free_full (t_list, g_free);
490 
491  LEAVE(" ");
492 }
gchar * gnc_g_list_stringjoin(GList *list_of_strings, const gchar *sep)
Return a string joining a GList whose elements are gchar* strings.
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
char * qof_print_date(time64 secs)
Convenience; calls through to qof_print_date_dmy_buff().
Definition: gnc-date.cpp:610
gchar * gnc_list_formatter(GList *strings)
This function takes a GList of char*, and uses locale-sensitive list formatter.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
GNCSplitReg * gnc_plugin_page_register_get_gsr(GncPluginPage *plugin_page)
Get the GNCSplitReg data structure associated with this register page.

◆ gnc_ppr_filter_start_cb()

void gnc_ppr_filter_start_cb ( GtkWidget *  radio,
RegisterFilterDialog rfd 
)

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.
rfdA pointer to the filter dialog structure.

Definition at line 965 of file gnc-plugin-page-register-filter.cpp.

967 {
968  g_return_if_fail (GTK_IS_RADIO_BUTTON(radio));
969  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(rfd->plugin_page));
970 
971  ENTER("(radio %s(%p), page %p)",
972  gtk_buildable_get_name (GTK_BUILDABLE(radio)), radio, rfd->plugin_page);
973 
974  if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(radio)))
975  {
976  LEAVE("1st callback of pair. Defer to 2nd callback.");
977  return;
978  }
979 
980  auto name = gtk_buildable_get_name (GTK_BUILDABLE(radio));
981  gboolean active = !g_strcmp0 (name, "start_date_choose");
982  gtk_widget_set_sensitive (rfd->start_date, active);
983  get_filter_times (rfd);
984  gnc_ppr_filter_update_date_query (rfd->plugin_page);
985 
986  LEAVE(" ");
987 }
#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_ppr_filter_status_clear_all_cb()

void gnc_ppr_filter_status_clear_all_cb ( GtkButton *  button,
RegisterFilterDialog rfd 
)

This function is called whenever the "clear 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.
rfdA pointer to the filter dialog structure.

Definition at line 778 of file gnc-plugin-page-register-filter.cpp.

780 {
781  g_return_if_fail (GTK_IS_BUTTON(button));
782  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(rfd->plugin_page));
783 
784  ENTER("(button %p, page %p)", button, rfd->plugin_page);
785 
786  auto fd = gnc_plugin_page_register_get_filter_data (rfd->plugin_page);
787 
788  /* Turn off all the check menu items */
789  for (const auto& action : status_actions)
790  {
791  set_checkbutton_with_blocking (action.widget,
793  rfd, FALSE);
794  }
795 
796  /* Set the requested status */
797  fd->cleared_match = CLEARED_NONE;
798  gnc_ppr_filter_update_status_query (rfd->plugin_page);
799  LEAVE(" ");
800 }
FilterData * gnc_plugin_page_register_get_filter_data(GncPluginPage *plugin_page)
Get the FilterData data structure associated with this register page.
#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
void gnc_ppr_filter_status_one_cb(GtkToggleButton *button, RegisterFilterDialog *rfd)
This function is called whenever one of the status entries is checked or unchecked.

◆ gnc_ppr_filter_status_one_cb()

void gnc_ppr_filter_status_one_cb ( GtkToggleButton *  button,
RegisterFilterDialog rfd 
)

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.
rfdA pointer to the filter dialog structure.

Definition at line 687 of file gnc-plugin-page-register-filter.cpp.

689 {
690  g_return_if_fail (GTK_IS_CHECK_BUTTON(button));
691  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(rfd->plugin_page));
692 
693  auto name = gtk_buildable_get_name (GTK_BUILDABLE(button));
694 
695  ENTER("toggle button %s (%p), plugin_page %p", name, button, rfd->plugin_page);
696 
697  auto fd = gnc_plugin_page_register_get_filter_data (rfd->plugin_page);
698 
699  /* Determine what status bit to change */
700  int value = CLEARED_NONE;
701  for (const auto& action : status_actions)
702  {
703  if (action.action_name.compare (name) == 0)
704  {
705  value = action.value;
706  break;
707  }
708  }
709 
710  /* Compute the new match status */
711  if (gtk_toggle_button_get_active (button))
712  fd->cleared_match = (cleared_match_t)(fd->cleared_match | value);
713  else
714  fd->cleared_match = (cleared_match_t)(fd->cleared_match & ~value);
715 
716  gnc_ppr_filter_update_status_query (rfd->plugin_page);
717 
718  LEAVE(" ");
719 }
FilterData * gnc_plugin_page_register_get_filter_data(GncPluginPage *plugin_page)
Get the FilterData data structure associated with this register page.
#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_ppr_filter_status_select_all_cb()

void gnc_ppr_filter_status_select_all_cb ( GtkButton *  button,
RegisterFilterDialog rfd 
)

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.
rfdA pointer to the filter dialog structure.

Definition at line 745 of file gnc-plugin-page-register-filter.cpp.

747 {
748  g_return_if_fail (GTK_IS_BUTTON(button));
749  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(rfd->plugin_page));
750 
751  ENTER("(button %p, page %p)", button, rfd->plugin_page);
752 
753  auto fd = gnc_plugin_page_register_get_filter_data (rfd->plugin_page);
754 
755  /* Turn on all the check menu items */
756  for (const auto& action : status_actions)
757  {
758  set_checkbutton_with_blocking (action.widget,
760  rfd, TRUE);
761  }
762 
763  /* Set the requested status */
764  fd->cleared_match = CLEARED_ALL;
765  gnc_ppr_filter_update_status_query (rfd->plugin_page);
766  LEAVE(" ");
767 }
FilterData * gnc_plugin_page_register_get_filter_data(GncPluginPage *plugin_page)
Get the FilterData data structure associated with this register page.
#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
void gnc_ppr_filter_status_one_cb(GtkToggleButton *button, RegisterFilterDialog *rfd)
This function is called whenever one of the status entries is checked or unchecked.

◆ gnc_ppr_filter_update_register()

void gnc_ppr_filter_update_register ( GncPluginPage plugin_page)

This function is called to update the register.

Parameters
pageA pointer to the GncPluginPageRegister that is associated with this filter dialog.

Definition at line 648 of file gnc-plugin-page-register-filter.cpp.

649 {
650  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
651 
652  auto gsr = gnc_plugin_page_register_get_gsr (plugin_page);
653 
654  if (!gsr)
655  return;
656 
657  auto fd = gnc_plugin_page_register_get_filter_data (plugin_page);
658  GNCLedgerDisplayType ledger_type = gnc_ledger_display_type (gsr->ledger);
659 
660  /* Set the filter for the split register and status of save filter button */
661  fd->save_filter = false;
662 
663  gnc_ppr_filter_load_filter_parts (gsr, ledger_type, fd);
664 
665  if (ledger_type == LD_GL)
666  {
667  SplitRegister *reg = gnc_ledger_display_get_split_register (gsr->ledger);
668 
669  if (reg->type != GENERAL_JOURNAL) // search ledger and the like
670  set_filterdata_to_defaults (fd);
671  }
672  /* Update Query with Filter Status and Dates */
673  gnc_ppr_filter_update_status_query (plugin_page);
674  gnc_ppr_filter_update_date_query (plugin_page);
675 }
FilterData * gnc_plugin_page_register_get_filter_data(GncPluginPage *plugin_page)
Get the FilterData data structure associated with this register page.
SplitRegister * gnc_ledger_display_get_split_register(GNCLedgerDisplay *ld)
return the split register associated with a ledger display
GNCSplitReg * gnc_plugin_page_register_get_gsr(GncPluginPage *plugin_page)
Get the GNCSplitReg data structure associated with this register page.

◆ gnc_ppr_sort_button_cb()

void gnc_ppr_sort_button_cb ( GtkToggleButton *  button,
RegisterSortDialog rsd 
)

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

Parameters
buttonThe button that was toggled.
rsdA pointer to the sort dialog structure.

Definition at line 372 of file gnc-plugin-page-register-sort.cpp.

374 {
375  g_return_if_fail (GTK_IS_TOGGLE_BUTTON(button));
376  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(rsd->plugin_page));
377 
378  auto name = gtk_buildable_get_name (GTK_BUILDABLE(button));
379 
380  ENTER("button %s(%p), page %p", name, button, rsd->plugin_page);
381 
382  if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(button)))
383  {
384  LEAVE("1st callback of pair. Defer to 2nd callback.");
385  return;
386  }
387 
388  auto gsr = gnc_plugin_page_register_get_gsr (rsd->plugin_page);
389 
390  SortType type = SortTypefromString (name);
391  gnc_split_reg_sort (gsr, type, no_force, refresh);
392  LEAVE (" ");
393 }
#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
GNCSplitReg * gnc_plugin_page_register_get_gsr(GncPluginPage *plugin_page)
Get the GNCSplitReg data structure associated with this register page.

◆ gnc_ppr_sort_dialog()

void gnc_ppr_sort_dialog ( GncPluginPage plugin_page,
SplitRegister *  reg,
SortData sd,
bool  show_save_button 
)

This function is called for the sort dialog.

Parameters
plugin_pageA pointer to the GncPluginPageRegister that is associated with this sort dialog.
regA pointer to the SplitRegister of the current register.
fdA pointer to the sort data structure for remembering state.
show_save_buttonSet to True to show save button.

Definition at line 530 of file gnc-plugin-page-register-sort.cpp.

532 {
533  RegisterSortDialog *rsd;
534 
535  ENTER(" ");
536 
537  rsd = g_new0 (RegisterSortDialog, 1);
538 
539  rsd->plugin_page = plugin_page;
540  rsd->reg = reg;
541  rsd->show_save_button = show_save_button;
542 
543  gnc_ppr_sort_dialog_create (rsd, sd);
544 
545  LEAVE(" ");
546 }
#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_ppr_sort_order_reverse_cb()

void gnc_ppr_sort_order_reverse_cb ( GtkToggleButton *  button,
RegisterSortDialog rsd 
)

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.
rsdA pointer to the sort dialog structure.

Definition at line 429 of file gnc-plugin-page-register-sort.cpp.

431 {
432  g_return_if_fail (GTK_IS_CHECK_BUTTON(button));
433  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(rsd->plugin_page));
434 
435  ENTER("Reverse toggle button (%p), page %p", button, rsd->plugin_page);
436 
437  /* Compute the new save sort order */
438  auto sd = gnc_plugin_page_register_get_sort_data (rsd->plugin_page);
439  auto gsr = gnc_plugin_page_register_get_gsr (rsd->plugin_page);
440 
441  sd->reverse_order = gtk_toggle_button_get_active (button);
442  gnc_split_reg_set_sort_reversed (gsr, sd->reverse_order, refresh);
443  LEAVE (" ");
444 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
SortData * gnc_plugin_page_register_get_sort_data(GncPluginPage *plugin_page)
Get the SortData data structure associated with this register page.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
GNCSplitReg * gnc_plugin_page_register_get_gsr(GncPluginPage *plugin_page)
Get the GNCSplitReg data structure associated with this register page.

◆ gnc_ppr_sort_order_save_cb()

void gnc_ppr_sort_order_save_cb ( GtkToggleButton *  button,
RegisterSortDialog rsd 
)

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.
rsdA pointer to the sort dialog structure.

Definition at line 403 of file gnc-plugin-page-register-sort.cpp.

405 {
406  g_return_if_fail (GTK_IS_CHECK_BUTTON(button));
407  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(rsd->plugin_page));
408 
409  ENTER("Save toggle button (%p), page %p", button, rsd->plugin_page);
410 
411  /* Compute the new save sort order */
412  auto sd = gnc_plugin_page_register_get_sort_data (rsd->plugin_page);
413 
414  if (gtk_toggle_button_get_active (button))
415  sd->save_order = true;
416  else
417  sd->save_order = false;
418  LEAVE (" ");
419 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
SortData * gnc_plugin_page_register_get_sort_data(GncPluginPage *plugin_page)
Get the SortData data structure associated with this register page.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_ppr_sort_response_cb()

void gnc_ppr_sort_response_cb ( GtkDialog *  dialog,
gint  response,
RegisterSortDialog rsd 
)

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.
rsdA pointer to the sort dialog structure.

Definition at line 309 of file gnc-plugin-page-register-sort.cpp.

312 {
313  g_return_if_fail (GTK_IS_DIALOG(dialog));
314  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(rsd->plugin_page));
315 
316  ENTER(" ");
317 
318  auto sd = gnc_plugin_page_register_get_sort_data (rsd->plugin_page);
319  auto gsr = gnc_plugin_page_register_get_gsr (rsd->plugin_page);
320 
321  if (response != GTK_RESPONSE_OK)
322  {
323  // Restore the original sort order
324  gnc_split_reg_set_sort_reversed (gsr, rsd->original_reverse_order, no_refresh);
325  sd->reverse_order = rsd->original_reverse_order;
326  // use force as sort_type may still be the same if only reverse_order changed
327  gnc_split_reg_sort (gsr, rsd->original_sort_type, force, refresh);
328  sd->sort_type = rsd->original_sort_type;
329  sd->save_order = rsd->original_save_order;
330  }
331  else
332  {
333  // clear the sort when unticking the save option
334  if ((!sd->save_order) && ((rsd->original_sort_type) ||
335  (rsd->original_reverse_order)))
336  {
337  gnc_ppr_sort_set_order (gsr, DEFAULT_SORT_ORDER);
338  gnc_ppr_sort_set_reversed (gsr, false);
339  }
340  rsd->original_sort_type = sd->sort_type;
341  rsd->original_reverse_order = sd->reverse_order;
342 
343  if (sd->save_order)
344  {
345  SortType type = gnc_split_reg_get_sort_type (gsr);
346  std::string sort_type = (SortTypeasString (type));
347 
348  gnc_ppr_sort_set_order (gsr, sort_type);
349  gnc_ppr_sort_set_reversed (gsr, sd->reverse_order);
350  }
351  }
352  gnc_book_option_remove_cb (OPTION_NAME_NUM_FIELD_SOURCE,
353  gnc_ppr_sort_book_option_changed,
354  (gpointer)rsd);
355  rsd->dialog = nullptr;
356  rsd->num_radio = nullptr;
357  rsd->act_radio = nullptr;
358  sd->dialog = nullptr;
359  g_free (rsd);
360  gtk_widget_destroy (GTK_WIDGET(dialog));
361  LEAVE (" ");
362 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
SortData * gnc_plugin_page_register_get_sort_data(GncPluginPage *plugin_page)
Get the SortData data structure associated with this register page.
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282
GNCSplitReg * gnc_plugin_page_register_get_gsr(GncPluginPage *plugin_page)
Get the GNCSplitReg data structure associated with this register page.

◆ gnc_ppr_sort_update_register()

void gnc_ppr_sort_update_register ( GncPluginPage plugin_page)

This function is called to update the register.

Parameters
pageA pointer to the GncPluginPageRegister that is associated with this sort order dialog.

Definition at line 220 of file gnc-plugin-page-register-sort.cpp.

221 {
222  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
223 
224  auto sd = gnc_plugin_page_register_get_sort_data (plugin_page);
225  auto gsr = gnc_plugin_page_register_get_gsr (plugin_page);
226  GNCLedgerDisplayType ledger_type = gnc_ledger_display_type (gsr->ledger);
227 
228  sd->save_order = false;
229 
230  // Set the sort direction for the split register and status of save order button
231  sd->reverse_order = gnc_ppr_sort_get_reversed (gsr);
232 
233  PINFO("Loaded Sort reversed order is %s", sd->reverse_order ? "true" : "false");
234 
235  gnc_split_reg_set_sort_reversed (gsr, sd->reverse_order, no_refresh);
236  if (sd->reverse_order)
237  sd->save_order = true;
238 
239  // Set the sort order for the split register and status of save order button
240  std::string sort_type = gnc_ppr_sort_get_order (gsr);
241 
242  PINFO("Loaded Sort type is %s", sort_type.c_str());
243 
244  SortType type = SortTypefromString (sort_type.c_str());
245 
246  gnc_split_reg_sort (gsr, type, no_force, no_refresh);
247 
248  if (sort_type.compare (DEFAULT_SORT_ORDER) != 0)
249  sd->save_order = true;
250 
251  if (ledger_type == LD_GL)
252  {
253  auto reg = gnc_ledger_display_get_split_register (gsr->ledger);
254 
255  if (reg->type != GENERAL_JOURNAL) // search ledger and the like
256  {
257  gnc_split_reg_sort (gsr, SortTypefromString (DEFAULT_SORT_ORDER.c_str()), no_force, no_refresh);
258  sd->reverse_order = false;
259  sd->save_order = false;
260  }
261  }
262 }
#define PINFO(format, args...)
Print an informational note.
Definition: qoflog.h:256
SortData * gnc_plugin_page_register_get_sort_data(GncPluginPage *plugin_page)
Get the SortData data structure associated with this register page.
SplitRegister * gnc_ledger_display_get_split_register(GNCLedgerDisplay *ld)
return the split register associated with a ledger display
GNCSplitReg * gnc_plugin_page_register_get_gsr(GncPluginPage *plugin_page)
Get the GNCSplitReg data structure associated with this register page.