[Gnucash-changes] r13339 - gnucash/trunk - Disable quote related functionality when F::Q isn't installed.

David Hampton hampton at cvs.gnucash.org
Mon Feb 20 22:44:15 EST 2006


Author: hampton
Date: 2006-02-20 22:44:15 -0500 (Mon, 20 Feb 2006)
New Revision: 13339
Trac: http://svn.gnucash.org/trac/changeset/13339

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/bin/gnucash-bin.c
   gnucash/trunk/src/gnome-utils/dialog-commodity.c
   gnucash/trunk/src/gnome-utils/glade/commodity.glade
   gnucash/trunk/src/gnome/dialog-price-edit-db.c
Log:
Disable quote related functionality when F::Q isn't installed.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-02-21 01:24:03 UTC (rev 13338)
+++ gnucash/trunk/ChangeLog	2006-02-21 03:44:15 UTC (rev 13339)
@@ -1,7 +1,12 @@
 2006-02-20  David Hampton  <hampton at employees.org>
 
+	* 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.
 

Modified: gnucash/trunk/src/bin/gnucash-bin.c
===================================================================
--- gnucash/trunk/src/bin/gnucash-bin.c	2006-02-21 01:24:03 UTC (rev 13338)
+++ gnucash/trunk/src/bin/gnucash-bin.c	2006-02-21 03:44:15 UTC (rev 13339)
@@ -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 @@
     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;

Modified: gnucash/trunk/src/gnome/dialog-price-edit-db.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-price-edit-db.c	2006-02-21 01:24:03 UTC (rev 13338)
+++ gnucash/trunk/src/gnome/dialog-price-edit-db.c	2006-02-21 03:44:15 UTC (rev 13339)
@@ -392,6 +392,11 @@
 
     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));

Modified: gnucash/trunk/src/gnome-utils/dialog-commodity.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-commodity.c	2006-02-21 01:24:03 UTC (rev 13338)
+++ gnucash/trunk/src/gnome-utils/dialog-commodity.c	2006-02-21 03:44:15 UTC (rev 13339)
@@ -83,6 +83,8 @@
 
   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_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 @@
   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);
   }
 
 

Modified: gnucash/trunk/src/gnome-utils/glade/commodity.glade
===================================================================
--- gnucash/trunk/src/gnome-utils/glade/commodity.glade	2006-02-21 01:24:03 UTC (rev 13338)
+++ gnucash/trunk/src/gnome-utils/glade/commodity.glade	2006-02-21 03:44:15 UTC (rev 13339)
@@ -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>



More information about the gnucash-changes mailing list