static PyObject * _wrap_gnc_html_webkit_show_data(PyObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "html", "data", "datalen", NULL }; PyGObject *html; char *data; int datalen; GncHtmlPrivate *priv_html; GncHtmlWebkitPrivate *priv; //fprintf(stderr,"webkit show data called 1\n"); if (!PyArg_ParseTupleAndKeywords(args, kwargs,"Osi:Gnc.HtmlWebkit.show_data", kwlist, &html, &data, &datalen)) return NULL; //fprintf(stderr,"webkit show data called 2\n"); // we now call the gnc-html class pointer //gnc_html_webkit_show_data(GNC_HTML_WEBKIT(html->obj), data, datalen); GncHtml* gself_html = GNC_HTML(html->obj); GncHtmlWebkit* gself = GNC_HTML_WEBKIT(html->obj); fprintf(stderr,"html self is %p\n",(void *)gself_html); fprintf(stderr,"html self is %d\n",GNC_IS_HTML(gself_html)); fprintf(stderr,"html self class is %p\n",(void *)GNC_HTML_GET_CLASS(gself_html)); fprintf(stderr,"html self show_data is %p\n",(void *)(GNC_HTML_GET_CLASS(gself_html)->show_data)); fprintf(stderr,"webkit self is %p\n",(void *)gself); fprintf(stderr,"webkit self is %d\n",GNC_IS_HTML(gself)); fprintf(stderr,"webkit self class is %p\n",(void *)GNC_HTML_WEBKIT_GET_CLASS(gself)); // so this does not exist - only the parent class GncHtml defines the show_data!! //fprintf(stderr,"webkit self show_data is %p\n",(void *)(GNC_HTML_WEBKIT_GET_CLASS(gself)->show_data)); // this appears to be the way we call should call it rather than // direct pointer call // great - inspection of code show this only displays stuff if priv->html_string is set // note that the dispose function frees this priv_html = GNC_HTML_GET_PRIVATE(gself_html); fprintf(stderr,"html self priv %p\n",(char *)&(gself_html->priv)); fprintf(stderr,"html self priv is %p\n",(void *)priv_html); priv = GNC_HTML_WEBKIT_GET_PRIVATE(gself); priv->html_string = g_strdup(data); fprintf(stderr,"html self html struct len %lx\n", sizeof(GncHtml)); fprintf(stderr,"html self htmlwebkitstruct len %lx\n", sizeof(GncHtmlWebkit)); fprintf(stderr,"webkit self priv %p\n",(char *)&(gself->priv)); fprintf(stderr,"webkit self priv offset %llx\n",((char *)((char *)&(gself->priv)-(char *)gself))); fprintf(stderr,"webkit self priv is %p\n",(void *)priv); fprintf(stderr,"webkit self priv html_string is %p\n",(void *)&(priv->html_string)); fprintf(stderr,"webkit self priv html_string offset %llx\n",((char *)&(priv->html_string)-(char *)priv)); gnc_html_show_data( GNC_HTML(gself), data, datalen ); Py_INCREF(Py_None); return Py_None; }
GtkWidget * gnc_html_get_widget( GncHtml* self ) { g_return_val_if_fail( self != NULL, NULL ); g_return_val_if_fail( GNC_IS_HTML(self), NULL ); return GNC_HTML_GET_PRIVATE(self)->container; }
gnc_html_history * gnc_html_get_history( GncHtml* self ) { g_return_val_if_fail( self != NULL, NULL ); g_return_val_if_fail( GNC_IS_HTML(self), NULL ); return GNC_HTML_GET_PRIVATE(self)->history; }
void gnc_html_set_urltype_cb( GncHtml* self, GncHTMLUrltypeCB urltype_cb ) { GncHtmlPrivate* priv; g_return_if_fail( self != NULL ); g_return_if_fail( GNC_IS_HTML(self) ); priv = GNC_HTML_GET_PRIVATE(self); priv->urltype_cb = urltype_cb; }
void gnc_html_set_flyover_cb( GncHtml* self, GncHTMLFlyoverCB flyover_cb, gpointer data ) { GncHtmlPrivate* priv; g_return_if_fail( self != NULL ); g_return_if_fail( GNC_IS_HTML(self) ); priv = GNC_HTML_GET_PRIVATE(self); priv->flyover_cb = flyover_cb; priv->flyover_cb_data = data; }
void gnc_html_set_button_cb( GncHtml* self, GncHTMLButtonCB button_cb, gpointer data ) { GncHtmlPrivate* priv; g_return_if_fail( self != NULL ); g_return_if_fail( GNC_IS_HTML(self) ); priv = GNC_HTML_GET_PRIVATE(self); priv->button_cb = button_cb; priv->button_cb_data = data; }
void gnc_html_set_load_cb( GncHtml* self, GncHTMLLoadCB load_cb, gpointer data ) { GncHtmlPrivate* priv; g_return_if_fail( self != NULL ); g_return_if_fail( GNC_IS_HTML(self) ); priv = GNC_HTML_GET_PRIVATE(self); priv->load_cb = load_cb; priv->load_cb_data = data; }
void gnc_html_destroy( GncHtml* self ) { g_return_if_fail( self != NULL ); g_return_if_fail( GNC_IS_HTML(self) ); if ( g_object_is_floating( G_OBJECT(self) ) ) { (void)g_object_ref_sink( G_OBJECT(self) ); } g_object_unref( G_OBJECT(self) ); }
void gnc_html_set_parent( GncHtml* self, GtkWindow* parent ) { g_return_if_fail( self != NULL ); g_return_if_fail( GNC_IS_HTML(self) ); if ( GNC_HTML_GET_CLASS(self)->set_parent != NULL ) { GNC_HTML_GET_CLASS(self)->set_parent( self, parent ); } else { DEBUG( "'set_parent' not implemented" ); } }
void gnc_html_print( GncHtml* self, const gchar* jobname, gboolean export_pdf ) { g_return_if_fail( self != NULL ); g_return_if_fail( GNC_IS_HTML(self) ); if ( GNC_HTML_GET_CLASS(self)->print != NULL ) { GNC_HTML_GET_CLASS(self)->print( self, jobname, export_pdf ); } else { DEBUG( "'print' not implemented" ); } }
void gnc_html_print( GncHtml* self ) { g_return_if_fail( self != NULL ); g_return_if_fail( GNC_IS_HTML(self) ); if ( GNC_HTML_GET_CLASS(self)->print != NULL ) { GNC_HTML_GET_CLASS(self)->print( self ); } else { DEBUG( "'print' not implemented" ); } }
void gnc_html_copy_to_clipboard( GncHtml* self ) { g_return_if_fail( self != NULL ); g_return_if_fail( GNC_IS_HTML(self) ); if ( GNC_HTML_GET_CLASS(self)->copy_to_clipboard != NULL ) { GNC_HTML_GET_CLASS(self)->copy_to_clipboard( self ); } else { DEBUG( "'copy_to_clipboard' not implemented" ); } }
void gnc_html_cancel( GncHtml* self ) { g_return_if_fail( self != NULL ); g_return_if_fail( GNC_IS_HTML(self) ); if ( GNC_HTML_GET_CLASS(self)->cancel != NULL ) { GNC_HTML_GET_CLASS(self)->cancel( self ); } else { DEBUG( "'cancel' not implemented" ); } }
void gnc_html_reload( GncHtml* self ) { g_return_if_fail( self != NULL ); g_return_if_fail( GNC_IS_HTML(self) ); if ( GNC_HTML_GET_CLASS(self)->reload != NULL ) { GNC_HTML_GET_CLASS(self)->reload( self ); } else { DEBUG( "'reload' not implemented" ); } }
void gnc_html_show_data( GncHtml* self, const gchar* data, int datalen ) { g_return_if_fail( self != NULL ); g_return_if_fail( GNC_IS_HTML(self) ); if ( GNC_HTML_GET_CLASS(self)->show_data != NULL ) { GNC_HTML_GET_CLASS(self)->show_data( self, data, datalen ); } else { DEBUG( "'show_data' not implemented" ); } }
gboolean gnc_html_export_to_file( GncHtml* self, const gchar* filepath ) { g_return_val_if_fail( self != NULL, FALSE ); g_return_val_if_fail( GNC_IS_HTML(self), FALSE ); if ( GNC_HTML_GET_CLASS(self)->export_to_file != NULL ) { return GNC_HTML_GET_CLASS(self)->export_to_file( self, filepath ); } else { DEBUG( "'export_to_file' not implemented" ); return FALSE; } }
void gnc_html_show_url( GncHtml* self, URLType type, const gchar* location, const gchar* label, gboolean new_window_hint ) { g_return_if_fail( self != NULL ); g_return_if_fail( GNC_IS_HTML(self) ); if ( GNC_HTML_GET_CLASS(self)->show_url != NULL ) { GNC_HTML_GET_CLASS(self)->show_url( self, type, location, label, new_window_hint ); } else { DEBUG( "'show_url' not implemented" ); } }
void gnc_html_show_url( GncHtml* self, URLType type, const gchar* location, const gchar* label, gboolean new_window_hint ) { URLType lc_type = NULL; g_return_if_fail( self != NULL ); g_return_if_fail( GNC_IS_HTML(self) ); lc_type = g_ascii_strdown (type, -1); if ( GNC_HTML_GET_CLASS(self)->show_url != NULL ) { GNC_HTML_GET_CLASS(self)->show_url( self, lc_type, location, label, new_window_hint ); } else { DEBUG( "'show_url' not implemented" ); } g_free (lc_type); }
URLType gnc_html_parse_url( GncHtml* self, const gchar* url, gchar** url_location, gchar** url_label ) { gchar uri_rexp[] = "^(([^:][^:]+):)?([^#]+)?(#(.*))?$"; regex_t compiled; regmatch_t match[6]; gchar* protocol = NULL; gchar* path = NULL; gchar* label = NULL; gboolean found_protocol = FALSE; gboolean found_path = FALSE; gboolean found_label = FALSE; URLType retval; GncHtmlPrivate* priv = GNC_HTML_GET_PRIVATE(self); g_return_val_if_fail( self != NULL, NULL ); g_return_val_if_fail( GNC_IS_HTML(self), NULL ); DEBUG( "parsing %s, base_location %s", url ? url : "(null)", self ? (priv->base_location ? priv->base_location : "(null base_location)") : "(null html)"); regcomp( &compiled, uri_rexp, REG_EXTENDED ); if ( !regexec( &compiled, url, 6, match, 0 ) ) { if ( match[2].rm_so != -1 ) { protocol = g_new0( gchar, match[2].rm_eo - match[2].rm_so + 1 ); strncpy( protocol, url + match[2].rm_so, match[2].rm_eo - match[2].rm_so ); protocol[match[2].rm_eo - match[2].rm_so] = 0; found_protocol = TRUE; } if ( match[3].rm_so != -1 ) { path = g_new0( gchar, match[3].rm_eo - match[3].rm_so + 1 ); strncpy( path, url + match[3].rm_so, match[3].rm_eo - match[3].rm_so ); path[match[3].rm_eo - match[3].rm_so] = 0; found_path = TRUE; } if ( match[5].rm_so != -1 ) { label = g_new0( gchar, match[5].rm_eo - match[5].rm_so + 1 ); strncpy( label, url + match[5].rm_so, match[5].rm_eo - match[5].rm_so ); label[match[5].rm_eo - match[5].rm_so] = 0; found_label = TRUE; } } regfree( &compiled ); if ( found_protocol ) { retval = g_hash_table_lookup( gnc_html_proto_to_type_hash, protocol ); if ( retval == NULL ) { PWARN( "unhandled URL type for '%s'", url ? url : "(null)" ); retval = URL_TYPE_OTHER; } } else if ( found_label && !found_path ) { retval = URL_TYPE_JUMP; } else { if ( self ) { retval = priv->base_type; } else { retval = URL_TYPE_FILE; } } g_free( protocol ); if ( !safe_strcmp( retval, URL_TYPE_FILE ) ) { if ( !found_protocol && path && self && priv->base_location ) { if ( g_path_is_absolute( path ) ) { *url_location = g_strdup( path ); } else { *url_location = g_build_filename( priv->base_location, path, (gchar*)NULL ); } g_free( path ); } else { *url_location = g_strdup( path ); g_free( path ); } } else if ( !safe_strcmp( retval, URL_TYPE_JUMP ) ) { *url_location = NULL; g_free( path ); } else { /* case URL_TYPE_OTHER: */ if ( !found_protocol && path && self && priv->base_location ) { if ( g_path_is_absolute( path ) ) { *url_location = g_build_filename( extract_machine_name( priv->base_location ), path, (gchar*)NULL ); } else { *url_location = g_build_filename( priv->base_location, path, (gchar*)NULL ); } g_free( path ); } else { *url_location = g_strdup( path ); g_free( path ); } } *url_label = label; return retval; }