Deprecate some gdk text conversion routines

And add x11-specific replacements for them
This commit is contained in:
Matthias Clasen 2010-12-17 01:43:24 -05:00
parent e65e208d40
commit bad6d00966
4 changed files with 107 additions and 13 deletions

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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