Realign source files gnc-tree-view-sx-list.*

This commit is contained in:
Robert Fewell 2023-11-15 10:10:14 +00:00
parent 631ac2b371
commit 5df19f4985
2 changed files with 63 additions and 62 deletions

View File

@ -4,19 +4,20 @@
**/
/********************************************************************
* This program is free software; you can redistribute it and/or *
* modify it under the terms of version 2 and/or version 3 of the GNU General Public *
* modify it under the terms of version 2 and/or version 3 of the *
* GNU General Public *
* License as published by the Free Software Foundation. *
*
* As a special exception, permission is granted to link the binary
* module resultant from this code with the OpenSSL project's
* "OpenSSL" library (or modified versions of it that use the same
* license as the "OpenSSL" library), and distribute the linked
* executable. You must obey the GNU General Public License in all
* respects for all of the code used other than "OpenSSL". If you
* modify this file, you may extend this exception to your version
* of the file, but you are not obligated to do so. If you do not
* wish to do so, delete this exception statement from your version
* of this file.
* *
* As a special exception, permission is granted to link the binary *
* module resultant from this code with the OpenSSL project's *
* "OpenSSL" library (or modified versions of it that use the same *
* license as the "OpenSSL" library), and distribute the linked *
* executable. You must obey the GNU General Public License in all *
* respects for all of the code used other than "OpenSSL". If you *
* modify this file, you may extend this exception to your version *
* of the file, but you are not obligated to do so. If you do not *
* wish to do so, delete this exception statement from your version *
* of this file. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
@ -47,8 +48,8 @@ static QofLogModule log_module = LOG_MOD;
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN LOG_MOD
static void gnc_tree_view_sx_list_dispose(GObject *object);
static void gnc_tree_view_sx_list_finalize(GObject *object);
static void gnc_tree_view_sx_list_dispose (GObject *object);
static void gnc_tree_view_sx_list_finalize (GObject *object);
struct _GncTreeViewSxList
{
@ -61,12 +62,9 @@ struct _GncTreeViewSxList
G_DEFINE_TYPE(GncTreeViewSxList, gnc_tree_view_sx_list, GNC_TYPE_TREE_VIEW)
static void
gnc_tree_view_sx_list_class_init(GncTreeViewSxListClass *klass)
gnc_tree_view_sx_list_class_init (GncTreeViewSxListClass *klass)
{
GObjectClass *o_class;
o_class = G_OBJECT_CLASS (klass);
GObjectClass *o_class = G_OBJECT_CLASS(klass);
o_class->dispose = gnc_tree_view_sx_list_dispose;
o_class->finalize = gnc_tree_view_sx_list_finalize;
@ -79,81 +77,81 @@ gnc_tree_view_sx_list_init (GncTreeViewSxList *view)
}
static void
gnc_tree_view_sx_list_dispose(GObject *object)
gnc_tree_view_sx_list_dispose (GObject *object)
{
GncTreeViewSxList *view;
gnc_leave_return_if_fail (object != NULL);
gnc_leave_return_if_fail (GNC_IS_TREE_VIEW_SX_LIST (object));
gnc_leave_return_if_fail (GNC_IS_TREE_VIEW_SX_LIST(object));
view = GNC_TREE_VIEW_SX_LIST (object);
view = GNC_TREE_VIEW_SX_LIST(object);
if (view->disposed)
return;
view->disposed = TRUE;
g_object_unref(G_OBJECT(view->tree_model));
g_object_unref (G_OBJECT(view->tree_model));
view->tree_model = NULL;
G_OBJECT_CLASS (gnc_tree_view_sx_list_parent_class)->dispose (object);
G_OBJECT_CLASS(gnc_tree_view_sx_list_parent_class)->dispose (object);
}
static void
gnc_tree_view_sx_list_finalize(GObject *object)
{
gnc_leave_return_if_fail(object != NULL);
gnc_leave_return_if_fail(GNC_IS_TREE_VIEW_SX_LIST (object));
gnc_leave_return_if_fail (object != NULL);
gnc_leave_return_if_fail (GNC_IS_TREE_VIEW_SX_LIST(object));
G_OBJECT_CLASS(gnc_tree_view_sx_list_parent_class)->finalize (object);
}
GtkTreeView*
gnc_tree_view_sx_list_new(GncSxInstanceModel *sx_instances)
gnc_tree_view_sx_list_new (GncSxInstanceModel *sx_instances)
{
GncTreeViewSxList *view = (GncTreeViewSxList*)g_object_new(GNC_TYPE_TREE_VIEW_SX_LIST, NULL);
g_object_set(view, "name", "gnc-id-sx-list-tree", NULL);
GncTreeViewSxList *view = (GncTreeViewSxList*)g_object_new (GNC_TYPE_TREE_VIEW_SX_LIST, NULL);
g_object_set (view, "name", "gnc-id-sx-list-tree", NULL);
view->tree_model = GTK_TREE_MODEL(gnc_sx_list_tree_model_adapter_new(sx_instances));
gtk_tree_view_set_model (GTK_TREE_VIEW (view), GTK_TREE_MODEL(view->tree_model));
view->tree_model = GTK_TREE_MODEL(gnc_sx_list_tree_model_adapter_new (sx_instances));
gtk_tree_view_set_model (GTK_TREE_VIEW(view), GTK_TREE_MODEL(view->tree_model));
GtkTreeViewColumn *col = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Name"), "name", NULL,
"Semi-Monthly Paycheck",
SXLTMA_COL_NAME, -1, NULL);
g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
GtkTreeViewColumn *col = gnc_tree_view_add_text_column (GNC_TREE_VIEW(view), _("Name"), "name", NULL,
"Semi-Monthly Paycheck",
SXLTMA_COL_NAME, -1, NULL);
g_object_set_data (G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
col = gnc_tree_view_add_toggle_column(GNC_TREE_VIEW(view), _("Enabled"),
C_("Single-character short column-title form of 'Enabled'", "E"),
"enabled", SXLTMA_COL_ENABLED,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
NULL, NULL);
g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
col = gnc_tree_view_add_toggle_column (GNC_TREE_VIEW(view), _("Enabled"),
C_("Single-character short column-title form of 'Enabled'", "E"),
"enabled", SXLTMA_COL_ENABLED,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
NULL, NULL);
g_object_set_data (G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
col = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Frequency"), "frequency", NULL,
"Weekly (x3): -------",
SXLTMA_COL_FREQUENCY, -1, NULL);
g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
col = gnc_tree_view_add_text_column (GNC_TREE_VIEW(view), _("Frequency"), "frequency", NULL,
"Weekly (x3): -------",
SXLTMA_COL_FREQUENCY, -1, NULL);
g_object_set_data (G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
col = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Last Occur"), "last-occur", NULL,
"2007-01-02",
SXLTMA_COL_LAST_OCCUR, -1, NULL);
g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
col = gnc_tree_view_add_text_column (GNC_TREE_VIEW(view), _("Last Occur"), "last-occur", NULL,
"2007-01-02",
SXLTMA_COL_LAST_OCCUR, -1, NULL);
g_object_set_data (G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
col = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Next Occur"), "next-occur", NULL,
"2007-01-02",
SXLTMA_COL_NEXT_OCCUR, -1, NULL);
g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
col = gnc_tree_view_add_text_column (GNC_TREE_VIEW(view), _("Next Occur"), "next-occur", NULL,
"2007-01-02",
SXLTMA_COL_NEXT_OCCUR, -1, NULL);
g_object_set_data (G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
gnc_tree_view_configure_columns(GNC_TREE_VIEW(view));
gnc_tree_view_configure_columns (GNC_TREE_VIEW(view));
gtk_widget_show(GTK_WIDGET(view));
gtk_widget_show (GTK_WIDGET(view));
return GTK_TREE_VIEW(view);
}
SchedXaction*
gnc_tree_view_sx_list_get_sx_from_path(GncTreeViewSxList *view, GtkTreePath *path)
gnc_tree_view_sx_list_get_sx_from_path (GncTreeViewSxList *view, GtkTreePath *path)
{
GtkTreeIter iter;
gtk_tree_model_get_iter(GTK_TREE_MODEL(view->tree_model), &iter, path);
gtk_tree_model_get_iter (GTK_TREE_MODEL(view->tree_model), &iter, path);
return gnc_sx_list_tree_model_adapter_get_sx_instances(
GNC_SX_LIST_TREE_MODEL_ADAPTER(view->tree_model), &iter)->sx;
}

View File

@ -7,7 +7,8 @@
**/
/********************************************************************
* This program is free software; you can redistribute it and/or *
* modify it under the terms of version 2 and/or version 3 of the GNU General Public *
* modify it under the terms of version 2 and/or version 3 of the *
* GNU General Public *
* License as published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
@ -37,12 +38,14 @@
G_BEGIN_DECLS
#define GNC_TYPE_TREE_VIEW_SX_LIST (gnc_tree_view_sx_list_get_type ())
G_DECLARE_FINAL_TYPE (GncTreeViewSxList, gnc_tree_view_sx_list, GNC, TREE_VIEW_SX_LIST, GncTreeView)
#define GNC_TYPE_TREE_VIEW_SX_LIST (gnc_tree_view_sx_list_get_type ())
G_DECLARE_FINAL_TYPE (GncTreeViewSxList, gnc_tree_view_sx_list,
GNC, TREE_VIEW_SX_LIST, GncTreeView)
GtkTreeView* gnc_tree_view_sx_list_new(GncSxInstanceModel *sx_instances);
GtkTreeView* gnc_tree_view_sx_list_new (GncSxInstanceModel *sx_instances);
SchedXaction* gnc_tree_view_sx_list_get_sx_from_path(GncTreeViewSxList *view, GtkTreePath *path);
SchedXaction* gnc_tree_view_sx_list_get_sx_from_path (GncTreeViewSxList *view,
GtkTreePath *path);
/** @} */