From 08d1d04c64f852b15b07626b8614a60999580828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Rameau?= Date: Wed, 13 Sep 2006 21:11:34 +0000 Subject: Clicking favicon in the location bar selects URL. Fix bug #349557. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2006-09-13 Jean-François Rameau * lib/widgets/ephy-location-entry.c: (ephy_location_entry_construct_contents), (icon_button_press_event_cb): Clicking favicon in the location bar selects URL. Fix bug #349557. --- lib/widgets/ephy-location-entry.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'lib/widgets') diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c index 6ccf8453b..963e4938d 100644 --- a/lib/widgets/ephy-location-entry.c +++ b/lib/widgets/ephy-location-entry.c @@ -831,6 +831,33 @@ favicon_drag_data_get_cb (GtkWidget *widget, time, entry, each_url_get_data_binder); } +static gboolean +icon_button_press_event_cb (GtkWidget *ebox, + GdkEventButton *event, + EphyLocationEntry *entry) +{ + guint state = event->state & gtk_accelerator_get_default_mod_mask (); + + if (event->type == GDK_BUTTON_PRESS && + event->button == 1 && + state == 0 /* left */) + { + GtkWidget *toplevel; + EphyLocationEntryPrivate *priv = entry->priv; + + toplevel = gtk_widget_get_toplevel (GTK_WIDGET (entry)); + gtk_window_set_focus (GTK_WINDOW(toplevel), + priv->icon_entry->entry); + + gtk_editable_select_region (GTK_EDITABLE (priv->icon_entry->entry), + 0, -1); + + return TRUE; + } + + return FALSE; +} + static gboolean lock_button_press_event_cb (GtkWidget *ebox, GdkEventButton *event, @@ -871,6 +898,8 @@ ephy_location_entry_construct_contents (EphyLocationEntry *entry) gtk_drag_source_set (priv->icon_ebox, GDK_BUTTON1_MASK, url_drag_types, G_N_ELEMENTS (url_drag_types), GDK_ACTION_ASK | GDK_ACTION_COPY | GDK_ACTION_LINK); + g_signal_connect (priv->icon_ebox, "button-press-event", + G_CALLBACK (icon_button_press_event_cb), entry); gtk_tooltips_set_tip (priv->tips, priv->icon_ebox, _("Drag and drop this icon to create a link to this page"), NULL); -- cgit v1.2.3