summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRamiro Estrugo <ramiro@src.gnome.org>2001-02-12 06:16:48 +0000
committerRamiro Estrugo <ramiro@src.gnome.org>2001-02-12 06:16:48 +0000
commitf34f72958180b0d20b0ff6edc5099b5488931bfd (patch)
tree67a74d9f1ea1eea8b36407b5a326b31ba6189a47 /test
parent24fe2c9cd9455f95697896840a193b200a5ede10 (diff)
downloadnautilus-f34f72958180b0d20b0ff6edc5099b5488931bfd.tar.gz
New NautilusWrapTable test.
* test/.cvsignore: * test/Makefile.am: * test/test-nautilus-wrap-table.c: (main): New NautilusWrapTable test.
Diffstat (limited to 'test')
-rw-r--r--test/.cvsignore3
-rw-r--r--test/Makefile.am8
-rw-r--r--test/test-nautilus-wrap-table.c97
3 files changed, 104 insertions, 4 deletions
diff --git a/test/.cvsignore b/test/.cvsignore
index 3a3c9e4bb..a65fe4fd3 100644
--- a/test/.cvsignore
+++ b/test/.cvsignore
@@ -11,10 +11,10 @@ test-nautilus-font
test-nautilus-font-picker
test-nautilus-font-simple
test-nautilus-image
-test-nautilus-image-table
test-nautilus-image-background
test-nautilus-image-scrolled
test-nautilus-image-simple
+test-nautilus-image-table
test-nautilus-image-tile
test-nautilus-label
test-nautilus-label-background
@@ -33,4 +33,5 @@ test-nautilus-preferences-change
test-nautilus-preferences-display
test-nautilus-smooth-graphics
test-nautilus-widgets
+test-nautilus-wrap-table
test-nautilus-wrapped-label
diff --git a/test/Makefile.am b/test/Makefile.am
index 4a27d2ac3..66af2532f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -31,16 +31,16 @@ LDADD =\
noinst_PROGRAMS =\
test-nautilus-async-activation \
test-nautilus-background \
+ test-nautilus-clickable-image \
test-nautilus-font \
test-nautilus-font-picker \
test-nautilus-font-simple \
test-nautilus-image \
test-nautilus-image-background \
- test-nautilus-clickable-image \
test-nautilus-image-scrolled \
test-nautilus-image-simple \
- test-nautilus-image-tile \
test-nautilus-image-table \
+ test-nautilus-image-tile \
test-nautilus-label \
test-nautilus-label-background \
test-nautilus-label-flavorful \
@@ -57,6 +57,7 @@ noinst_PROGRAMS =\
test-nautilus-preferences-display \
test-nautilus-smooth-graphics \
test-nautilus-widgets \
+ test-nautilus-wrap-table \
$(NULL)
test_nautilus_async_activation_SOURCES = test-nautilus-async-activation.c
@@ -67,9 +68,9 @@ test_nautilus_font_picker_SOURCES = test-nautilus-font-picker.c
test_nautilus_font_simple_SOURCES = test-nautilus-font-simple.c test.c
test_nautilus_image_SOURCES = test-nautilus-image.c
test_nautilus_image_background_SOURCES = test-nautilus-image-background.c test.c
-test_nautilus_image_table_SOURCES = test-nautilus-image-table.c test.c
test_nautilus_image_scrolled_SOURCES = test-nautilus-image-scrolled.c test.c
test_nautilus_image_simple_SOURCES = test-nautilus-image-simple.c
+test_nautilus_image_table_SOURCES = test-nautilus-image-table.c test.c
test_nautilus_image_tile_SOURCES = test-nautilus-image-tile.c test.c
test_nautilus_label_SOURCES = test-nautilus-label.c
test_nautilus_label_background_SOURCES = test-nautilus-label-background.c test.c
@@ -87,6 +88,7 @@ test_nautilus_preferences_change_SOURCES = test-nautilus-preferences-change.c te
test_nautilus_preferences_display_SOURCES = test-nautilus-preferences-display.c test.c
test_nautilus_smooth_graphics_SOURCES = test-nautilus-smooth-graphics.c
test_nautilus_widgets_SOURCES = test-nautilus-widgets.c
+test_nautilus_wrap_table_SOURCES = test-nautilus-wrap-table.c test.c
EXTRA_DIST = \
test.h \
diff --git a/test/test-nautilus-wrap-table.c b/test/test-nautilus-wrap-table.c
new file mode 100644
index 000000000..e55c36598
--- /dev/null
+++ b/test/test-nautilus-wrap-table.c
@@ -0,0 +1,97 @@
+#include "test.h"
+
+#include <libnautilus-extensions/nautilus-wrap-table.h>
+#include <libnautilus-extensions/nautilus-viewport.h>
+#include <libnautilus-extensions/nautilus-labeled-image.h>
+#include <libnautilus-extensions/nautilus-customization-data.h>
+#include <libnautilus-extensions/nautilus-icon-factory.h>
+
+int
+main (int argc, char* argv[])
+{
+ NautilusCustomizationData *customization_data;
+ GtkWidget *window;
+ GtkWidget *emblems_table, *button, *scroller;
+ char *emblem_name, *dot_pos;
+ GdkPixbuf *pixbuf;
+ char *label;
+
+ test_init (&argc, &argv);
+
+ window = test_window_new ("Wrap Table Test", 10);
+
+ gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
+
+ /* The emblems wrapped table */
+ emblems_table = nautilus_wrap_table_new (TRUE);
+
+ gtk_widget_show (emblems_table);
+ gtk_container_set_border_width (GTK_CONTAINER (emblems_table), GNOME_PAD);
+
+ scroller = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroller),
+ GTK_POLICY_NEVER,
+ GTK_POLICY_AUTOMATIC);
+
+ /* Viewport */
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scroller),
+ emblems_table);
+
+ gtk_container_add (GTK_CONTAINER (window), scroller);
+
+ gtk_widget_show (scroller);
+
+ /* Get rid of default lowered shadow appearance.
+ * This must be done after the widget is realized, due to
+ * an apparent bug in gtk_viewport_set_shadow_type.
+ */
+// gtk_signal_connect (GTK_OBJECT (GTK_BIN (scroller)->child),
+// "realize",
+// remove_default_viewport_shadow,
+// NULL);
+
+
+ /* Use nautilus_customization to make the emblem widgets */
+ customization_data = nautilus_customization_data_new ("emblems", TRUE, TRUE,
+ NAUTILUS_ICON_SIZE_SMALL,
+ NAUTILUS_ICON_SIZE_SMALL);
+
+ while (nautilus_customization_data_get_next_element_for_display (customization_data,
+ &emblem_name,
+ &pixbuf,
+ &label) == GNOME_VFS_OK) {
+
+ /* strip the suffix, if any */
+ dot_pos = strrchr(emblem_name, '.');
+ if (dot_pos) {
+ *dot_pos = '\0';
+ }
+
+ if (strcmp (emblem_name, "erase") == 0) {
+ gdk_pixbuf_unref (pixbuf);
+ g_free (label);
+ g_free (emblem_name);
+ continue;
+ }
+
+ button = nautilus_labeled_image_check_button_new (label, pixbuf);
+ g_free (label);
+ gdk_pixbuf_unref (pixbuf);
+
+ /* Attach parameters and signal handler. */
+ gtk_object_set_data_full (GTK_OBJECT (button),
+ "nautilus_property_name",
+ emblem_name,
+ g_free);
+
+ gtk_container_add (GTK_CONTAINER (emblems_table), button);
+ }
+
+ gtk_widget_show_all (emblems_table);
+
+ gtk_widget_show (window);
+
+ gtk_main ();
+
+ return 0;
+}