3 #include <eel/eel-wrap-table.h>
4 #include <eel/eel-labeled-image.h>
5 #include <libnautilus-private/nautilus-customization-data.h>
6 #include <libnautilus-private/nautilus-icon-info.h>
9 main (int argc
, char* argv
[])
11 NautilusCustomizationData
*customization_data
;
13 GtkWidget
*emblems_table
, *button
, *scroller
;
14 char *emblem_name
, *dot_pos
;
18 test_init (&argc
, &argv
);
20 window
= test_window_new ("Wrap Table Test", 10);
22 gtk_window_set_default_size (GTK_WINDOW (window
), 400, 300);
24 /* The emblems wrapped table */
25 emblems_table
= eel_wrap_table_new (TRUE
);
27 gtk_widget_show (emblems_table
);
28 gtk_container_set_border_width (GTK_CONTAINER (emblems_table
), GNOME_PAD
);
30 scroller
= gtk_scrolled_window_new (NULL
, NULL
);
31 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroller
),
33 GTK_POLICY_AUTOMATIC
);
36 gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scroller
),
39 gtk_container_add (GTK_CONTAINER (window
), scroller
);
41 gtk_widget_show (scroller
);
44 /* Get rid of default lowered shadow appearance.
45 * This must be done after the widget is realized, due to
46 * an apparent bug in gtk_viewport_set_shadow_type.
48 g_signal_connect (GTK_BIN (scroller
->child
),
50 remove_default_viewport_shadow
,
55 /* Use nautilus_customization to make the emblem widgets */
56 customization_data
= nautilus_customization_data_new ("emblems", TRUE
,
57 NAUTILUS_ICON_SIZE_SMALL
,
58 NAUTILUS_ICON_SIZE_SMALL
);
60 while (nautilus_customization_data_get_next_element_for_display (customization_data
,
63 &label
) == GNOME_VFS_OK
) {
65 /* strip the suffix, if any */
66 dot_pos
= strrchr(emblem_name
, '.');
71 if (strcmp (emblem_name
, "erase") == 0) {
72 g_object_unref (pixbuf
);
78 button
= eel_labeled_image_check_button_new (label
, pixbuf
);
80 g_object_unref (pixbuf
);
82 /* Attach parameters and signal handler. */
83 g_object_set_data_full (G_OBJECT (button
),
84 "nautilus_property_name",
86 (GDestroyNotify
) g_free
);
88 gtk_container_add (GTK_CONTAINER (emblems_table
), button
);
91 gtk_widget_show_all (emblems_table
);
93 gtk_widget_show (window
);