Refactor gncGetCurrentGroup dependencies.

Add .desktop.in and .keys.in files to
potfiles search.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5382 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-09-18 07:26:42 +00:00
parent 238d3801bf
commit 92d699e074
17 changed files with 67 additions and 54 deletions

View File

@ -11,7 +11,7 @@ use strict;
use File::Basename;
my @cvsignores = `find src -name '.cvsignore'`;
my @possible_files = `find src -name '*.c' -o -name '*.glade'`;
my @possible_files = `find src -name '*.c' -o -name '*.glade' -o -name '*.desktop.in' -o -name '*.keys.in'`;
chomp(my $cwd = `pwd`);

View File

@ -52,6 +52,8 @@ static gboolean reverse_balance_inited = FALSE;
static SCM reverse_balance_callback_id = SCM_UNDEFINED;
static gboolean reverse_type[NUM_ACCOUNT_TYPES];
static GNCGroupCB group_cb = NULL;
/********************************************************************\
* gnc_color_deficits *
@ -195,6 +197,20 @@ gnc_reverse_balance (Account *account)
return reverse_type[type];
}
AccountGroup *
gnc_get_current_group (void)
{
if (group_cb)
return group_cb ();
return NULL;
}
void
gnc_set_current_group_handler (GNCGroupCB cb)
{
group_cb = cb;
}
const char *
gnc_ui_account_get_field_name (AccountFieldCode field)

View File

@ -34,6 +34,9 @@
#include "Transaction.h"
typedef AccountGroup * (*GNCGroupCB) (void);
/* User Settings ****************************************************/
gboolean gnc_color_deficits (void);
@ -47,6 +50,9 @@ const char * gnc_register_default_hint_font(void);
/* Engine enhancements & i18n ***************************************/
AccountGroup * gnc_get_current_group (void);
void gnc_set_current_group_handler (GNCGroupCB cb);
typedef enum
{
ACCOUNT_TYPE = 0,

View File

@ -4,7 +4,7 @@
* GnuCash. *
* Copyright (C) 1998,1999 Jeremy Collins *
* Copyright (C) 1998,1999 Linas Vepstas *
* Copyright (C) 2000 Dave Peticolas <peticola@cs.ucdavis.edu> *
* Copyright (C) 2000 Dave Peticolas <dave@krondo.com> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@ -56,8 +56,6 @@ static guint account_tree_signals[LAST_SIGNAL];
/* This static indicates the debugging module that this .o belongs to. */
static short module = MOD_GUI;
static GNCAccountTreeGroupCB group_cb = NULL;
/** Static function declarations **************************************/
static void gnc_account_tree_init(GNCAccountTree *tree);
@ -84,12 +82,6 @@ static void gnc_account_tree_update_column_visibility (GNCAccountTree *tree);
static void gnc_account_tree_destroy(GtkObject *object);
void
gnc_account_tree_set_group_handler (GNCAccountTreeGroupCB cb)
{
group_cb = cb;
}
GtkType
gnc_account_tree_get_type (void)
{
@ -374,13 +366,10 @@ gnc_account_tree_refresh(GNCAccountTree * tree)
root_account = xaccAccountLookup (&tree->root_account);
if (!group_cb)
g_warning ("No account group handler.");
gnc_account_tree_fill (tree, expanded_accounts,
gnc_account_tree_insert_row (tree, NULL, NULL,
root_account),
group_cb ? group_cb () : NULL);
gnc_get_current_group ());
gtk_clist_columns_autosize(clist);

View File

@ -44,7 +44,6 @@ typedef struct GNCAccountTreeClass_s GNCAccountTreeClass;
typedef struct AccountViewInfo_s AccountViewInfo;
typedef gboolean (*AccountFilter) (Account *account, gpointer user_data);
typedef AccountGroup * (*GNCAccountTreeGroupCB) (void);
struct AccountViewInfo_s
{
@ -99,8 +98,6 @@ struct GNCAccountTreeClass_s
* public functions *
***********************************************************/
void gnc_account_tree_set_group_handler (GNCAccountTreeGroupCB cb);
GtkType gnc_account_tree_get_type (void);
GtkWidget * gnc_account_tree_new (void);

View File

@ -47,7 +47,6 @@
#include "dialog-utils.h"
#include "file-utils.h"
#include "global-options.h"
#include "gnc-account-tree.h"
#include "gnc-component-manager.h"
#include "gnc-engine-util.h"
#include "gnc-menu-extensions.h"
@ -545,7 +544,7 @@ gnucash_ui_init(void)
gnc_ui_commodity_set_help_callback (gnc_commodity_help_cb);
gnc_account_tree_set_group_handler (gncGetCurrentGroup);
gnc_set_current_group_handler (gncGetCurrentGroup);
/* initialize gnome MDI and set up application window defaults */
app = gnc_main_window_new();

View File

@ -1,3 +1,5 @@
DIST_SUBDIRS = test
pkglib_LTLIBRARIES = libgncmod-ledger-core.la
libgncmod_ledger_core_la_SOURCES = \

View File

@ -29,12 +29,12 @@
#include "Group.h"
#include "Query.h"
#include "Transaction.h"
#include "FileDialog.h"
#include "date.h"
#include "global-options.h"
#include "gnc-component-manager.h"
#include "gnc-engine-util.h"
#include "gnc-ledger-display.h"
#include "gnc-ui-util.h"
#include "split-register-control.h"
#include "split-register-model.h"
@ -379,7 +379,7 @@ gnc_ledger_display_gl (void)
query = xaccMallocQuery ();
xaccQuerySetGroup (query, gncGetCurrentGroup());
xaccQuerySetGroup (query, gnc_get_current_group());
xaccQueryAddBalanceMatch (query,
BALANCE_BALANCED | BALANCE_UNBALANCED,
@ -428,7 +428,8 @@ gnc_ledger_display_template_gl (char *id)
q = xaccMallocQuery ();
ag = gnc_book_get_template_group (gncGetCurrentBook());
ag = gnc_book_get_template_group
(xaccGroupGetBook (gnc_get_current_group ()));
acct = xaccGetAccountFromName (ag, id);
if (!acct)
{
@ -437,7 +438,7 @@ gnc_ledger_display_template_gl (char *id)
}
xaccQueryAddSingleAccountMatch (q, acct, QUERY_AND);
book = gncGetCurrentBook ();
book = xaccGroupGetBook (gnc_get_current_group ());
xaccQuerySetGroup (q, gnc_book_get_template_group(book));
ld = gnc_ledger_display_internal (NULL, q, LD_GL,
@ -586,7 +587,7 @@ gnc_ledger_display_make_query (GNCLedgerDisplay *ld,
if (!show_all && (type != SEARCH_LEDGER))
xaccQuerySetMaxSplits (ld->query, 30);
xaccQuerySetGroup (ld->query, gncGetCurrentGroup());
xaccQuerySetGroup (ld->query, gnc_get_current_group());
leader = gnc_ledger_display_leader (ld);

View File

@ -36,11 +36,16 @@ gnc_module_init(int refcount) {
{
return FALSE;
}
if(!gnc_module_load("gnucash/register/register-core", 0))
{
return FALSE;
}
if(!gnc_module_load("gnucash/app-utils", 0))
{
return FALSE;
}
}
return TRUE;
}

View File

@ -23,7 +23,6 @@
#include "config.h"
#include "AccWindow.h"
#include "FileDialog.h"
#include "Group.h"
#include "Scrub.h"
#include "combocell.h"
@ -128,16 +127,16 @@ gnc_split_register_balance_trans (SplitRegister *reg, Transaction *trans)
break;
case 1:
xaccTransScrubImbalance (trans, gncGetCurrentGroup (), NULL);
xaccTransScrubImbalance (trans, gnc_get_current_group (), NULL);
break;
case 2:
xaccTransScrubImbalance (trans, gncGetCurrentGroup (),
xaccTransScrubImbalance (trans, gnc_get_current_group (),
default_account);
break;
case 3:
xaccTransScrubImbalance (trans, gncGetCurrentGroup (),
xaccTransScrubImbalance (trans, gnc_get_current_group (),
other_account);
break;
}
@ -907,7 +906,7 @@ gnc_split_register_traverse (VirtualLocation *p_new_virt_loc,
safe_strcmp (name, STOCK_SPLIT_STR) == 0)
break;
account = xaccGetAccountFromFullName (gncGetCurrentGroup (),
account = xaccGetAccountFromFullName (gnc_get_current_group (),
cell->cell.value,
gnc_get_account_separator ());
if (account)

View File

@ -22,7 +22,6 @@
#include "config.h"
#include "FileDialog.h"
#include "Group.h"
#include "combocell.h"
#include "global-options.h"
@ -555,7 +554,7 @@ gnc_split_register_load_xfer_cells (SplitRegister *reg, Account *base_account)
group = xaccAccountGetRoot(base_account);
if (group == NULL)
group = gncGetCurrentGroup();
group = gnc_get_current_group();
if (group == NULL)
return;

View File

@ -24,7 +24,6 @@
#include <glib.h>
#include "FileDialog.h"
#include "Group.h"
#include "global-options.h"
#include "gnc-engine-util.h"
@ -87,7 +86,7 @@ gnc_split_register_use_security_cells (SplitRegister *reg,
const char *name;
name = gnc_table_layout_get_cell_value (reg->table->layout, XFRM_CELL);
account = xaccGetAccountFromFullName (gncGetCurrentGroup (),
account = xaccGetAccountFromFullName (gnc_get_current_group (),
name,
gnc_get_account_separator ());
}

View File

@ -106,7 +106,6 @@
#include <time.h>
#include "Account.h"
#include "FileDialog.h"
#include "combocell.h"
#include "datecell.h"
#include "global-options.h"
@ -1468,7 +1467,7 @@ gnc_split_register_get_account (SplitRegister *reg, const char * cell_name)
name = gnc_table_layout_get_cell_value (reg->table->layout, cell_name);
return xaccGetAccountFromFullName (gncGetCurrentGroup (),
return xaccGetAccountFromFullName (gnc_get_current_group (),
name, gnc_get_account_separator ());
}

View File

@ -16,12 +16,15 @@ LDADD = \
-L${top_srcdir}/src/app-utils -L${top_srcdir}/src/app-utils/.libs \
-L${top_srcdir}/src/gnome-utils -L${top_srcdir}/src/gnome-utils/.libs \
-L${top_srcdir}/src/register/register-core \
-L${top_srcdir}/src/register/register-core/.libs \
-L${top_srcdir}/src/register/register-core/.libs \
-L${top_srcdir}/src/register/register-gnome \
-L${top_srcdir}/src/register/register-gnome/.libs \
${top_srcdir}/src/gnc-module/libgncmodule.la \
${top_srcdir}/src/engine/libgncmod-engine.la \
${top_srcdir}/src/app-utils/libgncmod-app-utils.la \
${top_srcdir}/src/gnome-utils/libgncmod-gnome-utils.la \
${top_srcdir}/src/register/register-core/libgncmod-register-core.la \
${top_srcdir}/src/register/register-gnome/libgncmod-register-gnome.la \
../libgncmod-ledger-core.la \
${top_srcdir}/src/engine/libgw-engine.la \
${top_srcdir}/src/engine/libgw-glib.la \

View File

@ -113,8 +113,6 @@ gnc_table_init (Table * table)
/* initialize private data */
table->virt_cells = NULL;
table->ui_redraw_help = NULL;
table->ui_destroy = NULL;
table->ui_data = NULL;
}
@ -122,8 +120,8 @@ void
gnc_table_destroy (Table * table)
{
/* invoke destroy callback */
if (table->ui_destroy)
table->ui_destroy (table);
if (table->gui_handlers.destroy)
table->gui_handlers.destroy (table);
/* free the dynamic structures */
gnc_table_free_data (table);
@ -1044,8 +1042,8 @@ gnc_table_enter_update (Table *table,
g_free (old_value);
}
if (table->ui_redraw_help)
table->ui_redraw_help (table);
if (table->gui_handlers.redraw_help)
table->gui_handlers.redraw_help (table);
LEAVE("return %d\n", can_edit);
@ -1185,8 +1183,8 @@ gnc_table_modify_update (Table *table,
g_free (old_value);
if (table->ui_redraw_help)
table->ui_redraw_help (table);
if (table->gui_handlers.redraw_help)
table->gui_handlers.redraw_help (table);
LEAVE ("change %d %d (relrow=%d relcol=%d) val=%s\n",
virt_loc.vcell_loc.virt_row,
@ -1257,8 +1255,8 @@ gnc_table_direct_update (Table *table,
g_free (old_value);
if (table->ui_redraw_help)
table->ui_redraw_help (table);
if (table->gui_handlers.redraw_help)
table->gui_handlers.redraw_help (table);
return result;
}

View File

@ -117,13 +117,16 @@ typedef void (*TableCursorRefreshCB) (Table *table,
VirtualCellLocation vcell_loc,
gboolean do_scroll);
typedef void (*TableRedrawHelpCB) (Table *table);
typedef void (*TableDestroyCB) (Table *table);
typedef struct
{
TableCursorRefreshCB cursor_refresh;
} TableGUIHandlers;
typedef void (*TableRedrawHelpFunc) (Table *table);
typedef void (*TableDestroyFunc) (Table *table);
TableRedrawHelpCB redraw_help;
TableDestroyCB destroy;
} TableGUIHandlers;
struct table
{
@ -144,8 +147,6 @@ struct table
GTable *virt_cells;
TableGUIHandlers gui_handlers;
TableRedrawHelpFunc ui_redraw_help;
TableDestroyFunc ui_destroy;
gpointer ui_data;
};

View File

@ -155,8 +155,8 @@ gnc_table_init_gui (gncUIWidget widget, void *data)
sheet = GNUCASH_SHEET (greg->sheet);
table = sheet->table;
table->ui_redraw_help = table_ui_redraw_cb;
table->ui_destroy = table_destroy_cb;
table->gui_handlers.redraw_help = table_ui_redraw_cb;
table->gui_handlers.destroy = table_destroy_cb;
table->ui_data = sheet;
gtk_widget_ref (GTK_WIDGET(sheet));