From f62663bb9495088717cac6aa8ca6ca46330773b3 Mon Sep 17 00:00:00 2001 From: Diego Escalante Urrelo Date: Thu, 2 Aug 2012 17:09:47 +0200 Subject: 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 --- embed/ephy-web-view.c | 55 ++++++++++----------------------------------------- 1 file changed, 10 insertions(+), 45 deletions(-) (limited to 'embed') 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 @@ -708,18 +708,6 @@ store_password (GtkInfoBar *info_bar, gint response_id, gpointer data) gtk_widget_destroy (GTK_WIDGET (info_bar)); } -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) { @@ -727,8 +715,6 @@ request_decision_on_storing (StorePasswordData *store_data) 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 -- cgit