[gnome-db] Patch for #130730 & #131365



Hi,

Here is a patch to fix #130730 and #131365.

Cheers!

--
Laurent
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libgnomedb/ChangeLog,v
retrieving revision 1.292
diff -u -r1.292 ChangeLog
--- ChangeLog	9 Feb 2004 00:17:51 -0000	1.292
+++ ChangeLog	15 Feb 2004 23:20:54 -0000
@@ -1,3 +1,15 @@
+2004-02-15  Laurent Sansonetti <lrz gnome org>
+
+	Fixes #130730
+
+	* libgnome/gnome-db-config.c: Added missing implementation for 
+	gnome_db_config_get_component_data_model ().
+
+	Fixes #131365
+
+	* libgnomedb/gnome-db-data-source-selector.c (show_data_sources):
+	Calls gnome_db_option_menu_set_selection () with a valid parameter.
+
 2004-02-09  Yomasz Kłoczko <kloczek pld org pl>
 
 	* configure.in: Trivial cleanup: remove AC_SUBST(CFLAGS),
Index: libgnomedb/gnome-db-config.c
===================================================================
RCS file: /cvs/gnome/libgnomedb/libgnomedb/gnome-db-config.c,v
retrieving revision 1.8
diff -u -r1.8 gnome-db-config.c
--- libgnomedb/gnome-db-config.c	12 Jun 2003 23:36:58 -0000	1.8
+++ libgnomedb/gnome-db-config.c	15 Feb 2004 23:20:56 -0000
@@ -26,6 +26,7 @@
 #include <bonobo/bonobo-exception.h>
 #include "gnome-db-i18n.h"
 #include <gconf/gconf.h>
+#include <libgda/gda-data-model-array.h>
 #include <libgda/gda-log.h>
 #include <libgnomedb/gnome-db-config.h>
 
@@ -187,6 +188,60 @@
 }
 
 /**
+ * gnome_db_config_get_component_data_model
+ * @query: condition for components to be retrieved.
+ *
+ * Return a list of all components currently installed in
+ * the system that match the given query (see
+ * BonoboActivation documentation).
+ *
+ * Returns: a #GdaDataModel object, or %NULL on failure.
+ */
+GdaDataModel *
+gnome_db_config_get_component_data_model (const gchar *query)
+{
+	GdaDataModel *model;
+	GList *list, *i;
+	
+	list = gnome_db_config_get_component_list (query);
+	g_return_val_if_fail (list != NULL, NULL);
+
+	model = gda_data_model_array_new (6);
+	gda_data_model_set_column_title (model, 0, _("ID"));
+	gda_data_model_set_column_title (model, 1, _("Location"));
+	gda_data_model_set_column_title (model, 2, _("Description"));
+	gda_data_model_set_column_title (model, 3, _("Username"));
+	gda_data_model_set_column_title (model, 4, _("Hostname"));
+	gda_data_model_set_column_title (model, 5, _("Domain"));
+	
+	for (i = list; i != NULL; i = i->next) {
+		GnomeDbComponentInfo *info;
+		GList *row = NULL;
+		
+		info = (GnomeDbComponentInfo *) i->data;
+		row = g_list_append (row,
+				     gda_value_new_string (info->id));
+		row = g_list_append (row,
+				     gda_value_new_string (info->location));
+		row = g_list_append (row,
+				     gda_value_new_string (info->description));
+		row = g_list_append (row,
+				     gda_value_new_string (info->username));
+		row = g_list_append (row,
+				     gda_value_new_string (info->hostname));
+		row = g_list_append (row,
+				     gda_value_new_string (info->domain));
+
+		gda_data_model_append_row (GDA_DATA_MODEL (model), row);
+	}
+	
+	/* free memory */
+	gnome_db_config_free_component_list (list);
+
+	return model;
+}
+
+/**
  * gnome_db_config_free_component_list
  */
 void
Index: libgnomedb/gnome-db-data-source-selector.c
===================================================================
RCS file: /cvs/gnome/libgnomedb/libgnomedb/gnome-db-data-source-selector.c,v
retrieving revision 1.9
diff -u -r1.9 gnome-db-data-source-selector.c
--- libgnomedb/gnome-db-data-source-selector.c	4 Jul 2003 14:52:28 -0000	1.9
+++ libgnomedb/gnome-db-data-source-selector.c	15 Feb 2004 23:20:57 -0000
@@ -45,32 +45,22 @@
 static void
 show_data_sources (GnomeDbDataSourceSelector *selector, const gchar *name)
 {
-	GList *dsn_list;
-	GList *l;
+	GdaDataSourceInfo *dsn_info = NULL;
 
 	g_return_if_fail (GNOME_DB_IS_DATA_SOURCE_SELECTOR (selector));
 
 	gtk_option_menu_remove_menu (GTK_OPTION_MENU (selector));
 
-	/* load data sources */
-	dsn_list = gnome_db_config_get_data_source_list ();
-	for (l = dsn_list; l != NULL; l = l->next) {
-		GdaDataSourceInfo *dsn_info = (GdaDataSourceInfo *) l->data;
-
-		if (!dsn_info)
-			continue;
-
-		if (name != NULL && strcmp (name, dsn_info->name) != 0)
-			continue;
-
-		/* add the data source to the option menu */
-		gnome_db_option_menu_add_item (GTK_OPTION_MENU (selector), dsn_info->name);
-	}
-
-	gnome_db_config_free_data_source_list (dsn_list);
-
 	if (name != NULL)
-		gnome_db_option_menu_set_selection (GTK_OPTION_MENU (selector), name);
+		dsn_info = gnome_db_config_find_data_source (name);
+	
+	if (dsn_info != NULL) {
+		gnome_db_option_menu_add_item (GTK_OPTION_MENU (selector),
+					       dsn_info->name);
+		gnome_db_option_menu_set_selection (GTK_OPTION_MENU (selector),
+						    dsn_info->name);
+		gnome_db_config_free_data_source_info (dsn_info);
+	}
 	else
 		gtk_option_menu_set_history (GTK_OPTION_MENU (selector), 0);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]