diff --git a/gtk/gtkiconview.h b/gtk/gtkiconview.h index 6f1b2ea775..56fccfc3d4 100644 --- a/gtk/gtkiconview.h +++ b/gtk/gtkiconview.h @@ -33,14 +33,9 @@ G_BEGIN_DECLS #define GTK_TYPE_ICON_VIEW (gtk_icon_view_get_type ()) #define GTK_ICON_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ICON_VIEW, GtkIconView)) -#define GTK_ICON_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ICON_VIEW, GtkIconViewClass)) #define GTK_IS_ICON_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_VIEW)) -#define GTK_IS_ICON_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ICON_VIEW)) -#define GTK_ICON_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ICON_VIEW, GtkIconViewClass)) typedef struct _GtkIconView GtkIconView; -typedef struct _GtkIconViewClass GtkIconViewClass; -typedef struct _GtkIconViewPrivate GtkIconViewPrivate; /** * GtkIconViewForeachFunc: @@ -76,39 +71,6 @@ typedef enum GTK_ICON_VIEW_DROP_BELOW } GtkIconViewDropPosition; -struct _GtkIconView -{ - GtkContainer parent; - - /*< private >*/ - GtkIconViewPrivate *priv; -}; - -struct _GtkIconViewClass -{ - GtkContainerClass parent_class; - - void (* item_activated) (GtkIconView *icon_view, - GtkTreePath *path); - void (* selection_changed) (GtkIconView *icon_view); - - /* Key binding signals */ - void (* select_all) (GtkIconView *icon_view); - void (* unselect_all) (GtkIconView *icon_view); - void (* select_cursor_item) (GtkIconView *icon_view); - void (* toggle_cursor_item) (GtkIconView *icon_view); - gboolean (* move_cursor) (GtkIconView *icon_view, - GtkMovementStep step, - gint count); - gboolean (* activate_cursor_item) (GtkIconView *icon_view); - - /* Padding for future expansion */ - void (*_gtk_reserved1) (void); - void (*_gtk_reserved2) (void); - void (*_gtk_reserved3) (void); - void (*_gtk_reserved4) (void); -}; - GDK_AVAILABLE_IN_ALL GType gtk_icon_view_get_type (void) G_GNUC_CONST; GDK_AVAILABLE_IN_ALL diff --git a/testsuite/gtk/cellarea.c b/testsuite/gtk/cellarea.c index a80f40caea..4a7595ef11 100644 --- a/testsuite/gtk/cellarea.c +++ b/testsuite/gtk/cellarea.c @@ -75,117 +75,6 @@ test_iconview_object_new (void) g_object_unref (view); } -typedef GtkIconView MyIconView; -typedef GtkIconViewClass MyIconViewClass; - -GType my_icon_view_get_type (void); - -G_DEFINE_TYPE (MyIconView, my_icon_view, GTK_TYPE_ICON_VIEW) - -static void -my_icon_view_class_init (MyIconViewClass *klass) -{ -} - -static gint subclass_init; - -static void -my_icon_view_init (MyIconView *view) -{ - GtkCellArea *area; - - if (subclass_init == 0) - { - /* do nothing to area */ - } - else if (subclass_init == 1) - { - area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view)); - g_assert (GTK_IS_CELL_AREA_BOX (area)); - g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_VERTICAL); - gtk_orientable_set_orientation (GTK_ORIENTABLE (area), GTK_ORIENTATION_HORIZONTAL); - } -} - -/* test that an iconview subclass has an area */ -static void -test_iconview_subclass0 (void) -{ - GtkWidget *view; - GtkCellArea *area; - - subclass_init = 0; - - view = g_object_new (my_icon_view_get_type (), NULL); - area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view)); - g_assert (GTK_IS_CELL_AREA_BOX (area)); - g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_VERTICAL); - - g_object_ref_sink (view); - g_object_unref (view); -} - -/* test that an iconview subclass keeps the provided area */ -static void -test_iconview_subclass1 (void) -{ - GtkWidget *view; - GtkCellArea *area; - - subclass_init = 0; - - area = gtk_cell_area_box_new (); - view = g_object_new (my_icon_view_get_type (), "cell-area", area, NULL); - g_assert (area == gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view))); - g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_VERTICAL); - - g_object_ref_sink (view); - g_object_unref (view); -} - -/* test we can access the area in subclass init */ -static void -test_iconview_subclass2 (void) -{ - GtkWidget *view; - GtkCellArea *area; - - subclass_init = 1; - - view = g_object_new (my_icon_view_get_type (), NULL); - area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view)); - g_assert (GTK_IS_CELL_AREA_BOX (area)); - g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_HORIZONTAL); - - g_object_ref_sink (view); - g_object_unref (view); -} - -static void -test_iconview_subclass3_subprocess (void) -{ - GtkWidget *view; - GtkCellArea *area; - - subclass_init = 1; - - area = gtk_cell_area_box_new (); - view = g_object_new (my_icon_view_get_type (), "cell-area", area, NULL); - g_assert (area == gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view))); - g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_VERTICAL); - g_object_ref_sink (view); - g_object_unref (view); -} - -/* test we get a warning if an area is provided, but ignored */ -static void -test_iconview_subclass3 (void) -{ - g_test_trap_subprocess ("/tests/iconview-subclass3/subprocess", 0, 0); - g_test_trap_assert_failed (); - g_test_trap_assert_stderr ("*ignoring construct property*"); -} - /* test that we have a cell area after new() */ static void test_combobox_new (void) @@ -202,6 +91,8 @@ test_combobox_new (void) g_object_unref (view); } +static int subclass_init; + typedef GtkComboBox MyComboBox; typedef GtkComboBoxClass MyComboBoxClass; @@ -530,11 +421,6 @@ main (int argc, char *argv[]) g_test_add_func ("/tests/iconview-new", test_iconview_new); g_test_add_func ("/tests/iconview-new-with-area", test_iconview_new_with_area); g_test_add_func ("/tests/iconview-object-new", test_iconview_object_new); - g_test_add_func ("/tests/iconview-subclass0", test_iconview_subclass0); - g_test_add_func ("/tests/iconview-subclass1", test_iconview_subclass1); - g_test_add_func ("/tests/iconview-subclass2", test_iconview_subclass2); - g_test_add_func ("/tests/iconview-subclass3", test_iconview_subclass3); - g_test_add_func ("/tests/iconview-subclass3/subprocess", test_iconview_subclass3_subprocess); g_test_add_func ("/tests/combobox-new", test_combobox_new); g_test_add_func ("/tests/combobox-subclass0", test_combobox_subclass0);