GnuCash  4.11-627-g58c1a51897
Files | Data Structures | Macros | Functions

Files

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

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)
 
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 3076 of file gnc-plugin-page-register.c.

3077 {
3079 
3080  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page));
3081 
3082  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (plugin_page);
3083 
3084  priv->fd.days = 0;
3085  priv->fd.start_time = 0;
3086  priv->fd.end_time = 0;
3087  priv->fd.cleared_match = (gint)g_ascii_strtoll (DEFAULT_FILTER, NULL, 16);
3088 
3089  gnc_ppr_update_date_query (GNC_PLUGIN_PAGE_REGISTER(plugin_page));
3090 }

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

3105 {
3107 
3108  g_return_if_fail (GTK_IS_SPIN_BUTTON (button));
3109  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3110 
3111  ENTER ("(button %p, page %p)", button, page);
3112  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3113 
3114  priv->fd.days = gtk_spin_button_get_value (GTK_SPIN_BUTTON (button));
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_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 3212 of file gnc-plugin-page-register.c.

3214 {
3216  const gchar* name;
3217  gboolean active;
3218 
3219  g_return_if_fail (GTK_IS_RADIO_BUTTON (radio));
3220  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3221 
3222  ENTER ("(radio %s(%p), page %p)",
3223  gtk_buildable_get_name (GTK_BUILDABLE (radio)), radio, page);
3224  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3225  if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
3226  {
3227  LEAVE ("1st callback of pair. Defer to 2nd callback.");
3228  return;
3229  }
3230 
3231  name = gtk_buildable_get_name (GTK_BUILDABLE (radio));
3232  active = !g_strcmp0 (name, "end_date_choose");
3233  gtk_widget_set_sensitive (priv->fd.end_date, active);
3234  get_filter_times (page);
3235  gnc_ppr_update_date_query (page);
3236  LEAVE (" ");
3237 }
#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 3281 of file gnc-plugin-page-register.c.

3284 {
3286  GncPluginPage* plugin_page;
3287 
3288  g_return_if_fail (GTK_IS_DIALOG (dialog));
3289  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3290 
3291  ENTER (" ");
3292  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3293  plugin_page = GNC_PLUGIN_PAGE (page);
3294 
3295  if (response != GTK_RESPONSE_OK)
3296  {
3297  /* Remove the old status match */
3298  priv->fd.cleared_match = priv->fd.original_cleared_match;
3299  priv->enable_refresh = FALSE;
3300  gnc_ppr_update_status_query (page);
3301  priv->enable_refresh = TRUE;
3302  priv->fd.start_time = priv->fd.original_start_time;
3303  priv->fd.end_time = priv->fd.original_end_time;
3304  priv->fd.days = priv->fd.original_days;
3305  priv->fd.save_filter = priv->fd.original_save_filter;
3306  gnc_ppr_update_date_query (page);
3307  }
3308  else
3309  {
3310  // clear the filter when unticking the save option
3311  if ((priv->fd.save_filter == FALSE) && (priv->fd.original_save_filter == TRUE))
3312  gnc_plugin_page_register_set_filter (plugin_page, NULL);
3313 
3314  priv->fd.original_save_filter = priv->fd.save_filter;
3315 
3316  if (priv->fd.save_filter)
3317  {
3318  gchar *filter;
3319  GList *flist = NULL;
3320 
3321  // cleared match
3322  flist = g_list_prepend
3323  (flist, g_strdup_printf ("0x%04x", priv->fd.cleared_match));
3324 
3325  // start time
3326  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.start_date_choose)) && priv->fd.start_time != 0)
3327  flist = g_list_prepend (flist, gnc_plugin_page_register_filter_time2dmy (priv->fd.start_time));
3328  else
3329  flist = g_list_prepend (flist, g_strdup ("0"));
3330 
3331  // end time
3332  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.end_date_choose))
3333  && priv->fd.end_time != 0)
3334  flist = g_list_prepend (flist, gnc_plugin_page_register_filter_time2dmy (priv->fd.end_time));
3335  else
3336  flist = g_list_prepend (flist, g_strdup ("0"));
3337 
3338  // number of days
3339  if (priv->fd.days > 0)
3340  flist = g_list_prepend (flist, g_strdup_printf ("%d", priv->fd.days));
3341  else
3342  flist = g_list_prepend (flist, g_strdup ("0"));
3343 
3344  flist = g_list_reverse (flist);
3345  filter = gnc_g_list_stringjoin (flist, ",");
3346  PINFO ("The filter to save is %s", filter);
3347  gnc_plugin_page_register_set_filter (plugin_page, filter);
3348  g_free (filter);
3349  g_list_free_full (flist, g_free);
3350  }
3351  }
3352  priv->fd.dialog = NULL;
3353  gtk_widget_destroy (GTK_WIDGET (dialog));
3354  LEAVE (" ");
3355 }
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 3249 of file gnc-plugin-page-register.c.

3251 {
3253 
3254  g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
3255  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3256 
3257  ENTER ("Save toggle button (%p), plugin_page %p", button, page);
3258 
3259  /* Compute the new save filter status */
3260  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3261  if (gtk_toggle_button_get_active (button))
3262  priv->fd.save_filter = TRUE;
3263  else
3264  priv->fd.save_filter = FALSE;
3265  LEAVE (" ");
3266 }
#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 3036 of file gnc-plugin-page-register.c.

3038 {
3040  gboolean active;
3041  const gchar* name;
3042 
3043  g_return_if_fail (GTK_IS_RADIO_BUTTON (button));
3044  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3045 
3046  ENTER ("(button %p, page %p)", button, page);
3047  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3048  name = gtk_buildable_get_name (GTK_BUILDABLE (button));
3049  active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
3050 
3051  if (active && g_strcmp0 (name, "filter_show_range") == 0)
3052  {
3053  gtk_widget_set_sensitive (priv->fd.table, active);
3054  gtk_widget_set_sensitive (priv->fd.num_days, !active);
3055  get_filter_times (page);
3056  }
3057  else if (active && g_strcmp0 (name, "filter_show_days") == 0)
3058  {
3059  gtk_widget_set_sensitive (priv->fd.table, !active);
3060  gtk_widget_set_sensitive (priv->fd.num_days, active);
3061  gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->fd.num_days), priv->fd.days);
3062  }
3063  else
3064  {
3065  gtk_widget_set_sensitive (priv->fd.table, FALSE);
3066  gtk_widget_set_sensitive (priv->fd.num_days, FALSE);
3067  priv->fd.days = 0;
3068  priv->fd.start_time = 0;
3069  priv->fd.end_time = 0;
3070  }
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_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 3164 of file gnc-plugin-page-register.c.

3166 {
3168  const gchar* name;
3169  gboolean active;
3170 
3171  g_return_if_fail (GTK_IS_RADIO_BUTTON (radio));
3172  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3173 
3174  ENTER ("(radio %s(%p), page %p)",
3175  gtk_buildable_get_name (GTK_BUILDABLE (radio)), radio, page);
3176  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3177  if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
3178  {
3179  LEAVE ("1st callback of pair. Defer to 2nd callback.");
3180  return;
3181  }
3182 
3183  name = gtk_buildable_get_name (GTK_BUILDABLE (radio));
3184  active = !g_strcmp0 (name, "start_date_choose");
3185  gtk_widget_set_sensitive (priv->fd.start_date, active);
3186  get_filter_times (page);
3187  gnc_ppr_update_date_query (page);
3188  LEAVE (" ");
3189 }
#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 2933 of file gnc-plugin-page-register.c.

2935 {
2937  GtkWidget* widget;
2938  gint i;
2939 
2940  g_return_if_fail (GTK_IS_BUTTON (button));
2941  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2942 
2943  ENTER ("(button %p, page %p)", button, page);
2944 
2945  /* Turn on all the check menu items */
2946  for (i = 0; status_actions[i].action_name; i++)
2947  {
2948  widget = status_actions[i].widget;
2949  g_signal_handlers_block_by_func (widget,
2951  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
2952  g_signal_handlers_unblock_by_func (widget,
2954  }
2955 
2956  /* Set the requested status */
2957  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2958  priv->fd.cleared_match = CLEARED_ALL;
2959  gnc_ppr_update_status_query (page);
2960  LEAVE (" ");
2961 }
#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 2888 of file gnc-plugin-page-register.c.

2890 {
2892  const gchar* name;
2893  gint i, value;
2894 
2895  g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
2896  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2897 
2898  name = gtk_buildable_get_name (GTK_BUILDABLE (button));
2899  ENTER ("toggle button %s (%p), plugin_page %p", name, button, page);
2900 
2901  /* Determine what status bit to change */
2902  value = CLEARED_NONE;
2903  for (i = 0; status_actions[i].action_name; i++)
2904  {
2905  if (g_strcmp0 (name, status_actions[i].action_name) == 0)
2906  {
2907  value = status_actions[i].value;
2908  break;
2909  }
2910  }
2911 
2912  /* Compute the new match status */
2913  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2914  if (gtk_toggle_button_get_active (button))
2915  priv->fd.cleared_match |= value;
2916  else
2917  priv->fd.cleared_match &= ~value;
2918  gnc_ppr_update_status_query (page);
2919  LEAVE (" ");
2920 }
#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 945 of file gnc-plugin-page-register.c.

946 {
948  GNCLedgerDisplayType ledger_type;
949  Account* leader;
950 
951  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
952  ledger_type = gnc_ledger_display_type (priv->ledger);
953  leader = gnc_ledger_display_leader (priv->ledger);
954 
955  if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
956  return leader;
957  return NULL;
958 }
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 961 of file gnc-plugin-page-register.c.

962 {
964  SplitRegister* reg;
965 
966  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
967  reg = gnc_ledger_display_get_split_register (priv->ledger);
969 }
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 5209 of file gnc-plugin-page-register.c.

5210 {
5211  GncPluginPageRegister* page;
5213 
5214  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), NULL);
5215 
5216  page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
5217  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
5218 
5219  return priv->gsr;
5220 }

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

2464 {
2465  GncPluginPageRegister* page;
2467 
2468  g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), NULL);
2469 
2470  page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
2471  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2472  return gnc_ledger_display_get_query (priv->ledger);
2473 }
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 816 of file gnc-plugin-page-register.c.

817 {
818  GNCLedgerDisplay* ledger;
819  GncPluginPage* page;
821  gnc_commodity* com0;
822  gnc_commodity* com1;
823 
824  ENTER ("account=%p, subaccounts=%s", account,
825  subaccounts ? "TRUE" : "FALSE");
826 
827  com0 = gnc_account_get_currency_or_parent (account);
828  com1 = gnc_account_foreach_descendant_until (account,
829  gnc_plug_page_register_check_commodity, com0);
830 
831  if (subaccounts)
832  ledger = gnc_ledger_display_subaccounts (account, com1 != NULL);
833  else
834  ledger = gnc_ledger_display_simple (account);
835 
836  page = gnc_plugin_page_register_new_common (ledger);
837  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
838  priv->key = *xaccAccountGetGUID (account);
839 
840  LEAVE ("%p", page);
841  return page;
842 }
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 'func' on each...
Definition: Account.cpp:3253
#define ENTER(format, args...)
Print a function entry debugging message.
Definition: qoflog.h:272
GNCLedgerDisplay * gnc_ledger_display_subaccounts(Account *account, gboolean mismatched_commodities)
opens up a register window to display the parent account and all of its children. ...
#define xaccAccountGetGUID(X)
Definition: Account.h:254
gnc_commodity * gnc_account_get_currency_or_parent(const Account *account)
Returns a gnc_commodity that is a currency, suitable for being a Transaction's currency.
Definition: Account.cpp:3455
GNCLedgerDisplay * gnc_ledger_display_simple(Account *account)
opens up a register window to display a single account
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition: qoflog.h:282

◆ gnc_plugin_page_register_new_gl()

GncPluginPage * gnc_plugin_page_register_new_gl ( void  )

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

Returns
The newly created plugin page.

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

846 {
847  GNCLedgerDisplay* ledger;
848 
849  ledger = gnc_ledger_display_gl();
850  return gnc_plugin_page_register_new_common (ledger);
851 }
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 854 of file gnc-plugin-page-register.c.

855 {
856  return gnc_plugin_page_register_new_common (ledger);
857 }

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

5196 {
5197  GncPluginPageRegister* page;
5199 
5200  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page));
5201 
5202  page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
5203  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
5204  priv->lines_default = lines_default;
5205  priv->read_only = read_only;
5206 }

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

2592 {
2594  const gchar* name;
2595  SortType type;
2596 
2597  g_return_if_fail (GTK_IS_TOGGLE_BUTTON (button));
2598  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2599 
2600  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2601  name = gtk_buildable_get_name (GTK_BUILDABLE (button));
2602  ENTER ("button %s(%p), page %p", name, button, page);
2603  type = SortTypefromString (name);
2604  gnc_split_reg_set_sort_type (priv->gsr, type);
2605  LEAVE (" ");
2606 }
#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 2647 of file gnc-plugin-page-register.c.

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

◆ gnc_plugin_page_register_sort_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 2618 of file gnc-plugin-page-register.c.

2620 {
2622 
2623  g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
2624  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2625 
2626  ENTER ("Save toggle button (%p), plugin_page %p", button, page);
2627 
2628  /* Compute the new save sort order */
2629  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2630 
2631  if (gtk_toggle_button_get_active (button))
2632  priv->sd.save_order = TRUE;
2633  else
2634  priv->sd.save_order = FALSE;
2635  LEAVE (" ");
2636 }
#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 2526 of file gnc-plugin-page-register.c.

2529 {
2531  GncPluginPage* plugin_page;
2532  SortType type;
2533  const gchar* order;
2534 
2535  g_return_if_fail (GTK_IS_DIALOG (dialog));
2536  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2537 
2538  ENTER (" ");
2539  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2540  plugin_page = GNC_PLUGIN_PAGE (page);
2541 
2542  if (response != GTK_RESPONSE_OK)
2543  {
2544  /* Restore the original sort order */
2545  gnc_split_reg_set_sort_reversed (priv->gsr, priv->sd.original_reverse_order,
2546  TRUE);
2547  priv->sd.reverse_order = priv->sd.original_reverse_order;
2548  gnc_split_reg_set_sort_type (priv->gsr, priv->sd.original_sort_type);
2549  priv->sd.save_order = priv->sd.original_save_order;
2550  }
2551  else
2552  {
2553  // clear the sort when unticking the save option
2554  if ((!priv->sd.save_order) && ((priv->sd.original_save_order) || (priv->sd.original_reverse_order)))
2555  {
2556  gnc_plugin_page_register_set_sort_order (plugin_page, DEFAULT_SORT_ORDER);
2557  gnc_plugin_page_register_set_sort_reversed (plugin_page, FALSE);
2558  }
2559  priv->sd.original_save_order = priv->sd.save_order;
2560 
2561  if (priv->sd.save_order)
2562  {
2563  type = gnc_split_reg_get_sort_type (priv->gsr);
2564  order = SortTypeasString (type);
2565  gnc_plugin_page_register_set_sort_order (plugin_page, order);
2566  gnc_plugin_page_register_set_sort_reversed (plugin_page,
2567  priv->sd.reverse_order);
2568  }
2569  }
2570  gnc_book_option_remove_cb (OPTION_NAME_NUM_FIELD_SOURCE,
2571  gnc_plugin_page_register_sort_book_option_changed,
2572  page);
2573  priv->sd.dialog = NULL;
2574  priv->sd.num_radio = NULL;
2575  priv->sd.act_radio = NULL;
2576  gtk_widget_destroy (GTK_WIDGET (dialog));
2577  LEAVE (" ");
2578 }
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