gnucash maint: Multiple changes pushed
Robert Fewell
bobit at code.gnucash.org
Tue Feb 8 06:18:17 EST 2022
Updated via https://github.com/Gnucash/gnucash/commit/331a3947 (commit)
via https://github.com/Gnucash/gnucash/commit/5d52fd8b (commit)
via https://github.com/Gnucash/gnucash/commit/a9faf861 (commit)
via https://github.com/Gnucash/gnucash/commit/c054b977 (commit)
via https://github.com/Gnucash/gnucash/commit/7152b384 (commit)
via https://github.com/Gnucash/gnucash/commit/21621312 (commit)
via https://github.com/Gnucash/gnucash/commit/b92b546f (commit)
from https://github.com/Gnucash/gnucash/commit/2aed5c9f (commit)
commit 331a394795123358288644535af71a417d39140f
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Fri Feb 4 11:35:19 2022 +0000
Console error when cleared transaction is deleted
If a cleared transaction is deleted when the reconcile dialog is open
on that account, the following console error is observed...
sys:1: Warning: g_hash_table_foreach: assertion
'version == hash_table->version' failed
To fix this use g_hash_table_foreach_remove and modify helper function
instead of g_hash_table_foreach
diff --git a/gnucash/gnome/reconcile-view.c b/gnucash/gnome/reconcile-view.c
index 933bef7a4..8d1a9bafd 100644
--- a/gnucash/gnome/reconcile-view.c
+++ b/gnucash/gnome/reconcile-view.c
@@ -876,14 +876,12 @@ gnc_reconcile_view_is_reconciled (gpointer item, gpointer user_data)
* Args: view - view to refresh *
* Returns: nothing *
\********************************************************************/
-static void
+static gboolean
grv_refresh_helper (gpointer key, gpointer value, gpointer user_data)
{
- GNCReconcileView *view = user_data;
- GNCQueryView *qview = GNC_QUERY_VIEW(view);
+ GNCQueryView *qview = user_data;
- if (!gnc_query_view_item_in_view (qview, key))
- g_hash_table_remove (view->reconciled, key);
+ return !gnc_query_view_item_in_view (qview, key);
}
void
@@ -902,7 +900,7 @@ gnc_reconcile_view_refresh (GNCReconcileView *view)
/* Now verify that everything in the reconcile hash is still in qview */
if (view->reconciled)
- g_hash_table_foreach (view->reconciled, grv_refresh_helper, view);
+ g_hash_table_foreach_remove (view->reconciled, grv_refresh_helper, qview);
}
/********************************************************************\
commit 5d52fd8bd21be0a51c573123041fa739c91dcbe2
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Fri Feb 4 11:28:16 2022 +0000
Change reconcile-view scrolling to selection
Change the gnc_reconcile_view_refresh function to use the function
gnc_query_view_force_scroll_to_selection function.
diff --git a/gnucash/gnome/reconcile-view.c b/gnucash/gnome/reconcile-view.c
index 39acbf00d..933bef7a4 100644
--- a/gnucash/gnome/reconcile-view.c
+++ b/gnucash/gnome/reconcile-view.c
@@ -890,8 +890,6 @@ void
gnc_reconcile_view_refresh (GNCReconcileView *view)
{
GNCQueryView *qview;
- GtkTreeSelection *selection;
- GList *path_list, *node;
g_return_if_fail (view != NULL);
g_return_if_fail (GNC_IS_RECONCILE_VIEW(view));
@@ -900,16 +898,7 @@ gnc_reconcile_view_refresh (GNCReconcileView *view)
gnc_query_view_refresh (qview);
/* Ensure last selected split, if any, can be seen */
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(qview));
- path_list = gtk_tree_selection_get_selected_rows (selection, NULL);
- node = g_list_last (path_list);
- if (node)
- {
- GtkTreePath *tree_path = node->data;
- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(qview),
- tree_path, NULL, FALSE, 0.0, 0.0);
- }
- g_list_free_full (path_list, (GDestroyNotify) gtk_tree_path_free);
+ gnc_query_force_scroll_to_selection (qview);
/* Now verify that everything in the reconcile hash is still in qview */
if (view->reconciled)
commit a9faf8614148b2fab3c54610c822f5d51bb57483
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Fri Feb 4 11:27:25 2022 +0000
Add functions to gnc-query-view to do scrolling to selection
Add the ability when a row is selected to scroll to that row so it is
always visible when reordering the list.
The first function, gnc_query_use_scroll_to_selection can enable or
disable this for the query view, the default is off.
Two functions do the scrolling, gnc_query_scroll_to_selection and
gnc_query_force_scroll_to_selection with the first one respecting the
value of use scrolling to selection whereas the second will always do
it.
diff --git a/gnucash/gnome-utils/gnc-query-view.c b/gnucash/gnome-utils/gnc-query-view.c
index 0da3765dd..9dfcfd358 100644
--- a/gnucash/gnome-utils/gnc-query-view.c
+++ b/gnucash/gnome-utils/gnc-query-view.c
@@ -200,6 +200,8 @@ gnc_query_view_init (GNCQueryView *qview)
qview->num_columns = 0;
qview->column_params = NULL;
+ qview->use_scroll_to_selection = FALSE;
+
qview->sort_column = 0;
qview->increasing = FALSE;
@@ -604,6 +606,57 @@ gnc_query_view_get_selected_entry_list (GNCQueryView *qview)
return acc_entries.entries;
}
+void
+gnc_query_use_scroll_to_selection (GNCQueryView *qview, gboolean scroll)
+{
+ g_return_if_fail (qview != NULL);
+ g_return_if_fail (GNC_IS_QUERY_VIEW(qview));
+
+ qview->use_scroll_to_selection = scroll;
+}
+
+static void
+scroll_to_selection (GNCQueryView *qview, gboolean override_scroll)
+{
+ GtkTreeSelection *selection;
+ GList *path_list, *node;
+
+ if (!qview->use_scroll_to_selection && !override_scroll)
+ return;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(qview));
+
+ /* Ensure last selected item, if any, can be seen */
+ path_list = gtk_tree_selection_get_selected_rows (selection, NULL);
+ node = g_list_last (path_list);
+
+ if (node)
+ {
+ GtkTreePath *tree_path = node->data;
+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(qview),
+ tree_path, NULL, FALSE, 0.0, 0.0);
+ }
+ g_list_free_full (path_list, (GDestroyNotify) gtk_tree_path_free);
+}
+
+void
+gnc_query_scroll_to_selection (GNCQueryView *qview)
+{
+ g_return_if_fail (qview != NULL);
+ g_return_if_fail (GNC_IS_QUERY_VIEW(qview));
+
+ scroll_to_selection (qview, FALSE);
+}
+
+void
+gnc_query_force_scroll_to_selection (GNCQueryView *qview)
+{
+ g_return_if_fail (qview != NULL);
+ g_return_if_fail (GNC_IS_QUERY_VIEW(qview));
+
+ scroll_to_selection (qview, TRUE);
+}
+
static void
gnc_query_view_refresh_selected (GNCQueryView *qview, GList *old_entry)
{
@@ -641,6 +694,7 @@ gnc_query_view_refresh_selected (GNCQueryView *qview, GList *old_entry)
valid = gtk_tree_model_iter_next (model, &iter);
}
}
+ gnc_query_scroll_to_selection (qview);
}
}
diff --git a/gnucash/gnome-utils/gnc-query-view.h b/gnucash/gnome-utils/gnc-query-view.h
index 2bf56fe1c..420ac455b 100644
--- a/gnucash/gnome-utils/gnc-query-view.h
+++ b/gnucash/gnome-utils/gnc-query-view.h
@@ -52,6 +52,7 @@ struct _GNCQueryView
/* Select information */
gint toggled_row;
gint toggled_column;
+ gboolean use_scroll_to_selection;
/* Column information */
gint num_columns;
@@ -118,6 +119,12 @@ gboolean gnc_query_view_item_in_view (GNCQueryView *qview, gpointer item);
void gnc_query_sort_order (GNCQueryView *qview, gint column, GtkSortType order);
+void gnc_query_scroll_to_selection (GNCQueryView *qview);
+
+void gnc_query_force_scroll_to_selection (GNCQueryView *qview);
+
+void gnc_query_use_scroll_to_selection (GNCQueryView *qview, gboolean scroll);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
commit c054b977185a2f5f52ef718e0655122db586f020
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Fri Feb 4 11:24:20 2022 +0000
Bug 798438 - on reconcile window, 'R' column sorting broken
Sorting on the 'R' column was enabled in version 3.0 by mistake and
never worked as expected. Due to the 'R' column using a function to
populate the model, the existing sorting method would not work as this
was achieved by changing the query.
To fix this add a sorting function to sort the model for the 'R' column.
diff --git a/gnucash/gnome-utils/gnc-query-view.c b/gnucash/gnome-utils/gnc-query-view.c
index 683b078fe..0da3765dd 100644
--- a/gnucash/gnome-utils/gnc-query-view.c
+++ b/gnucash/gnome-utils/gnc-query-view.c
@@ -691,6 +691,13 @@ gnc_query_view_set_query_sort (GNCQueryView *qview, gboolean new_column)
g_assert (GNC_IS_SEARCH_PARAM_SIMPLE(param));
+ /* If param values are based on a param function, sorting is not possible */
+ if (gnc_search_param_has_param_fcn (param))
+ {
+ gnc_query_view_refresh (qview);
+ return;
+ }
+
/* If we're asked to invert numerics, and if this is a numeric or
* debred column, then invert the sort order.
*/
diff --git a/gnucash/gnome-utils/search-param.c b/gnucash/gnome-utils/search-param.c
index 60a5b9fb5..18f54e23c 100644
--- a/gnucash/gnome-utils/search-param.c
+++ b/gnucash/gnome-utils/search-param.c
@@ -538,6 +538,22 @@ gnc_search_param_set_param_fcn (GNCSearchParamSimple *param,
gnc_search_param_override_param_type (param, param_type);
}
+gboolean
+gnc_search_param_has_param_fcn (GNCSearchParamSimple *param)
+{
+ GNCSearchParamSimplePrivate *priv;
+
+ g_return_val_if_fail (param, FALSE);
+ g_return_val_if_fail (GNC_IS_SEARCH_PARAM_SIMPLE(param), FALSE);
+
+ priv = GNC_SEARCH_PARAM_SIMPLE_GET_PRIVATE(param);
+
+ if (priv->lookup_fcn)
+ return TRUE;
+
+ return FALSE;
+}
+
/* Compute the value of this parameter for this object */
gpointer
gnc_search_param_compute_value (GNCSearchParamSimple *param, gpointer object)
diff --git a/gnucash/gnome-utils/search-param.h b/gnucash/gnome-utils/search-param.h
index 08d07223c..4dc18e93e 100644
--- a/gnucash/gnome-utils/search-param.h
+++ b/gnucash/gnome-utils/search-param.h
@@ -184,6 +184,9 @@ void gnc_search_param_set_param_fcn (GNCSearchParamSimple *param,
GNCSearchParamFcn fcn,
gpointer arg);
+/* check to see if this parameter is a lookup function */
+gboolean gnc_search_param_has_param_fcn (GNCSearchParamSimple *param);
+
/* Compute the value of this parameter for this object */
gpointer gnc_search_param_compute_value (GNCSearchParamSimple *param,
gpointer object);
diff --git a/gnucash/gnome/reconcile-view.c b/gnucash/gnome/reconcile-view.c
index 864dbdbab..39acbf00d 100644
--- a/gnucash/gnome/reconcile-view.c
+++ b/gnucash/gnome/reconcile-view.c
@@ -315,17 +315,58 @@ gnc_reconcile_view_construct (GNCReconcileView *view, Query *query)
G_CALLBACK(gnc_reconcile_view_tooltip_cb), view);
}
+static gint
+sort_date_helper (time64 date_a, time64 date_b)
+{
+ gint ret = 0;
+
+ if (date_a < date_b)
+ ret = -1;
+ else if (date_a > date_b)
+ ret = 1;
+
+ return ret;
+}
+
+static gint
+sort_iter_compare_func (GtkTreeModel *model,
+ GtkTreeIter *a,
+ GtkTreeIter *b,
+ gpointer user_data)
+{
+ gboolean rec_a, rec_b;
+ Split *split_a, *split_b;
+ time64 date_a, date_b;
+ gint ret = 0;
+
+ gtk_tree_model_get (model, a, REC_POINTER, &split_a, REC_RECN, &rec_a, -1);
+ gtk_tree_model_get (model, b, REC_POINTER, &split_b, REC_RECN, &rec_b, -1);
+
+ date_a = xaccTransGetDate (xaccSplitGetParent (split_a));
+ date_b = xaccTransGetDate (xaccSplitGetParent (split_b));
+
+ if (rec_a > rec_b)
+ ret = -1;
+ else if (rec_b > rec_a)
+ ret = 1;
+ else ret = sort_date_helper (date_a, date_b);
+
+ return ret;
+}
+
GtkWidget *
gnc_reconcile_view_new (Account *account, GNCReconcileViewType type,
time64 statement_date)
{
- GNCReconcileView *view;
- GtkListStore *liststore;
- gboolean include_children, auto_check;
- GList *accounts = NULL;
- GList *splits;
- Query *query;
- QofNumericMatch sign;
+ GNCReconcileView *view;
+ GtkListStore *liststore;
+ GtkTreeSortable *sortable;
+ GtkTreeViewColumn *col;
+ gboolean include_children, auto_check;
+ GList *accounts = NULL;
+ GList *splits;
+ Query *query;
+ QofNumericMatch sign;
g_return_val_if_fail (account, NULL);
g_return_val_if_fail ((type == RECLIST_DEBIT) ||
@@ -392,6 +433,13 @@ gnc_reconcile_view_new (Account *account, GNCReconcileViewType type,
}
}
+ /* set up a separate sort function for the recn column as it is
+ * derived from a search function */
+ sortable = GTK_TREE_SORTABLE(gtk_tree_view_get_model (GTK_TREE_VIEW(view)));
+ col = gtk_tree_view_get_column (GTK_TREE_VIEW(view), REC_RECN -1);
+ gtk_tree_sortable_set_sort_func (sortable, REC_RECN, sort_iter_compare_func,
+ GINT_TO_POINTER (REC_RECN), NULL);
+
/* Free the query -- we don't need it anymore */
qof_query_destroy (query);
@@ -519,6 +567,28 @@ gnc_reconcile_view_toggle (GNCReconcileView *view, Split *split)
reconcile_view_signals[TOGGLE_RECONCILED], 0, split);
}
+static gboolean
+follow_select_tree_path (GNCReconcileView *view)
+{
+ if (view->rowref)
+ {
+ GtkTreePath *tree_path = gtk_tree_row_reference_get_path (view->rowref);
+ GNCQueryView qview = view->qview;
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(&qview));
+
+ gtk_tree_selection_unselect_all (selection);
+ gtk_tree_selection_select_path (selection, tree_path);
+
+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(&qview),
+ tree_path, NULL, FALSE, 0.0, 0.0);
+
+ gtk_tree_path_free (tree_path);
+ gtk_tree_row_reference_free (view->rowref);
+ view->rowref = NULL;
+ }
+ return FALSE;
+}
+
static void
gnc_reconcile_view_line_toggled (GNCQueryView *qview,
gpointer item,
@@ -528,6 +598,7 @@ gnc_reconcile_view_line_toggled (GNCQueryView *qview,
GtkTreeModel *model;
GtkTreeIter iter;
gpointer entry;
+ GtkTreePath *tree_path;
g_return_if_fail (user_data);
g_return_if_fail (GNC_IS_QUERY_VIEW(qview));
@@ -536,10 +607,32 @@ gnc_reconcile_view_line_toggled (GNCQueryView *qview,
model = gtk_tree_view_get_model (GTK_TREE_VIEW(qview));
gtk_tree_model_iter_nth_child (model, &iter, NULL, qview->toggled_row);
- gtk_list_store_set (GTK_LIST_STORE(model), &iter, qview->toggled_column, GPOINTER_TO_INT(item), -1);
- gtk_tree_model_get (model, &iter, REC_POINTER, &entry, -1);
- gnc_reconcile_view_toggle (view, entry);
+ tree_path = gtk_tree_model_get_path (model, &iter);
+ view->rowref = gtk_tree_row_reference_new (model, tree_path);
+ gtk_tree_path_free (tree_path);
+
+ gtk_list_store_set (GTK_LIST_STORE(model), &iter, qview->toggled_column,
+ GPOINTER_TO_INT(item), -1);
+
+ tree_path = gtk_tree_row_reference_get_path (view->rowref);
+
+ if (gtk_tree_model_get_iter (model, &iter, tree_path))
+ {
+ gtk_tree_model_get (model, &iter, REC_POINTER, &entry, -1);
+ gnc_reconcile_view_toggle (view, entry);
+ }
+
+ // See if sorting on rec column, -1 to allow for the model pointer column at 0
+ if (qview->sort_column == REC_RECN - 1)
+ g_idle_add ((GSourceFunc)follow_select_tree_path, view);
+ else
+ {
+ gtk_tree_row_reference_free (view->rowref);
+ view->rowref = NULL;
+ }
+
+ gtk_tree_path_free (tree_path);
}
static void
@@ -586,16 +679,30 @@ gnc_reconcile_view_set_list (GNCReconcileView *view, gboolean reconcile)
gboolean toggled;
GList *node;
GList *list_of_rows;
+ GList *rr_list = NULL;
+ GtkTreePath *last_tree_path = NULL;
model = gtk_tree_view_get_model (GTK_TREE_VIEW(qview));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(qview));
list_of_rows = gtk_tree_selection_get_selected_rows (selection, &model);
- /* We get a list of TreePaths */
+ /* First create a list of Row references */
for (node = list_of_rows; node; node = node->next)
{
- GtkTreeIter iter;
- if (gtk_tree_model_get_iter(model, &iter, node->data))
+ GtkTreeRowReference *rowref = gtk_tree_row_reference_new (model, node->data);
+ rr_list = g_list_append (rr_list, rowref);
+ gtk_tree_path_free (node->data);
+ }
+
+ for (node = rr_list; node; node = node->next)
+ {
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ GtkTreeRowReference *rowref = node->data;
+
+ path = gtk_tree_row_reference_get_path (rowref);
+
+ if (gtk_tree_model_get_iter (model, &iter, path))
{
/* now iter is a valid row iterator */
gtk_tree_model_get (model, &iter, REC_POINTER, &entry,
@@ -603,11 +710,30 @@ gnc_reconcile_view_set_list (GNCReconcileView *view, gboolean reconcile)
gtk_list_store_set (GTK_LIST_STORE(model), &iter, REC_RECN, reconcile, -1);
+ if (last_tree_path)
+ gtk_tree_path_free (last_tree_path);
+ last_tree_path = gtk_tree_row_reference_get_path (rowref);
+
if (reconcile != toggled)
gnc_reconcile_view_toggle (view, entry);
}
- gtk_tree_path_free (node->data);
+ gtk_tree_path_free (path);
}
+
+ if (last_tree_path)
+ {
+ // See if sorting on rec column, -1 to allow for the model pointer column at 0
+ if (qview->sort_column == REC_RECN -1)
+ {
+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(qview),
+ last_tree_path, NULL, FALSE, 0.0, 0.0);
+ }
+ gtk_tree_path_free (last_tree_path);
+ last_tree_path = NULL;
+ }
+ g_list_foreach (rr_list, (GFunc) gtk_tree_row_reference_free, NULL);
+ g_list_free (rr_list);
+
// Out of site toggles on selected rows may not appear correctly drawn so
// queue a draw for the treeview widget
gtk_widget_queue_draw (GTK_WIDGET(qview));
diff --git a/gnucash/gnome/reconcile-view.h b/gnucash/gnome/reconcile-view.h
index 267154b7f..4d927a5f2 100644
--- a/gnucash/gnome/reconcile-view.h
+++ b/gnucash/gnome/reconcile-view.h
@@ -67,6 +67,8 @@ struct GNCReconcileView
GNCReconcileView *sibling;
GNCReconcileViewType view_type;
gboolean no_toggle;
+
+ GtkTreeRowReference *rowref;
};
typedef struct
commit 7152b384247204f8a843a13580288a703cce7c41
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Fri Feb 4 11:23:18 2022 +0000
Change source files search-param.* for space and tabs
diff --git a/gnucash/gnome-utils/search-param.c b/gnucash/gnome-utils/search-param.c
index 24e35c060..60a5b9fb5 100644
--- a/gnucash/gnome-utils/search-param.c
+++ b/gnucash/gnome-utils/search-param.c
@@ -33,54 +33,54 @@
#include "search-param.h"
-static void gnc_search_param_class_init (GNCSearchParamClass *klass);
-static void gnc_search_param_init (GNCSearchParam *gspaper);
-static void gnc_search_param_finalize (GObject *obj);
+static void gnc_search_param_class_init (GNCSearchParamClass *klass);
+static void gnc_search_param_init (GNCSearchParam *gspaper);
+static void gnc_search_param_finalize (GObject *obj);
-static void gnc_search_param_simple_class_init (GNCSearchParamSimpleClass *klass);
-static void gnc_search_param_simple_init (GNCSearchParamSimple *gspaper);
-static void gnc_search_param_simple_finalize (GObject *obj);
+static void gnc_search_param_simple_class_init (GNCSearchParamSimpleClass *klass);
+static void gnc_search_param_simple_init (GNCSearchParamSimple *gspaper);
+static void gnc_search_param_simple_finalize (GObject *obj);
-static void gnc_search_param_compound_class_init (GNCSearchParamCompoundClass *klass);
-static void gnc_search_param_compound_init (GNCSearchParamCompound *gspaper);
-static void gnc_search_param_compound_finalize (GObject *obj);
+static void gnc_search_param_compound_class_init (GNCSearchParamCompoundClass *klass);
+static void gnc_search_param_compound_init (GNCSearchParamCompound *gspaper);
+static void gnc_search_param_compound_finalize (GObject *obj);
-typedef struct _GNCSearchParamPrivate GNCSearchParamPrivate;
+typedef struct _GNCSearchParamPrivate GNCSearchParamPrivate;
struct _GNCSearchParamPrivate
{
- QofIdTypeConst type;
+ QofIdTypeConst type;
};
-#define GNC_SEARCH_PARAM_GET_PRIVATE(o) \
- ((GNCSearchParamPrivate*)g_type_instance_get_private((GTypeInstance*)o, GNC_TYPE_SEARCH_PARAM))
+#define GNC_SEARCH_PARAM_GET_PRIVATE(o) \
+ ((GNCSearchParamPrivate*)g_type_instance_get_private ((GTypeInstance*)o, GNC_TYPE_SEARCH_PARAM))
-typedef struct _GNCSearchParamSimplePrivate GNCSearchParamSimplePrivate;
+typedef struct _GNCSearchParamSimplePrivate GNCSearchParamSimplePrivate;
struct _GNCSearchParamSimplePrivate
{
- GSList * converters;
- GSList * param_path;
+ GSList * converters;
+ GSList * param_path;
- GNCSearchParamFcn lookup_fcn;
- gpointer lookup_arg;
+ GNCSearchParamFcn lookup_fcn;
+ gpointer lookup_arg;
};
-#define GNC_SEARCH_PARAM_SIMPLE_GET_PRIVATE(o) \
- ((GNCSearchParamSimplePrivate*)g_type_instance_get_private((GTypeInstance*)o, GNC_TYPE_SEARCH_PARAM_SIMPLE))
+#define GNC_SEARCH_PARAM_SIMPLE_GET_PRIVATE(o) \
+ ((GNCSearchParamSimplePrivate*)g_type_instance_get_private ((GTypeInstance*)o, GNC_TYPE_SEARCH_PARAM_SIMPLE))
-typedef struct _GNCSearchParamCompoundPrivate GNCSearchParamCompoundPrivate;
+typedef struct _GNCSearchParamCompoundPrivate GNCSearchParamCompoundPrivate;
struct _GNCSearchParamCompoundPrivate
{
- GList * sub_search;
+ GList * sub_search;
/* This defines the type of subsearch, either AND or OR */
GNCSearchParamKind kind;
};
-#define GNC_SEARCH_PARAM_COMPOUND_GET_PRIVATE(o) \
- ((GNCSearchParamCompoundPrivate*)g_type_instance_get_private((GTypeInstance*)o, GNC_TYPE_SEARCH_PARAM_COMPOUND))
+#define GNC_SEARCH_PARAM_COMPOUND_GET_PRIVATE(o) \
+ ((GNCSearchParamCompoundPrivate*)g_type_instance_get_private ((GTypeInstance*)o, GNC_TYPE_SEARCH_PARAM_COMPOUND))
static GObjectClass *parent_gobject_class;
static GNCSearchParamClass *parent_search_param_class;
@@ -101,7 +101,7 @@ G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchParam, gnc_search_param, G_TYPE_OBJECT)
static void
gnc_search_param_class_init (GNCSearchParamClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
parent_gobject_class = g_type_class_peek_parent (klass);
@@ -117,9 +117,9 @@ static void
gnc_search_param_finalize (GObject *obj)
{
g_return_if_fail (obj != NULL);
- g_return_if_fail (GNC_IS_SEARCH_PARAM (obj));
+ g_return_if_fail (GNC_IS_SEARCH_PARAM(obj));
- G_OBJECT_CLASS (parent_gobject_class)->finalize(obj);
+ G_OBJECT_CLASS(parent_gobject_class)->finalize (obj);
}
/* subclass for simple searches of a single element */
@@ -129,7 +129,7 @@ G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchParamSimple, gnc_search_param_simple, GNC_TY
static void
gnc_search_param_simple_class_init (GNCSearchParamSimpleClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
parent_search_param_class = g_type_class_peek_parent (klass);
@@ -144,13 +144,13 @@ gnc_search_param_simple_init (GNCSearchParamSimple *o)
static void
gnc_search_param_simple_finalize (GObject *obj)
{
- GNCSearchParamSimple *o;
+ GNCSearchParamSimple *o;
GNCSearchParamSimplePrivate *priv;
g_return_if_fail (obj != NULL);
- g_return_if_fail (GNC_IS_SEARCH_PARAM_SIMPLE (obj));
+ g_return_if_fail (GNC_IS_SEARCH_PARAM_SIMPLE(obj));
- o = GNC_SEARCH_PARAM_SIMPLE (obj);
+ o = GNC_SEARCH_PARAM_SIMPLE(obj);
priv = GNC_SEARCH_PARAM_SIMPLE_GET_PRIVATE(o);
g_slist_free (priv->param_path);
@@ -158,7 +158,7 @@ gnc_search_param_simple_finalize (GObject *obj)
g_slist_free (priv->converters);
priv->converters = NULL;
- G_OBJECT_CLASS (parent_search_param_class)->finalize(obj);
+ G_OBJECT_CLASS(parent_search_param_class)->finalize (obj);
}
/* Subclass for compound searches consisting of AND/OR of several elements */
@@ -168,7 +168,7 @@ G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchParamCompound, gnc_search_param_compound, GN
static void
gnc_search_param_compound_class_init (GNCSearchParamCompoundClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
parent_search_param_class = g_type_class_peek_parent (klass);
@@ -183,19 +183,19 @@ gnc_search_param_compound_init (GNCSearchParamCompound *o)
static void
gnc_search_param_compound_finalize (GObject *obj)
{
- GNCSearchParamCompound *o;
+ GNCSearchParamCompound *o;
GNCSearchParamCompoundPrivate *priv;
g_return_if_fail (obj != NULL);
- g_return_if_fail (GNC_IS_SEARCH_PARAM_COMPOUND (obj));
+ g_return_if_fail (GNC_IS_SEARCH_PARAM_COMPOUND(obj));
- o = GNC_SEARCH_PARAM_COMPOUND (obj);
+ o = GNC_SEARCH_PARAM_COMPOUND(obj);
priv = GNC_SEARCH_PARAM_COMPOUND_GET_PRIVATE(o);
g_list_free (priv->sub_search);
priv->sub_search = NULL;
- G_OBJECT_CLASS (parent_search_param_class)->finalize(obj);
+ G_OBJECT_CLASS (parent_search_param_class)->finalize (obj);
}
/**
@@ -208,8 +208,8 @@ gnc_search_param_compound_finalize (GObject *obj)
GNCSearchParamSimple *
gnc_search_param_simple_new (void)
{
- GNCSearchParamSimple *o =
- (GNCSearchParamSimple *)g_object_new(gnc_search_param_simple_get_type (), NULL);
+ GNCSearchParamSimple *o = (GNCSearchParamSimple *)
+ g_object_new (gnc_search_param_simple_get_type (), NULL);
return o;
}
@@ -223,8 +223,8 @@ gnc_search_param_simple_new (void)
GNCSearchParamCompound *
gnc_search_param_compound_new (void)
{
- GNCSearchParamCompound *o =
- (GNCSearchParamCompound *)g_object_new(gnc_search_param_compound_get_type (), NULL);
+ GNCSearchParamCompound *o = (GNCSearchParamCompound *)
+ g_object_new (gnc_search_param_compound_get_type (), NULL);
return o;
}
@@ -234,11 +234,11 @@ gnc_search_param_set_param_path (GNCSearchParamSimple *param,
GSList *param_path)
{
GNCSearchParamSimplePrivate *priv;
- GNCSearchParamPrivate *priv_base;
- QofIdTypeConst type = NULL;
- GSList *converters = NULL;
+ GNCSearchParamPrivate *priv_base;
+ QofIdTypeConst type = NULL;
+ GSList *converters = NULL;
- g_return_if_fail (GNC_IS_SEARCH_PARAM_SIMPLE (param));
+ g_return_if_fail (GNC_IS_SEARCH_PARAM_SIMPLE(param));
priv = GNC_SEARCH_PARAM_SIMPLE_GET_PRIVATE(param);
if (priv->param_path)
@@ -251,8 +251,8 @@ gnc_search_param_set_param_path (GNCSearchParamSimple *param,
for (; param_path; param_path = param_path->next)
{
QofIdType param_name = param_path->data;
- const QofParam *objDef =
- qof_class_get_parameter (search_type, param_name);
+ const QofParam *objDef = qof_class_get_parameter (search_type,
+ param_name);
/* If it doesn't exist, then we've reached the end */
if (objDef == NULL)
@@ -283,10 +283,10 @@ gnc_search_param_override_param_type (GNCSearchParamSimple *param,
{
GNCSearchParamPrivate *priv;
- g_return_if_fail (GNC_IS_SEARCH_PARAM_SIMPLE (param));
+ g_return_if_fail (GNC_IS_SEARCH_PARAM_SIMPLE(param));
g_return_if_fail (param_type != NULL && *param_type != '\0');
- priv = GNC_SEARCH_PARAM_GET_PRIVATE (GNC_SEARCH_PARAM (param));
+ priv = GNC_SEARCH_PARAM_GET_PRIVATE(GNC_SEARCH_PARAM(param));
priv->type = param_type;
/* XXX: What about the converters? */
}
@@ -296,7 +296,7 @@ gnc_search_param_get_search (GNCSearchParamCompound *param)
{
GNCSearchParamCompoundPrivate *priv;
- g_return_val_if_fail (GNC_IS_SEARCH_PARAM_COMPOUND (param), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_PARAM_COMPOUND(param), NULL);
priv = GNC_SEARCH_PARAM_COMPOUND_GET_PRIVATE(param);
return priv->sub_search;
@@ -307,7 +307,7 @@ gnc_search_param_get_param_path (GNCSearchParamSimple *param)
{
GNCSearchParamSimplePrivate *priv;
- g_return_val_if_fail (GNC_IS_SEARCH_PARAM_SIMPLE (param), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_PARAM_SIMPLE(param), NULL);
priv = GNC_SEARCH_PARAM_SIMPLE_GET_PRIVATE(param);
return g_slist_copy (priv->param_path);
@@ -318,7 +318,7 @@ gnc_search_param_get_converters (GNCSearchParamSimple *param)
{
GNCSearchParamSimplePrivate *priv;
- g_return_val_if_fail (GNC_IS_SEARCH_PARAM_SIMPLE (param), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_PARAM_SIMPLE(param), NULL);
priv = GNC_SEARCH_PARAM_SIMPLE_GET_PRIVATE(param);
return priv->converters;
@@ -329,7 +329,7 @@ gnc_search_param_get_param_type (GNCSearchParam *param)
{
GNCSearchParamPrivate *priv;
- g_return_val_if_fail (GNC_IS_SEARCH_PARAM (param), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_PARAM(param), NULL);
priv = GNC_SEARCH_PARAM_GET_PRIVATE(param);
return priv->type;
@@ -340,10 +340,10 @@ gnc_search_param_get_kind (GNCSearchParam *param)
{
GNCSearchParamCompoundPrivate *priv;
- if (GNC_IS_SEARCH_PARAM_SIMPLE (param))
+ if (GNC_IS_SEARCH_PARAM_SIMPLE(param))
return SEARCH_PARAM_ELEM;
-
- g_return_val_if_fail (GNC_IS_SEARCH_PARAM_COMPOUND (param), SEARCH_PARAM_ELEM);
+
+ g_return_val_if_fail (GNC_IS_SEARCH_PARAM_COMPOUND(param), SEARCH_PARAM_ELEM);
priv = GNC_SEARCH_PARAM_COMPOUND_GET_PRIVATE(param);
return priv->kind;
@@ -352,7 +352,7 @@ gnc_search_param_get_kind (GNCSearchParam *param)
void
gnc_search_param_set_title (GNCSearchParam *param, const char *title)
{
- g_return_if_fail (GNC_IS_SEARCH_PARAM (param));
+ g_return_if_fail (GNC_IS_SEARCH_PARAM(param));
param->title = title;
}
@@ -360,7 +360,7 @@ gnc_search_param_set_title (GNCSearchParam *param, const char *title)
void
gnc_search_param_set_justify (GNCSearchParam *param, GtkJustification justify)
{
- g_return_if_fail (GNC_IS_SEARCH_PARAM (param));
+ g_return_if_fail (GNC_IS_SEARCH_PARAM(param));
param->justify = justify;
}
@@ -368,7 +368,7 @@ gnc_search_param_set_justify (GNCSearchParam *param, GtkJustification justify)
void
gnc_search_param_set_passive (GNCSearchParam *param, gboolean value)
{
- g_assert (GNC_IS_SEARCH_PARAM (param));
+ g_assert (GNC_IS_SEARCH_PARAM(param));
param->passive = value;
}
@@ -376,7 +376,7 @@ gnc_search_param_set_passive (GNCSearchParam *param, gboolean value)
void
gnc_search_param_set_non_resizeable (GNCSearchParam *param, gboolean value)
{
- g_assert (GNC_IS_SEARCH_PARAM (param));
+ g_assert (GNC_IS_SEARCH_PARAM(param));
param->non_resizeable = value;
}
@@ -386,11 +386,12 @@ gnc_search_param_type_match (GNCSearchParam *a, GNCSearchParam *b)
{
GNCSearchParamPrivate *a_priv, *b_priv;
- g_return_val_if_fail (GNC_IS_SEARCH_PARAM (a), FALSE);
- g_return_val_if_fail (GNC_IS_SEARCH_PARAM (b), FALSE);
+ g_return_val_if_fail (GNC_IS_SEARCH_PARAM(a), FALSE);
+ g_return_val_if_fail (GNC_IS_SEARCH_PARAM(b), FALSE);
a_priv = GNC_SEARCH_PARAM_GET_PRIVATE(a);
b_priv = GNC_SEARCH_PARAM_GET_PRIVATE(b);
+
if (a_priv->type == b_priv->type ||
!g_strcmp0 (a_priv->type, b_priv->type))
return TRUE;
@@ -406,12 +407,12 @@ gnc_search_param_prepend_internal (GList *list, char const *title,
const char *param, va_list args)
{
GNCSearchParamSimple *p;
- GSList *path = NULL;
- const char *this_param;
+ GSList *path = NULL;
+ const char *this_param;
p = gnc_search_param_simple_new ();
- gnc_search_param_set_title (GNC_SEARCH_PARAM (p), title);
- gnc_search_param_set_justify (GNC_SEARCH_PARAM (p), justify);
+ gnc_search_param_set_title (GNC_SEARCH_PARAM(p), title);
+ gnc_search_param_set_justify (GNC_SEARCH_PARAM(p), justify);
for (this_param = param; this_param;
this_param = va_arg (args, const char *))
@@ -439,7 +440,7 @@ gnc_search_param_prepend_with_justify (GList *list, char const *title,
QofIdTypeConst search_type,
const char *param, ...)
{
- GList *result;
+ GList *result;
va_list ap;
g_return_val_if_fail (title, list);
@@ -449,8 +450,8 @@ gnc_search_param_prepend_with_justify (GList *list, char const *title,
/* Build the parameter path */
va_start (ap, param);
result = gnc_search_param_prepend_internal (list, title, justify,
- type_override, search_type,
- param, ap);
+ type_override, search_type,
+ param, ap);
va_end (ap);
return result;
}
@@ -461,7 +462,7 @@ gnc_search_param_prepend (GList *list, char const *title,
QofIdTypeConst search_type,
const char *param, ...)
{
- GList *result;
+ GList *result;
va_list ap;
g_return_val_if_fail (title, list);
@@ -471,8 +472,8 @@ gnc_search_param_prepend (GList *list, char const *title,
/* Build the parameter path */
va_start (ap, param);
result = gnc_search_param_prepend_internal (list, title, GTK_JUSTIFY_LEFT,
- type_override, search_type,
- param, ap);
+ type_override, search_type,
+ param, ap);
va_end (ap);
return result;
}
@@ -483,38 +484,38 @@ gnc_search_param_prepend_compound (GList *list, char const *title,
GtkJustification justify,
GNCSearchParamKind kind)
{
- GList *p;
- QofIdTypeConst type = NULL;
- GNCSearchParamCompound *param;
- GNCSearchParamPrivate *basepriv;
+ GList *p;
+ QofIdTypeConst type = NULL;
+ GNCSearchParamCompound *param;
+ GNCSearchParamPrivate *basepriv;
GNCSearchParamCompoundPrivate *priv;
-
+
g_return_val_if_fail (title, list);
g_return_val_if_fail (param_list, list);
g_return_val_if_fail (kind == SEARCH_PARAM_ANY || kind == SEARCH_PARAM_ALL, list);
-
+
/* "param_list" is a list of GNCSearchParamSimple. Make sure all the types are the same */
for (p = param_list; p; p = p->next)
{
GNCSearchParam *baseparam;
- g_return_val_if_fail (GNC_IS_SEARCH_PARAM (p->data), list);
+ g_return_val_if_fail (GNC_IS_SEARCH_PARAM(p->data), list);
baseparam = GNC_SEARCH_PARAM(p->data);
if (!type)
type = gnc_search_param_get_param_type (baseparam);
else
g_return_val_if_fail (g_strcmp0 (type, gnc_search_param_get_param_type (baseparam)) == 0, list);
}
-
+
param = gnc_search_param_compound_new ();
- gnc_search_param_set_title (GNC_SEARCH_PARAM (param), title);
- gnc_search_param_set_justify (GNC_SEARCH_PARAM (param), justify);
+ gnc_search_param_set_title (GNC_SEARCH_PARAM(param), title);
+ gnc_search_param_set_justify (GNC_SEARCH_PARAM(param), justify);
priv = GNC_SEARCH_PARAM_COMPOUND_GET_PRIVATE(param);
basepriv = GNC_SEARCH_PARAM_GET_PRIVATE(param);
priv->sub_search = g_list_copy (param_list);
basepriv->type = type;
priv->kind = kind;
-
+
return g_list_prepend (list, param);
}
@@ -543,8 +544,8 @@ gnc_search_param_compute_value (GNCSearchParamSimple *param, gpointer object)
{
GNCSearchParamSimplePrivate *priv;
- g_return_val_if_fail(param, NULL);
- g_return_val_if_fail(GNC_IS_SEARCH_PARAM_SIMPLE(param), NULL);
+ g_return_val_if_fail (param, NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_PARAM_SIMPLE(param), NULL);
priv = GNC_SEARCH_PARAM_SIMPLE_GET_PRIVATE(param);
if (priv->lookup_fcn)
@@ -562,7 +563,6 @@ gnc_search_param_compute_value (GNCSearchParamSimple *param, gpointer object)
QofParam *qp = converters->data;
res = (qp->param_getfcn) (res, qp);
}
-
return res;
}
}
diff --git a/gnucash/gnome-utils/search-param.h b/gnucash/gnome-utils/search-param.h
index cfee78854..08d07223c 100644
--- a/gnucash/gnome-utils/search-param.h
+++ b/gnucash/gnome-utils/search-param.h
@@ -24,22 +24,22 @@
#define _GNCSEARCH_PARAM_H
-#define GNC_TYPE_SEARCH_PARAM (gnc_search_param_get_type ())
-#define GNC_SEARCH_PARAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_SEARCH_PARAM, GNCSearchParam))
+#define GNC_TYPE_SEARCH_PARAM (gnc_search_param_get_type ())
+#define GNC_SEARCH_PARAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_SEARCH_PARAM, GNCSearchParam))
#define GNCSEARCH_PARAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_SEARCH_PARAM, GNCSearchParamClass)
-#define GNC_IS_SEARCH_PARAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_SEARCH_PARAM))
+#define GNC_IS_SEARCH_PARAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_SEARCH_PARAM))
-typedef struct _GNCSearchParam GNCSearchParam;
-typedef struct _GNCSearchParamClass GNCSearchParamClass;
+typedef struct _GNCSearchParam GNCSearchParam;
+typedef struct _GNCSearchParamClass GNCSearchParamClass;
struct _GNCSearchParam
{
GObject gobject;
- const char * title;
- GtkJustification justify;
- gboolean passive;
- gboolean non_resizeable;
+ const char * title;
+ GtkJustification justify;
+ gboolean passive;
+ gboolean non_resizeable;
};
struct _GNCSearchParamClass
@@ -51,15 +51,15 @@ struct _GNCSearchParamClass
/* signals */
};
-#define GNC_TYPE_SEARCH_PARAM_SIMPLE (gnc_search_param_simple_get_type ())
-#define GNC_SEARCH_PARAM_SIMPLE(o) \
+#define GNC_TYPE_SEARCH_PARAM_SIMPLE (gnc_search_param_simple_get_type ())
+#define GNC_SEARCH_PARAM_SIMPLE(o) \
(G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_SEARCH_PARAM_SIMPLE, GNCSearchParamSimple))
#define GNCSEARCH_PARAM_SIMPLE_CLASS(k) \
(G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_SEARCH_PARAM_SIMPLE, GNCSearchParamSimpleClass)
-#define GNC_IS_SEARCH_PARAM_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_SEARCH_PARAM_SIMPLE))
+#define GNC_IS_SEARCH_PARAM_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_SEARCH_PARAM_SIMPLE))
-typedef struct _GNCSearchParamSimple GNCSearchParamSimple;
-typedef struct _GNCSearchParamSimpleClass GNCSearchParamSimpleClass;
+typedef struct _GNCSearchParamSimple GNCSearchParamSimple;
+typedef struct _GNCSearchParamSimpleClass GNCSearchParamSimpleClass;
struct _GNCSearchParamSimple
{
@@ -75,15 +75,15 @@ struct _GNCSearchParamSimpleClass
/* signals */
};
-#define GNC_TYPE_SEARCH_PARAM_COMPOUND (gnc_search_param_compound_get_type ())
-#define GNC_SEARCH_PARAM_COMPOUND(o) \
+#define GNC_TYPE_SEARCH_PARAM_COMPOUND (gnc_search_param_compound_get_type ())
+#define GNC_SEARCH_PARAM_COMPOUND(o) \
(G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_SEARCH_PARAM_COMPOUND, GNCSearchParamCompound))
#define GNCSEARCH_PARAM_COMPOUND_CLASS(k) \
(G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_SEARCH_PARAM_COMPOUND, GNCSearchParamCompoundClass)
-#define GNC_IS_SEARCH_PARAM_COMPOUND(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_SEARCH_PARAM_COMPOUND))
+#define GNC_IS_SEARCH_PARAM_COMPOUND(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_SEARCH_PARAM_COMPOUND))
-typedef struct _GNCSearchParamCompound GNCSearchParamCompound;
-typedef struct _GNCSearchParamCompoundClass GNCSearchParamCompoundClass;
+typedef struct _GNCSearchParamCompound GNCSearchParamCompound;
+typedef struct _GNCSearchParamCompoundClass GNCSearchParamCompoundClass;
struct _GNCSearchParamCompound
{
@@ -107,40 +107,40 @@ typedef enum
} GNCSearchParamKind;
/* These are internal functions */
-GType gnc_search_param_get_type (void);
-GType gnc_search_param_simple_get_type (void);
-GType gnc_search_param_compound_get_type (void);
+GType gnc_search_param_get_type (void);
+GType gnc_search_param_simple_get_type (void);
+GType gnc_search_param_compound_get_type (void);
/* Create a new search param */
-GNCSearchParamSimple * gnc_search_param_simple_new (void);
-GNCSearchParamCompound * gnc_search_param_compound_new (void);
+GNCSearchParamSimple * gnc_search_param_simple_new (void);
+GNCSearchParamCompound * gnc_search_param_compound_new (void);
/* use the param_path for this parameter. This will automatically
* compute the parameter type and the converter functions.
*/
-void gnc_search_param_set_param_path (GNCSearchParamSimple *param,
- QofIdTypeConst search_type,
- GSList *param_path);
+void gnc_search_param_set_param_path (GNCSearchParamSimple *param,
+ QofIdTypeConst search_type,
+ GSList *param_path);
/* List is property of the caller */
-GList * gnc_search_param_get_search (GNCSearchParamCompound *param);
-GSList * gnc_search_param_get_param_path (GNCSearchParamSimple *param);
-QofIdTypeConst gnc_search_param_get_param_type (GNCSearchParam *param);
-void gnc_search_param_set_title (GNCSearchParam *param,
- const char *title);
+GList * gnc_search_param_get_search (GNCSearchParamCompound *param);
+GSList * gnc_search_param_get_param_path (GNCSearchParamSimple *param);
+QofIdTypeConst gnc_search_param_get_param_type (GNCSearchParam *param);
+void gnc_search_param_set_title (GNCSearchParam *param,
+ const char *title);
GNCSearchParamKind gnc_search_param_get_kind (GNCSearchParam *param);
-void gnc_search_param_set_justify (GNCSearchParam *param,
- GtkJustification justify);
-void gnc_search_param_set_passive (GNCSearchParam *param,
- gboolean value);
-void gnc_search_param_set_non_resizeable (GNCSearchParam *param,
- gboolean value);
-gboolean gnc_search_param_type_match (GNCSearchParam *a,
- GNCSearchParam *b);
-
-/* Return the list of QofAccessFunc functions for this parameter. This list
+void gnc_search_param_set_justify (GNCSearchParam *param,
+ GtkJustification justify);
+void gnc_search_param_set_passive (GNCSearchParam *param,
+ gboolean value);
+void gnc_search_param_set_non_resizeable (GNCSearchParam *param,
+ gboolean value);
+gboolean gnc_search_param_type_match (GNCSearchParam *a,
+ GNCSearchParam *b);
+
+/* Return the list of QofAccessFunc functions for this parameter. This list
* is owned by the param object -- users should not change it */
-GSList * gnc_search_param_get_converters (GNCSearchParamSimple *param);
+GSList * gnc_search_param_get_converters (GNCSearchParamSimple *param);
/* This will override the automatic param_type logic from "set_param_path()"
* so that the programmer can force a particular UI to appear for a given
@@ -148,31 +148,29 @@ GSList * gnc_search_param_get_converters (GNCSearchParamSimple *param);
* it could result in an invalid Query Term, where the path and the predicate
* don't match types properly.
*/
-void gnc_search_param_override_param_type (GNCSearchParamSimple *param,
- QofIdTypeConst param_type);
-
+void gnc_search_param_override_param_type (GNCSearchParamSimple *param,
+ QofIdTypeConst param_type);
/*************************************************************
* Helper functions ..
*/
/* Create a parameter and prepend it to a GSList */
-GList * gnc_search_param_prepend (GList *list, char const *title,
- QofIdTypeConst type_override,
- QofIdTypeConst search_type,
- const char *param, ...);
-
-
-GList * gnc_search_param_prepend_with_justify (GList *list, char const *title,
- GtkJustification justify,
- QofIdTypeConst type_override,
- QofIdTypeConst search_type,
- const char *param, ...);
-
-GList * gnc_search_param_prepend_compound (GList *list, char const *title,
- GList *param_list,
- GtkJustification justify,
- GNCSearchParamKind kind);
+GList * gnc_search_param_prepend (GList *list, char const *title,
+ QofIdTypeConst type_override,
+ QofIdTypeConst search_type,
+ const char *param, ...);
+
+GList * gnc_search_param_prepend_with_justify (GList *list, char const *title,
+ GtkJustification justify,
+ QofIdTypeConst type_override,
+ QofIdTypeConst search_type,
+ const char *param, ...);
+
+GList * gnc_search_param_prepend_compound (GList *list, char const *title,
+ GList *param_list,
+ GtkJustification justify,
+ GNCSearchParamKind kind);
/* set a lookup function for this parameter (in lieu of setting the
* param path) if you want to specify a direct lookup function when
@@ -181,13 +179,13 @@ GList * gnc_search_param_prepend_compound (GList *list, char const *titl
* query-list.
*/
typedef gpointer (*GNCSearchParamFcn)(gpointer object, gpointer arg);
-void gnc_search_param_set_param_fcn (GNCSearchParamSimple *param,
- QofIdTypeConst param_type,
- GNCSearchParamFcn fcn,
- gpointer arg);
+void gnc_search_param_set_param_fcn (GNCSearchParamSimple *param,
+ QofIdTypeConst param_type,
+ GNCSearchParamFcn fcn,
+ gpointer arg);
/* Compute the value of this parameter for this object */
-gpointer gnc_search_param_compute_value (GNCSearchParamSimple *param, gpointer object);
-
+gpointer gnc_search_param_compute_value (GNCSearchParamSimple *param,
+ gpointer object);
#endif /* _GNCSEARCH_PARAM_H */
commit 21621312bebe38567cf49eea1a40bd827624cc2c
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Fri Feb 4 11:22:40 2022 +0000
Change source files reconcile-view.* for space and tabs
diff --git a/gnucash/gnome/reconcile-view.c b/gnucash/gnome/reconcile-view.c
index 289ca2f8d..864dbdbab 100644
--- a/gnucash/gnome/reconcile-view.c
+++ b/gnucash/gnome/reconcile-view.c
@@ -59,13 +59,25 @@ static guint reconcile_view_signals[LAST_SIGNAL] = {0};
static void gnc_reconcile_view_init (GNCReconcileView *view);
static void gnc_reconcile_view_class_init (GNCReconcileViewClass *klass);
static void gnc_reconcile_view_finalize (GObject *object);
-static gpointer gnc_reconcile_view_is_reconciled (gpointer item, gpointer user_data);
-static void gnc_reconcile_view_line_toggled (GNCQueryView *qview, gpointer item, gpointer user_data);
-static void gnc_reconcile_view_double_click_entry (GNCQueryView *qview, gpointer item, gpointer user_data);
-static void gnc_reconcile_view_row_selected (GNCQueryView *qview, gpointer item, gpointer user_data);
-static gboolean gnc_reconcile_view_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data);
-static gboolean gnc_reconcile_view_tooltip_cb (GNCQueryView *qview, gint x, gint y, gboolean keyboard_mode,
- GtkTooltip* tooltip, gpointer* user_data);
+static gpointer gnc_reconcile_view_is_reconciled (gpointer item,
+ gpointer user_data);
+static void gnc_reconcile_view_line_toggled (GNCQueryView *qview,
+ gpointer item,
+ gpointer user_data);
+static void gnc_reconcile_view_double_click_entry (GNCQueryView *qview,
+ gpointer item,
+ gpointer user_data);
+static void gnc_reconcile_view_row_selected (GNCQueryView *qview,
+ gpointer item,
+ gpointer user_data);
+static gboolean gnc_reconcile_view_key_press_cb (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer user_data);
+static gboolean gnc_reconcile_view_tooltip_cb (GNCQueryView *qview,
+ gint x, gint y,
+ gboolean keyboard_mode,
+ GtkTooltip* tooltip,
+ gpointer* user_data);
GType
gnc_reconcile_view_get_type (void)
@@ -88,8 +100,9 @@ gnc_reconcile_view_get_type (void)
};
gnc_reconcile_view_type = g_type_register_static (GNC_TYPE_QUERY_VIEW,
- "GncReconcileView",
- &gnc_reconcile_view_info, 0);
+ "GncReconcileView",
+ &gnc_reconcile_view_info,
+ 0);
}
return gnc_reconcile_view_type;
}
@@ -97,13 +110,15 @@ gnc_reconcile_view_get_type (void)
static gboolean
gnc_reconcile_view_tooltip_cb (GNCQueryView *qview, gint x, gint y,
- gboolean keyboard_mode, GtkTooltip *tooltip, gpointer *user_data)
+ gboolean keyboard_mode, GtkTooltip *tooltip,
+ gpointer *user_data)
{
GtkTreeModel* model;
GtkTreeIter iter;
// If the Description is longer than can be display, show it in a tooltip
- if (gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (qview), &x, &y, keyboard_mode, &model, NULL, &iter))
+ if (gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW(qview), &x, &y,
+ keyboard_mode, &model, NULL, &iter))
{
GtkTreeViewColumn *col;
GList *cols;
@@ -113,13 +128,14 @@ gnc_reconcile_view_tooltip_cb (GNCQueryView *qview, gint x, gint y,
/* Are we in keyboard tooltip mode, displays tooltip below/above treeview CTRL+F1 */
if (keyboard_mode == FALSE)
{
- if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (qview), x, y, NULL, &col, NULL, NULL) == FALSE)
+ if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW(qview), x, y,
+ NULL, &col, NULL, NULL) == FALSE)
return FALSE;
}
else
- gtk_tree_view_get_cursor (GTK_TREE_VIEW (qview), NULL, &col);
+ gtk_tree_view_get_cursor (GTK_TREE_VIEW(qview), NULL, &col);
- cols = gtk_tree_view_get_columns (GTK_TREE_VIEW (qview));
+ cols = gtk_tree_view_get_columns (GTK_TREE_VIEW(qview));
col_width = gtk_tree_view_column_get_width (col);
col_pos = g_list_index (cols, col);
g_list_free (cols);
@@ -137,7 +153,7 @@ gnc_reconcile_view_tooltip_cb (GNCQueryView *qview, gint x, gint y,
gint root_x, root_y;
gint cur_x, cur_y;
- layout = gtk_widget_create_pango_layout (GTK_WIDGET (qview), desc_text);
+ layout = gtk_widget_create_pango_layout (GTK_WIDGET(qview), desc_text);
pango_layout_get_pixel_size (layout, &text_width, NULL);
g_object_unref (layout);
@@ -156,7 +172,7 @@ gnc_reconcile_view_tooltip_cb (GNCQueryView *qview, gint x, gint y,
GdkWindow *parent_window;
GList *win_list, *node;
- parent_window = gtk_widget_get_parent_window (GTK_WIDGET (qview));
+ parent_window = gtk_widget_get_parent_window (GTK_WIDGET(qview));
seat = gdk_display_get_default_seat (gdk_window_get_display (parent_window));
pointer = gdk_seat_get_pointer (seat);
@@ -173,20 +189,20 @@ gnc_reconcile_view_tooltip_cb (GNCQueryView *qview, gint x, gint y,
for (node = win_list; node != NULL; node = node->next)
{
if (g_strcmp0 (gtk_widget_get_name (node->data), "gtk-tooltip") == 0)
- tip_win = node->data;
+ tip_win = node->data;
}
g_list_free (win_list);
gtk_tooltip_set_text (tooltip, desc_text);
- if (GTK_IS_WINDOW (tip_win))
+ if (GTK_IS_WINDOW(tip_win))
{
GdkMonitor *mon;
GdkRectangle monitor;
GtkRequisition requisition;
gint x, y;
- gtk_widget_get_preferred_size (GTK_WIDGET (tip_win), &requisition, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET(tip_win), &requisition, NULL);
x = root_x + cur_x + 10;
y = root_y + cur_y + 10;
@@ -213,31 +229,29 @@ gnc_reconcile_view_tooltip_cb (GNCQueryView *qview, gint x, gint y,
return FALSE;
}
-
gint
gnc_reconcile_view_get_column_width (GNCReconcileView *view, gint column)
{
- GNCQueryView *qview = GNC_QUERY_VIEW (view);
+ GNCQueryView *qview = GNC_QUERY_VIEW(view);
GtkTreeViewColumn *col;
- //allow for pointer model column at column 0
- col = gtk_tree_view_get_column (GTK_TREE_VIEW (qview), (column - 1));
+ // allow for pointer model column at column 0
+ col = gtk_tree_view_get_column (GTK_TREE_VIEW(qview), (column - 1));
return gtk_tree_view_column_get_width (col);
}
-
void
gnc_reconcile_view_add_padding (GNCReconcileView *view, gint column, gint xpadding)
{
- GNCQueryView *qview = GNC_QUERY_VIEW (view);
+ GNCQueryView *qview = GNC_QUERY_VIEW(view);
GtkTreeViewColumn *col;
GList *renderers;
GtkCellRenderer *cr0;
gint xpad, ypad;
- //allow for pointer model column at column 0
- col = gtk_tree_view_get_column (GTK_TREE_VIEW (qview), (column - 1));
- renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (col));
+ // allow for pointer model column at column 0
+ col = gtk_tree_view_get_column (GTK_TREE_VIEW(qview), (column - 1));
+ renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT(col));
cr0 = g_list_nth_data (renderers, 0);
g_list_free (renderers);
@@ -245,7 +259,6 @@ gnc_reconcile_view_add_padding (GNCReconcileView *view, gint column, gint xpaddi
gtk_cell_renderer_set_padding (cr0, xpadding, ypad);
}
-
/****************************************************************************\
* gnc_reconcile_view_new *
* creates the account tree *
@@ -258,7 +271,7 @@ gnc_reconcile_view_add_padding (GNCReconcileView *view, gint column, gint xpaddi
static void
gnc_reconcile_view_construct (GNCReconcileView *view, Query *query)
{
- GNCQueryView *qview = GNC_QUERY_VIEW (view);
+ GNCQueryView *qview = GNC_QUERY_VIEW(view);
GtkTreeViewColumn *col;
GtkTreeSelection *selection;
GList *renderers;
@@ -274,38 +287,37 @@ gnc_reconcile_view_construct (GNCReconcileView *view, Query *query)
/* Set the description field to have spare space,
REC_DESC -1 to allow for the pointer model column at 0 */
- col = gtk_tree_view_get_column (GTK_TREE_VIEW (qview), (REC_DESC - 1));
+ col = gtk_tree_view_get_column (GTK_TREE_VIEW(qview), (REC_DESC - 1));
gtk_tree_view_column_set_expand (col, TRUE);
/* Get the renderer of the description column and set ellipsize value */
- renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (col));
+ renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT(col));
cr0 = g_list_nth_data (renderers, 0);
g_list_free (renderers);
g_object_set (cr0, "ellipsize", PANGO_ELLIPSIZE_END, NULL );
- gtk_widget_set_has_tooltip (GTK_WIDGET (qview), TRUE);
+ gtk_widget_set_has_tooltip (GTK_WIDGET(qview), TRUE);
/* Set the selection method */
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (qview));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(qview));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
/* Now set up the signals for the QueryView */
g_signal_connect (G_OBJECT (qview), "column_toggled",
G_CALLBACK (gnc_reconcile_view_line_toggled), view);
- g_signal_connect (G_OBJECT (qview), "double_click_entry",
- G_CALLBACK (gnc_reconcile_view_double_click_entry), view);
- g_signal_connect (G_OBJECT (qview), "row_selected",
- G_CALLBACK (gnc_reconcile_view_row_selected), view);
- g_signal_connect (G_OBJECT (qview), "key_press_event",
- G_CALLBACK (gnc_reconcile_view_key_press_cb), view);
- g_signal_connect (G_OBJECT (qview), "query-tooltip",
- G_CALLBACK (gnc_reconcile_view_tooltip_cb), view);
+ g_signal_connect (G_OBJECT(qview), "double_click_entry",
+ G_CALLBACK(gnc_reconcile_view_double_click_entry), view);
+ g_signal_connect (G_OBJECT(qview), "row_selected",
+ G_CALLBACK(gnc_reconcile_view_row_selected), view);
+ g_signal_connect (G_OBJECT(qview), "key_press_event",
+ G_CALLBACK(gnc_reconcile_view_key_press_cb), view);
+ g_signal_connect (G_OBJECT(qview), "query-tooltip",
+ G_CALLBACK(gnc_reconcile_view_tooltip_cb), view);
}
-
GtkWidget *
gnc_reconcile_view_new (Account *account, GNCReconcileViewType type,
- time64 statement_date)
+ time64 statement_date)
{
GNCReconcileView *view;
GtkListStore *liststore;
@@ -324,8 +336,10 @@ gnc_reconcile_view_new (Account *account, GNCReconcileViewType type,
/* Create the list store with 6 columns and add to treeview,
column 0 will be a pointer to the entry */
liststore = gtk_list_store_new (6, G_TYPE_POINTER, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN );
- gtk_tree_view_set_model (GTK_TREE_VIEW (view), GTK_TREE_MODEL (liststore));
+ G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_BOOLEAN);
+
+ gtk_tree_view_set_model (GTK_TREE_VIEW(view), GTK_TREE_MODEL(liststore));
g_object_unref (liststore);
view->account = account;
@@ -346,8 +360,8 @@ gnc_reconcile_view_new (Account *account, GNCReconcileViewType type,
g_list_free (accounts);
- sign = (type == RECLIST_CREDIT) ?
- QOF_NUMERIC_MATCH_CREDIT : QOF_NUMERIC_MATCH_DEBIT;
+ sign = (type == RECLIST_CREDIT) ? QOF_NUMERIC_MATCH_CREDIT :
+ QOF_NUMERIC_MATCH_DEBIT;
xaccQueryAddNumericMatch (query, gnc_numeric_zero (), sign, QOF_COMPARE_GTE,
QOF_QUERY_AND, SPLIT_AMOUNT, NULL);
@@ -363,7 +377,7 @@ gnc_reconcile_view_new (Account *account, GNCReconcileViewType type,
if (auto_check)
{
- time64 statement_date_day_end = gnc_time64_get_day_end(statement_date);
+ time64 statement_date_day_end = gnc_time64_get_day_end (statement_date);
for (splits = qof_query_run (query); splits; splits = splits->next)
{
Split *split = splits->data;
@@ -373,32 +387,29 @@ gnc_reconcile_view_new (Account *account, GNCReconcileViewType type,
/* Just an extra verification that our query is correct ;) */
g_assert (recn == NREC || recn == CREC);
- if (recn == CREC &&
- gnc_difftime (trans_date, statement_date_day_end) <= 0)
- g_hash_table_insert (view->reconciled, split, split);
+ if (recn == CREC && gnc_difftime (trans_date, statement_date_day_end) <= 0)
+ g_hash_table_insert (view->reconciled, split, split);
}
}
/* Free the query -- we don't need it anymore */
qof_query_destroy (query);
- return GTK_WIDGET (view);
+ return GTK_WIDGET(view);
}
-
static void
gnc_reconcile_view_init (GNCReconcileView *view)
{
GNCSearchParamSimple *param;
- GList *columns = NULL;
- gboolean num_action =
- qof_book_use_split_action_for_num_field(gnc_get_current_book());
+ GList *columns = NULL;
+ gboolean num_action = qof_book_use_split_action_for_num_field (gnc_get_current_book());
view->reconciled = g_hash_table_new (NULL, NULL);
view->account = NULL;
view->sibling = NULL;
- param = gnc_search_param_simple_new();
+ param = gnc_search_param_simple_new ();
gnc_search_param_set_param_fcn (param, QOF_TYPE_BOOLEAN,
gnc_reconcile_view_is_reconciled, view);
gnc_search_param_set_title ((GNCSearchParam *) param, C_("Column header for 'Reconciled'", "R"));
@@ -408,69 +419,70 @@ gnc_reconcile_view_init (GNCReconcileView *view)
columns = g_list_prepend (columns, param);
columns = gnc_search_param_prepend_with_justify (columns, _("Amount"),
- GTK_JUSTIFY_RIGHT,
- NULL, GNC_ID_SPLIT,
- SPLIT_AMOUNT, NULL);
+ GTK_JUSTIFY_RIGHT,
+ NULL, GNC_ID_SPLIT,
+ SPLIT_AMOUNT, NULL);
columns = gnc_search_param_prepend (columns, _("Description"), NULL,
GNC_ID_SPLIT, SPLIT_TRANS,
TRANS_DESCRIPTION, NULL);
columns = num_action ?
gnc_search_param_prepend_with_justify (columns, _("Num"),
- GTK_JUSTIFY_CENTER,
- NULL, GNC_ID_SPLIT,
- SPLIT_ACTION, NULL) :
+ GTK_JUSTIFY_CENTER,
+ NULL, GNC_ID_SPLIT,
+ SPLIT_ACTION, NULL) :
gnc_search_param_prepend_with_justify (columns, _("Num"),
- GTK_JUSTIFY_CENTER,
- NULL, GNC_ID_SPLIT,
- SPLIT_TRANS, TRANS_NUM, NULL);
- columns = gnc_search_param_prepend (columns, _("Date"), NULL, GNC_ID_SPLIT,
- SPLIT_TRANS, TRANS_DATE_POSTED, NULL);
+ GTK_JUSTIFY_CENTER,
+ NULL, GNC_ID_SPLIT,
+ SPLIT_TRANS, TRANS_NUM, NULL);
+ columns = gnc_search_param_prepend (columns, _("Date"),
+ NULL, GNC_ID_SPLIT,
+ SPLIT_TRANS,
+ TRANS_DATE_POSTED, NULL);
view->column_list = columns;
}
-
static void
gnc_reconcile_view_class_init (GNCReconcileViewClass *klass)
{
GObjectClass *object_class;
- object_class = G_OBJECT_CLASS (klass);
+ object_class = G_OBJECT_CLASS(klass);
parent_class = g_type_class_peek_parent (klass);
reconcile_view_signals[TOGGLE_RECONCILED] =
- g_signal_new("toggle_reconciled",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GNCReconcileViewClass,
+ g_signal_new ("toggle_reconciled",
+ G_OBJECT_CLASS_TYPE(object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET(GNCReconcileViewClass,
toggle_reconciled),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
reconcile_view_signals[LINE_SELECTED] =
- g_signal_new("line_selected",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GNCReconcileViewClass,
+ g_signal_new ("line_selected",
+ G_OBJECT_CLASS_TYPE(object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET(GNCReconcileViewClass,
line_selected),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
reconcile_view_signals[DOUBLE_CLICK_SPLIT] =
- g_signal_new("double_click_split",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GNCReconcileViewClass,
+ g_signal_new ("double_click_split",
+ G_OBJECT_CLASS_TYPE(object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET(GNCReconcileViewClass,
double_click_split),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
object_class->finalize = gnc_reconcile_view_finalize;
@@ -479,13 +491,12 @@ gnc_reconcile_view_class_init (GNCReconcileViewClass *klass)
klass->double_click_split = NULL;
}
-
static void
gnc_reconcile_view_toggle_split (GNCReconcileView *view, Split *split)
{
Split *current;
- g_return_if_fail (GNC_IS_RECONCILE_VIEW (view));
+ g_return_if_fail (GNC_IS_RECONCILE_VIEW(view));
g_return_if_fail (view->reconciled != NULL);
current = g_hash_table_lookup (view->reconciled, split);
@@ -496,20 +507,18 @@ gnc_reconcile_view_toggle_split (GNCReconcileView *view, Split *split)
g_hash_table_remove (view->reconciled, split);
}
-
static void
gnc_reconcile_view_toggle (GNCReconcileView *view, Split *split)
{
- g_return_if_fail (GNC_IS_RECONCILE_VIEW (view));
+ g_return_if_fail (GNC_IS_RECONCILE_VIEW(view));
g_return_if_fail (view->reconciled != NULL);
gnc_reconcile_view_toggle_split (view, split);
- g_signal_emit (G_OBJECT (view),
+ g_signal_emit (G_OBJECT(view),
reconcile_view_signals[TOGGLE_RECONCILED], 0, split);
}
-
static void
gnc_reconcile_view_line_toggled (GNCQueryView *qview,
gpointer item,
@@ -521,55 +530,54 @@ gnc_reconcile_view_line_toggled (GNCQueryView *qview,
gpointer entry;
g_return_if_fail (user_data);
- g_return_if_fail (GNC_IS_QUERY_VIEW (qview));
+ g_return_if_fail (GNC_IS_QUERY_VIEW(qview));
view = user_data;
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (qview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW(qview));
gtk_tree_model_iter_nth_child (model, &iter, NULL, qview->toggled_row);
- gtk_list_store_set (GTK_LIST_STORE (model), &iter, qview->toggled_column, GPOINTER_TO_INT(item), -1);
+ gtk_list_store_set (GTK_LIST_STORE(model), &iter, qview->toggled_column, GPOINTER_TO_INT(item), -1);
gtk_tree_model_get (model, &iter, REC_POINTER, &entry, -1);
gnc_reconcile_view_toggle (view, entry);
}
-
static void
gnc_reconcile_view_double_click_entry (GNCQueryView *qview,
gpointer item,
gpointer user_data)
{
GNCReconcileView *view;
+
/* item is the entry */
g_return_if_fail (user_data);
- g_return_if_fail (GNC_IS_QUERY_VIEW (qview));
+ g_return_if_fail (GNC_IS_QUERY_VIEW(qview));
view = user_data;
- g_signal_emit(G_OBJECT (view),
+ g_signal_emit(G_OBJECT(view),
reconcile_view_signals[DOUBLE_CLICK_SPLIT], 0, item);
}
-
static void
gnc_reconcile_view_row_selected (GNCQueryView *qview,
gpointer item,
gpointer user_data)
{
GNCReconcileView *view;
+
/* item is the number of selected entries */
- g_return_if_fail(user_data);
- g_return_if_fail(GNC_IS_QUERY_VIEW(qview));
+ g_return_if_fail (user_data);
+ g_return_if_fail (GNC_IS_QUERY_VIEW(qview));
view = user_data;
- g_signal_emit(G_OBJECT(view),
- reconcile_view_signals[LINE_SELECTED], 0, item);
+ g_signal_emit (G_OBJECT(view),
+ reconcile_view_signals[LINE_SELECTED], 0, item);
}
-
void
-gnc_reconcile_view_set_list ( GNCReconcileView *view, gboolean reconcile)
+gnc_reconcile_view_set_list (GNCReconcileView *view, gboolean reconcile)
{
GNCQueryView *qview = GNC_QUERY_VIEW(view);
GtkTreeSelection *selection;
@@ -579,45 +587,43 @@ gnc_reconcile_view_set_list ( GNCReconcileView *view, gboolean reconcile)
GList *node;
GList *list_of_rows;
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (qview));
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (qview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW(qview));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(qview));
list_of_rows = gtk_tree_selection_get_selected_rows (selection, &model);
/* We get a list of TreePaths */
- for(node = list_of_rows; node; node = node->next)
+ for (node = list_of_rows; node; node = node->next)
{
GtkTreeIter iter;
- if(gtk_tree_model_get_iter(model, &iter, node->data))
+ if (gtk_tree_model_get_iter(model, &iter, node->data))
{
/* now iter is a valid row iterator */
- gtk_tree_model_get (model, &iter, REC_POINTER, &entry, -1);
- gtk_tree_model_get (model, &iter, REC_RECN, &toggled, -1);
+ gtk_tree_model_get (model, &iter, REC_POINTER, &entry,
+ REC_RECN, &toggled, -1);
- gtk_list_store_set (GTK_LIST_STORE (model), &iter, REC_RECN, reconcile, -1);
+ gtk_list_store_set (GTK_LIST_STORE(model), &iter, REC_RECN, reconcile, -1);
- if(reconcile != toggled)
+ if (reconcile != toggled)
gnc_reconcile_view_toggle (view, entry);
}
- gtk_tree_path_free(node->data);
+ gtk_tree_path_free (node->data);
}
// Out of site toggles on selected rows may not appear correctly drawn so
// queue a draw for the treeview widget
gtk_widget_queue_draw (GTK_WIDGET(qview));
- g_list_free(list_of_rows);
+ g_list_free (list_of_rows);
}
-
gint
gnc_reconcile_view_num_selected (GNCReconcileView *view )
{
GNCQueryView *qview = GNC_QUERY_VIEW(view);
GtkTreeSelection *selection;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (qview));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(qview));
return gtk_tree_selection_count_selected_rows (selection);
}
-
static gboolean
gnc_reconcile_view_set_toggle (GNCReconcileView *view)
{
@@ -630,38 +636,37 @@ gnc_reconcile_view_set_toggle (GNCReconcileView *view)
gint num_toggled = 0;
gint num_selected = 0;
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (qview));
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (qview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW(qview));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(qview));
list_of_rows = gtk_tree_selection_get_selected_rows (selection, &model);
num_selected = gtk_tree_selection_count_selected_rows (selection);
/* We get a list of TreePaths */
- for(node = list_of_rows; node; node = node->next)
+ for (node = list_of_rows; node; node = node->next)
{
GtkTreeIter iter;
toggled = FALSE;
- if(gtk_tree_model_get_iter(model, &iter, node->data))
+ if (gtk_tree_model_get_iter (model, &iter, node->data))
{
/* now iter is a valid row iterator */
gtk_tree_model_get (model, &iter, REC_RECN, &toggled, -1);
- if(toggled)
+ if (toggled)
num_toggled++;
}
- gtk_tree_path_free(node->data);
+ gtk_tree_path_free (node->data);
}
- g_list_free(list_of_rows);
+ g_list_free (list_of_rows);
- if(num_toggled == num_selected)
+ if (num_toggled == num_selected)
return FALSE;
else
return TRUE;
}
-
static gboolean
gnc_reconcile_view_key_press_cb (GtkWidget *widget, GdkEventKey *event,
- gpointer user_data)
+ gpointer user_data)
{
GNCReconcileView *view = GNC_RECONCILE_VIEW(user_data);
gboolean toggle;
@@ -681,11 +686,10 @@ gnc_reconcile_view_key_press_cb (GtkWidget *widget, GdkEventKey *event,
}
}
-
static void
gnc_reconcile_view_finalize (GObject *object)
{
- GNCReconcileView *view = GNC_RECONCILE_VIEW (object);
+ GNCReconcileView *view = GNC_RECONCILE_VIEW(object);
g_list_free (view->column_list);
if (view->reconciled != NULL)
@@ -693,30 +697,27 @@ gnc_reconcile_view_finalize (GObject *object)
g_hash_table_destroy (view->reconciled);
view->reconciled = NULL;
}
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS(parent_class)->finalize (object);
}
-
gint
gnc_reconcile_view_get_num_splits (GNCReconcileView *view)
{
g_return_val_if_fail (view != NULL, 0);
- g_return_val_if_fail (GNC_IS_RECONCILE_VIEW (view), 0);
+ g_return_val_if_fail (GNC_IS_RECONCILE_VIEW(view), 0);
- return gnc_query_view_get_num_entries (GNC_QUERY_VIEW (view));
+ return gnc_query_view_get_num_entries (GNC_QUERY_VIEW(view));
}
-
Split *
gnc_reconcile_view_get_current_split (GNCReconcileView *view)
{
g_return_val_if_fail (view != NULL, NULL);
- g_return_val_if_fail (GNC_IS_RECONCILE_VIEW (view), NULL);
+ g_return_val_if_fail (GNC_IS_RECONCILE_VIEW(view), NULL);
- return gnc_query_view_get_selected_entry (GNC_QUERY_VIEW (view));
+ return gnc_query_view_get_selected_entry (GNC_QUERY_VIEW(view));
}
-
/********************************************************************\
* gnc_reconcile_view_is_reconciled *
* Is the item a reconciled split? *
@@ -729,20 +730,19 @@ static gpointer
gnc_reconcile_view_is_reconciled (gpointer item, gpointer user_data)
{
GNCReconcileView *view = user_data;
- Split *current;
+ Split *current;
g_return_val_if_fail (item, NULL);
g_return_val_if_fail (view, NULL);
- g_return_val_if_fail (GNC_IS_RECONCILE_VIEW (view), NULL);
+ g_return_val_if_fail (GNC_IS_RECONCILE_VIEW(view), NULL);
if (!view->reconciled)
return NULL;
current = g_hash_table_lookup (view->reconciled, item);
- return GINT_TO_POINTER (current != NULL);
+ return GINT_TO_POINTER(current != NULL);
}
-
/********************************************************************\
* gnc_reconcile_view_refresh *
* refreshes the view *
@@ -754,7 +754,7 @@ static void
grv_refresh_helper (gpointer key, gpointer value, gpointer user_data)
{
GNCReconcileView *view = user_data;
- GNCQueryView *qview = GNC_QUERY_VIEW (view);
+ GNCQueryView *qview = GNC_QUERY_VIEW(view);
if (!gnc_query_view_item_in_view (qview, key))
g_hash_table_remove (view->reconciled, key);
@@ -763,24 +763,24 @@ grv_refresh_helper (gpointer key, gpointer value, gpointer user_data)
void
gnc_reconcile_view_refresh (GNCReconcileView *view)
{
- GNCQueryView *qview;
- GtkTreeSelection *selection;
- GList *path_list, *node;
+ GNCQueryView *qview;
+ GtkTreeSelection *selection;
+ GList *path_list, *node;
g_return_if_fail (view != NULL);
- g_return_if_fail (GNC_IS_RECONCILE_VIEW (view));
+ g_return_if_fail (GNC_IS_RECONCILE_VIEW(view));
- qview = GNC_QUERY_VIEW (view);
+ qview = GNC_QUERY_VIEW(view);
gnc_query_view_refresh (qview);
/* Ensure last selected split, if any, can be seen */
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (qview));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(qview));
path_list = gtk_tree_selection_get_selected_rows (selection, NULL);
node = g_list_last (path_list);
if (node)
{
GtkTreePath *tree_path = node->data;
- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (qview),
+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(qview),
tree_path, NULL, FALSE, 0.0, 0.0);
}
g_list_free_full (path_list, (GDestroyNotify) gtk_tree_path_free);
@@ -790,7 +790,6 @@ gnc_reconcile_view_refresh (GNCReconcileView *view)
g_hash_table_foreach (view->reconciled, grv_refresh_helper, view);
}
-
/********************************************************************\
* gnc_reconcile_view_reconciled_balance *
* returns the reconciled balance of the view *
@@ -801,7 +800,7 @@ gnc_reconcile_view_refresh (GNCReconcileView *view)
static void
grv_balance_hash_helper (gpointer key, gpointer value, gpointer user_data)
{
- Split *split = key;
+ Split *split = key;
gnc_numeric *total = user_data;
*total = gnc_numeric_add_fixed (*total, xaccSplitGetAmount (split));
@@ -813,7 +812,7 @@ gnc_reconcile_view_reconciled_balance (GNCReconcileView *view)
gnc_numeric total = gnc_numeric_zero ();
g_return_val_if_fail (view != NULL, total);
- g_return_val_if_fail (GNC_IS_RECONCILE_VIEW (view), total);
+ g_return_val_if_fail (GNC_IS_RECONCILE_VIEW(view), total);
if (view->reconciled == NULL)
return total;
@@ -823,7 +822,6 @@ gnc_reconcile_view_reconciled_balance (GNCReconcileView *view)
return gnc_numeric_abs (total);
}
-
/********************************************************************\
* gnc_reconcile_view_commit *
* Commit the reconcile information in the view. Only change the *
@@ -837,7 +835,7 @@ gnc_reconcile_view_reconciled_balance (GNCReconcileView *view)
static void
grv_commit_hash_helper (gpointer key, gpointer value, gpointer user_data)
{
- Split *split = key;
+ Split *split = key;
time64 *date = user_data;
xaccSplitSetReconcile (split, YREC);
@@ -848,17 +846,16 @@ void
gnc_reconcile_view_commit (GNCReconcileView *view, time64 date)
{
g_return_if_fail (view != NULL);
- g_return_if_fail (GNC_IS_RECONCILE_VIEW (view));
+ g_return_if_fail (GNC_IS_RECONCILE_VIEW(view));
if (view->reconciled == NULL)
return;
- gnc_suspend_gui_refresh();
+ gnc_suspend_gui_refresh ();
g_hash_table_foreach (view->reconciled, grv_commit_hash_helper, &date);
- gnc_resume_gui_refresh();
+ gnc_resume_gui_refresh ();
}
-
/********************************************************************\
* gnc_reconcile_view_postpone *
* postpone the reconcile information in the view by setting *
@@ -877,17 +874,17 @@ gnc_reconcile_view_postpone (GNCReconcileView *view)
gpointer entry = NULL;
g_return_if_fail (view != NULL);
- g_return_if_fail (GNC_IS_RECONCILE_VIEW (view));
+ g_return_if_fail (GNC_IS_RECONCILE_VIEW(view));
if (view->reconciled == NULL)
return;
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (GNC_QUERY_VIEW (view)));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW(GNC_QUERY_VIEW(view)));
gtk_tree_model_get_iter_first (model, &iter);
- num_splits = gnc_query_view_get_num_entries (GNC_QUERY_VIEW (view));
+ num_splits = gnc_query_view_get_num_entries (GNC_QUERY_VIEW(view));
- gnc_suspend_gui_refresh();
+ gnc_suspend_gui_refresh ();
for (i = 0; i < num_splits; i++)
{
char recn;
@@ -905,10 +902,9 @@ gnc_reconcile_view_postpone (GNCReconcileView *view)
}
gtk_tree_model_iter_next (model, &iter);
}
- gnc_resume_gui_refresh();
+ gnc_resume_gui_refresh ();
}
-
/********************************************************************\
* gnc_reconcile_view_unselect_all *
* unselect all splits in the view *
@@ -917,15 +913,14 @@ gnc_reconcile_view_postpone (GNCReconcileView *view)
* Returns: nothing *
\********************************************************************/
void
-gnc_reconcile_view_unselect_all(GNCReconcileView *view)
+gnc_reconcile_view_unselect_all (GNCReconcileView *view)
{
g_return_if_fail (view != NULL);
- g_return_if_fail (GNC_IS_RECONCILE_VIEW (view));
+ g_return_if_fail (GNC_IS_RECONCILE_VIEW(view));
- gnc_query_view_unselect_all (GNC_QUERY_VIEW (view));
+ gnc_query_view_unselect_all (GNC_QUERY_VIEW(view));
}
-
/********************************************************************\
* gnc_reconcile_view_changed *
* returns true if any splits have been reconciled *
@@ -937,7 +932,7 @@ gboolean
gnc_reconcile_view_changed (GNCReconcileView *view)
{
g_return_val_if_fail (view != NULL, FALSE);
- g_return_val_if_fail (GNC_IS_RECONCILE_VIEW (view), FALSE);
+ g_return_val_if_fail (GNC_IS_RECONCILE_VIEW(view), FALSE);
return g_hash_table_size (view->reconciled) != 0;
}
diff --git a/gnucash/gnome/reconcile-view.h b/gnucash/gnome/reconcile-view.h
index 12657946b..267154b7f 100644
--- a/gnucash/gnome/reconcile-view.h
+++ b/gnucash/gnome/reconcile-view.h
@@ -30,11 +30,11 @@
G_BEGIN_DECLS
-#define GNC_TYPE_RECONCILE_VIEW (gnc_reconcile_view_get_type ())
-#define GNC_RECONCILE_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_RECONCILE_VIEW, GNCReconcileView))
-#define GNC_RECONCILE_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_RECONCILE_VIEW, GNCReconcileViewClass))
-#define GNC_IS_RECONCILE_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_RECONCILE_VIEW))
-#define GNC_IS_RECONCILE_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_RECONCILE_VIEW))
+#define GNC_TYPE_RECONCILE_VIEW (gnc_reconcile_view_get_type ())
+#define GNC_RECONCILE_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_RECONCILE_VIEW, GNCReconcileView))
+#define GNC_RECONCILE_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_RECONCILE_VIEW, GNCReconcileViewClass))
+#define GNC_IS_RECONCILE_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_RECONCILE_VIEW))
+#define GNC_IS_RECONCILE_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_RECONCILE_VIEW))
typedef struct GNCReconcileView GNCReconcileView;
commit b92b546f4264ac1b89df0e22ba49c59289cfddd9
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Fri Feb 4 11:21:55 2022 +0000
Change source files gnc-query-view.* for space and tabs
diff --git a/gnucash/gnome-utils/gnc-query-view.c b/gnucash/gnome-utils/gnc-query-view.c
index 03c3ac9c6..683b078fe 100644
--- a/gnucash/gnome-utils/gnc-query-view.c
+++ b/gnucash/gnome-utils/gnc-query-view.c
@@ -63,7 +63,8 @@ static guint query_view_signals[LAST_SIGNAL] = {0};
static void gnc_query_view_init (GNCQueryView *qview);
static void gnc_query_view_init_view (GNCQueryView *qview);
static void gnc_query_view_class_init (GNCQueryViewClass *klass);
-static void gnc_query_view_select_row_cb (GtkTreeSelection *selection, gpointer user_data);
+static void gnc_query_view_select_row_cb (GtkTreeSelection *selection,
+ gpointer user_data);
static void gnc_query_view_toggled_cb (GtkCellRendererToggle *cell_renderer,
gchar *path, gpointer user_data);
static void gnc_query_view_double_click_cb (GtkTreeView *tree_view,
@@ -73,7 +74,8 @@ static void gnc_query_view_double_click_cb (GtkTreeView *tree_view,
static void gnc_query_view_destroy (GtkWidget *widget);
static void gnc_query_view_fill (GNCQueryView *qview);
-static void gnc_query_view_set_query_sort (GNCQueryView *qview, gboolean new_column);
+static void gnc_query_view_set_query_sort (GNCQueryView *qview,
+ gboolean new_column);
/********************************************************************\
@@ -99,9 +101,9 @@ gnc_query_view_construct (GNCQueryView *qview, GList *param_list, Query *query)
qview->column_params = param_list;
/* cache the function to get the guid of this query type */
- priv = GNC_QUERY_VIEW_GET_PRIVATE (qview);
- priv->get_guid =
- qof_class_get_parameter (qof_query_get_search_for (query), QOF_PARAM_GUID);
+ priv = GNC_QUERY_VIEW_GET_PRIVATE(qview);
+ priv->get_guid = qof_class_get_parameter (qof_query_get_search_for (query),
+ QOF_PARAM_GUID);
/* Initialize the Tree View */
gnc_query_view_init_view (qview);
@@ -125,10 +127,10 @@ gnc_query_view_new (GList *param_list, Query *query)
/* Add 1 to param_list length for extra pointer column */
columns = g_list_length (param_list) + 1;
- qview = GNC_QUERY_VIEW (g_object_new (gnc_query_view_get_type(), NULL));
+ qview = GNC_QUERY_VIEW(g_object_new (gnc_query_view_get_type (), NULL));
- array_size = sizeof( GType ) * columns;
- types = g_slice_alloc ( array_size );
+ array_size = sizeof(GType) * columns;
+ types = g_slice_alloc (array_size);
types[0] = G_TYPE_POINTER;
@@ -138,7 +140,8 @@ gnc_query_view_new (GList *param_list, Query *query)
GNCSearchParamSimple *param = node->data;
const char *type;
- g_assert (GNC_IS_SEARCH_PARAM_SIMPLE (param));
+ g_assert (GNC_IS_SEARCH_PARAM_SIMPLE(param));
+
type = gnc_search_param_get_param_type ((GNCSearchParam *) param);
if (g_strcmp0 (type, QOF_TYPE_BOOLEAN) == 0)
@@ -149,23 +152,22 @@ gnc_query_view_new (GList *param_list, Query *query)
/* Create the list store and add to treeview */
liststore = gtk_list_store_newv (columns, types );
- gtk_tree_view_set_model (GTK_TREE_VIEW (qview), GTK_TREE_MODEL (liststore));
+ gtk_tree_view_set_model (GTK_TREE_VIEW(qview), GTK_TREE_MODEL(liststore));
g_object_unref (liststore);
/* Free array */
- g_slice_free1( array_size, types );
+ g_slice_free1 (array_size, types);
gnc_query_view_construct (qview, param_list, query);
- return GTK_WIDGET (qview);
+ return GTK_WIDGET(qview);
}
-
void gnc_query_view_reset_query (GNCQueryView *qview, Query *query)
{
g_return_if_fail (qview);
g_return_if_fail (query);
- g_return_if_fail (GNC_IS_QUERY_VIEW (qview));
+ g_return_if_fail (GNC_IS_QUERY_VIEW(qview));
qof_query_destroy (qview->query);
qview->query = qof_query_copy (query);
@@ -173,13 +175,12 @@ void gnc_query_view_reset_query (GNCQueryView *qview, Query *query)
gnc_query_view_set_query_sort (qview, TRUE);
}
-
static void
gnc_query_view_refresh_handler (GHashTable *changes, gpointer user_data)
{
GNCQueryView *qview = (GNCQueryView *)user_data;
g_return_if_fail (qview);
- g_return_if_fail (GNC_IS_QUERY_VIEW (qview));
+ g_return_if_fail (GNC_IS_QUERY_VIEW(qview));
gnc_query_view_set_query_sort (qview, TRUE);
}
@@ -205,25 +206,22 @@ gnc_query_view_init (GNCQueryView *qview)
qview->numeric_abs = FALSE;
qview->numeric_inv_sort = FALSE;
- priv = GNC_QUERY_VIEW_GET_PRIVATE (qview);
- priv->component_id =
- gnc_register_gui_component ("gnc-query-view-cm-class",
- gnc_query_view_refresh_handler,
- NULL, qview);
+ priv = GNC_QUERY_VIEW_GET_PRIVATE(qview);
+ priv->component_id = gnc_register_gui_component ("gnc-query-view-cm-class",
+ gnc_query_view_refresh_handler,
+ NULL, qview);
}
-
static gint
sort_iter_compare_func (GtkTreeModel *model,
- GtkTreeIter *a,
- GtkTreeIter *b,
- gpointer userdata)
+ GtkTreeIter *a,
+ GtkTreeIter *b,
+ gpointer userdata)
{
/* This is really a dummy sort function, it leaves the list as is. */
return 0;
}
-
/********************************************************************\
* gnc_query_sort_order *
* allows the sort order to be specified *
@@ -233,15 +231,15 @@ sort_iter_compare_func (GtkTreeModel *model,
* order - GTK_SORT_ASCENDING or GTK_SORT_DESCENDING *
\********************************************************************/
void
-gnc_query_sort_order ( GNCQueryView *qview, gint column, GtkSortType order)
+gnc_query_sort_order (GNCQueryView *qview, gint column, GtkSortType order)
{
GtkTreeSortable *sortable;
gint sortcol;
g_return_if_fail (qview != NULL);
- g_return_if_fail (GNC_IS_QUERY_VIEW (qview));
+ g_return_if_fail (GNC_IS_QUERY_VIEW(qview));
- sortable = GTK_TREE_SORTABLE (gtk_tree_view_get_model (GTK_TREE_VIEW (qview)));
+ sortable = GTK_TREE_SORTABLE(gtk_tree_view_get_model (GTK_TREE_VIEW(qview)));
if((column > qview->num_columns) || (column == 0) )
sortcol = 1;
@@ -251,17 +249,16 @@ gnc_query_sort_order ( GNCQueryView *qview, gint column, GtkSortType order)
gtk_tree_sortable_set_sort_column_id (sortable, sortcol, order);
}
-
static void
gnc_query_sort_cb (GtkTreeSortable *sortable, gpointer user_data)
{
- GNCQueryView *qview = GNC_QUERY_VIEW (user_data);
+ GNCQueryView *qview = GNC_QUERY_VIEW(user_data);
GtkSortType type;
gint sortcol;
gboolean new_column = FALSE;
g_return_if_fail (qview != NULL);
- g_return_if_fail (GNC_IS_QUERY_VIEW (qview));
+ g_return_if_fail (GNC_IS_QUERY_VIEW(qview));
g_return_if_fail (qview->query != NULL);
gtk_tree_sortable_get_sort_column_id (sortable, &sortcol, &type);
@@ -284,11 +281,10 @@ gnc_query_sort_cb (GtkTreeSortable *sortable, gpointer user_data)
gnc_query_view_set_query_sort (qview, new_column);
}
-
static void
gnc_query_view_init_view (GNCQueryView *qview)
{
- GtkTreeView *view = GTK_TREE_VIEW (qview);
+ GtkTreeView *view = GTK_TREE_VIEW(qview);
GtkTreeSortable *sortable;
GtkTreeSelection *selection;
GtkTreeViewColumn *col;
@@ -296,7 +292,7 @@ gnc_query_view_init_view (GNCQueryView *qview)
GList *node;
gint i;
- sortable = GTK_TREE_SORTABLE (gtk_tree_view_get_model (GTK_TREE_VIEW (view)));
+ sortable = GTK_TREE_SORTABLE(gtk_tree_view_get_model (GTK_TREE_VIEW(view)));
/* compute the number of columns and fill in the rest of the view */
qview->num_columns = g_list_length (qview->column_params);
@@ -310,7 +306,7 @@ gnc_query_view_init_view (GNCQueryView *qview)
gfloat algn = 0;
GNCSearchParamSimple *param = node->data;
- g_assert (GNC_IS_SEARCH_PARAM_SIMPLE (param));
+ g_assert (GNC_IS_SEARCH_PARAM_SIMPLE(param));
col = gtk_tree_view_column_new ();
@@ -351,8 +347,9 @@ gnc_query_view_init_view (GNCQueryView *qview)
gtk_tree_view_column_set_clickable (col, TRUE);
/* Add sortable columns */
gtk_tree_view_column_set_sort_column_id (col, i+1);
- gtk_tree_sortable_set_sort_func (sortable, i+1, sort_iter_compare_func,
- GINT_TO_POINTER (i+1), NULL);
+ gtk_tree_sortable_set_sort_func (sortable, i+1,
+ sort_iter_compare_func,
+ GINT_TO_POINTER(i+1), NULL);
}
type = gnc_search_param_get_param_type (((GNCSearchParam *) param));
@@ -364,9 +361,10 @@ gnc_query_view_init_view (GNCQueryView *qview)
/* pack cell renderer toggle into tree view column */
gtk_tree_view_column_pack_start (col, renderer, TRUE);
gtk_tree_view_column_add_attribute (col, renderer, "active", i+1);
- g_object_set (renderer, "xalign", algn, NULL );
- g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (i+1) );
- g_signal_connect (renderer, "toggled", G_CALLBACK (gnc_query_view_toggled_cb), view);
+ g_object_set (renderer, "xalign", algn, NULL);
+ g_object_set_data (G_OBJECT(renderer), "column", GINT_TO_POINTER(i+1));
+ g_signal_connect (renderer, "toggled",
+ G_CALLBACK(gnc_query_view_toggled_cb), view);
}
else
{
@@ -375,8 +373,8 @@ gnc_query_view_init_view (GNCQueryView *qview)
/* pack cell renderer text into tree view column */
gtk_tree_view_column_pack_start (col, renderer, TRUE);
gtk_tree_view_column_add_attribute (col, renderer, "text", i+1);
- g_object_set (renderer, "xalign", algn, NULL );
- g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (i+1) );
+ g_object_set (renderer, "xalign", algn, NULL);
+ g_object_set_data (G_OBJECT(renderer), "column", GINT_TO_POINTER(i+1));
}
}
@@ -385,20 +383,19 @@ gnc_query_view_init_view (GNCQueryView *qview)
gtk_tree_sortable_set_sort_column_id (sortable, 1, GTK_SORT_DESCENDING);
g_signal_connect (sortable, "sort-column-changed",
- G_CALLBACK (gnc_query_sort_cb),
+ G_CALLBACK(gnc_query_sort_cb),
view);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
g_signal_connect (selection, "changed",
- G_CALLBACK (gnc_query_view_select_row_cb),
+ G_CALLBACK(gnc_query_view_select_row_cb),
NULL);
g_signal_connect (view, "row-activated",
- G_CALLBACK (gnc_query_view_double_click_cb),
+ G_CALLBACK(gnc_query_view_double_click_cb),
NULL);
}
-
static void
gnc_query_view_class_init (GNCQueryViewClass *klass)
{
@@ -408,9 +405,9 @@ gnc_query_view_class_init (GNCQueryViewClass *klass)
query_view_signals[COLUMN_TOGGLED] =
g_signal_new("column_toggled",
- G_TYPE_FROM_CLASS (widget_class),
+ G_TYPE_FROM_CLASS(widget_class),
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GNCQueryViewClass, column_toggled),
+ G_STRUCT_OFFSET(GNCQueryViewClass, column_toggled),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE,
@@ -419,9 +416,9 @@ gnc_query_view_class_init (GNCQueryViewClass *klass)
query_view_signals[ROW_SELECTED] =
g_signal_new("row_selected",
- G_TYPE_FROM_CLASS (widget_class),
+ G_TYPE_FROM_CLASS(widget_class),
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GNCQueryViewClass, row_selected),
+ G_STRUCT_OFFSET(GNCQueryViewClass, row_selected),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE,
@@ -430,9 +427,9 @@ gnc_query_view_class_init (GNCQueryViewClass *klass)
query_view_signals[DOUBLE_CLICK_ENTRY] =
g_signal_new("double_click_entry",
- G_TYPE_FROM_CLASS (widget_class),
+ G_TYPE_FROM_CLASS(widget_class),
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GNCQueryViewClass, double_click_entry),
+ G_STRUCT_OFFSET(GNCQueryViewClass, double_click_entry),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE,
@@ -446,18 +443,16 @@ gnc_query_view_class_init (GNCQueryViewClass *klass)
klass->double_click_entry = NULL;
}
-
static void
gnc_query_view_select_row_cb (GtkTreeSelection *selection, gpointer user_data)
{
- GNCQueryView *qview = GNC_QUERY_VIEW (gtk_tree_selection_get_tree_view (selection));
+ GNCQueryView *qview = GNC_QUERY_VIEW(gtk_tree_selection_get_tree_view (selection));
gint number_of_rows = gtk_tree_selection_count_selected_rows (selection);
g_signal_emit (qview, query_view_signals[ROW_SELECTED], 0,
GINT_TO_POINTER(number_of_rows));
}
-
static void
gnc_query_view_double_click_cb (GtkTreeView *view,
GtkTreePath *path,
@@ -469,7 +464,7 @@ gnc_query_view_double_click_cb (GtkTreeView *view,
GtkTreeIter iter;
gpointer entry = NULL;
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW(view));
if (gtk_tree_model_get_iter (model, &iter, path))
gtk_tree_model_get (model, &iter, 0, &entry, -1);
@@ -477,13 +472,12 @@ gnc_query_view_double_click_cb (GtkTreeView *view,
g_signal_emit (qview, query_view_signals[DOUBLE_CLICK_ENTRY], 0, entry);
}
-
static void
gnc_query_view_toggled_cb (GtkCellRendererToggle *cell_renderer,
gchar *path,
gpointer user_data)
{
- GNCQueryView *qview = GNC_QUERY_VIEW (user_data);
+ GNCQueryView *qview = GNC_QUERY_VIEW(user_data);
GtkTreeModel *model;
GtkTreeIter iter;
GtkTreePath *treepath;
@@ -492,15 +486,15 @@ gnc_query_view_toggled_cb (GtkCellRendererToggle *cell_renderer,
gboolean toggled;
gint column;
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (qview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW(qview));
- column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell_renderer),"column"));
+ column = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(cell_renderer), "column"));
toggled = gtk_cell_renderer_toggle_get_active (cell_renderer);
treepath = gtk_tree_path_new_from_string (path);
- if (gtk_tree_model_get_iter(model, &iter, treepath))
+ if (gtk_tree_model_get_iter (model, &iter, treepath))
{
gtk_tree_model_get (model, &iter, 0, &entry, -1);
indices = gtk_tree_path_get_indices (treepath);
@@ -512,16 +506,16 @@ gnc_query_view_toggled_cb (GtkCellRendererToggle *cell_renderer,
else
g_signal_emit (qview, query_view_signals[COLUMN_TOGGLED], 0, GINT_TO_POINTER(1));
}
+ gtk_tree_path_free (treepath);
}
-
static void
gnc_query_view_destroy (GtkWidget *widget)
{
- GNCQueryView *qview = GNC_QUERY_VIEW (widget);
+ GNCQueryView *qview = GNC_QUERY_VIEW(widget);
GNCQueryViewPrivate *priv;
- priv = GNC_QUERY_VIEW_GET_PRIVATE (qview);
+ priv = GNC_QUERY_VIEW_GET_PRIVATE(qview);
if (priv->component_id > 0)
{
gnc_unregister_gui_component (priv->component_id);
@@ -534,24 +528,22 @@ gnc_query_view_destroy (GtkWidget *widget)
qof_query_destroy (qview->query);
qview->query = NULL;
}
- if (GTK_WIDGET_CLASS (parent_class)->destroy)
- GTK_WIDGET_CLASS (parent_class)->destroy (widget);
+ if (GTK_WIDGET_CLASS(parent_class)->destroy)
+ GTK_WIDGET_CLASS(parent_class)->destroy (widget);
}
-
gint
gnc_query_view_get_num_entries (GNCQueryView *qview)
{
GtkTreeModel *model;
g_return_val_if_fail (qview != NULL, 0);
- g_return_val_if_fail (GNC_IS_QUERY_VIEW (qview), 0);
+ g_return_val_if_fail (GNC_IS_QUERY_VIEW(qview), 0);
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (qview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW(qview));
return gtk_tree_model_iter_n_children (model, NULL);
}
-
gpointer
gnc_query_view_get_selected_entry (GNCQueryView *qview)
{
@@ -560,7 +552,7 @@ gnc_query_view_get_selected_entry (GNCQueryView *qview)
gint num_entries = 0;
g_return_val_if_fail (qview != NULL, NULL);
- g_return_val_if_fail (GNC_IS_QUERY_VIEW (qview), NULL);
+ g_return_val_if_fail (GNC_IS_QUERY_VIEW(qview), NULL);
entries = gnc_query_view_get_selected_entry_list (qview);
if (entries)
@@ -602,17 +594,16 @@ gnc_query_view_get_selected_entry_list (GNCQueryView *qview)
GList *entries = NULL;
g_return_val_if_fail (qview != NULL, NULL);
- g_return_val_if_fail (GNC_IS_QUERY_VIEW (qview), NULL);
+ g_return_val_if_fail (GNC_IS_QUERY_VIEW(qview), NULL);
acc_entries.entries = NULL;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (qview));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(qview));
gtk_tree_selection_selected_foreach (selection, accumulate_entries,
&acc_entries);
acc_entries.entries = g_list_reverse (acc_entries.entries);
return acc_entries.entries;
}
-
static void
gnc_query_view_refresh_selected (GNCQueryView *qview, GList *old_entry)
{
@@ -623,15 +614,15 @@ gnc_query_view_refresh_selected (GNCQueryView *qview, GList *old_entry)
gboolean valid;
g_return_if_fail (qview != NULL);
- g_return_if_fail (GNC_IS_QUERY_VIEW (qview));
+ g_return_if_fail (GNC_IS_QUERY_VIEW(qview));
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (qview));
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (qview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW(qview));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(qview));
- if(g_list_length (old_entry) > 0)
+ if (g_list_length (old_entry) > 0)
{
/* Walk the list of old entries */
- for(node = old_entry; node; node = node->next)
+ for (node = old_entry; node; node = node->next)
{
gpointer pointer;
@@ -642,7 +633,7 @@ gnc_query_view_refresh_selected (GNCQueryView *qview, GList *old_entry)
// Walk through the liststore, reading each row
gtk_tree_model_get (model, &iter, 0, &pointer, -1);
- if(pointer == node->data)
+ if (pointer == node->data)
{
gtk_tree_selection_select_iter (selection, &iter);
break;
@@ -653,7 +644,6 @@ gnc_query_view_refresh_selected (GNCQueryView *qview, GList *old_entry)
}
}
-
/********************************************************************\
* gnc_query_view_refresh *
* refreshes the view *
@@ -668,18 +658,17 @@ gnc_query_view_refresh (GNCQueryView *qview)
GList *selected_entries;
g_return_if_fail (qview != NULL);
- g_return_if_fail (GNC_IS_QUERY_VIEW (qview));
+ g_return_if_fail (GNC_IS_QUERY_VIEW(qview));
selected_entries = gnc_query_view_get_selected_entry_list (qview);
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (qview));
- gtk_list_store_clear (GTK_LIST_STORE (model));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW(qview));
+ gtk_list_store_clear (GTK_LIST_STORE(model));
gnc_query_view_fill (qview);
gnc_query_view_refresh_selected (qview, selected_entries);
g_list_free (selected_entries);
}
-
/********************************************************************\
* gnc_query_view_set_query_sort *
* sets the sorting order of entries in the view *
@@ -692,14 +681,15 @@ gnc_query_view_refresh (GNCQueryView *qview)
static void
gnc_query_view_set_query_sort (GNCQueryView *qview, gboolean new_column)
{
- gboolean sort_order = qview->increasing;
- GList *node;
+ gboolean sort_order = qview->increasing;
+ GList *node;
GNCSearchParamSimple *param;
/* Find the column parameter definition */
node = g_list_nth (qview->column_params, qview->sort_column);
param = node->data;
- g_assert (GNC_IS_SEARCH_PARAM_SIMPLE (param));
+
+ g_assert (GNC_IS_SEARCH_PARAM_SIMPLE(param));
/* If we're asked to invert numerics, and if this is a numeric or
* debred column, then invert the sort order.
@@ -730,7 +720,6 @@ gnc_query_view_set_query_sort (GNCQueryView *qview, gboolean new_column)
gnc_query_view_refresh (qview);
}
-
/********************************************************************\
* gnc_query_view_fill *
* Add all items to the list store *
@@ -742,19 +731,19 @@ static void
gnc_query_view_fill (GNCQueryView *qview)
{
GNCQueryViewPrivate *priv;
- GtkTreeModel *model;
- GtkTreeIter iter;
- GList *entries, *item;
- const GncGUID *guid;
- gint i;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GList *entries, *item;
+ const GncGUID *guid;
+ gint i;
/* Clear all watches */
- priv = GNC_QUERY_VIEW_GET_PRIVATE (qview);
+ priv = GNC_QUERY_VIEW_GET_PRIVATE(qview);
gnc_gui_component_clear_watches (priv->component_id);
entries = qof_query_run (qview->query);
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (qview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW(qview));
for (item = entries; item; item = item->next)
{
@@ -764,9 +753,9 @@ gnc_query_view_fill (GNCQueryView *qview)
QofParam *qp = NULL;
/* Add a row to the list store */
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ gtk_list_store_append (GTK_LIST_STORE(model), &iter);
/* Add a pointer to the data in the first column of the list store */
- gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, item->data, -1);
+ gtk_list_store_set (GTK_LIST_STORE(model), &iter, 0, item->data, -1);
for (i = 0, node = qview->column_params; node; node = node->next)
{
@@ -777,14 +766,14 @@ gnc_query_view_fill (GNCQueryView *qview)
gpointer res = item->data;
gchar *qofstring;
- g_assert (GNC_IS_SEARCH_PARAM_SIMPLE (param));
+ g_assert (GNC_IS_SEARCH_PARAM_SIMPLE(param));
converters = gnc_search_param_get_converters (param);
/* Test for boolean type */
if (g_strcmp0 (type, QOF_TYPE_BOOLEAN) == 0)
{
- result = (gboolean) GPOINTER_TO_INT (gnc_search_param_compute_value (param, res));
- gtk_list_store_set (GTK_LIST_STORE (model), &iter, i + 1, result, -1);
+ result = (gboolean) GPOINTER_TO_INT(gnc_search_param_compute_value (param, res));
+ gtk_list_store_set (GTK_LIST_STORE(model), &iter, i + 1, result, -1);
i++;
continue;
}
@@ -798,23 +787,24 @@ gnc_query_view_fill (GNCQueryView *qview)
}
/* Now convert this to a text value for the row */
- if (qp && (g_strcmp0(type, QOF_TYPE_DEBCRED) == 0 || g_strcmp0(type, QOF_TYPE_NUMERIC) == 0))
+ if (qp && (g_strcmp0 (type, QOF_TYPE_DEBCRED) == 0 ||
+ g_strcmp0 (type, QOF_TYPE_NUMERIC) == 0))
{
gnc_numeric (*nfcn)(gpointer, QofParam *) =
(gnc_numeric(*)(gpointer, QofParam *))(qp->param_getfcn);
- gnc_numeric value = nfcn(res, qp);
+ gnc_numeric value = nfcn (res, qp);
if (qview->numeric_abs)
value = gnc_numeric_abs (value);
- gtk_list_store_set (GTK_LIST_STORE (model), &iter, i + 1,
+ gtk_list_store_set (GTK_LIST_STORE(model), &iter, i + 1,
xaccPrintAmount (value, gnc_default_print_info (FALSE)), -1);
}
else
{
qofstring = qof_query_core_to_string (type, res, qp);
- gtk_list_store_set (GTK_LIST_STORE (model), &iter, i + 1, qofstring , -1);
- g_free(qofstring);
+ gtk_list_store_set (GTK_LIST_STORE(model), &iter, i + 1, qofstring , -1);
+ g_free (qofstring);
}
i++;
}
@@ -827,7 +817,6 @@ gnc_query_view_fill (GNCQueryView *qview)
}
}
-
/********************************************************************\
* gnc_query_view_unselect_all *
* unselect all items in the view *
@@ -841,13 +830,12 @@ gnc_query_view_unselect_all (GNCQueryView *qview)
GtkTreeSelection *selection;
g_return_if_fail (qview != NULL);
- g_return_if_fail (GNC_IS_QUERY_VIEW (qview));
+ g_return_if_fail (GNC_IS_QUERY_VIEW(qview));
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (qview));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(qview));
gtk_tree_selection_unselect_all (selection);
}
-
gboolean gnc_query_view_item_in_view (GNCQueryView *qview, gpointer item)
{
GtkTreeModel *model;
@@ -857,9 +845,9 @@ gboolean gnc_query_view_item_in_view (GNCQueryView *qview, gpointer item)
g_return_val_if_fail (qview, FALSE);
g_return_val_if_fail (item, FALSE);
- g_return_val_if_fail (GNC_IS_QUERY_VIEW (qview), FALSE);
+ g_return_val_if_fail (GNC_IS_QUERY_VIEW(qview), FALSE);
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (qview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW(qview));
valid = gtk_tree_model_get_iter_first (model, &iter);
while (valid)
@@ -867,7 +855,7 @@ gboolean gnc_query_view_item_in_view (GNCQueryView *qview, gpointer item)
// Walk through the list, reading each row
gtk_tree_model_get (model, &iter, 0, &pointer, -1);
- if(pointer == item)
+ if (pointer == item)
return TRUE;
valid = gtk_tree_model_iter_next (model, &iter);
@@ -875,12 +863,11 @@ gboolean gnc_query_view_item_in_view (GNCQueryView *qview, gpointer item)
return FALSE;
}
-
void
gnc_query_view_set_numerics (GNCQueryView *qview, gboolean abs, gboolean inv_sort)
{
g_return_if_fail (qview);
- g_return_if_fail (GNC_IS_QUERY_VIEW (qview));
+ g_return_if_fail (GNC_IS_QUERY_VIEW(qview));
qview->numeric_abs = abs;
qview->numeric_inv_sort = inv_sort;
diff --git a/gnucash/gnome-utils/gnc-query-view.h b/gnucash/gnome-utils/gnc-query-view.h
index 9798db0f0..2bf56fe1c 100644
--- a/gnucash/gnome-utils/gnc-query-view.h
+++ b/gnucash/gnome-utils/gnc-query-view.h
@@ -29,8 +29,9 @@
#include "Query.h"
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
#define GNC_TYPE_QUERY_VIEW (gnc_query_view_get_type ())
#define GNC_QUERY_VIEW(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_QUERY_VIEW, GNCQueryView)
@@ -38,84 +39,84 @@ extern "C" {
#define GNC_IS_QUERY_VIEW(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_QUERY_VIEW)
#define GNC_IS_QUERY_VIEW_CLASS(klass) G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_QUERY_VIEW)
- typedef struct _GNCQueryView GNCQueryView;
- typedef struct _GNCQueryViewClass GNCQueryViewClass;
+typedef struct _GNCQueryView GNCQueryView;
+typedef struct _GNCQueryViewClass GNCQueryViewClass;
- struct _GNCQueryView
- {
- GtkTreeView qview;
+struct _GNCQueryView
+{
+ GtkTreeView qview;
- /* Query information */
- Query *query;
+ /* Query information */
+ Query *query;
- /* Select information */
- gint toggled_row;
- gint toggled_column;
+ /* Select information */
+ gint toggled_row;
+ gint toggled_column;
- /* Column information */
- gint num_columns;
- GList *column_params;
+ /* Column information */
+ gint num_columns;
+ GList *column_params;
- /* numeric information */
- gboolean numeric_abs;
- gboolean numeric_inv_sort;
+ /* numeric information */
+ gboolean numeric_abs;
+ gboolean numeric_inv_sort;
- /* Sorting info */
- gint sort_column;
- gboolean increasing;
- };
+ /* Sorting info */
+ gint sort_column;
+ gboolean increasing;
+};
- struct _GNCQueryViewClass
- {
- GtkTreeViewClass view_class;
+struct _GNCQueryViewClass
+{
+ GtkTreeViewClass view_class;
- /* This signal is emitted when a toggle happens, the pointer has
- an integer value for the active setting of the toggle */
- void (*column_toggled) (GNCQueryView *qview, gpointer item);
+ /* This signal is emitted when a toggle happens, the pointer has
+ an integer value for the active setting of the toggle */
+ void (*column_toggled) (GNCQueryView *qview, gpointer item);
- /* This signal is emitted when a row is selected, the pointer has
- an integer value for the number of rows selected */
- void (*row_selected) (GNCQueryView *qview, gpointer item);
+ /* This signal is emitted when a row is selected, the pointer has
+ an integer value for the number of rows selected */
+ void (*row_selected) (GNCQueryView *qview, gpointer item);
- /* This signal is emitted when a row is double clicked, the pointer has
- a pointer to the entry */
- void (*double_click_entry) (GNCQueryView *qview, gpointer entry);
- };
+ /* This signal is emitted when a row is double clicked, the pointer has
+ a pointer to the entry */
+ void (*double_click_entry) (GNCQueryView *qview, gpointer entry);
+};
- /***********************************************************
- * public functions *
- ***********************************************************/
+/***********************************************************
+ * public functions *
+ ***********************************************************/
- GType gnc_query_view_get_type (void);
+GType gnc_query_view_get_type (void);
- /* The param_list remains owned by the caller but is used by the
- * query-view; do not destroy it until you destroy this query-view.
- * The query will be copied by the query-view so the caller may do
- * whatever they want.
- */
- GtkWidget * gnc_query_view_new (GList *param_list, Query *query);
+/* The param_list remains owned by the caller but is used by the
+ * query-view; do not destroy it until you destroy this query-view.
+ * The query will be copied by the query-view so the caller may do
+ * whatever they want.
+ */
+GtkWidget * gnc_query_view_new (GList *param_list, Query *query);
- void gnc_query_view_construct (GNCQueryView *qview, GList *param_list, Query *query);
+void gnc_query_view_construct (GNCQueryView *qview, GList *param_list, Query *query);
- void gnc_query_view_reset_query (GNCQueryView *view, Query *query);
+void gnc_query_view_reset_query (GNCQueryView *view, Query *query);
- void gnc_query_view_set_numerics (GNCQueryView *qview, gboolean abs, gboolean inv_sort);
+void gnc_query_view_set_numerics (GNCQueryView *qview, gboolean abs, gboolean inv_sort);
- gint gnc_query_view_get_num_entries (GNCQueryView *qview);
+gint gnc_query_view_get_num_entries (GNCQueryView *qview);
- gpointer gnc_query_view_get_selected_entry (GNCQueryView *qview);
+gpointer gnc_query_view_get_selected_entry (GNCQueryView *qview);
- /** Returns a list of selected entries in the query view.
- * The returned GList should be freed by the caller */
- GList * gnc_query_view_get_selected_entry_list (GNCQueryView *qview);
+/** Returns a list of selected entries in the query view.
+ * The returned GList should be freed by the caller */
+GList * gnc_query_view_get_selected_entry_list (GNCQueryView *qview);
- void gnc_query_view_refresh (GNCQueryView *qview);
+void gnc_query_view_refresh (GNCQueryView *qview);
- void gnc_query_view_unselect_all (GNCQueryView *qview);
+void gnc_query_view_unselect_all (GNCQueryView *qview);
- gboolean gnc_query_view_item_in_view (GNCQueryView *qview, gpointer item);
+gboolean gnc_query_view_item_in_view (GNCQueryView *qview, gpointer item);
- void gnc_query_sort_order (GNCQueryView *qview, gint column, GtkSortType order);
+void gnc_query_sort_order (GNCQueryView *qview, gint column, GtkSortType order);
#ifdef __cplusplus
}
Summary of changes:
gnucash/gnome-utils/gnc-query-view.c | 280 +++++++++++--------
gnucash/gnome-utils/gnc-query-view.h | 122 +++++----
gnucash/gnome-utils/search-param.c | 188 +++++++------
gnucash/gnome-utils/search-param.h | 137 +++++-----
gnucash/gnome/reconcile-view.c | 510 +++++++++++++++++++++--------------
gnucash/gnome/reconcile-view.h | 12 +-
6 files changed, 716 insertions(+), 533 deletions(-)
More information about the gnucash-changes
mailing list