Commit 60e58366 authored by Nelson Ben's avatar Nelson Ben 👣 Committed by Cosimo Cecchi

Use g_timeout_add_seconds where appropriate

Use g_timeout_add_seconds instead of g_timeout_add where appropriate.
Fix bug #574033.
Signed-off-by: Cosimo Cecchi's avatarCosimo Cecchi <cosimoc@gnome.org>
parent 99e66a93
......@@ -145,7 +145,7 @@
#define SNAP_CEIL_VERTICAL(y) SNAP_VERTICAL (ceil, y)
/* Copied from NautilusIconContainer */
#define NAUTILUS_ICON_CONTAINER_SEARCH_DIALOG_TIMEOUT 5000
#define NAUTILUS_ICON_CONTAINER_SEARCH_DIALOG_TIMEOUT 5
/* Copied from NautilusFile */
#define UNDEFINED_TIME ((time_t) (-1))
......@@ -4903,7 +4903,7 @@ nautilus_icon_container_search_preedit_changed (GtkIMContext *im_context,
if (container->details->typeselect_flush_timeout) {
g_source_remove (container->details->typeselect_flush_timeout);
container->details->typeselect_flush_timeout =
g_timeout_add (NAUTILUS_ICON_CONTAINER_SEARCH_DIALOG_TIMEOUT,
g_timeout_add_seconds (NAUTILUS_ICON_CONTAINER_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) nautilus_icon_container_search_entry_flush_timeout,
container);
}
......@@ -5100,7 +5100,7 @@ nautilus_icon_container_search_scroll_event (GtkWidget *widget,
if (retval && container->details->typeselect_flush_timeout) {
g_source_remove (container->details->typeselect_flush_timeout);
container->details->typeselect_flush_timeout =
g_timeout_add (NAUTILUS_ICON_CONTAINER_SEARCH_DIALOG_TIMEOUT,
g_timeout_add_seconds (NAUTILUS_ICON_CONTAINER_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) nautilus_icon_container_search_entry_flush_timeout,
container);
}
......@@ -5161,7 +5161,7 @@ nautilus_icon_container_search_key_press_event (GtkWidget *widget,
if (retval && container->details->typeselect_flush_timeout) {
g_source_remove (container->details->typeselect_flush_timeout);
container->details->typeselect_flush_timeout =
g_timeout_add (NAUTILUS_ICON_CONTAINER_SEARCH_DIALOG_TIMEOUT,
g_timeout_add_seconds (NAUTILUS_ICON_CONTAINER_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) nautilus_icon_container_search_entry_flush_timeout,
container);
}
......@@ -5189,7 +5189,7 @@ nautilus_icon_container_search_init (GtkWidget *entry,
{
g_source_remove (container->details->typeselect_flush_timeout);
container->details->typeselect_flush_timeout =
g_timeout_add (NAUTILUS_ICON_CONTAINER_SEARCH_DIALOG_TIMEOUT,
g_timeout_add_seconds (NAUTILUS_ICON_CONTAINER_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) nautilus_icon_container_search_entry_flush_timeout,
container);
}
......@@ -5301,7 +5301,7 @@ nautilus_icon_container_real_start_interactive_search (NautilusIconContainer *co
}
container->details->typeselect_flush_timeout =
g_timeout_add (NAUTILUS_ICON_CONTAINER_SEARCH_DIALOG_TIMEOUT,
g_timeout_add_seconds (NAUTILUS_ICON_CONTAINER_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) nautilus_icon_container_search_entry_flush_timeout,
container);
......
......@@ -979,7 +979,7 @@ thumbnail_thread_start (gpointer data)
info->image_uri);
#endif
/* Reschedule thumbnailing via a change notification */
g_timeout_add (1000, thumbnail_thread_notify_file_changed,
g_timeout_add_seconds (1, thumbnail_thread_notify_file_changed,
g_strdup (info->image_uri));
continue;
}
......
......@@ -44,7 +44,7 @@
#define AUTO_SCROLL_MARGIN 20
#define HOVER_EXPAND_TIMEOUT 1000
#define HOVER_EXPAND_TIMEOUT 1
struct _NautilusTreeViewDragDestDetails {
GtkTreeView *tree_view;
......@@ -491,7 +491,7 @@ drag_motion_callback (GtkWidget *widget,
if (dest->details->expand_id == 0 && drop_path != NULL) {
gtk_tree_model_get_iter (model, &drop_iter, drop_path);
if (gtk_tree_model_iter_has_child (model, &drop_iter)) {
dest->details->expand_id = g_timeout_add (HOVER_EXPAND_TIMEOUT,
dest->details->expand_id = g_timeout_add_seconds (HOVER_EXPAND_TIMEOUT,
expand_timeout,
dest->details->tree_view);
}
......
......@@ -32,9 +32,9 @@
typedef struct _ExpiringCache ExpiringCache;
/* times in milliseconds */
#define USERS_CACHE_EXPIRE_TIME (60 * 1000)
#define GROUPS_CACHE_EXPIRE_TIME (60 * 1000)
/* times in seconds */
#define USERS_CACHE_EXPIRE_TIME 60
#define GROUPS_CACHE_EXPIRE_TIME 60
/* cache of users' names */
static ExpiringCache *users_cache = NULL;
......@@ -136,7 +136,7 @@ expiring_cache_get_value (ExpiringCache *cache, guint key)
NULL, (gpointer) &entry)) {
entry = expiring_cache_entry_new (cache, key, cache->get_value_func (key));
g_hash_table_insert (cache->cached_values, GSIZE_TO_POINTER (key), entry);
g_timeout_add (cache->expire_time, (GSourceFunc) cb_cache_entry_expired, entry);
g_timeout_add_seconds (cache->expire_time, (GSourceFunc) cb_cache_entry_expired, entry);
}
return entry->value;
......
......@@ -65,7 +65,7 @@
#include <unistd.h>
/* Timeout to check the desktop directory for updates */
#define RESCAN_TIMEOUT 4000
#define RESCAN_TIMEOUT 4
struct FMDesktopIconViewDetails
{
......@@ -480,7 +480,7 @@ delayed_init (FMDesktopIconView *desktop_icon_view)
/* Monitor desktop directory. */
desktop_icon_view->details->reload_desktop_timeout =
g_timeout_add (RESCAN_TIMEOUT, do_desktop_rescan, desktop_icon_view);
g_timeout_add_seconds (RESCAN_TIMEOUT, do_desktop_rescan, desktop_icon_view);
g_signal_handler_disconnect (desktop_icon_view,
desktop_icon_view->details->delayed_init_signal);
......
......@@ -1991,7 +1991,7 @@ preview_audio (FMIconView *icon_view, NautilusFile *file, gboolean start_flag)
if (start_flag) {
icon_view->details->audio_preview_file = file;
icon_view->details->audio_preview_timeout = g_timeout_add (1000, play_file, icon_view);
icon_view->details->audio_preview_timeout = g_timeout_add_seconds (1, play_file, icon_view);
}
}
......
......@@ -120,7 +120,7 @@ struct SelectionForeachData {
#define LIST_VIEW_MINIMUM_ROW_HEIGHT 28
/* We wait two seconds after row is collapsed to unload the subdirectory */
#define COLLAPSE_TO_UNLOAD_DELAY 2000
#define COLLAPSE_TO_UNLOAD_DELAY 2
/* Wait for the rename to end when activating a file being renamed */
#define WAIT_FOR_RENAME_ON_ACTIVATE 200
......@@ -890,7 +890,7 @@ row_collapsed_callback (GtkTreeView *treeview, GtkTreeIter *iter, GtkTreePath *p
eel_add_weak_pointer (&unload_data->view);
g_timeout_add (COLLAPSE_TO_UNLOAD_DELAY,
g_timeout_add_seconds (COLLAPSE_TO_UNLOAD_DELAY,
unload_file_timeout,
unload_data);
}
......
......@@ -46,7 +46,7 @@
#include <libnautilus-private/nautilus-window-slot-info.h>
#include <libnautilus-extension/nautilus-property-page-provider.h>
#define SAVE_TIMEOUT (3 * 1000)
#define SAVE_TIMEOUT 3
static void load_note_text_from_metadata (NautilusFile *file,
NautilusNotesViewer *notes);
......@@ -124,7 +124,7 @@ schedule_save (NautilusNotesViewer *notes)
{
cancel_pending_save (notes);
notes->details->save_timeout_id = g_timeout_add (SAVE_TIMEOUT, schedule_save_callback, notes);
notes->details->save_timeout_id = g_timeout_add_seconds (SAVE_TIMEOUT, schedule_save_callback, notes);
}
/* notifies event listeners if the notes data actually changed */
......
......@@ -154,7 +154,7 @@ nautilus_spatial_window_configure_event (GtkWidget *widget,
window->details->last_geometry = geometry_string;
window->details->save_geometry_timeout_id =
g_timeout_add (1000, save_window_geometry_timeout, window);
g_timeout_add_seconds (1, save_window_geometry_timeout, window);
}
return FALSE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment