[grisbi-cvs] [SCM] grisbi branch, pbiava_gestion_banques, updated. upstream_version_0_9_1-50-g0782c05
Pierre Biava
nobody at users.sourceforge.net
Tue May 17 21:27:09 CEST 2011
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, pbiava_gestion_banques has been updated
via 0782c056c91fba8d0b250025d82897842f2872b3 (commit)
via 0a3444ae09d8f09db0fe26a0a7ddab2fbeb926db (commit)
from 5c3e061638860689f0feb23e620b20a85f8c189e (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 0782c056c91fba8d0b250025d82897842f2872b3
Author: pbiava <pierre.biava at nerim.net>
Date: Tue May 17 21:26:25 2011 +0200
Adding the ability to undo changes the data of bank in account properties.
commit 0a3444ae09d8f09db0fe26a0a7ddab2fbeb926db
Author: pbiava <pierre.biava at nerim.net>
Date: Sun May 15 21:27:11 2011 +0200
Selection of suitable reconciliation to the transaction
-----------------------------------------------------------------------
Changes:
diff --git a/src/gsb_account_property.c b/src/gsb_account_property.c
index fcc8266..006c87a 100644
--- a/src/gsb_account_property.c
+++ b/src/gsb_account_property.c
@@ -668,7 +668,7 @@ gboolean gsb_account_property_changed_bank_label ( GtkWidget *combobox,
gpointer null )
{
gint bank_number;
-devel_debug (NULL);
+
if (!combobox)
return FALSE;
diff --git a/src/gsb_bank.c b/src/gsb_bank.c
index 7875869..6db2608 100644
--- a/src/gsb_bank.c
+++ b/src/gsb_bank.c
@@ -48,6 +48,7 @@
#include "structures.h"
#include "traitement_variables.h"
#include "utils.h"
+#include "utils_editables.h"
#include "erreur.h"
/*END_INCLUDE*/
@@ -56,8 +57,6 @@ static gboolean gsb_bank_add ( GtkWidget *button,
gpointer null );
static void gsb_bank_bic_code_changed ( GtkEntry *entry, gpointer data );
static void gsb_bank_code_changed ( GtkEntry *entry, gpointer data );
-static gboolean gsb_bank_combobox_changed ( GtkWidget *combobox,
- gboolean default_func (gint, gint));
static gboolean gsb_bank_create_combobox_model ( void );
static GtkWidget *gsb_bank_create_form ( GtkWidget *parent,
GtkWidget *combobox );
@@ -105,8 +104,8 @@ static GtkWidget *delete_bank_button;
static GtkWidget *bank_name;
static GtkWidget *bank_code;
static GtkWidget *bank_BIC;
-static GtkWidget *bank_tel;
static GtkWidget *bank_adr;
+static GtkWidget *bank_tel;
static GtkWidget *bank_mail;
static GtkWidget *bank_web;
static GtkWidget *bank_contact_name;
@@ -160,15 +159,15 @@ GtkWidget *gsb_bank_create_combobox ( gint index )
(GtkTreeViewRowSeparatorFunc) gsb_bank_list_check_separator,
NULL, NULL );
+ /* set the index */
+ gsb_bank_list_set_bank ( combo_box, index );
+
/* the signal just check if we select new bank, to show the dialog to add a new bank */
g_signal_connect ( G_OBJECT (combo_box),
"changed",
G_CALLBACK ( gsb_bank_list_changed ),
NULL );
- /* set the index */
- gsb_bank_list_set_bank ( combo_box, index );
-
return combo_box;
}
@@ -214,13 +213,17 @@ gboolean gsb_bank_list_set_bank ( GtkWidget *combobox,
{
GtkTreeIter iter;
-devel_debug_int (bank_number);
if ( !combobox )
return FALSE;
- if (!gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( bank_list_model ), &iter ) )
+ if ( !gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( bank_list_model ), &iter ) )
return FALSE;
+ /* on bloque la fonction de callback */
+ g_signal_handlers_block_by_func ( G_OBJECT ( combobox ),
+ gsb_bank_list_changed,
+ NULL );
+
do
{
gint current_bank;
@@ -239,43 +242,15 @@ devel_debug_int (bank_number);
}
while ( gtk_tree_model_iter_next ( GTK_TREE_MODEL ( bank_list_model ), &iter ) );
- return FALSE;
-}
-
-
-
-/**
- * called when the place change in the bank combobox
- *
- * \param combobox The reference Combobox
- * \param default_func the function to call to change the value in memory
- *
- * \return FALSE
- */
-static gboolean gsb_bank_combobox_changed ( GtkWidget *combobox,
- gboolean default_func (gint, gint))
-{
- gint number_for_func;
-devel_debug (NULL);
- /* just to be sure... */
- if (!default_func || !combobox)
- return FALSE;
-
- number_for_func = GPOINTER_TO_INT ( g_object_get_data (G_OBJECT (combobox), "number_for_func"));
-printf ("number_for_func = %d\n", number_for_func);
- default_func ( number_for_func,
- gsb_bank_list_get_bank_number (combobox));
-
- /* Mark file as modified */
- if ( etat.modification_fichier == 0 )
- modification_fichier ( TRUE );
+ /* on débloque la fonction de callback */
+ g_signal_handlers_unblock_by_func ( G_OBJECT ( combobox ),
+ gsb_bank_list_changed,
+ NULL );
return FALSE;
}
-
-
/**
* callback called when click on the edit-bank in the property of account
* show a window with the parameters of the bank in the combobox
@@ -289,7 +264,7 @@ gboolean gsb_bank_edit_from_button ( GtkWidget *button,
GtkWidget *combobox )
{
gint bank_number;
-devel_debug (NULL);
+
bank_number = gsb_bank_list_get_bank_number ( combobox );
/* if bank_number = 0, it's none ; -1 : it's new bank, so don't edit */
@@ -386,15 +361,7 @@ static gboolean gsb_bank_update_selected_line_model ( GtkWidget *combobox )
/* restore the selection */
if ( combobox )
- {
- g_signal_handlers_block_by_func ( G_OBJECT ( combobox ),
- gsb_bank_list_changed,
- NULL );
gsb_bank_list_set_bank ( combobox, save_bank_number );
- g_signal_handlers_unblock_by_func ( G_OBJECT ( combobox ),
- gsb_bank_list_changed,
- NULL );
- }
return TRUE;
}
@@ -439,12 +406,11 @@ static gboolean gsb_bank_list_changed ( GtkWidget *combobox,
gpointer null )
{
gint bank_number;
-devel_debug (NULL);
+
if (!combobox)
- return FALSE;
+ return FALSE;
bank_number = gsb_bank_list_get_bank_number (combobox);
-printf ("bank_number = %d\n", bank_number );
/* check if not new bank, ie -2 */
if ( bank_number != -2 )
@@ -458,11 +424,11 @@ printf ("bank_number = %d\n", bank_number );
/* asked to add a new bank */
bank_number = gsb_bank_edit_bank ( bank_number, combobox );
+
return FALSE;
}
-
/* ---------------- the second part is on the parameters page of the banks ------------------------ */
@@ -1057,7 +1023,7 @@ static gboolean gsb_bank_edit_bank ( gint bank_number,
{
GtkWidget *dialog, *form, *scrolled_window, *vbox;
gint result;
-devel_debug_int (bank_number);
+
dialog = gtk_dialog_new_with_buttons ( _("Edit bank"),
GTK_WINDOW ( run.window ),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -1102,12 +1068,15 @@ devel_debug_int (bank_number);
if ( result == GTK_RESPONSE_APPLY )
{
if ( bank_number == -2 )
- {
bank_number = gsb_data_bank_new ( _("New bank") );
- gsb_bank_update_selected_line_model ( combobox );
- }
+
gsb_bank_update_bank_data ( bank_number );
+ gsb_bank_update_selected_line_model ( combobox );
gsb_bank_list_set_bank ( combobox, bank_number );
+
+ /* Mark file as modified */
+ if ( etat.modification_fichier == 0 )
+ modification_fichier ( TRUE );
}
else
{
@@ -1190,6 +1159,7 @@ static gboolean gsb_bank_add ( GtkWidget *button,
gpointer null )
{
gint bank_number;
+
/* create the new bank */
bank_number = gsb_data_bank_new (_("New bank"));
@@ -1375,9 +1345,88 @@ static void gsb_bank_bic_code_changed ( GtkEntry *entry, gpointer data )
* */
static void gsb_bank_update_bank_data ( gint bank_number )
{
+ GtkTextBuffer *buffer;
+
+ devel_debug_int ( bank_number );
+ /* set bank_name */
+ if ( gtk_entry_get_text_length ( GTK_ENTRY ( bank_name ) ) > 0 )
+ gsb_data_bank_set_name ( bank_number, gtk_entry_get_text ( GTK_ENTRY ( bank_name ) ) );
+ else
+ gsb_data_bank_set_name ( bank_number, _("New bank") );
+
+ /* set bank_code */
+ if ( gtk_entry_get_text_length ( GTK_ENTRY ( bank_code ) ) > 0 )
+ gsb_data_bank_set_code ( bank_number, gtk_entry_get_text ( GTK_ENTRY ( bank_code ) ) );
+ else
+ gsb_data_bank_set_code ( bank_number, "" );
+
+ /* set bank_BIC */
+ if ( gtk_entry_get_text_length ( GTK_ENTRY ( bank_BIC ) ) > 0 )
+ gsb_data_bank_set_bic ( bank_number, gtk_entry_get_text ( GTK_ENTRY ( bank_BIC ) ) );
+ else
+ gsb_data_bank_set_bic ( bank_number, "" );
+
+ /* set bank_adr */
+ buffer = gtk_text_view_get_buffer ( GTK_TEXT_VIEW ( bank_adr ) );
+ if ( gtk_text_buffer_get_char_count ( buffer ) > 0 )
+ gsb_data_bank_set_bank_address ( bank_number,
+ gsb_editable_text_view_get_content ( bank_adr ) );
+ else
+ gsb_data_bank_set_bank_address ( bank_number, "" );
+
+ /* set bank_tel */
+ if ( gtk_entry_get_text_length ( GTK_ENTRY ( bank_tel ) ) > 0 )
+ gsb_data_bank_set_bank_tel ( bank_number, gtk_entry_get_text ( GTK_ENTRY ( bank_tel ) ) );
+ else
+ gsb_data_bank_set_bank_tel ( bank_number, "" );
+
+ /* set bank_mail */
+ if ( gtk_entry_get_text_length ( GTK_ENTRY ( bank_mail ) ) > 0 )
+ gsb_data_bank_set_bank_mail ( bank_number, gtk_entry_get_text ( GTK_ENTRY ( bank_mail ) ) );
+ else
+ gsb_data_bank_set_bank_mail ( bank_number, "" );
+
+ /* set bank_web */
+ if ( gtk_entry_get_text_length ( GTK_ENTRY ( bank_web ) ) > 0 )
+ gsb_data_bank_set_bank_web ( bank_number, gtk_entry_get_text ( GTK_ENTRY ( bank_web ) ) );
+ else
+ gsb_data_bank_set_bank_web ( bank_number, "" );
+
+ /* set contact_name */
+ if ( gtk_entry_get_text_length ( GTK_ENTRY ( bank_contact_name ) ) > 0 )
+ gsb_data_bank_set_correspondent_name ( bank_number, gtk_entry_get_text ( GTK_ENTRY ( bank_contact_name ) ) );
+ else
+ gsb_data_bank_set_correspondent_name ( bank_number, "" );
+
+ /* set contact_tel */
+ if ( gtk_entry_get_text_length ( GTK_ENTRY ( bank_contact_tel ) ) > 0 )
+ gsb_data_bank_set_correspondent_tel ( bank_number, gtk_entry_get_text ( GTK_ENTRY ( bank_contact_tel ) ) );
+ else
+ gsb_data_bank_set_correspondent_tel ( bank_number, "" );
+
+ /* set contact_mail */
+ if ( gtk_entry_get_text_length ( GTK_ENTRY ( bank_contact_mail ) ) > 0 )
+ gsb_data_bank_set_correspondent_mail ( bank_number, gtk_entry_get_text ( GTK_ENTRY ( bank_contact_mail ) ) );
+ else
+ gsb_data_bank_set_correspondent_mail ( bank_number, "" );
+
+ /* set contact_fax */
+ if ( gtk_entry_get_text_length ( GTK_ENTRY ( bank_contact_fax ) ) > 0 )
+ gsb_data_bank_set_correspondent_fax ( bank_number, gtk_entry_get_text ( GTK_ENTRY ( bank_contact_fax ) ) );
+ else
+ gsb_data_bank_set_correspondent_fax ( bank_number, "" );
+
+ /* set bank_notes */
+ buffer = gtk_text_view_get_buffer ( GTK_TEXT_VIEW ( bank_adr ) );
+ if ( gtk_text_buffer_get_char_count ( buffer ) > 0 )
+ gsb_data_bank_set_bank_note ( bank_number,
+ gsb_editable_text_view_get_content ( bank_notes ) );
+ else
+ gsb_data_bank_set_bank_note ( bank_number, "" );
}
+
/* Local Variables: */
/* c-basic-offset: 4 */
/* End: */
diff --git a/src/gsb_transactions_list.c b/src/gsb_transactions_list.c
index 4544041..de13533 100644
--- a/src/gsb_transactions_list.c
+++ b/src/gsb_transactions_list.c
@@ -92,7 +92,7 @@ static gboolean gsb_transactions_list_change_sort_type ( GtkWidget *menu_item,
gint *no_column );
static gboolean gsb_transactions_list_check_mark ( gint transaction_number );
static gint gsb_transactions_list_choose_reconcile ( gint account_number,
- gint selected_reconcile_number );
+ gint transaction_number );
static gboolean gsb_transactions_list_clone_template ( GtkWidget *menu_item,
gpointer null );
static gint gsb_transactions_list_clone_transaction ( gint transaction_number,
@@ -1925,8 +1925,7 @@ gboolean gsb_transactions_list_switch_R_mark ( gint transaction_number )
* associate the transaction with a reconcile */
gint reconcile_number;
- reconcile_number = gsb_transactions_list_choose_reconcile ( account_number,
- gsb_data_transaction_get_reconcile_number (transaction_number));
+ reconcile_number = gsb_transactions_list_choose_reconcile ( account_number,transaction_number );
if (!reconcile_number)
return FALSE;
@@ -1992,12 +1991,12 @@ gboolean gsb_transactions_list_switch_R_mark ( gint transaction_number )
* to choose one
*
* \param account_number
- * \param selected_reconcile_number if not null, we will select that reconcile in the list
+ * \param transaction_number, we will select that reconcile in the list
*
* \return the number of the chosen reconcile or 0 if cancel
* */
gint gsb_transactions_list_choose_reconcile ( gint account_number,
- gint selected_reconcile_number )
+ gint transaction_number )
{
GtkWidget *dialog;
GtkWidget *tree_view;
@@ -2097,35 +2096,65 @@ gint gsb_transactions_list_choose_reconcile ( gint account_number,
/* fill the list */
tmp_list = gsb_data_reconcile_get_reconcile_list ();
+
while (tmp_list)
{
- reconcile_number = gsb_data_reconcile_get_no_reconcile (tmp_list -> data);
+ reconcile_number = gsb_data_reconcile_get_no_reconcile ( tmp_list -> data );
- if (gsb_data_reconcile_get_account (reconcile_number) == account_number)
- {
- gchar *init_date, *final_date;
-
- init_date = gsb_format_gdate (gsb_data_reconcile_get_init_date (reconcile_number));
- final_date = gsb_format_gdate (gsb_data_reconcile_get_final_date (reconcile_number));
-
- gtk_list_store_append ( GTK_LIST_STORE (store),
- &iter );
- gtk_list_store_set ( GTK_LIST_STORE (store),
- &iter,
- RECONCILE_CHOOSE_NAME, gsb_data_reconcile_get_name (reconcile_number),
- RECONCILE_CHOOSE_INIT_DATE, init_date,
- RECONCILE_CHOOSE_FINAL_DATE, final_date,
- RECONCILE_NUMBER, reconcile_number,
- -1 );
- g_free (init_date);
- g_free (final_date);
-
- /* if we are on the reconcile to select, do it here */
- if (selected_reconcile_number == reconcile_number)
- gtk_tree_selection_select_iter ( selection,
- &iter );
- }
- tmp_list = tmp_list -> next;
+ if ( gsb_data_reconcile_get_account ( reconcile_number ) == account_number )
+ {
+ GtkTreePath *path;
+ gchar *init_date, *final_date;
+ gint tmp_reconcile_number;
+
+ init_date = gsb_format_gdate (gsb_data_reconcile_get_init_date ( reconcile_number ) );
+ final_date = gsb_format_gdate (gsb_data_reconcile_get_final_date ( reconcile_number) );
+
+ gtk_list_store_append ( GTK_LIST_STORE (store), &iter );
+ gtk_list_store_set ( GTK_LIST_STORE (store),
+ &iter,
+ RECONCILE_CHOOSE_NAME, gsb_data_reconcile_get_name (reconcile_number),
+ RECONCILE_CHOOSE_INIT_DATE, init_date,
+ RECONCILE_CHOOSE_FINAL_DATE, final_date,
+ RECONCILE_NUMBER, reconcile_number,
+ -1 );
+
+ /* select the reconcile here */
+ tmp_reconcile_number = gsb_data_transaction_get_reconcile_number ( transaction_number );
+ if ( tmp_reconcile_number == 0 )
+ {
+ GDate *date_debut;
+ GDate *date_fin;
+ const GDate *date;
+
+ date_debut = gsb_parse_date_string ( init_date );
+ date_fin = gsb_parse_date_string ( final_date );
+ date = gsb_data_transaction_get_date ( transaction_number );
+ if ( g_date_compare ( date, date_debut ) >= 0
+ &&
+ g_date_compare ( date, date_fin ) <= 0 )
+ {
+ path = gtk_tree_model_get_path ( GTK_TREE_MODEL ( store ), &iter );
+ gtk_tree_selection_select_iter ( selection, &iter );
+ gtk_tree_view_scroll_to_cell ( GTK_TREE_VIEW ( tree_view ), path, NULL, FALSE, 0.0, 0.0 );
+
+ gtk_tree_path_free ( path );
+ }
+ g_date_free ( date_debut );
+ g_date_free ( date_fin );
+ }
+ else if ( tmp_reconcile_number == reconcile_number )
+ {
+ path = gtk_tree_model_get_path ( GTK_TREE_MODEL ( store ), &iter );
+ gtk_tree_selection_select_iter ( selection, &iter );
+ gtk_tree_view_scroll_to_cell ( GTK_TREE_VIEW ( tree_view ), path, NULL, FALSE, 0.0, 0.0 );
+ }
+
+ g_free ( init_date );
+ g_free ( final_date );
+
+ }
+ tmp_list = tmp_list -> next;
}
/* run the dialog */
hooks/post-receive
--
grisbi
More information about the cvs
mailing list