[monkey-bubble: 325/753] Moved the async stuff to gnome-async-context.[ch].



commit 601690f672040d88ce35dd4a854f907305c1030b
Author: Martin Baulig <baulig suse de>
Date:   Fri May 25 14:08:26 2001 +0000

    Moved the async stuff to gnome-async-context.[ch].
    
    2001-05-25  Martin Baulig  <baulig suse de>
    
    	* gnome-selector.h, gnome-selectorP.h: Moved the async stuff to
    	gnome-async-context.[ch].
    
    	* gnome-async-context.[ch]: New files.
    
    	* gnome-directory-filter.[ch]: New files.

 libgnome/ChangeLog                |    9 ++
 libgnome/Makefile.am              |    4 +
 libgnome/gnome-directory-filter.c |  187 +++++++++++++++++++++++++++++++++++++
 libgnome/gnome-directory-filter.h |   77 +++++++++++++++
 libgnome/gnome-file-selector.c    |  157 +++++++++++++++----------------
 5 files changed, 355 insertions(+), 79 deletions(-)
---
diff --git a/libgnome/ChangeLog b/libgnome/ChangeLog
index ff20dc7..f28a6f7 100644
--- a/libgnome/ChangeLog
+++ b/libgnome/ChangeLog
@@ -1,3 +1,12 @@
+2001-05-25  Martin Baulig  <baulig suse de>
+
+	* gnome-selector.h, gnome-selectorP.h: Moved the async stuff to
+	gnome-async-context.[ch].
+
+	* gnome-async-context.[ch]: New files.
+
+	* gnome-directory-filter.[ch]: New files.
+
 2001-05-23  Martin Baulig  <baulig suse de>
 
 	* gnome-selector-factory.c (create_selector_handler): Read values
diff --git a/libgnome/Makefile.am b/libgnome/Makefile.am
index f05164a..93738e1 100644
--- a/libgnome/Makefile.am
+++ b/libgnome/Makefile.am
@@ -55,11 +55,13 @@ $(CORBA_SOURCE): $(idls) $(ORBIT_IDL)
 libgnome_src = \
 	libgnometypebuiltins.h	\
 	libgnometypebuiltins.c	\
+	gnome-async-context.c	\
 	gnome-program.c		\
 	gnome-selector.c	\
 	gnome-file-selector.c	\
 	gnome-selector-factory.c\
 	gnome-selector-dialog.c	\
+	gnome-directory-filter.c\
 	gnome-config.c		\
 	gnome-ditem.c		\
 	gnome-exec.c		\
@@ -84,6 +86,7 @@ libgnome_2_la_SOURCES = \
 	$(CORBA_SOURCE)
 
 libgnome_headers = \
+	gnome-async-context.h	\
 	gnome-program.h		\
 	gnome-i18n.h		\
         gnome-config.h 		\
@@ -104,6 +107,7 @@ libgnome_headers = \
 	gnome-file-selector.h	\
 	gnome-selector-factory.h\
 	gnome-selector-dialog.h	\
+	gnome-directory-filter.h\
 	libgnome-init.h		\
 	libgnome.h
 
diff --git a/libgnome/gnome-directory-filter.c b/libgnome/gnome-directory-filter.c
new file mode 100644
index 0000000..d2c2b77
--- /dev/null
+++ b/libgnome/gnome-directory-filter.c
@@ -0,0 +1,187 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * Copyright (C) 2001 SuSE Linux AG
+ * Author: Martin Baulig <baulig suse de>
+ *
+ * This file is part of the Gnome Library.
+ *
+ * The Gnome Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Gnome Library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Gnome Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/*
+  @NOTATION@
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <gobject/gsignal.h>
+#include <libgnome/gnome-marshal.h>
+#include <libgnome/gnome-directory-filter.h>
+#include <libgnome/gnome-async-context.h>
+
+struct _GnomeDirectoryFilterPrivate {
+    BonoboEventSource *event_source;
+    GnomeAsyncContext *async_ctx;
+};
+
+static void gnome_directory_filter_class_init   (GnomeDirectoryFilterClass *class);
+static void gnome_directory_filter_init         (GnomeDirectoryFilter      *filter);
+static void gnome_directory_filter_finalize     (GObject                   *object);
+
+#define PARENT_TYPE BONOBO_OBJECT_TYPE
+BonoboObjectClass *gnome_directory_filter_parent_class = NULL;
+
+enum {
+    CHECK_URI_SIGNAL,
+    SCAN_DIRECTORY_SIGNAL,
+    LAST_SIGNAL
+};
+
+static int gnome_directory_filter_signals [LAST_SIGNAL] = {0};
+
+static Bonobo_EventSource
+impl_GNOME_DirectoryFilter_getEventSource (PortableServer_Servant servant,
+					   CORBA_Environment * ev)
+{
+    GnomeDirectoryFilter *filter = GNOME_DIRECTORY_FILTER (bonobo_object_from_servant (servant));
+    Bonobo_EventSource corba_es;
+
+    corba_es = BONOBO_OBJREF (filter->_priv->event_source);
+
+    return bonobo_object_dup_ref (corba_es, ev);
+}
+
+static void
+check_uri_async_cb (GnomeAsyncContext *async_ctx, GnomeAsyncHandle *async_handle,
+		    GnomeAsyncType async_type, GObject *object,
+		    const gchar *uri, const gchar *error, gboolean success, gpointer user_data)
+{
+    g_message (G_STRLOC);
+}
+
+static void
+impl_GNOME_DirectoryFilter_checkURI (PortableServer_Servant servant,
+				     const CORBA_char * uri, CORBA_Environment * ev)
+{
+    GnomeDirectoryFilter *filter = GNOME_DIRECTORY_FILTER (bonobo_object_from_servant (servant));
+    GnomeAsyncHandle *async_handle;
+
+    async_handle = gnome_async_context_get (filter->_priv->async_ctx, 0, check_uri_async_cb,
+					    G_OBJECT (filter), NULL, NULL, NULL);
+
+    g_signal_emit (G_OBJECT (filter),
+		   gnome_directory_filter_signals [CHECK_URI_SIGNAL], 0,
+		   uri, async_handle);
+}
+
+static void
+impl_GNOME_DirectoryFilter_scanDirectory (PortableServer_Servant servant,
+					  const CORBA_char * directory,
+					  CORBA_Environment * ev)
+{
+}
+
+static void
+gnome_directory_filter_check_uri (GnomeDirectoryFilter *filter, const gchar *uri,
+				  GnomeAsyncHandle *async_handle)
+{
+    g_message (G_STRLOC ": `%s'", uri);
+
+    gnome_async_handle_completed (async_handle, FALSE);
+}
+
+static void
+gnome_directory_filter_class_init (GnomeDirectoryFilterClass *klass)
+{
+    GObjectClass *object_class;
+    POA_GNOME_DirectoryFilter__epv *epv = &klass->epv;
+
+    object_class = (GObjectClass *) klass;
+
+    gnome_directory_filter_parent_class = g_type_class_peek_parent (klass);
+
+    gnome_directory_filter_signals [CHECK_URI_SIGNAL] =
+	g_signal_newc ("check_uri",
+		       G_TYPE_FROM_CLASS (object_class),
+		       G_SIGNAL_RUN_LAST,
+		       G_STRUCT_OFFSET (GnomeDirectoryFilterClass,
+					check_uri),
+		       NULL, NULL,
+		       gnome_marshal_VOID__STRING_BOXED,
+		       G_TYPE_NONE, 2,
+		       G_TYPE_STRING,
+		       GNOME_TYPE_ASYNC_HANDLE);
+
+    gnome_directory_filter_signals [SCAN_DIRECTORY_SIGNAL] =
+	g_signal_newc ("scan_directory",
+		       G_TYPE_FROM_CLASS (object_class),
+		       G_SIGNAL_RUN_LAST,
+		       G_STRUCT_OFFSET (GnomeDirectoryFilterClass,
+					check_uri),
+		       NULL, NULL,
+		       gnome_marshal_VOID__STRING_BOXED,
+		       G_TYPE_NONE, 2,
+		       G_TYPE_STRING,
+		       GNOME_TYPE_ASYNC_HANDLE);
+
+    epv->getEventSource = impl_GNOME_DirectoryFilter_getEventSource;
+    epv->checkURI = impl_GNOME_DirectoryFilter_checkURI;
+    epv->scanDirectory = impl_GNOME_DirectoryFilter_scanDirectory;
+
+    klass->check_uri = gnome_directory_filter_check_uri;
+
+    object_class->finalize = gnome_directory_filter_finalize;
+}
+
+static void
+gnome_directory_filter_init (GnomeDirectoryFilter *filter)
+{
+    filter->_priv = g_new0 (GnomeDirectoryFilterPrivate, 1);
+}
+
+static void
+gnome_directory_filter_finalize (GObject *object)
+{
+    GnomeDirectoryFilter *filter;
+
+    g_return_if_fail (object != NULL);
+    g_return_if_fail (GNOME_IS_DIRECTORY_FILTER (object));
+
+    filter = GNOME_DIRECTORY_FILTER (object);
+
+    g_free (filter->_priv);
+    filter->_priv = NULL;
+
+    if (G_OBJECT_CLASS (gnome_directory_filter_parent_class)->finalize)
+	(* G_OBJECT_CLASS (gnome_directory_filter_parent_class)->finalize) (object);
+}
+
+GnomeDirectoryFilter *
+gnome_directory_filter_new (void)
+{
+    GnomeDirectoryFilter *filter;
+
+    filter = g_object_new (gnome_directory_filter_get_type (), NULL);
+
+    filter->_priv->event_source = bonobo_event_source_new ();
+    filter->_priv->async_ctx = gnome_async_context_new ();
+
+    return filter;
+}
+
+BONOBO_TYPE_FUNC_FULL (GnomeDirectoryFilter, GNOME_DirectoryFilter,
+		       PARENT_TYPE, gnome_directory_filter);
diff --git a/libgnome/gnome-directory-filter.h b/libgnome/gnome-directory-filter.h
new file mode 100644
index 0000000..3f47f46
--- /dev/null
+++ b/libgnome/gnome-directory-filter.h
@@ -0,0 +1,77 @@
+/* -*- Mode: C; c-set-style: gnu indent-tabs-mode: t; c-basic-offset: 4; tab-width: 8 -*- */
+/*
+ * Copyright (C) 2001 SuSE Linux AG
+ * Author: Martin Baulig <baulig suse de>
+ *
+ * This file is part of the Gnome Library.
+ *
+ * The Gnome Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * The Gnome Library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with the Gnome Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/*
+  @NOTATION@
+ */
+
+#ifndef GNOME_DIRECTORY_FILTER_H
+#define GNOME_DIRECTORY_FILTER_H
+
+
+#include <libgnome/gnome-async-context.h>
+
+
+G_BEGIN_DECLS
+
+
+#define GNOME_TYPE_DIRECTORY_FILTER            (gnome_directory_filter_get_type ())
+#define GNOME_DIRECTORY_FILTER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_DIRECTORY_FILTER, GnomeDirectoryFilter))
+#define GNOME_DIRECTORY_FILTER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_DIRECTORY_FILTER, GnomeDirectoryFilterClass))
+#define GNOME_IS_DIRECTORY_FILTER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_DIRECTORY_FILTER))
+#define GNOME_IS_DIRECTORY_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_DIRECTORY_FILTER))
+#define GNOME_DIRECTORY_FILTER_GET_CLASS(obj)  (GNOME_DIRECTORY_FILTER_CLASS (G_OBJECT_GET_CLASS (obj)))
+
+
+typedef struct _GnomeDirectoryFilter           GnomeDirectoryFilter;
+typedef struct _GnomeDirectoryFilterPrivate    GnomeDirectoryFilterPrivate;
+typedef struct _GnomeDirectoryFilterClass      GnomeDirectoryFilterClass;
+
+struct _GnomeDirectoryFilter {
+    BonoboObject object;
+        
+    /*< private >*/
+    GnomeDirectoryFilterPrivate *_priv;
+};
+
+struct _GnomeDirectoryFilterClass {
+    BonoboObjectClass parent_class;
+
+    POA_GNOME_DirectoryFilter__epv epv;
+
+    void     (*check_uri)             (GnomeDirectoryFilter     *filter,
+                                       const gchar              *uri,
+                                       GnomeAsyncHandle         *async_handle);
+
+    void     (*scan_directory)        (GnomeDirectoryFilter     *filter,
+                                       const gchar              *directory,
+                                       GnomeAsyncHandle         *async_handle);
+};
+
+
+GType                  gnome_directory_filter_get_type   (void) G_GNUC_CONST;
+
+GnomeDirectoryFilter  *gnome_directory_filter_new        (void);
+
+G_END_DECLS
+
+#endif
diff --git a/libgnome/gnome-file-selector.c b/libgnome/gnome-file-selector.c
index e7abdef..9bd2715 100644
--- a/libgnome/gnome-file-selector.c
+++ b/libgnome/gnome-file-selector.c
@@ -45,13 +45,13 @@
 #define PARENT_TYPE gnome_selector_get_type()
 GnomeSelectorClass *gnome_file_selector_parent_class = NULL;
 
-typedef struct _GnomeFileSelectorAsyncData      GnomeFileSelectorAsyncData;
+typedef struct _GnomeFileAsyncData      GnomeFileAsyncData;
 typedef struct _GnomeFileSelectorSubAsyncData   GnomeFileSelectorSubAsyncData;
 
-struct _GnomeFileSelectorAsyncData {
-    GnomeSelectorAsyncHandle *async_handle;
+struct _GnomeFileAsyncData {
+    GnomeAsyncHandle *async_handle;
 
-    GnomeSelectorAsyncType type;
+    GnomeAsyncType type;
     GnomeFileSelector *fselector;
 
     GSList *async_ops;
@@ -65,9 +65,9 @@ struct _GnomeFileSelectorAsyncData {
 };
 
 struct _GnomeFileSelectorSubAsyncData {
-    GnomeSelectorAsyncHandle *async_handle;
+    GnomeAsyncHandle *async_handle;
 
-    GnomeFileSelectorAsyncData *async_data;
+    GnomeFileAsyncData *async_data;
 };
 
 struct _GnomeFileSelectorPrivate {
@@ -84,25 +84,25 @@ static void      add_uri_handler                (GnomeSelector            *selec
                                                  const gchar              *uri,
                                                  gint                      position,
 						 guint                     list_id,
-						 GnomeSelectorAsyncHandle *async_handle);
+						 GnomeAsyncHandle *async_handle);
 
 static void      add_uri_list_handler           (GnomeSelector            *selector,
 						 GSList                   *list,
 						 gint                      position,
 						 guint                     list_id,
-						 GnomeSelectorAsyncHandle *async_handle);
+						 GnomeAsyncHandle *async_handle);
 
 static void      add_directory_handler          (GnomeSelector            *selector,
                                                  const gchar              *uri,
                                                  gint                      position,
 						 guint                     list_id,
-						 GnomeSelectorAsyncHandle *async_handle);
+						 GnomeAsyncHandle *async_handle);
 static void      check_filename_handler         (GnomeSelector            *selector,
                                                  const gchar              *filename,
-						 GnomeSelectorAsyncHandle *async_handle);
+						 GnomeAsyncHandle *async_handle);
 static void      check_directory_handler        (GnomeSelector            *selector,
                                                  const gchar              *directory,
-						 GnomeSelectorAsyncHandle *async_handle);
+						 GnomeAsyncHandle *async_handle);
 
 static void      activate_entry_handler         (GnomeSelector   *selector);
 
@@ -135,7 +135,7 @@ gnome_file_selector_class_init (GnomeFileSelectorClass *class)
 static void
 free_the_async_data (gpointer data)
 {
-    GnomeFileSelectorAsyncData *async_data = data;
+    GnomeFileAsyncData *async_data = data;
     GnomeFileSelector *fselector;
 
     g_return_if_fail (async_data != NULL);
@@ -152,9 +152,9 @@ free_the_async_data (gpointer data)
 }
 
 static void
-add_uri_async_done_cb (GnomeFileSelectorAsyncData *async_data)
+add_uri_async_done_cb (GnomeFileAsyncData *async_data)
 {
-    GnomeSelectorAsyncHandle *async_handle;
+    GnomeAsyncHandle *async_handle;
     gchar *path;
 
     g_return_if_fail (async_data != NULL);
@@ -189,18 +189,19 @@ add_uri_async_done_cb (GnomeFileSelectorAsyncData *async_data)
 
     g_free (path);
 
-    _gnome_selector_async_handle_remove (async_handle, async_data);
+    gnome_async_handle_remove (async_handle, async_data);
 }
 
 static void
-add_uri_async_add_cb (GnomeSelector *selector,
-		      GnomeSelectorAsyncHandle *async_handle,
-		      GnomeSelectorAsyncType async_type,
-		      const char *uri, GError *error,
+add_uri_async_add_cb (GnomeAsyncContext *context,
+		      GnomeAsyncHandle *async_handle,
+		      GnomeAsyncType async_type,
+		      GObject *object,
+		      const gchar *uri, const gchar *error,
 		      gboolean success, gpointer user_data)
 {
     GnomeFileSelectorSubAsyncData *sub_async_data = user_data;
-    GnomeFileSelectorAsyncData *async_data;
+    GnomeFileAsyncData *async_data;
 
     g_return_if_fail (sub_async_data != NULL);
     g_assert (sub_async_data->async_data != NULL);
@@ -227,7 +228,7 @@ static void
 add_uri_async_cb (GnomeVFSAsyncHandle *handle, GList *results,
 		  gpointer callback_data)
 {
-    GnomeFileSelectorAsyncData *async_data;
+    GnomeFileAsyncData *async_data;
     GnomeFileSelector *fselector;
     GList *list;
 
@@ -236,7 +237,7 @@ add_uri_async_cb (GnomeVFSAsyncHandle *handle, GList *results,
     async_data = callback_data;
     g_assert (async_data->vfs_handle == handle);
     g_assert (GNOME_IS_FILE_SELECTOR (async_data->fselector));
-    g_assert (async_data->type == GNOME_SELECTOR_ASYNC_TYPE_ADD_URI);
+    g_assert (async_data->type == GNOME_ASYNC_TYPE_ADD_URI);
 
     fselector = GNOME_FILE_SELECTOR (async_data->fselector);
 
@@ -318,10 +319,10 @@ add_uri_async_cb (GnomeVFSAsyncHandle *handle, GList *results,
 
 void
 add_uri_handler (GnomeSelector *selector, const gchar *uri, gint position,
-		 guint list_id, GnomeSelectorAsyncHandle *async_handle)
+		 guint list_id, GnomeAsyncHandle *async_handle)
 {
     GnomeFileSelector *fselector;
-    GnomeFileSelectorAsyncData *async_data;
+    GnomeFileAsyncData *async_data;
     GnomeVFSURI *vfs_uri;
     GList fake_list;
 
@@ -337,9 +338,9 @@ add_uri_handler (GnomeSelector *selector, const gchar *uri, gint position,
     if (!vfs_uri)
 	return;
 
-    async_data = g_new0 (GnomeFileSelectorAsyncData, 1);
+    async_data = g_new0 (GnomeFileAsyncData, 1);
     async_data->async_handle = async_handle;
-    async_data->type = GNOME_SELECTOR_ASYNC_TYPE_ADD_URI;
+    async_data->type = GNOME_ASYNC_TYPE_ADD_URI;
     async_data->fselector = fselector;
     async_data->uri = vfs_uri;
     async_data->position = position;
@@ -352,8 +353,7 @@ add_uri_handler (GnomeSelector *selector, const gchar *uri, gint position,
     fake_list.prev = NULL;
     fake_list.next = NULL;
 
-    _gnome_selector_async_handle_add (async_handle, async_data,
-				      free_the_async_data);
+    gnome_async_handle_add (async_handle, async_data, free_the_async_data);
 
     gnome_vfs_async_get_file_info (&async_data->vfs_handle, &fake_list,
 				   fselector->_priv->file_info_options,
@@ -363,9 +363,9 @@ add_uri_handler (GnomeSelector *selector, const gchar *uri, gint position,
 }
 
 static void
-add_uri_list_async_done_cb (GnomeFileSelectorAsyncData *async_data)
+add_uri_list_async_done_cb (GnomeFileAsyncData *async_data)
 {
-    GnomeSelectorAsyncHandle *async_handle;
+    GnomeAsyncHandle *async_handle;
 
     g_return_if_fail (async_data != NULL);
 
@@ -385,18 +385,19 @@ add_uri_list_async_done_cb (GnomeFileSelectorAsyncData *async_data)
 	     async_data->uri_list, async_data->position,
 	     async_data->list_id, async_handle);
 
-    _gnome_selector_async_handle_remove (async_handle, async_data);
+    gnome_async_handle_remove (async_handle, async_data);
 }
 
 static void
-add_uri_list_async_cb (GnomeSelector *selector,
-		       GnomeSelectorAsyncHandle *async_handle,
-		       GnomeSelectorAsyncType async_type,
-		       const char *uri, GError *error,
+add_uri_list_async_cb (GnomeAsyncContext *context,
+		       GnomeAsyncHandle *async_handle,
+		       GnomeAsyncType async_type,
+		       GObject *object,
+		       const gchar *uri, const gchar *error,
 		       gboolean success, gpointer user_data)
 {
     GnomeFileSelectorSubAsyncData *sub_async_data = user_data;
-    GnomeFileSelectorAsyncData *async_data;
+    GnomeFileAsyncData *async_data;
 
     g_return_if_fail (sub_async_data != NULL);
     g_assert (sub_async_data->async_data != NULL);
@@ -416,9 +417,9 @@ add_uri_list_async_cb (GnomeSelector *selector,
 static void
 add_uri_list_handler (GnomeSelector *selector, GSList *list,
 		      gint position, guint list_id,
-		      GnomeSelectorAsyncHandle *async_handle)
+		      GnomeAsyncHandle *async_handle)
 {
-    GnomeFileSelectorAsyncData *async_data;
+    GnomeFileAsyncData *async_data;
     GnomeFileSelector *fselector;
     GSList *c;
 
@@ -428,9 +429,9 @@ add_uri_list_handler (GnomeSelector *selector, GSList *list,
 
     fselector = GNOME_FILE_SELECTOR (selector);
 
-    async_data = g_new0 (GnomeFileSelectorAsyncData, 1);
+    async_data = g_new0 (GnomeFileAsyncData, 1);
     async_data->async_handle = async_handle;
-    async_data->type = GNOME_SELECTOR_ASYNC_TYPE_ADD_URI_LIST;
+    async_data->type = GNOME_ASYNC_TYPE_ADD_URI_LIST;
     async_data->fselector = fselector;
     async_data->position = position;
     async_data->uri_list = _gnome_selector_deep_copy_slist (list);
@@ -438,8 +439,7 @@ add_uri_list_handler (GnomeSelector *selector, GSList *list,
 
     g_object_ref (G_OBJECT (async_data->fselector));
 
-    _gnome_selector_async_handle_add (async_handle, async_data,
-				      free_the_async_data);
+    gnome_async_handle_add (async_handle, async_data, free_the_async_data);
 
     for (c = list; c; c = c->next) {
 	GnomeFileSelectorSubAsyncData *sub_async_data;
@@ -462,9 +462,9 @@ add_uri_list_handler (GnomeSelector *selector, GSList *list,
 }
 
 static void
-add_directory_async_done_cb (GnomeFileSelectorAsyncData *async_data)
+add_directory_async_done_cb (GnomeFileAsyncData *async_data)
 {
-    GnomeSelectorAsyncHandle *async_handle;
+    GnomeAsyncHandle *async_handle;
     gchar *path;
 
     g_return_if_fail (async_data != NULL);
@@ -489,18 +489,19 @@ add_directory_async_done_cb (GnomeFileSelectorAsyncData *async_data)
 
     g_free (path);
 
-    _gnome_selector_async_handle_remove (async_handle, async_data);
+    gnome_async_handle_remove (async_handle, async_data);
 }
 
 static void
-add_directory_async_file_cb (GnomeSelector *selector,
-			     GnomeSelectorAsyncHandle *async_handle,
-			     GnomeSelectorAsyncType async_type,
-			     const char *uri, GError *error,
+add_directory_async_file_cb (GnomeAsyncContext *context,
+			     GnomeAsyncHandle *async_handle,
+			     GnomeAsyncType async_type,
+			     GObject *object,
+			     const gchar *uri, const gchar *error,
 			     gboolean success, gpointer user_data)
 {
     GnomeFileSelectorSubAsyncData *sub_async_data = user_data;
-    GnomeFileSelectorAsyncData *async_data;
+    GnomeFileAsyncData *async_data;
 
     g_return_if_fail (sub_async_data != NULL);
     g_assert (sub_async_data->async_data != NULL);
@@ -521,7 +522,7 @@ static void
 add_directory_async_cb (GnomeVFSAsyncHandle *handle, GnomeVFSResult result,
 			GList *list, guint entries_read, gpointer callback_data)
 {
-    GnomeFileSelectorAsyncData *async_data;
+    GnomeFileAsyncData *async_data;
     GnomeFileSelector *fselector;
 
     g_return_if_fail (callback_data != NULL);
@@ -529,7 +530,7 @@ add_directory_async_cb (GnomeVFSAsyncHandle *handle, GnomeVFSResult result,
     async_data = callback_data;
     g_assert (async_data->vfs_handle == handle);
     g_assert (GNOME_IS_FILE_SELECTOR (async_data->fselector));
-    g_assert (async_data->type == GNOME_SELECTOR_ASYNC_TYPE_ADD_DIRECTORY);
+    g_assert (async_data->type == GNOME_ASYNC_TYPE_ADD_DIRECTORY);
 
     fselector = GNOME_FILE_SELECTOR (async_data->fselector);
 
@@ -587,10 +588,10 @@ add_directory_async_cb (GnomeVFSAsyncHandle *handle, GnomeVFSResult result,
 static void
 add_directory_handler (GnomeSelector *selector, const gchar *uri,
 		       gint position, guint list_id,
-		       GnomeSelectorAsyncHandle *async_handle)
+		       GnomeAsyncHandle *async_handle)
 {
     GnomeFileSelector *fselector;
-    GnomeFileSelectorAsyncData *async_data;
+    GnomeFileAsyncData *async_data;
     GnomeVFSURI *vfs_uri;
 
     g_return_if_fail (selector != NULL);
@@ -608,8 +609,8 @@ add_directory_handler (GnomeSelector *selector, const gchar *uri,
 
     vfs_uri = gnome_vfs_uri_new (uri);
 
-    async_data = g_new0 (GnomeFileSelectorAsyncData, 1);
-    async_data->type = GNOME_SELECTOR_ASYNC_TYPE_ADD_DIRECTORY;
+    async_data = g_new0 (GnomeFileAsyncData, 1);
+    async_data->type = GNOME_ASYNC_TYPE_ADD_DIRECTORY;
     async_data->fselector = fselector;
     async_data->uri = vfs_uri;
     async_data->position = position;
@@ -619,8 +620,7 @@ add_directory_handler (GnomeSelector *selector, const gchar *uri,
     gnome_vfs_uri_ref (async_data->uri);
     g_object_ref (G_OBJECT (async_data->fselector));
 
-    _gnome_selector_async_handle_add (async_handle, async_data,
-				      free_the_async_data);
+    gnome_async_handle_add (async_handle, async_data, free_the_async_data);
 
     gnome_vfs_async_load_directory_uri (&async_data->vfs_handle, vfs_uri,
 					fselector->_priv->file_info_options,
@@ -700,7 +700,7 @@ gnome_file_selector_init (GnomeFileSelector *fselector)
 static void
 check_uri_async_cb (GnomeVFSAsyncHandle *handle, GList *results, gpointer callback_data)
 {
-    GnomeFileSelectorAsyncData *async_data;
+    GnomeFileAsyncData *async_data;
     GnomeFileSelector *fselector;
     GList *list;
 
@@ -709,8 +709,8 @@ check_uri_async_cb (GnomeVFSAsyncHandle *handle, GList *results, gpointer callba
     async_data = callback_data;
     g_assert (async_data->vfs_handle == handle);
     g_assert (GNOME_IS_FILE_SELECTOR (async_data->fselector));
-    g_assert ((async_data->type == GNOME_SELECTOR_ASYNC_TYPE_CHECK_FILENAME) ||
-	      (async_data->type == GNOME_SELECTOR_ASYNC_TYPE_CHECK_DIRECTORY));
+    g_assert ((async_data->type == GNOME_ASYNC_TYPE_CHECK_FILENAME) ||
+	      (async_data->type == GNOME_ASYNC_TYPE_CHECK_DIRECTORY));
 
     fselector = GNOME_FILE_SELECTOR (async_data->fselector);
 
@@ -718,42 +718,42 @@ check_uri_async_cb (GnomeVFSAsyncHandle *handle, GList *results, gpointer callba
 
     for (list = results; list; list = list->next) {
 	GnomeVFSGetFileInfoResult *file = list->data;
-	GnomeSelectorAsyncHandle *async_handle = async_data->async_handle;
+	GnomeAsyncHandle *async_handle = async_data->async_handle;
 
 	/* better assert this than risking a crash. */
 	g_assert (file != NULL);
 
-	_gnome_selector_async_handle_remove (async_handle, async_data);
+	gnome_async_handle_remove (async_handle, async_data);
 
 	if (file->result != GNOME_VFS_OK) {
-	    _gnome_selector_async_handle_completed (async_handle, FALSE);
+	    gnome_async_handle_completed (async_handle, FALSE);
 	    return;
 	}
 
 	if ((file->file_info->type == GNOME_VFS_FILE_TYPE_DIRECTORY) &&
-	    (async_data->type != GNOME_SELECTOR_ASYNC_TYPE_CHECK_DIRECTORY)) {
-	    _gnome_selector_async_handle_completed (async_handle, FALSE);
+	    (async_data->type != GNOME_ASYNC_TYPE_CHECK_DIRECTORY)) {
+	    gnome_async_handle_completed (async_handle, FALSE);
 	    return;
 	}
 
 	if (fselector->_priv->filter &&
 	    !gnome_vfs_directory_filter_apply (fselector->_priv->filter,
 					       file->file_info)) {
-	    _gnome_selector_async_handle_completed (async_handle, FALSE);
+	    gnome_async_handle_completed (async_handle, FALSE);
 	    return;
 	}
 
-	_gnome_selector_async_handle_completed (async_handle, TRUE);
+	gnome_async_handle_completed (async_handle, TRUE);
 	return;
     }
 }
 
 static void
 check_uri_handler (GnomeSelector *selector, const gchar *uri,
-		   GnomeSelectorAsyncType async_type,
-		   GnomeSelectorAsyncHandle *async_handle)
+		   GnomeAsyncType async_type,
+		   GnomeAsyncHandle *async_handle)
 {
-    GnomeFileSelectorAsyncData *async_data;
+    GnomeFileAsyncData *async_data;
     GnomeFileSelector *fselector;
     GList fake_list;
 
@@ -764,9 +764,9 @@ check_uri_handler (GnomeSelector *selector, const gchar *uri,
 
     fselector = GNOME_FILE_SELECTOR (selector);
 
-    async_data = g_new0 (GnomeFileSelectorAsyncData, 1);
+    async_data = g_new0 (GnomeFileAsyncData, 1);
     async_data->async_handle = async_handle;
-    async_data->type = GNOME_SELECTOR_ASYNC_TYPE_CHECK_FILENAME;
+    async_data->type = GNOME_ASYNC_TYPE_CHECK_FILENAME;
     async_data->fselector = fselector;
     async_data->uri = gnome_vfs_uri_new (uri);
 
@@ -777,8 +777,7 @@ check_uri_handler (GnomeSelector *selector, const gchar *uri,
     fake_list.prev = NULL;
     fake_list.next = NULL;
 
-    _gnome_selector_async_handle_add (async_handle, async_data,
-				      free_the_async_data);
+    gnome_async_handle_add (async_handle, async_data, free_the_async_data);
 
     gnome_vfs_async_get_file_info (&async_data->vfs_handle, &fake_list,
 				   fselector->_priv->file_info_options,
@@ -789,26 +788,26 @@ check_uri_handler (GnomeSelector *selector, const gchar *uri,
 
 static void
 check_filename_handler (GnomeSelector *selector, const gchar *filename,
-			GnomeSelectorAsyncHandle *async_handle)
+			GnomeAsyncHandle *async_handle)
 {
     g_return_if_fail (selector != NULL);
     g_return_if_fail (GNOME_IS_FILE_SELECTOR (selector));
     g_return_if_fail (filename != NULL);
     g_return_if_fail (async_handle != NULL);
 
-    check_uri_handler (selector, filename, GNOME_SELECTOR_ASYNC_TYPE_CHECK_FILENAME, async_handle);
+    check_uri_handler (selector, filename, GNOME_ASYNC_TYPE_CHECK_FILENAME, async_handle);
 }
 
 static void
 check_directory_handler (GnomeSelector *selector, const gchar *directory,
-			 GnomeSelectorAsyncHandle *async_handle)
+			 GnomeAsyncHandle *async_handle)
 {
     g_return_if_fail (selector != NULL);
     g_return_if_fail (GNOME_IS_FILE_SELECTOR (selector));
     g_return_if_fail (directory != NULL);
     g_return_if_fail (async_handle != NULL);
 
-    check_uri_handler (selector, directory, GNOME_SELECTOR_ASYNC_TYPE_CHECK_DIRECTORY, async_handle);
+    check_uri_handler (selector, directory, GNOME_ASYNC_TYPE_CHECK_DIRECTORY, async_handle);
 }
 
 static void



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