コード例 #1
0
/**
 * Creates the "Payment methods" tab.  It uses a nice GtkTreeView.
 *
 * \param
 *
 * \returns A newly allocated vbox
 */
GtkWidget *gsb_payment_method_config_create ( void )
{
    GtkWidget *vbox_pref, *hbox, *scrolled_window, *paddingbox;
    GtkWidget *vbox, *table, *menu, *item, *label;
    GtkTreeViewColumn *column;
    GtkCellRenderer *cell;
    GtkWidget *bouton_ajouter_type;
    GtkTreeStore *payment_method_model;
    gint width_entry = 80;

    /* Now we have a model, create view */
    vbox_pref = new_vbox_with_title_and_icon ( _("Payment methods"),
					       "payment.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_IN);
    gtk_box_pack_start ( GTK_BOX ( hbox ), scrolled_window,
			 TRUE, TRUE, 0 );

    /* Create tree view */
    payment_method_model = gtk_tree_store_new (NUM_PAYMENT_METHODS_COLUMNS,
					       G_TYPE_STRING,
					       G_TYPE_STRING,
					       G_TYPE_BOOLEAN,
					       G_TYPE_INT,
					       G_TYPE_BOOLEAN,
					       G_TYPE_BOOLEAN,
					       G_TYPE_INT,
					       G_TYPE_INT );
    payment_method_treeview = gtk_tree_view_new_with_model ( GTK_TREE_MODEL (payment_method_model) );
    g_object_unref (G_OBJECT(payment_method_model));
    gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (payment_method_treeview), TRUE);
    g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (payment_method_treeview)),
		      "changed",
		      G_CALLBACK (gsb_payment_method_config_select),
		      payment_method_treeview);

    /* Account */
    cell = gtk_cell_renderer_text_new ();
    column = gtk_tree_view_column_new ( );
    gtk_tree_view_column_pack_end ( column, cell, TRUE );
    gtk_tree_view_column_set_title ( column, _("Account") );
    gtk_tree_view_column_set_attributes (column, cell,
					 "text", PAYMENT_METHODS_NAME_COLUMN,
					 NULL);
    gtk_tree_view_append_column ( GTK_TREE_VIEW(payment_method_treeview), column);

    /* Defaults */
    cell = gtk_cell_renderer_toggle_new ();
    g_signal_connect (cell, "toggled", G_CALLBACK (gsb_payment_method_config_toggled), payment_method_treeview);
    gtk_cell_renderer_toggle_set_radio ( GTK_CELL_RENDERER_TOGGLE(cell), TRUE );
    g_object_set (cell, "xalign", 0.5, NULL);
    column = gtk_tree_view_column_new ( );
    gtk_tree_view_column_set_alignment ( column, 0.5 );
    gtk_tree_view_column_pack_end ( column, cell, TRUE );
    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(payment_method_treeview), column);

    /* Numbering */
    cell = gtk_cell_renderer_text_new ();
    column = gtk_tree_view_column_new ( );
    gtk_tree_view_column_pack_end ( column, cell, TRUE );
    gtk_tree_view_column_set_title ( column, _("Numbering") );
    gtk_tree_view_column_set_attributes (column, cell,
					 "text", PAYMENT_METHODS_NUMBERING_COLUMN,
					 NULL);
    gtk_tree_view_append_column ( GTK_TREE_VIEW(payment_method_treeview), column);

    /* expand all rows after the treeview widget has been realized */
    g_signal_connect (payment_method_treeview, "realize",
		      G_CALLBACK (gtk_tree_view_expand_all), NULL);
    gtk_container_add ( GTK_CONTAINER ( scrolled_window ),
			payment_method_treeview );

    gsb_payment_method_config_fill_list (GTK_TREE_MODEL (payment_method_model));

    /* 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 );
    g_signal_connect ( G_OBJECT ( bouton_ajouter_type ),
		       "clicked",
		       G_CALLBACK (gsb_payment_method_config_add),
		       payment_method_treeview );
    gtk_box_pack_start ( GTK_BOX ( vbox ), bouton_ajouter_type,
			 TRUE, FALSE, 5 );

    /* "Remove payment method" button */
    payment_remove_button = gtk_button_new_from_stock (GTK_STOCK_REMOVE);
    gtk_button_set_relief ( GTK_BUTTON ( payment_remove_button ),
			    GTK_RELIEF_NONE );
    gtk_widget_set_sensitive ( payment_remove_button, FALSE );
    g_signal_connect ( G_OBJECT ( payment_remove_button ),
		       "clicked",
		       G_CALLBACK (gsb_payment_method_config_remove),
		       payment_method_treeview );
    gtk_box_pack_start ( GTK_BOX ( vbox ), payment_remove_button,
			 TRUE, FALSE, 5 );

    /* Payment method details */
    details_paddingbox = new_paddingbox_with_title (vbox_pref, FALSE,
						    _("Payment method details"));
    gtk_widget_set_sensitive ( details_paddingbox, FALSE );

    /* Payment method name */
    table = gtk_table_new ( 3, 3, 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 ( details_paddingbox ), table,
			 TRUE, TRUE, 6 );

    label = gtk_label_new ( _("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 );
    payment_name_entry = gsb_autofunc_entry_new ( NULL,
                        G_CALLBACK (gsb_payment_method_config_name_changed),
                        payment_method_treeview,
                        G_CALLBACK (gsb_data_payment_set_name), 0 );
    gtk_widget_set_size_request ( payment_name_entry, width_entry, -1 );
    gtk_table_attach ( GTK_TABLE ( table ),
		       payment_name_entry, 1, 2, 0, 1,
		       GTK_EXPAND | GTK_FILL, 0,
		       0, 0 );

    /* button show entry, automatic numbering button will be shown only if entry is showed */
    button_show_entry = gsb_autofunc_checkbutton_new ( _("Need entry field"),
						       FALSE,
						       G_CALLBACK (gsb_payment_method_config_show_entry_changed), payment_method_treeview,
						       G_CALLBACK (gsb_data_payment_set_show_entry), 0 );
    gtk_table_attach ( GTK_TABLE ( table ),
		       button_show_entry, 2, 3, 0, 1,
		       GTK_SHRINK | GTK_FILL, 0,
		       0, 0 );


    /* Automatic numbering */
    label = gtk_label_new ( _("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 );
    payment_last_number_entry = gsb_autofunc_spin_new ( 0,
						G_CALLBACK (gsb_payment_method_config_auto_entry_changed),
                        payment_method_treeview,
						G_CALLBACK (gsb_data_payment_set_last_number_from_int),
                        0 );
    gtk_widget_set_size_request ( payment_last_number_entry, width_entry, -1 );
    gtk_table_attach ( GTK_TABLE ( table ),
		       payment_last_number_entry, 1, 2, 1, 2,
		       GTK_EXPAND | GTK_FILL, 0,
		       0, 0 );

    /* button automatic numbering, activate it sensitive the automatic numbering entry */
    button_auto_numbering = gsb_autofunc_checkbutton_new ( _("Activate"),
							   FALSE,
							   G_CALLBACK (gsb_payment_method_config_auto_button_changed), payment_method_treeview,
							   G_CALLBACK (gsb_data_payment_set_automatic_numbering), 0 );
    gtk_table_attach ( GTK_TABLE ( table ),
		       button_auto_numbering, 2, 3, 1, 2,
		       GTK_SHRINK | GTK_FILL, 0,
		       0, 0 );

    /* Payment method method_ptr */
    label = gtk_label_new ( _("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 */
    payment_sign_button = gtk_option_menu_new ();
    menu = gtk_menu_new();
    /* Neutral method_ptr */
    item = gtk_menu_item_new_with_label ( _("Neutral") );
    g_signal_connect ( G_OBJECT ( item ),
		       "activate",
		       G_CALLBACK ( gsb_payment_method_config_sign_changed ),
		       GINT_TO_POINTER (GSB_PAYMENT_NEUTRAL));
    gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), item );
    /* Debit method_ptr */
    item = gtk_menu_item_new_with_label ( _("Debit") );
    g_signal_connect ( G_OBJECT ( item ),
		       "activate",
		       G_CALLBACK ( gsb_payment_method_config_sign_changed ),
		       GINT_TO_POINTER (GSB_PAYMENT_DEBIT));
    gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), item );
    /* Credit method_ptr */
    item = gtk_menu_item_new_with_label ( _("Credit") );
    g_signal_connect ( G_OBJECT ( item ),
		       "activate",
		       G_CALLBACK ( gsb_payment_method_config_sign_changed ),
		       GINT_TO_POINTER (GSB_PAYMENT_CREDIT));
    gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), item );
    /* Set menu */
    gtk_option_menu_set_menu ( GTK_OPTION_MENU ( payment_sign_button ), menu );
    gtk_table_attach ( GTK_TABLE ( table ),
		       payment_sign_button, 1, 3, 2, 3,
		       GTK_EXPAND | GTK_FILL, 0,
		       0, 0 );

    /** Do not set this tab sensitive is no account file is opened. */
    if ( !gsb_data_account_get_accounts_amount () )
    {
	gtk_widget_set_sensitive ( vbox_pref, FALSE );
    }

    return ( vbox_pref );
}
コード例 #2
0
ファイル: gsb_fyear_config.c プロジェクト: wazari972/Grisbi
/**
 * Creates the "Financial years" tab.  It creates a financial years
 * list and then a form that allows to edit selected financial year.
 *
 * \param
 *
 * \returns A newly allocated vbox
 */
GtkWidget *gsb_fyear_config_create_page ( void )
{
    GtkWidget *vbox_pref, *label;
    GtkWidget *scrolled_window, *vbox, *hbox;
    GtkWidget *paddingbox, *table;
    GtkWidget *tree_view;
    GtkTreeModel *tree_model;
    GtkWidget *entry;
    GtkWidget *button;

    vbox_pref = new_vbox_with_title_and_icon ( _("Financial years"),
					       "financial-years.png" );
    paddingbox = new_paddingbox_with_title ( vbox_pref, TRUE,
					     _("Known financial years") );
    hbox = gtk_hbox_new ( FALSE, 5 );
    gtk_box_pack_start ( GTK_BOX ( paddingbox ), hbox,
			 TRUE, TRUE, 0);

    /* Create financial years list */
    scrolled_window = gtk_scrolled_window_new ( NULL, NULL );
    gtk_box_pack_start ( GTK_BOX ( hbox ), scrolled_window,
			 TRUE, TRUE, 0);
    gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW ( scrolled_window ),
				     GTK_POLICY_AUTOMATIC,
				     GTK_POLICY_AUTOMATIC);

    tree_view = gsb_fyear_config_create_list ();
    tree_model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view));
    gtk_container_add ( GTK_CONTAINER ( scrolled_window ),
			tree_view);
    g_signal_connect ( gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
		       "changed",
		       G_CALLBACK (gsb_fyear_config_select),
		       NULL );


    /* Do not activate unless an account is opened */
    if ( gsb_data_account_get_accounts_amount () )
	gsb_fyear_config_fill_list (tree_model);
    else
	gtk_widget_set_sensitive ( vbox_pref, FALSE );


    /* Order buttons in a vbox */
    vbox = gtk_vbox_new ( FALSE, 5 );
    gtk_box_pack_start ( GTK_BOX ( hbox ), vbox,
			 FALSE, FALSE, 0 );

    /* Add button */
    button = gtk_button_new_from_stock (GTK_STOCK_ADD);
    g_signal_connect_swapped ( G_OBJECT (button),
			       "clicked",
			       G_CALLBACK  (gsb_fyear_config_add_fyear),
			       tree_view );
    gtk_box_pack_start ( GTK_BOX ( vbox ), button,
			 FALSE, FALSE, 5 );
    /* Remove button */
    button = gtk_button_new_from_stock (GTK_STOCK_REMOVE);
    gtk_widget_set_sensitive ( button, FALSE );
    g_object_set_data ( G_OBJECT (tree_model),
			"remove_fyear_button", button );
    g_signal_connect_swapped ( G_OBJECT (button),
			       "clicked",
			       G_CALLBACK  (gsb_fyear_config_remove_fyear),
			       tree_view );
    gtk_box_pack_start ( GTK_BOX ( vbox ), button,
			 FALSE, FALSE, 5 );

    /* Associate operations : under the list */
    hbox = gtk_hbox_new ( FALSE, 5 );
    gtk_box_pack_start ( GTK_BOX ( paddingbox ), hbox,
			 FALSE, FALSE, 0);

    button = gtk_button_new_with_label ( _("Associate operations without financial years") );
    g_signal_connect ( G_OBJECT ( button ),
			 "clicked",
			 G_CALLBACK ( gsb_fyear_config_associate_transactions ),
			 NULL );
    gtk_box_pack_start ( GTK_BOX (hbox), button,
			 FALSE, FALSE, 5 );
    gtk_widget_show ( button );

    /* Financial year details */
    paddingbox = new_paddingbox_with_title ( vbox_pref, FALSE,
						     _("Financial year details") );
    g_object_set_data ( G_OBJECT (tree_model),
			"paddingbox_details", paddingbox );

    /* create a hbox, the table on the left
     * and the warning on the right */
    hbox = gtk_hbox_new ( FALSE, 0);
    gtk_box_pack_start ( GTK_BOX (paddingbox), hbox,
			 FALSE, FALSE, 0 );

    /* Put stuff in a table */
    table = gtk_table_new ( 2, 2, FALSE );
    gtk_table_set_row_spacings ( GTK_TABLE ( table ), 6 );
    gtk_table_set_col_spacings ( GTK_TABLE ( table ), 6 );
    gtk_box_pack_start ( GTK_BOX (hbox), table,
			 FALSE, FALSE, 0 );

    /* Financial year name */
    label = gtk_label_new ( _("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 );
    entry = gsb_autofunc_entry_new ( NULL,
				     G_CALLBACK (gsb_fyear_config_modify_fyear), tree_view,
				     G_CALLBACK (gsb_data_fyear_set_name), 0 );
    g_object_set_data ( G_OBJECT (tree_model),
			"fyear_name_entry", entry );
    gtk_table_attach ( GTK_TABLE ( table ),
		       entry, 1, 2, 0, 1,
		       GTK_EXPAND | GTK_FILL, 0,
		       0, 0 );

    /* Start */
    label = gtk_label_new ( _("Start: ") );
    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 );
    entry = gsb_autofunc_date_new ( NULL,
				    G_CALLBACK (gsb_fyear_config_modify_fyear), tree_view,
				    G_CALLBACK (gsb_data_fyear_set_beginning_date), 0 );
    g_object_set_data ( G_OBJECT (tree_model),
			"fyear_begin_date_entry", entry );
    gtk_table_attach ( GTK_TABLE ( table ),
		       entry, 1, 2, 1, 2,
		       GTK_EXPAND | GTK_FILL, 0,
		       0, 0 );

    /* End */
    label = gtk_label_new ( _("End: ") );
    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 );
    entry = gsb_autofunc_date_new ( NULL,
				    G_CALLBACK (gsb_fyear_config_modify_fyear), tree_view,
				    G_CALLBACK (gsb_data_fyear_set_end_date), 0 );
    g_object_set_data ( G_OBJECT (tree_model),
			"fyear_end_date_entry", entry );
    gtk_table_attach ( GTK_TABLE ( table ),
		       entry, 1, 2, 2, 3,
		       GTK_EXPAND | GTK_FILL, 0,
		       0, 0 );

    /* label showed if the fyear is invalid */
    label = gtk_label_new (NULL);
    g_object_set_data ( G_OBJECT (tree_model),
			"invalid_label", label );
    gtk_box_pack_start ( GTK_BOX (hbox), label,
			 FALSE, FALSE, 0 );

    /* Activate in transaction form? */
    button = gsb_autofunc_checkbutton_new ( _("Activate financial year in transaction form"), FALSE,
					    NULL, NULL,
					    G_CALLBACK (gsb_data_fyear_set_form_show), 0);
    g_object_set_data ( G_OBJECT (tree_model),
			"fyear_show_button", button );
    gtk_box_pack_start ( GTK_BOX (paddingbox), button,
			 FALSE, FALSE, 0 );

    gtk_widget_set_sensitive (paddingbox, FALSE );

    return ( vbox_pref );
}
コード例 #3
0
ファイル: gsb_reconcile_config.c プロジェクト: grisbi/grisbi
 /**
 * create the config widget for the reconcile
 * to modify/delete a reconcile
 *
 * \param
 *
 * \return a GtkWidget containing the config widget
 */
GtkWidget *gsb_reconcile_config_create ( void )
{
    GtkWidget *scrolled_window;
    GtkWidget *vbox_pref;
    GtkWidget *paddinggrid;
    GtkTreeViewColumn *column;
    GtkCellRenderer *cell;
    GtkTreeStore *reconcile_model;
    GtkTreeSelection *reconcile_selection;
    GtkWidget *label;
    gint i;
    gfloat alignment[] = {
	COLUMN_LEFT, COLUMN_CENTER, COLUMN_CENTER,
	COLUMN_RIGHT, COLUMN_RIGHT
    };
    gchar *titles[] = {
	_("Account"), _("Init date"), _("Final date"),
	_("Init balance"), _("Final balance")
    };
    GtkWidget *table_selection;
    GtkWidget *button;
    gint width_entry = 80;
	GrisbiWinEtat *w_etat;

	w_etat = (GrisbiWinEtat *) grisbi_win_get_w_etat ();
    vbox_pref = new_vbox_with_title_and_icon ( _("Reconciliation"),
					       "gsb-reconciliation-32.png" );

    gsb_automem_radiobutton3_new_with_title ( vbox_pref,
                        _("Select the end date of reconciliation: "),
                        _("Start Date + one month"),
                        _("Today's date"),
                        NULL,
                        &w_etat->reconcile_end_date,
                        G_CALLBACK ( gsb_reconcile_config_end_date_changed ),
                        NULL,
                        GTK_ORIENTATION_HORIZONTAL );

    paddinggrid = utils_prefs_paddinggrid_new_with_title (vbox_pref, _("List of reconciliations"));
	gtk_widget_set_vexpand (paddinggrid, TRUE);

    /* set the list */
    scrolled_window = utils_prefs_scrolled_window_new ( NULL, GTK_SHADOW_IN, SW_COEFF_UTIL_PG, 200);
    gtk_grid_attach (GTK_GRID (paddinggrid), scrolled_window, 0, 0, 3, 3);

    /* need to create first the table to set it in the arg of the changed signal of selection */
    table_selection = gtk_grid_new ();
    gtk_grid_set_row_spacing (GTK_GRID (table_selection), 6);
    gtk_grid_set_column_spacing (GTK_GRID (table_selection), 6);

    /* create the model */
    reconcile_model = gtk_tree_store_new ( NUM_RECONCILIATION_COLUMNS,
					   G_TYPE_STRING,    /* Name account or reconciliation */
					   G_TYPE_STRING,    /* init date  */
					   G_TYPE_STRING,    /* final date  */
					   G_TYPE_STRING,    /* init balance  */
					   G_TYPE_STRING,    /* final balance  */
					   G_TYPE_INT,       /* Account number */
					   G_TYPE_INT,       /* Bold or regular text */
					   G_TYPE_INT,		 /* reconciliation number */
					   GDK_TYPE_RGBA);

	reconcile_treeview = gtk_tree_view_new_with_model ( GTK_TREE_MODEL (reconcile_model) );
	gtk_widget_set_name (reconcile_treeview, "tree_view");
    g_object_unref (G_OBJECT(reconcile_model));
    gtk_tree_selection_set_mode ( gtk_tree_view_get_selection (GTK_TREE_VIEW (reconcile_treeview)),
				  GTK_SELECTION_SINGLE );
    gtk_container_add ( GTK_CONTAINER (scrolled_window), reconcile_treeview );

    reconcile_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (reconcile_treeview));
    g_signal_connect (reconcile_selection,
                      "changed",
                      G_CALLBACK (gsb_reconcile_config_select),
                      table_selection);

    /* Name */
    for (i=RECONCILIATION_NAME_COLUMN ; i<RECONCILIATION_ACCOUNT_COLUMN ; i++)
    {
	cell = gtk_cell_renderer_text_new ();
	g_object_set ( G_OBJECT (cell),
		       "xalign", alignment[i],
		       NULL );
	column = gtk_tree_view_column_new ();
	gtk_tree_view_column_set_sizing ( column,
					  GTK_TREE_VIEW_COLUMN_AUTOSIZE );
	gtk_tree_view_column_set_alignment ( column,
					     alignment[i] );
	gtk_tree_view_column_pack_end ( column, cell, TRUE );
	gtk_tree_view_column_set_title ( column, titles[i] );
	gtk_tree_view_column_set_attributes (column, cell,
					     "text", i,
					     "weight", RECONCILIATION_WEIGHT_COLUMN,
						 "cell-background-rgba", RECONCILIATION_BACKGROUND_COLOR,
					     NULL);
	gtk_tree_view_column_set_expand ( column, TRUE );
	gtk_tree_view_column_set_resizable ( column,
					     TRUE );
	gtk_tree_view_append_column ( GTK_TREE_VIEW(reconcile_treeview), column);
    }

    /* Various remaining settings */
    gsb_reconcile_config_fill();

    /* Set the reconcile_sort */
    button = gsb_automem_checkbutton_new (_("Sort by descending date the reconciliations"),
                                          &w_etat->reconcile_sort,
                                          G_CALLBACK (gsb_reconcile_config_sort_reconcile),
                                          NULL);
    gtk_widget_set_margin_top (button, MARGIN_TOP);
    gtk_grid_attach (GTK_GRID (paddinggrid), button, 0, 3, 1, 1);

	button = gtk_button_new_with_label (_("Collapse row"));
	gtk_widget_set_sensitive (button, FALSE);
	g_signal_connect (G_OBJECT (button),
					  "clicked",
					  G_CALLBACK (gsb_reconcile_button_collapse_row_clicked),
					  reconcile_selection);
	gtk_grid_attach (GTK_GRID (paddinggrid), button, 1, 3, 1, 1);

	/* set signal here because data is button */
    g_signal_connect (reconcile_treeview,
                      "row-expanded",
                      G_CALLBACK (gsb_reconcile_treeview_row_expanded),
                      button);

    g_signal_connect (reconcile_treeview,
                      "row-collapsed",
                      G_CALLBACK (gsb_reconcile_treeview_row_collapsed),
                      button);

    /* set the modifying part under the list */
    paddinggrid = utils_prefs_paddinggrid_new_with_title (vbox_pref,_("Selected reconcile") );

    /* for that we make a table 2x3 but with the names 4x3,
     * the table has been set before to accept as arg on the changed selection */
    gtk_grid_attach (GTK_GRID (paddinggrid), table_selection, 0, 0, 1, 1);

    /* set the name */
	label = gtk_label_new ( _("Reconciliation reference: ") );
	utils_labels_set_alignment ( GTK_LABEL (label), 0, 0.5);
	gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT );
	gtk_grid_attach (GTK_GRID (table_selection), label, 0, 0, 1, 1);

	reconcile_name_entry = gsb_autofunc_entry_new ( NULL,
			G_CALLBACK (gsb_reconcile_config_update_line), reconcile_treeview,
			G_CALLBACK (gsb_data_reconcile_set_name), 0 );
    gtk_widget_set_size_request ( reconcile_name_entry, width_entry, -1 );
	gtk_grid_attach (GTK_GRID (table_selection), reconcile_name_entry, 1, 0, 1, 1);

	/* set the initial date */
	label = gtk_label_new ( _("Initial date: ") );
	utils_labels_set_alignment ( GTK_LABEL (label), 0, 0.5);
	gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT );
	gtk_grid_attach (GTK_GRID (table_selection), label, 0, 1, 1, 1);

	reconcile_init_date_entry = gsb_autofunc_date_new ( NULL,
			G_CALLBACK (gsb_reconcile_config_update_line), reconcile_treeview,
			G_CALLBACK (gsb_data_reconcile_set_init_date), 0 );
    gtk_widget_set_size_request ( reconcile_init_date_entry, width_entry, -1 );
	gtk_grid_attach (GTK_GRID (table_selection), reconcile_init_date_entry, 1, 1, 1, 1);

    /* set the final date */
	label = gtk_label_new ( _("Final date: ") );
	utils_labels_set_alignment ( GTK_LABEL (label), 0, 0.5);
	gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT );
	gtk_grid_attach (GTK_GRID (table_selection), label, 0, 2, 1, 1);

	reconcile_final_date_entry = gsb_autofunc_date_new ( NULL,
			G_CALLBACK (gsb_reconcile_config_update_line), reconcile_treeview,
			G_CALLBACK (gsb_data_reconcile_set_final_date), 0 );
    gtk_widget_set_size_request ( reconcile_final_date_entry, width_entry, -1 );
	gtk_grid_attach (GTK_GRID (table_selection), reconcile_final_date_entry, 1, 2, 1, 1);

    /* set the delete button */
	delete_reconcile_button = gtk_button_new_with_label (_("Delete the reconcile"));
    gtk_button_set_relief ( GTK_BUTTON (delete_reconcile_button), GTK_RELIEF_NORMAL);
	g_signal_connect ( G_OBJECT (delete_reconcile_button), "clicked",
			G_CALLBACK (gsb_reconcile_config_delete),
			reconcile_treeview );
	gtk_grid_attach (GTK_GRID (table_selection), delete_reconcile_button, 2, 0, 2, 1);

	/* set the initial balance */
	label = gtk_label_new ( _("Initial balance: ") );
	utils_labels_set_alignment ( GTK_LABEL (label), 0, 0.5);
	gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT );
	gtk_grid_attach (GTK_GRID (table_selection), label, 2, 1, 1, 1);

	reconcile_init_balance_entry = gsb_autofunc_real_new ( null_real,
			G_CALLBACK (gsb_reconcile_config_update_line), reconcile_treeview,
			G_CALLBACK (gsb_data_reconcile_set_init_balance), 0 );
    gtk_widget_set_size_request ( reconcile_init_balance_entry, width_entry, -1 );
	gtk_grid_attach (GTK_GRID (table_selection), reconcile_init_balance_entry, 3, 1, 1, 1);

    /* set the final balance */
	label = gtk_label_new ( _("Final balance: ") );
	utils_labels_set_alignment ( GTK_LABEL (label), 0, 0.5);
	gtk_label_set_justify ( GTK_LABEL (label), GTK_JUSTIFY_LEFT );
	gtk_grid_attach (GTK_GRID (table_selection), label, 2, 2, 1, 1);

	reconcile_final_balance_entry = gsb_autofunc_real_new ( null_real,
			G_CALLBACK (gsb_reconcile_config_update_line), reconcile_treeview,
			G_CALLBACK (gsb_data_reconcile_set_final_balance), 0 );
    gtk_widget_set_size_request ( reconcile_final_balance_entry, width_entry, -1 );
    gtk_grid_attach (GTK_GRID (table_selection), reconcile_final_balance_entry, 3, 2, 1, 1);

	/* at the beginning, the table is unsensitive */
	gtk_widget_set_sensitive ( table_selection, FALSE );

    /* set the button to find non-associated transactions */
	button = gtk_button_new_with_label (
                        _("Find all marked transactions not associated with a reconciliation"));
	gtk_button_set_relief ( GTK_BUTTON (button), GTK_RELIEF_NORMAL );
    utils_widget_set_padding (button, 0, MARGIN_TOP);
	g_signal_connect ( G_OBJECT (button),
                      "clicked",
                      G_CALLBACK (gsb_reconcile_config_find_alone_transactions),
                      NULL );
    gtk_grid_attach (GTK_GRID (paddinggrid), button, 0, 1, 1, 1);

    gtk_widget_show_all (vbox_pref);
	utils_set_tree_store_background_color (reconcile_treeview, RECONCILIATION_BACKGROUND_COLOR);

	if ( !gsb_data_account_get_accounts_amount () )
    {
	gtk_widget_set_sensitive ( vbox_pref, FALSE );
    }

    return vbox_pref;
}