[epiphany] embed: Replace a boolean parameter with an enum
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] embed: Replace a boolean parameter with an enum
- Date: Sat, 4 Mar 2017 19:54:28 +0000 (UTC)
commit fe037418e6357b4a190610419b339c02be60ee11
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Sat Mar 4 13:53:33 2017 -0600
embed: Replace a boolean parameter with an enum
embed/ephy-embed.c | 8 +++++---
embed/ephy-embed.h | 11 ++++++++---
embed/ephy-web-view.c | 11 +++++++----
3 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index efe7c05..c77de68 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -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;
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index 58e4e8f..919a6d3 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -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);
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 5db3f3c..d4048a8 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]