31 GNC_CURSOR_NORMAL = -1,
32 GNC_CURSOR_BUSY = GDK_WATCH
45 gnc_ui_set_cursor (GdkWindow *win, GNCCursorType type, gboolean update_now)
47 GdkCursor *cursor = NULL;
52 if (type != GNC_CURSOR_NORMAL)
53 cursor = gdk_cursor_new ((GdkCursorType)type);
55 gdk_window_set_cursor (win, cursor);
57 if (update_now && type != GNC_CURSOR_NORMAL)
59 while (gtk_events_pending ())
60 gtk_main_iteration ();
63 if (type != GNC_CURSOR_NORMAL)
64 gdk_cursor_unref (cursor);
79 gnc_set_busy_cursor (GtkWidget *w, gboolean update_now)
82 gnc_ui_set_cursor (gtk_widget_get_window(w), GNC_CURSOR_BUSY, update_now);
85 GList *containerstop, *node;
87 for (containerstop = node = gtk_window_list_toplevels (); node; node = node->next)
91 if (!w || !GTK_IS_WIDGET (w) || !w->window)
94 gnc_ui_set_cursor (gtk_widget_get_window(w), GNC_CURSOR_BUSY, update_now);
96 g_list_free (containerstop);
110 gnc_unset_busy_cursor (GtkWidget *w)
113 gnc_ui_set_cursor (gtk_widget_get_window(w), GNC_CURSOR_NORMAL, FALSE);
116 GList *containerstop, *node;
118 for (containerstop = node = gtk_window_list_toplevels (); node; node = node->next)
120 w = GTK_WIDGET (node->data);
122 if (!w || !GTK_IS_WIDGET (w) || (!gtk_widget_get_has_window(w)))
125 gnc_ui_set_cursor (gtk_widget_get_window(w), GNC_CURSOR_NORMAL, FALSE);
127 g_list_free (containerstop);