Changeset 103927 in webkit


Ignore:
Timestamp:
Jan 3, 2012 12:04:49 AM (12 years ago)
Author:
Philippe Normand
Message:

[GTK] GtkLauncher settings improvements
https://bugs.webkit.org/show_bug.cgi?id=75439

Reviewed by Martin Robinson.

  • GtkLauncher/main.c:

(filenameToURL): We can use NULL in C.
(isValidParameterType): Utility function to filter GParamTypes
that can be edited.
(getOptionEntriesFromWebKitWebSettings): Avoid handling
construct-only properties and use the isValidParameterType
function. Makes the code a bit cleaner.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r103911 r103927  
     12012-01-02  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GTK] GtkLauncher settings improvements
     4        https://bugs.webkit.org/show_bug.cgi?id=75439
     5
     6        Reviewed by Martin Robinson.
     7
     8        * GtkLauncher/main.c:
     9        (filenameToURL): We can use NULL in C.
     10        (isValidParameterType): Utility function to filter GParamTypes
     11        that can be edited.
     12        (getOptionEntriesFromWebKitWebSettings): Avoid handling
     13        construct-only properties and use the isValidParameterType
     14        function. Makes the code a bit cleaner.
     15
    1162012-01-02  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
    217
  • trunk/Tools/GtkLauncher/main.c

    r99156 r103927  
    231231{
    232232    if (!g_file_test(filename, G_FILE_TEST_EXISTS))
    233         return 0;
     233        return NULL;
    234234
    235235    GFile *gfile = g_file_new_for_path(filename);
     
    307307}
    308308
     309static gboolean isValidParameterType(GType gParamType)
     310{
     311    return (gParamType == G_TYPE_BOOLEAN || gParamType == G_TYPE_STRING || gParamType == G_TYPE_INT
     312            || gParamType == G_TYPE_FLOAT);
     313}
     314
    309315static GOptionEntry* getOptionEntriesFromWebKitWebSettings(WebKitWebSettings *webSettings)
    310316{
     
    315321    propertySpecs = g_object_class_list_properties(G_OBJECT_GET_CLASS(webSettings), &numProperties);
    316322    if (!propertySpecs)
    317         return 0;
     323        return NULL;
    318324
    319325    optionEntries = g_new0(GOptionEntry, numProperties + 1);
     
    322328        GParamSpec *param = propertySpecs[i];
    323329
    324         /* Fill in structures only for writable properties. */
    325         if (!param || !(param->flags & G_PARAM_WRITABLE))
     330        /* Fill in structures only for writable and not construct-only properties. */
     331        if (!param || !(param->flags & G_PARAM_WRITABLE) || (param->flags & G_PARAM_CONSTRUCT_ONLY))
    326332            continue;
    327333
    328334        GType gParamType = G_PARAM_SPEC_VALUE_TYPE(param);
    329         if (gParamType == G_TYPE_BOOLEAN || gParamType == G_TYPE_STRING || gParamType == G_TYPE_INT
    330             || gParamType == G_TYPE_FLOAT) {
    331             GOptionEntry *optionEntry = &optionEntries[numEntries++];
    332             optionEntry->long_name = g_param_spec_get_name(param);
    333 
    334             /* There is no easy way to figure our short name for generated option entries.
    335                optionEntry.short_name=*/
    336             /* For bool arguments "enable" type make option argument not required. */
    337             if (gParamType == G_TYPE_BOOLEAN && (strstr(optionEntry->long_name, "enable")))
    338                 optionEntry->flags = G_OPTION_FLAG_OPTIONAL_ARG;
    339             optionEntry->arg = G_OPTION_ARG_CALLBACK;
    340             optionEntry->arg_data = parseOptionEntryCallback;
    341             optionEntry->description = g_param_spec_get_blurb(param);
    342             optionEntry->arg_description = g_type_name(gParamType);
    343         }
     335        if (!isValidParameterType(gParamType))
     336            continue;
     337
     338        GOptionEntry *optionEntry = &optionEntries[numEntries++];
     339        optionEntry->long_name = g_param_spec_get_name(param);
     340
     341        /* There is no easy way to figure our short name for generated option entries.
     342           optionEntry.short_name=*/
     343        /* For bool arguments "enable" type make option argument not required. */
     344        if (gParamType == G_TYPE_BOOLEAN && (strstr(optionEntry->long_name, "enable")))
     345            optionEntry->flags = G_OPTION_FLAG_OPTIONAL_ARG;
     346        optionEntry->arg = G_OPTION_ARG_CALLBACK;
     347        optionEntry->arg_data = parseOptionEntryCallback;
     348        optionEntry->description = g_param_spec_get_blurb(param);
     349        optionEntry->arg_description = g_type_name(gParamType);
    344350    }
    345351    g_free(propertySpecs);
Note: See TracChangeset for help on using the changeset viewer.