nautilus/test/test-nautilus-wrap-table.c
Darin Adler 136742e4ef Because lots of recent bugs were due to "signal handler called after
* Tons of files:
	Because lots of recent bugs were due to "signal handler called after
	object gone" problems, switched many calls of g_signal_connect and
	g_signal_connect_swapped to use g_signal_connect_object instead.
	Also did other signal-related cleanup and changed some destroys to
	finalizes.

	* libnautilus/nautilus-view-standard-main.h:
	We no longer need to include nautilus-view.h in here. So include it
	in the files that use this instead.

	Did merges from stable branch:

	2001-10-25  Darin Adler  <darin@bentspoon.com>

        * libnautilus-private/nautilus-directory.c:
        (call_files_changed_common), (call_files_changed_free_list),
        (call_files_changed_unref_free_list),
        (nautilus_directory_notify_files_changed): Move call to
        nautilus_directory_add_file_to_work_queue into a better
        bottleneck; now it catches all the notify cases, not just changed.
        Also tell it to re-get top-left text and link info too when we get
        a changed notice.

        * src/file-manager/fm-directory-view.c: (queue_pending_files):
        Don't use the timeout (and the hysteresis) when queuing files once
        the initial directory load is complete. Doing this was causing
        delays processing changes that came in later, which we don't want.

        * src/nautilus-sidebar-title.c: (item_count_ready), (monitor_add),
	(update_all), (nautilus_sidebar_title_set_file): Monitor the
	directory count once we get it the first time. This makes sure
	that changes in the directory count get reflected in the sidebar
	without creating a race with the main view to see who calculates
	it first.

	2001-10-25  Alex Larsson  <alexl@redhat.com>

        * libnautilus-private/nautilus-directory.c
	(nautilus_directory_notify_files_changed): Call
	nautilus_directory_add_file_to_work_queue() when file_info is
	invalidated.  Otherwise it will not be read again.
2002-03-07 19:36:18 +00:00

99 lines
2.5 KiB
C

#include "test.h"
#include <eel/eel-wrap-table.h>
#include <eel/eel-labeled-image.h>
#include <libnautilus-private/nautilus-customization-data.h>
#include <libnautilus-private/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 = eel_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);
#if 0
/* 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.
*/
g_signal_connect (GTK_BIN (scroller->child),
"realize",
remove_default_viewport_shadow,
NULL);
#endif
/* 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) {
g_object_unref (pixbuf);
g_free (label);
g_free (emblem_name);
continue;
}
button = eel_labeled_image_check_button_new (label, pixbuf);
g_free (label);
g_object_unref (pixbuf);
/* Attach parameters and signal handler. */
g_object_set_data_full (G_OBJECT (button),
"nautilus_property_name",
emblem_name,
(GDestroyNotify) g_free);
gtk_container_add (GTK_CONTAINER (emblems_table), button);
}
gtk_widget_show_all (emblems_table);
gtk_widget_show (window);
gtk_main ();
return 0;
}