[libgda] Fix some deprecated functions and miscellaneous warnings



commit eb976cf72160938cf3af66af7cbf70ce06841024
Author: David King <davidk openismus com>
Date:   Fri Oct 1 17:14:25 2010 +0200

    Fix some deprecated functions and miscellaneous warnings
    
    Use non-deprecated functions where possible. Use const variables instead
    of defines where possible. Fix use of various functions.

 control-center/main.c                      |    2 +-
 libgda-ui/data-entries/common-bin.c        |    2 +-
 libgda-ui/demos/ddl_queries.c              |    2 +-
 libgda-ui/demos/main.c                     |   12 +++++++-----
 libgda-xslt/sql_backend.c                  |    8 +-------
 libgda/gda-data-model-array.c              |    2 +-
 testing/gdaui-test-data-entries.c          |    8 +-------
 tools/browser/canvas/browser-canvas-text.c |    2 +-
 8 files changed, 14 insertions(+), 24 deletions(-)
---
diff --git a/control-center/main.c b/control-center/main.c
index bdf3815..372dcd0 100644
--- a/control-center/main.c
+++ b/control-center/main.c
@@ -178,7 +178,7 @@ about_cb (G_GNUC_UNUSED GtkAction *action, G_GNUC_UNUSED gpointer user_data)
 	g_free (path);
 
 	dialog = gtk_about_dialog_new ();
-	gtk_about_dialog_set_name (GTK_ABOUT_DIALOG (dialog), _("Database access control center"));
+	gtk_about_dialog_set_program_name (GTK_ABOUT_DIALOG (dialog), _("Database access control center"));
 	gtk_about_dialog_set_version (GTK_ABOUT_DIALOG (dialog), PACKAGE_VERSION);
 	gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG (dialog), "(C) 1998-2009 GNOME Foundation");
 	gtk_about_dialog_set_comments (GTK_ABOUT_DIALOG (dialog), _("Database access services for the GNOME Desktop"));
diff --git a/libgda-ui/data-entries/common-bin.c b/libgda-ui/data-entries/common-bin.c
index af3c0e6..4a9cb83 100644
--- a/libgda-ui/data-entries/common-bin.c
+++ b/libgda-ui/data-entries/common-bin.c
@@ -320,7 +320,7 @@ common_bin_adjust_menu (BinMenu *binmenu, gboolean editable, const GValue *value
 		GList *list;
 		gchar *descr, *tmp;
 		descr = g_content_type_get_description (ctype);
-		tmp = g_markup_printf_escaped (descr);
+		tmp = g_markup_escape_text (descr, -1);
 		g_free (descr);
 		g_string_append_printf (string, "\n%s: %s", _("Data type"), tmp);
 		g_free (tmp);
diff --git a/libgda-ui/demos/ddl_queries.c b/libgda-ui/demos/ddl_queries.c
index c47a59f..5834aaf 100644
--- a/libgda-ui/demos/ddl_queries.c
+++ b/libgda-ui/demos/ddl_queries.c
@@ -489,7 +489,7 @@ show_sql (G_GNUC_UNUSED GtkButton *button, DemoData *data)
 
 		dlg = gtk_message_dialog_new_with_markup (GTK_WINDOW (data->top_window),
 							  GTK_DIALOG_MODAL,
-							  msg_type, GTK_BUTTONS_CLOSE, msg);
+							  msg_type, GTK_BUTTONS_CLOSE, "%s", msg);
 		g_free (sql);
 		g_free (msg);
 
diff --git a/libgda-ui/demos/main.c b/libgda-ui/demos/main.c
index 0e67927..459930a 100644
--- a/libgda-ui/demos/main.c
+++ b/libgda-ui/demos/main.c
@@ -573,17 +573,19 @@ selection_cb (GtkTreeSelection *selection,
 	      GtkTreeModel     *model)
 {
 	GtkTreeIter iter;
-	GValue value = {0, };
+	GValue *value;
 
 	if (! gtk_tree_selection_get_selected (selection, NULL, &iter))
 		return;
 
+	value = g_slice_new0(GValue);
 	gtk_tree_model_get_value (model, &iter,
 				  FILENAME_COLUMN,
-				  &value);
-	if (g_value_get_string (&value))
-		load_file (g_value_get_string (&value));
-	g_value_unset (&value);
+				  value);
+	if (g_value_get_string (value))
+		load_file (g_value_get_string (value));
+	g_value_unset (value);
+	g_slice_free(GValue, value);
 }
 
 static GtkWidget *
diff --git a/libgda-xslt/sql_backend.c b/libgda-xslt/sql_backend.c
index a77a485..6053eb9 100644
--- a/libgda-xslt/sql_backend.c
+++ b/libgda-xslt/sql_backend.c
@@ -587,12 +587,6 @@ gtype_equal (gconstpointer a, gconstpointer b)
 	return (GType) a == (GType) b ? TRUE : FALSE;
 }
 
-static guint
-gtype_hash (gconstpointer key)
-{
-	return (guint) key;
-}
-
 static xmlChar *
 value_to_xmlchar (const GValue * value)
 {
@@ -609,7 +603,7 @@ value_to_xmlchar (const GValue * value)
 	if (!data_handlers) {
 		/* initialize the internal data handlers */
 		data_handlers =
-			g_hash_table_new_full (gtype_hash, gtype_equal,
+			g_hash_table_new_full (g_direct_hash, gtype_equal,
 					       NULL, (GDestroyNotify)
 					       g_object_unref);
 
diff --git a/libgda/gda-data-model-array.c b/libgda/gda-data-model-array.c
index f505396..d659e7b 100644
--- a/libgda/gda-data-model-array.c
+++ b/libgda/gda-data-model-array.c
@@ -484,7 +484,7 @@ column_g_type_changed_cb (GdaColumn *column, G_GNUC_UNUSED GType old, GType new,
         const GValue *value;
         gchar *str;
         gint nb_warnings = 0;
-#define max_warnings 5
+	const gint max_warnings = 5;
 
         if ((new == G_TYPE_INVALID) ||
             (new == GDA_TYPE_NULL))
diff --git a/testing/gdaui-test-data-entries.c b/testing/gdaui-test-data-entries.c
index 5ca9fa1..6d05b4f 100644
--- a/testing/gdaui-test-data-entries.c
+++ b/testing/gdaui-test-data-entries.c
@@ -50,12 +50,6 @@ static void       fill_tested_models (void);
 static GtkWidget *build_test_for_plugin_struct (GdauiPlugin *plugin);
 static void       build_test_widget (TestWidgetData *tdata);
 
-static guint
-gtype_hash (gconstpointer key)
-{
-	return (guint) key;
-}
-
 static gboolean 
 gtype_equal (gconstpointer a, gconstpointer b)
 {
@@ -67,7 +61,7 @@ get_handler (GType for_type)
 {
 	static GHashTable *hash = NULL;
 	if (!hash) {
-		hash = g_hash_table_new_full (gtype_hash, gtype_equal, 
+		hash = g_hash_table_new_full (g_direct_hash, gtype_equal, 
 					      NULL, (GDestroyNotify) g_object_unref);
 
 		g_hash_table_insert (hash, (gpointer) G_TYPE_UINT64, gda_handler_numerical_new ());
diff --git a/tools/browser/canvas/browser-canvas-text.c b/tools/browser/canvas/browser-canvas-text.c
index 5110c8d..f447548 100644
--- a/tools/browser/canvas/browser-canvas-text.c
+++ b/tools/browser/canvas/browser-canvas-text.c
@@ -389,7 +389,7 @@ leave_notify_cb (G_GNUC_UNUSED GooCanvasItem *item, G_GNUC_UNUSED GooCanvasItem
 static guint
 compute_step_value (guint current, guint end)
 {
-#define STEP 15
+	const guint STEP = 15;
 	if (current < end)
 		return current + MIN (STEP, (end - current));
 	else if (current > end)



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