diff options
author | Manish Singh <yosh@gimp.org> | 2002-10-09 22:25:18 +0000 |
---|---|---|
committer | Manish Singh <yosh@src.gnome.org> | 2002-10-09 22:25:18 +0000 |
commit | 9565f3ffb2276ec2132b6211344329aec296b7ce (patch) | |
tree | 5b468f6c4f2d0c6983d7a65d1d26b975adbba323 /gtk | |
parent | fb6a7df846c6f553a2cd3387b12d0027bc986f43 (diff) | |
download | gtk+-9565f3ffb2276ec2132b6211344329aec296b7ce.tar.gz |
Deprecation cleanup
Wed Oct 9 15:23:48 2002 Manish Singh <yosh@gimp.org>
* gtk/gtkadjustment.[ch] gtk/gtkalignment.[ch] gtk/gtkentry.[ch]
gtk/gtkhsv.[ch] gtk/gtktooltips.[ch]: Deprecation cleanup
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkadjustment.c | 62 | ||||
-rw-r--r-- | gtk/gtkadjustment.h | 12 | ||||
-rw-r--r-- | gtk/gtkalignment.c | 28 | ||||
-rw-r--r-- | gtk/gtkalignment.h | 12 | ||||
-rw-r--r-- | gtk/gtkentry.c | 265 | ||||
-rw-r--r-- | gtk/gtkentry.h | 12 | ||||
-rw-r--r-- | gtk/gtkhsv.c | 106 | ||||
-rw-r--r-- | gtk/gtkhsv.h | 12 | ||||
-rw-r--r-- | gtk/gtktooltips.c | 96 | ||||
-rw-r--r-- | gtk/gtktooltips.h | 12 |
10 files changed, 324 insertions, 293 deletions
diff --git a/gtk/gtkadjustment.c b/gtk/gtkadjustment.c index 0c6cf648da..5a607cafeb 100644 --- a/gtk/gtkadjustment.c +++ b/gtk/gtkadjustment.c @@ -26,7 +26,6 @@ #include "gtkadjustment.h" #include "gtkmarshalers.h" -#include "gtksignal.h" enum { @@ -43,26 +42,29 @@ static void gtk_adjustment_init (GtkAdjustment *adjustment); static guint adjustment_signals[LAST_SIGNAL] = { 0 }; -GtkType +GType gtk_adjustment_get_type (void) { - static GtkType adjustment_type = 0; + static GType adjustment_type = 0; if (!adjustment_type) { - static const GtkTypeInfo adjustment_info = + static const GTypeInfo adjustment_info = { - "GtkAdjustment", - sizeof (GtkAdjustment), sizeof (GtkAdjustmentClass), - (GtkClassInitFunc) gtk_adjustment_class_init, - (GtkObjectInitFunc) gtk_adjustment_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_adjustment_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkAdjustment), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_adjustment_init, }; - adjustment_type = gtk_type_unique (GTK_TYPE_OBJECT, &adjustment_info); + adjustment_type = + g_type_register_static (GTK_TYPE_OBJECT, "GtkAdjustment", + &adjustment_info, 0); } return adjustment_type; @@ -71,27 +73,25 @@ gtk_adjustment_get_type (void) static void gtk_adjustment_class_init (GtkAdjustmentClass *class) { - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) class; - class->changed = NULL; class->value_changed = NULL; adjustment_signals[CHANGED] = - gtk_signal_new ("changed", - GTK_RUN_FIRST | GTK_RUN_NO_RECURSE, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkAdjustmentClass, changed), - _gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE (class), + G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, + G_STRUCT_OFFSET (GtkAdjustmentClass, changed), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); adjustment_signals[VALUE_CHANGED] = - gtk_signal_new ("value_changed", - GTK_RUN_FIRST | GTK_RUN_NO_RECURSE, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkAdjustmentClass, value_changed), - _gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_new ("value_changed", + G_OBJECT_CLASS_TYPE (class), + G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, + G_STRUCT_OFFSET (GtkAdjustmentClass, value_changed), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); } static void @@ -115,7 +115,7 @@ gtk_adjustment_new (gdouble value, { GtkAdjustment *adjustment; - adjustment = gtk_type_new (gtk_adjustment_get_type ()); + adjustment = g_object_new (GTK_TYPE_ADJUSTMENT, NULL); adjustment->value = value; adjustment->lower = lower; @@ -165,7 +165,7 @@ gtk_adjustment_changed (GtkAdjustment *adjustment) { g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment)); - gtk_signal_emit (GTK_OBJECT (adjustment), adjustment_signals[CHANGED]); + g_signal_emit (adjustment, adjustment_signals[CHANGED], 0); } void @@ -173,7 +173,7 @@ gtk_adjustment_value_changed (GtkAdjustment *adjustment) { g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment)); - gtk_signal_emit (GTK_OBJECT (adjustment), adjustment_signals[VALUE_CHANGED]); + g_signal_emit (adjustment, adjustment_signals[VALUE_CHANGED], 0); } void diff --git a/gtk/gtkadjustment.h b/gtk/gtkadjustment.h index 4362ff3e7c..d79fee5887 100644 --- a/gtk/gtkadjustment.h +++ b/gtk/gtkadjustment.h @@ -38,11 +38,11 @@ extern "C" { #define GTK_TYPE_ADJUSTMENT (gtk_adjustment_get_type ()) -#define GTK_ADJUSTMENT(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_ADJUSTMENT, GtkAdjustment)) -#define GTK_ADJUSTMENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_ADJUSTMENT, GtkAdjustmentClass)) -#define GTK_IS_ADJUSTMENT(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_ADJUSTMENT)) -#define GTK_IS_ADJUSTMENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ADJUSTMENT)) -#define GTK_ADJUSTMENT_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_ADJUSTMENT, GtkAdjustmentClass)) +#define GTK_ADJUSTMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ADJUSTMENT, GtkAdjustment)) +#define GTK_ADJUSTMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ADJUSTMENT, GtkAdjustmentClass)) +#define GTK_IS_ADJUSTMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ADJUSTMENT)) +#define GTK_IS_ADJUSTMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ADJUSTMENT)) +#define GTK_ADJUSTMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ADJUSTMENT, GtkAdjustmentClass)) typedef struct _GtkAdjustment GtkAdjustment; @@ -75,7 +75,7 @@ struct _GtkAdjustmentClass }; -GtkType gtk_adjustment_get_type (void) G_GNUC_CONST; +GType gtk_adjustment_get_type (void) G_GNUC_CONST; GtkObject* gtk_adjustment_new (gdouble value, gdouble lower, gdouble upper, diff --git a/gtk/gtkalignment.c b/gtk/gtkalignment.c index dbc42fd5ae..5eda80dd3f 100644 --- a/gtk/gtkalignment.c +++ b/gtk/gtkalignment.c @@ -54,26 +54,28 @@ static void gtk_alignment_get_property (GObject *object, GValue *value, GParamSpec *pspec); -GtkType +GType gtk_alignment_get_type (void) { - static GtkType alignment_type = 0; + static GType alignment_type = 0; if (!alignment_type) { - static const GtkTypeInfo alignment_info = + static const GTypeInfo alignment_info = { - "GtkAlignment", - sizeof (GtkAlignment), sizeof (GtkAlignmentClass), - (GtkClassInitFunc) gtk_alignment_class_init, - (GtkObjectInitFunc) gtk_alignment_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_alignment_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkAlignment), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_alignment_init, }; - alignment_type = gtk_type_unique (GTK_TYPE_BIN, &alignment_info); + alignment_type = g_type_register_static (GTK_TYPE_BIN, "GtkAlignment", + &alignment_info, 0); } return alignment_type; @@ -83,11 +85,9 @@ static void gtk_alignment_class_init (GtkAlignmentClass *class) { GObjectClass *gobject_class; - GtkObjectClass *object_class; GtkWidgetClass *widget_class; gobject_class = (GObjectClass*) class; - object_class = (GtkObjectClass*) class; widget_class = (GtkWidgetClass*) class; gobject_class->set_property = gtk_alignment_set_property; @@ -155,7 +155,7 @@ gtk_alignment_new (gfloat xalign, { GtkAlignment *alignment; - alignment = gtk_type_new (gtk_alignment_get_type ()); + alignment = g_object_new (GTK_TYPE_ALIGNMENT, NULL); alignment->xalign = CLAMP (xalign, 0.0, 1.0); alignment->yalign = CLAMP (yalign, 0.0, 1.0); diff --git a/gtk/gtkalignment.h b/gtk/gtkalignment.h index 3c3fba77b4..8a06c887bb 100644 --- a/gtk/gtkalignment.h +++ b/gtk/gtkalignment.h @@ -38,11 +38,11 @@ extern "C" { #define GTK_TYPE_ALIGNMENT (gtk_alignment_get_type ()) -#define GTK_ALIGNMENT(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_ALIGNMENT, GtkAlignment)) -#define GTK_ALIGNMENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_ALIGNMENT, GtkAlignmentClass)) -#define GTK_IS_ALIGNMENT(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_ALIGNMENT)) -#define GTK_IS_ALIGNMENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ALIGNMENT)) -#define GTK_ALIGNMENT_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_ALIGNMENT, GtkAlignmentClass)) +#define GTK_ALIGNMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ALIGNMENT, GtkAlignment)) +#define GTK_ALIGNMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ALIGNMENT, GtkAlignmentClass)) +#define GTK_IS_ALIGNMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ALIGNMENT)) +#define GTK_IS_ALIGNMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ALIGNMENT)) +#define GTK_ALIGNMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ALIGNMENT, GtkAlignmentClass)) typedef struct _GtkAlignment GtkAlignment; @@ -64,7 +64,7 @@ struct _GtkAlignmentClass }; -GtkType gtk_alignment_get_type (void) G_GNUC_CONST; +GType gtk_alignment_get_type (void) G_GNUC_CONST; GtkWidget* gtk_alignment_new (gfloat xalign, gfloat yalign, gfloat xscale, diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index cdc7175ec0..2c18e28411 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -45,7 +45,6 @@ #include "gtkselection.h" #include "gtksettings.h" #include "gtkstock.h" -#include "gtksignal.h" #include "gtktextutil.h" #include "gtkwindow.h" @@ -309,23 +308,24 @@ static void get_widget_window_size (GtkEntry *entry, static GtkWidgetClass *parent_class = NULL; -GtkType +GType gtk_entry_get_type (void) { - static GtkType entry_type = 0; + static GType entry_type = 0; if (!entry_type) { - static const GtkTypeInfo entry_info = + static const GTypeInfo entry_info = { - "GtkEntry", - sizeof (GtkEntry), sizeof (GtkEntryClass), - (GtkClassInitFunc) gtk_entry_class_init, - (GtkObjectInitFunc) gtk_entry_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_entry_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkEntry), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_entry_init, }; static const GInterfaceInfo editable_info = @@ -342,7 +342,9 @@ gtk_entry_get_type (void) NULL /* interface_data */ }; - entry_type = gtk_type_unique (GTK_TYPE_WIDGET, &entry_info); + entry_type = g_type_register_static (GTK_TYPE_WIDGET, "GtkEntry", + &entry_info, 0); + g_type_add_interface_static (entry_type, GTK_TYPE_EDITABLE, &editable_info); @@ -365,29 +367,27 @@ add_move_binding (GtkBindingSet *binding_set, gtk_binding_entry_add_signal (binding_set, keyval, modmask, "move_cursor", 3, - GTK_TYPE_ENUM, step, + G_TYPE_ENUM, step, G_TYPE_INT, count, - G_TYPE_BOOLEAN, FALSE); + G_TYPE_BOOLEAN, FALSE); /* Selection-extending version */ gtk_binding_entry_add_signal (binding_set, keyval, modmask | GDK_SHIFT_MASK, "move_cursor", 3, - GTK_TYPE_ENUM, step, + G_TYPE_ENUM, step, G_TYPE_INT, count, - G_TYPE_BOOLEAN, TRUE); + G_TYPE_BOOLEAN, TRUE); } static void gtk_entry_class_init (GtkEntryClass *class) { GObjectClass *gobject_class = G_OBJECT_CLASS (class); - GtkObjectClass *object_class; GtkWidgetClass *widget_class; GtkBindingSet *binding_set; - object_class = (GtkObjectClass*) class; widget_class = (GtkWidgetClass*) class; - parent_class = gtk_type_class (GTK_TYPE_WIDGET); + parent_class = g_type_class_peek_parent (class); gobject_class->finalize = gtk_entry_finalize; gobject_class->set_property = gtk_entry_set_property; @@ -526,79 +526,95 @@ gtk_entry_class_init (GtkEntryClass *class) G_PARAM_READABLE | G_PARAM_WRITABLE)); signals[POPULATE_POPUP] = - gtk_signal_new ("populate_popup", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkEntryClass, populate_popup), - _gtk_marshal_VOID__OBJECT, - GTK_TYPE_NONE, 1, GTK_TYPE_MENU); + g_signal_new ("populate_popup", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GtkEntryClass, populate_popup), + NULL, NULL, + _gtk_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + GTK_TYPE_MENU); /* Action signals */ signals[ACTIVATE] = - gtk_signal_new ("activate", - GTK_RUN_LAST | GTK_RUN_ACTION, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkEntryClass, activate), - _gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_new ("activate", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (GtkEntryClass, activate), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); widget_class->activate_signal = signals[ACTIVATE]; signals[MOVE_CURSOR] = - gtk_signal_new ("move_cursor", - GTK_RUN_LAST | GTK_RUN_ACTION, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkEntryClass, move_cursor), - _gtk_marshal_VOID__ENUM_INT_BOOLEAN, - GTK_TYPE_NONE, 3, GTK_TYPE_MOVEMENT_STEP, GTK_TYPE_INT, GTK_TYPE_BOOL); + g_signal_new ("move_cursor", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (GtkEntryClass, move_cursor), + NULL, NULL, + _gtk_marshal_VOID__ENUM_INT_BOOLEAN, + G_TYPE_NONE, 3, + GTK_TYPE_MOVEMENT_STEP, + G_TYPE_INT, + G_TYPE_BOOLEAN); signals[INSERT_AT_CURSOR] = - gtk_signal_new ("insert_at_cursor", - GTK_RUN_LAST | GTK_RUN_ACTION, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkEntryClass, insert_at_cursor), - _gtk_marshal_VOID__STRING, - GTK_TYPE_NONE, 1, GTK_TYPE_STRING); + g_signal_new ("insert_at_cursor", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (GtkEntryClass, insert_at_cursor), + NULL, NULL, + _gtk_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); signals[DELETE_FROM_CURSOR] = - gtk_signal_new ("delete_from_cursor", - GTK_RUN_LAST | GTK_RUN_ACTION, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkEntryClass, delete_from_cursor), - _gtk_marshal_VOID__ENUM_INT, - GTK_TYPE_NONE, 2, GTK_TYPE_DELETE_TYPE, GTK_TYPE_INT); + g_signal_new ("delete_from_cursor", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (GtkEntryClass, delete_from_cursor), + NULL, NULL, + _gtk_marshal_VOID__ENUM_INT, + G_TYPE_NONE, 2, + GTK_TYPE_DELETE_TYPE, + G_TYPE_INT); signals[CUT_CLIPBOARD] = - gtk_signal_new ("cut_clipboard", - GTK_RUN_LAST | GTK_RUN_ACTION, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkEntryClass, cut_clipboard), - _gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_new ("cut_clipboard", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (GtkEntryClass, cut_clipboard), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); signals[COPY_CLIPBOARD] = - gtk_signal_new ("copy_clipboard", - GTK_RUN_LAST | GTK_RUN_ACTION, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkEntryClass, copy_clipboard), - _gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_new ("copy_clipboard", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (GtkEntryClass, copy_clipboard), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); signals[PASTE_CLIPBOARD] = - gtk_signal_new ("paste_clipboard", - GTK_RUN_LAST | GTK_RUN_ACTION, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkEntryClass, paste_clipboard), - _gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_new ("paste_clipboard", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (GtkEntryClass, paste_clipboard), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); signals[TOGGLE_OVERWRITE] = - gtk_signal_new ("toggle_overwrite", - GTK_RUN_LAST | GTK_RUN_ACTION, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkEntryClass, toggle_overwrite), - _gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_new ("toggle_overwrite", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (GtkEntryClass, toggle_overwrite), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); /* * Key bindings @@ -660,13 +676,13 @@ gtk_entry_class_init (GtkEntryClass *class) gtk_binding_entry_add_signal (binding_set, GDK_a, GDK_CONTROL_MASK, "move_cursor", 3, GTK_TYPE_MOVEMENT_STEP, GTK_MOVEMENT_BUFFER_ENDS, - GTK_TYPE_INT, -1, - GTK_TYPE_BOOL, FALSE); + G_TYPE_INT, -1, + G_TYPE_BOOLEAN, FALSE); gtk_binding_entry_add_signal (binding_set, GDK_a, GDK_CONTROL_MASK, "move_cursor", 3, GTK_TYPE_MOVEMENT_STEP, GTK_MOVEMENT_BUFFER_ENDS, - GTK_TYPE_INT, 1, - GTK_TYPE_BOOL, TRUE); + G_TYPE_INT, 1, + G_TYPE_BOOLEAN, TRUE); /* Activate @@ -679,39 +695,39 @@ gtk_entry_class_init (GtkEntryClass *class) /* Deleting text */ gtk_binding_entry_add_signal (binding_set, GDK_Delete, 0, "delete_from_cursor", 2, - GTK_TYPE_ENUM, GTK_DELETE_CHARS, - GTK_TYPE_INT, 1); + G_TYPE_ENUM, GTK_DELETE_CHARS, + G_TYPE_INT, 1); gtk_binding_entry_add_signal (binding_set, GDK_KP_Delete, 0, "delete_from_cursor", 2, - GTK_TYPE_ENUM, GTK_DELETE_CHARS, - GTK_TYPE_INT, 1); + G_TYPE_ENUM, GTK_DELETE_CHARS, + G_TYPE_INT, 1); gtk_binding_entry_add_signal (binding_set, GDK_BackSpace, 0, "delete_from_cursor", 2, - GTK_TYPE_ENUM, GTK_DELETE_CHARS, - GTK_TYPE_INT, -1); + G_TYPE_ENUM, GTK_DELETE_CHARS, + G_TYPE_INT, -1); /* Make this do the same as Backspace, to help with mis-typing */ gtk_binding_entry_add_signal (binding_set, GDK_BackSpace, GDK_SHIFT_MASK, "delete_from_cursor", 2, - GTK_TYPE_ENUM, GTK_DELETE_CHARS, - GTK_TYPE_INT, -1); + G_TYPE_ENUM, GTK_DELETE_CHARS, + G_TYPE_INT, -1); gtk_binding_entry_add_signal (binding_set, GDK_Delete, GDK_CONTROL_MASK, "delete_from_cursor", 2, - GTK_TYPE_ENUM, GTK_DELETE_WORD_ENDS, - GTK_TYPE_INT, 1); + G_TYPE_ENUM, GTK_DELETE_WORD_ENDS, + G_TYPE_INT, 1); gtk_binding_entry_add_signal (binding_set, GDK_KP_Delete, GDK_CONTROL_MASK, "delete_from_cursor", 2, - GTK_TYPE_ENUM, GTK_DELETE_WORD_ENDS, - GTK_TYPE_INT, 1); + G_TYPE_ENUM, GTK_DELETE_WORD_ENDS, + G_TYPE_INT, 1); gtk_binding_entry_add_signal (binding_set, GDK_BackSpace, GDK_CONTROL_MASK, "delete_from_cursor", 2, - GTK_TYPE_ENUM, GTK_DELETE_WORD_ENDS, - GTK_TYPE_INT, -1); + G_TYPE_ENUM, GTK_DELETE_WORD_ENDS, + G_TYPE_INT, -1); /* Cut/copy/paste */ @@ -901,13 +917,13 @@ gtk_entry_init (GtkEntry *entry) */ entry->im_context = gtk_im_multicontext_new (); - g_signal_connect (G_OBJECT (entry->im_context), "commit", + g_signal_connect (entry->im_context, "commit", G_CALLBACK (gtk_entry_commit_cb), entry); - g_signal_connect (G_OBJECT (entry->im_context), "preedit_changed", + g_signal_connect (entry->im_context, "preedit_changed", G_CALLBACK (gtk_entry_preedit_changed_cb), entry); - g_signal_connect (G_OBJECT (entry->im_context), "retrieve_surrounding", + g_signal_connect (entry->im_context, "retrieve_surrounding", G_CALLBACK (gtk_entry_retrieve_surrounding_cb), entry); - g_signal_connect (G_OBJECT (entry->im_context), "delete_surrounding", + g_signal_connect (entry->im_context, "delete_surrounding", G_CALLBACK (gtk_entry_delete_surrounding_cb), entry); } @@ -917,9 +933,9 @@ gtk_entry_finalize (GObject *object) GtkEntry *entry = GTK_ENTRY (object); if (entry->cached_layout) - g_object_unref (G_OBJECT (entry->cached_layout)); + g_object_unref (entry->cached_layout); - g_object_unref (G_OBJECT (entry->im_context)); + g_object_unref (entry->im_context); if (entry->blink_timeout) g_source_remove (entry->blink_timeout); @@ -1195,7 +1211,7 @@ gtk_entry_draw_frame (GtkWidget *widget) "focus-line-width", &focus_width, NULL); - gdk_window_get_size (widget->window, &width, &height); + gdk_drawable_get_size (widget->window, &width, &height); if (GTK_WIDGET_HAS_FOCUS (widget) && !interior_focus) { @@ -1471,7 +1487,7 @@ gtk_entry_motion_notify (GtkWidget *widget, else { gint height; - gdk_window_get_size (entry->text_area, NULL, &height); + gdk_drawable_get_size (entry->text_area, NULL, &height); if (event->y < 0) tmp_pos = 0; @@ -1602,7 +1618,7 @@ gtk_entry_focus_out (GtkWidget *widget, gtk_entry_check_cursor_blink (entry); g_signal_handlers_disconnect_by_func (gdk_keymap_get_for_display (gtk_widget_get_display (widget)), - (gpointer) gtk_entry_keymap_direction_changed, + gtk_entry_keymap_direction_changed, entry); return FALSE; @@ -1654,7 +1670,7 @@ gtk_entry_state_changed (GtkWidget *widget, gtk_editable_select_region (GTK_EDITABLE (entry), entry->current_pos, entry->current_pos); } - gtk_widget_queue_clear (widget); + gtk_widget_queue_draw (widget); } /* GtkEditable method implementations @@ -1672,7 +1688,7 @@ gtk_entry_insert_text (GtkEditable *editable, if (*position < 0 || *position > entry->text_length) *position = entry->text_length; - g_object_ref (G_OBJECT (editable)); + g_object_ref (editable); if (new_text_length <= 63) text = buf; @@ -1687,7 +1703,7 @@ gtk_entry_insert_text (GtkEditable *editable, if (new_text_length > 63) g_free (text); - g_object_unref (G_OBJECT (editable)); + g_object_unref (editable); } static void @@ -1704,11 +1720,11 @@ gtk_entry_delete_text (GtkEditable *editable, if (start_pos > end_pos) start_pos = end_pos; - g_object_ref (G_OBJECT (editable)); + g_object_ref (editable); g_signal_emit_by_name (editable, "delete_text", start_pos, end_pos); - g_object_unref (G_OBJECT (editable)); + g_object_unref (editable); } static gchar * @@ -1844,9 +1860,9 @@ gtk_entry_start_editing (GtkCellEditable *cell_editable, { GTK_ENTRY (cell_editable)->is_cell_renderer = TRUE; - g_signal_connect (G_OBJECT (cell_editable), "activate", + g_signal_connect (cell_editable, "activate", G_CALLBACK (gtk_cell_editable_entry_activated), NULL); - g_signal_connect (G_OBJECT (cell_editable), "key_press_event", + g_signal_connect (cell_editable, "key_press_event", G_CALLBACK (gtk_cell_editable_key_press_event), NULL); } @@ -2383,7 +2399,7 @@ gtk_entry_reset_layout (GtkEntry *entry) { if (entry->cached_layout) { - g_object_unref (G_OBJECT (entry->cached_layout)); + g_object_unref (entry->cached_layout); entry->cached_layout = NULL; } } @@ -2733,7 +2749,7 @@ gtk_entry_draw_cursor (GtkEntry *entry, gint x2 = 0; GdkGC *gc; - gdk_window_get_size (entry->text_area, NULL, &text_area_height); + gdk_drawable_get_size (entry->text_area, NULL, &text_area_height); gtk_entry_get_cursor_locations (entry, type, &strong_x, &weak_x); @@ -2880,7 +2896,7 @@ gtk_entry_adjust_scroll (GtkEntry *entry) if (!GTK_WIDGET_REALIZED (entry)) return; - gdk_window_get_size (entry->text_area, &text_area_width, NULL); + gdk_drawable_get_size (entry->text_area, &text_area_width, NULL); text_area_width -= 2 * INNER_BORDER; layout = gtk_entry_ensure_layout (entry, TRUE); @@ -3200,14 +3216,14 @@ paste_received (GtkClipboard *clipboard, gtk_editable_set_position (editable, pos); } - g_object_unref (G_OBJECT (entry)); + g_object_unref (entry); } static void gtk_entry_paste (GtkEntry *entry, GdkAtom selection) { - g_object_ref (G_OBJECT (entry)); + g_object_ref (entry); gtk_clipboard_request_text (gtk_widget_get_clipboard (GTK_WIDGET (entry), selection), paste_received, entry); } @@ -3275,7 +3291,7 @@ gtk_entry_update_primary_selection (GtkEntry *entry) GtkWidget* gtk_entry_new (void) { - return GTK_WIDGET (gtk_type_new (GTK_TYPE_ENTRY)); + return g_object_new (GTK_TYPE_ENTRY, NULL); } /** @@ -3302,7 +3318,7 @@ gtk_entry_new_with_max_length (gint max) max = CLAMP (max, 0, MAX_SIZE); - entry = gtk_type_new (GTK_TYPE_ENTRY); + entry = g_object_new (GTK_TYPE_ENTRY, NULL); entry->text_max_length = max; return GTK_WIDGET (entry); @@ -3791,8 +3807,8 @@ static void activate_cb (GtkWidget *menuitem, GtkEntry *entry) { - const gchar *signal = gtk_object_get_data (GTK_OBJECT (menuitem), "gtk-signal"); - gtk_signal_emit_by_name (GTK_OBJECT (entry), signal); + const gchar *signal = g_object_get_data (G_OBJECT (menuitem), "gtk-signal"); + g_signal_emit_by_name (entry, signal); } @@ -3813,9 +3829,9 @@ append_action_signal (GtkEntry *entry, { GtkWidget *menuitem = gtk_image_menu_item_new_from_stock (stock_id, NULL); - gtk_object_set_data (GTK_OBJECT (menuitem), "gtk-signal", (char *)signal); - gtk_signal_connect (GTK_OBJECT (menuitem), "activate", - GTK_SIGNAL_FUNC (activate_cb), entry); + g_object_set_data (G_OBJECT (menuitem), "gtk-signal", (char *)signal); + g_signal_connect (menuitem, "activate", + G_CALLBACK (activate_cb), entry); gtk_widget_set_sensitive (menuitem, sensitive); @@ -3904,8 +3920,8 @@ popup_targets_received (GtkClipboard *clipboard, entry->editable && clipboard_contains_text); menuitem = gtk_menu_item_new_with_label (_("Select All")); - gtk_signal_connect_object (GTK_OBJECT (menuitem), "activate", - GTK_SIGNAL_FUNC (gtk_entry_select_all), entry); + g_signal_connect_swapped (menuitem, "activate", + G_CALLBACK (gtk_entry_select_all), entry); gtk_widget_show (menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (entry->popup_menu), menuitem); @@ -3936,9 +3952,10 @@ popup_targets_received (GtkClipboard *clipboard, if (!entry->editable) gtk_widget_set_sensitive (menuitem, FALSE); - gtk_signal_emit (GTK_OBJECT (entry), - signals[POPULATE_POPUP], - entry->popup_menu); + g_signal_emit (entry, + signals[POPULATE_POPUP], + 0, + entry->popup_menu); if (info->button) diff --git a/gtk/gtkentry.h b/gtk/gtkentry.h index 259b960953..b6b4ad44c8 100644 --- a/gtk/gtkentry.h +++ b/gtk/gtkentry.h @@ -40,11 +40,11 @@ extern "C" { #define GTK_TYPE_ENTRY (gtk_entry_get_type ()) -#define GTK_ENTRY(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_ENTRY, GtkEntry)) -#define GTK_ENTRY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_ENTRY, GtkEntryClass)) -#define GTK_IS_ENTRY(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_ENTRY)) -#define GTK_IS_ENTRY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ENTRY)) -#define GTK_ENTRY_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_ENTRY, GtkEntryClass)) +#define GTK_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ENTRY, GtkEntry)) +#define GTK_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ENTRY, GtkEntryClass)) +#define GTK_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ENTRY)) +#define GTK_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ENTRY)) +#define GTK_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ENTRY, GtkEntryClass)) typedef struct _GtkEntry GtkEntry; @@ -145,7 +145,7 @@ struct _GtkEntryClass void (*_gtk_reserved4) (void); }; -GtkType gtk_entry_get_type (void) G_GNUC_CONST; +GType gtk_entry_get_type (void) G_GNUC_CONST; GtkWidget* gtk_entry_new (void); void gtk_entry_set_visibility (GtkEntry *entry, gboolean visible); diff --git a/gtk/gtkhsv.c b/gtk/gtkhsv.c index a950ea5d54..7b72f9511e 100644 --- a/gtk/gtkhsv.c +++ b/gtk/gtkhsv.c @@ -24,7 +24,6 @@ #include <math.h> #include <string.h> -#include "gtksignal.h" #include "gtkhsv.h" #include "gdk/gdkkeysyms.h" #include "gtkbindings.h" @@ -125,24 +124,26 @@ static GtkWidgetClass *parent_class; * * Return value: The type ID of the &GtkHSV class. **/ -GtkType +GType gtk_hsv_get_type (void) { - static GtkType hsv_type = 0; + static GType hsv_type = 0; if (!hsv_type) { - static const GtkTypeInfo hsv_info = { - "GtkHSV", - sizeof (GtkHSV), + static const GTypeInfo hsv_info = { sizeof (GtkHSVClass), - (GtkClassInitFunc) gtk_hsv_class_init, - (GtkObjectInitFunc) gtk_hsv_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_hsv_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkHSV), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_hsv_init, }; - hsv_type = gtk_type_unique (GTK_TYPE_WIDGET, &hsv_info); + hsv_type = g_type_register_static (GTK_TYPE_WIDGET, "GtkHSV", + &hsv_info, 0); } return hsv_type; @@ -155,13 +156,13 @@ gtk_hsv_class_init (GtkHSVClass *class) GtkObjectClass *object_class; GtkWidgetClass *widget_class; GtkHSVClass *hsv_class; - GtkBindingSet *binding_set; + GtkBindingSet *binding_set; object_class = (GtkObjectClass *) class; widget_class = (GtkWidgetClass *) class; hsv_class = GTK_HSV_CLASS (class); - parent_class = gtk_type_class (GTK_TYPE_WIDGET); + parent_class = g_type_class_peek_parent (class); object_class->destroy = gtk_hsv_destroy; @@ -180,51 +181,54 @@ gtk_hsv_class_init (GtkHSVClass *class) hsv_class->move = gtk_hsv_move; hsv_signals[CHANGED] = - gtk_signal_new ("changed", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkHSVClass, changed), - _gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GtkHSVClass, changed), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); hsv_signals[MOVE] = - gtk_signal_new ("move", - GTK_RUN_LAST | GTK_RUN_ACTION, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkHSVClass, move), - _gtk_marshal_VOID__ENUM, - GTK_TYPE_NONE, 1, GTK_TYPE_DIRECTION_TYPE); + g_signal_new ("move", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (GtkHSVClass, move), + NULL, NULL, + _gtk_marshal_VOID__ENUM, + G_TYPE_NONE, 1, + GTK_TYPE_DIRECTION_TYPE); binding_set = gtk_binding_set_by_class (class); gtk_binding_entry_add_signal (binding_set, GDK_Up, 0, "move", 1, - GTK_TYPE_ENUM, GTK_DIR_UP); + G_TYPE_ENUM, GTK_DIR_UP); gtk_binding_entry_add_signal (binding_set, GDK_KP_Up, 0, "move", 1, - GTK_TYPE_ENUM, GTK_DIR_UP); + G_TYPE_ENUM, GTK_DIR_UP); gtk_binding_entry_add_signal (binding_set, GDK_Down, 0, "move", 1, - GTK_TYPE_ENUM, GTK_DIR_DOWN); + G_TYPE_ENUM, GTK_DIR_DOWN); gtk_binding_entry_add_signal (binding_set, GDK_KP_Down, 0, "move", 1, - GTK_TYPE_ENUM, GTK_DIR_DOWN); + G_TYPE_ENUM, GTK_DIR_DOWN); gtk_binding_entry_add_signal (binding_set, GDK_Right, 0, "move", 1, - GTK_TYPE_ENUM, GTK_DIR_RIGHT); + G_TYPE_ENUM, GTK_DIR_RIGHT); gtk_binding_entry_add_signal (binding_set, GDK_KP_Right, 0, "move", 1, - GTK_TYPE_ENUM, GTK_DIR_RIGHT); + G_TYPE_ENUM, GTK_DIR_RIGHT); gtk_binding_entry_add_signal (binding_set, GDK_Left, 0, "move", 1, - GTK_TYPE_ENUM, GTK_DIR_LEFT); + G_TYPE_ENUM, GTK_DIR_LEFT); gtk_binding_entry_add_signal (binding_set, GDK_KP_Left, 0, "move", 1, - GTK_TYPE_ENUM, GTK_DIR_LEFT); + G_TYPE_ENUM, GTK_DIR_LEFT); } /* Object initialization function for the HSV color selector */ @@ -337,7 +341,7 @@ gtk_hsv_realize (GtkWidget *widget) parent_window = gtk_widget_get_parent_window (widget); widget->window = parent_window; - gdk_window_ref (widget->window); + g_object_ref (widget->window); priv->window = gdk_window_new (parent_window, &attr, attr_mask); gdk_window_set_user_data (priv->window, hsv); @@ -363,7 +367,7 @@ gtk_hsv_unrealize (GtkWidget *widget) gdk_window_destroy (priv->window); priv->window = NULL; - gdk_gc_unref (priv->gc); + g_object_unref (priv->gc); priv->gc = NULL; if (GTK_WIDGET_CLASS (parent_class)->unrealize) @@ -762,7 +766,7 @@ set_cross_grab (GtkHSV *hsv, NULL, cursor, time); - gdk_cursor_destroy (cursor); + gdk_cursor_unref (cursor); } /* Button_press_event handler for the HSV color selector */ @@ -1004,7 +1008,7 @@ paint_ring (GtkHSV *hsv, priv->size - 2 * priv->ring_width + 1, priv->size - 2 * priv->ring_width + 1, 0, 360 * 64); - gdk_gc_unref (gc); + g_object_unref (gc); gdk_gc_set_clip_mask (priv->gc, mask); gdk_gc_set_clip_origin (priv->gc, 0, 0); @@ -1035,7 +1039,7 @@ paint_ring (GtkHSV *hsv, -y + center - sin (priv->h * 2.0 * G_PI) * center); gdk_gc_set_clip_mask (priv->gc, NULL); - gdk_bitmap_unref (mask); + g_object_unref (mask); g_free (buf); @@ -1241,7 +1245,7 @@ paint_triangle (GtkHSV *hsv, points[2].y = y3 - y; gdk_draw_polygon (mask, gc, TRUE, points, 3); - gdk_gc_unref (gc); + g_object_unref (gc); gdk_gc_set_clip_mask (priv->gc, mask); gdk_gc_set_clip_origin (priv->gc, 0, 0); @@ -1255,7 +1259,7 @@ paint_triangle (GtkHSV *hsv, x, y); gdk_gc_set_clip_mask (priv->gc, NULL); - gdk_bitmap_unref (mask); + g_object_unref (mask); g_free (buf); @@ -1351,15 +1355,15 @@ gtk_hsv_expose (GtkWidget *widget, dest.x - widget->allocation.x, dest.y - widget->allocation.y, dest.width, dest.height); - gdk_draw_pixmap (widget->window, - priv->gc, - pixmap, - 0, 0, - dest.x, - dest.y, - event->area.width, event->area.height); + gdk_draw_drawable (widget->window, + priv->gc, + pixmap, + 0, 0, + dest.x, + dest.y, + event->area.width, event->area.height); - gdk_pixmap_unref (pixmap); + g_object_unref (pixmap); return FALSE; } @@ -1434,7 +1438,7 @@ gtk_hsv_focus (GtkWidget *widget, GtkWidget* gtk_hsv_new (void) { - return GTK_WIDGET (gtk_type_new (GTK_TYPE_HSV)); + return g_object_new (GTK_TYPE_HSV, NULL); } /** @@ -1467,7 +1471,7 @@ gtk_hsv_set_color (GtkHSV *hsv, priv->s = s; priv->v = v; - gtk_signal_emit (GTK_OBJECT (hsv), hsv_signals[CHANGED]); + g_signal_emit (hsv, hsv_signals[CHANGED], 0); gtk_widget_queue_draw (GTK_WIDGET (hsv)); } diff --git a/gtk/gtkhsv.h b/gtk/gtkhsv.h index 789c742b27..c8dac79569 100644 --- a/gtk/gtkhsv.h +++ b/gtk/gtkhsv.h @@ -38,11 +38,11 @@ extern "C" { #endif #define GTK_TYPE_HSV (gtk_hsv_get_type ()) -#define GTK_HSV(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_HSV, GtkHSV)) -#define GTK_HSV_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_HSV, GtkHSVClass)) -#define GTK_IS_HSV(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_HSV)) -#define GTK_IS_HSV_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HSV)) -#define GTK_HSV_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_HSV, GtkHSVClass)) +#define GTK_HSV(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HSV, GtkHSV)) +#define GTK_HSV_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HSV, GtkHSVClass)) +#define GTK_IS_HSV(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HSV)) +#define GTK_IS_HSV_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HSV)) +#define GTK_HSV_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HSV, GtkHSVClass)) typedef struct _GtkHSV GtkHSV; @@ -70,7 +70,7 @@ struct _GtkHSVClass }; -GtkType gtk_hsv_get_type (void) G_GNUC_CONST; +GType gtk_hsv_get_type (void) G_GNUC_CONST; GtkWidget* gtk_hsv_new (void); void gtk_hsv_set_color (GtkHSV *hsv, double h, diff --git a/gtk/gtktooltips.c b/gtk/gtktooltips.c index 41cfae5e29..f301651305 100644 --- a/gtk/gtktooltips.c +++ b/gtk/gtktooltips.c @@ -34,7 +34,6 @@ #include "gtkprivate.h" #include "gtkwidget.h" #include "gtkwindow.h" -#include "gtksignal.h" #include "gtkstyle.h" #include "gtktooltips.h" @@ -69,26 +68,28 @@ static gboolean get_keyboard_mode (GtkWidget *widget); static GtkObjectClass *parent_class; static const gchar *tooltips_data_key = "_GtkTooltipsData"; -GtkType +GType gtk_tooltips_get_type (void) { - static GtkType tooltips_type = 0; + static GType tooltips_type = 0; if (!tooltips_type) { - static const GtkTypeInfo tooltips_info = + static const GTypeInfo tooltips_info = { - "GtkTooltips", - sizeof (GtkTooltips), sizeof (GtkTooltipsClass), - (GtkClassInitFunc) gtk_tooltips_class_init, - (GtkObjectInitFunc) gtk_tooltips_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_tooltips_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkTooltips), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_tooltips_init, }; - tooltips_type = gtk_type_unique (GTK_TYPE_OBJECT, &tooltips_info); + tooltips_type = g_type_register_static (GTK_TYPE_OBJECT, "GtkTooltips", + &tooltips_info, 0); } return tooltips_type; @@ -100,7 +101,8 @@ gtk_tooltips_class_init (GtkTooltipsClass *class) GtkObjectClass *object_class; object_class = (GtkObjectClass*) class; - parent_class = gtk_type_class (GTK_TYPE_OBJECT); + + parent_class = g_type_class_peek_parent (class); object_class->destroy = gtk_tooltips_destroy; } @@ -123,7 +125,7 @@ gtk_tooltips_init (GtkTooltips *tooltips) GtkTooltips * gtk_tooltips_new (void) { - return gtk_type_new (GTK_TYPE_TOOLTIPS); + return g_object_new (GTK_TYPE_TOOLTIPS, NULL); } static void @@ -131,10 +133,19 @@ gtk_tooltips_destroy_data (GtkTooltipsData *tooltipsdata) { g_free (tooltipsdata->tip_text); g_free (tooltipsdata->tip_private); - gtk_signal_disconnect_by_data (GTK_OBJECT (tooltipsdata->widget), - (gpointer) tooltipsdata); - gtk_object_remove_data (GTK_OBJECT (tooltipsdata->widget), tooltips_data_key); - gtk_widget_unref (tooltipsdata->widget); + + g_signal_handlers_disconnect_by_func (tooltipsdata->widget, + gtk_tooltips_event_handler, + tooltipsdata); + g_signal_handlers_disconnect_by_func (tooltipsdata->widget, + gtk_tooltips_widget_unmap, + tooltipsdata); + g_signal_handlers_disconnect_by_func (tooltipsdata->widget, + gtk_tooltips_widget_remove, + tooltipsdata); + + g_object_set_data (G_OBJECT (tooltipsdata->widget), tooltips_data_key, NULL); + g_object_unref (tooltipsdata->widget); g_free (tooltipsdata); } @@ -179,14 +190,13 @@ gtk_tooltips_force_window (GtkTooltips *tooltips) gtk_window_set_screen (GTK_WINDOW (tooltips->tip_window), gtk_widget_get_screen (tooltips->active_tips_data->widget)); gtk_widget_set_app_paintable (tooltips->tip_window, TRUE); - gtk_window_set_policy (GTK_WINDOW (tooltips->tip_window), FALSE, FALSE, TRUE); gtk_widget_set_name (tooltips->tip_window, "gtk-tooltips"); gtk_container_set_border_width (GTK_CONTAINER (tooltips->tip_window), 4); - gtk_signal_connect_object (GTK_OBJECT (tooltips->tip_window), - "expose_event", - GTK_SIGNAL_FUNC (gtk_tooltips_paint_window), - GTK_OBJECT (tooltips)); + g_signal_connect_swapped (tooltips->tip_window, + "expose_event", + G_CALLBACK (gtk_tooltips_paint_window), + tooltips); tooltips->tip_label = gtk_label_new (NULL); gtk_label_set_line_wrap (GTK_LABEL (tooltips->tip_label), TRUE); @@ -195,10 +205,10 @@ gtk_tooltips_force_window (GtkTooltips *tooltips) gtk_container_add (GTK_CONTAINER (tooltips->tip_window), tooltips->tip_label); - gtk_signal_connect (GTK_OBJECT (tooltips->tip_window), - "destroy", - GTK_SIGNAL_FUNC (gtk_widget_destroyed), - &tooltips->tip_window); + g_signal_connect (tooltips->tip_window, + "destroy", + G_CALLBACK (gtk_widget_destroyed), + &tooltips->tip_window); } } @@ -234,7 +244,7 @@ gtk_tooltips_data_get (GtkWidget *widget) { g_return_val_if_fail (widget != NULL, NULL); - return gtk_object_get_data ((GtkObject*) widget, tooltips_data_key); + return g_object_get_data (G_OBJECT (widget), tooltips_data_key); } void @@ -271,7 +281,7 @@ gtk_tooltips_set_tip (GtkTooltips *tooltips, } else { - gtk_widget_ref (widget); + g_object_ref (widget); if (tooltipsdata) gtk_tooltips_widget_remove (tooltipsdata->widget, tooltipsdata); @@ -286,24 +296,24 @@ gtk_tooltips_set_tip (GtkTooltips *tooltips, tooltips->tips_data_list = g_list_append (tooltips->tips_data_list, tooltipsdata); - gtk_signal_connect_after (GTK_OBJECT (widget), "event-after", - (GtkSignalFunc) gtk_tooltips_event_handler, - tooltipsdata); + g_signal_connect_after (widget, "event-after", + G_CALLBACK (gtk_tooltips_event_handler), + tooltipsdata); - gtk_object_set_data (GTK_OBJECT (widget), tooltips_data_key, - tooltipsdata); + g_object_set_data (G_OBJECT (widget), tooltips_data_key, + tooltipsdata); - gtk_signal_connect (GTK_OBJECT (widget), "unmap", - (GtkSignalFunc) gtk_tooltips_widget_unmap, - tooltipsdata); + g_signal_connect (widget, "unmap", + G_CALLBACK (gtk_tooltips_widget_unmap), + tooltipsdata); - gtk_signal_connect (GTK_OBJECT (widget), "unrealize", - (GtkSignalFunc) gtk_tooltips_widget_unmap, - tooltipsdata); + g_signal_connect (widget, "unrealize", + G_CALLBACK (gtk_tooltips_widget_unmap), + tooltipsdata); - gtk_signal_connect (GTK_OBJECT (widget), "destroy", - (GtkSignalFunc) gtk_tooltips_widget_remove, - tooltipsdata); + g_signal_connect (widget, "destroy", + G_CALLBACK (gtk_tooltips_widget_remove), + tooltipsdata); } } diff --git a/gtk/gtktooltips.h b/gtk/gtktooltips.h index 49973f6f59..bd0b404771 100644 --- a/gtk/gtktooltips.h +++ b/gtk/gtktooltips.h @@ -36,11 +36,11 @@ extern "C" { #define GTK_TYPE_TOOLTIPS (gtk_tooltips_get_type ()) -#define GTK_TOOLTIPS(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_TOOLTIPS, GtkTooltips)) -#define GTK_TOOLTIPS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_TOOLTIPS, GtkTooltipsClass)) -#define GTK_IS_TOOLTIPS(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_TOOLTIPS)) -#define GTK_IS_TOOLTIPS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TOOLTIPS)) -#define GTK_TOOLTIPS_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_TOOLTIPS, GtkTooltipsClass)) +#define GTK_TOOLTIPS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TOOLTIPS, GtkTooltips)) +#define GTK_TOOLTIPS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TOOLTIPS, GtkTooltipsClass)) +#define GTK_IS_TOOLTIPS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TOOLTIPS)) +#define GTK_IS_TOOLTIPS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TOOLTIPS)) +#define GTK_TOOLTIPS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TOOLTIPS, GtkTooltipsClass)) typedef struct _GtkTooltips GtkTooltips; @@ -83,7 +83,7 @@ struct _GtkTooltipsClass void (*_gtk_reserved4) (void); }; -GtkType gtk_tooltips_get_type (void) G_GNUC_CONST; +GType gtk_tooltips_get_type (void) G_GNUC_CONST; GtkTooltips* gtk_tooltips_new (void); void gtk_tooltips_enable (GtkTooltips *tooltips); |