[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_7_3-56-g82889f6
Pierre Biava
nobody at users.sourceforge.net
Sat Sep 25 19:22:58 CEST 2010
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grisbi".
The branch, master has been updated
via 82889f629dc990a9bae8bb124be14da85e105d3a (commit)
from 4597deb133909b92e6c58c4b9b27e9f8a9efcfd0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 82889f629dc990a9bae8bb124be14da85e105d3a
Author: pbiava <pierre.biava at nerim.net>
Date: Sat Sep 25 18:55:37 2010 +0200
fixed bugs 1166 and 1167
-----------------------------------------------------------------------
Changes:
diff --git a/src/bet_future.c b/src/bet_future.c
index ec8139a..76a8ea0 100644
--- a/src/bet_future.c
+++ b/src/bet_future.c
@@ -825,7 +825,7 @@ gboolean bet_form_clean ( gint account_number )
case TRANSACTION_FORM_TYPE:
gsb_payment_method_set_combobox_history ( element -> element_widget,
- gsb_data_account_get_default_debit (account_number));
+ gsb_data_account_get_default_debit ( account_number ), TRUE );
break;
}
@@ -1403,7 +1403,7 @@ gboolean bet_future_set_form_data_from_line ( gint account_number,
gsb_form_widget_set_empty ( widget, FALSE );
widget = bet_form_widget_get_widget ( TRANSACTION_FORM_TYPE );
- gsb_payment_method_set_combobox_history ( widget, scheduled -> payment_number );
+ gsb_payment_method_set_combobox_history ( widget, scheduled -> payment_number, TRUE );
if ( scheduled -> category_number > 0 )
{
diff --git a/src/gsb_form.c b/src/gsb_form.c
index d13f015..8d8d5cf 100644
--- a/src/gsb_form.c
+++ b/src/gsb_form.c
@@ -401,7 +401,7 @@ gboolean gsb_form_fill_by_transaction ( gint transaction_number,
devel_debug_int (transaction_number);
if ( !transaction_number )
- return FALSE;
+ return FALSE;
/* get the account */
account_number = gsb_data_mix_get_account_number (transaction_number, is_transaction);
@@ -411,12 +411,12 @@ gboolean gsb_form_fill_by_transaction ( gint transaction_number,
/* if here account number = -1, it's because it's a white line or there were a problem ;
* in all case, get the current account number */
if (account_number == -1)
- account_number = gsb_form_get_account_number ();
+ account_number = gsb_form_get_account_number ();
/* show and prepare the form */
- gsb_form_show (TRUE);
+ gsb_form_show ( TRUE );
- if (!is_transaction)
+ if ( !is_transaction )
{
/* we need to set up the part of scheduler form here because changing the account
* button will change the form */
@@ -428,25 +428,26 @@ gboolean gsb_form_fill_by_transaction ( gint transaction_number,
* on white line will do the same */
if ( transaction_number == -1 )
{
- GtkWidget *date_entry;
+ GtkWidget *date_entry;
- /* if we can't touch the focus, it's because we just select a transaction, and
- * for now, select the white line, so keep the form blank */
- if (!grab_focus)
- return FALSE;
+ /* if we can't touch the focus, it's because we just select a transaction, and
+ * for now, select the white line, so keep the form blank */
+ if ( !grab_focus )
+ return FALSE;
- date_entry = gsb_form_widget_get_widget (TRANSACTION_FORM_DATE);
+ date_entry = gsb_form_widget_get_widget (TRANSACTION_FORM_DATE);
- if ( gsb_form_widget_check_empty (date_entry))
- /* for now, transaction_number_in_form is NULL so can call the next function
- * wich will prepare the form for a new transaction */
- gsb_form_button_press_event ( date_entry,
- NULL,
- GINT_TO_POINTER (TRANSACTION_FORM_DATE));
-
- gtk_editable_select_region ( GTK_EDITABLE (date_entry), 0, -1);
- gtk_widget_grab_focus ( GTK_WIDGET (date_entry));
- return FALSE;
+ if ( gsb_form_widget_check_empty (date_entry))
+ /* for now, transaction_number_in_form is NULL so can call the next function
+ * wich will prepare the form for a new transaction */
+ gsb_form_button_press_event ( date_entry,
+ NULL,
+ GINT_TO_POINTER (TRANSACTION_FORM_DATE));
+
+ gtk_editable_select_region ( GTK_EDITABLE (date_entry), 0, -1);
+ gtk_widget_grab_focus ( GTK_WIDGET (date_entry));
+
+ return FALSE;
}
/* set the number of the transaction in the form, can be -2, -3...
@@ -825,10 +826,14 @@ void gsb_form_fill_element ( gint element_number,
tmp_widget = gsb_form_widget_get_widget ( TRANSACTION_FORM_CHEQUE );
if ( GTK_WIDGET_VISIBLE (widget))
{
+ gboolean check_entry = FALSE;
+
number = gsb_data_mix_get_method_of_payment_number (transaction_number, is_transaction);
+ if ( transaction_number == - 1 )
+ check_entry = TRUE;
/* we show the cheque entry only for transactions */
- if (gsb_payment_method_set_combobox_history ( widget, number )
+ if (gsb_payment_method_set_combobox_history ( widget, number, check_entry )
&&
gsb_data_payment_get_show_entry (number)
&&
@@ -908,8 +913,7 @@ void gsb_form_fill_element ( gint element_number,
else
method = gsb_data_scheduled_get_contra_method_of_payment_number (transaction_number);
- gsb_payment_method_set_combobox_history ( widget,
- method );
+ gsb_payment_method_set_combobox_history ( widget, method, FALSE );
}
}
else
@@ -1227,12 +1231,14 @@ gboolean gsb_form_fill_from_account ( gint account_number )
* the means of payment in accordance with the type of account */
if ( element == TRANSACTION_FORM_TYPE )
{
+ gint sign;
+
if ( gsb_data_account_get_default_credit ( account_number ) == 0 )
- gtk_widget_hide ( widget );
+ sign = GSB_PAYMENT_NEUTRAL;
else
- gsb_payment_method_create_combo_list ( widget,
- GSB_PAYMENT_DEBIT,
- account_number, 0 );
+ sign = GSB_PAYMENT_DEBIT;
+
+ gsb_payment_method_create_combo_list ( widget, sign, account_number, 0 );
}
else if ( element != TRANSACTION_FORM_CONTRA
&&
@@ -1333,11 +1339,16 @@ gboolean gsb_form_clean ( gint account_number )
break;
case TRANSACTION_FORM_TYPE:
- gsb_payment_method_set_combobox_history ( element -> element_widget,
- gsb_data_account_get_default_debit ( account_number ) );
+ {
+ gint payment_number;
+
+ payment_number = gsb_data_account_get_default_debit ( account_number );
+ gsb_payment_method_set_combobox_history ( element -> element_widget, payment_number, TRUE );
gtk_widget_set_sensitive ( GTK_WIDGET ( element -> element_widget ), FALSE );
- break;
+ gsb_payment_method_show_cheque_entry_if_necessary ( payment_number );
+ break;
+ }
case TRANSACTION_FORM_CONTRA:
gtk_widget_hide ( element -> element_widget );
break;
@@ -2205,7 +2216,7 @@ gboolean gsb_form_key_press_event ( GtkWidget *widget,
payment_number = gsb_data_payment_get_number_by_name ( _("Credit card"),
account_number );
if ( payment_number )
- gsb_payment_method_set_combobox_history ( widget, payment_number );
+ gsb_payment_method_set_combobox_history ( widget, payment_number, TRUE );
return TRUE;
break;
@@ -2214,7 +2225,7 @@ gboolean gsb_form_key_press_event ( GtkWidget *widget,
payment_number = gsb_data_payment_get_number_by_name ( _("Direct deposit"),
account_number );
if ( payment_number )
- gsb_payment_method_set_combobox_history ( widget, payment_number );
+ gsb_payment_method_set_combobox_history ( widget, payment_number, TRUE );
return TRUE;
break;
@@ -2223,7 +2234,7 @@ gboolean gsb_form_key_press_event ( GtkWidget *widget,
payment_number = gsb_data_payment_get_number_by_name ( _("Check"),
account_number );
if ( payment_number )
- gsb_payment_method_set_combobox_history ( widget, payment_number );
+ gsb_payment_method_set_combobox_history ( widget, payment_number, TRUE );
return TRUE;
break;
@@ -2232,7 +2243,7 @@ gboolean gsb_form_key_press_event ( GtkWidget *widget,
payment_number = gsb_data_payment_get_number_by_name ( _("Cash withdrawal"),
account_number );
if ( payment_number )
- gsb_payment_method_set_combobox_history ( widget, payment_number );
+ gsb_payment_method_set_combobox_history ( widget, payment_number, TRUE );
return TRUE;
break;
@@ -2242,7 +2253,7 @@ gboolean gsb_form_key_press_event ( GtkWidget *widget,
payment_number = gsb_data_payment_get_number_by_name ( _("Direct debit"),
account_number );
if ( payment_number )
- gsb_payment_method_set_combobox_history ( widget, payment_number );
+ gsb_payment_method_set_combobox_history ( widget, payment_number, TRUE );
return TRUE;
break;
@@ -2253,7 +2264,7 @@ gboolean gsb_form_key_press_event ( GtkWidget *widget,
payment_number = gsb_data_payment_get_number_by_name ( _("Transfer"),
account_number );
if ( payment_number )
- gsb_payment_method_set_combobox_history ( widget, payment_number );
+ gsb_payment_method_set_combobox_history ( widget, payment_number, TRUE );
return TRUE;
break;
diff --git a/src/gsb_form_scheduler.c b/src/gsb_form_scheduler.c
index fbf6ba4..e102536 100644
--- a/src/gsb_form_scheduler.c
+++ b/src/gsb_form_scheduler.c
@@ -523,7 +523,7 @@ void gsb_form_scheduler_set_content_list ( GSList *content_list )
gsb_data_payment_get_sign (element -> element_int),
account_number, FALSE );
gsb_payment_method_set_combobox_history ( form_element -> element_widget,
- gsb_data_payment_get_similar (element -> element_int, account_number));
+ gsb_data_payment_get_similar (element -> element_int, account_number), TRUE );
break;
case TRANSACTION_FORM_CONTRA:
@@ -531,7 +531,7 @@ void gsb_form_scheduler_set_content_list ( GSList *content_list )
gsb_data_payment_get_sign (element -> element_int),
account_number, FALSE );
gsb_payment_method_set_combobox_history ( form_element -> element_widget,
- gsb_data_payment_get_similar (element -> element_int, account_number));
+ gsb_data_payment_get_similar (element -> element_int, account_number), TRUE );
break;
case TRANSACTION_FORM_EXERCICE:
diff --git a/src/gsb_form_transaction.c b/src/gsb_form_transaction.c
index 94b72c0..699a793 100644
--- a/src/gsb_form_transaction.c
+++ b/src/gsb_form_transaction.c
@@ -206,7 +206,7 @@ gboolean gsb_form_transaction_complete_form_by_payee ( const gchar *payee_name )
account_number );
/* we show the cheque entry only for transactions */
- if (gsb_payment_method_set_combobox_history ( widget, number )
+ if (gsb_payment_method_set_combobox_history ( widget, number, TRUE )
&&
gsb_data_payment_get_show_entry ( number )
&&
diff --git a/src/gsb_payment_method.c b/src/gsb_payment_method.c
index 6709851..57ea8c7 100644
--- a/src/gsb_payment_method.c
+++ b/src/gsb_payment_method.c
@@ -145,14 +145,14 @@ gboolean gsb_payment_method_create_combo_list ( GtkWidget *combo_box,
else if ( sign == GSB_PAYMENT_CREDIT )
payment_number = gsb_data_account_get_default_credit ( account_number );
- gsb_payment_method_set_combobox_history ( combo_box, payment_number );
+ gsb_payment_method_set_combobox_history ( combo_box, payment_number, FALSE );
gtk_widget_show ( combo_box );
}
else
{
gtk_widget_hide (combo_box);
- gsb_payment_method_set_cheque_entry ( 0 );
+ gsb_payment_method_show_cheque_entry_if_necessary ( 0 );
}
/* on réactive le signal du gtk_combo_box */
@@ -311,14 +311,15 @@ void gsb_payment_method_set_payment_position ( GtkWidget *combo_box,
* \return TRUE if we can set the payment_number, FALSE if it's the default wich is set
* */
gboolean gsb_payment_method_set_combobox_history ( GtkWidget *combo_box,
- gint payment_number )
+ gint payment_number,
+ gboolean check_entry )
{
gint position;
gboolean return_value;
gint account_number;
/* on sort si le moyen de paiement est déjà le bon */
- if ( gsb_payment_method_get_selected_number ( combo_box ) == payment_number )
+ if ( payment_number && gsb_payment_method_get_selected_number ( combo_box ) == payment_number )
return TRUE;
/* on bloque le signal du gtk_combo_box pour éviter de multiples appels */
@@ -328,22 +329,25 @@ gboolean gsb_payment_method_set_combobox_history ( GtkWidget *combo_box,
account_number = gsb_data_payment_get_account_number (payment_number);
position = gsb_payment_method_get_payment_position ( combo_box, payment_number );
- if (position != -1)
+ if ( position != -1 )
return_value = TRUE;
else
{
if ( gsb_payment_method_get_combo_sign ( combo_box ) == GSB_PAYMENT_CREDIT )
position = gsb_payment_method_get_payment_position ( combo_box,
gsb_data_account_get_default_credit ( account_number ) );
- else
+ else if ( gsb_payment_method_get_combo_sign ( combo_box ) == GSB_PAYMENT_DEBIT )
position = gsb_payment_method_get_payment_position ( combo_box,
gsb_data_account_get_default_debit ( account_number ) );
+ else
+ position = 0;
return_value = FALSE;
}
gtk_combo_box_set_active ( GTK_COMBO_BOX (combo_box), position );
- gsb_payment_method_set_cheque_entry ( payment_number );
+ if ( check_entry )
+ gsb_payment_method_set_cheque_entry ( payment_number );
/* on réactive le signal du gtk_combo_box */
g_signal_handlers_unblock_by_func ( combo_box,
@@ -381,7 +385,7 @@ gboolean gsb_payment_method_changed_callback ( GtkWidget *combo_box,
if ( gsb_data_payment_get_show_entry ( payment_number) )
{
/* set the next number if needed */
- if (gsb_data_payment_get_automatic_numbering (payment_number) )
+ if (gsb_data_payment_get_automatic_numbering ( payment_number ) )
{
if ( gsb_form_widget_check_empty (cheque_entry) )
{
@@ -459,7 +463,7 @@ gboolean gsb_payment_method_set_cheque_entry ( gint payment_number )
GINT_TO_POINTER ( TRANSACTION_FORM_CHEQUE ) );
}
- gtk_widget_show (cheque_entry);
+ gtk_widget_show ( cheque_entry );
}
else
{
@@ -475,6 +479,30 @@ gboolean gsb_payment_method_set_cheque_entry ( gint payment_number )
}
+/**
+ * show or hide the entry for cheque in the form if necessary
+ *
+ * \param gint payment_number
+ *
+ * \return FALSE if not cheque_entry TRUE if OK
+ * */
+gboolean gsb_payment_method_show_cheque_entry_if_necessary ( gint payment_number )
+{
+ GtkWidget *cheque_entry;
+
+ cheque_entry = gsb_form_widget_get_widget ( TRANSACTION_FORM_CHEQUE );
+ if ( !cheque_entry )
+ return FALSE;
+
+ if ( gsb_data_payment_get_show_entry ( payment_number ) == TRUE )
+ gtk_widget_show ( cheque_entry );
+ else
+ gtk_widget_hide ( cheque_entry );
+
+ return TRUE;
+}
+
+
/* Local Variables: */
/* c-basic-offset: 4 */
/* End: */
diff --git a/src/gsb_payment_method.h b/src/gsb_payment_method.h
index af004d0..6ee9746 100644
--- a/src/gsb_payment_method.h
+++ b/src/gsb_payment_method.h
@@ -15,8 +15,10 @@ gboolean gsb_payment_method_create_combo_list ( GtkWidget *combo_box,
gint gsb_payment_method_get_combo_sign ( GtkWidget *combo_box );
gint gsb_payment_method_get_selected_number ( GtkWidget *combo_box );
gboolean gsb_payment_method_set_combobox_history ( GtkWidget *combo_box,
- gint payment_number );
+ gint payment_number,
+ gboolean check_entry );
void gsb_payment_method_set_payment_position ( GtkWidget *combo_box,
gint payment_number );
+gboolean gsb_payment_method_show_cheque_entry_if_necessary ( gint payment_number );
/* END_DECLARATION */
#endif
diff --git a/src/gsb_payment_method_config.c b/src/gsb_payment_method_config.c
index 33b57d5..9aa4544 100644
--- a/src/gsb_payment_method_config.c
+++ b/src/gsb_payment_method_config.c
@@ -734,7 +734,7 @@ gboolean gsb_payment_method_config_name_changed ( GtkWidget *entry,
if (GTK_WIDGET_VISIBLE (widget))
{
gsb_payment_method_set_combobox_history ( widget,
- gsb_data_account_get_default_debit (account_number));
+ gsb_data_account_get_default_debit (account_number), TRUE );
}
else
{
hooks/post-receive
--
grisbi
More information about the cvs
mailing list