summaryrefslogtreecommitdiff
path: root/gtk/gtkmenubar.c
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 /gtk/gtkmenubar.c
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.
Diffstat (limited to 'gtk/gtkmenubar.c')
-rw-r--r--gtk/gtkmenubar.c33
1 files changed, 8 insertions, 25 deletions
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