diff options
Diffstat (limited to 'src/web-view-schemes')
-rw-r--r-- | src/web-view-schemes/view-source.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/web-view-schemes/view-source.c b/src/web-view-schemes/view-source.c index d2f9f7e..40fc496 100644 --- a/src/web-view-schemes/view-source.c +++ b/src/web-view-schemes/view-source.c @@ -42,23 +42,18 @@ match_uri(const gchar *uri) static void initialize(MqWebView *web_view, MqWebViewScheme *scheme, const gchar *uri) { - MqTabPage *origin_tab; + gchar *query_str; + GHashTable *query; - /* TODO: Handle "view-source:URI" URIs. */ - g_assert(g_str_has_prefix(uri, "view-source:origin-tab=")); + query_str = g_strdup(uri + strlen("view-source:")); + query = parse_query_string(query_str); - /* Parse origin tab ID out of URI. */ - uri += strlen("view-source:origin-tab="); - scheme->view_source.origin_tab_id = atoi64(uri); + scheme->view_source.origin_tab_id = atoi64(g_hash_table_lookup(query, + "origin-tab")); + scheme->view_source.uri = g_strdup(g_hash_table_lookup(query, "uri")); - /* Look up origin tab. */ - origin_tab = mq_application_get_tab(mq_tab_page_get_application( - mq_web_view_get_tab_page(web_view)), - scheme->view_source.origin_tab_id); - - /* Get origin tab's URI. */ - scheme->view_source.uri = mq_web_view_get_uri( - mq_tab_page_get_web_view(origin_tab)); + g_hash_table_unref(query); + g_free(query_str); } static void |