Work on commodity editor.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3921 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-04-10 09:26:01 +00:00
parent f381ba1a68
commit 80831eacab
13 changed files with 826 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2001-04-10 Dave Peticolas <dave@krondo.com>
* src/gnome/dialog-commodities.c: new file. commodity editor.
unfinished.
2001-04-10 Christian Stimming <stimming@tuhh.de>
* src/scm/report/net-worth-timeseries.scm: Fixed date argument
@ -20,6 +25,10 @@
* src/scm/report/{Makefile.am, report-list.scm}: add new barchart.
2001-04-09 Dave Peticolas <dave@krondo.com>
* src/gnome/dialog-price-editor.c: more work
2001-04-09 Robert Graham Merkel <rgmerk@mira.net>
* src/scm/report/balance-sheet.scm (balance-sheet-renderer):

View File

@ -1299,8 +1299,7 @@ For now, this is what we have.
</listitem>
<listitem>
<para>scheme -- scheme and guile code -- <filename> src/scm </filename> plus
<filename> src/guile </filename> -- in parenthesis is <filename/*.c + *.h + *.scm/
<filename> src/guile </filename> -- in parenthesis is <filename>*.c + *.h + *.scm</filename>
</para>
</listitem>
<listitem>
@ -1311,7 +1310,8 @@ For now, this is what we have.
<listitem>
<para>Languages -- the number of languages that the application messages
have been translated to. In parenthesis, the number of messages
in the message files <command/grep msgstr *.po |wc/, in thousands.
in the message files <command>grep msgstr *.po |wc</command>,
in thousands.
</para>
</listitem>

View File

@ -120,6 +120,7 @@ examine some of the other reports in <filename> src/scm/report
rendering this with a HTML widget. (Future versions of GnuCash will
hopefully support a more flexible system). </para>
</sect1>
</article>
<!-- Local variables: -->
<!-- sgml-parent-document: "gnucash.sgml" -->

View File

@ -12,10 +12,12 @@ src/gnome/dialog-account-picker.c
src/gnome/dialog-account.c
src/gnome/dialog-budget.c
src/gnome/dialog-column-view.c
src/gnome/dialog-commodities.c
src/gnome/dialog-commodity.c
src/gnome/dialog-filebox.c
src/gnome/dialog-fincalc.c
src/gnome/dialog-options.c
src/gnome/dialog-price-editor.c
src/gnome/dialog-progress.c
src/gnome/dialog-totd.c
src/gnome/dialog-transfer.c

View File

@ -90,6 +90,7 @@ gboolean gnc_dup_trans_dialog (gncUIWidget parent, time_t *date_p,
void gnc_tax_info_dialog (gncUIWidget parent);
void gnc_stock_split_dialog (Account * initial);
void gnc_prices_dialog (gncUIWidget parent);
void gnc_commodities_dialog (gncUIWidget parent);
/* Open a dialog asking for username and password. The heading and
* either 'initial_*' arguments may be NULL. If the dialog returns

View File

@ -8,6 +8,7 @@ libgncgnome_a_SOURCES = \
dialog-account.c \
dialog-budget.c \
dialog-column-view.c \
dialog-commodities.c \
dialog-commodity.c \
dialog-dup-trans.c \
dialog-filebox.c \

View File

@ -0,0 +1,395 @@
/********************************************************************\
* dialog-commodities.c -- commodities 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 "FileDialog.h"
#include "dialog-commodity.h"
#include "dialog-utils.h"
#include "glade-gnc-dialogs.h"
#include "glade-support.h"
#include "gnc-commodity.h"
#include "gnc-component-manager.h"
#include "gnc-engine-util.h"
#include "gnc-ui.h"
#include "messages.h"
#define DIALOG_COMMODITIES_CM_CLASS "dialog-commodities"
/* This static indicates the debugging module that this .o belongs to. */
/* static short module = MOD_GUI; */
typedef struct
{
GtkWidget * dialog;
GtkWidget * commodity_list;
GtkWidget * edit_button;
GtkWidget * remove_button;
gnc_commodity *commodity;
gboolean new;
} CommoditiesDialog;
static gint last_width = 0;
static gint last_height = 0;
static int
commodity_compare (gconstpointer a, gconstpointer b)
{
gnc_commodity *comm_a = (gnc_commodity *) a;
gnc_commodity *comm_b = (gnc_commodity *) b;
gint fraction_a;
gint fraction_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));
SAFE_STRCMP (gnc_commodity_get_fullname (comm_a),
gnc_commodity_get_fullname (comm_b));
SAFE_STRCMP (gnc_commodity_get_exchange_code (comm_a),
gnc_commodity_get_exchange_code (comm_b));
fraction_a = gnc_commodity_get_fraction (comm_a);
fraction_b = gnc_commodity_get_fraction (comm_b);
if (fraction_a < fraction_b)
return -1;
if (fraction_b < fraction_a)
return 1;
return 0;
}
static int
namespace_compare (gconstpointer a, gconstpointer b)
{
return safe_strcmp (a, b);
}
static void
gnc_load_namespace (gpointer data, gpointer user_data)
{
const char *namespace = data;
CommoditiesDialog *cd = user_data;
gnc_commodity_table *ct;
GList *commodities;
GList *node;
ct = gnc_engine_commodities ();
commodities = gnc_commodity_table_get_commodities (ct, namespace);
commodities = g_list_sort (commodities, commodity_compare);
for (node = commodities; node; node = node->next)
{
gnc_commodity *commodity = node->data;
const char *text[5];
gint row;
text[0] = gnc_commodity_get_namespace (commodity);
text[1] = gnc_commodity_get_mnemonic (commodity);
text[2] = gnc_commodity_get_fullname (commodity);
text[3] = gnc_commodity_get_exchange_code (commodity);
text[4] = g_strdup_printf ("%d", gnc_commodity_get_fraction (commodity));
row = gtk_clist_append (GTK_CLIST (cd->commodity_list), (char **)text);
g_free ((char *) text[4]);
gtk_clist_set_row_data (GTK_CLIST (cd->commodity_list), row, commodity);
}
g_list_free (commodities);
}
static guint
gnc_commodities_load_commodities (CommoditiesDialog *cd)
{
gnc_commodity_table *ct;
GList *namespaces;
GList *node;
int new_row;
guint size;
ct = gnc_engine_commodities ();
namespaces = gnc_commodity_table_get_namespaces (ct);
namespaces = g_list_sort (namespaces, namespace_compare);
gtk_clist_freeze (GTK_CLIST (cd->commodity_list));
gtk_clist_clear (GTK_CLIST (cd->commodity_list));
g_list_foreach (namespaces, gnc_load_namespace, cd);
gtk_clist_thaw (GTK_CLIST (cd->commodity_list));
gtk_clist_columns_autosize (GTK_CLIST (cd->commodity_list));
new_row = gtk_clist_find_row_from_data (GTK_CLIST (cd->commodity_list),
cd->commodity);
if (new_row < 0)
new_row = 0;
gtk_clist_select_row (GTK_CLIST (cd->commodity_list), new_row, 0);
if (gtk_clist_row_is_visible (GTK_CLIST (cd->commodity_list), new_row)
!= GTK_VISIBILITY_FULL)
gtk_clist_moveto (GTK_CLIST (cd->commodity_list),
new_row, 0, 0.5, 0.0);
size = gnc_commodity_table_get_size (ct);
gtk_widget_set_sensitive (cd->edit_button, size != 0);
gtk_widget_set_sensitive (cd->remove_button, size != 0);
g_list_free (namespaces);
return size;
}
static void
window_destroy_cb (GtkObject *object, gpointer data)
{
CommoditiesDialog *cd = data;
gnc_unregister_gui_component_by_data (DIALOG_COMMODITIES_CM_CLASS, cd);
g_free (cd);
}
static void
close_clicked (GtkWidget *widget, gpointer data)
{
CommoditiesDialog *cd = data;
gnc_close_gui_component_by_data (DIALOG_COMMODITIES_CM_CLASS, cd);
}
static void
edit_clicked (GtkWidget *widget, gpointer data)
{
CommoditiesDialog *cd = data;
if (!cd->commodity)
return;
}
static void
remove_clicked (GtkWidget *widget, gpointer data)
{
CommoditiesDialog *cd = data;
const char *message = _("Are you sure you want to delete the\n"
"current commodity?");
if (!cd->commodity)
return;
}
static void
add_clicked (GtkWidget *widget, gpointer data)
{
CommoditiesDialog *cd = data;
}
static void
select_commodity_cb (GtkCList *clist, gint row, gint col,
GdkEventButton *event, gpointer data)
{
CommoditiesDialog *cd = data;
cd->commodity = gtk_clist_get_row_data (clist, row);
cd->new = FALSE;
gtk_widget_set_sensitive (cd->edit_button,
cd->commodity != NULL);
gtk_widget_set_sensitive (cd->remove_button,
cd->commodity != NULL);
}
static void
unselect_commodity_cb (GtkCTree *ctre, gint row, gint col,
GdkEventButton *event, gpointer data)
{
CommoditiesDialog *cd = data;
cd->commodity = NULL;
cd->new = FALSE;
gtk_widget_set_sensitive (cd->edit_button, FALSE);
gtk_widget_set_sensitive (cd->remove_button, FALSE);
}
static void
commodities_set_min_widths (CommoditiesDialog *cd)
{
const char *titles[] = { _("Type"),
_("Symbol"),
_("Name"),
_("Code"),
_("Fraction") };
GtkStyle *style = gtk_widget_get_style (cd->commodity_list);
GdkFont *font = NULL;
gint width;
gint i;
if (style != NULL)
font = style->font;
if (font != NULL)
for (i = 0; i < 5; i++)
{
width = gdk_string_width (font, titles[i]);
gtk_clist_set_column_min_width (GTK_CLIST (cd->commodity_list),
i, width + 5);
}
}
static void
gnc_commodities_dialog_create (GtkWidget * parent, CommoditiesDialog *cd)
{
GtkWidget *dialog;
dialog = create_Commodities_Dialog ();
cd->dialog = dialog;
gnome_dialog_button_connect (GNOME_DIALOG (dialog), 0,
GTK_SIGNAL_FUNC (close_clicked), cd);
gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
GTK_SIGNAL_FUNC (window_destroy_cb), cd);
/* 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);
/* commodity tree */
{
GtkWidget *list;
list = lookup_widget (dialog, "commodity_list");
cd->commodity_list = list;
gtk_signal_connect (GTK_OBJECT(list), "select_row",
GTK_SIGNAL_FUNC(select_commodity_cb), cd);
gtk_signal_connect (GTK_OBJECT(list), "unselect_row",
GTK_SIGNAL_FUNC(unselect_commodity_cb), cd);
}
/* buttons */
{
GtkWidget *button;
button = lookup_widget (dialog, "edit_button");
cd->edit_button = button;
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (edit_clicked), cd);
button = lookup_widget (dialog, "remove_button");
cd->remove_button = button;
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (remove_clicked), cd);
button = lookup_widget (dialog, "add_button");
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (add_clicked), cd);
}
gnc_commodities_load_commodities (cd);
commodities_set_min_widths (cd);
if (last_width == 0)
gnc_get_window_size ("commodities_win", &last_width, &last_height);
if (last_height == 0)
last_height = 400;
gtk_window_set_default_size (GTK_WINDOW(cd->dialog),
last_width, last_height);
}
static void
close_handler (gpointer user_data)
{
CommoditiesDialog *cd = user_data;
gdk_window_get_geometry (GTK_WIDGET(cd->dialog)->window,
NULL, NULL, &last_width, &last_height, NULL);
gnc_save_window_size ("commodities_win", last_width, last_height);
gnome_dialog_close (GNOME_DIALOG (cd->dialog));
}
static void
refresh_handler (GHashTable *changes, gpointer user_data)
{
CommoditiesDialog *cd = user_data;
gnc_commodities_load_commodities (cd);
}
/********************************************************************\
* gnc_commodities_dialog *
* opens up a window to edit price information *
* *
* Args: parent - the parent of the window to be created *
* Return: nothing *
\********************************************************************/
void
gnc_commodities_dialog (GtkWidget * parent)
{
CommoditiesDialog *cd;
gint component_id;
cd = g_new0 (CommoditiesDialog, 1);
gnc_commodities_dialog_create (parent, cd);
component_id = gnc_register_gui_component (DIALOG_COMMODITIES_CM_CLASS,
refresh_handler, close_handler,
cd);
gtk_widget_grab_focus (cd->commodity_list);
gtk_widget_show (cd->dialog);
}

View File

@ -207,6 +207,10 @@ gnc_prices_load_prices (PricesDialog *pdb_dialog)
pdb_dialog->prices = prices;
gtk_clist_select_row (GTK_CLIST (pdb_dialog->price_list), new_row, 0);
if (gtk_clist_row_is_visible (GTK_CLIST (pdb_dialog->price_list), new_row)
!= GTK_VISIBILITY_FULL)
gtk_clist_moveto (GTK_CLIST (pdb_dialog->price_list),
new_row, 0, 0.5, 0.0);
gtk_widget_set_sensitive (pdb_dialog->edit_button, prices != NULL);
gtk_widget_set_sensitive (pdb_dialog->remove_button, prices != NULL);
@ -730,13 +734,9 @@ gnc_prices_dialog_create (GtkWidget * parent, PricesDialog *pdb_dialog)
/* default to ok */
gnome_dialog_set_default (GNOME_DIALOG(dialog), 0);
/* price information */
/* price tree */
{
GtkWidget *income_radio;
GtkWidget *scroll;
GtkWidget *list;
list = lookup_widget (dialog, "price_list");

View File

@ -7485,7 +7485,7 @@ create_Price_Dialog (void)
GtkWidget *ok_button;
GtkWidget *cancel_button;
Price_Dialog = gnome_dialog_new (_("Price Dialog"), NULL);
Price_Dialog = gnome_dialog_new (_("Price Editor"), 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);
@ -7658,3 +7658,167 @@ create_Price_Dialog (void)
return Price_Dialog;
}
GtkWidget*
create_Commodities_Dialog (void)
{
GtkWidget *Commodities_Dialog;
GtkWidget *vbox127;
GtkWidget *hbox107;
GtkWidget *frame51;
GtkWidget *vbox128;
GtkWidget *scrolledwindow33;
GtkWidget *commodity_list;
GtkWidget *label8477426;
GtkWidget *label8477427;
GtkWidget *label8477428;
GtkWidget *label8477429;
GtkWidget *label8477430;
GtkWidget *hbuttonbox7;
GtkWidget *add_button;
GtkWidget *remove_button;
GtkWidget *edit_button;
GtkWidget *hbuttonbox6;
GtkWidget *close_button;
GtkTooltips *tooltips;
tooltips = gtk_tooltips_new ();
Commodities_Dialog = gnome_dialog_new (_("Commodities"), NULL);
gtk_object_set_data (GTK_OBJECT (Commodities_Dialog), "Commodities_Dialog", Commodities_Dialog);
gtk_window_set_policy (GTK_WINDOW (Commodities_Dialog), TRUE, TRUE, FALSE);
vbox127 = GNOME_DIALOG (Commodities_Dialog)->vbox;
gtk_object_set_data (GTK_OBJECT (Commodities_Dialog), "vbox127", vbox127);
gtk_widget_show (vbox127);
hbox107 = gtk_hbox_new (FALSE, 2);
gtk_widget_ref (hbox107);
gtk_object_set_data_full (GTK_OBJECT (Commodities_Dialog), "hbox107", hbox107,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hbox107);
gtk_box_pack_start (GTK_BOX (vbox127), hbox107, TRUE, TRUE, 0);
frame51 = gtk_frame_new (_("Commodities"));
gtk_widget_ref (frame51);
gtk_object_set_data_full (GTK_OBJECT (Commodities_Dialog), "frame51", frame51,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (frame51);
gtk_box_pack_start (GTK_BOX (hbox107), frame51, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (frame51), 3);
vbox128 = gtk_vbox_new (FALSE, 0);
gtk_widget_ref (vbox128);
gtk_object_set_data_full (GTK_OBJECT (Commodities_Dialog), "vbox128", vbox128,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox128);
gtk_container_add (GTK_CONTAINER (frame51), vbox128);
scrolledwindow33 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_ref (scrolledwindow33);
gtk_object_set_data_full (GTK_OBJECT (Commodities_Dialog), "scrolledwindow33", scrolledwindow33,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (scrolledwindow33);
gtk_box_pack_start (GTK_BOX (vbox128), scrolledwindow33, TRUE, TRUE, 0);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow33), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
commodity_list = gtk_clist_new (5);
gtk_widget_ref (commodity_list);
gtk_object_set_data_full (GTK_OBJECT (Commodities_Dialog), "commodity_list", commodity_list,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (commodity_list);
gtk_container_add (GTK_CONTAINER (scrolledwindow33), commodity_list);
gtk_clist_set_column_width (GTK_CLIST (commodity_list), 0, 80);
gtk_clist_set_column_width (GTK_CLIST (commodity_list), 1, 80);
gtk_clist_set_column_width (GTK_CLIST (commodity_list), 2, 80);
gtk_clist_set_column_width (GTK_CLIST (commodity_list), 3, 80);
gtk_clist_set_column_width (GTK_CLIST (commodity_list), 4, 80);
gtk_clist_column_titles_show (GTK_CLIST (commodity_list));
label8477426 = gtk_label_new (_("Type"));
gtk_widget_ref (label8477426);
gtk_object_set_data_full (GTK_OBJECT (Commodities_Dialog), "label8477426", label8477426,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label8477426);
gtk_clist_set_column_widget (GTK_CLIST (commodity_list), 0, label8477426);
label8477427 = gtk_label_new (_("Symbol"));
gtk_widget_ref (label8477427);
gtk_object_set_data_full (GTK_OBJECT (Commodities_Dialog), "label8477427", label8477427,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label8477427);
gtk_clist_set_column_widget (GTK_CLIST (commodity_list), 1, label8477427);
label8477428 = gtk_label_new (_("Name"));
gtk_widget_ref (label8477428);
gtk_object_set_data_full (GTK_OBJECT (Commodities_Dialog), "label8477428", label8477428,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label8477428);
gtk_clist_set_column_widget (GTK_CLIST (commodity_list), 2, label8477428);
label8477429 = gtk_label_new (_("Code"));
gtk_widget_ref (label8477429);
gtk_object_set_data_full (GTK_OBJECT (Commodities_Dialog), "label8477429", label8477429,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label8477429);
gtk_clist_set_column_widget (GTK_CLIST (commodity_list), 3, label8477429);
label8477430 = gtk_label_new (_("Fraction"));
gtk_widget_ref (label8477430);
gtk_object_set_data_full (GTK_OBJECT (Commodities_Dialog), "label8477430", label8477430,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label8477430);
gtk_clist_set_column_widget (GTK_CLIST (commodity_list), 4, label8477430);
hbuttonbox7 = gtk_hbutton_box_new ();
gtk_widget_ref (hbuttonbox7);
gtk_object_set_data_full (GTK_OBJECT (Commodities_Dialog), "hbuttonbox7", hbuttonbox7,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hbuttonbox7);
gtk_box_pack_start (GTK_BOX (vbox128), hbuttonbox7, FALSE, FALSE, 0);
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox7), GTK_BUTTONBOX_SPREAD);
add_button = gtk_button_new_with_label (_("Add"));
gtk_widget_ref (add_button);
gtk_object_set_data_full (GTK_OBJECT (Commodities_Dialog), "add_button", add_button,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (add_button);
gtk_container_add (GTK_CONTAINER (hbuttonbox7), 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 (Commodities_Dialog), "remove_button", remove_button,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (remove_button);
gtk_container_add (GTK_CONTAINER (hbuttonbox7), 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 (Commodities_Dialog), "edit_button", edit_button,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (edit_button);
gtk_container_add (GTK_CONTAINER (hbuttonbox7), edit_button);
GTK_WIDGET_SET_FLAGS (edit_button, GTK_CAN_DEFAULT);
hbuttonbox6 = GNOME_DIALOG (Commodities_Dialog)->action_area;
gtk_object_set_data (GTK_OBJECT (Commodities_Dialog), "hbuttonbox6", hbuttonbox6);
gtk_widget_show (hbuttonbox6);
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox6), GTK_BUTTONBOX_END);
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbuttonbox6), 8);
gnome_dialog_append_button (GNOME_DIALOG (Commodities_Dialog), GNOME_STOCK_BUTTON_CLOSE);
close_button = GTK_WIDGET (g_list_last (GNOME_DIALOG (Commodities_Dialog)->buttons)->data);
gtk_widget_ref (close_button);
gtk_object_set_data_full (GTK_OBJECT (Commodities_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 (Commodities_Dialog), "tooltips", tooltips);
return Commodities_Dialog;
}

View File

@ -27,3 +27,4 @@ GtkWidget* create_Edit_Column_View_Page (void);
GtkWidget* create_Edit_Report_Size (void);
GtkWidget* create_Prices_Dialog (void);
GtkWidget* create_Price_Dialog (void);
GtkWidget* create_Commodities_Dialog (void);

View File

@ -11048,7 +11048,7 @@ quit without making any changes.</text>
<class>GnomeDialog</class>
<name>Price Dialog</name>
<visible>False</visible>
<title>Price Dialog</title>
<title>Price Editor</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>True</modal>
@ -11363,4 +11363,225 @@ Unknown
</widget>
</widget>
<widget>
<class>GnomeDialog</class>
<name>Commodities Dialog</name>
<title>Commodities</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>vbox127</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>hbuttonbox6</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>hbox107</name>
<homogeneous>False</homogeneous>
<spacing>2</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkFrame</class>
<name>frame51</name>
<border_width>3</border_width>
<label>Commodities</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>vbox128</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow33</name>
<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>commodity_list</name>
<can_focus>True</can_focus>
<columns>5</columns>
<column_widths>80,80,80,80,80</column_widths>
<selection_mode>GTK_SELECTION_SINGLE</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>label8477426</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>label8477427</name>
<label>Symbol</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>label8477428</name>
<label>Name</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>label8477429</name>
<label>Code</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>label8477430</name>
<label>Fraction</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>hbuttonbox7</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>
</GTK-Interface>

View File

@ -830,6 +830,12 @@ gnc_ui_mainWindow_prices_cb(GtkWidget *widget, gpointer data)
gnc_prices_dialog (NULL);
}
static void
gnc_ui_mainWindow_commodities_cb(GtkWidget *widget, gpointer data)
{
gnc_commodities_dialog (NULL);
}
static gboolean
gnc_ui_mainWindow_delete_cb(GtkWidget *widget,
GdkEvent *event,
@ -1328,6 +1334,14 @@ gnc_main_create_menus(GnomeApp *app, GtkWidget *account_tree,
GNOME_APP_PIXMAP_NONE, NULL,
0, 0, NULL
},
{
GNOME_APP_UI_ITEM,
N_("Commodity _Editor"),
N_("View and edit the commodities for stocks and mutual funds"),
gnc_ui_mainWindow_commodities_cb, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, 0, NULL
},
{
GNOME_APP_UI_ITEM,
N_("_Price Editor"),

View File

@ -626,6 +626,14 @@ the current value of the path.")
(gnc:make-internal-option
"__gui" "account_win_height" 0))
(gnc:register-configuration-option
(gnc:make-internal-option
"__gui" "commodities_win_width" 0))
(gnc:register-configuration-option
(gnc:make-internal-option
"__gui" "commodities_win_height" 0))
(gnc:register-configuration-option
(gnc:make-internal-option
"__gui" "help_win_width" 0))