diff options
author | Michael Catanzaro <mcatanzaro@gnome.org> | 2016-09-21 22:44:23 -0500 |
---|---|---|
committer | Michael Catanzaro <mcatanzaro@gnome.org> | 2016-09-21 23:58:41 -0500 |
commit | 0b1e5915d3c0ec456ed4baae99b8ed16c0c32d8a (patch) | |
tree | 0bec4f60b8425f8b4c2c2e8cc51aa5e99d2c3d92 /lib/widgets | |
parent | 2cb4d313bdca896f4f7f42eda73763921c6d97bc (diff) | |
download | epiphany-0b1e5915d3c0ec456ed4baae99b8ed16c0c32d8a.tar.gz |
Create only an EphyLocationEntry *or* an EphyTitleBox
Now that EphyTitleBox no longer switches back and forth between location
entry mode and title mode... instead of wastefully creating both an
EphyLocationEntry and an EphyTitleBox and only ever using one or the
other, only create the one that's needed: an EphyLocationEntry normally,
but an EphyTitleBox if we're in app mode.
This requires moving the lock-clicked signal of EphyLocationEntry and
EphyTitleBox up to the EphyTitleWidget interface, and adjusting them to
match (carry the GdkRectangle at which to position the
EphySecurityPopover).
Diffstat (limited to 'lib/widgets')
-rw-r--r-- | lib/widgets/ephy-location-entry.c | 20 | ||||
-rw-r--r-- | lib/widgets/ephy-title-box.c | 25 | ||||
-rw-r--r-- | lib/widgets/ephy-title-widget.c | 8 |
3 files changed, 12 insertions, 41 deletions
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c index 55fbcf70b..ed4123d40 100644 --- a/lib/widgets/ephy-location-entry.c +++ b/lib/widgets/ephy-location-entry.c @@ -117,7 +117,6 @@ enum { enum signalsEnum { USER_CHANGED, - LOCK_CLICKED, GET_LOCATION, GET_TITLE, LAST_SIGNAL @@ -461,21 +460,6 @@ ephy_location_entry_class_init (EphyLocationEntryClass *klass) G_TYPE_NONE); /** - * EphyLocationEntry::lock-clicked: - * @entry: the object on which the signal is emitted - * - * Emitted when the user clicks the security icon inside the - * #EphyLocationEntry. - * - */ - signals[LOCK_CLICKED] = g_signal_new ("lock-clicked", - EPHY_TYPE_LOCATION_ENTRY, - G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST, - 0, NULL, NULL, NULL, - G_TYPE_NONE, - 0); - - /** * EphyLocationEntry::get-location: * @entry: the object on which the signal is emitted * Returns: the current page address as a string @@ -1014,7 +998,9 @@ icon_button_press_event_cb (GtkWidget *entry, gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1); } else { - g_signal_emit (lentry, signals[LOCK_CLICKED], 0); + GdkRectangle lock_position; + gtk_entry_get_icon_area (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY, &lock_position); + g_signal_emit_by_name (entry, "lock-clicked", &lock_position); } return TRUE; diff --git a/lib/widgets/ephy-title-box.c b/lib/widgets/ephy-title-box.c index 96879a763..6bbf023b1 100644 --- a/lib/widgets/ephy-title-box.c +++ b/lib/widgets/ephy-title-box.c @@ -30,13 +30,6 @@ enum { LAST_PROP }; -enum { - LOCK_CLICKED, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL]; - struct _EphyTitleBox { GtkEventBox parent_instance; @@ -69,7 +62,7 @@ ephy_title_box_button_press_event (GtkWidget *widget, event->x < lock_allocation.x + lock_allocation.width && event->y >= lock_allocation.y && event->y < lock_allocation.y + lock_allocation.height) { - g_signal_emit (title_box, signals[LOCK_CLICKED], 0, (GdkRectangle *)&lock_allocation); + g_signal_emit_by_name (title_box, "lock-clicked", (GdkRectangle *)&lock_allocation); return GDK_EVENT_STOP; } @@ -248,22 +241,6 @@ ephy_title_box_class_init (EphyTitleBoxClass *klass) g_object_class_override_property (object_class, PROP_ADDRESS, "address"); g_object_class_override_property (object_class, PROP_SECURITY_LEVEL, "security-level"); - - /** - * EphyTitleBox::lock-clicked: - * @title_box: the object on which the signal is emitted - * @lock_position: the position of the lock icon - * - * Emitted when the user clicks the security icon inside the - * #EphyTitleBox. - */ - signals[LOCK_CLICKED] = g_signal_new ("lock-clicked", - EPHY_TYPE_TITLE_BOX, - G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST, - 0, NULL, NULL, NULL, - G_TYPE_NONE, - 1, - GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE); } static void diff --git a/lib/widgets/ephy-title-widget.c b/lib/widgets/ephy-title-widget.c index 6a33947bc..e83a188ab 100644 --- a/lib/widgets/ephy-title-widget.c +++ b/lib/widgets/ephy-title-widget.c @@ -39,6 +39,14 @@ ephy_title_widget_default_init (EphyTitleWidgetInterface *iface) EPHY_TYPE_SECURITY_LEVEL, EPHY_SECURITY_LEVEL_TO_BE_DETERMINED, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_signal_new ("lock-clicked", + EPHY_TYPE_TITLE_WIDGET, + G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST, + 0, NULL, NULL, NULL, + G_TYPE_NONE, + 1, + GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE); } const char * |