i = n_strings;
tmp_list = strings; while (tmp_list)
{ if (list)
(*list)[--i] = tmp_list->data; else
g_free (tmp_list->data);
tmp_list = tmp_list->next;
}
g_slist_free (strings);
return n_strings;
}
int
_gdk_x11_display_text_property_to_utf8_list (GdkDisplay *display, constchar *encoding, int format, const guchar *text, int length, char ***list)
{ if (g_str_equal (encoding, "STRING"))
{ return make_list ((char *)text, length, TRUE, list);
} elseif (g_str_equal (encoding, "UTF8_STRING"))
{ return make_list ((char *)text, length, FALSE, list);
} else
{ char **local_list; int local_count; int i; constchar *charset = NULL;
gboolean need_conversion = !g_get_charset (&charset); int count = 0;
GError *error = NULL;
/* Probably COMPOUND text, we fall back to Xlib routines
*/
local_count = gdk_x11_display_text_property_to_text_list (display,
encoding,
format,
text,
length,
&local_list); if (list)
*list = g_new (char *, local_count + 1);
for (i=0; i<local_count; i++)
{ /* list contains stuff in our default encoding
*/ if (need_conversion)
{ char *utf = g_convert (local_list[i], -1, "UTF-8", charset,
NULL, NULL, &error); if (utf)
{ if (list)
(*list)[count++] = utf; else
g_free (utf);
} else
{
g_warning ("Error converting to UTF-8 from '%s': %s",
charset, error->message);
g_clear_error (&error);
}
} else
{ if (list)
{ if (g_utf8_validate (local_list[i], -1, NULL))
(*list)[count++] = g_strdup (local_list[i]); else
g_warning ("Error converting selection");
}
}
}
if (local_count)
gdk_x11_free_text_list (local_list);
if (list)
(*list)[count] = NULL;
return count;
}
}
/** *gdk_x11_display_string_to_compound_text: *@display:(typeGdkX11Display):the`GdkDisplay`wheretheencodingisdefined *@str:anul-terminatedstring *@encoding:(out)(transfernone):locationtostoretheencoding *(tobeusedasthetypefortheproperty) *@format:(out):locationtostoretheformatoftheproperty *@ctext:(out)(arraylength=length):locationtostorenewly *allocateddatafortheproperty *@length:thelengthof@ctext,inbytes * *Convertastringfromtheencodingofthecurrent *localeintoaformsuitableforstoringinawindowproperty. * *Returns:0uponsuccess,non-zerouponfailure * *Deprecated:4.18
*/ int
gdk_x11_display_string_to_compound_text (GdkDisplay *display, constchar *str, constchar **encoding, int *format,
guchar **ctext, int *length)
{ int res;
XTextProperty property;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.