[grisbi-cvs] grisbi/src Makefile.am, 1.151, 1.152 gsb_account.c, 1.36, 1.37 gsb_account.h, 1.12, 1.13 gsb_account_property.c, 1.15, 1.16 gsb_assistant_account.c, 1.23, 1.24 gsb_data_account.c, 1.59, 1.60 gsb_data_account.h, 1.27, 1.28 gsb_file_load.c, 1.144, 1.145 gsb_file_save.c, 1.107, 1.108 navigation.c, 1.108, 1.109

Pierre Biava pbiava at users.sourceforge.net
Sun Jan 4 19:31:56 CET 2009


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

Modified Files:
	Makefile.am gsb_account.c gsb_account.h gsb_account_property.c 
	gsb_assistant_account.c gsb_data_account.c gsb_data_account.h 
	gsb_file_load.c gsb_file_save.c navigation.c 
Log Message:
ajout nouvelle fonctionnalité selection icone par comte

Index: gsb_account.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_account.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- gsb_account.c	25 Oct 2008 15:27:29 -0000	1.36
+++ gsb_account.c	4 Jan 2009 18:31:54 -0000	1.37
@@ -84,7 +84,8 @@
 			   gint currency_number,
 			   gint bank_number,
 			   gsb_real init_amount,
-			   const gchar *name )
+			   const gchar *name,
+               gchar *name_icon )
 {
     gint account_number;
 
@@ -99,6 +100,10 @@
     /* set the default method of payment */
     gsb_data_payment_create_default (account_number);
 
+    /* set the icon_name */
+    if ( name_icon )
+        gsb_data_account_set_name_icon ( account_number, name_icon );
+
     gsb_data_account_set_currency ( account_number, currency_number);
     gsb_data_account_set_bank (account_number, bank_number);
     gsb_data_account_set_init_balance (account_number, init_amount);

Index: gsb_account.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_account.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- gsb_account.h	17 Dec 2007 10:44:38 -0000	1.12
+++ gsb_account.h	4 Jan 2009 18:31:54 -0000	1.13
@@ -19,7 +19,8 @@
 			   gint currency_number,
 			   gint bank_number,
 			   gsb_real init_amount,
-			   const gchar *name );
+			   const gchar *name,
+               gchar *name_icon );
 gboolean gsb_account_set_combo_account_number ( GtkWidget *combo_box,
 						gint account_number );
 gboolean gsb_account_update_combo_list ( GtkWidget *combo_box,

Index: gsb_assistant_account.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_assistant_account.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- gsb_assistant_account.c	1 Jan 2009 20:43:49 -0000	1.23
+++ gsb_assistant_account.c	4 Jan 2009 18:31:54 -0000	1.24
@@ -30,23 +30,26 @@
 
 /*START_INCLUDE*/
 #include "gsb_assistant_account.h"
+#include "./dialog.h"
 #include "./gsb_account.h"
 #include "./gsb_assistant.h"
-#include "./gsb_automem.h"
 #include "./gsb_bank.h"
 #include "./gsb_currency_config.h"
 #include "./gsb_currency.h"
+#include "./gsb_data_account.h"
 #include "./gsb_data_bank.h"
 #include "./gsb_data_currency.h"
 #include "./gsb_real.h"
+#include "./gsb_select_icon.h"
 #include "./utils.h"
 #include "./structures.h"
-#include "./utils_buttons.h"
 #include "./gsb_data_account.h"
 #include "./include.h"
+#include "./erreur.h"
 /*END_INCLUDE*/
 
 /*START_STATIC*/
+static void gsb_assistant_account_change_account_icon ( GtkWidget *button, gpointer data );
 static  gboolean gsb_assistant_account_enter_page_finish ( GtkWidget * assistant, gint new_page );
 static  GtkWidget *gsb_assistant_account_page_2 ( GtkWidget *assistant );
 static  GtkWidget *gsb_assistant_account_page_3 ( GtkWidget *assistant );
@@ -58,6 +61,8 @@
 /*START_EXTERN*/
 /*END_EXTERN*/
 
+static gchar * new_icon = NULL;
+
 enum first_assistant_page
 {
     ACCOUNT_ASSISTANT_INTRO= 0,
@@ -86,6 +91,8 @@
     GtkResponseType return_value;
     GtkWidget *assistant;
 
+    if ( new_icon && strlen ( new_icon ) > 0)
+        g_free ( new_icon );
     assistant = gsb_assistant_new ( _("Create a new account"),
 				    _("This assistant will help you to create a new account.\n"
 				      "All that you do here can be changed later in the account configuration page." ),
@@ -120,7 +127,8 @@
 			  gsb_currency_get_currency_from_combobox (account_combobox_currency),
 			  gsb_bank_list_get_bank_number (account_combobox_bank),
 			  gsb_real_get_from_string (gtk_entry_get_text (GTK_ENTRY (account_entry_initial_amount))),
-			  gtk_entry_get_text (GTK_ENTRY (account_entry_name)));
+			  gtk_entry_get_text (GTK_ENTRY (account_entry_name)),
+              new_icon );
         result = TRUE; /* assistant was not cancelled */
     }
 
@@ -212,6 +220,7 @@
 {
     GtkWidget *page, *label, *button, *table;
     GtkWidget *align;
+    GtkWidget *image;
     struct lconv * conv = localeconv();
 
     page = gtk_hbox_new (FALSE, 15);
@@ -314,11 +323,11 @@
     /* Récupération de l'icône par défaut */
     align = gtk_alignment_new (0.5,0.5,1,1);
     gtk_alignment_set_padding ( GTK_ALIGNMENT ( align ), 0, 0, 20, 20 );
-    button = gsb_automem_imagefile_button_new ( GSB_BUTTON_ICON,
-					       NULL,
-					       "ac_bank.png",
-					       NULL,
-					       NULL );
+    button = gtk_button_new ( );
+    gtk_widget_set_size_request ( button, 80, 80 );
+    image = gtk_image_new_from_pixbuf (
+                gsb_data_account_get_account_standard_pixbuf ( 0 ) );
+    gtk_button_set_image ( GTK_BUTTON ( button ), image);
     gtk_button_set_relief ( GTK_BUTTON ( button ), GTK_RELIEF_NORMAL );
     gtk_container_add (GTK_CONTAINER (align), button);
     gtk_table_attach ( GTK_TABLE ( table ), align, 
@@ -326,8 +335,11 @@
 		       GTK_FILL | GTK_FILL,
 		       GTK_FILL | GTK_FILL,
 		       0, 0 );
-    gtk_widget_set_size_request ( button, 80, 80 );
     g_object_set_data ( G_OBJECT (assistant), "bouton_icon", button );
+    g_signal_connect ( G_OBJECT( button ), 
+                            "pressed", 
+                            G_CALLBACK(gsb_assistant_account_change_account_icon), 
+                            NULL );
 
     gtk_widget_show_all (page);
     return page;
@@ -458,39 +470,43 @@
 {
     GtkWidget *bouton_icon, *image;
     kind_account account_kind;
-    gchar * account_icon;
 
     account_kind = GPOINTER_TO_INT ( g_object_get_data 
                 ( G_OBJECT (button), "account_kind"));
     g_object_set_data ( G_OBJECT (assistant),
-			"account_kind", GINT_TO_POINTER ( account_kind ) );
-
-    switch ( account_kind )
-    {
-	case GSB_TYPE_BANK:
-	    account_icon = "ac_bank.png";
-	    break;
-
-	case GSB_TYPE_CASH:
-	    account_icon = "ac_cash.png";
-	    break;
-
-	case GSB_TYPE_ASSET:
-    account_icon = "ac_asset.png";
-	    break;
-
-	case GSB_TYPE_LIABILITIES:
-	    account_icon = "ac_liability.png";
-	    break;
-
-	default:
-	    account_icon = "ac_bank.png";
-	    break;
-    }
+                "account_kind", GINT_TO_POINTER ( account_kind ) );
 
     bouton_icon = g_object_get_data ( G_OBJECT (assistant), "bouton_icon" );
-    image = gtk_image_new_from_file (g_build_filename (PIXMAPS_DIR,
-							   account_icon, NULL));
+    image = gtk_image_new_from_pixbuf (
+                gsb_data_account_get_account_standard_pixbuf ( account_kind ) );
     gtk_button_set_image ( GTK_BUTTON ( bouton_icon ), image);
     return FALSE;
 }
+
+void gsb_assistant_account_change_account_icon ( GtkWidget *button, gpointer data )
+{
+    GdkPixbuf * pixbuf;
+    GtkWidget *image;
+    gchar * name_icon;
+    GError *error = NULL;
+
+    devel_debug ( NULL );
+    image = gtk_button_get_image ( GTK_BUTTON ( button ) );
+    pixbuf = gtk_image_get_pixbuf ( GTK_IMAGE ( image ) );
+    name_icon = g_object_get_data ( G_OBJECT ( pixbuf ), "name_icon" );
+    devel_debug (name_icon);
+    new_icon = gsb_select_icon_create_window ( name_icon );
+    devel_debug (new_icon);
+    pixbuf = gdk_pixbuf_new_from_file_at_size ( new_icon , 32, 32, &error );
+    if ( ! pixbuf )
+    {
+        devel_debug ( error -> message );
+        dialogue_error ( error -> message );
+    }
+    else
+    {
+    image = gtk_image_new_from_pixbuf ( pixbuf );
+        if ( image )
+            gtk_button_set_image ( GTK_BUTTON ( button ), image );
+    }
+}

Index: gsb_file_save.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_save.c,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -d -r1.107 -r1.108
--- gsb_file_save.c	1 Jan 2009 20:43:49 -0000	1.107
+++ gsb_file_save.c	4 Jan 2009 18:31:54 -0000	1.108
@@ -949,7 +949,7 @@
 	    gsb_data_account_get_holder_name (account_number),
 	    gsb_data_account_get_kind (account_number),
 	    gsb_data_account_get_currency (account_number),
-        gsb_data_account_get_path_icon (account_number),
+        gsb_data_account_get_name_icon (account_number),
 	    gsb_data_account_get_bank (account_number),
 	    gsb_data_account_get_bank_branch_code (account_number),
 	    gsb_data_account_get_bank_account_number (account_number),

Index: navigation.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/navigation.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- navigation.c	1 Jan 2009 20:42:11 -0000	1.108
+++ navigation.c	4 Jan 2009 18:31:54 -0000	1.109
@@ -50,9 +50,7 @@
 #include "./imputation_budgetaire.h"
 #include "./transaction_list_select.h"
 #include "./transaction_list_sort.h"
-#include "./utils_files.h"
 #include "./fenetre_principale.h"
-#include "./gsb_data_account.h"
 #include "./include.h"
 #include "./balance_estimate_tab.h"
 #include "./erreur.h"
@@ -860,66 +858,10 @@
 					      GtkTreeIter * account_iter,
 					      gint account_number )
 {
-    GdkPixbuf * pixbuf;
-    gchar * account_icon;
-
-    if ( (account_icon = gsb_data_account_get_path_icon ( account_number ) ) )
-    {
-        GError *error = NULL;
-
-        pixbuf = gdk_pixbuf_new_from_file_at_size ( account_icon , 32, 32, &error );
-        if ( pixbuf )
-        {
-            gtk_tree_store_set(GTK_TREE_STORE(model), account_iter, 
-		       NAVIGATION_PIX, pixbuf,
-		       NAVIGATION_PIX_VISIBLE, TRUE, 
-		       NAVIGATION_TEXT, gsb_data_account_get_name ( account_number ), 
-		       NAVIGATION_FONT, 400,
-		       NAVIGATION_PAGE, GSB_ACCOUNT_PAGE,
-		       NAVIGATION_ACCOUNT, account_number,
-		       NAVIGATION_SENSITIVE, !gsb_data_account_get_closed_account ( account_number ),
-		       NAVIGATION_REPORT, -1,
-		       -1 );
-            return;
-        }
-        else
-        {
-            gchar* tmpstr = g_strconcat( "Erreur de pixbuf : " , 
-                 error -> message, " image ",
-				 account_icon, NULL );
-            devel_debug (tmpstr);
-            g_free ( tmpstr );
-        }
-    }
-	    
-    switch ( gsb_data_account_get_kind ( account_number ) )
-    {
-	case GSB_TYPE_BANK:
-	    account_icon = "ac_bank";
-	    break;
-
-	case GSB_TYPE_CASH:
-	    account_icon = "ac_cash";
-	    break;
-
-	case GSB_TYPE_ASSET:
-    account_icon = "ac_asset";
-	    break;
-
-	case GSB_TYPE_LIABILITIES:
-	    account_icon = "ac_liability";
-	    break;
+    GdkPixbuf * pixbuf = NULL;
 
-	default:
-	    account_icon = "ac_bank";
-	    break;
-    }
+    pixbuf = gsb_data_account_get_account_icon_pixbuf ( account_number );
 
-    gchar* tmpstr = g_strconcat( PIXMAPS_DIR, 
-				 C_DIRECTORY_SEPARATOR,
-				 account_icon, ".png", NULL );
-    pixbuf = gdk_pixbuf_new_from_file ( tmpstr , NULL );
-    g_free ( tmpstr );
     gtk_tree_store_set(GTK_TREE_STORE(model), account_iter, 
 		       NAVIGATION_PIX, pixbuf,
 		       NAVIGATION_PIX_VISIBLE, TRUE, 

Index: gsb_account_property.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_account_property.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- gsb_account_property.c	1 Jan 2009 20:43:49 -0000	1.15
+++ gsb_account_property.c	4 Jan 2009 18:31:54 -0000	1.16
@@ -35,7 +35,6 @@
 #include "gsb_account_property.h"
 #include "./gsb_account.h"
 #include "./gsb_autofunc.h"
-#include "./gsb_automem.h"
 #include "./gsb_bank.h"
 #include "./utils_buttons.h"
 #include "./gsb_currency.h"
@@ -60,8 +59,6 @@
 #include "./transaction_list.h"
 #include "./structures.h"
 #include "./gsb_transactions_list.h"
-#include "./utils_buttons.h"
-#include "./gsb_data_account.h"
 #include "./accueil.h"
 #include "./gsb_data_transaction.h"
 #include "./gsb_form_scheduler.h"
@@ -162,12 +159,13 @@
     align = gtk_alignment_new (0.5,0.5,0.5,0.5);
     gtk_size_group_add_widget ( GTK_SIZE_GROUP ( size_group ), align );
     gtk_box_pack_start ( GTK_BOX(hbox_account), align, FALSE, FALSE, 0);
-    bouton_icon = gsb_automem_imagefile_button_new ( GSB_BUTTON_ICON,
-					       NULL,
-					       "ac_bank.png",
-					       NULL,
-					       NULL );
+    bouton_icon = gtk_button_new ( );
     gtk_button_set_relief ( GTK_BUTTON ( bouton_icon ), GTK_RELIEF_NORMAL );
+    gtk_widget_set_size_request ( bouton_icon, 60, 60 );
+    g_signal_connect ( G_OBJECT( bouton_icon ), 
+                            "pressed", 
+                            G_CALLBACK(gsb_data_account_change_account_icon), 
+                            NULL );
     gtk_container_add (GTK_CONTAINER (align), bouton_icon);
     vbox_account = gtk_vbox_new ( FALSE, 5 );
     gtk_box_pack_start ( GTK_BOX(hbox_account), vbox_account, TRUE, TRUE, 0);
@@ -468,8 +466,6 @@
 {
     gint bank_number;
     gint current_account;
-    kind_account account_kind;
-    gchar * account_icon;
     GtkWidget *image;
 
     devel_debug (NULL);
@@ -479,43 +475,13 @@
     gsb_autofunc_entry_set_value (detail_nom_compte,
 				  gsb_data_account_get_name (current_account), current_account);
 
-    /* modification pour mettre à jour l'icône du sélecteur d'icône du compte */
-    account_kind = gsb_data_account_get_kind ( current_account );
-    gsb_autofunc_combobox_set_index (detail_type_compte, account_kind, current_account);
+    gsb_autofunc_combobox_set_index (detail_type_compte,
+				     gsb_data_account_get_kind (current_account), current_account);
     
-    if ( (account_icon = gsb_data_account_get_path_icon ( current_account ) ) )
-    {
-        GdkPixbuf * pixbuf;
+    /* modification pour mettre à jour l'icône du sélecteur d'icône du compte */
+    image = gsb_data_account_get_account_icon_image ( current_account );
+    gtk_button_set_image ( GTK_BUTTON ( bouton_icon ), image );
         
-        pixbuf = gdk_pixbuf_new_from_file_at_size ( account_icon , 32, 32, NULL );
-        image = gtk_image_new_from_pixbuf ( pixbuf );
-    }
-    else 
-    {
-        switch ( account_kind )
-        {
-        case GSB_TYPE_BANK:
-            account_icon = "ac_bank.png";
-            break;
-        case GSB_TYPE_CASH:
-            account_icon = "ac_cash.png";
-            break;
-        case GSB_TYPE_ASSET:
-        account_icon = "ac_asset.png";
-            break;
-        case GSB_TYPE_LIABILITIES:
-            account_icon = "ac_liability.png";
-            break;
-        default:
-            account_icon = "ac_bank.png";
-            break;
-        }
-        image = gtk_image_new_from_file (g_build_filename (PIXMAPS_DIR,
-							   account_icon, NULL));
-    }
-    if ( image )
-        gtk_button_set_image ( GTK_BUTTON ( bouton_icon ), image );
-    
     gsb_autofunc_currency_set_currency_number (detail_devise_compte,
 					       gsb_data_account_get_currency (current_account), current_account);
 
@@ -628,6 +594,7 @@
 {
     gint origin = GPOINTER_TO_INT (p_origin);
     gint account_number;
+    GtkWidget *image;
 
     account_number = gsb_gui_navigation_get_current_account ();
     if ( account_number == -1)
@@ -659,6 +626,8 @@
 
 	case PROPERTY_KIND:
 	    gsb_gui_navigation_update_account ( account_number );
+        image = gsb_data_account_get_account_icon_image ( account_number );
+        gtk_button_set_image ( GTK_BUTTON ( bouton_icon ), image );
 	    gsb_form_clean(gsb_form_get_account_number ());
 	    break;
 

Index: gsb_data_account.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- gsb_data_account.c	1 Jan 2009 20:43:49 -0000	1.59
+++ gsb_data_account.c	4 Jan 2009 18:31:54 -0000	1.60
@@ -34,7 +34,9 @@
 #include "./gsb_data_currency.h"
 #include "./gsb_data_form.h"
 #include "./gsb_data_transaction.h"
+#include "./navigation.h"
 #include "./gsb_real.h"
+#include "./gsb_select_icon.h"
 #include "./traitement_variables.h"
 #include "./utils_str.h"
 #include "./custom_list.h"
@@ -56,7 +58,7 @@
     kind_account account_kind;
     gchar 	*account_name;
     gint 	currency;
-    gchar   *path_icon;                         /* path for not standard icon ajout pbiava 31/12/2008 */
+    gchar   *name_icon;                         /* path for not standard icon ajout pbiava 31/12/2008 */
     gint 	closed_account;                     /**< if 1 => closed */
     gchar 	*comment;
     gchar 	*holder_name;
@@ -2458,7 +2460,7 @@
  * 
  * \return icon_path or NULL if the account doesn't exist
  * */
-gchar *gsb_data_account_get_path_icon (gint account_number)
+gchar *gsb_data_account_get_name_icon (gint account_number)
 {
     struct_account *account;
 
@@ -2467,7 +2469,7 @@
     if (!account )
 	return NULL;
 
-    return account -> path_icon;
+    return account -> name_icon;
 }
 
 
@@ -2480,7 +2482,7 @@
  * 
  * \return TRUE, ok ; FALSE, problem
  * */
-gboolean gsb_data_account_set_path_icon ( gint account_number,
+gboolean gsb_data_account_set_name_icon ( gint account_number,
 					       const gchar *filename )
 {
     struct_account *account;
@@ -2490,15 +2492,139 @@
     if (!account )
 	return FALSE;
 
-    if ( account -> path_icon )
-        g_free ( account -> path_icon );
+    if ( account -> name_icon )
+        g_free ( account -> name_icon );
 
     if (!filename || !strlen (filename))
-	account -> path_icon = NULL;
+	account -> name_icon = NULL;
     else
-	account -> path_icon = my_strdup (filename);
+	account -> name_icon = my_strdup (filename);
 
     return TRUE;
 }
 
+/**
+ * get the image icon of the account
+ * 
+ * \param account_number no of the account
+ * 
+ * \return image icon 
+ * */
+GtkWidget *gsb_data_account_get_account_icon_image ( gint account_number )
+{
+    GdkPixbuf * pixbuf;
+    GtkWidget *image;
+
+    pixbuf = gsb_data_account_get_account_icon_pixbuf ( account_number );
+    image = gtk_image_new_from_pixbuf ( pixbuf );
+
+    return image;
+}
+
+/**
+ * get the pixbuf icon of the account
+ * 
+ * \param account_number no of the account
+ * 
+ * \return pixbuf icon 
+ * */
+GdkPixbuf *gsb_data_account_get_account_icon_pixbuf ( gint account_number )
+{
+    GdkPixbuf * pixbuf = NULL;
+    gchar * account_icon;
+    GError *error = NULL;
+
+    if ( (account_icon = gsb_data_account_get_name_icon ( account_number ) ) )
+    {
+        pixbuf = gdk_pixbuf_new_from_file_at_size ( account_icon , 32, 32, &error );
+        g_object_set_data ( G_OBJECT ( pixbuf ), "name_icon", account_icon );
+    }
+
+    if ( ! pixbuf )
+    {
+        if (account_icon && strlen (account_icon) > 0)
+        {
+            gchar* tmpstr = g_strconcat( "Erreur de pixbuf : " , 
+                 error -> message, " image ",
+                 account_icon, NULL );
+            devel_debug (tmpstr);
+            dialogue_error ( tmpstr );
+            g_free ( tmpstr );
+        }        
+        pixbuf = gsb_data_account_get_account_standard_pixbuf ( 
+                    gsb_data_account_get_kind ( account_number ) );
+    }
+
+    return pixbuf;
+}
+
+
+GdkPixbuf *gsb_data_account_get_account_standard_pixbuf ( kind_account account_kind )
+{
+    GdkPixbuf * pixbuf = NULL;
+    gchar * account_icon;
+    GError *error = NULL;
+
+    switch ( account_kind )
+    {
+    case GSB_TYPE_BANK:
+        account_icon = "ac_bank.png";
+        break;
+    case GSB_TYPE_CASH:
+        account_icon = "ac_cash.png";
+        break;
+    case GSB_TYPE_ASSET:
+    account_icon = "ac_asset.png";
+        break;
+    case GSB_TYPE_LIABILITIES:
+        account_icon = "ac_liability.png";
+        break;
+    default:
+        account_icon = "ac_bank.png";
+        break;
+    }
+    pixbuf = gdk_pixbuf_new_from_file ( g_build_filename (PIXMAPS_DIR,
+                           account_icon, NULL), &error );
+    g_object_set_data ( G_OBJECT ( pixbuf ), "name_icon",  
+                           g_build_filename (PIXMAPS_DIR,
+                           account_icon, NULL) );
+
+    if ( ! pixbuf )
+    {
+        gchar* tmpstr = g_strconcat( "Erreur de pixbuf : " , 
+             error -> message, " image ",
+             account_icon, NULL );
+        devel_debug (tmpstr);
+        g_free ( tmpstr );
+    }
+
+    return pixbuf;
+}
+
+
+void gsb_data_account_change_account_icon ( GtkWidget *button, gpointer data )
+{
+    GdkPixbuf * pixbuf;
+    GtkWidget *image;
+    gchar * name_icon;
+    gchar * new_icon;
+    gint current_account;
+
+    devel_debug ( NULL );
+    image = gtk_button_get_image ( GTK_BUTTON ( button ) );
+    pixbuf = gtk_image_get_pixbuf ( GTK_IMAGE ( image ) );
+    name_icon = g_object_get_data ( G_OBJECT ( pixbuf ), "name_icon" );
+    devel_debug (name_icon);
+    new_icon = gsb_select_icon_create_window ( name_icon );
+    devel_debug (new_icon);
+    if ( new_icon )
+    {
+        current_account = gsb_gui_navigation_get_current_account ();
+        gsb_data_account_set_name_icon ( current_account, new_icon );
+        image = gsb_data_account_get_account_icon_image ( current_account );
+        gtk_button_set_image ( GTK_BUTTON ( button ), image );
+        gsb_gui_navigation_update_account ( current_account );
+    }
+}
+
 

Index: gsb_file_load.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_load.c,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -d -r1.144 -r1.145
--- gsb_file_load.c	1 Jan 2009 20:43:49 -0000	1.144
+++ gsb_file_load.c	4 Jan 2009 18:31:54 -0000	1.145
@@ -1284,7 +1284,7 @@
     if ( !strcmp ( attribute_names[i],
 		       "Path_icon" ))
 	{
-	    gsb_data_account_set_path_icon ( account_number,
+	    gsb_data_account_set_name_icon ( account_number,
 					    attribute_values[i]);
 	    i++;
 	    continue;

Index: Makefile.am
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/Makefile.am,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -d -r1.151 -r1.152
--- Makefile.am	26 Dec 2008 16:07:28 -0000	1.151
+++ Makefile.am	4 Jan 2009 18:31:54 -0000	1.152
@@ -144,7 +144,8 @@
 	utils_str.c		\
 	balance_estimate_tab.c
 
-grisbi_SOURCES = $(sources) $(sources_config)
+grisbi_SOURCES = $(sources) $(sources_config) \
+	gsb_select_icon.c
 
 grisbi_INCLUDES =		\
 	$(include_config)       \

Index: gsb_data_account.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- gsb_data_account.h	1 Jan 2009 20:43:49 -0000	1.27
+++ gsb_data_account.h	4 Jan 2009 18:31:54 -0000	1.28
@@ -25,11 +25,15 @@
 gsb_real gsb_data_account_calculate_current_and_marked_balances ( gint account_number );
 gsb_real gsb_data_account_calculate_marked_balance ( gint account_number );
 gsb_real gsb_data_account_calculate_waiting_marked_balance ( gint account_number );
+void gsb_data_account_change_account_icon ( GtkWidget *button, gpointer data );
 gint gsb_data_account_compare_position ( gint account_number_1,
 					 gint account_number_2 );
 gboolean gsb_data_account_delete ( gint account_number );
 gint gsb_data_account_first_number ( void );
 gint gsb_data_account_get_account_by_id ( const gchar *account_id );
+GtkWidget *gsb_data_account_get_account_icon_image ( gint account_number );
+GdkPixbuf *gsb_data_account_get_account_icon_pixbuf ( gint account_number );
+GdkPixbuf *gsb_data_account_get_account_standard_pixbuf ( kind_account account_kind );
 gint gsb_data_account_get_accounts_amount ( void );
 gint gsb_data_account_get_bank ( gint account_number );
 gchar *gsb_data_account_get_bank_account_key ( gint account_number );
@@ -58,10 +62,10 @@
 gsb_real gsb_data_account_get_mini_balance_wanted ( gint account_number );
 gboolean gsb_data_account_get_mini_balance_wanted_message ( gint account_number );
 gchar *gsb_data_account_get_name ( gint account_number );
+gchar *gsb_data_account_get_name_icon (gint account_number);
 gint gsb_data_account_get_nb_rows ( gint account_number );
 gint gsb_data_account_get_no_account ( gpointer account_ptr );
 gint gsb_data_account_get_no_account_by_name ( const gchar *account_name );
-gchar *gsb_data_account_get_path_icon (gint account_number);
 gboolean gsb_data_account_get_r ( gint account_number );
 gint gsb_data_account_get_reconcile_sort_type ( gint account_number );
 gfloat gsb_data_account_get_row_align ( gint account_number );
@@ -125,10 +129,10 @@
 							    gboolean value );
 gboolean gsb_data_account_set_name ( gint account_number,
 				     const gchar *name );
+gboolean gsb_data_account_set_name_icon ( gint account_number,
+					       const gchar *filename );
 gboolean gsb_data_account_set_nb_rows ( gint account_number,
 					gint nb_rows );
-gboolean gsb_data_account_set_path_icon ( gint account_number,
-					       const gchar *filename );
 gboolean gsb_data_account_set_r ( gint account_number,
 				  gboolean show_r );
 gboolean gsb_data_account_set_reconcile_sort_type ( gint account_number,



More information about the cvs mailing list