Remove change check for GTK_TYPE_OBJECT derivation to G_TYPE_OBJECTS -

Sat Jun 30 20:44:48 2001  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtktypeutils.c (gtk_type_class): Remove
	change check for GTK_TYPE_OBJECT derivation to
	G_TYPE_OBJECTS - it's Tim-approved to use this
	for arbitary objects.

	* gtk/gtkwindow.c gtk/gtkcontainer.[ch]: underscore
	prefix gtk_container_dequeue_resize_handler().

	* gtk/gtkwidget.[ch]: Add a previous_toplevel argument
	to the hierarachy_changed signal, since you otherwise
	have to always keep that around.

	* gtk/gtkmenubar.c gtk/gtklabel.c gtk/gtksocket.c: Adapt
	for extra argument to hierarchy_changed.
This commit is contained in:
Owen Taylor 2001-07-01 00:57:21 +00:00 committed by Owen Taylor
parent 95cd4d8e66
commit de985fb58e
17 changed files with 171 additions and 49 deletions

View File

@ -1,3 +1,20 @@
Sat Jun 30 20:44:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.c (gtk_type_class): Remove
change check for GTK_TYPE_OBJECT derivation to
G_TYPE_OBJECTS - it's Tim-approved to use this
for arbitary objects.
* gtk/gtkwindow.c gtk/gtkcontainer.[ch]: underscore
prefix gtk_container_dequeue_resize_handler().
* gtk/gtkwidget.[ch]: Add a previous_toplevel argument
to the hierarachy_changed signal, since you otherwise
have to always keep that around.
* gtk/gtkmenubar.c gtk/gtklabel.c gtk/gtksocket.c: Adapt
for extra argument to hierarchy_changed.
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL

View File

@ -1,3 +1,20 @@
Sat Jun 30 20:44:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.c (gtk_type_class): Remove
change check for GTK_TYPE_OBJECT derivation to
G_TYPE_OBJECTS - it's Tim-approved to use this
for arbitary objects.
* gtk/gtkwindow.c gtk/gtkcontainer.[ch]: underscore
prefix gtk_container_dequeue_resize_handler().
* gtk/gtkwidget.[ch]: Add a previous_toplevel argument
to the hierarachy_changed signal, since you otherwise
have to always keep that around.
* gtk/gtkmenubar.c gtk/gtklabel.c gtk/gtksocket.c: Adapt
for extra argument to hierarchy_changed.
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL

View File

@ -1,3 +1,20 @@
Sat Jun 30 20:44:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.c (gtk_type_class): Remove
change check for GTK_TYPE_OBJECT derivation to
G_TYPE_OBJECTS - it's Tim-approved to use this
for arbitary objects.
* gtk/gtkwindow.c gtk/gtkcontainer.[ch]: underscore
prefix gtk_container_dequeue_resize_handler().
* gtk/gtkwidget.[ch]: Add a previous_toplevel argument
to the hierarachy_changed signal, since you otherwise
have to always keep that around.
* gtk/gtkmenubar.c gtk/gtklabel.c gtk/gtksocket.c: Adapt
for extra argument to hierarchy_changed.
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL

View File

@ -1,3 +1,20 @@
Sat Jun 30 20:44:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.c (gtk_type_class): Remove
change check for GTK_TYPE_OBJECT derivation to
G_TYPE_OBJECTS - it's Tim-approved to use this
for arbitary objects.
* gtk/gtkwindow.c gtk/gtkcontainer.[ch]: underscore
prefix gtk_container_dequeue_resize_handler().
* gtk/gtkwidget.[ch]: Add a previous_toplevel argument
to the hierarachy_changed signal, since you otherwise
have to always keep that around.
* gtk/gtkmenubar.c gtk/gtklabel.c gtk/gtksocket.c: Adapt
for extra argument to hierarchy_changed.
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL

View File

@ -1,3 +1,20 @@
Sat Jun 30 20:44:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.c (gtk_type_class): Remove
change check for GTK_TYPE_OBJECT derivation to
G_TYPE_OBJECTS - it's Tim-approved to use this
for arbitary objects.
* gtk/gtkwindow.c gtk/gtkcontainer.[ch]: underscore
prefix gtk_container_dequeue_resize_handler().
* gtk/gtkwidget.[ch]: Add a previous_toplevel argument
to the hierarachy_changed signal, since you otherwise
have to always keep that around.
* gtk/gtkmenubar.c gtk/gtklabel.c gtk/gtksocket.c: Adapt
for extra argument to hierarchy_changed.
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL

View File

@ -1,3 +1,20 @@
Sat Jun 30 20:44:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.c (gtk_type_class): Remove
change check for GTK_TYPE_OBJECT derivation to
G_TYPE_OBJECTS - it's Tim-approved to use this
for arbitary objects.
* gtk/gtkwindow.c gtk/gtkcontainer.[ch]: underscore
prefix gtk_container_dequeue_resize_handler().
* gtk/gtkwidget.[ch]: Add a previous_toplevel argument
to the hierarachy_changed signal, since you otherwise
have to always keep that around.
* gtk/gtkmenubar.c gtk/gtklabel.c gtk/gtksocket.c: Adapt
for extra argument to hierarchy_changed.
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL

View File

@ -1,3 +1,20 @@
Sat Jun 30 20:44:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktypeutils.c (gtk_type_class): Remove
change check for GTK_TYPE_OBJECT derivation to
G_TYPE_OBJECTS - it's Tim-approved to use this
for arbitary objects.
* gtk/gtkwindow.c gtk/gtkcontainer.[ch]: underscore
prefix gtk_container_dequeue_resize_handler().
* gtk/gtkwidget.[ch]: Add a previous_toplevel argument
to the hierarachy_changed signal, since you otherwise
have to always keep that around.
* gtk/gtkmenubar.c gtk/gtklabel.c gtk/gtksocket.c: Adapt
for extra argument to hierarchy_changed.
Tue Jun 26 19:39:03 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_style): Allow %NULL

View File

@ -717,7 +717,7 @@ gtk_container_destroy (GtkObject *object)
container = GTK_CONTAINER (object);
if (GTK_CONTAINER_RESIZE_PENDING (container))
gtk_container_dequeue_resize_handler (container);
_gtk_container_dequeue_resize_handler (container);
if (container->resize_widgets)
gtk_container_clear_resize_widgets (container);
@ -894,7 +894,7 @@ gtk_container_remove (GtkContainer *container,
}
void
gtk_container_dequeue_resize_handler (GtkContainer *container)
_gtk_container_dequeue_resize_handler (GtkContainer *container)
{
g_return_if_fail (GTK_IS_CONTAINER (container));
g_return_if_fail (GTK_CONTAINER_RESIZE_PENDING (container));

View File

@ -205,7 +205,7 @@ void gtk_container_forall (GtkContainer *container,
gpointer callback_data);
gchar* gtk_container_child_composite_name (GtkContainer *container,
GtkWidget *child);
void gtk_container_dequeue_resize_handler (GtkContainer *container);
void _gtk_container_dequeue_resize_handler (GtkContainer *container);
#ifdef __cplusplus
}

View File

@ -113,7 +113,8 @@ static void set_markup (GtkLabel *label,
const gchar *str,
gboolean with_uline);
static void gtk_label_recalculate (GtkLabel *label);
static void gtk_label_hierarchy_changed (GtkWidget *widget);
static void gtk_label_hierarchy_changed (GtkWidget *widget,
GtkWidget *old_toplevel);
static void gtk_label_create_window (GtkLabel *label);
static void gtk_label_destroy_window (GtkLabel *label);
@ -502,7 +503,8 @@ gtk_label_setup_mnemonic (GtkLabel *label,
}
static void
gtk_label_hierarchy_changed (GtkWidget *widget)
gtk_label_hierarchy_changed (GtkWidget *widget,
GtkWidget *old_toplevel)
{
GtkLabel *label = GTK_LABEL (widget);

View File

@ -48,7 +48,8 @@ static void gtk_menu_bar_paint (GtkWidget *widget,
GdkRectangle *area);
static gint gtk_menu_bar_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gtk_menu_bar_hierarchy_changed (GtkWidget *widget);
static void gtk_menu_bar_hierarchy_changed (GtkWidget *widget,
GtkWidget *old_toplevel);
static GtkShadowType get_shadow_type (GtkMenuBar *menubar);
static GtkMenuShellClass *parent_class = NULL;
@ -460,30 +461,20 @@ add_to_window (GtkWindow *window,
"key_press_event",
G_CALLBACK (window_key_press_handler),
menubar);
menubar->toplevel = GTK_WIDGET (window);
}
static void
remove_from_window (GtkWindow *window,
GtkMenuBar *menubar)
{
g_return_if_fail (menubar->toplevel == GTK_WIDGET (window));
g_signal_handlers_disconnect_by_func (G_OBJECT (window),
G_CALLBACK (window_key_press_handler),
menubar);
/* dnotify zeroes menubar->toplevel */
g_object_set_data (G_OBJECT (window),
"gtk-menu-bar",
NULL);
menubar->toplevel = NULL;
}
static void
gtk_menu_bar_hierarchy_changed (GtkWidget *widget)
gtk_menu_bar_hierarchy_changed (GtkWidget *widget,
GtkWidget *old_toplevel)
{
GtkWidget *toplevel;
GtkMenuBar *menubar;
@ -492,19 +483,11 @@ gtk_menu_bar_hierarchy_changed (GtkWidget *widget)
toplevel = gtk_widget_get_toplevel (widget);
if (menubar->toplevel &&
toplevel != menubar->toplevel)
{
remove_from_window (GTK_WINDOW (menubar->toplevel),
menubar);
}
if (old_toplevel && GTK_IS_WINDOW (old_toplevel))
remove_from_window (old_toplevel, menubar);
if (toplevel &&
GTK_IS_WINDOW (toplevel))
{
add_to_window (GTK_WINDOW (toplevel),
menubar);
}
if (toplevel && GTK_IS_WINDOW (toplevel))
add_to_window (GTK_WINDOW (toplevel), menubar);
}
static GtkShadowType

View File

@ -51,8 +51,6 @@ typedef struct _GtkMenuBarClass GtkMenuBarClass;
struct _GtkMenuBar
{
GtkMenuShell menu_shell;
GtkWidget *toplevel;
};
struct _GtkMenuBarClass

View File

@ -46,7 +46,8 @@ static void gtk_socket_size_request (GtkWidget *widget
GtkRequisition *requisition);
static void gtk_socket_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_socket_hierarchy_changed (GtkWidget *widget);
static void gtk_socket_hierarchy_changed (GtkWidget *widget,
GtkWidget *old_toplevel);
static void gtk_socket_grab_notify (GtkWidget *widget,
gboolean was_grabbed);
static gboolean gtk_socket_key_press_event (GtkWidget *widget,
@ -541,7 +542,8 @@ toplevel_focus_out_handler (GtkWidget *toplevel,
}
static void
gtk_socket_hierarchy_changed (GtkWidget *widget)
gtk_socket_hierarchy_changed (GtkWidget *widget,
GtkWidget *old_toplevel)
{
GtkSocket *socket = GTK_SOCKET (widget);
GtkWidget *toplevel = gtk_widget_get_toplevel (widget);

View File

@ -62,7 +62,7 @@ gtk_type_class (GtkType type)
gpointer class;
if (!G_TYPE_IS_ENUM (type) && !G_TYPE_IS_FLAGS (type))
g_return_val_if_fail (GTK_TYPE_IS_OBJECT (type), NULL);
g_return_val_if_fail (G_TYPE_IS_OBJECT (type), NULL);
/* ok, this is a bit ugly, GLib reference counts classes,
* and gtk_type_class() used to always return static classes.

View File

@ -604,8 +604,9 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkWidgetClass, hierarchy_changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
gtk_marshal_VOID__OBJECT,
GTK_TYPE_NONE, 1,
GTK_TYPE_WIDGET);
widget_signals[STYLE_SET] =
gtk_signal_new ("style_set",
GTK_RUN_FIRST,
@ -1475,6 +1476,7 @@ gtk_widget_unparent (GtkWidget *widget)
{
GObjectNotifyQueue *nqueue;
GtkWidget *toplevel;
GtkWidget *ancestor;
GtkWidget *old_parent;
g_return_if_fail (widget != NULL);
@ -1524,6 +1526,14 @@ gtk_widget_unparent (GtkWidget *widget)
gtk_window_set_default (GTK_WINDOW (toplevel), NULL);
}
/* If we are unanchoring the child, we save around the toplevel
* to emit hierarchy changed
*/
if (GTK_WIDGET_ANCHORED (widget->parent))
g_object_ref (toplevel);
else
toplevel = NULL;
if (GTK_IS_RESIZE_CONTAINER (widget))
gtk_container_clear_resize_widgets (GTK_CONTAINER (widget));
@ -1536,20 +1546,20 @@ gtk_widget_unparent (GtkWidget *widget)
* Write a g_slist_conditional_remove (GSList, gboolean (*)(gpointer))
* Change resize_widgets to a GList
*/
toplevel = widget->parent;
while (toplevel)
ancestor = widget->parent;
while (ancestor)
{
GSList *slist;
GSList *prev;
if (!GTK_CONTAINER (toplevel)->resize_widgets)
if (!GTK_CONTAINER (ancestor)->resize_widgets)
{
toplevel = toplevel->parent;
ancestor = ancestor->parent;
continue;
}
prev = NULL;
slist = GTK_CONTAINER (toplevel)->resize_widgets;
slist = GTK_CONTAINER (ancestor)->resize_widgets;
while (slist)
{
GtkWidget *child;
@ -1571,7 +1581,7 @@ gtk_widget_unparent (GtkWidget *widget)
if (prev)
prev->next = slist;
else
GTK_CONTAINER (toplevel)->resize_widgets = slist;
GTK_CONTAINER (ancestor)->resize_widgets = slist;
g_slist_free_1 (last);
}
@ -1579,7 +1589,7 @@ gtk_widget_unparent (GtkWidget *widget)
prev = last;
}
toplevel = toplevel->parent;
ancestor = ancestor->parent;
}
gtk_widget_queue_clear_child (widget);
@ -1599,7 +1609,12 @@ gtk_widget_unparent (GtkWidget *widget)
widget->parent = NULL;
gtk_widget_set_parent_window (widget, NULL);
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[PARENT_SET], old_parent);
gtk_widget_propagate_hierarchy_changed (widget, NULL);
if (toplevel)
{
gtk_widget_propagate_hierarchy_changed (widget, toplevel);
g_object_unref (toplevel);
}
g_object_notify (G_OBJECT (widget), "parent");
g_object_thaw_notify (G_OBJECT (widget));
if (!widget->parent)
@ -3455,7 +3470,8 @@ gtk_widget_set_parent (GtkWidget *widget,
gtk_widget_set_style_recurse (widget, NULL);
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[PARENT_SET], NULL);
gtk_widget_propagate_hierarchy_changed (widget, NULL);
if (GTK_WIDGET_ANCHORED (widget->parent))
gtk_widget_propagate_hierarchy_changed (widget, NULL);
g_object_notify (G_OBJECT (widget), "parent");
}
@ -3928,7 +3944,8 @@ gtk_widget_propagate_hierarchy_changed (GtkWidget *widget,
else
GTK_PRIVATE_UNSET_FLAG (widget, GTK_ANCHORED);
g_signal_emit (GTK_OBJECT (widget), widget_signals[HIERARCHY_CHANGED], 0);
g_signal_emit (GTK_OBJECT (widget), widget_signals[HIERARCHY_CHANGED],
0, client_data);
if (GTK_IS_CONTAINER (widget))
gtk_container_forall (GTK_CONTAINER (widget),

View File

@ -266,7 +266,8 @@ struct _GtkWidgetClass
GtkStateType previous_state);
void (* parent_set) (GtkWidget *widget,
GtkWidget *previous_parent);
void (* hierarchy_changed) (GtkWidget *widget);
void (* hierarchy_changed) (GtkWidget *widget,
GtkWidget *previous_toplevel);
void (* style_set) (GtkWidget *widget,
GtkStyle *previous_style);
void (* direction_changed) (GtkWidget *widget,

View File

@ -2898,7 +2898,7 @@ gtk_window_move_resize (GtkWindow *window)
*/
gtk_widget_queue_resize (GTK_WIDGET (container));
if (container->resize_mode == GTK_RESIZE_QUEUE)
gtk_container_dequeue_resize_handler (container);
_gtk_container_dequeue_resize_handler (container);
}
else
{