[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_9_2-37-g1ee220a

Pierre Biava nobody at users.sourceforge.net
Wed Aug 3 22:54:40 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, master has been updated
       via  1ee220a3d5956763509ac73562dfff8f97ffe89c (commit)
      from  65fcab4e8e1111c08620fcbcb1907a800f471483 (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 1ee220a3d5956763509ac73562dfff8f97ffe89c
Author: pbiava <pierre.biava at nerim.net>
Date:   Wed Aug 3 21:23:23 2011 +0200

    Reattaching of the menu "Use selected transaction as a template"

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

Changes:
diff --git a/src/gsb_transactions_list.c b/src/gsb_transactions_list.c
index 593a43e..137226a 100644
--- a/src/gsb_transactions_list.c
+++ b/src/gsb_transactions_list.c
@@ -95,9 +95,6 @@ static gboolean gsb_transactions_list_change_sort_type ( GtkWidget *menu_item,
 static gboolean gsb_transactions_list_check_mark ( gint transaction_number );
 static gint gsb_transactions_list_choose_reconcile ( gint account_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,
                         gint mother_transaction_number );
 static GtkWidget *gsb_transactions_list_create_tree_view ( GtkTreeModel *model );
@@ -2515,16 +2512,15 @@ void popup_transaction_context_menu ( gboolean full, int x, int y )
     gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), menu_item );
 
     /* use transaction as template */
-/*     menu_item = gtk_image_menu_item_new_with_label ( _("Use selected transaction as a template") );
- *     gtk_image_menu_item_set_image ( GTK_IMAGE_MENU_ITEM(menu_item),
- * 				    gtk_image_new_from_stock ( GTK_STOCK_COPY,
- * 							       GTK_ICON_SIZE_MENU ));
- *     g_signal_connect ( G_OBJECT(menu_item), "activate",
- * 		       G_CALLBACK (gsb_transactions_list_clone_template), NULL );
- *     gtk_widget_set_sensitive ( menu_item, full );
- *     gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), menu_item );
- *
- */
+    menu_item = gtk_image_menu_item_new_with_label ( _("Use selected transaction as a template") );
+    gtk_image_menu_item_set_image ( GTK_IMAGE_MENU_ITEM(menu_item),
+				    gtk_image_new_from_stock ( GTK_STOCK_COPY,
+							       GTK_ICON_SIZE_MENU ));
+    g_signal_connect ( G_OBJECT(menu_item), "activate",
+		       G_CALLBACK (gsb_transactions_list_clone_template), NULL );
+    gtk_widget_set_sensitive ( menu_item, full );
+    gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), menu_item );
+
     /* Clone transaction */
     menu_item = gtk_image_menu_item_new_with_label ( _("Clone transaction") );
     gtk_image_menu_item_set_image ( GTK_IMAGE_MENU_ITEM(menu_item),
@@ -2783,8 +2779,6 @@ gboolean clone_selected_transaction ( GtkWidget *menu_item,
 
     update_transaction_in_trees (new_transaction_number);
 
-/*     gtk_notebook_set_current_page ( GTK_NOTEBOOK ( gsb_gui_get_general_notebook ( ) ), 1 );  */
-
     transaction_list_select ( new_transaction_number );
     gsb_transactions_list_edit_transaction ( new_transaction_number );
     g_object_set_data ( G_OBJECT ( gsb_form_get_form_widget ( ) ),
@@ -2807,34 +2801,45 @@ gboolean clone_selected_transaction ( GtkWidget *menu_item,
  *
  * \return FALSE
  * */
-/* static gboolean gsb_transactions_list_clone_template ( GtkWidget *menu_item,
- *                         gpointer null )
- * {
- *     gint new_transaction_number;
- *
- *     if ( !assert_selected_transaction ( ) )
- *         return FALSE;
- *
- *     new_transaction_number = gsb_transactions_list_clone_transaction (
- *                                     gsb_data_account_get_current_transaction_number (
- *                                     gsb_gui_navigation_get_current_account ( ) ),
- * 								    0 );
- *
- *     update_transaction_in_trees ( new_transaction_number );
- *
- *     transaction_list_select ( new_transaction_number );
- *     gsb_transactions_list_edit_transaction ( new_transaction_number );
- *     g_object_set_data ( G_OBJECT ( gsb_form_get_form_widget ( ) ),
- * 			    "transaction_selected_in_form",
- * 			    GINT_TO_POINTER ( -1 ) );
- */
+gboolean gsb_transactions_list_clone_template ( GtkWidget *menu_item,
+                        gpointer null )
+{
+    gint new_transaction_number;
+    gint account_number;
+    GDate *date;
+
+    if ( !assert_selected_transaction ( ) )
+        return FALSE;
+
+    account_number = gsb_gui_navigation_get_current_account ( );
+    new_transaction_number = gsb_transactions_list_clone_transaction (
+                                    gsb_data_account_get_current_transaction_number (
+                                    account_number ),
+								    0 );
+
+    date = gdate_today ( );
+    gsb_data_transaction_set_date ( new_transaction_number, date );
+    gsb_data_transaction_set_value_date ( new_transaction_number, NULL );
+    g_date_free ( date );
+
+    gsb_transactions_list_update_transaction ( new_transaction_number );
+    update_transaction_in_trees ( new_transaction_number );
+
+    transaction_list_select ( new_transaction_number );
+    gsb_transactions_list_edit_transaction ( new_transaction_number );
+    g_object_set_data ( G_OBJECT ( gsb_form_get_form_widget ( ) ),
+			    "transaction_selected_in_form",
+			    GINT_TO_POINTER ( -1 ) );
+
+    gsb_transactions_list_update_tree_view ( account_number, TRUE );
 
     /* force the update module budget */
-/*    gsb_data_account_set_bet_maj ( gsb_gui_navigation_get_current_account ( ), BET_MAJ_ALL );
+    gsb_data_account_set_bet_maj ( account_number, BET_MAJ_ALL );
 
     gsb_file_set_modified ( TRUE );
+
     return FALSE;
-}*/
+}
 
 
 /**
diff --git a/src/gsb_transactions_list.h b/src/gsb_transactions_list.h
index eb7de5b..e65d5c5 100644
--- a/src/gsb_transactions_list.h
+++ b/src/gsb_transactions_list.h
@@ -53,6 +53,8 @@ gboolean gsb_transactions_list_add_transactions_from_archive ( gint archive_numb
                         gboolean show_warning );
 gboolean gsb_transactions_list_append_new_transaction ( gint transaction_number,
                         gboolean update_tree_view );
+gboolean gsb_transactions_list_clone_template ( GtkWidget *menu_item,
+                        gpointer null );
 gboolean gsb_transactions_list_delete_transaction ( gint transaction_number,
                         gint show_warning );
 gboolean gsb_transactions_list_delete_transaction_from_tree_view ( gint transaction_number );
diff --git a/src/menu.c b/src/menu.c
index e489340..805a261 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -115,6 +115,7 @@ static const gchar *ui_manager_buffer =
 "      <separator/>"
 "      <menuitem name='NewTransaction' action='NewTransactionAction'/>"
 "      <menuitem name='RemoveTransaction' action='RemoveTransactionAction'/>"
+"      <menuitem name='TemplateTransaction' action='TemplateTransactionAction'/>"
 "      <menuitem name='CloneTransaction' action='CloneTransactionAction'/>"
 "      <separator/>"
 "      <menuitem name='ConvertToScheduled' action='ConvertToScheduledAction'/>"
@@ -217,6 +218,8 @@ GtkWidget *init_menus ( GtkWidget *vbox )
          G_CALLBACK ( new_transaction ) },
         {"RemoveTransactionAction", GTK_STOCK_DELETE, _("_Remove transaction"), "", NULL,
          G_CALLBACK ( remove_transaction ) },
+        {"TemplateTransactionAction", GTK_STOCK_COPY, _("Use selected transaction as a template"), "", NULL,
+         G_CALLBACK ( gsb_transactions_list_clone_template ) },
         {"CloneTransactionAction", GTK_STOCK_COPY, _("_Clone transaction"), "", NULL,
          G_CALLBACK ( clone_selected_transaction ) },
         {"ConvertToScheduledAction", GTK_STOCK_CONVERT, _("Convert to _scheduled transaction"), NULL, NULL,
@@ -805,6 +808,7 @@ gboolean gsb_menu_transaction_operations_set_sensitive ( gboolean sensitive )
     devel_debug ( sensitive ? "item sensitive" : "item unsensitive" );
 
     gsb_gui_sensitive_menu_item ( "/menubar/EditMenu/RemoveTransaction", sensitive );
+    gsb_gui_sensitive_menu_item ( "/menubar/EditMenu/TemplateTransaction", sensitive );
     gsb_gui_sensitive_menu_item ( "/menubar/EditMenu/CloneTransaction", sensitive );
     gsb_gui_sensitive_menu_item ( "/menubar/EditMenu/EditTransaction", sensitive );
     gsb_gui_sensitive_menu_item ( "/menubar/EditMenu/ConvertToScheduled", sensitive );
diff --git a/src/traitement_variables.c b/src/traitement_variables.c
index e02dafb..0efcb46 100644
--- a/src/traitement_variables.c
+++ b/src/traitement_variables.c
@@ -345,6 +345,7 @@ void menus_sensitifs ( gboolean sensitif )
         "/menubar/FileMenu/Close",
         "/menubar/EditMenu/NewTransaction",
         "/menubar/EditMenu/RemoveTransaction",
+        "/menubar/EditMenu/TemplateTransaction",
         "/menubar/EditMenu/CloneTransaction",
         "/menubar/EditMenu/EditTransaction",
         "/menubar/EditMenu/ConvertToScheduled",


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list