From 214d9ccc1853999cf0148e6fcc09ab1a9d7a4e33 Mon Sep 17 00:00:00 2001 From: David Hampton Date: Tue, 3 Jan 2006 01:08:20 +0000 Subject: [PATCH] Remove unused files. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@12239 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 4 + src/gnome-utils/Makefile.am | 4 - .../gnc-tree-model-example-account.c | 433 ------------------ .../gnc-tree-model-example-account.h | 72 --- 4 files changed, 4 insertions(+), 509 deletions(-) delete mode 100644 src/gnome-utils/gnc-tree-model-example-account.c delete mode 100644 src/gnome-utils/gnc-tree-model-example-account.h diff --git a/ChangeLog b/ChangeLog index a4141d083f..fb5b7fa5f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2006-01-02 David Hampton + * src/gnome-utils/Makefile.am + * src/gnome-utils/gnc-tree-model-example-account.[ch]: Remove + unused files. + * src/gnome/glade/account.glade: * src/gnome/druid-hierarchy.c: Use a GtkListStore for the example account categories instead of layering a custom selection model on diff --git a/src/gnome-utils/Makefile.am b/src/gnome-utils/Makefile.am index c9ed6c93af..3ccef8feb5 100644 --- a/src/gnome-utils/Makefile.am +++ b/src/gnome-utils/Makefile.am @@ -81,9 +81,7 @@ libgncmod_gnome_utils_la_SOURCES = \ gnc-tree-model-account-types.c \ gnc-tree-model-account.c \ gnc-tree-model-commodity.c \ - gnc-tree-model-example-account.c \ gnc-tree-model-price.c \ - gnc-tree-model-selection.c \ gnc-tree-view-account.c \ gnc-tree-view-commodity.c \ gnc-tree-view-price.c \ @@ -144,9 +142,7 @@ gncinclude_HEADERS = \ gnc-tree-model-account-types.h \ gnc-tree-model-account.h \ gnc-tree-model-commodity.h \ - gnc-tree-model-example-account.h \ gnc-tree-model-price.h \ - gnc-tree-model-selection.h \ gnc-tree-view-account.h \ gnc-tree-view-commodity.h \ gnc-tree-view-price.h \ diff --git a/src/gnome-utils/gnc-tree-model-example-account.c b/src/gnome-utils/gnc-tree-model-example-account.c deleted file mode 100644 index 233f9ef8e0..0000000000 --- a/src/gnome-utils/gnc-tree-model-example-account.c +++ /dev/null @@ -1,433 +0,0 @@ -/* - * gnc-tree-model-example-account.c -- GtkTreeModel implementation to - * display example accounts in a GtkTreeView. - * - * Copyright (C) 2003 Jan Arne Petersen - * Author: Jan Arne Petersen - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * 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 "qof.h" -#include "gnc-tree-model-example-account.h" -#include "io-example-account.h" -#include "Group.h" - -static void gnc_tree_model_example_account_class_init (GncTreeModelExampleAccountClass *klass); -static void gnc_tree_model_example_account_init (GncTreeModelExampleAccount *model); -static void gnc_tree_model_example_account_finalize (GObject *object); - -static void gnc_tree_model_example_account_tree_model_init (GtkTreeModelIface *iface); -static guint gnc_tree_model_example_account_get_flags (GtkTreeModel *tree_model); -static int gnc_tree_model_example_account_get_n_columns (GtkTreeModel *tree_model); -static GType gnc_tree_model_example_account_get_column_type (GtkTreeModel *tree_model, - int index); -static gboolean gnc_tree_model_example_account_get_iter (GtkTreeModel *tree_model, - GtkTreeIter *iter, - GtkTreePath *path); -static GtkTreePath *gnc_tree_model_example_account_get_path (GtkTreeModel *tree_model, - GtkTreeIter *iter); -static void gnc_tree_model_example_account_get_value (GtkTreeModel *tree_model, - GtkTreeIter *iter, - int column, - GValue *value); -static gboolean gnc_tree_model_example_account_iter_next (GtkTreeModel *tree_model, - GtkTreeIter *iter); -static gboolean gnc_tree_model_example_account_iter_children (GtkTreeModel *tree_model, - GtkTreeIter *iter, - GtkTreeIter *parent); -static gboolean gnc_tree_model_example_account_iter_has_child (GtkTreeModel *tree_model, - GtkTreeIter *iter); -static int gnc_tree_model_example_account_iter_n_children (GtkTreeModel *tree_model, - GtkTreeIter *iter); -static gboolean gnc_tree_model_example_account_iter_nth_child (GtkTreeModel *tree_model, - GtkTreeIter *iter, - GtkTreeIter *parent, - int n); -static gboolean gnc_tree_model_example_account_iter_parent (GtkTreeModel *tree_model, - GtkTreeIter *iter, - GtkTreeIter *child); - -typedef struct GncTreeModelExampleAccountPrivate -{ - GSList *accounts; -} GncTreeModelExampleAccountPrivate; - -#define GNC_TREE_MODEL_EXAMPLE_ACCOUNT_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_TREE_MODEL_EXAMPLE_ACCOUNT, GncTreeModelExampleAccountPrivate)) - -static GObjectClass *parent_class = NULL; - -GType -gnc_tree_model_example_account_get_type (void) -{ - static GType gnc_tree_model_example_account_type = 0; - - if (gnc_tree_model_example_account_type == 0) { - static const GTypeInfo our_info = { - sizeof (GncTreeModelExampleAccountClass), - NULL, - NULL, - (GClassInitFunc) gnc_tree_model_example_account_class_init, - NULL, - NULL, - sizeof (GncTreeModelExampleAccount), - 0, - (GInstanceInitFunc) gnc_tree_model_example_account_init - }; - - static const GInterfaceInfo tree_model_info = { - (GInterfaceInitFunc) gnc_tree_model_example_account_tree_model_init, - NULL, - NULL - }; - - gnc_tree_model_example_account_type = g_type_register_static (G_TYPE_OBJECT, - "GncTreeModelExampleAccount", - &our_info, 0); - - g_type_add_interface_static (gnc_tree_model_example_account_type, - GTK_TYPE_TREE_MODEL, - &tree_model_info); - } - - return gnc_tree_model_example_account_type; -} - -static void -gnc_tree_model_example_account_class_init (GncTreeModelExampleAccountClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); - - object_class->finalize = gnc_tree_model_example_account_finalize; - - g_type_class_add_private(klass, sizeof(GncTreeModelExampleAccountPrivate)); -} - -static void -gnc_tree_model_example_account_init (GncTreeModelExampleAccount *model) -{ - while (model->stamp == 0) { - model->stamp = g_random_int (); - } -} - -static void -gnc_tree_model_example_account_finalize (GObject *object) -{ - GncTreeModelExampleAccount *model; - GncTreeModelExampleAccountPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (GNC_IS_TREE_MODEL_EXAMPLE_ACCOUNT (object)); - - model = GNC_TREE_MODEL_EXAMPLE_ACCOUNT (object); - priv = GNC_TREE_MODEL_EXAMPLE_ACCOUNT_GET_PRIVATE(model); - - g_slist_free (priv->accounts); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -GtkTreeModel * -gnc_tree_model_example_account_new (GSList *accounts) -{ - GncTreeModelExampleAccount *model; - GncTreeModelExampleAccountPrivate *priv; - - model = g_object_new (GNC_TYPE_TREE_MODEL_EXAMPLE_ACCOUNT, - NULL); - - priv = GNC_TREE_MODEL_EXAMPLE_ACCOUNT_GET_PRIVATE(model); - priv->accounts = accounts; - - return GTK_TREE_MODEL (model); -} - -void -gnc_tree_model_example_account_set_accounts (GncTreeModelExampleAccount *model, - GSList *accounts) -{ - GncTreeModelExampleAccountPrivate *priv; - - g_return_if_fail (model != NULL); - - priv = GNC_TREE_MODEL_EXAMPLE_ACCOUNT_GET_PRIVATE(model); - g_slist_free (priv->accounts); - - priv->accounts = accounts; -} - -GncExampleAccount * -gnc_tree_model_example_account_get_account (GncTreeModelExampleAccount *model, - GtkTreeIter *iter) -{ - g_return_val_if_fail (GNC_IS_TREE_MODEL_EXAMPLE_ACCOUNT (model), NULL); - g_return_val_if_fail (iter != NULL, NULL); - g_return_val_if_fail (iter->user_data != NULL, NULL); - g_return_val_if_fail (iter->stamp == model->stamp, NULL); - - return (GncExampleAccount *) ((GSList *) iter->user_data)->data; -} - -static void -gnc_tree_model_example_account_tree_model_init (GtkTreeModelIface *iface) -{ - iface->get_flags = gnc_tree_model_example_account_get_flags; - iface->get_n_columns = gnc_tree_model_example_account_get_n_columns; - iface->get_column_type = gnc_tree_model_example_account_get_column_type; - iface->get_iter = gnc_tree_model_example_account_get_iter; - iface->get_path = gnc_tree_model_example_account_get_path; - iface->get_value = gnc_tree_model_example_account_get_value; - iface->iter_next = gnc_tree_model_example_account_iter_next; - iface->iter_children = gnc_tree_model_example_account_iter_children; - iface->iter_has_child = gnc_tree_model_example_account_iter_has_child; - iface->iter_n_children = gnc_tree_model_example_account_iter_n_children; - iface->iter_nth_child = gnc_tree_model_example_account_iter_nth_child; - iface->iter_parent = gnc_tree_model_example_account_iter_parent; -} - -static guint -gnc_tree_model_example_account_get_flags (GtkTreeModel *tree_model) -{ - return GTK_TREE_MODEL_ITERS_PERSIST | GTK_TREE_MODEL_LIST_ONLY; -} - -static int -gnc_tree_model_example_account_get_n_columns (GtkTreeModel *tree_model) -{ - return GNC_TREE_MODEL_EXAMPLE_ACCOUNT_NUM_COLUMNS; -} - -static GType -gnc_tree_model_example_account_get_column_type (GtkTreeModel *tree_model, - int index) -{ - g_return_val_if_fail (GNC_IS_TREE_MODEL_EXAMPLE_ACCOUNT (tree_model), G_TYPE_INVALID); - g_return_val_if_fail ((index < GNC_TREE_MODEL_EXAMPLE_ACCOUNT_NUM_COLUMNS) && (index >= 0), G_TYPE_INVALID); - - switch (index) { - case GNC_TREE_MODEL_EXAMPLE_ACCOUNT_COL_TITLE: - case GNC_TREE_MODEL_EXAMPLE_ACCOUNT_COL_SHORT_DESCRIPTION: - case GNC_TREE_MODEL_EXAMPLE_ACCOUNT_COL_LONG_DESCRIPTION: - return G_TYPE_STRING; - default: - g_assert_not_reached (); - return G_TYPE_INVALID; - } -} - -static gboolean -gnc_tree_model_example_account_get_iter (GtkTreeModel *tree_model, - GtkTreeIter *iter, - GtkTreePath *path) -{ - GncTreeModelExampleAccount *model = GNC_TREE_MODEL_EXAMPLE_ACCOUNT (tree_model); - GncTreeModelExampleAccountPrivate *priv; - guint i; - - g_return_val_if_fail (GNC_IS_TREE_MODEL_EXAMPLE_ACCOUNT (model), FALSE); - g_return_val_if_fail (gtk_tree_path_get_depth (path) > 0, FALSE); - - priv = GNC_TREE_MODEL_EXAMPLE_ACCOUNT_GET_PRIVATE(model); - if (priv->accounts == NULL) - return FALSE; - - i = gtk_tree_path_get_indices (path)[0]; - - g_return_val_if_fail (i >= 0 && i < g_slist_length (priv->accounts), FALSE); - - iter->stamp = model->stamp; - iter->user_data = g_slist_nth (priv->accounts, i); - - if (iter->user_data == NULL) { - iter->stamp = 0; - return FALSE; - } - - return TRUE; -} - -static GtkTreePath * -gnc_tree_model_example_account_get_path (GtkTreeModel *tree_model, - GtkTreeIter *iter) -{ - GncTreeModelExampleAccount *model = GNC_TREE_MODEL_EXAMPLE_ACCOUNT (tree_model); - GncTreeModelExampleAccountPrivate *priv; - GtkTreePath *path; - - g_return_val_if_fail (GNC_IS_TREE_MODEL_EXAMPLE_ACCOUNT (model), NULL); - g_return_val_if_fail (iter != NULL, NULL); - g_return_val_if_fail (iter->user_data != NULL, NULL); - g_return_val_if_fail (iter->stamp == model->stamp, NULL); - - priv = GNC_TREE_MODEL_EXAMPLE_ACCOUNT_GET_PRIVATE(model); - if (priv->accounts == NULL) - return NULL; - - path = gtk_tree_path_new (); - - gtk_tree_path_append_index (path, g_slist_position (priv->accounts, iter->user_data)); - - return path; -} - -static void -gnc_tree_model_example_account_get_value (GtkTreeModel *tree_model, - GtkTreeIter *iter, - int column, - GValue *value) -{ - GncTreeModelExampleAccount *model = GNC_TREE_MODEL_EXAMPLE_ACCOUNT (tree_model); - GncExampleAccount *account; - - g_return_if_fail (GNC_IS_TREE_MODEL_EXAMPLE_ACCOUNT (model)); - g_return_if_fail (iter != NULL); - g_return_if_fail (iter->user_data != NULL); - g_return_if_fail (iter->stamp == model->stamp); - - account = (GncExampleAccount *)((GSList *) iter->user_data)->data; - - switch (column) { - case GNC_TREE_MODEL_EXAMPLE_ACCOUNT_COL_TITLE: - g_value_init (value, G_TYPE_STRING); - - g_value_set_string (value, account->title); - break; - case GNC_TREE_MODEL_EXAMPLE_ACCOUNT_COL_SHORT_DESCRIPTION: - g_value_init (value, G_TYPE_STRING); - - g_value_set_string (value, account->short_description); - break; - case GNC_TREE_MODEL_EXAMPLE_ACCOUNT_COL_LONG_DESCRIPTION: - g_value_init (value, G_TYPE_STRING); - - g_value_set_string (value, account->long_description); - break; - default: - g_assert_not_reached (); - } -} - -static gboolean -gnc_tree_model_example_account_iter_next (GtkTreeModel *tree_model, - GtkTreeIter *iter) -{ - GncTreeModelExampleAccount *model = GNC_TREE_MODEL_EXAMPLE_ACCOUNT (tree_model); - - g_return_val_if_fail (GNC_IS_TREE_MODEL_EXAMPLE_ACCOUNT (model), FALSE); - g_return_val_if_fail (iter != NULL, FALSE); - g_return_val_if_fail (iter->user_data != NULL, FALSE); - g_return_val_if_fail (iter->stamp == model->stamp, FALSE); - - if (g_list_next (iter->user_data) == NULL) - return FALSE; - - iter->user_data = g_slist_next (iter->user_data); - - return TRUE; -} - -static gboolean -gnc_tree_model_example_account_iter_children (GtkTreeModel *tree_model, - GtkTreeIter *iter, - GtkTreeIter *parent) -{ - GncTreeModelExampleAccount *model; - GncTreeModelExampleAccountPrivate *priv; - - g_return_val_if_fail (GNC_IS_TREE_MODEL_EXAMPLE_ACCOUNT (tree_model), FALSE); - - if (parent != NULL) - return FALSE; - - model = GNC_TREE_MODEL_EXAMPLE_ACCOUNT (tree_model); - priv = GNC_TREE_MODEL_EXAMPLE_ACCOUNT_GET_PRIVATE(model); - iter->stamp = model->stamp; - iter->user_data = priv->accounts; - - return TRUE; -} - -static gboolean -gnc_tree_model_example_account_iter_has_child (GtkTreeModel *tree_model, - GtkTreeIter *iter) -{ - return FALSE; -} - -static int -gnc_tree_model_example_account_iter_n_children (GtkTreeModel *tree_model, - GtkTreeIter *iter) -{ - GncTreeModelExampleAccount *model; - GncTreeModelExampleAccountPrivate *priv; - - g_return_val_if_fail (GNC_IS_TREE_MODEL_EXAMPLE_ACCOUNT (tree_model), -1); - - model = GNC_TREE_MODEL_EXAMPLE_ACCOUNT (tree_model); - priv = GNC_TREE_MODEL_EXAMPLE_ACCOUNT_GET_PRIVATE(model); - if (iter == NULL) - return g_slist_length (priv->accounts); - - g_return_val_if_fail (model->stamp == iter->stamp, -1); - - return 0; -} - -static gboolean -gnc_tree_model_example_account_iter_nth_child (GtkTreeModel *tree_model, - GtkTreeIter *iter, - GtkTreeIter *parent, - int n) -{ - GncTreeModelExampleAccount *model; - GncTreeModelExampleAccountPrivate *priv; - - g_return_val_if_fail (GNC_IS_TREE_MODEL_EXAMPLE_ACCOUNT (tree_model), FALSE); - - if (parent != NULL) - return FALSE; - - model = GNC_TREE_MODEL_EXAMPLE_ACCOUNT (tree_model); - priv = GNC_TREE_MODEL_EXAMPLE_ACCOUNT_GET_PRIVATE(model); - - g_return_val_if_fail (n >= 0 && n < (int)g_slist_length (priv->accounts), FALSE); - - iter->stamp = model->stamp; - iter->user_data = g_slist_nth (priv->accounts, n); - - if (iter->user_data == NULL) { - iter->stamp = 0; - return FALSE; - } - - return TRUE; -} - -static gboolean -gnc_tree_model_example_account_iter_parent (GtkTreeModel *tree_model, - GtkTreeIter *iter, - GtkTreeIter *child) -{ - return FALSE; -} diff --git a/src/gnome-utils/gnc-tree-model-example-account.h b/src/gnome-utils/gnc-tree-model-example-account.h deleted file mode 100644 index db0533396f..0000000000 --- a/src/gnome-utils/gnc-tree-model-example-account.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * gnc-tree-model-example-account.h -- GtkTreeModel implementation to - * display examnple accounts in a GtkTreeView. - * - * Copyright (C) 2003 Jan Arne Petersen - * Author: Jan Arne Petersen - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * 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_MODEL_EXAMPLE_ACCOUNT_H -#define __GNC_TREE_MODEL_EXAMPLE_ACCOUNT_H - -#include - -#include "io-example-account.h" - -G_BEGIN_DECLS - -/* type macros */ -#define GNC_TYPE_TREE_MODEL_EXAMPLE_ACCOUNT (gnc_tree_model_example_account_get_type ()) -#define GNC_TREE_MODEL_EXAMPLE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_MODEL_EXAMPLE_ACCOUNT, GncTreeModelExampleAccount)) -#define GNC_TREE_MODEL_EXAMPLE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_MODEL_EXAMPLE_ACCOUNT, GncTreeModelExampleAccountClass)) -#define GNC_IS_TREE_MODEL_EXAMPLE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_MODEL_EXAMPLE_ACCOUNT)) -#define GNC_IS_TREE_MODEL_EXAMPLE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_MODEL_EXAMPLE_ACCOUNT)) -#define GNC_TREE_MODEL_EXAMPLE_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_MODEL_EXAMPLE_ACCOUNT, GncTreeModelExampleAccountClass)) - -typedef enum { - GNC_TREE_MODEL_EXAMPLE_ACCOUNT_COL_TITLE, - GNC_TREE_MODEL_EXAMPLE_ACCOUNT_COL_SHORT_DESCRIPTION, - GNC_TREE_MODEL_EXAMPLE_ACCOUNT_COL_LONG_DESCRIPTION, - GNC_TREE_MODEL_EXAMPLE_ACCOUNT_NUM_COLUMNS -} GncTreeModelExampleAccountColumn; - -/* typedefs & structures */ -typedef struct { - GObject gobject; - int stamp; -} GncTreeModelExampleAccount; - -typedef struct { - GObjectClass gobject; -} GncTreeModelExampleAccountClass; - -/* function prototypes */ -GType gnc_tree_model_example_account_get_type (void); - -GtkTreeModel *gnc_tree_model_example_account_new (GSList *accounts); -void gnc_tree_model_example_account_set_accounts (GncTreeModelExampleAccount *model, - GSList *accounts); - -GncExampleAccount *gnc_tree_model_example_account_get_account (GncTreeModelExampleAccount *model, - GtkTreeIter *iter); - -G_END_DECLS - -#endif /* __GNC_TREE_MODEL_EXAMPLE_ACCOUNT_H */