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_for_display (gdk_window_get_display (win),
56 gdk_window_set_cursor (win, cursor);
58 if (update_now && type != GNC_CURSOR_NORMAL)
60 while (gtk_events_pending ())
61 gtk_main_iteration ();
64 if (type != GNC_CURSOR_NORMAL)
65 g_object_unref (cursor);
80 gnc_set_busy_cursor (GtkWidget *w, gboolean update_now)
83 gnc_ui_set_cursor (gtk_widget_get_window(w), GNC_CURSOR_BUSY, update_now);
92 GList *containerstop = gtk_window_list_toplevels (), *node;
93 g_list_foreach (containerstop, (GFunc)g_object_ref, NULL);
95 for (node = containerstop; node; node = node->next)
99 if (!w || !GTK_IS_WIDGET (w) || (!gtk_widget_get_has_window(w)))
102 gnc_ui_set_cursor (gtk_widget_get_window(w), GNC_CURSOR_BUSY, update_now);
104 g_list_free_full (containerstop, (GDestroyNotify)g_object_unref);
118 gnc_unset_busy_cursor (GtkWidget *w)
121 gnc_ui_set_cursor (gtk_widget_get_window(w), GNC_CURSOR_NORMAL, FALSE);
124 GList *containerstop, *node;
126 for (containerstop = node = gtk_window_list_toplevels (); node; node = node->next)
128 w = GTK_WIDGET (node->data);
130 if (!w || !GTK_IS_WIDGET (w) || (!gtk_widget_get_has_window(w)))
133 gnc_ui_set_cursor (gtk_widget_get_window(w), GNC_CURSOR_NORMAL, FALSE);
135 g_list_free (containerstop);