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

@ -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,6 +145,7 @@ 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 ();
gnc_builder_add_from_file (builder, "gnc-plugin-page-register.glade", "num_adjustment");
@ -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"));
@ -186,8 +233,8 @@ gnc_dup_trans_dialog_create (GtkWidget * parent, DupTransDialog *dt_dialog,
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)
{
@ -296,13 +343,16 @@ gnc_dup_trans_dialog_internal (GtkWidget * parent,
}
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
@ -313,16 +363,20 @@ gnc_dup_trans_dialog_gdate (GtkWidget * parent, GDate *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
@ -332,7 +386,9 @@ gnc_dup_date_dialog (GtkWidget * parent, const char* title, GDate *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);
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);

View File

@ -142,10 +142,11 @@ typedef struct
GtkWidget *gain_loss_account_table;
GtkWidget *default_gain_loss_account_text;
GNCOption *option;
Account *prior_gain_loss_account;
gnc_commodity *retrieved_book_currency;
SCM retrieved_policy_scm;
SCM retrieved_gain_loss_acct_guid_scm;
Account *prior_gain_loss_account;
} currency_accounting_data;
@ -175,6 +176,8 @@ gnc_option_get_gtk_widget (GNCOption *option)
static void
gnc_options_dialog_changed_internal (GtkWidget *widget, gboolean sensitive)
{
GtkButton *button = NULL;
while (widget && !GTK_IS_WINDOW(widget))
widget = gtk_widget_get_parent (widget);
if (widget == NULL)
@ -202,6 +205,9 @@ gnc_options_dialog_changed_internal (GtkWidget *widget, gboolean sensitive)
if (g_strcmp0 (gtk_widget_get_name (GTK_WIDGET(it->data)), "apply_button") == 0)
gtk_widget_set_sensitive (GTK_WIDGET(it->data), sensitive);
if (g_strcmp0 (gtk_widget_get_name (GTK_WIDGET(it->data)), "cancel_button") == 0)
button = GTK_BUTTON(it->data);
}
g_list_free (children);
}
@ -211,6 +217,14 @@ gnc_options_dialog_changed_internal (GtkWidget *widget, gboolean sensitive)
}
g_list_free (children);
}
if (button)
{
if (sensitive)
gtk_button_set_label (button, _("_Cancel"));
else
gtk_button_set_label (button, _("_Close"));
}
}
void
@ -225,21 +239,20 @@ void
gnc_option_changed_widget_cb (GtkWidget *widget, GNCOption *option)
{
gnc_option_set_changed (option, TRUE);
gnc_option_call_option_widget_changed_proc(option);
gnc_option_call_option_widget_changed_proc (option, FALSE);
gnc_options_dialog_changed_internal (widget, TRUE);
}
void
gnc_option_changed_option_cb (GtkWidget *dummy, GNCOption *option)
{
GtkWidget *widget;
widget = gnc_option_get_gtk_widget (option);
GtkWidget *widget = gnc_option_get_gtk_widget (option);
gnc_option_changed_widget_cb (widget, option);
}
static void
gnc_date_option_set_select_method(GNCOption *option, gboolean use_absolute,
gnc_date_option_set_select_method (GNCOption *option,
gboolean use_absolute,
gboolean set_buttons)
{
GList* widget_list;
@ -260,20 +273,16 @@ gnc_date_option_set_select_method(GNCOption *option, gboolean use_absolute,
gtk_widget_set_sensitive (ab_widget, TRUE);
gtk_widget_set_sensitive (rel_widget, FALSE);
if (set_buttons)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(ab_button), TRUE);
}
}
else
{
gtk_widget_set_sensitive (rel_widget, TRUE);
gtk_widget_set_sensitive (ab_widget, FALSE);
if (set_buttons)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(rel_button), TRUE);
}
}
}
static void
gnc_rd_option_ab_set_cb (GtkWidget *widget, gpointer *raw_option)
@ -334,9 +343,7 @@ static void
gnc_image_option_selection_changed_cb (GtkFileChooser *chooser,
GNCOption *option)
{
gchar *filename;
filename = gtk_file_chooser_get_preview_filename(chooser);
gchar *filename = gtk_file_chooser_get_preview_filename (chooser);
if (!filename)
return;
g_object_set_data_full (G_OBJECT(chooser), LAST_SELECTION, filename, g_free);
@ -369,7 +376,18 @@ gnc_option_set_ui_value_internal (GNCOption *option, gboolean use_default)
type = gnc_option_type (option);
if (use_default)
{
SCM opt_getter = gnc_option_getter (option);
SCM opt_value = scm_call_0 (opt_getter);
SCM def_value;
getter = gnc_option_default_getter (option);
def_value = scm_call_0 (getter);
// only set changed if the values have changed
if (!scm_is_true (scm_equal_p (opt_value, def_value)))
gnc_option_set_changed (option, TRUE);
}
else
getter = gnc_option_getter (option);
@ -380,14 +398,10 @@ gnc_option_set_ui_value_internal (GNCOption *option, gboolean use_default)
{
bad_value = option_def->set_value (option, use_default, widget, value);
if (bad_value)
{
PERR("bad value\n");
}
}
else
{
PERR("Unknown type. Ignoring.\n");
}
free (type);
}
@ -414,14 +428,11 @@ gnc_option_get_ui_value_internal (GNCOption *option)
type = gnc_option_type (option);
option_def = gnc_options_ui_get_option (type);
if (option_def && option_def->get_value)
{
result = option_def->get_value (option, widget);
}
else
{
PERR("Unknown type for refresh. Ignoring.\n");
}
free (type);
@ -547,7 +558,8 @@ gnc_gain_loss_account_view_filter (Account *account, gpointer data)
/* gain/loss accts must be in book-currency; if a book currency has been
specified in the widget, use it to filter */
if (gtk_combo_box_get_active (GTK_COMBO_BOX(book_currency_data->book_currency_widget)) != -1)
if (gtk_combo_box_get_active (GTK_COMBO_BOX(
book_currency_data->book_currency_widget)) != -1)
commodity = gnc_currency_edit_get_currency (
GNC_CURRENCY_EDIT(
book_currency_data->book_currency_widget));
@ -800,7 +812,6 @@ gnc_set_default_gain_loss_account_widget(gnc_commodity *commodity)
NULL);
gtk_grid_attach (GTK_GRID(book_currency_data->gain_loss_account_table),
book_currency_data->default_gain_loss_account_widget, 0, 1, 2, 1);
}
}
}
@ -885,7 +896,8 @@ gnc_option_changed_gain_loss_account_widget_cb (GtkTreeSelection *selection,
}
void
gnc_option_changed_gain_loss_account_del_button_widget_cb (GtkButton *button, gpointer data)
gnc_option_changed_gain_loss_account_del_button_widget_cb (GtkButton *button,
gpointer data)
{
GtkTreeSelection *selection = NULL;
GtkWidget *option_widget =
@ -1069,10 +1081,8 @@ gnc_option_create_date_widget (GNCOption *option)
return box;
}
else /* can't happen */
{
return NULL;
}
}
static GtkWidget *
gnc_option_create_budget_widget (GNCOption *option)
@ -1137,7 +1147,6 @@ gnc_option_create_multichoice_widget(GNCOption *option)
g_signal_connect (G_OBJECT(widget), "changed",
G_CALLBACK(gnc_option_multichoice_cb), option);
}
return widget;
}
@ -1186,7 +1195,6 @@ gnc_option_create_radiobutton_widget(char *name, GNCOption *option)
if (tip)
free (tip);
}
return frame;
}
@ -1314,8 +1322,7 @@ gnc_option_create_currency_accounting_widget (char *name, GNCOption *option)
gtk_grid_attach (GTK_GRID(policy_table), widget_label, 0, 1, 1, 1);
g_signal_connect(G_OBJECT(
book_currency_data->default_cost_policy_widget),
g_signal_connect (G_OBJECT(book_currency_data->default_cost_policy_widget),
"changed",
G_CALLBACK(gnc_option_multichoice_cb), option);
@ -1336,7 +1343,8 @@ gnc_option_create_currency_accounting_widget (char *name, GNCOption *option)
gtk_widget_set_tooltip_text (book_currency_data->gain_loss_account_table,
tip && *tip ? _(tip) : "");
gtk_grid_attach (GTK_GRID(book_currency_data->gain_loss_account_table), widget_label, 0, 0, 1, 1);
gtk_grid_attach (GTK_GRID(book_currency_data->gain_loss_account_table),
widget_label, 0, 0, 1, 1);
widget_label = NULL;
gtk_box_pack_start (GTK_BOX (book_currency_data->book_currency_vbox),
@ -1368,10 +1376,7 @@ static void
gnc_option_account_cb (GtkTreeSelection *selection, gpointer data)
{
GNCOption *option = data;
GtkTreeView *tree_view;
tree_view = gtk_tree_selection_get_tree_view(selection);
GtkTreeView *tree_view = gtk_tree_selection_get_tree_view (selection);
gnc_option_changed_widget_cb (GTK_WIDGET(tree_view), option);
}
@ -1555,9 +1560,7 @@ static void
gnc_option_list_changed_cb (GtkTreeSelection *selection,
GNCOption *option)
{
GtkTreeView *view;
view = gtk_tree_selection_get_tree_view(selection);
GtkTreeView *view = gtk_tree_selection_get_tree_view (selection);
gnc_option_changed_widget_cb (GTK_WIDGET(view), option);
}
@ -1738,7 +1741,7 @@ gnc_option_set_ui_widget(GNCOption *option, GtkGrid *page_box, gint grid_row)
}
/* attach the name label to the first column of the grid and align to the end
* if option is a check button, do not add a label as we are using the biult
* if option is a check button, do not add a label as we are using the built
* in one */
if (!GTK_IS_CHECK_BUTTON(value))
gtk_grid_attach (GTK_GRID(page_box), GTK_WIDGET(name_label),
@ -1835,7 +1838,8 @@ gnc_options_dialog_append_page(GNCOptionWin * propertybox,
gtk_container_set_border_width (GTK_CONTAINER(options_box), 0);
gtk_container_add (GTK_CONTAINER(options_scrolled_win), GTK_WIDGET(options_box));
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(options_scrolled_win), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(options_scrolled_win),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
/* Create all the options */
num_options = gnc_option_section_num_options (section);
@ -1983,8 +1987,9 @@ gnc_options_dialog_build_contents_full (GNCOptionWin *propertybox,
for (j = 0; j < gnc_option_section_num_options (section); j++)
{
// setting TRUE will clear the changed flag after proc
gnc_option_call_option_widget_changed_proc (
gnc_get_option_section_option(section, j) );
gnc_get_option_section_option(section, j), TRUE);
}
}
@ -2086,7 +2091,9 @@ gnc_options_dialog_destroy_cb (GtkWidget *object, GNCOptionWin *win)
}
static gboolean
gnc_options_dialog_window_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
gnc_options_dialog_window_key_press_cb (GtkWidget *widget,
GdkEventKey *event,
gpointer data)
{
GNCOptionWin *win = data;
@ -2111,7 +2118,10 @@ gnc_options_dialog_reset_cb(GtkWidget * w, gpointer data)
g_return_if_fail (win);
section = (GNCOptionSection*)val;
gnc_option_db_section_reset_widgets (section);
if (gnc_option_db_get_changed (win->option_db))
gnc_options_dialog_changed_internal (win->window, TRUE);
}
@ -2251,7 +2261,8 @@ gnc_options_dialog_new_modal(gboolean modal, gchar *title,
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (_("Page"), renderer,
"text", PAGE_NAME, NULL);
"text", PAGE_NAME,
NULL);
gtk_tree_view_append_column (view, column);
gtk_tree_view_column_set_alignment (column, 0.5);
@ -2992,7 +3003,6 @@ gnc_rd_option_p_set_cb(GtkWidget *widget, gpointer *raw_option)
return;
}
static GtkWidget *
gnc_option_set_ui_widget_plot_size (GNCOption *option, GtkGrid *page_box,
GtkLabel *name_label, char *documentation,
@ -3288,10 +3298,8 @@ gnc_option_set_ui_value_date (GNCOption *option, gboolean use_default,
gnc_combott_set_active (GNC_COMBOTT(rel_date_widget), index);
}
else
{
bad_value = TRUE;
}
}
else if (g_strcmp0 (symbol_str, "absolute") == 0)
{
time64 time;
@ -3315,23 +3323,17 @@ gnc_option_set_ui_value_date (GNCOption *option, gboolean use_default,
gnc_date_edit_set_time (GNC_DATE_EDIT(ab_widget), time);
}
else
{
bad_value = TRUE;
}
}
else
{
bad_value = TRUE;
}
if (symbol_str)
free (symbol_str);
}
}
else
{
bad_value = TRUE;
}
if (date_option_type)
free (date_option_type);
@ -3349,7 +3351,6 @@ gnc_option_set_ui_value_account_list (GNCOption *option, gboolean use_default,
gnc_tree_view_account_set_selected_accounts (GNC_TREE_VIEW_ACCOUNT(widget),
list, TRUE);
g_list_free (list);
return FALSE;
}
@ -3504,8 +3505,10 @@ gnc_option_set_ui_value_pixmap (GNCOption *option, gboolean use_default,
return TRUE;
}
static gboolean gnc_option_set_ui_value_budget(
GNCOption *option, gboolean use_default, GtkWidget *widget, SCM value)
static gboolean gnc_option_set_ui_value_budget (GNCOption *option,
gboolean use_default,
GtkWidget *widget,
SCM value)
{
GncBudget *bgt;
@ -3526,8 +3529,6 @@ static gboolean gnc_option_set_ui_value_budget(
gtk_combo_box_set_active_iter (cb, &iter);
}
}
//FIXME: Unimplemented.
return FALSE;
}
@ -3945,7 +3946,6 @@ gnc_option_get_ui_value_list (GNCOption *option, GtkWidget *widget)
if (selected)
result = scm_cons (gnc_option_permissible_value (option, row), result);
}
return (scm_reverse (result));
}
@ -4068,8 +4068,8 @@ gnc_option_get_ui_value_plot_size (GNCOption *option, GtkWidget *widget)
}
static SCM
gnc_option_get_ui_value_currency_accounting (
GNCOption *option, GtkWidget *widget)
gnc_option_get_ui_value_currency_accounting (GNCOption *option,
GtkWidget *widget)
{
gpointer _index;
int index;

View File

@ -90,8 +90,10 @@ static QofLogModule log_module = GNC_MOD_PREFS;
void gnc_preferences_response_cb (GtkDialog *dialog, gint response, GtkDialog *unused);
void gnc_account_separator_pref_changed_cb (GtkEntry *entry, GtkWidget *dialog);
gboolean gnc_account_separator_validate_cb (GtkEntry *entry, GdkEvent *event, GtkWidget *dialog);
void gnc_save_on_close_expires_cb (GtkToggleButton *button, GtkWidget *dialog);
gboolean gnc_preferences_delete_event_cb (GtkWidget *widget,
GdkEvent *event,
gpointer user_data);
/** This data structure holds the information for a single addition to
* the preferences dialog. */
@ -131,7 +133,6 @@ static gchar *gnc_account_separator_is_valid (const gchar *separator,
conflict_accts);
g_list_free (conflict_accts);
return message;
}
@ -185,23 +186,95 @@ gnc_account_separator_pref_changed_cb (GtkEntry *entry, GtkWidget *dialog)
}
gboolean
gnc_account_separator_validate_cb (GtkEntry *entry, GdkEvent *event, GtkWidget *dialog)
/** Called when the 'Close' button pressed or preference dialog closes
* to check if the account separator is valid.
* Offers two choices, to reset separator to original value and exit
* or go back to the 'Accounts' page to change separator
*
* @internal
*
* @param dialog the prefs dialog.
*/
static gboolean
gnc_account_separator_validate (GtkWidget *dialog)
{
GtkWidget *entry = g_object_get_data (G_OBJECT(dialog), "account-separator");
gboolean ret = TRUE;
gchar *separator;
gchar *conflict_msg = gnc_account_separator_is_valid (gtk_entry_get_text (entry), &separator);
gchar *conflict_msg = gnc_account_separator_is_valid (gtk_entry_get_text (GTK_ENTRY(entry)), &separator);
/* Check if the new separator clashes with existing account names */
if (conflict_msg)
{
gnc_warning_dialog (GTK_WINDOW (dialog), "%s", conflict_msg);
GtkWidget *msg_dialog, *msg_label;
GtkBuilder *builder;
gint response;
builder = gtk_builder_new ();
gnc_builder_add_from_file (builder, "dialog-preferences.glade", "separator_validation_dialog");
msg_dialog = GTK_WIDGET(gtk_builder_get_object (builder, "separator_validation_dialog"));
msg_label = GTK_WIDGET(gtk_builder_get_object (builder, "conflict_message"));
gtk_label_set_text (GTK_LABEL(msg_label), conflict_msg);
g_object_unref (G_OBJECT(builder));
gtk_widget_show_all (msg_dialog);
response = gtk_dialog_run (GTK_DIALOG(msg_dialog));
if (response == GTK_RESPONSE_ACCEPT) // reset to original
{
gchar *original_sep = g_object_get_data (G_OBJECT(entry), "original_text");
if (original_sep != NULL)
gtk_entry_set_text (GTK_ENTRY(entry), original_sep);
}
else
ret = FALSE;
g_free (conflict_msg);
gtk_widget_destroy (msg_dialog);
}
g_free (separator);
return FALSE;
return ret;
}
/** Used to select the 'Accounts' page when the user wants
* to return from the account separator validation dialog
* to the preference dialog.
*
* @internal
*
* @param user_data A pointer to the dialog.
*/
static void
gnc_preferences_select_account_page (GtkDialog *dialog)
{
GtkWidget *notebook = g_object_get_data (G_OBJECT(dialog), NOTEBOOK);
GList *children = gtk_container_get_children (GTK_CONTAINER(notebook));
if (children)
{
GtkWidget *acc_page = NULL;
GList *node;
for (node = children; node; node = node->next)
{
if (g_strcmp0 (gtk_widget_get_name (GTK_WIDGET(node->data)), "accounts_page") == 0)
acc_page = node->data;
}
if (acc_page)
gtk_notebook_set_current_page (GTK_NOTEBOOK(notebook),
gtk_notebook_page_num (GTK_NOTEBOOK(notebook),
acc_page));
}
g_list_free (children);
}
/** Called when the save-on-close checkbutton is toggled.
* @internal
* @param button the toggle button.
@ -1096,6 +1169,15 @@ gnc_prefs_connect_date_edit (GNCDateEdit *gde , const gchar *boxname )
/* Callbacks */
/********************/
gboolean
gnc_preferences_delete_event_cb (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
/* need to block this for the account separator test */
return TRUE;
}
/** Handle a user click on one of the buttons at the bottom of the
* preference dialog. Also handles delete_window events, which have
* conveniently converted to a response by GtkDialog.
@ -1118,11 +1200,17 @@ gnc_preferences_response_cb(GtkDialog *dialog, gint response, GtkDialog *unused)
gnc_gnome_help (HF_HELP, HL_GLOBPREFS);
break;
case GTK_RESPONSE_DELETE_EVENT:
default:
if (gnc_account_separator_validate (GTK_WIDGET(dialog)))
{
gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(dialog));
gnc_unregister_gui_component_by_data (DIALOG_PREFERENCES_CM_CLASS,
dialog);
gtk_widget_destroy (GTK_WIDGET(dialog));
}
else
gnc_preferences_select_account_page (dialog);
break;
}
}
@ -1239,7 +1327,7 @@ static GtkWidget *
gnc_preferences_dialog_create (GtkWindow *parent)
{
GtkBuilder *builder;
GtkWidget *dialog, *notebook, *label, *image, *spinner;
GtkWidget *dialog, *notebook, *label, *image, *spinner, *entry;
GtkWidget *box, *date, *period, *currency, *fcb, *button;
GHashTable *prefs_table;
GDate* gdate = NULL;
@ -1304,6 +1392,9 @@ gnc_preferences_dialog_create(GtkWindow *parent)
image = GTK_WIDGET(gtk_builder_get_object (builder, "separator_error"));
g_object_set_data (G_OBJECT(dialog), "separator_error", image);
entry = GTK_WIDGET(gtk_builder_get_object (builder, "pref/general/account-separator"));
g_object_set_data (G_OBJECT(dialog), "account-separator", entry);
spinner = GTK_WIDGET(gtk_builder_get_object (builder, "pref/general/save-on-close-wait-time"));
g_object_set_data (G_OBJECT(dialog), "save_on_close_wait_time", spinner);
@ -1417,6 +1508,11 @@ gnc_preferences_dialog_create(GtkWindow *parent)
g_object_unref (G_OBJECT(builder));
/* save the original account separator incase it changes */
g_object_set_data_full (G_OBJECT(entry), "original_text",
g_strdup (gtk_entry_get_text (GTK_ENTRY(entry))),
g_free);
LEAVE("dialog %p", dialog);
return dialog;
}

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

@ -92,12 +92,10 @@ gnc_account_sel_get_type (void)
"GNCAccountSel",
&account_sel_info, 0);
}
return account_sel_type;
}
static
void
static void
gnc_account_sel_event_cb (QofInstance *entity,
QofEventId event_type,
gpointer user_data,
@ -113,8 +111,7 @@ gnc_account_sel_event_cb( QofInstance *entity,
gas_populate_list ((GNCAccountSel*)user_data);
}
static
void
static void
gnc_account_sel_class_init (GNCAccountSelClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS(klass);
@ -198,8 +195,7 @@ typedef struct
GList **outList;
} account_filter_data;
static
void
static void
gas_populate_list (GNCAccountSel *gas)
{
account_filter_data atnd;
@ -212,8 +208,7 @@ gas_populate_list( GNCAccountSel *gas )
gchar *currentSel, *name;
entry = GTK_ENTRY(gtk_bin_get_child (GTK_BIN(gas->combo)));
currentSel = gtk_editable_get_chars(
GTK_EDITABLE(entry), 0, -1 );
currentSel = gtk_editable_get_chars (GTK_EDITABLE(entry), 0, -1 );
g_signal_handlers_block_by_func (gas->combo, combo_changed_cb , gas);
@ -253,13 +248,10 @@ gas_populate_list( GNCAccountSel *gas )
g_list_free (filteredAccts);
if (currentSel)
{
g_free (currentSel);
}
}
static
void
static void
gas_filter_accounts (gpointer data, gpointer user_data)
{
account_filter_data *atnd;
@ -291,18 +283,13 @@ gas_filter_accounts( gpointer data, gpointer user_data )
return;
}
}
*atnd->outList = g_list_append (*atnd->outList, a);
}
GtkWidget *
gnc_account_sel_new (void)
{
GNCAccountSel *gas;
gas = g_object_new (GNC_TYPE_ACCOUNT_SEL, NULL);
GNCAccountSel *gas = g_object_new (GNC_TYPE_ACCOUNT_SEL, NULL);
return GTK_WIDGET(gas);
}
@ -313,8 +300,7 @@ typedef struct
Account *acct;
} gas_find_data;
static
gboolean
static gboolean
gnc_account_sel_find_account (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
@ -329,8 +315,10 @@ gnc_account_sel_find_account (GtkTreeModel *model,
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;
@ -372,9 +360,9 @@ gnc_account_sel_get_account( GNCAccountSel *gas )
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)
@ -391,22 +379,16 @@ gnc_account_sel_set_acct_filters( GNCAccountSel *gas, GList *typeFilters, GList
/* If both filters are null, then no filters exist. */
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);
}
/* Save the commodity filter list */
if (commodityFilters)
{
gas->acctCommodityFilters = g_list_copy (commodityFilters);
}
gas_populate_list (gas);
}
@ -422,9 +404,7 @@ gnc_account_sel_finalize (GObject *object)
gas = GNC_ACCOUNT_SEL(object);
if (gas->acctTypeFilters)
{
g_list_free (gas->acctTypeFilters);
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -464,8 +444,7 @@ gnc_account_sel_set_new_account_ability( GNCAccountSel *gas,
{
g_assert (state == TRUE);
/* destroy the existing button. */
gtk_container_remove( GTK_CONTAINER(gas),
gas->newAccountButton );
gtk_container_remove (GTK_CONTAINER(gas), gas->newAccountButton);
gtk_widget_destroy (gas->newAccountButton);
gas->newAccountButton = NULL;
return;
@ -477,6 +456,7 @@ gnc_account_sel_set_new_account_ability( GNCAccountSel *gas,
"clicked",
G_CALLBACK(gas_new_account_click),
gas);
gtk_box_pack_start (GTK_BOX(gas), gas->newAccountButton,
FALSE, FALSE, 0);
}
@ -493,10 +473,15 @@ static void
gas_new_account_click (GtkButton *b, gpointer ud)
{
GNCAccountSel *gas = (GNCAccountSel*)ud;
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,
{
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);
@ -507,6 +492,7 @@ 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);
}
@ -555,8 +541,5 @@ gnc_account_sel_purge_account( GNCAccountSel *gas,
}
while (more);
}
gtk_combo_box_set_active (GTK_COMBO_BOX(gas->combo), 0);
}

View File

@ -74,7 +74,8 @@ 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.
@ -87,22 +88,21 @@ 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);

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;
@ -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;
}
@ -3132,6 +3237,8 @@ gnc_main_window_close_page (GncPluginPage *page)
/* If this isn't the last window, go ahead and destroy the window. */
priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
if (priv->installed_pages == NULL)
{
if (window->window_quitting)
{
GncPluginManager *manager = gnc_plugin_manager_get ();
GList *plugins = gnc_plugin_manager_get_plugins (manager);
@ -3145,6 +3252,8 @@ gnc_main_window_close_page (GncPluginPage *page)
/* 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,12 +347,16 @@ can_calc_value(FinCalcDialog *fcd, FinCalcValue value, int *error_item)
return missing;
}
/* treat PAYMENT_PERIODS as a plain GtkEntry */
if (i != PAYMENT_PERIODS)
{
if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (fcd->amounts[i])))
{
*error_item = i;
return bad_exp;
}
}
}
/* Check for zero interest */
switch (value)
@ -371,8 +384,17 @@ 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]));
{
/* 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;
@ -383,6 +405,7 @@ can_calc_value(FinCalcDialog *fcd, FinCalcValue value, int *error_item)
*error_item = PAYMENT_PERIODS;
return _("The number of payments cannot be negative.");
}
}
break;
default:
break;

View File

@ -538,7 +538,21 @@ gnc_invoice_window_cancel_cb (GtkWidget *widget, gpointer data)
void
gnc_invoice_window_help_cb (GtkWidget *widget, gpointer data)
{
InvoiceWindow *iw = data;
GncOwnerType owner_type = gncOwnerGetType (&iw->owner);
switch(owner_type)
{
case GNC_OWNER_CUSTOMER:
gnc_gnome_help (HF_HELP, HL_USAGE_INVOICE);
break;
case GNC_OWNER_VENDOR:
gnc_gnome_help (HF_HELP, HL_USAGE_BILL);
break;
default:
gnc_gnome_help (HF_HELP, HL_USAGE_VOUCHER);
break;
}
}
static const gchar *

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