GnuCash 2.3.0
Data Structures | Modules | Files | Defines | Typedefs | Enumerations | Functions | Variables
GUI

Data Structures

struct  _GncPeriodSelectPrivate
struct  GncPeriodSelect
struct  GncPeriodSelectClass
struct  GncTreeViewSxList
struct  GncTreeViewSxListClass
struct  GncTreeView
struct  GncTreeViewClass

Modules

 Window/Plugin Structure
 Dialogs
 Druids
 Utility functions for the GnuCash GUI
 Auto-complete typed user input.
 Creating and editing accounts in the GUI
 Commodity windows
 GncCurrencyEdit
 Gnome-specific GUI handling.
 GUIUtility
 GnuCash Tree Model
 GncTreeView
 Registers, Ledgers and Journals
 Reports

Files

file  gnc-accounting-period.c
 

General utilities for dealing with accounting periods.


file  gnc-accounting-period.h
 

General utilities for dealing with accounting periods.


file  dialog-book-close.h
file  dialog-file-access.h
file  dialog-object-references.h
file  gnc-period-select.c
 

A custom widget for selecting accounting periods.


file  gnc-period-select.h
 

A custom widget for selecting accounting periods.


file  gnc-tree-view-sx-list.h
 

GncTreeView implementation for Scheduled Transaction List.


file  gnc-tree-view.h
 

common utilities for manipulating a GtkTreeView within gnucash


Defines

#define GCONF_SECTION   "window/pages/account_tree/summary"
#define KEY_START_CHOICE   "start_choice"
#define KEY_START_DATE   "start_date"
#define KEY_START_PERIOD   "start_period"
#define KEY_END_CHOICE   "end_choice"
#define KEY_END_DATE   "end_date"
#define KEY_END_PERIOD   "end_period"
#define GNC_PERIOD_SELECT_GET_PRIVATE(o)   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PERIOD_SELECT, GncPeriodSelectPrivate))
#define GNC_TYPE_PERIOD_SELECT   (gnc_period_select_get_type())
#define GNC_PERIOD_SELECT(o)   (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_PERIOD_SELECT, GncPeriodSelect))
#define GNC_PERIOD_SELECT_CLASS(k)   (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_PERIOD_SELECT, GncPeriodSelectClass))
#define GNC_IS_PERIOD_SELECT(o)   (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_PERIOD_SELECT))
#define GNC_TYPE_TREE_VIEW_SX_LIST   (gnc_tree_view_sx_list_get_type ())
#define GNC_TREE_VIEW_SX_LIST(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_VIEW_SX_LIST, GncTreeViewSxList))
#define GNC_TREE_VIEW_SX_LIST_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_VIEW_SX_LIST, GncTreeViewSxListClass))
#define GNC_IS_TREE_VIEW_SX_LIST(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_VIEW_SX_LIST))
#define GNC_IS_TREE_VIEW_SX_LIST_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_VIEW_SX_LIST))
#define GNC_TREE_VIEW_SX_LIST_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_VIEW_SX_LIST, GncTreeViewSxListClass))
#define GNC_TYPE_TREE_VIEW   (gnc_tree_view_get_type ())
#define GNC_TREE_VIEW(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_VIEW, GncTreeView))
#define GNC_TREE_VIEW_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_VIEW, GncTreeViewClass))
#define GNC_IS_TREE_VIEW(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_VIEW))
#define GNC_IS_TREE_VIEW_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_VIEW))
#define GNC_TREE_VIEW_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_VIEW, GncTreeViewClass))
#define GNC_TREE_VIEW_NAME   "GncTreeView"
#define ALWAYS_VISIBLE   "always-visible"
#define DEFAULT_VISIBLE   "default-visible"
#define GNC_TREE_VIEW_COLUMN_DATA_NONE   -1
#define GNC_TREE_VIEW_COLUMN_COLOR_NONE   -1
#define GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS   -1

Typedefs

typedef struct
_GncPeriodSelectPrivate 
GncPeriodSelectPrivate
typedef void(* renderer_toggled )(GtkCellRendererToggle *cell_renderer_toggle, const gchar *path, gpointer user_data)

Enumerations

enum  GncAccountingPeriod {
  GNC_ACCOUNTING_PERIOD_TODAY, GNC_ACCOUNTING_PERIOD_MONTH, GNC_ACCOUNTING_PERIOD_MONTH_PREV, GNC_ACCOUNTING_PERIOD_QUARTER,
  GNC_ACCOUNTING_PERIOD_QUARTER_PREV, GNC_ACCOUNTING_PERIOD_CYEAR, GNC_ACCOUNTING_PERIOD_CYEAR_PREV, GNC_ACCOUNTING_PERIOD_CYEAR_LAST,
  GNC_ACCOUNTING_PERIOD_FYEAR = GNC_ACCOUNTING_PERIOD_CYEAR_LAST, GNC_ACCOUNTING_PERIOD_FYEAR_PREV, GNC_ACCOUNTING_PERIOD_FYEAR_LAST, GNC_ACCOUNTING_PERIOD_LAST = GNC_ACCOUNTING_PERIOD_FYEAR_LAST
}
enum  { PROP_0, PROP_FY_END, PROP_SHOW_DATE, PROP_DATE_BASE }
enum  { CHANGED, LAST_SIGNAL }

Functions

void gnc_ui_close_book (QofBook *book)
void gnc_ui_file_access_for_open (void)
void gnc_ui_file_access_for_save_as (void)
void gnc_ui_file_access_for_export (void)
void gnc_ui_object_references_show (const gchar *explanation, GList *objlist)
void gnc_period_select_set_active (GncPeriodSelect *period, GncAccountingPeriod which)
GncAccountingPeriod gnc_period_select_get_active (GncPeriodSelect *period)
GDate * gnc_period_select_get_date (GncPeriodSelect *period)
time_t gnc_period_select_get_time (GncPeriodSelect *period)
GType gnc_tree_view_sx_list_get_type (void)
GtkTreeView * gnc_tree_view_sx_list_new (GncSxInstanceModel *sx_instances)
SchedXactiongnc_tree_view_sx_list_get_sx_from_path (GncTreeViewSxList *view, GtkTreePath *path)
GType gnc_tree_view_get_type (void)

Variables

const gchar * start_strings [GNC_ACCOUNTING_PERIOD_LAST]
const gchar * end_strings [GNC_ACCOUNTING_PERIOD_LAST]

Accounting Periods

time_t gnc_accounting_period_fiscal_start (void)
time_t gnc_accounting_period_fiscal_end (void)
GDate * gnc_accounting_period_start_gdate (GncAccountingPeriod which, const GDate *fy_end, const GDate *contains)
time_t gnc_accounting_period_start_timet (GncAccountingPeriod which, const GDate *fy_end, const GDate *contains)
GDate * gnc_accounting_period_end_gdate (GncAccountingPeriod which, const GDate *fy_end, const GDate *contains)
time_t gnc_accounting_period_end_timet (GncAccountingPeriod which, const GDate *fy_end, const GDate *contains)

GncPeriodSelect Properties

GDate * gnc_period_select_get_fy_end (GncPeriodSelect *period)
void gnc_period_select_set_fy_end (GncPeriodSelect *period, const GDate *fy_end)
gboolean gnc_period_select_get_show_date (GncPeriodSelect *period)
void gnc_period_select_set_show_date (GncPeriodSelect *period, const gboolean show_date)
GDate * gnc_period_select_get_date_base (GncPeriodSelect *period)
void gnc_period_select_set_date_base (GncPeriodSelect *period, const GDate *date_base)

GncPeriodSelect Core Implementation

GType gnc_period_select_get_type (void)
GtkWidget * gnc_period_select_new (gboolean starting_labels)
GtkWidget * gnc_period_select_new_glade (gchar *widget_name, gchar *string1, gchar *string2, gint int1, gint int2)

GncPeriodSelect Widget Implementation

void gnc_period_select_changed (GncPeriodSelect *period)

Tree View Creation

GtkTreeViewColumn * gnc_tree_view_add_toggle_column (GncTreeView *view, const gchar *column_title, const gchar *column_short_title, const gchar *pref_name, gint model_data_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn, renderer_toggled toggle_edited_cb)
GtkTreeViewColumn * gnc_tree_view_add_text_column (GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *stock_icon_name, const gchar *sizing_text, gint model_data_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn)
GtkTreeViewColumn * gnc_tree_view_add_combo_column (GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *sizing_text, gint model_data_column, gint model_visibility_column, GtkTreeModel *combo_tree_model, gint combo_model_text_column, GtkTreeIterCompareFunc column_sort_fn)
GtkTreeViewColumn * gnc_tree_view_add_numeric_column (GncTreeView *view, const gchar *column_title, const gchar *pref_name, const gchar *sizing_text, gint model_data_column, gint model_color_column, gint model_visibility_column, GtkTreeIterCompareFunc column_sort_fn)
gint gnc_tree_view_append_column (GncTreeView *view, GtkTreeViewColumn *column)

Tree View Properties

void gnc_tree_view_set_model (GncTreeView *view, GtkTreeModel *model)
void gnc_tree_view_configure_columns (GncTreeView *view)
GtkTreeViewColumn * gnc_tree_view_find_column_by_name (GncTreeView *view, const gchar *wanted)
void gnc_tree_view_set_gconf_section (GncTreeView *view, const gchar *section)
const gchar * gnc_tree_view_get_gconf_section (GncTreeView *view)
void gnc_tree_view_expand_columns (GncTreeView *view, gchar *first_column_name,...)
void gnc_tree_view_set_show_column_menu (GncTreeView *view, gboolean visible)
gboolean gnc_tree_view_get_show_column_menu (GncTreeView *view)
GtkCellRenderer * gnc_tree_view_column_get_renderer (GtkTreeViewColumn *column)
void gnc_tree_view_keynav (GncTreeView *view, GtkTreeViewColumn **col, GtkTreePath *path, GdkEventKey *event)
gboolean gnc_tree_view_path_is_valid (GncTreeView *view, GtkTreePath *path)

Detailed Description

gnc-plugin-page-report.h -- A GncPlugin page for a report.

Copyright (C) 2004 Joshua Sled Author: Joshua Sled <jsled@asynchronous.org>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, contact:

Free Software Foundation Voice: +1-617-542-5942 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 Boston, MA 02110-1301, USA gnu@gnu.org


Typedef Documentation

Private Data Structure

Definition at line 100 of file gnc-period-select.c.


Enumeration Type Documentation

This specifies a time interval.

Definition at line 53 of file gnc-accounting-period.h.

{
    GNC_ACCOUNTING_PERIOD_TODAY,
    GNC_ACCOUNTING_PERIOD_MONTH,
    GNC_ACCOUNTING_PERIOD_MONTH_PREV,
    GNC_ACCOUNTING_PERIOD_QUARTER,
    GNC_ACCOUNTING_PERIOD_QUARTER_PREV,
    GNC_ACCOUNTING_PERIOD_CYEAR,
    GNC_ACCOUNTING_PERIOD_CYEAR_PREV,
    GNC_ACCOUNTING_PERIOD_CYEAR_LAST,

    GNC_ACCOUNTING_PERIOD_FYEAR = GNC_ACCOUNTING_PERIOD_CYEAR_LAST,
    GNC_ACCOUNTING_PERIOD_FYEAR_PREV,
    GNC_ACCOUNTING_PERIOD_FYEAR_LAST,
    GNC_ACCOUNTING_PERIOD_LAST = GNC_ACCOUNTING_PERIOD_FYEAR_LAST,
} GncAccountingPeriod;

Function Documentation

GDate * gnc_accounting_period_end_gdate ( GncAccountingPeriod  which,
const GDate *  fy_end,
const GDate *  contains 
)

This function returns the ending date for an accounting period. The date will be computed based upon the type of accounting interval requested, an optional fiscal year end value, and an optional time value.

Parameters:
whichAn enum specifying the type of accounting period.
fy_endThis argument specifies the month and day of the fiscal year end. If the accounting period specified in the 'which' parameter is not a fiscal accounting period, this variable is ignored and may be NULL. Note: the year field of this argument is always ignored.
containsThis argument specifies the origin time value used by the calculations in this function. If this value is NULL, the origin will be the current time.
Returns:
The final day of the specified time interval, as a GDate.

Definition at line 256 of file gnc-accounting-period.c.

{
    GDate *date;

    if (contains)
    {
        date = g_date_new_dmy(g_date_get_day(contains),
                              g_date_get_month(contains),
                              g_date_get_year(contains));
    }
    else
    {
        date = g_date_new();
        g_date_set_time_t(date, time(NULL));
    }

    switch (which)
    {
    default:
        g_message("Undefined relative time constant %d", which);
        g_date_free(date);
        return 0;

    case GNC_ACCOUNTING_PERIOD_TODAY:
        /* Already have today's date */
        break;

    case GNC_ACCOUNTING_PERIOD_MONTH:
        gnc_gdate_set_month_end(date);
        break;

    case GNC_ACCOUNTING_PERIOD_MONTH_PREV:
        gnc_gdate_set_prev_month_end(date);
        break;

    case GNC_ACCOUNTING_PERIOD_QUARTER:
        gnc_gdate_set_quarter_end(date);
        break;

    case GNC_ACCOUNTING_PERIOD_QUARTER_PREV:
        gnc_gdate_set_prev_quarter_end(date);
        break;

    case GNC_ACCOUNTING_PERIOD_CYEAR:
        gnc_gdate_set_year_end(date);
        break;

    case GNC_ACCOUNTING_PERIOD_CYEAR_PREV:
        gnc_gdate_set_prev_year_end(date);
        break;

    case GNC_ACCOUNTING_PERIOD_FYEAR:
        if (fy_end == NULL)
        {
            g_message("Request for fisal year value but no fiscal year end value provided.");
            g_date_free(date);
            return 0;
        }
        gnc_gdate_set_fiscal_year_end(date, fy_end);
        break;

    case GNC_ACCOUNTING_PERIOD_FYEAR_PREV:
        if (fy_end == NULL)
        {
            g_message("Request for fisal year value but no fiscal year end value provided.");
            g_date_free(date);
            return 0;
        }
        gnc_gdate_set_prev_fiscal_year_end(date, fy_end);
        break;
    }

    return date;
}
time_t gnc_accounting_period_end_timet ( GncAccountingPeriod  which,
const GDate *  fy_end,
const GDate *  contains 
)

This function returns the ending time for an accounting period. The time will be computed based upon the type of accounting interval requested, an optional fiscal year end value, and an optional time value.

Parameters:
whichAn enum specifying the type of accounting period.
fy_endThis argument specifies the month and day of the fiscal year end. If the accounting period specified in the 'which' parameter is not a fiscal accounting period, this variable is ignored and may be NULL. Note: the year field of this argument is always ignored.
containsThis argument specifies the origin time value used by the calculations in this function. If this value is NULL, the origin will be the current time.
Returns:
The ending second of the specified time interval, based on a zero value of January 1st, 1970.

Definition at line 334 of file gnc-accounting-period.c.

{
    GDate *date;
    time_t secs;

    date = gnc_accounting_period_end_gdate(which, fy_end, contains);
    if (!date)
        return 0;

    secs = gnc_timet_get_day_end_gdate(date);
    g_date_free(date);
    return secs ;
}
GDate * gnc_accounting_period_start_gdate ( GncAccountingPeriod  which,
const GDate *  fy_end,
const GDate *  contains 
)

This function returns the starting date for an accounting period. The date will be computed based upon the type of accounting interval requested, an optional fiscal year end value, and an optional time value.

Parameters:
whichAn enum specifying the type of accounting period.
fy_endThis argument specifies the month and day of the fiscal year end. If the accounting period specified in the 'which' parameter is not a fiscal accounting period, this variable is ignored and may be NULL. Note: the year field of this argument is always ignored.
containsThis argument specifies the origin time value used by the calculations in this function. If this value is NULL, the origin will be the current time.
Returns:
The starting day of the specified time interval, as a GDate.

Definition at line 162 of file gnc-accounting-period.c.

{
    GDate *date;

    if (contains)
    {
        date = g_date_new_dmy(g_date_get_day(contains),
                              g_date_get_month(contains),
                              g_date_get_year(contains));
    }
    else
    {
        date = g_date_new();
        g_date_set_time_t(date, time(NULL));
    }

    switch (which)
    {
    default:
        g_message("Undefined relative time constant %d", which);
        g_date_free(date);
        return NULL;

    case GNC_ACCOUNTING_PERIOD_TODAY:
        /* Already have today's date */
        break;

    case GNC_ACCOUNTING_PERIOD_MONTH:
        gnc_gdate_set_month_start(date);
        break;

    case GNC_ACCOUNTING_PERIOD_MONTH_PREV:
        gnc_gdate_set_prev_month_start(date);
        break;

    case GNC_ACCOUNTING_PERIOD_QUARTER:
        gnc_gdate_set_quarter_start(date);
        break;

    case GNC_ACCOUNTING_PERIOD_QUARTER_PREV:
        gnc_gdate_set_prev_quarter_start(date);
        break;

    case GNC_ACCOUNTING_PERIOD_CYEAR:
        gnc_gdate_set_year_start(date);
        break;

    case GNC_ACCOUNTING_PERIOD_CYEAR_PREV:
        gnc_gdate_set_prev_year_start(date);
        break;

    case GNC_ACCOUNTING_PERIOD_FYEAR:
        if (fy_end == NULL)
        {
            g_message("Request for fisal year value but no fiscal year end value provided.");
            g_date_free(date);
            return NULL;
        }
        gnc_gdate_set_fiscal_year_start(date, fy_end);
        break;

    case GNC_ACCOUNTING_PERIOD_FYEAR_PREV:
        if (fy_end == NULL)
        {
            g_message("Request for fisal year value but no fiscal year end value provided.");
            g_date_free(date);
            return NULL;
        }
        gnc_gdate_set_prev_fiscal_year_start(date, fy_end);
        break;
    }
    return date;
}
time_t gnc_accounting_period_start_timet ( GncAccountingPeriod  which,
const GDate *  fy_end,
const GDate *  contains 
)

This function returns the starting time for an accounting period. The time will be computed based upon the type of accounting interval requested, an optional fiscal year end value, and an optional time value.

Parameters:
whichAn enum specifying the type of accounting period.
fy_endThis argument specifies the month and day of the fiscal year end. If the accounting period specified in the 'which' parameter is not a fiscal accounting period, this variable is ignored and may be NULL. Note: the year field of this argument is always ignored.
containsThis argument specifies the origin time value used by the calculations in this function. If this value is NULL, the origin will be the current time.
Returns:
The starting second of the specified time interval, based on a zero value of January 1st, 1970.

Definition at line 239 of file gnc-accounting-period.c.

{
    GDate *date;
    time_t secs;

    date = gnc_accounting_period_start_gdate(which, fy_end, contains);
    if (!date)
        return 0;

    secs = gnc_timet_get_day_start_gdate(date);
    g_date_free(date);
    return secs;
}
void gnc_period_select_changed ( GncPeriodSelect period)

Tells a GncPeriodSelect object to emit a "changed" signal.

Parameters:
periodThe GncPeriodSelect object that should emit the signal.

Definition at line 124 of file gnc-period-select.c.

{
    g_return_if_fail(GNC_IS_PERIOD_SELECT(period));

    g_signal_emit(G_OBJECT(period), signals[CHANGED], 0);
}
GncAccountingPeriod gnc_period_select_get_active ( GncPeriodSelect period)

Get the currently selected accounting period from a GncPeriodSelect widget. This is used to retrieve the user's selection in the form of an enum.

Parameters:
periodThe selection widget to query.
Returns:
An enum indicating the user's choice of accounting period.

Definition at line 698 of file gnc-period-select.c.

{
    GncPeriodSelectPrivate *priv;

    g_return_val_if_fail(period != NULL, -1);
    g_return_val_if_fail(GNC_IS_PERIOD_SELECT(period), -1);

    priv = GNC_PERIOD_SELECT_GET_PRIVATE(period);
    return gtk_combo_box_get_active(GTK_COMBO_BOX(priv->selector));
}
GDate * gnc_period_select_get_date ( GncPeriodSelect period)

Get the currently selected accounting period choice from a GncPeriodSelect widget. This is used to retrieve the user's selection in the form of a GDate.

Parameters:
periodThe selection widget to query.
Returns:
The starting/ending time.

Definition at line 715 of file gnc-period-select.c.

{
    GncPeriodSelectPrivate *priv;
    GncAccountingPeriod which;

    g_return_val_if_fail(period != NULL, 0);
    g_return_val_if_fail(GNC_IS_PERIOD_SELECT(period), 0);

    priv = GNC_PERIOD_SELECT_GET_PRIVATE(period);
    which = gtk_combo_box_get_active(GTK_COMBO_BOX(priv->selector));
    if (which == -1)
        return NULL;

    if (priv->start)
        return gnc_accounting_period_start_gdate(which, priv->fy_end,
                priv->date_base);
    return gnc_accounting_period_end_gdate(which, priv->fy_end,
                                           priv->date_base);
}
GDate * gnc_period_select_get_fy_end ( GncPeriodSelect period)

Get the current value of the fiscal year end setting from a GncPeriodSelect widget. If the result is NULL then fiscal years are not currently supported.

Parameters:
periodThe GncPeriodSelect widget to query.
Returns:
A pointer to a GDate containing the fiscal year end value, or NULL if no fiscal year end is set. Note that only the month and day fields are valid in the returned GDate.

Definition at line 208 of file gnc-period-select.c.

{
    GncPeriodSelectPrivate *priv;
    priv = GNC_PERIOD_SELECT_GET_PRIVATE(period);

    g_return_val_if_fail(period != NULL, NULL);
    g_return_val_if_fail(GNC_IS_PERIOD_SELECT(period), NULL);

    priv = GNC_PERIOD_SELECT_GET_PRIVATE(period);
    if (!priv->fy_end)
        return NULL;
    return g_date_new_dmy(g_date_get_day(priv->fy_end),
                          g_date_get_month(priv->fy_end),
                          G_DATE_BAD_YEAR);
}
gboolean gnc_period_select_get_show_date ( GncPeriodSelect period)

Get the current value of the "show sample" setting from a GncPeriodSelect widget.

Definition at line 313 of file gnc-period-select.c.

{
    GncPeriodSelectPrivate *priv;

    g_return_val_if_fail(period != NULL, FALSE);
    g_return_val_if_fail(GNC_IS_PERIOD_SELECT(period), FALSE);

    priv = GNC_PERIOD_SELECT_GET_PRIVATE(period);
    return (priv->date_base != NULL);
}
time_t gnc_period_select_get_time ( GncPeriodSelect period)

Get the currently selected accounting period choice from a GncPeriodSelect widget. This is used to retrieve the user's selection in the form of an timestamp.

Parameters:
periodThe selection widget to query.
Returns:
The starting/ending time (in seconds since 1970-01-01) of the accounting period selected by the user.

Definition at line 741 of file gnc-period-select.c.

{
    GncPeriodSelectPrivate *priv;
    GncAccountingPeriod which;

    g_return_val_if_fail(period != NULL, 0);
    g_return_val_if_fail(GNC_IS_PERIOD_SELECT(period), 0);

    priv = GNC_PERIOD_SELECT_GET_PRIVATE(period);
    which = gtk_combo_box_get_active(GTK_COMBO_BOX(priv->selector));
    if (which == -1)
        return 0;

    if (priv->start)
        return gnc_accounting_period_start_timet(which, priv->fy_end,
                priv->date_base);
    return gnc_accounting_period_end_timet(which, priv->fy_end,
                                           priv->date_base);
}
GType gnc_period_select_get_type ( void  )

Returns the GType of a GncPeriodSelect widget.

Definition at line 457 of file gnc-period-select.c.

{
    static GType period_select_type = 0;

    if (period_select_type == 0)
    {
        static const GTypeInfo period_select_info =
        {
            sizeof (GncPeriodSelectClass),
            NULL,
            NULL,
            (GClassInitFunc) gnc_period_select_class_init,
            NULL,
            NULL,
            sizeof (GncPeriodSelect),
            0, /* n_preallocs */
            (GInstanceInitFunc) gnc_period_select_init,
            NULL
        };

        period_select_type = g_type_register_static(GTK_TYPE_HBOX,
                             "GncPeriodSelect",
                             &period_select_info, 0);
    }

    return period_select_type;
}
GtkWidget * gnc_period_select_new ( gboolean  starting_labels)

Create a new GncPeriodSelect widget which is used to select a accounting period like "previous month" or "this year".

Parameters:
starting_labelsIf set to TRUE then all the labels will refer to the "Start of...". If FALSE, labels will refer to "End of...".
Returns:
A newly created GncPeriodSelect widget.

Definition at line 611 of file gnc-period-select.c.

{
    GncPeriodSelectPrivate *priv;
    GncPeriodSelect *period;
    const gchar *label;
    gint i;

    period = g_object_new(GNC_TYPE_PERIOD_SELECT, NULL);

    /* Set up private data structures */
    priv = GNC_PERIOD_SELECT_GET_PRIVATE(period);
    priv->selector   = gtk_combo_box_new_text();
    priv->start      = starting_labels;

    /* Add the internal widgets to the hbox */
    gtk_box_pack_start_defaults(GTK_BOX(period), priv->selector);
    gtk_widget_show(priv->selector);

    /* Find out when the combo box changes */
    g_signal_connect(G_OBJECT(priv->selector), "changed",
                     G_CALLBACK(gnc_period_sample_combobox_changed), period);

    /* Build all the labels except the fiscal year labels */
    for (i = 0; i < GNC_ACCOUNTING_PERIOD_CYEAR_LAST; i++)
    {
        label = starting_labels ? _(start_strings[i]) : _(end_strings[i]);
        gtk_combo_box_append_text(GTK_COMBO_BOX(priv->selector), label);
    }

    /* Track changes to date formatting */
    gnc_gconf_general_register_cb(KEY_DATE_FORMAT,
                                  (GncGconfGeneralCb)gnc_period_sample_new_date_format, period);

    return GTK_WIDGET (period);
}
GtkWidget * gnc_period_select_new_glade ( gchar *  widget_name,
gchar *  string1,
gchar *  string2,
gint  int1,
gint  int2 
)

Create a new GncPeriodSelect widget from a glade file. The int1 argument passed from glade is used to determine whether the widget uses labels for start times or end times. A non-zero int2 argument indicates that an example date should be shown.

Returns:
A newly created GncPeriodSelect widget.

Definition at line 654 of file gnc-period-select.c.

{
    GtkWidget *widget;
    widget = gnc_period_select_new(int1 != 0);
    if (int2)
        gnc_period_select_set_show_date(GNC_PERIOD_SELECT(widget), TRUE);
    gtk_widget_show(widget);
    return widget;
}
void gnc_period_select_set_active ( GncPeriodSelect period,
GncAccountingPeriod  which 
)

Set which item in the GncPeriodSelect is initially selected. This is used to set the initial selection before the widget is shown to the user.

Parameters:
periodThe selection widget to update.
whichThe accounting period that should be selected.

Definition at line 678 of file gnc-period-select.c.

{
    GncPeriodSelectPrivate *priv;

    g_return_if_fail(period != NULL);
    g_return_if_fail(GNC_IS_PERIOD_SELECT(period));
    g_return_if_fail(which >= 0);
    g_return_if_fail(which <  GNC_ACCOUNTING_PERIOD_LAST);

    priv = GNC_PERIOD_SELECT_GET_PRIVATE(period);
    gtk_combo_box_set_active(GTK_COMBO_BOX(priv->selector), which);
}
void gnc_period_select_set_fy_end ( GncPeriodSelect period,
const GDate *  fy_end 
)

Set the fiscal year end on a GncPeriodSelect widget. If set to a value other than NULL then widget will include fiscal accounting period like "this fiscal year".

Parameters:
periodThe GncPeriodSelect widget to update.
fy_endThe new fiscal year end value, or NULL if no fiscal year is set. Note that only the month and day fields need be valid in the provided GDate.

Definition at line 230 of file gnc-period-select.c.

{
    GncPeriodSelectPrivate *priv;
    const gchar *label;
    gint i;

    g_return_if_fail(period != NULL);
    g_return_if_fail(GNC_IS_PERIOD_SELECT(period));

    priv = GNC_PERIOD_SELECT_GET_PRIVATE(period);
    if (priv->fy_end)
        g_date_free(priv->fy_end);

    if (fy_end)
    {
        priv->fy_end = g_date_new_dmy(g_date_get_day(fy_end),
                                      g_date_get_month(fy_end),
                                      G_DATE_BAD_YEAR);
    }
    else
    {
        priv->fy_end = NULL;
    }

    if (fy_end)
    {
        for (i = GNC_ACCOUNTING_PERIOD_CYEAR_LAST; i < GNC_ACCOUNTING_PERIOD_FYEAR_LAST; i++)
        {
            label = priv->start ? _(start_strings[i]) : _(end_strings[i]);
            gtk_combo_box_append_text(GTK_COMBO_BOX(priv->selector), label);
        }
    }
    else
    {
        for (i = GNC_ACCOUNTING_PERIOD_FYEAR_LAST - 1; i >= GNC_ACCOUNTING_PERIOD_FYEAR_LAST; i--)
        {
            gtk_combo_box_remove_text(GTK_COMBO_BOX(priv->selector), i);
        }
    }
}
void gnc_period_select_set_show_date ( GncPeriodSelect period,
const gboolean  show_date 
)

Set the "show sample" setting on a GncPeriodSelect widget. If set to TRUE then a GtkLabel will be used to show the date corresponding to the selected time period.

Definition at line 329 of file gnc-period-select.c.

{
    GDate date;

    g_return_if_fail(period != NULL);
    g_return_if_fail(GNC_IS_PERIOD_SELECT(period));

    if (show_date)
    {
        g_date_clear(&date, 1);
        g_date_set_time_t(&date, time (NULL));
        gnc_period_select_set_date_common(period, &date);
    }
    else
    {
        gnc_period_select_set_date_common(period, NULL);
    }
}
GtkTreeViewColumn* gnc_tree_view_add_combo_column ( GncTreeView view,
const gchar *  column_title,
const gchar *  pref_name,
const gchar *  sizing_text,
gint  model_data_column,
gint  model_visibility_column,
GtkTreeModel *  combo_tree_model,
gint  combo_model_text_column,
GtkTreeIterCompareFunc  column_sort_fn 
)

This function adds a new combobox column to a GncTreeView base view. The parameters it takes in common with gnc_tree_view_add_text_column() behave the same as there. In addition, it will use combo_tree_model as the GtkTreeModel for the combobox, and combo_model_text_column will be the column in the model used for displaying the text in the combobox.

Definition at line 2001 of file gnc-tree-view.c.

{
    GtkTreeViewColumn *column;
    GtkCellRenderer *renderer;
    PangoLayout* layout;
    int default_width, title_width;

    g_return_val_if_fail (GNC_IS_TREE_VIEW(view), NULL);

    column = gtk_tree_view_column_new ();
    gtk_tree_view_column_set_title (column, gettext(column_title));

    /* Set up a renderer and attributes */
    renderer = gtk_cell_renderer_combo_new ();
    gtk_tree_view_column_pack_start (column, renderer, TRUE);

    /* Set renderer attributes controlled by the model */
    if (model_data_column != GNC_TREE_VIEW_COLUMN_DATA_NONE)
        gtk_tree_view_column_add_attribute (column, renderer,
                                            "text", model_data_column);
    if (model_visibility_column != GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS)
        gtk_tree_view_column_add_attribute (column, renderer,
                                            "visible", model_visibility_column);

    /* Default size is the larger of the column title and the sizing text */
    layout = gtk_widget_create_pango_layout (GTK_WIDGET(view), column_title);
    pango_layout_get_pixel_size(layout, &title_width, NULL);
    g_object_unref(layout);
    layout = gtk_widget_create_pango_layout (GTK_WIDGET(view), sizing_text);
    pango_layout_get_pixel_size(layout, &default_width, NULL);
    g_object_unref(layout);
    default_width = MAX(default_width, title_width);
    if (default_width)
        default_width += 10; /* padding on either side */

    gnc_tree_view_column_properties (view, column, pref_name, model_data_column,
                                     default_width, TRUE, column_sort_fn);

    /* Stuff specific to combo */
    if (combo_tree_model)
    {
        g_object_set(G_OBJECT(renderer), "model", combo_tree_model,
                     "text-column", combo_model_text_column, NULL);
    }
    /* TODO: has-entry? */

    gnc_tree_view_append_column (view, column);
    return column;
}
GtkTreeViewColumn* gnc_tree_view_add_numeric_column ( GncTreeView view,
const gchar *  column_title,
const gchar *  pref_name,
const gchar *  sizing_text,
gint  model_data_column,
gint  model_color_column,
gint  model_visibility_column,
GtkTreeIterCompareFunc  column_sort_fn 
)

This function adds a new numeric column to a GncTreeView base view. It takes all the parameters necessary to hook a GtkTreeModel column to a GtkTreeViewColumn. If the tree has a gconf section associated with it, this function also wires up the column so that its visibility and width are remembered. A numeric column is nothing more then a text column with a few extra attributes.

Parameters:
viewA pointer to a generic GncTreeView.
column_titleThe title for this column.
pref_nameThe internal name of this column. This name is used in several functions to look up the column, and it is also used to create the keys used to record the column width and visibility in gconf.
sizing_textA string used to compute the default width of the column. This text is never displayed.
model_data_columnThe index of the GtkTreeModel data column used to determine the data that will be displayed in this column for each row in the view. Use GNC_TREE_VIEW_COLUMN_DATA_NONE if you plan on using an non-model data source for this column.
model_color_columnThe index of the GtkTreeModel data column used to determine the foreground color of any text in this column. It should be used to display negative numbers in red. Use GNC_TREE_VIEW_COLUMN_COLOR_NONE if the text in this column should always be displayed in black.
model_visibility_columnThe index of the GtkTreeModel data column used to determine whether or not a checkbox for each row will be displayed at all. Use GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS if the checkbox should be displayed in all rows.
column_sort_fnThe function that GtkTreeModelSort will call to compare two rows to determine their displayed order.
Returns:
The newly created GtkTreeViewColumn.

This function adds a new numeric column to a GncTreeView base view. It takes all the parameters necessary to hook a GtkTreeModel column to a GtkTreeViewColumn. If the tree has a gconf section associated with it, this function also wires up the column so that its visibility and width are remembered. A numeric column is nothing more then a text column with a few extra attributes.

Parameters are defined in gnc-tree-view.h

Definition at line 2087 of file gnc-tree-view.c.

{
    GtkTreeViewColumn *column;
    GtkCellRenderer *renderer;

    column = gnc_tree_view_add_text_column (view, column_title, pref_name,
                                            NULL, sizing_text, model_data_column,
                                            model_visibility_column,
                                            column_sort_fn);

    renderer = gnc_tree_view_column_get_renderer(column);

    /* Right align the column title and data */
    g_object_set(G_OBJECT(column), "alignment",   1.0, NULL);
    g_object_set(G_OBJECT(renderer), "xalign",   1.0, NULL);

    /* Change the text color */
    if (model_color_column != GNC_TREE_VIEW_COLUMN_COLOR_NONE)
        gtk_tree_view_column_add_attribute (column, renderer,
                                            "foreground", model_color_column);

    return column;
}
GtkTreeViewColumn* gnc_tree_view_add_text_column ( GncTreeView view,
const gchar *  column_title,
const gchar *  pref_name,
const gchar *  stock_icon_name,
const gchar *  sizing_text,
gint  model_data_column,
gint  model_visibility_column,
GtkTreeIterCompareFunc  column_sort_fn 
)

This function adds a new text column to a GncTreeView base view. It takes all the parameters necessary to hook a GtkTreeModel column to a GtkTreeViewColumn. If the tree has a gconf section associated with it, this function also wires up the column so that its visibility and width are remembered.

Parameters:
viewA pointer to a generic GncTreeView.
column_titleThe title for this column.
pref_nameThe internal name of this column. This name is used in several functions to look up the column, and it is also used to create the keys used to record the column width and visibility in gconf.
stock_icon_nameThe name of the stock icon to display to the left of the text in this column. Used for adding icons like the "account" icon to a view. This must be a registered stock icon, not a filename.
sizing_textA string used to compute the default width of the column. This text is never displayed.
model_data_columnThe index of the GtkTreeModel data column used to determine the data that will be displayed in this column for each row in the view. Use GNC_TREE_VIEW_COLUMN_DATA_NONE if you plan on using a non-model data source for this column. This index is connected to the "text" attribute of the cell renderer.
model_visibility_columnThe index of the GtkTreeModel data column used to determine whether or not a checkbox for each row will be displayed at all. Use GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS if the checkbox should be displayed in all rows.
column_sort_fnThe function that GtkTreeModelSort will call to compare two rows to determine their displayed order.
Returns:
The newly created GtkTreeViewColumn.

This function adds a new text column to a GncTreeView base view. It takes all the parameters necessary to hook a GtkTreeModel column to a GtkTreeViewColumn. If the tree has a gconf section associated with it, this function also wires up the column so that its visibility and width are remembered.

Parameters are defined in gnc-tree-view.h

Definition at line 1944 of file gnc-tree-view.c.

{
    GtkTreeViewColumn *column;
    GtkCellRenderer *renderer;
    PangoLayout* layout;
    int default_width, title_width;

    g_return_val_if_fail (GNC_IS_TREE_VIEW(view), NULL);

    column = gtk_tree_view_column_new ();
    gtk_tree_view_column_set_title (column, column_title);

    /* Set up an icon renderer if requested */
    if (stock_icon_name)
    {
        renderer = gtk_cell_renderer_pixbuf_new ();
        g_object_set (renderer, "stock-id", stock_icon_name, NULL);
        gtk_tree_view_column_pack_start (column, renderer, FALSE);
    }

    /* Set up a text renderer and attributes */
    renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_column_pack_start (column, renderer, TRUE);

    /* Set renderer attributes controlled by the model */
    if (model_data_column != GNC_TREE_VIEW_COLUMN_DATA_NONE)
        gtk_tree_view_column_add_attribute (column, renderer,
                                            "text", model_data_column);
    if (model_visibility_column != GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS)
        gtk_tree_view_column_add_attribute (column, renderer,
                                            "visible", model_visibility_column);

    /* Default size is the larger of the column title and the sizing text */
    layout = gtk_widget_create_pango_layout (GTK_WIDGET(view), column_title);
    pango_layout_get_pixel_size(layout, &title_width, NULL);
    g_object_unref(layout);
    layout = gtk_widget_create_pango_layout (GTK_WIDGET(view), sizing_text);
    pango_layout_get_pixel_size(layout, &default_width, NULL);
    g_object_unref(layout);
    default_width = MAX(default_width, title_width);
    if (default_width)
        default_width += 10; /* padding on either side */
    gnc_tree_view_column_properties (view, column, pref_name, model_data_column,
                                     default_width, TRUE, column_sort_fn);

    gnc_tree_view_append_column (view, column);
    return column;
}
GtkTreeViewColumn* gnc_tree_view_add_toggle_column ( GncTreeView view,
const gchar *  column_title,
const gchar *  column_short_title,
const gchar *  pref_name,
gint  model_data_column,
gint  model_visibility_column,
GtkTreeIterCompareFunc  column_sort_fn,
renderer_toggled  toggle_edited_cb 
)

This function adds a new toggle column to a GncTreeView base view. It takes all the parameters necessary to hook a GtkTreeModel column to a GtkTreeViewColumn. It handles creating a tooltip to show the full title name, and setting the sort and edit callback functions. If the tree has a gconf section associated with it, this function also wires up the column so that its visibility and width are remembered.

Parameters:
viewA pointer to a generic GncTreeView.
column_titleThe full title for this column. This will be added as a tooltip what will be displayed when the mouse is hovered over the column title button.
column_short_titleThis is what will actually be displayed as the title of the column. This should be a single character, as anything more will unnecessarily expand the width of the column.
pref_nameThe internal name of this column. This name is used in several functions to look up the column, and it is also used to create the keys used to record the column width and visibility in gconf.
model_data_columnThe index of the GtkTreeModel data column used to determine whether the displayed checkbox for each row will be show as checked or empty. Use GNC_TREE_VIEW_COLUMN_DATA_NONE if you plan on using an non-model data source for this column.
model_visibility_columnThe index of the GtkTreeModel data column used to determine whether or not a checkbox for each row will be displayed at all. Use GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS if the checkbox should be displayed in all rows.
column_sort_fnThe function that GtkTreeModelSort will call to compare two rows to determine their displayed order.
toggle_edited_cbThe function to call when the user toggles the state of a checkbox.
Returns:
The newly created GtkTreeViewColumn.

This function adds a new toggle column to a GncTreeView base view. It takes all the parameters necessary to hook a GtkTreeModel column to a GtkTreeViewColumn. It handles creating a tooltip to show the full title name, and setting the sort and edit callback functions. If the tree has a gconf section associated with it, this function also wires up the column so that its visibility and width are remembered.

Parameters are defined in gnc-tree-view.h

Definition at line 1889 of file gnc-tree-view.c.

{
    GncTreeViewPrivate *priv;
    GtkTreeViewColumn *column;
    GtkCellRenderer *renderer;

    g_return_val_if_fail (GNC_IS_TREE_VIEW(view), NULL);

    priv = GNC_TREE_VIEW_GET_PRIVATE(view);
    renderer = gtk_cell_renderer_toggle_new ();
    column =
        gtk_tree_view_column_new_with_attributes (column_short_title,
                renderer,
                "active", model_data_column,
                NULL);

    /* Add the full title to the object for menu creation */
    g_object_set_data_full(G_OBJECT(column), REAL_TITLE,
                           g_strdup(column_title), g_free);
    if (toggle_edited_cb)
        g_signal_connect(G_OBJECT(renderer), "toggled",
                         G_CALLBACK(toggle_edited_cb), view);

    if (model_visibility_column != GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS)
        gtk_tree_view_column_add_attribute (column, renderer,
                                            "visible", model_visibility_column);


    gnc_tree_view_column_properties (view, column, pref_name, model_data_column,
                                     0, FALSE, column_sort_fn);

    gnc_tree_view_append_column (view, column);

    /* Also add the full title to the object as a tooltip */
    gtk_widget_set_tooltip_text(column->button, column_title);

    return column;
}
gint gnc_tree_view_append_column ( GncTreeView view,
GtkTreeViewColumn *  column 
)

Add a column to a view based upon a GncTreeView. This function knows about the two special columns on the right side of this type of view, and adds the new column before these two columns. You could say that it appends to the data columns and ignores the infrastructure columns.

Parameters:
viewA pointer to a generic GncTreeView.
columnThe column to append.
Returns:
The index of the newly added column.

Add a column to a view based upon a GncTreeView. This function knows about the two special columns on the right side of this type of view, and adds the new column before these two columns. You could say that it appends to the data columns and ignores the infrastructure columns.

Parameters are defined in gnc-tree-view.h

Definition at line 2127 of file gnc-tree-view.c.

{
    GList *columns;
    int n;

    /* There's no easy way to get this number. */
    columns = gtk_tree_view_get_columns(GTK_TREE_VIEW(view));
    n = g_list_length(columns);
    g_list_free(columns);

    /* Ignore the initial two columns (the spacer and the selection menu) */
    if (n >= 2)
        n -= 2;
    return gtk_tree_view_insert_column (GTK_TREE_VIEW(view), column, n);
}
GtkCellRenderer* gnc_tree_view_column_get_renderer ( GtkTreeViewColumn *  column)

Return the "main" cell renderer from a GtkTreeViewColumn added to a GncTreeView my one of the convenience routines.

Parameters:
columnThe tree view column that was added to the GncTreeView
Returns:
The cell renderer in use in the column.

Definition at line 2060 of file gnc-tree-view.c.

{
    GList *renderers;
    GtkCellRenderer *cr = NULL;

    g_return_val_if_fail(GTK_TREE_VIEW_COLUMN(column), NULL);

    /* Get the list of one renderer */
    renderers = gtk_tree_view_column_get_cell_renderers(column);
    if (g_list_length(renderers) > 0)
        cr = GTK_CELL_RENDERER(renderers->data);
    g_list_free(renderers);

    return cr;
}
void gnc_tree_view_configure_columns ( GncTreeView view)

Make all the correct columns visible, respecting their default visibility setting, their "always" visibility setting, and their gconf visibility settings, if managed by gconf.

Parameters:
viewA pointer to an gnc tree view.

Definition at line 1731 of file gnc-tree-view.c.

{
    GncTreeViewPrivate *priv;
    GtkTreeViewColumn *column;
    GList *columns;
    gboolean hide_spacer;

    g_return_if_fail(GNC_IS_TREE_VIEW(view));

    ENTER(" ");

    /* Update the view and gconf */
    columns = gtk_tree_view_get_columns(GTK_TREE_VIEW(view));
    g_list_foreach(columns, (GFunc)gnc_tree_view_update_visibility, view);
    g_list_free(columns);

    priv = GNC_TREE_VIEW_GET_PRIVATE(view);
    if (priv->gconf_section)
        priv->seen_gconf_visibility = TRUE;

    /* If only the first column is visible, hide the spacer and make that
     * column expand. */
    hide_spacer = (gnc_tree_view_count_visible_columns(view) == 1);
    column = gtk_tree_view_get_column(GTK_TREE_VIEW(view), 0);
    gtk_tree_view_column_set_expand(column, hide_spacer);
    gtk_tree_view_column_set_visible(priv->spacer_column, !hide_spacer);
    gtk_tree_view_column_set_visible(priv->selection_column, !hide_spacer);

    LEAVE(" ");
}
GtkTreeViewColumn* gnc_tree_view_find_column_by_name ( GncTreeView view,
const gchar *  wanted 
)

Find a tree column given the "pref name" used with gconf. This function simply runs the list of all (visible and invisible) columns looking for a match. Column names were attached to each column at the time the column was created.

Parameters:
viewThe visible tree widget.
wantedThe "pref name" to find.

Definition at line 498 of file gnc-tree-view.c.

{
    GtkTreeViewColumn *column, *found = NULL;
    GList *column_list, *tmp;
    const gchar *name;

    // ENTER("view %p, wanted %s", view, wanted);
    column_list = gtk_tree_view_get_columns(GTK_TREE_VIEW(view));
    for (tmp = column_list; tmp; tmp = g_list_next(tmp))
    {
        column = tmp->data;
        name = g_object_get_data(G_OBJECT(column), PREF_NAME);
        if (!name || (strcmp(name, wanted) != 0))
            continue;
        found = column;
        break;
    }
    g_list_free(column_list);

    // LEAVE("column %p", found);
    return found;
}
const gchar* gnc_tree_view_get_gconf_section ( GncTreeView view)

This function is called to get the current association between a gconf section and the display of a view. It returns the same value passed to gnc_tree_view_set_gconf_section(); i.e. a string like "dialogs/edit_prices".

Parameters:
viewThe tree view.
Returns:
The current gconf section. This is everything after "/apps/gnucash". I.E "dialogs/edit_prices".

This function is called to get the current association between a gconf section and the display of a view. It returns the same value passed to gnc_tree_view_set_gconf_section(); i.e. a string like "dialogs/edit_prices".

Parameters are defined in gnc-tree-view.h

Definition at line 1320 of file gnc-tree-view.c.

{
    GncTreeViewPrivate *priv;

    g_return_val_if_fail(GNC_IS_TREE_VIEW(view), NULL);

    priv = GNC_TREE_VIEW_GET_PRIVATE(view);
    return(priv->gconf_section);
}
gboolean gnc_tree_view_get_show_column_menu ( GncTreeView view)

This function is called to get the current value of the "show-column-menu" property. It returns the same value passed to gnc_tree_view_set_show_menu_column().

Parameters:
viewThe tree view.
Returns:
Whether or not the column selection menu should be shown.

This function is called to get the current value of the "show-column-menu" property. It returns the same value passed to gnc_tree_view_set_show_menu_column().

Parameters are defined in gnc-tree-view.h

Definition at line 1660 of file gnc-tree-view.c.

{
    GncTreeViewPrivate *priv;

    g_return_val_if_fail(GNC_IS_TREE_VIEW(view), FALSE);

    priv = GNC_TREE_VIEW_GET_PRIVATE(view);
    return(priv->show_column_menu);
}
GType gnc_tree_view_get_type ( void  )

Create a new glib type for the base gnucash tree view.

Definition at line 157 of file gnc-tree-view.c.

{
    static GType gnc_tree_view_type = 0;

    if (gnc_tree_view_type == 0)
    {
        static const GTypeInfo our_info =
        {
            sizeof (GncTreeViewClass),
            NULL,
            NULL,
            (GClassInitFunc) gnc_tree_view_class_init,
            NULL,
            NULL,
            sizeof (GncTreeView),
            0,
            (GInstanceInitFunc) gnc_tree_view_init
        };

        gnc_tree_view_type = g_type_register_static (GTK_TYPE_TREE_VIEW,
                             GNC_TREE_VIEW_NAME,
                             &our_info, 0);
    }

    return gnc_tree_view_type;
}
void gnc_tree_view_set_gconf_section ( GncTreeView view,
const gchar *  section 
)

This function is called to set up or remove an association between a gconf section and the display of a view. It will first remove any existing association, and then install the new one. This involves storing the gconf section value, requesting notification from gconf of any changes to keys in that section, then attaching several signals to catch user changes to the view.

Note:
This function currently marks the first column as autosized and all other columns as fixed size (with the size tracked by gconf). This may change in the future. It must change if we want to take advantage of the "fixed row height" performance enhancements added to GtkTreeView in gtk-2.4
Parameters:
viewThe tree view.
sectionLink the view to this gconf section. This is everything after "/apps/gnucash". I.E. "dialogs/edit_prices". Use NULL to disconnect a gconf association.

This function is called to set up or remove an association between a gconf section and the display of a view. It will first remove any existing association, and then install the new one. This involves storing the gconf section value, requesting notification from gconf of any changes to keys in that section, then attaching several signals to catch user changes to the view.

Parameters are defined in gnc-tree-view.h

Definition at line 1261 of file gnc-tree-view.c.

{
    GncTreeViewPrivate *priv;
    GtkTreeModel *model;
    gulong id;

    g_return_if_fail(GNC_IS_TREE_VIEW(view));

    ENTER("view %p, section %s", view, section);
    gnc_tree_view_remove_gconf(view);

    if (!section)
    {
        LEAVE("cleared gconf section");
        return;
    }

    /* Catch changes in gconf. Propagate to view. */
    priv = GNC_TREE_VIEW_GET_PRIVATE(view);
    priv->gconf_section = g_strdup(section);
    gnc_gconf_add_notification(G_OBJECT(view), section,
                               gnc_tree_view_gconf_changed,
                               GNC_TREE_VIEW_NAME);

    /* Catch changes to the sort column. Propagate to gconf. The key can
     * be set before the model, so the code must handle that case. */
    model = gtk_tree_view_get_model (GTK_TREE_VIEW(view));
    if (model)
        priv->sort_column_changed_cb_id =
            g_signal_connect(GTK_TREE_SORTABLE(model), "sort-column-changed",
                             (GCallback)gtk_tree_view_sort_column_changed_cb, view);

    /* Catch changes to the column order. Propagate to gconf */
    id = g_signal_connect(view, "columns-changed",
                          (GCallback)gtk_tree_view_columns_changed_cb, NULL);
    priv->columns_changed_cb_id = id;

    /* Catch changes to the column width. Propagate to gconf */
    id = g_signal_connect(view, "size-allocate",
                          (GCallback)gtk_tree_view_size_allocate_cb, NULL);
    priv->size_allocate_cb_id = id;

    /* Force an update of the view with all items from gconf. */
    gnc_tree_view_gconf_force_update(view);

    /* Rebuild the column visibility menu */
    gnc_tree_view_build_column_menu(view);
    LEAVE("set gconf section");
}
void gnc_tree_view_set_model ( GncTreeView view,
GtkTreeModel *  model 
)

Attach a data model to a visible GncTreeView widget. Users of this view object must use this function instead of directly calling the gtk_tree_view_set_model function. This function takes the additional step of attaching a callback function to the model to catch any changes to the sorting of the model. These changes are propagated into gconf by the callback function.

Parameters:
viewThe visible tree widget.
modelThe data model to attach.

Attach a data model to a visible GncTreeView widget. Users of this view object must use this function instead of directly calling the gtk_tree_view_set_model function. This function takes the additional step of attaching a callback function to the model to catch any changes to the sorting of the model. These changes are propagated into gconf by the callback function.

Parameters are defined in gnc-tree-view.h

Definition at line 1686 of file gnc-tree-view.c.

{
    GncTreeViewPrivate *priv;
    GtkTreeModel *old_model;

    /* Remove existing callback */
    priv = GNC_TREE_VIEW_GET_PRIVATE(view);
    if (priv->sort_column_changed_cb_id)
    {
        old_model = gtk_tree_view_get_model (GTK_TREE_VIEW(view));
        g_signal_handler_disconnect (old_model, priv->sort_column_changed_cb_id);
        priv->sort_column_changed_cb_id = 0;
    }

    gtk_tree_view_set_model (GTK_TREE_VIEW(view), model);

    /* Maybe add a new callback */
    if (model && priv->gconf_section)
    {
        priv->sort_column_changed_cb_id =
            g_signal_connect(GTK_TREE_SORTABLE(model), "sort-column-changed",
                             (GCallback)gtk_tree_view_sort_column_changed_cb, view);
    }
}
void gnc_tree_view_set_show_column_menu ( GncTreeView view,
gboolean  visible 
)

This function is called to set the "show-column-menu" property on this view. This function has no visible effect if the "gconf-section" property has not been set.

Parameters:
viewThe tree view.
visibleCreate the column selection menu if TRUE.

This function is called to set the "show-column-menu" property on this view. This function has no visible effect if the "gconf-section" property has not been set.

Parameters are defined in gnc-tree-view.h

Definition at line 1639 of file gnc-tree-view.c.

{
    GncTreeViewPrivate *priv;

    g_return_if_fail(GNC_IS_TREE_VIEW(view));

    ENTER("view %p, show menu %d", view, visible);
    priv = GNC_TREE_VIEW_GET_PRIVATE(view);
    priv->show_column_menu = visible;
    gnc_tree_view_build_column_menu(view);
    LEAVE(" ");
}
void gnc_ui_close_book ( QofBook book)

Create and run the dialog to close the book.

Parameters:
bookThis parameter specifies the book whose data will be closed.

Definition at line 318 of file dialog-book-close.c.

{
    struct CloseBookWindow *cbw;
    GtkBuilder* builder;
    GtkWidget* box;
    GList* equity_list = NULL;

    g_return_if_fail(book);

    cbw = g_new0(struct CloseBookWindow, 1);
    g_return_if_fail(cbw);
    cbw->book = book;

    /* Open the dialog */
    builder = gtk_builder_new();
    gnc_builder_add_from_file (builder, "dialog-book-close.glade", "Close Book");
    cbw->dialog = GTK_WIDGET(gtk_builder_get_object (builder,  "Close Book"));

    PINFO("Closed Book Window is %p, Dialog is %p", cbw, cbw->dialog);

    /* close date */
    box = GTK_WIDGET(gtk_builder_get_object (builder,  "date_box"));
    cbw->close_date_widget = gnc_date_edit_new(time(NULL), FALSE, FALSE);
    gtk_box_pack_start(GTK_BOX(box), cbw->close_date_widget, TRUE, TRUE, 0);

    /* income acct */
    equity_list = g_list_prepend(equity_list, GINT_TO_POINTER(ACCT_TYPE_EQUITY));
    box = GTK_WIDGET(gtk_builder_get_object (builder, "income_acct_box"));
    cbw->income_acct_widget = gnc_account_sel_new();
    gnc_account_sel_set_acct_filters(GNC_ACCOUNT_SEL(cbw->income_acct_widget),
                                     equity_list, NULL);
    gnc_account_sel_set_new_account_ability(GNC_ACCOUNT_SEL(cbw->income_acct_widget), TRUE);
    gtk_box_pack_start(GTK_BOX(box), cbw->income_acct_widget, TRUE, TRUE, 0);

    /* expense acct */
    box = GTK_WIDGET(gtk_builder_get_object (builder, "expense_acct_box"));
    cbw->expense_acct_widget = gnc_account_sel_new();
    gnc_account_sel_set_acct_filters(GNC_ACCOUNT_SEL(cbw->expense_acct_widget),
                                     equity_list, NULL);
    gnc_account_sel_set_new_account_ability(GNC_ACCOUNT_SEL(cbw->expense_acct_widget), TRUE);
    gtk_box_pack_start(GTK_BOX(box), cbw->expense_acct_widget, TRUE, TRUE, 0);

    /* desc */
    cbw->desc_widget = GTK_WIDGET(gtk_builder_get_object (builder, "desc_entry"));

    /* Autoconnect signals */
    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, cbw->dialog);

    /* Register dialog with component manager */
    cbw->component_manager_id =
        gnc_register_gui_component(DIALOG_BOOK_CLOSE_CM_CLASS, NULL, close_handler,
                                   cbw->dialog);
    gnc_gui_component_set_session(cbw->component_manager_id,
                                  gnc_get_current_session());
    g_signal_connect(cbw->dialog, "destroy", G_CALLBACK(destroy_cb), NULL);

    /* Clean up the data structure when the dialog is destroyed */
    g_object_set_data_full(G_OBJECT(cbw->dialog), "CloseBookWindow", cbw, g_free);

    g_object_unref(G_OBJECT(builder));

    /* Run the dialog */
    gtk_widget_show_all(cbw->dialog);

    g_list_free(equity_list);
}

Variable Documentation

const gchar* end_strings[GNC_ACCOUNTING_PERIOD_LAST]
Initial value:
{
    
    N_("Today"),
    N_("End of this month"),
    N_("End of previous month"),
    N_("End of this quarter"),
    N_("End of previous quarter"),
    N_("End of this year"),
    N_("End of previous year"),

    
    N_("End of this accounting period"),
    N_("End of previous accounting period"),
}

Definition at line 81 of file gnc-period-select.c.

const gchar* start_strings[GNC_ACCOUNTING_PERIOD_LAST]
Initial value:
{
    
    N_("Today"),
    N_("Start of this month"),
    N_("Start of previous month"),
    N_("Start of this quarter"),
    N_("Start of previous quarter"),
    N_("Start of this year"),
    N_("Start of previous year"),

    
    N_("Start of this accounting period"),
    N_("Start of previous accounting period"),
}

Definition at line 65 of file gnc-period-select.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines