mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
misc hacking
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8863 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
3c92f24d57
commit
6c4b3c40b7
@ -28,13 +28,16 @@
|
|||||||
#include <libgnomeui/gnome-window-icon.h>
|
#include <libgnomeui/gnome-window-icon.h>
|
||||||
|
|
||||||
#include "FreqSpec.h"
|
#include "FreqSpec.h"
|
||||||
|
#include "Query.h"
|
||||||
|
#include "Transaction.h"
|
||||||
#include "dialog-utils.h"
|
#include "dialog-utils.h"
|
||||||
#include "druid-acct-period.h"
|
#include "druid-acct-period.h"
|
||||||
#include "druid-utils.h"
|
#include "druid-utils.h"
|
||||||
#include "global-options.h"
|
|
||||||
#include "qofbook.h"
|
|
||||||
#include "gnc-component-manager.h"
|
#include "gnc-component-manager.h"
|
||||||
|
#include "gnc-frequency.h"
|
||||||
|
#include "gnc-ui-util.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
|
#include "qofbook.h"
|
||||||
|
|
||||||
|
|
||||||
#define DRUID_ACCT_PERIOD_CM_CLASS "druid-acct-period"
|
#define DRUID_ACCT_PERIOD_CM_CLASS "druid-acct-period"
|
||||||
@ -45,10 +48,14 @@ typedef struct
|
|||||||
{
|
{
|
||||||
GtkWidget * window;
|
GtkWidget * window;
|
||||||
GtkWidget * druid;
|
GtkWidget * druid;
|
||||||
GtkOptionMenu *period_menu;
|
GNCFrequency *period_menu;
|
||||||
GnomeDateEdit *closing_date_edit;
|
// GnomeDateEdit *closing_date_edit;
|
||||||
GtkLabel * earliest_date;
|
GtkLabel * earliest_date;
|
||||||
|
|
||||||
|
time_t earliest;
|
||||||
|
GDate *start_date;
|
||||||
|
FreqSpec *period;
|
||||||
|
|
||||||
} AcctPeriodInfo;
|
} AcctPeriodInfo;
|
||||||
|
|
||||||
|
|
||||||
@ -60,6 +67,9 @@ ap_window_destroy_cb (GtkObject *object, gpointer data)
|
|||||||
|
|
||||||
gnc_unregister_gui_component_by_data (DRUID_ACCT_PERIOD_CM_CLASS, info);
|
gnc_unregister_gui_component_by_data (DRUID_ACCT_PERIOD_CM_CLASS, info);
|
||||||
|
|
||||||
|
// gnc_frequency_destory ??
|
||||||
|
xaccFreqSpecFree (info->period);
|
||||||
|
g_free (info->start_date);
|
||||||
g_free (info);
|
g_free (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,27 +96,53 @@ ap_changed (GtkWidget *widget,
|
|||||||
gpointer arg1,
|
gpointer arg1,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
AcctPeriodInfo *info = user_data;
|
// AcctPeriodInfo *info = user_data;
|
||||||
time_t closing_date = 0;
|
time_t closing_date = 0;
|
||||||
GtkMenuItem *item;
|
GtkMenuItem *item = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
closing_date = gnome_date_edit_get_date (info->closing_date_edit);
|
closing_date = gnome_date_edit_get_date (info->closing_date_edit);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
item = GTK_MENU_ITEM (gtk_menu_get_active (GTK_MENU(info->period_menu->menu)));
|
// item = GTK_MENU_ITEM (gtk_menu_get_active (GTK_MENU(info->period_menu->menu)));
|
||||||
printf ("something changed, time=%ld item=%p\n", closing_date, item);
|
printf ("something changed, time=%ld item=%p\n", closing_date, item);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* =============================================================== */
|
||||||
|
/* Find the earliest date occuring in the book. Do this by making
|
||||||
|
* a query and sorting by date.
|
||||||
|
*/
|
||||||
|
static time_t
|
||||||
|
get_earliest_in_book (QofBook *book)
|
||||||
|
{
|
||||||
|
QofQuery *q;
|
||||||
|
GSList *p1, *p2;
|
||||||
|
time_t earliest;
|
||||||
|
|
||||||
|
q = qof_query_create_for(GNC_ID_SPLIT);
|
||||||
|
qof_query_set_max_results(q, 5);
|
||||||
|
|
||||||
|
p1 = g_slist_prepend (NULL, TRANS_DATE_POSTED);
|
||||||
|
p1 = g_slist_prepend (p1, SPLIT_TRANS);
|
||||||
|
p2 = g_slist_prepend (NULL, QUERY_DEFAULT_SORT);
|
||||||
|
qof_query_set_sort_order (q, p1, p2, NULL);
|
||||||
|
|
||||||
|
qof_query_set_sort_increasing (q, TRUE, TRUE, TRUE);
|
||||||
|
|
||||||
|
earliest = xaccQueryGetEarliestDateFound (q);
|
||||||
|
|
||||||
|
return earliest;
|
||||||
|
}
|
||||||
|
|
||||||
/* =============================================================== */
|
/* =============================================================== */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ap_druid_create (AcctPeriodInfo *info)
|
ap_druid_create (AcctPeriodInfo *info)
|
||||||
{
|
{
|
||||||
GladeXML *xml;
|
GladeXML *xml;
|
||||||
GtkWidget *page;
|
GtkWidget *w, *page;
|
||||||
|
|
||||||
xml = gnc_glade_xml_new ("acctperiod.glade", "Acct Period Druid");
|
xml = gnc_glade_xml_new ("acctperiod.glade", "Acct Period Druid");
|
||||||
|
|
||||||
@ -114,13 +150,30 @@ ap_druid_create (AcctPeriodInfo *info)
|
|||||||
|
|
||||||
info->druid = glade_xml_get_widget (xml, "acct_period_druid");
|
info->druid = glade_xml_get_widget (xml, "acct_period_druid");
|
||||||
|
|
||||||
info->period_menu =
|
/* Set up the freq spec widget */
|
||||||
GTK_OPTION_MENU (glade_xml_get_widget (xml, "period menu"));
|
|
||||||
info->closing_date_edit =
|
info->earliest = get_earliest_in_book (gnc_get_current_book());
|
||||||
GNOME_DATE_EDIT (glade_xml_get_widget (xml, "closing date edit"));
|
printf ("the earliest is %ld %s\n", info->earliest, ctime (&info->earliest));
|
||||||
|
info->start_date = g_date_new_dmy(5,5,1988);
|
||||||
|
|
||||||
|
info->period = xaccFreqSpecMalloc( gnc_get_current_book() );
|
||||||
|
xaccFreqSpecSetMonthly (info->period, info->start_date, 12);
|
||||||
|
xaccFreqSpecSetUIType (info->period, UIFREQ_YEARLY);
|
||||||
|
|
||||||
|
info->period_menu = GNC_FREQUENCY (
|
||||||
|
gnc_frequency_new (info->period, info->start_date));
|
||||||
|
w = glade_xml_get_widget (xml, "period box");
|
||||||
|
gtk_box_pack_start (GTK_BOX (w), GTK_WIDGET (info->period_menu),
|
||||||
|
TRUE, TRUE, 0);
|
||||||
|
printf ("postbox\n");
|
||||||
|
|
||||||
|
// info->closing_date_edit =
|
||||||
|
// GNOME_DATE_EDIT (glade_xml_get_widget (xml, "closing date edit"));
|
||||||
info->earliest_date =
|
info->earliest_date =
|
||||||
GTK_LABEL (glade_xml_get_widget (xml, "earliest trans label"));
|
GTK_LABEL (glade_xml_get_widget (xml, "earliest trans label"));
|
||||||
|
|
||||||
|
// "closing date box"
|
||||||
|
|
||||||
/* generic finished/close/abort signals */
|
/* generic finished/close/abort signals */
|
||||||
gtk_signal_connect (GTK_OBJECT (info->window), "destroy",
|
gtk_signal_connect (GTK_OBJECT (info->window), "destroy",
|
||||||
GTK_SIGNAL_FUNC (ap_window_destroy_cb), info);
|
GTK_SIGNAL_FUNC (ap_window_destroy_cb), info);
|
||||||
@ -132,16 +185,15 @@ ap_druid_create (AcctPeriodInfo *info)
|
|||||||
gtk_signal_connect (GTK_OBJECT (page), "finish",
|
gtk_signal_connect (GTK_OBJECT (page), "finish",
|
||||||
GTK_SIGNAL_FUNC (ap_finish), info);
|
GTK_SIGNAL_FUNC (ap_finish), info);
|
||||||
|
|
||||||
|
printf ("presig\n");
|
||||||
/* User changes the accouting period or date signals */
|
/* User changes the accouting period or date signals */
|
||||||
// XXX doesn't work ...
|
gtk_signal_connect (GTK_OBJECT (info->period_menu), "changed",
|
||||||
gtk_signal_connect (GTK_OBJECT (info->period_menu), "clicked",
|
|
||||||
GTK_SIGNAL_FUNC (ap_changed), info);
|
GTK_SIGNAL_FUNC (ap_changed), info);
|
||||||
|
printf ("postsig\n");
|
||||||
gtk_signal_connect (GTK_OBJECT (info->period_menu->menu), "selection_done",
|
/*
|
||||||
GTK_SIGNAL_FUNC (ap_changed), info);
|
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (info->closing_date_edit), "date_changed",
|
gtk_signal_connect (GTK_OBJECT (info->closing_date_edit), "date_changed",
|
||||||
GTK_SIGNAL_FUNC (ap_changed), info);
|
GTK_SIGNAL_FUNC (ap_changed), info);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -106,33 +106,6 @@ it is still under development.</text>
|
|||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
<widget>
|
|
||||||
<class>GtkOptionMenu</class>
|
|
||||||
<name>period menu</name>
|
|
||||||
<can_focus>True</can_focus>
|
|
||||||
<items>Weekly
|
|
||||||
Monthly
|
|
||||||
Quarterly
|
|
||||||
Bi-annual
|
|
||||||
Annual
|
|
||||||
</items>
|
|
||||||
<initial_choice>0</initial_choice>
|
|
||||||
<child>
|
|
||||||
<left_attach>1</left_attach>
|
|
||||||
<right_attach>2</right_attach>
|
|
||||||
<top_attach>0</top_attach>
|
|
||||||
<bottom_attach>1</bottom_attach>
|
|
||||||
<xpad>0</xpad>
|
|
||||||
<ypad>0</ypad>
|
|
||||||
<xexpand>False</xexpand>
|
|
||||||
<yexpand>False</yexpand>
|
|
||||||
<xshrink>False</xshrink>
|
|
||||||
<yshrink>False</yshrink>
|
|
||||||
<xfill>True</xfill>
|
|
||||||
<yfill>False</yfill>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkLabel</class>
|
<class>GtkLabel</class>
|
||||||
<name>label847716</name>
|
<name>label847716</name>
|
||||||
@ -160,13 +133,35 @@ Annual
|
|||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GnomeDateEdit</class>
|
<class>GtkHBox</class>
|
||||||
<name>closing date edit</name>
|
<name>period box</name>
|
||||||
<show_time>False</show_time>
|
<homogeneous>False</homogeneous>
|
||||||
<use_24_format>True</use_24_format>
|
<spacing>0</spacing>
|
||||||
<week_start_monday>False</week_start_monday>
|
<child>
|
||||||
<lower_hour>7</lower_hour>
|
<left_attach>1</left_attach>
|
||||||
<upper_hour>19</upper_hour>
|
<right_attach>2</right_attach>
|
||||||
|
<top_attach>0</top_attach>
|
||||||
|
<bottom_attach>1</bottom_attach>
|
||||||
|
<xpad>0</xpad>
|
||||||
|
<ypad>0</ypad>
|
||||||
|
<xexpand>False</xexpand>
|
||||||
|
<yexpand>False</yexpand>
|
||||||
|
<xshrink>False</xshrink>
|
||||||
|
<yshrink>False</yshrink>
|
||||||
|
<xfill>True</xfill>
|
||||||
|
<yfill>True</yfill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>Placeholder</class>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkHBox</class>
|
||||||
|
<name>closing date box</name>
|
||||||
|
<homogeneous>False</homogeneous>
|
||||||
|
<spacing>0</spacing>
|
||||||
<child>
|
<child>
|
||||||
<left_attach>1</left_attach>
|
<left_attach>1</left_attach>
|
||||||
<right_attach>2</right_attach>
|
<right_attach>2</right_attach>
|
||||||
@ -174,13 +169,17 @@ Annual
|
|||||||
<bottom_attach>2</bottom_attach>
|
<bottom_attach>2</bottom_attach>
|
||||||
<xpad>0</xpad>
|
<xpad>0</xpad>
|
||||||
<ypad>0</ypad>
|
<ypad>0</ypad>
|
||||||
<xexpand>True</xexpand>
|
<xexpand>False</xexpand>
|
||||||
<yexpand>False</yexpand>
|
<yexpand>False</yexpand>
|
||||||
<xshrink>False</xshrink>
|
<xshrink>False</xshrink>
|
||||||
<yshrink>False</yshrink>
|
<yshrink>False</yshrink>
|
||||||
<xfill>True</xfill>
|
<xfill>True</xfill>
|
||||||
<yfill>False</yfill>
|
<yfill>True</yfill>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>Placeholder</class>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user