[grisbi-cvs] grisbi/src categories_onglet.c, 1.200, 1.201 gsb_data_transaction.c, 1.74, 1.75 gsb_transactions_list_sort.c, 1.20, 1.21 gtk_combofix.c, 1.63, 1.64 imputation_budgetaire.c, 1.161, 1.162 tiers_onglet.c, 1.168, 1.169

Pierre Biava pbiava at users.sourceforge.net
Sun Nov 22 09:32:02 CET 2009


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

Modified Files:
	categories_onglet.c gsb_data_transaction.c 
	gsb_transactions_list_sort.c gtk_combofix.c 
	imputation_budgetaire.c tiers_onglet.c 
Log Message:
fixes bugs 745 and 746but not the bug 675

Index: gsb_data_transaction.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_transaction.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -d -r1.74 -r1.75
--- gsb_data_transaction.c	2 Nov 2009 19:56:37 -0000	1.74
+++ gsb_data_transaction.c	22 Nov 2009 08:32:00 -0000	1.75
@@ -749,35 +749,33 @@
 							return_currency_number )))
     {
 	/* there is a hard link between the transaction currency and the return currency */
-	if ( gsb_data_currency_link_get_first_currency (link_number) == transaction -> currency_number)
-	    amount = gsb_real_mul ( transaction -> transaction_amount,
-				    gsb_data_currency_link_get_change_rate (link_number));
-	else
-	    amount = gsb_real_div ( transaction -> transaction_amount,
-				    gsb_data_currency_link_get_change_rate (link_number));
+        if ( gsb_data_currency_link_get_first_currency (link_number) == transaction -> currency_number)
+            amount = gsb_real_mul ( transaction -> transaction_amount,
+                        gsb_data_currency_link_get_change_rate (link_number));
+        else
+            amount = gsb_real_div ( transaction -> transaction_amount,
+                        gsb_data_currency_link_get_change_rate (link_number));
+
+        /* The costs are still deducted from the transaction. In case of internal transfer there is no charge. */
+        amount = gsb_real_sub (amount, transaction -> exchange_fees);
     }
     else
     {
-	/* no hard link between the 2 currencies, the exchange must have been saved in the transaction itself */
-	if ( transaction -> exchange_rate.mantissa )
-	{
-	    if ( transaction -> change_between_account_and_transaction )
-		amount = gsb_real_div ( transaction -> transaction_amount,
-					transaction -> exchange_rate );
-	    else
-		amount = gsb_real_mul ( transaction -> transaction_amount,
-					transaction -> exchange_rate );
+	    /* no hard link between the 2 currencies, the exchange must have been saved in the transaction itself */
+        if ( transaction -> exchange_rate.mantissa )
+        {
+            if ( transaction -> change_between_account_and_transaction )
+            amount = gsb_real_div ( transaction -> transaction_amount,
+                        transaction -> exchange_rate );
+            else
+            amount = gsb_real_mul ( transaction -> transaction_amount,
+                        transaction -> exchange_rate );
 
-	    /* i assume we cannot have some fees if we received some money,
-	     * only when we give ; perhaps change that if we have some
-	     * cases like that but it becomes complex, because for a simple
-	     * transfer for example, we will have a false amout */
-	    if ((transaction -> transaction_amount).mantissa < 0)
-		amount = gsb_real_sub (amount, transaction -> exchange_fees);
-	}
+            /* The costs are still deducted from the transaction. In case of internal transfer there is no charge. */
+            amount = gsb_real_sub (amount, transaction -> exchange_fees);
+        }
     }
-    return gsb_real_adjust_exponent  ( amount,
-				       return_exponent );
+    return gsb_real_adjust_exponent  ( amount, return_exponent );
 }
 
 

Index: gtk_combofix.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gtk_combofix.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- gtk_combofix.c	19 Nov 2009 20:13:45 -0000	1.63
+++ gtk_combofix.c	22 Nov 2009 08:32:00 -0000	1.64
@@ -84,8 +84,7 @@
 static gboolean gtk_combofix_popup_key_press_event ( GtkWidget *popup,
 						     GdkEventKey *ev,
 						     GtkComboFix *combofix );
-
-
+static void gtk_combofix_print_visibles_rows ( GtkComboFix *combofix );
 
 /* globals variables */
 static gint block_expose_event;
@@ -439,100 +438,81 @@
 GtkWidget *scrolled_window;
 
 /* the combofix is a vbox */
-vbox = gtk_vbox_new ( FALSE,
-		      0 );
-gtk_container_add ( GTK_CONTAINER ( combofix ),
-		    vbox );
+vbox = gtk_vbox_new ( FALSE, 0 );
+gtk_container_add ( GTK_CONTAINER ( combofix ), vbox );
 gtk_widget_show ( vbox );
 
 /* a hbox wich contains the entry and the button */
-hbox = gtk_hbox_new ( FALSE,
-		      0 );
-gtk_box_pack_start ( GTK_BOX ( vbox ),
-		     hbox,
-		     TRUE,
-		     FALSE,
-		     0 );
+hbox = gtk_hbox_new ( FALSE, 0 );
+gtk_box_pack_start ( GTK_BOX ( vbox ), hbox, TRUE, FALSE, 0 );
 gtk_widget_show ( hbox );
 
 /* set the entry */
 combofix->entry = gtk_entry_new();
 g_signal_connect ( G_OBJECT (combofix -> entry),
-		   "key-press-event",
-		   G_CALLBACK ( gtk_combofix_key_press_event ),
-		   combofix );
+		                "key-press-event",
+		                G_CALLBACK ( gtk_combofix_key_press_event ),
+		                combofix );
 g_signal_connect_object ( G_OBJECT (combofix -> entry),
-			   "insert-text",
-			   G_CALLBACK (gtk_combofix_entry_insert),
-			   combofix,
-			   G_CONNECT_AFTER | G_CONNECT_SWAPPED);
+			            "insert-text",
+			            G_CALLBACK (gtk_combofix_entry_insert),
+			            combofix,
+			            G_CONNECT_AFTER | G_CONNECT_SWAPPED);
 g_signal_connect_object ( G_OBJECT (combofix -> entry),
-			   "delete-text",
-			   G_CALLBACK (gtk_combofix_entry_delete),
-			   combofix,
-			   G_CONNECT_AFTER | G_CONNECT_SWAPPED);
+			            "delete-text",
+			            G_CALLBACK (gtk_combofix_entry_delete),
+			            combofix,
+			            G_CONNECT_AFTER | G_CONNECT_SWAPPED);
 g_signal_connect_swapped ( G_OBJECT (combofix -> entry),
-			   "expose-event",
-			   G_CALLBACK (gtk_combofix_expose_entry),
-			   combofix );
+			            "expose-event",
+			            G_CALLBACK (gtk_combofix_expose_entry),
+			            combofix );
 g_signal_connect_after ( G_OBJECT ( combofix->entry ),
-			 "focus-out-event",
-			 G_CALLBACK ( gtk_combofix_focus_out ),
-			 combofix );
-gtk_box_pack_start ( GTK_BOX ( hbox ),
-		     combofix->entry,
-		     TRUE,
-		     TRUE,
-		     0 );
+			            "focus-out-event",
+			            G_CALLBACK ( gtk_combofix_focus_out ),
+			            combofix );
+gtk_box_pack_start ( GTK_BOX ( hbox ), combofix->entry, TRUE, TRUE, 0 );
 gtk_widget_show ( combofix->entry );
 
 /* set the button */
 button = gtk_button_new ();
-gtk_button_set_relief ( GTK_BUTTON (button),
-			GTK_RELIEF_NONE );
+gtk_button_set_relief ( GTK_BUTTON (button), GTK_RELIEF_NONE );
 gtk_container_add ( GTK_CONTAINER (button),
-		    gtk_arrow_new ( GTK_ARROW_DOWN,
-				    GTK_SHADOW_ETCHED_OUT) );
+		                gtk_arrow_new ( GTK_ARROW_DOWN,
+				        GTK_SHADOW_ETCHED_OUT) );
 g_signal_connect_swapped ( G_OBJECT (button),
-			   "clicked",
-			   G_CALLBACK ( gtk_combofix_show_popup ),
-			   combofix );
-gtk_box_pack_start ( GTK_BOX ( hbox ),
-		     button,
-		     FALSE,
-		     FALSE,
-		     0 );
+			            "clicked",
+			            G_CALLBACK ( gtk_combofix_show_popup ),
+			            combofix );
+gtk_box_pack_start ( GTK_BOX ( hbox ), button, FALSE, FALSE, 0 );
 gtk_widget_show_all (button);
 
 /* set the popup but don't show it */
 combofix->popup = gtk_window_new ( GTK_WINDOW_POPUP );
 g_signal_connect ( G_OBJECT (combofix -> popup),
-		   "key-press-event",
-		   G_CALLBACK (gtk_combofix_popup_key_press_event),
-		   combofix );
+		                "key-press-event",
+		                G_CALLBACK (gtk_combofix_popup_key_press_event),
+		                combofix );
 gtk_window_set_resizable ( GTK_WINDOW ( combofix->popup ), FALSE );
 
 g_signal_connect ( G_OBJECT ( combofix->popup ),
-		   "button-press-event",
-		   G_CALLBACK ( gtk_combofix_button_press ),
-		   combofix );
+		                "button-press-event",
+		                G_CALLBACK ( gtk_combofix_button_press ),
+		                combofix );
 g_signal_connect ( G_OBJECT ( combofix->popup ),
-		   "button-release-event",
-		   G_CALLBACK ( gtk_combofix_button_release_event ),
-		   combofix );
+		                "button-release-event",
+		                G_CALLBACK ( gtk_combofix_button_release_event ),
+		                combofix );
 
 frame = gtk_frame_new ( NULL );
-gtk_container_add ( GTK_CONTAINER ( combofix -> popup ),
-		    frame );
+gtk_container_add ( GTK_CONTAINER ( combofix -> popup ), frame );
 gtk_widget_show ( frame );
 
-scrolled_window = gtk_scrolled_window_new ( FALSE,
-					    FALSE );
+scrolled_window = gtk_scrolled_window_new ( FALSE, FALSE );
 gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW(scrolled_window),
-				 GTK_POLICY_AUTOMATIC,
-				 GTK_POLICY_AUTOMATIC );
-gtk_container_add ( GTK_CONTAINER (frame),
-		    scrolled_window );
+				        GTK_POLICY_AUTOMATIC,
+				        GTK_POLICY_AUTOMATIC );
+gtk_container_add ( GTK_CONTAINER (frame), scrolled_window );
 gtk_widget_show (scrolled_window);
 
 /* the tree_store is 5 columns :
@@ -733,7 +713,10 @@
     gchar *completed_string = NULL;
     const gchar *entry_string;
 
-    entry_string = gtk_entry_get_text ( GTK_ENTRY ( combofix -> entry ));
+    entry_string = gtk_entry_get_text ( GTK_ENTRY ( combofix -> entry ) );
+    //~ printf ("etape 0 entry_string = %s\n", entry_string );
+    if ( combofix -> force && !strlen ( entry_string ) )
+        gtk_combofix_show_popup ( combofix);
 
     gtk_editable_delete_selection ( GTK_EDITABLE (combofix -> entry));
 
@@ -752,7 +735,7 @@
 	    gchar *new_string = NULL;
 
         new_string = my_strdup ( entry_string );
-
+        //~ printf ("etape 1 entry_string = %s\n", entry_string );
         if ( strlen ( entry_string) )
             dialogue_warning_hint ( _("You cannot create new payee or category "
                             "and subcategory without changing the options "
@@ -783,6 +766,7 @@
             gtk_combofix_set_text ( combofix, "" );
             gtk_combofix_set_all_visible_rows (combofix);
         }
+        return FALSE;
     }
 
     if ( insert_text
@@ -808,8 +792,13 @@
 	 ||
 	 combofix -> visible_items < combofix -> max_items))
     {
+        //~ printf ("show the popup completed_string = %s\n", completed_string );
+        gtk_combofix_print_visibles_rows ( combofix );
+
+        //~ gtk_combofix_set_all_visible_rows ( combofix );
         gtk_combofix_set_popup_position ( combofix );
         gtk_widget_show ( combofix -> popup );
+        gtk_widget_grab_focus ( GTK_WIDGET ( combofix -> entry ));
         gtk_window_set_modal (GTK_WINDOW (combofix -> popup), TRUE);
     }
     else
@@ -864,6 +853,7 @@
     gboolean text_written = FALSE;
     gint separator;
 
+    devel_debug ( string);
     if (!combofix
 	||
 	!string )
@@ -889,6 +879,7 @@
                      COMBOFIX_COL_REAL_STRING, &model_string,
                      COMBOFIX_COL_SEPARATOR, &separator,
                      -1 );
+        //~ printf ("model_string = %s\n", model_string );
         /* this avoid to have 2 separators following,
          * or a separator at the begining */
         if (separator)
@@ -918,20 +909,24 @@
 
             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;
+                //~ printf ("show_row model_string = %s complete_string = %s\n", model_string, complete_string );
+                /* 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 (!complete_string
-                &&
-                model_string_length > length )
-                complete_string = model_string;
-            combofix -> visible_items = combofix -> visible_items + 1;
-            
-            text_written = TRUE;
+                if ( !complete_string && model_string_length > length )
+                    complete_string = model_string;
+                else if ( complete_string ) 
+                    if ( g_strncasecmp ( model_string, complete_string, length +1 ) < 0 )
+                        complete_string = model_string;
+                
+                combofix -> visible_items = combofix -> visible_items + 1;
+
+                text_written = TRUE;
             }
         }
+        //~ printf ("show_row = %d complete_string = %s\n", show_row, complete_string );
         gtk_tree_store_set ( GTK_TREE_STORE (model),
                      &iter,
                      COMBOFIX_COL_VISIBLE, show_row,
@@ -961,8 +956,8 @@
 
     gtk_tree_path_free (path);
 
-    gtk_tree_view_expand_all ( GTK_TREE_VIEW (combofix -> tree_view));
-
+    gtk_tree_view_expand_all ( GTK_TREE_VIEW ( combofix -> tree_view ) );
+    //~ printf ("nbre de lignes visibles = %d return complete_string = %s\n", combofix -> visible_items, complete_string );
     return complete_string;
 }
 
@@ -1046,7 +1041,6 @@
 }
 
 
-
 /**
  * set the position and the size of the popup
  *
@@ -1060,7 +1054,7 @@
     gint height;
     GdkRectangle rectangle;
     gint horizontal_separator;
-
+devel_debug (NULL);
     if (!combofix)
 	return FALSE;
 
@@ -1209,9 +1203,10 @@
  * */
 static gboolean gtk_combofix_show_popup ( GtkComboFix *combofix )
 {
+    devel_debug (NULL);
     if ( GTK_WIDGET_VISIBLE (combofix -> popup))
 	return FALSE;
-
+devel_debug (NULL);
     gtk_combofix_set_all_visible_rows (combofix);
     gtk_combofix_set_popup_position (combofix);
     gtk_widget_show ( combofix -> popup );
@@ -1796,7 +1791,59 @@
     return FALSE;
 }
 
+void gtk_combofix_print_visibles_rows ( GtkComboFix *combofix )
+{
+    GtkTreeModel *model;
+    GtkTreePath *path;
+    GtkTreeIter iter;
+    gint path_ok;
+    gint separator;
+
+    devel_debug ( NULL );
+
+    model = GTK_TREE_MODEL (combofix -> store);
+    path = gtk_tree_path_new_first ();
+    path_ok = gtk_tree_model_get_iter ( model, &iter, path );
+
+    while (path_ok)
+    {
+        gchar *model_string;
+        gint show_row;
+
+        gtk_tree_model_get ( model,
+                     &iter,
+                     COMBOFIX_COL_REAL_STRING, &model_string,
+                     COMBOFIX_COL_VISIBLE, &show_row,
+                     COMBOFIX_COL_SEPARATOR, &separator,
+                     -1 );
+        if ( show_row && !separator )
+            printf ("string = %s\n", model_string);
+        /* 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 );
+
+        /* 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);
+
 
+}
 /* Local Variables: */
 /* c-basic-offset: 4 */
 /* End: */

Index: imputation_budgetaire.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/imputation_budgetaire.c,v
retrieving revision 1.161
retrieving revision 1.162
diff -u -d -r1.161 -r1.162
--- imputation_budgetaire.c	3 Oct 2009 22:14:56 -0000	1.161
+++ imputation_budgetaire.c	22 Nov 2009 08:32:00 -0000	1.162
@@ -171,9 +171,9 @@
     gtk_tree_view_append_column ( GTK_TREE_VIEW ( budgetary_line_tree ),
 				  GTK_TREE_VIEW_COLUMN ( column ) );
 
-    /* Make balance column */
+    /* Make amount column */
     cell = gtk_cell_renderer_text_new ();
-    column = gtk_tree_view_column_new_with_attributes (_("Balance"), cell,
+    column = gtk_tree_view_column_new_with_attributes (_("Amount"), cell,
 						       "text", META_TREE_BALANCE_COLUMN,
 						       "weight", META_TREE_FONT_COLUMN,
 						       "xalign", META_TREE_XALIGN_COLUMN,

Index: categories_onglet.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/categories_onglet.c,v
retrieving revision 1.200
retrieving revision 1.201
diff -u -d -r1.200 -r1.201
--- categories_onglet.c	2 Nov 2009 19:56:37 -0000	1.200
+++ categories_onglet.c	22 Nov 2009 08:32:00 -0000	1.201
@@ -158,9 +158,9 @@
     gtk_tree_view_append_column ( GTK_TREE_VIEW ( arbre_categ ),
 				  GTK_TREE_VIEW_COLUMN ( column ) );
 
-    /* Make balance column */
+    /* Make amount column */
     cell = gtk_cell_renderer_text_new ();
-    column = gtk_tree_view_column_new_with_attributes (_("Balance"), cell,
+    column = gtk_tree_view_column_new_with_attributes (_("Amount"), cell,
 						       "text", META_TREE_BALANCE_COLUMN,
 						       "weight", META_TREE_FONT_COLUMN,
 						       "xalign", META_TREE_XALIGN_COLUMN,

Index: gsb_transactions_list_sort.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list_sort.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- gsb_transactions_list_sort.c	2 Oct 2009 21:35:04 -0000	1.20
+++ gsb_transactions_list_sort.c	22 Nov 2009 08:32:00 -0000	1.21
@@ -271,12 +271,12 @@
 gint gsb_transactions_list_sort_by_no_sort (  gint transaction_number_1,
                         gint transaction_number_2,
                         gint element_number )
-
 {
     gchar* tmpstr;
+
     switch (element_number)
     {
-	case ELEMENT_DATE:
+	case ELEMENT_DATE:  /* = 1 */
 	    return ( gsb_transactions_list_sort_by_date ( transaction_number_1,
 							  transaction_number_2));
 	    break;

Index: tiers_onglet.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/tiers_onglet.c,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -d -r1.168 -r1.169
--- tiers_onglet.c	7 Oct 2009 21:46:21 -0000	1.168
+++ tiers_onglet.c	22 Nov 2009 08:32:00 -0000	1.169
@@ -238,9 +238,9 @@
     gtk_tree_view_append_column ( GTK_TREE_VIEW ( payee_tree ),
 				  GTK_TREE_VIEW_COLUMN ( column ) );
 
-    /* Make balance column */
+    /* Make amount column */
     cell = gtk_cell_renderer_text_new ();
-    column = gtk_tree_view_column_new_with_attributes (_("Balance"), cell,
+    column = gtk_tree_view_column_new_with_attributes (_("Amount"), cell,
 						       "text", META_TREE_BALANCE_COLUMN,
 						       "weight", META_TREE_FONT_COLUMN,
 						       "xalign", META_TREE_XALIGN_COLUMN,



More information about the cvs mailing list