uh.. I guess attaching the patch is helpful :)
-Jamie
Index: src/gnome-utils/glade/transfer.glade =================================================================== --- src/gnome-utils/glade/transfer.glade (revision 17688) +++ src/gnome-utils/glade/transfer.glade (working copy) @@ -17,6 +17,7 @@ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="focus_on_map">True</property> + <property name="urgency_hint">False</property> <property name="has_separator">False</property> <signal name="response" handler="gnc_xfer_dialog_response_cb" last_modification_time="Sun, 27 Jul 2003 17:44:58 GMT"/> @@ -57,6 +58,83 @@ <property name="response_id">-5</property> </widget> </child> + + <child> + <widget class="GtkButton" id="fetch"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="response_id">-10</property> + <signal name="clicked" handler="gnc_xfer_dialog_fetch" after="yes" last_modification_time="Wed, 05 Nov 2008 19:33:19 GMT"/> + + <child> + <widget class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">0</property> + <property name="yscale">0</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">0</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkHBox" id="hbox1"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">2</property> + + <child> + <widget class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="stock">gtk-connect</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <signal name="button_press_event" handler="gnc_xfer_dialog_fetch" after="yes" last_modification_time="Wed, 05 Nov 2008 00:00:25 GMT"/> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Fetch Rate</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + </widget> + </child> </widget> <packing> <property name="padding">0</property> Index: src/gnome-utils/dialog-transfer.c =================================================================== --- src/gnome-utils/dialog-transfer.c (revision 17688) +++ src/gnome-utils/dialog-transfer.c (working copy) @@ -44,6 +44,10 @@ #include "gnc-ui.h" #include "Transaction.h" #include "Account.h" +#include <libguile.h> +#include "swig-runtime.h" +#include "guile-mappings.h" +#include "engine-helpers.h" #define DIALOG_TRANSFER_CM_CLASS "dialog-transfer" @@ -109,6 +113,8 @@ GtkWidget * price_radio; GtkWidget * amount_radio; + GtkWidget * fetch_button; + GtkTooltips *tips; GNCBook * book; @@ -1240,6 +1246,13 @@ Split *to_split; ENTER(" "); + + if (response == GTK_RESPONSE_APPLY) + { + LEAVE("fetching exchange rate"); + return; + } + if (response != GTK_RESPONSE_OK) { gnc_close_gui_component_by_data (DIALOG_TRANSFER_CM_CLASS, xferData); LEAVE("cancel, etc."); @@ -1537,6 +1550,56 @@ static void +gnc_xfer_dialog_fetch (GtkButton *button, XferDialog *xferData) +{ + gnc_numeric rate; + GNCPrice *prc; + gnc_commodity *from = xferData->from_commodity; + gnc_commodity *to = xferData->to_commodity; + SCM quotes_func; + SCM book_scm; + SCM scm_window; + + g_return_if_fail (xferData); + + ENTER(" "); + + quotes_func = scm_c_eval_string ("gnc:book-add-quotes"); + + if (!SCM_PROCEDUREP (quotes_func)) { + LEAVE("quote retrieval failed"); + return; + } + + book_scm = gnc_book_to_scm (xferData->book); + if (SCM_NFALSEP (scm_not (book_scm))) { + LEAVE("no book"); + return; + } + + scm_window = SWIG_NewPointerObj(xferData->dialog, + SWIG_TypeQuery("_p_GtkWidget"), 0); + + if (SCM_NFALSEP (scm_not (book_scm))) { + LEAVE("no scm window"); + return; + } + + gnc_set_busy_cursor (NULL, TRUE); + scm_call_2 (quotes_func, scm_window, book_scm); + gnc_unset_busy_cursor (NULL); + + /*the results should be in the price db now */ + + prc = gnc_pricedb_lookup_latest(xferData->pricedb, from, to); + rate = gnc_price_get_value (prc); + gnc_amount_edit_set_amount(GNC_AMOUNT_EDIT(xferData->price_edit), rate); + + LEAVE("quote retrieved"); + +} + +static void gnc_xfer_dialog_create(GtkWidget *parent, XferDialog *xferData) { GtkWidget *dialog; @@ -1573,6 +1636,10 @@ xferData->transferinfo_label = glade_xml_get_widget (xml, "transferinfo-label"); + xferData->fetch_button = glade_xml_get_widget (xml, "fetch"); + glade_xml_signal_connect_data (xml, "gnc_xfer_dialog_fetch", + G_CALLBACK (gnc_xfer_dialog_fetch), xferData); + /* amount & date widgets */ { GtkWidget *amount; @@ -1956,7 +2023,7 @@ DEBUG("gtk_dialog_run returned %d", response); gnc_xfer_dialog_response_cb (dialog, response, xferData); - if (response != GTK_RESPONSE_OK) { + if ((response != GTK_RESPONSE_OK) && (response != GTK_RESPONSE_APPLY)) { LEAVE("not ok"); return FALSE; }
_______________________________________________ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel