[Xfce4-commits] <midori:master> Introduce and use midori_view_save_speed_dial_config
Christian Dywan
noreply at xfce.org
Fri Oct 7 21:10:01 CEST 2011
Updating branch refs/heads/master
to 76a9bc38ff872d4825cbb5777e4a758362d2ff0c (commit)
from b5aad2d17650ba11677d397cc890ba0787f74ebb (commit)
commit 76a9bc38ff872d4825cbb5777e4a758362d2ff0c
Author: Paweł Forysiuk <tuxator at o2.pl>
Date: Fri Oct 7 21:07:21 2011 +0200
Introduce and use midori_view_save_speed_dial_config
midori/midori-browser.c | 12 +-----------
midori/midori-view.c | 33 ++++++++++++++++++++-------------
midori/midori-view.h | 4 ++++
3 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index 8f96d3b..2005c9c 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -1123,11 +1123,8 @@ midori_browser_add_speed_dial (MidoriBrowser* browser)
if ((img = midori_view_get_snapshot (MIDORI_VIEW (view), 240, 160)))
{
- gint i;
GKeyFile* key_file;
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 (uri);
gchar* thumb_dir = g_build_path (G_DIR_SEPARATOR_S, g_get_user_cache_dir (),
PACKAGE_NAME, "thumbnails", NULL);
@@ -1140,19 +1137,12 @@ midori_browser_add_speed_dial (MidoriBrowser* browser)
katze_mkdir_with_parents (thumb_dir, 0700);
gdk_pixbuf_save (img, file_path, "png", NULL, "compression", "7", NULL);
- sokoke_key_file_save_to_file (key_file, config_file, NULL);
-
- i = 0;
- while ((view = gtk_notebook_get_nth_page (GTK_NOTEBOOK (
- browser->notebook), i++)))
- if (midori_view_is_blank (MIDORI_VIEW (view)))
- midori_view_reload (MIDORI_VIEW (view), FALSE);
+ midori_view_save_speed_dial_config (MIDORI_VIEW (view), key_file);
g_object_unref (img);
g_free (file_path);
g_free (thumb_dir);
- g_free (config_file);
g_free (dial_id);
}
g_free (uri);
diff --git a/midori/midori-view.c b/midori/midori-view.c
index 7b54c4a..0e9aac3 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -5365,8 +5365,7 @@ thumb_view_load_status_cb (MidoriView* thumb_view,
gchar* thumb_dir;
gchar* thumb_uri;
MidoriBrowser* browser;
- gint i;
- GtkWidget* tab;
+ GKeyFile* key_file;
if (midori_view_get_load_status (thumb_view) != MIDORI_LOAD_FINISHED)
return;
@@ -5399,10 +5398,8 @@ thumb_view_load_status_cb (MidoriView* thumb_view,
#endif
browser = midori_browser_get_for_widget (GTK_WIDGET (view));
- i = 0;
- while ((tab = midori_browser_get_nth_tab (browser, i++)))
- if (midori_view_is_blank (MIDORI_VIEW (tab)))
- midori_view_reload (MIDORI_VIEW (tab), FALSE);
+ g_object_get (browser, "speed-dial", &key_file, NULL);
+ midori_view_save_speed_dial_config (view, key_file);
}
/**
@@ -5468,13 +5465,10 @@ midori_view_speed_dial_save (MidoriView* view,
const gchar* message)
{
gchar* action;
- gchar* config_file;
GKeyFile* key_file;
MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (view));
gchar* msg = g_strdup (message + 16);
gchar** parts = g_strsplit (msg, " ", 4);
- gint i;
- GtkWidget* tab;
g_object_get (browser, "speed-dial", &key_file, NULL);
action = parts[0];
@@ -5548,16 +5542,29 @@ midori_view_speed_dial_save (MidoriView* view,
g_free (dial_id);
}
+ midori_view_save_speed_dial_config (view, key_file);
+
+ g_free (msg);
+ g_free (action);
+}
+
+void
+midori_view_save_speed_dial_config (MidoriView* view,
+ GKeyFile* key_file)
+{
+ gchar* config_file;
+ guint i = 0;
+ MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (view));
+ GtkWidget* tab;
+
config_file = g_build_filename (sokoke_set_config_dir (NULL), "speeddial", NULL);
sokoke_key_file_save_to_file (key_file, config_file, NULL);
+ g_free (config_file);
+
katze_assign (speeddial_markup, prepare_speed_dial_html (view));
- i = 0;
while ((tab = midori_browser_get_nth_tab (browser, i++)))
if (midori_view_is_blank (MIDORI_VIEW (tab)))
midori_view_reload (MIDORI_VIEW (tab), FALSE);
- g_free (msg);
- g_free (action);
- g_free (config_file);
}
diff --git a/midori/midori-view.h b/midori/midori-view.h
index 9b8123d..b0246e3 100644
--- a/midori/midori-view.h
+++ b/midori/midori-view.h
@@ -248,6 +248,10 @@ midori_view_add_info_bar (MidoriView* view,
const gchar* first_button_text,
...);
+void
+midori_view_save_speed_dial_config (MidoriView* view,
+ GKeyFile* key_file);
+
G_END_DECLS
#endif /* __MIDORI_VIEW_H__ */
More information about the Xfce4-commits
mailing list