GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Files | Data Structures | Macros | Typedefs | Functions
Register Page

Files

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

Data Structures

struct  status_action
 
struct  GncPluginPageRegisterPrivate
 
struct  GncPluginPageRegister
 
struct  GncPluginPageRegisterClass
 
struct  GncPluginPageRegister2Private
 

Macros

#define DEFAULT_LINES_AMOUNT   50
 
#define 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 ASSOCIATE_TRANSACTION_FILE_LABEL   N_("_Associate File with Transaction")
 
#define ASSOCIATE_TRANSACTION_LOCATION_LABEL   N_("_Associate Location with Transaction")
 
#define EXECASSOCIATED_TRANSACTION_LABEL   N_("_Open Associated File/Location")
 
#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 ASSOCIATE_TRANSACTION_FILE_TIP   N_("Associate a file with the current transaction")
 
#define ASSOCIATE_TRANSACTION_LOCATION_TIP   N_("Associate a location with the current transaction")
 
#define EXECASSOCIATED_TRANSACTION_TIP   N_("Open the associated file or location with the current transaction")
 
#define CUT_SPLIT_TIP   N_("Cut the selected split into clipboard")
 
#define COPY_SPLIT_TIP   N_("Copy the selected split into clipboard")
 
#define PASTE_SPLIT_TIP   N_("Paste the split from the clipboard")
 
#define DUPLICATE_SPLIT_TIP   N_("Make a copy of the current split")
 
#define DELETE_SPLIT_TIP   N_("Delete the current split")
 
#define CLEARED_VALUE   "cleared_value"
 
#define DEFAULT_FILTER   "0x001f"
 
#define DEFAULT_SORT_ORDER   "BY_STANDARD"
 
#define GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(o)   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_PAGE_REGISTER, GncPluginPageRegisterPrivate))
 
#define KEY_REGISTER_TYPE   "RegisterType"
 
#define KEY_ACCOUNT_NAME   "AccountName"
 
#define KEY_REGISTER_STYLE   "RegisterStyle"
 
#define KEY_DOUBLE_LINE   "DoubleLineMode"
 
#define LABEL_ACCOUNT   "Account"
 
#define LABEL_SUBACCOUNT   "SubAccount"
 
#define LABEL_GL   "GL"
 
#define LABEL_SEARCH   "Search"
 
#define GNC_TYPE_PLUGIN_PAGE_REGISTER   (gnc_plugin_page_register_get_type ())
 
#define GNC_PLUGIN_PAGE_REGISTER(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_PAGE_REGISTER, GncPluginPageRegister))
 
#define GNC_PLUGIN_PAGE_REGISTER_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_PAGE_REGISTER, GncPluginPageRegisterClass))
 
#define GNC_IS_PLUGIN_PAGE_REGISTER(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_PAGE_REGISTER))
 
#define GNC_IS_PLUGIN_PAGE_REGISTER_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_PAGE_REGISTER))
 
#define GNC_PLUGIN_PAGE_REGISTER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_PAGE_REGISTER, GncPluginPageRegisterClass))
 
#define GNC_PLUGIN_PAGE_REGISTER_NAME   "GncPluginPageRegister"
 
#define DEFAULT_LINES_AMOUNT   50
 
#define CUT_TRANSACTION_LABEL   N_("Cu_t Transaction")
 
#define COPY_TRANSACTION_LABEL   N_("_Copy Transaction")
 
#define PASTE_TRANSACTION_LABEL   N_("_Paste Transaction")
 
#define DUPLICATE_TRANSACTION_LABEL   N_("Dup_licate Transaction")
 
#define DELETE_TRANSACTION_LABEL   N_("_Delete Transaction")
 
#define CUT_SPLIT_LABEL   N_("Cu_t Split")
 
#define COPY_SPLIT_LABEL   N_("_Copy Split")
 
#define PASTE_SPLIT_LABEL   N_("_Paste Split")
 
#define DUPLICATE_SPLIT_LABEL   N_("Dup_licate Split")
 
#define DELETE_SPLIT_LABEL   N_("_Delete Split")
 
#define CUT_TRANSACTION_TIP   N_("Cut the selected transaction into clipboard")
 
#define COPY_TRANSACTION_TIP   N_("Copy the selected transaction into clipboard")
 
#define PASTE_TRANSACTION_TIP   N_("Paste the transaction from the clipboard")
 
#define DUPLICATE_TRANSACTION_TIP   N_("Make a copy of the current transaction")
 
#define DELETE_TRANSACTION_TIP   N_("Delete the current transaction")
 
#define CUT_SPLIT_TIP   N_("Cut the selected split into clipboard")
 
#define COPY_SPLIT_TIP   N_("Copy the selected split into clipboard")
 
#define PASTE_SPLIT_TIP   N_("Paste the split from the clipboard")
 
#define DUPLICATE_SPLIT_TIP   N_("Make a copy of the current split")
 
#define DELETE_SPLIT_TIP   N_("Delete the current split")
 
#define TRANSACTION_UP_ACTION   "TransactionUpAction"
 
#define TRANSACTION_DOWN_ACTION   "TransactionDownAction"
 
#define CLEARED_VALUE   "cleared_value"
 
#define DEFAULT_FILTER   "0x001f"
 
#define GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(o)   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_PAGE_REGISTER2, GncPluginPageRegister2Private))
 
#define KEY_REGISTER_TYPE   "RegisterType"
 
#define KEY_ACCOUNT_NAME   "AccountName"
 
#define KEY_REGISTER_STYLE   "RegisterStyle"
 
#define KEY_DOUBLE_LINE   "DoubleLineMode"
 
#define KEY_EXTRA_DATES   "ExtraDatesMode"
 
#define LABEL_ACCOUNT   "Account"
 
#define LABEL_SUBACCOUNT   "SubAccount"
 
#define LABEL_GL   "GL"
 
#define LABEL_SEARCH   "Search"
 
#define SPLIT_REGISTER_GUID   "SplitRegister GUID"
 

Typedefs

typedef struct
GncPluginPageRegisterPrivate 
GncPluginPageRegisterPrivate
 
typedef struct
GncPluginPageRegister2Private 
GncPluginPageRegister2Private
 

Functions

void gnc_plugin_page_register_sort_button_cb (GtkToggleButton *button, GncPluginPageRegister *page)
 
void gnc_plugin_page_register_sort_response_cb (GtkDialog *dialog, gint response, GncPluginPageRegister *plugin_page)
 
void gnc_plugin_page_register_sort_order_save_cb (GtkToggleButton *button, GncPluginPageRegister *page)
 
void gnc_plugin_page_register_sort_order_reverse_cb (GtkToggleButton *button, GncPluginPageRegister *page)
 
void gnc_plugin_page_register_set_sort_order (GncPluginPage *plugin_page, const gchar *sort_order)
 
void gnc_plugin_page_register_filter_select_range_cb (GtkRadioButton *button, GncPluginPageRegister *page)
 
void gnc_plugin_page_register_filter_start_cb (GtkWidget *radio, GncPluginPageRegister *page)
 
void gnc_plugin_page_register_filter_end_cb (GtkWidget *radio, GncPluginPageRegister *page)
 
void gnc_plugin_page_register_filter_response_cb (GtkDialog *dialog, gint response, GncPluginPageRegister *plugin_page)
 
void gnc_plugin_page_register_filter_status_all_cb (GtkButton *button, GncPluginPageRegister *plugin_page)
 
void gnc_plugin_page_register_filter_status_one_cb (GtkToggleButton *button, GncPluginPageRegister *page)
 
void gnc_plugin_page_register_filter_save_cb (GtkToggleButton *button, GncPluginPageRegister *page)
 
void gnc_plugin_page_register_set_filter (GncPluginPage *plugin_page, const gchar *filter)
 
GType gnc_plugin_page_register_get_type (void)
 
GncPluginPagegnc_plugin_page_register_new (Account *account, gboolean subaccounts)
 
GncPluginPagegnc_plugin_page_register_new_gl (void)
 
GncPluginPagegnc_plugin_page_register_new_ledger (GNCLedgerDisplay *ledger)
 
Accountgnc_plugin_page_register_get_account (GncPluginPageRegister *page)
 
void gnc_plugin_page_register_set_options (GncPluginPage *plugin_page, gint lines_default, gboolean read_only)
 
GNCSplitReggnc_plugin_page_register_get_gsr (GncPluginPage *plugin_page)
 
void gnc_plugin_page_register2_filter_select_range_cb (GtkRadioButton *button, GncPluginPageRegister2 *page)
 
void gnc_plugin_page_register2_filter_start_cb (GtkWidget *radio, GncPluginPageRegister2 *page)
 
void gnc_plugin_page_register2_filter_end_cb (GtkWidget *radio, GncPluginPageRegister2 *page)
 
void gnc_plugin_page_register2_filter_response_cb (GtkDialog *dialog, gint response, GncPluginPageRegister2 *plugin_page)
 
void gnc_plugin_page_register2_filter_status_all_cb (GtkButton *button, GncPluginPageRegister2 *plugin_page)
 
void gnc_plugin_page_register2_filter_status_one_cb (GtkToggleButton *button, GncPluginPageRegister2 *page)
 
void gnc_plugin_page_register2_filter_save_cb (GtkToggleButton *button, GncPluginPageRegister2 *page)
 
void gnc_plugin_page_register2_set_filter (GncPluginPage *plugin_page, const gchar *filter)
 
GType gnc_plugin_page_register2_get_type (void)
 
GncPluginPagegnc_plugin_page_register2_new (Account *account, gboolean subaccounts)
 
GncPluginPagegnc_plugin_page_register2_new_gl (void)
 
GncPluginPagegnc_plugin_page_register2_new_ledger (GNCLedgerDisplay2 *ledger)
 
Accountgnc_plugin_page_register2_get_account (GncPluginPageRegister2 *page)
 
void gnc_plugin_page_register2_set_options (GncPluginPage *plugin_page, gint lines_default, gboolean read_only)
 
GNCSplitReg2gnc_plugin_page_register2_get_gsr (GncPluginPage *plugin_page)
 
GNCLedgerDisplay2gnc_plugin_page_register2_get_ledger (GncPluginPage *plugin_page)
 

Detailed Description

Function Documentation

void gnc_plugin_page_register2_filter_end_cb ( GtkWidget *  radio,
GncPluginPageRegister2 page 
)

This function is called when one of the end date radio buttons is selected. It updates the sensitivity of the date entry widget, then calls a common routine to determine the start/end times and update the register query.

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

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

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

2240 {
2242  const gchar *name;
2243  gboolean active;
2244 
2245  g_return_if_fail (GTK_IS_RADIO_BUTTON (radio));
2246  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
2247 
2248  ENTER("(radio %s(%p), page %p)", gtk_buildable_get_name (GTK_BUILDABLE (radio)), radio, page);
2249  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
2250  if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
2251  {
2252  LEAVE("1st callback of pair. Defer to 2nd callback.");
2253  return;
2254  }
2255 
2256  name = gtk_buildable_get_name (GTK_BUILDABLE (radio));
2257  active = (g_strcmp0 (name, g_strdup ("end_date_choose")) == 0 ? 1 : 0 );
2258  gtk_widget_set_sensitive (priv->fd.end_date, active);
2259  get_filter_times (page);
2260  gnc_ppr_update_date_query (page, TRUE);
2261  LEAVE(" ");
2262 }
#define ENTER(format, args...)
Definition: qoflog.h:261
#define LEAVE(format, args...)
Definition: qoflog.h:271
void gnc_plugin_page_register2_filter_response_cb ( GtkDialog *  dialog,
gint  response,
GncPluginPageRegister2 page 
)

This function is called when the "Filter By..." dialog is closed. If the dialog was closed by any method other than clicking the OK button, the original filter will be restored.

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

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

2307 {
2309  GncPluginPage *plugin_page;
2310 
2311  g_return_if_fail (GTK_IS_DIALOG (dialog));
2312  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
2313 
2314  ENTER(" ");
2315  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
2316  plugin_page = GNC_PLUGIN_PAGE (page);
2317 
2318  if (response != GTK_RESPONSE_OK)
2319  {
2320  /* Remove the old status match */
2321  priv->fd.cleared_match = priv->fd.original_cleared_match;
2322  gnc_ppr_update_status_query (page, FALSE);
2323  priv->fd.start_time = priv->fd.original_start_time;
2324  priv->fd.end_time = priv->fd.original_end_time;
2325  priv->fd.save_filter = priv->fd.original_save_filter;
2326  gnc_ppr_update_date_query (page, FALSE);
2327  gnc_ledger_display2_refresh (priv->ledger);
2328  }
2329  else
2330  {
2331  priv->fd.original_save_filter = priv->fd.save_filter;
2332 
2333  if (priv->fd.save_filter)
2334  {
2335  gchar* filter;
2336  filter = g_strdup_printf ("0x%04x", priv->fd.cleared_match);
2337 
2338  if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.start_date_choose)) && priv->fd.start_time != 0 )
2339  {
2340  gchar *timeval = gnc_plugin_page_register2_filter_time2dmy (priv->fd.start_time);
2341  filter = g_strconcat (filter, ",", timeval, NULL);
2342  g_free (timeval);
2343  }
2344  else
2345  filter = g_strconcat (filter, ",0", NULL);
2346 
2347  if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.end_date_choose)) && priv->fd.end_time != 0 )
2348  {
2349  gchar *timeval = gnc_plugin_page_register2_filter_time2dmy (priv->fd.end_time);
2350  filter = g_strconcat (filter, ",", timeval, NULL);
2351  g_free (timeval);
2352  }
2353  else
2354  filter = g_strconcat (filter, ",0", NULL);
2355 
2356  PINFO("The filter to save is %s", filter);
2357 
2358  gnc_plugin_page_register2_set_filter (plugin_page, filter);
2359  g_free (filter);
2360  }
2361  }
2362  priv->fd.dialog = NULL;
2363  gtk_widget_destroy (GTK_WIDGET (dialog));
2364  LEAVE(" ");
2365 }
#define PINFO(format, args...)
Definition: qoflog.h:249
#define ENTER(format, args...)
Definition: qoflog.h:261
#define LEAVE(format, args...)
Definition: qoflog.h:271
void gnc_plugin_page_register2_filter_save_cb ( GtkToggleButton *  button,
GncPluginPageRegister2 page 
)

This function is called whenever the save status is checked or unchecked. It will allow saving of the filter if required.

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

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

2275 {
2277 
2278  g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
2279  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
2280 
2281  ENTER("Save toggle button (%p), plugin_page %p", button, page);
2282 
2283  /* Compute the new save filter status */
2284  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
2285  if (gtk_toggle_button_get_active (button))
2286  priv->fd.save_filter = TRUE;
2287  else
2288  priv->fd.save_filter = FALSE;
2289  LEAVE(" ");
2290 }
#define ENTER(format, args...)
Definition: qoflog.h:261
#define LEAVE(format, args...)
Definition: qoflog.h:271
void gnc_plugin_page_register2_filter_select_range_cb ( GtkRadioButton *  button,
GncPluginPageRegister2 page 
)

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

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

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

2126 {
2128  gboolean active;
2129 
2130  g_return_if_fail (GTK_IS_RADIO_BUTTON (button));
2131  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
2132 
2133  ENTER("(button %p, page %p)", button, page);
2134  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
2135  active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
2136  gtk_widget_set_sensitive (priv->fd.table, active);
2137  if (active)
2138  {
2139  get_filter_times (page);
2140  }
2141  else
2142  {
2143  priv->fd.start_time = 0;
2144  priv->fd.end_time = 0;
2145  }
2146  gnc_ppr_update_date_query (page, TRUE);
2147  LEAVE(" ");
2148 }
#define ENTER(format, args...)
Definition: qoflog.h:261
#define LEAVE(format, args...)
Definition: qoflog.h:271
void gnc_plugin_page_register2_filter_start_cb ( GtkWidget *  radio,
GncPluginPageRegister2 page 
)

This function is called when one of the start date radio buttons is selected. It updates the sensitivity of the date entry widget, then calls a common routine to determine the start/end times and update the register query.

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

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

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

2194 {
2196  const gchar *name;
2197  gboolean active;
2198 
2199  g_return_if_fail (GTK_IS_RADIO_BUTTON (radio));
2200  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
2201 
2202  ENTER("(radio %s(%p), page %p)", gtk_buildable_get_name (GTK_BUILDABLE (radio)), radio, page);
2203  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
2204  if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
2205  {
2206  LEAVE("1st callback of pair. Defer to 2nd callback.");
2207  return;
2208  }
2209 
2210  name = gtk_buildable_get_name (GTK_BUILDABLE (radio));
2211  active = (g_strcmp0 (name, g_strdup ("start_date_choose")) == 0 ? 1 : 0 );
2212  gtk_widget_set_sensitive (priv->fd.start_date, active);
2213  get_filter_times (page);
2214  gnc_ppr_update_date_query (page, TRUE);
2215  LEAVE(" ");
2216 }
#define ENTER(format, args...)
Definition: qoflog.h:261
#define LEAVE(format, args...)
Definition: qoflog.h:271
void gnc_plugin_page_register2_filter_status_all_cb ( GtkButton *  button,
GncPluginPageRegister2 page 
)

This function is called whenever the "select all" status button is clicked. It updates all of the checkbox widgets, then updates the query on the register.

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

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

2026 {
2028  GtkWidget *widget;
2029  gint i;
2030 
2031  g_return_if_fail (GTK_IS_BUTTON (button));
2032  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
2033 
2034  ENTER("(button %p, page %p)", button, page);
2035 
2036  /* Turn on all the check menu items */
2037  for (i = 0; status_actions[i].action_name; i++)
2038  {
2039  widget = status_actions[i].widget;
2040  g_signal_handlers_block_by_func (widget, gnc_plugin_page_register2_filter_status_one_cb, page);
2041  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
2042  g_signal_handlers_unblock_by_func (widget, gnc_plugin_page_register2_filter_status_one_cb, page);
2043  }
2044 
2045  /* Set the requested status */
2046  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
2047  priv->fd.cleared_match = CLEARED_ALL;
2048  gnc_ppr_update_status_query (page, TRUE);
2049  LEAVE(" ");
2050 }
void gnc_plugin_page_register2_filter_status_one_cb(GtkToggleButton *button, GncPluginPageRegister2 *page)
#define ENTER(format, args...)
Definition: qoflog.h:261
#define LEAVE(format, args...)
Definition: qoflog.h:271
void gnc_plugin_page_register2_filter_status_one_cb ( GtkToggleButton *  button,
GncPluginPageRegister2 page 
)

This function is called whenever one of the status entries is checked or unchecked. It updates the status value maintained for the filter dialog, and calls another function to do the work of applying the change to the register itself.

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

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

1982 {
1984  const gchar *name;
1985  gint i, value;
1986 
1987  g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
1988  g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
1989 
1990  name = gtk_buildable_get_name (GTK_BUILDABLE (button));
1991  ENTER("toggle button %s (%p), plugin_page %p", name, button, page);
1992 
1993  /* Determine what status bit to change */
1994  value = CLEARED_NONE;
1995  for (i = 0; status_actions[i].action_name; i++)
1996  {
1997  if (g_strcmp0 (name, status_actions[i].action_name) == 0)
1998  {
1999  value = status_actions[i].value;
2000  break;
2001  }
2002  }
2003 
2004  /* Compute the new match status */
2005  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
2006  if (gtk_toggle_button_get_active (button))
2007  priv->fd.cleared_match |= value;
2008  else
2009  priv->fd.cleared_match &= ~value;
2010  gnc_ppr_update_status_query (page, TRUE);
2011  LEAVE(" ");
2012 }
#define ENTER(format, args...)
Definition: qoflog.h:261
#define LEAVE(format, args...)
Definition: qoflog.h:271
Account* gnc_plugin_page_register2_get_account ( GncPluginPageRegister2 page)

Get the Account associated with this register page.

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

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

799 {
801  GNCLedgerDisplay2Type ledger_type;
802  Account *leader;
803 
804  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
805  ledger_type = gnc_ledger_display2_type (priv->ledger);
806  leader = gnc_ledger_display2_leader (priv->ledger);
807 
808  if ((ledger_type == LD2_SINGLE) || (ledger_type == LD2_SUBACCOUNT))
809  return leader;
810  return NULL;
811 }
GNCSplitReg2* gnc_plugin_page_register2_get_gsr ( GncPluginPage plugin_page)

Get the GNCSplitReg data structure associated with this register page.

Parameters
plugin_pageA "register" page.

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

3839 {
3840  GncPluginPageRegister2 *page;
3842 
3843  g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page), NULL);
3844 
3845  page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
3846  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
3847 
3848  return priv->gsr;
3849 }
GNCLedgerDisplay2* gnc_plugin_page_register2_get_ledger ( GncPluginPage plugin_page)

Get the GNCLedgerDisplay data structure associated with this register page.

Parameters
plugin_pageA "register" page.

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

3854 {
3855  GncPluginPageRegister2 *page;
3857 
3858  g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page), NULL);
3859 
3860  page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
3861  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
3862 
3863  return priv->ledger;
3864 }
GType gnc_plugin_page_register2_get_type ( void  )

Retrieve the type number for the plugin page.

Returns
The type number.

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

561 {
562  static GType gnc_plugin_page_register2_type = 0;
563 
564  if (gnc_plugin_page_register2_type == 0)
565  {
566  static const GTypeInfo our_info =
567  {
569  NULL,
570  NULL,
571  (GClassInitFunc) gnc_plugin_page_register2_class_init,
572  NULL,
573  NULL,
574  sizeof (GncPluginPageRegister2),
575  0,
576  (GInstanceInitFunc) gnc_plugin_page_register2_init
577  };
578 
579  gnc_plugin_page_register2_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
580  GNC_PLUGIN_PAGE_REGISTER2_NAME,
581  &our_info, 0);
582  }
583 
584  return gnc_plugin_page_register2_type;
585 }
GncPluginPage* gnc_plugin_page_register2_new ( Account account,
gboolean  subaccounts 
)

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

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

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

654 {
655  GNCLedgerDisplay2 *ledger;
656  GncPluginPage *page;
658 
659 /*################## Added for Reg2 #################*/
660  const GList *item;
661  GncPluginPageRegister *old_register_page;
662 /*################## Added for Reg2 #################*/
663 
664  ENTER("account=%p, subaccounts=%s", account,
665  subaccounts ? "TRUE" : "FALSE");
666 
667 /*################## Added for Reg2 #################*/
668  // We test for the old register being open here, ie matching account guids
669  item = gnc_gobject_tracking_get_list (GNC_PLUGIN_PAGE_REGISTER_NAME);
670  for ( ; item; item = g_list_next (item))
671  {
672  Account *old_account;
673  old_register_page = (GncPluginPageRegister *)item->data;
674  old_account = gnc_plugin_page_register_get_account (old_register_page);
675 
676  if (guid_equal (xaccAccountGetGUID (account), xaccAccountGetGUID (old_account)))
677  {
678  gnc_error_dialog (NULL, "%s",
679  _("You have tried to open an account in the new register while it is open in the old register."));
680  return NULL;
681  }
682  }
683 /*################## Added for Reg2 #################*/
684 
685  if (subaccounts)
686  ledger = gnc_ledger_display2_subaccounts (account);
687  else
688  ledger = gnc_ledger_display2_simple (account);
689 
690  page = gnc_plugin_page_register2_new_common (ledger);
691  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
692  priv->key = *xaccAccountGetGUID (account);
693 
694  LEAVE("%p", page);
695  return page;
696 }
const GList * gnc_gobject_tracking_get_list(const gchar *name)
#define ENTER(format, args...)
Definition: qoflog.h:261
#define xaccAccountGetGUID(X)
Definition: Account.h:239
gboolean guid_equal(const GncGUID *guid_1, const GncGUID *guid_2)
#define LEAVE(format, args...)
Definition: qoflog.h:271
Account * gnc_plugin_page_register_get_account(GncPluginPageRegister *page)
GncPluginPage* gnc_plugin_page_register2_new_gl ( void  )

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

Returns
The newly created plugin page.

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

700 {
701  GNCLedgerDisplay2 *ledger;
702 
703  ledger = gnc_ledger_display2_gl ();
704  return gnc_plugin_page_register2_new_common (ledger);
705 }
GncPluginPage* gnc_plugin_page_register2_new_ledger ( GNCLedgerDisplay2 ledger)

Create a new "register" plugin page, given a pointer to an already created ledger. This function should be used when the ledger already exists. (E.G. From the "find transaction" code, or from the scheduled transaction code.)

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

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

709 {
710  return gnc_plugin_page_register2_new_common (ledger);
711 }
void gnc_plugin_page_register2_set_options ( GncPluginPage plugin_page,
gint  lines_default,
gboolean  read_only 
)

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

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

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

3825 {
3826  GncPluginPageRegister2 *page;
3828 
3829  g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
3830 
3831  page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
3832  priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
3833  priv->lines_default = lines_default;
3834  priv->read_only = read_only;
3835 }
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 2407 of file gnc-plugin-page-register.c.

2409 {
2411  const gchar *name;
2412  gboolean active;
2413 
2414  g_return_if_fail(GTK_IS_RADIO_BUTTON(radio));
2415  g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2416 
2417  ENTER("(radio %s(%p), page %p)", gtk_buildable_get_name(GTK_BUILDABLE(radio)), radio, page);
2418  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2419  if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio)))
2420  {
2421  LEAVE("1st callback of pair. Defer to 2nd callback.");
2422  return;
2423  }
2424 
2425  name = gtk_buildable_get_name(GTK_BUILDABLE(radio));
2426  active = ( g_strcmp0(name, g_strdup("end_date_choose")) == 0 ? 1 : 0 );
2427  gtk_widget_set_sensitive(priv->fd.end_date, active);
2428  get_filter_times(page);
2429  gnc_ppr_update_date_query(page);
2430  LEAVE(" ");
2431 }
#define ENTER(format, args...)
Definition: qoflog.h:261
#define LEAVE(format, args...)
Definition: qoflog.h:271
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 2475 of file gnc-plugin-page-register.c.

2478 {
2480  GncPluginPage *plugin_page;
2481 
2482  g_return_if_fail(GTK_IS_DIALOG(dialog));
2483  g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2484 
2485  ENTER(" ");
2486  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2487  plugin_page = GNC_PLUGIN_PAGE(page);
2488 
2489  if (response != GTK_RESPONSE_OK)
2490  {
2491  /* Remove the old status match */
2492  priv->fd.cleared_match = priv->fd.original_cleared_match;
2493  gnc_ppr_update_status_query(page);
2494  priv->fd.start_time = priv->fd.original_start_time;
2495  priv->fd.end_time = priv->fd.original_end_time;
2496  priv->fd.save_filter = priv->fd.original_save_filter;
2497  gnc_ppr_update_date_query(page);
2498  }
2499  else
2500  {
2501  priv->fd.original_save_filter = priv->fd.save_filter;
2502 
2503  if (priv->fd.save_filter)
2504  {
2505  gchar* filter;
2506  filter = g_strdup_printf("0x%04x", priv->fd.cleared_match);
2507 
2508  if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_choose)) && priv->fd.start_time != 0 )
2509  {
2510  gchar *timeval = gnc_plugin_page_register_filter_time2dmy(priv->fd.start_time);
2511  filter = g_strconcat ( filter, ",", timeval, NULL);
2512  g_free (timeval);
2513  }
2514  else
2515  filter = g_strconcat ( filter, ",0", NULL);
2516 
2517  if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.end_date_choose)) && priv->fd.end_time != 0 )
2518  {
2519  gchar *timeval = gnc_plugin_page_register_filter_time2dmy(priv->fd.end_time);
2520  filter = g_strconcat ( filter, ",", timeval, NULL);
2521  g_free (timeval);
2522  }
2523  else
2524  filter = g_strconcat ( filter, ",0", NULL);
2525 
2526  PINFO("The filter to save is %s", filter);
2527 
2528  gnc_plugin_page_register_set_filter (plugin_page, filter);
2529  g_free (filter);
2530  }
2531  }
2532  priv->fd.dialog = NULL;
2533  gtk_widget_destroy(GTK_WIDGET(dialog));
2534  LEAVE(" ");
2535 }
#define PINFO(format, args...)
Definition: qoflog.h:249
#define ENTER(format, args...)
Definition: qoflog.h:261
#define LEAVE(format, args...)
Definition: qoflog.h:271
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 2443 of file gnc-plugin-page-register.c.

2445 {
2447 
2448  g_return_if_fail(GTK_IS_CHECK_BUTTON(button));
2449  g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2450 
2451  ENTER("Save toggle button (%p), plugin_page %p", button, page);
2452 
2453  /* Compute the new save filter status */
2454  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2455  if (gtk_toggle_button_get_active(button))
2456  priv->fd.save_filter = TRUE;
2457  else
2458  priv->fd.save_filter = FALSE;
2459  LEAVE(" ");
2460 }
#define ENTER(format, args...)
Definition: qoflog.h:261
#define LEAVE(format, args...)
Definition: qoflog.h:271
void gnc_plugin_page_register_filter_select_range_cb ( GtkRadioButton *  button,
GncPluginPageRegister page 
)

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

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

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

2292 {
2294  gboolean active;
2295 
2296  g_return_if_fail(GTK_IS_RADIO_BUTTON(button));
2297  g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2298 
2299  ENTER("(button %p, page %p)", button, page);
2300  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2301  active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
2302  gtk_widget_set_sensitive(priv->fd.table, active);
2303  if (active)
2304  {
2305  get_filter_times(page);
2306  }
2307  else
2308  {
2309  priv->fd.start_time = 0;
2310  priv->fd.end_time = 0;
2311  }
2312  gnc_ppr_update_date_query(page);
2313  LEAVE(" ");
2314 }
#define ENTER(format, args...)
Definition: qoflog.h:261
#define LEAVE(format, args...)
Definition: qoflog.h:271
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 2360 of file gnc-plugin-page-register.c.

2362 {
2364  const gchar *name;
2365  gboolean active;
2366 
2367  g_return_if_fail(GTK_IS_RADIO_BUTTON(radio));
2368  g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2369 
2370  ENTER("(radio %s(%p), page %p)", gtk_buildable_get_name(GTK_BUILDABLE(radio)), radio, page);
2371  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2372  if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio)))
2373  {
2374  LEAVE("1st callback of pair. Defer to 2nd callback.");
2375  return;
2376  }
2377 
2378  name = gtk_buildable_get_name(GTK_BUILDABLE(radio));
2379  active = ( g_strcmp0(name, g_strdup("start_date_choose")) == 0 ? 1 : 0 );
2380  gtk_widget_set_sensitive(priv->fd.start_date, active);
2381  get_filter_times(page);
2382  gnc_ppr_update_date_query(page);
2383  LEAVE(" ");
2384 }
#define ENTER(format, args...)
Definition: qoflog.h:261
#define LEAVE(format, args...)
Definition: qoflog.h:271
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 2189 of file gnc-plugin-page-register.c.

2191 {
2193  GtkWidget *widget;
2194  gint i;
2195 
2196  g_return_if_fail(GTK_IS_BUTTON(button));
2197  g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2198 
2199  ENTER("(button %p, page %p)", button, page);
2200 
2201  /* Turn on all the check menu items */
2202  for (i = 0; status_actions[i].action_name; i++)
2203  {
2204  widget = status_actions[i].widget;
2205  g_signal_handlers_block_by_func(widget, gnc_plugin_page_register_filter_status_one_cb, page);
2206  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widget), TRUE);
2207  g_signal_handlers_unblock_by_func(widget, gnc_plugin_page_register_filter_status_one_cb, page);
2208  }
2209 
2210  /* Set the requested status */
2211  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2212  priv->fd.cleared_match = CLEARED_ALL;
2213  gnc_ppr_update_status_query(page);
2214  LEAVE(" ");
2215 }
#define ENTER(format, args...)
Definition: qoflog.h:261
void gnc_plugin_page_register_filter_status_one_cb(GtkToggleButton *button, GncPluginPageRegister *page)
#define LEAVE(format, args...)
Definition: qoflog.h:271
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 2144 of file gnc-plugin-page-register.c.

2146 {
2148  const gchar *name;
2149  gint i, value;
2150 
2151  g_return_if_fail(GTK_IS_CHECK_BUTTON(button));
2152  g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2153 
2154  name = gtk_buildable_get_name(GTK_BUILDABLE(button));
2155  ENTER("toggle button %s (%p), plugin_page %p", name, button, page);
2156 
2157  /* Determine what status bit to change */
2158  value = CLEARED_NONE;
2159  for (i = 0; status_actions[i].action_name; i++)
2160  {
2161  if (g_strcmp0(name, status_actions[i].action_name) == 0)
2162  {
2163  value = status_actions[i].value;
2164  break;
2165  }
2166  }
2167 
2168  /* Compute the new match status */
2169  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2170  if (gtk_toggle_button_get_active(button))
2171  priv->fd.cleared_match |= value;
2172  else
2173  priv->fd.cleared_match &= ~value;
2174  gnc_ppr_update_status_query(page);
2175  LEAVE(" ");
2176 }
#define ENTER(format, args...)
Definition: qoflog.h:261
#define LEAVE(format, args...)
Definition: qoflog.h:271
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 799 of file gnc-plugin-page-register.c.

800 {
802  GNCLedgerDisplayType ledger_type;
803  Account *leader;
804 
805  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
806  ledger_type = gnc_ledger_display_type (priv->ledger);
807  leader = gnc_ledger_display_leader (priv->ledger);
808 
809  if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
810  return leader;
811  return NULL;
812 }
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 3854 of file gnc-plugin-page-register.c.

3855 {
3856  GncPluginPageRegister *page;
3858 
3859  g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page), NULL);
3860 
3861  page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
3862  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
3863 
3864  return priv->gsr;
3865 }
GType gnc_plugin_page_register_get_type ( void  )

Retrieve the type number for the plugin page.

Returns
The type number.

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

577 {
578  static GType gnc_plugin_page_register_type = 0;
579 
580  if (gnc_plugin_page_register_type == 0)
581  {
582  static const GTypeInfo our_info =
583  {
585  NULL,
586  NULL,
587  (GClassInitFunc) gnc_plugin_page_register_class_init,
588  NULL,
589  NULL,
590  sizeof (GncPluginPageRegister),
591  0,
592  (GInstanceInitFunc) gnc_plugin_page_register_init
593  };
594 
595  gnc_plugin_page_register_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
596  GNC_PLUGIN_PAGE_REGISTER_NAME,
597  &our_info, 0);
598  }
599 
600  return gnc_plugin_page_register_type;
601 }
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 659 of file gnc-plugin-page-register.c.

660 {
661  GNCLedgerDisplay *ledger;
662  GncPluginPage *page;
664 
665 /*################## Added for Reg2 #################*/
666  const GList *item;
667  GncPluginPageRegister2 *new_register_page;
668 /*################## Added for Reg2 #################*/
669 
670  ENTER("account=%p, subaccounts=%s", account,
671  subaccounts ? "TRUE" : "FALSE");
672 
673 /*################## Added for Reg2 #################*/
674  // We test for the new register being open here, ie matching account guids
675  item = gnc_gobject_tracking_get_list (GNC_PLUGIN_PAGE_REGISTER2_NAME);
676  for ( ; item; item = g_list_next (item))
677  {
678  Account *new_account;
679  new_register_page = (GncPluginPageRegister2 *)item->data;
680  new_account = gnc_plugin_page_register2_get_account (new_register_page);
681 
682  if (guid_equal (xaccAccountGetGUID (account), xaccAccountGetGUID (new_account)))
683  {
684  gnc_error_dialog (NULL, "%s",
685  _("You have tried to open an account in the old register while it is open in the new register."));
686  return NULL;
687  }
688  }
689 /*################## Added for Reg2 #################*/
690 
691  if (subaccounts)
692  ledger = gnc_ledger_display_subaccounts (account);
693  else
694  ledger = gnc_ledger_display_simple (account);
695 
696  page = gnc_plugin_page_register_new_common(ledger);
697  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
698  priv->key = *xaccAccountGetGUID(account);
699 
700  LEAVE("%p", page);
701  return page;
702 }
const GList * gnc_gobject_tracking_get_list(const gchar *name)
#define ENTER(format, args...)
Definition: qoflog.h:261
#define xaccAccountGetGUID(X)
Definition: Account.h:239
gboolean guid_equal(const GncGUID *guid_1, const GncGUID *guid_2)
Account * gnc_plugin_page_register2_get_account(GncPluginPageRegister2 *page)
#define LEAVE(format, args...)
Definition: qoflog.h:271
GncPluginPage * gnc_plugin_page_register_new_gl ( void  )

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

Returns
The newly created plugin page.

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

706 {
707  GNCLedgerDisplay *ledger;
708 
709  ledger = gnc_ledger_display_gl ();
710  return gnc_plugin_page_register_new_common(ledger);
711 }
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 714 of file gnc-plugin-page-register.c.

715 {
716  return gnc_plugin_page_register_new_common(ledger);
717 }
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 3838 of file gnc-plugin-page-register.c.

3841 {
3842  GncPluginPageRegister *page;
3844 
3845  g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
3846 
3847  page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
3848  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
3849  priv->lines_default = lines_default;
3850  priv->read_only = read_only;
3851 }
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 1909 of file gnc-plugin-page-register.c.

1911 {
1913  const gchar *name;
1914  SortType type;
1915 
1916  g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
1917  g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
1918 
1919  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
1920  name = gtk_buildable_get_name(GTK_BUILDABLE(button));
1921  ENTER("button %s(%p), page %p", name, button, page);
1922  type = SortTypefromString(name);
1923  gnc_split_reg_set_sort_type(priv->gsr, type);
1924  LEAVE(" ");
1925 }
#define ENTER(format, args...)
Definition: qoflog.h:261
#define LEAVE(format, args...)
Definition: qoflog.h:271
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 1966 of file gnc-plugin-page-register.c.

1969 {
1971 
1972  g_return_if_fail(GTK_IS_CHECK_BUTTON(button));
1973  g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
1974 
1975  ENTER("Reverse toggle button (%p), plugin_page %p", button, page);
1976 
1977  /* Compute the new save sort order */
1978  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
1979 
1980  if (gtk_toggle_button_get_active(button))
1981  {
1982  gnc_split_reg_set_sort_reversed(priv->gsr, FALSE);
1983  priv->sd.reverse_order = TRUE;
1984  }
1985  else
1986  {
1987  gnc_split_reg_set_sort_reversed(priv->gsr, TRUE);
1988  priv->sd.reverse_order = FALSE;
1989  }
1990  LEAVE(" ");
1991 }
#define ENTER(format, args...)
Definition: qoflog.h:261
#define LEAVE(format, args...)
Definition: qoflog.h:271
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 1937 of file gnc-plugin-page-register.c.

1939 {
1941 
1942  g_return_if_fail(GTK_IS_CHECK_BUTTON(button));
1943  g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
1944 
1945  ENTER("Save toggle button (%p), plugin_page %p", button, page);
1946 
1947  /* Compute the new save sort order */
1948  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
1949 
1950  if (gtk_toggle_button_get_active(button))
1951  priv->sd.save_order = TRUE;
1952  else
1953  priv->sd.save_order = FALSE;
1954  LEAVE(" ");
1955 }
#define ENTER(format, args...)
Definition: qoflog.h:261
#define LEAVE(format, args...)
Definition: qoflog.h:271
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 1856 of file gnc-plugin-page-register.c.

1859 {
1861  GncPluginPage *plugin_page;
1862  SortType type;
1863  const gchar *order;
1864 
1865  g_return_if_fail(GTK_IS_DIALOG(dialog));
1866  g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
1867 
1868  ENTER(" ");
1869  priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
1870  plugin_page = GNC_PLUGIN_PAGE(page);
1871 
1872  if (response != GTK_RESPONSE_OK)
1873  {
1874  /* Restore the original sort order */
1875  gnc_split_reg_set_sort_type(priv->gsr, priv->sd.original_sort_type);
1876  priv->sd.save_order = priv->sd.original_save_order;
1877  }
1878  else
1879  {
1880  priv->sd.original_save_order = priv->sd.save_order;
1881 
1882  if (priv->sd.save_order)
1883  {
1884  type = gnc_split_reg_get_sort_type(priv->gsr);
1885  order = SortTypeasString(type);
1886  gnc_plugin_page_register_set_sort_order (plugin_page, order);
1887  }
1888  }
1889  gnc_book_option_remove_cb(OPTION_NAME_NUM_FIELD_SOURCE,
1890  gnc_plugin_page_register_sort_book_option_changed,
1891  page);
1892  priv->sd.dialog = NULL;
1893  priv->sd.num_radio = NULL;
1894  priv->sd.act_radio = NULL;
1895  gtk_widget_destroy(GTK_WIDGET(dialog));
1896  LEAVE(" ");
1897 }
#define ENTER(format, args...)
Definition: qoflog.h:261
#define LEAVE(format, args...)
Definition: qoflog.h:271