[libgda/gtk3] GTK3 adaptations



commit 2751cf3738e4e539a8cce0debb2e2dd707740ffa
Author: Vivien Malerba <malerba gnome-db org>
Date:   Sat Feb 19 18:26:55 2011 +0100

    GTK3 adaptations

 libgda-ui/data-entries/gdaui-entry-common-time.c  |    8 +++++-
 libgda-ui/data-entries/gdaui-entry-number.c       |   20 +++++++++++-------
 libgda-ui/data-entries/gdaui-entry-string.c       |    8 +++++-
 libgda-ui/data-entries/plugins/common-pict.c      |   23 +++-----------------
 libgda-ui/data-entries/plugins/gdaui-entry-pict.c |   10 ++------
 libgda/gda-data-model-dir.c                       |    6 +----
 providers/mysql/gda-mysql-provider.c              |    6 +----
 tests/data-models/Makefile.am                     |    2 +-
 tools/browser/common/fk-declare.c                 |    3 +-
 tools/browser/query-exec/query-editor.c           |   14 +++---------
 tools/config-info.c                               |    2 -
 tools/web-server.c                                |    6 +----
 12 files changed, 40 insertions(+), 68 deletions(-)
---
diff --git a/libgda-ui/data-entries/gdaui-entry-common-time.c b/libgda-ui/data-entries/gdaui-entry-common-time.c
index 8592b21..579b7d6 100644
--- a/libgda-ui/data-entries/gdaui-entry-common-time.c
+++ b/libgda-ui/data-entries/gdaui-entry-common-time.c
@@ -1,6 +1,6 @@
 /* gdaui-entry-common-time.c
  *
- * Copyright (C) 2003 - 2010 Vivien Malerba
+ * Copyright (C) 2003 - 2011 Vivien Malerba
  *
  * This Library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public License as
@@ -147,7 +147,8 @@ gdaui_entry_common_time_class_init (GdauiEntryCommonTimeClass * class)
 	object_class->get_property = gdaui_entry_common_time_get_property;
 
 	g_object_class_install_property (object_class, PROP_EDITING_CANCELED,
-					 g_param_spec_boolean ("editing-canceled", NULL, NULL, FALSE, G_PARAM_READABLE));
+					 g_param_spec_boolean ("editing-canceled", NULL, NULL, FALSE,
+							       G_PARAM_READABLE | G_PARAM_WRITABLE));
 	g_object_class_install_property (object_class, PROP_TYPE,
 					 g_param_spec_uint ("type", NULL, NULL, 0, G_MAXUINT, GDA_TYPE_TIME, 
 							    G_PARAM_WRITABLE | G_PARAM_READABLE));
@@ -259,6 +260,9 @@ gdaui_entry_common_time_set_property (GObject *object,
 		case PROP_TYPE:
 			gdaui_data_entry_set_value_type (GDAUI_DATA_ENTRY (object), g_value_get_uint (value));
 			break;
+		case PROP_EDITING_CANCELED:
+			TO_IMPLEMENT;
+			break;
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
 			break;
diff --git a/libgda-ui/data-entries/gdaui-entry-number.c b/libgda-ui/data-entries/gdaui-entry-number.c
index 6dcab0b..6bfa916 100644
--- a/libgda-ui/data-entries/gdaui-entry-number.c
+++ b/libgda-ui/data-entries/gdaui-entry-number.c
@@ -1,6 +1,6 @@
 /* gdaui-entry-number.c
  *
- * Copyright (C) 2009 - 2010 Vivien Malerba
+ * Copyright (C) 2009 - 2011 Vivien Malerba
  *
  * This Library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public License as
@@ -142,7 +142,8 @@ gdaui_entry_number_class_init (GdauiEntryNumberClass * klass)
 	object_class->get_property = gdaui_entry_number_get_property;
 
 	g_object_class_install_property (object_class, PROP_EDITING_CANCELED,
-					 g_param_spec_boolean ("editing-canceled", NULL, NULL, FALSE, G_PARAM_READABLE));
+					 g_param_spec_boolean ("editing-canceled", NULL, NULL, FALSE,
+							       G_PARAM_READABLE | G_PARAM_WRITABLE));
 	g_object_class_install_property (object_class, PROP_OPTIONS,
 					 g_param_spec_string ("options", NULL, NULL, NULL, G_PARAM_WRITABLE));
 }
@@ -255,9 +256,9 @@ gdaui_entry_number_finalize (GObject   * object)
 
 static void
 gdaui_entry_number_set_property (GObject *object,
-				    guint param_id,
-				    const GValue *value,
-				    GParamSpec *pspec)
+				 guint param_id,
+				 const GValue *value,
+				 GParamSpec *pspec)
 {
 	GdauiEntryNumber *mgstr;
 
@@ -267,6 +268,9 @@ gdaui_entry_number_set_property (GObject *object,
 		case PROP_OPTIONS:
 			set_entry_options (mgstr, g_value_get_string (value));
 			break;
+		case PROP_EDITING_CANCELED:
+			TO_IMPLEMENT;
+			break;
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
 			break;
@@ -276,9 +280,9 @@ gdaui_entry_number_set_property (GObject *object,
 
 static void
 gdaui_entry_number_get_property (GObject *object,
-			     guint param_id,
-			     GValue *value,
-			     GParamSpec *pspec)
+				 guint param_id,
+				 GValue *value,
+				 GParamSpec *pspec)
 {
 	GdauiEntryNumber *mgstr;
 
diff --git a/libgda-ui/data-entries/gdaui-entry-string.c b/libgda-ui/data-entries/gdaui-entry-string.c
index 5a91662..4ce2d68 100644
--- a/libgda-ui/data-entries/gdaui-entry-string.c
+++ b/libgda-ui/data-entries/gdaui-entry-string.c
@@ -1,6 +1,6 @@
 /* gdaui-entry-string.c
  *
- * Copyright (C) 2003 - 2010 Vivien Malerba
+ * Copyright (C) 2003 - 2011 Vivien Malerba
  *
  * This Library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public License as
@@ -153,7 +153,8 @@ gdaui_entry_string_class_init (GdauiEntryStringClass * klass)
 					 g_param_spec_boolean ("multiline", NULL, NULL, FALSE, 
 							       G_PARAM_READABLE | G_PARAM_WRITABLE));
 	g_object_class_install_property (object_class, PROP_EDITING_CANCELED,
-					 g_param_spec_boolean ("editing-canceled", NULL, NULL, FALSE, G_PARAM_READABLE));
+					 g_param_spec_boolean ("editing-canceled", NULL, NULL, FALSE,
+							       G_PARAM_READABLE | G_PARAM_WRITABLE));
 	g_object_class_install_property (object_class, PROP_OPTIONS,
 					 g_param_spec_string ("options", NULL, NULL, NULL, G_PARAM_WRITABLE));
 }
@@ -290,6 +291,9 @@ gdaui_entry_string_set_property (GObject *object,
 		case PROP_OPTIONS:
 			set_entry_options (mgstr, g_value_get_string (value));
 			break;
+		case PROP_EDITING_CANCELED:
+			TO_IMPLEMENT;
+			break;
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
 			break;
diff --git a/libgda-ui/data-entries/plugins/common-pict.c b/libgda-ui/data-entries/plugins/common-pict.c
index 178a4ad..2aeb1a2 100644
--- a/libgda-ui/data-entries/plugins/common-pict.c
+++ b/libgda-ui/data-entries/plugins/common-pict.c
@@ -1,5 +1,5 @@
 /* common-pict.c
- * Copyright (C) 2006 - 2007 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2006 - 2011 Vivien Malerba <malerba gnome-db org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -83,7 +83,6 @@ common_pict_load_data (PictOptions *options, const GValue *value, PictBinData *b
 						bindata->data_length = strlen ((gchar *) bindata->data);
 						break;
 					case ENCODING_BASE64: {
-#if (GLIB_MINOR_VERSION >= 12)
 						gsize out_len;
 						bindata->data = g_base64_decode (str, &out_len);
 						if (out_len > 0)
@@ -93,12 +92,6 @@ common_pict_load_data (PictOptions *options, const GValue *value, PictBinData *b
 							bindata->data = NULL;
 							bindata->data_length = 0;
 						}
-#else
-						g_warning ("Base64 enoding/decoding is not supported in the "
-							   "GLib version %d.%d.%d",
-							   glib_major_version, glib_minor_version, glib_micro_version);
-#endif
-
 						break;
 					}
 					}
@@ -263,13 +256,10 @@ common_pict_make_pixbuf (PictOptions *options, PictBinData *bindata, PictAllocat
 				gchar *notice_msg;
 				notice_msg = g_strdup_printf (_("Error while interpreting data as an image:\n%s"),
 							      loc_error && loc_error->message ? loc_error->message : _("No detail"));
-				g_error_free (loc_error);
 				*stock = GTK_STOCK_DIALOG_WARNING;
-#if GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 18
-				g_set_error (error, 0, 0, "%s", notice_msg);
-#else
-				g_set_error_literal (error, 0, 0, notice_msg);
-#endif
+				g_set_error_literal (error, loc_error ? loc_error->domain : 0,
+						     loc_error ? loc_error->code : 0, notice_msg);
+				g_error_free (loc_error);
 				g_free (notice_msg);
 			}
 			
@@ -693,12 +683,7 @@ common_pict_get_value (PictBinData *bindata, PictOptions *options, GType gtype)
 						 bindata->data_length);
 				break;
 			case ENCODING_BASE64: 
-#if (GLIB_MINOR_VERSION >= 12)
 				str = g_base64_encode (bindata->data, bindata->data_length);
-#else
-				g_warning ("Base64 enoding/decoding is not supported in the GLib version %d.%d.%d",
-					   glib_major_version, glib_minor_version, glib_micro_version);
-#endif
 				break;
 			}
 			
diff --git a/libgda-ui/data-entries/plugins/gdaui-entry-pict.c b/libgda-ui/data-entries/plugins/gdaui-entry-pict.c
index f01d833..0fa2d09 100644
--- a/libgda-ui/data-entries/plugins/gdaui-entry-pict.c
+++ b/libgda-ui/data-entries/plugins/gdaui-entry-pict.c
@@ -1,6 +1,6 @@
 /* gdaui-entry-pict.c
  *
- * Copyright (C) 2006 - 2010 Vivien Malerba
+ * Copyright (C) 2006 - 2011 Vivien Malerba
  *
  * This Library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public License as
@@ -509,12 +509,8 @@ value_is_equal_to (GdauiEntryWrapper *mgwrap, const GValue *value)
 						    mgpict->priv->bindata.data_length);
 				break;
 			case ENCODING_BASE64: 
-#if (GLIB_MINOR_VERSION >= 12)
-				curstr = g_base64_encode (mgpict->priv->bindata.data, mgpict->priv->bindata.data_length);
-#else
-				g_warning ("Base64 enoding/decoding is not supported in the GLib version %d.%d.%d",
-					   glib_major_version, glib_minor_version, glib_micro_version);
-#endif
+				curstr = g_base64_encode (mgpict->priv->bindata.data,
+							  mgpict->priv->bindata.data_length);
 				break;
 			default:
 				g_assert_not_reached ();
diff --git a/libgda/gda-data-model-dir.c b/libgda/gda-data-model-dir.c
index 6dd9f4b..36f094c 100644
--- a/libgda/gda-data-model-dir.c
+++ b/libgda/gda-data-model-dir.c
@@ -1,5 +1,5 @@
 /* GDA common library
- * Copyright (C) 2007 - 2010 The GNOME Foundation
+ * Copyright (C) 2007 - 2011 The GNOME Foundation
  *
  * AUTHORS:
  *      Vivien Malerba <malerba gnome-db org>
@@ -1043,11 +1043,7 @@ gda_data_model_dir_set_values (GdaDataModel *model, gint row, GList *values, GEr
 											   new_filename);
 						}
 					}
-#if GLIB_CHECK_VERSION(2,22,0)
 					g_mapped_file_unref (old_file);
-#else
-					g_mapped_file_free (old_file);
-#endif
 				}
 				if (!allok) {
 					gchar *str;
diff --git a/providers/mysql/gda-mysql-provider.c b/providers/mysql/gda-mysql-provider.c
index 0722d1a..77fdd1e 100644
--- a/providers/mysql/gda-mysql-provider.c
+++ b/providers/mysql/gda-mysql-provider.c
@@ -1,5 +1,5 @@
 /* GDA Mysql provider
- * Copyright (C) 2008 - 2010 The GNOME Foundation.
+ * Copyright (C) 2008 - 2011 The GNOME Foundation.
  *
  * AUTHORS:
  *      Carlos Savoretti <csavoretti gmail com>
@@ -506,11 +506,7 @@ real_open_connection (const gchar  *host,
 						  (port > 0) ? port : 0,
 						  socket, flags);
 	if (!return_mysql || mysql != return_mysql) {
-#if GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 18
-		g_set_error (error, 0, 0, "%s", mysql_error (mysql));
-#else
 		g_set_error_literal (error, GDA_SERVER_PROVIDER_ERROR, 0, mysql_error (mysql));
-#endif
 		g_free (mysql);
 		mysql = NULL;
 	}
diff --git a/tests/data-models/Makefile.am b/tests/data-models/Makefile.am
index 37a782d..a22993b 100644
--- a/tests/data-models/Makefile.am
+++ b/tests/data-models/Makefile.am
@@ -62,7 +62,7 @@ check_vcnc_CFLAGS = \
 	-I$(top_srcdir)/libgda/sqlite \
 	-I$(top_srcdir)/libgda/sqlite/vcnc
 check_vcnc_LDADD = \
-	$(top_builddir)/libgda/libgda-4.0.la \
+	$(top_builddir)/libgda/libgda-5.0.la \
 	$(LIBGDA_LIBS)
 
 
diff --git a/tools/browser/common/fk-declare.c b/tools/browser/common/fk-declare.c
index c6c5ab8..a2961c3 100644
--- a/tools/browser/common/fk-declare.c
+++ b/tools/browser/common/fk-declare.c
@@ -400,8 +400,7 @@ fk_declare_new (GtkWindow *parent, GdaMetaStruct *mstruct, GdaMetaTable *table)
 			       GDA_META_DB_OBJECT (table)->obj_short_name);
 	wid = (GtkWidget*) g_object_new (FK_DECLARE_TYPE, "title", str,
 					 "transient-for", parent,
-					 "border-width", 10, 
-					 "has-separator", FALSE, NULL);
+					 "border-width", 10, NULL);
 	g_free (str);
 
 	decl = FK_DECLARE (wid);
diff --git a/tools/browser/query-exec/query-editor.c b/tools/browser/query-exec/query-editor.c
index 054533b..4b67819 100644
--- a/tools/browser/query-exec/query-editor.c
+++ b/tools/browser/query-exec/query-editor.c
@@ -592,13 +592,8 @@ event (GtkWidget *text_view, GdkEvent *ev, QueryEditor *editor)
 }
 
 static gboolean
-text_view_expose_event (GtkTextView *tv, GdkEventExpose *event, QueryEditor *editor)
+text_view_draw (GtkTextView *tv, cairo_t *cr, QueryEditor *editor)
 {
-	GdkWindow *win;
-
-	win = gtk_text_view_get_window (tv, GTK_TEXT_WINDOW_TEXT);
-	if (event->window != win)
-		return FALSE;
 	if (!editor->priv->hist_focus)
 		return FALSE;
 	
@@ -648,16 +643,15 @@ text_view_expose_event (GtkTextView *tv, GdkEventExpose *event, QueryEditor *edi
 	redraw_rect.width = visible_rect.width;
 	redraw_rect.height = visible_rect.height;
 	
-	cairo_t *cr = gdk_cairo_create (win);
 	GdkRectangle rect;
 	margin = gtk_text_view_get_left_margin (tv);
 	rect.x = redraw_rect.x + MAX (0, margin - 1);
 	rect.y = win_y;
 	rect.width = redraw_rect.width;
 	rect.height = height;
+	cairo_set_source_rgba (cr, .5, .5, .5, .3);
 	gdk_cairo_rectangle (cr, &rect);
 	cairo_fill (cr);
-	cairo_destroy (cr);
 
 	return FALSE;
 }
@@ -708,8 +702,8 @@ query_editor_init (QueryEditor *editor, G_GNUC_UNUSED QueryEditorClass *klass)
 			  G_CALLBACK (event), editor);
 	g_signal_connect (gtk_text_view_get_buffer (GTK_TEXT_VIEW (editor->priv->text)), "changed", 
 			  G_CALLBACK (text_buffer_changed_cb), editor);
-	g_signal_connect (editor->priv->text, "expose-event",
-			  G_CALLBACK (text_view_expose_event), editor);
+	g_signal_connect (editor->priv->text, "draw",
+			  G_CALLBACK (text_view_draw), editor);
 
 	/* create some tags */
 	GtkTextBuffer *buffer;
diff --git a/tools/config-info.c b/tools/config-info.c
index 0606870..156afc5 100644
--- a/tools/config-info.c
+++ b/tools/config-info.c
@@ -506,7 +506,6 @@ config_info_compute_dict_file_name (GdaDsnInfo *info, const gchar *cnc_string)
 					    info->name);
 	}
 	else {
-#if GLIB_CHECK_VERSION(2,16,0)
 		GdaQuarkList *ql;
 		GSList *list, *sorted_list = NULL;
 		GString *string = NULL;
@@ -538,7 +537,6 @@ config_info_compute_dict_file_name (GdaDsnInfo *info, const gchar *cnc_string)
 					    chname);
 			g_free (chname);
 		}
-#endif
 	}
 
 	g_free (confdir);
diff --git a/tools/web-server.c b/tools/web-server.c
index eb554bd..04be6d0 100644
--- a/tools/web-server.c
+++ b/tools/web-server.c
@@ -1,6 +1,6 @@
 /* web-server.c
  *
- * Copyright (C) 2008 - 2009 Vivien Malerba
+ * Copyright (C) 2008 - 2011 Vivien Malerba
  *
  * This Library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public License as
@@ -472,11 +472,7 @@ get_file (G_GNUC_UNUSED WebServer *server, SoupMessage *msg, const char *path, G
 	SoupBuffer *buffer;
 	buffer = soup_buffer_new_with_owner (g_mapped_file_get_contents (mfile),
 					     g_mapped_file_get_length (mfile),
-#if GLIB_CHECK_VERSION(2,22,0)
 					     mfile, (GDestroyNotify) g_mapped_file_unref);
-#else
-					     mfile, (GDestroyNotify) g_mapped_file_free);
-#endif
 	soup_message_body_append_buffer (msg->response_body, buffer);
 	soup_buffer_free (buffer);
 	soup_message_set_status (msg, SOUP_STATUS_OK);



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