diff options
author | Ramiro Estrugo <ramiro@src.gnome.org> | 2001-02-01 10:24:58 +0000 |
---|---|---|
committer | Ramiro Estrugo <ramiro@src.gnome.org> | 2001-02-01 10:24:58 +0000 |
commit | 33f219c3e08f31fb1489af13247c25d1cb9b3e91 (patch) | |
tree | d068ba79078140299f7f6c374cbc01eab12fad62 /test/test-nautilus-labeled-image.c | |
parent | 93ea1a9d6190670f9566001502d0d0fbb3a02ede (diff) | |
download | nautilus-33f219c3e08f31fb1489af13247c25d1cb9b3e91.tar.gz |
reviewed by: Pavel Cisler <pavel@eazel.com>
* libnautilus-extensions/Makefile.am:
New files.
* libnautilus-extensions/nautilus-art-extensions.c:
(nautilus_art_irect_align):
* libnautilus-extensions/nautilus-art-extensions.h:
Make the align function actually work. The previous version was
copied from GtkPixmap and i didnt realize it did not work. Remove
the padding parameters which are not really needed for alignment.
* libnautilus-extensions/nautilus-clickable-image.h:
* libnautilus-extensions/nautilus-clickable-image.c:
New class. A clickable image.
* libnautilus-extensions/nautilus-labeled-image.h:
* libnautilus-extensions/nautilus-labeled-image.c:
New class. A labeled image.
* libnautilus-extensions/nautilus-image.h:
* libnautilus-extensions/nautilus-image.c:
(nautilus_image_expose_event), (image_get_pixbuf_bounds),
(image_is_smooth), (nautilus_image_set_is_smooth),
(nautilus_image_get_is_smooth), (nautilus_image_new_solid),
(nautilus_image_set_never_smooth):
Add never smooth attribute to force behavior to match GTK+ for
cases when consistency is most important.
Update for alignment art extensions api change.
Some minor paramter name changes to lose abbreviations.
* libnautilus-extensions/nautilus-label.h:
* libnautilus-extensions/nautilus-label.c:
(nautilus_label_size_request), (nautilus_label_expose_event),
(label_get_text_bounds), (label_is_smooth),
(nautilus_label_set_is_smooth), (nautilus_label_get_is_smooth),
(nautilus_label_new_solid), (nautilus_label_set_never_smooth):
Add never smooth attribute to force behavior to match GTK+ for
cases when consistency is most important.
Update for alignment art extensions api change.
Update for alignment art extensions api change.
Some minor paramter name changes to lose abbreviations.
* libnautilus-extensions/nautilus-smooth-widget.c:
(smooth_widget_get_tile_origin_point),
(nautilus_smooth_widget_get_preferred_frame):
Add some comments explaining why using 0 for ancestor offsets
works.
Fix a really dumb bug, the paddings where multiplies by 2 twice
instead of once.
* test/.cvsignore:
* test/Makefile.am:
* test/test-nautilus-clickable-image.c: (clicked_callback),
(enter_callback), (leave_callback), (clickable_image_new), (main):
* test/test-nautilus-label-background.c:
* test/test-nautilus-label-scrolled.c: (label_window_new_scrolled),
(label_window_new_table):
* test/test-nautilus-label-simple.c: (main):
* test/test-nautilus-label.c: (main):
* test/test-nautilus-labeled-image.c: (labeled_image_new),
(labeled_image_window_new), (labeled_image_button_window_new),
(main):
* test/test-nautilus-pixbuf-tile.c:
(pixbuf_drawing_area_expose_event),
(drawable_drawing_area_expose_event), (main):
* test/test-nautilus-preferences-change.c: (main):
* test/test.c: (test_init):
New tests for clickable and labeled images. Many updates to other
tests.
Also, changed many instances of NautilusFooDetail to
NautilusFooDetails as well as the corresponding members.
Diffstat (limited to 'test/test-nautilus-labeled-image.c')
-rw-r--r-- | test/test-nautilus-labeled-image.c | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/test/test-nautilus-labeled-image.c b/test/test-nautilus-labeled-image.c new file mode 100644 index 000000000..3eb2420bd --- /dev/null +++ b/test/test-nautilus-labeled-image.c @@ -0,0 +1,101 @@ +#include "test.h" + +#include <libnautilus-extensions/nautilus-labeled-image.h> + + +static const char pixbuf_name[] = "/usr/share/pixmaps/gnome-globe.png"; +static const char tile_name[] = "/gnome/share/nautilus/patterns/camouflage.png"; + +static GtkWidget * +labeled_image_new (const char *text, + GdkPixbuf *pixbuf, + const char *tile_file_name) +{ + GtkWidget *labeled_image; + + labeled_image = nautilus_labeled_image_new (text, pixbuf); + + if (tile_file_name != NULL) { + nautilus_labeled_image_set_tile_pixbuf_from_file_name (NAUTILUS_LABELED_IMAGE (labeled_image), + tile_file_name); + } + + return labeled_image; +} + +static GtkWidget * +labeled_image_window_new (const char *title, + GdkPixbuf *pixbuf, + const char *tile_file_name) +{ + GtkWidget *window; + GtkWidget *vbox; + GtkWidget *labeled_image; + GtkWidget *tiled_labeled_image; + + window = test_window_new (title, 20); + vbox = gtk_vbox_new (FALSE, 10); + gtk_container_add (GTK_CONTAINER (window), vbox); + + labeled_image = labeled_image_new ("Labeled Image", pixbuf, NULL); + tiled_labeled_image = labeled_image_new ("Labeled Image", pixbuf, tile_file_name); + if (tile_file_name != NULL) { + nautilus_labeled_image_set_fill (NAUTILUS_LABELED_IMAGE (tiled_labeled_image), TRUE); + } + if (labeled_image) gtk_box_pack_start (GTK_BOX (vbox), labeled_image, TRUE, TRUE, 0); + if (tiled_labeled_image) gtk_box_pack_start (GTK_BOX (vbox), tiled_labeled_image, TRUE, TRUE, 0); + + gtk_widget_show_all (vbox); + + return window; +} + +static GtkWidget * +labeled_image_button_window_new (const char *title, + GdkPixbuf *pixbuf) +{ + GtkWidget *window; + GtkWidget *vbox; + GtkWidget *button; + GtkWidget *toggle_button; + GtkWidget *check_button; + + window = test_window_new (title, 20); + vbox = gtk_vbox_new (FALSE, 10); + gtk_container_add (GTK_CONTAINER (window), vbox); + + if (1) button = nautilus_labeled_image_button_new ("GtkButton with LabeledImage", pixbuf); + if (1) toggle_button = nautilus_labeled_image_toggle_button_new ("GtkToggleButton with LabeledImage", pixbuf); + if (1) check_button = nautilus_labeled_image_check_button_new ("GtkCheckButton with LabeledImage", pixbuf); + + if (button) gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0); + if (toggle_button) gtk_box_pack_start (GTK_BOX (vbox), toggle_button, TRUE, TRUE, 0); + if (check_button) gtk_box_pack_start (GTK_BOX (vbox), check_button, TRUE, TRUE, 0); + + gtk_widget_show_all (vbox); + + return window; +} + +int +main (int argc, char* argv[]) +{ + GtkWidget *labeled_image_window = NULL; + GtkWidget *labeled_image_button_window = NULL; + GdkPixbuf *pixbuf = NULL; + + test_init (&argc, &argv); + + if (1) pixbuf = test_pixbuf_new_named (pixbuf_name, 1.0); + if (1) labeled_image_window = labeled_image_window_new ("LabeledImage Test", pixbuf, tile_name); + if (1) labeled_image_button_window = labeled_image_button_window_new ("LabeledImage in GtkButton Test", pixbuf); + + nautilus_gdk_pixbuf_unref_if_not_null (pixbuf); + + if (labeled_image_window) gtk_widget_show (labeled_image_window); + if (labeled_image_button_window) gtk_widget_show (labeled_image_button_window); + + gtk_main (); + + return 0; +} |