guint rows;
gchar* slot = NULL;
gchar* dial_id = NULL;
+ gchar* uri = NULL;
gchar* json_content;
gchar** parts;
dial_id = g_strdup_printf ("Dial %s", slot + 1);
slot_count++;
}
- else if (g_str_equal (key, "href") && (*val && strncmp (val, "#", 1)))
+ else if (g_str_equal (key, "href"))
{
- g_key_file_set_value (key_file, dial_id, "uri", val);
+ katze_assign (uri, g_strdup (val));
+ g_key_file_set_value (key_file, dial_id, "uri", uri);
}
- else if (g_str_equal (key, "img") && *val)
+ else if (g_str_equal (key, "img") && (*val && strncmp (val, "#", 1)))
{
gsize sz;
gint state = 0;
PACKAGE_NAME, "thumbnails", NULL);
if (!g_file_test (thumb_dir, G_FILE_TEST_EXISTS))
katze_mkdir_with_parents (thumb_dir, 0700);
- thumb_path = sokoke_build_thumbnail_path (slot);
+ thumb_path = sokoke_build_thumbnail_path (uri);
g_file_set_contents (thumb_path, (gchar*)decoded, sz, NULL);
g_free (decoded);
gchar* dial_id = g_strdup_printf ("Dial %s", slot_id + 1);
gchar* config_file = g_build_filename (sokoke_set_config_dir (NULL),
"speeddial", NULL);
- gchar* file_path = sokoke_build_thumbnail_path (slot_id);
+ gchar* file_path = sokoke_build_thumbnail_path (uri);
gchar* thumb_dir = g_build_path (G_DIR_SEPARATOR_S, g_get_user_cache_dir (),
PACKAGE_NAME, "thumbnails", NULL);
g_object_get (browser, "speed-dial", &key_file, NULL);
if (g_key_file_has_group (key_file, dial_entry))
{
gchar* slot_id = g_strdup_printf ("s%d", slot);
- gchar* thumb_file = sokoke_build_thumbnail_path (slot_id);
gchar* uri = g_key_file_get_string (key_file, dial_entry, "uri", NULL);
gchar* title = g_key_file_get_string (key_file, dial_entry, "title", NULL);
+ gchar* thumb_file = sokoke_build_thumbnail_path (uri);
gchar* encoded;
if (g_access (thumb_file, F_OK) == 0)
GdkPixbuf* img;
gchar* file_path;
gchar* thumb_dir;
- gchar* dom_id;
+ gchar* thumb_uri;
MidoriBrowser* browser;
gint i;
GtkWidget* tab;
gtk_widget_realize (midori_view_get_web_view (MIDORI_VIEW (thumb_view)));
img = midori_view_get_snapshot (MIDORI_VIEW (thumb_view), 240, 160);
- dom_id = g_object_get_data (G_OBJECT (thumb_view), "dom-id");
- file_path = sokoke_build_thumbnail_path (dom_id);
+ thumb_uri = g_object_get_data (G_OBJECT (thumb_view), "thumb-uri");
+ file_path = sokoke_build_thumbnail_path (thumb_uri);
thumb_dir = g_build_path (G_DIR_SEPARATOR_S, g_get_user_cache_dir (),
PACKAGE_NAME, "thumbnails", NULL);
g_object_unref (img);
- g_free (dom_id);
+ g_free (thumb_uri);
g_free (file_path);
g_free (thumb_dir);
"enable-plugins", FALSE, "auto-load-images", TRUE, NULL);
_midori_view_set_settings (MIDORI_VIEW (thumb_view), settings);
- g_object_set_data (G_OBJECT (thumb_view), "dom-id", dom_id);
+ g_object_set_data (G_OBJECT (thumb_view), "thumb-uri", url);
g_signal_connect (thumb_view, "notify::load-status",
G_CALLBACK (thumb_view_load_status_cb), view);
midori_view_set_uri (MIDORI_VIEW (thumb_view), url);