[epiphany/tgt: 4/10] Set title and address in document downloads



commit 3cc919b281e65e54ab95c8626ebb132ba90b7f9d
Author: Javier M. Mellid <jmunhoz igalia com>
Date:   Tue Jul 23 16:00:45 2013 +0200

    Set title and address in document downloads
    
    https://bugzilla.gnome.org/show_bug.cgi?id=689992

 embed/ephy-embed.c    |   10 ++++++++++
 embed/ephy-web-view.c |    4 ++--
 embed/ephy-web-view.h |    5 +++++
 3 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index cb1b6d4..39529cb 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -657,7 +657,12 @@ static void
 document_download_finished_cb (WebKitDownload *download,
                                EphyEmbed *embed)
 {
+ EphyWebView *view = EPHY_WEB_VIEW (embed->priv->web_view);
+ WebKitURIRequest *request = webkit_download_get_request (download);
+ const char *uri = webkit_uri_request_get_uri (request);
  const char *document_uri = webkit_download_get_destination (download);
+ gchar *basename;
+
  if (!embed->priv->document_view) {
     embed->priv->document_view = ephy_document_view_new ();
     gtk_box_pack_start (GTK_BOX (embed),
@@ -668,6 +673,11 @@ document_download_finished_cb (WebKitDownload *download,
 
   ephy_document_view_load_uri (EPHY_DOCUMENT_VIEW (embed->priv->document_view),
                                document_uri);
+
+  basename = g_path_get_basename (uri);
+  ephy_web_view_set_title (view, basename);
+  g_free (basename);
+  ephy_web_view_set_address (view, uri);
 }
 
 void
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index abc6f4d..7396756 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -1140,7 +1140,7 @@ _ephy_web_view_set_is_blank (EphyWebView *view,
   }
 }
 
-static void
+void
 ephy_web_view_set_title (EphyWebView *view,
                          const char *view_title)
 {
@@ -1200,7 +1200,7 @@ title_changed_cb (WebKitWebView *web_view,
  * Sets the view location to be address. Note that this function might
  * also set the typed-address property to NULL.
  */
-static void
+void
 ephy_web_view_set_address (EphyWebView *view,
                            const char *address)
 {
diff --git a/embed/ephy-web-view.h b/embed/ephy-web-view.h
index d3044bf..b94c099 100644
--- a/embed/ephy-web-view.h
+++ b/embed/ephy-web-view.h
@@ -164,6 +164,11 @@ const char *               ephy_web_view_get_title                (EphyWebView
 const char *               ephy_web_view_get_address              (EphyWebView               *view);
 const char *               ephy_web_view_get_title_composite      (EphyWebView               *view);
 
+void                       ephy_web_view_set_title                (EphyWebView               *view,
+                                                                   const char                *view_title);
+void                       ephy_web_view_set_address              (EphyWebView               *view,
+                                                                   const char                *address);
+
 void                       ephy_web_view_set_placeholder          (EphyWebView               *view,
                                                                    const char                *uri,
                                                                    const char                *title);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]