Security with background color and secondary icon

This commit is contained in:
Christian Dywan 2010-04-20 23:32:28 +02:00
parent aaf0d4b395
commit 0d4b041de3
2 changed files with 27 additions and 8 deletions

View file

@ -365,8 +365,6 @@ _midori_browser_update_interface (MidoriBrowser* browser)
#endif #endif
action = _action_by_name (browser, "Location"); 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")) if (g_object_get_data (G_OBJECT (view), "news-feeds"))
{ {
midori_location_action_set_secondary_icon ( midori_location_action_set_secondary_icon (
@ -379,6 +377,9 @@ _midori_browser_update_interface (MidoriBrowser* browser)
MIDORI_LOCATION_ACTION (action), GTK_STOCK_JUMP_TO); MIDORI_LOCATION_ACTION (action), GTK_STOCK_JUMP_TO);
gtk_action_set_sensitive (_action_by_name (browser, "AddNewsFeed"), FALSE); 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 static void

View file

@ -1700,27 +1700,45 @@ void
midori_location_action_set_security_hint (MidoriLocationAction* location_action, midori_location_action_set_security_hint (MidoriLocationAction* location_action,
MidoriSecurity hint) MidoriSecurity hint)
{ {
#if !HAVE_HILDON
GSList* proxies; GSList* proxies;
GtkWidget* entry; GtkWidget* entry;
GtkWidget* child; GtkWidget* child;
#endif
g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action)); g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action));
#if !HAVE_HILDON
proxies = gtk_action_get_proxies (GTK_ACTION (location_action)); proxies = gtk_action_get_proxies (GTK_ACTION (location_action));
for (; proxies != NULL; proxies = g_slist_next (proxies)) for (; proxies != NULL; proxies = g_slist_next (proxies))
if (GTK_IS_TOOL_ITEM (proxies->data)) 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); entry = midori_location_action_entry_for_proxy (proxies->data);
child = gtk_bin_get_child (GTK_BIN (entry)); child = gtk_bin_get_child (GTK_BIN (entry));
if (hint == MIDORI_SECURITY_UNKNOWN) if (hint == MIDORI_SECURITY_UNKNOWN)
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (child), GTK_ICON_ENTRY_PRIMARY, GTK_STOCK_INFO); {
else if (hint == MIDORI_SECURITY_TRUSTED) gdk_color_parse ("#ef7070", &bg_color);
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (child), GTK_ICON_ENTRY_PRIMARY, "lock"); 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 #endif
} }
else if (hint == MIDORI_SECURITY_TRUSTED)
{
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);
}
}