glom r2001 - in branches/glom-1-10: . glom/libglom/connectionpool_backends
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: glom r2001 - in branches/glom-1-10: . glom/libglom/connectionpool_backends
- Date: Tue, 17 Mar 2009 21:16:07 +0000 (UTC)
Author: murrayc
Date: Tue Mar 17 21:16:07 2009
New Revision: 2001
URL: http://svn.gnome.org/viewvc/glom?rev=2001&view=rev
Log:
2009-03-17 Murray Cumming <murrayc murrayc com>
* glom/libglom/connectionpool_backends/postgres.cc:
check_postgres_gda_client_is_available_with_warning(): Actually check.
This was commented out because the libgda-4.0 API for it is unpleasant.
Modified:
branches/glom-1-10/ChangeLog
branches/glom-1-10/glom/libglom/connectionpool_backends/postgres.cc
Modified: branches/glom-1-10/glom/libglom/connectionpool_backends/postgres.cc
==============================================================================
--- branches/glom-1-10/glom/libglom/connectionpool_backends/postgres.cc (original)
+++ branches/glom-1-10/glom/libglom/connectionpool_backends/postgres.cc Tue Mar 17 21:16:07 2009
@@ -21,6 +21,7 @@
#include <libglom/libglom_config.h>
#include <libglom/connectionpool_backends/postgres.h>
+#include <libglom/utils.h>
#include <glibmm/i18n.h>
#include <bakery/bakery.h>
@@ -428,23 +429,26 @@
bool Postgres::check_postgres_gda_client_is_available_with_warning()
{
- // TODO_gda:
-#if 0
- Glib::RefPtr<Gnome::Gda::Client> gda_client = Gnome::Gda::Client::create();
- if(gda_client)
- {
- //Get the list of providers:
- typedef std::list<Gnome::Gda::ProviderInfo> type_list_of_provider_info;
- type_list_of_provider_info providers = Gnome::Gda::Config::get_providers();
-
- //Examine the information about each Provider:
- for(type_list_of_provider_info::const_iterator iter = providers.begin(); iter != providers.end(); ++iter)
- {
- const Gnome::Gda::ProviderInfo& info = *iter;
- if(info.get_id() == "PostgreSQL")
- return true;
- }
+ //This API is horrible.
+ //See libgda bug http://bugzilla.gnome.org/show_bug.cgi?id=575754
+ Glib::RefPtr<Gnome::Gda::DataModel> model = Gnome::Gda::Config::list_providers();
+ if(!model)
+ return false;
+
+ Glib::RefPtr<Gnome::Gda::DataModelIter> iter = model->create_iter();
+
+ do
+ {
+ //See http://library.gnome.org/devel/libgda/unstable/libgda-40-Configuration.html#gda-config-list-providers
+ //about the columns of this DataModel:
+ const Gnome::Gda::Value name = iter->get_value_at(0);
+ const Glib::ustring name_as_string = name.get_string();
+ //std::cout << "DEBUG: Provider name:" << name_as_string << std::endl;
+ if(name_as_string == "PostgreSQL")
+ return true;
}
+ while(iter->move_next());
+
const Glib::ustring message = _("Your installation of Glom is not complete, because the PostgreSQL libgda provider is not available on your system. This provider is needed to access Postgres database servers.\n\nPlease report this bug to your vendor, or your system administrator so it can be corrected.");
#ifndef GLOM_ENABLE_MAEMO
@@ -456,8 +460,8 @@
Hildon::Note note(Hildon::NOTE_TYPE_INFORMATION, message);
note.run();
#endif
-#endif
- return true;
+
+ return false;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]