Bump glib2 minimum requirement to 2.12.

At the same time, remove all the conditional code and workarounds
that were in the code to cater for glib < 2.12.

Note: this commit will require a rerun of autogen.sh and configure.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18696 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens 2010-02-20 13:57:10 +00:00
parent 13ce6a10ee
commit 86c7ae019c
35 changed files with 227 additions and 1075 deletions

View File

@ -20,7 +20,7 @@ dnl Process this file with autoconf to produce a configure script.
# Autoconf initialization
AC_PREREQ(2.59)
AC_INIT([gnucash], [2.3.10], [gnucash-devel@gnucash.org])
AC_INIT([GnuCash], [2.3.10], [gnucash-devel@gnucash.org])
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_SRCDIR(src/engine/Transaction.h)
@ -233,8 +233,8 @@ fi
### --------------------------------------------------------------------------
### Glib checks..
AM_PATH_GLIB_2_0(2.6.0,,AC_MSG_ERROR([
*** GLIB >= 2.6 is required to build Gnucash; please make sure you have the
AM_PATH_GLIB_2_0(2.12.0,,AC_MSG_ERROR([
*** GLIB >= 2.12 is required to build Gnucash; please make sure you have the
*** development headers installed. The latest version of GLIB is
*** always available at ftp://ftp.gnome.org/pub/gnome/sources/glib/.]),
gthread gobject gmodule)
@ -244,35 +244,6 @@ then
AC_MSG_ERROR([Cannot find glib. Check config.log])
fi
AC_MSG_CHECKING(for GLIB - version >= 2.8.0)
if $PKG_CONFIG 'glib-2.0 >= 2.8.0'
then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GLIB_2_8,1,[System has glib 2.8.0 or better])
HAVE_GLIB_2_8=yes
else
AC_MSG_RESULT(no)
if test "x${native_win32}" = "xyes"; then
AC_MSG_ERROR([*** GLIB >= 2.8 is required to build Gnucash on Windows.])
else
GLIB26_LIBS="$GLIB_LIBS"
GLIB_LIBS="\${top_builddir}/lib/glib28/libgnc-glib.la $GLIB_LIBS"
GLIB_CFLAGS="-I\${top_srcdir}/lib/glib28 $GLIB_CFLAGS"
AC_SUBST(GLIB26_LIBS)
fi
fi
AM_CONDITIONAL(HAVE_GLIB_2_8, test "x$HAVE_GLIB_2_8" = "xyes")
AC_MSG_CHECKING(for GLIB - version >= 2.9.0)
if $PKG_CONFIG 'glib-2.0 >= 2.9.0'
then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GLIB29,1,[System has glib 2.9.0 or better])
HAVE_GLIB29=yes
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING(for GLIB - version >= 2.12.0)
if $PKG_CONFIG 'glib-2.0 >= 2.12.0'
then
@ -1524,7 +1495,6 @@ AC_CONFIG_FILES(po/Makefile.in
doc/examples/Makefile
intl-scm/Makefile
lib/Makefile
lib/glib28/Makefile
lib/guile-www/Makefile
lib/srfi/Makefile
lib/libc/Makefile

View File

@ -1,5 +1,5 @@
SUBDIRS = libc glib28 guile-www srfi stf
DIST_SUBDIRS = libc glib28 guile-www srfi stf
SUBDIRS = libc guile-www srfi stf
DIST_SUBDIRS = libc guile-www srfi stf
EXTRA_DIST = README

View File

@ -1,18 +0,0 @@
noinst_LTLIBRARIES = libgnc-glib.la
DUMMYSRCS = dummy.c
REALSRCS = gfileutils-2.8.c
REALHDRS = gfileutils-2.8.h gstdio-2.8.h
if HAVE_GLIB_2_8
libgnc_glib_la_SOURCES = ${DUMMYSRCS}
else
libgnc_glib_la_SOURCES = ${REALSRCS}
noinst_HEADERS = ${REALHDRS}
endif
libgnc_glib_la_LIBADD = ${GLIB26_LIBS}
AM_CPPFLAGS = ${GLIB_CFLAGS}
EXTRA_DIST = $(DUMMYSRCS) $(REALSRCS) $(REALHDRS)

View File

@ -1,6 +0,0 @@
void g_my_dummy_function (void);
void
g_my_dummy_function (void)
{
}

View File

@ -1,434 +0,0 @@
/* gfileutils.c - File utility functions
*
* Copyright 2000 Red Hat, Inc.
*
* GLib is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GLib; see the file COPYING.LIB. If not,
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* Contains all #includes, but otherwise only relevant differences between
* GLib 2.6 and GLib 2.8 */
#include "config.h"
#include <glib.h>
#include "gfileutils-2.8.h"
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifndef G_OS_WIN32
#include <sys/wait.h>
#endif
#include <fcntl.h>
#include <stdlib.h>
#ifdef G_OS_WIN32
#include <windows.h>
#include <io.h>
#endif /* G_OS_WIN32 */
#ifndef S_ISLNK
#define S_ISLNK(x) 0
#endif
#ifndef O_BINARY
#define O_BINARY 0
#endif
#include <glib/gstdio.h>
#define _(String) (String)
static gboolean
rename_file (const char *old_name,
const char *new_name,
GError **err)
{
errno = 0;
if (g_rename (old_name, new_name) == -1)
{
int save_errno = errno;
gchar *display_old_name = g_filename_display_name (old_name);
gchar *display_new_name = g_filename_display_name (new_name);
g_set_error (err,
G_FILE_ERROR,
g_file_error_from_errno (save_errno),
"Failed to rename file '%s' to '%s': g_rename() failed: %s",
display_old_name,
display_new_name,
g_strerror (save_errno));
g_free (display_old_name);
g_free (display_new_name);
return FALSE;
}
return TRUE;
}
static gboolean
set_umask_permissions (int fd,
GError **err)
{
#ifdef G_OS_WIN32
return TRUE;
#else
/* All of this function is just to work around the fact that
* there is no way to get the umask without changing it.
*
* We can't just change-and-reset the umask because that would
* lead to a race condition if another thread tried to change
* the umask in between the getting and the setting of the umask.
* So we have to do the whole thing in a child process.
*/
int save_errno;
pid_t pid;
pid = fork ();
if (pid == -1)
{
save_errno = errno;
g_set_error (err,
G_FILE_ERROR,
g_file_error_from_errno (save_errno),
_("Could not change file mode: fork() failed: %s"),
g_strerror (save_errno));
return FALSE;
}
else if (pid == 0)
{
/* child */
mode_t mask = umask (0666);
errno = 0;
if (fchmod (fd, 0666 & ~mask) == -1)
_exit (errno);
else
_exit (0);
return TRUE; /* To quiet gcc */
}
else
{
/* parent */
int status;
errno = 0;
if (waitpid (pid, &status, 0) == -1)
{
save_errno = errno;
g_set_error (err,
G_FILE_ERROR,
g_file_error_from_errno (save_errno),
_("Could not change file mode: waitpid() failed: %s"),
g_strerror (save_errno));
return FALSE;
}
if (WIFEXITED (status))
{
save_errno = WEXITSTATUS (status);
if (save_errno == 0)
{
return TRUE;
}
else
{
g_set_error (err,
G_FILE_ERROR,
g_file_error_from_errno (save_errno),
_("Could not change file mode: chmod() failed: %s"),
g_strerror (save_errno));
return FALSE;
}
}
else if (WIFSIGNALED (status))
{
g_set_error (err,
G_FILE_ERROR,
G_FILE_ERROR_FAILED,
_("Could not change file mode: Child terminated by signal: %s"),
g_strsignal (WTERMSIG (status)));
return FALSE;
}
else
{
/* This shouldn't happen */
g_set_error (err,
G_FILE_ERROR,
G_FILE_ERROR_FAILED,
_("Could not change file mode: Child terminated abnormally"));
return FALSE;
}
}
#endif
}
static gchar *
write_to_temp_file (const gchar *contents,
gssize length,
const gchar *template,
GError **err)
{
gchar *tmp_name;
gchar *display_name;
gchar *retval;
FILE *file;
gint fd;
int save_errno;
retval = NULL;
tmp_name = g_strdup_printf ("%s.XXXXXX", template);
errno = 0;
fd = g_mkstemp (tmp_name);
display_name = g_filename_display_name (tmp_name);
if (fd == -1)
{
save_errno = errno;
g_set_error (err,
G_FILE_ERROR,
g_file_error_from_errno (save_errno),
"Failed to create file '%s': %s",
display_name, g_strerror (save_errno));
goto out;
}
if (!set_umask_permissions (fd, err))
{
close (fd);
g_unlink (tmp_name);
goto out;
}
errno = 0;
file = fdopen (fd, "wb");
if (!file)
{
save_errno = errno;
g_set_error (err,
G_FILE_ERROR,
g_file_error_from_errno (save_errno),
"Failed to open file '%s' for writing: fdopen() failed: %s",
display_name,
g_strerror (save_errno));
close (fd);
g_unlink (tmp_name);
goto out;
}
if (length > 0)
{
size_t n_written;
errno = 0;
n_written = fwrite (contents, 1, length, file);
if (n_written < length)
{
save_errno = errno;
g_set_error (err,
G_FILE_ERROR,
g_file_error_from_errno (save_errno),
"Failed to write file '%s': fwrite() failed: %s",
display_name,
g_strerror (save_errno));
fclose (file);
g_unlink (tmp_name);
goto out;
}
}
errno = 0;
if (fclose (file) == EOF)
{
save_errno = 0;
g_set_error (err,
G_FILE_ERROR,
g_file_error_from_errno (save_errno),
"Failed to close file '%s': fclose() failed: %s",
display_name,
g_strerror (save_errno));
g_unlink (tmp_name);
goto out;
}
retval = g_strdup (tmp_name);
out:
g_free (tmp_name);
g_free (display_name);
return retval;
}
/**
* g_file_set_contents:
* @filename: name of a file to write @contents to, in the GLib file name
* encoding
* @contents: string to write to the file
* @length: length of @contents, or -1 if @contents is a nul-terminated string
* @error: return location for a #GError, or %NULL
*
* Writes all of @contents to a file named @filename, with good error checking.
* If a file called @filename already exists it will be overwritten.
*
* This write is atomic in the sense that it is first written to a temporary
* file which is then renamed to the final name. Notes:
* <itemizedlist>
* <listitem>
* On Unix, if @filename already exists hard links to @filename will break.
* Also since the file is recreated, existing permissions, access control
* lists, metadata etc. may be lost. If @filename is a symbolic link,
* the link itself will be replaced, not the linked file.
* </listitem>
* <listitem>
* On Windows renaming a file will not remove an existing file with the
* new name, so on Windows there is a race condition between the existing
* file being removed and the temporary file being renamed.
* </listitem>
* <listitem>
* On Windows there is no way to remove a file that is open to some
* process, or mapped into memory. Thus, this function will fail if
* @filename already exists and is open.
* </listitem>
* </itemizedlist>
*
* If the call was sucessful, it returns %TRUE. If the call was not successful,
* it returns %FALSE and sets @error. The error domain is #G_FILE_ERROR.
* Possible error codes are those in the #GFileError enumeration.
*
* Return value: %TRUE on success, %FALSE if an error occurred
*
* Since: 2.8
**/
gboolean
g_file_set_contents (const gchar *filename,
const gchar *contents,
gssize length,
GError **error)
{
gchar *tmp_filename;
gboolean retval;
GError *rename_error = NULL;
g_return_val_if_fail (filename != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
g_return_val_if_fail (contents != NULL || length == 0, FALSE);
g_return_val_if_fail (length >= -1, FALSE);
if (length == -1)
length = strlen (contents);
tmp_filename = write_to_temp_file (contents, length, filename, error);
if (!tmp_filename)
{
retval = FALSE;
goto out;
}
if (!rename_file (tmp_filename, filename, &rename_error))
{
#ifndef G_OS_WIN32
g_unlink (tmp_filename);
g_propagate_error (error, rename_error);
retval = FALSE;
goto out;
#else /* G_OS_WIN32 */
/* Renaming failed, but on Windows this may just mean
* the file already exists. So if the target file
* exists, try deleting it and do the rename again.
*/
if (!g_file_test (filename, G_FILE_TEST_EXISTS))
{
g_unlink (tmp_filename);
g_propagate_error (error, rename_error);
retval = FALSE;
goto out;
}
g_error_free (rename_error);
if (g_unlink (filename) == -1)
{
gchar *display_filename = g_filename_display_name (filename);
int save_errno = errno;
g_set_error (error,
G_FILE_ERROR,
g_file_error_from_errno (save_errno),
"Existing file '%s' could not be removed: g_unlink() failed: %s",
display_filename,
g_strerror (save_errno));
g_free (display_filename);
g_unlink (tmp_filename);
retval = FALSE;
goto out;
}
if (!rename_file (tmp_filename, filename, error))
{
g_unlink (tmp_filename);
retval = FALSE;
goto out;
}
#endif
}
retval = TRUE;
out:
g_free (tmp_filename);
return retval;
}

View File

@ -1,34 +0,0 @@
/* gfileutils.h - File utility functions
*
* Copyright 2000 Red Hat, Inc.
*
* GLib is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GLib; see the file COPYING.LIB. If not,
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* Contains only relevant differences between GLib 2.6 and GLib 2.8 */
#ifndef __G_FILEUTILS_2_8_H__
#define __G_FILEUTILS_2_8_H__
G_BEGIN_DECLS
gboolean g_file_set_contents (const gchar *filename,
const gchar *contents,
gssize length,
GError **error);
G_END_DECLS
#endif /* __G_FILEUTILS_2_8_H__ */

View File

@ -1,38 +0,0 @@
/* gstdio.h - GFilename wrappers for C library functions
*
* Copyright 2004 Tor Lillqvist
*
* GLib is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GLib; see the file COPYING.LIB. If not,
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* Contains only relevant differences between GLib 2.6 and GLib 2.8 */
#ifndef __G_STDIO_28_H__
#define __G_STDIO_28_H__
#ifdef G_OS_WIN32
#error "On Windows HAVE_GLIB_2_8 must be defined and gstdio28.h not included."
#endif
G_BEGIN_DECLS
#define g_access access
#define g_chmod chmod
#define g_creat creat
#define g_chdir chdir
G_END_DECLS
#endif /* __G_STDIO_H__ */

View File

@ -1,6 +1,5 @@
# Work around the intltool-0.35.5 / automake-1.10 failures
# due to "missing" files. These files may be distributed.
lib/glib28/gfileutils-2.8.c
src/gnome/gnucash.desktop.in.in
src/gnome/gnucash.desktop.in
src/engine/iso-4217-currencies.c

View File

@ -52,5 +52,4 @@ EXTRA_DIST = \
base-typemaps.i \
README.modules \
gnc-test-env \
guile-mappings.h \
glib-compat.h
guile-mappings.h

View File

@ -23,9 +23,6 @@
#include <glib.h>
#include <glib/gstdio.h>
#ifndef HAVE_GLIB_2_8
#include <gfileutils-2.8.h>
#endif
#include <libguile.h>
#include <errno.h>
#include <fcntl.h>

View File

@ -45,7 +45,6 @@
#define GNC_ACCOUNTING_PERIOD_H
#include <glib.h>
#include "glib-compat.h"
#include <time.h>
/**

View File

@ -34,7 +34,6 @@
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include "glib-compat.h"
#include "Account.h"
#include "SX-book.h"

View File

@ -1,7 +1,6 @@
#include "config.h"
#include <stdlib.h>
#include <glib.h>
#include "glib-compat.h"
#include "SX-book.h"
#include "gnc-sx-instance-model.h"
#include "gnc-ui-util.h"

View File

@ -33,9 +33,6 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#ifndef HAVE_GLIB_2_8
#include <gstdio-2.8.h>
#endif
#include <libintl.h>
#include <locale.h>
#include <fcntl.h>

View File

@ -46,221 +46,6 @@
#include "gnc-gkeyfile-utils.h"
#ifndef HAVE_GLIB_2_12
/**********************************************************************
*
* The following functions are copied verbatim from the GLIB 2.12
* source code. If more glib 2.12 functions are included into
* gnucash,then they should all be consolidated in a lib/glib212
* directory.
*
**********************************************************************/
static gchar *
_g_utf8_make_valid (const gchar *name)
{
GString *string;
const gchar *remainder, *invalid;
gint remaining_bytes, valid_bytes;
string = NULL;
remainder = name;
remaining_bytes = strlen (name);
while (remaining_bytes != 0)
{
if (g_utf8_validate (remainder, remaining_bytes, &invalid))
break;
valid_bytes = invalid - remainder;
if (string == NULL)
string = g_string_sized_new (remaining_bytes);
g_string_append_len (string, remainder, valid_bytes);
/* append U+FFFD REPLACEMENT CHARACTER */
g_string_append (string, "\357\277\275");
remaining_bytes -= valid_bytes + 1;
remainder = invalid + 1;
}
if (string == NULL)
return g_strdup (name);
g_string_append (string, remainder);
g_assert (g_utf8_validate (string->str, -1, NULL));
return g_string_free (string, FALSE);
}
static gdouble
g_key_file_parse_value_as_double (GKeyFile *key_file,
const gchar *value,
GError **error)
{
gchar *end_of_valid_d;
gdouble double_value = 0;
double_value = g_ascii_strtod (value, &end_of_valid_d);
if (*end_of_valid_d != '\0' || end_of_valid_d == value)
{
gchar *value_utf8 = _g_utf8_make_valid (value);
g_set_error (error, G_KEY_FILE_ERROR,
G_KEY_FILE_ERROR_INVALID_VALUE,
_("Value '%s' cannot be interpreted "
"as a float number."),
value_utf8);
g_free (value_utf8);
}
return double_value;
}
gdouble
g_key_file_get_double (GKeyFile *key_file, const gchar *group_name,
const gchar *key, GError **error)
{
GError *key_file_error;
gchar *value;
gdouble double_value;
g_return_val_if_fail (key_file != NULL, -1);
g_return_val_if_fail (group_name != NULL, -1);
g_return_val_if_fail (key != NULL, -1);
key_file_error = NULL;
value = g_key_file_get_value (key_file, group_name, key, &key_file_error);
if (key_file_error)
{
g_propagate_error (error, key_file_error);
return 0;
}
double_value = g_key_file_parse_value_as_double (key_file, value,
&key_file_error);
g_free (value);
if (key_file_error)
{
if (g_error_matches (key_file_error,
G_KEY_FILE_ERROR,
G_KEY_FILE_ERROR_INVALID_VALUE))
{
g_set_error (error, G_KEY_FILE_ERROR,
G_KEY_FILE_ERROR_INVALID_VALUE,
_("Key file contains key '%s' in group '%s' "
"which has a value that cannot be interpreted."), key,
group_name);
g_error_free (key_file_error);
}
else
g_propagate_error (error, key_file_error);
}
return double_value;
}
void
g_key_file_set_double (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
gdouble value)
{
gchar result[G_ASCII_DTOSTR_BUF_SIZE];
g_return_if_fail (key_file != NULL);
g_ascii_dtostr (result, sizeof (result), value);
g_key_file_set_value (key_file, group_name, key, result);
}
gdouble*
g_key_file_get_double_list (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
gsize *length,
GError **error)
{
GError *key_file_error = NULL;
gchar **values;
gdouble *double_values;
gsize i, num_doubles;
g_return_val_if_fail (key_file != NULL, NULL);
g_return_val_if_fail (group_name != NULL, NULL);
g_return_val_if_fail (key != NULL, NULL);
values = g_key_file_get_string_list (key_file, group_name, key,
&num_doubles, &key_file_error);
if (key_file_error)
g_propagate_error (error, key_file_error);
if (!values)
return NULL;
double_values = g_new0 (gdouble, num_doubles);
for (i = 0; i < num_doubles; i++)
{
double_values[i] = g_key_file_parse_value_as_double (key_file,
values[i],
&key_file_error);
if (key_file_error)
{
g_propagate_error (error, key_file_error);
g_strfreev (values);
g_free (double_values);
return NULL;
}
}
g_strfreev (values);
if (length)
*length = num_doubles;
return double_values;
}
void
g_key_file_set_double_list (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
gdouble list[],
gsize length)
{
GString *values;
gsize i;
g_return_if_fail (key_file != NULL);
g_return_if_fail (list != NULL);
values = g_string_sized_new (length * 16);
for (i = 0; i < length; i++)
{
gchar result[G_ASCII_DTOSTR_BUF_SIZE];
g_ascii_dtostr( result, sizeof (result), list[i] );
g_string_append (values, result);
g_string_append_c (values, ';');
}
g_key_file_set_value (key_file, group_name, key, values->str);
g_string_free (values, TRUE);
}
/**********************************************************************
*
* End of copied functions.
*
**********************************************************************/
#endif
GKeyFile *
gnc_key_file_load_from_file (const gchar *filename,

View File

@ -38,23 +38,6 @@
#define GNC_GKEYFILE_UTILS_H
#ifndef HAVE_GLIB_2_12
gdouble
g_key_file_get_double (GKeyFile *key_file, const gchar *group_name,
const gchar *key, GError **error);
void
g_key_file_set_double (GKeyFile *key_file, const gchar *group_name,
const gchar *key, gdouble value);
gdouble*
g_key_file_get_double_list (GKeyFile *key_file, const gchar *group_name,
const gchar *key, gsize *length, GError **error);
void
g_key_file_set_double_list (GKeyFile *key_file, const gchar *group_name,
const gchar *key, gdouble list[], gsize length);
#endif
/** Open and read a key/value file from disk into memory.
*
* @param file The name of the file to load. This should be a fully

View File

@ -22,7 +22,6 @@
#include <time.h>
#include <glib.h>
#include <glib/gi18n.h>
#include "glib-compat.h"
#include <string.h>
#include "Recurrence.h"
#include "gnc-date.h"
@ -477,7 +476,7 @@ recurrenceListIsSemiMonthly(GList *recurrences)
PeriodType first_period, second_period;
first_period = recurrenceGetPeriodType(first);
second_period = recurrenceGetPeriodType(second);
if (!((first_period == PERIOD_MONTH
|| first_period == PERIOD_END_OF_MONTH
|| first_period == PERIOD_LAST_WEEKDAY)
@ -497,7 +496,7 @@ gboolean
recurrenceListIsWeeklyMultiple(GList *recurrences)
{
GList *r_iter;
for (r_iter = recurrences; r_iter != NULL; r_iter = r_iter->next)
{
Recurrence *r = (Recurrence*)r_iter->data;

View File

@ -29,8 +29,6 @@
#include <time.h>
#include "qof.h"
#include "glib-compat.h"
#include "Account.h"
#include "gnc-budget.h"
@ -272,7 +270,7 @@ void
gnc_budget_commit_edit(GncBudget *bgt)
{
if (!qof_commit_edit(QOF_INSTANCE(bgt))) return;
qof_commit_edit_part2(QOF_INSTANCE(bgt), commit_err,
qof_commit_edit_part2(QOF_INSTANCE(bgt), commit_err,
noop, gnc_budget_free);
}
@ -560,7 +558,7 @@ gnc_budget_get_account_period_actual_value(
{
// FIXME: maybe zero is not best error return val.
g_return_val_if_fail(GNC_IS_BUDGET(budget) && acc, gnc_numeric_zero());
return recurrenceGetAccountPeriodValue(&GET_PRIVATE(budget)->recurrence,
return recurrenceGetAccountPeriodValue(&GET_PRIVATE(budget)->recurrence,
acc, period_num);
}
@ -620,11 +618,11 @@ static QofObject budget_object_def =
/* Static wrapper getters for the recurrence params */
static PeriodType gnc_budget_get_rec_pt(const GncBudget *bgt)
static PeriodType gnc_budget_get_rec_pt(const GncBudget *bgt)
{ return recurrenceGetPeriodType(&(GET_PRIVATE(bgt)->recurrence)); }
static guint gnc_budget_get_rec_mult(const GncBudget *bgt)
static guint gnc_budget_get_rec_mult(const GncBudget *bgt)
{ return recurrenceGetMultiplier(&(GET_PRIVATE(bgt)->recurrence)); }
static GDate gnc_budget_get_rec_date(const GncBudget *bgt)
static GDate gnc_budget_get_rec_date(const GncBudget *bgt)
{ return recurrenceGetDate(&(GET_PRIVATE(bgt)->recurrence)); }
/* Register ourselves with the engine. */
@ -634,8 +632,8 @@ gboolean gnc_budget_register (void)
{ "name", QOF_TYPE_STRING,
(QofAccessFunc) gnc_budget_get_name,
(QofSetterFunc) gnc_budget_set_name },
{ "description", QOF_TYPE_STRING,
(QofAccessFunc) gnc_budget_get_description,
{ "description", QOF_TYPE_STRING,
(QofAccessFunc) gnc_budget_get_description,
(QofSetterFunc) gnc_budget_set_description },
{ "recurrence_period_type", QOF_TYPE_INT32,
(QofAccessFunc) gnc_budget_get_rec_pt, NULL },
@ -648,12 +646,12 @@ gboolean gnc_budget_register (void)
{ "recurrence_date", QOF_TYPE_DATE,
(QofAccessFunc) gnc_budget_get_rec_date, NULL },
/* Signedness problem: Should be unsigned. */
{ "num_periods", QOF_TYPE_INT32,
{ "num_periods", QOF_TYPE_INT32,
(QofAccessFunc) gnc_budget_get_num_periods,
(QofSetterFunc) gnc_budget_set_num_periods },
{ QOF_PARAM_BOOK, QOF_ID_BOOK,
(QofSetterFunc) gnc_budget_set_num_periods },
{ QOF_PARAM_BOOK, QOF_ID_BOOK,
(QofAccessFunc) qof_instance_get_book, NULL },
{ QOF_PARAM_GUID, QOF_TYPE_GUID,
{ QOF_PARAM_GUID, QOF_TYPE_GUID,
(QofAccessFunc) qof_instance_get_guid, NULL },
{ NULL },
};

View File

@ -1,23 +0,0 @@
/*
* glib-compat.h - GLib version compatability mappings
* Copyright (C) 2005, David Hampton <hampton@employees.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#ifndef HAVE_GLIB29
#define g_date_set_time_t g_date_set_time
#endif

View File

@ -27,7 +27,6 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "glib-compat.h"
#include <glib/gi18n.h>
#include <glade/glade.h>
#include <gmodule.h>
@ -249,7 +248,7 @@ gnc_restore_window_size(const char *section, GtkWindow *window)
if (!gnc_gconf_get_bool(GCONF_GENERAL, KEY_SAVE_GEOMETRY, NULL))
return;
coord_list = gnc_gconf_get_list(section, WINDOW_POSITION,
GCONF_VALUE_INT, NULL);
if (coord_list) {
@ -326,7 +325,7 @@ gnc_option_menu_init(GtkWidget * w)
{
gtk_option_menu_set_history(GTK_OPTION_MENU(w), i);
active = gtk_menu_get_active(GTK_MENU(menu));
g_object_set_data(G_OBJECT(active),
g_object_set_data(G_OBJECT(active),
"option_index",
GINT_TO_POINTER(i));
}
@ -345,7 +344,7 @@ gnc_option_menu_set_one_item (gpointer loop_data, gpointer user_data)
{
GObject *item = G_OBJECT(loop_data);
menu_init_data *args = (menu_init_data *) user_data;
g_object_set_data(item, "option_index", GINT_TO_POINTER(args->i++));
g_signal_connect(item, "activate", args->f, args->cb_data);
}
@ -438,12 +437,12 @@ gnc_handle_date_accelerator (GdkEventKey *event,
if ((tm->tm_mday <= 0) || (tm->tm_mon == -1) || (tm->tm_year == -1))
return FALSE;
g_date_set_dmy (&gdate,
g_date_set_dmy (&gdate,
tm->tm_mday,
tm->tm_mon + 1,
tm->tm_year + 1900);
/*
/*
* Check those keys where the code does different things depending
* upon the modifiers.
*/
@ -479,7 +478,7 @@ gnc_handle_date_accelerator (GdkEventKey *event,
uc = g_utf8_get_char (c);
if (uc == '-')
count++;
c = g_utf8_next_char (c);
c = g_utf8_next_char (c);
}
if (count < 2)
@ -667,7 +666,7 @@ check_realize (GtkWidget *widget, gpointer user_data)
gdk_draw_line (check_info->on_pixmap, gc,
1, check_size / 2 + 1,
check_size / 3, check_size - 4);
gdk_draw_line (check_info->on_pixmap, gc,
check_size / 3, check_size - 5,
check_size - 3, 2);
@ -845,7 +844,7 @@ gnc_glade_lookup_widget (GtkWidget *widget, const char *name)
xml = glade_get_widget_tree (widget);
if (!xml) return NULL;
wid = glade_xml_get_widget (xml, name);
if (!wid)
PWARN("I know nothing of this '%s' whom you seek.", name);

View File

@ -35,7 +35,7 @@
#include "config.h"
#include <gnome.h>
#include <gnome.h>
#include <glib/gi18n.h>
#include <string.h>
#include <stdlib.h> /* atoi */
@ -50,7 +50,6 @@
#include "gnc-engine.h"
#include "dialog-utils.h"
#include "gnc-date-edit.h"
#include "glib-compat.h"
enum {
DATE_CHANGED,
@ -106,7 +105,7 @@ gnc_date_edit_get_type (void)
"GNCDateEdit",
&date_edit_info, 0);
}
return date_edit_type;
}
@ -469,7 +468,7 @@ fill_time_popup (GtkWidget *widget, GNCDateEdit *gde)
time (&current_time);
tm_returned = localtime_r (&current_time, &mtm);
g_return_if_fail(tm_returned != NULL);
for (i = gde->lower_hour; i <= gde->upper_hour; i++){
GtkWidget *item, *submenu;
hour_info_t *hit;
@ -531,7 +530,7 @@ gnc_date_edit_class_init (GNCDateEditClass *klass)
GObjectClass *object_class = (GObjectClass *) klass;
object_class = (GObjectClass*) klass;
parent_class = g_type_class_ref(GTK_TYPE_HBOX);
date_edit_signals [TIME_CHANGED] =
@ -642,7 +641,7 @@ gnc_date_edit_forall (GtkContainer *container, gboolean include_internals,
}
static void
gnc_date_edit_set_time_tm (GNCDateEdit *gde, struct tm *mytm)
gnc_date_edit_set_time_tm (GNCDateEdit *gde, struct tm *mytm)
{
char buffer [40];
@ -709,8 +708,8 @@ gnc_date_edit_set_gdate (GNCDateEdit *gde, const GDate *date)
{
struct tm mytm;
time_t t;
g_return_if_fail(gde && GNC_IS_DATE_EDIT(gde) &&
g_return_if_fail(gde && GNC_IS_DATE_EDIT(gde) &&
date && g_date_valid(date));
g_date_to_struct_tm(date, &mytm);
t = mktime(&mytm);
@ -914,7 +913,7 @@ create_children (GNCDateEdit *gde)
*
* Creates a new GNCDateEdit widget which can be used to provide
* an easy to use way for entering dates and times.
*
*
* Returns a GNCDateEdit widget.
*/
GtkWidget *
@ -957,9 +956,9 @@ gnc_date_edit_new_glade (gchar *widget_name,
* gnc_date_edit_new_flags:
* @the_time: The initial time for the date editor.
* @flags: A bitmask of GNCDateEditFlags values.
*
*
* Creates a new GNCDateEdit widget with the specified flags.
*
*
* Return value: the newly-created date editor widget.
**/
GtkWidget *
@ -1133,20 +1132,20 @@ gnc_date_edit_get_date_end_ts (GNCDateEdit *gde)
* gnc_date_edit_set_flags:
* @gde: The date editor widget whose flags should be changed.
* @flags: The new bitmask of GNCDateEditFlags values.
*
*
* Changes the display flags on an existing date editor widget.
**/
void
gnc_date_edit_set_flags (GNCDateEdit *gde, GNCDateEditFlags flags)
{
GNCDateEditFlags old_flags;
g_return_if_fail (gde != NULL);
g_return_if_fail (GNC_IS_DATE_EDIT (gde));
old_flags = gde->flags;
gde->flags = flags;
if ((flags & GNC_DATE_EDIT_SHOW_TIME) !=
(old_flags & GNC_DATE_EDIT_SHOW_TIME)) {
if (flags & GNC_DATE_EDIT_SHOW_TIME) {
@ -1182,9 +1181,9 @@ gnc_date_edit_set_flags (GNCDateEdit *gde, GNCDateEditFlags flags)
/**
* gnc_date_edit_get_flags:
* @gde: The date editor whose flags should be queried.
*
*
* Queries the display flags on a date editor widget.
*
*
* Return value: The current display flags for the given date editor widget.
**/
int
@ -1200,7 +1199,7 @@ gnc_date_edit_get_flags (GNCDateEdit *gde)
* gnc_date_set_activates_default:
* @gde: The date editor to modify
* @state: The new state for this widget.
*
*
* Extracts the editable field from a GNCDateEdit widget, and sets it
* up so that pressing the Enter key in this field as the same as
* clicking the button that has the default.
@ -1218,7 +1217,7 @@ gnc_date_activates_default (GNCDateEdit *gde, gboolean state)
* gnc_date_grab_focus:
* @gde: The date editor to modify
* @state: The new state for this widget.
*
*
* Sets the focus to the Editable field.
**/
void

View File

@ -33,7 +33,6 @@
#include "config.h"
#include <glib.h>
#include <glib-object.h>
#include "glib-compat.h"
#include "gnc-dense-cal.h"
#include "gnc-dense-cal-model.h"
#include "gnc-dense-cal-store.h"
@ -42,7 +41,7 @@
struct _GncDenseCalStore
{
GObject parent;
GDate start_date;
gdcs_end_type end_type;
GDate end_date;
@ -50,7 +49,7 @@ struct _GncDenseCalStore
gchar *name;
gchar *info;
int num_marks;
int num_real_marks;
int num_real_marks;
GDate **cal_marks;
};
@ -76,7 +75,7 @@ gnc_dense_cal_store_class_init(GncDenseCalStoreClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS(klass);
parent_class = g_type_class_peek_parent(klass);
object_class->finalize = gnc_dense_cal_store_finalize;
}
@ -90,7 +89,7 @@ gnc_dense_cal_store_iface_init(gpointer g_iface, gpointer iface_data)
iface->get_instance_count = gdcs_get_instance_count;
iface->get_instance = gdcs_get_instance;
}
GType
gnc_dense_cal_store_get_type(void)
{

View File

@ -22,7 +22,6 @@
#include "config.h"
#include "glib-compat.h"
#include "gnc-dense-cal.h"
#include "gnc-dense-cal-model.h"
#include "gnc-engine.h"
@ -265,7 +264,7 @@ gnc_dense_cal_init(GncDenseCal *dcal)
{
GtkTreeModel *options;
GtkCellRenderer *text_rend;
options = GTK_TREE_MODEL(_gdc_get_view_options());
dcal->view_options = GTK_COMBO_BOX(gtk_combo_box_new_with_model(options));
gtk_combo_box_set_active(GTK_COMBO_BOX(dcal->view_options), 0);
@ -287,7 +286,7 @@ gnc_dense_cal_init(GncDenseCal *dcal)
gtk_container_add(GTK_CONTAINER(label_align), GTK_WIDGET(label));
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label_align), TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(dcal->view_options), FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(dcal), GTK_WIDGET(hbox), FALSE, FALSE, 0);
}
dcal->cal_drawing_area = GTK_DRAWING_AREA(gtk_drawing_area_new());
@ -309,7 +308,7 @@ gnc_dense_cal_init(GncDenseCal *dcal)
dcal->lastMarkTag = 0;
dcal->showPopup = FALSE;
dcal->transPopup = GTK_WINDOW(gtk_window_new(GTK_WINDOW_POPUP));
{
GtkWidget *vbox, *hbox;
@ -373,7 +372,7 @@ gnc_dense_cal_init(GncDenseCal *dcal)
pango_font_description_set_size(font_desc, font_size);
gtk_widget_modify_font(GTK_WIDGET(dcal), font_desc);
pango_font_description_free(font_desc);
maxWidth = maxHeight = 0;
for (i=0; i<12; i++)
{
@ -387,7 +386,7 @@ gnc_dense_cal_init(GncDenseCal *dcal)
// these two were reversed, before...
dcal->label_width = maxWidth;
dcal->label_height = maxHeight;
g_object_unref(layout);
}
@ -427,7 +426,7 @@ gnc_dense_cal_init(GncDenseCal *dcal)
dcal->min_x_scale = dcal->x_scale = width_88 + 2;
dcal->min_y_scale = dcal->y_scale = MAX(floor((float)width_XXX / 3.), height_88 + 2);
dcal->dayLabelHeight = height_88;
g_object_unref(layout);
@ -572,7 +571,7 @@ gnc_dense_cal_set_num_months(GncDenseCal *dcal, guint num_months)
g_critical("no view options?");
return;
}
do
{
gint months_val, delta_months;
@ -718,7 +717,7 @@ gdc_reconfig(GncDenseCal *dcal)
gnc_dense_cal_draw_to_buffer(dcal);
}
static void
static void
_gdc_compute_min_size(GncDenseCal *dcal, guint *min_width, guint *min_height)
{
if (min_width != NULL)
@ -1000,7 +999,7 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
{
gint x, y, w, h;
gint j;
pango_layout_set_text(layout, "S", -1);
pango_layout_get_pixel_size(layout, NULL, &dcal->dayLabelHeight);
@ -1038,7 +1037,7 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
/* draw the day labels */
pango_layout_set_text(layout, "88", -1);
pango_layout_get_pixel_size(layout, &maxWidth, NULL);
if (dcal->x_scale > maxWidth)
{
for (j=0; j<7; j++)
@ -1124,7 +1123,7 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
}
LOG_AND_RESET(timer, "dates");
gtk_widget_queue_draw_area(GTK_WIDGET(dcal),
gtk_widget_queue_draw_area(GTK_WIDGET(dcal),
widget->allocation.x,
widget->allocation.y,
widget->allocation.width,
@ -1252,7 +1251,7 @@ _gdc_view_option_changed(GtkComboBox *widget, gpointer user_data)
GtkTreeIter iter;
GtkTreeModel *model;
gint months_val;
model = GTK_TREE_MODEL(gtk_combo_box_get_model(widget));
if (!gtk_combo_box_get_active_iter(widget, &iter))
return;
@ -1503,7 +1502,7 @@ month_coords(GncDenseCal *dcal, int monthOfCal, GList **outList)
rect = NULL;
}
}
/* Get the last week. */
{
gint end_week_of_year = g_date_get_sunday_week_of_year(endD);
@ -1629,10 +1628,10 @@ wheres_this(GncDenseCal *dcal, int x, int y)
{
return -1;
}
/* coords -> year-relative-values */
colNum = floor(x / (col_width(dcal)+COL_BORDER_SIZE));
x %= (col_width(dcal)+COL_BORDER_SIZE);
x -= dcal->label_width;
if (x < 0)
@ -1783,7 +1782,7 @@ gdc_model_added_cb(GncDenseCalModel *model, guint added_tag, gpointer user_data)
GncDenseCal *cal = GNC_DENSE_CAL(user_data);
g_debug("gdc_model_added_cb update\n");
gdc_add_tag_markings(cal, added_tag);
}
}
static void
gdc_model_update_cb(GncDenseCalModel *model, guint update_tag, gpointer user_data)
@ -1792,7 +1791,7 @@ gdc_model_update_cb(GncDenseCalModel *model, guint update_tag, gpointer user_dat
g_debug("gdc_model_update_cb update for tag [%d]\n", update_tag);
gdc_mark_remove(cal, update_tag, FALSE);
gdc_add_tag_markings(cal, update_tag);
}
static void

View File

@ -27,7 +27,6 @@
#include <gtk/gtk.h>
#include <glib/gtypes.h>
#include "glib-compat.h"
#include <math.h>
#include <time.h>
@ -117,7 +116,7 @@ gnc_frequency_get_type()
0,
(GInstanceInitFunc)gnc_frequency_init
};
gncfreq_type = g_type_register_static (GTK_TYPE_VBOX,
"GncFrequency",
&gncfreq_info, 0);
@ -130,7 +129,7 @@ static void
gnc_frequency_class_init( GncFrequencyClass *klass )
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
gnc_frequency_signals[GNCFREQ_CHANGED] =
@ -210,7 +209,7 @@ gnc_frequency_init(GncFrequency *gf)
/* initialize the spin buttons */
for (i=0; spinVals[i].name != NULL; i++)
{
if (spinVals[i].fn != NULL)
if (spinVals[i].fn != NULL)
{
o = glade_xml_get_widget(gf->gxml, spinVals[i].name);
adj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(o));
@ -287,7 +286,7 @@ start_date_changed( GNCDateEdit *gde, gpointer d )
/* ================================================================= */
/* Relabel some of the labels */
void
void
gnc_frequency_set_frequency_label_text(GncFrequency *gf, const gchar *txt)
{
GtkLabel *lbl;
@ -296,7 +295,7 @@ gnc_frequency_set_frequency_label_text(GncFrequency *gf, const gchar *txt)
gtk_label_set_text (lbl, txt);
}
void
void
gnc_frequency_set_date_label_text(GncFrequency *gf, const gchar *txt)
{
GtkLabel *lbl;
@ -469,7 +468,7 @@ gnc_frequency_setup(GncFrequency *gf, GList *recurrences, GDate *start_date)
case PERIOD_LAST_WEEKDAY: {
guint multiplier;
GtkWidget *multipler_spin, *day_of_month, *weekend_mode;
multipler_spin = glade_xml_get_widget(gf->gxml, "monthly_spin");
multiplier = recurrenceGetMultiplier(r);
if (recurrenceGetPeriodType(r) == PERIOD_YEAR)
@ -483,7 +482,7 @@ gnc_frequency_setup(GncFrequency *gf, GList *recurrences, GDate *start_date)
gtk_notebook_set_current_page(gf->nb, PAGE_MONTHLY);
gtk_combo_box_set_active(gf->freqComboBox, PAGE_MONTHLY);
} break;
} break;
case PERIOD_NTH_WEEKDAY:
g_critical("unhandled period type [%d]", recurrenceGetPeriodType(r));
break;
@ -515,7 +514,7 @@ _get_day_of_month_recurrence(GncFrequency *gf, GDate *start_date, int multiplier
int day_of_month_index = gtk_combo_box_get_active(GTK_COMBO_BOX(day_of_month_combo));
GtkWidget *weekend_adjust_combo = glade_xml_get_widget(gf->gxml, combo_weekend_name);
int weekend_adjust = gtk_combo_box_get_active(GTK_COMBO_BOX(weekend_adjust_combo));
r = g_new0(Recurrence, 1);
if (day_of_month_index > LAST_DAY_OF_MONTH_OPTION_INDEX)
{
@ -596,7 +595,7 @@ gnc_frequency_save_to_recurrence(GncFrequency *gf, GList **recurrences, GDate *o
r = g_new0(Recurrence, 1);
recurrenceSet(r, multiplier, PERIOD_WEEK, day_of_week_aligned_date, WEEKEND_ADJ_NONE);
*recurrences = g_list_append(*recurrences, r);
}
} break;

View File

@ -33,7 +33,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include "glib-compat.h"
#include "gnc-date.h"
#include "gnc-gconf-utils.h"
@ -101,7 +100,7 @@ struct _GncPeriodSelectPrivate
gboolean start;
GDate *fy_end;
GDate *date_base;
GtkWidget *date_label;
GtkWidget *date_align;
@ -373,7 +372,7 @@ gnc_period_select_get_property (GObject *object,
GParamSpec *pspec)
{
GncPeriodSelect *period = GNC_PERIOD_SELECT(object);
switch (prop_id)
{
case PROP_FY_END:
@ -407,7 +406,7 @@ gnc_period_select_set_property (GObject *object,
GParamSpec *pspec)
{
GncPeriodSelect *period = GNC_PERIOD_SELECT(object);
switch (prop_id)
{
case PROP_FY_END:
@ -455,7 +454,7 @@ gnc_period_select_get_type (void)
NULL
};
period_select_type = g_type_register_static(GTK_TYPE_HBOX,
period_select_type = g_type_register_static(GTK_TYPE_HBOX,
"GncPeriodSelect",
&period_select_info, 0);
}
@ -581,7 +580,7 @@ gnc_period_select_finalize (GObject *object)
/* Create a new GncPeriodSelect widget which is used to select a
* accounting period like "previous month" or "this year".
*
*
* @param starting_labels If set to TRUE then all the labels will
* refer to the "Start of...". If FALSE, labels will refer to "End
* of...".

View File

@ -25,7 +25,6 @@
#include "config.h"
#include <gnome.h>
#include "glib-compat.h"
#include <glade/glade.h>
#include "dialog-utils.h"

View File

@ -30,8 +30,6 @@
#include <locale.h>
#include <math.h>
#include "glib-compat.h"
#include "qof.h"
#include "gnc-date.h"
#include "gnc-gconf-utils.h"
@ -229,10 +227,10 @@ typedef struct _check_format {
gchar *title; /**< Title of this check format. Displayed to
* user in the dialog box. */
gboolean blocking; /**< Default for printing blocking characters for
gboolean blocking; /**< Default for printing blocking characters for
* this page of checks. */
gboolean print_date_format; /**< Default for printing date format characters for
gboolean print_date_format; /**< Default for printing date format characters for
* this page of checks. */
gboolean show_grid; /**< Print a grid pattern on the page */
@ -352,7 +350,7 @@ static void
get_float_pair (const char *section, const char *key, double *a, double *b)
{
GSList *coord_list;
coord_list = gnc_gconf_get_list (section, key, GCONF_VALUE_FLOAT, NULL);
if (NULL == coord_list) {
*a = 0;
@ -398,7 +396,7 @@ get_check_splits_amount(PrintCheckDialog *pcd)
s_list = xaccTransGetSplitList(trans);
if ( !s_list ) return NULL;
amount = g_strconcat("",NULL);
amount = g_strconcat("",NULL);
node = s_list;
cnt = 1;
while ( cnt < nSplits ) {
@ -431,7 +429,7 @@ get_check_splits_memo(PrintCheckDialog *pcd)
s_list = xaccTransGetSplitList(trans);
if ( !s_list ) return NULL;
memo = g_strconcat("",NULL);
memo = g_strconcat("",NULL);
node = s_list;
cnt = 1;
while ( cnt < nSplits ) {
@ -465,7 +463,7 @@ get_check_splits_account(PrintCheckDialog *pcd)
s_list = xaccTransGetSplitList(trans);
if ( !s_list ) return NULL;
account = g_strconcat("",NULL);
account = g_strconcat("",NULL);
node = s_list;
cnt = 1;
while ( cnt < nSplits ) {
@ -490,7 +488,7 @@ check_format_has_address ( PrintCheckDialog *pcd )
check_format_t *format = NULL;
if ( !pcd ) return FALSE;
/* if format is NULL, then the custom format is being used
/* if format is NULL, then the custom format is being used
* which has an ADDRESS item by definition */
format = pcd->selected_format;
if ( !format ) return TRUE;
@ -758,7 +756,7 @@ pcd_save_custom_data(PrintCheckDialog *pcd, const gchar *title)
pcd->splits_account_x, pcd->splits_account_y);
filename = g_strconcat(title, CHECK_NAME_EXTENSION, NULL);
pathname = g_build_filename(gnc_dotgnucash_dir(), CHECK_FMT_DIR,
pathname = g_build_filename(gnc_dotgnucash_dir(), CHECK_FMT_DIR,
filename, NULL);
if (gnc_key_file_save_to_file(pathname, key_file, &error)) {
@ -772,7 +770,7 @@ pcd_save_custom_data(PrintCheckDialog *pcd, const gchar *title)
dialog = gtk_message_dialog_new(GTK_WINDOW(pcd->dialog),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE, "%s",
GTK_BUTTONS_CLOSE, "%s",
_("Cannot save check format file."));
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
"%s", error->message);
@ -1382,7 +1380,7 @@ read_one_check_directory(PrintCheckDialog * pcd, GtkListStore *store,
dialog = gtk_message_dialog_new
(GTK_WINDOW(pcd->dialog),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s",
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s",
_("There is a duplicate check format file."));
gtk_message_dialog_format_secondary_text
(GTK_MESSAGE_DIALOG(dialog),
@ -1948,7 +1946,7 @@ draw_date_format(GncPrintContext * context, const gchar *date_format,
text = g_string_free(cdn_fmt, FALSE);
draw_text(context, text, &date_item, date_desc);
g_free(text);
g_free(text);
if (expanded)
g_free(expanded);
pango_font_description_free(date_desc);
@ -2335,7 +2333,7 @@ draw_page(GtkPrintOperation * operation,
/* Compute the number of pages required to complete this print operation.
* Today, check printing only prints one check at a time. When its extended to
* Today, check printing only prints one check at a time. When its extended to
* print multiple checks, this will need to take into account the number of
* checks to print, the number of checks on a page, and the starting check
* position on the page. This function is called once by the GtkPrint code to
@ -2453,7 +2451,7 @@ gnc_print_check_format_changed (GtkComboBox *widget,
/* If there's only one thing in the position combobox, make it insensitive */
sensitive = (pcd->position_max > 0);
gtk_widget_set_sensitive(GTK_WIDGET(pcd->position_combobox), sensitive);
/* Update the custom page */
sensitive = (!separator && !format);
gtk_container_foreach(GTK_CONTAINER(pcd->custom_table),

View File

@ -34,7 +34,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include "glib-compat.h"
#include <locale.h>
#include <time.h>
@ -249,7 +248,7 @@ editor_ok_button_clicked( GtkButton *b, GncSxEditorDialog *sxed )
QofBook *book;
SchedXactions *sxes;
if ( !gnc_sxed_check_consistent( sxed ) )
if ( !gnc_sxed_check_consistent( sxed ) )
return;
gnc_sxed_save_sx( sxed );
@ -287,7 +286,7 @@ gnc_sxed_check_changed( GncSxEditorDialog *sxed )
name = gtk_editable_get_chars( GTK_EDITABLE(sxed->nameEntry), 0, -1 );
if ( strlen(name) == 0 ) {
return TRUE;
}
if ( (xaccSchedXactionGetName(sxed->sx) == NULL)
|| (strcmp( xaccSchedXactionGetName(sxed->sx),
@ -350,10 +349,10 @@ gnc_sxed_check_changed( GncSxEditorDialog *sxed )
/* SX options [autocreate, notify, reminder, advance] */
{
gboolean dlgEnabled,
dlgAutoCreate,
dlgNotify,
dlgAutoCreate,
dlgNotify,
sxEnabled,
sxAutoCreate,
sxAutoCreate,
sxNotify;
gint dlgAdvance, sxAdvance;
gint dlgRemind, sxRemind;
@ -566,7 +565,7 @@ gnc_sxed_check_consistent( GncSxEditorDialog *sxed )
/* balance with random variable bindings some number
* of times in an attempt to ferret out
* un-balanceable transactions.
*
*
* NOTE: The Real Way to do this is with some
* symbolic math to eliminate the variables. This is
* hard, and we don't do it. This solution will
@ -619,7 +618,7 @@ gnc_sxed_check_consistent( GncSxEditorDialog *sxed )
base_cmdty = split_cmdty;
}
multi_commodity |= !gnc_commodity_equal(split_cmdty, base_cmdty);
v = kvp_frame_get_slot_path( f,
GNC_SX_ID,
GNC_SX_CREDIT_FORMULA,
@ -715,7 +714,7 @@ gnc_sxed_check_consistent( GncSxEditorDialog *sxed )
gnc_error_dialog( sxed->dialog, "%s", sx_has_no_name_msg );
g_free( name );
return FALSE;
}
nameExists = FALSE;
@ -765,7 +764,7 @@ gnc_sxed_check_consistent( GncSxEditorDialog *sxed )
GTK_TOGGLE_BUTTON(sxed->notifyOpt) );
if (((ttVarCount > 0) || multi_commodity) && autocreateState) {
gnc_warning_dialog(sxed->dialog, "%s",
gnc_warning_dialog(sxed->dialog, "%s",
_("Scheduled Transactions with variables "
"cannot be automatically created."));
return FALSE;
@ -774,7 +773,7 @@ gnc_sxed_check_consistent( GncSxEditorDialog *sxed )
/* Fix for part of Bug#121740 -- auto-create transactions are
* only valid if there's actually a transaction to create. */
if ( autocreateState && splitCount == 0 ) {
gnc_warning_dialog(sxed->dialog, "%s",
gnc_warning_dialog(sxed->dialog, "%s",
_("Scheduled Transactions without a template "
"transaction cannot be automatically created.") );
return FALSE;
@ -973,7 +972,7 @@ static void
enabled_toggled( GtkObject *o, GncSxEditorDialog *sxed )
{
return;
}
}
static void
autocreate_toggled( GtkObject *o, GncSxEditorDialog *sxed )
@ -1205,7 +1204,7 @@ gnc_ui_scheduled_xaction_editor_dialog_create(SchedXaction *sx,
gtk_editable_set_editable( GTK_EDITABLE(sxed->advanceSpin), TRUE );
gtk_editable_set_editable( GTK_EDITABLE(sxed->remindSpin), TRUE );
/* Allow resize */
gtk_window_set_resizable (GTK_WINDOW(sxed->dialog), TRUE);
@ -1423,7 +1422,7 @@ schedXact_editor_populate( GncSxEditorDialog *sxed )
}
/* populate the ledger */
{
{
/* create the split list */
GList *splitList;
@ -1492,7 +1491,7 @@ gnc_sxed_reg_check_close(GncSxEditorDialog *sxed)
_("The current template transaction "
"has been changed. "
"Would you like to record the changes?");
reg = gnc_ledger_display_get_split_register (sxed->ledger);
pending_changes = gnc_split_register_changed (reg);
if (!pending_changes) {
@ -1504,7 +1503,7 @@ gnc_sxed_reg_check_close(GncSxEditorDialog *sxed)
trans = gnc_split_register_get_current_trans( reg );
if ( !gnc_split_register_save( reg, TRUE ) )
return;
gnc_split_register_redraw( reg );
} else {
gnc_split_register_cancel_cursor_trans_changes (reg);

View File

@ -28,7 +28,6 @@
#include "dialog-sx-editor.h"
#include "dialog-sx-from-trans.h"
#include "dialog-utils.h"
#include "glib-compat.h"
#include "gnc-component-manager.h"
#include "gnc-date-edit.h"
#include "gnc-dense-cal-store.h"
@ -85,7 +84,7 @@ typedef enum { FREQ_DAILY = 0, /* I know the =0 is redundant, but I'm using
* the numeric equivalences explicitly here */
FREQ_WEEKLY,
FREQ_BIWEEKLY,
FREQ_MONTHLY,
FREQ_MONTHLY,
FREQ_QUARTERLY,
FREQ_ANNUALLY
} SxftiFreqType;
@ -138,24 +137,24 @@ sxfti_attach_callbacks(SXFromTransInfo *sxfti)
{ SXFTD_N_OCCURRENCES_ENTRY, "changed", sxftd_update_excal_adapt },
{ NULL, NULL, NULL }
};
int i;
GtkWidget *w;
for(i = 0; callbacks[i].name != NULL; i++)
{
w = glade_xml_get_widget(sxfti->gxml, callbacks[i].name);
g_signal_connect (GTK_OBJECT(w), callbacks[i].signal,
g_signal_connect (GTK_OBJECT(w), callbacks[i].signal,
G_CALLBACK(callbacks[i].handlerFn),
sxfti );
}
g_signal_connect (G_OBJECT(sxfti->dialog), "response",
G_CALLBACK (gnc_sx_trans_window_response_cb),
G_CALLBACK (gnc_sx_trans_window_response_cb),
sxfti);
}
static getEndTuple
sxftd_get_end_info(SXFromTransInfo *sxfti)
@ -172,7 +171,7 @@ sxftd_get_end_info(SXFromTransInfo *sxfti)
retval.type = NEVER_END;
return retval;
}
w = glade_xml_get_widget(sxfti->gxml, SXFTD_END_ON_DATE_BUTTON);
if(gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(w))) {
time_t end_tt;
@ -182,7 +181,7 @@ sxftd_get_end_info(SXFromTransInfo *sxfti)
g_date_set_time_t( &(retval.end_date), end_tt);
return retval;
}
w = glade_xml_get_widget(sxfti->gxml, SXFTD_N_OCCURRENCES_BUTTON);
if(gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(w) )) {
gchar *text, *endptr;
@ -214,12 +213,12 @@ sxftd_get_end_info(SXFromTransInfo *sxfti)
return retval;
}
static guint
sxftd_add_template_trans(SXFromTransInfo *sxfti)
{
Transaction *tr = sxfti->trans;
GList *tt_list = NULL;
GList *splits, *template_splits = NULL;
@ -353,7 +352,7 @@ sxftd_init( SXFromTransInfo *sxfti )
if ( xaccTransIsOpen( sxfti->trans ) ) {
return SXFTD_ERRNO_OPEN_XACTION;
}
sxfti_attach_callbacks(sxfti);
/* Setup the example calendar and related data structures. */
@ -441,7 +440,7 @@ sxftd_init( SXFromTransInfo *sxfti )
sxfti );
sxftd_update_example_cal( sxfti );
return 0;
}
@ -464,7 +463,7 @@ sxftd_compute_sx(SXFromTransInfo *sxfti)
g_free(name);
g_date_set_time_t( &date, gnc_date_edit_get_date( sxfti->startDateGDE ) );
sxftd_update_schedule(sxfti, &date, &schedule);
if (sxftd_errno == 0) {
gnc_sx_set_schedule(sx, schedule);
@ -485,7 +484,7 @@ sxftd_compute_sx(SXFromTransInfo *sxfti)
case END_AFTER_N_OCCS:
xaccSchedXactionSetNumOccur(sx, end_info.n_occurrences);
break;
default:
sxftd_errno = 2;
break;
@ -495,8 +494,8 @@ sxftd_compute_sx(SXFromTransInfo *sxfti)
/* Set the autocreate, days-in-advance and remind-in-advance values from
* options. */
{
gboolean autoCreateState, notifyState;
{
gboolean autoCreateState, notifyState;
gint daysInAdvance;
autoCreateState =
@ -506,7 +505,7 @@ sxftd_compute_sx(SXFromTransInfo *sxfti)
xaccSchedXactionSetAutoCreate( sx,
autoCreateState,
(autoCreateState & notifyState) );
daysInAdvance =
gnc_gconf_get_float( SXED_GCONF_SECTION, KEY_CREATE_DAYS, NULL );
xaccSchedXactionSetAdvanceCreation( sx, daysInAdvance );
@ -550,7 +549,7 @@ sxftd_ok_clicked(SXFromTransInfo *sxfti)
else
{
if ( sx_error == SXFTD_ERRNO_UNBALANCED_XACTION ) {
gnc_error_dialog( gnc_ui_get_toplevel(), "%s",
gnc_error_dialog( gnc_ui_get_toplevel(), "%s",
_( "The Scheduled Transaction is unbalanced. "
"You are strongly encouraged to correct this situation." ) );
}
@ -562,7 +561,7 @@ sxftd_ok_clicked(SXFromTransInfo *sxfti)
sxftd_close(sxfti, FALSE);
return;
}
/**
* Update start date... right now we always base this off the transaction
* start date, but ideally we want to respect what the user has in the field,
@ -736,7 +735,7 @@ sxftd_update_example_cal( SXFromTransInfo *sxfti )
gnc_dense_cal_set_month( sxfti->example_cal, g_date_get_month( &startDate ) );
gnc_dense_cal_set_year( sxfti->example_cal, g_date_get_year( &startDate ) );
recurrenceListFree(&schedule);
}
@ -758,18 +757,18 @@ gnc_sx_create_from_trans( Transaction *trans )
sxfti->gxml = gnc_glade_xml_new(SX_GLADE_FILE,
SXFTD_DIALOG_GLADE_NAME);
sxfti->dialog = glade_xml_get_widget(sxfti->gxml,
SXFTD_DIALOG_GLADE_NAME);
sxfti->trans = trans;
sxfti->sx = xaccSchedXactionMalloc(gnc_get_current_book ());
if ( (errno = sxftd_init( sxfti )) < 0 ) {
if ( errno == SXFTD_ERRNO_OPEN_XACTION )
{
gnc_error_dialog( gnc_ui_get_toplevel(), "%s",
gnc_error_dialog( gnc_ui_get_toplevel(), "%s",
_( "Cannot create a Scheduled Transaction "
"from a Transaction currently "
"being edited. Please Enter the "

View File

@ -26,7 +26,6 @@
#include <gnome.h>
#include <glib/gi18n.h>
#include "glib-compat.h"
#include "Recurrence.h"
#include "Period.h"
@ -121,8 +120,8 @@ get_earliest_in_book (QofBook *book)
}
/* =============================================================== */
/* Find the number of transactions occuring before the indicated date.
* Do this by making a query and counting the results.
/* Find the number of transactions occuring before the indicated date.
* Do this by making a query and counting the results.
*/
static int
@ -236,10 +235,10 @@ prepare_remarks (AcctPeriodInfo *info)
g_date_get_year(&period_end));
period_begin = period_end;
recurrenceListNextInstance(info->period, &period_begin, &period_end);
}
}
/* Display the results */
remarks_text =
remarks_text =
_("The earliest transaction date found in this book is %s. "
"Based on the selection made above, this book will be split "
"into %d books. Click on 'Forward' to start closing the "
@ -274,7 +273,7 @@ show_book_details (AcctPeriodInfo *info)
recurrenceListFree(&info->period);
gnc_frequency_save_to_recurrence(info->period_menu, &info->period, &info->closing_date);
qof_print_date_dmy_buff (close_date_str, MAX_DATE_LENGTH,
qof_print_date_dmy_buff (close_date_str, MAX_DATE_LENGTH,
g_date_get_day(&info->closing_date),
g_date_get_month(&info->closing_date),
g_date_get_year(&info->closing_date));
@ -286,7 +285,7 @@ show_book_details (AcctPeriodInfo *info)
nacc = gnc_account_n_descendants (gnc_book_get_root_account (currbook));
/* Display the book info */
period_text =
period_text =
_("You have asked for a book to be created. This book "
"will contain all transactions up to midnight %s "
"(for a total of %d transactions spread over %d accounts). "
@ -300,7 +299,7 @@ show_book_details (AcctPeriodInfo *info)
gtk_widget_show (GTK_WIDGET (info->book_details));
/* Create default settings for the title, notes fields */
qof_print_date_dmy_buff (prev_close_date_str, MAX_DATE_LENGTH,
qof_print_date_dmy_buff (prev_close_date_str, MAX_DATE_LENGTH,
g_date_get_day(&info->prev_closing_date),
g_date_get_month(&info->prev_closing_date),
g_date_get_year(&info->prev_closing_date));
@ -333,10 +332,10 @@ ap_show_menu (GnomeDruidPage *druidpage,
ENTER("info=%p", info);
/* Find the date of the earliest transaction in the current book.
* Note that this could have changed since last time, since
* Note that this could have changed since last time, since
* we may have closed books since last time. */
info->earliest = get_earliest_in_book (gnc_get_current_book());
info->earliest_str = qof_print_date(info->earliest);
info->earliest_str = qof_print_date(info->earliest);
PINFO ("date of earliest is %ld %s", info->earliest, ctime (&info->earliest));
prepare_remarks (info);
@ -450,7 +449,7 @@ ap_close_period (GnomeDruidPage *druidpage,
/* We must save now; if we don't, and the user bails without saving,
* then opening account balances will be incorrect, and this can only
* lead to unhappiness.
* lead to unhappiness.
*/
gnc_file_save ();
gnc_resume_gui_refresh ();
@ -517,13 +516,13 @@ ap_druid_create (AcctPeriodInfo *info)
info->druid = GNOME_DRUID (glade_xml_get_widget (xml, "acct_period_druid"));
gnc_druid_set_colors (info->druid);
info->start_page =
info->start_page =
GNOME_DRUID_PAGE(glade_xml_get_widget (xml, "start page"));
info->menu_page =
info->menu_page =
GNOME_DRUID_PAGE(glade_xml_get_widget (xml, "menu page"));
info->book_page =
info->book_page =
GNOME_DRUID_PAGE(glade_xml_get_widget (xml, "book page"));
info->finish_page =
info->finish_page =
GNOME_DRUID_PAGE(glade_xml_get_widget (xml, "finish page"));
info->close_status = -1;
@ -532,8 +531,8 @@ ap_druid_create (AcctPeriodInfo *info)
* Add a year minus a day as the first guess for book closing,
* and use that to set up the freq spec widget. */
info->earliest = get_earliest_in_book (gnc_get_current_book());
info->earliest_str = qof_print_date(info->earliest);
PINFO ("date of earliest transaction is %ld %s",
info->earliest_str = qof_print_date(info->earliest);
PINFO ("date of earliest transaction is %ld %s",
info->earliest, ctime (&info->earliest));
g_date_clear (&info->closing_date, 1);
@ -562,19 +561,19 @@ ap_druid_create (AcctPeriodInfo *info)
TRUE, TRUE, 0);
/* Get handles to all of the other widgets we'll need */
info->period_remarks =
info->period_remarks =
GTK_LABEL (glade_xml_get_widget (xml, "remarks label"));
info->close_results =
info->close_results =
GTK_LABEL (glade_xml_get_widget (xml, "results label"));
info->book_details =
info->book_details =
GTK_LABEL (glade_xml_get_widget (xml, "book label"));
info->book_title =
info->book_title =
GTK_ENTRY (glade_xml_get_widget (xml, "book title entry"));
info->book_notes =
info->book_notes =
GTK_TEXT_VIEW (glade_xml_get_widget (xml, "book notes text"));
/* generic finished/close/abort signals */
@ -619,7 +618,7 @@ ap_close_handler (gpointer user_data)
/********************************************************************\
* gnc_acct_period_dialog *
* opens up a druid to configure accounting periods *
* *
* *
* Args: none *
* Return: nothing *
\********************************************************************/

View File

@ -26,7 +26,6 @@
#include <gnome.h>
#include <glib/gi18n.h>
#include "glib-compat.h"
#include <string.h>
#include <glade/glade.h>
#include <math.h>
@ -254,7 +253,7 @@ typedef struct LoanDruidData_ {
/* Current index of the payment opt for multiplexing the 'payment'
* page. */
int currentIdx;
/* widgets */
/* prm = params */
GtkTable *prmTable;
@ -421,7 +420,7 @@ gnc_ui_sx_loan_druid_create(void)
/* get pointers to the various widgets */
gnc_loan_druid_get_widgets( ldd );
/* non-gladeable widget setup */
{
int i;
@ -596,7 +595,7 @@ gnc_ui_sx_loan_druid_create(void)
12, 12 ));
gtk_spin_button_set_adjustment( ldd->prmRemainSpin, a );
}
g_signal_connect( ldd->optEscrowCb, "toggled",
G_CALLBACK(ld_escrow_toggle), ldd );
gtk_widget_set_sensitive( GTK_WIDGET(ldd->optEscrowHBox), FALSE );
@ -864,7 +863,7 @@ gnc_loan_druid_get_widgets( LoanDruidData *ldd )
GET_CASTED_WIDGET( GTK_COMBO_BOX, LENGTH_OPT );
ldd->prmRemainSpin =
GET_CASTED_WIDGET( GTK_SPIN_BUTTON, REMAIN_SPIN );
/* opt = options */
ldd->optVBox =
GET_CASTED_WIDGET( GTK_VBOX, OPT_CONTAINER );
@ -999,9 +998,9 @@ ld_destroy( GtkObject *o, gpointer ud )
for ( i=0; i<ldd->ld.repayOptCount; i++ ) {
RepayOptData *rod = ldd->ld.repayOpts[i];
if ( rod->name )
if ( rod->name )
g_free( rod->name );
if ( rod->txnMemo )
if ( rod->txnMemo )
g_free( rod->txnMemo );
if ( rod->startDate )
@ -1159,10 +1158,10 @@ ld_info_save( GnomeDruidPage *gdp, gpointer arg1, gpointer ud )
ldd->ld.primaryAcct = gnc_account_sel_get_account( ldd->prmAccountGAS );
if ( ldd->ld.primaryAcct == NULL ) {
gnc_info_dialog( ldd->dialog, "%s",
gnc_info_dialog( ldd->dialog, "%s",
_("Please select a valid loan account.") );
return TRUE;
}
}
if ( ! ldd->ld.repPriAcct ) {
ldd->ld.repPriAcct = ldd->ld.primaryAcct;
}
@ -1246,12 +1245,12 @@ ld_opts_save_state( LoanDruidData *ldd )
ldd->ld.escrowAcct =
gnc_account_sel_get_account( ldd->optEscrowGAS );
if ( ldd->ld.escrowAcct == NULL ) {
gnc_info_dialog( ldd->dialog, "%s",
gnc_info_dialog( ldd->dialog, "%s",
_("Please select a valid "
"Escrow Account.") );
return TRUE;
}
} else {
ldd->ld.escrowAcct = NULL;
}
@ -1312,21 +1311,21 @@ ld_rep_save( LoanDruidData *ldd )
ldd->ld.repFromAcct =
gnc_account_sel_get_account( ldd->repAssetsFromGAS );
if ( ldd->ld.repFromAcct == NULL ) {
gnc_info_dialog( ldd->dialog, "%s",
gnc_info_dialog( ldd->dialog, "%s",
_("Please select a valid \"from\" account."));
return TRUE;
}
ldd->ld.repPriAcct =
gnc_account_sel_get_account( ldd->repPrincToGAS );
if ( ldd->ld.repPriAcct == NULL ) {
gnc_info_dialog( ldd->dialog, "%s",
gnc_info_dialog( ldd->dialog, "%s",
_("Please select a valid \"to\" account.") );
return TRUE;
}
ldd->ld.repIntAcct =
gnc_account_sel_get_account( ldd->repIntToGAS );
if ( ldd->ld.repIntAcct == NULL ) {
gnc_info_dialog( ldd->dialog, "%s",
gnc_info_dialog( ldd->dialog, "%s",
_("Please select a valid "
"\"interest\" account.") );
return TRUE;
@ -1531,7 +1530,7 @@ ld_pay_save_current( LoanDruidData *ldd )
if ( rod->specSrcAcctP ) {
rod->from = gnc_account_sel_get_account( ldd->payAcctFromGAS );
if ( rod->from == NULL ) {
gnc_info_dialog( ldd->dialog, "%s",
gnc_info_dialog( ldd->dialog, "%s",
_("Please select a valid "
"\"from\" account.") );
return TRUE;
@ -1540,12 +1539,12 @@ ld_pay_save_current( LoanDruidData *ldd )
rod->to = gnc_account_sel_get_account( ldd->payAcctToGAS );
if ( rod->to == NULL ) {
gnc_info_dialog( ldd->dialog, "%s",
gnc_info_dialog( ldd->dialog, "%s",
_("Please select a valid "
"\"to\" account.") );
return TRUE;
}
/* if ( rb toggled )
* ensure schedule/startdate setup
* save
@ -1651,7 +1650,7 @@ ld_pay_freq_toggle( GtkToggleButton *tb, gpointer ud )
g_assert( ldd->currentIdx >= 0 );
g_assert( ldd->currentIdx <= ldd->ld.repayOptCount );
uniq = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(ldd->payTxnFreqUniqRb) );
gtk_widget_set_sensitive( GTK_WIDGET(ldd->payFreqAlign), uniq );
@ -2039,12 +2038,12 @@ ld_setup_repayment_sx( LoanDruidData *ldd,
* c1: ( toTTI = tcSX.escrow )
* if ( rep->from ) {
* a1: (fromSplit = NULL) paymentSX.main.splits += split( rep->fromAcct, repAmt )
* b:
* b:
* tcSX.escrow.split( rep->escrow ).debCred += repAmt
* c1:
* } else {
* a2: (fromSplit = paymentSX.main.split( ldd->ld.repFromAcct )) .debcred += -repAmt
* b:
* b:
* tcSX.escrow.splits += split( rep->escrow, -repAmt )
* c1:
* }
@ -2052,10 +2051,10 @@ ld_setup_repayment_sx( LoanDruidData *ldd,
* c2: ( toTTI = paymentSX.main )
* if ( rep->from ) {
* a1: (fromSplit = NULL) paymentSX.main.splits += split( rep->fromAcct, -repAmt )
* c2:
* c2:
* } else {
* a2: (fromSplit = paymentSX.main.split( ldd->ld.payFromAcct )).debcred += -repAmt
* c2:
* c2:
* }
* }
* if ( fromSplit ) {
@ -2105,7 +2104,7 @@ ld_setup_repayment_sx( LoanDruidData *ldd,
gstr = NULL;
ttsi = NULL;
}
if ( rod->from != NULL ) {
gchar *str;
@ -2206,7 +2205,7 @@ ld_setup_repayment_sx( LoanDruidData *ldd,
ttsi = NULL;
tti = NULL;
}
/* Add to-account split. */
{
ttsi = gnc_ttsplitinfo_malloc();
@ -2275,7 +2274,7 @@ ld_create_sxes( LoanDruidData *ldd )
? _("Payment")
: _("Escrow Payment") )
);
gnc_ttinfo_set_description( paymentSX->mainTxn,
payMainTxnDesc->str );
g_string_free( payMainTxnDesc, TRUE );
@ -2295,7 +2294,7 @@ ld_create_sxes( LoanDruidData *ldd )
* ttxn.splits += split( escrow, -pmt)
* ttxn.splits += split( liability, ppmt )
* ttxn.splits += split( expenses:interest, ipmt ) */
{
Account *srcAcct;
@ -2443,7 +2442,7 @@ ld_create_sxes( LoanDruidData *ldd )
gnc_default_currency() );
gnc_ttinfo_set_description( tcSX->escrowTxn,
gstr->str );
g_string_free( gstr, TRUE );
gstr = NULL;
@ -2583,7 +2582,7 @@ ld_rev_get_dates( LoanDruidData *ldd, GDate *start, GDate *end )
PERR( "Unknown review date range option %d", range );
break;
}
}
static
@ -2643,7 +2642,7 @@ ld_rev_recalc_schedule( LoanDruidData *ldd )
GString *pmtFormula, *ppmtFormula, *ipmtFormula;
int i;
GHashTable *ivar;
pmtFormula = g_string_sized_new( 64 );
ld_get_pmt_formula( ldd, pmtFormula );
ppmtFormula = g_string_sized_new( 64 );
@ -2685,7 +2684,7 @@ ld_rev_recalc_schedule( LoanDruidData *ldd )
(gpointer)dateKeyCopy,
(gpointer)rowNumData );
}
/* evaluate the expressions given the correct
* sequence number i */
ival = gnc_numeric_create( i, 1 );
@ -2770,7 +2769,7 @@ ld_rev_recalc_schedule( LoanDruidData *ldd )
(gpointer)dateKeyCopy,
(gpointer)rowNumData );
}
val = double_to_gnc_numeric( (double)ldd->ld
.repayOpts[i]
->amount,

View File

@ -1,4 +1,4 @@
/*
/*
* gnc-plugin-page-sx-list.c
*
* Copyright (C) 2006 Josh Sled <jsled@asynchronous.org>
@ -43,7 +43,6 @@
#include <gtk/gtk.h>
#include <glib.h>
#include <glib/gi18n.h>
#include "glib-compat.h"
#include <glade/glade-xml.h>
#include "SX-book.h"
#include "Split.h"
@ -144,7 +143,7 @@ gnc_plugin_page_sx_list_get_type (void)
0,
(GInstanceInitFunc) gnc_plugin_page_sx_list_init
};
gnc_plugin_page_sx_list_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
GNC_PLUGIN_PAGE_SX_LIST_NAME,
&our_info, 0);
@ -223,12 +222,12 @@ gnc_plugin_page_sx_list_dispose(GObject *object)
g_return_if_fail(!priv->disposed);
priv->disposed = TRUE;
g_object_unref(G_OBJECT(priv->dense_cal_model));
priv->dense_cal_model = NULL;
gtk_widget_unref(GTK_WIDGET(priv->gdcal));
priv->gdcal = NULL;
g_object_unref(G_OBJECT(priv->instances));
g_object_unref(G_OBJECT(priv->instances));
priv->instances = NULL;
G_OBJECT_CLASS (parent_class)->dispose(object);
@ -373,7 +372,7 @@ gnc_plugin_page_sx_list_create_widget (GncPluginPage *plugin_page)
gnc_plugin_page_sx_list_refresh_cb,
gnc_plugin_page_sx_list_close_cb,
page);
return priv->widget;
}
@ -486,7 +485,7 @@ gnc_plugin_page_sx_list_cmd_new(GtkAction *action, GncPluginPageSxList *page)
GDate now;
Recurrence *r = g_new0(Recurrence, 1);
GList *schedule;
g_date_clear(&now, 1);
g_date_set_time_t(&now, time(NULL));
recurrenceSet(r, 1, PERIOD_MONTH, &now, WEEKEND_ADJ_NONE);

View File

@ -24,7 +24,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include "glib-compat.h"
#include "Scrub.h"
#include "Scrub3.h"
@ -62,9 +61,9 @@ struct _AutoClearWindow
/********************************************************************\
* gnc_ui_autoclear_window_raise *
* shows and raises an auto-clear window *
* *
* Args: autoClearData - the auto-clear window structure *
* shows and raises an auto-clear window *
* *
* Args: autoClearData - the auto-clear window structure *
\********************************************************************/
void
gnc_ui_autoclear_window_raise(AutoClearWindow * autoClearData)
@ -114,9 +113,9 @@ gnc_autoclear_window_ok_cb (GtkWidget *widget,
GList *node, *nc_list = 0, *toclear_list = 0;
gnc_numeric toclear_value;
GHashTable *sack;
gtk_label_set_text(data->status_label, "Searching for splits to clear ...");
/* Value we have to reach */
toclear_value = gnc_amount_edit_get_amount(data->end_value);
toclear_value = gnc_numeric_convert(toclear_value, xaccAccountGetCommoditySCU(data->account), GNC_RND_NEVER);
@ -136,7 +135,7 @@ gnc_autoclear_window_ok_cb (GtkWidget *widget,
else
toclear_value = gnc_numeric_sub_fixed(toclear_value, value);
}
/* Pretty print information */
printf("Amount to clear: %s\n", gnc_numeric_to_string(toclear_value));
printf("Available splits:\n");
@ -215,10 +214,10 @@ gnc_autoclear_window_ok_cb (GtkWidget *widget,
/* Cast the gpointer to the kind of pointer we actually need */
Split *split = (Split *)psplit;
toclear_list = g_list_prepend(toclear_list, split);
toclear_value = gnc_numeric_sub_fixed(toclear_value,
toclear_value = gnc_numeric_sub_fixed(toclear_value,
xaccSplitGetAmount(split));
printf(" Cleared: %s -> %s\n",
gnc_numeric_to_string(xaccSplitGetAmount(split)),
printf(" Cleared: %s -> %s\n",
gnc_numeric_to_string(xaccSplitGetAmount(split)),
gnc_numeric_to_string(toclear_value));
}
else
@ -233,7 +232,7 @@ gnc_autoclear_window_ok_cb (GtkWidget *widget,
{
printf(" No solution found.\n");
gtk_label_set_text(data->status_label, "The selected amount cannot be cleared.");
return;
return;
}
}
g_hash_table_destroy (sack);
@ -245,7 +244,7 @@ gnc_autoclear_window_ok_cb (GtkWidget *widget,
Split *split = node->data;
char recn;
gnc_numeric value;
recn = xaccSplitGetReconcile (split);
value = xaccSplitGetAmount (split);
@ -290,7 +289,7 @@ autoClearWindow (GtkWidget *parent, Account *account)
AutoClearWindow *data;
char *title;
data = g_new0 (AutoClearWindow, 1);
data = g_new0 (AutoClearWindow, 1);
data->account = account;
/* Create the dialog box */
@ -316,7 +315,7 @@ autoClearWindow (GtkWidget *parent, Account *account)
data->ok_button = glade_xml_get_widget(xml, "ok_button");
data->cancel_button = glade_xml_get_widget(xml, "cancel_button");
data->status_label = GTK_LABEL(glade_xml_get_widget(xml, "status_label"));
g_signal_connect(data->ok_button, "clicked",
G_CALLBACK(gnc_autoclear_window_ok_cb), data);
g_signal_connect(data->end_value, "activate",

View File

@ -32,7 +32,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include "glib-compat.h"
#include "Scrub.h"
#include "Scrub3.h"
@ -606,7 +605,7 @@ gnc_save_reconcile_interval(Account *account, time_t statement_date)
(12 * prev.tm_year + prev.tm_mon));
days = 0;
}
/*
* Remember for next time.
*/
@ -758,7 +757,7 @@ startRecnWindow(GtkWidget *parent, Account *account,
/* Allow the user to enter an interest payment
* or charge prior to reconciling */
if( account_type_has_auto_interest_xfer( data.account_type )
if( account_type_has_auto_interest_xfer( data.account_type )
&& auto_interest_xfer_option )
{
gnc_reconcile_interest_xfer_run( &data );
@ -1136,12 +1135,12 @@ gnc_ui_reconcile_window_balance_cb(GtkButton *button, gpointer data)
Account *account;
gnc_numeric balancing_amount;
time_t statement_date;
gsr = gnc_reconcile_window_open_register(recnData);
if (gsr == NULL)
return;
account = recn_get_account(recnData);
if (account == NULL)
return;
@ -1153,7 +1152,7 @@ gnc_ui_reconcile_window_balance_cb(GtkButton *button, gpointer data)
statement_date = recnData->statement_date;
if (statement_date == 0)
statement_date = time(NULL); // default to 'now'
gnc_split_reg_balancing_entry(gsr, account, statement_date, balancing_amount);
}
@ -1233,7 +1232,7 @@ gnc_recn_set_window_name(RecnWindow *recnData)
g_free (title);
}
static void
static void
gnc_recn_edit_account_cb(GtkAction *action, gpointer data)
{
RecnWindow *recnData = data;
@ -1245,7 +1244,7 @@ gnc_recn_edit_account_cb(GtkAction *action, gpointer data)
gnc_ui_edit_account_window (account);
}
static void
static void
gnc_recn_xfer_cb(GtkAction *action, gpointer data)
{
RecnWindow *recnData = data;
@ -1353,7 +1352,7 @@ gnc_get_reconcile_info (Account *account,
g_date_add_months(&date, months);
/* Track last day of the month, i.e. 1/31 -> 2/28 -> 3/31 */
/* Track last day of the month, i.e. 1/31 -> 2/28 -> 3/31 */
if (was_last_day_of_month)
{
g_date_set_day(&date, g_date_get_days_in_month(g_date_get_month(&date),
@ -1383,7 +1382,7 @@ gnc_get_reconcile_info (Account *account,
*/
*new_ending =
gnc_ui_account_get_balance_as_of_date
(account, *statement_date,
(account, *statement_date,
xaccAccountGetReconcileChildrenStatus(account));
}
}
@ -1419,7 +1418,7 @@ recn_set_watches_one_account (gpointer data, gpointer user_data)
case NREC:
case CREC:
trans = xaccSplitGetParent (split);
gnc_gui_component_watch_entity (recnData->component_id,
xaccTransGetGUID (trans),
QOF_EVENT_MODIFY
@ -1545,19 +1544,19 @@ recnWindow_add_widget (GtkUIManager *merge,
}
/********************************************************************\
* recnWindowWithBalance
* recnWindowWithBalance
*
* Opens up the window to reconcile an account, but with ending
* balance and statement date already given.
*
*
* Args: parent - The parent widget of the new window
* account - The account to reconcile
* new_ending - The amount for ending balance
* statement_date - The date of the statement
* Return: recnData - the instance of this RecnWindow
* account - The account to reconcile
* new_ending - The amount for ending balance
* statement_date - The date of the statement
* Return: recnData - the instance of this RecnWindow
\********************************************************************/
RecnWindow *
recnWindowWithBalance (GtkWidget *parent, Account *account,
recnWindowWithBalance (GtkWidget *parent, Account *account,
gnc_numeric new_ending, time_t statement_date)
{
RecnWindow *recnData;
@ -1820,9 +1819,9 @@ recnWindowWithBalance (GtkWidget *parent, Account *account,
/********************************************************************\
* gnc_ui_reconile_window_raise *
* shows and raises an account editing window *
* *
* Args: editAccData - the edit window structure *
* shows and raises an account editing window *
* *
* Args: editAccData - the edit window structure *
\********************************************************************/
void
gnc_ui_reconcile_window_raise(RecnWindow * recnData)
@ -1846,7 +1845,7 @@ gnc_ui_reconcile_window_raise(RecnWindow * recnData)
* data - the data struct for this window *
* Return: none *
\********************************************************************/
static void
static void
recn_destroy_cb (GtkWidget *w, gpointer data)
{
RecnWindow *recnData = data;
@ -1979,7 +1978,7 @@ find_payment_account(Account *account)
* data - the data struct for this window *
* Return: none *
\********************************************************************/
static void
static void
recnFinishCB (GtkAction *action, RecnWindow *recnData)
{
gboolean auto_payment;
@ -2038,7 +2037,7 @@ recnFinishCB (GtkAction *action, RecnWindow *recnData)
* data - the data struct for this window *
* Return: none *
\********************************************************************/
static void
static void
recnPostponeCB (GtkAction *action, gpointer data)
{
RecnWindow *recnData = data;
@ -2066,7 +2065,7 @@ recnPostponeCB (GtkAction *action, gpointer data)
gnc_close_gui_component_by_data (WINDOW_RECONCILE_CM_CLASS, recnData);
}
static void
static void
recnCancelCB (GtkAction *action, gpointer data)
{
RecnWindow *recnData = data;
@ -2087,7 +2086,7 @@ static GtkActionEntry recnWindow_actions [] =
{ "HelpMenuAction", NULL, N_("_Help"), NULL, NULL, NULL, },
/* Reconcile menu */
{ "RecnChangeInfoAction", NULL, N_("_Reconcile Information..."), NULL,
N_("Change the reconcile information "
"including statement date and ending balance."),

View File

@ -27,9 +27,6 @@
#include <gnome.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#ifndef HAVE_GLIB_2_8
#include <gstdio-2.8.h>
#endif
#include <libguile.h>
#include <sys/time.h>
#include <unistd.h>