[Xfce4-commits] <midori:master> Save speed dial thumbnails by uri rather than by dial id
Christian Dywan
noreply at xfce.org
Sun Apr 10 20:38:01 CEST 2011
Updating branch refs/heads/master
to 09a92c16bbd48635582e423e0ca9e1fa3913c7d3 (commit)
from 30d14ca320aac27d4e0b6cf6acca25eb000ae079 (commit)
commit 09a92c16bbd48635582e423e0ca9e1fa3913c7d3
Author: Paweł Forysiuk <tuxator at o2.pl>
Date: Fri Apr 8 21:18:41 2011 +0200
Save speed dial thumbnails by uri rather than by dial id
midori/main.c | 10 ++++++----
midori/midori-browser.c | 2 +-
midori/midori-view.c | 12 ++++++------
3 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/midori/main.c b/midori/main.c
index 22db995..5408714 100644
--- a/midori/main.c
+++ b/midori/main.c
@@ -1483,6 +1483,7 @@ speeddial_new_from_file (const gchar* config,
guint rows;
gchar* slot = NULL;
gchar* dial_id = NULL;
+ gchar* uri = NULL;
gchar* json_content;
gchar** parts;
@@ -1525,11 +1526,12 @@ speeddial_new_from_file (const gchar* config,
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;
@@ -1545,7 +1547,7 @@ speeddial_new_from_file (const gchar* config,
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);
diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index f425144..e4863eb 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -1174,7 +1174,7 @@ midori_browser_add_speed_dial (MidoriBrowser* browser)
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);
diff --git a/midori/midori-view.c b/midori/midori-view.c
index 11373c5..0481f5c 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -3919,9 +3919,9 @@ prepare_speed_dial_html (MidoriView* view)
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)
@@ -5585,7 +5585,7 @@ thumb_view_load_status_cb (MidoriView* thumb_view,
GdkPixbuf* img;
gchar* file_path;
gchar* thumb_dir;
- gchar* dom_id;
+ gchar* thumb_uri;
MidoriBrowser* browser;
gint i;
GtkWidget* tab;
@@ -5595,8 +5595,8 @@ thumb_view_load_status_cb (MidoriView* thumb_view,
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);
@@ -5607,7 +5607,7 @@ thumb_view_load_status_cb (MidoriView* thumb_view,
g_object_unref (img);
- g_free (dom_id);
+ g_free (thumb_uri);
g_free (file_path);
g_free (thumb_dir);
@@ -5671,7 +5671,7 @@ midori_view_speed_dial_get_thumb (MidoriView* view,
"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);
More information about the Xfce4-commits
mailing list