g_object_get not get the string property?



hi gtk-list
I have the following code,

/********** begin my code ****************/

#include <gtk/gtk.h>

int main(int argc,char **argv)
{
	
	GtkWidget *window;
	GtkWidget *entry;
	gchar value[1024];

	gtk_init(&argc,&argv);

	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	g_object_set(G_OBJECT(window),"title",g_locale_to_utf8("hello world",-1,NULL,NULL,NULL),NULL);
	g_signal_connect(G_OBJECT(window),"destroy",G_CALLBACK(gtk_main_quit),NULL);

	g_object_get(G_OBJECT(window),"title",value,NULL);
	g_print("Title %s\n",value);
	
	entry = gtk_entry_new();
	gtk_entry_set_text(GTK_ENTRY(entry),value);
	gtk_container_add(GTK_CONTAINER(window),entry);

	gtk_widget_show_all(window);

	gtk_main();
	return(0);
}
/******************* end ***********************/
when i run the code ,the following message displayed. it seems that 'g_object_get not' worked why?
(My locale is zh_CN)

[Invalid UTF-8] Title ĜĈŬ

**  WARNING **: Invalid UTF8 string passed to pango_layout_set_text()

**  WARNING **: Invalid UTF8 string passed to pango_layout_set_text()

**  CRITICAL **: file pango-layout.c: line 1707 (pango_layout_get_cursor_pos): assertion `index >= 0 && index <= layout->length' failed

**  CRITICAL **: file pango-layout.c: line 1707 (pango_layout_get_cursor_pos): assertion `index >= 0 && index <= layout->length' failed

  looking forward answer

ĦĦĦĦĦĦĦĦĦĦĦĦĦĦĦĦhoyt
ĦĦĦĦĦĦĦĦĦĦĦĦĦĦĦĦluozh handsome com cn
ĦĦĦĦĦĦĦĦĦĦĦĦĦĦĦĦĦĦĦĦ2002-10-16






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