[Gnucash-changes] r13572 - gnucash/trunk - Restore clickable links
for price quotes.
David Hampton
hampton at cvs.gnucash.org
Thu Mar 9 16:23:42 EST 2006
Author: hampton
Date: 2006-03-09 16:23:42 -0500 (Thu, 09 Mar 2006)
New Revision: 13572
Trac: http://svn.gnucash.org/trac/changeset/13572
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/src/gnc-ui.h
gnucash/trunk/src/gnome/dialog-price-editor.c
gnucash/trunk/src/gnome/top-level.c
Log:
Restore clickable links for price quotes.
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2006-03-09 18:12:14 UTC (rev 13571)
+++ gnucash/trunk/ChangeLog 2006-03-09 21:23:42 UTC (rev 13572)
@@ -1,3 +1,9 @@
+2006-03-09 David Hampton <hampton at employees.org>
+
+ * src/gnome/dialog-price-editor.c:
+ * src/gnome/top-level.c:
+ * src/gnc-ui.h: Restore clickable links for price quotes.
+
2006-03-09 Neil Williams <linux at codehelp.co.uk>
* src/optional/Makefile.am : Make xsl/ available
Modified: gnucash/trunk/src/gnc-ui.h
===================================================================
--- gnucash/trunk/src/gnc-ui.h 2006-03-09 18:12:14 UTC (rev 13571)
+++ gnucash/trunk/src/gnc-ui.h 2006-03-09 21:23:42 UTC (rev 13572)
@@ -109,6 +109,7 @@
GNCPrice* gnc_price_edit_dialog (gncUIWidget parent, QofSession *session,
GNCPrice *price, GNCPriceEditType type);
+GNCPrice* gnc_price_edit_by_guid (GtkWidget * parent, const GUID * guid);
void gnc_prices_dialog (gncUIWidget parent);
void gnc_commodities_dialog (gncUIWidget parent);
Modified: gnucash/trunk/src/gnome/dialog-price-editor.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-price-editor.c 2006-03-09 18:12:14 UTC (rev 13571)
+++ gnucash/trunk/src/gnome/dialog-price-editor.c 2006-03-09 21:23:42 UTC (rev 13572)
@@ -37,6 +37,7 @@
#include "gnc-date-edit.h"
#include "qof.h"
#include "gnc-pricedb.h"
+#include "gnc-session.h"
#include "gnc-ui.h"
#include "gnc-ui-util.h"
#include "guile-util.h"
@@ -484,3 +485,24 @@
gtk_widget_show (pedit_dialog->dialog);
return(price);
}
+
+/********************************************************************\
+ * gnc_price_edit_by_guid *
+ * opens up a window to edit price information *
+ * *
+ * Args: parent - the parent of the window to be created *
+ * Return: nothing *
+\********************************************************************/
+GNCPrice *
+gnc_price_edit_by_guid (GtkWidget * parent, const GUID * guid)
+{
+ GNCPrice *price;
+ QofSession *session;
+
+ session = gnc_get_current_session ();
+ price = gnc_price_lookup (guid, qof_session_get_book(session));
+ if (price == NULL)
+ return(NULL);
+
+ return(gnc_price_edit_dialog(parent, session, price, GNC_PRICE_EDIT));
+}
Modified: gnucash/trunk/src/gnome/top-level.c
===================================================================
--- gnucash/trunk/src/gnome/top-level.c 2006-03-09 18:12:14 UTC (rev 13571)
+++ gnucash/trunk/src/gnome/top-level.c 2006-03-09 21:23:42 UTC (rev 13572)
@@ -167,6 +167,35 @@
/* ============================================================== */
+static gboolean
+gnc_html_price_url_cb (const char *location, const char *label,
+ gboolean new_window, GNCURLResult *result)
+{
+ QofBook * book = gnc_get_current_book();
+ g_return_val_if_fail (location != NULL, FALSE);
+ g_return_val_if_fail (result != NULL, FALSE);
+
+ result->load_to_stream = FALSE;
+
+ /* href="gnc-register:guid=12345678901234567890123456789012" */
+ IF_TYPE ("price-guid=", GNC_ID_PRICE)
+ if (!gnc_price_edit_by_guid (NULL, &guid))
+ {
+ result->error_message = g_strdup_printf (_("No such price: %s"),
+ location);
+ return FALSE;
+ }
+ }
+ else
+ {
+ result->error_message = g_strdup_printf (_("Badly formed URL %s"),
+ location);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
/** Restore all persistent program state. This function finds the
* "new" state file associated with a specific book guid. It then
* iterates through this state information, calling a helper function
@@ -360,6 +389,9 @@
gnc_html_register_url_handler (URL_TYPE_REGISTER,
gnc_html_register_url_cb);
+ gnc_html_register_url_handler (URL_TYPE_PRICE,
+ gnc_html_price_url_cb);
+
gnc_ui_sx_initialize();
/* FIXME Remove this test code */
More information about the gnucash-changes
mailing list