[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_7_99-35-gdc55391

Pierre Biava nobody at users.sourceforge.net
Sat Feb 5 21:51:26 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  dc55391c60aab3140cde4178a51dde8fcdd21e99 (commit)
      from  b676c61981c63c6d4b8b42b2ac1a6df7cd345589 (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 dc55391c60aab3140cde4178a51dde8fcdd21e99
Author: pbiava <pierre.biava at nerim.net>
Date:   Sat Feb 5 21:50:03 2011 +0100

    fixes an initialization bug historical data and minor changes

-----------------------------------------------------------------------

Changes:
diff --git a/src/bet_config.c b/src/bet_config.c
index 436ce57..db00239 100644
--- a/src/bet_config.c
+++ b/src/bet_config.c
@@ -21,10 +21,7 @@
 /*                                                                            */
 /* ************************************************************************** */
 
-/* ./configure --with-balance-estimate */
-
 #include "include.h"
-#include <config.h>
 
 /*START_INCLUDE*/
 #include "bet_config.h"
diff --git a/src/bet_data.c b/src/bet_data.c
index a9316f5..99d9dbc 100644
--- a/src/bet_data.c
+++ b/src/bet_data.c
@@ -21,10 +21,7 @@
 /*                                                                            */
 /* ************************************************************************** */
 
-/* ./configure --with-balance-estimate */
-
 #include "include.h"
-#include <config.h>
 
 /*START_INCLUDE*/
 #include "bet_data.h"
@@ -257,7 +254,7 @@ gboolean bet_data_init_variables ( void )
  *
  *
  * */
-gboolean bet_data_hist_add_div ( gint account_nb,
+gboolean bet_data_hist_add_div ( gint account_number,
                         gint div_number,
                         gint sub_div_nb )
 {
@@ -265,10 +262,10 @@ gboolean bet_data_hist_add_div ( gint account_nb,
     gchar *sub_key;
     struct_hist_div *shd;
 
-    if ( account_nb == 0 )
+    if ( account_number == 0 )
         key = g_strconcat ("0:", utils_str_itoa ( div_number ), NULL );
     else
-        key = g_strconcat ( utils_str_itoa ( account_nb ), ":",
+        key = g_strconcat ( utils_str_itoa ( account_number ), ":",
                         utils_str_itoa ( div_number ), NULL );
 
     if ( ( shd = g_hash_table_lookup ( bet_hist_div_list, key ) ) )
@@ -307,7 +304,8 @@ gboolean bet_data_hist_add_div ( gint account_nb,
             dialogue_error_memory ( );
             return 0;
         }
-        shd -> account_nb = account_nb;
+        shd -> account_nb = account_number;
+        shd -> origin = gsb_data_account_get_bet_hist_data ( account_number );
         shd -> div_number = div_number;
         if ( sub_div_nb > 0 )
         {
@@ -377,16 +375,16 @@ void bet_data_insert_div_hist ( struct_hist_div *shd, struct_hist_div *sub_shd )
  *
  *
  * */
-gboolean bet_data_remove_div_hist ( gint account_nb, gint div_number, gint sub_div_nb )
+gboolean bet_data_remove_div_hist ( gint account_number, gint div_number, gint sub_div_nb )
 {
     gchar *key;
     char *sub_key;
     struct_hist_div *shd;
     
-    if ( account_nb == 0 )
+    if ( account_number == 0 )
         key = g_strconcat ("0:", utils_str_itoa ( div_number ), NULL );
     else
-        key = g_strconcat ( utils_str_itoa ( account_nb ), ":",
+        key = g_strconcat ( utils_str_itoa ( account_number ), ":",
                         utils_str_itoa ( div_number ), NULL );
 
     if ( ( shd = g_hash_table_lookup ( bet_hist_div_list, key ) ) )
@@ -412,19 +410,23 @@ gboolean bet_data_remove_div_hist ( gint account_nb, gint div_number, gint sub_d
  *
  *
  * */
-gboolean bet_data_search_div_hist ( gint account_nb, gint div_number, gint sub_div_nb )
+gboolean bet_data_search_div_hist ( gint account_number, gint div_number, gint sub_div_nb )
 {
     gchar *key;
     gchar *sub_key;
+    gint origin;
     struct_hist_div *shd;
 
-    if ( account_nb == 0 )
+    if ( account_number == 0 )
         key = g_strconcat ("0:", utils_str_itoa ( div_number ), NULL );
     else
-        key = g_strconcat ( utils_str_itoa ( account_nb ), ":",
+        key = g_strconcat ( utils_str_itoa ( account_number ), ":",
                         utils_str_itoa ( div_number ), NULL );
 
-    if ( ( shd = g_hash_table_lookup ( bet_hist_div_list, key ) ) )
+    origin = gsb_data_account_get_bet_hist_data ( account_number );
+
+    if ( ( shd = g_hash_table_lookup ( bet_hist_div_list, key ) )
+     && shd -> origin == origin )
     {
         if ( sub_div_nb == 0 )
         {
@@ -530,19 +532,23 @@ gchar *bet_data_get_div_name ( gint div_num,
  *
  *
  * */
-gboolean bet_data_get_div_edited ( gint account_nb, gint div_number, gint sub_div_nb )
+gboolean bet_data_get_div_edited ( gint account_number, gint div_number, gint sub_div_nb )
 {
     gchar *key;
+    gint origin;
     struct_hist_div *shd;
     gboolean edited;
 
-    if ( account_nb == 0 )
+    if ( account_number == 0 )
         key = g_strconcat ("0:", utils_str_itoa ( div_number ), NULL );
     else
-        key = g_strconcat ( utils_str_itoa ( account_nb ), ":",
+        key = g_strconcat ( utils_str_itoa ( account_number ), ":",
                         utils_str_itoa ( div_number ), NULL );
 
-    if ( ( shd = g_hash_table_lookup ( bet_hist_div_list, key ) ) )
+    origin = gsb_data_account_get_bet_hist_data ( account_number );
+
+    if ( ( shd = g_hash_table_lookup ( bet_hist_div_list, key ) )
+     && shd -> origin == origin )
     {
         if ( sub_div_nb == 0 )
             edited = shd -> div_edited;
@@ -831,10 +837,11 @@ GPtrArray *bet_data_get_strings_to_save ( void )
         if ( g_hash_table_size ( shd -> sub_div_list ) == 0 )
         {
             tmp_str = g_markup_printf_escaped ( "\t<Bet_historical Nb=\"%d\" Ac=\"%d\" "
-                        "Div=\"%d\" Edit=\"%d\" Damount=\"%s\" SDiv=\"%d\" "
+                        "Ori=\"%d\"Div=\"%d\" Edit=\"%d\" Damount=\"%s\" SDiv=\"%d\" "
                         "SEdit=\"%d\" SDamount=\"%s\" />\n",
                         tab -> len + 1,
                         shd -> account_nb,
+                        shd -> origin,
                         shd -> div_number,
                         shd -> div_edited,
                         gsb_real_safe_real_to_string ( shd -> amount,
@@ -855,10 +862,11 @@ GPtrArray *bet_data_get_strings_to_save ( void )
 
                 floating_point = gsb_data_account_get_currency_floating_point ( shd -> account_nb );
                 tmp_str = g_markup_printf_escaped ( "\t<Bet_historical Nb=\"%d\" Ac=\"%d\" "
-                        "Div=\"%d\" Edit=\"%d\" Damount=\"%s\" SDiv=\"%d\" "
+                        "Ori=\"%d\" Div=\"%d\" Edit=\"%d\" Damount=\"%s\" SDiv=\"%d\" "
                         "SEdit=\"%d\" SDamount=\"%s\" />\n",
                         tab -> len + 1,
                         shd -> account_nb,
+                        shd -> origin,
                         shd -> div_number,
                         shd -> div_edited,
                         gsb_real_safe_real_to_string ( shd -> amount, floating_point ),
diff --git a/src/bet_data.h b/src/bet_data.h
index 41ad654..b0d652b 100644
--- a/src/bet_data.h
+++ b/src/bet_data.h
@@ -39,6 +39,7 @@ struct _hist_div
 {
     gint account_nb;
     gint div_number;
+    gint origin;
     gboolean div_edited;
     GHashTable *sub_div_list;
     gsb_real amount;
@@ -98,7 +99,7 @@ gboolean bet_data_future_remove_lines ( gint account_number,
                         gint number,
                         gint mother_row );
 gboolean bet_data_future_set_lines_from_file ( struct_futur_data *scheduled );
-gboolean bet_data_get_div_edited ( gint account_nb, gint div_number, gint sub_div_nb );
+gboolean bet_data_get_div_edited ( gint account_number, gint div_number, gint sub_div_nb );
 gchar *bet_data_get_div_name ( gint div_num,
                         gint sub_div,
                         const gchar *return_value_error );
@@ -107,7 +108,7 @@ gint bet_data_get_div_type ( gint div_number );
 gint bet_data_get_selected_currency ( void );
 GPtrArray *bet_data_get_strings_to_save ( void );
 gint bet_data_get_sub_div_nb ( gint transaction_number, gboolean is_transaction );
-gboolean bet_data_hist_add_div ( gint account_nb,
+gboolean bet_data_hist_add_div ( gint account_number,
                         gint div_number,
                         gint sub_div_nb );
 gsb_real bet_data_hist_get_div_amount ( gint account_nb, gint div_number, gint sub_div_nb );
@@ -118,8 +119,8 @@ gboolean bet_data_populate_div ( gint transaction_number,
                         GHashTable  *list_div,
                         gint type_de_transaction );
 gboolean bet_data_remove_all_bet_data ( gint account_number );
-gboolean bet_data_remove_div_hist ( gint account_nb, gint div_number, gint sub_div_nb );
-gboolean bet_data_search_div_hist ( gint account_nb, gint div_number, gint sub_div_nb );
+gboolean bet_data_remove_div_hist ( gint account_number, gint div_number, gint sub_div_nb );
+gboolean bet_data_search_div_hist ( gint account_number, gint div_number, gint sub_div_nb );
 void bet_data_select_bet_pages ( gint account_number );
 gboolean bet_data_set_div_amount ( gint account_nb,
                         gint div_number,
diff --git a/src/bet_data_finance.c b/src/bet_data_finance.c
index e006fe9..aeabebf 100644
--- a/src/bet_data_finance.c
+++ b/src/bet_data_finance.c
@@ -20,7 +20,6 @@
 /* ************************************************************************** */
 
 #include "include.h"
-#include <config.h>
 
 /*START_INCLUDE*/
 #include "bet_data_finance.h"
diff --git a/src/bet_finance_ui.c b/src/bet_finance_ui.c
index 7756063..8577497 100644
--- a/src/bet_finance_ui.c
+++ b/src/bet_finance_ui.c
@@ -1,6 +1,6 @@
 /* ************************************************************************** */
 /*                                                                            */
-/*     Copyright (C) 2010 Pierre Biava (grisbi at pierre.biava.name)             */
+/*     Copyright (C) 2010-2011 Pierre Biava (grisbi at pierre.biava.name)        */
 /*          http://www.grisbi.org                                             */
 /*                                                                            */
 /*  This program is free software; you can redistribute it and/or modify      */
@@ -20,7 +20,6 @@
 /* ************************************************************************** */
 
 #include "include.h"
-#include <config.h>
 
 /*START_INCLUDE*/
 #include "bet_finance_ui.h"
diff --git a/src/bet_future.c b/src/bet_future.c
index aef1487..01f395d 100644
--- a/src/bet_future.c
+++ b/src/bet_future.c
@@ -2,7 +2,7 @@
 /*                                                                            */
 /*     Copyright (C) 2007 Dominique Parisot                                   */
 /*          zionly at free.org                                                   */
-/*          2008-2010 Pierre Biava (grisbi at pierre.biava.name)                 */
+/*          2008-2011 Pierre Biava (grisbi at pierre.biava.name)                 */
 /*          http://www.grisbi.org                                             */
 /*                                                                            */
 /*  This program is free software; you can redistribute it and/or modify      */
@@ -24,7 +24,6 @@
 /* ./configure --with-balance-estimate */
 
 #include "include.h"
-#include <config.h>
 
 /*START_INCLUDE*/
 #include "bet_future.h"
diff --git a/src/bet_hist.c b/src/bet_hist.c
index 57705f5..76b78ae 100644
--- a/src/bet_hist.c
+++ b/src/bet_hist.c
@@ -2,7 +2,7 @@
 /*                                                                            */
 /*     Copyright (C) 2007 Dominique Parisot                                   */
 /*          zionly at free.org                                                   */
-/*          2008-2010 Pierre Biava (grisbi at pierre.biava.name)                 */
+/*          2008-2011 Pierre Biava (grisbi at pierre.biava.name)                 */
 /*          http://www.grisbi.org                                             */
 /*                                                                            */
 /*  This program is free software; you can redistribute it and/or modify      */
@@ -21,10 +21,7 @@
 /*                                                                            */
 /* ************************************************************************** */
 
-/* ./configure --with-balance-estimate */
-
 #include "include.h"
-#include <config.h>
 
 /*START_INCLUDE*/
 #include "bet_hist.h"
@@ -861,7 +858,7 @@ void bet_historical_populate_div_model ( gpointer key,
                         -1);
         g_free ( str_retained );
     }
-
+/* printf ("division = %d div_name = %s\n", div_number, div_name);  */
     g_free ( div_name );
     g_free ( str_average );
     g_free ( str_amount );
@@ -882,15 +879,13 @@ void bet_historical_populate_div_model ( gpointer key,
             return;
 
         div_name = bet_data_get_div_name ( div_number, sub_sh -> div, NULL );
-        /* printf ("division = %d sub_div = %d div_name = %s\n",
-                        div_number, sub_sh -> div, div_name); */
+/*         printf ("division = %d sub_div = %d div_name = %s\n", div_number, sub_sh -> div, div_name);  */
         if ( div_name && g_utf8_strrchr ( div_name, -1, ':' ) )
         {
 	        tab_str = g_strsplit ( div_name, ":", 2 );
             if ( g_strv_length ( tab_str ) > 1 )
             {
-                if ( div_name )
-                    g_free ( div_name );
+                g_free ( div_name );
                 div_name = g_strdup ( g_strstrip ( tab_str[1] ) );
             }
             if ( tab_str )
@@ -924,6 +919,8 @@ void bet_historical_populate_div_model ( gpointer key,
 
         if ( bet_data_search_div_hist ( account_nb, div_number, sub_sh -> div ) )
         {
+            GtkTreePath *path;
+
             if ( bet_data_get_div_edited ( account_nb, div_number, sub_sh -> div ) )
             {
                 /* printf ("account_nb = %d div_number = %d sub_sh -> div = %d\n", account_nb, div_number, sub_sh -> div ); */
@@ -953,9 +950,11 @@ void bet_historical_populate_div_model ( gpointer key,
                         SPP_HISTORICAL_RETAINED_AMOUNT, str_amount,
                         -1);
             sub_div_visible = TRUE;
-            gtk_tree_view_expand_to_path ( tree_view, gtk_tree_model_get_path ( model, &fils ) );
+            path = gtk_tree_model_get_path ( model, &fils );
+            gtk_tree_view_expand_to_path ( tree_view, path );
 
             g_free ( str_retained );
+            gtk_tree_path_free ( path );
         }
         g_free ( div_name );
         g_free ( str_balance );
@@ -985,9 +984,13 @@ void bet_historical_populate_div_model ( gpointer key,
 
         if ( edited )
         {
-            gtk_tree_view_collapse_row ( tree_view, gtk_tree_model_get_path ( model, &parent ) );
+            GtkTreePath *path;
+
+            path = gtk_tree_model_get_path ( model, &parent );
+            gtk_tree_view_collapse_row ( tree_view, path );
             gtk_tree_selection_select_iter ( gtk_tree_view_get_selection ( tree_view ), &parent );
 
+            gtk_tree_path_free ( path );
         }
     }
 }
@@ -1570,12 +1573,36 @@ void bet_historical_add_average_amount ( GtkWidget *menu_item,
  * */
 gboolean bet_historical_initializes_account_settings ( gint account_number )
 {
+    GtkWidget *button = NULL;
     GtkWidget *combo = NULL;
+    GtkTreeViewColumn *column;
+    gchar *title;
     gint fyear_number;
+    gint origin;
     gpointer pointeur;
 
-    combo = g_object_get_data ( G_OBJECT ( account_page ), "bet_hist_fyear_combo" );
+    /* set data origin */
+    origin = gsb_data_account_get_bet_hist_data ( account_number );
+    if ( origin )
+    {
+        button = g_object_get_data ( G_OBJECT ( account_page ), "bet_hist_button_2" );
+        gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button ), TRUE );
+        bet_data_set_div_ptr ( 1 );
+        title = g_strdup ( _("Budgetary line") );
+    }
+    else
+    {
+        button = g_object_get_data ( G_OBJECT ( account_page ), "bet_hist_button_1" );
+        gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button ), TRUE );
 
+    }
+
+    column = g_object_get_data ( G_OBJECT ( account_page ),
+                        "historical_column_source" );
+    gtk_tree_view_column_set_title ( GTK_TREE_VIEW_COLUMN ( column ), title );
+
+    /* set fyear */
+    combo = g_object_get_data ( G_OBJECT ( account_page ), "bet_hist_fyear_combo" );
     fyear_number = gsb_data_account_get_bet_hist_fyear ( account_number );
 
     pointeur = g_object_get_data ( G_OBJECT ( combo ), "pointer" );
diff --git a/src/bet_tab.c b/src/bet_tab.c
index 1b24ce4..60e2d39 100644
--- a/src/bet_tab.c
+++ b/src/bet_tab.c
@@ -2,7 +2,7 @@
 /*                                                                            */
 /*     Copyright (C) 2007 Dominique Parisot                                   */
 /*          zionly at free.org                                                   */
-/*          2008-2010 Pierre Biava (grisbi at pierre.biava.name)                 */
+/*          2008-2011 Pierre Biava (grisbi at pierre.biava.name)                 */
 /*          http://www.grisbi.org                                             */
 /*                                                                            */
 /*  This program is free software; you can redistribute it and/or modify      */
@@ -21,18 +21,7 @@
 /*                                                                            */
 /* ************************************************************************** */
 
-/*
- * prefix bet : Balance Estimate Tab
- *
- * TODO : change the color of each line in the graph :
- * red if balance is less than 0.
- * orange if balance is less than the minimum desired balance.
- * TODO : add a select button to display the selected line in the array
- * in the scheduler tab or in the account tab.
- */
-
 #include "include.h"
-#include <config.h>
 
 /*START_INCLUDE*/
 #include "bet_tab.h"
diff --git a/src/gsb_file_load.c b/src/gsb_file_load.c
index 66d6a37..99eb5a6 100644
--- a/src/gsb_file_load.c
+++ b/src/gsb_file_load.c
@@ -3961,6 +3961,13 @@ void gsb_file_load_bet_historical ( const gchar **attribute_names,
         continue;
     }
 
+    if ( !strcmp ( attribute_names[i], "Ori" ) )
+    {
+        shd -> origin = utils_str_atoi ( attribute_values[i] );
+        i++;
+        continue;
+    }
+
     if ( !strcmp ( attribute_names[i], "Div" ) )
     {
         shd -> div_number = utils_str_atoi ( attribute_values[i] );


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list