[grisbi-cvs] grisbi/src accueil.c, 1.217, 1.218 gsb_currency.c, 1.44, 1.45 gsb_currency_link_config.c, 1.16, 1.17 gsb_data_form.c, 1.12, 1.13 gsb_form_transaction.c, 1.50, 1.51

Pierre Biava pbiava at users.sourceforge.net
Sat Nov 7 20:14:01 CET 2009


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

Modified Files:
	accueil.c gsb_currency.c gsb_currency_link_config.c 
	gsb_data_form.c gsb_form_transaction.c 
Log Message:
minor modifications for the links of currencies

Index: gsb_currency_link_config.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_currency_link_config.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- gsb_currency_link_config.c	24 Oct 2009 19:18:49 -0000	1.16
+++ gsb_currency_link_config.c	7 Nov 2009 19:13:59 -0000	1.17
@@ -2,6 +2,7 @@
 /*                                                                            */
 /*     Copyright (C)	2000-2006 Cédric Auger (cedric at grisbi.org)	          */
 /*			2003 Benjamin Drieu (bdrieu at april.org)		                      */
+/*                      2009 Pierre Biava (grisbi at pierre.biava.name)          */
 /* 			http://www.grisbi.org				                              */
 /*                                                                            */
 /*  This program is free software; you can redistribute it and/or modify      */
@@ -50,6 +51,7 @@
 					    GtkTreeIter *iter_to_fill );
 static GtkWidget *gsb_currency_link_config_create_list ();
 static void gsb_currency_link_config_fill_list ( GtkTreeModel *model );
+static gboolean gsb_currency_link_config_key_press ( GtkWidget *tree_view, GdkEventKey *ev );
 static gboolean gsb_currency_link_config_modify_link ( GtkWidget *tree_view );
 static gboolean gsb_currency_link_config_remove_link ( GtkWidget *tree_view );
 static gboolean gsb_currency_link_config_select_currency ( GtkTreeSelection *tree_selection,
@@ -111,6 +113,11 @@
 		       "changed",
 		       G_CALLBACK ( gsb_currency_link_config_select_currency ), 
 		       tree_model );
+    /* check the keys on the list */
+    g_signal_connect ( G_OBJECT ( tree_view ),
+                        "key_press_event",
+                        G_CALLBACK ( gsb_currency_link_config_key_press ),
+                        NULL );
 
     /* if nothing opened, all is unsensitive */
     if ( !gsb_data_account_get_accounts_amount () )
@@ -642,4 +649,22 @@
 }
 
 
+/**
+ * gère le clavier sur la liste des liens
+ *
+**/
+gboolean gsb_currency_link_config_key_press ( GtkWidget *tree_view, GdkEventKey *ev )
+{
+    switch ( ev -> keyval )
+    {
+    case GDK_Delete:    /*  del  */
+        gsb_currency_link_config_remove_link ( tree_view );
+        return TRUE;
+        break;
+    }
 
+    return FALSE;
+}
+/* Local Variables: */
+/* c-basic-offset: 4 */
+/* End: */

Index: accueil.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/accueil.c,v
retrieving revision 1.217
retrieving revision 1.218
diff -u -d -r1.217 -r1.218
--- accueil.c	26 Oct 2009 22:38:21 -0000	1.217
+++ accueil.c	7 Nov 2009 19:13:59 -0000	1.218
@@ -322,6 +322,7 @@
 					   NULL );
 
     gtk_window_set_position ( GTK_WINDOW ( dialog ), GTK_WIN_POS_CENTER_ON_PARENT );
+    gtk_widget_set_size_request ( dialog, 700, -1 );
     gtk_window_set_resizable ( GTK_WINDOW ( dialog ), TRUE );
     gtk_dialog_set_default_response ( GTK_DIALOG (dialog), GTK_RESPONSE_OK );
 

Index: gsb_currency.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_currency.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- gsb_currency.c	7 Nov 2009 08:09:57 -0000	1.44
+++ gsb_currency.c	7 Nov 2009 19:13:59 -0000	1.45
@@ -32,6 +32,7 @@
 /*START_INCLUDE*/
 #include "gsb_currency.h"
 #include "./gsb_autofunc.h"
+#include "./dialog.h"
 #include "./gsb_data_account.h"
 #include "./gsb_data_currency.h"
 #include "./gsb_data_currency_link.h"
@@ -491,12 +492,12 @@
     hbox = gtk_hbox_new ( FALSE, 0 );
     tmpstr = g_strconcat( PIXMAPS_DIR, C_DIRECTORY_SEPARATOR,
                     "flags", C_DIRECTORY_SEPARATOR,
-                    gsb_data_currency_get_code_iso4217 (transaction_currency_number),
+                    gsb_data_currency_get_code_iso4217 ( transaction_currency_number ),
                     ".png", NULL );
     pixbuf = gtk_image_new_from_file ( tmpstr );
     g_free ( tmpstr );
     gtk_box_pack_start ( GTK_BOX ( hbox ), pixbuf, FALSE, FALSE, 5 );
-    label = gtk_label_new (gsb_data_currency_get_name (transaction_currency_number));
+    label = gtk_label_new (gsb_data_currency_get_name ( transaction_currency_number ) );
     gtk_box_pack_start ( GTK_BOX ( hbox ), label, FALSE, FALSE, 0 );
     alignement = gtk_alignment_new ( 0.5, 0, 0, 0 );
     gtk_container_add ( GTK_CONTAINER ( alignement ), hbox );    
@@ -512,12 +513,12 @@
     hbox = gtk_hbox_new ( FALSE, 0 );
     tmpstr = g_strconcat( PIXMAPS_DIR, C_DIRECTORY_SEPARATOR,
                     "flags", C_DIRECTORY_SEPARATOR,
-                    gsb_data_currency_get_code_iso4217 (account_currency_number),
+                    gsb_data_currency_get_code_iso4217 ( account_currency_number ),
                     ".png", NULL );
     pixbuf = gtk_image_new_from_file ( tmpstr );
     g_free ( tmpstr );
     gtk_box_pack_start ( GTK_BOX ( hbox ), pixbuf, FALSE, FALSE, 5 );
-    label = gtk_label_new (gsb_data_currency_get_name (account_currency_number));
+    label = gtk_label_new (gsb_data_currency_get_name ( account_currency_number ) );
     gtk_box_pack_start ( GTK_BOX ( hbox ), label, FALSE, FALSE, 0 );
     alignement = gtk_alignment_new ( 0.5, 0, 0, 0 );
     gtk_container_add ( GTK_CONTAINER ( alignement ), hbox );
@@ -571,7 +572,7 @@
                GTK_SHRINK | GTK_FILL, 0, 0, 0 );
 
     /* exchange fees currency for fees */
-    label = gtk_label_new (gsb_data_currency_get_name (account_currency_number));
+    label = gtk_label_new (gsb_data_currency_get_name ( account_currency_number ) );
     gtk_misc_set_alignment ( GTK_MISC ( label ), 0.0, 0.0 );
     gtk_table_attach ( GTK_TABLE(table), label, 2, 3, 2, 3,
                GTK_SHRINK | GTK_FILL, 0, 0, 0 );
@@ -593,20 +594,21 @@
             tmpstr = gsb_real_get_string ( gsb_real_inverse ( exchange_rate ) );
         else
             tmpstr = gsb_real_get_string (exchange_rate );
-        gtk_entry_set_text ( GTK_ENTRY ( entry ), tmpstr);
+        gtk_entry_set_text ( GTK_ENTRY ( entry ), tmpstr );
         g_free ( tmpstr );
     }
 
     if ( exchange_fees.mantissa )
     {
         tmpstr = gsb_real_get_string (gsb_real_abs (exchange_fees));
-        gtk_entry_set_text ( GTK_ENTRY ( fees_entry ), tmpstr);
+        gtk_entry_set_text ( GTK_ENTRY ( fees_entry ), tmpstr );
         g_free ( tmpstr );
     }
 
     gtk_widget_show_all ( dialog );
 
     /* show the dialog */
+dialog_return:
     result = gtk_dialog_run ( GTK_DIALOG ( dialog ));
 
     if ( result == GTK_RESPONSE_OK )
@@ -622,7 +624,15 @@
                         gtk_entry_get_text ( GTK_ENTRY ( entry ) ) );
         current_exchange_fees = gsb_real_get_from_string (
                         gtk_entry_get_text ( GTK_ENTRY ( fees_entry ) ) );
+        if ( current_exchange.mantissa == 0 )
+        {
+            tmpstr = g_strdup_printf ( _("The exchange rate or the transaction amount in "
+                        "%s must be filled."),
+                        gsb_data_currency_get_name ( account_currency_number ) );
+            dialogue_warning_hint ( tmpstr, _("One field is not filled in") );
 
+            goto dialog_return;
+        }
         gsb_currency_config_set_cached_exchange ( account_currency_number,
                         transaction_currency_number,
                         current_exchange, current_exchange_fees );

Index: gsb_data_form.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_form.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- gsb_data_form.c	2 Oct 2008 22:11:23 -0000	1.12
+++ gsb_data_form.c	7 Nov 2009 19:13:59 -0000	1.13
@@ -488,7 +488,7 @@
 	return FALSE;
 
     form = gsb_data_account_get_form_organization ( account_number );
-    
+
     if ( !form)
 	return FALSE;
 

Index: gsb_form_transaction.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form_transaction.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- gsb_form_transaction.c	7 Nov 2009 08:09:57 -0000	1.50
+++ gsb_form_transaction.c	7 Nov 2009 19:13:59 -0000	1.51
@@ -579,6 +579,7 @@
     gint account_number;
     gint currency_number;
     gint account_currency_number;
+    gint link_number;
 
     account_number = gsb_form_get_account_number ( );
     gtk_widget_grab_focus ( gsb_form_widget_get_widget ( TRANSACTION_FORM_DATE ) );
@@ -590,6 +591,16 @@
         gtk_widget_hide ( gsb_form_widget_get_widget ( TRANSACTION_FORM_CHANGE ) );
     else
         gtk_widget_show ( gsb_form_widget_get_widget ( TRANSACTION_FORM_CHANGE ) );
+
+    link_number = gsb_data_currency_link_search ( account_currency_number,
+                        currency_number );
+    if ( link_number == 0 )
+        gsb_currency_exchange_dialog ( account_currency_number,
+                        currency_number,
+                        0,
+                        null_real,
+                        null_real,
+                        TRUE );
 }
 /* Local Variables: */
 /* c-basic-offset: 4 */



More information about the cvs mailing list