[webkit-gtk] How to change the user-agent string ? How to use properties ?

Diego Escalante Urrelo diegoe at gnome.org
Thu Jun 17 22:21:12 PDT 2010


El mié, 16-06-2010 a las 16:58 +0200, Mesny Jonathan escribió:

> > web_view = WEBKIT_WEB_VIEW(webkit_web_view_new()); WebKitWebSettings
> > * settings = webkit_web_view_get_settings(web_view);
> > g_object_set_property((GObject*)settings, "user-agent", (GValue*)"My
> > super crawler");
> 

Your casts are wrong.
GObject has a type system called GValue and you have to create GValue
types if you want to use set_property. You can read that in glib docs in
library.gnome.org

For your case, just use:

char *value = "My super string";
g_object_set (settings, "user-agent", &value, NULL);

That should work.



More information about the webkit-gtk mailing list