[grisbi-cvs] grisbi/src gsb_assistant_archive.c, 1.40, 1.41 gsb_calendar_entry.c, 1.28, 1.29 gsb_data_fyear.c, 1.18, 1.19 gsb_form_scheduler.c, 1.33, 1.34 gsb_transactions_list.c, 1.188, 1.189 import.c, 1.306, 1.307 transaction_list.c, 1.51, 1.52

Pierre Biava pbiava at users.sourceforge.net
Sun Nov 29 19:53:42 CET 2009


Update of /cvsroot/grisbi/grisbi/src
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv29486/src

Modified Files:
	gsb_assistant_archive.c gsb_calendar_entry.c gsb_data_fyear.c 
	gsb_form_scheduler.c gsb_transactions_list.c import.c 
	transaction_list.c 
Log Message:
fixed bug 691 and changes minor 

Index: gsb_assistant_archive.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_assistant_archive.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- gsb_assistant_archive.c	3 Oct 2009 22:14:56 -0000	1.40
+++ gsb_assistant_archive.c	29 Nov 2009 18:53:39 -0000	1.41
@@ -194,7 +194,7 @@
     GtkWidget *label;
     GtkWidget *button;
     GtkWidget *hbox;
-
+printf ("gsb_assistant_archive_page_menu\n");
     page = gtk_hbox_new (FALSE, 15);
     gtk_container_set_border_width ( GTK_CONTAINER (page), 10 );
 
@@ -348,7 +348,7 @@
     GtkWidget *page;
     GtkWidget *vbox;
     GtkWidget *label;
-
+printf ("gsb_assistant_archive_page_archive_name\n");
     page = gtk_hbox_new (FALSE, 15);
     gtk_container_set_border_width ( GTK_CONTAINER (page),
 				     10 );
@@ -397,7 +397,7 @@
     GtkWidget * page;
     GtkTextBuffer * buffer;
     GtkTextIter iter;
-
+printf ("gsb_assistant_archive_page_success\n");
     page = gtk_vbox_new ( FALSE, 0 );
     gtk_container_set_border_width ( GTK_CONTAINER (page),
 				     0 );
@@ -500,6 +500,7 @@
 static gboolean gsb_assistant_archive_switch_to_intro ( GtkWidget *assistant,
                         gint new_page )
 {
+printf ("gsb_assistant_archive_switch_to_intro\n");
     /* enter into the intro page */
     gsb_assistant_change_button_next ( assistant,
 				       GTK_STOCK_GO_FORWARD, GTK_RESPONSE_YES );
@@ -523,7 +524,7 @@
 {
     GSList *tmp_list;
     const GDate *date = NULL;
-
+printf ("gsb_assistant_archive_switch_to_menu\n");
     /* enter into the menu page */
     gtk_label_set_text ( GTK_LABEL (label_archived), NULL );
     gsb_assistant_change_button_next ( assistant,
@@ -572,7 +573,7 @@
                         gint new_page )
 {
     gchar * string = NULL;
-
+printf ("gsb_assistant_archive_switch_to_archive_name\n");
     gsb_assistant_change_button_next ( assistant,
                     GTK_STOCK_APPLY, GTK_RESPONSE_YES );
 
@@ -637,9 +638,11 @@
     GtkTextBuffer * buffer;
     GtkTextIter     iter;
     gint account_nb;
-
+printf ("gsb_assistant_archive_switch_to_succes\n");
     /* This would typically happen if user selected a time period
      * with no transactions related. */
+printf ("nbre de transactions dans l'archive = %d\n",
+                        g_slist_length ( list_transaction_to_archive ) );
     if (!list_transaction_to_archive)
     {
     gtk_widget_hide (vbox_congratulation);
@@ -707,7 +710,7 @@
     gsb_data_archive_store_init_variables ();
     gsb_data_archive_store_create_list ( );
     gsb_transactions_list_fill_archive_store ( );
-
+printf ("retour de gsb_transactions_list_fill_archive_store\n");
     /* set the message */
     string = g_strdup_printf ( _("Archive '%s' was successfully created and %d transactions "
                                  "out of %d were archived.\n\n"),
@@ -720,21 +723,42 @@
     gtk_text_buffer_get_iter_at_mark ( buffer, &iter, 
                         gtk_text_buffer_get_mark ( buffer, "status" ) );
     gtk_text_buffer_insert ( buffer, &iter, string, strlen(string) );
-
+printf ("avant g_free (string);\n");
     g_free (string);
-
+printf ("après g_free (string);\n");
     gtk_widget_hide (vbox_failed);
     gtk_widget_show (vbox_congratulation);
 
     /* free the transactions list to archive */
+printf ("avant g_slist_free (list_transaction_to_archive);\n");
     g_slist_free (list_transaction_to_archive);
+printf ("après g_slist_free (list_transaction_to_archive);\n");
     list_transaction_to_archive = NULL;
 
     /* erase all the previous entries */
+    g_signal_handlers_block_by_func ( G_OBJECT ( name_entry ),
+ 					G_CALLBACK ( gsb_assistant_archive_update_labels ),
+ 					assistant );
+    g_signal_handlers_block_by_func ( G_OBJECT ( initial_date ),
+ 					G_CALLBACK ( gsb_assistant_archive_update_labels ),
+ 					assistant );
+    g_signal_handlers_block_by_func ( G_OBJECT ( final_date ),
+ 					G_CALLBACK ( gsb_assistant_archive_update_labels ),
+ 					assistant );
     gtk_entry_set_text ( GTK_ENTRY (name_entry), "" );
     gtk_entry_set_text ( GTK_ENTRY (initial_date), "" );
     gtk_entry_set_text ( GTK_ENTRY (final_date), "" );
 
+    g_signal_handlers_unblock_by_func ( G_OBJECT ( name_entry ),
+ 					G_CALLBACK ( gsb_assistant_archive_update_labels ),
+ 					assistant );
+    g_signal_handlers_unblock_by_func ( G_OBJECT ( initial_date ),
+ 					G_CALLBACK ( gsb_assistant_archive_update_labels ),
+ 					assistant );
+    g_signal_handlers_unblock_by_func ( G_OBJECT ( final_date ),
+ 					G_CALLBACK ( gsb_assistant_archive_update_labels ),
+ 					assistant );
+
     /* propose to go in one or another way */
     gsb_assistant_sensitive_button_prev ( assistant, TRUE );
     gsb_assistant_sensitive_button_next ( assistant, TRUE );
@@ -746,7 +770,6 @@
     if ( ( account_nb = gsb_gui_navigation_get_current_account ( ) ) != -1 )
         gsb_transactions_list_update_tree_view ( account_nb, TRUE );
 
-        
     return FALSE;
 }
 
@@ -766,197 +789,191 @@
     GSList *tmp_list;
     GtkWidget * notebook;
     GSList *report_transactions_list;
-
+printf ("gsb_assistant_archive_update_labels\n");
     notebook = g_object_get_data ( G_OBJECT(assistant), "notebook" );
     
     /* erase the last list of transactions to archive */
     if (gtk_notebook_get_current_page (GTK_NOTEBOOK(notebook)) == ARCHIVE_ASSISTANT_MENU
-    &&
-    list_transaction_to_archive)
+     &&
+     list_transaction_to_archive)
     {
-    g_slist_free (list_transaction_to_archive);
-    list_transaction_to_archive = NULL;
+        printf ("current_page = ARCHIVE_ASSISTANT_MENU\n");
+        g_slist_free (list_transaction_to_archive);
+        list_transaction_to_archive = NULL;
+        gsb_assistant_sensitive_button_next ( assistant, TRUE );
     }
 
     /* ok for now the choice is on initial/final date */
-    if ( gtk_notebook_get_current_page (GTK_NOTEBOOK(notebook)) == ARCHIVE_ASSISTANT_MENU &&
-    GTK_WIDGET_IS_SENSITIVE (initial_date))
+    if ( gtk_notebook_get_current_page (GTK_NOTEBOOK(notebook)) == ARCHIVE_ASSISTANT_MENU )
     {
-    GDate *init_gdate;
-    GDate *final_gdate;
-    init_gdate = gsb_calendar_entry_get_date (initial_date);
-    final_gdate = gsb_calendar_entry_get_date (final_date);
-    string = NULL;
+        printf ("current_page = ARCHIVE_ASSISTANT_MENU\n");
+        if ( GTK_WIDGET_IS_SENSITIVE (initial_date) )
+        {
+            GDate *init_gdate;
+            GDate *final_gdate;
 
-    if ( !strlen ( gtk_entry_get_text ( GTK_ENTRY ( initial_date ) ) ) )
-        string = make_red ( _("Please fill the initial date."));
-    if ( !string
-        &&
-        !strlen ( gtk_entry_get_text ( GTK_ENTRY ( final_date ) ) ) )
-        string = make_red ( _("Please fill the final date.") );
-    if ( !string
-         &&
-         init_gdate
-         &&
-         final_gdate
-         &&
-         g_date_compare (init_gdate, final_gdate) > 0 )
-        string = make_red (_("The initial date is after the final date."));
-    if ( !string
-         &&
-         !init_gdate)
-        string = make_red (_("The initial date is not valid."));
-    if ( !string
-         &&
-         !final_gdate )
-        string = make_red (_("The final date is not valid."));
-    if ( !string
-         &&
-         gsb_data_archive_get_from_date (init_gdate) )
-        string = make_red (_("The initial date belongs already to an archive."));
-    if ( !string
-         &&
-         gsb_data_archive_get_from_date (final_gdate) )
-        string = make_red (_("The final date belongs already to an archive."));
+            init_gdate = gsb_calendar_entry_get_date (initial_date);
+            final_gdate = gsb_calendar_entry_get_date (final_date);
+            string = NULL;
 
-    if (string)
-    {
-        gtk_label_set_markup ( GTK_LABEL (label_archived), string );
-        g_free (string);
-        gsb_assistant_sensitive_button_next ( assistant, FALSE );
-        return FALSE;
-    }
+            if ( !strlen ( gtk_entry_get_text ( GTK_ENTRY ( initial_date ) ) ) )
+                string = make_red ( _("Please fill the initial date."));
+            if ( !string
+                &&
+                !strlen ( gtk_entry_get_text ( GTK_ENTRY ( final_date ) ) ) )
+                string = make_red ( _("Please fill the final date.") );
+            if ( !string
+                 &&
+                 init_gdate
+                 &&
+                 final_gdate
+                 &&
+                 g_date_compare (init_gdate, final_gdate) > 0 )
+                string = make_red (_("The initial date is after the final date."));
+            if ( !string
+                 &&
+                 !init_gdate)
+                string = make_red (_("The initial date is not valid."));
+            if ( !string
+                 &&
+                 !final_gdate )
+                string = make_red (_("The final date is not valid."));
+            if ( !string
+                 &&
+                 gsb_data_archive_get_from_date (init_gdate) )
+                string = make_red (_("The initial date belongs already to an archive."));
+            if ( !string
+                 &&
+                 gsb_data_archive_get_from_date (final_gdate) )
+                string = make_red (_("The final date belongs already to an archive."));
 
-    /* the dates are ok */
-    tmp_list = gsb_data_transaction_get_transactions_list ();
-    while (tmp_list)
-    {
-        gint transaction_number;
+            if (string)
+            {
+                gtk_label_set_markup ( GTK_LABEL (label_archived), string );
+                g_free (string);
+                gsb_assistant_sensitive_button_next ( assistant, FALSE );
+                return FALSE;
+            }
 
-        transaction_number = gsb_data_transaction_get_transaction_number (tmp_list -> data);
+            /* the dates are ok */
+            tmp_list = gsb_data_transaction_get_transactions_list ();
+            while (tmp_list)
+            {
+                gint transaction_number;
 
-        if ( g_date_compare ( init_gdate,
-                        gsb_data_transaction_get_date (transaction_number)) <= 0
-         &&
-         g_date_compare ( final_gdate,
-                        gsb_data_transaction_get_date (transaction_number)) >= 0 )
-        /* the transaction is into the dates, we append its address to the list to archive
-         * we could use gsb_assistant_archive_add_transaction_to_list but it's a lost of time
-         * because all the linked transactions will be taken because we work with dates,
-         * so don't use that function and add the transaction directly */
-        list_transaction_to_archive = g_slist_append ( list_transaction_to_archive,
-                        tmp_list -> data );
-        tmp_list = tmp_list -> next;
-    }
-    }
+                transaction_number = gsb_data_transaction_get_transaction_number (tmp_list -> data);
 
-    /* ok for now the choice is on fyear */
-    if ( gtk_notebook_get_current_page (GTK_NOTEBOOK(notebook)) == ARCHIVE_ASSISTANT_MENU &&
-    GTK_WIDGET_IS_SENSITIVE (financial_year_button))
-    {
-    gint fyear_number;
-    string = NULL;
+                if ( g_date_compare ( init_gdate,
+                                gsb_data_transaction_get_date (transaction_number)) <= 0
+                 &&
+                 g_date_compare ( final_gdate,
+                                gsb_data_transaction_get_date (transaction_number)) >= 0 )
+                /* the transaction is into the dates, we append its address to the list to archive
+                 * we could use gsb_assistant_archive_add_transaction_to_list but it's a lost of time
+                 * because all the linked transactions will be taken because we work with dates,
+                 * so don't use that function and add the transaction directly */
+                list_transaction_to_archive = g_slist_append ( list_transaction_to_archive,
+                                tmp_list -> data );
+                tmp_list = tmp_list -> next;
+            }
+            printf ("nbre de transactions dans l'archive = %d\n",
+                        g_slist_length ( list_transaction_to_archive ) );
+        }
 
-    fyear_number = gsb_fyear_get_fyear_from_combobox ( financial_year_button, NULL );
+        /* ok for now the choice is on fyear */
+        else if (  GTK_WIDGET_IS_SENSITIVE ( financial_year_button ) )
+        {
+            gint fyear_number;
+            string = NULL;
 
-    if (!fyear_number)
-        string = make_red (_("Please choose a financial year."));
+            fyear_number = gsb_fyear_get_fyear_from_combobox ( financial_year_button, NULL );
 
-    if ( !string
-     &&
-     gsb_data_archive_get_from_fyear ( fyear_number ) )
-        string = make_red (_("There is already an archive for that financial year."));
+            if (!fyear_number)
+                string = make_red (_("Please choose a financial year."));
 
-    if (string)
-    {
-        gtk_label_set_markup ( GTK_LABEL (label_archived), string );
-        g_free (string);
-        gsb_assistant_sensitive_button_next ( assistant, FALSE );
-        return FALSE;
-    }
+            if ( !string
+             &&
+             gsb_data_archive_get_from_fyear ( fyear_number ) )
+                string = make_red (_("There is already an archive for that financial year."));
 
-    /* the fyear is ok */
-    tmp_list = gsb_data_transaction_get_transactions_list ();
-    while (tmp_list)
-    {
-        gint transaction_number;
+            if (string)
+            {
+                gtk_label_set_markup ( GTK_LABEL (label_archived), string );
+                g_free (string);
+                gsb_assistant_sensitive_button_next ( assistant, FALSE );
+                return FALSE;
+            }
 
-        transaction_number = gsb_data_transaction_get_transaction_number (tmp_list -> data);
+            /* the fyear is ok */
+            tmp_list = gsb_data_transaction_get_transactions_list ();
+            while (tmp_list)
+            {
+                gint transaction_number;
 
-        if (gsb_data_transaction_get_financial_year_number (transaction_number) == fyear_number)
-        {
-        /* the transaction belongs to the fyear, we append its address to the list to archive
-         * all the linked transactions will be taken */
-        gsb_assistant_archive_add_transaction_to_list (tmp_list -> data);
-        }
-        tmp_list = tmp_list -> next;
-    }
-    }
+                transaction_number = gsb_data_transaction_get_transaction_number (tmp_list -> data);
 
-    /* ok for now the choice is on report */
-    if ( gtk_notebook_get_current_page (GTK_NOTEBOOK(notebook)) == ARCHIVE_ASSISTANT_MENU &&
-     GTK_WIDGET_IS_SENSITIVE (report_button))
-    {
-    gint report_number;
-    string = NULL;
+                if (gsb_data_transaction_get_financial_year_number (transaction_number) == fyear_number)
+                {
+                /* the transaction belongs to the fyear, we append its address to the list to archive
+                 * all the linked transactions will be taken */
+                gsb_assistant_archive_add_transaction_to_list (tmp_list -> data);
+                }
+                tmp_list = tmp_list -> next;
+            }
+        }
+        /* ok for now the choice is on report */
+        else if (  GTK_WIDGET_IS_SENSITIVE (report_button))
+        {
+            gint report_number;
+            string = NULL;
 
-    report_number = gsb_report_get_report_from_combobox (report_button);
+            report_number = gsb_report_get_report_from_combobox (report_button);
 
-    if (!report_number)
-        string = make_red (_("Please choose a report."));
+            if (!report_number)
+                string = make_red (_("Please choose a report."));
 
-    if (string)
-    {
-        gtk_label_set_markup ( GTK_LABEL (label_archived), string );
-        g_free (string);
-        gsb_assistant_sensitive_button_next ( assistant, FALSE );
-        return FALSE;
-    }
+            if (string)
+            {
+                gtk_label_set_markup ( GTK_LABEL (label_archived), string );
+                g_free (string);
+                gsb_assistant_sensitive_button_next ( assistant, FALSE );
+                return FALSE;
+            }
 
-    /* the report is ok */
-    report_transactions_list = recupere_opes_etat (report_number);
+            /* the report is ok */
+            report_transactions_list = recupere_opes_etat (report_number);
 
-    /* the list from report doesn't contain contra-transaction and mother/children split,
-     * so for each transaction of that list, we need to check the contra-transaction, the mother and children
-     * and add them to the list */
-    tmp_list = report_transactions_list;
-    while (tmp_list)
-    {
-        /* just call add_transaction_to_list, all the linked transactions will be taken */
-        gsb_assistant_archive_add_transaction_to_list (tmp_list -> data);
-        tmp_list = tmp_list -> next;
-    }
-    g_slist_free (report_transactions_list);
-    }
+            /* the list from report doesn't contain contra-transaction and mother/children split,
+             * so for each transaction of that list, we need to check the contra-transaction, the mother and children
+             * and add them to the list */
+            tmp_list = report_transactions_list;
+            while (tmp_list)
+            {
+                /* just call add_transaction_to_list, all the linked transactions will be taken */
+                gsb_assistant_archive_add_transaction_to_list (tmp_list -> data);
+                tmp_list = tmp_list -> next;
+            }
+            g_slist_free (report_transactions_list);
+        }
 
-    /* update the labels */
-    if (gtk_notebook_get_current_page (GTK_NOTEBOOK(notebook)) == ARCHIVE_ASSISTANT_MENU )
-    {
-    /* there is some transactions to archive */
-    string = g_strdup_printf (_("%d transactions out of %d will be archived."),
-                        g_slist_length (list_transaction_to_archive),
-                        g_slist_length (gsb_data_transaction_get_transactions_list () ) );
-    gtk_label_set_text ( GTK_LABEL (label_archived), string);
-    g_free (string);
+        /* there is some transactions to archive */
+        string = g_strdup_printf (_("%d transactions out of %d will be archived."),
+                            g_slist_length (list_transaction_to_archive),
+                            g_slist_length (gsb_data_transaction_get_transactions_list () ) );
+        gtk_label_set_text ( GTK_LABEL (label_archived), string);
+        g_free (string);
 
-    if ( gtk_notebook_get_current_page (GTK_NOTEBOOK(notebook)) != 
-        ARCHIVE_ASSISTANT_ARCHIVE_NAME )
-    {
         gsb_assistant_sensitive_button_next ( assistant, TRUE );
     }
-    }
 
-    if ( gtk_notebook_get_current_page (GTK_NOTEBOOK(notebook)) == 
+    else if ( gtk_notebook_get_current_page (GTK_NOTEBOOK(notebook)) == 
      ARCHIVE_ASSISTANT_ARCHIVE_NAME )
     {
-    if ( strlen ( gtk_entry_get_text ( GTK_ENTRY ( name_entry ) ) ) )
-    {
-        gsb_assistant_sensitive_button_next ( assistant, TRUE );
-    }
-    else
-    {
-        gsb_assistant_sensitive_button_next ( assistant, FALSE );
-    }
+        printf ("current_page = ARCHIVE_ASSISTANT_ARCHIVE_NAME\n");
+        if ( strlen ( gtk_entry_get_text ( GTK_ENTRY ( name_entry ) ) ) )
+            gsb_assistant_sensitive_button_next ( assistant, TRUE );
+        else
+            gsb_assistant_sensitive_button_next ( assistant, FALSE );
     }
     
     return FALSE;

Index: gsb_data_fyear.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_fyear.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- gsb_data_fyear.c	3 Oct 2009 22:14:56 -0000	1.18
+++ gsb_data_fyear.c	29 Nov 2009 18:53:39 -0000	1.19
@@ -720,6 +720,11 @@
     if ( !fyear_1 || !fyear_2 )
         return 0;
 
+    if ( ! fyear_1 -> beginning_date )
+        return -1;
+    if ( ! fyear_2 -> beginning_date )
+        return -1;
+
     if (g_date_compare (fyear_1 -> beginning_date, fyear_2 -> end_date) >= 0)
         return 1;
     if (g_date_compare (fyear_2 -> beginning_date, fyear_1 -> end_date) >= 0)

Index: gsb_transactions_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list.c,v
retrieving revision 1.188
retrieving revision 1.189
diff -u -d -r1.188 -r1.189
--- gsb_transactions_list.c	28 Nov 2009 12:56:18 -0000	1.188
+++ gsb_transactions_list.c	29 Nov 2009 18:53:39 -0000	1.189
@@ -568,15 +568,20 @@
     devel_debug (NULL);
 
     tmp_list = gsb_data_archive_store_get_archives_list ();
+printf ("nbre d'archives = %d\n", g_slist_length ( tmp_list ));
     while (tmp_list)
     {
     gint archive_store_number;
 
     /* get the store archive struct */
     archive_store_number = gsb_data_archive_store_get_number (tmp_list -> data);
+    printf ("archive_store_number = %d account_nb = %d\n",
+                        archive_store_number ,
+                        gsb_data_archive_store_get_account_number ( archive_store_number ));
     transaction_list_append_archive (archive_store_number);
     tmp_list = tmp_list -> next;
     }
+    printf ("sortie de gsb_transactions_list_fill_archive_store\n");
     return FALSE;
 }
 

Index: gsb_calendar_entry.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_calendar_entry.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- gsb_calendar_entry.c	23 Oct 2009 19:54:11 -0000	1.28
+++ gsb_calendar_entry.c	29 Nov 2009 18:53:39 -0000	1.29
@@ -445,11 +445,14 @@
     GtkWidget *popup, *pVBox, *pCalendar, *button, *frame;
     GtkRequisition *popup_size;
     gint x, y;
+    gint screen_width = gdk_screen_width ( );
     GDate * date;
 
     /* make the popup */
     popup = gtk_window_new ( GTK_WINDOW_TOPLEVEL );
     gtk_window_set_modal ( GTK_WINDOW ( popup ), TRUE );
+    gtk_window_set_transient_for ( GTK_WINDOW ( popup ),
+                        GTK_WINDOW ( window ) );
     gtk_window_set_decorated ( GTK_WINDOW ( popup ), FALSE );
     g_signal_connect_swapped ( G_OBJECT ( popup ),
 				"destroy",
@@ -518,6 +521,10 @@
     /* pour la soustraire à la position de l'entrée date */
     y -= popup_size -> height;
 
+    /* on décale le popup si on est trop près de bord droit de l'écran */
+    if ( x > ( screen_width - popup_size -> width ) )
+        x = screen_width - popup_size -> width - 10;
+
     /* si une des coordonnées est négative, alors la fonction
        gtk_window_move échoue et affiche la popup en 0,0 */
     if ( x < 0 )
@@ -555,8 +562,10 @@
 
     gtk_entry_set_text ( GTK_ENTRY ( entry ),
 			 gsb_format_date ( day, month + 1, year ));
+    gsb_form_widget_set_empty ( entry, FALSE );
     if ( GTK_WIDGET_TOPLEVEL ( pTopLevelWidget ) )
-	gtk_widget_destroy ( pTopLevelWidget );
+        gtk_widget_destroy ( pTopLevelWidget );
+
     return FALSE;
 }
 

Index: import.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import.c,v
retrieving revision 1.306
retrieving revision 1.307
diff -u -d -r1.306 -r1.307
--- import.c	27 Nov 2009 22:07:38 -0000	1.306
+++ import.c	29 Nov 2009 18:53:39 -0000	1.307
@@ -1847,7 +1847,7 @@
      * être dans le fichier importé */
     first_date_import = gsb_import_get_first_date ( imported_account -> operations_importees );
 
-    /* ok, now firt_date_import contains the firt transaction date used in that account,
+    /* ok, now first_date_import contains the firt transaction date used in that account,
      * can check the imported transactions */
     demande_confirmation = gsb_import_define_action ( imported_account,
                         account_number,

Index: transaction_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/transaction_list.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- transaction_list.c	28 Nov 2009 19:58:12 -0000	1.51
+++ transaction_list.c	29 Nov 2009 18:53:40 -0000	1.52
@@ -293,7 +293,7 @@
     CustomRecord *newrecord;
     gint amount_col;
     CustomList *custom_list;
-
+devel_debug_int ( archive_store_number);
     custom_list = transaction_model_get_model ();
 
     g_return_if_fail ( custom_list != NULL );
@@ -304,11 +304,24 @@
      * 1 for the archive */
     custom_list->num_rows = custom_list -> num_rows + 1;
     newsize = custom_list->num_rows * sizeof(CustomRecord*);
-    custom_list->rows = g_realloc(custom_list->rows, newsize);
-
+    //~ printf ("pos = %d custom_list->num_rows = %d newsize = %ld\n", pos,
+            //~ custom_list->num_rows, newsize );
+    custom_list->rows = g_try_realloc ( custom_list->rows, newsize );
+    if ( custom_list->rows == NULL )
+    {
+        printf ("realloc Non OK\n");
+        return;
+    }
+//~ printf ("realloc custom_list->rows OK\n");
     /* increase too the size of visibles rows, either if that row is not visible,
      * it's the only way to be sure to never go throw the end while filtering */
-    custom_list->visibles_rows = g_realloc(custom_list->visibles_rows, newsize);
+    custom_list->visibles_rows = g_try_realloc (custom_list->visibles_rows, newsize);
+    if ( custom_list->visibles_rows == NULL )
+    {
+        printf ("realloc Non OK\n");
+        return;
+    }
+//~ printf ("realloc custom_list->visibles_rows OK\n");
 
     /* create and fill the record */
     newrecord = g_malloc0 (sizeof (CustomRecord));
@@ -322,6 +335,7 @@
                         gsb_data_archive_get_name (archive_number),
                         gsb_data_archive_store_get_transactions_number (
                         archive_store_number ) );
+    printf ("texte archive = %s\n", newrecord -> visible_col[find_element_col (ELEMENT_PARTY)] );
     if ((gsb_data_archive_store_get_balance (archive_store_number)).mantissa < 0)
 	amount_col = find_element_col (ELEMENT_DEBIT);
     else

Index: gsb_form_scheduler.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form_scheduler.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- gsb_form_scheduler.c	12 Sep 2009 19:33:40 -0000	1.33
+++ gsb_form_scheduler.c	29 Nov 2009 18:53:39 -0000	1.34
@@ -1,8 +1,8 @@
 /* ************************************************************************** */
 /*                                                                            */
-/*     Copyright (C)	2000-2008 Cédric Auger (cedric at grisbi.org)	      */
-/*			2003-2008 Benjamin Drieu (bdrieu at april.org)	      */
-/* 			http://www.grisbi.org				      */
+/*     Copyright (C)    2000-2008 Cédric Auger (cedric at grisbi.org)            */
+/*          2003-2008 Benjamin Drieu (bdrieu at april.org)                       */
+/*          http://www.grisbi.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      */
@@ -56,16 +56,16 @@
 
 /*START_STATIC*/
 static gboolean gsb_form_scheduler_button_press_event ( GtkWidget *entry,
-						 GdkEventButton *ev,
-						 gint *ptr_origin );
+                        GdkEventButton *ev,
+                        gint *ptr_origin );
 static gboolean gsb_form_scheduler_change_account ( GtkWidget *button,
-					     gpointer null );
+                        gpointer null );
 static gboolean gsb_form_scheduler_entry_lose_focus ( GtkWidget *entry,
-					       GdkEventFocus *ev,
-					       gint *ptr_origin );
+                        GdkEventFocus *ev,
+                        gint *ptr_origin );
 static void gsb_form_scheduler_free_content_list ( GSList *content_list );
 static gboolean gsb_form_scheduler_frequency_button_changed ( GtkWidget *combo_box,
-						       gpointer null );
+                       gpointer null );
 static gint gsb_form_scheduler_get_auto ( void );
 static GSList *gsb_form_scheduler_get_content_list ( void );
 static gint gsb_form_scheduler_get_frequency ( void );
@@ -135,7 +135,7 @@
     scheduled_element *element;
     devel_debug (NULL);
     if (!table)
-	return FALSE;
+        return FALSE;
 
     /* just in case... be sure that not created */
     if (scheduled_element_list)
@@ -193,22 +193,22 @@
 		    tooltip_text = SPACIFY(_("Frequency"));
 		    break;
 
-		case SCHEDULED_FORM_LIMIT_DATE:
-		    widget = gsb_calendar_entry_new (FALSE);
-		    g_signal_connect ( G_OBJECT (widget),
+        case SCHEDULED_FORM_LIMIT_DATE:
+            widget = gsb_calendar_entry_new (FALSE);
+            g_signal_connect ( G_OBJECT (widget),
                         "button-press-event",
                         G_CALLBACK (gsb_form_scheduler_button_press_event),
                         GINT_TO_POINTER (element_number));
-		    g_signal_connect ( G_OBJECT (widget),
+            g_signal_connect ( G_OBJECT (widget),
                         "focus-in-event",
                         G_CALLBACK (gsb_form_entry_get_focus),
                         GINT_TO_POINTER (element_number));
-		    g_signal_connect_after ( G_OBJECT (widget),
+            g_signal_connect_after ( G_OBJECT (widget),
                         "focus-out-event",
-					    G_CALLBACK (gsb_form_scheduler_entry_lose_focus),
-					    GINT_TO_POINTER (element_number));
-		    tooltip_text = SPACIFY(_("Frequency"));
-		    break;
+                        G_CALLBACK (gsb_form_scheduler_entry_lose_focus),
+                        GINT_TO_POINTER (element_number));
+            tooltip_text = SPACIFY(_("Frequency"));
+            break;
 
 		case SCHEDULED_FORM_FREQUENCY_USER_ENTRY:
 		    widget = gtk_entry_new ();
@@ -236,12 +236,6 @@
 	    scheduled_element_list = g_slist_append ( scheduled_element_list,
                         element );
 
-	    /* set the key signal */
-	    g_signal_connect ( G_OBJECT (widget),
-                        "key-press-event",
-                        G_CALLBACK (gsb_form_key_press_event),
-                        GINT_TO_POINTER (SCHEDULED_FORM_ACCOUNT));
-
 	    /* set in the form */
 	    gtk_table_attach ( GTK_TABLE (table),
                         widget,
@@ -305,7 +299,7 @@
  * \return FALSE
  * */
 gboolean gsb_form_scheduler_change_account ( GtkWidget *button,
-					     gpointer null )
+                        gpointer null )
 {
     gint save_transaction;
     gint save_execute;
@@ -642,28 +636,22 @@
 		case SCHEDULED_FORM_AUTO:
 		case SCHEDULED_FORM_FREQUENCY_BUTTON:
 		case SCHEDULED_FORM_FREQUENCY_USER_BUTTON:
-		    gtk_combo_box_set_active ( GTK_COMBO_BOX (widget),
-					       0 );
-		    gtk_widget_set_sensitive ( widget,
-					       FALSE );
+		    gtk_combo_box_set_active ( GTK_COMBO_BOX (widget), 0 );
+		    gtk_widget_set_sensitive ( widget, FALSE );
 		    break;
 
 		case SCHEDULED_FORM_LIMIT_DATE:
-		    gsb_form_widget_set_empty ( widget,
-						TRUE );
+		    gsb_form_widget_set_empty ( widget, TRUE );
 		    gtk_entry_set_text ( GTK_ENTRY ( widget ),
 					 _("Limit date") );
-		    gtk_widget_set_sensitive ( widget,
-					       TRUE );
+		    gtk_widget_set_sensitive ( widget, TRUE );
 		    break;
 
 		case SCHEDULED_FORM_FREQUENCY_USER_ENTRY:
-		    gsb_form_widget_set_empty ( widget,
-						TRUE );
+		    gsb_form_widget_set_empty ( widget, TRUE );
 		    gtk_entry_set_text ( GTK_ENTRY ( widget ),
 					 _("User frequency") );
-		    gtk_widget_set_sensitive ( widget,
-					       TRUE );
+		    gtk_widget_set_sensitive ( widget, TRUE );
 		    break;
 	    }
 	}
@@ -806,8 +794,8 @@
  * \return FALSE
  * */
 gboolean gsb_form_scheduler_button_press_event ( GtkWidget *entry,
-						 GdkEventButton *ev,
-						 gint *ptr_origin )
+                        GdkEventButton *ev,
+                        gint *ptr_origin )
 {
     gint element_number;
     GtkWidget *date_entry;
@@ -821,10 +809,9 @@
     date_entry = gsb_form_widget_get_widget (TRANSACTION_FORM_DATE);
     if ( gsb_form_widget_check_empty (date_entry))
     {
-	gtk_entry_set_text ( GTK_ENTRY (date_entry),
-			     gsb_date_today ());
-	gsb_form_widget_set_empty ( date_entry,
-				    FALSE );
+        gtk_entry_set_text ( GTK_ENTRY (date_entry),
+                     gsb_date_today ( ) );
+        gsb_form_widget_set_empty ( date_entry, FALSE );
     }
     return FALSE;
 }
@@ -840,8 +827,8 @@
  * \return FALSE
  * */
 gboolean gsb_form_scheduler_entry_lose_focus ( GtkWidget *entry,
-					       GdkEventFocus *ev,
-					       gint *ptr_origin )
+                        GdkEventFocus *ev,
+                        gint *ptr_origin )
 {
     gchar *string;
     gint element_number;
@@ -849,10 +836,8 @@
 
     /* remove the selection */
 
-    gtk_editable_select_region ( GTK_EDITABLE ( entry ),
-				 0,
-				 0 );
-    element_number = GPOINTER_TO_INT (ptr_origin);
+    gtk_editable_select_region ( GTK_EDITABLE ( entry ), 0, 0 );
+    element_number = GPOINTER_TO_INT ( ptr_origin );
     account_number = gsb_form_get_account_number ();
 
     /* string will be filled only if the field is empty */
@@ -861,13 +846,13 @@
     switch ( element_number )
     {
 	case  SCHEDULED_FORM_LIMIT_DATE:
-	    if ( !strlen ( gtk_entry_get_text ( GTK_ENTRY (entry))))
-		string = _("Limit date");
+	    if ( !strlen ( gtk_entry_get_text ( GTK_ENTRY ( entry ) ) ) )
+            string = _("Limit date");
 	    break;
 
 	case  SCHEDULED_FORM_FREQUENCY_USER_ENTRY:
-	    if ( !strlen ( gtk_entry_get_text ( GTK_ENTRY (entry))))
-		string = _("Own frequency");
+	    if ( !strlen ( gtk_entry_get_text ( GTK_ENTRY ( entry ) ) ) )
+            string = _("Own frequency");
 	    break;
 
 	default :
@@ -878,9 +863,8 @@
 
     if ( string )
     {
-	gtk_entry_set_text ( GTK_ENTRY ( entry ), string );
-	gsb_form_widget_set_empty ( entry,
-				    TRUE );
+        gtk_entry_set_text ( GTK_ENTRY ( entry ), string );
+        gsb_form_widget_set_empty ( entry, TRUE );
     }
     return FALSE;
 }
@@ -1115,18 +1099,22 @@
 {
     GtkWidget *entry;
 
-    if (!date)
-	return FALSE;
+    entry = gsb_form_scheduler_get_element_widget ( SCHEDULED_FORM_LIMIT_DATE );
 
-    entry = gsb_form_scheduler_get_element_widget(SCHEDULED_FORM_LIMIT_DATE);
     /* if no entry, go away... */
-    if (!entry
-	||
-	!GTK_WIDGET_VISIBLE (entry))
-	return FALSE;
+    if (!entry || !GTK_WIDGET_VISIBLE ( entry ) )
+        return FALSE;
 
-    if (!gsb_calendar_entry_set_date ( entry, date ))
-	gsb_form_widget_set_empty (entry, FALSE);
+    if ( !date )
+    {
+        gsb_form_widget_set_empty ( entry, TRUE );
+        gtk_entry_set_text ( GTK_ENTRY ( entry ), _("Limit date") );
+    }
+    else
+    {
+        gsb_calendar_entry_set_date ( entry, date );
+        gsb_form_widget_set_empty (entry, FALSE);
+    }
 
     return TRUE;
 }



More information about the cvs mailing list