From a6c9b734424c8bb6bf027bd3c5645b87fe3e3107 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sat, 12 Mar 2011 03:24:05 +0100 Subject: [PATCH] Use lock-secure and lock-insecure icons if available --- midori/midori-locationaction.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c index d54ac430..c8f7c140 100644 --- a/midori/midori-locationaction.c +++ b/midori/midori-locationaction.c @@ -1795,8 +1795,6 @@ midori_location_action_set_security_hint (MidoriLocationAction* location_action, MidoriSecurity hint) { GSList* proxies; - GtkWidget* entry; - GtkWidget* child; g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action)); @@ -1807,17 +1805,22 @@ midori_location_action_set_security_hint (MidoriLocationAction* location_action, { 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)); + GtkWidget* entry = midori_location_action_entry_for_proxy (proxies->data); + GtkWidget* child = gtk_bin_get_child (GTK_BIN (entry)); + GdkScreen* screen = gtk_widget_get_screen (child); + GtkIconTheme* icon_theme = gtk_icon_theme_get_for_screen (screen); if (hint == MIDORI_SECURITY_UNKNOWN) { 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); + if (gtk_icon_theme_has_icon (icon_theme, "lock-insecure")) + gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (child), + GTK_ICON_ENTRY_SECONDARY, "lock-insecure"); + else + gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (child), + GTK_ICON_ENTRY_SECONDARY, GTK_STOCK_INFO); gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (child), GTK_ICON_ENTRY_SECONDARY, _("Not verified")); #endif @@ -1827,8 +1830,12 @@ midori_location_action_set_security_hint (MidoriLocationAction* location_action, 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); + if (gtk_icon_theme_has_icon (icon_theme, "lock-secure")) + gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (child), + GTK_ICON_ENTRY_SECONDARY, "lock-secure"); + else + gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (child), + GTK_ICON_ENTRY_SECONDARY, GTK_STOCK_DIALOG_AUTHENTICATION); gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (child), GTK_ICON_ENTRY_SECONDARY, _("Verified and encrypted connection")); #endif