[grisbi-cvs] grisbi/src export_csv.c, 1.24, 1.25 gsb_currency.c, 1.48, 1.49 gtk_combofix.c, 1.62, 1.63

Pierre Biava pbiava at users.sourceforge.net
Thu Nov 19 21:13:47 CET 2009


Update of /cvsroot/grisbi/grisbi/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4529/src

Modified Files:
	export_csv.c gsb_currency.c gtk_combofix.c 
Log Message:
Corrige le bug 675

Index: gtk_combofix.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gtk_combofix.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- gtk_combofix.c	24 Aug 2009 13:56:59 -0000	1.62
+++ gtk_combofix.c	19 Nov 2009 20:13:45 -0000	1.63
@@ -27,6 +27,7 @@
 
 /*START_INCLUDE*/
 #include "gtk_combofix.h"
+#include "./dialog.h"
 #include "./gsb_form_widget.h"
 #include "./utils_str.h"
 #include "./erreur.h"
@@ -138,39 +139,6 @@
 
 
 /**
- * create a normal combofix, ie just 1 list
- * by default, force is not set, auto_sort is TRUE, no max items
- * and case unsensitive
- *
- * \param list a g_slist of name (\t at the beginning makes it as a child)
- * \param force TRUE and the text must be in the list
- * \param sort TRUE and the list will be sorted automatickly
- * \param max_items the minimum of characters to show the popup
- *
- * \return the new widget
- * */
-/* comment by pbiava the 02/08/2009 : unused function 
-GtkWidget *gtk_combofix_new ( GSList *list )
-{
-    GtkComboFix *combofix = GTK_COMBOFIX ( gtk_type_new ( gtk_combofix_get_type () ) );
-
-    !* fill the field of the combofix *!
-    combofix -> force = FALSE;
-    combofix -> complex = 0;
-    combofix -> auto_sort = TRUE;
-    combofix -> max_items = 0;
-    combofix -> visible_items = 0;
-    combofix -> case_sensitive = FALSE;
-
-    gtk_combofix_fill_store ( combofix,
-			      list,
-			      0 );
-
-    return ( GTK_WIDGET ( combofix ) );
-} */
-
-
-/**
  * create a complex combofix, ie several list set one after the others
  * by default, force is not set, auto_sort is TRUE, no max items
  * and case unsensitive
@@ -244,7 +212,6 @@
 {
     g_return_if_fail (combofix);
     g_return_if_fail (GTK_IS_COMBOFIX (combofix));
-    g_return_if_fail ( text);
 
     g_signal_handlers_block_by_func ( G_OBJECT (combofix -> entry),
 				      G_CALLBACK (gtk_combofix_entry_insert),
@@ -252,8 +219,10 @@
     g_signal_handlers_block_by_func ( G_OBJECT (combofix -> entry),
 				      G_CALLBACK (gtk_combofix_entry_delete),
 				      combofix );
-    gtk_entry_set_text ( GTK_ENTRY ( combofix -> entry ),
-			 text );
+    if ( text && strlen ( text ) > 0 )
+        gtk_entry_set_text ( GTK_ENTRY ( combofix -> entry ), text );
+    else
+        gtk_entry_set_text ( GTK_ENTRY ( combofix -> entry ), "" );
     g_signal_handlers_unblock_by_func ( G_OBJECT (combofix -> entry),
 					G_CALLBACK (gtk_combofix_entry_insert),
 					combofix );
@@ -321,24 +290,6 @@
 
 
 /**
- * set if the list has to be automatickly sorted or not
- *
- * \param combofix
- * \param auto_sort TRUE for automatic sort
- *
- * \return
- * */
-/* comment by pbiava the 02/08/2009 : unused function 
-void gtk_combofix_set_sort ( GtkComboFix *combofix,
-			     gboolean auto_sort )
-{
-    g_return_if_fail (combofix );
-    g_return_if_fail (GTK_IS_COMBOFIX (combofix));
-
-    combofix -> auto_sort = auto_sort;
-} */
-
-/**
  * set if the completion is case sensitive or not
  *
  * \param combofix
@@ -394,31 +345,6 @@
 }
 
 
-
-
-
-/**
- * show or hide the popup
- *
- * \param combofix
- * \param show TRUE to show the popup
- *
- * \return
- * */
-/* comment by pbiava the 02/08/2009 : unused function 
-void gtk_combofix_view_list ( GtkComboFix *combofix,
-			      gboolean show )
-{
-    g_return_if_fail (combofix );
-    g_return_if_fail (GTK_IS_COMBOFIX (combofix));
-
-    if (show)
-	gtk_combofix_show_popup ( combofix );
-    else
-	gtk_combofix_hide_popup (combofix);
-} */
-
-
 /**
  * change the list of an existing combofix
  *
@@ -811,11 +737,11 @@
 
     gtk_editable_delete_selection ( GTK_EDITABLE (combofix -> entry));
 
-    if (strlen (entry_string))
-	completed_string = gtk_combofix_update_visible_rows ( combofix,
+    if ( strlen ( entry_string ) )
+	    completed_string = gtk_combofix_update_visible_rows ( combofix,
 							      entry_string);
     else
-	gtk_combofix_set_all_visible_rows (combofix);
+	    gtk_combofix_set_all_visible_rows (combofix);
 
     /* if force is set and there is no completed_string, we deleted 1 character by one
      * from the end to have again a completed string */
@@ -823,58 +749,56 @@
 	 &&
 	 !completed_string )
     {
-	gchar *new_string;
-
-	new_string = my_strdup (entry_string);
-
-	while (!completed_string
-	       &&
-	       new_string
-	       &&
-	       strlen (new_string))
-	{
-	    new_string[strlen (new_string) -1] = 0;
-	    completed_string = gtk_combofix_update_visible_rows ( combofix,
-								  new_string );
-	}
+	    gchar *new_string = NULL;
 
-	if (completed_string)
-	{
-	    gtk_combofix_set_text ( combofix,
-				    new_string );
-	    g_free ( new_string );
+        new_string = my_strdup ( entry_string );
 
-	    /* as we deleted something the user typed, we don't complete later, only
-	     * show the popup */
-	    completed_string = NULL;
-	}
-	else
-	{
-	    /* completed_string still NULL here means that even the first letter cannot
-	     * be set, so show all the list and erase the entry */
+        if ( strlen ( entry_string) )
+            dialogue_warning_hint ( _("You cannot create new payee or category "
+                            "and subcategory without changing the options "
+                            "in preferences"),
+                            _("Warning you cannot create payee or category") );
+        
+        while (!completed_string
+               &&
+               new_string
+               &&
+               strlen (new_string))
+        {
+            new_string[strlen (new_string) -1] = 0;
+            if ( strlen ( new_string ) > 0 )
+                completed_string = gtk_combofix_update_visible_rows ( combofix,
+                                      new_string );
+        }
 
-	    gtk_combofix_set_text ( combofix,
-				    "" );
-	    gtk_combofix_set_all_visible_rows (combofix);
-	    return FALSE;
-	}
+        if (completed_string)
+        {
+            gtk_combofix_set_text ( combofix, new_string );
+            g_free ( new_string );
+        }
+        else
+        {
+            /* completed_string still NULL here means that even the first letter cannot
+             * be set, so show all the list and erase the entry */
+            gtk_combofix_set_text ( combofix, "" );
+            gtk_combofix_set_all_visible_rows (combofix);
+        }
     }
 
     if ( insert_text
 	 &&
 	 completed_string )
     {
-	/* there is a completed_string, we set it in the entry only when inserting some text */
-	gint position;
+        /* there is a completed_string, we set it in the entry only when inserting some text */
+        gint position;
 
-	position = gtk_editable_get_position ( GTK_EDITABLE (combofix -> entry));
-	gtk_combofix_set_text ( combofix,
-				completed_string );
-	gtk_editable_set_position ( GTK_EDITABLE (GTK_EDITABLE (combofix -> entry)),
-				    position );
+        position = gtk_editable_get_position ( GTK_EDITABLE (combofix -> entry));
+        gtk_combofix_set_text ( combofix, completed_string );
+        gtk_editable_set_position ( GTK_EDITABLE (GTK_EDITABLE (combofix -> entry)),
+                        position );
 
-	/* set the selection here doesn't work, so we will do it at the expose event */
-	block_expose_event = 0;
+        /* set the selection here doesn't work, so we will do it at the expose event */
+        block_expose_event = 0;
     }
 
     /* show the popup */
@@ -884,12 +808,12 @@
 	 ||
 	 combofix -> visible_items < combofix -> max_items))
     {
-	gtk_combofix_set_popup_position ( combofix );
-	gtk_widget_show ( combofix -> popup );
-	gtk_window_set_modal (GTK_WINDOW (combofix -> popup), TRUE);
+        gtk_combofix_set_popup_position ( combofix );
+        gtk_widget_show ( combofix -> popup );
+        gtk_window_set_modal (GTK_WINDOW (combofix -> popup), TRUE);
     }
     else
-	gtk_combofix_hide_popup (combofix);
+	    gtk_combofix_hide_popup (combofix);
     return TRUE;
 }
 
@@ -952,98 +876,93 @@
     combofix -> visible_items = 0;
     model = GTK_TREE_MODEL (combofix -> store);
     path = gtk_tree_path_new_first ();
-    path_ok = gtk_tree_model_get_iter ( model,
-					&iter,
-					path );
+    path_ok = gtk_tree_model_get_iter ( model, &iter, path );
 
     while (path_ok)
     {
-	gchar *model_string;
-	gint show_row;
-	gint model_string_length;
-
-	gtk_tree_model_get ( model,
-			     &iter,
-			     COMBOFIX_COL_REAL_STRING, &model_string,
-			     COMBOFIX_COL_SEPARATOR, &separator,
-			     -1 );
-
-	/* this avoid to have 2 separators following,
-	 * or a separator at the begining */
-	if (separator)
-	{
-	    if (text_written)
-	    {
-		show_row = 1;
-		text_written = FALSE;
-	    }
-	    else
-		show_row = 0;
-	}
-	else
-	{
-	    model_string_length = strlen (model_string);
+        gchar *model_string;
+        gint show_row;
+        gint model_string_length;
 
-	    if ( combofix -> case_sensitive )
-		show_row = !strncmp ( model_string,
-				      string,
-				      MIN (length, model_string_length));
-	    else
-		show_row = !g_strncasecmp ( model_string,
-					    string,
-					    MIN (length, model_string_length));
+        gtk_tree_model_get ( model,
+                     &iter,
+                     COMBOFIX_COL_REAL_STRING, &model_string,
+                     COMBOFIX_COL_SEPARATOR, &separator,
+                     -1 );
+        /* this avoid to have 2 separators following,
+         * or a separator at the begining */
+        if (separator)
+        {
+            if (text_written)
+            {
+                show_row = 1;
+                text_written = FALSE;
+            }
+            else
+                show_row = 0;
+        }
+        else
+        {
+            model_string_length = strlen (model_string);
 
-	    if (show_row)
-	    {
-		/* if the current checked string is exactly the same as the wanted string,
-		 * we keep it for completion, else we keep only the first approximation */
-		if (model_string_length == length)
-		    complete_string = model_string;
+            if ( combofix -> case_sensitive )
+            {
+                show_row = !strncmp ( model_string,
+                          string,
+                          MIN (length, model_string_length));
+            }
+            else
+                show_row = !g_strncasecmp ( model_string,
+                            string,
+                            MIN (length, model_string_length));
 
-		if (!complete_string
-		    &&
-		    model_string_length > length )
-		    complete_string = model_string;
-		combofix -> visible_items = combofix -> visible_items + 1;
+            if (show_row)
+            {
+            /* if the current checked string is exactly the same as the wanted string,
+             * we keep it for completion, else we keep only the first approximation */
+            if (model_string_length == length)
+                complete_string = model_string;
 
-		text_written = TRUE;
-	    }
-	}
-	gtk_tree_store_set ( GTK_TREE_STORE (model),
-			     &iter,
-			     COMBOFIX_COL_VISIBLE, show_row,
-			     -1 );
+            if (!complete_string
+                &&
+                model_string_length > length )
+                complete_string = model_string;
+            combofix -> visible_items = combofix -> visible_items + 1;
+            
+            text_written = TRUE;
+            }
+        }
+        gtk_tree_store_set ( GTK_TREE_STORE (model),
+                     &iter,
+                     COMBOFIX_COL_VISIBLE, show_row,
+                     -1 );
 
-	/* increment the path :
-	 * 	go to see the children only if the mother is showed */
-	if ( gtk_tree_model_iter_has_child ( model,
-					     &iter)
-	     &&
-	     show_row )
-	    gtk_tree_path_down (path);
-	else
-	    gtk_tree_path_next (path);
+        /* increment the path :
+         * 	go to see the children only if the mother is showed */
+        if ( gtk_tree_model_iter_has_child ( model, &iter )
+             &&
+             show_row )
+            gtk_tree_path_down (path);
+        else
+            gtk_tree_path_next (path);
 
-	path_ok = gtk_tree_model_get_iter ( model,
-					    &iter,
-					    path );
+        path_ok = gtk_tree_model_get_iter ( model, &iter, path );
 
-	/* if path_ok is FALSE, perhaps we are on the end of the children list... */
-	if (!path_ok
-	    &&
-	    gtk_tree_path_get_depth (path) > 1)
-	{
-	    gtk_tree_path_up (path);
-	    gtk_tree_path_next (path);
-	    path_ok = gtk_tree_model_get_iter ( model,
-						&iter,
-						path );
-	}
+        /* if path_ok is FALSE, perhaps we are on the end of the children list... */
+        if (!path_ok
+            &&
+            gtk_tree_path_get_depth (path) > 1)
+        {
+            gtk_tree_path_up (path);
+            gtk_tree_path_next (path);
+            path_ok = gtk_tree_model_get_iter ( model, &iter, path );
+        }
     }
 
     gtk_tree_path_free (path);
 
     gtk_tree_view_expand_all ( GTK_TREE_VIEW (combofix -> tree_view));
+
     return complete_string;
 }
 

Index: gsb_currency.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_currency.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- gsb_currency.c	16 Nov 2009 20:19:19 -0000	1.48
+++ gsb_currency.c	19 Nov 2009 20:13:45 -0000	1.49
@@ -250,6 +250,7 @@
 gboolean gsb_currency_update_combobox_currency_list ( void )
 {
     GSList *list_tmp;
+    gint handler_id;
     gint old_currency_number = -1;
 	gchar* tmpstr;
 
@@ -263,24 +264,43 @@
      * try to find why. */
     if ( detail_devise_compte )
     {
-        g_signal_handler_block ( (gpointer *) detail_devise_compte,
-                            (gulong) g_object_get_data ( G_OBJECT 
-                            (detail_devise_compte), "changed-hook" ) );
-        old_currency_number = gtk_combo_box_get_active (GTK_COMBO_BOX 
+        handler_id = (gulong) g_object_get_data ( G_OBJECT 
+                            (detail_devise_compte), "changed-hook" );
+        if ( handler_id > 0 )
+        {
+            g_signal_handler_block ( (gpointer *) detail_devise_compte,
+                            handler_id );
+            old_currency_number = gtk_combo_box_get_active (GTK_COMBO_BOX 
                             (detail_devise_compte));
+        }
     }
     if ( combo_devise_totaux_tiers )
-        g_signal_handler_block ( (gpointer *) combo_devise_totaux_tiers,
+    {
+        handler_id = (gulong) g_object_get_data ( G_OBJECT 
+                            (combo_devise_totaux_tiers), "changed-hook" );
+        if ( handler_id > 0 )
+            g_signal_handler_block ( (gpointer *) combo_devise_totaux_tiers,
                             (gulong) g_object_get_data ( G_OBJECT 
                             (combo_devise_totaux_tiers), "changed-hook" ) );
+    }
     if ( combo_devise_totaux_categ )
-        g_signal_handler_block ( (gpointer *) combo_devise_totaux_categ,
+    {
+        handler_id = (gulong) g_object_get_data ( G_OBJECT 
+                            (combo_devise_totaux_categ), "changed-hook" );
+        if ( handler_id > 0 )
+            g_signal_handler_block ( (gpointer *) combo_devise_totaux_categ,
                             (gulong) g_object_get_data ( G_OBJECT 
                             (combo_devise_totaux_categ), "changed-hook" ) );
+    }
     if ( combo_devise_totaux_ib )
-        g_signal_handler_block ( (gpointer *) combo_devise_totaux_ib,
+    {
+        handler_id = (gulong) g_object_get_data ( G_OBJECT 
+                            (combo_devise_totaux_ib), "changed-hook" );
+        if ( handler_id > 0 )
+            g_signal_handler_block ( (gpointer *) combo_devise_totaux_ib,
                             (gulong) g_object_get_data ( G_OBJECT 
                             (combo_devise_totaux_ib), "changed-hook" ) );
+    }
 
     gtk_list_store_clear (GTK_LIST_STORE (combobox_currency_store));
     list_tmp = gsb_data_currency_get_currency_list ();
@@ -323,37 +343,56 @@
 
     if ( detail_devise_compte )
     {
-        gtk_combo_box_set_active ( GTK_COMBO_BOX (detail_devise_compte), 
-                        old_currency_number );
-        g_signal_handler_unblock ( detail_devise_compte,
+        handler_id = (gulong) g_object_get_data ( G_OBJECT 
+                            (detail_devise_compte), "changed-hook" );
+        {
+            gtk_combo_box_set_active ( GTK_COMBO_BOX (detail_devise_compte), 
+                            old_currency_number );
+            g_signal_handler_unblock ( detail_devise_compte,
                             (gulong) g_object_get_data ( G_OBJECT 
                             (detail_devise_compte), "changed-hook" ) );
+        }
     }
     if ( combo_devise_totaux_tiers )
     {
-        gtk_combo_box_set_active ( GTK_COMBO_BOX (combo_devise_totaux_tiers), 
-                        old_currency_number );
-        g_signal_handler_unblock ( (gpointer *) combo_devise_totaux_tiers,
+        handler_id = (gulong) g_object_get_data ( G_OBJECT 
+                            (combo_devise_totaux_tiers), "changed-hook" );
+        if ( handler_id > 0 )
+        {
+            gtk_combo_box_set_active ( GTK_COMBO_BOX (combo_devise_totaux_tiers), 
+                            old_currency_number );
+            g_signal_handler_unblock ( (gpointer *) combo_devise_totaux_tiers,
                             (gulong) g_object_get_data ( G_OBJECT 
                             (combo_devise_totaux_tiers), "changed-hook" ) );
+        }
     }
     if ( combo_devise_totaux_categ )
     {
-        gtk_combo_box_set_active ( GTK_COMBO_BOX (combo_devise_totaux_categ), 
-                        old_currency_number );
-        g_signal_handler_unblock ( (gpointer *) combo_devise_totaux_categ,
+        handler_id = (gulong) g_object_get_data ( G_OBJECT 
+                            (combo_devise_totaux_categ), "changed-hook" );
+        if ( handler_id > 0 )
+        {
+            gtk_combo_box_set_active ( GTK_COMBO_BOX (combo_devise_totaux_categ), 
+                            old_currency_number );
+            g_signal_handler_unblock ( (gpointer *) combo_devise_totaux_categ,
                             (gulong) g_object_get_data ( G_OBJECT 
                             (combo_devise_totaux_categ), "changed-hook" ) );
+        }
     }
     if ( combo_devise_totaux_ib )
     {
-        gtk_combo_box_set_active ( GTK_COMBO_BOX (combo_devise_totaux_ib), 
-                        old_currency_number );
-        g_signal_handler_unblock ( (gpointer *) combo_devise_totaux_ib,
+        handler_id = (gulong) g_object_get_data ( G_OBJECT 
+                            (combo_devise_totaux_ib), "changed-hook" );
+        if ( handler_id > 0 )
+        {
+            gtk_combo_box_set_active ( GTK_COMBO_BOX (combo_devise_totaux_ib), 
+                            old_currency_number );
+            g_signal_handler_unblock ( (gpointer *) combo_devise_totaux_ib,
                             (gulong) g_object_get_data ( G_OBJECT 
                             (combo_devise_totaux_ib), "changed-hook" ) );
+        }
     }
-    
+
     return FALSE;
 }
 

Index: export_csv.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/export_csv.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- export_csv.c	18 Nov 2009 21:00:03 -0000	1.24
+++ export_csv.c	19 Nov 2009 20:13:45 -0000	1.25
@@ -34,6 +34,7 @@
 #include "./gsb_data_account.h"
 #include "./gsb_data_archive_store.h"
 #include "./gsb_data_budget.h"
+#include "./gsb_data_category.h"
 #include "./gsb_data_currency.h"
 #include "./gsb_data_fyear.h"
 #include "./gsb_data_payee.h"
@@ -631,7 +632,7 @@
 			csv_field_rappro = my_strdup ( gsb_data_reconcile_get_name ( gsb_data_transaction_get_reconcile_number ( pSplitTransaction ) ) );
 		    }
 
-		    /* met le ch㨱ue si c'est un type 㠠num㩲otation automatique */
+		    /* met le chèque si c'est un type à numéotation automatique */
 		    payment_method = gsb_data_transaction_get_method_of_payment_number ( pSplitTransaction );
 		    if (gsb_data_payment_get_automatic_numbering (payment_method))
 		    {



More information about the cvs mailing list