]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtksearchenginesimple.c
filechooserbutton: Don't show the (None) item when the combo box is popped up
[~andy/gtk] / gtk / gtksearchenginesimple.c
index f311c192f3e283964b19c4ccbdd21322c9b0e6f9..8d0e07f44e6afbca06b0b6683cc22d9193d88cea 100644 (file)
@@ -12,8 +12,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  *
  * Author: Alexander Larsson <alexl@redhat.com>
  *
  * export ftw() and friends only if _XOPEN_SOURCE and _GNU_SOURCE
  * are defined. see bug #444097.
  */
-#define _XOPEN_SOURCE 500
-#define _GNU_SOURCE 
+#define _XOPEN_SOURCE 600
+#define _GNU_SOURCE
 
 #ifdef HAVE_FTW_H
 #include <ftw.h>
 #endif
 
+#include <gdk/gdk.h>
+
 #include "gtksearchenginesimple.h"
 #include "gtkprivate.h"
 
@@ -166,8 +167,7 @@ search_thread_add_hits_idle (gpointer user_data)
                                    hits->uris);
     }
 
-  g_list_foreach (hits->uris, (GFunc)g_free, NULL);
-  g_list_free (hits->uris);
+  g_list_free_full (hits->uris, g_free);
   g_free (hits);
        
   return FALSE;
@@ -188,10 +188,11 @@ send_batch (SearchThreadData *data)
       
       gdk_threads_add_idle (search_thread_add_hits_idle, hits);
     }
+
   data->uri_hits = NULL;
 }
 
-static GStaticPrivate search_thread_data = G_STATIC_PRIVATE_INIT;
+static GPrivate search_thread_data;
 
 #ifdef HAVE_FTW_H
 static int
@@ -202,13 +203,13 @@ search_visit_func (const char        *fpath,
 {
   SearchThreadData *data;
   gint i;
-  const gchar *name; 
+  const gchar *name;
   gchar *lower_name;
   gchar *uri;
   gboolean hit;
   gboolean is_hidden;
-  
-  data = (SearchThreadData*)g_static_private_get (&search_thread_data);
+
+  data = (SearchThreadData*)g_private_get (&search_thread_data);
 
   if (data->cancelled)
 #ifdef HAVE_GNU_FTW
@@ -273,7 +274,7 @@ search_thread_func (gpointer user_data)
   
   data = user_data;
   
-  g_static_private_set (&search_thread_data, data, NULL);
+  g_private_set (&search_thread_data, data);
 
   nftw (data->path, search_visit_func, 20,
 #ifdef HAVE_GNU_FTW
@@ -305,7 +306,7 @@ gtk_search_engine_simple_start (GtkSearchEngine *engine)
        
   data = search_thread_data_new (simple, simple->priv->query);
   
-  g_thread_create (search_thread_func, data, FALSE, NULL);
+  g_thread_unref (g_thread_new ("file-search", search_thread_func, data));
   
   simple->priv->active_search = data;
 }