Do not try to compute a tab colour unless it's a proper URI

This commit is contained in:
Christian Dywan 2009-03-23 19:27:35 +01:00
parent 350dbe5e07
commit 637388a8de

View file

@ -45,7 +45,8 @@ colorful_tabs_view_notify_uri_cb (MidoriView* view,
dark, we lighten it up a litte. Finally we make the event box dark, we lighten it up a litte. Finally we make the event box
visible and modify its background. */ visible and modify its background. */
uri = soup_uri_new (midori_view_get_display_uri (view)); if ((uri = soup_uri_new (midori_view_get_display_uri (view))))
{
hash = g_compute_checksum_for_string (G_CHECKSUM_MD5, uri->host, -1); hash = g_compute_checksum_for_string (G_CHECKSUM_MD5, uri->host, -1);
soup_uri_free (uri); soup_uri_free (uri);
colorstr = g_strndup (hash, 6 + 1); colorstr = g_strndup (hash, 6 + 1);
@ -62,6 +63,12 @@ colorful_tabs_view_notify_uri_cb (MidoriView* view,
gtk_widget_modify_bg (label, GTK_STATE_NORMAL, &color); gtk_widget_modify_bg (label, GTK_STATE_NORMAL, &color);
gtk_widget_modify_bg (label, GTK_STATE_ACTIVE, &color); gtk_widget_modify_bg (label, GTK_STATE_ACTIVE, &color);
} }
else
{
gtk_widget_modify_bg (label, GTK_STATE_NORMAL, NULL);
gtk_widget_modify_bg (label, GTK_STATE_ACTIVE, NULL);
}
}
static void static void
colorful_tabs_browser_add_tab_cb (MidoriBrowser* browser, colorful_tabs_browser_add_tab_cb (MidoriBrowser* browser,