Use lock-secure and lock-insecure icons if available

This commit is contained in:
Christian Dywan 2011-03-12 03:24:05 +01:00
parent c4f68aeba4
commit a6c9b73442

View file

@ -1795,8 +1795,6 @@ midori_location_action_set_security_hint (MidoriLocationAction* location_action,
MidoriSecurity hint) MidoriSecurity hint)
{ {
GSList* proxies; GSList* proxies;
GtkWidget* entry;
GtkWidget* child;
g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action)); 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 bg_color = { 0, 1 };
GdkColor fg_color = { 0, 1 }; GdkColor fg_color = { 0, 1 };
GtkWidget* entry = midori_location_action_entry_for_proxy (proxies->data);
entry = midori_location_action_entry_for_proxy (proxies->data); GtkWidget* child = gtk_bin_get_child (GTK_BIN (entry));
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) if (hint == MIDORI_SECURITY_UNKNOWN)
{ {
gdk_color_parse ("#ef7070", &bg_color); gdk_color_parse ("#ef7070", &bg_color);
gdk_color_parse ("#000", &fg_color); gdk_color_parse ("#000", &fg_color);
#if !HAVE_HILDON #if !HAVE_HILDON
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (child), if (gtk_icon_theme_has_icon (icon_theme, "lock-insecure"))
GTK_ICON_ENTRY_SECONDARY, GTK_STOCK_INFO); 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_set_tooltip (GTK_ICON_ENTRY (child),
GTK_ICON_ENTRY_SECONDARY, _("Not verified")); GTK_ICON_ENTRY_SECONDARY, _("Not verified"));
#endif #endif
@ -1827,8 +1830,12 @@ midori_location_action_set_security_hint (MidoriLocationAction* location_action,
gdk_color_parse ("#fcf19a", &bg_color); gdk_color_parse ("#fcf19a", &bg_color);
gdk_color_parse ("#000", &fg_color); gdk_color_parse ("#000", &fg_color);
#if !HAVE_HILDON #if !HAVE_HILDON
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (child), if (gtk_icon_theme_has_icon (icon_theme, "lock-secure"))
GTK_ICON_ENTRY_SECONDARY, GTK_STOCK_DIALOG_AUTHENTICATION); 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_set_tooltip (GTK_ICON_ENTRY (child),
GTK_ICON_ENTRY_SECONDARY, _("Verified and encrypted connection")); GTK_ICON_ENTRY_SECONDARY, _("Verified and encrypted connection"));
#endif #endif