[Xfce4-commits] <midori:master> No security window for blank pages, but a search icon
Christian Dywan
noreply at xfce.org
Wed Apr 17 01:16:03 CEST 2013
Updating branch refs/heads/master
to d5b99b0d9bfd2807be4a0eee19ef7914d261a9b8 (commit)
from 8a1d08d4f5488ec6e3399410e69726bcb446a39a (commit)
commit d5b99b0d9bfd2807be4a0eee19ef7914d261a9b8
Author: Christian Dywan <christian at twotoasts.de>
Date: Wed Apr 17 01:10:10 2013 +0200
No security window for blank pages, but a search icon
Fixes: https://bugs.launchpad.net/midori/+bug/1032320
Fixes: https://bugs.launchpad.net/midori/+bug/1107560
midori/midori-browser.c | 13 +++++-
midori/midori-locationaction.c | 88 ++++++++++++++++++++++++++--------------
midori/midori-locationaction.h | 5 ++
3 files changed, 73 insertions(+), 33 deletions(-)
diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index c0d5563..4187f76 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -345,8 +345,17 @@ _midori_browser_update_interface (MidoriBrowser* browser,
}
action = _action_by_name (browser, "Location");
- midori_location_action_set_security_hint (
- MIDORI_LOCATION_ACTION (action), midori_tab_get_security (MIDORI_TAB (view)));
+ if (midori_tab_is_blank (MIDORI_TAB (view)))
+ {
+ gchar* icon_names[] = { "edit-find-symbolic", "edit-find", NULL };
+ GIcon* icon = g_themed_icon_new_from_names (icon_names, -1);
+ midori_location_action_set_primary_icon (
+ MIDORI_LOCATION_ACTION (action), icon, _("Web Search…"));
+ g_object_unref (icon);
+ }
+ else
+ midori_location_action_set_security_hint (
+ MIDORI_LOCATION_ACTION (action), midori_tab_get_security (MIDORI_TAB (view)));
midori_browser_update_secondary_icon (browser, view, action);
}
diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c
index b1016c2..290c29b 100644
--- a/midori/midori-locationaction.c
+++ b/midori/midori-locationaction.c
@@ -1380,7 +1380,7 @@ midori_location_action_tls_flags_to_string (GTlsCertificateFlags tls_flags)
g_return_val_if_reached ("Unknown GTLSCertificateFlags value");
}
-void
+static void
midori_location_action_show_page_info (GtkWidget* widget,
GtkBox* box,
GtkWidget* dialog)
@@ -1463,6 +1463,10 @@ midori_location_action_icon_released_cb (GtkWidget* widget,
if (icon_pos == GTK_ICON_ENTRY_PRIMARY)
{
+ /* No "security" window for blank pages */
+ if (midori_uri_is_blank (MIDORI_LOCATION_ACTION (action)->text))
+ return;
+
const gchar* title = _("Security details");
GtkWidget* content_area;
GtkWidget* hbox;
@@ -1748,18 +1752,19 @@ midori_location_action_set_secondary_icon (MidoriLocationAction* location_action
}
/**
- * midori_location_action_set_security_hint:
+ * midori_location_action_primary_icon:
* @location_action: a #MidoriLocationAction
- * @hint: a security hint
+ * @icon: a list of icon names, preferred icon first
+ * @tooltip: The tooltip to show
*
- * Sets a security hint on the action, so that the security status
- * can be reflected visually.
+ * The primary icon is mutually exclusive with the security hint.
*
- * Since: 0.2.5
+ * Since: 0.5.1
**/
void
-midori_location_action_set_security_hint (MidoriLocationAction* location_action,
- MidoriSecurity hint)
+midori_location_action_set_primary_icon (MidoriLocationAction* location_action,
+ GIcon* icon,
+ const gchar* tooltip)
{
GSList* proxies;
@@ -1771,29 +1776,50 @@ midori_location_action_set_security_hint (MidoriLocationAction* location_action,
if (GTK_IS_TOOL_ITEM (proxies->data))
{
GtkWidget* entry = midori_location_action_entry_for_proxy (proxies->data);
+ gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY, icon);
+ gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY, tooltip);
+ }
+}
- if (hint == MIDORI_SECURITY_UNKNOWN)
- {
- gchar* icon_names[] = { "channel-insecure-symbolic", "lock-insecure", "dialog-information", NULL };
- gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY,
- g_themed_icon_new_from_names (icon_names, -1));
- gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (entry),
- GTK_ICON_ENTRY_PRIMARY, _("Not verified"));
- }
- else if (hint == MIDORI_SECURITY_TRUSTED)
- {
- gchar* icon_names[] = { "channel-secure-symbolic", "lock-secure", "locked", NULL };
- gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY,
- g_themed_icon_new_from_names (icon_names, -1));
- gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (entry),
- GTK_ICON_ENTRY_PRIMARY, _("Verified and encrypted connection"));
- }
- else if (hint == MIDORI_SECURITY_NONE)
- {
- gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY,
- g_themed_icon_new_with_default_fallbacks ("text-html-symbolic"));
- gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (entry),
- GTK_ICON_ENTRY_PRIMARY, _("Open, unencrypted connection"));
- }
+/**
+ * midori_location_action_set_security_hint:
+ * @location_action: a #MidoriLocationAction
+ * @hint: a security hint
+ *
+ * Sets a security hint on the action, so that the security status
+ * can be reflected visually.
+ *
+ * Since: 0.2.5
+ **/
+void
+midori_location_action_set_security_hint (MidoriLocationAction* location_action,
+ MidoriSecurity hint)
+{
+ GIcon* icon;
+ gchar* tooltip;
+
+ g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action));
+
+ if (hint == MIDORI_SECURITY_UNKNOWN)
+ {
+ gchar* icon_names[] = { "channel-insecure-symbolic", "lock-insecure", "dialog-information", NULL };
+ icon = g_themed_icon_new_from_names (icon_names, -1);
+ tooltip = _("Not verified");
+ }
+ else if (hint == MIDORI_SECURITY_TRUSTED)
+ {
+ gchar* icon_names[] = { "channel-secure-symbolic", "lock-secure", "locked", NULL };
+ icon = g_themed_icon_new_from_names (icon_names, -1);
+ tooltip = _("Verified and encrypted connection");
+ }
+ else if (hint == MIDORI_SECURITY_NONE)
+ {
+ icon = g_themed_icon_new_with_default_fallbacks ("text-html-symbolic");
+ tooltip = _("Open, unencrypted connection");
}
+ else
+ g_assert_not_reached ();
+
+ midori_location_action_set_primary_icon (location_action, icon, tooltip);
+ g_object_unref (icon);
}
diff --git a/midori/midori-locationaction.h b/midori/midori-locationaction.h
index 7fad42b..3b17300 100644
--- a/midori/midori-locationaction.h
+++ b/midori/midori-locationaction.h
@@ -71,6 +71,11 @@ void
midori_location_action_clear (MidoriLocationAction* location_action);
void
+midori_location_action_set_primary_icon (MidoriLocationAction* location_action,
+ GIcon* icon,
+ const gchar* tooltip);
+
+void
midori_location_action_set_security_hint (MidoriLocationAction* location_action,
MidoriSecurity hint);
More information about the Xfce4-commits
mailing list