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_all_cb (GtkButton *button, GncPluginPageRegister *page)
 This function is called whenever the "select all" status button is clicked. More...
 
void gnc_plugin_page_register_filter_status_one_cb (GtkToggleButton *button, GncPluginPageRegister *page)
 This function is called whenever one of the status entries is checked or unchecked. More...
 
void gnc_plugin_page_register_filter_save_cb (GtkToggleButton *button, GncPluginPageRegister *page)
 This function is called whenever the save status is checked or unchecked. More...
 
void gnc_plugin_page_register_filter_days_changed_cb (GtkSpinButton *button, GncPluginPageRegister *page)
 This function is called when the "number of days" spin button is changed which is then saved and updates the time limitation on the register query. More...
 
void gnc_plugin_page_register_set_filter (GncPluginPage *plugin_page, const gchar *filter)
 
 G_DEFINE_TYPE_WITH_PRIVATE (GncPluginPageRegister, gnc_plugin_page_register, GNC_TYPE_PLUGIN_PAGE) 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 2912 of file gnc-plugin-page-register.cpp.

2913 {
2915 
2916  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page));
2917 
2918  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (plugin_page);
2919 
2920  priv->fd.days = 0;
2921  priv->fd.start_time = 0;
2922  priv->fd.end_time = 0;
2923  priv->fd.cleared_match = (cleared_match_t)g_ascii_strtoll (DEFAULT_FILTER, NULL, 16);
2924 
2925  gnc_ppr_update_date_query (GNC_PLUGIN_PAGE_REGISTER(plugin_page));
2926 }

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

2941 {
2943 
2944  g_return_if_fail (GTK_IS_SPIN_BUTTON (button));
2945  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2946 
2947  ENTER ("(button %p, page %p)", button, page);
2948  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2949 
2950  priv->fd.days = gtk_spin_button_get_value (GTK_SPIN_BUTTON (button));
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_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 3048 of file gnc-plugin-page-register.cpp.

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

3120 {
3122  GncPluginPage* plugin_page;
3123 
3124  g_return_if_fail (GTK_IS_DIALOG (dialog));
3125  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3126 
3127  ENTER (" ");
3128  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3129  plugin_page = GNC_PLUGIN_PAGE (page);
3130 
3131  if (response != GTK_RESPONSE_OK)
3132  {
3133  /* Remove the old status match */
3134  priv->fd.cleared_match = priv->fd.original_cleared_match;
3135  priv->enable_refresh = FALSE;
3136  gnc_ppr_update_status_query (page);
3137  priv->enable_refresh = TRUE;
3138  priv->fd.start_time = priv->fd.original_start_time;
3139  priv->fd.end_time = priv->fd.original_end_time;
3140  priv->fd.days = priv->fd.original_days;
3141  priv->fd.save_filter = priv->fd.original_save_filter;
3142  gnc_ppr_update_date_query (page);
3143  }
3144  else
3145  {
3146  // clear the filter when unticking the save option
3147  if ((priv->fd.save_filter == FALSE) && (priv->fd.original_save_filter == TRUE))
3148  gnc_plugin_page_register_set_filter (plugin_page, NULL);
3149 
3150  priv->fd.original_save_filter = priv->fd.save_filter;
3151 
3152  if (priv->fd.save_filter)
3153  {
3154  gchar *filter;
3155  GList *flist = NULL;
3156 
3157  // cleared match
3158  flist = g_list_prepend
3159  (flist, g_strdup_printf ("0x%04x", priv->fd.cleared_match));
3160 
3161  // start time
3162  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.start_date_choose)) && priv->fd.start_time != 0)
3163  flist = g_list_prepend (flist, gnc_plugin_page_register_filter_time2dmy (priv->fd.start_time));
3164  else
3165  flist = g_list_prepend (flist, g_strdup ("0"));
3166 
3167  // end time
3168  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.end_date_choose))
3169  && priv->fd.end_time != 0)
3170  flist = g_list_prepend (flist, gnc_plugin_page_register_filter_time2dmy (priv->fd.end_time));
3171  else
3172  flist = g_list_prepend (flist, g_strdup ("0"));
3173 
3174  // number of days
3175  if (priv->fd.days > 0)
3176  flist = g_list_prepend (flist, g_strdup_printf ("%d", priv->fd.days));
3177  else
3178  flist = g_list_prepend (flist, g_strdup ("0"));
3179 
3180  flist = g_list_reverse (flist);
3181  filter = gnc_g_list_stringjoin (flist, ",");
3182  PINFO ("The filter to save is %s", filter);
3183  gnc_plugin_page_register_set_filter (plugin_page, filter);
3184  g_free (filter);
3185  g_list_free_full (flist, g_free);
3186  }
3187  }
3188  priv->fd.dialog = NULL;
3189  gtk_widget_destroy (GTK_WIDGET (dialog));
3190  LEAVE (" ");
3191 }
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 3085 of file gnc-plugin-page-register.cpp.

3087 {
3089 
3090  g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
3091  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3092 
3093  ENTER ("Save toggle button (%p), plugin_page %p", button, page);
3094 
3095  /* Compute the new save filter status */
3096  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3097  if (gtk_toggle_button_get_active (button))
3098  priv->fd.save_filter = TRUE;
3099  else
3100  priv->fd.save_filter = FALSE;
3101  LEAVE (" ");
3102 }
#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 2872 of file gnc-plugin-page-register.cpp.

2874 {
2876  gboolean active;
2877  const gchar* name;
2878 
2879  g_return_if_fail (GTK_IS_RADIO_BUTTON (button));
2880  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2881 
2882  ENTER ("(button %p, page %p)", button, page);
2883  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2884  name = gtk_buildable_get_name (GTK_BUILDABLE (button));
2885  active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
2886 
2887  if (active && g_strcmp0 (name, "filter_show_range") == 0)
2888  {
2889  gtk_widget_set_sensitive (priv->fd.table, active);
2890  gtk_widget_set_sensitive (priv->fd.num_days, !active);
2891  get_filter_times (page);
2892  }
2893  else if (active && g_strcmp0 (name, "filter_show_days") == 0)
2894  {
2895  gtk_widget_set_sensitive (priv->fd.table, !active);
2896  gtk_widget_set_sensitive (priv->fd.num_days, active);
2897  gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->fd.num_days), priv->fd.days);
2898  }
2899  else
2900  {
2901  gtk_widget_set_sensitive (priv->fd.table, FALSE);
2902  gtk_widget_set_sensitive (priv->fd.num_days, FALSE);
2903  priv->fd.days = 0;
2904  priv->fd.start_time = 0;
2905  priv->fd.end_time = 0;
2906  }
2907  gnc_ppr_update_date_query (page);
2908  LEAVE (" ");
2909 }
#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 3000 of file gnc-plugin-page-register.cpp.

3002 {
3004  const gchar* name;
3005  gboolean active;
3006 
3007  g_return_if_fail (GTK_IS_RADIO_BUTTON (radio));
3008  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3009 
3010  ENTER ("(radio %s(%p), page %p)",
3011  gtk_buildable_get_name (GTK_BUILDABLE (radio)), radio, page);
3012  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3013  if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
3014  {
3015  LEAVE ("1st callback of pair. Defer to 2nd callback.");
3016  return;
3017  }
3018 
3019  name = gtk_buildable_get_name (GTK_BUILDABLE (radio));
3020  active = !g_strcmp0 (name, "start_date_choose");
3021  gtk_widget_set_sensitive (priv->fd.start_date, active);
3022  get_filter_times (page);
3023  gnc_ppr_update_date_query (page);
3024  LEAVE (" ");
3025 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register_filter_status_all_cb()

void gnc_plugin_page_register_filter_status_all_cb ( GtkButton *  button,
GncPluginPageRegister page 
)

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

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

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

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

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

2726 {
2728  const gchar* name;
2729  gint i, value;
2730 
2731  g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
2732  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2733 
2734  name = gtk_buildable_get_name (GTK_BUILDABLE (button));
2735  ENTER ("toggle button %s (%p), plugin_page %p", name, button, page);
2736 
2737  /* Determine what status bit to change */
2738  value = CLEARED_NONE;
2739  for (i = 0; status_actions[i].action_name; i++)
2740  {
2741  if (g_strcmp0 (name, status_actions[i].action_name) == 0)
2742  {
2743  value = status_actions[i].value;
2744  break;
2745  }
2746  }
2747 
2748  /* Compute the new match status */
2749  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2750  if (gtk_toggle_button_get_active (button))
2751  priv->fd.cleared_match = (cleared_match_t)(priv->fd.cleared_match | value);
2752  else
2753  priv->fd.cleared_match = (cleared_match_t)(priv->fd.cleared_match & ~value);
2754  gnc_ppr_update_status_query (page);
2755  LEAVE (" ");
2756 }
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register_get_account()

Account * gnc_plugin_page_register_get_account ( GncPluginPageRegister page)

Get the Account associated with this register page.

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

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

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

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

5143 {
5144  GncPluginPageRegister* page;
5146 
5147  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), NULL);
5148 
5149  page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
5150  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
5151 
5152  return priv->gsr;
5153 }

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

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

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

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

604 {
605  return gnc_plugin_page_register_new_common (ledger);
606 }

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

5129 {
5130  GncPluginPageRegister* page;
5132 
5133  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page));
5134 
5135  page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
5136  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
5137  priv->lines_default = lines_default;
5138  priv->read_only = read_only;
5139 }

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

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

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

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

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