42 #include <glib/gi18n.h> 43 #include "swig-runtime.h" 44 #include "guile-mappings.h" 47 #include "gnc-plugin-register.h" 50 #include "gnc-plugin-business.h" 53 #include "dialog-dup-trans.h" 54 #include "dialog-find-account.h" 55 #include "dialog-find-transactions.h" 56 #include "dialog-print-check.h" 57 #include "dialog-invoice.h" 58 #include "dialog-transfer.h" 59 #include "dialog-utils.h" 60 #include "assistant-stock-split.h" 61 #include "assistant-stock-transaction.h" 62 #include "gnc-component-manager.h" 64 #include "gnc-date-edit.h" 71 #include "gnc-gui-query.h" 72 #include "gnc-icons.h" 73 #include "gnc-split-reg.h" 79 #include "gnc-session.h" 81 #include "gnc-warnings.h" 83 #include "dialog-lot-viewer.h" 87 #include "window-reconcile.h" 88 #include "window-autoclear.h" 89 #include "window-report.h" 90 #include "engine-helpers.h" 91 #include "qofbookslots.h" 95 static QofLogModule log_module = GNC_MOD_GUI;
97 #define DEFAULT_LINES_AMOUNT 50 98 #define DEFAULT_FILTER_NUM_DAYS_GL "30" 100 static void gnc_plugin_page_register_finalize (GObject*
object);
104 static GtkWidget* gnc_plugin_page_register_create_widget (
106 static void gnc_plugin_page_register_destroy_widget (
GncPluginPage*
108 static void gnc_plugin_page_register_window_changed (
GncPluginPage*
109 plugin_page, GtkWidget* window);
110 static gboolean gnc_plugin_page_register_focus_widget (
GncPluginPage*
112 static void gnc_plugin_page_register_focus (
GncPluginPage* plugin_page,
113 gboolean current_page);
114 static void gnc_plugin_page_register_save_page (
GncPluginPage* plugin_page,
115 GKeyFile* file,
const gchar* group);
116 static GncPluginPage* gnc_plugin_page_register_recreate_page (
117 GtkWidget* window, GKeyFile* file,
const gchar* group);
118 static void gnc_plugin_page_register_update_edit_menu (
GncPluginPage* page,
120 static gboolean gnc_plugin_page_register_finish_pending (
GncPluginPage* page);
122 static gchar* gnc_plugin_page_register_get_tab_name (
GncPluginPage*
124 static gchar* gnc_plugin_page_register_get_tab_color (
GncPluginPage*
126 static gchar* gnc_plugin_page_register_get_long_name (
GncPluginPage*
129 static void gnc_plugin_page_register_summarybar_position_changed (
130 gpointer prefs, gchar* pref, gpointer user_data);
145 static gchar* gnc_plugin_page_register_get_sort_order (
GncPluginPage*
147 void gnc_plugin_page_register_set_sort_order (
GncPluginPage* plugin_page,
148 const gchar* sort_order);
149 static gboolean gnc_plugin_page_register_get_sort_reversed (
151 void gnc_plugin_page_register_set_sort_reversed (
GncPluginPage* plugin_page,
152 gboolean reverse_order);
175 static time64 gnc_plugin_page_register_filter_dmy2time (
char* date_string);
176 static gchar* gnc_plugin_page_register_filter_time2dmy (
time64 raw_time);
177 static gchar* gnc_plugin_page_register_get_filter (
GncPluginPage* plugin_page);
178 void gnc_plugin_page_register_set_filter (
GncPluginPage* plugin_page,
179 const gchar* filter);
186 static void gnc_plugin_page_register_cmd_print_check (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
187 static void gnc_plugin_page_register_cmd_cut (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
188 static void gnc_plugin_page_register_cmd_copy (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
189 static void gnc_plugin_page_register_cmd_paste (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
190 static void gnc_plugin_page_register_cmd_edit_account (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
191 static void gnc_plugin_page_register_cmd_find_account (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
192 static void gnc_plugin_page_register_cmd_find_transactions (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
193 static void gnc_plugin_page_register_cmd_edit_tax_options (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
194 static void gnc_plugin_page_register_cmd_cut_transaction (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
195 static void gnc_plugin_page_register_cmd_copy_transaction (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
196 static void gnc_plugin_page_register_cmd_paste_transaction (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
197 static void gnc_plugin_page_register_cmd_void_transaction (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
198 static void gnc_plugin_page_register_cmd_unvoid_transaction (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
199 static void gnc_plugin_page_register_cmd_reverse_transaction (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
200 static void gnc_plugin_page_register_cmd_view_sort_by (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
201 static void gnc_plugin_page_register_cmd_view_filter_by (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
203 static void gnc_plugin_page_register_cmd_style_changed (GSimpleAction *simple, GVariant *parameter, gpointer user_data);
204 static void gnc_plugin_page_register_cmd_style_double_line (GSimpleAction *simple, GVariant *parameter, gpointer user_data);
205 static void gnc_plugin_page_register_cmd_expand_transaction (GSimpleAction *simple, GVariant *parameter, gpointer user_data);
207 static void gnc_plugin_page_register_cmd_reconcile (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
208 static void gnc_plugin_page_register_cmd_stock_assistant (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
209 static void gnc_plugin_page_register_cmd_autoclear (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
210 static void gnc_plugin_page_register_cmd_transfer (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
211 static void gnc_plugin_page_register_cmd_stock_split (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
212 static void gnc_plugin_page_register_cmd_lots (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
213 static void gnc_plugin_page_register_cmd_enter_transaction (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
214 static void gnc_plugin_page_register_cmd_cancel_transaction (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
215 static void gnc_plugin_page_register_cmd_delete_transaction (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
216 static void gnc_plugin_page_register_cmd_blank_transaction (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
217 static void gnc_plugin_page_register_cmd_goto_date (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
218 static void gnc_plugin_page_register_cmd_duplicate_transaction (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
219 static void gnc_plugin_page_register_cmd_reinitialize_transaction (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
220 static void gnc_plugin_page_register_cmd_exchange_rate (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
221 static void gnc_plugin_page_register_cmd_jump (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
222 static void gnc_plugin_page_register_cmd_reload (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
223 static void gnc_plugin_page_register_cmd_schedule (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
224 static void gnc_plugin_page_register_cmd_scrub_all (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
225 static void gnc_plugin_page_register_cmd_scrub_current (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
226 static void gnc_plugin_page_register_cmd_account_report (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
227 static void gnc_plugin_page_register_cmd_transaction_report (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
228 static void gnc_plugin_page_register_cmd_linked_transaction (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
229 static void gnc_plugin_page_register_cmd_linked_transaction_open (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
230 static void gnc_plugin_page_register_cmd_jump_linked_invoice (GSimpleAction *simple, GVariant *paramter, gpointer user_data);
232 static void gnc_plugin_page_help_changed_cb (GNCSplitReg* gsr,
234 static void gnc_plugin_page_popup_menu_cb (GNCSplitReg* gsr,
236 static void gnc_plugin_page_register_refresh_cb (GHashTable* changes,
238 static void gnc_plugin_page_register_close_cb (gpointer user_data);
240 static void gnc_plugin_page_register_ui_update (gpointer various,
242 static void gppr_account_destroy_cb (
Account* account);
243 static void gnc_plugin_page_register_event_handler (
QofInstance* entity,
248 static GncInvoice* invoice_from_split (Split* split);
254 #define CUT_TRANSACTION_LABEL N_("Cu_t Transaction") 255 #define COPY_TRANSACTION_LABEL N_("_Copy Transaction") 256 #define PASTE_TRANSACTION_LABEL N_("_Paste Transaction") 257 #define DUPLICATE_TRANSACTION_LABEL N_("Dup_licate Transaction") 258 #define DELETE_TRANSACTION_LABEL N_("_Delete Transaction") 262 #define LINK_TRANSACTION_LABEL N_("_Manage Document Link…") 266 #define LINK_TRANSACTION_OPEN_LABEL N_("_Open Linked Document") 269 #define JUMP_LINKED_INVOICE_LABEL N_("Jump to Invoice") 270 #define CUT_SPLIT_LABEL N_("Cu_t Split") 271 #define COPY_SPLIT_LABEL N_("_Copy Split") 272 #define PASTE_SPLIT_LABEL N_("_Paste Split") 273 #define DUPLICATE_SPLIT_LABEL N_("Dup_licate Split") 274 #define DELETE_SPLIT_LABEL N_("_Delete Split") 275 #define CUT_TRANSACTION_TIP N_("Cut the selected transaction into clipboard") 276 #define COPY_TRANSACTION_TIP N_("Copy the selected transaction into clipboard") 277 #define PASTE_TRANSACTION_TIP N_("Paste the transaction from the clipboard") 278 #define DUPLICATE_TRANSACTION_TIP N_("Make a copy of the current transaction") 279 #define DELETE_TRANSACTION_TIP N_("Delete the current transaction") 280 #define LINK_TRANSACTION_TIP N_("Add, change, or unlink the document linked with the current transaction") 281 #define LINK_TRANSACTION_OPEN_TIP N_("Open the linked document for the current transaction") 282 #define JUMP_LINKED_INVOICE_TIP N_("Jump to the linked bill, invoice, or voucher") 283 #define CUT_SPLIT_TIP N_("Cut the selected split into clipboard") 284 #define COPY_SPLIT_TIP N_("Copy the selected split into clipboard") 285 #define PASTE_SPLIT_TIP N_("Paste the split from the clipboard") 286 #define DUPLICATE_SPLIT_TIP N_("Make a copy of the current split") 287 #define DELETE_SPLIT_TIP N_("Delete the current split") 289 static GActionEntry gnc_plugin_page_register_actions [] =
291 {
"FilePrintAction", gnc_plugin_page_register_cmd_print_check, NULL, NULL, NULL },
292 {
"EditCutAction", gnc_plugin_page_register_cmd_cut, NULL, NULL, NULL },
293 {
"EditCopyAction", gnc_plugin_page_register_cmd_copy, NULL, NULL, NULL },
294 {
"EditPasteAction", gnc_plugin_page_register_cmd_paste, NULL, NULL, NULL },
295 {
"EditEditAccountAction", gnc_plugin_page_register_cmd_edit_account, NULL, NULL, NULL },
296 {
"EditFindAccountAction", gnc_plugin_page_register_cmd_find_account, NULL, NULL, NULL },
297 {
"EditFindTransactionsAction", gnc_plugin_page_register_cmd_find_transactions, NULL, NULL, NULL },
298 {
"EditTaxOptionsAction", gnc_plugin_page_register_cmd_edit_tax_options, NULL, NULL, NULL },
299 {
"CutTransactionAction", gnc_plugin_page_register_cmd_cut_transaction, NULL, NULL, NULL },
300 {
"CopyTransactionAction", gnc_plugin_page_register_cmd_copy_transaction, NULL, NULL, NULL },
301 {
"PasteTransactionAction", gnc_plugin_page_register_cmd_paste_transaction, NULL, NULL, NULL },
302 {
"DuplicateTransactionAction", gnc_plugin_page_register_cmd_duplicate_transaction, NULL, NULL, NULL },
303 {
"DeleteTransactionAction", gnc_plugin_page_register_cmd_delete_transaction, NULL, NULL, NULL },
304 {
"RemoveTransactionSplitsAction", gnc_plugin_page_register_cmd_reinitialize_transaction, NULL, NULL, NULL },
305 {
"RecordTransactionAction", gnc_plugin_page_register_cmd_enter_transaction, NULL, NULL, NULL },
306 {
"CancelTransactionAction", gnc_plugin_page_register_cmd_cancel_transaction, NULL, NULL, NULL },
307 {
"VoidTransactionAction", gnc_plugin_page_register_cmd_void_transaction, NULL, NULL, NULL },
308 {
"UnvoidTransactionAction", gnc_plugin_page_register_cmd_unvoid_transaction, NULL, NULL, NULL },
309 {
"ReverseTransactionAction", gnc_plugin_page_register_cmd_reverse_transaction, NULL, NULL, NULL },
310 {
"LinkTransactionAction", gnc_plugin_page_register_cmd_linked_transaction, NULL, NULL, NULL },
311 {
"LinkedTransactionOpenAction", gnc_plugin_page_register_cmd_linked_transaction_open, NULL, NULL, NULL },
312 {
"JumpLinkedInvoiceAction", gnc_plugin_page_register_cmd_jump_linked_invoice, NULL, NULL, NULL },
313 {
"ViewSortByAction", gnc_plugin_page_register_cmd_view_sort_by, NULL, NULL, NULL },
314 {
"ViewFilterByAction", gnc_plugin_page_register_cmd_view_filter_by, NULL, NULL, NULL },
315 {
"ViewRefreshAction", gnc_plugin_page_register_cmd_reload, NULL, NULL, NULL },
316 {
"ActionsTransferAction", gnc_plugin_page_register_cmd_transfer, NULL, NULL, NULL },
317 {
"ActionsReconcileAction", gnc_plugin_page_register_cmd_reconcile, NULL, NULL, NULL },
318 {
"ActionsAutoClearAction", gnc_plugin_page_register_cmd_autoclear, NULL, NULL, NULL },
319 {
"ActionsStockAssistantAction", gnc_plugin_page_register_cmd_stock_assistant, NULL, NULL, NULL },
320 {
"ActionsStockSplitAction", gnc_plugin_page_register_cmd_stock_split, NULL, NULL, NULL },
321 {
"ActionsLotsAction", gnc_plugin_page_register_cmd_lots, NULL, NULL, NULL },
322 {
"BlankTransactionAction", gnc_plugin_page_register_cmd_blank_transaction, NULL, NULL, NULL },
323 {
"GotoDateAction", gnc_plugin_page_register_cmd_goto_date, NULL, NULL, NULL },
324 {
"EditExchangeRateAction", gnc_plugin_page_register_cmd_exchange_rate, NULL, NULL, NULL },
325 {
"JumpTransactionAction", gnc_plugin_page_register_cmd_jump, NULL, NULL, NULL },
326 {
"ScheduleTransactionAction", gnc_plugin_page_register_cmd_schedule, NULL, NULL, NULL },
327 {
"ScrubAllAction", gnc_plugin_page_register_cmd_scrub_all, NULL, NULL, NULL },
328 {
"ScrubCurrentAction", gnc_plugin_page_register_cmd_scrub_current, NULL, NULL, NULL },
329 {
"ReportsAccountReportAction", gnc_plugin_page_register_cmd_account_report, NULL, NULL, NULL },
330 {
"ReportsAcctTransReportAction", gnc_plugin_page_register_cmd_transaction_report, NULL, NULL, NULL },
332 {
"ViewStyleDoubleLineAction", gnc_plugin_page_register_cmd_style_double_line, NULL,
"false", NULL },
333 {
"SplitTransactionAction", gnc_plugin_page_register_cmd_expand_transaction, NULL,
"false", NULL },
334 {
"ViewStyleRadioAction", gnc_plugin_page_register_cmd_style_changed,
"i",
"@i 0", NULL },
336 static guint gnc_plugin_page_register_n_actions = G_N_ELEMENTS(gnc_plugin_page_register_actions);
339 static const gchar *gnc_plugin_load_ui_items [] =
355 "ActionsPlaceholder4",
356 "ActionsPlaceholder5",
357 "ActionsPlaceholder6",
358 "ReportsPlaceholder1",
364 static const gchar* actions_requiring_account[] =
366 "EditEditAccountAction",
367 "ActionsReconcileAction",
368 "ActionsAutoClearAction",
373 static const gchar* actions_requiring_priced_account[] =
375 "ActionsStockAssistantAction",
382 {
"ActionsTransferAction", N_ (
"Transfer") },
383 {
"RecordTransactionAction", N_ (
"Enter") },
384 {
"CancelTransactionAction", N_ (
"Cancel") },
385 {
"DeleteTransactionAction", N_ (
"Delete") },
386 {
"DuplicateTransactionAction", N_ (
"Duplicate") },
387 {
"SplitTransactionAction",
389 N_ (
"Show Splits") },
390 {
"JumpTransactionAction", N_ (
"Jump") },
391 {
"ScheduleTransactionAction", N_ (
"Schedule") },
392 {
"BlankTransactionAction", N_ (
"Blank") },
393 {
"ActionsReconcileAction", N_ (
"Reconcile") },
394 {
"ActionsAutoClearAction", N_ (
"Auto-clear") },
395 {
"LinkTransactionAction", N_ (
"Manage Document Link") },
396 {
"LinkedTransactionOpenAction", N_ (
"Open Linked Document") },
397 {
"JumpLinkedInvoiceAction", N_ (
"Invoice") },
398 {
"ActionsStockAssistantAction", N_ (
"Stock Assistant") },
404 const char* action_name;
411 {
"filter_status_reconciled", CLEARED_RECONCILED, NULL },
412 {
"filter_status_cleared", CLEARED_CLEARED, NULL },
413 {
"filter_status_voided", CLEARED_VOIDED, NULL },
414 {
"filter_status_frozen", CLEARED_FROZEN, NULL },
415 {
"filter_status_unreconciled", CLEARED_NO, NULL },
419 #define CLEARED_VALUE "cleared_value" 420 #define DEFAULT_FILTER "0x001f" 421 #define DEFAULT_SORT_ORDER "BY_STANDARD" 429 GNCLedgerDisplay* ledger;
434 gint event_handler_id;
435 gint component_manager_id;
441 gboolean enable_refresh;
448 GtkWidget* num_radio;
449 GtkWidget* act_radio;
450 SortType original_sort_type;
451 gboolean original_save_order;
453 gboolean reverse_order;
454 gboolean original_reverse_order;
461 GtkWidget* start_date_choose;
462 GtkWidget* start_date_today;
463 GtkWidget* start_date;
464 GtkWidget* end_date_choose;
465 GtkWidget* end_date_today;
468 cleared_match_t original_cleared_match;
469 cleared_match_t cleared_match;
470 time64 original_start_time;
476 gboolean original_save_filter;
477 gboolean save_filter;
482 GNC_TYPE_PLUGIN_PAGE)
484 #define GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(o) \ 485 ((GncPluginPageRegisterPrivate*)gnc_plugin_page_register_get_instance_private((GncPluginPageRegister*)o)) 492 gnc_plugin_page_register_new_common (GNCLedgerDisplay* ledger)
505 if (!gnc_features_check_used (gnc_get_current_book(), GNC_FEATURE_REG_SORT_FILTER))
509 if (!gnc_using_equity_type_opening_balance_account (gnc_get_current_book()))
510 gnc_set_use_equity_type_opening_balance_account (gnc_get_current_book());
513 gsr = GNC_SPLIT_REG(gnc_ledger_display_get_user_data (ledger));
517 for (; item; item = g_list_next (item))
520 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (register_page);
521 if (priv->gsr == gsr)
522 return GNC_PLUGIN_PAGE (register_page);
526 register_page = GNC_PLUGIN_PAGE_REGISTER(g_object_new (GNC_TYPE_PLUGIN_PAGE_REGISTER,
nullptr));
527 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (register_page);
528 priv->ledger = ledger;
531 plugin_page = GNC_PLUGIN_PAGE (register_page);
532 label = gnc_plugin_page_register_get_tab_name (plugin_page);
536 label_color = gnc_plugin_page_register_get_tab_color (plugin_page);
538 g_free (label_color);
540 label = gnc_plugin_page_register_get_long_name (plugin_page);
546 for (item = book_list; item; item = g_list_next (item))
550 priv->component_manager_id = 0;
555 gnc_plug_page_register_check_commodity (
Account* account,
void* usr_data)
558 gnc_commodity* com0 = (gnc_commodity*) usr_data;
566 GNCLedgerDisplay* ledger;
572 ENTER (
"account=%p, subaccounts=%s", account,
573 subaccounts ?
"TRUE" :
"FALSE");
577 gnc_plug_page_register_check_commodity,
578 static_cast<gpointer>(com0)));
585 page = gnc_plugin_page_register_new_common (ledger);
586 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
596 GNCLedgerDisplay* ledger;
599 return gnc_plugin_page_register_new_common (ledger);
605 return gnc_plugin_page_register_new_common (ledger);
611 GObjectClass* object_class = G_OBJECT_CLASS (klass);
614 object_class->finalize = gnc_plugin_page_register_finalize;
616 gnc_plugin_class->
tab_icon = GNC_ICON_ACCOUNT;
617 gnc_plugin_class->
plugin_name = GNC_PLUGIN_PAGE_REGISTER_NAME;
618 gnc_plugin_class->
create_widget = gnc_plugin_page_register_create_widget;
619 gnc_plugin_class->
destroy_widget = gnc_plugin_page_register_destroy_widget;
620 gnc_plugin_class->
window_changed = gnc_plugin_page_register_window_changed;
621 gnc_plugin_class->
focus_page = gnc_plugin_page_register_focus;
622 gnc_plugin_class->
save_page = gnc_plugin_page_register_save_page;
623 gnc_plugin_class->
recreate_page = gnc_plugin_page_register_recreate_page;
625 gnc_plugin_page_register_update_edit_menu;
626 gnc_plugin_class->
finish_pending = gnc_plugin_page_register_finish_pending;
629 gnc_ui_register_account_destroy_callback (gppr_account_destroy_cb);
637 GSimpleActionGroup *simple_action_group;
640 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (plugin_page);
643 parent = GNC_PLUGIN_PAGE (plugin_page);
646 g_object_set (G_OBJECT (plugin_page),
647 "page-name", _ (
"General Journal"),
648 "ui-description",
"gnc-plugin-page-register.ui",
649 "use-new-window", use_new,
654 g_action_map_add_action_entries (G_ACTION_MAP(simple_action_group),
655 gnc_plugin_page_register_actions,
656 gnc_plugin_page_register_n_actions,
659 priv->lines_default = DEFAULT_LINES_AMOUNT;
660 priv->read_only = FALSE;
661 priv->fd.cleared_match = CLEARED_ALL;
663 priv->enable_refresh = TRUE;
664 priv->search_query = NULL;
665 priv->filter_query = NULL;
669 gnc_plugin_page_register_finalize (GObject*
object)
671 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (
object));
673 ENTER (
"object %p",
object);
675 G_OBJECT_CLASS (gnc_plugin_page_register_parent_class)->finalize (
object);
683 GNCLedgerDisplayType ledger_type;
686 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
687 ledger_type = gnc_ledger_display_type (priv->ledger);
690 if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
701 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
711 gnc_plugin_page_register_focus_widget (
GncPluginPage* register_plugin_page)
713 if (GNC_IS_PLUGIN_PAGE_REGISTER (register_plugin_page))
715 GncWindow* gnc_window = GNC_WINDOW(GNC_PLUGIN_PAGE(register_plugin_page)->window);
718 if (GNC_IS_MAIN_WINDOW(GNC_PLUGIN_PAGE(register_plugin_page)->window))
722 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), TRUE);
725 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), FALSE);
728 register_plugin_page,
729 gnc_plugin_load_ui_items);
733 GtkWidget *toolbar = gnc_window_get_toolbar (gnc_window);
734 GtkWidget *menubar = gnc_window_get_menubar (gnc_window);
735 GMenuModel *menubar_model = gnc_window_get_menubar_model (gnc_window);
736 GtkWidget *statusbar = gnc_window_get_statusbar (gnc_window);
746 gnc_plugin_page_register_ui_update (NULL, GNC_PLUGIN_PAGE_REGISTER(register_plugin_page));
748 gnc_split_reg_focus_on_sheet (gsr);
754 static const char* readonly_inactive_actions[] =
758 "CutTransactionAction",
759 "PasteTransactionAction",
760 "DuplicateTransactionAction",
761 "DeleteTransactionAction",
762 "RemoveTransactionSplitsAction",
763 "RecordTransactionAction",
764 "CancelTransactionAction",
765 "UnvoidTransactionAction",
766 "VoidTransactionAction",
767 "ReverseTransactionAction",
768 "ActionsTransferAction",
769 "ActionsReconcileAction",
770 "ActionsStockSplitAction",
771 "ScheduleTransactionAction",
773 "ScrubCurrentAction",
774 "LinkTransactionAction",
780 static const char* tran_vs_split_actions[] =
782 "CutTransactionAction",
783 "CopyTransactionAction",
784 "PasteTransactionAction",
785 "DuplicateTransactionAction",
786 "DeleteTransactionAction",
791 static const char* tran_action_labels[] =
793 CUT_TRANSACTION_LABEL,
794 COPY_TRANSACTION_LABEL,
795 PASTE_TRANSACTION_LABEL,
796 DUPLICATE_TRANSACTION_LABEL,
797 DELETE_TRANSACTION_LABEL,
798 LINK_TRANSACTION_LABEL,
799 LINK_TRANSACTION_OPEN_LABEL,
800 JUMP_LINKED_INVOICE_LABEL,
805 static const char* tran_action_tips[] =
808 COPY_TRANSACTION_TIP,
809 PASTE_TRANSACTION_TIP,
810 DUPLICATE_TRANSACTION_TIP,
811 DELETE_TRANSACTION_TIP,
812 LINK_TRANSACTION_TIP,
813 LINK_TRANSACTION_OPEN_TIP,
814 JUMP_LINKED_INVOICE_TIP,
819 static const char* split_action_labels[] =
824 DUPLICATE_SPLIT_LABEL,
830 static const char* split_action_tips[] =
840 static std::vector<GncInvoice*>
841 invoices_from_transaction (
const Transaction* trans)
843 std::vector<GncInvoice*> rv;
845 g_return_val_if_fail (GNC_IS_TRANSACTION (trans), rv);
849 auto split = GNC_SPLIT(node->data);
853 auto inv = invoice_from_split (split);
861 gnc_plugin_page_register_ui_update (gpointer various,
867 GNCLedgerDisplayType ledger_type;
868 gboolean expanded, voided, read_only = FALSE, read_only_reg = FALSE;
873 GncWindow* gnc_window = GNC_WINDOW(GNC_PLUGIN_PAGE(page)->window);
876 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
882 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), reg->style == REG_STYLE_LEDGER);
885 ledger_type = gnc_ledger_display_type (priv->ledger);
888 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), ledger_type != LD_GL);
889 g_action_change_state (G_ACTION(action), g_variant_new_int32 (reg->style));
893 g_action_change_state (G_ACTION(action), g_variant_new_boolean (reg->use_double_line));
897 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), reg->style == REG_STYLE_LEDGER);
899 g_signal_handlers_block_by_func (action, (gpointer)gnc_plugin_page_register_cmd_expand_transaction, page);
900 g_action_change_state (G_ACTION(action), g_variant_new_boolean (expanded));
901 g_signal_handlers_unblock_by_func (action, (gpointer)gnc_plugin_page_register_cmd_expand_transaction, page);
906 if (GNC_IS_MAIN_WINDOW(GNC_PLUGIN_PAGE(page)->window))
910 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), TRUE);
914 actions_requiring_priced_account,
922 gnc_split_reg_get_read_only (priv->gsr))
923 read_only_reg = TRUE;
926 actions_requiring_account,
927 !read_only_reg && account != NULL);
930 actions_requiring_priced_account,
936 if (cursor_class == CURSOR_CLASS_SPLIT)
938 if (GNC_IS_MAIN_WINDOW(GNC_PLUGIN_PAGE(page)->window))
945 if (GNC_IS_MAIN_WINDOW(GNC_PLUGIN_PAGE(page)->window))
956 for (iter = readonly_inactive_actions; *iter; ++iter)
960 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), TRUE);
970 "CutTransactionAction");
971 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), !read_only & !voided);
974 "PasteTransactionAction");
975 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), !read_only & !voided);
978 "DeleteTransactionAction");
979 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), !read_only & !voided);
981 if (cursor_class == CURSOR_CLASS_SPLIT)
984 "DuplicateTransactionAction");
985 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), !read_only & !voided);
989 "RemoveTransactionSplitsAction");
990 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), !read_only & !voided);
997 "VoidTransactionAction");
998 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), !voided);
1004 "UnvoidTransactionAction");
1005 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), voided);
1010 "LinkedTransactionOpenAction");
1014 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), (uri ? TRUE:FALSE));
1022 "JumpLinkedInvoiceAction");
1025 auto invoices = invoices_from_transaction (trans);
1026 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), !invoices.empty());
1029 gnc_plugin_business_split_reg_ui_update (GNC_PLUGIN_PAGE(page));
1035 for (iter = readonly_inactive_actions; *iter; ++iter)
1039 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), FALSE);
1046 GncMenuModelSearch *gsm = g_new0 (GncMenuModelSearch, 1);
1047 gboolean found = FALSE;
1048 const char** iter, **label_iter, **tooltip_iter;
1049 gboolean curr_label_trans = FALSE;
1050 iter = tran_vs_split_actions;
1051 label_iter = tran_action_labels;
1053 gsm->search_action_label = NULL;
1054 gsm->search_action_name = *iter;
1055 gsm->search_action_target = NULL;
1059 PINFO(
"Test for action '%s', found is %d, iter label is '%s'", *iter, found, _(*label_iter));
1067 if (g_strcmp0 (gsm->search_action_label, _(*label_iter)) == 0)
1068 curr_label_trans = TRUE;
1072 if ((cursor_class == CURSOR_CLASS_SPLIT) && curr_label_trans)
1074 gboolean found = FALSE;
1075 label_iter = split_action_labels;
1076 tooltip_iter = split_action_tips;
1077 for (iter = tran_vs_split_actions; *iter; ++iter)
1081 *iter, NULL, _(*label_iter), NULL, _(*tooltip_iter));
1083 PINFO(
"split model_item action '%s', found is %d, iter label is '%s'",
1084 *iter, found, _(*label_iter));
1090 else if ((cursor_class == CURSOR_CLASS_TRANS) && !curr_label_trans)
1092 gboolean found = FALSE;
1093 label_iter = tran_action_labels;
1094 tooltip_iter = tran_action_tips;
1095 for (iter = tran_vs_split_actions; *iter; ++iter)
1099 *iter, NULL, _(*label_iter), NULL, _(*tooltip_iter));
1101 PINFO(
"trans model_item action '%s', found is %d, iter label is '%s'",
1102 *iter, found, _(*label_iter));
1110 gnc_window_get_menubar_model (gnc_window),
1111 gnc_window_get_statusbar (gnc_window));
1115 gnc_window_get_menubar_model (gnc_window),
1116 gnc_window_get_accel_group (gnc_window));
1124 GSimpleActionGroup *simple_action_group;
1128 GNCLedgerDisplayType ledger_type;
1131 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
1136 g_return_if_fail (G_IS_SIMPLE_ACTION_GROUP(simple_action_group));
1139 is_readwrite && account != NULL);
1142 ledger_type = gnc_ledger_display_type (priv->ledger);
1144 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), ledger_type == LD_SINGLE);
1148 g_signal_handlers_block_by_func (action,
1149 (gpointer)gnc_plugin_page_register_cmd_style_changed, page);
1150 g_action_change_state (G_ACTION(action), g_variant_new_int32 (reg->style));
1151 g_signal_handlers_unblock_by_func (action,
1152 (gpointer)gnc_plugin_page_register_cmd_style_changed, page);
1156 g_signal_handlers_block_by_func (action,
1157 (gpointer)gnc_plugin_page_register_cmd_style_double_line, page);
1158 g_action_change_state (G_ACTION(action), g_variant_new_boolean (reg->use_double_line));
1159 g_signal_handlers_unblock_by_func (action,
1160 (gpointer)gnc_plugin_page_register_cmd_style_double_line, page);
1166 get_filter_default_num_of_days (GNCLedgerDisplayType ledger_type)
1168 if (ledger_type == LD_GL)
1169 return DEFAULT_FILTER_NUM_DAYS_GL;
1181 gboolean on_current_page)
1187 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page));
1189 page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
1190 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
1194 if (on_current_page)
1196 priv->page_focus = TRUE;
1200 GNC_PLUGIN_PAGE_CLASS (gnc_plugin_page_register_parent_class)->focus_page (plugin_page, TRUE);
1203 priv->page_focus = FALSE;
1206 gnc_split_reg_set_sheet_focus (gsr, priv->page_focus);
1212 gnc_plugin_page_register_create_widget (
GncPluginPage* plugin_page)
1216 GNCLedgerDisplayType ledger_type;
1217 GncWindow* gnc_window;
1223 int filter_changed = 0;
1224 gboolean create_new_page = FALSE;
1226 ENTER (
"page %p", plugin_page);
1227 page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
1228 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
1230 if (priv->widget != NULL)
1232 LEAVE (
"existing widget %p", priv->widget);
1233 return priv->widget;
1236 priv->widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
1237 gtk_box_set_homogeneous (GTK_BOX (priv->widget), FALSE);
1238 gtk_widget_show (priv->widget);
1241 gtk_widget_set_name (GTK_WIDGET(priv->widget),
"gnc-id-register-page");
1243 numRows = priv->lines_default;
1244 numRows = MIN (numRows, DEFAULT_LINES_AMOUNT);
1246 gnc_window = GNC_WINDOW(GNC_PLUGIN_PAGE(page)->window);
1247 gsr = gnc_split_reg_new (priv->ledger,
1248 gnc_window_get_gtk_window (gnc_window),
1249 numRows, priv->read_only);
1250 priv->gsr = (GNCSplitReg *)gsr;
1252 gtk_widget_show (gsr);
1253 gtk_box_pack_start (GTK_BOX (priv->widget), gsr, TRUE, TRUE, 0);
1255 g_signal_connect (G_OBJECT (gsr),
"help-changed",
1256 G_CALLBACK (gnc_plugin_page_help_changed_cb),
1259 g_signal_connect (G_OBJECT (gsr),
"show-popup-menu",
1260 G_CALLBACK (gnc_plugin_page_popup_menu_cb),
1265 reg->use_double_line);
1267 gnc_plugin_page_register_ui_initial_state (page);
1268 gnc_plugin_page_register_ui_update (NULL, page);
1270 ledger_type = gnc_ledger_display_type (priv->ledger);
1275 guint filtersize = 0;
1277 priv->sd.save_order = FALSE;
1278 order = gnc_plugin_page_register_get_sort_order (plugin_page);
1280 PINFO (
"Loaded Sort order is %s", order);
1282 gnc_split_reg_set_sort_type (priv->gsr, SortTypefromString (order));
1284 if (order && (g_strcmp0 (order, DEFAULT_SORT_ORDER) != 0))
1285 priv->sd.save_order = TRUE;
1287 priv->sd.original_save_order = priv->sd.save_order;
1290 priv->sd.reverse_order = gnc_plugin_page_register_get_sort_reversed (
1292 gnc_split_reg_set_sort_reversed (priv->gsr, priv->sd.reverse_order, FALSE);
1293 if (priv->sd.reverse_order)
1294 priv->sd.save_order = TRUE;
1296 priv->sd.original_reverse_order = priv->sd.reverse_order;
1299 priv->fd.save_filter = FALSE;
1301 filter_str = gnc_plugin_page_register_get_filter (plugin_page);
1302 filter = g_strsplit (filter_str,
",", -1);
1303 filtersize = g_strv_length (filter);
1304 g_free (filter_str);
1306 PINFO (
"Loaded Filter Status is %s", filter[0]);
1308 priv->fd.cleared_match = (cleared_match_t)g_ascii_strtoll (filter[0], NULL, 16);
1310 if (filtersize > 0 && (g_strcmp0 (filter[0], DEFAULT_FILTER) != 0))
1311 filter_changed = filter_changed + 1;
1313 if (filtersize > 1 && (g_strcmp0 (filter[1],
"0") != 0))
1315 PINFO (
"Loaded Filter Start Date is %s", filter[1]);
1317 priv->fd.start_time = gnc_plugin_page_register_filter_dmy2time (filter[1]);
1319 filter_changed = filter_changed + 1;
1322 if (filtersize > 2 && (g_strcmp0 (filter[2],
"0") != 0))
1324 PINFO (
"Loaded Filter End Date is %s", filter[2]);
1326 priv->fd.end_time = gnc_plugin_page_register_filter_dmy2time (filter[2]);
1328 filter_changed = filter_changed + 1;
1332 priv->fd.days = (gint)g_ascii_strtoll (
1333 get_filter_default_num_of_days (ledger_type), NULL, 10);
1335 if (filtersize > 3 &&
1336 (g_strcmp0 (filter[3], get_filter_default_num_of_days (ledger_type)) != 0))
1338 PINFO (
"Loaded Filter Days is %s", filter[3]);
1340 priv->fd.days = (gint)g_ascii_strtoll (filter[3], NULL, 10);
1341 filter_changed = filter_changed + 1;
1344 if (filter_changed != 0)
1345 priv->fd.save_filter = TRUE;
1347 priv->fd.original_save_filter = priv->fd.save_filter;
1348 g_strfreev (filter);
1351 if (ledger_type == LD_GL)
1353 time64 start_time = 0, end_time = 0;
1355 if (reg->type == GENERAL_JOURNAL)
1357 start_time = priv->fd.start_time;
1358 end_time = priv->fd.end_time;
1363 priv->fd.cleared_match = (cleared_match_t)g_ascii_strtoll (DEFAULT_FILTER, NULL, 16);
1364 gnc_split_reg_set_sort_type (priv->gsr,
1365 SortTypefromString (DEFAULT_SORT_ORDER));
1366 priv->sd.reverse_order = FALSE;
1367 priv->fd.save_filter = FALSE;
1368 priv->sd.save_order = FALSE;
1371 priv->fd.original_days = priv->fd.days;
1373 priv->fd.original_start_time = start_time;
1374 priv->fd.start_time = start_time;
1375 priv->fd.original_end_time = end_time;
1376 priv->fd.end_time = end_time;
1381 if (priv->enable_refresh == TRUE)
1383 create_new_page = TRUE;
1384 priv->enable_refresh = FALSE;
1388 gnc_ppr_update_status_query (page);
1389 gnc_ppr_update_date_query (page);
1392 if (create_new_page)
1394 priv->enable_refresh = TRUE;
1399 gnc_plugin_page_register_set_filter_tooltip (page);
1401 plugin_page->
summarybar = gsr_create_summary_bar (priv->gsr);
1404 gtk_widget_show_all (plugin_page->
summarybar);
1405 gtk_box_pack_start (GTK_BOX (priv->widget), plugin_page->
summarybar,
1408 gnc_plugin_page_register_summarybar_position_changed (NULL, NULL, page);
1410 GNC_PREF_SUMMARYBAR_POSITION_TOP,
1411 (gpointer)gnc_plugin_page_register_summarybar_position_changed,
1414 GNC_PREF_SUMMARYBAR_POSITION_BOTTOM,
1415 (gpointer)gnc_plugin_page_register_summarybar_position_changed,
1421 priv->component_manager_id =
1422 gnc_register_gui_component (GNC_PLUGIN_PAGE_REGISTER_NAME,
1423 gnc_plugin_page_register_refresh_cb,
1424 gnc_plugin_page_register_close_cb,
1426 gnc_gui_component_set_session (priv->component_manager_id,
1427 gnc_get_current_session());
1430 gnc_gui_component_watch_entity (
1432 QOF_EVENT_DESTROY | QOF_EVENT_MODIFY);
1434 gnc_split_reg_set_moved_cb
1435 (priv->gsr, (GFunc)gnc_plugin_page_register_ui_update, page);
1437 g_signal_connect (G_OBJECT (plugin_page),
"inserted",
1443 return priv->widget;
1447 gnc_plugin_page_register_destroy_widget (
GncPluginPage* plugin_page)
1452 ENTER (
"page %p", plugin_page);
1453 page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
1454 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (plugin_page);
1457 GNC_PREF_SUMMARYBAR_POSITION_TOP,
1458 (gpointer)gnc_plugin_page_register_summarybar_position_changed,
1461 GNC_PREF_SUMMARYBAR_POSITION_BOTTOM,
1462 (gpointer)gnc_plugin_page_register_summarybar_position_changed,
1469 g_idle_remove_by_data (GNC_PLUGIN_PAGE_REGISTER (plugin_page));
1471 if (priv->widget == NULL)
1474 if (priv->component_manager_id)
1476 gnc_unregister_gui_component (priv->component_manager_id);
1477 priv->component_manager_id = 0;
1480 if (priv->event_handler_id)
1483 priv->event_handler_id = 0;
1486 if (priv->sd.dialog)
1488 gtk_widget_destroy (priv->sd.dialog);
1489 memset (&priv->sd, 0, sizeof (priv->sd));
1492 if (priv->fd.dialog)
1494 gtk_widget_destroy (priv->fd.dialog);
1495 memset (&priv->fd, 0, sizeof (priv->fd));
1501 gtk_widget_hide (priv->widget);
1503 priv->ledger = NULL;
1508 gnc_plugin_page_register_window_changed (
GncPluginPage* plugin_page,
1514 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page));
1516 page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
1517 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
1519 GTK_WIDGET (gnc_window_get_gtk_window (GNC_WINDOW (window)));
1522 static const gchar* style_names[] =
1530 #define KEY_REGISTER_TYPE "RegisterType" 1531 #define KEY_ACCOUNT_NAME "AccountName" 1532 #define KEY_ACCOUNT_GUID "AccountGuid" 1533 #define KEY_REGISTER_STYLE "RegisterStyle" 1534 #define KEY_DOUBLE_LINE "DoubleLineMode" 1536 #define LABEL_ACCOUNT "Account" 1537 #define LABEL_SUBACCOUNT "SubAccount" 1538 #define LABEL_GL "GL" 1539 #define LABEL_SEARCH "Search" 1552 gnc_plugin_page_register_save_page (
GncPluginPage* plugin_page,
1554 const gchar* group_name)
1558 GNCLedgerDisplayType ledger_type;
1562 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page));
1563 g_return_if_fail (key_file != NULL);
1564 g_return_if_fail (group_name != NULL);
1566 ENTER (
"page %p, key_file %p, group_name %s", plugin_page, key_file,
1569 page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
1570 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
1573 ledger_type = gnc_ledger_display_type (priv->ledger);
1574 if (ledger_type > LD_GL)
1576 LEAVE (
"Unsupported ledger type");
1579 if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
1584 label = (ledger_type == LD_SINGLE) ? LABEL_ACCOUNT : LABEL_SUBACCOUNT;
1586 g_key_file_set_string (key_file, group_name, KEY_REGISTER_TYPE, label);
1588 g_key_file_set_string (key_file, group_name, KEY_ACCOUNT_NAME, name);
1591 g_key_file_set_string (key_file, group_name, KEY_ACCOUNT_GUID, acct_guid);
1593 else if (reg->type == GENERAL_JOURNAL)
1595 g_key_file_set_string (key_file, group_name, KEY_REGISTER_TYPE,
1598 else if (reg->type == SEARCH_LEDGER)
1600 g_key_file_set_string (key_file, group_name, KEY_REGISTER_TYPE,
1605 LEAVE (
"Unsupported register type");
1609 g_key_file_set_string (key_file, group_name, KEY_REGISTER_STYLE,
1610 style_names[reg->style]);
1611 g_key_file_set_boolean (key_file, group_name, KEY_DOUBLE_LINE,
1612 reg->use_double_line);
1631 gnc_plugin_page_register_restore_edit_menu (
GncPluginPage* page,
1633 const gchar* group_name)
1637 GError* error = NULL;
1640 gboolean use_double_line;
1645 style_name = g_key_file_get_string (key_file, group_name,
1646 KEY_REGISTER_STYLE, &error);
1647 for (i = 0 ; style_names[i]; i++)
1649 if (g_ascii_strcasecmp (style_name, style_names[i]) == 0)
1651 DEBUG (
"Found match for style name: %s", style_name);
1655 g_free (style_name);
1658 if (i <= REG_STYLE_JOURNAL)
1660 DEBUG (
"Setting style: %d", i);
1662 g_action_activate (G_ACTION(action), g_variant_new_int32 (i));
1666 use_double_line = g_key_file_get_boolean (key_file, group_name,
1667 KEY_DOUBLE_LINE, &error);
1668 DEBUG (
"Setting double_line_mode: %d", use_double_line);
1671 state = g_action_get_state (G_ACTION(action));
1673 if (use_double_line != g_variant_get_boolean (state))
1674 g_action_activate (G_ACTION(action), NULL);
1676 g_variant_unref (state);
1692 gnc_plugin_page_register_recreate_page (GtkWidget* window,
1694 const gchar* group_name)
1698 GError* error = NULL;
1699 gchar* reg_type, *acct_guid;
1703 gboolean include_subs;
1705 g_return_val_if_fail (key_file, NULL);
1706 g_return_val_if_fail (group_name, NULL);
1707 ENTER (
"key_file %p, group_name %s", key_file, group_name);
1710 reg_type = g_key_file_get_string (key_file, group_name,
1711 KEY_REGISTER_TYPE, &error);
1712 DEBUG (
"Page type: %s", reg_type);
1713 if ((g_ascii_strcasecmp (reg_type, LABEL_ACCOUNT) == 0) ||
1714 (g_ascii_strcasecmp (reg_type, LABEL_SUBACCOUNT) == 0))
1716 include_subs = (g_ascii_strcasecmp (reg_type, LABEL_SUBACCOUNT) == 0);
1717 DEBUG (
"Include subs: %d", include_subs);
1721 LEAVE(
"Session has no book");
1724 acct_guid = g_key_file_get_string (key_file, group_name,
1725 KEY_ACCOUNT_GUID, &error);
1731 if (account == NULL)
1733 gchar* acct_name = g_key_file_get_string (key_file, group_name,
1734 KEY_ACCOUNT_NAME, &error);
1739 if (account == NULL)
1741 LEAVE (
"Bad account name");
1747 else if (g_ascii_strcasecmp (reg_type, LABEL_GL) == 0)
1753 LEAVE (
"Bad ledger type");
1761 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
1762 priv->enable_refresh = FALSE;
1771 gnc_plugin_page_register_restore_edit_menu (page, key_file, group_name);
1774 priv->enable_refresh = TRUE;
1784 gnc_plugin_page_register_update_edit_menu (
GncPluginPage* page, gboolean hide)
1789 gboolean can_copy = FALSE, can_cut = FALSE, can_paste = FALSE;
1790 gboolean has_selection;
1793 reg_page = GNC_PLUGIN_PAGE_REGISTER (page);
1794 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (reg_page);
1795 has_selection = gnucash_register_has_selection (priv->gsr->reg);
1797 can_copy = has_selection;
1798 can_cut = is_readwrite && has_selection;
1799 can_paste = is_readwrite;
1802 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), can_copy);
1804 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), can_cut);
1806 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), can_paste);
1809 static gboolean is_scrubbing = FALSE;
1810 static gboolean show_abort_verify = TRUE;
1813 check_repair_abort_YN = N_(
"'Check & Repair' is currently running, do you want to abort it?");
1818 gboolean ret = FALSE;
1823 false,
"%s", _(check_repair_abort_YN));
1825 show_abort_verify = FALSE;
1834 gnc_plugin_page_register_finish_pending (
GncPluginPage* page)
1839 GtkWidget* dialog, *window;
1843 if (is_scrubbing && show_abort_verify)
1845 if (!finish_scrub (page))
1849 reg_page = GNC_PLUGIN_PAGE_REGISTER (page);
1850 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (reg_page);
1856 name = gnc_plugin_page_register_get_tab_name (page);
1858 dialog = gtk_message_dialog_new (GTK_WINDOW (window),
1859 GTK_DIALOG_DESTROY_WITH_PARENT,
1860 GTK_MESSAGE_WARNING,
1864 _ (
"Save changes to %s?"), name);
1866 gtk_message_dialog_format_secondary_text
1867 (GTK_MESSAGE_DIALOG (dialog),
1869 _ (
"This register has pending changes to a transaction. " 1870 "Would you like to save the changes to this transaction, " 1871 "discard the transaction, or cancel the operation?"));
1872 gnc_gtk_dialog_add_button (dialog, _ (
"_Discard Transaction"),
1873 "edit-delete", GTK_RESPONSE_REJECT);
1874 gtk_dialog_add_button (GTK_DIALOG (dialog),
1875 _ (
"_Cancel"), GTK_RESPONSE_CANCEL);
1876 gnc_gtk_dialog_add_button (dialog, _ (
"_Save Transaction"),
1877 "document-save", GTK_RESPONSE_ACCEPT);
1879 response = gtk_dialog_run (GTK_DIALOG (dialog));
1880 gtk_widget_destroy (dialog);
1884 case GTK_RESPONSE_ACCEPT:
1888 case GTK_RESPONSE_REJECT:
1900 gnc_plugin_page_register_get_tab_name (
GncPluginPage* plugin_page)
1903 GNCLedgerDisplayType ledger_type;
1904 GNCLedgerDisplay* ld;
1908 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page),
1909 g_strdup (_(
"unknown")));
1911 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (plugin_page);
1914 ledger_type = gnc_ledger_display_type (ld);
1917 switch (ledger_type)
1928 case GENERAL_JOURNAL:
1930 return g_strdup (_ (
"General Journal"));
1931 case PORTFOLIO_LEDGER:
1932 return g_strdup (_ (
"Portfolio"));
1934 return g_strdup (_ (
"Search Results"));
1944 return g_strdup (_ (
"unknown"));
1948 gnc_plugin_page_register_get_tab_color (
GncPluginPage* plugin_page)
1951 GNCLedgerDisplayType ledger_type;
1952 GNCLedgerDisplay* ld;
1956 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page),
1957 g_strdup (_(
"unknown")));
1959 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (plugin_page);
1961 ledger_type = gnc_ledger_display_type (ld);
1965 if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
1968 return g_strdup (color ? color :
"Not Set");
1972 gnc_plugin_page_register_check_for_empty_group (GKeyFile *state_file,
1973 const gchar *state_section)
1976 gchar **keys = g_key_file_get_keys (state_file, state_section, &num_keys, NULL);
1985 gnc_plugin_page_register_get_filter_gcm (GNCSplitReg *gsr)
1988 gchar* state_section;
1989 GError* error = NULL;
1990 char* filter = NULL;
1993 state_section = gsr_get_register_state_section (gsr);
1994 filter = g_key_file_get_string (state_file, state_section,
1995 KEY_PAGE_FILTER, &error);
1998 g_clear_error (&error);
2000 g_strdelimit (filter,
";",
',');
2002 g_free (state_section);
2007 gnc_plugin_page_register_get_filter (
GncPluginPage* plugin_page)
2010 GNCLedgerDisplayType ledger_type;
2011 char* filter = NULL;
2013 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page),
2014 g_strdup (_(
"unknown")));
2016 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (plugin_page);
2018 ledger_type = gnc_ledger_display_type (priv->ledger);
2021 filter = gnc_plugin_page_register_get_filter_gcm (priv->gsr);
2026 return g_strdup_printf (
"%s,%s,%s,%s", DEFAULT_FILTER,
2027 "0",
"0", get_filter_default_num_of_days (ledger_type));
2031 gnc_plugin_page_register_set_filter_gcm (GNCSplitReg *gsr,
const gchar* filter,
2032 gchar* default_filter)
2035 gchar* state_section;
2039 state_section = gsr_get_register_state_section (gsr);
2040 if (!filter || (g_strcmp0 (filter, default_filter) == 0))
2042 if (g_key_file_has_key (state_file, state_section, KEY_PAGE_FILTER, NULL))
2043 g_key_file_remove_key (state_file, state_section, KEY_PAGE_FILTER, NULL);
2045 gnc_plugin_page_register_check_for_empty_group (state_file, state_section);
2049 filter_text = g_strdup (filter);
2050 g_strdelimit (filter_text,
",",
';');
2051 g_key_file_set_string (state_file, state_section, KEY_PAGE_FILTER,
2053 g_free (filter_text);
2055 g_free (state_section);
2059 gnc_plugin_page_register_set_filter (
GncPluginPage* plugin_page,
2060 const gchar* filter)
2063 GNCLedgerDisplayType ledger_type;
2064 gchar* default_filter;
2066 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (plugin_page);
2068 ledger_type = gnc_ledger_display_type (priv->ledger);
2070 default_filter = g_strdup_printf (
"%s,%s,%s,%s", DEFAULT_FILTER,
2071 "0",
"0", get_filter_default_num_of_days (ledger_type));
2074 gnc_plugin_page_register_set_filter_gcm (priv->gsr, filter, default_filter);
2076 g_free (default_filter);
2081 gnc_plugin_page_register_get_sort_order_gcm (GNCSplitReg *gsr)
2084 gchar* state_section;
2086 GError* error = NULL;
2087 char* sort_order = NULL;
2090 state_section = gsr_get_register_state_section (gsr);
2091 sort_text = g_key_file_get_string (state_file, state_section, KEY_PAGE_SORT,
2095 g_clear_error (&error);
2098 sort_order = g_strdup (sort_text);
2101 g_free (state_section);
2106 gnc_plugin_page_register_get_sort_order (
GncPluginPage* plugin_page)
2109 char* sort_order = NULL;
2111 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page),
2114 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (plugin_page);
2117 sort_order = gnc_plugin_page_register_get_sort_order_gcm (priv->gsr);
2119 return sort_order ? sort_order : g_strdup (DEFAULT_SORT_ORDER);
2123 gnc_plugin_page_register_set_sort_order_gcm (GNCSplitReg *gsr,
2124 const gchar* sort_order)
2127 gchar* state_section;
2130 state_section = gsr_get_register_state_section (gsr);
2131 if (!sort_order || (g_strcmp0 (sort_order, DEFAULT_SORT_ORDER) == 0))
2133 if (g_key_file_has_key (state_file, state_section, KEY_PAGE_SORT, NULL))
2134 g_key_file_remove_key (state_file, state_section, KEY_PAGE_SORT, NULL);
2136 gnc_plugin_page_register_check_for_empty_group (state_file, state_section);
2139 g_key_file_set_string (state_file, state_section, KEY_PAGE_SORT, sort_order);
2141 g_free (state_section);
2144 gnc_plugin_page_register_set_sort_order (
GncPluginPage* plugin_page,
2145 const gchar* sort_order)
2149 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (plugin_page);
2152 gnc_plugin_page_register_set_sort_order_gcm (priv->gsr, sort_order);
2156 gnc_plugin_page_register_get_sort_reversed_gcm (GNCSplitReg *gsr)
2159 gchar* state_section;
2160 GError* error = NULL;
2161 gboolean sort_reversed = FALSE;
2164 state_section = gsr_get_register_state_section (gsr);
2165 sort_reversed = g_key_file_get_boolean (state_file, state_section,
2166 KEY_PAGE_SORT_REV, &error);
2169 g_clear_error (&error);
2171 g_free (state_section);
2172 return sort_reversed;
2176 gnc_plugin_page_register_get_sort_reversed (
GncPluginPage* plugin_page)
2179 gboolean sort_reversed = FALSE;
2181 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), FALSE);
2183 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (plugin_page);
2186 sort_reversed = gnc_plugin_page_register_get_sort_reversed_gcm (priv->gsr);
2187 return sort_reversed;
2191 gnc_plugin_page_register_set_sort_reversed_gcm (GNCSplitReg *gsr,
2192 gboolean reverse_order)
2195 gchar* state_section;
2198 state_section = gsr_get_register_state_section (gsr);
2202 if (g_key_file_has_key (state_file, state_section, KEY_PAGE_SORT_REV, NULL))
2203 g_key_file_remove_key (state_file, state_section, KEY_PAGE_SORT_REV, NULL);
2205 gnc_plugin_page_register_check_for_empty_group (state_file, state_section);
2208 g_key_file_set_boolean (state_file, state_section, KEY_PAGE_SORT_REV,
2211 g_free (state_section);
2215 gnc_plugin_page_register_set_sort_reversed (
GncPluginPage* plugin_page,
2216 gboolean reverse_order)
2220 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (plugin_page);
2223 gnc_plugin_page_register_set_sort_reversed_gcm (priv->gsr, reverse_order);
2227 gnc_plugin_page_register_get_long_name (
GncPluginPage* plugin_page)
2230 GNCLedgerDisplayType ledger_type;
2231 GNCLedgerDisplay* ld;
2234 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page),
2237 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (plugin_page);
2239 ledger_type = gnc_ledger_display_type (ld);
2242 switch (ledger_type)
2250 gchar* return_string = g_strdup_printf (
"%s+", account_full_name);
2251 g_free ((gpointer*) account_full_name);
2252 return return_string;
2263 gnc_plugin_page_register_summarybar_position_changed (gpointer prefs,
2270 GtkPositionType position = GTK_POS_BOTTOM;
2272 g_return_if_fail (user_data != NULL);
2274 if (!GNC_IS_PLUGIN_PAGE (user_data))
2277 plugin_page = GNC_PLUGIN_PAGE (user_data);
2278 page = GNC_PLUGIN_PAGE_REGISTER (user_data);
2279 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2285 GNC_PREF_SUMMARYBAR_POSITION_TOP))
2286 position = GTK_POS_TOP;
2288 gtk_box_reorder_child (GTK_BOX (priv->widget),
2290 (position == GTK_POS_TOP ? 0 : -1));
2304 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), NULL);
2306 page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
2307 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2326 gnc_plugin_page_register_sort_book_option_changed (gpointer new_val,
2330 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
2331 gboolean* new_data = (gboolean*)new_val;
2333 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2335 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2338 gtk_button_set_label (GTK_BUTTON (priv->sd.num_radio),
2339 _ (
"Transaction Number"));
2340 gtk_button_set_label (GTK_BUTTON (priv->sd.act_radio), _ (
"Number/Action"));
2344 gtk_button_set_label (GTK_BUTTON (priv->sd.num_radio), _ (
"Number"));
2345 gtk_button_set_label (GTK_BUTTON (priv->sd.act_radio), _ (
"Action"));
2347 gnc_split_reg_set_sort_type_force (priv->gsr, (SortType)priv->gsr->sort_type, TRUE);
2371 g_return_if_fail (GTK_IS_DIALOG (dialog));
2372 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2375 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2376 plugin_page = GNC_PLUGIN_PAGE (page);
2378 if (response != GTK_RESPONSE_OK)
2381 gnc_split_reg_set_sort_reversed (priv->gsr, priv->sd.original_reverse_order,
2383 priv->sd.reverse_order = priv->sd.original_reverse_order;
2384 gnc_split_reg_set_sort_type (priv->gsr, priv->sd.original_sort_type);
2385 priv->sd.save_order = priv->sd.original_save_order;
2390 if ((!priv->sd.save_order) && ((priv->sd.original_save_order) || (priv->sd.original_reverse_order)))
2392 gnc_plugin_page_register_set_sort_order (plugin_page, DEFAULT_SORT_ORDER);
2393 gnc_plugin_page_register_set_sort_reversed (plugin_page, FALSE);
2395 priv->sd.original_save_order = priv->sd.save_order;
2397 if (priv->sd.save_order)
2399 type = gnc_split_reg_get_sort_type (priv->gsr);
2400 order = SortTypeasString (type);
2401 gnc_plugin_page_register_set_sort_order (plugin_page, order);
2402 gnc_plugin_page_register_set_sort_reversed (plugin_page,
2403 priv->sd.reverse_order);
2406 gnc_book_option_remove_cb (OPTION_NAME_NUM_FIELD_SOURCE,
2407 gnc_plugin_page_register_sort_book_option_changed,
2409 priv->sd.dialog = NULL;
2410 priv->sd.num_radio = NULL;
2411 priv->sd.act_radio = NULL;
2412 gtk_widget_destroy (GTK_WIDGET (dialog));
2433 g_return_if_fail (GTK_IS_TOGGLE_BUTTON (button));
2434 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2436 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2437 name = gtk_buildable_get_name (GTK_BUILDABLE (button));
2438 ENTER (
"button %s(%p), page %p", name, button, page);
2439 type = SortTypefromString (name);
2440 gnc_split_reg_set_sort_type (priv->gsr, type);
2459 g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
2460 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2462 ENTER (
"Save toggle button (%p), plugin_page %p", button, page);
2465 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2467 if (gtk_toggle_button_get_active (button))
2468 priv->sd.save_order = TRUE;
2470 priv->sd.save_order = FALSE;
2489 g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
2490 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2492 ENTER (
"Reverse toggle button (%p), plugin_page %p", button, page);
2495 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2497 priv->sd.reverse_order = gtk_toggle_button_get_active (button);
2498 gnc_split_reg_set_sort_reversed (priv->gsr, priv->sd.reverse_order, TRUE);
2512 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2515 if (reg->type == SEARCH_LEDGER)
2522 if ((priv->filter_query == NULL) ||
2553 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2556 LEAVE (
"no ledger");
2560 gnc_ppr_update_for_search_query (page);
2565 LEAVE (
"no query found");
2572 if (reg->type != SEARCH_LEDGER)
2574 GSList *param_list = qof_query_build_param_list (SPLIT_RECONCILE, NULL);
2576 g_slist_free (param_list);
2580 if (priv->fd.cleared_match != CLEARED_ALL)
2581 xaccQueryAddClearedMatch (query, priv->fd.cleared_match, QOF_QUERY_AND);
2584 gnc_plugin_page_register_set_filter_tooltip (page);
2590 if (priv->enable_refresh)
2616 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2619 LEAVE (
"no ledger");
2623 gnc_ppr_update_for_search_query (page);
2636 if (reg->type != SEARCH_LEDGER)
2638 GSList *param_list = qof_query_build_param_list (SPLIT_TRANS,
2639 TRANS_DATE_POSTED, NULL);
2641 g_slist_free (param_list);
2644 if (priv->fd.start_time || priv->fd.end_time)
2647 xaccQueryAddDateMatchTT (query,
2648 priv->fd.start_time != 0, priv->fd.start_time,
2649 priv->fd.end_time != 0, priv->fd.end_time,
2653 if (priv->fd.days > 0)
2660 tm.tm_mday = tm.tm_mday - priv->fd.days;
2662 xaccQueryAddDateMatchTT (query, TRUE, start, FALSE, 0, QOF_QUERY_AND);
2666 gnc_plugin_page_register_set_filter_tooltip (page);
2672 if (priv->enable_refresh)
2680 gnc_plugin_page_register_filter_time2dmy (
time64 raw_time)
2682 struct tm* timeinfo;
2683 gchar date_string[11];
2686 strftime (date_string, 11,
"%d-%m-%Y", timeinfo);
2687 PINFO (
"Date string is %s", date_string);
2690 return g_strdup (date_string);
2696 gnc_plugin_page_register_filter_dmy2time (
char* date_string)
2700 PINFO (
"Date string is %s", date_string);
2701 memset (&when, 0,
sizeof (when));
2703 sscanf (date_string,
"%d-%d-%d", &when.tm_mday,
2704 &when.tm_mon, &when.tm_year);
2707 when.tm_year -= 1900;
2731 g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
2732 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2734 name = gtk_buildable_get_name (GTK_BUILDABLE (button));
2735 ENTER (
"toggle button %s (%p), plugin_page %p", name, button, page);
2738 value = CLEARED_NONE;
2739 for (i = 0; status_actions[i].action_name; i++)
2741 if (g_strcmp0 (name, status_actions[i].action_name) == 0)
2743 value = status_actions[i].value;
2749 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2750 if (gtk_toggle_button_get_active (button))
2751 priv->fd.cleared_match = (cleared_match_t)(priv->fd.cleared_match | value);
2753 priv->fd.cleared_match = (cleared_match_t)(priv->fd.cleared_match & ~value);
2754 gnc_ppr_update_status_query (page);
2776 g_return_if_fail (GTK_IS_BUTTON (button));
2777 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2779 ENTER (
"(button %p, page %p)", button, page);
2782 for (i = 0; status_actions[i].action_name; i++)
2784 widget = status_actions[i].widget;
2785 g_signal_handlers_block_by_func (widget,
2787 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
2788 g_signal_handlers_unblock_by_func (widget,
2793 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2794 priv->fd.cleared_match = CLEARED_ALL;
2795 gnc_ppr_update_status_query (page);
2817 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2818 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (
2819 priv->fd.start_date_choose)))
2821 time_val = gnc_date_edit_get_date (GNC_DATE_EDIT (priv->fd.start_date));
2823 priv->fd.start_time = time_val;
2827 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (
2828 priv->fd.start_date_today)))
2834 priv->fd.start_time = 0;
2838 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (
2839 priv->fd.end_date_choose)))
2841 time_val = gnc_date_edit_get_date (GNC_DATE_EDIT (priv->fd.end_date));
2843 priv->fd.end_time = time_val;
2847 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (
2848 priv->fd.start_date_today)))
2854 priv->fd.end_time = 0;
2879 g_return_if_fail (GTK_IS_RADIO_BUTTON (button));
2880 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2882 ENTER (
"(button %p, page %p)", button, page);
2883 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2884 name = gtk_buildable_get_name (GTK_BUILDABLE (button));
2885 active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
2887 if (active && g_strcmp0 (name,
"filter_show_range") == 0)
2889 gtk_widget_set_sensitive (priv->fd.table, active);
2890 gtk_widget_set_sensitive (priv->fd.num_days, !active);
2891 get_filter_times (page);
2893 else if (active && g_strcmp0 (name,
"filter_show_days") == 0)
2895 gtk_widget_set_sensitive (priv->fd.table, !active);
2896 gtk_widget_set_sensitive (priv->fd.num_days, active);
2897 gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->fd.num_days), priv->fd.days);
2901 gtk_widget_set_sensitive (priv->fd.table, FALSE);
2902 gtk_widget_set_sensitive (priv->fd.num_days, FALSE);
2904 priv->fd.start_time = 0;
2905 priv->fd.end_time = 0;
2907 gnc_ppr_update_date_query (page);
2916 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page));
2918 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (plugin_page);
2921 priv->fd.start_time = 0;
2922 priv->fd.end_time = 0;
2923 priv->fd.cleared_match = (cleared_match_t)g_ascii_strtoll (DEFAULT_FILTER, NULL, 16);
2925 gnc_ppr_update_date_query (GNC_PLUGIN_PAGE_REGISTER(plugin_page));
2944 g_return_if_fail (GTK_IS_SPIN_BUTTON (button));
2945 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2947 ENTER (
"(button %p, page %p)", button, page);
2948 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
2950 priv->fd.days = gtk_spin_button_get_value (GTK_SPIN_BUTTON (button));
2951 gnc_ppr_update_date_query (page);
2967 gnc_plugin_page_register_filter_gde_changed_cb (GtkWidget* unused,
2970 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
2972 ENTER (
"(widget %s(%p), page %p)",
2973 gtk_buildable_get_name (GTK_BUILDABLE (unused)), unused, page);
2974 get_filter_times (page);
2975 gnc_ppr_update_date_query (page);
3007 g_return_if_fail (GTK_IS_RADIO_BUTTON (radio));
3008 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3010 ENTER (
"(radio %s(%p), page %p)",
3011 gtk_buildable_get_name (GTK_BUILDABLE (radio)), radio, page);
3012 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3013 if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
3015 LEAVE (
"1st callback of pair. Defer to 2nd callback.");
3019 name = gtk_buildable_get_name (GTK_BUILDABLE (radio));
3020 active = !g_strcmp0 (name,
"start_date_choose");
3021 gtk_widget_set_sensitive (priv->fd.start_date, active);
3022 get_filter_times (page);
3023 gnc_ppr_update_date_query (page);
3055 g_return_if_fail (GTK_IS_RADIO_BUTTON (radio));
3056 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3058 ENTER (
"(radio %s(%p), page %p)",
3059 gtk_buildable_get_name (GTK_BUILDABLE (radio)), radio, page);
3060 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3061 if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
3063 LEAVE (
"1st callback of pair. Defer to 2nd callback.");
3067 name = gtk_buildable_get_name (GTK_BUILDABLE (radio));
3068 active = !g_strcmp0 (name,
"end_date_choose");
3069 gtk_widget_set_sensitive (priv->fd.end_date, active);
3070 get_filter_times (page);
3071 gnc_ppr_update_date_query (page);
3090 g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
3091 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3093 ENTER (
"Save toggle button (%p), plugin_page %p", button, page);
3096 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3097 if (gtk_toggle_button_get_active (button))
3098 priv->fd.save_filter = TRUE;
3100 priv->fd.save_filter = FALSE;
3124 g_return_if_fail (GTK_IS_DIALOG (dialog));
3125 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3128 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3129 plugin_page = GNC_PLUGIN_PAGE (page);
3131 if (response != GTK_RESPONSE_OK)
3134 priv->fd.cleared_match = priv->fd.original_cleared_match;
3135 priv->enable_refresh = FALSE;
3136 gnc_ppr_update_status_query (page);
3137 priv->enable_refresh = TRUE;
3138 priv->fd.start_time = priv->fd.original_start_time;
3139 priv->fd.end_time = priv->fd.original_end_time;
3140 priv->fd.days = priv->fd.original_days;
3141 priv->fd.save_filter = priv->fd.original_save_filter;
3142 gnc_ppr_update_date_query (page);
3147 if ((priv->fd.save_filter == FALSE) && (priv->fd.original_save_filter == TRUE))
3148 gnc_plugin_page_register_set_filter (plugin_page, NULL);
3150 priv->fd.original_save_filter = priv->fd.save_filter;
3152 if (priv->fd.save_filter)
3155 GList *flist = NULL;
3158 flist = g_list_prepend
3159 (flist, g_strdup_printf (
"0x%04x", priv->fd.cleared_match));
3162 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.start_date_choose)) && priv->fd.start_time != 0)
3163 flist = g_list_prepend (flist, gnc_plugin_page_register_filter_time2dmy (priv->fd.start_time));
3165 flist = g_list_prepend (flist, g_strdup (
"0"));
3168 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.end_date_choose))
3169 && priv->fd.end_time != 0)
3170 flist = g_list_prepend (flist, gnc_plugin_page_register_filter_time2dmy (priv->fd.end_time));
3172 flist = g_list_prepend (flist, g_strdup (
"0"));
3175 if (priv->fd.days > 0)
3176 flist = g_list_prepend (flist, g_strdup_printf (
"%d", priv->fd.days));
3178 flist = g_list_prepend (flist, g_strdup (
"0"));
3180 flist = g_list_reverse (flist);
3182 PINFO (
"The filter to save is %s", filter);
3183 gnc_plugin_page_register_set_filter (plugin_page, filter);
3185 g_list_free_full (flist, g_free);
3188 priv->fd.dialog = NULL;
3189 gtk_widget_destroy (GTK_WIDGET (dialog));
3194 gpp_update_match_filter_text (cleared_match_t match,
const guint mask,
3195 const gchar* filter_name, GList **show, GList **hide)
3197 if ((match & mask) == mask)
3198 *show = g_list_prepend (*show, g_strdup (filter_name));
3200 *hide = g_list_prepend (*hide, g_strdup (filter_name));
3207 GList *t_list = NULL;
3209 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3212 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3215 if (priv->fd.start_time != 0)
3218 t_list = g_list_prepend
3219 (t_list, g_strdup_printf (
"%s %s", _(
"Start Date:"), sdate));
3224 if (priv->fd.days > 0)
3225 t_list = g_list_prepend
3226 (t_list, g_strdup_printf (
"%s %d", _(
"Show previous number of days:"),
3230 if (priv->fd.end_time != 0)
3233 t_list = g_list_prepend
3234 (t_list, g_strdup_printf (
"%s %s", _(
"End Date:"), edate));
3239 if (priv->fd.cleared_match != CLEARED_ALL)
3244 gpp_update_match_filter_text (priv->fd.cleared_match, 0x01, _ (
"Unreconciled"),
3246 gpp_update_match_filter_text (priv->fd.cleared_match, 0x02, _ (
"Cleared"),
3248 gpp_update_match_filter_text (priv->fd.cleared_match, 0x04, _ (
"Reconciled"),
3250 gpp_update_match_filter_text (priv->fd.cleared_match, 0x08, _ (
"Frozen"),
3252 gpp_update_match_filter_text (priv->fd.cleared_match, 0x10, _ (
"Voided"),
3255 show = g_list_reverse (show);
3256 hide = g_list_reverse (hide);
3261 t_list = g_list_prepend
3262 (t_list, g_strdup_printf (
"%s %s", _(
"Show:"), str));
3269 t_list = g_list_prepend
3270 (t_list, g_strdup_printf (
"%s %s", _(
"Hide:"), str));
3274 g_list_free_full (show, g_free);
3275 g_list_free_full (hide, g_free);
3278 t_list = g_list_reverse (t_list);
3281 t_list = g_list_prepend (t_list, g_strdup (_(
"Filter By:")));
3284 if (priv->gsr->filter_text != NULL)
3285 g_free (priv->gsr->filter_text);
3290 g_list_free_full (t_list, g_free);
3297 gnc_plugin_page_register_update_page_icon (
GncPluginPage* plugin_page)
3302 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page));
3304 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (plugin_page);
3307 gnc_split_reg_get_read_only (priv->gsr))
3321 gnc_reg_get_name (GNCLedgerDisplay* ledger, gboolean for_window)
3325 gchar* account_name;
3328 GNCLedgerDisplayType ledger_type;
3334 ledger_type = gnc_ledger_display_type (ledger);
3338 case GENERAL_JOURNAL:
3341 reg_name = _ (
"General Journal");
3343 reg_name = _ (
"Transaction Report");
3345 case PORTFOLIO_LEDGER:
3347 reg_name = _ (
"Portfolio");
3349 reg_name = _ (
"Portfolio Report");
3353 reg_name = _ (
"Search Results");
3355 reg_name = _ (
"Search Results Report");
3359 reg_name = _ (
"Register");
3361 reg_name = _ (
"Transaction Report");
3367 if ((leader != NULL) && (ledger_type != LD_GL))
3371 if (ledger_type == LD_SINGLE)
3373 name = g_strconcat (account_name,
" - ", reg_name, NULL);
3377 name = g_strconcat (account_name,
" ", _ (
"and subaccounts"),
" - ", reg_name,
3380 g_free (account_name);
3383 name = g_strdup (reg_name);
3389 report_helper (GNCLedgerDisplay* ledger, Split* split,
Query* query)
3395 swig_type_info* qtype;
3402 func = scm_c_eval_string (
"gnc:register-report-create");
3403 g_return_val_if_fail (scm_is_procedure (func), -1);
3406 arg = scm_from_utf8_string (tmp ? tmp : _ (
"Credit"));
3407 args = scm_cons (arg, args);
3410 arg = scm_from_utf8_string (tmp ? tmp : _ (
"Debit"));
3411 args = scm_cons (arg, args);
3413 str = gnc_reg_get_name (ledger, FALSE);
3414 arg = scm_from_utf8_string (str ? str :
"");
3415 args = scm_cons (arg, args);
3418 arg = SCM_BOOL (reg->use_double_line);
3419 args = scm_cons (arg, args);
3421 arg = SCM_BOOL (reg->type == GENERAL_JOURNAL || reg->type == INCOME_LEDGER
3422 || reg->type == SEARCH_LEDGER);
3423 args = scm_cons (arg, args);
3425 arg = SCM_BOOL (reg->style == REG_STYLE_JOURNAL);
3426 args = scm_cons (arg, args);
3431 g_return_val_if_fail (query != NULL, -1);
3434 qtype = SWIG_TypeQuery (
"_p__QofQuery");
3435 g_return_val_if_fail (qtype, -1);
3437 arg = SWIG_NewPointerObj (query, qtype, 0);
3438 args = scm_cons (arg, args);
3439 g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
3444 qtype = SWIG_TypeQuery (
"_p_Split");
3445 g_return_val_if_fail (qtype, -1);
3446 arg = SWIG_NewPointerObj (split, qtype, 0);
3452 args = scm_cons (arg, args);
3453 g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
3456 qtype = SWIG_TypeQuery (
"_p_Account");
3457 g_return_val_if_fail (qtype, -1);
3460 arg = SWIG_NewPointerObj (account, qtype, 0);
3461 args = scm_cons (arg, args);
3462 g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
3466 arg = scm_apply (func, args, SCM_EOL);
3467 g_return_val_if_fail (scm_is_exact (arg), -1);
3469 return scm_to_int (arg);
3477 gnc_plugin_page_register_cmd_print_check (GSimpleAction *simple,
3481 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
3486 GList* splits = NULL, *item;
3487 GNCLedgerDisplayType ledger_type;
3488 Account* account, *subaccount = NULL;
3491 ENTER (
"(action %p, page %p)", simple, page);
3493 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3495 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3497 ledger_type = gnc_ledger_display_type (priv->ledger);
3499 if (ledger_type == LD_SINGLE || ledger_type == LD_SUBACCOUNT)
3504 if (ledger_type == LD_SUBACCOUNT)
3508 subaccount = account;
3515 splits = g_list_prepend (splits, split);
3516 gnc_ui_print_check_dialog_create (window, splits, subaccount);
3517 g_list_free (splits);
3526 splits = g_list_prepend (splits, split);
3527 gnc_ui_print_check_dialog_create (window, splits, subaccount);
3528 g_list_free (splits);
3533 else if (ledger_type == LD_GL && reg->type == SEARCH_LEDGER)
3541 for (item = splits; item; item = g_list_next (item))
3543 split = (Split*) item->data;
3544 if (common_acct == NULL)
3554 const gchar* title = _ (
"Print checks from multiple accounts?");
3555 const gchar* message =
3556 _ (
"This search result contains splits from more than one account. " 3557 "Do you want to print the checks even though they are not all " 3558 "from the same account?");
3559 dialog = gtk_message_dialog_new (GTK_WINDOW (window),
3560 GTK_DIALOG_DESTROY_WITH_PARENT,
3561 GTK_MESSAGE_WARNING,
3564 gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
3566 gtk_dialog_add_button (GTK_DIALOG (dialog), _ (
"_Print checks"),
3568 response = gnc_dialog_run (GTK_DIALOG (dialog),
3569 GNC_PREF_WARN_CHECKPRINTING_MULTI_ACCT);
3570 gtk_widget_destroy (dialog);
3571 if (response != GTK_RESPONSE_YES)
3573 LEAVE (
"Multiple accounts");
3580 gnc_ui_print_check_dialog_create (window, splits, NULL);
3584 gnc_error_dialog (GTK_WINDOW (window),
"%s",
3585 _ (
"You can only print checks from a bank account register or search results."));
3586 LEAVE (
"Unsupported ledger type");
3594 gnc_plugin_page_register_cmd_cut (GSimpleAction *simple,
3598 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
3601 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3603 ENTER (
"(action %p, page %p)", simple, page);
3604 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3605 gnucash_register_cut_clipboard (priv->gsr->reg);
3611 gnc_plugin_page_register_cmd_copy (GSimpleAction *simple,
3615 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
3618 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3620 ENTER (
"(action %p, page %p)", simple, page);
3621 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3622 gnucash_register_copy_clipboard (priv->gsr->reg);
3628 gnc_plugin_page_register_cmd_paste (GSimpleAction *simple,
3632 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
3635 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3637 ENTER (
"(action %p, page %p)", simple, page);
3638 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3639 gnucash_register_paste_clipboard (priv->gsr->reg);
3645 gnc_plugin_page_register_cmd_edit_account (GSimpleAction *simple,
3649 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
3652 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3654 ENTER (
"(action %p, page %p)", simple, page);
3663 gnc_plugin_page_register_cmd_find_account (GSimpleAction *simple,
3667 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
3670 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3673 gnc_find_account_dialog (window, NULL);
3678 gnc_plugin_page_register_cmd_find_transactions (GSimpleAction *simple,
3682 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
3686 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3688 ENTER (
"(action %p, page %p)", simple, page);
3689 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3691 gnc_ui_find_transactions_dialog_create (window, priv->ledger);
3697 gnc_plugin_page_register_cmd_edit_tax_options (GSimpleAction *simple,
3701 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
3705 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3707 ENTER (
"(action %p, page %p)", simple, page);
3710 gnc_tax_info_dialog (window, account);
3715 gnc_plugin_page_register_cmd_cut_transaction (GSimpleAction *simple,
3719 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
3722 ENTER (
"(action %p, page %p)", simple, page);
3724 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3726 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3727 gsr_default_cut_txn_handler (priv->gsr, NULL);
3733 gnc_plugin_page_register_cmd_copy_transaction (GSimpleAction *simple,
3737 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
3741 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3743 ENTER (
"(action %p, page %p)", simple, page);
3744 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3752 gnc_plugin_page_register_cmd_paste_transaction (GSimpleAction *simple,
3756 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
3760 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3762 ENTER (
"(action %p, page %p)", simple, page);
3763 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3771 gnc_plugin_page_register_cmd_void_transaction (GSimpleAction *simple,
3775 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
3777 GtkWidget* dialog, *entry;
3780 GtkBuilder* builder;
3785 ENTER (
"(action %p, page %p)", simple, page);
3787 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3790 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3800 gnc_error_dialog (window,
"%s",
3801 _ (
"You cannot void a transaction with reconciled or cleared splits."));
3807 gnc_error_dialog (window,
3808 _ (
"This transaction is marked read-only with the comment: '%s'"), reason);
3812 if (!gnc_plugin_page_register_finish_pending (GNC_PLUGIN_PAGE (page)))
3815 builder = gtk_builder_new();
3816 gnc_builder_add_from_file (builder,
"gnc-plugin-page-register.glade",
3817 "void_transaction_dialog");
3818 dialog = GTK_WIDGET (gtk_builder_get_object (builder,
3819 "void_transaction_dialog"));
3820 entry = GTK_WIDGET (gtk_builder_get_object (builder,
"reason"));
3822 gtk_window_set_transient_for (GTK_WINDOW (dialog), window);
3824 result = gtk_dialog_run (GTK_DIALOG (dialog));
3825 if (result == GTK_RESPONSE_OK)
3827 reason = gtk_entry_get_text (GTK_ENTRY (entry));
3834 gtk_widget_destroy (dialog);
3835 g_object_unref (G_OBJECT (builder));
3840 gnc_plugin_page_register_cmd_unvoid_transaction (GSimpleAction *simple,
3844 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
3849 ENTER (
"(action %p, page %p)", simple, page);
3851 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3853 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3862 static std::optional<time64>
3863 input_date (GtkWidget * parent,
const char *window_title,
const char* title)
3866 if (!gnc_dup_time64_dialog (parent, window_title, title, &rv))
3873 gnc_plugin_page_register_cmd_reverse_transaction (GSimpleAction *simple,
3877 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
3881 Transaction* trans, *new_trans;
3886 ENTER (
"(action %p, page %p)", simple, page);
3888 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3890 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3902 LEAVE (
"shouldn't try to reverse the blank transaction...");
3909 const char *rev = _(
"A reversing entry has already been created for this transaction.");
3910 const char *jump = _(
"Jump to the transaction?");
3911 if (!gnc_verify_dialog (GTK_WINDOW (window), TRUE,
"%s\n\n%s", rev, jump))
3913 LEAVE (
"reverse cancelled");
3919 auto date = input_date (window, _(
"Reverse Transaction"), _(
"New Transaction Information"));
3922 LEAVE (
"reverse cancelled");
3926 gnc_suspend_gui_refresh ();
3933 gnc_resume_gui_refresh();
3938 split = xaccTransFindSplitByAccount(new_trans, account);
3941 if (gnc_split_reg_clear_filter_for_split (gsr, split))
3944 gnc_split_reg_jump_to_split (gsr, split);
3952 GNCLedgerDisplayType ledger_type = gnc_ledger_display_type (priv->ledger);
3955 if (ledger_type == LD_SINGLE || ledger_type == LD_SUBACCOUNT)
3961 case GENERAL_JOURNAL:
3966 case PORTFOLIO_LEDGER:
3976 gnc_plugin_page_register_cmd_view_sort_by (GSimpleAction *simple,
3980 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
3983 GtkWidget* dialog, *button;
3984 GtkBuilder* builder;
3989 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
3990 ENTER (
"(action %p, page %p)", simple, page);
3992 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
3993 if (priv->sd.dialog)
3995 gtk_window_present (GTK_WINDOW (priv->sd.dialog));
3996 LEAVE (
"existing dialog");
4002 builder = gtk_builder_new();
4003 gnc_builder_add_from_file (builder,
"gnc-plugin-page-register.glade",
4005 dialog = GTK_WIDGET (gtk_builder_get_object (builder,
"sort_by_dialog"));
4006 priv->sd.dialog = dialog;
4007 gtk_window_set_transient_for (GTK_WINDOW (dialog),
4008 gnc_window_get_gtk_window (GNC_WINDOW (GNC_PLUGIN_PAGE (page)->window)));
4010 title = g_strdup_printf (_ (
"Sort %s by…"),
4012 gtk_window_set_title (GTK_WINDOW (dialog), title);
4016 sort = gnc_split_reg_get_sort_type (priv->gsr);
4017 name = SortTypeasString (sort);
4018 button = GTK_WIDGET (gtk_builder_get_object (builder, name));
4019 DEBUG (
"current sort %d, button %s(%p)", sort, name, button);
4020 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
4021 priv->sd.original_sort_type = sort;
4023 button = GTK_WIDGET (gtk_builder_get_object (builder,
"sort_save"));
4024 if (priv->sd.save_order == TRUE)
4025 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
4028 gtk_widget_set_visible (GTK_WIDGET (button),
4029 gnc_plugin_page_register_show_fs_save (page));
4032 button = GTK_WIDGET (gtk_builder_get_object (builder,
"sort_reverse"));
4033 if (priv->sd.reverse_order == TRUE)
4034 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
4035 priv->sd.original_reverse_order = priv->sd.reverse_order;
4037 priv->sd.num_radio = GTK_WIDGET (gtk_builder_get_object (builder,
"BY_NUM"));
4038 priv->sd.act_radio = GTK_WIDGET (gtk_builder_get_object (builder,
4042 if (reg && !reg->use_tran_num_for_num_field)
4044 gtk_button_set_label (GTK_BUTTON (priv->sd.num_radio),
4045 _ (
"Transaction Number"));
4046 gtk_button_set_label (GTK_BUTTON (priv->sd.act_radio), _ (
"Number/Action"));
4048 gnc_book_option_register_cb (OPTION_NAME_NUM_FIELD_SOURCE,
4049 (GncBOCb)gnc_plugin_page_register_sort_book_option_changed,
4053 gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func,
4057 gtk_widget_show (dialog);
4058 g_object_unref (G_OBJECT (builder));
4063 gnc_plugin_page_register_cmd_view_filter_by (GSimpleAction *simple,
4067 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4069 GtkWidget* dialog, *toggle, *button, *
table, *hbox;
4070 time64 start_time, end_time, time_val;
4071 GtkBuilder* builder;
4072 gboolean sensitive, value;
4077 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4078 ENTER (
"(action %p, page %p)", simple, page);
4080 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
4081 if (priv->fd.dialog)
4083 gtk_window_present (GTK_WINDOW (priv->fd.dialog));
4084 LEAVE (
"existing dialog");
4089 builder = gtk_builder_new();
4090 gnc_builder_add_from_file (builder,
"gnc-plugin-page-register.glade",
4092 gnc_builder_add_from_file (builder,
"gnc-plugin-page-register.glade",
4093 "filter_by_dialog");
4094 dialog = GTK_WIDGET (gtk_builder_get_object (builder,
"filter_by_dialog"));
4095 priv->fd.dialog = dialog;
4096 gtk_window_set_transient_for (GTK_WINDOW (dialog),
4097 gnc_window_get_gtk_window (GNC_WINDOW (GNC_PLUGIN_PAGE (page)->window)));
4100 title = g_strdup_printf (_ (
"Filter %s by…"),
4102 gtk_window_set_title (GTK_WINDOW (dialog), title);
4106 for (i = 0; status_actions[i].action_name; i++)
4108 toggle = GTK_WIDGET (gtk_builder_get_object (builder,
4109 status_actions[i].action_name));
4110 value = priv->fd.cleared_match & status_actions[i].value;
4111 status_actions[i].widget = toggle;
4112 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), value);
4114 priv->fd.original_cleared_match = priv->fd.cleared_match;
4116 button = GTK_WIDGET (gtk_builder_get_object (builder,
"filter_save"));
4117 if (priv->fd.save_filter == TRUE)
4118 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
4121 gtk_widget_set_visible (GTK_WIDGET (button),
4122 gnc_plugin_page_register_show_fs_save (page));
4125 priv->fd.num_days = GTK_WIDGET (gtk_builder_get_object (builder,
4126 "filter_show_num_days"));
4127 button = GTK_WIDGET (gtk_builder_get_object (builder,
"filter_show_days"));
4131 if (priv->fd.days > 0)
4133 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
4134 gtk_widget_set_sensitive (GTK_WIDGET (priv->fd.num_days), TRUE);
4135 gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->fd.num_days), priv->fd.days);
4136 priv->fd.original_days = priv->fd.days;
4144 gtk_widget_set_sensitive (GTK_WIDGET (priv->fd.num_days), FALSE);
4145 priv->fd.original_days = 0;
4149 xaccQueryGetDateMatchTT (query, &start_time, &end_time);
4153 priv->fd.original_start_time = start_time;
4154 priv->fd.start_time = start_time;
4155 priv->fd.original_end_time = end_time;
4156 priv->fd.end_time = end_time;
4158 button = GTK_WIDGET (gtk_builder_get_object (builder,
"filter_show_range"));
4159 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), start_time ||
4161 table = GTK_WIDGET (gtk_builder_get_object (builder,
"select_range_table"));
4162 priv->fd.table =
table;
4163 gtk_widget_set_sensitive (GTK_WIDGET (
table), start_time || end_time);
4165 priv->fd.start_date_choose = GTK_WIDGET (gtk_builder_get_object (builder,
4166 "start_date_choose"));
4167 priv->fd.start_date_today = GTK_WIDGET (gtk_builder_get_object (builder,
4168 "start_date_today"));
4169 priv->fd.end_date_choose = GTK_WIDGET (gtk_builder_get_object (builder,
4170 "end_date_choose"));
4171 priv->fd.end_date_today = GTK_WIDGET (gtk_builder_get_object (builder,
4176 if (start_time == 0)
4178 button = GTK_WIDGET (gtk_builder_get_object (builder,
"start_date_earliest"));
4179 time_val = xaccQueryGetEarliestDateFound (query);
4184 time_val = start_time;
4188 button = priv->fd.start_date_today;
4193 button = priv->fd.start_date_choose;
4197 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
4198 priv->fd.start_date = gnc_date_edit_new (
gnc_time (NULL), FALSE, FALSE);
4199 hbox = GTK_WIDGET (gtk_builder_get_object (builder,
"start_date_hbox"));
4200 gtk_box_pack_start (GTK_BOX (hbox), priv->fd.start_date, TRUE, TRUE, 0);
4201 gtk_widget_show (priv->fd.start_date);
4202 gtk_widget_set_sensitive (GTK_WIDGET (priv->fd.start_date), sensitive);
4203 gnc_date_edit_set_time (GNC_DATE_EDIT (priv->fd.start_date), time_val);
4204 g_signal_connect (G_OBJECT (priv->fd.start_date),
"date-changed",
4205 G_CALLBACK (gnc_plugin_page_register_filter_gde_changed_cb),
4213 button = GTK_WIDGET (gtk_builder_get_object (builder,
"end_date_latest"));
4214 time_val = xaccQueryGetLatestDateFound (query);
4219 time_val = end_time;
4223 button = priv->fd.end_date_today;
4228 button = priv->fd.end_date_choose;
4232 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
4233 priv->fd.end_date = gnc_date_edit_new (
gnc_time (NULL), FALSE, FALSE);
4234 hbox = GTK_WIDGET (gtk_builder_get_object (builder,
"end_date_hbox"));
4235 gtk_box_pack_start (GTK_BOX (hbox), priv->fd.end_date, TRUE, TRUE, 0);
4236 gtk_widget_show (priv->fd.end_date);
4237 gtk_widget_set_sensitive (GTK_WIDGET (priv->fd.end_date), sensitive);
4238 gnc_date_edit_set_time (GNC_DATE_EDIT (priv->fd.end_date), time_val);
4239 g_signal_connect (G_OBJECT (priv->fd.end_date),
"date-changed",
4240 G_CALLBACK (gnc_plugin_page_register_filter_gde_changed_cb),
4245 gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func,
4249 gtk_widget_show (dialog);
4250 g_object_unref (G_OBJECT (builder));
4255 gnc_plugin_page_register_cmd_reload (GSimpleAction *simple,
4259 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4263 ENTER (
"(action %p, page %p)", simple, page);
4265 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4267 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
4273 LEAVE (
"register has pending edits");
4281 gnc_plugin_page_register_cmd_style_changed (GSimpleAction *simple,
4282 GVariant *parameter,
4285 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4289 ENTER (
"(action %p, page %p)", simple, page);
4291 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4293 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
4297 g_action_change_state (G_ACTION(simple), parameter);
4299 gnc_split_reg_change_style (priv->gsr, value, priv->enable_refresh);
4301 gnc_plugin_page_register_ui_update (NULL, page);
4306 gnc_plugin_page_register_cmd_style_double_line (GSimpleAction *simple,
4307 GVariant *parameter,
4310 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4313 gboolean use_double_line;
4316 ENTER (
"(action %p, page %p)", simple, page);
4318 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER(page));
4320 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
4323 state = g_action_get_state (G_ACTION(simple));
4325 g_action_change_state (G_ACTION(simple), g_variant_new_boolean (!g_variant_get_boolean (state)));
4327 use_double_line = !g_variant_get_boolean (state);
4329 if (use_double_line != reg->use_double_line)
4332 if (priv->enable_refresh)
4335 g_variant_unref (state);
4340 gnc_plugin_page_register_cmd_transfer (GSimpleAction *simple,
4344 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4346 GncWindow* gnc_window;
4349 ENTER (
"(action %p, page %p)", simple, page);
4351 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4354 gnc_window = GNC_WINDOW (GNC_PLUGIN_PAGE (page)->window);
4355 window = GTK_WIDGET (gnc_window_get_gtk_window (gnc_window));
4356 gnc_xfer_dialog (window, account);
4361 gnc_plugin_page_register_cmd_reconcile (GSimpleAction *simple,
4365 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4368 RecnWindow* recnData;
4370 ENTER (
"(action %p, page %p)", simple, page);
4372 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4382 if (!gnc_plugin_page_register_finish_pending (GNC_PLUGIN_PAGE (page)))
4387 window = gnc_window_get_gtk_window (GNC_WINDOW (GNC_PLUGIN_PAGE (
4389 recnData = recnWindow (GTK_WIDGET (window), account);
4390 gnc_ui_reconcile_window_raise (recnData);
4395 gnc_plugin_page_register_cmd_stock_assistant (GSimpleAction *simple,
4399 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4403 ENTER (
"(action %p, page %p)", simple, page);
4405 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4406 window = gnc_window_get_gtk_window (GNC_WINDOW (GNC_PLUGIN_PAGE (page)->window));
4408 gnc_stock_transaction_assistant (GTK_WIDGET (window), account);
4414 gnc_plugin_page_register_cmd_autoclear (GSimpleAction *simple,
4418 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4421 AutoClearWindow* autoClearData;
4423 ENTER (
"(action %p, page %p)", simple, page);
4425 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4429 window = gnc_window_get_gtk_window (GNC_WINDOW (GNC_PLUGIN_PAGE (
4431 autoClearData = autoClearWindow (GTK_WIDGET (window), account);
4432 gnc_ui_autoclear_window_raise (autoClearData);
4437 gnc_plugin_page_register_cmd_stock_split (GSimpleAction *simple,
4441 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4445 ENTER (
"(action %p, page %p)", simple, page);
4447 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4450 window = gnc_window_get_gtk_window (GNC_WINDOW (GNC_PLUGIN_PAGE (page)->window));
4451 gnc_stock_split_dialog (GTK_WIDGET (window), account);
4456 gnc_plugin_page_register_cmd_lots (GSimpleAction *simple,
4460 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4464 ENTER (
"(action %p, page %p)", simple, page);
4466 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4468 window = gnc_window_get_gtk_window (GNC_WINDOW (GNC_PLUGIN_PAGE (
4471 gnc_lot_viewer_dialog (window, account);
4476 gnc_plugin_page_register_cmd_enter_transaction (GSimpleAction *simple,
4480 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4483 ENTER (
"(action %p, page %p)", simple, page);
4485 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4487 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
4488 gnc_split_reg_enter (priv->gsr, FALSE);
4493 gnc_plugin_page_register_cmd_cancel_transaction (GSimpleAction *simple,
4497 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4500 ENTER (
"(action %p, page %p)", simple, page);
4502 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4504 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
4511 gnc_plugin_page_register_cmd_delete_transaction (GSimpleAction *simple,
4515 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4518 ENTER (
"(action %p, page %p)", simple, page);
4520 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4522 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
4523 gsr_default_delete_handler (priv->gsr, NULL);
4529 gnc_plugin_page_register_cmd_linked_transaction (GSimpleAction *simple,
4533 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4536 ENTER (
"(action %p, page %p)", simple, page);
4538 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4540 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
4541 gsr_default_doclink_handler (priv->gsr);
4542 gnc_plugin_page_register_ui_update (NULL, page);
4547 gnc_plugin_page_register_cmd_linked_transaction_open (GSimpleAction *simple,
4551 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4554 ENTER (
"(action %p, page %p)", simple, page);
4556 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4558 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
4559 gsr_default_doclink_open_handler (priv->gsr);
4563 static GncInvoice* invoice_from_split (Split* split)
4565 GncInvoice* invoice;
4584 gnc_plugin_page_register_cmd_jump_linked_invoice (GSimpleAction *simple,
4588 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4591 GncInvoice* invoice;
4595 ENTER (
"(action %p, page %p)", simple, page);
4597 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4598 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
4602 window = GNC_PLUGIN_PAGE(page)->window;
4606 auto invoices = invoices_from_transaction (txn);
4607 if (invoices.empty())
4608 PERR (
"shouldn't happen: if no invoices, function is never called");
4609 else if (invoices.size() == 1)
4610 invoice = invoices[0];
4613 GList *details = NULL;
4616 for (
const auto& inv : invoices)
4621 gnc_account_print_info (gncInvoiceGetPostedAcc (inv), TRUE));
4622 details = g_list_prepend
4627 g_strdup_printf (_(
"%s %s from %s, posted %s, amount %s"),
4628 gncInvoiceGetTypeString (inv),
4629 gncInvoiceGetID (inv),
4630 gncOwnerGetName (gncInvoiceGetOwner (inv)),
4634 details = g_list_reverse (details);
4635 choice = gnc_choose_radio_option_dialog
4636 (window, _(
"Select document"),
4637 _(
"Several documents are linked with this transaction. \ 4638 Please choose one:"), _(
"Select"), 0, details);
4639 if ((choice >= 0) && ((
size_t)choice < invoices.size()))
4640 invoice = invoices[choice];
4641 g_list_free_full (details, g_free);
4647 GtkWindow *gtk_window = gnc_window_get_gtk_window (GNC_WINDOW (window));
4648 gnc_ui_invoice_edit (gtk_window, invoice);
4655 gnc_plugin_page_register_cmd_blank_transaction (GSimpleAction *simple,
4659 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4663 ENTER (
"(action %p, page %p)", simple, page);
4665 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4667 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
4673 gnc_split_reg_jump_to_blank (priv->gsr);
4678 find_after_date (Split *split,
time64* find_date)
4687 gnc_plugin_page_register_cmd_goto_date (GSimpleAction *simple,
4691 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4697 ENTER (
"(action %p, page %p)", simple, page);
4698 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4700 auto date = input_date (window, _(
"Go to Date"), _(
"Go to Date"));
4704 LEAVE (
"goto_date cancelled");
4715 auto it = g_list_find_custom (splits, &date.value(), (GCompareFunc)find_after_date);
4718 gnc_split_reg_jump_to_split (gsr, GNC_SPLIT(it->data));
4720 gnc_split_reg_jump_to_blank (gsr);
4722 g_list_free (splits);
4727 gnc_plugin_page_register_cmd_duplicate_transaction (GSimpleAction *simple,
4731 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4734 ENTER (
"(action %p, page %p)", simple, page);
4736 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4738 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
4745 gnc_plugin_page_register_cmd_reinitialize_transaction (GSimpleAction *simple,
4749 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4752 ENTER (
"(action %p, page %p)", simple, page);
4754 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4756 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
4757 gsr_default_reinit_handler (priv->gsr, NULL);
4762 gnc_plugin_page_register_cmd_expand_transaction (GSimpleAction *simple,
4763 GVariant *parameter,
4766 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4772 ENTER (
"(action %p, page %p)", simple, page);
4774 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4776 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
4779 state = g_action_get_state (G_ACTION(simple));
4781 g_action_change_state (G_ACTION(simple), g_variant_new_boolean (!g_variant_get_boolean (state)));
4783 expand = !g_variant_get_boolean (state);
4786 g_variant_unref (state);
4793 gnc_plugin_page_register_cmd_exchange_rate (GSimpleAction *simple,
4797 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4801 ENTER (
"(action %p, page %p)", simple, page);
4803 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4805 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
4814 gnc_plugin_page_register_cmd_jump (GSimpleAction *simple,
4818 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4828 ENTER (
"(action %p, page %p)", simple, page);
4830 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4832 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
4833 window = GNC_PLUGIN_PAGE (page)->window;
4836 LEAVE (
"no window");
4844 LEAVE (
"no split (1)");
4849 if (account == NULL)
4851 LEAVE (
"no account");
4856 if (account == leader)
4861 LEAVE (
"no split (2)");
4866 if (account == NULL)
4868 LEAVE (
"no account (2)");
4872 if (account == leader)
4874 LEAVE (
"register open for account");
4880 if (new_page == NULL)
4882 LEAVE (
"couldn't create new page");
4890 if (gnc_split_reg_clear_filter_for_split (gsr, split))
4893 gnc_split_reg_jump_to_split (gsr, split);
4898 gnc_plugin_page_register_cmd_schedule (GSimpleAction *simple,
4902 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4906 ENTER (
"(action %p, page %p)", simple, page);
4908 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4912 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
4913 gsr_default_schedule_handler (priv->gsr, window);
4918 scrub_split (Split *split)
4924 g_return_if_fail (split);
4928 g_return_if_fail (trans);
4940 gnc_plugin_page_register_cmd_scrub_current (GSimpleAction *simple,
4944 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
4949 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
4951 ENTER (
"(action %p, page %p)", simple, page);
4953 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
4957 LEAVE (
"no query found");
4963 gnc_suspend_gui_refresh();
4965 gnc_resume_gui_refresh();
4970 scrub_kp_handler (GtkWidget *widget, GdkEventKey *event, gpointer data)
4972 if (event->length == 0)
return FALSE;
4974 switch (event->keyval)
4976 case GDK_KEY_Escape:
4978 auto abort_scrub = gnc_verify_dialog (GTK_WINDOW(widget),
false,
4979 "%s", _(check_repair_abort_YN));
4993 gnc_plugin_page_register_cmd_scrub_all (GSimpleAction *simple,
4997 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
5001 GList* node, *splits;
5002 gint split_count = 0, curr_split_no = 0;
5003 gulong scrub_kp_handler_ID;
5004 const char* message = _ (
"Checking splits in current register: %u of %u");
5006 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
5008 ENTER (
"(action %p, page %p)", simple, page);
5010 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
5014 LEAVE (
"no query found");
5018 gnc_suspend_gui_refresh();
5019 is_scrubbing = TRUE;
5021 window = GNC_WINDOW (GNC_PLUGIN_PAGE (page)->window);
5022 scrub_kp_handler_ID = g_signal_connect (G_OBJECT (window),
"key-press-event",
5023 G_CALLBACK (scrub_kp_handler), NULL);
5024 gnc_window_set_progressbar_window (window);
5027 split_count = g_list_length (splits);
5028 for (node = splits; node && !gnc_get_abort_scrub (); node = node->next, curr_split_no++)
5030 auto split = GNC_SPLIT(node->data);
5032 if (!split)
continue;
5034 PINFO (
"Start processing split %d of %d",
5035 curr_split_no + 1, split_count);
5037 scrub_split (split);
5039 PINFO (
"Finished processing split %d of %d",
5040 curr_split_no + 1, split_count);
5042 if (curr_split_no % 10 == 0)
5044 char* progress_msg = g_strdup_printf (message, curr_split_no, split_count);
5045 gnc_window_show_progress (progress_msg, (100 * curr_split_no) / split_count);
5046 g_free (progress_msg);
5050 g_signal_handler_disconnect (G_OBJECT(window), scrub_kp_handler_ID);
5051 gnc_window_show_progress (NULL, -1.0);
5052 is_scrubbing = FALSE;
5053 show_abort_verify = TRUE;
5056 gnc_resume_gui_refresh();
5061 gnc_plugin_page_register_cmd_account_report (GSimpleAction *simple,
5065 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
5070 ENTER (
"(action %p, page %p)", simple, page);
5072 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
5074 window = GNC_MAIN_WINDOW (GNC_PLUGIN_PAGE (page)->window);
5075 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
5076 id = report_helper (priv->ledger, NULL, NULL);
5078 gnc_main_window_open_report (
id, window);
5083 gnc_plugin_page_register_cmd_transaction_report (GSimpleAction *simple,
5087 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
5096 ENTER (
"(action %p, page %p)", simple, page);
5098 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
5100 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
5107 query = qof_query_create_for (GNC_ID_SPLIT);
5112 GNC_ID_SPLIT, QOF_QUERY_AND);
5114 window = GNC_MAIN_WINDOW (GNC_PLUGIN_PAGE (page)->window);
5115 id = report_helper (priv->ledger, split, query);
5117 gnc_main_window_open_report (
id, window);
5133 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page));
5135 page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
5136 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
5137 priv->lines_default = lines_default;
5138 priv->read_only = read_only;
5147 g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (plugin_page), NULL);
5149 page = GNC_PLUGIN_PAGE_REGISTER (plugin_page);
5150 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
5156 gnc_plugin_page_help_changed_cb (GNCSplitReg* gsr,
5164 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (register_page));
5166 window = GNC_WINDOW (GNC_PLUGIN_PAGE (register_page)->window);
5176 (GNC_MAIN_WINDOW(window)) != GNC_PLUGIN_PAGE(register_page)))
5180 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (register_page);
5182 help = gnc_table_get_help (reg->table);
5183 gnc_window_set_status (window, GNC_PLUGIN_PAGE (register_page), help);
5188 gnc_plugin_page_popup_menu_cb (GNCSplitReg* gsr,
5193 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
5195 window = GNC_WINDOW (GNC_PLUGIN_PAGE (page)->window);
5203 GNC_PLUGIN_PAGE (page));
5207 gnc_plugin_page_register_refresh_cb (GHashTable* changes, gpointer user_data)
5209 auto page = GNC_PLUGIN_PAGE_REGISTER(user_data);
5212 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
5213 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
5218 ei = gnc_gui_get_entity_events (changes, &priv->key);
5221 if (ei->event_mask & QOF_EVENT_DESTROY)
5226 if (ei->event_mask & QOF_EVENT_MODIFY)
5234 gnucash_register_refresh_from_prefs (priv->gsr->reg);
5235 gtk_widget_queue_draw (priv->widget);
5238 gnc_plugin_page_register_ui_update (NULL, page);
5242 gnc_plugin_page_register_close_cb (gpointer user_data)
5257 gppr_account_destroy_cb (
Account* account)
5261 GNCLedgerDisplayType ledger_type;
5264 GList* item, *kill = NULL;
5271 for (; citem; citem = g_list_next (citem))
5274 priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
5275 ledger_type = gnc_ledger_display_type (priv->ledger);
5276 if (ledger_type == LD_GL)
5278 kill = g_list_prepend (kill, page);
5281 else if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
5283 if (guid_compare (acct_guid, &priv->key) == 0)
5285 kill = g_list_prepend (kill, page);
5290 kill = g_list_reverse (kill);
5292 for (item = kill; item; item = g_list_next (item))
5315 gnc_plugin_page_register_event_handler (
QofInstance* entity,
5325 g_return_if_fail (page);
5326 if (!GNC_IS_TRANS (entity) && !GNC_IS_ACCOUNT (entity))
5329 ENTER (
"entity %p of type %d, page %p, event data %p",
5330 entity, event_type, page, ed);
5334 if (GNC_IS_ACCOUNT (entity))
5336 if (GNC_IS_MAIN_WINDOW (window))
5342 LEAVE (
"account is NULL");
5346 gchar *name = gnc_plugin_page_register_get_tab_name (GNC_PLUGIN_PAGE (page));
5349 gchar *long_name = gnc_plugin_page_register_get_long_name (GNC_PLUGIN_PAGE (page));
5352 gchar *color = gnc_plugin_page_register_get_tab_color (GNC_PLUGIN_PAGE (page));
5355 gnc_plugin_page_register_update_page_icon (GNC_PLUGIN_PAGE (page));
5361 LEAVE (
"tab contents updated");
5365 if (! (event_type & (QOF_EVENT_MODIFY | QOF_EVENT_DESTROY)))
5367 LEAVE (
"not a modify");
5370 trans = GNC_TRANS (entity);
5374 LEAVE (
"not in this book");
5378 if (GNC_IS_MAIN_WINDOW (window))
5381 if (visible_page != GNC_PLUGIN_PAGE (page))
5383 LEAVE (
"page not visible");
5388 gnc_plugin_page_register_ui_update (NULL, page);
CursorClass gnc_split_register_get_current_cursor_class(SplitRegister *reg)
Returns the class of a register's current cursor.
Split * gnc_split_register_get_current_trans_split(SplitRegister *reg, VirtualCellLocation *trans_split_loc)
Gets the anchoring split of the transaction at the current cursor location, which may be on the trans...
void gnc_ledger_display_close(GNCLedgerDisplay *ld)
close the window
GncPluginPage * gnc_plugin_page_register_new(Account *account, gboolean subaccounts)
Create a new "register" plugin page, given a pointer to an account.
void gnc_ledger_display_set_focus(GNCLedgerDisplay *ld, gboolean focus)
Mark the ledger as being in focus (refresh immediately) or not.
Functions to load, save and get gui state.
gint xaccSplitOrder(const Split *sa, const Split *sb)
The xaccSplitOrder(sa,sb) method is useful for sorting.
GtkWidget * gnc_plugin_page_get_window(GncPluginPage *page)
Retrieve a pointer to the GncMainWindow (GtkWindow) containing this page.
gboolean xaccTransHasReconciledSplits(const Transaction *trans)
FIXME: document me.
void gnc_ledger_display_refresh(GNCLedgerDisplay *ld)
redisplay/redraw only the indicated window.
const gchar * tab_icon
The relative name of the icon that should be shown on the tab for this page.
const char * gnc_split_register_get_credit_string(SplitRegister *reg)
Return the credit string used in the register.
gboolean(* focus_page_function)(GncPluginPage *plugin_page)
This function performs specific actions to set the focus on a specific widget.
void xaccTransSetDatePostedSecsNormalized(Transaction *trans, time64 time)
This function sets the posted date of the transaction, specified by a time64 (see ctime(3))...
void gnc_main_window_update_menu_and_toolbar(GncMainWindow *window, GncPluginPage *page, const gchar **ui_updates)
Update the main window menu with the placeholders listed in ui_updates and load the page specific too...
void(* focus_page)(GncPluginPage *plugin_page, gboolean on_current_page)
Perform plugin specific actions to set the focus.
void gnc_plugin_page_register_filter_save_cb(GtkToggleButton *button, GncPluginPageRegister *page)
This function is called whenever the save status is checked or unchecked.
time64 xaccTransGetDate(const Transaction *trans)
Retrieve the posted date of the transaction.
The instance data structure for a content plugin.
const GList * gnc_gobject_tracking_get_list(const gchar *name)
Get a list of all known objects of a specified type.
void gnc_plugin_page_register_filter_days_changed_cb(GtkSpinButton *button, GncPluginPageRegister *page)
This function is called when the "number of days" spin button is changed which is then saved and upda...
gboolean xaccTransIsReadonlyByPostedDate(const Transaction *trans)
Returns TRUE if this Transaction is read-only because its posted-date is older than the "auto-readonl...
Date and Time handling routines.
gulong gnc_prefs_register_cb(const char *group, const gchar *pref_name, gpointer func, gpointer user_data)
Register a callback that gets triggered when the given preference changes.
gboolean gnc_split_register_save(SplitRegister *reg, gboolean do_commit)
Copy the contents of the current cursor to a split.
This file contains the functions to present a gui to the user for creating a new account or editing a...
gchar * gnc_g_list_stringjoin(GList *list_of_strings, const gchar *sep)
Return a string joining a GList whose elements are gchar* strings.
void gnc_split_register_unvoid_current_trans(SplitRegister *reg)
Unvoids the transaction associated with the current cursor, if non-NULL.
QofBook * qof_instance_get_book(gconstpointer inst)
Return the book pointer.
gboolean xaccAccountIsPriced(const Account *acc)
Returns true if the account is a stock, mutual fund or currency, otherwise false. ...
void(* QofEventHandler)(QofInstance *ent, QofEventId event_type, gpointer handler_data, gpointer event_data)
Handler invoked when an event is generated.
void gnc_split_register_expand_current_trans(SplitRegister *reg, gboolean expand)
Expand the current transaction if it is collapsed.
utility functions for the GnuCash UI
#define PINFO(format, args...)
Print an informational note.
void gnc_main_window_set_vis_of_items_by_action(GncMainWindow *window, const gchar **action_names, gboolean vis)
Show or hide menu and toolbar items based on a NULL terminated list of action names.
void qof_query_purge_terms(QofQuery *q, QofQueryParamList *param_list)
Remove query terms of a particular type from q.
GNCAccountType xaccAccountGetType(const Account *acc)
Returns the account's account type.
Transaction * gnc_split_register_get_current_trans(SplitRegister *reg)
Gets the transaction at the current cursor location, which may be on the transaction itself or on any...
GncPluginPage *(* recreate_page)(GtkWidget *window, GKeyFile *file, const gchar *group)
Create a new page based on the information saved during a previous instantiation of gnucash...
gboolean gnc_menubar_model_find_item(GMenuModel *menu_model, GncMenuModelSearch *gsm)
Find a GtkMenu item from the action name.
gint gnc_state_drop_sections_for(const gchar *partial_name)
Drop all sections from the state file whose name contains partial_name.
const char * xaccTransGetReadOnly(Transaction *trans)
Returns a non-NULL value if this Transaction was marked as read-only with some specific "reason" text...
#define DEBUG(format, args...)
Print a debugging message.
const gchar * gnc_plugin_page_get_page_name(GncPluginPage *page)
Retrieve the name of this page.
gboolean string_to_guid(const gchar *string, GncGUID *guid)
Given a string, replace the given guid with the parsed one unless the given value is null...
Functions that are supported by all types of windows.
void gnc_features_set_used(QofBook *book, const gchar *feature)
Indicate that the current book uses the given feature.
gboolean gnc_commodity_equal(const gnc_commodity *a, const gnc_commodity *b)
This routine returns TRUE if the two commodities are equal.
GSimpleActionGroup * gnc_plugin_page_get_action_group(GncPluginPage *page)
Retrieve the GSimpleActionGroup object associated with this page.
gpointer gnc_account_foreach_descendant_until(const Account *acc, AccountCb2 thunk, gpointer user_data)
This method will traverse all children of this accounts and their descendants, calling 'func' on each...
const char * xaccPrintAmount(gnc_numeric val, GNCPrintAmountInfo info)
Make a string representation of a gnc_numeric.
void gnc_plugin_page_register_sort_response_cb(GtkDialog *dialog, gint response, GncPluginPageRegister *plugin_page)
This function is called when the "Sort By…" dialog is closed.
QofQuery * qof_query_copy(QofQuery *q)
Make a copy of the indicated query.
gboolean qof_query_equal(const QofQuery *q1, const QofQuery *q2)
Compare two queries for equality.
GtkWidget * window
The window that contains the display widget for this plugin.
void gnc_plugin_page_register_filter_status_all_cb(GtkButton *button, GncPluginPageRegister *plugin_page)
This function is called whenever the "select all" status button is clicked.
Account * gnc_ledger_display_leader(GNCLedgerDisplay *ld)
Implementations.
void gnc_plugin_page_set_page_long_name(GncPluginPage *page, const char *name)
Set the long name of this page.
Transaction * xaccSplitGetParent(const Split *split)
Returns the parent transaction of the split.
void gnc_tm_get_today_start(struct tm *tm)
The gnc_tm_get_today_start() routine takes a pointer to a struct tm and fills it in with the first se...
GSimpleActionGroup * gnc_plugin_page_create_action_group(GncPluginPage *page, const gchar *group_name)
Create the GSimpleActionGroup object associated with this page.
gchar * guid_to_string_buff(const GncGUID *guid, gchar *str)
The guid_to_string_buff() routine puts a null-terminated string encoding of the id into the memory po...
void gnc_ledger_display_set_query(GNCLedgerDisplay *ledger_display, Query *q)
Set the query used for a register.
#define PERR(format, args...)
Log a serious error.
#define ENTER(format, args...)
Print a function entry debugging message.
Cleanup functions for business objects.
gnc_numeric gncInvoiceGetTotal(GncInvoice *invoice)
Return the "total" amount of the invoice as seen on the document (and shown to the user in the report...
GKeyFile * gnc_state_get_current(void)
Returns a pointer to the most recently loaded state.
void gnc_ui_edit_account_window(GtkWindow *parent, Account *account)
Display a window for editing the attributes of an existing account.
gboolean gnc_split_register_current_trans_expanded(SplitRegister *reg)
Return TRUE if current trans is expanded and style is REG_STYLE_LEDGER.
GncPluginPage * gnc_main_window_get_current_page(GncMainWindow *window)
Retrieve a pointer to the page that is currently at the front of the specified window.
const char * xaccTransGetDocLink(const Transaction *trans)
Gets the transaction Document Link.
void gnc_main_window_open_page(GncMainWindow *window, GncPluginPage *page)
Display a data plugin page in a window.
Query * gnc_ledger_display_get_query(GNCLedgerDisplay *ld)
return the query associated with a ledger
Functions for adding content to a window.
GncPluginPage * gnc_plugin_page_register_new_ledger(GNCLedgerDisplay *ledger)
Create a new "register" plugin page, given a pointer to an already created ledger.
void(* update_edit_menu_actions)(GncPluginPage *plugin_page, gboolean hide)
This function vector allows page specific actions to override the generic code for setting the sensit...
#define VREC
split is void
void(* destroy_widget)(GncPluginPage *plugin_page)
Function called to destroy the display widget for a particular type of plugin.
gint qof_event_register_handler(QofEventHandler handler, gpointer user_data)
Register a handler for events.
void main_window_update_page_long_name(GncPluginPage *page, const gchar *long_name_in)
Update the long name of the page in the main window.
void gnc_tm_free(struct tm *time)
free a struct tm* created with gnc_localtime() or gnc_gmtime()
const char * xaccAccountGetColor(const Account *acc)
Get the account's color.
void gnc_plugin_page_register_filter_select_range_cb(GtkRadioButton *button, GncPluginPageRegister *page)
This function is called when the radio buttons changes state.
int xaccTransCountSplits(const Transaction *trans)
Returns the number of splits in this transaction.
GNCLedgerDisplay * gnc_ledger_display_subaccounts(Account *account, gboolean mismatched_commodities)
opens up a register window to display the parent account and all of its children. ...
#define xaccAccountGetGUID(X)
void gnc_set_abort_scrub(gboolean abort)
The gnc_set_abort_scrub () method causes a currently running scrub operation to stop, if abort is TRUE; gnc_set_abort_scrub(FALSE) must be called before any scrubbing operation.
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. ...
convert single-entry accounts to clean double-entry
char * qof_print_date(time64 secs)
Convenience; calls through to qof_print_date_dmy_buff().
gboolean xaccTransHasSplitsInState(const Transaction *trans, const char state)
FIXME: document me.
QofBook * qof_session_get_book(const QofSession *session)
Returns the QofBook of this session.
gchar * gnc_account_get_full_name(const Account *account)
The gnc_account_get_full_name routine returns the fully qualified name of the account using the given...
void gnc_split_register_redraw(SplitRegister *reg)
Causes a redraw of the register window associated with reg.
Functions providing a register page for the GnuCash UI.
const char * gnc_split_register_get_debit_string(SplitRegister *reg)
Return the debit string used in the register.
void main_window_update_page_color(GncPluginPage *page, const gchar *color_in)
Update the color on the page tabs in the main window.
The class data structure for a content plugin.
void qof_query_destroy(QofQuery *query)
Frees the resources associate with a Query object.
gint QofEventId
Define the type of events allowed.
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.
void gnc_plugin_page_set_use_new_window(GncPluginPage *page, gboolean use_new)
Set the "use new window" setting associated with this page.
CursorClass
Types of cursors.
GAction * gnc_main_window_find_action(GncMainWindow *window, const gchar *action_name)
Find the GAction in the main window.
#define GUID_ENCODING_LENGTH
Number of characters needed to encode a guid as a string not including the null terminator.
Transaction * gnc_plugin_page_register_get_current_txn(GncPluginPageRegister *page)
Get the currently selected transaction in this register page.
gboolean gnc_split_register_changed(SplitRegister *reg)
Returns TRUE if the register has changed cells.
void xaccTransScrubImbalance(Transaction *trans, Account *root, Account *account)
Correct transaction imbalances.
void gnc_plugin_page_disconnect_page_changed(GncPluginPage *page)
Disconnect the page_changed_id signal callback.
gboolean gncScrubBusinessSplit(Split *split)
The gncScrubBusinessSplit() function will fix all issues found with the given split.
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.
void qof_query_set_book(QofQuery *query, QofBook *book)
Set the book to be searched.
gboolean gnc_plugin_page_has_book(GncPluginPage *page, QofBook *book)
Query a page to see if it has a reference to a given book.
void(* window_changed)(GncPluginPage *plugin_page, GtkWidget *window)
Perform plugin specific actions when a page is added to a window (or has been removed from one window...
gboolean gnc_main_window_popup_menu_cb(GtkWidget *widget, GncPluginPage *page)
Callback function invoked when the user requests that Gnucash popup the contextual menu via the keybo...
time64 gnc_time64_get_day_start(time64 time_val)
The gnc_time64_get_day_start() routine will take the given time in seconds and adjust it to the first...
void gnc_plugin_page_register_filter_response_cb(GtkDialog *dialog, gint response, GncPluginPageRegister *plugin_page)
This function is called when the "Filter By…" dialog is closed.
const gchar * plugin_name
The textual name of this plugin.
void gnc_split_register_config(SplitRegister *reg, SplitRegisterType newtype, SplitRegisterStyle newstyle, gboolean use_double_line)
Sets a split register's type, style or line use.
gchar * gnc_list_formatter(GList *strings)
This function takes a GList of char*, and uses locale-sensitive list formatter.
void qof_event_unregister_handler(gint handler_id)
Unregister an event handler.
GtkWidget *(* create_widget)(GncPluginPage *plugin_page)
Function called to create the display widget for a particular type of plugin.
time64 gnc_time64_get_today_start(void)
The gnc_time64_get_today_start() routine returns a time64 value corresponding to the first second of ...
Account * gnc_account_lookup_by_full_name(const Account *any_acc, const gchar *name)
The gnc_account_lookup_full_name() subroutine works like gnc_account_lookup_by_name, but uses fully-qualified names using the given separator.
void gnc_split_register_void_current_trans(SplitRegister *reg, const char *reason)
Voids the transaction associated with the current cursor, if non-NULL.
time64 gnc_mktime(struct tm *time)
calculate seconds from the epoch given a time struct
void xaccTransScrubOrphans(Transaction *trans)
The xaccTransScrubOrphans() method scrubs only the splits in the given transaction.
Gnome specific utility functions.
Public declarations of GnucashRegister class.
gboolean xaccAccountIsAPARType(GNCAccountType t)
Convenience function to check if the account is a valid business account type (meaning an Accounts Pa...
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(* finish_pending)(GncPluginPage *plugin_page)
This function vector is called to finish any outstanding activities.
All type declarations for the whole Gnucash engine.
#define CREC
The Split has been cleared.
void(* save_page)(GncPluginPage *page, GKeyFile *file, const gchar *group)
Save enough information about this page so that it can be recreated next time the user starts gnucash...
gnc_commodity * gnc_account_get_currency_or_parent(const Account *account)
Returns a gnc_commodity that is a currency, suitable for being a Transaction's currency.
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.
Generic api to store and retrieve preferences.
Split * gnc_split_register_duplicate_current(SplitRegister *reg)
Duplicates either the current transaction or the current split depending on the register mode and cur...
void gnc_add_accelerator_keys_for_menu(GtkWidget *menu, GMenuModel *model, GtkAccelGroup *accel_group)
Add accelerator keys for menu item widgets.
Query * gnc_plugin_page_register_get_query(GncPluginPage *plugin_page)
This function is called to get the query associated with this plugin page.
void gnc_split_register_cancel_cursor_trans_changes(SplitRegister *reg)
Cancels any changes made to the current pending transaction, reloads the table from the engine...
GncInvoice * gncInvoiceGetInvoiceFromLot(GNCLot *lot)
Given a LOT, find and return the Invoice attached to the lot.
void gnc_split_register_paste_current(SplitRegister *reg)
Pastes a previous copied entity onto the current entity, but only if the copied and current entity ha...
Transaction * xaccTransReverse(Transaction *orig)
xaccTransReverse creates a Transaction that reverses the given transaction by inverting all the numer...
GList * qof_query_run(QofQuery *query)
Perform the query, return the results.
void main_window_update_page_set_read_only_icon(GncPluginPage *page, gboolean read_only)
Update the icon on the page tabs in the main window.
gboolean qof_book_is_readonly(const QofBook *book)
Return whether the book is read only.
void gnc_plugin_page_set_page_color(GncPluginPage *page, const char *color)
Set the color of this page.
GncPluginPage * gnc_plugin_page_register_new_gl(void)
Create a new "register" plugin page containing a general journal.
GNCLedgerDisplay * gnc_ledger_display_simple(Account *account)
opens up a register window to display a single account
gboolean gncScrubBusinessLot(GNCLot *lot)
The gncScrubBusinessLot() function makes sure that the indicated lot has all the correct properties r...
Account * xaccSplitGetAccount(const Split *split)
Returns the account of this split, which was set through xaccAccountInsertSplit().
gnc_commodity * xaccAccountGetCommodity(const Account *acc)
Get the account's commodity.
const GncGUID * guid_null(void)
Returns a GncGUID which is guaranteed to never reference any entity.
time64 gnc_time64_get_today_end(void)
The gnc_time64_get_today_end() routine returns a time64 value corresponding to the last second of tod...
gboolean gnc_prefs_get_bool(const gchar *group, const gchar *pref_name)
Get a boolean value from the preferences backend.
void gnc_plugin_page_set_menu_popup_qualifier(GncPluginPage *page, const char *menu_qualifier)
Set a qualifier string for this page.
void gnc_plugin_page_inserted_cb(GncPluginPage *page, gpointer user_data)
Set up the page_changed callback for when the current page is changed.
void gnc_main_window_close_page(GncPluginPage *page)
Remove a data plugin page from a window and display the previous page.
Transaction * xaccTransGetReversedBy(const Transaction *trans)
Returns the transaction that reversed the given transaction.
Split * xaccSplitGetOtherSplit(const Split *split)
The xaccSplitGetOtherSplit() is a convenience routine that returns the other of a pair of splits...
#define LEAVE(format, args...)
Print a function exit debugging message.
void gnc_plugin_page_set_page_name(GncPluginPage *page, const char *name)
Set the name of this page.
time64 gnc_time(time64 *tbuf)
get the current time
Account * gnc_plugin_page_register_get_account(GncPluginPageRegister *page)
Get the Account associated with this register page.
void gnc_plugin_page_add_book(GncPluginPage *page, QofBook *book)
Add a book reference to the specified page.
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
void gnc_plugin_page_register_sort_order_save_cb(GtkToggleButton *button, GncPluginPageRegister *page)
This function is called whenever the save sort order is checked or unchecked which allows saving of t...
The instance data structure for a main window object.
gboolean gnc_split_register_handle_exchange(SplitRegister *reg, gboolean force_dialog)
If needed display the transfer dialog to get a price/exchange rate and adjust the price cell accordin...
void gnc_plugin_page_register_clear_current_filter(GncPluginPage *plugin_page)
This function clears the registers current filter.
void xaccTransSetDateEnteredSecs(Transaction *trans, time64 secs)
Modify the date of when the transaction was entered.
GNCLedgerDisplay * gnc_ledger_display_gl(void)
opens up a general ledger window
time64 gnc_time64_get_day_end(time64 time_val)
The gnc_time64_get_day_end() routine will take the given time in seconds and adjust it to the last se...
SplitRegister * gnc_ledger_display_get_split_register(GNCLedgerDisplay *ld)
return the split register associated with a ledger display
const char * xaccAccountGetName(const Account *acc)
Get the account's name.
The type used to store guids in C.
GNCSplitReg * gnc_plugin_page_register_get_gsr(GncPluginPage *plugin_page)
Get the GNCSplitReg data structure associated with this register page.
void gnc_plugin_page_register_sort_order_reverse_cb(GtkToggleButton *button, GncPluginPageRegister *page)
This function is called whenever the reverse sort order is checked or unchecked which allows reversin...
void main_window_update_page_name(GncPluginPage *page, const gchar *name_in)
Update the name of the page in the main window.
gboolean gnc_menubar_model_update_item(GMenuModel *menu_model, const gchar *action_name, const gchar *target, const gchar *label, const gchar *accel_name, const gchar *tooltip)
Update the GMenuModel item based on the action name by copying existing item, removing it and inserti...
GAction * gnc_plugin_page_get_action(GncPluginPage *page, const gchar *name)
Retrieve a GAction object associated with this page.
Split * gnc_split_register_get_current_split(SplitRegister *reg)
Returns the split at which the cursor is currently located.
void gnc_plugin_page_register_set_options(GncPluginPage *plugin_page, gint lines_default, gboolean read_only)
Set various register options on a newly created "register" plugin page.
SplitList * xaccTransGetSplitList(const Transaction *trans)
The xaccTransGetSplitList() method returns a GList of the splits in a transaction.
GtkWidget * summarybar
The summary bar widget (if any) that is associated with this plugin.
SplitRegisterStyle
Register styles.
GNCLot * xaccSplitGetLot(const Split *split)
Returns the pointer to the debited/credited Lot where this split belongs to, or NULL if it doesn't be...
GList * qof_query_get_books(QofQuery *q)
Return the list of books we're using.
void gnc_prefs_remove_cb_by_func(const gchar *group, const gchar *pref_name, gpointer func, gpointer user_data)
Remove a function that was registered for a callback when the given preference changed.
void gnc_split_register_copy_current(SplitRegister *reg)
Makes a copy of the current entity, either a split or a transaction, so that it can be pasted later...
Utility functions for file access.
Account * xaccAccountLookup(const GncGUID *guid, QofBook *book)
The xaccAccountLookup() subroutine will return the account associated with the given id...