Remove obsolete KatzeNet instanciation

This commit is contained in:
Christian Dywan 2012-08-29 20:27:47 +02:00
parent f5d0c3ad5d
commit 1c1fd1740e
2 changed files with 10 additions and 32 deletions

View file

@ -27,8 +27,6 @@
struct _KatzeNet struct _KatzeNet
{ {
GObject parent_instance; GObject parent_instance;
guint cache_size;
}; };
struct _KatzeNetClass struct _KatzeNetClass
@ -61,23 +59,6 @@ katze_net_finalize (GObject* object)
G_OBJECT_CLASS (katze_net_parent_class)->finalize (object); G_OBJECT_CLASS (katze_net_parent_class)->finalize (object);
} }
static KatzeNet*
katze_net_new (void)
{
static KatzeNet* net = NULL;
if (!net)
{
net = g_object_new (KATZE_TYPE_NET, NULL);
/* Since this is a "singleton", keep an extra reference */
g_object_ref (net);
}
else
g_object_ref (net);
return net;
}
typedef struct typedef struct
{ {
KatzeNetStatusCb status_cb; KatzeNetStatusCb status_cb;
@ -102,29 +83,28 @@ katze_net_get_cached_path (KatzeNet* net,
const gchar* uri, const gchar* uri,
const gchar* subfolder) const gchar* subfolder)
{ {
gchar* cache_path;
gchar* checksum; gchar* checksum;
gchar* extension; gchar* extension;
gchar* cached_filename; gchar* cached_filename;
gchar* cached_path; gchar* cached_path;
net = katze_net_new ();
if (subfolder)
cache_path = g_build_filename (midori_paths_get_cache_dir (), subfolder, NULL);
else
cache_path = midori_paths_get_cache_dir ();
katze_mkdir_with_parents (cache_path, 0700);
checksum = g_compute_checksum_for_string (G_CHECKSUM_MD5, uri, -1); checksum = g_compute_checksum_for_string (G_CHECKSUM_MD5, uri, -1);
extension = g_strrstr (uri, "."); extension = g_strrstr (uri, ".");
cached_filename = g_strdup_printf ("%s%s", checksum, cached_filename = g_strdup_printf ("%s%s", checksum,
extension ? extension : ""); extension ? extension : "");
g_free (checksum); g_free (checksum);
cached_path = g_build_filename (cache_path, cached_filename, NULL);
g_free (cached_filename);
if (subfolder) if (subfolder)
{
gchar* cache_path = g_build_filename (midori_paths_get_cache_dir (), subfolder, NULL);
katze_mkdir_with_parents (cache_path, 0700);
cached_path = g_build_filename (cache_path, cached_filename, NULL);
g_free (cache_path); g_free (cache_path);
}
else
cached_path = g_build_filename (midori_paths_get_cache_dir (), cached_filename, NULL);
g_free (cached_filename);
return cached_path; return cached_path;
} }

View file

@ -14,8 +14,6 @@
#include "katze-utils.h" #include "katze-utils.h"
#include <gtk/gtk.h>
G_BEGIN_DECLS G_BEGIN_DECLS
#define KATZE_TYPE_NET \ #define KATZE_TYPE_NET \