00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "config.h"
00025
00026 #include <gtk/gtk.h>
00027 #include <glib/gi18n.h>
00028 #include <qof.h>
00029
00030 #include "Transaction.h"
00031 #include "dialog-utils.h"
00032 #include "gncOwner.h"
00033
00034 #include "dialog-choose-owner.h"
00035 #include "business-gnome-utils.h"
00036
00037 struct _choose_owner_dialog {
00038 GtkWidget * dialog;
00039 GtkWidget * owner_choice;
00040 QofBook * book;
00041 GncOwner owner;
00042 Split * split;
00043 };
00044
00045 static DialogChooseOwner *
00046 gcoi_create_dialog(Split* split)
00047 {
00048 DialogChooseOwner* dco;
00049 GladeXML *xml;
00050 GtkWidget *widget, *box;
00051
00052 g_return_val_if_fail(split, NULL);
00053
00054 dco = g_new0(DialogChooseOwner, 1);
00055 g_assert(dco);
00056 dco->book = qof_instance_get_book(QOF_INSTANCE(split));
00057 dco->split = split;
00058
00059
00060 xml = gnc_glade_xml_new("choose-owner.glade", "Choose Owner Dialog");
00061 g_assert(xml);
00062
00063
00064 dco->dialog = glade_xml_get_widget(xml, "Choose Owner Dialog");
00065 g_assert(dco->dialog);
00066
00067
00068 widget = glade_xml_get_widget(xml, "title_label");
00069 if (1 == 1) {
00070 gncOwnerInitCustomer(&(dco->owner), NULL);
00071 gtk_label_set_text(GTK_LABEL(widget),
00072 _("This transaction needs to be assigned to a Customer."
00073 " Please choose the Customer below."));
00074 } else {
00075 gncOwnerInitVendor(&(dco->owner), NULL);
00076 gtk_label_set_text(GTK_LABEL(widget),
00077 _("This transaction needs to be assigned to a Vendor."
00078 " Please choose the Vendor below."));
00079 }
00080
00081
00082 widget = glade_xml_get_widget(xml, "desc_label");
00083 gtk_label_set_text(GTK_LABEL(widget),
00084 xaccTransGetDescription(xaccSplitGetParent(split)));
00085
00086
00087 widget = glade_xml_get_widget(xml, "owner_label");
00088 box = glade_xml_get_widget(xml, "owner_box");
00089 dco->owner_choice = gnc_owner_select_create(widget, box, dco->book,
00090 &(dco->owner));
00091
00092 gtk_widget_show_all(dco->dialog);
00093 return dco;
00094 }
00095
00096
00097 gboolean
00098 gnc_split_assign_owner(GtkWidget* window, Split* split)
00099 {
00100 if (1 == 0)
00101 gcoi_create_dialog(split);
00102
00103 return FALSE;
00104 }