From: Christian Dywan Date: Mon, 10 Sep 2012 23:34:14 +0000 (+0200) Subject: Refresh open speed dials when it changes X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=886ad1b765663048d0602b259300cecdc305b36b;p=midori Refresh open speed dials when it changes --- diff --git a/midori/midori-browser.c b/midori/midori-browser.c index a2d7ea24..b6271af9 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -1118,6 +1118,17 @@ midori_view_save_as_cb (GtkWidget* menuitem, midori_browser_save_uri (browser, MIDORI_VIEW (view), uri); } +static void +midori_browser_speed_dial_refresh_cb (MidoriSpeedDial* dial, + MidoriBrowser* browser) +{ + GList* tabs = midori_browser_get_tabs (browser); + for (; tabs != NULL; tabs = g_list_next (tabs)) + if (midori_view_is_blank (tabs->data)) + midori_view_reload (tabs->data, FALSE); + g_list_free (tabs); +} + static void midori_browser_add_speed_dial (MidoriBrowser* browser) { @@ -6943,6 +6954,9 @@ _midori_browser_update_settings (MidoriBrowser* browser) #endif midori_findbar_set_close_button_left (MIDORI_FINDBAR (browser->find), katze_object_get_boolean (browser->settings, "close-buttons-left")); + if (browser->dial != NULL) + midori_speed_dial_set_close_buttons_left (browser->dial, + katze_object_get_boolean (browser->settings, "close-buttons-left")); if (remember_last_window_size) { @@ -7084,6 +7098,8 @@ midori_browser_settings_notify (MidoriWebSettings* web_settings, { midori_findbar_set_close_button_left (MIDORI_FINDBAR (browser->find), g_value_get_boolean (&value)); + midori_speed_dial_set_close_buttons_left (browser->dial, + katze_object_get_boolean (browser->settings, "close-buttons-left")); } else if (!g_object_class_find_property (G_OBJECT_GET_CLASS (web_settings), name)) @@ -7347,6 +7363,8 @@ midori_browser_set_property (GObject* object, break; case PROP_SPEED_DIAL: browser->dial = g_value_get_pointer (value); + g_signal_connect (browser->dial, "refresh", + G_CALLBACK (midori_browser_speed_dial_refresh_cb), browser); break; case PROP_SHOW_TABS: browser->show_tabs = g_value_get_boolean (value); diff --git a/midori/midori-speeddial.vala b/midori/midori-speeddial.vala index 309f9f17..07eef4c9 100644 --- a/midori/midori-speeddial.vala +++ b/midori/midori-speeddial.vala @@ -20,12 +20,15 @@ namespace Sokoke { namespace Midori { public class SpeedDial : GLib.Object { string filename; - public GLib.KeyFile keyfile; string? html = null; List thumb_queue = null; WebKit.WebView thumb_view = null; Spec? spec = null; + public GLib.KeyFile keyfile; + public bool close_buttons_left { get; set; default = false; } + public signal void refresh (); + public class Spec { public string dial_id; public string uri; @@ -151,7 +154,7 @@ namespace Midori { return Path.build_filename (Paths.get_cache_dir (), "thumbnails", thumbnail); } - public unowned string get_html (bool close_buttons_left, GLib.Object view) throws Error { + public unowned string get_html () throws Error { bool load_missing = true; if (html != null) @@ -309,7 +312,7 @@ namespace Midori { catch (Error error) { critical ("Failed to update speed dial: %s", error.message); } - /* FIXME Refresh all open views */ + refresh (); } void load_status (GLib.Object thumb_view_, ParamSpec pspec) { diff --git a/midori/midori-view.c b/midori/midori-view.c index 22e1637c..ebe8693f 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -4249,9 +4249,7 @@ midori_view_set_uri (MidoriView* view, katze_item_set_meta_string (view->item, "mime-type", NULL); katze_item_set_meta_integer (view->item, "delay", -1); - html = midori_speed_dial_get_html (dial, - katze_object_get_boolean (view->settings, "close-buttons-left"), - G_OBJECT (view), NULL); + html = midori_speed_dial_get_html (dial, NULL); midori_view_load_alternate_string (view, html, "about:blank", NULL); #ifdef G_ENABLE_DEBUG