GnuCash  5.6-150-g038405b370+
Files | Data Structures | Macros | Functions

Files

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

Data Structures

struct  status_action
 
struct  GncPluginPageRegisterPrivate
 
struct  GncPluginPageRegister
 
struct  GncPluginPageRegisterClass
 

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"
 

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_select_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_clear_all_cb (GtkButton *button, GncPluginPageRegister *page)
 This function is called whenever the "clear 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) 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_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...
 

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

2957 {
2959 
2960  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page));
2961 
2962  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (plugin_page);
2963 
2964  priv->fd.days = 0;
2965  priv->fd.start_time = 0;
2966  priv->fd.end_time = 0;
2967  priv->fd.cleared_match = (cleared_match_t)g_ascii_strtoll (DEFAULT_FILTER, NULL, 16);
2968 
2969  gnc_ppr_update_date_query (GNC_PLUGIN_PAGE_REGISTER(plugin_page));
2970 }

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

2985 {
2987 
2988  g_return_if_fail (GTK_IS_SPIN_BUTTON (button));
2989  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2990 
2991  ENTER ("(button %p, page %p)", button, page);
2992  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2993 
2994  priv->fd.days = gtk_spin_button_get_value (GTK_SPIN_BUTTON (button));
2995  gnc_ppr_update_date_query (page);
2996  LEAVE (" ");
2997 }
#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 3092 of file gnc-plugin-page-register.cpp.

3094 {
3096  const gchar* name;
3097  gboolean active;
3098 
3099  g_return_if_fail (GTK_IS_RADIO_BUTTON (radio));
3100  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3101 
3102  ENTER ("(radio %s(%p), page %p)",
3103  gtk_buildable_get_name (GTK_BUILDABLE (radio)), radio, page);
3104  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3105  if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
3106  {
3107  LEAVE ("1st callback of pair. Defer to 2nd callback.");
3108  return;
3109  }
3110 
3111  name = gtk_buildable_get_name (GTK_BUILDABLE (radio));
3112  active = !g_strcmp0 (name, "end_date_choose");
3113  gtk_widget_set_sensitive (priv->fd.end_date, active);
3114  get_filter_times (page);
3115  gnc_ppr_update_date_query (page);
3116  LEAVE (" ");
3117 }
#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 3161 of file gnc-plugin-page-register.cpp.

3164 {
3166  GncPluginPage* plugin_page;
3167 
3168  g_return_if_fail (GTK_IS_DIALOG (dialog));
3169  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3170 
3171  ENTER (" ");
3172  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3173  plugin_page = GNC_PLUGIN_PAGE (page);
3174 
3175  if (response != GTK_RESPONSE_OK)
3176  {
3177  /* Remove the old status match */
3178  priv->fd.cleared_match = priv->fd.original_cleared_match;
3179  priv->enable_refresh = FALSE;
3180  gnc_ppr_update_status_query (page);
3181  priv->enable_refresh = TRUE;
3182  priv->fd.start_time = priv->fd.original_start_time;
3183  priv->fd.end_time = priv->fd.original_end_time;
3184  priv->fd.days = priv->fd.original_days;
3185  priv->fd.save_filter = priv->fd.original_save_filter;
3186  gnc_ppr_update_date_query (page);
3187  }
3188  else
3189  {
3190  // clear the filter when unticking the save option
3191  if ((priv->fd.save_filter == FALSE) && (priv->fd.original_save_filter == TRUE))
3192  gnc_plugin_page_register_set_filter (plugin_page, NULL);
3193 
3194  priv->fd.original_save_filter = priv->fd.save_filter;
3195 
3196  if (priv->fd.save_filter)
3197  {
3198  gchar *filter;
3199  GList *flist = NULL;
3200 
3201  // cleared match
3202  flist = g_list_prepend
3203  (flist, g_strdup_printf ("0x%04x", priv->fd.cleared_match));
3204 
3205  // start time
3206  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.start_date_choose)) && priv->fd.start_time != 0)
3207  flist = g_list_prepend (flist, gnc_plugin_page_register_filter_time2dmy (priv->fd.start_time));
3208  else
3209  flist = g_list_prepend (flist, g_strdup ("0"));
3210 
3211  // end time
3212  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.end_date_choose))
3213  && priv->fd.end_time != 0)
3214  flist = g_list_prepend (flist, gnc_plugin_page_register_filter_time2dmy (priv->fd.end_time));
3215  else
3216  flist = g_list_prepend (flist, g_strdup ("0"));
3217 
3218  // number of days
3219  if (priv->fd.days > 0)
3220  flist = g_list_prepend (flist, g_strdup_printf ("%d", priv->fd.days));
3221  else
3222  flist = g_list_prepend (flist, g_strdup ("0"));
3223 
3224  flist = g_list_reverse (flist);
3225  filter = gnc_g_list_stringjoin (flist, ",");
3226  PINFO ("The filter to save is %s", filter);
3227  gnc_plugin_page_register_set_filter (plugin_page, filter);
3228  g_free (filter);
3229  g_list_free_full (flist, g_free);
3230  }
3231  }
3232  priv->fd.dialog = NULL;
3233  gtk_widget_destroy (GTK_WIDGET (dialog));
3234  LEAVE (" ");
3235 }
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 3129 of file gnc-plugin-page-register.cpp.

3131 {
3133 
3134  g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
3135  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3136 
3137  ENTER ("Save toggle button (%p), plugin_page %p", button, page);
3138 
3139  /* Compute the new save filter status */
3140  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3141  if (gtk_toggle_button_get_active (button))
3142  priv->fd.save_filter = TRUE;
3143  else
3144  priv->fd.save_filter = FALSE;
3145  LEAVE (" ");
3146 }
#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 2916 of file gnc-plugin-page-register.cpp.

2918 {
2920  gboolean active;
2921  const gchar* name;
2922 
2923  g_return_if_fail (GTK_IS_RADIO_BUTTON (button));
2924  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2925 
2926  ENTER ("(button %p, page %p)", button, page);
2927  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2928  name = gtk_buildable_get_name (GTK_BUILDABLE (button));
2929  active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
2930 
2931  if (active && g_strcmp0 (name, "filter_show_range") == 0)
2932  {
2933  gtk_widget_set_sensitive (priv->fd.table, active);
2934  gtk_widget_set_sensitive (priv->fd.num_days, !active);
2935  get_filter_times (page);
2936  }
2937  else if (active && g_strcmp0 (name, "filter_show_days") == 0)
2938  {
2939  gtk_widget_set_sensitive (priv->fd.table, !active);
2940  gtk_widget_set_sensitive (priv->fd.num_days, active);
2941  gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->fd.num_days), priv->fd.days);
2942  }
2943  else
2944  {
2945  gtk_widget_set_sensitive (priv->fd.table, FALSE);
2946  gtk_widget_set_sensitive (priv->fd.num_days, FALSE);
2947  priv->fd.days = 0;
2948  priv->fd.start_time = 0;
2949  priv->fd.end_time = 0;
2950  }
2951  gnc_ppr_update_date_query (page);
2952  LEAVE (" ");
2953 }
#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 3044 of file gnc-plugin-page-register.cpp.

3046 {
3048  const gchar* name;
3049  gboolean active;
3050 
3051  g_return_if_fail (GTK_IS_RADIO_BUTTON (radio));
3052  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3053 
3054  ENTER ("(radio %s(%p), page %p)",
3055  gtk_buildable_get_name (GTK_BUILDABLE (radio)), radio, page);
3056  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3057  if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
3058  {
3059  LEAVE ("1st callback of pair. Defer to 2nd callback.");
3060  return;
3061  }
3062 
3063  name = gtk_buildable_get_name (GTK_BUILDABLE (radio));
3064  active = !g_strcmp0 (name, "start_date_choose");
3065  gtk_widget_set_sensitive (priv->fd.start_date, active);
3066  get_filter_times (page);
3067  gnc_ppr_update_date_query (page);
3068  LEAVE (" ");
3069 }
#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_clear_all_cb()

void gnc_plugin_page_register_filter_status_clear_all_cb ( GtkButton *  button,
GncPluginPageRegister page 
)

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.
pageA pointer to the GncPluginPageRegister that is associated with this filter dialog.

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

2815 {
2817  GtkWidget* widget;
2818  gint i;
2819 
2820  g_return_if_fail (GTK_IS_BUTTON (button));
2821  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2822 
2823  ENTER ("(button %p, page %p)", button, page);
2824 
2825  /* Turn off all the check menu items */
2826  for (i = 0; status_actions[i].action_name; i++)
2827  {
2828  widget = status_actions[i].widget;
2829  g_signal_handlers_block_by_func (widget,
2831  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
2832  g_signal_handlers_unblock_by_func (widget,
2834  }
2835 
2836  /* Set the requested status */
2837  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2838  priv->fd.cleared_match = CLEARED_NONE;
2839  gnc_ppr_update_status_query (page);
2840  LEAVE (" ");
2841 }
#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 2726 of file gnc-plugin-page-register.cpp.

2728 {
2730  const gchar* name;
2731  gint i, value;
2732 
2733  g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
2734  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2735 
2736  name = gtk_buildable_get_name (GTK_BUILDABLE (button));
2737  ENTER ("toggle button %s (%p), plugin_page %p", name, button, page);
2738 
2739  /* Determine what status bit to change */
2740  value = CLEARED_NONE;
2741  for (i = 0; status_actions[i].action_name; i++)
2742  {
2743  if (g_strcmp0 (name, status_actions[i].action_name) == 0)
2744  {
2745  value = status_actions[i].value;
2746  break;
2747  }
2748  }
2749 
2750  /* Compute the new match status */
2751  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2752  if (gtk_toggle_button_get_active (button))
2753  priv->fd.cleared_match = (cleared_match_t)(priv->fd.cleared_match | value);
2754  else
2755  priv->fd.cleared_match = (cleared_match_t)(priv->fd.cleared_match & ~value);
2756  gnc_ppr_update_status_query (page);
2757  LEAVE (" ");
2758 }
#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_select_all_cb()

void gnc_plugin_page_register_filter_status_select_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 2771 of file gnc-plugin-page-register.cpp.

2773 {
2775  GtkWidget* widget;
2776  gint i;
2777 
2778  g_return_if_fail (GTK_IS_BUTTON (button));
2779  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2780 
2781  ENTER ("(button %p, page %p)", button, page);
2782 
2783  /* Turn on all the check menu items */
2784  for (i = 0; status_actions[i].action_name; i++)
2785  {
2786  widget = status_actions[i].widget;
2787  g_signal_handlers_block_by_func (widget,
2789  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
2790  g_signal_handlers_unblock_by_func (widget,
2792  }
2793 
2794  /* Set the requested status */
2795  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2796  priv->fd.cleared_match = CLEARED_ALL;
2797  gnc_ppr_update_status_query (page);
2798  LEAVE (" ");
2799 }
#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_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 682 of file gnc-plugin-page-register.cpp.

683 {
685  GNCLedgerDisplayType ledger_type;
686  Account* leader;
687 
688  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
689  ledger_type = gnc_ledger_display_type (priv->ledger);
690  leader = gnc_ledger_display_leader (priv->ledger);
691 
692  if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
693  return leader;
694  return NULL;
695 }
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 698 of file gnc-plugin-page-register.cpp.

699 {
701  SplitRegister* reg;
702 
703  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
704  reg = gnc_ledger_display_get_split_register (priv->ledger);
706 }
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 5186 of file gnc-plugin-page-register.cpp.

5187 {
5188  GncPluginPageRegister* page;
5190 
5191  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), NULL);
5192 
5193  page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
5194  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
5195 
5196  return priv->gsr;
5197 }

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

2302 {
2303  GncPluginPageRegister* page;
2305 
2306  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), NULL);
2307 
2308  page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
2309  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2310  return gnc_ledger_display_get_query (priv->ledger);
2311 }
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 566 of file gnc-plugin-page-register.cpp.

567 {
568  GNCLedgerDisplay* ledger;
569  GncPluginPage* page;
571  gnc_commodity* com0;
572  gnc_commodity* com1;
573 
574  ENTER ("account=%p, subaccounts=%s", account,
575  subaccounts ? "TRUE" : "FALSE");
576 
577  com0 = gnc_account_get_currency_or_parent (account);
578  com1 = GNC_COMMODITY(gnc_account_foreach_descendant_until (account,
579  gnc_plug_page_register_check_commodity,
580  static_cast<gpointer>(com0)));
581 
582  if (subaccounts)
583  ledger = gnc_ledger_display_subaccounts (account, com1 != NULL);
584  else
585  ledger = gnc_ledger_display_simple (account);
586 
587  page = gnc_plugin_page_register_new_common (ledger);
588  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
589  priv->key = *xaccAccountGetGUID (account);
590 
591  LEAVE ("%p", page);
592  return page;
593 }
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:3194
#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
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:3358
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 596 of file gnc-plugin-page-register.cpp.

597 {
598  GNCLedgerDisplay* ledger;
599 
600  ledger = gnc_ledger_display_gl();
601  return gnc_plugin_page_register_new_common (ledger);
602 }
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 605 of file gnc-plugin-page-register.cpp.

606 {
607  return gnc_plugin_page_register_new_common (ledger);
608 }

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

5173 {
5174  GncPluginPageRegister* page;
5176 
5177  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page));
5178 
5179  page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
5180  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
5181  priv->lines_default = lines_default;
5182  priv->read_only = read_only;
5183 }

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

2430 {
2432  const gchar* name;
2433  SortType type;
2434 
2435  g_return_if_fail (GTK_IS_TOGGLE_BUTTON (button));
2436  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2437 
2438  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2439  name = gtk_buildable_get_name (GTK_BUILDABLE (button));
2440  ENTER ("button %s(%p), page %p", name, button, page);
2441  type = SortTypefromString (name);
2442  gnc_split_reg_set_sort_type (priv->gsr, type);
2443  LEAVE (" ");
2444 }
#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 2485 of file gnc-plugin-page-register.cpp.

2488 {
2490 
2491  g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
2492  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2493 
2494  ENTER ("Reverse toggle button (%p), plugin_page %p", button, page);
2495 
2496  /* Compute the new save sort order */
2497  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2498 
2499  priv->sd.reverse_order = gtk_toggle_button_get_active (button);
2500  gnc_split_reg_set_sort_reversed (priv->gsr, priv->sd.reverse_order, TRUE);
2501  LEAVE (" ");
2502 }
#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 2456 of file gnc-plugin-page-register.cpp.

2458 {
2460 
2461  g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
2462  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2463 
2464  ENTER ("Save toggle button (%p), plugin_page %p", button, page);
2465 
2466  /* Compute the new save sort order */
2467  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2468 
2469  if (gtk_toggle_button_get_active (button))
2470  priv->sd.save_order = TRUE;
2471  else
2472  priv->sd.save_order = FALSE;
2473  LEAVE (" ");
2474 }
#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 2364 of file gnc-plugin-page-register.cpp.

2367 {
2369  GncPluginPage* plugin_page;
2370  SortType type;
2371  const gchar* order;
2372 
2373  g_return_if_fail (GTK_IS_DIALOG (dialog));
2374  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2375 
2376  ENTER (" ");
2377  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2378  plugin_page = GNC_PLUGIN_PAGE (page);
2379 
2380  if (response != GTK_RESPONSE_OK)
2381  {
2382  /* Restore the original sort order */
2383  gnc_split_reg_set_sort_reversed (priv->gsr, priv->sd.original_reverse_order,
2384  TRUE);
2385  priv->sd.reverse_order = priv->sd.original_reverse_order;
2386  gnc_split_reg_set_sort_type (priv->gsr, priv->sd.original_sort_type);
2387  priv->sd.save_order = priv->sd.original_save_order;
2388  }
2389  else
2390  {
2391  // clear the sort when unticking the save option
2392  if ((!priv->sd.save_order) && ((priv->sd.original_save_order) || (priv->sd.original_reverse_order)))
2393  {
2394  gnc_plugin_page_register_set_sort_order (plugin_page, DEFAULT_SORT_ORDER);
2395  gnc_plugin_page_register_set_sort_reversed (plugin_page, FALSE);
2396  }
2397  priv->sd.original_save_order = priv->sd.save_order;
2398 
2399  if (priv->sd.save_order)
2400  {
2401  type = gnc_split_reg_get_sort_type (priv->gsr);
2402  order = SortTypeasString (type);
2403  gnc_plugin_page_register_set_sort_order (plugin_page, order);
2404  gnc_plugin_page_register_set_sort_reversed (plugin_page,
2405  priv->sd.reverse_order);
2406  }
2407  }
2408  gnc_book_option_remove_cb (OPTION_NAME_NUM_FIELD_SOURCE,
2409  gnc_plugin_page_register_sort_book_option_changed,
2410  page);
2411  priv->sd.dialog = NULL;
2412  priv->sd.num_radio = NULL;
2413  priv->sd.act_radio = NULL;
2414  gtk_widget_destroy (GTK_WIDGET (dialog));
2415  LEAVE (" ");
2416 }
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