summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2001-07-01 00:57:21 +0000
committerOwen Taylor <otaylor@src.gnome.org>2001-07-01 00:57:21 +0000
commitde985fb58e80be74a181fee5e6f2d85d390c9140 (patch)
tree0f5375d670b577d09c94a59bcb2ec0b5f3086613
parent95cd4d8e66453e3c0f2e97d8a8eff312bf675b3a (diff)
downloadgdk-pixbuf-de985fb58e80be74a181fee5e6f2d85d390c9140.tar.gz
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.
-rw-r--r--ChangeLog17
-rw-r--r--ChangeLog.pre-2-017
-rw-r--r--ChangeLog.pre-2-1017
-rw-r--r--ChangeLog.pre-2-217
-rw-r--r--ChangeLog.pre-2-417
-rw-r--r--ChangeLog.pre-2-617
-rw-r--r--ChangeLog.pre-2-817
-rw-r--r--gtk/gtkcontainer.c4
-rw-r--r--gtk/gtkcontainer.h2
-rw-r--r--gtk/gtklabel.c6
-rw-r--r--gtk/gtkmenubar.c33
-rw-r--r--gtk/gtkmenubar.h2
-rw-r--r--gtk/gtksocket.c6
-rw-r--r--gtk/gtktypeutils.c2
-rw-r--r--gtk/gtkwidget.c41
-rw-r--r--gtk/gtkwidget.h3
-rw-r--r--gtk/gtkwindow.c2
17 files changed, 171 insertions, 49 deletions
diff --git a/ChangeLog b/ChangeLog
index c256b216e..94abf571b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index c256b216e..94abf571b 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -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
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index c256b216e..94abf571b 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -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
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index c256b216e..94abf571b 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -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
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index c256b216e..94abf571b 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -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
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index c256b216e..94abf571b 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -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
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index c256b216e..94abf571b 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -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
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 455eef710..b73529d11 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -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));
diff --git a/gtk/gtkcontainer.h b/gtk/gtkcontainer.h
index d668a418f..cebb10b82 100644
--- a/gtk/gtkcontainer.h
+++ b/gtk/gtkcontainer.h
@@ -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
}
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index b1e85ffff..64f85330e 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -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);
diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c
index e5b20b856..298241892 100644
--- a/gtk/gtkmenubar.c
+++ b/gtk/gtkmenubar.c
@@ -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
diff --git a/gtk/gtkmenubar.h b/gtk/gtkmenubar.h
index e1d55830a..195f94ee3 100644
--- a/gtk/gtkmenubar.h
+++ b/gtk/gtkmenubar.h
@@ -51,8 +51,6 @@ typedef struct _GtkMenuBarClass GtkMenuBarClass;
struct _GtkMenuBar
{
GtkMenuShell menu_shell;
-
- GtkWidget *toplevel;
};
struct _GtkMenuBarClass
diff --git a/gtk/gtksocket.c b/gtk/gtksocket.c
index 77d391b29..f28310bcc 100644
--- a/gtk/gtksocket.c
+++ b/gtk/gtksocket.c
@@ -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);
diff --git a/gtk/gtktypeutils.c b/gtk/gtktypeutils.c
index 6b7de94cc..c49a69a8d 100644
--- a/gtk/gtktypeutils.c
+++ b/gtk/gtktypeutils.c
@@ -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.
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 3851d0952..6bff27922 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -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),
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 83f416e4b..e8f525fe1 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -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,
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index b4b6f9f26..1ebd9f19f 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -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
{