From 0d4b041de3bde92fdc1c05af938a9b822a41ee4a Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Tue, 20 Apr 2010 23:32:28 +0200 Subject: [PATCH] Security with background color and secondary icon --- midori/midori-browser.c | 5 +++-- midori/midori-locationaction.c | 30 ++++++++++++++++++++++++------ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 65647f0f..e280c263 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -365,8 +365,6 @@ _midori_browser_update_interface (MidoriBrowser* browser) #endif action = _action_by_name (browser, "Location"); - midori_location_action_set_security_hint ( - MIDORI_LOCATION_ACTION (action), midori_view_get_security (view)); if (g_object_get_data (G_OBJECT (view), "news-feeds")) { midori_location_action_set_secondary_icon ( @@ -379,6 +377,9 @@ _midori_browser_update_interface (MidoriBrowser* browser) MIDORI_LOCATION_ACTION (action), GTK_STOCK_JUMP_TO); gtk_action_set_sensitive (_action_by_name (browser, "AddNewsFeed"), FALSE); } + midori_location_action_set_security_hint ( + MIDORI_LOCATION_ACTION (action), midori_view_get_security (view)); + } static void diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c index b4b1dafe..9434e1cd 100644 --- a/midori/midori-locationaction.c +++ b/midori/midori-locationaction.c @@ -1700,27 +1700,45 @@ void midori_location_action_set_security_hint (MidoriLocationAction* location_action, MidoriSecurity hint) { - #if !HAVE_HILDON GSList* proxies; GtkWidget* entry; GtkWidget* child; - #endif g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action)); - #if !HAVE_HILDON proxies = gtk_action_get_proxies (GTK_ACTION (location_action)); for (; proxies != NULL; proxies = g_slist_next (proxies)) if (GTK_IS_TOOL_ITEM (proxies->data)) { + GdkColor bg_color = { 0, 1 }; + GdkColor fg_color = { 0, 1 }; + entry = midori_location_action_entry_for_proxy (proxies->data); child = gtk_bin_get_child (GTK_BIN (entry)); if (hint == MIDORI_SECURITY_UNKNOWN) - gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (child), GTK_ICON_ENTRY_PRIMARY, GTK_STOCK_INFO); + { + gdk_color_parse ("#ef7070", &bg_color); + gdk_color_parse ("#000", &fg_color); + #if !HAVE_HILDON + gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (child), + GTK_ICON_ENTRY_SECONDARY, GTK_STOCK_INFO); + #endif + } else if (hint == MIDORI_SECURITY_TRUSTED) - gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (child), GTK_ICON_ENTRY_PRIMARY, "lock"); + { + gdk_color_parse ("#fcf19a", &bg_color); + gdk_color_parse ("#000", &fg_color); + #if !HAVE_HILDON + gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (child), + GTK_ICON_ENTRY_SECONDARY, GTK_STOCK_DIALOG_AUTHENTICATION); + #endif + } + + gtk_widget_modify_base (child, GTK_STATE_NORMAL, + bg_color.red == 1 ? NULL : &bg_color); + gtk_widget_modify_text (child, GTK_STATE_NORMAL, + bg_color.red == 1 ? NULL : &fg_color); } - #endif } -- 2.39.5