Refresh open speed dials when it changes

This commit is contained in:
Christian Dywan 2012-09-11 01:34:14 +02:00
parent 2bdaf5057e
commit 886ad1b765
3 changed files with 25 additions and 6 deletions

View file

@ -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);

View file

@ -20,12 +20,15 @@ namespace Sokoke {
namespace Midori {
public class SpeedDial : GLib.Object {
string filename;
public GLib.KeyFile keyfile;
string? html = null;
List<Spec> 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) {

View file

@ -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