Changeset 103927 in webkit
- Timestamp:
- Jan 3, 2012 12:04:49 AM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r103911 r103927 1 2012-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 1 16 2012-01-02 Gyuyoung Kim <gyuyoung.kim@samsung.com> 2 17 -
trunk/Tools/GtkLauncher/main.c
r99156 r103927 231 231 { 232 232 if (!g_file_test(filename, G_FILE_TEST_EXISTS)) 233 return 0;233 return NULL; 234 234 235 235 GFile *gfile = g_file_new_for_path(filename); … … 307 307 } 308 308 309 static 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 309 315 static GOptionEntry* getOptionEntriesFromWebKitWebSettings(WebKitWebSettings *webSettings) 310 316 { … … 315 321 propertySpecs = g_object_class_list_properties(G_OBJECT_GET_CLASS(webSettings), &numProperties); 316 322 if (!propertySpecs) 317 return 0;323 return NULL; 318 324 319 325 optionEntries = g_new0(GOptionEntry, numProperties + 1); … … 322 328 GParamSpec *param = propertySpecs[i]; 323 329 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)) 326 332 continue; 327 333 328 334 GType gParamType = G_PARAM_SPEC_VALUE_TYPE(param); 329 if ( gParamType == G_TYPE_BOOLEAN || gParamType == G_TYPE_STRING || gParamType == G_TYPE_INT330 || 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); 344 350 } 345 351 g_free(propertySpecs);
Note: See TracChangeset
for help on using the changeset viewer.