[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_9.0-24-g500bfbd
Pierre Biava
nobody at users.sourceforge.net
Sat Feb 26 21:44:03 CET 2011
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grisbi".
The branch, master has been updated
via 500bfbd5c92f475fe894f1c3ad60ce4ee3d39fd0 (commit)
via bcbfe13c072999c7a7267709aad5927e2a17ef42 (commit)
via 9649f0c6aa5ae951632de0b70cbe91e67fa46a7a (commit)
from 8bbe92686d7f4bb4f7c0ce07eae586a814646590 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 500bfbd5c92f475fe894f1c3ad60ce4ee3d39fd0
Author: pbiava <pierre.biava at nerim.net>
Date: Sat Feb 26 21:16:47 2011 +0100
fixes bug 1296
commit bcbfe13c072999c7a7267709aad5927e2a17ef42
Author: pbiava <pierre.biava at nerim.net>
Date: Sat Feb 26 20:35:39 2011 +0100
Changing the .gitignore file
commit 9649f0c6aa5ae951632de0b70cbe91e67fa46a7a
Author: pbiava <pierre.biava at nerim.net>
Date: Sat Feb 26 20:34:48 2011 +0100
Adding the XDG directories in the printed variables and fix memory leaks
-----------------------------------------------------------------------
Changes:
diff --git a/.gitignore b/.gitignore
index 93e52c6..06ebe93 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,3 +24,5 @@ TODO*
doxygen/
*.o
*.ho
+*~
+*.md5
diff --git a/src/erreur.c b/src/erreur.c
index 89d5173..8fed7bd 100644
--- a/src/erreur.c
+++ b/src/erreur.c
@@ -42,6 +42,7 @@
#include "gsb_real.h"
#include "gsb_status.h"
#include "import.h"
+#include "main.h"
#include "structures.h"
#include "traitement_variables.h"
#include "utils.h"
@@ -487,8 +488,8 @@ gboolean gsb_debug_start_log ( void )
if ( debug_file )
{
GtkWidget *widget;
- struct lconv *conv;
-
+ gchar *tmp_str_2;
+
widget = gtk_ui_manager_get_widget ( ui_manager, "/menubar/FileMenu/DebugMode" );
etat.debug_mode = TRUE;
@@ -509,23 +510,7 @@ gboolean gsb_debug_start_log ( void )
g_free ( tmp_str );
/* write locales */
- conv = localeconv();
- tmp_str = g_strdup_printf ( "Variables d'environnement :\n\n"
- "LANG = %s\n\n"
- "Currency\n"
- "\tcurrency_symbol = %s\n"
- "\tmon_thousands_sep = \"%s\"\n"
- "\tmon_decimal_point = %s\n"
- "\tpositive_sign = \"%s\"\n"
- "\tnegative_sign = \"%s\"\n"
- "\tfrac_digits = \"%d\"\n\n",
- g_getenv ( "LANG"),
- conv->currency_symbol,
- g_locale_to_utf8 ( conv->mon_thousands_sep, -1, NULL, NULL, NULL ),
- g_locale_to_utf8 ( conv->mon_decimal_point, -1, NULL, NULL, NULL ),
- g_locale_to_utf8 ( conv->positive_sign, -1, NULL, NULL, NULL ),
- g_locale_to_utf8 ( conv->negative_sign, -1, NULL, NULL, NULL ),
- conv->frac_digits );
+ tmp_str = gsb_main_get_print_locale_var ( );
fwrite ( tmp_str, sizeof (gchar), strlen ( tmp_str ), debug_file );
fflush ( debug_file );
@@ -542,25 +527,7 @@ gboolean gsb_debug_start_log ( void )
g_free ( tmp_str );
- tmp_str = g_strdup_printf ("Paths\n"
- "\tC_GRISBIRC = %s\n"
- "\tC_PATH_CONFIG = %s\n"
- "\tC_PATH_CONFIG_ACCELS = %s\n"
- "\tC_PATH_DATA_FILES = %s\n"
- "\tGRISBI_LOCALEDIR = %s\n"
- "\tGRISBI_PLUGINS_DIR = %s\n"
- "\tGRISBI_PIXMAPS_DIR = %s\n\n",
- C_GRISBIRC,
- C_PATH_CONFIG,
- C_PATH_CONFIG_ACCELS,
- C_PATH_DATA_FILES,
-#ifdef GTKOSXAPPLICATION
- grisbi_osx_get_locale_dir ( ),
-#else
- LOCALEDIR,
-#endif
- GRISBI_PLUGINS_DIR,
- GRISBI_PIXMAPS_DIR );
+ tmp_str = gsb_main_get_print_dir_var ( );
fwrite ( tmp_str, sizeof (gchar), strlen ( tmp_str ), debug_file );
fflush ( debug_file );
@@ -574,11 +541,13 @@ gboolean gsb_debug_start_log ( void )
g_free ( tmp_str );
tmp_str = gsb_import_formats_get_list_formats_to_string ( );
+ tmp_str_2 = g_strconcat ( tmp_str, "\n", NULL );
- fwrite ( tmp_str, sizeof (gchar), strlen ( tmp_str ), debug_file );
+ fwrite ( tmp_str_2, sizeof (gchar), strlen ( tmp_str_2 ), debug_file );
fflush ( debug_file );
g_free ( tmp_str );
+ g_free ( tmp_str_2 );
}
else
dialogue_error (_("Grisbi failed to create the log file...") );
diff --git a/src/gsb_form.c b/src/gsb_form.c
index 62d185b..f12dcdb 100644
--- a/src/gsb_form.c
+++ b/src/gsb_form.c
@@ -1727,33 +1727,40 @@ gboolean gsb_form_entry_lose_focus ( GtkWidget *entry,
case TRANSACTION_FORM_CATEGORY :
if ( strlen ( gtk_entry_get_text ( GTK_ENTRY (entry))))
{
- /* if it's a transfer, set the content of the contra combo */
- if ( gsb_data_form_check_for_value ( TRANSACTION_FORM_CONTRA ))
- {
- /* if it's a transfer, set the contra_method of payment menu */
- gint contra_account_number;
+ /* if it's a transfer, set the content of the contra combo */
+ if ( gsb_data_form_check_for_value ( TRANSACTION_FORM_CONTRA ) )
+ {
+ /* if it's a transfer, set the contra_method of payment menu */
+ gint contra_account_number;
- if ( (contra_account_number = gsb_form_check_for_transfer ( gtk_entry_get_text ( GTK_ENTRY (entry)))) >= 0
- &&
- contra_account_number != account_number )
- {
- if ( gsb_form_widget_check_empty (gsb_form_widget_get_widget (TRANSACTION_FORM_CREDIT)))
- /* there is something in debit */
- gsb_payment_method_create_combo_list ( gsb_form_widget_get_widget (TRANSACTION_FORM_CONTRA),
- GSB_PAYMENT_CREDIT,
- contra_account_number, 0, TRUE );
- else
- /* there is something in credit */
- gsb_payment_method_create_combo_list ( gsb_form_widget_get_widget (TRANSACTION_FORM_CONTRA),
- GSB_PAYMENT_DEBIT,
- contra_account_number, 0, TRUE );
- }
- else
- gtk_widget_hide ( gsb_form_widget_get_widget (TRANSACTION_FORM_CONTRA));
- }
+ contra_account_number = gsb_form_check_for_transfer ( gtk_entry_get_text (
+ GTK_ENTRY ( entry ) ) );
+ if ( contra_account_number >= 0 && contra_account_number != account_number )
+ {
+ if ( gsb_form_widget_check_empty ( gsb_form_widget_get_widget ( TRANSACTION_FORM_CREDIT ) ) )
+ /* there is something in debit */
+ gsb_payment_method_create_combo_list (
+ gsb_form_widget_get_widget ( TRANSACTION_FORM_CONTRA ),
+ GSB_PAYMENT_CREDIT,
+ contra_account_number, 0, TRUE );
+ else
+ /* there is something in credit */
+ gsb_payment_method_create_combo_list (
+ gsb_form_widget_get_widget ( TRANSACTION_FORM_CONTRA ),
+ GSB_PAYMENT_DEBIT,
+ contra_account_number, 0, TRUE );
+ }
+ else
+ gtk_widget_hide ( gsb_form_widget_get_widget (TRANSACTION_FORM_CONTRA));
+ }
+ if ( strcmp ( gtk_entry_get_text ( GTK_ENTRY ( entry ) ), _("Split of transaction") )
+ && gtk_widget_get_visible ( form_button_recover_split ) )
+ {
+ gtk_widget_hide ( form_button_recover_split );
+ }
}
else
- string = gsb_form_widget_get_name (TRANSACTION_FORM_CATEGORY);
+ string = gsb_form_widget_get_name (TRANSACTION_FORM_CATEGORY);
break;
case TRANSACTION_FORM_CHEQUE :
diff --git a/src/main.c b/src/main.c
index d098bec..838aba9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -32,6 +32,7 @@
#include "include.h"
#include <stdlib.h>
#include <glib/gi18n.h>
+#include <glib/gprintf.h>
/*START_INCLUDE*/
#include "main.h"
@@ -93,6 +94,7 @@ static gboolean gsb_grisbi_init_app ( void );
static void gsb_grisbi_load_file_if_necessary ( cmdline_options *opt );
static gboolean gsb_grisbi_print_environment_var ( void );
static void gsb_grisbi_trappe_signal_sigsegv ( void );
+static void gsb_main_free_global_definitions ( void );
static void main_mac_osx ( int argc, char **argv );
static void main_linux ( int argc, char **argv );
static void main_win_32 ( int argc, char **argv );
@@ -397,51 +399,24 @@ void main_win_32 ( int argc, char **argv )
* */
gboolean gsb_grisbi_print_environment_var ( void )
{
- struct lconv *conv;
+ gchar *tmp_str;
- /* test local pour les nombres */
- conv = localeconv();
-
- printf ("Variables d'environnement :\n\n" );
- printf ("LANG = %s\n\n"
- "Currency\n"
- "\tcurrency_symbol = %s\n"
- "\tmon_thousands_sep = \"%s\"\n"
- "\tmon_decimal_point = %s\n"
- "\tpositive_sign = \"%s\"\n"
- "\tnegative_sign = \"%s\"\n"
- "\tfrac_digits = \"%d\"\n\n",
- g_getenv ( "LANG"),
- conv->currency_symbol,
- g_locale_to_utf8 ( conv->mon_thousands_sep, -1, NULL, NULL, NULL ),
- g_locale_to_utf8 ( conv->mon_decimal_point, -1, NULL, NULL, NULL ),
- g_locale_to_utf8 ( conv->positive_sign, -1, NULL, NULL, NULL ),
- g_locale_to_utf8 ( conv->negative_sign, -1, NULL, NULL, NULL ),
- conv->frac_digits );
-
- printf ("gint64\n" );
- printf ("\tG_GINT64_MODIFIER = \"%s\"\n", G_GINT64_MODIFIER );
- printf ("\t%"G_GINT64_MODIFIER"d\n\n", G_MAXINT64 );
-
- printf ("Paths\n"
- "\tC_GRISBIRC = %s\n"
- "\tC_PATH_CONFIG = %s\n"
- "\tC_PATH_CONFIG_ACCELS = %s\n"
- "\tC_PATH_DATA_FILES = %s\n"
- "\tGRISBI_LOCALEDIR = %s\n"
- "\tGRISBI_PLUGINS_DIR = %s\n"
- "\tGRISBI_PIXMAPS_DIR = %s\n\n",
- C_GRISBIRC,
- C_PATH_CONFIG,
- C_PATH_CONFIG_ACCELS,
- C_PATH_DATA_FILES,
-#ifdef GTKOSXAPPLICATION
- grisbi_osx_get_locale_dir ( ),
-#else
- LOCALEDIR,
-#endif
- GRISBI_PLUGINS_DIR,
- GRISBI_PIXMAPS_DIR );
+ g_printf ("Variables d'environnement :\n\n" );
+
+ tmp_str = gsb_main_get_print_locale_var ( );
+ g_printf ("%s", tmp_str);
+
+ g_free ( tmp_str );
+
+ g_printf ( "gint64\n\tG_GINT64_MODIFIER = \"%s\"\n"
+ "\t%"G_GINT64_MODIFIER"d\n\n",
+ G_GINT64_MODIFIER,
+ G_MAXINT64 );
+
+ tmp_str = gsb_main_get_print_dir_var ( );
+ g_printf ("%s", tmp_str);
+
+ g_free ( tmp_str );
return FALSE;
}
@@ -696,6 +671,9 @@ gboolean gsb_grisbi_close ( void )
if (etat.debug_mode && debug_file)
fclose (debug_file);
+ /* clean the initial vars */
+ gsb_main_free_global_definitions ( );
+
return FALSE;
}
@@ -802,6 +780,110 @@ gboolean gsb_main_set_grisbi_title ( gint account_number )
}
+/**
+ *
+ * \return must be freed
+ *
+ */
+gchar *gsb_main_get_print_locale_var ( void )
+{
+ struct lconv *conv;
+ gchar *locale_str = NULL;
+ gchar *mon_thousands_sep;
+ gchar *mon_decimal_point;
+ gchar *positive_sign;
+ gchar *negative_sign;
+
+ /* test local pour les nombres */
+ conv = localeconv();
+
+ mon_thousands_sep = g_locale_to_utf8 ( conv->mon_thousands_sep, -1, NULL, NULL, NULL );
+ mon_decimal_point = g_locale_to_utf8 ( conv->mon_decimal_point, -1, NULL, NULL, NULL );
+ positive_sign = g_locale_to_utf8 ( conv->positive_sign, -1, NULL, NULL, NULL );
+ negative_sign = g_locale_to_utf8 ( conv->negative_sign, -1, NULL, NULL, NULL );
+
+ locale_str = g_strdup_printf ( "LANG = %s\n\n"
+ "Currency\n"
+ "\tcurrency_symbol = %s\n"
+ "\tmon_thousands_sep = \"%s\"\n"
+ "\tmon_decimal_point = %s\n"
+ "\tpositive_sign = \"%s\"\n"
+ "\tnegative_sign = \"%s\"\n"
+ "\tfrac_digits = \"%d\"\n\n",
+ g_getenv ( "LANG"),
+ conv->currency_symbol,
+ mon_thousands_sep,
+ mon_decimal_point,
+ positive_sign,
+ negative_sign,
+ conv->frac_digits );
+
+ g_free ( mon_thousands_sep );
+ g_free ( mon_decimal_point );
+ g_free ( positive_sign );
+ g_free ( negative_sign );
+
+ return locale_str;
+}
+
+
+/**
+ *
+ * \return must be freed
+ *
+ */
+gchar *gsb_main_get_print_dir_var ( void )
+{
+ gchar *path_str = NULL;
+ gchar *tmp_str = NULL;
+
+#ifdef GTKOSXAPPLICATION
+ tmp_str = grisbi_osx_get_locale_dir ( );
+#else
+ tmp_str = g_strdup ( LOCALEDIR );
+#endif
+
+ path_str = g_strdup_printf ( "Paths\n"
+ "\tXDG_DATA_HOME = %s\n"
+ "\tXDG_CONFIG_HOME = %s\n\n"
+ "\tC_GRISBIRC = %s\n"
+ "\tC_PATH_CONFIG = %s\n"
+ "\tC_PATH_CONFIG_ACCELS = %s\n"
+ "\tC_PATH_DATA_FILES = %s\n\n"
+ "\tGRISBI_LOCALEDIR = %s\n"
+ "\tGRISBI_PLUGINS_DIR = %s\n"
+ "\tGRISBI_PIXMAPS_DIR = %s\n\n",
+ g_get_user_data_dir ( ),
+ g_get_user_config_dir ( ),
+ C_GRISBIRC,
+ C_PATH_CONFIG,
+ C_PATH_CONFIG_ACCELS,
+ C_PATH_DATA_FILES,
+ tmp_str,
+ GRISBI_PLUGINS_DIR,
+ GRISBI_PIXMAPS_DIR );
+
+ g_free ( tmp_str );
+
+ return path_str;
+}
+
+
+/**
+ * libère la mémoire des définitions globales
+ *
+ *
+ */
+void gsb_main_free_global_definitions ( void )
+{
+ g_free ( C_GRISBIRC );
+ g_free ( C_OLD_GRISBIRC );
+ g_free ( C_PATH_CONFIG );
+ g_free ( C_PATH_CONFIG_ACCELS );
+ g_free ( C_PATH_DATA_FILES );
+}
+
+
/* Local Variables: */
/* c-basic-offset: 4 */
/* End: */
diff --git a/src/main.h b/src/main.h
index 2e817bd..fee8b38 100644
--- a/src/main.h
+++ b/src/main.h
@@ -9,6 +9,8 @@
/* START_DECLARATION */
gboolean gsb_grisbi_close ( void );
int main (int argc, char **argv);
+gchar *gsb_main_get_print_locale_var ( void );
+gchar *gsb_main_get_print_dir_var ( void );
gboolean gsb_main_set_grisbi_title ( gint account_number );
/* END_DECLARATION */
#endif
hooks/post-receive
--
grisbi
More information about the cvs
mailing list