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 |
Defines | |
| #define | DEFAULT_LINES_OPTION_SECTION GCONF_GENERAL_REGISTER |
| #define | DEFAULT_LINES_OPTION_NAME KEY_NUMBER_OF_ROWS |
| #define | DEFAULT_LINES_AMOUNT 20 |
| #define | CLEARED_VALUE "cleared_value" |
| #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" |
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_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) |
| GType | gnc_plugin_page_register_get_type (void) |
| GncPluginPage * | gnc_plugin_page_register_new (Account *account, gboolean subaccounts) |
| GncPluginPage * | gnc_plugin_page_register_new_gl (void) |
| GncPluginPage * | gnc_plugin_page_register_new_ledger (GNCLedgerDisplay *ledger) |
| Account * | gnc_plugin_page_register_get_account (GncPluginPageRegister *page) |
| void | gnc_plugin_page_register_set_options (GncPluginPage *plugin_page, const char *lines_opt_section, const char *lines_opt_name, gint lines_default, gboolean read_only) |
| GNCSplitReg * | gnc_plugin_page_register_get_gsr (GncPluginPage *plugin_page) |
| 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.
| button | The 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. | |
| page | A pointer to the GncPluginPageRegister that is associated with this filter dialog. |
Definition at line 1667 of file gnc-plugin-page-register.c.
01669 { 01670 GtkWidget *widget, *gde; 01671 gboolean active; 01672 01673 g_return_if_fail(GTK_IS_RADIO_BUTTON(radio)); 01674 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page)); 01675 01676 ENTER("(radio %s(%p), page %p)", gtk_widget_get_name(radio), radio, page); 01677 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio))) { 01678 LEAVE("1st callback of pair. Defer to 2nd callback."); 01679 return; 01680 } 01681 01682 widget = gnc_glade_lookup_widget(radio, "end_date_choose"); 01683 active = (widget == radio); 01684 gde = gnc_glade_lookup_widget(radio, "end_date"); 01685 gtk_widget_set_sensitive(gde, active); 01686 01687 get_filter_times(page); 01688 gnc_ppr_update_date_query(page); 01689 LEAVE(" "); 01690 }
| 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.
| dialog | A pointer to the dialog box. | |
| response | A numerical value indicating why the dialog box was closed. | |
| page | A pointer to the GncPluginPageRegister associated with this dialog box. |
Definition at line 1705 of file gnc-plugin-page-register.c.
01708 { 01709 GncPluginPageRegisterPrivate *priv; 01710 01711 g_return_if_fail(GTK_IS_DIALOG(dialog)); 01712 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page)); 01713 01714 ENTER(" "); 01715 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page); 01716 if (response != GTK_RESPONSE_OK) { 01717 /* Remove the old status match */ 01718 priv->fd.cleared_match = priv->fd.original_cleared_match; 01719 gnc_ppr_update_status_query(page); 01720 priv->fd.start_time = priv->fd.original_start_time; 01721 priv->fd.end_time = priv->fd.original_end_time; 01722 gnc_ppr_update_date_query(page); 01723 } 01724 priv->fd.dialog = NULL; 01725 gtk_widget_destroy(GTK_WIDGET(dialog)); 01726 LEAVE(" "); 01727 }
| 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.
| button | A pointer to the "select range" radio button. | |
| page | A pointer to the GncPluginPageRegister that is associated with this filter dialog. |
Definition at line 1552 of file gnc-plugin-page-register.c.
01554 { 01555 GncPluginPageRegisterPrivate *priv; 01556 GtkWidget *table; 01557 gboolean active; 01558 01559 g_return_if_fail(GTK_IS_RADIO_BUTTON(button)); 01560 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page)); 01561 01562 ENTER("(button %p, page %p)", button, page); 01563 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page); 01564 table = gnc_glade_lookup_widget(GTK_WIDGET(button), "select_range_table"); 01565 active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); 01566 gtk_widget_set_sensitive(table, active); 01567 if (active) { 01568 get_filter_times(page); 01569 } else { 01570 priv->fd.start_time = 0; 01571 priv->fd.end_time = 0; 01572 } 01573 gnc_ppr_update_date_query(page); 01574 LEAVE(" "); 01575 }
| 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.
| button | The 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. | |
| page | A pointer to the GncPluginPageRegister that is associated with this filter dialog. |
Definition at line 1621 of file gnc-plugin-page-register.c.
01623 { 01624 GtkWidget *widget, *gde; 01625 gboolean active; 01626 01627 g_return_if_fail(GTK_IS_RADIO_BUTTON(radio)); 01628 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page)); 01629 01630 ENTER("(radio %s(%p), page %p)", gtk_widget_get_name(radio), radio, page); 01631 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio))) { 01632 LEAVE("1st callback of pair. Defer to 2nd callback."); 01633 return; 01634 } 01635 01636 widget = gnc_glade_lookup_widget(radio, "start_date_choose"); 01637 active = (widget == radio); 01638 gde = gnc_glade_lookup_widget(radio, "start_date"); 01639 gtk_widget_set_sensitive(gde, active); 01640 01641 get_filter_times(page); 01642 gnc_ppr_update_date_query(page); 01643 LEAVE(" "); 01644 }
| 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.
| button | The button that was clicked. | |
| page | A pointer to the GncPluginPageRegister that is associated with this filter dialog. |
Definition at line 1456 of file gnc-plugin-page-register.c.
01458 { 01459 GncPluginPageRegisterPrivate *priv; 01460 GtkWidget *widget; 01461 gint i; 01462 01463 g_return_if_fail(GTK_IS_BUTTON(button)); 01464 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page)); 01465 01466 ENTER("(button %p, page %p)", button, page); 01467 01468 /* Turn on all the check menu items */ 01469 for (i = 0; status_actions[i].action_name; i++) { 01470 widget = gnc_glade_lookup_widget(GTK_WIDGET(button), 01471 status_actions[i].action_name); 01472 g_signal_handlers_block_by_func(widget, gnc_plugin_page_register_filter_status_one_cb, page); 01473 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widget), TRUE); 01474 g_signal_handlers_unblock_by_func(widget, gnc_plugin_page_register_filter_status_one_cb, page); 01475 } 01476 01477 /* Set the requested status */ 01478 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page); 01479 priv->fd.cleared_match = CLEARED_ALL; 01480 gnc_ppr_update_status_query(page); 01481 LEAVE(" "); 01482 }
| 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.
| button | The toggle button that was changed. | |
| page | A pointer to the GncPluginPageRegister that is associated with this filter dialog. |
Definition at line 1413 of file gnc-plugin-page-register.c.
01415 { 01416 GncPluginPageRegisterPrivate *priv; 01417 const gchar *name; 01418 gint i, value; 01419 01420 g_return_if_fail(GTK_IS_CHECK_BUTTON(button)); 01421 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page)); 01422 01423 name = gtk_widget_get_name(GTK_WIDGET(button)); 01424 ENTER("toggle button %s (%p), plugin_page %p", name, button, page); 01425 01426 /* Determine what status bit to change */ 01427 value = CLEARED_NONE; 01428 for (i = 0; status_actions[i].action_name; i++) { 01429 if (strcmp(name, status_actions[i].action_name) == 0) { 01430 value = status_actions[i].value; 01431 break; 01432 } 01433 } 01434 01435 /* Compute the new match status */ 01436 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page); 01437 if (gtk_toggle_button_get_active(button)) 01438 priv->fd.cleared_match |= value; 01439 else 01440 priv->fd.cleared_match &= ~value; 01441 gnc_ppr_update_status_query(page); 01442 LEAVE(" "); 01443 }
| Account * gnc_plugin_page_register_get_account | ( | GncPluginPageRegister * | page | ) |
Get the Account associated with this register page.
| page | A "register" page. |
Definition at line 602 of file gnc-plugin-page-register.c.
00603 { 00604 GncPluginPageRegisterPrivate *priv; 00605 GNCLedgerDisplayType ledger_type; 00606 Account *leader; 00607 00608 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page); 00609 ledger_type = gnc_ledger_display_type (priv->ledger); 00610 leader = gnc_ledger_display_leader (priv->ledger); 00611 00612 if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT)) 00613 return leader; 00614 return NULL; 00615 }
| GNCSplitReg * gnc_plugin_page_register_get_gsr | ( | GncPluginPage * | plugin_page | ) |
Get the GNCSplitReg data structure associated with this register page.
| plugin_page | A "register" page. |
Definition at line 2810 of file gnc-plugin-page-register.c.
02811 { 02812 GncPluginPageRegister *page; 02813 GncPluginPageRegisterPrivate *priv; 02814 02815 g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page), NULL); 02816 02817 page = GNC_PLUGIN_PAGE_REGISTER (plugin_page); 02818 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page); 02819 02820 return priv->gsr; 02821 }
| GType gnc_plugin_page_register_get_type | ( | void | ) |
Retrieve the type number for the plugin page.
Definition at line 405 of file gnc-plugin-page-register.c.
00406 { 00407 static GType gnc_plugin_page_register_type = 0; 00408 00409 if (gnc_plugin_page_register_type == 0) { 00410 static const GTypeInfo our_info = { 00411 sizeof (GncPluginPageRegisterClass), 00412 NULL, 00413 NULL, 00414 (GClassInitFunc) gnc_plugin_page_register_class_init, 00415 NULL, 00416 NULL, 00417 sizeof (GncPluginPageRegister), 00418 0, 00419 (GInstanceInitFunc) gnc_plugin_page_register_init 00420 }; 00421 00422 gnc_plugin_page_register_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE, 00423 GNC_PLUGIN_PAGE_REGISTER_NAME, 00424 &our_info, 0); 00425 } 00426 00427 return gnc_plugin_page_register_type; 00428 }
| GncPluginPage * gnc_plugin_page_register_new | ( | Account * | account, | |
| gboolean | subaccounts | |||
| ) |
Create a new "register" plugin page, given a pointer to an account.
| account | The pointer to the account to embed in the register. | |
| subaccounts | TRUE if all the sub-accounts of the specified account should be included in the register. |
Definition at line 482 of file gnc-plugin-page-register.c.
00483 { 00484 GNCLedgerDisplay *ledger; 00485 GncPluginPage *page; 00486 GncPluginPageRegisterPrivate *priv; 00487 00488 if (subaccounts) 00489 ledger = gnc_ledger_display_subaccounts (account); 00490 else 00491 ledger = gnc_ledger_display_simple (account); 00492 00493 page = gnc_plugin_page_register_new_common(ledger); 00494 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page); 00495 priv->key = *xaccAccountGetGUID(account); 00496 return page; 00497 }
| GncPluginPage * gnc_plugin_page_register_new_gl | ( | void | ) |
Create a new "register" plugin page containing a general ledger.
Definition at line 500 of file gnc-plugin-page-register.c.
00501 { 00502 GNCLedgerDisplay *ledger; 00503 00504 ledger = gnc_ledger_display_gl (); 00505 return gnc_plugin_page_register_new_common(ledger); 00506 }
| 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.)
| ledger | The pointer to the ledger to embed into the register. |
Definition at line 509 of file gnc-plugin-page-register.c.
| void gnc_plugin_page_register_set_options | ( | GncPluginPage * | plugin_page, | |
| const char * | lines_opt_page, | |||
| const char * | lines_opt_name, | |||
| gint | lines_default, | |||
| gboolean | read_only | |||
| ) |
Set various register options on a newly created "register" plugin page.
| plugin_page | The "register" page to modify. | |
| lines_opt_page | The name of the options page containing the number of lines per register. | |
| lines_opt_name | The name of the options (within the page specified above) containing the number of lines per register. | |
| lines_default | The number of lines to use if the specified options cannot be found or has never been set. | |
| read_only | True if the register should be read-only. |
Definition at line 2790 of file gnc-plugin-page-register.c.
02795 { 02796 GncPluginPageRegister *page; 02797 GncPluginPageRegisterPrivate *priv; 02798 02799 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page)); 02800 02801 page = GNC_PLUGIN_PAGE_REGISTER (plugin_page); 02802 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page); 02803 priv->lines_opt_section = lines_opt_section; 02804 priv->lines_opt_name = lines_opt_name; 02805 priv->lines_default = lines_default; 02806 priv->read_only = read_only; 02807 }
| 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.
| button | The button that was toggled. | |
| page | A pointer to the GncPluginPageRegister associated with this dialog box. |
Definition at line 1285 of file gnc-plugin-page-register.c.
01287 { 01288 GncPluginPageRegisterPrivate *priv; 01289 const gchar *name; 01290 SortType type; 01291 01292 g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button)); 01293 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page)); 01294 01295 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page); 01296 name = gtk_widget_get_name(GTK_WIDGET(button)); 01297 ENTER("button %s(%p), page %p", name, button, page); 01298 type = SortTypefromString(name); 01299 gnc_split_reg_set_sort_type(priv->gsr, type); 01300 LEAVE(" "); 01301 }
| 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.
| dialog | A pointer to the dialog box. | |
| response | A numerical value indicating why the dialog box was closed. | |
| page | A pointer to the GncPluginPageRegister associated with this dialog box. |
Definition at line 1255 of file gnc-plugin-page-register.c.
01258 { 01259 GncPluginPageRegisterPrivate *priv; 01260 01261 g_return_if_fail(GTK_IS_DIALOG(dialog)); 01262 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page)); 01263 01264 ENTER(" "); 01265 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page); 01266 if (response != GTK_RESPONSE_OK) { 01267 /* Restore the original sort order */ 01268 gnc_split_reg_set_sort_type(priv->gsr, priv->sd.original_sort_type); 01269 } 01270 priv->sd.dialog = NULL; 01271 gtk_widget_destroy(GTK_WIDGET(dialog)); 01272 LEAVE(" "); 01273 }
1.5.2