[libgda/LIBGDA_4.2] Honor the minimum GTK+ version 2.12



commit 44a9b29c84c9f283af286f110283bb2dea39f062
Author: Vivien Malerba <malerba gnome-db org>
Date:   Fri Jul 15 15:46:47 2011 +0200

    Honor the minimum GTK+ version 2.12

 libgda-report/engine/rt-parser.c                   |    5 +++++
 libgda-ui/gdaui-rt-editor.c                        |    7 +++++++
 tools/browser/ldap-browser/class-properties.c      |   19 ++++++++++++++++---
 tools/browser/ldap-browser/classes-view.c          |    6 ++++++
 tools/browser/ldap-browser/entry-properties.c      |   19 ++++++++++++++++---
 tools/browser/ldap-browser/hierarchy-view.c        |    6 ++++++
 tools/browser/ldap-browser/ldap-classes-page.c     |    6 ++++++
 tools/browser/ldap-browser/ldap-entries-page.c     |    6 ++++++
 .../browser/ldap-browser/ldap-favorite-selector.c  |   17 ++++++++++++++++-
 tools/browser/ldap-browser/vtable-dialog.c         |    5 +++++
 10 files changed, 89 insertions(+), 7 deletions(-)
---
diff --git a/libgda-report/engine/rt-parser.c b/libgda-report/engine/rt-parser.c
index 106cb50..1486ee3 100644
--- a/libgda-report/engine/rt-parser.c
+++ b/libgda-report/engine/rt-parser.c
@@ -912,7 +912,12 @@ rt_parse_text (const gchar *text)
 			else {
 				gchar *tmp;
 				tmp = remove_newlines_from_base64 (part);
+#if GLIB_CHECK_VERSION(2,20,0)
 				node->binary.data = g_base64_decode_inplace (tmp, (gsize*) & node->binary.binary_length);
+#else
+				node->binary.data = g_base64_decode (tmp, (gsize*) & node->binary.binary_length);
+				g_free (tmp);
+#endif
 			}
 		}
 		else {
diff --git a/libgda-ui/gdaui-rt-editor.c b/libgda-ui/gdaui-rt-editor.c
index 8e5cbe8..6dc679b 100644
--- a/libgda-ui/gdaui-rt-editor.c
+++ b/libgda-ui/gdaui-rt-editor.c
@@ -1051,7 +1051,14 @@ apply_markup (GdauiRtEditor *rte, GtkTextBuffer *textbuffer, TextTag *current, G
 		pe = start;
 		data = remove_newlines_from_base64 (gtk_text_buffer_get_text (textbuffer, &ps, &pe, FALSE));
 		/*g_print ("{{{%s}}}\n", data);*/
+#if GLIB_CHECK_VERSION(2,20,0)
 		g_base64_decode_inplace (data, &length);
+#else
+		gchar *tmp;
+		tmp = g_base64_decode (data, &length);
+		g_free (data);
+		data = tmp;
+#endif
 		if (gdk_pixdata_deserialize (&pixdata, length, (guint8*) data, NULL)) {
 			GdkPixbuf *pixbuf;
 			pixbuf = gdk_pixbuf_from_pixdata (&pixdata, TRUE, NULL);
diff --git a/tools/browser/ldap-browser/class-properties.c b/tools/browser/ldap-browser/class-properties.c
index 1be4004..42c5bb7 100644
--- a/tools/browser/ldap-browser/class-properties.c
+++ b/tools/browser/ldap-browser/class-properties.c
@@ -246,7 +246,11 @@ visibility_notify_event (GtkWidget *text_view, G_GNUC_UNUSED GdkEventVisibility
 {
 	gint wx, wy, bx, by;
 	
+#if GTK_CHECK_VERSION(2,14,0)
 	gdk_window_get_pointer (gtk_widget_get_window (text_view), &wx, &wy, NULL);
+#else
+	gdk_window_get_pointer (text_view->window, &wx, &wy, NULL);
+#endif
 	
 	gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view), 
 					       GTK_TEXT_WINDOW_WIDGET,
@@ -271,7 +275,11 @@ motion_notify_event (GtkWidget *text_view, GdkEventMotion *event, ClassPropertie
 	
 	set_cursor_if_appropriate (GTK_TEXT_VIEW (text_view), x, y, cprop);
 
+#if GTK_CHECK_VERSION(2,14,0)
 	gdk_window_get_pointer (gtk_widget_get_window (text_view), NULL, NULL, NULL);
+#else
+	gdk_window_get_pointer (text_view->window, NULL, NULL, NULL);
+#endif
 
 	return FALSE;
 }
@@ -354,14 +362,14 @@ key_press_event (GtkWidget *text_view, GdkEventKey *event, ClassProperties *cpro
 						  gtk_text_buffer_get_insert (buffer));
 		follow_if_link (text_view, &iter, cprop);
 		break;
-	case GDK_KEY_F:
-	case GDK_KEY_f:
+	case GDK_F:
+	case GDK_f:
 		if (event->state & GDK_CONTROL_MASK) {
 			show_search_bar (cprop);
 			return TRUE;
 		}
 		break;
-	case GDK_KEY_slash:
+	case GDK_slash:
 		show_search_bar (cprop);
 		return TRUE;
 		break;		
@@ -588,8 +596,13 @@ class_properties_set_class (ClassProperties *cprop, const gchar *classname)
 		}
 	}
 
+#if GTK_CHECK_VERSION(2,18,0)
 	if (cprop->priv->text_search && gtk_widget_get_visible (cprop->priv->text_search))
 		text_search_rerun (TEXT_SEARCH (cprop->priv->text_search));
+#else
+	if (cprop->priv->text_search && GTK_WIDGET_VISIBLE (cprop->priv->text_search))
+		text_search_rerun (TEXT_SEARCH (cprop->priv->text_search));
+#endif
 }
 
 static void
diff --git a/tools/browser/ldap-browser/classes-view.c b/tools/browser/ldap-browser/classes-view.c
index 9e602ea..a1788eb 100644
--- a/tools/browser/ldap-browser/classes-view.c
+++ b/tools/browser/ldap-browser/classes-view.c
@@ -187,9 +187,15 @@ source_drag_data_get_cb (G_GNUC_UNUSED GtkWidget *widget, G_GNUC_UNUSED GdkDragC
 	case TARGET_KEY_VALUE: {
 		gchar *str;
 		str = classes_view_to_selection (eview);
+#if GTK_CHECK_VERSION(2,18,0)
 		gtk_selection_data_set (selection_data,
 					gtk_selection_data_get_target (selection_data), 8, (guchar*) str,
 					strlen (str));
+#else
+		gtk_selection_data_set (selection_data,
+					(GdkAtom) selection_data->data, 8, (guchar*) str,
+					strlen (str));
+#endif
 		g_free (str);
 		break;
 	}
diff --git a/tools/browser/ldap-browser/entry-properties.c b/tools/browser/ldap-browser/entry-properties.c
index 44dac63..275d8a8 100644
--- a/tools/browser/ldap-browser/entry-properties.c
+++ b/tools/browser/ldap-browser/entry-properties.c
@@ -345,7 +345,11 @@ visibility_notify_event (GtkWidget *text_view, G_GNUC_UNUSED GdkEventVisibility
 {
 	gint wx, wy, bx, by;
 	
+#if GTK_CHECK_VERSION(2,14,0)
 	gdk_window_get_pointer (gtk_widget_get_window (text_view), &wx, &wy, NULL);
+#else
+	gdk_window_get_pointer (text_view->window, &wx, &wy, NULL);
+#endif
 	
 	gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view), 
 					       GTK_TEXT_WINDOW_WIDGET,
@@ -370,7 +374,11 @@ motion_notify_event (GtkWidget *text_view, GdkEventMotion *event, EntryPropertie
 	
 	set_cursor_if_appropriate (GTK_TEXT_VIEW (text_view), x, y, eprop);
 
+#if GTK_CHECK_VERSION(2,14,0)
 	gdk_window_get_pointer (gtk_widget_get_window (text_view), NULL, NULL, NULL);
+#else
+	gdk_window_get_pointer (text_view->window, NULL, NULL, NULL);
+#endif
 
 	/* store coordinates */
 	eprop->priv->bx = x;
@@ -460,14 +468,14 @@ key_press_event (GtkWidget *text_view, GdkEventKey *event, EntryProperties *epro
 						  gtk_text_buffer_get_insert (buffer));
 		follow_if_link (text_view, &iter, eprop);
 		break;
-	case GDK_KEY_F:
-	case GDK_KEY_f:
+	case GDK_F:
+	case GDK_f:
 		if (event->state & GDK_CONTROL_MASK) {
 			show_search_bar (eprop);
 			return TRUE;
 		}
 		break;
-	case GDK_KEY_slash:
+	case GDK_slash:
 		show_search_bar (eprop);
 		return TRUE;
 		break;
@@ -922,8 +930,13 @@ info_fetch_cb (BrowserConnection *bcnc, gpointer out_result, EntryProperties *ep
 		browser_show_message (GTK_WINDOW (gtk_widget_get_toplevel ((GtkWidget*) eprop)),
 				      "%s", _("Could not get information about LDAP entry"));
 
+#if GTK_CHECK_VERSION(2,18,0)
 	if (eprop->priv->text_search && gtk_widget_get_visible (eprop->priv->text_search))
 		text_search_rerun (TEXT_SEARCH (eprop->priv->text_search));
+#else
+	if (eprop->priv->text_search && GTK_WIDGET_VISIBLE (eprop->priv->text_search))
+		text_search_rerun (TEXT_SEARCH (eprop->priv->text_search));
+#endif
 
 	g_object_unref (eprop);
 }
diff --git a/tools/browser/ldap-browser/hierarchy-view.c b/tools/browser/ldap-browser/hierarchy-view.c
index 088a1e9..231e350 100644
--- a/tools/browser/ldap-browser/hierarchy-view.c
+++ b/tools/browser/ldap-browser/hierarchy-view.c
@@ -200,9 +200,15 @@ source_drag_data_get_cb (G_GNUC_UNUSED GtkWidget *widget, G_GNUC_UNUSED GdkDragC
 	case TARGET_KEY_VALUE: {
 		gchar *str;
 		str = hierarchy_view_to_selection (eview);
+#if GTK_CHECK_VERSION(2,18,0)
 		gtk_selection_data_set (selection_data,
 					gtk_selection_data_get_target (selection_data), 8, (guchar*) str,
 					strlen (str));
+#else
+		gtk_selection_data_set (selection_data,
+					(GdkAtom) selection_data->data, 8, (guchar*) str,
+					strlen (str));
+#endif
 		g_free (str);
 		break;
 	}
diff --git a/tools/browser/ldap-browser/ldap-classes-page.c b/tools/browser/ldap-browser/ldap-classes-page.c
index 4643f70..ec3280e 100644
--- a/tools/browser/ldap-browser/ldap-classes-page.c
+++ b/tools/browser/ldap-browser/ldap-classes-page.c
@@ -227,9 +227,15 @@ source_drag_data_get_cb (G_GNUC_UNUSED GtkWidget *widget, G_GNUC_UNUSED GdkDragC
 	case TARGET_KEY_VALUE: {
 		gchar *str;
 		str = ldap_classes_page_to_selection (ebrowser);
+#if GTK_CHECK_VERSION(2,18,0)
 		gtk_selection_data_set (selection_data,
 					gtk_selection_data_get_target (selection_data), 8, (guchar*) str,
 					strlen (str));
+#else
+		gtk_selection_data_set (selection_data,
+					(GdkAtom) selection_data->data, 8, (guchar*) str,
+					strlen (str));
+#endif
 		g_free (str);
 		break;
 	}
diff --git a/tools/browser/ldap-browser/ldap-entries-page.c b/tools/browser/ldap-browser/ldap-entries-page.c
index bb2ea0e..d682e34 100644
--- a/tools/browser/ldap-browser/ldap-entries-page.c
+++ b/tools/browser/ldap-browser/ldap-entries-page.c
@@ -228,9 +228,15 @@ source_drag_data_get_cb (G_GNUC_UNUSED GtkWidget *widget, G_GNUC_UNUSED GdkDragC
 	case TARGET_KEY_VALUE: {
 		gchar *str;
 		str = ldap_entries_page_to_selection (ebrowser);
+#if GTK_CHECK_VERSION(2,18,0)
 		gtk_selection_data_set (selection_data,
 					gtk_selection_data_get_target (selection_data), 8, (guchar*) str,
 					strlen (str));
+#else
+		gtk_selection_data_set (selection_data,
+					(GdkAtom) selection_data->data, 8, (guchar*) str,
+					strlen (str));
+#endif
 		g_free (str);
 		break;
 	}
diff --git a/tools/browser/ldap-browser/ldap-favorite-selector.c b/tools/browser/ldap-browser/ldap-favorite-selector.c
index 2877100..121af03 100644
--- a/tools/browser/ldap-browser/ldap-favorite-selector.c
+++ b/tools/browser/ldap-browser/ldap-favorite-selector.c
@@ -578,15 +578,25 @@ tree_store_drag_drop_cb (G_GNUC_UNUSED GdauiTreeStore *store, const gchar *path,
 	gint id;
 	bfav = browser_connection_get_favorites (fsel->priv->bcnc);
 
+#if GTK_CHECK_VERSION(2,18,0)
 	id = browser_favorites_find (bfav, 0, (gchar*) gtk_selection_data_get_data (selection_ldap),
 				     &fav, NULL);
+#else
+	id = browser_favorites_find (bfav, 0, (gchar*) selection_ldap->data,
+				     &fav, NULL);
+#endif
 	if (id < 0) {
 		memset (&fav, 0, sizeof (BrowserFavoritesAttributes));
 		fav.id = -1;
 		fav.type = BROWSER_FAVORITES_LDAP_DN;
+#if GTK_CHECK_VERSION(2,18,0)
 		fav.name = (gchar*) gtk_selection_data_get_data (selection_ldap);
-		fav.descr = NULL;
 		fav.contents = (gchar*) gtk_selection_data_get_data (selection_ldap);
+#else
+		fav.name = (gchar*) selection_ldap->data;
+		fav.contents = (gchar*) selection_ldap->data;
+#endif
+		fav.descr = NULL;
 	}
 
 	pos = atoi (path);
@@ -634,8 +644,13 @@ tree_store_drag_get_cb (G_GNUC_UNUSED GdauiTreeStore *store, const gchar *path,
 		if (cvalue) {
 			const gchar *str;
 			str = g_value_get_string (cvalue);
+#if GTK_CHECK_VERSION(2,18,0)
 			gtk_selection_data_set (selection_ldap, gtk_selection_data_get_target (selection_ldap),
 						8, (guchar*) str, strlen (str));
+#else
+			gtk_selection_data_set (selection_ldap, selection_ldap->target,
+						8, (guchar*) str, strlen (str));
+#endif
 			return TRUE;
 		}
 	}
diff --git a/tools/browser/ldap-browser/vtable-dialog.c b/tools/browser/ldap-browser/vtable-dialog.c
index 1a35919..6fb9a11 100644
--- a/tools/browser/ldap-browser/vtable-dialog.c
+++ b/tools/browser/ldap-browser/vtable-dialog.c
@@ -118,7 +118,12 @@ vtable_dialog_new (GtkWindow *parent, BrowserConnection *bcnc)
 	GtkWidget *dcontents;
 	GtkWidget *label, *entry, *table, *button;
 	gchar *str;
+
+#if GTK_CHECK_VERSION(2,18,0)
 	dcontents = gtk_dialog_get_content_area (GTK_DIALOG (dlg));
+#else
+	dcontents = GTK_DIALOG (dlg)->vbox;
+#endif
 	label = gtk_label_new (NULL);
 	gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
 	str = g_markup_printf_escaped ("<b>%s:</b>\n<small>%s</small>",



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