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); 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 static void
midori_browser_add_speed_dial (MidoriBrowser* browser) midori_browser_add_speed_dial (MidoriBrowser* browser)
{ {
@ -6943,6 +6954,9 @@ _midori_browser_update_settings (MidoriBrowser* browser)
#endif #endif
midori_findbar_set_close_button_left (MIDORI_FINDBAR (browser->find), midori_findbar_set_close_button_left (MIDORI_FINDBAR (browser->find),
katze_object_get_boolean (browser->settings, "close-buttons-left")); 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) 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), midori_findbar_set_close_button_left (MIDORI_FINDBAR (browser->find),
g_value_get_boolean (&value)); 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), else if (!g_object_class_find_property (G_OBJECT_GET_CLASS (web_settings),
name)) name))
@ -7347,6 +7363,8 @@ midori_browser_set_property (GObject* object,
break; break;
case PROP_SPEED_DIAL: case PROP_SPEED_DIAL:
browser->dial = g_value_get_pointer (value); browser->dial = g_value_get_pointer (value);
g_signal_connect (browser->dial, "refresh",
G_CALLBACK (midori_browser_speed_dial_refresh_cb), browser);
break; break;
case PROP_SHOW_TABS: case PROP_SHOW_TABS:
browser->show_tabs = g_value_get_boolean (value); browser->show_tabs = g_value_get_boolean (value);

View file

@ -20,12 +20,15 @@ namespace Sokoke {
namespace Midori { namespace Midori {
public class SpeedDial : GLib.Object { public class SpeedDial : GLib.Object {
string filename; string filename;
public GLib.KeyFile keyfile;
string? html = null; string? html = null;
List<Spec> thumb_queue = null; List<Spec> thumb_queue = null;
WebKit.WebView thumb_view = null; WebKit.WebView thumb_view = null;
Spec? spec = 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 class Spec {
public string dial_id; public string dial_id;
public string uri; public string uri;
@ -151,7 +154,7 @@ namespace Midori {
return Path.build_filename (Paths.get_cache_dir (), "thumbnails", thumbnail); 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; bool load_missing = true;
if (html != null) if (html != null)
@ -309,7 +312,7 @@ namespace Midori {
catch (Error error) { catch (Error error) {
critical ("Failed to update speed dial: %s", error.message); critical ("Failed to update speed dial: %s", error.message);
} }
/* FIXME Refresh all open views */ refresh ();
} }
void load_status (GLib.Object thumb_view_, ParamSpec pspec) { 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_string (view->item, "mime-type", NULL);
katze_item_set_meta_integer (view->item, "delay", -1); katze_item_set_meta_integer (view->item, "delay", -1);
html = midori_speed_dial_get_html (dial, html = midori_speed_dial_get_html (dial, NULL);
katze_object_get_boolean (view->settings, "close-buttons-left"),
G_OBJECT (view), NULL);
midori_view_load_alternate_string (view, html, "about:blank", NULL); midori_view_load_alternate_string (view, html, "about:blank", NULL);
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG