r14509 - gnucash/branches/sx-cleanup - gnc-plugin-page-sx-list.
Joshua Sled
jsled at cvs.gnucash.org
Sat Jul 15 11:56:19 EDT 2006
Author: jsled
Date: 2006-07-15 11:56:15 -0400 (Sat, 15 Jul 2006)
New Revision: 14509
Trac: http://svn.gnucash.org/trac/changeset/14509
Added:
gnucash/branches/sx-cleanup/src/doc/sx.rst
gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-page-sx-list.c
gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-page-sx-list.h
gnucash/branches/sx-cleanup/src/gnome/ui/gnc-plugin-page-sx-list-ui.xml
Modified:
gnucash/branches/sx-cleanup/ChangeLog
gnucash/branches/sx-cleanup/src/engine/SchedXaction.h
gnucash/branches/sx-cleanup/src/gnome/Makefile.am
gnucash/branches/sx-cleanup/src/gnome/glade/sched-xact.glade
gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-basic-commands.c
gnucash/branches/sx-cleanup/src/gnome/ui/Makefile.am
Log:
gnc-plugin-page-sx-list.
Modified: gnucash/branches/sx-cleanup/ChangeLog
===================================================================
--- gnucash/branches/sx-cleanup/ChangeLog 2006-07-15 15:29:41 UTC (rev 14508)
+++ gnucash/branches/sx-cleanup/ChangeLog 2006-07-15 15:56:15 UTC (rev 14509)
@@ -1,3 +1,15 @@
+2006-07-15 Joshua Sled <jsled at asynchronous.org>
+
+ * src/engine/SchedXaction.h (GNC_IS_SX,GNC_SX): added for convenience.
+
+ * src/gnome/ui/gnc-plugin-page-sx-list-ui.xml:
+ * src/gnome/gnc-plugin-page-sx-list.[ch]: SX List as a plugin page.
+
+ * src/gnome/gnc-plugin-basic-commands.c: Call SX List plugin page,
+ not dialog.
+
+ * src/doc/sx.rst: Added.
+
2006-07-01 David Hampton <hampton at employees.org>
* src/quotes/gnc-fq-helper.in: This one file really does require
Added: gnucash/branches/sx-cleanup/src/doc/sx.rst
===================================================================
--- gnucash/branches/sx-cleanup/src/doc/sx.rst 2006-07-15 15:29:41 UTC (rev 14508)
+++ gnucash/branches/sx-cleanup/src/doc/sx.rst 2006-07-15 15:56:15 UTC (rev 14509)
@@ -0,0 +1,63 @@
+Scheduled Transactions
+======================
+
+Overview
+--------
+
+- SX List
+ - CRUD operations on SXes
+ - Show Next "year"s worth of SX instances
+ - gnc_sx_get_instances({now + 1yr})
+
+- SinceLastRun
+ - Last .. present (+ create-in-advance, reminder) instances
+ - gnc_sx_get_instances(now)
+
+TODO
+----
+
+- 'sx_updated' QOF events
+
+- gnc_dense_cal
+ - change number-month properties to display (width, length)
+ - set_data(GncSxUpcomingInstances *future);
+ - set_model(GncSxUpcomingInstances *model);
+ - register callbacks for signals
+ - set_data(...)
+
+- transaction creation
+ - verification routine
+ - variable binding/requirements.
+ - actual creation
+ - error handling
+
+- stateful editing of instances in since-last-run dialog
+ - postponed/ignored/to-create constraints
+ - processed_valid_reminders_list, contiguous-date logic
+ - postponed/ignored/to-create transitions [?]
+ - "allowed to finish" decision.
+
+Pedantic Todo
+----------------
+
+- s/SchedXaction/Scheduled/
+- s/temporal_state/instance_sequence_context/
+
+
+<?c
+
+
+?>
+
+GtkTreeModelIface
+-----------------
+
+- signals
+ - row_changed : sx_updated
+ - row_inserted : sx_created
+ - row_has_child_toggled : are there any children, here?
+ - row_deleted : sx_deleted
+ - rows_reordered : ???
+
+- GtkTreeSortableIface
+ -
Modified: gnucash/branches/sx-cleanup/src/engine/SchedXaction.h
===================================================================
--- gnucash/branches/sx-cleanup/src/engine/SchedXaction.h 2006-07-15 15:29:41 UTC (rev 14508)
+++ gnucash/branches/sx-cleanup/src/engine/SchedXaction.h 2006-07-15 15:56:15 UTC (rev 14509)
@@ -42,6 +42,9 @@
#include "FreqSpec.h"
#include "gnc-engine.h"
+#define GNC_IS_SX(obj) (QOF_CHECK_TYPE((obj), GNC_ID_SCHEDXACTION))
+#define GNC_SX(obj) (QOF_CHECK_CAST((obj), GNC_ID_SCHEDXACTION, SchedXaction))
+
/**
* The SchedXaction data.
*/
Modified: gnucash/branches/sx-cleanup/src/gnome/Makefile.am
===================================================================
--- gnucash/branches/sx-cleanup/src/gnome/Makefile.am 2006-07-15 15:29:41 UTC (rev 14508)
+++ gnucash/branches/sx-cleanup/src/gnome/Makefile.am 2006-07-15 15:56:15 UTC (rev 14509)
@@ -56,6 +56,7 @@
gnc-plugin-register.c \
gnc-plugin-page-account-tree.c \
gnc-plugin-page-budget.c \
+ gnc-plugin-page-sx-list.c \
gnc-plugin-page-register.c \
gnc-split-reg.c \
lot-viewer.c \
@@ -92,6 +93,7 @@
gnc-plugin-register.h \
gnc-plugin-page-account-tree.h \
gnc-plugin-page-budget.h \
+ gnc-plugin-page-sx-list.h \
gnc-plugin-page-register.h \
gnc-split-reg.h \
gw-gnc.h \
Modified: gnucash/branches/sx-cleanup/src/gnome/glade/sched-xact.glade
===================================================================
--- gnucash/branches/sx-cleanup/src/gnome/glade/sched-xact.glade 2006-07-15 15:29:41 UTC (rev 14508)
+++ gnucash/branches/sx-cleanup/src/gnome/glade/sched-xact.glade 2006-07-15 15:56:15 UTC (rev 14509)
@@ -77,7 +77,7 @@
</child>
<child>
- <widget class="GtkVBox" id="vbox105">
+ <widget class="GtkVBox" id="editor-vbox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
@@ -4846,360 +4846,6 @@
</child>
</widget>
-<widget class="GtkDialog" id="Scheduled Transaction List">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Scheduled Transactions</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="default_width">640</property>
- <property name="default_height">480</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="has_separator">True</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox18">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">8</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area18">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
-
- <child>
- <widget class="GtkButton" id="close_button">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-close</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="response_id">0</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847992">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>Transactions</b></property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkAlignment" id="alignment34">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">1</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">12</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkHBox" id="hbox123">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="visible">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
- <child>
- <widget class="GtkCList" id="sched_xact_list">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="n_columns">3</property>
- <property name="column_widths">127,140,80</property>
- <property name="selection_mode">GTK_SELECTION_SINGLE</property>
- <property name="show_titles">True</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
-
- <child>
- <widget class="GtkLabel" id="label847750">
- <property name="label" translatable="yes">Name</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847751">
- <property name="label" translatable="yes">Frequency</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847752">
- <property name="label" translatable="yes">Next Occurrence</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVButtonBox" id="vbuttonbox1">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
- <property name="spacing">10</property>
-
- <child>
- <widget class="GtkButton" id="new_button">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-new</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="edit_button">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment24">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">0</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkHBox" id="hbox179">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
-
- <child>
- <widget class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="stock">gtk-properties</property>
- <property name="icon_size">4</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847980">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Edit</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="delete_button">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-delete</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847993">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label847970">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>Upcoming</b></property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkAlignment" id="alignment35">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">1</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">12</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkHBox" id="upcoming_cal_hbox">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <placeholder/>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
<widget class="GtkDialog" id="sx_from_real_trans">
<property name="visible">True</property>
<property name="title" translatable="yes">Make Scheduled Transaction</property>
@@ -8664,4 +8310,174 @@
</child>
</widget>
+<widget class="GtkWindow" id="sx list plugin page content">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">window1</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+
+ <child>
+ <widget class="GtkVBox" id="sx-list-vbox">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label847992">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Transactions</b></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment34">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox123">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkTreeView" id="sx_list">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">False</property>
+ <property name="reorderable">True</property>
+ <property name="enable_search">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label847993">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label847970">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Upcoming</b></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment35">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="upcoming_cal_hbox">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
</glade-interface>
Modified: gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-basic-commands.c
===================================================================
--- gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-basic-commands.c 2006-07-15 15:29:41 UTC (rev 14508)
+++ gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-basic-commands.c 2006-07-15 15:56:15 UTC (rev 14509)
@@ -55,6 +55,8 @@
#include "gnc-window.h"
#include "gnc-session.h"
+#include "gnc-plugin-page-sx-list.h"
+
/* This static indicates the debugging module that this .o belongs to. */
#ifdef QSF_IMPORT_NO_LONGER_BROKEN
static QofLogModule log_module = GNC_MOD_GUI;
@@ -435,7 +437,9 @@
static void
gnc_main_window_cmd_actions_scheduled_transaction_editor (GtkAction *action, GncMainWindowActionData *data)
{
- gnc_ui_scheduled_xaction_dialog_create ();
+ GncPluginPage *page = gnc_plugin_page_sx_list_new();
+ gnc_main_window_open_page(NULL, page);
+ //gnc_ui_scheduled_xaction_dialog_create ();
}
static void
Added: gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-page-sx-list.c
===================================================================
--- gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-page-sx-list.c 2006-07-15 15:29:41 UTC (rev 14508)
+++ gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-page-sx-list.c 2006-07-15 15:56:15 UTC (rev 14509)
@@ -0,0 +1,1144 @@
+/*
+ * gnc-plugin-page-sx-list.c
+ *
+ * Copyright (C) 2006 Josh Sled <jsled at asynchronous.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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
+ * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
+ * Boston, MA 02110-1301, USA gnu at gnu.org
+ */
+
+/* todo:
+ * - ui, actions, menus
+ * - icon
+ */
+
+/** @addtogroup ContentPlugins
+ @{ */
+/** @addtogroup GncPluginPageSxList A SX List Plugin Page
+ @{ */
+/** @brief Functions providing the SX List as a plugin page.
+ @author Josh Sled <jsled at asynchronous.org>
+*/
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include <glade/glade-xml.h>
+#ifndef HAVE_GLIB26
+#include "gkeyfile.h"
+#endif
+#include "gnc-engine.h"
+#include "gnc-dense-cal.h"
+#include "gnc-icons.h"
+#include "gnc-plugin-page-sx-list.h"
+#include "gnc-ui-util.h"
+#include "gnc-main-window.h"
+#include "dialog-utils.h"
+#include "gnc-component-manager.h"
+#include "SX-book.h"
+#include "SX-book-p.h"
+#include "gnc-book.h"
+
+/* This static indicates the debugging module that this .o belongs to. */
+static QofLogModule log_module = GNC_MOD_GUI;
+
+#define PLUGIN_PAGE_SX_LIST_CM_CLASS "plugin-page-sx-list"
+#define GCONF_SECTION "window/pages/sx_list"
+
+typedef struct _GncSxInstanceModel GncSxInstanceModel;
+typedef struct _GncSxListTreeModelAdapter GncSxListTreeModelAdapter;
+
+typedef struct GncPluginPageSxListPrivate
+{
+ GtkWidget* widget;
+ gint gnc_component_id;
+ gint gppsl_event_handler_id;
+
+ GladeXML* gxml;
+ GncDenseCal* gdcal;
+
+ GncSxInstanceModel* instances;
+ GncSxListTreeModelAdapter* tree_model;
+ GtkTreeView* tree_view;
+
+} GncPluginPageSxListPrivate;
+
+#define GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_PAGE_SX_LIST, GncPluginPageSxListPrivate))
+
+static GObjectClass *parent_class = NULL;
+
+struct _GncSxInstanceModel
+{
+ GObject parent;
+
+ /* private */
+ gint qof_event_handler_id;
+
+ // signals
+ //void (*added)(GncSxInstance *sx); // gpointer user_data
+ //void (*removed)(GncSxInstance *sx); // gpointer user_data
+ //void (*changed)(GncSxInstance *inst); // gpointer user_data
+
+ /* public */
+ GDate range_end;
+ GList *sx_instance_list; // <GncSxInstances*>
+};
+
+typedef struct _GncSxInstanceModelClass
+{
+ GObjectClass parent;
+
+ guint updated_signal_id;
+} GncSxInstanceModelClass;
+
+typedef struct _GncSxInstances
+{
+ SchedXaction *sx;
+
+ GDate next_instance_date;
+
+ /** all: <GncSxInstance*> **/
+ GList *ignored;
+ GList *postponed;
+ GList *upcoming;
+ GList *remind;
+} GncSxInstances;
+
+typedef enum
+{
+ IGNORED, POSTPONED, TO_CREATE, REMINDER, MAX_STATE
+} GncSxInstanceType;
+
+typedef struct _GncSxInstance
+{
+ GncSxInstances *parent;
+ GncSxInstanceType type;
+ GDate date;
+} GncSxInstance;
+
+GType gnc_sx_instance_model_get_type(void);
+static void gnc_sx_instance_model_class_init (GncSxInstanceModelClass *klass);
+static void gnc_sx_instance_model_init(GTypeInstance *instance, gpointer klass);
+GncSxInstanceModel* gnc_sx_instance_model_new(void);
+
+static void _gnc_sx_instance_event_handler(QofEntity *ent, QofEventId event_type, gpointer user_data, gpointer evt_data);
+
+#define GNC_TYPE_SX_INSTANCE_MODEL (gnc_sx_instance_model_get_type ())
+#define GNC_SX_INSTANCE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_SX_INSTANCE_MODEL, GncSxInstanceModel))
+#define GNC_SX_INSTANCE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_SX_INSTANCE_MODEL, GncSxInstanceModelClass))
+#define GNC_IS_SX_INSTANCE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_SX_INSTANCE_MODEL))
+#define GNC_IS_SX_INSTANCE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_SX_INSTANCE_MODEL))
+#define GNC_SX_INSTANCE_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_SX_INSTANCE_MODEL, GncSxInstanceModelClass))
+
+GncSxInstanceModel* gnc_sx_get_instances(GDate *range_end);
+
+/* ------------------------------------------------------------ */
+
+struct _GncSxListTreeModelAdapter
+{
+ GObject parent;
+
+ /* private */
+ GncSxInstanceModel *instances;
+ GtkTreeStore *real;
+};
+
+typedef struct _GncSxListTreeModelAdapterClass
+{
+ GObjectClass parent;
+} GncSxListTreeModelAdapterClass;
+
+GType gnc_sx_list_tree_model_adapter_get_type(void);
+static void gnc_sx_list_tree_model_adapter_class_init(GncSxListTreeModelAdapterClass *klass);
+static void gnc_sx_list_tree_model_adapter_interface_init(gpointer g_iface, gpointer iface_data);
+static void gnc_sx_list_tree_model_adapter_init(GTypeInstance *instance, gpointer klass);
+GncSxListTreeModelAdapter* gnc_sx_list_tree_model_adapter_new(GncSxInstanceModel *instances);
+
+GncSxInstances* gnc_sx_list_tree_model_adapter_get_sx_instances(GncSxListTreeModelAdapter *model, GtkTreeIter *iter);
+
+#define GNC_TYPE_SX_LIST_TREE_MODEL_ADAPTER (gnc_sx_list_tree_model_adapter_get_type ())
+#define GNC_SX_LIST_TREE_MODEL_ADAPTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_SX_LIST_TREE_MODEL_ADAPTER, GncSxListTreeModelAdapter))
+#define GNC_SX_LIST_TREE_MODEL_ADAPTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_SX_LIST_TREE_MODEL_ADAPTER, GncSxListTreeModelAdapterClass))
+#define GNC_IS_SX_LIST_TREE_MODEL_ADAPTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_SX_LIST_TREE_MODEL_ADAPTER))
+#define GNC_IS_SX_LIST_TREE_MODEL_ADAPTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_SX_LIST_TREE_MODEL_ADAPTER))
+#define GNC_SX_LIST_TREE_MODEL_ADAPTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_SX_LIST_TREE_MODEL_ADAPTER, GncSxListTreeModelAdapterClass))
+
+/* ------------------------------------------------------------ */
+
+typedef gpointer (*GMapFunc)(gpointer data, gpointer user_data);
+static GList*
+g_list_map(GList* list, GMapFunc fn, gpointer user_data)
+{
+ GList *rtn = NULL;
+ for (; list != NULL; list = list->next)
+ {
+ rtn = g_list_append(rtn, (*fn)(list->data, user_data));
+ }
+ return rtn;
+}
+
+/************************************************************
+ * Prototypes *
+ ************************************************************/
+/* Plugin Actions */
+static void gnc_plugin_page_sx_list_class_init (GncPluginPageSxListClass *klass);
+static void gnc_plugin_page_sx_list_init (GncPluginPageSxList *plugin_page);
+static void gnc_plugin_page_sx_list_finalize (GObject *object);
+
+static GtkWidget *gnc_plugin_page_sx_list_create_widget (GncPluginPage *plugin_page);
+static void gnc_plugin_page_sx_list_destroy_widget (GncPluginPage *plugin_page);
+static void gnc_plugin_page_sx_list_save_page (GncPluginPage *plugin_page, GKeyFile *file, const gchar *group);
+static GncPluginPage *gnc_plugin_page_sx_list_recreate_page (GtkWidget *window, GKeyFile *file, const gchar *group);
+
+static void gppsl_event_handler(QofEntity *ent, QofEventId event_type, gpointer user_data, gpointer evt_data);
+
+
+/* Callbacks */
+static void gnc_plugin_page_sx_list_cmd_new(GtkAction *action, GncPluginPageSxList *page);
+static void gnc_plugin_page_sx_list_cmd_edit(GtkAction *action, GncPluginPageSxList *page);
+static void gnc_plugin_page_sx_list_cmd_delete(GtkAction *action, GncPluginPageSxList *page);
+
+/* Command callbacks */
+
+static GtkActionEntry gnc_plugin_page_sx_list_actions [] = {
+ { "SxListAction", NULL, N_("Scheduled"), NULL, NULL, NULL },
+ { "SxListNewAction", GNC_STOCK_NEW_ACCOUNT, N_("New"), NULL,
+ N_("Create a new scheduled transaction"), G_CALLBACK(gnc_plugin_page_sx_list_cmd_new) },
+ { "SxListEditAction", GNC_STOCK_EDIT_ACCOUNT, N_("Edit"), NULL,
+ N_("Edit the selected scheduled transaction"), G_CALLBACK(gnc_plugin_page_sx_list_cmd_edit) },
+ { "SxListDeleteAction", GNC_STOCK_DELETE_ACCOUNT, N_("Delete"), NULL,
+ N_("Delete the selected scheduled transaction"), G_CALLBACK(gnc_plugin_page_sx_list_cmd_delete) },
+};
+/** The number of actions provided by this plugin. */
+static guint gnc_plugin_page_sx_list_n_actions = G_N_ELEMENTS (gnc_plugin_page_sx_list_actions);
+
+GType
+gnc_plugin_page_sx_list_get_type (void)
+{
+ static GType gnc_plugin_page_sx_list_type = 0;
+
+ if (gnc_plugin_page_sx_list_type == 0) {
+ static const GTypeInfo our_info = {
+ sizeof (GncPluginPageSxListClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) gnc_plugin_page_sx_list_class_init,
+ NULL,
+ NULL,
+ sizeof (GncPluginPageSxList),
+ 0,
+ (GInstanceInitFunc) gnc_plugin_page_sx_list_init
+ };
+
+ gnc_plugin_page_sx_list_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
+ GNC_PLUGIN_PAGE_SX_LIST_NAME,
+ &our_info, 0);
+ }
+
+ return gnc_plugin_page_sx_list_type;
+}
+
+GncPluginPage *
+gnc_plugin_page_sx_list_new (void)
+{
+ GncPluginPageSxList *plugin_page;
+ plugin_page = g_object_new(GNC_TYPE_PLUGIN_PAGE_SX_LIST, NULL);
+ return GNC_PLUGIN_PAGE(plugin_page);
+}
+
+static void
+gnc_plugin_page_sx_list_class_init (GncPluginPageSxListClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
+ GncPluginPageClass *gnc_plugin_class = GNC_PLUGIN_PAGE_CLASS(klass);
+
+ parent_class = g_type_class_peek_parent(klass);
+
+ object_class->finalize = gnc_plugin_page_sx_list_finalize;
+
+ gnc_plugin_class->tab_icon = GNC_STOCK_ACCOUNT;
+ gnc_plugin_class->plugin_name = GNC_PLUGIN_PAGE_SX_LIST_NAME;
+ gnc_plugin_class->create_widget = gnc_plugin_page_sx_list_create_widget;
+ gnc_plugin_class->destroy_widget = gnc_plugin_page_sx_list_destroy_widget;
+ gnc_plugin_class->save_page = gnc_plugin_page_sx_list_save_page;
+ gnc_plugin_class->recreate_page = gnc_plugin_page_sx_list_recreate_page;
+
+ g_type_class_add_private(klass, sizeof(GncPluginPageSxListPrivate));
+}
+
+static void
+gnc_plugin_page_sx_list_init (GncPluginPageSxList *plugin_page)
+{
+ GtkActionGroup *action_group;
+ GncPluginPageSxListPrivate *priv;
+ GncPluginPage *parent;
+
+ ENTER("page %p", plugin_page);
+ priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(plugin_page);
+
+ /* Init parent declared variables */
+ parent = GNC_PLUGIN_PAGE(plugin_page);
+ g_object_set(G_OBJECT(plugin_page),
+ "page-name", _("Scheduled Transactions"),
+ "page-uri", "default:",
+ "ui-description", "gnc-plugin-page-sx-list-ui.xml",
+ NULL);
+
+ /* change me when the system supports multiple books */
+ gnc_plugin_page_add_book(parent, gnc_get_current_book());
+
+ /* Create menu and toolbar information */
+ action_group =
+ gnc_plugin_page_create_action_group(parent,
+ "GncPluginPageSxListActions");
+ gtk_action_group_add_actions(action_group,
+ gnc_plugin_page_sx_list_actions,
+ gnc_plugin_page_sx_list_n_actions,
+ plugin_page);
+ //gnc_plugin_init_short_names (action_group, toolbar_labels);
+
+ LEAVE("page %p, priv %p, action group %p",
+ plugin_page, priv, action_group);
+}
+
+static void
+gnc_plugin_page_sx_list_finalize (GObject *object)
+{
+ GncPluginPageSxList *page;
+ GncPluginPageSxListPrivate *priv;
+
+ ENTER("object %p", object);
+ page = GNC_PLUGIN_PAGE_SX_LIST (object);
+ g_return_if_fail (GNC_IS_PLUGIN_PAGE_SX_LIST (page));
+ priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
+ g_return_if_fail (priv != NULL);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+ LEAVE(" ");
+}
+
+/* Virtual Functions */
+static void
+gnc_plugin_page_sx_list_refresh_cb (GHashTable *changes, gpointer user_data)
+{
+ GncPluginPageSxList *page = user_data;
+ GncPluginPageSxListPrivate *priv;
+
+ g_return_if_fail(GNC_IS_PLUGIN_PAGE_SX_LIST(page));
+
+ /* We're only looking for forced updates here. */
+ if (changes)
+ return;
+
+ priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
+ gtk_widget_queue_draw(priv->widget);
+}
+
+static void
+gnc_plugin_page_sx_list_close_cb (gpointer user_data)
+{
+ GncPluginPage *plugin_page;
+ GncPluginPageSxList *page;
+
+ plugin_page = GNC_PLUGIN_PAGE(user_data);
+ page = GNC_PLUGIN_PAGE_SX_LIST (plugin_page);
+ gnc_main_window_close_page(plugin_page);
+}
+
+static void
+gppsl_selection_changed_cb(GtkTreeSelection *selection, gpointer user_data)
+{
+ GncPluginPage *page;
+ GtkAction *edit_action, *delete_action;
+ gboolean selection_state = TRUE;
+
+ printf("selection changed\n");
+ page = GNC_PLUGIN_PAGE(user_data);
+ edit_action = gnc_plugin_page_get_action(page, "SxListEditAction");
+ delete_action = gnc_plugin_page_get_action(page, "SxListDeleteAction");
+ selection_state
+ = gtk_tree_selection_count_selected_rows(selection) == 0
+ ? FALSE
+ : TRUE;
+ gtk_action_set_sensitive(edit_action, selection_state);
+ gtk_action_set_sensitive(delete_action, selection_state);
+}
+
+static GtkWidget *
+gnc_plugin_page_sx_list_create_widget (GncPluginPage *plugin_page)
+{
+ GncPluginPageSxList *page;
+ GncPluginPageSxListPrivate *priv;
+
+ ENTER("page %p", plugin_page);
+ page = GNC_PLUGIN_PAGE_SX_LIST(plugin_page);
+ priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
+ if (priv->widget != NULL) {
+ LEAVE("widget = %p", priv->widget);
+ return priv->widget;
+ }
+
+ priv->gxml = gnc_glade_xml_new("sched-xact.glade", "sx-list-vbox");
+ priv->widget = glade_xml_get_widget(priv->gxml, "sx-list-vbox");
+
+ {
+ GDate end;
+ g_date_clear(&end, 1);
+ g_date_set_time_t(&end, time(NULL));
+ g_date_add_years(&end, 1);
+ priv->instances = GNC_SX_INSTANCE_MODEL(gnc_sx_get_instances(&end));
+ }
+
+ {
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ GtkTreeSelection *selection;
+
+ priv->tree_model = gnc_sx_list_tree_model_adapter_new(priv->instances);
+ priv->tree_view = GTK_TREE_VIEW(glade_xml_get_widget(priv->gxml, "sx_list"));
+ gtk_tree_view_set_model(priv->tree_view, GTK_TREE_MODEL(priv->tree_model));
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("Name", renderer, "text", 0, NULL);
+ gtk_tree_view_append_column(priv->tree_view, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("Frequency", renderer, "text", 1, NULL);
+ gtk_tree_view_append_column(priv->tree_view, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("Last Occur", renderer, "text", 2, NULL);
+ gtk_tree_view_append_column(priv->tree_view, column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("Next Occur", renderer, "text", 3, NULL);
+ gtk_tree_view_append_column(priv->tree_view, column);
+
+ selection = gtk_tree_view_get_selection(priv->tree_view);
+ gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
+ g_signal_connect(G_OBJECT(selection), "changed", (GCallback)gppsl_selection_changed_cb, (gpointer)page);
+
+ //g_signal_connect(G_OBJECT(tree_view), "row-activated", (GCallback)gppsl_row_activate_cb, (gpointer)page);
+ }
+
+ {
+ GtkWidget *w;
+ w = glade_xml_get_widget(priv->gxml, "upcoming_cal_hbox");
+ priv->gdcal = GNC_DENSE_CAL(gnc_dense_cal_new());
+ gnc_dense_cal_set_months_per_col(priv->gdcal, 4);
+ gnc_dense_cal_set_num_months(priv->gdcal, 12);
+ gtk_container_add(GTK_CONTAINER(w), GTK_WIDGET(priv->gdcal));
+ gtk_widget_show_all(w);
+ }
+
+ priv->gppsl_event_handler_id = qof_event_register_handler(gppsl_event_handler, page);
+ gnc_register_gui_component("plugin-page-sx-list",
+ gnc_plugin_page_sx_list_refresh_cb,
+ gnc_plugin_page_sx_list_close_cb,
+ page);
+
+ // @@fixme
+ //gnc_restore_window_size(SX_LIST_GCONF_SECTION, GTK_WINDOW(priv->widget));
+
+ return priv->widget;
+}
+
+static void
+gnc_plugin_page_sx_list_destroy_widget (GncPluginPage *plugin_page)
+{
+ GncPluginPageSxList *page;
+ GncPluginPageSxListPrivate *priv;
+
+ ENTER("page %p", plugin_page);
+ page = GNC_PLUGIN_PAGE_SX_LIST (plugin_page);
+ priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
+
+ if (priv->widget) {
+ g_object_unref(G_OBJECT(priv->widget));
+ priv->widget = NULL;
+ }
+
+ if (priv->gnc_component_id) {
+ gnc_unregister_gui_component(priv->gnc_component_id);
+ priv->gnc_component_id = 0;
+ }
+
+ LEAVE("widget destroyed");
+}
+
+static void
+gppsl_event_handler(QofEntity *ent, QofEventId event_type, gpointer user_data, gpointer evt_data)
+{
+ // if (type != SX)
+ // return;
+ // - correlate SX to tree_store data
+ // - update || add || remove
+ return;
+}
+
+/**
+ * Save enough information about this page that it can be recreated next time
+ * the user starts gnucash.
+ * @param page The page to save.
+ * @param key_file A pointer to the GKeyFile data structure where the
+ * page information should be written.
+ * @param group_name The group name to use when saving data.
+ **/
+static void
+gnc_plugin_page_sx_list_save_page (GncPluginPage *plugin_page,
+ GKeyFile *key_file,
+ const gchar *group_name)
+{
+ GncPluginPageSxList *page;
+ GncPluginPageSxListPrivate *priv;
+
+ g_return_if_fail(GNC_IS_PLUGIN_PAGE_SX_LIST(plugin_page));
+ g_return_if_fail(key_file != NULL);
+ g_return_if_fail(group_name != NULL);
+
+ ENTER("page %p, key_file %p, group_name %s", plugin_page, key_file,
+ group_name);
+
+ page = GNC_PLUGIN_PAGE_SX_LIST(plugin_page);
+ priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
+
+#if 0
+ gnc_tree_view_account_save(GNC_TREE_VIEW_ACCOUNT(priv->tree_view),
+ &priv->fd, key_file, group_name);
+#endif // 0
+ LEAVE(" ");
+}
+
+
+
+/**
+ * Create a new sx list page based on the information saved during a previous
+ * instantiation of gnucash.
+ * @param window The window where this page should be installed.
+ * @param key_file A pointer to the GKeyFile data structure where the
+ * page information should be read.
+ * @param group_name The group name to use when restoring data.
+ **/
+static GncPluginPage *
+gnc_plugin_page_sx_list_recreate_page (GtkWidget *window,
+ GKeyFile *key_file,
+ const gchar *group_name)
+{
+ GncPluginPageSxList *page;
+ GncPluginPageSxListPrivate *priv;
+
+ g_return_val_if_fail(key_file, NULL);
+ g_return_val_if_fail(group_name, NULL);
+ ENTER("key_file %p, group_name %s", key_file, group_name);
+
+ /* Create the new page. */
+ page = GNC_PLUGIN_PAGE_SX_LIST(gnc_plugin_page_sx_list_new());
+ priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
+
+ /* Install it now so we can them manipulate the created widget */
+ gnc_main_window_open_page(GNC_MAIN_WINDOW(window), GNC_PLUGIN_PAGE(page));
+
+#if 0
+ gnc_tree_view_account_restore(GNC_TREE_VIEW_ACCOUNT(priv->tree_view),
+ &priv->fd, key_file, group_name);
+#endif // 0
+ LEAVE(" ");
+ return GNC_PLUGIN_PAGE(page);
+}
+
+
+/* Callbacks */
+
+static void
+gnc_plugin_page_sx_list_cmd_new(GtkAction *action, GncPluginPageSxList *page)
+{
+ printf("new\n");
+}
+
+static void
+gnc_plugin_page_sx_list_cmd_edit(GtkAction *action, GncPluginPageSxList *page)
+{
+ printf("edit\n");
+}
+
+static SchedXaction*
+_sx_for_iter(gpointer data, gpointer user_data)
+{
+ GtkTreeIter iter;
+ GncSxListTreeModelAdapter *model = GNC_SX_LIST_TREE_MODEL_ADAPTER(user_data);
+ gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, (GtkTreePath*)data);
+ return gnc_sx_list_tree_model_adapter_get_sx_instances(model, &iter)->sx;
+}
+
+static void
+_destroy_sx(gpointer data, gpointer user_data)
+{
+ SchedXaction *sx = (SchedXaction*)data;
+ GNCBook *book;
+ GList *book_sxes;
+ book = gnc_get_current_book();
+ book_sxes = gnc_book_get_schedxactions(book);
+ book_sxes = g_list_remove(book_sxes, sx);
+ gnc_book_set_schedxactions(book, book_sxes);
+ xaccSchedXactionFree(sx);
+}
+
+static void
+gnc_plugin_page_sx_list_cmd_delete(GtkAction *action, GncPluginPageSxList *page)
+{
+ GncPluginPageSxListPrivate *priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
+ GtkTreeSelection *selection;
+ GList *selected_paths, *to_delete = NULL;
+ GtkTreeModel *model;
+
+ selection = gtk_tree_view_get_selection(priv->tree_view);
+ selected_paths = gtk_tree_selection_get_selected_rows(selection, &model);
+ if (g_list_length(selected_paths) == 0)
+ {
+ PERR("no selection for delete.");
+ return;
+ }
+
+ to_delete = g_list_map(selected_paths, (GMapFunc)_sx_for_iter, model);
+ {
+ GList *list;
+ for (list = to_delete; list != NULL; list = list->next)
+ {
+ DEBUG("to-delete [%s]\n", xaccSchedXactionGetName((SchedXaction*)list->data));
+ }
+ }
+ g_list_foreach(to_delete, (GFunc)_destroy_sx, NULL);
+ g_list_free(to_delete);
+ g_list_foreach(selected_paths, (GFunc)gtk_tree_path_free, NULL);
+ g_list_free(selected_paths);
+ }
+
+/* ------------------------------------------------------------ */
+
+static GncSxInstances*
+_gnc_sx_gen_instances(gpointer *data, gpointer user_data)
+{
+ GncSxInstances *instances = g_new0(GncSxInstances, 1);
+ SchedXaction *sx = (SchedXaction*)data;
+ GDate *range_end = (GDate*)user_data;
+ GDate creation_end, remind_end;
+ GDate cur_date;
+ void *sequence_ctx;
+
+ instances->sx = sx;
+
+ creation_end = *range_end;
+ g_date_add_days(&creation_end, xaccSchedXactionGetAdvanceCreation(sx));
+ remind_end = creation_end;
+ g_date_add_days(&remind_end, xaccSchedXactionGetAdvanceReminder(sx));
+
+ // postponed
+ {
+ // defer list.
+ }
+
+ // to-create
+ g_date_clear(&cur_date, 1);
+ sequence_ctx = gnc_sx_create_temporal_state(sx);
+ cur_date = xaccSchedXactionGetInstanceAfter(sx, &cur_date, sequence_ctx);
+ instances->next_instance_date = cur_date;
+
+ while (g_date_valid(&cur_date)
+ && (g_date_compare(&cur_date, &creation_end) <= 0))
+ {
+ GncSxInstance *inst;
+ char str[64];
+ g_date_strftime(str, 64, "%c", &cur_date);
+
+ inst = g_new0(GncSxInstance, 1);
+ inst->parent = instances;
+ inst->type = TO_CREATE;
+ g_date_clear(&inst->date, 1);
+ inst->date = cur_date;
+ instances->upcoming = g_list_append(instances->upcoming, inst);
+
+ gnc_sx_incr_temporal_state(sx, sequence_ctx);
+ cur_date = xaccSchedXactionGetInstanceAfter(sx, &cur_date, sequence_ctx);
+ }
+
+ // reminders
+ while (g_date_valid(&cur_date) && g_date_compare(&cur_date, &remind_end) <= 0)
+ {
+ GncSxInstance *inst;
+ char str[64];
+ g_date_strftime(str, 64, "%c", &cur_date);
+
+ inst = g_new0(GncSxInstance, 1);
+ inst->parent = instances;
+ inst->type = REMINDER;
+ g_date_clear(&inst->date, 1);
+ inst->date = cur_date;
+ instances->upcoming = g_list_append(instances->upcoming, inst);
+
+ gnc_sx_incr_temporal_state(sx, sequence_ctx);
+ cur_date = xaccSchedXactionGetInstanceAfter(sx, &cur_date, sequence_ctx);
+ }
+
+ return instances;
+}
+
+GncSxInstanceModel*
+gnc_sx_get_instances(GDate *range_end)
+{
+ GncSxInstanceModel *instances;
+ GList *sxes;
+
+ g_assert(range_end != NULL);
+ g_assert(g_date_valid(range_end));
+
+ instances = gnc_sx_instance_model_new();
+ instances->range_end = *range_end;
+ sxes = gnc_book_get_schedxactions(gnc_get_current_book());
+ instances->sx_instance_list = g_list_map(sxes, (GMapFunc)_gnc_sx_gen_instances, (gpointer)range_end);
+
+ return instances;
+}
+
+GncSxInstanceModel*
+gnc_sx_instance_model_new(void)
+{
+ return GNC_SX_INSTANCE_MODEL(g_object_new(GNC_TYPE_SX_INSTANCE_MODEL, NULL));
+}
+
+GType
+gnc_sx_instance_model_get_type(void)
+{
+ static GType type = 0;
+ if (type == 0) {
+ static const GTypeInfo info = {
+ sizeof (GncSxInstanceModelClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc)gnc_sx_instance_model_class_init, /* class_init */
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (GncSxInstanceModel),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc)gnc_sx_instance_model_init /* instance_init */
+ };
+ type = g_type_register_static (G_TYPE_OBJECT,
+ "GncSxInstanceModelType",
+ &info, 0);
+ }
+ return type;
+}
+
+static void
+gnc_sx_instance_model_dispose (GObject *object)
+{
+ printf("dispose\n");
+}
+
+static void
+gnc_sx_instance_model_finalize (GObject *object)
+{
+ printf("finalize\n");
+}
+
+static void
+gnc_sx_instance_model_class_init (GncSxInstanceModelClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
+ object_class->dispose = gnc_sx_instance_model_dispose;
+ object_class->finalize = gnc_sx_instance_model_finalize;
+
+ klass->updated_signal_id =
+ g_signal_new("updated",
+ GNC_TYPE_SX_INSTANCE_MODEL,
+ G_SIGNAL_RUN_FIRST,
+ 0, // class offset
+ NULL, // accumulator
+ NULL, // accum data
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0, NULL);
+}
+
+static void
+gnc_sx_instance_model_init(GTypeInstance *instance, gpointer klass)
+{
+ GncSxInstanceModel *inst = (GncSxInstanceModel*)instance;
+
+ g_date_clear(&inst->range_end, 1);
+ inst->sx_instance_list = NULL;
+ inst->qof_event_handler_id = qof_event_register_handler(_gnc_sx_instance_event_handler, inst);
+}
+
+static void
+_gnc_sx_instance_event_handler(QofEntity *ent, QofEventId event_type, gpointer user_data, gpointer evt_data)
+{
+ GncSxInstanceModel *instances = GNC_SX_INSTANCE_MODEL(user_data);
+ SchedXaction *sx;
+
+ if (!GNC_IS_SX(ent))
+ return;
+ sx = GNC_SX(ent);
+
+ if (event_type & QOF_EVENT_DESTROY)
+ {
+ gpointer sx_instance_to_remove = NULL;
+ GList *list;
+ // find, remove, update
+ for (list = instances->sx_instance_list; list != NULL; list = list->next)
+ {
+ if (sx == ((GncSxInstances*)list->data)->sx)
+ {
+ sx_instance_to_remove = list->data;
+ break;
+ }
+ }
+ if (sx_instance_to_remove != NULL)
+ {
+ instances->sx_instance_list = g_list_remove(instances->sx_instance_list, sx_instance_to_remove);
+ g_signal_emit_by_name(instances, "updated");
+ }
+ else { printf("err\n"); }
+ }
+ else if (event_type & QOF_EVENT_CREATE)
+ {
+ // add, update
+ g_signal_emit_by_name(instances, "updated");
+ }
+ else { printf("unknown\n"); }
+ /* else { unsupported event type; ignore } */
+
+ instances = 0;
+}
+
+
+/* ------------------------------------------------------------ */
+
+GType
+gnc_sx_list_tree_model_adapter_get_type(void)
+{
+ static GType type = 0;
+ if (type == 0) {
+ static const GTypeInfo info = {
+ sizeof (GncSxListTreeModelAdapterClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc)gnc_sx_list_tree_model_adapter_class_init, /* class_init */
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (GncSxListTreeModelAdapter),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc)gnc_sx_list_tree_model_adapter_init /* instance_init */
+ };
+ static const GInterfaceInfo itreeModel_info = {
+ (GInterfaceInitFunc) gnc_sx_list_tree_model_adapter_interface_init, /* interface_init */
+ NULL, /* interface_finalize */
+ NULL /* interface_data */
+ };
+
+ type = g_type_register_static (G_TYPE_OBJECT,
+ "GncSxListTreeModelAdapterType",
+ &info, 0);
+ g_type_add_interface_static(type,
+ GTK_TYPE_TREE_MODEL,
+ &itreeModel_info);
+ }
+ return type;
+}
+
+static void
+gnc_sx_list_tree_model_adapter_class_init(GncSxListTreeModelAdapterClass *klass)
+{
+ ; // nop
+}
+
+static GtkTreeModelFlags
+gsltma_get_flags(GtkTreeModel *tree_model)
+{
+ return gtk_tree_model_get_flags(GTK_TREE_MODEL(GNC_SX_LIST_TREE_MODEL_ADAPTER(tree_model)->real));
+}
+
+static gint
+gsltma_get_n_columns(GtkTreeModel *tree_model)
+{
+ return gtk_tree_model_get_n_columns(GTK_TREE_MODEL(GNC_SX_LIST_TREE_MODEL_ADAPTER(tree_model)->real));
+}
+
+static GType
+gsltma_get_column_type(GtkTreeModel *tree_model, gint index)
+{
+ return gtk_tree_model_get_column_type(GTK_TREE_MODEL(GNC_SX_LIST_TREE_MODEL_ADAPTER(tree_model)->real), index);
+}
+
+static gboolean
+gsltma_get_iter(GtkTreeModel *tree_model,
+ GtkTreeIter *iter,
+ GtkTreePath *path)
+{
+ return gtk_tree_model_get_iter(GTK_TREE_MODEL(GNC_SX_LIST_TREE_MODEL_ADAPTER(tree_model)->real), iter, path);
+}
+
+static GtkTreePath*
+gsltma_get_path(GtkTreeModel *tree_model,
+ GtkTreeIter *iter)
+{
+ return gtk_tree_model_get_path(GTK_TREE_MODEL(GNC_SX_LIST_TREE_MODEL_ADAPTER(tree_model)->real), iter);
+}
+
+static void
+gsltma_get_value(GtkTreeModel *tree_model,
+ GtkTreeIter *iter,
+ gint column,
+ GValue *value)
+{
+ gtk_tree_model_get_value(GTK_TREE_MODEL(GNC_SX_LIST_TREE_MODEL_ADAPTER(tree_model)->real), iter, column, value);
+}
+
+static gboolean
+gsltma_iter_next(GtkTreeModel *tree_model,
+ GtkTreeIter *iter)
+{
+ return gtk_tree_model_iter_next(GTK_TREE_MODEL(GNC_SX_LIST_TREE_MODEL_ADAPTER(tree_model)->real), iter);
+}
+
+static gboolean
+gsltma_iter_children(GtkTreeModel *tree_model,
+ GtkTreeIter *iter,
+ GtkTreeIter *parent)
+{
+ return gtk_tree_model_iter_children(GTK_TREE_MODEL(GNC_SX_LIST_TREE_MODEL_ADAPTER(tree_model)->real), iter, parent);
+}
+
+static gboolean
+gsltma_iter_has_child(GtkTreeModel *tree_model,
+ GtkTreeIter *iter)
+{
+ return gtk_tree_model_iter_has_child(GTK_TREE_MODEL(GNC_SX_LIST_TREE_MODEL_ADAPTER(tree_model)->real), iter);
+}
+
+static gint
+gsltma_iter_n_children(GtkTreeModel *tree_model,
+ GtkTreeIter *iter)
+{
+ return gtk_tree_model_iter_n_children(GTK_TREE_MODEL(GNC_SX_LIST_TREE_MODEL_ADAPTER(tree_model)->real), iter);
+}
+
+static gboolean
+gsltma_iter_nth_child(GtkTreeModel *tree_model,
+ GtkTreeIter *iter,
+ GtkTreeIter *parent,
+ gint n)
+{
+ return gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(GNC_SX_LIST_TREE_MODEL_ADAPTER(tree_model)->real), iter, parent, n);
+}
+
+static gboolean
+gsltma_iter_parent(GtkTreeModel *tree_model,
+ GtkTreeIter *iter,
+ GtkTreeIter *child)
+{
+ return gtk_tree_model_iter_parent(GTK_TREE_MODEL(GNC_SX_LIST_TREE_MODEL_ADAPTER(tree_model)->real), iter, child);
+}
+
+static void
+gsltma_ref_node(GtkTreeModel *tree_model,
+ GtkTreeIter *iter)
+{
+ gtk_tree_model_ref_node(GTK_TREE_MODEL(GNC_SX_LIST_TREE_MODEL_ADAPTER(tree_model)->real), iter);
+}
+
+static void
+gsltma_unref_node(GtkTreeModel *tree_model,
+ GtkTreeIter *iter)
+{
+ gtk_tree_model_unref_node(GTK_TREE_MODEL(GNC_SX_LIST_TREE_MODEL_ADAPTER(tree_model)->real), iter);
+}
+
+static void
+gnc_sx_list_tree_model_adapter_interface_init(gpointer g_iface, gpointer iface_data)
+{
+ GtkTreeModelIface *tree_model = (GtkTreeModelIface*)g_iface;
+ tree_model->get_flags = gsltma_get_flags;
+ tree_model->get_n_columns = gsltma_get_n_columns;
+ tree_model->get_column_type = gsltma_get_column_type;
+ tree_model->get_iter = gsltma_get_iter;
+ tree_model->get_path = gsltma_get_path;
+ tree_model->get_value = gsltma_get_value;
+ tree_model->iter_next = gsltma_iter_next;
+ tree_model->iter_children = gsltma_iter_children;
+ tree_model->iter_has_child = gsltma_iter_has_child;
+ tree_model->iter_n_children = gsltma_iter_n_children;
+ tree_model->iter_nth_child = gsltma_iter_nth_child;
+ tree_model->iter_parent = gsltma_iter_parent;
+ tree_model->ref_node = gsltma_ref_node;
+ tree_model->unref_node = gsltma_unref_node;
+}
+
+static void
+gsltma_proxy_row_changed(GtkTreeModel *treemodel,
+ GtkTreePath *arg1,
+ GtkTreeIter *arg2,
+ gpointer user_data)
+{
+ g_signal_emit_by_name(user_data, "row-changed", arg1, arg2);
+}
+
+static void
+gsltma_proxy_row_deleted(GtkTreeModel *treemodel,
+ GtkTreePath *arg1,
+ gpointer user_data)
+{
+ g_signal_emit_by_name(user_data, "row-deleted", arg1);
+}
+
+
+static void
+gsltma_proxy_row_has_child_toggled(GtkTreeModel *treemodel,
+ GtkTreePath *arg1,
+ GtkTreeIter *arg2,
+ gpointer user_data)
+{
+ g_signal_emit_by_name(user_data, "row-has-child-toggled", arg1, arg2);
+}
+
+
+static void
+gsltma_proxy_row_inserted(GtkTreeModel *treemodel,
+ GtkTreePath *arg1,
+ GtkTreeIter *arg2,
+ gpointer user_data)
+{
+ g_signal_emit_by_name(user_data, "row-inserted", arg1, arg2);
+}
+
+
+static void
+gsltma_proxy_rows_reordered(GtkTreeModel *treemodel,
+ GtkTreePath *arg1,
+ GtkTreeIter *arg2,
+ gpointer arg3,
+ gpointer user_data)
+{
+ g_signal_emit_by_name(user_data, "rows-reordered", arg1, arg2, arg3);
+}
+
+static void
+gnc_sx_list_tree_model_adapter_init(GTypeInstance *instance, gpointer klass)
+{
+ GncSxListTreeModelAdapter *adapter = GNC_SX_LIST_TREE_MODEL_ADAPTER(instance);
+ adapter->real = gtk_tree_store_new(4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+
+ g_signal_connect(adapter->real, "row-changed", G_CALLBACK(gsltma_proxy_row_changed), adapter);
+ g_signal_connect(adapter->real, "row-deleted", G_CALLBACK(gsltma_proxy_row_deleted), adapter);
+ g_signal_connect(adapter->real, "row-has-child-toggled", G_CALLBACK(gsltma_proxy_row_has_child_toggled), adapter);
+ g_signal_connect(adapter->real, "row-inserted", G_CALLBACK(gsltma_proxy_row_inserted), adapter);
+ g_signal_connect(adapter->real, "rows-reordered", G_CALLBACK(gsltma_proxy_rows_reordered), adapter);
+}
+
+static void
+gsltma_populate(GncSxListTreeModelAdapter *model)
+{
+ GtkTreeIter iter;
+ GList *list;
+
+ for (list = model->instances->sx_instance_list; list != NULL; list = list->next)
+ {
+ GncSxInstances *instances = (GncSxInstances*)list->data;
+ FreqSpec *fs;
+ GString *frequency_str;
+ char last_occur_date_buf[MAX_DATE_LENGTH+1];
+ char next_occur_date_buf[MAX_DATE_LENGTH+1];
+
+
+ frequency_str = g_string_sized_new(32);
+ fs = xaccSchedXactionGetFreqSpec(instances->sx);
+ xaccFreqSpecGetFreqStr(fs, frequency_str);
+
+ {
+ GDate *last_occur = xaccSchedXactionGetLastOccurDate(instances->sx);
+ if (last_occur == NULL || !g_date_valid(last_occur))
+ {
+ g_stpcpy(last_occur_date_buf, "never");
+ }
+ else
+ {
+ qof_print_gdate(last_occur_date_buf,
+ MAX_DATE_LENGTH,
+ last_occur);
+ }
+ }
+
+ qof_print_gdate(next_occur_date_buf, MAX_DATE_LENGTH, &instances->next_instance_date);
+
+ gtk_tree_store_append(model->real, &iter, NULL);
+ gtk_tree_store_set(model->real, &iter,
+ 0, xaccSchedXactionGetName(instances->sx),
+ 1, frequency_str->str,
+ 2, last_occur_date_buf,
+ 3, next_occur_date_buf,
+ -1);
+ g_string_free(frequency_str, TRUE);
+ }
+}
+
+static void
+gsltma_updated_cb(GncSxInstanceModel *instances, gpointer user_data)
+{
+ GncSxListTreeModelAdapter *model = GNC_SX_LIST_TREE_MODEL_ADAPTER(user_data);
+ printf("update!\n");
+ gtk_tree_store_clear(model->real);
+ gsltma_populate(model);
+}
+
+GncSxListTreeModelAdapter*
+gnc_sx_list_tree_model_adapter_new(GncSxInstanceModel *instances)
+{
+ GncSxListTreeModelAdapter *rtn;
+
+ rtn = GNC_SX_LIST_TREE_MODEL_ADAPTER(g_object_new(GNC_TYPE_SX_LIST_TREE_MODEL_ADAPTER, NULL));
+ rtn->instances = instances;
+
+ // copy data over...
+ gsltma_populate(rtn);
+
+ g_signal_connect(G_OBJECT(rtn->instances), "updated", (GCallback)gsltma_updated_cb, (gpointer)rtn);
+
+ return rtn;
+}
+
+GncSxInstances*
+gnc_sx_list_tree_model_adapter_get_sx_instances(GncSxListTreeModelAdapter *model, GtkTreeIter *iter)
+{
+ GtkTreePath *path;
+ gint *indices;
+ gint index;
+
+ path = gtk_tree_model_get_path(GTK_TREE_MODEL(model), iter);
+ if (gtk_tree_path_get_depth(path) > 1)
+ {
+ gtk_tree_path_free(path);
+ return NULL;
+ }
+ indices = gtk_tree_path_get_indices(path);
+ index = indices[0];
+
+ gtk_tree_path_free(path);
+ return (GncSxInstances*)g_list_nth_data(model->instances->sx_instance_list, index);
+}
+
+/** @} */
+/** @} */
Added: gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-page-sx-list.h
===================================================================
--- gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-page-sx-list.h 2006-07-15 15:29:41 UTC (rev 14508)
+++ gnucash/branches/sx-cleanup/src/gnome/gnc-plugin-page-sx-list.h 2006-07-15 15:56:15 UTC (rev 14509)
@@ -0,0 +1,79 @@
+/*
+ * gnc-plugin-page-sx-list.h
+ *
+ * Copyright (C) 2006 Josh Sled <jsled at asynchronous.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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
+ * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
+ * Boston, MA 02110-1301, USA gnu at gnu.org
+ */
+
+/** @addtogroup ContentPlugins
+ @{ */
+/** @addtogroup GncPluginPageSxList An Plugin Page for the SX List.
+ @{ */
+/** @brief Functions providing a list of scheduled transactions as a plugin page.
+ @author Josh Sled <jsled at asynchronous.org>
+
+*/
+
+#ifndef __GNC_PLUGIN_PAGE_SX_LIST_H
+#define __GNC_PLUGIN_PAGE_SX_LIST_H
+
+#include <gtk/gtkwindow.h>
+#include "SchedXaction.h"
+#include "gnc-plugin-page.h"
+
+
+G_BEGIN_DECLS
+
+/* type macros */
+#define GNC_TYPE_PLUGIN_PAGE_SX_LIST (gnc_plugin_page_sx_list_get_type ())
+#define GNC_PLUGIN_PAGE_SX_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_PAGE_SX_LIST, GncPluginPageSxList))
+#define GNC_PLUGIN_PAGE_SX_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_PAGE_SX_LIST, GncPluginPageSxListClass))
+#define GNC_IS_PLUGIN_PAGE_SX_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_PAGE_SX_LIST))
+#define GNC_IS_PLUGIN_PAGE_SX_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_PAGE_SX_LIST))
+#define GNC_PLUGIN_PAGE_SX_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_PAGE_SX_LIST, GncPluginPageSxListClass))
+
+#define GNC_PLUGIN_PAGE_SX_LIST_NAME "GncPluginPageSxList"
+
+
+/* typedefs & structures */
+typedef struct {
+ GncPluginPage gnc_plugin_page;
+} GncPluginPageSxList;
+
+typedef struct {
+ GncPluginPageClass gnc_plugin_page;
+} GncPluginPageSxListClass;
+
+/* function prototypes */
+
+/**
+ * Retrieve the type number for an "sx list" plugin page.
+ * @return The type number.
+ */
+GType gnc_plugin_page_sx_list_get_type (void);
+
+/**
+ * @return The newly created plugin page.
+ **/
+GncPluginPage *gnc_plugin_page_sx_list_new (void);
+
+G_END_DECLS
+
+#endif /* __GNC_PLUGIN_PAGE_SX_LIST_H */
+/** @} */
+/** @} */
Modified: gnucash/branches/sx-cleanup/src/gnome/ui/Makefile.am
===================================================================
--- gnucash/branches/sx-cleanup/src/gnome/ui/Makefile.am 2006-07-15 15:29:41 UTC (rev 14508)
+++ gnucash/branches/sx-cleanup/src/gnome/ui/Makefile.am 2006-07-15 15:56:15 UTC (rev 14509)
@@ -8,6 +8,7 @@
gnc-plugin-file-history-ui.xml \
gnc-plugin-register-ui.xml \
gnc-plugin-page-register-ui.xml \
+ gnc-plugin-page-sx-list-ui.xml \
gnc-plugin-page-sxregister-ui.xml \
gnc-sxed-to-create-window-ui.xml \
gnc-reconcile-window-ui.xml \
Added: gnucash/branches/sx-cleanup/src/gnome/ui/gnc-plugin-page-sx-list-ui.xml
===================================================================
--- gnucash/branches/sx-cleanup/src/gnome/ui/gnc-plugin-page-sx-list-ui.xml 2006-07-15 15:29:41 UTC (rev 14508)
+++ gnucash/branches/sx-cleanup/src/gnome/ui/gnc-plugin-page-sx-list-ui.xml 2006-07-15 15:56:15 UTC (rev 14509)
@@ -0,0 +1,20 @@
+<ui>
+ <menubar>
+ <placeholder name="AdditionalMenusPlaceholder">
+ <menu action="SxListAction">
+ <menuitem name="SxListNew" action="SxListNewAction"/>
+ <menuitem name="SxListEdit" action="SxListEditAction"/>
+ <menuitem name="SxListDelete" action="SxListDeleteAction"/>
+ </menu>
+ </placeholder>
+ </menubar>
+
+ <toolbar name="DefaultToolbar">
+ <placeholder name="DefaultToolbarPlaceholder">
+ <separator name="ToolbarSep2" />
+ <toolitem name="SxListToolbarNew" action="SxListNewAction"/>
+ <toolitem name="SxListToolbarEdit" action="SxListEditAction"/>
+ <toolitem name="SxListToolbarDelete" action="SxListDeleteAction"/>
+ </placeholder>
+ </toolbar>
+</ui>
More information about the gnucash-changes
mailing list