39 #include "guile-mappings.h"
41 #include <glib/gi18n.h>
42 #include "swig-runtime.h"
46 #include "gnc-plugin-page-register2.h"
48 #include "gnc-plugin-register.h"
53 #include "dialog-find-transactions.h"
54 #include "dialog-print-check.h"
55 #include "dialog-transfer.h"
56 #include "dialog-utils.h"
57 #include "assistant-stock-split.h"
58 #include "gnc-component-manager.h"
60 #include "gnc-date-edit.h"
65 #include "gnc-gui-query.h"
66 #include "gnc-icons.h"
67 #include "gnc-split-reg.h"
72 #include "gnc-session.h"
73 #include "gnome-utils/gnc-warnings.h"
74 #include "gnucash-sheet.h"
75 #include "dialog-lot-viewer.h"
79 #include "window-reconcile.h"
80 #include "window-autoclear.h"
81 #include "window-report.h"
82 #include "engine-helpers.h"
83 #include "qofbookslots.h"
88 #define DEFAULT_LINES_AMOUNT 50
92 static void gnc_plugin_page_register_finalize (GObject *
object);
96 static GtkWidget *gnc_plugin_page_register_create_widget (
GncPluginPage *plugin_page);
97 static void gnc_plugin_page_register_destroy_widget (
GncPluginPage *plugin_page);
98 static void gnc_plugin_page_register_window_changed (
GncPluginPage *plugin_page, GtkWidget *window);
99 static void gnc_plugin_page_register_save_page (
GncPluginPage *plugin_page, GKeyFile *file,
const gchar *group);
100 static GncPluginPage *gnc_plugin_page_register_recreate_page (GtkWidget *window, GKeyFile *file,
const gchar *group);
101 static void gnc_plugin_page_register_update_edit_menu (
GncPluginPage *page, gboolean hide);
102 static gboolean gnc_plugin_page_register_finish_pending (
GncPluginPage *page);
104 static gchar *gnc_plugin_page_register_get_tab_name (
GncPluginPage *plugin_page);
105 static gchar *gnc_plugin_page_register_get_tab_color (
GncPluginPage *plugin_page);
106 static gchar *gnc_plugin_page_register_get_long_name (
GncPluginPage *plugin_page);
108 static void gnc_plugin_page_register_summarybar_position_changed(gpointer prefs, gchar* pref, gpointer user_data);
116 static gchar *gnc_plugin_page_register_get_sort_order (
GncPluginPage *plugin_page);
117 void gnc_plugin_page_register_set_sort_order (
GncPluginPage *plugin_page,
const gchar *sort_order);
128 static time64 gnc_plugin_page_register_filter_dmy2time (
char *date_string);
129 static gchar *gnc_plugin_page_register_filter_time2dmy (
time64 raw_time);
130 static gchar *gnc_plugin_page_register_get_filter (
GncPluginPage *plugin_page);
131 void gnc_plugin_page_register_set_filter (
GncPluginPage *plugin_page,
const gchar *filter);
137 static void gnc_plugin_page_register_cmd_print_check (GtkAction *action,
GncPluginPageRegister *plugin_page);
138 static void gnc_plugin_page_register_cmd_cut (GtkAction *action,
GncPluginPageRegister *plugin_page);
139 static void gnc_plugin_page_register_cmd_copy (GtkAction *action,
GncPluginPageRegister *plugin_page);
140 static void gnc_plugin_page_register_cmd_paste (GtkAction *action,
GncPluginPageRegister *plugin_page);
141 static void gnc_plugin_page_register_cmd_edit_account (GtkAction *action,
GncPluginPageRegister *plugin_page);
142 static void gnc_plugin_page_register_cmd_find_transactions (GtkAction *action,
GncPluginPageRegister *plugin_page);
143 static void gnc_plugin_page_register_cmd_cut_transaction (GtkAction *action,
GncPluginPageRegister *plugin_page);
144 static void gnc_plugin_page_register_cmd_copy_transaction (GtkAction *action,
GncPluginPageRegister *plugin_page);
145 static void gnc_plugin_page_register_cmd_paste_transaction (GtkAction *action,
GncPluginPageRegister *plugin_page);
146 static void gnc_plugin_page_register_cmd_void_transaction (GtkAction *action,
GncPluginPageRegister *plugin_page);
147 static void gnc_plugin_page_register_cmd_unvoid_transaction (GtkAction *action,
GncPluginPageRegister *plugin_page);
148 static void gnc_plugin_page_register_cmd_reverse_transaction (GtkAction *action,
GncPluginPageRegister *plugin_page);
149 static void gnc_plugin_page_register_cmd_view_sort_by (GtkAction *action,
GncPluginPageRegister *plugin_page);
150 static void gnc_plugin_page_register_cmd_view_filter_by (GtkAction *action,
GncPluginPageRegister *plugin_page);
151 static void gnc_plugin_page_register_cmd_style_changed (GtkAction *action, GtkRadioAction *current,
GncPluginPageRegister *plugin_page);
152 static void gnc_plugin_page_register_cmd_style_double_line (GtkToggleAction *action,
GncPluginPageRegister *plugin_page);
154 static void gnc_plugin_page_register_cmd_reconcile (GtkAction *action,
GncPluginPageRegister *plugin_page);
155 static void gnc_plugin_page_register_cmd_autoclear (GtkAction *action,
GncPluginPageRegister *plugin_page);
156 static void gnc_plugin_page_register_cmd_transfer (GtkAction *action,
GncPluginPageRegister *plugin_page);
157 static void gnc_plugin_page_register_cmd_stock_split (GtkAction *action,
GncPluginPageRegister *plugin_page);
158 static void gnc_plugin_page_register_cmd_lots (GtkAction *action,
GncPluginPageRegister *plugin_page);
159 static void gnc_plugin_page_register_cmd_enter_transaction (GtkAction *action,
GncPluginPageRegister *plugin_page);
160 static void gnc_plugin_page_register_cmd_cancel_transaction (GtkAction *action,
GncPluginPageRegister *plugin_page);
161 static void gnc_plugin_page_register_cmd_delete_transaction (GtkAction *action,
GncPluginPageRegister *plugin_page);
162 static void gnc_plugin_page_register_cmd_blank_transaction (GtkAction *action,
GncPluginPageRegister *plugin_page);
163 static void gnc_plugin_page_register_cmd_duplicate_transaction (GtkAction *action,
GncPluginPageRegister *plugin_page);
164 static void gnc_plugin_page_register_cmd_reinitialize_transaction (GtkAction *action,
GncPluginPageRegister *plugin_page);
165 static void gnc_plugin_page_register_cmd_expand_transaction (GtkToggleAction *action,
GncPluginPageRegister *plugin_page);
166 static void gnc_plugin_page_register_cmd_exchange_rate (GtkAction *action,
GncPluginPageRegister *plugin_page);
167 static void gnc_plugin_page_register_cmd_jump (GtkAction *action,
GncPluginPageRegister *plugin_page);
168 static void gnc_plugin_page_register_cmd_schedule (GtkAction *action,
GncPluginPageRegister *plugin_page);
169 static void gnc_plugin_page_register_cmd_scrub_all (GtkAction *action,
GncPluginPageRegister *plugin_page);
170 static void gnc_plugin_page_register_cmd_scrub_current (GtkAction *action,
GncPluginPageRegister *plugin_page);
171 static void gnc_plugin_page_register_cmd_account_report (GtkAction *action,
GncPluginPageRegister *plugin_page);
172 static void gnc_plugin_page_register_cmd_transaction_report (GtkAction *action,
GncPluginPageRegister *plugin_page);
173 static void gnc_plugin_page_register_cmd_associate_file_transaction (GtkAction *action,
GncPluginPageRegister *plugin_page);
174 static void gnc_plugin_page_register_cmd_associate_location_transaction (GtkAction *action,
GncPluginPageRegister *plugin_page);
175 static void gnc_plugin_page_register_cmd_execassociated_transaction (GtkAction *action,
GncPluginPageRegister *plugin_page);
178 static void gnc_plugin_page_register_refresh_cb (GHashTable *changes, gpointer user_data);
179 static void gnc_plugin_page_register_close_cb (gpointer user_data);
182 static void gppr_account_destroy_cb (
Account *account);
183 static void gnc_plugin_page_register_event_handler (
QofInstance *entity,
192 #define CUT_TRANSACTION_LABEL N_("Cu_t Transaction")
193 #define COPY_TRANSACTION_LABEL N_("_Copy Transaction")
194 #define PASTE_TRANSACTION_LABEL N_("_Paste Transaction")
195 #define DUPLICATE_TRANSACTION_LABEL N_("Dup_licate Transaction")
196 #define DELETE_TRANSACTION_LABEL N_("_Delete Transaction")
197 #define ASSOCIATE_TRANSACTION_FILE_LABEL N_("_Associate File with Transaction")
198 #define ASSOCIATE_TRANSACTION_LOCATION_LABEL N_("_Associate Location with Transaction")
199 #define EXECASSOCIATED_TRANSACTION_LABEL N_("_Open Associated File/Location")
200 #define CUT_SPLIT_LABEL N_("Cu_t Split")
201 #define COPY_SPLIT_LABEL N_("_Copy Split")
202 #define PASTE_SPLIT_LABEL N_("_Paste Split")
203 #define DUPLICATE_SPLIT_LABEL N_("Dup_licate Split")
204 #define DELETE_SPLIT_LABEL N_("_Delete Split")
205 #define CUT_TRANSACTION_TIP N_("Cut the selected transaction into clipboard")
206 #define COPY_TRANSACTION_TIP N_("Copy the selected transaction into clipboard")
207 #define PASTE_TRANSACTION_TIP N_("Paste the transaction from the clipboard")
208 #define DUPLICATE_TRANSACTION_TIP N_("Make a copy of the current transaction")
209 #define DELETE_TRANSACTION_TIP N_("Delete the current transaction")
210 #define ASSOCIATE_TRANSACTION_FILE_TIP N_("Associate a file with the current transaction")
211 #define ASSOCIATE_TRANSACTION_LOCATION_TIP N_("Associate a location with the current transaction")
212 #define EXECASSOCIATED_TRANSACTION_TIP N_("Open the associated file or location with the current transaction")
213 #define CUT_SPLIT_TIP N_("Cut the selected split into clipboard")
214 #define COPY_SPLIT_TIP N_("Copy the selected split into clipboard")
215 #define PASTE_SPLIT_TIP N_("Paste the split from the clipboard")
216 #define DUPLICATE_SPLIT_TIP N_("Make a copy of the current split")
217 #define DELETE_SPLIT_TIP N_("Delete the current split")
219 static GtkActionEntry gnc_plugin_page_register_actions [] =
224 "FilePrintAction", GTK_STOCK_PRINT, N_(
"_Print Checks..."),
"<control>p", NULL,
225 G_CALLBACK (gnc_plugin_page_register_cmd_print_check)
231 "EditCutAction", GTK_STOCK_CUT, N_(
"Cu_t"), NULL,
232 N_(
"Cut the current selection and copy it to clipboard"),
233 G_CALLBACK (gnc_plugin_page_register_cmd_cut)
236 "EditCopyAction", GTK_STOCK_COPY, N_(
"_Copy"), NULL,
237 N_(
"Copy the current selection to clipboard"),
238 G_CALLBACK (gnc_plugin_page_register_cmd_copy)
241 "EditPasteAction", GTK_STOCK_PASTE, N_(
"_Paste"), NULL,
242 N_(
"Paste the clipboard content at the cursor position"),
243 G_CALLBACK (gnc_plugin_page_register_cmd_paste)
246 "EditEditAccountAction", GNC_STOCK_EDIT_ACCOUNT, N_(
"Edit _Account"),
"<control>e",
247 N_(
"Edit the selected account"),
248 G_CALLBACK (gnc_plugin_page_register_cmd_edit_account)
251 "EditFindTransactionsAction", GTK_STOCK_FIND, N_(
"_Find..."),
"<control>f",
252 N_(
"Find transactions with a search"),
253 G_CALLBACK (gnc_plugin_page_register_cmd_find_transactions)
259 "CutTransactionAction", GTK_STOCK_CUT, CUT_TRANSACTION_LABEL,
"",
261 G_CALLBACK (gnc_plugin_page_register_cmd_cut_transaction)
264 "CopyTransactionAction", GTK_STOCK_COPY, COPY_TRANSACTION_LABEL,
"",
265 COPY_TRANSACTION_TIP,
266 G_CALLBACK (gnc_plugin_page_register_cmd_copy_transaction)
269 "PasteTransactionAction", GTK_STOCK_PASTE, PASTE_TRANSACTION_LABEL,
"",
270 PASTE_TRANSACTION_TIP,
271 G_CALLBACK (gnc_plugin_page_register_cmd_paste_transaction)
274 "DuplicateTransactionAction", GTK_STOCK_COPY, DUPLICATE_TRANSACTION_LABEL,
"",
275 DUPLICATE_TRANSACTION_TIP,
276 G_CALLBACK (gnc_plugin_page_register_cmd_duplicate_transaction)
279 "DeleteTransactionAction", GTK_STOCK_DELETE, DELETE_TRANSACTION_LABEL, NULL,
280 DELETE_TRANSACTION_TIP,
281 G_CALLBACK (gnc_plugin_page_register_cmd_delete_transaction)
284 "RemoveTransactionSplitsAction", GTK_STOCK_CLEAR, N_(
"Remo_ve Other Splits"), NULL,
285 N_(
"Remove all splits in the current transaction"),
286 G_CALLBACK (gnc_plugin_page_register_cmd_reinitialize_transaction)
289 "RecordTransactionAction", GTK_STOCK_ADD, N_(
"_Enter Transaction"), NULL,
290 N_(
"Record the current transaction"),
291 G_CALLBACK (gnc_plugin_page_register_cmd_enter_transaction)
294 "CancelTransactionAction", GTK_STOCK_CANCEL, N_(
"Ca_ncel Transaction"), NULL,
295 N_(
"Cancel the current transaction"),
296 G_CALLBACK (gnc_plugin_page_register_cmd_cancel_transaction)
299 "VoidTransactionAction", NULL, N_(
"_Void Transaction"), NULL, NULL,
300 G_CALLBACK (gnc_plugin_page_register_cmd_void_transaction)
303 "UnvoidTransactionAction", NULL, N_(
"_Unvoid Transaction"), NULL, NULL,
304 G_CALLBACK (gnc_plugin_page_register_cmd_unvoid_transaction)
307 "ReverseTransactionAction", NULL, N_(
"Add _Reversing Transaction"), NULL, NULL,
308 G_CALLBACK (gnc_plugin_page_register_cmd_reverse_transaction)
311 "AssociateTransactionFileAction", NULL, ASSOCIATE_TRANSACTION_FILE_LABEL, NULL,
312 ASSOCIATE_TRANSACTION_FILE_TIP,
313 G_CALLBACK (gnc_plugin_page_register_cmd_associate_file_transaction)
316 "AssociateTransactionLocationAction", NULL, ASSOCIATE_TRANSACTION_LOCATION_LABEL, NULL,
317 ASSOCIATE_TRANSACTION_LOCATION_TIP,
318 G_CALLBACK (gnc_plugin_page_register_cmd_associate_location_transaction)
321 "ExecAssociatedTransactionAction", NULL, EXECASSOCIATED_TRANSACTION_LABEL, NULL,
322 EXECASSOCIATED_TRANSACTION_TIP,
323 G_CALLBACK (gnc_plugin_page_register_cmd_execassociated_transaction)
329 "ViewSortByAction", NULL, N_(
"_Sort By..."), NULL, NULL,
330 G_CALLBACK (gnc_plugin_page_register_cmd_view_sort_by)
333 "ViewFilterByAction", NULL, N_(
"_Filter By..."), NULL, NULL,
334 G_CALLBACK (gnc_plugin_page_register_cmd_view_filter_by)
340 "ActionsTransferAction", GNC_STOCK_TRANSFER, N_(
"_Transfer..."),
"<control>t",
341 N_(
"Transfer funds from one account to another"),
342 G_CALLBACK (gnc_plugin_page_register_cmd_transfer)
345 "ActionsReconcileAction", GTK_STOCK_INDEX, N_(
"_Reconcile..."), NULL,
346 N_(
"Reconcile the selected account"),
347 G_CALLBACK (gnc_plugin_page_register_cmd_reconcile)
350 "ActionsAutoClearAction", GTK_STOCK_INDEX, N_(
"_Auto-clear..."), NULL,
351 N_(
"Automatically clear individual transactions, so as to reach a certain cleared amount"),
352 G_CALLBACK (gnc_plugin_page_register_cmd_autoclear)
355 "ActionsStockSplitAction", NULL, N_(
"Stoc_k Split..."), NULL,
356 N_(
"Record a stock split or a stock merger"),
357 G_CALLBACK (gnc_plugin_page_register_cmd_stock_split)
360 "ActionsLotsAction", NULL, N_(
"View _Lots..."), NULL,
361 N_(
"Bring up the lot viewer/editor window"),
362 G_CALLBACK (gnc_plugin_page_register_cmd_lots)
365 "BlankTransactionAction", GTK_STOCK_GOTO_BOTTOM, N_(
"_Blank Transaction"),
"<control>Page_Down",
366 N_(
"Move to the blank transaction at the bottom of the register"),
367 G_CALLBACK (gnc_plugin_page_register_cmd_blank_transaction)
370 "EditExchangeRateAction", NULL, N_(
"Edit E_xchange Rate"), NULL,
371 N_(
"Edit the exchange rate for the current transaction"),
372 G_CALLBACK (gnc_plugin_page_register_cmd_exchange_rate)
375 "JumpTransactionAction", GNC_STOCK_JUMP_TO, N_(
"_Jump"), NULL,
376 N_(
"Jump to the corresponding transaction in the other account"),
377 G_CALLBACK (gnc_plugin_page_register_cmd_jump)
380 "ScheduleTransactionAction", GNC_STOCK_SCHEDULE, N_(
"Sche_dule..."), NULL,
381 N_(
"Create a Scheduled Transaction with the current transaction as a template"),
382 G_CALLBACK (gnc_plugin_page_register_cmd_schedule)
385 "ScrubAllAction", NULL, N_(
"_All transactions"), NULL, NULL,
386 G_CALLBACK (gnc_plugin_page_register_cmd_scrub_all)
389 "ScrubCurrentAction", NULL, N_(
"_This transaction"), NULL, NULL,
390 G_CALLBACK (gnc_plugin_page_register_cmd_scrub_current)
396 "ReportsAccountReportAction", NULL, N_(
"Account Report"), NULL,
397 N_(
"Open a register report for this Account"),
398 G_CALLBACK (gnc_plugin_page_register_cmd_account_report)
401 "ReportsAcctTransReportAction", NULL, N_(
"Account Report - Single Transaction"), NULL,
402 N_(
"Open a register report for the selected Transaction"),
403 G_CALLBACK (gnc_plugin_page_register_cmd_transaction_report)
407 static guint gnc_plugin_page_register_n_actions = G_N_ELEMENTS (gnc_plugin_page_register_actions);
409 static GtkToggleActionEntry toggle_entries[] =
412 "ViewStyleDoubleLineAction", NULL, N_(
"_Double Line"), NULL,
413 N_(
"Show two lines of information for each transaction"),
414 G_CALLBACK (gnc_plugin_page_register_cmd_style_double_line), FALSE
418 "SplitTransactionAction", GNC_STOCK_SPLIT_TRANS, N_(
"S_plit Transaction"), NULL,
419 N_(
"Show all splits in the current transaction"),
420 G_CALLBACK (gnc_plugin_page_register_cmd_expand_transaction), FALSE
424 static guint n_toggle_entries = G_N_ELEMENTS (toggle_entries);
426 static GtkRadioActionEntry radio_entries_2 [] =
430 "ViewStyleBasicAction", NULL, N_(
"_Basic Ledger"), NULL,
431 N_(
"Show transactions on one or two lines"), REG_STYLE_LEDGER
435 "ViewStyleAutoSplitAction", NULL, N_(
"_Auto-Split Ledger"), NULL,
436 N_(
"Show transactions on one or two lines and expand the current transaction"), REG_STYLE_AUTO_LEDGER
440 "ViewStyleJournalAction", NULL, N_(
"Transaction _Journal"), NULL,
441 N_(
"Show expanded transactions with all splits"), REG_STYLE_JOURNAL
445 static guint n_radio_entries_2 = G_N_ELEMENTS (radio_entries_2);
450 static const gchar *important_actions[] =
452 "SplitTransactionAction",
458 static const gchar *actions_requiring_account[] =
460 "EditEditAccountAction",
461 "ActionsReconcileAction",
462 "ActionsAutoClearAction",
468 static const gchar *view_style_actions[] =
470 "ViewStyleBasicAction",
471 "ViewStyleAutoSplitAction",
472 "ViewStyleJournalAction",
479 {
"ActionsTransferAction", N_(
"Transfer") },
480 {
"RecordTransactionAction", N_(
"Enter") },
481 {
"CancelTransactionAction", N_(
"Cancel") },
482 {
"DeleteTransactionAction", N_(
"Delete") },
483 {
"DuplicateTransactionAction", N_(
"Duplicate") },
484 {
"SplitTransactionAction", N_(
"Split") },
485 {
"ScheduleTransactionAction", N_(
"Schedule") },
486 {
"BlankTransactionAction", N_(
"Blank") },
487 {
"ActionsReconcileAction", N_(
"Reconcile") },
488 {
"ActionsAutoClearAction", N_(
"Auto-clear") },
489 {
"AssociateTransactionFileAction", N_(
"Associate File") },
490 {
"AssociateTransactionLocationAction", N_(
"Associate Location") },
491 {
"ExecAssociatedTransactionAction", N_(
"Open File/Location") },
497 const char *action_name;
504 {
"filter_status_reconciled", CLEARED_RECONCILED, NULL },
505 {
"filter_status_cleared", CLEARED_CLEARED, NULL },
506 {
"filter_status_voided", CLEARED_VOIDED, NULL },
507 {
"filter_status_frozen", CLEARED_FROZEN, NULL },
508 {
"filter_status_unreconciled", CLEARED_NO, NULL },
512 #define CLEARED_VALUE "cleared_value"
513 #define DEFAULT_FILTER "0x001f"
514 #define DEFAULT_SORT_ORDER "BY_STANDARD"
527 gint event_handler_id;
528 gint component_manager_id;
537 GtkWidget *num_radio;
538 GtkWidget *act_radio;
539 SortType original_sort_type;
540 gboolean original_save_order;
542 gboolean reverse_order;
549 GtkWidget *start_date_choose;
550 GtkWidget *start_date_today;
551 GtkWidget *start_date;
552 GtkWidget *end_date_choose;
553 GtkWidget *end_date_today;
555 cleared_match_t original_cleared_match;
556 cleared_match_t cleared_match;
557 time64 original_start_time;
561 gboolean original_save_filter;
562 gboolean save_filter;
566 #define GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(o) \
567 (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_PAGE_REGISTER, GncPluginPageRegisterPrivate))
569 static GObjectClass *parent_class = NULL;
578 static GType gnc_plugin_page_register_type = 0;
580 if (gnc_plugin_page_register_type == 0)
582 static const GTypeInfo our_info =
587 (GClassInitFunc) gnc_plugin_page_register_class_init,
592 (GInstanceInitFunc) gnc_plugin_page_register_init
595 gnc_plugin_page_register_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
596 GNC_PLUGIN_PAGE_REGISTER_NAME,
600 return gnc_plugin_page_register_type;
617 gsr = gnc_ledger_display_get_user_data (ledger);
621 for ( ; item; item = g_list_next(item))
624 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(register_page);
625 if (priv->gsr == gsr)
626 return GNC_PLUGIN_PAGE(register_page);
630 register_page = g_object_new (GNC_TYPE_PLUGIN_PAGE_REGISTER, NULL);
631 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(register_page);
632 priv->ledger = ledger;
635 plugin_page = GNC_PLUGIN_PAGE(register_page);
636 label = gnc_plugin_page_register_get_tab_name(plugin_page);
640 label_color = gnc_plugin_page_register_get_tab_color(plugin_page);
644 label = gnc_plugin_page_register_get_long_name(plugin_page);
648 q = gnc_ledger_display_get_query (ledger);
650 for (item = book_list; item; item = g_list_next(item))
654 priv->component_manager_id = 0;
670 ENTER(
"account=%p, subaccounts=%s", account,
671 subaccounts ?
"TRUE" :
"FALSE");
676 for ( ; item; item = g_list_next (item))
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."));
692 ledger = gnc_ledger_display_subaccounts (account);
694 ledger = gnc_ledger_display_simple (account);
696 page = gnc_plugin_page_register_new_common(ledger);
697 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
709 ledger = gnc_ledger_display_gl ();
710 return gnc_plugin_page_register_new_common(ledger);
716 return gnc_plugin_page_register_new_common(ledger);
722 GObjectClass *object_class = G_OBJECT_CLASS (klass);
725 parent_class = g_type_class_peek_parent (klass);
727 object_class->finalize = gnc_plugin_page_register_finalize;
729 gnc_plugin_class->
tab_icon = GNC_STOCK_ACCOUNT;
730 gnc_plugin_class->
plugin_name = GNC_PLUGIN_PAGE_REGISTER_NAME;
731 gnc_plugin_class->
create_widget = gnc_plugin_page_register_create_widget;
732 gnc_plugin_class->
destroy_widget = gnc_plugin_page_register_destroy_widget;
733 gnc_plugin_class->
window_changed = gnc_plugin_page_register_window_changed;
734 gnc_plugin_class->
save_page = gnc_plugin_page_register_save_page;
735 gnc_plugin_class->
recreate_page = gnc_plugin_page_register_recreate_page;
737 gnc_plugin_class->
finish_pending = gnc_plugin_page_register_finish_pending;
741 gnc_ui_register_account_destroy_callback (gppr_account_destroy_cb);
749 GtkActionGroup *action_group;
752 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
755 parent = GNC_PLUGIN_PAGE(plugin_page);
757 g_object_set(G_OBJECT(plugin_page),
758 "page-name", _(
"General Ledger"),
759 "page-uri",
"default:",
760 "ui-description",
"gnc-plugin-page-register-ui.xml",
761 "use-new-window", use_new,
767 "GncPluginPageRegisterActions");
768 gtk_action_group_add_actions (action_group, gnc_plugin_page_register_actions,
769 gnc_plugin_page_register_n_actions, plugin_page);
770 gtk_action_group_add_toggle_actions (action_group,
771 toggle_entries, n_toggle_entries,
773 gtk_action_group_add_radio_actions (action_group,
774 radio_entries_2, n_radio_entries_2,
776 G_CALLBACK(gnc_plugin_page_register_cmd_style_changed),
782 priv->lines_default = DEFAULT_LINES_AMOUNT;
783 priv->read_only = FALSE;
784 priv->fd.cleared_match = CLEARED_ALL;
788 gnc_plugin_page_register_finalize (GObject *
object)
790 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (
object));
792 ENTER(
"object %p",
object);
794 G_OBJECT_CLASS (parent_class)->finalize (
object);
802 GNCLedgerDisplayType ledger_type;
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);
809 if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
815 static const char* readonly_inactive_actions[] =
819 "CutTransactionAction",
820 "PasteTransactionAction",
821 "DuplicateTransactionAction",
822 "DeleteTransactionAction",
823 "RemoveTransactionSplitsAction",
824 "RecordTransactionAction",
825 "CancelTransactionAction",
826 "UnvoidTransactionAction",
827 "VoidTransactionAction",
828 "ReverseTransactionAction",
829 "ActionsTransferAction",
830 "ActionsReconcileAction",
831 "ActionsStockSplitAction",
832 "ScheduleTransactionAction",
834 "ScrubCurrentAction",
835 "AssociateTransactionFileAction",
836 "AssociateTransactionLocationAction",
842 static const char* tran_vs_split_actions[] =
844 "CutTransactionAction",
845 "CopyTransactionAction",
846 "PasteTransactionAction",
847 "DuplicateTransactionAction",
848 "DeleteTransactionAction",
853 static const char* tran_action_labels[] =
855 CUT_TRANSACTION_LABEL,
856 COPY_TRANSACTION_LABEL,
857 PASTE_TRANSACTION_LABEL,
858 DUPLICATE_TRANSACTION_LABEL,
859 DELETE_TRANSACTION_LABEL,
860 ASSOCIATE_TRANSACTION_FILE_LABEL,
861 ASSOCIATE_TRANSACTION_LOCATION_LABEL,
862 EXECASSOCIATED_TRANSACTION_LABEL,
867 static const char* tran_action_tips[] =
870 COPY_TRANSACTION_TIP,
871 PASTE_TRANSACTION_TIP,
872 DUPLICATE_TRANSACTION_TIP,
873 DELETE_TRANSACTION_TIP,
874 ASSOCIATE_TRANSACTION_FILE_TIP,
875 ASSOCIATE_TRANSACTION_LOCATION_TIP,
876 EXECASSOCIATED_TRANSACTION_TIP,
881 static const char* split_action_labels[] =
886 DUPLICATE_SPLIT_LABEL,
892 static const char* split_action_tips[] =
908 gboolean expanded, voided;
913 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
914 reg = gnc_ledger_display_get_split_register(priv->ledger);
917 "SplitTransactionAction");
918 gtk_action_set_sensitive (action, reg->style == REG_STYLE_LEDGER);
919 g_signal_handlers_block_by_func
920 (action, gnc_plugin_page_register_cmd_expand_transaction, page);
921 gtk_toggle_action_set_active (GTK_TOGGLE_ACTION(action), expanded);
922 g_signal_handlers_unblock_by_func
923 (action, gnc_plugin_page_register_cmd_expand_transaction, page);
929 "VoidTransactionAction");
930 gtk_action_set_sensitive (GTK_ACTION(action), !voided);
933 "UnvoidTransactionAction");
934 gtk_action_set_sensitive (GTK_ACTION(action), voided);
939 "ExecAssociatedTransactionAction");
940 gtk_action_set_sensitive (GTK_ACTION(action), uri ? TRUE:FALSE);
946 for (iter = readonly_inactive_actions; *iter; ++iter)
950 gtk_action_set_sensitive(action, FALSE);
956 const char **iter, **label_iter, **tooltip_iter;
957 gboolean curr_label_trans = FALSE;
959 iter = tran_vs_split_actions;
961 label_iter = tran_action_labels;
962 if (g_strcmp0 (gtk_action_get_label(action), _(*label_iter)) == 0)
963 curr_label_trans = TRUE;
964 if ((cursor_class == CURSOR_CLASS_SPLIT) && curr_label_trans)
966 label_iter = split_action_labels;
967 tooltip_iter = split_action_tips;
968 for (iter = tran_vs_split_actions; *iter; ++iter)
972 gtk_action_set_label(action, _(*label_iter));
973 gtk_action_set_tooltip(action, _(*tooltip_iter));
978 else if ((cursor_class == CURSOR_CLASS_TRANS) && !curr_label_trans)
980 label_iter = tran_action_labels;
981 tooltip_iter = tran_action_tips;
982 for (iter = tran_vs_split_actions; *iter; ++iter)
986 gtk_action_set_label(action, _(*label_iter));
987 gtk_action_set_tooltip(action, _(*tooltip_iter));
999 GtkActionGroup *action_group;
1003 GNCLedgerDisplayType ledger_type;
1007 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
1011 "sensitive", is_readwrite && account != NULL);
1014 ledger_type = gnc_ledger_display_type(priv->ledger);
1016 "sensitive", ledger_type == LD_SINGLE);
1018 reg = gnc_ledger_display_get_split_register(priv->ledger);
1019 for (i = n_radio_entries_2 - 1; i > 0; i--)
1021 DEBUG(
" index %d: comparing %x to %x", i, radio_entries_2[i].value,
1023 if (radio_entries_2[i].value == reg->style)
1031 action = gtk_action_group_get_action(action_group, radio_entries_2[i].name);
1032 g_signal_handlers_block_by_func(action, gnc_plugin_page_register_cmd_style_changed, page);
1033 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE);
1034 g_signal_handlers_unblock_by_func(action, gnc_plugin_page_register_cmd_style_changed, page);
1037 action = gtk_action_group_get_action (action_group,
1038 "ViewStyleDoubleLineAction");
1039 g_signal_handlers_block_by_func(action, gnc_plugin_page_register_cmd_style_double_line, page);
1040 gtk_toggle_action_set_active (GTK_TOGGLE_ACTION(action), reg->
use_double_line);
1041 g_signal_handlers_unblock_by_func(action, gnc_plugin_page_register_cmd_style_double_line, page);
1047 gnc_plugin_page_register_create_widget (
GncPluginPage *plugin_page)
1051 GNCLedgerDisplayType ledger_type;
1052 GncWindow *gnc_window;
1059 int filter_changed = 0;
1061 ENTER(
"page %p", plugin_page);
1062 page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
1063 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
1065 if (priv->widget != NULL)
1067 LEAVE(
"existing widget %p", priv->widget);
1068 return priv->widget;
1071 priv->widget = gtk_vbox_new (FALSE, 0);
1072 gtk_widget_show (priv->widget);
1074 numRows = priv->lines_default;
1075 numRows = MIN(numRows, DEFAULT_LINES_AMOUNT);
1077 gnc_window = GNC_WINDOW(GNC_PLUGIN_PAGE(page)->window);
1078 gsr = gnc_split_reg_new(priv->ledger,
1079 gnc_window_get_gtk_window(gnc_window),
1080 numRows, priv->read_only);
1082 gtk_widget_show (gsr);
1083 gtk_box_pack_start (GTK_BOX (priv->widget), gsr, TRUE, TRUE, 0);
1085 g_signal_connect (G_OBJECT (gsr),
"help-changed",
1086 G_CALLBACK ( gnc_plugin_page_help_changed_cb ),
1089 reg = gnc_ledger_display_get_split_register(priv->ledger);
1092 gnc_ledger_display_refresh(priv->ledger);
1094 gnc_plugin_page_register_ui_initial_state (page);
1095 gnc_plugin_page_register_ui_update (NULL, page);
1097 ledger_type = gnc_ledger_display_type (priv->ledger);
1099 if (ledger_type == LD_SINGLE || ledger_type == LD_SUBACCOUNT)
1102 priv->sd.save_order = FALSE;
1103 priv->sd.reverse_order = FALSE;
1104 order = gnc_plugin_page_register_get_sort_order(plugin_page);
1106 PINFO(
"Loaded Sort order is %s", order);
1108 gnc_split_reg_set_sort_type(priv->gsr, SortTypefromString(order));
1110 if (order && (g_strcmp0 (order, DEFAULT_SORT_ORDER) != 0))
1111 priv->sd.save_order = TRUE;
1113 priv->sd.original_save_order = priv->sd.save_order;
1117 priv->fd.save_filter = FALSE;
1119 filter = g_strsplit(gnc_plugin_page_register_get_filter(plugin_page),
",", -1);
1121 PINFO(
"Loaded Filter Status is %s", filter[0]);
1123 priv->fd.cleared_match = (gint)g_ascii_strtoll( filter[0], NULL, 16 );
1125 if (filter[0] && (g_strcmp0 (filter[0], DEFAULT_FILTER) != 0))
1126 filter_changed = filter_changed + 1;
1128 if (filter[1] && (g_strcmp0 (filter[1],
"0") != 0 ))
1130 PINFO(
"Loaded Filter Start Date is %s", filter[1]);
1132 priv->fd.start_time = gnc_plugin_page_register_filter_dmy2time (filter[1] );
1134 filter_changed = filter_changed + 1;
1136 if (filter[2] && (g_strcmp0 (filter[2],
"0") != 0 ))
1138 PINFO(
"Loaded Filter End Date is %s", filter[2]);
1140 priv->fd.end_time = gnc_plugin_page_register_filter_dmy2time (filter[2] );
1142 filter_changed = filter_changed + 1;
1146 if (filter_changed != 0)
1147 priv->fd.save_filter = TRUE;
1149 priv->fd.original_save_filter = priv->fd.save_filter;
1153 gnc_ppr_update_status_query (page);
1154 gnc_ppr_update_date_query(page);
1157 plugin_page->
summarybar = gsr_create_summary_bar(priv->gsr);
1160 gtk_widget_show_all(plugin_page->
summarybar);
1161 gtk_box_pack_start(GTK_BOX (priv->widget), plugin_page->
summarybar,
1164 gnc_plugin_page_register_summarybar_position_changed (NULL, NULL, page);
1166 GNC_PREF_SUMMARYBAR_POSITION_TOP,
1167 gnc_plugin_page_register_summarybar_position_changed,
1170 GNC_PREF_SUMMARYBAR_POSITION_BOTTOM,
1171 gnc_plugin_page_register_summarybar_position_changed,
1177 priv->component_manager_id =
1178 gnc_register_gui_component(GNC_PLUGIN_PAGE_REGISTER_NAME,
1179 gnc_plugin_page_register_refresh_cb,
1180 gnc_plugin_page_register_close_cb,
1182 gnc_gui_component_set_session (priv->component_manager_id,
1183 gnc_get_current_session());
1186 gnc_gui_component_watch_entity (
1188 QOF_EVENT_DESTROY | QOF_EVENT_MODIFY);
1190 gnc_split_reg_set_moved_cb
1191 (priv->gsr, (GFunc)gnc_plugin_page_register_ui_update, page);
1195 return priv->widget;
1199 gnc_plugin_page_register_destroy_widget (
GncPluginPage *plugin_page)
1204 ENTER(
"page %p", plugin_page);
1205 page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
1206 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
1209 GNC_PREF_SUMMARYBAR_POSITION_TOP,
1210 gnc_plugin_page_register_summarybar_position_changed,
1213 GNC_PREF_SUMMARYBAR_POSITION_BOTTOM,
1214 gnc_plugin_page_register_summarybar_position_changed,
1216 if (priv->widget == NULL)
1219 if (priv->component_manager_id)
1221 gnc_unregister_gui_component(priv->component_manager_id);
1222 priv->component_manager_id = 0;
1225 if (priv->event_handler_id)
1228 priv->event_handler_id = 0;
1231 if (priv->sd.dialog)
1233 gtk_widget_destroy(priv->sd.dialog);
1234 memset(&priv->sd, 0,
sizeof(priv->sd));
1237 if (priv->fd.dialog)
1239 gtk_widget_destroy(priv->fd.dialog);
1240 memset(&priv->fd, 0,
sizeof(priv->fd));
1243 gtk_widget_hide(priv->widget);
1244 gnc_ledger_display_close (priv->ledger);
1245 priv->ledger = NULL;
1250 gnc_plugin_page_register_window_changed (
GncPluginPage *plugin_page,
1256 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page));
1258 page = GNC_PLUGIN_PAGE_REGISTER(plugin_page);
1259 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
1261 GTK_WIDGET(gnc_window_get_gtk_window(GNC_WINDOW(window)));
1264 static const gchar *style_names[] =
1272 #define KEY_REGISTER_TYPE "RegisterType"
1273 #define KEY_ACCOUNT_NAME "AccountName"
1274 #define KEY_REGISTER_STYLE "RegisterStyle"
1275 #define KEY_DOUBLE_LINE "DoubleLineMode"
1277 #define LABEL_ACCOUNT "Account"
1278 #define LABEL_SUBACCOUNT "SubAccount"
1279 #define LABEL_GL "GL"
1280 #define LABEL_SEARCH "Search"
1293 gnc_plugin_page_register_save_page (
GncPluginPage *plugin_page,
1295 const gchar *group_name)
1299 GNCLedgerDisplayType ledger_type;
1303 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
1304 g_return_if_fail (key_file != NULL);
1305 g_return_if_fail (group_name != NULL);
1307 ENTER(
"page %p, key_file %p, group_name %s", plugin_page, key_file,
1310 page = GNC_PLUGIN_PAGE_REGISTER(plugin_page);
1311 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
1313 reg = gnc_ledger_display_get_split_register(priv->ledger);
1314 ledger_type = gnc_ledger_display_type(priv->ledger);
1315 if (ledger_type > LD_GL)
1317 LEAVE(
"Unsupported ledger type");
1320 if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
1324 label = (ledger_type == LD_SINGLE) ? LABEL_ACCOUNT : LABEL_SUBACCOUNT;
1325 leader = gnc_ledger_display_leader(priv->ledger);
1326 g_key_file_set_string(key_file, group_name, KEY_REGISTER_TYPE, label);
1328 g_key_file_set_string(key_file, group_name, KEY_ACCOUNT_NAME, name);
1331 else if (reg->type == GENERAL_LEDGER)
1333 g_key_file_set_string(key_file, group_name, KEY_REGISTER_TYPE,
1336 else if (reg->type == SEARCH_LEDGER)
1338 g_key_file_set_string(key_file, group_name, KEY_REGISTER_TYPE,
1343 LEAVE(
"Unsupported register type");
1347 g_key_file_set_string(key_file, group_name, KEY_REGISTER_STYLE,
1348 style_names[reg->style]);
1349 g_key_file_set_boolean(key_file, group_name, KEY_DOUBLE_LINE,
1369 gnc_plugin_page_register_restore_edit_menu (
GncPluginPage *page,
1371 const gchar *group_name)
1374 GError *error = NULL;
1377 gboolean use_double_line;
1382 style_name = g_key_file_get_string(key_file, group_name,
1383 KEY_REGISTER_STYLE, &error);
1384 for (i = 0 ; style_names[i]; i++)
1386 if (g_ascii_strcasecmp(style_name, style_names[i]) == 0)
1388 DEBUG(
"Found match for style name: %s", style_name);
1395 if (i <= REG_STYLE_JOURNAL)
1397 DEBUG(
"Setting style: %d", i);
1399 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE);
1404 g_key_file_get_boolean(key_file, group_name, KEY_DOUBLE_LINE, &error);
1405 DEBUG(
"Setting double_line_mode: %d", use_double_line);
1407 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), use_double_line);
1423 gnc_plugin_page_register_recreate_page (GtkWidget *window,
1425 const gchar *group_name)
1428 GError *error = NULL;
1429 gchar *reg_type, *acct_name;
1432 gboolean include_subs;
1434 g_return_val_if_fail(key_file, NULL);
1435 g_return_val_if_fail(group_name, NULL);
1436 ENTER(
"key_file %p, group_name %s", key_file, group_name);
1439 reg_type = g_key_file_get_string(key_file, group_name,
1440 KEY_REGISTER_TYPE, &error);
1441 DEBUG(
"Page type: %s", reg_type);
1442 if ((g_ascii_strcasecmp(reg_type, LABEL_ACCOUNT) == 0) ||
1443 (g_ascii_strcasecmp(reg_type, LABEL_SUBACCOUNT) == 0))
1445 include_subs = (g_ascii_strcasecmp(reg_type, LABEL_SUBACCOUNT) == 0);
1446 DEBUG(
"Include subs: %d", include_subs);
1447 acct_name = g_key_file_get_string(key_file, group_name,
1448 KEY_ACCOUNT_NAME, &error);
1453 if (account == NULL)
1455 LEAVE(
"Bad account name");
1461 else if (g_ascii_strcasecmp(reg_type, LABEL_GL) == 0)
1467 LEAVE(
"Bad ledger type");
1480 gnc_plugin_page_register_restore_edit_menu(page, key_file, group_name);
1490 gnc_plugin_page_register_update_edit_menu (
GncPluginPage *page, gboolean hide)
1495 gboolean can_copy = FALSE, can_cut = FALSE, can_paste = FALSE;
1496 gboolean has_selection;
1499 reg_page = GNC_PLUGIN_PAGE_REGISTER(page);
1500 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(reg_page);
1501 has_selection = gnucash_register_has_selection (priv->gsr->
reg);
1503 can_copy = has_selection;
1504 can_cut = is_readwrite && has_selection;
1505 can_paste = is_readwrite;
1508 gtk_action_set_sensitive (action, can_copy);
1509 gtk_action_set_visible (action, !hide || can_copy);
1511 gtk_action_set_sensitive (action, can_cut);
1512 gtk_action_set_visible (action, !hide || can_cut);
1514 gtk_action_set_sensitive (action, can_paste);
1515 gtk_action_set_visible (action, !hide || can_paste);
1520 gnc_plugin_page_register_finish_pending (
GncPluginPage *page)
1525 GtkWidget *dialog, *window;
1529 reg_page = GNC_PLUGIN_PAGE_REGISTER(page);
1530 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(reg_page);
1531 reg = gnc_ledger_display_get_split_register(priv->ledger);
1536 name = gnc_plugin_page_register_get_tab_name(page);
1538 dialog = gtk_message_dialog_new(GTK_WINDOW(window),
1539 GTK_DIALOG_DESTROY_WITH_PARENT,
1540 GTK_MESSAGE_WARNING,
1544 _(
"Save changes to %s?"), name);
1545 gtk_message_dialog_format_secondary_text
1546 (GTK_MESSAGE_DIALOG(dialog),
1548 _(
"This register has pending changes to a transaction. "
1549 "Would you like to save the changes to this transaction, "
1550 "discard the transaction, or cancel the operation?"));
1551 gnc_gtk_dialog_add_button(dialog, _(
"_Discard Transaction"),
1552 GTK_STOCK_DELETE, GTK_RESPONSE_REJECT);
1553 gtk_dialog_add_button(GTK_DIALOG(dialog),
1554 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
1555 gnc_gtk_dialog_add_button(dialog, _(
"_Save Transaction"),
1556 GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT);
1558 response = gtk_dialog_run(GTK_DIALOG(dialog));
1559 gtk_widget_destroy(dialog);
1563 case GTK_RESPONSE_ACCEPT:
1567 case GTK_RESPONSE_REJECT:
1579 gnc_plugin_page_register_get_tab_name (
GncPluginPage *plugin_page)
1582 GNCLedgerDisplayType ledger_type;
1587 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), _(
"unknown"));
1589 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
1591 reg = gnc_ledger_display_get_split_register (ld);
1592 ledger_type = gnc_ledger_display_type (ld);
1593 leader = gnc_ledger_display_leader (ld);
1595 switch (ledger_type)
1606 case GENERAL_LEDGER:
1608 return g_strdup(_(
"General Ledger"));
1609 case PORTFOLIO_LEDGER:
1610 return g_strdup(_(
"Portfolio"));
1612 return g_strdup(_(
"Search Results"));
1622 return g_strdup(_(
"unknown"));
1626 gnc_plugin_page_register_get_tab_color (
GncPluginPage *plugin_page)
1629 GNCLedgerDisplayType ledger_type;
1634 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), _(
"unknown"));
1636 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
1638 ledger_type = gnc_ledger_display_type (ld);
1639 leader = gnc_ledger_display_leader (ld);
1642 if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
1645 return g_strdup(color ? color :
"Not Set");
1649 gnc_plugin_page_register_get_filter (
GncPluginPage *plugin_page)
1652 GNCLedgerDisplayType ledger_type;
1657 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), _(
"unknown"));
1659 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
1661 ledger_type = gnc_ledger_display_type (ld);
1662 leader = gnc_ledger_display_leader (ld);
1665 if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
1668 return filter ? g_strdup(filter) : g_strdup_printf(
"%s,%s,%s", DEFAULT_FILTER,
"0",
"0");
1672 gnc_plugin_page_register_set_filter (
GncPluginPage *plugin_page,
const gchar *filter )
1677 gchar *default_filter;
1679 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
1681 leader = gnc_ledger_display_leader (ld);
1685 default_filter = g_strdup_printf(
"%s,%s,%s", DEFAULT_FILTER,
"0",
"0");
1687 if (!filter || (g_strcmp0 (filter, default_filter) == 0))
1692 g_free (default_filter);
1699 gnc_plugin_page_register_get_sort_order (
GncPluginPage *plugin_page)
1702 GNCLedgerDisplayType ledger_type;
1705 const char* sort_order;
1707 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), _(
"unknown"));
1709 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
1711 ledger_type = gnc_ledger_display_type (ld);
1712 leader = gnc_ledger_display_leader (ld);
1715 if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
1718 return g_strdup(sort_order ? sort_order : DEFAULT_SORT_ORDER);
1722 gnc_plugin_page_register_set_sort_order (
GncPluginPage *plugin_page,
const gchar *sort_order )
1728 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
1730 leader = gnc_ledger_display_leader (ld);
1734 if (!sort_order || (g_strcmp0 (sort_order, DEFAULT_SORT_ORDER) == 0))
1744 gnc_plugin_page_register_get_long_name (
GncPluginPage *plugin_page)
1747 GNCLedgerDisplayType ledger_type;
1751 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), _(
"unknown"));
1753 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
1755 ledger_type = gnc_ledger_display_type (ld);
1756 leader = gnc_ledger_display_leader (ld);
1758 switch (ledger_type)
1766 gchar *return_string = g_strdup_printf(
"%s+", account_full_name);
1767 g_free ((gpointer *) account_full_name);
1768 return return_string;
1779 gnc_plugin_page_register_summarybar_position_changed (gpointer prefs, gchar* pref, gpointer user_data)
1784 GtkPositionType position = GTK_POS_BOTTOM;
1786 g_return_if_fail (user_data != NULL);
1788 if (!GNC_IS_PLUGIN_PAGE (user_data))
1791 plugin_page = GNC_PLUGIN_PAGE (user_data);
1792 page = GNC_PLUGIN_PAGE_REGISTER (user_data);
1793 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
1799 position = GTK_POS_TOP;
1801 gtk_box_reorder_child (GTK_BOX (priv->widget),
1803 (position == GTK_POS_TOP ? 0 : -1) );
1821 gnc_plugin_page_register_sort_book_option_changed (gpointer new_val,
1826 gboolean *new_data = (gboolean*)new_val;
1828 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
1830 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
1833 gtk_button_set_label(GTK_BUTTON (priv->sd.num_radio), _(
"Transaction Number"));
1834 gtk_button_set_label(GTK_BUTTON (priv->sd.act_radio), _(
"Number/Action"));
1838 gtk_button_set_label(GTK_BUTTON (priv->sd.num_radio), _(
"Number"));
1839 gtk_button_set_label(GTK_BUTTON (priv->sd.act_radio), _(
"Action"));
1841 gnc_split_reg_set_sort_type_force (priv->gsr, priv->gsr->sort_type, TRUE);
1865 g_return_if_fail(GTK_IS_DIALOG(dialog));
1866 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
1869 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
1870 plugin_page = GNC_PLUGIN_PAGE(page);
1872 if (response != GTK_RESPONSE_OK)
1875 gnc_split_reg_set_sort_type(priv->gsr, priv->sd.original_sort_type);
1876 priv->sd.save_order = priv->sd.original_save_order;
1880 priv->sd.original_save_order = priv->sd.save_order;
1882 if (priv->sd.save_order)
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);
1889 gnc_book_option_remove_cb(OPTION_NAME_NUM_FIELD_SOURCE,
1890 gnc_plugin_page_register_sort_book_option_changed,
1892 priv->sd.dialog = NULL;
1893 priv->sd.num_radio = NULL;
1894 priv->sd.act_radio = NULL;
1895 gtk_widget_destroy(GTK_WIDGET(dialog));
1916 g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));
1917 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
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);
1942 g_return_if_fail(GTK_IS_CHECK_BUTTON(button));
1943 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
1945 ENTER(
"Save toggle button (%p), plugin_page %p", button, page);
1948 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
1950 if (gtk_toggle_button_get_active(button))
1951 priv->sd.save_order = TRUE;
1953 priv->sd.save_order = FALSE;
1972 g_return_if_fail(GTK_IS_CHECK_BUTTON(button));
1973 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
1975 ENTER(
"Reverse toggle button (%p), plugin_page %p", button, page);
1978 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
1980 if (gtk_toggle_button_get_active(button))
1982 gnc_split_reg_set_sort_reversed(priv->gsr, FALSE);
1983 priv->sd.reverse_order = TRUE;
1987 gnc_split_reg_set_sort_reversed(priv->gsr, TRUE);
1988 priv->sd.reverse_order = FALSE;
2017 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2018 query = gnc_ledger_display_get_query( priv->ledger );
2021 LEAVE(
"no query found");
2026 param_list = qof_query_build_param_list (SPLIT_RECONCILE, NULL);
2030 g_slist_free(param_list);
2034 if (priv->fd.cleared_match != CLEARED_ALL)
2035 xaccQueryAddClearedMatch(query, priv->fd.cleared_match, QOF_QUERY_AND);
2037 gnc_ledger_display_refresh (priv->ledger);
2062 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2069 query = gnc_ledger_display_get_query( priv->ledger );
2077 param_list = qof_query_build_param_list(SPLIT_TRANS, TRANS_DATE_POSTED, NULL);
2081 g_slist_free(param_list);
2084 if (priv->fd.start_time || priv->fd.end_time)
2087 xaccQueryAddDateMatchTT(query,
2088 priv->fd.start_time != 0, priv->fd.start_time,
2089 priv->fd.end_time != 0, priv->fd.end_time,
2093 gnc_ledger_display_refresh (priv->ledger);
2100 gnc_plugin_page_register_filter_time2dmy (
time64 raw_time)
2102 struct tm * timeinfo;
2103 gchar date_string[11];
2106 strftime (date_string, 11,
"%d-%m-%Y", timeinfo);
2107 PINFO(
"Date string is %s", date_string);
2110 return g_strdup(date_string);
2116 gnc_plugin_page_register_filter_dmy2time (
char *date_string)
2120 PINFO(
"Date string is %s", date_string);
2121 memset (&when, 0,
sizeof (when));
2123 sscanf (date_string,
"%d-%d-%d", &when.tm_mday,
2124 &when.tm_mon, &when.tm_year);
2127 when.tm_year -= 1900;
2151 g_return_if_fail(GTK_IS_CHECK_BUTTON(button));
2152 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2154 name = gtk_buildable_get_name(GTK_BUILDABLE(button));
2155 ENTER(
"toggle button %s (%p), plugin_page %p", name, button, page);
2158 value = CLEARED_NONE;
2159 for (i = 0; status_actions[i].action_name; i++)
2161 if (g_strcmp0(name, status_actions[i].action_name) == 0)
2163 value = status_actions[i].value;
2169 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2170 if (gtk_toggle_button_get_active(button))
2171 priv->fd.cleared_match |= value;
2173 priv->fd.cleared_match &= ~value;
2174 gnc_ppr_update_status_query(page);
2196 g_return_if_fail(GTK_IS_BUTTON(button));
2197 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2199 ENTER(
"(button %p, page %p)", button, page);
2202 for (i = 0; status_actions[i].action_name; i++)
2204 widget = status_actions[i].widget;
2206 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widget), TRUE);
2211 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2212 priv->fd.cleared_match = CLEARED_ALL;
2213 gnc_ppr_update_status_query(page);
2235 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2236 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_choose)))
2238 time_val = gnc_date_edit_get_date(GNC_DATE_EDIT(priv->fd.start_date));
2240 priv->fd.start_time = time_val;
2244 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_today)))
2250 priv->fd.start_time = 0;
2254 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.end_date_choose)))
2256 time_val = gnc_date_edit_get_date(GNC_DATE_EDIT(priv->fd.end_date));
2258 priv->fd.end_time = time_val;
2262 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_today)))
2268 priv->fd.end_time = 0;
2296 g_return_if_fail(GTK_IS_RADIO_BUTTON(button));
2297 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
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);
2305 get_filter_times(page);
2309 priv->fd.start_time = 0;
2310 priv->fd.end_time = 0;
2312 gnc_ppr_update_date_query(page);
2328 gnc_plugin_page_register_filter_gde_changed_cb (GtkWidget *unused,
2331 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2333 ENTER(
"(widget %s(%p), page %p)", gtk_buildable_get_name(GTK_BUILDABLE(unused)), unused, page);
2334 get_filter_times(page);
2335 gnc_ppr_update_date_query(page);
2367 g_return_if_fail(GTK_IS_RADIO_BUTTON(radio));
2368 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
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)))
2374 LEAVE(
"1st callback of pair. Defer to 2nd callback.");
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);
2414 g_return_if_fail(GTK_IS_RADIO_BUTTON(radio));
2415 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
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)))
2421 LEAVE(
"1st callback of pair. Defer to 2nd callback.");
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);
2448 g_return_if_fail(GTK_IS_CHECK_BUTTON(button));
2449 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2451 ENTER(
"Save toggle button (%p), plugin_page %p", button, page);
2454 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2455 if (gtk_toggle_button_get_active(button))
2456 priv->fd.save_filter = TRUE;
2458 priv->fd.save_filter = FALSE;
2482 g_return_if_fail(GTK_IS_DIALOG(dialog));
2483 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2486 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2487 plugin_page = GNC_PLUGIN_PAGE(page);
2489 if (response != GTK_RESPONSE_OK)
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);
2501 priv->fd.original_save_filter = priv->fd.save_filter;
2503 if (priv->fd.save_filter)
2506 filter = g_strdup_printf(
"0x%04x", priv->fd.cleared_match);
2508 if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_choose)) && priv->fd.start_time != 0 )
2510 gchar *
timeval = gnc_plugin_page_register_filter_time2dmy(priv->fd.start_time);
2511 filter = g_strconcat ( filter,
",", timeval, NULL);
2515 filter = g_strconcat ( filter,
",0", NULL);
2517 if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.end_date_choose)) && priv->fd.end_time != 0 )
2519 gchar *
timeval = gnc_plugin_page_register_filter_time2dmy(priv->fd.end_time);
2520 filter = g_strconcat ( filter,
",", timeval, NULL);
2524 filter = g_strconcat ( filter,
",0", NULL);
2526 PINFO(
"The filter to save is %s", filter);
2528 gnc_plugin_page_register_set_filter (plugin_page, filter);
2532 priv->fd.dialog = NULL;
2533 gtk_widget_destroy(GTK_WIDGET(dialog));
2547 gchar *account_name;
2550 GNCLedgerDisplayType ledger_type;
2555 reg = gnc_ledger_display_get_split_register (ledger);
2556 ledger_type = gnc_ledger_display_type (ledger);
2560 case GENERAL_LEDGER:
2563 reg_name = _(
"General Ledger");
2565 reg_name = _(
"Transaction Report");
2567 case PORTFOLIO_LEDGER:
2569 reg_name = _(
"Portfolio");
2571 reg_name = _(
"Portfolio Report");
2575 reg_name = _(
"Search Results");
2577 reg_name = _(
"Search Results Report");
2581 reg_name = _(
"Register");
2583 reg_name = _(
"Transaction Report");
2587 leader = gnc_ledger_display_leader (ledger);
2589 if ((leader != NULL) && (ledger_type != LD_GL))
2593 if (ledger_type == LD_SINGLE)
2595 name = g_strconcat (account_name,
" - ", reg_name, NULL);
2599 name = g_strconcat (account_name,
" ", _(
"and subaccounts"),
" - ", reg_name, NULL);
2601 g_free(account_name);
2604 name = g_strdup (reg_name);
2612 SplitRegister *reg = gnc_ledger_display_get_split_register (ledger);
2616 swig_type_info * qtype;
2623 func = scm_c_eval_string (
"gnc:register-report-create");
2624 g_return_val_if_fail (scm_is_procedure (func), -1);
2627 arg = scm_from_utf8_string (tmp ? tmp : _(
"Credit"));
2628 args = scm_cons (arg, args);
2631 arg = scm_from_utf8_string (tmp ? tmp : _(
"Debit"));
2632 args = scm_cons (arg, args);
2634 str = gnc_reg_get_name (ledger, FALSE);
2635 arg = scm_from_utf8_string (str ? str :
"");
2636 args = scm_cons (arg, args);
2640 args = scm_cons (arg, args);
2642 arg = SCM_BOOL (reg->type == GENERAL_LEDGER || reg->type == INCOME_LEDGER
2643 || reg->type == SEARCH_LEDGER);
2644 args = scm_cons (arg, args);
2646 arg = SCM_BOOL (reg->style == REG_STYLE_JOURNAL);
2647 args = scm_cons (arg, args);
2651 query = gnc_ledger_display_get_query (ledger);
2652 g_return_val_if_fail (query != NULL, -1);
2655 qtype = SWIG_TypeQuery (
"_p__QofQuery");
2656 g_return_val_if_fail (qtype, -1);
2658 arg = SWIG_NewPointerObj (query, qtype, 0);
2659 args = scm_cons (arg, args);
2660 g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
2665 qtype = SWIG_TypeQuery (
"_p_Split");
2666 g_return_val_if_fail (qtype, -1);
2667 arg = SWIG_NewPointerObj (split, qtype, 0);
2673 args = scm_cons (arg, args);
2674 g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
2677 qtype = SWIG_TypeQuery (
"_p_Account");
2678 g_return_val_if_fail (qtype, -1);
2680 account = gnc_ledger_display_leader (ledger);
2681 arg = SWIG_NewPointerObj (account, qtype, 0);
2682 args = scm_cons (arg, args);
2683 g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
2687 arg = scm_apply (func, args, SCM_EOL);
2688 g_return_val_if_fail (scm_is_exact (arg), -1);
2690 return scm_to_int (arg);
2698 gnc_plugin_page_register_cmd_print_check (GtkAction *action,
2705 GList * splits = NULL, *item;
2706 GNCLedgerDisplayType ledger_type;
2709 ENTER(
"(action %p, plugin_page %p)", action, plugin_page);
2711 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
2713 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
2714 reg = gnc_ledger_display_get_split_register (priv->ledger);
2715 ledger_type = gnc_ledger_display_type(priv->ledger);
2716 if (ledger_type == LD_SINGLE || ledger_type == LD_SUBACCOUNT)
2726 splits = g_list_append(splits, split);
2727 gnc_ui_print_check_dialog_create(plugin_page, splits);
2728 g_list_free(splits);
2737 splits = g_list_append(splits, split);
2738 gnc_ui_print_check_dialog_create(plugin_page, splits);
2739 g_list_free(splits);
2744 else if (ledger_type == LD_GL && reg->type == SEARCH_LEDGER)
2747 splits =
qof_query_run(gnc_ledger_display_get_query(priv->ledger));
2749 for (item = splits; item; item = g_list_next(item))
2751 split = (
Split *) item->data;
2752 if (common_acct == NULL)
2760 GtkWidget *dialog, *window;
2762 const gchar *title = _(
"Print checks from multiple accounts?");
2763 const gchar *message =
2764 _(
"This search result contains splits from more than one account. "
2765 "Do you want to print the checks even though they are not all "
2766 "from the same account?");
2768 dialog = gtk_message_dialog_new(GTK_WINDOW(window),
2769 GTK_DIALOG_DESTROY_WITH_PARENT,
2770 GTK_MESSAGE_WARNING,
2773 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
2775 gtk_dialog_add_button(GTK_DIALOG(dialog), _(
"_Print checks"),
2777 response = gnc_dialog_run(GTK_DIALOG(dialog),
2778 GNC_PREF_WARN_CHECKPRINTING_MULTI_ACCT);
2779 gtk_widget_destroy(dialog);
2780 if (response != GTK_RESPONSE_YES)
2782 LEAVE(
"Multiple accounts");
2789 gnc_ui_print_check_dialog_create(plugin_page, splits);
2794 _(
"You can only print checks from a bank account register or search results."));
2795 LEAVE(
"Unsupported ledger type");
2803 gnc_plugin_page_register_cmd_cut (GtkAction *action,
2808 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2810 ENTER(
"(action %p, page %p)", action, page);
2811 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2812 gnucash_register_cut_clipboard(priv->gsr->
reg);
2818 gnc_plugin_page_register_cmd_copy (GtkAction *action,
2823 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2825 ENTER(
"(action %p, page %p)", action, page);
2826 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2827 gnucash_register_copy_clipboard(priv->gsr->
reg);
2833 gnc_plugin_page_register_cmd_paste (GtkAction *action,
2838 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2840 ENTER(
"(action %p, page %p)", action, page);
2841 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2842 gnucash_register_paste_clipboard(priv->gsr->
reg);
2848 gnc_plugin_page_register_cmd_edit_account (GtkAction *action,
2853 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2855 ENTER(
"(action %p, page %p)", action, page);
2864 gnc_plugin_page_register_cmd_find_transactions (GtkAction *action,
2869 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2871 ENTER(
"(action %p, page %p)", action, page);
2872 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2873 gnc_ui_find_transactions_dialog_create(priv->ledger);
2879 gnc_plugin_page_register_cmd_cut_transaction (GtkAction *action,
2885 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2887 ENTER(
"(action %p, page %p)", action, page);
2888 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2889 reg = gnc_ledger_display_get_split_register(priv->ledger);
2896 gnc_plugin_page_register_cmd_copy_transaction (GtkAction *action,
2902 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2904 ENTER(
"(action %p, page %p)", action, page);
2905 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2906 reg = gnc_ledger_display_get_split_register(priv->ledger);
2913 gnc_plugin_page_register_cmd_paste_transaction (GtkAction *action,
2919 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2921 ENTER(
"(action %p, page %p)", action, page);
2922 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2923 reg = gnc_ledger_display_get_split_register(priv->ledger);
2930 gnc_plugin_page_register_cmd_void_transaction (GtkAction *action,
2934 GtkWidget *dialog, *entry;
2937 GtkBuilder *builder;
2941 ENTER(
"(action %p, page %p)", action, page);
2943 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2945 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2946 reg = gnc_ledger_display_get_split_register(priv->ledger);
2954 gnc_error_dialog(NULL,
"%s", _(
"You cannot void a transaction with reconciled or cleared splits."));
2958 if (!gnc_plugin_page_register_finish_pending(GNC_PLUGIN_PAGE(page)))
2961 builder = gtk_builder_new();
2962 gnc_builder_add_from_file (builder ,
"gnc-plugin-page-register.glade",
"Void Transaction");
2963 dialog = GTK_WIDGET(gtk_builder_get_object (builder,
"Void Transaction"));
2964 entry = GTK_WIDGET(gtk_builder_get_object (builder,
"reason"));
2966 result = gtk_dialog_run(GTK_DIALOG(dialog));
2967 if (result == GTK_RESPONSE_OK)
2969 reason = gtk_entry_get_text(GTK_ENTRY(entry));
2976 gtk_widget_destroy(dialog);
2977 g_object_unref(G_OBJECT(builder));
2982 gnc_plugin_page_register_cmd_unvoid_transaction (GtkAction *action,
2989 ENTER(
"(action %p, page %p)", action, page);
2991 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
2993 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
2994 reg = gnc_ledger_display_get_split_register(priv->ledger);
3004 gnc_plugin_page_register_cmd_reverse_transaction (GtkAction *action,
3012 ENTER(
"(action %p, page %p)", action, page);
3014 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
3016 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
3017 reg = gnc_ledger_display_get_split_register(priv->ledger);
3025 _(
"A reversing entry has already been created for this transaction."));
3045 gnc_plugin_page_register_cmd_view_sort_by (GtkAction *action,
3050 GtkWidget *dialog, *button;
3051 GtkBuilder *builder;
3056 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
3057 ENTER(
"(action %p, page %p)", action, page);
3059 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
3060 if (priv->sd.dialog)
3062 gtk_window_present(GTK_WINDOW(priv->sd.dialog));
3063 LEAVE(
"existing dialog");
3069 builder = gtk_builder_new();
3070 gnc_builder_add_from_file (builder,
"gnc-plugin-page-register.glade",
"Sort By");
3071 dialog = GTK_WIDGET(gtk_builder_get_object (builder,
"Sort By"));
3072 priv->sd.dialog = dialog;
3073 gtk_window_set_transient_for(GTK_WINDOW(dialog),
3074 gnc_window_get_gtk_window(GNC_WINDOW(GNC_PLUGIN_PAGE(page)->window)));
3076 title = g_strdup_printf(_(
"Sort %s by..."),
3078 gtk_window_set_title(GTK_WINDOW(dialog), title);
3082 sort = gnc_split_reg_get_sort_type(priv->gsr);
3083 name = SortTypeasString(sort);
3084 button = GTK_WIDGET(gtk_builder_get_object (builder, name));
3085 DEBUG(
"current sort %d, button %s(%p)", sort, name, button);
3086 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
3087 priv->sd.original_sort_type = sort;
3089 button = GTK_WIDGET(gtk_builder_get_object (builder,
"sort_save"));
3090 if (priv->sd.save_order == TRUE)
3091 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
3094 button = GTK_WIDGET(gtk_builder_get_object (builder,
"sort_reverse"));
3095 if(priv->sd.reverse_order == TRUE)
3096 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
3098 priv->sd.num_radio = GTK_WIDGET(gtk_builder_get_object (builder,
"BY_NUM"));
3099 priv->sd.act_radio = GTK_WIDGET(gtk_builder_get_object (builder,
"BY_ACTION"));
3101 reg = gnc_ledger_display_get_split_register(priv->ledger);
3104 gtk_button_set_label(GTK_BUTTON (priv->sd.num_radio), _(
"Transaction Number"));
3105 gtk_button_set_label(GTK_BUTTON (priv->sd.act_radio), _(
"Number/Action"));
3107 gnc_book_option_register_cb(OPTION_NAME_NUM_FIELD_SOURCE,
3108 gnc_plugin_page_register_sort_book_option_changed,
3112 gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, page);
3115 gtk_widget_show(dialog);
3116 g_object_unref(G_OBJECT(builder));
3121 gnc_plugin_page_register_cmd_view_filter_by (GtkAction *action,
3125 GtkWidget *dialog, *toggle, *button, *
table, *hbox;
3126 time64 start_time, end_time, time_val;
3127 GtkBuilder *builder;
3128 gboolean sensitive, value;
3133 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
3134 ENTER(
"(action %p, page %p)", action, page);
3136 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
3137 if (priv->fd.dialog)
3139 gtk_window_present(GTK_WINDOW(priv->fd.dialog));
3140 LEAVE(
"existing dialog");
3145 builder = gtk_builder_new();
3146 gnc_builder_add_from_file (builder,
"gnc-plugin-page-register.glade",
"Filter By");
3147 dialog = GTK_WIDGET(gtk_builder_get_object (builder,
"Filter By"));
3148 priv->fd.dialog = dialog;
3149 gtk_window_set_transient_for(GTK_WINDOW(dialog),
3150 gnc_window_get_gtk_window(GNC_WINDOW(GNC_PLUGIN_PAGE(page)->window)));
3153 title = g_strdup_printf(_(
"Filter %s by..."),
3155 gtk_window_set_title(GTK_WINDOW(dialog), title);
3159 for (i = 0; status_actions[i].action_name; i++)
3161 toggle = GTK_WIDGET(gtk_builder_get_object (builder, status_actions[i].action_name));
3162 value = priv->fd.cleared_match & status_actions[i].value;
3163 status_actions[i].widget = toggle;
3164 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), value);
3166 priv->fd.original_cleared_match = priv->fd.cleared_match;
3168 button = GTK_WIDGET(gtk_builder_get_object (builder,
"filter_save"));
3169 if (priv->fd.save_filter == TRUE)
3170 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
3174 button = GTK_WIDGET(gtk_builder_get_object (builder,
"filter_show_range"));
3175 query = gnc_ledger_display_get_query (priv->ledger);
3176 xaccQueryGetDateMatchTT(query, &start_time, &end_time);
3177 priv->fd.original_start_time = start_time;
3178 priv->fd.start_time = start_time;
3179 priv->fd.original_end_time = end_time;
3180 priv->fd.end_time = end_time;
3182 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), start_time || end_time);
3183 table = GTK_WIDGET(gtk_builder_get_object (builder,
"select_range_table"));
3184 priv->fd.table = table;
3185 gtk_widget_set_sensitive(GTK_WIDGET(table), start_time || end_time);
3187 priv->fd.start_date_choose = GTK_WIDGET(gtk_builder_get_object (builder,
"start_date_choose"));
3188 priv->fd.start_date_today = GTK_WIDGET(gtk_builder_get_object (builder,
"start_date_today"));
3189 priv->fd.end_date_choose = GTK_WIDGET(gtk_builder_get_object (builder,
"end_date_choose"));
3190 priv->fd.end_date_today = GTK_WIDGET(gtk_builder_get_object (builder,
"end_date_today"));
3194 if (start_time == 0)
3196 button = GTK_WIDGET(gtk_builder_get_object (builder,
"start_date_earliest"));
3197 time_val = xaccQueryGetEarliestDateFound (query);
3202 time_val = start_time;
3206 button = priv->fd.start_date_today;
3211 button = priv->fd.start_date_choose;
3215 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
3216 priv->fd.start_date = gnc_date_edit_new (
gnc_time (NULL), FALSE, FALSE);
3217 hbox = GTK_WIDGET(gtk_builder_get_object (builder,
"start_date_hbox"));
3218 gtk_box_pack_start (GTK_BOX (hbox), priv->fd.start_date, TRUE, TRUE, 0);
3219 gtk_widget_show (priv->fd.start_date);
3220 gtk_widget_set_sensitive(GTK_WIDGET(priv->fd.start_date), sensitive);
3221 gnc_date_edit_set_time (GNC_DATE_EDIT(priv->fd.start_date), time_val);
3222 g_signal_connect (G_OBJECT (priv->fd.start_date),
"date-changed",
3223 G_CALLBACK (gnc_plugin_page_register_filter_gde_changed_cb),
3231 button = GTK_WIDGET(gtk_builder_get_object (builder,
"end_date_latest"));
3232 time_val = xaccQueryGetLatestDateFound (query);
3237 time_val = end_time;
3241 button = priv->fd.end_date_today;
3246 button = priv->fd.end_date_choose;
3250 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
3251 priv->fd.end_date = gnc_date_edit_new (
gnc_time (NULL), FALSE, FALSE);
3252 hbox = GTK_WIDGET(gtk_builder_get_object (builder,
"end_date_hbox"));
3253 gtk_box_pack_start (GTK_BOX (hbox), priv->fd.end_date, TRUE, TRUE, 0);
3254 gtk_widget_show (priv->fd.end_date);
3255 gtk_widget_set_sensitive(GTK_WIDGET(priv->fd.end_date), sensitive);
3256 gnc_date_edit_set_time (GNC_DATE_EDIT(priv->fd.end_date), time_val);
3257 g_signal_connect (G_OBJECT (priv->fd.end_date),
"date-changed",
3258 G_CALLBACK (gnc_plugin_page_register_filter_gde_changed_cb),
3263 gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, page);
3266 gtk_widget_show_all(dialog);
3267 g_object_unref(G_OBJECT(builder));
3272 gnc_plugin_page_register_cmd_style_changed (GtkAction *action,
3273 GtkRadioAction *current,
3279 ENTER(
"(action %p, radio action %p, plugin_page %p)",
3280 action, current, plugin_page);
3282 g_return_if_fail(GTK_IS_ACTION(action));
3283 g_return_if_fail(GTK_IS_RADIO_ACTION(current));
3284 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
3286 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
3287 value = gtk_radio_action_get_current_value(current);
3288 gnc_split_reg_change_style(priv->gsr, value);
3290 gnc_plugin_page_register_ui_update (NULL, plugin_page);
3295 gnc_plugin_page_register_cmd_style_double_line (GtkToggleAction *action,
3300 gboolean use_double_line;
3302 ENTER(
"(action %p, plugin_page %p)", action, plugin_page);
3304 g_return_if_fail(GTK_IS_ACTION(action));
3305 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
3307 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
3308 reg = gnc_ledger_display_get_split_register (priv->ledger);
3310 use_double_line = gtk_toggle_action_get_active (action);
3314 gnc_ledger_display_refresh(priv->ledger);
3320 gnc_plugin_page_register_cmd_transfer (GtkAction *action,
3324 GncWindow *gnc_window;
3327 ENTER(
"(action %p, plugin_page %p)", action, page);
3329 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
3332 gnc_window = GNC_WINDOW(GNC_PLUGIN_PAGE (page)->window);
3333 window = GTK_WIDGET(gnc_window_get_gtk_window(gnc_window));
3334 gnc_xfer_dialog (window, account);
3339 gnc_plugin_page_register_cmd_reconcile (GtkAction *action,
3346 ENTER(
"(action %p, plugin_page %p)", action, page);
3348 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
3352 window = gnc_window_get_gtk_window(GNC_WINDOW(GNC_PLUGIN_PAGE (page)->window));
3353 recnData = recnWindow (GTK_WIDGET(window), account);
3354 gnc_ui_reconcile_window_raise (recnData);
3359 gnc_plugin_page_register_cmd_autoclear (GtkAction *action,
3366 ENTER(
"(action %p, plugin_page %p)", action, page);
3368 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
3372 window = gnc_window_get_gtk_window(GNC_WINDOW(GNC_PLUGIN_PAGE (page)->window));
3373 autoClearData = autoClearWindow (GTK_WIDGET(window), account);
3374 gnc_ui_autoclear_window_raise (autoClearData);
3379 gnc_plugin_page_register_cmd_stock_split (GtkAction *action,
3384 ENTER(
"(action %p, plugin_page %p)", action, page);
3386 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
3389 gnc_stock_split_dialog (NULL, account);
3394 gnc_plugin_page_register_cmd_lots (GtkAction *action,
3399 ENTER(
"(action %p, plugin_page %p)", action, page);
3401 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
3404 gnc_lot_viewer_dialog (account);
3409 gnc_plugin_page_register_cmd_enter_transaction (GtkAction *action,
3414 ENTER(
"(action %p, plugin_page %p)", action, plugin_page);
3416 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
3418 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
3419 gnc_split_reg_enter(priv->gsr, FALSE);
3424 gnc_plugin_page_register_cmd_cancel_transaction (GtkAction *action,
3429 ENTER(
"(action %p, plugin_page %p)", action, plugin_page);
3431 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
3433 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
3435 (gnc_ledger_display_get_split_register(priv->ledger));
3440 gnc_plugin_page_register_cmd_delete_transaction (GtkAction *action,
3445 ENTER(
"(action %p, plugin_page %p)", action, plugin_page);
3447 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
3449 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
3450 gsr_default_delete_handler(priv->gsr, NULL);
3456 gnc_plugin_page_register_cmd_associate_file_transaction (GtkAction *action,
3461 ENTER(
"(action %p, plugin_page %p)", action, plugin_page);
3463 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
3465 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
3466 gsr_default_associate_handler_file(priv->gsr, NULL);
3467 gnc_plugin_page_register_ui_update (NULL, plugin_page);
3473 gnc_plugin_page_register_cmd_associate_location_transaction (GtkAction *action,
3478 ENTER(
"(action %p, plugin_page %p)", action, plugin_page);
3480 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
3482 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
3483 gsr_default_associate_handler_location(priv->gsr, NULL);
3484 gnc_plugin_page_register_ui_update (NULL, plugin_page);
3490 gnc_plugin_page_register_cmd_execassociated_transaction (GtkAction *action,
3495 ENTER(
"(action %p, plugin_page %p)", action, plugin_page);
3497 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
3499 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
3500 gsr_default_execassociated_handler(priv->gsr, NULL);
3506 gnc_plugin_page_register_cmd_blank_transaction (GtkAction *action,
3512 ENTER(
"(action %p, plugin_page %p)", action, plugin_page);
3514 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
3516 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
3517 reg = gnc_ledger_display_get_split_register (priv->ledger);
3522 gnc_split_reg_jump_to_blank (priv->gsr);
3527 gnc_plugin_page_register_cmd_duplicate_transaction (GtkAction *action,
3532 ENTER(
"(action %p, plugin_page %p)", action, plugin_page);
3534 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
3536 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
3538 (gnc_ledger_display_get_split_register(priv->ledger));
3543 gnc_plugin_page_register_cmd_reinitialize_transaction (GtkAction *action,
3548 ENTER(
"(action %p, plugin_page %p)", action, plugin_page);
3550 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
3552 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
3553 gsr_default_reinit_handler(priv->gsr, NULL);
3558 gnc_plugin_page_register_cmd_expand_transaction (GtkToggleAction *action,
3565 ENTER(
"(action %p, plugin_page %p)", action, plugin_page);
3567 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
3569 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
3570 reg = gnc_ledger_display_get_split_register (priv->ledger);
3571 expand = gtk_toggle_action_get_active (action);
3577 gnc_plugin_page_register_cmd_exchange_rate (GtkAction *action,
3583 ENTER(
"(action %p, plugin_page %p)", action, plugin_page);
3585 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
3587 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
3588 reg = gnc_ledger_display_get_split_register (priv->ledger);
3596 gnc_plugin_page_register_cmd_jump (GtkAction *action,
3608 ENTER(
"(action %p, plugin_page %p)", action, plugin_page);
3610 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
3612 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
3613 window = GNC_PLUGIN_PAGE (plugin_page)->window;
3620 reg = gnc_ledger_display_get_split_register (priv->ledger);
3624 LEAVE(
"no split (1)");
3629 if (account == NULL)
3631 LEAVE(
"no account");
3635 leader = gnc_ledger_display_leader (priv->ledger);
3636 if (account == leader)
3641 LEAVE(
"no split (2)");
3646 if (account == NULL)
3648 LEAVE(
"no account (2)");
3652 if (account == leader)
3654 LEAVE(
"register open for account");
3660 if (new_page == NULL)
3662 LEAVE(
"couldn't create new page");
3668 gnc_split_reg_jump_to_split(gsr, split);
3673 gnc_plugin_page_register_cmd_schedule (GtkAction *action,
3678 ENTER(
"(action %p, plugin_page %p)", action, plugin_page);
3680 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
3682 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
3683 gsr_default_schedule_handler(priv->gsr, NULL);
3688 gnc_plugin_page_register_cmd_scrub_current (GtkAction *action,
3699 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
3701 ENTER(
"(action %p, plugin_page %p)", action, plugin_page);
3703 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
3704 query = gnc_ledger_display_get_query( priv->ledger );
3707 LEAVE(
"no query found");
3711 reg = gnc_ledger_display_get_split_register(priv->ledger);
3715 LEAVE(
"no trans found");
3719 gnc_suspend_gui_refresh();
3720 root = gnc_get_current_root_account();
3728 gnc_resume_gui_refresh();
3733 gnc_plugin_page_register_cmd_scrub_all (GtkAction *action,
3744 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
3746 ENTER(
"(action %p, plugin_page %p)", action, plugin_page);
3748 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
3749 query = gnc_ledger_display_get_query( priv->ledger );
3752 LEAVE(
"no query found");
3756 gnc_suspend_gui_refresh();
3757 root = gnc_get_current_root_account();
3772 gnc_resume_gui_refresh();
3777 gnc_plugin_page_register_cmd_account_report (GtkAction *action,
3784 ENTER(
"(action %p, plugin_page %p)", action, plugin_page);
3786 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
3788 window = GNC_MAIN_WINDOW(GNC_PLUGIN_PAGE(plugin_page)->window);
3789 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
3790 id = report_helper (priv->ledger, NULL, NULL);
3792 gnc_main_window_open_report(
id, window);
3797 gnc_plugin_page_register_cmd_transaction_report (GtkAction *action,
3808 ENTER(
"(action %p, plugin_page %p)", action, plugin_page);
3810 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
3812 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
3813 reg = gnc_ledger_display_get_split_register (priv->ledger);
3819 query = qof_query_create_for(GNC_ID_SPLIT);
3824 GNC_ID_SPLIT, QOF_QUERY_AND);
3826 window = GNC_MAIN_WINDOW(GNC_PLUGIN_PAGE(plugin_page)->window);
3827 id = report_helper (priv->ledger, split, query);
3829 gnc_main_window_open_report(
id, window);
3845 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
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;
3859 g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page), NULL);
3861 page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
3862 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
3875 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(register_page));
3877 window = GNC_WINDOW(GNC_PLUGIN_PAGE(register_page)->window);
3886 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(register_page);
3887 reg = gnc_ledger_display_get_split_register(priv->ledger);
3888 help = gnc_table_get_help(reg->
table);
3889 gnc_window_set_status(window, GNC_PLUGIN_PAGE(register_page), help);
3894 gnc_plugin_page_register_refresh_cb (GHashTable *changes, gpointer user_data)
3899 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
3900 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
3905 ei = gnc_gui_get_entity_events(changes, &priv->key);
3908 if (ei->event_mask & QOF_EVENT_DESTROY)
3913 if (ei->event_mask & QOF_EVENT_MODIFY)
3921 gnucash_register_refresh_from_prefs(priv->gsr->
reg);
3922 gtk_widget_queue_draw(priv->widget);
3925 gnc_plugin_page_register_ui_update(NULL, page);
3929 gnc_plugin_page_register_close_cb (gpointer user_data)
3944 gppr_account_destroy_cb (
Account *account)
3948 GNCLedgerDisplayType ledger_type;
3951 GList *item, *kill = NULL;
3958 for ( ; citem; citem = g_list_next(citem))
3961 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
3962 ledger_type = gnc_ledger_display_type (priv->ledger);
3963 if (ledger_type == LD_GL)
3965 kill = g_list_append(kill, page);
3968 else if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
3970 if (guid_compare(acct_guid, &priv->key) == 0)
3972 kill = g_list_append(kill, page);
3978 for (item = kill; item; item = g_list_next(item))
4000 gnc_plugin_page_register_event_handler (
QofInstance *entity,
4009 gchar *label, *color;
4011 g_return_if_fail(page);
4012 if (!GNC_IS_TRANS(entity) && !GNC_IS_ACCOUNT(entity))
4015 ENTER(
"entity %p of type %d, page %p, event data %p",
4016 entity, event_type, page, ed);
4020 if (GNC_IS_ACCOUNT(entity))
4022 if (GNC_IS_MAIN_WINDOW(window))
4024 label = gnc_plugin_page_register_get_tab_name(GNC_PLUGIN_PAGE(page));
4026 color = gnc_plugin_page_register_get_tab_color(GNC_PLUGIN_PAGE(page));
4031 LEAVE(
"tab name updated");
4035 if (!(event_type & (QOF_EVENT_MODIFY | QOF_EVENT_DESTROY)))
4037 LEAVE(
"not a modify");
4040 trans = GNC_TRANS(entity);
4044 LEAVE(
"not in this book");
4048 if (GNC_IS_MAIN_WINDOW(window))
4051 if (visible_page != GNC_PLUGIN_PAGE(page))
4053 LEAVE(
"page not visible");
4058 gnc_plugin_page_register_ui_update(NULL, page);
GncPluginPage * gnc_plugin_page_register_new(Account *account, gboolean subaccounts)
void xaccAccountSetFilter(Account *acc, const char *str)
void xaccAccountSetSortOrder(Account *acc, const char *str)
Transaction * gnc_split_register_get_current_trans(SplitRegister *reg)
const char * gnc_split_register_get_debit_string(SplitRegister *reg)
void gnc_split_register_void_current_trans(SplitRegister *reg, const char *reason)
GtkWidget * gnc_plugin_page_get_window(GncPluginPage *page)
gboolean xaccTransHasReconciledSplits(const Transaction *trans)
time64 gnc_time64_get_today_start(void)
void xaccTransSetDatePostedSecsNormalized(Transaction *trans, time64 time)
void gnc_plugin_page_register_filter_save_cb(GtkToggleButton *button, GncPluginPageRegister *page)
Split * xaccTransGetSplit(const Transaction *trans, int i)
const GList * gnc_gobject_tracking_get_list(const gchar *name)
GncPluginPage *(* recreate_page)(GtkWidget *window, GKeyFile *file, const gchar *group)
Date and Time handling routines.
gulong gnc_prefs_register_cb(const char *group, const gchar *pref_name, gpointer func, gpointer user_data)
Dialog for create/edit an account.
QofBook * qof_instance_get_book(gconstpointer)
void(* update_edit_menu_actions)(GncPluginPage *plugin_page, gboolean hide)
time64 gnc_time64_get_today_end(void)
utility functions for the GnuCash UI
void gnc_split_register_copy_current(SplitRegister *reg)
The type, style and table for the register.
#define PINFO(format, args...)
const char * xaccAccountGetFilter(const Account *acc)
void qof_query_purge_terms(QofQuery *q, QofQueryParamList *param_list)
GNCAccountType xaccAccountGetType(const Account *acc)
gboolean use_tran_num_for_num_field
const char * xaccTransGetAssociation(const Transaction *trans)
void gnc_split_register_unvoid_current_trans(SplitRegister *reg)
Split * gnc_split_register_get_current_split(SplitRegister *reg)
#define DEBUG(format, args...)
const gchar * gnc_plugin_page_get_page_name(GncPluginPage *page)
Functions that are supported by all types of windows.
void(* QofEventHandler)(QofInstance *ent, QofEventId event_type, gpointer handler_data, gpointer event_data)
Handler invoked when an event is generated.
Split * gnc_split_register_get_current_trans_split(SplitRegister *reg, VirtualCellLocation *trans_split_loc)
gboolean gnc_split_register_changed(SplitRegister *reg)
void gnc_plugin_page_set_page_long_name(GncPluginPage *page, const char *name)
Transaction * xaccSplitGetParent(const Split *split)
void gnc_split_register_expand_current_trans(SplitRegister *reg, gboolean expand)
gboolean gnc_split_register_save(SplitRegister *reg, gboolean do_commit)
GtkActionGroup * gnc_plugin_page_get_action_group(GncPluginPage *page)
#define ENTER(format, args...)
Cleanup functions for business objects.
struct _QofQuery QofQuery
void gnc_plugin_page_register_filter_status_all_cb(GtkButton *button, GncPluginPageRegister *plugin_page)
GType gnc_plugin_page_register_get_type(void)
GncPluginPage * gnc_main_window_get_current_page(GncMainWindow *window)
void gnc_main_window_open_page(GncMainWindow *window, GncPluginPage *page)
void gnc_ui_edit_account_window(Account *account)
Functions for adding content to a window.
GncPluginPage * gnc_plugin_page_register_new_ledger(GNCLedgerDisplay *ledger)
gboolean(* finish_pending)(GncPluginPage *plugin_page)
gint qof_event_register_handler(QofEventHandler handler, gpointer handler_data)
Register a handler for events.
void gnc_tm_free(struct tm *time)
free a struct tm* created with gnc_localtime() or gnc_gmtime()
const char * xaccAccountGetColor(const Account *acc)
void gnc_split_register_redraw(SplitRegister *reg)
void gnc_plugin_page_register_filter_select_range_cb(GtkRadioButton *button, GncPluginPageRegister *page)
#define xaccAccountGetGUID(X)
void gnc_plugin_page_register_sort_button_cb(GtkToggleButton *button, GncPluginPageRegister *page)
convert single-entry accounts to clean double-entry
gboolean xaccTransHasSplitsInState(const Transaction *trans, const char state)
QofBook * qof_session_get_book(const QofSession *session)
gchar * gnc_account_get_full_name(const Account *account)
void gnc_split_register_paste_current(SplitRegister *reg)
Functions providing a register page for the GnuCash UI.
void main_window_update_page_color(GncPluginPage *page, const gchar *color_in)
void gnc_plugin_page_register_filter_end_cb(GtkWidget *radio, GncPluginPageRegister *page)
void gnc_plugin_page_set_use_new_window(GncPluginPage *page, gboolean use_new)
void gnc_plugin_page_register_filter_response_cb(GtkDialog *dialog, gint response, GncPluginPageRegister *plugin_page)
gboolean guid_equal(const GncGUID *guid_1, const GncGUID *guid_2)
Account * gnc_plugin_page_register2_get_account(GncPluginPageRegister2 *page)
void(* destroy_widget)(GncPluginPage *plugin_page)
void xaccTransScrubImbalance(Transaction *trans, Account *root, Account *account)
void gnc_plugin_page_register_filter_start_cb(GtkWidget *radio, GncPluginPageRegister *page)
time64 gnc_time64_get_day_end(time64 time_val)
void qof_query_set_book(QofQuery *q, QofBook *book)
gboolean gnc_plugin_page_has_book(GncPluginPage *page, QofBook *book)
const gchar * plugin_name
void qof_event_unregister_handler(gint handler_id)
Unregister an event handler.
Account * gnc_account_lookup_by_full_name(const Account *any_acc, const gchar *name)
time64 gnc_mktime(struct tm *time)
calculate seconds from the epoch given a time struct
void xaccTransScrubOrphans(Transaction *trans)
Gnome specific utility functions.
gboolean xaccAccountIsAPARType(GNCAccountType t)
Additional event handling code.
#define xaccSplitGetGUID(X)
struct tm * gnc_localtime(const time64 *secs)
fill out a time struct from a 64-bit time value.
gboolean gnc_split_register_current_trans_expanded(SplitRegister *reg)
All type declarations for the whole Gnucash engine.
void gnc_plugin_page_register_filter_status_one_cb(GtkToggleButton *button, GncPluginPageRegister *page)
void(* window_changed)(GncPluginPage *plugin_page, GtkWidget *window)
Generic api to store and retrieve preferences.
Transaction * xaccTransReverse(Transaction *orig)
time64 gnc_time64_get_day_start(time64 time_val)
GList * qof_query_run(QofQuery *query)
const char * gnc_split_register_get_credit_string(SplitRegister *reg)
gboolean qof_book_is_readonly(const QofBook *book)
GtkAction * gnc_plugin_page_get_action(GncPluginPage *page, const gchar *name)
void gnc_plugin_page_set_page_color(GncPluginPage *page, const char *color)
gboolean gnc_split_register_handle_exchange(SplitRegister *reg, gboolean force_dialog)
GncPluginPage * gnc_plugin_page_register_new_gl(void)
void qof_event_suspend(void)
Suspend all engine events.
gboolean gncScrubBusinessLot(GNCLot *lot)
CursorClass gnc_split_register_get_current_cursor_class(SplitRegister *reg)
Account * xaccSplitGetAccount(const Split *s)
const GncGUID * guid_null(void)
GtkWidget *(* create_widget)(GncPluginPage *plugin_page)
void qof_event_resume(void)
gboolean gnc_prefs_get_bool(const gchar *group, const gchar *pref_name)
void gnc_main_window_close_page(GncPluginPage *page)
Transaction * xaccTransGetReversedBy(const Transaction *trans)
Split * xaccSplitGetOtherSplit(const Split *split)
#define LEAVE(format, args...)
void(* save_page)(GncPluginPage *page, GKeyFile *file, const gchar *group)
Split * gnc_split_register_duplicate_current(SplitRegister *reg)
void gnc_plugin_page_set_page_name(GncPluginPage *page, const char *name)
time64 gnc_time(time64 *tbuf)
get the current local time
Account * gnc_plugin_page_register_get_account(GncPluginPageRegister *page)
void gnc_plugin_page_add_book(GncPluginPage *page, QofBook *book)
GtkActionGroup * gnc_plugin_page_create_action_group(GncPluginPage *page, const gchar *group_name)
void gnc_plugin_page_register_sort_order_save_cb(GtkToggleButton *button, GncPluginPageRegister *page)
void gnc_plugin_page_register_sort_response_cb(GtkDialog *dialog, gint response, GncPluginPageRegister *plugin_page)
void xaccTransSetDateEnteredSecs(Transaction *trans, time64 secs)
const char * xaccAccountGetName(const Account *acc)
const char * xaccAccountGetSortOrder(const Account *acc)
void gnc_split_register_cut_current(SplitRegister *reg)
GNCSplitReg * gnc_plugin_page_register_get_gsr(GncPluginPage *plugin_page)
void gnc_plugin_page_register_sort_order_reverse_cb(GtkToggleButton *button, GncPluginPageRegister *page)
void main_window_update_page_name(GncPluginPage *page, const gchar *name_in)
void gnc_plugin_page_register_set_options(GncPluginPage *plugin_page, gint lines_default, gboolean read_only)
void gnc_split_register_cancel_cursor_trans_changes(SplitRegister *reg)
GNCLot * xaccSplitGetLot(const Split *split)
GList * qof_query_get_books(QofQuery *q)
const gchar * QofLogModule
void gnc_prefs_remove_cb_by_func(const gchar *group, const gchar *pref_name, gpointer func, gpointer user_data)
void gnc_split_register_config(SplitRegister *reg, SplitRegisterType newtype, SplitRegisterStyle newstyle, gboolean use_double_line)