/** * callback called when select a line in the tree * fill the entry of the name, dates and balances * * \param selection the GtkTreeSelection * \param table the GtkTable containing the widgets to set the value of the selection * * \return FALSE */ gboolean gsb_reconcile_config_select ( GtkTreeSelection *selection, GtkWidget *table ) { GtkTreeIter iter; GtkTreeModel *model; gboolean good; good = gtk_tree_selection_get_selected (selection, &model, &iter); if (good) { gint reconcile_number; gtk_tree_model_get (model, &iter, RECONCILIATION_RECONCILE_COLUMN, &reconcile_number, -1 ); if (reconcile_number) { /* we are on a payment method, we fill the fields */ gsb_autofunc_entry_set_value ( reconcile_name_entry, gsb_data_reconcile_get_name (reconcile_number), reconcile_number ); gsb_autofunc_date_set ( reconcile_init_date_entry, gsb_data_reconcile_get_init_date (reconcile_number), reconcile_number); gsb_autofunc_date_set ( reconcile_final_date_entry, gsb_data_reconcile_get_final_date (reconcile_number), reconcile_number ); gsb_autofunc_real_set ( reconcile_init_balance_entry, gsb_data_reconcile_get_init_balance (reconcile_number), reconcile_number ); gsb_autofunc_real_set ( reconcile_final_balance_entry, gsb_data_reconcile_get_final_balance (reconcile_number), reconcile_number ); /* we make the table sensitive */ gtk_widget_set_sensitive ( table, TRUE ); } else gtk_widget_set_sensitive ( table, FALSE ); } else gtk_widget_set_sensitive ( table, FALSE ); return FALSE; }
/** * called when change the selection of the fyear * * \param tree_selection * \param null * * \return FALSE * */ gboolean gsb_fyear_config_select ( GtkTreeSelection *tree_selection, gpointer null ) { GtkTreeModel *model; GtkTreeIter iter; gint fyear_number; GtkWidget *tree_view; GtkWidget *widget; if (!gtk_tree_selection_get_selected ( GTK_TREE_SELECTION (tree_selection), &model, &iter )) return FALSE; gtk_tree_model_get ( GTK_TREE_MODEL (model), &iter, FYEAR_NUMBER_COLUMN, &fyear_number, -1 ); tree_view = GTK_WIDGET (gtk_tree_selection_get_tree_view (tree_selection)); /* set the name */ widget = g_object_get_data ( G_OBJECT (model), "fyear_name_entry" ); gsb_autofunc_entry_set_value ( widget, gsb_data_fyear_get_name (fyear_number), fyear_number ); /* set the beginning date */ widget = g_object_get_data ( G_OBJECT (model), "fyear_begin_date_entry" ); gsb_calendar_entry_set_color (widget, TRUE); gsb_autofunc_date_set ( widget, gsb_data_fyear_get_beginning_date (fyear_number), fyear_number ); /* set the end date */ widget = g_object_get_data ( G_OBJECT (model), "fyear_end_date_entry" ); gsb_calendar_entry_set_color (widget, TRUE); gsb_autofunc_date_set ( widget, gsb_data_fyear_get_end_date (fyear_number), fyear_number ); /* set the button */ widget = g_object_get_data ( G_OBJECT (model), "fyear_show_button" ); gsb_autofunc_checkbutton_set_value ( widget, gsb_data_fyear_get_form_show (fyear_number), fyear_number ); /* set the invalid label */ widget = g_object_get_data ( G_OBJECT (model), "invalid_label" ); if (gsb_data_fyear_get_invalid (fyear_number)) { gtk_label_set_markup ( GTK_LABEL (widget), gsb_data_fyear_get_invalid_message (fyear_number)); gtk_widget_show (widget); } else gtk_widget_hide (widget); /* sensitive what is needed */ gtk_widget_set_sensitive ( g_object_get_data ( G_OBJECT (model), "paddingbox_details" ), TRUE ); gtk_widget_set_sensitive ( g_object_get_data ( G_OBJECT (model), "remove_fyear_button" ), TRUE ); return FALSE; }