diff --git a/ChangeLog b/ChangeLog index f9715c5eb7..bbcdd0eb93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,12 @@ 2006-02-20 David Hampton - * src/gnome-utils/gnc-file.[ch]: + * src/bin/gnucash-bin.c: + * src/gnome-utils/glade/commodity.glade: + * src/gnome-utils/dialog-commodity.c: + * src/gnome/dialog-price-edit-db.c: Disable quote related + functionality when F::Q isn't installed. Fixes 130347 and 314054. + * src/gnome-utils/gnc-file.[ch]: * src/gnome-utils/gnc-main-window.c: Catch and defer the quit command if a file save is in progress. Fixes 155327. diff --git a/src/bin/gnucash-bin.c b/src/bin/gnucash-bin.c index 74d1cf7b1a..909d182c58 100644 --- a/src/bin/gnucash-bin.c +++ b/src/bin/gnucash-bin.c @@ -41,6 +41,7 @@ #include "gnc-hooks.h" #include "top-level.h" #include "gfec.h" +#include "gnc-commodity.h" #include "gnc-main.h" #include "gnc-main-window.h" #include "gnc-splash.h" @@ -388,14 +389,19 @@ inner_main_add_price_quotes(void *closure, int argc, char **argv) g_message("Beginning to install price-quote sources"); scm_c_eval_string("(gnc:price-quotes-install-sources)"); - add_quotes = scm_c_eval_string("gnc:add-quotes-to-book-at-url"); - scm_filename = scm_makfrom0str (add_quotes_file); - scm_result = scm_call_1(add_quotes, scm_filename); + if (gnc_quote_source_fq_installed()) { + add_quotes = scm_c_eval_string("gnc:add-quotes-to-book-at-url"); + scm_filename = scm_makfrom0str (add_quotes_file); + scm_result = scm_call_1(add_quotes, scm_filename); - if (!SCM_NFALSEP(scm_result)) { + if (!SCM_NFALSEP(scm_result)) { g_error("Failed to add quotes to %s.", add_quotes_file); gnc_shutdown(1); + } + } else { + g_print(_("No quotes retrieved. Finance::Quote isn't installed properly.\n")); } + gnc_engine_resume_events(); gnc_shutdown(0); return; diff --git a/src/gnome-utils/dialog-commodity.c b/src/gnome-utils/dialog-commodity.c index 519efd4fb2..72f717604b 100644 --- a/src/gnome-utils/dialog-commodity.c +++ b/src/gnome-utils/dialog-commodity.c @@ -83,6 +83,8 @@ struct commodity_window { guint comm_section_top; guint comm_section_bottom; + guint fq_section_top; + guint fq_section_bottom; gboolean is_currency; gnc_commodity *edit_commodity; @@ -540,6 +542,28 @@ gnc_ui_update_commodity_info (CommodityWindow *cw) gnc_set_commodity_section_sensitivity, cw); } +static void +gnc_set_fq_sensitivity (GtkWidget *widget, gpointer user_data) +{ + CommodityWindow *cw = user_data; + guint offset = 0; + + gtk_container_child_get(GTK_CONTAINER(cw->table), widget, + "top-attach", &offset, + NULL); + + if ((offset < cw->fq_section_top) || (offset >= cw->fq_section_bottom)) + return; + g_object_set(widget, "sensitive", FALSE, NULL); +} + +static void +gnc_ui_update_fq_info (CommodityWindow *cw) +{ + gtk_container_foreach(GTK_CONTAINER(cw->table), + gnc_set_fq_sensitivity, cw); +} + /******************************************************************** * gnc_ui_update_namespace_picker ********************************************************************/ @@ -907,8 +931,14 @@ gnc_ui_new_commodity_dialog(const char * selected_namespace, if (gnc_quote_source_fq_installed()) { gtk_widget_destroy(glade_xml_get_widget (xml, "finance_quote_warning")); } else { - gtk_widget_set_sensitive(glade_xml_get_widget (xml, "price_quote_frame"), - FALSE); + /* Determine the price quote of the dialog */ + widget = glade_xml_get_widget (xml, "fq_warning_alignment"); + gtk_container_child_get(GTK_CONTAINER(retval->table), widget, + "bottom-attach", &retval->fq_section_top, NULL); + widget = glade_xml_get_widget (xml, "quote_tz_alignment"); + gtk_container_child_get(GTK_CONTAINER(retval->table), widget, + "bottom-attach", &retval->fq_section_bottom, NULL); + gnc_ui_update_fq_info (retval); } diff --git a/src/gnome-utils/glade/commodity.glade b/src/gnome-utils/glade/commodity.glade index 4a2661352b..abb651709a 100644 --- a/src/gnome-utils/glade/commodity.glade +++ b/src/gnome-utils/glade/commodity.glade @@ -981,7 +981,7 @@ - + True 0.5 0.5 @@ -1219,7 +1219,7 @@ - + True 0.5 0.5 diff --git a/src/gnome/dialog-price-edit-db.c b/src/gnome/dialog-price-edit-db.c index 928e449374..3a7b80391c 100644 --- a/src/gnome/dialog-price-edit-db.c +++ b/src/gnome/dialog-price-edit-db.c @@ -392,6 +392,11 @@ gnc_prices_dialog_create (GtkWidget * parent, PricesDialog *pdb_dialog) button = glade_xml_get_widget (xml, "remove_button"); pdb_dialog->remove_button = button; + + if (!gnc_quote_source_fq_installed()) { + button = glade_xml_get_widget (xml, "get_quotes_button"); + gtk_widget_set_sensitive(button, FALSE); + } } gnc_restore_window_size(GCONF_SECTION, GTK_WINDOW(pdb_dialog->dialog));