Reviewed by Alp Toker.
http://bugs.webkit.org/show_bug.cgi?id=16802
[GTK] Missing gtk properties
Add missing properties to WebKitViewFrame and WebKitWebView.
* WebView/webkitprivate.h: add some useful defines for param specs
* WebView/webkitwebframe.cpp:
(webkit_web_frame_get_property): added
(webkit_web_frame_class_init): add name, title and uri read-only properties
* WebView/webkitwebview.cpp:
(webkit_web_view_get_property): add editable property read
(webkit_web_view_set_property): added for editable property write
(webkit_web_view_class_init): add read-write editable property
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29341
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2008-01-09 Luca Bruno <lethalman88@gmail.com>
+
+ Reviewed by Alp Toker.
+
+ http://bugs.webkit.org/show_bug.cgi?id=16802
+ [GTK] Missing gtk properties
+
+ Add missing properties to WebKitViewFrame and WebKitWebView.
+
+ * WebView/webkitprivate.h: add some useful defines for param specs
+ * WebView/webkitwebframe.cpp:
+ (webkit_web_frame_get_property): added
+ (webkit_web_frame_class_init): add name, title and uri read-only properties
+ * WebView/webkitwebview.cpp:
+ (webkit_web_view_get_property): add editable property read
+ (webkit_web_view_set_property): added for editable property write
+ (webkit_web_view_class_init): add read-write editable property
+
2008-01-03 Xan Lopez <xan@gnome.org>
Reviewed by Alp Toker.
extern "C" {
void webkit_init();
+#define WEBKIT_PARAM_READABLE ((GParamFlags)(G_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB))
+#define WEBKIT_PARAM_READWRITE ((GParamFlags)(G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB))
+
#define WEBKIT_WEB_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_VIEW, WebKitWebViewPrivate))
typedef struct _WebKitWebViewPrivate WebKitWebViewPrivate;
struct _WebKitWebViewPrivate {
LAST_SIGNAL
};
+enum {
+ PROP_0,
+
+ PROP_NAME,
+ PROP_TITLE,
+ PROP_URI
+};
+
static guint webkit_web_frame_signals[LAST_SIGNAL] = { 0, };
G_DEFINE_TYPE(WebKitWebFrame, webkit_web_frame, G_TYPE_OBJECT)
+static void webkit_web_frame_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
+{
+ WebKitWebFrame* frame = WEBKIT_WEB_FRAME(object);
+
+ switch(prop_id) {
+ case PROP_NAME:
+ g_value_set_string(value, webkit_web_frame_get_name(frame));
+ break;
+ case PROP_TITLE:
+ g_value_set_string(value, webkit_web_frame_get_title(frame));
+ break;
+ case PROP_URI:
+ g_value_set_string(value, webkit_web_frame_get_uri(frame));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
static void webkit_web_frame_finalize(GObject* object)
{
WebKitWebFramePrivate* privateData = WEBKIT_WEB_FRAME_GET_PRIVATE(WEBKIT_WEB_FRAME(object));
webkit_web_frame_signals[TITLE_CHANGED] = g_signal_new("title-changed",
G_TYPE_FROM_CLASS(frameClass),
(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
- 0,
+ 0,
NULL,
NULL,
webkit_marshal_VOID__STRING,
/*
* implementations of virtual methods
*/
- G_OBJECT_CLASS(frameClass)->finalize = webkit_web_frame_finalize;
+ GObjectClass* objectClass = G_OBJECT_CLASS(frameClass);
+ objectClass->finalize = webkit_web_frame_finalize;
+ objectClass->get_property = webkit_web_frame_get_property;
+
+ /*
+ * properties
+ */
+ g_object_class_install_property(objectClass, PROP_NAME,
+ g_param_spec_string("name",
+ "Name",
+ "The name of the frame",
+ NULL,
+ WEBKIT_PARAM_READABLE));
+
+ g_object_class_install_property(objectClass, PROP_TITLE,
+ g_param_spec_string("title",
+ "Title",
+ "The document title of the frame",
+ NULL,
+ WEBKIT_PARAM_READABLE));
+
+ g_object_class_install_property(objectClass, PROP_URI,
+ g_param_spec_string("uri",
+ "URI",
+ "The current URI of the contents displayed by the frame",
+ NULL,
+ WEBKIT_PARAM_READABLE));
}
static void webkit_web_frame_init(WebKitWebFrame* frame)
return frame;
}
+/**
+ * webkit_web_frame_get_title:
+ * @frame: a #WebKitWebFrame
+ *
+ * Returns the @frame's document title
+ *
+ * Return value: the title of @frame
+ */
const gchar* webkit_web_frame_get_title(WebKitWebFrame* frame)
{
g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL);
return frameData->title;
}
+/**
+ * webkit_web_frame_get_uri:
+ * @frame: a #WebKitWebFrame
+ *
+ * Returns the current URI of the contents displayed by the @frame
+ *
+ * Return value: the URI of @frame
+ */
const gchar* webkit_web_frame_get_uri(WebKitWebFrame* frame)
{
g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL);
PROP_0,
PROP_COPY_TARGET_LIST,
- PROP_PASTE_TARGET_LIST
+ PROP_PASTE_TARGET_LIST,
+ PROP_EDITABLE
};
static guint webkit_web_view_signals[LAST_SIGNAL] = { 0, };
return webkit_web_view_forward_context_menu_event(WEBKIT_WEB_VIEW(widget), event);
}
-static void webkit_web_view_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) {
+static void webkit_web_view_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
+{
WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
switch(prop_id) {
case PROP_PASTE_TARGET_LIST:
g_value_set_boxed(value, webkit_web_view_get_paste_target_list(webView));
break;
+ case PROP_EDITABLE:
+ g_value_set_boolean(value, webkit_web_view_get_editable(webView));
+ break;
default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void webkit_web_view_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec *pspec)
+{
+ WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
+
+ switch(prop_id) {
+ case PROP_EDITABLE:
+ webkit_web_view_set_editable(webView, g_value_get_boolean(value));
+ break;
+ default:
+ g_assert_not_reached();
break;
}
}
webViewClass->copy_clipboard = webkit_web_view_real_copy_clipboard;
webViewClass->paste_clipboard = webkit_web_view_real_paste_clipboard;
- G_OBJECT_CLASS(webViewClass)->finalize = webkit_web_view_finalize;
-
GObjectClass* objectClass = G_OBJECT_CLASS(webViewClass);
+ objectClass->finalize = webkit_web_view_finalize;
objectClass->get_property = webkit_web_view_get_property;
+ objectClass->set_property = webkit_web_view_set_property;
GtkWidgetClass* widgetClass = GTK_WIDGET_CLASS(webViewClass);
widgetClass->realize = webkit_web_view_realize;
gtk_binding_entry_add_signal(binding_set, GDK_Insert, GDK_SHIFT_MASK,
"paste_clipboard", 0);
- /* Properties */
- GParamFlags flags = (GParamFlags)(G_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB);
+ /*
+ * properties
+ */
g_object_class_install_property(objectClass, PROP_COPY_TARGET_LIST,
g_param_spec_boxed("copy-target-list",
"Target list",
"The list of targets this Web view supports for copying to the clipboard",
GTK_TYPE_TARGET_LIST,
- flags));
+ WEBKIT_PARAM_READABLE));
g_object_class_install_property(objectClass, PROP_PASTE_TARGET_LIST,
g_param_spec_boxed("paste-target-list",
"Target list",
"The list of targets this Web view supports for pasting to the clipboard",
GTK_TYPE_TARGET_LIST,
- flags));
+ WEBKIT_PARAM_READABLE));
+
+ g_object_class_install_property(objectClass, PROP_EDITABLE,
+ g_param_spec_boolean("editable",
+ "Editable",
+ "Whether content can be modified by the user",
+ FALSE,
+ WEBKIT_PARAM_READWRITE));
}
static void webkit_web_view_init(WebKitWebView* webView)