diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-10-30 15:09:32 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-10-30 15:09:32 (EDT) |
commit | 6a4fb1c24d8bdb2c17ddb153c95f899f6bb339c4 (patch) | |
tree | 81f803de2c7be65223ba7bc155d1ea01b06cb16d | |
parent | 05e294808c5c50bff54a512ea5d96ac34ec84991 (diff) | |
download | marquee-6a4fb1c24d8bdb2c17ddb153c95f899f6bb339c4.zip marquee-6a4fb1c24d8bdb2c17ddb153c95f899f6bb339c4.tar.gz marquee-6a4fb1c24d8bdb2c17ddb153c95f899f6bb339c4.tar.bz2 |
mq_web_view_*_scheme_methods->initialize(): New methods
-rw-r--r-- | src/web-view-schemes/normal.c | 7 | ||||
-rw-r--r-- | src/web-view-schemes/schemes.h | 1 | ||||
-rw-r--r-- | src/web-view-schemes/view-source.c | 21 |
3 files changed, 21 insertions, 8 deletions
diff --git a/src/web-view-schemes/normal.c b/src/web-view-schemes/normal.c index 9b64b5d..5641a9c 100644 --- a/src/web-view-schemes/normal.c +++ b/src/web-view-schemes/normal.c @@ -41,6 +41,12 @@ match_uri(const gchar *uri) } static void +initialize(MqWebView G_GNUC_UNUSED *web_view, + MqWebViewScheme G_GNUC_UNUSED *scheme, const gchar G_GNUC_UNUSED *uri) +{ +} + +static void finalize(MqWebViewScheme *scheme) { memset(&scheme->normal, 0, sizeof(scheme->normal)); @@ -779,6 +785,7 @@ save_file(MqWebView *web_view, MqWebViewScheme *scheme) MqWebViewSchemeMethods mq_web_view_normal_scheme_methods = { .match_uri = match_uri, + .initialize = initialize, .finalize = finalize, .rewrite_uri = rewrite_uri, .display_uri = display_uri, diff --git a/src/web-view-schemes/schemes.h b/src/web-view-schemes/schemes.h index 555f30b..e6f82d4 100644 --- a/src/web-view-schemes/schemes.h +++ b/src/web-view-schemes/schemes.h @@ -50,6 +50,7 @@ union _MqWebViewScheme { typedef struct { gboolean (*match_uri) (const gchar *uri); + void (*initialize) (MqWebView *, MqWebViewScheme *, const gchar *); void (*finalize) (MqWebViewScheme *); gchar * (*rewrite_uri) (MqWebView *, MqWebViewScheme *, const gchar *); gchar * (*display_uri) (MqWebView *, MqWebViewScheme *, const gchar *); diff --git a/src/web-view-schemes/view-source.c b/src/web-view-schemes/view-source.c index 7ed062d..a654e5d 100644 --- a/src/web-view-schemes/view-source.c +++ b/src/web-view-schemes/view-source.c @@ -40,13 +40,7 @@ match_uri(const gchar *uri) } static void -finalize(MqWebViewScheme *scheme) -{ - memset(&scheme->view_source, 0, sizeof(scheme->view_source)); -} - -static gchar * -rewrite_uri(MqWebView *web_view, MqWebViewScheme *scheme, const gchar *uri) +initialize(MqWebView *web_view, MqWebViewScheme *scheme, const gchar *uri) { MqTabPage *origin_tab; @@ -65,8 +59,18 @@ rewrite_uri(MqWebView *web_view, MqWebViewScheme *scheme, const gchar *uri) scheme->view_source.uri = mq_web_view_get_uri( mq_tab_page_get_web_view(origin_tab)); /* TODO: Get data. */ +} + +static void +finalize(MqWebViewScheme *scheme) +{ + memset(&scheme->view_source, 0, sizeof(scheme->view_source)); +} - /* Rewrite URI. */ +static gchar * +rewrite_uri(MqWebView *web_view, MqWebViewScheme G_GNUC_UNUSED *scheme, + const gchar G_GNUC_UNUSED *uri) +{ return g_strdup_printf("view-source:view-tab=%" PRId64, mq_tab_page_get_id(mq_web_view_get_tab_page(web_view))); } @@ -221,6 +225,7 @@ save_file(MqWebView *web_view, MqWebViewScheme *scheme) MqWebViewSchemeMethods mq_web_view_view_source_scheme_methods = { .match_uri = match_uri, + .initialize = initialize, .finalize = finalize, .rewrite_uri = rewrite_uri, .display_uri = display_uri, |