rem: col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), -1, _("Default"), cell, "active", PAYMENT_METHODS_DEFAULT_COLUMN, "activatable", PAYMENT_METHODS_ACTIVABLE_COLUMN, "visible", PAYMENT_METHODS_VISIBLE_COLUMN, NULL); column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1); gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
add: column = gtk_tree_view_column_new ( ); gtk_tree_view_column_pack_end ( column, cell, FALSE ); gtk_tree_view_column_set_title ( column, _("Default") ); gtk_tree_view_column_set_attributes (column, cell, "active", PAYMENT_METHODS_DEFAULT_COLUMN, "activatable", PAYMENT_METHODS_ACTIVABLE_COLUMN, "visible", PAYMENT_METHODS_VISIBLE_COLUMN, NULL); gtk_tree_view_append_column ( GTK_TREE_VIEW(treeview), column);
context: GtkWidget *onglet_types_operations ( void ){  GtkWidget *vbox_pref, *hbox, *scrolled_window, *paddingbox;  GtkWidget *vbox, *table, *menu, *item, *label, *bouton;  GtkWidget *treeview;  GtkTreeStore *model;  GtkTreeViewColumn *column;  GtkCellRenderer *cell;  GtkTreeIter account_iter, debit_iter, credit_iter, child_iter;  gint i, col_offset;  vbox_pref = new_vbox_with_title_and_icon ( _("Reconciliation"),					     "reconciliation.png" );  /* Copy lists so that we work on temporary lists. */  liste_tmp_types = malloc ( nb_comptes * sizeof (gpointer));  type_defaut_debit = malloc ( nb_comptes * sizeof (gint));  type_defaut_credit = malloc ( nb_comptes * sizeof (gint));  liste_tri_tmp = malloc ( nb_comptes * sizeof (gpointer));  tri_tmp = malloc ( nb_comptes * sizeof (gint));  neutres_inclus_tmp = malloc ( nb_comptes * sizeof (gint));  p_tab_nom_de_compte_variable = p_tab_nom_de_compte;  for ( i = 0 ; i < nb_comptes ; i++ )    {      GSList *liste_tmp;      GSList *liste_types_tmp;      liste_tmp = TYPES_OPES;      liste_types_tmp = NULL;      while ( liste_tmp )	{	  struct struct_type_ope *type_ope;	  struct struct_type_ope *type_ope_tmp;	  type_ope = liste_tmp -> data;	  type_ope_tmp = malloc ( sizeof ( struct struct_type_ope ));	  type_ope_tmp -> no_type = type_ope -> no_type;	  type_ope_tmp -> nom_type = g_strdup ( type_ope -> nom_type );	  type_ope_tmp -> signe_type = type_ope -> signe_type;	  type_ope_tmp -> affiche_entree = type_ope -> affiche_entree;	  type_ope_tmp -> numerotation_auto = type_ope -> numerotation_auto;	  type_ope_tmp -> no_en_cours = type_ope -> no_en_cours;	  type_ope_tmp -> no_compte = type_ope -> no_compte;	  liste_types_tmp = g_slist_append ( liste_types_tmp,					     type_ope_tmp );	  liste_tmp = liste_tmp -> next;	}      liste_tmp_types[i] = liste_types_tmp;      type_defaut_debit[i] = TYPE_DEFAUT_DEBIT;      type_defaut_credit[i] = TYPE_DEFAUT_CREDIT;      /* on s'occupe des tris */      tri_tmp[i] = TRI;      neutres_inclus_tmp[i] = NEUTRES_INCLUS;      liste_tmp = LISTE_TRI;      liste_types_tmp = NULL;      while ( liste_tmp )	{	  liste_types_tmp = g_slist_append ( liste_types_tmp,					     liste_tmp -> data );	  liste_tmp = liste_tmp -> next;	}      liste_tri_tmp[i] = liste_types_tmp;      p_tab_nom_de_compte_variable++;    }  /* Now we have a model, create view */  vbox_pref = new_vbox_with_title_and_icon ( _("Payment methods"),					     "payment-methods.png" );  /* Known payment methods */  paddingbox = new_paddingbox_with_title (vbox_pref, TRUE,					  _("Known payment methods"));  hbox = gtk_hbox_new ( FALSE, 6 );  gtk_box_pack_start ( GTK_BOX ( paddingbox ), hbox,		       TRUE, TRUE, 0 );  /* Create tree */  scrolled_window = gtk_scrolled_window_new ( NULL, NULL );  gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW ( scrolled_window ),				   GTK_POLICY_AUTOMATIC,				   GTK_POLICY_AUTOMATIC );  gtk_scrolled_window_set_shadow_type ( GTK_SCROLLED_WINDOW ( scrolled_window ),					GTK_SHADOW_ETCHED_IN );  gtk_box_pack_start ( GTK_BOX ( hbox ), scrolled_window,		       TRUE, TRUE, 0 );  /* Create tree view */  model = gtk_tree_store_new (NUM_PAYMENT_METHODS_COLUMNS,			      G_TYPE_STRING,			      G_TYPE_STRING,			      G_TYPE_BOOLEAN,			      G_TYPE_BOOLEAN,			      G_TYPE_BOOLEAN);  treeview = gtk_tree_view_new_with_model ( GTK_TREE_MODEL (model) );  gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);/*   g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)),  *//* 		    "changed",  *//* 		    G_CALLBACK (select_currency_in_iso_list), *//* 		    model); */  cell = gtk_cell_renderer_text_new ();  col_offset =     gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),						 -1, _("Accounts"),						 cell, "text",						 PAYMENT_METHODS_NAME_COLUMN,						 NULL);  column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);  gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);  cell = gtk_cell_renderer_text_new ();  col_offset =     gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),						 -1, _("Numbering"),						 cell, "text",						 PAYMENT_METHODS_NUMBERING_COLUMN,						 NULL);  column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);  gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);  cell = gtk_cell_renderer_toggle_new ();  g_signal_connect (cell, "toggled", G_CALLBACK (item_toggled), model);  gtk_tree_view_column_set_sizing ( cell, GTK_TREE_VIEW_COLUMN_AUTOSIZE );  gtk_cell_renderer_toggle_set_radio ( GTK_CELL_RENDERER_TOGGLE(cell), TRUE );  col_offset =     gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),						 -1, _("Default"), cell, 						 "active", PAYMENT_METHODS_DEFAULT_COLUMN,						 "activatable", PAYMENT_METHODS_ACTIVABLE_COLUMN,						 "visible", PAYMENT_METHODS_VISIBLE_COLUMN,						 NULL);  column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);  gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);  /* Sort columns accordingly *//*   gtk_tree_sortable_set_default_sort_func (model, sort_tree, NULL, NULL); *//*   gtk_tree_sortable_set_sort_func (model, COUNTRY_NAME_COLUMN, sort_tree, NULL, NULL); *//*   gtk_tree_sortable_set_sort_column_id (model, COUNTRY_NAME_COLUMN, GTK_SORT_ASCENDING); */  /* expand all rows after the treeview widget has been realized */  g_signal_connect (treeview, "realize",		    G_CALLBACK (gtk_tree_view_expand_all), NULL);  gtk_container_add ( GTK_CONTAINER ( scrolled_window ),		      treeview );  /* Fill tree, iter over with accounts */  p_tab_nom_de_compte_variable = p_tab_nom_de_compte;  for ( i=0 ; i<nb_comptes ; i++ )    {      GtkCTreeNode *node_compte;      GtkCTreeNode *node_debit;      GtkCTreeNode *node_credit;      gchar *ligne[2];      GSList *liste_tmp;      gtk_tree_store_append (model, &account_iter, NULL);      gtk_tree_store_set (model, &account_iter,			  PAYMENT_METHODS_NAME_COLUMN, NOM_DU_COMPTE,			  PAYMENT_METHODS_NUMBERING_COLUMN, FALSE,			  PAYMENT_METHODS_DEFAULT_COLUMN, FALSE,			  PAYMENT_METHODS_ACTIVABLE_COLUMN, FALSE, 			  PAYMENT_METHODS_VISIBLE_COLUMN, FALSE, 			  -1 );      /* Create the "Debit" node */      gtk_tree_store_append (model, &debit_iter, &account_iter);      gtk_tree_store_set (model, &debit_iter,			  PAYMENT_METHODS_NAME_COLUMN, _("Debit"),			  PAYMENT_METHODS_NUMBERING_COLUMN, FALSE,			  PAYMENT_METHODS_DEFAULT_COLUMN, FALSE,			  PAYMENT_METHODS_ACTIVABLE_COLUMN, FALSE, 			  PAYMENT_METHODS_VISIBLE_COLUMN, FALSE, 			  -1 );      /* Create the "Debit" node */      gtk_tree_store_append (model, &credit_iter, &account_iter);      gtk_tree_store_set (model, &credit_iter,			  PAYMENT_METHODS_NAME_COLUMN, _("Credit"),			  PAYMENT_METHODS_NUMBERING_COLUMN, FALSE,			  PAYMENT_METHODS_DEFAULT_COLUMN, FALSE,			  PAYMENT_METHODS_ACTIVABLE_COLUMN, FALSE, 			  PAYMENT_METHODS_VISIBLE_COLUMN, FALSE, 			  -1 );      /* Iter over account payment methods */      liste_tmp = liste_tmp_types[i];      while ( liste_tmp )	{	  struct struct_type_ope *type_ope;	  GtkTreeIter * parent_iter;	  GtkTreeIter method_iter;	  gboolean isdefault;	  gchar * number;	  type_ope = liste_tmp->data;	  if ( type_ope -> no_type == TYPE_DEFAUT_DEBIT	       ||	       type_ope -> no_type == TYPE_DEFAUT_CREDIT )	    isdefault = 1;	  else	    isdefault = 0;	  if ( !type_ope -> signe_type )	    parent_iter = &account_iter;	  else	    if ( type_ope -> signe_type == 1 )	      parent_iter = &debit_iter;	    else	      parent_iter = &credit_iter;	  if ( type_ope -> numerotation_auto )	    {	      number = itoa ( type_ope -> no_en_cours );	    }	  else	    {	      number = "";	    }	  /* Insert a child node */	  gtk_tree_store_append (model, &method_iter, parent_iter);	  gtk_tree_store_set (model, &method_iter,			      PAYMENT_METHODS_NAME_COLUMN, type_ope -> nom_type,			      PAYMENT_METHODS_NUMBERING_COLUMN, number,			      PAYMENT_METHODS_DEFAULT_COLUMN, isdefault,			      PAYMENT_METHODS_ACTIVABLE_COLUMN, TRUE, 			      PAYMENT_METHODS_VISIBLE_COLUMN, TRUE, 			      -1 );	  liste_tmp = liste_tmp -> next;	}      p_tab_nom_de_compte_variable++;    }  /* Create "Add" & "Remove" buttons */  vbox = gtk_vbox_new ( FALSE, 6 );  gtk_box_pack_start ( GTK_BOX ( hbox ), vbox,		       FALSE, FALSE, 0 );  /* "Add payment method" button */  bouton_ajouter_type = gtk_button_new_from_stock (GTK_STOCK_ADD);  gtk_button_set_relief ( GTK_BUTTON ( bouton_ajouter_type ),			  GTK_RELIEF_NONE );  gtk_widget_set_sensitive ( bouton_ajouter_type, FALSE );  gtk_signal_connect ( GTK_OBJECT ( bouton_ajouter_type ),		       "clicked",		       (GtkSignalFunc ) ajouter_type_operation,		       NULL );  gtk_box_pack_start ( GTK_BOX ( vbox ), bouton_ajouter_type,		       TRUE, FALSE, 5 );  /* "Remove payment method" button */  bouton_retirer_type = gtk_button_new_from_stock (GTK_STOCK_REMOVE);  gtk_button_set_relief ( GTK_BUTTON ( bouton_retirer_type ),			  GTK_RELIEF_NONE );  gtk_widget_set_sensitive ( bouton_retirer_type, FALSE );  gtk_signal_connect ( GTK_OBJECT ( bouton_retirer_type ),		       "clicked",		       (GtkSignalFunc ) supprimer_type_operation,		       NULL );  gtk_box_pack_start ( GTK_BOX ( vbox ), bouton_retirer_type,		       TRUE, FALSE, 5 );  /* Payment method details */  paddingbox = new_paddingbox_with_title (vbox_pref, FALSE,					  _("Payment method details"));  gtk_widget_set_sensitive ( paddingbox, FALSE );  /* Payment method name */  table = gtk_table_new ( 2, 2, FALSE );  gtk_table_set_col_spacings ( GTK_TABLE ( table ), 6 );  gtk_table_set_row_spacings ( GTK_TABLE ( table ), 6 );  gtk_box_pack_start ( GTK_BOX ( paddingbox ), table,		       TRUE, TRUE, 6 );  label = gtk_label_new ( COLON(_("Name")) );  gtk_misc_set_alignment (GTK_MISC (label), 0, 1);  gtk_label_set_justify ( GTK_LABEL(label), GTK_JUSTIFY_RIGHT );  gtk_table_attach ( GTK_TABLE ( table ),		     label, 0, 1, 0, 1,		     GTK_SHRINK | GTK_FILL, 0,		     0, 0 );  entree_type_nom = gtk_entry_new ();  gtk_signal_connect ( GTK_OBJECT ( entree_type_nom ), /* FIXME: check this*/		       "changed",		       GTK_SIGNAL_FUNC ( modification_entree_nom_type ),		       NULL );  gtk_table_attach ( GTK_TABLE ( table ),		     entree_type_nom, 1, 2, 0, 1,		     GTK_EXPAND | GTK_FILL, 0,		     0, 0 );  /* Automatic numbering */  label = gtk_label_new ( COLON(_("Automatic numbering")) );  gtk_misc_set_alignment (GTK_MISC (label), 0, 1);  gtk_label_set_justify ( GTK_LABEL(label), GTK_JUSTIFY_RIGHT );  gtk_table_attach ( GTK_TABLE ( table ),		     label, 0, 1, 1, 2,		     GTK_SHRINK | GTK_FILL, 0,		     0, 0 );  entree_type_dernier_no = gtk_entry_new ();  gtk_table_attach ( GTK_TABLE ( table ),		     entree_type_dernier_no, 1, 2, 1, 2,		     GTK_EXPAND | GTK_FILL, 0,		     0, 0 );  gtk_signal_connect ( GTK_OBJECT (entree_type_dernier_no  ),		       "changed",		       GTK_SIGNAL_FUNC ( modification_entree_type_dernier_no ),		       NULL );  /* Payment method type */  label = gtk_label_new ( COLON(_("Type")) );  gtk_misc_set_alignment (GTK_MISC (label), 0, 1);  gtk_label_set_justify ( GTK_LABEL(label), GTK_JUSTIFY_RIGHT );  gtk_table_attach ( GTK_TABLE ( table ),		     label, 0, 1, 2, 3,		     GTK_SHRINK | GTK_FILL, 0,		     0, 0 );  /* Create menu */  bouton_signe_type = gtk_option_menu_new ();  menu = gtk_menu_new();  /* Neutral type */  item = gtk_menu_item_new_with_label ( _("Neutral") );  gtk_signal_connect_object ( GTK_OBJECT ( item ),			      "activate",			      GTK_SIGNAL_FUNC ( modification_type_signe ),			      NULL );  gtk_menu_append ( GTK_MENU ( menu ), item );  /* Debit type */  item = gtk_menu_item_new_with_label ( _("Debit") );  gtk_signal_connect_object ( GTK_OBJECT ( item ),			      "activate",			      GTK_SIGNAL_FUNC ( modification_type_signe ),			      GINT_TO_POINTER (1) );  gtk_menu_append ( GTK_MENU ( menu ), item );  /* Credit type */  item = gtk_menu_item_new_with_label ( _("Credit") );  gtk_signal_connect_object ( GTK_OBJECT ( item ),			      "activate",			      GTK_SIGNAL_FUNC ( modification_type_signe ),			      GINT_TO_POINTER (2) );  gtk_menu_append ( GTK_MENU ( menu ), item );  /* Set menu */  gtk_option_menu_set_menu ( GTK_OPTION_MENU ( bouton_signe_type ), menu );  gtk_table_attach ( GTK_TABLE ( table ),		     bouton_signe_type, 1, 2, 2, 3,		     GTK_EXPAND | GTK_FILL, 0,		     0, 0 );  /* FIXME: put this in the treeview *//*   bouton_type_choix_defaut = gtk_check_button_new_with_label ( _("Default") ); *//*   gtk_signal_connect_object ( GTK_OBJECT ( bouton_type_choix_defaut ), *//* 			      "toggled", *//* 			      GTK_SIGNAL_FUNC ( modification_type_par_defaut ), *//* 			      NULL ); */  /* Trap list changes */  gtk_signal_connect ( GTK_OBJECT ( arbre_types_operations ),		       "tree-select-row",		       GTK_SIGNAL_FUNC ( selection_ligne_arbre_types ),		       paddingbox );  gtk_signal_connect ( GTK_OBJECT ( arbre_types_operations ),		       "tree-unselect-row",		       GTK_SIGNAL_FUNC ( deselection_ligne_arbre_types ),		       paddingbox );  return ( vbox_pref );}