31 #include <glib/gi18n.h>
34 #include "gnc-split-reg.h"
40 #include "dialog-sx-editor.h"
41 #include "dialog-sx-from-trans.h"
42 #include "gnc-component-manager.h"
43 #include "gnc-date-edit.h"
47 #include "gnc-gui-query.h"
49 #include "gnc-ledger-display.h"
53 #include "gnome-utils/gnc-warnings.h"
54 #include "gnucash-sheet.h"
57 #include "dialog-utils.h"
62 #define STATE_SECTION_REG_PREFIX "Register"
67 static GtkWidget* add_summary_label( GtkWidget *summarybar,
68 const char *label_str );
70 static void gnc_split_reg_determine_read_only(
GNCSplitReg *gsr );
77 static void gsr_setup_status_widgets(
GNCSplitReg *gsr );
79 static void gsr_update_summary_label( GtkWidget *label,
80 xaccGetBalanceFn getter,
94 void gsr_default_enter_handler (
GNCSplitReg *w, gpointer ud );
95 void gsr_default_cancel_handler (
GNCSplitReg *w, gpointer ud );
96 void gsr_default_delete_handler (
GNCSplitReg *w, gpointer ud );
97 void gsr_default_reinit_handler (
GNCSplitReg *w, gpointer ud );
98 void gsr_default_dup_handler (
GNCSplitReg *w, gpointer ud );
99 void gsr_default_schedule_handler (
GNCSplitReg *w, gpointer ud );
100 void gsr_default_expand_handler (
GNCSplitReg *w, gpointer ud );
101 void gsr_default_blank_handler (
GNCSplitReg *w, gpointer ud );
102 void gsr_default_jump_handler (
GNCSplitReg *w, gpointer ud );
103 void gsr_default_cut_handler (
GNCSplitReg *w, gpointer ud );
104 void gsr_default_cut_txn_handler (
GNCSplitReg *w, gpointer ud );
105 void gsr_default_copy_handler (
GNCSplitReg *w, gpointer ud );
106 void gsr_default_copy_txn_handler (
GNCSplitReg *w, gpointer ud );
107 void gsr_default_paste_handler (
GNCSplitReg *w, gpointer ud );
108 void gsr_default_paste_txn_handler(
GNCSplitReg *w, gpointer ud );
109 void gsr_default_void_txn_handler (
GNCSplitReg *w, gpointer ud );
110 void gsr_default_unvoid_txn_handler (
GNCSplitReg *w, gpointer ud );
111 void gsr_default_reverse_txn_handler (
GNCSplitReg *w, gpointer ud );
112 void gsr_default_associate_handler_file (
GNCSplitReg *w, gpointer ud );
113 void gsr_default_associate_handler_location (
GNCSplitReg *w, gpointer ud );
114 void gsr_default_execassociated_handler (
GNCSplitReg *w, gpointer ud );
116 static void gsr_emit_simple_signal(
GNCSplitReg *gsr,
const char *sigName );
117 static void gsr_emit_help_changed(
GnucashRegister *reg, gpointer user_data );
120 void gnc_split_reg_cut_cb(GtkWidget *w, gpointer data);
121 void gnc_split_reg_copy_cb(GtkWidget *w, gpointer data);
122 void gnc_split_reg_paste_cb(GtkWidget *w, gpointer data);
124 void gnc_split_reg_cut_trans_cb(GtkWidget *w, gpointer data);
125 void gnc_split_reg_copy_trans_cb(GtkWidget *w, gpointer data);
126 void gnc_split_reg_paste_trans_cb(GtkWidget *w, gpointer data);
127 void gnc_split_reg_void_trans_cb(GtkWidget *w, gpointer data);
128 void gnc_split_reg_unvoid_trans_cb(GtkWidget *w, gpointer data);
129 void gnc_split_reg_reverse_trans_cb(GtkWidget *w, gpointer data);
132 void gnc_split_reg_reinitialize_trans_cb(GtkWidget *w, gpointer data);
133 void gnc_split_reg_delete_trans_cb(GtkWidget *w, gpointer data);
134 void gnc_split_reg_duplicate_trans_cb(GtkWidget *w, gpointer data);
135 void gnc_split_reg_recur_cb(GtkWidget *w, gpointer data);
136 void gnc_split_reg_record_trans_cb(GtkWidget *w, gpointer data);
137 void gnc_split_reg_cancel_trans_cb(GtkWidget *w, gpointer data);
139 void gnc_split_reg_expand_trans_menu_cb(GtkWidget *widget, gpointer data);
140 void gnc_split_reg_expand_trans_toolbar_cb(GtkWidget *widget, gpointer data);
141 void gnc_split_reg_new_trans_cb(GtkWidget *widget, gpointer data);
142 void gnc_split_reg_jump_cb(GtkWidget *widget, gpointer data);
144 void gnc_split_reg_style_ledger_cb (GtkWidget *w, gpointer data);
145 void gnc_split_reg_style_auto_ledger_cb (GtkWidget *w, gpointer data);
146 void gnc_split_reg_style_journal_cb (GtkWidget *w, gpointer data);
147 void gnc_split_reg_double_line_cb (GtkWidget *w, gpointer data);
149 void gnc_split_reg_sort_standard_cb (GtkWidget *w, gpointer data);
150 void gnc_split_reg_sort_date_cb (GtkWidget *w, gpointer data);
151 void gnc_split_reg_sort_date_entered_cb (GtkWidget *w, gpointer data);
152 void gnc_split_reg_sort_date_reconciled_cb (GtkWidget *w, gpointer data);
153 void gnc_split_reg_sort_num_cb (GtkWidget *w, gpointer data);
154 void gnc_split_reg_sort_amount_cb (GtkWidget *w, gpointer data);
155 void gnc_split_reg_sort_memo_cb (GtkWidget *w, gpointer data);
156 void gnc_split_reg_sort_desc_cb (GtkWidget *w, gpointer data);
157 void gnc_split_reg_sort_action_cb (GtkWidget *w, gpointer data);
158 void gnc_split_reg_sort_notes_cb (GtkWidget *w, gpointer data);
161 void gnc_split_reg_destroy_cb(GtkWidget *widget, gpointer data);
162 void gnc_split_reg_size_allocate( GtkWidget *widget,
163 GtkAllocation *allocation,
164 gpointer user_data );
167 void gnc_split_reg_handle_exchange_cb (GtkWidget *w, gpointer data);
170 static void gnc_split_reg_init(
GNCSplitReg *gsr );
171 static void gnc_split_reg_init2(
GNCSplitReg *gsr );
173 FROM_STRING_FUNC(SortType, ENUM_LIST_SORTTYPE)
174 AS_STRING_FUNC(SortType, ENUM_LIST_SORTTYPE)
177 gnc_split_reg_get_type(
void )
179 static GType gnc_split_reg_type = 0;
181 if (!gnc_split_reg_type)
183 GTypeInfo type_info =
188 (GClassInitFunc)gnc_split_reg_class_init,
193 (GInstanceInitFunc)gnc_split_reg_init,
196 gnc_split_reg_type = g_type_register_static( GTK_TYPE_VBOX,
201 return gnc_split_reg_type;
205 enum gnc_split_reg_signal_enum
230 static guint gnc_split_reg_signals[LAST_SIGNAL] = { 0 };
236 GtkObjectClass *object_class;
237 static struct similar_signal_info
239 enum gnc_split_reg_signal_enum s;
240 const char *signal_name;
244 { ENTER_ENT_SIGNAL,
"enter_ent", G_STRUCT_OFFSET(
GNCSplitRegClass, enter_ent_cb ) },
245 { CANCEL_ENT_SIGNAL,
"cancel_ent", G_STRUCT_OFFSET(
GNCSplitRegClass, cancel_ent_cb ) },
246 { DELETE_ENT_SIGNAL,
"delete_ent", G_STRUCT_OFFSET(
GNCSplitRegClass, delete_ent_cb ) },
247 { REINIT_ENT_SIGNAL,
"reinit_ent", G_STRUCT_OFFSET(
GNCSplitRegClass, reinit_ent_cb ) },
248 { DUP_ENT_SIGNAL,
"dup_ent", G_STRUCT_OFFSET(
GNCSplitRegClass, dup_ent_cb ) },
249 { SCHEDULE_ENT_SIGNAL,
"schedule_ent", G_STRUCT_OFFSET(
GNCSplitRegClass, schedule_ent_cb ) },
250 { EXPAND_ENT_SIGNAL,
"expand_ent", G_STRUCT_OFFSET(
GNCSplitRegClass, expand_ent_cb ) },
254 { CUT_TXN_SIGNAL,
"cut_txn", G_STRUCT_OFFSET(
GNCSplitRegClass, cut_txn_cb ) },
256 { COPY_TXN_SIGNAL,
"copy_txn", G_STRUCT_OFFSET(
GNCSplitRegClass, copy_txn_cb ) },
258 { PASTE_TXN_SIGNAL,
"paste_txn", G_STRUCT_OFFSET(
GNCSplitRegClass, paste_txn_cb ) },
259 { VOID_TXN_SIGNAL,
"void_txn", G_STRUCT_OFFSET(
GNCSplitRegClass, void_txn_cb ) },
260 { UNVOID_TXN_SIGNAL,
"unvoid_txn", G_STRUCT_OFFSET(
GNCSplitRegClass, unvoid_txn_cb ) },
261 { REVERSE_TXN_SIGNAL,
"reverse_txn", G_STRUCT_OFFSET(
GNCSplitRegClass, reverse_txn_cb ) },
262 { HELP_CHANGED_SIGNAL,
"help-changed", G_STRUCT_OFFSET(
GNCSplitRegClass, help_changed_cb ) },
263 { INCLUDE_DATE_SIGNAL,
"include-date", G_STRUCT_OFFSET(
GNCSplitRegClass, include_date_cb ) },
264 { LAST_SIGNAL, NULL, 0 }
267 object_class = (GtkObjectClass*) klass;
269 for ( i = 0; signals[i].s != INCLUDE_DATE_SIGNAL; i++ )
271 gnc_split_reg_signals[ signals[i].s ] =
272 g_signal_new( signals[i].signal_name,
273 G_TYPE_FROM_CLASS(object_class),
275 signals[i].defaultOffset,
277 g_cclosure_marshal_VOID__VOID,
282 gnc_split_reg_signals[ INCLUDE_DATE_SIGNAL ] =
283 g_signal_new(
"include-date",
284 G_TYPE_FROM_CLASS(object_class),
286 signals[i++].defaultOffset,
288 g_cclosure_marshal_VOID__INT,
289 G_TYPE_NONE, 1, G_TYPE_INT );
291 g_assert( i == LAST_SIGNAL );
294 klass->enter_ent_cb = gsr_default_enter_handler;
295 klass->cancel_ent_cb = gsr_default_cancel_handler;
296 klass->delete_ent_cb = gsr_default_delete_handler;
297 klass->reinit_ent_cb = gsr_default_reinit_handler;
298 klass->dup_ent_cb = gsr_default_dup_handler;
299 klass->schedule_ent_cb = gsr_default_schedule_handler;
300 klass->expand_ent_cb = gsr_default_expand_handler;
301 klass->blank_cb = gsr_default_blank_handler;
302 klass->jump_cb = gsr_default_jump_handler;
303 klass->cut_cb = gsr_default_cut_handler;
304 klass->cut_txn_cb = gsr_default_cut_txn_handler;
305 klass->copy_cb = gsr_default_copy_handler;
306 klass->copy_txn_cb = gsr_default_copy_txn_handler;
307 klass->paste_cb = gsr_default_paste_handler;
308 klass->paste_txn_cb = gsr_default_paste_txn_handler;
309 klass->void_txn_cb = gsr_default_void_txn_handler;
310 klass->unvoid_txn_cb = gsr_default_unvoid_txn_handler;
311 klass->reverse_txn_cb = gsr_default_reverse_txn_handler;
313 klass->help_changed_cb = NULL;
314 klass->include_date_cb = NULL;
325 ENTER(
"ld=%p, parent=%p, numberOfLines=%d, read_only=%s",
326 ld, parent, numberOfLines, read_only ?
"TRUE" :
"FALSE");
328 gsrToRet = g_object_new( gnc_split_reg_get_type(), NULL );
330 gsrToRet->numRows = numberOfLines;
331 gsrToRet->read_only = read_only;
334 gsrToRet->window = GTK_WIDGET(parent);
336 gnc_split_reg_init2( gsrToRet );
338 LEAVE(
"%p", gsrToRet);
339 return GTK_WIDGET( gsrToRet );
345 gsr->sort_type = BY_STANDARD;
349 gsr->read_only = FALSE;
351 g_signal_connect( gsr,
"destroy",
352 G_CALLBACK (gnc_split_reg_destroy_cb), gsr );
360 gnc_split_reg_determine_read_only( gsr );
362 gsr_setup_status_widgets( gsr );
364 gsr_create_table( gsr );
365 gsr_setup_table( gsr );
374 ENTER(
"gsr=%p", gsr);
376 sr = gnc_ledger_display_get_split_register( gsr->
ledger );
388 GtkWidget *register_widget = NULL;
394 gchar *state_section = NULL;
396 state_section = g_strconcat (STATE_SECTION_REG_PREFIX,
" ", guidstr, NULL);
398 ENTER(
"gsr=%p", gsr);
400 gnc_ledger_display_set_user_data( gsr->
ledger, (gpointer)gsr );
401 gnc_ledger_display_set_handlers( gsr->
ledger,
402 gnc_split_reg_ld_destroy,
403 gnc_split_reg_get_parent );
406 sr = gnc_ledger_display_get_split_register( gsr->
ledger );
407 register_widget = gnucash_register_new( sr->
table );
408 gsr->
reg = GNUCASH_REGISTER( register_widget );
410 g_free (state_section);
411 gtk_box_pack_start (GTK_BOX (gsr), GTK_WIDGET(gsr->
reg), TRUE, TRUE, 0);
412 gnucash_sheet_set_window (gnucash_register_get_sheet (gsr->
reg), gsr->window);
413 gtk_widget_show ( GTK_WIDGET(gsr->
reg) );
414 g_signal_connect (gsr->
reg,
"activate_cursor",
415 G_CALLBACK(gnc_split_reg_record_cb), gsr);
416 g_signal_connect (gsr->
reg,
"redraw_all",
417 G_CALLBACK(gsr_redraw_all_cb), gsr);
418 g_signal_connect (gsr->
reg,
"redraw_help",
419 G_CALLBACK(gsr_emit_help_changed), gsr);
429 gboolean use_double_line;
431 sr = gnc_ledger_display_get_split_register( gsr->
ledger );
432 use_double_line = gnc_ledger_display_default_double_line( gsr->
ledger );
439 gnc_split_reg_destroy_cb(GtkWidget *widget, gpointer data)
452 if (gsr->window == NULL)
455 gtk_window_present( GTK_WINDOW(gsr->window) );
465 gsr_update_summary_label( GtkWidget *label,
466 xaccGetBalanceFn getter,
479 amount = (*getter)( leader );
490 strcat(
string,
" / " );
492 gnc_convert_to_euro( cmdty, amount ),
493 gnc_commodity_print_info( gnc_get_euro(), TRUE ) );
496 gnc_set_label_color( label, amount );
497 gtk_label_set_text( GTK_LABEL(label),
string );
501 account_latest_price (
Account *account)
508 if (!account)
return NULL;
512 book = gnc_account_get_book (account);
519 account_latest_price_any_currency (
Account *account)
527 if (!account)
return NULL;
530 book = gnc_account_get_book (account);
534 if (!price_list)
return NULL;
556 if ( gsr->summarybar == NULL )
559 leader = gnc_ledger_display_leader( gsr->
ledger );
564 if (commodity != NULL)
565 euro = (gnc_is_euro_currency( commodity ) &&
570 print_info = gnc_account_print_info( leader, TRUE );
571 reverse = gnc_reverse_balance( leader );
573 gsr_update_summary_label( gsr->balance_label,
574 xaccAccountGetPresentBalance,
575 leader, print_info, commodity, reverse, euro );
576 gsr_update_summary_label( gsr->cleared_label,
578 leader, print_info, commodity, reverse, euro );
579 gsr_update_summary_label( gsr->reconciled_label,
581 leader, print_info, commodity, reverse, euro );
582 gsr_update_summary_label( gsr->future_label,
584 leader, print_info, commodity, reverse, euro );
585 gsr_update_summary_label( gsr->projectedminimum_label,
586 xaccAccountGetProjectedMinimumBalance,
587 leader, print_info, commodity, reverse, euro );
590 if (gsr->shares_label != NULL)
592 print_info = gnc_account_print_info( leader, TRUE );
600 gnc_set_label_color( gsr->shares_label, amount );
601 gtk_label_set_text( GTK_LABEL(gsr->shares_label),
string );
605 if (gsr->value_label != NULL)
612 price = account_latest_price (leader);
619 print_info = gnc_commodity_print_info (currency, TRUE);
620 amount = gnc_numeric_zero ();
624 gnc_set_label_color (gsr->value_label, amount);
625 gtk_label_set_text (GTK_LABEL (gsr->value_label),
string);
630 price = account_latest_price_any_currency (leader);
633 gnc_set_label_color (gsr->value_label, gnc_numeric_zero ());
634 gtk_label_set_text (GTK_LABEL (gsr->value_label),
635 _(
"<No information>"));
644 print_info = gnc_commodity_print_info (currency, TRUE);
647 xaccAccountConvertBalanceToCurrency(leader, amount,
648 commodity, currency);
651 default_currency_amount =
652 xaccAccountConvertBalanceToCurrency(leader, amount,
657 strcat(
string,
" / " );
658 print_info = gnc_commodity_print_info (default_currency, TRUE);
663 gnc_set_label_color (gsr->value_label, amount);
664 gtk_label_set_text (GTK_LABEL (gsr->value_label),
string);
674 print_info = gnc_commodity_print_info (currency, TRUE);
682 gnc_set_label_color (gsr->value_label, amount);
683 gtk_label_set_text (GTK_LABEL (gsr->value_label),
string);
693 GNCSplitReg *gsr = gnc_ledger_display_get_user_data( ledger );
695 Account * account = gnc_ledger_display_leader(ledger);
698 gchar *state_section;
702 state_section = g_strconcat (STATE_SECTION_REG_PREFIX,
" ", guidstr, NULL);
708 reg = gnc_ledger_display_get_split_register (ledger);
710 if (reg && reg->
table)
718 g_free (state_section);
719 gnc_ledger_display_set_user_data (ledger, NULL);
723 gsr_default_cut_handler(
GNCSplitReg *gsr, gpointer data )
725 gnucash_register_cut_clipboard( gsr->
reg );
732 gnc_split_reg_cut_cb (GtkWidget *w, gpointer data)
735 gsr_emit_simple_signal( gsr,
"cut" );
739 gsr_default_copy_handler(
GNCSplitReg *gsr, gpointer data )
741 gnucash_register_copy_clipboard( gsr->
reg );
748 gnc_split_reg_copy_cb (GtkWidget *w, gpointer data)
751 gsr_emit_simple_signal( gsr,
"copy" );
755 gsr_default_paste_handler(
GNCSplitReg *gsr, gpointer data )
757 gnucash_register_paste_clipboard( gsr->
reg );
764 gnc_split_reg_paste_cb (GtkWidget *w, gpointer data)
767 gsr_emit_simple_signal( gsr,
"paste" );
771 gsr_default_cut_txn_handler(
GNCSplitReg *gsr, gpointer data )
774 (gnc_ledger_display_get_split_register( gsr->
ledger ));
781 gnc_split_reg_cut_trans_cb (GtkWidget *w, gpointer data)
784 gsr_emit_simple_signal( gsr,
"cut_txn" );
788 gsr_default_copy_txn_handler(
GNCSplitReg *gsr, gpointer data )
791 (gnc_ledger_display_get_split_register( gsr->
ledger ));
798 gnc_split_reg_copy_trans_cb(GtkWidget *w, gpointer data)
801 gsr_emit_simple_signal( gsr,
"copy_txn" );
805 gsr_default_paste_txn_handler(
GNCSplitReg *gsr, gpointer data )
808 (gnc_ledger_display_get_split_register( gsr->
ledger ));
815 gnc_split_reg_paste_trans_cb (GtkWidget *w, gpointer data)
818 gsr_emit_simple_signal( gsr,
"paste_txn" );
829 gsr_default_void_txn_handler (
GNCSplitReg *gsr, gpointer data)
835 gnc_split_reg_void_trans_cb (GtkWidget *w, gpointer data)
838 gsr_emit_simple_signal( gsr,
"void_txn" );
849 gsr_default_unvoid_txn_handler (
GNCSplitReg *gsr, gpointer data)
855 gnc_split_reg_unvoid_trans_cb (GtkWidget *w, gpointer data)
858 gsr_emit_simple_signal( gsr,
"unvoid_txn" );
869 gsr_default_reverse_txn_handler (
GNCSplitReg *gsr, gpointer data)
874 reg = gnc_ledger_display_get_split_register( gsr->
ledger );
881 gnc_error_dialog(gsr->window,
"%s",
882 _(
"A reversing entry has already been created for this transaction."));
897 gnc_split_reg_reverse_trans_cb (GtkWidget *w, gpointer data)
900 gsr_emit_simple_signal( gsr,
"reverse_txn" );
905 is_trans_readonly_and_warn (
const Transaction *trans)
909 const gchar *title = _(
"Cannot modify or delete this transaction.");
910 const gchar *message =
911 _(
"This transaction is marked read-only with the comment: '%s'");
913 if (!trans)
return FALSE;
917 dialog = gtk_message_dialog_new(NULL,
922 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
923 "%s", _(
"The date of this transaction is older than the \"Read-Only Threshold\" set for this book. "
924 "This setting can be changed in File -> Properties -> Accounts."));
925 gtk_dialog_run(GTK_DIALOG(dialog));
926 gtk_widget_destroy(dialog);
933 dialog = gtk_message_dialog_new(NULL,
938 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
940 gtk_dialog_run(GTK_DIALOG(dialog));
941 gtk_widget_destroy(dialog);
949 gsr_default_reinit_handler(
GNCSplitReg *gsr, gpointer data )
957 const gchar *warning;
959 const char *title = _(
"Remove the splits from this transaction?");
960 const char *recn_warn = _(
"This transaction contains reconciled splits. "
961 "Modifying it is not a good idea because that will "
962 "cause your reconciled balance to be off.");
964 reg = gnc_ledger_display_get_split_register( gsr->
ledger );
967 if (is_trans_readonly_and_warn(trans))
969 dialog = gtk_message_dialog_new(GTK_WINDOW(gsr->window),
970 GTK_DIALOG_DESTROY_WITH_PARENT,
976 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
978 warning = GNC_PREF_WARN_REG_SPLIT_DEL_ALL_RECD;
982 warning = GNC_PREF_WARN_REG_SPLIT_DEL_ALL;
985 gtk_dialog_add_button(GTK_DIALOG(dialog),
986 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
987 gnc_gtk_dialog_add_button(dialog, _(
"_Remove Splits"),
988 GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT);
989 response = gnc_dialog_run(GTK_DIALOG(dialog), warning);
990 gtk_widget_destroy (dialog);
991 if (response != GTK_RESPONSE_ACCEPT)
1010 gnc_split_reg_reinitialize_trans_cb(GtkWidget *widget, gpointer data)
1013 gsr_emit_simple_signal( gsr,
"reinit_ent" );
1020 gsr_default_associate_handler_file(
GNCSplitReg *gsr, gpointer data )
1028 reg = gnc_ledger_display_get_split_register( gsr->
ledger );
1041 if (cursor_class == CURSOR_CLASS_NONE)
1044 if (is_trans_readonly_and_warn(trans))
1047 dialog = gtk_file_chooser_dialog_new (
"Associate File with Transaction",
1048 GTK_WINDOW(gsr->window),
1049 GTK_FILE_CHOOSER_ACTION_OPEN,
1050 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
1051 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
1054 gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER(dialog), 0);
1055 if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
1059 uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
1060 DEBUG(
"File URI: %s\n", uri);
1064 gtk_widget_destroy (dialog);
1072 gsr_default_associate_handler_location(
GNCSplitReg *gsr, gpointer data )
1078 GtkWidget *dialog, *entry, *label, *content_area;
1080 reg = gnc_ledger_display_get_split_register( gsr->
ledger );
1093 if (cursor_class == CURSOR_CLASS_NONE)
1096 if (is_trans_readonly_and_warn(trans))
1099 dialog = gtk_dialog_new_with_buttons (
"Associate Location with Transaction",
1100 GTK_WINDOW(gsr->window),
1102 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
1103 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
1106 content_area = GTK_DIALOG (dialog)->vbox;
1109 label = gtk_label_new (
"Please enter URL:");
1110 gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
1111 gtk_container_add (GTK_CONTAINER (content_area), label);
1114 entry = gtk_entry_new ();
1115 gtk_entry_set_width_chars(GTK_ENTRY (entry), 80);
1116 gtk_entry_set_activates_default(GTK_ENTRY (entry), TRUE);
1117 gtk_container_add (GTK_CONTAINER (content_area), entry);
1120 gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
1121 gtk_container_set_border_width (GTK_CONTAINER (label), 5);
1122 gtk_container_set_border_width (GTK_CONTAINER (content_area), 5);
1125 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
1128 gtk_widget_show_all (dialog);
1130 if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
1134 uri = gtk_entry_get_text (GTK_ENTRY (entry));
1135 DEBUG(
"Location URI: %s\n", uri);
1139 gtk_widget_destroy (dialog);
1146 gsr_default_execassociated_handler(
GNCSplitReg *gsr, gpointer data )
1155 reg = gnc_ledger_display_get_split_register( gsr->
ledger );
1168 if (cursor_class == CURSOR_CLASS_NONE)
1171 #ifdef DUMP_FUNCTIONS
1173 xaccTransDump (trans,
"ExecAssociated");
1179 const gchar *message =
1180 _(
"This transaction is not associated with a URI.");
1181 gnc_error_dialog(NULL,
"%s", message);
1193 gsr_default_delete_handler(
GNCSplitReg *gsr, gpointer data )
1201 const gchar *warning;
1203 reg = gnc_ledger_display_get_split_register( gsr->
ledger );
1220 if (split == blank_split)
1227 if (cursor_class == CURSOR_CLASS_NONE)
1230 if (is_trans_readonly_and_warn(trans))
1234 if (cursor_class == CURSOR_CLASS_SPLIT)
1236 const char *format = _(
"Delete the split '%s' from the transaction '%s'?");
1237 const char *recn_warn = _(
"You would be deleting a reconciled split! "
1238 "This is not a good idea as it will cause your "
1239 "reconciled balance to be off.");
1240 const char *anchor_error = _(
"You cannot delete this split.");
1241 const char *anchor_split = _(
"This is the split anchoring this transaction "
1242 "to the register. You may not delete it from "
1243 "this register window. You may delete the "
1244 "entire transaction from this window, or you "
1245 "may navigate to a register that shows "
1246 "another side of this same transaction and "
1247 "delete the split from that register.");
1255 dialog = gtk_message_dialog_new(GTK_WINDOW(gsr->window),
1257 | GTK_DIALOG_DESTROY_WITH_PARENT,
1260 "%s", anchor_error);
1261 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
1262 "%s", anchor_split);
1263 gtk_dialog_run(GTK_DIALOG(dialog));
1264 gtk_widget_destroy (dialog);
1269 memo = (memo && *memo) ? memo : _(
"(no memo)");
1272 desc = (desc && *desc) ? desc : _(
"(no description)");
1275 buf = g_strdup_printf (format, memo, desc);
1276 dialog = gtk_message_dialog_new(GTK_WINDOW(gsr->window),
1278 | GTK_DIALOG_DESTROY_WITH_PARENT,
1279 GTK_MESSAGE_QUESTION,
1286 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
1288 warning = GNC_PREF_WARN_REG_SPLIT_DEL_RECD;
1292 warning = GNC_PREF_WARN_REG_SPLIT_DEL;
1295 gtk_dialog_add_button(GTK_DIALOG(dialog),
1296 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
1297 gnc_gtk_dialog_add_button(dialog, _(
"_Delete Split"),
1298 GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT);
1299 response = gnc_dialog_run(GTK_DIALOG(dialog), warning);
1300 gtk_widget_destroy (dialog);
1301 if (response != GTK_RESPONSE_ACCEPT)
1308 g_return_if_fail(cursor_class == CURSOR_CLASS_TRANS);
1313 const char *title = _(
"Delete the current transaction?");
1314 const char *recn_warn = _(
"You would be deleting a transaction "
1315 "with reconciled splits! "
1316 "This is not a good idea as it will cause your "
1317 "reconciled balance to be off.");
1319 dialog = gtk_message_dialog_new(GTK_WINDOW(gsr->window),
1321 | GTK_DIALOG_DESTROY_WITH_PARENT,
1322 GTK_MESSAGE_WARNING,
1327 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
1329 warning = GNC_PREF_WARN_REG_TRANS_DEL_RECD;
1333 warning = GNC_PREF_WARN_REG_TRANS_DEL;
1335 gtk_dialog_add_button(GTK_DIALOG(dialog),
1336 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
1337 gnc_gtk_dialog_add_button(dialog, _(
"_Delete Transaction"),
1338 GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT);
1339 response = gnc_dialog_run(GTK_DIALOG(dialog), warning);
1340 gtk_widget_destroy (dialog);
1341 if (response != GTK_RESPONSE_ACCEPT)
1353 gnc_split_reg_delete_trans_cb(GtkWidget *widget, gpointer data)
1356 gsr_emit_simple_signal( gsr,
"delete_ent" );
1360 gsr_default_dup_handler(
GNCSplitReg *gsr, gpointer data )
1363 (gnc_ledger_display_get_split_register( gsr->
ledger ));
1370 gnc_split_reg_duplicate_trans_cb(GtkWidget *w, gpointer data)
1373 gsr_emit_simple_signal( gsr,
"dup_ent" );
1382 gsr_default_schedule_handler(
GNCSplitReg *gsr, gpointer data )
1394 "from-sched-xaction", &fromSXId,
1398 for ( sxElts = gnc_book_get_schedxactions (gnc_get_current_book())->sx_list;
1400 sxElts = sxElts->next )
1410 gnc_ui_scheduled_xaction_editor_dialog_create(theSX, FALSE);
1415 gnc_sx_create_from_trans(pending_trans);
1419 gnc_split_reg_recur_cb(GtkWidget *w, gpointer data)
1422 gsr_emit_simple_signal( gsr,
"schedule_ent" );
1429 gnc_split_reg_record_trans_cb (GtkWidget *w, gpointer data)
1432 gsr_emit_simple_signal( gsr,
"enter_ent" );
1436 gsr_default_cancel_handler(
GNCSplitReg *gsr, gpointer data )
1439 (gnc_ledger_display_get_split_register( gsr->
ledger ));
1446 gnc_split_reg_cancel_trans_cb(GtkWidget *w, gpointer data)
1449 gsr_emit_simple_signal( gsr,
"cancel_ent" );
1453 gsr_default_expand_handler(
GNCSplitReg *gsr, gpointer data )
1462 reg = gnc_ledger_display_get_split_register (gsr->
ledger);
1466 ( ( GTK_CHECK_MENU_ITEM(gsr->split_menu_check)->active ? 1 : -1 )
1467 + ( GTK_CHECK_MENU_ITEM(gsr->split_popup_check)->active ? 1 : -1 )
1468 + ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(gsr->split_button) )
1474 expand = ( activeCount < 0 );
1482 gnc_split_reg_expand_trans_menu_cb (GtkWidget *widget, gpointer data)
1485 gsr_emit_simple_signal( gsr,
"expand_ent" );
1489 gnc_split_reg_expand_trans_toolbar_cb (GtkWidget *widget, gpointer data)
1492 gsr_emit_simple_signal( gsr,
"expand_ent" );
1511 reg = gnc_ledger_display_get_split_register( gsr->
ledger );
1514 gnucash_register_goto_virt_cell( gsr->
reg, vcell_loc );
1516 gnc_ledger_display_refresh( gsr->
ledger );
1535 reg = gnc_ledger_display_get_split_register (gsr->
ledger);
1538 gnucash_register_goto_virt_loc (gsr->
reg, virt_loc);
1540 gnc_ledger_display_refresh (gsr->
ledger);
1550 ENTER(
"gsr=%p", gsr);
1555 LEAVE(
"no blank split");
1560 gnucash_register_goto_virt_cell (gsr->
reg, vcell_loc);
1562 gnc_ledger_display_refresh (gsr->
ledger);
1575 transaction = create_balancing_transaction(gnc_get_current_book(),
1576 account, statement_date, balancing_amount);
1579 split = xaccTransFindSplitByAccount(transaction, account);
1583 g_warning(
"create_balancing_transaction failed");
1584 gnc_split_reg_jump_to_blank(gsr);
1589 gnc_split_reg_jump_to_split(gsr, split );
1641 gsr_default_blank_handler(
GNCSplitReg *gsr, gpointer data )
1645 ENTER(
"gsr=%p, gpointer=%p", gsr, data);
1647 reg = gnc_ledger_display_get_split_register (gsr->
ledger);
1652 gnc_split_reg_jump_to_blank (gsr);
1657 gnc_split_reg_new_trans_cb (GtkWidget *widget, gpointer data)
1660 gsr_emit_simple_signal( gsr,
"blank" );
1664 gsr_default_jump_handler(
GNCSplitReg *gsr, gpointer data )
1666 g_assert_not_reached();
1670 gnc_split_reg_jump_cb( GtkWidget *widget, gpointer data )
1673 gsr_emit_simple_signal( gsr,
"jump" );
1681 if (style == reg->style)
1685 gnc_ledger_display_refresh (gsr->
ledger);
1689 gnc_split_reg_style_ledger_cb (GtkWidget *w, gpointer data)
1693 if (!GTK_CHECK_MENU_ITEM(w)->active)
1696 gnc_split_reg_change_style (gsr, REG_STYLE_LEDGER);
1700 gnc_split_reg_style_auto_ledger_cb (GtkWidget *w, gpointer data)
1704 if (!GTK_CHECK_MENU_ITEM(w)->active)
1707 gnc_split_reg_change_style (gsr, REG_STYLE_AUTO_LEDGER);
1711 gnc_split_reg_style_journal_cb (GtkWidget *w, gpointer data)
1715 if (!GTK_CHECK_MENU_ITEM(w)->active)
1718 gnc_split_reg_change_style (gsr, REG_STYLE_JOURNAL);
1722 gnc_split_reg_double_line_cb (GtkWidget *w, gpointer data)
1726 gboolean use_double_line;
1728 use_double_line = GTK_CHECK_MENU_ITEM(w)->active;
1733 gnc_ledger_display_refresh( gsr->
ledger );
1737 gnc_split_reg_sort_force(
GNCSplitReg *gsr, SortType sort_code, gboolean force )
1739 Query *query = gnc_ledger_display_get_query( gsr->
ledger );
1740 gboolean show_present_divider = FALSE;
1741 GSList *p1 = NULL, *p2 = NULL, *p3 = NULL, *standard;
1744 if ((gsr->sort_type == sort_code) && !force)
1753 show_present_divider = TRUE;
1756 p1 = g_slist_prepend (p1, TRANS_DATE_POSTED);
1757 p1 = g_slist_prepend (p1, SPLIT_TRANS);
1759 show_present_divider = TRUE;
1761 case BY_DATE_ENTERED:
1762 p1 = g_slist_prepend (p1, TRANS_DATE_ENTERED);
1763 p1 = g_slist_prepend (p1, SPLIT_TRANS);
1766 case BY_DATE_RECONCILED:
1767 p1 = g_slist_prepend (p1, SPLIT_RECONCILE);
1768 p2 = g_slist_prepend (p2, SPLIT_DATE_RECONCILED);
1772 p1 = g_slist_prepend (p1, TRANS_NUM);
1773 p1 = g_slist_prepend (p1, SPLIT_TRANS);
1777 p1 = g_slist_prepend (p1, SPLIT_VALUE);
1781 p1 = g_slist_prepend (p1, SPLIT_MEMO);
1785 p1 = g_slist_prepend (p1, TRANS_DESCRIPTION);
1786 p1 = g_slist_prepend (p1, SPLIT_TRANS);
1790 p1 = g_slist_prepend (p1, SPLIT_ACTION);
1794 p1 = g_slist_prepend (p1, TRANS_NOTES);
1795 p1 = g_slist_prepend (p1, SPLIT_TRANS);
1799 g_slist_free (standard);
1800 g_return_if_fail (FALSE);
1805 reg = gnc_ledger_display_get_split_register( gsr->
ledger );
1807 gsr->sort_type = sort_code;
1808 gnc_ledger_display_refresh( gsr->
ledger );
1812 gnc_split_reg_sort(
GNCSplitReg *gsr, SortType sort_code )
1814 gnc_split_reg_sort_force( gsr, sort_code, FALSE );
1818 gnc_split_reg_sort_standard_cb(GtkWidget *w, gpointer data)
1821 gnc_split_reg_sort(gsr, BY_STANDARD);
1825 gnc_split_reg_sort_date_cb(GtkWidget *w, gpointer data)
1828 gnc_split_reg_sort(gsr, BY_DATE);
1832 gnc_split_reg_sort_date_entered_cb(GtkWidget *w, gpointer data)
1835 gnc_split_reg_sort(gsr, BY_DATE_ENTERED);
1839 gnc_split_reg_sort_date_reconciled_cb(GtkWidget *w, gpointer data)
1842 gnc_split_reg_sort(gsr, BY_DATE_RECONCILED);
1846 gnc_split_reg_sort_num_cb(GtkWidget *w, gpointer data)
1849 gnc_split_reg_sort(gsr, BY_NUM);
1853 gnc_split_reg_sort_amount_cb(GtkWidget *w, gpointer data)
1856 gnc_split_reg_sort(gsr, BY_AMOUNT);
1860 gnc_split_reg_sort_memo_cb(GtkWidget *w, gpointer data)
1863 gnc_split_reg_sort(gsr, BY_MEMO);
1867 gnc_split_reg_sort_desc_cb(GtkWidget *w, gpointer data)
1870 gnc_split_reg_sort(gsr, BY_DESC);
1874 gnc_split_reg_sort_action_cb(GtkWidget *w, gpointer data)
1877 gnc_split_reg_sort(gsr, BY_ACTION);
1881 gnc_split_reg_sort_notes_cb(GtkWidget *w, gpointer data)
1884 gnc_split_reg_sort(gsr, BY_NOTES);
1889 gnc_split_reg_set_sort_reversed(
GNCSplitReg *gsr, gboolean rev)
1891 Query *query = gnc_ledger_display_get_query( gsr->
ledger );
1893 gnc_ledger_display_refresh( gsr->
ledger );
1897 gnc_split_reg_handle_exchange_cb (GtkWidget *w, gpointer data)
1912 ENTER(
"gsr=%p", gsr);
1914 reg = gnc_ledger_display_get_split_register (gsr->
ledger);
1933 gpointer user_data )
1939 sr = gnc_ledger_display_get_split_register (gsr->
ledger);
1942 return (cursor_class == CURSOR_CLASS_TRANS);
1946 gnc_split_reg_goto_next_trans_row (
GNCSplitReg *gsr)
1948 ENTER(
"gsr=%p", gsr);
1949 gnucash_register_goto_next_matching_row( gsr->
reg,
1950 gnc_split_reg_match_trans_row,
1956 gnc_split_reg_enter(
GNCSplitReg *gsr, gboolean next_transaction )
1959 gboolean goto_blank;
1961 ENTER(
"gsr=%p, next_transaction=%s", gsr, next_transaction ?
"TRUE" :
"FALSE");
1964 GNC_PREF_ENTER_MOVES_TO_END);
1970 if ( !goto_blank && !next_transaction )
1974 if (style == REG_STYLE_LEDGER)
1979 if (blank_split != NULL)
1981 Split *current_split;
1985 if (blank_split == current_split)
1992 gnc_split_reg_record( gsr );
1994 if (!goto_blank && next_transaction)
1999 gnc_split_reg_jump_to_blank( gsr );
2000 else if (next_transaction)
2001 gnc_split_reg_goto_next_trans_row( gsr );
2003 gnucash_register_goto_next_virt_row( gsr->
reg );
2008 gsr_default_enter_handler(
GNCSplitReg *gsr, gpointer data )
2010 gnc_split_reg_enter( gsr, FALSE );
2016 gsr_emit_simple_signal( (
GNCSplitReg*)data,
"enter_ent" );
2020 gnc_split_reg_size_allocate (GtkWidget *widget,
2021 GtkAllocation *allocation,
2025 gsr->width = allocation->width;
2026 gtk_window_set_default_size( GTK_WINDOW(gsr->window), gsr->width, 0 );
2031 add_summary_label (GtkWidget *summarybar,
const char *label_str)
2036 hbox = gtk_hbox_new(FALSE, 2);
2037 gtk_box_pack_start( GTK_BOX(summarybar), hbox, FALSE, FALSE, 5 );
2039 label = gtk_label_new( label_str );
2040 gtk_misc_set_alignment( GTK_MISC(label), 1.0, 0.5 );
2041 gtk_box_pack_start( GTK_BOX(hbox), label, FALSE, FALSE, 0 );
2043 label = gtk_label_new(
"" );
2044 gtk_misc_set_alignment( GTK_MISC(label), 1.0, 0.5 );
2045 gtk_box_pack_start( GTK_BOX(hbox), label, FALSE, FALSE, 0 );
2053 GtkWidget *summarybar;
2055 gsr->cleared_label = NULL;
2056 gsr->balance_label = NULL;
2057 gsr->reconciled_label = NULL;
2058 gsr->future_label = NULL;
2059 gsr->projectedminimum_label = NULL;
2060 gsr->shares_label = NULL;
2061 gsr->value_label = NULL;
2063 if ( gnc_ledger_display_type(gsr->
ledger) >= LD_SUBACCOUNT )
2065 gsr->summarybar = NULL;
2069 summarybar = gtk_hbox_new (FALSE, 4);
2073 gsr->balance_label = add_summary_label (summarybar, _(
"Present:"));
2074 gsr->future_label = add_summary_label (summarybar, _(
"Future:"));
2075 gsr->cleared_label = add_summary_label (summarybar, _(
"Cleared:"));
2076 gsr->reconciled_label = add_summary_label (summarybar, _(
"Reconciled:"));
2077 gsr->projectedminimum_label = add_summary_label (summarybar, _(
"Projected Minimum:"));
2081 gsr->shares_label = add_summary_label (summarybar, _(
"Shares:"));
2082 gsr->value_label = add_summary_label (summarybar, _(
"Current Value:"));
2085 gsr->summarybar = summarybar;
2088 gsr_redraw_all_cb(NULL, gsr);
2089 return gsr->summarybar;
2104 gboolean single_account;
2107 return PLACEHOLDER_NONE;
2109 reg = gnc_ledger_display_get_split_register( gsr->
ledger );
2113 case GENERAL_LEDGER:
2115 case PORTFOLIO_LEDGER:
2117 single_account = FALSE;
2120 single_account = TRUE;
2124 leader = gnc_ledger_display_leader( gsr->
ledger );
2127 return PLACEHOLDER_NONE;
2131 return PLACEHOLDER_THIS;
2132 return PLACEHOLDER_NONE;
2153 gtk_callback_bug_workaround (gpointer argp)
2156 const gchar *read_only = _(
"This account register is read-only.");
2159 dialog = gtk_message_dialog_new(GTK_WINDOW(args->gsr->window),
2160 GTK_DIALOG_DESTROY_WITH_PARENT,
2161 GTK_MESSAGE_WARNING,
2164 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
2165 "%s", args->string);
2166 gnc_dialog_run(GTK_DIALOG(dialog), GNC_PREF_WARN_REG_IS_READ_ONLY);
2167 gtk_widget_destroy(dialog);
2177 gnc_split_reg_determine_read_only(
GNCSplitReg *gsr )
2186 gsr->read_only = TRUE;
2189 if ( !gsr->read_only )
2192 switch (gnc_split_reg_get_placeholder(gsr))
2194 case PLACEHOLDER_NONE:
2198 case PLACEHOLDER_THIS:
2199 args->string = _(
"This account may not be edited. If you want "
2200 "to edit transactions in this register, please "
2201 "open the account options and turn off the "
2202 "placeholder checkbox.");
2206 args->string = _(
"One of the sub-accounts selected may not be "
2207 "edited. If you want to edit transactions in "
2208 "this register, please open the sub-account "
2209 "options and turn off the placeholder checkbox. "
2210 "You may also open an individual account instead "
2211 "of a set of accounts.");
2214 gsr->read_only = TRUE;
2217 g_timeout_add (250, gtk_callback_bug_workaround, args);
2221 reg = gnc_ledger_display_get_split_register( gsr->
ledger );
2231 GNC_SPLIT_REG(gnc_ledger_display_get_user_data( ledger ));
2243 gsr_emit_simple_signal( (
GNCSplitReg*)user_data,
"help-changed" );
2250 g_signal_emit_by_name( gsr,
"include-date", date, NULL );
2255 gsr_emit_simple_signal(
GNCSplitReg *gsr,
const char *sigName )
2257 g_signal_emit_by_name( gsr, sigName, NULL );
2273 return gsr->sort_type;
2277 gnc_split_reg_set_sort_type(
GNCSplitReg *gsr, SortType t )
2279 gnc_split_reg_sort( gsr, t );
2283 gnc_split_reg_set_sort_type_force(
GNCSplitReg *gsr, SortType t, gboolean force )
2285 gnc_split_reg_sort_force( gsr, t, force );
2292 if ( !gsr )
return NULL;
2293 return gsr->summarybar;
2300 return gsr->read_only;
2304 gnc_split_reg_set_moved_cb(
GNCSplitReg *gsr, GFunc cb, gpointer cb_data )
2306 gnucash_register_set_moved_cb (gsr->
reg, cb, cb_data);
void xaccSplitSetValue(Split *s, gnc_numeric amt)
void gnc_price_list_destroy(PriceList *prices)
Transaction * gnc_split_register_get_current_trans(SplitRegister *reg)
gboolean xaccTransHasReconciledSplits(const Transaction *trans)
#define xaccTransAppendSplit(t, s)
Transaction * xaccMallocTransaction(QofBook *book)
gboolean gnc_numeric_equal(gnc_numeric a, gnc_numeric b)
void xaccTransSetDatePostedSecsNormalized(Transaction *trans, time64 time)
int gnc_commodity_get_fraction(const gnc_commodity *cm)
void qof_instance_get(const QofInstance *inst, const gchar *first_param,...)
Wrapper for g_object_get.
Split * xaccTransGetSplit(const Transaction *trans, int i)
void gnc_split_register_cancel_cursor_split_changes(SplitRegister *reg)
time64 xaccTransGetDate(const Transaction *trans)
gboolean xaccTransIsReadonlyByPostedDate(const Transaction *trans)
const char * gnc_commodity_get_mnemonic(const gnc_commodity *cm)
Dialog for create/edit an account.
gboolean xaccAccountIsPriced(const Account *acc)
a simple price database for gnucash
utility functions for the GnuCash UI
void gnc_split_register_copy_current(SplitRegister *reg)
The type, style and table for the register.
void qof_query_set_sort_order(QofQuery *q, QofQueryParamList *primary_sort_params, QofQueryParamList *secondary_sort_params, QofQueryParamList *tertiary_sort_params)
const char * xaccTransGetAssociation(const Transaction *trans)
gnc_numeric gnc_numeric_neg(gnc_numeric a)
Split * gnc_split_register_get_current_split(SplitRegister *reg)
void gnc_split_register_delete_current_split(SplitRegister *reg)
void gnc_price_unref(GNCPrice *p)
#define DEBUG(format, args...)
Split * gnc_split_register_get_blank_split(SplitRegister *reg)
char xaccSplitGetReconcile(const Split *split)
void xaccTransSetDescription(Transaction *trans, const char *desc)
CursorClass gnc_split_register_get_cursor_class(SplitRegister *reg, VirtualCellLocation vcell_loc)
Split * gnc_split_register_get_current_trans_split(SplitRegister *reg, VirtualCellLocation *trans_split_loc)
gboolean gnc_numeric_zero_p(gnc_numeric a)
Transaction * xaccSplitGetParent(const Split *split)
gchar * guid_to_string_buff(const GncGUID *guid, gchar *buff)
void qof_query_set_sort_increasing(QofQuery *q, gboolean prim_inc, gboolean sec_inc, gboolean tert_inc)
void gnc_split_register_expand_current_trans(SplitRegister *reg, gboolean expand)
gboolean gnc_split_register_save(SplitRegister *reg, gboolean do_commit)
#define ENTER(format, args...)
gnc_numeric xaccAccountGetClearedBalance(const Account *acc)
GNCPriceDB * gnc_pricedb_get_db(QofBook *book)
void xaccTransSetCurrency(Transaction *trans, gnc_commodity *curr)
gnc_commodity * gnc_default_currency(void)
gboolean qof_log_check(QofLogModule log_module, QofLogLevel log_level)
void gnc_split_register_redraw(SplitRegister *reg)
gboolean gnc_split_register_get_split_virt_loc(SplitRegister *reg, Split *split, VirtualCellLocation *vcell_loc)
#define xaccAccountGetGUID(X)
void xaccSplitSetAmount(Split *s, gnc_numeric amt)
void xaccTransSetAssociation(Transaction *trans, const char *assoc)
void gnc_split_register_paste_current(SplitRegister *reg)
Account handling public routines.
gboolean guid_equal(const GncGUID *guid_1, const GncGUID *guid_2)
gnc_numeric gnc_numeric_mul(gnc_numeric a, gnc_numeric b, gint64 denom, gint how)
#define GUID_ENCODING_LENGTH
GNCPlaceholderType xaccAccountGetDescendantPlaceholder(const Account *acc)
Anchor Scheduled Transaction info in a book. See src/doc/books.txt for design overview.
void gnc_table_save_state(Table *table, gchar *state_section)
const char * xaccTransGetDescription(const Transaction *trans)
PriceList * gnc_pricedb_lookup_latest_any_currency(GNCPriceDB *db, const gnc_commodity *commodity)
Gnome specific utility functions.
void xaccTransCommitEdit(Transaction *trans)
#define xaccSchedXactionGetGUID(X)
void xaccTransBeginEdit(Transaction *trans)
gnc_numeric xaccAccountGetReconciledBalance(const Account *acc)
void gnc_table_init_gui(GtkWidget *widget, gchar *state_section)
const char * xaccTransGetReadOnly(const Transaction *trans)
All type declarations for the whole Gnucash engine.
gnc_numeric xaccAccountGetBalance(const Account *acc)
int xaccSPrintAmount(char *bufp, gnc_numeric val, GNCPrintAmountInfo info)
void gnc_split_register_empty_current_trans_except_split(SplitRegister *reg, Split *split)
Split * xaccMallocSplit(QofBook *book)
Generic api to store and retrieve preferences.
void gnc_split_register_set_read_only(SplitRegister *reg, gboolean read_only)
gnc_commodity * gnc_account_or_default_currency(const Account *account, gboolean *currency_from_account_found)
Transaction * xaccTransReverse(Transaction *orig)
void gnc_launch_assoc(const char *uri)
gboolean qof_book_is_readonly(const QofBook *book)
gboolean gnc_split_register_handle_exchange(SplitRegister *reg, gboolean force_dialog)
GNCPrice * gnc_price_clone(GNCPrice *p, QofBook *book)
void xaccAccountBeginEdit(Account *acc)
CursorClass gnc_split_register_get_current_cursor_class(SplitRegister *reg)
gnc_commodity * xaccAccountGetCommodity(const Account *acc)
#define xaccAccountInsertSplit(acc, s)
GNCLedgerDisplay * ledger
gboolean xaccAccountGetPlaceholder(const Account *acc)
gboolean gnc_prefs_get_bool(const gchar *group, const gchar *pref_name)
Declarations for the Table object.
Transaction * xaccTransGetReversedBy(const Transaction *trans)
#define LEAVE(format, args...)
void gnc_split_register_delete_current_trans(SplitRegister *reg)
gboolean gnc_split_register_get_split_amount_virt_loc(SplitRegister *reg, Split *split, VirtualLocation *virt_loc)
Split * gnc_split_register_duplicate_current(SplitRegister *reg)
#define QUERY_DEFAULT_SORT
time64 gnc_time(time64 *tbuf)
get the current local time
const char * xaccSplitGetMemo(const Split *split)
void gnc_split_register_show_present_divider(SplitRegister *reg, gboolean show_present)
GNCPrice * gnc_pricedb_lookup_latest(GNCPriceDB *db, const gnc_commodity *commodity, const gnc_commodity *currency)
void xaccTransSetDateEnteredSecs(Transaction *trans, time64 secs)
void gnc_split_register_cut_current(SplitRegister *reg)
void xaccAccountCommitEdit(Account *acc)
void gnc_split_register_cancel_cursor_trans_changes(SplitRegister *reg)
const gchar * QofLogModule
void gnc_split_register_config(SplitRegister *reg, SplitRegisterType newtype, SplitRegisterStyle newstyle, gboolean use_double_line)