mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
* src/gnome/dialog-price-editor.c: new file with price db
editor. Unfinished. * src/engine/gnc-pricedb.c: connect prices to pricedbs * src/engine/io-gncxml-v2.c (gnc_book_load_from_xml_file_v2): fix for files with no pricedb section * src/scm/prefs.scm: add price editor geometry options git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3900 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
16
ChangeLog
16
ChangeLog
@@ -1,3 +1,19 @@
|
||||
2001-04-06 Dave Peticolas <dave@krondo.com>
|
||||
|
||||
* src/gnome/dialog-price-editor.c: new file with price db
|
||||
editor. Unfinished.
|
||||
|
||||
* src/engine/gnc-pricedb.c: connect prices to pricedbs
|
||||
|
||||
2001-04-05 Dave Peticolas <dave@krondo.com>
|
||||
|
||||
* src/engine/io-gncxml-v2.c (gnc_book_load_from_xml_file_v2): fix
|
||||
for files with no pricedb section
|
||||
|
||||
2001-04-04 Dave Peticolas <dave@krondo.com>
|
||||
|
||||
* src/scm/prefs.scm: add price editor geometry options
|
||||
|
||||
2001-04-06 Christian Stimming <stimming@tuhh.de>
|
||||
|
||||
* src/scm/report/balance-sheet.scm: Major overhaul. Adapted to new
|
||||
|
||||
@@ -394,6 +394,7 @@ gnc_pricedb_add_price(GNCPriceDB *db, GNCPrice *p)
|
||||
if(!price_list) return FALSE;
|
||||
g_hash_table_insert(currency_hash, currency, price_list);
|
||||
db->dirty = TRUE;
|
||||
p->db = db;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -416,15 +417,21 @@ gnc_pricedb_remove_price(GNCPriceDB *db, GNCPrice *p)
|
||||
if(!currency_hash) return FALSE;
|
||||
|
||||
price_list = g_hash_table_lookup(currency_hash, currency);
|
||||
if(!gnc_price_list_remove(&price_list, p)) return FALSE;
|
||||
gnc_price_ref(p);
|
||||
if(!gnc_price_list_remove(&price_list, p)) {
|
||||
gnc_price_unref(p);
|
||||
return FALSE;
|
||||
}
|
||||
if(price_list) {
|
||||
g_hash_table_insert(currency_hash, currency, price_list);
|
||||
} else {
|
||||
g_hash_table_remove(currency_hash, currency);
|
||||
}
|
||||
db->dirty = TRUE;
|
||||
p->db = NULL;
|
||||
gnc_price_unref(p);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
GNCPrice *
|
||||
gnc_pricedb_lookup_latest(GNCPriceDB *db,
|
||||
|
||||
@@ -284,6 +284,12 @@ gnc_book_load_from_xml_file_v2(
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* If the parse succeeded, but there is no pricedb,
|
||||
* then the file had no pricedb section. However,
|
||||
* this routine is expected to put one in the book. */
|
||||
if (!gnc_book_get_pricedb (book))
|
||||
gnc_book_set_pricedb (book, gnc_pricedb_create ());
|
||||
|
||||
/* mark the newly read group as saved, since the act of putting
|
||||
* it together will have caused it to be marked up as not-saved.
|
||||
*/
|
||||
|
||||
@@ -89,6 +89,7 @@ gboolean gnc_dup_trans_dialog (gncUIWidget parent, time_t *date_p,
|
||||
const char *num, char **out_num);
|
||||
void gnc_tax_info_dialog (gncUIWidget parent);
|
||||
void gnc_stock_split_dialog (Account * initial);
|
||||
void gnc_prices_dialog (gncUIWidget parent);
|
||||
|
||||
/* Open a dialog asking for username and password. The heading and
|
||||
* either 'initial_*' arguments may be NULL. If the dialog returns
|
||||
|
||||
@@ -14,6 +14,7 @@ libgncgnome_a_SOURCES = \
|
||||
dialog-fincalc.c \
|
||||
dialog-find-transactions.c \
|
||||
dialog-options.c \
|
||||
dialog-price-editor.c \
|
||||
dialog-print-check.c \
|
||||
dialog-progress.c \
|
||||
dialog-style-sheet.c \
|
||||
|
||||
735
src/gnome/dialog-price-editor.c
Normal file
735
src/gnome/dialog-price-editor.c
Normal file
@@ -0,0 +1,735 @@
|
||||
/********************************************************************\
|
||||
* dialog-price-editor.c -- price editor dialog *
|
||||
* Copyright (C) 2001 Gnumatic, Inc. *
|
||||
* Author: Dave Peticolas <dave@krondo.com> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation; either version 2 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License*
|
||||
* along with this program; if not, contact: *
|
||||
* *
|
||||
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
||||
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
||||
\********************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gnome.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "FileDialog.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "glade-gnc-dialogs.h"
|
||||
#include "glade-support.h"
|
||||
#include "gnc-amount-edit.h"
|
||||
#include "gnc-commodity-edit.h"
|
||||
#include "gnc-component-manager.h"
|
||||
#include "gnc-currency-edit.h"
|
||||
#include "gnc-dateedit.h"
|
||||
#include "gnc-engine-util.h"
|
||||
#include "gnc-pricedb.h"
|
||||
#include "gnc-ui.h"
|
||||
#include "messages.h"
|
||||
|
||||
|
||||
#define DIALOG_PRICES_CM_CLASS "dialog-prices"
|
||||
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
/* static short module = MOD_GUI; */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget * dialog;
|
||||
GtkWidget * price_dialog;
|
||||
|
||||
GtkWidget * price_list;
|
||||
GtkWidget * edit_button;
|
||||
GtkWidget * remove_button;
|
||||
|
||||
GtkWidget * commodity_edit;
|
||||
GtkWidget * currency_edit;
|
||||
GtkWidget * date_edit;
|
||||
GtkWidget * source_entry;
|
||||
GtkWidget * type_option;
|
||||
GtkWidget * price_edit;
|
||||
|
||||
GNCPrice *price;
|
||||
gboolean changed;
|
||||
gboolean new;
|
||||
|
||||
GList *prices;
|
||||
} PricesDialog;
|
||||
|
||||
|
||||
static gint last_width = 0;
|
||||
static gint last_height = 0;
|
||||
|
||||
|
||||
static void
|
||||
gnc_prices_set_changed (PricesDialog *pdb_dialog, gboolean changed)
|
||||
{
|
||||
GtkWidget *button;
|
||||
|
||||
pdb_dialog->changed = changed;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
load_price_helper (GNCPrice *price, gpointer data)
|
||||
{
|
||||
GList **prices_p = data;
|
||||
|
||||
gnc_price_ref (price);
|
||||
*prices_p = g_list_prepend (*prices_p, price);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
price_compare (gconstpointer a, gconstpointer b)
|
||||
{
|
||||
GNCPrice *price_a = (GNCPrice *) a;
|
||||
GNCPrice *price_b = (GNCPrice *) b;
|
||||
gnc_commodity *comm_a;
|
||||
gnc_commodity *comm_b;
|
||||
Timespec ts_a;
|
||||
Timespec ts_b;
|
||||
gint result;
|
||||
|
||||
comm_a = gnc_price_get_commodity (price_a);
|
||||
comm_b = gnc_price_get_commodity (price_b);
|
||||
|
||||
SAFE_STRCMP (gnc_commodity_get_namespace (comm_a),
|
||||
gnc_commodity_get_namespace (comm_b));
|
||||
|
||||
SAFE_STRCMP (gnc_commodity_get_mnemonic (comm_a),
|
||||
gnc_commodity_get_mnemonic (comm_b));
|
||||
|
||||
comm_a = gnc_price_get_currency (price_a);
|
||||
comm_b = gnc_price_get_currency (price_b);
|
||||
|
||||
SAFE_STRCMP (gnc_commodity_get_namespace (comm_a),
|
||||
gnc_commodity_get_namespace (comm_b));
|
||||
|
||||
SAFE_STRCMP (gnc_commodity_get_mnemonic (comm_a),
|
||||
gnc_commodity_get_mnemonic (comm_b));
|
||||
|
||||
ts_a = gnc_price_get_time (price_a);
|
||||
ts_b = gnc_price_get_time (price_b);
|
||||
|
||||
result = timespec_cmp (&ts_a, &ts_b);
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
SAFE_STRCMP (gnc_price_get_type (price_a),
|
||||
gnc_price_get_type (price_b));
|
||||
|
||||
SAFE_STRCMP (gnc_price_get_source (price_a),
|
||||
gnc_price_get_source (price_b));
|
||||
|
||||
return gnc_numeric_compare (gnc_price_get_value (price_a),
|
||||
gnc_price_get_value (price_b));
|
||||
}
|
||||
|
||||
static int
|
||||
gnc_prices_load_prices (PricesDialog *pdb_dialog)
|
||||
{
|
||||
gnc_commodity *current_commodity;
|
||||
GNCPrintAmountInfo print_info;
|
||||
GNCBook *book;
|
||||
GList *prices;
|
||||
GList *node;
|
||||
|
||||
book = gncGetCurrentBook ();
|
||||
prices = NULL;
|
||||
|
||||
gnc_pricedb_foreach_price (gnc_book_get_pricedb (book),
|
||||
load_price_helper, &prices, FALSE);
|
||||
|
||||
prices = g_list_sort (prices, price_compare);
|
||||
|
||||
gtk_clist_freeze (GTK_CLIST (pdb_dialog->price_list));
|
||||
|
||||
gtk_clist_clear (GTK_CLIST (pdb_dialog->price_list));
|
||||
|
||||
current_commodity = NULL;
|
||||
print_info = gnc_default_price_print_info ();
|
||||
|
||||
for (node = prices; node; node = node->next)
|
||||
{
|
||||
GNCPrice *price = node->data;
|
||||
const char *text[6];
|
||||
gint row;
|
||||
|
||||
text[0] = gnc_commodity_get_printname (gnc_price_get_commodity (price));
|
||||
text[1] = gnc_commodity_get_printname (gnc_price_get_currency (price));
|
||||
text[2] = gnc_print_date (gnc_price_get_time (price));
|
||||
text[3] = gnc_price_get_source (price);
|
||||
text[4] = gnc_price_get_type (price);
|
||||
text[5] = xaccPrintAmount (gnc_price_get_value (price), print_info);
|
||||
|
||||
row = gtk_clist_append (GTK_CLIST (pdb_dialog->price_list), (char **)text);
|
||||
|
||||
gtk_clist_set_row_data (GTK_CLIST (pdb_dialog->price_list), row, price);
|
||||
}
|
||||
|
||||
gtk_clist_thaw (GTK_CLIST (pdb_dialog->price_list));
|
||||
|
||||
gtk_clist_columns_autosize (GTK_CLIST (pdb_dialog->price_list));
|
||||
|
||||
for (node = pdb_dialog->prices; node; node = node->next)
|
||||
{
|
||||
GNCPrice *price = node->data;
|
||||
|
||||
gnc_price_unref (price);
|
||||
}
|
||||
|
||||
g_list_free (pdb_dialog->prices);
|
||||
pdb_dialog->prices = prices;
|
||||
|
||||
gtk_clist_select_row (GTK_CLIST (pdb_dialog->price_list), 0, 0);
|
||||
|
||||
gtk_widget_set_sensitive (pdb_dialog->edit_button, prices != NULL);
|
||||
gtk_widget_set_sensitive (pdb_dialog->remove_button, prices != NULL);
|
||||
|
||||
return g_list_length (prices);
|
||||
}
|
||||
|
||||
static int
|
||||
type_string_to_index (const char *type)
|
||||
{
|
||||
if (safe_strcmp (type, "bid") == 0)
|
||||
return 0;
|
||||
|
||||
if (safe_strcmp (type, "ask") == 0)
|
||||
return 1;
|
||||
|
||||
if (safe_strcmp (type, "last") == 0)
|
||||
return 2;
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
static const char *
|
||||
type_index_to_string (int index)
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case 0: return "bid";
|
||||
case 1: return "ask";
|
||||
case 2: return "last";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
price_to_gui (PricesDialog *pdb_dialog)
|
||||
{
|
||||
gnc_commodity *commodity;
|
||||
gnc_commodity *currency;
|
||||
const char *source;
|
||||
const char *type;
|
||||
gnc_numeric value;
|
||||
Timespec date;
|
||||
|
||||
if (pdb_dialog->price)
|
||||
{
|
||||
commodity = gnc_price_get_commodity (pdb_dialog->price);
|
||||
currency = gnc_price_get_currency (pdb_dialog->price);
|
||||
date = gnc_price_get_time (pdb_dialog->price);
|
||||
source = gnc_price_get_source (pdb_dialog->price);
|
||||
type = gnc_price_get_type (pdb_dialog->price);
|
||||
value = gnc_price_get_value (pdb_dialog->price);
|
||||
}
|
||||
else
|
||||
{
|
||||
commodity = NULL;
|
||||
currency = gnc_locale_default_currency ();
|
||||
date.tv_sec = time (NULL);
|
||||
date.tv_nsec = 0;
|
||||
source = "";
|
||||
type = "";
|
||||
value = gnc_numeric_zero ();
|
||||
}
|
||||
|
||||
if (commodity)
|
||||
gnc_commodity_edit_set_commodity
|
||||
(GNC_COMMODITY_EDIT (pdb_dialog->commodity_edit), commodity);
|
||||
|
||||
if (currency)
|
||||
gnc_currency_edit_set_currency
|
||||
(GNC_CURRENCY_EDIT (pdb_dialog->currency_edit), currency);
|
||||
|
||||
gnc_date_edit_set_time (GNC_DATE_EDIT (pdb_dialog->date_edit), date.tv_sec);
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (pdb_dialog->source_entry), source);
|
||||
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (pdb_dialog->type_option),
|
||||
type_string_to_index (type));
|
||||
|
||||
gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (pdb_dialog->price_edit), value);
|
||||
}
|
||||
|
||||
static const char *
|
||||
gui_to_price (PricesDialog *pdb_dialog)
|
||||
{
|
||||
gnc_commodity *commodity;
|
||||
gnc_commodity *currency;
|
||||
const char *source;
|
||||
const char *type;
|
||||
gnc_numeric value;
|
||||
Timespec date;
|
||||
|
||||
if (!pdb_dialog->price)
|
||||
return NULL;
|
||||
|
||||
commodity = gnc_commodity_edit_get_commodity
|
||||
(GNC_COMMODITY_EDIT (pdb_dialog->commodity_edit));
|
||||
if (!commodity)
|
||||
return _("You must select a commodity.");
|
||||
|
||||
currency = gnc_currency_edit_get_currency
|
||||
(GNC_CURRENCY_EDIT (pdb_dialog->currency_edit));
|
||||
if (!currency)
|
||||
return _("You must select a currency.");
|
||||
|
||||
date.tv_sec = gnc_date_edit_get_date (GNC_DATE_EDIT (pdb_dialog->date_edit));
|
||||
date.tv_nsec = 0;
|
||||
|
||||
type = type_index_to_string
|
||||
(gnc_option_menu_get_active (pdb_dialog->type_option));
|
||||
|
||||
if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (pdb_dialog->price_edit)))
|
||||
return _("You must enter a valid amount.");
|
||||
|
||||
value = gnc_amount_edit_get_amount
|
||||
(GNC_AMOUNT_EDIT (pdb_dialog->price_edit));
|
||||
|
||||
gnc_price_set_commodity (pdb_dialog->price, commodity);
|
||||
gnc_price_set_currency (pdb_dialog->price, currency);
|
||||
gnc_price_set_time (pdb_dialog->price, date);
|
||||
gnc_price_set_type (pdb_dialog->price, type);
|
||||
gnc_price_set_value (pdb_dialog->price, value);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
window_destroy_cb (GtkObject *object, gpointer data)
|
||||
{
|
||||
PricesDialog *pdb_dialog = data;
|
||||
GList *node;
|
||||
|
||||
gnc_unregister_gui_component_by_data (DIALOG_PRICES_CM_CLASS, pdb_dialog);
|
||||
|
||||
gtk_widget_destroy (pdb_dialog->price_dialog);
|
||||
pdb_dialog->price_dialog = NULL;
|
||||
|
||||
for (node = pdb_dialog->prices; node; node = node->next)
|
||||
{
|
||||
GNCPrice *price = node->data;
|
||||
|
||||
gnc_price_unref (price);
|
||||
}
|
||||
|
||||
g_list_free (pdb_dialog->prices);
|
||||
pdb_dialog->prices = NULL;
|
||||
|
||||
g_free (pdb_dialog);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
price_window_delete_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
|
||||
{
|
||||
PricesDialog *pdb_dialog = data;
|
||||
|
||||
gtk_widget_hide (pdb_dialog->price_dialog);
|
||||
|
||||
/* Don't delete the window, we'll handle things ourselves. */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
price_ok_clicked (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
PricesDialog *pdb_dialog = data;
|
||||
|
||||
gtk_widget_hide (pdb_dialog->price_dialog);
|
||||
|
||||
if (pdb_dialog->changed)
|
||||
{
|
||||
GNCBook *book = gncGetCurrentBook ();
|
||||
GNCPriceDB *pdb = gnc_book_get_pricedb (book);
|
||||
|
||||
gui_to_price (pdb_dialog);
|
||||
|
||||
gnc_gui_refresh_all ();
|
||||
}
|
||||
|
||||
pdb_dialog->changed = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
price_cancel_clicked (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
PricesDialog *pdb_dialog = data;
|
||||
|
||||
price_to_gui (pdb_dialog);
|
||||
pdb_dialog->changed = FALSE;
|
||||
|
||||
gtk_widget_hide (pdb_dialog->price_dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
prices_close_clicked (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
PricesDialog *pdb_dialog = data;
|
||||
|
||||
gnc_close_gui_component_by_data (DIALOG_PRICES_CM_CLASS, pdb_dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
edit_clicked (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
PricesDialog *pdb_dialog = data;
|
||||
|
||||
if (!pdb_dialog->price)
|
||||
return;
|
||||
|
||||
gtk_widget_show (pdb_dialog->price_dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
remove_clicked (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
PricesDialog *pdb_dialog = data;
|
||||
const char *message = _("Are you sure you want to delete the\n"
|
||||
"current price?");
|
||||
|
||||
if (!pdb_dialog->price)
|
||||
return;
|
||||
|
||||
if (gnc_verify_dialog_parented (pdb_dialog->dialog, message, TRUE))
|
||||
{
|
||||
GNCBook *book = gncGetCurrentBook ();
|
||||
GNCPriceDB *pdb = gnc_book_get_pricedb (book);
|
||||
|
||||
gnc_pricedb_remove_price (pdb, pdb_dialog->price);
|
||||
|
||||
gnc_gui_refresh_all ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_prices_select_price_cb (GtkCList *clist, gint row, gint col,
|
||||
GdkEventButton *event, gpointer data)
|
||||
{
|
||||
PricesDialog *pdb_dialog = data;
|
||||
|
||||
pdb_dialog->price = gtk_clist_get_row_data (clist, row);
|
||||
|
||||
price_to_gui (pdb_dialog);
|
||||
gtk_widget_set_sensitive (pdb_dialog->edit_button,
|
||||
pdb_dialog->price != NULL);
|
||||
gtk_widget_set_sensitive (pdb_dialog->remove_button,
|
||||
pdb_dialog->price != NULL);
|
||||
gnc_prices_set_changed (pdb_dialog, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_prices_unselect_price_cb (GtkCTree *ctre, gint row, gint col,
|
||||
GdkEventButton *event, gpointer data)
|
||||
{
|
||||
PricesDialog *pdb_dialog = data;
|
||||
|
||||
pdb_dialog->price = NULL;
|
||||
|
||||
gtk_widget_set_sensitive (pdb_dialog->edit_button, FALSE);
|
||||
gtk_widget_set_sensitive (pdb_dialog->remove_button, FALSE);
|
||||
gnc_prices_set_changed (pdb_dialog, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
commodity_changed_cb (GNCCommodityEdit *gce, gpointer data)
|
||||
{
|
||||
PricesDialog *pdb_dialog = data;
|
||||
|
||||
gnc_prices_set_changed (pdb_dialog, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
currency_changed_cb (GtkWidget *w, gpointer data)
|
||||
{
|
||||
PricesDialog *pdb_dialog = data;
|
||||
|
||||
gnc_prices_set_changed (pdb_dialog, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
date_changed_cb (GNCDateEdit *gde, gpointer data)
|
||||
{
|
||||
PricesDialog *pdb_dialog = data;
|
||||
|
||||
gnc_prices_set_changed (pdb_dialog, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
type_menu_changed (GtkButton *button, gpointer data)
|
||||
{
|
||||
PricesDialog *pdb_dialog = data;
|
||||
|
||||
gnc_prices_set_changed (pdb_dialog, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
connect_type_menu_item (GtkWidget *item, gpointer data)
|
||||
{
|
||||
gtk_signal_connect (GTK_OBJECT(item), "activate",
|
||||
GTK_SIGNAL_FUNC (type_menu_changed), data);
|
||||
}
|
||||
|
||||
static void
|
||||
amount_changed_cb (GtkWidget *w, gpointer data)
|
||||
{
|
||||
PricesDialog *pdb_dialog = data;
|
||||
|
||||
gnc_prices_set_changed (pdb_dialog, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
prices_set_min_widths (PricesDialog *pdb_dialog)
|
||||
{
|
||||
const char *titles[] = { _("Commodity"),
|
||||
_("Currency"),
|
||||
_("Date"),
|
||||
_("Source"),
|
||||
_("Type"),
|
||||
_("Price") };
|
||||
|
||||
GtkStyle *style = gtk_widget_get_style (pdb_dialog->price_list);
|
||||
GdkFont *font = NULL;
|
||||
gint width;
|
||||
gint i;
|
||||
|
||||
if (style != NULL)
|
||||
font = style->font;
|
||||
|
||||
if (font != NULL)
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
width = gdk_string_width (font, titles[i]);
|
||||
gtk_clist_set_column_min_width (GTK_CLIST (pdb_dialog->price_list),
|
||||
i, width + 5);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_prices_dialog_create (GtkWidget * parent, PricesDialog *pdb_dialog)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *price_dialog;
|
||||
|
||||
dialog = create_Prices_Dialog ();
|
||||
pdb_dialog->dialog = dialog;
|
||||
|
||||
price_dialog = create_Price_Dialog ();
|
||||
pdb_dialog->price_dialog = price_dialog;
|
||||
|
||||
gnome_dialog_set_parent (GNOME_DIALOG (price_dialog), GTK_WINDOW (dialog));
|
||||
|
||||
gnome_dialog_button_connect (GNOME_DIALOG (dialog), 0,
|
||||
GTK_SIGNAL_FUNC (prices_close_clicked),
|
||||
pdb_dialog);
|
||||
|
||||
gnome_dialog_button_connect (GNOME_DIALOG (price_dialog), 0,
|
||||
GTK_SIGNAL_FUNC (price_ok_clicked),
|
||||
pdb_dialog);
|
||||
|
||||
gnome_dialog_button_connect (GNOME_DIALOG (price_dialog), 1,
|
||||
GTK_SIGNAL_FUNC (price_cancel_clicked),
|
||||
pdb_dialog);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
|
||||
GTK_SIGNAL_FUNC (window_destroy_cb), pdb_dialog);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (price_dialog), "delete_event",
|
||||
GTK_SIGNAL_FUNC (price_window_delete_cb),
|
||||
pdb_dialog);
|
||||
|
||||
/* parent */
|
||||
if (parent != NULL)
|
||||
gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (parent));
|
||||
|
||||
/* default to ok */
|
||||
gnome_dialog_set_default (GNOME_DIALOG(dialog), 0);
|
||||
|
||||
/* price information */
|
||||
{
|
||||
GNCPrintAmountInfo print_info;
|
||||
GtkWidget *button;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *box;
|
||||
GtkWidget *w;
|
||||
|
||||
box = lookup_widget (price_dialog, "commodity_box");
|
||||
|
||||
w = gnc_commodity_edit_new ();
|
||||
pdb_dialog->commodity_edit = w;
|
||||
gtk_box_pack_start (GTK_BOX (box), w, TRUE, TRUE, 0);
|
||||
gtk_widget_show (w);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (w), "changed",
|
||||
GTK_SIGNAL_FUNC (commodity_changed_cb), pdb_dialog);
|
||||
|
||||
box = lookup_widget (price_dialog, "currency_box");
|
||||
|
||||
w = gnc_currency_edit_new ();
|
||||
pdb_dialog->currency_edit = w;
|
||||
gtk_box_pack_start (GTK_BOX (box), w, TRUE, TRUE, 0);
|
||||
gtk_widget_show (w);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (GTK_COMBO(w)->entry), "changed",
|
||||
GTK_SIGNAL_FUNC (currency_changed_cb), pdb_dialog);
|
||||
|
||||
box = lookup_widget (price_dialog, "date_box");
|
||||
|
||||
w = gnc_date_edit_new (time (NULL), FALSE, FALSE);
|
||||
pdb_dialog->date_edit = w;
|
||||
gtk_box_pack_start (GTK_BOX (box), w, TRUE, TRUE, 0);
|
||||
gtk_widget_show (w);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (w), "date_changed",
|
||||
GTK_SIGNAL_FUNC (date_changed_cb), pdb_dialog);
|
||||
|
||||
w = lookup_widget (price_dialog, "source_entry");
|
||||
pdb_dialog->source_entry = w;
|
||||
|
||||
w = lookup_widget (price_dialog, "type_option");
|
||||
pdb_dialog->type_option = w;
|
||||
|
||||
gnc_option_menu_init (w);
|
||||
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (w));
|
||||
gtk_container_forall (GTK_CONTAINER (menu),
|
||||
connect_type_menu_item, pdb_dialog);
|
||||
|
||||
box = lookup_widget (price_dialog, "price_box");
|
||||
|
||||
w = gnc_amount_edit_new ();
|
||||
pdb_dialog->price_edit = w;
|
||||
gtk_box_pack_start (GTK_BOX (box), w, TRUE, TRUE, 0);
|
||||
gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (w), TRUE);
|
||||
print_info = gnc_default_price_print_info ();
|
||||
gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (w), print_info);
|
||||
gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (w), 1000000);
|
||||
gtk_widget_show (w);
|
||||
|
||||
entry = gnc_amount_edit_gtk_entry (GNC_AMOUNT_EDIT (w));
|
||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
||||
GTK_SIGNAL_FUNC (amount_changed_cb), pdb_dialog);
|
||||
}
|
||||
|
||||
/* price tree */
|
||||
{
|
||||
GtkWidget *income_radio;
|
||||
GtkWidget *scroll;
|
||||
GtkWidget *list;
|
||||
|
||||
list = lookup_widget (dialog, "price_list");
|
||||
pdb_dialog->price_list = list;
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT(list), "select_row",
|
||||
GTK_SIGNAL_FUNC(gnc_prices_select_price_cb),
|
||||
pdb_dialog);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT(list), "unselect_row",
|
||||
GTK_SIGNAL_FUNC(gnc_prices_unselect_price_cb),
|
||||
pdb_dialog);
|
||||
}
|
||||
|
||||
/* buttons */
|
||||
{
|
||||
GtkWidget *button;
|
||||
|
||||
button = lookup_widget (dialog, "edit_button");
|
||||
pdb_dialog->edit_button = button;
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (edit_clicked), pdb_dialog);
|
||||
|
||||
button = lookup_widget (dialog, "remove_button");
|
||||
pdb_dialog->remove_button = button;
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (remove_clicked), pdb_dialog);
|
||||
}
|
||||
|
||||
gnc_prices_load_prices (pdb_dialog);
|
||||
gnc_prices_set_changed (pdb_dialog, FALSE);
|
||||
prices_set_min_widths (pdb_dialog);
|
||||
|
||||
if (last_width == 0)
|
||||
gnc_get_window_size ("prices_win", &last_width, &last_height);
|
||||
|
||||
if (last_height == 0)
|
||||
last_height = 400;
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW(pdb_dialog->dialog),
|
||||
last_width, last_height);
|
||||
}
|
||||
|
||||
static void
|
||||
close_handler (gpointer user_data)
|
||||
{
|
||||
PricesDialog *pdb_dialog = user_data;
|
||||
|
||||
gdk_window_get_geometry (GTK_WIDGET(pdb_dialog->dialog)->window,
|
||||
NULL, NULL, &last_width, &last_height, NULL);
|
||||
|
||||
gnc_save_window_size ("prices_win", last_width, last_height);
|
||||
|
||||
gnome_dialog_close (GNOME_DIALOG (pdb_dialog->dialog));
|
||||
}
|
||||
|
||||
static void
|
||||
refresh_handler (GHashTable *changes, gpointer user_data)
|
||||
{
|
||||
PricesDialog *pdb_dialog = user_data;
|
||||
|
||||
gnc_prices_load_prices (pdb_dialog);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_prices_dialog *
|
||||
* opens up a window to edit price information *
|
||||
* *
|
||||
* Args: parent - the parent of the window to be created *
|
||||
* Return: nothing *
|
||||
\********************************************************************/
|
||||
void
|
||||
gnc_prices_dialog (GtkWidget * parent)
|
||||
{
|
||||
PricesDialog *pdb_dialog;
|
||||
gint component_id;
|
||||
|
||||
pdb_dialog = g_new0 (PricesDialog, 1);
|
||||
|
||||
gnc_prices_dialog_create (parent, pdb_dialog);
|
||||
|
||||
component_id = gnc_register_gui_component (DIALOG_PRICES_CM_CLASS,
|
||||
refresh_handler, close_handler,
|
||||
pdb_dialog);
|
||||
|
||||
gtk_widget_grab_focus (pdb_dialog->price_list);
|
||||
|
||||
gtk_widget_show (pdb_dialog->dialog);
|
||||
}
|
||||
@@ -3304,6 +3304,7 @@ create_New_Commodity_Dialog (void)
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (code_entry);
|
||||
gtk_box_pack_start (GTK_BOX (vbox78), code_entry, FALSE, FALSE, 0);
|
||||
gtk_tooltips_set_tip (tooltips, code_entry, _("Enter a unique code used to identify the commodity. Or, you may safely leave this field blank."), NULL);
|
||||
|
||||
hbox64 = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_ref (hbox64);
|
||||
@@ -3319,14 +3320,14 @@ create_New_Commodity_Dialog (void)
|
||||
gtk_widget_show (label814);
|
||||
gtk_box_pack_start (GTK_BOX (hbox64), label814, FALSE, FALSE, 4);
|
||||
|
||||
fraction_spinbutton_adj = gtk_adjustment_new (100, 1, 1e+08, 1, 100, 100);
|
||||
fraction_spinbutton_adj = gtk_adjustment_new (10000, 1, 1e+08, 1, 100, 100);
|
||||
fraction_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (fraction_spinbutton_adj), 1, 0);
|
||||
gtk_widget_ref (fraction_spinbutton);
|
||||
gtk_object_set_data_full (GTK_OBJECT (New_Commodity_Dialog), "fraction_spinbutton", fraction_spinbutton,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (fraction_spinbutton);
|
||||
gtk_box_pack_start (GTK_BOX (hbox64), fraction_spinbutton, TRUE, TRUE, 0);
|
||||
gtk_tooltips_set_tip (tooltips, fraction_spinbutton, _("Enter the smallest fraction of the commodity which can be traded."), NULL);
|
||||
gtk_tooltips_set_tip (tooltips, fraction_spinbutton, _("Enter the smallest fraction of the commodity which can be traded. For stocks which can only be traded in whole numbers, enter 1."), NULL);
|
||||
|
||||
dialog_action_area13 = GNOME_DIALOG (New_Commodity_Dialog)->action_area;
|
||||
gtk_object_set_data (GTK_OBJECT (New_Commodity_Dialog), "dialog_action_area13", dialog_action_area13);
|
||||
@@ -7281,3 +7282,379 @@ create_Edit_Report_Size (void)
|
||||
return Edit_Report_Size;
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
create_Prices_Dialog (void)
|
||||
{
|
||||
GtkWidget *Prices_Dialog;
|
||||
GtkWidget *vbox121;
|
||||
GtkWidget *hbox104;
|
||||
GtkWidget *frame50;
|
||||
GtkWidget *vbox122;
|
||||
GtkWidget *scrolledwindow32;
|
||||
GtkWidget *price_list;
|
||||
GtkWidget *label8477415;
|
||||
GtkWidget *label8477416;
|
||||
GtkWidget *label8477417;
|
||||
GtkWidget *label8477418;
|
||||
GtkWidget *label8477419;
|
||||
GtkWidget *label8477420;
|
||||
GtkWidget *hbuttonbox5;
|
||||
GtkWidget *add_button;
|
||||
GtkWidget *remove_button;
|
||||
GtkWidget *edit_button;
|
||||
GtkWidget *hbuttonbox4;
|
||||
GtkWidget *close_button;
|
||||
GtkTooltips *tooltips;
|
||||
|
||||
tooltips = gtk_tooltips_new ();
|
||||
|
||||
Prices_Dialog = gnome_dialog_new (_("Prices Editor"), NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (Prices_Dialog), "Prices_Dialog", Prices_Dialog);
|
||||
gtk_window_set_policy (GTK_WINDOW (Prices_Dialog), TRUE, TRUE, FALSE);
|
||||
|
||||
vbox121 = GNOME_DIALOG (Prices_Dialog)->vbox;
|
||||
gtk_object_set_data (GTK_OBJECT (Prices_Dialog), "vbox121", vbox121);
|
||||
gtk_widget_show (vbox121);
|
||||
|
||||
hbox104 = gtk_hbox_new (FALSE, 2);
|
||||
gtk_widget_ref (hbox104);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Prices_Dialog), "hbox104", hbox104,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (hbox104);
|
||||
gtk_box_pack_start (GTK_BOX (vbox121), hbox104, TRUE, TRUE, 0);
|
||||
|
||||
frame50 = gtk_frame_new (_("Prices"));
|
||||
gtk_widget_ref (frame50);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Prices_Dialog), "frame50", frame50,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (frame50);
|
||||
gtk_box_pack_start (GTK_BOX (hbox104), frame50, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame50), 3);
|
||||
|
||||
vbox122 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_ref (vbox122);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Prices_Dialog), "vbox122", vbox122,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (vbox122);
|
||||
gtk_container_add (GTK_CONTAINER (frame50), vbox122);
|
||||
|
||||
scrolledwindow32 = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_ref (scrolledwindow32);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Prices_Dialog), "scrolledwindow32", scrolledwindow32,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (scrolledwindow32);
|
||||
gtk_box_pack_start (GTK_BOX (vbox122), scrolledwindow32, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow32), 3);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow32), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
||||
|
||||
price_list = gtk_clist_new (6);
|
||||
gtk_widget_ref (price_list);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Prices_Dialog), "price_list", price_list,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (price_list);
|
||||
gtk_container_add (GTK_CONTAINER (scrolledwindow32), price_list);
|
||||
gtk_clist_set_column_width (GTK_CLIST (price_list), 0, 80);
|
||||
gtk_clist_set_column_width (GTK_CLIST (price_list), 1, 80);
|
||||
gtk_clist_set_column_width (GTK_CLIST (price_list), 2, 80);
|
||||
gtk_clist_set_column_width (GTK_CLIST (price_list), 3, 80);
|
||||
gtk_clist_set_column_width (GTK_CLIST (price_list), 4, 80);
|
||||
gtk_clist_set_column_width (GTK_CLIST (price_list), 5, 80);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (price_list), GTK_SELECTION_BROWSE);
|
||||
gtk_clist_column_titles_show (GTK_CLIST (price_list));
|
||||
|
||||
label8477415 = gtk_label_new (_("Commodity"));
|
||||
gtk_widget_ref (label8477415);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Prices_Dialog), "label8477415", label8477415,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (label8477415);
|
||||
gtk_clist_set_column_widget (GTK_CLIST (price_list), 0, label8477415);
|
||||
|
||||
label8477416 = gtk_label_new (_("Currency"));
|
||||
gtk_widget_ref (label8477416);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Prices_Dialog), "label8477416", label8477416,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (label8477416);
|
||||
gtk_clist_set_column_widget (GTK_CLIST (price_list), 1, label8477416);
|
||||
|
||||
label8477417 = gtk_label_new (_("Date"));
|
||||
gtk_widget_ref (label8477417);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Prices_Dialog), "label8477417", label8477417,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (label8477417);
|
||||
gtk_clist_set_column_widget (GTK_CLIST (price_list), 2, label8477417);
|
||||
|
||||
label8477418 = gtk_label_new (_("Source"));
|
||||
gtk_widget_ref (label8477418);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Prices_Dialog), "label8477418", label8477418,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (label8477418);
|
||||
gtk_clist_set_column_widget (GTK_CLIST (price_list), 3, label8477418);
|
||||
|
||||
label8477419 = gtk_label_new (_("Type"));
|
||||
gtk_widget_ref (label8477419);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Prices_Dialog), "label8477419", label8477419,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (label8477419);
|
||||
gtk_clist_set_column_widget (GTK_CLIST (price_list), 4, label8477419);
|
||||
|
||||
label8477420 = gtk_label_new (_("Price"));
|
||||
gtk_widget_ref (label8477420);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Prices_Dialog), "label8477420", label8477420,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (label8477420);
|
||||
gtk_clist_set_column_widget (GTK_CLIST (price_list), 5, label8477420);
|
||||
|
||||
hbuttonbox5 = gtk_hbutton_box_new ();
|
||||
gtk_widget_ref (hbuttonbox5);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Prices_Dialog), "hbuttonbox5", hbuttonbox5,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (hbuttonbox5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox122), hbuttonbox5, FALSE, FALSE, 0);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox5), GTK_BUTTONBOX_SPREAD);
|
||||
|
||||
add_button = gtk_button_new_with_label (_("Add"));
|
||||
gtk_widget_ref (add_button);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Prices_Dialog), "add_button", add_button,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (add_button);
|
||||
gtk_container_add (GTK_CONTAINER (hbuttonbox5), add_button);
|
||||
GTK_WIDGET_SET_FLAGS (add_button, GTK_CAN_DEFAULT);
|
||||
gtk_tooltips_set_tip (tooltips, add_button, _("Add a new price."), NULL);
|
||||
|
||||
remove_button = gtk_button_new_with_label (_("Remove"));
|
||||
gtk_widget_ref (remove_button);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Prices_Dialog), "remove_button", remove_button,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (remove_button);
|
||||
gtk_container_add (GTK_CONTAINER (hbuttonbox5), remove_button);
|
||||
GTK_WIDGET_SET_FLAGS (remove_button, GTK_CAN_DEFAULT);
|
||||
gtk_tooltips_set_tip (tooltips, remove_button, _("Remove the current price"), NULL);
|
||||
|
||||
edit_button = gtk_button_new_with_label (_("Edit"));
|
||||
gtk_widget_ref (edit_button);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Prices_Dialog), "edit_button", edit_button,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (edit_button);
|
||||
gtk_container_add (GTK_CONTAINER (hbuttonbox5), edit_button);
|
||||
GTK_WIDGET_SET_FLAGS (edit_button, GTK_CAN_DEFAULT);
|
||||
|
||||
hbuttonbox4 = GNOME_DIALOG (Prices_Dialog)->action_area;
|
||||
gtk_object_set_data (GTK_OBJECT (Prices_Dialog), "hbuttonbox4", hbuttonbox4);
|
||||
gtk_widget_show (hbuttonbox4);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox4), GTK_BUTTONBOX_END);
|
||||
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbuttonbox4), 8);
|
||||
|
||||
gnome_dialog_append_button (GNOME_DIALOG (Prices_Dialog), GNOME_STOCK_BUTTON_CLOSE);
|
||||
close_button = GTK_WIDGET (g_list_last (GNOME_DIALOG (Prices_Dialog)->buttons)->data);
|
||||
gtk_widget_ref (close_button);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Prices_Dialog), "close_button", close_button,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (close_button);
|
||||
GTK_WIDGET_SET_FLAGS (close_button, GTK_CAN_DEFAULT);
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT (Prices_Dialog), "tooltips", tooltips);
|
||||
|
||||
return Prices_Dialog;
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
create_Price_Dialog (void)
|
||||
{
|
||||
GtkWidget *Price_Dialog;
|
||||
GtkWidget *dialog_vbox18;
|
||||
GtkWidget *price_info_frame;
|
||||
GtkWidget *vbox126;
|
||||
GtkWidget *hbox106;
|
||||
GtkWidget *vbox125;
|
||||
GtkWidget *label8477399;
|
||||
GtkWidget *label8477400;
|
||||
GtkWidget *label8477401;
|
||||
GtkWidget *label8477402;
|
||||
GtkWidget *label8477403;
|
||||
GtkWidget *label8477404;
|
||||
GtkWidget *vbox126zz;
|
||||
GtkWidget *commodity_box;
|
||||
GtkWidget *currency_box;
|
||||
GtkWidget *date_box;
|
||||
GtkWidget *source_entry;
|
||||
GtkWidget *type_option;
|
||||
GtkWidget *type_option_menu;
|
||||
GtkWidget *glade_menuitem;
|
||||
GtkWidget *price_box;
|
||||
GtkWidget *dialog_action_area18;
|
||||
GtkWidget *ok_button;
|
||||
GtkWidget *cancel_button;
|
||||
|
||||
Price_Dialog = gnome_dialog_new (_("Price Dialog"), NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (Price_Dialog), "Price_Dialog", Price_Dialog);
|
||||
gtk_window_set_modal (GTK_WINDOW (Price_Dialog), TRUE);
|
||||
gtk_window_set_policy (GTK_WINDOW (Price_Dialog), FALSE, FALSE, FALSE);
|
||||
|
||||
dialog_vbox18 = GNOME_DIALOG (Price_Dialog)->vbox;
|
||||
gtk_object_set_data (GTK_OBJECT (Price_Dialog), "dialog_vbox18", dialog_vbox18);
|
||||
gtk_widget_show (dialog_vbox18);
|
||||
|
||||
price_info_frame = gtk_frame_new (_("Price Information"));
|
||||
gtk_widget_ref (price_info_frame);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Price_Dialog), "price_info_frame", price_info_frame,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (price_info_frame);
|
||||
gtk_box_pack_start (GTK_BOX (dialog_vbox18), price_info_frame, TRUE, TRUE, 0);
|
||||
|
||||
vbox126 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_ref (vbox126);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Price_Dialog), "vbox126", vbox126,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (vbox126);
|
||||
gtk_container_add (GTK_CONTAINER (price_info_frame), vbox126);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox126), 3);
|
||||
|
||||
hbox106 = gtk_hbox_new (FALSE, 2);
|
||||
gtk_widget_ref (hbox106);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Price_Dialog), "hbox106", hbox106,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (hbox106);
|
||||
gtk_box_pack_start (GTK_BOX (vbox126), hbox106, FALSE, FALSE, 0);
|
||||
|
||||
vbox125 = gtk_vbox_new (TRUE, 0);
|
||||
gtk_widget_ref (vbox125);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Price_Dialog), "vbox125", vbox125,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (vbox125);
|
||||
gtk_box_pack_start (GTK_BOX (hbox106), vbox125, FALSE, FALSE, 0);
|
||||
|
||||
label8477399 = gtk_label_new (_("Commodity:"));
|
||||
gtk_widget_ref (label8477399);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Price_Dialog), "label8477399", label8477399,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (label8477399);
|
||||
gtk_box_pack_start (GTK_BOX (vbox125), label8477399, FALSE, FALSE, 0);
|
||||
gtk_misc_set_alignment (GTK_MISC (label8477399), 1, 0.5);
|
||||
|
||||
label8477400 = gtk_label_new (_("Currency:"));
|
||||
gtk_widget_ref (label8477400);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Price_Dialog), "label8477400", label8477400,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (label8477400);
|
||||
gtk_box_pack_start (GTK_BOX (vbox125), label8477400, FALSE, FALSE, 0);
|
||||
gtk_misc_set_alignment (GTK_MISC (label8477400), 1, 0.5);
|
||||
|
||||
label8477401 = gtk_label_new (_("Date:"));
|
||||
gtk_widget_ref (label8477401);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Price_Dialog), "label8477401", label8477401,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (label8477401);
|
||||
gtk_box_pack_start (GTK_BOX (vbox125), label8477401, FALSE, FALSE, 0);
|
||||
gtk_misc_set_alignment (GTK_MISC (label8477401), 1, 0.5);
|
||||
|
||||
label8477402 = gtk_label_new (_("Source:"));
|
||||
gtk_widget_ref (label8477402);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Price_Dialog), "label8477402", label8477402,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_box_pack_start (GTK_BOX (vbox125), label8477402, FALSE, FALSE, 0);
|
||||
gtk_misc_set_alignment (GTK_MISC (label8477402), 1, 0.5);
|
||||
|
||||
label8477403 = gtk_label_new (_("Type:"));
|
||||
gtk_widget_ref (label8477403);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Price_Dialog), "label8477403", label8477403,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (label8477403);
|
||||
gtk_box_pack_start (GTK_BOX (vbox125), label8477403, FALSE, FALSE, 0);
|
||||
gtk_misc_set_alignment (GTK_MISC (label8477403), 1, 0.5);
|
||||
|
||||
label8477404 = gtk_label_new (_("Price:"));
|
||||
gtk_widget_ref (label8477404);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Price_Dialog), "label8477404", label8477404,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (label8477404);
|
||||
gtk_box_pack_start (GTK_BOX (vbox125), label8477404, FALSE, FALSE, 0);
|
||||
gtk_misc_set_alignment (GTK_MISC (label8477404), 1, 0.5);
|
||||
|
||||
vbox126zz = gtk_vbox_new (TRUE, 0);
|
||||
gtk_widget_ref (vbox126zz);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Price_Dialog), "vbox126zz", vbox126zz,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (vbox126zz);
|
||||
gtk_box_pack_start (GTK_BOX (hbox106), vbox126zz, TRUE, TRUE, 0);
|
||||
|
||||
commodity_box = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_ref (commodity_box);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Price_Dialog), "commodity_box", commodity_box,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (commodity_box);
|
||||
gtk_box_pack_start (GTK_BOX (vbox126zz), commodity_box, TRUE, TRUE, 0);
|
||||
|
||||
currency_box = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_ref (currency_box);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Price_Dialog), "currency_box", currency_box,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (currency_box);
|
||||
gtk_box_pack_start (GTK_BOX (vbox126zz), currency_box, TRUE, TRUE, 0);
|
||||
|
||||
date_box = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_ref (date_box);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Price_Dialog), "date_box", date_box,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (date_box);
|
||||
gtk_box_pack_start (GTK_BOX (vbox126zz), date_box, TRUE, TRUE, 0);
|
||||
|
||||
source_entry = gtk_entry_new ();
|
||||
gtk_widget_ref (source_entry);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Price_Dialog), "source_entry", source_entry,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_box_pack_start (GTK_BOX (vbox126zz), source_entry, FALSE, FALSE, 0);
|
||||
gtk_entry_set_editable (GTK_ENTRY (source_entry), FALSE);
|
||||
|
||||
type_option = gtk_option_menu_new ();
|
||||
gtk_widget_ref (type_option);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Price_Dialog), "type_option", type_option,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (type_option);
|
||||
gtk_box_pack_start (GTK_BOX (vbox126zz), type_option, FALSE, FALSE, 0);
|
||||
type_option_menu = gtk_menu_new ();
|
||||
glade_menuitem = gtk_menu_item_new_with_label (_("Bid"));
|
||||
gtk_widget_show (glade_menuitem);
|
||||
gtk_menu_append (GTK_MENU (type_option_menu), glade_menuitem);
|
||||
glade_menuitem = gtk_menu_item_new_with_label (_("Ask"));
|
||||
gtk_widget_show (glade_menuitem);
|
||||
gtk_menu_append (GTK_MENU (type_option_menu), glade_menuitem);
|
||||
glade_menuitem = gtk_menu_item_new_with_label (_("Last"));
|
||||
gtk_widget_show (glade_menuitem);
|
||||
gtk_menu_append (GTK_MENU (type_option_menu), glade_menuitem);
|
||||
glade_menuitem = gtk_menu_item_new_with_label (_("Unknown"));
|
||||
gtk_widget_show (glade_menuitem);
|
||||
gtk_menu_append (GTK_MENU (type_option_menu), glade_menuitem);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (type_option), type_option_menu);
|
||||
|
||||
price_box = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_ref (price_box);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Price_Dialog), "price_box", price_box,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (price_box);
|
||||
gtk_box_pack_start (GTK_BOX (vbox126zz), price_box, TRUE, TRUE, 0);
|
||||
|
||||
dialog_action_area18 = GNOME_DIALOG (Price_Dialog)->action_area;
|
||||
gtk_object_set_data (GTK_OBJECT (Price_Dialog), "dialog_action_area18", dialog_action_area18);
|
||||
gtk_widget_show (dialog_action_area18);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area18), GTK_BUTTONBOX_END);
|
||||
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area18), 8);
|
||||
|
||||
gnome_dialog_append_button (GNOME_DIALOG (Price_Dialog), GNOME_STOCK_BUTTON_OK);
|
||||
ok_button = GTK_WIDGET (g_list_last (GNOME_DIALOG (Price_Dialog)->buttons)->data);
|
||||
gtk_widget_ref (ok_button);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Price_Dialog), "ok_button", ok_button,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (ok_button);
|
||||
GTK_WIDGET_SET_FLAGS (ok_button, GTK_CAN_DEFAULT);
|
||||
|
||||
gnome_dialog_append_button (GNOME_DIALOG (Price_Dialog), GNOME_STOCK_BUTTON_CANCEL);
|
||||
cancel_button = GTK_WIDGET (g_list_last (GNOME_DIALOG (Price_Dialog)->buttons)->data);
|
||||
gtk_widget_ref (cancel_button);
|
||||
gtk_object_set_data_full (GTK_OBJECT (Price_Dialog), "cancel_button", cancel_button,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (cancel_button);
|
||||
GTK_WIDGET_SET_FLAGS (cancel_button, GTK_CAN_DEFAULT);
|
||||
|
||||
return Price_Dialog;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,3 +25,5 @@ GtkWidget* create_Stock_Split_Druid (void);
|
||||
GtkWidget* create_Username_Password_Dialog (void);
|
||||
GtkWidget* create_Edit_Column_View_Page (void);
|
||||
GtkWidget* create_Edit_Report_Size (void);
|
||||
GtkWidget* create_Prices_Dialog (void);
|
||||
GtkWidget* create_Price_Dialog (void);
|
||||
|
||||
@@ -4869,6 +4869,7 @@ Daily (365)
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<name>code_entry</name>
|
||||
<tooltip>Enter a unique code used to identify the commodity. Or, you may safely leave this field blank.</tooltip>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
@@ -4912,7 +4913,7 @@ Daily (365)
|
||||
<widget>
|
||||
<class>GtkSpinButton</class>
|
||||
<name>fraction_spinbutton</name>
|
||||
<tooltip>Enter the smallest fraction of the commodity which can be traded.</tooltip>
|
||||
<tooltip>Enter the smallest fraction of the commodity which can be traded. For stocks which can only be traded in whole numbers, enter 1.</tooltip>
|
||||
<can_focus>True</can_focus>
|
||||
<climb_rate>1</climb_rate>
|
||||
<digits>0</digits>
|
||||
@@ -4920,7 +4921,7 @@ Daily (365)
|
||||
<update_policy>GTK_UPDATE_ALWAYS</update_policy>
|
||||
<snap>False</snap>
|
||||
<wrap>False</wrap>
|
||||
<value>100</value>
|
||||
<value>10000</value>
|
||||
<lower>1</lower>
|
||||
<upper>1e+08</upper>
|
||||
<step>1</step>
|
||||
@@ -10808,4 +10809,558 @@ quit without making any changes.</text>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomeDialog</class>
|
||||
<name>Prices Dialog</name>
|
||||
<title>Prices Editor</title>
|
||||
<type>GTK_WINDOW_TOPLEVEL</type>
|
||||
<position>GTK_WIN_POS_NONE</position>
|
||||
<modal>False</modal>
|
||||
<allow_shrink>True</allow_shrink>
|
||||
<allow_grow>True</allow_grow>
|
||||
<auto_shrink>False</auto_shrink>
|
||||
<auto_close>False</auto_close>
|
||||
<hide_on_close>False</hide_on_close>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<child_name>GnomeDialog:vbox</child_name>
|
||||
<name>vbox121</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>8</spacing>
|
||||
<child>
|
||||
<padding>4</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHButtonBox</class>
|
||||
<child_name>GnomeDialog:action_area</child_name>
|
||||
<name>hbuttonbox4</name>
|
||||
<layout_style>GTK_BUTTONBOX_END</layout_style>
|
||||
<spacing>8</spacing>
|
||||
<child_min_width>85</child_min_width>
|
||||
<child_min_height>27</child_min_height>
|
||||
<child_ipad_x>7</child_ipad_x>
|
||||
<child_ipad_y>0</child_ipad_y>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
<pack>GTK_PACK_END</pack>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>close_button</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<stock_button>GNOME_STOCK_BUTTON_CLOSE</stock_button>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox104</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>2</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame50</name>
|
||||
<border_width>3</border_width>
|
||||
<label>Prices</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox122</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkScrolledWindow</class>
|
||||
<name>scrolledwindow32</name>
|
||||
<border_width>3</border_width>
|
||||
<hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
|
||||
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
|
||||
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
|
||||
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkCList</class>
|
||||
<name>price_list</name>
|
||||
<can_focus>True</can_focus>
|
||||
<columns>6</columns>
|
||||
<column_widths>80,80,80,80,80,80</column_widths>
|
||||
<selection_mode>GTK_SELECTION_BROWSE</selection_mode>
|
||||
<show_titles>True</show_titles>
|
||||
<shadow_type>GTK_SHADOW_IN</shadow_type>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label8477415</name>
|
||||
<label>Commodity</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label8477416</name>
|
||||
<label>Currency</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label8477417</name>
|
||||
<label>Date</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label8477418</name>
|
||||
<label>Source</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label8477419</name>
|
||||
<label>Type</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label8477420</name>
|
||||
<label>Price</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHButtonBox</class>
|
||||
<name>hbuttonbox5</name>
|
||||
<layout_style>GTK_BUTTONBOX_SPREAD</layout_style>
|
||||
<spacing>30</spacing>
|
||||
<child_min_width>85</child_min_width>
|
||||
<child_min_height>27</child_min_height>
|
||||
<child_ipad_x>7</child_ipad_x>
|
||||
<child_ipad_y>0</child_ipad_y>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>add_button</name>
|
||||
<tooltip>Add a new price.</tooltip>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Add</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>remove_button</name>
|
||||
<tooltip>Remove the current price</tooltip>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Remove</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>edit_button</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Edit</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomeDialog</class>
|
||||
<name>Price Dialog</name>
|
||||
<visible>False</visible>
|
||||
<title>Price Dialog</title>
|
||||
<type>GTK_WINDOW_TOPLEVEL</type>
|
||||
<position>GTK_WIN_POS_NONE</position>
|
||||
<modal>True</modal>
|
||||
<allow_shrink>False</allow_shrink>
|
||||
<allow_grow>False</allow_grow>
|
||||
<auto_shrink>False</auto_shrink>
|
||||
<auto_close>False</auto_close>
|
||||
<hide_on_close>False</hide_on_close>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<child_name>GnomeDialog:vbox</child_name>
|
||||
<name>dialog-vbox18</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>8</spacing>
|
||||
<child>
|
||||
<padding>4</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHButtonBox</class>
|
||||
<child_name>GnomeDialog:action_area</child_name>
|
||||
<name>dialog-action_area18</name>
|
||||
<layout_style>GTK_BUTTONBOX_END</layout_style>
|
||||
<spacing>8</spacing>
|
||||
<child_min_width>85</child_min_width>
|
||||
<child_min_height>27</child_min_height>
|
||||
<child_ipad_x>7</child_ipad_x>
|
||||
<child_ipad_y>0</child_ipad_y>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
<pack>GTK_PACK_END</pack>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>ok_button</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>cancel_button</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>price_info_frame</name>
|
||||
<label>Price Information</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox126</name>
|
||||
<border_width>3</border_width>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox106</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>2</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox125</name>
|
||||
<homogeneous>True</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label8477399</name>
|
||||
<label>Commodity:</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label8477400</name>
|
||||
<label>Currency:</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label8477401</name>
|
||||
<label>Date:</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label8477402</name>
|
||||
<visible>False</visible>
|
||||
<label>Source:</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label8477403</name>
|
||||
<label>Type:</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label8477404</name>
|
||||
<label>Price:</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox126zz</name>
|
||||
<homogeneous>True</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>commodity_box</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>currency_box</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>date_box</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<name>source_entry</name>
|
||||
<visible>False</visible>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>False</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>type_option</name>
|
||||
<can_focus>True</can_focus>
|
||||
<items>Bid
|
||||
Ask
|
||||
Last
|
||||
Unknown
|
||||
</items>
|
||||
<initial_choice>0</initial_choice>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>price_box</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
</GTK-Interface>
|
||||
|
||||
@@ -824,6 +824,12 @@ gnc_ui_mainWindow_gl_cb(GtkWidget *widget, gpointer data)
|
||||
gnc_register_raise (regData);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_ui_mainWindow_prices_cb(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gnc_prices_dialog (NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gnc_ui_mainWindow_delete_cb(GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
@@ -1322,6 +1328,14 @@ gnc_main_create_menus(GnomeApp *app, GtkWidget *account_tree,
|
||||
GNOME_APP_PIXMAP_NONE, NULL,
|
||||
0, 0, NULL
|
||||
},
|
||||
{
|
||||
GNOME_APP_UI_ITEM,
|
||||
N_("_Price Editor"),
|
||||
N_("View and edit the prices for stocks and mutual funds"),
|
||||
gnc_ui_mainWindow_prices_cb, NULL, NULL,
|
||||
GNOME_APP_PIXMAP_NONE, NULL,
|
||||
0, 0, NULL
|
||||
},
|
||||
{
|
||||
GNOME_APP_UI_ITEM,
|
||||
N_("Financial _Calculator"),
|
||||
|
||||
@@ -642,6 +642,14 @@ the current value of the path.")
|
||||
(gnc:make-internal-option
|
||||
"__gui" "main_win_height" 0))
|
||||
|
||||
(gnc:register-configuration-option
|
||||
(gnc:make-internal-option
|
||||
"__gui" "prices_win_width" 0))
|
||||
|
||||
(gnc:register-configuration-option
|
||||
(gnc:make-internal-option
|
||||
"__gui" "prices_win_height" 0))
|
||||
|
||||
(gnc:register-configuration-option
|
||||
(gnc:make-internal-option
|
||||
"__gui" "reg_win_width" 0))
|
||||
|
||||
@@ -233,12 +233,11 @@
|
||||
(gnc:html-markup-b
|
||||
(gnc:sum-collector-commodity
|
||||
balance report-currency exchange-fn)))))))))
|
||||
|
||||
|
||||
|
||||
;;(gnc:warn "account names" liability-account-names)
|
||||
(gnc:html-document-set-title!
|
||||
;; FIXME: Use magic sprintf code.
|
||||
doc (sprintf #f (N_ "Balance sheet at %s")
|
||||
doc (sprintf #f (_ "Balance sheet at %s")
|
||||
(gnc:timepair-to-datestring to-date-tp)))
|
||||
|
||||
(if (not (null? accounts))
|
||||
|
||||
Reference in New Issue
Block a user