mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Factor the sx-list tree view out and promote into an GncTreeViewSxList as a subclass of GncTreeView.
Move the gnc-sx-list-tree-model-adapter into gnome-utils to accomodate. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15642 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
2a4cea1b17
commit
aa6acf8b6c
@ -3,20 +3,6 @@
|
|||||||
Scheduled Transactions
|
Scheduled Transactions
|
||||||
===============================================================
|
===============================================================
|
||||||
|
|
||||||
Overview
|
|
||||||
--------------
|
|
||||||
|
|
||||||
- SX List
|
|
||||||
- CRUD operations on SXes
|
|
||||||
- Show Next "year"s worth of enabled and disabled SX instances
|
|
||||||
- gnc_sx_get_instances({now + 1yr}, TRUE)
|
|
||||||
|
|
||||||
- SX Editor
|
|
||||||
|
|
||||||
- SinceLastRun
|
|
||||||
- Last .. present (+ create-in-advance, reminder) enabled instances
|
|
||||||
- gnc_sx_get_instances(now, FALSE)
|
|
||||||
|
|
||||||
TODO
|
TODO
|
||||||
----------
|
----------
|
||||||
|
|
||||||
@ -78,10 +64,10 @@ TODO
|
|||||||
.. _[ve20070209]: http://lists.gnucash.org/pipermail/gnucash-devel/2007-February/019834.html
|
.. _[ve20070209]: http://lists.gnucash.org/pipermail/gnucash-devel/2007-February/019834.html
|
||||||
|
|
||||||
- sx list page
|
- sx list page
|
||||||
! - [ ] use gnc-tree-view?
|
|
||||||
- [/] make into split panel
|
- [/] make into split panel
|
||||||
- [ ] fix slider position
|
- [ ] fix slider position
|
||||||
- [ ] {0, 1, 2, 4, 8, 12} month selection for dense calendar
|
- [ ] {0, 1, 2, 4, 8, 12} month selection for dense calendar
|
||||||
|
! - [x] use gnc-tree-view
|
||||||
! - [x] save/restore state
|
! - [x] save/restore state
|
||||||
|
|
||||||
- sx editor
|
- sx editor
|
||||||
@ -132,6 +118,8 @@ TODO
|
|||||||
- [x] remove biweekly page (-> weekly)
|
- [x] remove biweekly page (-> weekly)
|
||||||
- [x] remove > monthly pages (-> monthly)
|
- [x] remove > monthly pages (-> monthly)
|
||||||
- [x] clean up, reformat source
|
- [x] clean up, reformat source
|
||||||
|
- gnc-plugin-page-sx-list
|
||||||
|
- [ ] gnc_plugin_page_sx_list_cmd_new
|
||||||
- dialog-sx-editor
|
- dialog-sx-editor
|
||||||
- [x] gnc_sxed_check_changed
|
- [x] gnc_sxed_check_changed
|
||||||
- [x] gnc_sxed_check_consistent
|
- [x] gnc_sxed_check_consistent
|
||||||
|
@ -77,6 +77,7 @@ libgncmod_gnome_utils_la_SOURCES = \
|
|||||||
gnc-query-list.c \
|
gnc-query-list.c \
|
||||||
gnc-splash.c \
|
gnc-splash.c \
|
||||||
gnc-sx-instance-dense-cal-adapter.c \
|
gnc-sx-instance-dense-cal-adapter.c \
|
||||||
|
gnc-sx-list-tree-model-adapter.c \
|
||||||
gnc-tree-model.c \
|
gnc-tree-model.c \
|
||||||
gnc-tree-model-account-types.c \
|
gnc-tree-model-account-types.c \
|
||||||
gnc-tree-model-account.c \
|
gnc-tree-model-account.c \
|
||||||
@ -86,6 +87,7 @@ libgncmod_gnome_utils_la_SOURCES = \
|
|||||||
gnc-tree-view-account.c \
|
gnc-tree-view-account.c \
|
||||||
gnc-tree-view-commodity.c \
|
gnc-tree-view-commodity.c \
|
||||||
gnc-tree-view-price.c \
|
gnc-tree-view-price.c \
|
||||||
|
gnc-tree-view-sx-list.c \
|
||||||
gnc-tree-view.c \
|
gnc-tree-view.c \
|
||||||
gnc-window.c \
|
gnc-window.c \
|
||||||
gncmod-gnome-utils.c \
|
gncmod-gnome-utils.c \
|
||||||
@ -145,6 +147,7 @@ gncinclude_HEADERS = \
|
|||||||
gnc-query-list.h \
|
gnc-query-list.h \
|
||||||
gnc-splash.h \
|
gnc-splash.h \
|
||||||
gnc-sx-instance-dense-cal-adapter.h \
|
gnc-sx-instance-dense-cal-adapter.h \
|
||||||
|
gnc-sx-list-tree-model-adapter.h \
|
||||||
gnc-tree-model.h \
|
gnc-tree-model.h \
|
||||||
gnc-tree-model-account-types.h \
|
gnc-tree-model-account-types.h \
|
||||||
gnc-tree-model-account.h \
|
gnc-tree-model-account.h \
|
||||||
@ -154,6 +157,7 @@ gncinclude_HEADERS = \
|
|||||||
gnc-tree-view-account.h \
|
gnc-tree-view-account.h \
|
||||||
gnc-tree-view-commodity.h \
|
gnc-tree-view-commodity.h \
|
||||||
gnc-tree-view-price.h \
|
gnc-tree-view-price.h \
|
||||||
|
gnc-tree-view-sx-list.h \
|
||||||
gnc-tree-view.h \
|
gnc-tree-view.h \
|
||||||
gnc-window.h \
|
gnc-window.h \
|
||||||
misc-gnome-utils.h \
|
misc-gnome-utils.h \
|
||||||
|
198
src/gnome-utils/gnc-tree-view-sx-list.c
Normal file
198
src/gnome-utils/gnc-tree-view-sx-list.c
Normal file
@ -0,0 +1,198 @@
|
|||||||
|
/**
|
||||||
|
* @brief GncTreeView implementation for Scheduled Transaction List.
|
||||||
|
* @author Copyright (C) 2007 Joshua Sled <jsled@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@gnu.org *
|
||||||
|
* *
|
||||||
|
*******************************************************************/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#include <glib/gi18n.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "gnc-tree-view.h"
|
||||||
|
#include "gnc-tree-view-sx-list.h"
|
||||||
|
#include "gnc-sx-list-tree-model-adapter.h"
|
||||||
|
#include "gnc-gconf-utils.h"
|
||||||
|
|
||||||
|
#define LOG_MOD "gnc.ui.tree-view.sx-list"
|
||||||
|
static QofLogModule log_module = LOG_MOD;
|
||||||
|
#undef G_LOG_DOMAIN
|
||||||
|
#define G_LOG_DOMAIN LOG_MOD
|
||||||
|
|
||||||
|
static void gnc_tree_view_sx_list_class_init(GncTreeViewSxListClass *klass);
|
||||||
|
static void gnc_tree_view_sx_list_init(GncTreeViewSxList *view);
|
||||||
|
static void gnc_tree_view_sx_list_dispose(GObject *object);
|
||||||
|
static void gnc_tree_view_sx_list_finalize(GObject *object);
|
||||||
|
|
||||||
|
typedef struct GncTreeViewSxListPrivate
|
||||||
|
{
|
||||||
|
GtkTreeModel *tree_model;
|
||||||
|
gboolean disposed;
|
||||||
|
} GncTreeViewSxListPrivate;
|
||||||
|
|
||||||
|
#define GNC_TREE_VIEW_SX_LIST_GET_PRIVATE(o) \
|
||||||
|
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_TREE_VIEW_SX_LIST, GncTreeViewSxListPrivate))
|
||||||
|
|
||||||
|
static GObjectClass *parent_class = NULL;
|
||||||
|
|
||||||
|
GType
|
||||||
|
gnc_tree_view_sx_list_get_type(void)
|
||||||
|
{
|
||||||
|
static GType gnc_tree_view_sx_list_type = 0;
|
||||||
|
|
||||||
|
if (gnc_tree_view_sx_list_type == 0)
|
||||||
|
{
|
||||||
|
static const GTypeInfo our_info = {
|
||||||
|
sizeof (GncTreeViewSxListClass),
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
(GClassInitFunc) gnc_tree_view_sx_list_class_init,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
sizeof (GncTreeViewSxList),
|
||||||
|
0,
|
||||||
|
(GInstanceInitFunc) gnc_tree_view_sx_list_init
|
||||||
|
};
|
||||||
|
|
||||||
|
gnc_tree_view_sx_list_type = g_type_register_static (GNC_TYPE_TREE_VIEW,
|
||||||
|
"GncTreeViewSxList",
|
||||||
|
&our_info, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return gnc_tree_view_sx_list_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_tree_view_sx_list_class_init(GncTreeViewSxListClass *klass)
|
||||||
|
{
|
||||||
|
GObjectClass *o_class;
|
||||||
|
|
||||||
|
parent_class = g_type_class_peek_parent (klass);
|
||||||
|
|
||||||
|
o_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
|
o_class->dispose = gnc_tree_view_sx_list_dispose;
|
||||||
|
o_class->finalize = gnc_tree_view_sx_list_finalize;
|
||||||
|
|
||||||
|
g_type_class_add_private(klass, sizeof(GncTreeViewSxListPrivate));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_tree_view_sx_list_init (GncTreeViewSxList *view)
|
||||||
|
{
|
||||||
|
; /* nop */
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_tree_view_sx_list_dispose(GObject *object)
|
||||||
|
{
|
||||||
|
GncTreeViewSxList *view;
|
||||||
|
GncTreeViewSxListPrivate *priv;
|
||||||
|
|
||||||
|
gnc_leave_return_if_fail (object != NULL);
|
||||||
|
gnc_leave_return_if_fail (GNC_IS_TREE_VIEW_SX_LIST (object));
|
||||||
|
|
||||||
|
view = GNC_TREE_VIEW_SX_LIST (object);
|
||||||
|
priv = GNC_TREE_VIEW_SX_LIST_GET_PRIVATE(view);
|
||||||
|
|
||||||
|
if (priv->disposed)
|
||||||
|
return;
|
||||||
|
priv->disposed = TRUE;
|
||||||
|
|
||||||
|
g_object_unref(G_OBJECT(priv->tree_model));
|
||||||
|
priv->tree_model = NULL;
|
||||||
|
|
||||||
|
if (G_OBJECT_CLASS (parent_class)->dispose)
|
||||||
|
(* G_OBJECT_CLASS (parent_class)->dispose) (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_tree_view_sx_list_finalize(GObject *object)
|
||||||
|
{
|
||||||
|
GncTreeViewSxList *view;
|
||||||
|
|
||||||
|
gnc_leave_return_if_fail(object != NULL);
|
||||||
|
gnc_leave_return_if_fail(GNC_IS_TREE_VIEW_SX_LIST (object));
|
||||||
|
|
||||||
|
view = GNC_TREE_VIEW_SX_LIST(object);
|
||||||
|
|
||||||
|
if (G_OBJECT_CLASS(parent_class)->finalize)
|
||||||
|
(* G_OBJECT_CLASS(parent_class)->finalize) (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkTreeView*
|
||||||
|
gnc_tree_view_sx_list_new(GncSxInstanceModel *sx_instances)
|
||||||
|
{
|
||||||
|
GncTreeView *view;
|
||||||
|
GtkTreeModel *model;
|
||||||
|
GtkTreeViewColumn *col;
|
||||||
|
GncTreeViewSxListPrivate *priv;
|
||||||
|
|
||||||
|
view = (GncTreeView*)g_object_new(GNC_TYPE_TREE_VIEW_SX_LIST, NULL);
|
||||||
|
g_object_set(view, "name", "sx_list_tree", NULL);
|
||||||
|
|
||||||
|
priv = GNC_TREE_VIEW_SX_LIST_GET_PRIVATE(view);
|
||||||
|
|
||||||
|
priv->tree_model = GTK_TREE_MODEL(gnc_sx_list_tree_model_adapter_new(sx_instances));
|
||||||
|
gnc_tree_view_set_model(view, GTK_TREE_MODEL(priv->tree_model));
|
||||||
|
|
||||||
|
col = gnc_tree_view_add_text_column(view, _("Name"), "name", NULL,
|
||||||
|
"Semi-Monthly Paycheck",
|
||||||
|
SXLTMA_COL_NAME, -1, NULL);
|
||||||
|
g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
|
||||||
|
|
||||||
|
col = gnc_tree_view_add_toggle_column(view, _("Enabled"),
|
||||||
|
Q_("Single-character short column-title form of 'Enabled'|E"),
|
||||||
|
"enabled", SXLTMA_COL_ENABLED,
|
||||||
|
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
|
||||||
|
NULL, NULL);
|
||||||
|
g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
|
||||||
|
|
||||||
|
col = gnc_tree_view_add_text_column(view, _("Frequency"), "frequency", NULL,
|
||||||
|
"Weekly (x3): -------",
|
||||||
|
SXLTMA_COL_FREQUENCY, -1, NULL);
|
||||||
|
g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
|
||||||
|
|
||||||
|
col = gnc_tree_view_add_text_column(view, _("Last Occur"), "last-occur", NULL,
|
||||||
|
"2007-01-02",
|
||||||
|
SXLTMA_COL_LAST_OCCUR, -1, NULL);
|
||||||
|
g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
|
||||||
|
|
||||||
|
col = gnc_tree_view_add_text_column(view, _("Next Occur"), "next-occur", NULL,
|
||||||
|
"2007-01-02",
|
||||||
|
SXLTMA_COL_NEXT_OCCUR, -1, NULL);
|
||||||
|
g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
|
||||||
|
|
||||||
|
gnc_tree_view_configure_columns(view);
|
||||||
|
|
||||||
|
gtk_widget_show(GTK_WIDGET(view));
|
||||||
|
return GTK_TREE_VIEW(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
SchedXaction*
|
||||||
|
gnc_tree_view_sx_list_get_sx_from_path(GncTreeViewSxList *view, GtkTreePath *path)
|
||||||
|
{
|
||||||
|
GtkTreeIter iter;
|
||||||
|
GncTreeViewSxListPrivate *priv = GNC_TREE_VIEW_SX_LIST_GET_PRIVATE(view);
|
||||||
|
gtk_tree_model_get_iter(GTK_TREE_MODEL(priv->tree_model), &iter, path);
|
||||||
|
return gnc_sx_list_tree_model_adapter_get_sx_instances(
|
||||||
|
GNC_SX_LIST_TREE_MODEL_ADAPTER(priv->tree_model), &iter)->sx;
|
||||||
|
}
|
66
src/gnome-utils/gnc-tree-view-sx-list.h
Normal file
66
src/gnome-utils/gnc-tree-view-sx-list.h
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/**
|
||||||
|
* @addtogroup GUI
|
||||||
|
* @{
|
||||||
|
* @file gnc-tree-view-sx-list.h
|
||||||
|
* @brief GncTreeView implementation for Scheduled Transaction List.
|
||||||
|
* @author Copyright (C) 2007 Joshua Sled <jsled@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@gnu.org *
|
||||||
|
* *
|
||||||
|
*******************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __GNC_TREE_VIEW_SX_LIST_H
|
||||||
|
#define __GNC_TREE_VIEW_SX_LIST_H
|
||||||
|
|
||||||
|
#include <gtk/gtktreemodel.h>
|
||||||
|
#include <gtk/gtktreeview.h>
|
||||||
|
#include "gnc-tree-view.h"
|
||||||
|
|
||||||
|
#include "SchedXaction.h"
|
||||||
|
#include "gnc-sx-instance-model.h"
|
||||||
|
#include "gnc-ui-util.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define GNC_TYPE_TREE_VIEW_SX_LIST (gnc_tree_view_sx_list_get_type ())
|
||||||
|
#define GNC_TREE_VIEW_SX_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_VIEW_SX_LIST, GncTreeViewSxList))
|
||||||
|
#define GNC_TREE_VIEW_SX_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_VIEW_SX_LIST, GncTreeViewSxListClass))
|
||||||
|
#define GNC_IS_TREE_VIEW_SX_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_VIEW_SX_LIST))
|
||||||
|
#define GNC_IS_TREE_VIEW_SX_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_VIEW_SX_LIST))
|
||||||
|
#define GNC_TREE_VIEW_SX_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_VIEW_SX_LIST, GncTreeViewSxListClass))
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
GncTreeView gnc_tree_view;
|
||||||
|
} GncTreeViewSxList;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
GncTreeViewClass gnc_tree_view;
|
||||||
|
} GncTreeViewSxListClass;
|
||||||
|
|
||||||
|
GType gnc_tree_view_sx_list_get_type(void);
|
||||||
|
|
||||||
|
GtkTreeView* gnc_tree_view_sx_list_new(GncSxInstanceModel *sx_instances);
|
||||||
|
|
||||||
|
SchedXaction* gnc_tree_view_sx_list_get_sx_from_path(GncTreeViewSxList *view, GtkTreePath *path);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __GNC_TREE_VIEW_SX_LIST_H */
|
@ -48,7 +48,6 @@ libgnc_gnome_la_SOURCES = \
|
|||||||
gnc-plugin-page-sx-list.c \
|
gnc-plugin-page-sx-list.c \
|
||||||
gnc-plugin-page-register.c \
|
gnc-plugin-page-register.c \
|
||||||
gnc-split-reg.c \
|
gnc-split-reg.c \
|
||||||
gnc-sx-list-tree-model-adapter.c \
|
|
||||||
lot-viewer.c \
|
lot-viewer.c \
|
||||||
reconcile-list.c \
|
reconcile-list.c \
|
||||||
top-level.c \
|
top-level.c \
|
||||||
@ -86,7 +85,6 @@ noinst_HEADERS = \
|
|||||||
gnc-plugin-page-sx-list.h \
|
gnc-plugin-page-sx-list.h \
|
||||||
gnc-plugin-page-register.h \
|
gnc-plugin-page-register.h \
|
||||||
gnc-split-reg.h \
|
gnc-split-reg.h \
|
||||||
gnc-sx-list-tree-model-adapter.h \
|
|
||||||
lot-viewer.h \
|
lot-viewer.h \
|
||||||
reconcile-list.h \
|
reconcile-list.h \
|
||||||
top-level.h \
|
top-level.h \
|
||||||
|
@ -5579,13 +5579,13 @@ Custom</property>
|
|||||||
<property name="right_padding">0</property>
|
<property name="right_padding">0</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox123">
|
<widget class="GtkHBox" id="hbox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="homogeneous">False</property>
|
<property name="homogeneous">False</property>
|
||||||
<property name="spacing">12</property>
|
<property name="spacing">12</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
<widget class="GtkScrolledWindow" id="sx-list-tree-view-container">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
@ -5593,14 +5593,7 @@ Custom</property>
|
|||||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkTreeView" id="sx_list">
|
<placeholder/>
|
||||||
<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>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include "gnc-glib-utils.h"
|
#include "gnc-glib-utils.h"
|
||||||
#include "gnc-icons.h"
|
#include "gnc-icons.h"
|
||||||
#include "gnc-plugin-page-sx-list.h"
|
#include "gnc-plugin-page-sx-list.h"
|
||||||
|
#include "gnc-tree-view-sx-list.h"
|
||||||
#include "gnc-sx-instance-model.h"
|
#include "gnc-sx-instance-model.h"
|
||||||
#include "gnc-sx-instance-dense-cal-adapter.h"
|
#include "gnc-sx-instance-dense-cal-adapter.h"
|
||||||
#include "gnc-sx-list-tree-model-adapter.h"
|
#include "gnc-sx-list-tree-model-adapter.h"
|
||||||
@ -57,10 +58,10 @@
|
|||||||
#include "dialog-sx-editor.h"
|
#include "dialog-sx-editor.h"
|
||||||
|
|
||||||
/* This static indicates the debugging module that this .o belongs to. */
|
/* This static indicates the debugging module that this .o belongs to. */
|
||||||
static QofLogModule log_module = "gnc.gui.plugin-page";
|
#define LOG_MOD "gnc.gui.plugin-page.sx-list"
|
||||||
|
static QofLogModule log_module = LOG_MOD
|
||||||
#undef G_LOG_DOMAIN
|
#undef G_LOG_DOMAIN
|
||||||
#define G_LOG_DOMAIN "gnc.gui.plugin-page.sx-list"
|
#define G_LOG_DOMAIN LOG_MOD
|
||||||
|
|
||||||
#define PLUGIN_PAGE_SX_LIST_CM_CLASS "plugin-page-sx-list"
|
#define PLUGIN_PAGE_SX_LIST_CM_CLASS "plugin-page-sx-list"
|
||||||
#define GCONF_SECTION "window/pages/sx_list"
|
#define GCONF_SECTION "window/pages/sx_list"
|
||||||
@ -77,7 +78,6 @@ typedef struct GncPluginPageSxListPrivate
|
|||||||
GncDenseCal* gdcal;
|
GncDenseCal* gdcal;
|
||||||
|
|
||||||
GncSxInstanceModel* instances;
|
GncSxInstanceModel* instances;
|
||||||
GncSxListTreeModelAdapter* tree_model;
|
|
||||||
GtkTreeView* tree_view;
|
GtkTreeView* tree_view;
|
||||||
} GncPluginPageSxListPrivate;
|
} GncPluginPageSxListPrivate;
|
||||||
|
|
||||||
@ -102,13 +102,11 @@ static GncPluginPage *gnc_plugin_page_sx_list_recreate_page (GtkWidget *window,
|
|||||||
|
|
||||||
static void gppsl_row_activated_cb(GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data);
|
static void gppsl_row_activated_cb(GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data);
|
||||||
|
|
||||||
/* Callbacks */
|
|
||||||
static void gnc_plugin_page_sx_list_cmd_new(GtkAction *action, GncPluginPageSxList *page);
|
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_edit(GtkAction *action, GncPluginPageSxList *page);
|
||||||
static void gnc_plugin_page_sx_list_cmd_delete(GtkAction *action, GncPluginPageSxList *page);
|
static void gnc_plugin_page_sx_list_cmd_delete(GtkAction *action, GncPluginPageSxList *page);
|
||||||
|
|
||||||
/* Command callbacks */
|
/* Command callbacks */
|
||||||
|
|
||||||
static GtkActionEntry gnc_plugin_page_sx_list_actions [] = {
|
static GtkActionEntry gnc_plugin_page_sx_list_actions [] = {
|
||||||
{ "SxListAction", NULL, N_("Scheduled"), NULL, NULL, NULL },
|
{ "SxListAction", NULL, N_("Scheduled"), NULL, NULL, NULL },
|
||||||
{ "SxListNewAction", GNC_STOCK_NEW_ACCOUNT, N_("New"), NULL,
|
{ "SxListNewAction", GNC_STOCK_NEW_ACCOUNT, N_("New"), NULL,
|
||||||
@ -193,10 +191,7 @@ gnc_plugin_page_sx_list_init (GncPluginPageSxList *plugin_page)
|
|||||||
"ui-description", "gnc-plugin-page-sx-list-ui.xml",
|
"ui-description", "gnc-plugin-page-sx-list-ui.xml",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* change me when the system supports multiple books */
|
|
||||||
gnc_plugin_page_add_book(parent, gnc_get_current_book());
|
gnc_plugin_page_add_book(parent, gnc_get_current_book());
|
||||||
|
|
||||||
/* Create menu and toolbar information */
|
|
||||||
action_group =
|
action_group =
|
||||||
gnc_plugin_page_create_action_group(parent,
|
gnc_plugin_page_create_action_group(parent,
|
||||||
"GncPluginPageSxListActions");
|
"GncPluginPageSxListActions");
|
||||||
@ -225,8 +220,6 @@ gnc_plugin_page_sx_list_dispose(GObject *object)
|
|||||||
priv->dense_cal_model = NULL;
|
priv->dense_cal_model = NULL;
|
||||||
gtk_widget_unref(GTK_WIDGET(priv->gdcal));
|
gtk_widget_unref(GTK_WIDGET(priv->gdcal));
|
||||||
priv->gdcal = NULL;
|
priv->gdcal = NULL;
|
||||||
g_object_unref(G_OBJECT(priv->tree_model));
|
|
||||||
priv->tree_model = NULL;
|
|
||||||
g_object_unref(G_OBJECT(priv->instances));
|
g_object_unref(G_OBJECT(priv->instances));
|
||||||
priv->instances = NULL;
|
priv->instances = NULL;
|
||||||
|
|
||||||
@ -244,9 +237,6 @@ gnc_plugin_page_sx_list_finalize (GObject *object)
|
|||||||
priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
|
priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
|
||||||
g_return_if_fail(priv != NULL);
|
g_return_if_fail(priv != NULL);
|
||||||
|
|
||||||
// by virtue of being a g_type_instance_..._private, does the private
|
|
||||||
// data get freed somewhere else?
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +301,7 @@ gnc_plugin_page_sx_list_create_widget (GncPluginPage *plugin_page)
|
|||||||
priv->widget = glade_xml_get_widget(priv->gxml, "sx-list-vbox");
|
priv->widget = glade_xml_get_widget(priv->gxml, "sx-list-vbox");
|
||||||
|
|
||||||
{
|
{
|
||||||
//gint half_way;
|
// gint half_way;
|
||||||
// half_way = plugin_page->notebook_page->allocation.height * 0.5;
|
// half_way = plugin_page->notebook_page->allocation.height * 0.5;
|
||||||
// fixme; get a real value:
|
// fixme; get a real value:
|
||||||
gtk_paned_set_position(GTK_PANED(priv->widget), 160);
|
gtk_paned_set_position(GTK_PANED(priv->widget), 160);
|
||||||
@ -334,43 +324,20 @@ gnc_plugin_page_sx_list_create_widget (GncPluginPage *plugin_page)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
GtkCellRenderer *renderer;
|
GtkContainer *tree_view_container;
|
||||||
GtkTreeViewColumn *column;
|
|
||||||
GtkTreeSelection *selection;
|
GtkTreeSelection *selection;
|
||||||
|
|
||||||
priv->tree_model = gnc_sx_list_tree_model_adapter_new(priv->instances);
|
tree_view_container = GTK_CONTAINER(glade_xml_get_widget(priv->gxml, "sx-list-tree-view-container"));
|
||||||
priv->tree_view = GTK_TREE_VIEW(glade_xml_get_widget(priv->gxml, "sx_list"));
|
priv->tree_view = GTK_TREE_VIEW(gnc_tree_view_sx_list_new(priv->instances));
|
||||||
gtk_tree_view_set_model(priv->tree_view, GTK_TREE_MODEL(priv->tree_model));
|
g_object_set(G_OBJECT(priv->tree_view),
|
||||||
|
"gconf-section", GCONF_SECTION,
|
||||||
renderer = gtk_cell_renderer_text_new();
|
"show-column-menu", TRUE,
|
||||||
column = gtk_tree_view_column_new_with_attributes("Name", renderer, "text", SXLTMA_COL_NAME, NULL);
|
NULL);
|
||||||
gtk_tree_view_column_set_sort_column_id(column, SXLTMA_COL_NAME);
|
gtk_container_add(tree_view_container, GTK_WIDGET(priv->tree_view));
|
||||||
gtk_tree_view_append_column(priv->tree_view, column);
|
|
||||||
|
|
||||||
renderer = gtk_cell_renderer_toggle_new();
|
|
||||||
column = gtk_tree_view_column_new_with_attributes("Enabled", renderer, "active", SXLTMA_COL_ENABLED, NULL);
|
|
||||||
gtk_tree_view_column_set_sort_column_id(column, SXLTMA_COL_ENABLED);
|
|
||||||
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", SXLTMA_COL_FREQUENCY, NULL);
|
|
||||||
gtk_tree_view_column_set_sort_column_id(column, SXLTMA_COL_FREQUENCY);
|
|
||||||
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", SXLTMA_COL_LAST_OCCUR, NULL);
|
|
||||||
gtk_tree_view_column_set_sort_column_id(column, SXLTMA_COL_LAST_OCCUR);
|
|
||||||
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", SXLTMA_COL_NEXT_OCCUR, NULL);
|
|
||||||
gtk_tree_view_column_set_sort_column_id(column, SXLTMA_COL_NEXT_OCCUR);
|
|
||||||
gtk_tree_view_append_column(priv->tree_view, column);
|
|
||||||
|
|
||||||
selection = gtk_tree_view_get_selection(priv->tree_view);
|
selection = gtk_tree_view_get_selection(priv->tree_view);
|
||||||
gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
|
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(selection), "changed", (GCallback)gppsl_selection_changed_cb, (gpointer)page);
|
||||||
|
|
||||||
g_signal_connect(G_OBJECT(priv->tree_view), "row-activated", (GCallback)gppsl_row_activated_cb, (gpointer)page);
|
g_signal_connect(G_OBJECT(priv->tree_view), "row-activated", (GCallback)gppsl_row_activated_cb, (gpointer)page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,11 +408,6 @@ gnc_plugin_page_sx_list_save_page (GncPluginPage *plugin_page,
|
|||||||
|
|
||||||
page = GNC_PLUGIN_PAGE_SX_LIST(plugin_page);
|
page = GNC_PLUGIN_PAGE_SX_LIST(plugin_page);
|
||||||
priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(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 */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -474,25 +436,10 @@ gnc_plugin_page_sx_list_recreate_page (GtkWidget *window,
|
|||||||
/* Install it now so we can them manipulate the created widget */
|
/* Install it now so we can them manipulate the created widget */
|
||||||
gnc_main_window_open_page(GNC_MAIN_WINDOW(window), GNC_PLUGIN_PAGE(page));
|
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 */
|
|
||||||
return GNC_PLUGIN_PAGE(page);
|
return GNC_PLUGIN_PAGE(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Callbacks */
|
|
||||||
|
|
||||||
static SchedXaction*
|
|
||||||
_sx_for_path(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
|
static void
|
||||||
gnc_plugin_page_sx_list_cmd_new(GtkAction *action, GncPluginPageSxList *page)
|
gnc_plugin_page_sx_list_cmd_new(GtkAction *action, GncPluginPageSxList *page)
|
||||||
{
|
{
|
||||||
@ -536,7 +483,9 @@ gnc_plugin_page_sx_list_cmd_edit(GtkAction *action, GncPluginPageSxList *page)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
to_edit = gnc_g_list_map(selected_paths, (GncGMapFunc)_sx_for_path, model);
|
to_edit = gnc_g_list_map(selected_paths,
|
||||||
|
(GncGMapFunc)gnc_tree_view_sx_list_get_sx_from_path,
|
||||||
|
priv->tree_view);
|
||||||
g_list_foreach(to_edit, (GFunc)_edit_sx, NULL);
|
g_list_foreach(to_edit, (GFunc)_edit_sx, NULL);
|
||||||
g_list_free(to_edit);
|
g_list_free(to_edit);
|
||||||
g_list_foreach(selected_paths, (GFunc)gtk_tree_path_free, NULL);
|
g_list_foreach(selected_paths, (GFunc)gtk_tree_path_free, NULL);
|
||||||
@ -551,7 +500,8 @@ gppsl_row_activated_cb(GtkTreeView *tree_view,
|
|||||||
{
|
{
|
||||||
GncPluginPageSxList *page = GNC_PLUGIN_PAGE_SX_LIST(user_data);
|
GncPluginPageSxList *page = GNC_PLUGIN_PAGE_SX_LIST(user_data);
|
||||||
GncPluginPageSxListPrivate *priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
|
GncPluginPageSxListPrivate *priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
|
||||||
SchedXaction *sx = _sx_for_path(path, priv->tree_model);
|
|
||||||
|
SchedXaction *sx = gnc_tree_view_sx_list_get_sx_from_path(GNC_TREE_VIEW_SX_LIST(priv->tree_view), path);
|
||||||
gnc_ui_scheduled_xaction_editor_dialog_create(sx, FALSE);
|
gnc_ui_scheduled_xaction_editor_dialog_create(sx, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -577,7 +527,6 @@ gnc_plugin_page_sx_list_cmd_delete(GtkAction *action, GncPluginPageSxList *page)
|
|||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
|
|
||||||
/* @@fixme -- add (suppressible?) confirmation dialog */
|
/* @@fixme -- add (suppressible?) confirmation dialog */
|
||||||
|
|
||||||
selection = gtk_tree_view_get_selection(priv->tree_view);
|
selection = gtk_tree_view_get_selection(priv->tree_view);
|
||||||
selected_paths = gtk_tree_selection_get_selected_rows(selection, &model);
|
selected_paths = gtk_tree_selection_get_selected_rows(selection, &model);
|
||||||
if (g_list_length(selected_paths) == 0)
|
if (g_list_length(selected_paths) == 0)
|
||||||
@ -586,7 +535,9 @@ gnc_plugin_page_sx_list_cmd_delete(GtkAction *action, GncPluginPageSxList *page)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
to_delete = gnc_g_list_map(selected_paths, (GncGMapFunc)_sx_for_path, model);
|
to_delete = gnc_g_list_map(selected_paths,
|
||||||
|
(GncGMapFunc)gnc_tree_view_sx_list_get_sx_from_path,
|
||||||
|
priv->tree_view);
|
||||||
{
|
{
|
||||||
GList *list;
|
GList *list;
|
||||||
for (list = to_delete; list != NULL; list = list->next)
|
for (list = to_delete; list != NULL; list = list->next)
|
||||||
|
Loading…
Reference in New Issue
Block a user