From 1c1fd1740e4053ba7e5e5ee8b6d4832523c60299 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Wed, 29 Aug 2012 20:27:47 +0200 Subject: [PATCH] Remove obsolete KatzeNet instanciation --- katze/katze-net.c | 40 ++++++++++------------------------------ katze/katze-net.h | 2 -- 2 files changed, 10 insertions(+), 32 deletions(-) diff --git a/katze/katze-net.c b/katze/katze-net.c index 63b5e602..10b55bff 100644 --- a/katze/katze-net.c +++ b/katze/katze-net.c @@ -27,8 +27,6 @@ struct _KatzeNet { GObject parent_instance; - - guint cache_size; }; struct _KatzeNetClass @@ -61,23 +59,6 @@ katze_net_finalize (GObject* 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 { KatzeNetStatusCb status_cb; @@ -102,29 +83,28 @@ katze_net_get_cached_path (KatzeNet* net, const gchar* uri, const gchar* subfolder) { - gchar* cache_path; gchar* checksum; gchar* extension; gchar* cached_filename; 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); - extension = g_strrstr (uri, "."); cached_filename = g_strdup_printf ("%s%s", checksum, extension ? extension : ""); g_free (checksum); - cached_path = g_build_filename (cache_path, cached_filename, NULL); - g_free (cached_filename); + 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); + } + else + cached_path = g_build_filename (midori_paths_get_cache_dir (), cached_filename, NULL); + + g_free (cached_filename); return cached_path; } diff --git a/katze/katze-net.h b/katze/katze-net.h index 5658ff47..eea2df41 100644 --- a/katze/katze-net.h +++ b/katze/katze-net.h @@ -14,8 +14,6 @@ #include "katze-utils.h" -#include - G_BEGIN_DECLS #define KATZE_TYPE_NET \ -- 2.39.5