Changeset 29341 in webkit


Ignore:
Timestamp:
Jan 9, 2008 12:26:47 PM (16 years ago)
Author:
alp@webkit.org
Message:

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
Location:
trunk/WebKit/gtk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/gtk/ChangeLog

    r29147 r29341  
     12008-01-09  Luca Bruno  <lethalman88@gmail.com>
     2
     3        Reviewed by Alp Toker.
     4
     5        http://bugs.webkit.org/show_bug.cgi?id=16802
     6        [GTK] Missing gtk properties
     7       
     8        Add missing properties to WebKitViewFrame and WebKitWebView.
     9       
     10        * WebView/webkitprivate.h: add some useful defines for param specs
     11        * WebView/webkitwebframe.cpp:
     12        (webkit_web_frame_get_property): added
     13        (webkit_web_frame_class_init): add name, title and uri read-only properties
     14        * WebView/webkitwebview.cpp:
     15        (webkit_web_view_get_property): add editable property read
     16        (webkit_web_view_set_property): added for editable property write
     17        (webkit_web_view_class_init): add read-write editable property
     18
    1192008-01-03  Xan Lopez  <xan@gnome.org>
    220
  • trunk/WebKit/gtk/WebView/webkitprivate.h

    r29080 r29341  
    5151extern "C" {
    5252    void webkit_init();
     53
     54#define WEBKIT_PARAM_READABLE ((GParamFlags)(G_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB))
     55#define WEBKIT_PARAM_READWRITE ((GParamFlags)(G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB))
    5356
    5457    #define WEBKIT_WEB_VIEW_GET_PRIVATE(obj)    (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_VIEW, WebKitWebViewPrivate))
  • trunk/WebKit/gtk/WebView/webkitwebframe.cpp

    r28818 r29341  
    5555};
    5656
     57enum {
     58    PROP_0,
     59
     60    PROP_NAME,
     61    PROP_TITLE,
     62    PROP_URI
     63};
     64
    5765static guint webkit_web_frame_signals[LAST_SIGNAL] = { 0, };
    5866
    5967G_DEFINE_TYPE(WebKitWebFrame, webkit_web_frame, G_TYPE_OBJECT)
     68
     69static void webkit_web_frame_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
     70{
     71    WebKitWebFrame* frame = WEBKIT_WEB_FRAME(object);
     72
     73    switch(prop_id) {
     74    case PROP_NAME:
     75        g_value_set_string(value, webkit_web_frame_get_name(frame));
     76        break;
     77    case PROP_TITLE:
     78        g_value_set_string(value, webkit_web_frame_get_title(frame));
     79        break;
     80    case PROP_URI:
     81        g_value_set_string(value, webkit_web_frame_get_uri(frame));
     82        break;
     83    default:
     84        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
     85        break;
     86    }
     87}
    6088
    6189static void webkit_web_frame_finalize(GObject* object)
     
    111139            G_TYPE_FROM_CLASS(frameClass),
    112140            (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
    113             0,                                               
     141            0,
    114142            NULL,
    115143            NULL,
     
    131159     * implementations of virtual methods
    132160     */
    133     G_OBJECT_CLASS(frameClass)->finalize = webkit_web_frame_finalize;
     161    GObjectClass* objectClass = G_OBJECT_CLASS(frameClass);
     162    objectClass->finalize = webkit_web_frame_finalize;
     163    objectClass->get_property = webkit_web_frame_get_property;
     164
     165    /*
     166     * properties
     167     */
     168    g_object_class_install_property(objectClass, PROP_NAME,
     169                                    g_param_spec_string("name",
     170                                                        "Name",
     171                                                        "The name of the frame",
     172                                                        NULL,
     173                                                        WEBKIT_PARAM_READABLE));
     174
     175    g_object_class_install_property(objectClass, PROP_TITLE,
     176                                    g_param_spec_string("title",
     177                                                        "Title",
     178                                                        "The document title of the frame",
     179                                                        NULL,
     180                                                        WEBKIT_PARAM_READABLE));
     181
     182    g_object_class_install_property(objectClass, PROP_URI,
     183                                    g_param_spec_string("uri",
     184                                                        "URI",
     185                                                        "The current URI of the contents displayed by the frame",
     186                                                        NULL,
     187                                                        WEBKIT_PARAM_READABLE));
    134188}
    135189
     
    191245}
    192246
     247/**
     248 * webkit_web_frame_get_title:
     249 * @frame: a #WebKitWebFrame
     250 *
     251 * Returns the @frame's document title
     252 *
     253 * Return value: the title of @frame
     254 */
    193255const gchar* webkit_web_frame_get_title(WebKitWebFrame* frame)
    194256{
     
    199261}
    200262
     263/**
     264 * webkit_web_frame_get_uri:
     265 * @frame: a #WebKitWebFrame
     266 *
     267 * Returns the current URI of the contents displayed by the @frame
     268 *
     269 * Return value: the URI of @frame
     270 */
    201271const gchar* webkit_web_frame_get_uri(WebKitWebFrame* frame)
    202272{
  • trunk/WebKit/gtk/WebView/webkitwebview.cpp

    r29147 r29341  
    8585
    8686    PROP_COPY_TARGET_LIST,
    87     PROP_PASTE_TARGET_LIST
     87    PROP_PASTE_TARGET_LIST,
     88    PROP_EDITABLE
    8889};
    8990
     
    178179}
    179180
    180 static void webkit_web_view_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) {
     181static void webkit_web_view_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
     182{
    181183    WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
    182184
     
    188190        g_value_set_boxed(value, webkit_web_view_get_paste_target_list(webView));
    189191        break;
     192    case PROP_EDITABLE:
     193        g_value_set_boolean(value, webkit_web_view_get_editable(webView));
     194        break;
    190195    default:
     196        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
     197        break;
     198    }
     199}
     200
     201static void webkit_web_view_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec *pspec)
     202{
     203    WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
     204
     205    switch(prop_id) {
     206    case PROP_EDITABLE:
     207        webkit_web_view_set_editable(webView, g_value_get_boolean(value));
     208        break;
     209    default:
     210        g_assert_not_reached();
    191211        break;
    192212    }
     
    894914    webViewClass->paste_clipboard = webkit_web_view_real_paste_clipboard;
    895915
    896     G_OBJECT_CLASS(webViewClass)->finalize = webkit_web_view_finalize;
    897 
    898916    GObjectClass* objectClass = G_OBJECT_CLASS(webViewClass);
     917    objectClass->finalize = webkit_web_view_finalize;
    899918    objectClass->get_property = webkit_web_view_get_property;
     919    objectClass->set_property = webkit_web_view_set_property;
    900920
    901921    GtkWidgetClass* widgetClass = GTK_WIDGET_CLASS(webViewClass);
     
    954974                                 "paste_clipboard", 0);
    955975
    956     /* Properties */
    957     GParamFlags flags = (GParamFlags)(G_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB);
     976    /*
     977     * properties
     978     */
    958979    g_object_class_install_property(objectClass, PROP_COPY_TARGET_LIST,
    959980                                    g_param_spec_boxed("copy-target-list",
     
    961982                                                       "The list of targets this Web view supports for copying to the clipboard",
    962983                                                       GTK_TYPE_TARGET_LIST,
    963                                                        flags));
     984                                                       WEBKIT_PARAM_READABLE));
    964985
    965986    g_object_class_install_property(objectClass, PROP_PASTE_TARGET_LIST,
     
    968989                                                       "The list of targets this Web view supports for pasting to the clipboard",
    969990                                                       GTK_TYPE_TARGET_LIST,
    970                                                        flags));
     991                                                       WEBKIT_PARAM_READABLE));
     992
     993    g_object_class_install_property(objectClass, PROP_EDITABLE,
     994                                    g_param_spec_boolean("editable",
     995                                                         "Editable",
     996                                                         "Whether content can be modified by the user",
     997                                                         FALSE,
     998                                                         WEBKIT_PARAM_READWRITE));
    971999}
    9721000
Note: See TracChangeset for help on using the changeset viewer.