[grisbi-cvs] grisbi/src gsb_currency.c, 1.35, 1.36 gsb_form.c, 1.104, 1.105 gsb_form.h, 1.24, 1.25 gsb_form_widget.c, 1.26, 1.27 gsb_payment_method_config.c, 1.30, 1.31

Pierre Biava pbiava at users.sourceforge.net
Fri Feb 6 23:05:06 CET 2009


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

Modified Files:
	gsb_currency.c gsb_form.c gsb_form.h gsb_form_widget.c 
	gsb_payment_method_config.c 
Log Message:
fix the bug 464

Index: gsb_payment_method_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_payment_method_config.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- gsb_payment_method_config.c	9 Jan 2009 14:49:00 -0000	1.30
+++ gsb_payment_method_config.c	6 Feb 2009 22:05:04 -0000	1.31
@@ -389,7 +389,7 @@
 			    PAYMENT_METHODS_ACCOUNT_COLUMN, account_number,
 			    -1 );
 
-	/* Create the "Debit" node */
+	/* Create the "Credit" node */
 	gtk_tree_store_append (GTK_TREE_STORE (model), &credit_iter, &account_iter);
 	gtk_tree_store_set (GTK_TREE_STORE (model), &credit_iter,
 			    PAYMENT_METHODS_NAME_COLUMN, _("Credit"),

Index: gsb_form.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- gsb_form.h	26 Oct 2008 21:40:37 -0000	1.24
+++ gsb_form.h	6 Feb 2009 22:05:04 -0000	1.25
@@ -28,6 +28,7 @@
 				       GdkEventButton *ev,
 				       gint *ptr_origin );
 gboolean gsb_form_change_sensitive_buttons ( gboolean sensitive );
+void gsb_form_check_auto_separator ( GtkWidget *entry );
 gboolean gsb_form_clean ( gint account_number );
 void gsb_form_create_widgets ();
 gboolean gsb_form_entry_get_focus ( GtkWidget *entry );

Index: gsb_form.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -d -r1.104 -r1.105
--- gsb_form.c	9 Jan 2009 14:49:00 -0000	1.104
+++ gsb_form.c	6 Feb 2009 22:05:04 -0000	1.105
@@ -89,7 +89,6 @@
 static gboolean gsb_form_button_press ( GtkWidget *vbox,
 				 GdkEventButton *ev,
 				 gpointer null );
-static void gsb_form_check_auto_separator ( GtkWidget *entry );
 static gint gsb_form_check_for_transfer ( const gchar *entry_string );
 static gboolean gsb_form_get_categories ( gint transaction_number,
 				   gint new_transaction,
@@ -110,8 +109,6 @@
 extern GtkWidget *window ;
 /*END_EXTERN*/
 
-
-
 /** label of the last statement */
 GtkWidget *label_last_statement = NULL;
 
@@ -137,8 +134,8 @@
 
 /** need to set the 2 buttons valid/cancel here and cannot
  * just show/hide the form_button_part because of the split button */
-static GtkWidget *form_button_valid;
-static GtkWidget *form_button_cancel;
+GtkWidget *form_button_valid;
+GtkWidget *form_button_cancel;
 
 /* Buttons for the form */
 GtkWidget *form_button_part;

Index: gsb_form_widget.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form_widget.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- gsb_form_widget.c	7 Jan 2009 21:18:55 -0000	1.26
+++ gsb_form_widget.c	6 Feb 2009 22:05:04 -0000	1.27
@@ -54,17 +54,18 @@
 
 /*START_STATIC*/
 static gboolean gsb_form_widget_can_focus ( gint element_number );
+static gboolean gsb_form_widget_entry_get_focus ( GtkWidget *entry, GdkEventFocus *ev, gint *ptr_origin );
 /*END_STATIC*/
 
 /*START_EXTERN*/
+extern GtkWidget *form_button_cancel;
+extern GtkWidget *form_button_valid;
 /*END_EXTERN*/
 
 /** contains a list of struct_element according to the current form */
 static GSList *form_list_widgets = NULL;
 
 
-
-
 /**
  * return the list wich contains the widgets of the form
  *
@@ -294,7 +295,7 @@
 	{
 	    g_signal_connect ( G_OBJECT ( widget ),
 			       "focus-in-event",
-			       G_CALLBACK ( gsb_form_entry_get_focus ),
+			       G_CALLBACK ( gsb_form_widget_entry_get_focus ),
 			       GINT_TO_POINTER ( element_number ));
 	    g_signal_connect ( G_OBJECT ( widget ),
 			       "focus-out-event",
@@ -724,3 +725,132 @@
 }
 
 
+/**
+ * called when an debit or credit entry get the focus, 
+ * if the entry is free, set it normal and erase the help content
+ *
+ * \param entry
+ * \param ev
+ *
+ * \return FALSE
+ * */
+gboolean gsb_form_widget_entry_get_focus ( GtkWidget *entry, GdkEventFocus *ev, gint *ptr_origin )
+{
+    GtkWidget *fyear_button;
+    GtkWidget *widget;
+    gchar *string;
+    gint element_number;
+    gint account_number;
+
+    devel_debug (NULL);
+    /* still not found, if change the content of the form, something come in entry
+     * wich is nothing, so protect here */
+    if ( !GTK_IS_WIDGET (entry)
+	 ||
+	 !GTK_IS_ENTRY (entry))
+	return FALSE;
+
+    /* it clears the entry in question */
+    if ( gsb_form_widget_check_empty (entry) )
+    {
+        gtk_entry_set_text ( GTK_ENTRY (entry), "" );
+        gsb_form_widget_set_empty ( entry,
+                    FALSE );
+    }
+    element_number = GPOINTER_TO_INT (ptr_origin);
+    account_number = gsb_form_get_account_number ();
+
+    switch ( element_number )
+    {
+    case TRANSACTION_FORM_DEBIT :
+	    /* we change the payment method to adapt it for the debit */
+        /* empty the credit */
+        widget = gsb_form_widget_get_widget (TRANSACTION_FORM_CREDIT);
+        if (!gsb_form_widget_check_empty (widget))
+        {
+            gtk_entry_set_text ( GTK_ENTRY (widget),
+                     gsb_form_widget_get_name (TRANSACTION_FORM_CREDIT));
+            gsb_form_widget_set_empty ( widget,
+                        TRUE );
+        }
+
+        widget = gsb_form_widget_get_widget ( TRANSACTION_FORM_TYPE);
+
+        /* change the method of payment if necessary
+         * (if grey, it's a child of split so do nothing) */
+        if ( widget
+             &&
+             GTK_WIDGET_SENSITIVE (widget))
+        {
+            /* change the signe of the method of payment and the contra */
+            if ( gsb_payment_method_get_combo_sign (widget) == GSB_PAYMENT_CREDIT)
+            {
+                gsb_payment_method_create_combo_list ( widget,
+                                       GSB_PAYMENT_DEBIT,
+                                       account_number, 0 );
+                /* if there is no payment method, the last function hide it, but we have
+                 * to hide the cheque element too */
+                if ( !GTK_WIDGET_VISIBLE (widget))
+                    gtk_widget_hide (gsb_form_widget_get_widget (TRANSACTION_FORM_CHEQUE));
+
+                widget = gsb_form_widget_get_widget (TRANSACTION_FORM_CONTRA);
+                if ( GTK_WIDGET_VISIBLE (widget))
+                    gsb_payment_method_create_combo_list ( gsb_form_widget_get_widget (TRANSACTION_FORM_CONTRA),
+                                       GSB_PAYMENT_CREDIT,
+                                       account_number, 0 );
+            }
+        }
+        gsb_form_check_auto_separator (entry);
+	    break;
+	case TRANSACTION_FORM_CREDIT :
+	    /* we change the payment method to adapt it for the debit */
+        /* empty the credit */
+        widget = gsb_form_widget_get_widget (TRANSACTION_FORM_DEBIT);
+        if (!gsb_form_widget_check_empty (widget))
+        {
+            gtk_entry_set_text ( GTK_ENTRY (widget),
+                     gsb_form_widget_get_name (TRANSACTION_FORM_DEBIT));
+            gsb_form_widget_set_empty ( widget,
+                        TRUE );
+        }
+        widget = gsb_form_widget_get_widget ( TRANSACTION_FORM_TYPE);
+
+        /* change the method of payment if necessary
+         * (if grey, it's a child of split so do nothing) */
+        if ( widget
+             &&
+             GTK_WIDGET_SENSITIVE (widget))
+        {
+            /* change the signe of the method of payment and the contra */
+            if ( gsb_payment_method_get_combo_sign (widget) == GSB_PAYMENT_DEBIT)
+            {
+                gsb_payment_method_create_combo_list ( widget,
+                                       GSB_PAYMENT_CREDIT,
+                                       account_number, 0 );
+                /* if there is no payment method, the last function hide it, but we have
+                 * to hide the cheque element too */
+                if ( !GTK_WIDGET_VISIBLE (widget))
+                    gtk_widget_hide (gsb_form_widget_get_widget (TRANSACTION_FORM_CHEQUE));
+
+                widget = gsb_form_widget_get_widget ( TRANSACTION_FORM_CONTRA);
+                if ( GTK_WIDGET_VISIBLE (widget))
+                    gsb_payment_method_create_combo_list ( widget,
+                                       GSB_PAYMENT_DEBIT,
+                                       account_number, 0 );
+            }
+        }
+        gsb_form_check_auto_separator (entry);
+	    break;
+    }
+    
+    /* sensitive the valid and cancel buttons */
+    gtk_widget_set_sensitive (GTK_WIDGET (form_button_valid), TRUE);
+    gtk_widget_set_sensitive (GTK_WIDGET (form_button_cancel), TRUE);
+
+    /* set the financial year on automatic by default */
+    fyear_button = gsb_form_widget_get_widget (TRANSACTION_FORM_EXERCICE);
+    if (fyear_button)
+        gsb_fyear_set_combobox_history ( fyear_button, 0 );
+
+    return FALSE;
+}

Index: gsb_currency.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_currency.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- gsb_currency.c	5 Feb 2009 22:19:46 -0000	1.35
+++ gsb_currency.c	6 Feb 2009 22:05:04 -0000	1.36
@@ -92,15 +92,15 @@
 
 
 /*START_EXTERN*/
+extern GtkWidget *combo_devise_totaux_categ;
+extern GtkWidget *combo_devise_totaux_ib;
+extern GtkWidget *combo_devise_totaux_tiers;
 extern GtkWidget *detail_devise_compte ;
 extern gint mise_a_jour_liste_comptes_accueil;
 extern gint mise_a_jour_liste_echeances_auto_accueil;
 extern gint mise_a_jour_liste_echeances_manuelles_accueil;
 extern gsb_real null_real;
 extern GtkWidget *window;
-extern GtkWidget *combo_devise_totaux_tiers;
-extern GtkWidget *combo_devise_totaux_ib;
-extern GtkWidget *combo_devise_totaux_categ;
 /*END_EXTERN*/
 
 



More information about the cvs mailing list