Update location icon even if it's not in the history

This commit is contained in:
Christian Dywan 2008-11-11 00:51:28 +01:00
parent d11900932e
commit 9e997e4c90
3 changed files with 38 additions and 2 deletions

View file

@ -2910,6 +2910,8 @@ gtk_notebook_switch_page_cb (GtkWidget* notebook,
uri = midori_view_get_display_uri (MIDORI_VIEW (view)); uri = midori_view_get_display_uri (MIDORI_VIEW (view));
action = _action_by_name (browser, "Location"); action = _action_by_name (browser, "Location");
midori_location_action_set_uri (MIDORI_LOCATION_ACTION (action), uri); midori_location_action_set_uri (MIDORI_LOCATION_ACTION (action), uri);
midori_location_action_set_icon (MIDORI_LOCATION_ACTION (action),
midori_view_get_icon (MIDORI_VIEW (view)));
title = midori_view_get_display_title (MIDORI_VIEW (view)); title = midori_view_get_display_title (MIDORI_VIEW (view));
window_title = g_strconcat (title, " - ", window_title = g_strconcat (title, " - ",

View file

@ -611,7 +611,7 @@ midori_location_action_item_iter (MidoriLocationAction* location_action,
g_return_val_if_fail (uri != NULL, FALSE); g_return_val_if_fail (uri != NULL, FALSE);
found = FALSE; found = FALSE;
model = location_action->model; // filter_model model = location_action->model;
if (gtk_tree_model_get_iter_first (model, iter)) if (gtk_tree_model_get_iter_first (model, iter))
{ {
tmpuri = NULL; tmpuri = NULL;
@ -860,6 +860,7 @@ midori_location_action_set_text (MidoriLocationAction* location_action,
GdkPixbuf* icon; GdkPixbuf* icon;
g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action)); g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action));
g_return_if_fail (text != NULL);
proxies = gtk_action_get_proxies (GTK_ACTION (location_action)); proxies = gtk_action_get_proxies (GTK_ACTION (location_action));
if (!proxies) if (!proxies)
@ -875,7 +876,7 @@ midori_location_action_set_text (MidoriLocationAction* location_action,
gtk_entry_set_text (GTK_ENTRY (entry), text); gtk_entry_set_text (GTK_ENTRY (entry), text);
if (midori_location_action_item_iter (location_action, text, &iter)) if (midori_location_action_item_iter (location_action, text, &iter))
{ {
model = location_action->model; // filter_model model = location_action->model;
gtk_tree_model_get (model, &iter, FAVICON_COL, &icon, -1); gtk_tree_model_get (model, &iter, FAVICON_COL, &icon, -1);
gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (entry), gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_PRIMARY, icon); GTK_ICON_ENTRY_PRIMARY, icon);
@ -900,6 +901,35 @@ midori_location_action_set_uri (MidoriLocationAction* location_action,
midori_location_action_set_text (location_action, uri); midori_location_action_set_text (location_action, uri);
} }
void
midori_location_action_set_icon (MidoriLocationAction* location_action,
GdkPixbuf* icon)
{
GSList* proxies;
GtkWidget* alignment;
GtkWidget* location_entry;
GtkWidget* entry;
g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action));
g_return_if_fail (icon && GDK_IS_PIXBUF (icon));
proxies = gtk_action_get_proxies (GTK_ACTION (location_action));
if (!proxies)
return;
do
if (GTK_IS_TOOL_ITEM (proxies->data))
{
alignment = gtk_bin_get_child (GTK_BIN (proxies->data));
location_entry = gtk_bin_get_child (GTK_BIN (alignment));
entry = gtk_bin_get_child (GTK_BIN (location_entry));
gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_PRIMARY, icon);
}
while ((proxies = g_slist_next (proxies)));
}
/** /**
* midori_location_action_prepend_item: * midori_location_action_prepend_item:
* @location_action: a #MidoriLocationAction * @location_action: a #MidoriLocationAction

View file

@ -51,6 +51,10 @@ void
midori_location_action_set_uri (MidoriLocationAction* location_action, midori_location_action_set_uri (MidoriLocationAction* location_action,
const gchar* uri); const gchar* uri);
void
midori_location_action_set_icon (MidoriLocationAction* location_action,
GdkPixbuf* icon);
void void
midori_location_action_add_uri (MidoriLocationAction* location_action, midori_location_action_add_uri (MidoriLocationAction* location_action,
const gchar* uri); const gchar* uri);