[Xfce4-commits] <midori:master> Refresh open speed dials when it changes

Christian Dywan noreply at xfce.org
Wed Sep 12 14:14:01 CEST 2012


Updating branch refs/heads/master
         to 886ad1b765663048d0602b259300cecdc305b36b (commit)
       from 2bdaf5057ec9352895c0664c94999a77de645f87 (commit)

commit 886ad1b765663048d0602b259300cecdc305b36b
Author: Christian Dywan <christian at twotoasts.de>
Date:   Tue Sep 11 01:34:14 2012 +0200

    Refresh open speed dials when it changes

 midori/midori-browser.c      |   18 ++++++++++++++++++
 midori/midori-speeddial.vala |    9 ++++++---
 midori/midori-view.c         |    4 +---
 3 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index a2d7ea2..b6271af 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -1119,6 +1119,17 @@ midori_view_save_as_cb (GtkWidget*   menuitem,
 }
 
 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)
 {
     GdkPixbuf* img;
@@ -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 309f9f1..07eef4c 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<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) {
diff --git a/midori/midori-view.c b/midori/midori-view.c
index 22e1637..ebe8693 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


More information about the Xfce4-commits mailing list