diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | src/glade-cursor.c | 87 | ||||
-rw-r--r-- | src/glade-project.c | 2 |
4 files changed, 83 insertions, 19 deletions
@@ -1,3 +1,15 @@ +2006-07-25 Tristan Van Berkom <tvb@gnome.org> + + * src/glade-project.c: Dont require that an object be "toplevel" to be + saved, just that it has no parent (toplevel means that it can _only_ + be top-level, and gwidget->parent == NULL means that it _happens_ to + be top-level. + + * src/glade-cursor.c: Hacked the cursor code to violently set cursors + on all visible project widgets, this fixes bug 348657. + + * TODO: Updated. + 2006-07-25 Juan Pablo Ugarte <juanpablougarte@gmail.com> * src/glade-gtk.c: Fixed bug 347850 "Selection Bug consequence" @@ -4,7 +4,6 @@ Tasks/Bugs Blocking glade-3 3.0: ================================ o Default notebook tab labels (bug 345438) (Tristan) (We'll do a clean-up here... but not command recursion just yet). - o Cursor woes (bug 348657) (Tristan) o Missing icons (Vincent) Wishlist items for 3.0 release: diff --git a/src/glade-cursor.c b/src/glade-cursor.c index 7d9424d8..27f8a5f7 100644 --- a/src/glade-cursor.c +++ b/src/glade-cursor.c @@ -31,7 +31,56 @@ #define ADD_PIXBUF_FILENAME "plus.png" -GladeCursor *cursor = NULL; +static GladeCursor *cursor = NULL; + + +static void +set_cursor_recurse (GtkWidget *widget, + GdkCursor *gdk_cursor) +{ + GList *children, *list; + + if (!GTK_WIDGET_VISIBLE (widget)) + return; + + gdk_window_set_cursor (widget->window, gdk_cursor); + + if (GTK_IS_CONTAINER (widget) && + (children = + glade_util_container_get_all_children (GTK_CONTAINER (widget))) != NULL) + { + for (list = children; list; list = list->next) + { + set_cursor_recurse (GTK_WIDGET (list->data), gdk_cursor); + } + g_list_free (children); + } +} + + +static void +set_cursor (GdkCursor *gdk_cursor) +{ + GladeProject *project; + GList *list, *projects; + + for (projects = glade_app_get_projects (); + projects; projects = projects->next) + { + project = projects->data; + + for (list = project->objects; + list; list = list->next) + { + GObject *object = list->data; + + if (GTK_WIDGET_TOPLEVEL (object)) + { + set_cursor_recurse (GTK_WIDGET (object), gdk_cursor); + } + } + } +} /** * glade_cursor_set: @@ -39,17 +88,19 @@ GladeCursor *cursor = NULL; * @type: a #GladeCursorType * * Sets the cursor for @window to something appropriate based on @type. + * (also sets the cursor on all visible project widgets) */ void glade_cursor_set (GdkWindow *window, GladeCursorType type) { GladeWidgetClass *widget_class; - + GdkCursor *the_cursor = NULL; g_return_if_fail (cursor != NULL); switch (type) { case GLADE_CURSOR_SELECTOR: - gdk_window_set_cursor (window, cursor->selector); + set_cursor (cursor->selector); + gdk_window_set_cursor (window, cursor->selector); break; case GLADE_CURSOR_ADD_WIDGET: @@ -58,47 +109,49 @@ glade_cursor_set (GdkWindow *window, GladeCursorType type) if (widget_class != NULL) { if (widget_class->cursor != NULL) - gdk_window_set_cursor (window, widget_class->cursor); + the_cursor = widget_class->cursor; else - gdk_window_set_cursor (window, cursor->add_widget); + the_cursor = cursor->add_widget; } else - { - gdk_window_set_cursor (window, cursor->add_widget); + { + the_cursor = cursor->add_widget; } - break; case GLADE_CURSOR_RESIZE_TOP_LEFT: - gdk_window_set_cursor (window, cursor->resize_top_left); + the_cursor = cursor->resize_top_left; break; case GLADE_CURSOR_RESIZE_TOP_RIGHT: - gdk_window_set_cursor (window, cursor->resize_top_right); + the_cursor = cursor->resize_top_right; break; case GLADE_CURSOR_RESIZE_BOTTOM_LEFT: - gdk_window_set_cursor (window, cursor->resize_bottom_left); + the_cursor = cursor->resize_bottom_left; break; case GLADE_CURSOR_RESIZE_BOTTOM_RIGHT: - gdk_window_set_cursor (window, cursor->resize_bottom_right); + the_cursor = cursor->resize_bottom_right; break; case GLADE_CURSOR_RESIZE_LEFT: - gdk_window_set_cursor (window, cursor->resize_left); + the_cursor = cursor->resize_left; break; case GLADE_CURSOR_RESIZE_RIGHT: - gdk_window_set_cursor (window, cursor->resize_right); + the_cursor = cursor->resize_right; break; case GLADE_CURSOR_RESIZE_TOP: - gdk_window_set_cursor (window, cursor->resize_top); + the_cursor = cursor->resize_top; break; case GLADE_CURSOR_RESIZE_BOTTOM: - gdk_window_set_cursor (window, cursor->resize_bottom); + the_cursor = cursor->resize_bottom; break; case GLADE_CURSOR_DRAG: - gdk_window_set_cursor (window, cursor->drag); + the_cursor = cursor->drag; break; default: break; } + gdk_window_set_cursor (window, the_cursor); + set_cursor (the_cursor); + } /** diff --git a/src/glade-project.c b/src/glade-project.c index 937586f6..d902bedd 100644 --- a/src/glade-project.c +++ b/src/glade-project.c @@ -1336,7 +1336,7 @@ glade_project_write (GladeProject *project) * Append toplevel widgets. Each widget then takes * care of appending its children. */ - if (widget->parent == NULL && widget->widget_class->toplevel) + if (widget->parent == NULL) { info = glade_widget_write (widget, interface); if (!info) |