Deprecation cleanup

Fri Oct  4 18:40:50 2002  Manish Singh  <yosh@gimp.org>

        * gtkcheckmenuitem.[ch] gtkimagemenuitem.[ch] gtkmenu.[ch]
        gtkmenubar.[ch] gtkmenuitem.[ch] gtkmenushell.[ch]
        gtkradiomenuitem.[ch]: Deprecation cleanup
This commit is contained in:
Manish Singh 2002-10-05 01:51:16 +00:00 committed by Manish Singh
parent 2ffa58f11d
commit 8409ada92f
20 changed files with 340 additions and 287 deletions

View File

@ -1,3 +1,9 @@
Fri Oct 4 18:40:50 2002 Manish Singh <yosh@gimp.org>
* gtkcheckmenuitem.[ch] gtkimagemenuitem.[ch] gtkmenu.[ch]
gtkmenubar.[ch] gtkmenuitem.[ch] gtkmenushell.[ch]
gtkradiomenuitem.[ch]: Deprecation cleanup
Fri Oct 4 16:48:27 2002 Manish Singh <yosh@gimp.org> Fri Oct 4 16:48:27 2002 Manish Singh <yosh@gimp.org>
* gtkaspectframe.[ch] gtkbin.[ch] gtkframe.[ch] gtkhruler.[ch] * gtkaspectframe.[ch] gtkbin.[ch] gtkframe.[ch] gtkhruler.[ch]

View File

@ -1,3 +1,9 @@
Fri Oct 4 18:40:50 2002 Manish Singh <yosh@gimp.org>
* gtkcheckmenuitem.[ch] gtkimagemenuitem.[ch] gtkmenu.[ch]
gtkmenubar.[ch] gtkmenuitem.[ch] gtkmenushell.[ch]
gtkradiomenuitem.[ch]: Deprecation cleanup
Fri Oct 4 16:48:27 2002 Manish Singh <yosh@gimp.org> Fri Oct 4 16:48:27 2002 Manish Singh <yosh@gimp.org>
* gtkaspectframe.[ch] gtkbin.[ch] gtkframe.[ch] gtkhruler.[ch] * gtkaspectframe.[ch] gtkbin.[ch] gtkframe.[ch] gtkhruler.[ch]

View File

@ -1,3 +1,9 @@
Fri Oct 4 18:40:50 2002 Manish Singh <yosh@gimp.org>
* gtkcheckmenuitem.[ch] gtkimagemenuitem.[ch] gtkmenu.[ch]
gtkmenubar.[ch] gtkmenuitem.[ch] gtkmenushell.[ch]
gtkradiomenuitem.[ch]: Deprecation cleanup
Fri Oct 4 16:48:27 2002 Manish Singh <yosh@gimp.org> Fri Oct 4 16:48:27 2002 Manish Singh <yosh@gimp.org>
* gtkaspectframe.[ch] gtkbin.[ch] gtkframe.[ch] gtkhruler.[ch] * gtkaspectframe.[ch] gtkbin.[ch] gtkframe.[ch] gtkhruler.[ch]

View File

@ -1,3 +1,9 @@
Fri Oct 4 18:40:50 2002 Manish Singh <yosh@gimp.org>
* gtkcheckmenuitem.[ch] gtkimagemenuitem.[ch] gtkmenu.[ch]
gtkmenubar.[ch] gtkmenuitem.[ch] gtkmenushell.[ch]
gtkradiomenuitem.[ch]: Deprecation cleanup
Fri Oct 4 16:48:27 2002 Manish Singh <yosh@gimp.org> Fri Oct 4 16:48:27 2002 Manish Singh <yosh@gimp.org>
* gtkaspectframe.[ch] gtkbin.[ch] gtkframe.[ch] gtkhruler.[ch] * gtkaspectframe.[ch] gtkbin.[ch] gtkframe.[ch] gtkhruler.[ch]

View File

@ -1,3 +1,9 @@
Fri Oct 4 18:40:50 2002 Manish Singh <yosh@gimp.org>
* gtkcheckmenuitem.[ch] gtkimagemenuitem.[ch] gtkmenu.[ch]
gtkmenubar.[ch] gtkmenuitem.[ch] gtkmenushell.[ch]
gtkradiomenuitem.[ch]: Deprecation cleanup
Fri Oct 4 16:48:27 2002 Manish Singh <yosh@gimp.org> Fri Oct 4 16:48:27 2002 Manish Singh <yosh@gimp.org>
* gtkaspectframe.[ch] gtkbin.[ch] gtkframe.[ch] gtkhruler.[ch] * gtkaspectframe.[ch] gtkbin.[ch] gtkframe.[ch] gtkhruler.[ch]

View File

@ -1,3 +1,9 @@
Fri Oct 4 18:40:50 2002 Manish Singh <yosh@gimp.org>
* gtkcheckmenuitem.[ch] gtkimagemenuitem.[ch] gtkmenu.[ch]
gtkmenubar.[ch] gtkmenuitem.[ch] gtkmenushell.[ch]
gtkradiomenuitem.[ch]: Deprecation cleanup
Fri Oct 4 16:48:27 2002 Manish Singh <yosh@gimp.org> Fri Oct 4 16:48:27 2002 Manish Singh <yosh@gimp.org>
* gtkaspectframe.[ch] gtkbin.[ch] gtkframe.[ch] gtkhruler.[ch] * gtkaspectframe.[ch] gtkbin.[ch] gtkframe.[ch] gtkhruler.[ch]

View File

@ -26,7 +26,6 @@
#include "gtkcheckmenuitem.h" #include "gtkcheckmenuitem.h"
#include "gtkaccellabel.h" #include "gtkaccellabel.h"
#include "gtksignal.h"
#include "gtkintl.h" #include "gtkintl.h"
#include "gtkmarshalers.h" #include "gtkmarshalers.h"
@ -68,26 +67,29 @@ static GtkMenuItemClass *parent_class = NULL;
static guint check_menu_item_signals[LAST_SIGNAL] = { 0 }; static guint check_menu_item_signals[LAST_SIGNAL] = { 0 };
GtkType GType
gtk_check_menu_item_get_type (void) gtk_check_menu_item_get_type (void)
{ {
static GtkType check_menu_item_type = 0; static GType check_menu_item_type = 0;
if (!check_menu_item_type) if (!check_menu_item_type)
{ {
static const GtkTypeInfo check_menu_item_info = static const GTypeInfo check_menu_item_info =
{ {
"GtkCheckMenuItem",
sizeof (GtkCheckMenuItem),
sizeof (GtkCheckMenuItemClass), sizeof (GtkCheckMenuItemClass),
(GtkClassInitFunc) gtk_check_menu_item_class_init, NULL, /* base_init */
(GtkObjectInitFunc) gtk_check_menu_item_init, NULL, /* base_finalize */
/* reserved_1 */ NULL, (GClassInitFunc) gtk_check_menu_item_class_init,
/* reserved_2 */ NULL, NULL, /* class_finalize */
(GtkClassInitFunc) NULL, NULL, /* class_data */
sizeof (GtkCheckMenuItem),
0, /* n_preallocs */
(GInstanceInitFunc) gtk_check_menu_item_init,
}; };
check_menu_item_type = gtk_type_unique (GTK_TYPE_MENU_ITEM, &check_menu_item_info); check_menu_item_type =
g_type_register_static (GTK_TYPE_MENU_ITEM, "GtkCheckMenuItem",
&check_menu_item_info, 0);
} }
return check_menu_item_type; return check_menu_item_type;
@ -96,20 +98,20 @@ gtk_check_menu_item_get_type (void)
static void static void
gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass) gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass)
{ {
GtkObjectClass *object_class; GObjectClass *gobject_class;
GtkWidgetClass *widget_class; GtkWidgetClass *widget_class;
GtkMenuItemClass *menu_item_class; GtkMenuItemClass *menu_item_class;
object_class = (GtkObjectClass*) klass; gobject_class = G_OBJECT_CLASS (klass);
widget_class = (GtkWidgetClass*) klass; widget_class = (GtkWidgetClass*) klass;
menu_item_class = (GtkMenuItemClass*) klass; menu_item_class = (GtkMenuItemClass*) klass;
parent_class = gtk_type_class (GTK_TYPE_MENU_ITEM); parent_class = g_type_class_peek_parent (klass);
G_OBJECT_CLASS(object_class)->set_property = gtk_check_menu_item_set_property; gobject_class->set_property = gtk_check_menu_item_set_property;
G_OBJECT_CLASS(object_class)->get_property = gtk_check_menu_item_get_property; gobject_class->get_property = gtk_check_menu_item_get_property;
g_object_class_install_property (G_OBJECT_CLASS (object_class), g_object_class_install_property (gobject_class,
PROP_ACTIVE, PROP_ACTIVE,
g_param_spec_boolean ("active", g_param_spec_boolean ("active",
_("Active"), _("Active"),
@ -117,7 +119,7 @@ gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass)
FALSE, FALSE,
G_PARAM_READWRITE)); G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (object_class), g_object_class_install_property (gobject_class,
PROP_INCONSISTENT, PROP_INCONSISTENT,
g_param_spec_boolean ("inconsistent", g_param_spec_boolean ("inconsistent",
_("Inconsistent"), _("Inconsistent"),
@ -135,18 +137,19 @@ gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass)
klass->draw_indicator = gtk_real_check_menu_item_draw_indicator; klass->draw_indicator = gtk_real_check_menu_item_draw_indicator;
check_menu_item_signals[TOGGLED] = check_menu_item_signals[TOGGLED] =
gtk_signal_new ("toggled", g_signal_new ("toggled",
GTK_RUN_FIRST, G_OBJECT_CLASS_TYPE (gobject_class),
GTK_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST,
GTK_SIGNAL_OFFSET (GtkCheckMenuItemClass, toggled), G_STRUCT_OFFSET (GtkCheckMenuItemClass, toggled),
_gtk_marshal_VOID__VOID, NULL, NULL,
GTK_TYPE_NONE, 0); _gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
} }
GtkWidget* GtkWidget*
gtk_check_menu_item_new (void) gtk_check_menu_item_new (void)
{ {
return GTK_WIDGET (gtk_type_new (GTK_TYPE_CHECK_MENU_ITEM)); return g_object_new (GTK_TYPE_CHECK_MENU_ITEM, NULL);
} }
GtkWidget* GtkWidget*
@ -184,7 +187,7 @@ gtk_check_menu_item_new_with_mnemonic (const gchar *label)
GtkWidget *accel_label; GtkWidget *accel_label;
check_menu_item = gtk_check_menu_item_new (); check_menu_item = gtk_check_menu_item_new ();
accel_label = gtk_type_new (GTK_TYPE_ACCEL_LABEL); accel_label = g_object_new (GTK_TYPE_ACCEL_LABEL, NULL);
gtk_label_set_text_with_mnemonic (GTK_LABEL (accel_label), label); gtk_label_set_text_with_mnemonic (GTK_LABEL (accel_label), label);
gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5);
@ -247,7 +250,7 @@ gtk_check_menu_item_set_show_toggle (GtkCheckMenuItem *menu_item,
void void
gtk_check_menu_item_toggled (GtkCheckMenuItem *check_menu_item) gtk_check_menu_item_toggled (GtkCheckMenuItem *check_menu_item)
{ {
gtk_signal_emit (GTK_OBJECT (check_menu_item), check_menu_item_signals[TOGGLED]); g_signal_emit (check_menu_item, check_menu_item_signals[TOGGLED], 0);
} }
/** /**

View File

@ -38,11 +38,11 @@ extern "C" {
#define GTK_TYPE_CHECK_MENU_ITEM (gtk_check_menu_item_get_type ()) #define GTK_TYPE_CHECK_MENU_ITEM (gtk_check_menu_item_get_type ())
#define GTK_CHECK_MENU_ITEM(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_CHECK_MENU_ITEM, GtkCheckMenuItem)) #define GTK_CHECK_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CHECK_MENU_ITEM, GtkCheckMenuItem))
#define GTK_CHECK_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_CHECK_MENU_ITEM, GtkCheckMenuItemClass)) #define GTK_CHECK_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CHECK_MENU_ITEM, GtkCheckMenuItemClass))
#define GTK_IS_CHECK_MENU_ITEM(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_CHECK_MENU_ITEM)) #define GTK_IS_CHECK_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CHECK_MENU_ITEM))
#define GTK_IS_CHECK_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CHECK_MENU_ITEM)) #define GTK_IS_CHECK_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CHECK_MENU_ITEM))
#define GTK_CHECK_MENU_ITEM_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_CHECK_MENU_ITEM, GtkCheckMenuItemClass)) #define GTK_CHECK_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CHECK_MENU_ITEM, GtkCheckMenuItemClass))
typedef struct _GtkCheckMenuItem GtkCheckMenuItem; typedef struct _GtkCheckMenuItem GtkCheckMenuItem;
@ -73,7 +73,7 @@ struct _GtkCheckMenuItemClass
}; };
GtkType gtk_check_menu_item_get_type (void) G_GNUC_CONST; GType gtk_check_menu_item_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_check_menu_item_new (void); GtkWidget* gtk_check_menu_item_new (void);
GtkWidget* gtk_check_menu_item_new_with_label (const gchar *label); GtkWidget* gtk_check_menu_item_new_with_label (const gchar *label);
GtkWidget* gtk_check_menu_item_new_with_mnemonic (const gchar *label); GtkWidget* gtk_check_menu_item_new_with_mnemonic (const gchar *label);

View File

@ -26,7 +26,6 @@
#include "gtkimagemenuitem.h" #include "gtkimagemenuitem.h"
#include "gtkaccellabel.h" #include "gtkaccellabel.h"
#include "gtksignal.h"
#include "gtkintl.h" #include "gtkintl.h"
#include "gtkstock.h" #include "gtkstock.h"
#include "gtkiconfactory.h" #include "gtkiconfactory.h"
@ -65,26 +64,29 @@ enum {
static GtkMenuItemClass *parent_class = NULL; static GtkMenuItemClass *parent_class = NULL;
GtkType GType
gtk_image_menu_item_get_type (void) gtk_image_menu_item_get_type (void)
{ {
static GtkType image_menu_item_type = 0; static GType image_menu_item_type = 0;
if (!image_menu_item_type) if (!image_menu_item_type)
{ {
static const GtkTypeInfo image_menu_item_info = static const GTypeInfo image_menu_item_info =
{ {
"GtkImageMenuItem",
sizeof (GtkImageMenuItem),
sizeof (GtkImageMenuItemClass), sizeof (GtkImageMenuItemClass),
(GtkClassInitFunc) gtk_image_menu_item_class_init, NULL, /* base_init */
(GtkObjectInitFunc) gtk_image_menu_item_init, NULL, /* base_finalize */
/* reserved_1 */ NULL, (GClassInitFunc) gtk_image_menu_item_class_init,
/* reserved_2 */ NULL, NULL, /* class_finalize */
(GtkClassInitFunc) NULL, NULL, /* class_data */
sizeof (GtkImageMenuItem),
0, /* n_preallocs */
(GInstanceInitFunc) gtk_image_menu_item_init,
}; };
image_menu_item_type = gtk_type_unique (GTK_TYPE_MENU_ITEM, &image_menu_item_info); image_menu_item_type =
g_type_register_static (GTK_TYPE_MENU_ITEM, "GtkImageMenuItem",
&image_menu_item_info, 0);
} }
return image_menu_item_type; return image_menu_item_type;
@ -94,18 +96,16 @@ static void
gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass) gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GtkObjectClass *object_class;
GtkWidgetClass *widget_class; GtkWidgetClass *widget_class;
GtkMenuItemClass *menu_item_class; GtkMenuItemClass *menu_item_class;
GtkContainerClass *container_class; GtkContainerClass *container_class;
gobject_class = (GObjectClass*) klass; gobject_class = (GObjectClass*) klass;
object_class = (GtkObjectClass*) klass;
widget_class = (GtkWidgetClass*) klass; widget_class = (GtkWidgetClass*) klass;
menu_item_class = (GtkMenuItemClass*) klass; menu_item_class = (GtkMenuItemClass*) klass;
container_class = (GtkContainerClass*) klass; container_class = (GtkContainerClass*) klass;
parent_class = gtk_type_class (GTK_TYPE_MENU_ITEM); parent_class = g_type_class_peek_parent (klass);
widget_class->size_request = gtk_image_menu_item_size_request; widget_class->size_request = gtk_image_menu_item_size_request;
widget_class->size_allocate = gtk_image_menu_item_size_allocate; widget_class->size_allocate = gtk_image_menu_item_size_allocate;
@ -301,8 +301,7 @@ gtk_image_menu_item_new_with_label (const gchar *label)
GtkImageMenuItem *image_menu_item; GtkImageMenuItem *image_menu_item;
GtkWidget *accel_label; GtkWidget *accel_label;
image_menu_item = GTK_IMAGE_MENU_ITEM (g_object_new (GTK_TYPE_IMAGE_MENU_ITEM, image_menu_item = g_object_new (GTK_TYPE_IMAGE_MENU_ITEM, NULL);
NULL));
accel_label = gtk_accel_label_new (label); accel_label = gtk_accel_label_new (label);
gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5);
@ -332,10 +331,9 @@ gtk_image_menu_item_new_with_mnemonic (const gchar *label)
GtkImageMenuItem *image_menu_item; GtkImageMenuItem *image_menu_item;
GtkWidget *accel_label; GtkWidget *accel_label;
image_menu_item = GTK_IMAGE_MENU_ITEM (g_object_new (GTK_TYPE_IMAGE_MENU_ITEM, image_menu_item = g_object_new (GTK_TYPE_IMAGE_MENU_ITEM, NULL);
NULL));
accel_label = gtk_type_new (GTK_TYPE_ACCEL_LABEL); accel_label = g_object_new (GTK_TYPE_ACCEL_LABEL, NULL);
gtk_label_set_text_with_mnemonic (GTK_LABEL (accel_label), label); gtk_label_set_text_with_mnemonic (GTK_LABEL (accel_label), label);
gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5);

View File

@ -38,11 +38,11 @@ extern "C" {
#define GTK_TYPE_IMAGE_MENU_ITEM (gtk_image_menu_item_get_type ()) #define GTK_TYPE_IMAGE_MENU_ITEM (gtk_image_menu_item_get_type ())
#define GTK_IMAGE_MENU_ITEM(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_IMAGE_MENU_ITEM, GtkImageMenuItem)) #define GTK_IMAGE_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IMAGE_MENU_ITEM, GtkImageMenuItem))
#define GTK_IMAGE_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMAGE_MENU_ITEM, GtkImageMenuItemClass)) #define GTK_IMAGE_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMAGE_MENU_ITEM, GtkImageMenuItemClass))
#define GTK_IS_IMAGE_MENU_ITEM(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_IMAGE_MENU_ITEM)) #define GTK_IS_IMAGE_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_IMAGE_MENU_ITEM))
#define GTK_IS_IMAGE_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMAGE_MENU_ITEM)) #define GTK_IS_IMAGE_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMAGE_MENU_ITEM))
#define GTK_IMAGE_MENU_ITEM_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_IMAGE_MENU_ITEM, GtkImageMenuItemClass)) #define GTK_IMAGE_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IMAGE_MENU_ITEM, GtkImageMenuItemClass))
typedef struct _GtkImageMenuItem GtkImageMenuItem; typedef struct _GtkImageMenuItem GtkImageMenuItem;
@ -62,7 +62,7 @@ struct _GtkImageMenuItemClass
}; };
GtkType gtk_image_menu_item_get_type (void) G_GNUC_CONST; GType gtk_image_menu_item_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_image_menu_item_new (void); GtkWidget* gtk_image_menu_item_new (void);
GtkWidget* gtk_image_menu_item_new_with_label (const gchar *label); GtkWidget* gtk_image_menu_item_new_with_label (const gchar *label);
GtkWidget* gtk_image_menu_item_new_with_mnemonic (const gchar *label); GtkWidget* gtk_image_menu_item_new_with_mnemonic (const gchar *label);

View File

@ -24,6 +24,8 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/. * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#define GTK_MENU_INTERNALS
#include <string.h> /* memset */ #include <string.h> /* memset */
#include "gdk/gdkkeysyms.h" #include "gdk/gdkkeysyms.h"
#include "gtkaccelmap.h" #include "gtkaccelmap.h"
@ -32,7 +34,6 @@
#include "gtkmain.h" #include "gtkmain.h"
#include "gtkmenu.h" #include "gtkmenu.h"
#include "gtkmenuitem.h" #include "gtkmenuitem.h"
#include "gtksignal.h"
#include "gtkwindow.h" #include "gtkwindow.h"
#include "gtkhbox.h" #include "gtkhbox.h"
#include "gtkvscrollbar.h" #include "gtkvscrollbar.h"
@ -180,26 +181,28 @@ gtk_menu_get_private (GtkMenu *menu)
return private; return private;
} }
GtkType GType
gtk_menu_get_type (void) gtk_menu_get_type (void)
{ {
static GtkType menu_type = 0; static GType menu_type = 0;
if (!menu_type) if (!menu_type)
{ {
static const GtkTypeInfo menu_info = static const GTypeInfo menu_info =
{ {
"GtkMenu",
sizeof (GtkMenu),
sizeof (GtkMenuClass), sizeof (GtkMenuClass),
(GtkClassInitFunc) gtk_menu_class_init, NULL, /* base_init */
(GtkObjectInitFunc) gtk_menu_init, NULL, /* base_finalize */
/* reserved_1 */ NULL, (GClassInitFunc) gtk_menu_class_init,
/* reserved_2 */ NULL, NULL, /* class_finalize */
(GtkClassInitFunc) NULL, NULL, /* class_data */
sizeof (GtkMenu),
0, /* n_preallocs */
(GInstanceInitFunc) gtk_menu_init,
}; };
menu_type = gtk_type_unique (gtk_menu_shell_get_type (), &menu_info); menu_type = g_type_register_static (GTK_TYPE_MENU_SHELL, "GtkMenu",
&menu_info, 0);
} }
return menu_type; return menu_type;
@ -228,6 +231,7 @@ gtk_menu_class_init (GtkMenuClass *class)
_("A title that may be displayed by the window manager when this menu is torn-off"), _("A title that may be displayed by the window manager when this menu is torn-off"),
"", "",
G_PARAM_READABLE | G_PARAM_WRITABLE)); G_PARAM_READABLE | G_PARAM_WRITABLE));
object_class->destroy = gtk_menu_destroy; object_class->destroy = gtk_menu_destroy;
widget_class->realize = gtk_menu_realize; widget_class->realize = gtk_menu_realize;
@ -351,8 +355,8 @@ gtk_menu_window_event (GtkWidget *window,
{ {
gboolean handled = FALSE; gboolean handled = FALSE;
gtk_widget_ref (window); g_object_ref (window);
gtk_widget_ref (menu); g_object_ref (menu);
switch (event->type) switch (event->type)
{ {
@ -364,8 +368,8 @@ gtk_menu_window_event (GtkWidget *window,
break; break;
} }
gtk_widget_unref (window); g_object_unref (window);
gtk_widget_unref (menu); g_object_unref (menu);
return handled; return handled;
} }
@ -396,16 +400,15 @@ gtk_menu_init (GtkMenu *menu)
menu->position_func_data = NULL; menu->position_func_data = NULL;
menu->toggle_size = 0; menu->toggle_size = 0;
menu->toplevel = g_object_connect (gtk_widget_new (GTK_TYPE_WINDOW, menu->toplevel = g_object_connect (g_object_new (GTK_TYPE_WINDOW,
"type", GTK_WINDOW_POPUP, "type", GTK_WINDOW_POPUP,
"child", menu, "child", menu,
NULL), NULL),
"signal::event", gtk_menu_window_event, menu, "signal::event", gtk_menu_window_event, menu,
"signal::size_request", gtk_menu_window_size_request, menu, "signal::size_request", gtk_menu_window_size_request, menu,
"signal::destroy", gtk_widget_destroyed, &menu->toplevel, "signal::destroy", gtk_widget_destroyed, &menu->toplevel,
NULL); NULL);
gtk_window_set_policy (GTK_WINDOW (menu->toplevel), gtk_window_set_resizable (GTK_WINDOW (menu->toplevel), FALSE);
FALSE, FALSE, TRUE);
gtk_window_set_mnemonic_modifier (GTK_WINDOW (menu->toplevel), 0); gtk_window_set_mnemonic_modifier (GTK_WINDOW (menu->toplevel), 0);
/* Refloat the menu, so that reference counting for the menu isn't /* Refloat the menu, so that reference counting for the menu isn't
@ -449,7 +452,7 @@ gtk_menu_destroy (GtkObject *object)
gtk_menu_stop_scrolling (menu); gtk_menu_stop_scrolling (menu);
data = gtk_object_get_data (object, attach_data_key); data = g_object_get_data (G_OBJECT (object), attach_data_key);
if (data) if (data)
gtk_menu_detach (menu); gtk_menu_detach (menu);
@ -457,7 +460,7 @@ gtk_menu_destroy (GtkObject *object)
if (menu->old_active_menu_item) if (menu->old_active_menu_item)
{ {
gtk_widget_unref (menu->old_active_menu_item); g_object_unref (menu->old_active_menu_item);
menu->old_active_menu_item = NULL; menu->old_active_menu_item = NULL;
} }
@ -465,7 +468,7 @@ gtk_menu_destroy (GtkObject *object)
if (menu->needs_destruction_ref_count) if (menu->needs_destruction_ref_count)
{ {
menu->needs_destruction_ref_count = FALSE; menu->needs_destruction_ref_count = FALSE;
gtk_object_ref (object); g_object_ref (object);
} }
if (menu->accel_group) if (menu->accel_group)
@ -506,21 +509,21 @@ gtk_menu_attach_to_widget (GtkMenu *menu,
/* keep this function in sync with gtk_widget_set_parent() /* keep this function in sync with gtk_widget_set_parent()
*/ */
data = gtk_object_get_data (GTK_OBJECT (menu), attach_data_key); data = g_object_get_data (G_OBJECT (menu), attach_data_key);
if (data) if (data)
{ {
g_warning ("gtk_menu_attach_to_widget(): menu already attached to %s", g_warning ("gtk_menu_attach_to_widget(): menu already attached to %s",
gtk_type_name (GTK_OBJECT_TYPE (data->attach_widget))); g_type_name (G_TYPE_FROM_INSTANCE (data->attach_widget)));
return; return;
} }
gtk_object_ref (GTK_OBJECT (menu)); g_object_ref (menu);
gtk_object_sink (GTK_OBJECT (menu)); gtk_object_sink (GTK_OBJECT (menu));
data = g_new (GtkMenuAttachData, 1); data = g_new (GtkMenuAttachData, 1);
data->attach_widget = attach_widget; data->attach_widget = attach_widget;
data->detacher = detacher; data->detacher = detacher;
gtk_object_set_data (GTK_OBJECT (menu), attach_data_key, data); g_object_set_data (G_OBJECT (menu), attach_data_key, data);
if (GTK_WIDGET_STATE (menu) != GTK_STATE_NORMAL) if (GTK_WIDGET_STATE (menu) != GTK_STATE_NORMAL)
gtk_widget_set_state (GTK_WIDGET (menu), GTK_STATE_NORMAL); gtk_widget_set_state (GTK_WIDGET (menu), GTK_STATE_NORMAL);
@ -540,7 +543,7 @@ gtk_menu_get_attach_widget (GtkMenu *menu)
g_return_val_if_fail (GTK_IS_MENU (menu), NULL); g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
data = gtk_object_get_data (GTK_OBJECT (menu), attach_data_key); data = g_object_get_data (G_OBJECT (menu), attach_data_key);
if (data) if (data)
return data->attach_widget; return data->attach_widget;
return NULL; return NULL;
@ -555,13 +558,13 @@ gtk_menu_detach (GtkMenu *menu)
/* keep this function in sync with gtk_widget_unparent() /* keep this function in sync with gtk_widget_unparent()
*/ */
data = gtk_object_get_data (GTK_OBJECT (menu), attach_data_key); data = g_object_get_data (G_OBJECT (menu), attach_data_key);
if (!data) if (!data)
{ {
g_warning ("gtk_menu_detach(): menu is not attached"); g_warning ("gtk_menu_detach(): menu is not attached");
return; return;
} }
gtk_object_remove_data (GTK_OBJECT (menu), attach_data_key); g_object_set_data (G_OBJECT (menu), attach_data_key, NULL);
data->detacher (data->attach_widget, menu); data->detacher (data->attach_widget, menu);
@ -573,7 +576,7 @@ gtk_menu_detach (GtkMenu *menu)
/* Fallback title for menu comes from attach widget */ /* Fallback title for menu comes from attach widget */
gtk_menu_update_title (menu); gtk_menu_update_title (menu);
gtk_widget_unref (GTK_WIDGET (menu)); g_object_unref (menu);
} }
static void static void
@ -590,7 +593,7 @@ gtk_menu_remove (GtkContainer *container,
*/ */
if (menu->old_active_menu_item == widget) if (menu->old_active_menu_item == widget)
{ {
gtk_widget_unref (menu->old_active_menu_item); g_object_unref (menu->old_active_menu_item);
menu->old_active_menu_item = NULL; menu->old_active_menu_item = NULL;
} }
@ -601,7 +604,7 @@ gtk_menu_remove (GtkContainer *container,
GtkWidget* GtkWidget*
gtk_menu_new (void) gtk_menu_new (void)
{ {
return GTK_WIDGET (gtk_type_new (gtk_menu_get_type ())); return g_object_new (GTK_TYPE_MENU, NULL);
} }
static void static void
@ -636,24 +639,24 @@ gtk_menu_tearoff_bg_copy (GtkMenu *menu)
gc = gdk_gc_new_with_values (widget->window, gc = gdk_gc_new_with_values (widget->window,
&gc_values, GDK_GC_SUBWINDOW); &gc_values, GDK_GC_SUBWINDOW);
gdk_window_get_size (menu->tearoff_window->window, &width, &height); gdk_drawable_get_size (menu->tearoff_window->window, &width, &height);
pixmap = gdk_pixmap_new (menu->tearoff_window->window, pixmap = gdk_pixmap_new (menu->tearoff_window->window,
width, width,
height, height,
-1); -1);
gdk_draw_pixmap (pixmap, gc, gdk_draw_drawable (pixmap, gc,
menu->tearoff_window->window, menu->tearoff_window->window,
0, 0, 0, 0, -1, -1); 0, 0, 0, 0, -1, -1);
gdk_gc_unref (gc); g_object_unref (gc);
gtk_widget_set_usize (menu->tearoff_window, gtk_widget_set_size_request (menu->tearoff_window,
width, width,
height); height);
gdk_window_set_back_pixmap (menu->tearoff_window->window, pixmap, FALSE); gdk_window_set_back_pixmap (menu->tearoff_window->window, pixmap, FALSE);
gdk_pixmap_unref (pixmap); g_object_unref (pixmap);
} }
} }
@ -710,7 +713,7 @@ gtk_menu_popup (GtkMenu *menu,
* attached to a widget, try to get screen from its * attached to a widget, try to get screen from its
* toplevel window else go with the default * toplevel window else go with the default
*/ */
attach_data = gtk_object_get_data (GTK_OBJECT (menu), attach_data_key); attach_data = g_object_get_data (G_OBJECT (menu), attach_data_key);
if (attach_data) if (attach_data)
{ {
if (!GTK_WIDGET_REALIZED (menu)) if (!GTK_WIDGET_REALIZED (menu))
@ -879,9 +882,9 @@ gtk_menu_popdown (GtkMenu *menu)
if (menu_shell->active_menu_item) if (menu_shell->active_menu_item)
{ {
if (menu->old_active_menu_item) if (menu->old_active_menu_item)
gtk_widget_unref (menu->old_active_menu_item); g_object_unref (menu->old_active_menu_item);
menu->old_active_menu_item = menu_shell->active_menu_item; menu->old_active_menu_item = menu_shell->active_menu_item;
gtk_widget_ref (menu->old_active_menu_item); g_object_ref (menu->old_active_menu_item);
} }
gtk_menu_shell_deselect (menu_shell); gtk_menu_shell_deselect (menu_shell);
@ -892,7 +895,7 @@ gtk_menu_popdown (GtkMenu *menu)
if (menu->torn_off) if (menu->torn_off)
{ {
gtk_widget_set_usize (menu->tearoff_window, -1, -1); gtk_widget_set_size_request (menu->tearoff_window, -1, -1);
if (GTK_BIN (menu->toplevel)->child) if (GTK_BIN (menu->toplevel)->child)
{ {
@ -954,7 +957,7 @@ gtk_menu_get_active (GtkMenu *menu)
menu->old_active_menu_item = child; menu->old_active_menu_item = child;
if (menu->old_active_menu_item) if (menu->old_active_menu_item)
gtk_widget_ref (menu->old_active_menu_item); g_object_ref (menu->old_active_menu_item);
} }
return menu->old_active_menu_item; return menu->old_active_menu_item;
@ -976,9 +979,9 @@ gtk_menu_set_active (GtkMenu *menu,
if (GTK_BIN (child)->child) if (GTK_BIN (child)->child)
{ {
if (menu->old_active_menu_item) if (menu->old_active_menu_item)
gtk_widget_unref (menu->old_active_menu_item); g_object_unref (menu->old_active_menu_item);
menu->old_active_menu_item = child; menu->old_active_menu_item = child;
gtk_widget_ref (menu->old_active_menu_item); g_object_ref (menu->old_active_menu_item);
} }
} }
} }
@ -992,10 +995,10 @@ gtk_menu_set_accel_group (GtkMenu *menu,
if (menu->accel_group != accel_group) if (menu->accel_group != accel_group)
{ {
if (menu->accel_group) if (menu->accel_group)
gtk_accel_group_unref (menu->accel_group); g_object_unref (menu->accel_group);
menu->accel_group = accel_group; menu->accel_group = accel_group;
if (menu->accel_group) if (menu->accel_group)
gtk_accel_group_ref (menu->accel_group); g_object_ref (menu->accel_group);
_gtk_menu_refresh_accel_paths (menu, TRUE); _gtk_menu_refresh_accel_paths (menu, TRUE);
} }
} }
@ -1191,7 +1194,7 @@ gtk_menu_set_tearoff_state (GtkMenu *menu,
menu->tearoff_hbox = gtk_hbox_new (FALSE, FALSE); menu->tearoff_hbox = gtk_hbox_new (FALSE, FALSE);
gtk_container_add (GTK_CONTAINER (menu->tearoff_window), menu->tearoff_hbox); gtk_container_add (GTK_CONTAINER (menu->tearoff_window), menu->tearoff_hbox);
gdk_window_get_size (GTK_WIDGET (menu)->window, &width, &height); gdk_drawable_get_size (GTK_WIDGET (menu)->window, &width, &height);
menu->tearoff_adjustment = menu->tearoff_adjustment =
GTK_ADJUSTMENT (gtk_adjustment_new (0, GTK_ADJUSTMENT (gtk_adjustment_new (0,
0, 0,
@ -1199,7 +1202,7 @@ gtk_menu_set_tearoff_state (GtkMenu *menu,
MENU_SCROLL_STEP, MENU_SCROLL_STEP,
height/2, height/2,
height)); height));
g_object_connect (GTK_OBJECT (menu->tearoff_adjustment), g_object_connect (menu->tearoff_adjustment,
"signal::value_changed", gtk_menu_scrollbar_changed, menu, "signal::value_changed", gtk_menu_scrollbar_changed, menu,
NULL); NULL);
menu->tearoff_scrollbar = gtk_vscrollbar_new (menu->tearoff_adjustment); menu->tearoff_scrollbar = gtk_vscrollbar_new (menu->tearoff_adjustment);
@ -1216,7 +1219,7 @@ gtk_menu_set_tearoff_state (GtkMenu *menu,
gtk_menu_reparent (menu, menu->tearoff_hbox, FALSE); gtk_menu_reparent (menu, menu->tearoff_hbox, FALSE);
gdk_window_get_size (GTK_WIDGET (menu)->window, &width, NULL); gdk_drawable_get_size (GTK_WIDGET (menu)->window, &width, NULL);
/* Update menu->requisition /* Update menu->requisition
*/ */
@ -1297,7 +1300,7 @@ gtk_menu_get_title (GtkMenu *menu)
{ {
g_return_val_if_fail (GTK_IS_MENU (menu), NULL); g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
return gtk_object_get_data (GTK_OBJECT (menu), "gtk-menu-title"); return g_object_get_data (G_OBJECT (menu), "gtk-menu-title");
} }
void void
@ -1697,7 +1700,7 @@ gtk_menu_paint (GtkWidget *widget,
border_x = GTK_CONTAINER (widget)->border_width + widget->style->xthickness; border_x = GTK_CONTAINER (widget)->border_width + widget->style->xthickness;
border_y = GTK_CONTAINER (widget)->border_width + widget->style->ythickness; border_y = GTK_CONTAINER (widget)->border_width + widget->style->ythickness;
gdk_window_get_size (widget->window, &width, &height); gdk_drawable_get_size (widget->window, &width, &height);
if (event->window == widget->window) if (event->window == widget->window)
{ {
@ -1839,7 +1842,7 @@ gtk_menu_key_press (GtkWidget *widget,
if (event->keyval == keyval && if (event->keyval == keyval &&
(mods & event->state) == mods) (mods & event->state) == mods)
{ {
gtk_signal_emit_by_name (GTK_OBJECT (menu), "cancel"); g_signal_emit_by_name (menu, "cancel", 0);
} }
g_free (accel); g_free (accel);
@ -1975,7 +1978,7 @@ gtk_menu_motion_notify (GtkWidget *widget,
menu_shell->ignore_enter = FALSE; menu_shell->ignore_enter = FALSE;
gdk_window_get_size (event->window, &width, &height); gdk_drawable_get_size (event->window, &width, &height);
if (event->x >= 0 && event->x < width && if (event->x >= 0 && event->x < width &&
event->y >= 0 && event->y < height) event->y >= 0 && event->y < height)
{ {
@ -2033,7 +2036,7 @@ gtk_menu_scroll_timeout (gpointer data)
if ((menu->scroll_offset >= 0) && (offset < 0)) if ((menu->scroll_offset >= 0) && (offset < 0))
offset = 0; offset = 0;
gdk_window_get_size (widget->window, &view_width, &view_height); gdk_drawable_get_size (widget->window, &view_width, &view_height);
/* Don't scroll past the bottom if we weren't before: */ /* Don't scroll past the bottom if we weren't before: */
if (menu->scroll_offset > 0) if (menu->scroll_offset > 0)
@ -2064,7 +2067,7 @@ gtk_menu_handle_scrolling (GtkMenu *menu, gboolean enter)
menu_shell = GTK_MENU_SHELL (menu); menu_shell = GTK_MENU_SHELL (menu);
gdk_window_get_pointer (GTK_WIDGET (menu)->window, &x, &y, NULL); gdk_window_get_pointer (GTK_WIDGET (menu)->window, &x, &y, NULL);
gdk_window_get_size (GTK_WIDGET (menu)->window, &width, &height); gdk_drawable_get_size (GTK_WIDGET (menu)->window, &width, &height);
border = GTK_CONTAINER (menu)->border_width + GTK_WIDGET (menu)->style->ythickness; border = GTK_CONTAINER (menu)->border_width + GTK_WIDGET (menu)->style->ythickness;
@ -2301,11 +2304,11 @@ gtk_menu_set_submenu_navigation_region (GtkMenu *menu,
event_widget = gtk_get_event_widget ((GdkEvent*) event); event_widget = gtk_get_event_widget ((GdkEvent*) event);
gdk_window_get_origin (menu_item->submenu->window, &submenu_left, &submenu_top); gdk_window_get_origin (menu_item->submenu->window, &submenu_left, &submenu_top);
gdk_window_get_size (menu_item->submenu->window, &width, &height); gdk_drawable_get_size (menu_item->submenu->window, &width, &height);
submenu_right = submenu_left + width; submenu_right = submenu_left + width;
submenu_bottom = submenu_top + height; submenu_bottom = submenu_top + height;
gdk_window_get_size (event_widget->window, &width, &height); gdk_drawable_get_size (event_widget->window, &width, &height);
if (event->x >= 0 && event->x < width) if (event->x >= 0 && event->x < width)
{ {
@ -2613,7 +2616,7 @@ gtk_menu_scroll_item_visible (GtkMenuShell *menu_shell,
if (child == menu_item) if (child == menu_item)
{ {
y = menu->scroll_offset; y = menu->scroll_offset;
gdk_window_get_size (GTK_WIDGET (menu)->window, &width, &height); gdk_drawable_get_size (GTK_WIDGET (menu)->window, &width, &height);
height -= 2*GTK_CONTAINER (menu)->border_width + 2*GTK_WIDGET (menu)->style->ythickness; height -= 2*GTK_CONTAINER (menu)->border_width + 2*GTK_WIDGET (menu)->style->ythickness;
@ -2707,15 +2710,15 @@ gtk_menu_reparent (GtkMenu *menu,
GtkWidget *widget = GTK_WIDGET (menu); GtkWidget *widget = GTK_WIDGET (menu);
gboolean was_floating = GTK_OBJECT_FLOATING (object); gboolean was_floating = GTK_OBJECT_FLOATING (object);
gtk_object_ref (object); g_object_ref (object);
gtk_object_sink (object); gtk_object_sink (object);
if (unrealize) if (unrealize)
{ {
gtk_object_ref (object); g_object_ref (object);
gtk_container_remove (GTK_CONTAINER (widget->parent), widget); gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
gtk_container_add (GTK_CONTAINER (new_parent), widget); gtk_container_add (GTK_CONTAINER (new_parent), widget);
gtk_object_unref (object); g_object_unref (object);
} }
else else
gtk_widget_reparent (GTK_WIDGET (menu), new_parent); gtk_widget_reparent (GTK_WIDGET (menu), new_parent);
@ -2723,7 +2726,7 @@ gtk_menu_reparent (GtkMenu *menu,
if (was_floating) if (was_floating)
GTK_OBJECT_SET_FLAGS (object, GTK_FLOATING); GTK_OBJECT_SET_FLAGS (object, GTK_FLOATING);
else else
gtk_object_unref (object); g_object_unref (object);
} }
static void static void

View File

@ -38,11 +38,11 @@ extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
#define GTK_TYPE_MENU (gtk_menu_get_type ()) #define GTK_TYPE_MENU (gtk_menu_get_type ())
#define GTK_MENU(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_MENU, GtkMenu)) #define GTK_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU, GtkMenu))
#define GTK_MENU_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU, GtkMenuClass)) #define GTK_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU, GtkMenuClass))
#define GTK_IS_MENU(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_MENU)) #define GTK_IS_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU))
#define GTK_IS_MENU_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU)) #define GTK_IS_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU))
#define GTK_MENU_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_MENU, GtkMenuClass)) #define GTK_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU, GtkMenuClass))
typedef struct _GtkMenu GtkMenu; typedef struct _GtkMenu GtkMenu;
@ -121,7 +121,7 @@ struct _GtkMenuClass
}; };
GtkType gtk_menu_get_type (void) G_GNUC_CONST; GType gtk_menu_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_menu_new (void); GtkWidget* gtk_menu_new (void);
/* Display the menu onscreen */ /* Display the menu onscreen */

View File

@ -35,7 +35,6 @@
#include "gtksettings.h" #include "gtksettings.h"
#include "gtkintl.h" #include "gtkintl.h"
#include "gtkwindow.h" #include "gtkwindow.h"
#include "gtksignal.h"
#define BORDER_SPACING 0 #define BORDER_SPACING 0
@ -57,26 +56,28 @@ static GtkShadowType get_shadow_type (GtkMenuBar *menubar);
static GtkMenuShellClass *parent_class = NULL; static GtkMenuShellClass *parent_class = NULL;
GtkType GType
gtk_menu_bar_get_type (void) gtk_menu_bar_get_type (void)
{ {
static GtkType menu_bar_type = 0; static GType menu_bar_type = 0;
if (!menu_bar_type) if (!menu_bar_type)
{ {
static const GtkTypeInfo menu_bar_info = static const GTypeInfo menu_bar_info =
{ {
"GtkMenuBar",
sizeof (GtkMenuBar),
sizeof (GtkMenuBarClass), sizeof (GtkMenuBarClass),
(GtkClassInitFunc) gtk_menu_bar_class_init, NULL, /* base_init */
(GtkObjectInitFunc) NULL, NULL, /* base_finalize */
/* reserved_1 */ NULL, (GClassInitFunc) gtk_menu_bar_class_init,
/* reserved_2 */ NULL, NULL, /* class_finalize */
(GtkClassInitFunc) NULL, NULL, /* class_data */
sizeof (GtkMenuBar),
0, /* n_preallocs */
NULL, /* instance_init */
}; };
menu_bar_type = gtk_type_unique (gtk_menu_shell_get_type (), &menu_bar_info); menu_bar_type = g_type_register_static (GTK_TYPE_MENU_SHELL, "GtkMenuBar",
&menu_bar_info, 0);
} }
return menu_bar_type; return menu_bar_type;
@ -168,7 +169,7 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class)
GtkWidget* GtkWidget*
gtk_menu_bar_new (void) gtk_menu_bar_new (void)
{ {
return GTK_WIDGET (gtk_type_new (gtk_menu_bar_get_type ())); return g_object_new (GTK_TYPE_MENU_BAR, NULL);
} }
static void static void
@ -472,7 +473,7 @@ add_to_window (GtkWindow *window,
if (!menubars) if (!menubars)
{ {
g_signal_connect (G_OBJECT (window), g_signal_connect (window,
"key_press_event", "key_press_event",
G_CALLBACK (window_key_press_handler), G_CALLBACK (window_key_press_handler),
NULL); NULL);
@ -494,8 +495,8 @@ remove_from_window (GtkWindow *window,
if (!menubars) if (!menubars)
{ {
g_signal_handlers_disconnect_by_func (G_OBJECT (window), g_signal_handlers_disconnect_by_func (window,
(gpointer) window_key_press_handler, window_key_press_handler,
NULL); NULL);
} }

View File

@ -38,11 +38,11 @@ extern "C" {
#define GTK_TYPE_MENU_BAR (gtk_menu_bar_get_type ()) #define GTK_TYPE_MENU_BAR (gtk_menu_bar_get_type ())
#define GTK_MENU_BAR(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_MENU_BAR, GtkMenuBar)) #define GTK_MENU_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_BAR, GtkMenuBar))
#define GTK_MENU_BAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_BAR, GtkMenuBarClass)) #define GTK_MENU_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_BAR, GtkMenuBarClass))
#define GTK_IS_MENU_BAR(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_MENU_BAR)) #define GTK_IS_MENU_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU_BAR))
#define GTK_IS_MENU_BAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_BAR)) #define GTK_IS_MENU_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_BAR))
#define GTK_MENU_BAR_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_MENU_BAR, GtkMenuBarClass)) #define GTK_MENU_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU_BAR, GtkMenuBarClass))
typedef struct _GtkMenuBar GtkMenuBar; typedef struct _GtkMenuBar GtkMenuBar;
@ -65,7 +65,7 @@ struct _GtkMenuBarClass
}; };
GtkType gtk_menu_bar_get_type (void) G_GNUC_CONST; GType gtk_menu_bar_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_menu_bar_new (void); GtkWidget* gtk_menu_bar_new (void);
#ifndef GTK_DISABLE_DEPRECATED #ifndef GTK_DISABLE_DEPRECATED

View File

@ -34,7 +34,6 @@
#include "gtkmenubar.h" #include "gtkmenubar.h"
#include "gtkmenuitem.h" #include "gtkmenuitem.h"
#include "gtkseparatormenuitem.h" #include "gtkseparatormenuitem.h"
#include "gtksignal.h"
#define BORDER_SPACING 3 #define BORDER_SPACING 3
@ -103,10 +102,10 @@ static guint32 last_submenu_deselect_time = 0;
GtkType GType
gtk_menu_item_get_type (void) gtk_menu_item_get_type (void)
{ {
static GtkType menu_item_type = 0; static GType menu_item_type = 0;
if (!menu_item_type) if (!menu_item_type)
{ {
@ -123,7 +122,8 @@ gtk_menu_item_get_type (void)
(GInstanceInitFunc) gtk_menu_item_init, (GInstanceInitFunc) gtk_menu_item_init,
}; };
menu_item_type = g_type_register_static (GTK_TYPE_ITEM, "GtkMenuItem", &menu_item_info, 0); menu_item_type = g_type_register_static (GTK_TYPE_ITEM, "GtkMenuItem",
&menu_item_info, 0);
} }
return menu_item_type; return menu_item_type;
@ -169,39 +169,43 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
klass->hide_on_activate = TRUE; klass->hide_on_activate = TRUE;
menu_item_signals[ACTIVATE] = menu_item_signals[ACTIVATE] =
gtk_signal_new ("activate", g_signal_new ("activate",
GTK_RUN_FIRST | GTK_RUN_ACTION, G_OBJECT_CLASS_TYPE (gobject_class),
GTK_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
GTK_SIGNAL_OFFSET (GtkMenuItemClass, activate), G_STRUCT_OFFSET (GtkMenuItemClass, activate),
_gtk_marshal_VOID__VOID, NULL, NULL,
GTK_TYPE_NONE, 0); _gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
widget_class->activate_signal = menu_item_signals[ACTIVATE]; widget_class->activate_signal = menu_item_signals[ACTIVATE];
menu_item_signals[ACTIVATE_ITEM] = menu_item_signals[ACTIVATE_ITEM] =
gtk_signal_new ("activate_item", g_signal_new ("activate_item",
GTK_RUN_FIRST, G_OBJECT_CLASS_TYPE (gobject_class),
GTK_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST,
GTK_SIGNAL_OFFSET (GtkMenuItemClass, activate_item), G_STRUCT_OFFSET (GtkMenuItemClass, activate_item),
gtk_signal_default_marshaller, NULL, NULL,
GTK_TYPE_NONE, 0); _gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
menu_item_signals[TOGGLE_SIZE_REQUEST] = menu_item_signals[TOGGLE_SIZE_REQUEST] =
gtk_signal_new ("toggle_size_request", g_signal_new ("toggle_size_request",
GTK_RUN_FIRST, G_OBJECT_CLASS_TYPE (gobject_class),
GTK_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST,
GTK_SIGNAL_OFFSET (GtkMenuItemClass, toggle_size_request), G_STRUCT_OFFSET (GtkMenuItemClass, toggle_size_request),
_gtk_marshal_VOID__POINTER, NULL, NULL,
GTK_TYPE_NONE, 1, _gtk_marshal_VOID__POINTER,
GTK_TYPE_POINTER); G_TYPE_NONE, 1,
G_TYPE_POINTER);
menu_item_signals[TOGGLE_SIZE_ALLOCATE] = menu_item_signals[TOGGLE_SIZE_ALLOCATE] =
gtk_signal_new ("toggle_size_allocate", g_signal_new ("toggle_size_allocate",
GTK_RUN_FIRST, G_OBJECT_CLASS_TYPE (gobject_class),
GTK_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST,
GTK_SIGNAL_OFFSET (GtkMenuItemClass, toggle_size_allocate), G_STRUCT_OFFSET (GtkMenuItemClass, toggle_size_allocate),
_gtk_marshal_NONE__INT, NULL, NULL,
GTK_TYPE_NONE, 1, _gtk_marshal_NONE__INT,
GTK_TYPE_INT); G_TYPE_NONE, 1,
G_TYPE_INT);
gtk_widget_class_install_style_property_parser (widget_class, gtk_widget_class_install_style_property_parser (widget_class,
g_param_spec_enum ("selected_shadow_type", g_param_spec_enum ("selected_shadow_type",
@ -232,7 +236,7 @@ gtk_menu_item_init (GtkMenuItem *menu_item)
GtkWidget* GtkWidget*
gtk_menu_item_new (void) gtk_menu_item_new (void)
{ {
return GTK_WIDGET (gtk_type_new (gtk_menu_item_get_type ())); return g_object_new (GTK_TYPE_MENU_ITEM, NULL);
} }
GtkWidget* GtkWidget*
@ -270,7 +274,7 @@ gtk_menu_item_new_with_mnemonic (const gchar *label)
GtkWidget *accel_label; GtkWidget *accel_label;
menu_item = gtk_menu_item_new (); menu_item = gtk_menu_item_new ();
accel_label = gtk_type_new (GTK_TYPE_ACCEL_LABEL); accel_label = g_object_new (GTK_TYPE_ACCEL_LABEL, NULL);
gtk_label_set_text_with_mnemonic (GTK_LABEL (accel_label), label); gtk_label_set_text_with_mnemonic (GTK_LABEL (accel_label), label);
gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5);
@ -399,7 +403,7 @@ gtk_menu_item_activate (GtkMenuItem *menu_item)
{ {
g_return_if_fail (GTK_IS_MENU_ITEM (menu_item)); g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
gtk_signal_emit (GTK_OBJECT (menu_item), menu_item_signals[ACTIVATE]); g_signal_emit (menu_item, menu_item_signals[ACTIVATE], 0);
} }
void void
@ -408,7 +412,7 @@ gtk_menu_item_toggle_size_request (GtkMenuItem *menu_item,
{ {
g_return_if_fail (GTK_IS_MENU_ITEM (menu_item)); g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
gtk_signal_emit (GTK_OBJECT (menu_item), menu_item_signals[TOGGLE_SIZE_REQUEST], requisition); g_signal_emit (menu_item, menu_item_signals[TOGGLE_SIZE_REQUEST], 0, requisition);
} }
void void
@ -417,7 +421,7 @@ gtk_menu_item_toggle_size_allocate (GtkMenuItem *menu_item,
{ {
g_return_if_fail (GTK_IS_MENU_ITEM (menu_item)); g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
gtk_signal_emit (GTK_OBJECT (menu_item), menu_item_signals[TOGGLE_SIZE_ALLOCATE], allocation); g_signal_emit (menu_item, menu_item_signals[TOGGLE_SIZE_ALLOCATE], 0, allocation);
} }
static void static void
@ -540,7 +544,7 @@ gtk_menu_item_realize (GtkWidget *widget)
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
widget->window = gtk_widget_get_parent_window (widget); widget->window = gtk_widget_get_parent_window (widget);
gdk_window_ref (widget->window); g_object_ref (widget->window);
attributes.x = widget->allocation.x; attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y; attributes.y = widget->allocation.y;
@ -773,7 +777,7 @@ gtk_menu_item_mnemonic_activate (GtkWidget *widget,
} }
else else
gtk_signal_emit (GTK_OBJECT (widget), menu_item_signals[ACTIVATE_ITEM]); g_signal_emit (widget, menu_item_signals[ACTIVATE_ITEM], 0);
return TRUE; return TRUE;
} }

View File

@ -38,11 +38,11 @@ extern "C" {
#define GTK_TYPE_MENU_ITEM (gtk_menu_item_get_type ()) #define GTK_TYPE_MENU_ITEM (gtk_menu_item_get_type ())
#define GTK_MENU_ITEM(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_MENU_ITEM, GtkMenuItem)) #define GTK_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_ITEM, GtkMenuItem))
#define GTK_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_ITEM, GtkMenuItemClass)) #define GTK_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_ITEM, GtkMenuItemClass))
#define GTK_IS_MENU_ITEM(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_MENU_ITEM)) #define GTK_IS_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU_ITEM))
#define GTK_IS_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_ITEM)) #define GTK_IS_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_ITEM))
#define GTK_MENU_ITEM_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_MENU_ITEM, GtkMenuItemClass)) #define GTK_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU_ITEM, GtkMenuItemClass))
typedef struct _GtkMenuItem GtkMenuItem; typedef struct _GtkMenuItem GtkMenuItem;
@ -94,7 +94,7 @@ struct _GtkMenuItemClass
}; };
GtkType gtk_menu_item_get_type (void) G_GNUC_CONST; GType gtk_menu_item_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_menu_item_new (void); GtkWidget* gtk_menu_item_new (void);
GtkWidget* gtk_menu_item_new_with_label (const gchar *label); GtkWidget* gtk_menu_item_new_with_label (const gchar *label);
GtkWidget* gtk_menu_item_new_with_mnemonic (const gchar *label); GtkWidget* gtk_menu_item_new_with_mnemonic (const gchar *label);

View File

@ -33,7 +33,6 @@
#include "gtkmenubar.h" #include "gtkmenubar.h"
#include "gtkmenuitem.h" #include "gtkmenuitem.h"
#include "gtkmenushell.h" #include "gtkmenushell.h"
#include "gtksignal.h"
#include "gtktearoffmenuitem.h" #include "gtktearoffmenuitem.h"
#include "gtkwindow.h" #include "gtkwindow.h"
@ -140,7 +139,7 @@ static gint gtk_menu_shell_is_item (GtkMenuShell *menu_shell,
GtkWidget *child); GtkWidget *child);
static GtkWidget *gtk_menu_shell_get_item (GtkMenuShell *menu_shell, static GtkWidget *gtk_menu_shell_get_item (GtkMenuShell *menu_shell,
GdkEvent *event); GdkEvent *event);
static GtkType gtk_menu_shell_child_type (GtkContainer *container); static GType gtk_menu_shell_child_type (GtkContainer *container);
static void gtk_menu_shell_real_select_item (GtkMenuShell *menu_shell, static void gtk_menu_shell_real_select_item (GtkMenuShell *menu_shell,
GtkWidget *menu_item); GtkWidget *menu_item);
static void gtk_menu_shell_select_submenu_first (GtkMenuShell *menu_shell); static void gtk_menu_shell_select_submenu_first (GtkMenuShell *menu_shell);
@ -157,10 +156,10 @@ static GtkContainerClass *parent_class = NULL;
static guint menu_shell_signals[LAST_SIGNAL] = { 0 }; static guint menu_shell_signals[LAST_SIGNAL] = { 0 };
GtkType GType
gtk_menu_shell_get_type (void) gtk_menu_shell_get_type (void)
{ {
static GtkType menu_shell_type = 0; static GType menu_shell_type = 0;
if (!menu_shell_type) if (!menu_shell_type)
{ {
@ -169,17 +168,18 @@ gtk_menu_shell_get_type (void)
sizeof (GtkMenuShellClass), sizeof (GtkMenuShellClass),
NULL, /* base_init */ NULL, /* base_init */
NULL, /* base_finalize */ NULL, /* base_finalize */
(GClassInitFunc) gtk_menu_shell_class_init, (GClassInitFunc) gtk_menu_shell_class_init,
NULL, /* class_finalize */ NULL, /* class_finalize */
NULL, /* class_data */ NULL, /* class_data */
sizeof (GtkMenuShell), sizeof (GtkMenuShell),
0, /* n_preallocs */ 0, /* n_preallocs */
(GInstanceInitFunc) gtk_menu_shell_init, (GInstanceInitFunc) gtk_menu_shell_init,
NULL /* value_table */ NULL, /* value_table */
}; };
menu_shell_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkMenuShell", menu_shell_type =
&menu_shell_info, G_TYPE_FLAG_ABSTRACT); g_type_register_static (GTK_TYPE_CONTAINER, "GtkMenuShell",
&menu_shell_info, G_TYPE_FLAG_ABSTRACT);
} }
return menu_shell_type; return menu_shell_type;
@ -217,17 +217,17 @@ binding_signal_new (const gchar *signal_name,
static void static void
gtk_menu_shell_class_init (GtkMenuShellClass *klass) gtk_menu_shell_class_init (GtkMenuShellClass *klass)
{ {
GtkObjectClass *object_class; GObjectClass *object_class;
GtkWidgetClass *widget_class; GtkWidgetClass *widget_class;
GtkContainerClass *container_class; GtkContainerClass *container_class;
GtkBindingSet *binding_set; GtkBindingSet *binding_set;
object_class = (GtkObjectClass*) klass; object_class = (GObjectClass*) klass;
widget_class = (GtkWidgetClass*) klass; widget_class = (GtkWidgetClass*) klass;
container_class = (GtkContainerClass*) klass; container_class = (GtkContainerClass*) klass;
parent_class = gtk_type_class (gtk_container_get_type ()); parent_class = g_type_class_peek_parent (klass);
widget_class->realize = gtk_menu_shell_realize; widget_class->realize = gtk_menu_shell_realize;
widget_class->button_press_event = gtk_menu_shell_button_press; widget_class->button_press_event = gtk_menu_shell_button_press;
@ -251,50 +251,55 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
klass->insert = gtk_menu_shell_real_insert; klass->insert = gtk_menu_shell_real_insert;
menu_shell_signals[DEACTIVATE] = menu_shell_signals[DEACTIVATE] =
gtk_signal_new ("deactivate", g_signal_new ("deactivate",
GTK_RUN_FIRST, G_OBJECT_CLASS_TYPE (object_class),
GTK_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST,
GTK_SIGNAL_OFFSET (GtkMenuShellClass, deactivate), G_STRUCT_OFFSET (GtkMenuShellClass, deactivate),
_gtk_marshal_VOID__VOID, NULL, NULL,
GTK_TYPE_NONE, 0); _gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
menu_shell_signals[SELECTION_DONE] = menu_shell_signals[SELECTION_DONE] =
gtk_signal_new ("selection-done", g_signal_new ("selection-done",
GTK_RUN_FIRST, G_OBJECT_CLASS_TYPE (object_class),
GTK_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST,
GTK_SIGNAL_OFFSET (GtkMenuShellClass, selection_done), G_STRUCT_OFFSET (GtkMenuShellClass, selection_done),
_gtk_marshal_VOID__VOID, NULL, NULL,
GTK_TYPE_NONE, 0); _gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
menu_shell_signals[MOVE_CURRENT] = menu_shell_signals[MOVE_CURRENT] =
gtk_signal_new ("move_current", g_signal_new ("move_current",
GTK_RUN_LAST | GTK_RUN_ACTION, G_OBJECT_CLASS_TYPE (object_class),
GTK_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
GTK_SIGNAL_OFFSET (GtkMenuShellClass, move_current), G_STRUCT_OFFSET (GtkMenuShellClass, move_current),
_gtk_marshal_VOID__ENUM, NULL, NULL,
GTK_TYPE_NONE, 1, _gtk_marshal_VOID__ENUM,
GTK_TYPE_MENU_DIRECTION_TYPE); G_TYPE_NONE, 1,
GTK_TYPE_MENU_DIRECTION_TYPE);
menu_shell_signals[ACTIVATE_CURRENT] = menu_shell_signals[ACTIVATE_CURRENT] =
gtk_signal_new ("activate_current", g_signal_new ("activate_current",
GTK_RUN_LAST | GTK_RUN_ACTION, G_OBJECT_CLASS_TYPE (object_class),
GTK_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
GTK_SIGNAL_OFFSET (GtkMenuShellClass, activate_current), G_STRUCT_OFFSET (GtkMenuShellClass, activate_current),
_gtk_marshal_VOID__BOOLEAN, NULL, NULL,
GTK_TYPE_NONE, 1, _gtk_marshal_VOID__BOOLEAN,
GTK_TYPE_BOOL); G_TYPE_NONE, 1,
G_TYPE_BOOLEAN);
menu_shell_signals[CANCEL] = menu_shell_signals[CANCEL] =
gtk_signal_new ("cancel", g_signal_new ("cancel",
GTK_RUN_LAST | GTK_RUN_ACTION, G_OBJECT_CLASS_TYPE (object_class),
GTK_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
GTK_SIGNAL_OFFSET (GtkMenuShellClass, cancel), G_STRUCT_OFFSET (GtkMenuShellClass, cancel),
_gtk_marshal_VOID__VOID, NULL, NULL,
GTK_TYPE_NONE, 0); _gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
menu_shell_signals[CYCLE_FOCUS] = menu_shell_signals[CYCLE_FOCUS] =
binding_signal_new ("cycle_focus", binding_signal_new ("cycle_focus",
G_OBJECT_CLASS_TYPE (object_class), G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST | GTK_RUN_ACTION, G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_CALLBACK (gtk_real_menu_shell_cycle_focus), G_CALLBACK (gtk_real_menu_shell_cycle_focus),
NULL, NULL, NULL, NULL,
_gtk_marshal_VOID__ENUM, _gtk_marshal_VOID__ENUM,
GTK_TYPE_NONE, 1, G_TYPE_NONE, 1,
GTK_TYPE_DIRECTION_TYPE); GTK_TYPE_DIRECTION_TYPE);
@ -305,22 +310,22 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
gtk_binding_entry_add_signal (binding_set, gtk_binding_entry_add_signal (binding_set,
GDK_Return, 0, GDK_Return, 0,
"activate_current", 1, "activate_current", 1,
GTK_TYPE_BOOL, G_TYPE_BOOLEAN,
TRUE); TRUE);
gtk_binding_entry_add_signal (binding_set, gtk_binding_entry_add_signal (binding_set,
GDK_KP_Enter, 0, GDK_KP_Enter, 0,
"activate_current", 1, "activate_current", 1,
GTK_TYPE_BOOL, G_TYPE_BOOLEAN,
TRUE); TRUE);
gtk_binding_entry_add_signal (binding_set, gtk_binding_entry_add_signal (binding_set,
GDK_space, 0, GDK_space, 0,
"activate_current", 1, "activate_current", 1,
GTK_TYPE_BOOL, G_TYPE_BOOLEAN,
FALSE); FALSE);
gtk_binding_entry_add_signal (binding_set, gtk_binding_entry_add_signal (binding_set,
GDK_KP_Space, 0, GDK_KP_Space, 0,
"activate_current", 1, "activate_current", 1,
GTK_TYPE_BOOL, G_TYPE_BOOLEAN,
FALSE); FALSE);
gtk_binding_entry_add_signal (binding_set, gtk_binding_entry_add_signal (binding_set,
GDK_F10, 0, GDK_F10, 0,
@ -332,7 +337,7 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
GTK_TYPE_DIRECTION_TYPE, GTK_DIR_TAB_BACKWARD); GTK_TYPE_DIRECTION_TYPE, GTK_DIR_TAB_BACKWARD);
} }
static GtkType static GType
gtk_menu_shell_child_type (GtkContainer *container) gtk_menu_shell_child_type (GtkContainer *container)
{ {
return GTK_TYPE_MENU_ITEM; return GTK_TYPE_MENU_ITEM;
@ -398,7 +403,7 @@ gtk_menu_shell_deactivate (GtkMenuShell *menu_shell)
{ {
g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell)); g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell));
gtk_signal_emit (GTK_OBJECT (menu_shell), menu_shell_signals[DEACTIVATE]); g_signal_emit (menu_shell, menu_shell_signals[DEACTIVATE], 0);
} }
static void static void
@ -492,7 +497,7 @@ gtk_menu_shell_button_press (GtkWidget *widget,
if (widget == GTK_WIDGET (menu_shell)) if (widget == GTK_WIDGET (menu_shell))
{ {
gtk_menu_shell_deactivate (menu_shell); gtk_menu_shell_deactivate (menu_shell);
gtk_signal_emit (GTK_OBJECT (menu_shell), menu_shell_signals[SELECTION_DONE]); g_signal_emit (menu_shell, menu_shell_signals[SELECTION_DONE], 0);
} }
} }
@ -590,7 +595,7 @@ gtk_menu_shell_button_release (GtkWidget *widget,
if (deactivate) if (deactivate)
{ {
gtk_menu_shell_deactivate (menu_shell); gtk_menu_shell_deactivate (menu_shell);
gtk_signal_emit (GTK_OBJECT (menu_shell), menu_shell_signals[SELECTION_DONE]); g_signal_emit (menu_shell, menu_shell_signals[SELECTION_DONE], 0);
} }
} }
@ -910,7 +915,7 @@ gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
if (!deactivate) if (!deactivate)
deactivate = GTK_MENU_ITEM_GET_CLASS (menu_item)->hide_on_activate; deactivate = GTK_MENU_ITEM_GET_CLASS (menu_item)->hide_on_activate;
gtk_widget_ref (GTK_WIDGET (menu_shell)); g_object_ref (menu_shell);
if (deactivate) if (deactivate)
{ {
@ -918,7 +923,7 @@ gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
do do
{ {
gtk_widget_ref (GTK_WIDGET (parent_menu_shell)); g_object_ref (parent_menu_shell);
shells = g_slist_prepend (shells, parent_menu_shell); shells = g_slist_prepend (shells, parent_menu_shell);
parent_menu_shell = (GtkMenuShell*) parent_menu_shell->parent_menu_shell; parent_menu_shell = (GtkMenuShell*) parent_menu_shell->parent_menu_shell;
} }
@ -937,12 +942,12 @@ gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
for (slist = shells; slist; slist = slist->next) for (slist = shells; slist; slist = slist->next)
{ {
gtk_signal_emit (slist->data, menu_shell_signals[SELECTION_DONE]); g_signal_emit (slist->data, menu_shell_signals[SELECTION_DONE], 0);
gtk_widget_unref (slist->data); g_object_unref (slist->data);
} }
g_slist_free (shells); g_slist_free (shells);
gtk_widget_unref (GTK_WIDGET (menu_shell)); g_object_unref (menu_shell);
} }
/* Distance should be +/- 1 */ /* Distance should be +/- 1 */
@ -1162,7 +1167,7 @@ gtk_real_menu_shell_cancel (GtkMenuShell *menu_shell)
gtk_menu_shell_deselect (menu_shell); gtk_menu_shell_deselect (menu_shell);
gtk_menu_shell_deactivate (menu_shell); gtk_menu_shell_deactivate (menu_shell);
gtk_signal_emit (GTK_OBJECT (menu_shell), menu_shell_signals[SELECTION_DONE]); g_signal_emit (menu_shell, menu_shell_signals[SELECTION_DONE], 0);
} }
static void static void

View File

@ -38,11 +38,11 @@ extern "C" {
#define GTK_TYPE_MENU_SHELL (gtk_menu_shell_get_type ()) #define GTK_TYPE_MENU_SHELL (gtk_menu_shell_get_type ())
#define GTK_MENU_SHELL(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_MENU_SHELL, GtkMenuShell)) #define GTK_MENU_SHELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_SHELL, GtkMenuShell))
#define GTK_MENU_SHELL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_SHELL, GtkMenuShellClass)) #define GTK_MENU_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_SHELL, GtkMenuShellClass))
#define GTK_IS_MENU_SHELL(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_MENU_SHELL)) #define GTK_IS_MENU_SHELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU_SHELL))
#define GTK_IS_MENU_SHELL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_SHELL)) #define GTK_IS_MENU_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_SHELL))
#define GTK_MENU_SHELL_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_MENU_SHELL, GtkMenuShellClass)) #define GTK_MENU_SHELL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU_SHELL, GtkMenuShellClass))
typedef struct _GtkMenuShell GtkMenuShell; typedef struct _GtkMenuShell GtkMenuShell;
@ -95,7 +95,7 @@ struct _GtkMenuShellClass
}; };
GtkType gtk_menu_shell_get_type (void) G_GNUC_CONST; GType gtk_menu_shell_get_type (void) G_GNUC_CONST;
void gtk_menu_shell_append (GtkMenuShell *menu_shell, void gtk_menu_shell_append (GtkMenuShell *menu_shell,
GtkWidget *child); GtkWidget *child);
void gtk_menu_shell_prepend (GtkMenuShell *menu_shell, void gtk_menu_shell_prepend (GtkMenuShell *menu_shell,

View File

@ -37,26 +37,29 @@ static void gtk_radio_menu_item_draw_indicator (GtkCheckMenuItem *check_men
static GtkCheckMenuItemClass *parent_class = NULL; static GtkCheckMenuItemClass *parent_class = NULL;
GtkType GType
gtk_radio_menu_item_get_type (void) gtk_radio_menu_item_get_type (void)
{ {
static GtkType radio_menu_item_type = 0; static GType radio_menu_item_type = 0;
if (!radio_menu_item_type) if (!radio_menu_item_type)
{ {
static const GtkTypeInfo radio_menu_item_info = static const GTypeInfo radio_menu_item_info =
{ {
"GtkRadioMenuItem",
sizeof (GtkRadioMenuItem),
sizeof (GtkRadioMenuItemClass), sizeof (GtkRadioMenuItemClass),
(GtkClassInitFunc) gtk_radio_menu_item_class_init, NULL, /* base_init */
(GtkObjectInitFunc) gtk_radio_menu_item_init, NULL, /* base_finalize */
/* reserved_1 */ NULL, (GClassInitFunc) gtk_radio_menu_item_class_init,
/* reserved_2 */ NULL, NULL, /* class_finalize */
(GtkClassInitFunc) NULL, NULL, /* class_data */
sizeof (GtkRadioMenuItem),
0, /* n_preallocs */
(GInstanceInitFunc) gtk_radio_menu_item_init,
}; };
radio_menu_item_type = gtk_type_unique (gtk_check_menu_item_get_type (), &radio_menu_item_info); radio_menu_item_type =
g_type_register_static (GTK_TYPE_CHECK_MENU_ITEM, "GtkRadioMenuItem",
&radio_menu_item_info, 0);
} }
return radio_menu_item_type; return radio_menu_item_type;
@ -67,7 +70,7 @@ gtk_radio_menu_item_new (GSList *group)
{ {
GtkRadioMenuItem *radio_menu_item; GtkRadioMenuItem *radio_menu_item;
radio_menu_item = gtk_type_new (gtk_radio_menu_item_get_type ()); radio_menu_item = g_object_new (GTK_TYPE_RADIO_MENU_ITEM, NULL);
gtk_radio_menu_item_set_group (radio_menu_item, group); gtk_radio_menu_item_set_group (radio_menu_item, group);
@ -157,7 +160,7 @@ gtk_radio_menu_item_new_with_mnemonic (GSList *group,
GtkWidget *accel_label; GtkWidget *accel_label;
radio_menu_item = gtk_radio_menu_item_new (group); radio_menu_item = gtk_radio_menu_item_new (group);
accel_label = gtk_type_new (GTK_TYPE_ACCEL_LABEL); accel_label = g_object_new (GTK_TYPE_ACCEL_LABEL, NULL);
gtk_label_set_text_with_mnemonic (GTK_LABEL (accel_label), label); gtk_label_set_text_with_mnemonic (GTK_LABEL (accel_label), label);
gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5);
@ -188,7 +191,7 @@ gtk_radio_menu_item_class_init (GtkRadioMenuItemClass *klass)
menu_item_class = (GtkMenuItemClass*) klass; menu_item_class = (GtkMenuItemClass*) klass;
check_menu_item_class = (GtkCheckMenuItemClass*) klass; check_menu_item_class = (GtkCheckMenuItemClass*) klass;
parent_class = gtk_type_class (gtk_check_menu_item_get_type ()); parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gtk_radio_menu_item_destroy; object_class->destroy = gtk_radio_menu_item_destroy;

View File

@ -38,11 +38,11 @@ extern "C" {
#define GTK_TYPE_RADIO_MENU_ITEM (gtk_radio_menu_item_get_type ()) #define GTK_TYPE_RADIO_MENU_ITEM (gtk_radio_menu_item_get_type ())
#define GTK_RADIO_MENU_ITEM(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_RADIO_MENU_ITEM, GtkRadioMenuItem)) #define GTK_RADIO_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RADIO_MENU_ITEM, GtkRadioMenuItem))
#define GTK_RADIO_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_RADIO_MENU_ITEM, GtkRadioMenuItemClass)) #define GTK_RADIO_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RADIO_MENU_ITEM, GtkRadioMenuItemClass))
#define GTK_IS_RADIO_MENU_ITEM(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_RADIO_MENU_ITEM)) #define GTK_IS_RADIO_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RADIO_MENU_ITEM))
#define GTK_IS_RADIO_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RADIO_MENU_ITEM)) #define GTK_IS_RADIO_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RADIO_MENU_ITEM))
#define GTK_RADIO_MENU_ITEM_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_RADIO_MENU_ITEM, GtkRadioMenuItemClass)) #define GTK_RADIO_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RADIO_MENU_ITEM, GtkRadioMenuItemClass))
typedef struct _GtkRadioMenuItem GtkRadioMenuItem; typedef struct _GtkRadioMenuItem GtkRadioMenuItem;
@ -67,7 +67,7 @@ struct _GtkRadioMenuItemClass
}; };
GtkType gtk_radio_menu_item_get_type (void) G_GNUC_CONST; GType gtk_radio_menu_item_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_radio_menu_item_new (GSList *group); GtkWidget* gtk_radio_menu_item_new (GSList *group);
GtkWidget* gtk_radio_menu_item_new_with_label (GSList *group, GtkWidget* gtk_radio_menu_item_new_with_label (GSList *group,
const gchar *label); const gchar *label);