From bad6d00966fe6b2ad45ac0c1201b7dcb777fa798 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 17 Dec 2010 01:43:24 -0500 Subject: [PATCH] Deprecate some gdk text conversion routines And add x11-specific replacements for them --- gdk/gdk.symbols | 16 ++++++++++- gdk/gdkproperty.h | 28 ++++++++++--------- gdk/x11/gdkselection-x11.c | 55 ++++++++++++++++++++++++++++++++++++++ gdk/x11/gdkx.h | 21 +++++++++++++++ 4 files changed, 107 insertions(+), 13 deletions(-) diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols index a0d061235d..9d9dfc35a9 100644 --- a/gdk/gdk.symbols +++ b/gdk/gdk.symbols @@ -175,12 +175,14 @@ gdk_screen_height_mm G_GNUC_CONST #if IN_HEADER(__GDK_PROPERTY_H__) #if IN_FILE(__GDK_SELECTION_C__) +#ifndef GDK_DISABLE_DEPRECATED gdk_string_to_compound_text gdk_text_property_to_text_list gdk_text_property_to_utf8_list gdk_utf8_to_compound_text #endif #endif +#endif #if IN_HEADER(__GDK_PROPERTY_H__) #if IN_FILE(__GDK_PROPERTY_X11_C__) @@ -195,13 +197,25 @@ gdk_property_get #if IN_HEADER(__GDK_PROPERTY_H__) #if IN_FILE(__GDK_SELECTION_X11_C__) +#ifndef GDK_DISABLE_DEPRECATED gdk_free_compound_text gdk_free_text_list gdk_string_to_compound_text_for_display gdk_text_property_to_text_list_for_display +gdk_utf8_to_compound_text_for_display +#endif gdk_text_property_to_utf8_list_for_display gdk_utf8_to_string_target -gdk_utf8_to_compound_text_for_display +#endif +#endif + +#if IN_HEADER(__GDK_X_H__) +#if IN_FILE(__GDK_SELECTION_X11_C__) +gdk_x11_display_string_to_compound_text +gdk_x11_display_text_property_to_text_list +gdk_x11_display_utf8_to_compound_text +gdk_x11_free_compound_text +gdk_x11_free_text_list #endif #endif diff --git a/gdk/gdkproperty.h b/gdk/gdkproperty.h index 3cfda50191..ba99e6ef48 100644 --- a/gdk/gdkproperty.h +++ b/gdk/gdkproperty.h @@ -67,16 +67,12 @@ void gdk_property_change (GdkWindow *window, void gdk_property_delete (GdkWindow *window, GdkAtom property); #ifndef GDK_MULTIHEAD_SAFE +#ifndef GDK_DISABLE_DEPRECATED gint gdk_text_property_to_text_list (GdkAtom encoding, gint format, const guchar *text, gint length, gchar ***list); -gint gdk_text_property_to_utf8_list (GdkAtom encoding, - gint format, - const guchar *text, - gint length, - gchar ***list); gboolean gdk_utf8_to_compound_text (const gchar *str, GdkAtom *encoding, gint *format, @@ -87,22 +83,29 @@ gint gdk_string_to_compound_text (const gchar *str, gint *format, guchar **ctext, gint *length); +gint gdk_text_property_to_utf8_list (GdkAtom encoding, + gint format, + const guchar *text, + gint length, + gchar ***list); +#endif #endif -gint gdk_text_property_to_text_list_for_display (GdkDisplay *display, - GdkAtom encoding, - gint format, - const guchar *text, - gint length, - gchar ***list); gint gdk_text_property_to_utf8_list_for_display (GdkDisplay *display, GdkAtom encoding, gint format, const guchar *text, gint length, gchar ***list); - + gchar *gdk_utf8_to_string_target (const gchar *str); +#ifndef GDK_DISABLE_DEPRECATED +gint gdk_text_property_to_text_list_for_display (GdkDisplay *display, + GdkAtom encoding, + gint format, + const guchar *text, + gint length, + gchar ***list); gint gdk_string_to_compound_text_for_display (GdkDisplay *display, const gchar *str, GdkAtom *encoding, @@ -118,6 +121,7 @@ gboolean gdk_utf8_to_compound_text_for_display (GdkDisplay *display, void gdk_free_text_list (gchar **list); void gdk_free_compound_text (guchar *ctext); +#endif G_END_DECLS diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c index f993b5bf45..3a69578ae1 100644 --- a/gdk/x11/gdkselection-x11.c +++ b/gdk/x11/gdkselection-x11.c @@ -438,9 +438,27 @@ gdk_selection_send_notify_for_display (GdkDisplay *display, * if the conversion failed. * * Since: 2.2 + * + * Deprecated:2.24: Use gdk_x11_display_text_property_to_text_list() */ gint gdk_text_property_to_text_list_for_display (GdkDisplay *display, + GdkAtom encoding, + gint format, + const guchar *text, + gint length, + gchar ***list) +{ + return gdk_x11_display_text_property_to_text_list (display, + encoding, + format, + text, + length, + list); +} + +gint +gdk_x11_display_text_property_to_text_list (GdkDisplay *display, GdkAtom encoding, gint format, const guchar *text, @@ -480,6 +498,12 @@ gdk_text_property_to_text_list_for_display (GdkDisplay *display, void gdk_free_text_list (gchar **list) +{ + gdk_x11_free_text_list (list); +} + +void +gdk_x11_free_text_list (gchar **list) { g_return_if_fail (list != NULL); @@ -685,6 +709,8 @@ gdk_text_property_to_utf8_list_for_display (GdkDisplay *display, * Returns: 0 upon success, non-zero upon failure. * * Since: 2.2 + * + * Deprecated:2.24: Use gdk_x11_display_string_to_compound_text() **/ gint gdk_string_to_compound_text_for_display (GdkDisplay *display, @@ -693,6 +719,17 @@ gdk_string_to_compound_text_for_display (GdkDisplay *display, gint *format, guchar **ctext, gint *length) +{ + return gdk_x11_display_string_to_compound_text (display, str, encoding, format, ctext, length); +} + +gint +gdk_x11_display_string_to_compound_text (GdkDisplay *display, + const gchar *str, + GdkAtom *encoding, + gint *format, + guchar **ctext, + gint *length) { gint res; XTextProperty property; @@ -818,6 +855,8 @@ gdk_utf8_to_string_target (const gchar *str) * %FALSE. * * Since: 2.2 + * + * Deprecated:2.24: Use gdk_x11_display_utf8_to_compound_text() **/ gboolean gdk_utf8_to_compound_text_for_display (GdkDisplay *display, @@ -826,6 +865,17 @@ gdk_utf8_to_compound_text_for_display (GdkDisplay *display, gint *format, guchar **ctext, gint *length) +{ + return gdk_x11_display_utf8_to_compound_text (display, str, encoding, format, ctext, length); +} + +gboolean +gdk_x11_display_utf8_to_compound_text (GdkDisplay *display, + const gchar *str, + GdkAtom *encoding, + gint *format, + guchar **ctext, + gint *length) { gboolean need_conversion; const gchar *charset; @@ -883,6 +933,11 @@ gdk_utf8_to_compound_text_for_display (GdkDisplay *display, } void gdk_free_compound_text (guchar *ctext) +{ + gdk_x11_free_compound_text (ctext); +} + +void gdk_x11_free_compound_text (guchar *ctext) { if (ctext) XFree (ctext); diff --git a/gdk/x11/gdkx.h b/gdk/x11/gdkx.h index cdadd6416c..f3ac394fce 100644 --- a/gdk/x11/gdkx.h +++ b/gdk/x11/gdkx.h @@ -228,6 +228,27 @@ GdkWindow *gdk_x11_window_foreign_new_for_display (GdkDisplay *display, GdkWindow *gdk_x11_window_lookup_for_display (GdkDisplay *display, Window window); +gint gdk_x11_display_text_property_to_text_list (GdkDisplay *display, + GdkAtom encoding, + gint format, + const guchar *text, + gint length, + gchar ***list); +void gdk_x11_free_text_list (gchar **list); +gint gdk_x11_display_string_to_compound_text (GdkDisplay *display, + const gchar *str, + GdkAtom *encoding, + gint *format, + guchar **ctext, + gint *length); +gboolean gdk_x11_display_utf8_to_compound_text (GdkDisplay *display, + const gchar *str, + GdkAtom *encoding, + gint *format, + guchar **ctext, + gint *length); +void gdk_x11_free_compound_text (guchar *ctext); + G_END_DECLS