static GtkShadowType get_shadow_type (GtkMenuBar *menubar);
-static GtkMenuShellClass *parent_class = NULL;
+G_DEFINE_TYPE (GtkMenuBar, gtk_menu_bar, GTK_TYPE_MENU_SHELL)
-GType
-gtk_menu_bar_get_type (void)
+static void
+gtk_menu_bar_init (GtkMenuBar *object)
{
- static GType menu_bar_type = 0;
-
- if (!menu_bar_type)
- {
- static const GTypeInfo menu_bar_info =
- {
- sizeof (GtkMenuBarClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gtk_menu_bar_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GtkMenuBar),
- 0, /* n_preallocs */
- NULL, /* instance_init */
- };
-
- menu_bar_type = g_type_register_static (GTK_TYPE_MENU_SHELL, "GtkMenuBar",
- &menu_bar_info, 0);
- }
-
- return menu_bar_type;
}
static void
gtk_menu_bar_class_init (GtkMenuBarClass *class)
{
GObjectClass *gobject_class;
- GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkMenuShellClass *menu_shell_class;
GtkBindingSet *binding_set;
- parent_class = g_type_class_peek_parent (class);
-
gobject_class = (GObjectClass*) class;
- object_class = (GtkObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
menu_shell_class = (GtkMenuShellClass*) class;
}
}
- gtk_widget_style_get (widget, "internal_padding", &ipadding, NULL);
+ gtk_widget_style_get (widget, "internal-padding", &ipadding, NULL);
requisition->width += (GTK_CONTAINER (menu_bar)->border_width +
ipadding +
allocation->x, allocation->y,
allocation->width, allocation->height);
- gtk_widget_style_get (widget, "internal_padding", &ipadding, NULL);
+ gtk_widget_style_get (widget, "internal-padding", &ipadding, NULL);
if (menu_shell->children)
{
{
gtk_menu_bar_paint (widget, &event->area);
- (* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
+ (* GTK_WIDGET_CLASS (gtk_menu_bar_parent_class)->expose_event) (widget, event);
}
return FALSE;
set_menu_bars (GtkWindow *window,
GList *menubars)
{
- g_object_set_data (G_OBJECT (window), "gtk-menu-bar-list", menubars);
+ g_object_set_data (G_OBJECT (window), I_("gtk-menu-bar-list"), menubars);
}
static gboolean
gboolean retval = FALSE;
g_object_get (gtk_widget_get_settings (widget),
- "gtk-menu-bar-accel",
- &accel,
+ "gtk-menu-bar-accel", &accel,
NULL);
- if (accel)
+ if (accel && *accel)
{
guint keyval = 0;
GdkModifierType mods = 0;
GtkShadowType shadow_type = GTK_SHADOW_OUT;
gtk_widget_style_get (GTK_WIDGET (menubar),
- "shadow_type", &shadow_type,
+ "shadow-type", &shadow_type,
NULL);
return shadow_type;
}
}
- GTK_MENU_SHELL_CLASS (parent_class)->move_current (menu_shell, direction);
+ GTK_MENU_SHELL_CLASS (gtk_menu_bar_parent_class)->move_current (menu_shell, direction);
}
/**
GtkPackDirection pack_dir)
{
GtkMenuBarPrivate *priv;
+ GList *l;
g_return_if_fail (GTK_IS_MENU_BAR (menubar));
priv->pack_direction = pack_dir;
gtk_widget_queue_resize (GTK_WIDGET (menubar));
+
+ for (l = GTK_MENU_SHELL (menubar)->children; l; l = l->next)
+ gtk_widget_queue_resize (GTK_WIDGET (l->data));
+
g_object_notify (G_OBJECT (menubar), "pack-direction");
}
}
GtkPackDirection child_pack_dir)
{
GtkMenuBarPrivate *priv;
+ GList *l;
g_return_if_fail (GTK_IS_MENU_BAR (menubar));
priv->child_pack_direction = child_pack_dir;
gtk_widget_queue_resize (GTK_WIDGET (menubar));
+
+ for (l = GTK_MENU_SHELL (menubar)->children; l; l = l->next)
+ gtk_widget_queue_resize (GTK_WIDGET (l->data));
+
g_object_notify (G_OBJECT (menubar), "child-pack-direction");
}
}