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 "qofbookslots.h"
#include "Transaction.h" /* for the SPLIT_* and TRANS_* */
#include "Transaction.h" /* for the SPLIT_* and TRANS_* */
#include "dialog-search.h"
#include "search-core-type.h"
@ -73,6 +73,7 @@ struct _GNCSearchWindow
GtkWidget *grouping_combo;
GtkWidget *match_all_label;
GtkWidget *criteria_table;
GtkWidget *criteria_scroll_window;
GtkWidget *result_hbox;
/* The "results" sub-window widgets */
@ -165,7 +166,6 @@ gnc_search_callback_button_execute (GNCSearchCallbackButton *cb,
}
}
static void
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);
}
static void
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
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);
}
static void
gnc_search_dialog_select_row_cb (GNCQueryView *qview,
gpointer item,
@ -248,7 +245,6 @@ gnc_search_dialog_select_row_cb (GNCQueryView *qview,
gnc_search_dialog_select_buttons_enable(sw, number_of_rows);
}
static void
gnc_search_dialog_double_click_cb (GNCQueryView *qview,
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 */
}
static void
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);
}
static void
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);
}
static void
match_combo_changed (GtkComboBoxText *combo_box, GNCSearchWindow *sw)
{
sw->grouping = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box));
}
static void
search_type_cb (GtkToggleButton *button, GNCSearchWindow *sw)
{
@ -395,7 +387,6 @@ search_type_cb (GtkToggleButton *button, GNCSearchWindow *sw)
}
}
static void
search_active_only_cb (GtkToggleButton *button, GNCSearchWindow *sw)
{
@ -409,24 +400,24 @@ create_query_fragment (QofIdTypeConst search_for, GNCSearchParam *param, QofQuer
{
GNCSearchParamKind kind = gnc_search_param_get_kind (param);
QofQuery *q = qof_query_create_for (search_for);
if (kind == SEARCH_PARAM_ELEM)
{
/* The "op" parameter below will be ignored since q has no terms. */
qof_query_add_term (q, gnc_search_param_get_param_path (GNC_SEARCH_PARAM_SIMPLE (param)),
pdata, QOF_QUERY_OR);
}
}
else
{
GList *plist = gnc_search_param_get_search (GNC_SEARCH_PARAM_COMPOUND (param));
for ( ; plist; plist = plist->next)
{
QofQuery *new_q;
GNCSearchParam *param2 = plist->data;
QofQuery *q2 = create_query_fragment (search_for, param2,
QofQuery *q2 = create_query_fragment (search_for, param2,
qof_query_core_predicate_copy (pdata));
new_q = qof_query_merge (q, q2, kind == SEARCH_PARAM_ANY ?
new_q = qof_query_merge (q, q2, kind == SEARCH_PARAM_ANY ?
QOF_QUERY_OR : QOF_QUERY_AND);
qof_query_destroy (q);
qof_query_destroy (q2);
@ -489,19 +480,19 @@ search_update_query (GNCSearchWindow *sw)
switch (sw->search_type)
{
case 0: /* New */
case 0: /* New */
new_q = qof_query_merge (sw->start_q, q, QOF_QUERY_AND);
qof_query_destroy (q);
break;
case 1: /* Refine */
case 1: /* Refine */
new_q = qof_query_merge (sw->q, q, QOF_QUERY_AND);
qof_query_destroy (q);
break;
case 2: /* Add */
case 2: /* Add */
new_q = qof_query_merge (sw->q, q, QOF_QUERY_OR);
qof_query_destroy (q);
break;
case 3: /* Delete */
case 3: /* Delete */
q2 = qof_query_invert (q);
new_q = qof_query_merge (sw->q, q2, QOF_QUERY_AND);
qof_query_destroy (q2);
@ -527,7 +518,6 @@ search_update_query (GNCSearchWindow *sw)
sw->q = new_q;
}
static void
gnc_search_dialog_show_close_cancel (GNCSearchWindow *sw)
{
@ -543,11 +533,11 @@ gnc_search_dialog_show_close_cancel (GNCSearchWindow *sw)
}
}
static void
gnc_search_dialog_reset_widgets (GNCSearchWindow *sw)
{
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->add_rb), sens);
@ -560,17 +550,12 @@ gnc_search_dialog_reset_widgets (GNCSearchWindow *sw)
}
if (sw->crit_list)
{
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);
}
}
crit_list_vis = TRUE;
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
gnc_search_dialog_crit_ok (GNCSearchWindow *sw)
@ -592,7 +577,6 @@ gnc_search_dialog_crit_ok (GNCSearchWindow *sw)
return ret;
}
static void
search_find_cb (GtkButton *button, GNCSearchWindow *sw)
{
@ -617,7 +601,6 @@ search_find_cb (GtkButton *button, GNCSearchWindow *sw)
gnc_search_dialog_display_results (sw);
}
static void
search_new_item_cb (GtkButton *button, GNCSearchWindow *sw)
{
@ -651,7 +634,6 @@ search_new_item_cb (GtkButton *button, GNCSearchWindow *sw)
}
}
static void
search_cancel_cb (GtkButton *button, GNCSearchWindow *sw)
{
@ -659,14 +641,12 @@ search_cancel_cb (GtkButton *button, GNCSearchWindow *sw)
gnc_search_dialog_destroy (sw);
}
static void
search_help_cb (GtkButton *button, GNCSearchWindow *sw)
{
gnc_gnome_help (HF_HELP, HL_FIND_TRANSACTIONS);
}
static void
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_show(sw->match_all_label);
gtk_widget_hide(sw->criteria_scroll_window);
}
}
static void
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);
gtk_widget_show (remove);
data->button = remove; /* Save the button for later */
data->button = remove; /* Save the button for later */
}
static void
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);
}
static void
search_clear_criteria (GNCSearchWindow *sw)
{
@ -792,7 +770,6 @@ search_clear_criteria (GNCSearchWindow *sw)
}
}
static GtkWidget *
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 */
gtk_widget_set_sensitive(sw->grouping_combo, TRUE);
gtk_widget_hide(sw->match_all_label);
gtk_widget_show(sw->criteria_scroll_window);
}
/* create a new criterion element */
new_sct = gnc_search_core_type_new_type_name
@ -1010,14 +988,12 @@ gnc_search_dialog_add_criterion (GNCSearchWindow *sw)
}
}
static void
add_criterion (GtkWidget *button, GNCSearchWindow *sw)
{
gnc_search_dialog_add_criterion (sw);
}
static int
gnc_search_dialog_close_cb (GtkDialog *dialog, GNCSearchWindow *sw)
{
@ -1050,7 +1026,6 @@ gnc_search_dialog_close_cb (GtkDialog *dialog, GNCSearchWindow *sw)
return FALSE;
}
static void
refresh_handler (GHashTable *changes, gpointer data)
{
@ -1063,7 +1038,6 @@ refresh_handler (GHashTable *changes, gpointer data)
gnc_search_dialog_display_results (sw);
}
static void
close_handler (gpointer data)
{
@ -1074,7 +1048,6 @@ close_handler (gpointer data)
/* DRH: should sw be freed here? */
}
static const gchar *
type_label_to_new_button(const gchar* type_label)
{
@ -1126,7 +1099,6 @@ type_label_to_new_button(const gchar* type_label)
}
}
static void
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 */
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 */
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));
}
void
gnc_search_dialog_destroy (GNCSearchWindow *sw)
{
@ -1282,7 +1254,6 @@ gnc_search_dialog_destroy (GNCSearchWindow *sw)
gnc_close_gui_component (sw->component_id);
}
void
gnc_search_dialog_raise (GNCSearchWindow *sw)
{
@ -1356,7 +1327,6 @@ gnc_search_dialog_create (GtkWindow *parent,
return sw;
}
/* Register an on-close signal with the Search Dialog */
guint gnc_search_dialog_connect_on_close (GNCSearchWindow *sw,
GCallback func,
@ -1371,7 +1341,6 @@ guint gnc_search_dialog_connect_on_close (GNCSearchWindow *sw,
}
/* Un-register the signal handlers with the Search Dialog */
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);
}
/* Clear all callbacks with this Search Window */
void gnc_search_dialog_set_select_cb (GNCSearchWindow *sw,
GNCSearchSelectedCB selected_cb,
@ -1441,7 +1409,6 @@ get_params_list (QofIdTypeConst type)
return list;
}
static GList *
get_display_list (QofIdTypeConst type)
{
@ -1463,7 +1430,6 @@ do_nothing (GtkWindow *dialog, gpointer *a, gpointer b)
return;
}
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) */
gnc_search_dialog_create (NULL, GNC_ID_SPLIT,
_("Find Transaction"),
params, display,
NULL, NULL, buttons, NULL, NULL, NULL, NULL,
NULL, NULL, NULL);
params, display,
NULL, NULL, buttons, NULL, NULL, NULL, NULL,
NULL, NULL, NULL);
}

View File

@ -230,12 +230,13 @@ gnc_account_to_ui(AccountWindow *aw)
string = xaccAccountGetColor (account);
if ((string == NULL) || (g_strcmp0 ("Not Set", string) == 0))
if (!string)
string = DEFAULT_COLOR;
if (gdk_rgba_parse(&color, string))
{
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(aw->color_entry_button), &color);
}
if (!gdk_rgba_parse (&color, string))
gdk_rgba_parse (&color, DEFAULT_COLOR);
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(aw->color_entry_button), &color);
commodity = xaccAccountGetCommodity (account);
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 );
string = gdk_rgba_to_string(&color);
if (g_strcmp0 (string, DEFAULT_COLOR) == 0)
string = "Not Set";
string = NULL;
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 *)
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
update_account_color (Account *acc, const gchar *old_color, const gchar *new_color, gboolean replace)
{
// check to see if the color has been changed
if (g_strcmp0 (new_color, old_color) != 0)
PINFO("Account is '%s', old_color is '%s', new_color is '%s', replace is %d",
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);
xaccAccountSetColor (acc, new_color);
xaccAccountCommitEdit (acc);
// check to see if the color is different from old one
if (g_strcmp0 (new_color, old_color) != 0)
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
@ -2114,7 +2130,7 @@ gnc_account_cascade_color_dialog (GtkWidget *window, Account *account)
GtkWidget *color_label, *color_button, *over_write, *color_button_default;
gchar *string;
const char *color_string;
gchar *old_color_string;
gchar *old_color_string = NULL;
GdkRGBA color;
gint response;
@ -2144,14 +2160,16 @@ gnc_account_cascade_color_dialog (GtkWidget *window, Account *account)
color_string = xaccAccountGetColor (account); // get existing account color
old_color_string = g_strdup (color_string); // save the old color string
if ((color_string == NULL) || (g_strcmp0 (color_string, "Not Set") == 0))
if (!color_string)
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
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 */
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);
if (g_strcmp0 (new_color_string, DEFAULT_COLOR) == 0)
new_color_string = "Not Set";
new_color_string = NULL;
// check/update selected account
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))
{
const char *string = xaccAccountGetColor (acct->data);
// check/update sub-account
// check/update sub-accounts
update_account_color (acct->data, string, new_color_string, replace);
}
g_list_free (accounts);

View File

@ -337,8 +337,8 @@ GtkTreeViewGridLines
gnc_tree_view_get_grid_lines_pref (void)
{
GtkTreeViewGridLines grid_lines;
gboolean h_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, "grid-lines-horizontal");
gboolean v_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, "grid-lines-vertical");
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, GNC_PREF_GRID_LINES_VERTICAL);
if (h_lines)
{

View File

@ -29,6 +29,9 @@
#include <gtk/gtk.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);
/********************************************************************\

View File

@ -45,6 +45,7 @@
#include "gnc-window.h"
#include "gnc-plugin-file-history.h"
#include "qof.h"
#include "Scrub.h"
#include "TransLog.h"
#include "gnc-session.h"
#include "gnc-state.h"
@ -1023,6 +1024,12 @@ RESTART:
gnc_warning_dialog(parent, "%s", 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;
}

View File

@ -44,6 +44,7 @@
#include "gnc-gobject-utils.h"
#include "gnc-cell-renderer-date.h"
#include "gnc-state.h"
#include "gnc-prefs.h"
#include "dialog-utils.h"
/* 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;
}
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
* function allocates and initializes the object private storage
* 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
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
* 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);
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);
if (priv->state_section)

View File

@ -54,6 +54,7 @@
#include "gnc-gobject-utils.h"
#include "gnc-gtk-utils.h"
#include "gnc-icons.h"
#include "gnc-prefs.h"
#include "gnc-session.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));
}
static void
gnc_budget_view_init(GncBudgetView *budget_view)
{
@ -262,16 +262,30 @@ gnc_budget_view_init(GncBudgetView *budget_view)
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
gnc_budget_view_finalize(GObject *object)
{
GncBudgetView *view;
GncBudgetViewPrivate *priv;
ENTER("object %p", object);
view = GNC_BUDGET_VIEW(object);
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);
LEAVE(" ");
}
@ -457,6 +471,10 @@ gbv_create_widget(GncBudgetView *view)
// 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 ());
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));

View File

@ -228,7 +228,7 @@ static GtkActionEntry gnc_plugin_page_account_tree_actions [] =
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"),
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",
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,
"sensitive", is_readwrite && sensitive);
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;
}
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
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 */
gsr_create_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
@ -451,6 +463,11 @@ gnc_split_reg_dispose(GObject *obj)
g_free (gsr->filter_text);
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)
{
g_signal_handlers_disconnect_by_data (gsr->reg, gsr);
@ -1288,6 +1305,10 @@ gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data )
trans = xaccSplitGetParent(split);
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 */
{
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="left_margin">2</property>
<property name="right_margin">2</property>
<property name="accepts_tab">False</property>
</object>
</child>
</object>

View File

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

View File

@ -475,6 +475,7 @@
<property name="visible">True</property>
<property name="can_focus">True</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"/>
</object>
</child>
@ -1247,6 +1248,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="wrap_mode">word</property>
<property name="accepts_tab">False</property>
</object>
</child>
</object>

View File

@ -169,6 +169,7 @@
<property name="visible">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="accepts_tab">False</property>
<property name="wrap_mode">word</property>
</object>
</child>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.20.4 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkAdjustment" id="DigitsToRound_Adj">
@ -245,6 +245,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_left">5</property>
<property name="label" translatable="yes">Budget Name:</property>
</object>
<packing>
@ -271,6 +272,7 @@
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="margin_left">5</property>
<property name="label" translatable="yes">Notes:</property>
</object>
<packing>
@ -291,6 +293,7 @@
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="wrap_mode">word</property>
<property name="accepts_tab">False</property>
</object>
</child>
</object>
@ -317,6 +320,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_left">5</property>
<property name="label" translatable="yes">Number of Periods:</property>
</object>
<packing>
@ -345,6 +349,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_left">5</property>
<property name="label" translatable="yes">Budget Period:</property>
</object>
<packing>
@ -383,6 +388,18 @@
<property name="position">0</property>
</packing>
</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>
</child>
<action-widgets>

View File

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

View File

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

View File

@ -1024,6 +1024,49 @@ gnc_split_register_paste_current (SplitRegister *reg)
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
gnc_split_register_delete_current_split (SplitRegister *reg)
{
@ -1322,11 +1365,17 @@ void
gnc_split_register_cancel_cursor_trans_changes (SplitRegister *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,
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
* then repaint everything. To repaint everything, make a note of
* 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 ();
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

View File

@ -539,6 +539,14 @@ const char * gnc_split_register_get_debit_string (SplitRegister *reg);
/** Return the credit string used in the register. */
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.
* 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="EditDeleteAccount" action="EditDeleteAccountAction"/>
<menuitem name="EditAccountFindAccount" action="EditFindAccountAction"/>
<menuitem name="AccountColorCascade" action="ColorCascadeAccountAction"/>
<menuitem name="AccountColorCascade" action="EditColorCascadeAccountAction"/>
<menuitem name="EditRenumberSubaccounts" action="EditRenumberSubaccountsAction"/>
<separator name="EditSep2"/>
<menuitem name="FileOpenAccount" action="FileOpenAccountAction"/>
@ -46,7 +46,7 @@
<menuitem name="AccountOpenAccount" action="FileOpenAccountAction"/>
<menuitem name="AccountOpenSubaccounts" action="FileOpenSubaccountsAction"/>
<menuitem name="AccountEditAccount" action="EditEditAccountAction"/>
<menuitem name="AccountColorCascade" action="ColorCascadeAccountAction"/>
<menuitem name="AccountColorCascade" action="EditColorCascadeAccountAction"/>
<menuitem name="AccountFindAccountPopup" action="EditFindAccountPopupAction"/>
<separator name="AccountSep1"/>
<menuitem name="AccountReconcile" action="ActionsReconcileAction"/>

View File

@ -1114,15 +1114,15 @@ xaccTransScrubCurrency (Transaction *trans)
}
else
{
gnc_commodity *currency = xaccAccountGetCommodity(split->acc);
gnc_commodity *currency = xaccAccountGetCommodity(split->acc);
PWARN ("setting to split=\"%s\" account=\"%s\" commodity=\"%s\"",
split->memo, xaccAccountGetName(split->acc),
gnc_commodity_get_mnemonic(currency));
xaccTransBeginEdit (trans);
xaccTransSetCurrency (trans, currency);
xaccTransCommitEdit (trans);
return;
xaccTransBeginEdit (trans);
xaccTransSetCurrency (trans, currency);
xaccTransCommitEdit (trans);
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 *
xaccScrubUtilityGetOrMakeAccount (Account *root, gnc_commodity * currency,
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. */
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.
* 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