diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-10-31 01:39:53 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-10-31 01:43:33 (EDT) |
commit | 73759d75da834dada7b4748cdccd85a81d9fc495 (patch) | |
tree | fcf9c3d5233ee0ac1508f5ac963609c815922077 /src | |
parent | 8ac815b63975db5ea2b06550833de55d0297ee14 (diff) | |
download | marquee-73759d75da834dada7b4748cdccd85a81d9fc495.zip marquee-73759d75da834dada7b4748cdccd85a81d9fc495.tar.gz marquee-73759d75da834dada7b4748cdccd85a81d9fc495.tar.bz2 |
mq_web_view_view_source_scheme_methods.initialize(): Use hash table and get origin URI from URI
Trading MqApplication's registered tabs hash table for a query
parameters hash table.
Diffstat (limited to 'src')
-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 |