[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_7_97-10-g190ffe9
Pierre Biava
nobody at users.sourceforge.net
Tue Dec 28 22:11:06 CET 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 190ffe974938877f8fc6bd4803a6c296c6a18b41 (commit)
from 6e83c008c3b565221de82f1b7715ad1865a74692 (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 190ffe974938877f8fc6bd4803a6c296c6a18b41
Author: pbiava <pierre.biava at nerim.net>
Date: Tue Dec 28 22:08:35 2010 +0100
Adding the forecast tab for cash accounts
-----------------------------------------------------------------------
Changes:
diff --git a/src/bet_config.c b/src/bet_config.c
index da05c65..08c29b9 100644
--- a/src/bet_config.c
+++ b/src/bet_config.c
@@ -56,6 +56,8 @@
/*START_STATIC*/
static gboolean bet_config_change_account ( GtkWidget *combo );
static gint bet_config_get_account_from_combo ( void );
+static gboolean bet_config_general_cash_account_option_clicked ( GtkWidget *checkbutton,
+ gpointer null );
static GtkWidget *bet_config_general_get_period_widget ( GtkWidget *container );
static GtkWidget *bet_config_account_get_finance_data ( gchar *title );
static GtkWidget *bet_config_get_finance_widget ( GtkWidget *parent );
@@ -120,6 +122,19 @@ GtkWidget *bet_config_general_create_general_page ( void )
/* add a separator */
gtk_box_pack_start ( GTK_BOX ( vbox ), gtk_hseparator_new (), FALSE, FALSE, 5 );
+ /* option pour les comptes de caisse */
+ paddingbox = new_paddingbox_with_title ( vbox, FALSE, _("Option for cash accounts") );
+
+ widget = gsb_automem_checkbutton_new ( _("Add the forecast tab for cash accounts"),
+ &etat.bet_deb_cash_account_option,
+ G_CALLBACK ( bet_config_general_cash_account_option_clicked ),
+ NULL);
+
+ gtk_box_pack_start ( GTK_BOX ( paddingbox ), widget, FALSE, FALSE, 0 );
+
+ if ( etat.bet_deb_cash_account_option == 1 )
+ gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( widget ), TRUE );
+
gtk_widget_show_all ( vbox );
return vbox;
@@ -202,6 +217,35 @@ GtkWidget *bet_config_general_get_period_widget ( GtkWidget *container )
*
*
* */
+gboolean bet_config_general_cash_account_option_clicked ( GtkWidget *checkbutton,
+ gpointer null )
+{
+ GtkWidget *combo;
+
+ combo = g_object_get_data ( G_OBJECT ( account_page ), "account_combo" );
+ if ( combo )
+ {
+ gint account_number;
+
+ account_number = gsb_account_get_combo_account_number ( combo );
+ bet_config_sensitive_account_parameters ( account_number, TRUE );
+ }
+
+ bet_data_select_bet_pages ( gsb_gui_navigation_get_current_account ( ) );
+
+ if ( etat.modification_fichier == 0 )
+ modification_fichier ( TRUE );
+
+ return FALSE;
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
GtkWidget *bet_config_account_create_account_page ( void )
{
@@ -981,6 +1025,9 @@ gboolean bet_config_change_account ( GtkWidget *combo )
}
kind = gsb_data_account_get_kind ( account_number );
+ if ( etat.bet_deb_cash_account_option == 1 && kind == GSB_TYPE_CASH )
+ kind = GSB_TYPE_BANK;
+
notebook = g_object_get_data ( G_OBJECT ( account_page ), "config_notebook" );
switch ( kind )
{
@@ -1074,6 +1121,9 @@ void bet_config_sensitive_account_parameters ( gint account_number, gboolean sen
kind_account kind;
kind = gsb_data_account_get_kind ( account_number );
+ if ( etat.bet_deb_cash_account_option == 1 && kind == GSB_TYPE_CASH )
+ kind = GSB_TYPE_BANK;
+
switch ( kind )
{
case GSB_TYPE_BANK:
@@ -1194,6 +1244,8 @@ GtkWidget *bet_config_get_finance_widget ( GtkWidget *parent )
GtkWidget *widget;
GtkWidget *spin_button = NULL;
GtkWidget *button_1, *button_2;
+ GtkWidget *align;
+ GtkWidget *image;
GtkWidget *button;
vbox = gtk_vbox_new ( FALSE, 5 );
@@ -1308,13 +1360,20 @@ GtkWidget *bet_config_get_finance_widget ( GtkWidget *parent )
gtk_box_pack_start ( GTK_BOX ( hbox ), button_1, FALSE, FALSE, 5) ;
gtk_box_pack_start ( GTK_BOX ( hbox ), button_2, FALSE, FALSE, 5) ;
+ /* Apply */
+ align = gtk_alignment_new (0.5, 0.0, 0.0, 0.0);
+ gtk_box_pack_start ( GTK_BOX ( vbox ), align, FALSE, FALSE, 5);
+
+ image = gtk_image_new_from_stock ( GTK_STOCK_APPLY, GTK_ICON_SIZE_BUTTON );
button = gtk_button_new_with_label ( _("Apply") );
+ gtk_button_set_image ( GTK_BUTTON ( button ), image );
gtk_button_set_relief ( GTK_BUTTON ( button ), GTK_RELIEF_NONE );
g_signal_connect ( G_OBJECT ( button ),
"clicked",
G_CALLBACK ( bet_config_finance_apply_clicked ),
parent );
- gtk_box_pack_start ( GTK_BOX ( vbox ), button, FALSE, FALSE, 5);
+
+ gtk_container_add ( GTK_CONTAINER ( align ), button );
return vbox;
}
/**
diff --git a/src/bet_data.c b/src/bet_data.c
index 62782d5..ef86729 100644
--- a/src/bet_data.c
+++ b/src/bet_data.c
@@ -112,6 +112,8 @@ void bet_data_select_bet_pages ( gint account_number )
bet_use_budget = gsb_data_account_get_bet_use_budget ( account_number );
if ( bet_use_budget <= 0 )
kind = GSB_TYPE_ASSET;
+ else if ( etat.bet_deb_cash_account_option == 1 && kind == GSB_TYPE_CASH )
+ kind = GSB_TYPE_BANK;
tree_view = g_object_get_data ( G_OBJECT ( account_page ), "bet_estimate_treeview" );
diff --git a/src/bet_tab.c b/src/bet_tab.c
index 658eb98..66a9739 100644
--- a/src/bet_tab.c
+++ b/src/bet_tab.c
@@ -1481,35 +1481,37 @@ void bet_array_list_context_menu ( GtkWidget *tree_view )
gtk_widget_show ( menu_item );
/* Insert an account balance */
- tmp_str = g_build_filename ( GRISBI_PIXMAPS_DIR, "ac_bank_16.png", NULL);
- image = gtk_image_new_from_file ( tmp_str );
- g_free ( tmp_str );
- menu_item = gtk_image_menu_item_new_with_label (
+ if ( gsb_data_account_get_kind ( gsb_gui_navigation_get_current_account ( ) ) != GSB_TYPE_CASH )
+ {
+ tmp_str = g_build_filename ( GRISBI_PIXMAPS_DIR, "ac_bank_16.png", NULL);
+ image = gtk_image_new_from_file ( tmp_str );
+ g_free ( tmp_str );
+ menu_item = gtk_image_menu_item_new_with_label (
_("Insert the balance of a cash account") );
- gtk_image_menu_item_set_image ( GTK_IMAGE_MENU_ITEM ( menu_item ), image );
- g_signal_connect ( G_OBJECT ( menu_item ),
+ gtk_image_menu_item_set_image ( GTK_IMAGE_MENU_ITEM ( menu_item ), image );
+ g_signal_connect ( G_OBJECT ( menu_item ),
"activate",
G_CALLBACK ( bet_array_list_insert_account_balance_menu ),
tree_selection );
- gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), menu_item );
+ gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), menu_item );
- if ( origine == SPP_ORIGIN_ACCOUNT )
- {
- menu_item = gtk_image_menu_item_new_with_label ( _("Delete selection") );
- gtk_image_menu_item_set_image ( GTK_IMAGE_MENU_ITEM ( menu_item ),
+ if ( origine == SPP_ORIGIN_ACCOUNT )
+ {
+ menu_item = gtk_image_menu_item_new_with_label ( _("Delete selection") );
+ gtk_image_menu_item_set_image ( GTK_IMAGE_MENU_ITEM ( menu_item ),
gtk_image_new_from_stock ( GTK_STOCK_DELETE,
GTK_ICON_SIZE_MENU ) );
- g_signal_connect ( G_OBJECT ( menu_item ),
+ g_signal_connect ( G_OBJECT ( menu_item ),
"activate",
G_CALLBACK ( bet_array_list_delete_menu ),
tree_selection );
- gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), menu_item );
- }
-
- /* Separator */
- gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), gtk_separator_menu_item_new() );
- gtk_widget_show ( menu_item );
+ gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), menu_item );
+ }
+ /* Separator */
+ gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), gtk_separator_menu_item_new() );
+ gtk_widget_show ( menu_item );
+ }
/* redo item */
menu_item = gtk_image_menu_item_new_with_label ( _("Reset data") );
gtk_image_menu_item_set_image ( GTK_IMAGE_MENU_ITEM ( menu_item ),
diff --git a/src/gsb_file_load.c b/src/gsb_file_load.c
index ae9ceb8..0bce08d 100644
--- a/src/gsb_file_load.c
+++ b/src/gsb_file_load.c
@@ -3928,6 +3928,13 @@ void gsb_file_load_bet_part ( const gchar **attribute_names,
continue;
}
+ if ( !strcmp ( attribute_names[i], "Bet_deb_cash_account_option" ) )
+ {
+ etat.bet_deb_cash_account_option = utils_str_atoi ( attribute_values[i] );
+ i++;
+ continue;
+ }
+
/* normally, shouldn't come here */
i++;
}
diff --git a/src/gsb_file_save.c b/src/gsb_file_save.c
index 17f755d..1e60b93 100644
--- a/src/gsb_file_save.c
+++ b/src/gsb_file_save.c
@@ -2875,7 +2875,8 @@ gulong gsb_file_save_bet_part ( gulong iterator,
gint i;
/* save the general informations */
- new_string = g_markup_printf_escaped ( "\t<Bet Ddte=\"%d\" />\n", etat.bet_deb_period );
+ new_string = g_markup_printf_escaped ( "\t<Bet Ddte=\"%d\" Bet_deb_cash_account_option=\"%d\"/>\n",
+ etat.bet_deb_period, etat.bet_deb_cash_account_option );
/* append the new string to the file content */
iterator = gsb_file_save_append_part ( iterator,
diff --git a/src/structures.h b/src/structures.h
index f478234..536409f 100644
--- a/src/structures.h
+++ b/src/structures.h
@@ -120,6 +120,7 @@ struct gsb_etat_t
/* variables for the module estimate balance */
gint bet_deb_period;
+ gint bet_deb_cash_account_option; /* ajoute l'onglet prévision aux comptes de caisse */
/* variables pour le simulateur de crédits */
gdouble bet_capital;
hooks/post-receive
--
grisbi
More information about the cvs
mailing list