ajacoutot e20fe79990 - fix WANTLIB after libgnomedb+libgda changes
- add a workaround to prevent a SIGSEGV when no datasources are configured.

"go for it!" jasper@
2009-02-11 15:23:35 +00:00

39 lines
1.2 KiB
Plaintext

$OpenBSD: patch-src_main_c,v 1.1 2009/02/11 15:23:35 ajacoutot Exp $
XXX Workaround a SIGSEGV when no datasources are configured. This should
eventually be fixed at the source (libgnomedb?). Next major libgnomedb
release will use a new API (V4) anyway so this workaround may not even
be needed at that point.
--- src/main.c.orig Wed Feb 11 15:28:38 2009
+++ src/main.c Wed Feb 11 15:28:41 2009
@@ -120,7 +120,27 @@ main (int argc, char *argv[])
else {
if (user || pass)
g_warning ("No data source specified, ignoring user and password specifications");
- gnome_db_main_run ((GdaInitFunc) create_new_workspace_window, NULL);
+
+ GList *dsn_list;
+ dsn_list = gda_config_get_data_source_list ();
+
+ if (dsn_list) {
+ gnome_db_main_run ((GdaInitFunc) create_new_workspace_window, NULL);
+ } else {
+ GtkWidget* dialog;
+
+ dialog = gtk_message_dialog_new (NULL,
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "No data source configured!");
+
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG(dialog), "Use the gnome-database-properties-3.0 program to add or remove data sources.");
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+
}
return 0;