[Xfce4-commits] <midori:master> Include main resource and fix target checks

Christian Dywan noreply at xfce.org
Mon Oct 29 10:46:02 CET 2012


Updating branch refs/heads/master
         to 4c83c3947ead7df9394d040a83ac1c2b8625f62a (commit)
       from f7b4119d85c96a0ab19ea0c4dd822fd4f49018dd (commit)

commit 4c83c3947ead7df9394d040a83ac1c2b8625f62a
Author: Christian Dywan <christian at twotoasts.de>
Date:   Mon Oct 29 10:12:02 2012 +0100

    Include main resource and fix target checks
    
    Fixes: https://bugs.launchpad.net/midori/+bug/1072412

 midori/midori-browser.c |    2 +-
 midori/midori-view.c    |   12 ++++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index b7bddc5..b90c699 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -1039,7 +1039,7 @@ midori_browser_save_uri (MidoriBrowser* browser,
     GtkWidget* dialog;
     const gchar* title = midori_view_get_display_title (view);
     gchar* filename;
-    GList* resources = midori_view_get_subresources (view);
+    GList* resources = midori_view_get_resources (view);
     gboolean file_only = TRUE;
     GtkWidget* checkbox = NULL;
 
diff --git a/midori/midori-view.c b/midori/midori-view.c
index 37cc78f..a2bda09 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -1993,21 +1993,22 @@ midori_web_view_menu_image_new_tab_activate_cb (GtkWidget*  widget,
 }
 
 GList*
-midori_view_get_subresources (MidoriView* view)
+midori_view_get_resources (MidoriView* view)
 {
     WebKitWebView* web_view = WEBKIT_WEB_VIEW (view->web_view);
     WebKitWebFrame* frame = webkit_web_view_get_main_frame (web_view);
     WebKitWebDataSource* data_source = webkit_web_frame_get_data_source (frame);
-    return webkit_web_data_source_get_subresources (data_source);
+    GList* resources = webkit_web_data_source_get_subresources (data_source);
+    return g_list_prepend (resources, webkit_web_data_source_get_main_resource (data_source));
 }
 
 static GString*
 midori_view_get_data_for_uri (MidoriView*  view,
                               const gchar* uri)
 {
-    GList* resources = midori_view_get_subresources (view);
+    GList* resources = midori_view_get_resources (view);
     GList* list;
-    GString* result;
+    GString* result = NULL;
 
     for (list = resources; list; list = g_list_next (list))
     {
@@ -2032,7 +2033,9 @@ midori_view_clipboard_get_image_cb (GtkClipboard*     clipboard,
     MidoriView* view = MIDORI_VIEW (g_object_get_data (user_data, "view"));
     WebKitHitTestResult* hit_test = user_data;
     gchar* uri = katze_object_get_string (hit_test, "image-uri");
+    GdkAtom target = gtk_selection_data_get_target (selection_data);
     /* if (gtk_selection_data_targets_include_image (selection_data, TRUE)) */
+    if (gtk_targets_include_image (&target, 1, TRUE))
     {
         GString* data = midori_view_get_data_for_uri (view, uri);
         if (data != NULL)
@@ -2053,6 +2056,7 @@ midori_view_clipboard_get_image_cb (GtkClipboard*     clipboard,
             g_warn_if_reached ();
     }
     /* if (gtk_selection_data_targets_include_text (selection_data)) */
+    if (gtk_targets_include_text (&target, 1))
         gtk_selection_data_set_text (selection_data, uri, -1);
     g_free (uri);
 }


More information about the Xfce4-commits mailing list