Commit fe037418 authored by Michael Catanzaro's avatar Michael Catanzaro

embed: Replace a boolean parameter with an enum

parent dda2a997
......@@ -842,17 +842,19 @@ ephy_embed_get_find_toolbar (EphyEmbed *embed)
* ephy_embed_add_top_widget:
* @embed: an #EphyEmbed
* @widget: a #GtkWidget
* @destroy_on_transition: whether the widget be automatically
* @policy: whether the widget be automatically
* destroyed on page transitions
*
* Adds a #GtkWidget to the top of the embed.
*/
void
ephy_embed_add_top_widget (EphyEmbed *embed, GtkWidget *widget, gboolean destroy_on_transition)
ephy_embed_add_top_widget (EphyEmbed *embed,
GtkWidget *widget,
EphyEmbedTopWidgetPolicy policy)
{
GSList *list;
if (destroy_on_transition) {
if (policy == EPHY_EMBED_TOP_WIDGET_POLICY_DESTROY_ON_TRANSITION) {
list = embed->destroy_on_transition_list;
list = g_slist_prepend (list, widget);
embed->destroy_on_transition_list = list;
......
......@@ -32,11 +32,16 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (EphyEmbed, ephy_embed, EPHY, EMBED, GtkBox)
typedef enum {
EPHY_EMBED_TOP_WIDGET_POLICY_RETAIN_ON_TRANSITION,
EPHY_EMBED_TOP_WIDGET_POLICY_DESTROY_ON_TRANSITION
} EphyEmbedTopWidgetPolicy;
EphyWebView* ephy_embed_get_web_view (EphyEmbed *embed);
EphyFindToolbar* ephy_embed_get_find_toolbar (EphyEmbed *embed);
void ephy_embed_add_top_widget (EphyEmbed *embed,
GtkWidget *widget,
gboolean destroy_on_transition);
void ephy_embed_add_top_widget (EphyEmbed *embed,
GtkWidget *widget,
EphyEmbedTopWidgetPolicy policy);
void ephy_embed_remove_top_widget (EphyEmbed *embed,
GtkWidget *widget);
void ephy_embed_entering_fullscreen (EphyEmbed *embed);
......
......@@ -550,7 +550,8 @@ ephy_web_view_create_form_auth_save_confirmation_info_bar (EphyWebView *web_view
track_info_bar (info_bar, &web_view->password_info_bar);
ephy_embed_add_top_widget (EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (web_view),
info_bar, FALSE);
info_bar,
EPHY_EMBED_TOP_WIDGET_POLICY_RETAIN_ON_TRANSITION);
return info_bar;
}
......@@ -800,7 +801,8 @@ sensitive_form_focused_cb (EphyEmbedShell *shell,
track_info_bar (info_bar, &web_view->sensitive_form_info_bar);
ephy_embed_add_top_widget (EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (web_view),
info_bar, TRUE);
info_bar,
EPHY_EMBED_TOP_WIDGET_POLICY_DESTROY_ON_TRANSITION);
gtk_widget_show (info_bar);
}
......@@ -1464,7 +1466,8 @@ show_permission_request_info_bar (WebKitWebView *web_view,
}
ephy_embed_add_top_widget (EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (web_view),
info_bar, TRUE);
info_bar,
EPHY_EMBED_TOP_WIDGET_POLICY_DESTROY_ON_TRANSITION);
}
static gboolean
......@@ -3092,7 +3095,7 @@ ephy_web_view_print_failed (EphyWebView *view, GError *error)
g_signal_connect (info_bar, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
ephy_embed_add_top_widget (embed, info_bar, FALSE);
ephy_embed_add_top_widget (embed, info_bar, EPHY_EMBED_TOP_WIDGET_POLICY_RETAIN_ON_TRANSITION);
gtk_widget_show_all (info_bar);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment