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>
* 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>
* 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>
* 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>
* 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>
* 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>
* gtkaspectframe.[ch] gtkbin.[ch] gtkframe.[ch] gtkhruler.[ch]

View File

@ -26,7 +26,6 @@
#include "gtkcheckmenuitem.h"
#include "gtkaccellabel.h"
#include "gtksignal.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
@ -68,26 +67,29 @@ static GtkMenuItemClass *parent_class = NULL;
static guint check_menu_item_signals[LAST_SIGNAL] = { 0 };
GtkType
GType
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)
{
static const GtkTypeInfo check_menu_item_info =
static const GTypeInfo check_menu_item_info =
{
"GtkCheckMenuItem",
sizeof (GtkCheckMenuItem),
sizeof (GtkCheckMenuItemClass),
(GtkClassInitFunc) gtk_check_menu_item_class_init,
(GtkObjectInitFunc) gtk_check_menu_item_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_check_menu_item_class_init,
NULL, /* class_finalize */
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;
@ -96,20 +98,20 @@ gtk_check_menu_item_get_type (void)
static void
gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *gobject_class;
GtkWidgetClass *widget_class;
GtkMenuItemClass *menu_item_class;
object_class = (GtkObjectClass*) klass;
gobject_class = G_OBJECT_CLASS (klass);
widget_class = (GtkWidgetClass*) 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;
G_OBJECT_CLASS(object_class)->get_property = gtk_check_menu_item_get_property;
gobject_class->set_property = gtk_check_menu_item_set_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,
g_param_spec_boolean ("active",
_("Active"),
@ -117,7 +119,7 @@ gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass)
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (object_class),
g_object_class_install_property (gobject_class,
PROP_INCONSISTENT,
g_param_spec_boolean ("inconsistent",
_("Inconsistent"),
@ -135,18 +137,19 @@ gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass)
klass->draw_indicator = gtk_real_check_menu_item_draw_indicator;
check_menu_item_signals[TOGGLED] =
gtk_signal_new ("toggled",
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkCheckMenuItemClass, toggled),
g_signal_new ("toggled",
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkCheckMenuItemClass, toggled),
NULL, NULL,
_gtk_marshal_VOID__VOID,
GTK_TYPE_NONE, 0);
G_TYPE_NONE, 0);
}
GtkWidget*
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*
@ -184,7 +187,7 @@ gtk_check_menu_item_new_with_mnemonic (const gchar *label)
GtkWidget *accel_label;
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_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
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_CHECK_MENU_ITEM(obj) (GTK_CHECK_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_IS_CHECK_MENU_ITEM(obj) (GTK_CHECK_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_CHECK_MENU_ITEM_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_CHECK_MENU_ITEM, GtkCheckMenuItemClass))
#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) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CHECK_MENU_ITEM, GtkCheckMenuItemClass))
#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) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CHECK_MENU_ITEM))
#define GTK_CHECK_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CHECK_MENU_ITEM, GtkCheckMenuItemClass))
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_with_label (const gchar *label);
GtkWidget* gtk_check_menu_item_new_with_mnemonic (const gchar *label);

View File

@ -26,7 +26,6 @@
#include "gtkimagemenuitem.h"
#include "gtkaccellabel.h"
#include "gtksignal.h"
#include "gtkintl.h"
#include "gtkstock.h"
#include "gtkiconfactory.h"
@ -65,26 +64,29 @@ enum {
static GtkMenuItemClass *parent_class = NULL;
GtkType
GType
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)
{
static const GtkTypeInfo image_menu_item_info =
static const GTypeInfo image_menu_item_info =
{
"GtkImageMenuItem",
sizeof (GtkImageMenuItem),
sizeof (GtkImageMenuItemClass),
(GtkClassInitFunc) gtk_image_menu_item_class_init,
(GtkObjectInitFunc) gtk_image_menu_item_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_image_menu_item_class_init,
NULL, /* class_finalize */
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;
@ -94,18 +96,16 @@ static void
gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass)
{
GObjectClass *gobject_class;
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkMenuItemClass *menu_item_class;
GtkContainerClass *container_class;
gobject_class = (GObjectClass*) klass;
object_class = (GtkObjectClass*) klass;
widget_class = (GtkWidgetClass*) klass;
menu_item_class = (GtkMenuItemClass*) 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_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;
GtkWidget *accel_label;
image_menu_item = GTK_IMAGE_MENU_ITEM (g_object_new (GTK_TYPE_IMAGE_MENU_ITEM,
NULL));
image_menu_item = g_object_new (GTK_TYPE_IMAGE_MENU_ITEM, NULL);
accel_label = gtk_accel_label_new (label);
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;
GtkWidget *accel_label;
image_menu_item = GTK_IMAGE_MENU_ITEM (g_object_new (GTK_TYPE_IMAGE_MENU_ITEM,
NULL));
image_menu_item = g_object_new (GTK_TYPE_IMAGE_MENU_ITEM, 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_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_IMAGE_MENU_ITEM(obj) (GTK_CHECK_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_IS_IMAGE_MENU_ITEM(obj) (GTK_CHECK_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_IMAGE_MENU_ITEM_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_IMAGE_MENU_ITEM, GtkImageMenuItemClass))
#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) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMAGE_MENU_ITEM, GtkImageMenuItemClass))
#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) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMAGE_MENU_ITEM))
#define GTK_IMAGE_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IMAGE_MENU_ITEM, GtkImageMenuItemClass))
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_with_label (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/.
*/
#define GTK_MENU_INTERNALS
#include <string.h> /* memset */
#include "gdk/gdkkeysyms.h"
#include "gtkaccelmap.h"
@ -32,7 +34,6 @@
#include "gtkmain.h"
#include "gtkmenu.h"
#include "gtkmenuitem.h"
#include "gtksignal.h"
#include "gtkwindow.h"
#include "gtkhbox.h"
#include "gtkvscrollbar.h"
@ -180,26 +181,28 @@ gtk_menu_get_private (GtkMenu *menu)
return private;
}
GtkType
GType
gtk_menu_get_type (void)
{
static GtkType menu_type = 0;
static GType menu_type = 0;
if (!menu_type)
{
static const GtkTypeInfo menu_info =
static const GTypeInfo menu_info =
{
"GtkMenu",
sizeof (GtkMenu),
sizeof (GtkMenuClass),
(GtkClassInitFunc) gtk_menu_class_init,
(GtkObjectInitFunc) gtk_menu_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_menu_class_init,
NULL, /* class_finalize */
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;
@ -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"),
"",
G_PARAM_READABLE | G_PARAM_WRITABLE));
object_class->destroy = gtk_menu_destroy;
widget_class->realize = gtk_menu_realize;
@ -351,8 +355,8 @@ gtk_menu_window_event (GtkWidget *window,
{
gboolean handled = FALSE;
gtk_widget_ref (window);
gtk_widget_ref (menu);
g_object_ref (window);
g_object_ref (menu);
switch (event->type)
{
@ -364,8 +368,8 @@ gtk_menu_window_event (GtkWidget *window,
break;
}
gtk_widget_unref (window);
gtk_widget_unref (menu);
g_object_unref (window);
g_object_unref (menu);
return handled;
}
@ -396,7 +400,7 @@ gtk_menu_init (GtkMenu *menu)
menu->position_func_data = NULL;
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,
"child", menu,
NULL),
@ -404,8 +408,7 @@ gtk_menu_init (GtkMenu *menu)
"signal::size_request", gtk_menu_window_size_request, menu,
"signal::destroy", gtk_widget_destroyed, &menu->toplevel,
NULL);
gtk_window_set_policy (GTK_WINDOW (menu->toplevel),
FALSE, FALSE, TRUE);
gtk_window_set_resizable (GTK_WINDOW (menu->toplevel), FALSE);
gtk_window_set_mnemonic_modifier (GTK_WINDOW (menu->toplevel), 0);
/* 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);
data = gtk_object_get_data (object, attach_data_key);
data = g_object_get_data (G_OBJECT (object), attach_data_key);
if (data)
gtk_menu_detach (menu);
@ -457,7 +460,7 @@ gtk_menu_destroy (GtkObject *object)
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;
}
@ -465,7 +468,7 @@ gtk_menu_destroy (GtkObject *object)
if (menu->needs_destruction_ref_count)
{
menu->needs_destruction_ref_count = FALSE;
gtk_object_ref (object);
g_object_ref (object);
}
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()
*/
data = gtk_object_get_data (GTK_OBJECT (menu), attach_data_key);
data = g_object_get_data (G_OBJECT (menu), attach_data_key);
if (data)
{
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;
}
gtk_object_ref (GTK_OBJECT (menu));
g_object_ref (menu);
gtk_object_sink (GTK_OBJECT (menu));
data = g_new (GtkMenuAttachData, 1);
data->attach_widget = attach_widget;
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)
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);
data = gtk_object_get_data (GTK_OBJECT (menu), attach_data_key);
data = g_object_get_data (G_OBJECT (menu), attach_data_key);
if (data)
return data->attach_widget;
return NULL;
@ -555,13 +558,13 @@ gtk_menu_detach (GtkMenu *menu)
/* 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)
{
g_warning ("gtk_menu_detach(): menu is not attached");
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);
@ -573,7 +576,7 @@ gtk_menu_detach (GtkMenu *menu)
/* Fallback title for menu comes from attach widget */
gtk_menu_update_title (menu);
gtk_widget_unref (GTK_WIDGET (menu));
g_object_unref (menu);
}
static void
@ -590,7 +593,7 @@ gtk_menu_remove (GtkContainer *container,
*/
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;
}
@ -601,7 +604,7 @@ gtk_menu_remove (GtkContainer *container,
GtkWidget*
gtk_menu_new (void)
{
return GTK_WIDGET (gtk_type_new (gtk_menu_get_type ()));
return g_object_new (GTK_TYPE_MENU, NULL);
}
static void
@ -636,24 +639,24 @@ gtk_menu_tearoff_bg_copy (GtkMenu *menu)
gc = gdk_gc_new_with_values (widget->window,
&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,
width,
height,
-1);
gdk_draw_pixmap (pixmap, gc,
gdk_draw_drawable (pixmap, gc,
menu->tearoff_window->window,
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,
height);
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
* 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 (!GTK_WIDGET_REALIZED (menu))
@ -879,9 +882,9 @@ gtk_menu_popdown (GtkMenu *menu)
if (menu_shell->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;
gtk_widget_ref (menu->old_active_menu_item);
g_object_ref (menu->old_active_menu_item);
}
gtk_menu_shell_deselect (menu_shell);
@ -892,7 +895,7 @@ gtk_menu_popdown (GtkMenu *menu)
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)
{
@ -954,7 +957,7 @@ gtk_menu_get_active (GtkMenu *menu)
menu->old_active_menu_item = child;
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;
@ -976,9 +979,9 @@ gtk_menu_set_active (GtkMenu *menu,
if (GTK_BIN (child)->child)
{
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;
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)
gtk_accel_group_unref (menu->accel_group);
g_object_unref (menu->accel_group);
menu->accel_group = 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);
}
}
@ -1191,7 +1194,7 @@ gtk_menu_set_tearoff_state (GtkMenu *menu,
menu->tearoff_hbox = gtk_hbox_new (FALSE, FALSE);
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 =
GTK_ADJUSTMENT (gtk_adjustment_new (0,
0,
@ -1199,7 +1202,7 @@ gtk_menu_set_tearoff_state (GtkMenu *menu,
MENU_SCROLL_STEP,
height/2,
height));
g_object_connect (GTK_OBJECT (menu->tearoff_adjustment),
g_object_connect (menu->tearoff_adjustment,
"signal::value_changed", gtk_menu_scrollbar_changed, menu,
NULL);
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);
gdk_window_get_size (GTK_WIDGET (menu)->window, &width, NULL);
gdk_drawable_get_size (GTK_WIDGET (menu)->window, &width, NULL);
/* Update menu->requisition
*/
@ -1297,7 +1300,7 @@ gtk_menu_get_title (GtkMenu *menu)
{
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
@ -1697,7 +1700,7 @@ gtk_menu_paint (GtkWidget *widget,
border_x = GTK_CONTAINER (widget)->border_width + widget->style->xthickness;
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)
{
@ -1839,7 +1842,7 @@ gtk_menu_key_press (GtkWidget *widget,
if (event->keyval == keyval &&
(mods & event->state) == mods)
{
gtk_signal_emit_by_name (GTK_OBJECT (menu), "cancel");
g_signal_emit_by_name (menu, "cancel", 0);
}
g_free (accel);
@ -1975,7 +1978,7 @@ gtk_menu_motion_notify (GtkWidget *widget,
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 &&
event->y >= 0 && event->y < height)
{
@ -2033,7 +2036,7 @@ gtk_menu_scroll_timeout (gpointer data)
if ((menu->scroll_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: */
if (menu->scroll_offset > 0)
@ -2064,7 +2067,7 @@ gtk_menu_handle_scrolling (GtkMenu *menu, gboolean enter)
menu_shell = GTK_MENU_SHELL (menu);
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;
@ -2301,11 +2304,11 @@ gtk_menu_set_submenu_navigation_region (GtkMenu *menu,
event_widget = gtk_get_event_widget ((GdkEvent*) event);
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_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)
{
@ -2613,7 +2616,7 @@ gtk_menu_scroll_item_visible (GtkMenuShell *menu_shell,
if (child == menu_item)
{
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;
@ -2707,15 +2710,15 @@ gtk_menu_reparent (GtkMenu *menu,
GtkWidget *widget = GTK_WIDGET (menu);
gboolean was_floating = GTK_OBJECT_FLOATING (object);
gtk_object_ref (object);
g_object_ref (object);
gtk_object_sink (object);
if (unrealize)
{
gtk_object_ref (object);
g_object_ref (object);
gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
gtk_container_add (GTK_CONTAINER (new_parent), widget);
gtk_object_unref (object);
g_object_unref (object);
}
else
gtk_widget_reparent (GTK_WIDGET (menu), new_parent);
@ -2723,7 +2726,7 @@ gtk_menu_reparent (GtkMenu *menu,
if (was_floating)
GTK_OBJECT_SET_FLAGS (object, GTK_FLOATING);
else
gtk_object_unref (object);
g_object_unref (object);
}
static void

View File

@ -38,11 +38,11 @@ extern "C" {
#endif /* __cplusplus */
#define GTK_TYPE_MENU (gtk_menu_get_type ())
#define GTK_MENU(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_MENU, GtkMenu))
#define GTK_MENU_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU, GtkMenuClass))
#define GTK_IS_MENU(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_MENU))
#define GTK_IS_MENU_CLASS(klass) (GTK_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(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU, GtkMenu))
#define GTK_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU, GtkMenuClass))
#define GTK_IS_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU))
#define GTK_IS_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU))
#define GTK_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU, GtkMenuClass))
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);
/* Display the menu onscreen */

View File

@ -35,7 +35,6 @@
#include "gtksettings.h"
#include "gtkintl.h"
#include "gtkwindow.h"
#include "gtksignal.h"
#define BORDER_SPACING 0
@ -57,26 +56,28 @@ static GtkShadowType get_shadow_type (GtkMenuBar *menubar);
static GtkMenuShellClass *parent_class = NULL;
GtkType
GType
gtk_menu_bar_get_type (void)
{
static GtkType menu_bar_type = 0;
static GType menu_bar_type = 0;
if (!menu_bar_type)
{
static const GtkTypeInfo menu_bar_info =
static const GTypeInfo menu_bar_info =
{
"GtkMenuBar",
sizeof (GtkMenuBar),
sizeof (GtkMenuBarClass),
(GtkClassInitFunc) gtk_menu_bar_class_init,
(GtkObjectInitFunc) NULL,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
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 = 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;
@ -168,7 +169,7 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class)
GtkWidget*
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
@ -472,7 +473,7 @@ add_to_window (GtkWindow *window,
if (!menubars)
{
g_signal_connect (G_OBJECT (window),
g_signal_connect (window,
"key_press_event",
G_CALLBACK (window_key_press_handler),
NULL);
@ -494,8 +495,8 @@ remove_from_window (GtkWindow *window,
if (!menubars)
{
g_signal_handlers_disconnect_by_func (G_OBJECT (window),
(gpointer) window_key_press_handler,
g_signal_handlers_disconnect_by_func (window,
window_key_press_handler,
NULL);
}

View File

@ -38,11 +38,11 @@ extern "C" {
#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_CLASS(klass) (GTK_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_CLASS(klass) (GTK_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(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_BAR, GtkMenuBar))
#define GTK_MENU_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_BAR, GtkMenuBarClass))
#define GTK_IS_MENU_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 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) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU_BAR, GtkMenuBarClass))
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);
#ifndef GTK_DISABLE_DEPRECATED

View File

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

View File

@ -38,11 +38,11 @@ extern "C" {
#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_CLASS(klass) (GTK_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_CLASS(klass) (GTK_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(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_ITEM, GtkMenuItem))
#define GTK_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_ITEM, GtkMenuItemClass))
#define GTK_IS_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 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) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU_ITEM, GtkMenuItemClass))
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_with_label (const gchar *label);
GtkWidget* gtk_menu_item_new_with_mnemonic (const gchar *label);

View File

@ -33,7 +33,6 @@
#include "gtkmenubar.h"
#include "gtkmenuitem.h"
#include "gtkmenushell.h"
#include "gtksignal.h"
#include "gtktearoffmenuitem.h"
#include "gtkwindow.h"
@ -140,7 +139,7 @@ static gint gtk_menu_shell_is_item (GtkMenuShell *menu_shell,
GtkWidget *child);
static GtkWidget *gtk_menu_shell_get_item (GtkMenuShell *menu_shell,
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,
GtkWidget *menu_item);
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 };
GtkType
GType
gtk_menu_shell_get_type (void)
{
static GtkType menu_shell_type = 0;
static GType menu_shell_type = 0;
if (!menu_shell_type)
{
@ -175,10 +174,11 @@ gtk_menu_shell_get_type (void)
sizeof (GtkMenuShell),
0, /* n_preallocs */
(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 =
g_type_register_static (GTK_TYPE_CONTAINER, "GtkMenuShell",
&menu_shell_info, G_TYPE_FLAG_ABSTRACT);
}
@ -217,17 +217,17 @@ binding_signal_new (const gchar *signal_name,
static void
gtk_menu_shell_class_init (GtkMenuShellClass *klass)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
GtkBindingSet *binding_set;
object_class = (GtkObjectClass*) klass;
object_class = (GObjectClass*) klass;
widget_class = (GtkWidgetClass*) 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->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;
menu_shell_signals[DEACTIVATE] =
gtk_signal_new ("deactivate",
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkMenuShellClass, deactivate),
g_signal_new ("deactivate",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkMenuShellClass, deactivate),
NULL, NULL,
_gtk_marshal_VOID__VOID,
GTK_TYPE_NONE, 0);
G_TYPE_NONE, 0);
menu_shell_signals[SELECTION_DONE] =
gtk_signal_new ("selection-done",
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkMenuShellClass, selection_done),
g_signal_new ("selection-done",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkMenuShellClass, selection_done),
NULL, NULL,
_gtk_marshal_VOID__VOID,
GTK_TYPE_NONE, 0);
G_TYPE_NONE, 0);
menu_shell_signals[MOVE_CURRENT] =
gtk_signal_new ("move_current",
GTK_RUN_LAST | GTK_RUN_ACTION,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkMenuShellClass, move_current),
g_signal_new ("move_current",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkMenuShellClass, move_current),
NULL, NULL,
_gtk_marshal_VOID__ENUM,
GTK_TYPE_NONE, 1,
G_TYPE_NONE, 1,
GTK_TYPE_MENU_DIRECTION_TYPE);
menu_shell_signals[ACTIVATE_CURRENT] =
gtk_signal_new ("activate_current",
GTK_RUN_LAST | GTK_RUN_ACTION,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkMenuShellClass, activate_current),
g_signal_new ("activate_current",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkMenuShellClass, activate_current),
NULL, NULL,
_gtk_marshal_VOID__BOOLEAN,
GTK_TYPE_NONE, 1,
GTK_TYPE_BOOL);
G_TYPE_NONE, 1,
G_TYPE_BOOLEAN);
menu_shell_signals[CANCEL] =
gtk_signal_new ("cancel",
GTK_RUN_LAST | GTK_RUN_ACTION,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkMenuShellClass, cancel),
g_signal_new ("cancel",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkMenuShellClass, cancel),
NULL, NULL,
_gtk_marshal_VOID__VOID,
GTK_TYPE_NONE, 0);
G_TYPE_NONE, 0);
menu_shell_signals[CYCLE_FOCUS] =
binding_signal_new ("cycle_focus",
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),
NULL, NULL,
_gtk_marshal_VOID__ENUM,
GTK_TYPE_NONE, 1,
G_TYPE_NONE, 1,
GTK_TYPE_DIRECTION_TYPE);
@ -305,22 +310,22 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
gtk_binding_entry_add_signal (binding_set,
GDK_Return, 0,
"activate_current", 1,
GTK_TYPE_BOOL,
G_TYPE_BOOLEAN,
TRUE);
gtk_binding_entry_add_signal (binding_set,
GDK_KP_Enter, 0,
"activate_current", 1,
GTK_TYPE_BOOL,
G_TYPE_BOOLEAN,
TRUE);
gtk_binding_entry_add_signal (binding_set,
GDK_space, 0,
"activate_current", 1,
GTK_TYPE_BOOL,
G_TYPE_BOOLEAN,
FALSE);
gtk_binding_entry_add_signal (binding_set,
GDK_KP_Space, 0,
"activate_current", 1,
GTK_TYPE_BOOL,
G_TYPE_BOOLEAN,
FALSE);
gtk_binding_entry_add_signal (binding_set,
GDK_F10, 0,
@ -332,7 +337,7 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
GTK_TYPE_DIRECTION_TYPE, GTK_DIR_TAB_BACKWARD);
}
static GtkType
static GType
gtk_menu_shell_child_type (GtkContainer *container)
{
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));
gtk_signal_emit (GTK_OBJECT (menu_shell), menu_shell_signals[DEACTIVATE]);
g_signal_emit (menu_shell, menu_shell_signals[DEACTIVATE], 0);
}
static void
@ -492,7 +497,7 @@ gtk_menu_shell_button_press (GtkWidget *widget,
if (widget == GTK_WIDGET (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)
{
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)
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)
{
@ -918,7 +923,7 @@ gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
do
{
gtk_widget_ref (GTK_WIDGET (parent_menu_shell));
g_object_ref (parent_menu_shell);
shells = g_slist_prepend (shells, 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)
{
gtk_signal_emit (slist->data, menu_shell_signals[SELECTION_DONE]);
gtk_widget_unref (slist->data);
g_signal_emit (slist->data, menu_shell_signals[SELECTION_DONE], 0);
g_object_unref (slist->data);
}
g_slist_free (shells);
gtk_widget_unref (GTK_WIDGET (menu_shell));
g_object_unref (menu_shell);
}
/* 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_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

View File

@ -38,11 +38,11 @@ extern "C" {
#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_CLASS(klass) (GTK_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_CLASS(klass) (GTK_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(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_SHELL, GtkMenuShell))
#define GTK_MENU_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_SHELL, GtkMenuShellClass))
#define GTK_IS_MENU_SHELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 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) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU_SHELL, GtkMenuShellClass))
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,
GtkWidget *child);
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;
GtkType
GType
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)
{
static const GtkTypeInfo radio_menu_item_info =
static const GTypeInfo radio_menu_item_info =
{
"GtkRadioMenuItem",
sizeof (GtkRadioMenuItem),
sizeof (GtkRadioMenuItemClass),
(GtkClassInitFunc) gtk_radio_menu_item_class_init,
(GtkObjectInitFunc) gtk_radio_menu_item_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_radio_menu_item_class_init,
NULL, /* class_finalize */
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;
@ -67,7 +70,7 @@ gtk_radio_menu_item_new (GSList *group)
{
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);
@ -157,7 +160,7 @@ gtk_radio_menu_item_new_with_mnemonic (GSList *group,
GtkWidget *accel_label;
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_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;
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;

View File

@ -38,11 +38,11 @@ extern "C" {
#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_CLASS(klass) (GTK_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_CLASS(klass) (GTK_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(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RADIO_MENU_ITEM, GtkRadioMenuItem))
#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) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 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) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RADIO_MENU_ITEM, GtkRadioMenuItemClass))
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_with_label (GSList *group,
const gchar *label);