00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _LIBGDAMM_CONFIG_H
00024 #define _LIBGDAMM_CONFIG_H
00025
00026 #include <libgdamm/providerinfo.h>
00027 #include <libgdamm/datasourceinfo.h>
00028 #include <libgdamm/datamodel.h>
00029 #include <glibmm.h>
00030
00031 namespace Gnome
00032 {
00033
00034 namespace Gda
00035 {
00036
00037 namespace Config
00038 {
00039
00040
00041 Glib::ustring get_value_string(const Glib::ustring& path);
00042 int get_value_int(const Glib::ustring& path);
00043 double get_value_float(const Glib::ustring& path);
00044 bool get_value_boolean(const Glib::ustring& path);
00045 void set_value(const Glib::ustring& path, const Glib::ustring& new_value);
00046 void set_value(const Glib::ustring& path, int new_value);
00047 void set_value(const Glib::ustring& path, double new_value);
00048 void set_value(const Glib::ustring& path, bool new_value);
00049
00050 void remove_section(const Glib::ustring& path);
00051 void remove_key(const Glib::ustring& path);
00052 bool has_section(const Glib::ustring& path);
00053 bool has_key(const Glib::ustring& path);
00054
00055 Glib::ListHandle<Glib::ustring> list_sections(const Glib::ustring& path);
00056 Glib::ListHandle<Glib::ustring> list_keys(const Glib::ustring& path);
00057 Glib::ustring get_type(const Glib::ustring& path);
00058
00059
00061 typedef sigc::slot<void, const Glib::ustring&> SlotListener;
00062
00063 guint add_listener(const Glib::ustring& path, const SlotListener& slot);
00064 void remove_listener(guint id);
00065
00066 struct ProviderInfoTraits
00067 {
00068 typedef Gnome::Gda::ProviderInfo CppType;
00069 typedef const GdaProviderInfo* CType;
00070 typedef GdaProviderInfo* CTypeNonConst;
00071
00072 static CType to_c_type (const CppType& obj) { return obj.gobj(); }
00073 static CType to_c_type (CType ptr) { return ptr; }
00074 static CppType to_cpp_type (CType ptr) { return CppType(const_cast<CTypeNonConst>(ptr), true); }
00075 static void release_c_type (CType ptr) { gda_provider_info_free(const_cast<CTypeNonConst>(ptr)); }
00076 };
00077
00078 typedef Glib::ListHandle<ProviderInfo, ProviderInfoTraits> ListHandle_ProviderInfo;
00079 ListHandle_ProviderInfo get_providers();
00080
00081 ProviderInfo get_provider_by_name(const Glib::ustring& name);
00082
00083 struct DataSourceInfoTraits
00084 {
00085 typedef Gnome::Gda::DataSourceInfo CppType;
00086 typedef const GdaDataSourceInfo* CType;
00087 typedef GdaDataSourceInfo* CTypeNonConst;
00088
00089 static CType to_c_type (const CppType& obj) { return obj.gobj(); }
00090 static CType to_c_type (CType ptr) { return ptr; }
00091 static CppType to_cpp_type (CType ptr) { return CppType(const_cast<CTypeNonConst>(ptr), true); }
00092 static void release_c_type (CType ptr) { gda_config_free_data_source_info(const_cast<CTypeNonConst>(ptr)); }
00093 };
00094
00095
00096 typedef Glib::ListHandle<DataSourceInfo, DataSourceInfoTraits> ListHandle_DataSourceInfo;
00097 ListHandle_DataSourceInfo get_data_sources();
00098
00099 DataSourceInfo find_data_source(const Glib::ustring& name);
00100
00101 Glib::RefPtr<DataModel> get_data_source_model();
00102 void save_data_source(const Glib::ustring& name, const Glib::ustring& provider,
00103 const Glib::ustring& cnc_string, const Glib::ustring& description,
00104 const Glib::ustring& username, const Glib::ustring& password);
00105 void save_data_source(const DataSourceInfo& dsn_info);
00106 void remove_data_source(const Glib::ustring& name);
00107
00108
00109 }
00110
00111 }
00112 }
00113
00114
00115 #endif
00116