Use a Go icon when showing the target URI in the location

This commit is contained in:
Christian Dywan 2009-07-24 17:01:02 +02:00
parent 65ff5b3277
commit 356f3f20be
2 changed files with 18 additions and 8 deletions

View file

@ -352,12 +352,8 @@ _midori_browser_set_statusbar_text (MidoriBrowser* browser,
MidoriLocationAction* location_action = MIDORI_LOCATION_ACTION (action); MidoriLocationAction* location_action = MIDORI_LOCATION_ACTION (action);
if (text && *text) if (text && *text)
{ {
static GdkPixbuf* blank = NULL;
if (G_UNLIKELY (!blank))
blank = gdk_pixbuf_new_from_data ((guchar*)"",
GDK_COLORSPACE_RGB, TRUE, 8, 1, 1, 1, NULL, NULL);
midori_location_action_set_uri (location_action, text); midori_location_action_set_uri (location_action, text);
midori_location_action_set_icon (location_action, blank); midori_location_action_set_icon (location_action, NULL);
midori_location_action_set_secondary_icon (location_action, NULL); midori_location_action_set_secondary_icon (location_action, NULL);
} }
else else

View file

@ -1119,6 +1119,16 @@ midori_location_action_set_uri (MidoriLocationAction* location_action,
midori_location_action_set_text (location_action, uri); midori_location_action_set_text (location_action, uri);
} }
/**
* midori_location_action_set_icon:
* @location_action: a #MidoriLocationAction
* @icon: a #GdkPixbuf or %NULL
*
* Sets the icon shown on the left hand side.
*
* Note: Since 0.1.8 %NULL can be passed to indicate that the
* visible URI refers to a target, not the current location.
**/
void void
midori_location_action_set_icon (MidoriLocationAction* location_action, midori_location_action_set_icon (MidoriLocationAction* location_action,
GdkPixbuf* icon) GdkPixbuf* icon)
@ -1128,7 +1138,7 @@ midori_location_action_set_icon (MidoriLocationAction* location_action,
GtkWidget* entry; GtkWidget* entry;
g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action)); g_return_if_fail (MIDORI_IS_LOCATION_ACTION (location_action));
g_return_if_fail (GDK_IS_PIXBUF (icon)); g_return_if_fail (!icon || GDK_IS_PIXBUF (icon));
proxies = gtk_action_get_proxies (GTK_ACTION (location_action)); proxies = gtk_action_get_proxies (GTK_ACTION (location_action));
@ -1138,8 +1148,12 @@ midori_location_action_set_icon (MidoriLocationAction* location_action,
location_entry = midori_location_action_entry_for_proxy (proxies->data); location_entry = midori_location_action_entry_for_proxy (proxies->data);
entry = gtk_bin_get_child (GTK_BIN (location_entry)); entry = gtk_bin_get_child (GTK_BIN (location_entry));
gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (entry), if (icon)
GTK_ICON_ENTRY_PRIMARY, icon); gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_PRIMARY, icon);
else
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_PRIMARY, GTK_STOCK_JUMP_TO);
} }
} }