Skip to content

Commit

Permalink
Added currency editor widget.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2370 57a11ea4-9604-0410-9ed3-97b8803252fd
  • Loading branch information
jdavisp3 committed May 24, 2000
1 parent 7011321 commit 7567cbc
Show file tree
Hide file tree
Showing 11 changed files with 640 additions and 5 deletions.
16 changes: 16 additions & 0 deletions ChangeLog
@@ -1,3 +1,19 @@
2000-05-23 Dave Peticolas <peticola@cs.ucdavis.edu>

* src/scm/options.scm: add a currency option type.

* src/gnome/dialog-options.c: add support for currency options.

* src/gnome/dialog-utils.c (gnc_ui_account_field_box_create): used
the new currency editor widget.

* src/gnome/gnc-currency-edit.c: new widget for picking currencies.

2000-05-22 Dave Peticolas <peticola@cs.ucdavis.edu>

* src/guile/guile-util.c (gnc_depend): new function to access the
gnc:depend guile function.

2000-05-21 Dave Peticolas <peticola@cs.ucdavis.edu>

* src/gnome/window-reconcile.c: use share balances when
Expand Down
2 changes: 1 addition & 1 deletion src/gnome/Makefile.in
Expand Up @@ -68,7 +68,7 @@ GNOME_SRCS := top-level.c window-main.c window-register.c window-adjust.c \
dialog-options.c dialog-filebox.c dialog-transfer.c \
dialog-add.c dialog-edit.c dialog-utils.c \
extensions.c query-user.c reconcile-list.c \
window-report.c gnc-dateedit.c \
window-report.c gnc-dateedit.c gnc-currency-edit.c \
dialog-qif-import.c glade-gnc-dialogs.c gnc-datedelta.c \
dialog-account-picker.c print-session.c file-history.c \
dialog-print-check.c dialog-find-transactions.c
Expand Down
52 changes: 52 additions & 0 deletions src/gnome/dialog-options.c
Expand Up @@ -32,6 +32,7 @@
#include "gnc-helpers.h"
#include "account-tree.h"
#include "gnc-dateedit.h"
#include "gnc-currency-edit.h"
#include "global-options.h"
#include "query-user.h"
#include "window-help.h"
Expand Down Expand Up @@ -91,6 +92,18 @@ gnc_option_set_ui_value(GNCOption *option, gboolean use_default)
else
bad_value = TRUE;
}
else if (safe_strcmp(type, "currency") == 0)
{
if (gh_string_p(value))
{
char *string = gh_scm2newstr(value, NULL);
gnc_currency_edit_set_currency(GNC_CURRENCY_EDIT(option->widget),
string);
free(string);
}
else
bad_value = TRUE;
}
else if (safe_strcmp(type, "multichoice") == 0)
{
int index;
Expand Down Expand Up @@ -241,6 +254,16 @@ gnc_option_get_ui_value(GNCOption *option)
result = gh_str02scm(string);
g_free(string);
}
else if (safe_strcmp(type, "currency") == 0)
{
GtkEditable *editable;
char * string;

editable = GTK_EDITABLE(GTK_COMBO(option->widget)->entry);
string = gtk_editable_get_chars(editable, 0, -1);
result = gh_str02scm(string);
g_free(string);
}
else if (safe_strcmp(type, "multichoice") == 0)
{
gpointer _index;
Expand Down Expand Up @@ -797,6 +820,35 @@ gnc_option_set_ui_widget(GNCOption *option,
gnc_option_create_default_button(option, tooltips),
FALSE, FALSE, 0);
}
else if (safe_strcmp(type, "currency") == 0)
{
GtkWidget *label;
gchar *colon_name;

colon_name = g_strconcat(name, ":", NULL);
label = gtk_label_new(colon_name);
gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
g_free(colon_name);

enclosing = gtk_hbox_new(FALSE, 5);
value = gnc_currency_edit_new();

option->widget = value;
gnc_option_set_ui_value(option, FALSE);

if (documentation != NULL)
gtk_tooltips_set_tip(tooltips, GTK_COMBO(value)->entry,
documentation, NULL);

gtk_signal_connect(GTK_OBJECT(GTK_COMBO(value)->entry), "changed",
GTK_SIGNAL_FUNC(gnc_option_changed_cb), option);

gtk_box_pack_start(GTK_BOX(enclosing), label, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(enclosing), value, FALSE, FALSE, 0);
gtk_box_pack_end(GTK_BOX(enclosing),
gnc_option_create_default_button(option, tooltips),
FALSE, FALSE, 0);
}
else if (safe_strcmp(type, "multichoice") == 0)
{
GtkWidget *label;
Expand Down
7 changes: 4 additions & 3 deletions src/gnome/dialog-utils.c
Expand Up @@ -28,9 +28,10 @@
#include "account-tree.h"
#include "dialog-utils.h"
#include "global-options.h"
#include "gnc-currency-edit.h"
#include "messages.h"
#include "util.h"
#include "EuroUtils.h"
#include "util.h"


/* This static indicates the debugging module that this .o belongs to. */
Expand Down Expand Up @@ -166,8 +167,8 @@ gnc_ui_account_field_box_create(AccountEditInfo * info,
gtk_box_pack_start(GTK_BOX(vbox), widget, TRUE, TRUE, 0);
gtk_widget_show(widget);

widget = gtk_entry_new();
info->currency_entry = GTK_EDITABLE(widget);
widget = gnc_currency_edit_new();
info->currency_entry = GTK_EDITABLE(GTK_COMBO(widget)->entry);
gtk_box_pack_start(GTK_BOX(vbox), widget, TRUE, TRUE, 0);
gtk_widget_show(widget);

Expand Down
1 change: 1 addition & 0 deletions src/gnome/dialog-utils.h
Expand Up @@ -43,6 +43,7 @@ struct _AccountEditInfo
GtkEditable * notes_entry;

GtkOptionMenu * source_menu;

gint source;
};

Expand Down

0 comments on commit 7567cbc

Please sign in to comment.