Display statusbar text in the location if the statusbar is hidden

This commit is contained in:
Christian Dywan 2009-07-17 04:06:44 +02:00
parent a7391693b2
commit 525e7a2227

View file

@ -340,10 +340,44 @@ _midori_browser_set_statusbar_text (MidoriBrowser* browser,
const gchar* text) const gchar* text)
{ {
katze_assign (browser->statusbar_text, g_strdup (text)); katze_assign (browser->statusbar_text, g_strdup (text));
if (!GTK_WIDGET_VISIBLE (browser->statusbar))
{
GtkAction* action = _action_by_name (browser, "Location");
MidoriLocationAction* location_action = MIDORI_LOCATION_ACTION (action);
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_icon (location_action, blank);
midori_location_action_set_secondary_icon (location_action, NULL);
}
else
{
GtkWidget* view = midori_browser_get_current_tab (browser);
if (G_LIKELY (view))
{
if (g_object_get_data (G_OBJECT (view), "news-feeds"))
midori_location_action_set_secondary_icon (
location_action, STOCK_NEWS_FEED);
else
midori_location_action_set_secondary_icon (
location_action, GTK_STOCK_JUMP_TO);
midori_location_action_set_uri (location_action,
midori_view_get_display_uri (MIDORI_VIEW (view)));
}
}
}
else
{
gtk_statusbar_pop (GTK_STATUSBAR (browser->statusbar), 1); gtk_statusbar_pop (GTK_STATUSBAR (browser->statusbar), 1);
gtk_statusbar_push (GTK_STATUSBAR (browser->statusbar), 1, gtk_statusbar_push (GTK_STATUSBAR (browser->statusbar), 1,
browser->statusbar_text ? browser->statusbar_text : ""); browser->statusbar_text ? browser->statusbar_text : "");
} }
}
static void static void
_midori_browser_set_current_page_smartly (MidoriBrowser* browser, _midori_browser_set_current_page_smartly (MidoriBrowser* browser,