aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <diegoe@igalia.com>2012-08-02 23:09:47 +0800
committerDiego Escalante Urrelo <diegoe@igalia.com>2012-08-03 16:52:13 +0800
commitf62663bb9495088717cac6aa8ca6ca46330773b3 (patch)
tree85f4fda6f63657fee01b8eadff9671edb71224dd
parentbfc43c1adad33c68f5b5aede0c67eb0eade102f4 (diff)
downloadgsoc2013-epiphany-f62663bb9495088717cac6aa8ca6ca46330773b3.tar
gsoc2013-epiphany-f62663bb9495088717cac6aa8ca6ca46330773b3.tar.gz
gsoc2013-epiphany-f62663bb9495088717cac6aa8ca6ca46330773b3.tar.bz2
gsoc2013-epiphany-f62663bb9495088717cac6aa8ca6ca46330773b3.tar.lz
gsoc2013-epiphany-f62663bb9495088717cac6aa8ca6ca46330773b3.tar.xz
gsoc2013-epiphany-f62663bb9495088717cac6aa8ca6ca46330773b3.tar.zst
gsoc2013-epiphany-f62663bb9495088717cac6aa8ca6ca46330773b3.zip
e-web-view: use GtkOrientable API for info bars
Instead of creating a custom GtkButtonBox, use GtkOrientable API implemented by the default action_area widget (a GtkBox) of GtkInfoBar. https://bugzilla.gnome.org/show_bug.cgi?id=681078
-rw-r--r--embed/ephy-web-view.c55
1 files changed, 10 insertions, 45 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 43dd2fae2..360f73d8b 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -709,26 +709,12 @@ store_password (GtkInfoBar *info_bar, gint response_id, gpointer data)
}
static void
-send_no_response_cb (GtkButton *button, GtkInfoBar *info_bar)
-{
- gtk_info_bar_response (info_bar, GTK_RESPONSE_NO);
-}
-
-static void
-send_yes_response_cb (GtkButton *button, GtkInfoBar *info_bar)
-{
- gtk_info_bar_response (info_bar, GTK_RESPONSE_YES);
-}
-
-static void
request_decision_on_storing (StorePasswordData *store_data)
{
EphyEmbed *embed = store_data->embed;
EphyWebView *web_view = ephy_embed_get_web_view (embed);
GtkWidget *info_bar;
GtkWidget *action_area;
- GtkWidget *button_box;
- GtkWidget *action_button;
GtkWidget *content_area;
GtkWidget *label;
char *message;
@@ -736,21 +722,13 @@ request_decision_on_storing (StorePasswordData *store_data)
LOG ("Going to show infobar about %s", store_data->uri);
- info_bar = gtk_info_bar_new ();
+ info_bar = gtk_info_bar_new_with_buttons (_("Not now"), GTK_RESPONSE_NO,
+ _("Store password"), GTK_RESPONSE_YES,
+ NULL);
action_area = gtk_info_bar_get_action_area (GTK_INFO_BAR (info_bar));
- button_box = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (action_area), button_box);
-
- action_button = gtk_button_new_with_mnemonic (_("_Not now"));
- g_signal_connect (action_button, "clicked",
- G_CALLBACK (send_no_response_cb), info_bar);
- gtk_box_pack_start (GTK_BOX (button_box), action_button, FALSE, FALSE, 0);
-
- action_button = gtk_button_new_with_mnemonic (_("_Store password"));
- g_signal_connect (action_button, "clicked",
- G_CALLBACK (send_yes_response_cb), info_bar);
- gtk_box_pack_start (GTK_BOX (button_box), action_button, FALSE, FALSE, 0);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (action_area),
+ GTK_ORIENTATION_HORIZONTAL);
label = gtk_label_new (NULL);
hostname = ephy_string_get_host_name (store_data->uri);
@@ -1933,8 +1911,6 @@ geolocation_policy_decision_requested_cb (WebKitWebView *web_view,
{
GtkWidget *info_bar;
GtkWidget *action_area;
- GtkWidget *button_box;
- GtkWidget *button;
GtkWidget *content_area;
GtkWidget *label;
char *message;
@@ -1945,25 +1921,14 @@ geolocation_policy_decision_requested_cb (WebKitWebView *web_view,
return FALSE;
#endif
- info_bar = gtk_info_bar_new ();
+ info_bar = gtk_info_bar_new_with_buttons (_("Deny"), GTK_RESPONSE_NO,
+ _("Allow"), GTK_RESPONSE_YES,
+ NULL);
- /* Buttons */
action_area = gtk_info_bar_get_action_area (GTK_INFO_BAR (info_bar));
-
- button_box = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (action_area), button_box);
-
- /* Translators: Geolocation policy for a specific site. */
- button = gtk_button_new_with_label (_("Deny"));
- gtk_box_pack_start (GTK_BOX (button_box), button, FALSE, FALSE, 0);
- g_signal_connect (button, "clicked",
- G_CALLBACK (send_no_response_cb), info_bar);
-
/* Translators: Geolocation policy for a specific site. */
- button = gtk_button_new_with_label (_("Allow"));
- gtk_box_pack_start (GTK_BOX (button_box), button, FALSE, FALSE, 0);
- g_signal_connect (button, "clicked",
- G_CALLBACK (send_yes_response_cb), info_bar);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (action_area),
+ GTK_ORIENTATION_HORIZONTAL);
/* Label */
#ifdef HAVE_WEBKIT2