]> Pileus Git - ~andy/gtk/blobdiff - tests/testdnd.c
Replace a lot of idle and timeout calls by the new gdk_threads api.
[~andy/gtk] / tests / testdnd.c
index 8e4e9333a9c33f0faacce1b5925e09798447b496..608cfc869321f812f5023c6873ca47cab51552aa 100644 (file)
@@ -1,4 +1,24 @@
-#include <stdlib.h> /* putenv */
+/* testdnd.c
+ * Copyright (C) 1998  Red Hat, Inc.
+ * Author: Owen Taylor
+ *
+ * This 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.
+ *
+ * This 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 this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
 #include "gtk/gtk.h"
 
 /* Target side drag signals */
@@ -281,7 +301,7 @@ enum {
 static GtkTargetEntry target_table[] = {
   { "STRING",     0, TARGET_STRING },
   { "text/plain", 0, TARGET_STRING },
-  { "application/x-rootwin-drop", 0, TARGET_ROOTWIN }
+  { "application/x-rootwindow-drop", 0, TARGET_ROOTWIN }
 };
 
 static guint n_targets = sizeof(target_table) / sizeof(target_table[0]);
@@ -311,7 +331,7 @@ target_drag_motion     (GtkWidget          *widget,
     {
       have_drag = TRUE;
       gtk_image_set_from_pixmap (GTK_IMAGE (widget),
-                                trashcan_closed, trashcan_closed_mask);
+                                trashcan_open, trashcan_open_mask);
     }
 
   source_widget = gtk_drag_get_source_widget (context);
@@ -465,12 +485,12 @@ popup_leave          (GtkWidget          *widget,
       if (!popdown_timer)
        {
          g_print ("added popdown\n");
-         popdown_timer = g_timeout_add (500, popdown_cb, NULL);
+         popdown_timer = gdk_threads_add_timeout (500, popdown_cb, NULL);
        }
     }
 }
 
-gint
+gboolean
 popup_cb (gpointer data)
 {
   if (!popped_up)
@@ -514,7 +534,7 @@ popup_cb (gpointer data)
       popped_up = TRUE;
     }
 
-  popdown_timer = g_timeout_add (500, popdown_cb, NULL);
+  popdown_timer = gdk_threads_add_timeout (500, popdown_cb, NULL);
   g_print ("added popdown\n");
 
   popup_timer = FALSE;
@@ -530,7 +550,7 @@ popsite_motion         (GtkWidget          *widget,
                    guint               time)
 {
   if (!popup_timer)
-    popup_timer = g_timeout_add (500, popup_cb, NULL);
+    popup_timer = gdk_threads_add_timeout (500, popup_cb, NULL);
 
   return TRUE;
 }
@@ -556,13 +576,13 @@ source_drag_data_delete  (GtkWidget          *widget,
 }
   
 void
-test_init ()
+test_init (void)
 {
   if (g_file_test ("../gdk-pixbuf/libpixbufloader-pnm.la",
                   G_FILE_TEST_EXISTS))
     {
-      putenv ("GDK_PIXBUF_MODULE_FILE=../gdk-pixbuf/gdk-pixbuf.loaders");
-      putenv ("GTK_IM_MODULE_FILE=../modules/input/gtk.immodules");
+      g_setenv ("GDK_PIXBUF_MODULE_FILE", "../gdk-pixbuf/gdk-pixbuf.loaders", TRUE);
+      g_setenv ("GTK_IM_MODULE_FILE", "../modules/input/gtk.immodules", TRUE);
     }
 }