Merge branch 'maint'

This commit is contained in:
Christopher Lam 2020-11-29 18:08:57 +08:00
commit 15d3eb48dc
264 changed files with 14598 additions and 11789 deletions

2
.gitattributes vendored
View File

@ -23,7 +23,7 @@
*.sh text eol=lf
*.svg text eol=lf
*.xsl text eol=lf
*.cmake test eol=lf
*.cmake text eol=lf
Makefile.TAGS text eol=lf
Makevars text eol=lf

7
.github/workflows/README.md vendored Normal file
View File

@ -0,0 +1,7 @@
Github Actions Continuous Integration Testing Workflows.
ci-tests.yml runs Ubuntu 18.04 and Ubuntu 20.04 using Github-provided virtual environments. The virtual environments are about twice as fast as Docker ones and getting Docker to run Ubuntu images was problematic. Note that updating Ubuntu 18.04 updates ICU4C from v60 to v65 and that causes conflicts with Boost, so don't.
ci-docker.yml runs tests in a Docker container running Arch Linux.
mac-tests.yml runs tests on macOS using a Github-provided virtual machine. Note that this test relies on a prebuilt tarball containing all of the dependencies. Instructions for building that tarball along with some support scripts may be found in utils/ci/macos-ci-deps.

15
.github/workflows/ci-docker.yml vendored Normal file
View File

@ -0,0 +1,15 @@
name: ci-tests-docker
on: [push]
jobs:
ci_tests_archlinux:
runs-on: ubuntu-latest
name: Test Docker Action
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Test Action
uses: ./util/ci/actions/archlinux-test
- uses: actions/upload-artifact@v2
with:
name: TestLog
path: ${{ github.workspace }}/LastTest.log

75
.github/workflows/ci-tests.yml vendored Normal file
View File

@ -0,0 +1,75 @@
name: ci-tests
on: [push]
jobs:
ci_tests_ubuntu-18:
runs-on: ubuntu-18.04
name: Ubuntu-18.04 Tests
env:
TZ: America/Los_Angeles
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install additional dependencies
run: sudo apt-get install -y cmake libxslt-dev xsltproc ninja-build libboost-all-dev libgtk-3-dev guile-2.2-dev libgwengui-gtk3-dev libaqbanking-dev libofx-dev libdbi-dev libdbd-sqlite3 libwebkit2gtk-4.0-dev googletest
- name: Install language packs.
run: sudo apt-get --reinstall install -y language-pack-en language-pack-fr
- run: |
echo "ROOT_DIR=$GITHUB_WORKSPACE/.." >> $GITHUB_ENV
- name: Create Directories
run: |
pwd
mkdir $ROOT_DIR/inst
mkdir build
- name: Configure GnuCash
run: |
cd build
cmake -G Ninja -DWITH_PYTHON=ON -DCMAKE_INSTALL_PREFIX=$ROOT_DIR/inst $GITHUB_WORKSPACE
- name: Build and Test GnuCash
run: |
cd build
ninja
ninja check
- uses: actions/upload-artifact@v2
if: failure()
with:
name: TestLog
path: ${{ github.workspace }}/build/Testing/Temporary/LastTest.log
ci_tests_ubuntu-20:
runs-on: ubuntu-20.04
name: Ubuntu-20.04 Tests
env:
TZ: America/Los_Angeles
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install apt utils
run: sudo apt-get install -y --no-install-recommends apt-utils
- name: Upgrade apt
run: |
sudo apt-get update -y
sudo apt-get upgrade -y
- name: Install additional dependencies
run: sudo apt-get install -y cmake libxslt-dev xsltproc ninja-build libboost-all-dev libgtk-3-dev guile-2.2-dev libgwengui-gtk3-dev libaqbanking-dev libofx-dev libdbi-dev libdbd-sqlite3 libwebkit2gtk-4.0-dev googletest
- name: Install language packs.
run: sudo apt-get --reinstall install -y language-pack-en language-pack-fr
- run: |
echo "ROOT_DIR=$GITHUB_WORKSPACE/.." >> $GITHUB_ENV
- name: Create Directories
run: |
pwd
mkdir $ROOT_DIR/inst
mkdir build
- name: Configure GnuCash
run: |
cd build
cmake -G Ninja -DWITH_PYTHON=ON -DCMAKE_INSTALL_PREFIX=$ROOT_DIR/inst $GITHUB_WORKSPACE
- name: Build and Test GnuCash
run: |
cd build
ninja
ninja check
- uses: actions/upload-artifact@v2
if: failure()
with:
name: TestLog
path: ${{ github.workspace }}/build/Testing/Temporary/LastTest.log

55
.github/workflows/mac-tests.yaml vendored Normal file
View File

@ -0,0 +1,55 @@
name: mac-tests
on: [push]
jobs:
ci_tests_mac:
runs-on: macos-10.15
name: macOS Tests
env:
TZ: America/Los_Angeles
steps:
- name: Checkout
uses: actions/checkout@v2
- run: |
echo "PATH=$PATH:$HOME/gnucash/inst/bin" >> $GITHUB_ENV
echo "PREFIX=$HOME/gnucash/inst" >> $GITHUB_ENV
echo "SRCROOT=$HOME/gnucash/source" >> $GITHUB_ENV
- name: download dependency tarball
uses: carlosperate/download-file-action@v1.0.3
id: dependencies
with:
file-url: 'https://downloads.sourceforge.net/gnucash/Dependencies/gnucash-4.x-mac-dependencies.tar.xz'
file-name: gnucash-dependencies.tar.xz
- name: download googletest
uses: carlosperate/download-file-action@v1.0.3
id: googletest
with:
file-url: 'https://github.com/google/googletest/archive/release-1.10.0.tar.gz'
file-name: googletest.tar.gz
- run: |
cd $HOME
mkdir gnucash
cd gnucash
tar -xf $GITHUB_WORKSPACE/gnucash-dependencies.tar.xz
mkdir source
cd source
tar -xf $GITHUB_WORKSPACE/googletest.tar.gz
mv googletest-* googletest
cd ..
ls source
- name: Configure GnuCash
run: |
mkdir build
cd build
cmake -GNinja -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_PREFIX_PATH=$PREFIX -DWITH_PYTHON=ON -DGTEST_ROOT=$SRCROOT/googletest $GITHUB_WORKSPACE
- name: Build and Test GnuCash
run: |
cd build
ninja
ninja check
- uses: actions/upload-artifact@v2
if: failure()
with:
name: TestLog
path: ${{ github.workspace }}/build/Testing/Temporary/LastTest.log
if-no-files-found: ignore

View File

@ -207,7 +207,7 @@ pkg_check_modules (GTHREAD REQUIRED gthread-2.0)
pkg_check_modules (LIBXML2 REQUIRED libxml-2.0>=2.9.4)
pkg_check_modules (LIBXSLT REQUIRED libxslt)
if (WITH_GNUCASH)
if (WIN32 OR APPLE)
if (WIN32)
pkg_check_modules (WEBKIT REQUIRED IMPORTED_TARGET webkitgtk-3.0)
set(WEBKIT1 1 CACHE INTERNAL "WebKitGtk")
else()
@ -279,7 +279,7 @@ string(REGEX MATCH "^[0-9]+[.]" SWIG_MAJOR ${SWIG_VERSION})
# guile library and include dir
pkg_check_modules (GUILE3 guile-3.0 QUIET)
pkg_check_modules (GUILE22 guile-2.2)
pkg_check_modules (GUILE22 guile-2.2 QUIET)
pkg_check_modules (GUILE2 guile-2.0>=2.0.9 QUIET)
if (GUILE3_FOUND) # found guile-3.0

View File

@ -157,6 +157,9 @@ gchar *gnc_locale_name (void);
}
%rename ("gnc:ngettext") ngettext;
extern const char* ngettext (const char *msgid1, const char *msgid2,
unsigned long int n);
%rename ("gnc:gettext") gettext;
extern const char* gettext(const char*);
%rename ("gnc:C_gettext") wrap_C_;

View File

@ -27,13 +27,17 @@
(define-module (gnucash core-utils)
#:export (N_
G_
NG_
C_
gnc:string-locale<?
gnc:string-locale>?
gnc:version))
;; Guile 2 needs to find the symbols from the extension at compile time already
(eval-when (compile load eval expand)
(load-extension "libgnucash-guile" "gnc_guile_bindings_init"))
(use-modules (sw_core_utils))
(use-modules (ice-9 i18n))
;; Export the swig-wrapped symbols in the public interface of this module
(module-use! (module-public-interface (current-module))
@ -43,6 +47,7 @@
;; gettext functions
(define G_ gnc:gettext)
(define NG_ gnc:ngettext)
(define C_ gnc:C-gettext)
(define-syntax-rule (N_ x) x)
@ -54,3 +59,6 @@
(define-public (_ x)
(issue-deprecation-warning "Using _ to call gettext is disallowed in guile-3 and will be removed in the future. Use G_ instead.")
(gnc:gettext x))))
(define gnc:string-locale<? string-locale<?)
(define gnc:string-locale>? string-locale>?)

View File

@ -81,20 +81,24 @@
;; A few account related utility functions which used to be in engine-utilities.scm
(define (gnc:account-map-descendants thunk account)
(issue-deprecation-warning "gnc:account-map-descendants is deprecated.")
(let ((descendants (or (gnc-account-get-descendants-sorted account) '())))
(map thunk descendants)))
(define (gnc:account-map-children thunk account)
(issue-deprecation-warning "gnc:account-map-children is deprecated.")
(let ((children (or (gnc-account-get-children-sorted account) '())))
(map thunk children)))
;; account related functions
;; helper for sorting of account list
(define (account-full-name<? a b)
(issue-deprecation-warning "account-full-name<? is deprecated. use gnc:account-full-name<? instead.")
(string<? (gnc-account-get-full-name a) (gnc-account-get-full-name b)))
;; return maximum depth over accounts and their children, if any
(define (accounts-get-children-depth accounts)
(issue-deprecation-warning "accounts-get-children-depth is deprecated. use gnc:accounts-get-children-depth instead.")
(apply max
(map (lambda (acct)
(let ((acct-depth (gnc-account-get-current-depth acct)))

View File

@ -1721,18 +1721,28 @@ gnc_scm2query (SCM query_scm)
gnc_numeric
gnc_scm_to_numeric(SCM gncnum)
{
if (scm_is_signed_integer(scm_numerator(gncnum), INT64_MIN, INT64_MAX) &&
scm_is_signed_integer(scm_denominator(gncnum), INT64_MIN, INT64_MAX))
return gnc_numeric_create(scm_to_int64(scm_numerator(gncnum)),
scm_to_int64(scm_denominator(gncnum)));
return gnc_numeric_create(0, GNC_ERROR_OVERFLOW);
SCM num, denom;
/* Not a number. */
if (!scm_is_number (gncnum))
return gnc_numeric_error (GNC_ERROR_ARG);
num = scm_numerator (gncnum);
denom = scm_denominator (gncnum);
/* scm overflows 64-bit numbers */
if (!scm_is_signed_integer (num, INT64_MIN, INT64_MAX) ||
!scm_is_signed_integer (denom, INT64_MIN, INT64_MAX))
return gnc_numeric_error (GNC_ERROR_OVERFLOW);
return gnc_numeric_create (scm_to_int64 (num), scm_to_int64 (denom));
}
SCM
gnc_numeric_to_scm(gnc_numeric arg)
{
return scm_divide(scm_from_int64(arg.num),
scm_from_int64(arg.denom));
return gnc_numeric_check (arg) ? SCM_BOOL_F :
scm_divide (scm_from_int64 (arg.num), scm_from_int64 (arg.denom));
}
static SCM

View File

@ -354,7 +354,7 @@ static void go_option_menu_init(GOOptionMenu *option_menu)
option_menu->button_label = GTK_LABEL(gtk_label_new(""));
gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(option_menu->button_label), FALSE, TRUE, 0);
arrow = gtk_image_new_from_icon_name ("go-down", GTK_ICON_SIZE_BUTTON);
arrow = gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_BUTTON);
gtk_widget_set_margin_start (GTK_WIDGET(arrow), 5);
gtk_box_pack_end(GTK_BOX(box), arrow, FALSE, FALSE, 0);

View File

@ -1422,6 +1422,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Opening Balances</act:description>
<act:parent type="new">87e02e757b32b3059652cfe09fe9ae00</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Retained Earnings</act:name>

View File

@ -147,5 +147,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Opening Balances</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -783,6 +783,12 @@
</act:commodity>
<act:description>Opening Balances</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -1396,6 +1396,12 @@
</act:commodity>
<act:description>Opening Balances</act:description>
<act:parent type="new">68d4074f91295062c0b773b4ae8de6bd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -684,5 +684,11 @@
</act:commodity>
<act:description>Åbningssaldi</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -964,5 +964,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Anfangsbestand</act:description>
<act:parent type="new">1972cce2e2364f95b2b0bc014502661d</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -964,5 +964,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Anfangsbestand</act:description>
<act:parent type="new">1972cce2e2364f95b2b0bc014502661d</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -739,5 +739,11 @@
</act:commodity>
<act:description>Anfangsbestand</act:description>
<act:parent type="new">1972cce2e2364f95b2b0bc014502661d</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -843,6 +843,12 @@
</act:commodity>
<act:description>Anfangsbestand</act:description>
<act:parent type="new">1972cce2e2364f95b2b0bc014502661d</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -1192,6 +1192,12 @@
</act:commodity>
<act:description>Anfangsbestand</act:description>
<act:parent type="new">320d3cf62b418db6281c3cd8ec2e95c7</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -1269,6 +1269,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:code>9000</act:code>
<act:parent type="new">26c3f10c1c7621661c1b813d6141280d</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>9008 Saldenvorträge Debitoren</act:name>

View File

@ -15678,6 +15678,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:code>9000</act:code>
<act:parent type="new">e57d948c9a884e179bd090118b9212f8</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Saldenvorträge Debitoren</act:name>

View File

@ -14305,6 +14305,12 @@ Den Bereich habe ich mit „9999“ bezeichet, damit er unterhalb der regulären
</slot>
</act:slots>
<act:parent type="guid">ffca2686cb9963bea1089b796763dda0</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>9001-9007 Saldenvorträge, Sachkonten</act:name>

View File

@ -786,5 +786,11 @@
</act:commodity>
<act:description>Αρχικά υπόλοιπα</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -1420,6 +1420,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Opening Balances</act:description>
<act:parent type="new">87e02e757b32b3059652cfe09fe9ae00</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Retained Earnings</act:name>

View File

@ -149,6 +149,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Opening Balances</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -781,5 +781,11 @@
</act:commodity>
<act:description>Opening Balances</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -1393,5 +1393,11 @@
</act:commodity>
<act:description>Opening Balances</act:description>
<act:parent type="new">68d4074f91295062c0b773b4ae8de6bd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -398,6 +398,12 @@
</act:commodity>
<act:commodity-scu>100</act:commodity-scu>
<act:parent type="new">c0b1160d2dd6b3059acc5083348b282f</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Grants</act:name>

View File

@ -1137,6 +1137,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Opening Balances</act:description>
<act:parent type="new">599b08659324698f0177ce3dbb513e5f</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Reserves and Surplus</act:name>

View File

@ -753,5 +753,11 @@
</act:commodity>
<act:description>Balances de apertura</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -830,5 +830,11 @@
</act:commodity>
<act:description>Balances de apertura</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -397,6 +397,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Opening Balances</act:description>
<act:parent type="new">7081f24a5685d4dfcb8f143f0b7ee31d</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -1378,6 +1378,12 @@ Les utilisateurs gérant une entreprise sélectionneront ceci au lieu des autres
<act:commodity-scu>100</act:commodity-scu>
<act:description>Soldes initiaux</act:description>
<act:parent type="new">87e02e757b32b3059652cfe09fe9ae00</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Gains enregistrés</act:name>

View File

@ -750,5 +750,11 @@
</act:commodity>
<act:description>Soldes initiaux</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -1378,6 +1378,12 @@ Les utilisateurs gérant une entreprise sélectionneront ceci au lieu des autres
<act:commodity-scu>100</act:commodity-scu>
<act:description>Soldes initiaux</act:description>
<act:parent type="new">87e02e757b32b3059652cfe09fe9ae00</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Gains enregistrés</act:name>

View File

@ -750,5 +750,11 @@
</act:commodity>
<act:description>Soldes initiaux</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -1378,6 +1378,12 @@ Les utilisateurs gérant une entreprise sélectionneront ceci au lieu des autres
<act:commodity-scu>100</act:commodity-scu>
<act:description>Soldes initiaux</act:description>
<act:parent type="new">87e02e757b32b3059652cfe09fe9ae00</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Gains enregistrés</act:name>

View File

@ -750,5 +750,11 @@
</act:commodity>
<act:description>Soldes initiaux</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -147,5 +147,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>יתרת פתיחה</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -147,5 +147,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Početni saldo</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -800,6 +800,12 @@
</act:commodity>
<act:description>Početni saldo</act:description>
<act:parent type="new">73f3a388cebe42a3bc40ab8db179d32d</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -1378,6 +1378,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Nyitóegyenlegek</act:description>
<act:parent type="new">87e02e757b32b3059652cfe09fe9ae00</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Céltartalékok</act:name>

View File

@ -139,5 +139,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Nyitóegyenlegek</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -728,5 +728,11 @@
</act:commodity>
<act:description>Nyitóegyenlegek</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -144,5 +144,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Bilanci d'apertura</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -747,5 +747,11 @@
</act:commodity>
<act:description>Bilanci d'apertura</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -1414,6 +1414,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>開始残高</act:description>
<act:parent type="new">87e02e757b32b3059652cfe09fe9ae00</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>内部留保</act:name>

View File

@ -147,5 +147,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>開始残高</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -775,5 +775,11 @@
</act:commodity>
<act:description>開始残高</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -1390,5 +1390,11 @@
</act:commodity>
<act:description>開始残高</act:description>
<act:parent type="new">68d4074f91295062c0b773b4ae8de6bd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -129,5 +129,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Sākuma bilance</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -736,5 +736,11 @@
</act:commodity>
<act:description>Kontu sākuma bilances</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -1354,5 +1354,11 @@
</act:commodity>
<act:description>Sākuma bilances</act:description>
<act:parent type="new">68d4074f91295062c0b773b4ae8de6bd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -739,5 +739,11 @@
</act:commodity>
<act:description>Opening Balances</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -1319,5 +1319,11 @@
</act:commodity>
<act:description>Opening Balances</act:description>
<act:parent type="new">68d4074f91295062c0b773b4ae8de6bd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -147,5 +147,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Beginsaldi</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -1387,5 +1387,11 @@
</act:commodity>
<act:description>Openingsbalans</act:description>
<act:parent type="new">68d4074f91295062c0b773b4ae8de6bd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -1414,6 +1414,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Bilanse otwarcia</act:description>
<act:parent type="new">87e02e757b32b3059652cfe09fe9ae00</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Zyski zatrzymane</act:name>

View File

@ -147,5 +147,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>Bilanse otwarcia</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -775,5 +775,11 @@
</act:commodity>
<act:description>Bilanse otwarcia</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -1387,5 +1387,11 @@
</act:commodity>
<act:description>Bilanse otwarcia</act:description>
<act:parent type="new">68d4074f91295062c0b773b4ae8de6bd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -728,5 +728,11 @@
</act:commodity>
<act:description>Saldos Iniciais</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -746,5 +746,11 @@
</act:commodity>
<act:description>Saldos iniciais</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -843,6 +843,12 @@
</act:commodity>
<act:description>Остаток средств на начало периода</act:description>
<act:parent type="new">1972cce2e2364f95b2b0bc014502661d</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -3835,6 +3835,12 @@
</slot>
</act:slots>
<act:parent type="new">cfd3ff3dffa577973d3c1c5def43e568</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Ödenmemiş Sermaye(-)</act:name>
@ -3871,6 +3877,12 @@
</slot>
</act:slots>
<act:parent type="new">cfd3ff3dffa577973d3c1c5def43e568</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Sermaye Düzeltmesi Olumsuz Farkları(-)</act:name>

View File

@ -1414,6 +1414,12 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>期初余额</act:description>
<act:parent type="new">87e02e757b32b3059652cfe09fe9ae00</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>留存收益</act:name>

View File

@ -147,5 +147,11 @@
<act:commodity-scu>100</act:commodity-scu>
<act:description>期初余额</act:description>
<act:parent type="new">b8b72887da1adf889f171923d23efbdd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -775,5 +775,11 @@
</act:commodity>
<act:description>期初余额</act:description>
<act:parent type="new">3ab6a6d97b216c11333e48aa2b749a91</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -1387,5 +1387,11 @@
</act:commodity>
<act:description>期初余额</act:description>
<act:parent type="new">68d4074f91295062c0b773b4ae8de6bd</act:parent>
<act:slots>
<slot>
<slot:key>equity-type</slot:key>
<slot:value type="string">opening-balance</slot:value>
</slot>
</act:slots>
</gnc:account>
</gnc-account-example>

View File

@ -226,7 +226,7 @@ if (MAC_INTEGRATION)
file(APPEND ${ENV_FILE_OUT} "GIO_MODULE_DIR={SYS_LIB}/gio/modules\n")
file(APPEND ${ENV_FILE_OUT} "XDG_CONFIG_HOME={HOME}/Library/Application Support/${PACKAGE_NAME}/config\n")
file(APPEND ${ENV_FILE_OUT} "GDK_PIXBUF_MODULE_FILE={SYS_LIB}/gdk-pixbuf-2.0/2.10.0/loaders.cache\n")
file(APPEND ${ENV_FILE_OUT} "FONTCONFIG_FILE={GNC_HOME}/etc/fonts/fonts.conf\n")
file(APPEND ${ENV_FILE_OUT} "FONTCONFIG_PATH={GNC_HOME}/etc/fonts\n")
file(APPEND ${ENV_FILE_OUT} "OFX_DTD_PATH={GNC_HOME}/share/libofx/dtd\n")
file(APPEND ${ENV_FILE_OUT} "GNC_DBD_DIR={SYS_LIB}/dbd\n")
file(APPEND ${ENV_FILE_OUT} "GTK_IM_MODULE_FILE={GNC_HOME}/lib/gtk-3.0/3.0.0/immodules.cache\n")

View File

@ -64,10 +64,7 @@ GUILE_LOAD_PATH=@GNC_GUILE_LOAD_PATH@;{GUILE_LIBS};{GUILE_LOAD_PATH}
GUILE_LOAD_COMPILED_PATH=@GNC_GUILE_LOAD_COMPILED_PATH@;{GUILE_COMPILED_LIBS};{GUILE_LOAD_COMPILED_PATH}
# Tell Guile where to find GnuCash specific shared libraries
GNC_LIBRARY_PATH={SYS_LIB};{GNC_LIB}
LD_LIBRARY_PATH={GNC_LIBRARY_PATH};{LD_LIBRARY_PATH}
# The same, but for GnuCash on OS X
DYLD_LIBRARY_PATH={GNC_LIBRARY_PATH};{DYLD_LIBRARY_PATH}
LTDL_LIBRARY_PATH={SYS_LIB};{GNC_LIB}
# For changing the language GnuCash uses, first refer to
# to https://wiki.gnucash.org/wiki/Locale_Settings.

View File

@ -367,6 +367,15 @@ gnc_search_dialog_display_results (GNCSearchWindow *sw)
max_count = gnc_prefs_get_float(GNC_PREFS_GROUP_SEARCH_GENERAL, GNC_PREF_NEW_SEARCH_LIMIT);
if (gnc_query_view_get_num_entries(GNC_QUERY_VIEW(sw->result_view)) < max_count)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (sw->new_rb), TRUE);
/* If there is only one item then select it */
if (gnc_query_view_get_num_entries (GNC_QUERY_VIEW(sw->result_view)) == 1)
{
GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(sw->result_view));
GtkTreePath *path = gtk_tree_path_new_first ();
gtk_tree_selection_select_path (selection, path);
gtk_tree_path_free (path);
}
}
static void

View File

@ -106,6 +106,7 @@ typedef struct _AccountWindow
GtkTreeView * parent_tree;
GtkWidget * parent_scroll;
GtkWidget * opening_balance_button;
GtkWidget * opening_balance_edit;
GtkWidget * opening_balance_date_edit;
GtkWidget * opening_balance_page;
@ -205,6 +206,37 @@ gnc_account_commodity_from_type (AccountWindow * aw, gboolean update)
aw->commodity_mode = new_mode;
}
static void
gnc_account_opening_balance_button_update (AccountWindow *aw, gnc_commodity *commodity)
{
Account *account = aw_get_account (aw);
Account *ob_account = gnc_account_lookup_by_opening_balance (gnc_book_get_root_account (aw->book), commodity);
gboolean has_splits = xaccAccountCountSplits (account, FALSE) > 0;
if (xaccAccountGetType (account) != ACCT_TYPE_EQUITY)
{
gtk_widget_set_sensitive (aw->opening_balance_button, FALSE);
return;
}
/* The opening balance flag can be edited, if the associated feature is enabled and
* there is no opening balance account or we are editing the only opening balance account
* and it has no splits assigned.
*/
if (!gnc_using_equity_type_opening_balance_account (gnc_get_current_book()))
return;
switch(aw->dialog_type)
{
case EDIT_ACCOUNT:
gtk_widget_set_sensitive (aw->opening_balance_button, (ob_account == NULL || ob_account == account) && has_splits == 0);
break;
case NEW_ACCOUNT:
gtk_widget_set_sensitive (aw->opening_balance_button, ob_account == NULL);
break;
}
}
/* Copy the account values to the GUI widgets */
static void
gnc_account_to_ui(AccountWindow *aw)
@ -268,6 +300,12 @@ gnc_account_to_ui(AccountWindow *aw)
gtk_text_buffer_set_text (aw->notes_text_buffer, string, strlen(string));
gnc_account_opening_balance_button_update (aw, commodity);
flag = xaccAccountGetIsOpeningBalance (account);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (aw->opening_balance_button),
flag);
flag = xaccAccountGetTaxRelated (account);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (aw->tax_related_button),
flag);
@ -434,6 +472,11 @@ gnc_ui_to_account(AccountWindow *aw)
if (null_strcmp (string, old_string) != 0)
xaccAccountSetNotes (account, string);
flag =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (aw->opening_balance_button));
if (xaccAccountGetIsOpeningBalance (account) != flag)
xaccAccountSetIsOpeningBalance (account, flag);
flag =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (aw->tax_related_button));
if (xaccAccountGetTaxRelated (account) != flag)
@ -699,7 +742,7 @@ verify_children_compatible (AccountWindow *aw)
gnc_label_set_alignment (label, 0.0, 0.0);
/* make label large */
gnc_widget_style_context_add_class (GTK_WIDGET(label), "gnc-class-emphasize-label");
gnc_widget_style_context_add_class (GTK_WIDGET(label), "gnc-class-title");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
@ -856,6 +899,9 @@ gnc_common_ok (AccountWindow *aw)
return FALSE;
}
/* update opening balance account */
gnc_find_or_create_equity_account (root, EQUITY_OPENING_BALANCE, commodity);
LEAVE("passed");
return TRUE;
}
@ -1271,11 +1317,33 @@ commodity_changed_cb (GNCGeneralSelect *gsl, gpointer data)
AccountWindow *aw = data;
gnc_commodity *currency;
GtkTreeSelection *selection;
Account *account = aw_get_account (aw);
currency = (gnc_commodity *) gnc_general_select_get_selected (gsl);
if (!currency)
return;
if (xaccAccountGetIsOpeningBalance (account))
{
Account *ob_account = gnc_account_lookup_by_opening_balance (gnc_book_get_root_account (aw->book), currency);
if (ob_account != account)
{
gchar *dialog_msg = _("An account with opening balance already exists for the desired currency.");
gchar *dialog_title = _("Cannot change currency");
GtkWidget *dialog = gtk_message_dialog_new (gnc_ui_get_main_window (NULL),
0,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
"%s", dialog_title);
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG(dialog),
"%s", dialog_msg);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
gnc_general_select_set_selected (gsl, xaccAccountGetCommodity (account));
return;
}
}
gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (aw->opening_balance_edit),
gnc_commodity_get_fraction (currency));
gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (aw->opening_balance_edit),
@ -1283,6 +1351,7 @@ commodity_changed_cb (GNCGeneralSelect *gsl, gpointer data)
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (aw->transfer_tree));
gtk_tree_selection_unselect_all (selection);
gnc_account_opening_balance_button_update (aw, currency);
}
static gboolean
@ -1420,6 +1489,7 @@ gnc_account_window_create(GtkWindow *parent, AccountWindow *aw)
g_signal_connect (G_OBJECT (selection), "changed",
G_CALLBACK (gnc_account_parent_changed_cb), aw);
aw->opening_balance_button = GTK_WIDGET(gtk_builder_get_object (builder, "opening_balance_button"));
aw->tax_related_button = GTK_WIDGET(gtk_builder_get_object (builder, "tax_related_button"));
aw->placeholder_button = GTK_WIDGET(gtk_builder_get_object (builder, "placeholder_button"));
aw->hidden_button = GTK_WIDGET(gtk_builder_get_object (builder, "hidden_button"));

View File

@ -48,11 +48,11 @@ typedef struct
GtkWidget * link_edit;
GtkWidget *duplicate_title_label; // GtkLabel
GtkWidget *duplicate_table; // GtkTable
GtkWidget *date_label; // GtkLabel
GtkWidget *num_label; // GtkLabel
GtkWidget *tnum_label; // GtkLabel
GtkWidget *link_label; //GtkLabel
GtkWidget *duplicate_table; // GtkTable
GtkWidget *date_label; // GtkLabel
GtkWidget *num_label; // GtkLabel
GtkWidget *tnum_label; // GtkLabel
GtkWidget *link_label; // GtkLabel
} DupTransDialog;
/* Parses the string value and returns true if it is a
@ -66,10 +66,10 @@ parse_num (const char *string, long int *num)
if (string == NULL)
return FALSE;
if (!gnc_strisnum(string))
if (!gnc_strisnum (string))
return FALSE;
number = strtol(string, NULL, 10);
number = strtol (string, NULL, 10);
if ((number == LONG_MIN) || (number == LONG_MAX))
return FALSE;
@ -81,17 +81,61 @@ parse_num (const char *string, long int *num)
}
static gboolean
gnc_dup_trans_output_cb(GtkSpinButton *spinbutton,
gpointer user_data)
gnc_dup_inc_dec (GtkWidget *widget, const gchar *text, gint inc_dec)
{
gboolean is_number;
long int num;
gchar *txt = gtk_editable_get_chars(GTK_EDITABLE(spinbutton), 0, -1);
is_number = parse_num(txt, &num);
g_free(txt);
if (!is_number)
gtk_entry_set_text(GTK_ENTRY(spinbutton), "");
return !is_number;
if (parse_num (text, &num))
{
gchar *format;
gchar *out;
num = num + inc_dec;
if (num == -1)
num = 0;
if (g_str_has_prefix (text, "0"))
format = g_strdup_printf ("%s%ld%s", "%0", g_utf8_strlen (text, -1), "d");
else
format = g_strdup_printf ("%s", "%ld");
out = g_strdup_printf (format, num);
gtk_entry_set_text (GTK_ENTRY(widget), out);
g_free (format);
g_free (out);
return TRUE;
}
return FALSE;
}
static gboolean
gnc_dup_key_press_event_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
const gchar *text = gtk_entry_get_text (GTK_ENTRY(widget));
if (gnc_strisnum (text))
{
GdkModifierType modifiers = gtk_accelerator_get_default_mod_mask ();
gint increment;
long int num;
if ((event->state & modifiers) == GDK_CONTROL_MASK ||
(event->state & modifiers) == GDK_MOD1_MASK)
return FALSE;
if (event->keyval == GDK_KEY_plus || event->keyval == GDK_KEY_KP_Add)
increment = 1;
else if (event->keyval == GDK_KEY_minus || event->keyval == GDK_KEY_KP_Subtract)
increment = -1;
else
return FALSE;
return gnc_dup_inc_dec (widget, text, increment);
}
else
return FALSE;
}
static void
@ -101,8 +145,9 @@ gnc_dup_trans_dialog_create (GtkWidget * parent, DupTransDialog *dt_dialog,
{
GtkWidget *dialog;
GtkBuilder *builder;
const gchar *tt = _("Use +- keys to increment/decrement number");
builder = gtk_builder_new();
builder = gtk_builder_new ();
gnc_builder_add_from_file (builder, "gnc-plugin-page-register.glade", "num_adjustment");
gnc_builder_add_from_file (builder, "gnc-plugin-page-register.glade", "tnum_adjustment");
gnc_builder_add_from_file (builder, "gnc-plugin-page-register.glade", "duplicate_transaction_dialog");
@ -116,7 +161,7 @@ gnc_dup_trans_dialog_create (GtkWidget * parent, DupTransDialog *dt_dialog,
/* parent */
if (parent != NULL)
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
gtk_window_set_transient_for (GTK_WINDOW(dialog), GTK_WINDOW(parent));
/* date widget */
dt_dialog->date_label = GTK_WIDGET(gtk_builder_get_object (builder, "date_label"));
@ -126,13 +171,13 @@ gnc_dup_trans_dialog_create (GtkWidget * parent, DupTransDialog *dt_dialog,
GtkWidget *hbox;
date_edit = gnc_date_edit_new (date, FALSE, FALSE);
gnc_date_activates_default(GNC_DATE_EDIT(date_edit), TRUE);
gnc_date_activates_default (GNC_DATE_EDIT(date_edit), TRUE);
hbox = GTK_WIDGET(gtk_builder_get_object (builder, "date_hbox"));
gtk_widget_show (date_edit);
gnc_date_make_mnemonic_target (GNC_DATE_EDIT(date_edit), dt_dialog->date_label);
gtk_box_pack_end (GTK_BOX (hbox), date_edit, TRUE, TRUE, 0);
gtk_box_pack_end (GTK_BOX(hbox), date_edit, TRUE, TRUE, 0);
dt_dialog->date_edit = date_edit;
}
else
@ -147,31 +192,33 @@ gnc_dup_trans_dialog_create (GtkWidget * parent, DupTransDialog *dt_dialog,
dt_dialog->num_label = GTK_WIDGET(gtk_builder_get_object (builder, "num_label"));
dt_dialog->tnum_label = GTK_WIDGET(gtk_builder_get_object (builder, "tnum_label"));
dt_dialog->num_edit = GTK_WIDGET(gtk_builder_get_object (builder, "num_entry"));
dt_dialog->tnum_edit = GTK_WIDGET(gtk_builder_get_object (builder, "tnum_entry"));
if (num_str)
gtk_entry_set_text (GTK_ENTRY(dt_dialog->num_edit), num_str);
if (tnum_str)
gtk_entry_set_text (GTK_ENTRY(dt_dialog->tnum_edit), tnum_str);
g_signal_connect (dt_dialog->num_edit, "key-press-event",
G_CALLBACK(gnc_dup_key_press_event_cb),
dt_dialog);
g_signal_connect (dt_dialog->tnum_edit, "key-press-event",
G_CALLBACK(gnc_dup_key_press_event_cb),
dt_dialog);
if (gnc_strisnum (num_str))
{
GtkWidget *num_spin, *tnum_spin;
long int num, tnum;
num_spin = GTK_WIDGET(gtk_builder_get_object (builder, "num_spin"));
tnum_spin = GTK_WIDGET(gtk_builder_get_object (builder, "tnum_spin"));
dt_dialog->num_edit = num_spin;
dt_dialog->tnum_edit = tnum_spin;
gtk_entry_set_activates_default(GTK_ENTRY(num_spin), TRUE);
g_signal_connect(num_spin, "output",
G_CALLBACK(gnc_dup_trans_output_cb), dt_dialog);
g_signal_connect(tnum_spin, "output",
G_CALLBACK(gnc_dup_trans_output_cb), dt_dialog);
if (num_str && parse_num (num_str, &num))
gtk_spin_button_set_value (GTK_SPIN_BUTTON (num_spin), num + 1);
else
gtk_entry_set_text (GTK_ENTRY (num_spin), "");
if (tnum_str && parse_num (tnum_str, &tnum))
gtk_spin_button_set_value (GTK_SPIN_BUTTON (tnum_spin), tnum + 1);
else
gtk_entry_set_text (GTK_ENTRY (tnum_spin), "");
gtk_widget_set_tooltip_text (GTK_WIDGET(dt_dialog->num_edit), tt);
gnc_dup_inc_dec (GTK_WIDGET(dt_dialog->num_edit), num_str, 1);
}
if (gnc_strisnum (tnum_str))
{
gtk_widget_set_tooltip_text (GTK_WIDGET(dt_dialog->tnum_edit), tt);
gnc_dup_inc_dec (GTK_WIDGET(dt_dialog->tnum_edit), tnum_str, 1);
}
/* Transaction Linked Document */
{
dt_dialog->link_label = GTK_WIDGET(gtk_builder_get_object (builder, "link_label"));
@ -180,14 +227,14 @@ gnc_dup_trans_dialog_create (GtkWidget * parent, DupTransDialog *dt_dialog,
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, dt_dialog);
g_object_unref(G_OBJECT(builder));
g_object_unref (G_OBJECT(builder));
}
static gboolean
gnc_dup_trans_dialog_internal (GtkWidget * parent,
const char* window_title, const char* title,
gboolean show_date, time64 *date_p,
GDate *gdate_p, const char *num, char **out_num,
gboolean show_date, time64 *date_p, GDate *gdate_p,
const char *num, char **out_num,
const char *tnum, char **out_tnum,
const char *tlink, char **out_tlink)
{
@ -204,9 +251,9 @@ gnc_dup_trans_dialog_internal (GtkWidget * parent,
if (!show_date)
{
// The "date" field isn't being asked for, so we make the widgets invisible
gtk_widget_set_visible(dt_dialog->date_label, FALSE);
gtk_widget_set_visible (dt_dialog->date_label, FALSE);
if (dt_dialog->date_edit)
gtk_widget_set_visible(dt_dialog->date_edit, FALSE);
gtk_widget_set_visible (dt_dialog->date_edit, FALSE);
// If no "date" field, there must be a "num" field, so give it focus
if (out_num)
gtk_widget_grab_focus (dt_dialog->num_edit);
@ -215,70 +262,70 @@ gnc_dup_trans_dialog_internal (GtkWidget * parent,
{
GNCDateEdit *gde;
gde = GNC_DATE_EDIT (dt_dialog->date_edit);
gde = GNC_DATE_EDIT(dt_dialog->date_edit);
entry = gde->date_entry;
gtk_widget_grab_focus (entry);
}
if (window_title)
gtk_window_set_title (GTK_WINDOW (dt_dialog->dialog), window_title);
gtk_window_set_title (GTK_WINDOW(dt_dialog->dialog), window_title);
if (title)
{
gchar *full_text = g_strdup_printf("<b>%s</b>", title);
gtk_label_set_markup(GTK_LABEL (dt_dialog->duplicate_title_label), full_text);
g_free(full_text);
gchar *full_text = g_strdup_printf ("<b>%s</b>", title);
gtk_label_set_markup (GTK_LABEL(dt_dialog->duplicate_title_label), full_text);
g_free (full_text);
}
if (!out_num)
{
// The "num" field isn't being asked for, so we make the widgets invisible
gtk_widget_set_visible(dt_dialog->num_label, FALSE);
gtk_widget_set_visible(dt_dialog->num_edit, FALSE);
gtk_widget_set_visible (dt_dialog->num_label, FALSE);
gtk_widget_set_visible (dt_dialog->num_edit, FALSE);
}
if (!tnum)
{
// The "tnum" field isn't being asked for, so we make the widgets invisible
gtk_widget_set_visible(dt_dialog->tnum_label, FALSE);
gtk_widget_set_visible(dt_dialog->tnum_edit, FALSE);
gtk_widget_set_visible (dt_dialog->tnum_label, FALSE);
gtk_widget_set_visible (dt_dialog->tnum_edit, FALSE);
}
if (!show_date && !tnum)
{
// The "date" and the "tnum" fields aren't being asked for, this is a split copy
gtk_label_set_markup(GTK_LABEL (dt_dialog->num_label), _("Action/Number"));
gtk_label_set_markup (GTK_LABEL(dt_dialog->num_label), _("Action/Number"));
}
if (tnum)
{
gtk_entry_set_activates_default(GTK_ENTRY(dt_dialog->num_edit), FALSE);
gtk_entry_set_activates_default(GTK_ENTRY(dt_dialog->tnum_edit), TRUE);
gtk_entry_set_activates_default (GTK_ENTRY(dt_dialog->num_edit), FALSE);
gtk_entry_set_activates_default (GTK_ENTRY(dt_dialog->tnum_edit), TRUE);
}
if (tlink)
{
gtk_widget_set_visible(dt_dialog->link_label, TRUE);
gtk_widget_set_visible(dt_dialog->link_edit, TRUE);
gtk_widget_set_visible (dt_dialog->link_label, TRUE);
gtk_widget_set_visible (dt_dialog->link_edit, TRUE);
}
else
{
gtk_widget_set_visible(dt_dialog->link_label, FALSE);
gtk_widget_set_visible(dt_dialog->link_edit, FALSE);
gtk_widget_set_visible (dt_dialog->link_label, FALSE);
gtk_widget_set_visible (dt_dialog->link_edit, FALSE);
}
result = gtk_dialog_run (GTK_DIALOG (dt_dialog->dialog));
result = gtk_dialog_run (GTK_DIALOG(dt_dialog->dialog));
if (result == GTK_RESPONSE_OK)
{
if (date_p)
*date_p = gnc_date_edit_get_date (GNC_DATE_EDIT (dt_dialog->date_edit));
*date_p = gnc_date_edit_get_date (GNC_DATE_EDIT(dt_dialog->date_edit));
if (gdate_p)
gnc_date_edit_get_gdate (GNC_DATE_EDIT (dt_dialog->date_edit), gdate_p);
gnc_date_edit_get_gdate (GNC_DATE_EDIT(dt_dialog->date_edit), gdate_p);
if (out_num)
*out_num = g_strdup (gtk_entry_get_text (GTK_ENTRY (dt_dialog->num_edit)));
*out_num = g_strdup (gtk_entry_get_text (GTK_ENTRY(dt_dialog->num_edit)));
if (tnum)
*out_tnum = g_strdup (gtk_entry_get_text (GTK_ENTRY (dt_dialog->tnum_edit)));
*out_tnum = g_strdup (gtk_entry_get_text (GTK_ENTRY(dt_dialog->tnum_edit)));
if (tlink)
{
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dt_dialog->link_edit)))
@ -289,20 +336,23 @@ gnc_dup_trans_dialog_internal (GtkWidget * parent,
else
ok = FALSE;
gtk_widget_destroy(GTK_WIDGET(dt_dialog->dialog));
gtk_widget_destroy (GTK_WIDGET(dt_dialog->dialog));
g_free (dt_dialog);
return ok;
}
gboolean
gnc_dup_trans_dialog (GtkWidget * parent, const char* title, gboolean show_date,
time64 *date_p, const char *num, char **out_num,
gnc_dup_trans_dialog (GtkWidget * parent, const char* title,
gboolean show_date, time64 *date_p,
const char *num, char **out_num,
const char *tnum, char **out_tnum,
const char *tlink, char **out_tlink)
{
return gnc_dup_trans_dialog_internal(parent, NULL, title, show_date, date_p, NULL,
num, out_num, tnum, out_tnum, tlink, out_tlink);
return gnc_dup_trans_dialog_internal (parent, NULL, title,
show_date, date_p, NULL,
num, out_num, tnum, out_tnum,
tlink, out_tlink);
}
gboolean
@ -310,29 +360,35 @@ gnc_dup_trans_dialog_gdate (GtkWidget * parent, GDate *gdate_p,
const char *num, char **out_num)
{
time64 tmp_time;
g_assert(gdate_p);
g_assert (gdate_p);
tmp_time = gdate_to_time64 (*gdate_p);
return gnc_dup_trans_dialog_internal(parent, NULL, NULL, TRUE, &tmp_time, gdate_p,
num, out_num, NULL, NULL, NULL, NULL);
return gnc_dup_trans_dialog_internal (parent, NULL, NULL, TRUE,
&tmp_time, gdate_p,
num, out_num, NULL, NULL,
NULL, NULL);
}
gboolean
gnc_dup_time64_dialog (GtkWidget * parent, const char *window_title,
const char* title, time64 *date)
{
return gnc_dup_trans_dialog_internal(parent, window_title, title, TRUE, date, NULL,
NULL, NULL, NULL, NULL, NULL, NULL);
return gnc_dup_trans_dialog_internal (parent, window_title, title, TRUE,
date, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL);
}
gboolean
gnc_dup_date_dialog (GtkWidget * parent, const char* title, GDate *gdate_p)
{
time64 tmp_time;
g_assert(gdate_p);
g_assert (gdate_p);
tmp_time = gdate_to_time64(*gdate_p);
return gnc_dup_trans_dialog_internal(parent, NULL, title, TRUE, &tmp_time, gdate_p,
NULL, NULL, NULL, NULL, NULL, NULL);
tmp_time = gdate_to_time64 (*gdate_p);
return gnc_dup_trans_dialog_internal (parent, NULL, title, TRUE,
&tmp_time, gdate_p,
NULL, NULL, NULL, NULL,
NULL, NULL);
}

View File

@ -50,8 +50,9 @@
* Return: TRUE if user closes dialog with 'OK' *
\***********************************************************************/
gboolean
gnc_dup_trans_dialog (GtkWidget * parent, const char* title, gboolean show_date,
time64 *date_p, const char *num, char **out_num,
gnc_dup_trans_dialog (GtkWidget * parent, const char* title,
gboolean show_date, time64 *date_p,
const char *num, char **out_num,
const char *tnum, char **out_tnum,
const char *tdoclink, char **out_tdoclink);

File diff suppressed because it is too large Load Diff

View File

@ -35,49 +35,49 @@ typedef struct gnc_option_win GNCOptionWin;
typedef void (* GNCOptionWinCallback)(GNCOptionWin *, gpointer data);
GNCOptionWin * gnc_options_dialog_new_modal(gboolean modal, gchar *title,
const char *component_class,
GtkWindow *parent);
GNCOptionWin * gnc_options_dialog_new(gchar *title, GtkWindow *parent);
GNCOptionWin * gnc_options_dialog_new_w_dialog(gchar *title, GtkWidget *dialog);
void gnc_options_dialog_destroy(GNCOptionWin * win);
GNCOptionWin * gnc_options_dialog_new_modal (gboolean modal, gchar *title,
const char *component_class,
GtkWindow *parent);
GNCOptionWin * gnc_options_dialog_new (gchar *title, GtkWindow *parent);
GNCOptionWin * gnc_options_dialog_new_w_dialog (gchar *title, GtkWidget *dialog);
void gnc_options_dialog_destroy (GNCOptionWin * win);
void gnc_options_register_stocks (void);
GtkWidget * gnc_options_dialog_widget(GNCOptionWin * win);
GtkWidget * gnc_options_page_list(GNCOptionWin * win);
GtkWidget * gnc_options_dialog_notebook(GNCOptionWin * win);
GtkWidget * gnc_options_dialog_widget (GNCOptionWin * win);
GtkWidget * gnc_options_page_list (GNCOptionWin * win);
GtkWidget * gnc_options_dialog_notebook (GNCOptionWin * win);
void gnc_options_dialog_changed (GNCOptionWin *win);
void gnc_option_changed_widget_cb(GtkWidget *widget, GNCOption *option);
void gnc_option_changed_option_cb(GtkWidget *dummy, GNCOption *option);
void gnc_option_changed_widget_cb (GtkWidget *widget, GNCOption *option);
void gnc_option_changed_option_cb (GtkWidget *dummy, GNCOption *option);
void gnc_options_dialog_set_apply_cb(GNCOptionWin * win,
GNCOptionWinCallback thunk,
gpointer cb_data);
void gnc_options_dialog_set_help_cb(GNCOptionWin * win,
GNCOptionWinCallback thunk,
gpointer cb_data);
void gnc_options_dialog_set_close_cb(GNCOptionWin * win,
void gnc_options_dialog_set_apply_cb (GNCOptionWin * win,
GNCOptionWinCallback thunk,
gpointer cb_data);
void gnc_options_dialog_set_help_cb (GNCOptionWin * win,
GNCOptionWinCallback thunk,
gpointer cb_data);
void gnc_options_dialog_set_close_cb (GNCOptionWin * win,
GNCOptionWinCallback thunk,
gpointer cb_data);
void gnc_options_dialog_set_global_help_cb(GNCOptionWinCallback thunk,
gpointer cb_data);
void gnc_options_dialog_set_global_help_cb (GNCOptionWinCallback thunk,
gpointer cb_data);
void gnc_options_dialog_build_contents(GNCOptionWin *win,
GNCOptionDB *odb);
void gnc_options_dialog_build_contents (GNCOptionWin *win,
GNCOptionDB *odb);
void gnc_options_dialog_build_contents_full(GNCOptionWin *win,
GNCOptionDB *odb,
gboolean show_dialog);
void gnc_options_dialog_build_contents_full (GNCOptionWin *win,
GNCOptionDB *odb,
gboolean show_dialog);
/* Both apply_cb and close_cb should be scheme functions with 0 arguments.
* References to these functions will be held until the close_cb is called
*/
void gnc_options_dialog_set_scm_callbacks (GNCOptionWin *win,
SCM apply_cb,
SCM close_cb);
SCM apply_cb,
SCM close_cb);
/*****************************************************************/
/* Option Registration */

File diff suppressed because it is too large Load Diff

View File

@ -409,6 +409,9 @@ tax_table_entries_refresh (TaxTableWindow *ttw)
g_free (row_text[1]);
}
if (list)
g_list_free (list);
if (reference)
{
path = gtk_tree_row_reference_get_path (reference);

View File

@ -89,35 +89,32 @@ gnc_account_sel_get_type (void)
};
account_sel_type = g_type_register_static (GTK_TYPE_BOX,
"GNCAccountSel",
&account_sel_info, 0);
"GNCAccountSel",
&account_sel_info, 0);
}
return account_sel_type;
}
static
void
gnc_account_sel_event_cb( QofInstance *entity,
static void
gnc_account_sel_event_cb (QofInstance *entity,
QofEventId event_type,
gpointer user_data,
gpointer event_data )
gpointer event_data)
{
if ( ! ( event_type == QOF_EVENT_CREATE
|| event_type == QOF_EVENT_MODIFY
|| event_type == QOF_EVENT_DESTROY )
|| !GNC_IS_ACCOUNT(entity) )
if (!(event_type == QOF_EVENT_CREATE
|| event_type == QOF_EVENT_MODIFY
|| event_type == QOF_EVENT_DESTROY)
|| !GNC_IS_ACCOUNT(entity))
{
return;
}
gas_populate_list( (GNCAccountSel*)user_data );
gas_populate_list ((GNCAccountSel*)user_data);
}
static
void
static void
gnc_account_sel_class_init (GNCAccountSelClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS(klass);
parent_class = g_type_class_peek_parent (klass);
@ -137,14 +134,14 @@ gnc_account_sel_class_init (GNCAccountSelClass *klass)
}
static void
combo_changed_cb(GNCAccountSel *gas, gpointer combo)
combo_changed_cb (GNCAccountSel *gas, gpointer combo)
{
gint selected = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
gint selected = gtk_combo_box_get_active (GTK_COMBO_BOX(combo));
if (selected == gas->currentSelection)
return;
gas->currentSelection = selected;
g_signal_emit_by_name(gas, "account_sel_changed");
g_signal_emit_by_name (gas, "account_sel_changed");
}
static void
@ -159,37 +156,37 @@ gnc_account_sel_init (GNCAccountSel *gas)
gas->newAccountButton = NULL;
gas->currentSelection = -1;
g_object_set(gas, "spacing", 2, (gchar*)NULL);
g_object_set (gas, "spacing", 2, (gchar*)NULL);
// Set the name for this widget so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(gas), "gnc-id-account-select");
gas->store = gtk_list_store_new(NUM_ACCT_COLS, G_TYPE_STRING, G_TYPE_POINTER);
widget = gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(gas->store));
gas->store = gtk_list_store_new (NUM_ACCT_COLS, G_TYPE_STRING, G_TYPE_POINTER);
widget = gtk_combo_box_new_with_model_and_entry (GTK_TREE_MODEL(gas->store));
gas->combo = GTK_COMBO_BOX(widget);
gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(widget), ACCT_COL_NAME);
g_object_unref(gas->store);
g_signal_connect_swapped(gas->combo, "changed",
G_CALLBACK(combo_changed_cb), gas);
gtk_container_add( GTK_CONTAINER(gas), widget );
gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX(widget), ACCT_COL_NAME);
g_object_unref (gas->store);
g_signal_connect_swapped (gas->combo, "changed",
G_CALLBACK(combo_changed_cb), gas);
gtk_container_add (GTK_CONTAINER(gas), widget);
/* Add completion. */
gnc_cbwe_require_list_item(GTK_COMBO_BOX(widget));
gnc_cbwe_require_list_item (GTK_COMBO_BOX(widget));
/* Get the accounts, place into combo list */
gas_populate_list( gas );
gas_populate_list (gas);
gas->eventHandlerId =
qof_event_register_handler( gnc_account_sel_event_cb, gas );
qof_event_register_handler (gnc_account_sel_event_cb, gas);
gas->initDone = TRUE;
}
void
gnc_account_sel_set_hexpand ( GNCAccountSel *gas, gboolean expand )
gnc_account_sel_set_hexpand (GNCAccountSel *gas, gboolean expand)
{
gtk_widget_set_hexpand( GTK_WIDGET(gas), expand );
gtk_widget_set_hexpand( GTK_WIDGET(gas->combo), expand );
gtk_widget_set_hexpand (GTK_WIDGET(gas), expand);
gtk_widget_set_hexpand (GTK_WIDGET(gas->combo), expand);
}
typedef struct
@ -198,9 +195,8 @@ typedef struct
GList **outList;
} account_filter_data;
static
void
gas_populate_list( GNCAccountSel *gas )
static void
gas_populate_list (GNCAccountSel *gas)
{
account_filter_data atnd;
Account *root;
@ -211,56 +207,52 @@ gas_populate_list( GNCAccountSel *gas )
GList *accts, *ptr, *filteredAccts;
gchar *currentSel, *name;
entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(gas->combo)));
currentSel = gtk_editable_get_chars(
GTK_EDITABLE(entry), 0, -1 );
entry = GTK_ENTRY(gtk_bin_get_child (GTK_BIN(gas->combo)));
currentSel = gtk_editable_get_chars (GTK_EDITABLE(entry), 0, -1 );
g_signal_handlers_block_by_func( gas->combo, combo_changed_cb , gas );
g_signal_handlers_block_by_func (gas->combo, combo_changed_cb , gas);
root = gnc_book_get_root_account( gnc_get_current_book() );
accts = gnc_account_get_descendants_sorted( root );
root = gnc_book_get_root_account (gnc_get_current_book ());
accts = gnc_account_get_descendants_sorted (root);
filteredAccts = NULL;
atnd.gas = gas;
atnd.outList = &filteredAccts;
g_list_foreach( accts, gas_filter_accounts, (gpointer)&atnd );
g_list_free( accts );
g_list_foreach (accts, gas_filter_accounts, (gpointer)&atnd);
g_list_free (accts);
gtk_list_store_clear(gas->store);
gtk_list_store_clear (gas->store);
for (ptr = filteredAccts, i = 0; ptr; ptr = g_list_next(ptr), i++)
{
acc = ptr->data;
name = gnc_account_get_full_name(acc);
gtk_list_store_append(gas->store, &iter);
gtk_list_store_set(gas->store, &iter,
ACCT_COL_NAME, name,
ACCT_COL_PTR, acc,
-1);
if (g_utf8_collate(name, currentSel) == 0)
name = gnc_account_get_full_name (acc);
gtk_list_store_append (gas->store, &iter);
gtk_list_store_set (gas->store, &iter,
ACCT_COL_NAME, name,
ACCT_COL_PTR, acc,
-1);
if (g_utf8_collate (name, currentSel) == 0)
{
active = i;
g_free(name);
g_free (name);
}
}
/* If the account which was in the text box before still exists, then
* reset to it. */
if (active != -1)
gtk_combo_box_set_active(GTK_COMBO_BOX(gas->combo), active);
gtk_combo_box_set_active (GTK_COMBO_BOX(gas->combo), active);
g_signal_handlers_unblock_by_func( gas->combo, combo_changed_cb , gas );
g_signal_handlers_unblock_by_func (gas->combo, combo_changed_cb , gas);
g_list_free( filteredAccts );
if ( currentSel )
{
g_free( currentSel );
}
g_list_free (filteredAccts);
if (currentSel)
g_free (currentSel);
}
static
void
gas_filter_accounts( gpointer data, gpointer user_data )
static void
gas_filter_accounts (gpointer data, gpointer user_data)
{
account_filter_data *atnd;
Account *a;
@ -268,53 +260,47 @@ gas_filter_accounts( gpointer data, gpointer user_data )
atnd = (account_filter_data*)user_data;
a = (Account*)data;
/* Filter as we've been configured to do. */
if ( atnd->gas->acctTypeFilters )
if (atnd->gas->acctTypeFilters)
{
/* g_list_find is the poor-mans '(member ...)', especially
* easy when the data pointers in the list are just casted
* account type identifiers. */
if ( g_list_find( atnd->gas->acctTypeFilters,
GINT_TO_POINTER(xaccAccountGetType( a )) )
== NULL )
if (g_list_find (atnd->gas->acctTypeFilters,
GINT_TO_POINTER(xaccAccountGetType (a)))
== NULL)
{
return;
}
}
if ( atnd->gas->acctCommodityFilters )
if (atnd->gas->acctCommodityFilters)
{
if ( g_list_find_custom( atnd->gas->acctCommodityFilters,
GINT_TO_POINTER(xaccAccountGetCommodity( a )),
gnc_commodity_compare_void)
== NULL )
if (g_list_find_custom (atnd->gas->acctCommodityFilters,
GINT_TO_POINTER(xaccAccountGetCommodity (a)),
gnc_commodity_compare_void)
== NULL)
{
return;
}
}
*atnd->outList = g_list_append( *atnd->outList, a );
*atnd->outList = g_list_append (*atnd->outList, a);
}
GtkWidget *
gnc_account_sel_new (void)
{
GNCAccountSel *gas;
GNCAccountSel *gas = g_object_new (GNC_TYPE_ACCOUNT_SEL, NULL);
gas = g_object_new (GNC_TYPE_ACCOUNT_SEL, NULL);
return GTK_WIDGET (gas);
return GTK_WIDGET(gas);
}
typedef struct
{
GNCAccountSel *gas;
Account *acct;
Account *acct;
} gas_find_data;
static
gboolean
static gboolean
gnc_account_sel_find_account (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
@ -322,93 +308,89 @@ gnc_account_sel_find_account (GtkTreeModel *model,
{
Account *model_acc;
gtk_tree_model_get(model, iter, ACCT_COL_PTR, &model_acc, -1);
gtk_tree_model_get (model, iter, ACCT_COL_PTR, &model_acc, -1);
if (data->acct != model_acc)
return FALSE;
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(data->gas->combo), iter);
gtk_combo_box_set_active_iter (GTK_COMBO_BOX(data->gas->combo), iter);
return TRUE;
}
void
gnc_account_sel_set_account( GNCAccountSel *gas, Account *acct, gboolean set_default_acct )
gnc_account_sel_set_account (GNCAccountSel *gas, Account *acct,
gboolean set_default_acct)
{
gas_find_data data;
if (set_default_acct)
{
gtk_combo_box_set_active(GTK_COMBO_BOX(gas->combo), 0);
if ( !acct )
gtk_combo_box_set_active (GTK_COMBO_BOX(gas->combo), 0);
if (!acct)
return;
}
else
{
gtk_combo_box_set_active( GTK_COMBO_BOX(gas->combo), -1 );
if ( !acct )
gtk_combo_box_set_active (GTK_COMBO_BOX(gas->combo), -1 );
if (!acct)
{
GtkEntry *entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(gas->combo)));
gtk_editable_delete_text(GTK_EDITABLE(entry), 0, -1);
GtkEntry *entry = GTK_ENTRY(gtk_bin_get_child (GTK_BIN(gas->combo)));
gtk_editable_delete_text (GTK_EDITABLE(entry), 0, -1);
return;
}
}
data.gas = gas;
data.acct = acct;
gtk_tree_model_foreach(GTK_TREE_MODEL(gas->store),
(GtkTreeModelForeachFunc)gnc_account_sel_find_account,
&data);
gtk_tree_model_foreach (GTK_TREE_MODEL(gas->store),
(GtkTreeModelForeachFunc)gnc_account_sel_find_account,
&data);
}
Account*
gnc_account_sel_get_account( GNCAccountSel *gas )
gnc_account_sel_get_account (GNCAccountSel *gas)
{
GtkTreeIter iter;
Account *acc;
if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(gas->combo), &iter))
if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX(gas->combo), &iter))
return NULL;
gtk_tree_model_get(GTK_TREE_MODEL(gas->store), &iter,
ACCT_COL_PTR, &acc,
-1);
gtk_tree_model_get (GTK_TREE_MODEL(gas->store), &iter,
ACCT_COL_PTR, &acc,
-1);
return acc;
}
void
gnc_account_sel_set_acct_filters( GNCAccountSel *gas, GList *typeFilters, GList *commodityFilters )
gnc_account_sel_set_acct_filters (GNCAccountSel *gas, GList *typeFilters,
GList *commodityFilters)
{
if ( gas->acctTypeFilters != NULL )
if (gas->acctTypeFilters != NULL)
{
g_list_free( gas->acctTypeFilters );
g_list_free (gas->acctTypeFilters);
gas->acctTypeFilters = NULL;
}
if ( gas->acctCommodityFilters != NULL)
if (gas->acctCommodityFilters != NULL)
{
g_list_free( gas->acctCommodityFilters );
g_list_free (gas->acctCommodityFilters);
gas->acctCommodityFilters = NULL;
}
/* If both filters are null, then no filters exist. */
if (( ! typeFilters ) && ( ! commodityFilters))
{
if ((!typeFilters) && (!commodityFilters))
return;
}
/* This works because the GNCAccountTypes in the list are
* ints-casted-as-pointers. */
if (typeFilters)
{
gas->acctTypeFilters = g_list_copy( typeFilters );
}
gas->acctTypeFilters = g_list_copy (typeFilters);
/* Save the commodity filter list */
if (commodityFilters)
{
gas->acctCommodityFilters = g_list_copy(commodityFilters);
}
gas->acctCommodityFilters = g_list_copy (commodityFilters);
gas_populate_list( gas );
gas_populate_list (gas);
}
static void
@ -417,14 +399,12 @@ gnc_account_sel_finalize (GObject *object)
GNCAccountSel *gas;
g_return_if_fail (object != NULL);
g_return_if_fail (GNC_IS_ACCOUNT_SEL (object));
g_return_if_fail (GNC_IS_ACCOUNT_SEL(object));
gas = GNC_ACCOUNT_SEL (object);
gas = GNC_ACCOUNT_SEL(object);
if (gas->acctTypeFilters)
{
g_list_free (gas->acctTypeFilters);
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -435,9 +415,9 @@ gnc_account_sel_dispose (GObject *object)
GNCAccountSel *gas;
g_return_if_fail (object != NULL);
g_return_if_fail (GNC_IS_ACCOUNT_SEL (object));
g_return_if_fail (GNC_IS_ACCOUNT_SEL(object));
gas = GNC_ACCOUNT_SEL (object);
gas = GNC_ACCOUNT_SEL(object);
if (gas->eventHandlerId)
{
@ -449,69 +429,75 @@ gnc_account_sel_dispose (GObject *object)
}
void
gnc_account_sel_set_new_account_ability( GNCAccountSel *gas,
gboolean state )
gnc_account_sel_set_new_account_ability (GNCAccountSel *gas,
gboolean state)
{
g_return_if_fail (gas != NULL);
if ( state == (gas->newAccountButton != NULL) )
if (state == (gas->newAccountButton != NULL))
{
/* We're already in that state; don't do anything. */
return;
}
if ( gas->newAccountButton )
if (gas->newAccountButton)
{
g_assert( state == TRUE );
g_assert (state == TRUE);
/* destroy the existing button. */
gtk_container_remove( GTK_CONTAINER(gas),
gas->newAccountButton );
gtk_widget_destroy( gas->newAccountButton );
gtk_container_remove (GTK_CONTAINER(gas), gas->newAccountButton);
gtk_widget_destroy (gas->newAccountButton);
gas->newAccountButton = NULL;
return;
}
/* create the button. */
gas->newAccountButton = gtk_button_new_with_label( _("New...") );
g_signal_connect( gas->newAccountButton,
gas->newAccountButton = gtk_button_new_with_label (_("New..."));
g_signal_connect (gas->newAccountButton,
"clicked",
G_CALLBACK( gas_new_account_click ),
gas );
gtk_box_pack_start( GTK_BOX(gas), gas->newAccountButton,
FALSE, FALSE, 0 );
G_CALLBACK(gas_new_account_click),
gas);
gtk_box_pack_start (GTK_BOX(gas), gas->newAccountButton,
FALSE, FALSE, 0);
}
void
gnc_account_sel_set_new_account_modal( GNCAccountSel *gas,
gboolean state )
gnc_account_sel_set_new_account_modal (GNCAccountSel *gas,
gboolean state)
{
g_return_if_fail (gas != NULL);
gas->isModal = state;
}
static void
gas_new_account_click( GtkButton *b, gpointer ud )
gas_new_account_click (GtkButton *b, gpointer ud)
{
GNCAccountSel *gas = (GNCAccountSel*)ud;
GtkWindow *parent = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gas)));
Account *account = NULL;
GtkWindow *parent = GTK_WINDOW(gtk_widget_get_toplevel (GTK_WIDGET(gas)));
if (gas->isModal)
gnc_ui_new_accounts_from_name_window_with_types (parent, NULL,
gas->acctTypeFilters );
{
account = gnc_ui_new_accounts_from_name_window_with_types (parent, NULL,
gas->acctTypeFilters);
if (account)
gnc_account_sel_set_account (gas, account, FALSE);
}
else
gnc_ui_new_account_with_types (parent, gnc_get_current_book(),
gas->acctTypeFilters );
gas->acctTypeFilters);
}
gint
gnc_account_sel_get_num_account( GNCAccountSel *gas )
gnc_account_sel_get_num_account (GNCAccountSel *gas)
{
if (NULL == gas)
return 0;
return gtk_tree_model_iter_n_children( GTK_TREE_MODEL(gas->store), NULL );
return gtk_tree_model_iter_n_children (GTK_TREE_MODEL(gas->store), NULL);
}
void
gnc_account_sel_purge_account( GNCAccountSel *gas,
gnc_account_sel_purge_account (GNCAccountSel *gas,
Account *target,
gboolean recursive)
{
@ -520,43 +506,40 @@ gnc_account_sel_purge_account( GNCAccountSel *gas,
Account *acc;
gboolean more;
if (!gtk_tree_model_get_iter_first(model, &iter))
if (!gtk_tree_model_get_iter_first (model, &iter))
return;
if (!recursive)
{
do
{
gtk_tree_model_get(model, &iter, ACCT_COL_PTR, &acc, -1);
gtk_tree_model_get (model, &iter, ACCT_COL_PTR, &acc, -1);
if (acc == target)
{
gtk_list_store_remove(gas->store, &iter);
gtk_list_store_remove (gas->store, &iter);
break;
}
}
while (gtk_tree_model_iter_next(model, &iter));
while (gtk_tree_model_iter_next (model, &iter));
}
else
{
do
{
gtk_tree_model_get(model, &iter, ACCT_COL_PTR, &acc, -1);
gtk_tree_model_get (model, &iter, ACCT_COL_PTR, &acc, -1);
while (acc)
{
if (acc == target)
break;
acc = gnc_account_get_parent(acc);
acc = gnc_account_get_parent (acc);
}
if (acc == target)
more = gtk_list_store_remove(gas->store, &iter);
more = gtk_list_store_remove (gas->store, &iter);
else
more = gtk_tree_model_iter_next(model, &iter);
more = gtk_tree_model_iter_next (model, &iter);
}
while (more);
}
gtk_combo_box_set_active(GTK_COMBO_BOX(gas->combo), 0);
gtk_combo_box_set_active (GTK_COMBO_BOX(gas->combo), 0);
}

View File

@ -74,12 +74,13 @@ GtkWidget* gnc_account_sel_new (void);
* list, then it doesn't change the state of the GAS. If the account is
* NULL, then the first list selection is made if set_default_acct is TRUE.
**/
void gnc_account_sel_set_account( GNCAccountSel *gas, Account *acct, gboolean set_default_acct );
void gnc_account_sel_set_account (GNCAccountSel *gas, Account *acct,
gboolean set_default_acct);
/**
* Returns the currently-selected Account. If, for some reason the selection
* is in a bad state, NULL will be returned.
**/
Account* gnc_account_sel_get_account( GNCAccountSel *gas );
Account* gnc_account_sel_get_account (GNCAccountSel *gas);
/**
* The GNCAccountSel can be setup to filter the accounts displayed.
@ -87,25 +88,24 @@ Account* gnc_account_sel_get_account( GNCAccountSel *gas );
* @param commodityFilters A GList of gnc_commodity types which are allowed.
* The list is copied, of course.
**/
void gnc_account_sel_set_acct_filters( GNCAccountSel *gas, GList *typeFilters, GList *commodityFilters );
void gnc_account_sel_set_acct_filters (GNCAccountSel *gas, GList *typeFilters,
GList *commodityFilters);
/**
* Conditional inclusion of a new-account button to the right of the
* combobox.
* @param state TRUE if the new-account button is desired, FALSE otherwise.
**/
void gnc_account_sel_set_new_account_ability( GNCAccountSel *gas,
gboolean state );
void gnc_account_sel_set_new_account_ability (GNCAccountSel *gas, gboolean state);
/**
* Conditional call of the new-account window in modal mode.
* @param state TRUE if the new-account window should be modal, FALSE otherwise.
**/
void gnc_account_sel_set_new_account_modal( GNCAccountSel *gas,
gboolean state );
void gnc_account_sel_set_new_account_modal (GNCAccountSel *gas, gboolean state);
gint gnc_account_sel_get_num_account( GNCAccountSel *gas );
void gnc_account_sel_purge_account( GNCAccountSel *gas, Account *acc, gboolean recursive);
void gnc_account_sel_set_hexpand ( GNCAccountSel *gas, gboolean expand);
gint gnc_account_sel_get_num_account (GNCAccountSel *gas);
void gnc_account_sel_purge_account (GNCAccountSel *gas, Account *acc, gboolean recursive);
void gnc_account_sel_set_hexpand (GNCAccountSel *gas, gboolean expand);
#endif /* GNC_ACCOUNT_SEL_H */

View File

@ -112,6 +112,7 @@ static void
gnc_popup_entry_init (GncPopupEntry *widget)
{
GtkWidget *arrow;
GtkStyleContext *context;
widget->editing_canceled = FALSE;
@ -123,14 +124,17 @@ gnc_popup_entry_init (GncPopupEntry *widget)
gtk_entry_set_visibility (GTK_ENTRY(widget->entry), TRUE);
gtk_widget_show (widget->entry);
context = gtk_widget_get_style_context (widget->entry);
gtk_style_context_add_class (context, "combo");
widget->button = gtk_button_new ();
gtk_widget_show (widget->button);
arrow = gtk_image_new_from_icon_name ("go-down", GTK_ICON_SIZE_BUTTON);
gtk_widget_show (arrow);
context = gtk_widget_get_style_context (widget->button);
gtk_style_context_add_class (context, "combo");
g_signal_connect (G_OBJECT(arrow), "draw",
G_CALLBACK(gnc_draw_arrow_cb), GINT_TO_POINTER(1));
arrow = gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_BUTTON);
gtk_widget_show (arrow);
gtk_container_add (GTK_CONTAINER(widget->button), arrow);
@ -144,6 +148,13 @@ gnc_popup_entry_init (GncPopupEntry *widget)
gtk_widget_add_events (GTK_WIDGET(widget), GDK_KEY_RELEASE_MASK);
}
static void
gpw_grab_focus (GtkWidget *box)
{
GncPopupEntry *widget = GNC_POPUP_ENTRY(box);
gtk_widget_grab_focus (widget->entry);
}
static void
gnc_popup_entry_class_init (GncPopupEntryClass *klass)
{
@ -151,6 +162,7 @@ gnc_popup_entry_class_init (GncPopupEntryClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
widget_class->key_press_event = gpw_key_press_event;
widget_class->grab_focus = gpw_grab_focus;
gobject_class->set_property = gpw_set_property;
gobject_class->get_property = gpw_get_property;
@ -249,7 +261,7 @@ gtk_cell_editable_key_press_event (GtkEntry *entry,
if (qof_scan_date (date_string, &day, &month, &year))
{
when.tm_year = year - 1900;
when.tm_mon = month - 1 ;
when.tm_mon = month - 1;
when.tm_mday = day;
if (!gnc_handle_date_accelerator (key_event, &when, date_string))
@ -363,7 +375,7 @@ gnc_popup_get_button_width (void)
gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER(window), button);
arrow = gtk_image_new_from_icon_name ("go-down", GTK_ICON_SIZE_BUTTON);
arrow = gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_BUTTON);
gtk_widget_show (arrow);
gtk_container_add (GTK_CONTAINER(button), arrow);

View File

@ -177,6 +177,7 @@ gnc_combott_init (GncCombott *combott)
GtkWidget *arrow;
GtkWidget *button;
GtkWidget *sep;
GtkStyleContext *context;
GncCombottPrivate *priv = GNC_COMBOTT_GET_PRIVATE (combott);
@ -192,10 +193,7 @@ gnc_combott_init (GncCombott *combott)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous (GTK_BOX(hbox), FALSE);
arrow = gtk_image_new_from_icon_name ("go-down", GTK_ICON_SIZE_BUTTON);
g_signal_connect (G_OBJECT (arrow), "draw",
G_CALLBACK (gnc_draw_arrow_cb), GINT_TO_POINTER(1));
arrow = gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_BUTTON);
gtk_widget_set_margin_start (GTK_WIDGET(arrow), 5);
gtk_box_pack_end (GTK_BOX (hbox), arrow, FALSE, FALSE, 0);
@ -207,10 +205,16 @@ gnc_combott_init (GncCombott *combott)
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
priv->label = label;
context = gtk_widget_get_style_context (priv->label);
gtk_style_context_add_class (context, "combo");
button = gtk_button_new();
gtk_container_add(GTK_CONTAINER(button), GTK_WIDGET(hbox));
priv->button = button;
context = gtk_widget_get_style_context (priv->button);
gtk_style_context_add_class (context, "combo");
gtk_container_add(GTK_CONTAINER(combott), GTK_WIDGET(button));
g_signal_connect (button, "event",

View File

@ -892,10 +892,7 @@ create_children (GNCDateEdit *gde)
gtk_widget_show (GTK_WIDGET(gde->cal_label));
/* Graphic for the popup button. */
arrow = gtk_image_new_from_icon_name ("go-down", GTK_ICON_SIZE_BUTTON);
g_signal_connect (G_OBJECT (arrow), "draw",
G_CALLBACK (gnc_draw_arrow_cb), GINT_TO_POINTER(1));
arrow = gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_BUTTON);
gtk_box_pack_start (GTK_BOX (hbox), arrow, TRUE, FALSE, 0);
gtk_widget_show (GTK_WIDGET(arrow));

View File

@ -695,7 +695,7 @@ gnc_file_query_save (GtkWindow *parent, gboolean can_cancel)
/* private utilities for file open; done in two stages */
#define RESPONSE_NEW 1
#define RESPONSE_NO_FILE 1
#define RESPONSE_OPEN 2
#define RESPONSE_QUIT 3
#define RESPONSE_READONLY 4
@ -847,11 +847,11 @@ RESTART:
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE);
gnc_gtk_dialog_add_button(dialog, _("_Open Read-Only"),
"document-revert", RESPONSE_READONLY);
gnc_gtk_dialog_add_button(dialog, _("_Create New File"),
"document-new", RESPONSE_NEW);
"emblem-readonly", RESPONSE_READONLY);
gnc_gtk_dialog_add_button(dialog, _("Open with _No File"),
"document-new-symbolic", RESPONSE_NO_FILE);
gnc_gtk_dialog_add_button(dialog, _("Open _Anyway"),
"document-open", RESPONSE_OPEN);
"document-open-symbolic", RESPONSE_OPEN);
if (shutdown_cb)
gtk_dialog_add_button(GTK_DIALOG(dialog),
_("_Quit"), RESPONSE_QUIT);
@ -861,7 +861,7 @@ RESTART:
if (rc == GTK_RESPONSE_DELETE_EVENT)
{
rc = shutdown_cb ? RESPONSE_QUIT : RESPONSE_NEW;
rc = shutdown_cb ? RESPONSE_QUIT : RESPONSE_NO_FILE;
}
switch (rc)
{
@ -881,10 +881,9 @@ RESTART:
break;
default:
/* Can't use the given file, so just create a new
* database so that the user will get a window that
* they can click "Exit" on.
* Gnucash window so they can choose File->New, File->Open
* or just "Exit".
*/
gnc_file_new (parent);
break;
}
}

View File

@ -130,6 +130,20 @@ gnc_options_dialog_set_new_book_option_values (GNCOptionDB *odb)
}
}
static void
gnc_style_sheet_options_help_cb (GNCOptionWin *win, gpointer dat)
{
gnc_gnome_help (HF_HELP, HL_STYLE_SHEET);
}
void
gnc_options_dialog_set_style_sheet_options_help_cb (GNCOptionWin *win)
{
gnc_options_dialog_set_help_cb (win,
(GNCOptionWinCallback)gnc_style_sheet_options_help_cb,
NULL);
}
static void
gnc_commodity_help_cb (void)
{

View File

@ -73,6 +73,11 @@ void gnc_options_dialog_set_book_options_help_cb (GNCOptionWin *win);
*/
void gnc_options_dialog_set_new_book_option_values (GNCOptionDB *odb);
/** Set the help callback to 'gnc_style_sheet_options_help_cb' to open a help browser
* and point it to the Style Sheet link in the Help file.
*/
void gnc_options_dialog_set_style_sheet_options_help_cb (GNCOptionWin *win);
/** Given a file name, find and load the requested pixmap. This
* routine will display an error message if it can't find the file or
* load the pixmap.

View File

@ -67,6 +67,7 @@
#include "gnc-ui-util.h"
#include "gnc-uri-utils.h"
#include "gnc-version.h"
#include "gnc-warnings.h"
#include "gnc-window.h"
#include "gnc-prefs.h"
#include "option-util.h"
@ -231,6 +232,8 @@ typedef struct GncMainWindowPrivate
* group, the values are structures of type
* MergedActionEntry. */
GHashTable *merged_actions_table;
/** Set when restoring plugin pages */
gboolean restoring_pages;
} GncMainWindowPrivate;
GNC_DEFINE_TYPE_WITH_CODE(GncMainWindow, gnc_main_window, GTK_TYPE_WINDOW,
@ -529,6 +532,14 @@ typedef struct
} GncMainWindowSaveData;
gboolean
gnc_main_window_is_restoring_pages (GncMainWindow *window)
{
GncMainWindowPrivate *priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
return priv->restoring_pages;
}
/* Iterator function to walk all pages in all windows, calling the
* specified function for each page. */
void
@ -853,7 +864,7 @@ gnc_main_window_restore_window (GncMainWindow *window, GncMainWindowSaveData *da
{
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), desired_visibility);
}
priv->restoring_pages = TRUE;
/* Now populate the window with pages. */
for (i = 0; i < page_count; i++)
{
@ -865,7 +876,7 @@ gnc_main_window_restore_window (GncMainWindow *window, GncMainWindowSaveData *da
while (gtk_events_pending ())
gtk_main_iteration ();
}
priv->restoring_pages = FALSE;
/* Restore page ordering within the notebook. Use +1 notation so the
* numbers in the page order match the page sections, at least for
* the one window case. */
@ -899,6 +910,9 @@ gnc_main_window_restore_window (GncMainWindow *window, GncMainWindowSaveData *da
}
gtk_notebook_set_current_page (GTK_NOTEBOOK(priv->notebook),
order[0] - 1);
g_signal_emit_by_name (window, "page_changed",
g_list_nth_data (priv->usage_order, 0));
}
if (order)
{
@ -1391,8 +1405,14 @@ gnc_main_window_quit(GncMainWindow *window)
}
if (do_shutdown)
{
GList *w;
for (w = active_windows; w; w = g_list_next (w))
{
window = w->data;
window->window_quitting = TRUE; // set window_quitting on all windows
}
/* remove the preference callbacks from the main window */
window->window_quitting = TRUE;
gnc_main_window_remove_prefs (window);
g_timeout_add(250, gnc_main_window_timed_quit, NULL);
return TRUE;
@ -1410,6 +1430,32 @@ gnc_main_window_delete_event (GtkWidget *window,
if (already_dead)
return TRUE;
if (g_list_length (active_windows) > 1)
{
gint response;
GtkWidget *dialog;
gchar *message = _("This window is closing and will not be restored.");
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_NONE,
"%s", _("Close Window?"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG(dialog),
"%s", message);
gtk_dialog_add_buttons (GTK_DIALOG(dialog),
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_OK"), GTK_RESPONSE_YES,
(gchar *)NULL);
gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_YES);
response = gnc_dialog_run (GTK_DIALOG(dialog), GNC_PREF_WARN_CLOSING_WINDOW_QUESTION);
gtk_widget_destroy (dialog);
if (response == GTK_RESPONSE_CANCEL)
return TRUE;
}
if (!gnc_main_window_finish_pending(GNC_MAIN_WINDOW(window)))
{
/* Don't close the window. */
@ -2581,6 +2627,8 @@ gnc_main_window_init (GncMainWindow *window, void *data)
priv->event_handler_id =
qof_event_register_handler(gnc_main_window_event_handler, window);
priv->restoring_pages = FALSE;
/* Get the show_color_tabs value preference */
priv->show_color_tabs = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_COLOR);
@ -2728,6 +2776,58 @@ gnc_main_window_destroy (GtkWidget *widget)
}
static gboolean
gnc_main_window_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
GncMainWindowPrivate *priv;
GdkModifierType modifiers;
g_return_val_if_fail (GNC_IS_MAIN_WINDOW(widget), FALSE);
priv = GNC_MAIN_WINDOW_GET_PRIVATE(widget);
modifiers = gtk_accelerator_get_default_mod_mask ();
if ((event->state & modifiers) == (GDK_CONTROL_MASK | GDK_MOD1_MASK)) // Ctrl+Alt+
{
const gchar *account_key = C_ ("lower case key for short cut to 'Accounts'", "a");
guint account_keyval = gdk_keyval_from_name (account_key);
if ((account_keyval == event->keyval) || (account_keyval == gdk_keyval_to_lower (event->keyval)))
{
gint page = 0;
for (GList *item = priv->installed_pages; item; item = g_list_next (item))
{
const gchar *pname = gnc_plugin_page_get_plugin_name (GNC_PLUGIN_PAGE(item->data));
if (g_strcmp0 (pname, "GncPluginPageAccountTree") == 0)
{
gtk_notebook_set_current_page (GTK_NOTEBOOK(priv->notebook), page);
return TRUE;
}
page++;
}
}
else if ((GDK_KEY_Menu == event->keyval) || (GDK_KEY_space == event->keyval))
{
GList *menu = gtk_menu_get_for_attach_widget (GTK_WIDGET(priv->notebook));
if (menu)
{
gtk_menu_popup_at_widget (GTK_MENU(menu->data),
GTK_WIDGET(priv->notebook),
GDK_GRAVITY_SOUTH,
GDK_GRAVITY_SOUTH,
NULL);
return TRUE;
}
}
}
return FALSE;
}
/* Create a new gnc main window plugin.
*/
GncMainWindow *
@ -2762,6 +2862,11 @@ gnc_main_window_new (void)
#endif
gnc_engine_add_commit_error_callback( gnc_main_window_engine_commit_error_callback, window );
// set up a callback for noteboook navigation
g_signal_connect (G_OBJECT(window), "key-press-event",
G_CALLBACK(gnc_main_window_key_press_event),
NULL);
return window;
}
@ -3133,21 +3238,25 @@ gnc_main_window_close_page (GncPluginPage *page)
priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
if (priv->installed_pages == NULL)
{
GncPluginManager *manager = gnc_plugin_manager_get ();
GList *plugins = gnc_plugin_manager_get_plugins (manager);
/* remove only the preference callbacks from the window plugins */
window->just_plugin_prefs = TRUE;
g_list_foreach (plugins, gnc_main_window_remove_plugin, window);
window->just_plugin_prefs = FALSE;
g_list_free (plugins);
/* remove the preference callbacks from the main window */
gnc_main_window_remove_prefs (window);
if (g_list_length(active_windows) > 1)
if (window->window_quitting)
{
gtk_widget_destroy(GTK_WIDGET(window));
GncPluginManager *manager = gnc_plugin_manager_get ();
GList *plugins = gnc_plugin_manager_get_plugins (manager);
/* remove only the preference callbacks from the window plugins */
window->just_plugin_prefs = TRUE;
g_list_foreach (plugins, gnc_main_window_remove_plugin, window);
window->just_plugin_prefs = FALSE;
g_list_free (plugins);
/* remove the preference callbacks from the main window */
gnc_main_window_remove_prefs (window);
gtk_widget_destroy (GTK_WIDGET(window));
}
if (g_list_length (active_windows) > 1)
{
gtk_widget_destroy (GTK_WIDGET(window));
}
}
}

View File

@ -348,6 +348,16 @@ gboolean gnc_main_window_popup_menu_cb (GtkWidget *widget,
*/
void gnc_main_window_restore_all_windows(const GKeyFile *keyfile);
/** Check if the main window is restoring the plugin pages. This is
* used on report pages to delay the creation of the report till the
* page is focused.
*
* @param window When window whose pages should be checked.
*
* @return TRUE if pages are being restored
*/
gboolean gnc_main_window_is_restoring_pages (GncMainWindow *window);
/** Save the persistent state of all windows.
*
* @param keyfile The GKeyFile to contain persistent window state.

View File

@ -420,6 +420,7 @@ gnc_tree_model_account_get_column_type (GtkTreeModel *tree_model, int index)
case GNC_TREE_MODEL_ACCOUNT_COL_HIDDEN:
case GNC_TREE_MODEL_ACCOUNT_COL_PLACEHOLDER:
case GNC_TREE_MODEL_ACCOUNT_COL_OPENING_BALANCE:
return G_TYPE_BOOLEAN;
default:
@ -956,6 +957,11 @@ gnc_tree_model_account_get_value (GtkTreeModel *tree_model,
g_value_set_boolean (value, xaccAccountGetPlaceholder (account));
break;
case GNC_TREE_MODEL_ACCOUNT_COL_OPENING_BALANCE:
g_value_init (value, G_TYPE_BOOLEAN);
g_value_set_boolean (value, xaccAccountGetIsOpeningBalance (account));
break;
default:
g_assert_not_reached ();
break;

View File

@ -81,8 +81,9 @@ typedef enum
GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO_SUB_ACCT,
GNC_TREE_MODEL_ACCOUNT_COL_HIDDEN,
GNC_TREE_MODEL_ACCOUNT_COL_PLACEHOLDER,
GNC_TREE_MODEL_ACCOUNT_COL_OPENING_BALANCE,
GNC_TREE_MODEL_ACCOUNT_COL_LAST_VISIBLE = GNC_TREE_MODEL_ACCOUNT_COL_PLACEHOLDER,
GNC_TREE_MODEL_ACCOUNT_COL_LAST_VISIBLE = GNC_TREE_MODEL_ACCOUNT_COL_OPENING_BALANCE,
/* internal hidden columns */
GNC_TREE_MODEL_ACCOUNT_COL_COLOR_PRESENT,

View File

@ -164,7 +164,7 @@ gnc_tree_model_price_init (GncTreeModelPrice *model)
}
priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
priv->print_info = gnc_share_print_info_places(6);
priv->print_info = gnc_default_price_print_info(NULL);
}
static void

View File

@ -494,6 +494,29 @@ sort_by_placeholder (GtkTreeModel *f_model,
return xaccAccountOrder(account_a, account_b);
}
static gint
sort_by_opening_balance (GtkTreeModel *f_model,
GtkTreeIter *f_iter_a,
GtkTreeIter *f_iter_b,
gpointer user_data)
{
const Account *account_a, *account_b;
gboolean flag_a, flag_b;
/* Find the accounts */
sort_cb_setup (f_model, f_iter_a, f_iter_b, &account_a, &account_b);
/* Get the opening balance flags. */
flag_a = xaccAccountGetIsOpeningBalance (account_a);
flag_b = xaccAccountGetIsOpeningBalance (account_b);
if (flag_a > flag_b)
return -1;
else if (flag_a < flag_b)
return 1;
return xaccAccountOrder(account_a, account_b);
}
static gint
sort_by_xxx_period_value (GtkTreeModel *f_model,
GtkTreeIter *f_iter_a,
@ -970,6 +993,14 @@ gnc_tree_view_account_new_with_root (Account *root, gboolean show_root)
sort_by_placeholder,
gnc_tree_view_account_placeholder_toggled);
gnc_tree_view_add_toggle_column(view, _("Opening Balance"),
C_("Column header for 'Opening Balance'", "O"),
"opening-balance",
GNC_TREE_MODEL_ACCOUNT_COL_OPENING_BALANCE,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_opening_balance,
NULL);
/* Add function to each column that optionally sets a background color for accounts */
col_list = gtk_tree_view_get_columns(GTK_TREE_VIEW(view));
for (node = col_list; node; node = node->next)

View File

@ -274,7 +274,7 @@ gnc_tree_view_init (GncTreeView *view, void *data)
/* Create the last column which contains the column selection
* widget. gnc_tree_view_add_text_column will do most of the
* work. */
icon = gtk_image_new_from_icon_name ("go-down", GTK_ICON_SIZE_SMALL_TOOLBAR);
icon = gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR);
priv->column_menu_icon_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous (GTK_BOX(priv->column_menu_icon_box), FALSE);
@ -288,9 +288,6 @@ gnc_tree_view_init (GncTreeView *view, void *data)
gtk_widget_show_all (priv->column_menu_icon_box);
g_signal_connect (G_OBJECT(icon), "draw",
G_CALLBACK(gnc_draw_arrow_cb), GINT_TO_POINTER(1));
column = gnc_tree_view_add_text_column (view, NULL, NULL, NULL, NULL,
-1, -1, NULL);
g_object_set (G_OBJECT(column),

View File

@ -51,13 +51,14 @@
#endif
/** Links in the Help Files *****************************************/
#define HL_USAGE "usage"
#define HL_USAGE_BSNSS "chapter_busnss"
#define HL_USAGE_BSNSS "busnss-ar-setup1"
#define HL_USAGE_INVOICE "busnss-ar-invoices1"
#define HL_USAGE_VOUCHER "busnss-emply-newvchr"
#define HL_USAGE_BILL "busnss-ap-bills1"
#define HL_USAGE_CUSTOMER "busnss-ar-customers1"
#define HL_USAGE_VENDOR "busnss-ap-vendors1"
#define HL_USAGE_EMPLOYEE "busnss-emply"
#define HL_USAGE_JOB "busnss-ar-jobs1"
#define HL_ACC "acct-create"
#define HL_ACCEDIT "acct-edit"
#define HL_COMMODITY "tool-commodity"
@ -65,10 +66,13 @@
#define HL_GLOBPREFS "set-prefs"
#define HL_PRINTCHECK "print-check"
#define HL_RECNWIN "acct-reconcile"
#define HL_SXEDITOR "tool-sched"
#define HL_SXEDITOR "trans-sched"
#define HL_BOOK_OPTIONS "book-options"
#define HL_STYLE_SHEET "change-style"
#define HL_CLOSE_BOOK "tool-close-book"
#define HL_USAGE_CUSTOMREP "report-custom"
#define HL_USAGE_CUSTOMREP "report-saving"
#define HL_IMPORT_BC "busnss-imp-bills-invoices"
#define HL_IMPORT_CUST "busnss-imp-customer-vendor"
/* GTK Windows - Common Response Codes */

View File

@ -1423,13 +1423,6 @@ on_finish (GtkAssistant *gtkassistant,
ENTER (" ");
com = gnc_currency_edit_get_currency (GNC_CURRENCY_EDIT(data->currency_selector));
if (data->our_account_tree)
{
gnc_account_foreach_descendant (data->our_account_tree,
(AccountCb)starting_balance_helper,
data);
}
// delete before we suspend GUI events, and then muck with the model,
// because the model doesn't seem to handle this correctly.
if (data->initial_category)
@ -1452,6 +1445,13 @@ on_finish (GtkAssistant *gtkassistant,
gnc_resume_gui_refresh ();
if (data->our_account_tree)
{
gnc_account_foreach_descendant (data->our_account_tree,
(AccountCb)starting_balance_helper,
data);
}
if (when_completed)
{
(*when_completed)();

View File

@ -637,6 +637,7 @@ gnc_loan_assistant_create( LoanAssistantData *ldd )
gtk_widget_set_halign (GTK_WIDGET(gas), GTK_ALIGN_FILL);
gnc_account_sel_set_hexpand (GNC_ACCOUNT_SEL(gas), true);
gnc_account_sel_set_new_account_modal (GNC_ACCOUNT_SEL(gas), true);
g_object_set (GTK_WIDGET(gas), "margin", 2, nullptr);
*(gas_data[i].loc) = gas;
}
@ -730,6 +731,7 @@ gnc_loan_assistant_create( LoanAssistantData *ldd )
gtk_widget_set_sensitive( GTK_WIDGET(ldd->optEscrowHBox), FALSE );
ldd->optEscrowGAS = GNC_ACCOUNT_SEL(gnc_account_sel_new());
gnc_account_sel_set_hexpand (GNC_ACCOUNT_SEL(ldd->optEscrowGAS), true);
gnc_account_sel_set_new_account_modal (GNC_ACCOUNT_SEL(ldd->optEscrowGAS), true);
gnc_account_sel_set_new_account_ability( ldd->optEscrowGAS, TRUE );
gtk_container_add( GTK_CONTAINER(ldd->optEscrowHBox),
GTK_WIDGET(ldd->optEscrowGAS) );

View File

@ -183,12 +183,21 @@ gui_to_fi(FinCalcDialog *fcd)
GtkToggleButton *toggle;
gnc_numeric npp;
int i;
const gchar *text;
if (fcd == NULL)
return;
npp =
gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(fcd->amounts[PAYMENT_PERIODS]));
/* treat PAYMENT_PERIODS as a plain GtkEntry */
text = gtk_entry_get_text (GTK_ENTRY(GNC_AMOUNT_EDIT(fcd->amounts[PAYMENT_PERIODS])));
if (text && *text)
{
gnc_numeric out;
gboolean result = string_to_gnc_numeric (text, &out);
npp = gnc_numeric_convert (out, 1, GNC_HOW_RND_TRUNC);
}
else
npp = gnc_numeric_zero ();
fcd->financial_info.npp = npp.num;
fcd->financial_info.ir =
@ -338,10 +347,14 @@ can_calc_value(FinCalcDialog *fcd, FinCalcValue value, int *error_item)
return missing;
}
if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (fcd->amounts[i])))
/* treat PAYMENT_PERIODS as a plain GtkEntry */
if (i != PAYMENT_PERIODS)
{
*error_item = i;
return bad_exp;
if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (fcd->amounts[i])))
{
*error_item = i;
return bad_exp;
}
}
}
@ -371,17 +384,27 @@ can_calc_value(FinCalcDialog *fcd, FinCalcValue value, int *error_item)
case PRESENT_VALUE:
case PERIODIC_PAYMENT:
case FUTURE_VALUE:
nvalue = gnc_amount_edit_get_amount
(GNC_AMOUNT_EDIT(fcd->amounts[PAYMENT_PERIODS]));
if (gnc_numeric_zero_p (nvalue))
{
*error_item = PAYMENT_PERIODS;
return _("The number of payments cannot be zero.");
}
if (gnc_numeric_negative_p (nvalue))
{
*error_item = PAYMENT_PERIODS;
return _("The number of payments cannot be negative.");
/* treat PAYMENT_PERIODS as a plain GtkEntry */
GNCAmountEdit *edit = GNC_AMOUNT_EDIT(fcd->amounts[PAYMENT_PERIODS]);
const gchar *text = gtk_entry_get_text (GTK_ENTRY(edit));
gboolean result = string_to_gnc_numeric (text, &nvalue);
if (!result)
{
*error_item = PAYMENT_PERIODS;
return bad_exp;
}
if (gnc_numeric_zero_p (nvalue))
{
*error_item = PAYMENT_PERIODS;
return _("The number of payments cannot be zero.");
}
if (gnc_numeric_negative_p (nvalue))
{
*error_item = PAYMENT_PERIODS;
return _("The number of payments cannot be negative.");
}
}
break;
default:

Some files were not shown because too many files have changed in this diff Show More