[epiphany] location-entry: Fix URI normalization on cut and copy



commit ec49bf2ae4cfeb3b547c0bed81457e27ddb47d40
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Tue Aug 21 22:15:59 2018 -0500

    location-entry: Fix URI normalization on cut and copy
    
    This broke when the EphyLocationEntry was changed to inherit from
    GtkOverlay and contain a packed GtkEntry rather than inheriting from
    GtkEntry. Still not overly fond of that change.
    
    Anyway, we just need to stop the default handler from running.
    
    For copy, it's sufficient to use g_signal_connect_after(). That doesn't
    work for cut. Not sure why. Anyway, g_signal_stop_emission_by_name()
    works in both cases, so let's use that instead.
    
    Fixes #513

 lib/widgets/ephy-location-entry.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index 5eaacbb2c..487b5edf6 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -331,8 +331,7 @@ ephy_location_entry_get_preferred_height (GtkWidget *widget,
 }
 
 static void
-ephy_location_entry_copy_clipboard (GtkEntry *entry,
-                                    gpointer  user_data)
+ephy_location_entry_do_copy_clipboard (GtkEntry *entry)
 {
   char *text;
   gint start;
@@ -355,6 +354,15 @@ ephy_location_entry_copy_clipboard (GtkEntry *entry,
   g_free (text);
 }
 
+static void
+ephy_location_entry_copy_clipboard (GtkEntry *entry,
+                                    gpointer  user_data)
+{
+  ephy_location_entry_do_copy_clipboard (entry);
+
+  g_signal_stop_emission_by_name (entry, "copy-clipboard");
+}
+
 static void
 ephy_location_entry_cut_clipboard (GtkEntry *entry)
 {
@@ -363,8 +371,10 @@ ephy_location_entry_cut_clipboard (GtkEntry *entry)
     return;
   }
 
-  ephy_location_entry_copy_clipboard (entry, NULL);
+  ephy_location_entry_do_copy_clipboard (entry);
   gtk_editable_delete_selection (GTK_EDITABLE (entry));
+
+  g_signal_stop_emission_by_name (entry, "cut-clipboard");
 }
 
 static void


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