GnuCash 2.4.99
qofsession.h
Go to the documentation of this file.
00001 /********************************************************************\
00002  * qofsession.h -- session access (connection to backend)           *
00003  *                                                                  *
00004  * This program is free software; you can redistribute it and/or    *
00005  * modify it under the terms of the GNU General Public License as   *
00006  * published by the Free Software Foundation; either version 2 of   *
00007  * the License, or (at your option) any later version.              *
00008  *                                                                  *
00009  * This program is distributed in the hope that it will be useful,  *
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
00012  * GNU General Public License for more details.                     *
00013  *                                                                  *
00014  * You should have received a copy of the GNU General Public License*
00015  * along with this program; if not, contact:                        *
00016  *                                                                  *
00017  * Free Software Foundation           Voice:  +1-617-542-5942       *
00018  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
00019  * Boston, MA  02110-1301,  USA       gnu@gnu.org                   *
00020  *                                                                  *
00021 \********************************************************************/
00022 
00098 #ifndef QOF_SESSION_H
00099 #define QOF_SESSION_H
00100 
00101 #include "qofbackend.h"
00102 #include "qofbook.h"
00103 #include "qofclass.h"
00104 #include "qofobject.h"
00105 
00106 #define QOF_MOD_SESSION "qof.session"
00107 
00108 /* PROTOTYPES ******************************************************/
00109 
00110 typedef struct _QofSession    QofSession;
00111 
00112 QofSession * qof_session_new (void);
00113 void         qof_session_destroy (QofSession *session);
00114 
00118 void qof_session_swap_data (QofSession *session_1, QofSession *session_2);
00119 
00150 void qof_session_begin (QofSession *session, const char * book_id,
00151                         gboolean ignore_lock, gboolean create,
00152                         gboolean force);
00153 
00154 
00168 typedef void (*QofPercentageFunc) (const char *message, double percent);
00169 void qof_session_load (QofSession *session,
00170                        QofPercentageFunc percentage_func);
00171 
00177 QofBackendError qof_session_get_error (QofSession *session);
00178 const char * qof_session_get_error_message(const QofSession *session);
00179 
00190 QofBackendError qof_session_pop_error (QofSession *session);
00195 QofBook * qof_session_get_book (const QofSession *session);
00196 
00211 const char * qof_session_get_file_path (const QofSession *session);
00212 
00213 const char * qof_session_get_url (const QofSession *session);
00214 
00219 /* gboolean qof_session_not_saved(const QofSession *session); <- unimplemented */
00220 gboolean qof_session_save_in_progress(const QofSession *session);
00221 
00228 void     qof_session_save (QofSession *session,
00229                            QofPercentageFunc percentage_func);
00230 
00238 void     qof_session_safe_save (QofSession *session,
00239                                 QofPercentageFunc percentage_func);
00240 
00249 void     qof_session_end  (QofSession *session);
00250 
00269 #define QOF_STDOUT ">"
00270 
00278 gboolean qof_session_events_pending (const QofSession *session);
00279 
00284 gboolean qof_session_process_events (QofSession *session);
00293 void qof_session_add_close_hook (GFunc fn, gpointer data);
00294 
00299 void qof_session_call_close_hooks (QofSession *session);
00300 
00301 gboolean qof_session_export (QofSession *tmp_session,
00302                              QofSession *real_session,
00303                              QofPercentageFunc percentage_func);
00304 
00308 GList* qof_backend_get_registered_access_method_list(void);
00309 
00312 void qof_session_ensure_all_data_loaded(QofSession* session);
00313 
00314 #endif /* QOF_SESSION_H */
00315 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines