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 {
00039 GtkWidget * dialog;
00040 GtkWidget * owner_choice;
00041 QofBook * book;
00042 GncOwner owner;
00043 Split * split;
00044 };
00045
00046 static DialogChooseOwner *
00047 gcoi_create_dialog(Split* split)
00048 {
00049 DialogChooseOwner* dco;
00050 GladeXML *xml;
00051 GtkWidget *widget, *box;
00052
00053 g_return_val_if_fail(split, NULL);
00054
00055 dco = g_new0(DialogChooseOwner, 1);
00056 g_assert(dco);
00057 dco->book = qof_instance_get_book(QOF_INSTANCE(split));
00058 dco->split = split;
00059
00060
00061 xml = gnc_glade_xml_new("choose-owner.glade", "Choose Owner Dialog");
00062 g_assert(xml);
00063
00064
00065 dco->dialog = glade_xml_get_widget(xml, "Choose Owner Dialog");
00066 g_assert(dco->dialog);
00067
00068
00069 widget = glade_xml_get_widget(xml, "title_label");
00070 if (1 == 1)
00071 {
00072 gncOwnerInitCustomer(&(dco->owner), NULL);
00073 gtk_label_set_text(GTK_LABEL(widget),
00074 _("This transaction needs to be assigned to a Customer."
00075 " Please choose the Customer below."));
00076 }
00077 else
00078 {
00079 gncOwnerInitVendor(&(dco->owner), NULL);
00080 gtk_label_set_text(GTK_LABEL(widget),
00081 _("This transaction needs to be assigned to a Vendor."
00082 " Please choose the Vendor below."));
00083 }
00084
00085
00086 widget = glade_xml_get_widget(xml, "desc_label");
00087 gtk_label_set_text(GTK_LABEL(widget),
00088 xaccTransGetDescription(xaccSplitGetParent(split)));
00089
00090
00091 widget = glade_xml_get_widget(xml, "owner_label");
00092 box = glade_xml_get_widget(xml, "owner_box");
00093 dco->owner_choice = gnc_owner_select_create(widget, box, dco->book,
00094 &(dco->owner));
00095
00096 gtk_widget_show_all(dco->dialog);
00097 return dco;
00098 }
00099
00100
00101 gboolean
00102 gnc_split_assign_owner(GtkWidget* window, Split* split)
00103 {
00104 if (1 == 0)
00105 gcoi_create_dialog(split);
00106
00107 return FALSE;
00108 }