[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_7_4-73-g3c4d4e8

Pierre Biava nobody at users.sourceforge.net
Tue Nov 2 23:04:57 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  3c4d4e89d610e6003785b57854a2984b8707d28e (commit)
       via  5b7f48ebf5bdf5e7a83cb265b1a1e71e24f81bef (commit)
      from  83e7d87694d0359c8a554bea343a82c66b3ff6df (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 3c4d4e89d610e6003785b57854a2984b8707d28e
Author: pbiava <pierre.biava at nerim.net>
Date:   Tue Nov 2 22:57:44 2010 +0100

    changes the location of the lock file to place it in the backup directory

commit 5b7f48ebf5bdf5e7a83cb265b1a1e71e24f81bef
Author: pbiava <pierre.biava at nerim.net>
Date:   Tue Nov 2 22:53:26 2010 +0100

    Fixed a bug that slows grisbi: suppression of automatic adjustment of the balance column

-----------------------------------------------------------------------

Changes:
diff --git a/src/gsb_file.c b/src/gsb_file.c
index 12f6849..541cf11 100644
--- a/src/gsb_file.c
+++ b/src/gsb_file.c
@@ -292,7 +292,6 @@ devel_debug ( last_path );
  * */
 const gchar *gsb_file_get_last_path ( void )
 {
-devel_debug (NULL);
     return last_path_used;
 }
 
diff --git a/src/gsb_file_util.c b/src/gsb_file_util.c
index 6f1d068..97c1719 100644
--- a/src/gsb_file_util.c
+++ b/src/gsb_file_util.c
@@ -28,6 +28,7 @@
 #include "dialog.h"
 #include "gsb_data_account.h"
 #include "gsb_data_transaction.h"
+#include "gsb_file.h"
 #include "utils_str.h"
 #include "utils_files.h"
 #include "include.h"
@@ -269,115 +270,104 @@ void switch_t_r ( void )
 
 
 /**
- * create or delete a file ".name_of_file.swp" to check if the file is opened
+ * create or delete a file ".name_of_file.lock" to check if the file is opened
  * already or not
  *
- * \param create_swp if we create or delete it
+ * \param create_lock if we create or delete it
  *
  * \return TRUE if ok
  * */
-gboolean gsb_file_util_modify_lock ( gboolean create_swp )
+gboolean gsb_file_util_modify_lock ( gboolean create_lock )
 {
     gchar *lock_filename;
-    gchar **tab_str;
-    gint i;
-devel_debug_int ( create_swp );
+
+    devel_debug_int ( create_lock );
     /* if the file was already opened and we don't force the saving, we do nothing */
-    if ( (etat.fichier_deja_ouvert
-	  &&
-	  !conf.force_enregistrement)
+    if ( ( etat.fichier_deja_ouvert && !conf.force_enregistrement )
 	 ||
 	 !nom_fichier_comptes
 	 ||
-	 !strlen(nom_fichier_comptes) )
-	return TRUE;
+	 strlen ( nom_fichier_comptes) == 0 )
+        return TRUE;
 
     /* Check if nom_fichier_comptes exists.  If not, this is a new
      * file so don't try to lock it. */
-    if (!g_file_test ( nom_fichier_comptes,
-		       G_FILE_TEST_EXISTS ))
-    {
-	return FALSE;
-    }
+    if ( !g_file_test ( nom_fichier_comptes, G_FILE_TEST_EXISTS ) )
+        return FALSE;
 
     /* Create the name of the lock file */
-    tab_str = g_strsplit ( nom_fichier_comptes, G_DIR_SEPARATOR_S, 0 );
-
-    i=0;
-
-    while ( tab_str[i+1] )
-	i++;
-
-    tab_str[i] = g_strconcat ( 
+    lock_filename = g_strconcat ( gsb_file_get_backup_path ( ),
+                        G_DIR_SEPARATOR_S,
 #ifndef _WIN32
-                              ".",
+                        ".",
 #endif
-			       tab_str[i],
-			       ".swp",
-			       NULL );
-    lock_filename = g_strjoinv ( G_DIR_SEPARATOR_S,
-				 tab_str );
-    g_strfreev ( tab_str );
-
-    if ( create_swp )
+                        g_path_get_basename ( nom_fichier_comptes ),
+                        ".lock",
+                        NULL );
+
+    if ( create_lock )
     {
-	/* now we create the lock file */
+        /* now we create the lock file */
 
-	FILE *fichier;
+        FILE *fichier;
 
-	/* check if the file lock exists */
-	if (g_file_test ( lock_filename,
-			  G_FILE_TEST_EXISTS ))
-	{
-	    if ( ! conf.force_enregistrement )
-		dialog_message ( "account-already-opened", nom_fichier_comptes );
+        /* check if the file lock exists */
+        if ( g_file_test ( lock_filename, G_FILE_TEST_EXISTS ) )
+        {
+            if ( ! conf.force_enregistrement )
+                dialog_message ( "account-already-opened", nom_fichier_comptes );
 
-	    /* the lock is already created, return TRUE */
-	    etat.fichier_deja_ouvert = 1;
-	    return TRUE;
-	}
+            /* the lock is already created, return TRUE */
+            etat.fichier_deja_ouvert = 1;
+            return TRUE;
+        }
 
-	etat.fichier_deja_ouvert = 0;
+        etat.fichier_deja_ouvert = 0;
 
-	fichier = utf8_fopen ( lock_filename, "w" );
+        fichier = utf8_fopen ( lock_filename, "w" );
 
-	if ( !fichier )
-	{
-	    gchar* tmpstr = g_strdup_printf (_("Cannot write lock file :'%s': %s"),
-					     nom_fichier_comptes,
-					     g_strerror(errno));
-	    dialogue_error ( tmpstr );
-	    g_free ( tmpstr );
-	    return FALSE;
-	}
+        if ( !fichier )
+        {
+            gchar* tmp_str;
 
-	fclose ( fichier );
-	return TRUE;
+            tmp_str = g_strdup_printf ( _("Cannot write lock file :'%s': %s"),
+                                nom_fichier_comptes,
+                                g_strerror ( errno ) );
+            dialogue_error ( tmp_str );
+            g_free ( tmp_str );
+
+            return FALSE;
+        }
+
+        fclose ( fichier );
+        return TRUE;
     }
     else
     {
-	/* delete the lock file */
-	gint result;
+        /* delete the lock file */
+        gint result;
 
-	etat.fichier_deja_ouvert = 0;
+        etat.fichier_deja_ouvert = 0;
 
-	/* check if it exits, if not, just go away */
-	if (!g_file_test ( lock_filename,
-			   G_FILE_TEST_EXISTS ))
-	    return TRUE;
+        /* check if it exits, if not, just go away */
+        if ( !g_file_test ( lock_filename, G_FILE_TEST_EXISTS ) )
+            return TRUE;
 
-	result = utf8_remove ( lock_filename );
+        result = utf8_remove ( lock_filename );
 
-	if ( result == -1 )
-	{
-	    gchar* tmpstr = g_strdup_printf (_("Cannot erase lock file :'%s': %s"),
-					     nom_fichier_comptes,
-					     g_strerror(errno));
-	    dialogue_error ( tmpstr );
-	    g_free ( tmpstr );
-	    return FALSE;
-	}
-	return TRUE;
+        if ( result == -1 )
+        {
+            gchar* tmp_str;
+
+            tmp_str = g_strdup_printf (_("Cannot erase lock file :'%s': %s"),
+                                nom_fichier_comptes,
+                                g_strerror ( errno ) );
+            dialogue_error ( tmp_str );
+            g_free ( tmp_str );
+
+            return FALSE;
+        }
+        return TRUE;
     }
 }
 
diff --git a/src/gsb_file_util.h b/src/gsb_file_util.h
index 91a5a55..a8d6e91 100644
--- a/src/gsb_file_util.h
+++ b/src/gsb_file_util.h
@@ -10,7 +10,7 @@ void gsb_file_util_display_warning_permissions ( void );
 gboolean gsb_file_util_get_contents ( gchar *filename,
 				      gchar **file_content,
 				      gulong *length );
-gboolean gsb_file_util_modify_lock ( gboolean create_swp );
+gboolean gsb_file_util_modify_lock ( gboolean create_lock );
 gboolean gsb_file_util_test_overwrite ( const gchar *filename );
 void switch_t_r ( void );
 /* END_DECLARATION */
diff --git a/src/gsb_transactions_list.c b/src/gsb_transactions_list.c
index 20bacbd..59c9ec3 100644
--- a/src/gsb_transactions_list.c
+++ b/src/gsb_transactions_list.c
@@ -272,6 +272,8 @@ void gsb_transactions_list_update_tree_view ( gint account_number,
         transaction_list_set_color_jour ( account_number );
     if ( keep_selected_transaction )
         transaction_list_select ( selected_transaction );
+    else
+        transaction_list_select ( -1 );
 }
 
 
@@ -405,14 +407,8 @@ void gsb_transactions_list_create_tree_view_columns ( void )
 	gtk_tree_view_column_set_alignment ( transactions_tree_view_columns[i],
 					     alignment[i] );
 
-	/* automatic and resizeable sizing */
-    if ( i == column_balance )
-        gtk_tree_view_column_set_sizing ( transactions_tree_view_columns[i],
-					    GTK_TREE_VIEW_COLUMN_AUTOSIZE );
-    else
-	    gtk_tree_view_column_set_sizing ( transactions_tree_view_columns[i],
+    gtk_tree_view_column_set_sizing ( transactions_tree_view_columns[i],
 					    GTK_TREE_VIEW_COLUMN_FIXED );
-
 	gtk_tree_view_column_set_resizable ( transactions_tree_view_columns[i],
 					    TRUE );
     }
@@ -467,6 +463,8 @@ GtkWidget *gsb_transactions_list_create_tree_view ( GtkTreeModel *model )
                         GTK_TREE_VIEW( tree_view ))),
 				        GTK_SELECTION_NONE );
 
+    gtk_tree_view_set_fixed_height_mode ( GTK_TREE_VIEW ( tree_view ), TRUE );
+
     /* check the buttons on the list */
     g_signal_connect ( G_OBJECT ( tree_view ),
 		                "button_press_event",
diff --git a/src/transaction_list.c b/src/transaction_list.c
index 58f9ef3..f6baeb8 100644
--- a/src/transaction_list.c
+++ b/src/transaction_list.c
@@ -140,7 +140,7 @@ void transaction_list_append_transaction ( gint transaction_number )
     }
 
     /* the transaction is a mother */
-    account_number = gsb_data_transaction_get_account_number ( transaction_number );
+    account_number = gsb_gui_navigation_get_current_account ( );
 
     /* if the transaction is a split, create a white line, we will append it later */
     if ( gsb_data_transaction_get_split_of_transaction ( transaction_number ) )
@@ -217,7 +217,7 @@ void transaction_list_append_transaction ( gint transaction_number )
 	/* we check if the row is visible or not only if we are on an account,
 	 * in other case, the model will be filtered when change account so no need
 	 * to do that here */
-	if ( gsb_gui_navigation_get_current_account ( ) != -1
+	if ( account_number != -1
 	    &&
 	    gsb_transactions_list_transaction_visible ( newrecord[i] -> transaction_pointer,
 							account_number,


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list