[nautilus] Use g_timeout_add_seconds where appropriate



commit 60e58366e06f42b03072e06a19f8adeece0ded6a
Author: Nelson Benitez <nbenitezl gmail com>
Date:   Tue Apr 21 15:37:34 2009 +0200

    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 <cosimoc gnome org>
---
 libnautilus-private/nautilus-icon-container.c      |   12 ++++++------
 libnautilus-private/nautilus-thumbnails.c          |    2 +-
 libnautilus-private/nautilus-tree-view-drag-dest.c |    4 ++--
 libnautilus-private/nautilus-users-groups-cache.c  |    8 ++++----
 src/file-manager/fm-desktop-icon-view.c            |    4 ++--
 src/file-manager/fm-icon-view.c                    |    2 +-
 src/file-manager/fm-list-view.c                    |    4 ++--
 src/nautilus-notes-viewer.c                        |    4 ++--
 src/nautilus-spatial-window.c                      |    2 +-
 9 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c
index d83a1b6..7bf4c12 100644
--- a/libnautilus-private/nautilus-icon-container.c
+++ b/libnautilus-private/nautilus-icon-container.c
@@ -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);
 
diff --git a/libnautilus-private/nautilus-thumbnails.c b/libnautilus-private/nautilus-thumbnails.c
index f064135..75be343 100644
--- a/libnautilus-private/nautilus-thumbnails.c
+++ b/libnautilus-private/nautilus-thumbnails.c
@@ -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;
 		}
diff --git a/libnautilus-private/nautilus-tree-view-drag-dest.c b/libnautilus-private/nautilus-tree-view-drag-dest.c
index e747268..ff77d48 100644
--- a/libnautilus-private/nautilus-tree-view-drag-dest.c
+++ b/libnautilus-private/nautilus-tree-view-drag-dest.c
@@ -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);
 			}
diff --git a/libnautilus-private/nautilus-users-groups-cache.c b/libnautilus-private/nautilus-users-groups-cache.c
index 18ae3bd..c0f313a 100644
--- a/libnautilus-private/nautilus-users-groups-cache.c
+++ b/libnautilus-private/nautilus-users-groups-cache.c
@@ -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;
diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c
index 6c43a07..0804598 100644
--- a/src/file-manager/fm-desktop-icon-view.c
+++ b/src/file-manager/fm-desktop-icon-view.c
@@ -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);
diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c
index 55e90d5..2fa2336 100644
--- a/src/file-manager/fm-icon-view.c
+++ b/src/file-manager/fm-icon-view.c
@@ -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);
 	}
 }
 
diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c
index ca37860..86f6ebd 100644
--- a/src/file-manager/fm-list-view.c
+++ b/src/file-manager/fm-list-view.c
@@ -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);
 }
diff --git a/src/nautilus-notes-viewer.c b/src/nautilus-notes-viewer.c
index 6bdecd8..894dc2d 100644
--- a/src/nautilus-notes-viewer.c
+++ b/src/nautilus-notes-viewer.c
@@ -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 */
diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c
index 176db5d..692a0ad 100644
--- a/src/nautilus-spatial-window.c
+++ b/src/nautilus-spatial-window.c
@@ -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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]