gnucash master: Multiple changes pushed
Robert Fewell
bobit at code.gnucash.org
Tue May 3 12:22:19 EDT 2022
Updated via https://github.com/Gnucash/gnucash/commit/ee7ed89b (commit)
via https://github.com/Gnucash/gnucash/commit/c6dff82b (commit)
via https://github.com/Gnucash/gnucash/commit/db6a8f80 (commit)
via https://github.com/Gnucash/gnucash/commit/5d156474 (commit)
via https://github.com/Gnucash/gnucash/commit/17cf3170 (commit)
via https://github.com/Gnucash/gnucash/commit/d78a6b2d (commit)
via https://github.com/Gnucash/gnucash/commit/91c7333a (commit)
via https://github.com/Gnucash/gnucash/commit/0b67a912 (commit)
via https://github.com/Gnucash/gnucash/commit/506eb384 (commit)
via https://github.com/Gnucash/gnucash/commit/6e8272b7 (commit)
via https://github.com/Gnucash/gnucash/commit/3fcaaef6 (commit)
via https://github.com/Gnucash/gnucash/commit/6d390dc6 (commit)
via https://github.com/Gnucash/gnucash/commit/b843dac2 (commit)
via https://github.com/Gnucash/gnucash/commit/adbc3014 (commit)
via https://github.com/Gnucash/gnucash/commit/94105a19 (commit)
via https://github.com/Gnucash/gnucash/commit/9cce53a6 (commit)
via https://github.com/Gnucash/gnucash/commit/b9e93d6e (commit)
from https://github.com/Gnucash/gnucash/commit/1a186b95 (commit)
commit ee7ed89b68a400f3e637f8a2a5b747486d7be1ad
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Fri Apr 22 11:22:52 2022 +0100
This partly fixes the currency and commodity combos
With these changes the currency works but the commodity allows you to
set the commodity but will crash if you save config or leave report
open, this was tested on the 'Price scatter plot' report. Fixed with
John's commit a8e6a59
diff --git a/gnucash/gnome-utils/dialog-options.cpp b/gnucash/gnome-utils/dialog-options.cpp
index dff8c7289..8a219dc3b 100644
--- a/gnucash/gnome-utils/dialog-options.cpp
+++ b/gnucash/gnome-utils/dialog-options.cpp
@@ -976,15 +976,16 @@ public:
void set_ui_item_from_option(GncOption& option) noexcept override
{
auto widget{GNC_CURRENCY_EDIT(get_widget())};
- auto instance{option.get_value<const QofInstance*>()};
- if (instance)
- gnc_currency_edit_set_currency(widget, GNC_COMMODITY(instance));
+ auto currency{option.get_value<gnc_commodity*>()};
+
+ if (currency)
+ gnc_currency_edit_set_currency(widget, GNC_COMMODITY(currency));
}
void set_option_from_ui_item(GncOption& option) noexcept override
{
auto widget{GNC_CURRENCY_EDIT(get_widget())};
auto currency = gnc_currency_edit_get_currency(widget);
- option.set_value(qof_instance_cast(currency));
+ option.set_value<gnc_commodity*>(currency);
}
};
@@ -1016,15 +1017,16 @@ public:
void set_ui_item_from_option(GncOption& option) noexcept override
{
auto widget{GNC_GENERAL_SELECT(get_widget())};
- auto instance{option.get_value<const QofInstance*>()};
- if (instance)
- gnc_general_select_set_selected(widget, GNC_COMMODITY(instance));
+ auto commodity{option.get_value<gnc_commodity*>()};
+
+ if (commodity)
+ gnc_general_select_set_selected(widget, GNC_COMMODITY(commodity));
}
void set_option_from_ui_item(GncOption& option) noexcept override
{
auto widget{GNC_GENERAL_SELECT(get_widget())};
auto commodity{gnc_general_select_get_selected(widget)};
- option.set_value(qof_instance_cast(commodity));
+ option.set_value<gnc_commodity*>(GNC_COMMODITY(commodity));
}
};
diff --git a/libgnucash/app-utils/gnc-option-impl.cpp b/libgnucash/app-utils/gnc-option-impl.cpp
index be976e122..2b42508ca 100644
--- a/libgnucash/app-utils/gnc-option-impl.cpp
+++ b/libgnucash/app-utils/gnc-option-impl.cpp
@@ -224,7 +224,7 @@ GncOptionCommodityValue::reset_default_value()
bool
GncOptionCommodityValue::is_changed() const noexcept
{
- return m_namespace == m_default_namespace && m_mnemonic == m_default_mnemonic;
+ return m_namespace != m_default_namespace || m_mnemonic != m_default_mnemonic;
}
bool
diff --git a/libgnucash/app-utils/gnc-optiondb.i b/libgnucash/app-utils/gnc-optiondb.i
index 1eb7b2b61..b4feefd82 100644
--- a/libgnucash/app-utils/gnc-optiondb.i
+++ b/libgnucash/app-utils/gnc-optiondb.i
@@ -1346,8 +1346,7 @@ inline SCM return_scm_value(ValueType value)
if (scm_is_string(new_value))
{
auto strval{scm_to_utf8_string(new_value)};
- auto val{qof_instance_from_string(strval, option.get_ui_type())};
- option.set_value(GNC_COMMODITY(val));
+ option.deserialize(strval);
return;
}
option.set_value(scm_to_value<gnc_commodity*>(new_value));
commit c6dff82b12ad20a2bccc52e4cde98bdcaf5ca06a
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Thu Apr 21 14:37:32 2022 +0100
Toggle the sensitivity of date when using BothDateEntry
diff --git a/gnucash/gnome-utils/dialog-options.cpp b/gnucash/gnome-utils/dialog-options.cpp
index 7e1b379f2..dff8c7289 100644
--- a/gnucash/gnome-utils/dialog-options.cpp
+++ b/gnucash/gnome-utils/dialog-options.cpp
@@ -1319,6 +1319,11 @@ void
BothDateEntry::toggle_relative(bool use_absolute)
{
m_use_absolute = use_absolute;
+
+ gtk_widget_set_sensitive(GTK_WIDGET(m_abs_entry->get_widget()),
+ m_use_absolute);
+ gtk_widget_set_sensitive(GTK_WIDGET(m_rel_entry->get_widget()),
+ !m_use_absolute);
}
void
@@ -1334,6 +1339,8 @@ BothDateEntry::set_entry_from_option(GncOption& option)
!m_use_absolute);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_abs_button),
m_use_absolute);
+
+ toggle_relative(m_use_absolute);
}
void
commit db6a8f809be236b0092910713e22086668dea9b7
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Thu Apr 21 09:56:30 2022 +0100
Tax Tables combo does not set the active one
Fixed by correcting spelling of tax table qof type, should
'gncTaxTable'. Also fixed setting tax table combo to 'none' when page
reset button used.
diff --git a/gnucash/gnome/business-options-gnome.cpp b/gnucash/gnome/business-options-gnome.cpp
index 48144d929..43e47f7bb 100644
--- a/gnucash/gnome/business-options-gnome.cpp
+++ b/gnucash/gnome/business-options-gnome.cpp
@@ -167,6 +167,9 @@ public:
if (taxtable)
gnc_simple_combo_set_value(GTK_COMBO_BOX(get_widget()),
GNC_TAXTABLE(taxtable));
+ else
+ gnc_simple_combo_set_value(GTK_COMBO_BOX(get_widget()),
+ nullptr);
}
void set_option_from_ui_item(GncOption& option) noexcept override
{
diff --git a/libgnucash/app-utils/gnc-option-impl.cpp b/libgnucash/app-utils/gnc-option-impl.cpp
index 5a6f0e9c7..be976e122 100644
--- a/libgnucash/app-utils/gnc-option-impl.cpp
+++ b/libgnucash/app-utils/gnc-option-impl.cpp
@@ -587,7 +587,7 @@ qof_instance_from_guid(GncGUID* guid, GncOptionUIType type)
qof_type = "gncInvoice";
break;
case GncOptionUIType::TAX_TABLE:
- qof_type = "gncTaxtable";
+ qof_type = "gncTaxTable";
break;
case GncOptionUIType::ACCOUNT_LIST:
case GncOptionUIType::ACCOUNT_SEL:
commit 5d15647430d7303885eb120740955a9765e9f5ba
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Mon Apr 18 13:37:35 2022 +0100
Change some function alignments.
diff --git a/gnucash/gnome-utils/dialog-options.cpp b/gnucash/gnome-utils/dialog-options.cpp
index befcfc39d..7e1b379f2 100644
--- a/gnucash/gnome-utils/dialog-options.cpp
+++ b/gnucash/gnome-utils/dialog-options.cpp
@@ -647,7 +647,7 @@ component_close_handler (gpointer data)
/** Constructs a GncOptionsDialog
*
* Based on the description in the GtkBuilder file. Initializes signals.
- * Two component classes might be used, DIALOG_BOOK_OPTIONS_CM_CLASS or DIALOG_OPTIONS_CM_CLASS of which the latter is the default.
+ * Two component classes might be used, DIALOG_BOOK_OPTIONS_CM_CLASS or DIALOG_OPTIONS_CM_CLASS of which the latter is the default.
*
* @param modal: If true the "Apply" button is hidden. It doesn't make the dialog run in its own event loop so it's not truly modal.
* @param title: The title that will appear in the dialog's title bar.
@@ -2642,9 +2642,9 @@ create_option_widget<GncOptionUIType::PLOT_SIZE> (GncOption& option,
g_signal_connect(G_OBJECT(value_percent), "changed",
G_CALLBACK(gnc_option_changed_widget_cb), &option);
g_signal_connect(G_OBJECT(px_butt), "toggled",
- G_CALLBACK(gnc_rd_option_px_set_cb), &option);
+ G_CALLBACK(gnc_rd_option_px_set_cb), &option);
g_signal_connect(G_OBJECT(p_butt), "toggled",
- G_CALLBACK(gnc_rd_option_p_set_cb), &option);
+ G_CALLBACK(gnc_rd_option_p_set_cb), &option);
gtk_container_add(GTK_CONTAINER(*enclosing), hbox);
gtk_widget_show_all(*enclosing);
commit 17cf31700d19cfca74694ded2ec927b2ffbdb123
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Mon Apr 18 13:36:16 2022 +0100
Move setting up the account select changed callback till after selecting default value.
diff --git a/gnucash/gnome-utils/dialog-options.cpp b/gnucash/gnome-utils/dialog-options.cpp
index 1b85ed6eb..befcfc39d 100644
--- a/gnucash/gnome-utils/dialog-options.cpp
+++ b/gnucash/gnome-utils/dialog-options.cpp
@@ -1828,14 +1828,14 @@ create_option_widget<GncOptionUIType::ACCOUNT_SEL> (GncOption& option,
gnc_account_sel_set_acct_filters(GNC_ACCOUNT_SEL(widget),
acct_type_list, NULL);
g_list_free(acct_type_list);
- g_signal_connect(widget, "account_sel_changed",
- G_CALLBACK(gnc_option_changed_widget_cb), &option);
-
-// gnc_account_sel doesn't emit a changed signal
+ // gnc_account_sel doesn't emit a changed signal
option.set_ui_item(std::make_unique<GncGtkAccountSelUIItem>(widget));
option.set_ui_item_from_option();
+ g_signal_connect(widget, "account_sel_changed",
+ G_CALLBACK(gnc_option_changed_widget_cb), &option);
+
*enclosing = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
gtk_box_set_homogeneous (GTK_BOX (*enclosing), FALSE);
gtk_box_pack_start(GTK_BOX(*enclosing), widget, FALSE, FALSE, 0);
commit d78a6b2d12e766beaccbf690b1300dca34f1aabe
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Mon Apr 18 13:32:17 2022 +0100
Segfault when leaving the properties option pages in hierarchy assistant
Segfaults when trying to retrieve the default budget value. Check for a
valid iter before trying to retrieve the budget.
diff --git a/gnucash/gnome-utils/dialog-options.cpp b/gnucash/gnome-utils/dialog-options.cpp
index 06ebcfde8..1b85ed6eb 100644
--- a/gnucash/gnome-utils/dialog-options.cpp
+++ b/gnucash/gnome-utils/dialog-options.cpp
@@ -2691,10 +2691,12 @@ public:
{
GtkTreeIter iter;
auto widget{GTK_COMBO_BOX(get_widget())};
- gtk_combo_box_get_active_iter(widget, &iter);
- auto tree_model{gtk_combo_box_get_model(widget)};
- auto budget{gnc_tree_model_budget_get_budget(tree_model, &iter)};
- option.set_value(qof_instance_cast(budget));
+ if (gtk_combo_box_get_active_iter(widget, &iter))
+ {
+ auto tree_model{gtk_combo_box_get_model(widget)};
+ auto budget{gnc_tree_model_budget_get_budget(tree_model, &iter)};
+ option.set_value(qof_instance_cast(budget));
+ }
}
};
commit 91c7333aa2011b69e8f46fdda1ee019ce30f9dfd
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Mon Apr 18 13:27:33 2022 +0100
Fix segfault when running hierarchy assistant
When the dialog options properties page is part of the hierarchy
assistant, the top level window has changed and so can no longer get
the option_win pointer so test for this being null before trying to
update the sensitivity of the buttons.
diff --git a/gnucash/gnome-utils/dialog-options.cpp b/gnucash/gnome-utils/dialog-options.cpp
index 29b156b69..06ebcfde8 100644
--- a/gnucash/gnome-utils/dialog-options.cpp
+++ b/gnucash/gnome-utils/dialog-options.cpp
@@ -214,7 +214,9 @@ dialog_changed_internal (GtkWidget *widget, bool sensitive)
auto option_win =
static_cast<GncOptionsDialog*>(g_object_get_data(G_OBJECT(toplevel),
"optionwin"));
- option_win->set_sensitive(sensitive);
+
+ if (option_win) // this null when part of assistant
+ option_win->set_sensitive(sensitive);
}
void
commit 0b67a912175c272b82c2fd5a897d174eef39b8d0
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Mon Apr 18 10:00:36 2022 +0100
Fix the option GncOptionRangeValue
The GncOptionRangeValue can be used with integers or doubles, the
default being doubles. When used for setting the plot width/height,
integers are used so all ValueTypes need to be integers other wise
the when create_range_spinner is used you end up with the upper_bound
value being G_MAXDOUBLE, a 309 character wide spin button. To
differentiate the two, use 'set_alternate(true)' for integers.
diff --git a/gnucash/gnome-utils/dialog-options.cpp b/gnucash/gnome-utils/dialog-options.cpp
index 4365ec2e2..29b156b69 100644
--- a/gnucash/gnome-utils/dialog-options.cpp
+++ b/gnucash/gnome-utils/dialog-options.cpp
@@ -2021,12 +2021,19 @@ public:
GncOptionGtkUIItem{widget, GncOptionUIType::NUMBER_RANGE} {}
void set_ui_item_from_option(GncOption& option) noexcept override
{
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(get_widget()),
- option.get_value<double>());
+ if (option.is_alternate())
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(get_widget()),
+ option.get_value<int>());
+ else
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(get_widget()),
+ option.get_value<double>());
}
void set_option_from_ui_item(GncOption& option) noexcept override
{
- option.set_value<double>(gtk_spin_button_get_value(GTK_SPIN_BUTTON(get_widget())));
+ if (option.is_alternate())
+ option.set_value<int>(gtk_spin_button_get_value(GTK_SPIN_BUTTON(get_widget())));
+ else
+ option.set_value<double>(gtk_spin_button_get_value(GTK_SPIN_BUTTON(get_widget())));
}
};
@@ -2042,7 +2049,19 @@ create_range_spinner(GncOption& option)
gdouble upper_bound = G_MAXDOUBLE;
gdouble step_size = 1.0;
- option.get_limits(upper_bound, lower_bound, step_size);
+ if (option.is_alternate())
+ {
+ int tmp_lower_bound = G_MININT;
+ int tmp_upper_bound = G_MAXINT;
+ int tmp_step_size = 1.0;
+ option.get_limits<int>(tmp_upper_bound, tmp_lower_bound, tmp_step_size);
+ lower_bound =(double)tmp_lower_bound;
+ upper_bound = (double)tmp_upper_bound;
+ step_size = (double)tmp_step_size;
+ }
+ else
+ option.get_limits<double>(upper_bound, lower_bound, step_size);
+
auto adj = GTK_ADJUSTMENT(gtk_adjustment_new(lower_bound, lower_bound,
upper_bound, step_size,
step_size * 5.0,
diff --git a/libgnucash/app-utils/gnc-option-impl.hpp b/libgnucash/app-utils/gnc-option-impl.hpp
index d126e3ea7..75dd9d41f 100644
--- a/libgnucash/app-utils/gnc-option-impl.hpp
+++ b/libgnucash/app-utils/gnc-option-impl.hpp
@@ -335,8 +335,9 @@ public:
OptionClassifier{section, name, key, doc_string},
m_value{value >= min && value <= max ? value : min},
m_default_value{value >= min && value <= max ? value : min},
- m_min{min}, m_max{max}, m_step{step} {}
-
+ m_min{min}, m_max{max}, m_step{step} {
+ if constexpr(is_same_decayed_v<ValueType, int>)
+ set_alternate(true);}
GncOptionRangeValue<ValueType>(const GncOptionRangeValue<ValueType>&) = default;
GncOptionRangeValue<ValueType>(GncOptionRangeValue<ValueType>&&) = default;
GncOptionRangeValue<ValueType>& operator=(const GncOptionRangeValue<ValueType>&) = default;
@@ -369,10 +370,7 @@ public:
GncOptionUIType get_ui_type() const noexcept { return m_ui_type; }
void make_internal() { m_ui_type = GncOptionUIType::INTERNAL; }
bool is_alternate() const noexcept { return m_alternate; }
- void set_alternate(bool value) noexcept {
- if (m_ui_type == GncOptionUIType::PLOT_SIZE)
- m_alternate = value;
- }
+ void set_alternate(bool value) noexcept { m_alternate = value; }
std::string serialize() const noexcept;
bool deserialize(const std::string& str) noexcept;
private:
commit 506eb38493e3ad5edd5672b365a514616986bcd1
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Mon Apr 18 09:56:04 2022 +0100
Update Chart Width/Height Plot setting
The new plot setting does both settings, values above 100 are treated
as pixels and ones below are treated as a percentage. This means the
maximum valid setting must be higher and also the tooltip needs to be
changed.
diff --git a/gnucash/report/options-utilities.scm b/gnucash/report/options-utilities.scm
index 12c3b4ea5..2d9402102 100644
--- a/gnucash/report/options-utilities.scm
+++ b/gnucash/report/options-utilities.scm
@@ -157,7 +157,7 @@
(gnc:make-number-plot-size-option
pagename name-width
(string-append sort-tag "a")
- (N_ "Width of plot in pixels.") default-width
+ (N_ "Width of plot, 10 - 100 in percent, above in pixels.") default-width
100 20000 0 5))
(gnc:register-option
@@ -165,7 +165,7 @@
(gnc:make-number-plot-size-option
pagename name-height
(string-append sort-tag "b")
- (N_ "Height of plot in pixels.") default-height
+ (N_ "Height of plot, 10 - 100 in percent, above in pixels.") default-height
100 20000 0 5)))
;; A multicoice option for the marker of a scatter plot.
diff --git a/libgnucash/app-utils/options.scm b/libgnucash/app-utils/options.scm
index 51086d6b2..390c52dad 100644
--- a/libgnucash/app-utils/options.scm
+++ b/libgnucash/app-utils/options.scm
@@ -255,7 +255,7 @@
(define-public (gnc:make-number-plot-size-option section name key docstring default min max dec-places step)
(issue-deprecation-warning "gnc:make-number-plot-size-option is deprecated. Make and register the option in one command with gnc-register-plot-size-range-option.")
;; Ignore what the call asks for, only 10-100% makes sense.
- (gnc-make-plot-size-option section name key docstring 100 10 100 1))
+ (gnc-make-plot-size-option section name key docstring 100 10 2000 1))
(define-public (gnc:make-query-option section name default)
(issue-deprecation-warning "gnc:make-query-option is deprecated. Make and register the option in one command with gnc-register-query-option.")
(let ((defv (if (list? default) default (gnc-query2scm default))))
commit 6e8272b7b39886a6042d00dafadc07a6ee641e49
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Wed Apr 13 16:43:13 2022 +0100
Casting error on the terminal
Opening options dialog would generate the following error on the
terminal, invalid cast from 'GtkComboBox' to 'GNCDateEdit' which was
traced back to the RelativeDateEntry block_signals function. The
returned value of the cast was not being used so was removed.
diff --git a/gnucash/gnome-utils/dialog-options.cpp b/gnucash/gnome-utils/dialog-options.cpp
index 6442432f8..4365ec2e2 100644
--- a/gnucash/gnome-utils/dialog-options.cpp
+++ b/gnucash/gnome-utils/dialog-options.cpp
@@ -1248,7 +1248,6 @@ RelativeDateEntry::set_option_from_entry(GncOption& option)
void
RelativeDateEntry::block_signals(bool block)
{
- auto entry{G_OBJECT(GNC_DATE_EDIT(m_entry)->date_entry)};
if (block)
g_signal_handler_block(m_entry, m_handler_id);
else
commit 3fcaaef657abf3240908e0d380a19adabba5740c
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Wed Apr 13 16:32:59 2022 +0100
Object reference error on terminal
Opening options dialog would generate the following error on the
terminal, g_object_ref: assertion 'G_IS_OBJECT (object)' failed which
was traced back to GncOptionDateUIItem trying to use a null pointer to
reference the GtkUIItem.
diff --git a/gnucash/gnome-utils/dialog-options.cpp b/gnucash/gnome-utils/dialog-options.cpp
index cc00319b7..6442432f8 100644
--- a/gnucash/gnome-utils/dialog-options.cpp
+++ b/gnucash/gnome-utils/dialog-options.cpp
@@ -1365,7 +1365,7 @@ class GncOptionDateUIItem : public GncOptionGtkUIItem
{
public:
GncOptionDateUIItem(GncDateEntryPtr entry, GncOptionUIType type) :
- GncOptionGtkUIItem{nullptr, type}, m_entry{std::move(entry)} { }
+ GncOptionGtkUIItem{entry->get_widget(), type}, m_entry{std::move(entry)} { }
~GncOptionDateUIItem() = default;
void clear_ui_item() override { m_entry = nullptr; }
void set_ui_item_from_option(GncOption& option) noexcept override
commit 6d390dc6b45344b0b39ac013e3310529b9df6456
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Wed Apr 13 16:07:34 2022 +0100
Error in trace file, gtk_box_pack: assertion failed
In create_list_widget there was a duplicate set of lines that were
trying to pack the view into the same box widget.
diff --git a/gnucash/gnome-utils/dialog-options.cpp b/gnucash/gnome-utils/dialog-options.cpp
index 4cab1d4ab..cc00319b7 100644
--- a/gnucash/gnome-utils/dialog-options.cpp
+++ b/gnucash/gnome-utils/dialog-options.cpp
@@ -1986,11 +1986,6 @@ create_list_widget(GncOption& option, char *name)
g_object_set (G_OBJECT(hbox), "margin", 3, NULL);
- option.set_ui_item(std::make_unique<GncGtkListUIItem>(GTK_WIDGET(view)));
- option.set_ui_item_from_option();
-
- gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(view), FALSE, FALSE, 0);
-
return frame;
}
commit b843dac2d1e57bfaa303be2559110bb8649b02df
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Wed Apr 13 15:56:50 2022 +0100
Block the list selection changed signal
While the options dialog is loading, populating the GncGtkListUIItem
will cause the selection changed signal to be emitted and update the
options buttons but they are not yet available so block the signal.
diff --git a/gnucash/gnome-utils/dialog-options.cpp b/gnucash/gnome-utils/dialog-options.cpp
index 27bccb856..4cab1d4ab 100644
--- a/gnucash/gnome-utils/dialog-options.cpp
+++ b/gnucash/gnome-utils/dialog-options.cpp
@@ -1893,6 +1893,7 @@ public:
{
auto widget{GTK_TREE_VIEW(get_widget())};
auto selection{gtk_tree_view_get_selection(widget)};
+ g_signal_handlers_block_by_func(selection, (gpointer)list_changed_cb, &option);
gtk_tree_selection_unselect_all(selection);
for (auto index : option.get_value<GncMultichoiceOptionIndexVec>())
{
@@ -1900,6 +1901,7 @@ public:
gtk_tree_selection_select_path(selection, path);
gtk_tree_path_free(path);
}
+ g_signal_handlers_unblock_by_func(selection, (gpointer)list_changed_cb, &option);
}
void set_option_from_ui_item(GncOption& option) noexcept override
{
commit adbc301499c4910f80be06e29cf4bb51a5278c09
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Wed Apr 13 16:27:34 2022 +0100
Using an eventbox for tooltips is no longer required.
diff --git a/gnucash/gnome-utils/dialog-options.cpp b/gnucash/gnome-utils/dialog-options.cpp
index 4d344a1ef..27bccb856 100644
--- a/gnucash/gnome-utils/dialog-options.cpp
+++ b/gnucash/gnome-utils/dialog-options.cpp
@@ -304,18 +304,12 @@ gnc_option_set_ui_widget(GncOption& option, GtkGrid *page_box, gint grid_row)
}
if (!packed && (enclosing != NULL))
{
- /* Pack option widget into an extra eventbox because otherwise the
- "documentation" tooltip is not displayed. */
- GtkWidget *eventbox = gtk_event_box_new();
-
- gtk_container_add (GTK_CONTAINER (eventbox), enclosing);
-
/* attach the option widget to the second column of the grid */
- gtk_grid_attach (GTK_GRID(page_box), eventbox,
+ gtk_grid_attach (GTK_GRID(page_box), enclosing,
1, grid_row, // left, top
1, 1); // width, height
- gtk_widget_set_tooltip_text (eventbox, documentation);
+ gtk_widget_set_tooltip_text (enclosing, documentation);
}
if (value != NULL)
@@ -1462,15 +1456,10 @@ create_date_option_widget(GncOption& option, GtkGrid *page_box,
gtk_widget_set_halign (GTK_WIDGET(*enclosing), GTK_ALIGN_START);
- /* Pack option widget into an extra eventbox because otherwise the
- "documentation" tooltip is not displayed. */
- auto eventbox = gtk_event_box_new();
- gtk_container_add (GTK_CONTAINER (eventbox), *enclosing);
-
- gtk_grid_attach (GTK_GRID(page_box), eventbox, 1, grid_row, 1, 1);
+ gtk_grid_attach (GTK_GRID(page_box), *enclosing, 1, grid_row, 1, 1);
*packed = TRUE;
- gtk_widget_set_tooltip_text (eventbox, documentation);
+ gtk_widget_set_tooltip_text (*enclosing, documentation);
auto ui_item{dynamic_cast<GncOptionDateUIItem*>(option.get_ui_item())};
if (auto date_ui{ui_item ? ui_item->get_entry() : nullptr})
@@ -2020,15 +2009,10 @@ create_option_widget<GncOptionUIType::LIST> (GncOption& option,
align_label (name_label);
- /* Pack option widget into an extra eventbox because otherwise the
- "documentation" tooltip is not displayed. */
- auto eventbox = gtk_event_box_new();
- gtk_container_add (GTK_CONTAINER (eventbox), *enclosing);
-
- gtk_grid_attach (GTK_GRID(page_box), eventbox, 1, grid_row, 1, 1);
+ gtk_grid_attach (GTK_GRID(page_box), *enclosing, 1, grid_row, 1, 1);
*packed = TRUE;
- gtk_widget_set_tooltip_text(eventbox, documentation);
+ gtk_widget_set_tooltip_text(*enclosing, documentation);
gtk_widget_show(*enclosing);
return value;
commit 94105a19f111ae145f048e164c3c50e3c4e3d7aa
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Wed Apr 13 16:17:03 2022 +0100
GtkFontButton is deprecated, use GtkFontChooser instead
diff --git a/gnucash/gnome-utils/dialog-options.cpp b/gnucash/gnome-utils/dialog-options.cpp
index 4c1574e0d..4d344a1ef 100644
--- a/gnucash/gnome-utils/dialog-options.cpp
+++ b/gnucash/gnome-utils/dialog-options.cpp
@@ -2186,15 +2186,15 @@ public:
GncOptionGtkUIItem{widget, GncOptionUIType::FONT} {}
void set_ui_item_from_option(GncOption& option) noexcept override
{
- GtkFontButton *font_button = GTK_FONT_BUTTON(get_widget());
- gtk_font_button_set_font_name(font_button,
+ GtkFontChooser *font_chooser = GTK_FONT_CHOOSER(get_widget());
+ gtk_font_chooser_set_font(font_chooser,
option.get_value<std::string>().c_str());
}
void set_option_from_ui_item(GncOption& option) noexcept override
{
- GtkFontButton *font_button = GTK_FONT_BUTTON(get_widget());
- option.set_value(std::string{gtk_font_button_get_font_name(font_button)});
+ GtkFontChooser *font_chooser = GTK_FONT_CHOOSER(get_widget());
+ option.set_value(std::string{gtk_font_chooser_get_font(font_chooser)});
}
};
commit 9cce53a6278f2e57d4d3c744a34e4833cc6d3b3d
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Wed Apr 13 15:45:55 2022 +0100
Assistant hierarchy builder functions
With conversion of the source file to *.cpp the GtkBuilder connected
functions need to wrapped in a 'extern "C"' block.
diff --git a/gnucash/gnome/assistant-hierarchy.cpp b/gnucash/gnome/assistant-hierarchy.cpp
index 5f60c1042..56fe345b8 100644
--- a/gnucash/gnome/assistant-hierarchy.cpp
+++ b/gnucash/gnome/assistant-hierarchy.cpp
@@ -130,18 +130,23 @@ typedef struct
} hierarchy_data;
-void on_prepare (GtkAssistant *assistant, GtkWidget *page,
- hierarchy_data *data);
+extern "C"
+{
+void on_prepare (GtkAssistant *assistant, GtkWidget *page,
+ hierarchy_data *data);
+
+void on_cancel (GtkAssistant *gtkassistant, hierarchy_data *data);
+void on_finish (GtkAssistant *gtkassistant, hierarchy_data *data);
+
+void select_all_clicked (GtkButton *button,
+ hierarchy_data *data);
+void clear_all_clicked (GtkButton *button,
+ hierarchy_data *data);
+}
+
void on_choose_account_categories_prepare (hierarchy_data *data);
-void select_all_clicked (GtkButton *button,
- hierarchy_data *data);
-void clear_all_clicked (GtkButton *button,
- hierarchy_data *data);
void on_final_account_prepare (hierarchy_data *data);
void on_select_currency_prepare (hierarchy_data *data);
-void on_cancel (GtkAssistant *gtkassistant, hierarchy_data *data);
-void on_finish (GtkAssistant *gtkassistant, hierarchy_data *data);
-
static void add_one_category (GncExampleAccount *acc, hierarchy_data *data);
static void categories_page_enable_next (hierarchy_data *data);
commit b9e93d6e68a6fd1fcefa8c14ef063d55ce4b1e86
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Wed Apr 13 15:39:24 2022 +0100
Limit saving dialog options window size
Only save the dialog options window size and location via the call
backs for the button press event. Using the destroy signal is not
suitable to save widget state as in this case the window position will
be (0,0).
diff --git a/gnucash/gnome-utils/dialog-options.cpp b/gnucash/gnome-utils/dialog-options.cpp
index 71ee5f3df..4c1574e0d 100644
--- a/gnucash/gnome-utils/dialog-options.cpp
+++ b/gnucash/gnome-utils/dialog-options.cpp
@@ -506,7 +506,6 @@ void GncOptionsDialog::call_apply_cb() noexcept
if (m_apply_cb)
(m_apply_cb)(this, m_apply_cb_data);
m_close_cb = close_cb;
- gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(m_window));
set_sensitive(false);
}
@@ -518,7 +517,6 @@ void GncOptionsDialog::call_help_cb() noexcept
void GncOptionsDialog::call_close_cb() noexcept
{
- gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(m_window));
if (m_close_cb)
{
gtk_window_close(GTK_WINDOW(m_window));
@@ -556,6 +554,7 @@ dialog_help_button_cb(GtkWidget * widget, GncOptionsDialog *win)
static void
dialog_cancel_button_cb(GtkWidget * widget, GncOptionsDialog *win)
{
+ gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(win->get_widget()));
win->call_close_cb();
}
@@ -563,6 +562,7 @@ dialog_cancel_button_cb(GtkWidget * widget, GncOptionsDialog *win)
static void
dialog_apply_button_cb(GtkWidget * widget, GncOptionsDialog *win)
{
+ gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(win->get_widget()));
win->call_apply_cb();
}
@@ -645,7 +645,6 @@ static void
component_close_handler (gpointer data)
{
GncOptionsDialog *win = static_cast<decltype(win)>(data);
- gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(win->get_widget()));
dialog_cancel_button_cb (NULL, win);
}
Summary of changes:
gnucash/gnome-utils/dialog-options.cpp | 131 +++++++++++++++++--------------
gnucash/gnome/assistant-hierarchy.cpp | 23 +++---
gnucash/gnome/business-options-gnome.cpp | 3 +
gnucash/report/options-utilities.scm | 4 +-
libgnucash/app-utils/gnc-option-impl.cpp | 4 +-
libgnucash/app-utils/gnc-option-impl.hpp | 10 +--
libgnucash/app-utils/gnc-optiondb.i | 3 +-
libgnucash/app-utils/options.scm | 2 +-
8 files changed, 98 insertions(+), 82 deletions(-)
More information about the gnucash-changes
mailing list