[grisbi-cvs] grisbi/src etats_affiche.c, 1.102, 1.103 etats_config.c, 1.159, 1.160

Pierre Biava pbiava at users.sourceforge.net
Sun Dec 14 23:33:33 CET 2008


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

Modified Files:
	etats_affiche.c etats_config.c 
Log Message:
correction bugs et traduction (fr.po) etats

Index: etats_affiche.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/etats_affiche.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -d -r1.102 -r1.103
--- etats_affiche.c	25 Oct 2008 13:47:21 -0000	1.102
+++ etats_affiche.c	14 Dec 2008 22:33:30 -0000	1.103
@@ -830,9 +830,13 @@
     {
 	gchar *text = NULL;
 	const GDate *date;
+    gint jour_debut_semaine;
 
 	date = gsb_data_transaction_get_date (transaction_number);
 
+    /* on récupère ici le premier jour de la semaine */
+    jour_debut_semaine = gsb_data_report_get_period_split_day ( current_report_number ) + 1;
+
 	/* si la date de début de période est nulle, on la met au début de la période la date de l'opération */
 	if ( !date_debut_periode )
 	{
@@ -856,14 +860,13 @@
 							      g_date_month ( date),
 							      g_date_year ( date));
 
-			if ( g_date_weekday ( date_debut_periode )  != (gsb_data_report_get_period_split_day (current_report_number) + 1 ))
+            if ( g_date_get_weekday ( date_debut_periode )  != jour_debut_semaine )
 			{
-			    if ( g_date_weekday ( date_debut_periode ) < (gsb_data_report_get_period_split_day (current_report_number)+ 1 ))
-				g_date_subtract_days ( date_debut_periode,
-						       g_date_weekday ( date_debut_periode ) + gsb_data_report_get_period_split_day (current_report_number)- 2 );
-			    else
-				g_date_subtract_days ( date_debut_periode,
-						       g_date_weekday ( date_debut_periode ) - gsb_data_report_get_period_split_day (current_report_number)- 1 );
+                do 
+                {
+                    g_date_subtract_days ( date_debut_periode, 1 );
+                }
+                while ( g_date_get_weekday ( date_debut_periode )  != jour_debut_semaine );
 			}
 			break;
 
@@ -946,7 +949,7 @@
 
 	    if ( !force
 		 &&
-		 ( g_date_weekday ( date)  != (gsb_data_report_get_period_split_day (current_report_number)+ 1 )
+		 ( g_date_get_weekday ( date)  != (gsb_data_report_get_period_split_day (current_report_number)+ 1 )
 		   &&
 		   g_date_compare ( date,
 				    date_tmp ) < 0 ))
@@ -954,15 +957,14 @@
 
 	    /* on doit retrouver la date du début de semaine et y ajouter 6j pour afficher la période */
 
-	    if ( g_date_weekday ( date_debut_periode )  != (gsb_data_report_get_period_split_day (current_report_number)+ 1 ))
-	    {
-		if ( g_date_weekday ( date_debut_periode ) < (gsb_data_report_get_period_split_day (current_report_number)+ 1 ))
-		    g_date_subtract_days ( date_debut_periode,
-					   g_date_weekday ( date_debut_periode ) + gsb_data_report_get_period_split_day (current_report_number)- 2 );
-		else
-		    g_date_subtract_days ( date_debut_periode,
-					   g_date_weekday ( date_debut_periode ) - gsb_data_report_get_period_split_day (current_report_number)- 1 );
-	    }
+	    if ( g_date_get_weekday ( date_debut_periode )  != jour_debut_semaine )
+			{
+                do 
+                {
+                    g_date_subtract_days ( date_debut_periode, 1 );
+                }
+                while ( g_date_get_weekday ( date_debut_periode )  != jour_debut_semaine );
+			}
 
 
 	    g_date_free ( date_tmp );
@@ -1096,15 +1098,14 @@
 							  g_date_month ( date),
 							  g_date_year ( date));
 
-		    if ( g_date_weekday ( date_debut_periode )  != (gsb_data_report_get_period_split_day (current_report_number)+ 1 ))
-		    {
-			if ( g_date_weekday ( date_debut_periode ) < (gsb_data_report_get_period_split_day (current_report_number)+ 1 ))
-			    g_date_subtract_days ( date_debut_periode,
-						   g_date_weekday ( date_debut_periode ) + gsb_data_report_get_period_split_day (current_report_number)- 2 );
-			else
-			    g_date_subtract_days ( date_debut_periode,
-						   g_date_weekday ( date_debut_periode ) - gsb_data_report_get_period_split_day (current_report_number)- 1 );
-		    }
+		    if ( g_date_get_weekday ( date_debut_periode )  != jour_debut_semaine )
+			{
+                do 
+                {
+                    g_date_subtract_days ( date_debut_periode, 1 );
+                }
+                while ( g_date_get_weekday ( date_debut_periode )  != jour_debut_semaine );
+			}
 		    break;
 
 		case 2:

Index: etats_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/etats_config.c,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- etats_config.c	7 Dec 2008 21:40:06 -0000	1.159
+++ etats_config.c	14 Dec 2008 22:33:30 -0000	1.160
@@ -151,6 +151,8 @@
 static void selectionne_partie_liste_compte_etat ( gint *type_compte );
 static void selectionne_partie_liste_compte_vir_etat ( gint *type_compte );
 static void sensitive_hbox_fonction_bouton_txt ( gint text_comparison_number );
+
+void etat_option_menu_changed (GtkWidget *optionmenu, GtkWidget *user_data);
 /*END_STATIC*/
 
 /* the def of the columns in the categ and budget list
@@ -880,10 +882,12 @@
     {
 	gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( bouton_separe_plages_etat ),
 				       TRUE );
-	gtk_widget_set_sensitive ( bouton_type_separe_plages_etat,
-				   TRUE );
-	gtk_widget_set_sensitive ( bouton_debut_semaine,
+	if (gtk_option_menu_get_history ( GTK_OPTION_MENU ( bouton_type_separe_plages_etat )) == 1)
+        gtk_widget_set_sensitive ( bouton_debut_semaine,
 				   TRUE );
+    else
+        gtk_widget_set_sensitive ( bouton_debut_semaine,
+				   FALSE );
     }
     else
     {
@@ -898,7 +902,6 @@
     gtk_option_menu_set_history ( GTK_OPTION_MENU ( bouton_debut_semaine ),
 				  gsb_data_report_get_period_split_day (current_report_number));
 
-
     /* onglet comptes */
 
     gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( bouton_detaille_comptes_etat ),
@@ -6456,8 +6459,10 @@
 		       "toggled",
 		       G_CALLBACK (sens_desensitive_pointeur),
 		       bouton_type_separe_plages_etat );
-    g_signal_connect ( G_OBJECT (bouton_type_separe_plages_etat ), "destroy",
-		       G_CALLBACK ( gtk_widget_destroyed), &bouton_type_separe_plages_etat );
+    g_signal_connect ( G_OBJECT (bouton_type_separe_plages_etat ), 
+               "destroy",
+		       G_CALLBACK ( gtk_widget_destroyed), 
+               &bouton_type_separe_plages_etat );
 
     gtk_table_attach ( GTK_TABLE ( table ), bouton_type_separe_plages_etat,
 		       1, 2, 0, 1, GTK_SHRINK | GTK_FILL, 0, 0, 0 );
@@ -6493,8 +6498,10 @@
 		       "toggled",
 		       G_CALLBACK (sens_desensitive_pointeur),
 		       bouton_debut_semaine );
-    g_signal_connect ( G_OBJECT (bouton_debut_semaine ), "destroy",
-		       G_CALLBACK ( gtk_widget_destroyed), &bouton_debut_semaine );
+    g_signal_connect ( G_OBJECT (bouton_debut_semaine ), 
+               "destroy",
+		       G_CALLBACK ( gtk_widget_destroyed), 
+               &bouton_debut_semaine );
 
     gtk_table_attach ( GTK_TABLE ( table ), bouton_debut_semaine,
 		       1, 2, 1, 2, GTK_SHRINK | GTK_FILL, 0, 0, 0 );
@@ -6506,12 +6513,21 @@
     while ( jours_semaine[i] )
     {
 	menu_item = gtk_menu_item_new_with_label ( _(jours_semaine[i]) );
-	gtk_object_set_data ( GTK_OBJECT ( menu_item ), _("day"), GINT_TO_POINTER (i));
+	gtk_object_set_data ( GTK_OBJECT ( menu_item ), "day", GINT_TO_POINTER (i));
 	gtk_menu_append ( GTK_MENU ( menu ), menu_item );
 	i++;
     }
     gtk_option_menu_set_menu ( GTK_OPTION_MENU ( bouton_debut_semaine ), menu );
 
+    /* on connecte le signal "changed" au bouton bouton_type_separe_plages_etat
+     * pour rendre insensible le choix du jour de la semaine pour les choix
+     * autres que la semaine. On le met ici pour que l'initialisation se fasse
+     * proprement */
+    g_signal_connect ( G_OBJECT ( bouton_type_separe_plages_etat ), 
+                  "changed",
+		          G_CALLBACK ( etat_option_menu_changed ), 
+                  bouton_debut_semaine );
+
     return ( vbox_onglet );
 }
 /******************************************************************************/
@@ -7617,8 +7633,19 @@
 }
 /******************************************************************************/
 
-
-
+/******************************************************************************/
+void etat_option_menu_changed (GtkWidget *optionmenu, GtkWidget *user_data)
+{
+    gint current_report_number = gsb_gui_navigation_get_current_report();
+    if ( gsb_data_report_get_period_split (current_report_number))
+    {
+    if (gtk_option_menu_get_history ( GTK_OPTION_MENU ( optionmenu )) == 1)
+        gtk_widget_set_sensitive ( user_data, TRUE );
+    else
+        gtk_widget_set_sensitive ( user_data, FALSE );
+    }
+}
+/******************************************************************************/
 
 /* Local Variables: */
 /* c-basic-offset: 4 */



More information about the cvs mailing list