Restore clickable links for price quotes.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13572 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton 2006-03-09 21:23:42 +00:00
parent 321f21a303
commit 64ee595be2
4 changed files with 61 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2006-03-09 David Hampton <hampton@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@codehelp.co.uk> 2006-03-09 Neil Williams <linux@codehelp.co.uk>
* src/optional/Makefile.am : Make xsl/ available * src/optional/Makefile.am : Make xsl/ available

View File

@ -109,6 +109,7 @@ typedef enum
GNCPrice* gnc_price_edit_dialog (gncUIWidget parent, QofSession *session, GNCPrice* gnc_price_edit_dialog (gncUIWidget parent, QofSession *session,
GNCPrice *price, GNCPriceEditType type); GNCPrice *price, GNCPriceEditType type);
GNCPrice* gnc_price_edit_by_guid (GtkWidget * parent, const GUID * guid);
void gnc_prices_dialog (gncUIWidget parent); void gnc_prices_dialog (gncUIWidget parent);
void gnc_commodities_dialog (gncUIWidget parent); void gnc_commodities_dialog (gncUIWidget parent);

View File

@ -37,6 +37,7 @@
#include "gnc-date-edit.h" #include "gnc-date-edit.h"
#include "qof.h" #include "qof.h"
#include "gnc-pricedb.h" #include "gnc-pricedb.h"
#include "gnc-session.h"
#include "gnc-ui.h" #include "gnc-ui.h"
#include "gnc-ui-util.h" #include "gnc-ui-util.h"
#include "guile-util.h" #include "guile-util.h"
@ -484,3 +485,24 @@ gnc_price_edit_dialog (GtkWidget * parent,
gtk_widget_show (pedit_dialog->dialog); gtk_widget_show (pedit_dialog->dialog);
return(price); 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));
}

View File

@ -167,6 +167,35 @@ gnc_html_register_url_cb (const char *location, const char *label,
/* ============================================================== */ /* ============================================================== */
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 /** Restore all persistent program state. This function finds the
* "new" state file associated with a specific book guid. It then * "new" state file associated with a specific book guid. It then
* iterates through this state information, calling a helper function * iterates through this state information, calling a helper function
@ -360,6 +389,9 @@ gnc_main_gui_init (void)
gnc_html_register_url_handler (URL_TYPE_REGISTER, gnc_html_register_url_handler (URL_TYPE_REGISTER,
gnc_html_register_url_cb); gnc_html_register_url_cb);
gnc_html_register_url_handler (URL_TYPE_PRICE,
gnc_html_price_url_cb);
gnc_ui_sx_initialize(); gnc_ui_sx_initialize();
/* FIXME Remove this test code */ /* FIXME Remove this test code */