static void sendIncompleteRequest(InspectorServerTest* test, gconstpointer) { GOwnPtr<GError> error; // Connect to the inspector server. GRefPtr<GSocketClient> client = adoptGRef(g_socket_client_new()); GRefPtr<GSocketConnection> connection = adoptGRef(g_socket_client_connect_to_host(client.get(), "127.0.0.1", 2999, 0, &error.outPtr())); g_assert_no_error(error.get()); // Send incomplete request (missing blank line after headers) and check if inspector server // replies. The server should not reply to an incomplete request and the test should timeout // on read. GOutputStream* ostream = g_io_stream_get_output_stream(G_IO_STREAM(connection.get())); // Request missing blank line after headers. const gchar* incompleteRequest = "GET /devtools/page/1 HTTP/1.1\r\nHost: Localhost\r\n"; g_output_stream_write(ostream, incompleteRequest, strlen(incompleteRequest), 0, &error.outPtr()); g_assert_no_error(error.get()); GInputStream* istream = g_io_stream_get_input_stream(G_IO_STREAM(connection.get())); char response[16]; memset(response, 0, sizeof(response)); GRefPtr<GCancellable> cancel = adoptGRef(g_cancellable_new()); g_input_stream_read_async(istream, response, sizeof(response) - 1, G_PRIORITY_DEFAULT, cancel.get(), 0, 0); // Give a chance for the server to reply. test->wait(1); g_cancellable_cancel(cancel.get()); // If we got any answer it means the server replied to an incomplete request, lets fail. g_assert(response[0] == '\0'); }
void GeolocationClient::startUpdating() { ASSERT(!m_geoclueClient); GRefPtr<GeoclueMaster> master = adoptGRef(geoclue_master_get_default()); GRefPtr<GeoclueMasterClient> client = adoptGRef(geoclue_master_create_client(master.get(), 0, 0)); if (!client) { errorOccured(_("Could not connect to location provider.")); return; } GOwnPtr<GError> error; GeoclueAccuracyLevel accuracyLevel = m_enableHighAccuracy ? GEOCLUE_ACCURACY_LEVEL_DETAILED : GEOCLUE_ACCURACY_LEVEL_LOCALITY; if (!geoclue_master_client_set_requirements(client.get(), accuracyLevel, 0, false, GEOCLUE_RESOURCE_ALL, &error.outPtr())) { errorOccured(error->message); return; } m_geocluePosition = adoptGRef(geoclue_master_client_create_position(client.get(), &error.outPtr())); if (!m_geocluePosition) { errorOccured(error->message); return; } m_geoclueClient = client; geoclue_position_get_position_async(m_geocluePosition.get(), reinterpret_cast<GeocluePositionCallback>(getPositionCallback), this); g_signal_connect(G_OBJECT(m_geocluePosition.get()), "position-changed", G_CALLBACK(positionChangedCallback), this); m_isUpdating = true; }
static gboolean webkit_download_open_stream_for_uri(WebKitDownload* download, const gchar* uri, gboolean append=FALSE) { g_return_val_if_fail(uri, FALSE); WebKitDownloadPrivate* priv = download->priv; GRefPtr<GFile> file = adoptGRef(g_file_new_for_uri(uri)); GOwnPtr<GError> error; if (append) priv->outputStream = g_file_append_to(file.get(), G_FILE_CREATE_NONE, NULL, &error.outPtr()); else priv->outputStream = g_file_replace(file.get(), NULL, TRUE, G_FILE_CREATE_NONE, NULL, &error.outPtr()); if (error) { webkitDownloadEmitError(download, downloadDestinationError(core(priv->networkResponse), error->message)); return FALSE; } GRefPtr<GFileInfo> info = adoptGRef(g_file_info_new()); const char* uri_string = webkit_download_get_uri(download); g_file_info_set_attribute_string(info.get(), "metadata::download-uri", uri_string); g_file_info_set_attribute_string(info.get(), "xattr::xdg.origin.url", uri_string); g_file_set_attributes_async(file.get(), info.get(), G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, 0, 0, 0); return TRUE; }
static void canExecuteEditingCommandReadyCallback(GObject*, GAsyncResult* result, EditorTest* test) { GOwnPtr<GError> error; test->m_canExecuteEditingCommand = webkit_web_view_can_execute_editing_command_finish(test->m_webView, result, &error.outPtr()); g_assert(!error.get()); g_main_loop_quit(test->m_mainLoop); }
static void busAcquiredCallback(GDBusConnection* connection, const char* name, gpointer userData) { static GDBusNodeInfo* introspectionData = 0; if (!introspectionData) introspectionData = g_dbus_node_info_new_for_xml(introspectionXML, 0); GOwnPtr<GError> error; unsigned registrationID = g_dbus_connection_register_object( connection, "/org/webkit/gtk/WebExtensionTest", introspectionData->interfaces[0], &interfaceVirtualTable, g_object_ref(userData), static_cast<GDestroyNotify>(g_object_unref), &error.outPtr()); if (!registrationID) g_warning("Failed to register object: %s\n", error->message); g_object_set_data(G_OBJECT(userData), "dbus-connection", connection); while (delayedSignalsQueue.size()) { OwnPtr<DelayedSignal> delayedSignal = delayedSignalsQueue.takeFirst(); switch (delayedSignal->type) { case DocumentLoadedSignal: emitDocumentLoaded(connection); break; case URIChangedSignal: emitURIChanged(connection, delayedSignal->uri.data()); break; } } }
void WebViewTest::keyStroke(unsigned keyVal, unsigned keyModifiers) { g_assert(m_parentWindow); GtkWidget* viewWidget = GTK_WIDGET(m_webView); g_assert(gtk_widget_get_realized(viewWidget)); GOwnPtr<GdkEvent> event(gdk_event_new(GDK_KEY_PRESS)); event->key.keyval = keyVal; event->key.time = GDK_CURRENT_TIME; event->key.window = gtk_widget_get_window(viewWidget); g_object_ref(event->key.window); gdk_event_set_device(event.get(), gdk_device_manager_get_client_pointer(gdk_display_get_device_manager(gtk_widget_get_display(viewWidget)))); event->key.state = keyModifiers; // When synthesizing an event, an invalid hardware_keycode value can cause it to be badly processed by GTK+. GOwnPtr<GdkKeymapKey> keys; int keysCount; if (gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(), keyVal, &keys.outPtr(), &keysCount)) event->key.hardware_keycode = keys.get()[0].keycode; gtk_main_do_event(event.get()); event->key.type = GDK_KEY_RELEASE; gtk_main_do_event(event.get()); }
void RenderThemeGtk::systemFont(int, FontDescription& fontDescription) const { GtkSettings* settings = gtk_settings_get_default(); if (!settings) return; // This will be a font selection string like "Sans 10" so we cannot use it as the family name. GOwnPtr<gchar> fontName; g_object_get(settings, "gtk-font-name", &fontName.outPtr(), NULL); PangoFontDescription* pangoDescription = pango_font_description_from_string(fontName.get()); if (!pangoDescription) return; fontDescription.firstFamily().setFamily(pango_font_description_get_family(pangoDescription)); int size = pango_font_description_get_size(pangoDescription) / PANGO_SCALE; // If the size of the font is in points, we need to convert it to pixels. if (!pango_font_description_get_size_is_absolute(pangoDescription)) size = size * (getScreenDPI() / 72.0); fontDescription.setSpecifiedSize(size); fontDescription.setIsAbsoluteSize(true); fontDescription.setGenericFamily(FontDescription::NoFamily); fontDescription.setWeight(FontWeightNormal); fontDescription.setItalic(false); pango_font_description_free(pangoDescription); }
static void openRemoteDebuggingSession(InspectorServerTest* test, gconstpointer) { // To test the whole pipeline this exploits a behavior of the inspector front-end which won't provide the page address as title unless the // debugging session was established correctly through web socket. // In our case page URL should be http://127.0.0.1:2999/ // So this test case will fail if: // - The page list didn't return a valid inspector URL // - Or the front-end couldn't be loaded through the inspector HTTP server // - Or the web socket connection couldn't be established between the front-end and the page through the inspector server // Let's see if this test isn't raising too many false positives, in which case we should use a better predicate if available. test->showInWindowAndWaitUntilMapped(GTK_WINDOW_TOPLEVEL); g_assert(test->getPageList()); GOwnPtr<GError> error; WebKitJavascriptResult* javascriptResult = test->runJavaScriptAndWaitUntilFinished("pages[0].inspectorUrl;", &error.outPtr()); g_assert(javascriptResult); g_assert(!error.get()); String resolvedURL = String("http://127.0.0.1:2999/") + String::fromUTF8(WebViewTest::javascriptResultToCString(javascriptResult)); test->loadURI(resolvedURL.utf8().data()); test->waitUntilLoadFinished(); javascriptResult = test->runJavaScriptAndWaitUntilFinished("window.document.getElementsByTagName('li')[0].title", &error.outPtr()); g_assert(javascriptResult); g_assert(!error.get()); GOwnPtr<char> title(WebViewTest::javascriptResultToCString(javascriptResult)); g_assert_cmpstr(title.get(), ==, "http://127.0.0.1:2999/"); }
static PassRefPtr<SharedBuffer> loadResourceSharedBuffer(CString name) { GOwnPtr<gchar> content; gsize length; if (!g_file_get_contents(name.data(), &content.outPtr(), &length, 0)) return SharedBuffer::create(); return SharedBuffer::create(content.get(), length); }
static void onSnapshotReady(WebKitWebView* web_view, GAsyncResult* res, WebViewTest* test) { GOwnPtr<GError> error; test->m_surface = webkit_web_view_get_snapshot_finish(web_view, res, &error.outPtr()); g_assert(!test->m_surface || !error.get()); if (error) g_assert_error(error.get(), WEBKIT_SNAPSHOT_ERROR, WEBKIT_SNAPSHOT_ERROR_FAILED_TO_CREATE); test->quitMainLoop(); }
static bool webKitWebSrcStart(WebKitWebSrc* src) { WebKitWebSrcPrivate* priv = src->priv; if (!priv->uri) { GST_ERROR_OBJECT(src, "No URI provided"); return false; } KURL url = KURL(KURL(), priv->uri); ResourceRequest request(url); request.setTargetType(ResourceRequestBase::TargetIsMedia); request.setAllowCookies(true); NetworkingContext* context = 0; if (priv->frame) { Document* document = priv->frame->document(); if (document) request.setHTTPReferrer(document->documentURI()); FrameLoader* loader = priv->frame->loader(); if (loader) { loader->addExtraFieldsToSubresourceRequest(request); context = loader->networkingContext(); } } // Let Apple web servers know we want to access their nice movie trailers. if (!g_ascii_strcasecmp("movies.apple.com", url.host().utf8().data()) || !g_ascii_strcasecmp("trailers.apple.com", url.host().utf8().data())) request.setHTTPUserAgent("Quicktime/7.6.6"); if (priv->requestedOffset) { GOwnPtr<gchar> val; val.set(g_strdup_printf("bytes=%" G_GUINT64_FORMAT "-", priv->requestedOffset)); request.setHTTPHeaderField("Range", val.get()); } if (priv->iradioMode) request.setHTTPHeaderField("icy-metadata", "1"); // Needed to use DLNA streaming servers request.setHTTPHeaderField("transferMode.dlna", "Streaming"); priv->resourceHandle = ResourceHandle::create(context, request, priv->client, false, false); if (!priv->resourceHandle) { GST_ERROR_OBJECT(src, "Failed to create ResourceHandle"); return false; } GST_DEBUG_OBJECT(src, "Started request"); return true; }
PassOwnPtr<AudioBus> AudioBus::loadPlatformResource(const char* name, float sampleRate) { GOwnPtr<gchar> filename(g_strdup_printf("%s.wav", name)); const char* environmentPath = getenv("AUDIO_RESOURCES_PATH"); GOwnPtr<gchar> absoluteFilename; if (environmentPath) absoluteFilename.set(g_build_filename(environmentPath, filename.get(), NULL)); else absoluteFilename.set(g_build_filename(sharedResourcesPath().data(), "resources", "audio", filename.get(), NULL)); return createBusFromAudioFile(absoluteFilename.get(), false, sampleRate); }
static uint64_t getCacheDiskFreeSize(SoupCache* cache) { ASSERT(cache); GOwnPtr<char> cacheDir; g_object_get(G_OBJECT(cache), "cache-dir", &cacheDir.outPtr(), NULL); if (!cacheDir) return 0; return WebCore::getVolumeFreeSizeForPath(cacheDir.get()); }
static void readReadyCallback(GInputStream* stream, GAsyncResult* result, void* id) { // Always finish the read, even if this SocketStreamHandle was deactivated earlier. GOwnPtr<GError> error; gssize bytesRead = g_input_stream_read_finish(stream, result, &error.outPtr()); SocketStreamHandle* handle = getHandleFromId(id); if (!handle) return; handle->readBytes(bytesRead, error.get()); }
static bool isStyleSheetInjectedForURLAtPath(WebViewTest* test, const char* path) { test->loadURI(kServer->getURIForPath(path).data()); test->waitUntilLoadFinished(); GOwnPtr<GError> error; WebKitJavascriptResult* javascriptResult = test->runJavaScriptAndWaitUntilFinished(kStyleSheetTestScript, &error.outPtr()); g_assert(javascriptResult); g_assert(!error.get()); GOwnPtr<char> resultString(WebViewTest::javascriptResultToCString(javascriptResult)); return !g_strcmp0(resultString.get(), kStyleSheetTestScriptResult); }
bool initializeGStreamer() { #if GST_CHECK_VERSION(0, 10, 31) if (gst_is_initialized()) return true; #endif GOwnPtr<GError> error; // FIXME: We should probably pass the arguments from the command line. bool gstInitialized = gst_init_check(0, 0, &error.outPtr()); ASSERT_WITH_MESSAGE(gstInitialized, "GStreamer initialization failed: %s", error ? error->message : "unknown error occurred"); return gstInitialized; }
static void resourceGetDataCallback(GObject* object, GAsyncResult* result, gpointer userData) { size_t dataSize; GOwnPtr<GError> error; unsigned char* data = webkit_web_resource_get_data_finish(WEBKIT_WEB_RESOURCE(object), result, &dataSize, &error.outPtr()); g_assert(!error.get()); g_assert(data); g_assert_cmpint(dataSize, >, 0); ResourcesTest* test = static_cast<ResourcesTest*>(userData); test->m_resourceData.set(reinterpret_cast<char*>(data)); test->m_resourceDataSize = dataSize; g_main_loop_quit(test->m_mainLoop); }
static gchar* utf16ToUtf8(const UChar* aText, gint aLength, gint &length) { gboolean needCopy = FALSE; for (int i = 0; i < aLength; i++) { if (!aText[i] || IS_LOW_SURROGATE(aText[i])) { needCopy = TRUE; break; } if (IS_HIGH_SURROGATE(aText[i])) { if (i < aLength - 1 && IS_LOW_SURROGATE(aText[i+1])) i++; else { needCopy = TRUE; break; } } } GOwnPtr<UChar> copiedString; if (needCopy) { /* Pango doesn't correctly handle nuls. We convert them to 0xff. */ /* Also "validate" UTF-16 text to make sure conversion doesn't fail. */ copiedString.set(static_cast<UChar*>(g_memdup(aText, aLength * sizeof(aText[0])))); UChar* p = copiedString.get(); /* don't need to reset i */ for (int i = 0; i < aLength; i++) { if (!p[i] || IS_LOW_SURROGATE(p[i])) p[i] = 0xFFFD; else if (IS_HIGH_SURROGATE(p[i])) { if (i < aLength - 1 && IS_LOW_SURROGATE(aText[i+1])) i++; else p[i] = 0xFFFD; } } aText = p; } gchar* utf8Text; glong itemsWritten; utf8Text = g_utf16_to_utf8(reinterpret_cast<const gunichar2*>(aText), aLength, 0, &itemsWritten, 0); length = itemsWritten; return utf8Text; }
// // 1.) Initialize Geoclue with our requirements // 2.) Try to get a GeocluePosition // 3.) Update the Information and get the current position // // TODO: Also get GeoclueVelocity but there is no master client // API for that. // bool GeolocationServiceGtk::startUpdating(PositionOptions* options) { ASSERT(!m_geoclueClient); m_lastPosition = 0; m_lastError = 0; GOwnPtr<GError> error; GeoclueMaster* master = geoclue_master_get_default(); GeoclueMasterClient* client = geoclue_master_create_client(master, 0, 0); g_object_unref(master); if (!client) { setError(PositionError::POSITION_UNAVAILABLE, "Could not connect to location provider."); return false; } GeoclueAccuracyLevel accuracyLevel = GEOCLUE_ACCURACY_LEVEL_LOCALITY; int timeout = 0; if (options) { accuracyLevel = options->enableHighAccuracy() ? GEOCLUE_ACCURACY_LEVEL_DETAILED : GEOCLUE_ACCURACY_LEVEL_LOCALITY; if (options->hasTimeout()) timeout = options->timeout(); } gboolean result = geoclue_master_client_set_requirements(client, accuracyLevel, timeout, false, GEOCLUE_RESOURCE_ALL, &error.outPtr()); if (!result) { setError(PositionError::POSITION_UNAVAILABLE, error->message); g_object_unref(client); return false; } m_geocluePosition = geoclue_master_client_create_position(client, &error.outPtr()); if (!m_geocluePosition) { setError(PositionError::POSITION_UNAVAILABLE, error->message); g_object_unref(client); return false; } m_geoclueClient = client; geoclue_position_get_position_async(m_geocluePosition, (GeocluePositionCallback)getPositionCallback, this); g_signal_connect(G_OBJECT(m_geocluePosition), "position-changed", G_CALLBACK(position_changed), this); return true; }
static void connectedCallback(GSocketClient* client, GAsyncResult* result, void* id) { // Always finish the connection, even if this SocketStreamHandle was deactivated earlier. GOwnPtr<GError> error; GSocketConnection* socketConnection = g_socket_client_connect_to_host_finish(client, result, &error.outPtr()); // The SocketStreamHandle has been deactivated, so just close the connection, ignoring errors. SocketStreamHandle* handle = getHandleFromId(id); if (!handle) { g_io_stream_close(G_IO_STREAM(socketConnection), 0, &error.outPtr()); return; } handle->connected(socketConnection, error.get()); }
void mediaPlayerPrivateSourceChangedCallback(GObject *object, GParamSpec *pspec, gpointer data) { MediaPlayerPrivateGStreamer* mp = reinterpret_cast<MediaPlayerPrivateGStreamer*>(data); GOwnPtr<GstElement> element; g_object_get(mp->m_playBin, "source", &element.outPtr(), NULL); gst_object_replace((GstObject**) &mp->m_source, (GstObject*) element.get()); if (WEBKIT_IS_WEB_SRC(element.get())) { Frame* frame = mp->m_player->frameView() ? mp->m_player->frameView()->frame() : 0; if (frame) webKitWebSrcSetFrame(WEBKIT_WEB_SRC(element.get()), frame); } }
bool decode(ArgumentDecoder* decoder, GRefPtr<GtkPageSetup>& pageSetup) { GOwnPtr<GKeyFile> keyFile; if (!decodeGKeyFile(decoder, keyFile)) return false; pageSetup = adoptGRef(gtk_page_setup_new()); if (!keyFile) return true; if (!gtk_page_setup_load_key_file(pageSetup.get(), keyFile.get(), "Page Setup", 0)) pageSetup = 0; return pageSetup; }
bool decode(ArgumentDecoder* decoder, GRefPtr<GtkPrintSettings>& printSettings) { GOwnPtr<GKeyFile> keyFile; if (!decodeGKeyFile(decoder, keyFile)) return false; printSettings = adoptGRef(gtk_print_settings_new()); if (!keyFile) return true; if (!gtk_print_settings_load_key_file(printSettings.get(), keyFile.get(), "Print Settings", 0)) printSettings = 0; return printSettings; }
bool CharacterIterator::setText(const UChar* string, int length) { long utf8Size = 0; m_utf8.set(g_utf16_to_utf8(string, length, 0, &utf8Size, 0)); if (!utf8Size) return false; m_utf16Length = length; m_length = g_utf8_strlen(m_utf8.get(), utf8Size); m_size = utf8Size; m_index = 0; m_utf16Index = 0; return true; }
static void webkit_download_received_data(WebKitDownload* download, const gchar* data, int length) { WebKitDownloadPrivate* priv = download->priv; if (priv->currentSize == 0) webkit_download_set_status(download, WEBKIT_DOWNLOAD_STATUS_STARTED); ASSERT(priv->outputStream); gsize bytes_written; GOwnPtr<GError> error; g_output_stream_write_all(G_OUTPUT_STREAM(priv->outputStream), data, length, &bytes_written, NULL, &error.outPtr()); if (error) { webkitDownloadEmitError(download, downloadDestinationError(core(priv->networkResponse), error->message)); return; } priv->currentSize += length; g_object_notify(G_OBJECT(download), "current-size"); ASSERT(priv->networkResponse); if (priv->currentSize > webkit_download_get_total_size(download)) g_object_notify(G_OBJECT(download), "total-size"); // Throttle progress notification to not consume high amounts of // CPU on fast links, except when the last notification occured // in more then 0.7 secs from now, or the last notified progress // is passed in 1% or we reached the end. static gdouble lastProgress = 0; static gdouble lastElapsed = 0; gdouble currentElapsed = g_timer_elapsed(priv->timer, NULL); gdouble currentProgress = webkit_download_get_progress(download); if (lastElapsed && lastProgress && (currentElapsed - lastElapsed) < 0.7 && (currentProgress - lastProgress) < 0.01 && currentProgress < 1.0) { return; } lastElapsed = currentElapsed; lastProgress = currentProgress; g_object_notify(G_OBJECT(download), "progress"); }
void ProcessLauncher::launchProcess() { GPid pid = 0; int sockets[2]; if (socketpair(AF_UNIX, SOCK_DGRAM, 0, sockets) < 0) { g_printerr("Creation of socket failed: %s.\n", g_strerror(errno)); ASSERT_NOT_REACHED(); return; } GOwnPtr<gchar> binaryPath(g_build_filename(applicationDirectoryPath().data(), gWebKitWebProcessName, NULL)); GOwnPtr<gchar> socket(g_strdup_printf("%d", sockets[0])); char* argv[3]; argv[0] = binaryPath.get(); argv[1] = socket.get(); argv[2] = 0; GOwnPtr<GError> error; int spawnFlags = G_SPAWN_LEAVE_DESCRIPTORS_OPEN | G_SPAWN_DO_NOT_REAP_CHILD; if (!g_spawn_async(0, argv, 0, static_cast<GSpawnFlags>(spawnFlags), childSetupFunction, GINT_TO_POINTER(sockets[1]), &pid, &error.outPtr())) { g_printerr("Unable to fork a new WebProcess: %s.\n", error->message); ASSERT_NOT_REACHED(); } close(sockets[0]); m_processIdentifier = pid; // We've finished launching the process, message back to the main run loop. RunLoop::main()->scheduleWork(WorkItem::create(this, &ProcessLauncher::didFinishLaunchingProcess, m_processIdentifier, sockets[1])); }
void GeolocationClient::setEnableHighAccuracy(bool enable) { m_enableHighAccuracy = enable; // If we're already updating we should report the new requirements in order // to change to a more suitable provider if needed. If not, return. if (!m_isUpdating) return; GOwnPtr<GError> error; GeoclueAccuracyLevel accuracyLevel = m_enableHighAccuracy ? GEOCLUE_ACCURACY_LEVEL_DETAILED : GEOCLUE_ACCURACY_LEVEL_LOCALITY; if (!geoclue_master_client_set_requirements(m_geoclueClient.get(), accuracyLevel, 0, false, GEOCLUE_RESOURCE_ALL, &error.outPtr())) { errorOccured(error->message); stopUpdating(); } }
static bool decodeGKeyFile(ArgumentDecoder* decoder, GOwnPtr<GKeyFile>& keyFile) { DataReference dataReference; if (!decoder->decode(dataReference)) return false; if (!dataReference.size()) return true; keyFile.set(g_key_file_new()); if (!g_key_file_load_from_data(keyFile.get(), reinterpret_cast<const gchar*>(dataReference.data()), dataReference.size(), G_KEY_FILE_NONE, 0)) { keyFile.clear(); return false; } return true; }
static void busAcquiredCallback(GDBusConnection* connection, const char* name, gpointer userData) { static GDBusNodeInfo *introspectionData = 0; if (!introspectionData) introspectionData = g_dbus_node_info_new_for_xml(introspectionXML, 0); GOwnPtr<GError> error; unsigned registrationID = g_dbus_connection_register_object( connection, "/org/webkit/gtk/WebExtensionTest", introspectionData->interfaces[0], &interfaceVirtualTable, g_object_ref(userData), static_cast<GDestroyNotify>(g_object_unref), &error.outPtr()); if (!registrationID) g_warning("Failed to register object: %s\n", error->message); }
gboolean mediaPlayerPrivateErrorCallback(GstBus* bus, GstMessage* message, gpointer data) { if (GST_MESSAGE_TYPE(message) == GST_MESSAGE_ERROR) { GOwnPtr<GError> err; GOwnPtr<gchar> debug; gst_message_parse_error(message, &err.outPtr(), &debug.outPtr()); if (err->code == 3) { LOG_VERBOSE(Media, "File not found"); MediaPlayerPrivate* mp = reinterpret_cast<MediaPlayerPrivate*>(data); if (mp) mp->loadingFailed(); } else LOG_VERBOSE(Media, "Error: %d, %s", err->code, err->message); } return true; }