[Kazehakase-cvs] CVS update: kazehakase/src

Zurück zum Archiv-Index

Ryo SHIMIZU furyo****@users*****
Sun Oct 22 00:38:45 JST 2006


Index: kazehakase/src/kz-favicon.c
diff -u kazehakase/src/kz-favicon.c:1.37 kazehakase/src/kz-favicon.c:1.38
--- kazehakase/src/kz-favicon.c:1.37	Wed Oct 18 13:24:01 2006
+++ kazehakase/src/kz-favicon.c	Sun Oct 22 00:38:45 2006
@@ -256,6 +256,8 @@
 {	
 	GQuark quark;
 	const gchar *uri;
+	KzFavicon *kzfav = kzfavicon_single;
+	KzFaviconPrivate *priv = KZ_FAVICON_GET_PRIVATE (kzfav);
 
 	uri = info->document_uri;
 	quark = g_quark_from_string(uri);
@@ -267,14 +269,22 @@
 				 kz_downloader_get_size(dl),
 				 NULL) &&
 	    g_file_test(info->favicon_file_location, G_FILE_TEST_EXISTS))
+	{
 		g_unlink(info->favicon_file_location);
-	g_free(info->favicon_file_location);
+		g_free(info->favicon_file_location);
+	}
+	else
+	{
+		g_hash_table_insert(priv->uri_hash,
+		 create_profile_key_from_uri(uri), 
+		 info->favicon_file_location);
+	}
 	g_free(info);
 
 	g_idle_add(idle_unref_dl, dl);
 
 	/* FIXME! Do not use kzfavicon_sigle object! */
-	g_signal_emit(kzfavicon_single,
+	g_signal_emit(kzfav,
 		      kz_favicon_signals[READY_SIGNAL],
 		      quark,
 		      uri);
@@ -284,10 +294,7 @@
 static void
 cb_downloader_load_error (KzDownloader *dl, downloader_info_t *info)
 {
-	gchar *hash_key, *uri;
-	KzFavicon *kzfav = kzfavicon_single;
-	KzFaviconPrivate *priv = KZ_FAVICON_GET_PRIVATE (kzfav);
-
+	gchar *uri;
 	uri = info->document_uri;
 
 	kz_downloader_disconnect_signal(dl, info);
@@ -295,10 +302,6 @@
 
 	g_free(info->favicon_file_location);
 	g_free(info);
-
-	hash_key = create_profile_key_from_uri(uri);
-	g_hash_table_remove(priv->uri_hash, hash_key);
-	g_free(hash_key);	
 }
 
 
@@ -419,17 +422,13 @@
 		return;
 	}
 
-	g_hash_table_insert(priv->uri_hash,
-			    create_profile_key_from_uri(document_uri),
-			    g_strdup(favicon_file_location));
-
 	/* start download */
 	dl = kz_downloader_new(uri);
 	if (dl)
 	{
 		downloader_info_t *info = g_new(downloader_info_t, 1);
 		info->document_uri = document_uri;
-		info->favicon_file_location = g_strdup(favicon_file_location);
+		info->favicon_file_location = favicon_file_location;
 
 		g_signal_connect(dl, "completed",
 				 G_CALLBACK(cb_downloader_load_complete),
@@ -439,7 +438,9 @@
 				 (gpointer)info);
 		kz_downloader_to_buffer(dl);
 	}
-
-	g_free(favicon_file_location);
+	else
+	{
+		g_free(favicon_file_location);
+	}
 }
 
Index: kazehakase/src/kz-window.c
diff -u kazehakase/src/kz-window.c:1.273 kazehakase/src/kz-window.c:1.274
--- kazehakase/src/kz-window.c:1.273	Sat Oct 14 17:43:38 2006
+++ kazehakase/src/kz-window.c	Sun Oct 22 00:38:45 2006
@@ -2605,11 +2605,36 @@
 static void
 cb_embed_load_finished (KzEmbed *embed, KzWindow *kz)
 {
+	const gchar *uri;
+	gchar *root;
+	gchar *find_uri;
+	gchar *slash_pos;
+
 	g_return_if_fail(KZ_IS_WINDOW(kz));
 
 	kz_actions_set_sensitive(kz, KZ_EMBED(KZ_WINDOW_CURRENT_PAGE(kz)));
 
 	kz_feed_info_change_state(KZ_FEED_INFO(kz->feed_info));
+	
+	uri = kz_embed_get_location(embed);
+	if(!kz_favicon_is_loaded(kz->kzfav, uri))
+	{
+		slash_pos = strstr(uri + strlen("https://"), "/");
+		if(slash_pos)
+		{
+			root = g_strndup(uri, slash_pos - uri);
+			if(root)
+			{
+				find_uri = g_strconcat(root, "/favicon.ico",
+				NULL);
+				kz_favicon_get_icon_from_uri(kz->kzfav, 
+				find_uri, uri);
+
+				g_free(root);
+				g_free(find_uri);
+			}
+		}
+	}
 }
 
 


More information about the Kazehakase-cvs mailing list
Zurück zum Archiv-Index