[Xfce4-commits] <midori:master> Support Midori.Test.idle_timeouts for non-second timeouts

Christian Dywan noreply at xfce.org
Sat Dec 8 03:32:01 CET 2012


Updating branch refs/heads/master
         to 77b28d2af643daa48d4ed430cd0daca5b21fa267 (commit)
       from 069f40165631be20f26a0abdbf1371e68e01a491 (commit)

commit 77b28d2af643daa48d4ed430cd0daca5b21fa267
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat Dec 8 02:11:15 2012 +0100

    Support Midori.Test.idle_timeouts for non-second timeouts

 extensions/delayed-load.vala                       |    4 ++--
 extensions/formhistory/formhistory-gdom-frontend.c |    4 ++--
 katze/katze-scrolled.c                             |    4 +++-
 katze/katze-throbber.c                             |    8 +++-----
 midori/midori-browser.c                            |    7 ++++---
 midori/midori-dialog.vala                          |    5 +++++
 panels/midori-bookmarks.c                          |    4 ++--
 panels/midori-history.c                            |    4 ++--
 8 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/extensions/delayed-load.vala b/extensions/delayed-load.vala
index 2cc2b31..1ff2803 100644
--- a/extensions/delayed-load.vala
+++ b/extensions/delayed-load.vala
@@ -126,7 +126,7 @@ namespace DelayedLoad {
                 unowned TabShaker shaker = tasks.get (browser);
                 if (shaker != null) {
                     shaker.tasks.add (view);
-                    Timeout.add (this.timeout, shaker.reload_tab);
+                    Midori.Timeout.add (this.timeout, shaker.reload_tab);
                 }
             }
         }
@@ -189,7 +189,7 @@ namespace DelayedLoad {
 
             Midori.Browser? focused_browser = app.browser;
             if (focused_browser == null)
-                Timeout.add (50, this.reload_first_tab);
+                Midori.Timeout.add (50, this.reload_first_tab);
 
             foreach (Midori.Browser browser in app.get_browsers ()) {
                 browser_added (browser);
diff --git a/extensions/formhistory/formhistory-gdom-frontend.c b/extensions/formhistory/formhistory-gdom-frontend.c
index b601f35..3d1d05e 100644
--- a/extensions/formhistory/formhistory-gdom-frontend.c
+++ b/extensions/formhistory/formhistory-gdom-frontend.c
@@ -365,8 +365,8 @@ formhistory_editbox_key_pressed_cb (WebKitDOMElement* element,
     if (gtk_widget_get_visible (priv->popup) &&
         !g_strcmp0 (keyword, priv->oldkeyword))
         goto free_data;
-    priv->completion_timeout = g_timeout_add (COMPLETION_DELAY,
-                               (GSourceFunc)formhistory_suggestions_show, priv);
+    priv->completion_timeout = midori_timeout_add (COMPLETION_DELAY,
+        (GSourceFunc)formhistory_suggestions_show, priv, NULL);
 free_data:
     g_free (keyword);
 }
diff --git a/katze/katze-scrolled.c b/katze/katze-scrolled.c
index 582142a..0b2d7da 100644
--- a/katze/katze-scrolled.c
+++ b/katze/katze-scrolled.c
@@ -17,6 +17,7 @@
 
 #include "katze-scrolled.h"
 #include "katze-utils.h"
+#include "midori/midori-core.h"
 
 #define DEFAULT_INTERVAL 50
 #define DEFAULT_DECELERATION 0.7
@@ -531,7 +532,8 @@ button_release_event (GtkWidget*      widget,
             priv->horizontal_deceleration = priv->deceleration;
             priv->vertical_deceleration = priv->deceleration * ABS (priv->vertical_speed / priv->horizontal_speed);
         }
-        priv->scrolling_timeout_id = g_timeout_add (priv->interval, timeout_scroll, scrolled);
+        priv->scrolling_timeout_id = midori_timeout_add (priv->interval,
+            timeout_scroll, scrolled, NULL);
 
         do_timeout_scroll (scrolled);
     }
diff --git a/katze/katze-throbber.c b/katze/katze-throbber.c
index 85c206f..0f9f616 100644
--- a/katze/katze-throbber.c
+++ b/katze/katze-throbber.c
@@ -490,11 +490,9 @@ katze_throbber_set_animated (KatzeThrobber*  throbber,
     g_object_set (throbber, "active", animated, NULL);
     #else
     if (animated && (throbber->timer_id < 0))
-        throbber->timer_id = g_timeout_add_full (
-                         G_PRIORITY_LOW, 50,
-                         (GSourceFunc)katze_throbber_timeout,
-                         throbber,
-                         (GDestroyNotify)katze_throbber_timeout_destroy);
+        throbber->timer_id = midori_timeout_add (50,
+            (GSourceFunc)katze_throbber_timeout, throbber,
+            (GDestroyNotify)katze_throbber_timeout_destroy);
     #endif
     gtk_widget_queue_draw (GTK_WIDGET (throbber));
 
diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index df60c75..0d5ff7a 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -1195,7 +1195,8 @@ midori_browser_notify_new_tab (MidoriBrowser* browser)
         #ifndef G_OS_WIN32
         gtk_window_set_opacity (GTK_WINDOW (browser), 0.8);
         #endif
-        g_timeout_add (100, (GSourceFunc) midori_browser_notify_new_tab_timeout_cb, browser);
+        midori_timeout_add (100,
+            (GSourceFunc) midori_browser_notify_new_tab_timeout_cb, browser, NULL);
     }
 }
 
@@ -4768,7 +4769,7 @@ midori_panel_notify_position_cb (GObject*       hpaned,
                                  MidoriBrowser* browser)
 {
     if (!browser->panel_timeout)
-        browser->panel_timeout = g_timeout_add_full (G_PRIORITY_LOW, 5000,
+        browser->panel_timeout = midori_timeout_add_seconds (5,
             (GSourceFunc)midori_browser_panel_timeout, hpaned, NULL);
 }
 
@@ -5563,7 +5564,7 @@ midori_browser_size_allocate_cb (MidoriBrowser* browser,
             g_object_set_data (G_OBJECT (browser), "last-page", NULL);
         }
 
-        browser->alloc_timeout = g_timeout_add_full (G_PRIORITY_LOW, 5000,
+        browser->alloc_timeout = midori_timeout_add_seconds (5,
             (GSourceFunc)midori_browser_alloc_timeout, browser, NULL);
     }
 }
diff --git a/midori/midori-dialog.vala b/midori/midori-dialog.vala
index 5fd4611..d8c7146 100644
--- a/midori/midori-dialog.vala
+++ b/midori/midori-dialog.vala
@@ -16,6 +16,11 @@ namespace Midori {
                 return GLib.Idle.add (function);
             return GLib.Timeout.add_seconds (interval, function);
         }
+        public uint add (uint interval, owned SourceFunc function) {
+            if (Test.test_idle_timeouts)
+                return GLib.Idle.add (function);
+            return GLib.Timeout.add (interval, function);
+        }
     }
 
     namespace Test {
diff --git a/panels/midori-bookmarks.c b/panels/midori-bookmarks.c
index eb8347a..69d3df3 100644
--- a/panels/midori-bookmarks.c
+++ b/panels/midori-bookmarks.c
@@ -997,8 +997,8 @@ midori_bookmarks_filter_entry_changed_cb (GtkEntry*        entry,
     else
         katze_assign (bookmarks->filter, NULL);
 
-    bookmarks->filter_timeout = g_timeout_add (COMPLETION_DELAY,
-        midori_bookmarks_filter_timeout_cb, bookmarks);
+    bookmarks->filter_timeout = midori_timeout_add (COMPLETION_DELAY,
+        midori_bookmarks_filter_timeout_cb, bookmarks, NULL);
 }
 
 static void
diff --git a/panels/midori-history.c b/panels/midori-history.c
index fa7b7ec..4f1574d 100644
--- a/panels/midori-history.c
+++ b/panels/midori-history.c
@@ -956,8 +956,8 @@ midori_history_filter_entry_changed_cb (GtkEntry*      entry,
 {
     if (history->filter_timeout)
         g_source_remove (history->filter_timeout);
-    history->filter_timeout = g_timeout_add (COMPLETION_DELAY,
-        midori_history_filter_timeout_cb, history);
+    history->filter_timeout = midori_timeout_add (COMPLETION_DELAY,
+        midori_history_filter_timeout_cb, history, NULL);
 
     if (!g_object_get_data (G_OBJECT (entry), "sokoke_has_default"))
         katze_assign (history->filter, g_strdup (gtk_entry_get_text (entry)));


More information about the Xfce4-commits mailing list