Disable quote related functionality when F::Q isn't installed.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13339 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton
2006-02-21 03:44:15 +00:00
parent 416a64337f
commit de8e3a75c4
5 changed files with 55 additions and 9 deletions

View File

@@ -1,7 +1,12 @@
2006-02-20 David Hampton <hampton@employees.org>
* 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.

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -981,7 +981,7 @@
</child>
<child>
<widget class="GtkAlignment" id="alignment8">
<widget class="GtkAlignment" id="fq_warning_alignment">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
@@ -1219,7 +1219,7 @@
</child>
<child>
<widget class="GtkAlignment" id="alignment14">
<widget class="GtkAlignment" id="quote_tz_alignment">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>

View File

@@ -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));