From 5aee0deca12e14554ce0fa0d4b02613e99ba77a9 Mon Sep 17 00:00:00 2001 From: Diego Escalante Urrelo Date: Wed, 2 Dec 2009 17:01:24 -0500 Subject: Remove redundant parameters in location-set API EphyLocationEntry, EphyLocationAction and EphyToolbar take an @adress and @typed_address parameter, while both are useful we only end up using one so we can easily decide which one to use in ephy-window.c instead of carrying both around until ephy-location-entry.c Bonus: make ephy_location_entry_set_location accept NULL as @address safely. Bug #603651 --- lib/widgets/ephy-location-entry.c | 22 +++++++--------------- lib/widgets/ephy-location-entry.h | 3 +-- 2 files changed, 8 insertions(+), 17 deletions(-) (limited to 'lib') diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c index 009d5f89f..217aa80e2 100644 --- a/lib/widgets/ephy-location-entry.c +++ b/lib/widgets/ephy-location-entry.c @@ -561,7 +561,7 @@ match_selected_cb (GtkEntryCompletion *completion, priv->needs_reset = (state == GDK_CONTROL_MASK || state == (GDK_CONTROL_MASK | GDK_SHIFT_MASK)); - ephy_location_entry_set_location (entry, item, NULL); + ephy_location_entry_set_location (entry, item); //gtk_im_context_reset (GTK_ENTRY (entry->priv->entry)->im_context); g_signal_emit_by_name (priv->entry, "activate"); @@ -1304,15 +1304,13 @@ ephy_location_entry_set_completion (EphyLocationEntry *entry, /** * ephy_location_entry_set_location: * @entry: an #EphyLocationEntry widget - * @address: current location address - * @typed_address: address shown in the location entry + * @address: new location address * - * Sets the current address of @entry to @address or @typed_address if given. + * Sets the current address of @entry to @address. **/ void ephy_location_entry_set_location (EphyLocationEntry *entry, - const char *address, - const char *typed_address) + const char *address) { EphyLocationEntryPrivate *priv = entry->priv; GtkClipboard *clipboard; @@ -1320,8 +1318,6 @@ ephy_location_entry_set_location (EphyLocationEntry *entry, char* selection = NULL; int start, end; - g_return_if_fail (address != NULL); - /* Setting a new text will clear the clipboard. This makes it impossible * to copy&paste from the location entry of one tab into another tab, see * bug #155824. So we save the selection iff the clipboard was owned by @@ -1342,11 +1338,7 @@ ephy_location_entry_set_location (EphyLocationEntry *entry, } } - if (typed_address != NULL) - { - text = typed_address; - } - else if (address != NULL && strcmp (address, "about:blank") != 0) + if (address != NULL && strcmp (address, "about:blank") != 0) { text = address; } @@ -1356,7 +1348,7 @@ ephy_location_entry_set_location (EphyLocationEntry *entry, } /* First record the new hash, then update the entry text */ - priv->hash = g_str_hash (address); + priv->hash = g_str_hash (text); priv->block_update = TRUE; gtk_entry_set_text (GTK_ENTRY (priv->entry), text); @@ -1452,7 +1444,7 @@ ephy_location_entry_reset_internal (EphyLocationEntry *entry, retval = g_str_hash (text) != g_str_hash (old_text); - ephy_location_entry_set_location (entry, text, NULL); + ephy_location_entry_set_location (entry, text); g_free (url); if (notify) diff --git a/lib/widgets/ephy-location-entry.h b/lib/widgets/ephy-location-entry.h index 708510dcf..2bb0d46c0 100644 --- a/lib/widgets/ephy-location-entry.h +++ b/lib/widgets/ephy-location-entry.h @@ -76,8 +76,7 @@ void ephy_location_entry_set_completion (EphyLocationEntry *entry, guint favicon_col); void ephy_location_entry_set_location (EphyLocationEntry *entry, - const char *address, - const char *typed_address); + const char *address); void ephy_location_entry_set_match_func (EphyLocationEntry *entry, GtkEntryCompletionMatchFunc match_func, -- cgit