Changeset 65255 in webkit
- Timestamp:
- Aug 12, 2010 10:33:35 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r65253 r65255 1 2010-08-12 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> 2 3 Reviewed by Martin Robinson. 4 5 [GTK] Use GSettings to save/restore Web Inspector settings 6 https://bugs.webkit.org/show_bug.cgi?id=43512 7 8 * GNUmakefile.am: GSettings rules. 9 * configure.ac: GSettings infrastructure, and check if we should 10 use it by looking for an appropriate version of GIO. 11 1 12 2010-08-12 Rafael Antognolli <antognolli@profusion.mobi> 2 13 -
trunk/GNUmakefile.am
r64760 r65255 925 925 && rm -f xgen-gtc 926 926 927 # GSettings 928 if USE_GSETTINGS 929 gsettings_SCHEMAS = $(top_builddir)/WebKit/gtk/org.webkitgtk-@WEBKITGTK_API_VERSION@.gschema.xml 930 931 @GSETTINGS_RULES@ 932 endif 933 927 934 # Files that will be distributed 928 935 EXTRA_DIST += \ … … 941 948 $(srcdir)/WebKit/gtk/resources/* \ 942 949 $(srcdir)/WebKit/gtk/tests/resources/* \ 943 $(srcdir)/WebKit/gtk/tests/test_utils.h 950 $(srcdir)/WebKit/gtk/tests/test_utils.h \ 951 $(srcdir)/WebKit/gtk/org.webkitgtk.gschema.xml.in 944 952 945 953 # extra resource files … … 1146 1154 $(top_builddir)/WebKit/gtk/docs/GNUmakefile \ 1147 1155 $(top_builddir)/WebKit/gtk/@WEBKITGTK_PC_NAME@-@WEBKITGTK_API_VERSION@.pc \ 1148 $(top_builddir)/WebKit/gtk/webkit/webkitversion.h 1156 $(top_builddir)/WebKit/gtk/webkit/webkitversion.h \ 1157 $(top_builddir)/WebKit/gtk/org.webkitgtk-@WEBKITGTK_API_VERSION@.gschema.xml 1149 1158 1150 1159 MAINTAINERCLEANFILES += \ -
trunk/JavaScriptCore/ChangeLog
r65242 r65255 1 2010-08-12 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> 2 3 Reviewed by Martin Robinson. 4 5 [GTK] Use GSettings to save/restore Web Inspector settings 6 https://bugs.webkit.org/show_bug.cgi?id=43512 7 8 * wtf/gobject/GRefPtr.cpp: Added support for GVariant, used by our 9 GSettings support. 10 (WTF::refGPtr): 11 (WTF::derefGPtr): 12 * wtf/gobject/GRefPtr.h: 13 1 14 2010-08-12 Gabor Loki <loki@webkit.org> 2 15 -
trunk/JavaScriptCore/wtf/gobject/GRefPtr.cpp
r55149 r65255 36 36 } 37 37 38 #if GLIB_CHECK_VERSION(2, 24, 0) 39 template <> GVariant* refGPtr(GVariant* ptr) 40 { 41 if (ptr) 42 g_variant_ref(ptr); 43 return ptr; 44 } 45 46 template <> void derefGPtr(GVariant* ptr) 47 { 48 g_variant_unref(ptr); 49 } 50 #endif 51 38 52 } // namespace WTF -
trunk/JavaScriptCore/wtf/gobject/GRefPtr.h
r62674 r65255 26 26 #include "AlwaysInline.h" 27 27 #include <algorithm> 28 29 typedef struct _GHashTable GHashTable; 30 typedef void* gpointer; 31 extern "C" void g_object_unref(gpointer object); 32 extern "C" gpointer g_object_ref_sink(gpointer object); 28 #include <glib.h> 33 29 34 30 namespace WTF { … … 41 37 template <> GHashTable* refGPtr(GHashTable* ptr); 42 38 template <> void derefGPtr(GHashTable* ptr); 39 40 #if GLIB_CHECK_VERSION(2, 24, 0) 41 template <> GVariant* refGPtr(GVariant* ptr); 42 template <> void derefGPtr(GVariant* ptr); 43 #endif 43 44 44 45 template <typename T> class GRefPtr { -
trunk/WebKit/gtk/ChangeLog
r65209 r65255 1 2010-08-12 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> 2 3 Reviewed by Martin Robinson. 4 5 [GTK] Use GSettings to save/restore Web Inspector settings 6 https://bugs.webkit.org/show_bug.cgi?id=43512 7 8 Use GSettings to save/restore settings used by the Web Inspector. 9 A few helper functions were added to have settings that use 10 boolean values be actual booleans, and also to conform with the 11 GSettings naming requirements for keys. 12 13 * WebCoreSupport/InspectorClientGtk.cpp: 14 (WebKit::toGSettingName): 15 (WebKit::truthStringFromVariant): 16 (WebKit::variantFromTruthString): 17 (WebKit::InspectorClient::populateSetting): 18 (WebKit::InspectorClient::storeSetting): 19 * org.webkit.gtk.gschema.xml: Added. 20 * webkit/webkitprivate.cpp: 21 (inspectorGSettings): 22 (webkit_init): 23 * webkit/webkitprivate.h: 24 1 25 2010-08-11 Joone Hur <joone@kldp.org> 2 26 -
trunk/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
r64865 r65255 1 1 /* 2 2 * Copyright (C) 2008 Gustavo Noronha Silva 3 * Copyright (C) 2010 Collabora Ltd. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 119 120 } 120 121 122 #if HAVE_GSETTINGS 123 static String toGSettingName(String inspectorSettingName) 124 { 125 if (inspectorSettingName == "resourceTrackingEnabled") 126 return String("resource-tracking-enabled"); 127 128 if (inspectorSettingName == "xhrMonitor") 129 return String("xhr-monitor-enabled"); 130 131 if (inspectorSettingName == "frontendSettings") 132 return String("frontend-settings"); 133 134 if (inspectorSettingName == "debuggerEnabled") 135 return String("debugger-enabled"); 136 137 if (inspectorSettingName == "profilerEnabled") 138 return String("profiler-enabled"); 139 140 return inspectorSettingName; 141 } 142 143 static String truthStringFromVariant(GVariant* variant) 144 { 145 if (g_variant_get_boolean(variant)) 146 return String("true"); 147 148 return String("false"); 149 } 150 151 static GVariant* variantFromTruthString(const String& truth) 152 { 153 if (truth == "true") 154 return g_variant_new_boolean(TRUE); 155 156 return g_variant_new_boolean(FALSE); 157 } 158 159 static bool shouldIgnoreSetting(const String& key) 160 { 161 // Ignore this setting for now, it doesn't seem to be used for 162 // anything right now. 163 if (key == "lastActivePanel") 164 return true; 165 166 // GSettings considers trying to fetch or set a setting that is 167 // not backed by a schema as programmer error, and aborts the 168 // program's execution. We check here to avoid having an unhandled 169 // setting as a fatal error. 170 if (key == "resourceTrackingEnabled" || key == "xhrMonitor" 171 || key == "frontendSettings" || key == "debuggerEnabled" 172 || key == "profilerEnabled") 173 return false; 174 175 LOG_VERBOSE(NotYetImplemented, "Unknown key ignored: %s", key.ascii().data()); 176 return true; 177 } 178 121 179 void InspectorClient::populateSetting(const String& key, String* value) 122 180 { 181 if (shouldIgnoreSetting(key)) 182 return; 183 184 GSettings* settings = inspectorGSettings(); 185 if (!settings) 186 return; 187 188 GRefPtr<GVariant> variant = adoptGRef(g_settings_get_value(settings, toGSettingName(key).utf8().data())); 189 190 if (key == "resourceTrackingEnabled" || key == "xhrMonitor" 191 || key == "debuggerEnabled" || key == "profilerEnabled") 192 *value = truthStringFromVariant(variant.get()); 193 else if (key == "frontendSettings") 194 *value = String(g_variant_get_string(variant.get(), 0)); 195 } 196 197 void InspectorClient::storeSetting(const String& key, const String& value) 198 { 199 if (shouldIgnoreSetting(key)) 200 return; 201 202 GSettings* settings = inspectorGSettings(); 203 if (!settings) 204 return; 205 206 GRefPtr<GVariant> variant(0); 207 208 // Set the key with the appropriate type, and also avoid setting 209 // unknown keys to avoid aborting the execution. 210 if (key == "resourceTrackingEnabled" || key == "xhrMonitor" 211 || key == "debuggerEnabled" || key == "profilerEnabled") 212 variant = adoptGRef(variantFromTruthString(value)); 213 else if (key == "frontendSettings") 214 variant = adoptGRef(g_variant_new_string(value.utf8().data())); 215 216 if (!variant) 217 return; 218 219 g_settings_set_value(settings, toGSettingName(key).utf8().data(), variant.get()); 220 } 221 #else 222 void InspectorClient::populateSetting(const String&, String*) 223 { 123 224 notImplemented(); 124 225 } 125 226 126 void InspectorClient::storeSetting(const String& key, const String& value)227 void InspectorClient::storeSetting(const String&, const String&) 127 228 { 128 229 notImplemented(); 129 230 } 231 #endif // HAVE_GSETTINGS 130 232 131 233 bool InspectorClient::sendMessageToFrontend(const String& message) -
trunk/WebKit/gtk/webkit/webkitprivate.cpp
r60841 r65255 45 45 #include "webkitnetworkresponse.h" 46 46 #include "webkitsoupauthdialog.h" 47 #include "webkitversion.h" 47 48 #include <libintl.h> 48 49 #include <runtime/InitializeThreading.h> … … 215 216 } 216 217 218 #if HAVE_GSETTINGS 219 static bool isSchemaAvailable(char* schemaID) 220 { 221 const char* const* availableSchemas = g_settings_list_schemas(); 222 char* const* iter = const_cast<char* const*>(availableSchemas); 223 224 while (*iter) { 225 if (g_str_equal(schemaID, *iter)) 226 return true; 227 iter++; 228 } 229 230 return false; 231 } 232 233 GSettings* inspectorGSettings() 234 { 235 static GSettings* settings = 0; 236 237 if (settings) 238 return settings; 239 240 GOwnPtr<gchar> schemaID(g_strdup_printf("org.webkitgtk-%.1f.inspector", WEBKITGTK_API_VERSION)); 241 242 // Unfortunately GSettings will abort the process execution if the 243 // schema is not installed, which is the case for when running 244 // tests, or even the introspection dump at build time, so check 245 // if we have the schema before trying to initialize it. 246 if (!isSchemaAvailable(schemaID.get())) { 247 g_warning("GSettings schema not found - settings will not be used or saved."); 248 return 0; 249 } 250 251 settings = g_settings_new(schemaID.get()); 252 253 return settings; 254 } 255 #endif 256 217 257 void webkit_init() 218 258 { … … 239 279 webkit_set_cache_model(WEBKIT_CACHE_MODEL_WEB_BROWSER); 240 280 281 #if HAVE_GSETTINGS 282 // Initialize settings variables here to make sure this happens in 283 // the main thread. 284 inspectorGSettings(); 285 #endif 286 241 287 #if ENABLE(DATABASE) 242 288 gchar* databaseDirectory = g_build_filename(g_get_user_data_dir(), "webkit", "databases", NULL); -
trunk/WebKit/gtk/webkit/webkitprivate.h
r65107 r65255 121 121 void webkit_init(); 122 122 123 #if HAVE_GSETTINGS 124 GSettings* inspectorGSettings(); 125 #endif 126 123 127 #define WEBKIT_PARAM_READABLE ((GParamFlags)(G_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB)) 124 128 #define WEBKIT_PARAM_READWRITE ((GParamFlags)(G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB)) -
trunk/configure.ac
r64763 r65255 261 261 WEBKIT_CHECK_DEPENDENCIES([glib unicode]) 262 262 263 # Check if we can use GSettings 264 PKG_CHECK_MODULES([GSETTINGS], 265 [gio-2.0 >= 2.25.0], 266 [have_gsettings=yes], 267 [have_gsettings=no]) 268 if test "$have_gsettings" = "yes"; then 269 AC_DEFINE([HAVE_GSETTINGS], 1, [Whether we can use GSettings]) 270 fi 271 263 272 GETTEXT_PACKAGE=$PACKAGE-$GTK_API_VERSION 264 273 AC_SUBST(GETTEXT_PACKAGE) … … 826 835 fi 827 836 837 # GSettings 838 GLIB_GSETTINGS 839 828 840 # check if gstreamer is available 829 841 if test "$enable_video" = "yes"; then … … 874 886 AM_CONDITIONAL([USE_FREETYPE], [test "$with_font_backend" = "freetype"]) 875 887 AM_CONDITIONAL([USE_PANGO], [test "$with_font_backend" = "pango"]) 888 889 # GLib/GIO feature conditionals 890 AM_CONDITIONAL([USE_GSETTINGS], [test "$have_gsettings" = "yes"]) 876 891 877 892 # WebKit feature conditionals … … 935 950 AC_CONFIG_FILES([ 936 951 WebKit/gtk/${WEBKITGTK_PC_NAME}-${WEBKITGTK_API_VERSION}.pc:WebKit/gtk/webkit.pc.in 937 WebKit/gtk/JSCore-${WEBKITGTK_API_VERSION}.gir:WebKit/gtk/JSCore.gir.in] 952 WebKit/gtk/JSCore-${WEBKITGTK_API_VERSION}.gir:WebKit/gtk/JSCore.gir.in 953 WebKit/gtk/org.webkitgtk-${WEBKITGTK_API_VERSION}.gschema.xml:WebKit/gtk/org.webkitgtk.gschema.xml.in 954 ] 938 955 ,[WEBKITGTK_API_VERSION=$WEBKITGTK_API_VERSION,WEBKITGTK_PC_NAME=$WEBKITGTK_PC_NAME] 939 956 )
Note: See TracChangeset
for help on using the changeset viewer.