Merge Bob Fewell's 'fixes03' into maint.

This commit is contained in:
John Ralls 2018-12-25 11:11:27 -08:00
commit 53680e6100
26 changed files with 331 additions and 129 deletions

View File

@ -40,7 +40,7 @@
#include "engine-helpers.h" #include "engine-helpers.h"
#include "qofbookslots.h" #include "qofbookslots.h"
#include "Transaction.h" /* for the SPLIT_* and TRANS_* */ #include "Transaction.h" /* for the SPLIT_* and TRANS_* */
#include "dialog-search.h" #include "dialog-search.h"
#include "search-core-type.h" #include "search-core-type.h"
@ -73,6 +73,7 @@ struct _GNCSearchWindow
GtkWidget *grouping_combo; GtkWidget *grouping_combo;
GtkWidget *match_all_label; GtkWidget *match_all_label;
GtkWidget *criteria_table; GtkWidget *criteria_table;
GtkWidget *criteria_scroll_window;
GtkWidget *result_hbox; GtkWidget *result_hbox;
/* The "results" sub-window widgets */ /* The "results" sub-window widgets */
@ -165,7 +166,6 @@ gnc_search_callback_button_execute (GNCSearchCallbackButton *cb,
} }
} }
static void static void
gnc_search_dialog_result_clicked (GtkButton *button, GNCSearchWindow *sw) gnc_search_dialog_result_clicked (GtkButton *button, GNCSearchWindow *sw)
{ {
@ -175,7 +175,6 @@ gnc_search_dialog_result_clicked (GtkButton *button, GNCSearchWindow *sw)
gnc_search_callback_button_execute (cb, sw); gnc_search_callback_button_execute (cb, sw);
} }
static void static void
gnc_search_dialog_select_buttons_enable (GNCSearchWindow *sw, gint selected) gnc_search_dialog_select_buttons_enable (GNCSearchWindow *sw, gint selected)
{ {
@ -218,7 +217,6 @@ gnc_search_dialog_select_buttons_enable (GNCSearchWindow *sw, gint selected)
} }
} }
static void static void
gnc_search_dialog_select_cb (GtkButton *button, GNCSearchWindow *sw) gnc_search_dialog_select_cb (GtkButton *button, GNCSearchWindow *sw)
{ {
@ -237,7 +235,6 @@ gnc_search_dialog_select_cb (GtkButton *button, GNCSearchWindow *sw)
gnc_search_dialog_destroy (sw); gnc_search_dialog_destroy (sw);
} }
static void static void
gnc_search_dialog_select_row_cb (GNCQueryView *qview, gnc_search_dialog_select_row_cb (GNCQueryView *qview,
gpointer item, gpointer item,
@ -248,7 +245,6 @@ gnc_search_dialog_select_row_cb (GNCQueryView *qview,
gnc_search_dialog_select_buttons_enable(sw, number_of_rows); gnc_search_dialog_select_buttons_enable(sw, number_of_rows);
} }
static void static void
gnc_search_dialog_double_click_cb (GNCQueryView *qview, gnc_search_dialog_double_click_cb (GNCQueryView *qview,
gpointer item, gpointer item,
@ -266,7 +262,6 @@ gnc_search_dialog_double_click_cb (GNCQueryView *qview,
/* If we get here, then nothing to do for a double-click */ /* If we get here, then nothing to do for a double-click */
} }
static void static void
gnc_search_dialog_init_result_view (GNCSearchWindow *sw) gnc_search_dialog_init_result_view (GNCSearchWindow *sw)
{ {
@ -289,7 +284,6 @@ gnc_search_dialog_init_result_view (GNCSearchWindow *sw)
G_CALLBACK(gnc_search_dialog_double_click_cb), sw); G_CALLBACK(gnc_search_dialog_double_click_cb), sw);
} }
static void static void
gnc_search_dialog_display_results (GNCSearchWindow *sw) gnc_search_dialog_display_results (GNCSearchWindow *sw)
{ {
@ -375,14 +369,12 @@ gnc_search_dialog_display_results (GNCSearchWindow *sw)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (sw->new_rb), TRUE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (sw->new_rb), TRUE);
} }
static void static void
match_combo_changed (GtkComboBoxText *combo_box, GNCSearchWindow *sw) match_combo_changed (GtkComboBoxText *combo_box, GNCSearchWindow *sw)
{ {
sw->grouping = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box)); sw->grouping = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box));
} }
static void static void
search_type_cb (GtkToggleButton *button, GNCSearchWindow *sw) search_type_cb (GtkToggleButton *button, GNCSearchWindow *sw)
{ {
@ -395,7 +387,6 @@ search_type_cb (GtkToggleButton *button, GNCSearchWindow *sw)
} }
} }
static void static void
search_active_only_cb (GtkToggleButton *button, GNCSearchWindow *sw) search_active_only_cb (GtkToggleButton *button, GNCSearchWindow *sw)
{ {
@ -489,19 +480,19 @@ search_update_query (GNCSearchWindow *sw)
switch (sw->search_type) switch (sw->search_type)
{ {
case 0: /* New */ case 0: /* New */
new_q = qof_query_merge (sw->start_q, q, QOF_QUERY_AND); new_q = qof_query_merge (sw->start_q, q, QOF_QUERY_AND);
qof_query_destroy (q); qof_query_destroy (q);
break; break;
case 1: /* Refine */ case 1: /* Refine */
new_q = qof_query_merge (sw->q, q, QOF_QUERY_AND); new_q = qof_query_merge (sw->q, q, QOF_QUERY_AND);
qof_query_destroy (q); qof_query_destroy (q);
break; break;
case 2: /* Add */ case 2: /* Add */
new_q = qof_query_merge (sw->q, q, QOF_QUERY_OR); new_q = qof_query_merge (sw->q, q, QOF_QUERY_OR);
qof_query_destroy (q); qof_query_destroy (q);
break; break;
case 3: /* Delete */ case 3: /* Delete */
q2 = qof_query_invert (q); q2 = qof_query_invert (q);
new_q = qof_query_merge (sw->q, q2, QOF_QUERY_AND); new_q = qof_query_merge (sw->q, q2, QOF_QUERY_AND);
qof_query_destroy (q2); qof_query_destroy (q2);
@ -527,7 +518,6 @@ search_update_query (GNCSearchWindow *sw)
sw->q = new_q; sw->q = new_q;
} }
static void static void
gnc_search_dialog_show_close_cancel (GNCSearchWindow *sw) gnc_search_dialog_show_close_cancel (GNCSearchWindow *sw)
{ {
@ -543,11 +533,11 @@ gnc_search_dialog_show_close_cancel (GNCSearchWindow *sw)
} }
} }
static void static void
gnc_search_dialog_reset_widgets (GNCSearchWindow *sw) gnc_search_dialog_reset_widgets (GNCSearchWindow *sw)
{ {
gboolean sens = (sw->q != NULL); gboolean sens = (sw->q != NULL);
gboolean crit_list_vis = FALSE;
gtk_widget_set_sensitive(GTK_WIDGET(sw->narrow_rb), sens); gtk_widget_set_sensitive(GTK_WIDGET(sw->narrow_rb), sens);
gtk_widget_set_sensitive(GTK_WIDGET(sw->add_rb), sens); gtk_widget_set_sensitive(GTK_WIDGET(sw->add_rb), sens);
@ -560,17 +550,12 @@ gnc_search_dialog_reset_widgets (GNCSearchWindow *sw)
} }
if (sw->crit_list) if (sw->crit_list)
{ crit_list_vis = TRUE;
gtk_widget_set_sensitive(sw->grouping_combo, TRUE);
gtk_widget_hide(sw->match_all_label);
}
else
{
gtk_widget_set_sensitive(sw->grouping_combo, FALSE);
gtk_widget_show(sw->match_all_label);
}
}
gtk_widget_set_sensitive(sw->grouping_combo, crit_list_vis);
gtk_widget_set_visible (sw->criteria_scroll_window, crit_list_vis);
gtk_widget_set_visible (sw->match_all_label, !crit_list_vis);
}
static gboolean static gboolean
gnc_search_dialog_crit_ok (GNCSearchWindow *sw) gnc_search_dialog_crit_ok (GNCSearchWindow *sw)
@ -592,7 +577,6 @@ gnc_search_dialog_crit_ok (GNCSearchWindow *sw)
return ret; return ret;
} }
static void static void
search_find_cb (GtkButton *button, GNCSearchWindow *sw) search_find_cb (GtkButton *button, GNCSearchWindow *sw)
{ {
@ -617,7 +601,6 @@ search_find_cb (GtkButton *button, GNCSearchWindow *sw)
gnc_search_dialog_display_results (sw); gnc_search_dialog_display_results (sw);
} }
static void static void
search_new_item_cb (GtkButton *button, GNCSearchWindow *sw) search_new_item_cb (GtkButton *button, GNCSearchWindow *sw)
{ {
@ -651,7 +634,6 @@ search_new_item_cb (GtkButton *button, GNCSearchWindow *sw)
} }
} }
static void static void
search_cancel_cb (GtkButton *button, GNCSearchWindow *sw) search_cancel_cb (GtkButton *button, GNCSearchWindow *sw)
{ {
@ -659,14 +641,12 @@ search_cancel_cb (GtkButton *button, GNCSearchWindow *sw)
gnc_search_dialog_destroy (sw); gnc_search_dialog_destroy (sw);
} }
static void static void
search_help_cb (GtkButton *button, GNCSearchWindow *sw) search_help_cb (GtkButton *button, GNCSearchWindow *sw)
{ {
gnc_gnome_help (HF_HELP, HL_FIND_TRANSACTIONS); gnc_gnome_help (HF_HELP, HL_FIND_TRANSACTIONS);
} }
static void static void
remove_element (GtkWidget *button, GNCSearchWindow *sw) remove_element (GtkWidget *button, GNCSearchWindow *sw)
{ {
@ -691,10 +671,10 @@ remove_element (GtkWidget *button, GNCSearchWindow *sw)
{ {
gtk_widget_set_sensitive(sw->grouping_combo, FALSE); gtk_widget_set_sensitive(sw->grouping_combo, FALSE);
gtk_widget_show(sw->match_all_label); gtk_widget_show(sw->match_all_label);
gtk_widget_hide(sw->criteria_scroll_window);
} }
} }
static void static void
attach_element (GtkWidget *element, GNCSearchWindow *sw, int row) attach_element (GtkWidget *element, GNCSearchWindow *sw, int row)
{ {
@ -720,10 +700,9 @@ attach_element (GtkWidget *element, GNCSearchWindow *sw, int row)
g_object_set (remove, "margin", 0, NULL); g_object_set (remove, "margin", 0, NULL);
gtk_widget_show (remove); gtk_widget_show (remove);
data->button = remove; /* Save the button for later */ data->button = remove; /* Save the button for later */
} }
static void static void
combo_box_changed (GtkComboBox *combo_box, struct _crit_data *data) combo_box_changed (GtkComboBox *combo_box, struct _crit_data *data)
{ {
@ -776,7 +755,6 @@ combo_box_changed (GtkComboBox *combo_box, struct _crit_data *data)
gnc_search_core_type_editable_enters (newelem); gnc_search_core_type_editable_enters (newelem);
} }
static void static void
search_clear_criteria (GNCSearchWindow *sw) search_clear_criteria (GNCSearchWindow *sw)
{ {
@ -792,7 +770,6 @@ search_clear_criteria (GNCSearchWindow *sw)
} }
} }
static GtkWidget * static GtkWidget *
get_comb_box_widget (GNCSearchWindow *sw, struct _crit_data *data) get_comb_box_widget (GNCSearchWindow *sw, struct _crit_data *data)
{ {
@ -986,6 +963,7 @@ gnc_search_dialog_add_criterion (GNCSearchWindow *sw)
/* no match-all situation anymore */ /* no match-all situation anymore */
gtk_widget_set_sensitive(sw->grouping_combo, TRUE); gtk_widget_set_sensitive(sw->grouping_combo, TRUE);
gtk_widget_hide(sw->match_all_label); gtk_widget_hide(sw->match_all_label);
gtk_widget_show(sw->criteria_scroll_window);
} }
/* create a new criterion element */ /* create a new criterion element */
new_sct = gnc_search_core_type_new_type_name new_sct = gnc_search_core_type_new_type_name
@ -1010,14 +988,12 @@ gnc_search_dialog_add_criterion (GNCSearchWindow *sw)
} }
} }
static void static void
add_criterion (GtkWidget *button, GNCSearchWindow *sw) add_criterion (GtkWidget *button, GNCSearchWindow *sw)
{ {
gnc_search_dialog_add_criterion (sw); gnc_search_dialog_add_criterion (sw);
} }
static int static int
gnc_search_dialog_close_cb (GtkDialog *dialog, GNCSearchWindow *sw) gnc_search_dialog_close_cb (GtkDialog *dialog, GNCSearchWindow *sw)
{ {
@ -1050,7 +1026,6 @@ gnc_search_dialog_close_cb (GtkDialog *dialog, GNCSearchWindow *sw)
return FALSE; return FALSE;
} }
static void static void
refresh_handler (GHashTable *changes, gpointer data) refresh_handler (GHashTable *changes, gpointer data)
{ {
@ -1063,7 +1038,6 @@ refresh_handler (GHashTable *changes, gpointer data)
gnc_search_dialog_display_results (sw); gnc_search_dialog_display_results (sw);
} }
static void static void
close_handler (gpointer data) close_handler (gpointer data)
{ {
@ -1074,7 +1048,6 @@ close_handler (gpointer data)
/* DRH: should sw be freed here? */ /* DRH: should sw be freed here? */
} }
static const gchar * static const gchar *
type_label_to_new_button(const gchar* type_label) type_label_to_new_button(const gchar* type_label)
{ {
@ -1126,7 +1099,6 @@ type_label_to_new_button(const gchar* type_label)
} }
} }
static void static void
gnc_search_dialog_init_widgets (GNCSearchWindow *sw, const gchar *title) gnc_search_dialog_init_widgets (GNCSearchWindow *sw, const gchar *title)
{ {
@ -1154,6 +1126,7 @@ gnc_search_dialog_init_widgets (GNCSearchWindow *sw, const gchar *title)
/* Grab the search-table widget */ /* Grab the search-table widget */
sw->criteria_table = GTK_WIDGET(gtk_builder_get_object (builder, "criteria_table")); sw->criteria_table = GTK_WIDGET(gtk_builder_get_object (builder, "criteria_table"));
sw->criteria_scroll_window = GTK_WIDGET(gtk_builder_get_object (builder, "criteria_scroll_window"));
/* Set the type label */ /* Set the type label */
label = GTK_WIDGET(gtk_builder_get_object (builder, "type_label")); label = GTK_WIDGET(gtk_builder_get_object (builder, "type_label"));
@ -1272,7 +1245,6 @@ gnc_search_dialog_init_widgets (GNCSearchWindow *sw, const gchar *title)
g_object_unref(G_OBJECT(builder)); g_object_unref(G_OBJECT(builder));
} }
void void
gnc_search_dialog_destroy (GNCSearchWindow *sw) gnc_search_dialog_destroy (GNCSearchWindow *sw)
{ {
@ -1282,7 +1254,6 @@ gnc_search_dialog_destroy (GNCSearchWindow *sw)
gnc_close_gui_component (sw->component_id); gnc_close_gui_component (sw->component_id);
} }
void void
gnc_search_dialog_raise (GNCSearchWindow *sw) gnc_search_dialog_raise (GNCSearchWindow *sw)
{ {
@ -1356,7 +1327,6 @@ gnc_search_dialog_create (GtkWindow *parent,
return sw; return sw;
} }
/* Register an on-close signal with the Search Dialog */ /* Register an on-close signal with the Search Dialog */
guint gnc_search_dialog_connect_on_close (GNCSearchWindow *sw, guint gnc_search_dialog_connect_on_close (GNCSearchWindow *sw,
GCallback func, GCallback func,
@ -1371,7 +1341,6 @@ guint gnc_search_dialog_connect_on_close (GNCSearchWindow *sw,
} }
/* Un-register the signal handlers with the Search Dialog */ /* Un-register the signal handlers with the Search Dialog */
void gnc_search_dialog_disconnect (GNCSearchWindow *sw, gpointer user_data) void gnc_search_dialog_disconnect (GNCSearchWindow *sw, gpointer user_data)
{ {
@ -1382,7 +1351,6 @@ void gnc_search_dialog_disconnect (GNCSearchWindow *sw, gpointer user_data)
0, 0, NULL, NULL, user_data); 0, 0, NULL, NULL, user_data);
} }
/* Clear all callbacks with this Search Window */ /* Clear all callbacks with this Search Window */
void gnc_search_dialog_set_select_cb (GNCSearchWindow *sw, void gnc_search_dialog_set_select_cb (GNCSearchWindow *sw,
GNCSearchSelectedCB selected_cb, GNCSearchSelectedCB selected_cb,
@ -1441,7 +1409,6 @@ get_params_list (QofIdTypeConst type)
return list; return list;
} }
static GList * static GList *
get_display_list (QofIdTypeConst type) get_display_list (QofIdTypeConst type)
{ {
@ -1463,7 +1430,6 @@ do_nothing (GtkWindow *dialog, gpointer *a, gpointer b)
return; return;
} }
void void
gnc_search_dialog_test (void) gnc_search_dialog_test (void)
{ {
@ -1490,8 +1456,7 @@ gnc_search_dialog_test (void)
/* (keep the line break below to avoid a translator comment) */ /* (keep the line break below to avoid a translator comment) */
gnc_search_dialog_create (NULL, GNC_ID_SPLIT, gnc_search_dialog_create (NULL, GNC_ID_SPLIT,
_("Find Transaction"), _("Find Transaction"),
params, display, params, display,
NULL, NULL, buttons, NULL, NULL, NULL, NULL, NULL, NULL, buttons, NULL, NULL, NULL, NULL,
NULL, NULL, NULL); NULL, NULL, NULL);
} }

View File

@ -230,12 +230,13 @@ gnc_account_to_ui(AccountWindow *aw)
string = xaccAccountGetColor (account); string = xaccAccountGetColor (account);
if ((string == NULL) || (g_strcmp0 ("Not Set", string) == 0)) if (!string)
string = DEFAULT_COLOR; string = DEFAULT_COLOR;
if (gdk_rgba_parse(&color, string))
{ if (!gdk_rgba_parse (&color, string))
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(aw->color_entry_button), &color); gdk_rgba_parse (&color, DEFAULT_COLOR);
}
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(aw->color_entry_button), &color);
commodity = xaccAccountGetCommodity (account); commodity = xaccAccountGetCommodity (account);
gnc_general_select_set_selected (GNC_GENERAL_SELECT (aw->commodity_edit), gnc_general_select_set_selected (GNC_GENERAL_SELECT (aw->commodity_edit),
@ -380,12 +381,19 @@ gnc_ui_to_account(AccountWindow *aw)
gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(aw->color_entry_button), &color ); gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(aw->color_entry_button), &color );
string = gdk_rgba_to_string(&color); string = gdk_rgba_to_string(&color);
if (g_strcmp0 (string, DEFAULT_COLOR) == 0) if (g_strcmp0 (string, DEFAULT_COLOR) == 0)
string = "Not Set"; string = NULL;
old_string = xaccAccountGetColor (account); old_string = xaccAccountGetColor (account);
if (g_strcmp0 (string, old_string) != 0)
xaccAccountSetColor (account, string); if (!string && old_string)
xaccAccountSetColor (account, ""); // remove entry
else
{
if (g_strcmp0 (string, old_string) != 0)
xaccAccountSetColor (account, string); // update entry
}
commodity = (gnc_commodity *) commodity = (gnc_commodity *)
gnc_general_select_get_selected (GNC_GENERAL_SELECT (aw->commodity_edit)); gnc_general_select_get_selected (GNC_GENERAL_SELECT (aw->commodity_edit));
@ -2094,16 +2102,24 @@ default_color_button_cb (GtkButton *button, gpointer user_data)
static void static void
update_account_color (Account *acc, const gchar *old_color, const gchar *new_color, gboolean replace) update_account_color (Account *acc, const gchar *old_color, const gchar *new_color, gboolean replace)
{ {
// check to see if the color has been changed PINFO("Account is '%s', old_color is '%s', new_color is '%s', replace is %d",
if (g_strcmp0 (new_color, old_color) != 0) xaccAccountGetName (acc), old_color, new_color, replace);
// have a new color, update if we can
if (new_color)
{ {
if ((old_color == NULL) || (g_strcmp0 (old_color, "Not Set") == 0) || (replace == TRUE)) if (!old_color || replace)
{ {
xaccAccountBeginEdit (acc); // check to see if the color is different from old one
xaccAccountSetColor (acc, new_color); if (g_strcmp0 (new_color, old_color) != 0)
xaccAccountCommitEdit (acc); xaccAccountSetColor (acc, new_color);
} }
} }
else // change from a color to default one, remove color entry if we can
{
if (old_color && replace)
xaccAccountSetColor (acc, ""); // remove entry
}
} }
void void
@ -2114,7 +2130,7 @@ gnc_account_cascade_color_dialog (GtkWidget *window, Account *account)
GtkWidget *color_label, *color_button, *over_write, *color_button_default; GtkWidget *color_label, *color_button, *over_write, *color_button_default;
gchar *string; gchar *string;
const char *color_string; const char *color_string;
gchar *old_color_string; gchar *old_color_string = NULL;
GdkRGBA color; GdkRGBA color;
gint response; gint response;
@ -2144,14 +2160,16 @@ gnc_account_cascade_color_dialog (GtkWidget *window, Account *account)
color_string = xaccAccountGetColor (account); // get existing account color color_string = xaccAccountGetColor (account); // get existing account color
old_color_string = g_strdup (color_string); // save the old color string if (!color_string)
if ((color_string == NULL) || (g_strcmp0 (color_string, "Not Set") == 0))
color_string = DEFAULT_COLOR; color_string = DEFAULT_COLOR;
else
old_color_string = g_strdup (color_string); // save the old color string
if (!gdk_rgba_parse (&color, color_string))
gdk_rgba_parse (&color, DEFAULT_COLOR);
// set the color chooser to account color // set the color chooser to account color
if (gdk_rgba_parse (&color, color_string)) gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER(color_button), &color);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER(color_button), &color);
/* default to cancel */ /* default to cancel */
gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_CANCEL); gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_CANCEL);
@ -2175,18 +2193,18 @@ gnc_account_cascade_color_dialog (GtkWidget *window, Account *account)
new_color_string = gdk_rgba_to_string (&new_color); new_color_string = gdk_rgba_to_string (&new_color);
if (g_strcmp0 (new_color_string, DEFAULT_COLOR) == 0) if (g_strcmp0 (new_color_string, DEFAULT_COLOR) == 0)
new_color_string = "Not Set"; new_color_string = NULL;
// check/update selected account // check/update selected account
update_account_color (account, old_color_string, new_color_string, replace); update_account_color (account, old_color_string, new_color_string, replace);
if (accounts != NULL) if (accounts)
{ {
for (acct = accounts; acct; acct = g_list_next(acct)) for (acct = accounts; acct; acct = g_list_next(acct))
{ {
const char *string = xaccAccountGetColor (acct->data); const char *string = xaccAccountGetColor (acct->data);
// check/update sub-account // check/update sub-accounts
update_account_color (acct->data, string, new_color_string, replace); update_account_color (acct->data, string, new_color_string, replace);
} }
g_list_free (accounts); g_list_free (accounts);

View File

@ -337,8 +337,8 @@ GtkTreeViewGridLines
gnc_tree_view_get_grid_lines_pref (void) gnc_tree_view_get_grid_lines_pref (void)
{ {
GtkTreeViewGridLines grid_lines; GtkTreeViewGridLines grid_lines;
gboolean h_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, "grid-lines-horizontal"); gboolean h_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_GRID_LINES_HORIZONTAL);
gboolean v_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, "grid-lines-vertical"); gboolean v_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_GRID_LINES_VERTICAL);
if (h_lines) if (h_lines)
{ {

View File

@ -29,6 +29,9 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "qof.h" #include "qof.h"
#define GNC_PREF_GRID_LINES_HORIZONTAL "grid-lines-horizontal"
#define GNC_PREF_GRID_LINES_VERTICAL "grid-lines-vertical"
void gnc_set_label_color (GtkWidget *label, gnc_numeric value); void gnc_set_label_color (GtkWidget *label, gnc_numeric value);
/********************************************************************\ /********************************************************************\

View File

@ -45,6 +45,7 @@
#include "gnc-window.h" #include "gnc-window.h"
#include "gnc-plugin-file-history.h" #include "gnc-plugin-file-history.h"
#include "qof.h" #include "qof.h"
#include "Scrub.h"
#include "TransLog.h" #include "TransLog.h"
#include "gnc-session.h" #include "gnc-session.h"
#include "gnc-state.h" #include "gnc-state.h"
@ -1023,6 +1024,12 @@ RESTART:
gnc_warning_dialog(parent, "%s", message); gnc_warning_dialog(parent, "%s", message);
g_free ( message ); g_free ( message );
} }
// Fix account color slots being set to 'Not Set', should run once on a book
qof_event_suspend();
xaccAccountScrubColorNotSet (gnc_get_current_book());
qof_event_resume();
return TRUE; return TRUE;
} }

View File

@ -44,6 +44,7 @@
#include "gnc-gobject-utils.h" #include "gnc-gobject-utils.h"
#include "gnc-cell-renderer-date.h" #include "gnc-cell-renderer-date.h"
#include "gnc-state.h" #include "gnc-state.h"
#include "gnc-prefs.h"
#include "dialog-utils.h" #include "dialog-utils.h"
/* The actual state key for a particular column visibility. This is /* The actual state key for a particular column visibility. This is
@ -223,6 +224,13 @@ gnc_tree_view_class_init (GncTreeViewClass *klass)
gtkwidget_class->destroy = gnc_tree_view_destroy; gtkwidget_class->destroy = gnc_tree_view_destroy;
} }
static void
gnc_tree_view_update_grid_lines (gpointer prefs, gchar* pref, gpointer user_data)
{
GncTreeView *view = user_data;
gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(view), gnc_tree_view_get_grid_lines_pref ());
}
/** Initialize a new instance of a base gnucash tree view. This /** Initialize a new instance of a base gnucash tree view. This
* function allocates and initializes the object private storage * function allocates and initializes the object private storage
* space. It also adds the new object to a list (for memory tracking * space. It also adds the new object to a list (for memory tracking
@ -274,6 +282,10 @@ gnc_tree_view_init (GncTreeView *view, GncTreeViewClass *klass)
// Set grid lines option to preference // Set grid lines option to preference
gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(view), gnc_tree_view_get_grid_lines_pref ()); gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(view), gnc_tree_view_get_grid_lines_pref ());
gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_GRID_LINES_HORIZONTAL,
gnc_tree_view_update_grid_lines, view);
gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_GRID_LINES_VERTICAL,
gnc_tree_view_update_grid_lines, view);
/* Create the last column which contains the column selection /* Create the last column which contains the column selection
* widget. gnc_tree_view_add_text_column will do most of the * widget. gnc_tree_view_add_text_column will do most of the
@ -348,6 +360,11 @@ gnc_tree_view_destroy (GtkWidget *widget)
view = GNC_TREE_VIEW (widget); view = GNC_TREE_VIEW (widget);
gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL, GNC_PREF_GRID_LINES_HORIZONTAL,
gnc_tree_view_update_grid_lines, view);
gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL, GNC_PREF_GRID_LINES_VERTICAL,
gnc_tree_view_update_grid_lines, view);
priv = GNC_TREE_VIEW_GET_PRIVATE(view); priv = GNC_TREE_VIEW_GET_PRIVATE(view);
if (priv->state_section) if (priv->state_section)

View File

@ -54,6 +54,7 @@
#include "gnc-gobject-utils.h" #include "gnc-gobject-utils.h"
#include "gnc-gtk-utils.h" #include "gnc-gtk-utils.h"
#include "gnc-icons.h" #include "gnc-icons.h"
#include "gnc-prefs.h"
#include "gnc-session.h" #include "gnc-session.h"
#include "gnc-tree-view-account.h" #include "gnc-tree-view-account.h"
@ -215,7 +216,6 @@ gnc_budget_view_class_init(GncBudgetViewClass *klass)
g_type_class_add_private(klass, sizeof(GncBudgetViewPrivate)); g_type_class_add_private(klass, sizeof(GncBudgetViewPrivate));
} }
static void static void
gnc_budget_view_init(GncBudgetView *budget_view) gnc_budget_view_init(GncBudgetView *budget_view)
{ {
@ -262,16 +262,30 @@ gnc_budget_view_init(GncBudgetView *budget_view)
LEAVE(""); LEAVE("");
} }
static void
gbv_treeview_update_grid_lines (gpointer prefs, gchar* pref, gpointer user_data)
{
GtkTreeView *view = user_data;
gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(view), gnc_tree_view_get_grid_lines_pref ());
}
static void static void
gnc_budget_view_finalize(GObject *object) gnc_budget_view_finalize(GObject *object)
{ {
GncBudgetView *view; GncBudgetView *view;
GncBudgetViewPrivate *priv;
ENTER("object %p", object); ENTER("object %p", object);
view = GNC_BUDGET_VIEW(object); view = GNC_BUDGET_VIEW(object);
g_return_if_fail(GNC_IS_BUDGET_VIEW(view)); g_return_if_fail(GNC_IS_BUDGET_VIEW(view));
priv = GNC_BUDGET_VIEW_GET_PRIVATE(view);
gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL, GNC_PREF_GRID_LINES_HORIZONTAL,
gbv_treeview_update_grid_lines, priv->totals_tree_view);
gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL, GNC_PREF_GRID_LINES_VERTICAL,
gbv_treeview_update_grid_lines, priv->totals_tree_view);
G_OBJECT_CLASS(gnc_budget_view_parent_class)->finalize(object); G_OBJECT_CLASS(gnc_budget_view_parent_class)->finalize(object);
LEAVE(" "); LEAVE(" ");
} }
@ -457,6 +471,10 @@ gbv_create_widget(GncBudgetView *view)
// Set grid lines option to preference // Set grid lines option to preference
gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(totals_tree_view), gnc_tree_view_get_grid_lines_pref ()); gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(totals_tree_view), gnc_tree_view_get_grid_lines_pref ());
gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_GRID_LINES_HORIZONTAL,
gbv_treeview_update_grid_lines, totals_tree_view);
gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_GRID_LINES_VERTICAL,
gbv_treeview_update_grid_lines, totals_tree_view);
PINFO("Number of Created totals columns is %d", gtk_tree_view_get_n_columns (totals_tree_view)); PINFO("Number of Created totals columns is %d", gtk_tree_view_get_n_columns (totals_tree_view));

View File

@ -228,7 +228,7 @@ static GtkActionEntry gnc_plugin_page_account_tree_actions [] =
G_CALLBACK (gnc_plugin_page_account_tree_cmd_delete_account) G_CALLBACK (gnc_plugin_page_account_tree_cmd_delete_account)
}, },
{ {
"ColorCascadeAccountAction", NULL, N_("_Cascade Account Color..."), NULL, "EditColorCascadeAccountAction", NULL, N_("_Cascade Account Color..."), NULL,
N_("Cascade selected account color"), N_("Cascade selected account color"),
G_CALLBACK (gnc_plugin_page_account_tree_cmd_cascade_color_account) G_CALLBACK (gnc_plugin_page_account_tree_cmd_cascade_color_account)
}, },
@ -1072,6 +1072,9 @@ gnc_plugin_page_account_tree_selection_changed_cb (GtkTreeSelection *selection,
g_object_set (G_OBJECT(action), "sensitive", g_object_set (G_OBJECT(action), "sensitive",
is_readwrite && sensitive && subaccounts, NULL); is_readwrite && sensitive && subaccounts, NULL);
action = gtk_action_group_get_action (action_group, "EditColorCascadeAccountAction");
g_object_set (G_OBJECT(action), "sensitive", subaccounts, NULL);
gnc_plugin_update_actions (action_group, actions_requiring_account_rw, gnc_plugin_update_actions (action_group, actions_requiring_account_rw,
"sensitive", is_readwrite && sensitive); "sensitive", is_readwrite && sensitive);
gnc_plugin_update_actions (action_group, actions_requiring_account_always, gnc_plugin_update_actions (action_group, actions_requiring_account_always,

View File

@ -358,6 +358,13 @@ gnc_split_reg_init( GNCSplitReg *gsr )
gsr->read_only = FALSE; gsr->read_only = FALSE;
} }
static void
gnc_split_reg_pref_acc_labels (gpointer prefs, gchar *pref, gpointer user_data)
{
GNCSplitReg *gsr = user_data;
gnucash_register_refresh_from_prefs (gsr->reg);
}
static void static void
gnc_split_reg_init2( GNCSplitReg *gsr ) gnc_split_reg_init2( GNCSplitReg *gsr )
{ {
@ -369,6 +376,11 @@ gnc_split_reg_init2( GNCSplitReg *gsr )
/* ordering is important here... setup_status before create_table */ /* ordering is important here... setup_status before create_table */
gsr_create_table( gsr ); gsr_create_table( gsr );
gsr_setup_table( gsr ); gsr_setup_table( gsr );
gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
GNC_PREF_ACCOUNTING_LABELS,
gnc_split_reg_pref_acc_labels,
gsr);
} }
static static
@ -451,6 +463,11 @@ gnc_split_reg_dispose(GObject *obj)
g_free (gsr->filter_text); g_free (gsr->filter_text);
gsr->filter_text = NULL; gsr->filter_text = NULL;
gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
GNC_PREF_ACCOUNTING_LABELS,
gnc_split_reg_pref_acc_labels,
gsr);
if (gsr->reg) if (gsr->reg)
{ {
g_signal_handlers_disconnect_by_data (gsr->reg, gsr); g_signal_handlers_disconnect_by_data (gsr->reg, gsr);
@ -1288,6 +1305,10 @@ gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data )
trans = xaccSplitGetParent(split); trans = xaccSplitGetParent(split);
cursor_class = gnc_split_register_get_current_cursor_class (reg); cursor_class = gnc_split_register_get_current_cursor_class (reg);
/* test for blank_split reference pointing to split */
if (gnc_split_register_is_blank_split (reg, split))
gnc_split_register_change_blank_split_ref (reg, split);
/* Deleting the blank split just cancels */ /* Deleting the blank split just cancels */
{ {
Split *blank_split = gnc_split_register_get_blank_split (reg); Split *blank_split = gnc_split_register_get_blank_split (reg);

View File

@ -329,6 +329,7 @@ Cancel to abort.</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="left_margin">2</property> <property name="left_margin">2</property>
<property name="right_margin">2</property> <property name="right_margin">2</property>
<property name="accepts_tab">False</property>
</object> </object>
</child> </child>
</object> </object>

View File

@ -541,6 +541,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="wrap_mode">word</property> <property name="wrap_mode">word</property>
<property name="accepts_tab">False</property>
</object> </object>
</child> </child>
</object> </object>

View File

@ -475,6 +475,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="wrap_mode">word</property> <property name="wrap_mode">word</property>
<property name="accepts_tab">False</property>
<signal name="focus-out-event" handler="gnc_invoice_window_leave_notes_cb" swapped="no"/> <signal name="focus-out-event" handler="gnc_invoice_window_leave_notes_cb" swapped="no"/>
</object> </object>
</child> </child>
@ -1247,6 +1248,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="wrap_mode">word</property> <property name="wrap_mode">word</property>
<property name="accepts_tab">False</property>
</object> </object>
</child> </child>
</object> </object>

View File

@ -169,6 +169,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Enter any notes you want to make about this lot.</property> <property name="tooltip_text" translatable="yes">Enter any notes you want to make about this lot.</property>
<property name="accepts_tab">False</property>
<property name="wrap_mode">word</property> <property name="wrap_mode">word</property>
</object> </object>
</child> </child>

View File

@ -446,6 +446,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="wrap_mode">word</property> <property name="wrap_mode">word</property>
<property name="accepts_tab">False</property>
<property name="buffer">notes_buffer</property> <property name="buffer">notes_buffer</property>
</object> </object>
</child> </child>
@ -847,6 +848,7 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="editable">False</property> <property name="editable">False</property>
<property name="wrap_mode">word</property> <property name="wrap_mode">word</property>
<property name="accepts_tab">False</property>
<property name="buffer">text_buffer</property> <property name="buffer">text_buffer</property>
</object> </object>
</child> </child>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 --> <!-- Generated with glade 3.20.4 -->
<interface> <interface>
<requires lib="gtk+" version="3.10"/> <requires lib="gtk+" version="3.10"/>
<object class="GtkDialog" id="search_dialog"> <object class="GtkDialog" id="search_dialog">
@ -235,36 +235,51 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkGrid" id="criteria_table"> <object class="GtkScrolledWindow" id="criteria_scroll_window">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">True</property>
<property name="border_width">3</property> <property name="hscrollbar_policy">never</property>
<property name="shadow_type">etched-in</property>
<child> <child>
<placeholder/> <object class="GtkViewport" id="criteria_viewport">
</child> <property name="visible">True</property>
<child> <property name="can_focus">False</property>
<placeholder/> <property name="shadow_type">etched-in</property>
</child> <child>
<child> <object class="GtkGrid" id="criteria_table">
<placeholder/> <property name="visible">True</property>
</child> <property name="can_focus">False</property>
<child> <property name="border_width">3</property>
<placeholder/> <child>
</child> <placeholder/>
<child> </child>
<placeholder/> <child>
</child> <placeholder/>
<child> </child>
<placeholder/> <child>
</child> <placeholder/>
<child> </child>
<placeholder/> <child>
</child> <placeholder/>
<child> </child>
<placeholder/> <child>
</child> <placeholder/>
<child> </child>
<placeholder/> <child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</child> </child>
</object> </object>
<packing> <packing>
@ -284,8 +299,8 @@
</child> </child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">True</property>
<property name="fill">False</property> <property name="fill">True</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
@ -298,6 +313,7 @@
<object class="GtkBox" id="hboxXXX"> <object class="GtkBox" id="hboxXXX">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="valign">start</property>
<child> <child>
<object class="GtkAlignment" id="alignment2"> <object class="GtkAlignment" id="alignment2">
<property name="visible">True</property> <property name="visible">True</property>
@ -441,8 +457,8 @@
</child> </child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">False</property>
<property name="position">2</property> <property name="position">2</property>
</packing> </packing>
</child> </child>

View File

@ -604,6 +604,7 @@
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="editable">False</property> <property name="editable">False</property>
<property name="wrap_mode">word</property> <property name="wrap_mode">word</property>
<property name="accepts_tab">False</property>
</object> </object>
</child> </child>
</object> </object>

View File

@ -125,6 +125,7 @@
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="editable">False</property> <property name="editable">False</property>
<property name="wrap_mode">word</property> <property name="wrap_mode">word</property>
<property name="accepts_tab">False</property>
<property name="left_margin">5</property> <property name="left_margin">5</property>
<property name="right_margin">5</property> <property name="right_margin">5</property>
<property name="cursor_visible">False</property> <property name="cursor_visible">False</property>

View File

@ -536,6 +536,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="wrap_mode">word</property> <property name="wrap_mode">word</property>
<property name="accepts_tab">False</property>
</object> </object>
</child> </child>
</object> </object>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 --> <!-- Generated with glade 3.20.4 -->
<interface> <interface>
<requires lib="gtk+" version="3.10"/> <requires lib="gtk+" version="3.10"/>
<object class="GtkAdjustment" id="DigitsToRound_Adj"> <object class="GtkAdjustment" id="DigitsToRound_Adj">
@ -245,6 +245,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="margin_left">5</property>
<property name="label" translatable="yes">Budget Name:</property> <property name="label" translatable="yes">Budget Name:</property>
</object> </object>
<packing> <packing>
@ -271,6 +272,7 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="valign">start</property> <property name="valign">start</property>
<property name="margin_left">5</property>
<property name="label" translatable="yes">Notes:</property> <property name="label" translatable="yes">Notes:</property>
</object> </object>
<packing> <packing>
@ -291,6 +293,7 @@
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="wrap_mode">word</property> <property name="wrap_mode">word</property>
<property name="accepts_tab">False</property>
</object> </object>
</child> </child>
</object> </object>
@ -317,6 +320,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="margin_left">5</property>
<property name="label" translatable="yes">Number of Periods:</property> <property name="label" translatable="yes">Number of Periods:</property>
</object> </object>
<packing> <packing>
@ -345,6 +349,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="margin_left">5</property>
<property name="label" translatable="yes">Budget Period:</property> <property name="label" translatable="yes">Budget Period:</property>
</object> </object>
<packing> <packing>
@ -383,6 +388,18 @@
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="budget_note">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Note: Use View-&gt;'Filter By...' to control visible accounts.</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object> </object>
</child> </child>
<action-widgets> <action-widgets>

View File

@ -242,6 +242,7 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="editable">False</property> <property name="editable">False</property>
<property name="wrap_mode">word</property> <property name="wrap_mode">word</property>
<property name="accepts_tab">False</property>
</object> </object>
</child> </child>
</object> </object>

View File

@ -283,6 +283,8 @@ csv_account_import (CsvImportInfo *info)
{ {
if (gdk_rgba_parse (&testcolor, color)) if (gdk_rgba_parse (&testcolor, color))
xaccAccountSetColor (acc, color); xaccAccountSetColor (acc, color);
else
xaccAccountSetColor (acc, "");
} }
if (g_strcmp0 (hidden, "T") == 0) if (g_strcmp0 (hidden, "T") == 0)
@ -323,6 +325,8 @@ csv_account_import (CsvImportInfo *info)
{ {
if (gdk_rgba_parse (&testcolor, color)) if (gdk_rgba_parse (&testcolor, color))
xaccAccountSetColor (acc, color); xaccAccountSetColor (acc, color);
else
xaccAccountSetColor (acc, "");
} }
if (g_strcmp0 (notes, "") != 0) if (g_strcmp0 (notes, "") != 0)

View File

@ -1024,6 +1024,49 @@ gnc_split_register_paste_current (SplitRegister *reg)
LEAVE(" "); LEAVE(" ");
} }
gboolean
gnc_split_register_is_blank_split (SplitRegister *reg, Split *split)
{
SRInfo *info = gnc_split_register_get_info (reg);
Split *current_blank_split = xaccSplitLookup (&info->blank_split_guid, gnc_get_current_book ());
if (split == current_blank_split)
return TRUE;
return FALSE;
}
void
gnc_split_register_change_blank_split_ref (SplitRegister *reg, Split *split)
{
SRInfo *info = gnc_split_register_get_info (reg);
Split *current_blank_split = xaccSplitLookup (&info->blank_split_guid, gnc_get_current_book ());
Split *pref_split = NULL; // has the same account as incoming split
Split *other_split = NULL; // other split
Split *s;
Account *blank_split_account = xaccSplitGetAccount (current_blank_split);
Transaction *trans = xaccSplitGetParent (split);
int i = 0;
// loop through splitlist looking for splits other than the blank_split
while ((s = xaccTransGetSplit (trans, i)) != NULL)
{
if (s != current_blank_split)
{
if (blank_split_account == xaccSplitGetAccount (s))
pref_split = s; // prefer same account
else
other_split = s; // any other split
}
i++;
}
// now change the saved blank split reference
if (pref_split != NULL)
info->blank_split_guid = *xaccSplitGetGUID (pref_split);
else if (other_split != NULL)
info->blank_split_guid = *xaccSplitGetGUID (other_split);
}
void void
gnc_split_register_delete_current_split (SplitRegister *reg) gnc_split_register_delete_current_split (SplitRegister *reg)
{ {
@ -1322,11 +1365,17 @@ void
gnc_split_register_cancel_cursor_trans_changes (SplitRegister *reg) gnc_split_register_cancel_cursor_trans_changes (SplitRegister *reg)
{ {
SRInfo *info = gnc_split_register_get_info (reg); SRInfo *info = gnc_split_register_get_info (reg);
Transaction *pending_trans; Transaction *pending_trans, *blank_trans;
gboolean refresh_all = FALSE;
pending_trans = xaccTransLookup (&info->pending_trans_guid, pending_trans = xaccTransLookup (&info->pending_trans_guid,
gnc_get_current_book ()); gnc_get_current_book ());
blank_trans = xaccSplitGetParent (gnc_split_register_get_blank_split (reg));
if (pending_trans == blank_trans)
refresh_all = TRUE;
/* Get the currently open transaction, rollback the edits on it, and /* Get the currently open transaction, rollback the edits on it, and
* then repaint everything. To repaint everything, make a note of * then repaint everything. To repaint everything, make a note of
* all of the accounts that will be affected by this rollback. */ * all of the accounts that will be affected by this rollback. */
@ -1346,7 +1395,11 @@ gnc_split_register_cancel_cursor_trans_changes (SplitRegister *reg)
info->pending_trans_guid = *guid_null (); info->pending_trans_guid = *guid_null ();
gnc_resume_gui_refresh (); gnc_resume_gui_refresh ();
gnc_split_register_redraw(reg);
if (refresh_all)
gnc_gui_refresh_all (); // force a refresh of all registers
else
gnc_split_register_redraw (reg);
} }
void void

View File

@ -539,6 +539,14 @@ const char * gnc_split_register_get_debit_string (SplitRegister *reg);
/** Return the credit string used in the register. */ /** Return the credit string used in the register. */
const char * gnc_split_register_get_credit_string (SplitRegister *reg); const char * gnc_split_register_get_credit_string (SplitRegister *reg);
/** Return TRUE if split is the blank_split. */
gboolean gnc_split_register_is_blank_split (SplitRegister *reg, Split *split);
/** Change the blank_split reference from pointing to split to another
* split of the transaction. This is used when deleting a split after an
* autocomplete as the blank_split reference will be pointing to one of
* the splits so it does not cancel the whole transaction */
void gnc_split_register_change_blank_split_ref (SplitRegister *reg, Split *split);
/** Pop up the exchange-rate dialog, maybe, for the current split. /** Pop up the exchange-rate dialog, maybe, for the current split.
* If force_dialog is TRUE, the forces the dialog to to be called. * If force_dialog is TRUE, the forces the dialog to to be called.

View File

@ -5,7 +5,7 @@
<menuitem name="EditEditAccount" action="EditEditAccountAction"/> <menuitem name="EditEditAccount" action="EditEditAccountAction"/>
<menuitem name="EditDeleteAccount" action="EditDeleteAccountAction"/> <menuitem name="EditDeleteAccount" action="EditDeleteAccountAction"/>
<menuitem name="EditAccountFindAccount" action="EditFindAccountAction"/> <menuitem name="EditAccountFindAccount" action="EditFindAccountAction"/>
<menuitem name="AccountColorCascade" action="ColorCascadeAccountAction"/> <menuitem name="AccountColorCascade" action="EditColorCascadeAccountAction"/>
<menuitem name="EditRenumberSubaccounts" action="EditRenumberSubaccountsAction"/> <menuitem name="EditRenumberSubaccounts" action="EditRenumberSubaccountsAction"/>
<separator name="EditSep2"/> <separator name="EditSep2"/>
<menuitem name="FileOpenAccount" action="FileOpenAccountAction"/> <menuitem name="FileOpenAccount" action="FileOpenAccountAction"/>
@ -46,7 +46,7 @@
<menuitem name="AccountOpenAccount" action="FileOpenAccountAction"/> <menuitem name="AccountOpenAccount" action="FileOpenAccountAction"/>
<menuitem name="AccountOpenSubaccounts" action="FileOpenSubaccountsAction"/> <menuitem name="AccountOpenSubaccounts" action="FileOpenSubaccountsAction"/>
<menuitem name="AccountEditAccount" action="EditEditAccountAction"/> <menuitem name="AccountEditAccount" action="EditEditAccountAction"/>
<menuitem name="AccountColorCascade" action="ColorCascadeAccountAction"/> <menuitem name="AccountColorCascade" action="EditColorCascadeAccountAction"/>
<menuitem name="AccountFindAccountPopup" action="EditFindAccountPopupAction"/> <menuitem name="AccountFindAccountPopup" action="EditFindAccountPopupAction"/>
<separator name="AccountSep1"/> <separator name="AccountSep1"/>
<menuitem name="AccountReconcile" action="ActionsReconcileAction"/> <menuitem name="AccountReconcile" action="ActionsReconcileAction"/>

View File

@ -1114,15 +1114,15 @@ xaccTransScrubCurrency (Transaction *trans)
} }
else else
{ {
gnc_commodity *currency = xaccAccountGetCommodity(split->acc); gnc_commodity *currency = xaccAccountGetCommodity(split->acc);
PWARN ("setting to split=\"%s\" account=\"%s\" commodity=\"%s\"", PWARN ("setting to split=\"%s\" account=\"%s\" commodity=\"%s\"",
split->memo, xaccAccountGetName(split->acc), split->memo, xaccAccountGetName(split->acc),
gnc_commodity_get_mnemonic(currency)); gnc_commodity_get_mnemonic(currency));
xaccTransBeginEdit (trans); xaccTransBeginEdit (trans);
xaccTransSetCurrency (trans, currency); xaccTransSetCurrency (trans, currency);
xaccTransCommitEdit (trans); xaccTransCommitEdit (trans);
return; return;
} }
} }
} }
@ -1354,6 +1354,42 @@ xaccAccountScrubKvp (Account *account)
/* ================================================================ */ /* ================================================================ */
void
xaccAccountScrubColorNotSet (QofBook *book)
{
GValue value_s = G_VALUE_INIT;
// get the run-once value
qof_instance_get_kvp (QOF_INSTANCE (book), &value_s, 1, "remove-color-not-set-slots");
if (G_VALUE_HOLDS_STRING (&value_s) && (strcmp(g_value_get_string (&value_s), "true") == 0))
return;
else
{
GValue value_b = G_VALUE_INIT;
Account *root = gnc_book_get_root_account (book);
GList *accts = gnc_account_get_descendants_sorted (root);
GList *ptr;
for (ptr = accts; ptr; ptr = g_list_next (ptr))
{
const gchar *color = xaccAccountGetColor (ptr->data);
if (g_strcmp0 (color, "Not Set") == 0)
xaccAccountSetColor (ptr->data, "");
}
g_list_free (accts);
g_value_init (&value_b, G_TYPE_BOOLEAN);
g_value_set_boolean (&value_b, TRUE);
// set the run-once value
qof_instance_set_kvp (QOF_INSTANCE (book), &value_b, 1, "remove-color-not-set-slots");
}
}
/* ================================================================ */
Account * Account *
xaccScrubUtilityGetOrMakeAccount (Account *root, gnc_commodity * currency, xaccScrubUtilityGetOrMakeAccount (Account *root, gnc_commodity * currency,
const char *accname, GNCAccountType acctype, const char *accname, GNCAccountType acctype,

View File

@ -145,6 +145,11 @@ void xaccAccountTreeScrubQuoteSources (Account *root, gnc_commodity_table *table
/** Removes empty "notes", "placeholder", and "hbci" KVP slots from Accounts. */ /** Removes empty "notes", "placeholder", and "hbci" KVP slots from Accounts. */
void xaccAccountScrubKvp (Account *account); void xaccAccountScrubKvp (Account *account);
/** Remove color slots that have a "Not Set" value, since 2.4.0, fixed in 3.4
* This should only be run once on a book
*/
void xaccAccountScrubColorNotSet (QofBook *book);
/** Changes Transaction date_posted timestamps from 00:00 local to 11:00 UTC. /** Changes Transaction date_posted timestamps from 00:00 local to 11:00 UTC.
* 11:00 UTC is the same day local time in almost all timezones, the exceptions * 11:00 UTC is the same day local time in almost all timezones, the exceptions
* being the -12, +13, and +14 timezones along the International Date Line. If * being the -12, +13, and +14 timezones along the International Date Line. If